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ICAgICAgICAgImNvbS5hbmRyb2lkLmJsdWV0b290aC51cGRhdGFibGUiLAorICAgICAgICAgICAgICAgICJjb20uYW5kcm9pZC5tZWRpYSIsCisgICAgICAgICAgICAgICAgImNvbS5hbmRyb2lkLm1lZGlhLnN3Y29kZWMiLAorICAgICAgICAgICAgXSwKKyAgICAgICAgfSwKKyAgICB9LAorfQorCitjY19saWJyYXJ5X2hlYWRlcnMgeworICAgIG5hbWU6ICJhdi1oZWFkZXJzIiwKKyAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUiXSwKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAiYXYtdHlwZXMtYWlkbC1jcHAiLAorICAgIF0sCisgICAgZXhwb3J0X3N0YXRpY19saWJfaGVhZGVyczogWworICAgICAgICAiYXYtdHlwZXMtYWlkbC1jcHAiLAorICAgIF0sCisgICAgaGVhZGVyX2xpYnM6IFsKKyAgICAgICAgImxpYmF1ZGlvY2xpZW50X2FpZGxfY29udmVyc2lvbl91dGlsIiwKKyAgICBdLAorICAgIGV4cG9ydF9oZWFkZXJfbGliX2hlYWRlcnM6IFsKKyAgICAgICAgImxpYmF1ZGlvY2xpZW50X2FpZGxfY29udmVyc2lvbl91dGlsIiwKKyAgICBdLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIHZlbmRvcl9hdmFpbGFibGU6IHRydWUsCisgICAgZG91YmxlX2xvYWRhYmxlOiB0cnVlLAorICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKKyAgICBhcGV4X2F2YWlsYWJsZTogWworICAgICAgICAiLy9hcGV4X2F2YWlsYWJsZTpwbGF0Zm9ybSIsCisgICAgICAgICJjb20uYW5kcm9pZC5ibHVldG9vdGgudXBkYXRhYmxlIiwKKyAgICAgICAgImNvbS5hbmRyb2lkLm1lZGlhIiwKKyAgICAgICAgImNvbS5hbmRyb2lkLm1lZGlhLnN3Y29kZWMiLAorICAgIF0sCisgICAgdGFyZ2V0O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4wCisgICAgZGVmYXVsdF9hcHBsaWNhYmxlX2xpY2Vuc2VzOiBbImZyYW1ld29ya3NfYXZfbGljZW5zZSJdLAorfQorCiBhcGV4X2RlZmF1bHRzIHsKICAgICBuYW1lOiAiY29tLmFuZHJvaWQubWVkaWEtZGVmYXVsdHMiLAogICAgIHVwZGF0YWJsZTogdHJ1ZSwKLSAgICBqYXZhX2xpYnM6IFsidXBkYXRhYmxlLW1lZGlhIl0sCisgICAgYm9vdGNsYXNzcGF0aF9mcmFnbWVudHM6IFsiY29tLmFuZHJvaWQubWVkaWEtYm9vdGNsYXNzcGF0aC1mcmFnbWVudCJdLAorICAgIHN5c3RlbXNlcnZlcmNsYXNzcGF0aF9mcmFnbWVudHM6IFsiY29tLmFuZHJvaWQubWVkaWEtc3lzdGVtc2VydmVyY2xhc3NwYXRoLWZyYWdtZW50Il0sCiAgICAgbXVsdGlsaWI6IHsKICAgICAgICAgZmlyc3Q6IHsKICAgICAgICAgICAgIC8vIEV4dHJhY3RvciBwcm9jZXNzIHJ1bnMgb25seSB3aXRoIHRoZSBwcmltYXJ5IEFCSS4KQEAgLTMxLDE1ICs0MSwyNSBAQAogICAgICAgICAgICAgICAgICJsaWJtcGVnMmV4dHJhY3RvciIsCiAgICAgICAgICAgICAgICAgImxpYm9nZ2V4dHJhY3RvciIsCiAgICAgICAgICAgICAgICAgImxpYndhdmV4dHJhY3RvciIsCi0gICAgICAgICAgICAgICAgLy8gSk5JCi0gICAgICAgICAgICAgICAgImxpYm1lZGlhcGFyc2VyLWpuaSIKKyAgICAgICAgICAgIF0sCisgICAgICAgICAgICAvLyBUcmFuc2NvZGluZyBzZXJ2aWNlIG9ubHkgcnVuIHdpdGggcHJpbWFyeSBBQkkuCisgICAgICAgICAgICBiaW5hcmllczogWworICAgICAgICAgICAgICAgICJtZWRpYXRyYW5zY29kaW5nIiwKICAgICAgICAgICAgIF0sCiAgICAgICAgIH0sCiAgICAgfSwKKyAgICAvLyBKTkkKKyAgICBuYXRpd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NlIGhhcmR3YXJlOjpJQ2FtZXJhU2VydmljZTo6RVJST1JfQ0FNRVJBX0lOX1VTRToKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUJVU1k7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICBjYXNlIGhhcmR3YXJlOjpJQ2FtZXJhU2VydmljZTo6RVJST1JfSU5WQUxJRF9PUEVSQVRJT046Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgaGFyZHdhcmU6OklDYW1lcmFTZXJ2aWNlOjpFUlJPUl9NQVhfQ0FNRVJBU19JTl9VU0U6Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gLUVVU0VSUzsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgaGFyZHdhcmU6OklDYW1lcmFTZXJ2aWNlOjpFUlJPUl9JTExFR0FMX0FSR1VNRU5UOgotICAgICAgICAgICAgICAgIHN0YXR1cyA9IEJBRF9WQUxVRTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgaGFyZHdhcmU6OklDYW1lcmFTZXJ2aWNlOjpFUlJPUl9ERVBSRUNBVEVEX0hBTDoKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRU9QTk9UU1VQUDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgaGFyZHdhcmU6OklDYW1lcmFTZXJ2aWNlOjpFUlJPUl9ESVNBQkxFRDoKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUFDQ0VTOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBoYXJkd2FyZTo6SUNhbWVyYVNlcnZpY2U6OkVSUk9SX1BFUk1JU1NJT05fREVOSUVEOgotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBFUk1JU1NJT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ZWwiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIGludDY0X3QgdXNhZ2UgPSAwOworICAgIGlmICgoZXJyID0gcGFyY2VsLT5yZWFkSW50NjQoJnVzYWdlKSkgIT0gT0spIHsKKyAgICAgICAgQUxPR0UoIiVzOiBGYWlsZWQgdG8gcmVhZCB1c2FnZSBmcm9tIHBhcmNlbCIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHJldHVybiBlcnI7CisgICAgfQorCisgICAgaW50NjRfdCByZXF1ZXN0Q291bnQgPSAwOworICAgIGlmICgoZXJyID0gcGFyY2VsLT5yZWFkSW50NjQoJnJlcXVlc3RDb3VudCkpICE9IE9LKSB7CisgICAgICAgIEFMT0dFKCIlczogRmFpbGVkIHRvIHJlYWQgcmVxdWVzdCBjb3VudCBmcm9tIHBhcmNlbCIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHJldHVybiBlcnI7CisgICAgfQorCisgICAgaW50NjRfdCBlcnJvckNvdW50ID0gMDsKKyAgICBpZiAoKGVyciA9IHBhcmNlbC0+cmVhZEludDY0KCZlcnJvckNvdW50KSkgIT0gT0spIHsKKyAgICAgICAgQUxPR0UoIiVzOiBGYWlsZWQgdG8gcmVhZCBlcnJvciBjb3VudCBmcm9tIHBhcmNlbCIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHJldHVybiBlcnI7CisgICAgfQorCisgICAgaW50IHN0YXJ0TGF0ZW5jeU1zID0gMDsKKyAgICBpZiAoKGVyciA9IHBhcmNlbC0+cmVhZEludDMyKCZzdGFydExhdGVuY3lNcykpICE9IE9LKSB7CisgICAgICAgIEFMT0dFKCIlczogRmFpbGVkIHRvIHJlYWQgc3RhcnQgbGF0ZW5jeSBmcm9tIHBhcmNlbCIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHJldHVybiBlcnI7CisgICAgfQorCisgICAgaW50IG1heEhhbEJ1ZmZlcnMgPSAwOworICAgIGl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gICBzdGF0dXNfdCBlcnIgPSBPSzsKKworICAgIGlmICgoZXJyID0gcGFyY2VsLT53cml0ZUludDMyKG1XaWR0aCkpICE9IE9LKSB7CisgICAgICAgIEFMT0dFKCIlczogRmFpbGVkIHRvIHdyaXRlIHN0cmVhbSB3aWR0aCEiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIGlmICgoZXJyID0gcGFyY2VsLT53cml0ZUludDMyKG1IZWlnaHQpKSAhPSBPSykgeworICAgICAgICBBTE9HRSgiJXM6IEZhaWxlZCB0byB3cml0ZSBzdHJlYW0gaGVpZ2h0ISIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHJldHVybiBlcnI7CisgICAgfQorCisgICAgaWYgKChlcnIgPSBwYXJjZWwtPndyaXRlSW50MzIobUZvcm1hdCkpICE9IE9LKSB7CisgICAgICAgIEFMT0dFKCIlczogRmFpbGVkIHRvIHdyaXRlIHN0cmVhbSBmb3JtYXQhIiwgX19GVU5DVElPTl9fKTsKKyAgICAgICAgcmV0dXJuIGVycjsKKyAgICB9CisKKyAgICBpZiAoKGVyciA9IHBhcmNlbC0+d3JpdGVJbnQzMihtRGF0YVNwYWNlKSkgIT0gT0spIHsKKyAgICAgICAgQUxPR0UoIiVzOiBGYWlsZWQgdG8gd3JpdGUgc3RyZWFtIGRhdGFTcGFjZSEiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIGlmICgoZXJyID0gcGFyY2VsLT53cml0ZUludDY0KG1Vc2FnZSkpICE9IE9LKSB7CisgICAgICAgIEFMT0dFKCIlczogRmFpbGVkIHRvIHdyaXRlIHN0cmVhbSB1c2FnZSEiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIGlmICgoZXJyID0gcGFyY2VsLT53cml0ZUludDY0KG1SZXF1ZXN0Q291bnQpKSAhPSBPSykgeworICAgICAgICB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TZXNzaW9uU3RhdHM6OkNBTUVSQV9BUElfTEVWRUxfMSA9IDE7Citjb25zdCBpbnQgQ2FtZXJhU2Vzc2lvblN0YXRzOjpDQU1FUkFfQVBJX0xFVkVMXzIgPSAyOworCitDYW1lcmFTZXNzaW9uU3RhdHM6OkNhbWVyYVNlc3Npb25TdGF0cygpIDoKKyAgICAgICAgbUZhY2luZyhDQU1FUkFfRkFDSU5HX0JBQ0spLAorICAgICAgICBtTmV3Q2FtZXJhU3RhdGUoQ0FNRVJBX1NUQVRFX0NMT1NFRCksCisgICAgICAgIG1BcGlMZXZlbCgwKSwKKyAgICAgICAgbUlzTmRrKGZhbHNlKSwKKyAgICAgICAgbUxhdGVuY3lNcygtMSksCisgICAgICAgIG1TZXNzaW9uVHlwZSgwKSwKKyAgICAgICAgbUludGVybmFsUmVjb25maWd1cmUoMCksCisgICAgICAgIG1SZXF1ZXN0Q291bnQoMCksCisgICAgICAgIG1SZXN1bHRFcnJvckNvdW50KDApLAorICAgICAgICBtRGV2aWNlRXJyb3IoZmFsc2UpIHt9CisKK0NhbWVyYVNlc3Npb25TdGF0czo6Q2FtZXJhU2Vzc2lvblN0YXRzKGNvbnN0IFN0cmluZzE2JiBjYW1lcmFJZCwKKyAgICAgICAgaW50IGZhY2luZywgaW50IG5ld0NhbWVyYVN0YXRlLCBjb25zdCBTdHJpbmcxNiYgY2xpZW50TmFtZSwKKyAgICAgICAgaW50IGFwaUxldmVsLCBib29sIGlzTmRrLCBpbnQzMl90IGxhdGVuY3lNcykgOgorICAgICAgICAgICAgICAgIG1DYW1lcmFJZChjYW1lcmFJZCksCisgICAgICAgICAgICAgICAgbUZhY2luZyhmYWNpbmcpLAorICAgICAgICAgICAgICAgIG1OZXdDYW1lcmFTdGF0ZShuZXdDYW1lcmFTdGF0ZSksCisgICAgICAgICAgICAgICAgbUNsaWVudE5hbWUoY2xpZW50TmFtZSksCisgICAgICAgICAgICAgICAgbUFwaUxldmVsKGFwaUxldmVsKSwKKyAgICAgICAgICAgICAgICBtSXNOZGsoaXNOZGspLAorICAgICAgICAgICAgICAgIG1MYXRlbmN5TXMobGF0ZW5jeU1zKSwKKyAgICAgICAgICAgICAgICBtU2Vzc2lvblR5cGUoMCksCisgICAgICAgICAgICAgICAgbUludGVybmFsUmVjb25maWd1cmUoMCksCisgICAgICAgICAgICAgICAgbVJlcXVlc3RDb3VudCgwKSwKKyAgICAgICAgICAgICAgICBtUmVzdWx0RXJyb3JDb3VudCgwKSwKKyAgICAgICAgICAgICAgICBtRGV2aWNlRXJyb3IoMCkge30KKworc3RhdHVzX3QgQ2FtZXJhU2Vzc2lvblN0YXRzOjpyZWFkRnJvbVBhcmNlbChjb25zdCBhbmRyb2lkOjpQYXJjZWwqIHBhcmNlbCkgeworICAgIGlmIChwYXJjZWwgPT0gTlVMTCkgeworICAgICAgICBBTE9HRSgiJXM6IE51bGwgcGFyY2VsIiwgX19GVU5DVElPTl9fKTsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisKKyAgICBzdGF0dXNfdCBlcnIgPSBPSzsKKworICAgIFN0cmluZzE2IGlkOworICAgIGlmICgoZXJyID0gcGFyY2VsLT5yZWFkU3RyaW5nMTYoJmlkKSkgIT0gT0spIHsKKyAgICAgICAgQUxPR0UoIiVzOiBGYWlsZWQgdG8gcmVhZCBjYW1lcmEgaWQhIiwgX19GVU5DVElPTl9fKTsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisKKyAgICBpbnQgZmFjaW5nID0gMDsKKyAgICBpZiAoKGVyciA9IHBhcmNlbC0+cmVhZEludDMyKCZmYWNpbmcpKSAhPSBPSykgeworICAgICAgICBBTE9HRSgiJXM6IEZhaWxlZCB0byByZWFkIGNhbWVyYSBmYWNpbmcgZnJvbSBwYXJjZWwiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIGludDMyX3QgbmV3Q2FtZXJhU3RhdGU7CisgICAg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BwYXJjZWwiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIGludDMyX3Qgc2Vzc2lvblR5cGU7CisgICAgaWYgKChlcnIgPSBwYXJjZWwtPnJlYWRJbnQzMigmc2Vzc2lvblR5cGUpKSAhPSBPSykgeworICAgICAgICBBTE9HRSgiJXM6IEZhaWxlZCB0byByZWFkIHNlc3Npb24gdHlwZSBmcm9tIHBhcmNlbCIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHJldHVybiBlcnI7CisgICAgfQorCisgICAgaW50MzJfdCBpbnRlcm5hbFJlY29uZmlndXJlOworICAgIGlmICgoZXJyID0gcGFyY2VsLT5yZWFkSW50MzIoJmludGVybmFsUmVjb25maWd1cmUpKSAhPSBPSykgeworICAgICAgICBBTE9HRSgiJXM6IEZhaWxlZCB0byByZWFkIGludGVybmFsIHJlY29uZmlndXJlIGNvdW50IGZyb20gcGFyY2VsIiwgX19GVU5DVElPTl9fKTsKKyAgICAgICAgcmV0dXJuIGVycjsKKyAgICB9CisKKyAgICBpbnQ2NF90IHJlcXVlc3RDb3VudDsKKyAgICBpZiAoKGVyciA9IHBhcmNlbC0+cmVhZEludDY0KCZyZXF1ZXN0Q291bnQpKSAhPSBPSykgeworICAgICAgICBBTE9HRSgiJXM6IEZhaWxlZCB0byByZWFkIHJlcXVlc3QgY291bnQgZnJvbSBwYXJjZWwiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIGludDY0X3QgcmVzdWx0RXJyb3JDb3VudDsKKyAgICBpZiAoKGVyciA9IHBhcmNlbC0+cmVhZEludDY0KCZyZXN1bHRFcnJvckNvdW50KSkgIT0gT0spIHsKKyAgICAgICAgQUxPR0UoIiVzOiBGYWlsZWQgdG8gcmVhZCByZXN1bHQgZXJyb3IgY291bnQgZnJvbSBwYXJjZWwiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gZXJyOworIC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1TdGF0cyk7CisKKyAgICByZXR1cm4gT0s7Cit9CisKK3N0YXR1c190IENhbWVyYVNlc3Npb25TdGF0czo6d3JpdGVUb1BhcmNlbChhbmRyb2lkOjpQYXJjZWwqIHBhcmNlbCkgY29uc3QgeworICAgIGlmIChwYXJjZWwgPT0gTlVMTCkgeworICAgICAgICBBTE9HRSgiJXM6IE51bGwgcGFyY2VsIiwgX19GVU5DVElPTl9fKTsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisKKyAgICBzdGF0dXNfdCBlcnIgPSBPSzsKKworICAgIGlmICgoZXJyID0gcGFyY2VsLT53cml0ZVN0cmluZzE2KG1DYW1lcmFJZCkpICE9IE9LKSB7CisgICAgICAgIEFMT0dFKCIlczogRmFpbGVkIHRvIHdyaXRlIGNhbWVyYSBpZCEiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIGlmICgoZXJyID0gcGFyY2VsLT53cml0ZUludDMyKG1GYWNpbmcpKSAhPSBPSykgeworICAgICAgICBBTE9HRSgiJXM6IEZhaWxlZCB0byB3cml0ZSBjYW1lcmEgZmFjaW5nISIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHJldHVybiBlcnI7CisgICAgfQorCisgICAgaWYgKChlcnIgPSBwYXJjZWwtPndyaXRlSW50MzIobU5ld0NhbWVyYVN0YXRlKSkgIT0gT0spIHsKKyAgICAgICAgQUxPR0UoIiVzOiBGYWlsZWQgdG8gd3JpdGUgbmV3IGNhbWVyYSBzdGF0ZSEiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIGlmICgoZXJyID0gcGFyY2VsLT53cml0ZVN0cmluZzE2KG1DbGllbnROYW1lKSkgIT0gT0spIHsKKyAgICAgICAgQUxPR0UoIiVzOiBGYWlsZWQgdG8gd3JpdGUgY2xpZW50IG5hbWUhIiwgX19GVU5DVElPTl9fKTsKKyAgICAgIC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HN0cmVycm9yKC1yZXMpLCByZXMpOwotICAgICAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGQ6OnZlY3Rvcjxuc2Vjc190PiB0aW1lc3RhbXBzOwotICAgICAgICAgICAgc3RkOjp2ZWN0b3I8bmF0aXZlX2hhbmRsZV90Kj4gaGFuZGxlczsKLSAgICAgICAgICAgIHRpbWVzdGFtcHMucmVzZXJ2ZShuKTsKLSAgICAgICAgICAgIGhhbmRsZXMucmVzZXJ2ZShuKTsKLSAgICAgICAgICAgIGZvciAodWludDMyX3QgaSA9IDA7IGkgPCBuOyBpKyspIHsKLSAgICAgICAgICAgICAgICBuc2Vjc190IHQ7Ci0gICAgICAgICAgICAgICAgcmVzID0gZGF0YS5yZWFkSW50NjQoJnQpOwotICAgICAgICAgICAgICAgIGlmIChyZXMgIT0gT0spIHsKLSAgICAgICAgICAgICAgICAgICAgQUxPR0UoIiVzOiBGYWlsZWQgdG8gcmVhZCB0aW1lc3RhbXBbJWRdOiAlcyAoJWQpIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX0ZVTkNUSU9OX18sIGksIHN0cmVycm9yKC1yZXMpLCByZXMpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB0aW1lc3RhbXBzLnB1c2hfYmFjayh0KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZvciAodWludDMyX3QgaSA9IDA7IGkgPCBuOyBpKyspIHsKLSAgICAgICAgICAgICAgICBuYXRpdmVfaGFuZGxlX3QqIGhhbmRsZSA9IGRhdGEucmVhZE5hdGl2ZUhhbmRsZSgpOwotICAgICAgICAgICAgICAgIGlmIChoYW5kbGUgPT0gbnVsbHB0cikgewotICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXM6IFJlY2VpdmVkIGEgbnVsbCBuYXRpdmUgaG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uc3QgU3RyaW5nMTYmIGNsaWVudFBhY2thZ2VOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgY2xpZW50VWlkLCBpbnQgY2xpZW50UGlkKTsKLQotICAgIHN0YXRpYyAgc3RhdHVzX3QgIGNvbm5lY3RMZWdhY3koaW50IGNhbWVyYUlkLCBpbnQgaGFsVmVyc2lvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTdHJpbmcxNiYgY2xpZW50UGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNsaWVudFVpZCwgc3A8Q2FtZXJhPiYgY2FtZXJhKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNsaWVudFVpZCwgaW50IGNsaWVudFBpZCwgaW50IHRhcmdldFNka1ZlcnNpb24pOwogCiAgICAgICAgICAgICB2aXJ0dWFsICAgICB+Q2FtZXJhKCk7CiAKQEAgLTE1NCw3ICsxNDksNiBAQAogICAgICAgICAgICAgc3RhdHVzX3QgICAgc2V0VmlkZW9UYXJnZXQoY29uc3Qgc3A8SUdyYXBoaWNCdWZmZXJQcm9kdWNlcj4mIGJ1ZmZlclByb2R1Y2VyKTsKIAogICAgICAgICAgICAgdm9pZCAgICAgICAgc2V0TGlzdGVuZXIoY29uc3Qgc3A8Q2FtZXJhTGlzdGVuZXI+JiBsaXN0ZW5lcik7Ci0gICAgICAgICAgICB2b2lkICAgICAgICBzZXRSZWNvcmRpbmdQcm94eUxpc3RlbmVyKGNvbnN0IHNwPElDYW1lcmFSZWNvcmRpbmdQcm94eUxpc3RlbmVyPiYgbGlzdGVuZXIpOwogCiAgICAgICAgICAgICAvLyBDb25maWd1cmUgcHJldmlldyBjYWxsYmFja3MgdG8gYXBwLiBPbmx5IG9uZSBvZiB0aGUgb2xkZXIKICAgICAgICAgICAgIC8vIGNhbGxiYWNrcyBvciB0aGUgY2FsbGJhY2sg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aGVyLm1PcGVyYXRpbmdNb2RlKTsKKyAgICAgICAgICAgICAgICBtT3BlcmF0aW5nTW9kZSA9PSBvdGhlci5tT3BlcmF0aW5nTW9kZSAmJgorICAgICAgICAgICAgICAgIG1JbnB1dElzTXVsdGlSZXNvbHV0aW9uID09IG90aGVyLm1JbnB1dElzTXVsdGlSZXNvbHV0aW9uKTsKICAgICB9CiAKICAgICBib29sIG9wZXJhdG9yICE9IChjb25zdCBTZXNzaW9uQ29uZmlndXJhdGlvbiYgb3RoZXIpIGNvbnN0IHsKQEAgLTgzLDYgKzg1LDEwIEBACiAgICAgICAgICAgICByZXR1cm4gbUlucHV0Rm9ybWF0IDwgb3RoZXIubUlucHV0Rm9ybWF0OwogICAgICAgICB9CiAKKyAgICAgICAgaWYgKG1JbnB1dElzTXVsdGlSZXNvbHV0aW9uICE9IG90aGVyLm1JbnB1dElzTXVsdGlSZXNvbHV0aW9uKSB7CisgICAgICAgICAgICByZXR1cm4gbUlucHV0SXNNdWx0aVJlc29sdXRpb24gPCBvdGhlci5tSW5wdXRJc011bHRpUmVzb2x1dGlvbjsKKyAgICAgICAgfQorCiAgICAgICAgIGlmIChtT3BlcmF0aW5nTW9kZSAhPSBvdGhlci5tT3BlcmF0aW5nTW9kZSkgewogICAgICAgICAgICAgcmV0dXJuIG1PcGVyYXRpbmdNb2RlIDwgb3RoZXIubU9wZXJhdGluZ01vZGU7CiAgICAgICAgIH0KQEAgLTEwNCw2ICsxMTAsNyBAQAogCiAgICAgc3RkOjp2ZWN0b3I8T3V0cHV0Q29uZmlndXJhdGlvbj4gbU91dHB1dFN0cmVhbXM7CiAgICAgaW50ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUlucHV0V2lkdGgsIG1JbnB1dEhlaWdodCwgbUlucHV0Rm9ybWF0LCBtT3BlcmF0aW5nTW9kZTsKKyAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW5wdXRJc011bHRpUmVzb2x1dGlvbiA9IGZhbHNl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VUNFRF9JTigyOSk7CiAKIC8qKgotICogQ2hlY2sgd2hldGhlciBhIHBhcnRpY3VsYXIge0BBQ2FwdHVyZVNlc3Npb25PdXRwdXRDb250YWluZXJ9IGlzIHN1cHBvcnRlZCBieQorICogQ2hlY2sgd2hldGhlciBhIHBhcnRpY3VsYXIge0BsaW5rIEFDYXB0dXJlU2Vzc2lvbk91dHB1dENvbnRhaW5lcn0gaXMgc3VwcG9ydGVkIGJ5CiAgKiB0aGUgY2FtZXJhIGRldmljZS4KICAqCiAgKiA8cD5UaGlzIG1ldGhvZCBwZXJmb3JtcyBhIHJ1bnRpbWUgY2hlY2sgb2YgYSBnaXZlbiB7QGxpbmsKQEAgLTg4NSwxMyArODg1LDEyIEBACiAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZS48L2xpPgogICogICAgICAgIDxsaT57QGxpbmsgQUNBTUVSQV9FUlJPUl9VTlNVUFBPUlRFRF9PUEVSQVRJT059IGlmIHRoZSBxdWVyeSBvcGVyYXRpb24gaXMgbm90CiAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VwcG9ydGVkIGJ5IHRoZSBjYW1lcmEgZGV2aWNlLjwvbGk+CisgKiAgICAgICAgPC91bD4KICAqLwogY2FtZXJhX3N0YXR1c190IEFDYW1lcmFEZXZpY2VfaXNTZXNzaW9uQ29uZmlndXJhdGlvblN1cHBvcnRlZCgKICAgICAgICAgY29uc3QgQUNhbWVyYURldmljZSogZGV2aWNlLAogICAgICAgICBjb25zdCBBQ2FwdHVyZVNlc3Npb25PdXRwdXRDb250YWluZXIqIHNlc3Npb25PdXRwdXRDb250YWluZXIpIF9fSU5UUk9EVUNFRF9JTigyOSk7CiAKLSNlbmRpZiAvKiBfX0FORFJPSURfQVBJX18gPj0gMjkgKi8KLQogX19FTkRfREVDTFMKIAogI2VuZGlmIC8qIF9OREtfQ0FNR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7PSBhY3RpdmVBcnJheVNpemUKKyAgICAgKiBZVVZfNDIwXzg4OCAgICB8IEFDQU1FUkFfU0VOU09SX0lORk9fQUNUSVZFX0FSUkFZX1NJWkUgICAgICAgICAgfCBGVUxMICAgICAgICAgICB8CisgICAgICogWVVWXzQyMF84ODggICAgfCAxOTIweDEwODAgKDEwODBwKSAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IEZVTEwgICAgICAgICAgIHwgaWYgMTA4MHAgJmx0Oz0gYWN0aXZlQXJyYXlTaXplCisgICAgICogWVVWXzQyMF84ODggICAgfCAxMjgweDcyMCAoNzIwKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IEZVTEwgICAgICAgICAgIHwgaWYgNzIwcCAmbHQ7PSBhY3RpdmVBcnJheVNpemUKKyAgICAgKiBZVVZfNDIwXzg4OCAgICB8IDY0MHg0ODAgKDQ4MHApICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgRlVMTCAgICAgICAgICAgfCBpZiA0ODBwICZsdDs9IGFjdGl2ZUFycmF5U2l6ZQorICAgICAqIFlVVl80MjBfODg4ICAgIHwgMzIweDI0MCAoMjQwcCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBGVUxMICAgICAgICAgICB8IGlmIDI0MHAgJmx0Oz0gYWN0aXZlQXJyYXlTaXplCisgICAgICogWVVWXzQyMF84ODggICAgfCBhbGwgb3V0cHV0IHNpemVzIGF2YWlsYWJsZSBmb3IgRlVMTCBoYXJkd2FyZSBsZXZlbCwgdXAgdG8gdGhlIG1heGltdW0gdmlkZW8gc2l6ZSB8IExJTUlURUQgICAgICAgIHwKKyAgICAgKiBJTVBMRU1FTlRBVElPTl9ERUZJTkVEIHwgc2FtZSBhcyBZVVZfNDIwXzg4OCAgICAgICAgICAgICAgICAgIHwgQW55ICAgICAgICAgICAgfDwvcD4KKyAgICAgKiA8cD5Gb3IgYXBwbGljYXRpb25zIHRhcmdldGluZyBTREsgdmVyc2lvbiAzMSBv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U19NQVhJTVVNX1JFU09MVVRJT04KK3R5cGVkZWYgZW51bSBhY2FtZXJhX21ldGFkYXRhX2VudW1fYWNhbWVyYV9zY2FsZXJfYXZhaWxhYmxlX3N0cmVhbV9jb25maWd1cmF0aW9uc19tYXhpbXVtX3Jlc29sdXRpb24geworICAgIEFDQU1FUkFfU0NBTEVSX0FWQUlMQUJMRV9TVFJFQU1fQ09ORklHVVJBVElPTlNfTUFYSU1VTV9SRVNPTFVUSU9OX09VVFBVVAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMCwKKworICAgIEFDQU1FUkFfU0NBTEVSX0FWQUlMQUJMRV9TVFJFQU1fQ09ORklHVVJBVElPTlNfTUFYSU1VTV9SRVNPTFVUSU9OX0lOUFVUCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPSAxLAorCit9IGFjYW1lcmFfbWV0YWRhdGFfZW51bV9hbmRyb2lkX3NjYWxlcl9hdmFpbGFibGVfc3RyZWFtX2NvbmZpZ3VyYXRpb25zX21heGltdW1fcmVzb2x1dGlvbl90OworCisvLyBBQ0FNRVJBX1NDQUxFUl9NVUxUSV9SRVNPTFVUSU9OX1NUUkVBTV9TVVBQT1JURUQKK3R5cGVkZWYgZW51bSBhY2FtZXJhX21ldGFkYXRhX2VudW1fYWNhbWVyYV9zY2FsZXJfbXVsdGlfcmVzb2x1dGlvbl9zdHJlYW1fc3VwcG9ydGVkIHsKKyAgICBBQ0FNRVJBX1NDQUxFUl9NVUxUSV9SRVNPTFVUSU9OX1NUUkVBTV9TVVBQT1JURURfRkFMU0UgICAgICAgICAgID0gMCwKKworICAgIEFDQU1FUkFfU0NBTEVSX01VTFRJX1JFU09MVVRJT05fU1RSRUFNX1NVUFBPUlRFRF9UUlVFICAgICAgICAgICAgPSAxLAorCit9IGFjYW1lcmFfbWV0YWRhdGF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QUlMQUJMRV9ERVBUSF9TVFJFQU1fQ09ORklHVVJBVElPTlNfTUFYSU1VTV9SRVNPTFVUSU9OX09VVFBVVAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMCwKKworICAgIEFDQU1FUkFfREVQVEhfQVZBSUxBQkxFX0RFUFRIX1NUUkVBTV9DT05GSUdVUkFUSU9OU19NQVhJTVVNX1JFU09MVVRJT05fSU5QVVQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IDEsCisKK30gYWNhbWVyYV9tZXRhZGF0YV9lbnVtX2FuZHJvaWRfZGVwdGhfYXZhaWxhYmxlX2RlcHRoX3N0cmVhbV9jb25maWd1cmF0aW9uc19tYXhpbXVtX3Jlc29sdXRpb25fdDsKKworLy8gQUNBTUVSQV9ERVBUSF9BVkFJTEFCTEVfRFlOQU1JQ19ERVBUSF9TVFJFQU1fQ09ORklHVVJBVElPTlNfTUFYSU1VTV9SRVNPTFVUSU9OCit0eXBlZGVmIGVudW0gYWNhbWVyYV9tZXRhZGF0YV9lbnVtX2FjYW1lcmFfZGVwdGhfYXZhaWxhYmxlX2R5bmFtaWNfZGVwdGhfc3RyZWFtX2NvbmZpZ3VyYXRpb25zX21heGltdW1fcmVzb2x1dGlvbiB7CisgICAgQUNBTUVSQV9ERVBUSF9BVkFJTEFCTEVfRFlOQU1JQ19ERVBUSF9TVFJFQU1fQ09ORklHVVJBVElPTlNfTUFYSU1VTV9SRVNPTFVUSU9OX09VVFBVVAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMCwKKworICAgIEFDQU1FUkFfREVQVEhfQVZBSUxBQkxFX0RZTkFNSUNfREVQVEhfU1RSRUFNX0NPTkZJR1VSQVRJT05TX01BWElNVU1fUkVTT0xVVElPT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ICAgLyp0YXJnZXRTZGtWZXJzaW9uKi9fX0FORFJPSURfQVBJX0ZVVFVSRV9fLCAvKm91dCovJmRldmljZSk7CiAgICAgICAgIEVYUEVDVF9UUlVFKHJlcy5pc09rKCkpIDw8IHJlczsKICAgICAgICAgQVNTRVJUX05FKG51bGxwdHIsIGRldmljZS5nZXQoKSk7CiAgICAgICAgIGRldmljZS0+ZGlzY29ubmVjdCgpOwpAQCAtNDIxLDggKzQyMiw4IEBACiAgICAgICAgIHsKICAgICAgICAgICAgIFNDT1BFRF9UUkFDRSgib3Blbk5ld0RldmljZSIpOwogICAgICAgICAgICAgYmluZGVyOjpTdGF0dXMgcmVzID0gc2VydmljZS0+Y29ubmVjdERldmljZShjYWxsYmFja3MsIGRldmljZUlkLCBTdHJpbmcxNigibWVlZWVlZWVlZSEiKSwKLSAgICAgICAgICAgICAgICAgICAgc3RkOjp1bmlxdWVfcHRyPFN0cmluZzE2PigpLCBoYXJkd2FyZTo6SUNhbWVyYVNlcnZpY2U6OlVTRV9DQUxMSU5HX1VJRCwKLSAgICAgICAgICAgICAgICAgICAgLypvdXQqLyZkZXZpY2UpOworICAgICAgICAgICAgICAgICAgICB7fSwgaGFyZHdhcmU6OklDYW1lcmFTZXJ2aWNlOjpVU0VfQ0FMTElOR19VSUQsIC8qb29tU2NvcmVPZmZzZXQqLyAwLAorICAgICAgICAgICAgICAgICAgICAvKnRhcmdldFNka1ZlcnNpb24qL19fQU5EUk9JRF9BUElfRlVUVVJFX18sIC8qb3V0Ki8mZGV2aWNlKTsKICAgICAgICAgICAgIEVYUEVDVF9UUlVFKHJlcy5pc09rKCkpIDw8IHJlczsKICAgICAgICAgfQogICAgICAgICBhdXRvIHAgPSBzdGQ6Om1ha2VfcGFpcihjYWxsYmFja3MsIGRldmljZSk7CkBAIC01MTcsNyArNTE4LDcgQEAKICAgICAgICAgQ2FtZXJhTWV0YWRhdGEgc2Vzc2lvblBhcmFtczsKICAgICAgICAgc3RkOjp2ZWN0b3I8aW50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IAogICAgIFJldHVybjx2b2lkPiBoUmVzdWx0OwogCisgICAgbUxvY2sudW5sb2NrKCk7CiAgICAgaWYgKG1QbHVnaW5WMV8yICE9IE5VTEwpIHsKICAgICAgICAgaFJlc3VsdCA9IG1QbHVnaW5WMV8yLT5kZWNyeXB0XzFfMihzZWN1cmUsIHRvSGlkbEFycmF5MTYoa2V5SWQpLCB0b0hpZGxBcnJheTE2KGl2KSwKICAgICAgICAgICAgICAgICBoTW9kZSwgaFBhdHRlcm4sIGhTdWJTYW1wbGVzLCBoU291cmNlLCBvZmZzZXQsIGhEZXN0aW5hdGlvbiwKQEAgLTM4NCw3ICszNTIsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZXNXcml0dGVuID0gaEJ5dGVzV3JpdHRlbjsKICAgICAgICAgICAgICAgICAgICAgICAgICplcnJvckRldGFpbE1zZyA9IHRvU3RyaW5nOChoRGV0YWlsZWRFcnJvcik7CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZXJyID0gdG9TdGF0dXNUXzFfMihzdGF0dXMpOworICAgICAgICAgICAgICAgICAgICBlcnIgPSB0b1N0YXR1c1Qoc3RhdHVzKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICApOwogICAgIH0gZWxzZSB7CkBAIC00MTQsNyArMzgyLDggQEAKICAgICAgICAgcmV0dXJuOwogICAgIH0KIAotICAgIG1QbHVnaW4tPm5vdGlmeVJlc29sdXRpb24od2lkdGgsIGhlaWdodCk7CisgICAgYXV0byBoUmVzdWx0ID0gbVBsdWdpbi0+bm90aWZ5UmVzb2x1dGlvbih3aWR0aCwgaGVpZ2h0KTsKKyAgICBBTE9HRV9JRighaFJlc3VsdC5pc09rKCksICJub3RpZnlSZXNvbHV0aW9uIHR4biBmYWlsZWQgJXMiLCBoUmVzdWx0LmRlc2NyaXB0aW9uKCkuY19zdHIoKSk7CiB9CiAKIHN0YXR1c190IENyeXB0b0hhbDo6c2V0TWVk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y2FzdEZyb20obVBsdWdpbik7CiAgICAgICAgICAgICAgICAgbVBsdWdpblYxXzIgPSBkcm06OlYxXzI6OklEcm1QbHVnaW46OmNhc3RGcm9tKG1QbHVnaW4pOworICAgICAgICAgICAgICAgIG1QbHVnaW5WMV80ID0gZHJtOjpWMV80OjpJRHJtUGx1Z2luOjpjYXN0RnJvbShtUGx1Z2luKTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KIAogICAgIGlmIChtUGx1Z2luID09IE5VTEwpIHsKKyAgICAgICAgRHJtVXRpbHM6OkxPRzJCRSh1dWlkLCAiTm8gc3VwcG9ydGVkIGhhbCBpbnN0YW5jZSBmb3VuZCIpOwogICAgICAgICBtSW5pdENoZWNrID0gRVJST1JfVU5TVVBQT1JURUQ7CiAgICAgfSBlbHNlIHsKICAgICAgICAgbUluaXRDaGVjayA9IE9LOwpAQCAtNjQyLDYgKzU5Myw3IEBACiAgICAgICAgICAgICBtUGx1Z2luLmNsZWFyKCk7CiAgICAgICAgICAgICBtUGx1Z2luVjFfMS5jbGVhcigpOwogICAgICAgICAgICAgbVBsdWdpblYxXzIuY2xlYXIoKTsKKyAgICAgICAgICAgIG1QbHVnaW5WMV80LmNsZWFyKCk7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTgyMiw3ICs3NzQsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFVybCA9IHRvU3RyaW5nOChoRGVmYXVsdFVybCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAqa2V5UmVxdWVzdFR5cGUgPSB0b0tleVJlcXVlc3RUeXBlXzFfMShoS2V5UmVxdWVzdFR5cGUpOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGVyciA9IHRvU3RhdHVzVF8xXzIoc3RhdHVzKTsKKyAgICAgICAgICAgICAgICAgICAgZXJyID0gdG9TdGF0dXNUKHN0YXR1cyk7CiAgICAgICAgICAgICAgICAgfSk7CiAgICAgfSBlbHNlIGlmIChtUGx1Z2luVjFfMSAhPSBOVUxMKSB7CiAgICAgICAgIGhSZXN1bHQgPSBtUGx1Z2luVjFfMS0+Z2V0S2V5UmVxdWVzdF8xXzEoCkBAIC05MzYsNyArODg4LDcgQEAKICAgICBSZXR1cm48dm9pZD4gaFJlc3VsdDsKIAogICAgIGlmIChtUGx1Z2luVjFfMiAhPSBOVUxMKSB7Ci0gICAgICAgIFJldHVybjx2b2lkPiBoUmVzdWx0ID0gbVBsdWdpblYxXzItPmdldFByb3Zpc2lvblJlcXVlc3RfMV8yKAorICAgICAgICBoUmVzdWx0ID0gbVBsdWdpblYxXzItPmdldFByb3Zpc2lvblJlcXVlc3RfMV8yKAogICAgICAgICAgICAgICAgIHRvSGlkbFN0cmluZyhjZXJ0VHlwZSksIHRvSGlkbFN0cmluZyhjZXJ0QXV0aG9yaXR5KSwKICAgICAgICAgICAgICAgICBbJl0oU3RhdHVzX1YxXzIgc3RhdHVzLCBjb25zdCBoaWRsX3ZlYzx1aW50OF90PiYgaFJlcXVlc3QsCiAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBoaWRsX3N0cmluZyYgaERlZmF1bHRVcmwpIHsKQEAgLTk0NCwxMSArODk2LDExIEBACiAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0ID0gdG9WZWN0b3IoaFJlcXVlc3QpOwogICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFVybCA9IHRvU3RyaW5nOChoRGVmYXVsdFVybCk7CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZXJyID0gdG9TdGF0dXNUXzFfMihzdGF0dXMpOworICAgICAgICAgICAgICAgICAgICBlcnIgPSB0b1N0YXR1c1Qoc3RhdHVzKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICApOwogICAgIH0gZWxzZSB7Ci0gICAgICAgIFJldHVybjx2b2lkPiBoUmVzdWx0ID0gbV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JuYWwoU3RyaW5nOCgidmVuZG9yIiksIHZlbmRvcikgPT0gT0sgJiYKICAgICAgICAgICAgIGdldFByb3BlcnR5U3RyaW5nSW50ZXJuYWwoU3RyaW5nOCgiZGVzY3JpcHRpb24iKSwgZGVzY3JpcHRpb24pID09IE9LICYmCiAgICAgICAgICAgICBnZXRQcm9wZXJ0eUJ5dGVBcnJheUludGVybmFsKFN0cmluZzgoIm1ldHJpY3MiKSwgbWV0cmljc1ZlY3RvcikgPT0gT0spIHsKLSAgICAgICAgc3RkOjpzdHJpbmcgbWV0cmljc1N0cmluZyA9IHRvQmFzZTY0U3RyaW5nTm9QYWQobWV0cmljc1ZlY3Rvci5hcnJheSgpLAorICAgICAgICBtZXRyaWNzU3RyaW5nID0gdG9CYXNlNjRTdHJpbmdOb1BhZChtZXRyaWNzVmVjdG9yLmFycmF5KCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldHJpY3NWZWN0b3Iuc2l6ZSgpKTsKICAgICAgICAgc3RhdHVzX3QgcmVzID0gYW5kcm9pZDo6cmVwb3J0RHJtUGx1Z2luTWV0cmljcyhtZXRyaWNzU3RyaW5nLCB2ZW5kb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb24sIG1NZXRyaWNzLkdldEFwcFVpZCgpKTsKQEAgLTE1NjIsNiArMTUxOSw1NSBAQAogICAgICAgICAgICAgQUxPR0UoIk1ldHJpY3Mgd2VyZSByZXRyaWV2ZWQgYnV0IGNvdWxkIG5vdCBiZSByZXBvcnRlZDogJWQiLCByZXMpOwogICAgICAgICB9CiAgICAgfQorICAgIHJldHVybiBtZXRyaWNzU3RyaW5nOworfQorCitzdGF0dXNfdCBEcm1IYWw6OnJlcXVpcmVzU2VjdXJlRGVjb2Rlcihjb25zdCBjaGFyICptaW1lLCBib29sICpyZXF1aXJlZCkgY29uc3QgeworIC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E1ha2VEcm1QbHVnaW4oY29uc3Qgc3A8OjpWMV8wOjpJRHJtRmFjdG9yeT4gJmZhY3RvcnksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCB1dWlkWzE2XSwgY29uc3QgY2hhciAqYXBwUGFja2FnZU5hbWUpIHsKICAgICBzcDw6OlYxXzA6OklEcm1QbHVnaW4+IHBsdWdpbjsKLSAgICBmYWN0b3J5LT5jcmVhdGVQbHVnaW4odG9IaWRsQXJyYXkxNih1dWlkKSwgaGlkbF9zdHJpbmcoYXBwUGFja2FnZU5hbWUpLAotICAgICAgICAgICAgICAgICAgICAgICAgICBbJl0oOjpWMV8wOjpTdGF0dXMgc3RhdHVzLCBjb25zdCBzcDw6OlYxXzA6OklEcm1QbHVnaW4+ICZoUGx1Z2luKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzICE9IDo6VjFfMDo6U3RhdHVzOjpPSykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsdWdpbiA9IGhQbHVnaW47Ci0gICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwotICAgIHJldHVybiBwbHVnaW47CisgICAgYXV0byBlcnIgPSBmYWN0b3J5LT5jcmVhdGVQbHVnaW4oCisgICAgICAgICAgICB0b0hpZGxBcnJheTE2KHV1aWQpLCBoaWRsX3N0cmluZyhhcHBQYWNrYWdlTmFtZSksCisgICAgICAgICAgICBbJl0oOjpWMV8wOjpTdGF0dXMgc3RhdHVzLCBjb25zdCBzcDw6OlYxXzA6OklEcm1QbHVnaW4+ICZoUGx1Z2luKSB7CisgICAgICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSA6OlYxXzA6OlN0YXR1czo6T0spIHsKKyAgICAgICAgICAgICAgICAgICAgTE9HMkJFKHV1aWQsICJNYWtlRHJtUGx1Z2luIGZhaWxlZDogJWQiLCBzdGF0dXMpOworICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHBsdWdpbiA9IGhQbHVnaW47CisgICAgICAgICAgICB9KTsKKyAgICBpZiAoZXJyLmlzT2soKSkgeworICAgICAgICByZXR1cm4gcGx1Z2luOworICAgIH0gZWxzZSB7CisgICAgICAgIExPRzJCRSh1dWlkLCAiTWFrZURybVBsdWdpbiB0eG4gZmFpbGVkOiAlcyIsIGVyci5kZXNjcmlwdGlvbigpLmNfc3RyKCkpOworICAgICAgICByZXR1cm4gbnVsbHB0cjsKKyAgICB9CiB9CiAKIHNwPDo6VjFfMDo6SUNyeXB0b1BsdWdpbj4gTWFrZUNyeXB0b1BsdWdpbihjb25zdCBzcDw6OlYxXzA6OklDcnlwdG9GYWN0b3J5PiAmZmFjdG9yeSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90IHV1aWRbMTZdLCBjb25zdCB2b2lkICppbml0RGF0YSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgaW5pdERhdGFTaXplKSB7CiAgICAgc3A8OjpWMV8wOjpJQ3J5cHRvUGx1Z2luPiBwbHVnaW47Ci0gICAgZmFjdG9yeS0+Y3JlYXRlUGx1Z2luKHRvSGlkbEFycmF5MTYodXVpZCksIHRvSGlkbFZlYyhpbml0RGF0YSwgaW5pdERhdGFTaXplKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgWyZdKDo6VjFfMDo6U3RhdHVzIHN0YXR1cywgY29uc3Qgc3A8OjpWMV8wOjpJQ3J5cHRvUGx1Z2luPiAmaFBsdWdpbikgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSA6OlYxXzA6OlN0YXR1czo6T0spIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbHVnaW4gPSBoUGx1Z2luOwotICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKLSAgICByZXR1cm4gcGx1Z2luOworICAgIGF1dG8gZXJyID0gZmFjdG9yeS0+Y3JlYXRlUGx1Z2luKAorICAgICAgICAgICAgdG9IaWRsQXJyYXkxNih1dWlkKSwgdG9IaWRsVmVjKGluaXREYXRhLCBpbml0RGF0YVNpemUpLAorICAgICAgICAgICAgWyZdKDo6VjFfMDo6U3RhdHVzIHN0YXR1cywgY29uc3Qgc3A8OjpWMV8wOjpJQ3J5cHRvUGx1Z2luPiAmaFBsdWdpbikgeworICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gOjpWMV8wOjpTdGF0dXM6Ok9LKSB7CisgICAgICAgICAgICAgICAgICAgIExPRzJCRSh1dWlkLCAiTWFrZUNyeXB0b1BsdWdpbiBmYWlsZWQ6ICVkIiwgc3RhdHVzKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBwbHVnaW4gPSBoUGx1Z2luOworICAgICAgICAgICAgfSk7CisgICAgaWYgKGVyci5pc09rKCkpIHsKKyAgICAgICAgcmV0dXJuIHBsdWdpbjsKKyAgICB9IGVsc2UgeworICAgICAgICBMT0cyQkUodXVpZCwgIk1ha2VDcnlwdG9QbHVnaW4gdHhuIGZhaWxlZDogJXMiLCBlcnIuZGVzY3JpcHRpb24oKS5jX3N0cigpKTsKKyAgICAgICAgcmV0dXJuIG51bGxwdHI7CisgICAgfQogfQogCiB9IC8vIG5hbWVzcGFjZQpAQCAtMTQzLDEwICsxNzgsMTUgQEAKIAogc3RkOjp2ZWN0b3I8c3A8OjpWMV8wOjpJRHJtRmFjdG9yeT4+IE1ha2VEcm1GYWN0b3JpZXMoY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DT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgorICogU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAorICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKgorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKiBPcmlnaW5hbGx5IGRldmVsb3BlZCBhbmQgY29udHJpYnV0ZWQgYnkgSXR0aWFtIFN5c3RlbXMgUHZ0LiBMdGQsIEJhbmdhbG9yZQorICovCisKK3BhY2thZ2UgeworICAgIC8vIFNlZTogaHR0cDovL2dvL2FuZHJvaWQtbGljZW5zZS1mYXEKKyAgICAvLyBBIGxhcmdlLXNjYWxlLWNoYW5nZSBhZGRlZCAnZGVmYXVsdF9hcHBsaWNhYmxlX2xpY2Vuc2VzJyB0byBpbXBvcnQKKyAgICAvLyBhbGwgb2YgdGhlICdsaWNlbnNlX2tpbmRzJyBmcm9tICJmcmFtZXdvcmtzX2F2X2xpY2Vuc2UiCisgICAgLy8gdG8gZ2V0IHRoZSBiZWxvdyBsaWNlbnNlIGtpbmRzOgorICAgIC8vICAgU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMAorICAgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWyJmcmFtZXdvcmtzX2F2X2xpY2Vuc2UiXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogIm1lZGlhZHJtX2Z1enplciIsCisgICAgc3JjczogWworICAgICAgICAibWVkaWFkcm1fZnV6emVyLmNwcCIsCisgICAgXSwKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGlibWVkaWFkcm0iLAorICAgICAgICAibGlibG9nIiwKKyAgICAgICAgInJlc291cmNlbWFuYWdlcl9haWRsX2ludGVyZmFjZS1uZGtfcGxhdGZvcm0iLAorICAgIF0sCisgICAgaGVhZGVyX2xpYnM6IFsKKyAgICAgICAgImxpYm1lZGlhX2hlYWRlcnMiLAorICAgICAgICAibGlibWVkaWFkcm1faGVhZGVycyIsCisgICAgXSwKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGliYmluZGVyIiwKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICAgICAgImxpYmJpbmRlcl9uZGsiLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICAgICAgImxpYmRsIiwKKyAgICAgICAgImxpYm1lZGlhIiwKKyAgICAgICAgImxpYm1lZGlhZHJtbWV0cmljc19saXRlIiwKKyAgICAgICAgImxpYm1lZGlhbWV0cmljcyMxIiwKKyAgICAgICAgImxpYm1lZGlhdXRpbHMiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZm91bmRhdGlvbiIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmRybUAxLjAiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5kcm1AMS4xIiwKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuZHJtQDEuMiIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmRybUAxLjMiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5kcm1AMS40IiwKKyAgICAgICAgImxpYmhpZGxhbGxvY2F0b3J1dGlscyIsCisgICAgICAgICJsaWJoaWRsYmFzZSIsCisgICAgXSwKKyAgICBmdXp6X2NvbmZpZzogeworICAgICAgICBjYzogWworICAgICAgICAgICAgImFuZHJvaWQtbWVkaWEtZnV6emluZy1yZXBvcnRzQGdvb2dsZS5jb20iLAorICAgICAgICBdLAorICAgICAgICBjb21wb25lbnRpZDogMTU1Mjc2LAorICAgIH0sCit9CmRpZmYgLS1naXQgYS9kcm0vbGlibWVkaWFkcm0vZnV6emVyL1JFQURNRS5tZCBiL2RybS9saWJtZWRpYWRyb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worI2RlZmluZSBBRVNfQkxPQ0tfU0laRSAxNgorI2RlZmluZSBVTlVTRURfUEFSQU0gX19hdHRyaWJ1dGVfXygodW51c2VkKSkKKwordXNpbmcgbmFtZXNwYWNlIHN0ZDsKK3VzaW5nIG5hbWVzcGFjZSBhbmRyb2lkOwordXNpbmcgYW5kcm9pZDo6aGFyZHdhcmU6OmZyb21IZWFwOwordXNpbmcgOjphbmRyb2lkOjpvczo6UGVyc2lzdGFibGVCdW5kbGU7Cit1c2luZyBkcm06OlYxXzA6OkJ1ZmZlclR5cGU7CisKK2VudW0geworICAgIElOVkFMSURfVVVJRCA9IDAsCisgICAgUFNTSF9CT1hfVVVJRCwKKyAgICBDTEVBUktFWV9VVUlELAorfTsKKworc3RhdGljIGNvbnN0IHVpbnQ4X3Qga0ludmFsaWRVVUlEWzE2XSA9IHsweDEwLCAweDIwLCAweDMwLCAweDQwLCAweDUwLCAweDYwLCAweDcwLCAweDgwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDEwLCAweDIwLCAweDMwLCAweDQwLCAweDUwLCAweDYwLCAweDcwLCAweDgwfTsKKworc3RhdGljIGNvbnN0IHVpbnQ4X3Qga0NvbW1vblBzc2hCb3hVVUlEWzE2XSA9IHsweDEwLCAweDc3LCAweEVGLCAweEVDLCAweEMwLCAweEIyLCAweDRELCAweDAyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEFDLCAweEUzLCAweDNDLCAweDFFLCAweDUyLCAweEUyLCAweEZCLCAweDRCfTsKKworc3RhdGljIGNvbnN0IHVpbnQ4X3Qga0NsZWFyS2V5VVVJRFsxNl0gPSB7MHhFMiwgMHg3MSwgMHg5RCwgMHg1OCwgMHhBOSwgMHg4NSwgMHhCMywgMHhDOSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4NzgsIDB4MUEsIDB4QjAsIDB4MzAsIDB4QUYsIDB4NzgsI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lkZSB7fQorICAgIERybUxpc3RlbmVyKCkge30KKworICAgcHJpdmF0ZToKKyAgICBESVNBTExPV19FVklMX0NPTlNUUlVDVE9SUyhEcm1MaXN0ZW5lcik7Cit9OworCitjbGFzcyBEcm1GdXp6ZXIgeworICAgcHVibGljOgorICAgIHZvaWQgcHJvY2Vzcyhjb25zdCB1aW50OF90ICpkYXRhLCBzaXplX3Qgc2l6ZSk7CisKKyAgIHByaXZhdGU6CisgICAgdm9pZCBpbnZva2VEcm0oY29uc3QgdWludDhfdCAqZGF0YSwgc2l6ZV90IHNpemUpOworICAgIGJvb2wgaW5pdERybSgpOworICAgIHZvaWQgaW52b2tlRHJtQ3JlYXRlUGx1Z2luKCk7CisgICAgdm9pZCBpbnZva2VEcm1PcGVuU2Vzc2lvbigpOworICAgIHZvaWQgaW52b2tlRHJtU2V0TGlzdGVuZXIoKTsKKyAgICB2b2lkIGludm9rZURybVNldEFsZ29yaXRobUFQSSgpOworICAgIHZvaWQgaW52b2tlRHJtUHJvcGVydHlBUEkoKTsKKyAgICB2b2lkIGludm9rZURybURlY3J5cHRFbmNyeXB0QVBJKGNvbnN0IHVpbnQ4X3QgKmRhdGEsIHNpemVfdCBzaXplKTsKKyAgICB2b2lkIGludm9rZURybVNlY3VyZVN0b3BBUEkoKTsKKyAgICB2b2lkIGludm9rZURybU9mZmxpbmVMaWNlbnNlQVBJKCk7CisgICAgdm9pZCBpbnZva2VEcm1DbG9zZVNlc3Npb24oKTsKKyAgICB2b2lkIGludm9rZURybURlc3Ryb3lQbHVnaW4oKTsKKyAgICB2b2lkIGludm9rZUNyeXB0byhjb25zdCB1aW50OF90ICpkYXRhKTsKKyAgICBib29sIGluaXRDcnlwdG8oKTsKKyAgICB2b2lkIGludm9rZUNyeXB0b0NyZWF0ZVBsdWdpbigpOworICAgIHZvaWQgaW52b2tlQ3J5cHRvRGVjcnlwdChjb25zdCB1aW50OF90ICpkYXRhKTsKKyAgICB2b2lkIGludm9rZUNyeXB0b0Rlc3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2lvbigpOworICAgIGludm9rZURybVNldEFsZ29yaXRobUFQSSgpOworICAgIGludm9rZURybVNldExpc3RlbmVyKCk7CisgICAgaW52b2tlRHJtUHJvcGVydHlBUEkoKTsKKyAgICBpbnZva2VEcm1EZWNyeXB0RW5jcnlwdEFQSShkYXRhLCBzaXplKTsKKyAgICBpbnZva2VEcm1TZWN1cmVTdG9wQVBJKCk7CisgICAgaW52b2tlRHJtT2ZmbGluZUxpY2Vuc2VBUEkoKTsKKyAgICBpbnZva2VEcm1DbG9zZVNlc3Npb24oKTsKKyAgICBpbnZva2VEcm1EZXN0cm95UGx1Z2luKCk7Cit9CisKK3ZvaWQgRHJtRnV6emVyOjppbnZva2VDcnlwdG8oY29uc3QgdWludDhfdCAqZGF0YSkgeworICAgIGlmICghaW5pdENyeXB0bygpKSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgaW52b2tlQ3J5cHRvQ3JlYXRlUGx1Z2luKCk7CisgICAgaW52b2tlQ3J5cHRvRGVjcnlwdChkYXRhKTsKKyAgICBpbnZva2VDcnlwdG9EZXN0cm95UGx1Z2luKCk7Cit9CisKK3ZvaWQgRHJtRnV6emVyOjpwcm9jZXNzKGNvbnN0IHVpbnQ4X3QgKmRhdGEsIHNpemVfdCBzaXplKSB7CisgICAgbUZ1enplZERhdGFQcm92aWRlciA9IG5ldyBGdXp6ZWREYXRhUHJvdmlkZXIoZGF0YSwgc2l6ZSk7CisgICAgaW52b2tlRHJtKGRhdGEsIHNpemUpOworICAgIGludm9rZUNyeXB0byhkYXRhKTsKKyAgICBkZWxldGUgbUZ1enplZERhdGFQcm92aWRlcjsKK30KKworZXh0ZXJuICJDIiBpbnQgTExWTUZ1enplclRlc3RPbmVJbnB1dChjb25zdCB1aW50OF90ICpkYXRhLCBzaXplX3Qgc2l6ZSkgeworICAgIGlmIChzaXplIDwgQUVTX0JMT0NLX1NJWkUpIHsKKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorICAgIERybUZ1enplciBkcm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AnbGljZW5zZV9raW5kcycgZnJvbSAiZnJhbWV3b3Jrc19hdl9saWNlbnNlIgorICAgIC8vIHRvIGdldCB0aGUgYmVsb3cgbGljZW5zZSBraW5kczoKKyAgICAvLyAgIFNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUFwYWNoZS0yLjAKKyAgICBkZWZhdWx0X2FwcGxpY2FibGVfbGljZW5zZXM6IFsiZnJhbWV3b3Jrc19hdl9saWNlbnNlIl0sCit9CisKK2NjX2xpYnJhcnlfaG9zdF9zaGFyZWQgeworICAgIG5hbWU6ICJsaWJkcm1fbWV0cmljc19wcm90b3NfZnVsbF9ob3N0IiwKKyAgICB2ZW5kb3JfYXZhaWxhYmxlOiB0cnVlLAorCisgICAgaW5jbHVkZV9kaXJzOiBbImV4dGVybmFsL3Byb3RvYnVmL3NyYyJdLAorCisgICAgc3JjczogWworICAgICAgICAibWV0cmljcy5wcm90byIsCisgICAgXSwKKworICAgIHByb3RvOiB7CisgICAgICAgIGV4cG9ydF9wcm90b19oZWFkZXJzOiB0cnVlLAorICAgICAgICB0eXBlOiAiZnVsbCIsCisgICAgfSwKKworICAgIGNmbGFnczogWworICAgICAgICAvLyBTdXBwcmVzcyB1bnVzZWQgcGFyYW1ldGVyIGVycm9yLiBUaGlzIGVycm9yIG9jY3VycworICAgICAgICAvLyB3aGVuIHVzaW5nIHRoZSBtYXAgdHlwZSBpbiBhIHByb3RvIGRlZmluaXRpb24uCisgICAgICAgICItV25vLXVudXNlZC1wYXJhbWV0ZXIiLAorICAgIF0sCit9CmRpZmYgLS1naXQgYS9kcm0vbGlibWVkaWFkcm0vdGVzdHMvQW5kcm9pZC5icCBiL2RybS9saWJtZWRpYWRybS90ZXN0cy9BbmRyb2lkLmJwCmluZGV4IDY1MjkzODcuLjkyNjdlNzkgMTAwNjQ0Ci0tLSBhL2RybS9saWJtZWRpYWRybS90ZXN0cy9BbmRyb2lkLmJwCisrKyBiL2RybS9saWJtZWRpYWRybS90ZXN0cy9BbmRyb2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7CiAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7CiAgICAgICAgIGRlZmF1bHQ6CkBAIC0yMzUsNDkgKzIyOSw1MCBAQAogICAgICAgICBtTWVtby5jbGVhcigpOwogICAgIH0KIAorICAgIC8vIFRPRE8oeXRhaSk6IHJlbW92ZSB0aGlzIG1ldGhvZCBvbmNlIGl0IGlzIG5vdCB1c2VkLgogICAgIHN0YXR1c190IHdyaXRlVG9QYXJjZWwoUGFyY2VsICpwYXJjZWwpIGNvbnN0IHsKLSAgICAgICAgaWYgKHBhcmNlbCA9PSBudWxscHRyKSB7Ci0gICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICB9Ci0gICAgICAgIHN0YXR1c190IHJlcyA9IHBhcmNlbC0+d3JpdGVJbnQzMihtSW50ZXJwb2xhdG9yVHlwZSkKLSAgICAgICAgICAgICAgICA/OiBwYXJjZWwtPndyaXRlRmxvYXQobUZpcnN0U2xvcGUpCi0gICAgICAgICAgICAgICAgPzogcGFyY2VsLT53cml0ZUZsb2F0KG1MYXN0U2xvcGUpCi0gICAgICAgICAgICAgICAgPzogcGFyY2VsLT53cml0ZVVpbnQzMigodWludDMyX3QpdGhpcy0+c2l6ZSgpKTsgLy8gc2lsZW50IHRydW5jYXRpb24KLSAgICAgICAgaWYgKHJlcyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgcmV0dXJuIHJlczsKLSAgICAgICAgfQotICAgICAgICBmb3IgKGNvbnN0IGF1dG8gJnB0IDogKnRoaXMpIHsKLSAgICAgICAgICAgIHJlcyA9IHBhcmNlbC0+d3JpdGVGbG9hdChwdC5maXJzdCkKLSAgICAgICAgICAgICAgICAgICAgPzogcGFyY2VsLT53cml0ZUZsb2F0KHB0LnNlY29uZCk7Ci0gICAgICAgICAgICBpZiAocmVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHJlczsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gTk9fRVJST1I7CisgICAgICAgIG1lZGlhOjpJbnRlcnBvbGF0b3JDb25maWcgY29uZmlnOworICAgICAgICB3cml0ZVRvQ29uZmlnKCZjb25maWcpOworICAgICAgICByZXR1cm4gY29uZmlnLndyaXRlVG9QYXJjZWwocGFyY2VsKTsKICAgICB9CiAKKyAgICB2b2lkIHdyaXRlVG9Db25maWcobWVkaWE6OkludGVycG9sYXRvckNvbmZpZyAqY29uZmlnKSBjb25zdCB7CisgICAgICAgIGNvbmZpZy0+dHlwZSA9IG1JbnRlcnBvbGF0b3JUeXBlOworICAgICAgICBjb25maWctPmZpcnN0U2xvcGUgPSBtRmlyc3RTbG9wZTsKKyAgICAgICAgY29uZmlnLT5sYXN0U2xvcGUgPSBtTGFzdFNsb3BlOworICAgICAgICBmb3IgKGNvbnN0IGF1dG8gJnB0IDogKnRoaXMpIHsKKyAgICAgICAgICAgIGNvbmZpZy0+eHkucHVzaF9iYWNrKHB0LmZpcnN0KTsKKyAgICAgICAgICAgIGNvbmZpZy0+eHkucHVzaF9iYWNrKHB0LnNlY29uZCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBUT0RPKHl0YWkpOiByZW1vdmUgdGhpcyBtZXRob2Qgb25jZSBpdCBpcyBub3QgdXNlZC4KICAgICBzdGF0dXNfdCByZWFkRnJvbVBhcmNlbChjb25zdCBQYXJjZWwgJnBhcmNlbCkgewotICAgICAgICB0aGlzLT5jbGVhcigpOwotICAgICAgICBpbnQzMl90IHR5cGU7Ci0gICAgICAgIHVpbnQzMl90IHNpemU7Ci0gICAgICAgIHN0YXR1c190IHJlcyA9IHBhcmNlbC5yZWFkSW50MzIoJnR5cGUpCi0gICAgICAgICAgICAgICAgICAgICAgICA/OiBwYXJjZWwucmVhZEZsb2F0KCZtRmlyc3RTbG9wZSkKLSAgICAgICAgICAgICAgICAgICAgICAgID86IHBhcmNlbC5yZWFkRmxvYXQoJm1MYXN0U2xvcGUpCi0gICAgICAgICAgICAgICAgICAgICAgICA/OiBwYXJjZWwucmVhZFVpbnQzMigmc2l6ZSkKLSAgICAgICAgICAgICAgICAgICAgICAgID86IHNldEludGVycG9sYXRvclR5cGUoKEludGVycG9sYXRvclR5cGUpdHlwZSk7CisgICAgICAgIG1lZGlhOjpJbnRlcnBvbGF0b3JDb25maWcgY29uZmlnOworICAgICAgICBzdGF0dXNfdCByZXMgPSBjb25maWcucmVhZEZyb21QYXJjZWwoJnBhcmNlbCk7CiAgICAgICAgIGlmIChyZXMgIT0gTk9fRVJST1IpIHsKICAgICAgICAgICAgIHJldHVybiByZXM7CiAgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJlYWRGcm9tQ29uZmlnKGNvbmZpZyk7CisgICAgfQorCisgICAgc3RhdHVzX3QgcmVhZEZyb21Db25maWcoY29uc3QgbWVkaWE6OkludGVycG9sYXRvckNvbmZpZyAmY29uZmlnKSB7CisgICAgICAgIHRoaXMtPmNsZWFyKCk7CisgICAgICAgIHNldEludGVycG9sYXRvclR5cGUoY29uZmlnLnR5cGUpOworICAgICAgICBpZiAoKGNvbmZpZy54eS5zaXplKCkgJiAxKSAhPSAwKSB7CisgICAgICAgICAgICAvLyB4eSBzaXplIG11c3QgYmUgZXZlbi4KKyAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgICAgIH0KKyAgICAgICAgdWludDMyX3Qgc2l6ZSA9IGNvbmZpZy54eS5zaXplKCkgLyAyOworICAgICAgICBtRmlyc3RTbG9wZSA9IGNvbmZpZy5maXJzdFNsb3BlOworICAgICAgICBtTGFzdFNsb3BlID0gY29uZmlnLmxhc3RTbG9wZTsKKwogICAgICAgICAvLyBOb3RlOiBXZSBkb24ndCBuZWVkIHRvIGNoZWNrIHNpemUgaXMgd2l0aGluIHNvbWUgYm91bmRzIGFzCiAgICAgICAgIC8vIHRoZSBQYXJjZWwgcmVhZCB3aWxsIGZhaWwgaWYgc2l6ZSBpcyBpbmNvcnJlY3RseSBzcGVjaWZpZWQgdG9vIGxhcmdlLgogICAgICAgICBmbG9hdCBsYXN0eDsKICAgICAgICAgZm9yICh1aW50MzJfdCBpID0gMDsgaSA8IHNpemU7ICsraSkgewotICAgICAgICAgICAgZmxvYXQgeCwgeTsKLSAgICAgICAgICAgIHJlcyA9IHBhcmNlbC5yZWFkRmxvYXQoJngpCi0gICAgICAgICAgICAgICAgICAgID86IHBhcmNlbC5yZWFkRmxvYXQoJnkpOwotICAgICAgICAgICAgaWYgKHJlcyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiByZXM7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBmbG9hdCB4ID0gY29uZmlnLnh5W2kgKiAyXTsKKyAgICAgICAgICAgIGZsb2F0IHkgPSBjb25maWcueHlbaSAqIDIgKyAxXTsKICAgICAgICAgICAgIGlmICgoaSA+IDAgJiYgISh4ID4gbGFzdHgpKSAvKiBoYW5kbGUgbmFuICovCiAgICAgICAgICAgICAgICAgICAgIHx8IHkgIT0geSAvKiBoYW5kbGUgbmFuICovKSB7CiAgICAgICAgICAgICAgICAgLy8gVGhpcyBpcyBhIHN0ZDo6bWFwIG9iamVjdCB3aGljaCBpbXBvc2VzIHNvcnRlZCBvcmRlcgpkaWZmIC0tZ2l0IGEvaW5jbHVkZS9tZWRpYS9NaWNyb3Bob25lSW5mby5oIGIvaW5jbHVkZS9tZWRpYS9NaWNyb3Bob25lSW5mby5oCmluZGV4IDIyODdhY2EuLmE1MDQ1YjkgMTAwNjQ0Ci0tLSBhL2luY2x1ZGUvbWVkaWEvTWljcm9waG9uZUluZm8uaAorKysgYi9pbmNsdWRlL21lZGlhL01pY3JvcGhvbmVJbmZvLmgKQEAgLTE3LDMzICsxNywyNCBAQAogI2lmbmRlZiBBTkRST0lEX01JQ1JPUEhPTkVfSU5GT19ICiAjZGVmaW5lIEFORFJPSURfTUlDUk9QSE9ORV9JTkZPX0gKIAorI2luY2x1ZGUgPGFuZHJvaWQvbWVkaWEvTWljcm9waG9uZUluZm9EYXRhLmg+CiAjaW5jbHVkZSA8YmluZGVyL1BhcmNlbC5oPgogI2luY2x1ZGUgPGJpbmRlci9QYXJjZWxhYmxlLmg+CisjaW5jbHVkZSA8bWVkaWEvQWlkbENvbnZlcnNpb25VdGlsLmg+CiAjaW5jbHVkZSA8c3lzdGVtL2F1ZGlvLmg+Ci0jaW5jbHVkZSA8dXRpbHMvU3RyaW5nMTYuaD4KLSNpbmNsdWRlIDx1dGlscy9WZWN0b3IuaD4KIAogbmFtZXNwYWNlIGFuZHJvaWQgewogbmFtZXNwYWNlIG1lZGlhIHsKIAotI2RlZmluZSBSRVRVUk5fSUZfRkFJTEVEKGNhbGxlZE9uY2UpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgIHN0YXR1c190IHJldHVyblN0YXR1cyA9IGNhbGxlZE9uY2U7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICBpZiAocmV0dXJuU3RhdHVzKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICAgICAgICAgIEFMT0dFKCJGYWlsZWQgYXQgJXM6JWQgKCVzKSIsIF9fRklMRV9fLCBfX0xJTkVfXywgX19mdW5jX18pOyBcCi0gICAgICAgICAgICByZXR1cm4gcmV0dXJuU3RhdHVzOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICB9Ci0KIGNsYXNzIE1pY3JvcGhvbmVJbmZvIDogcHVibGljIFBhcmNlbGFibGUgewogcHVibGljOgogICAgIE1pY3JvcGhvbmVJbmZvKCkgPSBkZWZhdWx0OwogICAgIE1pY3Jv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JjZWwtPndyaXRlRG91YmxlKG1EdXJhdGlvbk1zKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgID86IEludGVycG9sYXRvcjxTLCBUPjo6d3JpdGVUb1BhcmNlbChwYXJjZWwpOworICAgICAgICAgICAgVm9sdW1lU2hhcGVyQ29uZmlndXJhdGlvbiBwYXJjZWxhYmxlOworICAgICAgICAgICAgd3JpdGVUb1BhcmNlbGFibGUoJnBhcmNlbGFibGUpOworICAgICAgICAgICAgcmV0dXJuIHBhcmNlbGFibGUud3JpdGVUb1BhcmNlbChwYXJjZWwpOwogICAgICAgICB9CiAKLSAgICAgICAgc3RhdHVzX3QgcmVhZEZyb21QYXJjZWwoY29uc3QgUGFyY2VsICpwYXJjZWwpIG92ZXJyaWRlIHsKLSAgICAgICAgICAgIGludDMyX3QgdHlwZSwgb3B0aW9uRmxhZ3M7Ci0gICAgICAgICAgICByZXR1cm4gcGFyY2VsLT5yZWFkSW50MzIoJnR5cGUpCi0gICAgICAgICAgICAgICAgICAgID86IHNldFR5cGUoKFR5cGUpdHlwZSkKLSAgICAgICAgICAgICAgICAgICAgPzogcGFyY2VsLT5yZWFkSW50MzIoJm1JZCkKLSAgICAgICAgICAgICAgICAgICAgPzogbVR5cGUgPT0gVFlQRV9JRAotICAgICAgICAgICAgICAgICAgICAgICAgPyBOT19FUlJPUgotICAgICAgICAgICAgICAgICAgICAgICAgOiBwYXJjZWwtPnJlYWRJbnQzMigmb3B0aW9uRmxhZ3MpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPzogc2V0T3B0aW9uRmxhZ3MoKE9wdGlvbkZsYWcpb3B0aW9uRmxhZ3MpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPzogcGFyY2VsLT5yZWFkRG91YmxlKCZtRHVyYXRpb25NcykKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICA/OiBJbnRlcnBvbGF0b3I8UywgVD46OnJlYWRGcm9tUGFyY2VsKCpwYXJjZWwpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPzogY2hlY2tDdXJ2ZSgpOworICAgICAgICB2b2lkIHdyaXRlVG9QYXJjZWxhYmxlKFZvbHVtZVNoYXBlckNvbmZpZ3VyYXRpb24gKnBhcmNlbGFibGUpIGNvbnN0IHsKKyAgICAgICAgICAgIHBhcmNlbGFibGUtPmlkID0gZ2V0SWQoKTsKKyAgICAgICAgICAgIHBhcmNlbGFibGUtPnR5cGUgPSBnZXRUeXBlQXNBaWRsKCk7CisgICAgICAgICAgICBwYXJjZWxhYmxlLT5vcHRpb25GbGFncyA9IDA7CisgICAgICAgICAgICBpZiAobVR5cGUgIT0gVFlQRV9JRCkgeworICAgICAgICAgICAgICAgIHBhcmNlbGFibGUtPm9wdGlvbkZsYWdzID0gZ2V0T3B0aW9uRmxhZ3NBc0FpZGwoKTsKKyAgICAgICAgICAgICAgICBwYXJjZWxhYmxlLT5kdXJhdGlvbk1zID0gZ2V0RHVyYXRpb25NcygpOworICAgICAgICAgICAgICAgIHBhcmNlbGFibGUtPmludGVycG9sYXRvckNvbmZpZy5lbXBsYWNlKCk7IC8vIGNyZWF0ZSB2YWx1ZSBpbiBzdGQ6Om9wdGlvbmFsCisgICAgICAgICAgICAgICAgSW50ZXJwb2xhdG9yPFMsIFQ+Ojp3cml0ZVRvQ29uZmlnKCYqcGFyY2VsYWJsZS0+aW50ZXJwb2xhdG9yQ29uZmlnKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHN0YXR1c190IHJlYWRGcm9tUGFyY2VsKGNvbnN0IFBhcmNlbCogcGFyY2VsKSBvdmVycmlkZSB7CisgICAgICAgICAgICBWb2x1bWVTaGFwZXJDb25maWd1cmF0aW9uIGRhdGE7CisgICAgICAgICAgICByZXR1cm4gZGF0YS5yZWFkRnJvbVBhcmNlbChwYXJjZWwpCisgICAgICAgICAgICAgICAgICAgPzogcmVhZEZyb21QYXJjZWxhYmxlKGRhdGEpOworICAgICAgICB9CisKKyAgICAgICAgc3RhdHVzX3QgcmVhZEZyb21QYXJjZWxhYmxlKGNvbnN0IFZvbHVtZVNoYXBlckNvbmZpZ3VyYXRpb24mIHBhcmNlbGFibGUpIHsKKyAgICAgICAgICAgIHNldElkKHBhcmNlbGFibGUuaWQpOworICAgICAgICAgICAgcmV0dXJuIHNldFR5cGVGcm9tQWlkbChwYXJjZWxhYmxlLnR5cGUpCisgICAgICAgICAgICAgICAgICAgPzogbVR5cGUgPT0gVFlQRV9JRAorICAgICAgICAgICAgICAgICAgICAgID8gTk9fRVJST1IKKyAgICAgICAgICAgICAgICAgICAgICA6IHNldE9wdGlvbkZsYWdzRnJvbUFpZGwocGFyY2VsYWJsZS5vcHRpb25GbGFncykKKyAgICAgICAgICAgICAgICAgICAgICAgID86IHNldER1cmF0aW9uTXMocGFyY2VsYWJsZS5kdXJhdGlvbk1zKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgPzogIXBhcmNlbGFibGUuaW50ZXJwb2xhdG9yQ29uZmlnICAvLyBjaGVjayBzdGQ6Om9wdGlvbmFsIGZvciB2YWx1ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gQkFEX1ZBTFVFIC8vIG11c3QgYmUgbm9ubnVsbC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IEludGVycG9sYXRvcjxTLCBUPjo6cmVhZEZyb21Db25maWcoKnBhcmNlbGFibGUuaW50ZXJwb2xhdG9yQ29uZmlnKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/OiBjaGVja0N1cnZlKCk7CiAgICAgICAgIH0KIAogICAgICAgICAvLyBSZXR1cm5zIGEgc3RyaW5nIGZvciBkZWJ1ZyBwcmludGluZy4KQEAgLTMyOSw2ICszNDUsNTEgQEAKICAgICAgICAgaW50MzJfdCBtSWQ7ICAgICAgICAgICAgIC8vIEEgdmFsaWQgaWQgaXMgPj0gMC4KICAgICAgICAgT3B0aW9uRmxhZyBtT3B0aW9uRmxhZ3M7IC8vIG9wdGlvbiBmbGFncyBmb3IgdGhlIGNvbmZpZ3VyYXRpb24uCiAgICAgICAgIGRvdWJsZSBtRHVyYXRpb25NczsgICAgICAvLyBkdXJhdGlvbiwgbXVzdCBiZSA+IDA7IGRlZmF1bHQgaXMgMTAwMCBtcy4KKworICAgICAgICBpbnQzMl90IGdldE9wdGlvbkZsYWdzQXNBaWRsKCkgY29uc3QgeworICAgICAgICAgICAgaW50MzJfdCByZXN1bHQgPSAwOworICAgICAgICAgICAgaWYgKGdldE9wdGlvbkZsYWdzKCkgJiBPUFRJT05fRkxBR19WT0xVTUVfSU5fREJGUykgeworICAgICAgICAgICAgICAgIHJlc3VsdCB8PQorICAgICAgICAgICAgICAgICAgICAgICAgMSA8PCBzdGF0aWNfY2FzdDxpbnQ+KFZvbHVtZVNoYXBlckNvbmZpZ3VyYXRpb25PcHRpb25GbGFnOjpWT0xVTUVfSU5fREJGUyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZ2V0T3B0aW9uRmxhZ3MoKSAmIE9QVElPTl9GTEFHX0NMT0NLX1RJTUUpIHsKKyAgICAgICAgICAgICAgICByZXN1bHQgfD0gMSA8PCBzdGF0aWNfY2FzdDxpbnQ+KFZvbHVtZVNoYXBlckNvbmZpZ3VyYXRpb25PcHRpb25GbGFnOjpDTE9DS19USU1FKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgICAgIH0KKworICAgICAgICBzdGF0dXNfdCBzZXRPcHRpb25GbGFnc0Zyb21BaWRsKGludDMyX3QgYWlkbCkgeworICAgICAgICAgICAgc3RkOjp1bmRlcmx5aW5nX3R5cGVfdDxPcHRpb25GbGFnPiBvcHRpb25zID0gMDsKKyAgICAgICAgICAgIGlmIChhaWRsICYgKDEgPDwgc3RhdGljX2Nhc3Q8aW50PihWb2x1bWVTaGFwZXJDb25maWd1cmF0aW9uT3B0aW9uRmxhZzo6Vk9MVU1FX0lOX0RCRlMpKSkgeworICAgICAgICAgICAgICAgIG9wdGlvbnMgfD0gT1BUSU9OX0ZMQUdfVk9MVU1FX0lOX0RCRlM7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoYWlkbCAmICgxIDw8IHN0YXRpY19jYXN0PGludD4oVm9sdW1lU2hhcGVyQ29uZmlndXJhdGlvbk9wdGlvbkZsYWc6OkNMT0NLX1RJTUUpKSkgeworICAgICAgICAgICAgICAgIG9wdGlvbnMgfD0gT1BUSU9OX0ZMQUdfQ0xPQ0tfVElNRTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBzZXRPcHRpb25GbGFncyhzdGF0aWNfY2FzdDxPcHRpb25GbGFnPihvcHRpb25zKSk7CisgICAgICAgIH0KKworICAgICAgICBzdGF0dXNfdCBzZXRUeXBlRnJvbUFpZGwoVm9sdW1lU2hhcGVyQ29uZmlndXJhdGlvblR5cGUgYWlkbCkgeworICAgICAgICAgICAgc3dpdGNoIChhaWRsKSB7CisgICAgICAgICAgICAgICAgY2FzZSBWb2x1bWVTaGFwZXJDb25maWd1cmF0aW9uVHlwZTo6SUQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBzZXRUeXBlKFRZUEVfSUQpOworICAgICAgICAgICAgICAgIGNhc2UgVm9sdW1lU2hhcGVyQ29uZmlndXJhdGlvblR5cGU6OlNDQUxFOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2V0VHlwZShUWVBFX1NDQUxFKTsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgVm9sdW1lU2hhcGVyQ29uZmlndXJhdGlvblR5cGUgZ2V0VHlwZUFzQWlkbCgpIGNvbnN0IHsKKyAgICAgICAgICAgIHN3aXRjaCAoZ2V0VHlwZSgpKSB7CisgICAgICAgICAgICAgICAgY2FzZSBUWVBFX0lEOgorICAgICAgICAgICAgICAgIC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cCk7CisgICAgICAgICAgICByZXR1cm4gb3Aud3JpdGVUb1BhcmNlbChwYXJjZWwpOwogICAgICAgICB9CiAKLSAgICAgICAgc3RhdHVzX3QgcmVhZEZyb21QYXJjZWwoY29uc3QgUGFyY2VsICpwYXJjZWwpIG92ZXJyaWRlIHsKLSAgICAgICAgICAgIGludDMyX3QgZmxhZ3M7Ci0gICAgICAgICAgICByZXR1cm4gcGFyY2VsLT5yZWFkSW50MzIoJmZsYWdzKQotICAgICAgICAgICAgICAgICAgICA/OiBwYXJjZWwtPnJlYWRJbnQzMigmbVJlcGxhY2VJZCkKLSAgICAgICAgICAgICAgICAgICAgPzogcGFyY2VsLT5yZWFkRmxvYXQoJm1YT2Zmc2V0KQotICAgICAgICAgICAgICAgICAgICA/OiBzZXRGbGFncygoRmxhZylmbGFncyk7CisgICAgICAgIHZvaWQgd3JpdGVUb1BhcmNlbGFibGUoVm9sdW1lU2hhcGVyT3BlcmF0aW9uKiBvcCkgY29uc3QgeworICAgICAgICAgICAgb3AtPmZsYWdzID0gZ2V0RmxhZ3NBc0FpZGwoKTsKKyAgICAgICAgICAgIG9wLT5yZXBsYWNlSWQgPSBtUmVwbGFjZUlkOworICAgICAgICAgICAgb3AtPnhPZmZzZXQgPSBtWE9mZnNldDsKKyAgICAgICAgfQorCisgICAgICAgIHN0YXR1c190IHJlYWRGcm9tUGFyY2VsKGNvbnN0IFBhcmNlbCogcGFyY2VsKSBvdmVycmlkZSB7CisgICAgICAgICAgICBWb2x1bWVTaGFwZXJPcGVyYXRpb24gb3A7CisgICAgICAgICAgICByZXR1cm4gb3AucmVhZEZyb21QYXJjZWwocGFyY2VsKQorICAgICAgICAgICAgICAgICAgID86IHJlYWRGcm9tUGFyY2VsYWJsZShvcCk7CisgICAgICAgIH0KKworICAgICAgICBzdGF0dXNfdCByZWFkRnJvbVBhcmNlbGFibGUoY29uc3QgVm9sdW1lU2hhcGVyT3BlcmF0aW9uJiBvcCkgeworICAgICAgICAgICAgbVJlcGxhY2VJZCA9IG9wLnJlcGxhY2VJZDsKKyAgICAgICAgICAgIG1YT2Zmc2V0ID0gb3AueE9mZnNldDsKKyAgICAgICAgICAgIHJldHVybiBzZXRGbGFnc0Zyb21BaWRsKG9wLmZsYWdzKTsKICAgICAgICAgfQogCiAgICAgICAgIHN0ZDo6c3RyaW5nIHRvU3RyaW5nKCkgY29uc3QgewpAQCAtNDQ1LDYgKzUxNiw0OCBAQAogICAgICAgICB9CiAKICAgICBwcml2YXRlOgorICAgICAgICBzdGF0dXNfdCBzZXRGbGFnc0Zyb21BaWRsKGludDMyX3QgYWlkbCkgeworICAgICAgICAgICAgc3RkOjp1bmRlcmx5aW5nX3R5cGVfdDxGbGFnPiBmbGFncyA9IDA7CisgICAgICAgICAgICBpZiAoYWlkbCAmICgxIDw8IHN0YXRpY19jYXN0PGludD4oVm9sdW1lU2hhcGVyT3BlcmF0aW9uRmxhZzo6UkVWRVJTRSkpKSB7CisgICAgICAgICAgICAgICAgZmxhZ3MgfD0gRkxBR19SRVZFUlNFOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGFpZGwgJiAoMSA8PCBzdGF0aWNfY2FzdDxpbnQ+KFZvbHVtZVNoYXBlck9wZXJhdGlvbkZsYWc6OlRFUk1JTkFURSkpKSB7CisgICAgICAgICAgICAgICAgZmxhZ3MgfD0gRkxBR19URVJNSU5BVEU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoYWlkbCAmICgxIDw8IHN0YXRpY19jYXN0PGludD4oVm9sdW1lU2hhcGVyT3BlcmF0aW9uRmxhZzo6Sk9JTikpKSB7CisgICAgICAgICAgICAgICAgZmxhZ3MgfD0gRkxBR19KT0lOOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGFpZGwgJiAoMSA8PCBzdGF0aWNfY2FzdDxpbnQ+KFZvbHVtZVNoYXBlck9wZXJhdGlvbkZsYWc6OkRFTEFZKSkpIHsKKyAgICAgICAgICAgICAgICBmbGFncyB8PSBGTEFHX0RFTEFZOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGFpZGwgJiAoMSA8PCBzdGF0aWNfY2FzdDxpbnQ+KFZvbHVtZVNoYXBlck9wZXJhdGlvbkZsYWc6OkNSRUFURV9JRl9ORUNFU1NBUlkpKSkgeworICAgICAgICAgICAgICAgIGZsYWdzIHw9IEZMQUdfQ1JFQVRFX0lGX05FQ0VTU0FSWTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBzZXRGbGFncyhzdGF0aWNfY2FzdDxGbGFnPihmbGFncykpOworICAgICAgICB9CisKKyAgICAgICAgaW50MzJfdCBnZXRGbGFnc0FzQWlkbCgpIGNvbnN0IHsKKyAgICAgICAgICAgIGludDMyX3QgYWlkbCA9IDA7CisgICAgICAgICAgICBzdGQ6OnVuZGVybHlpbmdfdHlwZV90PEZsYWc+IGZsYWdzID0gZ2V0RmxhZ3MoKTsKKyAgICAgICAgICAgIGlmIChmbGFncyAmIEZMQUdfUkVWRVJTRSkgeworICAgICAgICAgICAgICAgIGFpZGwgfD0gKDEgPDwgc3RhdGljX2Nhc3Q8aW50PihWb2x1bWVTaGFwZXJPcGVyYXRpb25GbGFnOjpSRVZFUlNFKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZmxhZ3MgJiBGTEFHX1RFUk1JTkFURSkgeworICAgICAgICAgICAgICAgIGFpZGwgfD0gKDEgPDwgc3RhdGljX2Nhc3Q8aW50PihWb2x1bWVTaGFwZXJPcGVyYXRpb25GbGFnOjpURVJNSU5BVEUpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChmbGFncyAmIEZMQUdfSk9JTikgeworICAgICAgICAgICAgICAgIGFpZGwgfD0gKDEgPDwgc3RhdGljX2Nhc3Q8aW50PihWb2x1bWVTaGFwZXJPcGVyYXRpb25GbGFnOjpKT0lOKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZmxhZ3MgJiBGTEFHX0RF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bHVtZSkKLSAgICAgICAgICAgICAgICAgICAgPzogcGFyY2VsLT53cml0ZUZsb2F0KG1YT2Zmc2V0KTsKKyAgICAgICAgICAgIFZvbHVtZVNoYXBlclN0YXRlIHN0YXRlOworICAgICAgICAgICAgd3JpdGVUb1BhcmNlbGFibGUoJnN0YXRlKTsKKyAgICAgICAgICAgIHJldHVybiBzdGF0ZS53cml0ZVRvUGFyY2VsKHBhcmNlbCk7CiAgICAgICAgIH0KIAotICAgICAgICBzdGF0dXNfdCByZWFkRnJvbVBhcmNlbChjb25zdCBQYXJjZWwgKnBhcmNlbCkgb3ZlcnJpZGUgewotICAgICAgICAgICAgcmV0dXJuIHBhcmNlbC0+cmVhZEZsb2F0KCZtVm9sdW1lKQotICAgICAgICAgICAgICAgICAgICAgPzogcGFyY2VsLT5yZWFkRmxvYXQoJm1YT2Zmc2V0KTsKKyAgICAgICAgdm9pZCB3cml0ZVRvUGFyY2VsYWJsZShWb2x1bWVTaGFwZXJTdGF0ZSogcGFyY2VsYWJsZSkgY29uc3QgeworICAgICAgICAgICAgcGFyY2VsYWJsZS0+dm9sdW1lID0gbVZvbHVtZTsKKyAgICAgICAgICAgIHBhcmNlbGFibGUtPnhPZmZzZXQgPSBtWE9mZnNldDsKKyAgICAgICAgfQorCisgICAgICAgIHN0YXR1c190IHJlYWRGcm9tUGFyY2VsKGNvbnN0IFBhcmNlbCogcGFyY2VsKSBvdmVycmlkZSB7CisgICAgICAgICAgICBWb2x1bWVTaGFwZXJTdGF0ZSBzdGF0ZTsKKyAgICAgICAgICAgIHJldHVybiBzdGF0ZS5yZWFkRnJvbVBhcmNlbChwYXJjZWwpCisgICAgICAgICAgICAgICAgICAgPzogcmVhZEZyb21QYXJjZWxhYmxlKHN0YXRlKTsKKyAgICAgICAgfQorCisgICAgICAgIHN0YXR1c190IHJlYWRGcm9tUGFyY2VsYWJsZShjb25zdCBWb2x1bWVTaGFwZXJTdGF0ZSYgcGFyY2VsYWJsZSkgeworICAgICAgICAgICA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ICAgICAgICAgfSwKICAgICAgICAgewotICAgICAgICAgICJpbmNsdWRlLWZpbHRlciI6ICJjb20uZ29vZ2xlLmFuZHJvaWQubWVkaWEuZ3RzLldpZGV2aW5lR2VuZXJpY09wc1Rlc3RzIgorICAgICAgICAgICAgIm5hbWUiOiAiQ3RzTWVkaWFUZXN0Q2FzZXMiLAorICAgICAgICAgICAgIm9wdGlvbnMiOiBbCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAiaW5jbHVkZS1maWx0ZXIiOiAiYW5kcm9pZC5tZWRpYS5jdHMuRGVjb2RlRWRpdEVuY29kZVRlc3QiCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgXQogICAgICAgICB9Ci0gICAgICBdCi0gICAgfSwKLSAgICB7Ci0gICAgICAibmFtZSI6ICJHdHNFeG9QbGF5ZXJUZXN0Q2FzZXMiLAotICAgICAgIm9wdGlvbnMiIDogWworICAgIF0sCisgICAgInByZXN1Ym1pdCI6IFsKICAgICAgICAgewotICAgICAgICAgICJpbmNsdWRlLWFubm90YXRpb24iOiAiYW5kcm9pZC5wbGF0Zm9ybS50ZXN0LmFubm90YXRpb25zLlNvY1ByZXN1Ym1pdCIKLSAgICAgICAgfSwKLSAgICAgICAgewotICAgICAgICAgICJpbmNsdWRlLWZpbHRlciI6ICJjb20uZ29vZ2xlLmFuZHJvaWQuZXhvcGxheWVyLmd0cy5EYXNoVGVzdCN0ZXN0V2lkZXZpbmUyM0Zwc0gyNjRGaXhlZCIKKyAgICAgICAgICAgICJuYW1lIjogIkd0c01lZGlhVGVzdENhc2VzIiwKKyAgICAgICAgICAgICJvcHRpb25zIiA6IFsKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICJpbmNsdWRlLWFubm90YXRpb24iOiAiYW5kcm9pZC5wbGF0Zm9ybS50ZXN0LmFubm90YXRpb25zLlByZXN1Ym1pdCIKKyAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgImluY2x1ZGUtZmlsdGVyIjogImNvbS5nb29nbGUuYW5kcm9pZC5tZWRpYS5ndHMuV2lkZXZpbmVHZW5lcmljT3BzVGVzdHMiCisgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICJpbmNsdWRlLWZpbHRlciI6ICJjb20uZ29vZ2xlLmFuZHJvaWQubWVkaWEuZ3RzLldpZGV2aW5lSDI2NFBsYXliYWNrVGVzdHMiCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgXQogICAgICAgICB9Ci0gICAgICBdCi0gICAgfQotICBdLAotICAiaW1wb3J0cyI6IFsKLSAgICB7Ci0gICAgICAicGF0aCI6ICJmcmFtZXdvcmtzL2F2L2RybS9tZWRpYWRybS9wbHVnaW5zIgotICAgIH0KLSAgXQotfQorICAgIF0sCiAKKyAgICAiaW1wb3J0cyI6IFsKKyAgICAgICAgeworICAgICAgICAgICAgInBhdGgiOiAiZnJhbWV3b3Jrcy9hdi9kcm0vbWVkaWFkcm0vcGx1Z2lucyIKKyAgICAgICAgfQorICAgIF0sCisKKyAgICAicGxhdGludW0tcG9zdHN1Ym1pdCI6IFsKKyAgICAgICAgLy8gcnVucyByZWd1bGFybHksIGluZGVwZW5kZW50IG9mIGNoYW5nZXMgaW4gdGhpcyB0cmVlLgorICAgICAgICAvLyBzaWduYWxzIGlmIGNoYW5nZXMgZWxzZXdoZXJlIGJyZWFrIG1lZGlhIGZ1bmN0aW9uYWxpdHkKKyAgICAgICAgeworICAgICAgICAgICAgIm5hbWUiOiAiQ3RzTWVkaWFUZXN0Q2FzZXMiLAorICAgICAgICAgICAgIm9wdGlvbnMiOiBbCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAiaW5jbHVkZS1maWx0ZXIiOiAiYW5kcm9pZC5tZWRpYS5jdHMuRW5jb2RlRGVjb2RlVGVzdCIKKyAgICAgICAgICAgICAgICB9CisgICAg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ogWworICAgICAgICAibWFpbl9hdWRpb3NlcnZlci5jcHAiLAorICAgIF0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1XYWxsIiwKKyAgICAgICAgIi1XZXJyb3IiLAorICAgIF0sCisKKyAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGliYXVkaW9oYWxfaGVhZGVycyIsCisgICAgICAgICJsaWJtZWRpYW1ldHJpY3NfaGVhZGVycyIsCisgICAgXSwKKworICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJhYXVkaW9zZXJ2aWNlIiwKKyAgICAgICAgImxpYmF1ZGlvZmxpbmdlciIsCisgICAgICAgICJsaWJhdWRpb3BvbGljeXNlcnZpY2UiLAorICAgICAgICAibGliYXVkaW9wcm9jZXNzaW5nIiwKKyAgICAgICAgImxpYmJpbmRlciIsCisgICAgICAgICJsaWJjdXRpbHMiLAorICAgICAgICAibGliaGlkbGJhc2UiLAorICAgICAgICAibGlibG9nIiwKKyAgICAgICAgImxpYm1lZGlhIiwKKyAgICAgICAgImxpYm1lZGlhbG9nc2VydmljZSIsCisgICAgICAgICJsaWJtZWRpYXV0aWxzIiwKKyAgICAgICAgImxpYm5iYWlvIiwKKyAgICAgICAgImxpYm5ibG9nIiwKKyAgICAgICAgImxpYnBvd2VybWFuYWdlciIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgICAgICJsaWJ2aWJyYXRvciIsCisKKyAgICBdLAorCisgICAgLy8gVE9ETyBjaGVjayBpZiB3ZSBzdGlsbCBuZWVkIGFsbCBvZiB0aGVzZSBpbmNsdWRlIGRpcmVjdG9yaWVzCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJleHRlcm5hbC9zb25pYyIsCisgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL2xpYmFhdWRpby9pbmNsdWRlIiwKKyAgICAgICAgImZyYW1ld29ya3MvYXYvbWVkaWEvbGliYWF1ZGlvL3NyYyIsCisgICAgICAgICJmcmFtZX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sICZyaGFuZGxlLCAmcmJ1ZmZlcik7CisgICAgICBtTWFuYWdlci0+Y2xvc2UobWVzc2FnZS5kYXRhLmNvbm5lY3Rpb25JZCk7CisgICAgICBpZiAoc3RhdHVzICE9IFJlc3VsdFN0YXR1czo6T0spIHsKKyAgICAgICAgICBtZXNzYWdlLmRhdGEuY29tbWFuZCA9IFBpcGVDb21tYW5kOjpSRUNFSVZFX0VSUk9SOworICAgICAgICAgIHNlbmRNZXNzYWdlKG1SZXN1bHRQaXBlRmRzLCBtZXNzYWdlKTsKKyAgICAgICAgICByZXR1cm47CisgICAgICB9CisgICAgICBpZiAoIVRlc3RCdWZmZXJQb29sQWxsb2NhdG9yOjpNYXBNZW1vcnlGb3JNdXRleChyaGFuZGxlLCAmbWVtKSkgeworICAgICAgICAgIG1lc3NhZ2UuZGF0YS5jb21tYW5kID0gUGlwZUNvbW1hbmQ6OlJFQ0VJVkVfRVJST1I7CisgICAgICAgICAgc2VuZE1lc3NhZ2UobVJlc3VsdFBpcGVGZHMsIG1lc3NhZ2UpOworICAgICAgICAgIHJldHVybjsKKyAgICAgIH0KKyAgICAgIG11dGV4ID0gSXBjTXV0ZXg6OkltcG9ydChtZW0pOworICAgICAgcHRocmVhZF9tdXRleF9sb2NrKCYobXV0ZXgtPmxvY2spKTsKKyAgICAgIHdoaWxlIChtdXRleC0+c2lnbmFsbGVkICE9IHRydWUpIHsKKyAgICAgICAgICBwdGhyZWFkX2NvbmRfd2FpdCgmKG11dGV4LT5jb25kKSwgJihtdXRleC0+bG9jaykpOworICAgICAgfQorICAgICAgdmFsID0gbXV0ZXgtPmNvdW50ZXI7CisgICAgICBwdGhyZWFkX211dGV4X3VubG9jaygmKG11dGV4LT5sb2NrKSk7CisKKyAgICAgICh2b2lkKVRlc3RCdWZmZXJQb29sQWxsb2NhdG9yOjpVbm1hcE1lbW9yeUZvck11dGV4KG1lbSk7CisgICAgICBpZiAocmhhbmRsZSkgeworICAgICAgICBuYXRpdmVfaGFuZGxlX2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N0YXR1c190IHN0YXR1cyA9IFVOS05PV05fRVJST1I7CisgICAgaWYgKG1BQUNEZWNvZGVyKSB7CisgICAgICAgIGFhY0RlY29kZXJfQ2xvc2UobUFBQ0RlY29kZXIpOworICAgICAgICBzdGF0dXMgPSBpbml0RGVjb2RlcigpOworICAgIH0KICAgICBtU2lnbmFsbGVkRXJyb3IgPSBmYWxzZTsKIAotICAgIHJldHVybiBDMl9PSzsKKyAgICByZXR1cm4gc3RhdHVzID09IE9LID8gQzJfT0sgOiBDMl9DT1JSVVBURUQ7CiB9CiAKIHZvaWQgQzJTb2Z0QWFjRGVjOjpvblJlc2V0KCkgewpAQCAtNTA5LDggKzUxNSw4IEBACiAKICAgICAgICAgICAgICAgICAvLyBUT0RPOiBlcnJvciBoYW5kbGluZywgcHJvcGVyIHVzYWdlLCBldGMuCiAgICAgICAgICAgICAgICAgQzJNZW1vcnlVc2FnZSB1c2FnZSA9IHsgQzJNZW1vcnlVc2FnZTo6Q1BVX1JFQUQsIEMyTWVtb3J5VXNhZ2U6OkNQVV9XUklURSB9OwotICAgICAgICAgICAgICAgIGMyX3N0YXR1c190IGVyciA9IHBvb2wtPmZldGNoTGluZWFyQmxvY2soCi0gICAgICAgICAgICAgICAgICAgICAgICBudW1TYW1wbGVzICogc2l6ZW9mKGludDE2X3QpLCB1c2FnZSwgJmJsb2NrKTsKKyAgICAgICAgICAgICAgICBzaXplX3QgYnVmZmVyU2l6ZSA9IG51bVNhbXBsZXMgKiBzaXplb2YoaW50MTZfdCk7CisgICAgICAgICAgICAgICAgYzJfc3RhdHVzX3QgZXJyID0gcG9vbC0+ZmV0Y2hMaW5lYXJCbG9jayhidWZmZXJTaXplLCB1c2FnZSwgJmJsb2NrKTsKICAgICAgICAgICAgICAgICBpZiAoZXJyICE9IEMyX09LKSB7CiAgICAgICAgICAgICAgICAgICAgIEFMT0dEKCJmYWlsZWQgdG8gZmV0Y2ggYSBsaW5lYXIgYmxvY2sgKCVkKSIsIGVycik7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzdGQ6OmJpbmQoZmlsbEVtcHR5V29yaywgXzEsIEMyX05PX01FTU9SWSk7CkBAIC01MjQsNyArNTMwLDcgQEAKICAgICAgICAgICAgICAgICAgICAgbVNpZ25hbGxlZEVycm9yID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0ZDo6YmluZChmaWxsRW1wdHlXb3JrLCBfMSwgQzJfQ09SUlVQVEVEKTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcmV0dXJuIFtidWZmZXIgPSBjcmVhdGVMaW5lYXJCdWZmZXIoYmxvY2spXSgKKyAgICAgICAgICAgICAgICByZXR1cm4gW2J1ZmZlciA9IGNyZWF0ZUxpbmVhckJ1ZmZlcihibG9jaywgMCwgYnVmZmVyU2l6ZSldKAogICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp1bmlxdWVfcHRyPEMyV29yaz4gJndvcmspIHsKICAgICAgICAgICAgICAgICAgICAgd29yay0+cmVzdWx0ID0gQzJfT0s7CiAgICAgICAgICAgICAgICAgICAgIEMyRnJhbWVEYXRhICZvdXRwdXQgPSB3b3JrLT53b3JrbGV0cy5mcm9udCgpLT5vdXRwdXQ7CkBAIC04NzcsMTAgKzg4MywxNCBAQAogICAgICAgICAgICAgd29yay0+d29ya2xldHMuZnJvbnQoKS0+b3V0cHV0LmNvbmZpZ1VwZGF0ZS5wdXNoX2JhY2soCiAgICAgICAgICAgICAgICAgICAgIEMyUGFyYW06OkNvcHkoY3VycmVudEJvb3N0RmFjdG9yKSk7CiAKLSAgICAgICAgICAgIEMyU3RyZWFtRHJjQ29tcHJlc3Npb25Nb2RlVHVuaW5nOjppbnB1dCBjdXJyZW50Q29tcHJlc3NNb2RlKDB1LAotICAgICAgICAgICAgICAgICAgICAoQzJDb25maWc6OmRyY19jb21wcmVzc2lvbl9tb2RlX3QpIGNvbXByZXNzTW9kZSk7Ci0gICAgICAgICAgICB3b3JrLT53b3JrbGV0cy5mcm9udCgpLT5vdXRwdXQuY29uZmlnVXBkYXRlLnB1c2hfYmFjaygKLSAgICAgICAgICAgICAgICAgICAgQzJQYXJhbTo6Q29weShjdXJyZW50Q29tcHJlc3NNb2RlKSk7CisgICAgICAgICAgICBpZiAoYW5kcm9pZF9nZXRfZGV2aWNlX2FwaV9sZXZlbCgpIDwgX19BTkRST0lEX0FQSV9TX18pIHsKKyAgICAgICAgICAgICAgICAvLyBXZSB1c2VkIHRvIHJlcG9ydCBEUkMgY29tcHJlc3Npb24gbW9kZSBpbiB0aGUgb3V0cHV0IGZvcm1hdAorICAgICAgICAgICAgICAgIC8vIGluIFEgYW5kIFIsIGJ1dCBzdG9wcGVkIGRvaW5nIHRoYXQgaW4gUworICAgICAgICAgICAgICAgIEMyU3RyZWFtRHJjQ29tcHJlc3Npb25Nb2RlVHVuaW5nOjppbnB1dCBjdXJyZW50Q29tcHJlc3NNb2RlKDB1LAorICAgICAgICAgICAgICAgICAgICAgICAgKEMyQ29uZmlnOjpkcmNfY29tcHJlc3Npb25fbW9kZV90KSBjb21wcmVzc01vZGUpOworICAgICAgICAgICAgICAgIHdvcmstPndvcmtsZXRzLmZyb250KCktPm91dHB1dC5jb25maWdVcGRhdGUucHVzaF9iYWNrKAorICAgICAgICAgICAgICAgICAgICAgICAgQzJQYXJhbTo6Q29weShjdXJyZW50Q29tcHJlc3NNb2RlKSk7CisgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIEMyU3RyZWFtRHJjRW5jb2RlZFRhcmdldExldmVsVHVuaW5nOjppbnB1dCBjdXJyZW50RW5jb2RlZFRhcmdldExldmVsKDB1LAogICAgICAgICAgICAgICAgICAgICAoQzJGbG9hdFZhbHVlKSAoZW5jVGFyZ2V0TGV2ZWwqLTAuMjUpKTsKQEAgLTkxMSw2ICs5MjEsMjkgQEAKIAogICAgIGludDMyX3Qgb3V0cHV0RGVsYXkgPSBtU3RyZWFtSW5mby0+b3V0cHV0RGVsYXk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gICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGNvbnZlcnRZVVY0MjBQbGFuYXIxNlRvWVVWNDIwUGxhbmFyKGRzdCwgc3JjWSwgc3JjVSwgc3JjViwgc3JjWVN0cmlkZSAvIDIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmNVU3RyaWRlIC8gMiwgc3JjVlN0cmlkZSAvIDIsCisgICAgICAgICAgICBjb252ZXJ0WVVWNDIwUGxhbmFyMTZUb1lVVjQyMFBsYW5hcihkc3RZLCBkc3RVLCBkc3RWLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjWSwgc3JjVSwgc3JjViwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyY1lTdHJpZGUgLyAyLCBzcmNVU3RyaWRlIC8gMiwgc3JjVlN0cmlkZSAvIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3RZU3RyaWRlLCBkc3RVVlN0cmlkZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XaWR0aCwgbUhlaWdodCk7CiAgICAgICAgIH0KQEAgLTcyNSw3ICs3MjIsNyBAQAogICAgICAgICBjb25zdCB1aW50OF90ICpzcmNVID0gKGNvbnN0IHVpbnQ4X3QgKilpbWctPnBsYW5lc1tBT01fUExBTkVfVV07CiAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKnNyY1YgPSAoY29uc3QgdWludDhfdCAqKWltZy0+cGxhbmVzW0FPTV9QTEFORV9WXTsKICAgICAgICAgY29weU91dHB1dEJ1ZmZlclRvWXV2UGxhbmFyRnJhbWUoCi0gICAgICAgICAgICAgICAgZHN0LCBzcmNZLCBzcmNVLCBzcmNWLAorICAgICAgICAgICAgICAgIGRzdFksIGRzdFUsIGRzdFYsIHNyY1ksIHNyY1UsIHNyY1YsCiAgICAgICAgICAgICAgICAgc3JjWVN0cmlkZSwgc3JjVVN0cmlkZSwgc3JjVl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BzX3NldF9keW5fcGFyYW1zX2lwLT5lX3ZpZF9kZWNfbW9kZSA9IGRlY19tb2RlOworICAgIHBzX3NldF9keW5fcGFyYW1zX29wLT51NF9zaXplID0gc2l6ZW9mKGloMjY0ZF9jdGxfc2V0X2NvbmZpZ19vcF90KTsKICAgICBJVl9BUElfQ0FMTF9TVEFUVVNfVCBzdGF0dXMgPSBpdmRlY19hcGlfZnVuY3Rpb24obURlY0hhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNfc2V0X2R5bl9wYXJhbXNfaXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzX3NldF9keW5fcGFyYW1zX29wKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNfaDI2NGRfc2V0X2R5bl9wYXJhbXNfaXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzX2gyNjRkX3NldF9keW5fcGFyYW1zX29wKTsKICAgICBpZiAoc3RhdHVzICE9IElWX1NVQ0NFU1MpIHsKLSAgICAgICAgQUxPR0UoImVycm9yIGluICVzOiAweCV4IiwgX19mdW5jX18sIHNfc2V0X2R5bl9wYXJhbXNfb3AudTRfZXJyb3JfY29kZSk7CisgICAgICAgIEFMT0dFKCJlcnJvciBpbiAlczogMHgleCIsIF9fZnVuY19fLCBwc19zZXRfZHluX3BhcmFtc19vcC0+dTRfZXJyb3JfY29kZSk7CiAgICAgICAgIHJldHVybiBVTktOT1dOX0VSUk9SOwogICAgIH0KIApAQCAtNDc3LDggKzQ4Niw4IEBACiB9CiAKIHZvaWQgQzJTb2Z0QXZjRGVjOjpnZXRWZXJzaW9uKCkgewotICAgIGl2ZF9jdGxfZ2V0dmVyc2lvbmluZm9faXBfdCBzX2dldF92ZXJzaW9uaW5mb19pcDsKLSAgICBpdmR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XZkX3ZpZGVvX2RlY29kZV9pcF90IHNfZGVjb2RlX2lwOwotICAgICAgICBpdmRfdmlkZW9fZGVjb2RlX29wX3Qgc19kZWNvZGVfb3A7CisgICAgICAgIGloMjY0ZF92aWRlb19kZWNvZGVfaXBfdCBzX2gyNjRkX2RlY29kZV9pcCA9IHt9OworICAgICAgICBpaDI2NGRfdmlkZW9fZGVjb2RlX29wX3Qgc19oMjY0ZF9kZWNvZGVfb3AgPSB7fTsKKyAgICAgICAgaXZkX3ZpZGVvX2RlY29kZV9pcF90ICpwc19kZWNvZGVfaXAgPSAmc19oMjY0ZF9kZWNvZGVfaXAuc19pdmRfdmlkZW9fZGVjb2RlX2lwX3Q7CisgICAgICAgIGl2ZF92aWRlb19kZWNvZGVfb3BfdCAqcHNfZGVjb2RlX29wID0gJnNfaDI2NGRfZGVjb2RlX29wLnNfaXZkX3ZpZGVvX2RlY29kZV9vcF90OwogICAgICAgICB7CiAgICAgICAgICAgICBDMkdyYXBoaWNWaWV3IHdWaWV3ID0gbU91dEJsb2NrLT5tYXAoKS5nZXQoKTsKICAgICAgICAgICAgIGlmICh3Vmlldy5lcnJvcigpKSB7CkBAIC04NDIsNyArODUzLDcgQEAKICAgICAgICAgICAgICAgICB3b3JrLT5yZXN1bHQgPSB3Vmlldy5lcnJvcigpOwogICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghc2V0RGVjb2RlQXJncygmc19kZWNvZGVfaXAsICZzX2RlY29kZV9vcCwgJnJWaWV3LCAmd1ZpZXcsCisgICAgICAgICAgICBpZiAoIXNldERlY29kZUFyZ3MocHNfZGVjb2RlX2lwLCBwc19kZWNvZGVfb3AsICZyVmlldywgJndWaWV3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluT2Zmc2V0ICsgaW5Qb3MsIGluU2l6ZSAtIGluUG9zLCB3b3JrSW5kZXgpKSB7CiAgICAgICAgICAgICAgICAgbVNpZ25hbGxlZEVycm9yID0gdHJ1ZTsKICAgICAgICAgICAgICAgICB3b3JrLT53b3JrbGV0c1Byb2Nlc3NlZCA9IDF1OwpAQCAtODU4LDI2ICs4NjksMjcgQEAKICAgICAgICAgICAgIFdPUkQzMiBkZWxheTsKICAgICAgICAgICAgIEdFVFRJTUUoJm1UaW1lU3RhcnQsIG51bGxwdHIpOwogICAgICAgICAgICAgVElNRV9ESUZGKG1UaW1lRW5kLCBtVGltZVN0YXJ0LCBkZWxheSk7Ci0gICAgICAgICAgICAodm9pZCkgaXZkZWNfYXBpX2Z1bmN0aW9uKG1EZWNIYW5kbGUsICZzX2RlY29kZV9pcCwgJnNfZGVjb2RlX29wKTsKKyAgICAgICAgICAgICh2b2lkKSBpdmRlY19hcGlfZnVuY3Rpb24obURlY0hhbmRsZSwgJnNfaDI2NGRfZGVjb2RlX2lwLCAmc19oMjY0ZF9kZWNvZGVfb3ApOwogICAgICAgICAgICAgV09SRDMyIGRlY29kZVRpbWU7CiAgICAgICAgICAgICBHRVRUSU1FKCZtVGltZUVuZCwgbnVsbHB0cik7CiAgICAgICAgICAgICBUSU1FX0RJRkYobVRpbWVTdGFydCwgbVRpbWVFbmQsIGRlY29kZVRpbWUpOwogICAgICAgICAgICAgQUxPR1YoImRlY29kZVRpbWU9JTZkIGRlbGF5PSU2ZCBudW1CeXRlcz0lNmQiLCBkZWNvZGVUaW1lLCBkZWxheSwKLSAgICAgICAgICAgICAgICAgIHNfZGVjb2RlX29wLnU0X251bV9ieXRlc19jb25zdW1lZCk7CisgICAgICAgICAgICAgICAgICBwc19kZWNvZGVfb3AtPnU0X251bV9ieXRlc19jb25zdW1lZCk7CiAgICAgICAgIH0KLSAgICAgICAgaWYgKElWRF9NRU1fQUxMT0NfRkFJTEVEID09IChzX2RlY29kZV9vcC51NF9lcnJvcl9jb2RlICYgSVZEX0VSUk9SX01BU0spKSB7CisgICAgICAgIGlmIChJVkRfTUVNX0FMTE9DX0ZBSUxFRCA9PSAocHNfZGVjb2RlX29wLT51NF9lcnJvcl9jb2RlICYgSVZEX0VSUk9SX01BU0spKSB7CiAgICAgICAgICAgICBBTE9HRSgiYWxsb2NhdGlvbiBmYWlsdXJlIGluIGRlY29kZXIiKTsKICAgICAgICAgICAgIG1TaWduYWxsZWRFcnJvciA9IHRydWU7CiAgICAgICAgICAgICB3b3JrLT53b3JrbGV0c1Byb2Nlc3NlZCA9IDF1OwogICAgICAgICAgICAgd29yay0+cmVzdWx0ID0gQzJfQ09SUlVQVEVEOwogICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICB9IGVsc2UgaWYgKElWRF9TVFJFQU1fV0lEVEhfSEVJR0hUX05PVF9TVVBQT1JURUQgPT0gKHNfZGVjb2RlX29wLnU0X2Vycm9yX2NvZGUgJiBJVkRfRVJST1JfTUFTSykpIHsKKyAgICAgICAgfSBlbHNlIGlmIChJVkRfU1RSRUFNX1dJRFRIX0hFSUdIVF9OT1RfU1VQUE9SVEVEID09CisgICAgICAgICAgICAgICAgKHBzX2RlY29kZV9vcC0+dTRfZXJyb3JfY29kZSAmIElWRF9FUlJPUl9NQVNLKSkgewogICAgICAgICAgICAgQUxPR0UoInVuc3VwcG9ydGVkIHJlc29sdXRpb24gOiAlZHglZCIsIG1XaWR0aCwgbUhlaWdodCk7CiAgICAgICAgICAgICBtU2lnbmFsbGVkRXJyb3IgPSB0cnVlOwogICAgICAgICAgICAgd29yay0+d29ya2xldHNQcm9jZXNzZWQgPSAxdTsKICAgICAgICAgICAgIHdvcmstPnJlc3VsdCA9IEMyX0NPUlJVUFRFRDsKICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfSBlbHNlIGlmIChJVkRfUkVTX0NIQU5HRUQgPT0gKHNfZGVjb2RlX29wLnU0X2Vycm9yX2NvZGUgJiBJVkRfRVJST1JfTUFTSykpIHsKKyAgICAgICAgfSBlbHNlIGlmIChJVkRfUkVTX0NIQU5HRUQgPT0gKHBzX2RlY29kZV9vcC0+dTRfZXJyb3JfY29kZSAmIElWRF9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sdCA9IEMyX0NPUlJVUFRFRDsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQotICAgICAgICBpZiAoc19kZWNvZGVfb3AuaTRfcmVvcmRlcl9kZXB0aCA+PSAwICYmIG1PdXRwdXREZWxheSAhPSBzX2RlY29kZV9vcC5pNF9yZW9yZGVyX2RlcHRoKSB7Ci0gICAgICAgICAgICBtT3V0cHV0RGVsYXkgPSBzX2RlY29kZV9vcC5pNF9yZW9yZGVyX2RlcHRoOworICAgICAgICBpZiAocHNfZGVjb2RlX29wLT5pNF9yZW9yZGVyX2RlcHRoID49IDAgJiYgbU91dHB1dERlbGF5ICE9IHBzX2RlY29kZV9vcC0+aTRfcmVvcmRlcl9kZXB0aCkgeworICAgICAgICAgICAgbU91dHB1dERlbGF5ID0gcHNfZGVjb2RlX29wLT5pNF9yZW9yZGVyX2RlcHRoOwogICAgICAgICAgICAgQUxPR1YoIk5ldyBPdXRwdXQgZGVsYXkgJWQgIiwgbU91dHB1dERlbGF5KTsKIAogICAgICAgICAgICAgQzJQb3J0QWN0dWFsRGVsYXlUdW5pbmc6Om91dHB1dCBvdXRwdXREZWxheShtT3V0cHV0RGVsYXkpOwpAQCAtOTEzLDE2ICs5MjUsMTYgQEAKICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgICAgaWYgKDAgPCBzX2RlY29kZV9vcC51NF9waWNfd2QgJiYgMCA8IHNfZGVjb2RlX29wLnU0X3BpY19odCkgeworICAgICAgICBpZiAoMCA8IHBzX2RlY29kZV9vcC0+dTRfcGljX3dkICYmIDAgPCBwc19kZWNvZGVfb3AtPnU0X3BpY19odCkgewogICAgICAgICAgICAgaWYgKG1IZWFkZXJEZWNvZGVkID09IGZhbHNlKSB7CiAgICAgICAgICAgICAgICAgbUhlYWRlckRlY29kZWQgPSB0cnVlOwotICAgICAgICAgICAgICAgIG1TdHJpZGUgPSBBTElHTjMyKHNfZGVjb2RlX29wLnU0X3BpY193ZCk7CisgICAgICAgICAgICAgICAgbVN0cmlkZSA9IEFMSUdOMzIocHNfZGVjb2RlX29wLT51NF9waWNfd2QpOwogICAgICAgICAgICAgICAgIHNldFBhcmFtcyhtU3RyaWRlLCBJVkRfREVDT0RFX0ZSQU1FKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChzX2RlY29kZV9vcC51NF9waWNfd2QgIT0gbVdpZHRoIHx8IHNfZGVjb2RlX29wLnU0X3BpY19odCAhPSBtSGVpZ2h0KSB7Ci0gICAgICAgICAgICAgICAgbVdpZHRoID0gc19kZWNvZGVfb3AudTRfcGljX3dkOwotICAgICAgICAgICAgICAgIG1IZWlnaHQgPSBzX2RlY29kZV9vcC51NF9waWNfaHQ7Ci0gICAgICAgICAgICAgICAgQ0hFQ0tfRVEoMHUsIHNfZGVjb2RlX29wLnU0X291dHB1dF9wcmVzZW50KTsKKyAgICAgICAgICAgIGlmIChwc19kZWNvZGVfb3AtPnU0X3BpY193ZCAhPSBtV2lkdGggfHwgcHNfZGVjb2RlX29wLT51NF9waWNfaHQgIT0gbUhlaWdodCkgeworICAgICAgICAgICAgICAgIG1XaWR0aCA9IHBzX2RlY29kZV9vcC0+dTRfcGljX3dkOworICAgICAgICAgICAgICAgIG1IZWlnaHQgPSBwc19kZWNvZGVfb3AtPnU0X3BpY19odDsKKyAgICAgICAgICAgICAgICBDSEVDS19FUSgwdSwgcHNfZGVjb2RlX29wLT51NF9vdXRwdXRfcHJlc2VudCk7CiAKICAgICAgICAgICAgICAgICBDMlN0cmVhbVBpY3R1cmVTaXplSW5mbzo6b3V0cHV0IHNpemUoMHUsIG1XaWR0aCwgbUhlaWdodCk7CiAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjp1bmlxdWVfcHRyPEMyU2V0dGluZ1Jlc3VsdD4+IGZhaWx1cmVzOwpAQCAtOTQxLDExICs5NTMsMTEgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICAodm9pZClnZXRWdWlQYXJhbXMoKTsKLSAgICAgICAgaGFzUGljdHVyZSB8PSAoMSA9PSBzX2RlY29kZV9vcC51NF9mcmFtZV9kZWNvZGVkX2ZsYWcpOwotICAgICAgICBpZiAoc19kZWNvZGVfb3AudTRfb3V0cHV0X3ByZXNlbnQpIHsKLSAgICAgICAgICAgIGZpbmlzaFdvcmsoc19kZWNvZGVfb3AudTRfdHMsIHdvcmspOworICAgICAgICBoYXNQaWN0dXJlIHw9ICgxID09IHBzX2RlY29kZV9vcC0+dTRfZnJhbWVfZGVjb2RlZF9mbGFnKTsKKyAgICAgICAgaWYgKHBzX2RlY29kZV9vcC0+dTRfb3V0cHV0X3ByZXNlbnQpIHsKKyAgICAgICAgICAgIGZpbmlzaFdvcmsocHNfZGVjb2RlX29wLT51NF90cywgd29yayk7CiAgICAgICAgIH0KLSAgICAgICAgaW5Qb3MgKz0gc19kZWNvZGVfb3AudTRfbnVtX2J5dGVzX2NvbnN1bWVkOworICAgICAgICBpblBvcyArPSBwc19kZWNvZGVfb3AtPnU0X251bV9ieXRlc19jb25zdW1lZDsKICAgICB9CiAgICAgaWYgKGVvcykgewogICAgICAgICBkcmFpbkludGVybmFsKERSQUlOX0NPTVBPTkVOVF9XSVRIX0VPUywgcG9vbCwgd29yayk7CkBAIC05ODMsMTYgKzk5NSwxOCBAQAogICAgICAgICAgICAgQUxPR0UoImdyYXBoaWMgdmlldyBtYXAgZmFpbGVkICVkIiwgd1ZpZXcuZXJyb3IoKSk7CiAgICAgICAgICAgICByZXR1cm4gQzJfQ09SUlVQVEVEOwogICAgICAgICB9Ci0gICAgICAgIGl2ZF92aWRlb19kZWNvZGVfaXBfdCBzX2RlY29kZV9pcDsKLSAgICAgICAgaXZkX3ZpZGVvX2RlY29kZV9vcF90IHNfZGVjb2RlX29wOwotICAgICAgICBpZiAoIXNldERlY29kZUFyZ3MoJnNfZGVjb2RlX2lwLCAmc19kZWNvZGVfb3AsIG51bGxwdHIsICZ3VmlldywgM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ICAgICAgICAgICAgLmJ1aWxkKCkpOwogCiAgICAgICAgIGFkZFBhcmFtZXRlcigKKyAgICAgICAgICAgICAgICBEZWZpbmVQYXJhbShtUGljdHVyZVF1YW50aXphdGlvbiwgQzJfUEFSQU1LRVlfUElDVFVSRV9RVUFOVElaQVRJT04pCisgICAgICAgICAgICAgICAgLndpdGhEZWZhdWx0KEMyU3RyZWFtUGljdHVyZVF1YW50aXphdGlvblR1bmluZzo6b3V0cHV0OjpBbGxvY1NoYXJlZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIDAgLyogZmxleENvdW50ICovLCAwdSAvKiBzdHJlYW0gKi8pKQorICAgICAgICAgICAgICAgIC53aXRoRmllbGRzKHtDMkYobVBpY3R1cmVRdWFudGl6YXRpb24sIG0udmFsdWVzWzBdLnR5cGVfKS5vbmVPZigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge0MyQ29uZmlnOjpwaWN0dXJlX3R5cGVfdChJX0ZSQU1FKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbmZpZzo6cGljdHVyZV90eXBlX3QoUF9GUkFNRSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJDb25maWc6OnBpY3R1cmVfdHlwZV90KEJfRlJBTUUpfSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyRihtUGljdHVyZVF1YW50aXphdGlvbiwgbS52YWx1ZXNbMF0ubWluKS5hbnkoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJGKG1QaWN0dXJlUXVhbnRpemF0aW9uLCBtLnZhbHVlc1swXS5tYXgpLmFueSgpfSkKKyAgICAgICAgICAgICAgICAud2l0aFNldHRlcihQaWN0dXJlUXVhbnRpemF0aW9uU2V0dGVyKQorICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICBhZGRQYXJhbWV0ZXIoCiAgICAgICAgICAgICAgICAgRGVmaW5lUGFyYW0obUFjdHVhbElucHV0RGVsYXksIEMyX1BBUkFNS0VZX0lOUFVUX0RFTEFZKQogICAgICAgICAgICAgICAgIC53aXRoRGVmYXVsdChuZXcgQzJQb3J0QWN0dWFsRGVsYXlUdW5pbmc6OmlucHV0KERFRkFVTFRfQl9GUkFNRVMpKQogICAgICAgICAgICAgICAgIC53aXRoRmllbGRzKHtDMkYobUFjdHVhbElucHV0RGVsYXksIHZhbHVlKS5pblJhbmdlKDAsIE1BWF9CX0ZSQU1FUyl9KQpAQCAtMTk4LDYgKzIxNCw0MiBAQAogICAgICAgICAgICAgICAgIC53aXRoRmllbGRzKHtDMkYobVN5bmNGcmFtZVBlcmlvZCwgdmFsdWUpLmFueSgpfSkKICAgICAgICAgICAgICAgICAud2l0aFNldHRlcihTZXR0ZXI8ZGVjbHR5cGUoKm1TeW5jRnJhbWVQZXJpb2QpPjo6U3RyaWN0VmFsdWVXaXRoTm9EZXBzKQogICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICBhZGRQYXJhbWV0ZXIoCisgICAgICAgICAgICAgICAgRGVmaW5lUGFyYW0obUNvbG9yQXNwZWN0cywgQzJfUEFSQU1LRVlfQ09MT1JfQVNQRUNUUykKKyAgICAgICAgICAgICAgICAud2l0aERlZmF1bHQobmV3IEMyU3RyZWFtQ29sb3JBc3BlY3RzSW5mbzo6aW5wdXQoCisgICAgICAgICAgICAgICAgICAgICAgICAwdSwgQzJDb2xvcjo6UkFOR0VfVU5TUEVDSUZJRUQsIEMyQ29sb3I6OlBSSU1BUklFU19VTlNQRUNJRklFRCwKKyAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29sb3I6OlRSQU5TRkVSX1VOU1BFQ0lGSUVELCBDMkNvbG9yOjpNQVRSSVhfVU5TUEVDSUZJRUQpKQorICAgICAgICAgICAgICAgIC53aXRoRmllbGRzKHsKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2xvckFzcGVjdHMsIHJhbmdlKS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpSQU5HRV9VTlNQRUNJRklFRCwgICAgIEMyQ29sb3I6OlJBTkdFX09USEVSKSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2xvckFzcGVjdHMsIHByaW1hcmllcykuaW5SYW5nZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJDb2xvcjo6UFJJTUFSSUVTX1VOU1BFQ0lGSUVELCBDMkNvbG9yOjpQUklNQVJJRVNfT1RIRVIpLAorICAgICAgICAgICAgICAgICAgICBDMkYobUNvbG9yQXNwZWN0cywgdHJhbnNmZXIpLmluUmFuZ2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29sb3I6OlRSQU5TRkVSX1VOU1BFQ0lGSUVELCAgQzJDb2xvcjo6VFJBTlNGRVJfT1RIRVIpLAorICAgICAgICAgICAgICAgICAgICBDMkYobUNvbG9yQXNwZWN0cywgbWF0cml4KS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpNQVRSSVhfVU5TUEVDSUZJRUQsICAgIEMyQ29sb3I6Ok1BVFJJWF9PVEhFUikKKyAgICAgICAgICAgICAgICB9KQorICAgICAgICAgICAgICAgIC53aXRoU2V0dGVyKENvbG9yQXNwZWN0c1NldHRlcikKKyAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CisKKyAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1Db2RlZENvbG9yQXNwZWN0cywgQzJfUEFSQU1LRVlfVlVJX0NPTE9SX0FTUEVDVFMpCisgICAgICAgICAgICAgICAgLndpdGhEZWZhdWx0KG5ldyBDMlN0cmVhbUNvbG9yQXNwZWN0c0luZm86Om91dHB1dCgKKyAgICAgICAgICAgICAgICAgICAgICAgIDB1LCBDMkNvbG9yOjpSQU5HRV9MSU1JVEVELCBDMkNvbG9yOjpQUklNQVJJRVNfVU5TUEVDSUZJRUQsCisgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpUUkFOU0ZFUl9VTlNQRUNJRklFRCwgQzJDb2xvcjo6TUFUUklYX1VOU1BFQ0lGSUVEKSkKKyAgICAgICAgICAgICAgICAud2l0aEZpZWxkcyh7CisgICAgICAgICAgICAgICAgICAgIEMyRihtQ29kZWRDb2xvckFzcGVjdHMsIHJhbmdlKS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpSQU5HRV9VTlNQRUNJRklFRCwgICAgIEMyQ29sb3I6OlJBTkdFX09USEVSKSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2RlZENvbG9yQXNwZWN0cywgcHJpbWFyaWVzKS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpQUklNQVJJRVNfVU5TUEVDSUZJRUQsIEMyQ29sb3I6OlBSSU1BUklFU19PVEhFUiksCisgICAgICAgICAgICAgICAgICAgIEMyRihtQ29kZWRDb2xvckFzcGVjdHMsIHRyYW5zZmVyKS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpUUkFOU0ZFUl9VTlNQRUNJRklFRCwgIEMyQ29sb3I6OlRSQU5TRkVSX09USEVSKSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2RlZENvbG9yQXNwZWN0cywgbWF0cml4KS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpNQVRSSVhfVU5TUEVDSUZJRUQsICAgIEMyQ29sb3I6Ok1BVFJJWF9PVEhFUikKKyAgICAgICAgICAgICAgICB9KQorICAgICAgICAgICAgICAgIC53aXRoU2V0dGVyKENvZGVkQ29sb3JBc3BlY3RzU2V0dGVyLCBtQ29sb3JBc3BlY3RzKQorICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKICAgICB9CiAKICAgICBzdGF0aWMgQzJSIElucHV0RGVsYXlTZXR0ZXIoCkBAIC0yMjAsNiArMjcyLDcgQEAKICAgICAgICAgcmV0dXJuIHJlczsKICAgICB9CiAKKwogICAgIHN0YXRpYyBDMlIgU2l6ZVNldHRlcihib29sIG1heUJsb2NrLCBjb25zdCBDMlA8QzJTdHJlYW1QaWN0dXJlU2l6ZUluZm86OmlucHV0PiAmb2xkTWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyUDxDMlN0cmVhbVBpY3R1cmVTaXplSW5mbzo6aW5wdXQ+ICZtZSkgewogICAgICAgICAodm9pZCltYXlCbG9jazsKQEAgLTMzNiw2ICszODksOTUgQEAKICAgICAgICAgcmV0dXJuIEMyUjo6T2soKTsKICAgICB9CiAKKyAgICBzdGF0aWMgQzJSIFBpY3R1cmVRdWFudGl6YXRpb25TZXR0ZXIoYm9vbCBtYXlCbG9jaywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJQPEMyU3RyZWFtUGljdHVyZVF1YW50aXphdGlvblR1bmluZzo6b3V0cHV0PiAmbWUpIHsKKyAgICAgICAgKHZvaWQpbWF5QmxvY2s7CisgICAgICAgICh2b2lkKW1lOworCisgICAgICAgIC8vIFRPRE86IHJlZmFjdG9yIHdpdGggc2FtZSBhbGdvcml0aG0gaW4gdGhlIFNldFFwKCkKKyAgICAgICAgaW50MzJfdCBpTWluID0gREVGQVVMVF9JX1FQX01JTiwgcE1pbiA9IERFRkFVTFRfUF9RUF9NSU4sIGJNaW4gPSBERUZBVUxUX0JfUVBfTUlOOworICAgICAgICBpbnQzMl90IGlNYXggPSBERUZBVUxUX0lfUVBfTUFYLCBwTWF4ID0gREVGQVVMVF9QX1FQX01BWCwgYk1heCA9IERFRkFVTFRfQl9RUF9NQVg7CisKKyAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBtZS52LmZsZXhDb3VudCgpOyArK2kpIHsKKyAgICAgICAgICAgIGNvbnN0IEMyUGljdHVyZVF1YW50aXphdGlvblN0cnVjdCAmbGF5ZXIgPSBtZS52Lm0udmFsdWVzW2ldOworCisgICAgICAgICAgICBpZiAobGF5ZXIudHlwZV8gPT0gQzJDb25maWc6OnBpY3R1cmVfdHlwZV90KElfRlJBTUUpKSB7CisgICAgICAgICAgICAgICAgaU1heCA9IGxheWVyLm1heDsKKyAgICAgICAgICAgICAgICBpTWluID0gbGF5ZXIubWluOworICAgICAgICAgICAgICAgIEFMT0dWKCJpTWluICVkIGlNYXggJWQiLCBpTWluLCBpTWF4KTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobGF5ZXIudHlwZV8gPT0gQzJDb25maWc6OnBpY3R1cmVfdHlwZV90KFBfRlJBTUUpKSB7CisgICAgICAgICAgICAgICAgcE1heCA9IGxheWVyLm1heDsKKyAgICAgICAgICAgICAgICBwTWluID0gbGF5ZXIubWluOworICAgICAgICAgICAgICAgIEFMT0dWKCJwTWluICVkIHBNYXggJWQiLCBwTWluLCBwTWF4KTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobGF5ZXIudHlwZV8gPT0gQzJDb25maWc6OnBpY3R1cmVfdHlwZV90KEJfRlJBTUUpKSB7CisgICAgICAgICAgICAgICAgYk1heCA9IGxheWVyLm1heDsKKyAgICAgICAgICAgICAgICBiTWluID0gbGF5ZXIubWluOworICAgICAgICAgICAgICAgIEFMT0dWKCJiTWluICVkIGJNYXggJWQiLCBiTWluLCBiTWF4KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEFMT0dWKCJQaWN0dXJlUXVhbnRpemF0aW9uU2V0dGVyKGVudHJ5KTogaSAlZC0lZCBwICVkLSVkIGIgJWQtJWQiLAorICAgICAgICAgICAgICBpTWluLCBpTWF4LCBwTWluLCBwTWF4LCBiTWluLCBiTWF4KTsKKworICAgICAgICAvLyBlbnN1cmUgd2UgaGF2ZSBsZWdhbCB2YWx1ZXMKKyAgICAgICAgaU1heCA9IHN0ZDo6Y2xhbXAoaU1heCwgQ09ERUNfUVBfTUlOLCBDT0RFQ19RUF9NQVgpOworICAgICAgICBpTWluID0gc3RkOjpjbGFtcChpTWluLCBDT0RFQ19RUF9NSU4sIENPREVDX1FQX01BWCk7CisgICAgICAgIHBNYXggPSBzdGQ6OmNsYW1wKHBNYXgsIENPREVDX1FQX01JTiwgQ09ERUNfUVBfTUFYKTsKKyAgICAgICAgcE1pbiA9IHN0ZDo6Y2xhbXAocE1pbiwgQ09ERUNfUVBfTUlOLCBDT0RFQ19RUF9NQVgpOworICAgICAgICBiTWF4ID0gc3RkOjpjbGFtcChiTWF4LCBDT0RFQ19RUF9NSU4sIENPREVDX1FQX01BWCk7CisgICAgICAgIGJNaW4gPSBzdGQ6OmNsYW1wKGJNaW4sIENPREVDX1FQX01JTiwgQ09ERUNfUVBfTUFYKTsKKworICAgICAgICAvLyBwdXQgdGhlbSBiYWNrIGludG8gdGhlIHN0cnVjdHVyZQorICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG1lLnYuZmxleENvdW50KCk7ICsraSkgeworICAgICAgICAgICAgY29uc3QgQzJQaWN0dXJlUXVhbnRpemF0aW9uU3RydWN0ICZsYXllciA9IG1lLnYubS52YWx1ZXNbaV07CisKKyAgICAgICAgICAgIGlmIChsYXllci50eXBlXyA9PSBDMkNvbmZpZzo6cGljdHVyZV90eXBlX3QoSV9GUkFNRSkpIHsKKyAgICAgICAgICAgICAgICBtZS5zZXQoKS5tLnZhbHVlc1tpXS5tYXggPSBpTWF4OworICAgICAgICAgICAgICAgIG1lLnNldCgpLm0udmFsdWVzW2ldLm1pbiA9IGlNaW47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobGF5ZXIudHlwZV8gPT0gQzJDb25maWc6OnBpY3R1cmVfdHlwZV90KFBfRlJBTUUpKSB7CisgICAgICAgICAgICAgICAgbWUuc2V0KCkubS52YWx1ZXNbaV0ubWF4ID0gcE1heDsKKyAgICAgICAgICAgICAgICBtZS5zZXQoKS5tLnZhbHVlc1tpXS5taW4gPSBwTWluOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGxheWVyLnR5cGVfID09IEMyQ29uZmlnOjpwaWN0dXJlX3R5cGVfdChCX0ZSQU1FKSkgeworICAgICAgICAgICAgICAgIG1lLnNldCgpLm0udmFsdWVzW2ldLm1heCA9IGJNYXg7CisgICAgICAgICAgICAgICAgbWUuc2V0KCkubS52YWx1ZXNbaV0ubWluID0gYk1pbjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEFMT0dWKCJQaWN0dXJlUXVhbnRpemF0aW9uU2V0dGVyKGV4aXQpOiBpICVkLSVkIHAgJWQtJWQgYiAlZC0lZCIsCisgICAgICAgICAgICAgIGlNaW4sIGlNYXgsIHBNaW4sIHBNYXgsIGJNaW4sIGJNYXgpOworCisgICAgICAgIHJldHVybiBDMlI6Ok9rKCk7CisgICAgfQorCisgICAgc3RhdGljIEMyUiBDb2xvckFzcGVjdHNTZXR0ZXIoYm9vbCBtYXlCbG9jaywgQzJQPEMyU3RyZWFtQ29sb3JBc3BlY3RzSW5mbzo6aW5wdXQ+ICZtZSkgeworICAgICAgICAodm9pZCltYXlCbG9jazsKKyAgICAgICAgaWYgKG1lLnYucmFuZ2UgPiBDMkNvbG9yOjpSQU5HRV9PVEhFUikgeworICAgICAgICAgICAgICAgIG1lLnNldCgpLnJhbmdlID0gQzJDb2xvcjo6UkFOR0VfT1RIRVI7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1lLnYucHJpbWFyaWVzID4gQzJDb2xvcjo6UFJJTUFSSUVTX09USEVSKSB7CisgICAgICAgICAgICAgICAgbWUuc2V0KCkucHJpbWFyaWVzID0gQzJDb2xvcjo6UFJJTUFSSUVTX09USEVSOworICAgICAgICB9CisgICAgICAgIGlmIChtZS52LnRyYW5zZmVyID4gQzJDb2xvcjo6VFJBTlNGRVJfT1RIRVIpIHsKKyAgICAgICAgICAgICAgICBtZS5zZXQoKS50cmFuc2ZlciA9IEMyQ29sb3I6OlRSQU5TRkVSX09USEVSOworICAgICAgICB9CisgICAgICAgIGlmIChtZS52Lm1hdHJpeCA+IEMyQ29sb3I6Ok1BVFJJWF9PVEhFUikgeworICAgICAgICAgICAgICAgIG1lLnNldCgpLm1hdHJpeCA9IEMyQ29sb3I6Ok1BVFJJWF9PVEhFUjsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gQzJSOjpPaygpOworICAgIH0KKworICAgIHN0YXRpYyBDMlIgQ29kZWRDb2xvckFzcGVjdHNTZXR0ZXIoYm9vbCBtYXlCbG9jaywgQzJQPEMyU3RyZWFtQ29sb3JBc3BlY3RzSW5mbzo6b3V0cHV0PiAmbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBDMlA8QzJTdHJlYW1Db2xvckFzcGVjdHNJbmZvOjppbnB1dD4gJmNvZGVkKSB7CisgICAgICAgICh2b2lkKW1heUJsb2NrOworICAgICAgICBtZS5zZXQoKS5yYW5nZSA9IGNvZGVkLnYucmFuZ2U7CisgICAgICAgIG1lLnNldCgpLnByaW1hcmllcyA9IGNvZGVkLnYucHJpbWFyaWVzOworICAgICAgICBtZS5zZXQoKS50cmFuc2ZlciA9IGNvZGVkLnYudHJhbnNmZXI7CisgICAgICAgIG1lLnNldCgpLm1hdHJpeCA9IGNvZGVkLnYubWF0cml4OworICAgICAgICByZXR1cm4gQzJSOjpPaygpOworICAgIH0KKwogICAgIElWX1BST0ZJTEVfVCBnZXRQcm9maWxlX2woKSBjb25zdCB7CiAgICAgICAgIHN3aXRjaCAobVByb2ZpbGVMZXZlbC0+cHJvZmlsZSkgewogICAgICAgICBjYXNlIFBST0ZJTEVfQVZDX0NPTlNUUkFJTkVEX0JBU0VMSU5FOiAgW1tmYWxsdGhyb3VnaF1dOwpAQCAtMzkzLDYgKzUzNSwxMSBAQAogICAgIHN0ZDo6c2hhcmVkX3B0cjxDMlN0cmVhbUJpdHJhdGVJbmZvOjpvd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Ml90IGlNYXggPSBERUZBVUxUX0lfUVBfTUFYLCBwTWF4ID0gREVGQVVMVF9QX1FQX01BWCwgYk1heCA9IERFRkFVTFRfQl9RUF9NQVg7CiAKLSAgICBzX3FwX2lwLnU0X3BfcXAgPSBERUZBVUxUX1BfUVA7Ci0gICAgc19xcF9pcC51NF9wX3FwX21heCA9IERFRkFVTFRfUVBfTUFYOwotICAgIHNfcXBfaXAudTRfcF9xcF9taW4gPSBERUZBVUxUX1FQX01JTjsKKyAgICBJbnRmSW1wbDo6TG9jayBsb2NrID0gbUludGYtPmxvY2soKTsKIAotICAgIHNfcXBfaXAudTRfYl9xcCA9IERFRkFVTFRfUF9RUDsKLSAgICBzX3FwX2lwLnU0X2JfcXBfbWF4ID0gREVGQVVMVF9RUF9NQVg7Ci0gICAgc19xcF9pcC51NF9iX3FwX21pbiA9IERFRkFVTFRfUVBfTUlOOworICAgIHN0ZDo6c2hhcmVkX3B0cjxDMlN0cmVhbVBpY3R1cmVRdWFudGl6YXRpb25UdW5pbmc6Om91dHB1dD4gcXAgPQorICAgICAgICAgICAgICAgICAgICBtSW50Zi0+Z2V0UGljdHVyZVF1YW50aXphdGlvbl9sKCk7CisgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBxcC0+ZmxleENvdW50KCk7ICsraSkgeworICAgICAgICBjb25zdCBDMlBpY3R1cmVRdWFudGl6YXRpb25TdHJ1Y3QgJmxheWVyID0gcXAtPm0udmFsdWVzW2ldOworCisgICAgICAgIGlmIChsYXllci50eXBlXyA9PSBDMkNvbmZpZzo6cGljdHVyZV90eXBlX3QoSV9GUkFNRSkpIHsKKyAgICAgICAgICAgIGlNYXggPSBsYXllci5tYXg7CisgICAgICAgICAgICBpTWluID0gbGF5ZXIubWluOworICAgICAgICAgICAgQUxPR1YoImlNaW4gJWQgaU1heCAlZCIsIGlNaW4sIGlNYXgpOworICAgICAgICB9IGVsc2UgaWYgKGxheWVyLnR5cGVfID09IEMyQ29uZmlnOjpwaWN0dXJlX3R5cGVfdChQX0ZSQU1FKSkgeworICAgICAgICAgICAgcE1heCA9IGxheWVyLm1heDsKKyAgICAgICAgICAgIHBNaW4gPSBsYXllci5taW47CisgICAgICAgICAgICBBTE9HVigicE1pbiAlZCBwTWF4ICVkIiwgcE1pbiwgcE1heCk7CisgICAgICAgIH0gZWxzZSBpZiAobGF5ZXIudHlwZV8gPT0gQzJDb25maWc6OnBpY3R1cmVfdHlwZV90KEJfRlJBTUUpKSB7CisgICAgICAgICAgICBiTWF4ID0gbGF5ZXIubWF4OworICAgICAgICAgICAgYk1pbiA9IGxheWVyLm1pbjsKKyAgICAgICAgICAgIEFMT0dWKCJiTWluICVkIGJNYXggJWQiLCBiTWluLCBiTWF4KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHNfcXBfaXAudTRfaV9xcF9tYXggPSBpTWF4OworICAgIHNfcXBfaXAudTRfaV9xcF9taW4gPSBpTWluOworICAgIHNfcXBfaXAudTRfcF9xcF9tYXggPSBwTWF4OworICAgIHNfcXBfaXAudTRfcF9xcF9taW4gPSBwTWluOworICAgIHNfcXBfaXAudTRfYl9xcF9tYXggPSBiTWF4OworICAgIHNfcXBfaXAudTRfYl9xcF9taW4gPSBiTWluOworCisgICAgLy8gZW5zdXJlIGluaXRpYWwgcXAgdmFsdWVzIGFyZSB3aXRoaW4gb3VyIG5ld2x5IGNvbmZpZ3VyZWQgYm91bmRzLi4uCisgICAgc19xcF9pcC51NF9pX3FwID0gc3RkOjpjbGFtcChERUZBVUxUX0lfUVAsIGlNaW4sIGlNYXgpOworICAgIHNfcXBfaXAudTRfcF9xcCA9IHN0ZDo6Y2xhbXAoREVGQVVMVF9QX1FQLCBwTWluLCBwTWF4KTsKKyAgICBzX3FwX2lwLnU0X2JfcXAgPSBzdGQ6OmNsYW1wKERFRkFVTFRfQl9RUCwgYk1pbiwgYk1heCk7CisKKyAgICBBTE9HVigic2V0UXAoKTogaSAlZC0lZCBwICVkLSVkIGIgJWQtJWQiLCBpTWluLCBp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jb3JkczsKLSAgICAgICAgc19pbml0X2lwLnBzX21lbV9yZWMgPSBtTWVtUmVjb3JkczsKLSAgICAgICAgc19pbml0X2lwLnU0X21heF93ZCA9IHdpZHRoOwotICAgICAgICBzX2luaXRfaXAudTRfbWF4X2h0ID0gaGVpZ2h0OwotICAgICAgICBzX2luaXRfaXAudTRfbWF4X3JlZl9jbnQgPSBERUZBVUxUX01BWF9SRUZfRlJNOwotICAgICAgICBzX2luaXRfaXAudTRfbWF4X3Jlb3JkZXJfY250ID0gREVGQVVMVF9NQVhfUkVPUkRFUl9GUk07Ci0gICAgICAgIHNfaW5pdF9pcC51NF9tYXhfbGV2ZWwgPSBtQVZDRW5jTGV2ZWw7Ci0gICAgICAgIHNfaW5pdF9pcC5lX2lucF9jb2xvcl9mbXQgPSBtSXZWaWRlb0NvbG9yRm9ybWF0OworICAgICAgICBwc19pbml0X2lwLT5lX2NtZCA9IElWX0NNRF9JTklUOworICAgICAgICBwc19pbml0X2lwLT51NF9udW1fbWVtX3JlYyA9IG1OdW1NZW1SZWNvcmRzOworICAgICAgICBwc19pbml0X2lwLT5wc19tZW1fcmVjID0gbU1lbVJlY29yZHM7CisgICAgICAgIHBzX2luaXRfaXAtPnU0X21heF93ZCA9IHdpZHRoOworICAgICAgICBwc19pbml0X2lwLT51NF9tYXhfaHQgPSBoZWlnaHQ7CisgICAgICAgIHBzX2luaXRfaXAtPnU0X21heF9yZWZfY250ID0gREVGQVVMVF9NQVhfUkVGX0ZSTTsKKyAgICAgICAgcHNfaW5pdF9pcC0+dTRfbWF4X3Jlb3JkZXJfY250ID0gREVGQVVMVF9NQVhfUkVPUkRFUl9GUk07CisgICAgICAgIHBzX2luaXRfaXAtPnU0X21heF9sZXZlbCA9IG1BVkNFbmNMZXZlbDsKKyAgICAgICAgcHNfaW5pdF9pcC0+ZV9pbnBfY29sb3JfZm10ID0gbUl2VmlkZW9Db2xvckZvcm1hdDsKIAogICAgICAgICBpZiAobVJlY29uRW5hYmxlIHx8IG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aXBfdCAqcHNfZW5jb2RlX2lwID0gJnNfdmlkZW9fZW5jb2RlX2lwLnNfaXZlX2lwOworICAgIGl2ZV92aWRlb19lbmNvZGVfb3BfdCAqcHNfZW5jb2RlX29wID0gJnNfdmlkZW9fZW5jb2RlX29wLnNfaXZlX29wOworICAgIG1lbXNldChwc19lbmNvZGVfb3AsIDAsIHNpemVvZigqcHNfZW5jb2RlX29wKSk7CiAKICAgICBpZiAoIW1TcHNQcHNIZWFkZXJSZWNlaXZlZCkgewogICAgICAgICBjb25zdGV4cHIgdWludDMyX3Qga0hlYWRlckxlbmd0aCA9IE1JTl9TVFJFQU1fU0laRTsKICAgICAgICAgdWludDhfdCBoZWFkZXJba0hlYWRlckxlbmd0aF07CiAgICAgICAgIGVycm9yID0gc2V0RW5jb2RlQXJncygKLSAgICAgICAgICAgICAgICAmc19lbmNvZGVfaXAsICZzX2VuY29kZV9vcCwgbnVsbHB0ciwgaGVhZGVyLCBrSGVhZGVyTGVuZ3RoLCB3b3JrSW5kZXgpOworICAgICAgICAgICAgICAgIHBzX2VuY29kZV9pcCwgcHNfZW5jb2RlX29wLCBudWxscHRyLCBoZWFkZXIsIGtIZWFkZXJMZW5ndGgsIHdvcmtJbmRleCk7CiAgICAgICAgIGlmIChlcnJvciAhPSBDMl9PSykgewogICAgICAgICAgICAgQUxPR0UoInNldEVuY29kZUFyZ3MgZmFpbGVkOiAlZCIsIGVycm9yKTsKICAgICAgICAgICAgIG1TaWduYWxsZWRFcnJvciA9IHRydWU7CkBAIC0xNDQ1LDIyICsxNjg3LDIyIEBACiAgICAgICAgICAgICB3b3JrLT53b3JrbGV0c1Byb2Nlc3NlZCA9IDF1OwogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9Ci0gICAgICAgIHN0YXR1cyA9IGl2ZV9hcGlfZnVuY3Rpb24obUNvZGVjQ3R4LCAmc19lbmNvZGVfaXAsICZzX2VuY29kZV9vcCk7CisgICAgICAgIHN0YXR1cyA9IGl2ZV9hcGlfZnVuY3Rpb24obUNvZGVjQ3R4LCBwc19lbmNvZGVfaXAsIHBzX2VuY29kZV9vcCk7CiAKICAgICAgICAgaWYgKElWX1NVQ0NFU1MgIT0gc3RhdHVzKSB7CiAgICAgICAgICAgICBBTE9HRSgiRW5jb2RlIGhlYWRlciBmYWlsZWQgPSAweCV4XG4iLAotICAgICAgICAgICAgICAgICAgICBzX2VuY29kZV9vcC51NF9lcnJvcl9jb2RlKTsKKyAgICAgICAgICAgICAgICAgICAgcHNfZW5jb2RlX29wLT51NF9lcnJvcl9jb2RlKTsKICAgICAgICAgICAgIHdvcmstPndvcmtsZXRzUHJvY2Vzc2VkID0gMXU7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICBBTE9HVigiQnl0ZXMgR2VuZXJhdGVkIGluIGhlYWRlciAlZFxuIiwKLSAgICAgICAgICAgICAgICAgICAgc19lbmNvZGVfb3Auc19vdXRfYnVmLnU0X2J5dGVzKTsKKyAgICAgICAgICAgICAgICAgICAgcHNfZW5jb2RlX29wLT5zX291dF9idWYudTRfYnl0ZXMpOwogICAgICAgICB9CiAKICAgICAgICAgbVNwc1Bwc0hlYWRlclJlY2VpdmVkID0gdHJ1ZTsKIAogICAgICAgICBzdGQ6OnVuaXF1ZV9wdHI8QzJTdHJlYW1Jbml0RGF0YUluZm86Om91dHB1dD4gY3NkID0KLSAgICAgICAgICAgIEMyU3RyZWFtSW5pdERhdGFJbmZvOjpvdXRwdXQ6OkFsbG9jVW5pcXVlKHNfZW5jb2RlX29wLnNfb3V0X2J1Zi51NF9ieXRlcywgMHUpOworICAgICAgICAgICAgQzJTdHJlYW1Jbml0RGF0YUluZm86Om91dHB1dDo6QWxsb2NVbmlxdWUocHNfZW5jb2RlX29wLT5zX291dF9idWYudTRfYnl0ZXMsIDB1KTsKICAgICAgICAgaWYgKCFjc2QpIHsKICAgICAgICAgICAgIEFMT0dFKCJDU0QgYWxsb2NhdGlvbiBmYWlsZWQiKTsKICAgICAgICAgICAgIG1TaWduYWxsZWRFcnJvciA9IHRydWU7CkBAIC0xNDY4LDcgKzE3MTAsNyBAQAogICAgICAgICAgICAgd29yay0+d29ya2xldHNQcm9jZXNzZWQgPSAxdTsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQotICAgICAgICBtZW1jcHkoY3NkLT5tLnZhbHVlLCBoZWFkZXIsIHNfZW5jb2RlX29wLnNfb3V0X2J1Zi51NF9ieXRlcyk7CisgICAgICAgIG1lbWNweShjc2QtPm0udmFsdWUsIGhlYWRlciwgcHNfZW5jb2RlX29wLT5zX291dF9idWYudTRfYnl0ZXMpOwogICAgICAgICB3b3JrLT53b3JrbGV0cy5mcm9udCgpLT5vdXRwdXQuY29uZmlnVXBkYXRlLnB1c2hfYmFjayhzdGQ6Om1vdmUoY3NkKSk7CiAKICAgICAgICAgRFVNUF9UT19GSUxFKApAQCAtMTU2Miw3ICsxODA0LDcgQEAKICAgICAgICAgfQogCiAgICAgICAgIGVycm9yID0gc2V0RW5jb2RlQXJncygKLSAgICAgICAgICAgICAgICAmc19lbmNvZGVfaXAsICZzX2VuY29kZV9vcCwgdmlldy5nZXQoKSwgd1ZpZXcuYmFzZSgpLCB3Vmlldy5jYXBhY2l0eSgpLCB3b3JrSW5kZXgpOworICAgICAgICAgICAgICAgIHBzX2VuY29kZV9pcCwgcHNfZW5jb2RlX29wLCB2aWV3LmdldCgpLCB3Vmlldy5iYXNlKCksIHdWaWV3LmNhcGFjaXR5KCksIHdvcmtJbmRleCk7CiAgICAgICAgIGlmIChlcnJvciAhPSBDMl9PSykgewogICAgICAgICAgICAgQUxPR0UoInNldEVuY29kZUFyZ3MgZmFpbGVkIDogJWQiLCBlcnJvcik7CiAgICAgICAgICAgICBtU2lnbmFsbGVkRXJyb3IgPSB0cnVlOwpAQCAtMTU3OSwxNyArMTgyMSwxNyBAQAogICAgICAgICAvKiBDb21wdXRlIHRpbWUgZWxhcHNlZCBiZXR3ZWVuIGVuZCBvZiBwcmV2aW91cyBkZWNvZGUoKQogICAgICAgICAgKiB0byBzdGFydCBvZiBjdXJyZW50IGRlY29kZSgpICovCiAgICAgICAgIFRJTUVfRElGRihtVGltZUVuZCwgbVRpbWVTdGFydCwgdGltZURlbGF5KTsKLSAgICAgICAgc3RhdHVzID0gaXZlX2FwaV9mdW5jdGlvbihtQ29kZWNDdHgsICZzX2VuY29kZV9pcCwgJnNfZW5jb2RlX29wKTsKKyAgICAgICAgc3RhdHVzID0gaXZlX2FwaV9mdW5jdGlvbihtQ29kZWNDdHgsICZzX3ZpZGVvX2VuY29kZV9pcCwgJnNfdmlkZW9fZW5jb2RlX29wKTsKIAogICAgICAgICBpZiAoSVZfU1VDQ0VTUyAhPSBzdGF0dXMpIHsKLSAgICAgICAgICAgIGlmICgoc19lbmNvZGVfb3AudTRfZXJyb3JfY29kZSAmIDB4RkYpID09IElIMjY0RV9CSVRTVFJFQU1fQlVGRkVSX09WRVJGTE9XKSB7CisgICAgICAgICAgICBpZiAoKHBzX2VuY29kZV9vcC0+dTRfZXJyb3JfY29kZSAmIDB4RkYpID09IElIMjY0RV9CSVRTVFJFQU1fQlVGRkVSX09WRVJGTE9XKSB7CiAgICAgICAgICAgICAgICAgLy8gVE9ETzogdXNlIElWRV9DTURfQ1RMX0dFVEJVRklORk8gZm9yIHByb3BlciBtYXggaW5wdXQgc2l6ZT8KICAgICAgICAgICAgICAgICBtT3V0QnVmZmVyU2l6ZSAqPSAyOwogICAgICAgICAgICAgICAgIG1PdXRCbG9jay5yZXNldCgpOwogICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgQUxPR0UoIkVuY29kZSBGcmFtZSBmYWlsZWQgPSAweCV4XG4iLAotICAgICAgICAgICAgICAgICAgICBzX2VuY29kZV9vcC51NF9lcnJvcl9jb2RlKTsKKyAgICAgICAgICAgICAgICAgICAgcHNfZW5jb2RlX29wLT51NF9lcnJvcl9jb2RlKTsKICAgICAg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AgICAgIGlmIChtQnVmZmVycy5jb3VudChmcmVlZCkgPT0gMHUpIHsKQEAgLTE2MjEsMTcgKzE4NjMsMTcgQEAKICAgICAgICAgfQogICAgIH0KIAotICAgIGlmIChzX2VuY29kZV9vcC5vdXRwdXRfcHJlc2VudCkgewotICAgICAgICBpZiAoIXNfZW5jb2RlX29wLnNfb3V0X2J1Zi51NF9ieXRlcykgeworICAgIGlmIChwc19lbmNvZGVfb3AtPm91dHB1dF9wcmVzZW50KSB7CisgICAgICAgIGlmICghcHNfZW5jb2RlX29wLT5zX291dF9idWYudTRfYnl0ZXMpIHsKICAgICAgICAgICAgIEFMT0dFKCJFcnJvcjogT3V0cHV0IHByZXNlbnQgYnV0IGJ5dGVzIGdlbmVyYXRlZCBpcyB6ZXJvIik7CiAgICAgICAgICAgICBtU2lnbmFsbGVkRXJyb3IgPSB0cnVlOwogICAgICAgICAgICAgd29yay0+cmVzdWx0ID0gQzJfQ09SUlVQVEVEOwogICAgICAgICAgICAgd29yay0+d29ya2xldHNQcm9jZXNzZWQgPSAxdTsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQotICAgICAgICB1aW50NjRfdCB3b3JrSWQgPSAoKHVpbnQ2NF90KXNfZW5jb2RlX29wLnU0X3RpbWVzdGFtcF9oaWdoIDw8IDMyKSB8Ci0gICAgICAgICAgICAgICAgICAgICAgc19lbmNvZGVfb3AudTRfdGltZXN0YW1wX2xvdzsKLSAgICAgICAgZmluaXNoV29yayh3b3JrSWQsIHdvcmssICZzX2VuY29kZV9vcCk7CisgICAgICAgIHVpbnQ2NF90IHdvcmtJZCA9ICgodWludDY0X3QpcHNfZW5jb2RlX29wLT51NF90aW1lc3RhbXBfaGlnaCA8PCAzMikgfAorICAgICAgICAgICAgICAgICAgICAgIHBzX2VuY29kZV9vcC0+dTRfdGltZXN0YW1wX2xvdzsKKyAgICAgICAgZmluaXNoV29yayh3b3JrSWQsIHdvcmssIHBzX2VuY29kZV9vcCk7CiAgICAgfQogICA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WxlZCBmb3IgZHJhaW5JbnRlcm5hbCIpOwogICAgICAgICAgICAgbVNpZ25hbGxlZEVycm9yID0gdHJ1ZTsKQEAgLTE2ODEsOSArMTkyNSw5IEBACiAgICAgICAgICAgICB3b3JrLT53b3JrbGV0c1Byb2Nlc3NlZCA9IDF1OwogICAgICAgICAgICAgcmV0dXJuIEMyX0NPUlJVUFRFRDsKICAgICAgICAgfQotICAgICAgICAodm9pZClpdmVfYXBpX2Z1bmN0aW9uKG1Db2RlY0N0eCwgJnNfZW5jb2RlX2lwLCAmc19lbmNvZGVfb3ApOworICAgICAgICAodm9pZClpdmVfYXBpX2Z1bmN0aW9uKG1Db2RlY0N0eCwgJnNfdmlkZW9fZW5jb2RlX2lwLCAmc192aWRlb19lbmNvZGVfb3ApOwogCi0gICAgICAgIHZvaWQgKmZyZWVkID0gc19lbmNvZGVfb3Auc19pbnBfYnVmLmFwdl9idWZzWzBdOworICAgICAgICB2b2lkICpmcmVlZCA9IHBzX2VuY29kZV9vcC0+c19pbnBfYnVmLmFwdl9idWZzWzBdOwogICAgICAgICAvKiBJZiBlbmNvZGVyIGZyZWVzIHVwIGFuIGlucHV0IGJ1ZmZlciwgbWFyayBpdCBhcyBmcmVlICovCiAgICAgICAgIGlmIChmcmVlZCAhPSBudWxscHRyKSB7CiAgICAgICAgICAgICBpZiAobUJ1ZmZlcnMuY291bnQoZnJlZWQpID09IDB1KSB7CkBAIC0xNjk1LDEwICsxOTM5LDEwIEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAotICAgICAgICBpZiAoc19lbmNvZGVfb3Aub3V0cHV0X3ByZXNlbnQpIHsKLSAgICAgICAgICAgIHVpbnQ2NF90IHdvcmtJZCA9ICgodWludDY0X3Qpc19lbmNvZGVfb3AudTRfdGltZXN0YW1wX2hpZ2ggPDwgMzIpIHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgc19lbmNvZGVfb3AudTRfdGltZXN0YW1wX2xvdzsKLSAgICAgICAgICAgIGZp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21lZGlhL2NvZGVjMi9jb21wb25lbnRzL2Jhc2UvU2ltcGxlQzJDb21wb25lbnQuY3BwCmluZGV4IGZiM2ZiZDAuLjZjNGI3ZDkgMTAwNjQ0Ci0tLSBhL21lZGlhL2NvZGVjMi9jb21wb25lbnRzL2Jhc2UvU2ltcGxlQzJDb21wb25lbnQuY3BwCisrKyBiL21lZGlhL2NvZGVjMi9jb21wb25lbnRzL2Jhc2UvU2ltcGxlQzJDb21wb25lbnQuY3BwCkBAIC0xMTAsMTcgKzExMCwyMCBAQAogICAgICAgICB9CiAgICAgICAgIGNhc2Uga1doYXRTdG9wOiB7CiAgICAgICAgICAgICBpbnQzMl90IGVyciA9IHRoaXotPm9uU3RvcCgpOworICAgICAgICAgICAgdGhpei0+bU91dHB1dEJsb2NrUG9vbC5yZXNldCgpOwogICAgICAgICAgICAgUmVwbHkobXNnLCAmZXJyKTsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CiAgICAgICAgIGNhc2Uga1doYXRSZXNldDogewogICAgICAgICAgICAgdGhpei0+b25SZXNldCgpOworICAgICAgICAgICAgdGhpei0+bU91dHB1dEJsb2NrUG9vbC5yZXNldCgpOwogICAgICAgICAgICAgbVJ1bm5pbmcgPSBmYWxzZTsKICAgICAgICAgICAgIFJlcGx5KG1zZyk7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogICAgICAgICBjYXNlIGtXaGF0UmVsZWFzZTogewogICAgICAgICAgICAgdGhpei0+b25SZWxlYXNlKCk7CisgICAgICAgICAgICB0aGl6LT5tT3V0cHV0QmxvY2tQb29sLnJlc2V0KCk7CiAgICAgICAgICAgICBtUnVubmluZyA9IGZhbHNlOwogICAgICAgICAgICAgUmVwbHkobXNnKTsKICAgICAgICAgICAgIGJyZWFrOwpAQCAtNTg5LDIxICs1OTIsMTEgQEAKIH0KIAogc3RkOjpzaGFyZWRfcHRyPEMyQnVmZmVyPiBTaW1wbGVDMkNvbXBvbmVudDo6Y3JlYXRlTGluZWF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lczogWworICAgICAgICAiZnJhbWV3b3Jrc19hdl9tZWRpYV9jb2RlYzJfY29tcG9uZW50c19nNzExX2xpY2Vuc2UiLAorICAgIF0sCit9CisKKy8vIEFkZGVkIGF1dG9tYXRpY2FsbHkgYnkgYSBsYXJnZS1zY2FsZS1jaGFuZ2UKKy8vIFNlZTogaHR0cDovL2dvL2FuZHJvaWQtbGljZW5zZS1mYXEKK2xpY2Vuc2UgeworICAgIG5hbWU6ICJmcmFtZXdvcmtzX2F2X21lZGlhX2NvZGVjMl9jb21wb25lbnRzX2c3MTFfbGljZW5zZSIsCisgICAgdmlzaWJpbGl0eTogWyI6X19zdWJwYWNrYWdlc19fIl0sCisgICAgbGljZW5zZV9raW5kczogWworICAgICAgICAiU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMCIsCisgICAgXSwKKyAgICBsaWNlbnNlX3RleHQ6IFsKKyAgICAgICAgIk5PVElDRSIsCisgICAgXSwKK30KKworY2NfbGlicmFyeSB7CiAgICAgbmFtZTogImxpYmNvZGVjMl9zb2Z0X2c3MTFhbGF3ZGVjIiwKICAgICBkZWZhdWx0czogWwogICAgICAgICAibGliY29kZWMyX3NvZnQtZGVmYXVsdHMiLApAQCAtNywxMiArMjYsMTQgQEAKIAogICAgIHNyY3M6IFsiQzJTb2Z0RzcxMURlYy5jcHAiXSwKIAorICAgIHN0YXRpY19saWJzOiBbImNvZGVjc19nNzExZGVjIl0sCisKICAgICBjZmxhZ3M6IFsKICAgICAgICAgIi1EQUxBVyIsCiAgICAgXSwKIH0KIAotY2NfbGlicmFyeV9zaGFyZWQgeworY2NfbGlicmFyeSB7CiAgICAgbmFtZTogImxpYmNvZGVjMl9zb2Z0X2c3MTFtbGF3ZGVjIiwKICAgICBkZWZhdWx0czogWwogICAgICAgICAibGliY29kZWMyX3NvZnQtZGVmYXVsdHMiLApAQCAtMjAsNCArNDEsNiBAQAogICAgIF0sCiAKICAgICBzcmNzOiBbIkMyU29mdEc3MTFEZW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lucHV0Lm9yZGluYWw7CiAKICAgICBpZiAoZW9zKSB7CkBAIC0yMjQsNTMgKzIyNCw2IEBACiAgICAgcmV0dXJuIEMyX09LOwogfQogCi0jaWZkZWYgQUxBVwotdm9pZCBDMlNvZnRHNzExRGVjOjpEZWNvZGVBTGF3KAotICAgICAgICBpbnQxNl90ICpvdXQsIGNvbnN0IHVpbnQ4X3QgKmluLCBzaXplX3QgaW5TaXplKSB7Ci0gICAgd2hpbGUgKGluU2l6ZSA+IDApIHsKLSAgICAgICAgaW5TaXplLS07Ci0gICAgICAgIGludDMyX3QgeCA9ICppbisrOwotCi0gICAgICAgIGludDMyX3QgaXggPSB4IF4gMHg1NTsKLSAgICAgICAgaXggJj0gMHg3ZjsKLQotICAgICAgICBpbnQzMl90IGlleHAgPSBpeCA+PiA0OwotICAgICAgICBpbnQzMl90IG1hbnQgPSBpeCAmIDB4MGY7Ci0KLSAgICAgICAgaWYgKGlleHAgPiAwKSB7Ci0gICAgICAgICAgICBtYW50ICs9IDE2OwotICAgICAgICB9Ci0KLSAgICAgICAgbWFudCA9IChtYW50IDw8IDQpICsgODsKLQotICAgICAgICBpZiAoaWV4cCA+IDEpIHsKLSAgICAgICAgICAgIG1hbnQgPSBtYW50IDw8IChpZXhwIC0gMSk7Ci0gICAgICAgIH0KLQotICAgICAgICAqb3V0KysgPSAoeCA+IDEyNykgPyBtYW50IDogLW1hbnQ7Ci0gICAgfQotfQotI2Vsc2UKLXZvaWQgQzJTb2Z0RzcxMURlYzo6RGVjb2RlTUxhdygKLSAgICAgICAgaW50MTZfdCAqb3V0LCBjb25zdCB1aW50OF90ICppbiwgc2l6ZV90IGluU2l6ZSkgewotICAgIHdoaWxlIChpblNpemUgPiAwKSB7Ci0gICAgICAgIGluU2l6ZS0tOwotICAgICAgICBpbnQzMl90IHggPSAqaW4rKzsKLQotICAgICAgICBpbnQzMl90IG1hbnRpc3NhID0gfng7Ci0gICAgICAgIGludDMyX3QgZXhwb25lbnQgPSAobWFudGlz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ZXhwciB1aW50OF90IE5FVVRSQUxfVVZfVkFMVUUgPSAxMjg7CisKK30gIC8vIG5hbWVzcGFjZQogCiAvLyBjb2RlY25hbWUgc2V0IGFuZCBwYXNzZWQgaW4gYXMgYSBjb21waWxlIGZsYWcgZnJvbSBBbmRyb2lkLmJwCiBjb25zdGV4cHIgY2hhciBDT01QT05FTlRfTkFNRVtdID0gQ09ERUNOQU1FOwpAQCAtNTEsOCArNTYsOCBAQAogICAgICAgICBEZWZpbmVQYXJhbShtU2l6ZSwgQzJfUEFSQU1LRVlfUElDVFVSRV9TSVpFKQogICAgICAgICAgICAgLndpdGhEZWZhdWx0KG5ldyBDMlN0cmVhbVBpY3R1cmVTaXplSW5mbzo6b3V0cHV0KDB1LCAzMjAsIDI0MCkpCiAgICAgICAgICAgICAud2l0aEZpZWxkcyh7Ci0gICAgICAgICAgICAgICAgQzJGKG1TaXplLCB3aWR0aCkuaW5SYW5nZSgyLCAyMDQ4LCAyKSwKLSAgICAgICAgICAgICAgICBDMkYobVNpemUsIGhlaWdodCkuaW5SYW5nZSgyLCAyMDQ4LCAyKSwKKyAgICAgICAgICAgICAgICBDMkYobVNpemUsIHdpZHRoKS5pblJhbmdlKDIsIDQwOTYsIDIpLAorICAgICAgICAgICAgICAgIEMyRihtU2l6ZSwgaGVpZ2h0KS5pblJhbmdlKDIsIDQwOTYsIDIpLAogICAgICAgICAgICAgfSkKICAgICAgICAgICAgIC53aXRoU2V0dGVyKFNpemVTZXR0ZXIpCiAgICAgICAgICAgICAuYnVpbGQoKSk7CkBAIC02NSwxMiArNzAsMTQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbmZpZzo6UFJPRklMRV9BVjFfMX0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyRihtUHJvZmlsZUxldmVsLCBsZXZlbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLm9uZU9mKHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29uZmlnOjpMRVZFTF9BVjFfMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29uZmlnOjpMRVZFTF9BVjFfMl8xLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJDb25maWc6OkxFVkVMX0FWMV8yXzIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbmZpZzo6TEVWRUxfQVYxXzMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbmZpZzo6TEVWRUxfQVYxXzNfMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29uZmlnOjpMRVZFTF9BVjFfM18yLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJDb25maWc6OkxFVkVMX0FWMV8yLCBDMkNvbmZpZzo6TEVWRUxfQVYxXzJfMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29uZmlnOjpMRVZFTF9BVjFfMl8yLCBDMkNvbmZpZzo6TEVWRUxfQVYxXzJfMywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29uZmlnOjpMRVZFTF9BVjFfMywgQzJDb25maWc6OkxFVkVMX0FWMV8zXzEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbmZpZzo6TEVWRUxfQVYxXzNfMiwgQzJDb25maWc6OkxFVkVMX0FWMV8zXzMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbmZpZzo6TEVWRUxfQVYxXzQsIEMyQ29uZmlnOjpMRVZFTF9BVjFfNF8xLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJDb25maWc6OkxFVkVMX0FWMV80XzIsIEMyQ29uZmlnOjpMRVZFTF9BVjFfNF8zLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJDb25maWc6OkxFVkVMX0FWMV81LCBDMkNvbmZpZzo6TEVWRUxfQVYxXzVfMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29uZmlnOjpMRVZFTF9BVjFfNV8yLCBDMkNvbmZpZzo6TEVWRUxfQVYxXzVfMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSl9KQogICAgICAgICAgICAgICAgICAgICAgLndpdGhTZXR0ZXIoUHJvZmlsZUxldmVsU2V0dGVyLCBtU2l6ZSkKICAgICAgICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKQEAgLTQ1OCwzMiArNDY1LDQwIEBACiAgIH0KIH0KIAotc3RhdGljIHZvaWQgY29weU91dHB1dEJ1ZmZlclRvWXV2UGxhbmFyRnJhbWUodWludDhfdCAqZHN0LCBjb25zdCB1aW50OF90ICpzcmNZLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCAqc3JjVSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKnNyY1YsIHNpemVfdCBzcmNZU3RyaWRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IHNyY1VTdHJpZGUsIHNpemVfdCBzcmNWU3RyaWRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IGRzdFlTdHJpZGUsIHNpemVfdCBkc3RVVlN0cmlkZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHdpZHRoLCB1aW50MzJfdCBoZWlnaHQpIHsKLSAgdWludDhfdCAqY29uc3QgZHN0U3RhcnQgPSBkc3Q7CitzdGF0aWMgdm9pZCBjb3B5T3V0cHV0QnVmZmVyVG9ZVjEyRnJhbWUodWludDhfdCAqZHN0WSwgdWludDhfdCAqZHN0VSwgdWludDhfdCAqZHN0ViwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90ICpzcmNZLCBjb25zdCB1aW50OF90ICpzcmNVLCBjb25zdCB1aW50OF90ICpzcmNWLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCBzcmNZU3RyaWRlLCBzaXplX3Qgc3JjVVN0cmlkZSwgc2l6ZV90IHNyY1ZTdHJpZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IGRzdFlTdHJpZGUsIHNpemVfdCBkc3RVVlN0cmlkZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCB3aWR0aCwgdWludDMyX3QgaGVpZ2h0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNNb25vY2hyb21lKSB7CiAKICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBoZWlnaHQ7ICsraSkgewotICAgIG1lbWNweShkc3QsIHNyY1ksIHdpZHRoKTsKKyAgICBtZW1jcHkoZHN0WSwgc3JjWSwgd2lkdGgpOwogICAgIHNyY1kgKz0gc3JjWVN0cmlkZTsKLSAgICBkc3QgKz0gZHN0WVN0cmlkZTsKKyAgICBkc3RZICs9IGRzdFlTdHJpZGU7CiAgIH0KIAotICBkc3QgPSBkc3RTdGFydCArIGRzdFlTdHJpZGUgKiBoZWlnaHQ7CisgIGlmIChpc01vbm9jaHJvbWUpIHsKKyAgICAvLyBGaWxsIHdpdGggbmV1dHJhbCBVL1YgdmFsdWVzLgorICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpID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ICBwc19zZXRfZHluX3BhcmFtc19pcC0+ZV9zdWJfY21kID0gSVZEX0NNRF9DVExfU0VUUEFSQU1TOworICAgIHBzX3NldF9keW5fcGFyYW1zX2lwLT51NF9kaXNwX3dkID0gKFVXT1JEMzIpIHN0cmlkZTsKKyAgICBwc19zZXRfZHluX3BhcmFtc19pcC0+ZV9mcm1fc2tpcF9tb2RlID0gSVZEX1NLSVBfTk9ORTsKKyAgICBwc19zZXRfZHluX3BhcmFtc19pcC0+ZV9mcm1fb3V0X21vZGUgPSBJVkRfRElTUExBWV9GUkFNRV9PVVQ7CisgICAgcHNfc2V0X2R5bl9wYXJhbXNfaXAtPmVfdmlkX2RlY19tb2RlID0gZGVjX21vZGU7CisgICAgcHNfc2V0X2R5bl9wYXJhbXNfb3AtPnU0X3NpemUgPSBzaXplb2YoaWhldmNkX2N4YV9jdGxfc2V0X2NvbmZpZ19vcF90KTsKICAgICBJVl9BUElfQ0FMTF9TVEFUVVNfVCBzdGF0dXMgPSBpdmRlY19hcGlfZnVuY3Rpb24obURlY0hhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNfc2V0X2R5bl9wYXJhbXNfaXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzX3NldF9keW5fcGFyYW1zX29wKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHNfc2V0X2R5bl9wYXJhbXNfaXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBzX3NldF9keW5fcGFyYW1zX29wKTsKICAgICBpZiAoc3RhdHVzICE9IElWX1NVQ0NFU1MpIHsKLSAgICAgICAgQUxPR0UoImVycm9yIGluICVzOiAweCV4IiwgX19mdW5jX18sIHNfc2V0X2R5bl9wYXJhbXNfb3AudTRfZXJyb3JfY29kZSk7CisgIC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ICAgaWYgKElWRF9NRU1fQUxMT0NfRkFJTEVEID09IChwc19kZWNvZGVfb3AtPnU0X2Vycm9yX2NvZGUgJiBJVkRfRVJST1JfTUFTSykpIHsKICAgICAgICAgICAgIEFMT0dFKCJhbGxvY2F0aW9uIGZhaWx1cmUgaW4gZGVjb2RlciIpOwogICAgICAgICAgICAgbVNpZ25hbGxlZEVycm9yID0gdHJ1ZTsKICAgICAgICAgICAgIHdvcmstPndvcmtsZXRzUHJvY2Vzc2VkID0gMXU7CiAgICAgICAgICAgICB3b3JrLT5yZXN1bHQgPSBDMl9DT1JSVVBURUQ7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0gZWxzZSBpZiAoSVZEX1NUUkVBTV9XSURUSF9IRUlHSFRfTk9UX1NVUFBPUlRFRCA9PQotICAgICAgICAgICAgICAgICAgIChzX2RlY29kZV9vcC51NF9lcnJvcl9jb2RlICYgSVZEX0VSUk9SX01BU0spKSB7CisgICAgICAgICAgICAgICAgICAgKHBzX2RlY29kZV9vcC0+dTRfZXJyb3JfY29kZSAmIElWRF9FUlJPUl9NQVNLKSkgewogICAgICAgICAgICAgQUxPR0UoInVuc3VwcG9ydGVkIHJlc29sdXRpb24gOiAlZHglZCIsIG1XaWR0aCwgbUhlaWdodCk7CiAgICAgICAgICAgICBtU2lnbmFsbGVkRXJyb3IgPSB0cnVlOwogICAgICAgICAgICAgd29yay0+d29ya2xldHNQcm9jZXNzZWQgPSAxdTsKICAgICAgICAgICAgIHdvcmstPnJlc3VsdCA9IEMyX0NPUlJVUFRFRDsKICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfSBlbHNlIGlmIChJVkRfUkVTX0NIQU5HRUQgPT0gKHNfZGVjb2RlX29wLnU0X2Vycm9yX2NvZGUgJiBJVkRfRVJST1JfTUFTSykpIHsKKyAgICAgICAgfSBlbHNlIGlmIChJVkRfUkVTX0NIQU5HRUQgPT0gKHBzX2RlY29kZV9vcC0+dTRfZXJyb3JfY29kZSAmIEl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lc3VsdCA9IEMyX0NPUlJVUFRFRDsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQotICAgICAgICBpZiAoc19kZWNvZGVfb3AuaTRfcmVvcmRlcl9kZXB0aCA+PSAwICYmIG1PdXRwdXREZWxheSAhPSBzX2RlY29kZV9vcC5pNF9yZW9yZGVyX2RlcHRoKSB7Ci0gICAgICAgICAgICBtT3V0cHV0RGVsYXkgPSBzX2RlY29kZV9vcC5pNF9yZW9yZGVyX2RlcHRoOworICAgICAgICBpZiAocHNfZGVjb2RlX29wLT5pNF9yZW9yZGVyX2RlcHRoID49IDAgJiYgbU91dHB1dERlbGF5ICE9IHBzX2RlY29kZV9vcC0+aTRfcmVvcmRlcl9kZXB0aCkgeworICAgICAgICAgICAgbU91dHB1dERlbGF5ID0gcHNfZGVjb2RlX29wLT5pNF9yZW9yZGVyX2RlcHRoOwogICAgICAgICAgICAgQUxPR1YoIk5ldyBPdXRwdXQgZGVsYXkgJWQgIiwgbU91dHB1dERlbGF5KTsKIAogICAgICAgICAgICAgQzJQb3J0QWN0dWFsRGVsYXlUdW5pbmc6Om91dHB1dCBvdXRwdXREZWxheShtT3V0cHV0RGVsYXkpOwpAQCAtOTA2LDE3ICs5MTMsMTYgQEAKICAgICAgICAgICAgICAgICB3b3JrLT5yZXN1bHQgPSBDMl9DT1JSVVBURUQ7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgIH0KLSAgICAgICAgaWYgKDAgPCBzX2RlY29kZV9vcC51NF9waWNfd2QgJiYgMCA8IHNfZGVjb2RlX29wLnU0X3BpY19odCkgeworICAgICAgICBpZiAoMCA8IHBzX2RlY29kZV9vcC0+dTRfcGljX3dkICYmIDAgPCBwc19kZWNvZGVfb3AtPnU0X3BpY19odCkgewogICAgICAgICAgICAgaWYgKG1IZWFkZXJEZWNvZGVkID09IGZhbHNlKSB7CiAgICAgICAgICAgICAgICAgbUhlYWRlckRlY29kZWQgPSB0cnVlOwotICAgICAgICAgICAgICAgIHNldFBhcmFtcyhBTElHTjMyKHNfZGVjb2RlX29wLnU0X3BpY193ZCksIElWRF9ERUNPREVfRlJBTUUpOworICAgICAgICAgICAgICAgIHNldFBhcmFtcyhBTElHTjMyKHBzX2RlY29kZV9vcC0+dTRfcGljX3dkKSwgSVZEX0RFQ09ERV9GUkFNRSk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoc19kZWNvZGVfb3AudTRfcGljX3dkICE9IG1XaWR0aCB8fCAgc19kZWNvZGVfb3AudTRfcGljX2h0ICE9IG1IZWlnaHQpIHsKLSAgICAgICAgICAgICAgICBtV2lkdGggPSBzX2RlY29kZV9vcC51NF9waWNfd2Q7Ci0gICAgICAgICAgICAgICAgbUhlaWdodCA9IHNfZGVjb2RlX29wLnU0X3BpY19odDsKLSAgICAgICAgICAgICAgICBDSEVDS19FUSgwdSwgc19kZWNvZGVfb3AudTRfb3V0cHV0X3ByZXNlbnQpOworICAgICAgICAgICAgaWYgKHBzX2RlY29kZV9vcC0+dTRfcGljX3dkICE9IG1XaWR0aCB8fCAgcHNfZGVjb2RlX29wLT51NF9waWNfaHQgIT0gbUhlaWdodCkgeworICAgICAgICAgICAgICAgIG1XaWR0aCA9IHBzX2RlY29kZV9vcC0+dTRfcGljX3dkOworICAgICAgICAgICAgICAgIG1IZWlnaHQgPSBwc19kZWNvZGVfb3AtPnU0X3BpY19odDsKKyAgICAgICAgICAgICAgICBDSEVDS19FUSgwdSwgcHNfZGVjb2RlX29wLT51NF9vdXRwdXRfcHJlc2VudCk7CiAKICAgICAgICAgICAgICAgICBDMlN0cmVhbVBpY3R1cmVTaXplSW5mbzo6b3V0cHV0IHNpemUoMHUsIG1XaWR0aCwgbUhlaWdodCk7CiAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjp1bmlxdWVfcHRyPEMyU2V0dGluZ1Jlc3VsdD4+IGZhaWx1cmVzOwpAQCAtOTM2LDE1ICs5NDIsMTUgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICAodm9pZCkgZ2V0VnVpUGFyYW1zKCk7Ci0gICAgICAgIGhhc1BpY3R1cmUgfD0gKDEgPT0gc19kZWNvZGVfb3AudTRfZnJhbWVfZGVjb2RlZF9mbGFnKTsKLSAgICAgICAgaWYgKHNfZGVjb2RlX29wLnU0X291dHB1dF9wcmVzZW50KSB7Ci0gICAgICAgICAgICBmaW5pc2hXb3JrKHNfZGVjb2RlX29wLnU0X3RzLCB3b3JrKTsKKyAgICAgICAgaGFzUGljdHVyZSB8PSAoMSA9PSBwc19kZWNvZGVfb3AtPnU0X2ZyYW1lX2RlY29kZWRfZmxhZyk7CisgICAgICAgIGlmIChwc19kZWNvZGVfb3AtPnU0X291dHB1dF9wcmVzZW50KSB7CisgICAgICAgICAgICBmaW5pc2hXb3JrKHBzX2RlY29kZV9vcC0+dTRfdHMsIHdvcmspOwogICAgICAgICB9Ci0gICAgICAgIGlmICgwID09IHNfZGVjb2RlX29wLnU0X251bV9ieXRlc19jb25zdW1lZCkgeworICAgICAgICBpZiAoMCA9PSBwc19kZWNvZGVfb3AtPnU0X251bV9ieXRlc19jb25zdW1lZCkgewogICAgICAgICAgICAgQUxPR0QoIkJ5dGVzIGNvbnN1bWVkIGlzIHplcm8uIElnbm9yaW5nIHJlbWFpbmluZyBieXRlcyIpOwogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KLSAgICAgICAgaW5Qb3MgKz0gc19kZWNvZGVfb3AudTRfbnVtX2J5dGVzX2NvbnN1bWVkOworICAgICAgICBpblBvcyArPSBwc19kZWNvZGVfb3AtPnU0X251bV9ieXRlc19jb25zdW1lZDsKICAgICAgICAgaWYgKGhhc1BpY3R1cmUgJiYgKGluU2l6ZSAtIGluUG9zKSkgewogICAgICAgICAgICAgQUxPR0QoImRlY29kZWQgZnJhbWUgaW4gY3VycmVudCBhY2Nlc3MgbmFsLCBpZ25vcmluZ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ICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpQUklNQVJJRVNfVU5TUEVDSUZJRUQsIEMyQ29sb3I6OlBSSU1BUklFU19PVEhFUiksCisgICAgICAgICAgICAgICAgICAgIEMyRihtQ29sb3JBc3BlY3RzLCB0cmFuc2ZlcikuaW5SYW5nZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJDb2xvcjo6VFJBTlNGRVJfVU5TUEVDSUZJRUQsICBDMkNvbG9yOjpUUkFOU0ZFUl9PVEhFUiksCisgICAgICAgICAgICAgICAgICAgIEMyRihtQ29sb3JBc3BlY3RzLCBtYXRyaXgpLmluUmFuZ2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29sb3I6Ok1BVFJJWF9VTlNQRUNJRklFRCwgICAgQzJDb2xvcjo6TUFUUklYX09USEVSKQorICAgICAgICAgICAgICAgIH0pCisgICAgICAgICAgICAgICAgLndpdGhTZXR0ZXIoQ29sb3JBc3BlY3RzU2V0dGVyKQorICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICBhZGRQYXJhbWV0ZXIoCisgICAgICAgICAgICAgICAgRGVmaW5lUGFyYW0obUNvZGVkQ29sb3JBc3BlY3RzLCBDMl9QQVJBTUtFWV9WVUlfQ09MT1JfQVNQRUNUUykKKyAgICAgICAgICAgICAgICAud2l0aERlZmF1bHQobmV3IEMyU3RyZWFtQ29sb3JBc3BlY3RzSW5mbzo6b3V0cHV0KAorICAgICAgICAgICAgICAgICAgICAgICAgMHUsIEMyQ29sb3I6OlJBTkdFX0xJTUlURUQsIEMyQ29sb3I6OlBSSU1BUklFU19VTlNQRUNJRklFRCwKKyAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29sb3I6OlRSQU5TRkVSX1VOU1BFQ0lGSUVELCBDMkNvbG9yOjpNQVRSSVhfVU5TUEVDSUZJRUQpKQorICAgICAgICAgICAgICAgIC53aXRoRmllbGRzKHsKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2RlZENvbG9yQXNwZWN0cywgcmFuZ2UpLmluUmFuZ2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29sb3I6OlJBTkdFX1VOU1BFQ0lGSUVELCAgICAgQzJDb2xvcjo6UkFOR0VfT1RIRVIpLAorICAgICAgICAgICAgICAgICAgICBDMkYobUNvZGVkQ29sb3JBc3BlY3RzLCBwcmltYXJpZXMpLmluUmFuZ2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29sb3I6OlBSSU1BUklFU19VTlNQRUNJRklFRCwgQzJDb2xvcjo6UFJJTUFSSUVTX09USEVSKSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2RlZENvbG9yQXNwZWN0cywgdHJhbnNmZXIpLmluUmFuZ2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29sb3I6OlRSQU5TRkVSX1VOU1BFQ0lGSUVELCAgQzJDb2xvcjo6VFJBTlNGRVJfT1RIRVIpLAorICAgICAgICAgICAgICAgICAgICBDMkYobUNvZGVkQ29sb3JBc3BlY3RzLCBtYXRyaXgpLmluUmFuZ2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29sb3I6Ok1BVFJJWF9VTlNQRUNJRklFRCwgICAgQzJDb2xvcjo6TUFUUklYX09USEVSKQorICAgICAgICAgICAgICAgIH0pCisgICAgICAgICAgICAgICAgLndpdGhTZXR0ZXIoQ29kZWRDb2xvckFzcGVjdHNTZXR0ZXIsIG1Db2xvckFzcGVjdHMpCisgICAgICAgICAgICAgICAgLmJ1aWxkKCkpOwogICAgIH0KIAogICAgIHN0YXRpYyBDMlIgSW5wdXREZWxheVNldHRlcigKQEAgLTQwMiw2ICs0MzksMzQgQEAKICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJTdHJlYW1Hb3BUdW5pbmc6Om91dHB1dD4gZ2V0R29wX2woKSBjb25zdCB7CiAgICAgICAgIHJldHVybiBtR29wOwogICAgIH0KKyAgICBzdGF0aWMgQzJSIENvbG9yQXNwZWN0c1NldHRlcihib29sIG1heUJsb2NrLCBDMlA8QzJTdHJlYW1Db2xvckFzcGVjdHNJbmZvOjppbnB1dD4gJm1lKSB7CisgICAgICAgICh2b2lkKW1heUJsb2NrOworICAgICAgICBpZiAobWUudi5yYW5nZSA+IEMyQ29sb3I6OlJBTkdFX09USEVSKSB7CisgICAgICAgICAgICAgICAgbWUuc2V0KCkucmFuZ2UgPSBDMkNvbG9yOjpSQU5HRV9PVEhFUjsKKyAgICAgICAgfQorICAgICAgICBpZiAobWUudi5wcmltYXJpZXMgPiBDMkNvbG9yOjpQUklNQVJJRVNfT1RIRVIpIHsKKyAgICAgICAgICAgICAgICBtZS5zZXQoKS5wcmltYXJpZXMgPSBDMkNvbG9yOjpQUklNQVJJRVNfT1RIRVI7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1lLnYudHJhbnNmZXIgPiBDMkNvbG9yOjpUUkFOU0ZFUl9PVEhFUikgeworICAgICAgICAgICAgICAgIG1lLnNldCgpLnRyYW5zZmVyID0gQzJDb2xvcjo6VFJBTlNGRVJfT1RIRVI7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1lLnYubWF0cml4ID4gQzJDb2xvcjo6TUFUUklYX09USEVSKSB7CisgICAgICAgICAgICAgICAgbWUuc2V0KCkubWF0cml4ID0gQzJDb2xvcjo6TUFUUklYX09USEVSOworICAgICAgICB9CisgICAgICAgIHJldHVybiBDMlI6Ok9rKCk7CisgICAgfQorICAgIHN0YXRpYyBDMlIgQ29kZWRDb2xvckFzcGVjdHNTZXR0ZXIoYm9vbCBtYXlCbG9jaywgQzJQPEMyU3RyZWFtQ29sb3JBc3BlY3RzSW5mbzo6b3V0cHV0PiAmbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBDMlA8QzJTdHJlYW1Db2xvckFzcGVjdHNJbmZvOjppbnB1dD4gJmN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aXplLCBDMl9QQVJBTUtFWV9NQVhfUElDVFVSRV9TSVpFKQogICAgICAgICAgICAgICAgIC53aXRoRGVmYXVsdChuZXcgQzJTdHJlYW1NYXhQaWN0dXJlU2l6ZVR1bmluZzo6b3V0cHV0KDB1LCAzMjAsIDI0MCkpCiAgICAgICAgICAgICAgICAgLndpdGhGaWVsZHMoewotICAgICAgICAgICAgICAgICAgICBDMkYobVNpemUsIHdpZHRoKS5pblJhbmdlKDIsIDE5MjAsIDIpLAotICAgICAgICAgICAgICAgICAgICBDMkYobVNpemUsIGhlaWdodCkuaW5SYW5nZSgyLCAxMDg4LCAyKSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1TaXplLCB3aWR0aCkuaW5SYW5nZSgyLCBrTWF4RGltZW5zaW9uLCAyKSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1TaXplLCBoZWlnaHQpLmluUmFuZ2UoMiwga01heERpbWVuc2lvbiwgMiksCiAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAud2l0aFNldHRlcihNYXhQaWN0dXJlU2l6ZVNldHRlciwgbVNpemUpCiAgICAgICAgICAgICAgICAgLmJ1aWxkKCkpOwpAQCAtMjA0LDggKzIwNSw4IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBDMlA8QzJTdHJlYW1QaWN0dXJlU2l6ZUluZm86Om91dHB1dD4gJnNpemUpIHsKICAgICAgICAgKHZvaWQpbWF5QmxvY2s7CiAgICAgICAgIC8vIFRPRE86IGdldCBtYXggd2lkdGgvaGVpZ2h0IGZyb20gdGhlIHNpemUncyBmaWVsZCBoZWxwZXJzIHZzLiBoYXJkY29kaW5nCi0gICAgICAgIG1lLnNldCgpLndpZHRoID0gYzJfbWluKGMyX21heChtZS52LndpZHRoLCBzaXplLnYud2lkdGgpLCAxOTIwdSk7Ci0gICAgICAgIG1lLnNldCgpLmhlaWdodCA9IGMyX21pbihjMl9tYXgobWUudi5oZWlnaHQs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I7CiBjb25zdGV4cHIgY2hhciBDT01QT05FTlRfTkFNRVtdID0gImMyLmFuZHJvaWQuaDI2My5kZWNvZGVyIjsKICNlbmRpZgogCkBAIC03NSwxMyArNzcsOCBAQAogICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1TaXplLCBDMl9QQVJBTUtFWV9QSUNUVVJFX1NJWkUpCiAgICAgICAgICAgICAgICAgLndpdGhEZWZhdWx0KG5ldyBDMlN0cmVhbVBpY3R1cmVTaXplSW5mbzo6b3V0cHV0KDB1LCAxNzYsIDE0NCkpCiAgICAgICAgICAgICAgICAgLndpdGhGaWVsZHMoewotI2lmZGVmIE1QRUc0Ci0gICAgICAgICAgICAgICAgICAgIEMyRihtU2l6ZSwgd2lkdGgpLmluUmFuZ2UoMiwgMTkyMCwgMiksCi0gICAgICAgICAgICAgICAgICAgIEMyRihtU2l6ZSwgaGVpZ2h0KS5pblJhbmdlKDIsIDEwODgsIDIpLAotI2Vsc2UKLSAgICAgICAgICAgICAgICAgICAgQzJGKG1TaXplLCB3aWR0aCkuaW5SYW5nZSgyLCAzNTIsIDIpLAotICAgICAgICAgICAgICAgICAgICBDMkYobVNpemUsIGhlaWdodCkuaW5SYW5nZSgyLCAyODgsIDIpLAotI2VuZGlmCisgICAgICAgICAgICAgICAgICAgIEMyRihtU2l6ZSwgd2lkdGgpLmluUmFuZ2UoMiwga01heERpbWVuc2lvbiwgMiksCisgICAgICAgICAgICAgICAgICAgIEMyRihtU2l6ZSwgaGVpZ2h0KS5pblJhbmdlKDIsIGtNYXhEaW1lbnNpb24sIDIpLAogICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgLndpdGhTZXR0ZXIoU2l6ZVNldHRlcikKICAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CkBAIC0xMzAsMTkgKzEyNywxMCBAQAogCiAgICAgICAgIGFkZFBhcmFtZXRlcigKICAgICAgICAgICAgICAgICBEZWZpbmVQYXJhbShtTWF4U2l6ZSwgQzJfUEFSQU1LRVlfTUFYX1BJQ1RVUkVfU0laRSkKLSNpZmRlZiBNUEVHNAotICAgICAgICAgICAgICAgIC53aXRoRGVmYXVsdChuZXcgQzJTdHJlYW1NYXhQaWN0dXJlU2l6ZVR1bmluZzo6b3V0cHV0KDB1LCAxOTIwLCAxMDg4KSkKLSNlbHNlCiAgICAgICAgICAgICAgICAgLndpdGhEZWZhdWx0KG5ldyBDMlN0cmVhbU1heFBpY3R1cmVTaXplVHVuaW5nOjpvdXRwdXQoMHUsIDM1MiwgMjg4KSkKLSNlbmRpZgogICAgICAgICAgICAgICAgIC53aXRoRmllbGRzKHsKLSNpZmRlZiBNUEVHNAotICAgICAgICAgICAgICAgICAgICBDMkYobVNpemUsIHdpZHRoKS5pblJhbmdlKDIsIDE5MjAsIDIpLAotICAgICAgICAgICAgICAgICAgICBDMkYobVNpemUsIGhlaWdodCkuaW5SYW5nZSgyLCAxMDg4LCAyKSwKLSNlbHNlCi0gICAgICAgICAgICAgICAgICAgIEMyRihtU2l6ZSwgd2lkdGgpLmluUmFuZ2UoMiwgMzUyLCAyKSwKLSAgICAgICAgICAgICAgICAgICAgQzJGKG1TaXplLCBoZWlnaHQpLmluUmFuZ2UoMiwgMjg4LCAyKSwKLSNlbmRpZgorICAgICAgICAgICAgICAgICAgICBDMkYobVNpemUsIHdpZHRoKS5pblJhbmdlKDIsIGtNYXhEaW1lbnNpb24sIDIpLAorICAgICAgICAgICAgICAgICAgICBDMkYobVNpemUsIGhlaWdodCkuaW5SYW5nZSgyLCBrTWF4RGltZW5zaW9uLCAyKSwKICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgIC53aXRoU2V0dGVyKE1heFBpY3R1cmVTaXplU2V0dGVyLCBtU2l6ZSkKICAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CkBAIC0yMDAsMTMgKzE4OCw4IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBDMlA8QzJTdHJlYW1QaWN0dXJl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Do6QzJDb21wb25lbnRGYWN0b3J5KiBmYWN0b3J5KSB7CiAgICAgQUxPR1YoImluICVzIiwgX19mdW5jX18pOwogICAgIGRlbGV0ZSBmYWN0b3J5OwpkaWZmIC0tZ2l0IGEvbWVkaWEvY29kZWMyL2NvbXBvbmVudHMvb3B1cy9DMlNvZnRPcHVzRW5jLmNwcCBiL21lZGlhL2NvZGVjMi9jb21wb25lbnRzL29wdXMvQzJTb2Z0T3B1c0VuYy5jcHAKaW5kZXggNzBkMTk2NS4uMzcwZDMzYyAxMDA2NDQKLS0tIGEvbWVkaWEvY29kZWMyL2NvbXBvbmVudHMvb3B1cy9DMlNvZnRPcHVzRW5jLmNwcAorKysgYi9tZWRpYS9jb2RlYzIvY29tcG9uZW50cy9vcHVzL0MyU29mdE9wdXNFbmMuY3BwCkBAIC03OCw2ICs3OCwxOSBAQAogICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKIAogICAgICAgICBhZGRQYXJhbWV0ZXIoCisgICAgICAgICAgICBEZWZpbmVQYXJhbShtQml0cmF0ZU1vZGUsIEMyX1BBUkFNS0VZX0JJVFJBVEVfTU9ERSkKKyAgICAgICAgICAgICAgICAud2l0aERlZmF1bHQobmV3IEMyU3RyZWFtQml0cmF0ZU1vZGVUdW5pbmc6Om91dHB1dCgKKyAgICAgICAgICAgICAgICAgICAgICAgIDB1LCBDMkNvbmZpZzo6QklUUkFURV9WQVJJQUJMRSkpCisgICAgICAgICAgICAgICAgLndpdGhGaWVsZHMoeworICAgICAgICAgICAgICAgICAgICBDMkYobUJpdHJhdGVNb2RlLCB2YWx1ZSkub25lT2YoeworICAgICAgICAgICAgICAgICAgICAgICAgQzJDb25maWc6OkJJVFJBVEVfQ09OU1QsCisgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbmZpZzo6QklUUkFURV9WQVJJQUJMRX0pCisgICAgICAgICAgICAgICAgfSkKKyAgICAgICAgICAgICAgICAud2l0aFNldHRlcigKKyAgICAgICAgICAgICAgICAgICAgU2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gICAgICAgICAud2l0aEZpZWxkcyh7QzJGKG1QY21FbmNvZGluZ0luZm8sIHZhbHVlKS5vbmVPZih7CiAgICAgICAgICAgICAgICAgICAgICBDMkNvbmZpZzo6UENNXzE2LAogICAgICAgICAgICAgICAgICAgICAgQzJDb25maWc6OlBDTV84LAotICAgICAgICAgICAgICAgICAgICAgQzJDb25maWc6OlBDTV9GTE9BVH0pCisgICAgICAgICAgICAgICAgICAgICBDMkNvbmZpZzo6UENNX0ZMT0FULAorICAgICAgICAgICAgICAgICAgICAgQzJDb25maWc6OlBDTV8yNCwKKyAgICAgICAgICAgICAgICAgICAgIEMyQ29uZmlnOjpQQ01fMzJ9KQogICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgLndpdGhTZXR0ZXIoKFNldHRlcjxkZWNsdHlwZSgqbVBjbUVuY29kaW5nSW5mbyk+OjpTdHJpY3RWYWx1ZVdpdGhOb0RlcHMpKQogICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKQEAgLTIxNSwxMSArMjE3LDEzIEBACiAKIH0gIC8vIG5hbWVzcGFjZSBhbmRyb2lkCiAKK19fYXR0cmlidXRlX18oKGNmaV9jYW5vbmljYWxfanVtcF90YWJsZSkpCiBleHRlcm4gIkMiIDo6QzJDb21wb25lbnRGYWN0b3J5KiBDcmVhdGVDb2RlYzJGYWN0b3J5KCkgewogICAgIEFMT0dWKCJpbiAlcyIsIF9fZnVuY19fKTsKICAgICByZXR1cm4gbmV3IDo6YW5kcm9pZDo6QzJTb2Z0UmF3RGVjRmFjdG9yeSgpOwogfQogCitfX2F0dHJpYnV0ZV9fKChjZmlfY2Fub25pY2FsX2p1bXBfdGFibGUpKQogZXh0ZXJuICJDIiB2b2lkIERlc3Ryb3lDb2RlYzJGYWN0b3J5KDo6QzJDb21wb25lbnRGYWN0b3J5KiBmYWN0b3J5KSB7CiAgICAgQUxPR1YoImluICVzIiwgX19mdW5jX18pOwogICAgIGRlbGV0ZSBmYWN0b3J5OwpkaW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IsCisgICAgICAgICJsaWJjdXRpbHMiLAorICAgICAgICAibGliY29kZWMyIiwKKyAgICAgICAgImxpYmhpZGxiYXNlIiwKKyAgICAgICAgImxpYmRtYWJ1ZmhlYXAiLAorICAgICAgICAibGliY29kZWMyX3ZuZGsiLAorICAgICAgICAibGlibmF0aXZld2luZG93IiwKKyAgICAgICAgImxpYmNvZGVjMl9zb2Z0X2NvbW1vbiIsCisgICAgICAgICJsaWJzZnBsdWdpbl9jY29kZWNfdXRpbHMiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZm91bmRhdGlvbiIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9idWZmZXJwb29sQDIuMC4xIiwKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuZ3JhcGhpY3MubWFwcGVyQDIuMCIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmdyYXBoaWNzLm1hcHBlckAzLjAiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5idWZmZXJwb29sQDIuMCIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmdyYXBoaWNzLmFsbG9jYXRvckAyLjAiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5ncmFwaGljcy5hbGxvY2F0b3JAMy4wIiwKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuZ3JhcGhpY3MuYnVmZmVycXVldWVAMi4wIiwKKyAgICBdLAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYnVpIiwKKyAgICAgICAgImxpYmRsIiwKKyAgICAgICAgImxpYmhhcmR3YXJlIiwKKyAgICAgICAgImxpYnZuZGtzdXBwb3J0IiwKKyAgICAgICAgImxpYnByb2Nlc3Nncm91cCIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLVdhbGwiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgXSwKK30KKworY2NfdGVzdCB7CisgICAgbmFtZTogIkMyU29mdE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zo6VGVzdCB7CitwdWJsaWM6CisgIHZvaWQgU2V0VXAoKSBvdmVycmlkZSB7CisgICAgbUZhY3RvcnkgPSBDcmVhdGVDb2RlYzJGYWN0b3J5KCk7CisgIH0KKworICB2b2lkIFRlYXJEb3duKCkgb3ZlcnJpZGUgeworICAgIGlmIChtRmFjdG9yeSkgeworICAgICAgRGVzdHJveUNvZGVjMkZhY3RvcnkobUZhY3RvcnkpOworICAgIH0KKyAgfQorCisgIGMyX3N0YXR1c190IGNyZWF0ZUNvbXBvbmVudCgKKyAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyQ29tcG9uZW50PiogY29uc3QgY29tcCkgeworICAgIGlmICghbUZhY3RvcnkpIHsKKyAgICAgIHJldHVybiBDMl9OT19JTklUOworICAgIH0KKyAgICByZXR1cm4gbUZhY3RvcnktPmNyZWF0ZUNvbXBvbmVudCgKKyAgICAgICAga1BsYWNlaG9sZGVySWQsIGNvbXAsIHN0ZDo6ZGVmYXVsdF9kZWxldGU8QzJDb21wb25lbnQ+KCkpOworICB9CisKKyAgYzJfc3RhdHVzX3QgY3JlYXRlSW50ZXJmYWNlKAorICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyQ29tcG9uZW50SW50ZXJmYWNlPiogY29uc3QgaW50ZikgeworICAgIGlmICghbUZhY3RvcnkpIHsKKyAgICAgIHJldHVybiBDMl9OT19JTklUOworICAgIH0KKyAgICByZXR1cm4gbUZhY3RvcnktPmNyZWF0ZUludGVyZmFjZSgKKyAgICAgICAga1BsYWNlaG9sZGVySWQsIGludGYsIHN0ZDo6ZGVmYXVsdF9kZWxldGU8QzJDb21wb25lbnRJbnRlcmZhY2U+KCkpOworICB9CisKKyAgOjpDMkNvbXBvbmVudEZhY3RvcnkgKmdldEZhY3RvcnkoKSB7IHJldHVybiBtRmFjdG9yeTsgfQorCitwcml2YXRlOgorICBzdGF0aWMgY29uc3RleHByIDo6YzJfbm9kZV9pZF90IGtQbGFjZWhvbGRlcklkID0gMDsKKworIC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1BMQU5FX1ZdOwpAQCAtODQyLDE4ICs4NDAsMTggQEAKICAgICAgICAgICAgIGNvbnN0ZXhwciBzaXplX3Qga0hlaWdodCA9IDY0OwogICAgICAgICAgICAgZm9yICg7IGkgPCBtSGVpZ2h0OyBpICs9IGtIZWlnaHQpIHsKICAgICAgICAgICAgICAgICBxdWV1ZS0+ZW50cmllcy5wdXNoX2JhY2soCi0gICAgICAgICAgICAgICAgICAgICAgICBbZHN0LCBzcmNZLCBzcmNVLCBzcmNWLAorICAgICAgICAgICAgICAgICAgICAgICAgW2RzdFksIHNyY1ksIHNyY1UsIHNyY1YsCiAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjWVN0cmlkZSwgc3JjVVN0cmlkZSwgc3JjVlN0cmlkZSwgZHN0WVN0cmlkZSwKICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aCA9IG1XaWR0aCwgaGVpZ2h0ID0gc3RkOjptaW4obUhlaWdodCAtIGksIGtIZWlnaHQpXSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udmVydFlVVjQyMFBsYW5hcjE2VG9ZNDEwKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHVpbnQzMl90ICopZHN0LCBzcmNZLCBzcmNVLCBzcmNWLCBzcmNZU3RyaWRlIC8gMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh1aW50MzJfdCAqKWRzdFksIHNyY1ksIHNyY1UsIHNyY1YsIHNyY1lTdHJpZGUgLyAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjVVN0cmlkZSAvIDIsIHNyY1ZTdHJpZGUgLyAyLCBkc3RZU3RyaWRlIC8gc2l6ZW9mKHVpbnQzMl90KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoLCBoZWlnaHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgc3JjWSArPSBzcmNZU3RyaWRlIC8gMiAqIGtIZWlnaHQ7CiAgICAgICAgICAgICAgICAgc3JjVSArPSBzcmNVU3RyaWRlIC8gMiAqIChrSGVpZ2h0IC8gMik7CiAgICAgICAgICAgICAgICAgc3JjViArPSBzcmNWU3RyaWRlIC8gMiAqIChrSGVpZ2h0IC8gMik7Ci0gICAgICAgICAgICAgICAgZHN0ICs9IGRzdFlTdHJpZGUgKiBrSGVpZ2h0OworICAgICAgICAgICAgICAgIGRzdFkgKz0gZHN0WVN0cmlkZSAqIGtIZWlnaHQ7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBDSEVDS19FUSgwdSwgcXVldWUtPm51bVBlbmRpbmcpOwogICAgICAgICAgICAgcXVldWUtPm51bVBlbmRpbmcgPSBxdWV1ZS0+ZW50cmllcy5zaXplKCk7CkBAIC04NjIsOCArODYwLDkgQEAKICAgICAgICAgICAgICAgICBxdWV1ZS53YWl0Rm9yQ29uZGl0aW9uKHF1ZXVlLT5jb25kKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGNvbnZlcnRZVVY0MjBQbGFuYXIxNlRvWVVWNDIwUGxhbmFyKGRzdCwgc3JjWSwgc3JjVSwgc3JjViwgc3JjWVN0cmlkZSAvIDIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmNVU3RyaWRlIC8gMiwgc3JjVlN0cmlkZSAvIDIsCisgICAgICAgICAgICBjb252ZXJ0WVVWNDIwUGxhbmFyMTZUb1lVVjQyMFBsYW5hcihkc3RZLCBkc3RVLCBkc3RWLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjWSwgc3JjVSwgc3JjViwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyY1lTdHJpZGUgLyAyLCBzcmNVU3RyaWRlIC8gMiwgc3JjVlN0cmlkZSAvIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3RZU3RyaWRlLCBkc3RVVlN0cmlkZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XaWR0aCwgbUhlaWdodCk7CiAgICAgICAgIH0KQEAgLTg3MSw4ICs4NzAsMTAgQEAKICAgICAgICAgY29uc3QgdWludDhfdCAqc3JjWSA9IChjb25zdCB1aW50OF90ICopaW1nLT5wbGFuZXNbVlBYX1BMQU5FX1ldOwogICAgICAgICBjb25zdCB1aW50OF90ICpzcmNVID0gKGNvbnN0IHVpbnQ4X3QgKilpbWctPnBsYW5lc1tWUFhfUExBTkVfVV07CiAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKnNyY1YgPSAoY29uc3QgdWludDhfdCAqKWltZy0+cGxhbmVzW1ZQWF9QTEFORV9WXTsKKwogICAgICAgICBjb3B5T3V0cHV0QnVmZmVyVG9ZdXZQbGFuYXJGcmFtZSgKLSAgICAgICAgICAgICAgICBkc3QsIHNyY1ksIHNyY1UsIHNyY1YsCisgICAgICAgICAgICAgICAgZHN0WSwgZHN0VSwgZHN0ViwKKyAgICAgICAgICAgICAgICBzcmNZLCBzcmNVLCBzcmNWLAogICAgICAgICAgICAgICAgIHNyY1lTdHJpZGUsIHNyY1VTdHJpZGUsIHNyY1ZTdHJpZGUsCiAgICAgICAgICAgICAgICAgZHN0WVN0cmlkZSwgZHN0VVZTdHJpZGUsCiAgICAgICAgICAgICAgICAgbVdpZHRoLCBtSGVpZ2h0KTsKQEAgLTk0NywxMSArOTQ4LDEzIEBACiAKIH0gIC8vIG5hbWVzcGFjZSBhbmRyb2lkCiAKK19fYXR0cmlidXRlX18oKGNmaV9jYW5vbmljYWxfanVtcF90YWJsZSkpCiBleHRlcm4gIkMiIDo6QzJDb21wb25lbnRGYWN0b3J5KiBDcmVhdGVDb2RlYzJGYWN0b3J5KCkgewogICAgIEFMT0dWKCJpbiAlcyI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bHQobmV3IEMyU3RyZWFtQ29sb3JBc3BlY3RzSW5mbzo6aW5wdXQoCisgICAgICAgICAgICAgICAgICAgICAgICAwdSwgQzJDb2xvcjo6UkFOR0VfVU5TUEVDSUZJRUQsIEMyQ29sb3I6OlBSSU1BUklFU19VTlNQRUNJRklFRCwKKyAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29sb3I6OlRSQU5TRkVSX1VOU1BFQ0lGSUVELCBDMkNvbG9yOjpNQVRSSVhfVU5TUEVDSUZJRUQpKQorICAgICAgICAgICAgICAgIC53aXRoRmllbGRzKHsKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2xvckFzcGVjdHMsIHJhbmdlKS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpSQU5HRV9VTlNQRUNJRklFRCwgICAgIEMyQ29sb3I6OlJBTkdFX09USEVSKSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2xvckFzcGVjdHMsIHByaW1hcmllcykuaW5SYW5nZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJDb2xvcjo6UFJJTUFSSUVTX1VOU1BFQ0lGSUVELCBDMkNvbG9yOjpQUklNQVJJRVNfT1RIRVIpLAorICAgICAgICAgICAgICAgICAgICBDMkYobUNvbG9yQXNwZWN0cywgdHJhbnNmZXIpLmluUmFuZ2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29sb3I6OlRSQU5TRkVSX1VOU1BFQ0lGSUVELCAgQzJDb2xvcjo6VFJBTlNGRVJfT1RIRVIpLAorICAgICAgICAgICAgICAgICAgICBDMkYobUNvbG9yQXNwZWN0cywgbWF0cml4KS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpNQVRSSVhfVU5TUEVDSUZJRUQsICAgIEMyQ29sb3I6Ok1BVFJJWF9PVEhFUikKKyAgICAgICAgICAgICAgICB9KQorICAgICAgICAgICAgICAgIC53aXRoU2V0dGVyKENvbG9yQXNwZWN0c1NldHRlcikKKyAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CisKKyAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1Db2RlZENvbG9yQXNwZWN0cywgQzJfUEFSQU1LRVlfVlVJX0NPTE9SX0FTUEVDVFMpCisgICAgICAgICAgICAgICAgLndpdGhEZWZhdWx0KG5ldyBDMlN0cmVhbUNvbG9yQXNwZWN0c0luZm86Om91dHB1dCgKKyAgICAgICAgICAgICAgICAgICAgICAgIDB1LCBDMkNvbG9yOjpSQU5HRV9MSU1JVEVELCBDMkNvbG9yOjpQUklNQVJJRVNfVU5TUEVDSUZJRUQsCisgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpUUkFOU0ZFUl9VTlNQRUNJRklFRCwgQzJDb2xvcjo6TUFUUklYX1VOU1BFQ0lGSUVEKSkKKyAgICAgICAgICAgICAgICAud2l0aEZpZWxkcyh7CisgICAgICAgICAgICAgICAgICAgIEMyRihtQ29kZWRDb2xvckFzcGVjdHMsIHJhbmdlKS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpSQU5HRV9VTlNQRUNJRklFRCwgICAgIEMyQ29sb3I6OlJBTkdFX09USEVSKSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2RlZENvbG9yQXNwZWN0cywgcHJpbWFyaWVzKS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpQUklNQVJJRVNfVU5TUEVDSUZJRUQsIEMyQ29sb3I6OlBSSU1BUklFU19PVEhFUiksCisgICAgICAgICAgICAgICAgICAgIEMyRihtQ29kZWRDb2xvckFzcGVjdHMsIHRyYW5zZmVyKS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpUUkFOU0ZFUl9VTlNQRUNJRklFRCwgIEMyQ29sb3I6OlRSQU5TRkVSX09USEVSKSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2RlZENvbG9yQXNwZWN0cywgbWF0cml4KS5pblJhbmdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpNQVRSSVhfVU5TUEVDSUZJRUQsICAgIEMyQ29sb3I6Ok1BVFJJWF9PVEhFUikKKyAgICAgICAgICAgICAgICB9KQorICAgICAgICAgICAgICAgIC53aXRoU2V0dGVyKENvZGVkQ29sb3JBc3BlY3RzU2V0dGVyLCBtQ29sb3JBc3BlY3RzKQorICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKICAgICB9CiAKICAgICBzdGF0aWMgQzJSIEJpdHJhdGVTZXR0ZXIoYm9vbCBtYXlCbG9jaywgQzJQPEMyU3RyZWFtQml0cmF0ZUluZm86Om91dHB1dD4gJm1lKSB7CkBAIC00MTUsNiArNDUxLDMxIEBACiAgICAgICAgIGRvdWJsZSBwZXJpb2QgPSBtU3luY0ZyYW1lUGVyaW9kLT52YWx1ZSAvIDFlNiAqIG1GcmFtZVJhdGUtPnZhbHVlOwogICAgICAgICByZXR1cm4gKHVpbnQzMl90KWMyX21heChjMl9taW4ocGVyaW9kICsgMC41LCBkb3VibGUoVUlOVDMyX01BWCkpLCAxLik7CiAgICAgfQorICAgIHN0YXRpYyBDMlIgQ29sb3JBc3BlY3RzU2V0dGVyKGJvb2wgbWF5QmxvY2ssIEMyUDxDMlN0cmVhbUNvbG9yQXNwZWN0c0luZm86OmlucHV0PiAmbWUpIHsKKyAgICAgICAgKHZvaWQpbWF5QmxvY2s7CisgICAgICAgIGlmIChtZS52LnJhbmdlID4gQzJDb2xvcjo6UkFOR0VfT1RIRVIpIHsKKyAgICAgICAgICAgICAgICBtZS5zZXQoKS5yYW5nZSA9IEMyQ29sb3I6OlJBTkdFX09USEVSOworICAgICAgICB9CisgICAgICAgIGlmIChtZS52LnByaW1hcmllcyA+IEMyQ29sb3I6OlBSSU1BUklFU19PVEhFUikgeworICAgICAgICAgICAgICAgIG1lLnNldCgpLnByaW1hcmllcyA9IEMyQ29sb3I6OlBSSU1BUklFU19PVEhFUjsKKyAgICAgICAgfQorICAgICAgICBpZiAobWUudi50cmFuc2ZlciA+IEMyQ29sb3I6OlRSQU5TRkVSX09USEVSKSB7CisgICAgICAgICAgICAgICAgbWUuc2V0KCkudHJhbnNmZXIgPSBDMkNvbG9yOjpUUkFOU0ZFUl9PVEhFUjsKKyAgICAgICAgfQorICAgICAgICBpZiAobWUudi5tYXRyaXggPiBDMkNvbG9yOjpNQVRSSVhfT1RIRVIpIHsKKyAgICAgICAgICAgICAgICBtZS5zZXQoKS5tYXRyaXggPSBDMkNvbG9yOjpNQVRSSVhfT1RIRVI7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIEMyUjo6T2soKTsKKyAgICB9CisgICAgc3RhdGljIEMyUiBDb2RlZENvbG9yQXNwZWN0c1NldHRlcihib29sIG1heUJsb2NrLCBDMlA8QzJTdHJlYW1Db2xvckFzcGVjdHNJbmZvOjpvdXRwdXQ+ICZtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEMyUDxDMlN0cmVhbUNvbG9yQXNwZWN0c0luZm86OmlucHV0PiAmY29kZWQpIHsKKyAgICAgICAgKHZvaWQpbWF5QmxvY2s7CisgICAgICAgIG1lLnNldCgpLnJhbmdlID0gY29kZWQudi5yYW5nZTsKKyAgICAgICAgbWUuc2V0KCkucHJpbWFyaWVzID0gY29kZWQudi5wcmltYXJpZXM7CisgICAgICAgIG1lLnNldCgpLnRyYW5zZmVyID0gY29kZWQudi50cmFuc2ZlcjsKKyAgICAgICAgbWUuc2V0KCkubWF0cml4ID0gY29kZWQudi5tYXRyaXg7CisgICAgICAgIHJldHVybiBDMlI6Ok9rKCk7CisgICAgfQogCiAgICBwcml2YXRlOgogICAgIHN0ZDo6c2hhcmVkX3B0cj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AgICAgICAgICAgICB1aW50MzJfdCB3aWR0aCBfX3VudXNlZCwgdWludDMyX3QgaGVpZ2h0IF9fdW51c2VkLCB1aW50MzJfdCBmb3JtYXQgX191bnVzZWQsCkBAIC03MjQsNyArNzI3LDggQEAKICAgICAgKiBccmV0dmFsIEMyX1JFRlVTRUQgICBubyBwZXJtaXNzaW9uIHRvIHJlY3JlYXRlIHRoZSBhbGxvY2F0aW9uCiAgICAgICogXHJldHZhbCBDMl9CQURfVkFMVUUgaW52YWxpZCBoYW5kbGUgKGNhbGxlciBlcnJvcikKICAgICAgKiBccmV0dmFsIEMyX09NSVRURUQgICB0aGlzIGFsbG9jYXRvciBkb2VzIG5vdCBzdXBwb3J0IDJEIGFsbG9jYXRpb25zCi0gICAgICogXHJldHZhbCBDMl9DT1JSVVBURUQgc29tZSB1bmtub3duLCB1bnJlY292ZXJhYmxlIGVycm9yIG9jY3VyZWQgZHVyaW5nIHJlY3JlYXRpb24gKHVuZXhwZWN0ZWQpCisgICAgICogXHJldHZhbCBDMl9DT1JSVVBURUQgc29tZSB1bmtub3duLCB1bnJlY292ZXJhYmxlIGVycm9yIG9jY3VycmVkIGR1cmluZyByZWNyZWF0aW9uCisgICAgICogICAgICAgICAgICAgICAgICAgICAgKHVuZXhwZWN0ZWQpCiAgICAgICovCiAgICAgdmlydHVhbCBjMl9zdGF0dXNfdCBwcmlvckdyYXBoaWNBbGxvY2F0aW9uKAogICAgICAgICAgICAgY29uc3QgQzJIYW5kbGUgKmhhbmRsZSBfX3VudXNlZCwKQEAgLTczNCw2ICs3MzgsMjIgQEAKICAgICB9CiAKICAgICB2aXJ0dWFsIH5DMkFsbG9jYXRvcigpID0gZGVmYXVsdDsKKworICAgIC8qKgorICAgICAqIFJldHVybnMgYSB0cnVlIGlmIHRoZSBoYW5kbGUgbG9va3MgdmFsaWQgZm9yIHRoaXMgYWxsb2NhdG9yLgorICAgICAqCisgICAgICogSXQgZG9lcyBub3QgYWN0dWFsbHkgdmFsaWRhdGU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gICAgICAvLy88IFZQOCBQcm9maWxlIDEKKyAgICBQUk9GSUxFX1ZQOF8yLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vLzwgVlA4IFByb2ZpbGUgMgorICAgIFBST0ZJTEVfVlA4XzMsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8vPCBWUDggUHJvZmlsZSAzCisKKyAgICAvLyBNUEVHLUggM0QgQXVkaW8gcHJvZmlsZXMKKyAgICBQUk9GSUxFX01QRUdIX01BSU4gPSBfQzJfUExfTVBFR0hfQkFTRSwgICAgIC8vLzwgTVBFRy1IIE1haW4KKyAgICBQUk9GSUxFX01QRUdIX0hJR0gsICAgICAgICAgICAgICAgICAgICAgICAgIC8vLzwgTVBFRy1IIEhpZ2gKKyAgICBQUk9GSUxFX01QRUdIX0xDLCAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vLzwgTVBFRy1IIExvdy1jb21wbGV4aXR5CisgICAgUFJPRklMRV9NUEVHSF9CQVNFTElORSwgICAgICAgICAgICAgICAgICAgICAvLy88IE1QRUctSCBCYXNlbGluZQogfTsKIAogZW51bSBDMkNvbmZpZzo6bGV2ZWxfdCA6IHVpbnQzMl90IHsKQEAgLTY3OCw2ICs3MTYsMTMgQEAKICAgICBMRVZFTF9BVjFfN18xLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vLzwgQVYxIExldmVsIDcuMQogICAgIExFVkVMX0FWMV83XzIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8vPCBBVjEgTGV2ZWwgNy4yCiAgICAgTEVWRUxfQVYxXzdfMywgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLy88IEFWMSBMZXZlbCA3LjMKKworICAgIC8vIE1QRUctSCAzRCBBdWRpbyBsZXZlbHMKKyAgICBMRVZFTF9NUEVHSF8xID0gX0MyX1BMX01QRUdIX0JBU0UsICAgICAgICAgIC8vLzwgTVBFRy1IIEwxCisgICAgTEVWRUxfTVBFR0hfMiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLy88IE1QRUctSCBMMgorICAgIExFVkVMX01QRUdIXzMsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8vPCBNUEVHLUggTDMKKyAgICBMRVZFTF9NUEVHSF80LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vLzwgTVBFRy1IIEw0CisgICAgTEVWRUxfTVBFR0hfNSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLy88IE1QRUctSCBMNQogfTsKIAogc3RydWN0IEMyUHJvZmlsZUxldmVsU3RydWN0IHsKQEAgLTExMzcsNiArMTE4Miw4IEBACiBDMkVOVU0oQzJDb25maWc6OnNlY3VyZV9tb2RlX3QsIHVpbnQzMl90LAogICAgIFNNX1VOUFJPVEVDVEVELCAgICAvLy88IG5vIGNvbnRlbnQgcHJvdGVjdGlvbgogICAgIFNNX1JFQURfUFJPVEVDVEVELCAvLy88IGlucHV0IGFuZCBvdXRwdXQgYnVmZmVycyBzaGFsbCBiZSBwcm90ZWN0ZWQgZnJvbSByZWFkaW5nCisgICAgLy8vIGJvdGggcmVhZCBwcm90ZWN0ZWQgYW5kIHJlYWRhYmxlIGVuY3J5cHRlZCBidWZmZXJzIGFyZSB1c2VkCisgICAgU01fUkVBRF9QUk9URUNURURfV0lUSF9FTkNSWVBURUQsCiApCiAKIHR5cGVkZWYgQzJHbG9iYWxQYXJhbTxDMlR1bmluZywgQzJTaW1wbGVWYWx1ZVN0cnVjdDxDMkNvbmZpZzo6c2VjdXJlX21vZGVfdD4sIGtQYXJhbUluZGV4U2VjdXJlTW9kZT4KQEAgLTE2ODgsNiArMTczNSwzMSBAQAogY29uc3RleHByIGNoYXIgQzJfUEFSQU1LRVlfR09QW10gPSAiY29kaW5nLmdvcCI7CiAKIC8qKgorICogUXVhbnRpemF0aW9uCisgKiBtaW4vbWF4IGZvciBlYWNoIHBpY3R1cmUgdHlwZQorICoKKyAqLworc3RydWN0IEMyUGljdHVyZVF1YW50aXphdGlvblN0cnVjdCB7CisgICAgQzJQaWN0dXJlUXVhbnRpemF0aW9uU3RydWN0KCkgOiB0eXBlXygoQzJDb25maWc6OnBpY3R1cmVfdHlwZV90KTApLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW4oSU5UMzJfTUlOKSwgbWF4KElOVDMyX01BWCkge30KKyAgICBDMlBpY3R1cmVRdWFudGl6YXRpb25TdHJ1Y3QoQzJDb25maWc6OnBpY3R1cmVfdHlwZV90IHR5cGUsIGludDMyX3QgbWluXywgaW50MzJfdCBtYXhfKQorICAgICAgICA6IHR5cGVfKHR5cGUpLCBtaW4obWluXyksIG1heChtYXhfKSB7IH0KKworICAgIEMyQ29uZmlnOjpwaWN0dXJlX3R5cGVfdCB0eXBlXzsKKyAgICBpbnQzMl90IG1pbjsgICAgICAvLyBJTlQzMl9NSU4gPT0gJ25vIGxvd2VyIGJvdW5kIHNwZWNpZmllZCcKKyAgICBpbnQzMl90IG1heDsgICAgICAvLyBJTlQzMl9NQVggPT0gJ25vIHVwcGVyIGJvdW5kIHNwZWNpZmllZCcKKworICAgIERFRklORV9BTkRfREVTQ1JJQkVfQzJTVFJVQ1QoUGljdHVyZVF1YW50aXphdGlvbikKKyAgICBDMkZJRUxEKHR5cGVfLCAidHlwZSIpCisgICAgQzJGSUVMRChtaW4sICJtaW4iKQorICAgIEMyRklFTEQobWF4LCAibWF4IikKK307CisKK3R5cGVkZWYgQzJTdHJlYW1QYXJhbTxDMlR1bmluZywgQzJTaW1wbGVBcnJheVN0cnVjdDxDMlBpY3R1cmVRdWFudGl6YXRpb25TdHJ1Y3Q+LAorICAgICAgICBrUGFyYW1JbmRleFBpY3R1cmVRdWFudGl6YXRpb24+IEMyU3RyZWFtUGljdHVyZVF1YW50aXphdGlvblR1bmluZzsKK2NvbnN0ZXhwciBjaGFyIEMyX1BBUkFNS0VZX1BJQ1RVUkVfUVVBTlRJWkFUSU9OW10gPSAiY29kaW5nLnFwIjsKKworLyoq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G1vZGUobW9kZV8pLCBzeW5jVHlwZSh0eXBlKSB7CisgICAgICAgIG1lbWNweSgmc3luY0lkLCAmaWRbMF0sIGMyX21pbihpZC5zaXplKCksIGZsZXhDb3VudCkgKiBGTEVYX1NJWkUpOworICAgIH0KKworICAgIGlubGluZSBDMlR1bm5lbGVkTW9kZVN0cnVjdChzaXplX3QgZmxleENvdW50LCBtb2RlX3QgbW9kZV8sIHN5bmNfdHlwZV90IHR5cGUsIGludDMyX3QgaWQpCisgICAgICAgIDogbW9kZShtb2RlXyksIHN5bmNUeXBlKHR5cGUpIHsKKyAgICAgICAgaWYgKGZsZXhDb3VudCA+PSAxKSB7CisgICAgICAgICAgICBzeW5jSWRbMF0gPSBpZDsKKyAgICAgICAgfQorICAgIH0KKworICAgIG1vZGVfdCBtb2RlOyAgICAgICAgICAvLy88IHR1bm5lbGVkIG1vZGUKKyAgICBzeW5jX3R5cGVfdCBzeW5jVHlwZTsgLy8vPCB0eXBlIG9mIHN5bmMgdXNlZCBmb3IgdHVubmVsZWQgbW9kZQorICAgIGludDMyX3Qgc3luY0lkW107ICAgICAvLy88IHN5bmMgaWQKKworICAgIERFRklORV9BTkRfREVTQ1JJQkVfRkxFWF9DMlNUUlVDVChUdW5uZWxlZE1vZGUsIHN5bmNJZCkKKyAgICBDMkZJRUxEKG1vZGUsICJtb2RlIikKKyAgICBDMkZJRUxEKHN5bmNUeXBlLCAic3luYy10eXBlIikKKyAgICBDMkZJRUxEKHN5bmNJZCwgInN5bmMtaWQiKQorCit9OworCitDMkVOVU0oQzJUdW5uZWxlZE1vZGVTdHJ1Y3Q6Om1vZGVfdCwgdWludDMyX3QsCisgICAgTk9ORSwKKyAgICBTSURFQkFORCwKKyk7CisKKworQzJFTlVNKEMyVHVubmVsZWRNb2RlU3RydWN0OjpzeW5jX3R5cGVfdCwgdWludDMyX3QsCisgICAgUkVBTFRJTUUsCisgICAgQVVESU9fSFdfU1lOQywKKyAgICBIV19BVl9TWU5DLAorKTsKKworLyo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ICAgImxpYmRtYWJ1ZmhlYXAiLAorICAgICAgICAibGliY29kZWMyX3ZuZGsiLAorICAgICAgICAibGlibmF0aXZld2luZG93IiwKKyAgICAgICAgImxpYmNvZGVjMl9zb2Z0X2NvbW1vbiIsCisgICAgICAgICJsaWJzZnBsdWdpbl9jY29kZWNfdXRpbHMiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZm91bmRhdGlvbiIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9idWZmZXJwb29sQDIuMC4xIiwKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuZ3JhcGhpY3MubWFwcGVyQDIuMCIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmdyYXBoaWNzLm1hcHBlckAzLjAiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5idWZmZXJwb29sQDIuMCIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmdyYXBoaWNzLmFsbG9jYXRvckAyLjAiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5ncmFwaGljcy5hbGxvY2F0b3JAMy4wIiwKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuZ3JhcGhpY3MuYnVmZmVycXVldWVAMi4wIiwKKyAgICBdLAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYnVpIiwKKyAgICAgICAgImxpYmRsIiwKKyAgICAgICAgImxpYmJpbmRlciIsCisgICAgICAgICJsaWJoYXJkd2FyZSIsCisgICAgICAgICJsaWJ2bmRrc3VwcG9ydCIsCisgICAgICAgICJsaWJwcm9jZXNzZ3JvdXAiLAorICAgIF0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1XYWxsIiwKKyAgICAgICAgIi1XZXJyb3IiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJDMkZ1enplckF2Y0RlYyIsCisgICAgZGVmYXVsdHM6IFsiQzJGdXp6ZXItZGVmYXVsdHMiXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURDMkNPTVBPTkVOVE5BTUU9XCJjMi5hbmRyb2lkLmF2Yy5kZWNvZGVyXCIiLAorICAgIF0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGliYXZjZGVjIiwKKyAgICAgICAgImxpYmNvZGVjMl9zb2Z0X2F2Y2RlYyIsCisgICAgXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogIkMyRnV6emVySGV2Y0RlYyIsCisgICAgZGVmYXVsdHM6IFsiQzJGdXp6ZXItZGVmYXVsdHMiXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURDMkNPTVBPTkVOVE5BTUU9XCJjMi5hbmRyb2lkLmhldmMuZGVjb2RlclwiIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYmhldmNkZWMiLAorICAgICAgICAibGliY29kZWMyX3NvZnRfaGV2Y2RlYyIsCisgICAgXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogIkMyRnV6emVyTXBlZzJEZWMiLAorICAgIGRlZmF1bHRzOiBbIkMyRnV6emVyLWRlZmF1bHRzIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1EQzJDT01QT05FTlROQU1FPVwiYzIuYW5kcm9pZC5tcGVnMi5kZWNvZGVyXCIiLAorICAgIF0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGlibXBlZzJkZWMiLAorICAgICAgICAibGliY29kZWMyX3NvZnRfbXBlZzJkZWMiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJDMkZ1enplck1wZWc0RGVjIiwKKyAgICBkZWZhdWx0czogWyJDMkZ1enplci1kZWZhdWx0cyJdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItREMyQ09NUE9ORU5UTkFNRT1cImMyLmFuZHJvaWQubXBlZzQuZGVjb2RlclwiIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X200dmgyNjNkZWMiLAorICAgICAgICAibGliY29kZWMyX3NvZnRfbXBlZzRkZWMiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJDMkZ1enplckgyNjNEZWMiLAorICAgIGRlZmF1bHRzOiBbIkMyRnV6emVyLWRlZmF1bHRzIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1EQzJDT01QT05FTlROQU1FPVwiYzIuYW5kcm9pZC5oMjYzLmRlY29kZXJcIiIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9tNHZoMjYzZGVjIiwKKyAgICAgICAgImxpYmNvZGVjMl9zb2Z0X2gyNjNkZWMiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJDMkZ1enplclZwOERlYyIsCisgICAgZGVmYXVsdHM6IFsiQzJGdXp6ZXItZGVmYXVsdHMiXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURDMkNPTVBPTkVOVE5BTUU9XCJjMi5hbmRyb2lkLnZwOC5kZWNvZGVyXCIiLAorICAgIF0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGlidnB4IiwKKyAgICAgICAgImxpYmNvZGVjMl9zb2Z0X3ZwOGRlYyIsCisgICAgXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogIkMyRnV6emVyVnA5RGVjIiwKKyAgICBkZWZhdWx0czogWyJDMkZ1enplci1kZWZhdWx0cyJdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItREMyQ09NUE9ORU5UTkFNRT1cImMyLmFuZHJvaWQudnA5LmRlY29kZXJcIiIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJ2cHgiLAorICAgICAgICAibGliY29kZWMyX3NvZnRfdnA5ZGVjIiwKKyAgICBdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiQzJGdXp6ZXJBYWNEZWMiLAorICAgIGRlZmF1bHRzOiBbIkMyRnV6emVyLWRlZmF1bHRzIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1EQzJDT01QT05FTlROQU1FPVwiYzIuYW5kcm9pZC5hYWMuZGVjb2RlclwiIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYkZyYXVuaG9mZXJBQUMiLAorICAgICAgICAibGliY29kZWMyX3NvZnRfYWFjZGVjIiwKKyAgICBdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiQzJGdXp6ZXJBbXJuYkRlYyIsCisgICAgZGVmYXVsdHM6IFsiQzJGdXp6ZXItZGVmYXVsdHMiXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURDMkNPTVBPTkVOVE5BTUU9XCJjMi5hbmRyb2lkLmFtcm5iLmRlY29kZXJcIiIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9hbXJuYmRlYyIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9hbXJ3YmRlYyIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9hbXJuYl9jb21tb24iLAorICAgICAgICAibGliY29kZWMyX3NvZnRfYW1ybmJkZWMiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJDMkZ1enplckFtcndiRGVjIiwKKyAgICBkZWZhdWx0czogWyJDMkZ1enplci1kZWZhdWx0cyJdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItREMyQ09NUE9ORU5UTkFNRT1cImMyLmFuZHJvaWQuYW1yd2IuZGVjb2RlclwiIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2Ftcm5iZGVjIiwKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2FtcndiZGVjIiwKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2Ftcm5iX2NvbW1vbiIsCisgICAgICAgICJsaWJjb2RlYzJfc29mdF9hbXJ3YmRlYyIsCisgICAgXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogIkMyRnV6emVyRmxhY0RlYyIsCisgICAgZGVmYXVsdHM6IFsiQzJGdXp6ZXItZGVmYXVsdHMiXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURDMkNPTVBPTkVOVE5BTUU9XCJjMi5hbmRyb2lkLmZsYWMuZGVjb2RlclwiIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYkZMQUMiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZmxhY2RlYyIsCisgICAgICAgICJsaWJjb2RlYzJfc29mdF9mbGFjZGVjIiwKKyAgICBdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiQzJGdXp6ZXJHNzExQWxhd0RlYyIsCisgICAgZGVmYXVsdHM6IFsiQzJGdXp6ZXItZGVmYXVsdHMiXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURDMkNPTVBPTkVOVE5BTUU9XCJjMi5hbmRyb2lkLmc3MTEuYWxhdy5kZWNvZGVyXCIiLAorICAgIF0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAiY29kZWNzX2c3MTFkZWMiLAorICAgICAgICAibGliY29kZWMyX3NvZnRfZzcxMWFsYXdkZWMiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJDMkZ1enplckc3MTFNbGF3RGVjIiwKKyAgICBkZWZhdWx0czogWyJDMkZ1enplci1kZWZhdWx0cyJdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItREMyQ09NUE9ORU5UTkFNRT1cImMyLmFuZHJvaWQuZzcxMS5tbGF3LmRlY29kZXJcIiIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJjb2RlY3NfZzcxMWRlYyIsCisgICAgICAgICJsaWJjb2RlYzJfc29mdF9nNzExbWxhd2RlYyIsCisgICAgXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogIkMyRnV6emVyR3NtRGVjIiwKKyAgICBkZWZhdWx0czogWyJDMkZ1enplci1kZWZhdWx0cyJdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItREMyQ09NUE9ORU5UTkFNRT1cImMyLmFuZHJvaWQuZ3NtLmRlY29kZXJcIiIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJnc20iLAorICAgICAgICAibGliY29kZWMyX3NvZnRfZ3NtZGVjIiwKKyAgICBdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiQzJGdXp6ZXJNcDNEZWMiLAorICAgIGRlZmF1bHRzOiBbIkMyRnV6emVyLWRlZmF1bHRzIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1EQzJDT01QT05FTlROQU1FPVwiYzIuYW5kcm9pZC5tcDMuZGVjb2RlclwiIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X21wM2RlYyIsCisgICAgICAgICJsaWJjb2RlYzJfc29mdF9tcDNkZWMiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJDMkZ1enplck9wdXNEZWMiLAorICAgIGRlZmF1bHRzOiBbIkMyRnV6emVyLWRlZmF1bHRzIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1EQzJDT01QT05FTlROQU1FPVwiYzIuYW5kcm9pZC5vcHVzLmRlY29kZXJcIiIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJvcHVzIiwKKyAgICAgICAgImxpYmNvZGVjMl9zb2Z0X29wdXNkZWMiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJDMkZ1enplclJhd0RlYyIsCisgICAgZGVmYXVsdHM6IFsiQzJGdXp6ZXItZGVmYXVsdHMiXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURDMkNPTVBPTkVOVE5BTUU9XCJjMi5hbmRyb2lkLnJhdy5kZWNvZGVyXCIiLAorICAgIF0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGliY29kZWMyX3NvZnRfcmF3ZGVjIiwKKyAgICBdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiQzJGdXp6ZXJWb3JiaXNEZWMiLAorICAgIGRlZmF1bHRzOiBbIkMyRnV6emVyLWRlZmF1bHRzIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1EQzJDT01QT05FTlROQU1FPVwiYzIuYW5kcm9pZC52b3JiaXMuZGVjb2RlclwiIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYnZvcmJpc2lkZWMiLAorICAgICAgICAibGliY29kZWMyX3NvZnRfdm9yYmlzZGVjIiwKKyAgICBdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiQzJGdXp6ZXJYYWFjRGVjIiwKKyAgICBkZWZhdWx0czogWyJDMkZ1enplci1kZWZhdWx0cyJdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItREMyQ09NUE9ORU5UTkFNRT1cImMyLmFuZHJvaWQueGFhYy5kZWNvZGVyXCIiLAorICAgIF0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGlieGFhY2RlYyIsCisgICAgICAgICJsaWJjb2RlYzJfc29mdF94YWFjZGVjIiwKKyAgICBdLAorfQpkaWZmIC0tZ2l0IGEvbWVkaWEvY29kZWMyL2Z1enplci9DMkZ1enplci5jcHAgYi9tZWRpYS9jb2RlYzIvZnV6emVyL0MyRnV6emVyLmNwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi41MWUxMDEz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gICAgICAgc3RkOjpsaXN0PHN0ZDo6dW5pcXVlX3B0cjxDMldvcms+PiYgd29ya0l0ZW1zKTsKKworIHByaXZhdGU6CisgIGNsYXNzIEJ1ZmZlclNvdXJjZSB7CisgICBwdWJsaWM6CisgICAgQnVmZmVyU291cmNlKGNvbnN0IHVpbnQ4X3QqIGRhdGEsIHNpemVfdCBzaXplKSA6IG1EYXRhKGRhdGEpLCBtU2l6ZShzaXplKSB7CisgICAgICBtUmVhZEluZGV4ID0gKHNpemUgPD0ga01hcmtlclNpemUpID8gMCA6IChzaXplIC0ga01hcmtlclNpemUpOworICAgIH0KKyAgICB+QnVmZmVyU291cmNlKCkgeworICAgICAgbURhdGEgPSBudWxscHRyOworICAgICAgbVNpemUgPSAwOworICAgICAgbVJlYWRJbmRleCA9IDA7CisgICAgICBtRnJhbWVMaXN0LmNsZWFyKCk7CisgICAgfQorICAgIGJvb2wgaXNFb3MoKSB7IHJldHVybiBtRnJhbWVMaXN0LmVtcHR5KCk7IH0KKyAgICB2b2lkIHBhcnNlKCk7CisgICAgRnJhbWVEYXRhIGdldEZyYW1lKCk7CisKKyAgIHByaXZhdGU6CisgICAgYm9vbCBpc01hcmtlcigpIHsKKyAgICAgIGlmICgoa01hcmtlclNpemUgPCBtU2l6ZSkgJiYgKG1SZWFkSW5kZXggPCBtU2l6ZSAtIGtNYXJrZXJTaXplKSkgeworICAgICAgICByZXR1cm4gKG1lbWNtcCgmbURhdGFbbVJlYWRJbmRleF0sIGtNYXJrZXIsIGtNYXJrZXJTaXplKSA9PSAwKTsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgIH0KKyAgICB9CisKKyAgICBib29sIGlzQ1NETWFya2VyKHNpemVfdCBwb3NpdGlvbikgeworICAgICAgaWYgKChrTWFya2VyU3VmZml4U2l6ZSA8IG1TaXplKSAmJiAocG9zaXRpb24gPCBtU2l6ZSAtIGtNYXJrZXJTdWZmaXhTaXplKSkgeworICAgICA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KSB7Ci0gICAgZm9yIChjb25zdCBzdGQ6OnVuaXF1ZV9wdHI8QzJXb3JrPiYgd29yayA6IHdvcmtMaXN0KSB7Ci0gICAgICAgIGlmICghd29yaykgewotICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgIH0KLSAgICAgICAgZm9yIChjb25zdCBzdGQ6OnVuaXF1ZV9wdHI8QzJXb3JrbGV0PiYgd29ya2xldCA6IHdvcmstPndvcmtsZXRzKSB7Ci0gICAgICAgICAgICBpZiAod29ya2xldCkgewotICAgICAgICAgICAgICAgIGZvckVhY2hCbG9jayh3b3JrbGV0LT5vdXRwdXQsIHByb2Nlc3MpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotfQotCi1zcDxIR3JhcGhpY0J1ZmZlclByb2R1Y2VyPiBnZXRIZ2JwKGNvbnN0IHNwPElHcmFwaGljQnVmZmVyUHJvZHVjZXI+JiBpZ2JwKSB7Ci0gICAgc3A8SEdyYXBoaWNCdWZmZXJQcm9kdWNlcj4gaGdicCA9Ci0gICAgICAgICAgICBpZ2JwLT5nZXRIYWxJbnRlcmZhY2U8SEdyYXBoaWNCdWZmZXJQcm9kdWNlcj4oKTsKLSAgICByZXR1cm4gaGdicCA/IGhnYnAgOgotICAgICAgICAgICAgbmV3IEIySEdyYXBoaWNCdWZmZXJQcm9kdWNlcihpZ2JwKTsKLX0KLQotc3RhdHVzX3QgYXR0YWNoVG9CdWZmZXJRdWV1ZShjb25zdCBDMkNvbnN0R3JhcGhpY0Jsb2NrJiBibG9jaywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8SUdyYXBoaWNCdWZmZXJQcm9kdWNlcj4mIGlnYnAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGdlbmVyYXRpb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QqIGJxU2xvdCkgewotICAgIGlmICghaWdicCkgewotICAgICAgICBMT0coV0FSTklORyk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AgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBCdWZmZXJRdWV1ZURlZnM6Ok5VTV9CVUZGRVJfU0xPVFM7ICsraSkgewotICAgICAgICAgICAgaWYgKG1CcUlkID09IDAgfHwgIW1CdWZmZXJzW2ldKSB7Ci0gICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8X0MyQmxvY2tQb29sRGF0YT4gZGF0YSA9IG1Qb29sRGF0YXNbaV0ubG9jaygpOwotICAgICAgICAgICAgaWYgKCFkYXRhIHx8Ci0gICAgICAgICAgICAgICAgIV9DMkJsb2NrRmFjdG9yeTo6QmVnaW5BdHRhY2hCbG9ja1RvQnVmZmVyUXVldWUoZGF0YSkpIHsKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgICsrdHJ5TnVtOwotICAgICAgICAgICAgaW50IGJxU2xvdDsKLSAgICAgICAgICAgIG1CdWZmZXJzW2ldLT5zZXRHZW5lcmF0aW9uTnVtYmVyKGdlbmVyYXRpb24pOwotICAgICAgICAgICAgc3RhdHVzX3QgcmVzdWx0ID0gaWdicC0+YXR0YWNoQnVmZmVyKCZicVNsb3QsIG1CdWZmZXJzW2ldKTsKLSAgICAgICAgICAgIGlmIChyZXN1bHQgIT0gT0spIHsKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJvb2wgYXR0YWNoID0KLSAgICAgICAgICAgICAgICAgICAgX0MyQmxvY2tGYWN0b3J5OjpFbmRBdHRhY2hCbG9ja1RvQnVmZmVyUXVldWUoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSwgbU93bmVyLCBnZXRIZ2JwKG1JZ2JwKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZW5lcmF0aW9uLCBicUlkLCBicVNsb3QpOwotICAgICAgICAgICAgaWYgK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Ci0gICAgICAgIHJldHVybiBPSzsKLSAgICB9Ci0KLSAgICBtTXV0ZXgubG9jaygpOwotICAgIHNwPElHcmFwaGljQnVmZmVyUHJvZHVjZXI+IG91dHB1dElnYnAgPSBtSWdicDsKLSAgICB1aW50MzJfdCBvdXRwdXRHZW5lcmF0aW9uID0gbUdlbmVyYXRpb247Ci0gICAgdWludDY0X3Qgb3V0cHV0QnFJZCA9IG1CcUlkOwotICAgIG1NdXRleC51bmxvY2soKTsKLQotICAgIGlmICghb3V0cHV0SWdicCkgewotICAgICAgICBMT0coVkVSQk9TRSkgPDwgIm91dHB1dEJ1ZmZlciAtLSBvdXRwdXQgc3VyZmFjZSBpcyBudWxsLiI7Ci0gICAgICAgIHJldHVybiBOT19JTklUOwotICAgIH0KLQotICAgIGlmICghZGlzcGxheSkgewotICAgICAgICBMT0coV0FSTklORykgPDwgIm91dHB1dEJ1ZmZlciAtLSBjYW5ub3QgZGlzcGxheSAiCi0gICAgICAgICAgICAgICAgICAgICAiYnVmZmVycXVldWUtYmFzZWQgYmxvY2sgdG8gdGhlIGJ1ZmZlcnF1ZXVlLiI7Ci0gICAgICAgIHJldHVybiBVTktOT1dOX0VSUk9SOwotICAgIH0KLSAgICBpZiAoYnFJZCAhPSBvdXRwdXRCcUlkIHx8IGdlbmVyYXRpb24gIT0gb3V0cHV0R2VuZXJhdGlvbikgewotICAgICAgICBpbnQzMl90IGRpZmYgPSAoaW50MzJfdCkgb3V0cHV0R2VuZXJhdGlvbiAtIChpbnQzMl90KSBnZW5lcmF0aW9uOwotICAgICAgICBMT0coV0FSTklORykgPDwgIm91dHB1dEJ1ZmZlciAtLSBidWZmZXJzIGZyb20gb2xkIGdlbmVyYXRpb24gdG8gIgotICAgICAgICAgICAgICAgICAgICAgPDwgb3V0cHV0R2VuZXJhdGlvbiA8PCAiICwgZGlmZjogIiA8PCBkaWZmCi0gICAgICAgICAgICAgICAgICAgICA8PCAiICwgc2xvdDogIiA8PCBicVNsb3Q7Ci0gICA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k9SKSA8PCAiSW52YWxpZCBJbmZvQnVmZmVyOjpCdWZmZXI6OmJsb2Nrc1swXS5tZXRhLiI7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICAvLyBDb3B5IGZlbmNlLgorICAgIEMyRmVuY2UgZEZlbmNlOworICAgIGlmICghb2JqY3B5KCZkRmVuY2UsIHNCbG9jay5mZW5jZSkpIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiSW52YWxpZCBJbmZvQnVmZmVyOjpCdWZmZXI6OmJsb2Nrc1swXS5mZW5jZS4iOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLy8gQ29uc3RydWN0IGEgYmxvY2suCisgICAgc3dpdGNoIChiYXNlQmxvY2sudHlwZSkgeworICAgIGNhc2UgQzJCYXNlQmxvY2s6OkxJTkVBUjoKKyAgICAgICAgaWYgKHNCbG9ja01ldGEuc2l6ZSgpID09IDEgJiYgc0Jsb2NrTWV0YVswXSAhPSBudWxscHRyICYmCisgICAgICAgICAgICBzQmxvY2tNZXRhWzBdLT5zaXplKCkgPT0gc2l6ZW9mKEMySGlkbF9SYW5nZUluZm8pKSB7CisgICAgICAgICAgICBDMkhpZGxfUmFuZ2VJbmZvICpyYW5nZUluZm8gPQorICAgICAgICAgICAgICAgICAgICByZWludGVycHJldF9jYXN0PEMySGlkbF9SYW5nZUluZm8qPihzQmxvY2tNZXRhWzBdKTsKKyAgICAgICAgICAgIGQtPmVtcGxhY2VfYmFjayhDMkluZm9CdWZmZXI6OkNyZWF0ZUxpbmVhckJ1ZmZlcigKKyAgICAgICAgICAgICAgICAgICAgcy5pbmRleCwKKyAgICAgICAgICAgICAgICAgICAgYmFzZUJsb2NrLmxpbmVhci0+c2hhcmUoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmFuZ2VJbmZvLT5vZmZzZXQsIHJhbmdlSW5mby0+bGVuZ3RoLCBkRmVuY2UpKSk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICBMT0coRVJST1IpIDw8ICJJbnZhbGlkIE1ldGEgZm9yIEMyQmFzZUJsb2NrOjpMaW5lYXIgSW5mb0J1ZmZlci4iOworICAgICAgICBicmVhazsKKyAgICBjYXNlIEMyQmFzZUJsb2NrOjpHUkFQSElDOgorICAgICAgICAvLyBJdCdzIG5vdCB1c2VkIG5vdworICAgICAgICBMT0coRVJST1IpIDw8ICJOb24tVXNlZCBDMkJhc2VCbG9jazo6dHlwZSBmb3IgSW5mb0J1ZmZlci4iOworICAgICAgICBicmVhazsKKyAgICBkZWZhdWx0OgorICAgICAgICBMT0coRVJST1IpIDw8ICJJbnZhbGlkIEMyQmFzZUJsb2NrOjp0eXBlIGZvciBJbmZvQnVmZmVyLiI7CisgICAgICAgIGJyZWFrOworICAgIH0KKworICAgIHJldHVybiBmYWxzZTsKK30KKwogLy8gRnJhbWVEYXRhIC0+IEMyRnJhbWVEYXRhCiBib29sIG9iamNweShDMkZyYW1lRGF0YSogZCwgY29uc3QgRnJhbWVEYXRhJiBzLAogICAgICAgICBjb25zdCBzdGQ6OnZlY3RvcjxDMkJhc2VCbG9jaz4mIGJhc2VCbG9ja3MpIHsKQEAgLTEzNzUsOCArMTQzMSwxOCBAQAogICAgICAgICB9CiAgICAgfQogCi0gICAgLy8gVE9ETzogSW1wbGVtZW50IHRoaXMgb25jZSBDMkluZm9CdWZmZXIgaGFzIGNvbnN0cnVjdG9ycy4KICAgICBkLT5pbmZvQnVmZmVycy5jbGVhcigpOworICAgIGlmIChzLmluZm9CdWZmZXJzLnNpemUoKSA9PSAwKSB7CisgICAgICAgIC8vIEluZm9CdWZmZXIgaXMgb3B0aW9uYWwKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorICAgIGQtPmluZm9CdWZmZXJzLnJlc2VydmUocy5pbmZvQnVmZmVycy5zaXplKCkpOworICAgIGZvciAoY29uc3QgSW5mb0J1ZmZlciAmc0luZm9CdWZmZXI6IHMua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dCkocmFuZ2UubWF4KS5yZWY8dWludDMyX3Q+KCk7CisgICAgICAgICAgICBpZiAocm1heCA+PSAyKSB7CisgICAgICAgICAgICAgICAgKm5DaGFubmVscyA9IDI7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICpuQ2hhbm5lbHMgPSAxOworICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgQ29kZWMyQXVkaW9FbmNIaWRsVGVzdDo6ZmxhYzoKLSAgICAgICAgICAgICpuQ2hhbm5lbHMgPSAyOwotICAgICAgICAgICAgKm5TYW1wbGVSYXRlID0gNDgwMDA7Ci0gICAgICAgICAgICAqc2FtcGxlc1BlckZyYW1lID0gMTE1MjsKKyAgICAgICAgfQorICAgICAgICBjYXNlIEMyRmllbGRTdXBwb3J0ZWRWYWx1ZXM6OnR5cGVfdDo6VkFMVUVTOiB7CisgICAgICAgICAgICBmb3IgKGNvbnN0IEMyVmFsdWU6OlByaW1pdGl2ZSYgcHJpbSA6IGMyRlNWLnZhbHVlcykgeworICAgICAgICAgICAgICAgIGlmICgodWludDMyX3QpcHJpbS5yZWY8dWludDMyX3Q+KCkgPT0gMikgeworICAgICAgICAgICAgICAgICAgICAqbkNoYW5uZWxzID0gMjsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCh1aW50MzJfdClwcmltLnJlZjx1aW50MzJfdD4oKSA9PSAxKSB7CisgICAgICAgICAgICAgICAgICAgICpuQ2hhbm5lbHMgPSAxOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIENvZGVjMkF1ZGlvRW5jSGlkbFRlc3Q6Om9wdXM6Ci0gICAgICAgICAgICAqbkNoYW5uZWxzID0gMjsKLSAgICAgICAgICAgICpuU2FtcGxlUmF0ZSA9IDQ4MDAwOwotICAgICAgICAgICAgKnNhbXBsZXNQZXJGcmFtZSA9IDk2MDsKLSAg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FtcGxlc1BlckZyYW1lLCBuQ2hhbm5lbHMsIG5TYW1wbGVSYXRlKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU2FtcGxlc1BlckZyYW1lLCBtTnVtQ2hhbm5lbHMsIG1TYW1wbGVSYXRlKSk7CiAgICAgZXJyID0gbUNvbXBvbmVudC0+Zmx1c2goQzJDb21wb25lbnQ6OkZMVVNIX0NPTVBPTkVOVCwgJmZsdXNoZWRXb3JrKTsKICAgICBBU1NFUlRfRVEoZXJyLCBDMl9PSyk7CiAgICAgd2FpdE9uSW5wdXRDb25zdW1wdGlvbihtUXVldWVMb2NrLCBtUXVldWVDb25kaXRpb24sIG1Xb3JrUXVldWUsCkBAIC01NjYsOCArNTYxLDggQEAKICAgICBBU1NFUlRfRVEobVdvcmtRdWV1ZS5zaXplKCksIE1BWF9JTlBVVF9CVUZGRVJTKTsKICAgICBBU1NFUlRfTk9fRkFUQUxfRkFJTFVSRShlbmNvZGVORnJhbWVzKG1Db21wb25lbnQsIG1RdWV1ZUxvY2ssIG1RdWV1ZUNvbmRpdGlvbiwgbVdvcmtRdWV1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GbHVzaGVkSW5kaWNlcywgbUxpbmVhclBvb2wsIGVsZVN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bUZyYW1lcyAtIG51bUZyYW1lc0ZsdXNoZWQsIHNhbXBsZXNQZXJGcmFtZSwgbkNoYW5uZWxzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgblNhbXBsZVJhdGUsIHRydWUpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bUZyYW1lcyAtIG51bUZyYW1lc0ZsdXNoZWQsIG1TYW1wbGVzUGVyRnJhbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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Zmc2V0ID0gc2l6ZW9mKEMyUGFyYW0pOwotICAgICAgICBDMlBhcmFtKiBwYXJhbSA9IGluUGFyYW1zWzBdLmdldCgpOwotICAgICAgICBpbnQzMl90IGNoYW5uZWxDb3VudCA9ICooaW50MzJfdCopKCh1aW50OF90KilwYXJhbSArIG9mZnNldCk7CisgICAgICAgIGludDMyX3QgY2hhbm5lbENvdW50ID0gQzJTdHJlYW1DaGFubmVsQ291bnRJbmZvOjppbnB1dDo6RnJvbShpblBhcmFtc1swXS5nZXQoKSktPnZhbHVlOworCiAgICAgICAgIGlmIChjaGFubmVsQ291bnQgIT0gbkNoYW5uZWxzKSB7CiAgICAgICAgICAgICBzdGQ6OmNvdXQgPDwgIlsgICBXQVJOICAgXSBUZXN0IFNraXBwZWQgZm9yIENoYW5uZWxDb3VudCAiIDw8IG5DaGFubmVscyA8PCAiXG4iOwogICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgIH0KIAogICAgICAgICAvLyBUbyBjaGVjayBpZiB0aGUgaW5wdXQgc3RyZWFtIGlzIHN1ZmZpY2llbnQgdG8gZW5jb2RlIGZvciB0aGUgaGlnaGVyIGNoYW5uZWwgY291bnQKLSAgICAgICAgaW50MzJfdCBieXRlc0NvdW50ID0gKHNhbXBsZXNQZXJGcmFtZSAqIG5DaGFubmVscyAqIDIpICogbnVtRnJhbWVzOwotICAgICAgICBpZiAoZWxlU3RyZWFtLmdjb3VudCgpIDwgYnl0ZXNDb3VudCkgeworICAgICAgICBzdHJ1Y3Qgc3RhdCBidWY7CisgICAgICAgIHN0YXQobUlucHV0RmlsZS5jX3N0cigpLCAmYnVmKTsKKyAgICAgICAgc2l6ZV90IGZpbGVTaXplID0gYnVmLnN0X3NpemU7CisgICAgICAgIGludDMyX3QgYnl0ZXNDb3VudCA9IChtU2FtcGxlc1BlckZyYW1lICogbkNoYW5uZWxzICogMikgKiBudW1GcmFtZXM7CisgICAgICAgIGlmIChmaWxlU2l6ZSA8IGJ5dGVzQ291bnQpIHsKICAgICAgICAgICAgIHN0ZDo6Y291dCA8PCAiWyAgIFdBUk4gICBdIFRlc3QgU2tpcHBlZCBmb3IgQ2hhbm5lbENvdW50ICIgPDwgbkNoYW5uZWxzCiAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBiZWNhdXNlIG9mIGluc3VmZmljaWVudCBpbnB1dCBkYXRhXG4iOwogICAgICAgICAgICAgY29udGludWU7CkBAIC02NDMsNyArNjI2LDcgQEAKIAogICAgICAgICBBU1NFUlRfTk9fRkFUQUxfRkFJTFVSRShlbmNvZGVORnJhbWVzKG1Db21wb25lbnQsIG1RdWV1ZUxvY2ssIG1RdWV1ZUNvbmRpdGlvbiwgbVdvcmtRdWV1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmx1c2hlZEluZGljZXMsIG1MaW5lYXJQb29sLCBlbGVTdHJlYW0sIG51bUZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGVzUGVyRnJhbWUsIG5DaGFubmVscywgblNhbXBsZVJhdGUpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU2FtcGxlc1BlckZyYW1lLCBuQ2hhbm5lbHMsIG1TYW1wbGVSYXRlKSk7CiAKICAgICAgICAgLy8gbURpc2FibGVUZXN0IHdpbGwgYmUgc2V0IGlmIGJ1ZmZlciB3YXMgbm90IGZldGNoZWQgcHJvcGVybHkuCiAgICAgICAgIC8vIFRoaXMgbWF5IGhhcHBlbiB3aGVuIGNvbmZpZyBwYXJhbXMgaXMgbm90IHByb3BlciBidXQgY29uZmlnIHN1Y2NlZWRlZApAQCAtNjU3LDkgKzY0MCw2IEBACiAgICAgICAgIC8vIGJsb2NraW5nIGNhbGwgdG8gZW5zdXJlcyBhcHBsaWNhdGlvbiB0byBXYWl0IHRpbGwgYWxsIHRoZSBpbnB1dHMgYXJlIGNvbnN1bWVkCiAg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BlZCBmb3IgU2FtcGxlUmF0ZSAiIDw8IG5TYW1wbGVSYXRlCiAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBiZWNhdXNlIG9mIGluc3VmZmljaWVudCBpbnB1dCBkYXRhXG4iOwogICAgICAgICAgICAgY29udGludWU7CkBAIC03NDQsNyArNzE0LDcgQEAKIAogICAgICAgICBBU1NFUlRfTk9fRkFUQUxfRkFJTFVSRShlbmNvZGVORnJhbWVzKG1Db21wb25lbnQsIG1RdWV1ZUxvY2ssIG1RdWV1ZUNvbmRpdGlvbiwgbVdvcmtRdWV1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmx1c2hlZEluZGljZXMsIG1MaW5lYXJQb29sLCBlbGVTdHJlYW0sIG51bUZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGVzUGVyRnJhbWUsIG5DaGFubmVscywgblNhbXBsZVJhdGUpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU2FtcGxlc1BlckZyYW1lLCBtTnVtQ2hhbm5lbHMsIG5TYW1wbGVSYXRlKSk7CiAKICAgICAgICAgLy8gbURpc2FibGVUZXN0IHdpbGwgYmUgc2V0IGlmIGJ1ZmZlciB3YXMgbm90IGZldGNoZWQgcHJvcGVybHkuCiAgICAgICAgIC8vIFRoaXMgbWF5IGhhcHBlbiB3aGVuIGNvbmZpZyBwYXJhbXMgaXMgbm90IHByb3BlciBidXQgY29uZmlnIHN1Y2NlZWRlZApAQCAtNzU4LDEyICs3MjgsNiBAQAogICAgICAgICAvLyBibG9ja2luZyBjYWxsIHRvIGVuc3VyZXMgYXBwbGljYXRpb24gdG8gV2FpdCB0aWxsIGFsbCB0aGUgaW5wdXRzIGFyZSBjb25zdW1lZAogICAgICAgICB3YWl0T25JbnB1dENvbnN1bXB0aW9uKG1RdWV1ZUxvY2ssIG1RdWV1ZU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FZzogYzIuYW5kcm9pZC5hYWMuZGVjb2RlciAtIHRlc3QgYSBzcGVjaWZpYyBjb2RlYyBcbiI7CisgICAgc3RkOjpjZXJyIDw8ICJcdCAtaCwgIC0taGVscDogICBQcmludCB1c2FnZSBcbiI7Cit9CisKK3ZvaWQgcGFyc2VBcmdzKGludCBhcmdjLCBjaGFyKiogYXJndikgeworICAgIGludCBhcmc7CisgICAgaW50IG9wdGlvbl9pbmRleDsKKyAgICB3aGlsZSAoKGFyZyA9IGdldG9wdF9sb25nKGFyZ2MsIGFyZ3YsICI6UDpwOmgiLCBrQXJnT3B0aW9ucywgJm9wdGlvbl9pbmRleCkpICE9IC0xKSB7CisgICAgICAgIHN3aXRjaCAoYXJnKSB7CisgICAgICAgICAgICBjYXNlICdQJzoKKyAgICAgICAgICAgICAgICBzUmVzb3VyY2VEaXIgPSBvcHRhcmc7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlICdwJzoKKyAgICAgICAgICAgICAgICBzQ29tcG9uZW50TmFtZVByZWZpeCA9IG9wdGFyZzsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgJ2gnOgorICAgICAgICAgICAgICAgIHByaW50VXNhZ2UoYXJndlswXSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorfQorCiAvLyBUZXN0IHRoZSBjb2RlY3MgZm9yIE51bGxCdWZmZXIsIEVtcHR5IElucHV0IEJ1ZmZlciB3aXRoKG91dCkgZmxhZ3Mgc2V0CiB2b2lkIHRlc3RJbnB1dEJ1ZmZlcihjb25zdCBzdGQ6OnNoYXJlZF9wdHI8YW5kcm9pZDo6Q29kZWMyQ2xpZW50OjpDb21wb25lbnQ+JiBjb21wb25lbnQsCiAgICAgICAgICAgICAgICAgICAgICBzdGQ6Om11dGV4JiBxdWV1ZUxvY2ssIH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XBvbmVudDo6ZG9tYWluX3QgZG9tYWluLCBDMkNvbXBvbmVudDo6a2luZF90IGtpbmQpIHsKLSAgICBzdGF0aWMgc3RkOjp2ZWN0b3I8c3RkOjp0dXBsZTxzdGQ6OnN0cmluZywgc3RkOjpzdHJpbmc+PiBwYXJhbWV0ZXJzOworY29uc3Qgc3RkOjp2ZWN0b3I8VGVzdFBhcmFtZXRlcnM+JiBnZXRUZXN0UGFyYW1ldGVycyhDMkNvbXBvbmVudDo6ZG9tYWluX3QgZG9tYWluLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbXBvbmVudDo6a2luZF90IGtpbmQpIHsKKyAgICBzdGF0aWMgc3RkOjp2ZWN0b3I8VGVzdFBhcmFtZXRlcnM+IHBhcmFtZXRlcnM7CiAKICAgICBhdXRvIGluc3RhbmNlcyA9IGFuZHJvaWQ6OkNvZGVjMkNsaWVudDo6R2V0U2VydmljZU5hbWVzKCk7CiAgICAgZm9yIChzdGQ6OnN0cmluZyBpbnN0YW5jZSA6IGluc3RhbmNlcykgewpAQCAtMTU3LDExICsxOTcsMTggQEAKICAgICAgICAgICAgICAgICAodHJhaXRzLmRvbWFpbiAhPSBkb21haW4gfHwgdHJhaXRzLmtpbmQgIT0ga2luZCkpIHsKICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgIH0KLQorICAgICAgICAgICAgaWYgKHRyYWl0cy5uYW1lLnJmaW5kKHNDb21wb25lbnROYW1lUHJlZml4LCAwKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgQUxPR0QoIlNraXBwaW5nIHRlc3RzIGZvciAlcy4gUHJlZml4IHNwZWNpZmllZCBpcyAlcyIsIHRyYWl0cy5uYW1lLmNfc3RyKCksCisgICAgICAgICAgICAgICAgICAgICAgc0NvbXBvbmVudE5hbWVQcmVmaXguY19zdHIoKSk7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CiAgIC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gICBtQ29tcG9uZW50LT5xdWVyeSh7JnJlb3JkZXJCdWZmZXJEZXB0aH0sIHt9LCBDMl9NQVlfQkxPQ0ssCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxscHRyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnQtPnF1ZXJ5KHsmcmVvcmRlckJ1ZmZlckRlcHRofSwge30sIEMyX01BWV9CTE9DSywgbnVsbHB0cik7CiAgICAgICAgICAgICAgICAgICAgICAgICBtUmVvcmRlckRlcHRoID0gcmVvcmRlckJ1ZmZlckRlcHRoLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1SZW9yZGVyRGVwdGggPiAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVE9ETzogQWRkIHZhbGlkYXRpb24gZm9yIHJlb3JkZXJlZCBvdXRwdXQKQEAgLTI2NywxOCArMzAxLDcgQEAKICAgICAgICAgfQogICAgIH0KIAotICAgIGVudW0gc3RhbmRhcmRDb21wIHsKLSAgICAgICAgaDI2MywKLSAgICAgICAgYXZjLAotICAgICAgICBtcGVnMiwKLSAgICAgICAgbXBlZzQsCi0gICAgICAgIGhldmMsCi0gICAgICAgIHZwOCwKLSAgICAgICAgdnA5LAotICAgICAgICBhdjEsCi0gICAgICAgIHVua25vd25fY29tcCwKLSAgICB9OwotCisgICAgc3RkOjpzdHJpbmcgbU1pbWU7CiAgICAgc3RkOjpzdHJpbmcgbUluc3RhbmNlTmFtZTsKICAgICBzdGQ6OnN0cmluZyBtQ29tcG9uZW50TmFtZTsKIApAQCAtMjkxLDcgKzMxNCw2IEBACiAgICAgY2hhciogbVJlZk1kNTsKICAgICBzdGQ6Omxpc3Q8dWludDY0X3Q+IG1UaW1lc3RhbXBVc2xpc3Q7CiAgICAgc3RkOjpsaXN0PHVpbnQ2NF90PiBtRmx1c2hlZEluZGljZXM7Ci0gICAgc3RhbmRhcmRDb21wIG1Db21wTm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Lm1kNSIsICIifX0sCi0gICAgfTsKLQotICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgc2l6ZW9mKGtDb21wVG9VUkwpIC8gc2l6ZW9mKGtDb21wVG9VUkxbMF0pOyArK2kpIHsKLSAgICAgICAgaWYgKGtDb21wVG9VUkxbaV0uY29tcCA9PSBjb21wKSB7Ci0gICAgICAgICAgICBzdHJjYXQobVVSTCwga0NvbXBUb1VSTFtpXS5tVVJMW3N0cmVhbUluZGV4XSk7Ci0gICAgICAgICAgICBzdHJjYXQoaW5mbywga0NvbXBUb1VSTFtpXS5pbmZvW3N0cmVhbUluZGV4XSk7Ci0gICAgICAgICAgICBzdHJjYXQoY2hrc3VtLCBrQ29tcFRvVVJMW2ldLmNoa3N1bVtzdHJlYW1JbmRleF0pOwotICAgICAgICAgICAgcmV0dXJuOworICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgZ0NvbXBUb0ZpbGVzLnNpemUoKTsgKytpKSB7CisgICAgICAgIGlmICghbU1pbWUuY29tcGFyZSgidmlkZW8vIiArIGdDb21wVG9GaWxlc1tpXS5taW1lKSkgeworICAgICAgICAgICAgaWYgKHN0cmVhbUNvdW50ID09IHN0cmVhbUluZGV4KSB7CisgICAgICAgICAgICAgICAgbUlucHV0RmlsZSA9IHNSZXNvdXJjZURpciArIGdDb21wVG9GaWxlc1tpXS5pbnB1dEZpbGU7CisgICAgICAgICAgICAgICAgbUluZm9GaWxlID0gc1Jlc291cmNlRGlyICsgZ0NvbXBUb0ZpbGVzW2ldLmluZm9GaWxlOworICAgICAgICAgICAgICAgIG1DaGtzdW1GaWxlID0gc1Jlc291cmNlRGlyICsgZ0NvbXBUb0ZpbGVzW2ldLmNoa3N1bUZpbGU7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzdHJlYW1Db3VudCsrOwogICAgICAgICB9CiAgICAgfQorICAgIHJldHVybiBmYWxzZTsKIH0KIAotdm9p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RGlyLmNfc3RyKCkpOwotICAgICAgICBHZXRVUkxGb3JDb21wb25lbnQobUNvbXBOYW1lLCBtVVJMLCBpbmZvLCBpICUgU1RSRUFNX0NPVU5UKTsKLSAgICAgICAgaWYgKCEoc3RyY21wKG1VUkwsIHNSZXNvdXJjZURpci5jX3N0cigpKSkgfHwgIShzdHJjbXAoaW5mbywgc1Jlc291cmNlRGlyLmNfc3RyKCkpKSkgeworICAgICAgICBib29sIHZhbGlkID0gZ2V0RmlsZU5hbWVzKGkgJSBBREFQVElWRV9TVFJFQU1fQ09VTlQpOworICAgICAgICBpZiAoIXZhbGlkKSB7CiAgICAgICAgICAgICBBTE9HVigiU3RyZWFtIG5vdCBhdmFpbGFibGUsIHNraXBwaW5nIHRoaXMgaW5kZXgiKTsKICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICB9CiAKLSAgICAgICAgZWxlSW5mby5vcGVuKGluZm8pOwotICAgICAgICBBU1NFUlRfRVEoZWxlSW5mby5pc19vcGVuKCksIHRydWUpIDw8IG1VUkwgPDwgIiAtIGZpbGUgbm90IGZvdW5kIjsKKyAgICAgICAgZWxlSW5mby5vcGVuKG1JbmZvRmlsZSk7CisgICAgICAgIEFTU0VSVF9FUShlbGVJbmZvLmlzX29wZW4oKSwgdHJ1ZSkgPDwgbUlucHV0RmlsZSA8PCAiIC0gZmlsZSBub3QgZm91bmQiOwogICAgICAgICBpbnQgYnl0ZXNDb3VudCA9IDA7CiAgICAgICAgIHVpbnQzMl90IGZsYWdzID0gMDsKICAgICAgICAgdWludDMyX3QgdGltZXN0YW1wID0gMDsKQEAgLTczNCwxMyArNzI4LDEyIEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAodGltZXN0YW1wTWF4IDwgdGltZXN0YW1wKSB0aW1lc3RhbXBNYXggPSB0aW1lc3RhbXA7CiAgICAgICAgIH0KLSAgICAgICAgdGltZXN0YW1wT2Zmc2V0ID0gdGltZXN0YW1wTWF4OworICAgICAgICB0aW1l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mYWlsZWQiOworICAgICAgICBBU1NFUlRfRVEocXVlcmllZC5zaXplKCksIDEpIDw8ICJTaXplIG9mIHRoZSB2ZWN0b3IgcmV0dXJuZWQgaXMgaW52YWxpZCI7CiAKLSAgICAgICAgY29uc3QgU3RyaW5nVG9OYW1lIGtTdHJpbmdUb05hbWVbXSA9IHsKLSAgICAgICAgICAgICAgICB7ImgyNjMiLCBoMjYzfSwgeyJhdmMiLCBhdmN9LCB7Im1wZWc0IiwgbXBlZzR9LAotICAgICAgICAgICAgICAgIHsiaGV2YyIsIGhldmN9LCB7InZwOCIsIHZwOH0sIHsidnA5IiwgdnA5fSwKLSAgICAgICAgfTsKLQotICAgICAgICBjb25zdCBzaXplX3Qga051bVN0cmluZ1RvTmFtZSA9IHNpemVvZihrU3RyaW5nVG9OYW1lKSAvIHNpemVvZihrU3RyaW5nVG9OYW1lWzBdKTsKLQotICAgICAgICAvLyBGaW5kIHRoZSBjb21wb25lbnQgdHlwZQotICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IGtOdW1TdHJpbmdUb05hbWU7ICsraSkgewotICAgICAgICAgICAgaWYgKHN0cmNhc2VzdHIobUNvbXBvbmVudE5hbWUuY19zdHIoKSwga1N0cmluZ1RvTmFtZVtpXS5OYW1lKSkgewotICAgICAgICAgICAgICAgIG1Db21wTmFtZSA9IGtTdHJpbmdUb05hbWVbaV0uQ29tcE5hbWU7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KKyAgICAgICAgbU1pbWUgPSAoKEMyUG9ydE1lZGlhVHlwZVNldHRpbmc6Om91dHB1dCopcXVlcmllZFswXS5nZXQoKSktPm0udmFsdWU7CisgICAgICAgIHN0ZDo6Y291dCA8PCAibWltZSA6ICIgPDwgbU1pbWUgPDwgIlxuIjsKICAgICAgICAgbUVvcyA9IGZhbHNlOwogICAgICAgICBtQ3NkID0gZmFsc2U7CiAgICAgICAgIG1Db25maWdCUGljdHVyZXMgPSBmYWxzZTsKQEAgLTEwNiw3ICs4OSwyNiBAQAogICAgICAgICBtVGltZXN0YW1wVXMgPSAwdTsKICAgICAgICAgbU91dHB1dFNpemUgPSAwdTsKICAgICAgICAgbVRpbWVzdGFtcERldlRlc3QgPSBmYWxzZTsKLSAgICAgICAgaWYgKG1Db21wTmFtZSA9PSB1bmtub3duX2NvbXApIG1EaXNhYmxlVGVzdCA9IHRydWU7CisgICAgICAgIG1XaWR0aCA9IEVOQ19ERUZBVUxUX0ZSQU1FX1dJRFRIOworICAgICAgICBtSGVpZ2h0ID0gRU5DX0RFRkFVTFRfRlJBTUVfSEVJR0hUOworICAgICAgICBtTWF4V2lkdGggPSAwOworICAgICAgICBtTWF4SGVpZ2h0ID0gMDsKKyAgICAgICAgbU1pbldpZHRoID0gSU5UMzJfTUFYOworICAgICAgICBtTWluSGVpZ2h0ID0gSU5UMzJfTUFYOworCisgICAgICAgIEFTU0VSVF9FUShnZXRNYXhNaW5SZXNvbHV0aW9uU3VwcG9ydGVkKCksIEMyX09LKTsKKyAgICAgICAgbVdpZHRoID0gc3RkOjptYXgoc3RkOjptaW4obVdpZHRoLCBtTWF4V2lkdGgpLCBtTWluV2lkdGgpOworICAgICAgICBtSGVpZ2h0ID0gc3RkOjptYXgoc3RkOjptaW4obUhlaWdodCwgbU1heEhlaWdodCksIG1NaW5IZWlnaHQpOworICAgICAgICBBTE9HVigibVdpZHRoICVkIG1IZWlnaHQgJWQiLCBtV2lkdGgsIG1IZWlnaHQpOworCisgICAgICAgIEMyU2VjdXJlTW9kZVR1bmluZyBzZWN1cmVNb2RlVHVuaW5ne307CisgICAgICAgIG1Db21wb25lbnQtPnF1ZXJ5KHsmc2VjdXJlTW9kZVR1bmluZ30sIHt9LCBDMl9NQVlfQkxPQ0ssIG51bGxwdHIpOworICAgICAgICBpZiAoc2VjdXJlTW9kZVR1bmluZy52YWx1ZSA9PSBDMkNvbmZpZzo6U01fUkVBRF9QUk9URUNURUQgfHwKKyAgICA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RhdGEsIGRlZmF1bHRCeXRlc0NvdW50KTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfRVEoZWxlU3RyZWFtLmdjb3VudCgpLCBkZWZhdWx0Qnl0ZXNDb3VudCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmaWxsQnl0ZUJ1ZmZlcihkYXRhLCBzcmNEYXRhLCBuV2lkdGgsIG5IZWlnaHQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKGVsZVN0cmVhbS5pc19vcGVuKCkpIHsKKyAgICAgICAgICAgICAgICBlbGVTdHJlYW0ucmVhZChkYXRhLCBieXRlc0NvdW50KTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfRVEoZWxlU3RyZWFtLmdjb3VudCgpLCBieXRlc0NvdW50KTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJHcmFwaGljQmxvY2s+IGJsb2NrOwogICAgICAgICBlcnIgPSBncmFwaGljUG9vbC0+ZmV0Y2hHcmFwaGljQmxvY2sobldpZHRoLCBuSGVpZ2h0LCBIQUxfUElYRUxfRk9STUFUX1lWMTIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7QzJNZW1vcnlVc2FnZTo6Q1BVX1JFQUQsIEMyTWVtb3J5VXNhZ2U6OkNQVV9XUklURX0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7QzJNZW1vcnlVc2FnZTo6Q1BVX1JFQUQgfCBjb21wVXNhZ2UudmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJNZW1vcnlVc2FnZTo6Q1BVX1dSSVRFIHwgY29tcFVzYWdlLnZhbHVlfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZibG9jayk7CiAgICAgICAgIGlmIChlcnIgIT0gQzJfT0spIHsK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TsKKyAgICAgICAgICAgIG1NaW5XaWR0aCA9ICh1aW50MzJfdCkod2lkdGhSYW5nZS5taW4pLnJlZjx1aW50MzJfdD4oKTsKKyAgICAgICAgICAgIG1NaW5IZWlnaHQgPSAodWludDMyX3QpKGhlaWdodFJhbmdlLm1pbikucmVmPHVpbnQzMl90PigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBDMkZpZWxkU3VwcG9ydGVkVmFsdWVzOjp0eXBlX3Q6OlZBTFVFUzogeworICAgICAgICAgICAgaW50MzJfdCBjdXJyID0gMDsKKyAgICAgICAgICAgIGZvciAoY29uc3QgQzJWYWx1ZTo6UHJpbWl0aXZlJiBwcmltIDogYzJGU1ZXaWR0aC52YWx1ZXMpIHsKKyAgICAgICAgICAgICAgICBjdXJyID0gKHVpbnQzMl90KXByaW0ucmVmPHVpbnQzMl90PigpOworICAgICAgICAgICAgICAgIG1NYXhXaWR0aCA9IHN0ZDo6bWF4KGN1cnIsIG1NYXhXaWR0aCk7CisgICAgICAgICAgICAgICAgbU1pbldpZHRoID0gc3RkOjptaW4oY3VyciwgbU1pbldpZHRoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZvciAoY29uc3QgQzJWYWx1ZTo6UHJpbWl0aXZlJiBwcmltIDogYzJGU1ZIZWlnaHQudmFsdWVzKSB7CisgICAgICAgICAgICAgICAgY3VyciA9ICh1aW50MzJfdClwcmltLnJlZjx1aW50MzJfdD4oKTsKKyAgICAgICAgICAgICAgICBtTWF4SGVpZ2h0ID0gc3RkOjptYXgoY3VyciwgbU1heEhlaWdodCk7CisgICAgICAgICAgICAgICAgbU1pbkhlaWdodCA9IHN0ZDo6bWluKGN1cnIsIG1NaW5IZWlnaHQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIEFMT0dFKCJOb24gc3VwcG9ydGVkIGRhd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sKQEAgLTQ1OSw5ICs1MzIsMTcgQEAKICAgICAgICAgICAgICAgICAgIDw8ICIgcmVzZXR0aW5nIG51bSBCRnJhbWVzIHRvIDBcbiI7CiAgICAgICAgIG1Db25maWdCUGljdHVyZXMgPSBmYWxzZTsKICAgICB9IGVsc2UgewotICAgICAgICBzaXplX3Qgb2Zmc2V0ID0gc2l6ZW9mKEMyUGFyYW0pOwotICAgICAgICBDMlBhcmFtKiBwYXJhbSA9IGluUGFyYW1zWzBdLmdldCgpOwotICAgICAgICBpbnQzMl90IG51bUJGcmFtZXMgPSAqKGludDMyX3QqKSgodWludDhfdCopcGFyYW0gKyBvZmZzZXQpOworICAgICAgICBpbnQzMl90IG51bUJGcmFtZXMgPSAwOworICAgICAgICBDMlN0cmVhbUdvcFR1bmluZzo6b3V0cHV0KiBnb3AgPSBDMlN0cmVhbUdvcFR1bmluZzo6b3V0cHV0OjpGcm9tKGluUGFyYW1zWzBdLmdldCgpKTsKKyAgICAgICAgaWYgKGdvcCAmJiBnb3AtPmZsZXhDb3VudCgpID49IDEpIHsKKyAgICAgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgZ29wLT5mbGV4Q291bnQoKTsgKytpKSB7CisgICAgICAgICAgICAgICAgY29uc3QgQzJHb3BMYXllclN0cnVjdCYgbGF5ZXIgPSBnb3AtPm0udmFsdWVzW2ldOworICAgICAgICAgICAgICAgIGlmIChsYXllci50eXBlXyA9PSBDMkNvbmZpZzo6cGljdHVyZV90eXBlX3QoUF9GUkFNRSB8IEJfRlJBTUUpKSB7CisgICAgICAgICAgICAgICAgICAgIG51bUJGcmFtZXMgPSBsYXllci5jb3VudDsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CiAKICAgICAgICAgaWYgKCFudW1CRnJhbWVzKSB7CiAgICAgICAgICAgICBzdGQ6OmNvdXQgPDwgIlsgICBXQVJOICAgXSBCZnJhbW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0gICAgaW50MzJfdCBuSGVpZ2h0ID0gRU5DX0RFRkFVTFRfRlJBTUVfSEVJR0hUOwotICAgIGlmICghc2V0dXBDb25maWdQYXJhbShuV2lkdGgsIG5IZWlnaHQpKSB7Ci0gICAgICAgIHN0ZDo6Y291dCA8PCAiWyAgIFdBUk4gICBdIFRlc3QgU2tpcHBlZCBcbiI7Ci0gICAgICAgIHJldHVybjsKKyAgICBpZiAoIXNldHVwQ29uZmlnUGFyYW0obVdpZHRoLCBtSGVpZ2h0KSkgeworICAgICAgICBBU1NFUlRfVFJVRShmYWxzZSkgPDwgIkZhaWxlZCB3aGlsZSBjb25maWd1cmluZyBoZWlnaHQgYW5kIHdpZHRoIGZvciAiIDw8IG1Db21wb25lbnROYW1lOwogICAgIH0KICAgICBBU1NFUlRfRVEobUNvbXBvbmVudC0+c3RhcnQoKSwgQzJfT0spOwogCkBAIC03ODYsOCArODU5LDggQEAKIAogICAgICAgICBBU1NFUlRfTk9fRkFUQUxfRkFJTFVSRShlbmNvZGVORnJhbWVzKG1Db21wb25lbnQsIG1RdWV1ZUxvY2ssIG1RdWV1ZUNvbmRpdGlvbiwgbVdvcmtRdWV1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmx1c2hlZEluZGljZXMsIG1HcmFwaGljUG9vbCwgZWxlU3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1EaXNhYmxlVGVzdCwgaW5wdXRGcmFtZUlkLCBFTkNfTlVNX0ZSQU1FUywgbldpZHRoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5IZWlnaHQsIGZhbHNlLCBmYWxzZSkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1EaXNhYmxlVGVzdCwgaW5wdXRGcmFtZUlkLCBFTkNfTlVNX0ZSQU1FUywgbVdpZHRoLAorICAgICAgICAg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TQ0LDYgKzUyLDEyIEBACiAgICAgICAgICJsaWJzdGFnZWZyaWdodF9idWZmZXJwb29sQDIuMC4xIiwKICAgICAgICAgImxpYnVpIiwKICAgICBdLAorCisgICAgLy8gRGV2aWNlIGRvZXMgbm90IGJvb3Qgd2hlbiBnbG9iYWwgVGhpbkxUTyBpcyBlbmFibGVkIGZvciB0aGlzIGxpYnJhcnkuCisgICAgLy8gaHR0cDovL2IvMTcwNTk1NDI5CisgICAgbHRvOiB7CisgICAgICAgIG5ldmVyOiB0cnVlLAorICAgIH0sCiB9CiAKIApAQCAtODUsNiArOTksNyBAQAogICAgICAgICAibGliYmFzZSIsCiAgICAgICAgICJsaWJjb2RlYzIiLAogICAgICAgICAibGliY29kZWMyX2hpZGxAMS4wIiwKKyAgICAgICAgImxpYmNvZGVjMl9oaWRsX3BsdWdpbl9zdHViIiwKICAgICAgICAgImxpYmNvZGVjMl92bmRrIiwKICAgICAgICAgImxpYmN1dGlscyIsCiAgICAgICAgICJsaWJoaWRsYmFzZSIsCkBAIC05OSw5ICsxMTQsMTcgQEAKICAgICAgICAgdmVuZG9yOiB7CiAgICAgICAgICAgICBleGNsdWRlX3NoYXJlZF9saWJzOiBbCiAgICAgICAgICAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2J1ZmZlcnF1ZXVlX2hlbHBlcl9ub3ZuZGsiLAorICAgICAgICAgICAgICAgICJsaWJjb2RlYzJfaGlkbF9wbHVnaW5fc3R1YiIsCiAgICAgICAgICAgICBdLAogICAgICAgICAgICAgc2hhcmVkX2xpYnM6IFsKICAgICAgICAgICAgICAgICAibGlic3RhZ2VmcmlnaHRfYnVmZmVycXVldWVfaGVscGVyIiwKKyAgICAgICAgICAgICAgICAibGliY29kZWMyX2hpZGxfcGx1Z2luIiwKKyAgICAgICAgICAgIF0sCisgICAgICAgIH0sCisgICAgICAgIGFwZXg6IHsKKyAgICAgICAgICAgIGV4Y2x1ZGVfc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgICAg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iIsCisgICAgICAgICJsaWJjb2RlYzJfaGlkbF9jbGllbnRAMS4wIiwKKyAgICAgICAgImxpYmNvZGVjMl9oaWRsX2NsaWVudEAxLjEiLAorICAgICAgICAibGliY29kZWMyX3ZuZGsiLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICAgICAgImxpYmd1aSIsCisgICAgICAgICJsaWJoaWRsYmFzZSIsCisgICAgICAgICJsaWJsb2ciLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfYnVmZmVycG9vbEAyLjAuMSIsCisgICAgICAgICJsaWJ1aSIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgXSwKKworICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsKKyAgICAgICAgImluY2x1ZGUiLAorICAgIF0sCisKKyAgICBleHBvcnRfc2hhcmVkX2xpYl9oZWFkZXJzOiBbCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLm1lZGlhLmMyQDEuMCIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLm1lZGlhLmMyQDEuMSIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLm1lZGlhLmMyQDEuMiIsCisgICAgICAgICJsaWJjb2RlYzIiLAorICAgICAgICAibGliY29kZWMyX2hpZGxfY2xpZW50QDEuMCIsCisgICAgICAgICJsaWJjb2RlYzJfaGlkbF9jbGllbnRAMS4xIiwKKyAgICAgICAgImxpYmd1aSIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9idWZmZXJwb29sQDIuMC4xIiwKKyAgICAgICAgImxpYnVpIiwKKyAgICBdLAorCisgICAgLy8gRGV2aWNlIGRvZXMgbm90IGJvb3Qgd2hlbiBnbG9iYWwgVGhpbkxUTyBpcyBlbmFibGVkIGZvciB0aGlzIGxpYnJhcnkuCisgICAgLy8gaHR0cDovL2IvMTcwNTk1NDI5CisgICAgbHRvOiB7CisgICAgICAgIG5ldmVyOiB0cnVlLAorICAgIH0sCit9CisKKworLy8gRE8gTk9UIERFUEVORCBPTiBUSElTIERJUkVDVExZCisvLyB1c2UgbGliY29kZWMyLWhpZGwtZGVmYXVsdHMgaW5zdGVhZAorY2NfbGlicmFyeSB7CisgICAgbmFtZTogImxpYmNvZGVjMl9oaWRsQDEuMiIsCisgICAgdmVuZG9yX2F2YWlsYWJsZTogdHJ1ZSwKKyAgICBtaW5fc2RrX3ZlcnNpb246ICIyOSIsCisgICAgYXBleF9hdmFpbGFibGU6IFsKKyAgICAgICAgIi8vYXBleF9hdmFpbGFibGU6cGxhdGZvcm0iLAorICAgICAgICAiY29tLmFuZHJvaWQubWVkaWEuc3djb2RlYyIsCisgICAgICAgICJ0ZXN0X2NvbS5hbmRyb2lkLm1lZGlhLnN3Y29kZWMiLAorICAgIF0sCisKKyAgICBkZWZhdWx0czogWyJoaWRsX2RlZmF1bHRzIl0sCisKKyAgICBzcmNzOiBbCisgICAgICAgICJDb21wb25lbnQuY3BwIiwKKyAgICAgICAgIkNvbXBvbmVudEludGVyZmFjZS5jcHAiLAorICAgICAgICAiQ29tcG9uZW50U3RvcmUuY3BwIiwKKyAgICAgICAgIkNvbmZpZ3VyYWJsZS5jcHAiLAorICAgICAgICAiSW5wdXRCdWZmZXJNYW5hZ2VyLmNwcCIsCisgICAgICAgICJJbnB1dFN1cmZhY2UuY3BwIiwKKyAgICAgICAgIklucHV0U3VyZmFjZUNvbm5lY3Rpb24uY3BwIiwKKyAgICAgICAgInR5cGVzLmNwcCIsCisgICAgXSwKKworICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJiaW5kZXJfaGVhZGVycyIsCisgICAgICAgICJsaWJzeXN0ZW1faGVhZGVycyIsCisgICAgICAgICJsaWJjb2RlYzJfaW50ZXJuYWwiLCAvLyBwcml2YXRlCisgICAgXSwKKworICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmdyYXBoaWNzLmJ1ZmZlcnF1ZXVlQDEuMCIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmdyYXBoaWNzLmJ1ZmZlcnF1ZXVlQDIuMCIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmdyYXBoaWNzLmNvbW1vbkAxLjAiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYUAxLjAiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5idWZmZXJwb29sQDIuMCIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLm1lZGlhLmMyQDEuMCIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLm1lZGlhLmMyQDEuMSIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLm1lZGlhLmMyQDEuMiIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLm1lZGlhLm9teEAxLjAiLAorICAgICAgICAibGliYmFzZSIsCisgICAgICAgICJsaWJjb2RlYzIiLAorICAgICAgICAibGliY29kZWMyX2hpZGxAMS4wIiwKKyAgICAgICAgImxpYmNvZGVjMl9oaWRsQDEuMSIsCisgICAgICAgICJsaWJjb2RlYzJfaGlkbF9wbHVnaW5fc3R1YiIsCisgICAgICAgICJsaWJjb2RlYzJfdm5kayIsCisgICAgICAgICJsaWJjdXRpbHMiLAorICAgICAgICAibGliaGlkbGJhc2UiLAorICAgICAgICAibGlibG9nIiwKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2J1ZmZlcnBvb2xAMi4wLjEiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfYnVmZmVycXVldWVfaGVscGVyX25vdm5kayIsCisgICAgICAgICJsaWJ1aSIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgXSwKKworICAgIHRhcmdldDogeworICAgICAgICB2ZW5kb3I6IHsKKyAgICAgICAgICAgIGV4Y2x1ZGVfc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgICAgICAgICAibGlic3RhZ2VmcmlnaHRfYnVmZmVycXVldWVfaGVscGVyX25vdm5kayIsCisgICAgICAgICAgICAgICAgImxpYmNvZGVjMl9oaWRsX3BsdWdpbl9zdHViIiwKKyAgICAgICAgICAgIF0sCisgICAgICAgICAgICBzaGFyZWRfbGliczogWworICAgICAgICAgICAgICAgICJsaWJzdGFnZWZyaWdodF9idWZmZXJxdWV1ZV9oZWxwZXIiLAorICAgICAgICAgICAgICAgICJsaWJjb2RlYzJfaGlkbF9wbHVnaW4iLAorICAgICAgICAgICAgXSwKKyAgICAgICAgfSwKKyAgICAgICAgYXBleDogeworICAgICAgICAgICAgZXhjbHVkZV9zaGFyZWRfbGliczogWworICAgICAgICAgICAgICAgICJsaWJjb2RlYzJfaGlkbF9wbHVnaW5fc3R1YiIsCisgICAgICAgICAgICAgICAgImxpYmNvZGVjMl9oaWRsX3BsdWdpbiIsCisgICAgICAgICAgICBdLAorICAgICAgICB9LAorICAgIH0sCisKKyAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJpbmNsdWRlIiwKKyAgICBdLAorCisgICAgZXhwb3J0X3NoYXJlZF9saWJfaGVhZGVyczogWworICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5jMkAxLjAiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5jMkAxLjEiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5jMkAxLjIiLAorICAgICAgICAibGliY29kZWMyIiwKKyAgICAgICAgImxpYmNvZGVjMl9oaWRsQDEuMCIsCisgICAgICAgICJsaWJjb2RlYzJfaGlkbEAxLjEiLAorICAgICAgICAibGliY29kZWMyX3ZuZGsiLAorICAgICAgICAibGliaGlkbGJhc2UiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfYnVmZmVycG9vbEAyLjAuMSIsCisgICAgICAgICJsaWJ1aSIsCisgICAgXSwKK30KKworLy8gcHVibGljIGRlcGVuZGVuY3kgZm9yIENvZGVjIDIuMCBIQUwgc2VydmljZSBpbXBsZW1lbnRhd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AgICAgICAgICBpZiAoIXRyYW5zU3RhdHVzLmlzT2soKSkgeworICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkNvbXBvbmVudDo6TGlzdGVuZXI6Om9uRXJyb3JfbmIgLS0gIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgInRyYW5zYWN0aW9uIGZhaWxlZC4iOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkIG9uVHJpcHBlZF9uYigKKyAgICAgICAgICAgIHN0ZDo6d2Vha19wdHI8QzJDb21wb25lbnQ+IC8qIGMyY29tcG9uZW50ICovLAorICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjpzaGFyZWRfcHRyPEMyU2V0dGluZ1Jlc3VsdD4+IGMyc2V0dGluZ1Jlc3VsdAorICAgICAgICAgICAgKSBvdmVycmlkZSB7CisgICAgICAgIHNwPElDb21wb25lbnRMaXN0ZW5lcj4gbGlzdGVuZXIgPSBtTGlzdGVuZXIucHJvbW90ZSgpOworICAgICAgICBpZiAobGlzdGVuZXIpIHsKKyAgICAgICAgICAgIGhpZGxfdmVjPFNldHRpbmdSZXN1bHQ+IHNldHRpbmdSZXN1bHRzKGMyc2V0dGluZ1Jlc3VsdC5zaXplKCkpOworICAgICAgICAgICAgc2l6ZV90IGl4ID0gMDsKKyAgICAgICAgICAgIGZvciAoY29uc3Qgc3RkOjpzaGFyZWRfcHRyPEMyU2V0dGluZ1Jlc3VsdD4gJmMycmVzdWx0IDoKKyAgICAgICAgICAgICAgICAgICAgYzJzZXR0aW5nUmVzdWx0KSB7CisgICAgICAgICAgICAgICAgaWYgKGMycmVzdWx0KSB7CisgICAgICAgICAgICAgICAgICAgIGlmICghb2JqY3B5KCZzZXR0aW5nUmVzdWx0c1tpeCsrXSwgKmMycmVzdWx0KSkgeworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzZXR0aW5nUmVzdWx0cy5yZXNpemUoaXgpOworICAgICAgICAgICAgUmV0dXJuPHZvaWQ+IHRyYW5zU3RhdHVzID0gbGlzdGVuZXItPm9uVHJpcHBlZChzZXR0aW5nUmVzdWx0cyk7CisgICAgICAgICAgICBpZiAoIXRyYW5zU3RhdHVzLmlzT2soKSkgeworICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkNvbXBvbmVudDo6TGlzdGVuZXI6Om9uVHJpcHBlZF9uYiAtLSAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAidHJhbnNhY3Rpb24gZmFpbGVkLiI7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgb25Xb3JrRG9uZV9uYigKKyAgICAgICAgICAgIHN0ZDo6d2Vha19wdHI8QzJDb21wb25lbnQ+IC8qIGMyY29tcG9uZW50ICovLAorICAgICAgICAgICAgc3RkOjpsaXN0PHN0ZDo6dW5pcXVlX3B0cjxDMldvcms+PiBjMndvcmtJdGVtcykgb3ZlcnJpZGUgeworICAgICAgICBmb3IgKGNvbnN0IHN0ZDo6dW5pcXVlX3B0cjxDMldvcms+JiB3b3JrIDogYzJ3b3JrSXRlbXMpIHsKKyAgICAgICAgICAgIGlmICh3b3JrKSB7CisgICAgICAgICAgICAgICAgaWYgKHdvcmstPndvcmtsZXRzLmVtcHR5KCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHx8ICF3b3JrLT53b3JrbGV0cy5iYWNrKCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHx8ICh3b3JrLT53b3JrbGV0cy5iYWNrKCktPm91dHB1dC5mbGFncyAmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJGcmFtZURhdGE6OkZMQUdfSU5DT01QTEVURSkgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICBJbnB1dEJ1ZmZlck1hbmFnZXI6OgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVucmVnaXN0ZXJGcmFtZURhdGEobUxpc3RlbmVyLCB3b3JrLT5pbnB1dCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgc3A8SUNvbXBvbmVudExpc3RlbmVyPiBsaXN0ZW5lciA9IG1MaXN0ZW5lci5wcm9tb3RlKCk7CisgICAgICAgIGlmIChsaXN0ZW5lcikgeworICAgICAgICAgICAgV29ya0J1bmRsZSB3b3JrQnVuZGxlOworCisgICAgICAgICAgICBzcDxDb21wb25lbnQ+IHN0cm9uZ0NvbXBvbmVudCA9IG1Db21wb25lbnQucHJvbW90ZSgpOworICAgICAgICAgICAgYmVnaW5UcmFuc2ZlckJ1ZmZlclF1ZXVlQmxvY2tzKGMyd29ya0l0ZW1zLCB0cnVlKTsKKyAgICAgICAgICAgIGlmICghb2JqY3B5KCZ3b3JrQnVuZGxlLCBjMndvcmtJdGVtcywgc3Ryb25nQ29tcG9uZW50ID8KKyAgICAgICAgICAgICAgICAgICAgJnN0cm9uZ0NvbXBvbmVudC0+bUJ1ZmZlclBvb2xTZW5kZXIgOiBudWxscHRyKSkgeworICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkNvbXBvbmVudDo6TGlzdGVuZXI6Om9uV29ya0RvbmVfbmIgLS0gIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgInJlY2VpdmVkIGNvcnJ1cHRlZCB3b3JrIGl0ZW1zLiI7CisgICAgICAgICAgICAgICAgZW5kVHJhbnNmZXJCdWZmZXJRdWV1ZUJsb2NrcyhjMndvcmtJdGVtcywgZmFsc2UsIHRydWUpOworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFJldHVybjx2b2lkPiB0cmFuc1N0YXR1cyA9IGxpc3RlbmVyLT5vbldvcmtEb25lKHdvcmtCdW5kbGUpOworICAgICAgICAgICAgaWYgKCF0cmFu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bnN0IHN0ZDo6c2hhcmVkX3B0cjxDb21wb25lbnQ+JiBjb21wb25lbnQpOworICAgIHZpcnR1YWwgflNpbmsoKSBvdmVycmlkZTsKKworICAgIC8vIFByb2Nlc3Mtd2lkZSBtYXA6IENvbXBvbmVudDo6U2luayAtPiBDMkNvbXBvbmVudC4KKyAgICBzdGF0aWMgc3RkOjptdXRleCBzU2luazJDb21wb25lbnRNdXRleDsKKyAgICBzdGF0aWMgc3RkOjptYXA8SUlucHV0U2luayosIHN0ZDo6d2Vha19wdHI8QzJDb21wb25lbnQ+PiBzU2luazJDb21wb25lbnQ7CisKKyAgICBzdGF0aWMgc3RkOjpzaGFyZWRfcHRyPEMyQ29tcG9uZW50PiBmaW5kTG9jYWxDb21wb25lbnQoCisgICAgICAgICAgICBjb25zdCBzcDxJSW5wdXRTaW5rPiYgc2luayk7Cit9OworCitzdGQ6Om11dGV4CisgICAgICAgIENvbXBvbmVudDo6U2luazo6c1NpbmsyQ29tcG9uZW50TXV0ZXh7fTsKK3N0ZDo6bWFwPElJbnB1dFNpbmsqLCBzdGQ6OndlYWtfcHRyPEMyQ29tcG9uZW50Pj4KKyAgICAgICAgQ29tcG9uZW50OjpTaW5rOjpzU2luazJDb21wb25lbnR7fTsKKworQ29tcG9uZW50OjpTaW5rOjpTaW5rKGNvbnN0IHN0ZDo6c2hhcmVkX3B0cjxDb21wb25lbnQ+JiBjb21wb25lbnQpCisgICAgICAgIDogbUNvbXBvbmVudHtjb21wb25lbnR9LAorICAgICAgICAgIG1Db25maWd1cmFibGV7WyZjb21wb25lbnRdKCkgLT4gc3A8SUNvbmZpZ3VyYWJsZT4geworICAgICAgICAgICAgICBSZXR1cm48c3A8SUNvbXBvbmVudEludGVyZmFjZT4+IHJldDEgPSBjb21wb25lbnQtPmdldEludGVyZmFjZSgpOworICAgICAgICAgICAgICBpZiAoIXJldDEuaXNPaygpKSB7CisgICAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJTaW5rOjpTaW5rIC0tIGNvbXBvbmVudCdzIHRyYW5zYWN0aW9uIGZhaWxlZC4iOworICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGxwdHI7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgUmV0dXJuPHNwPElDb25maWd1cmFibGU+PiByZXQyID0KKyAgICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxzcDxJQ29tcG9uZW50SW50ZXJmYWNlPj4ocmV0MSktPgorICAgICAgICAgICAgICAgICAgICAgIGdldENvbmZpZ3VyYWJsZSgpOworICAgICAgICAgICAgICBpZiAoIXJldDIuaXNPaygpKSB7CisgICAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJTaW5rOjpTaW5rIC0tIGludGVyZmFjZSdzIHRyYW5zYWN0aW9uIGZhaWxlZC4iOworICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGxwdHI7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0PHNwPElDb25maWd1cmFibGU+PihyZXQyKTsKKyAgICAgICAgICB9KCl9IHsKKyAgICBzdGQ6OmxvY2tfZ3VhcmQ8c3RkOjptdXRleD4gbG9jayhzU2luazJDb21wb25lbnRNdXRleCk7CisgICAgc1NpbmsyQ29tcG9uZW50LmVtcGxhY2UodGhpcywgY29tcG9uZW50LT5tQ29tcG9uZW50KTsKK30KKworQ29tcG9uZW50OjpTaW5rOjp+U2luaygpIHsKKyAgICBzdGQ6OmxvY2tfZ3VhcmQ8c3RkOjptdXRleD4gbG9jayhzU2luazJDb21wb25lbnRNdXRleCk7CisgICAgc1NpbmsyQ29tcG9uZW50LmVyYXNlKHRoaXMpOworfQorCitzdGQ6OnNoYXJlZF9wdHI8QzJDb21wb25lbnQ+IENvbXBvbmVudDo6U2luazo6ZmluZExvY2FsQ29tcG9uZW50KAorICAgICAgICBjb25zdCBzcDxJSW5wdXRTaW5rPiYgc2luaykgeworICAgIHN0ZDo6bG9ja19ndWFyZDxzdGQ6Om11dGV4PiBsb2NrKHNTaW5rMkNvbXBvbmVudE11dGV4KTsKKyAgICBhdXRvIGkgPSBzU2luazJDb21wb25lbnQuZmluZChzaW5rLmdldCgpKTsKKyAgICBpZiAoaSA9PSBzU2luazJDb21wb25lbnQuZW5kKCkpIHsKKyAgICAgICAgcmV0dXJuIG51bGxwdHI7CisgICAgfQorICAgIHJldHVybiBpLT5zZWNvbmQubG9jaygpOworfQorCisvLyBDb21wb25lbnQKK0NvbXBvbmVudDo6Q29tcG9uZW50KAorICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8QzJDb21wb25lbnQ+JiBjb21wb25lbnQsCisgICAgICAgIGNvbnN0IHNwPElDb21wb25lbnRMaXN0ZW5lcj4mIGxpc3RlbmVyLAorICAgICAgICBjb25zdCBzcDxDb21wb25lbnRTdG9yZT4mIHN0b3JlLAorICAgICAgICBjb25zdCBzcDw6OmFuZHJvaWQ6OmhhcmR3YXJlOjptZWRpYTo6YnVmZmVycG9vbDo6VjJfMDo6CisgICAgICAgIElDbGllbnRNYW5hZ2VyPiYgY2xpZW50UG9vbE1hbmFnZXIpCisgICAgICA6IG1Db21wb25lbnR7Y29tcG9uZW50fSwKKyAgICAgICAgbUludGVyZmFjZXtuZXcgQ29tcG9uZW50SW50ZXJmYWNlKGNvbXBvbmVudC0+aW50ZigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmUtPmdldFBhcmFtZXRlckNhY2hlKCkpfSwKKyAgICAgICAgbUxpc3RlbmVye2xpc3RlbmVyfSwKKyAgICAgICAgbVN0b3Jle3N0b3JlfSwKKyAgICAgICAgbUJ1ZmZlclBvb2xTZW5kZXJ7Y2xpZW50UG9vbE1hbmFnZXJ9IHsKKyAgICAvLyBSZXRyaWV2ZSBzdXBwb3J0ZWQgcGFyYW1ldGVycyBmcm9tIHN0b3JlCisgICAgLy8gVE9ETzogV2UgY291bGQgY2FjaGUgdGhpcyBwZXIg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0gbUNvbXBvbmVudC0+Zmx1c2hfc20oCisgICAgICAgICAgICBDMkNvbXBvbmVudDo6RkxVU0hfQ09NUE9ORU5ULAorICAgICAgICAgICAgJmMyZmx1c2hlZFdvcmtzKTsKKworICAgIC8vIFVucmVnaXN0ZXIgaW5wdXQgYnVmZmVycy4KKyAgICBmb3IgKGNvbnN0IHN0ZDo6dW5pcXVlX3B0cjxDMldvcms+JiB3b3JrIDogYzJmbHVzaGVkV29ya3MpIHsKKyAgICAgICAgaWYgKHdvcmspIHsKKyAgICAgICAgICAgIGlmICh3b3JrLT53b3JrbGV0cy5lbXB0eSgpCisgICAgICAgICAgICAgICAgICAgIHx8ICF3b3JrLT53b3JrbGV0cy5iYWNrKCkKKyAgICAgICAgICAgICAgICAgICAgfHwgKHdvcmstPndvcmtsZXRzLmJhY2soKS0+b3V0cHV0LmZsYWdzICYKKyAgICAgICAgICAgICAgICAgICAgICAgIEMyRnJhbWVEYXRhOjpGTEFHX0lOQ09NUExFVEUpID09IDApIHsKKyAgICAgICAgICAgICAgICBJbnB1dEJ1ZmZlck1hbmFnZXI6OgorICAgICAgICAgICAgICAgICAgICAgICAgdW5yZWdpc3RlckZyYW1lRGF0YShtTGlzdGVuZXIsIHdvcmstPmlucHV0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIFdvcmtCdW5kbGUgZmx1c2hlZFdvcmtCdW5kbGU7CisgICAgU3RhdHVzIHJlcyA9IHN0YXRpY19jYXN0PFN0YXR1cz4oYzJyZXMpOworICAgIGJlZ2luVHJhbnNmZXJCdWZmZXJRdWV1ZUJsb2NrcyhjMmZsdXNoZWRXb3JrcywgdHJ1ZSk7CisgICAgaWYgKGMycmVzID09IEMyX09LKSB7CisgICAgICAgIGlmICghb2JqY3B5KCZmbHVzaGVkV29ya0J1bmRsZSwgYzJmbHVzaGVkV29ya3MsICZtQnVmZmVyUG9vbFNlbmRlcikpIHsKKyAgICAgICAgICAgIHJlcyA9IFN0YXR1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gICBDMkJ1ZmZlclF1ZXVlQmxvY2tQb29sOjpPblJlbmRlckNhbGxiYWNrIGNiID0KKyAgICAgICAgICAgIFt0aGlzXSh1aW50NjRfdCBwcm9kdWNlciwgaW50MzJfdCBzbG90LCBpbnQ2NF90IG5zZWNzKSB7CisgICAgICAgICAgICAgICAgLy8gVE9ETzogYmF0Y2ggdGhpcworICAgICAgICAgICAgICAgIGhpZGxfdmVjPElDb21wb25lbnRMaXN0ZW5lcjo6UmVuZGVyZWRGcmFtZT4gcmVuZGVyZWQ7CisgICAgICAgICAgICAgICAgcmVuZGVyZWQucmVzaXplKDEpOworICAgICAgICAgICAgICAgIHJlbmRlcmVkWzBdID0geyBwcm9kdWNlciwgc2xvdCwgbnNlY3MgfTsKKyAgICAgICAgICAgICAgICAodm9pZCltTGlzdGVuZXItPm9uRnJhbWVzUmVuZGVyZWQocmVuZGVyZWQpLmlzT2soKTsKKyAgICAgICAgfTsKKyAgICAgICAgaWYgKGJxUG9vbCkgeworICAgICAgICAgICAgYnFQb29sLT5zZXRSZW5kZXJDYWxsYmFjayhjYik7CisgICAgICAgICAgICBicVBvb2wtPmNvbmZpZ3VyZVByb2R1Y2VyKHN1cmZhY2UpOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiBTdGF0dXM6Ok9LOworfQorCitSZXR1cm48dm9pZD4gQ29tcG9uZW50Ojpjb25uZWN0VG9JbnB1dFN1cmZhY2UoCisgICAgICAgIGNvbnN0IHNwPElJbnB1dFN1cmZhY2U+JiBpbnB1dFN1cmZhY2UsCisgICAgICAgIGNvbm5lY3RUb0lucHV0U3VyZmFjZV9jYiBfaGlkbF9jYikgeworICAgIFN0YXR1cyBzdGF0dXM7CisgICAgc3A8SUlucHV0U3VyZmFjZUNvbm5lY3Rpb24+IGNvbm5lY3Rpb247CisgICAgYXV0byB0cmFuc1N0YXR1cyA9IGlucHV0U3VyZmFjZS0+Y29ubmVjdCgKKyAgICAgICAgICAgIGFzSW5wdXRTaW5rKCksCisgICAgICAgICAgICBbJnN0YXR1cywgJmNvbm5lY3Rpb25dKAorICAgICAgICAgICAgICAgICAgICBTdGF0dXMgcywgY29uc3Qgc3A8SUlucHV0U3VyZmFjZUNvbm5lY3Rpb24+JiBjKSB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gczsKKyAgICAgICAgICAgICAgICBjb25uZWN0aW9uID0gYzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICBfaGlkbF9jYihzdGF0dXMsIGNvbm5lY3Rpb24pOworICAgIHJldHVybiBWb2lkKCk7Cit9CisKK1JldHVybjx2b2lkPiBDb21wb25lbnQ6OmNvbm5lY3RUb09teElucHV0U3VyZmFjZSgKKyAgICAgICAgY29uc3Qgc3A8SEdyYXBoaWNCdWZmZXJQcm9kdWNlcjE+JiBwcm9kdWNlciwKKyAgICAgICAgY29uc3Qgc3A8OjphbmRyb2lkOjpoYXJkd2FyZTo6bWVkaWE6Om9teDo6VjFfMDo6CisgICAgICAgIElHcmFwaGljQnVmZmVyU291cmNlPiYgc291cmNlLAorICAgICAgICBjb25uZWN0VG9PbXhJbnB1dFN1cmZhY2VfY2IgX2hpZGxfY2IpIHsKKyAgICAodm9pZClwcm9kdWNlcjsKKyAgICAodm9pZClzb3VyY2U7CisgICAgKHZvaWQpX2hpZGxfY2I7CisgICAgcmV0dXJuIFZvaWQoKTsKK30KKworUmV0dXJuPFN0YXR1cz4gQ29tcG9uZW50OjpkaXNjb25uZWN0RnJvbUlucHV0U3VyZmFjZSgpIHsKKyAgICAvLyBUT0RPIGltcGxlbWVudAorICAgIHJldHVybiBTdGF0dXM6Ok9LOworfQorCituYW1lc3BhY2UgLyogdW5uYW1lZCAqLyB7CisKK3N0cnVjdCBCbG9ja1Bvb2xJbnRmIDogcHVibGljIENvbmZpZ3VyYWJsZUMySW50ZiB7CisgICAgQmxvY2tQb29sSW50Zihjb25zdCBzdGQ6OnNoYXJlZF9wdHI8QzJCbG9ja1Bvb2w+JiBwb29sKQorICAgICAgICAgIDogQ29uZmlndXJhYmxlQzJJbnRmeworICAgICAgICAgICAgICAgICJDMkJsb2NrUG9vbDoiICsKKyAgICAgICAgICAgICAgICAgICAgKHBvb2wgPyBzdGQ6OnRvX3N0cmluZyhwb29sLT5nZXRMb2NhbElkKCkpIDogIm51bGwiKSwKKyAgICAgICAgICAgICAgICAwfSwKKyAgICAgICAgICAgIG1Qb29se3Bvb2x9IHsKKyAgICB9CisKKyAgICB2aXJ0dWFsIGMyX3N0YXR1c190IGNvbmZpZygKKyAgICAgICAgICAgIGNvbnN0IHN0ZDo6dmVjdG9yPEMyUGFyYW0qPiYgcGFyYW1zLAorICAgICAgICAgICAgYzJfYmxvY2tpbmdfdCBtYXlCbG9jaywKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHN0ZDo6dW5pcXVlX3B0cjxDMlNldHRpbmdSZXN1bHQ+PiogY29uc3QgZmFpbHVyZXMKKyAgICAgICAgICAgICkgb3ZlcnJpZGUgeworICAgICAgICAodm9pZClwYXJhbXM7CisgICAgICAgICh2b2lkKW1heUJsb2NrOworICAgICAgICAodm9pZClmYWlsdXJlczsKKyAgICAgICAgcmV0dXJuIEMyX09LOworICAgIH0KKworICAgIHZpcnR1YWwgYzJfc3RhdHVzX3QgcXVlcnkoCisgICAgICAgICAgICBjb25zdCBzdGQ6OnZlY3RvcjxDMlBhcmFtOjpJbmRleD4mIGluZGljZXMsCisgICAgICAgICAgICBjMl9ibG9ja2luZ190IG1heUJsb2NrLAorICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjp1bmlxdWVfcHRyPEMyUGFyYW0+PiogY29uc3QgcGFyYW1zCisgICAgICAgICAgICApIGNvbnN0IG92ZXJyaWRlIHsKKyAgICAgICAgKHZvaWQpaW5kaWNlczsKKyAgICAgICAgKHZvaWQpbWF5QmxvY2s7CisgICAgICAgICh2b2lkKXBhcmFtczsKKyAgICAgICAgcmV0dXJuIEMyX09LOworICAgIH0KKworICAgIHZpcnR1YWwgYzJfc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XJmYWNlU3luY09iaiYgc3luY09iamVjdCkgeworICAgIHN0ZDo6c2hhcmVkX3B0cjxDMkJsb2NrUG9vbD4gcG9vbDsKKyAgICBHZXRDb2RlYzJCbG9ja1Bvb2woYmxvY2tQb29sSWQsIG1Db21wb25lbnQsICZwb29sKTsKKyAgICBpZiAocG9vbCAmJiBwb29sLT5nZXRBbGxvY2F0b3JJZCgpID09IEMyUGxhdGZvcm1BbGxvY2F0b3JTdG9yZTo6QlVGRkVSUVVFVUUpIHsKKyAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyQnVmZmVyUXVldWVCbG9ja1Bvb2w+IGJxUG9vbCA9CisgICAgICAgICAgICAgICAgc3RkOjpzdGF0aWNfcG9pbnRlcl9jYXN0PEMyQnVmZmVyUXVldWVCbG9ja1Bvb2w+KHBvb2wpOworICAgICAgICBDMkJ1ZmZlclF1ZXVlQmxvY2tQb29sOjpPblJlbmRlckNhbGxiYWNrIGNiID0KKyAgICAgICAgICAgIFt0aGlzXSh1aW50NjRfdCBwcm9kdWNlciwgaW50MzJfdCBzbG90LCBpbnQ2NF90IG5zZWNzKSB7CisgICAgICAgICAgICAgICAgLy8gVE9ETzogYmF0Y2ggdGhpcworICAgICAgICAgICAgICAgIGhpZGxfdmVjPElDb21wb25lbnRMaXN0ZW5lcjo6UmVuZGVyZWRGcmFtZT4gcmVuZGVyZWQ7CisgICAgICAgICAgICAgICAgcmVuZGVyZWQucmVzaXplKDEpOworICAgICAgICAgICAgICAgIHJlbmRlcmVkWzBdID0geyBwcm9kdWNlciwgc2xvdCwgbnNlY3MgfTsKKyAgICAgICAgICAgICAgICAodm9pZCltTGlzdGVuZXItPm9uRnJhbWVzUmVuZGVyZWQocmVuZGVyZWQpLmlzT2soKTsKKyAgICAgICAgfTsKKyAgICAgICAgaWYgKGJxUG9vbCkgeworICAgICAgICAgICAgY29uc3QgbmF0aXZlX2hhbmRsZV90ICpoID0gc3luY09iamVjdC5zeW5jTWVtb3J5OworICAgICAgICAgICAgbmF0aXZlX2hhbmRsZV90ICpzeW5jTWVtb3J5ID0gaCA/IG5hdGl2ZV9oYW5kbGVfY2xvbmUoaCkgOiBudWxscHRyOworICAgICAgICAgICAgdWludDY0X3QgYnFJZCA9IHN5bmNPYmplY3QuYnFJZDsKKyAgICAgICAgICAgIHVpbnQzMl90IGdlbmVyYXRpb25JZCA9IHN5bmNPYmplY3QuZ2VuZXJhdGlvbklkOworICAgICAgICAgICAgdWludDY0X3QgY29uc3VtZXJVc2FnZSA9IHN5bmNPYmplY3QuY29uc3VtZXJVc2FnZTsKKworICAgICAgICAgICAgYnFQb29sLT5zZXRSZW5kZXJDYWxsYmFjayhjYik7CisgICAgICAgICAgICBicVBvb2wtPmNvbmZpZ3VyZVByb2R1Y2VyKHN1cmZhY2UsIHN5bmNNZW1vcnksIGJxSWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdlbmVyYXRpb25JZCwgY29uc3VtZXJVc2FnZSk7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIFN0YXR1czo6T0s7Cit9CisKK3N0ZDo6c2hhcmVkX3B0cjxDMkNvbXBvbmVudD4gQ29tcG9uZW50OjpmaW5kTG9jYWxDb21wb25lbnQoCisgICAgICAgIGNvbnN0IHNwPElJbnB1dFNpbms+JiBzaW5rKSB7CisgICAgcmV0dXJuIENvbXBvbmVudDo6U2luazo6ZmluZExvY2FsQ29tcG9uZW50KHNpbmspOworfQorCit2b2lkIENvbXBvbmVudDo6aW5pdExpc3RlbmVyKGNvbnN0IHNwPENvbXBvbmVudD4mIHNlbGYpIHsKKyAgICBzdGQ6OnNoYXJlZF9wdHI8QzJDb21wb25lbnQ6Okxpc3RlbmVyPiBjMmxpc3RlbmVyID0KKyAgICAgICAgICAgIHN0ZDo6bWFrZV9zaGFyZWQ8TGlzdGVuZXI+KHNlbGYpOworICAgIGMyX3N0YXR1c190IHJlcyA9IG1Db21wb25lbnQtPnNldExpc3RlbmVyX3ZiKGMyb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sKKyAgICBzdGQ6OnNoYXJlZF9wdHI8QzJDb21wb25lbnQ+IGMyY29tcG9uZW50OworICAgIFN0YXR1cyBzdGF0dXMgPSBzdGF0aWNfY2FzdDxTdGF0dXM+KAorICAgICAgICAgICAgbVN0b3JlLT5jcmVhdGVDb21wb25lbnQobmFtZSwgJmMyY29tcG9uZW50KSk7CisKKyAgICBpZiAoc3RhdHVzID09IFN0YXR1czo6T0spIHsKKyNpZm5kZWYgX19BTkRST0lEX0FQRVhfXworICAgICAgICBjMmNvbXBvbmVudCA9IEdldEZpbHRlcldyYXBwZXIoKS0+bWF5YmVXcmFwQ29tcG9uZW50KGMyY29tcG9uZW50KTsKKyNlbmRpZgorICAgICAgICBvbkludGVyZmFjZUxvYWRlZChjMmNvbXBvbmVudC0+aW50ZigpKTsKKyAgICAgICAgY29tcG9uZW50ID0gbmV3IENvbXBvbmVudChjMmNvbXBvbmVudCwgbGlzdGVuZXIsIHRoaXMsIHBvb2wpOworICAgICAgICBpZiAoIWNvbXBvbmVudCkgeworICAgICAgICAgICAgc3RhdHVzID0gU3RhdHVzOjpDT1JSVVBURUQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXBvcnRDb21wb25lbnRCaXJ0aChjb21wb25lbnQuZ2V0KCkpOworICAgICAgICAgICAgaWYgKGNvbXBvbmVudC0+c3RhdHVzKCkgIT0gQzJfT0spIHsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBzdGF0aWNfY2FzdDxTdGF0dXM+KGNvbXBvbmVudC0+c3RhdHVzKCkpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBjb21wb25lbnQtPmluaXRMaXN0ZW5lcihjb21wb25lbnQpOworICAgICAgICAgICAgICAgIGlmIChjb21wb25lbnQtPnN0YXR1cygpICE9IEMyX09LKSB7CisgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IHN0YXRpY19jYXN0PFN0YXR1cz4oY29tcG9uZW50LT5zdGF0dXMo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GVzYykgeworICAgICAgICAgICAgICAgICAgICBtVW5zdXBwb3J0ZWRTdHJ1Y3REZXNjcmlwdG9ycy5lbXBsYWNlKGNvcmVJbmRleCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbVN0cnVjdERlc2NyaXB0b3JzLmluc2VydCh7IGNvcmVJbmRleCwgc3RydWN0RGVzYyB9KTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG9iamNweSgmZGVzY3JpcHRvcnNbZHN0SXhdLCAqc3RydWN0RGVzYykpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICsrZHN0SXg7CisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICByZXMgPSBTdGF0dXM6OkNPUlJVUFRFRDsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmVzID0gU3RhdHVzOjpOT1RfRk9VTkQ7CisgICAgICAgIH0gZWxzZSBpZiAoaXRlbS0+c2Vjb25kKSB7CisgICAgICAgICAgICBpZiAob2JqY3B5KCZkZXNjcmlwdG9yc1tkc3RJeF0sICppdGVtLT5zZWNvbmQpKSB7CisgICAgICAgICAgICAgICAgKytkc3RJeDsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJlcyA9IFN0YXR1czo6Q09SUlVQVEVEOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXMgPSBTdGF0dXM6Ok5PX01FTU9SWTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorICAgIGRlc2NyaXB0b3JzLnJlc2l6ZShkc3RJeCk7CisgICAgX2hpZGxfY2IocmVzLCBkZXNjcmlwdG9ycyk7CisgICAgcmV0dXJuIFZva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ChuYW1lLCAmYzJjb21wb25lbnQpKTsKKworICAgIGlmIChzdGF0dXMgPT0gU3RhdHVzOjpPSykgeworI2lmbmRlZiBfX0FORFJPSURfQVBFWF9fCisgICAgICAgIGMyY29tcG9uZW50ID0gR2V0RmlsdGVyV3JhcHBlcigpLT5tYXliZVdyYXBDb21wb25lbnQoYzJjb21wb25lbnQpOworI2VuZGlmCisgICAgICAgIG9uSW50ZXJmYWNlTG9hZGVkKGMyY29tcG9uZW50LT5pbnRmKCkpOworICAgICAgICBjb21wb25lbnQgPSBuZXcgQ29tcG9uZW50KGMyY29tcG9uZW50LCBsaXN0ZW5lciwgdGhpcywgcG9vbCk7CisgICAgICAgIGlmICghY29tcG9uZW50KSB7CisgICAgICAgICAgICBzdGF0dXMgPSBTdGF0dXM6OkNPUlJVUFRFRDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJlcG9ydENvbXBvbmVudEJpcnRoKGNvbXBvbmVudC5nZXQoKSk7CisgICAgICAgICAgICBpZiAoY29tcG9uZW50LT5zdGF0dXMoKSAhPSBDMl9PSykgeworICAgICAgICAgICAgICAgIHN0YXR1cyA9IHN0YXRpY19jYXN0PFN0YXR1cz4oY29tcG9uZW50LT5zdGF0dXMoKSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGNvbXBvbmVudC0+aW5pdExpc3RlbmVyKGNvbXBvbmVudCk7CisgICAgICAgICAgICAgICAgaWYgKGNvbXBvbmVudC0+c3RhdHVzKCkgIT0gQzJfT0spIHsKKyAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gc3RhdGljX2Nhc3Q8U3RhdHVzPihjb21wb25lbnQtPnN0YXR1cygpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgX2hpZGxfY2Ioc3RhdHVzLCBjb21wb25lbnQpOworICAgIHJldHVybiBWb2lkKCk7Cit9CisKKy8vIE1ldGhvZHMgZnJv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goY29tcG9uZW50LmdldCgpKTsKKyAgICAgICAgICAgIGlmIChjb21wb25lbnQtPnN0YXR1cygpICE9IEMyX09LKSB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gc3RhdGljX2Nhc3Q8U3RhdHVzPihjb21wb25lbnQtPnN0YXR1cygpKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgY29tcG9uZW50LT5pbml0TGlzdGVuZXIoY29tcG9uZW50KTsKKyAgICAgICAgICAgICAgICBpZiAoY29tcG9uZW50LT5zdGF0dXMoKSAhPSBDMl9PSykgeworICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBzdGF0aWNfY2FzdDxTdGF0dXM+KGNvbXBvbmVudC0+c3RhdHVzKCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICBfaGlkbF9jYihzdGF0dXMsIGNvbXBvbmVudCk7CisgICAgcmV0dXJuIFZvaWQoKTsKK30KKworLy8gQ2FsbGVkIGZyb20gY3JlYXRlQ29tcG9uZW50KCkgYWZ0ZXIgYSBzdWNjZXNzZnVsIGNyZWF0aW9uIG9mIGBjb21wb25lbnRgLgordm9pZCBDb21wb25lbnRTdG9yZTo6cmVwb3J0Q29tcG9uZW50QmlydGgoQ29tcG9uZW50KiBjb21wb25lbnQpIHsKKyAgICBDb21wb25lbnRTdGF0dXMgY29tcG9uZW50U3RhdHVzOworICAgIGNvbXBvbmVudFN0YXR1cy5jMkNvbXBvbmVudCA9IGNvbXBvbmVudC0+bUNvbXBvbmVudDsKKyAgICBjb21wb25lbnRTdGF0dXMuYmlydGhUaW1lID0gc3RkOjpjaHJvbm86OnN5c3RlbV9jbG9jazo6bm93KCk7CisKKyAgICBzdGQ6OmxvY2tfZ3VhcmQ8c3RkOjptdXRleD4gbG9jayhtQ29tcG9uZW50Um9zdGVyTXV0ZXgpOworICAgIG1Db21wb25lbnRSb3N0ZXIuZW1wbGFjZShjb21w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KSA8PCBzdGQ6OmVuZGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBEdW1wIGFjdGl2ZSBjb21wb25lbnRzLgorICAgICAgICB7CisgICAgICAgICAgICBvdXQgPDwgaW5kZW50IDw8ICJBY3RpdmUgY29tcG9uZW50czoiIDw8IHN0ZDo6ZW5kbCA8PCBzdGQ6OmVuZGw7CisgICAgICAgICAgICBzdGQ6OmxvY2tfZ3VhcmQ8c3RkOjptdXRleD4gbG9jayhtQ29tcG9uZW50Um9zdGVyTXV0ZXgpOworICAgICAgICAgICAgaWYgKG1Db21wb25lbnRSb3N0ZXIuc2l6ZSgpID09IDApIHsKKyAgICAgICAgICAgICAgICBvdXQgPDwgaW5kZW50IDw8IGluZGVudCA8PCAiTk9ORSIgPDwgc3RkOjplbmRsIDw8IHN0ZDo6ZW5kbDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZm9yIChhdXRvJiBwYWlyIDogbUNvbXBvbmVudFJvc3RlcikgeworICAgICAgICAgICAgICAgICAgICBkdW1wKG91dCwgcGFpci5zZWNvbmQpIDw8IHN0ZDo6ZW5kbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBvdXQgPDwgIkVuZCBvZiBkdW1wIC0tIEMyQ29tcG9uZW50U3RvcmU6ICIKKyAgICAgICAgICAgICAgICA8PCBtU3RvcmUtPmdldE5hbWUoKSA8PCBzdGQ6OmVuZGw7CisgICAgfQorCisgICAgaWYgKCFhbmRyb2lkOjpiYXNlOjpXcml0ZVN0cmluZ1RvRmQob3V0LnN0cigpLCBoLT5kYXRhWzBdKSkgeworICAgICAgICBQTE9HKFdBUk5JTkcpIDw8ICJkZWJ1ZyAtLSBkdW1waW5nIGZhaWxlZCAtLSB3cml0ZSgpIjsKKyAgICB9IGVsc2UgeworICAgICAgICBMT0coSU5GTykgPDwgImRlYnVnIC0tIGR1bXBpbmcgc3VjY2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cm9pZC5oYXJkd2FyZS5tZWRpYS5jMkAxLjEiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5jMkAxLjIiLAogICAgICAgICAibGliYmFzZSIsCiAgICAgICAgICJsaWJiaW5kZXIiLAogICAgICAgICAibGliY29kZWMyIiwKICAgICAgICAgImxpYmNvZGVjMl9oaWRsX2NsaWVudEAxLjAiLAogICAgICAgICAibGliY29kZWMyX2hpZGxfY2xpZW50QDEuMSIsCisgICAgICAgICJsaWJjb2RlYzJfaGlkbF9jbGllbnRAMS4yIiwKICAgICAgICAgImxpYmNvZGVjMl92bmRrIiwKICAgICAgICAgImxpYmN1dGlscyIsCiAgICAgICAgICJsaWJndWkiLApAQCAtMzIsMTEgKzQ4LDEyIEBACiAgICAgZXhwb3J0X3NoYXJlZF9saWJfaGVhZGVyczogWwogICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5jMkAxLjAiLAogICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5jMkAxLjEiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5jMkAxLjIiLAogICAgICAgICAibGliY29kZWMyIiwKICAgICAgICAgImxpYmNvZGVjMl9oaWRsX2NsaWVudEAxLjAiLAogICAgICAgICAibGliY29kZWMyX2hpZGxfY2xpZW50QDEuMSIsCisgICAgICAgICJsaWJjb2RlYzJfaGlkbF9jbGllbnRAMS4yIiwKICAgICAgICAgImxpYmNvZGVjMl92bmRrIiwKICAgICBdLAogCiB9Ci0KZGlmZiAtLWdpdCBhL21lZGlhL2NvZGVjMi9oaWRsL2NsaWVudC9jbGllbnQuY3BwIGIvbWVkaWEvY29kZWMyL2hpZGwvY2xpZW50L2NsaWVudC5jcHAKaW5kZXggN2U0MzUyZC4uNDJiM2M0MyAxMDA2NDQKLS0tIGEvbWVkaWEvY29kZWMyL2hpZGwvY2xpZW50L2NsaWVudC5jcHAKKysrIGIvbWVkaWEvY29kZWMyL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AgICAgKmNvbXBvbmVudCA9IHN0ZDo6bWFrZV9zaGFyZWQ8Q29kZWMyQ2xpZW50OjpDb21wb25lbnQ+KGMpOwogICAgICAgICAgICAgICAgIGhpZGxMaXN0ZW5lci0+Y29tcG9uZW50ID0gKmNvbXBvbmVudDsKLSAgICAgICAgICAgIH0pIDoKLSAgICAgICAgbUJhc2UxXzAtPmNyZWF0ZUNvbXBvbmVudCgKKyAgICAgICAgICAgIH0pOworICAgIH0KKyAgICBlbHNlIGlmIChtQmFzZTFfMSkgeworICAgICAgICB0cmFuc1N0YXR1cyA9IG1CYXNlMV8xLT5jcmVhdGVDb21wb25lbnRfMV8xKAorICAgICAgICAgICAgbmFtZSwKKyAgICAgICAgICAgIGhpZGxMaXN0ZW5lciwKKyAgICAgICAgICAgIENsaWVudE1hbmFnZXI6OmdldEluc3RhbmNlKCksCisgICAgICAgICAgICBbJnN0YXR1cywgY29tcG9uZW50LCBoaWRsTGlzdGVuZXJdKAorICAgICAgICAgICAgICAgICAgICBTdGF0dXMgcywKKyAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8SUNvbXBvbmVudD4mIGMpIHsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBzdGF0aWNfY2FzdDxjMl9zdGF0dXNfdD4ocyk7CisgICAgICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBDMl9PSykgeworICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICpjb21wb25lbnQgPSBzdGQ6Om1ha2Vfc2hhcmVkPENvZGVjMkNsaWVudDo6Q29tcG9uZW50PihjKTsKKyAgICAgICAgICAgICAgICBoaWRsTGlzdGVuZXItPmNvbXBvbmVudCA9ICpjb21wb25lbnQ7CisgICAgICAgICAgICB9KTsKKyAgICB9IGVsc2UgaWYgKG1CYXNlMV8wKSB7IC8vIHZlcjFfMAorICAgICAgICB0cmFuc1N0YXR1cyA9IG1CYXNlMV8wLT5jcmVhdGVDb21wb25lbnQoCiAgICAgICAgICAgICBuYW1lLAogICAgICAgICAgICAgaGlkbExpc3RlbmVyLAogICAgICAgICAgICAgQ2xpZW50TWFuYWdlcjo6Z2V0SW5zdGFuY2UoKSwKQEAgLTY3NCw2ICs3MDcsOSBAQAogICAgICAgICAgICAgICAgICpjb21wb25lbnQgPSBzdGQ6Om1ha2Vfc2hhcmVkPENvZGVjMkNsaWVudDo6Q29tcG9uZW50PihjKTsKICAgICAgICAgICAgICAgICBoaWRsTGlzdGVuZXItPmNvbXBvbmVudCA9ICpjb21wb25lbnQ7CiAgICAgICAgICAgICB9KTsKKyAgICB9IGVsc2UgeworICAgICAgICBzdGF0dXMgPSBDMl9DT1JSVVBURUQ7CisgICAgfQogICAgIGlmICghdHJhbnNTdGF0dXMuaXNPaygpKSB7CiAgICAgICAgIExPRyhFUlJPUikgPDwgImNyZWF0ZUNvbXBvbmVudCgiIDw8IG5hbWUuY19zdHIoKQogICAgICAgICAgICAgICAgICAgIDw8ICIpIC0tIHRyYW5zYWN0aW9uIGZhaWxlZC4iOwpAQCAtODQzLDYgKzg3OSwxMSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICBpZiAoIXRyYW5zU3RhdHVzLmlzT2soKSkgeworICAgICAgICAgICAgICAgIExPRyhERUJVRykgPDwgIlNpbXBsZVBhcmFtUmVmbGVjdG9yIC0tIHRyYW5zYWN0aW9uIGZhaWxlZDogIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgdHJhbnNTdGF0dXMuZGVzY3JpcHRpb24oKTsKKyAgICAgICAgICAgICAgICBkZXNjcmlwdG9yLnJlc2V0KCk7CisgICAgICAgICAgICB9CiAgICAgICAgICAgICByZXR1cm4gZGVzY3JpcHRvcjsKICAgICAgICAgfQogCkBAIC0xMDAzLDYgKzEwNDQsOCBAQAogICAgICAgICAgICA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ICAgICAgIHNpemVfdCBudW1iZXJPZkF0dGVtcHRzKSB7CiAgICAgc3RkOjpzdHJpbmcga2V5eyJjcmVhdGU6In07CiAgICAga2V5LmFwcGVuZChjb21wb25lbnROYW1lKTsKLSAgICBzdGQ6OnNoYXJlZF9wdHI8Q29tcG9uZW50PiBjb21wb25lbnQ7CiAgICAgYzJfc3RhdHVzX3Qgc3RhdHVzID0gRm9yQWxsU2VydmljZXMoCiAgICAgICAgICAgICBrZXksCiAgICAgICAgICAgICBudW1iZXJPZkF0dGVtcHRzLAotICAgICAgICAgICAgW293bmVyLCAmY29tcG9uZW50LCBjb21wb25lbnROYW1lLCAmbGlzdGVuZXJdKAorICAgICAgICAgICAgW293bmVyLCBjb21wb25lbnQsIGNvbXBvbmVudE5hbWUsICZsaXN0ZW5lcl0oCiAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c2hhcmVkX3B0cjxDb2RlYzJDbGllbnQ+ICZjbGllbnQpCiAgICAgICAgICAgICAgICAgICAgICAgICAtPiBjMl9zdGF0dXNfdCB7CiAgICAgICAgICAgICAgICAgYzJfc3RhdHVzX3Qgc3RhdHVzID0gY2xpZW50LT5jcmVhdGVDb21wb25lbnQoY29tcG9uZW50TmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmY29tcG9uZW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnQpOwogICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gQzJfT0spIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKG93bmVyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAqb3duZXIgPSBjbGllbnQ7CkBAIC0xMDU5LDcgKzExMDEsNy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mFzZTFfMj4mIGJhc2UpCisgICAgICA6IENvbmZpZ3VyYWJsZXsKKyAgICAgICAgICAgIFtiYXNlXSgpIC0+IHNwPElDb25maWd1cmFibGU+IHsKKyAgICAgICAgICAgICAgICBSZXR1cm48c3A8SUNvbXBvbmVudEludGVyZmFjZT4+IHRyYW5zUmVzdWx0MSA9CisgICAgICAgICAgICAgICAgICAgICAgICBiYXNlLT5nZXRJbnRlcmZhY2UoKTsKKyAgICAgICAgICAgICAgICBpZiAoIXRyYW5zUmVzdWx0MS5pc09rKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGxwdHI7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIFJldHVybjxzcDxJQ29uZmlndXJhYmxlPj4gdHJhbnNSZXN1bHQyID0KKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PHNwPElDb21wb25lbnRJbnRlcmZhY2U+Pih0cmFuc1Jlc3VsdDEpLT4KKyAgICAgICAgICAgICAgICAgICAgICAgIGdldENvbmZpZ3VyYWJsZSgpOworICAgICAgICAgICAgICAgIHJldHVybiB0cmFuc1Jlc3VsdDIuaXNPaygpID8KKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PHNwPElDb25maWd1cmFibGU+Pih0cmFuc1Jlc3VsdDIpIDoKKyAgICAgICAgICAgICAgICAgICAgICAgIG51bGxwdHI7CisgICAgICAgICAgICB9KCkKKyAgICAgICAgfSwKKyAgICAgICAgbUJhc2UxXzB7YmFzZX0sCisgICAgICAgIG1CYXNlMV8xe2Jhc2V9LAorICAgICAgICBtQmFzZTFfMntiYXNlfSwKICAgICAgICAgbUJ1ZmZlclBvb2xTZW5kZXJ7c3RkOjptYWtlX3VuaXF1ZTxCdWZmZXJQb29sU2VuZGVyPigpfSwKICAgICAgICAgbU91dHB1dEJ1ZmZlclF1ZXVle3N0ZDo6bWFrZV91bmlxdWU8T3V0cHV0QnVmZmVyUXVldWU+KCl9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VzcykgeworICAgIGZvciAoY29uc3Qgc3RkOjp1bmlxdWVfcHRyPEMyV29yaz4mIHdvcmsgOiB3b3JrTGlzdCkgeworICAgICAgICBpZiAoIXdvcmspIHsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGZvciAoY29uc3Qgc3RkOjp1bmlxdWVfcHRyPEMyV29ya2xldD4mIHdvcmtsZXQgOiB3b3JrLT53b3JrbGV0cykgeworICAgICAgICAgICAgaWYgKHdvcmtsZXQpIHsKKyAgICAgICAgICAgICAgICBmb3JFYWNoQmxvY2sod29ya2xldC0+b3V0cHV0LCBwcm9jZXNzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KK30KKworc3A8SEdyYXBoaWNCdWZmZXJQcm9kdWNlcj4gZ2V0SGdicChjb25zdCBzcDxJR3JhcGhpY0J1ZmZlclByb2R1Y2VyPiYgaWdicCkgeworICAgIHNwPEhHcmFwaGljQnVmZmVyUHJvZHVjZXI+IGhnYnAgPQorICAgICAgICAgICAgaWdicC0+Z2V0SGFsSW50ZXJmYWNlPEhHcmFwaGljQnVmZmVyUHJvZHVjZXI+KCk7CisgICAgcmV0dXJuIGhnYnAgPyBoZ2JwIDoKKyAgICAgICAgICAgIG5ldyBCMkhHcmFwaGljQnVmZmVyUHJvZHVjZXIoaWdicCk7Cit9CisKK3N0YXR1c190IGF0dGFjaFRvQnVmZmVyUXVldWUoY29uc3QgQzJDb25zdEdyYXBoaWNCbG9jayYgYmxvY2ssCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPElHcmFwaGljQnVmZmVyUHJvZHVjZXI+JiBpZ2JwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBnZW5lcmF0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90KiBicVNsb3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDM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OjpzZXRmaWxsKCcgJykKKyAgICAgICAgICAgIDw8ICIsIHN0cmlkZSAiIDw8IGdyYXBoaWNCdWZmZXItPmdldFN0cmlkZSgpCisgICAgICAgICAgICA8PCAiLCBnZW5lcmF0aW9uICIgPDwgZ3JhcGhpY0J1ZmZlci0+Z2V0R2VuZXJhdGlvbk51bWJlcigpOworCisgICAgQzJTeW5jVmFyaWFibGVzICpzeW5jVmFyID0gc3luY01lbSA/IHN5bmNNZW0tPm1lbSgpIDogbnVsbHB0cjsKKyAgICBzdGF0dXNfdCByZXN1bHQgPSBPSzsKKyAgICBpZiAoc3luY1ZhcikgeworICAgICAgICBzeW5jVmFyLT5sb2NrKCk7CisgICAgICAgIGlmICghc3luY1Zhci0+aXNEZXF1ZXVlYWJsZUxvY2tlZCgpIHx8CisgICAgICAgICAgICBzeW5jVmFyLT5nZXRTeW5jU3RhdHVzTG9ja2VkKCkgPT0gQzJTeW5jVmFyaWFibGVzOjpTVEFUVVNfU1dJVENISU5HKSB7CisgICAgICAgICAgICBzeW5jVmFyLT51bmxvY2soKTsKKyAgICAgICAgICAgIExPRyhXQVJOSU5HKSA8PCAiYXR0YWNoVG9CdWZmZXJRdWV1ZSAtLSBhdHRhY2hCdWZmZXIgZmFpbGVkOiAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgInN0YXR1cyA9ICIgPDwgSU5WQUxJRF9PUEVSQVRJT04gPDwgIi4iOworICAgICAgICAgICAgcmV0dXJuIElOVkFMSURfT1BFUkFUSU9OOworICAgICAgICB9CisgICAgICAgIHJlc3VsdCA9IGlnYnAtPmF0dGFjaEJ1ZmZlcihicVNsb3QsIGdyYXBoaWNCdWZmZXIpOworICAgICAgICBpZiAocmVzdWx0ID09IE9LKSB7CisgICAgICAgICAgICBzeW5jVmFyLT5ub3RpZnlEZXF1ZXVlZExvY2tlZCgpOworICAgICAgICB9CisgICAgICAgIHN5bmNWYXItPnVubG9jaygpOworICAgIH0gZWxzZSB7CisgICAgICAgIHJlc3VsdCA9IGlnYnAtPmF0dGFjaEJ1ZmZlcihicVNsb3QsIGdyYXBoaWNCdWZmZXIpOworICAgIH0KKyAgICBpZiAocmVzdWx0ICE9IE9LKSB7CisgICAgICAgIExPRyhXQVJOSU5HKSA8PCAiYXR0YWNoVG9CdWZmZXJRdWV1ZSAtLSBhdHRhY2hCdWZmZXIgZmFpbGVkOiAiCisgICAgICAgICAgICAgICAgICAgICAgICAic3RhdHVzID0gIiA8PCByZXN1bHQgPDwgIi4iOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKyAgICBMT0coVkVSQk9TRSkgPDwgImF0dGFjaFRvQnVmZmVyUXVldWUgLS0gYXR0YWNoQnVmZmVyIHJldHVybmVkIHNsb3QgIyIKKyAgICAgICAgICAgICAgICAgPDwgKmJxU2xvdCA8PCAiLiI7CisgICAgcmV0dXJuIE9LOworfQorCitib29sIGdldEJ1ZmZlclF1ZXVlQXNzaWdubWVudChjb25zdCBDMkNvbnN0R3JhcGhpY0Jsb2NrJiBibG9jaywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90KiBnZW5lcmF0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDY0X3QqIGJxSWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90KiBicVNsb3QpIHsKKyAgICByZXR1cm4gX0MyQmxvY2tGYWN0b3J5OjpHZXRCdWZmZXJRdWV1ZURhdGEoCisgICAgICAgICAgICBfQzJCbG9ja0ZhY3Rvcnk6OkdldEdyYXBoaWNCbG9ja1Bvb2xEYXRhKGJsb2NrKSwKKyAgICAgICAgICAgIGdlbmVyYXRpb24sIGJxSWQsIGJxU2xvdCk7Cit9CisKK30gLy8gdW5uYW1lZCBuYW1lc3BhY2UKKworT3V0cHV0QnVmZmVyUXVldWU6Ok91dHB1dEJ1ZmZlclF1ZXVlKCkKKyAgICAgIDogbUdlbmVyYXRpb257MH0sIG1CcUlkezB9IHsKK30KKworT3V0cHV0QnVmZmVyUXVldWU6On5PdXRwdXRCdWZmZXJRdWV1ZSgpIHsKK30KKworYm9vbCBPdXRwdXRCdWZmZXJRdWV1ZTo6Y29uZmlndXJlKGNvbnN0IHNwPElHcmFwaGljQnVmZmVyUHJvZHVjZXI+JiBpZ2JwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGdlbmVyYXRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDY0X3QgYnFJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbWF4RGVxdWV1ZUJ1ZmZlckNvdW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxWMV8yOjpTdXJmYWNlU3luY09iaj4gKnN5bmNPYmopIHsKKyAgICB1aW50NjRfdCBjb25zdW1lclVzYWdlID0gMDsKKyAgICBpZiAoaWdicCAmJiBpZ2JwLT5nZXRDb25zdW1lclVzYWdlKCZjb25zdW1lclVzYWdlKSAhPSBPSykgeworICAgICAgICBBTE9HVygiZmFpbGVkIHRvIGdldCBjb25zdW1lciB1c2FnZSIpOworICAgIH0KKworICAgIC8vIFRPRE8gOiBBYnN0cmFjdCBjcmVhdGlvbiBwcm9jZXNzIGludG8gQzJTdXJmYWNlU3luY01lbW9yeSBjbGFzcy4KKyAgICAvLyB1c2UgQzJMaW5lYXJCbG9jayBpbnN0ZWFkIGFzaG1lbS4KKyAgICBzdGQ6OnNoYXJlZF9wdHI8QzJTdXJmYWNlU3luY01lbW9yeT4gc3luY01lbTsKKyAgICBpZiAoc3luY09iaiAmJiBpZ2JwKSB7CisgICAgICAgIGJvb2wgbWFwcGVkID0gZmFsc2U7CisgICAgICAgIGludCBtZW1GZCA9IGFzaG1lbV9jcmVhdGVfcmVnaW9uKCJDMlN1cmZhY2VNZW0iLCBzaXplb2YoQzJTeW5jVmFyaWFibGVzKSk7CisgICAgICAgIHNpemVfdCBtZW1TaXplID0gbWVtRmQgPCAwID8gMCA6IGFzaG1lbV9nZXRfc2l6ZV9yZWdpb24obWVtRmQpOworICAgICAgICBpZiAobWVtU2l6ZSA+IDApIHsKKyAgICAgICAgICAgIHN5bmNNZW0gPSBDMlN1cmZhY2VTeW5jTWVtb3J5OjpDcmVhdGUobWVtRmQsIG1lbVNpemUpOworICAgICAgICAgICAgaWYgKHN5bmNNZW0pIHsKKyAgICAgICAgICAgICAgICBtYXBwZWQgPSB0cnVlOworICAgICAgICAgICAgICAgICpzeW5jT2JqID0gc3RkOjptYWtlX3NoYXJlZDxWMV8yOjpTdXJmYWNlU3luY09iaj4oKTsKKyAgICAgICAgICAgICAgICAoKnN5bmNPYmopLT5zeW5jTWVtb3J5ID0gc3luY01lbS0+aGFuZGxlKCk7CisgICAgICAgICAgICAgICAgKCpzeW5jT2JqKS0+YnFJZCA9IGJxSWQ7CisgICAgICAgICAgICAgICAgKCpzeW5jT2JqKS0+Z2VuZXJhdGlvbklkID0gZ2VuZXJhdGlvbjsKKyAgICAgICAgICAgICAgICAoKnN5bmNPYmopLT5jb25zdW1lclVzYWdlID0gY29uc3VtZXJVc2FnZTsKKyAgICAgICAgICAgICAgICBBTE9HRCgiQzJTdXJmYWNlU3luY01lbW9yeSBjcmVhdGVkICV6dSglenUpIiwgc2l6ZW9mKEMyU3luY1ZhcmlhYmxlcyksIG1lbVNpemUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICghbWFwcGVkKSB7CisgICAgICAgICAgICBpZiAobWVtRmQgPj0gMCkgeworICAgICAgICAgICAgICAgIDo6Y2xvc2UobWVtRmQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQUxPR1coIlN1cmZhY2VTeW5jT2JqIGNyZWF0aW9uIGZhaWx1cmUiKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHNpemVfdCB0cnlOdW0gPSAwOworICAgIHNpemVfdCBzdWNjZXNzID0gMDsKKyAgICBzcDxH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MyU3luY1ZhcmlhYmxlczo6U1RBVFVTX0lOSVQpOworICAgICAgICAgICAgICAgIHZhci0+c2V0SW5pdGlhbERlcXVldWVDb3VudExvY2tlZChtTWF4RGVxdWV1ZUJ1ZmZlckNvdW50LCAwKTsKKyAgICAgICAgICAgICAgICB2YXItPnVubG9jaygpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMlN1cmZhY2VTeW5jTWVtb3J5PiBvbGRNZW0gPSBtU3luY01lbTsKKyAgICAgICAgQzJTeW5jVmFyaWFibGVzICpvbGRTeW5jID0gbVN5bmNNZW0gPyBtU3luY01lbS0+bWVtKCkgOiBudWxscHRyOworICAgICAgICBpZiAob2xkU3luYykgeworICAgICAgICAgICAgb2xkU3luYy0+bG9jaygpOworICAgICAgICAgICAgb2xkU3luYy0+c2V0U3luY1N0YXR1c0xvY2tlZChDMlN5bmNWYXJpYWJsZXM6OlNUQVRVU19TV0lUQ0hJTkcpOworICAgICAgICAgICAgb2xkU3luYy0+dW5sb2NrKCk7CisgICAgICAgIH0KKyAgICAgICAgbVN5bmNNZW0ucmVzZXQoKTsKKyAgICAgICAgaWYgKHN5bmNNZW0pIHsKKyAgICAgICAgICAgIG1TeW5jTWVtID0gc3luY01lbTsKKyAgICAgICAgfQorICAgICAgICBDMlN5bmNWYXJpYWJsZXMgKm5ld1N5bmMgPSBtU3luY01lbSA/IG1TeW5jTWVtLT5tZW0oKSA6IG51bGxwdHI7CisKKyAgICAgICAgbUlnYnAgPSBpZ2JwOworICAgICAgICBtR2VuZXJhdGlvbiA9IGdlbmVyYXRpb247CisgICAgICAgIG1CcUlkID0gYnFJZDsKKyAgICAgICAgbU93bmVyID0gc3RkOjptYWtlX3NoYXJlZDxpbnQ+KDApOworICAgICAgICBtTWF4RGVxdWV1ZUJ1ZmZlckNvdW50ID0gbWF4RGVxdWV1ZUJ1ZmZlckNvdW50OworICAgICAgICBpZiAoaWdicCA9PSBudWxscHRyKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBCdWZmZXJRdWV1ZURlZnM6Ok5VTV9CVUZGRVJfU0xPVFM7ICsraSkgeworICAgICAgICAgICAgaWYgKG1CcUlkID09IDAgfHwgIW1CdWZmZXJzW2ldKSB7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8X0MyQmxvY2tQb29sRGF0YT4gZGF0YSA9IG1Qb29sRGF0YXNbaV0ubG9jaygpOworICAgICAgICAgICAgaWYgKCFkYXRhIHx8CisgICAgICAgICAgICAgICAgIV9DMkJsb2NrRmFjdG9yeTo6QmVnaW5BdHRhY2hCbG9ja1RvQnVmZmVyUXVldWUoZGF0YSkpIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICsrdHJ5TnVtOworICAgICAgICAgICAgaW50IGJxU2xvdDsKKworICAgICAgICAgICAgLy8gVXBkYXRlIGJ1ZmZlcidzIGdlbmVyYXRpb24gYW5kIHVzYWdlLgorICAgICAgICAgICAgaWYgKChtQnVmZmVyc1tpXS0+Z2V0VXNhZ2UoKSAmIGNvbnN1bWVyVXNhZ2UpICE9IGNvbnN1bWVyVXNhZ2UpIHsKKyAgICAgICAgICAgICAgICBtQnVmZmVyc1tpXSA9IG5ldyBHcmFwaGljQnVmZmVyKAorICAgICAgICAgICAgICAgICAgICBtQnVmZmVyc1tpXS0+aGFuZGxlLCBHcmFwaGljQnVmZmVyOjpDTE9ORV9IQU5ETEUsCisgICAgICAgICAgICAgICAgICAgIG1CdWZmZXJzW2ldLT53aWR0aCwgbUJ1ZmZlcnNbaV0tPmhlaWdodCwKKyAgICAgICAgICAgICAgICAgICAgbUJ1ZmZlcnNbaV0tPmZvcm1hdCwgbUJ1ZmZlcnNbaV0tPmxheWVyQ291bnQsCisgICAgICAgICAgICAgICAgICAgIG1CdWZmZXJzW2ldLT5nZXRVc2FnZSgpIHwgY29uc3VtZXJVc2FnZSwKKyAgICAgICAgICAgICAgICAgICAgbUJ1ZmZlcnNbaV0tPnN0cmlkZSk7CisgICAgICAgICAgICAgICAgaWYgKG1CdWZmZXJzW2ldLT5pbml0Q2hlY2soKSAhPSBPSykgeworICAgICAgICAgICAgICAgICAgICBBTE9HVygiJXMoKSBmYWlsZWQgdG8gdXBkYXRlIHVzYWdlLCBvcmlnaW5hbCB1c2FnZT0lIiBQUkl4NjQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIiwgY29uc3VtZXIgdXNhZ2U9JSIgUFJJeDY0LAorICAgICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgbUJ1ZmZlcnNbaV0tPmdldFVzYWdlKCksIGNvbnN1bWVyVXNhZ2UpOworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtQnVmZmVyc1tpXS0+c2V0R2VuZXJhdGlvbk51bWJlcihnZW5lcmF0aW9uKTsKKworICAgICAgICAgICAgc3RhdHVzX3QgcmVzdWx0ID0gaWdicC0+YXR0YWNoQnVmZmVyKCZicVNsb3QsIG1CdWZmZXJzW2ldKTsKKyAgICAgICAgICAgIGlmIChyZXN1bHQgIT0gT0spIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJvb2wgYXR0YWNoID0KKyAgICAgICAgICAgICAgICAgICAgX0MyQmxvY2tGYWN0b3J5OjpFbmRBdHRhY2hCbG9ja1RvQnVmZmVyUXVldWUoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSwgbU93bmVyLCBnZXRIZ2JwKG1JZ2JwKSwgbVN5bmNNZW0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2VuZXJhdGlvbiwgYnFJZCwgYnFTbG90KTsKKyAgICAgICAgICAgIGlmICghYXR0YWNoKSB7CisgICAgICAgICAgICAgICAgaWdicC0+Y2FuY2VsQnVmZmVyKGJxU2xvdCwgRmVuY2U6Ok5PX0ZFTkNFKTsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJ1ZmZlcnNbYnFTbG90XSA9IG1CdWZmZXJzW2ldOworICAgICAgICAgICAgcG9vbERhdGFzW2JxU2xvdF0gPSBkYXRhOworICAgICAgICAgICAgKytzdWNjZXNzOworICAgICAgICB9CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgQnVmZmVyUXVldWVEZWZzOjpOVU1fQlVGRkVSX1NMT1RTOyArK2kpIHsKKyAgICAgICAgICAgIG1CdWZmZXJzW2ldID0gYnVmZmVyc1tpXTsKKyAgICAgICAgICAgIG1Qb29sRGF0YXNbaV0gPSBwb29sRGF0YXNbaV07CisgICAgICAgIH0KKyAgICAgICAgaWYgKG5ld1N5bmMpIHsKKyAgICAgICAgICAgIG5ld1N5bmMtPmxvY2soKTsKKyAgICAgICAgICAgIG5ld1N5bmMtPnNldEluaXRpYWxEZXF1ZXVlQ291bnRMb2NrZWQobU1heERlcXVldWVCdWZmZXJDb3VudCwgc3VjY2Vzcyk7CisgICAgICAgICAgICBuZXdTeW5jLT51bmxvY2soKTsKKyAgICAgICAgfQorICAgIH0KKyAgICBBTE9HRCgicmVtb3RlIGdyYXBoaWMgYnVmZmVyIG1pZ3JhdGlvbiAlenUvJXp1IiwKKyAgICAgICAgICBzdWNjZXNzLCB0cnlOdW0pOworICAgIHJldHVybiB0cnVlOworfQorCitib29sIE91dHB1dEJ1ZmZlclF1ZXVlOjpyZWdpc3RlckJ1ZmZlcihjb25zdCBDMkNvbnN0R3JhcGhpY0Jsb2NrJiBibG9jaykgeworICAgIHN0ZDo6c2hhcmVkX3B0cjxfQzJCbG9ja1Bvb2xEYXRhPiBkYXRhID0KKyAgICAgICAgICAgIF9DMkJsb2NrRmFjdG9yeTo6R2V0R3JhcGhpY0Jsb2NrUG9vbERhdGEoYmxvY2spOworICAgIGlmICghZGF0YSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHN0ZDo6c2NvcGVkX2xvY2s8c3RkOjptdXRleD4gbChtTXV0ZXgpOworCisgICAgaWYgKCFtSWdicCkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgdWludDMyX3Qgb2xkR2VuZXJhdGlvbjsKKyAgICB1aW50NjRfdCBvbGRJZDsKKyAgICBpbnQzMl90IG9sZFNsb3Q7CisgICAgLy8gSWYgdGhlIGJsb2NrIGlzIG5vdCBidWZmZXJxdWV1ZS1iYXNlZCwgZG8gbm90aGluZy4KKyAgICBpZiAoIV9DMkJsb2NrRmFjdG9yeTo6R2V0QnVmZmVyUXVldWVEYXRhKAorICAgICAgICAgICAgZGF0YSwgJm9sZEdlbmVyYXRpb24sICZvbGRJZCwgJm9sZFNsb3QpIHx8IChvbGRJZCA9PSAwKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIC8vIElmIHRoZSBibG9jaydzIGJxSWQgaXMgdGhlIHNhbWUgYXMgdGhlIGRlc2lyZWQgYnFJZCwganVzdCBob2xkLgorICAgIGlmICgob2xkSWQgPT0gbUJxSWQpICYmIChvbGRHZW5lcmF0aW9uID09IG1HZW5lcmF0aW9uKSkgeworICAgICAgICBMT0coVkVSQk9TRSkgPDwgImhvbGRCdWZmZXJRdWV1ZUJsb2NrIC0tIGltcG9ydCB3aXRob3V0IGF0dGFjaGluZzoiCisgICAgICAgICAgICAgICAgICAgICA8PCAiIGJxSWQgIiA8PCBvbGRJZAorICAgICAgICAgICAgICAgICAgICAgPDwgIiwgYnFTbG90ICIgPDwgb2xkU2xvdAorICAgICAgICAgICAgICAgICAgICAgPDwgIiwgZ2VuZXJhdGlvbiAiIDw8IG1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W50MzJfdCBicVNsb3Q7CisgICAgYm9vbCBkaXNwbGF5ID0gVjFfMDo6dXRpbHM6OmRpc3BsYXlCdWZmZXJRdWV1ZUJsb2NrKGJsb2NrKTsKKyAgICBpZiAoIWdldEJ1ZmZlclF1ZXVlQXNzaWdubWVudChibG9jaywgJmdlbmVyYXRpb24sICZicUlkLCAmYnFTbG90KSB8fAorICAgICAgICBicUlkID09IDApIHsKKyAgICAgICAgLy8gQmxvY2sgbm90IGZyb20gYnVmZmVycXVldWUgLS0gaXQgbXVzdCBiZSBhdHRhY2hlZCBiZWZvcmUgcXVldWluZy4KKworICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJTdXJmYWNlU3luY01lbW9yeT4gc3luY01lbTsKKyAgICAgICAgbU11dGV4LmxvY2soKTsKKyAgICAgICAgc3A8SUdyYXBoaWNCdWZmZXJQcm9kdWNlcj4gb3V0cHV0SWdicCA9IG1JZ2JwOworICAgICAgICB1aW50MzJfdCBvdXRwdXRHZW5lcmF0aW9uID0gbUdlbmVyYXRpb247CisgICAgICAgIHN5bmNNZW0gPSBtU3luY01lbTsKKyAgICAgICAgbU11dGV4LnVubG9jaygpOworCisgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGF0dGFjaFRvQnVmZmVyUXVldWUoCisgICAgICAgICAgICAgICAgYmxvY2ssIG91dHB1dElnYnAsIG91dHB1dEdlbmVyYXRpb24sICZicVNsb3QsIHN5bmNNZW0pOworCisgICAgICAgIGlmIChzdGF0dXMgIT0gT0spIHsKKyAgICAgICAgICAgIExPRyhXQVJOSU5HKSA8PCAib3V0cHV0QnVmZmVyIC0tIGF0dGFjaGluZyBmYWlsZWQuIjsKKyAgICAgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKKyAgICAgICAgfQorCisgICAgICAgIGF1dG8gc3luY1ZhciA9IHN5bmNNZW0gPyBzeW5jTWVtLT5tZW0oKSA6IG51bGxwdHI7CisgICAgICAgIGlmKHN5bmNWYXIpIHsKKyAgICAgICAgICAgIHN5bmNWYXItPmxvY2soKTsKKyAgICAgICAgICAgIHN0YXR1cyA9IG91dHB1dElnYnAtPnF1ZXVlQnVmZmVyKHN0YXRpY19jYXN0PGludD4oYnFTbG90KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQsIG91dHB1dCk7CisgICAgICAgICAgICBpZiAoc3RhdHVzID09IE9LKSB7CisgICAgICAgICAgICAgICAgc3luY1Zhci0+bm90aWZ5UXVldWVkTG9ja2VkKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzeW5jVmFyLT51bmxvY2soKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHN0YXR1cyA9IG91dHB1dElnYnAtPnF1ZXVlQnVmZmVyKHN0YXRpY19jYXN0PGludD4oYnFTbG90KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQsIG91dHB1dCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHN0YXR1cyAhPSBPSykgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAib3V0cHV0QnVmZmVyIC0tIHF1ZXVlQnVmZmVyKCkgZmFpbGVkICIKKyAgICAgICAgICAgICAgICAgICAgICAgIm9uIG5vbi1idWZmZXJxdWV1ZS1iYXNlZCBibG9jay4gIgorICAgICAgICAgICAgICAgICAgICAgICAiRXJyb3IgPSAiIDw8IHN0YXR1cyA8PCAiLiI7CisgICAgICAgICAgICByZXR1cm4gc3RhdHVzOworICAgICAgICB9CisgICAgICAgIHJldHVybiBPSzsKKyAgICB9CisKKyAgICBzdGQ6OnNoYXJlZF9wdHI8QzJTdXJmYWNlU3luY01lbW9yeT4gc3luY01lbTsKKyAgICBtTXV0ZXgubG9jaygpOworICAgIHNwPElHcmFwaGljQnVmZmVyUHJvZHVjZXI+IG91dHB1dElnYnAgPSBtSWdicDsKKyAgICB1aW50MzJfdCBvdXRwdXRHZW5lcmF0aW9u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ICBzdGF0dXNfdCBzdGF0dXMgPSBPSzsKKyAgICBpZiAoc3luY1ZhcikgeworICAgICAgICBzeW5jVmFyLT5sb2NrKCk7CisgICAgICAgIHN0YXR1cyA9IG91dHB1dElnYnAtPnF1ZXVlQnVmZmVyKHN0YXRpY19jYXN0PGludD4oYnFTbG90KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQsIG91dHB1dCk7CisgICAgICAgIGlmIChzdGF0dXMgPT0gT0spIHsKKyAgICAgICAgICAgIHN5bmNWYXItPm5vdGlmeVF1ZXVlZExvY2tlZCgpOworICAgICAgICB9CisgICAgICAgIHN5bmNWYXItPnVubG9jaygpOworICAgIH0gZWxzZSB7CisgICAgICAgIHN0YXR1cyA9IG91dHB1dElnYnAtPnF1ZXVlQnVmZmVyKHN0YXRpY19jYXN0PGludD4oYnFTbG90KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQsIG91dHB1dCk7CisgICAgfQorCisgICAgaWYgKHN0YXR1cyAhPSBPSykgeworICAgICAgICBMT0coRVJST1IpIDw8ICJvdXRwdXRCdWZmZXIgLS0gcXVldWVCdWZmZXIoKSBmYWlsZWQgIgorICAgICAgICAgICAgICAgICAgICJvbiBidWZmZXJxdWV1ZS1iYXNlZCBibG9jay4gIgorICAgICAgICAgICAgICAgICAgICJFcnJvciA9ICIgPDwgc3RhdHVzIDw8ICIuIjsKKyAgICAgICAgcmV0dXJuIHN0YXR1czsKKyAgICB9CisgICAgcmV0dXJuIE9LOworfQorCit2b2lkIE91dHB1dEJ1ZmZlclF1ZXVlOjpob2xkQnVmZmVyUXVldWVCbG9ja3MoCisgICAgICAgIGNvbnN0IHN0ZDo6bGlzdDxzdGQ6OnVuaXF1ZV9wdHI8QzJXb3JrPj4mIHdvcmtMaXN0KSB7CisgICAgZm9yRWFjaEJsb2NrKHdvcmtMaXN0LAorICAgICAgICAgICAg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ZWMyIiwKKyAgICAgICAgImxpYmNvZGVjMl92bmRrIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgXSwKKworICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsKKyAgICAgICAgImluY2x1ZGUiLAorICAgICAgICAiaW50ZXJuYWwiLAorICAgIF0sCisKKyAgICBhcGV4X2F2YWlsYWJsZTogWworICAgICAgICAiLy9hcGV4X2F2YWlsYWJsZTpwbGF0Zm9ybSIsCisgICAgICAgICJjb20uYW5kcm9pZC5tZWRpYS5zd2NvZGVjIiwKKyAgICBdLAorICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKK30KKworY2NfbGlicmFyeSB7CisgICAgbmFtZTogImxpYmNvZGVjMl9oaWRsX3BsdWdpbiIsCisgICAgdmVuZG9yOiB0cnVlLAorCisgICAgc3JjczogWworICAgICAgICAiRGVmYXVsdEZpbHRlclBsdWdpbi5jcHAiLAorICAgICAgICAiRmlsdGVyV3JhcHBlci5jcHAiLAorICAgIF0sCisKKyAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGliY29kZWMyX2ludGVybmFsIiwgLy8gcHJpdmF0ZQorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGliYmFzZSIsCisgICAgICAgICJsaWJjb2RlYzIiLAorICAgICAgICAibGliY29kZWMyX3ZuZGsiLAorICAgICAgICAibGlibG9nIiwKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICBdLAorCisgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWworICAgICAgICAiaW5jbHVkZSIsCisgICAgICAgICJpbnRlcm5hbCIsCisgICAgXSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL2NvZGVjMi9oaWRsL3BsdWdpbi9EZWZhdWx0RmlsdGVyUGx1Z2luLmNwcCBiL21lZGlhL2NvZGVjMi9oaWRsL3BsdWdpbi9EZWZhdWx0RmlsdGVyUGx1Z2luLmNwcApuZXcgZ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GVzRm9yTGFzdEZpbHRlciksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjplbmQoa1R5cGVzRm9yTGFzdEZpbHRlciksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXgudHlwZSgpKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChpbmRleC5mb3JTdHJlYW0oKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gcXVlcnlTdXBwb3J0ZWRQYXJhbXMgZG9lcyBub3QgcmV0dXJuIHBlci1zdHJlYW0gcGFyYW1zLgorICAgICAgICAgICAgICAgICAgICAgICAgLy8gV2Ugb25seSBzdXBwb3J0IHN0cmVhbS0wIGZvciBub3cuCisgICAgICAgICAgICAgICAgICAgICAgICBpbmRleCA9IGluZGV4LndpdGhTdHJlYW0oMHUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGluZGljZXMucHVzaF9iYWNrKGluZGV4KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoIWluZGljZXMuZW1wdHkoKSkgeworICAgICAgICAgICAgICAgIG1GaWx0ZXJzLmJhY2soKS5pbnRmLT5xdWVyeV92Yih7fSwgaW5kaWNlcywgQzJfTUFZX0JMT0NLLCAmbGFzdEZpbHRlclBhcmFtcyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBUT0RPOiBkb2N1bWVudGF0aW9uCisgICAgICAgIG1GaWx0ZXJzID0gc3RkOjptb3ZlKGZpbHRlcnMpOworICAgICAgICBtVHlwZVRvSW5kZXhGb3JRdWVyeS5jbGVhcigpOworICAgICAgICBtVHlwZVRvSW5kZXhGb3JDb25maWcuY2xlYXIoKTsKKyAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBtRmlsdGVycy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgaWYgKGkgPT0gMCkgeworICAgICAgICAgICAgICAgIHRyYW5zZmVyUGFyYW1zX2wobUludGYsIG1GaWx0ZXJzWzBdLmludGYsIEMyX01BWV9CTE9DSyk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHRyYW5zZmVyUGFyYW1zX2wobUZpbHRlcnNbaSAtIDFdLmludGYsIG1GaWx0ZXJzW2ldLmludGYsIEMyX01BWV9CTE9DSyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmb3IgKEMyUGFyYW06OlR5cGUgdHlwZSA6IG1GaWx0ZXJzW2ldLmRlc2MuY29udHJvbFBhcmFtcykgeworICAgICAgICAgICAgICAgIG1UeXBlVG9JbmRleEZvclF1ZXJ5W3R5cGUudHlwZSgpXSA9IGk7CisgICAgICAgICAgICAgICAgbVR5cGVUb0luZGV4Rm9yQ29uZmlnW3R5cGUudHlwZSgpICYgfkMyUGFyYW06OkNvcmVJbmRleDo6SVNfUkVRVUVTVF9GTEFHXSA9IGk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmb3IgKEMyUGFyYW06OlR5cGUgdHlwZSA6IG1GaWx0ZXJzW2ldLmRlc2MuYWZmZWN0ZWRQYXJhbXMpIHsKKyAgICAgICAgICAgICAgICBtVHlwZVRvSW5kZXhGb3JRdWVyeVt0eXBlLnR5cGUoKV0gPSBpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGZvciAoc2l6ZV90IGkgPSBtRmlsdGVycy5zaXplKCk7IGkgPiAwOyAtLWkpIHsKKyAgICAgICAgICAgIGlmIChpID09IDEpIHsKKyAgICAgICAgICAgICAgICBiYWNrUHJvcGFnYXRlUGFyYW1zX2wobUludGYsIG1GaWx0ZXJzWzBdLmludGYsIEMyX01BWV9CTE9DSyk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGJhY2tQcm9wYWdhdGVQYXJhbXNfbChtRmlsdGVyc1tpIC0gMl0uaW50ZiwgbUZpbHRlcnNbaSAtIDFdLmludGYsIEMyX01BWV9CTE9DSyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFtRmlsdGVycy5lbXB0eSgpKSB7CisgICAgICAgICAgICBmb3IgKHVpbnQzMl90IHR5cGUgOiBrVHlwZXNGb3JMYXN0RmlsdGVyKSB7CisgICAgICAgICAgICAgICAgbVR5cGVUb0luZGV4Rm9yUXVlcnlbdHlwZV0gPSBtRmlsdGVycy5zaXplKCkgLSAxOworICAgICAgICAgICAgICAgIG1UeXBlVG9JbmRleEZvckNvbmZpZ1t0eXBlICYgfkMyUGFyYW06OkNvcmVJbmRleDo6SVNfUkVRVUVTVF9GTEFHXSA9CisgICAgICAgICAgICAgICAgICAgIG1GaWx0ZXJzLnNpemUoKSAtIDE7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoIWxhc3RGaWx0ZXJQYXJhbXMuZW1wdHkoKSkgeworICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPEMyUGFyYW0gKj4gcGFyYW1QdHJzKGxhc3RGaWx0ZXJQYXJhbXMuc2l6ZSgpKTsKKyAgICAgICAgICAgICAgICBzdGQ6OnRyYW5zZm9ybSgKKyAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RGaWx0ZXJQYXJhbXMuYmVnaW4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RGaWx0ZXJQYXJhbXMuZW5kKCksCisgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbVB0cnMuYmVnaW4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIFtdKGNvbnN0IHN0ZDo6dW5pcXVlX3B0cjxDMlBhcmFtPiAmcGFyYW0pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFyYW0uZ2V0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxzdGQ6OnVuaXF1ZV9wdHI8QzJTZXR0aW5nUmVzdWx0Pj4gZmFpbHVyZX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aXphdGlvbgorICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG1GaWx0ZXJzLnNpemUoKTsgKytpKSB7CisgICAgICAgICAgICAvLyBGaWx0ZXIgc3RhY2sgcGFyYW1zIGFjY29yZGluZyB0byBtVHlwZVRvSW5kZXhGb3JRdWVyeQorICAgICAgICAgICAgc3RkOjp2ZWN0b3I8QzJQYXJhbSAqPiBzdGFja1BhcmFtc0ZvckZpbHRlcjsKKyAgICAgICAgICAgIGZvciAoYXV0byBpdCA9IHN0YWNrUGFyYW1zTGlzdC5iZWdpbigpOyBpdCAhPSBzdGFja1BhcmFtc0xpc3QuZW5kKCk7ICkgeworICAgICAgICAgICAgICAgIEMyUGFyYW0gKnBhcmFtID0gKml0OworICAgICAgICAgICAgICAgIHVpbnQzMl90IHR5cGUgPSBwYXJhbS0+dHlwZSgpLnR5cGUoKTsKKyAgICAgICAgICAgICAgICBhdXRvIGl0MiA9IG1UeXBlVG9JbmRleEZvclF1ZXJ5LmZpbmQodHlwZSk7CisgICAgICAgICAgICAgICAgaWYgKGl0MiA9PSBtVHlwZVRvSW5kZXhGb3JRdWVyeS5lbmQoKSB8fCBpdDItPnNlY29uZCAhPSBpKSB7CisgICAgICAgICAgICAgICAgICAgICsraXQ7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzdGFja1BhcmFtc0ZvckZpbHRlci5wdXNoX2JhY2socGFyYW0pOworICAgICAgICAgICAgICAgIGl0ID0gc3RhY2tQYXJhbXNMaXN0LmVyYXNlKGl0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIEZpbHRlciBoZWFwIHBhcmFtcyBhY2NvcmRpbmcgdG8gbVR5cGVUb0luZGV4Rm9yUXVlcnkKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPEMyUGFyYW06OkluZGV4PiBoZWFwUGFyYW1JbmRpY2VzRm9yRmlsdGVyOworICAgICAgICAgICAgZm9yIChzaXplX3QgaiA9IDA7IGogPCBoZWFwUGFyYW1JbmRpY2VzLnNpemUoKTsgKytqKSB7CisgICAgICAgICAgICAgICAgdWludDMyX3QgdHlwZSA9IGhlYXBQYXJhbUluZGljZXNbal0udHlwZSgpOworICAgICAgICAgICAgICAgIGF1dG8gaXQgPSBtVHlwZVRvSW5kZXhGb3JRdWVyeS5maW5kKHR5cGUpOworICAgICAgICAgICAgICAgIGlmIChpdCA9PSBtVHlwZVRvSW5kZXhGb3JRdWVyeS5lbmQoKSB8fCBpdC0+c2Vjb25kICE9IGkpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGhlYXBQYXJhbUluZGljZXNGb3JGaWx0ZXIucHVzaF9iYWNrKGhlYXBQYXJhbUluZGljZXNbal0pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjp1bmlxdWVfcHRyPEMyUGFyYW0+PiBoZWFwUGFyYW1zRm9yRmlsdGVyOworICAgICAgICAgICAgY29uc3Qgc3RkOjpzaGFyZWRfcHRyPEMyQ29tcG9uZW50SW50ZXJmYWNlPiAmZmlsdGVyID0gbUZpbHRlcnNbaV0uaW50ZjsKKyAgICAgICAgICAgIGMyX3N0YXR1c190IGVyciA9IGZpbHRlci0+cXVlcnlfdmIoCisgICAgICAgICAgICAgICAgICAgIHN0YWNrUGFyYW1zRm9yRmlsdGVyLCBoZWFwUGFyYW1JbmRpY2VzRm9yRmlsdGVyLCBtYXlCbG9jaywKKyAgICAgICAgICAgICAgICAgICAgJmhlYXBQYXJhbXNGb3JGaWx0ZXIpOworICAgICAgICAgICAgaWYgKGVyciAhPSBDMl9PSyAmJiBlcnIgIT0gQzJfQkFEX0lOREVYKSB7CisgICAgICAgICAgICAgICAgTE9HKFdBUk5JTkcpIDw8ICJXcmFwcGVkRGVjb2RlckludGVyZmFjZTogIiA8PCBmaWx0ZXItPmdldE5hbWUoKQorICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiByZXR1cm5lZCBlcnJvciBmb3IgcXVlcnlfdmI7IGVycj0iIDw8IGVycjsKKyAgICAgICAgICAgICAgICByZXN1bHQgPSBlcnI7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBoZWFwUGFyYW1zLT5pbnNlcnQoCisgICAgICAgICAgICAgICAgICAgIGhlYXBQYXJhbXMtPmVuZCgpLAorICAgICAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfbW92ZV9pdGVyYXRvcihoZWFwUGFyYW1zRm9yRmlsdGVyLmJlZ2luKCkpLAorICAgICAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfbW92ZV9pdGVyYXRvcihoZWFwUGFyYW1zRm9yRmlsdGVyLmVuZCgpKSk7CisgICAgICAgIH0KKworICAgICAgICBzdGQ6OnZlY3RvcjxDMlBhcmFtICo+IHN0YWNrUGFyYW1zRm9ySW50ZjsKKyAgICAgICAgc3RkOjpjb3B5X24oc3RhY2tQYXJhbXNMaXN0LmJlZ2luKCksIHN0YWNrUGFyYW1zTGlzdC5zaXplKCksIHN0YWNrUGFyYW1zRm9ySW50Zi5iZWdpbigpKTsKKworICAgICAgICAvLyBHYXRoZXIgaGVhcCBwYXJhbXMgdGhhdCBkaWQgbm90IGdldCBxdWVyaWVkIGZyb20gdGhlIGZpbHRlciBpbnRlcmZhY2VzIGFib3ZlLgorICAgICAgICAvLyBUaGVzZSBuZWVkIHRvIGJlIHF1ZXJpZWQgZnJvbSB0aGUgZGVjb2RlciBpbnRlcmZhY2UuCisgICAgICAgIHN0ZDo6dmVjdG9yPEMyUGFyYW06OkluZGV4PiBoZWFwUGFyYW1JbmRpY2VzRm9ySW50ZjsKKyAgICAgICAgZm9yIChzaXplX3QgaiA9IDA7IGogPCBoZWFwUGFyYW1JbmRpY2VzLnNpemUoKTsgKytqKSB7CisgICAgICAgICAgICB1aW50MzJfdCB0eXBlID0gaGVhcFBhcmFtSW5kaWNlc1tqXS50eXBlKCk7CisgICAgICAgICAgICBpZiAobVR5cGVUb0luZGV4Rm9yUXVlcnkuZmluZCh0eXBlKSAhPSBtVHlwZVRvSW5kZXhGb3JRdWVyeS5lbmQoKSkgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaGVhcFBhcmFtSW5kaWNlc0ZvckludGYucHVzaF9iYWNrKGhlYXBQYXJhbUluZGljZXNbal0pOworICAgICAgICB9CisKKyAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjp1bmlxdWVfcHRyPEMyUGFyYW0+PiBoZWFwUGFyYW1zRm9ySW50ZjsKKyAgICAgICAgYzJfc3RhdHVzX3QgZXJyID0gbUludGYtPnF1ZXJ5X3ZiKAorICAgICAgICAgICAgICAgIHN0YWNrUGFyYW1zRm9ySW50ZiwgaGVhcFBhcmFtSW5kaWNlc0ZvckludGYsIG1heUJsb2NrLCAmaGVhcFBhcmFtc0ZvckludGYpOworICAgICAgICBpZiAoZXJyICE9IEMyX09LKSB7CisgICAgICAgICAgICBMT0coZXJyID09IEMyX0JBRF9JTkRFWCA/IFZFUkJPU0UgOiBXQVJOSU5HKQorICAgICAgICAgICAgICAgICAgICA8PCAiV3JhcHBlZERlY29kZXJJbnRlcmZhY2U6ICIgPDwgbUludGYtPmdldE5hbWUoKQorICAgICAgICAgICAgICAgICAgICA8PCAiIHJldHVybmVkIGVycm9yIGZvciBxdWVyeV92YjsgZXJyPSIgPDwgZXJyOworICAgICAgICAgICAgcmVzdWx0ID0gZXJyOworICAgICAgICB9CisKKyAgICAgICAgLy8gVE9ETzogcGFyYW1zIG5lZWRzIHRvIHByZXNlcnZlIHRoZSBvcmRlcgorICAgICAgICBoZWFwUGFyYW1zLT5pbnNlcnQoCisgICAgICAgICAgICAgICAgaGVhcFBhcmFtcy0+ZW5kKCksCisgICAgICAgICAgICAgICAgc3RkOjptYWtlX21vdmVfaXRlcmF0b3IoaGVhcFBhcmFtc0ZvckludGYuYmVnaW4oKSksCisgICAgICAgICAgICAgICAgc3RkOjptYWtlX21vdmVfaXRlcmF0b3IoaGVhcFBhcmFtc0ZvckludGYuZW5kKCkpKTsKKworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIGMyX3N0YXR1c190IGNvbmZpZ192YigKKyAgICAgICAgICAgIGNvbnN0IHN0ZDo6dmVjdG9yPEMyUGFyYW0gKj4gJnBhcmFtcywKKyAgICAgICAgICAgIGMyX2Jsb2NraW5nX3QgbWF5QmxvY2ssCisgICAgICAgICAgICBzdGQ6OnZlY3RvcjxzdGQ6OnVuaXF1ZV9wdHI8QzJTZXR0aW5nUmVzdWx0Pj4qIGNvbnN0IGZhaWx1cmVzKSBvdmVycmlkZSB7CisgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtTXV0ZXgpOworICAgICAgICBjMl9zdGF0dXNfdCByZXN1bHQgPSBDMl9PSzsKKyAgICAgICAgc3RkOjp2ZWN0b3I8QzJQYXJhbSAqPiBwYXJhbXNGb3JJbnRmOworICAgICAgICBmb3IgKEMyUGFyYW0qIHBhcmFtIDogcGFyYW1zKSB7CisgICAgICAgICAgICBhdXRvIGl0ID0gbVR5cGVUb0luZGV4Rm9yQ29uZmlnLmZpbmQocGFyYW0tPnR5cGUoKS50eXBlKCkpOworICAgICAgICAgICAgaWYgKGl0ICE9IG1UeXBlVG9JbmRleEZvckNvbmZpZy5lbmQoKSkgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcGFyYW1zRm9ySW50Zi5wdXNoX2JhY2socGFyYW0pOworICAgICAgICB9CisgICAgICAgIGMyX3N0YXR1c190IGVyciA9IG1JbnRmLT5jb25maWdfdmIocGFyYW1zRm9ySW50ZiwgbWF5QmxvY2ssIGZhaWx1cmVzKTsKKyAgICAgICAgaWYgKGVyciAhPSBDMl9PSykgeworICAgICAgICAgICAgTE9HKGVyciA9PSBDMl9CQURfSU5ERVggPyBWRVJCT1NFIDogV0FSTklORykKKyAgICAgICAgICAgICAgICAgICAgPDwgIldyYXBwZWREZWNvZGVySW50ZXJmYWNlOiAiIDw8IG1JbnRmLT5nZXROYW1lKCkKKyAgICAgICAgICAgICAgICAgICAgPDwgIiByZXR1cm5lZCBlcnJvciBmb3IgY29uZmlnX3ZiOyBlcnI9IiA8PCBlcnI7CisgICAgICAgICAgICByZXN1bHQgPSBlcnI7CisgICAgICAgIH0KKyAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBtRmlsdGVycy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgaWYgKGkgPT0gMCkgeworICAgICAgICAgICAgICAgIHRyYW5zZmVyUGFyYW1zX2wobUludGYsIG1GaWx0ZXJzWzBdLmludGYsIG1heUJsb2NrKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgdHJhbnNmZXJQYXJhbXNfbChtRmlsdGVyc1tpIC0gMV0uaW50ZiwgbUZpbHRlcnNbaV0uaW50ZiwgbWF5QmxvY2spOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY29uc3Qgc3RkOjpzaGFyZWRfcHRyPEMyQ29tcG9uZW50SW50ZXJmYWNlPiAmZmlsdGVyID0gbUZpbHRlcnNbaV0uaW50ZjsKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHN0ZDo6dW5pcXVlX3B0cjxDMlNldHRpbmdSZXN1bHQ+PiBmaWx0ZXJGYWlsdXJlczsKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPEMyUGFyYW0gKj4gcGFyYW1zRm9yRmlsdGVyOworICAgICAgICAgICAgZm9yIChDMlBhcmFtKiBwYXJhbSA6IHBhcmFtcykgeworICAgICAgICAgICAgICAgIGF1dG8gaXQgPSBtVHlwZVRvSW5kZXhGb3JDb25maWcuZmluZChwYXJhbS0+dHlwZSgpLnR5cGUoKSk7CisgICAgICAgICAgICAgICAgaWYgKGl0ICE9IG1UeXBlVG9JbmRleEZvckNvbmZpZy5lbmQoKSAmJiBpdC0+c2Vjb25kICE9IGkpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHBhcmFtc0ZvckZpbHRlci5wdXNoX2JhY2socGFyYW0pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYzJfc3RhdHVzX3QgZXJyID0gZmlsdGVyLT5jb25maWdfdmIocGFyYW1zRm9yRmlsdGVyLCBtYXlCbG9jaywgJmZpbHRlckZhaWx1cmVzKTsKKyAgICAgICAgICAgIGlmIChlcnIgIT0gQzJfT0spIHsKKyAgICAgICAgICAgICAgICBMT0coZXJyID09IEMyX0JBRF9JTkRFWCA/IFZFUkJPU0UgOiBXQVJOSU5HKQorICAgICAgICAgICAgICAgICAgICAgICAgPDwgIldyYXBwZWREZWNvZGVySW50ZXJmYWNlOiAiIDw8IGZpbHRlci0+Z2V0TmFtZSgpCisgICAgICAgICAgICAgICAgICAgICAgICA8PCAiIHJldHVybmVkIGVycm9yIGZvciBjb25maWdfdmI7IGVycj0iIDw8IGVycjsKKyAgICAgICAgICAgICAgICByZXN1bHQgPSBlcnI7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZm9yIChzaXplX3QgaSA9IG1GaWx0ZXJzLnNpemUoKTsgaSA+IDA7IC0taSkgeworICAgICAgICAgICAgaWYgKGkgPT0gMSkgeworICAgICAgICAgICAgICAgIGJhY2tQcm9wYWdhdGVQYXJhbXNfbChtSW50ZiwgbUZpbHRlcnNbMF0uaW50ZiwgbWF5QmxvY2spOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBiYWNrUHJvcGFnYXRlUGFyYW1zX2wobUZpbHRlcnNbaSAtIDJdLmludGYsIG1GaWx0ZXJzW2kgLSAxXS5pbnRmLCBtYXlCbG9jayk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworIC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jdG9yPHN0ZDo6c2hhcmVkX3B0cjxDMlBhcmFtRGVzY3JpcHRvcj4+IGZpbHRlclBhcmFtczsKKyAgICAgICAgICAgIGMyX3N0YXR1c190IGVyciA9IGZpbHRlci5pbnRmLT5xdWVyeVN1cHBvcnRlZFBhcmFtc19uYigmZmlsdGVyUGFyYW1zKTsKKyAgICAgICAgICAgIGlmIChlcnIgIT0gQzJfT0spIHsKKyAgICAgICAgICAgICAgICBMT0coV0FSTklORykgPDwgIldyYXBwZWREZWNvZGVySW50ZXJmYWNlOiAiIDw8IGZpbHRlci5pbnRmLT5nZXROYW1lKCkKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgcmV0dXJuZWQgZXJyb3IgZm9yIHF1ZXJ5U3VwcG9ydGVkUGFyYW1zX25iOyBlcnI9IiA8PCByZXN1bHQ7CisgICAgICAgICAgICAgICAgcmVzdWx0ID0gZXJyOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZm9yIChjb25zdCBzdGQ6OnNoYXJlZF9wdHI8QzJQYXJhbURlc2NyaXB0b3I+ICZwYXJhbURlc2MgOiBmaWx0ZXJQYXJhbXMpIHsKKyAgICAgICAgICAgICAgICBpZiAoc3RkOjpjb3VudCgKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpbHRlci5kZXNjLmNvbnRyb2xQYXJhbXMuYmVnaW4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpbHRlci5kZXNjLmNvbnRyb2xQYXJhbXMuZW5kKCksCisgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbURlc2MtPmluZGV4KCkudHlwZSgpKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBwYXJhbXMtPnB1c2hfYmFjayhwYXJhbURlc2MpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiByZXN1bHQ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dWVyeSAmZmllbGQgPSBmaWVsZHNbaV07CisgICAgICAgICAgICAgICAgdWludDMyX3QgdHlwZSA9IEMyUGFyYW06OkluZGV4KF9DMlBhcmFtSW5zcGVjdG9yOjpHZXRJbmRleChmaWVsZC5maWVsZCgpKSkudHlwZSgpOworICAgICAgICAgICAgICAgIGlmIChzdGQ6OmNvdW50KAorICAgICAgICAgICAgICAgICAgICAgICAgZmlsdGVyLmRlc2MuY29udHJvbFBhcmFtcy5iZWdpbigpLAorICAgICAgICAgICAgICAgICAgICAgICAgZmlsdGVyLmRlc2MuY29udHJvbFBhcmFtcy5lbmQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUpID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGZpbHRlckZpZWxkcy5wdXNoX2JhY2soZmllbGQpOworICAgICAgICAgICAgICAgIGluZGljZXMucHVzaF9iYWNrKGkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYzJfc3RhdHVzX3QgZXJyID0gZmlsdGVyLmludGYtPnF1ZXJ5U3VwcG9ydGVkVmFsdWVzX3ZiKGZpbHRlckZpZWxkcywgbWF5QmxvY2spOworICAgICAgICAgICAgaWYgKGVyciAhPSBDMl9PSyAmJiBlcnIgIT0gQzJfQkFEX0lOREVYKSB7CisgICAgICAgICAgICAgICAgTE9HKFdBUk5JTkcpIDw8ICJXcmFwcGVkRGVjb2RlckludGVyZmFjZTogIiA8PCBmaWx0ZXIuaW50Zi0+Z2V0TmFtZSgpCisgICAgICAgICAgICAgICAgICAgICAgICA8PCAiIHJldHVybmVkIGVycm9yIGZvciBxdWVyeVN1cHBvcnRlZFBhcmFtc19uYjsgZXJyPSIgPDwgcmVzdWx0OworICAgICAgICAgICAgICAgIHJlc3VsdCA9IGVycjsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZvciAoc2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dGQ6OnZlY3RvcjxzdGQ6OnNoYXJlZF9wdHI8QzJQYXJhbURlc2NyaXB0b3I+PiBwYXJhbURlc2NzOworICAgICAgICBjMl9zdGF0dXNfdCBlcnIgPSBuZXh0LT5xdWVyeVN1cHBvcnRlZFBhcmFtc19uYigmcGFyYW1EZXNjcyk7CisgICAgICAgIGlmIChlcnIgIT0gQzJfT0spIHsKKyAgICAgICAgICAgIExPRyhERUJVRykgPDwgIldyYXBwZWREZWNvZGVySW50ZXJmYWNlOiAiIDw8IG5leHQtPmdldE5hbWUoKQorICAgICAgICAgICAgICAgICAgICA8PCAiIHJldHVybmVkIGVycm9yIGZvciBxdWVyeVN1cHBvcnRlZFBhcmFtc19uYjsgZXJyPSIgPDwgZXJyOworICAgICAgICAgICAgcmV0dXJuIGVycjsKKyAgICAgICAgfQorICAgICAgICAvLyBGaW5kIHN1cHBvcnRlZCBpbnB1dCBwYXJhbXMgZnJvbSB0aGUgbmV4dCBpbnRlcmZhY2UgYW5kIGZsaXAgZGlyZWN0aW9uCisgICAgICAgIC8vIHNvIHRoZXkgYmVjb21lIG91dHB1dCBwYXJhbXMuCisgICAgICAgIHN0ZDo6dmVjdG9yPEMyUGFyYW06OkluZGV4PiBpbmRpY2VzOworICAgICAgICBmb3IgKGNvbnN0IHN0ZDo6c2hhcmVkX3B0cjxDMlBhcmFtRGVzY3JpcHRvcj4gJnBhcmFtRGVzYyA6IHBhcmFtRGVzY3MpIHsKKyAgICAgICAgICAgIEMyUGFyYW06OkluZGV4IGluZGV4ID0gcGFyYW1EZXNjLT5pbmRleCgpOworICAgICAgICAgICAgaWYgKCFpbmRleC5mb3JJbnB1dCgpIHx8IHBhcmFtRGVzYy0+aXNSZWFkT25seSgpKSB7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoaW5kZXguZm9yU3RyZWFtKCkpIHsKKyAgICAgICAgICAgICAgICB1aW50MzJfdCBzdHJlYW0gPSBpbmRleC5zdHJlYW0oKTsKKyAgICAgICAgICAgICAgICBpbmRleCA9IGluZGV4LndpdGhQb3J0KHRydWUgLyogb3V0cHV0ICovKS53aXRoU3RyZWFtKHN0cmVhbSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGluZGV4ID0gaW5kZXgud2l0aFBvcnQodHJ1ZSAvKiBvdXRwdXQgKi8pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaW5kaWNlcy5wdXNoX2JhY2soaW5kZXgpOworICAgICAgICB9CisgICAgICAgIC8vIFF1ZXJ5IHRob3NlIG91dHB1dCBwYXJhbXMgZnJvbSB0aGUgY3VycmVudCBpbnRlcmZhY2UKKyAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjp1bmlxdWVfcHRyPEMyUGFyYW0+PiBoZWFwUGFyYW1zOworICAgICAgICBlcnIgPSBjdXJyLT5xdWVyeV92Yih7fSwgaW5kaWNlcywgbWF5QmxvY2ssICZoZWFwUGFyYW1zKTsKKyAgICAgICAgaWYgKGVyciAhPSBDMl9PSyAmJiBlcnIgIT0gQzJfQkFEX0lOREVYKSB7CisgICAgICAgICAgICBMT0coREVCVUcpIDw8ICJXcmFwcGVkRGVjb2RlckludGVyZmFjZTogIiA8PCBjdXJyLT5nZXROYW1lKCkKKyAgICAgICAgICAgICAgICAgICAgPDwgIiByZXR1cm5lZCBlcnJvciBmb3IgcXVlcnlfdmI7IGVycj0iIDw8IGVycjsKKyAgICAgICAgICAgIHJldHVybiBlcnI7CisgICAgICAgIH0KKyAgICAgICAgLy8gRmxpcCB0aGUgZGlyZWN0aW9uIG9mIHRoZSBxdWVyaWVkIHBhcmFtcywgc28gdGhleSBiZWNvbWUgaW5wdXQgcGFyYW1ldGVycy4KKyAgICAgICAgLy8gQ29uZmlndXJlIHRoZSBuZXh0IGludGVyZmFjZSB3aXRoIHRoZSBwYXJhbXMuCisgICAgICAgIHN0ZDo6dmVjdG9yPEMyUGFyYW0gKj4gY29uZmlnUGFyYW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QzJfT0spIHsKKyAgICAgICAgICAgIExPRyhERUJVRykgPDwgIldyYXBwZWREZWNvZGVySW50ZXJmYWNlOiBGaWx0ZXJXcmFwcGVyIHJldHVybmVkIGVycm9yIGZvciAiCisgICAgICAgICAgICAgICAgPDwgInF1ZXJ5UGFyYW1zRm9yUHJldmlvdXNDb21wb25lbnQ7IGludGY9IiA8PCBuZXh0LT5nZXROYW1lKCkgPDwgIiBlcnI9IiA8PCBlcnI7CisgICAgICAgICAgICByZXR1cm4gQzJfT0s7CisgICAgICAgIH0KKyAgICAgICAgc3RkOjp2ZWN0b3I8QzJQYXJhbSAqPiBjb25maWdQYXJhbXM7CisgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgcGFyYW1zLnNpemUoKTsgKytpKSB7CisgICAgICAgICAgICBpZiAoIXBhcmFtc1tpXSkgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY29uZmlnUGFyYW1zLnB1c2hfYmFjayhwYXJhbXNbaV0uZ2V0KCkpOworICAgICAgICB9CisgICAgICAgIHN0ZDo6dmVjdG9yPHN0ZDo6dW5pcXVlX3B0cjxDMlNldHRpbmdSZXN1bHQ+PiBmYWlsdXJlczsKKyAgICAgICAgY3Vyci0+Y29uZmlnX3ZiKGNvbmZpZ1BhcmFtcywgbWF5QmxvY2ssICZmYWlsdXJlcyk7CisgICAgICAgIGlmIChlcnIgIT0gQzJfT0sgJiYgZXJyICE9IEMyX0JBRF9JTkRFWCkgeworICAgICAgICAgICAgTE9HKERFQlVHKSA8PCAiV3JhcHBlZERlY29kZXJJbnRlcmZhY2U6ICIgPDwgbmV4dC0+Z2V0TmFtZSgpCisgICAgICAgICAgICAgICAgICAgIDw8ICIgcmV0dXJuZWQgZXJyb3IgZm9yIGNvbmZpZ192YjsgZXJyPSIgPDwgZXJyOworICAgICAgICAgICAgcmV0dXJuIGVycjsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gQzJfT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Xb3JrPj4gaXRlbXM7CisgICAgICAgICAgICBpdGVtcy5wdXNoX2JhY2soc3RkOjptb3ZlKGVvc1dvcmspKTsKKyAgICAgICAgICAgIG1Db21wLT5xdWV1ZV9uYigmaXRlbXMpOworICAgICAgICAgICAgcmV0dXJuIEMyX09LOworICAgICAgICB9CisgICAgICAgIGNhc2UgRFJBSU5fQ09NUE9ORU5UX05PX0VPUzoKKyAgICAgICAgY2FzZSBEUkFJTl9DSEFJTjoKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHJldHVybiBDMl9CQURfVkFMVUU7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjMl9zdGF0dXNfdCBzdGFydCgpIG92ZXJyaWRlIHsKKyAgICAgICAgc3RkOjp2ZWN0b3I8RmlsdGVyV3JhcHBlcjo6Q29tcG9uZW50PiBmaWx0ZXJzOworICAgICAgICBpZiAoc3RkOjpzaGFyZWRfcHRyPEZpbHRlcldyYXBwZXI+IGZpbHRlcldyYXBwZXIgPSBtRmlsdGVyV3JhcHBlci5sb2NrKCkpIHsKKyAgICAgICAgICAgIC8vIExldCdzIGNoZWNrIGlmIHdlIGhhdmUgZmlsdGVycyB0aGF0IHdlIGNhbiBza2lwCisgICAgICAgICAgICBmb3IgKEZpbHRlcldyYXBwZXI6OkNvbXBvbmVudCAmZmlsdGVyIDogbUZpbHRlcnMpIHsKKyAgICAgICAgICAgICAgICBpZiAoIWZpbHRlcldyYXBwZXItPmlzRmlsdGVyaW5nRW5hYmxlZChmaWx0ZXIuaW50ZikpIHsKKyAgICAgICAgICAgICAgICAgICAgTE9HKFZFUkJPU0UpIDw8ICJmaWx0ZXJpbmcgZGlzYWJsZWQgZm9yICIgPDwgZmlsdGVyLnRyYWl0cy5uYW1lOworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgTE9HKFZFUkJPU0UpIDw8ICJmaWx0ZXJpbmcgZW5hYmxlZCBmb3IgIiA8PCBmaWx0ZXIudHJhaXRzLm5hbWU7CisgICAgICAgICAgICAgICAgZmlsdGVycy5wdXNoX2JhY2soZmlsdGVyKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChmaWx0ZXJzLnNpemUoKSA8IG1GaWx0ZXJzLnNpemUoKSkgeworICAgICAgICAgICAgICAgIExPRyhWRVJCT1NFKSA8PCAobUZpbHRlcnMuc2l6ZSgpIC0gZmlsdGVycy5zaXplKCkpIDw8ICIgZmlsdGVyKHMpIHNraXBwZWQiOworICAgICAgICAgICAgICAgIHNldExpc3RlbmVySW50ZXJuYWwoZmlsdGVycywgbUxpc3RlbmVyLCBDMl9NQVlfQkxPQ0spOworICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yIGZpbHRlcnNDb3B5KGZpbHRlcnMpOworICAgICAgICAgICAgICAgIG1JbnRmLT50YWtlRmlsdGVycyhzdGQ6Om1vdmUoZmlsdGVyc0NvcHkpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGMyX3N0YXR1c190IGVyciA9IG1Db21wLT5zdGFydCgpOworICAgICAgICBpZiAoZXJyICE9IEMyX09LKSB7CisgICAgICAgICAgICByZXR1cm4gZXJyOworICAgICAgICB9CisgICAgICAgIGZvciAoRmlsdGVyV3JhcHBlcjo6Q29tcG9uZW50ICZmaWx0ZXIgOiBmaWx0ZXJzKSB7CisgICAgICAgICAgICBjMl9zdGF0dXNfdCBlcnIgPSBmaWx0ZXIuY29tcC0+c3RhcnQoKTsKKyAgICAgICAgICAgIGlmIChlcnIgIT0gQzJfT0spIHsKKyAgICAgICAgICAgICAgICAvLyBQcmV2aW91cyBjb21wb25lbnRzIGFyZSBhbHJlYWR5IHN0YXJ0ZWQgc3VjY2Vzc2Z1bGx5OworICAgICAgICAgICAgICAgIC8vIHdlIGVuZGVkIHVwIGluIGFuIGluY29oZXJlbnQgc3RhdGUuCisgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0NPUlJVUFRFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBtUnVubmluZ0ZpbHRlcnMgPSBzdGQ6Om1vdmUoZmlsdGVycyk7CisgICAgICAgIHJldHVybiBDMl9PSzsKKyAgICB9CisKKyAgICBjMl9zdGF0dXNfdCBzdG9wKCkgb3ZlcnJpZGUgeworICAgICAgICBjMl9zdGF0dXNfdCBlcnIgPSBtQ29tcC0+c3RvcCgpOworICAgICAgICBpZiAoZXJyICE9IEMyX09LKSB7CisgICAgICAgICAgICByZXR1cm4gZXJyOworICAgICAgICB9CisgICAgICAgIGZvciAoRmlsdGVyV3JhcHBlcjo6Q29tcG9uZW50IGZpbHRlciA6IG1SdW5uaW5nRmlsdGVycykgeworICAgICAgICAgICAgYzJfc3RhdHVzX3QgZXJyID0gZmlsdGVyLmNvbXAtPnN0b3AoKTsKKyAgICAgICAgICAgIGlmIChlcnIgIT0gQzJfT0spIHsKKyAgICAgICAgICAgICAgICAvLyBQcmV2aW91cyBjb21wb25lbnRzIGFyZSBhbHJlYWR5IHN0b3BwZWQgc3VjY2Vzc2Z1bGx5OworICAgICAgICAgICAgICAgIC8vIHdlIGVuZGVkIHVwIGluIGFuIGluY29oZXJlbnQgc3RhdGUuCisgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0NPUlJVUFRFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBtUnVubmluZ0ZpbHRlcnMuY2xlYXIoKTsKKyAgICAgICAgcmV0dXJuIEMyX09LOworICAgIH0KKworICAgIGMyX3N0YXR1c190IHJlc2V0KCkgb3ZlcnJpZGUgeworICAgICAgICBjMl9zdGF0dXNfdCByZXN1bHQgPSBtQ29tcC0+cmVzZXQoKTsKKyAgICAgICAgaWYgKHJlc3VsdCAhPSBDMl9PSykgeworICAgICAgICAgICAgcmVzdWx0ID0gQzJfQ09SUlVQVEVEOworICAgICAgICB9CisgICAgICAgIGZvciAoRmlsdGVyV3JhcHBlcjo6Q29tcG9uZW50IGZpbHRlciA6IG1GaWx0ZXJzKSB7CisgICAgICAgICAgICBjMl9zdGF0dXNfdCBlcnIgPSBmaWx0ZXIuY29tcC0+cmVzZXQoKTsKKyAgICAgICAgICAgIGlmIChlcnIgIT0gQzJfT0spIHsKKyAgICAgICAgICAgICAgICAvLyBQcmV2aW91cyBjb21wb25lbnRzIGFyZSBhbHJlYWR5IHJlc2V0IHN1Y2Nlc3NmdWxseTsKKyAgICAgICAgICAgICAgICAvLyB3ZSBlbmRlZCB1cCBpbiBhbiBpbmNvaGVyZW50IHN0YXRlLgorICAgICAgICAgICAgICAgIHJlc3VsdCA9IEMyX0NPUlJVUFRFRDsKKyAgICAgICAgICAgICAgICAvLyBjb250aW51ZSBmb3IgdGhlIHJlc3Qgb2YgdGhlIGNoYWluCisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbVJ1bm5pbmdGaWx0ZXJzLmNsZWFyKCk7CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorCisgICAgYzJfc3RhdHVzX3QgcmVsZWFzZSgpIG92ZXJyaWRlIHsKKyAgICAgICAgYzJfc3RhdHVzX3QgcmVzdWx0ID0gbUNvbXAtPnJlbGVhc2UoKTsKKyAgICAgICAgaWYgKHJlc3VsdCAhPSBDMl9PSykgeworICAgICAgICAgICAgcmVzdWx0ID0gQzJfQ09SUlVQVEVEOworICAgICAgICB9CisgICAgICAgIGZvciAoRmlsdGVyV3JhcHBlcjo6Q29tcG9uZW50IGZpbHRlciA6IG1GaWx0ZXJzKSB7CisgICAgICAgICAgICBjMl9zdGF0dXNfdCBlcnIgPSBmaWx0ZXIuY29tcC0+cmVsZWFzZSgpOworICAgICAgICAgICAgaWYgKGVyciAhPSBDMl9PSykgeworICAgICAgICAgICAgICAgIC8vIFByZXZpb3VzIGNvbXBvbmVudHMgYXJlIGFscmVhZHkgcmVsZWFzZWQgc3VjY2Vzc2Z1bGx5OworICAgICAgICAgICAgICAgIC8vIHdlIGVuZGVkIHVwIGluIGFuIGluY29oZXJlbnQgc3RhdGUuCisgICAgICAgICAgICAgICAgcmVzdWx0ID0gQzJfQ09SUlVQVEVEOworICAgICAgICAgICAgICAgIC8vIGNvbnRpbnVlIGZvciB0aGUgcmVzdCBvZiB0aGUgY2hhaW4KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBtUnVubmluZ0ZpbHRlcnMuY2xlYXIoKTsKKyAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICB9CisKK3ByaXZhdGU6CisgICAgY2xhc3MgUGFzc2luZ0xpc3RlbmVyIDogcHVibGljIExpc3RlbmVyIHsKKyAgICBwdWJsaWM6CisgICAgICAgIFBhc3NpbmdMaXN0ZW5lcigKKyAgICAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJDb21wb25lbnQ+IHdyYXBwZWRDb21wb25lbnQsCisgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzaGFyZWRfcHRyPExpc3RlbmVyPiAmd3JhcHBlZENvbXBvbmVudExpc3RlbmVyLAorICAgICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMkNvbXBvbmVudD4gbmV4dENvbXBvbmVudCkKKyAgICAgICAgICAgIDogbVdyYXBwZWRDb21wb25lbnQod3JhcHBlZENvbXBvbmVudCksCisgICAgICAgICAgICAgIG1XcmFwcGVkQ29tcG9uZW50TGlzdGVuZXIod3JhcHBlZENvbXBvbmVudExpc3RlbmVyKSwKKyAgICAgICAgICAgICAgbU5leHRDb21wb25lbnQobmV4dENvbXBvbmVudCkgeworICAgICAgICB9CisKKyAgICAgICAgdm9pZCBvbldvcmtEb25lX25iKAorICAgICAgICAgICAgICAgIHN0ZDo6d2Vha19wdHI8QzJDb21wb25lbnQ+LAorICAgICAgICAgICAgICAgIHN0ZDo6bGlzdDxzdGQ6OnVuaXF1ZV9wdHI8QzJXb3JrPj4gd29ya0l0ZW1zKSBvdmVycmlkZSB7CisgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJDb21wb25lbnQ+IG5leHRDb21wb25lbnQgPSBtTmV4dENvbXBvbmVudC5sb2NrKCk7CisgICAgICAgICAgICBzdGQ6Omxpc3Q8c3RkOjp1bmlxdWVfcHRyPEMyV29yaz4+IGZhaWxlZFdvcmtJdGVtczsKKyAgICAgICAgICAgIGlmICghbmV4dENvbXBvbmVudCkgeworICAgICAgICAgICAgICAgIGZvciAoc3RkOjp1bmlxdWVfcHRyPEMyV29yaz4gJndvcmsgOiB3b3JrSXRlbXMpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gTmV4dCBjb21wb25lbnQgdW5leHBlY3RlZGx5IHJlbGVhc2VkIHdoaWxlIHRoZSB3b3JrIGlzCisgICAgICAgICAgICAgICAgICAgIC8vIGluLWZsaWdodC4gUmVwb3J0IEMyX0NPUlJVUFRFRCB0byB0aGUgY2xpZW50LgorICAgICAgICAgICAgICAgICAgICB3b3JrLT5yZXN1bHQgPSBDMl9DT1JSVVBURUQ7CisgICAgICAgICAgICAgICAgICAgIGZhaWxlZFdvcmtJdGVtcy5wdXNoX2JhY2soc3RkOjptb3ZlKHdvcmspKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgd29ya0l0ZW1zLmNsZWFyKCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGZvciAoYXV0byBpdCA9IHdvcmtJdGVtcy5iZWdpbigpOyBpdCAhPSB3b3JrSXRlbXMuZW5kKCk7ICkgeworICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnVuaXF1ZV9wdHI8QzJXb3JrPiAmd29yayA9ICppdDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHdvcmstPnJlc3VsdCAhPSBDMl9PSworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IHdvcmstPndvcmtsZXRzLnNpemUoKSAhPSAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmYWlsZWRXb3JrSXRlbXMucHVzaF9iYWNrKHN0ZDo6bW92ZSgqaXQpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGl0ID0gd29ya0l0ZW1zLmVyYXNlKGl0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIEMyRnJhbWVEYXRhICZvdXRwdXQgPSB3b3JrLT53b3JrbGV0cy5mcm9udCgpLT5vdXRwdXQ7CisgICAgICAgICAgICAgICAgICAgIGMyX2NudHI2NF90IGN1c3RvbU9yZGluYWwgPSB3b3JrLT5pbnB1dC5vcmRpbmFsLmN1c3RvbU9yZGluYWw7CisgICAgICAgICAgICAgICAgICAgIHdvcmstPmlucHV0ID0gc3RkOjptb3ZlKG91dHB1dCk7CisgICAgICAgICAgICAgICAgICAgIHdvcmstPmlucHV0Lm9yZGluYWwuY3VzdG9tT3JkaW5hbCA9IGN1c3RvbU9yZGluYWw7CisgICAgICAgICAgICAgICAgICAgIG91dHB1dC5mbGFncyA9IEMyRnJhbWVEYXRhOjpmbGFnc190KDApOworICAgICAgICAgICAgICAgICAgICBvdXRwdXQuYnVmZmVycy5jbGVhcigpOworICAgICAgICAgICAgICAgICAgICBvdXRwdXQuY29uZmlnVXBkYXRlLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgIG91dHB1dC5pbmZvQnVmZmVycy5jbGVhcigpOworICAgICAgICAgICAgICAgICAgICArK2l0OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICghZmFpbGVkV29ya0l0ZW1zLmVtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IHN0ZDo6dW5pcXVlX3B0cjxDMldvcms+ICZ3b3JrIDogZmFpbGVkV29ya0l0ZW1zKSB7CisgICAgICAgICAgICAgICAgICAgIExPRyhWRVJCT1NFKSA8PCAid29yayAjIiA8PCB3b3JrLT5pbnB1dC5vcmRpbmFsLmZyYW1lSW5kZXgucGVlaygpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBmYWlsZWQ6IGVycj0iIDw8IHdvcmstPnJlc3VsdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgd29ya2xldHMuc2l6ZSgpPSIgPDwgd29yay0+d29ya2xldHMuc2l6ZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoc3RkOjpzaGFyZWRfcHRyPExpc3RlbmVyPiB3cmFwcGVkQ29tcG9uZW50TGlzdGVuZXIgPQorICAgICAgICAgICAgICAgICAgICAgICAgbVdyYXBwZWRDb21wb25lbnRMaXN0ZW5lci5sb2NrKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgd3JhcHBlZENvbXBvbmVudExpc3RlbmVyLT5vbldvcmtEb25lX25iKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XcmFwcGVkQ29tcG9uZW50LCBzdGQ6Om1vdmUoZmFpbGVkV29ya0l0ZW1zKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCF3b3JrSXRlbXMuZW1wdHkoKSkgeworICAgICAgICAgICAgICAgIG5leHRDb21wb25lbnQtPnF1ZXVlX25iKCZ3b3JrSXRlbXMpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdm9pZCBvblRyaXBwZWRfbmIoCisgICAgICAgICAgICAgICAgc3RkOjp3ZWFrX3B0cjxDMkNvbXBvbmVudD4sCisgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjpzaGFyZWRfcHRyPEMyU2V0dGluZ1Jlc3VsdD4+KSBvdmVycmlkZSB7CisgICAgICAgICAgICAvLyBUcmlwIG5vdCBzdXBwb3J0ZWQKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgb25FcnJvcl9uYihzdGQ6OndlYWtfcHRyPEMyQ29tcG9uZW50PiwgdWludDMyX3QgZXJyb3JDb2RlKSB7CisgICAgICAgICAgICBpZiAoc3RkOjpzaGFyZWRfcHRyPExpc3RlbmVyPiB3cmFwcGVkQ29tcG9uZW50TGlzdGVuZXIgPQorICAgICAgICAgICAgICAgICAgICBtV3JhcHBlZENvbXBvbmVudExpc3RlbmVyLmxvY2soKSkgeworICAgICAgICAgICAgICAgIHdyYXBwZWRDb21wb25lbnRMaXN0ZW5lci0+b25FcnJvcl9uYihtV3JhcHBlZENvbXBvbmVudCwgZXJyb3JDb2RlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgcHJpdmF0ZToKKyAgICAgICAgc3RkOjp3ZWFrX3B0cjxDMkNvbXBvbmVudD4gbVdyYXBwZWRDb21wb25lbnQ7CisgICAgICAgIHN0ZDo6d2Vha19wdHI8TGlzdGVuZXI+IG1XcmFwcGVkQ29tcG9uZW50TGlzdGVuZXI7CisgICAgICAgIHN0ZDo6d2Vha19wdHI8QzJDb21wb25lbnQ+IG1OZXh0Q29tcG9uZW50OworICAgIH07CisKKyAgICBjbGFzcyBMYXN0TGlzdGVuZXIgOiBwdWJsaWMgTGlzdGVuZXIgeworICAgIHB1YmxpYzoKKyAgICAgICAgTGFzdExpc3RlbmVyKAorICAgICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMkNvbXBvbmVudD4gd3JhcHBlZENvbXBvbmVudCwKKyAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8TGlzdGVuZXI+ICZ3cmFwcGVkQ29tcG9uZW50TGlzdGVuZXIpCisgICAgICAgICAgICA6IG1XcmFwcGVkQ29tcG9uZW50KHdyYXBwZWRDb21wb25lbnQpLAorICAgICAgICAgICAgICBtV3JhcHBlZENvbXBvbmVudExpc3RlbmVyKHdyYXBwZWRDb21wb25lbnRMaXN0ZW5lcikgeworICAgICAgICB9CisKKyAgICAgICAgdm9pZCBvbldvcmtEb25lX25iKAorICAgICAgICAgICAgICAgIHN0ZDo6d2Vha19wdHI8QzJDb21wb25lbnQ+LAorICAgICAgICAgICAgICAgIHN0ZDo6bGlzdDxzdGQ6OnVuaXF1ZV9wdHI8QzJXb3JrPj4gd29ya0l0ZW1zKSBvdmVycmlkZSB7CisgICAgICAgICAgICBpZiAobVdyYXBwZWRDb21wb25lbnQuZXhwaXJlZCgpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHN0ZDo6c2hhcmVkX3B0cjxMaXN0ZW5lcj4gd3JhcHBlZENvbXBvbmVudExpc3RlbmVyID0KKyAgICAgICAgICAgICAgICAgICAgbVdyYXBwZWRDb21wb25lbnRMaXN0ZW5lci5sb2NrKCkpIHsKKyAgICAgICAgICAgICAgICB3cmFwcGVkQ29tcG9uZW50TGlzdGVuZXItPm9uV29ya0RvbmVfbmIoCisgICAgICAgICAgICAgICAgICAgICAgICBtV3JhcHBlZENvbXBvbmVudCwgc3RkOjptb3ZlKHdvcmtJdGVtcykpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdm9pZCBvblRyaXBwZWRfbmIoCisgICAgICAgICAgICAgICAgc3RkOjp3ZWFrX3B0cjxDMkNvbXBvbmVudD4sCisgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjpzaGFyZWRfcHRyPEMyU2V0dGluZ1Jlc3VsdD4+KSBvdmVycmlkZSB7CisgICAgICAgICAgICAvLyBUcmlwIG5vdCBzdXBwb3J0ZWQKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgb25FcnJvcl9uYihzdGQ6OndlYWtfcHRyPEMyQ29tcG9uZW50PiwgdWludDMyX3QgZXJyb3JDb2RlKSB7CisgICAgICAgICAgICBpZiAobVdyYXBwZWRDb21wb25lbnQuZXhwaXJlZCgpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHN0ZDo6c2hhcmVkX3B0cjxMaXN0ZW5lcj4gd3JhcH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+ICZmaWx0ZXJzLAorICAgICAgICAgICAgY29uc3Qgc3RkOjpzaGFyZWRfcHRyPExpc3RlbmVyPiAmbGlzdGVuZXIsCisgICAgICAgICAgICBjMl9ibG9ja2luZ190IG1heUJsb2NrKSB7CisgICAgICAgIGlmIChmaWx0ZXJzLmVtcHR5KCkpIHsKKyAgICAgICAgICAgIHJldHVybiBtQ29tcC0+c2V0TGlzdGVuZXJfdmIobGlzdGVuZXIsIG1heUJsb2NrKTsKKyAgICAgICAgfQorICAgICAgICBzdGQ6OnNoYXJlZF9wdHIgcGFzc2luZ0xpc3RlbmVyID0gc3RkOjptYWtlX3NoYXJlZDxQYXNzaW5nTGlzdGVuZXI+KAorICAgICAgICAgICAgICAgIHNoYXJlZF9mcm9tX3RoaXMoKSwKKyAgICAgICAgICAgICAgICBsaXN0ZW5lciwKKyAgICAgICAgICAgICAgICBmaWx0ZXJzLmZyb250KCkuY29tcCk7CisgICAgICAgIG1Db21wLT5zZXRMaXN0ZW5lcl92YihwYXNzaW5nTGlzdGVuZXIsIG1heUJsb2NrKTsKKyAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBmaWx0ZXJzLnNpemUoKSAtIDE7ICsraSkgeworICAgICAgICAgICAgZmlsdGVyc1tpXS5jb21wLT5zZXRMaXN0ZW5lcl92YigKKyAgICAgICAgICAgICAgICAgICAgc3RkOjptYWtlX3NoYXJlZDxQYXNzaW5nTGlzdGVuZXI+KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlZF9mcm9tX3RoaXMoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWx0ZXJzW2kgKyAxXS5jb21wKSwKKyAgICAgICAgICAgICAgICAgICAgbWF5QmxvY2spOworICAgICAgICB9CisgICAgICAgIGZpbHRlcnMuYmFjaygpLmNvbXAtPnNldExpc3RlbmVyX3ZiKAorICAgICAgICAgICAgICAgIHN0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6OlRyYWl0cz4gJmIpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYS0+cmFuayA8IGItPnJhbms7CisgICAgICAgICAgICB9KTsKKyAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHRyYWl0cy5zaXplKCk7ICsraSkgeworICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8Y29uc3QgQzJDb21wb25lbnQ6OlRyYWl0cz4gJnRyYWl0ID0gdHJhaXRzW2ldOworICAgICAgICBpZiAodHJhaXQtPmRvbWFpbiA9PSBDMkNvbXBvbmVudDo6RE9NQUlOX09USEVSCisgICAgICAgICAgICAgICAgfHwgdHJhaXQtPmRvbWFpbiA9PSBDMkNvbXBvbmVudDo6RE9NQUlOX0FVRElPCisgICAgICAgICAgICAgICAgfHwgdHJhaXQtPmtpbmQgIT0gQzJDb21wb25lbnQ6OktJTkRfT1RIRVIpIHsKKyAgICAgICAgICAgIExPRyhERUJVRykgPDwgdHJhaXQtPm5hbWUgPDwgIiBpcyBpZ25vcmVkIGJlY2F1c2Ugb2YgZG9tYWluL2tpbmQ6ICIKKyAgICAgICAgICAgICAgICA8PCB0cmFpdC0+ZG9tYWluIDw8ICIvIiA8PCB0cmFpdC0+a2luZDsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIERlc2NyaXB0b3IgZGVzYzsKKyAgICAgICAgaWYgKCFtUGx1Z2luLT5kZXNjcmliZSh0cmFpdC0+bmFtZSwgJmRlc2MpKSB7CisgICAgICAgICAgICBMT0coREVCVUcpIDw8IHRyYWl0LT5uYW1lIDw8ICIgaXMgaWdub3JlZCBiZWNhdXNlIGRlc2NyaWJlKCkgZmFpbGVkIjsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIG1Db21wb25lbnRzLnB1c2hfYmFjayh7bnVsbHB0ciwgbnVsbHB0ciwgKnRyYWl0LCBkZXNjfSk7CisgICAgfQorICAgIGlmIChtQ29tcG9uZW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5pcXVlX2xvY2sgbG9jayhtQ2FjaGVNdXRleCk7CisgICAgICAgIGlmIChtQ2FjaGVkVHJhaXRzLmNvdW50KGludGYtPmdldE5hbWUoKSkpIHsKKyAgICAgICAgICAgIHJldHVybiBtQ2FjaGVkVHJhaXRzLmF0KGludGYtPmdldE5hbWUoKSk7CisgICAgICAgIH0KKyAgICB9CisgICAgQzJDb21wb25lbnREb21haW5TZXR0aW5nIGRvbWFpbjsKKyAgICBDMkNvbXBvbmVudEtpbmRTZXR0aW5nIGtpbmQ7CisgICAgYzJfc3RhdHVzX3QgZXJyID0gaW50Zi0+cXVlcnlfdmIoeyZkb21haW4sICZraW5kfSwge30sIEMyX01BWV9CTE9DSywgbnVsbHB0cik7CisgICAgQzJDb21wb25lbnQ6OlRyYWl0cyB0cmFpdHMgPSB7CisgICAgICAgICJxdWVyeSBmYWlsZWQiLCAgLy8gbmFtZQorICAgICAgICBDMkNvbXBvbmVudDo6RE9NQUlOX09USEVSLAorICAgICAgICBDMkNvbXBvbmVudDo6S0lORF9PVEhFUiwKKyAgICAgICAgMCwgICAvLyByYW5rLCB1bnVzZWQKKyAgICAgICAgIiIsICAvLyBtZWRpYSB0eXBlLCB1bnVzZWQKKyAgICAgICAgIiIsICAvLyBvd25lciwgdW51c2VkCisgICAgICAgIHt9LCAgLy8gYWxpYXNlcywgdW51c2VkCisgICAgfTsKKyAgICBpZiAoZXJyID09IEMyX09LKSB7CisgICAgICAgIHRyYWl0cyA9IHsKKyAgICAgICAgICAgIGludGYtPmdldE5hbWUoKSwKKyAgICAgICAgICAgIGRvbWFpbi52YWx1ZSwKKyAgICAgICAgICAgIGtpbmQudmFsdWUsCisgICAgICAgICAgICAwLCAgIC8vIHJhbmssIHVudXNlZAorICAgICAgICAgICAgIiIsICAvLyBtZWRpYSB0eXBlLCB1bnVzZWQKKyAgICAgICAgICAgICIiLCAgLy8gb3duZXIsIHVudXNlZAorICAgICAgICAgICAge30sICAvLyBhbGlhc2VzLCB1bnVzZWQK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yQ29tcG9uZW50PiBjb21wID0gaXQtPmZyb250KCkubG9jaygpOworICAgICAgICBpZiAoIWNvbXApIHsKKyAgICAgICAgICAgIGl0ID0gbVdyYXBwZWRDb21wb25lbnRzLmVyYXNlKGl0KTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGlmIChjb21wb25lbnQgPT0gY29tcCkgeworICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjpzaGFyZWRfcHRyPGNvbnN0IEMyQ29tcG9uZW50Pj4gY29tcG9uZW50cyhpdC0+c2l6ZSgpKTsKKyAgICAgICAgICAgIHN0ZDo6dHJhbnNmb3JtKAorICAgICAgICAgICAgICAgICAgICBpdC0+YmVnaW4oKSwgaXQtPmVuZCgpLCBjb21wb25lbnRzLmJlZ2luKCksCisgICAgICAgICAgICAgICAgICAgIFtdKGNvbnN0IHN0ZDo6d2Vha19wdHI8Y29uc3QgQzJDb21wb25lbnQ+ICZlbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVsLmxvY2soKTsKKyAgICAgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICBpZiAoQzJfT0sgPT0gQ3JlYXRlQ29kZWMyQmxvY2tQb29sKGFsbG9jYXRvcklkLCBjb21wb25lbnRzLCBwb29sKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBDMl9PSzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICArK2l0OworICAgIH0KKyAgICByZXR1cm4gQ3JlYXRlQ29kZWMyQmxvY2tQb29sKGFsbG9jYXRvcklkLCBjb21wb25lbnQsIHBvb2wpOworfQorCitjMl9zdGF0dXNfdCBGaWx0ZXJXcmFwcGVyOjpxdWVyeVBhcmFtc0ZvclByZXZpb3VzQ29tcG9uZW50KAorICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8QzJDb21wb25lbnRJbnRlcmZhY2U+ICZpbnRmLAorICAgICAgICBzdGQ6OnZlY3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CIsCisgICAgXSwKKworICAgIGRlZmF1bHRzOiBbCisgICAgICAgICJsaWJjb2RlYzItaW1wbC1kZWZhdWx0cyIsCisgICAgXSwKKworICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJjb2RlYzJfaGlkbF9wbHVnaW5faGVhZGVycyIsCisgICAgICAgICJsaWJndWlfaGVhZGVycyIsCisgICAgXSwKKworICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJFR0wiLAorICAgICAgICAibGliR0xFU3YxX0NNIiwKKyAgICAgICAgImxpYkdMRVN2MiIsCisgICAgICAgICJsaWJHTEVTdjMiLAorICAgICAgICAibGliYmFzZSIsCisgICAgICAgICJsaWJjb2RlYzIiLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICAgICAgImxpYnByb2Nlc3Nncm91cCIsCisgICAgICAgICJsaWJzZnBsdWdpbl9jY29kZWNfdXRpbHMiLAorICAgICAgICAibGlic3luYyIsCisgICAgICAgICJsaWJ1aSIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJyZW5kZXJmcmlnaHQiLAorICAgIF0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1XZXJyb3IiLAorICAgICAgICAiLVdhbGwiLAorICAgIF0sCit9CisKK2NjX2xpYnJhcnkgeworICAgIG5hbWU6ICJzYW1wbGUtY29kZWMyLWhpZGwtcGx1Z2luIiwKKyAgICB2ZW5kb3I6IHRydWUsCisKKyAgICBkZWZhdWx0czogWworICAgICAgICAic2FtcGxlLWNvZGVjMi1oaWRsLXBsdWdpbi1kZWZhdWx0cyIsCisgICAgXSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL2NvZGVjMi9oaWRsL3BsdWdpbi9zYW1wbGVzL1NhbXBsZUZpbHRlclBsdWdpbi5jcHAgYi9tZWRpYS9jb2RlYzIvaGlkbC9wbHVnaW4vc2FtcGxlcy9TYW1wbGVGaWx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gICAgIH0KKyAgICAgICAgYzJfc3RhdHVzX3QgY3JlYXRlVHVubmVsX3NtKGMyX25vZGVfaWRfdCkgb3ZlcnJpZGUgeyByZXR1cm4gQzJfT01JVFRFRDsgfQorICAgICAgICBjMl9zdGF0dXNfdCByZWxlYXNlVHVubmVsX3NtKGMyX25vZGVfaWRfdCkgb3ZlcnJpZGUgeyByZXR1cm4gQzJfT01JVFRFRDsgfQorCisgICAgICAgIHVpbnQzMl90IGdldERhdGFTcGFjZSgpIHsKKyAgICAgICAgICAgIEhlbHBlcjo6TG9jayBsb2NrID0gbUhlbHBlci5sb2NrKCk7CisgICAgICAgICAgICB1aW50MzJfdCBkYXRhc3BhY2UgPSBIQUxfREFUQVNQQUNFX1VOS05PV047CisgICAgICAgICAgICBDMk1hcHBlcjo6bWFwKAorICAgICAgICAgICAgICAgICAgICBtSGVscGVyLm1JbnB1dENvbG9yQXNwZWN0SW5mby0+cmFuZ2UsCisgICAgICAgICAgICAgICAgICAgIG1IZWxwZXIubUlucHV0Q29sb3JBc3BlY3RJbmZvLT5wcmltYXJpZXMsCisgICAgICAgICAgICAgICAgICAgIG1IZWxwZXIubUlucHV0Q29sb3JBc3BlY3RJbmZvLT5tYXRyaXgsCisgICAgICAgICAgICAgICAgICAgIG1IZWxwZXIubUlucHV0Q29sb3JBc3BlY3RJbmZvLT50cmFuc2ZlciwKKyAgICAgICAgICAgICAgICAgICAgJmRhdGFzcGFjZSk7CisgICAgICAgICAgICByZXR1cm4gZGF0YXNwYWNlOworICAgICAgICB9CisgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMlN0cmVhbUhkclN0YXRpY0luZm86OmlucHV0PiBnZXRIZHJTdGF0aWNNZXRhZGF0YSgpIHsKKyAgICAgICAgICAgIEhlbHBlcjo6TG9jayBsb2NrID0gbUhlbHBlci5sb2NrKCk7CisgICAgICAgICAgICByZXR1cm4gbUhlbHBlci5tSW5wdXRIZHJTdGF0aWNJbmZvOworICAgICAgICB9CisgICAgICAg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tZXRlcigKKyAgICAgICAgICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1BcGlGZWF0dXJlcywgQzJfUEFSQU1LRVlfQVBJX0ZFQVRVUkVTKQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhDb25zdFZhbHVlKG5ldyBDMkFwaUZlYXR1cmVzU2V0dGluZyhDMkNvbmZpZzo6YXBpX2ZlYXR1cmVfdCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVBJX1JFRkxFQ1RJT04gfAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBUElfVkFMVUVTIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVBJX0NVUlJFTlRfVkFMVUVTIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVBJX0RFUEVOREVOQ1kgfAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBUElfU0FNRV9JTlBVVF9CVUZGRVIpKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICAgICAgICAgIG1OYW1lID0gQzJDb21wb25lbnROYW1lU2V0dGluZzo6QWxsb2NTaGFyZWQoTkFNRS5zaXplKCkgKyAxKTsKKyAgICAgICAgICAgICAgICBzdHJuY3B5KG1OYW1lLT5tLnZhbHVlLCBOQU1FLmNfc3RyKCksIE5BTUUuc2l6ZSgpICsgMSk7CisgICAgICAgICAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgRGVmaW5lUGFyYW0obU5hbWUsIEMyX1BBUkFNS0VZX0NPTVBPTkVOVF9OQU1FKQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhDb25zdFZhbHVlKG1OYW1lKQorICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCkpOworCisgICAgICAgICAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgRGVmaW5lUGFyYW0obUtpbmQsIEMyX1BBUkFNS0VZX0NPTVBPTkVOVF9LSU5EKQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhDb25zdFZhbHVlKG5ldyBDMkNvbXBvbmVudEtpbmRTZXR0aW5nKEMyQ29tcG9uZW50OjpLSU5EX09USEVSKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICAgICAgICAgIGFkZFBhcmFtZXRlcigKKyAgICAgICAgICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1Eb21haW4sIEMyX1BBUkFNS0VZX0NPTVBPTkVOVF9ET01BSU4pCisgICAgICAgICAgICAgICAgICAgICAgICAud2l0aENvbnN0VmFsdWUobmV3IEMyQ29tcG9uZW50RG9tYWluU2V0dGluZyhDMkNvbXBvbmVudDo6RE9NQUlOX1ZJREVPKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICAgICAgICAgIGFkZFBhcmFtZXRlcigKKyAgICAgICAgICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1JbnB1dFN0cmVhbUNvdW50LCBDMl9QQVJBTUtFWV9JTlBVVF9TVFJFQU1fQ09VTlQpCisgICAgICAgICAgICAgICAgICAgICAgICAud2l0aENvbnN0VmFsdWUobmV3IEMyUG9ydFN0cmVhbUNvdW50VHVuaW5nOjppbnB1dCgxKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICAgICAgICAgIGFkZFBhcmFtZXRlcigKKyAgICAgICAgICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1PdXRwdXRTdHJlYW1Db3VudCwgQzJfUEFSQU1LRVlfT1VUUFVUX1NUUkVBTV9DT1VOVCkKKyAgICAgICAgICAgICAgICAgICAgICAgIC53aXRoQ29uc3RWYWx1ZShuZXcgQzJQb3J0U3RyZWFtQ291bnRUdW5pbmc6Om91dHB1dCgxKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICAgICAgICAgIGFkZFBhcmFtZXRlcigKKyAgICAgICAgICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1JbnB1dEZvcm1hdCwgQzJfUEFSQU1LRVlfSU5QVVRfU1RSRUFNX0JVRkZFUl9UWVBFKQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhDb25zdFZhbHVlKG5ldyBDMlN0cmVhbUJ1ZmZlclR5cGVTZXR0aW5nOjppbnB1dCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHUsIEMyQnVmZmVyRGF0YTo6R1JBUEhJQykpCisgICAgICAgICAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CisKKyAgICAgICAgICAgICAgICBzdGF0aWMgY29uc3Qgc3RkOjpzdHJpbmcga1Jhd01lZGlhVHlwZSA9ICJ2aWRlby9yYXciOworICAgICAgICAgICAgICAgIG1JbnB1dE1lZGlhVHlwZSA9IEMyUG9ydE1lZGlhVHlwZVNldHRpbmc6OmlucHV0OjpBbGxvY1NoYXJlZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIGtSYXdNZWRpYVR5cGUuc2l6ZSgpICsgMSk7CisgICAgICAgICAgICAgICAgc3RybmNweShtSW5wdXRNZWRpYVR5cGUtPm0udmFsdWUsIGtSYXdNZWRpYVR5cGUuY19zdHIoKSwga1Jhd01lZGlhVHlwZS5zaXplKCkgKyAxKTsKKyAgICAgICAgICAgICAgICBhZGRQYXJhbWV0ZXIoCisgICAgICAgICAgICAgICAgICAgICAgICBEZWZpbmVQYXJhbShtSW5wdXRNZWRpYVR5cGUsIEMyX1BBUkFNS0VZX0lOUFVUX01FRElBX1RZUEUpCisgICAgICAgICAgICAgICAgICAgICAgICAud2l0aENvbnN0VmFsdWUobUlucHV0TWVkaWFUeXBlKQorICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCkpOworCisgICAgICAgICAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgRGVmaW5lUGFyYW0obU91dHB1dEZvcm1hdCwgQzJfUEFSQU1LRVlfT1VUUFVUX1NUUkVBTV9CVUZGRVJfVFlQRSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC53aXRoQ29uc3RWYWx1ZShuZXcgQzJTdHJlYW1CdWZmZXJUeXBlU2V0dGluZzo6b3V0cHV0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwdSwgQzJCdWZmZXJEYXRhOjpHUkFQSElDKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICAgICAgICAgIG1PdXRwdXRNZWRpYVR5cGUgPSBDMlBvcnRNZWRpYVR5cGVTZXR0aW5nOjpvdXRwdXQ6OkFsbG9jU2hhcmVkKAorICAgICAgICAgICAgICAgICAgICAgICAga1Jhd01lZGlhVHlwZS5zaXplKCkgKyAxKTsKKyAgICAgICAgICAgICAgICBzdHJuY3B5KG1PdXRwdXRNZWRpYVR5cGUtPm0udmFsdWUsIGtSYXdNZWRpYVR5cGUuY19zdHIoKSwga1Jhd01lZGlhVHlwZS5zaXplKCkgKyAxKTsKKyAgICAgICAgICAgICAgICBhZGRQYXJhbWV0ZXIoCisgICAgICAgICAgICAgICAgICAgICAgICBEZWZpbmVQYXJhbShtT3V0cHV0TWVkaWFUeXBlLCBDMl9QQVJBTUtFWV9PVVRQVVRfTUVESUFfVFlQRSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC53aXRoQ29uc3RWYWx1ZShtT3V0cHV0TWVkaWFUeXBlKQorICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCkpOworCisgICAgICAgICAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgRGVmaW5lUGFyYW0obUFjdHVhbElucHV0RGVsYXksIEMyX1BBUkFNS0VZX0lOUFVUX0RFTEFZKQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhDb25zdFZhbHVlKG5ldyBDMlBvcnRBY3R1YWxEZWxheVR1bmluZzo6aW5wdXQoMHUpKQorICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCkpOworCisgICAgICAgICAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgRGVmaW5lUGFyYW0obUFjdHVhbE91dHB1dERlbGF5LCBDMl9QQVJBTUtFWV9PVVRQVVRfREVMQVkpCisgICAgICAgICAgICAgICAgICAgICAgICAud2l0aENvbnN0VmFsdWUobmV3IEMyUG9ydEFjdHVhbERlbGF5VHVuaW5nOjpvdXRwdXQoMHUpKQorICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCkpOworCisgICAgICAgICAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgRGVmaW5lUGFyYW0obUFjdHVhbFBpcGVsaW5lRGVsYXksIEMyX1BBUkFNS0VZX1BJUEVMSU5FX0RFTEFZKQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhDb25zdFZhbHVlKG5ldyBDMkFjdHVhbFBpcGVsaW5lRGVsYXlUdW5pbmcoMHUpKQorICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCkpOworCisgICAgICAgICAgICAgICAgQzJCbG9ja1Bvb2w6OmxvY2FsX2lkX3Qgb3V0cHV0UG9vbElkc1sxXSA9IHsgQzJCbG9ja1Bvb2w6OkJBU0lDX0dSQVBISUMgfTsKKyAgICAgICAgICAgICAgICBhZGRQYXJhbWV0ZXIoCisgICAgICAgICAgICAgICAgICAgICAgICBEZWZpbmVQYXJhbShtT3V0cHV0UG9vbElkcywgQzJfUEFSQU1LRVlfT1VUUFVUX0JMT0NLX1BPT0xTKQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhEZWZhdWx0KEMyUG9ydEJsb2NrUG9vbHNUdW5pbmc6Om91dHB1dDo6QWxsb2NTaGFyZWQob3V0cHV0UG9vbElkcykpCisgICAgICAgICAgICAgICAgICAgICAgICAud2l0aEZpZWxkcyh7IEMyRihtT3V0cHV0UG9vbElkcywgbS52YWx1ZXNbMF0pLmFueSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkYobU91dHB1dFBvb2xJZHMsIG0udmFsdWVzKS5pblJhbmdlKDAsIDEpIH0pCisgICAgICAgICAgICAgICAgICAgICAgICAud2l0aFNldHRlcihPdXRwdXRCbG9ja1Bvb2xTZXR0ZXIpCisgICAgICAgICAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CisKKyAgICAgICAgICAgICAgICBhZGRQYXJhbWV0ZXIoCisgICAgICAgICAgICAgICAgICAgICAgICBEZWZpbmVQYXJhbShtSW5wdXRIZHJTdGF0aWNJbmZvLCBDMl9QQVJBTUtFWV9IRFJfU1RBVElDX0lORk8pCisgICAgICAgICAgICAgICAgICAgICAgICAud2l0aERlZmF1bHQobmV3IEMyU3RyZWFtSGRyU3RhdGljSW5mbzo6aW5wdXQoMHUpKQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhGaWVsZHMoeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyRihtSW5wdXRIZHJTdGF0aWNJbmZvLCBtYXN0ZXJpbmcucmVkLngpLmFueSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgfSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC53aXRoU2V0dGVyKEhkclN0YXRpY0luZm9TZXR0ZXIpCisgICAgICAgICAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CisKKyAgICAgICAgICAgICAgICBhZGRQYXJhbWV0ZXIoCisgICAgICAgICAgICAgICAgICAgICAgICBEZWZpbmVQYXJhbShtT3V0cHV0SGRyU3RhdGljSW5mbywgQzJfUEFSQU1LRVlfSERSX1NUQVRJQ19JTkZPKQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhDb25zdFZhbHVlKG5ldyBDMlN0cmVhbUhkclN0YXRpY0luZm86Om91dHB1dCgwdSkpCisgICAgICAgICAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CisKKyAgICAgICAgICAgICAgICBhZGRQYXJhbWV0ZXIoCisgICAgICAgICAgICAgICAgICAgICAgICBEZWZpbmVQYXJhbShtSW5wdXRDb2xvckFzcGVjdEluZm8sIEMyX1BBUkFNS0VZX0NPTE9SX0FTUEVDVFMpCisgICAgICAgICAgICAgICAgICAgICAgICAud2l0aERlZmF1bHQobmV3IEMyU3RyZWFtQ29sb3JBc3BlY3RzSW5mbzo6aW5wdXQoMHUpKQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhGaWVsZHMoeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyRihtSW5wdXRDb2xvckFzcGVjdEluZm8sIHJhbmdlKS5hbnkoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkYobUlucHV0Q29sb3JBc3BlY3RJbmZvLCBwcmltYXJpZXMpLmFueSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyRihtSW5wdXRDb2xvckFzcGVjdEluZm8sIHRyYW5zZmVyKS5hbnkoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkYobUlucHV0Q29sb3JBc3BlY3RJbmZvLCBtYXRyaXgpLmFueSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgfSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC53aXRoU2V0dGVyKElucHV0Q29sb3JBc3BlY3RzU2V0dGVyKQorICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCkpOworCisgICAgICAgICAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgRGVmaW5lUGFyYW0oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbG9yQXNwZWN0UmVxdWVzdEluZm8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHN0ZDo6c3RyaW5nKEMyX1BBUkFNS0VZX0NPTE9SX0FTUEVDVFMpICsgIi5yZXF1ZXN0IikuY19zdHIoKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC53aXRoRGVmYXVsdChuZXcgQzJTdHJlYW1Db2xvckFzcGVjdHNSZXF1ZXN0SW5mbzo6b3V0cHV0KDB1KSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC53aXRoRmllbGRzKHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkYobUNvbG9yQXNwZWN0UmVxdWVzdEluZm8sIHJhbmdlKS5hbnkoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkYobUNvbG9yQXNwZWN0UmVxdWVzdEluZm8sIHByaW1hcmllcykuYW55KCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJGKG1Db2xvckFzcGVjdFJlcXVlc3RJbmZvLCB0cmFuc2Zlcikub25lT2YoeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkNvbG9yOjpUUkFOU0ZFUl9VTlNQRUNJRklFRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJDb2xvcjo6VFJBTlNGRVJfMTcwTSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkYobUNvbG9yQXNwZWN0UmVxdWVzdEluZm8sIG1hdHJpeCkuYW55KCksCisgICAgICAgICAgICAgICAgICAgICAgICB9KQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhTZXR0ZXIoQ29sb3JBc3BlY3RzUmVxdWVzdFNldHRlcikKKyAgICAgICAgICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICAgICAgICAgIGFkZFBhcmFtZXRlcigKKyAgICAgICAgICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1PdXRwdXRDb2xvckFzcGVjdEluZm8sIEMyX1BBUkFNS0VZX0NPTE9SX0FTUEVDVFMpCisgICAgICAgICAgICAgICAgICAgICAgICAud2l0aERlZmF1bHQobmV3IEMyU3RyZWFtQ29sb3JBc3BlY3RzSW5mbzo6b3V0cHV0KDB1KSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC53aXRoRmllbGRzKHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMkYobU91dHB1dENvbG9yQXNwZWN0SW5mbywgcmFuZ2UpLmFueSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyRihtT3V0cHV0Q29sb3JBc3BlY3RJbmZvLCBwcmltYXJpZXMpLmFueSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyRihtT3V0cHV0Q29sb3JBc3BlY3RJbmZvLCB0cmFuc2ZlcikuYW55KCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJGKG1PdXRwdXRDb2xvckFzcGVjdEluZm8sIG1hdHJpeCkuYW55KCksCisgICAgICAgICAgICAgICAgICAgICAgICB9KQorICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhTZXR0ZXIoT3V0cHV0Q29sb3JBc3BlY3RzU2V0dGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUlucHV0Q29sb3JBc3BlY3RJbmZvLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbG9yQXNwZWN0UmVxdWVzdEluZm8pCisgICAgICAgICAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHN0YXRpYyBDMlIgT3V0cHV0QmxvY2tQb29sU2V0dGVyKAorICAgICAgICAgICAgICAgICAgICBib29sIG1heUJsb2NrLAorICAgICAgICAgICAgICAgICAgICBDMlA8QzJQb3J0QmxvY2tQb29sc1R1bmluZzo6b3V0cHV0PiAmbWUpIHsKKyAgICAgICAgICAgICAgICAodm9pZCltYXlCbG9jaywgKHZvaWQpbWU7CisgICAgICAgICAgICAgICAgcmV0dXJuIEMyUjo6T2soKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3RhdGljIEMyUiBIZHJTdGF0aWNJbmZvU2V0dGVyKAorICAgICAgICAgICAgICAgICAgICBib29sIG1heUJsb2NrLAorICAgICAgICAgICAgICAgICAgICBDMlA8QzJTdHJlYW1IZHJTdGF0aWNJbmZvOjppbnB1dD4gJm1lKSB7CisgICAgICAgICAgICAgICAgKHZvaWQpbWF5QmxvY2ssICh2b2lkKW1lOworICAgICAgICAgICAgICAgIHJldHVybiBDMlI6Ok9rKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHN0YXRpYyBDMlIgSW5wdXRDb2xvckFzcGVjdHNTZXR0ZXIoCisgICAgICAgICAgICAgICAgICAgIGJvb2wgbWF5QmxvY2ssCisgICAgICAgICAgICAgICAgICAgIEMyUDxDMlN0cmVhbUNvbG9yQXNwZWN0c0luZm86OmlucHV0PiAmbWUpIHsKKyAgICAgICAgICAgICAgICAodm9pZCltYXlCbG9jaywgKHZvaWQpbWU7CisgICAgICAgICAgICAgICAgcmV0dXJuIEMyUjo6T2soKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3RhdGljIEMyUiBPdXRwdXRDb2xvckFzcGVjdHNTZXR0ZXIoCisgICAgICAgICAgICAgICAgICAgIGJvb2wgbWF5QmxvY2ssCisgICAgICAgICAgICAgICAgICAgIEMyUDxDMlN0cmVhbUNvbG9yQXNwZWN0c0luZm86Om91dHB1dD4gJm1lLAorICAgICAgICAgICAgICAgICAgICBjb25zdCBDMlA8QzJTdHJlYW1Db2xvckFzcGVjdHNJbmZvOjppbnB1dD4gJmlucHV0Q29sb3IsCisgICAgICAgICAgICAgICAgICAgIGNvbnN0IEMyUDxDMlN0cmVhbUNvbG9yQXNwZWN0c1JlcXVlc3RJbmZvOjpvdXRwdXQ+ICZyZXF1ZXN0KSB7CisgICAgICAgICAgICAgICAgKHZvaWQpbWF5QmxvY2s7CisgICAgICAgICAgICAgICAgbWUuc2V0KCkucmFuZ2UgPSBpbnB1dENvbG9yLnYucmFuZ2U7CisgICAgICAgICAgICAgICAgbWUuc2V0KCkucHJpbWFyaWVzID0gaW5wdXRDb2xvci52LnByaW1hcmllczsKKyAgICAgICAgICAgICAgICBtZS5zZXQoKS50cmFuc2ZlciA9IGlucHV0Q29sb3Iudi50cmFuc2ZlcjsKKyAgICAgICAgICAgICAgICBpZiAocmVxdWVzdC52LnRyYW5zZmVyID09IEMyQ29sb3I6OlRSQU5TRkVSXzE3ME0pIHsKKyAgICAgICAgICAgICAgICAgICAgbWUuc2V0KCkudHJhbnNmZXIgPSBDMkNvbG9yOjpUUkFOU0ZFUl8xNzBNOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtZS5zZXQoKS5tYXRyaXggPSBpbnB1dENvbG9yLnYubWF0cml4OworICAgICAgICAgICAgICAgIHJldHVybiBDMlI6Ok9rKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHN0YXRpYyBDMlIgQ29sb3JBc3BlY3RzUmVxdWVzdFNldHRlcigKKyAgICAgICAgICAgICAgICAgICAgYm9vbCBtYXlCbG9jaywKKyAgICAgICAgICAgICAgICAgICAgQzJQPEMyU3RyZWFtQ29sb3JBc3BlY3RzUmVxdWVzdEluZm86Om91dHB1dD4gJm1lKSB7CisgICAgICAgICAgICAgICAgKHZvaWQpbWF5QmxvY2s7CisgICAgICAgICAgICAgICAgaWYgKG1lLnYucmFuZ2UgIT0gQzJDb2xvcjo6UkFOR0VfVU5TUEVDSUZJRUQpIHsKKyAgICAgICAgICAgICAgICAgICAgbWUuc2V0KCkucmFuZ2UgPSBDMkNvbG9yOjpSQU5HRV9VTlNQRUNJRklFRDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG1lLnYucHJpbWFyaWVzICE9IEMyQ29sb3I6OlBSSU1BUklFU19VTlNQRUNJRklFRCkgeworICAgICAgICAgICAgICAgICAgICBtZS5zZXQoKS5wcmltYXJpZXMgPSBDMkNvbG9yOjpQUklNQVJJRVNfVU5TUEVDSUZJRUQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICA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ZiAobVN0YXRlID09IFJFTEVBU0VEKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0JBRF9TVEFURTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gUlVOTklORyAmJiBsaXN0ZW5lcikgeworICAgICAgICAgICAgICAgIHJldHVybiBDMl9CQURfU1RBVEU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobVN0YXRlICE9IFNUT1BQRUQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gQzJfQkFEX1NUQVRFOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtTGlzdGVuZXJNdXRleCwgc3RkOjp0cnlfdG9fbG9jayk7CisgICAgICAgIGlmIChsb2NrKSB7CisgICAgICAgICAgICBtTGlzdGVuZXIgPSBsaXN0ZW5lcjsKKyAgICAgICAgICAgIHJldHVybiBDMl9PSzsKKyAgICAgICAgfQorICAgICAgICBpZiAobWF5QmxvY2sgPT0gQzJfRE9OVF9CTE9DSykgeworICAgICAgICAgICAgcmV0dXJuIEMyX0JMT0NLSU5HOworICAgICAgICB9CisgICAgICAgIGxvY2sudHJ5X2xvY2tfdW50aWwoZGVhZGxpbmUpOworICAgICAgICBpZiAoIWxvY2spIHsKKyAgICAgICAgICAgIHJldHVybiBDMl9USU1FRF9PVVQ7CisgICAgICAgIH0KKyAgICAgICAgbUxpc3RlbmVyID0gbGlzdGVuZXI7CisgICAgICAgIHJldHVybiBDMl9PSzsKKyAgICB9CisKKyAgICBjMl9zdGF0dXNfdCBxdWV1ZV9uYihzdGQ6Omxpc3Q8c3RkOjp1bmlxdWVfcHRyPEMyV29yaz4+KiBjb25zdCBpdGVtcykgb3ZlcnJpZGUgeworICAgICAgICBpZiAoIWl0ZW1zKSB7CisgICAgICAgICAgICByZXR1cm4gQzJfQkFEX1ZBTFVFOworICAgICAgICB9CisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtU3RhdGVNdXRleCk7CisgICAgICAgICAgICBpZiAobVN0YXRlICE9IFJVTk5JTkcpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gQzJfQkFEX1NUQVRFOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtUXVldWVNdXRleCk7CisgICAgICAgIG1RdWV1ZS5zcGxpY2UobVF1ZXVlLmVuZCgpLCAqaXRlbXMpOworICAgICAgICByZXR1cm4gQzJfT0s7CisgICAgfQorCisgICAgYzJfc3RhdHVzX3QgYW5ub3VuY2VfbmIoY29uc3Qgc3RkOjp2ZWN0b3I8QzJXb3JrT3V0bGluZT4gJikgb3ZlcnJpZGUgeyByZXR1cm4gQzJfT01JVFRFRDsgfQorCisgICAgYzJfc3RhdHVzX3QgZmx1c2hfc20oCisgICAgICAgICAgICBmbHVzaF9tb2RlX3QgbW9kZSwKKyAgICAgICAgICAgIHN0ZDo6bGlzdDxzdGQ6OnVuaXF1ZV9wdHI8QzJXb3JrPj4qIGNvbnN0IGZsdXNoZWRXb3JrKSBvdmVycmlkZSB7CisgICAgICAgIGlmICghZmx1c2hlZFdvcmspIHsKKyAgICAgICAgICAgIHJldHVybiBDMl9CQURfVkFMVUU7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1vZGUgPT0gRkxVU0hfQ0hBSU4pIHsKKyAgICAgICAgICAgIHJldHVybiBDMl9CQURfVkFMVUU7CisgICAgICAgIH0KKyAgICAgICAgeworICAgICAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1TdGF0ZU11dGV4KTsKKyAgICAgICAgICAgIGlmIChtU3RhdGUgIT0gUlVOTklORykgeworICAgICAgICAgICAgICAgIHJldHVybiBDMl9CQURfU1RBVEU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgeworICAgICAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1RdWV1ZU11dGV4KTsKKyAgICAgICAgICAgIG1RdWV1ZS5zd2FwKCpmbHVzaGVkV29yayk7CisgICAgICAgIH0KKyAgICAgICAgLy8gTk9URTogdGhpcyBjb21wb25lbnQgZG9lcyBub3QgaGF2ZSBpbnRlcm5hbCBzdGF0ZSB0byBmbHVzaC4KKyAgICAgICAgcmV0dXJuIEMyX09LOworICAgIH0KKworICAgIGMyX3N0YXR1c190IGRyYWluX25iKGRyYWluX21vZGVfdCBtb2RlKSBvdmVycmlkZSB7CisgICAgICAgIGlmIChtb2RlID09IERSQUlOX0NIQUlOKSB7CisgICAgICAgICAgICByZXR1cm4gQzJfQkFEX1ZBTFVFOworICAgICAgICB9CisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtU3RhdGVNdXRleCk7CisgICAgICAgICAgICBpZiAobVN0YXRlICE9IFJVTk5JTkcpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gQzJfQkFEX1NUQVRFOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIC8vIE5PVEU6IHRoaXMgY29tcG9uZW50IGRvZXMgbm90IHdhaXQgZm9yIHdvcmsgaXRlbXMgYmVmb3JlIHByb2Nlc3NpbmcuCisgICAgICAgIHJldHVybiBDMl9PSzsKKyAgICB9CisKKyAgICBjMl9zdGF0dXNfdCBzdGFydCgpIG92ZXJyaWRlIHsKKyAgICAgICAgLy9zdGQ6OmNocm9ubzo6c3RlYWR5X2Nsb2NrOjp0aW1lX3BvaW50IGRlYWRsaW5lID0gc3RkOjpjaHJvbm86OnN0ZWFkeV9jbG9jazo6bm93KCkgKyA1MDBtczsKKyAgICAgICAgeworICAgICAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1TdGF0ZU11dGV4KTsKKyAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gU1RBUlRJTkcpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gQzJfRFVQTElDQVRFOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1TdGF0ZSAhPSBTVE9QUEVEKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0JBRF9TVEFURTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1TdGF0ZSA9IFNUQVJUSU5HOworICAgICAgICB9CisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtUHJvY2Vzc2luZ011dGV4KTsKKyAgICAgICAgICAgIGlmICghbVByb2Nlc3NpbmdUaHJlYWQuam9pbmFibGUoKSkgeworICAgICAgICAgICAgICAgIG1Qcm9jZXNzaW5nVGhyZWFkID0gc3RkOjp0aHJlYWQoW3RoaXNdKCkgeworICAgICAgICAgICAgICAgICAgICBwcm9jZXNzTG9vcChzaGFyZWRfZnJvbV90aGlzKCkpOworICAgICAgICAgICAgICAgIH0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtU3RhdGVNdXRleCk7CisgICAgICAgICAgICBtU3RhdGUgPSBSVU5OSU5HOworICAgICAgICB9CisgICAgICAgIHJldHVybiBDMl9PSzsKKyAgICB9CisKKyAgICBjMl9zdGF0dXNfdCBzdG9wKCkgb3ZlcnJpZGUgeworICAgICAgICAvL3N0ZDo6Y2hyb25vOjpzdGVhZHlfY2xvY2s6OnRpbWVfcG9pbnQgZGVhZGxpbmUgPSBzdGQ6OmNocm9ubzo6c3RlYWR5X2Nsb2NrOjpub3coKSArIDUwMG1zOworICAgICAgICB7CisgICAgICAgICAgICBzdGQ6OnVuaXF1ZV9sb2NrIGxvY2sobVN0YXRlTXV0ZXgpOworICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBTVE9QUElORykgeworICAgICAgICAgICAgICAgIHJldHVybiBDMl9EVVBMSUNBVEU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobVN0YXRlICE9IFJVTk5JTkcpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gQzJfQkFEX1NUQVRFOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVN0YXRlID0gU1RPUFBJTkc7CisgICAgICAgIH0KKyAgICAgICAgeworICAgICAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1RdWV1ZU11dGV4KTsKKyAgICAgICAgICAgIG1RdWV1ZUNvbmRpdGlvbi5ub3RpZnlfYWxsKCk7CisgICAgICAgIH0KKyAgICAgICAgeworICAgICAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1Qcm9jZXNzaW5nTXV0ZXgpOworICAgICAgICAgICAgaWYgKG1Qcm9jZXNzaW5nVGhyZWFkLmpvaW5hYmxlKCkpIHsKKyAgICAgICAgICAgICAgICBtUHJvY2Vzc2luZ1RocmVhZC5qb2luKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgeworICAgICAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1TdGF0ZU11dGV4KTsKKyAgICAgICAgICAgIG1TdGF0ZSA9IFNUT1BQRUQ7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIEMyX09LOworICAgIH0KKworICAgIGMyX3N0YXR1c190IHJlc2V0KCkgb3ZlcnJpZGUgeworICAgICAgICAvL3N0ZDo6Y2hyb25vOjpzdGVhZHlfY2xvY2s6OnRpbWVfcG9pbnQgZGVhZGxpbmUgPSBzdGQ6OmNocm9ubzo6c3RlYWR5X2Nsb2NrOjpub3coKSArIDUwMG1zOworICAgICAgICB7CisgICAgICAgICAgICBzdGQ6OnVuaXF1ZV9sb2NrIGxvY2sobVN0YXRlTXV0ZXgpOworICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBSRVNFVFRJTkcpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gQzJfRFVQTElDQVRFOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBSRUxFQVNFRCkgeworICAgICAgICAgICAgICAgIHJldHVybiBDMl9CQURfU1RBVEU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtU3RhdGUgPSBSRVNFVFRJTkc7CisgICAgICAgIH0KKyAgICAgICAgeworICAgICAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1RdWV1ZU11dGV4KTsKKyAgICAgICAgICAgIG1RdWV1ZUNvbmRpdGlvbi5ub3RpZnlfYWxsKCk7CisgICAgICAgIH0KKyAgICAgICAgeworICAgICAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1Qcm9jZXNzaW5nTXV0ZXgpOworICAgICAgICAgICAgaWYgKG1Qcm9jZXNzaW5nVGhyZWFkLmpvaW5hYmxlKCkpIHsKKyAgICAgICAgICAgICAgICBtUHJvY2Vzc2luZ1RocmVhZC5qb2luKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgeworICAgICAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1TdGF0ZU11dGV4KTsKKyAgICAgICAgICAgIG1TdGF0ZSA9IFNUT1BQRUQ7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIEMyX09LOworICAgIH0KKworICAgIGMyX3N0YXR1c190IHJlbGVhc2UoKSBvdmVycmlkZSB7CisgICAgICAgIC8vc3RkOjpjaHJvbm86OnN0ZWFkeV9jbG9jazo6dGltZV9wb2ludCBkZWFkbGluZSA9IHN0ZDo6Y2hyb25vOjpzdGVhZHlfY2xvY2s6Om5vdygpICsgNTAwbXM7CisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtU3RhdGVNdXRleCk7CisgICAgICAgICAgICBpZiAobVN0YXRlID09IFJFTEVBU0VEIHx8IG1TdGF0ZSA9PSBSRUxFQVNJTkcpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gQzJfRFVQTElDQVRFOworICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gVE9ETzogcmV0dXJuIEMyX0JBRF9TVEFURSBpZiBub3Qgc3RvcHBlZAorICAgICAgICAgICAgbVN0YXRlID0gUkVMRUFTSU5HOworICAgICAgICB9CisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtUXVldWVNdXRleCk7CisgICAgICAgICAgICBtUXVldWVDb25kaXRpb24ubm90aWZ5X2FsbCgpOworICAgICAgICB9CisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtUHJvY2Vzc2luZ011dGV4KTsKKyAgICAgICAgICAgIGlmIChtUHJvY2Vzc2luZ1RocmVhZC5qb2luYWJsZSgpKSB7CisgICAgICAgICAgICAgICAgbVByb2Nlc3NpbmdUaHJlYWQuam9pbigpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtU3RhdGVNdXRleCk7CisgICAgICAgICAgICBtU3RhdGUgPSBSRUxFQVNFRDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gQzJfT0s7CisgICAgfQorCisgICAgc3RkOjpzaGFyZWRfcHRyPEMyQ29tcG9uZW50SW50ZXJmYWNlPiBpbnRmKCkgb3ZlcnJpZGUgeworICAgICAgICByZXR1cm4gbUludGY7CisgICAgfQorCitwcml2YXRlOgorICAgIHZvaWQgcHJvY2Vzc0xvb3Aoc3RkOjpzaGFyZWRfcHRyPFNhbXBsZVRvbmVNYXBwaW5nRmlsdGVyPiB0aGl6KSB7CisgICAgICAgIGNvbnN0ZXhwciBmbG9hdCBrRGVmYXVsdE1heEx1bWlhbmNlID0gNTAwLjA7CisgICAgICAgIGNvbnN0ZXhwciBmbG9hdCBrRGVmYXVsdE1heE1hc3RlcmluZ0x1bWluYW5jZSA9IDEwMDAuMDsKKyAgICAgICAgY29uc3RleHByIGZsb2F0IGtEZWZhdWx0TWF4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ICAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CisgICAgICAgIGlmICghcmVuZGVyRW5naW5lKSB7CisgICAgICAgICAgICBzdGQ6OnVuaXF1ZV9sb2NrIGxvY2sobUxpc3RlbmVyTXV0ZXgpOworICAgICAgICAgICAgbUxpc3RlbmVyLT5vbkVycm9yX25iKHRoaXosIEMyX0NPUlJVUFRFRCk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgdWludDMyX3QgdGV4dHVyZU5hbWUgPSAwOworICAgICAgICByZW5kZXJFbmdpbmUtPmdlblRleHR1cmVzKDEsICZ0ZXh0dXJlTmFtZSk7CisKKyAgICAgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgICAgIC8vIEJlZm9yZSBkb2luZyBhbnl0aGluZywgdmVyaWZ5IHRoZSBzdGF0ZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtU3RhdGVNdXRleCk7CisgICAgICAgICAgICAgICAgaWYgKG1TdGF0ZSAhPSBSVU5OSU5HKSB7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIEV4dHJhY3Qgb25lIHdvcmsgaXRlbQorICAgICAgICAgICAgc3RkOjp1bmlxdWVfcHRyPEMyV29yaz4gd29yazsKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzdGQ6OnVuaXF1ZV9sb2NrIGxvY2sobVF1ZXVlTXV0ZXgpOworICAgICAgICAgICAgICAgIGlmIChtUXVldWUuZW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICBtUXVldWVDb25kaXRpb24ud2FpdF9mb3IobG9jaywgMXMpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobVF1ZXVlLmVtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1RdWV1ZS5mcm9udCgpLnN3YXAod29yayk7CisgICAgICAgICAgICAgICAgbVF1ZXVlLnBvcF9mcm9udCgpOworICAgICAgICAgICAgICAgICsrd29ya0NvdW50OworICAgICAgICAgICAgfQorICAgICAgICAgICAgTE9HKFZFUkJPU0UpIDw8ICJ3b3JrICMiIDw8IHdvcmtDb3VudCA8PCAiOiBmbGFncz0iIDw8IHdvcmstPmlucHV0LmZsYWdzCisgICAgICAgICAgICAgICAgICAgIDw8ICIgdGltZXN0YW1wPSIgPDwgd29yay0+aW5wdXQub3JkaW5hbC50aW1lc3RhbXAucGVlaygpOzsKKworICAgICAgICAgICAgc3RkOjp2ZWN0b3I8QzJQYXJhbSAqPiBjb25maWdVcGRhdGU7CisgICAgICAgICAgICBmb3IgKGNvbnN0IHN0ZDo6dW5pcXVlX3B0cjxDMlBhcmFtPiAmcGFyYW0gOiB3b3JrLT5pbnB1dC5jb25maWdVcGRhdGUpIHsKKyAgICAgICAgICAgICAgICBjb25maWdVcGRhdGUucHVzaF9iYWNrKHBhcmFtLmdldCgpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHN0ZDo6dW5pcXVlX3B0cjxDMlNldHRpbmdSZXN1bHQ+PiBmYWlsdXJlczsKKyAgICAgICAgICAgIG1JbnRmLT5jb25maWdfdmIoY29uZmlnVXBkYXRlLCBDMl9NQVlfQkxPQ0ssICZmYWlsdXJlcyk7CisKKyAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMlN0cmVhbUhkclN0YXRpY0luZm86OmlucHV0PiBoZHJTdGF0aWNJbmZvID0KKyAgICAgICAgICAgICAgICBtSW50Zi0+Z2V0SGRyU3RhdGljTWV0YWRhdGEoKTsKKyAgICAgICAgICAgIHVpbnQzMl90IGRhdGFzcGFjZSA9IG1JbnRmLT5nZXREYXRhU3BhY2UoKTsKKworICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyQnVmZmVyPiBidWZmZXI7CisgICAgICAgICAgICBpZiAoIXdvcmstPmlucHV0LmJ1ZmZlcnMuZW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGJ1ZmZlciA9IHdvcmstPmlucHV0LmJ1ZmZlcnMuZnJvbnQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMkJ1ZmZlcj4gb3V0QzJCdWZmZXI7CisgICAgICAgICAgICBzdGF0dXNfdCBlcnIgPSBPSzsKKyAgICAgICAgICAgIGlmIChidWZmZXIpIHsKKyAgICAgICAgICAgICAgICBpZiAoYnVmZmVyLT5oYXNJbmZvKEMyU3RyZWFtSGRyU3RhdGljSW5mbzo6b3V0cHV0OjpQQVJBTV9UWVBFKSkgeworICAgICAgICAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8Y29uc3QgQzJJbmZvPiBpbmZvID0KKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlci0+Z2V0SW5mbyhDMlN0cmVhbUhkclN0YXRpY0luZm86Om91dHB1dDo6UEFSQU1fVFlQRSk7CisgICAgICAgICAgICAgICAgICAgIHN0ZDo6dW5pcXVlX3B0cjxDMlBhcmFtPiBmbGlwcGVkID0gQzJQYXJhbTo6Q29weUFzU3RyZWFtKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICppbmZvLCBmYWxzZSAvKiBvdXRwdXQgKi8sIGluZm8tPnN0cmVhbSgpKTsKKyAgICAgICAgICAgICAgICAgICAgaGRyU3RhdGljSW5mby5yZXNldChzdGF0aWNfY2FzdDxDMlN0cmVhbUhkclN0YXRpY0luZm86OmlucHV0ICo+KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsaXBwZWQucmVsZWFzZSgpKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNvbnN0IEMySGFuZGxlICpjMkhhbmRsZSA9CisgICAgICAgICAgICAgICAgICAgIG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AgICAgICAgICAgICAgIEdldENvZGVjMkJsb2NrUG9vbChwb29sSWQsIHRoaXosICZwb29sKTsKKyAgICAgICAgICAgICAgICBwb29sLT5mZXRjaEdyYXBoaWNCbG9jaygKKyAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoLCBoZWlnaHQsIEhBTF9QSVhFTF9GT1JNQVRfUkdCQV84ODg4LCBDMkFuZHJvaWRNZW1vcnlVc2FnZTo6RnJvbUdyYWxsb2NVc2FnZShrRHN0VXNhZ2UpLAorICAgICAgICAgICAgICAgICAgICAgICAgJmRzdEJsb2NrKTsKKyAgICAgICAgICAgICAgICBvdXRDMkJ1ZmZlciA9IEMyQnVmZmVyOjpDcmVhdGVHcmFwaGljQnVmZmVyKAorICAgICAgICAgICAgICAgICAgICAgICAgZHN0QmxvY2stPnNoYXJlKEMyUmVjdCh3aWR0aCwgaGVpZ2h0KSwgQzJGZW5jZSgpKSk7CisgICAgICAgICAgICAgICAgYzJIYW5kbGUgPSBkc3RCbG9jay0+aGFuZGxlKCk7CisgICAgICAgICAgICAgICAgX1Vud3JhcE5hdGl2ZUNvZGVjMkdyYWxsb2NNZXRhZGF0YSgKKyAgICAgICAgICAgICAgICAgICAgICAgIGMySGFuZGxlLCAmd2lkdGgsICZoZWlnaHQsICZmb3JtYXQsICZ1c2FnZSwgJnN0cmlkZSwgJmdlbmVyYXRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAmaWdicF9pZCwgJmlnYnBfc2xvdCk7CisgICAgICAgICAgICAgICAgZ3JhbGxvY0hhbmRsZSA9IFVud3JhcE5hdGl2ZUNvZGVjMkdyYWxsb2NIYW5kbGUoYzJIYW5kbGUpOworICAgICAgICAgICAgICAgIHNwPEdyYXBoaWNCdWZmZXI+IGRzdEJ1ZmZlciA9IG5ldyBHcmFwaGljQnVmZmVyKAorICAgICAgICAgICAgICAgICAgICAgICAgZ3JhbGxvY0hhbmRsZSwgR3JhcGhpY0J1ZmZlcjo6Q0xPTkVfSEFORExFLAorICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGgsIGhlaWdodCwgZm9ybWF0LCAxLCB1c2FnZSwgc3RyaWRlKTsKKworICAgICAgICAgICAgICAgIFJlY3Qgc291cmNlQ3JvcCgwLCAwLCB3aWR0aCwgaGVpZ2h0KTsKKworICAgICAgICAgICAgICAgIHJlbmRlcmVuZ2luZTo6RGlzcGxheVNldHRpbmdzIGNsaWVudENvbXBvc2l0aW9uRGlzcGxheTsKKyAgICAgICAgICAgICAgICBzdGQ6OnZlY3Rvcjxjb25zdCByZW5kZXJlbmdpbmU6OkxheWVyU2V0dGluZ3MqPiBjbGllbnRDb21wb3NpdGlvbkxheWVyczsKKworICAgICAgICAgICAgICAgIGNsaWVudENvbXBvc2l0aW9uRGlzcGxheS5waHlzaWNhbERpc3BsYXkgPSBzb3VyY2VDcm9wOworICAgICAgICAgICAgICAgIGNsaWVudENvbXBvc2l0aW9uRGlzcGxheS5jbGlwID0gc291cmNlQ3JvcDsKKworICAgICAgICAgICAgICAgIGNsaWVudENvbXBvc2l0aW9uRGlzcGxheS5vdXRwdXREYXRhc3BhY2UgPSB1aTo6RGF0YXNwYWNlOjpWMF9TUkdCOworICAgICAgICAgICAgICAgIGNsaWVudENvbXBvc2l0aW9uRGlzcGxheS5tYXhMdW1pbmFuY2UgPSBrRGVmYXVsdE1heEx1bWlhbmNlOworICAgICAgICAgICAgICAgIGNsaWVudENvbXBvc2l0aW9uRGlzcGxheS5jbGVhclJlZ2lvbiA9IFJlZ2lvbjo6SU5WQUxJRF9SRUdJT047CisgICAgICAgICAgICAgICAgcmVuZGVyZW5naW5lOjpMYXllclNldHRpbmdzIGxheWVyU2V0dGluZ3M7CisgICAgICAgICAgICAgICAgbGF5ZXJTZXR0aW5ncy5nZW9tZXRyeS5ib3VuZGFyaWVzID0gc291cmNlQ3JvcC50b0Zsb2F0UmVjdCgpOworICAgICAgICAgICAgICAgIGxheWVyU2V0dGluZ3MuYWxwaGEgPSAxLjBmOworCisgICAgICAgICAgICAgICAgbGF5ZXJTZXR0aW5ncy5zb3VyY2VEYXRhc3BhY2UgPSBzdGF0aWNfY2FzdDx1aTo6RGF0YXNwYWNlPihkYXRhc3BhY2UpOworCisgICAgICAgICAgICAgICAgLy8gZnJvbSBCdWZmZXJMYXllcgorICAgICAgICAgICAgICAgIGxheWVyU2V0dGluZ3Muc291cmNlLmJ1ZmZlci5idWZmZXIgPSBzcmNCdWZmZXI7CisgICAgICAgICAgICAgICAgbGF5ZXJTZXR0aW5ncy5zb3VyY2UuYnVmZmVyLmlzT3BhcXVlID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAvLyBUT0RPOiBmZW5jZQorICAgICAgICAgICAgICAgIGxheWVyU2V0dGluZ3Muc291cmNlLmJ1ZmZlci5mZW5jZSA9IEZlbmNlOjpOT19GRU5DRTsKKyAgICAgICAgICAgICAgICBsYXllclNldHRpbmdzLnNvdXJjZS5idWZmZXIudGV4dHVyZU5hbWUgPSB0ZXh0dXJlTmFtZTsKKyAgICAgICAgICAgICAgICBsYXllclNldHRpbmdzLnNvdXJjZS5idWZmZXIudXNlUHJlbXVsdGlwbGllZEFscGhhID0gZmFsc2U7CisgICAgICAgICAgICAgICAgbGF5ZXJTZXR0aW5ncy5zb3VyY2UuYnVmZmVyLmlzWTQxMEJUMjAyMCA9CisgICAgICAgICAgICAgICAgICAgIChsYXllclNldHRpbmdzLnNvdXJjZURhdGFzcGFjZSA9PSB1aTo6RGF0YXNwYWNlOjpCVDIwMjBfSVRVX1BRIHx8CisgICAgICAgICAgICAgICAgICAgICBsYXllclNldHRpbmdzLnNvdXJjZURhdGFzcGFjZSA9PSB1aTo6RGF0YXNwYWNlOjpCVDIwMjBfSVRVX0hMRykgJiYKKyAgICAgICAgICAgICAgICAgICAgZm9ybWF0ID09IEhBTF9QSVhFTF9GT1JNQVRfUkdCQV8xMDEwMTAyOworICAgICAgICAgICAgICAgIGxheWVyU2V0dGluZ3Muc291cmNlLmJ1ZmZlci5tYXhNYXN0ZXJpbmdMdW1pbmFuY2UgPQorICAgICAgICAgICAgICAgICAgICAoaGRyU3RhdGljSW5mbyAmJiAqaGRyU3RhdGljSW5mbyAmJgorICAgICAgICAgICAgICAgICAgICAgaGRyU3RhdGljSW5mby0+bWFzdGVyaW5nLm1heEx1bWluYW5jZSA+IDAgJiYKKyAgICAgICAgICAgICAgICAgICAgIGhkclN0YXRpY0luZm8tPm1hc3RlcmluZy5taW5MdW1pbmFuY2UgPiAwKQorICAgICAgICAgICAgICAgICAgICAgICAgPyBoZHJTdGF0aWNJbmZvLT5tYXN0ZXJpbmcubWF4THVtaW5hbmNlIDoga0RlZmF1bHRNYXhNYXN0ZXJpbmdMdW1pbmFuY2U7CisgICAgICAgICAgICAgICAgbGF5ZXJTZXR0aW5ncy5zb3VyY2UuYnVmZmVyLm1heENvbnRlbnRMdW1pbmFuY2UgPQorICAgICAgICAgICAgICAgICAgICAoaGRyU3RhdGljSW5mbyAmJiAqaGRyU3RhdGljSW5mbyAmJiBoZHJTdGF0aWNJbmZvLT5tYXhDbGwgPiAwKQorICAgICAgICAgICAgICAgICAgICAgICAgPyBoZHJTdGF0aWNJbmZvLT5tYXhDbGwgOiBrRGVmYXVsdE1heENvbnRlbnRMdW1pbmFuY2U7CisKKyAgICAgICAgICAgICAgICAvLyBTZXQgZmlsdGVyaW5nIHRvIGZhbHNlIHNpbmNlIHRoZSBjYXB0dXJlIGl0c2VsZiBkb2Vzbid0IGludm9sdmUKKyAgICAgICAgICAgICAgICAvLyBhbnkgc2NhbGluZywgbWV0YWRhdGEgcmV0cmlldmVyIEpOSSBpcyBzY2FsaW5nIHRoZSBiaXRtYXAgaWYKKyAgICAgICAgICAgICAgICAvLyBkaXNwbGF5IHNpemUgaXMgZGlmZmVyZW50IGZyb20gZGVjb2RlZCBzaXplLiBJZiB0aGF0IHNjYWxpbmcKKyAgICAgICAgICAgICAgICAvLyBuZWVkcyB0byBiZSBoYW5kbGVkIGJ5IHNlcnZlciBzaWRlLCBjb25zaWRlciB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KyAgICAgICAgICAgICAgICBzcDxGZW5jZT4gZmVuY2UgPSBuZXcgRmVuY2Uoc3RkOjptb3ZlKGRyYXdGZW5jZSkpOworCisgICAgICAgICAgICAgICAgLy8gV2UgY2FuIG1vdmUgd2FpdGluZyBmb3IgZmVuY2UgJiBzZW5kaW5nIGl0IGJhY2sgb24gYSBzZXBhcmF0ZSB0aHJlYWQgdG8gaW1wcm92ZQorICAgICAgICAgICAgICAgIC8vIGVmZmljaWVuY3ksIGJ1dCBsZWF2aW5nIGl0IGhlcmUgZm9yIHNpbXBsaWNpdHkuCisgICAgICAgICAgICAgICAgaWYgKGVyciAhPSBPSykgeworICAgICAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJkcmF3TGF5ZXJzIHJldHVybmVkIGVyciAiIDw8IGVycjsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBlcnIgPSBmZW5jZS0+d2FpdCg1MDApOworICAgICAgICAgICAgICAgICAgICBpZiAoZXJyICE9IE9LKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMT0coV0FSTklORykgPDwgIndhaXQgZm9yIGZlbmNlIHJldHVybmVkIGVyciAiIDw8IGVycjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZW5kZXJFbmdpbmUtPmNsZWFudXBQb3N0UmVuZGVyKHJlbmRlcmVuZ2luZTo6UmVuZGVyRW5naW5lOjpDbGVhbnVwTW9kZTo6Q0xFQU5fQUxMKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgd29yay0+d29ya2xldHMuZnJvbnQoKS0+b3V0cHV0Lm9yZGluYWwgPSB3b3JrLT5pbnB1dC5vcmRpbmFsOworICAgICAgICAgICAgd29yay0+d29ya2xldHMuZnJvbnQoKS0+b3V0cHV0LmZsYWdzID0gd29yay0+aW5wdXQuZmxhZ3M7CisgICAgICAgICAgICBpZiAoZXJyID09IE9LKSB7CisgICAgICAgICAgICAgICAgd29yay0+d29ya2xldHNQcm9jZXNzZWQgPSAxOworICAgICAgICAgICAgICAgIGlmIChvdXRDMkJ1ZmZlcikgeworICAgICAgICAgICAgICAgICAgICB3b3JrLT53b3JrbGV0cy5mcm9udCgpLT5vdXRwdXQuYnVmZmVycy5wdXNoX2JhY2sob3V0QzJCdWZmZXIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB3b3JrLT5yZXN1bHQgPSBDMl9PSzsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgd29yay0+cmVzdWx0ID0gQzJfQ09SUlVQVEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3RkOjpsaXN0PHN0ZDo6dW5pcXVlX3B0cjxDMldvcms+PiBpdGVtczsKKyAgICAgICAgICAgIGl0ZW1zLnB1c2hfYmFjayhzdGQ6Om1vdmUod29yaykpOworCisgICAgICAgICAgICBzdGQ6OnVuaXF1ZV9sb2NrIGxvY2sobUxpc3RlbmVyTXV0ZXgpOworICAgICAgICAgICAgbUxpc3RlbmVyLT5vbldvcmtEb25lX25iKHRoaXosIHN0ZDo6bW92ZShpdGVtcykpOworICAgICAgICAgICAgTE9HKFZFUkJPU0UpIDw8ICJzZW50IHdvcmsgIyIgPDwgd29ya0NvdW50OworICAgICAgICB9CisgICAgfQorCisgICAgbXV0YWJsZSBzdGQ6OnRpbWVkX211dGV4IG1MaXN0ZW5lck11dGV4OworICAgIHN0ZDo6c2hhcmVkX3B0cjxMaXN0ZW5lcj4gbUxpc3RlbmVyOworCisgICAgbXV0YWJsZSBzdGQ6Om11dGV4IG1RdWV1ZU11dGV4OworICAgIG11dGFibGUgc3RkOjpjb25kaXRpb25fdmFyaWFibGUgbVF1ZXVlQ29uZGl0aW9uOworICAgIHN0ZDo6bGlzdDxzdGQ6OnVuaXF1ZV9wdHI8QzJXb3JrPj4gbVF1ZXVlOworCisgICAgY29uc3Qgc3RkOjpzaGFyZWRfcHRyPE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5tZWRpYS5jMkAxLjItZXh0ZW5kZWQtc2VjY29tcC1wb2xpY3kiOwogCiBjbGFzcyBTdG9yZUltcGwgOiBwdWJsaWMgQzJDb21wb25lbnRTdG9yZSB7CiBwdWJsaWM6CkBAIC0xMjIsNiArMTIyLDE4IEBACiAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAud2l0aFNldHRlcihTZXRJb25Vc2FnZSkKICAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CisKKyAgICAgICAgICAgIGFkZFBhcmFtZXRlcigKKyAgICAgICAgICAgICAgICBEZWZpbmVQYXJhbShtRG1hQnVmVXNhZ2VJbmZvLCAiZG1hYnVmLXVzYWdlIikKKyAgICAgICAgICAgICAgICAud2l0aERlZmF1bHQobmV3IEMyU3RvcmVEbWFCdWZVc2FnZUluZm8oKSkKKyAgICAgICAgICAgICAgICAud2l0aEZpZWxkcyh7CisgICAgICAgICAgICAgICAgICAgIEMyRihtRG1hQnVmVXNhZ2VJbmZvLCB1c2FnZSkuZmxhZ3Moe0MyTWVtb3J5VXNhZ2U6OkNQVV9SRUFEIHwgQzJNZW1vcnlVc2FnZTo6Q1BVX1dSSVRFfSksCisgICAgICAgICAgICAgICAgICAgIEMyRihtRG1hQnVmVXNhZ2VJbmZvLCBjYXBhY2l0eSkuaW5SYW5nZSgwLCBVSU5UMzJfTUFYLCAxMDI0KSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1EbWFCdWZVc2FnZUluZm8sIGhlYXBOYW1lKS5hbnkoKSwKKyAgICAgICAgICAgICAgICAgICAgQzJGKG1EbWFCdWZVc2FnZUluZm8sIGFsbG9jRmxhZ3MpLmZsYWdzKHt9KSwKKyAgICAgICAgICAgICAgICB9KQorICAgICAgICAgICAgICAgIC53aXRoU2V0dGVyKFNldERtYUJ1ZlVzYWdlKQorICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKICAgICAgICAgfQogCiAgICAgICAgIHZpcnR1YWwgfkludGVyZmFjZSgpID0g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cnZhbE5zID0gbnNlY3NfdCgxMCkgKiAxMDAwICogMTAwMDsgIC8vIDEwbXMKQEAgLTk5LDYgKzEyNSw5IEBACiAgICAgICAgICAgICAgICAgICAgIHVuaXF1ZUZkcy5wdXNoX2JhY2soc3RkOjptb3ZlKHF1ZXVlLndvcmtMaXN0LmZyb250KCkuZmQxKSk7CiAgICAgICAgICAgICAgICAgICAgIHF1ZXVlLndvcmtMaXN0LnBvcF9mcm9udCgpOwogICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IHN0ZDo6dW5pcXVlX3B0cjxDMlBhcmFtPiAmcGFyYW0gOiBqb2JzLT5jb25maWdVcGRhdGUpIHsKKyAgICAgICAgICAgICAgICAgICAgaXRlbXMuZnJvbnQoKS0+aW5wdXQuY29uZmlnVXBkYXRlLmVtcGxhY2VfYmFjayhDMlBhcmFtOjpDb3B5KCpwYXJhbSkpOworICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIGpvYnMudW5sb2NrKCk7CiAgICAgICAgICAgICAgICAgZm9yIChpbnQgZmVuY2VGZCA6IGZlbmNlRmRzKSB7CkBAIC0xMTYsNiArMTQ1LDcgQEAKICAgICAgICAgICAgICAgICBxdWV1ZWQgPSB0cnVlOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKHF1ZXVlZCkgeworICAgICAgICAgICAgICAgIGpvYnMtPmNvbmZpZ1VwZGF0ZS5jbGVhcigpOwogICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKGkgPT0gMCkgewpAQCAtMTU4LDYgKzE4OCw3IEBACiAgICAgICAgIHN0ZDo6bWFwPHN0ZDo6d2Vha19wdHI8Q29kZWMyQ2xpZW50OjpDb21wb25lbnQ+LAogICAgICAgICAgICAgICAgICBRdWV1ZSwKICAgICAgICAgICAgICAgICAgc3RkOjpvd25lcl9sZXNzPHN0ZDo6d2Vha19wdHI8Q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yBXT1JLQVJPVU5EOiBoYXZpbmcgbW9yZSBzbG90cyBpbXByb3ZlIHBlcmZvcm1hbmNlIHdoaWxlIGNvbnN1bWluZworICAgICAgICAgICAgLy8gbW9yZSBtZW1vcnkuIFRoaXMgaXMgYSB0ZW1wb3Jhcnkgd29ya2Fyb3VuZCB0byByZWR1Y2UgbWVtb3J5IGZvcgorICAgICAgICAgICAgLy8gbGFyZ2VyLXRoYW4tNEsgc2NlbmFyaW8uCisgICAgICAgICAgICBpZiAobVdpZHRoICogbUhlaWdodCA+IDQwOTYgKiAyMzQwKSB7CisgICAgICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPENvZGVjMkNsaWVudDo6Q29tcG9uZW50PiBjb21wID0gbUNvbXAubG9jaygpOworICAgICAgICAgICAgICAgIEMyUG9ydEFjdHVhbERlbGF5VHVuaW5nOjppbnB1dCBpbnB1dERlbGF5KDApOworICAgICAgICAgICAgICAgIEMyQWN0dWFsUGlwZWxpbmVEZWxheVR1bmluZyBwaXBlbGluZURlbGF5KDApOworICAgICAgICAgICAgICAgIGMyX3N0YXR1c190IGMyZXJyID0gQzJfTk9UX0ZPVU5EOworICAgICAgICAgICAgICAgIGlmIChjb21wKSB7CisgICAgICAgICAgICAgICAgICAgIGMyZXJyID0gY29tcC0+cXVlcnkoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyZpbnB1dERlbGF5LCAmcGlwZWxpbmVEZWxheX0sIHt9LCBDMl9ET05UX0JMT0NLLCBudWxscHRyKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGMyZXJyID09IEMyX09LIHx8IGMyZXJyID09IEMyX0JBRF9JTkRFWCkgeworICAgICAgICAgICAgICAgICAgICBwRGVmLT5uQnVmZmVyQ291bnRBY3R1YWwgPSA0OworICAgICAgICAgICAgICAgICAgICBwRGVmLT5uQnVmZmVyQ291bnRBY3R1YWwgKz0gKGlucHV0RGVsYXkgPyBpbnB1dERlbGF5LnZhbHVlI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gICAgICAgLy8gY29tbXVuaWNhdGUgdGhhdCBkaXJlY3RseSB0byB0aGUgY29tcG9uZW50LgogICAgICAgICBtU291cmNlLT5jb25maWd1cmUoCiAgICAgICAgICAgICAgICAgbU9teE5vZGUsIHN0YXRpY19jYXN0PGhhcmR3YXJlOjpncmFwaGljczo6Y29tbW9uOjpWMV8wOjpEYXRhc3BhY2U+KG1EYXRhU3BhY2UpKTsKICAgICAgICAgcmV0dXJuIE9LOwpAQCAtMjQ2LDggKzI0NiwxOSBAQAogICAgICAgICBpZiAoc291cmNlID09IG51bGxwdHIpIHsKICAgICAgICAgICAgIHJldHVybiBOT19JTklUOwogICAgICAgICB9Ci0gICAgICAgIGNvbnN0ZXhwciBzaXplX3Qga051bVNsb3RzID0gMTY7Ci0gICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwga051bVNsb3RzOyArK2kpIHsKKworICAgICAgICBzaXplX3QgbnVtU2xvdHMgPSAxNjsKKyAgICAgICAgY29uc3RleHByIE9NWF9VMzIga1BvcnRJbmRleElucHV0ID0gMDsKKworICAgICAgICBPTVhfUEFSQU1fUE9SVERFRklOSVRJT05UWVBFIHBhcmFtOworICAgICAgICBwYXJhbS5uUG9ydEluZGV4ID0ga1BvcnRJbmRleElucHV0OworICAgICAgICBzdGF0dXNfdCBlcnIgPSBtTm9kZS0+Z2V0UGFyYW1ldGVyKE9NWF9JbmRleFBhcmFtUG9ydERlZmluaXRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBhcmFtLCBzaXplb2YocGFyYW0pKTsKKyAgICAgICAgaWYgKGVyciA9PSBPSykgeworICAgICAgICAgICAgbnVtU2xvdHMgPSBwYXJhbS5uQnVmZmVyQ291bnRBY3R1YWw7CisgICAgICAgIH0KKworICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG51bVNsb3RzOyArK2kpIHsKICAgICAgICAgICAgIHNvdXJjZS0+b25JbnB1dEJ1ZmZlckF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gICAgeworICAgICAgICAgICAgLy8gQ29tcG9uZW50IGlzIG9ubHkgdXNlZCBmb3IgcmVwb3J0aW5nIGFzIHdlIHVzZSBhIHNlcGFyYXRlIGxpc3RlbmVyIGZvciBlYWNoIGluc3RhbmNlCisgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8Q29kZWMyQ2xpZW50OjpDb21wb25lbnQ+IGNvbXAgPSBjb21wb25lbnQubG9jaygpOworICAgICAgICAgICAgaWYgKCFjb21wKSB7CisgICAgICAgICAgICAgICAgQUxPR0QoIkNvbXBvbmVudCBkaWVkIHdpdGggZXJyb3I6IDB4JXgiLCBlcnJvckNvZGUpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBBTE9HRCgiQ29tcG9uZW50IFwiJXNcIiByZXR1cm5lZCBlcnJvcjogMHgleCIsIGNvbXAtPmdldE5hbWUoKS5jX3N0cigpLCBlcnJvckNvZGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gUmVwb3J0IHRvIE1lZGlhQ29kZWMKKyAgICAgICAgLy8gTm90ZTogZm9yIG5vdyB3ZSBkbyBub3QgcHJvcGFnYXRlIHRoZSBlcnJvciBjb2RlIHRvIE1lZGlhQ29kZWMKKyAgICAgICAgLy8gZXhjZXB0IGZvciBDMl9OT19NRU1PUlksIGFzIHdlIHdvdWxkIG5lZWQgdG8gdHJhbnNsYXRlIHRvIGEgTWVkaWFDb2RlYyBlcnJvci4KKyAgICAgICAgc3A8Q0NvZGVjPiBjb2RlYyhtQ29kZWMucHJvbW90ZSgpKTsKKyAgICAgICAgaWYgKCFjb2RlYyB8fCAhY29kZWMtPm1DYWxsYmFjaykgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGNvZGVjLT5tQ2FsbGJhY2stPm9uRXJyb3IoCisgICAgICAgICAgICAgICAgZXJyb3JDb2RlID09IEMyX05PX01FTU9SWSA/IE5PX01FTU9SWSA6IFVOS05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1ZV9wdHI8Q29uZmlnPj46OkxvY2tlZCBjb25maWdMb2NrZWQobUNvbmZpZyk7CisgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp1bmlxdWVfcHRyPENvbmZpZz4gJmNvbmZpZyA9ICpjb25maWdMb2NrZWQ7CisgICAgICAgICAgICAgICAgaWYgKChjb25maWctPm1Eb21haW4gJiBDb25maWc6OklTX0RFQ09ERVIpCisgICAgICAgICAgICAgICAgICAgICAgICAmJiAoY29uZmlnLT5tRG9tYWluICYgQ29uZmlnOjpJU19WSURFTykpIHsKKyAgICAgICAgICAgICAgICAgICAgaW50MzJfdCB0dW5uZWxlZDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1zZy0+ZmluZEludDMyKCJmZWF0dXJlLXR1bm5lbGVkLXBsYXliYWNrIiwgJnR1bm5lbGVkKSAmJiB0dW5uZWxlZCAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBBTE9HSSgiQ29uZmlndXJpbmcgVFVOTkVMRUQgdmlkZW8gcGxheWJhY2suIik7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IGNvbmZpZ3VyZVR1bm5lbGVkVmlkZW9QbGF5YmFjayhjb21wLCAmY29uZmlnLT5tU2lkZWJhbmRIYW5kbGUsIG1zZyk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJyICE9IE9LKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR0UoImNvbmZpZ3VyZVR1bm5lbGVkVmlkZW9QbGF5YmFjayBmYWlsZWQhIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVycjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy0+bVR1bm5lbGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIHNldFN1cmZhY2Uoc3VyZmFjZSk7CiAgICAgICAgIH0KIApAQCAtNzczLDEyICs5MDQsMTQgQEAKICAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwogICAgICAgICAgICAgfQogICAgICAgICB9CisgICAgICAgIGludDMyX3Qgd2lkdGggPSAwOworICAgICAgICBpbnQzMl90IGhlaWdodCA9IDA7CiAgICAgICAgIGlmIChjb25maWctPm1Eb21haW4gJiAoQ29uZmlnOjpJU19JTUFHRSB8IENvbmZpZzo6SVNfVklERU8pKSB7Ci0gICAgICAgICAgICBpZiAoIW1zZy0+ZmluZEludDMyKEtFWV9XSURUSCwgJmkzMikpIHsKKyAgICAgICAgICAgIGlmICghbXNnLT5maW5kSW50MzIoS0VZX1dJRFRILCAmd2lkdGgpKSB7CiAgICAgICAgICAgICAgICAgQUxPR0QoIndpZHRoIGlzIG1pc3NpbmcsIHdoaWNoIGlzIHJlcXVpcmVkIGZvciBpbWFnZS92aWRlbyBjb21wb25lbnRzLiIpOwogICAgICAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIW1zZy0+ZmluZEludDMyKEtFWV9IRUlHSFQsICZpMzIpKSB7CisgICAgICAgICAgICBpZiAoIW1zZy0+ZmluZEludDMyKEtFWV9IRUlHSFQsICZoZWlnaHQpKSB7CiAgICAgICAgICAgICAgICAgQUxPR0QoImhlaWdodCBpcyBtaXNzaW5nLCB3aGljaCBpcyByZXF1aXJlZCBmb3IgaW1hZ2UvdmlkZW8gY29tcG9uZW50cy4iKTsKICAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwogICAgICAgICAgICAgfQpAQCAtODYyLDI4ICs5OTUsMTIyIEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgY29uZmlnLT5tSVNDb25maWctPm1Vc2FnZSA9IDA7CisgICAgICAgICAgICBjb25maWctPm1JU0NvbmZpZy0+bVByaW9yaXR5ID0gSU5UX01BWDsKICAgICAgICAgfQogCiAgICAgICAgIC8qCiAgICAgICAgICAqIEhhbmRsZSBkZXNpcmVkIGNvbG9yIGZvcm1hdC4KICAgICAgICAgICovCisgICAgICAgIGludDMyX3QgZGVmYXVsdENvbG9yRm9ybWF0ID0gQ09MT1JfRm9ybWF0WVVWNDIwRmxleGlibGU7CiAgICAgICAgIGlmICgoY29uZmlnLT5tRG9tYWluICYgKENvbmZpZzo6SVNfVklERU8gfCBDb25maWc6OklTX0lNQUdFKSkpIHsKLSAgICAgICAgICAgIGludDMyX3QgZm9ybWF0ID0gLTE7CisgICAgICAgICAgICBpbnQzMl90IGZvcm1hdCA9IDA7CisgICAgICAgICAgICAvLyBRdWVyeSB2ZW5kb3IgZm9ybWF0IGZvciBGbGV4aWJsZSBZVVYKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHN0ZDo6dW5pcXVlX3B0cjxDMlBhcmFtPj4gaGVhcFBhcmFtczsKKyAgICAgICAgICAgIEMyU3RvcmVGbGV4aWJsZVBpeGVsRm9ybWF0RGVzY3JpcHRvcnNJbmZvICpwaXhlbEZvcm1hdEluZm8gPSBudWxscHRyOworICAgICAgICAgICAgaWYgKG1DbGllbnQtPnF1ZXJ5KAorICAgICAgICAgICAgICAgICAgICAgICAge30sCisgICAgICAgICAgICAgICAgICAgICAgICB7QzJTdG9yZUZsZXhpYmxlUGl4ZWxGb3JtYXREZXNjcmlwdG9yc0luZm86OlBBUkFNX1RZUEV9LAorICAgICAgICAgICAgICAgICAgICAgICAgQzJfTUFZX0JMT0NLLAorICAgICAgICAgICAgICAgICAgICAgICAgJmhlYXBQYXJhbXMpID09IEMyX09LCisgICAgICAgICAgICAgICAgICAgICYmIGhlYXBQYXJhbXMuc2l6ZSgpID09IDF1KSB7CisgICAgICAgICAgICAgICAgcGl4ZWxGb3JtYXRJbmZvID0gQzJTdG9yZUZsZXhpYmxlUGl4ZWxGb3JtYXREZXNjcmlwdG9yc0luZm86OkZyb20oCisgICAgICAgICAgICAgICAgICAgICAgICBoZWFwUGFyYW1zWzBdLmdldCgpKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcGl4ZWxGb3JtYXRJbmZvID0gbnVsbHB0cjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHN0ZDo6b3B0aW9uYWw8dWludDMyX3Q+IGZsZXhQaXhlbEZvcm1hdHt9OworICAgICAgICAgICAgc3RkOjpvcHRpb25hbDx1aW50MzJfdD4gZmxleFBsYW5hclBpeGVsRm9ybWF0e307CisgICAgICAgICAgICBzdGQ6Om9wdGlvbmFsPHVpbnQzMl90PiBmbGV4U2VtaVBsYW5hclBpeGVsRm9ybWF0e307CisgICAgICAgICAgICBpZiAocGl4ZWxGb3JtYXRJbmZvICYmICpwaXhlbEZvcm1hdEluZm8pIHsKKyAgICAgICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHBpeGVsRm9ybWF0SW5mby0+ZmxleENvdW50KCk7ICsraSkgeworICAgICAgICAgICAgICAgICAgICBjb25zdCBDMkZsZXhpYmxlUGl4ZWxGb3JtYXREZXNjcmlwdG9yU3RydWN0ICZkZXNjID0KKyAgICAgICAgICAgICAgICAgICAgICAgIHBpeGVsRm9ybWF0SW5mby0+bS52YWx1ZXNbaV07CisgICAgICAgICAgICAgICAgICAgIGlmIChkZXNjLmJpdERlcHRoICE9IDgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCBkZXNjLnN1YnNhbXBsaW5nICE9IEMyQ29sb3I6OllVVl80MjAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUT0RPKGIvMTgwMDc2MTA1KTogc29tZSBkZXZpY2UgcmVwb3J0IHdyb25nIGxheW91dAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHx8IGRlc2MubGF5b3V0ID09IEMyQ29sb3I6OklOVEVSTEVBVkVEX1BBQ0tFRAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHx8IGRlc2MubGF5b3V0ID09IEMyQ29sb3I6OklOVEVSTEVBVkVEX0FMSUdORUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCBkZXNjLmxheW91dCA9PSBDMkNvbG9yOjpVTktOT1dOX0xBWU9VVCkgeworICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKCFmbGV4UGl4ZWxGb3JtYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhQaXhlbEZvcm1hdCA9IGRlc2MucGl4ZWxGb3JtYXQ7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGRlc2MubGF5b3V0ID09IEMyQ29sb3I6OlBMQU5BUl9QQUNLRUQgJiYgIWZsZXhQbGFuYXJQaXhlbEZvcm1hdCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmxleFBsYW5hclBpeGVsRm9ybWF0ID0gZGVzYy5waXhlbEZvcm1hdDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoZGVzYy5sYXlvdXQgPT0gQzJDb2xvcjo6U0VNSVBMQU5BUl9QQUNLRUQgJiYgIWZsZXhTZW1pUGxhbmFyUGl4ZWxGb3JtYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhTZW1pUGxhbmFyUGl4ZWxGb3JtYXQgPSBkZXNjLnBpeGVsRm9ybWF0OworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKCFtc2ctPmZpbmRJbnQzMihLRVlfQ09MT1JfRk9STUFULCAmZm9ybWF0KSkgewotICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICogQWxzbyBoYW5kbGUgZGVmYXVsdCBjb2xvciBmb3JtYXQgKGVuY29kZXJzIHJlcXVpcmUgY29sb3IgZm9ybWF0LCBzbyB0aGlzIGlzIG9ubHkKLSAgICAgICAgICAgICAgICAgKiBuZWVkZWQgZm9yIGRlY29kZXJzLgotICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgIC8vIEFsc28gaGFuZGxlIGRlZmF1bHQgY29sb3IgZm9ybWF0IChlbmNvZGVycyByZXF1aXJlIGNvbG9yIGZvcm1hdCwgc28gdGhpcyBpcyBvbmx5CisgICAgICAgICAgICAgICAgLy8gbmVlZGVkIGZvciBkZWNvZGVycy4KICAgICAgICAgICAgICAgICBpZiAoIShjb25maWctPm1Eb21haW4gJiBDb25maWc6OklTX0VOQ09ERVIpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZvcm1hdCA9IChzdXJmYWNlID09IG51bGxwdHIpID8gQ09MT1JfRm9ybWF0WVVWNDIwUGxhbmFyIDogQ09MT1JfRm9ybWF0U3VyZmFjZTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHN1cmZhY2UgPT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqcHJlZml4ID0gIiI7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmxleFNlbWlQbGFuYXJQaXhlbEZvcm1hdCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcm1hdCA9IENPTE9SX0Zvcm1hdFlVVjQyMFNlbWlQbGFuYXI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlZml4ID0gInNlbWktIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9ybWF0ID0gQ09MT1JfRm9ybWF0WVVWNDIwUGxhbmFyOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgQUxPR0QoIkNsaWVudCByZXF1ZXN0ZWQgQnl0ZUJ1ZmZlciBtb2RlIGRlY29kZXIgdy9vIGNvbG9yIGZvcm1hdCBzZXQ6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInVzaW5nIGRlZmF1bHQgJXNwbGFuYXIgY29sb3IgZm9ybWF0IiwgcHJlZml4KTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvcm1hdCA9IENPTE9SX0Zvcm1hdFN1cmZhY2U7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdENvbG9yRm9ybWF0ID0gZm9ybWF0OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaWYgKChjb25maWctPm1Eb21haW4gJiBDb25maWc6OklTX0VOQ09ERVIpIHx8ICFzdXJmYWNlKSB7CisgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZm9ybWF0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdFlVVjQyMEZsZXhpYmxlOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcm1hdCA9IGZsZXhQaXhlbEZvcm1hdC52YWx1ZV9vcihDT0xPUl9Gb3JtYXRZVVY0MjBQbGFuYXIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDT0xPUl9Gb3JtYXRZVVY0MjBQbGFuYXI6CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdFlVVjQyMFBhY2tlZFBsYW5hcjoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXQgPSBmbGV4UGxhbmFyUGl4ZWxGb3JtYXQudmFsdWVfb3IoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGV4UGl4ZWxGb3JtYXQudmFsdWVfb3IoZm9ybWF0KSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdFlVVjQyMFNlbWlQbGFuYXI6CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdFlVVjQyMFBhY2tlZFNlbWlQbGFuYXI6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9ybWF0ID0gZmxleFNlbWlQbGFuYXJQaXhlbEZvcm1hdC52YWx1ZV9vcigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhQaXhlbEZvcm1hdC52YWx1ZV9vcihmb3JtYXQpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gTm8tb3AKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgaWYgKGZvcm1hdCA+PSAwKSB7CisgICAgICAgICAgICBpZiAoZm9ybWF0ICE9IDApIHsKICAgICAgICAgICAgICAgICBtc2ctPnNldEludDMyKCJhbmRyb2lkLl9jb2xvci1mb3JtYXQiLCBmb3JtYXQpOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAKKyAgICAgICAgLyoKKyAgICAgICAgICogSGFuZGxlIGRhdGFzcGFjZQorICAgICAgICAgKi8KKyAgICAgICAgaW50MzJfdCB1c2luZ1JlY29yZGVyOworICAgICAgICBpZiAobXNnLT5maW5kSW50MzIoImFuZHJvaWQuX3VzaW5nLXJlY29yZGVyIiwgJnVzaW5nUmVjb3JkZXIpICYmIHVzaW5nUmVjb3JkZXIpIHsKKyAgICAgICAgICAgIGFuZHJvaWRfZGF0YXNwYWNlIGRhdGFTcGFjZSA9IEhBTF9EQVRBU1BBQ0VfQlQ3MDk7CisgICAgICAgICAgICBpbnQzMl90IHdpZHRoLCBoZWlnaHQ7CisgICAgICAgICAgICBpZiAobXNnLT5maW5kSW50MzIoIndpZHRoIiwgJndpZHRoKQorICAgICAgICAgICAgICAgICAgICAmJiBtc2ctPmZpbmRJbnQzMigiaGVpZ2h0IiwgJmhlaWdodCkpIHsKKyAgICAgICAgICAgICAgICBDb2xvckFzcGVjdHMgYXNwZWN0czsKKyAgICAgICAgICAgICAgICBnZXRDb2xvckFzcGVjdHNGcm9tRm9ybWF0KG1zZywgYXNwZWN0cyk7CisgICAgICAgICAgICAgICAgc2V0RGVmYXVsdENvZGVjQ29sb3JBc3BlY3RzSWZOZWVkZWQoYXNwZWN0cywgd2lkdGgsIGhlaWdodCk7CisgICAgICAgICAgICAgICAgLy8gVE9ETzogcmVhZCBkYXRhc3BhY2UgLyBjb2xvciBhc3BlY3QgZnJvbSB0aGUgY29tcG9uZW50CisgICAgICAgICAgICAgICAgc2V0Q29sb3JBc3BlY3RzSW50b0Zvcm1hdChhc3BlY3RzLCBjb25zdF9jYXN0PHNwPEFNZXNzYWdlPiAmPihtc2cpKTsKKyAgICAgICAgICAgICAgICBkYXRhU3BhY2UgPSBnZXREYXRhU3BhY2VGb3JDb2xvckFzcGVjdHMoYXNwZWN0cywgdHJ1ZSAvKiBtYXlleHBhbmQgKi8pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbXNnLT5zZXRJbnQzMigiYW5kcm9pZC5fZGF0YXNwYWNlIiwgKGludDMyX3QpZGF0YVNwYWNlKTsKKyAgICAgICAgICAgIEFMT0dEKCJzZXR0aW5nIGRhdGFzcGFjZSB0byAleCIsIGRhdGFTcGFjZSk7CisgICAgICAgIH0KKwogICAgICAgICBpbnQzMl90IHN1YnNjcmliZVRvQWxsVmVuZG9yUGFyYW1zOwogICAgICAgICBpZiAobXNnLT5maW5kSW50MzIoIngtKiIsICZzdWJzY3JpYmVUb0FsbFZlbmRvclBhcmFtcykgJiYgc3Vic2NyaWJl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I8QzJTdHJlYW1QaWN0dXJlUXVhbnRpemF0aW9uVHVuaW5nOjpvdXRwdXQ+IHFwID0KKyAgICAgICAgICAgICAgICBDMlN0cmVhbVBpY3R1cmVRdWFudGl6YXRpb25UdW5pbmc6Om91dHB1dDo6QWxsb2NVbmlxdWUoMyAvKiBmbGV4Q291bnQgKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB1IC8qIHN0cmVhbSAqLyk7CisKKyAgICAgICAgICAgIGludCBpeCA9IDA7CisKKyAgICAgICAgICAgIGludDMyX3QgaU1heCA9IElOVDMyX01BWDsKKyAgICAgICAgICAgIGludDMyX3QgaU1pbiA9IElOVDMyX01JTjsKKyAgICAgICAgICAgICh2b2lkKSBzZGtQYXJhbXMtPmZpbmRJbnQzMihLRVlfVklERU9fUVBfSV9NQVgsICZpTWF4KTsKKyAgICAgICAgICAgICh2b2lkKSBzZGtQYXJhbXMtPmZpbmRJbnQzMihLRVlfVklERU9fUVBfSV9NSU4sICZpTWluKTsKKyAgICAgICAgICAgIGlmIChpTWF4ICE9IElOVDMyX01BWCB8fCBpTWluICE9IElOVDMyX01JTikgeworICAgICAgICAgICAgICAgIHFwLT5tLnZhbHVlc1tpeCsrXSA9IHtJX0ZSQU1FLCBpTWluLCBpTWF4fTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaW50MzJfdCBwTWF4ID0gSU5UMzJfTUFYOworICAgICAgICAgICAgaW50MzJfdCBwTWluID0gSU5UMzJfTUlOOworICAgICAgICAgICAgKHZvaWQpIHNka1BhcmFtcy0+ZmluZEludDMyKEtFWV9WSURFT19RUF9QX01BWCwgJnBNYXgpOworICAgICAgICAgICAgKHZvaWQpIHNka1BhcmFtcy0+ZmluZEludDMyKEtFWV9WSURFT19RUF9QX01JTiwgJnBNaW4pOworICAgICAgICAgICAgaWYgKHBNYXggIT0gSU5UMzJfTUFYIHx8IHBNaW4gIT0gSU5UMzJfTUlOKSB7CisgICAgICAgICAgICAgICAgcXAtPm0udmFsdWVzW2l4KytdID0ge1BfRlJBTUUsIHBNaW4sIHBNYXh9OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQzMl90IGJNYXggPSBJTlQzMl9NQVg7CisgICAgICAgICAgICBpbnQzMl90IGJNaW4gPSBJTlQzMl9NSU47CisgICAgICAgICAgICAodm9pZCkgc2RrUGFyYW1zLT5maW5kSW50MzIoS0VZX1ZJREVPX1FQX0JfTUFYLCAmYk1heCk7CisgICAgICAgICAgICAodm9pZCkgc2RrUGFyYW1zLT5maW5kSW50MzIoS0VZX1ZJREVPX1FQX0JfTUlOLCAmYk1pbik7CisgICAgICAgICAgICBpZiAoYk1heCAhPSBJTlQzMl9NQVggfHwgYk1pbiAhPSBJTlQzMl9NSU4pIHsKKyAgICAgICAgICAgICAgICBxcC0+bS52YWx1ZXNbaXgrK10gPSB7Ql9GUkFNRSwgYk1pbiwgYk1heH07CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIGFkanVzdCB0byByZWZsZWN0IGFjdHVhbCB1c2UuCisgICAgICAgICAgICBxcC0+c2V0RmxleENvdW50KGl4KTsKKworICAgICAgICAgICAgY29uZmlnVXBkYXRlLnB1c2hfYmFjayhzdGQ6Om1vdmUocXApKTsKKyAgICAgICAgfQorCisgICAgICAgIGludDMyX3QgYmFja2dyb3VuZCA9IDA7CisgICAgICAgIGlmICgoY29uZmlnLT5tRG9tYWluICYgQ29uZmlnOjpJU19WSURFTykKKyAgICAgICAgICAgICAgICAmJiBtc2ctPmZpbmRJbnQzMigiYW5kcm9pZC5fYmFja2dyb3VuZC1tb2RlIiwgJmJhY2tncm91bmQpCisgICAgICAgICAgICAgICAgJiYgYmFja2dyb3VuZCkgeworICAgICAgICAgICAgYW5kcm9pZFNldFRocmVhZFByaW9yaXR5KGdldHRpZCgpLCBBTkRST0lEX1BSSU9SSVRZX0JBQ0tHUk9VTkQpOworICAgICAgICAgICAgaWYgKGNvbmZpZy0+bUlTQ29uZmlnKSB7CisgICAgICAgICAgICAgICAgY29uZmlnLT5tSVNDb25maWctPm1Qcmlvcml0eSA9IEFORFJPSURfUFJJT1JJVFlfQkFDS0dST1VORDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCiAgICAgICAgIGVyciA9IGNvbmZpZy0+c2V0UGFyYW1ldGVycyhjb21wLCBjb25maWdVcGRhdGUsIEMyX0RPTlRfQkxPQ0spOwogICAgICAgICBpZiAoZXJyICE9IE9LKSB7CiAgICAgICAgICAgICBBTE9HVygiZmFpbGVkIHRvIGNvbmZpZ3VyZSBjMiBwYXJhbXMiKTsKQEAgLTkzMiw3ICsxMjA4LDEwIEBACiAgICAgICAgIEMyU3RyZWFtTWF4QnVmZmVyU2l6ZUluZm86OmlucHV0IG1heElucHV0U2l6ZSgwdSwgMHUpOwogICAgICAgICBDMlByZXBlbmRIZWFkZXJNb2RlU2V0dGluZyBwcmVwZW5kKFBSRVBFTkRfSEVBREVSX1RPX05PTkUpOwogCisgICAgICAgIEMyUGFyYW06OkluZGV4IGNvbG9yQXNwZWN0c1JlcXVlc3RJbmRleCA9CisgICAgICAgICAgICBDMlN0cmVhbUNvbG9yQXNwZWN0c0luZm86Om91dHB1dDo6UEFSQU1fVFlQRSB8IEMyUGFyYW06OkNvcmVJbmRleDo6SVNfUkVRVUVTVF9GTEFHOwogICAgICAgICBzdGQ6OmluaXRpYWxpemVyX2xpc3Q8QzJQYXJhbTo6SW5kZXg+IGluZGljZXMgeworICAgICAgICAgICAgY29sb3JBc3BlY3RzUmVxdWVzdEluZGV4LndpdGhTdHJlYW0oMHUpLAogICAgICAgICB9OwogICAgICAgICBjMl9zdGF0dXNfdCBjMmVyciA9IGNvbXAtPnF1ZXJ5KAogICAgICAgICAgICAgICAgIHsgJnVzYWdlLCAmbWF4SW5wdXRTaXplLCAmcHJlcGVuZCB9LApAQCAtOTQzLDExICsxMjIyLDYgQEAKICAgICAgICAgICAgIEFMT0dFKCJGYWlsZWQgdG8gcXVlcnkgY29tcG9uZW50IGludGVyZmFjZTogJWQiLCBjMmVycik7CiAgICAgICAgICAgICByZXR1cm4gVU5LTk9XTl9FUlJPUjsKICAgICAgICAgfQotICAgICAgICBpZiAocGFyYW1zLnNpemUoKSAhPSBpbmRpY2VzLnNpemUoKSkgewotICAgICAgICAgICAgQUxPR0UoIkNvbXBvbmVudCByZXR1cm5zIHdyb25nIG51bWJlciBvZiBwYXJhbXM6IGV4cGVjdGVkICV6dSBhY3R1YWwgJXp1IiwKLSAgICAgICAgICAgICAgICAgICAgaW5kaWNlcy5zaXplKCksIHBhcmFtcy5zaXplKCkpOwotICAgICAgICAgICAgcmV0dXJuIFVOS05PV05fRVJST1I7Ci0gICAgICAgIH0KICAgICAgICAgaWYgKHVzYWdlKSB7CiAgICAgICAgICAgICBpZiAodXNhZ2UudmFsdWUgJiBDMk1lbW9yeVVzYWdlOjpDUFVfUkVBRCkgewogICAgICAgICAgICAgICAgIGNvbmZpZy0+bUlucHV0Rm9ybWF0LT5zZXRJbnQzMigidXNpbmctc3ctcmVhZC1vZnRlbiIsIHRydWUpOwpAQCAtOTU2LDYgKzEyMzAsNyBAQAogICAgICAgICAgICAgICAgIEMyQW5kcm9pZE1lbW9yeVVzYWdlIGFuZHJvaWRVc2FnZShDMk1lbW9yeVVzYWdlKHVzYWdlLnZhbHVlKSk7CiAgICAgICAgICAgICAgICAgY29uZmlnLT5tSVNDb25maWctPm1Vc2FnZSA9IGFuZHJvaWRVc2FnZS5hc0dyYWxsb2NVc2FnZSgpOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgY29uZmlnLT5tSW5wdXRGb3JtYXQtPnNldEludDY0KCJhbmRyb2lkLl9DMk1lbW9yeVVzYWdlIiwgdXNhZ2UudmFsdWUpOwogICAgICAgICB9CiAKICAgICAgICAgLy8gTk9URTogd2UgZG9uJ3QgYmxpbmRseSB1c2UgY2xpZW50IHNwZWNpZmllZCBpbnB1dCBzaXplIGlmIHNwZWNpZmllZCBhcyBjbGllbnRzCkBAIC0xMDEyLDEzICsxMjg3LDE0IEBACiAgICAgICAgIGludDMyX3QgY2xpZW50UHJlcGVuZDsKICAgICAgICAgaWYgKChjb25maWctPm1Eb21haW4gJiBDb25maWc6OklTX1ZJREVPKQogICAgICAgICAgICAgICAgICYmIChjb25maWctPm1Eb21haW4gJiBDb25maWc6OklTX0VOQ09ERVIpCi0gICAgICAgICAgICAgICAgJiYgbXNnLT5maW5kSW50MzIoS0VZX1BSRVBFTkRfSEVBREVSU19UT19TWU5DX0ZSQU1FUywgJmNsaWVudFByZXBlbmQpCisgICAgICAgICAgICAgICAgJiYgbXNnLT5maW5kSW50MzIoS0VZX1BSRVBFTkRfSEVBREVSX1RPX1NZTkNfRlJBTUVTLCAmY2xpZW50UHJlcGVuZCkKICAgICAgICAgICAgICAgICAmJiBjbGllbnRQcmVwZW5kCiAgICAgICAgICAgICAgICAgJiYgKCFwcmVwZW5kIHx8IHByZXBlbmQudmFsdWUgIT0gUFJFUEVORF9IRUFERVJfVE9fQUxMX1NZTkMpKSB7Ci0gICAgICAgICAgICBBTE9HRSgiRmFpbGVkIHRvIHNldCBLRVlfUFJFUEVORF9IRUFERVJTX1RPX1NZTkNfRlJBTUVTIik7CisgICAgICAgICAgICBBTE9HRSgiRmFpbGVkIHRvIHNldCBLRVlfUFJFUEVORF9IRUFERVJfVE9fU1lOQ19GUkFNRVMiKTsKICAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7CiAgICAgICAgIH0KIAorICAgICAgICBpbnQzMl90IGNvbXBvbmVudENvbG9yRm9ybWF0ID0gMDsKICAgICAgICAgaWYgKChjb25maWctPm1Eb21haW4gJiAoQ29uZmlnOjpJU19WSURFTyB8IENvbmZpZzo6SVNfSU1BR0UpKSkgewogICAgICAgICAgICAgLy8gcHJvcGFnYXRlIEhEUiBzdGF0aWMgaW5mbyB0byBvdXRwdXQgZm9ybWF0IGZvciBib3RoIGVuY29kZXJzIGFuZCBkZWNvZGVycwogICAgICAgICAgICAgLy8gaWYgY29tcG9uZW50IHN1cHBvcnRzIHRoaXMgaW5mbywgd2Ugd2lsbCB1cGRhdGUgZnJvbSBjb21wb25lbnQsIGJ1dCBvbmx5IHRoZSByYXcgcG9ydCwKQEAgLTEwMzEsMTIgKzEzMDcsMTYgQEAKIAogICAgICAgICAgICAgLy8gU2V0IGRlc2lyZWQgY29sb3IgZm9ybWF0IGZyb20gY29uZmlndXJhdGlvbiBwYXJhbWV0ZXIKICAgICAgICAgICAgIGludDMyX3QgZm9ybWF0OwotICAgICAgICAgICAgaWYgKG1zZy0+ZmluZEludDMyKCJhbmRyb2lkLl9jb2xvci1mb3JtYXQiLCAmZm9ybWF0KSkgewotICAgICAgICAgICAgICAgIGlmIChjb25maWctPm1Eb21haW4gJiBDb25maWc6OklTX0VOQ09ERVIpIHsKLSAgICAgICAgICAgICAgICAgICAgY29uZmlnLT5tSW5wdXRGb3JtYXQtPnNldEludDMyKEtFWV9DT0xPUl9GT1JNQVQsIGZvcm1hdCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgY29uZmlnLT5tT3V0cHV0Rm9ybWF0LT5zZXRJbnQzMihLRVlfQ09MT1JfRk9STUFULCBmb3JtYXQpOworICAgICAgICAgICAgaWYgKCFtc2ctPmZpbmRJbnQzMihLRVlfQ09MT1JfRk9STUFULCAmZm9ybWF0KSkgeworICAgICAgICAgICAgICAgIGZvcm1hdCA9IGRlZmF1bHRDb2xvckZvcm1hdDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChjb25maWctPm1Eb21haW4gJiBDb25maWc6OklTX0VOQ09ERVIpIHsKKyAgICAgICAgICAgICAgICBjb25maWctPm1JbnB1dEZvcm1hdC0+c2V0SW50MzIoS0VZX0NPTE9SX0ZPUk1BVCwgZm9ybWF0KTsKKyAgICAgICAgICAgICAgICBpZiAobXNnLT5maW5kSW50MzIoImFuZHJvaWQuX2NvbG9yLWZvcm1hdCIsICZjb21wb25lbnRDb2xvckZvcm1hdCkpIHsKKyAgICAgICAgICAgICAgICAgICAgY29uZmlnLT5tSW5wdXRGb3JtYXQtPnNldEludDMyKCJhbmRyb2lkLl9jb2xvci1mb3JtYXQiLCBjb21wb25lbnRDb2xvckZvcm1hdCk7CiAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBjb25maWctPm1PdXRwdXRGb3JtYXQtPnNldEludDMyKEtFWV9DT0xPUl9GT1JNQVQsIGZvcm1hdCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIApAQCAtMTA2NCw4ICsxMzQ0LDg2IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAotICAgICAgICBBTE9HRCgic2V0dXAgZm9ybWF0cyBpbnB1dDogJXMgYW5kIG91dHB1dDogJXMiLAotICAgICAgICAgICAgICAgIGNvbmZpZy0+bUlucHV0Rm9ybWF0LT5kZWJ1Z1N0cmluZygpLmNfc3RyKCksCisgICAgICAgIHN0ZDo6dW5pcXVlX3B0cjxDMlBhcmFtPiBjb2xvclRyYW5zZmVyUmVxdWVzdFBhcmFtOworICAgICAgICBmb3IgKHN0ZDo6dW5pcXVlX3B0cjxDMlBhcmFtPiAmcGFyYW0gOiBwYXJhbXMpIHsKKyAgICAgICAgICAgIGlmIChwYXJhbS0+aW5kZXgoKSA9PSBjb2xvckFzcGVjdHNSZXF1ZXN0SW5kZXgud2l0aFN0cmVhbSgwdSkpIHsKKyAgICAgICAgICAgICAgICBBTE9HSSgiZm91bmQgY29sb3IgdHJhbnNmZXIgcmVxdWVzdCBwYXJhbSIpOworICAgICAgICAgICAgICAgIGNvbG9yVHJhbnNmZXJSZXF1ZXN0UGFyYW0gPSBzdGQ6Om1vdmUocGFyYW0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGludDMyX3QgY29sb3JUcmFuc2ZlclJlcXVlc3QgPSAwOworICAgICAgICBpZiAoY29uZmlnLT5tRG9tYWluICYgKENvbmZpZzo6SVNfSU1BR0UgfCBDb25maWc6OklTX1ZJREVPKQorICAgICAgICAgICAgICAgICYmICFzZGtQYXJhbXMtPmZpbmRJbnQzMigiY29sb3ItdHJhbnNmZXItcmVxdWVzdCIsICZjb2xvclRyYW5zZmVyUmVxdWVzdCkpIHsKKyAgICAgICAgICAgIGNvbG9yVHJhbnNmZXJSZXF1ZXN0ID0gMDsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChjb2xvclRyYW5zZmVyUmVxdWVzdCAhPSAwKSB7CisgICAgICAgICAgICBpZiAoY29sb3JUcmFuc2ZlclJlcXVlc3RQYXJhbSAmJiAqY29sb3JUcmFuc2ZlclJlcXVlc3RQYXJhbSkgeworICAgICAgICAgICAgICAgIEMyU3RyZWFtQ29sb3JBc3BlY3RzSW5mbzo6b3V0cHV0ICppbmZvID0KKyAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8QzJTdHJlYW1Db2xvckFzcGVjdHNJbmZvOjpvdXRwdXQgKj4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sb3JUcmFuc2ZlclJlcXVlc3RQYXJhbS5nZXQoKSk7CisgICAgICAgICAgICAgICAgaWYgKCFDMk1hcHBlcjo6bWFwKGluZm8tPnRyYW5zZmVyLCAmY29sb3JUcmFuc2ZlclJlcXVlc3QpKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbG9yVHJhbnNmZXJSZXF1ZXN0ID0gMDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGNvbG9yVHJhbnNmZXJSZXF1ZXN0ID0gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNvbmZpZy0+bUlucHV0Rm9ybWF0LT5zZXRJbnQzMigiY29sb3ItdHJhbnNmZXItcmVxdWVzdCIsIGNvbG9yVHJhbnNmZXJSZXF1ZXN0KTsKKyAgICAgICAgfQorCisgICA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gICAgYnVmZmVyID0gR3JhcGhpY0Jsb2NrQnVmZmVyOjpBbGxvY2F0ZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWctPm1JbnB1dEZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9jaywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBbXShzaXplX3Qgc2l6ZSkgLT4gc3A8QUJ1ZmZlcj4geyByZXR1cm4gbmV3IEFCdWZmZXIoc2l6ZSk7IH0pOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIEFMT0dEKCJGYWlsZWQgdG8gYWxsb2NhdGUgYSBncmFwaGljIGJsb2NrICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKHdpZHRoPSVkIGhlaWdodD0lZCBwaXhlbEZvcm1hdD0ldSB1c2FnZT0lbGx4KSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGgsIGhlaWdodCwgcGl4ZWxGb3JtYXQsIChsb25nIGxvbmcpYmxvY2tVc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgbWVhbnMgdGhhdCBieXRlIGJ1ZmZlciBtb2RlIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBjb25maWd1cmF0aW9uCisgICAgICAgICAgICAgICAgICAgIC8vIGFueXdheS4gU2tpcCBzZXR0aW5nIHN0cmlkZS92c3RyaWRlIHRvIGlucHV0IGZvcm1hdC4KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGJ1ZmZlcikgeworICAgICAgICAgICAgICAgICAgICBzcDxBQnVmZmVyPiBpbWFnZURhdGEgPSBidWZmZXItPmdldEltYWdlRGF0YSgpOworICAgICAgICAgICAgICAgICAgICBNZWRpYUltYWdlMiAqaW1nID0gbnVsbHB0cjsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGltYWdlRGF0YSAmJiBpbWFnZURhdGEtPmRhdGEoKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIGltYWdlRGF0YS0+c2l6ZSgpID49IHNpemVvZihNZWRpYUltYWdlMikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGltZyA9IChNZWRpYUltYWdlMiopaW1hZ2VEYXRhLT5kYXRhKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGltZyAmJiBpbWctPm1OdW1QbGFuZXMgPiAwICYmIGltZy0+bVR5cGUgIT0gaW1nLT5NRURJQV9JTUFHRV9UWVBFX1VOS05PV04pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3Qgc3RyaWRlID0gaW1nLT5tUGxhbmVbMF0ubVJvd0luYzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy0+bUlucHV0Rm9ybWF0LT5zZXRJbnQzMihLRVlfU1RSSURFLCBzdHJpZGUpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGltZy0+bU51bVBsYW5lcyA+IDEgJiYgc3RyaWRlID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDY0X3Qgb2Zmc2V0RGVsdGEgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50NjRfdClpbWctPm1QbGFuZVsxXS5tT2Zmc2V0IC0gKGludDY0X3QpaW1nLT5tUGxhbmVbMF0ubU9mZnNldDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob2Zmc2V0RGVsdGEgJSBzdHJpZGUgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHZzdHJpZGUgPSBpbnQzMl90KG9mZnNldERlbHRhIC8gc3RyaWRlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnLT5tSW5wdXRGb3JtYXQtPnNldEludDMyKEtFWV9TTElDRV9IRUlHSFQsIHZzdHJpZGUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dEKCJDYW5ub3QgcmVwb3J0IGFjY3VyYXRlIHNsaWNlIGhlaWdodDogIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJvZmZzZXREZWx0YSA9ICVsbGQgc3RyaWRlID0gJWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChsb25nIGxvbmcpb2Zmc2V0RGVsdGEsIHN0cmlkZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgQUxPR0QoInNldHVwIGZvcm1hdHMgaW5wdXQ6ICVzIiwKKyAgICAgICAgICAgICAgICBjb25maWctPm1JbnB1dEZvcm1hdC0+ZGVidWdTdHJpbmcoKS5jX3N0cigpKTsKKyAgICAgICAgQUxPR0QoInNldHVwIGZvcm1hdHMgb3V0cHV0OiAlcyIsCiAgICAgICAgICAgICAgICAgY29uZmlnLT5tT3V0cHV0Rm9ybWF0LT5kZWJ1Z1N0cmluZygpLmNfc3RyKCkpOwogICAgICAgICByZXR1cm4gT0s7CiAgICAgfTsKQEAgLTEwNzYsNiArMTQzNCw4IEBACiAgICAgTXV0ZXhlZDxzdGQ6OnVuaXF1ZV9wdHI8Q29uZmlnPj46OkxvY2tlZCBjb25maWdMb2NrZWQobUNvbmZpZyk7CiAgICAgY29uc3Qgc3RkOjp1bmlxdWVfcHRyPENvbmZpZz4gJmNvbmZpZyA9ICpjb25maWdMb2NrZWQ7CiAKKyAgICBjb25maWctPnF1ZXJ5Q29uZmlndXJhdGlvbihjb21wKTsKKwogICAgIG1DYWxsYmFjay0+b25Db21wb25lbnRDb25maWd1cmVkKGNvbmZpZy0+bUlucHV0Rm9ybWF0LCBjb25maWct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1hdCk7CiB9CiAKQEAgLTEzMjQsNiArMTcxNyw3IEBACiAgICAgICAgIG91dHB1dEZvcm1hdCA9IGNvbmZpZy0+bU91dHB1dEZvcm1hdCA9IGNvbmZpZy0+bU91dHB1dEZvcm1hdC0+ZHVwKCk7CiAgICAgICAgIGlmIChjb25maWctPm1JbnB1dFN1cmZhY2UpIHsKICAgICAgICAgICAgIGVycjIgPSBjb25maWctPm1JbnB1dFN1cmZhY2UtPnN0YXJ0KCk7CisgICAgICAgICAgICBjb25maWctPm1JbnB1dFN1cmZhY2VEYXRhc3BhY2UgPSBjb25maWctPm1JbnB1dFN1cmZhY2UtPmdldERhdGFzcGFjZSgpOwogICAgICAgICB9CiAgICAgICAgIGJ1ZmZlcnNCb3VuZFRvQ29kZWMgPSBjb25maWctPm1CdWZmZXJzQm91bmRUb0NvZGVjOwogICAgIH0KQEAgLTE0MTEsNiArMTgwNSw3IEBACiAgICAgICAgIGlmIChjb25maWctPm1JbnB1dFN1cmZhY2UpIHsKICAgICAgICAgICAgIGNvbmZpZy0+bUlucHV0U3VyZmFjZS0+ZGlzY29ubmVjdCgpOwogICAgICAgICAgICAgY29uZmlnLT5tSW5wdXRTdXJmYWNlID0gbnVsbHB0cjsKKyAgICAgICAgICAgIGNvbmZpZy0+bUlucHV0U3VyZmFjZURhdGFzcGFjZSA9IEhBTF9EQVRBU1BBQ0VfVU5LTk9XTjsKICAgICAgICAgfQogICAgIH0KICAgICB7CkBAIC0xNDYwLDYgKzE4NTUsNyBAQAogICAgICAgICBpZiAoY29uZmlnLT5tSW5wdXRTdXJmYWNlKSB7CiAgICAgICAgICAgICBjb25maWctPm1JbnB1dFN1cmZhY2UtPmRpc2Nvbm5lY3QoKTsKICAgICAgICAgICAgIGNvbmZpZy0+bUlucHV0U3VyZmFjZSA9IG51bGxwdHI7CisgICAgICAgICAgICBjb25maWctPm1JbnB1dFN1cmZhY2VEYXRhc3BhY2UgPSBIQUxfREFUQVNQQUNFX1VOS05PV047CiAgICAgIC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gICAgQ29uZmlnOjpXYXRjaGVyPEMyU3RyZWFtSW5pdERhdGFJbmZvOjpvdXRwdXQ+IGluaXREYXRhID0KLSAgICAgICAgICAgICAgICBjb25maWctPndhdGNoPEMyU3RyZWFtSW5pdERhdGFJbmZvOjpvdXRwdXQ+KCk7Ci0gICAgICAgICAgICBpZiAoIXdvcmstPndvcmtsZXRzLmVtcHR5KCkKLSAgICAgICAgICAgICAgICAgICAgJiYgKHdvcmstPndvcmtsZXRzLmZyb250KCktPm91dHB1dC5mbGFncwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICYgQzJGcmFtZURhdGE6OkZMQUdfRElTQ0FSRF9GUkFNRSkgPT0gMCkgeworICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPGNvbnN0IEMyU3RyZWFtSW5pdERhdGFJbmZvOjpvdXRwdXQ+IGluaXREYXRhOworICAgICAgICAgICAgc3A8QU1lc3NhZ2U+IG91dHB1dEZvcm1hdCA9IG51bGxwdHI7CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTXV0ZXhlZDxzdGQ6OnVuaXF1ZV9wdHI8Q29uZmlnPj46OkxvY2tlZCBjb25maWdMb2NrZWQobUNvbmZpZyk7CisgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp1bmlxdWVfcHRyPENvbmZpZz4gJmNvbmZpZyA9ICpjb25maWdMb2NrZWQ7CisgICAgICAgICAgICAgICAgQ29uZmlnOjpXYXRjaGVyPEMyU3RyZWFtSW5pdERhdGFJbmZvOjpvdXRwdXQ+IGluaXREYXRhV2F0Y2hlciA9CisgICAgICAgICAgICAgICAgICAgIGNvbmZpZy0+d2F0Y2g8QzJTdHJlYW1Jbml0RGF0YUluZm86Om91dHB1dD4oKTsKKyAgICAgICAgICAgICAgICBpZiAoIXdvcmstPndvcmtsZXRzLmVtcHR5KCkKKyAgICAgICAgICAgICAgICAgICAgICAgICYmICh3b3JrLT53b3JrbGV0cy5mcm9udCgpLT5vdXRwdXQuZmxhZ3M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ZmZlciBpbmZvIHRvIGNvbmZpZworICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxzdGQ6OnVuaXF1ZV9wdHI8QzJQYXJhbT4+IHVwZGF0ZXM7CisgICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3Qgc3RkOjp1bmlxdWVfcHRyPEMyUGFyYW0+ICZwYXJhbQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogd29yay0+d29ya2xldHMuZnJvbnQoKS0+b3V0cHV0LmNvbmZpZ1VwZGF0ZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlcy5wdXNoX2JhY2soQzJQYXJhbTo6Q29weSgqcGFyYW0pKTsKICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IEMyQ29uc3RHcmFwaGljQmxvY2sgJmJsb2NrIDogYnVmLT5kYXRhKCkuZ3JhcGhpY0Jsb2NrcygpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBBTE9HVigiZ290IG91dHB1dCBidWZmZXIgd2l0aCBjcm9wICV1LCV1KyV1LCV1IGFuZCBzaXplICV1LCV1IiwKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgYmxvY2suY3JvcCgpLmxlZnQsIGJsb2NrLmNyb3AoKS50b3AsCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgIGJsb2NrLmNyb3AoKS53aWR0aCwgYmxvY2suY3JvcCgpLmhlaWdodCwKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgYmxvY2sud2lkdGgoKSwgYmxvY2suaGVpZ2h0KCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlcy5lbXBsYWNlX2JhY2sobmV3IEMyU3RyZWFtQ3JvcFJlY3RJbmZvOjpvdXRwdXQoc3RyZWFtLCBibG9jay5jcm9wKCkpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZXMuZW1wbGFjZV9iYWNrKG5ldyBDMlN0cmVhbVBpY3R1cmVTaXplSW5mbzo6b3V0cHV0KAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW0sIGJsb2NrLmNyb3AoKS53aWR0aCwgYmxvY2suY3JvcCgpLmhlaWdodCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7IC8vIGZvciBub3cgb25seSBkbyB0aGUgZmlyc3QgYmxvY2sKKyAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQgc3RyZWFtID0gMDsKKyAgICAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjpzaGFyZWRfcHRyPEMyQnVmZmVyPj4gJm91dHB1dEJ1ZmZlcnMgPQorICAgICAgICAgICAgICAgICAgICAgICAgd29yay0+d29ya2xldHMuZnJvbnQoKS0+b3V0cHV0LmJ1ZmZlcnM7CisgICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3Qgc3RkOjpzaGFyZWRfcHRyPEMyQnVmZmVyPiAmYnVmIDogb3V0cHV0QnVmZmVycykgeworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBzdGQ6OnNoYXJlZF9wdHI8Y29uc3QgQzJJbmZvPiAmaW5mbyA6IGJ1Zi0+aW5mbygpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbW92ZSBhbGwgaW5mbyBpbnRvIG91dHB1dC1zdHJlYW0gIzAgZG9tYWluCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlcy5lbXBsYWNlX2JhY2soCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDMlBhcmFtOjpDb3B5QXNTdHJlYW0oKmluZm8sIHRydWUgLyogb3V0cHV0ICovLCBzdHJlYW0pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8QzJDb25zdEdyYXBoaWNCbG9jaz4gYmxvY2tzID0gYnVmLT5kYXRhKCkuZ3JhcGhpY0Jsb2NrcygpOworICAgICAgICAgICAgICAgICAgICAgICAgLy8gZm9yIG5vdyBvbmx5IGRvIHRoZSBmaXJzdCBibG9jaworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFibG9ja3MuZW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFMT0dWKCJnb3Qgb3V0cHV0IGJ1ZmZlciB3aXRoIGNyb3AgJXUsJXUrJXUsJXUgYW5kIHNpemUgJXUsJXUiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgYmxvY2suY3JvcCgpLmxlZnQsIGJsb2NrLmNyb3AoKS50b3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICBibG9jay5jcm9wKCkud2lkdGgsIGJsb2NrLmNyb3AoKS5oZWlnaHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICBibG9jay53aWR0aCgpLCBibG9jay5oZWlnaHQoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQzJDb25zdEdyYXBoaWNCbG9jayAmYmxvY2sgPSBibG9ja3NbMF07CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlcy5lbXBsYWNlX2JhY2sobmV3IEMyU3RyZWFtQ3JvcFJlY3RJbmZvOjpvdXRwdXQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW0sIGJsb2NrLmNyb3AoKSkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgKytzdHJlYW07CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgKytzdHJlYW07Ci0gICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKGNvbmZpZy0+dXBkYXRlQ29uZmlndXJhdGlvbih1cGRhdGVzLCBjb25maWctPm1PdXRwdXREb21haW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UsCi0gICAgICAgICAgICAgICAgICAgIEMyU3RyZWFtSGRyMTBQbHVzSW5mbzo6b3V0cHV0OjpQQVJBTV9UWVBFLAotICAgICAgICAgICAgICAgICAgICBDMlN0cmVhbVBpeGVsQXNwZWN0UmF0aW9JbmZvOjpvdXRwdXQ6OlBBUkFNX1RZUEUsCi0gICAgICAgICAgICAgICAgICAgIEMyU3RyZWFtU3VyZmFjZVNjYWxpbmdJbmZvOjpvdXRwdXQ6OlBBUkFNX1RZUEUKLSAgICAgICAgICAgICAgICB9OwotICAgICAgICAgICAgICAgIGZvciAoY29uc3Qgc3RkOjpzaGFyZWRfcHRyPEMyQnVmZmVyPiAmYnVmIDogd29yay0+d29ya2xldHMuZnJvbnQoKS0+b3V0cHV0LmJ1ZmZlcnMpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGJ1Zi0+ZGF0YSgpLmdyYXBoaWNCbG9ja3MoKS5zaXplKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoQzJQYXJhbTo6SW5kZXggaXggOiBzdGRHZnhJbmZvcykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYnVmLT5oYXNJbmZvKGl4KSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBDMlBhcmFtICpwYXJhbSA9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWctPmdldENvbmZpZ1BhcmFtZXRlclZhbHVlKGl4LndpdGhTdHJlYW0oc3RyZWFtKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYXJhbSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyUGFyYW0+IGluZm8oQzJQYXJhbTo6Q29weSgqcGFyYW0pKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1Zi0+c2V0SW5mbyhzdGQ6OnN0YXRpY19wb2ludGVyX2Nhc3Q8QzJJbmZvPihpbmZvKSk7CisgICAgICAgICAgICAgICAgICAgIC8vIGNvcHkgc3RhbmRhcmQgaW5mb3MgdG8gZ3JhcGhpYyBidWZmZXJzIGlmIG5vdCBhbHJlYWR5IHByZXNlbnQgKG90aGVyd2lzZSwgd2UKKyAgICAgICAgICAgICAgICAgICAgLy8gbWF5IG92ZXJ3cml0ZSB0aGUgYWN0dWFsIGludGVybWVkaWF0ZSB2YWx1ZSB3aXRoIGEgZmluYWwgdmFsdWUpCisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA9IDA7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0YXRpYyBDMlBhcmFtOjpJbmRleCBzdGRHZnhJbmZvc1tdID0geworICAgICAgICAgICAgICAgICAgICAgICAgQzJTdHJlYW1Sb3RhdGlvbkluZm86Om91dHB1dDo6UEFSQU1fVFlQRSwKKyAgICAgICAgICAgICAgICAgICAgICAgIEMyU3RyZWFtQ29sb3JBc3BlY3RzSW5mbzo6b3V0cHV0OjpQQVJBTV9UWVBFLAorICAgICAgICAgICAgICAgICAgICAgICAgQzJTdHJlYW1EYXRhU3BhY2VJbmZvOjpvdXRwdXQ6OlBBUkFNX1RZUEUsCisgICAgICAgICAgICAgICAgICAgICAgICBDMlN0cmVhbUhkclN0YXRpY0luZm86Om91dHB1dDo6UEFSQU1fVFlQRSwKKyAgICAgICAgICAgICAgICAgICAgICAgIEMyU3RyZWFtSGRyMTBQbHVzSW5mbzo6b3V0cHV0OjpQQVJBTV9UWVBFLAorICAgICAgICAgICAgICAgICAgICAgICAgQzJTdHJlYW1QaXhlbEFzcGVjdFJhdGlvSW5mbzo6b3V0cHV0OjpQQVJBTV9UWVBFLAorICAgICAgICAgICAgICAgICAgICAgICAgQzJTdHJlYW1TdXJmYWNlU2NhbGluZ0luZm86Om91dHB1dDo6UEFSQU1fVFlQRQorICAgICAgICAgICAgICAgICAgICB9OworICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IHN0ZDo6c2hhcmVkX3B0cjxDMkJ1ZmZlcj4gJmJ1ZiA6IG91dHB1dEJ1ZmZlcnMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChidWYtPmRhdGEoKS5ncmFwaGljQmxvY2tzKCkuc2l6ZSgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChDMlBhcmFtOjpJbmRleCBpeCA6IHN0ZEdmeEluZm9zKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYnVmLT5oYXNJbmZvKGl4KSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQzJQYXJhbSAqcGFyYW0gPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy0+Z2V0Q29uZmlnUGFyYW1ldGVyVmFsdWUoaXgud2l0aFN0cmVhbShzdHJlYW0pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYXJhbSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMlBhcmFtPiBpbmZvKEMyUGFyYW06OkNvcHkoKnBhcmFtKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmLT5zZXRJbmZvKHN0ZDo6c3RhdGljX3BvaW50ZXJfY2FzdDxDMkluZm8+KGluZm8pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICsrc3RyZWFtOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICsrc3RyZWFtOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChjb25maWctPm1JbnB1dFN1cmZhY2UpIHsKLSAgICAgICAgICAgICAgICBjb25maWctPm1JbnB1dFN1cmZhY2UtPm9uSW5wdXRCdWZmZXJEb25lKHdvcmstPmlucHV0Lm9yZGluYWwuZnJhbWVJbmRleCk7CisgICAgICAgICAgICAgICAgaWYgKGNvbmZpZy0+bUlucHV0U3VyZmFjZSkgeworICAgICAgICAgICAgICAgICAgICBpZiAod29yay0+d29ya2xldHMuZW1wdHkoKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgIXdvcmstPndvcmtsZXRzLmJhY2soKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgKHdvcmstPndvcmtsZXRzLmJhY2soKS0+b3V0cHV0LmZsYWdzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiBDMkZyYW1lRGF0YTo6RkxBR19JTkNPTVBMRVRFKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjb25maWctPm1JbnB1dFN1cmZhY2UtPm9uSW5wdXRCdWZmZXJEb25lKHdvcmstPmlucHV0Lm9yZGluYWwuZnJhbWVJbmRleCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGluaXREYXRhV2F0Y2hlci5oYXNDaGFuZ2VkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgaW5pdERhdGEgPSBpbml0RGF0YVdhdGNoZXIudXBkYXRlKCk7CisgICAgICAgICAgICAgICAgICAgIEFtZW5kT3V0cHV0Rm9ybWF0V2l0aENvZGVjU3BlY2lmaWNEYXRhKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXREYXRhLT5tLnZhbHVlLCBpbml0RGF0YS0+ZmxleENvdW50KCksIGNvbmZpZy0+bUNvZGluZ01lZGlhVHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWctPm1PdXRwdXRGb3JtYXQpOworIC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7CisgICAgICAgIGlmIChoYW5kbGUgIT0gbnVsbHB0ciAmJiB2aWRlb1R1bm5lbFNpZGViYW5kLT5mbGV4Q291bnQoKSkgeworICAgICAgICAgICAgbWVtY3B5KGhhbmRsZS0+ZGF0YSwgdmlkZW9UdW5uZWxTaWRlYmFuZC0+bS52YWx1ZXMsCisgICAgICAgICAgICAgICAgICAgIHNpemVvZihpbnQzMl90KSAqIHZpZGVvVHVubmVsU2lkZWJhbmQtPmZsZXhDb3VudCgpKTsKKyAgICAgICAgICAgIHJldHVybiBPSzsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJldHVybiBOT19NRU1PUlk7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIFVOS05PV05fRVJST1I7Cit9CisKIHZvaWQgQ0NvZGVjOjppbml0aWF0ZVJlbGVhc2VJZlN0dWNrKCkgewogICAgIHN0ZDo6c3RyaW5nIG5hbWU7CiAgICAgYm9vbCBwZW5kaW5nRGVhZGxpbmUgPSBmYWxzZTsKQEAgLTE4OTksNyArMjQyMSw0NCBAQAogICAgICAgICAgICAgcGVuZGluZ0RlYWRsaW5lID0gdHJ1ZTsKICAgICAgICAgfQogICAgIH0KLSAgICBpZiAobmFtZS5lbXB0eSgpKSB7CisgICAgYm9vbCB0dW5uZWxlZCA9IGZhbHNlOworICAgIGJvb2wgaXNNZWRpYVR5cGVLbm93biA9IGZhbHNlOworICAgIHsKKyAgICAgICAgc3RhdGljIGNvbnN0IHN0ZDo6c2V0PHN0ZDo6c3RyaW5nPiBrS25vd25NZWRpYVR5cGVzeworICAgICAgICAgICAgTUlNRVRZUEVfVklERU9fVlA4LAorICAgICAgICAgICAgTUlNRVRZUEVfVklERU9fVlA5LAorICAgICAgICAgICAgTUlNRVRZUEVfVklERU9fQVYxLAorICAgICAgICAgICAgTUlNRVRZUEVfVklERU9fQVZDLAorICAgICAgICAgICAgTUlNRVRZUEVfVklERU9fSEVWQywKKyAgICAgICAgICAgIE1JTUVUWVBFX1ZJREVPX01QRUc0LAorICAgICAgICAgICAgTUlNRVRZUEVfVklERU9fSDI2MywKKyAgICAgICAgICAgIE1JTUVUWVBFX1ZJREVPX01QRUcyLAorICAgICAgICAgICAgTUlNRVRZUEVfVklERU9fUkFXLAorICAgICAgICAgICAgTUlNRVRZUEVfVklERU9fRE9MQllfVklTSU9OLAorCisgICAgICAgICAgICBNSU1FVFlQRV9BVURJT19BTVJfTkIsCisgICAgICAgICAgICBNSU1FVFlQRV9BVURJT19BTVJfV0IsCisgICAgICAgICAgICBNSU1FVFlQRV9BVURJT19NUEVHLAorICAgICAgICAgICAgTUlNRVRZUEVfQVVESU9fQUFDLAorICAgICAgICAgICAgTUlNRVRZUEVfQVVESU9fUUNFTFAsCisgICAgICAgICAgICBNSU1FVFlQRV9BVURJT19WT1JCSVMsCisgICAgICAgICAgICBNSU1FVFlQRV9BVURJT19PUFVTLAorICAgICAgICAgICAgTUlNRVRZUEVfQVVESU9fRzcxMV9BTEFXLAorICAgICAgICAgICAgTUlNRVRZUEVfQVVESU9fRzcxMV9NTEFXLAorICAgICAgICAgICAgTUlNRVRZUEVfQVVESU9fUkFXLAorICAgICAgICAgICAgTUlNRVRZUEVfQVVESU9fRkxBQywKKyAgICAgICAgICAgIE1JTUVUWVBFX0FVRElPX01TR1NNLAorICAgICAgICAgICAgTUlNRVRZUEVfQVVESU9fQUMzLAorICAgICAgICAgICAgTUlNRVRZUEVfQVVESU9fRUFDMywKKworICAgICAgICAgICAgTUlNRVRZUEVfSU1BR0VfQU5EUk9JRF9IRUlDLAorICAgICAgICB9OworICAgICAgICBNdXRleGVkPHN0ZDo6dW5pcXVlX3B0cjxDb25maWc+Pjo6TG9ja2VkIGNvbmZpZ0xvY2tlZChtQ29uZmlnKTsKKyAgICAgICAgY29uc3Qgc3RkOjp1bmlxdWVfcHRyPENvbmZpZz4gJmNvbmZpZyA9ICpjb25maWdMb2NrZWQ7CisgICAgICAgIHR1bm5lbGVkID0gY29uZmlnLT5tVHV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hbGwgdG8gJXMgZXhjZWVkZWQgdGltZW91dCIsIGNvbXBOYW1lLmNfc3RyKCksIG5hbWUuY19zdHIoKSk7CisKICAgICBpbml0aWF0ZVJlbGVhc2UoZmFsc2UpOwogICAgIG1DYWxsYmFjay0+b25FcnJvcihVTktOT1dOX0VSUk9SLCBBQ1RJT05fQ09ERV9GQVRBTCk7CiB9CkBAIC0xOTkxLDcgKzI1NjEsNyBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKHBhcmFtLT50eXBlKCkgPT0gQzJQb3J0QWxsb2NhdG9yc1R1bmluZzo6aW5wdXQ6OlBBUkFNX1RZUEUpIHsKICAgICAgICAgICAgICAgICBtSW5wdXRBbGxvY2F0b3JzLnJlc2V0KAotICAgICAgICAgICAgICAgICAgICAgICAgQzJQb3J0QWxsb2NhdG9yc1R1bmluZzo6aW5wdXQ6OkZyb20ocGFyYW1zWzBdLmdldCgpKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBDMlBvcnRBbGxvY2F0b3JzVHVuaW5nOjppbnB1dDo6RnJvbShwYXJhbSkpOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIG1Jbml0U3RhdHVzID0gT0s7CkBAIC0yMTQxLDcgKzI3MTEsMTEgQEAKICAgICAgICAgICAgICptYXhVc2FnZSA9IDA7CiAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgfQotICAgICAgICAqbWluVXNhZ2UgfD0gc3VwcG9ydGVkLnZhbHVlc1swXS51NjQ7CisgICAgICAgIGlmIChzdXBwb3J0ZWQudmFsdWVzLnNpemUoKSA+IDEpIHsKKyAgICAgICAgICAgICptaW5Vc2FnZSB8PSBzdXBwb3J0ZWQudmFsdWVzWzFdLnU2NDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICptaW5Vc2FnZSB8PSBzdXBwb3J0ZWQudmFsdWVzWzBdLnU2NDsKKyAgICAgICAgfQogICAgICAgICBpbnQ2NF90IGN1cnJlbnRN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BxdWV1ZWRCdWZmZXJzOwogICAgIHNwPENvZGVjMkJ1ZmZlcj4gY29weTsKKyAgICBib29sIHVzZXNGcmFtZVJlYXNzZW1ibGVyID0gZmFsc2U7CiAKICAgICBpZiAoYnVmZmVyLT5zaXplKCkgPiAwdSkgewogICAgICAgICBNdXRleGVkPElucHV0Pjo6TG9ja2VkIGlucHV0KG1JbnB1dCk7CkBAIC0yNDUsMzAgKzI1OCw1NSBAQAogICAgICAgICAgICAgICAgICAgICAgICJidWZmZXIgc3RhcnZhdGlvbiBvbiBjb21wb25lbnQuIiwgbU5hbWUpOwogICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIHdvcmstPmlucHV0LmJ1ZmZlcnMucHVzaF9iYWNrKGMyYnVmZmVyKTsKLSAgICAgICAgcXVldWVkQnVmZmVycy5wdXNoX2JhY2soYzJidWZmZXIpOworICAgICAgICBpZiAoaW5wdXQtPmZyYW1lUmVhc3NlbWJsZXIpIHsKKyAgICAgICAgICAgIHVzZXNGcmFtZVJlYXNzZW1ibGVyID0gdHJ1ZTsKKyAgICAgICAgICAgIGlucHV0LT5mcmFtZVJlYXNzZW1ibGVyLnByb2Nlc3MoYnVmZmVyLCAmaXRlbXMpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaW50MzJfdCBjdm8gPSAwOworICAgICAgICAgICAgaWYgKGJ1ZmZlci0+bWV0YSgpLT5maW5kSW50MzIoImN2byIsICZjdm8pKSB7CisgICAgICAgICAgICAgICAgaW50MzJfdCByb3RhdGlvbiA9IGN2byAlIDM2MDsKKyAgICAgICAgICAgICAgICAvLyBjaGFuZ2Ugcm90YXRpb24gdG8gY291bnRlci1jbG9jayB3aXNlLgorICAgICAgICAgICAgICAgIHJvdGF0aW9uID0gKChyb3RhdGlvbiA8PSAwKSA/IDAgOiAzNjApIC0gcm90YXRpb247CisKKyAgICAgICAgICAgICAgICBNdXRleGVkPE91dHB1dFN1cmZhY2U+OjpMb2NrZWQgb3V0cHV0KG1PdXRwdXRTdXJmYWNlKTsKKyAgICAgICAgICAgICAgICB1aW50NjRfdCBmcmFtZUluZGV4ID0gd29yay0+aW5wdXQub3JkaW5hbC5mcmFtZUluZGV4LnBlZWt1KCk7CisgICAgICAgICAgICAgICAgb3V0cHV0LT5yb3RhdGlvbltmcmFtZUluZGV4XSA9IHJvdGF0aW9uOworICAgICAgICAgICAgfQorICAgICAgICAgICAgd29yay0+aW5wdXQuYnVmZmVycy5wdXNoX2JhY2soYzJidWZmZXIpOworICAgICAgICAgICAgaWYgKGVuY3J5cHRlZEJsb2NrKSB7CisgICAgICAgICAgICAgICAgd29yay0+aW5wdXQuaW5mb0J1ZmZlcnMuZW1wbGFjZV9iYWNrKEMySW5mb0J1ZmZlcjo6Q3JlYXRlTGluZWFyQnVmZmVyKAorICAgICAgICAgICAgICAgICAgICAgICAga1BhcmFtSW5kZXhFbmNyeXB0ZWRCdWZmZXIsCisgICAgICAgICAgICAgICAgICAgICAgICBlbmNyeXB0ZWRCbG9jay0+c2hhcmUoMCwgYmxvY2tTaXplLCBDMkZlbmNlKCkpKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KICAgICB9IGVsc2UgaWYgKGVvcykgewogICAgICAgICBmbGFncyB8PSBDMkZyYW1lRGF0YTo6RkxBR19FTkRfT0ZfU1RSRUFNOwogICAgIH0KLSAgICB3b3JrLT5pbnB1dC5mbGFncyA9IChDMkZyYW1lRGF0YTo6ZmxhZ3NfdClmbGFnczsKLSAgICAvLyBUT0RPOiBmaWxsIGluZm8ncworICAgIGlmICh1c2VzRnJhbWVSZWFzc2VtYmxlcikgeworICAgICAgICBpZiAoIWl0ZW1zLmVtcHR5KCkpIHsKKyAgICAgICAgICAgIGl0ZW1zLmZyb250KCktPmlucHV0LmNvbmZpZ1VwZGF0ZSA9IHN0ZDo6bW92ZShtUGFyYW1zVG9CZVNldCk7CisgICAgICAgICAgICBtRnJhbWVJbmRleCA9IChpdGVtcy5iYWNrKCktPmlucHV0Lm9yZGluY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QotICAgICAgICBpdGVtcy5jbGVhcigpOwogICAgICAgICBpdGVtcy5wdXNoX2JhY2soc3RkOjptb3ZlKHdvcmspKTsKLQotICAgICAgICBtUGlwZWxpbmVXYXRjaGVyLmxvY2soKS0+b25Xb3JrUXVldWVkKAotICAgICAgICAgICAgICAgIHF1ZXVlZEZyYW1lSW5kZXgsCi0gICAgICAgICAgICAgICAgc3RkOjptb3ZlKHF1ZXVlZEJ1ZmZlcnMpLAotICAgICAgICAgICAgICAgIFBpcGVsaW5lV2F0Y2hlcjo6Q2xvY2s6Om5vdygpKTsKLSAgICAgICAgZXJyID0gbUNvbXBvbmVudC0+cXVldWUoJml0ZW1zKTsKLSAgICAgICAgaWYgKGVyciAhPSBDMl9PSykgewotICAgICAgICAgICAgbVBpcGVsaW5lV2F0Y2hlci5sb2NrKCktPm9uV29ya0RvbmUocXVldWVkRnJhbWVJbmRleCk7Ci0gICAgICAgIH0KICAgICB9Ci0gICAgaWYgKGVyciA9PSBDMl9PSykgeworICAgIGMyX3N0YXR1c190IGVyciA9IEMyX09LOworICAgIGlmICghaXRlbXMuZW1wdHkoKSkgeworICAgICAgICB7CisgICAgICAgICAgICBNdXRleGVkPFBpcGVsaW5lV2F0Y2hlcj46OkxvY2tlZCB3YXRjaGVyKG1QaXBlbGluZVdhdGNoZXIpOworICAgICAgICAgICAgUGlwZWxpbmVXYXRjaGVyOjpDbG9jazo6dGltZV9wb2ludCBub3cgPSBQaXBlbGluZVdhdGNoZXI6OkNsb2NrOjpub3coKTsKKyAgICAgICAgICAgIGZvciAoY29uc3Qgc3RkOjp1bmlxdWVfcHRyPEMyV29yaz4gJndvcmsgOiBpdGVtcykgeworICAgICAgICAgICAgICAgIHdhdGNoZXItPm9uV29ya1F1ZXVlZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIHdvcmstPmlucHV0Lm9yZGluYWwuZnJhbWVJbmRleC5wZWVrdSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3Iod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hY2U+OjpMb2NrZWQgb3V0cHV0KG1PdXRwdXRTdXJmYWNlKTsKKyAgICAgICAgaWYgKG91dHB1dC0+c3VyZmFjZSA9PSBudWxscHRyKSB7CisgICAgICAgICAgICBBTE9HSSgiWyVzXSBjYW5ub3QgcmVuZGVyIGJ1ZmZlciB3aXRob3V0IHN1cmZhY2UiLCBtTmFtZSk7CisgICAgICAgICAgICByZXR1cm4gT0s7CisgICAgICAgIH0KKyAgICAgICAgaW50NjRfdCBmcmFtZUluZGV4OworICAgICAgICBidWZmZXItPm1ldGEoKS0+ZmluZEludDY0KCJmcmFtZUluZGV4IiwgJmZyYW1lSW5kZXgpOworICAgICAgICBpZiAob3V0cHV0LT5yb3RhdGlvbi5jb3VudChmcmFtZUluZGV4KSAhPSAwKSB7CisgICAgICAgICAgICBhdXRvIGl0ID0gb3V0cHV0LT5yb3RhdGlvbi5maW5kKGZyYW1lSW5kZXgpOworICAgICAgICAgICAgcXVhcnRlcnMgPSAoaXQtPnNlY29uZCAvIDkwKSAmIDM7CisgICAgICAgICAgICBvdXRwdXQtPnJvdGF0aW9uLmVyYXNlKGl0KTsKKyAgICAgICAgfQorICAgIH0KKwogICAgIHVpbnQzMl90IHRyYW5zZm9ybSA9IDA7CiAgICAgc3dpdGNoIChxdWFydGVycykgewogICAgICAgICBjYXNlIDA6IC8vIG5vIHJvdGF0aW9uCkBAIC03MzgsMTQgKzgzMiw2IEBACiAgICAgICAgIGhkcjEwUGx1c0luZm8ucmVzZXQoKTsKICAgICB9CiAKLSAgICB7Ci0gICAgICAgIE11dGV4ZWQ8T3V0cHV0U3VyZmFjZT46OkxvY2tlZCBvdXRwdXQobU91dHB1dFN1cmZhY2UpOwotICAgICAgICBpZiAob3V0cHV0LT5zdXJmYWNlID09IG51bGxwdHIpIHsKLSAgICAgICAgICAgIEFMT0dJKCJbJXNdIGNhbm5vdCByZW5kZXIgYnVmZmVyIHdpdGhvdXQgc3VyZmFjZSIsIG1OYW1lKTsKLSAgICAgICAgIC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wbGVSYXRlLmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgICAgICBjaGFubmVsQ291bnQuaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgICAgIHBjbUVuY29kaW5nLmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVyciA9IG1Db21wb25lbnQtPnF1ZXJ5KHN0YWNrUGFyYW1zLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyBDMlBvcnRBbGxvY2F0b3JzVHVuaW5nOjppbnB1dDo6UEFSQU1fVFlQRSB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzJfRE9OVF9CTE9DSywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwYXJhbXMpOwpAQCAtOTk4LDEwICsxMTE2LDIxIEBACiAgICAgICAgIGlucHV0LT5udW1TbG90cyA9IG51bUlucHV0U2xvdHM7CiAgICAgICAgIGlucHV0LT5leHRyYUJ1ZmZlcnMuZmx1c2goKTsKICAgICAgICAgaW5wdXQtPm51bUV4dHJhU2xvdHMgPSAwdTsKKyAgICAgICAgaWYgKGF1ZGlvRW5jb2RlciAmJiBlbmNvZGVyRnJhbWVTaXplICYmIHNhbXBsZVJhdGUgJiYgY2hhbm5lbENvdW50KSB7CisgICAgICAgICAgICBpbnB1dC0+ZnJhbWVSZWFzc2VtYmxlci5pbml0KAorICAgICAgICAgICAgICAgICAgICBwb29sLAorICAgICAgICAgICAgICAgICAgICB7QzJNZW1vcnlVc2FnZTo6Q1BVX1JFQUQsIEMyTWVtb3J5VXNhZ2U6OkNQVV9XUklURX0sCisgICAgICAgICAgICAgICAgICAgIGVuY29kZXJGcmFtZVNpemUudmFsdWUsCisgICAgICAgICAgICAgICAgICAgIHNhbXBsZVJhdGUudmFsdWUsCisgICAgICAgICAgICAgICAgICAgIGNoYW5uZWxDb3VudC52YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgcGNtRW5jb2Rpbmc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IC8vIHNldCBkZWZhdWx0IGFsbG9jYXRvciBJRC4KICAgICAgICAgICAgIHBvb2xzLT5vdXRwdXRBbGxvY2F0b3JJZCA9IChncmFwaGljKSA/IEMyUGxhdGZvcm1BbGxvY2F0b3JTdG9yZTo6R1JBTExPQwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogcHJlZmVycmVkTGluZWFySWQ7CkBAIC0xMTczLDYgKzEzMDMsMTUgQEAKICAgICAgICAgICAgIG91dHB1dFBvb2xJZF8gPSBwb29scy0+b3V0cHV0UG9vbElkOwogICAgICAgICB9CiAKKyAgICAgICAgaWYgKHByZXZPdXRwdXRQb29sSWQgIT0gQzJCbG9ja1Bvb2w6OkJBU0lDX0xJTkVBUgorICAgICAgICAgICAgICAgICYmIHByZXZPdXRwdXRQb29sSWQgIT0gQzJCbG9ja1Bvb2w6OkJBU0lDX0dSQVBISUMpIHsKKyAgICAgICAgICAgIGMyX3N0YXR1c190IGVyciA9IG1Db21wb25lbnQtPmRlc3Ryb3lCbG9ja1Bvb2wocHJldk91dHB1dFBvb2xJZCk7CisgICAgICAgICAgICBpZiAoZXJyICE9IEMyX09LKSB7CisgICAgICAgICAgICAgICAgQUxPR1coIkZhaWxlZCB0byBjbGVhbiB1cCBwcmV2aW91cyBibG9jayBwb29sICVsbHUgLSAlcyAoJWQpXG4iLAorICAgICAgICAgICAgICAgICAgICAgICAgKHVuc2lnbmVkIGxvbmcgbG9uZykgcHJldk91dHB1dFBvb2xJZCwgYXNTdHJpbmcoZXJyKSwgZXJyKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCiAgICAgICAgIE11dGV4ZWQ8T3V0cHV0Pjo6TG9ja2VkIG91dHB1dChtT3V0cHV0KTsKICAgICAgICAgb3V0cHV0LT5vdXRwdXREZWxheSA9IG91dHB1dERlbGF5VmFsdWU7CiAgICAgICAgIG91dHB1dC0+bnVtU2xvdHMgPSBudW1PdXRwdXRTbG90czsKQEAgLTEyMDAsNyArMTMzOSwxNyBAQAogICAgICAgICAgICAgbUNvbXBvbmVudC0+c2V0T3V0cHV0U3VyZmFjZSgKICAgICAgICAgICAgICAgICAgICAgb3V0cHV0UG9vbElkXywKICAgICAgICAgICAgICAgICAgICAgb3V0cHV0U3VyZmFjZSwKLSAgICAgICAgICAgICAgICAgICAgb3V0cHV0R2VuZXJhdGlvbik7CisgICAgICAgICAgICAgICAgICAgIG91dHB1dEdlbmVyYXRpb24sCisgICAgICAgICAgICAgICAgICAgIG1heERlcXVldWVDb3VudCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyBjb25maWd1cmUgQ1BVIHJlYWQgY29uc3VtZXIgdXNhZ2UKKyAgICAgICAgICAgIEMyU3RyZWFtVXNhZ2VUdW5pbmc6Om91dHB1dCBvdXRwdXRVc2FnZXswdSwgQzJNZW1vcnlVc2FnZTo6Q1BVX1JFQUR9OworICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjp1bmlxdWVfcHRyPEMyU2V0dGluZ1Jlc3VsdD4+IGZhaWx1cmVzOworICAgICAgICAgICAgZXJyID0gbUNvbXBvbmVudC0+Y29uZmlnKHsgJm91dHB1dFVzYWdlIH0sIEMyX01BWV9CTE9DSywgJmZhaWx1cmVzKTsKKyAgICAgICAgICAgIC8vIGRvIG5vdCBwcmludCBlcnJvciBtZXNzYWdlIGZvciBub3cgYXMgbW9zdCBjb21wb25lbnRzIG1heSBub3QgeWV0CisgICAgICAgICAgICAvLyBzdXBwb3J0IHRoaXMgc2V0dGluZworICAgICAgICAgICAgQUxPR0RfSUYoZXJyICE9IEMyX0JBRF9JTkRFWCwgIlslc10gQ29uZmlndXJlZCBvdXRwdXQgdXNhZ2UgWyUjbGx4XSIsCisgICAgICAgICAgICAgICAgICBtTmFtZSwgKGxvbmcgbG9uZylvdXRwdXRVc2FnZS52YWx1ZSk7CiAgICAgICAgIH0KIAogICAgICAgICBpZiAob1N0cmVhbUZvcm1hdC52YWx1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6ZmluZF9pZigKLSAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudElucHV0QnVmZmVycy5iZWdpbigpLAotICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50SW5wdXRCdWZmZXJzLmVuZCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgW2NmZ1NpemUgPSBjb25maWctPnNpemUoKV0oY29uc3QgQ2xpZW50SW5wdXRCdWZmZXImIGIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi5jYXBhY2l0eSA+PSBjZmdTaXplOwotICAgICAgICAgICAgICAgICAgICAgICAgfSk7Ci0gICAgICAgICAgICAgICAgaWYgKGkgPT0gY2xpZW50SW5wdXRCdWZmZXJzLmVuZCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIEFMT0dXKCJbJXNdIG5vIGlucHV0IGJ1ZmZlciBsYXJnZSBlbm91Z2ggZm9yIHRoZSBjb25maWcgIgotICAgICAgICAgICAgICAgICAgICAgICAgICAiKCV6dSBieXRlcykiLAotICAgICAgICAgICAgICAgICAgICAgICAgICBtTmFtZSwgY29uZmlnLT5zaXplKCkpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9fTUVNT1JZOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBzcDxNZWRpYUNvZGVjQnVmZmVyPiBidWZmZXIgPSBpLT5idWZmZXI7Ci0gICAgICAgICAgICAgICAgbWVtY3B5KGJ1ZmZlci0+YmFzZSgpLCBjb25maWctPmRhdGEoKSwgY29uZmlnLT5zaXplKCkpOwotICAgICAgICAgICAgICAgIGJ1ZmZlci0+c2V0UmFuZ2UoMCwgY29uZmlnLT5zaXplKCkpOwotICAgICAgICAgICAgICAgIGJ1ZmZlci0+bWV0YSgpLT5jbGVhcigpOwotICAgICAgICAgICAgICAgIGJ1ZmZlci0+bWV0YSgpLT5zZXRJbnQ2NCgidGltZVVzIiwgMCk7Ci0gICAgICAgICAgICAgICAgYnVmZmVyLT5tZXRhKCktPnNldEludDMyKCJjc2QiLCAxKTsKLSAgICAgICAgICAgICAgICBpZiAocXVldWVJbnB1dEJ1ZmZlckludGVybmFsKGJ1ZmZlcikgIT0gT0spIHsKLSAgICAgICAgICAgICAgICAgICAgQUxPR1coIlslc10gRXJyb3Igd2hpbGUgcXVldWVpbmcgYSBmbHVzaGVkIGNvbmZpZyIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIG1OYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVOS05PV05fRVJST1I7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNsaWVudElucHV0QnVmZmVycy5lcmFzZShpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIGlmIChvU3RyZWFtRm9ybWF0LnZhbHVlID09IEMyQnVmZmVyRGF0YTo6TElORUFSICYmCi0gICAgICAgICAgICAgICAgICAgKCFwcmVwZW5kIHx8IHByZXBlbmQudmFsdWUgPT0gUFJFUEVORF9IRUFERVJfVE9fTk9ORSkpIHsKLSAgICAgICAgICAgIHNwPE1lZGlhQ29kZWNCdWZmZXI+IGJ1ZmZlciA9IGNsaWVudElucHV0QnVmZmVycy5mcm9udCgpLmJ1ZmZlcjsKLSAgICAgICAgICAgIC8vIFdPUktBUk9VTkQ6IFNvbWUgYXBwcyBleHBlY3QgQ1NEIGF2YWlsYWJsZSB3aXRob3V0IHF1ZXVlaW5nCi0gICAgICAgICAgICAvLyAgICAgICAgICAgICBhbnkgaW5wdXQuIFF1ZXVlIGFuIGVtcHR5IGJ1ZmZlciB0byBnZXQgdGhlIENTRC4KLSAgICAgICAgICAgIGJ1ZmZlci0+c2V0UmFuZ2UoMCwgMCk7Ci0gICAgICAgICAgICBidWZmZXItPm1ldGEoKS0+Y2xlYXIoKTsKLSAgICAgICAgICAgIGJ1ZmZlci0+bWV0YSgpLT5zZXRJbnQ2NCgidGltZVVzIiwgMCk7Ci0gICAgICAgICAgICBpZiAocXVldWVJbn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CkuZW1wdHkoKSkgewotICAgICAgICAgICAgICAgIEFMT0dEKCJbJXNdIG5vIGxpbmVhciBjb2RlYyBjb25maWcgZGF0YSBmb3VuZCIsIG1OYW1lKTsKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIEMyUmVhZFZpZXcgdmlldyA9Ci0gICAgICAgICAgICAgICAgICAgIHdvcmstPmlucHV0LmJ1ZmZlcnMuZnJvbnQoKS0+ZGF0YSgpLmxpbmVhckJsb2NrcygpLmZyb250KCkubWFwKCkuZ2V0KCk7Ci0gICAgICAgICAgICBpZiAodmlldy5lcnJvcigpICE9IEMyX09LKSB7Ci0gICAgICAgICAgICAgICAgQUxPR0QoIlslc10gZmFpbGVkIHRvIG1hcCBmbHVzaGVkIGNvZGVjIGNvbmZpZyBkYXRhOiAlZCIsIG1OYW1lLCB2aWV3LmVycm9yKCkpOwotICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY29uZmlncy0+cHVzaF9iYWNrKEFCdWZmZXI6OkNyZWF0ZUFzQ29weSh2aWV3LmRhdGEoKSwgdmlldy5jYXBhY2l0eSgpKSk7Ci0gICAgICAgICAgICBBTE9HVigiWyVzXSBzdGFzaGVkIGZsdXNoZWQgY29kZWMgY29uZmlnIGRhdGEgKHNpemU9JXUpIiwgbU5hbWUsIHZpZXcuY2FwYWNpdHkoKSk7CisgICAgc3RkOjp2ZWN0b3I8dWludDY0X3Q+IGluZGljZXM7CisgICAgc3RkOjpsaXN0PHN0ZDo6dW5pcXVlX3B0cjxDMldvcms+PiBjb25maWdzOworICAgIGZvciAoY29uc3Qgc3RkOjp1bmlxdWVfcHRyPEMyV29yaz4gJndvcmsgOiBmbHVzaGVkV29yaykgeworICAgICAgICBpbmRpY2VzLnB1c2hfYmFjayh3b3JrLT5pbnB1dC5vcmRpbmFsLmZyYW1lSW5kZXgucGVla3UoKSk7CisgICAgICAgIGlmICghKHdvcmstPmlucHV0LmZsYWdzICYgQzJGcmFtZURhdGE6OkZMQUdfQ09ERUNfQ09ORklHKSkgeworICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgIH0KKyAgICAgICAgaWYgKHdvcmstPmlucHV0LmJ1ZmZlcnMuZW1wdHkoKQorICAgICAgICAgICAgICAgIHx8IHdvcmstPmlucHV0LmJ1ZmZlcnMuZnJvbnQoKSA9PSBudWxscHRyCisgICAgICAgICAgICAgICAgfHwgd29yay0+aW5wdXQuYnVmZmVycy5mcm9udCgpLT5kYXRhKCkubGluZWFyQmxvY2tzKCkuZW1wdHkoKSkgeworICAgICAgICAgICAgQUxPR0QoIlslc10gbm8gbGluZWFyIGNvZGVjIGNvbmZpZyBkYXRhIGZvdW5kIiwgbU5hbWUpOworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKyAgICAgICAgc3RkOjp1bmlxdWVfcHRyPEMyV29yaz4gY29weShuZXcgQzJXb3JrKTsKKyAgICAgICAgY29weS0+aW5wdXQuZmxhZ3MgPSBDMkZyYW1lRGF0YTo6ZmxhZ3NfdCh3b3JrLT5pbnB1dC5mbGFncyB8IEMyRnJhbWVEYXRhOjpGTEFHX0RST1BfRlJBTUUpOworICAgICAgICBjb3B5LT5pbnB1dC5vcmRpbmFsID0gd29yay0+aW5wdXQub3JkaW5hbDsKKyAgICAgICAgY29weS0+aW5wdXQub3JkaW5hbC5mcmFtZUluZGV4ID0gbUZyYW1lSW5kZXgrKzsKKyAgICAgICAgY29weS0+aW5wdXQuYnVmZmVycy5pbnNlcnQoCisgICAgICAgICAgICAgICAgY29weS0+aW5wdXQuYnVmZmVycy5iZWdpbigpLAorICAgICAgICAgICAgICAgIHdvcmstPmlucHV0LmJ1ZmZlcnMuYmVnaW4oKSwKKyAgICAgICAgICAgICAgICB3b3JrLT5pbnB1dC5idWZmZXJzLmVuZCgpKTsKKyAgICAgICAgZm9yIChjb25zdCBzdGQ6OnVuaXF1ZV9wdHI8QzJQYXJhbT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Q29tcG9uZW50LT5nZXROYW1lKCkuZmluZCgiLnNlY3VyZSIpICE9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmc6Om5wb3M7Ci0gICAgICAgICAgICAgICAgICAgIG1PdXRwdXQubG9jaygpLT5idWZmZXJzLT5zZXRSZW9yZGVyRGVwdGgoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVvcmRlckRlcHRoLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlslc10gb25Xb3JrRG9uZTogdXBkYXRlZCByZW9yZGVyIGRlcHRoIHRvICV1IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgbU5hbWUsIHJlb3JkZXJEZXB0aC52YWx1ZSk7Ci0gICAgICAgICAgICAgICAgICAgIHNpemVfdCBudW1PdXRwdXRTbG90cyA9IG1PdXRwdXQubG9jaygpLT5udW1TbG90czsKLSAgICAgICAgICAgICAgICAgICAgc2l6ZV90IG51bUlucHV0U2xvdHMgPSBtSW5wdXQubG9jaygpLT5udW1TbG90czsKLSAgICAgICAgICAgICAgICAgICAgTXV0ZXhlZDxPdXRwdXRTdXJmYWNlPjo6TG9ja2VkIG91dHB1dChtT3V0cHV0U3VyZmFjZSk7Ci0gICAgICAgICAgICAgICAgICAgIG91dHB1dC0+bWF4RGVxdWV1ZUJ1ZmZlcnMgPSBudW1PdXRwdXRTbG90cyArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVvcmRlckRlcHRoLnZhbHVlICsga1JlbmRlcmluZ0RlcHRoOwotICAgICAgICAgICAgICAgICAgICBpZiAoIXNlY3VyZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0LT5tYXhEZXF1ZXVlQnVmZmVycyArPSBudW1JbnB1dFNsb3RzOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGlmIChvdXRwdXQtPnN1cmZhY2UpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dC0+c3VyZmFjZS0+c2V0TWF4RGVxdWV1ZWRCdWZmZXJDb3VudCgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0LT5tYXhEZXF1ZXVlQnVmZmVycyk7Ci0gICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgbmV3UmVvcmRlckRlcHRoID0gcmVvcmRlckRlcHRoLnZhbHVlOworICAgICAgICAgICAgICAgICAgICBuZWVkTWF4RGVxdWV1ZUJ1ZmZlckNvdW50VXBkYXRlID0gdHJ1ZTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICBBTE9HRCgiWyVzXSBvbldvcmtEb25lOiBmYWlsZWQgdG8gcmVhZCByZW9yZGVyIGRlcHRoIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgbU5hbWUpOwpAQCAtMTU2MSw3ICsxNjkxLDcgQEAKICAgICAgICAgICAgIGNhc2UgQzJQb3J0UmVvcmRlcktleVNldHRpbmc6OkNPUkVfSU5ERVg6IHsKICAgICAgICAgICAgICAgICBDMlBvcnRSZW9yZGVyS2V5U2V0dGluZzo6b3V0cHV0IHJlb3JkZXJLZXk7CiAgICAgICAgICAgICAgICAgaWYgKHJlb3JkZXJLZXkudXBkYXRlRnJvbSgqcGFyYW0pKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1PdXRwdXQubG9jaygpLT5idWZmZXJzLT5zZXRSZW9yZGVyS2V5KHJlb3JkZXJLZXkudmFsdWUpOworICAgICAgICAgICAgICAgICAgICBuZXdSZW9yZGVyS2V5ID0gcmVvcmRlcktleS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlslc10gb25Xb3JrRG9uZTogdXBkYXRlZCByZW9yZGVyIGtleSB0byAldSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgIG1OYW1lLCByZW9yZGVyS2V5LnZhbHVlKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewpAQCAtMTU5NSw1MyArMTcyNSwzNCBAQAogICAgICAgICAgICAgICAgICAgICBpZiAob3V0cHV0RGVsYXkudXBkYXRlRnJvbSgqcGFyYW0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiWyVzXSBvbldvcmtEb25lOiB1cGRhdGluZyBvdXRwdXQgZGVsYXkgJXUiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU5hbWUsIG91dHB1dERlbGF5LnZhbHVlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgc2VjdXJlID0gbUNvbXBvbmVudC0+Z2V0TmFtZSgpLmZpbmQoIi5zZWN1cmUiKSAhPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZzo6bnBvczsKLSAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKW1QaXBlbGluZVdhdGNoZXIubG9jaygpLT5vdXRwdXREZWxheSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0RGVsYXkudmFsdWUpOworICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQpbVBpcGVsaW5lV2F0Y2hlci5sb2NrKCktPm91dHB1dERlbGF5KG91dHB1dERlbGF5LnZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ld091dHB1dERlbGF5ID0gb3V0cHV0RGVsYXkudmFsdWU7CisgICAgICAgICAgICAgICAgICAgICAgICBuZWVkTWF4RGVxdWV1ZUJ1ZmZlckNvdW50VXBkYXRlID0gdHJ1ZTsKIAotICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBvdXRwdXRCdWZmZXJzQ2hhbmdlZCA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IG51bU91dHB1dFNsb3RzID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCBudW1JbnB1dFNsb3RzID0gbUlucHV0LmxvY2soKS0+bnVtU2xvdHM7Ci0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTXV0ZXhlZDxPdXRwdXQ+OjpMb2NrZWQgb3V0cHV0KG1PdXRwdXQpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghb3V0cHV0LT5idWZmZXJzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0LT5vdXRwdXREZWxheSA9IG91dHB1dERlbGF5LnZhbHVlOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bU91dHB1dFNsb3RzID0gb3V0cHV0RGVsYXkudmFsdWUgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga1Ntb290aG5lc3NGYWN0b3I7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG91dHB1dC0+bnVtU2xvdHMgPCBudW1PdXRwdXRTbG90cykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXQtPm51bVNsb3RzID0gbnVtT3V0cHV0U2xvdHM7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvdXRwdXQtPmJ1ZmZlcnMtPmlzQXJyYXlNb2RlKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE91dHB1dEJ1ZmZlcnNBcnJheSAqYXJyYXkgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChPdXRwdXRCdWZmZXJzQXJyYXkgKilvdXRwdXQtPmJ1ZmZlcnMuZ2V0KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiWyVzXSBvbldvcmtEb25lOiBncm93aW5nIG91dHB1dCBidWZmZXIgYXJyYXkgdG8gJXp1IiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1OYW1lLCBudW1PdXRwdXRTbG90cyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcnJheS0+Z3JvdyhudW1PdXRwdXRTbG90cyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRCdWZmZXJzQ2hhbmdlZCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtT3V0cHV0U2xvdHMgPSBvdXRwdXQtPm51bVNsb3RzOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAob3V0cHV0QnVmZmVyc0NoYW5nZWQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ0NvZGVjQ2FsbGJhY2stPm9uT3V0cHV0QnVmZmVyc0NoYW5nZWQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgZGVwdGggPSBtT3V0cHV0LmxvY2soKS0+YnVmZmVycy0+Z2V0UmVvcmRlckRlcHRoKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBNdXRleGVkPE91dHB1dFN1cmZhY2U+OjpMb2NrZWQgb3V0cHV0KG1PdXRwdXRTdXJmYWNlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dC0+bWF4RGVxdWV1ZUJ1ZmZlcnMgPSBudW1PdXRwdXRTbG90cyArIGRlcHRoICsga1JlbmRlcmluZ0RlcHRoOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWN1cmUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXQtPm1heERlcXVldWVCdWZmZXJzICs9IG51bUlucHV0U2xvdHM7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAob3V0cHV0LT5zdXJmYWNlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0LT5zdXJmYWNlLT5zZXRNYXhEZXF1ZXVlZEJ1ZmZlckNvdW50KG91dHB1dC0+bWF4RGVxdWV1ZUJ1ZmZlcnMpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBDMlBvcnRUdW5uZWxTeXN0ZW1UaW1lOjpDT1JFX0lOREVYOiB7CisgICAgICAgICAgICAgICAgQzJQb3J0VHVubmVsU3lzdGVtVGltZTo6b3V0cHV0IGZyYW1lUmVuZGVyVGltZTsKKyAgICAgICAgICAgICAgICBpZiAoZnJhbWVSZW5kZXJUaW1lLnVwZGF0ZUZyb20oKnBhcmFtKSkgeworICAgICAgICAgICAgICAgICAgICBBTE9HVigiWyVzXSBvbldvcmtEb25lOiBmcmFtZSByZW5kZXJlZCAoc3lzOiVsbGQgbnMsIG1lZGlhOiVsbGQgdXMpIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbU5hbWUsIChsb25nIGxvbmcpZnJhbWVSZW5kZXJUaW1lLnZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAobG9uZyBsb25nKXdvcmtsZXQtPm91dHB1dC5vcmRpbmFsLnRpbWVzdGFtcC5wZWVrbGwoKSk7CisgICAgICAgICAgICAgICAgICAgIG1DQ29kZWNDYWxsYmFjay0+b25PdXRwdXRGcmFtZXNSZW5kZXJlZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB3b3JrbGV0LT5vdXRwdXQub3JkaW5hbC50aW1lc3RhbXAucGVlaygpLCBmcmFtZVJlbmRlclRpbWUudmFsdWUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgQzJTdHJlYW1UdW5uZWxIb2xkUmVuZGVyOjpDT1JFX0lOREVYOiB7CisgICAgICAgICAgICAgICAgQzJTdHJlYW1UdW5uZWxIb2xkUmVuZGVyOjpvdXRwdXQgZmlyc3RUdW5uZWxGcmFtZUhvbGRSZW5kZXI7CisgICAgICAgICAgICAgICAgaWYgKCEod29ya2xldC0+b3V0cHV0LmZsYWdzICYgQzJGcmFtZURhdGE6OkZMQUdfSU5DT01QTEVURSkpIGJyZWFrOworICAgICAgICAgICAgICAgIGlmICghZmlyc3RUdW5uZWxGcmFtZUhvbGRSZW5kZXIudXBkYXRlRnJvbSgqcGFyYW0pKSBicmVhazsKKyAgICAgICAgICAgICAgICBpZiAoZmlyc3RUdW5uZWxGcmFtZUhvbGRSZW5kZXIudmFsdWUgIT0gQzJfVFJVRSkgYnJlYWs7CisgICAgICAgICAgICAgICAgQUxPR1YoIlslc10gb25Xb3JrRG9uZTogZmlyc3QgdHVubmVsIGZyYW1lIHJlYWR5IiwgbU5hbWUpOworICAgICAgICAgICAgICAgIG1DQ29kZWNDYWxsYmFjay0+b25GaXJzdFR1bm5lbEZyYW1lUmVhZHkoKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgQUxPR1YoIlslc10gb25Xb3JrRG9uZTogdW5yZWNvZ25pemVkIGNvbmZpZyB1cGRhdGUgKCUwOFgpIiwKICAgICAgICAgICAgICAgICAgICAgICBtTmFtZSwgcGFyYW0tPmluZGV4KCkpOwpAQCAtMTY2Niw2ICsxNzc3LDU2IEBACiAgICAgICAgICAgICBpbnB1dC0+bnVtU2xvdHMgPSBuZXdOdW1TbG90czsKICAgICAgICAgfQogICAgIH0KKyAgICBzaXplX3QgbnVtT3V0cHV0U2xvdHMgPSAw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dHB1dC0+bnVtU2xvdHMgPSBudW1PdXRwdXRTbG90czsKKyAgICAgICAgICAgICAgICBpZiAob3V0cHV0LT5idWZmZXJzLT5pc0FycmF5TW9kZSgpKSB7CisgICAgICAgICAgICAgICAgICAgIE91dHB1dEJ1ZmZlcnNBcnJheSAqYXJyYXkgPQorICAgICAgICAgICAgICAgICAgICAgICAgKE91dHB1dEJ1ZmZlcnNBcnJheSAqKW91dHB1dC0+YnVmZmVycy5nZXQoKTsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlslc10gb25Xb3JrRG9uZTogZ3Jvd2luZyBvdXRwdXQgYnVmZmVyIGFycmF5IHRvICV6dSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1OYW1lLCBudW1PdXRwdXRTbG90cyk7CisgICAgICAgICAgICAgICAgICAgIGFycmF5LT5ncm93KG51bU91dHB1dFNsb3RzKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0cHV0QnVmZmVyc0NoYW5nZWQgPSB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBudW1PdXRwdXRTbG90cyA9IG91dHB1dC0+bnVtU2xvdHM7CisgICAgfQorICAgIGlmIChvdXRwdXRCdWZmZXJzQ2hhbmdlZCkgeworICAgICAgICBtQ0NvZGVjQ2FsbGJhY2stPm9uT3V0cHV0QnVmZmVyc0NoYW5nZWQoKTsKKyAgICB9CisgICAgaWYgKG5lZWRNYXhEZXF1ZXVlQnVmZmVyQ291bnRVcGRhdGUpIHsKKyAgICAgICAgaW50IG1heERlcXVldWVDb3VudCA9IDA7CisgICAgICAgIHsKKyAgICAgICAgICAgIE11dGV4ZWQ8T3V0cHV0U3VyZmFjZT46OkxvY2tlZCBvdXRwdXQobU91dHB1dFN1cmZhY2UpOworICAgICAgICAgICAgbWF4RGVxdWV1ZUNvdW50ID0gb3V0cHV0LT5tYXhEZXF1ZXVlQnVmZmVycyA9CisgICAgICAgICAgICAgICAg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sKKyAgICAgICAgICAgIEFMT0dEKCJbJXNdIHVwZGF0aW5nIHN0cmlkZSA9ICVkLCB3aWR0aDogJWQsIGhlaWdodDogJWQiLAorICAgICAgICAgICAgICAgICAgbU5hbWUsIHN0cmlkZSwgaW1nLT5tV2lkdGgsIGltZy0+bUhlaWdodCk7CiAgICAgICAgICAgICBpZiAoaW1nLT5tTnVtUGxhbmVzID4gMSAmJiBzdHJpZGUgPiAwKSB7Ci0gICAgICAgICAgICAgICAgaW50MzJfdCB2c3RyaWRlID0gKGltZy0+bVBsYW5lWzFdLm1PZmZzZXQgLSBpbWctPm1QbGFuZVswXS5tT2Zmc2V0KSAvIHN0cmlkZTsKLSAgICAgICAgICAgICAgICBuZXdGb3JtYXQtPnNldEludDMyKEtFWV9TTElDRV9IRUlHSFQsIHZzdHJpZGUpOworICAgICAgICAgICAgICAgIGludDY0X3Qgb2Zmc2V0RGVsdGEgPQorICAgICAgICAgICAgICAgICAgICAoaW50NjRfdClpbWctPm1QbGFuZVsxXS5tT2Zmc2V0IC0gKGludDY0X3QpaW1nLT5tUGxhbmVbMF0ubU9mZnNldDsKKyAgICAgICAgICAgICAgICBpbnQzMl90IHZzdHJpZGUgPSBpbnQzMl90KG9mZnNldERlbHRhIC8gc3RyaWRlKTsKKyAgICAgICAgICAgICAgICBtRm9ybWF0V2l0aEltYWdlRGF0YS0+c2V0SW50MzIoS0VZX1NMSUNFX0hFSUdIVCwgdnN0cmlkZSk7CiAgICAgICAgICAgICAgICAgQUxPR0QoIlslc10gdXBkYXRpbmcgdnN0cmlkZSA9ICVkIiwgbU5hbWUsIHZzdHJpZGUpOworICAgICAgICAgICAgICAgIGJ1ZmZlci0+c2V0UmFuZ2UoCisgICAgICAgICAgICAgICAgICAgICAgICBpbWctPm1QbGFuZVswXS5tT2Zmc2V0LAorICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyLT5zaXplKCkgLSBpbWctPm1QbGFuZVswXS5tT2Zmc2V0KTsKICAgICAgICAgICAg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kBAIC01MTIsNyArNTM3LDcgQEAKICAgICAgICAgICAgIHJldHVybiBDMlZhbHVlKCk7CiAgICAgICAgIH0pKTsKICAgICAvLyByZW1vdmUgd2hlbiBjb2RlY3Mgc3dpdGNoIHRvIFBBUkFNS0VZCi0gICAgZGVwcmVjYXRlZChDb25maWdNYXBwZXIoS0VZX1BSRVBFTkRfSEVBREVSU19UT19TWU5DX0ZSQU1FUywKKyAgICBkZXByZWNhdGVkKENvbmZpZ01hcHBlcihLRVlfUFJFUEVORF9IRUFERVJfVE9fU1lOQ19GUkFNRVMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNvZGluZy5hZGQtY3NkLXRvLXN5bmMtZnJhbWVzIiwgInZhbHVlIikKICAgICAgICAgICAgICAgIC5saW1pdFRvKEQ6OkVOQ09ERVIgJiBEOjpWSURFTykpOwogICAgIC8vIGNvbnZlcnQgdG8gdGltZXN0YW1wIGJhc2UKQEAgLTcwOCw2ICs3MzMsMTcgQEAKICAgICAgICAgICAgIHJldHVybiBDMlZhbHVlKCk7CiAgICAgICAgIH0pKTsKIAorICAgIGFkZChDb25maWdNYXBwZXIoS0VZX0FBQ19QUk9GSUxFLCBDMl9QQVJBTUtFWV9QUk9GSUxFX0xFVkVMLCAicHJvZmlsZSIpCisgICAgICAgIC5saW1pdFRvKEQ6OkFVRElPICYgRDo6RU5DT0RFUiAmIChEOjpDT05GSUcgfCBEOjpQQVJBTSkpCisgICAgICAgIC53aXRoTWFwcGVyKFttYXBwZXJdKEMyVmFsdWUgdikgLT4gQzJWYWx1ZSB7CisgICAgICAgICAgICBDMkNvbmZpZzo6cHJvZmlsZV90IGMyID0gUFJPRklMRV9VTlVTRUQ7CisgICAgICAgICAgICBpbnQzMl90IHNkazsKKyAgICAgICAgICAgIGlmIChtYXBwZXIgJiYgdi5nZXQoJnNkaykgJiYgbWFwcGVyLT5tYXBQcm9maWxlKHNkaywgJmMyKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBjMjsKKyAgIC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OCBAQAogICAgICAgICBjb25zdCBSZWZsZWN0ZWRQYXJhbVVwZGF0ZXI6OkRpY3QgJnJlZmxlY3RlZCwKICAgICAgICAgRG9tYWluIHBvcnREb21haW4pIGNvbnN0IHsKICAgICBzcDxBTWVzc2FnZT4gbXNnID0gbmV3IEFNZXNzYWdlOwotICAgIGZvciAoY29uc3Qgc3RkOjpwYWlyPHN0ZDo6c3RyaW5nLCBzdGQ6OnZlY3RvcjxDb25maWdNYXBwZXI+PiAmZWwgOiBtU3RhbmRhcmRQYXJhbXMtPmdldEtleXMoKSkgewotICAgICAgICBmb3IgKGNvbnN0IENvbmZpZ01hcHBlciAmY20gOiBlbC5zZWNvbmQpIHsKKyAgICBmb3IgKGNvbnN0IGF1dG8gJltrZXksIG1hcHBlcnNdIDogbVN0YW5kYXJkUGFyYW1zLT5nZXRLZXlzKCkpIHsKKyAgICAgICAgZm9yIChjb25zdCBDb25maWdNYXBwZXIgJmNtIDogbWFwcGVycykgewogICAgICAgICAgICAgaWYgKChjbS5kb21haW4oKSAmIHBvcnREb21haW4pID09IDAgLy8gaW5wdXQtb3V0cHV0LWNvZGVkLXJhdwogICAgICAgICAgICAgICAgIHx8IChjbS5kb21haW4oKSAmIG1Eb21haW4pICE9IG1Eb21haW4gLy8gY29tcG9uZW50IGRvbWFpbiArIGtpbmQgKHRoZXNlIG11c3QgbWF0Y2gpCiAgICAgICAgICAgICAgICAgfHwgKGNtLmRvbWFpbigpICYgSVNfUkVBRCkgPT0gMCkgewpAQCAtMTIwNSwyNiArMTI1MiwyNiBAQAogICAgICAgICAgICAgICAgIEFMT0dEKCJ1bmV4cGVjdGVkIHVudHlwZWQgcXVlcnkgdmFsdWUgZm9yIGtleTogJXMiLCBjbS5wYXRoKCkuY19zdHIoKSk7CiAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBtc2ctPnNldEl0ZW0oZWwuZmlyc3QuY19zdHIoKSwgaXRlbSk7CisgICAgIC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c2VudApAQCAtMTI5OSw5ICsxMzQ2LDQ2IEBACiAgICAgICAgIH0KICAgICB9CiAKKyAgICAvLyBSZW1vdmUgS0VZX0FBQ19TQlJfTU9ERSBmcm9tIFNESyBtZXNzYWdlIGlmIGl0IGlzIG91dHNpZGUgc3VwcG9ydGVkIHJhbmdlCisgICAgLy8gYXMgU0RLIGRvZXNuJ3QgaGF2ZSBhIHdheSB0byBzaWduYWwgZGVmYXVsdCBzYnIgbW9kZSBiYXNlZCBvbiBwcm9maWxlIGFuZAorICAgIC8vIHJlcXVpcmVzIHRoYXQgdGhlIGtleSBpc24ndCBwcmVzZW50IGluIGZvcm1hdCB0byBzaWduYWwgdGhhdAorICAgIGludCBzYnJNb2RlOworICAgIGlmIChtc2ctPmZpbmRJbnQzMihLRVlfQUFDX1NCUl9NT0RFLCAmc2JyTW9kZSkgJiYgKHNick1vZGUgPCAwIHx8IHNick1vZGUgPiAyKSkgeworICAgICAgICBtc2ctPnJlbW92ZUVudHJ5QXQobXNnLT5maW5kRW50cnlCeU5hbWUoS0VZX0FBQ19TQlJfTU9ERSkpOworICAgIH0KKwogICAgIHsgLy8gY29udmVydCBjb2xvciBpbmZvCisgICAgICAgIC8vIG1vdmUgZGVmYXVsdCBjb2xvciB0byBjb2xvciBhc3BlY3QgaWYgbm90IHJlYWQgZnJvbSB0aGUgY29tcG9uZW50CisgICAgICAgIGludDMyX3QgdG1wOworICAgICAgICBpbnQzMl90IHJhbmdlOworICAgICAgICBpZiAobXNnLT5maW5kSW50MzIoImRlZmF1bHQtY29sb3ItcmFuZ2UiLCAmcmFuZ2UpKSB7CisgICAgICAgICAgICBpZiAoIW1zZy0+ZmluZEludDMyKEtFWV9DT0xPUl9SQU5HRSwgJnRtcCkpIHsKKyAgICAgICAgICAgICAgICBtc2ctPnNldEludDMyKEtFWV9DT0xPUl9SQU5HRSwgcmFuZ2UpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbXNnLT5yZW1vdmVFbnRyeUF0KG1zZy0+ZmluZEVudHJ5QnlOYW1lKCJkZWZhdWx0LWNvbG9yLXJhbmdlIikpOworICAgICAgICB9CisgICAgICAgIGludDMyX3QgdHJhbnNmZXI7CisgICAgICAgIGlmIChtc2ctPmZpbmRJbnQzMigiZGVmYXVsdC1jb2xvci10cmFuc2ZlciIsICZ0cmFuc2ZlcikpIHsKKyAgICAgICAgICAgIGlmICghbXNnLT5maW5kSW50MzIoS0VZX0NPTE9SX1RSQU5TRkVSLCAmdG1wKSkgeworICAgICAgICAgICAgICAgIG1zZy0+c2V0SW50MzIoS0VZX0NPTE9SX1RSQU5TRkVSLCB0cmFuc2Zlcik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtc2ctPnJlbW92ZUVudHJ5QXQobXNnLT5maW5kRW50cnlCeU5hbWUoImRlZmF1bHQtY29sb3ItdHJhbnNmZXIiKSk7CisgICAgICAgIH0KICAgICAgICAgQzJDb2xvcjo6cHJpbWFyaWVzX3QgcHJpbWFyaWVzOworICAgICAgICBpZiAobXNnLT5maW5kSW50MzIoImRlZmF1bHQtY29sb3ItcHJpbWFyaWVzIiwgKGludDMyX3QqKSZwcmltYXJpZXMpKSB7CisgICAgICAgICAgICBpZiAoIW1zZy0+ZmluZEludDMyKCJjb2xvci1wcmltYXJpZXMiLCAmdG1wKSkgeworICAgICAgICAgICAgICAgIG1zZy0+c2V0SW50MzIoImNvbG9yLXByaW1hcmllcyIsIHByaW1hcmllcyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtc2ctPnJlbW92ZUVudHJ5QXQobXNnLT5maW5kRW50cnlCeU5hbWUoImRlZmF1bHQtY29sb3ItcHJpbWFyaWVzIikpOworICAgICAgICB9CiAgICAgICAgIEMyQ29sb3I6Om1hdHJpeF90IG1hdHJpeDsKKyAgICAgICAgaWYgKG1zZy0+ZmluZEludDMyKCJkZWZhdWx0LWNvbG9yLW1hdHJpeCIsIChpbnQzMl90KikmbWF0cml4KSkgeworICAgICAgICAgICAgaWYgKCFtc2ctPm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FzcGFjZSgpOworICAgICAgICAgICAgQ29sb3JVdGlsczo6Y29udmVydERhdGFTcGFjZVRvVjAoZGF0YXNwYWNlKTsKKyAgICAgICAgICAgIGludDMyX3Qgc3RhbmRhcmQ7CisgICAgICAgICAgICBDb2xvclV0aWxzOjpnZXRDb2xvckNvbmZpZ0Zyb21EYXRhU3BhY2UoZGF0YXNwYWNlLCAmcmFuZ2UsICZzdGFuZGFyZCwgJnRyYW5zZmVyKTsKKyAgICAgICAgICAgIGlmIChyYW5nZSAhPSAwKSB7CisgICAgICAgICAgICAgICAgbXNnLT5zZXRJbnQzMihLRVlfQ09MT1JfUkFOR0UsIHJhbmdlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChzdGFuZGFyZCAhPSAwKSB7CisgICAgICAgICAgICAgICAgbXNnLT5zZXRJbnQzMihLRVlfQ09MT1JfU1RBTkRBUkQsIHN0YW5kYXJkKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICh0cmFuc2ZlciAhPSAwKSB7CisgICAgICAgICAgICAgICAgbXNnLT5zZXRJbnQzMihLRVlfQ09MT1JfVFJBTlNGRVIsIHRyYW5zZmVyKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1zZy0+c2V0SW50MzIoImFuZHJvaWQuX2RhdGFzcGFjZSIsIGRhdGFzcGFjZSk7CisgICAgICAgIH0KKwogICAgICAgICAvLyBIRFIgc3RhdGljIGluZm8KIAogICAgICAgICBDMkhkclN0YXRpY01ldGFkYXRhU3RydWN0IGhkcjsKQEAgLTEzOTMsMjIgKzE0OTMsMjIgQEAKICAgICAgICAgICAgICAgICBtZXRhLnNUeXBlMS5tTWluRGlzcGxheUx1bWluYW5jZSA9IGhkci5tYXN0ZXJpbmcubWluTHVtaW5hbmNlIC8gMC4wMDAxICsgMC41OwogICAgICAgICAgICAgICAgIG1ldGEuc1R5cGUxLm1NYXhDb250ZW50TGlnaHRMZXZlbCA9IGhkci5tYXhDbGwgKy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CisgICAgfQorICAgIHJldHVybiBPSzsKK30KKworc3RhdHVzX3QgQ0NvZGVjQ29uZmlnOjpkZXNjcmliZShjb25zdCBzdGQ6OnN0cmluZyAmbmFtZSwgQ29kZWNQYXJhbWV0ZXJEZXNjcmlwdG9yICpkZXNjKSB7CisgICAgaWYgKCFkZXNjKSB7CisgICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgfQorICAgIC8vIFRPRE86IGV4cGFuZCB0byBzdGFuZGFyZCBwYXJhbXMKKyAgICBkZXNjLT5uYW1lID0gbmFtZTsKKyAgICBzd2l0Y2ggKG1QYXJhbVVwZGF0ZXItPmdldFR5cGVGb3JLZXkobmFtZSkpIHsKKyAgICAgICAgY2FzZSBDMkZpZWxkRGVzY3JpcHRvcjo6SU5UMzI6CisgICAgICAgIGNhc2UgQzJGaWVsZERlc2NyaXB0b3I6OlVJTlQzMjoKKyAgICAgICAgY2FzZSBDMkZpZWxkRGVzY3JpcHRvcjo6Q05UUjMyOgorICAgICAgICAgICAgZGVzYy0+dHlwZSA9IEFNZXNzYWdlOjprVHlwZUludDMyOworICAgICAgICAgICAgcmV0dXJuIE9LOworICAgICAgICBjYXNlIEMyRmllbGREZXNjcmlwdG9yOjpJTlQ2NDoKKyAgICAgICAgY2FzZSBDMkZpZWxkRGVzY3JpcHRvcjo6VUlOVDY0OgorICAgICAgICBjYXNlIEMyRmllbGREZXNjcmlwdG9yOjpDTlRSNjQ6CisgICAgICAgICAgICBkZXNjLT50eXBlID0gQU1lc3NhZ2U6OmtUeXBlSW50NjQ7CisgICAgICAgICAgICByZXR1cm4gT0s7CisgICAgICAgIGNhc2UgQzJGaWVsZERlc2NyaXB0b3I6OkZMT0FUOgorICAgICAgICAgICAgZGVzYy0+dHlwZSA9IEFNZXNzYWdlOjprVHlwZUZsb2F0OworICAgICAgICAgICAgcmV0dXJuIE9LOworICAgICAgICBjYXNlIEMyRmllbGREZXNjcmlwdG9yOjpTVFJJTkc6CisgICAgICAgICAgICBkZXNj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kIHBsYW5lcyBmb3IgWVVWIGxheW91dCIsIGxheW91dC5udW1QbGFuZXMpOwogICAgICAgICAgICAgICAgICAgICBtSW5pdENoZWNrID0gQkFEX1ZBTFVFOwogICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChsYXlvdXQucGxhbmVzWzBdLmNoYW5uZWwgIT0gQzJQbGFuZUluZm86OkNIQU5ORUxfWQotICAgICAgICAgICAgICAgICAgICAgICAgfHwgbGF5b3V0LnBsYW5lc1sxXS5jaGFubmVsICE9IEMyUGxhbmVJbmZvOjpDSEFOTkVMX0NCCi0gICAgICAgICAgICAgICAgICAgICAgICB8fCBsYXlvdXQucGxhbmVzWzJdLmNoYW5uZWwgIT0gQzJQbGFuZUluZm86OkNIQU5ORUxfQ1IKLSAgICAgICAgICAgICAgICAgICAgICAgIHx8IGxheW91dC5wbGFuZXNbMF0uY29sU2FtcGxpbmcgIT0gMQotICAgICAgICAgICAgICAgICAgICAgICAgfHwgbGF5b3V0LnBsYW5lc1swXS5yb3dTYW1wbGluZyAhPSAxCi0gICAgICAgICAgICAgICAgICAgICAgICB8fCBsYXlvdXQucGxhbmVzWzFdLmNvbFNhbXBsaW5nICE9IDIKLSAgICAgICAgICAgICAgICAgICAgICAgIHx8IGxheW91dC5wbGFuZXNbMV0ucm93U2FtcGxpbmcgIT0gMgotICAgICAgICAgICAgICAgICAgICAgICAgfHwgbGF5b3V0LnBsYW5lc1syXS5jb2xTYW1wbGluZyAhPSAyCi0gICAgICAgICAgICAgICAgICAgICAgICB8fCBsYXlvdXQucGxhbmVzWzJdLnJvd1NhbXBsaW5nICE9IDIpIHsKLSAgICAgICAgICAgICAgICAgICAgQUxPR0QoIkNvbnZlcnRlcjogbm90IFlVVjQyMCBmb3IgWVVWIGxheW91dCIpOworICAgICAgICAgICAgICAgIEMyUGxhbmVJbmZvIHlQbGFuZSA9IGxheW91dC5wbGFuZXNbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1ldOworICAgICAgICAgICAgICAgIEMyUGxhbmVJbmZvIHVQbGFuZSA9IGxheW91dC5wbGFuZXNbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1VdOworICAgICAgICAgICAgICAgIEMyUGxhbmVJbmZvIHZQbGFuZSA9IGxheW91dC5wbGFuZXNbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1ZdOworICAgICAgICAgICAgICAgIGlmICh5UGxhbmUuY2hhbm5lbCAhPSBDMlBsYW5lSW5mbzo6Q0hBTk5FTF9ZCisgICAgICAgICAgICAgICAgICAgICAgICB8fCB1UGxhbmUuY2hhbm5lbCAhPSBDMlBsYW5lSW5mbzo6Q0hBTk5FTF9DQgorICAgICAgICAgICAgICAgICAgICAgICAgfHwgdlBsYW5lLmNoYW5uZWwgIT0gQzJQbGFuZUluZm86OkNIQU5ORUxfQ1IpIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR0QoIkNvbnZlcnRlcjogbm90IFlVViBsYXlvdXQiKTsKICAgICAgICAgICAgICAgICAgICAgbUluaXRDaGVjayA9IEJBRF9WQUxVRTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBzd2l0Y2ggKG1Db2xvckZvcm1hdCkgewotICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdFlVVjQyMEZsZXhpYmxlOgotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjb3B5KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdHJ5IHRvIG1hcCBkaXJlY3RseS4gY2hlY2sgaWYgdGhlIHBsYW5lcyBhcmUgbmVhciBvbmUgYW5vdGhlcgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKm1pblB0ciA9IG1WaWV3LmRhdGEoKVswXTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90ICptYXhQdHIgPSBtVmlldy5kYXRhKClbMF07Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBwbGFuZVNpemUgPSAwOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodWludDMyX3QgaSA9IDA7IGkgPCBsYXlvdXQubnVtUGxhbmVzOyArK2kpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQzJQbGFuZUluZm8gJnBsYW5lID0gbGF5b3V0LnBsYW5lc1tpXTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3NpemVfdCBtaW5PZmZzZXQgPSBwbGFuZS5taW5PZmZzZXQobVdpZHRoLCBtSGVpZ2h0KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3NpemVfdCBtYXhPZmZzZXQgPSBwbGFuZS5tYXhPZmZzZXQobVdpZHRoLCBtSGVpZ2h0KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1pblB0ciA+IG1WaWV3LmRhdGEoKVtpXSArIG1pbk9mZnNldCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWluUHRyID0gbVZpZXcuZGF0YSgpW2ldICsgbWluT2Zmc2V0OwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXhQdHIgPCBtVmlldy5kYXRhKClbaV0gKyBtYXhPZmZzZXQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heFB0ciA9IG1WaWV3LmRhdGEoKVtpXSArIG1heE9mZnNldDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbGFuZVNpemUgKz0gc3RkOjphYnMocGxhbmUucm93SW5jKSAqIGFsaWduKG1IZWlnaHQsIDY0KQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gcGxhbmUucm93U2FtcGxpbmcgLyBwbGFuZS5jb2xTYW1wbGluZwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICogZGl2VXAobUFsbG9jYXRlZERlcHRoLCA4dSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChtYXhQdHIgLSBtaW5QdHIgKyAxKSA8PSBwbGFuZVNpemUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gRklYTUU6IHRoaXMgaXMgcmlza3kgYXMgcmVhZGluZy93cml0aW5nIGRhdGEgb3V0IG9mIGJvdW5kIHJlc3VsdHMKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgIGluIGFuIHVuZGVmaW5lZCBiZWhhdmlvciwgYnV0IGdyYWxsb2MgZG9lcyBhc3N1bWUgYQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgICAgY29udGlndW91cyBtYXBwaW5nCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodWludDMyX3QgaSA9IDA7IGkgPCBsYXlvdXQubnVtUGxhbmVzOyArK2kpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEMyUGxhbmVJbmZvICZwbGFuZSA9IGxheW91dC5wbGFuZXNbaV07Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbaV0ubU9mZnNldCA9IG1WaWV3LmRhdGEoKVtpXSAtIG1pblB0cjsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVtpXS5tQ29sSW5jID0gcGxhbmUuY29sSW5jOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW2ldLm1Sb3dJbmMgPSBwbGFuZS5yb3dJbmM7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbaV0ubUhvcml6U3Vic2FtcGxpbmcgPSBwbGFuZS5jb2xTYW1wbGluZzsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVtpXS5tVmVydFN1YnNhbXBsaW5nID0gcGxhbmUucm93U2FtcGxpbmc7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVdyYXBwZWQgPSBuZXcgQUJ1ZmZlcihjb25zdF9jYXN0PHVpbnQ4X3QgKj4obWluUHRyKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhQdHIgLSBtaW5QdHIgKyAxKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJvb2wgeXV2NDIwODg4ID0geVBsYW5lLnJvd1NhbXBsaW5nID09IDEgJiYgeVBsYW5lLmNvbFNhbXBsaW5nID09IDEKKyAgICAgICAgICAgICAgICAgICAgICAgICYmIHVQbGFuZS5yb3dTYW1wbGluZyA9PSAyICYmIHVQbGFuZS5jb2xTYW1wbGluZyA9PSAyCisgICAgICAgICAgICAgICAgICAgICAgICAmJiB2UGxhbmUucm93U2FtcGxpbmcgPT0gMiAmJiB2UGxhbmUuY29sU2FtcGxpbmcgPT0gMjsKKyAgICAgICAgICAgICAgICBpZiAoeXV2NDIwODg4KSB7CisgICAgICAgICAgICAgICAgICAgIGZvciAodWludDMyX3QgaSA9IDA7IGkgPCAzOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEMyUGxhbmVJbmZvICZwbGFuZSA9IGxheW91dC5wbGFuZXNbaV07CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGxhbmUuYWxsb2NhdGVkRGVwdGggIT0gOCB8fCBwbGFuZS5iaXREZXB0aCAhPSA4KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeXV2NDIwODg4ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBbW2ZhbGx0aHJvdWdoXV07Ci0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB5dXY0MjA4ODggPSB5dXY0MjA4ODggJiYgeVBsYW5lLmNvbEluYyA9PSAxICYmIHVQbGFuZS5yb3dJbmMgPT0gdlBsYW5lLnJvd0luYzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50MzJfdCBjb3B5Rm9ybWF0ID0gbUNsaWVudENvbG9yRm9ybWF0OworICAgICAgICAgICAgICAgIGlmICh5dXY0MjA4ODggJiYgbUNsaWVudENvbG9yRm9ybWF0ID09IENPTE9SX0Zvcm1hdFlVVjQyMEZsZXhpYmxlKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICh1UGxhbmUuY29sSW5jID09IDIgJiYgdlBsYW5lLmNvbEluYyA9PSAyCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgeVBsYW5lLnJvd0luYyA9PSB1UGxhbmUucm93SW5jKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjb3B5Rm9ybWF0ID0gQ09MT1JfRm9ybWF0WVVWNDIwUGFja2VkU2VtaVBsYW5hcjsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh1UGxhbmUuY29sSW5jID09IDEgJiYgdlBsYW5lLmNvbEluYyA9PSAxCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgeVBsYW5lLnJvd0luYyA9PSB1UGxhbmUucm93SW5jICogMikgeworICAgICAgICAgICAgICAgICAgICAgICAgY29weUZvcm1hdCA9IENPTE9SX0Zvcm1hdFlVVjQyMFBhY2tlZFBsYW5hcjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBBTE9HVigiY2xpZW50X2ZtdD0weCV4IHk6e2NvbEluYz0lZCByb3dJbmM9JWR9IHU6e2NvbEluYz0lZCByb3dJbmM9JWR9ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICJ2Ontjb2xJbmM9JWQgcm93SW5jPSVkfSIsCisgICAgICAgICAgICAgICAgICAgICAgICBtQ2xpZW50Q29sb3JGb3JtYXQsCisgICAgICAgICAgICAgICAgICAgICAgICB5UGxhbmUuY29sSW5jLCB5UGxhbmUucm93SW5jLAorICAgICAgICAgICAgICAgICAgICAgICAgdVBsYW5lLmNvbEluYywgdVBsYW5lLnJvd0luYywKKyAgICAgICAgICAgICAgICAgICAgICAgIHZQbGFuZS5jb2xJbmMsIHZQbGFuZS5yb3dJbmMpOworICAgICAgICAgICAgICAgIHN3aXRjaCAoY29weUZvcm1hdCkgeworICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdFlVVjQyMEZsZXhpYmxlOgogICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdFlVVjQyMFBsYW5hcjoKICAgICAgICAgICAgICAgICAgICAgY2FzZSBDT0xPUl9Gb3JtYXRZVVY0MjBQYWNrZWRQbGFuYXI6CiAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+WV0ubU9mZnNldCA9IDA7CkBAIC0zMjcsNiArMzIwLDEzIEBACiAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+Vl0ubVJvd0luYyA9IHN0cmlkZSAvIDI7CiAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+Vl0ubUhvcml6U3Vic2FtcGxpbmcgPSAyOwogICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlZdLm1WZXJ0U3Vic2FtcGxpbmcgPSAyOworCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHJ5V3JhcHBpbmcgJiYgbUNsaWVudENvbG9yRm9ybWF0ICE9IENPTE9SX0Zvcm1hdFlVVjQyMEZsZXhpYmxlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5V3JhcHBpbmcgPSB5dXY0MjA4ODggJiYgdVBsYW5lLmNvbEluYyA9PSAxICYmIHZQbGFuZS5jb2xJbmMgPT0gMQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgeVBsYW5lLnJvd0luYyA9PSB1UGxhbmUucm93SW5jICogMgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgdmlldy5kYXRhKClbMF0gPCB2aWV3LmRhdGEoKVsxXQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgdmlldy5kYXRhKClbMV0gPCB2aWV3LmRhdGEoKVsyXTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ09MT1JfRm9ybWF0WVVWNDIwU2VtaVBsYW5hcjoKQEAgLTM0OCw2NCArMzQ4LDE2NSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlZdLm1Sb3dJbmMgPSBzdHJpZGU7CiAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+Vl0ubUhvcml6U3Vic2FtcGxpbmcgPSAyOwogICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlZdLm1WZXJ0U3Vic2FtcGxpbmcgPSAyOworCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHJ5V3JhcHBpbmcgJiYgbUNsaWVudENvbG9yRm9ybWF0ICE9IENPTE9SX0Zvcm1hdFlVVjQyMEZsZXhpYmxlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5V3JhcHBpbmcgPSB5dXY0MjA4ODggJiYgdVBsYW5lLmNvbEluYyA9PSAyICYmIHZQbGFuZS5jb2xJbmMgPT0gMgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgeVBsYW5lLnJvd0luYyA9PSB1UGxhbmUucm93SW5jCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiB2aWV3LmRhdGEoKVswXSA8IHZpZXcuZGF0YSgpWzFdCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiB2aWV3LmRhdGEoKVsxXSA8IHZpZXcuZGF0YSgpWzJdOworICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAKLSAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dEKCJDb252ZXJ0ZXI6IGluY29tcGFjdGlibGUgY29sb3IgZm9ybWF0ICglZCkgZm9yIFlVViBsYXlvdXQiLCBtQ29sb3JGb3JtYXQpOwotICAgICAgICAgICAgICAgICAgICAgICAgbUluaXRDaGVjayA9IEJBRF9WQUxVRTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBDT0xPUl9Gb3JtYXRZVVZQMDEwOgorICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlldLm1PZmZzZXQgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlldLm1Db2xJbmMgPSAyOworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlldLm1Sb3dJbmMgPSBzdHJpZGUgKiAyOworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlldLm1Ib3JpelN1YnNhbXBsaW5nID0gMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVttZWRpYUltYWdlLT5ZXS5tVmVydFN1YnNhbXBsaW5nID0gMTsKKworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlVdLm1PZmZzZXQgPSBzdHJpZGUgKiB2U3RyaWRlICogMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVttZWRpYUltYWdlLT5VXS5tQ29sSW5jID0gNDsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVttZWRpYUltYWdlLT5VXS5tUm93SW5jID0gc3RyaWRlICogMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVttZWRpYUltYWdlLT5VXS5tSG9yaXpTdWJzYW1wbGluZyA9IDI7CisgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+VV0ubVZlcnRTdWJzYW1wbGluZyA9IDI7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVttZWRpYUltYWdlLT5WXS5tT2Zmc2V0ID0gc3RyaWRlICogdlN0cmlkZSAqIDIgKyAyOworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlZdLm1Db2xJbmMgPSA0OworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlZdLm1Sb3dJbmMgPSBzdHJpZGUgKiAyOworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlZdLm1Ib3JpelN1YnNhbXBsaW5nID0gMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVttZWRpYUltYWdlLT5WXS5tVmVydFN1YnNhbXBsaW5nID0gMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0cnlXcmFwcGluZykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeVdyYXBwaW5nID0geVBsYW5lLmFsbG9jYXRlZERlcHRoID09IDE2CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiB1UGxhbmUuYWxsb2NhdGVkRGVwdGggPT0gMTYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIHZQbGFuZS5hbGxvY2F0ZWREZXB0aCA9PSAxNgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgeVBsYW5lLmJpdERlcHRoID09IDEwCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiB1UGxhbmUuYml0RGVwdGggPT0gMTAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIHZQbGFuZS5iaXREZXB0aCA9PSAxMAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgeVBsYW5lLnJpZ2h0U2hpZnQgPT0gNgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgdVBsYW5lLnJpZ2h0U2hpZnQgPT0gNgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgdlBsYW5lLnJpZ2h0U2hpZnQgPT0gNgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgeVBsYW5lLnJvd1NhbXBsaW5nID09IDEgJiYgeVBsYW5lLmNvbFNhbXBsaW5nID09IDEKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIHVQbGFuZS5yb3dTYW1wbGluZyA9PSAyICYmIHVQbGFuZS5jb2xTYW1wbGluZyA9PSAyCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiB2UGxhbmUucm93U2FtcGxpbmcgPT0gMiAmJiB2UGxhbmUuY29sU2FtcGxpbmcgPT0gMgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgeVBsYW5lLmNvbEluYyA9PSAyCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiB1UGxhbmUuY29sSW5jID09IDQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIHZQbGFuZS5jb2xJbmMgPT0gNAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgeVBsYW5lLnJvd0luYyA9PSB1UGxhbmUucm93SW5jCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiB5UGxhbmUucm93SW5jID09IHZQbGFuZS5yb3dJbmM7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OiB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBkZWZhdWx0IHRvIGZ1bGx5IHBsYW5hciBmb3JtYXQgLS0tIHRoaXMgd2lsbCBiZSBvdmVycmlkZGVuIGlmIHdyYXBwaW5nCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBUT0RPOiBrZWVwIGludGVybGVhdmVkIGZvcm1hdAorICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBjb2xJbmMgPSBkaXZVcChtQWxsb2NhdGVkRGVwdGgsIDh1KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3Qgcm93SW5jID0gc3RyaWRlICogY29sSW5jIC8geVBsYW5lLmNvbFNhbXBsaW5nOworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlldLm1PZmZzZXQgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlldLm1Db2xJbmMgPSBjb2xJbmM7CisgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+WV0ubVJvd0luYyA9IHJvd0luYzsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVttZWRpYUltYWdlLT5ZXS5tSG9yaXpTdWJzYW1wbGluZyA9IHlQbGFuZS5jb2xTYW1wbGluZzsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVttZWRpYUltYWdlLT5ZXS5tVmVydFN1YnNhbXBsaW5nID0geVBsYW5lLnJvd1NhbXBsaW5nOworICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBvZmZzZXQgPSByb3dJbmMgKiB2U3RyaWRlIC8geVBsYW5lLnJvd1NhbXBsaW5nOworCisgICAgICAgICAgICAgICAgICAgICAgICByb3dJbmMgPSBzdHJpZGUgKiBjb2xJbmMgLyB1UGxhbmUuY29sU2FtcGxpbmc7CisgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+VV0ubU9mZnNldCA9IG9mZnNldDsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVttZWRpYUltYWdlLT5VXS5tQ29sSW5jID0gY29sSW5jOworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlVdLm1Sb3dJbmMgPSByb3dJbmM7CisgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+VV0ubUhvcml6U3Vic2FtcGxpbmcgPSB1UGxhbmUuY29sU2FtcGxpbmc7CisgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+VV0ubVZlcnRTdWJzYW1wbGluZyA9IHVQbGFuZS5yb3dTYW1wbGluZzsKKyAgICAgICAgICAgICAgICAgICAgICAgIG9mZnNldCArPSByb3dJbmMgKiB2U3RyaWRlIC8gdVBsYW5lLnJvd1NhbXBsaW5nOworCisgICAgICAgICAgICAgICAgICAgICAgICByb3dJbmMgPSBzdHJpZGUgKiBjb2xJbmMgLyB2UGxhbmUuY29sU2FtcGxpbmc7CisgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+Vl0ubU9mZnNldCA9IG9mZnNldDsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVttZWRpYUltYWdlLT5WXS5tQ29sSW5jID0gY29sSW5jOworICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW21lZGlhSW1hZ2UtPlZdLm1Sb3dJbmMgPSByb3dJbmM7CisgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+Vl0ubUhvcml6U3Vic2FtcGxpbmcgPSB2UGxhbmUuY29sU2FtcGxpbmc7CisgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbbWVkaWFJbWFnZS0+Vl0ubVZlcnRTdWJzYW1wbGluZyA9IHZQbGFuZS5yb3dTYW1wbGluZzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorCiAgICAgICAgICAgICBjYXNlIEMyUGxhbmFyTGF5b3V0OjpUWVBFX1lVVkE6Ci0gICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVR5cGUgPSBNZWRpYUltYWdlMjo6TUVESUFfSU1BR0VfVFlQRV9ZVVZBOwotICAgICAgICAgICAgICAgIC8vIFdlIGRvbid0IGhhdmUgYW4gU0RLIFlVVkEgZm9ybWF0Ci0gICAgICAgICAgICAgICAgQUxPR0QoIkNvbnZlcnRlcjogaW5jb21wYWN0aWJsZSBjb2xvciBmb3JtYXQgKCVkKSBmb3IgWVVWQSBsYXlvdXQiLCBtQ29sb3JGb3JtYXQpOwotICAgICAgICAgICAgICAgIG1Jbml0Q2hlY2sgPSBCQURfVkFMVUU7CisgICAgICAgICAgICAgICAgQUxPR0QoIkNvbnZlcnRlcjogdW5yZWNvZ25pemVkIGNvbG9yIGZvcm1hdCAiCisgICAgICAgICAgICAgICAgICAgICAgICAiKGNsaWVudCAlZCBjb21wb25lbnQgJWQpIGZvciBZVVZBIGxheW91dCIsCisgICAgICAgICAgICAgICAgICAgICAgICBtQ2xpZW50Q29sb3JGb3JtYXQsIG1Db21wb25lbnRDb2xvckZvcm1hdCk7CisgICAgICAgICAgICAgICAgbUluaXRDaGVjayA9IE5PX0lOSVQ7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgY2FzZSBDMlBsYW5hckxheW91dDo6VFlQRV9SR0I6Ci0gICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVR5cGUgPSBNZWRpYUltYWdlMjo6TUVESUFfSU1BR0VfVFlQRV9SR0I7Ci0gICAgICAgICAgICAgICAgc3dpdGNoIChtQ29sb3JGb3JtYXQpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gVE9ETyBtZWRpYSBpbWFnZQotICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdFJHQkZsZXhpYmxlOgotICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdDI0Yml0QkdSODg4OgotICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdDI0Yml0UkdCODg4OgotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICBBTE9HRCgiQ29udmVydGVyOiBpbmNvbXBhY3RpYmxlIGNvbG9yIGZvcm1hdCAoJWQpIGZvciBSR0IgbGF5b3V0IiwgbUNvbG9yRm9ybWF0KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1Jbml0Q2hlY2sgPSBCQURfVkFMVUU7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChsYXlvdXQubnVtUGxhbmVzICE9IDMpIHsKLSAgICAgICAgICAgICAgICAgICAgQUxPR0QoIkNvbnZlcnRlcjogJWQgcGxhbmVzIGZvciBSR0IgbGF5b3V0IiwgbGF5b3V0Lm51bVBsYW5lcyk7Ci0gICAgICAgICAgICAgICAgICAgIG1Jbml0Q2hlY2sgPSBCQURfVkFMVUU7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgQUxPR0QoIkNvbnZlcnRlcjogdW5yZWNvZ25pemVkIGNvbG9yIGZvcm1hdCAiCisgICAgICAgICAgICAgICAgICAgICAgICAiKGNsaWVudCAlZCBjb21wb25lbnQgJWQpIGZvciBSR0IgbGF5b3V0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgIG1DbGllbnRDb2xvckZvcm1hdCwgbUNvbXBvbmVudENvbG9yRm9ybWF0KTsKKyAgICAgICAgICAgICAgICBtSW5pdENoZWNrID0gTk9fSU5JVDsKKyAgICAgICAgICAgICAgICAvLyBUT0RPOiBzdXBwb3J0IE1lZGlhSW1hZ2UgbGF5b3V0CisgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgY2FzZSBDMlBsYW5hckxheW91dDo6VFlQRV9SR0JBOgotICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1UeXBlID0gTWVkaWFJbWFnZTI6Ok1FRElBX0lNQUdFX1RZUEVfUkdCQTsKLSAgICAgICAgICAgICAgICBzd2l0Y2ggKG1Db2xvckZvcm1hdCkgewotICAgICAgICAgICAgICAgICAgICAvLyBUT0RPIG1lZGlhIGltYWdlCi0gICAgICAgICAgICAgICAgICAgIGNhc2UgQ09MT1JfRm9ybWF0UkdCQUZsZXhpYmxlOgotICAgICAgICAgICAgICAgICAgICBjYXNlIENPTE9SX0Zvcm1hdDMyYml0QUJHUjg4ODg6Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgQ09MT1JfRm9ybWF0MzJiaXRBUkdCODg4ODoKLSAgICAgICAgICAgICAgICAgICAgY2FzZSBDT0xPUl9Gb3JtYXQzMmJpdEJHUkE4ODg4OgotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICBBTE9HRCgiSW5jb21wYWN0aWJsZSBjb2xvciBmb3JtYXQgKCVkKSBmb3IgUkdCQSBsYXlvdXQiLCBtQ29sb3JGb3JtYXQpOwotICAgICAgICAgICAgICAgICAgICAgICAgbUluaXRDaGVjayA9IEJBRF9WQUxVRTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKGxheW91dC5udW1QbGFuZXMgIT0gNCkgewotICAgICAgICAgICAgICAgICAgICBBTE9HRCgiQ29udmVydGVyOiAlZCBwbGFuZXMgZm9yIFJHQkEgbGF5b3V0IiwgbGF5b3V0Lm51bVBsYW5lcyk7Ci0gICAgICAgICAgICAgICAgICAgIG1Jbml0Q2hlY2sgPSBCQURfVkFMVUU7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgQUxPR0QoIkNvbnZlcnRlcjogdW5yZWNvZ25pemVkIGNvbG9yIGZvcm1hdCAiCisgICAgICAgICAgICAgICAgICAgICAgICAiKGNsaWVudCAlZCBjb21wb25lbnQgJWQpIGZvciBSR0JBIGxheW91dCIsCisgICAgICAgICAgICAgICAgICAgICAgICBtQ2xpZW50Q29sb3JGb3JtYXQsIG1Db21wb25lbnRDb2xvckZvcm1hdCk7CisgICAgICAgICAgICAgICAgbUluaXRDaGVjayA9IE5PX0lOSVQ7CisgICAgICAgICAgICAgICAgLy8gVE9ETzogc3VwcG9ydCBNZWRpYUltYWdlIGxheW91dAorICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVR5cGUgPSBNZWRpYUltYWdlMjo6TUVESUFfSU1BR0VfVFlQRV9VTktOT1dOOwotICAgICAgICAgICAgICAgIEFMT0dEKCJVbmtub3duIGxheW91dCIpOwotICAgICAgICAgICAgICAgIG1Jbml0Q2hlY2sgPSBCQURfVkFMVUU7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIGlmIChsYXlvdXQubnVtUGxhbmVzID09IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgY29uc3QgQzJQbGFuZUluZm8gJnBsYW5lID0gbGF5b3V0LnBsYW5lc1swXTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHBsYW5lLmNvbEluYyA8IDAgfHwgcGxhbmUucm93SW5jIDwgMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ29weS1vbmx5IGlmIHdlIGhhdmUgbmVnYXRpdmUgY29sSW5jL3Jvd0luYworICAgICAgICAgICAgICAgICAgICAgICAgdHJ5V3JhcHBpbmcgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbMF0ubU9mZnNldCA9IDA7CisgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVswXS5tQ29sSW5jID0gc3RkOjphYnMocGxhbmUuY29sSW5jKTsKKyAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lWzBdLm1Sb3dJbmMgPSBzdGQ6OmFicyhwbGFuZS5yb3dJbmMpOworICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbMF0ubUhvcml6U3Vic2FtcGxpbmcgPSBwbGFuZS5jb2xTYW1wbGluZzsKKyAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lWzBdLm1WZXJ0U3Vic2FtcGxpbmcgPSBwbGFuZS5yb3dTYW1wbGluZzsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBBTE9HRCgiQ29udmVydGVyOiB1bnJlY29nbml6ZWQgbGF5b3V0OiBjb2xvciBmb3JtYXQgKGNsaWVudCAlZCBjb21wb25lbnQgJWQpIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ2xpZW50Q29sb3JGb3JtYXQsIG1Db21wb25lbnRDb2xvckZvcm1hdCk7CisgICAgICAgICAgICAgICAgICAgIG1Jbml0Q2hlY2sgPSBOT19JTklUOworICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGlmICh0cnlXcmFwcGluZykgeworICAgICAgICAgICAgLy8gdHJ5IHRvIG1hcCBkaXJlY3RseS4gY2hlY2sgaWYgdGhlIHBsYW5lcyBhcmUgbmVhciBvbmUgYW5vdGhlcgorICAgICAgICAgICAgY29uc3QgdWludDhfdCAqbWluUHRyID0gbVZpZXcuZGF0YSgpWzBdOworICAgICAgICAgICAgY29uc3QgdWludDhfdCAqbWF4UHRyID0gbVZpZXcuZGF0YSgpWzBdOworICAgICAgICAgICAgaW50MzJfdCBwbGFuZVNpemUgPSAwOworICAgICAgICAgICAgZm9yICh1aW50MzJfdCBpID0gMDsgaSA8IGxheW91dC5udW1QbGFuZXM7ICsraSkgeworICAgICAgICAgICAgICAgIGNvbnN0IEMyUGxhbmVJbmZvICZwbGFuZSA9IGxheW91dC5wbGFuZXNbaV07CisgICAgICAgICAgICAgICAgaW50NjRfdCBwbGFuZVN0cmlkZSA9IHN0ZDo6YWJzKHBsYW5lLnJvd0luYyAvIHBsYW5lLmNvbEluYyk7CisgICAgICAgICAgICAgICAgc3NpemVfdCBtaW5PZmZzZXQgPSBwbGFuZS5taW5PZmZzZXQoCisgICAgICAgICAgICAgICAgICAgICAgICBtV2lkdGggLyBwbGFuZS5jb2xTYW1wbGluZywgbUhlaWdodCAvIHBsYW5lLnJvd1NhbXBsaW5nKTsKKyAgICAgICAgICAgICAgICBzc2l6ZV90IG1heE9mZnNldCA9IHBsYW5lLm1heE9mZnNldCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG1XaWR0aCAvIHBsYW5lLmNvbFNhbXBsaW5nLCBtSGVpZ2h0IC8gcGxhbmUucm93U2FtcGxpbmcpOworICAgICAgICAgICAgICAgIGlmIChtaW5QdHIgPiBtVmlldy5kYXRhKClbaV0gKyBtaW5PZmZzZXQpIHsKKyAgICAgICAgICAgICAgICAgICAgbWluUHRyID0gbVZpZXcuZGF0YSgpW2ldICsgbWluT2Zmc2V0OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobWF4UHRyIDwgbVZpZXcuZGF0YSgpW2ldICsgbWF4T2Zmc2V0KSB7CisgICAgICAgICAgICAgICAgICAgIG1heFB0ciA9IG1WaWV3LmRhdGEoKVtpXSArIG1heE9mZnNldDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcGxhbmVTaXplICs9IHBsYW5lU3RyaWRlICogZGl2VXAobUFsbG9jYXRlZERlcHRoLCA4dSkKKyAgICAgICAgICAgICAgICAgICAgICAgICogYWxpZ24obUhlaWdodCwgNjQpIC8gcGxhbmUucm93U2FtcGxpbmc7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChtaW5QdHIgPT0gbVZpZXcuZGF0YSgpWzBdICYmIChtYXhQdHIgLSBtaW5QdHIgKyAxKSA8PSBwbGFuZVNpemUpIHsKKyAgICAgICAgICAgICAgICAvLyBGSVhNRTogdGhpcyBpcyByaXNreSBhcyByZWFkaW5nL3dyaXRpbmcgZGF0YSBvdXQgb2YgYm91bmQgcmVzdWx0cworICAgICAgICAgICAgICAgIC8vICAgICAgICBpbiBhbiB1bmRlZmluZWQgYmVoYXZpb3IsIGJ1dCBncmFsbG9jIGRvZXMgYXNzdW1lIGEKKyAgICAgICAgICAgICAgICAvLyAgICAgICAgY29udGlndW91cyBtYXBwaW5nCisgICAgICAgICAgICAgICAgZm9yICh1aW50MzJfdCBpID0gMDsgaSA8IGxheW91dC5udW1QbGFuZXM7ICsraSkgeworICAgICAgICAgICAgICAgICAgICBjb25zdCBDMlBsYW5lSW5mbyAmcGxhbmUgPSBsYXlvdXQucGxhbmVzW2ldOworICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbaV0ubU9mZnNldCA9IG1WaWV3LmRhdGEoKVtpXSAtIG1pblB0cjsKKyAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW2ldLm1Db2xJbmMgPSBwbGFuZS5jb2xJbmM7CisgICAgICAgICAgICAgICAgICAgIG1lZGlhSW1hZ2UtPm1QbGFuZVtpXS5tUm93SW5jID0gcGxhbmUucm93SW5jOworICAgICAgICAgICAgICAgICAgICBtZWRpYUltYWdlLT5tUGxhbmVbaV0ubUhvcml6U3Vic2FtcGxpbmcgPSBwbGFuZS5jb2xTYW1wbGluZzsKKyAgICAgICAgICAgICAgICAgICAgbWVkaWFJbWFnZS0+bVBsYW5lW2ldLm1WZXJ0U3Vic2FtcGxpbmcgPSBwbGFuZS5yb3dTYW1wbGluZzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbVdyYXBwZWQgPSBuZXcgQUJ1ZmZlcihjb25zdF9jYXN0PHVpbnQ4X3QgKj4obWluUHRyKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heFB0ciAtIG1pblB0ciArIDEpOworICAgICAgICAgICAgICAgIEFMT0dWKCJDb252ZXJ0ZXI6IHdyYXBwZWQgKGNhcGFjaXR5PSV6dSkiLCBtV3JhcHBlZC0+Y2FwYWNpdHkoKSk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICAgICAgbWVkaWFJbWFnZS0+bU51bVBsYW5lcyA9IGxheW91dC5udW1QbGFuZXM7CiAgICAgICAgIG1lZGlhSW1hZ2UtPm1XaWR0aCA9IHZpZXcuY3JvcCgpLndpZHRoOwpAQCAtNDI4LDEyICs1MjksMTIgQEAKICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAocGxhbmUuYWxsb2NhdGVkRGVwdGggIT0gbUFsbG9jYXRlZERlcHRoIHx8IHBsYW5lLmJpdERlcHRoICE9IGJpdERlcHRoKSB7Ci0gICAgICAgICAgICAgICAgQUxPR1YoImRpZmZlcmVudCBhbGxvY2F0ZWREZXB0aC9iaXREZXB0aCBwZXIgcGxhbmUgdW5zdXBwb3J0ZWQiKTsKKyAgICAgICAgICAgICAgICBBTE9HRCgiZGlmZmVyZW50IGFsbG9jYXRlZERlcHRoL2JpdERlcHRoIHBlci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sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJicmFuZC9wcm9kdWN0L2RldmljZToiKTsKKyAgICAgICAgQUxPR1YoInByb3BlcnR5X2dldCBmb3Igcm8udmVuZG9yLmJ1aWxkLmZpbmdlcnByaW50ID09ICclcyciLCBmaW5nZXJwcmludC5jX3N0cigpKTsKKworICAgICAgICAvLyByby52ZW5kb3IuYnVpbGQudmVyc2lvbi5zZGsKKyAgICAgICAgc3RkOjpzdHJpbmcgc2RrID0gYmFzZTo6R2V0UHJvcGVydHkoInJvLnZlbmRvci5idWlsZC52ZXJzaW9uLnNkayIsICIwIik7CisgICAgICAgIEFMT0dWKCJwcm9wZXJ0eV9nZXQgZm9yIHJvLnZlbmRvci5idWlsZC52ZXJzaW9uLnNkayA9PSAnJXMnIiwgc2RrLmNfc3RyKCkpOworCisgICAgICAgIHN0ZDo6c3RyaW5nIGJyYW5kOworICAgICAgICBzdGQ6OnN0cmluZyBwcm9kdWN0OworICAgICAgICBzdGQ6OnN0cmluZyBkZXZpY2U7CisgICAgICAgIHNpemVfdCBwb3MxOworICAgICAgICBwb3MxID0gZmluZ2VycHJpbnQuZmluZCgnLycpOworICAgICAgICBpZiAocG9zMSAhPSBzdGQ6OnN0cmluZzo6bnBvcykgeworICAgICAgICAgICAgYnJhbmQgPSBmaW5nZXJwcmludC5zdWJzdHIoMCwgcG9zMSk7CisgICAgICAgICAgICBzaXplX3QgcG9zMiA9IGZpbmdlcnByaW50LmZpbmQoJy8nLCBwb3MxKzEpOworICAgICAgICAgICAgaWYgKHBvczIgIT0gc3RkOjpzdHJpbmc6Om5wb3MpIHsKKyAgICAgICAgICAgICAgICBwcm9kdWN0ID0gZmluZ2VycHJpbnQuc3Vic3RyKHBvczErMSwgcG9zMiAtIHBvczEgLSAxKTsKKyAgICAgICAgICAgICAgICBzaXplX3QgcG9zMyA9IGZpbmdlcnByaW50LmZpbmQoJy8nLCBwb3MyKzEpOworICAgICAgICAgICAgICAgIGlmIChwb3MzICE9IHN0ZDo6c3RyaW5nOjpucG9zKSB7CisgICAgICAgICAgICAgICAgICAgIGRldmljZSA9IGZpbmdlcnByaW50LnN1YnN0cihwb3MyKzEsIHBvczMgLSBwb3MyIC0gMSk7CisgICAgICAgICAgICAgICAgICAgIHNpemVfdCBwb3M0ID0gZGV2aWNlLmZpbmQoJzonKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHBvczQgIT0gc3RkOjpzdHJpbmc6Om5wb3MpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZS5yZXNpemUocG9zNCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBBTE9HVigicGFyc2VkOiBzZGsgJyVzJyBicmFuZCAnJXMnIHByb2R1Y3QgJyVzJyBkZXZpY2UgJyVzJyIsCisgICAgICAgICAgICBzZGsuY19zdHIoKSwgYnJhbmQuY19zdHIoKSwgcHJvZHVjdC5jX3N0cigpLCBkZXZpY2UuY19zdHIoKSk7CisKKyAgICAgICAgc3RkOjpzdHJpbmcgYmFzZSA9ICIvYXBleC9jb20uYW5kcm9pZC5tZWRpYS9ldGMvZm9ybWF0c2hhcGVyIjsKKworICAgICAgICAvLyBsb29raW5nIGluIHRoZXNlIGRpcmVjdG9yaWVzIHdpdGhpbiB0aGUgYXBleAorICAgICAgICBjb25zdCBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz4gbW9kdWxlUGF0aG5hbWVzID0geworICAgICAgICAgICAgYmFzZSArICIvIiArIHNkayArICIvIiArIGJyYW5kICsgIi8iICsgcHJvZHVjdCArICIvIiArIGRldmljZSwKKyAgICAgICAgICAgIGJhc2UgKyAiLyIgKyBzZGsgKyAiLyIgKyBicmFuZCArICIvIiArIHByb2R1Y3QsCisgICAgICAgICAgICBiYXNlICsgIi8iICsgc2RrICsgIi8iICsgYnJhbmQsCisgICAgICAgICAgICBiYXNlICsgIi8iICsgc2RrLAorICAgICAgICAgICAgYmFzZQorICAgICAgICB9OworCisgICAgICAgIHBhcnNlci5wYXJzZVhtbEZpbGVzSW5TZWFyY2hEaXJzKCB7ICJtZWRpYV9jb2RlY3Nfc2hhcGluZy54bWwiIH0sIG1vZHVsZVBhdGhuYW1lcyk7CisgICAgfQorCiAgICAgaWYgKHBhcnNlci5nZXRQYXJzaW5nU3RhdHVzKCkgIT0gT0spIHsKICAgICAgICAgQUxPR0QoIlhNTCBwYXJzZXIgbm8gZ29vZCIpOwogICAgICAgICByZXR1cm4gT0s7CkBAIC01NDYsNyArNjA5LDE1IEBACiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBhZGRTdXBwb3J0ZWRQcm9maWxlTGV2ZWxzKGludGYsIGNhcHMuZ2V0KCksIHRyYWl0LCBtZWRpYVR5cGUpOworICAgICAgICAgICAgICAgIGlmICghYWRkU3VwcG9ydGVkUHJvZmlsZUxldmVscyhpbnRmLCBjYXBzLmdldCgpLCB0cmFpdCwgbWVkaWFUeXBlKSkgeworICAgICAgICAgICAgICAgICAgICAvLyBUT0RPKGIvMTkzMjc5NjQ2KSBUaGlzIHdpbGwgZ2V0IGZpeGVkIGluIEMySW50ZXJmYWNlSGVscGVyCisgICAgICAgICAgICAgICAgICAgIC8vIFNvbWUgY29tcG9uZW50cyBtYXkgbm90IGFkdmVydGlzZSBzdXBwb3J0ZWQgdmFsdWVzIGlmIHRoZXkgdXNlIGEgY29uc3QKKyAgICAgICAgICAgICAgICAgICAgLy8gcGFyYW0gZm9yIHByb2ZpbGUvbGV2ZWwgKHRoZXkgc3VwcG9ydCBvbmx5IG9uZSBwcm9maWxlKS4gRm9yIG5vdyBjb3ZlcgorICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IFZQOCBoZXJlIHVudGlsIGl0IGlzIGZpeGVkLgorICAgICAgICAgICAgICAgICAgICBpZiAobWVkaWFUeXBlID09IE1J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b2RpbmcpIHsKKyAgICBmaW5pc2hDdXJyZW50QmxvY2soJm1QZW5kaW5nV29yayk7CisgICAgbUVuY29kaW5nID0gZW5jb2Rpbmc7Cit9CisKK3ZvaWQgRnJhbWVSZWFzc2VtYmxlcjo6cmVzZXQoKSB7CisgICAgZmx1c2goKTsKKyAgICBtQ3VycmVudE9yZGluYWwgPSB7MCwgMCwgMH07CisgICAgbUJsb2NrUG9vbC5yZXNldCgpOworICAgIG1GcmFtZVNpemUucmVzZXQoKTsKKyAgICBtU2FtcGxlUmF0ZSA9IDB1OworICAgIG1DaGFubmVsQ291bnQgPSAwdTsKKyAgICBtRW5jb2RpbmcgPSBDMkNvbmZpZzo6UENNXzE2OworfQorCitGcmFtZVJlYXNzZW1ibGVyOjpvcGVyYXRvciBib29sKCkgY29uc3QgeworICAgIHJldHVybiBtRnJhbWVTaXplLmhhc192YWx1ZSgpOworfQorCitjMl9zdGF0dXNfdCBGcmFtZVJlYXNzZW1ibGVyOjpwcm9jZXNzKAorICAgICAgICBjb25zdCBzcDxNZWRpYUNvZGVjQnVmZmVyPiAmYnVmZmVyLAorICAgICAgICBzdGQ6Omxpc3Q8c3RkOjp1bmlxdWVfcHRyPEMyV29yaz4+ICppdGVtcykgeworICAgIGludDY0X3QgdGltZVVzOworICAgIGlmIChidWZmZXItPnNpemUoKSA9PSAwdQorICAgICAgICAgICAgfHwgIWJ1ZmZlci0+bWV0YSgpLT5maW5kSW50NjQoInRpbWVVcyIsICZ0aW1lVXMpKSB7CisgICAgICAgIHJldHVybiBDMl9CQURfVkFMVUU7CisgICAgfQorCisgICAgaXRlbXMtPnNwbGljZShpdGVtcy0+ZW5kKCksIG1QZW5kaW5nV29yayk7CisKKyAgICAvLyBGaWxsIG1DdXJyZW50QmxvY2sKKyAgICBpZiAobUN1cnJlbnRCbG9jaykgeworICAgICAgICAvLyBGaXJzdCBjaGVjayB0aGUgdGltZXN0YW1wCisgICAgICAgIGMyX2NudHI2NF90IGVuZFRpbWVzdGFt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KTsKKyAgICAgICAgICAgICAgICBzaXplX3QgcmVtYWluaW5nU2FtcGxlcyA9CisgICAgICAgICAgICAgICAgICAgIChtV3JpdGVWaWV3LT5jYXBhY2l0eSgpIC0gbVdyaXRlVmlldy0+c2l6ZSgpKQorICAgICAgICAgICAgICAgICAgICAvIG1DaGFubmVsQ291bnQgLyBieXRlc1BlclNhbXBsZSgpOworICAgICAgICAgICAgICAgIGlmIChnYXBTYW1wbGVzIDwgcmVtYWluaW5nU2FtcGxlcykgeworICAgICAgICAgICAgICAgICAgICBzaXplX3QgZ2FwQnl0ZXMgPSBnYXBTYW1wbGVzICogbUNoYW5uZWxDb3VudCAqIGJ5dGVzUGVyU2FtcGxlKCk7CisgICAgICAgICAgICAgICAgICAgIG1lbXNldChtV3JpdGVWaWV3LT5iYXNlKCkgKyBtV3JpdGVWaWV3LT5zaXplKCksIDB1LCBnYXBCeXRlcyk7CisgICAgICAgICAgICAgICAgICAgIG1Xcml0ZVZpZXctPnNldFNpemUobVdyaXRlVmlldy0+c2l6ZSgpICsgZ2FwQnl0ZXMpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGZpbmlzaEN1cnJlbnRCbG9jayhpdGVtcyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgaWYgKG1DdXJyZW50QmxvY2spIHsKKyAgICAgICAgLy8gQXBwZW5kIHRoZSBkYXRhIGF0IHRoZSBlbmQgb2YgdGhlIGN1cnJlbnQgYmxvY2sKKyAgICAgICAgc2l6ZV90IGNvcHlTaXplID0gc3RkOjptaW4oCisgICAgICAgICAgICAgICAgYnVmZmVyLT5zaXplKCksCisgICAgICAgICAgICAgICAgc2l6ZV90KG1Xcml0ZVZpZXctPmNhcGFjaXR5KCkgLSBtV3JpdGVWaWV3LT5zaXplKCkpKTsKKyAgICAgICAgbWVtY3B5KG1Xcml0ZVZpZXctPmJhc2UoKSArIG1Xcml0ZVZpZXctPnNpemUoKSwgYnVmZmVyLT5kYXRhKCksIGNvcHlTaXplKTsKKyAgICAgICAgYnVmZmVyLT5zZXRSYW5nZShidWZmZXItPm9mZnNldCgpICsgY29weVNpemUsIGJ1ZmZlci0+c2l6ZSgpIC0gY29weVNpemUpOworICAgICAgICBtV3JpdGVWaWV3LT5zZXRTaXplKG1Xcml0ZVZpZXctPnNpemUoKSArIGNvcHlTaXplKTsKKyAgICAgICAgaWYgKG1Xcml0ZVZpZXctPnNpemUoKSA9PSBtV3JpdGVWaWV3LT5jYXBhY2l0eSgpKSB7CisgICAgICAgICAgICBmaW5pc2hDdXJyZW50QmxvY2soaXRlbXMpOworICAgICAgICB9CisgICAgICAgIHRpbWVVcyArPSBieXRlc1RvU2FtcGxlcyhjb3B5U2l6ZSkgKiAxMDAwMDAwIC8gbVNhbXBsZVJhdGU7CisgICAgfQorCisgICAgaWYgKGJ1ZmZlci0+c2l6ZSgpID4gMCkgeworICAgICAgICBtQ3VycmVudE9yZGluYWwudGltZXN0YW1wID0gdGltZVVzOworICAgICAgICBtQ3VycmVudE9yZGluYWwuY3VzdG9tT3JkaW5hbCA9IHRpbWVVczsKKyAgICB9CisKKyAgICBzaXplX3QgZnJhbWVTaXplQnl0ZXMgPSBtRnJhbWVTaXplLnZhbHVlKCkgKiBtQ2hhbm5lbENvdW50ICogYnl0ZXNQZXJTYW1wbGUoKTsKKyAgICB3aGlsZSAoYnVmZmVyLT5zaXplKCkgPiAwKSB7CisgICAgICAgIExPR19BTFdBWVNfRkFUQUxfSUYoCisgICAgICAgICAgICAgICAgbUN1cnJlbnRCbG9jaywKKyAgICAgICAgICAgICAgICAiVGhlcmUncyByZW1haW5pbmcgZGF0YSBidXQgdGhlIHBlbmRpbmcgYmxvY2sgaXMgbm90IGZpbGxlZCAmIGZpbmlzaGVkIik7CisgICAgICAgIHN0ZDo6dW5pcXVlX3B0cjxDMldvcms+IHdvcmsobmV3IEMyV29yayk7CisgICAgICAgIGMyX3N0YXR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6OnZlY3RvcjxzdGQ6OnVuaXF1ZV9wdHI8QzJQYXJhbT4+IGhlYXBQYXJhbXM7CisgICAgICAgIEMyU3RvcmVGbGV4aWJsZVBpeGVsRm9ybWF0RGVzY3JpcHRvcnNJbmZvICpwaXhlbEZvcm1hdEluZm8gPSBudWxscHRyOworICAgICAgICBpZiAoY2xpZW50LT5xdWVyeSgKKyAgICAgICAgICAgICAgICAgICAge30sCisgICAgICAgICAgICAgICAgICAgIHtDMlN0b3JlRmxleGlibGVQaXhlbEZvcm1hdERlc2NyaXB0b3JzSW5mbzo6UEFSQU1fVFlQRX0sCisgICAgICAgICAgICAgICAgICAgIEMyX01BWV9CTE9DSywKKyAgICAgICAgICAgICAgICAgICAgJmhlYXBQYXJhbXMpID09IEMyX09LCisgICAgICAgICAgICAgICAgJiYgaGVhcFBhcmFtcy5zaXplKCkgPT0gMXUpIHsKKyAgICAgICAgICAgIHBpeGVsRm9ybWF0SW5mbyA9IEMyU3RvcmVGbGV4aWJsZVBpeGVsRm9ybWF0RGVzY3JpcHRvcnNJbmZvOjpGcm9tKAorICAgICAgICAgICAgICAgICAgICBoZWFwUGFyYW1zWzBdLmdldCgpKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHBpeGVsRm9ybWF0SW5mbyA9IG51bGxwdHI7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHBpeGVsRm9ybWF0SW5mbyAmJiAqcGl4ZWxGb3JtYXRJbmZvKSB7CisgICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHBpeGVsRm9ybWF0SW5mby0+ZmxleENvdW50KCk7ICsraSkgeworICAgICAgICAgICAgICAgIGNvbnN0IEMyRmxleGlibGVQaXhlbEZvcm1hdERlc2NyaXB0b3JTdHJ1Y3QgJmRlc2MgPQorICAgICAgICAgICAgICAgICAgICBwaXhlbEZvcm1hdEluZm8tPm0udmFsdWVzW2ldOworICAgICAgICAgICAgICAgIGlmIChkZXNjLmJpdERlcHRoICE9IDgKKyAgICAgICAgICAgICAgICAgICAgICAgIHx8IGRlc2Muc3Vic2FtcGxpbmcgIT0gQzJDb2xvcjo6WVVWXzQyMAorICAgICAgICAgICAgICAgICAgICAgICAgLy8gVE9ETyhiLzE4MDA3NjEwNSk6IHNvbWUgZGV2aWNlcyByZXBvcnQgd3JvbmcgbGF5b3V0cworICAgICAgICAgICAgICAgICAgICAgICAgLy8gfHwgZGVzYy5sYXlvdXQgPT0gQzJDb2xvcjo6SU5URVJMRUFWRURfUEFDS0VECisgICAgICAgICAgICAgICAgICAgICAgICAvLyB8fCBkZXNjLmxheW91dCA9PSBDMkNvbG9yOjpJTlRFUkxFQVZFRF9BTElHTkVECisgICAgICAgICAgICAgICAgICAgICAgICB8fCBkZXNjLmxheW91dCA9PSBDMkNvbG9yOjpVTktOT1dOX0xBWU9VVCkgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZmxleFBpeGVsRm9ybWF0cy5wdXNoX2JhY2soZGVzYy5waXhlbEZvcm1hdCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBmb3IgKHVpbnQzMl90IHBpeGVsRm9ybWF0IDogZmxleFBpeGVsRm9ybWF0cykgeworICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8UmF3R3JhcGhpY091dHB1dEJ1ZmZlcnM+IGJ1ZmZlcnMgPQorICAgICAgICAgICAgc3RkOjptYWtlX3NoYXJlZDxSYXdHcmFwaGljT3V0cHV0QnVmZmVycz4oCisgICAgICAgICAgICAgICAgICAgIEFTdHJpbmdQcmludGYoInRlc3QgcGl4ZWwgZm9ybWF0IDB4JXgiLCBwaXhlbEZvcm1hdCkuY19zdHIoKSk7CisKKyAgICAgICAgc3A8QU1lc3NhZ2U+IGZvcm1hdHtuZXcgQU1lc3NhZ2V9OworICAgICAgICBmb3JtYXQtPnNldEludDMyKEtFWV9XSURUSCwga1dpZHRoKTs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ICAgICAgIEFTU0VSVF9FUSg4dSwgdVBsYW5lLmFsbG9jYXRlZERlcHRoKTsKKyAgICAgICAgICAgIEFTU0VSVF9FUSg4dSwgdVBsYW5lLmJpdERlcHRoKTsKKyAgICAgICAgICAgIEFTU0VSVF9FUSgwdSwgdVBsYW5lLnJpZ2h0U2hpZnQpOworCisgICAgICAgICAgICAvLyBWIHBsYW5lCisgICAgICAgICAgICBBU1NFUlRfRVEoMnUsIHZQbGFuZS5jb2xTYW1wbGluZyk7CisgICAgICAgICAgICBBU1NFUlRfRVEoMnUsIHZQbGFuZS5yb3dTYW1wbGluZyk7CisgICAgICAgICAgICBBU1NFUlRfRVEoOHUsIHZQbGFuZS5hbGxvY2F0ZWREZXB0aCk7CisgICAgICAgICAgICBBU1NFUlRfRVEoOHUsIHZQbGFuZS5iaXREZXB0aCk7CisgICAgICAgICAgICBBU1NFUlRfRVEoMHUsIHZQbGFuZS5yaWdodFNoaWZ0KTsKKworICAgICAgICAgICAgdWludDhfdCAqeVJvd1B0ciA9IHZpZXcuZGF0YSgpW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9ZXTsKKyAgICAgICAgICAgIHVpbnQ4X3QgKnVSb3dQdHIgPSB2aWV3LmRhdGEoKVtDMlBsYW5hckxheW91dDo6UExBTkVfVV07CisgICAgICAgICAgICB1aW50OF90ICp2Um93UHRyID0gdmlldy5kYXRhKClbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1ZdOworICAgICAgICAgICAgZm9yIChpbnQzMl90IHJvdyA9IDA7IHJvdyA8IGtIZWlnaHQ7ICsrcm93KSB7CisgICAgICAgICAgICAgICAgdWludDhfdCAqeVB0ciA9IHlSb3dQdHI7CisgICAgICAgICAgICAgICAgdWludDhfdCAqdVB0ciA9IHVSb3dQdHI7CisgICAgICAgICAgICAgICAgdWludDhfdCAqdlB0ciA9IHZSb3dQdHI7CisgICAgICAgICAgICAgICAgZm9yIChpbnQzMl90IGNvbCA9IDA7IGNvbCA8IGtXaWR0aDsgKytjb2wpIHsKKyAgICAgICAgICAgICAgICAgICAgKnlQdHIgPSAoKHJvdyArIGNvbCkgJiAweEZGKTsKKyAgICAgICAgICAgICAgICAgICAgeVB0ciArPSB5UGxhbmUuY29sSW5jOworCisgICAgICAgICAgICAgICAgICAgIGlmIChyb3cgPCBrSGVpZ2h0IC8gMiAmJiBjb2wgPCBrV2lkdGggLyAyKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAqdVB0ciA9ICgocm93ICsgY29sICsgMSkgJiAweEZGKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICp2UHRyID0gKChyb3cgKyBjb2wgKyAyKSAmIDB4RkYpOworICAgICAgICAgICAgICAgICAgICAgICAgdVB0ciArPSB1UGxhbmUuY29sSW5jOworICAgICAgICAgICAgICAgICAgICAgICAgdlB0ciArPSB2UGxhbmUuY29sSW5jOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHlSb3dQdHIgKz0geVBsYW5lLnJvd0luYzsKKyAgICAgICAgICAgICAgICBpZiAocm93IDwga0hlaWdodCAvIDIpIHsKKyAgICAgICAgICAgICAgICAgICAgdVJvd1B0ciArPSB1UGxhbmUucm93SW5jOworICAgICAgICAgICAgICAgICAgICB2Um93UHRyICs9IHZQbGFuZS5yb3dJbmM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyQnVmZmVyPiBjMkJ1ZmZlciA9IEMyQnVmZmVyOjpDcmVhdGVHcmFwaGljQnVmZmVyKGJsb2NrLT5zaGFyZSgKKyAgICAgICAgICAgICAgICBibG9jay0+Y3JvcCgpLCBDMkZlbmNle30pKTsKKyAgICAgICAgc2l6ZV90IGluZGV4OworICAgICAgICBzcDxNZWRpYUNvZGVjQnVmZmVyPiBjbGllbnRCdWZmZXI7CisgICAgICAgIEFTU0VSVF9FUShPSywgYnVmZmVycy0+cmVn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OworICAgICAgICBBU1NFUlRfRVEoMXUsIHlQbGFuZS5tVmVydFN1YnNhbXBsaW5nKTsKKyAgICAgICAgQVNTRVJUX0VRKDJ1LCB1UGxhbmUubUhvcml6U3Vic2FtcGxpbmcpOworICAgICAgICBBU1NFUlRfRVEoMnUsIHVQbGFuZS5tVmVydFN1YnNhbXBsaW5nKTsKKyAgICAgICAgQVNTRVJUX0VRKDJ1LCB2UGxhbmUubUhvcml6U3Vic2FtcGxpbmcpOworICAgICAgICBBU1NFUlRfRVEoMnUsIHZQbGFuZS5tVmVydFN1YnNhbXBsaW5nKTsKKworICAgICAgICB1aW50OF90ICp5Um93UHRyID0gY2xpZW50QnVmZmVyLT5kYXRhKCkgKyB5UGxhbmUubU9mZnNldDsKKyAgICAgICAgdWludDhfdCAqdVJvd1B0ciA9IGNsaWVudEJ1ZmZlci0+ZGF0YSgpICsgdVBsYW5lLm1PZmZzZXQ7CisgICAgICAgIHVpbnQ4X3QgKnZSb3dQdHIgPSBjbGllbnRCdWZmZXItPmRhdGEoKSArIHZQbGFuZS5tT2Zmc2V0OworICAgICAgICBmb3IgKGludDMyX3Qgcm93ID0gMDsgcm93IDwga0hlaWdodDsgKytyb3cpIHsKKyAgICAgICAgICAgIHVpbnQ4X3QgKnlQdHIgPSB5Um93UHRyOworICAgICAgICAgICAgdWludDhfdCAqdVB0ciA9IHVSb3dQdHI7CisgICAgICAgICAgICB1aW50OF90ICp2UHRyID0gdlJvd1B0cjsKKyAgICAgICAgICAgIGZvciAoaW50MzJfdCBjb2wgPSAwOyBjb2wgPCBrV2lkdGg7ICsrY29sKSB7CisgICAgICAgICAgICAgICAgQVNTRVJUX0VRKChyb3cgKyBjb2wpICYgMHhGRiwgKnlQdHIpOworICAgICAgICAgICAgICAgIHlQdHIgKz0geVBsYW5lLm1Db2xJbmM7CisgICAgICAgICAgICAgICAgaWYgKHJvdyA8IGtIZWlnaHQgLyAyICYmIGNvbCA8IGtXaWR0aCAvIDIpIHsKKyAgICAgICAgICAgICAgICAgICAgQVNTRVJUX0VRKChyb3cgKyBjb2wgKyAxKSAmIDB4RkYsICp1UHRyKTsKKyAgICAgICAgICAgICAgICAgICAgQVNTRVJUX0VRKChyb3cgKyBjb2wgKyAyKSAmIDB4RkYsICp2UHRyKTsKKyAgICAgICAgICAgICAgICAgICAgdVB0ciArPSB1UGxhbmUubUNvbEluYzsKKyAgICAgICAgICAgICAgICAgICAgdlB0ciArPSB2UGxhbmUubUNvbEluYzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICB5Um93UHRyICs9IHlQbGFuZS5tUm93SW5jOworICAgICAgICAgICAgaWYgKHJvdyA8IGtIZWlnaHQgLyAyKSB7CisgICAgICAgICAgICAgICAgdVJvd1B0ciArPSB1UGxhbmUubVJvd0luYzsKKyAgICAgICAgICAgICAgICB2Um93UHRyICs9IHZQbGFuZS5tUm93SW5jOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQorCitURVNUKFJhd0dyYXBoaWNPdXRwdXRCdWZmZXJzVGVzdCwgUDAxMENvbG9yRm9ybWF0KSB7CisgICAgY29uc3RleHByIGludDMyX3Qga1dpZHRoID0gMzIwOworICAgIGNvbnN0ZXhwciBpbnQzMl90IGtIZWlnaHQgPSAyNDA7CisKKyAgICBzdGQ6OnNoYXJlZF9wdHI8UmF3R3JhcGhpY091dHB1dEJ1ZmZlcnM+IGJ1ZmZlcnMgPQorICAgICAgICBzdGQ6Om1ha2Vfc2hhcmVkPFJhd0dyYXBoaWNPdXRwdXRCdWZmZXJzPigidGVzdCBQMDEwIik7CisKKyAgICBzcDxBTWVzc2FnZT4gZm9ybWF0e25ldyBBTWVzc2FnZX07CisgICAgZm9ybWF0LT5zZXRJbnQzMihLRVlfV0lEVEgsIGtXaWR0aCk7CisgICAgZm9ybWF0LT5zZXRJbnQzMihLRVlfSEVJR0hULCBrSGVpZ2h0KTsKKyAgICBmb3JtYXQtPnNldEludDMyKEtFWV9DT0xPUl9G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BsYW5lLnJpZ2h0U2hpZnQpOworCisgICAgICAgIC8vIFYgcGxhbmUKKyAgICAgICAgQVNTRVJUX0VRKDJ1LCB2UGxhbmUuY29sU2FtcGxpbmcpOworICAgICAgICBBU1NFUlRfRVEoMnUsIHZQbGFuZS5yb3dTYW1wbGluZyk7CisgICAgICAgIEFTU0VSVF9FUSgxNnUsIHZQbGFuZS5hbGxvY2F0ZWREZXB0aCk7CisgICAgICAgIEFTU0VSVF9FUSgxMHUsIHZQbGFuZS5iaXREZXB0aCk7CisgICAgICAgIEFTU0VSVF9FUSg2dSwgdlBsYW5lLnJpZ2h0U2hpZnQpOworCisgICAgICAgIHVpbnQ4X3QgKnlSb3dQdHIgPSB2aWV3LmRhdGEoKVtDMlBsYW5hckxheW91dDo6UExBTkVfWV07CisgICAgICAgIHVpbnQ4X3QgKnVSb3dQdHIgPSB2aWV3LmRhdGEoKVtDMlBsYW5hckxheW91dDo6UExBTkVfVV07CisgICAgICAgIHVpbnQ4X3QgKnZSb3dQdHIgPSB2aWV3LmRhdGEoKVtDMlBsYW5hckxheW91dDo6UExBTkVfVl07CisgICAgICAgIGZvciAoaW50MzJfdCByb3cgPSAwOyByb3cgPCBrSGVpZ2h0OyArK3JvdykgeworICAgICAgICAgICAgdWludDhfdCAqeVB0ciA9IHlSb3dQdHI7CisgICAgICAgICAgICB1aW50OF90ICp1UHRyID0gdVJvd1B0cjsKKyAgICAgICAgICAgIHVpbnQ4X3QgKnZQdHIgPSB2Um93UHRyOworICAgICAgICAgICAgZm9yIChpbnQzMl90IGNvbCA9IDA7IGNvbCA8IGtXaWR0aDsgKytjb2wpIHsKKyAgICAgICAgICAgICAgICB5UHRyWzBdID0gKChyb3cgKyBjb2wpICYgMHgzKSA8PCA2OworICAgICAgICAgICAgICAgIHlQdHJbMV0gPSAoKHJvdyArIGNvbCkgJiAweDNGQykgPj4gMjsKKyAgICAgICAgICAgICAgICB5UHRyICs9IHlQbGFuZS5jb2xJbmM7CisKKyAgICAgICAgICAgICAgICBpZiAocm93IDwga0hlaWdodCAvIDIgJiYgY29sIDwga1dpZHRoIC8gMikgeworICAgICAgICAgICAgICAgICAgICB1UHRyWzBdID0gKChyb3cgKyBjb2wgKyAxKSAmIDB4MykgPDwgNjsKKyAgICAgICAgICAgICAgICAgICAgdVB0clsxXSA9ICgocm93ICsgY29sICsgMSkgJiAweDNGQykgPj4gMjsKKyAgICAgICAgICAgICAgICAgICAgdlB0clswXSA9ICgocm93ICsgY29sICsgMikgJiAweDMpIDw8IDY7CisgICAgICAgICAgICAgICAgICAgIHZQdHJbMV0gPSAoKHJvdyArIGNvbCArIDIpICYgMHgzRkMpID4+IDI7CisgICAgICAgICAgICAgICAgICAgIHVQdHIgKz0gdVBsYW5lLmNvbEluYzsKKyAgICAgICAgICAgICAgICAgICAgdlB0ciArPSB2UGxhbmUuY29sSW5jOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHlSb3dQdHIgKz0geVBsYW5lLnJvd0luYzsKKyAgICAgICAgICAgIGlmIChyb3cgPCBrSGVpZ2h0IC8gMikgeworICAgICAgICAgICAgICAgIHVSb3dQdHIgKz0gdVBsYW5lLnJvd0luYzsKKyAgICAgICAgICAgICAgICB2Um93UHRyICs9IHZQbGFuZS5yb3dJbmM7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBzdGQ6OnNoYXJlZF9wdHI8QzJCdWZmZXI+IGMyQnVmZmVyID0gQzJCdWZmZXI6OkNyZWF0ZUdyYXBoaWNCdWZmZXIoYmxvY2stPnNoYXJlKAorICAgICAgICAgICAgYmxvY2stPmNyb3AoKSwgQzJGZW5jZXt9KSk7CisgICAgc2l6ZV90IGluZGV4OworICAgIHNwPE1lZGlhQ29kZWNCdWZmZXI+IGNsaWVudEJ1ZmZlcjsKKyAgICBBU1NFUlRfRVEoT0ssIGJ1ZmZlcnMtPnJlZ2lzdGVyQnVmZmVyKGMyQnVmZmVyLCAmaW5kZXg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IDB4MykgPDwgNiwgdVB0clswXSk7CisgICAgICAgICAgICAgICAgQVNTRVJUX0VRKCgocm93ICsgY29sICsgMSkgJiAweDNGQykgPj4gMiwgdVB0clsxXSk7CisgICAgICAgICAgICAgICAgQVNTRVJUX0VRKCgocm93ICsgY29sICsgMikgJiAweDMpIDw8IDYsIHZQdHJbMF0pOworICAgICAgICAgICAgICAgIEFTU0VSVF9FUSgoKHJvdyArIGNvbCArIDIpICYgMHgzRkMpID4+IDIsIHZQdHJbMV0pOworICAgICAgICAgICAgICAgIHVQdHIgKz0gdVBsYW5lLm1Db2xJbmM7CisgICAgICAgICAgICAgICAgdlB0ciArPSB2UGxhbmUubUNvbEluYzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB5Um93UHRyICs9IHlQbGFuZS5tUm93SW5jOworICAgICAgICBpZiAocm93IDwga0hlaWdodCAvIDIpIHsKKyAgICAgICAgICAgIHVSb3dQdHIgKz0gdVBsYW5lLm1Sb3dJbmM7CisgICAgICAgICAgICB2Um93UHRyICs9IHZQbGFuZS5tUm93SW5jOworICAgICAgICB9CisgICAgfQorfQorCitjbGFzcyBUZXN0R3JhcGhpY0FsbG9jYXRpb24gOiBwdWJsaWMgQzJHcmFwaGljQWxsb2NhdGlvbiB7CitwdWJsaWM6CisgICAgVGVzdEdyYXBoaWNBbGxvY2F0aW9uKAorICAgICAgICAgICAgdWludDMyX3Qgd2lkdGgsCisgICAgICAgICAgICB1aW50MzJfdCBoZWlnaHQsCisgICAgICAgICAgICBjb25zdCBDMlBsYW5hckxheW91dCAmbGF5b3V0LAorICAgICAgICAgICAgc2l6ZV90IGNhcGFjaXR5LAorICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c2l6ZV90PiBvZmZzZXRzKQorICAgICAgICA6IEMyR3JhcGhpY0FsbG9jYXRpb24od2lkdGgsIGhlaWdodCksCisgICAgICAgICAgbUxheW91dChsYXlvdXQpLAorICAgICAgICAgIG1NZW1vcnkoY2FwYWNpdHksIDB4QUEpLAorICAgICAgICAgIG1PZmZzZXRzKG9mZnNldHMpIHsKKyAgICB9CisKKyAgICBjMl9zdGF0dXNfdCBtYXAoCisgICAgICAgICAgICBDMlJlY3QgcmVjdCwgQzJNZW1vcnlVc2FnZSB1c2FnZSwgQzJGZW5jZSAqZmVuY2UsCisgICAgICAgICAgICBDMlBsYW5hckxheW91dCAqbGF5b3V0LCB1aW50OF90ICoqYWRkcikgb3ZlcnJpZGUgeworICAgICAgICAodm9pZClyZWN0OworICAgICAgICAodm9pZCl1c2FnZTsKKyAgICAgICAgKHZvaWQpZmVuY2U7CisgICAgICAgICpsYXlvdXQgPSBtTGF5b3V0OworICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG1MYXlvdXQubnVtUGxhbmVzOyArK2kpIHsKKyAgICAgICAgICAgIGFkZHJbaV0gPSBtTWVtb3J5LmRhdGEoKSArIG1PZmZzZXRzW2ldOworICAgICAgICB9CisgICAgICAgIHJldHVybiBDMl9PSzsKKyAgICB9CisKKyAgICBjMl9zdGF0dXNfdCB1bm1hcCh1aW50OF90ICoqLCBDMlJlY3QsIEMyRmVuY2UgKikgb3ZlcnJpZGUgeyByZXR1cm4gQzJfT0s7IH0KKworICAgIEMyQWxsb2NhdG9yOjppZF90IGdldEFsbG9jYXRvcklkKCkgY29uc3Qgb3ZlcnJpZGUgeyByZXR1cm4gLTE7IH0KKworICAgIGNvbnN0IEMySGFuZGxlICpoYW5kbGUoKSBjb25zdCBvdmVycmlkZSB7IHJldHVybiBudWxscHRyOyB9CisKKyAgICBib29sIGVxdWFscyhjb25zdCBzdGQ6OnNoYXJlZF9wdHI8Y29uc3QgQzJHcmFwaGljQWxsb2NhdGlvbj4gJm90aGVyKSBjb25zdCBvdmVycmlkZSB7CisgICAgICAgIHJldHVybiBvdGhlci5nZXQoKSA9PSB0aGlzOworICAgIH0KKworcHJpdmF0ZToKKyAgICBDMlBsYW5hckxheW91dCBtTGF5b3V0OworICAgIHN0ZDo6dmVjdG9yPHVpbnQ4X3Q+IG1NZW1vcnk7CisgICAgc3RkOjp2ZWN0b3I8dWludDhfdCAqPiBtQWRkcjsKKyAgICBzdGQ6OnZlY3RvcjxzaXplX3Q+IG1PZmZzZXRzOworfTsKKworY2xhc3MgTGF5b3V0VGVzdCA6IHB1YmxpYyA6OnRlc3Rpbmc6OlRlc3RXaXRoUGFyYW08c3RkOjp0dXBsZTxib29sLCBzdGQ6OnN0cmluZywgYm9vbCwgaW50MzJfdD4+IHsKK3ByaXZhdGU6CisgICAgc3RhdGljIEMyUGxhbmFyTGF5b3V0IFlVVlBsYW5hckxheW91dChpbnQzMl90IHN0cmlkZSkgeworICAgICAgICBDMlBsYW5hckxheW91dCBsYXlvdXQgPSB7CisgICAgICAgICAgICBDMlBsYW5hckxheW91dDo6VFlQRV9ZVVYsCisgICAgICAgICAgICAzLCAgLyogbnVtUGxhbmVzICovCisgICAgICAgICAgICAzLCAgLyogcm9vdFBsYW5lcyAqLworICAgICAgICAgICAge30sICAvKiBwbGFuZXMgLS0tIHRvIGJlIGZpbGxlZCBiZWxvdyAqLworICAgICAgICB9OworICAgICAgICBsYXlvdXQucGxhbmVzW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9ZXSA9IHsKKyAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpDSEFOTkVMX1ksCisgICAgICAgICAgICAxLCAgLyogY29sSW5jICovCisgICAgICAgICAgICBzdHJpZGUsICAvKiByb3dJbmMgKi8KKyAgICAgICAgICAgIDEsICAvKiBjb2xTYW1wbGluZyAqLworICAgICAgICAgICAgMSwgIC8qIHJvd1NhbXBsaW5nICovCisgICAgICAgICAgICA4LCAgLyogYWxsb2NhdGVkRGVwdGggKi8KKyAgICAgICAgICAgIDgsICAvKiBiaXREZXB0aCAqLworICAgICAgICAgICAgMCwgIC8qIHJpZ2h0U2hpZnQgKi8KKyAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpOQVRJVkUsCisgICAgICAgICAgICBDMlBsYW5hckxheW91dDo6UExBTkVfWSwgIC8qIHJvb3RJeCAqLworICAgICAgICAgICAgMCwgIC8qIG9mZnNldCAqLworICAgICAgICB9OworICAgICAgICBsYXlvdXQucGxhbmVzW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9VXSA9IHsKKyAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpDSEFOTkVMX0NCLAorICAgICAgICAgICAgMSwgIC8qIGNvbEluYyAqLworICAgICAgICAgICAgc3RyaWRlIC8gMiwgIC8qIHJvd0luYyAqLworICAgICAgICAgICAgMiwgIC8qIGNvbFNhbXBsaW5nICovCisgICAgICAgICAgICAyLCAgLyogcm93U2FtcGxpbmcgKi8KKyAgICAgICAgICAgIDgsICAvKiBhbGxvY2F0ZWREZXB0aCAqLworICAgICAgICAgICAgOCwgIC8qIGJpdERlcHRoICovCisgICAgICAgICAgICAwLCAgLyogcmlnaHRTaGlmdCAqLworICAgICAgICAgICAgQzJQbGFuZUluZm86Ok5BVElWRSwKKyAgICAgICAgICAgIEMyUGxhbmFyTGF5b3V0OjpQTEFORV9VLCAgLyogcm9vdEl4ICovCisgICAgICAgICAgICAwLCAgLyogb2Zmc2V0ICovCisgICAgICAgIH07CisgICAgICAgIGxheW91dC5wbGFuZXNbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1ZdID0geworICAgICAgICAgICAgQzJQbGFuZUluZm86OkNIQU5ORUxfQ1IsCisgICAgICAgICAgICAxLCAgLyogY29sSW5jICovCisgICAgICAgICAgICBzdHJpZGUgLyAyLCAgLyogcm93SW5jICovCisgICAgICAgICAgICAyLCAgLyogY29sU2FtcGxpbmcgKi8KKyAgICAgICAgICAgIDIsICAvKiByb3dTYW1wbGluZyAqLworICAgICAgICAgICAgOCwgIC8qIGFsbG9jYXRlZERlcHRoICovCisgICAgICAgICAgICA4LCAgLyogYml0RGVwdGggKi8KKyAgICAgICAgICAgIDAsICAvKiByaWdodFNoaWZ0ICovCisgICAgICAgICAgICBDMlBsYW5lSW5mbzo6TkFUSVZFLAorICAgICAgICAgICAgQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1YsICAvKiByb290SXggKi8KKyAgICAgICAgICAgIDAsICAvKiBvZmZzZXQgKi8KKyAgICAgICAgfTsKKyAgICAgICAgcmV0dXJuIGxheW91dDsKKyAgICB9CisKKyAgICBzdGF0aWMgQzJQbGFuYXJMYXlvdXQgWVVWU2VtaVBsYW5hckxheW91dChpbnQzMl90IHN0cmlkZSkgeworICAgICAgICBDMlBsYW5hckxheW91dCBsYXlvdXQgPSB7CisgICAgICAgICAgICBDMlBsYW5hckxheW91dDo6VFlQRV9ZVVYsCisgICAgICAgICAgICAzLCAgLyogbnVtUGxhbmVzICovCisgICAgICAgICAgICAyLCAgLyogcm9vdFBsYW5lcyAqLworICAgICAgICAgICAge30sICAvKiBwbGFuZXMgLS0tIHRvIGJlIGZpbGxlZCBiZWxvdyAqLworICAgICAgICB9OworICAgICAgICBsYXlvdXQucGxhbmVzW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9ZXSA9IHsKKyAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpDSEFOTkVMX1ksCisgICAgICAgICAgICAxLCAgLyogY29sSW5jICovCisgICAgICAgICAgICBzdHJpZGUsICAvKiByb3dJbmMgKi8KKyAgICAgICAgICAgIDEsICAvKiBjb2xTYW1wbGluZyAqLworICAgICAgICAgICAgMSwgIC8qIHJvd1NhbXBsaW5nICovCisgICAgICAgICAgICA4LCAgLyogYWxsb2NhdGVkRGVwdGggKi8KKyAgICAgICAgICAgIDgsICAvKiBiaXREZXB0aCAqLworICAgICAgICAgICAgMCwgIC8qIHJpZ2h0U2hpZnQgKi8KKyAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpOQVRJVkUsCisgICAgICAgICAgICBDMlBsYW5hckxheW91dDo6UExBTkVfWSwgIC8qIHJvb3RJeCAqLworICAgICAgICAgICAgMCwgIC8qIG9mZnNldCAqLworICAgICAgICB9OworICAgICAgICBsYXlvdXQucGxhbmVzW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9VXSA9IHsKKyAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpDSEFOTkVMX0NCLAorICAgICAgICAgICAgMiwgIC8qIGNvbEluYyAqLworICAgICAgICAgICAgc3RyaWRlLCAgLyogcm93SW5jICovCisgICAgICAgICAgICAyLCAgLyogY29sU2FtcGxpbmcgKi8KKyAgICAgICAgICAgIDIsICAvKiByb3dTYW1wbGluZyAqLworICAgICAgICAgICAgOCwgIC8qIGFsbG9jYXRlZERlcHRoICovCisgICAgICAgICAgICA4LCAgLyogYml0RGVwdGggKi8KKyAgICAgICAgICAgIDAsICAvKiByaWdodFNoaWZ0ICovCisgICAgICAgICAgICBDMlBsYW5lSW5mbzo6TkFUSVZFLAorICAgICAgICAgICAgQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1UsICAvKiByb290SXggKi8KKyAgICAgICAgICAgIDAsICAvKiBvZmZzZXQgKi8KKyAgICAgICAgfTsKKyAgICAgICAgbGF5b3V0LnBsYW5lc1tDMlBsYW5hckxheW91dDo6UExBTkVfVl0gPSB7CisgICAgICAgICAgICBDMlBsYW5lSW5mbzo6Q0hBTk5FTF9DUiwKKyAgICAgICAgICAgIDIsICAvKiBjb2xJbmMgKi8KKyAgICAgICAgICAgIHN0cmlkZSwgIC8qIHJvd0luYyAqLworICAgICAgICAgICAgMiwgIC8qIGNvbFNhbXBsaW5nICovCisgICAgICAgICAgICAyLCAgLyogcm93U2FtcGxpbmcgKi8KKyAgICAgICAgICAgIDgsICAvKiBhbGxvY2F0ZWREZXB0aCAqLworICAgICAgICAgICAgOCwgIC8qIGJpdERlcHRoICovCisgICAgICAgICAgICAwLCAgLyogcmlnaHRTaGlmdCAqLworICAgICAgICAgICAgQzJQbGFuZUluZm86Ok5BVElWRSwKKyAgICAgICAgICAgIEMyUGxhbmFyTGF5b3V0OjpQTEFORV9VLCAgLyogcm9vdEl4ICovCisgICAgICAgICAgICAxLCAgLyogb2Zmc2V0ICovCisgICAgICAgIH07CisgICAgICAgIHJldHVybiBsYXlvdXQ7CisgICAgfQorCisgICAgc3RhdGljIEMyUGxhbmFyTGF5b3V0IFlWVVNlbWlQbGFuYXJMYXlvdXQoaW50MzJfdCBzdHJpZGUpIHsKKyAgICAgICAgQzJQbGFuYXJMYXlvdXQgbGF5b3V0ID0geworICAgICAgICAgICAgQzJQbGFuYXJMYXlvdXQ6OlRZUEVfWVVWLAorICAgICAgICAgICAgMywgIC8qIG51bVBsYW5lcyAqLworICAgICAgICAgICAgMiwgIC8qIHJvb3RQbGFuZXMgKi8KKyAgICAgICAgICAgIHt9LCAgLyogcGxhbmVzIC0tLSB0byBiZSBmaWxsZWQgYmVsb3cgKi8KKyAgICAgICAgfTsKKyAgICAgICAgbGF5b3V0LnBsYW5lc1tDMlBsYW5hckxheW91dDo6UExBTkVfWV0gPSB7CisgICAgICAgICAgICBDMlBsYW5lSW5mbzo6Q0hBTk5FTF9ZLAorICAgICAgICAgICAgMSwgIC8qIGNvbEluYyAqLworICAgICAgICAgICAgc3RyaWRlLCAgLyogcm93SW5jICovCisgICAgICAgICAgICAxLCAgLyogY29sU2FtcGxpbmcgKi8KKyAgICAgICAgICAgIDEsICAvKiByb3dTYW1wbGluZyAqLworICAgICAgICAgICAgOCwgIC8qIGFsbG9jYXRlZERlcHRoICovCisgICAgICAgICAgICA4LCAgLyogYml0RGVwdGggKi8KKyAgICAgICAgICAgIDAsICAvKiByaWdodFNoaWZ0ICovCisgICAgICAgICAgICBDMlBsYW5lSW5mbzo6TkFUSVZFLAorICAgICAgICAgICAgQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1ksICAvKiByb290SXggKi8KKyAgICAgICAgICAgIDAsICAvKiBvZmZzZXQgKi8KKyAgICAgICAgfTsKKyAgICAgICAgbGF5b3V0LnBsYW5lc1tDMlBsYW5hckxheW91dDo6UExBTkVfVV0gPSB7CisgICAgICAgICAgICBDMlBsYW5lSW5mbzo6Q0hBTk5FTF9DQiwKKyAgICAgICAgICAgIDIsICAvKiBjb2xJbmMgKi8KKyAgICAgICAgICAgIHN0cmlkZSwgIC8qIHJvd0luYyAqLworICAgICAgICAgICAgMiwgIC8qIGNvbFNhbXBsaW5nICovCisgICAgICAgICAgICAyLCAgLyogcm93U2FtcGxpbmcgKi8KKyAgICAgICAgICAgIDgsICAvKiBhbGxvY2F0ZWREZXB0aCAqLworICAgICAgICAgICAgOCwgIC8qIGJpdERlcHRoICovCisgICAgICAgICAgICAwLCAgLyogcmlnaHRTaGlmdCAqLworICAgICAgICAgICAgQzJQbGFuZUluZm86Ok5BVElWRSwKKyAgICAgICAgICAgIEMyUGxhbmFyTGF5b3V0OjpQTEFORV9WLCAgLyogcm9vdEl4ICovCisgICAgICAgICAgICAxLCAgLyogb2Zmc2V0ICovCisgICAgICAgIH07CisgICAgICAgIGxheW91dC5wbGFuZXNbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1ZdID0geworICAgICAgICAgICAgQzJQbGFuZUluZm86OkNIQU5ORUxfQ1IsCisgICAgICAgICAgICAyLCAgLyogY29sSW5jICovCisgICAgICAgICAgICBzdHJpZGUsICAvKiByb3dJbmMgKi8KKyAgICAgICAgICAgIDIsICAvKiBjb2xTYW1wbGluZyAqLworICAgICAgICAgICAgMiwgIC8qIHJvd1NhbXBsaW5nICovCisgICAgICAgICAgICA4LCAgLyogYWxsb2NhdGVkRGVwdGggKi8KKyAgICAgICAgICAgIDgsICAvKiBiaXREZXB0aCAqLworICAgICAgICAgICAgMCwgIC8qIHJpZ2h0U2hpZnQgKi8KKyAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpOQVRJVkUsCisgICAgICAgICAgICBDMlBsYW5hckxheW91dDo6UExBTkVfViwgIC8qIHJvb3RJeCAqLworICAgICAgICAgICAgMCwgIC8qIG9mZnNldCAqLworICAgICAgICB9OworICAgICAgICByZXR1cm4gbGF5b3V0OworICAgIH0KKworICAgIHN0YXRpYyBzdGQ6OnNoYXJlZF9wdHI8QzJHcmFwaGljQmxvY2s+IENyZWF0ZUdyYXBoaWNCbG9jaygKKyAgICAgICAgICAgIHVpbnQzMl90IHdpZHRoLAorICAgICAgICAgICAgdWludDMyX3QgaGVpZ2h0LAorICAgICAgICAgICAgY29uc3QgQzJQbGFuYXJMYXlvdXQgJmxheW91dCwKKyAgICAgICAgICAgIHNpemVfdCBjYXBhY2l0eSwKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHNpemVfdD4gb2Zmc2V0cykgeworICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJHcmFwaGljQWxsb2NhdGlvbj4gYWxsb2MgPSBzdGQ6Om1ha2Vfc2hhcmVkPFRlc3RHcmFwaGljQWxsb2NhdGlvbj4oCisgICAgICAgICAgICAgICAgd2lkdGgsCisgICAgICAgICAgICAgICAgaGVpZ2h0LAorICAgICAgICAgICAgICAgIGxheW91dCwKKyAgICAgICAgICAgICAgICBjYXBhY2l0eSwKKyAgICAgICAgICAgICAgICBvZmZzZXRzKTsKKworICAgICAgICByZXR1cm4gX0MyQmxvY2tGYWN0b3J5OjpDcmVhdGVHcmFwaGljQmxvY2soYWxsb2MpOworICAgIH0KKworICAgIHN0YXRpYyBjb25zdGV4cHIgdWludDhfdCBHZXRQaXhlbFZhbHVlKHVpbnQ4X3QgdmFsdWUsIHVpbnQzMl90IHJvdywgdWludDMyX3QgY29sKSB7CisgICAgICAgIHJldHVybiAodWludDMyX3QodmFsdWUpICogcm93ICsgY29sKSAmIDB4RkY7CisgICAgfQorCisgICAgc3RhdGljIHZvaWQgRmlsbFBsYW5lKEMyR3JhcGhpY1ZpZXcgJnZpZXcsIHNpemVfdCBpbmRleCwgdWludDhfdCB2YWx1ZSkgeworICAgICAgICBDMlBsYW5hckxheW91dCBsYXlvdXQgPSB2aWV3LmxheW91dCgpOworCisgICAgICAgIHVpbnQ4X3QgKnJvd1B0ciA9IHZpZXcuZGF0YSgpW2luZGV4XTsKKyAgICAgICAgQzJQbGFuZUluZm8gcGxhbmUgPSBsYXlvdXQucGxhbmVzW2luZGV4XTsKKyAgICAgICAgZm9yICh1aW50MzJfdCByb3cgPSAwOyByb3cgPCB2aWV3LmhlaWdodCgpIC8gcGxhbmUucm93U2FtcGxpbmc7ICsrcm93KSB7CisgICAgICAgICAgICB1aW50OF90ICpjb2xQdHIgPSByb3dQdHI7CisgICAgICAgICAgICBmb3IgKHVpbnQzMl90IGNvbCA9IDA7IGNvbCA8IHZpZXcud2lkdGgoKSAvIHBsYW5lLmNvbFNhbXBsaW5nOyArK2NvbCkgeworICAgICAgICAgICAgICAgICpjb2xQdHIgPSBHZXRQaXhlbFZhbHVlKHZhbHVlLCByb3csIGNvbCk7CisgICAgICAgICAgICAgICAgY29sUHRyICs9IHBsYW5lLmNvbEluYzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJvd1B0ciArPSBwbGFuZS5yb3dJbmM7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBzdGF0aWMgdm9pZCBGaWxsQmxvY2soY29uc3Qgc3RkOjpzaGFyZWRfcHRyPEMyR3JhcGhpY0Jsb2NrPiAmYmxvY2spIHsKKyAgICAgICAgQzJHcmFwaGljVmlldyB2aWV3ID0gYmxvY2stPm1hcCgpLmdldCgpOworCisgICAgICAgIEZpbGxQbGFuZSh2aWV3LCBDMlBsYW5hckxheW91dDo6UExBTkVfWSwgJ1knKTsKKyAgICAgICAgRmlsbFBsYW5lKHZpZXcsIEMyUGxhbmFyTGF5b3V0OjpQTEFORV9VLCAnVScpOworICAgICAgICBGaWxsUGxhbmUodmlldywgQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1YsICdWJyk7CisgICAgfQorCisgICAgc3RhdGljIGJvb2wgVmVyaWZ5UGxhbmUoCisgICAgICAgICAgICBjb25zdCBNZWRpYUltYWdlMiAqbWVkaWFJbWFnZSwKKyAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKmJhc2UsCisgICAgICAgICAgICB1aW50MzJfdCBpbmRleCwKKyAgICAgICAgICAgIHVpbnQ4X3QgdmFsdWUsCisgICAgICAgICAgICBzdGQ6OnN0cmluZyAqZXJyb3JNc2cpIHsKKyAgICAgICAgKmVycm9yTXNnID0gIiI7CisgICAgICAgIE1lZGlhSW1hZ2UyOjpQbGFuZUluZm8gcGxhbmUgPSBtZWRpYUltYWdlLT5tUGxhbmVbaW5kZXhdOworICAgICAgICBjb25zdCB1aW50OF90ICpyb3dQdHIgPSBiYXNlICsgcGxhbmUubU9mZnNldDsKKyAgICAgICAgZm9yICh1aW50MzJfdCByb3cgPSAwOyByb3cgPCBtZWRpYUltYWdlLT5tSGVpZ2h0IC8gcGxhbmUubVZlcnRTdWJzYW1wbGluZzsgKytyb3cpIHsKKyAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKmNvbFB0ciA9IHJvd1B0cjsKKyAgICAgICAgICAgIGZvciAodWludDMyX3QgY29sID0gMDsgY29sIDwgbWVkaWFJbWFnZS0+bVdpZHRoIC8gcGxhbmUubUhvcml6U3Vic2FtcGxpbmc7ICsrY29sKSB7CisgICAgICAgICAgICAgICAgaWYgKEdldFBpeGVsVmFsdWUodmFsdWUsIHJvdywgY29sKSAhPSAqY29sUHRyKSB7CisgICAgICAgICAgICAgICAgICAgICplcnJvck1zZyA9IEFTdHJpbmdQcmludGYoInJvdz0ldSBjb2w9JXUgZXhwZWN0ZWQ9JTAyeCBhY3R1YWw9JTAyeCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcm93LCBjb2wsIEdldFBpeGVsVmFsdWUodmFsdWUsIHJvdywgY29sKSwgKmNvbFB0cikuY19zdHIoKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjb2xQdHIgKz0gcGxhbmUubUNvbEluYzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJvd1B0ciArPSBwbGFuZS5tUm93SW5jOworICAgICAgICB9CisgICAgICAgIHJldHVybiB0cnVlOwor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JyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgJ1UnOiBwbGFuZUluZGV4ID0gQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1U7IGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgJ1YnOiBwbGFuZUluZGV4ID0gQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1Y7IGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICByZXR1cm4gbnVsbHB0cjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHBsYW5lT3JkZXJbaV0gPSBwbGFuZUluZGV4OworICAgICAgICB9CisKKyAgICAgICAgaWYgKHBsYW5hcikgeworICAgICAgICAgICAgbGF5b3V0ID0gWVVWUGxhbmFyTGF5b3V0KHN0cmlkZSk7CisgICAgICAgIH0gZWxzZSB7ICAvLyBzZW1pLXBsYW5hcgorICAgICAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCAzOyArK2kpIHsKKyAgICAgICAgICAgICAgICBpZiAocGxhbmVPcmRlcltpXSA9PSBDMlBsYW5hckxheW91dDo6UExBTkVfVSkgeworICAgICAgICAgICAgICAgICAgICBsYXlvdXQgPSBZVVZTZW1pUGxhbmFyTGF5b3V0KHN0cmlkZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAocGxhbmVPcmRlcltpXSA9PSBDMlBsYW5hckxheW91dDo6UExBTkVfVikgeworICAgICAgICAgICAgICAgICAgICBsYXlvdXQgPSBZVlVTZW1pUGxhbmFyTGF5b3V0KHN0cmlkZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBzaXplX3QgeVBsYW5lU2l6ZSA9IHN0cmlkZSAqIGtIZWlnaHQ7CisgICAgICAgIHNpemVfdCB1dlBsYW5lU2l6ZSA9IHN0cmlkZSAqIGtIZWlnaHQgLyA0OworICAgICAgICBzaXplX3QgY2FwYWNpdHkgPSB5UGxhbmVTaXplICsgdXZQbGFuZVNpemUgKiAyOworICAgICAgICBzdGQ6OnZlY3RvcjxzaXplX3Q+IG9mZnNldHMoMyk7CisKKyAgICAgICAgaWYgKCFjb250aWd1b3VzKSB7CisgICAgICAgICAgICBpZiAocGxhbmFyKSB7CisgICAgICAgICAgICAgICAgY2FwYWNpdHkgKz0ga0dhcExlbmd0aCAqIDI7CisgICAgICAgICAgICB9IGVsc2UgeyAgLy8gc2VtaS1wbGFuYXIKKyAgICAgICAgICAgICAgICBjYXBhY2l0eSArPSBrR2FwTGVuZ3RoOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgb2Zmc2V0c1twbGFuZU9yZGVyWzBdXSA9IDA7CisgICAgICAgIHNpemVfdCBwbGFuZVNpemUgPSAocGxhbmVPcmRlclswXSA9PSBDMlBsYW5hckxheW91dDo6UExBTkVfWSkgPyB5UGxhbmVTaXplIDogdXZQbGFuZVNpemU7CisgICAgICAgIGZvciAoc2l6ZV90IGkgPSAxOyBpIDwgMzsgKytpKSB7CisgICAgICAgICAgICBvZmZzZXRzW3BsYW5lT3JkZXJbaV1dID0gb2Zmc2V0c1twbGFuZU9yZGVyW2kgLSAxXV0gKyBwbGFuZVNpemU7CisgICAgICAgICAgICBpZiAoIWNvbnRpZ3VvdXMpIHsKKyAgICAgICAgICAgICAgICBvZmZzZXRzW3BsYW5lT3JkZXJbaV1dICs9IGtHYXBMZW5ndGg7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBwbGFuZVNpemUgPSAocGxhbmVPcmRlcltpXSA9PSBDMlBsYW5hckxheW91dDo6UExBTkVfWSkgPyB5UGxhbmVTaXplIDogdXZQbGFuZVNpemU7CisgICAgICAgICAgICBpZiAoIXBsYW5hciAgLy8gc2VtaS1wbGFuYXIKKyAgICAgICAgICAgICAgICAgICAgJiYgcGxhbmVPcmRlcltpIC0gMV0gIT0gQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1kKKyAgICAgICAgICAgICAgICAgICAgJiYgcGxhbmVPcmRlcltpXSAhPSBDMlBsYW5hckxheW91dDo6UExBTkVfWSkgeworICAgICAgICAgICAgICAgIG9mZnNldHNbcGxhbmVPcmRlcltpXV0gPSBvZmZzZXRzW3BsYW5lT3JkZXJbaSAtIDFdXSArIDE7CisgICAgICAgICAgICAgICAgcGxhbmVTaXplID0gdXZQbGFuZVNpemUgKiAyIC0gMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMkdyYXBoaWNCbG9jaz4gYmxvY2sgPSBDcmVhdGVHcmFwaGljQmxvY2soCisgICAgICAgICAgICAgICAga1dpZHRoLAorICAgICAgICAgICAgICAgIGtIZWlnaHQsCisgICAgICAgICAgICAgICAgbGF5b3V0LAorICAgICAgICAgICAgICAgIGNhcGFjaXR5LAorICAgICAgICAgICAgICAgIG9mZnNldHMpOworICAgICAgICBGaWxsQmxvY2soYmxvY2spOworICAgICAgICByZXR1cm4gQzJCdWZmZXI6OkNyZWF0ZUdyYXBoaWNCdWZmZXIoCisgICAgICAgICAgICAgICAgYmxvY2stPnNoYXJlKGJsb2NrLT5jcm9wKCksIEMyRmVuY2UoKSkpOworICAgIH0KKworICAgIHN0YXRpYyBib29sIFZlcmlmeUNsaWVudEJ1ZmZlcigKKyAgICAgICAgICAgIGNvbnN0IHNwPE1lZGlhQ29kZWNCdWZmZXI+ICZidWZmZXIsIHN0ZDo6c3RyaW5nICplcnJvck1zZykgeworICAgICAgICAqZXJyb3JNc2cgPSAiIjsKKyAgICAgICAgc3A8QUJ1ZmZlcj4gaW1hZ2VEYXRhOworICAgICAgICBpZiAoIWJ1ZmZlci0+Zm9ybWF0KCktPmZpbmRCdWZmZXIoImltYWdlLWRhdGEiLCAmaW1hZ2VEYXRhKSkgeworICAgICAgICAgICAgKmVycm9yTXNnID0gIk1pc3NpbmcgaW1hZ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kgeworICAgICAgICAgICAgKmVycm9yTXNnID0gIlYgcGxhbmUgZG9lcyBub3QgbWF0Y2g6ICIgKyBwbGFuZUVycm9yTXNnOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgaW50MzJfdCB3aWR0aCwgaGVpZ2h0LCBzdHJpZGU7CisgICAgICAgIGJ1ZmZlci0+Zm9ybWF0KCktPmZpbmRJbnQzMihLRVlfV0lEVEgsICZ3aWR0aCk7CisgICAgICAgIGJ1ZmZlci0+Zm9ybWF0KCktPmZpbmRJbnQzMihLRVlfSEVJR0hULCAmaGVpZ2h0KTsKKyAgICAgICAgYnVmZmVyLT5mb3JtYXQoKS0+ZmluZEludDMyKEtFWV9TVFJJREUsICZzdHJpZGUpOworCisgICAgICAgIE1lZGlhSW1hZ2UyIGxlZ2FjeVlMYXlvdXQgPSB7CisgICAgICAgICAgICBNZWRpYUltYWdlMjo6TUVESUFfSU1BR0VfVFlQRV9ZLAorICAgICAgICAgICAgMSwgIC8vIG1OdW1QbGFuZXMKKyAgICAgICAgICAgIHVpbnQzMl90KHdpZHRoKSwKKyAgICAgICAgICAgIHVpbnQzMl90KGhlaWdodCksCisgICAgICAgICAgICA4LAorICAgICAgICAgICAgOCwKKyAgICAgICAgICAgIHt9LCAgLy8gbVBsYW5lCisgICAgICAgIH07CisgICAgICAgIGxlZ2FjeVlMYXlvdXQubVBsYW5lW01lZGlhSW1hZ2UyOjpZXSA9IHsKKyAgICAgICAgICAgIDAsICAvLyBtT2Zmc2V0CisgICAgICAgICAgICAxLCAgLy8gbUNvbEluYworICAgICAgICAgICAgc3RyaWRlLCAgLy8gbVJvd0luYworICAgICAgICAgICAgMSwgIC8vIG1Ib3JpelN1YnNhbXBsaW5nCisgICAgICAgICAgICAxLCAgLy8gbVZlcnRTdWJzYW1wbGluZworICAgICAgICB9OworICAgICAgICBpZiAoIVZlcmlmeVBsYW5lKCZsZWdhY3lZTGF5b3V0LCBidWZmZXItPmRhd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2M2NjBkYyAxMDA2NDQKLS0tIGEvbWVkaWEvY29kZWMyL3NmcGx1Z2luL3Rlc3RzL0NDb2RlY0NvbmZpZ190ZXN0LmNwcAorKysgYi9tZWRpYS9jb2RlYzIvc2ZwbHVnaW4vdGVzdHMvQ0NvZGVjQ29uZmlnX3Rlc3QuY3BwCkBAIC0yMDgsNiArMjA4LDI0IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAud2l0aFNldHRlcihTZXR0ZXI8QzJTdHJlYW1QaXhlbEFzcGVjdFJhdGlvSW5mbzo6b3V0cHV0PikKICAgICAgICAgICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKIAorICAgICAgICAgICAgICAgIGlmIChpc0VuY29kZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1JbnB1dEJpdHJhdGUsIEMyX1BBUkFNS0VZX0JJVFJBVEUpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhEZWZhdWx0KG5ldyBDMlN0cmVhbUJpdHJhdGVJbmZvOjppbnB1dCgwdSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhGaWVsZHMoe0MyRihtSW5wdXRCaXRyYXRlLCB2YWx1ZSkuYW55KCl9KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC53aXRoU2V0dGVyKFNldHRlcjxDMlN0cmVhbUJpdHJhdGVJbmZvOjppbnB1dD4pCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCkpOworCisgICAgICAgICAgICAgICAgICAgIGFkZFBhcmFtZXRlcigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZWZpbmVQYXJhbShtT3V0cHV0Qml0cmF0ZSwgQzJfUEFSQU1LRVlfQklUUkFURSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAud2l0aERlZmF1bHQobmV3IEMyU3RyZWFtQml0cmF0ZUluZm86Om91dHB1dCgwdSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLndpdGhGaWVsZHMoe0MyRihtT3V0cHV0Qml0cmF0ZSwgdmFsdWUpLmFueSgpfSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAuY2FsY3VsYXRlZEFzKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb3B5PEMyU3RyZWFtQml0cmF0ZUluZm86Om91dHB1dCwgQzJTdHJlYW1CaXRyYXRlSW5mbzo6aW5wdXQ+LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW5wdXRCaXRyYXRlKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKyAgICAgICAgICAgICAgICB9CisKICAgICAgICAgICAgICAgICAvLyBUT0RPOiBtb3JlIFNESyBwYXJhbXMKICAgICAgICAgICAgIH0KICAgICAgICAgcHJpdmF0ZToKQEAgLTIyMSwxMSArMjM5LDE5IEBACiAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJTdHJlYW1WZW5kb3JJbnQ2NEluZm86Om91dHB1dD4gbUludDY0T3V0cHV0OwogICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyUG9ydFZlbmRvclN0cmluZ0luZm86OmlucHV0PiBtU3RyaW5nSW5wdXQ7CiAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJTdHJlYW1QaXhlbEFzcGVjdFJhdGlvSW5mbzo6b3V0cHV0PiBtUGl4ZWxBc3BlY3RSYXRpbzsKKyAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMlN0cmVhbUJpdHJhdGVJbmZvOjppbnB1dD4gbUlucHV0Qml0cmF0ZTsKKyAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMlN0cmVhbUJpdHJhdGVJbmZvOjpvdXRwdXQ+IG1PdXRwdXRCaXRyYXRlOwogCiAgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgogICAgICAgICAgICAgc3RhdGljIEMyUiBTZXR0ZXIoYm9vbCwgQzJQPFQ+ICYpIHsKICAgICAgICAgICAgICAgICByZXR1cm4gQzJSOjpPaygpOwogICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBNRSwgdHlwZW5hbWUgREVQPgorICAgICAgICAgICAgc3RhdGljIEMyUiBDb3B5KGJvb2wsIEMyUDxNRT4gJm1lLCBjb25zdCBDMlA8REVQPiAmZGVwKSB7CisgICAgICAgICAgICAgICAgbWUuc2V0KCkudmFsdWUgPSBkZXAudi52YWx1ZTsKKyAgICAgICAgICAgICAgICByZXR1cm4gQzJSOjpPaygpOworICAgICAgICAgICAgfQogICAgICAgICB9OwogCiAgICAgICAgIEltcGwgbUltcGw7CkBAIC00NTcsNCArNDgzLDk3IEBACiAgICAgICAgICAgICA8PCAibUlucHV0Rm9ybWF0ID0gIiA8PCBtQ29uZmlnLm1JbnB1dEZvcm1hdC0+ZGVidWdTdHJpbmcoKS5jX3N0cigpOwogfQogCitURVNUX0YoQ0NvZGVjQ29uZmlnVGVzdCwgRGF0YXNwYWNlVXBkYXRlKSB7CisgICAgaW5pdChDMkNvbXBvbmVudDo6RE9NQUlOX1ZJREVPLCBDMkNvbXBvbmVudDo6S0lORF9FTkNPREVSLCBNSU1FVFlQRV9WSURFT19BVkMpOworCisgICAgQVNTRVJUX0VRKE9LLCBtQ29uZmlnLmluaXRpYWxpemUobVJlZmxlY3RvciwgbUNvbmZpZ3VyYWJsZSkpOworICAgIGNsYXNzIElucHV0U3VyZmFjZVN0dWIgOiBwdWJsaWMgSW5wdXRTdXJmYWNlV3JhcHBlciB7CisgICAgcHVibGljOgorICAgICAgICB+SW5wdXRTdXJmYWNlU3R1YigpIG92ZXJyaWRlID0gZGVmYXVsdDsKKyAgICAgICAgc3RhdHVzX3QgY29ubmVjdChjb25zdCBzdGQ6OnNoYXJlZF9wdHI8Q29kZWMyQ2xpZ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k7Cit9CisKK2NsYXNzIEZyYW1lUmVhc3NlbWJsZXJUZXN0IDogcHVibGljIDo6dGVzdGluZzo6VGVzdCB7CitwdWJsaWM6CisgICAgc3RhdGljIGNvbnN0IEMyTWVtb3J5VXNhZ2Uga1VzYWdlOworICAgIHN0YXRpYyBjb25zdGV4cHIgdWludDY0X3Qga1RpbWVzdGFtcFRvbGVyYW5jZVVzID0gMTAwOworCisgICAgRnJhbWVSZWFzc2VtYmxlclRlc3QoKSB7CisgICAgICAgIG1Jbml0U3RhdHVzID0gR2V0Q29kZWMyQmxvY2tQb29sKEMyQmxvY2tQb29sOjpCQVNJQ19MSU5FQVIsIG51bGxwdHIsICZtUG9vbCk7CisgICAgfQorCisgICAgc3RhdHVzX3QgaW5pdFN0YXR1cygpIGNvbnN0IHsgcmV0dXJuIG1Jbml0U3RhdHVzOyB9CisKKyAgICB2b2lkIHRlc3RQdXNoU2FtZVNpemUoCisgICAgICAgICAgICBzaXplX3QgZW5jb2RlckZyYW1lU2l6ZSwKKyAgICAgICAgICAgIHNpemVfdCBzYW1wbGVSYXRlLAorICAgICAgICAgICAgc2l6ZV90IGNoYW5uZWxDb3VudCwKKyAgICAgICAgICAgIEMyQ29uZmlnOjpwY21fZW5jb2RpbmdfdCBlbmNvZGluZywKKyAgICAgICAgICAgIHNpemVfdCBpbnB1dEZyYW1lU2l6ZUluQnl0ZXMsCisgICAgICAgICAgICBzaXplX3QgY291bnQsCisgICAgICAgICAgICBzaXplX3QgZXhwZWN0ZWRPdXRwdXRTaXplKSB7CisgICAgICAgIEZyYW1lUmVhc3NlbWJsZXIgZnJhbWVSZWFzc2VtYmxlcjsKKyAgICAgICAgZnJhbWVSZWFzc2VtYmxlci5pbml0KAorICAgICAgICAgICAgICAgIG1Qb29sLAorICAgICAgICAgICAgICAgIGtVc2FnZSwKKyAgICAgICAgICAgICAgICBlbmNvZGVyRnJhbWVTaXplLAorICAgICAgICAgICAgICAgIHNhbXBsZVJhdGUsCisgICAgICAgICAgICAgICAgY2hhbm5lbENvdW50LAorICAgICAgICAgICAgICAgIGVuY29kaW5nKTsKKworICAgICAgICBBU1NFUlRfVFJVRShmcmFtZVJlYXNzZW1ibGVyKSA8PCAiRnJhbWVSZWFzc2VtYmxlciBpbml0IGZhaWxlZCI7CisKKyAgICAgICAgc2l6ZV90IGlucHV0SW5kZXggPSAwLCBvdXRwdXRJbmRleCA9IDA7CisgICAgICAgIHNpemVfdCBleHBlY3RDb3VudCA9IDA7CisgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgY291bnQ7ICsraSkgeworICAgICAgICAgICAgc3A8TWVkaWFDb2RlY0J1ZmZlcj4gYnVmZmVyID0gbmV3IE1lZGlhQ29kZWNCdWZmZXIoCisgICAgICAgICAgICAgICAgICAgIG5ldyBBTWVzc2FnZSwgbmV3IEFCdWZmZXIoaW5wdXRGcmFtZVNpemVJbkJ5dGVzKSk7CisgICAgICAgICAgICBidWZmZXItPnNldFJhbmdlKDAsIGlucHV0RnJhbWVTaXplSW5CeXRlcyk7CisgICAgICAgICAgICBidWZmZXItPm1ldGEoKS0+c2V0SW50NjQoCisgICAgICAgICAgICAgICAgICAgICJ0aW1lVXMiLAorICAgICAgICAgICAgICAgICAgICBpbnB1dEluZGV4ICogMTAwMDAwMCAvIHNhbXBsZVJhdGUgLyBjaGFubmVsQ291bnQgLyBCeXRlc1BlclNhbXBsZShlbmNvZGluZykpOworICAgICAgICAgICAgaWYgKGkgPT0gY291bnQgLSAxKSB7CisgICAgICAgICAgICAgICAgYnVmZmVyLT5tZXRhKCktPnNldEludDMyKCJlb3MiLCAxKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZvciAoc2l6ZV90IGogPSAwOyBqIDwgaW5wdXRGcmFtZVNpemVJbkJ5dGVzOyArK2osICsraW5wdXRJbmRleCkgeworICAgICAgICAgICAgICAgIGJ1ZmZlci0+YmFzZSgpW2pdID0gKGlucHV0SW5kZXggJiAweEZGKTsKKyAgICAgICAgICAg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ICAgICAgICAvLyBWZXJpZnkgYnVmZmVyCisgICAgICAgICAgICAgICAgQVNTRVJUX0VRKDF1LCB3b3JrLT5pbnB1dC5idWZmZXJzLnNpemUoKSk7CisgICAgICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyQnVmZmVyPiBidWZmZXIgPSB3b3JrLT5pbnB1dC5idWZmZXJzLmZyb250KCk7CisgICAgICAgICAgICAgICAgQVNTRVJUX0VRKEMyQnVmZmVyRGF0YTo6TElORUFSLCBidWZmZXItPmRhdGEoKS50eXBlKCkpOworICAgICAgICAgICAgICAgIEFTU0VSVF9FUSgxdSwgYnVmZmVyLT5kYXRhKCkubGluZWFyQmxvY2tzKCkuc2l6ZSgpKTsKKyAgICAgICAgICAgICAgICBDMlJlYWRWaWV3IHZpZXcgPSBidWZmZXItPmRhdGEoKS5saW5lYXJCbG9ja3MoKS5mcm9udCgpLm1hcCgpLmdldCgpOworICAgICAgICAgICAgICAgIEFTU0VSVF9FUShDMl9PSywgdmlldy5lcnJvcigpKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfRVEoZW5jb2RlckZyYW1lU2l6ZSAqIEJ5dGVzUGVyU2FtcGxlKGVuY29kaW5nKSwgdmlldy5jYXBhY2l0eSgpKTsKKyAgICAgICAgICAgICAgICBmb3IgKHNpemVfdCBqID0gMDsgaiA8IHZpZXcuY2FwYWNpdHkoKTsgKytqLCArK291dHB1dEluZGV4KSB7CisgICAgICAgICAgICAgICAgICAgIEFTU0VSVF9UUlVFKG91dHB1dEluZGV4IDwgaW5wdXRJbmRleAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCBpbnB1dEluZGV4ID09IGlucHV0RnJhbWVTaXplSW5CeXRlcyAqIGNvdW50KTsKKyAgICAgICAgICAgICAgICAgICAgdWludDhfdCBleHBlY3RlZCA9IG91dHB1dEluZGV4IDwgaW5wdXRJbmRleCA/IChvdXRwdXRJbmRleCAmIDB4RkYpIDogMDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGV4cGVjdENvdW50IDwgMTApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICsrZXhwZWN0Q291bnQ7CisgICAgICAgICAgICAgICAgICAgICAgICBFWFBFQ1RfRVEoZXhwZWN0ZWQsIHZpZXcuZGF0YSgpW2pdKSA8PCAib3V0cHV0IGluZGV4ID0gIiA8PCBvdXRwdXRJbmRleDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEFTU0VSVF9FUShpbnB1dEZyYW1lU2l6ZUluQnl0ZXMgKiBjb3VudCwgaW5wdXRJbmRleCk7CisgICAgICAgIHNpemVfdCBlbmNvZGVyRnJhbWVTaXplSW5CeXRlcyA9CisgICAgICAgICAgICBlbmNvZGVyRnJhbWVTaXplICogY2hhbm5lbENvdW50ICogQnl0ZXNQZXJTYW1wbGUoZW5jb2RpbmcpOworICAgICAgICBBU1NFUlRfRVEoMCwgb3V0cHV0SW5kZXggJSBlbmNvZGVyRnJhbWVTaXplSW5CeXRlcykKKyAgICAgICAgICAgIDw8ICJvdXRwdXQgc2l6ZSBtdXN0IGJlIG11bHRpcGxlIG9mIGZyYW1lIHNpemU6IG91dHB1dCBzaXplID0gIiA8PCBvdXRwdXRJbmRleAorICAgICAgICAgICAgPDwgIiBmcmFtZSBzaXplID0gIiA8PCBlbmNvZGVyRnJhbWVTaXplSW5CeXRlczsKKyAgICAgICAgQVNTRVJUX0VRKGV4cGVjdGVkT3V0cHV0U2l6ZSwgb3V0cHV0SW5kZXgpCisgICAgICAgICAgICA8PCAib3V0cHV0IHNpemUgbXVzdCBiZSBzbWFsbGVzdCBtdWx0aXBsZSBvZiBmcmFtZSBzaXplLCAiCisgICAgICAgICAgICA8PCAiZXF1YWwgdG8gb3IgbGFyZ2VyIHRoYW4gaW5wdXQgc2l6ZS4gb3V0cHV0IHNpemUgPSAiIDw8IG91dHB1dEluZGV4CisgICAgICAgICAgIC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gICAgICAgIDEwMjQgLyogZnJhbWUgc2l6ZSBpbiBzYW1wbGVzICovLAorICAgICAgICAgICAgNDgwMDAgLyogc2FtcGxlIHJhdGUgKi8sCisgICAgICAgICAgICAxIC8qIGNoYW5uZWwgY291bnQgKi8sCisgICAgICAgICAgICBQQ01fMTYsCisgICAgICAgICAgICAyMDQ4IC8qIGlucHV0IGZyYW1lIHNpemUgaW4gYnl0ZXMgPSAxMDI0IHNhbXBsZXMgKiAxIGNoYW5uZWwgKiAyIGJ5dGVzL3NhbXBsZSAqLywKKyAgICAgICAgICAgIDEwIC8qIGNvdW50ICovLAorICAgICAgICAgICAgMjA0ODAgLyogZXhwZWN0ZWQgb3V0cHV0IHNpemUgPSAxMCAqIDIwNDggYnl0ZXMvZnJhbWUgKi8pOworICAgIHRlc3RQdXNoU2FtZVNpemUoCisgICAgICAgICAgICAxMDI0IC8qIGZyYW1lIHNpemUgaW4gc2FtcGxlcyAqLywKKyAgICAgICAgICAgIDQ4MDAwIC8qIHNhbXBsZSByYXRlICovLAorICAgICAgICAgICAgMSAvKiBjaGFubmVsIGNvdW50ICovLAorICAgICAgICAgICAgUENNX0ZMT0FULAorICAgICAgICAgICAgNDA5NiAvKiBpbnB1dCBmcmFtZSBzaXplIGluIGJ5dGVzID0gMTAyNCBzYW1wbGVzICogMSBjaGFubmVsICogNCBieXRlcy9zYW1wbGUgKi8sCisgICAgICAgICAgICAxMCAvKiBjb3VudCAqLywKKyAgICAgICAgICAgIDQwOTYwIC8qIGV4cGVjdGVkIG91dHB1dCBzaXplID0gMTAgKiA0MDk2IGJ5dGVzL2ZyYW1lICovKTsKK30KKworLy8gUHVzaCBmcmFtZXMgd2l0aCBoYWxmIHRoZSBzaXplIHRoYXQgdGhlIGVuY29kZXIgcmVxdWVzdGVkLgorVEVTVF9GKEZyYW1lUmVhc3NlbWJsZXJUZXN0LCBQdXNoSGFsZkZyYW1lU2l6ZSkgeworICAgIEFTU0VSVF9FUShPSywgaW5pdFN0YXR1cygp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ICAgIDEgLyogY2hhbm5lbCBjb3VudCAqLywKKyAgICAgICAgICAgIFBDTV9GTE9BVCwKKyAgICAgICAgICAgIDIwNDggLyogaW5wdXQgZnJhbWUgc2l6ZSBpbiBieXRlcyA9IDUxMiBzYW1wbGVzICogMSBjaGFubmVsICogNCBieXRlcyBwZXIgc2FtcGxlICovLAorICAgICAgICAgICAgMTAgLyogY291bnQgKi8sCisgICAgICAgICAgICAyMDQ4MCAvKiBleHBlY3RlZCBvdXRwdXQgc2l6ZSA9IDUgKiA0MDk2IGJ5dGVzL2ZyYW1lICovKTsKK30KKworLy8gUHVzaCBmcmFtZXMgd2l0aCB0d2ljZSB0aGUgc2l6ZSB0aGF0IHRoZSBlbmNvZGVyIHJlcXVlc3RlZC4KK1RFU1RfRihGcmFtZVJlYXNzZW1ibGVyVGVzdCwgUHVzaERvdWJsZUZyYW1lU2l6ZSkgeworICAgIEFTU0VSVF9FUShPSywgaW5pdFN0YXR1cygpKTsKKyAgICB0ZXN0UHVzaFNhbWVTaXplKAorICAgICAgICAgICAgMTAyNCAvKiBmcmFtZSBzaXplIGluIHNhbXBsZXMgKi8sCisgICAgICAgICAgICA0ODAwMCAvKiBzYW1wbGUgcmF0ZSAqLywKKyAgICAgICAgICAgIDEgLyogY2hhbm5lbCBjb3VudCAqLywKKyAgICAgICAgICAgIFBDTV84LAorICAgICAgICAgICAgMjA0OCAvKiBpbnB1dCBmcmFtZSBzaXplIGluIGJ5dGVzID0gMjA0OCBzYW1wbGVzICogMSBjaGFubmVsICogMSBieXRlcyBwZXIgc2FtcGxlICovLAorICAgICAgICAgICAgMTAgLyogY291bnQgKi8sCisgICAgICAgICAgICAyMDQ4MCAvKiBleHBlY3RlZCBvdXRwdXQgc2l6ZSA9IDIwICogMTAyNCBieXRlcy9mcmFtZSAqLyk7CisgICAgdGVzdFB1c2hTYW1lU2l6ZSgKKyAgICAgICAgICAgIDEwMjQgLyogZnJhbWUgc2l6ZSBpbiBzYW1wbGVzICovLAorICAgICA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VzKCkpOworICAgIHRlc3RQdXNoU2FtZVNpemUoCisgICAgICAgICAgICAxMDI0IC8qIGZyYW1lIHNpemUgaW4gc2FtcGxlcyAqLywKKyAgICAgICAgICAgIDQ4MDAwIC8qIHNhbXBsZSByYXRlICovLAorICAgICAgICAgICAgMSAvKiBjaGFubmVsIGNvdW50ICovLAorICAgICAgICAgICAgUENNXzgsCisgICAgICAgICAgICAxMDI5IC8qIGlucHV0IGZyYW1lIHNpemUgaW4gYnl0ZXMgPSAxMDI5IHNhbXBsZXMgKiAxIGNoYW5uZWwgKiAxIGJ5dGVzIHBlciBzYW1wbGUgKi8sCisgICAgICAgICAgICAxMCAvKiBjb3VudCAqLywKKyAgICAgICAgICAgIDExMjY0IC8qIGV4cGVjdGVkIG91dHB1dCBzaXplID0gMTEgKiAxMDI0IGJ5dGVzL2ZyYW1lICovKTsKKyAgICB0ZXN0UHVzaFNhbWVTaXplKAorICAgICAgICAgICAgMTAyNCAvKiBmcmFtZSBzaXplIGluIHNhbXBsZXMgKi8sCisgICAgICAgICAgICA0ODAwMCAvKiBzYW1wbGUgcmF0ZSAqLywKKyAgICAgICAgICAgIDEgLyogY2hhbm5lbCBjb3VudCAqLywKKyAgICAgICAgICAgIFBDTV8xNiwKKyAgICAgICAgICAgIDIwNTggLyogaW5wdXQgZnJhbWUgc2l6ZSBpbiBieXRlcyA9IDEwMjkgc2FtcGxlcyAqIDEgY2hhbm5lbCAqIDIgYnl0ZXMgcGVyIHNhbXBsZSAqLywKKyAgICAgICAgICAgIDEwIC8qIGNvdW50ICovLAorICAgICAgICAgICAgMjI1MjggLyogZXhwZWN0ZWQgb3V0cHV0IHNpemUgPSAxMSAqIDIwNDggYnl0ZXMvZnJhbWUgKi8pOworICAgIHRlc3RQdXNoU2FtZVNpemUoCisgICAgICAgICAgICAxMDI0IC8qIGZyYW1lIHNpemUgaW4gc2FtcGxlcyAqLywKKyAgICAgICAgICAgIDQ4MDAwIC8qIHNhbXBsZSByYXRlICovLAorICAgICAgICAgICAgMSAvKiBjaGFubmVsIGNvdW50ICovLAorICAgICAgICAgICAgUENNX0ZMT0FULAorICAgICAgICAgICAgNDExNiAvKiBpbnB1dCBmcmFtZSBzaXplIGluIGJ5dGVzID0gMTAyOSBzYW1wbGVzICogMSBjaGFubmVsICogNCBieXRlcyBwZXIgc2FtcGxlICovLAorICAgICAgICAgICAgMTAgLyogY291bnQgKi8sCisgICAgICAgICAgICA0NTA1NiAvKiBleHBlY3RlZCBvdXRwdXQgc2l6ZSA9IDExICogNDA5NiBieXRlcy9mcmFtZSAqLyk7Cit9CisKKy8vIFB1c2ggZnJhbWVzIHdpdGggYSBsaXR0bGUgYml0IHNtYWxsZXIgKC01IHNhbXBsZXMpIHRoYW4gdGhlIHJlcXVlc3RlZCBzaXplLgorVEVTVF9GKEZyYW1lUmVhc3NlbWJsZXJUZXN0LCBQdXNoTGl0dGxlU21hbGxlckZyYW1lU2l6ZSkgeworICAgIEFTU0VSVF9FUShPSywgaW5pdFN0YXR1cygpKTsKKyAgICB0ZXN0UHVzaFNhbWVTaXplKAorICAgICAgICAgICAgMTAyNCAvKiBmcmFtZSBzaXplIGluIHNhbXBsZXMgKi8sCisgICAgICAgICAgICA0ODAwMCAvKiBzYW1wbGUgcmF0ZSAqLywKKyAgICAgICAgICAgIDEgLyogY2hhbm5lbCBjb3VudCAqLywKKyAgICAgICAgICAgIFBDTV84LAorICAgICAgICAgICAgMTAxOSAvKiBpbnB1dCBmcmFtZSBzaXplIGluIGJ5dGVzID0gMTAxOSBzYW1wbGVzICogMSBjaGFubmVsICogMSBieXRlcyBwZXIgc2FtcGxlICovLAorICAgICAgICAgICAgMTAgLyogY291bnQgKi8sCisgICAgICAgICAgICAxMDI0MCAvKiBleHBlY3RlZCBvdXRwdXQgc2l6ZSA9IDEwICogMTAyNCBieXRlcy9mcmFtZSAqLyk7CisgICAgdGVzdFB1c2hTYW1lU2l6ZSgKKyAgICAgICAgICAgIDEwMjQgLyogZnJhbWUgc2l6ZSBpb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cmFtZSBzaXplIGluIHNhbXBsZXMgKi8sCisgICAgICAgICAgICA0ODAwMCAvKiBzYW1wbGUgcmF0ZSAqLywKKyAgICAgICAgICAgIDEgLyogY2hhbm5lbCBjb3VudCAqLywKKyAgICAgICAgICAgIFBDTV84LAorICAgICAgICAgICAgMSAvKiBpbnB1dCBmcmFtZSBzaXplIGluIGJ5dGVzICovLAorICAgICAgICAgICAgMTAwMDAwIC8qIGNvdW50ICovLAorICAgICAgICAgICAgMTAwMzUyIC8qIGV4cGVjdGVkIG91dHB1dCBzaXplID0gOTggKiAxMDI0IGJ5dGVzL2ZyYW1lICovKTsKKyAgICB0ZXN0UHVzaFNhbWVTaXplKAorICAgICAgICAgICAgMTAyNCAvKiBmcmFtZSBzaXplIGluIHNhbXBsZXMgKi8sCisgICAgICAgICAgICA0ODAwMCAvKiBzYW1wbGUgcmF0ZSAqLywKKyAgICAgICAgICAgIDEgLyogY2hhbm5lbCBjb3VudCAqLywKKyAgICAgICAgICAgIFBDTV8xNiwKKyAgICAgICAgICAgIDEgLyogaW5wdXQgZnJhbWUgc2l6ZSBpbiBieXRlcyAqLywKKyAgICAgICAgICAgIDEwMDAwMCAvKiBjb3VudCAqLywKKyAgICAgICAgICAgIDEwMDM1MiAvKiBleHBlY3RlZCBvdXRwdXQgc2l6ZSA9IDQ5ICogMjA0OCBieXRlcy9mcmFtZSAqLyk7CisgICAgdGVzdFB1c2hTYW1lU2l6ZSgKKyAgICAgICAgICAgIDEwMjQgLyogZnJhbWUgc2l6ZSBpbiBzYW1wbGVzICovLAorICAgICAgICAgICAgNDgwMDAgLyogc2FtcGxlIHJhdGUgKi8sCisgICAgICAgICAgICAxIC8qIGNoYW5uZWwgY291bnQgKi8sCisgICAgICAgICAgICBQQ01fRkxPQVQsCisgICAgICAgICAgICAxIC8qIGlucHV0IGZyYW1lIHNpemUgaW4gYnl0ZXMgKi8sCisgICAgICAgICAgICAxMDAwMDAgLyogY291bnQgKi8sCisgICAgICAgICAgICAxMDI0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bVBsYW5lWzFdLm1Sb3dJbmM7CisgICAgaW50MzJfdCBkc3Rfc3RyaWRlX3YgPSBpbWctPm1QbGFuZVsyXS5tUm93SW5jOworICAgIGludCB3aWR0aCA9IHZpZXcuY3JvcCgpLndpZHRoOworICAgIGludCBoZWlnaHQgPSB2aWV3LmNyb3AoKS5oZWlnaHQ7CisKKyAgICBpZiAoSXNOVjEyKHZpZXcpKSB7CisgICAgICAgIGlmIChJc05WMTIoaW1nKSkgeworICAgICAgICAgICAgbGlieXV2OjpDb3B5UGxhbmUoc3JjX3ksIHNyY19zdHJpZGVfeSwgZHN0X3ksIGRzdF9zdHJpZGVfeSwgd2lkdGgsIGhlaWdodCk7CisgICAgICAgICAgICBsaWJ5dXY6OkNvcHlQbGFuZShzcmNfdSwgc3JjX3N0cmlkZV91LCBkc3RfdSwgZHN0X3N0cmlkZV91LCB3aWR0aCwgaGVpZ2h0IC8gMik7CisgICAgICAgICAgICByZXR1cm4gT0s7CisgICAgICAgIH0gZWxzZSBpZiAoSXNOVjIxKGltZykpIHsKKyAgICAgICAgICAgIGlmICghbGlieXV2OjpOVjIxVG9OVjEyKHNyY195LCBzcmNfc3RyaWRlX3ksIHNyY191LCBzcmNfc3RyaWRlX3UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3RfeSwgZHN0X3N0cmlkZV95LCBkc3RfdiwgZHN0X3N0cmlkZV92LCB3aWR0aCwgaGVpZ2h0KSkgeworICAgICAgICAgICAgICAgIHJldHVybiBPSzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmIChJc0k0MjAoaW1nKSkgewogICAgICAgICAgICAgaWYgKCFsaWJ5dXY6Ok5WMTJUb0k0MjAoc3JjX3ksIHNyY19zdHJpZGVfeSwgc3JjX3UsIHNyY19zdHJpZGVfdSwgZHN0X3ksIGRzdF9zdHJpZGVfeSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRzdF91LCBkc3Rfc3RyaWRlX3UsIGRzdF92LCBkc3Rfc3RyaWRlX3YsIHZpZXcuY3JvcCgpLndpZHRoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlldy5jcm9wKCkuaGVpZ2h0KSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHN0X3UsIGRzdF9zdHJpZGVfdSwgZHN0X3YsIGRzdF9zdHJpZGVfdiwgd2lkdGgsIGhlaWdodCkpIHsKICAgICAgICAgICAgICAgICByZXR1cm4gT0s7CiAgICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7CisgICAgICAgIH0KKyAgICB9IGVsc2UgaWYgKElzTlYyMSh2aWV3KSkgeworICAgICAgICBpZiAoSXNOVjEyKGltZykpIHsKKyAgICAgICAgICAgIGlmICghbGlieXV2OjpOVjIxVG9OVjEyKHNyY195LCBzcmNfc3RyaWRlX3ksIHNyY192LCBzcmNfc3RyaWRlX3YsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3RfeSwgZHN0X3N0cmlkZV95LCBkc3RfdSwgZHN0X3N0cmlkZV91LCB3aWR0aCwgaGVpZ2h0KSkgeworICAgICAgICAgICAgICAgIHJldHVybiBPSzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmIChJc05WMjEoaW1nKSkgeworICAgICAgICAgICAgbGlieXV2OjpDb3B5UGxhbmUoc3JjX3ksIHNyY19zdHJpZGVfeSwgZHN0X3ksIGRzdF9zdHJpZGVfeSwgd2lkdGgsIGhlaWdodCk7CisgICAgICAgICAgICBsaWJ5dXY6OkNvcHlQbGFuZShzcmNfdiwgc3JjX3N0cmlkZV92LCBkc3RfdiwgZHN0X3N0cmlkZV92LCB3aWR0aCwgaGVpZ2h0IC8gMik7CisgICAgICAgICAgICByZXR1cm4gT0s7CisgICAgICAgIH0gZWxzZSBpZiAoSXNJNDIwKGltZykpIHsKKyAgICAgICAgICAgIGlmICghbGlieXV2OjpOVjIxVG9JNDIwKHNyY195LCBzcmNfc3RyaWRlX3ksIHNyY192LCBzcmNfc3RyaWRlX3YsIGRzdF95LCBkc3Rfc3RyaWRlX3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3RfdSwgZHN0X3N0cmlkZV91LCBkc3RfdiwgZHN0X3N0cmlkZV92LCB3aWR0aCwgaGVpZ2h0KSkgeworICAgICAgICAgICAgICAgIHJldHVybiBPSzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0gZWxzZSBpZiAoSXNJNDIwKHZpZXcpKSB7CisgICAgICAgIGlmIChJc05WMTIoaW1nKSkgewogICAgICAgICAgICAgaWYgKCFsaWJ5dXY6Okk0MjBUb05WMTIoc3JjX3ksIHNyY19zdHJpZGVfeSwgc3JjX3UsIHNyY19zdHJpZGVfdSwgc3JjX3YsIHNyY19zdHJpZGVfdiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRzdF95LCBkc3Rfc3RyaWRlX3ksIGRzdF91LCBkc3Rfc3RyaWRlX3UsIHZpZXcuY3JvcCgpLndpZHRoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlldy5jcm9wKCkuaGVpZ2h0KSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHN0X3ksIGRzdF9zdHJpZGVfeSwgZHN0X3UsIGRzdF9zdHJpZGVfdSwgd2lkdGgsIGhlaWdodCkpIHsKICAgICAgICAgICAgICAgICByZXR1cm4gT0s7CiAgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAoSXNOVjIxKGltZykpIHsKKyAgICAgICAgICAgIGlmICghbGlieXV2OjpJNDIwVG9OVjIxKHNyY195LCBzcmNfc3RyaWRlX3ksIHNyY191LCBzcmNfc3RyaWRlX3UsIHNyY192LCBzcmNfc3RyaWRlX3YsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3RfeSwgZHN0X3N0cm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HJldHVybiBPSzsKKyAgICAgICAgfSBlbHNlIGlmIChJc05WMjEodmlldykpIHsKKyAgICAgICAgICAgIGlmICghbGlieXV2OjpOVjIxVG9OVjEyKHNyY195LCBzcmNfc3RyaWRlX3ksIHNyY191LCBzcmNfc3RyaWRlX3UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3RfeSwgZHN0X3N0cmlkZV95LCBkc3RfdiwgZHN0X3N0cmlkZV92LCB3aWR0aCwgaGVpZ2h0KSkgeworICAgICAgICAgICAgICAgIHJldHVybiBPSzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmIChJc0k0MjAodmlldykpIHsKICAgICAgICAgICAgIGlmICghbGlieXV2OjpOVjEyVG9JNDIwKHNyY195LCBzcmNfc3RyaWRlX3ksIHNyY191LCBzcmNfc3RyaWRlX3UsIGRzdF95LCBkc3Rfc3RyaWRlX3ksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3RfdSwgZHN0X3N0cmlkZV91LCBkc3RfdiwgZHN0X3N0cmlkZV92LCB2aWV3LndpZHRoKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWV3LmhlaWdodCgpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHN0X3UsIGRzdF9zdHJpZGVfdSwgZHN0X3YsIGRzdF9zdHJpZGVfdiwgd2lkdGgsIGhlaWdodCkpIHsKICAgICAgICAgICAgICAgICByZXR1cm4gT0s7CiAgICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7CisgICAgICAgIH0KKyAgICB9IGVsc2UgaWYgKElzTlYyMShpbWcpKSB7CisgICAgICAgIGlmIChJc05WMTIodmlldykpIHsKKyAgICAgICAgICAgIGlmICghbGlieXV2OjpOVjIxVG9OVjEyKHNyY195LCBzcmNfc3RyaWRlX3ksIHNyY192LCBzcmNfc3RyaWRlX3YsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3RfeSwgZHN0X3N0cmlkZV95LCBkc3RfdSwgZHN0X3N0cmlkZV91LCB3aWR0aCwgaGVpZ2h0KSkgeworICAgICAgICAgICAgICAgIHJldHVybiBPSzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmIChJc05WMjEodmlldykpIHsKKyAgICAgICAgICAgIGxpYnl1djo6Q29weVBsYW5lKHNyY195LCBzcmNfc3RyaWRlX3ksIGRzdF95LCBkc3Rfc3RyaWRlX3ksIHdpZHRoLCBoZWlnaHQpOworICAgICAgICAgICAgbGlieXV2OjpDb3B5UGxhbmUoc3JjX3YsIHNyY19zdHJpZGVfdiwgZHN0X3YsIGRzdF9zdHJpZGVfdiwgd2lkdGgsIGhlaWdodCAvIDIpOworICAgICAgICAgICAgcmV0dXJuIE9LOworICAgICAgICB9IGVsc2UgaWYgKElzSTQyMCh2aWV3KSkgeworICAgICAgICAgICAgaWYgKCFsaWJ5dXY6Ok5WMjFUb0k0MjAoc3JjX3ksIHNyY19zdHJpZGVfeSwgc3JjX3YsIHNyY19zdHJpZGVfdiwgZHN0X3ksIGRzdF9zdHJpZGVfeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRzdF91LCBkc3Rfc3RyaWRlX3UsIGRzdF92LCBkc3Rfc3RyaWRlX3YsIHdpZHRoLCBoZWlnaHQpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIE9LOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfSBlbHNlIGlmIChJc0k0MjAoaW1nKSkgeworICAgICAgICBpZiAoSXNOVjEyKHZpZXcpKSB7CiAgICAgICAgICAgICBpZiAoIWxpYnl1djo6STQyMFRvTlYxMihzcmNfeSwgc3JjX3N0cmlkZV95LCBzcmNfdSwgc3JjX3N0cmlkZV91LCBzcmNfdiwgc3JjX3N0cmlkZV92LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHN0X3ksIGRzdF9zdHJpZGVfeSwgZHN0X3UsIGRzdF9zdHJpZGVfdSwgdmlldy53aWR0aCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlldy5oZWlnaHQoKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRzdF95LCBkc3Rfc3RyaWRlX3ksIGRzdF91LCBkc3Rfc3RyaWRlX3UsIHdpZHRoLCBoZWlnaHQpKSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuIE9LOwogICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgaWYgKElzTlYyMSh2aWV3KSkgeworICAgICAgICAgICAgaWYgKCFsaWJ5dXY6Okk0MjBUb05WMjEoc3JjX3ksIHNyY19zdHJpZGVfeSwgc3JjX3UsIHNyY19zdHJpZGVfdSwgc3JjX3YsIHNyY19zdHJpZGVfdiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRzdF95LCBkc3Rfc3RyaWRlX3ksIGRzdF92LCBkc3Rfc3RyaWRlX3YsIHdpZHRoLCBoZWlnaHQpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIE9LOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgaWYgKElzSTQyMCh2aWV3KSkgeworICAgICAgICAgICAgbGlieXV2OjpDb3B5UGxhbmUoc3JjX3ksIHNyY19zdHJpZGVfeSwgZHN0X3ksIGRzdF9zdHJpZGVfeSwgd2lkdGgsIGhlaWdodCk7CisgICAgICAgICAgICBsaWJ5dXY6OkNvcHlQbGFuZShzcmNfdSwgc3JjX3N0cmlkZV91LCBkc3RfdSwgZHN0X3N0cmlkZV91LCB3aWR0aCAvIDIsIGhlaWdodCAvIDIpOworICAgICAgICAgICAgbGlieXV2OjpDb3B5UGxhbmUoc3JjX3YsIHNyY19zdHJpZGVfdiwgZHN0X3YsIGRzdF9zdHJpZGVfdiwgd2lkdGggLyAyLCBoZWlnaHQgLyAyKTsKKyAgICAgICAgICAgIHJldHVybiBPSzsKICAgICAgICAgfQogICAgIH0KICAgICByZXR1cm4gX0ltYWdlQ29weTxmYWxzZT4odmlldywgaW1nLCBpbWdCYXNlKTsKQEAgLTIyNSw2ICsyOTksMjAgQEAKICAgICAgICAgICAgICYmIGxheW91dC5wbGFuZXNbbGF5b3V0LlBMQU5FX1ZdLm9mZnNldCA9PSAxKTsKIH0KIAorYm9vbCBJc05WMjEoY29uc3QgQzJHcmFwaGljVmlldyAmdmlldykgeworICAgIGlmICghSXNZVVY0MjAodmlldykpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBjb25zdCBDMlBsYW5hckxheW91dCAmbGF5b3V0ID0gdmlldy5sYXlvdXQoKTsKKyAgICByZXR1cm4gKGxheW91dC5yb290UGxhbmVzID09IDIKKyAgICAgICAgICAgICYmIGxheW91dC5wbGFuZXNbbGF5b3V0LlBMQU5FX1VdLmNvbEluYyA9PSAyCisgICAgICAgICAgICAmJiBsYXlvdXQucGxhbmVzW2xheW91dC5QTEFORV9VXS5yb290SXggPT0gbGF5b3V0LlBMQU5FX1YKKyAgICAgICAgICAgICYmIGxheW91dC5wbGFuZXNbbGF5b3V0LlBMQU5FX1VdLm9mZnNldCA9PSAxCisgICAgICAgICAgICAmJiBsYXlvdXQucGxhbmVzW2xheW91dC5QTEFORV9WXS5jb2xJbmMgPT0gMgorICAgICAgICAgICAgJiYgbGF5b3V0LnBsYW5lc1tsYXlvdXQuUExBTkVfVl0ucm9vdEl4ID09IGxheW91dC5QTEFORV9WCisgICAgICAgICAgICAmJiBsYXlvdXQucGxhbmVzW2xheW91dC5QTEFORV9WXS5vZmZzZXQgPT0gMCk7Cit9CisKIGJvb2wgSXNJNDIwKGNvbnN0IEMyR3JhcGhpY1ZpZXcgJnZpZXcpIHsKICAgICBpZiAoIUlzWVVWNDIwKHZpZXcpKSB7CiAgICAgICAgIHJldHVybiBmYWxzZTsKQEAgLTI1OCw3ICszNDYsMTYgQEAKICAgICB9CiAgICAg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lcjsKKyAgICAgICAgICAgIGJvb2wgbUxvY2tlZDsKKyAgICAgICAgfSBhdXRvQ2xvc2VyKGJ1ZmZlcik7CisgICAgICAgIEFIYXJkd2FyZUJ1ZmZlcl9QbGFuZXMgcGxhbmVzOworICAgICAgICByZXQgPSBBSGFyZHdhcmVCdWZmZXJfbG9ja1BsYW5lcygKKyAgICAgICAgICAgICAgICBidWZmZXIsCisgICAgICAgICAgICAgICAgQUhBUkRXQVJFQlVGRkVSX1VTQUdFX0NQVV9SRUFEX09GVEVOIHwgQUhBUkRXQVJFQlVGRkVSX1VTQUdFX0NQVV9XUklURV9PRlRFTiwKKyAgICAgICAgICAgICAgICAtMSwgICAgICAgLy8gZmVuY2UKKyAgICAgICAgICAgICAgICBudWxscHRyLCAgLy8gcmVjdAorICAgICAgICAgICAgICAgICZwbGFuZXMpOworICAgICAgICBpZiAocmV0ICE9IDApIHsKKyAgICAgICAgICAgIEFIYXJkd2FyZUJ1ZmZlcl9yZWxlYXNlKGJ1ZmZlcik7CisgICAgICAgICAgICByZXR1cm4gRkxFWF9MQVlPVVRfVU5LTk9XTjsKKyAgICAgICAgfQorICAgICAgICBhdXRvQ2xvc2VyLnNldExvY2tlZCgpOworICAgICAgICBpZiAocGxhbmVzLnBsYW5lQ291bnQgIT0gMykgeworICAgICAgICAgICAgcmV0dXJuIEZMRVhfTEFZT1VUX1VOS05PV047CisgICAgICAgIH0KKyAgICAgICAgaWYgKHBsYW5lcy5wbGFuZXNbMF0ucGl4ZWxTdHJpZGUgIT0gMSkgeworICAgICAgICAgICAgcmV0dXJuIEZMRVhfTEFZT1VUX1VOS05PV047CisgICAgICAgIH0KKyAgICAgICAgaWYgKHBsYW5lcy5wbGFuZXNbMV0ucGl4ZWxTdHJpZGUgPT0gMSAmJiBwbGFuZXMucGxhbmVzWzJdLnBpeGVsU3RyaWRlID09IDEpIHsKKyAgICAgICAgICAgIHJldHVybiBGTEVYX0xBWU9VVF9QTEFOQVI7CisgICAgICAgIH0KKyA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KSA6ICgoKG1heCkgPiAodikpID8gKHYpIDogKG1heCkpKQogICAgIGZvciAoc2l6ZV90IHkgPSAwOyB5IDwgc3JjLmhlaWdodCgpOyArK3kpIHsKICAgICAgICAgZm9yIChzaXplX3QgeCA9IDA7IHggPCBzcmMud2lkdGgoKTsgKyt4KSB7Ci0gICAgICAgICAgICB1aW50OF90IHJlZCA9ICpwUmVkOwotICAgICAgICAgICAgdWludDhfdCBncmVlbiA9ICpwR3JlZW47Ci0gICAgICAgICAgICB1aW50OF90IGJsdWUgPSAqcEJsdWU7CisgICAgICAgICAgICB1aW50OF90IHIgPSAqcFJlZDsKKyAgICAgICAgICAgIHVpbnQ4X3QgZyA9ICpwR3JlZW47CisgICAgICAgICAgICB1aW50OF90IGIgPSAqcEJsdWU7CiAKLSAgICAgICAgICAgIC8vIHVzaW5nIElUVS1SIEJULjYwMSBjb252ZXJzaW9uIG1hdHJpeAotICAgICAgICAgICAgdW5zaWduZWQgbHVtYSA9Ci0gICAgICAgICAgICAgICAgQ0xJUDMoMCwgKCgocmVkICogNjYgKyBncmVlbiAqIDEyOSArIGJsdWUgKiAyNSkgPj4gOCkgKyAxNiksIDI1NSk7CisgICAgICAgICAgICB1bnNpZ25lZCBsdW1hID0gKChyICogd2VpZ2h0c1swXVswXSArIGcgKiB3ZWlnaHRzWzBdWzFdICsgYiAqIHdlaWdodHNbMF1bMl0pID4+IDgpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgemVyb0x2bDsKIAotICAgICAgICAgICAgZHN0WVt4XSA9IGx1bWE7CisgICAgICAgICAgICBkc3RZW3hdID0gQ0xJUDMoemVyb0x2bCwgbHVtYSwgbWF4THZsTHVtYSk7CiAKICAgICAgICAgICAgIGlmICgoeCAmIDEpID09IDAgJiYgKHkgJiAxKSA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgdW5zaWduZWQgVSA9Ci0gICAgICAgICAgICAgICAgICAgIENMSVAzKDAsICgoKC1yZWQgKiAzOCAtIGdyZWVuICogNzQgKyBibHVlICogMTEyKSA+PiA4KSArIDEyOCksIDI1NSk7CisgICAgICAgICAgICAgICAgdW5zaWduZWQgVSA9ICgociAqIHdlaWdodHNbMV1bMF0gKyBnICogd2VpZ2h0c1sxXVsxXSArIGIgKiB3ZWlnaHRzWzFdWzJdKSA+PiA4KSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMjg7CiAKLSAgICAgICAgICAgICAgICB1bnNpZ25lZCBWID0KLSAgICAgICAgICAgICAgICAgICAgQ0xJUDMoMCwgKCgocmVkICogMTEyIC0gZ3JlZW4gKiA5NCAtIGJsdWUgKiAxOCkgPj4gOCkgKyAxMjgpLCAyNTUpOworICAgICAgICAgICAgICAgIHVuc2lnbmVkIFYgPSAoKHIgKiB3ZWlnaHRzWzJdWzBdICsgZyAqIHdlaWdodHNbMl1bMV0gKyBiICogd2VpZ2h0c1syXVsyXSkgPj4gOCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTI4OwogCi0gICAgICAgICAgICAgICAgZHN0VVt4ID4+IDFdID0gVTsKLSAgICAgICAgICAgICAgICBkc3RWW3ggPj4gMV0gPSBWOworICAgICAgICAgICAgICAgIGRzdFVbeCA+PiAxXSA9IENMSVAzKHplcm9MdmwsIFUsIG1heEx2bENocm9tYSk7CisgICAgICAgICAgICAgICAgZHN0Vlt4ID4+IDFdID0gQ0xJUDMoemVyb0x2bCwgViwgbWF4THZsQ2hyb21hKTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHBSZWQgICArPSBsYXlvdXQucGxhbmVzW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9SXS5jb2xJbmM7CiAgICAgICAgICAgICBwR3JlZW4gKz0gbGF5b3V0LnBsYW5lc1tDMlBsYW5hckxheW91dDo6UExBTkVfR10uY29sSW5jOwpkaWZmIC0tZ2l0IGEvbWVkaWEvY29kZWMyL3NmcGx1Z2luL3V0aWxzL0NvZGVjMkJ1ZmZlclV0aWxzLmggYi9tZWRpY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gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgKGludDMyX3QpcmVjdC5sZWZ0LCAoaW50MzJfdClyZWN0LnRvcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50MzJfdClyZWN0LndpZHRoLCAoaW50MzJfdClyZWN0LmhlaWdodCB9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcG9pbnRlcik7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0X2Nhc3Q8bmF0aXZlX2hhbmRsZV90ICo+KG1CdWZmZXIpLCBncmFsbG9jVXNhZ2UsIHJlY3QsICZwb2ludGVyKTsKICAgICAgICAgICAgIGlmIChlcnIpIHsKICAgICAgICAgICAgICAgICBBTE9HRSgiZmFpbGVkIHRyYW5zYWN0aW9uOiBsb2NrKFJHQkFfMTAxMDEwMikiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gQzJfQ09SUlVQVEVEOwpAQCAtNDY0LDEwICs0NjgsNyBAQAogICAgICAgICAgICAgdm9pZCAqcG9pbnRlciA9IG51bGxwdHI7CiAgICAgICAgICAgICAvLyBUT0RPOiBmZW5jZQogICAgICAgICAgICAgc3RhdHVzX3QgZXJyID0gR3JhcGhpY0J1ZmZlck1hcHBlcjo6Z2V0KCkubG9jaygKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3RfY2FzdDxuYXRpdmVfaGFuZGxlX3QqPihtQnVmZmVyKSwgZ3JhbGxvY1VzYWdlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IChpbnQzMl90KXJlY3QubGVmdCwgKGludDMyX3QpcmVjdC50b3AsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGludDMyX3QpcmVjdC53aWR0aCwgKGludDMyX3QpcmVjdC5oZWlnaHQgfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBvaW50ZXIpOworICAgICAgICAgICAgICAgICAgICBjb25zdF9jYXN0PG5hdGl2ZV9oYW5kbGVfdCo+KG1CdWZmZXIpLCBncmFsbG9jVXNhZ2UsIHJlY3QsICZwb2ludGVyKTsKICAgICAgICAgICAgIGlmIChlcnIpIHsKICAgICAgICAgICAgICAgICBBTE9HRSgiZmFpbGVkIHRyYW5zYWN0aW9uOiBsb2NrKFJHQkFfODg4OCkiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gQzJfQ09SUlVQVEVEOwpAQCAtNTI0LDEwICs1MjUsNyBAQAogICAgICAgICAgICAgdm9pZCAqcG9pbnRlciA9IG51bGxwdHI7CiAgICAgICAgICAgICAvLyBUT0RPOiBmZW5jZQogICAgICAgICAgICAgc3RhdHVzX3QgZXJyID0gR3JhcGhpY0J1ZmZlck1hcHBlcjo6Z2V0KCkubG9jaygKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3RfY2FzdDxuYXRpdmVfaGFuZGxlX3QqPihtQnVmZmVyKSwgZ3JhbGxvY1VzYWdlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IChpbnQzMl90KXJlY3QubGVmdCwgKGludDMyX3QpcmVjdC50b3AsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGludDMyX3QpcmVjdC53aWR0aCwgKGludDMyX3QpcmVjdC5oZWlnaHQgfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBvaW50ZXIpOworICAgICAgICAgICAgICAgICAgICBjb25zdF9jYXN0PG5hdGl2ZV9oYW5kbGVfdCo+KG1CdWZmZXIpLCBncmFsbG9jVXNhZ2UsIHJlY3QsICZwb2ludGVyKTsKICAgICAgICAgICAgIGlmIChlcnIpIHsKICAgICAgICAgICAgICAgICBBTE9HRSgiZmFpbGVkIHRyYW5zYWN0aW9uOiBsb2NrKEJMT0IpIik7CiAgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0NPUlJVUFRFRDsKQEAgLTUzNiwyMCArNTM0LDMzIEBACiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogCisgICAgICAgIGNhc2Ugc3RhdGljX2Nhc3Q8dWludDMyX3Q+KFBpeGVsRm9ybWF0NDo6WUNCQ1JfNDIyX1NQKToKKyAgICAgICAgICAgIC8vIGZhbGwtdGhyb3VnaAorICAgICAgICBjYXNlIHN0YXRpY19jYXN0PHVpbnQzMl90PihQaXhlbEZvcm1hdDQ6OllDUkNCXzQyMF9TUCk6CisgICAgICAgICAgICAvLyBmYWxsLXRocm91Z2gKKyAgICAgICAgY2FzZSBzdGF0aWNfY2FzdDx1aW50MzJfdD4oUGl4ZWxGb3JtYXQ0OjpZQ0JDUl80MjJfSSk6CisgICAgICAgICAgICAvLyBmYWxsLXRocm91Z2gKICAgICAgICAgY2FzZSBzdGF0aWNfY2FzdDx1aW50MzJfdD4oUGl4ZWxGb3JtYXQ0OjpZQ0JDUl80MjBfODg4KToKICAgICAgICAgICAgIC8vIGZhbGwtdGhyb3VnaAotICAgICAgICBjYXNlIHN0YXRpY19jYXN0PHVpbnQzMl90PihQaXhlbEZvcm1hdDQ6OllWMTIpOgotICAgICAgICAgICAgLy8gZmFsbC10aHJvdWdoCi0gICAgICAgIGRlZmF1bHQ6IHsKKyAgICAgICAgY2FzZSBzdGF0aWNfY2FzdDx1aW50MzJfdD4oUGl4ZWxGb3JtYXQ0OjpZVjEyKTogewogICAgICAgICAgICAgYW5kcm9pZF95Y2JjciB5Y2JjckxheW91dDsKIAogICAgICAgICAgICAgc3RhdHVzX3QgZXJyID0gR3JhcGhpY0J1ZmZlck1hcHBlcjo6Z2V0KCkubG9ja1lDYkNyKAotICAgICAgICAgICAgICAgICAgICAgICAgY29uc3RfY2FzdDxuYXRpdmVfaGFuZGxlX3QqPihtQnVmZmVyKSwgZ3JhbGxvY1VzYWdlLAotICAgICAgICAgICAgICAgICAgICAgICAgeyAoaW50MzJfdClyZWN0LmxlZnQsIChpbnQzMl90KXJlY3QudG9wLAotICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50MzJfdClyZWN0LndpZHRoLCAoaW50MzJfdClyZWN0LmhlaWdodCB9LAotICAgICAgICAgICAgICAgICAgICAgICAgJnljYmNyTGF5b3V0KTsKKyAgICAgICAgICAgICAgICAgICAgY29uc3RfY2FzdDxuYXRpdmVfaGFuZGxlX3QqPihtQnVmZmVyKSwgZ3JhbGxvY1VzYWdlLCByZWN0LCAmeWNiY3JMYXlvdXQpOwogICAgICAgICAgICAgaWYgKGVycikgewotICAgICAgICAgICAgICAgIEFMT0dFKCJmYWlsZWQgdHJhbnNhY3Rpb246IGxvY2tZQ2JDciIpOworICAgICAgICAgICAgICAgIEFMT0dFKCJmYWlsZWQgdHJhbnNhY3Rpb246IGxvY2tZQ2JDciAoZXJyPSVkKSIsIGVycik7CisgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0NPUlJVUFRFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICgheWNiY3JMYXlvdXQueSB8fCAheWNiY3JMYXlvdXQuY2IgfHwgIXljYmNyTGF5b3V0LmNyCisgICAgICAgICAgICAgICAgICAgIHx8IHljYmNyTGF5b3V0LnlzdHJpZGUgPT0gMAorICAgICAgICAgICAgICAgICAgICB8fCB5Y2JjckxheW91dC5jc3RyaWRlID09IDAKKyAgICAgICAgICAgICAgICAgICAgfHwgeWNiY3JMYXlvdXQuY2hyb21hX3N0ZXAgPT0gMCkgeworICAgICAgICAgICAgICAgIEFMT0dFKCJpbnZhbGlkIGxheW91dDogbG9ja1lDYkNyICh5PSVzIGNiPSVzIGNyPSVzICIKKyAgICAgICAgICAgICAgICAgICAgICAgICJ5c3RyaWRlPSV6dSBjc3RyaWRlPSV6dSBjaHJvbWFfc3RlcD0lenUpIiwKKyAgICAgICAgICAgICAgICAgICAgICAgIHljYmNyTGF5b3V0LnkgPyAiKG5vbi1udWxsKSIgOiAiKG51bGwpIiwKKyAgICAgICAgICAgICAgICAgICAgICAgIHljYmNyTGF5b3V0LmNiID8gIihub24tbnVsbCkiIDogIihudWxsKSIsCisgICAgICAgICAgICAgICAgICAgICAgICB5Y2JjckxheW91dC5jciA/ICIobm9uLW51bGwpIiA6ICIobnVsbCkiLAorICAgICAgICAgICAgICAgICAgICAgICAgeWNiY3JMYXlvdXQueXN0cmlkZSwgeWNiY3JMYXlvdXQuY3N0cmlkZSwgeWNiY3JMYXlvdXQuY2hyb21hX3N0ZXApOwogICAgICAgICAgICAgICAgIHJldHVybiBDMl9DT1JSVVBURUQ7CiAgICAgICAgICAgICB9CiAKQEAgLTYxMSw2ICs2MjIsMTcxIEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQorCisgICAgICAgIGNhc2Ugc3RhdGljX2Nhc3Q8dWludDMyX3Q+KFBpeGVsRm9ybWF0NDo6WUNCQ1JfUDAxMCk6IHsKKyAgICAgICAgICAgIHZvaWQgKnBvaW50ZXIgPSBudWxscHRyOworICAgICAgICAgICAgc3RhdHVzX3QgZXJyID0gR3JhcGhpY0J1ZmZlck1hcHBlcjo6Z2V0KCkubG9jaygKKyAgICAgICAgICAgICAgICAgICAgY29uc3RfY2FzdDxuYXRpdmVfaGFuZGxlX3QgKj4obUJ1ZmZlciksIGdyYWxsb2NVc2FnZSwgcmVjdCwgJnBvaW50ZXIpOworICAgICAgICAgICAgaWYgKGVycikgeworICAgICAgICAgICAgICAgIEFMT0dFKCJmYWlsZWQgdHJhbnNhY3Rpb246IGxvY2soWUNCQ1JfUDAxMCkiKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gQzJfQ09SUlVQVEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYWRkcltDMlBsYW5hckxheW91dDo6UExBTkVfWV0gPSAodWludDhfdCAqKXBvaW50ZXI7CisgICAgICAgICAgICBhZGRyW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9VXSA9ICh1aW50OF90ICopcG9pbnRlciArIG1TdHJpZGUgKiAyICogcmVjdC5oZWlnaHQoKTsKKyAgICAgICAgICAgIGFkZHJbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1ZdID0gYWRkcltDMlBsYW5hckxheW91dDo6UExBTkVfVV0gKyAyOworICAgICAgICAgICAgbGF5b3V0LT50eXBlID0gQzJQbGFuYXJMYXlvdXQ6OlRZUEVfWVVWOworICAgICAgICAgICAgbGF5b3V0LT5udW1QbGFuZXMgPSAzOworICAgICAgICAgICAgbGF5b3V0LT5yb290UGxhbmVzID0gMjsKKyAgICAgICAgICAgIGxheW91dC0+cGxhbmVzW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9ZXSA9IHsKKyAgICAgICAgICAgICAgICBDMlBsYW5lSW5mbzo6Q0hBTk5FTF9ZLCAgICAgICAgIC8vIGNoYW5uZWwKKyAgICAgICAgICAgICAgICAyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbEluYworICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PGludDMyX3Q+KDIgKiBtU3RyaWRlKSwgLy8gcm93SW5jCisgICAgICAgICAgICAgICAgMSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtQ29sU2FtcGxpbmcKKyAgICAgICAgICAgICAgICAxLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1Sb3dTYW1wbGluZworICAgICAgICAgICAgICAgIDE2LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYWxsb2NhdGVkRGVwdGgKKyAgICAgICAgICAgICAgICAxMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGJpdERlcHRoCisgICAgICAgICAgICAgICAgNiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByaWdodFNoaWZ0CisgICAgICAgICAgICAgICAgQzJQbGFuZUluZm86OkxJVFRMRV9FTkQsICAgICAgICAvLyBlbmRpYW5uZXNzCisgICAgICAgICAgICAgICAgQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1ksICAgICAgICAvLyByb290SXgKKyAgICAgICAgICAgICAgICAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9mZnNldAorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIGxheW91dC0+cGxhbmVzW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9VXSA9IHsKKyAgICAgICAgICAgICAgICBDMlBsYW5lSW5mbzo6Q0hBTk5FTF9DQiwgICAgICAgIC8vIGNoYW5uZWwKKyAgICAgICAgICAgICAgICA0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbEluYworICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PGludDMyX3Q+KDIgKiBtU3RyaWRlKSwgLy8gcm93SW5jCisgICAgICAgICAgICAgICAgMiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtQ29sU2FtcGxpbmcKKyAgICAgICAgICAgICAgICAyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1Sb3dTYW1wbGluZworICAgICAgICAgICAgICAgIDE2LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYWxsb2NhdGVkRGVwdGgKKyAgICAgICAgICAgICAgICAxMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGJpdERlcHRoCisgICAgICAgICAgICAgICAgNiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByaWdodFNoaWZ0CisgICAgICAgICAgICAgICAgQzJQbGFuZUluZm86OkxJVFRMRV9FTkQsICAgICAgICAvLyBlbmRpYW5uZXNzCisgICAgICAgICAgICAgICAgQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1UsICAgICAgICAvLyByb290SXgKKyAgICAgICAgICAgICAgICAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9mZnNldAorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIGxheW91dC0+cGxhbmVzW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9WXSA9IHsKKyAgICAgICAgICAgICAgICBDMlBsYW5lSW5mbzo6Q0hBTk5FTF9DUiwgICAgICAgIC8vIGNoYW5uZWwKKyAgICAgICAgICAgICAgICA0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbEluYworICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PGludDMyX3Q+KDIgKiBtU3RyaWRlKSwgLy8gcm93SW5jCisgICAgICAgICAgICAgICAgMiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtQ29sU2FtcGxpbmcKKyAgICAgICAgICAgICAgICAyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1Sb3dTYW1wbGluZworICAgICAgICAgICAgICAgIDE2LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYWxsb2NhdGVkRGVwdGgKKyAgICAgICAgICAgICAgICAxMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGJpdERlcHRoCisgICAgICAgICAgICAgICAgNiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByaWdodFNoaWZ0CisgICAgICAgICAgICAgICAgQzJQbGFuZUluZm86OkxJVFRMRV9FTkQsICAgICAgICAvLyBlbmRpYW5uZXNzCisgICAgICAgICAgICAgICAgQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1UsICAgICAgICAvLyByb290SXgKKyAgICAgICAgICAgICAgICAyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9mZnNldAorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgZGVmYXVsdDogeworICAgICAgICAgICAgLy8gV2UgZG9uJ3Qga25vdyB3aGF0IGl0IGlzLCBidXQgbGV0J3MgdHJ5IHRvIGxvY2sgaXQuCisgICAgICAgICAgICBhbmRyb2lkX3ljYmNyIHljYmNyTGF5b3V0OworCisgICAgICAgICAgICBzdGF0dXNfdCBlcnIgPSBHcmFwaGljQnVmZmVyTWFwcGVyOjpnZXQoKS5sb2NrWUNiQ3IoCisgICAgICAgICAgICAgICAgICAgIGNvbnN0X2Nhc3Q8bmF0aXZlX2hhbmRsZV90Kj4obUJ1ZmZlciksIGdyYWxsb2NVc2FnZSwgcmVjdCwgJnljYmNyTGF5b3V0KTsKKyAgICAgICAgICAgIGlmIChlcnIgPT0gT0sgJiYgeWNiY3JMYXlvdXQueSAmJiB5Y2JjckxheW91dC5jYiAmJiB5Y2JjckxheW91dC5jcgorICAgICAgICAgICAgICAgICAgICAmJiB5Y2JjckxheW91dC55c3RyaWRlID4gMAorICAgICAgICAgICAgICAgICAgICAmJiB5Y2JjckxheW91dC5jc3RyaWRlID4gMAorICAgICAgICAgICAgICAgICAgICAmJiB5Y2JjckxheW91dC5jaHJvbWFfc3RlcCA+IDApIHsKKyAgICAgICAgICAgICAgICBhZGRyW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9ZXSA9ICh1aW50OF90ICopeWNiY3JMYXlvdXQueTsKKyAgICAgICAgICAgICAgICBhZGRyW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9VXSA9ICh1aW50OF90ICopeWNiY3JMYXlvdXQuY2I7CisgICAgICAgICAgICAgICAgYWRkcltDMlBsYW5hckxheW91dDo6UExBTkVfVl0gPSAodWludDhfdCAqKXljYmNyTGF5b3V0LmNyOworICAgICAgICAgICAgICAgIGxheW91dC0+dHlwZSA9IEMyUGxhbmFyTGF5b3V0OjpUWVBFX1lVVjsKKyAgICAgICAgICAgICAgICBsYXlvdXQtPm51bVBsYW5lcyA9IDM7CisgICAgICAgICAgICAgICAgbGF5b3V0LT5yb290UGxhbmVzID0gMzsKKyAgICAgICAgICAgICAgICBsYXlvdXQtPnBsYW5lc1tDMlBsYW5hckxheW91dDo6UExBTkVfWV0gPSB7CisgICAgICAgICAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpDSEFOTkVMX1ksICAgICAgICAgLy8gY2hhbm5lbAorICAgICAgICAgICAgICAgICAgICAxLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbEluYworICAgICAgICAgICAgICAgICAgICAoaW50MzJfdCl5Y2JjckxheW91dC55c3RyaWRlLCAgIC8vIHJvd0luYworICAgICAgICAgICAgICAgICAgICAxLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1Db2xTYW1wbGluZworICAgICAgICAgICAgICAgICAgICAxLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1Sb3dTYW1wbGluZworICAgICAgICAgICAgICAgICAgICA4LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFsbG9jYXRlZERlcHRoCisgICAgICAgICAgICAgICAgICAgIDgsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYml0RGVwdGgKKyAgICAgICAgICAgICAgICAgICAgMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByaWdodFNoaWZ0CisgICAgICAgICAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpOQVRJVkUsICAgICAgICAgICAgLy8gZW5kaWFubmVzcworICAgICAgICAgICAgICAgICAgICBDMlBsYW5hckxheW91dDo6UExBTkVfWSwgICAgICAgIC8vIHJvb3RJeAorICAgICAgICAgICAgICAgICAgICAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9mZnNldAorICAgICAgICAgICAgICAgIH07CisgICAgICAgICAgICAgICAgbGF5b3V0LT5wbGFuZXNbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1VdID0geworICAgICAgICAgICAgICAgICAgICBDMlBsYW5lSW5mbzo6Q0hBTk5FTF9DQiwgICAgICAgICAgLy8gY2hhbm5lbAorICAgICAgICAgICAgICAgICAgICAoaW50MzJfdCl5Y2JjckxheW91dC5jaHJvbWFfc3RlcCwgLy8gY29sSW5jCisgICAgICAgICAgICAgICAgICAgIChpbnQzMl90KXljYmNyTGF5b3V0LmNzdHJpZGUsICAgICAvLyByb3dJbmMKKyAgICAgICAgICAgICAgICAgICAgMiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1Db2xTYW1wbGluZworICAgICAgICAgICAgICAgICAgICAyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbVJvd1NhbXBsaW5nCisgICAgICAgICAgICAgICAgICAgIDgsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBhbGxvY2F0ZWREZXB0aAorICAgICAgICAgICAgICAgICAgICA4LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYml0RGVwdGgKKyAgICAgICAgICAgICAgICAgICAgMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJpZ2h0U2hpZnQKKyAgICAgICAgICAgICAgICAgICAgQzJQbGFuZUluZm86Ok5BVElWRSwgICAgICAgICAgICAgIC8vIGVuZGlhbm5lc3MKKyAgICAgICAgICAgICAgICAgICAgQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1UsICAgICAgICAgIC8vIHJvb3RJeAorICAgICAgICAgICAgICAgICAgICAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gb2Zmc2V0CisgICAgICAgICAgICAgICAgfTsKKyAgICAgICAgICAgICAgICBsYXlvdXQtPnBsYW5lc1tDMlBsYW5hckxheW91dDo6UExBTkVfVl0gPSB7CisgICAgICAgICAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpDSEFOTkVMX0NSLCAgICAgICAgICAvLyBjaGFubmVsCisgICAgICAgICAgICAgICAgICAgIChpbnQzMl90KXljYmNyTGF5b3V0LmNocm9tYV9zdGVwLCAvLyBjb2xJbmMKKyAgICAgICAgICAgICAgICAgICAgKGludDMyX3QpeWNiY3JMYXlvdXQuY3N0cmlkZSwgICAgIC8vIHJvd0luYworICAgICAgICAgICAgICAgICAgICAyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbUNvbFNhbXBsaW5nCisgICAgICAgICAgICAgICAgICAgIDIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtUm93U2FtcGxpbmcKKyAgICAgICAgICAgICAgICAgICAgOCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFsbG9jYXRlZERlcHRoCisgICAgICAgICAgICAgICAgICAgIDgsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBiaXREZXB0aAorICAgICAgICAgICAgICAgICAgICAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmlnaHRTaGlmdAorICAgICAgICAgICAgICAgICAgICBDMlBsYW5lSW5mbzo6TkFUSVZFLCAgICAgICAgICAgICAgLy8gZW5kaWFubmVzcworICAgICAgICAgICAgICAgICAgICBDMlBsYW5hckxheW91dDo6UExBTkVfViwgICAgICAgICAgLy8gcm9vdEl4CisgICAgICAgICAgICAgICAgICAgIDAsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBvZmZzZXQKKyAgICAgICAgICAgICAgICB9OworICAgICAgICAgICAgICAgIC8vIGhhbmRsZSBpbnRlcmxlYXZlZCBmb3JtYXRzCisgICAgICAgICAgICAgICAgaW50cHRyX3QgdXZPZmZzZXQgPSBhZGRyW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9WXSAtIGFkZHJbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1VdOworICAgICAgICAgICAgICAgIGlmICh1dk9mZnNldCA+IDAgJiYgdXZPZmZzZXQgPCAoaW50cHRyX3QpeWNiY3JMYXlvdXQuY2hyb21hX3N0ZXApIHsKKyAgICAgICAgICAgICAgICAgICAgbGF5b3V0LT5yb290UGxhbmVzID0gMjsKKyAgICAgICAgICAgICAgICAgICAgbGF5b3V0LT5wbGFuZXNbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1ZdLnJvb3RJeCA9IEMyUGxhbmFyTGF5b3V0OjpQTEFORV9VOworICAgICAgICAgICAgICAgICAgICBsYXlvdXQtPnBsYW5lc1tDMlBsYW5hckxheW91dDo6UExBTkVfVl0ub2Zmc2V0ID0gdXZPZmZzZXQ7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh1dk9mZnNldCA8IDAgJiYgdXZPZmZzZXQgPiAtKGludHB0cl90KXljYmNyTGF5b3V0LmNocm9tYV9zdGVwKSB7CisgICAgICAgICAgICAgICAgICAgIGxheW91dC0+cm9vdFBsYW5lcyA9IDI7CisgICAgICAgICAgICAgICAgICAgIGxheW91dC0+cGxhbmVzW0MyUGxhbmFyTGF5b3V0OjpQTEFORV9VXS5yb290SXggPSBDMlBsYW5hckxheW91dDo6UExBTkVfVjsKKyAgICAgICAgICAgICAgICAgICAgbGF5b3V0LT5wbGFuZXNbQzJQbGFuYXJMYXlvdXQ6OlBMQU5FX1VdLm9mZnNldCA9IC11dk9mZnNldDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIFdlIHJlYWxseSBkb24ndCBrbm93IHdoYXQgdGhpcyBpczsgbG9jayB0aGUgYnVmZmVyIGFuZCBwYXNzIGl0IHRocm91Z2ggLS0tCisgICAgICAgICAgICAvLyB0aGUgY2xpZW50IG1heSBrbm93IGhvdyB0byBpbnRlcnByZXQgaXQuCisKKyAgICAgICAgICAgIC8vIHVubG9jayBwcmV2aW91cyBhbGxvY2F0aW9uIGlmIGl0IHdhcyBzdWNjZXNzZnVsCisgICAgICAgICAgICBpZiAoZXJyID09IE9LKSB7CisgICAgICAgICAgICAgICAgZXJyID0gR3JhcGhpY0J1ZmZlck1hcHBlcjo6Z2V0KCkudW5sb2NrKG1CdWZmZXIpOworICAgICAgICAgICAgICAgIGlmIChlcnIpIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR0UoImZhaWxlZCB0cmFuc2FjdGlvbjogdW5sb2NrIik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBDMl9DT1JSVVBURUQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2b2lkICpwb2ludGVyID0gbnVsbHB0cjsKKyAgICAgICAgICAgIGVyciA9IEdyYXBoaWNCdWZmZXJNYXBwZXI6OmdldCgpLmxvY2soCisgICAgICAgICAgICAgICAgICAgIGNvbnN0X2Nhc3Q8bmF0aXZlX2hhbmRsZV90ICo+KG1CdWZmZXIpLCBncmFsbG9jVXNhZ2UsIHJlY3QsICZwb2ludGVyKTsKKyAgICAgICAgICAgIGlmIChlcnIpIHsKKyAgICAgICAgICAgICAgICBBTE9HRSgiZmFpbGVkIHRyYW5zYWN0aW9uOiBsb2NrKD8/PyAleCkiLCBtRm9ybWF0KTsKKyAgICAgICAgICAgICAgICByZXR1cm4gQzJfQ09SUlVQVEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYWRkclswXSA9ICh1aW50OF90ICopcG9pbnRlcjsKKyAgICAgICAgICAgIGxheW91dC0+dHlwZSA9IEMyUGxhbmFyTGF5b3V0OjpUWVBFX1VOS05PV047CisgICAgICAgICAgICBsYXlvdXQtPm51bVBsYW5lcyA9IDE7CisgICAgICAgICAgICBsYXlvdXQtPnJvb3RQbGFuZXMgPSAxOworICAgICAgICAgICAgbGF5b3V0LT5wbGFuZXNbMF0gPSB7CisgICAgICAgICAgICAgICAgLy8gVE9ETzogQ0hBTk5FTF9VTktOT1dOPworICAgICAgICAgICAgICAgIEMyUGxhbmVJbmZvOjpjaGFubmVsX3QoMHhGRiksICAgLy8gY2hhbm5lbAorICAgICAgICAgICAgICAgIDEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gY29sSW5jCisgICAgICAgICAgICAgICAgaW50MzJfdChtU3RyaWRlKSwgICAgICAgICAgICAgICAvLyByb3dJbmMKKyAgICAgICAgICAgICAgICAxLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1Db2xTYW1wbGluZworICAgICAgICAgICAgICAgIDEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbVJvd1NhbXBsaW5nCisgICAgICAgICAgICAgICAgOCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBhbGxvY2F0ZWREZXB0aAorICAgICAgICAgICAgICAgIDgsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYml0RGVwdGgKKyAgICAgICAgICAgICAgICAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJpZ2h0U2hpZnQKKyAgICAgICAgICAgICAgICBDMlBsYW5lSW5mbzo6TkFUSVZFLCAgICAgICAgICAgIC8vIGVuZGlhbm5lc3MKKyAgICAgICAgICAgICAgICAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJvb3RJeAorICAgICAgICAgICAgICAgIDAsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gb2Zmc2V0CisgICAgICAgICAgICB9OworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KICAgICB9CiAgICAgbUxvY2tlZCA9IHRydWU7CiAKQEAgLTc4NCw4ICs5NjAsOSBAQAogICAgIHJldHVybiBtSW1wbC0+c3RhdHVzKCk7CiB9CiAKLWJvb2wgQzJBbGxvY2F0b3JHcmFsbG9jOjppc1ZhbGlkKGNvbnN0IEMySGFuZGxlKiBjb25zdCBvKSB7Ci0gICAgcmV0dXJuIEMySGFuZGxlR3JhbGxvYzo6aXNWYWxpZChvKTsKKy8vIHN0YXRpYworYm9vbCBDMkFsbG9jYXRvckdyYWxsb2M6OkNoZWNrSGFuZGxlKGNvbnN0IEMySGFuZGxlKiBjb25zdCBvKSB7CisgICAgcmV0dXJuIEMySGFuZGxlR3JhbGxvYzo6SXNWYWxpZChvKTsKIH0KIAogfSAvLyBuYW1lc3BhY2UgYW5kcm9pZApkaWZmIC0tZ2l0IGEvbWVkaWEvY29kZWMyL3ZuZGsvQzJBbGxvY2F0b3JJb24uY3BwIGIvbWVkaWEvY29kZWMyL3ZuZGsvQzJBbGxvY2F0b3JJb24uY3BwCmluZGV4IDk0MTBjZTkuLjdiNTkzZWUgMTAwNjQ0Ci0tLSBhL21lZGlhL2NvZGVjMi92bmRrL0MyQWxsb2NhdG9ySW9uLm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T0s7CisgICAgICAgICpiYXNlID0gbW1hcChudWxscHRyLCBtYXBTaXplLCBwcm90LCBmbGFncywgbUhhbmRsZS5idWZmZXJGZCgpLCBtYXBPZmZzZXQpOworICAgICAgICBBTE9HVigibW1hcChzaXplID0gJXp1LCBwcm90ID0gJWQsIGZsYWdzID0gJWQsIG1hcEZkID0gJWQsIG9mZnNldCA9ICV6dSkgIgorICAgICAgICAgICAgICAicmV0dXJuZWQgKCVkKSIsCisgICAgICAgICAgICAgIG1hcFNpemUsIHByb3QsIGZsYWdzLCBtSGFuZGxlLmJ1ZmZlckZkKCksIG1hcE9mZnNldCwgZXJybm8pOworICAgICAgICBpZiAoKmJhc2UgPT0gTUFQX0ZBSUxFRCkgeworICAgICAgICAgICAgKmJhc2UgPSAqYWRkciA9IG51bGxwdHI7CisgICAgICAgICAgICBlcnIgPSBjMl9tYXBfZXJybm88RUlOVkFMPihlcnJubyk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAqYWRkciA9ICh1aW50OF90KikqYmFzZSArIGFsaWdubWVudEJ5dGVzOworICAgICAgICB9CisgICAgICAgIHJldHVybiBlcnI7CisgICAgfQorCisgICAgQzJBbGxvY2F0b3I6OmlkX3QgbUlkOworICAgIEMySGFuZGxlQnVmIG1IYW5kbGU7CisgICAgYzJfc3RhdHVzX3QgbUluaXQ7CisgICAgc3RydWN0IE1hcHBpbmcgeworICAgICAgICB2b2lkKiBhZGRyOworICAgICAgICBzaXplX3QgYWxpZ25tZW50Qnl0ZXM7CisgICAgICAgIHNpemVfdCBzaXplOworICAgIH07CisgICAgc3RkOjpsaXN0PE1hcHBpbmc+IG1NYXBwaW5nczsKKworICAgIC8vIFRPRE86IHdlIGNvdWxkIG1ha2UgdGhpcyBlbmNhcHN1bGF0ZSBzaGFyZWRfcHRyIGFuZCBjb3BpYWJsZQorICAgIEMyX0RPX05PVF9DT1BZKEMyRG1hQnVmQWxsb2NhdGlvbik7Cit9OworCitjMl9zdGF0dXNfdCBDMk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gY29uc3QgPSAwOworCisgICAgdmlydHVhbCBib29sIHJlYWR5KCkgY29uc3QgPSAwOworCisgICAgdmlydHVhbCBpbnQgZmQoKSBjb25zdCA9IDA7CisKKyAgICB2aXJ0dWFsIGJvb2wgaXNIVygpIGNvbnN0ID0gMDsKKworICAgIHZpcnR1YWwgfkltcGwoKSA9IGRlZmF1bHQ7CisKKyAgICBJbXBsKCkgPSBkZWZhdWx0OworfTsKKworYzJfc3RhdHVzX3QgQzJGZW5jZTo6d2FpdChjMl9uc2Vjc190IHRpbWVvdXROcykgeworICAgIGlmIChtSW1wbCkgeworICAgICAgICByZXR1cm4gbUltcGwtPndhaXQodGltZW91dE5zKTsKKyAgICB9CisgICAgLy8gbnVsbCBmZW5jZSBpcyBhbHdheXMgc2lnbmFsbGVkLgorICAgIHJldHVybiBDMl9PSzsKK30KKworYm9vbCBDMkZlbmNlOjp2YWxpZCgpIGNvbnN0IHsKKyAgICBpZiAobUltcGwpIHsKKyAgICAgICAgcmV0dXJuIG1JbXBsLT52YWxpZCgpOworICAgIH0KKyAgICAvLyBudWxsIGZlbmNlIGlzIGFsd2F5cyB2YWxpZC4KKyAgICByZXR1cm4gdHJ1ZTsKK30KKworYm9vbCBDMkZlbmNlOjpyZWFkeSgpIGNvbnN0IHsKKyAgICBpZiAobUltcGwpIHsKKyAgICAgICAgcmV0dXJuIG1JbXBsLT5yZWFkeSgpOworICAgIH0KKyAgICAvLyBudWxsIGZlbmNlIGlzIGFsd2F5cyBzaWduYWxsZWQuCisgICAgcmV0dXJuIHRydWU7Cit9CisKK2ludCBDMkZlbmNlOjpmZCgpIGNvbnN0IHsKKyAgICBpZiAobUltcGwpIHsKKyAgICAgICAgcmV0dXJuIG1JbXBsLT5mZCgpOworICAgIH0KKyAgICAvLyBudWxsIGZlbmNlIGRvZXMgbm90IGhhdmUgZmQuCisgICAgcmV0dXJuIC0xOworfQorCitib29sIEMyRmVuY2U6OmlzSFcoKSBjb25zdCB7CisgICAgaWYgKG1JbXBsKSB7CisgICAgICAgIHJldHVybiBtSW1wbC0+aXNIVygpOworICAgIH0KKyAgICByZXR1cm4gZmFsc2U7Cit9CisKKy8qKgorICogRmVuY2UgaW1wbGVtZW50YXRpb24gZm9yIEMyQnVmZmVyUXVldWVCbG9ja1Bvb2wgYmFzZWQgYmxvY2sgYWxsb2NhdGlvbi4KKyAqIFRoZSBpbXBsZW1lbnRhdGlvbiBzdXBwb3J0cyBhbGwgQzJGZW5jZSBpbnRlcmZhY2UgZXhjZXB0IGZkKCkuCisgKi8KK2NsYXNzIF9DMkZlbmNlRmFjdG9yeTo6U3VyZmFjZUZlbmNlSW1wbDogcHVibGljIEMyRmVuY2U6OkltcGwgeworcHVibGljOgorICAgIHZpcnR1YWwgYzJfc3RhdHVzX3Qgd2FpdChjMl9uc2Vjc190IHRpbWVvdXROcykgeworICAgICAgICBpZiAobVB0cikgeworICAgICAgICAgICAgcmV0dXJuIG1QdHItPndhaXRGb3JDaGFuZ2UobVdhaXRJZCwgdGltZW91dE5zKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gQzJfT0s7CisgICAgfQorCisgICAgdmlydHVhbCBib29sIHZhbGlkKCkgY29uc3QgeworICAgICAgICByZXR1cm4gbVB0cjsKKyAgICB9CisKKyAgICB2aXJ0dWFsIGJvb2wgcmVhZHkoKSBjb25zdCB7CisgICAgICAgIHVpbnQzMl90IHN0YXR1czsKKyAgICAgICAgaWYgKG1QdHIpIHsKKyAgICAgICAgICAgIG1QdHItPmxvY2soKTsKKyAgICAgICAgICAgIHN0YXR1cyA9IG1QdHItPmdldFdhaXRJZExvY2tlZCgpOworICAgICAgICAgICAgbVB0ci0+dW5sb2NrKCk7CisKKyAgICAgICAgICAgIHJldHVybiBzdGF0dXMgIT0gbVdhaXRJZDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICB2aXJ0dWFsIGludCBmZCgpIGNvbnN0IHsKKyAgICAgICAgLy8gZG9lcyBub3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vciAoQzJWYWx1ZTo6UHJpbWl0aXZlIHYgOiBmc3YudmFsdWVzKSB7CisgICAgICAgICAgICAgICAgICAgIG1heFVzYWdlIHw9IHYudTY0OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAocXVlcnlbMV0uc3RhdHVzID09IEMyX09LKSB7CisgICAgICAgICAgICBjb25zdCBDMkZpZWxkU3VwcG9ydGVkVmFsdWVzJiBmc3YgPSBxdWVyeVsxXS52YWx1ZXM7CisgICAgICAgICAgICBpZiAoZnN2LnR5cGUgPT0gQzJGaWVsZFN1cHBvcnRlZFZhbHVlczo6UkFOR0UgJiYgZnN2LnJhbmdlLnN0ZXAudTMyID4gMCkgeworICAgICAgICAgICAgICAgIGJsb2NrU2l6ZSA9IGZzdi5yYW5nZS5zdGVwLnUzMjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIG1hcHBlciA9IFtzdG9yZV0oQzJNZW1vcnlVc2FnZSB1c2FnZSwgc2l6ZV90IGNhcGFjaXR5LCBDMlN0cmluZyogaGVhcE5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQqIGZsYWdzKSAtPiBjMl9zdGF0dXNfdCB7CisgICAgICAgICAgICBpZiAoY2FwYWNpdHkgPiBVSU5UMzJfTUFYKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0JBRF9WQUxVRTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3RkOjp1bmlxdWVfcHRyPEMyU3RvcmVEbWFCdWZVc2FnZUluZm8+IHVzYWdlSW5mbzsKKyAgICAgICAgICAgIHVzYWdlSW5mbyA9IEMyU3RvcmVEbWFCdWZVc2FnZUluZm86OkFsbG9jVW5pcXVlKG1heEhlYXBOYW1lTGVuLCB1c2FnZS5leHBlY3RlZCwgY2FwYWNpdHkpOworICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjp1bmlxdWVfcHR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yQ29tcG9uZW50Pj4gY29tcG9uZW50cywKICAgICAgICAgICAgIEMyQmxvY2tQb29sOjpsb2NhbF9pZF90IHBvb2xJZCwKICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMkJsb2NrUG9vbD4gKnBvb2wpIHsKICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyQWxsb2NhdG9yU3RvcmU+IGFsbG9jYXRvclN0b3JlID0KQEAgLTM0Nyw3ICs0NTcsNyBAQAogICAgICAgICAgICAgYWxsb2NhdG9ySWQgPSBHZXRQcmVmZXJyZWRMaW5lYXJBbGxvY2F0b3JJZChHZXRDb2RlYzJQb29sTWFzaygpKTsKICAgICAgICAgfQogICAgICAgICBzd2l0Y2goYWxsb2NhdG9ySWQpIHsKLSAgICAgICAgICAgIGNhc2UgQzJQbGF0Zm9ybUFsbG9jYXRvclN0b3JlOjpJT046CisgICAgICAgICAgICBjYXNlIEMyUGxhdGZvcm1BbGxvY2F0b3JTdG9yZTo6SU9OOiAvKiBhbHNvIDo6RE1BQlVGSEVBUCAqLwogICAgICAgICAgICAgICAgIHJlcyA9IGFsbG9jYXRvclN0b3JlLT5mZXRjaEFsbG9jYXRvcigKICAgICAgICAgICAgICAgICAgICAgICAgIEMyUGxhdGZvcm1BbGxvY2F0b3JTdG9yZTo6SU9OLCAmYWxsb2NhdG9yKTsKICAgICAgICAgICAgICAgICBpZiAocmVzID09IEMyX09LKSB7CkBAIC0zNTYsNyArNDY2LDkgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbG9jYXRvciwgcG9vbElkKTsKICAgICAgICAgICAgICAgICAgICAgKnBvb2wgPSBwdHI7CiAgICAgICAgICAgICAgICAgICAgIG1CbG9ja1Bvb2xzW3Bvb2xJZF0gPSBwdHI7Ci0gICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnRzW3Bvb2xJZF0gPSBjb21wb25lbnQ7CisgICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnRzW3Bvb2xJZF0uaW5zZXJ0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbXBvbmVudHNbcG9vbElkXS5lbmQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudHMuYmVnaW4oKSwgY29tcG9uZW50cy5lbmQoKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBDMlBsYXRmb3JtQWxsb2NhdG9yU3RvcmU6OkJMT0I6CkBAIC0zNjgsNyArNDgwLDkgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbG9jYXRvciwgcG9vbElkKTsKICAgICAgICAgICAgICAgICAgICAgKnBvb2wgPSBwdHI7CiAgICAgICAgICAgICAgICAgICAgIG1CbG9ja1Bvb2xzW3Bvb2xJZF0gPSBwdHI7Ci0gICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnRzW3Bvb2xJZF0gPSBjb21wb25lbnQ7CisgICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnRzW3Bvb2xJZF0uaW5zZXJ0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbXBvbmVudHNbcG9vbElkXS5lbmQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudHMuYmVnaW4oKSwgY29tcG9uZW50cy5lbmQoKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBDMlBsYXRmb3JtQWxsb2NhdG9yU3RvcmU6OkdSQUxMT0M6CkBAIC0zODAsNyArNDk0LDkgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6bWFrZV9zaGFyZWQ8QzJQb29sZWRCbG9ja1Bvb2w+KGFsbG9jYXRvciwgcG9vbElkKTsKICAgICAgICAgICAgICAgICAgICAgKnBvb2wgPSBwdHI7CiAgICAgICAgICAgICAgICAgICAgIG1CbG9ja1Bvb2xzW3Bvb2xJZF0gPSBwdHI7Ci0gICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnRzW3Bvb2xJZF0gPSBjb21wb25lbnQ7CisgICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnRzW3Bvb2xJZF0uaW5zZXJ0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbXBvbmVudHNbcG9vbElkXS5lbmQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudHMuYmVnaW4oKSwgY29tcG9uZW50cy5lbmQoKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBDMlBsYXRmb3JtQWxsb2NhdG9yU3RvcmU6OkJVRkZFUlFVRVVFOgpAQCAtMzkyLDcgKzUwOCw5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxvY2F0b3IsIHBvb2xJZCk7CiAgICAgICAgICAgICAgICAgICAgICpwb29sID0gcHRyOwogICAgICAgICAgICAgICAgICAgICBtQmxvY2tQb29sc1twb29sSWRdID0gcHRyOwotICAgICAgICAgICAgICAgICAgICBtQ29tcG9uZW50c1twb29sSWRdID0gY29tcG9uZW50OworICAgICAgICAgICAgICAgICAgICBtQ29tcG9uZW50c1twb29sSWRdLmluc2VydCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnRzW3Bvb2xJZF0uZW5kKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRzLmJlZ2luKCksIGNvbXBvbmVudHMuZW5kKCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGRlZmF1bHQ6CkBAIC00MDMsNyArNTIxLDkgQEAKICAgICAgICAgICAgICAgICBpZiAocmVzID09IEMyX09LKSB7CiAgICAgICAgICAgICAgICAgICAgICpwb29sID0gcHRyOwogICAgICAgICAgICAgICAgICAgICBtQmxvY2tQb29sc1twb29sSWRdID0gcHRyOwotICAgICAgICAgICAgICAgICAgICBtQ29tcG9uZW50c1twb29sSWRdID0gY29tcG9uZW50OworICAgICAgICAgICAgICAgICAgICBtQ29tcG9uZW50c1twb29sSWRdLmluc2VydCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnRzW3Bvb2xJZF0uZW5kKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRzLmJlZ2luKCksIGNvbXBvbmVudHMuZW5kKCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQpAQCAtNDEyLDkgKzUzMiw5IEBACiAKICAgICBjMl9zdGF0dXNfdCBjcmVhdGVCbG9ja1Bvb2woCiAgICAgICAgICAgICBDMlBsYXRmb3JtQWxsb2NhdG9yU3RvcmU6OmlkX3QgYWxsb2NhdG9ySWQsCi0gICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8Y29uc3QgQzJDb21wb25lbnQ+IGNvbXBvbmVudCwKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHN0ZDo6c2hhcmVkX3B0cjxjb25zdCBDMkNvbXBvbmVudD4+IGNvbXBvbmVudHMsCiAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJCbG9ja1Bvb2w+ICpwb29sKSB7Ci0gICAgICAgIHJldHVybiBfY3JlYXRlQmxvY2tQb29sKGFsbG9jYXRvcklkLCBjb21wb25lbnQsIG1CbG9ja1Bvb2xTZXFJZCsrLCBwb29sKTsKKyAgICAgICAgcmV0dXJuIF9jcmVhdGVCbG9ja1Bvb2woYWxsb2NhdG9ySWQsIGNvbXBvbmVudHMsIG1CbG9ja1Bvb2xTZXFJZCsrLCBwb29sKTsKICAgICB9CiAKICAgICBib29sIGdldEJsb2NrUG9vbCgKQEAgLTQzMCw4ICs1NTAsMTMgQEAKICAgICAgICAgICAgICAgICBtQmxvY2tQb29scy5lcmFzZShpdCk7CiAgICAgICAgICAgICAgICAgbUNvbXBvbmVudHMuZXJhc2UoYmxvY2tQb29sSWQpOwogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBhdXRvIGZvdW5kID0gbUNvbXBvbmVudHMuZmluZChibG9ja1Bvb2xJZCk7Ci0gICAgICAgICAgICAgICAgaWYgKGNvbXBvbmVudCA9PSBmb3VuZC0+c2Vjb25kLmxvY2soKSkgeworICAgICAgICAgICAgICAgIGF1dG8gZm91bmQgPSBzdGQ6OmZpbmRfaWYoCisgICAgICAgICAgICAgICAgICAgICAgICBtQ29tcG9uZW50c1tibG9ja1Bvb2xJZF0uYmVnaW4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnRzW2Jsb2NrUG9vbElkXS5lbmQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIFtjb21wb25lbnRdKGNvbnN0IHN0ZDo6d2Vha19wdHI8Y29uc3QgQzJDb21wb25lbnQ+ICZwdHIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29tcG9uZW50ID09IHB0ci5sb2NrKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgICAgICBpZiAoZm91bmQgIT0gbUNvbXBvbmVudHNbYmxvY2tQb29sSWRdLmVuZCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICpwb29sID0gcHRyOwogICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgICAgICB9CkBAIC00NDQsNyArNTY5LDcgQEAKICAgICBDMkJsb2NrUG9vbDo6bG9jYWxfaWRfdCBtQmxvY2tQb29sU2VxSWQ7CiAKICAgICBzdGQ6Om1hcDxDMkJsb2NrUG9vbDo6bG9jYWxfaWRfdCwgc3RkOjp3ZWFrX3B0cjxDMkJsb2NrUG9vbD4+IG1CbG9ja1Bvb2xzOwotICAgIHN0ZDo6bWFwPEMyQmxvY2tQb29s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dG9yZSgpOwogCisgICAgLy8gRm9yIHRlc3Rpbmcgb25seQorICAgIEMyUGxhdGZvcm1Db21wb25lbnRTdG9yZSgKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHN0ZDo6dHVwbGU8QzJTdHJpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29tcG9uZW50RmFjdG9yeTo6Q3JlYXRlQ29kZWMyRmFjdG9yeUZ1bmMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMyQ29tcG9uZW50RmFjdG9yeTo6RGVzdHJveUNvZGVjMkZhY3RvcnlGdW5jPj4pOworCiAgICAgdmlydHVhbCB+QzJQbGF0Zm9ybUNvbXBvbmVudFN0b3JlKCkgb3ZlcnJpZGUgPSBkZWZhdWx0OwogCiBwcml2YXRlOgpAQCAtNTY2LDYgKzcwNywyNCBAQAogICAgICAgICB9CiAKICAgICAgICAgLyoqCisgICAgICAgICAqIENyZWF0ZXMgYW4gdW5pbml0aWFsaXplZCBjb21wb25lbnQgbW9kdWxlLgorICAgICAgICAgKiBOT1RFOiBGb3IgdGVzdGluZyBvbmx5CisgICAgICAgICAqCisgICAgICAgICAqIFxwYXJhbSBuYW1lW2luXSAgY29tcG9uZW50IG5hbWUuCisgICAgICAgICAqCisgICAgICAgICAqIFxub3RlIE9ubHkgdXNlZCBieSBDb21wb25lbnRMb2FkZXIuCisgICAgICAgICAqLworICAgICAgICBDb21wb25lbnRNb2R1bGUoCisgICAgICAgICAgICAgICAgQzJDb21wb25lbnRGYWN0b3J5OjpDcmVhdGVDb2RlYzJGYWN0b3J5RnVuYyBjcmVhdGVGYWN0b3J5LAorICAgICAgICAgICAgICAgIEMyQ29tcG9uZW50RmFjdG9yeTo6RGVzdHJveUNvZGVjMkZhY3RvcnlGdW5jIGRlc3Ryb3lGYWN0b3J5KQorICAgICAgICAgICAgOiBtSW5pdChDMl9OT19JTklUKSwKKyAgICAgICAgICAgICAgbUxpYkhhbmRsZShudWxscHRyKSwKKyAgICAgICAgICAgICAgY3JlYXRlRmFjdG9yeShjcmVhdGVGYWN0b3J5KSwKKyAgICAgICAgICAgICAgZGVzdHJveUZhY3RvcnkoZGVzdHJveUZhY3RvcnkpLAorICAgICAgICAgICAgICBtQ29tcG9uZW50RmFjdG9yeShudWxscHRyKSB7CisgICAgICAgIH0KKworICAgICAgICAvKioKICAgICAgICAgICogSW5pdGlhbGl6ZXMgYSBjb21wb25lbnQgbW9kdWxlIHdpdGggYSBnaXZlbiBsaWJyYXJ5IHBhdGguIE11c3QgYmUgY2FsbGVkIGV4YWN0bHkgb25jZS4KICAgICAgICAgICoKICAgICAgICAgICogXG5vdGUgT25seSB1c2VkIGJ5IENvbXBvbmVudExvYWRlci4KQEAgLTYyMSw3ICs3ODAsMTMgQEAKICAgICAgICAgICAgIHN0ZDo6bG9ja19ndWFyZDxzdGQ6Om11dGV4PiBsb2NrKG1NdXRleCk7CiAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8Q29tcG9uZW50TW9kdWxlPiBsb2NhbE1vZHVsZSA9IG1Nb2R1bGUubG9jaygpOwogICAgICAgICAgICAgaWYgKGxvY2FsTW9kdWxlID09IG51bGxwdHIpIHsKLSAgICAgICAgICAgICAgICBsb2NhbE1vZHVsZSA9IHN0ZDo6bWFrZV9zaGFyZWQ8Q29tcG9uZW50TW9kdWxlPigpOworICAgICAgICAgICAgICAgIGlmKG1DcmVhdGVGYWN0b3J5KSB7CisgICAgICAgICAgICAgICAgICAgIC8vIEZvciB0ZXN0aW5nIG9ubHkKKyAgICAgICAgICAgICAgICAgICAgbG9jYWxNb2R1bGUgPSBzdGQ6Om1ha2Vfc2hhcmVkPENvbXBvbmVudE1vZHVsZT4obUNyZWF0ZUZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1EZXN0cm95RmFjdG9yeSk7CisgICAgICAgICAgICAgICAgfSB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gICAgICAgICAgICAgICAgIGxvbmcgbG9uZyB1c2FnZSA9IChsb25nIGxvbmcpbWUuZ2V0KCkubS51c2FnZTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKEMyRG1hQnVmQWxsb2NhdG9yOjpzeXN0ZW1fdW5jYWNoZWRfc3VwcG9ydGVkKCkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICEodXNhZ2UgJiAoQzJNZW1vcnlVc2FnZTo6Q1BVX1JFQUQgfCBDMk1lbW9yeVVzYWdlOjpDUFVfV1JJVEUpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3RybmNweShtZS5zZXQoKS5tLmhlYXBOYW1lLCAic3lzdGVtLXVuY2FjaGVkIiwgbWUudi5mbGV4Q291bnQoKSk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdHJuY3B5KG1lLnNldCgpLm0uaGVhcE5hbWUsICJzeXN0ZW0iLCBtZS52LmZsZXhDb3VudCgpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBtZS5zZXQoKS5tLmFsbG9jRmxhZ3MgPSAwOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gQzJSOjpPaygpOworICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICB9OwogCiAgICAgICAgICAgICBhZGRQYXJhbWV0ZXIoCkBAIC02OTUsNiArODg1LDE4IEBACiAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAud2l0aFNldHRlcihTZXR0ZXI6OnNldElvblVzYWdlKQogICAgICAgICAgICAgICAgIC5idWlsZCgpKTsKKworICAgICAgICAgICAgYWRkUGFyYW1ldGVyKAorICAgICAgICAgICAgICAgIERlZmluZVBhcmFtKG1EbWFCdWZVc2FnZUluZm8sICJkbWFidWYtdXNhZ2UiKQorICAgICAgICAgICAgICAgIC53aXRoRGVmYXVsdChDMlN0b3JlRG1hQnVmVXNhZ2VJbmZvOjpB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YVR5cGVDb25maWcgPSBDMlBvcnRNZWRpYVR5cGVTZXR0aW5nOjpGcm9tKHBhcmFtc1swXS5nZXQoKSk7Ci0gICAgICAgIGlmIChtZWRpYVR5cGVDb25maWcgPT0gbnVsbHB0cikgewotICAgICAgICAgICAgQUxPR0QoImZhaWxlZCB0byBxdWVyeSBtZWRpYSB0eXBlIik7Ci0gICAgICAgICAgICByZXR1cm4gbUluaXQ7Ci0gICAgICAgIH0KLSAgICAgICAgdHJhaXRzLT5tZWRpYVR5cGUgPQotICAgICAgICAgICAgc3RkOjpzdHJpbmcobWVkaWFUeXBlQ29uZmlnLT5tLnZhbHVlLAotICAgICAgICAgICAgICAgICAgICAgICAgc3RybmxlbihtZWRpYVR5cGVDb25maWctPm0udmFsdWUsIG1lZGlhVHlwZUNvbmZpZy0+ZmxleENvdW50KCkpKTsKLQotICAgICAgICBpZiAoZml4RG9tYWluKSB7Ci0gICAgICAgICAgICBpZiAoc3RybmNtcCh0cmFpdHMtPm1lZGlhVHlwZS5jX3N0cigpLCAiYXVkaW8vIiwgNikgPT0gMCkgewotICAgICAgICAgICAgICAgIHRyYWl0cy0+ZG9tYWluID0gQzJDb21wb25lbnQ6OkRPTUFJTl9BVURJTzsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RybmNtcCh0cmFpdHMtPm1lZGlhVHlwZS5jX3N0cigpLCAidmlkZW8vIiwgNikgPT0gMCkgewotICAgICAgICAgICAgICAgIHRyYWl0cy0+ZG9tYWluID0gQzJDb21wb25lbnQ6OkRPTUFJTl9WSURFTzsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RybmNtcCh0cmFpdHMtPm1lZGlhVHlwZS5jX3N0cigpLCAiaW1hZ2UvIiwgNikgPT0gMCkgewotICAgICAgICAgICAgICAgIHRyYWl0cy0+ZG9tYWluID0gQzJDb21wb25lbnQ6OkRPTUFJTl9JTUFHRTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgdHJ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ICAgICAgICAgIEFMT0dEKCInJXMnIGhhcyBhbGlhc2VzOiAnJXMnIiwgaW50Zi0+Z2V0TmFtZSgpLmNfc3RyKCksIGFsaWFzZXMpOwotCi0gICAgICAgICAgICAgICAgZm9yIChjaGFyICp0b2ssICpwdHIsICpzdHIgPSBhbGlhc2VzOyAodG9rID0gOjpzdHJ0b2tfcihzdHIsICIsIiwgJnB0cikpOwotICAgICAgICAgICAgICAgICAgICAgICAgc3RyID0gbnVsbHB0cikgewotICAgICAgICAgICAgICAgICAgICB0cmFpdHMtPmFsaWFzZXMucHVzaF9iYWNrKHRvayk7Ci0gICAgICAgICAgICAgICAgICAgIEFMT0dEKCJhZGRpbmcgYWxpYXM6ICclcyciLCB0b2spOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBmcmVlKGFsaWFzZXMpOwotICAgICAgICAgICAgfQotICAgICAgICB9CiAgICAgfQogICAgIG1UcmFpdHMgPSB0cmFpdHM7CiAKQEAgLTk1MCw2ICsxMDkyLDIyIEBACiAgICAgZW1wbGFjZSgibGliY29kZWMyX3NvZnRfdnA4ZW5jLnNvIik7CiAgICAgZW1wbGFjZSgibGliY29kZWMyX3NvZnRfdnA5ZGVjLnNvIik7CiAgICAgZW1wbGFjZSgibGliY29kZWMyX3NvZnRfdnA5ZW5jLnNvIik7CisKK30KKworLy8gRm9yIHRlc3Rpbmcgb25seQorQzJQbGF0Zm9ybUNvbXBvbmVudFN0b3JlOjpDMlBsYXRmb3JtQ29tcG9uZW50U3RvcmUoCisgICAgc3RkOjp2ZWN0b3I8c3RkOjp0dXBsZTxDMlN0cmluZywKKyAgICAgICAgICAgICAgICBDMkNvbXBvbmVudEZhY3Rvcnk6OkNyZWF0ZUNvZGVjMkZhY3RvcnlGdW5jLAorICAgICAgICAgICAgICAgIEMyQ29tcG9uZW50RmFjdG9yeTo6RGVzdHJveUNvZGVjMkZhY3RvcnlGdW5jPj4gZnVuY3MpCisgICAgOiBtVmlzaXRlZChmYWxzZ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KyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgIGFsbG9jYXRpb25zIChkZWZhdWx0cyB0byAwKQorICAgICAqCisgICAgICogXHBhcmFtIG1heFVzYWdlICAgICAgICBNYXhpbXVtIGJ1ZmZlciB1c2FnZSBzdXBwb3J0ZWQgYnkgdGhlIGlvbiBhbGxvY2F0b3IKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgIChkZWZhdWx0cyB0byBTV19SRUFEIHwgU1dfV1JJVEUpCisgICAgICoKKyAgICAgKiBccGFyYW0gYmxvY2tTaXplICAgICAgIEFsaWdubWVudCB1c2VkIHByaW9yIHRvIGNhbGxpbmcgfG1hcHBlcnwgZm9yIHRoZQorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyIGNhcGFjaXR5LiBUaGlzIGFsc28gaGVscHMgcmVkdWNlIHRoZSBzaXplIG9mCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICBjYWNoZSByZXF1aXJlZCBmb3IgY2FjaGluZyBtYXBwZXIgcmVzdWx0cy4KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgIChkZWZhdWx0cyB0byB0aGUgcGFnZSBzaXplKQorICAgICAqLworICAgIHZvaWQgc2V0VXNhZ2VNYXBwZXIoY29uc3QgVXNhZ2VNYXBwZXJGbiYgbWFwcGVyLCB1aW50NjRfdCBtaW5Vc2FnZSwgdWludDY0X3QgbWF4VXNhZ2UsCisgICAgICAgICAgICAgICAgICAgICAgICB1aW50NjRfdCBibG9ja1NpemUpOworCisgICAgc3RhdGljIGJvb2wgc3lzdGVtX3VuY2FjaGVkX3N1cHBvcnRlZCh2b2lkKSB7CisgICAgICAgIHN0YXRpYyBpbnQgY2FjaGVkX3Jlc3VsdCA9IC0xOworCisgICAgICAgIGlmIChjYWNoZWRfcmVzdWx0ID09IC0xKSB7CisgICAgICAgICAgICBzdHJ1Y3Qgc3RhdCBidWZmZXI7CisgICAgICAgICAgICBjYWNoZWRfcmVzdWx0ID0gK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gICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBTVEFUVVNfSU5JVCAtPiBTVEFUVVNfQUNUSVZFCisgICAgICAgICAgIFNUQVRVU19TV0lUQ0hJTkcgPSAyLCAgICAvLyBXaGVuIHRoZSBzdXJmYWNlIGlzIHJlcGxhY2VkIGJ5IGEgbmV3IHN1cmZhY2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGR1cmluZyBzdXJmYWNlIGNvbmZpZ3VyYXRpb24uCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBTVEFUVVNfQUNUSVZFIC0+IFNUQVRVU19TV0lUQ0hJTkcKKyAgICB9OworCisgICAgLyoqCisgICAgICogTG9jayB0aGUgbWVtb3J5IHJlZ2lvbgorICAgICAqLworICAgIGludCBsb2NrKCk7CisKKyAgICAvKioKKyAgICAgKiBVbmxvY2sgdGhlIG1lbW9yeSByZWdpb24KKyAgICAgKi8KKyAgICBpbnQgdW5sb2NrKCk7CisKKyAgICAvKioKKyAgICAgKiBTZXQgaW5pdGlhbCBkZXF1ZXVlZCBidWZmZXIgY291bnQuCisgICAgICoKKyAgICAgKiBccGFyYW0gbWF4RGVxdWV1ZUNvdW50ICAgICAgICAgICBJbml0aWFsIHZhbHVlIG9mICMgb2YgbWF4IGRlcXVldWVkIGJ1ZmZlciBjb3VudAorICAgICAqIFxwYXJhbSBjdXJEZXF1ZXVlQ291bnQgICAgICAgICAgIEluaXRpYWwgdmFsdWUgb2YgIyBvZiBjdXJyZW50IGRlcXVldWVkIGJ1ZmZlciBjb3VudAorICAgICAqLworICAgIHZvaWQgc2V0SW5pdGlhbERlcXVldWVDb3VudExvY2tlZChpbnQzMl90IG1heERlcXVldWVDb3VudCwgaW50MzJfdCBjdXJEZXF1ZXVlQ291bnQpOworCisgICAgLyoqCisgICAgICogR2V0IGEgd2FpdElkIHdoaWNoIHdpbGwgYmUgdXNlZCB0byBpbXBsZW1lbnQgZmVuY2UuCisgICAgIC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VkLgorICAgICAqLworICAgIHZvaWQgbm90aWZ5RGVxdWV1ZWRMb2NrZWQoKTsKKworICAgIC8qKgorICAgICAqIFNldCBzeW5jIHN0YXR1cy4KKyAgICAgKi8KKyAgICB2b2lkIHNldFN5bmNTdGF0dXNMb2NrZWQoU3luY1N0YXR1cyBzdGF0dXMpOworCisgICAgLyoqCisgICAgICogR2V0IHN5bmMgc3RhdHVzLgorICAgICAqLworICAgIEMyU3luY1ZhcmlhYmxlczo6U3luY1N0YXR1cyBnZXRTeW5jU3RhdHVzTG9ja2VkKCk7CisKKyAgICAvKioKKyAgICAgKiBVcGRhdGUgY3VycmVudCBtYXggZGVxdWV1ZSBjb3VudC4KKyAgICAgKi8KKyAgICB2b2lkIHVwZGF0ZU1heERlcXVldWVDb3VudExvY2tlZChpbnQzMl90IG1heERlcXVldWVDb3VudCk7CisKKyAgICAvKioKKyAgICAgKiBXYWl0IHVudGlsIHN0YXR1cyBpcyBubyBsb25nZXIgZXF1YWwgdG8gd2FpdElkLCBvciB1bnRpbCB0aW1lb3V0LgorICAgICAqCisgICAgICogXHBhcmFtIHdhaXRJZCAgICAgICAgICAgIGludGVybmFsIHN0YXR1cyBmb3Igd2FpdGluZyB1bnRpbCBpdCBpcyBjaGFuZ2VkLgorICAgICAqIFxwYXJhbSB0aW1lb3VzTnMgICAgICAgICBuYW5vIHNlY29uZHMgdG8gdGltZW91dC4KKyAgICAgKgorICAgICAqIFxyZXR2YWwgQzJfVElNRURPVVQgICAgICBjaGFuZ2UgZG9lcyBub3QgaGFwcGVuIGR1cmluZyB3YWl0aW5nLgorICAgICAqIFxyZXR2YWwgQzJfQkFEX1ZBTFVFICAgICBpbnZhbGlkIGV2ZW50IHdhaXRpbmcuCisgICAgICogXHJldHZhbCBDMl9PSyAgICAgICAgICAgIGNoYW5nZSB3YXMgc2lnbmFsbGVkLgorICAgICAqLworICAgIGMyX3N0YXR1c190IHdhaXRGb3JDaGFuZ2UodWludDMyX3Qgd2FpdElkLCBjMl9uc2Vjc190IHRpbWVvdXROcyk7CisKKyAgICBDMlN5bmNWYXJpYWJsZXMoKSB7fQorCitwcml2YXRlOgorICAgIC8qKgorICAgICAqIHNpZ25hbCBvbmUgd2FpdGVyIHRvIHdha2UgdXAuCisgICAgICovCisgICAgaW50IHNpZ25hbCgpOworCisgICAgLyoqCisgICAgICogc2lnbmFsIGFsbCB3YWl0ZXIgdG8gd2FrZSB1cC4KKyAgICAgKi8KKyAgICBpbnQgYnJvYWRjYXN0KCk7CisKKyAgICAvKioKKyAgICAgKiB3YWl0IGZvciBzaWduYWwgb3IgYnJvYWRjYXN0LgorICAgICAqLworICAgIGludCB3YWl0KCk7CisKKyAgICBzdGQ6OmF0b21pYzx1aW50MzJfdD4gbUxvY2s7CisgICAgc3RkOjphdG9taWM8dWludDMyX3Q+IG1Db25kOworICAgIGludDMyX3QgbU1heERlcXVldWVDb3VudDsKKyAgICBpbnQzMl90IG1DdXJEZXF1ZXVlQ291bnQ7CisgICAgU3luY1N0YXR1cyBtU3RhdHVzOworfTsKKworLyoqCisgKiBTaGFyZWQgbWVtb3J5IGluIG9yZGVyIHRvIHN5bmNocm9uaXplIGluZm9ybWF0aW9uIGZvciBTdXJmYWNlKElHQlApCisgKiBiYXNlZCBvdXRwdXQgYnVmZmVyIGFsbG9jYXRpb24uCisgKi8KK2NsYXNzIEMyU3VyZmFjZVN5bmNNZW1vcnkgeworcHVibGljOgorICAgIC8qKgorICAgICAqIFNoYXJlZCBtZW1vcnkgaGFuZGxlIGluIG9yZGVyIHRvIHN5bmNocm9uaXplIGluZm9ybWF0aW9uIGZvcgorICAgICAqIFN1cmZhY2UgYmFzZWQgb3V0cHV0IGJ1ZmZlciBhbGxvY2F0aW9uLgorICAgICAqLworICAgIHN0cnVjdCBIYW5kbGVTeW5jTWVtIDogcHVibGljIG5hdGl2ZV9oYW5kbGVfdCB7CisgICAgICAgIEhhbmRsZVN5bmNNZW0oaW50IGZkLCBzaXplX3Qgc2l6ZSkgOgorICAgICAgICAgICAgbmF0aXZlX2hhbmRsZV90KGNIZWFkZXIpLAorICAgICAgICAgICAgbUZkc3tmZH0sCisgICAgICAgICAgICBtSW50c3tpbnQoc2l6ZSAmIDB4RkZGRkZGRkYpLAorICAgICAgICAgICAgICAgIGludCgodWludDY0X3Qoc2l6ZSkgPj4gMzIpICYgMHhGRkZGRkZGRiksIGtNYWdpY30ge30KKworICAgICAgICAvKiogUmV0dXJucyBhIGZpbGUgZGVzY3JpcHRvciBvZiB0aGUgc2hhcmVkIG1lbW9yeQorICAgICAgICAgKiBccmV0dXJuIGEgZmlsZSBkZXNjcmlwdG9yIHJlcHJlc2VudGluZyB0aGUgc2hhcmVkIG1lbW9yeQorICAgICAgICAgKi8KKyAgICAgICAgaW50IG1lbUZkKCkgY29uc3Qge3JldHVybiBtRmRzLm1NZW07fQorCisgICAgICAgIC8qKiBSZXR1cm5zIHRoZSBzaXplIG9mIHRoZSBzaGFyZWQgbWVtb3J5ICovCisgICAgICAgIHNpemVfdCBzaXplKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIHNpemVfdCh1bnNpZ25lZChtSW50cy5tU2l6ZUxvKSkKKyAgICAgICAgICAgICAgICAgICAgfCBzaXplX3QodWludDY0X3QodW5zaWduZWQobUludHMubVNpemVIaSkpIDw8IDMyKTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKiBDaGVjayB3aGV0aGVyIHRoZSBuYXRpdmUgaGFuZGxlIGlzIGluIHRoZSBmb3JtIG9mIEhhbmRsZVN5bmNNZW0KKyAgICAgICAgICoKKyAgICAgICAgICogXHJldHVybiB3aGV0aGVyIHRoZSBuYXRpdmUgaGFuZGxlIGlzIGNvbXBhdGlibGUKKyAgICAgICAgICovCisgICAgICAgIHN0YXRpYyBib29sIGlzVmFsaWQoY29uc3QgbmF0aXZlX2hhbmRsZV90ICogY29uc3Qgbyk7CisKKyAgICBwcm90ZWN0ZWQ6CisgICAgICAgIHN0cnVjdCB7CisgICAgICAgICAgICBpbnQgbU1lbTsKKyAgICAgICAgfSBtRmRzOworICAgICAgICBzdHJ1Y3QgeworICAgICAgICAgICAgaW50IG1TaXplTG87CisgICAgICAgICAgICBpbnQgbVNpemVIaTsKKyAgICAgICAgICAgIGludCBtTWFnaWM7CisgICAgICAgIH0gbUludHM7CisgICAgcHJpdmF0ZToKKyAgICAgICAgZW51bSB7CisgICAgICAgICAgICBrTWFnaWMgPSAnc3NtXHgwMCcsCisgICAgICAgICAgICBudW1GZHMgPSBzaXplb2YobUZkcykgLyBzaXplb2YoaW50KSwKKyAgICAgICAgICAgIG51bUludHMgPSBzaXplb2YobUludHMpIC8gc2l6ZW9mKGludCksCisgICAgICAgICAgICB2ZXJzaW9uID0gc2l6ZW9mKG5hdGl2ZV9oYW5kbGVfdCkKKyAgICAgICAgfTsKKyAgICAgICAgY29uc3Qgc3RhdGljIG5hdGl2ZV9oYW5kbGVfdCBjSGVhZGVyOworICAgIH07CisKKyAgICAvKioKKyAgICAgKiBJbXBvcnRzIGEgc2hhcmVkIG1lbW9yeSBvYmplY3QgZnJvbSBhIG5hdGl2ZSBoYW5kbGUoVGhlIHNoYXJlZCBtZW1vcnkgaXMgYWxyZWFkeSBleGlzdGluZykuCisgICAgICogVGhpcyBpcyB1c3VhbGx5IHVzZWQgYWZ0ZXIgbmF0aXZlX2hhbmRsZV90IGlzIHBhc3NlZCB2aWEgUlBDLgorICAgICAqCisgICAgICogXHBhcmFtIGhhbmRsZSAgICAgICAgaGFuZGxlIHJlcHJlc2VudGluZyBzaGFyZWQgbWVtb3J5IGZvciBvdXRwdXQgYnVmZmVyIGFsbG9jYXRpb24uCisgICAgICovCisgICAgc3RhdGljIHN0ZDo6c2hhcmVkX3B0cjxDMlN1cmZhY2VTeW5jTWVtb3J5PiBJbXBvcnQobmF0aXZlX2hhbmRsZV90ICpoYW5kbGUpOworCisgICAgLyoqCisgICAgICogQ3JlYXRzIGEgc2hhcmVkIG1lbW9yeSBvYmplY3QgZm9yIHN5bmNocm9uaXphdGlvbi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mNocm9uaXphdGlvbgorICAgICAqICAgICAgICAgICAgICAgICBiZXR3ZWVuIEZyYW1ld29yayBhbmQgSEFMLgogICAgICAqCiAgICAgICogXHJldHVybiBUaGUgcHJldmlvdXMgaGVsZCBzdGF0dXMuCiAgICAgICovCkBAIC0yODcsNyArMjkxLDggQEAKICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c2hhcmVkX3B0cjxfQzJCbG9ja1Bvb2xEYXRhPiYgcG9vbERhdGEsCiAgICAgICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8aW50PiYgb3duZXIsCiAgICAgICAgICAgICBjb25zdCA6OmFuZHJvaWQ6OnNwPDo6YW5kcm9pZDo6aGFyZHdhcmU6OmdyYXBoaWNzOjpidWZmZXJxdWV1ZTo6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFYyXzA6OklHcmFwaGljQnVmZmVyUHJvZHVjZXI+JiBpZ2JwID0gbnVsbHB0cik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFYyXzA6OklHcmFwaGljQnVmZmVyUHJvZHVjZXI+JiBpZ2JwID0gbnVsbHB0ciwKKyAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMlN1cmZhY2VTeW5jTWVtb3J5PiBzeW5jTWVtID0gbnVsbHB0cik7CiAKICAgICAvKioKICAgICAgKiBQcmVwYXJlIGEgYmxvY2sgdG8gYmUgdHJhbnNmZXJyZWQgdG8gb3RoZXIgcHJvY2Vzcy4gVGhpcyBibG9ja3MKQEAgLTM1OCw2ICszNjMsNyBAQAogICAgICAgICAgICAgY29uc3Qgc3RkOjpzaGFyZWRfcHRyPGludD4mIG93bmVyLAogICAgICAgICAgICAgY29uc3QgOjphbmRyb2lkOjpzcDw6OmFuZHJvaWQ6OmhhcmR3YXJlOjpncmFwaGljczo6YnVmZmVycXVldWU6OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWMl8wOjpJR3JhcGhpY0J1ZmZlclBy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AgICAgICAgICAgICAgICAgICAgICAgICBoMmIoaEJ1ZmZlciwgJnNsb3RCdWZmZXIpICYmCiAgICAgICAgICAgICAgICAgICAgICAgICBzbG90QnVmZmVyKSB7CiAgICAgICAgICAgICAgICAgICAgICpnZW5lcmF0aW9uID0gZ2VuZXJhdGlvbk51bWJlcjsKKyAgICAgICAgICAgICAgICAgICAgKnVzYWdlID0gc2xvdEJ1ZmZlci0+Z2V0VXNhZ2UoKTsKICAgICAgICAgICAgICAgICAgICAgc2xvdEJ1ZmZlci0+c2V0R2VuZXJhdGlvbk51bWJlcihnZW5lcmF0aW9uTnVtYmVyKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBhbmRyb2lkOjpCQURfVkFMVUU7CkBAIC0zMzAsMTIgKzIzNSw1OCBAQAogY2xhc3MgQzJCdWZmZXJRdWV1ZUJsb2NrUG9vbDo6SW1wbAogICAgICAgICA6IHB1YmxpYyBzdGQ6OmVuYWJsZV9zaGFyZWRfZnJvbV90aGlzPEMyQnVmZmVyUXVldWVCbG9ja1Bvb2w6OkltcGw+IHsKIHByaXZhdGU6CisgICAgYzJfc3RhdHVzX3QgZGVxdWV1ZUJ1ZmZlcigKKyAgICAgICAgICAgIHVpbnQzMl90IHdpZHRoLAorICAgICAgICAgICAgdWludDMyX3QgaGVpZ2h0LAorICAgICAgICAgICAgdWludDMyX3QgZm9ybWF0LAorICAgICAgICAgICAgQzJBbmRyb2lkTWVtb3J5VXNhZ2UgYW5kcm9pZFVzYWdlLAorICAgICAgICAgICAgaW50ICpzbG90LCBib29sICpuZWVkc1JlYWxsb2MsIHNwPEZlbmNlPiAqZmVuY2UpIHsKKyAgICAgICAgc3RhdHVzX3Qgc3RhdHVze307CisgICAgICAgIHVzaW5nIElucHV0ID0gSEdyYXBoaWNCdWZmZXJQcm9kdWNlcjo6RGVxdWV1ZUJ1ZmZlcklucHV0OworICAgICAgICB1c2luZyBPdXRwdXQgPSBIR3JhcGhpY0J1ZmZlclByb2R1Y2VyOjpEZXF1ZXVlQnVmZmVyT3V0cHV0OworICAgICAgICBSZXR1cm48dm9pZD4gdHJhbnNSZXN1bHQgPSBtUHJvZHVjZXItPmRlcXVldWVCdWZmZXIoCisgICAgICAgICAgICAgICAgSW5wdXR7CisgICAgICAgICAgICAgICAgICAgIHdpZHRoLAorICAgICAgICAgICAgICAgICAgICBoZWlnaHQsCisgICAgICAgICAgICAgICAgICAgIGZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZFVzYWdlLmFzR3JhbGxvY1VzYWdlKCl9LAorICAgICAgICAgICAgICAgIFsmc3RhdHVzLCBzbG90LCBuZWVkc1JlYWxsb2MsCisgICAgICAgICAgICAgICAgIGZlbmNlXShIU3RhdHVzIGhTdGF0dXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBoU2xvdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBPdXRwdXQgY29uc3QmIGhPdXRwdXQpIHsKKyAgICAgICAgICAgICAgICAgICAgKnNsb3QgPSBzdGF0aWNfY2FzdDxpbnQ+KGhTbG90KTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFoMmIoaFN0YXR1cywgJnN0YXR1cykgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAhaDJiKGhPdXRwdXQuZmVuY2UsIGZlbmNlKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gOjphbmRyb2lkOjpCQURfVkFMVUU7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAqbmVlZHNSZWFsbG9jID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaE91dHB1dC5idWZmZXJOZWVkc1JlYWxsb2NhdGlvbjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0pOworICAgICAgICBpZiAoIXRyYW5zUmVzdWx0LmlzT2soKSB8fCBzdGF0dXMgIT0gYW5kcm9pZDo6T0spIHsKKyAgICAgICAgICAgIGlmICh0cmFuc1Jlc3VsdC5pc09rKCkpIHsKKyAgICAgICAgICAgICAgICArK21EcUZhaWx1cmU7CisgICAgICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBhbmRyb2lkOjpJTlZBTElEX09QRVJBVElPTiB8fAorICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPT0gYW5kcm9pZDo6VElNRURfT1VUIHx8CisgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9PSBhbmRyb2lkOjpXT1VMRF9CTE9DSykgeworICAgICAgICAgICAgICAgICAgICAvLyBEZXF1ZXVlIGJ1ZmZlciBpcyBibG9ja2VkIHRlbXBvcmFyaWx5LiBSZXRyeWluZyBpcworICAgICAgICAgICAgICAgICAgICAvLyByZXF1aXJlZC4KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0JMT0NLSU5HOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFMT0dEKCJjYW5ub3QgZGVxdWV1ZSBidWZmZXIgJWQiLCBzdGF0dXMpOworICAgICAgICAgICAgcmV0dXJuIEMyX0JBRF9WQUxVRTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gQzJfT0s7CisgICAgfQorCiAgICAgYzJfc3RhdHVzX3QgZmV0Y2hGcm9tSWdicF9sKAogICAgICAgICAgICAgdWludDMyX3Qgd2lkdGgsCiAgICAgICAgICAgICB1aW50MzJfdCBoZWlnaHQsCiAgICAgICAgICAgICB1aW50MzJfdCBmb3JtYXQsCiAgICAgICAgICAgICBDMk1lbW9yeVVzYWdlIHVzYWdlLAotICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyR3JhcGhpY0Jsb2NrPiAqYmxvY2sgLyogbm9ubnVsbCAqLykgeworICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyR3JhcGhpY0Jsb2NrPiAqYmxvY2sg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gICAgICAgICAgICAgICAgICAgICZmZW5jZV0oSFN0YXR1cyBoU3RhdHVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IGhTbG90LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPdXRwdXQgY29uc3QmIGhPdXRwdXQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNsb3QgPSBzdGF0aWNfY2FzdDxpbnQ+KGhTbG90KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaDJiKGhTdGF0dXMsICZzdGF0dXMpIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFoMmIoaE91dHB1dC5mZW5jZSwgJmZlbmNlKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IDo6YW5kcm9pZDo6QkFEX1ZBTFVFOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXJOZWVkc1JlYWxsb2NhdGlvbiA9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoT3V0cHV0LmJ1ZmZlck5lZWRzUmVhbGxvY2F0aW9uOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9KTsKLSAgICAgICAgICAgIGlmICghdHJhbnNSZXN1bHQuaXNPaygpIHx8IHN0YXR1cyAhPSBhbmRyb2lkOjpPSykgewotICAgICAgICAgICAgICAgIGlmICh0cmFuc1Jlc3VsdC5pc09rKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgKyttRHFGYWlsdXJlOwotICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzID09IGFuZHJvaWQ6OklOVkFMSURfT1BFUkFUSU9OIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPT0gYW5kcm9pZDo6VElNRURfT1VUIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPT0gYW5kcm9pZDo6V09VTERfQkxPQ0spIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIERlcXVldWUgYnVmZmVyIGlzIGJsb2NrZWQgdGVtcG9yYXJpbHkuIFJldHJ5aW5nIGlzCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyByZXF1aXJlZC4KLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBDMl9CTE9DS0lORzsKKyAgICAgICAgICAgIGMyX3N0YXR1c190IGMyU3RhdHVzOworICAgICAgICAgICAgaWYgKHN5bmNWYXIpIHsKKyAgICAgICAgICAgICAgICB1aW50MzJfdCB3YWl0SWQ7CisgICAgICAgICAgICAgICAgc3luY1Zhci0+bG9jaygpOworICAgICAgICAgICAgICAgIGlmICghc3luY1Zhci0+aXNEZXF1ZXVlYWJsZUxvY2tlZCgmd2FpdElkKSkgeworICAgICAgICAgICAgICAgICAgICBzeW5jVmFyLT51bmxvY2soKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGMyRmVuY2UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICpjMkZlbmNlID0gX0MyRmVuY2VGYWN0b3J5OjpDcmVhdGVTdXJmYWNlRmVuY2UobVN5bmNNZW0sIHdhaXRJZCk7CiAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0JMT0NLSU5HOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBBTE9HRCgiY2Fubm90IGRlcXVldWUgYnVmZmVyICVkIiwgc3RhdHVzKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gQzJfQkFEX1ZBTFVFOworICAgICAgICAgICAgICAgIGlmIChzeW5jVmFyLT5nZXRTeW5jU3RhdHVzTG9ja2VkKCkgIT0gQzJTeW5jVmFyaWFibGVzOjpTVEFUVVNfQUNUSVZFKSB7CisgICAgICAgICAgICAgICAgICAgIHdhaXRJZCA9IHN5bmNWYXItPmdldFdhaXRJZExvY2tlZCgpOworICAgICAgICAgICAgICAgICAgICBzeW5jVmFyLT51bmxvY2soKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGMyRmVuY2UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICpjMkZlbmNlID0gX0MyRmVuY2VGYWN0b3J5OjpDcmVhdGVTdXJmYWNlRmVuY2UobVN5bmNNZW0sIHdhaXRJZCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0JMT0NLSU5HOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzeW5jVmFyLT5ub3RpZnlEZXF1ZXVlZExvY2tlZCgpOworICAgICAgICAgICAgICAgIHN5bmNWYXItPnVubG9jaygpOworICAgICAgICAgICAgICAgIGMyU3RhdHVzID0gZGVxdWV1ZUJ1ZmZlcih3aWR0aCwgaGVpZ2h0LCBmb3JtYXQsIGFuZHJvaWRVc2FnZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzbG90LCAmYnVmZmVyTmVlZHNSZWFsbG9jYXRpb24sICZmZW5jZSk7CisgICAgICAgICAgICAgICAgaWYgKGMyU3RhdHVzICE9IEMyX09LKSB7CisgICAgICAgICAgICAgICAgICAgIHN5bmNWYXItPmxvY2soKTsKKyAgICAgICAgICAgICAgICAgICAgc3luY1Zhci0+bm90aWZ5UXVldWVkTG9ja2VkKCk7CisgICAgICAgICAgICAgICAgICAgIHN5bmNWYXItPnVubG9jaygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgYzJTdGF0dXMgPSBkZXF1ZXVlQnVmZmVyKHdpZHRoLCBoZWlnaHQsIGZvcm1hdCwgdXNhZ2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmc2xvdCwgJmJ1ZmZlck5lZWRzUmVhbGxvY2F0aW9uLCAmZmVuY2UpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGMyU3RhdHVzICE9IEMyX09LKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGMyU3RhdHVzOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgbURxRmFpbHVyZSA9IDA7CiAgICAgICAgICAgICBtTGFzdERxVHMgPSBnZXRUaW1lc3RhbXBOb3coKTsKQEAgLTM4OSwxOCArMzQxLDQxIEBACiAgICAgICAgICAgICByZXR1cm4gQzJfQkFEX1ZBTFVFOwogICAgICAgICB9CiAgICAgICAgIEFMT0dWKCJkZXF1ZXVlZCBhIGJ1ZmZlciBzdWNjZXNzZnVsbHkiKTsKKyAgICAgICAgYm9vbCBkZXF1ZXVlYWJsZSA9IGZhbHNlOworICAgICAgICB1aW50MzJfdCB3YWl0SWQ7CiAgICAgICAgIGlmIChmZW5jZSkgewogICAgICAgICAgICAgc3RhdGljIGNvbnN0ZXhwciBpbnQga0ZlbmNlV2FpdFRpbWVNcyA9IDEwOwogCiAgICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBmZW5jZS0+d2FpdChrRmVuY2VXYWl0VGltZU1zKTsKICAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gLUVUSU1FKSB7CiAgICAgICAgICAgICAgICAgLy8gZmVuY2UgaXMgbm90IHNpZ25hbGxlZCB5ZXQuCi0gICAgICAgICAgICAgICAgKHZvaWQpbVByb2R1Y2VyLT5jYW5jZWxCdWZmZXIoc2xvdCwgaEZlbmNlV3JhcHBlci5nZXRIYW5kbGUoKSkuaXNPaygpOworICAgICAgICAgICAgICAgIGlmIChzeW5jVmFyKSB7CisgICAgICAgICAgICAgICAgICAgIHN5bmNWYXItPmxvY2soKTsKKyAgICAgICAgICAgICAgICAgICAgKHZvaWQpbVByb2R1Y2VyLT5jYW5jZWxCdWZmZXIoc2xvdCwgaEZlbmNlV3JhcHBlci5nZXRIYW5kbGUoKSkuaXNPaygpOworICAgICAgICAgICAgICAgICAgICBkZXF1ZXVlYWJsZSA9IHN5bmNWYXItPm5vdGlmeVF1ZXVlZExvY2tlZCgmd2FpdElkKTsKKyAgICAgICAgICAgICAgICAgICAgc3luY1Zhci0+dW5sb2NrKCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChjMkZlbmNlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAqYzJGZW5jZSA9IGRlcXVldWVhYmxlID8gQzJGZW5jZSgpIDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX0MyRmVuY2VGYWN0b3J5OjpDcmVhdGVTdXJmYWNlRmVuY2UobVN5bmNNZW0sIHdhaXRJZCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAodm9pZCltUHJvZHVjZXItPmNhbmNlbEJ1ZmZlcihzbG90LCBoRmVuY2VXcmFwcGVyLmdldEhhbmRsZSgpKS5pc09rKCk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHJldHVybiBDMl9CTE9DS0lORzsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gYW5kcm9pZDo6Tk9fRVJST1IpIHsKICAgICAgICAgICAgICAgICBBTE9HRCgiYnVmZmVyIGZlbmNlIHdhaXQgZXJyb3IgJWQiLCBzdGF0dXMpOwotICAgICAgICAgICAgICAgICh2b2lkKW1Qcm9kdWNlci0+Y2FuY2VsQnVmZmVyKHNsb3QsIGhGZW5jZVdyYXBwZXIuZ2V0SGFuZGxlKCkpLmlzT2soKTsKKyAgICAgICAgICAgICAgICBpZiAoc3luY1ZhcikgeworICAgICAgICAgICAgICAgICAgICBzeW5jVmFyLT5sb2NrKCk7CisgICAgICAgICAgICAgICAgICAgICh2b2lkKW1Qcm9kdWNlci0+Y2FuY2VsQnVmZmVyKHNsb3QsIGhGZW5jZVdyYXBwZXIuZ2V0SGFuZGxlKCkpLmlzT2soKTsKKyAgICAgICAgICAgICAgICAgICAgc3luY1Zhci0+bm90aWZ5UXVldWVkTG9ja2VkKCk7CisgICAgICAgICAgICAgICAgICAgIHN5bmNWYXItPnVubG9jaygpOworICAgICAgICAgICAgICAgICAgICBpZiAoYzJGZW5jZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgKmMyRmVuY2UgPSBDMkZlbmNlKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAodm9pZCltUHJvZHVjZXItPmNhbmNlbEJ1ZmZlcihzbG90LCBoRmVuY2VXcmFwcGVyLmdldEhhbmRsZSgpKS5pc09rKCk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHJldHVybiBDMl9CQURfVkFMVUU7CiAgICAgICAgICAgICB9IGVsc2UgaWYgKG1SZW5kZXJDYWxsYmFjaykgewogICAgICAgICAgICAgICAgIG5zZWNzX3Qgc2lnbmFsVGltZSA9IGZlbmNlLT5nZXRTaWduYWxUaW1lKCk7CkBAIC00NDAsNyArNDE1LDE3IEBACiAgICAgICAgICAgICAgICAgcmV0dXJuIEMyX0JBRF9WQUxVRTsKICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RhdHVzICE9IGFuZHJvaWQ6Ok5PX0VSUk9SKSB7CiAgICAgICAgICAgICAgICAgc2xvdEJ1ZmZlci5jbGVhcigpOwotICAgICAgICAgICAgICAgICh2b2lkKW1Qcm9kdWNlci0+Y2FuY2VsQnVmZmVyKHNsb3QsIGhGZW5jZVdyYXBwZXIuZ2V0SGFuZGxlKCkpLmlzT2soKTsKKyAgICAgICAgICAgICAgICBpZiAoc3luY1ZhcikgeworICAgICAgICAgICAgICAgICAgICBzeW5jVmFyLT5sb2NrKCk7CisgICAgICAgICAgICAgICAgICAgICh2b2lkKW1Qcm9kdWNlci0+Y2FuY2VsQnVmZmVyKHNsb3QsIGhGZW5jZVdyYXBwZXIuZ2V0SGFuZGxlKCkpLmlzT2soKTsKKyAgICAgICAgICAgICAgICAgICAgc3luY1Zhci0+bm90aWZ5UXVldWVkTG9ja2VkKCk7CisgICAgICAgICAgICAgICAgICAgIHN5bmNWYXItPnVubG9jaygpOworICAgICAgICAgICAgICAgICAgICBpZiAoYzJGZW5jZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgKmMyRmVuY2UgPSBDMkZlbmNlKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAodm9pZCltUHJvZHVjZXItPmNhbmNlbEJ1ZmZlcihzbG90LCBoRmVuY2VXcmFwcGVyLmdldEhhbmRsZSgpKS5pc09rKCk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHJldHVybiBDMl9CQURfVkFMVUU7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAobUdlbmVyYXRpb24gPT0gMCkgewpAQCAtNDYzLDIwICs0NDgsMzYgQEAKICAgICAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJHcmFwaGljQWxsb2NhdGlvbj4gYWxsb2M7CiAgICAgICAgICAgICAgICAgYzJfc3RhdHVzX3QgZXJyID0gbUFsbG9jYXRvci0+cHJpb3JHcmFwaGljQWxsb2NhdGlvbihjMkhhbmRsZSwgJmFsbG9jKTsKICAgICAgICAgICAgICAgICBpZiAoZXJyICE9IEMyX09LKSB7CisgICAgICAgICAgICAgICAgICAgIG5hdGl2ZV9oYW5kbGVfY2xvc2UoYzJIYW5kbGUpOworICAgICAgICAgICAgICAgICAgICBuYXRpdmVfaGFuZGxlX2RlbGV0ZShjMkhhbmRsZSk7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlcnI7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMkJ1ZmZlclF1ZXVlQmxvY2tQb29sRGF0YT4gcG9vbERhdGEgPQogICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjptYWtlX3NoYXJlZDxDMkJ1ZmZlclF1ZXVlQmxvY2tQb29sRGF0YT4oCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNsb3RCdWZmZXItPmdldEdlbmVyYXRpb25OdW1iZXIoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByb2R1Y2VySWQsIHNsb3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlZF9mcm9tX3RoaXMoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qcm9kdWNlciwgbVN5bmNNZW0sIDApOwogICAgICAgICAgICAgICAgIG1Qb29sRGF0YXNbc2xvdF0gPSBwb29sRGF0YTsKICAgICAgICAgICAgICAgICAqYmxvY2sgPSBfQzJCbG9ja0ZhY3Rvcnk6OkNyZWF0ZUdyYXBoaWNCbG9jayhhbGxvYywgcG9vbERhdGEpOwogICAgICAgICAgICAgICAgIHJldHVybiBDMl9PSzsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIC8vIEJsb2NrIHdhcyBub3QgY3JlYXRlZC4gY2FsbCByZXF1ZXN0QnVmZmVyIyBhZ2FpbiBuZXh0IHRpbWUuCiAgICAgICAgICAgICBzbG90QnVmZmVyLmNsZWFyKCk7Ci0gICAgICAgICAgICAodm9pZCltUHJvZHVjZXItPmNhbmNlbEJ1ZmZlcihzbG90LCBoRmVuY2VXcmFwcGVyLmdldEhhbmRsZSgpKS5pc09rKCk7CisgICAgICAgICAgICBpZiAoc3luY1ZhcikgeworICAgICAgICAgICAgICAgIHN5bmNWYXItPmxvY2soKTsKKyAgICAgICAgICAgICAgICAodm9pZCltUHJvZHVjZXItPmNhbmNlbEJ1ZmZlcihzbG90LCBoRmVuY2VXcmFwcGVyLmdldEhhbmRsZSgpKS5pc09rKCk7CisgICAgICAgICAgICAgICAgc3luY1Zhci0+bm90aWZ5UXVldWVkTG9ja2VkKCk7CisgICAgICAgICAgICAgICAgc3luY1Zhci0+dW5sb2NrKCk7CisgICAgICAgICAgICAgICAgaWYgKGMyRmVuY2UpIHsKKyAgICAgICAgICAgICAgICAgICAgKmMyRmVuY2UgPSBDMkZlbmNlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAodm9pZCltUHJvZHVjZXItPmNhbmNlbEJ1ZmZlcihzbG90LCBoRmVuY2VXcmFwcGVyLmdldEhhbmRsZSgpKS5pc09rKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gQzJfQkFEX1ZBTFVFOworICAgICAgICB9CisgICAgICAgIGlmIChjMkZlbmNlKSB7CisgICAgICAgICAgICAqYzJGZW5jZSA9IEMyRmVuY2UoKTsKICAgICAgICAgfQogICAgICAgICByZXR1cm4gQzJfQkFEX1ZBTFVFOwogICAgIH0KQEAgLTUwNiw3ICs1MDcsOCBAQAogICAgICAgICAgICAgdWludDMyX3QgaGVpZ2h0LAogICAgICAgICAgICAgdWludDMyX3QgZm9ybWF0LAogICAgICAgICAgICAgQzJNZW1vcnlVc2FnZSB1c2FnZSwKLSAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMkdyYXBoaWNCbG9jaz4gKmJsb2NrIC8qIG5vbm51bGwgKi8pIHsKKyAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMkdyYXBoaWNCbG9jaz4gKmJsb2NrIC8qIG5vbm51bGwgKi8sCisgICAgICAgICAgICBDMkZlbmNlICpmZW5jZSkgewogICAgICAgICBibG9jay0+cmVzZXQoKTsKICAgICAgICAgaWYgKG1Jbml0ICE9IEMyX09LKSB7CiAgICAgICAgICAgICByZXR1cm4gbUluaXQ7CkBAIC01MzcsMTcgKzUzOSwxOSBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyQnVmZmVyUXVldWVCbG9ja1Bvb2xEYXRhPiBwb29sRGF0YSA9CiAgICAgICAgICAgICAgICAgICAgIHN0ZDo6bWFrZV9zaGFyZWQ8QzJCdWZmZXJRdWV1ZUJsb2NrUG9vbERhdGE+KAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsICh1aW50NjRfdCkwLCB+MCwgc2hhcmVkX2Zyb21fdGhpcygpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCAodWludDY0X3QpMCwgfjAsIG51bGxwdHIsIG51bGxwdHIsIDApOwogICAgICAgICAgICAgKmJsb2NrID0gX0MyQmxvY2tGYWN0b3J5OjpDcmVhdGVHcmFwaGljQmxvY2soYWxsb2MsIHBvb2xEYXRhKTsKICAgICAgICAgICAgIEFMT0dWKCJhbGxvY2F0ZWQgYSBidWZmZXIgc3VjY2Vzc2Z1bGx5Iik7CiAKICAgICAgICAgICAgIHJldHVybiBDMl9PSzsKICAgICAgICAgfQotICAgICAgICBjMl9zdGF0dXNfdCBzdGF0dXMgPSBmZXRjaEZyb21JZ2JwX2wod2lkdGgsIGhlaWdodCwgZm9ybWF0LCB1c2FnZSwgYmxvY2spOworICAgICAgICBjMl9zdGF0dXNfdCBzdGF0dXMgPSBmZXRjaEZyb21JZ2JwX2wod2lkdGgsIGhlaWdodCwgZm9ybWF0LCB1c2FnZSwgYmxvY2ssIGZlbmNlKTsKICAgICAgICAgaWYgKHN0YXR1cyA9PSBDMl9CTE9DS0lORykgewogICAgICAgICAgICAgbG9jay51bmxvY2soKTsKLSAgICAgICAgICAgIC8vIGluIG9yZGVyIG5vdCB0byBkcmFpbiBjcHUgZnJvbSBjb21wb25lbnQncyBzcGlubmluZwotICAgICAgICAgICAgOjp1c2xlZXAoa01heElnYnBSZXRyeURlbGF5VXMpOworICAgICAgICAgICAgaWYgKCFmZW5jZSkgeworICAgICAgICAgICAgICAgIC8vIGluIG9yZGVyIG5vdCB0byBkcmFpbiBjcHUgZnJvbSBjb21wb25lbnQncyBzcGlubmluZworICAgICAgICAgICAgICAgIDo6dXNsZWVwKGtNYXhJZ2JwUmV0cnlEZWxheVVzKTsKKyAgICAgICAgICAgIH0KICAgICA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B7CisgICAgICAgICAgICBicUluZm9ybWF0aW9uID0gZ2V0R2VuZXJhdGlvbk51bWJlckFuZFVzYWdlKHByb2R1Y2VyLCAmZ2VuZXJhdGlvbiwgJnVzYWdlKTsKKyAgICAgICAgICAgIGlmICghYnFJbmZvcm1hdGlvbikgewogICAgICAgICAgICAgICAgIEFMT0dXKCJnZXQgZ2VuZXJhdGlvbk51bWJlciBmYWlsZWQgJWxsdSIsCiAgICAgICAgICAgICAgICAgICAgICAgKHVuc2lnbmVkIGxvbmcgbG9uZylwcm9kdWNlcklkKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQorICAgICAgICBjb25maWd1cmVQcm9kdWNlcihwcm9kdWNlciwgbnVsbHB0ciwgcHJvZHVjZXJJZCwgZ2VuZXJhdGlvbiwgdXNhZ2UsIGJxSW5mb3JtYXRpb24pOworICAgIH0KKworICAgIHZvaWQgY29uZmlndXJlUHJvZHVjZXIoY29uc3Qgc3A8SEdyYXBoaWNCdWZmZXJQcm9kdWNlcj4gJnByb2R1Y2VyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlX2hhbmRsZV90ICpzeW5jSGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDY0X3QgcHJvZHVjZXJJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGdlbmVyYXRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50NjRfdCB1c2FnZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgYnFJbmZvcm1hdGlvbikgeworICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJTdXJmYWNlU3luY01lbW9yeT4gYzJTeW5jTWVtOworICAgICAgICBpZiAoc3luY0hhbmRsZSkgeworICAgICAgICAgICAgaWYgKCFwcm9kdWNlcikgeworICAgICAgICAgICAgICAgIG5hdGl2ZV9oYW5kbGVfY2xvc2Uoc3luY0hhbmRsZSk7CisgICAgICAgICAgICAgICAgbmF0aXZlX2hhbmRsZV9kZWxldGUoc3luY0hhbmRsZSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGMyU3luY01lbSA9IEMyU3VyZmFjZVN5bmNNZW1vcnk6OkltcG9ydChzeW5jSGFuZGxlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogICAgICAgICBpbnQgbWlncmF0ZWQgPSAwOworICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJTdXJmYWNlU3luY01lbW9yeT4gb2xkTWVtOwogICAgICAgICAvLyBwb29sRGF0YXMgZHRvciBzaG91bGQgbm90IGJlIGNhbGxlZCBkdXJpbmcgbG9jayBpcyBoZWxkLgogICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8QzJCdWZmZXJRdWV1ZUJsb2NrUG9vbERhdGE+CiAgICAgICAgICAgICAgICAgcG9vbERhdGFzW05VTV9CVUZGRVJfU0xPVFNdOwpAQCAtNTk1LDIyICs2MTksMzAgQEAKICAgICAgICAgICAgIGlmIChwcm9kdWNlcikgewogICAgICAgICAgICAgICAgIG1Qcm9kdWNlciA9IHByb2R1Y2VyOwogICAgICAgICAgICAgICAgIG1Qcm9kdWNlcklkID0gcHJvZHVjZXJJZDsKLSAgICAgICAgICAgICAgICBtR2VuZXJhdGlvbiA9IGhhdmVHZW5lcmF0aW9uID8gZ2VuZXJhdGlvbiA6IDA7CisgICAgICAgICAgICAgICAgbUdlbmVyYXRpb24gPSBicUluZm9ybWF0aW9uID8gZ2VuZXJhdGlvbiA6IDA7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIG1Qcm9kdWNlciA9IG51bGxwdHI7CiAgICAgICAgICAgICAgICAgbVByb2R1Y2VySWQgPSAwOwogICAgICAgICAgICAgICAgIG1HZW5lcmF0aW9uID0gMDsKICAgICAgICAgICAgICAgICBBTE9HVygiaW52YWxpZCBwcm9kdWNlciBwcm9kdWNlciglZCksIGdlbmVyYXRpb24oJWQpIiwKLSAgICAgICAgICAgICAgICAgICAgICAoYm9vbClwcm9kdWNlciwgaGF2ZUdlbmVyYXRpb24pOworICAgICAgICAgICAgICAgICAgICAgIChib29sKXByb2R1Y2VyLCBicUluZm9ybWF0aW9uKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtUHJvZHVjZXIgJiYgaGF2ZUdlbmVyYXRpb24pIHsgLy8gbWlncmF0ZSBidWZmZXJzCisgICAgICAgICAgICBvbGRNZW0gPSBtU3luY01lbTsgLy8gcHJldmVuIGRlc3RydWN0aW9uIHdoaWxlIGxvY2tlZC4KKyAgICAgICAgICAgIG1TeW5jTWVtID0gYzJTeW5jTWVtOworICAgICAgICAgICAgQzJTeW5jVmFyaWFibGVzICpzeW5jVmFyID0gbVN5bmNNZW0gPyBtU3luY01lbS0+bWVtKCkgOiBudWxscHRyOworICAgICAgICAgICAgaWYgKHN5bmNWYXIpIHsKKyAgICAgICAgICAgICAgICBzeW5jVmFyLT5sb2NrKCk7CisgICAgICAgICAgICAgICAgc3luY1Zhci0+c2V0U3luY1N0YXR1c0xvY2tlZChDMlN5bmNWYXJpYWJsZXM6OlNUQVRVU19BQ1RJVkUpOworICAgICAgICAgICAgICAgIHN5bmNWYXItPnVubG9jaygpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1Qcm9kdWNlciAmJiBicUluZm9ybWF0aW9uKSB7IC8vIG1pZ3JhdGUgYnVmZmVycwogICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTlVNX0JVRkZFUl9TTE9UUzsgKytpKSB7CiAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxDMkJ1ZmZlclF1ZXVlQmxvY2tQb29sRGF0YT4gZGF0YSA9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVBvb2xEYXRhc1tpXS5sb2NrKCk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc2xvdCA9IGRhdGEtPm1pZ3JhdGUoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qcm9kdWNlciwgZ2VuZXJhdGlvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZHVjZXJJZCwgbUJ1ZmZlcnMsIG9sZEdlbmVyYXRpb24pOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUHJvZHVjZXIsIGdlbmVyYXRpb24sIHVzYWdlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kdWNlcklkLCBtQnVmZmVyc1tpXSwgb2xkR2VuZXJhdGlvbiwgbVN5bmNNZW0pOwogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNsb3QgPj0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlcnNbc2xvdF0gPSBtQnVmZmVyc1tpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb29sRGF0YXNbc2xvdF0gPSBkYXRhOwpAQCAtNjI0LDcgKzY1Niw3IEBACiAgICAgICAgICAgICAgICAgbVBvb2xEYXRhc1tpXSA9IHBvb2xEYXRhc1tpXTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgICAgICBpZiAocHJvZHVjZXIgJiYgaGF2ZUdlbmVyYXRpb24pIHsKKyAgICAgICAgaWYgKHByb2R1Y2VyICYmIGJxSW5mb3JtYXRpb24pIHsKICAgICAgICAgICAgIEFMT0dEKCJsb2NhbCBnZW5lcmF0aW9uIGNoYW5nZSAldSAsICIKICAgICAgICAgICAgICAgICAgICJicUlkOiAlbGx1IG1pZ3JhdGVkIGJ1ZmZlcnMgIyAlZCIsCiAgICAgICAgICAgICAgICAgICBnZW5lcmF0aW9uLCAodW5zaWduZWQgbG9uZyBsb25nKXByb2R1Y2VySWQsIG1pZ3JhdGVkKTsKQEAgLTYzNCwxNyArNjY2LDYgQEAKIHByaXZhdGU6CiAgICAgZnJpZW5kI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WYgKGxvY2FsUG9vbCkgewotICAgICAgICAgICAgbG9jYWxQb29sLT5jYW5jZWwoZ2VuZXJhdGlvbiwgYnFJZCwgYnFTbG90KTsKKworICAgIGlmIChtTG9jYWwpIHsKKyAgICAgICAgaWYgKG1HZW5lcmF0aW9uID09IG1DdXJyZW50R2VuZXJhdGlvbiAmJiBtQnFJZCA9PSBtQ3VycmVudEJxSWQpIHsKKyAgICAgICAgICAgIEMyU3luY1ZhcmlhYmxlcyAqc3luY1ZhciA9IG1TeW5jTWVtID8gbVN5bmNNZW0tPm1lbSgpIDogbnVsbHB0cjsKKyAgICAgICAgICAgIGlmIChzeW5jVmFyKSB7CisgICAgICAgICAgICAgICAgc3luY1Zhci0+bG9jaygpOworICAgICAgICAgICAgICAgIGlmIChzeW5jVmFyLT5nZXRTeW5jU3RhdHVzTG9ja2VkKCkgPT0gQzJTeW5jVmFyaWFibGVzOjpTVEFUVVNfQUNUSVZFKSB7CisgICAgICAgICAgICAgICAgICAgIG1JZ2JwLT5jYW5jZWxCdWZmZXIobUJxU2xvdCwgaGlkbF9oYW5kbGV7fSkuaXNPaygpOworICAgICAgICAgICAgICAgICAgICBzeW5jVmFyLT5ub3RpZnlRdWV1ZWRMb2NrZWQoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc3luY1Zhci0+dW5sb2NrKCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1JZ2JwLT5jYW5jZWxCdWZmZXIobUJxU2xvdCwgaGlkbF9oYW5kbGV7fSkuaXNPaygpOworICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgfSBlbHNlIGlmIChpZ2JwICYmICFvd25lci5leHBpcmVkKCkpIHsKLSAgICAgICAgaWdicC0+Y2FuY2VsQnVmZmVyKGJxU2xvdCwgaGlkbF9oYW5kbGV7fSkuaXNPaygpOworICAgIH0gZWxzZSBpZiAoIW1Pd25lci5leHBpcmVkKCkpIHsKKyAgICAgICAgQzJTeW5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lzcGxheSB8fAorICAgICAgICBtQXR0YWNoIHx8ICFtSGVsZCkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIGlmIChtQnFJZCA9PSAwKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgbUF0dGFjaCA9IHRydWU7CisgICAgcmV0dXJuIHRydWU7Cit9CisKK2Jvb2wgQzJCdWZmZXJRdWV1ZUJsb2NrUG9vbERhdGE6OmVuZEF0dGFjaEJsb2NrVG9CdWZmZXJRdWV1ZSgKKyAgICAgICAgY29uc3Qgc3RkOjpzaGFyZWRfcHRyPGludD4mIG93bmVyLAorICAgICAgICBjb25zdCBzcDxIR3JhcGhpY0J1ZmZlclByb2R1Y2VyPiYgaWdicCwKKyAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEMyU3VyZmFjZVN5bmNNZW1vcnk+IHN5bmNNZW0sCisgICAgICAgIHVpbnQzMl90IGdlbmVyYXRpb24sCisgICAgICAgIHVpbnQ2NF90IGJxSWQsCisgICAgICAgIGludDMyX3QgYnFTbG90KSB7CisgICAgc3RkOjpzY29wZWRfbG9jazxzdGQ6Om11dGV4PiBsb2NrKG1Mb2NrKTsKKyAgICBpZiAobUxvY2FsIHx8ICFtQXR0YWNoKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgaWYgKG1EaXNwbGF5KSB7CisgICAgICAgIG1BdHRhY2ggPSBmYWxzZTsKKyAgICAgICAgbUhlbGQgPSBmYWxzZTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBtQXR0YWNoID0gZmFsc2U7CisgICAgbUhlbGQgPSB0cnVlOworICAgIG1Pd25lciA9IG93bmVyOworICAgIG1JZ2JwID0gaWdicDsKKyAgICBtU3luY01lbSA9IHN5bmNNZW07CisgICAgbUdlbmVyYXRpb24gPSBnZW5lcmF0aW9uOworICAgIG1CcUlkID0gYnFJZDsKKyAgICBtQnFTbG90ID0gYnFTbG90Owor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7CisgICAgICAgICAgICBtTG9jay5jb21wYXJlX2V4Y2hhbmdlX3N0cm9uZyhvbGQsIEZVVEVYX0xPQ0tFRF9DT05URU5ERUQpOworICAgICAgICAgICAgaWYgKG9sZCkgeworICAgICAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHNjaGVkX3lpZWxkKCk7CisgICAgfQorCisgICAgKHZvaWQpIHN5c2NhbGwoX19OUl9mdXRleCwgJm1Mb2NrLCBGVVRFWF9XQUtFLCAxLCBOVUxMLCBOVUxMLCAwKTsKKyAgICByZXR1cm4gMDsKK30KKwordm9pZCBDMlN5bmNWYXJpYWJsZXM6OnNldEluaXRpYWxEZXF1ZXVlQ291bnRMb2NrZWQoCisgICAgICAgIGludDMyX3QgbWF4RGVxdWV1ZUNvdW50LCBpbnQzMl90IGN1ckRlcXVldWVDb3VudCkgeworICAgIG1NYXhEZXF1ZXVlQ291bnQgPSBtYXhEZXF1ZXVlQ291bnQ7CisgICAgbUN1ckRlcXVldWVDb3VudCA9IGN1ckRlcXVldWVDb3VudDsKK30KKwordWludDMyX3QgQzJTeW5jVmFyaWFibGVzOjpnZXRXYWl0SWRMb2NrZWQoKSB7CisgICAgcmV0dXJuIG1Db25kLmxvYWQoKTsKK30KKworYm9vbCBDMlN5bmNWYXJpYWJsZXM6OmlzRGVxdWV1ZWFibGVMb2NrZWQodWludDMyX3QgKndhaXRJZCkgeworICAgIGlmIChtTWF4RGVxdWV1ZUNvdW50IDw9IG1DdXJEZXF1ZXVlQ291bnQpIHsKKyAgICAgICAgaWYgKHdhaXRJZCkgeworICAgICAgICAgICAgKndhaXRJZCA9IGdldFdhaXRJZExvY2tlZCgpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgcmV0dXJuIHRydWU7Cit9CisKK2Jvb2wgQzJTeW5jVmFyaWFibGVzOjpub3RpZnlRdWV1ZWRMb2NrZWQodWludDMyX3QgKndhaXRJZ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iA9IEMyQ29tcG9uZW50OjpET01BSU5fSU1BR0U7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB0cmFpdHMtPmRvbWFpbiA9IEMyQ29tcG9uZW50OjpET01BSU5fT1RIRVI7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwYXJhbXMuY2xlYXIoKTsKKyAgICByZXMgPSBpbnRmLT5xdWVyeV92Yih7fSwgeyBDMkNvbXBvbmVudEFsaWFzZXNTZXR0aW5nOjpQQVJBTV9UWVBFIH0sIEMyX01BWV9CTE9DSywgJnBhcmFtcyk7CisgICAgaWYgKHJlcyA9PSBDMl9PSyAmJiBwYXJhbXMuc2l6ZSgpID09IDF1KSB7CisgICAgICAgIEMyQ29tcG9uZW50QWxpYXNlc1NldHRpbmcgKmFsaWFzZXNTZXR0aW5nID0KKyAgICAgICAgICAgIEMyQ29tcG9uZW50QWxpYXNlc1NldHRpbmc6OkZyb20ocGFyYW1zWzBdLmdldCgpKTsKKyAgICAgICAgaWYgKGFsaWFzZXNTZXR0aW5nKSB7CisgICAgICAgICAgICBzdGQ6OmlzdHJpbmdzdHJlYW0gaXNzKAorICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyhhbGlhc2VzU2V0dGluZy0+bS52YWx1ZSwgYWxpYXNlc1NldHRpbmctPmZsZXhDb3VudCgpKSk7CisgICAgICAgICAgICBDMl9MT0coREVCVUcpIDw8IGludGYtPmdldE5hbWUoKSA8PCAiIGhhcyBhbGlhc2VzOiAiIDw8IGlzcy5zdHIoKTsKKworICAgICAgICAgICAgZm9yIChzdGQ6OnN0cmluZyB0b2s7IHN0ZDo6Z2V0bGluZShpc3MsIHRvaywgJywnKTsgKSB7CisgICAgICAgICAgICAgICAgdHJhaXRzLT5hbGlhc2VzLnB1c2hfYmFjayh0b2spOworICAgICAgICAgICAgICAgIEMyX0xPRyhERUJVRykgPDwgImFkZGluZyBhbGlhczogIiA8PCB0b2s7CisgICAgICAgICAgICB9CisgICAgICAgIH0KK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bGljYWJsZV9saWNlbnNlczogWworICAgICAgICAiZnJhbWV3b3Jrc19hdl9tZWRpYV9jb2RlY3NfYW1ybmJfY29tbW9uX2xpY2Vuc2UiLAorICAgIF0sCit9CisKKy8vIEFkZGVkIGF1dG9tYXRpY2FsbHkgYnkgYSBsYXJnZS1zY2FsZS1jaGFuZ2UKKy8vIFNlZTogaHR0cDovL2dvL2FuZHJvaWQtbGljZW5zZS1mYXEKK2xpY2Vuc2UgeworICAgIG5hbWU6ICJmcmFtZXdvcmtzX2F2X21lZGlhX2NvZGVjc19hbXJuYl9jb21tb25fbGljZW5zZSIsCisgICAgdmlzaWJpbGl0eTogWyI6X19zdWJwYWNrYWdlc19fIl0sCisgICAgbGljZW5zZV9raW5kczogWworICAgICAgICAiU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMCIsCisgICAgXSwKKyAgICBsaWNlbnNlX3RleHQ6IFsKKyAgICAgICAgIk5PVElDRSIsCisgICAgXSwKK30KKworY2NfbGlicmFyeSB7CisgICAgbmFtZTogImxpYnN0YWdlZnJpZ2h0X2Ftcm5iX2NvbW1vbiIsCisgICAgdmVuZG9yX2F2YWlsYWJsZTogdHJ1ZSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKyAgICBtaW5fc2RrX3ZlcnNpb246ICIyOSIsCisKKyAgICBzcmNzOiBbCisgICAgICAgICJzcmMvYWRkLmNwcCIsCisgICAgICAgICJzcmMvYXpfbHNwLmNwcCIsCisgICAgICAgICJzcmMvYml0bm9fdGFiLmNwcCIsCisgICAgICAgICJzcmMvYml0cmVvcmRlcl90YWIuY3BwIiwKKyAgICAgICAgInNyYy9iaXRzMnBybS5jcHAiLAorICAgICAgICAic3JjL2MyXzlwZl90YWIuY3BwIiwKKyAgICAgICAgInNyYy9jb3B5LmNwcCIsCisgICAgICAgICJzcmMvZGl2XzMyLmNwcCIsCisgICAgICAgICJzcmMvZGl2X3MuY3BwIiwKKyAgICAgICAgInNyYy9leHRyYWN0X2guY3BwIiwKKyAgICAgICAgInNyYy9leHRyYWN0X2wuY3BwIiwKKyAgICAgICAgInNyYy9nYWluc190YmwuY3BwIiwKKyAgICAgICAgInNyYy9nY19wcmVkLmNwcCIsCisgICAgICAgICJzcmMvZ21lZF9uLmNwcCIsCisgICAgICAgICJzcmMvZ3JpZF90YmwuY3BwIiwKKyAgICAgICAgInNyYy9ncmF5X3RibC5jcHAiLAorICAgICAgICAic3JjL2ludF9scGMuY3BwIiwKKyAgICAgICAgInNyYy9pbnZfc3FydC5jcHAiLAorICAgICAgICAic3JjL2ludl9zcXJ0X3RibC5jcHAiLAorICAgICAgICAic3JjL2xfYWJzLmNwcCIsCisgICAgICAgICJzcmMvbF9kZXBvc2l0X2guY3BwIiwKKyAgICAgICAgInNyYy9sX2RlcG9zaXRfbC5jcHAiLAorICAgICAgICAic3JjL2xfc2hyX3IuY3BwIiwKKyAgICAgICAgInNyYy9sb2cyLmNwcCIsCisgICAgICAgICJzcmMvbG9nMl9ub3JtLmNwcCIsCisgICAgICAgICJzcmMvbG9nMl90YmwuY3BwIiwKKyAgICAgICAgInNyYy9sc2Z3dC5jcHAiLAorICAgICAgICAic3JjL2xzcC5jcHAiLAorICAgICAgICAic3JjL2xzcF9hei5jcHAiLAorICAgICAgICAic3JjL2xzcF9sc2YuY3BwIiwKKyAgICAgICAgInNyYy9sc3BfbHNmX3RibC5jcHAiLAorICAgICAgICAic3JjL2xzcF90YWIuY3BwIiwKKyAgICAgICAgInNyYy9tdWx0X3IuY3BwIiwKKyAgICAgICAgInNyYy9ub3JtX2wuY3BwIiwKKyAgICAgICAgInNyYy9ub3JtX3MuY3BwIiwKKyAgICAgICAgInNyYy9waF9kaXNwX3RhYi5jcHAiLAorICAgICAgICAic3JjL3BvdzIuY3BwIiwKKyAgICAgICAgInNyYy9wb3cyX3RibC5jcHAiLAorICAgICAgICAic3JjL3ByZWRfbHQuY3BwIiwKKyAgICAgICAgInNyYy9xX3Bsc2YuY3BwIiwKKyAgICAgICAgInNyYy9xX3Bsc2ZfMy5jcHAiLAorICAgICAgICAic3JjL3FfcGxzZl8zX3RibC5jcHAiLAorICAgICAgICAic3JjL3FfcGxzZl81LmNwcCIsCisgICAgICAgICJzcmMvcV9wbHNmXzVfdGJsLmNwcCIsCisgICAgICAgICJzcmMvcXVhX2dhaW5fdGJsLmNwcCIsCisgICAgICAgICJzcmMvcmVvcmRlci5jcHAiLAorICAgICAgICAic3JjL3Jlc2lkdS5jcHAiLAorICAgICAgICAic3JjL3JvdW5kLmNwcCIsCisgICAgICAgICJzcmMvc2V0X3plcm8uY3BwIiwKKyAgICAgICAgInNyYy9zaHIuY3BwIiwKKyAgICAgICAgInNyYy9zaHJfci5jcHAiLAorICAgICAgICAic3JjL3NxcnRfbC5jcHAiLAorICAgICAgICAic3JjL3NxcnRfbF90YmwuY3BwIiwKKyAgICAgICAgInNyYy9zdWIuY3BwIiwKKyAgICAgICAgInNyYy9zeW5fZmlsdC5jcHAiLAorICAgICAgICAic3JjL3ZhZDEuY3BwIiwKKyAgICAgICAgInNyYy93ZWlnaHRfYS5jcHAiLAorICAgICAgICAic3JjL3dpbmRvd190YWIuY3BwIiwKKyAgICBdLAorCisgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWyJpbmNsdWRlIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1ET1NDTF9VTlVTRURfQVJHKHgpPSh2b2lkKSh4KSIsCisgICAgICAgICItRE9TQ0xfSU1QT1JUX1JFRj0iLAorICAgICAgICAiLURPU0NMX0VYUE9SVF9SRUY9IiwKKworICAgICAgICAiLVdlcnJvciIsCisgICAgXSwKKworICAgIHRhcmdldDogeworICAgICAgICBkYXJ3aW46IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgIH0sCisKKyAgICAvL2FkZHJlc3NpbmcgYi8yNTQwOTc0NAorICAgIC8vc2FuaXRpemU6IHsKKyAgICAvLyAgICBtaXNjX3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kZWNzX2Ftcm5iX2RlY19saWNlbnNlIiwKKyAgICB2aXNpYmlsaXR5OiBbIjpfX3N1YnBhY2thZ2VzX18iXSwKKyAgICBsaWNlbnNlX2tpbmRzOiBbCisgICAgICAgICJTUERYLWxpY2Vuc2UtaWRlbnRpZmllci1BcGFjaGUtMi4wIiwKKyAgICAgICAgIlNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUJTRCIsCisgICAgXSwKKyAgICBsaWNlbnNlX3RleHQ6IFsKKyAgICAgICAgIk5PVElDRSIsCisgICAgXSwKK30KKworY2NfbGlicmFyeV9zdGF0aWMgeworICAgIG5hbWU6ICJsaWJzdGFnZWZyaWdodF9hbXJuYmRlYyIsCisgICAgdmVuZG9yX2F2YWlsYWJsZTogdHJ1ZSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKyAgICBtaW5fc2RrX3ZlcnNpb246ICIyOSIsCisKKyAgICBzcmNzOiBbCisgICAgICAgICJzcmMvYV9yZWZsLmNwcCIsCisgICAgICAgICJzcmMvYWdjLmNwcCIsCisgICAgICAgICJzcmMvYW1yZGVjb2RlLmNwcCIsCisgICAgICAgICJzcmMvYl9jbl9jb2QuY3BwIiwKKyAgICAgICAgInNyYy9iZ25zY2QuY3BwIiwKKyAgICAgICAgInNyYy9jX2dfYXZlci5jcHAiLAorICAgICAgICAic3JjL2QxMDM1cGYuY3BwIiwKKyAgICAgICAgInNyYy9kMl8xMXBmLmNwcCIsCisgICAgICAgICJzcmMvZDJfOXBmLmNwcCIsCisgICAgICAgICJzcmMvZDNfMTRwZi5jcHAiLAorICAgICAgICAic3JjL2Q0XzE3cGYuY3BwIiwKKyAgICAgICAgInNyYy9kOF8zMXBmLmNwcCIsCisgICAgICAgICJzcmMvZF9nYWluX2MuY3BwIiwKKyAgICAgICAgInNyYy9kX2dhaW5fcC5jcHAiLAorICAgICAgICAic3JjL2RfcGxzZi5jcHAiLAorICAgICAgICAic3JjL2RfcGxzZl8zLmNwcCIsCisgICAgICAgICJzcmMvZF9wbHNmXzUuY3BwIiwKKyAgICAgICAgInNyYy9kZWNfYW1yLmNwcCIsCisgICAgICAgICJzcmMvZGVjX2dhaW4uY3BwIiwKKyAgICAgICAgInNyYy9kZWNfaW5wdXRfZm9ybWF0X3RhYi5jcHAiLAorICAgICAgICAic3JjL2RlY19sYWczLmNwcCIsCisgICAgICAgICJzcmMvZGVjX2xhZzYuY3BwIiwKKyAgICAgICAgInNyYy9kdHhfZGVjLmNwcCIsCisgICAgICAgICJzcmMvZWNfZ2FpbnMuY3BwIiwKKyAgICAgICAgInNyYy9leF9jdHJsLmNwcCIsCisgICAgICAgICJzcmMvaWYyX3RvX2V0cy5jcHAiLAorICAgICAgICAic3JjL2ludF9sc2YuY3BwIiwKKyAgICAgICAgInNyYy9sc3BfYXZnLmNwcCIsCisgICAgICAgICJzcmMvcGhfZGlzcC5jcHAiLAorICAgICAgICAic3JjL3Bvc3RfcHJvLmNwcCIsCisgICAgICAgICJzcmMvcHJlZW1waC5jcHAiLAorICAgICAgICAic3JjL3BzdGZpbHQuY3BwIiwKKyAgICAgICAgInNyYy9xZ2FpbjQ3NV90YWIuY3BwIiwKKyAgICAgICAgInNyYy9zcF9kZWMuY3BwIiwKKyAgICAgICAgInNyYy93bWZfdG9fZXRzLmNwcCIsCisgICAgXSwKKworICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsic3JjIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1ET1NDTF9VTlVTRURfQVJHKHgpPSh2b2lkKSh4KSIsCisgICAgICAgICItRE9TQ0xfSU1QT1JUX1JFRj0iLAorCisgICAgICAgICItV2Vycm9yIiwKKyAgICBdLAorCisgICAgLy9zYW5pdGl6ZTogeworICAgIC8vICAgIG1pc2NfdW5kZWZpbmVkOiBbCisgICAgLy8gICAgICAgICJzaWduZWQtaW50ZWdlci1vdmVyZmxvdyIsCisgICAgLy8gICAgXSwKKyAgICAvL30sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGlic3RhZ2VmcmlnaHRfYW1ybmJfY29tbW9uIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgXSwKKworICAgIHRhcmdldDogeworICAgICAgICBkYXJ3aW46IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgIH0sCit9CisKKy8vIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIworY2NfdGVzdCB7CisgICAgbmFtZTogImxpYnN0YWdlZnJpZ2h0X2Ftcm5iZGVjX3Rlc3QiLAorICAgIGd0ZXN0OiBmYWxzZSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKworICAgIHNyY3M6IFsidGVzdC9hbXJuYmRlY190ZXN0LmNwcCJdLAorCisgICAgY2ZsYWdzOiBbIi1XYWxsIiwgIi1XZXJyb3IiXSwKKworICAgIGxvY2FsX2luY2x1ZGVfZGlyczogWyJzcmMiXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9hbXJuYmRlYyIsCisgICAgICAgICJsaWJzbmRmaWxlIiwKKyAgICBdLAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2Ftcm5iX2NvbW1vbiIsCisgICAgICAgICJsaWJhdWRpb3V0aWxzIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgXSwKKworICAgIHRhcmdldDogeworICAgICAgICBkYXJ3aW46IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgIH0sCisKKyAgICAvL3Nhbml0aXplOiB7CisgICAgLy8gICAgbWlzY191bmRlZmluZWQ6IFsKKyAgICAvLyAgICAgICAgInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAvLyAgICBd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pY2Vuc2Vfa2luZHMnIGZyb20gImZyYW1ld29ya3NfYXZfbWVkaWFfY29kZWNzX2Ftcm5iX2RlY19saWNlbnNlIgorICAgIC8vIHRvIGdldCB0aGUgYmVsb3cgbGljZW5zZSBraW5kczoKKyAgICAvLyAgIFNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUFwYWNoZS0yLjAKKyAgICAvLyAgIFNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUJTRAorICAgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWworICAgICAgICAiZnJhbWV3b3Jrc19hdl9tZWRpYV9jb2RlY3NfYW1ybmJfZGVjX2xpY2Vuc2UiLAorICAgIF0sCit9CisKK2NjX3Rlc3QgeworICAgIG5hbWU6ICJBbXJuYkRlY29kZXJUZXN0IiwKKyAgICBndGVzdDogdHJ1ZSwKKyAgICB0ZXN0X3N1aXRlczogWyJkZXZpY2UtdGVzdHMiXSwKKworICAgIHNyY3M6IFsKKyAgICAgICAgIkFtcm5iRGVjb2RlclRlc3QuY3BwIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2Ftcm5iX2NvbW1vbiIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9hbXJuYmRlYyIsCisgICAgICAgICJsaWJhdWRpb3V0aWxzIiwKKyAgICAgICAgImxpYnNuZGZpbGUiLAorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGlibG9nIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV2Vycm9yIiwKKyAgICAgICAgIi1XYWxsIiwKKyAgICBdLAorCisgICAgc2FuaXRpemU6IHsKKyAgICAgICAgY2ZpOiB0cnVlLAorICAgICAgICBtaXNjX3VuZGVmaW5lZDogWworICAgICAgICAgICAgInVuc2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICAgICAgInNpZ25lZC1pbnRlZ2Vy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cm5iX2VuY19saWNlbnNlIiwKKyAgICB2aXNpYmlsaXR5OiBbIjpfX3N1YnBhY2thZ2VzX18iXSwKKyAgICBsaWNlbnNlX2tpbmRzOiBbCisgICAgICAgICJTUERYLWxpY2Vuc2UtaWRlbnRpZmllci1BcGFjaGUtMi4wIiwKKyAgICAgICAgIlNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUJTRCIsCisgICAgXSwKKyAgICBsaWNlbnNlX3RleHQ6IFsKKyAgICAgICAgIk5PVElDRSIsCisgICAgXSwKK30KKworY2NfbGlicmFyeV9zdGF0aWMgeworICAgIG5hbWU6ICJsaWJzdGFnZWZyaWdodF9hbXJuYmVuYyIsCisgICAgdmVuZG9yX2F2YWlsYWJsZTogdHJ1ZSwKKyAgICBtaW5fc2RrX3ZlcnNpb246ICIyOSIsCisKKyAgICBzcmNzOiBbCisgICAgICAgICJzcmMvYW1yZW5jb2RlLmNwcCIsCisgICAgICAgICJzcmMvYXV0b2NvcnIuY3BwIiwKKyAgICAgICAgInNyYy9jMTAzNXBmLmNwcCIsCisgICAgICAgICJzcmMvYzJfMTFwZi5jcHAiLAorICAgICAgICAic3JjL2MyXzlwZi5jcHAiLAorICAgICAgICAic3JjL2MzXzE0cGYuY3BwIiwKKyAgICAgICAgInNyYy9jNF8xN3BmLmNwcCIsCisgICAgICAgICJzcmMvYzhfMzFwZi5jcHAiLAorICAgICAgICAic3JjL2NhbGNfY29yLmNwcCIsCisgICAgICAgICJzcmMvY2FsY19lbi5jcHAiLAorICAgICAgICAic3JjL2Nic2VhcmNoLmNwcCIsCisgICAgICAgICJzcmMvY2xfbHRwLmNwcCIsCisgICAgICAgICJzcmMvY29kX2Ftci5jcHAiLAorICAgICAgICAic3JjL2NvbnZvbHZlLmNwcCIsCisgICAgICAgICJzcmMvY29yX2guY3BwIiwKKyAgICAgICAgInNyYy9jb3JfaF94LmNwcCIsCisgICAgICAgICJzcmMvY29yX2hfeDIuY3BwIiwKKyAgICAgICAgInNyYy9jb3Jyd2dodF90YWIuY3BwIiwKKyAgICAgICAgInNyYy9kdHhfZW5jLmNwcCIsCisgICAgICAgICJzcmMvZW5jX2xhZzMuY3BwIiwKKyAgICAgICAgInNyYy9lbmNfbGFnNi5jcHAiLAorICAgICAgICAic3JjL2VuY19vdXRwdXRfZm9ybWF0X3RhYi5jcHAiLAorICAgICAgICAic3JjL2V0c190b19pZjIuY3BwIiwKKyAgICAgICAgInNyYy9ldHNfdG9fd21mLmNwcCIsCisgICAgICAgICJzcmMvZ19hZGFwdC5jcHAiLAorICAgICAgICAic3JjL2dfY29kZS5jcHAiLAorICAgICAgICAic3JjL2dfcGl0Y2guY3BwIiwKKyAgICAgICAgInNyYy9nYWluX3EuY3BwIiwKKyAgICAgICAgInNyYy9ocF9tYXguY3BwIiwKKyAgICAgICAgInNyYy9pbnRlcl8zNi5jcHAiLAorICAgICAgICAic3JjL2ludGVyXzM2X3RhYi5jcHAiLAorICAgICAgICAic3JjL2xfY29tcC5jcHAiLAorICAgICAgICAic3JjL2xfZXh0cmFjdC5jcHAiLAorICAgICAgICAic3JjL2xfbmVnYXRlLmNwcCIsCisgICAgICAgICJzcmMvbGFnX3dpbmQuY3BwIiwKKyAgICAgICAgInNyYy9sYWdfd2luZF90YWIuY3BwIiwKKyAgICAgICAgInNyYy9sZXZpbnNvbi5jcHAiLAorICAgICAgICAic3JjL2xwYy5jcHAiLAorICAgICAgICAic3JjL29sX2x0cC5jcHAiLAorICAgICAgICAic3JjL3Bfb2xfd2doLmNwcCIsCisgICAgICAgICJzcmMvcGl0Y2hfZnIuY3BwIiwKKyAgICAgICAgInNyYy9waXRjaF9vbC5jcHAiLAorICAgICAgICAic3JjL3ByZV9iaWcuY3BwIiwKKyAgICAgICAgInNyYy9wcmVfcHJvYy5jcHAiLAorICAgICAgICAic3JjL3BybTJiaXRzLmNwcCIsCisgICAgICAgICJzcmMvcV9nYWluX2MuY3BwIiwKKyAgICAgICAgInNyYy9xX2dhaW5fcC5jcHAiLAorICAgICAgICAic3JjL3FnYWluNDc1LmNwcCIsCisgICAgICAgICJzcmMvcWdhaW43OTUuY3BwIiwKKyAgICAgICAgInNyYy9xdWFfZ2Fpbi5jcHAiLAorICAgICAgICAic3JjL3MxMF84cGYuY3BwIiwKKyAgICAgICAgInNyYy9zZXRfc2lnbi5jcHAiLAorICAgICAgICAic3JjL3NpZF9zeW5jLmNwcCIsCisgICAgICAgICJzcmMvc3BfZW5jLmNwcCIsCisgICAgICAgICJzcmMvc3ByZXByb2MuY3BwIiwKKyAgICAgICAgInNyYy9zcHN0cHJvYy5jcHAiLAorICAgICAgICAic3JjL3Rvbl9zdGFiLmNwcCIsCisgICAgXSwKKworICAgIGhlYWRlcl9saWJzOiBbImxpYnN0YWdlZnJpZ2h0X2hlYWRlcnMiXSwKKyAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbInNyYyJdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItRE9TQ0xfVU5VU0VEX0FSRyh4KT0odm9pZCkoeCkiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgXSwKKworICAgIC8vYWRkcmVzc2luZyBiLzI1NDA5NzQ0CisgICAgLy9zYW5pdGl6ZTogeworICAgIC8vICAgIG1pc2NfdW5kZWZpbmVkOiBbCisgICAgLy8gICAgICAgICJzaWduZWQtaW50ZWdlci1vdmVyZmxvdyIsCisgICAgLy8gICAgXSwKKyAgICAvL30sCisKKyAgICBzaGFyZWRfbGliczogWyJsaWJzdGFnZWZyaWdodF9hbXJuYl9jb21tb24iXSwKKworICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIHRhcmdldDogeworICAgICAgICBkYXJ3aW46IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgIH0sCit9CisKKy8vIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjI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OV0gPSB7TVI0NzUsIC8qIDQuNzUga2JwcyAqLworICAgICAgICAgICAgICAgICAgICAgICAgTVI1MTUsIC8qIDUuMTUga2JwcyAqLworICAgICAgICAgICAgICAgICAgICAgICAgTVI1OSwgIC8qIDUuOTAga2JwcyAqLworICAgICAgICAgICAgICAgICAgICAgICAgTVI2NywgIC8qIDYuNzAga2JwcyAqLworICAgICAgICAgICAgICAgICAgICAgICAgTVI3NCwgIC8qIDcuNDAga2JwcyAqLworICAgICAgICAgICAgICAgICAgICAgICAgTVI3OTUsIC8qIDcuOTUga2JwcyAqLworICAgICAgICAgICAgICAgICAgICAgICAgTVIxMDIsIC8qIDEwLjIga2JwcyAqLworICAgICAgICAgICAgICAgICAgICAgICAgTVIxMjIsIC8qIDEyLjIga2JwcyAqLworICAgICAgICAgICAgICAgICAgICAgICAgTVJEVFgsIC8qIERUWCAgICAgICAqL307Citjb25zdCBXb3JkMTYga091dHB1dEZvcm1hdFszXSA9IHtBTVJfVFhfV01GLCBBTVJfVFhfSUYyLCBBTVJfVFhfRVRTfTsKKworY2xhc3MgQ29kZWMgeworICAgcHVibGljOgorICAgIENvZGVjKCkgPSBkZWZhdWx0OworICAgIH5Db2RlYygpIHsgZGVJbml0RW5jb2RlcigpOyB9CisgICAgV29yZDE2IGluaXRFbmNvZGVyKGNvbnN0IHVpbnQ4X3QgKmRhdGEpOworICAgIHZvaWQgZGVJbml0RW5jb2RlcigpOworICAgIHZvaWQgZW5jb2RlRnJhbWVzKGNvbnN0IHVpbnQ4X3QgKmRhdGEsIHNpemVfdCBzaXplKTsKKworICAgcHJpdmF0ZToKKyAgICB2b2lkICptRW5jU3RhdGUgPSBudWxscHRyOworICAgIHZvaWQgKm1TaWRTdGF0ZSA9IG51bGxwdHI7Cit9OworCitXb3JkMTYgQ29kZWM6OmluaXRFbmNvZGVyKGNvbnN0IHVpbnQ4X3QgKmRhdGEpIHsKKyAgICByZXR1cm4gQU1SRW5jb2RlSW5pdCgmbUVuY1N0YXRlL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gICAgICAgIGluIG9uZSB0cmFjayAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIEZsYWcgKnBPdmVyZmxvdworKQoreworICAgIFdvcmQxNiBpOworICAgIFdvcmQxNiBqOworICAgIFdvcmQxNiBrOworICAgIFdvcmQzMiBzOworICAgIFdvcmQzMiB5MzJbTF9DT0RFXXt9OworICAgIFdvcmQzMiBtYXg7CisgICAgV29yZDMyIHRvdDsKKworCisgICAgLyogZmlyc3Qga2VlcCB0aGUgcmVzdWx0IG9uIDMyIGJpdHMgYW5kIGZpbmQgYWJzb2x1dGUgbWF4aW11bSAqLworICAgIHRvdCA9IExPRzJfT0ZfMzI7CisgICAgZm9yIChrID0gMDsgayA8IG5iX3RyYWNrOyBrKyspCisgICAgeworICAgICAgICBtYXggPSAwOworICAgICAgICBmb3IgKGkgPSBrOyBpIDwgTF9DT0RFOyBpICs9IHN0ZXApCisgICAgICAgIHsKKyAgICAgICAgICAgIHMgPSAwOworCisgICAgICAgICAgICBmb3IgKGogPSBpOyBqIDwgTF9DT0RFOyBqKyspCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcyA9IGFtcm5iX2Z4cF9tYWNfMTZfYnlfMTZiYigoV29yZDMyKXhbal0sIChXb3JkMzIpaFtqLWldLCBzKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcyA9IHMgPDwgMTsKKyAgICAgICAgICAgIHkzMltpXSA9IHM7CisgICAgICAgICAgICBzID0gTF9hYnMocyk7CisKKyAgICAgICAgICAgIGlmIChzID4gbWF4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG1heCA9IHM7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgdG90ID0gKHRvdCArIChtYXggPj4gMSkpOworICAgIH0KKworICAgIGogPSBzdWIobm9ybV9sKHRvdCksIHNmLCBwT3ZlcmZsb3cpOworCisgICAgZm9yIChpID0gMDsgaSA8IExfQ09ERTsgaSsrKQorICAgIHsKKy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0KSAvLyBmb3Igc3ViLQorICogICAgZ19mYWMoMCkgICAgICAgICAgKFExMikgLy8gZnJhbWUgMCBhbmQgMgorICogICAgZ19waXRjaCgxKSAgICAgICAgKFExNCkgLy8gZm9yIHN1Yi0KKyAqICAgIGdfZmFjKDIpICAgICAgICAgIChRMTIpIC8vIGZyYW1lIDEgYW5kIDMKKyAqCisgKi8KK3N0YXRpYyBjb25zdCBXb3JkMTYgdGFibGVfZ2Fpbl9NUjQ3NVtNUjQ3NV9WUV9TSVpFKjRdID0KK3sKKyAgICAvKmdfcGl0KDApLCBnX2ZhYygwKSwgICAgICBnX3BpdCgxKSwgZ19mYWMoMSkgKi8KKyAgICA4MTIsICAgICAgICAgIDEyOCwgICAgICAgICAgIDU0MiwgICAgICAxNDAsCisgICAgMjg3MywgICAgICAgICAxMTM1LCAgICAgICAgICAyMjY2LCAgICAgMzQwMiwKKyAgICAyMDY3LCAgICAgICAgICA1NjMsICAgICAgICAgMTI2NzcsICAgICAgNjQ3LAorICAgIDQxMzIsICAgICAgICAgMTc5OCwgICAgICAgICAgNTYwMSwgICAgIDUyODUsCisgICAgNzY4OSwgICAgICAgICAgMzc0LCAgICAgICAgICAzNzM1LCAgICAgIDQ0MSwKKyAgICAxMDkxMiwgICAgICAgICAyNjM4LCAgICAgICAgIDExODA3LCAgICAgMjQ5NCwKKyAgICAyMDQ5MCwgICAgICAgICAgNzk3LCAgICAgICAgICA1MjE4LCAgICAgIDY3NSwKKyAgICA2NzI0LCAgICAgICAgIDgzNTQsICAgICAgICAgIDUyODIsICAgICAxNjk2LAorICAgIDE0ODgsICAgICAgICAgIDQyOCwgICAgICAgICAgNTg4MiwgICAgICA0NTIsCisgICAgNTMzMiwgICAgICAgICA0MDcyLCAgICAgICAgICAzNTgzLCAgICAgMTI2OCwKKyAgICAyNDY5LCAgICAgICAgICA5MDEsICAgICAgICAgMTU4OTQsICAgICAxMDA1LAorICAgIDE0OTgyLCAgICAgICAgIDMyNzEsICAgICAgICAgMTAzMzEsICAgICA0ODU4LAorICAgIDM2MzUsICAgICAgICAgMjAyMSwgICAgICAgICAgMjU5NiwgICAgICA4MzUsCisgICAgMTIzNjAsICAgICAgICAgNDg5MiwgICAgICAgICAxMjIwNiwgICAgIDE3MDQsCisgICAgMTM0MzIsICAgICAgICAgMTYwNCwgICAgICAgICAgOTExOCwgICAgIDIzNDEsCisgICAgMzk2OCwgICAgICAgICAxNTM4LCAgICAgICAgICA1NDc5LCAgICAgOTkzNiwKKyAgICAzNzk1LCAgICAgICAgICA0MTcsICAgICAgICAgIDEzNTksICAgICAgNDE0LAorICAgIDM2NDAsICAgICAgICAgMTU2OSwgICAgICAgICAgNzk5NSwgICAgIDM1NDEsCisgICAgMTE0MDUsICAgICAgICAgIDY0NSwgICAgICAgICAgODU1MiwgICAgICA2MzUsCisgICAgNDA1NiwgICAgICAgICAxMzc3LCAgICAgICAgIDE2NjA4LCAgICAgNjEyNCwKKyAgICAxMTQyMCwgICAgICAgICAgNzAwLCAgICAgICAgICAyMDA3LCAgICAgIDYwNywKKyAgICAxMjQxNSwgICAgICAgICAxNTc4LCAgICAgICAgIDExMTE5LCAgICAgNDY1NCwKKyAgICAxMzY4MCwgICAgICAgICAxNzA4LCAgICAgICAgIDExOTkwLCAgICAgMTIyOSwKKyAgICA3OTk2LCAgICAgICAgIDcyOTcsICAgICAgICAgMTMyMzEsICAgICA1NzE1LAorICAgIDI0MjgsICAgICAgICAgMTE1OSwgICAgICAgICAgMjA3MywgICAgIDE5NDEsCisgICAgNjIxOCwgICAgICAgICA2MTIxLCAgICAgICAgICAzNTQ2LCAgICAgMTgwNCwKKyAgICA4OTI1LCAgICAgICAgIDE4MDIsICAgICAgICAgIDg2NzksICAgICAxNTgwLAorICAgIDEzOTM1LCAgICAgICAgIDM1NzYsICAgICAgICAgMTMzMTMsICAgICA2MjM3LAorICAgIDYxNDIsICAgICAgICAgMTEzMCwgICAgICAgICAgNTk5NCwgICAgIDE3MzQsCisgICAgMTQxNDEsICAgICAgICAgNDY2MiwgICAgICAgICAxMTI3MSwgICAgIDMzMjEsCisgICAgMTIyMjYsICAgICAgICAgMTU1MSwgICAgICAgICAxMzkzMSwgICAgIDMwMTUsCisgICAgNTA4MSwgICAgICAgIDEwNDY0LCAgICAgICAgICA5NDQ0LCAgICAgNjcwNiwKKyAgICAxNjg5LCAgICAgICAgICA2ODMsICAgICAgICAgIDE0MzYsICAgICAxMzA2LAorICAgIDcyMTIsICAgICAgICAgMzkzMywgICAgICAgICAgNDA4MiwgICAgIDI3MTMsCisgICAgNzc5MywgICAgICAgICAgNzA0LCAgICAgICAgIDE1MDcwLCAgICAgIDgwMiwKKyAgICA2Mjk5LCAgICAgICAgIDUyMTIsICAgICAgICAgIDQzMzcsICAgICA1MzU3LAorICAgIDY2NzYsICAgICAgICAgIDU0MSwgICAgICAgICAgNjA2MiwgICAgICA2MjYsCisgICAgMTM2NTEsICAgICAgICAgMzcwMCwgICAgICAgICAxMTQ5OCwgICAgIDI0MDgsCisgICAgMTYxNTYsICAgICAgICAgIDcxNiwgICAgICAgICAxMjE3NywgICAgICA3NTEsCisgICAgODA2NSwgICAgICAgIDExNDg5LCAgICAgICAgICA2MzE0LCAgICAgMjI1NiwKKyAgICA0NDY2LCAgICAgICAgICA0OTYsICAgICAgICAgIDcyOTMsICAgICAgNTIzLAorICAgIDEwMjEzLCAgICAgICAgIDM4MzMsICAgICAgICAgIDgzOTQsICAgICAzMDM3LAorICAgIDg0MDMsICAgICAgICAgIDk2NiwgICAgICAgICAxNDIyOCwgICAgIDE4ODAsCisgICAgODcwMywgICAgICAgICA1NDA5LCAgICAgICAgIDE2Mzk1LCAgICAgNDg2MywKKyAgICA3NDIwLCAgICAgICAgIDE5NzksICAgICAgICAgIDYwODksICAgICAxMjMwLAorICAgIDkzNzEsICAgICAgICAgNDM5OCwgICAgICAgICAxNDU1OCwgICAgIDMzNjMsCisgICAgMTM1NTksICAgICAgICAgMjg3MywgICAgICAgICAxMzE2MywgICAgIDE0NjUsCisgICAgNTUzNCwgICAgICAgICAxNjc4LCAgICAgICAgIDEzMTM4LCAgICAxNDc3MSwKKyAgICA3MzM4LCAgICAgICAgICA2MDAsICAgICAgICAgIDEzMTgsICAgICAgNTQ4LAorICAgIDQyNTIsICAgICAgICAgMzUzOSwgICAgICAgICAxMDA0NCwgICAgIDIzNjQsCisgICAgMTA1ODcsICAgICAgICAgIDYyMiwgICAgICAgICAxMzA4OCwgICAgICA2NjksCisgICAgMTQxMjYsICAgICAgICAgMzUyNiwgICAgICAgICAgNTAzOSwgICAgIDk3ODQsCisgICAgMTUzMzgsICAgICAgICAgIDYxOSwgICAgICAgICAgMzExNSwgICAgICA1OTAsCisgICAgMTY0NDIsICAgICAgICAgMzAxMywgICAgICAgICAxNTU0MiwgICAgIDQxNjgsCisgICAgMTU1MzcsICAgICAgICAgMTYxMSwgICAgICAgICAxNTQwNSwgICAgIDEyMjgsCisgICAgMTYwMjMsICAgICAgICAgOTI5OSwgICAgICAgICAgNzUzNCwgICAgIDQ5NzYsCisgICAgMTk5MCwgICAgICAgICAxMjEzLCAgICAgICAgIDExNDQ3LCAgICAgMTE1NywKKyAgICAxMjUxMiwgICAgICAgICA1NTE5LCAgICAgICAgICA5NDc1LCAgICAgMjY0NCwKKyAgICA3NzE2LCAgICAgICAgIDIwMzQsICAgICAgICAgMTMyODAsICAgICAyMjM5LAorICAgIDE2MDExLCAgICAgICAgIDUwOTMsICAgICAgICAgIDgwNjYsICAgICA2NzYxLAorICAgIDEwMDgzLCAgICAgICAgIDE0MTMsICAgICAgICAgIDUwMDIsICAgICAyMzQ3LAorICAgIDEyNTIzLCAgICAgICAgIDU5NzUsICAgICAgICAgMTUxMjYsICAgICAyODk5LAorICAgIDE4MjY0LCAgICAgICAgIDIyODksICAgICAgICAgMTU4MjcsICAgICAyNTI3LAorICAgIDE2MjY1LCAgICAgICAgMTAyNTQsICAgICAgICAgMTQ2NTEsICAgIDExMzE5LAorICAgIDE3OTcsICAgICAgICAgIDMzNywgICAgICAgICAgMzExNSwgICAgICAzOTcsCisgICAgMzUxMCwgICAgICAgICAyOTI4LCAgICAgICAgICA0NTkyLCAgICAgMjY3MCwKKyAgICA3NTE5LCAgICAgICAgICA2MjgsICAgICAgICAgMTE0MTUsICAgICAgNjU2LAorICAgIDU5NDYsICAgICAgICAgMjQzNSwgICAgICAgICAgNjU0NCwgICAgIDczNjcsCisgICAgODIzOCwgICAgICAgICAgODI5LCAgICAgICAgICA0MDAwLCAgICAgIDg2MywKKyAgICAxMDAzMiwgICAgICAgICAyNDkyLCAgICAgICAgIDE2MDU3LCAgICAgMzU1MSwKKyAgICAxODIwNCwgICAgICAgICAxMDU0LCAgICAgICAgICA2MTAzLCAgICAgMTQ1NCwKKyAgICA1ODg0LCAgICAgICAgIDc5MDAsICAgICAgICAgMTg3NTIsICAgICAzNDY4LAorICAgIDE4NjQsICAgICAgICAgIDU0NCwgICAgICAgICAgOTE5OCwgICAgICA2ODMsCisgICAgMTE2MjMsICAgICAgICAgNDE2MCwgICAgICAgICAgNDU5NCwgICAgIDE2NDQsCisgICAgMzE1OCwgICAgICAgICAxMTU3LCAgICAgICAgIDE1OTUzLCAgICAgMjU2MCwKKyAgICAxMjM0OSwgICAgICAgICAzNzMzLCAgICAgICAgIDE3NDIwLCAgICAgNTI2MCwKKyAgICA2MTA2LCAgICAgICAgIDIwMDQsICAgICAgICAgIDI5MTcsICAgICAxNzQyLAorICAgIDE2NDY3LCAgICAgICAgIDUyNTcsICAgICAgICAgMTY3ODcsICAgICAxNjgwLAorICAgIDE3MjA1LCAgICAgICAgIDE3NTksICAgICAgICAgIDQ3NzMsICAgICAzMjMxLAorICAgIDczODYsICAgICAgICAgNjAzNSwgICAgICAgICAxNDM0MiwgICAgMTAwMTIsCisgICAgNDAzNSwgICAgICAgICAgNDQyLCAgICAgICAgICA0MTk0LCAgICAgIDQ1OCwKKyAgICA5MjE0LCAgICAgICAgIDIyNDIsICAgICAgICAgIDc0MjcsICAgICA0MjE3LAorICAgIDEyODYwLCAgICAgICAgICA4MDEsICAgICAgICAgMTExODYsICAgICAgODI1LAorICAgIDEyNjQ4LCAgICAgICAgIDIwODQsICAgICAgICAgMTI5NTYsICAgICA2NTU0LAorICAgIDk1MDUsICAgICAgICAgIDk5NiwgICAgICAgICAgNjYyOSwgICAgICA5ODUsCisgICAgMTA1MzcsICAgICAgICAgMjUwMiwgICAgICAgICAxNTI4OSwgICAgIDUwMDYsCisgICAgMTI2MDIsICAgICAgICAgMjA1NSwgICAgICAgICAxNTQ4NCwgICAgIDE2NTMsCisgICAgMTYxOTQsICAgICAgICAgNjkyMSwgICAgICAgICAxNDIzMSwgICAgIDU3OTAsCisgICAgMjYyNiwgICAgICAgICAgODI4LCAgICAgICAgICA1NjE1LCAgICAgMTY4NiwKKyAgICAxMzY2MywgICAgICAgICA1Nzc4LCAgICAgICAgICAzNjY4LCAgICAgMTU1NCwKKyAgICAxMTMxMywgICAgICAgICAyNjMzLCAgICAgICAgICA5NzcwLCAgICAgMTQ1OSwKKyAgICAxNDAwMywgICAgICAgICA0NzMzLCAgICAgICAgIDE1ODk3LCAgICAgNjI5MSwKKyAgICA2Mjc4LCAgICAgICAgIDE4NzAsICAgICAgICAgIDc5MTAsICAgICAyMjg1LAorICAgIDE2OTc4LCAgICAgICAgIDQ1NzEsICAgICAgICAgMTY1NzYsICAgICAzODQ5LAorICAgIDE1MjQ4LCAgICAgICAgIDIzMTEsICAgICAgICAgMTYwMjMsICAgICAzMjQ0LAorICAgIDE0NDU5LCAgICAgICAgMTc4MDgsICAgICAgICAgMTE4NDcsICAgICAyNzYzLAorICAgIDE5ODEsICAgICAgICAgMTQwNywgICAgICAgICAgMTQwMCwgICAgICA4NzYsCisgICAgNDMzNSwgICAgICAgICAzNTQ3LCAgICAgICAgICA0MzkxLCAgICAgNDIxMCwKKyAgICA1NDA1LCAgICAgICAgICA2ODAsICAgICAgICAgMTc0NjEsICAgICAgNzgxLAorICAgIDY1MDEsICAgICAgICAgNTExOCwgICAgICAgICAgODA5MSwgICAgIDc2NzcsCisgICAgNzM1NSwgICAgICAgICAgNzk0LCAgICAgICAgICA4MzMzLCAgICAgMTE4MiwKKyAgICAxNTA0MSwgICAgICAgICAzMTYwLCAgICAgICAgIDE0OTI4LCAgICAgMzAzOSwKKyAgICAyMDQyMSwgICAgICAgICAgODgwLCAgICAgICAgIDE0NTQ1LCAgICAgIDg1MiwKKyAgICAxMjMzNywgICAgICAgIDE0NzA4LCAgICAgICAgICA2OTA0LCAgICAgMTkyMCwKKyAgICA0MjI1LCAgICAgICAgICA5MzMsICAgICAgICAgIDgyMTgsICAgICAxMDg3LAorICAgIDEwNjU5LCAgICAgICAgIDQwODQsICAgICAgICAgMTAwODIsICAgICA0NTMzLAorICAgIDI3MzUsICAgICAgICAgIDg0MCwgICAgICAgICAyMDY1NywgICAgIDEwODEsCisgICAgMTY3MTEsICAgICAgICAgNTk2NiwgICAgICAgICAxNTg3MywgICAgIDQ1NzgsCisgICAgMTA4NzEsICAgICAgICAgMjU3NCwgICAgICAgICAgMzc3MywgICAgIDExNjYsCisgICAgMTQ1MTksICAgICAgICAgNDA0NCwgICAgICAgICAyMDY5OSwgICAgIDI2MjcsCisgICAgMTUyMTksICAgICAgICAgMjczNCwgICAgICAgICAxNTI3NCwgICAgIDIxODYsCisgICAgNjI1NywgICAgICAgICAzMjI2LCAgICAgICAgIDEzMTI1LCAgICAxOTQ4MCwKKyAgICA3MTk2LCAgICAgICAgICA5MzAsICAgICAgICAgIDI0NjIsICAgICAxNjE4LAorICAgIDQ1MTUsICAgICAgICAgMzA5MiwgICAgICAgICAxMzg1MiwgICAgIDQyNzcsCisgICAgMTA0NjAsICAgICAgICAgIDgzMywgICAgICAgICAxNzMzOSwgICAgICA4MTAsCisgICAgMTY4OTEsICAgICAgICAgMjI4OSwgICAgICAgICAxNTU0NiwgICAgIDgyMTcsCisgICAgMTM2MDMsICAgICAgICAgMTY4NCwgICAgICAgICAgMzE5NywgICAgIDE4MzQsCisgICAgMTU5NDgsICAgICAgICAgMjgyMCwgICAgICAgICAxNTgxMiwgICAgIDUzMjcsCisgICAgMTcwMDYsICAgICAgICAgMjQzOCwgICAgICAgICAxNjc4OCwgICAgIDEzMjYsCisgICAgMTU2NzEsICAgICAgICAgODE1NiwgICAgICAgICAxMTcyNiwgICAgIDg1NTYsCisgICAgMzc2MiwgICAgICAgICAyMDUzLCAgICAgICAgICA5NTYzLCAgICAgMTMxNywKKyAgICAxMzU2MSwgICAgICAgICA2NzkwLCAgICAgICAgIDEyMjI3LCAgICAgMTkzNiwKKyAgICA4MTgwLCAgICAgICAgIDM1NTAsICAgICAgICAgMTMyODcsICAgICAxNzc4LAorICAgIDE2Mjk5LCAgICAgICAgIDY1OTksICAgICAgICAgMTYyOTEsICAgICA3NzU4LAorICAgIDg1MjEsICAgICAgICAgMjU1MSwgICAgICAgICAgNzIyNSwgICAgIDI2NDUsCisgICAgMTgyNjksICAgICAgICAgNzQ4OSwgICAgICAgICAxNjg4NSwgICAgIDIyNDgsCisgICAgMTc4ODIsICAgICAgICAgMjg4NCwgICAgICAgICAxNzI2NSwgICAgIDMzMjgsCisgICAgOTQxNywgICAgICAgIDIwMTYyLCAgICAgICAgIDExMDQyLCAgICAgODMyMCwKKyAgICAxMjg2LCAgICAgICAgICA2MjAsICAgICAgICAgIDE0MzEsICAgICAgNTgzLAorICAgIDU5OTMsICAgICAgICAgMjI4OSwgICAgICAgICAgMzk3OCwgICAgIDM2MjYsCisgICAgNTE0NCwgICAgICAgICAgNzUyLCAgICAgICAgIDEzNDA5LCAgICAgIDgzMCwKKyAgICA1NTUzLCAgICAgICAgIDI4NjAsICAgICAgICAgMTE3NjQsICAgICA1OTA4LAorICAgIDEwNzM3LCAgICAgICAgICA1NjAsICAgICAgICAgIDU0NDYsICAgICAgNTY0LAorICAgIDEzMzIxLCAgICAgICAgIDMwMDgsICAgICAgICAgMTE5NDYsICAgICAzNjgzLAorICAgIDE5ODg3LCAgICAgICAgICA3OTgsICAgICAgICAgIDk4MjUsICAgICAgNzI4LAorICAgIDEzNjYzLCAgICAgICAgIDg3NDgsICAgICAgICAgIDczOTEsICAgICAzMDUzLAorICAgIDI1MTUsICAgICAgICAgIDc3OCwgICAgICAgICAgNjA1MCwgICAgICA4MzMsCisgICAgNjQ2OSwgICAgICAgICA1MDc0LCAgICAgICAgICA4MzA1LCAgICAgMjQ2MywKKyAgICA2MTQxLCAgICAgICAgIDE4NjUsICAgICAgICAgMTUzMDgsICAgICAxMjYyLAorICAgIDE0NDA4LCAgICAgICAgIDQ1NDcsICAgICAgICAgMTM2NjMsICAgICA0NTE1LAorICAgIDMxMzcsICAgICAgICAgMjk4MywgICAgICAgICAgMjQ3OSwgICAgIDEyNTksCisgICAgMTUwODgsICAgICAgICAgNDY0NywgICAgICAgICAxNTM4MiwgICAgIDI2MDcsCisgICAgMTQ0OTIsICAgICAgICAgMjM5MiwgICAgICAgICAxMjQ2MiwgICAgIDI1MzcsCisgICAgNzUzOSwgICAgICAgICAyOTQ5LCAgICAgICAgIDEyOTA5LCAgICAxMjA2MCwKKyAgICA1NDY4LCAgICAgICAgICA2ODQsICAgICAgICAgIDMxNDEsICAgICAgNzIyLAorICAgIDUwODEsICAgICAgICAgMTI3NCwgICAgICAgICAxMjczMiwgICAgIDQyMDAsCisgICAgMTUzMDIsICAgICAgICAgIDY4MSwgICAgICAgICAgNzgxOSwgICAgICA1OTIsCisgICAgNjUzNCwgICAgICAgICAyMDIxLCAgICAgICAgIDE2NDc4LCAgICAgODczNywKKyAgICAxMzM2NCwgICAgICAgICAgODgyLCAgICAgICAgICA1Mzk3LCAgICAgIDg5OSwKKyAgICAxNDY1NiwgICAgICAgICAyMTc4LCAgICAgICAgIDE0NzQxLCAgICAgNDIyNywKKyAgICAxNDI3MCwgICAgICAgICAxMjk4LCAgICAgICAgIDEzOTI5LCAgICAgMjAyOSwKKyAgICAxNTQ3NywgICAgICAgICA3NDgyLCAgICAgICAgIDE1ODE1LCAgICAgNDU3MiwKKyAgICAyNTIxLCAgICAgICAgIDIwMTMsICAgICAgICAgIDUwNjIsICAgICAxODA0LAorICAgIDUxNTksICAgICAgICAgNjU4MiwgICAgICAgICAgNzEzMCwgICAgIDM1OTcsCisgICAgMTA5MjAsICAgICAgICAgMTYxMSwgICAgICAgICAxMTcyOSwgICAgIDE3MDgsCisgICAgMTY5MDMsICAgICAgICAgMzQ1NSwgICAgICAgICAxNjI2OCwgICAgIDY2NDAsCisgICAgOTMwNiwgICAgICAgICAxMDA3LCAgICAgICAgICA5MzY5LCAgICAgMjEwNiwKKyAgICAxOTE4MiwgICAgICAgICA1MDM3LCAgICAgICAgIDEyNDQxLCAgICAgNDI2OSwKKyAgICAxNTkxOSwgICAgICAgICAxMzMyLCAgICAgICAgIDE1MzU3LCAgICAgMzUxMiwKKyAgICAxMTg5OCwgICAgICAgIDE0MTQxLCAgICAgICAgIDE2MTAxLCAgICAgNjg1NCwKKyAgICAyMDEwLCAgICAgICAgICA3MzcsICAgICAgICAgIDM3NzksICAgICAgODYxLAorICAgIDExNDU0LCAgICAgICAgIDI4ODAsICAgICAgICAgIDM1NjQsICAgICAzNTQwLAorICAgIDkwNTcsICAgICAgICAgMTI0MSwgICAgICAgICAxMjM5MSwgICAgICA4OTYsCisgICAgODU0NiwgICAgICAgICA0NjI5LCAgICAgICAgIDExNTYxLCAgICAgNTc3NiwKKyAgICA4MTI5LCAgICAgICAgICA1ODksICAgICAgICAgIDgyMTgsICAgICAgNTg4LAorICAgIDE4NzI4LCAgICAgICAgIDM3NTUsICAgICAgICAgMTI5NzMsICAgICAzMTQ5LAorICAgIDE1NzI5LCAgICAgICAgICA3NTgsICAgICAgICAgMTY2MzQsICAgICAgNzU0LAorICAgIDE1MjIyLCAgICAgICAgMTExMzgsICAgICAgICAgMTU4NzEsICAgICAyMjA4LAorICAgIDQ2NzMsICAgICAgICAgIDYxMCwgICAgICAgICAxMDIxOCwgICAgICA2NzgsCisgICAgMTUyNTcsICAgICAgICAgNDE0NiwgICAgICAgICAgNTcyOSwgICAgIDMzMjcsCisgICAgODM3NywgICAgICAgICAxNjcwLCAgICAgICAgIDE5ODYyLCAgICAgMjMyMSwKKyAgICAxNTQ1MCwgICAgICAgICA1NTExLCAgICAgICAgIDE0MDU0LCAgICAgNTQ4MSwKKyAgICA1NzI4LCAgICAgICAgIDI4ODgsICAgICAgICAgIDc1ODAsICAgICAxMzQ2LAorICAgIDE0Mzg0LCAgICAgICAgIDUzMjUsICAgICAgICAgMTYyMzYsICAgICAzOTUwLAorICAgIDE1MTE4LCAgICAgICAgIDM3NDQsICAgICAgICAgMTUzMDYsICAgICAxNDM1LAorICAgIDE0NTk3LCAgICAgICAgIDQwNzAsICAgICAgICAgMTIzMDEsICAgIDE1Njk2LAorICAgIDc2MTcsICAgICAgICAgMTY5OSwgICAgICAgICAgMjE3MCwgICAgICA4ODQsCisgICAgNDQ1OSwgICAgICAgICA0NTY3LCAgICAgICAgIDE4MDk0LCAgICAgMzMwNiwKKyAgICAxMjc0MiwgICAgICAgICAgODE1LCAgICAgICAgIDE0OTI2LCAgICAgIDkwNywKKyAgICAxNTAxNiwgICAgICAgICA0MjgxLCAgICAgICAgIDE1NTE4LCAgICAgODM2OCwKKyAgICAxNzk5NCwgICAgICAgICAxMDg3LCAgICAgICAgICAyMzU4LCAgICAgIDg2NSwKKyAgICAxNjI4MSwgICAgICAgICAzNzg3LCAgICAgICAgIDE1Njc5LCAgICAgNDU5NiwKKyAgICAxNjM1NiwgICAgICAgICAxNTM0LCAgICAgICAgIDE2NTg0LCAgICAgMjIxMCwKKyAgICAxNjgzMywgICAgICAgICA5Njk3LCAgICAgICAgIDE1OTI5LCAgICAgNDUxMywKKyAgICAzMjc3LCAgICAgICAgIDEwODUsICAgICAgICAgIDk2NDMsICAgICAyMTg3LAorICAgIDExOTczLCAgICAgICAgIDYwNjgsICAgICAgICAgIDkxOTksICAgICA0NDYyLAorICAgIDg5NTUsICAgICAgICAgMTYyOSwgICAgICAgICAxMDI4OSwgICAgIDMwNjIsCisgICAgMTY0ODEsICAgICAgICAgNTE1NSwgICAgICAgICAxNTQ2NiwgICAgIDcwNjYsCisgICAgMTM2NzgsICAgICAgICAgMjU0MywgICAgICAgICAgNTI3MywgICAgIDIyNzcsCisgICAgMTY3NDYsICAgICAgICAgNjIxMywgICAgICAgICAxNjY1NSwgICAgIDM0MDgsCisgICAgMjAzMDQsICAgICAgICAgMzM2MywgICAgICAgICAxODY4OCwgICAgIDE5ODUsCisgICAgMTQxNzIsICAgICAgICAxMjg2NywgICAgICAgICAxNTE1NCwgICAgMTU3MDMsCisgICAgNDQ3MywgICAgICAgICAxMDIwLCAgICAgICAgICAxNjgxLCAgICAgIDg4NiwKKyAgICA0MzExLCAgICAgICAgIDQzMDEsICAgICAgICAgIDg5NTIsICAgICAzNjU3LAorICAgIDU4OTMsICAgICAgICAgMTE0NywgICAgICAgICAxMTY0NywgICAgIDE0NTIsCisgICAgMTU4ODYsICAgICAgICAgMjIyNywgICAgICAgICAgNDU4MiwgICAgIDY2NDQsCisgICAgNjkyOSwgICAgICAgICAxMjA1LCAgICAgICAgICA2MjIwLCAgICAgIDc5OSwKKyAgICAxMjQxNSwgICAgICAgICAzNDA5LCAgICAgICAgIDE1OTY4LCAgICAgMzg3NywKKyAgICAxOTg1OSwgICAgICAgICAyMTA5LCAgICAgICAgICA5Njg5LCAgICAgMjE0MSwKKyAgICAxNDc0MiwgICAgICAgICA4ODMwLCAgICAgICAgIDE0NDgwLCAgICAgMjU5OSwKKyAgICAxODE3LCAgICAgICAgIDEyMzgsICAgICAgICAgIDc3NzEsICAgICAgODEzLAorICAgIDE5MDc5LCAgICAgICAgIDQ0MTAsICAgICAgICAgIDU1NTQsICAgICAyMDY0LAorICAgIDM2ODcsICAgICAgICAgMjg0NCwgICAgICAgICAxNzQzNSwgICAgIDIyNTYsCisgICAgMTY2OTcsICAgICAgICAgNDQ4NiwgICAgICAgICAxNjE5OSwgICAgIDUzODgsCisgICAgODAyOCwgICAgICAgICAyNzYzLCAgICAgICAgICAzNDA1LCAgICAgMjExOSwKKyAgICAxNzQyNiwgICAgICAgICA1NDc3LCAgICAgICAgIDEzNjk4LCAgICAgMjc4NiwKKyAgICAxOTg3OSwgICAgICAgICAyNzIwLCAgICAgICAgICA5MDk4LCAgICAgMzg4MCwKKyAgICAxODE3MiwgICAgICAgICA0ODMzLCAgICAgICAgIDE3MzM2LCAgICAxMjIwNywKKyAgICA1MTE2LCAgICAgICAgICA5OTYsICAgICAgICAgIDQ5MzUsICAgICAgOTg4LAorICAgIDk4ODgsICAgICAgICAgMzA4MSwgICAgICAgICAgNjAxNCwgICAgIDUzNzEsCisgICAgMTU4ODEsICAgICAgICAgMTY2NywgICAgICAgICAgODQwNSwgICAgIDExODMsCisgICAgMTUwODcsICAgICAgICAgMjM2NiwgICAgICAgICAxOTc3NywgICAgIDcwMDIsCisgICAgMTE5NjMsICAgICAgICAgMTU2MiwgICAgICAgICAgNzI3OSwgICAgIDExMjgsCisgICAgMTY4NTksICAgICAgICAgMTUzMiwgICAgICAgICAxNTc2MiwgICAgIDUzODEsCisgICAgMTQ3MDgsICAgICAgICAgMjA2NSwgICAgICAgICAyMDEwNSwgICAgIDIxNTUsCisgICAgMTcxNTgsICAgICAgICAgODI0NSwgICAgICAgICAxNzkxMSwgICAgIDYzMTgsCisgICAgNTQ2NywgICAgICAgICAxNTA0LCAgICAgICAgICA0MTAwLCAgICAgMjU3NCwKKyAgICAxNzQyMSwgICAgICAgICA2ODEwLCAgICAgICAgICA1NjczLCAgICAgMjg4OCwKKyAgICAxNjYzNiwgICAgICAgICAzMzgyLCAgICAgICAgICA4OTc1LCAgICAgMTgzMSwKKyAgICAyMDE1OSwgICAgICAgICA0NzM3LCAgICAgICAgIDE5NTUwLCAgICAgNzI5NCwKKyAgICA2NjU4LCAgICAgICAgIDI3ODEsICAgICAgICAgMTE0NzIsICAgICAzMzIxLAorICAgIDE5Mzk3LCAgICAgICAgIDUwNTQsICAgICAgICAgMTg4NzgsICAgICA0NzIyLAorICAgIDE2NDM5LCAgICAgICAgIDIzNzMsICAgICAgICAgMjA0MzAsICAgICA0Mzg2LAorICAgIDExMzUzLCAgICAgICAgMjY1MjYsICAgICAgICAgMTE1OTMsICAgICAzMDY4LAorICAgIDI4NjYsICAgICAgICAgMTU2NiwgICAgICAgICAgNTEwOCwgICAgIDEwNzAsCisgICAgOTYxNCwgICAgICAgICA0OTE1LCAgICAgICAgICA0OTM5LCAgICAgMzUzNiwKKyAgICA3NTQxLCAgICAgICAgICA4NzgsICAgICAgICAgMjA3MTcsICAgICAgODUxLAorICAgIDY5MzgsICAgICAgICAgNDM5NSwgICAgICAgICAxNjc5OSwgICAgIDc3MzMsCisgICAgMTAxMzcsICAgICAgICAgMTAxOSwgICAgICAgICAgOTg0NSwgICAgICA5NjQsCisgICAgMTU0OTQsICAgICAgICAgMzk1NSwgICAgICAgICAxNTQ1OSwgICAgIDM0MzAsCisgICAgMTg4NjMsICAgICAgICAgIDk4MiwgICAgICAgICAyMDEyMCwgICAgICA5NjMsCisgICAgMTY4NzYsICAgICAgICAxMjg4NywgICAgICAgICAxNDMzNCwgICAgIDQyMDAsCisgICAgNjU5OSwgICAgICAgICAxMjIwLCAgICAgICAgICA5MjIyLCAgICAgIDgxNCwKKyAgICAxNjk0MiwgICAgICAgICA1MTM0LCAgICAgICAgICA1NjYxLCAgICAgNDg5OCwKKyAgICA1NDg4LCAgICAgICAgIDE3OTgsICAgICAgICAgMjAyNTgsICAgICAzOTYyLAorICAgIDE3MDA1LCAgICAgICAgIDYxNzgsICAgICAgICAgMTc5MjksICAgICA1OTI5LAorICAgIDkzNjUsICAgICAgICAgMzQyMCwgICAgICAgICAgNzQ3NCwgICAgIDE5NzEsCisgICAgMTk1MzcsICAgICAgICAgNTE3NywgICAgICAgICAxOTAwMywgICAgIDMwMDYsCisgICAgMTY0NTQsICAgICAgICAgMzc4OCwgICAgICAgICAxNjA3MCwgICAgIDIzNjcsCisgICAgODY2NCwgICAgICAgICAyNzQzLCAgICAgICAgICA5NDQ1LCAgICAyNjM1OCwKKyAgICAxMDg1NiwgICAgICAgICAxMjg3LCAgICAgICAgICAzNTU1LCAgICAgMTAwOSwKKyAgICA1NjA2LCAgICAgICAgIDM2MjIsICAgICAgICAgMTk0NTMsICAgICA1NTEyLAorICAgIDEyNDUzLCAgICAgICAgICA3OTcsICAgICAgICAgMjA2MzQsICAgICAgOTExLAorICAgIDE1NDI3LCAgICAgICAgIDMwNjYsICAgICAgICAgMTcwMzcsICAgIDEwMjc1LAorICAgIDE4ODgzLCAgICAgICAgIDI2MzMsICAgICAgICAgIDM5MTMsICAgICAxMjY4LAorICAgIDE5NTE5LCAgICAgICAgIDMzNzEsICAgICAgICAgMTgwNTIsICAgICA1MjMwLAorICAgIDE5MjkxLCAgICAgICAgIDE2NzgsICAgICAgICAgMTk1MDgsICAgICAzMTcyLAorICAgIDE4MDcyLCAgICAgICAgMTA3NTQsICAgICAgICAgMTY2MjUsICAgICA2ODQ1LAorICAgIDMxMzQsICAgICAgICAgMjI5OCwgICAgICAgICAxMDg2OSwgICAgIDI0MzcsCisgICAgMTU1ODAsICAgICAgICAgNjkxMywgICAgICAgICAxMjU5NywgICAgIDMzODEsCisgICAgMTExMTYsICAgICAgICAgMzI5NywgICAgICAgICAxNjc2MiwgICAgIDI0MjQsCisgICAgMTg4NTMsICAgICAgICAgNjcxNSwgICAgICAgICAxNzE3MSwgICAgIDk4ODcsCisgICAgMTI3NDMsICAgICAgICAgMjYwNSwgICAgICAgICAgODkzNywgICAgIDMxNDAsCisgICAgMTkwMzMsICAgICAgICAgNzc2NCwgICAgICAgICAxODM0NywgICAgIDM4ODAsCisgICAgMjA0NzUsICAgICAgICAgMzY4MiwgICAgICAgICAxOTYwMiwgICAgIDMzODAsCisgICAgMTMwNDQsICAgICAgICAxOTM3MywgICAgICAgICAxMDUyNiwgICAgMjMxMjQKK307CisKKy8qCistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tL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ZDE2IGdjb2RlMCwgICAgICAgICAvLyBpICA6IHByZWRpY3RlZCBDQiBnYWluLCAgICAgUSgxNCAtIGV4cF9nY29kZTApCisgICAgV29yZDE2IGV4cF9nY29kZTAsICAgICAvLyBpICA6IGV4cG9uZW50IG9mIHByZWRpY3RlZCBDQiBnYWluLCAgICAgICAgUTAKKyAgICBXb3JkMTYgKmdhaW5fcGl0LCAgICAgIC8vIG8gIDogUGl0Y2ggZ2FpbiwgICAgICAgICAgICAgICAgICAgICAgICAgICBRMTQKKyAgICBXb3JkMTYgKmdhaW5fY29kICAgICAgIC8vIG8gIDogQ29kZSBnYWluLCAgICAgICAgICAgICAgICAgICAgICAgICAgICBRMQorKQoreworCisgICAgV29yZDE2IGdfY29kZSwgZXhwLCBmcmFjLCB0bXA7CisgICAgV29yZDMyIExfdG1wOworCisgICAgV29yZDE2IHF1YV9lbmVyX01SMTIyOyAvLyBvICA6IHF1YW50aXplZCBlbmVyZ3kgZXJyb3IsIE1SMTIyIHZlcnNpb24gUTEwCisgICAgV29yZDE2IHF1YV9lbmVyOyAgICAgICAvLyBvICA6IHF1YW50aXplZCBlbmVyZ3kgZXJyb3IsICAgICAgICAgICAgICAgUTEwCisKKyAgICAvLyBSZWFkIHRoZSBxdWFudGl6ZWQgZ2FpbnMKKyAgICAqZ2Fpbl9waXQgPSAqcCsrOworICAgIGdfY29kZSA9ICpwKys7CisKKyAgICAvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSoKKyAgICAgKiAgY2FsY3VsYXRlIGZpbmFsIGZpeGVkIGNvZGVib29rIGdhaW46ICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgfn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgIGdjID0gZ2MwICogZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCisgICAgTF90bXAgPSBMX211bHQoZ19jb2RlLCBnY29kZTApOworICAgIExfdG1wID0gTF9zaHIoTF90bXAsIHN1YigxMCwgZXhwX2djb2RlMCkpOworICAgICpnYWluX2NvZCA9IGV4dHJhY3RfaChMX3RtcCk7CisKKyAgICAvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSoKKyAgICAgKiAgY2FsY3VsYXRlIHByZWRpY3RvciB1cGRhdGUgdmFsdWVzIGFuZCB1cGRhdGUgZ2FpbiBwcmVkaWN0b3I6ICAgICoKKyAgICAgKiAgfn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+ICAgICoKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgIHF1YV9lbmVyICAgICAgID0gbG9nMihnKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgIHF1YV9lbmVyX01SMTIyID0gMjAqbG9nMTAoZykgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCisgICAgTG9nMiAoTF9kZXBv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gKi8KKyAgICBXb3JkMTYgKmdhaW5fY29kLCAgICAgIC8qIG8gIDogQ29kZSBnYWluLCAgICAgICAgICAgICAgICAgICAgICAgICAgICBRMSAgKi8KKyAgICBGbGFnICAgKnBPdmVyZmxvdyAgICAgIC8qIG8gIDogb3ZlcmZsb3cgaW5kaWNhdG9yICAgICAgICAgICAgICAgICAgICAgICAgKi8KKykKK3sKKyAgICBXb3JkMTYgZ19jb2RlOworICAgIFdvcmQxNiBleHA7CisgICAgV29yZDE2IGZyYWM7CisgICAgV29yZDE2IHRtcDsKKyAgICBXb3JkMzIgTF90bXA7CisKKyAgICBXb3JkMTYgcXVhX2VuZXJfTVIxMjI7IC8qIG8gIDogcXVhbnRpemVkIGVuZXJneSBlcnJvciwgTVIxMjIgdmVyc2lvbiBRMTAgKi8KKyAgICBXb3JkMTYgcXVhX2VuZXI7ICAgICAgIC8qIG8gIDogcXVhbnRpemVkIGVuZXJneSBlcnJvciwgICAgICAgICAgICAgICBRMTAgKi8KKworCisgICAgLyogUmVhZCB0aGUgcXVhbnRpemVkIGdhaW5zICovCisgICAgKmdhaW5fcGl0ID0gKnArKzsKKyAgICBnX2NvZGUgPSAqcCsrOworCisgICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCisgICAgICogIGNhbGN1bGF0ZSBmaW5hbCBmaXhlZCBjb2RlYm9vayBnYWluOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogIH5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogICBnYyA9IGdjMCAqIGcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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zogZ2FpbiBwcmVkaWN0b3Igc3RhdGUgc3RydWN0ICAgICAgICAgICAgKi8KKyAgICBXb3JkMTYgZXhwX2djb2RlMCwgICAgIC8qIGkgIDogcHJlZGljdGVkIENCIGdhaW4gKGV4cG9uZW50IE1TVyksICBRMCAgKi8KKyAgICBXb3JkMTYgZnJhY19nY29kZTAsICAgIC8qIGkgIDogcHJlZGljdGVkIENCIGdhaW4gKGV4cG9uZW50IExTVyksICBRMTUgKi8KKyAgICBXb3JkMTYgY29kX2dhaW5fZXhwLCAgIC8qIGkgIDogb3B0aW11bSBjb2RlYm9vayBnYWluIChleHBvbmVudCksICBRMCAgKi8KKyAgICBXb3JkMTYgY29kX2dhaW5fZnJhYywgIC8qIGkgIDogb3B0aW11bSBjb2RlYm9vayBnYWluIChmcmFjdGlvbiksICBRMTUgKi8KKyAgICBGbGFnICAgKnBPdmVyZmxvdyAgICAgIC8qIG8gIDogb3ZlcmZsb3cgaW5kaWNhdG9yICAgICAgICAgICAgICAgICAgICAgKi8KKykKK3sKKyAgICBXb3JkMTYgdG1wOworICAgIFdvcmQxNiBleHA7CisgICAgV29yZDE2IGZyYWM7CisgICAgV29yZDE2IHF1YV9lbmVyOworICAgIFdvcmQxNiBxdWFfZW5lcl9NUjEyMjsKKyAgICBXb3JkMzIgTF90bXA7CisKKyAgICAvKiBjYWxjdWxhdGUgcHJlZGljdGlvbiBlcnJvciBmYWN0b3IgKGdpdmVuIG9wdGltdW0gQ0IgZ2FpbiBnY3UpOgorICAgICAqCisgICAgICogICBwcmVkRXJyRmFjdCA9IGdjdSAvIGdjb2RlMAorICAgICAqICAgKGxpbWl0IHRvIE1JTl9QUkVEX0VSUl9GQUNUIDw9IHByZWRFcnJGYWN0IDw9IE1BWF9QUkVEX0VSUl9GQUNUCisgICAgICogICAgLT4gbGltaXQgcXVhX2VuZXIqKQorICAgICAqCisgICAgICogY2FsY3VsYXRlIHByZWRpY3Rpb24gZXJyb3IgKGxvZyk6CisgICAgICoKKyAgICAgKiAgIHF1YV9lbmVyX01SMTIyID0gbG9nMihwcmVkRXJyRmFjdCkKKyAgICAgKiAgIHF1YV9lbmVyICAgICAgID0gMjAqbG9nMTAocHJlZEVyckZhY3QpCisgICAgICoKKyAgICAgKi8KKworICAgIGlmIChjb2RfZ2Fpbl9mcmFjIDw9IDApCisgICAgeworICAgICAgICAvKiBpZiBnY3UgPD0gMCAtPiBwcmVkRXJyRmFjdCA9IDAgPCBNSU5fUFJFRF9FUlJfRkFDVCAqLworICAgICAgICAvKiAtPiBzZXQgcXVhX2VuZXIoX01SMTIyKSBkaXJlY3RseSAgICAgICAgICAgICAgICAgICAqLworICAgICAgICBxdWFfZW5lciA9IE1JTl9RVUFfRU5FUjsKKyAgICAgICAgcXVhX2VuZXJfTVIxMjIgPSBNSU5fUVVBX0VORVJfTVIxMjI7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIC8qIGNvbnZlcnQgZ2NvZGUwIGZyb20gRFBGIHRvIHN0YW5kYXJkIGZyYWN0aW9uL2V4cG9uZW50IGZvcm1hdCAqLworICAgICAgICAvKiB3aXRoIG5vcm1hbGl6ZWQgZnJhYywgaS5lLiAxNjM4NCA8PSBmcmFjIDw9IDMyNzY3ICAgICAgICAgICAgKi8KKyAgICAgICAgLyogTm90ZTogZXhwb25lbnQgY29ycmVjdGlvbiAoZXhwPWV4cC0xNCkgaXMgZG9uZSBhZnRlciBkaXZfcyAgICovCisgICAgICAgIGZyYWNfZ2NvZGUwID0gKFdvcmQxNikoUG93MigxNCwgZnJhY19nY29kZTAsIHBPdmVyZmxvdykpOworCisgICAgICAgIC8qIG1ha2Ugc3VyZSBjb2RfZ2Fpbl9mcmFjIDwgZnJhY19nY29kZTAgIGZvciBkaXZfcyAqLworICAgICAgICBpZiAoY29kX2dhaW5fZnJhYyA+PSBmcmFjX2djb2RlMCkKKyAgICAgICAgeworICAgICAgICAgICAgY29kX2dhaW5fZnJhYyA+Pj0gMTsKKyAgICAgICAgICAgIGNvZF9nYWluX2V4cCArPSAxOworICAgICAgICB9CisKKyAgICAgICAgLyoKKyAgICAgICAgICBwcmVkRXJyRmFjdAorICAgICAgICAgICAgID0gZ2N1IC8gZ2NvZGUwCisgICAgICAgICAgICAgPSBjb2RfZ2Fpbl9mcmFjL2ZyYWNfZ2NvZGUwICogMl4oY29kX2dhaW5fZXhwLShleHBfZ2NvZGUwLTE0KSkKKyAgICAgICAgICAgICA9IGRpdl9zIChjX2dfZiwgZnJhY19nY29kZTApKjJeLTE1ICogMl4oY19nX2UtZXhwX2djb2RlMCsxNCkKKyAgICAgICAgICAgICA9IGRpdl9zICogMl4oY29kX2dhaW5fZXhwLWV4cF9nY29kZTAgLSAxKQorICAgICAgICAqLworICAgICAgICBmcmFjID0gZGl2X3MoY29kX2dhaW5fZnJhYywgZnJhY19nY29kZTApOworICAgICAgICB0bXAgPSBjb2RfZ2Fpbl9leHAgLSBleHBfZ2NvZGUwOworICAgICAgICB0bXAgLT0gMTsKKworICAgICAgICBMb2cyKChXb3JkMzIpIGZyYWMsICZleHAsICZmcmFjLCBwT3ZlcmZsb3cpOworICAgICAgICBleHAgKz0gdG1wOworCisgICAgICAgIC8qIGNhbGN1bGF0ZSBwcmVkaWN0aW9uIGVycm9yIChsb2cyLCBRMTApICovCisgICAgICAgIHF1YV9lbmVyX01SMTIyID0gc2hyX3IoZnJhYywgNSwgcE92ZXJmbG93KTsKKyAgICAgICAgdG1wID0gZXhwIDw8IDEwOworICAgICAgICBxdWFfZW5lcl9NUjEyMiArPSB0bXA7CisKKyAgICAgICAgaWYgKHF1YV9lbmVyX01SMTIyID4gTUFYX1FVQV9FTkVSX01SMTIyKQorICAgICAgICB7CisgICAgICAgICAgICBxdWFfZW5lciA9IE1BWF9RVUFfRU5FUjsKKyAgICAgICAgICAgIHF1YV9lbmVyX01SMTIyID0gTUFYX1FVQV9FTkVSX01SMTIyOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgLyogY2FsY3VsYXRlIHByZWRpY3Rpb24gZXJyb3IgKDIwKmxvZzEwLCBRMTApICovCisgICAgICAgICAgICBMX3RtcCA9IE1weV8zMl8xNihleHAsIGZyYWMsIDI0NjYwLCBwT3ZlcmZsb3cpOworICAgICAgICAgICAgLyogMjQ2NjAgUTEyIH49IDYuMDIwNiA9IDIwKmxvZzEwKDIpICovCisgICAgICAgICAgICBMX3RtcCA9ICBMX3NobChMX3RtcCwgMTMsIHBPdmVyZmxvdyk7CisgICAgICAgICAgICBxdWFfZW5lciA9IHB2X3JvdW5kKExfdG1wLCBwT3ZlcmZsb3cpOworCisgICAgICAgICAgICAvKiBRMTIgKiBRMCA9IFExMyAtPiBRMjYgLT4gUTEwICAgICAqLworICAgICAgICB9CisgICAgfQorCisgICAgLyogdXBkYXRlIE1BIHByZWRpY3RvciBtZW1vcnkgKi8KKyAgICBnY19wcmVkX3VwZGF0ZShwcmVkX3N0LCBxdWFfZW5lcl9NUjEyMiwgcXVhX2VuZXIpOworCisKKyAgICByZXR1cm47Cit9CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisKKy8qCistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKyBGVU5DVElPTiBOQU1FOiBNUjQ3NV9nYWluX3F1YW50CistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKyBJTlBVVCBBTkQgT1VUUFVUIERFRklOSVRJT05TCisKKyBJbnB1dHM6CisgICAgcHJlZF9zdCA9IHBvaW50ZXIgdG8gc3RydWN0dXJlIG9mIHR5cGUgZ2NfcHJlZFN0YXRlCisgICAgc2YwX2V4cF9nY29kZ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A6IGVuZXJneSBjb2VmZi4gKDUpLCBmcmFjdGlvbiBwYXJ0LCAgUTE1CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAoZnJhY19jb2VmZiBhbmQgZXhwX2NvZWZmIGNvbXB1dGVkIGluCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgY2FsY19maWx0X2VuZXJnaWVzKCkpCisgICAgV29yZDE2IHNmMF9leHBfdGFyZ2V0X2VuLCAgLy8gaSAgOiBleHBvbmVudCBvZiB0YXJnZXQgZW5lcmd5LCAgICAgICAgIFEwCisgICAgV29yZDE2IHNmMF9mcmFjX3RhcmdldF9lbiwgLy8gaSAgOiBmcmFjdGlvbiBvZiB0YXJnZXQgZW5lcmd5LCAgICAgICAgIFExNQorCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZGF0YSBmcm9tIHN1YmZyYW1lIDEgKG9yIDMpCisgICAgV29yZDE2IHNmMV9jb2RlX25vc2hhcnBbXSwgLy8gaSAgOiBpbm5vdmF0aXZlIGNvZGVib29rIHZlY3RvciAoTF9TVUJGUikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgICh3aGl0aG91dCBwaXRjaCBzaGFycGVuaW5nKQorICAgIFdvcmQxNiBzZjFfZXhwX2djb2RlMCwgICAgIC8vIGkgIDogcHJlZGljdGVkIENCIGdhaW4gKGV4cG9uZW50KSwgICAgICBRMAorICAgIFdvcmQxNiBzZjFfZnJhY19nY29kZTAsICAgIC8vIGkgIDogcHJlZGljdGVkIENCIGdhaW4gKGZyYWN0aW9uKSwgICAgICBRMTUKKyAgICBXb3JkMTYgc2YxX2V4cF9jb2VmZltdLCAgICAvLyBpICA6IGVuZXJneSBjb2VmZi4gKDUpLCBleHBvbmVudCBwYXJ0LCAgUTAKKyAgICBXb3JkMTYgc2YxX2ZyYWNfY29lZmZbXSwgICAvLyBpICA6IGVuZXJneSBjb2VmZi4gKDUpLCBmcmFjdGlvbiBwYXJ0LCAgUTE1CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAoZnJhY19jb2VmZiBhbmQgZXhwX2NvZWZmIGNvbXB1dGVkIGluCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgY2FsY19maWx0X2VuZXJnaWVzKCkpCisgICAgV29yZDE2IHNmMV9leHBfdGFyZ2V0X2VuLCAgLy8gaSAgOiBleHBvbmVudCBvZiB0YXJnZXQgZW5lcmd5LCAgICAgICAgIFEwCisgICAgV29yZDE2IHNmMV9mcmFjX3RhcmdldF9lbiwgLy8gaSAgOiBmcmFjdGlvbiBvZiB0YXJnZXQgZW5lcmd5LCAgICAgICAgIFExNQorCisgICAgV29yZDE2IGdwX2xpbWl0LCAgICAgICAgICAgLy8gaSAgOiBwaXRjaCBnYWluIGxpbWl0CisKKyAgICBXb3JkMTYgKnNmMF9nYWluX3BpdCwgICAgICAvLyBvICA6IFBpdGNoIGdhaW4sICAgICAgICAgICAgICAgICAgICAgICAgUTE0CisgICAgV29yZDE2ICpzZjBfZ2Fpbl9jb2QsICAgICAgLy8gbyAgOiBDb2RlIGdhaW4sICAgICAgICAgICAgICAgICAgICAgICAgIFExCisKKyAgICBXb3JkMTYgKnNmMV9nYWluX3BpdCwgICAgICAvLyBvICA6IFBpdGNoIGdhaW4sICAgICAgICAgICAgICAgICAgICAgICAgUTE0CisgICAgV29yZDE2ICpzZjFfZ2Fpbl9jb2QgICAgICAgLy8gbyAgOiBDb2RlIGdhaW4sICAgICAgICAgICAgICAgICAgICAgICAgIFExCispCit7CisgICAgY29uc3QgV29yZDE2ICpwOworICAgIFdvcmQxNiBpLCBpbmRleCA9IDA7CisgICAgV29yZDE2IHRtcDsKKyAgICBXb3JkMTYgZXhwOworICAgIFdvcmQxNiBzZjBfZ2NvZGUwLCBzZjFfZ2NvZGUwOworICAgIFdvcmQxNiBnX3BpdGNoLCBnMl9waXRjaCwgZ19jb2RlLCBnMl9jb2RlLCBnX3BpdF9jb2Q7CisgICAgV29yZDE2IGNvZWZmWzEwXSwgY29lZmZfbG9bMTBdLCBleHBfbWF4WzEwXTsgIC8vIDAuLjQ6IHNmMDsgNS4uOTogc2YxCisgICAgV29yZDMyIExfdG1wLCBkaXN0X21pbjsKKworICAgICAqLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSoKKyAgICAgKiAgcHJlZGljdGVkIGNvZGVib29rIGdhaW4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogIH5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICAgICAqICBnYzAgICAgID0gMl5leHBfZ2NvZGUwICsgMl5mcmFjX2djb2RlMCAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogIGdjb2RlMCAoUTE0KSA9IDJeMTQqMl5mcmFjX2djb2RlMCA9IGdjMCAqIDJeKDE0LWV4cF9nY29kZTApICAgICAgKgorICAgICAqLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSoKKworICAgIHNmMF9nY29kZTAgPSBleHRyYWN0X2woUG93MigxNCwgc2YwX2ZyYWNfZ2NvZGUwKSk7CisgICAgc2YxX2djb2RlMCA9IGV4dHJhY3RfbChQb3cyKDE0LCBzZjFfZnJhY19nY29kZTApKTsKKworICAgICAqIEZvciBlYWNoIHN1YmZyYW1lLCB0aGUgZXJyb3IgZW5lcmd5IChzdW0pIHRvIGJlIG1pbmltaXplZCBjb25zaXN0cworICAgICAqIG9mIGZpdmUgdGVybXMsIHRbMC4uNF0uCisgICAgICoKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICB0WzBdID0gICAgZ3BeMiAgKiA8eTEgeTE+CisgICAgICogICAgICAgICAgICAgICAgICAgICAgdFsxXSA9IC0yKmdwICAgICogPHhuIHkxPgorICAgICAqICAgICAgICAgICAgICAgICAgICAgIHRbMl0gPSAgICBnY14yICAqIDx5MiB5Mj4KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICB0WzNdID0gLTIqZ2MgICAgKiA8eG4geTI+CisgICAgICogICAgICAgICAgICAgICAgICAgICAgdFs0XSA9ICAyKmdwKmdjICogPHkxIHkyPgorICAgICAqCisKKyAgICAvLyBzZiAwCisgICAgLy8gZGV0ZXJtaW5lIHRoZSBzY2FsaW5nIGV4cG9uZW50IGZvciBnX2NvZGU6IGVjID0gZWMwIC0gMTEKKyAgICBleHAgPSBzdWIoc2YwX2V4cF9nY29kZTAsIDExKTsKKworICAgIC8vIGNhbGN1bGF0ZSBleHBfbWF4W2ldID0gc1tpXS0xCisgICAgZXhwX21heFswXSA9IHN1YihzZjBfZXhwX2NvZWZmWzBdLCAxMyk7CisgICAgZXhwX21heFsxXSA9IHN1YihzZjBfZXhwX2NvZWZmWzFdLCAxNCk7CisgICAgZXhwX21heFsyXSA9IGFkZChzZjBfZXhwX2NvZWZmWzJdLCBhZGQoMTUsIHNobChleHAsIDEpKSk7CisgICAgZXhwX21heFszXSA9IGFkZChzZjBfZXhwX2NvZWZmWzNdLCBleHApOworICAgIGV4cF9tYXhbNF0gPSBhZGQoc2YwX2V4cF9jb2VmZls0XSwgYWRkKDEsIGV4cCkpOworCisgICAgLy8gc2YgMQorICAgIC8vIGRldGVybWluZSB0aGUgc2NhbGluZyBleHBvbmVudCBmb3IgZ19jb2RlOiBlYyA9IGVjMCAtIDExCisgICAgZXhwID0gc3ViKHNmMV9leHBfZ2NvZGUwLCAxMSk7CisKKyAgICAvLyBjYWxjdWxhdGUgZXhwX21heFtpXSA9IHNbaV0tM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pCisgICAgICAgIGlmIChzdWIgKHRtcCwgc2YxX2ZyYWNfdGFyZ2V0X2VuKSA+IDApICAgICAgLy8gdG1wID4gZW4oc2YxKT8KKyAgICAgICAgeworICAgICAgICAgICAgLy8gdGFyZ2V0X2VuZXJneShzZjEpIDwgMC4yNSp0YXJnZXRfZW5lcmd5KHNmMCkKKyAgICAgICAgICAgIC8vICAgLT4gc2NhbGUgZG93biBNU0Uoc2YwKSBieSAwLjUgYnkgc3VidHJhY3RpbmcgMSBmcm9tCisgICAgICAgICAgICAvLyAgICAgIGNvZWZmaWNpZW50cyAwLi40CisgICAgICAgICAgICBleHAgPSAtMTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGZvciAoaSA9IDA7IGkgPCA1OyBpKyspCisgICAgeworICAgICAgICBleHBfbWF4W2ldID0gYWRkIChleHBfbWF4W2ldLCBleHApOworICAgIH0KKworICAgICAqLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSoKKyAgICAgKiAgRmluZCBtYXhpbXVtIGV4cG9uZW50OiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogIH5+fn5+fn5+fn5+fn5+fn5+fn5+fn4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgRm9yIHRoZSBzdW0gb3BlcmF0aW9uLCBhbGwgdGVybXMgbXVzdCBoYXZlIHRoZSBzYW1lIHNjYWxpbmc7ICAgICAqCisgICAgICogIHRoYXQgc2NhbGluZyBzaG91bGQgYmUgbG93IGVub3VnaCB0byBwcmV2ZW50IG92ZXJmbG93LiBUaGVyZS0gICAgKgorICAgICAqICBmb3JlLCB0aGUgbWF4aW11bSBzY2FsZSBpcyBkZXRlcm1pbmVkIGFuZCBhbGwgY29lZmZpY2llbnRzIGFyZSAgICoKKyAgICAgKiAgcmUtc2NhbGVkOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICAgICAqICAgIGV4cCA9IG1heChleHBfbWF4W2ldKSArIDE7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgICBlID0gZXhwX21heFtpXS1leHA7ICAgICAgICAgZSA8PSAwISAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogICAgY1tpXSA9IGNbaV0qMl5lICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICAgICAqLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSoKKworICAgIGV4cCA9IGV4cF9tYXhbMF07CisgICAgZm9yIChpID0gMTsgaSA8IDEwOyBpKyspCisgICAgeworICAgICAgICBpZiAoc3ViKGV4cF9tYXhbaV0sIGV4cCkgPiAwKQorICAgICAgICB7CisgICAgICAgICAgICBleHAgPSBleHBfbWF4W2ldOworICAgICAgICB9CisgICAgfQorICAgIGV4cCA9IGFkZChleHAsIDEpOyAgICAgIC8vIFRvIGF2b2lkIG92ZXJmbG93CisKKyAgICBwID0gJnNmMF9mcmFjX2NvZWZmWzBdOworICAgIGZvciAoaSA9IDA7IGkgPCA1OyBpKyspIHsKKyAgICAgICAgdG1wID0gc3ViKGV4cCwgZXhwX21heFtpXSk7CisgICAgICAgIExfdG1wID0gTF9kZXBvc2l0X2goKnArKyk7CisgICAgICAgIExfdG1wID0gTF9zaHIoTF90bXAsIHRtcCk7CisgICAgICAgIExfRXh0cmFjdChMX3RtcCwgJmNvZWZmW2ldLCAmY29lZmZfbG9baV0pOworICAgIH0KKyAgICBwID0gJnNmMV9mcmFjX2NvZWZmWzBdOworICAgIGZvciAoOyBpIDwgMTA7IGkrKykgeworICAgICAgICB0bXAgPSBzdWIoZXhwLCBleHBfbWF4W2ldKTsKKyAgICAgICAgTF90bXAgPSBMX2RlcG9zaXRfaCgqcCsrKTsKKyAgICAgICAgTF90bXAgPSBMX3NocihMX3RtcCwgdG1wKTsKKyAgICAgICAgTF9FeHRyYWN0KExfdG1wLCAmY29lZmZbaV0sICZjb2VmZl9sb1tpXSk7CisgICAgfQorCisgICAgLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKgorICAgICAqICBDb2RlYm9vayBzZWFyY2g6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgfn5+fn5+fn5+fn5+fn5+fiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICAgICAqICBGb3IgZWFjaCBwYWlyIChnX3BpdGNoLCBnX2ZhYykgaW4gdGhlIHRhYmxlIGNhbGN1bGF0ZSB0aGUgICAgICAgICoKKyAgICAgKiAgdGVybXMgdFswLi40XSBhbmQgc3VtIHRoZW0gdXA7IHRoZSByZXN1bHQgaXMgdGhlIG1lYW4gc3F1YXJlZCAgICAqCisgICAgICogIGVycm9yIGZvciB0aGUgcXVhbnRpemVkIGdhaW5zIGZyb20gdGhlIHRhYmxlLiBUaGUgaW5kZXggZm9yIHRoZSAgKgorICAgICAqICBtaW5pbXVtIE1TRSBpcyBzdG9yZWQgYW5kIGZpbmFsbHkgdXNlZCB0byByZXRyaWV2ZSB0aGUgcXVhbnRpemVkICoKKyAgICAgKiAgZ2FpbnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisKKyAgICAvLyBzdGFydCB3aXRoICJpbmZpbml0ZSIgTVNFCisgICAgZGlzdF9taW4gPSBNQVhfMzI7CisKKyAgICBwID0gJnRhYmxlX2dhaW5fTVI0NzVbMF07CisKKyAgICBmb3IgKGkgPSAwOyBpIDwgTVI0NzVfVlFfU0laRTsgaSsrKQorICAgIHsKKyAgICAgICAgLy8gc3ViZnJhbWUgMCAoYW5kIDIpIGNhbGN1bGF0aW9ucworICAgICAgICBnX3BpdGNoID0gKnArKzsKKyAgICAgICAgZ19jb2RlID0gKnArKzsKKworICAgICAgICBnX2NvZGUgPSBtdWx0KGdfY29kZSwgc2YwX2djb2RlMCk7CisgICAgICAgIGcyX3BpdGNoID0gbXVsdChnX3BpdGNoLCBnX3BpdGNoKTsKKyAgICAgICAgZzJfY29kZSA9IG11bHQoZ19jb2RlLCBnX2NvZGUpOworICAgICAgICBnX3BpdF9jb2QgPSBtdWx0KGdfY29kZSwgZ19waXRjaCk7CisKKyAgICAgICAgTF90bXAgPSBNcHlfMzJfMTYoICAgICAgIGNvZWZmWzBdLCBjb2VmZl9sb1swXSwgZzJfcGl0Y2gpOworICAgICAgICBMX3RtcCA9IE1hY18zMl8xNihMX3RtcCwgY29lZmZbMV0sIGNvZWZmX2xvWzFdLCBnX3BpdGNoKTsKKyAgICAgICAgTF90bXAgPSBNYWNfMzJfMTYoTF90bXAsIGNvZWZmWzJdLCBjb2VmZl9sb1syXSwgZzJfY29kZSk7CisgICAgICAgIExfdG1wID0gTWFjXzMyXzE2KExfdG1wLCBjb2VmZlszXSwgY29lZmZfbG9bM10sIGdfY29kZSk7CisgICAgICAgIExfdG1wID0gTWFjXzMyXzE2KExfdG1wLCBjb2VmZls0XSwgY29lZmZfbG9bNF0sIGdfcGl0X2NvZCk7CisKKyAgICAgICAgdG1wID0gc3ViIChnX3BpdGNoLCBncF9saW1pdCk7CisKKyAgICAgICAgLy8gc3ViZnJhbWUgMSAoYW5kIDMpIGNhbGN1bGF0aW9ucworICAgICAgICBnX3BpdGNoID0gKnArKzsKKyAgICAgICAgZ19jb2RlID0gKnArKzsKKworICAgICAgICBpZiAodG1wIDw9IDAgJiYgc3ViKGdfcGl0Y2gsIGdwX2xpbWl0KSA8PSAwKQorICAgICAgICB7CisgICAgICAgICAgICBnX2NvZGUgPSBtdWx0KGdfY29kZSwgc2YxX2djb2RlMCk7CisgICAgICAgICAgICBnMl9waXRjaCA9IG11bHQoZ19waXRjaCwgZ19waXRjaCk7CisgICAgICAgICAgICBnMl9jb2RlID0gbXVsdChnX2NvZGUsIGdfY29kZSk7CisgICAgICAgICAgICBnX3BpdF9jb2QgPSBtdWx0KGdfY29kZSwgZ19waXRjaCk7CisKKyAgICAgICAgICAgIExfdG1wID0gTWFjXzMyXzE2KExfdG1wLCBjb2VmZls1XSwgY29lZmZfbG9bNV0sIGcyX3BpdGNoKTsKKyAgICAgICAgICAgIExfdG1wID0gTWFjXzMyXzE2KExfdG1wLCBjb2VmZls2XSwgY29lZmZfbG9bNl0sIGdfcGl0Y2gpOworICAgICAgICAgICAgTF90bXAgPSBNYWNfMzJfMTYoTF90bXAsIGNvZWZmWzddLCBjb2VmZl9sb1s3XSwgZzJfY29kZSk7CisgICAgICAgICAgICBMX3RtcCA9IE1hY18zMl8xNihMX3RtcCwgY29lZmZbOF0sIGNvZWZmX2xvWzhdLCBnX2NvZGUpOworICAgICAgICAgICAgTF90bXAgPSBNYWNfMzJfMTYoTF90bXAsIGNvZWZmWzldLCBjb2VmZl9sb1s5XSwgZ19waXRfY29kKTsKKworICAgICAgICAgICAgLy8gc3RvcmUgdGFibGUgaW5kZXggaWYgTVNFIGZvciB0aGlzIGluZGV4IGlzIGxvd2VyCisgICAgICAgICAgICAgICB0aGFuIHRoZSBtaW5pbXVtIE1TRSBzZWVuIHNvIGZhcgorICAgICAgICAgICAgaWYgKExfc3ViKExfdG1wLCBkaXN0X21pbikgPCAoV29yZDMyKSAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGRpc3RfbWluID0gTF90bXA7CisgICAgICAgICAgICAgICAgaW5kZXggPSBpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCisgICAgICogIHJlYWQgcXVhbnRpemVkIGdhaW5zIGFuZCB1cGRhdGUgTUEgcHJlZGljdG9yIG1lbW9yaWVzICAgICAgICAgICAqCisgICAgICogIH5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+ICAgICAgICAgICAqCisgICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCisKKyAgICAvLyBmb3Igc3ViZnJhbWUgMCwgdGhlIHByZS1jYWxjdWxhdGVkIGdjb2RlMC9leHBfZ2NvZGUwIGFyZSB0aGUgc2FtZQorICAgIC8vIGFzIHRob3NlIGNhbGN1bGF0ZWQgZnJvbSB0aGUgInJlYWwiIHByZWRpY3RvciB1c2luZyBxdWFudGl6ZWQgZ2FpbnMKKyAgICB0bXAgPSBzaGwoaW5kZXgsIDIpOworICAgIE1SNDc1X3F1YW50X3N0b3JlX3Jlc3VsdHMocHJlZF9zdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ0YWJsZV9nYWluX01SNDc1W3RtcF0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZjBfZ2NvZGUwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2YwX2V4cF9nY29kZTAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZjBfZ2Fpbl9waXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZjBfZ2Fpbl9jb2QpOworCisgICAgLy8gY2FsY3VsYXRlIG5ldyBwcmVkaWN0ZWQgZ2FpbiBmb3Igc3ViZnJhbWUgMSAodGhpcyB0aW1lIHVzaW5nCisgICAgLy8gdGhlIHJlYWwsIHF1YW50aXplZCBnYWlucykKKyAgICBnY19wcmVkKHByZWRfc3QsIE1SNDc1LCBzZjFfY29kZV9ub3NoYXJwLAorICAgICAgICAgICAgJnNmMV9leHBfZ2NvZGUwLCAmc2YxX2ZyYWNfZ2NvZGUwLAorICAgICAgICAgICAgJnNmMF9leHBfZ2NvZGUwLCAmc2YwX2djb2RlMCk7IC8vIGxhc3QgdHdvIGFyZ3MgYXJlIHVudXNlZAorICAgIHNmMV9nY29kZTAgPSBleHRyYWN0X2woUG93MigxNCwgc2YxX2ZyYWNfZ2NvZGUwKSk7CisKKyAgICB0bXAgPSBhZGQgKHRtcCwgMik7CisgICAgTVI0NzVfcXVhbnRfc3RvcmVfcmVzdWx0cyhwcmVkX3N0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnRhYmxlX2dhaW5fTVI0NzVbdG1wXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNmMV9nY29kZTAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZjFfZXhwX2djb2RlMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNmMV9nYWluX3BpdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNmMV9nYWluX2NvZCk7CisKKyAgICByZXR1cm4gaW5kZXg7Cit9CisKKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS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0aW9uLiAgICAgICAgICAgICAgICAgKi8KKyAgICBnY19wcmVkU3RhdGUgKnByZWRfc3QsICAgICAvKiBpL286IGdhaW4gcHJlZGljdG9yIHN0YXRlIHN0cnVjdCAgICAgICAgICAgICovCisKKyAgICAvKiBkYXRhIGZyb20gc3ViZnJhbWUgMCAob3IgMikgKi8KKyAgICBXb3JkMTYgc2YwX2V4cF9nY29kZTAsICAgICAvKiBpICA6IHByZWRpY3RlZCBDQiBnYWluIChleHBvbmVudCksICAgICAgUTAgICovCisgICAgV29yZDE2IHNmMF9mcmFjX2djb2RlMCwgICAgLyogaSAgOiBwcmVkaWN0ZWQgQ0IgZ2FpbiAoZnJhY3Rpb24pLCAgICAgIFExNSAqLworICAgIFdvcmQxNiBzZjBfZXhwX2NvZWZmW10sICAgIC8qIGkgIDogZW5lcmd5IGNvZWZmLiAoNSksIGV4cG9uZW50IHBhcnQsICBRMCAgKi8KKyAgICBXb3JkMTYgc2YwX2ZyYWNfY29lZmZbXSwgICAvKiBpICA6IGVuZXJneSBjb2VmZi4gKDUpLCBmcmFjdGlvbiBwYXJ0LCAgUTE1ICovCisgICAgLyogICAgICAoZnJhY19jb2VmZiBhbmQgZXhwX2NvZWZmIGNvbXB1dGVkIGluICAqLworICAgIC8qICAgICAgIGNhbGNfZmlsdF9lbmVyZ2llcygpKSAgICAgICAgICAgICAgICAgKi8KKyAgICBXb3JkMTYgc2YwX2V4cF90YXJnZXRfZW4sICAvKiBpICA6IGV4cG9uZW50IG9mIHRhcmdldCBlbmVyZ3ksICAgICAgICAgUTAgICovCisgICAgV29yZDE2IHNmMF9mcmFjX3RhcmdldF9lbiwgLyogaSAgOiBmcmFjdGlvbiBvZiB0YXJnZXQgZW5lcmd5LCAgICAgICAgIFExNSAqLworCisgICAgLyogZGF0YSBmcm9tIHN1YmZyYW1lIDEgKG9yIDMpICovCisgICAgV29yZDE2IHNmMV9jb2RlX25vc2hhcnBbXSwgLyogaSAgOiBpbm5vdmF0aXZlIGNvZGVib29rIHZlY3RvciAoTF9TVUJGUikgICAqLworICAgIC8qICAgICAgKHdoaXRob3V0IHBpdGNoIHNoYXJwZW5pbmcpICAgICAgICAgICAgKi8KKyAgICBXb3JkMTYgc2YxX2V4cF9nY29kZTAsICAgICAvKiBpICA6IHByZWRpY3RlZCBDQiBnYWluIChleHBvbmVudCksICAgICAgUTAgICovCisgICAgV29yZDE2IHNmMV9mcmFjX2djb2RlMCwgICAgLyogaSAgOiBwcmVkaWN0ZWQgQ0IgZ2FpbiAoZnJhY3Rpb24pLCAgICAgIFExNSAqLworICAgIFdvcmQxNiBzZjFfZXhwX2NvZWZmW10sICAgIC8qIGkgIDogZW5lcmd5IGNvZWZmLiAoNSksIGV4cG9uZW50IHBhcnQsICBRMCAgKi8KKyAgICBXb3JkMTYgc2YxX2ZyYWNfY29lZmZbXSwgICAvKiBpICA6IGVuZXJneSBjb2VmZi4gKDUpLCBmcmFjdGlvbiBwYXJ0LCAgUTE1ICovCisgICAgLyogICAgICAoZnJhY19jb2VmZiBhbmQgZXhwX2NvZWZmIGNvbXB1dGVkIGluICAqLworICAgIC8qICAgICAgIGNhbGNfZmlsdF9lbmVyZ2llcygpKSAgICAgICAgICAgICAgICAgKi8KKyAgICBXb3JkMTYgc2YxX2V4cF90YXJnZXRfZW4sICAvKiBpICA6IGV4cG9uZW50IG9mIHRhcmdldCBlbmVyZ3ksICAgICAgICAgUTAgICovCisgICAgV29yZDE2IHNmMV9mcmFjX3RhcmdldF9lbiwgLyogaSAgOiBmcmFjdGlvbiBvZiB0YXJnZXQgZW5lcmd5LCAgICAgICAgIFExNSAqLworCisgICAgV29yZDE2IGdwX2xpbWl0LCAgICAgICAgICAgLyogaSAgOiBwaXRjaCBnYWluIGxpbWl0ICAgICAgICAgICAgICAgICAgICAgICAqLworCisgICAgV29yZDE2ICpzZjBfZ2Fpbl9waXQsICAgICAgLyogbyAgOiBQaXRjaCBnYWluLCAgICAgICAgICAgICAgICAgICAgICAgIFExNCAqLworICAgIFdvcmQxNiAqc2YwX2dhaW5fY29kLCAgICAgIC8qIG8gIDogQ29kZSBnYWluLCAgICAgICAgICAgICAgICAgICAgICAgICBRMSAgKi8KKworICAgIFdvcmQxNiAqc2YxX2dhaW5fcGl0LCAgICAgIC8qIG8gIDogUGl0Y2ggZ2FpbiwgICAgICAgICAgICAgICAgICAgICAgICBRMTQgKi8KKyAgICBXb3JkMTYgKnNmMV9nYWluX2NvZCwgICAgICAvKiBvICA6IENvZGUgZ2FpbiwgICAgICAgICAgICAgICAgICAgICAgICAgUTEgICovCisgICAgRmxhZyAgICpwT3ZlcmZsb3cgICAgICAgICAgLyogbyAgOiBvdmVyZmxvdyBpbmRpY2F0b3IgICAgICAgICAgICAgICAgICAgICAqLworKQoreworICAgIGNvbnN0IFdvcmQxNiAqcDsKKyAgICBXb3JkMTYgaTsKKyAgICBXb3JkMTYgaW5kZXggPSAwOworICAgIFdvcmQxNiB0bXA7CisgICAgV29yZDE2IGV4cDsKKyAgICBXb3JkMTYgc2YwX2djb2RlMDsKKyAgICBXb3JkMTYgc2YxX2djb2RlMDsKKyAgICBXb3JkMTYgZ19waXRjaDsKKyAgICBXb3JkMTYgZzJfcGl0Y2g7CisgICAgV29yZDE2IGdfY29kZTsKKyAgICBXb3JkMTYgZzJfY29kZTsKKyAgICBXb3JkMTYgZ19waXRfY29kOworICAgIFdvcmQxNiBjb2VmZlsxMF07CisgICAgV29yZDE2IGNvZWZmX2xvWzEwXTsKKyAgICBXb3JkMTYgZXhwX21heFsxMF07ICAvKiAwLi40OiBzZjA7IDUuLjk6IHNmMSAqLworICAgIFdvcmQzMiBMX3RtcDsKKyAgICBXb3JkMzIgZGlzdF9taW47CisKKyAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCisgICAgICogIHByZWRpY3RlZCBjb2RlYm9vayBnYWluICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICAgICAqICB+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgZ2MwICAgICA9IDJeZXhwX2djb2RlMCArIDJeZnJhY19nY29kZTAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICAgICAqICBnY29kZTAgKFExNCkgPSAyXjE0KjJeZnJhY19nY29kZTAgPSBnYzAgKiAyXigxNC1leHBfZ2NvZGUwKSAgICAgICoKKyAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworCisgICAgc2YwX2djb2RlMCA9IChXb3JkMTYpKFBvdzIoMTQsIHNmMF9mcmFjX2djb2RlMCwgcE92ZXJmbG93KSk7CisgICAgc2YxX2djb2RlMCA9IChXb3JkMTYpKFBvdzIoMTQsIHNmMV9mcmFjX2djb2RlMCwgcE92ZXJmbG93KSk7CisKKyAgICAvKgorICAgICAqIEZvciBlYWNoIHN1YmZyYW1lLCB0aGUgZXJyb3IgZW5lcmd5IChzdW0pIHRvIGJlIG1pbmltaXplZCBjb25zaXN0cworICAgICAqIG9mIGZpdmUgdGVybXMsIHRbMC4uNF0uCisgICAgICoKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICB0WzBdID0gICAgZ3BeMiAgKiA8eTEgeTE+CisgICAgICogICAgICAgICAgICAgICAgICAgICAgdFsxXSA9IC0yKmdwICAgICogPHhuIHkxPgorICAgICAqICAgICAgICAgICAgICAgICAgICAgIHRbMl0gPSAgICBnY14yICAqIDx5MiB5Mj4KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICB0WzNdID0gLTIqZ2MgICAgKiA8eG4geTI+CisgICAgICogICAgICAgICAgICAgICAgICAgICAgdFs0XSA9ICAyKmdwKmdjICogPHkxIHkyPgorICAgICAqCisgICAgICovCisKKyAgICAvKiBzZiAwICovCisgICAgLyogZGV0ZXJtaW5lIHRoZSBzY2FsaW5nIGV4cG9uZW50IGZvciBnX2NvZGU6IGVjID0gZWMwIC0gMTEgKi8KKyAgICBleHAgPSBzZjBfZXhwX2djb2RlMCAtIDExOworCisgICAgLyogY2FsY3VsYXRlIGV4cF9tYXhbaV0gPSBzW2ldLTEgKi8KKyAgICBleHBfbWF4WzBdID0gKHNmMF9leHBfY29lZmZbMF0gLSAxMyk7CisgICAgZXhwX21heFsxXSA9IChzZjBfZXhwX2NvZWZmWzFdIC0gMTQpOworICAgIGV4cF9tYXhbMl0gPSAoc2YwX2V4cF9jb2VmZlsyXSArICgxNSArIChleHAgPDwgMSkpKTsKKyAgICBleHBfbWF4WzNdID0gKHNmMF9leHBfY29lZmZbM10gKyBleHApOworICAgIGV4cF9tYXhbNF0gPSAoc2YwX2V4cF9jb2VmZls0XSArICgxICsgZXhwKSk7CisKKyAgICAvKiBzZiAxICovCisgICAgLyogZGV0ZXJtaW5lIHRoZSBzY2FsaW5nIGV4cG9uZW50IGZvciBnX2NvZGU6IGVjID0gZWMwIC0gMTEgKi8KKyAgICBleHAgPSBzZjFfZXhwX2djb2RlMCAtIDExOworCisgICAgLyogY2FsY3VsYXRlIGV4cF9tYXhbaV0gPSBzW2ldLTEgKi8KKyAgICBleHBfbWF4WzVdID0gKHNmMV9leHBfY29lZmZbMF0gLSAxMyk7CisgICAgZXhwX21heFs2XSA9IChzZjFfZXhwX2NvZWZmWzFdIC0gMTQpOworICAgIGV4cF9tYXhbN10gPSAoc2YxX2V4cF9jb2VmZlsyXSArICgxNSArIChleHAgPDwgMSkpKTsKKyAgICBleHBfbWF4WzhdID0gKHNmMV9leHBfY29lZmZbM10gKyBleHApOworICAgIGV4cF9tYXhbOV0gPSAoc2YxX2V4cF9jb2VmZls0XSArICgxICsgZX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BubyBjaGFuZ2Ugb2YgZXhwb25lbnRzICovCisgICAgZXhwID0gMDsKKworICAgIC8qIHRlc3QgZm9yIHRhcmdldCBlbmVyZ3kgZGlmZmVyZW5jZTsgc2V0IGV4cCB0byArMSBvciAtMSB0byBzY2FsZQorICAgICAqIHVwL2Rvd24gY29lZmZpY2llbnRzIGZvciBzZiAxCisgICAgICovCisgICAgdG1wID0gc2hyX3Ioc2YxX2ZyYWNfdGFyZ2V0X2VuLCAxLCBwT3ZlcmZsb3cpOyAgLyogdG1wID0gY2VpbCgwLjUqZW4oc2YxKSkgKi8KKworICAgIGlmICh0bXAgPiBzZjBfZnJhY190YXJnZXRfZW4pICAgICAgICAgIC8qIHRtcCA+IGVuKHNmMCk/ICovCisgICAgeworICAgICAgICAvKgorICAgICAgICAgKiB0YXJnZXRfZW5lcmd5KHNmMSkgPiAyKnRhcmdldF9lbmVyZ3koc2YwKQorICAgICAgICAgKiAgIC0+IHNjYWxlIHVwIE1TRShzZjApIGJ5IDIgYnkgYWRkaW5nIDEgdG8gZXhwb25lbnRzIDAuLjQKKyAgICAgICAgICovCisgICAgICAgIGV4cCA9IDE7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIHRtcCA9ICgoc2YwX2ZyYWNfdGFyZ2V0X2VuICsgMykgPj4gMik7IC8qIHRtcD1jZWlsKDAuMjUqZW4oc2YwKSkgKi8KKworICAgICAgICBpZiAodG1wID4gc2YxX2ZyYWNfdGFyZ2V0X2VuKSAgICAgIC8qIHRtcCA+IGVuKHNmMSk/ICovCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgKiB0YXJnZXRfZW5lcmd5KHNmMSkgPCAwLjI1KnRhcmdldF9lbmVyZ3koc2YwKQorICAgICAgICAgICAgICogICAtPiBzY2FsZSBkb3duIE1TRShzZjApIGJ5IDAuNSBieSBzdWJ0cmFjdGluZyAxIGZyb20KKyAgICAgICAgICAgICAqICAgICAgY29lZmZpY2llbnRzIDAuLjQKKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgZXhwID0gLTE7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBmb3IgKGkgPSAwOyBpIDwgNTsgaSsrKQorICAgIHsKKyAgICAgICAgZXhwX21heFtpXSArPSBleHA7CisgICAgfQorCisgICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKgorICAgICAqICBGaW5kIG1heGltdW0gZXhwb25lbnQ6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgfn5+fn5+fn5+fn5+fn5+fn5+fn5+fiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICAgICAqICBGb3IgdGhlIHN1bSBvcGVyYXRpb24sIGFsbCB0ZXJtcyBtdXN0IGhhdmUgdGhlIHNhbWUgc2NhbGluZzsgICAgICoKKyAgICAgKiAgdGhhdCBzY2FsaW5nIHNob3VsZCBiZSBsb3cgZW5vdWdoIHRvIHByZXZlbnQgb3ZlcmZsb3cuIFRoZXJlLSAgICAqCisgICAgICogIGZvcmUsIHRoZSBtYXhpbXVtIHNjYWxlIGlzIGRldGVybWluZWQgYW5kIGFsbCBjb2VmZmljaWVudHMgYXJlICAgKgorICAgICAqICByZS1zY2FsZWQ6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogICAgZXhwID0gbWF4KGV4cF9tYXhbaV0pICsgMTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICAgICAqICAgIGUgPSBleHBfbWF4W2ldLWV4cDsgICAgICAgICBlIDw9IDAhICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgICBjW2ldID0gY1tpXSoyXmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KKworICAgIGV4cCA9IGV4cF9tYXhbMF07CisgICAgZm9yIChpID0gOTsgaSA+IDA7IGktLSkKKyAgICB7CisgICAgICAgIGlmIChleHBfbWF4W2ldID4gZXhwKQorICAgICAgICB7CisgICAgICAgICAgICBleHAgPSBleHBfbWF4W2ldOworICAgICAgICB9CisgICAgfQorICAgIGV4cCsrOyAgICAgIC8qIFRvIGF2b2lkIG92ZXJmbG93ICovCisKKyAgICBwID0gJnNmMF9mcmFjX2NvZWZmWzBdOworICAgIGZvciAoaSA9IDA7IGkgPCA1OyBpKyspCisgICAgeworICAgICAgICB0bXAgPSAoZXhwIC0gZXhwX21heFtpXSk7CisgICAgICAgIExfdG1wID0gKChXb3JkMzIpKCpwKyspIDw8IDE2KTsKKyAgICAgICAgTF90bXAgPSBMX3NocihMX3RtcCwgdG1wLCBwT3ZlcmZsb3cpOworICAgICAgICBjb2VmZltpXSA9IChXb3JkMTYpKExfdG1wID4+IDE2KTsKKyAgICAgICAgY29lZmZfbG9baV0gPSAoV29yZDE2KSgoTF90bXAgPj4gMSkgLSAoKExfdG1wID4+IDE2KSA8PCAxNSkpOworICAgIH0KKyAgICBwID0gJnNmMV9mcmFjX2NvZWZmWzBdOworICAgIGZvciAoOyBpIDwgMTA7IGkrKykKKyAgICB7CisgICAgICAgIHRtcCA9IGV4cCAtIGV4cF9tYXhbaV07CisgICAgICAgIExfdG1wID0gKChXb3JkMzIpKCpwKyspIDw8IDE2KTsKKyAgICAgICAgTF90bXAgPSBMX3NocihMX3RtcCwgdG1wLCBwT3ZlcmZsb3cpOworICAgICAgICBjb2VmZltpXSA9IChXb3JkMTYpKExfdG1wID4+IDE2KTsKKyAgICAgICAgY29lZmZfbG9baV0gPSAoV29yZDE2KSgoTF90bXAgPj4gMSkgLSAoKExfdG1wID4+IDE2KSA8PCAxNSkpOworICAgIH0KKworCisgICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKgorICAgICAqICBDb2RlYm9vayBzZWFyY2g6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyAgICAgKiAgfn5+fn5+fn5+fn5+fn5+fiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorICAgICAqICBGb3IgZWFjaCBwYWlyIChnX3BpdGNoLCBnX2ZhYykgaW4gdGhlIHRhYmxlIGNhbGN1bGF0ZSB0aGUgICAgICAgICoKKyAgICAgKiAgdGVybXMgdFswLi40XSBhbmQgc3VtIHRoZW0gdXA7IHRoZSByZXN1bHQgaXMgdGhlIG1lYW4gc3F1YXJlZCAgICAqCisgICAgICogIGVycm9yIGZvciB0aGUgcXVhbnRpemVkIGdhaW5zIGZyb20gdGhlIHRhYmxlLiBUaGUgaW5kZXggZm9yIHRoZSAgKgorICAgICAqICBtaW5pbXVtIE1TRSBpcyBzdG9yZWQgYW5kIGZpbmFsbHkgdXNlZCB0byByZXRyaWV2ZSB0aGUgcXVhbnRpemVkICoKKyAgICAgKiAgZ2FpbnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisgICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tL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bM10sIGNvZWZmX2xvWzNdLCBnX2NvZGUsIHBPdmVyZmxvdykgKworICAgICAgICAgICAgICAgIE1weV8zMl8xNihjb2VmZls0XSwgY29lZmZfbG9bNF0sIGdfcGl0X2NvZCwgcE92ZXJmbG93KTsKKworICAgICAgICB0bXAgPSAoZ19waXRjaCAtIGdwX2xpbWl0KTsKKworICAgICAgICAvKiBzdWJmcmFtZSAxIChhbmQgMykgY2FsY3VsYXRpb25zICovCisgICAgICAgIGdfcGl0Y2ggPSAqcCsrOworICAgICAgICBnX2NvZGUgPSAqcCsrOworCisgICAgICAgIGlmICgodG1wIDw9IDApICYmIChnX3BpdGNoIDw9IGdwX2xpbWl0KSkKKyAgICAgICAgeworICAgICAgICAgICAgZ19jb2RlID0gKFdvcmQxNikoKChXb3JkMzIpIGdfY29kZSAqIHNmMV9nY29kZTApID4+IDE1KTsKKyAgICAgICAgICAgIGcyX3BpdGNoICA9IChXb3JkMTYpKCgoV29yZDMyKSBnX3BpdGNoICogZ19waXRjaCkgPj4gMTUpOworICAgICAgICAgICAgZzJfY29kZSAgID0gKFdvcmQxNikoKChXb3JkMzIpIGdfY29kZSAqIGdfY29kZSkgPj4gMTUpOworICAgICAgICAgICAgZ19waXRfY29kID0gKFdvcmQxNikoKChXb3JkMzIpIGdfY29kZSAqIGdfcGl0Y2gpID4+IDE1KTsKKworICAgICAgICAgICAgTF90bXAgKz0gKE1weV8zMl8xNihjb2VmZls1XSwgY29lZmZfbG9bNV0sIGcyX3BpdGNoLCBwT3ZlcmZsb3cpICsKKyAgICAgICAgICAgICAgICAgICAgICBNcHlfMzJfMTYoY29lZmZbNl0sIGNvZWZmX2xvWzZdLCBnX3BpdGNoLCBwT3ZlcmZsb3cpICsKKyAgICAgICAgICAgICAgICAgICAgICBNcHlfMzJfMTYoY29lZmZbN10sIGNvZWZmX2xvWzddLCBnMl9jb2RlLCBwT3ZlcmZsb3cpICsKKyAgICAgICAgICAgICAgICAgICAgICBNcHlfMzJfMTYoY29lZmZbOF0sIGNvZWZmX2xvWzhdLCBnX2NvZGUsIHBPdmVyZmxvdykgKworICAgICAgICAgICAgICAgICAgICAgIE1weV8zMl8xNihjb2VmZls5XSwgY29lZmZfbG9bOV0sIGdfcGl0X2NvZCwgcE92ZXJmbG93KSk7CisKKyAgICAgICAgICAgIC8qIHN0b3JlIHRhYmxlIGluZGV4IGlmIE1TRSBmb3IgdGhpcyBpbmRleCBpcyBsb3dlcgorICAgICAgICAgICAgICAgdGhhbiB0aGUgbWluaW11bSBNU0Ugc2VlbiBzbyBmYXIgKi8KKyAgICAgICAgICAgIGlmIChMX3RtcCA8IGRpc3RfbWluKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGRpc3RfbWluID0gTF90bXA7CisgICAgICAgICAgICAgICAgaW5kZXggPSBpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCisgICAgICogIHJlYWQgcXVhbnRpemVkIGdhaW5zIGFuZCB1cGRhdGUgTUEgcHJlZGljdG9yIG1lbW9yaWVzICAgICAgICAgICAqCisgICAgICogIH5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+ICAgICAgICAgICAqCisgICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworCisgICAgLyogZm9yIHN1YmZyYW1lIDAsIHRoZSBwcmUtY2FsY3VsYXRlZCBnY29kZTAvZXhwX2djb2RlMCBhcmUgdGhlIHNhbWUKKyAgICAgICBhcyB0aG9zZSBjYWxjdWxhdGVkIGZyb20gdGhlICJyZWFsIiBwcmVkaWN0b3IgdXNpbmcgcXVhbnRpemVkIGdhaW5zICovCisgICAgdG1wID0gaW5kZXggPDwgMjsKKyAgICBNUjQ3NV9xdWFudF9zdG9yZV9yZXN1bHRzKHByZWRfc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdGFibGVfZ2Fpbl9NUjQ3NVt0bXBdLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2YwX2djb2RlMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNmMF9leHBfZ2NvZGUwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2YwX2dhaW5fcGl0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2YwX2dhaW5fY29kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcE92ZXJmbG93KTsKKworICAgIC8qIGNhbGN1bGF0ZSBuZXcgcHJlZGljdGVkIGdhaW4gZm9yIHN1YmZyYW1lIDEgKHRoaXMgdGltZSB1c2luZworICAgICAgIHRoZSByZWFsLCBxdWFudGl6ZWQgZ2FpbnMpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIGdjX3ByZWQocHJlZF9zdCwgTVI0NzUsIHNmMV9jb2RlX25vc2hhcnAsCisgICAgICAgICAgICAmc2YxX2V4cF9nY29kZTAsICZzZjFfZnJhY19nY29kZTAsCisgICAgICAgICAgICAmc2YwX2V4cF9nY29kZTAsICZzZjBfZ2NvZGUwLCAvKiB1bnVzZWQgYXJncyAqLworICAgICAgICAgICAgcE92ZXJmbG93KTsKKworICAgIHNmMV9nY29kZTAgPSAoV29yZDE2KShQb3cyKDE0LCBzZjFfZnJhY19nY29kZTAsIHBPdmVyZmxvdykpOworCisgICAgdG1wICs9IDI7CisgICAgTVI0NzVfcXVhbnRfc3RvcmVfcmVzdWx0cygKKyAgICAgICAgcHJlZF9zdCwKKyAgICAgICAgJnRhYmxlX2dhaW5fTVI0NzVbdG1wXSwKKyAgICAgICAgc2YxX2djb2RlMCwKKyAgICAgICAgc2YxX2V4cF9nY29kZTAsCisgICAgICA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ZXM6IFsKKyAgICAgICAgImZyYW1ld29ya3NfYXZfbWVkaWFfY29kZWNzX2Ftcm5iX2VuY19saWNlbnNlIiwKKyAgICBdLAorfQorCitjY190ZXN0IHsKKyAgICBuYW1lOiAiQW1ybmJFbmNvZGVyVGVzdCIsCisgICAgZ3Rlc3Q6IHRydWUsCisgICAgdGVzdF9zdWl0ZXM6IFsiZGV2aWNlLXRlc3RzIl0sCisKKyAgICBzcmNzOiBbCisgICAgICAgICJBbXJuYkVuY29kZXJUZXN0LmNwcCIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9hbXJuYl9jb21tb24iLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfYW1ybmJlbmMiLAorICAgICAgICAibGliYXVkaW91dGlscyIsCisgICAgICAgICJsaWJzbmRmaWxlIiwKKyAgICBdLAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmxvZyIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLVdlcnJvciIsCisgICAgICAgICItV2FsbCIsCisgICAgXSwKKworICAgIHNhbml0aXplOiB7CisgICAgICAgIGNmaTogdHJ1ZSwKKyAgICAgICAgbWlzY191bmRlZmluZWQ6IFsKKyAgICAgICAgICAgICJ1bnNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgICAgICJzaWduZWQtaW50ZWdlci1vdmVyZmxvdyIsCisgICAgICAgIF0sCisgICAgfSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L2NvZGVjcy9hbXJuYi9lbmMvdGVzdC9BbmRyb2lkVGVzdC54bWwgYi9tZWRpYS9jb2RlY3MvYW1ybmIvZW5jL3Rlc3QvQW5kcm9pZFRlc3QueG1sCnNpbWlsYXJpdHkgaW5kZXggMTAwJQpyZW5hbWUgZnJvbSBtZWRpYS9saWJzdGFnZWZyaWdodC9jb2RlY3MvYW1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gICJzcmMvZGVjX2FjZWxwXzRwX2luXzY0LmNwcCIsCisgICAgICAgICJzcmMvZGVjX2FsZ19jb2RlYm9vay5jcHAiLAorICAgICAgICAic3JjL2RlY19nYWluMl9hbXJfd2IuY3BwIiwKKyAgICAgICAgInNyYy9kZWVtcGhhc2lzXzMyLmNwcCIsCisgICAgICAgICJzcmMvZHR4X2RlY29kZXJfYW1yX3diLmNwcCIsCisgICAgICAgICJzcmMvZ2V0X2Ftcl93Yl9iaXRzLmNwcCIsCisgICAgICAgICJzcmMvaGlnaHBhc3NfNDAwaHpfYXRfMTJrOC5jcHAiLAorICAgICAgICAic3JjL2hpZ2hwYXNzXzUwaHpfYXRfMTJrOC5jcHAiLAorICAgICAgICAic3JjL2hvbWluZ19hbXJfd2JfZGVjLmNwcCIsCisgICAgICAgICJzcmMvaW50ZXJwb2xhdGVfaXNwLmNwcCIsCisgICAgICAgICJzcmMvaXNmX2V4dHJhcG9sYXRpb24uY3BwIiwKKyAgICAgICAgInNyYy9pc3BfYXouY3BwIiwKKyAgICAgICAgInNyYy9pc3BfaXNmLmNwcCIsCisgICAgICAgICJzcmMvbGFnY29uY2VhbC5jcHAiLAorICAgICAgICAic3JjL2xvd19wYXNzX2ZpbHRfN2suY3BwIiwKKyAgICAgICAgInNyYy9tZWRpYW41LmNwcCIsCisgICAgICAgICJzcmMvbWltZV9pby5jcHAiLAorICAgICAgICAic3JjL25vaXNlX2dlbl9hbXJ3Yi5jcHAiLAorICAgICAgICAic3JjL25vcm1hbGl6ZV9hbXJfd2IuY3BwIiwKKyAgICAgICAgInNyYy9vdmVyc2FtcF8xMms4X3RvXzE2ay5jcHAiLAorICAgICAgICAic3JjL3BoYXNlX2Rpc3BlcnNpb24uY3BwIiwKKyAgICAgICAgInNyYy9waXRfc2hycC5jcHAiLAorICAgICAgICAic3JjL3ByZWRfbHQ0LmNwcCIsCisgICAgICAgICJzcmMvcHJlZW1waF9hbXJ3Yl9kZWMuY3BwIiwKKyAgICAgICAgInNyYy9wdmFtcndiX21hdGhfb3AuY3BwIiwKKyAgICAgICAgInNyYy9wdmFtcndiZGVjb2Rlci5jcHAiLAorICAgICAgICAic3JjL3FfZ2FpbjJfdGFiLmNwcCIsCisgICAgICAgICJzcmMvcWlzZl9ucy5jcHAiLAorICAgICAgICAic3JjL3Fpc2ZfbnNfdGFiLmNwcCIsCisgICAgICAgICJzcmMvcXBpc2ZfMnMuY3BwIiwKKyAgICAgICAgInNyYy9xcGlzZl8yc190YWIuY3BwIiwKKyAgICAgICAgInNyYy9zY2FsZV9zaWduYWwuY3BwIiwKKyAgICAgICAgInNyYy9zeW50aGVzaXNfYW1yX3diLmNwcCIsCisgICAgICAgICJzcmMvdm9pY2VfZmFjdG9yLmNwcCIsCisgICAgICAgICJzcmMvd2Jfc3luX2ZpbHQuY3BwIiwKKyAgICAgICAgInNyYy93ZWlnaHRfYW1yd2JfbHBjLmNwcCIsCisgICAgXSwKKworICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsKKyAgICAgICAgInNyYyIsCisgICAgICAgICJpbmNsdWRlIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItRE9TQ0xfVU5VU0VEX0FSRyh4KT0odm9pZCkoeCkiLAorICAgICAgICAiLURPU0NMX0lNUE9SVF9SRUY9IiwKKworICAgICAgICAiLVdlcnJvciIsCisgICAgXSwKKworICAgIHNhbml0aXplOiB7CisgICAgICAgIG1pc2NfdW5kZWZpbmVkOiBbCisgICAgICAgICAgICAic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICBdLAorICAgIH0sCisKKyAgICB0YXJnZXQ6IHsKKyAgICAgICAgZGFyd2luOiB7CisgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSwKKyAgICAgICAgfSwKKyAgICB9LAorfQorCisvLyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyM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VVRQVVQgREVGSU5JVElPTlMKKword2Jfc3luX2ZpbHQKKworICAgICBpbnQxNiBhW10sICAgICAgICAgICAgICAgKGkpIFExMiA6IGFbbSsxXSBwcmVkaWN0aW9uIGNvZWZmaWNpZW50cworICAgICBpbnQxNiBtLCAgICAgICAgICAgICAgICAgKGkpICAgICA6IG9yZGVyIG9mIExQIGZpbHRlcgorICAgICBpbnQxNiB4W10sICAgICAgICAgICAgICAgKGkpICAgICA6IGlucHV0IHNpZ25hbAorICAgICBpbnQxNiB5W10sICAgICAgICAgICAgICAgKG8pICAgICA6IG91dHB1dCBzaWduYWwKKyAgICAgaW50MTYgbGcsICAgICAgICAgICAgICAgIChpKSAgICAgOiBzaXplIG9mIGZpbHRlcmluZworICAgICBpbnQxNiBtZW1bXSwgICAgICAgICAgICAgKGkvbykgICA6IG1lbW9yeSBhc3NvY2lhdGVkIHdpdGggdGhpcyBmaWx0ZXJpbmcuCisgICAgIGludDE2IHVwZGF0ZSwgICAgICAgICAgICAoaSkgICAgIDogMD1ubyB1cGRhdGUsIDE9dXBkYXRlIG9mIG1lbW9yeS4KKyAgICAgaW50MTYgeV9idWZbXQorCitTeW5fZmlsdF8zMgorCisgICAgIGludDE2IGFbXSwgICAgICAgICAgICAgIChpKSBRMTIgOiBhW20rMV0gcHJlZGljdGlvbiBjb2VmZmljaWVudHMKKyAgICAgaW50MTYgbSwgICAgICAgICAgICAgICAgKGkpICAgICA6IG9yZGVyIG9mIExQIGZpbHRlcgorICAgICBpbnQxNiBleGNbXSwgICAgICAgICAgICAoaSkgUW5ldzogZXhjaXRhdGlvbiAoZXhjW2ldID4+IFFuZXcpCisgICAgIGludDE2IFFuZXcsICAgICAgICAgICAgIChpKSAgICAgOiBleGMgc2NhbGluZyA9IDAobWluKSB0byA4KG1heCkKKyAgICAgaW50MTYgc2lnX2hpW10sICAgICAgICAgKG8pIC8xNiA6IHN5bnRoZXNpcyBoaWdoCisgICAgIGludDE2IHNpZ19sb1tdLCAgICAgICAgICh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iB4W10sICAgICAgIC8qIChpKSAgICAgOiBpbnB1dCBzaWduYWwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgaW50MTYgeVtdLCAgICAgICAvKiAobykgICAgIDogb3V0cHV0IHNpZ25hbCAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIGludDE2IGxnLCAgICAgICAgLyogKGkpICAgICA6IHNpemUgb2YgZmlsdGVyaW5nICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICBpbnQxNiBtZW1bXSwgICAgIC8qIChpL28pICAgOiBtZW1vcnkgYXNzb2NpYXRlZCB3aXRoIHRoaXMgZmlsdGVyaW5nLiAgICovCisgICAgaW50MTYgdXBkYXRlLCAgICAvKiAoaSkgICAgIDogMD1ubyB1cGRhdGUsIDE9dXBkYXRlIG9mIG1lbW9yeS4gICAgICAgICAqLworICAgIGludDE2IHlfYnVmW10KKykKK3sKKworICAgIGludDE2IGksIGo7CisgICAgaW50MzIgTF90bXAxOworICAgIGludDMyIExfdG1wMjsKKyAgICBpbnQzMiBMX3RtcDM7CisgICAgaW50MzIgTF90bXA0OworICAgIGludDE2ICp5eTsKKworICAgIC8qIGNvcHkgaW5pdGlhbCBmaWx0ZXIgc3RhdGVzIGludG8gc3ludGhlc2lzIGJ1ZmZlciAqLworICAgIHB2X21lbWNweSh5X2J1ZiwgbWVtLCBtKnNpemVvZigqeXkpKTsKKworICAgIHl5ID0gJnlfYnVmW21dOworCisgICAgLyogRG8gdGhlIGZpbHRlcmluZy4gKi8KKworICAgIGZvciAoaSA9IDA7IGkgPCBsZyA+PiAyOyBpKyspCisgICAgeworICAgICAgICBMX3RtcDEgPSAtKChpbnQzMil4WyhpPDwyKV0gPDwgMTEpOworICAgICAgICBMX3RtcDIgPSAtKChpbnQzMil4WyhpPDwyKSsxXSA8PCAxMSk7CisgICAgICAgIExfdG1wMyA9IC0oKGludDMyKXhbKGk8PDIpKzJdIDw8IDExKTsKKyAgICAgICAgTF90bXA0ID0gLSgoaW50MzIpeFsoaTw8MikrM10gPDwgMTEpOworCisgICAgICAgIC8qIGFbXSB1c2VzIFExMiBhbmQgYWJzKGEpID08IDEgKi8KKworICAgICAgICBMX3RtcDEgID0gZnhwX21hY18xNmJ5MTYoeXlbKGk8PDIpIC0zXSwgYVszXSwgTF90bXAxKTsKKyAgICAgICAgTF90bXAyICA9IGZ4cF9tYWNfMTZieTE2KHl5WyhpPDwyKSAtMl0sIGFbM10sIExfdG1wMik7CisgICAgICAgIExfdG1wMSAgPSBmeHBfbWFjXzE2YnkxNih5eVsoaTw8MikgLTJdLCBhWzJdLCBMX3RtcDEpOworICAgICAgICBMX3RtcDIgID0gZnhwX21hY18xNmJ5MTYoeXlbKGk8PDIpIC0xXSwgYVsyXSwgTF90bXAyKTsKKyAgICAgICAgTF90bXAxICA9IGZ4cF9tYWNfMTZieTE2KHl5WyhpPDwyKSAtMV0sIGFbMV0sIExfdG1wMSk7CisKKyAgICAgICAgZm9yIChqID0gNDsgaiA8IG07IGogKz0gMikKKyAgICAgICAgeworICAgICAgICAgICAgTF90bXAxICA9IGZ4cF9tYWNfMTZieTE2KHl5WyhpPDwyKS0xICAtIGpdLCBhW2orMV0sIExfdG1wMSk7CisgICAgICAgICAgICBMX3RtcDIgID0gZnhwX21hY18xNmJ5MTYoeXlbKGk8PDIpICAgIC0gal0sIGFbaisxXSwgTF90bXAyKTsKKyAgICAgICAgICAgIExfdG1wMSAgPSBmeHBfbWFjXzE2YnkxNih5eVsoaTw8MikgICAgLSBqXSwgYVtqICBdLCBMX3RtcDEpOworICAgICAgICAgICAgTF90bXAyICA9IGZ4cF9tYWNfMTZieTE2KHl5WyhpPDwyKSsxICAtIGpdLCBhW2ogIF0sIExfdG1wMik7CisgICAgICAgICAgICBMX3RtcDMgID0gZnhwX21hY18xNmJ5MTYoeXlbKGk8PDIpKzEgIC0gal0sIGFbaisxXSwgTF90bXAzKTsKKyAgICAgICAgICAgIExfdG1wNCAgPSBmeHBfbWFjXzE2YnkxNih5eVsoaTw8MikrMiAgLSBqXSwgYVtqKzFdLCBMX3RtcDQpOworICAgICAgICAgICAgTF90bXAzICA9IGZ4cF9tYWNfMTZieTE2KHl5WyhpPDwyKSsyICAtIGpdLCBhW2ogIF0sIExfdG1wMyk7CisgICAgICAgICAgICBMX3RtcDQgID0gZnhwX21hY18xNmJ5MTYoeXlbKGk8PDIpKzMgIC0gal0sIGFbaiAgXSwgTF90bXA0KTsKKyAgICAgICAgfQorCisgICAgICAgIExfdG1wMSAgPSBmeHBfbWFjXzE2YnkxNih5eVsoaTw8MikgICAgLSBqXSwgYVtqXSwgTF90bXAxKTsKKyAgICAgICAgTF90bXAyICA9IGZ4cF9tYWNfMTZieTE2KHl5WyhpPDwyKSsxICAtIGpdLCBhW2pdLCBMX3RtcDIpOworICAgICAgICBMX3RtcDMgID0gZnhwX21hY18xNmJ5MTYoeXlbKGk8PDIpKzIgIC0gal0sIGFbal0sIExfdG1wMyk7CisgICAgICAgIExfdG1wNCAgPSBmeHBfbWFjXzE2YnkxNih5eVsoaTw8MikrMyAgLSBqXSwgYVtqXSwgTF90bXA0KTsKKworICAgICAgICBMX3RtcDEgPSBzaGxfaW50MzIoTF90bXAxLCA0KTsKKyAgICAgICAgTF90bXAxID0gTF90bXAxID09IElOVDMyX01JTiA/IElOVDMyX01JTiArIDEgOiBMX3RtcDE7CisKKyAgICAgICAgeVsoaTw8MildID0geXlbKGk8PDIpXSA9IGFtcl93Yl9yb3VuZCgtTF90bXAxKTsKKworICAgICAgICBMX3RtcDIgID0gZnhwX21hY18xNmJ5MTYoeXlbKGk8PDIpXSwgYVsxXSwgTF90bXAyKTsKKworICAgICAgICBMX3RtcDIgPSBzaGxfaW50MzIoTF90bXAyLCA0KTsKKyAgICAgICAgTF90bXAyID0gTF90bXAyID09IElOVDMyX01JTiA/IElOVDMyX01JTiArIDEgOiBMX3RtcDI7CisKKyAgICAgICAgeVsoaTw8MikrMV0gPSB5eVsoaTw8MikrMV0gPSBhbXJfd2Jfcm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LCBtKnNpemVvZigqeSkpOworICAgIH0KKworICAgIHJldHVybjsKK30KKworLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCis7IEZVTkNUSU9OIENPREUKKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworCit2b2lkIFN5bl9maWx0XzMyKAorICAgIGludDE2IGFbXSwgICAgICAgICAgICAgIC8qIChpKSBRMTIgOiBhW20rMV0gcHJlZGljdGlvbiBjb2VmZmljaWVudHMgKi8KKyAgICBpbnQxNiBtLCAgICAgICAgICAgICAgICAvKiAoaSkgICAgIDogb3JkZXIgb2YgTFAgZmlsdGVyICAgICAgICAgICAgICovCisgICAgaW50MTYgZXhjW10sICAgICAgICAgICAgLyogKGkpIFFuZXc6IGV4Y2l0YXRpb24gKGV4Y1tpXSA+PiBRbmV3KSAgICAqLworICAgIGludDE2IFFuZXcsICAgICAgICAgICAgIC8qIChpKSAgICAgOiBleGMgc2NhbGluZyA9IDAobWluKSB0byA4KG1heCkgKi8KKyAgICBpbnQxNiBzaWdfaGlbXSwgICAgICAgICAvKiAobykgLzE2IDogc3ludGhlc2lzIGhpZ2ggICAgICAgICAgICAgICAgICovCisgICAgaW50MTYgc2lnX2xvW10sICAgICAgICAgLyogKG8pIC8xNiA6IHN5bnRoZXNpcyBsb3cgICAgICAgICAgICAgICAgICAqLworICAgIGludDE2IGxnICAgICAgICAgICAgICAgIC8qIChpKSAgICAgOiBzaXplIG9mIGZpbHRlcmluZyAgICAgICAgICAgICAgKi8KKykKK3sKKyAgICBpbnQxNiBpLCBrLCBhMDsKKyAgICBpbnQzMiBMX3RtcDE7CisgICAgaW50MzIgTF90bXAyOworICAgIGludDMyIExfdG1wMzsKKyAgICBpbnQzMiBMX3RtcDQ7CisKKyAgICBhMCA9IDkgLSBRbmV3OyAgICAgICAgLyogaW5wdXQgLyAxNiBhbmQgPj5RbmV3ICovCisKKyAgICAvKiBEbyB0aGUgZmlsdGVyaW5nLiAqLworCisgICAgZm9yIChpID0gMDsgaSA8IGxnID4+IDE7IGkrKykKKyAgICB7CisKKyAgICAgICAgTF90bXAzID0gMDsKKyAgICAgICAgTF90bXA0ID0gMDsKKworICAgICAgICBMX3RtcDEgPSBmeHBfbXVsXzE2YnkxNihzaWdfbG9bKGk8PDEpIC0gMV0sIGFbMV0pOworICAgICAgICBMX3RtcDIgPSBmeHBfbXVsXzE2YnkxNihzaWdfaGlbKGk8PDEpIC0gMV0sIGFbMV0pOworCisgICAgICAgIGZvciAoayA9IDI7IGsgPCBtOyBrICs9IDIpCisgICAgICAgIHsKKworICAgICAgICAgICAgTF90bXAxID0gZnhwX21hY18xNmJ5MTYoc2lnX2xvWyhpPDwxKS0xIC0ga10sIGFbaysxXSwgTF90bXAxKTsKKyAgICAgICAgICAgIExfdG1wMiA9IGZ4cF9tYWNfMTZieTE2KHNpZ19oaVsoaTw8MSktMSAtIGtdLCBhW2srMV0sIExfdG1wMik7CisgICAgICAgICAgICBMX3RtcDEgPSBmeHBfbWFjXzE2YnkxNihzaWdfbG9bKGk8PDEpICAgLSBrXSwgYVtrICBdLCBMX3RtcDEpOworICAgICAgICAgICAgTF90bXAyID0gZnhwX21hY18xNmJ5MTYoc2lnX2hpWyhpPDwxKSAgIC0ga10sIGFbayAgXSwgTF90bXAyKTsKKyAgICAgICAgICAgIExfdG1wMyA9IGZ4cF9tYWNfMTZieTE2KHNpZ19sb1soaTw8MSkgICAtIGtdLCBhW2srMV0sIExfdG1wMyk7CisgICAgICAgICAgICBMX3RtcDQgPSBmeHBfbWFjXzE2YnkxNihzaWdfaGlbKGk8PDEpICAgLSBrXSwgYVtrKzFdLCBMX3RtcDQpOworICAgICAgICAgICAgTF90bXAzID0gZnhwX21hY18xNmJ5MTYoc2lnX2xvWyhpPDwxKSsxIC0ga10sIGFbayAgXSwgTF90bXAzKTsKKyAgICAgICAgICAgIExfdG1wNCA9IGZ4cF9tYWNfMTZieTE2KHNpZ19oaVsoaTw8MSkrMSAtIGtdLCBhW2sgIF0sIExfdG1wNCk7CisgICAgICAgIH0KKworICAgICAgICBMX3RtcDEgPSAtZnhwX21hY18xNmJ5MTYoc2lnX2xvWyhpPDwxKSAgIC0ga10sIGFba10sIExfdG1wMSk7CisgICAgICAgIExfdG1wMyA9ICBmeHBfbWFjXzE2YnkxNihzaWdfbG9bKGk8PDEpKzEgLSBrXSwgYVtrXSwgTF90bXAzKTsKKyAgICAgICAgTF90bXAyID0gIGZ4cF9tYWNfMTZieTE2KHNpZ19oaVsoaTw8MSkgICAtIGtdLCBhW2tdLCBMX3RtcDIpOworICAgICAgICBMX3RtcDQgPSAgZnhwX21hY18xNmJ5MTYoc2lnX2hpWyhpPDwxKSsxIC0ga10sIGFba10sIExfdG1wNCk7CisKKworCisgICAgICAgIExfdG1wMSA+Pj0gMTE7ICAgICAgLyogLTQgOiBzaWdfbG9baV0gPDwgNCAqLworCisgICAgICAgIGludDY0IHNpZ190bXA7CisgICAgICAgIHNpZ190bXAgPSAoaW50NjQpTF90bXAxICsgKGludDMyKShleGNbKGk8PDEpXSA8PCBhMCk7CisgICAgICAgIExfdG1wMSA9IChpbnQzMikoc2lnX3RtcCAtIChMX3RtcDIgPDwgMSkpOworCisgICAgICAgIC8qIHNpZ19oaSA9IGJpdDE2IHRvIGJpdDMxIG9mIHN5bnRoZXNpcyAqLworICAgICAgICBMX3RtcDEgPSBzaGxfaW50MzIoTF90bXAxLCAzKTsgICAgICAgICAgIC8qIGFpIGluIFExMiAqLworCisgICAgICAgIHNpZ19oaVsoaTw8MSldID0gKGludDE2KShMX3RtcDEgPj4gMTYpOworCisgICAgICAgIExfdG1wNCA9IGZ4cF9tYWNfMTZieTE2KChpbnQxNikoTF90bXAxID4+IDE2KSwgYVsxXSwgTF90bXA0KTsKKworICAgICAgICAvKiBzaWdfbG8gPSBiaXQ0IHRvIGJpdDE1IG9mIHN5bnRoZXNpcyAqLworICAgICAgICAvKiBMX3RtcDEgPj49IDQgOiBzaWdfbG9baV0gPj4gNCAqLworICAgICAgICBzaWdfbG9bKGk8PDEpXSA9IChpbnQxNikoKExfdG1wMSA+PiA0KSAtICgoTF90bXAxID4+IDE2KSA8PCAxMikpOworCisgICAgICAgIExfdG1wMyA9IGZ4cF9tYWNfMTZieTE2KHNpZ19sb1soaTw8MSldLCBhWzFdLCBMX3RtcDMpOworICAgICAgICBMX3RtcDMgPSAtTF90bXAzID4+IDExOworCisgICAgICAgIHNpZ190bXAgPSAoaW50NjQpTF90bXAzICsgKGludDMyKShleGNbKGk8PDEpKzFdIDw8IGEwKTsKKyAgICAgICAgTF90bXAzID0gKGludDMyKShzaWdfdG1wIC0gKExfdG1wNCA8PCAxKSk7CisgICAgICAgIC8qIHNpZ19oaSA9IGJpdDE2IHRvIGJpdDMxIG9mIHN5bnRoZXNpcyAqLworICAgICAgICBMX3RtcDMgPSBzaGxfaW50MzIoTF90bXAzLCAzKTsgICAgICAgICAgIC8qIGFpIGluIFExMiAqLworICAgICAgICBzaWdfaGlbKGk8PDEpKzFdID0gKGludDE2KShMX3RtcDMgPj4gMTYpOworCisgICAgICAgIC8qIHNpZ19sbyA9IGJpdDQgdG8gYml0MTUgb2Ygc3ludGhlc2lzICovCisgICAgICAgIC8qIExfdG1wMSA+Pj0gNCA6IHNpZ19sb1tpXSA+PiA0ICovCisgICAgICAgIHNpZ19sb1soaTw8MSkrMV0gPSAoaW50MTYpKChMX3RtcDMgPj4gNCkgLSAoc2lnX2hpWyhpPDwxKSsxXSA8PCAxMikpOworICAgIH0KKworfQorCisKZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L2NvZGVjcy9hbXJ3Yi9zcmMvd2VpZ2h0X2FtcndiX2xwYy5jcHAgYi9tZWRpYS9jb2RlY3MvYW1yd2Iv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W1yd2JlbmMiLAorICAgIHZlbmRvcl9hdmFpbGFibGU6IHRydWUsCisgICAgbWluX3Nka192ZXJzaW9uOiAiMjkiLAorCisgICAgc3JjczogWworICAgICAgICAic3JjL2F1dG9jb3JyLmMiLAorICAgICAgICAic3JjL2F6X2lzcC5jIiwKKyAgICAgICAgInNyYy9iaXRzLmMiLAorICAgICAgICAic3JjL2MydDY0ZnguYyIsCisgICAgICAgICJzcmMvYzR0NjRmeC5jIiwKKyAgICAgICAgInNyYy9jb252b2x2ZS5jIiwKKyAgICAgICAgInNyYy9jb3JfaF94LmMiLAorICAgICAgICAic3JjL2RlY2ltNTQuYyIsCisgICAgICAgICJzcmMvZGVlbXBoLmMiLAorICAgICAgICAic3JjL2R0eC5jIiwKKyAgICAgICAgInNyYy9nX3BpdGNoLmMiLAorICAgICAgICAic3JjL2dwY2xpcC5jIiwKKyAgICAgICAgInNyYy9ob21pbmcuYyIsCisgICAgICAgICJzcmMvaHA0MDAuYyIsCisgICAgICAgICJzcmMvaHA1MC5jIiwKKyAgICAgICAgInNyYy9ocDZrLmMiLAorICAgICAgICAic3JjL2hwX3dzcC5jIiwKKyAgICAgICAgInNyYy9pbnRfbHBjLmMiLAorICAgICAgICAic3JjL2lzcF9hei5jIiwKKyAgICAgICAgInNyYy9pc3BfaXNmLmMiLAorICAgICAgICAic3JjL2xhZ193aW5kLmMiLAorICAgICAgICAic3JjL2xldmluc29uLmMiLAorICAgICAgICAic3JjL2xvZzIuYyIsCisgICAgICAgICJzcmMvbHBfZGVjMi5jIiwKKyAgICAgICAgInNyYy9tYXRoX29wLmMiLAorICAgICAgICAic3JjL29wZXJfMzJiLmMiLAorICAgICAgICAic3JjL3BfbWVkX29sLmMiLAorICAgICAgICAic3JjL3BpdF9zaHJwLmMiLAorICAgICAgICAic3JjL3BpdGNoX2Y0LmMiLAorICAgICAgICAic3JjL3ByZWRfbHQ0LmMiLAorICAgICAgICAic3JjL3ByZWVtcGguYyIsCisgICAgICAgICJzcmMvcV9nYWluMi5jIiwKKyAgICAgICAgInNyYy9xX3B1bHNlLmMiLAorICAgICAgICAic3JjL3Fpc2ZfbnMuYyIsCisgICAgICAgICJzcmMvcXBpc2ZfMnMuYyIsCisgICAgICAgICJzcmMvcmFuZG9tLmMiLAorICAgICAgICAic3JjL3Jlc2lkdS5jIiwKKyAgICAgICAgInNyYy9zY2FsZS5jIiwKKyAgICAgICAgInNyYy9zdHJlYW0uYyIsCisgICAgICAgICJzcmMvc3luX2ZpbHQuYyIsCisgICAgICAgICJzcmMvdXBkdF90YXIuYyIsCisgICAgICAgICJzcmMvdXRpbC5jIiwKKyAgICAgICAgInNyYy92b0FNUldCRW5jLmMiLAorICAgICAgICAic3JjL3ZvaWNlZmFjLmMiLAorICAgICAgICAic3JjL3diX3ZhZC5jIiwKKyAgICAgICAgInNyYy93ZWlnaHRfYS5jIiwKKyAgICAgICAgInNyYy9tZW1fYWxpZ24uYyIsCisgICAgXSwKKworICAgIGFyY2g6IHsKKyAgICAgICAgYXJtOiB7CisgICAgICAgICAgICBzcmNzOiBbCisgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL2NvbnZvbHZlX29wdC5zIiwKKyAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvY29yX2hfdmVjX29wdC5zIiwKKyAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvRGVlbXBoXzMyX29wdC5zIiwKKyAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvRG90X3Bfb3B0LnMiLAorICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9GaWx0XzZrXzdrX29wdC5zIiwKKyAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvTm9ybV9Db3JyX29wdC5zIiwKKyAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvcHJlZF9sdDRfMV9vcHQucyIsCisgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL3Jlc2lkdV9hc21fb3B0LnMiLAorICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9zY2FsZV9zaWdfb3B0LnMiLAorICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9TeW5fZmlsdF8zMl9vcHQucyIsCisgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL3N5bl9maWx0X29wdC5zIiwKKyAgICAgICAgICAgIF0sCisKKyAgICAgICAgICAgIGNmbGFnczogWworICAgICAgICAgICAgICAgICItREFSTSIsCisgICAgICAgICAgICAgICAgIi1EQVNNX09QVCIsCisgICAgICAgICAgICBdLAorICAgICAgICAgICAgbG9jYWxfaW5jbHVkZV9kaXJzOiBbInNyYy9hc20vQVJNVjVFIl0sCisKKyAgICAgICAgICAgIGluc3RydWN0aW9uX3NldDogImFybSIsCisKKyAgICAgICAgICAgIG5lb246IHsKKyAgICAgICAgICAgICAgICBleGNsdWRlX3NyY3M6IFsKKyAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL2NvbnZvbHZlX29wdC5zIiwKKyAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL2Nvcl9oX3ZlY19vcHQucyIsCisgICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9EZWVtcGhfMzJfb3B0LnMiLAorICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvRG90X3Bfb3B0LnMiLAorICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvRmlsdF82a183a19vcHQucyIsCisgICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9Ob3JtX0NvcnJfb3B0LnMiLAorICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvcHJlZF9sdDRfMV9vcHQucyIsCisgICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9yZXNpZHVfYXNtX29wdC5zIiwKKyAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL3NjYWxlX3NpZ19vcHQucyIsCisgICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9TeW5fZmlsdF8zMl9vcHQucyIsCisgICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9zeW5fZmlsdF9vcHQucyIsCisgICAgICAgICAgICAgICAgXSwKKworICAgICAgICAgICAgICAgIHNyY3M6IFsKKyAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjcvY29udm9sdmVfbmVvbi5zIiwKKyAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjcvY29yX2hfdmVjX25lb24ucyIsCisgICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY3L0RlZW1waF8zMl9uZW9uLnMiLAorICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNy9Eb3RfcF9uZW9uLnMiLAorICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNy9GaWx0XzZrXzdrX25lb24ucyIsCisgICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY3L05vcm1fQ29ycl9uZW9uLnMiLAorICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNy9wcmVkX2x0NF8xX25lb24ucyIsCisgICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY3L3Jlc2lkdV9hc21fbmVvbi5zIiwKKyAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjcvc2NhbGVfc2lnX25lb24ucyIsCisgICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY3L1N5bl9maWx0XzMyX25lb24ucyIsCisgICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY3L3N5bl9maWx0X25lb24ucyIsCisgICAgICAgICAgICAgICAgXSwKKworICAgICAgICAgICAgICAgIC8vIGRvbid0IGFjdHVhbGx5IGdlbmVyYXRlIG5lb24gaW5zdHJ1Y3Rpb25zLCBzZWUgYnVnIDI2OTMyOTgwCisgICAgICAgICAgICAgICAgY2ZsYWdzOiBbCisgICAgICAgICAgICAgICAgICAgICItREFSTVY3IiwKKyAgICAgICAgICAgICAgICAgICAgIi1tZnB1PXZmcHYzIiwKKyAgICAgICAgICAgICAgICBdLAorICAgICAgICAgICAgICAgIGxvY2FsX2luY2x1ZGVfZGlyczogWworICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUiLAorICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNyIsCisgICAgICAgICAgICAgICAgXSwKKyAgICAgICAgICAgIH0sCisKKyAgICAgICAgfSwKKyAgICB9LAorCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJmcmFtZXdvcmtzL2F2L2luY2x1ZGUiLAorICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9saWJzdGFnZWZyaWdodC9pbmNsdWRlIiwKKyAgICBdLAorCisgICAgbG9jYWxfaW5jbHVkZV9kaXJzOiBbInNyYyJdLAorICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsiaW5jIl0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGlic3RhZ2VmcmlnaHRfZW5jX2NvbW1vbiIsCisgICAgICAgICJsaWJsb2ciLAorICAgIF0sCisKKyAgICBjZmxhZ3M6IFsiLVdlcnJvciJdLAorICAgIHNhbml0aXplOiB7CisgICAgICAgIGNmaTogdHJ1ZSwKKyAgICB9LAorCisgICAgaG9zdF9zdXBwb3J0ZWQ6IHRydWUsCisgICAgdGFyZ2V0OiB7CisgICAgICAgIGRhcndpbjogeworICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsCisgICAgICAgIH0sCisgICAgfSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L2NvZGVjcy9hbXJuYi9lbmMvTU9EVUxFX0xJQ0VOU0VfQVBBQ0hFMiBiL21lZGlhL2NvZGVjcy9hbXJ3Yi9lbmMvTU9EVUxFX0xJQ0VO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AgICAgICBkZWxldGUgbUFwaUhhbmRsZTsKKyAgICAgICAgbUFwaUhhbmRsZSA9IG51bGxwdHI7CisgICAgfQorICAgIGlmIChtTWVtT3BlcmF0b3IpIHsKKyAgICAgICAgZGVsZXRlIG1NZW1PcGVyYXRvcjsKKyAgICAgICAgbU1lbU9wZXJhdG9yID0gbnVsbHB0cjsKKyAgICB9Cit9CisKK3ZvaWQgQ29kZWM6OmVuY29kZUZyYW1lcyhjb25zdCB1aW50OF90ICpkYXRhLCBzaXplX3Qgc2l6ZSkgeworICAgIGRvIHsKKyAgICAgICAgaW50MzJfdCBtaW5TaXplID0gc3RkOjptaW4oKGludDMyX3Qpc2l6ZSwga0lucHV0QnVmZmVyU2l6ZSk7CisgICAgICAgIHVpbnQ4X3Qgb3V0cHV0QnVmW2tPdXRwdXRCdWZmZXJTaXplXSA9IHt9OworICAgICAgICBWT19DT0RFQ0JVRkZFUiBpbkRhdGE7CisgICAgICAgIFZPX0NPREVDQlVGRkVSIG91dERhdGE7CisgICAgICAgIFZPX0FVRElPX09VVFBVVElORk8gb3V0Rm9ybWF0OworICAgICAgICBpbkRhdGEuQnVmZmVyID0gKHVuc2lnbmVkIGNoYXIgKilkYXRhOworICAgICAgICBpbkRhdGEuTGVuZ3RoID0gbWluU2l6ZTsKKyAgICAgICAgb3V0RGF0YS5CdWZmZXIgPSBvdXRwdXRCdWY7CisgICAgICAgIG1BcGlIYW5kbGUtPlNldElucHV0RGF0YShtRW5jb2RlckhhbmRsZSwgJmluRGF0YSk7CisgICAgICAgIG1BcGlIYW5kbGUtPkdldE91dHB1dERhdGEobUVuY29kZXJIYW5kbGUsICZvdXREYXRhLCAmb3V0Rm9ybWF0KTsKKyAgICAgICAgZGF0YSArPSBtaW5TaXplOworICAgICAgICBzaXplIC09IG1pblNpemU7CisgICAgfSB3aGlsZSAoc2l6ZSA+IDApOworfQorCitleHRlcm4gIkMiIGludCBMTFZNRnV6emVyVGVzdE9uZUlucHV0KGNvbnN0IHVpbnQ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IGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuCisgKiogU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAorICoqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLgorICovCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgICAgIEZpbGU6IHByZWVtcGguYyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCisqICAgICAgRGVzY3JpcHRpb246IFByZWVtcGhhc2lzOiBmaWx0ZXJpbmcgdGhyb3VnaCAxIC0gZyB6Xi0xICAgICAgICAgKgorKiAgICAgICAgICAgICAgUHJlZW1waDIgLS0+IHNpZ25hbCBpcyBtdWx0aXBsaWVkIGJ5IDIgICAgICAgICAgICAgKgorKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2luY2x1ZGUgInR5cGVkZWYuaCIKKyNpbmNsdWRlICJiYXNpY19vcC5oIgorI2luY2x1ZGUgPHN0ZGludC5oPgorCit2b2lkIFByZWVtcGgoCisgICAgICAgIFdvcmQxNiB4W10sICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkvbykgICA6IGlucHV0IHNpZ25hbCBvdmVyd3JpdHRlbiBieSB0aGUgb3V0cHV0ICovCisgICAgICAgIFdvcmQxNiBtdSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIFExNSA6IHByZWVtcGhhc2lzIGNvZWZmaWNpZW50ICAgICAgICAgICAgICAgICovCisgICAgICAgIFdvcmQxNiBsZywgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpICAgICA6IGxlbmdodCBvZiBmaWx0ZXJpbmcgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgIFdvcmQxNiAqIG1lbSAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkvbykgICA6IG1lbW9yeSAoeFstMV0pICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICkKK3sKKyAgICBXb3JkMTYgdGVtcDsKKyAgICBXb3JkMzIgaSwgTF90bXA7CisKKyAgICB0ZW1wID0geFtsZyAtIDFdOworCisgICAgZm9yIChpID0gbGcgLSAxOyBpID4gMDsgaS0tKQorICAgIHsKKyAgICAgICAgTF90bXAgPSBMX2RlcG9zaXRfaCh4W2ldKTsKKyAgICAgICAgTF90bXAgLT0gKHhbaSAtIDFdICogbXUpPDwxOworICAgICAgICB4W2ldID0gKExfdG1wICsgMHg4MDAwKT4+MTY7CisgICAgfQorCisgICAgTF90bXAgPSBMX2RlcG9zaXRfaCh4WzBdKTsKKyAgICBMX3RtcCAtPSAoKCptZW0pICogbXUpPDwxOworICAgIHhbMF0gPSAoTF90bXAgKyAweDgwMDApPj4xNjsKKworICAgICptZW0gPSB0ZW1wOworCisgICAgcmV0dXJuOworfQorCisKK3ZvaWQgUHJlZW1waDIoCisgICAgICAgIFdvcmQxNiB4W10sICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkvbykgICA6IGlucHV0IHNpZ25hbCBvdmVyd3JpdHRlbiBieSB0aGUgb3V0cHV0ICovCisgICAgICAgIFdvcmQxNiBtdSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIFExNSA6IHByZWVtcGhhc2lzIGNvZWZmaWNpZW50ICAgICAgICAgICAgICAgICovCisgICAgICAgIFdvcmQxNiBsZywgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpICAgICA6IGxlbmdodCBvZiBmaWx0ZXJpbmcgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgIFdvcmQxNiAqIG1lbSAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkvbykgICA6IG1lbW9yeSAoeFstMV0pICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICApCit7CisgICAgV29yZDE2IHRlbXA7CisgICAgV29yZDMyIGksIExfdG1wOworCisgICAgdGVtcCA9IHhbbGcgLSAxXTsKKworICAgIGZvciAoaSA9IChXb3JkMTYpIChsZyAtIDEpOyBpID4gMDsgaS0tKQorICAgIHsKKyAgICAgICAgTF90bXAgPSBMX2RlcG9zaXRfaCh4W2ldKTsKKyAgICAgICAgTF90bXAgLT0gKHhbaSAtIDFdICogbXUpPDwxOyAvLyBvbmx5IGNhbGxlZCB3aXRoIG11ID09IDIyMjgyLCBzbyB0aGlzIHdvbid0IG92ZXJmbG93CisgICAgICAgIGlmIChMX3RtcCA+IElOVDMyX01BWCAvIDIpIHsKKyAgICAgICAgICAgIExfdG1wID0gSU5UMzJfTUFYIC8gMjsKKyAgICAgICAgfQorICAgICAgICBMX3RtcCA9IChMX3RtcCA8PCAxKTsKKyAgICAgICAgaWYgKExfdG1wID4gSU5UMzJfTUFYIC0gMHg4MDAwKSB7CisgICAgICAgICAgICBMX3RtcCA9IElOVDMyX01BWCAtIDB4ODAwMDsKKyAgICAgICAgfQorICAgICAgICB4W2ldID0gKExfdG1wICsgMHg4MDAwKT4+MTY7CisgICAgfQorCisgICAgTF90bXAgPSBMX2RlcG9zaXRfaCh4WzBdKTsKKyAgICBMX3RtcCAtPSAoKCptZW0pICogbXUpPDwxOworICAgIGlmIChMX3RtcCA+IElOVDMyX01BWCAvIDIpIHsKKyAgICAgICAgTF90bXAgPSBJTlQzMl9NQVggLyAyOworICAgIH0KKyAgICBMX3RtcCA9IChMX3RtcCA8PCAxKTsKKyAgICBpZiAoTF90bXAgPiBJTlQzMl9NQVggLSAweDgwMDApIHsKKyA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iAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wCisgKioKKyAqKiBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlCisgKiogZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gIkFTIElTIiBCQVNJUywKKyAqKiBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4KKyAqKiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCisgKiogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgRmlsZTogcV9wdWxzZS5jICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgorKiAgICAgIERlc2NyaXB0aW9uOiBDb2RpbmcgYW5kIGRlY29kaW5nIG9mIGFsZ2VicmFpYyBjb2RlYm9vayAgICAgICAgICAqCisqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2luY2x1ZGUgPHN0ZGlvLmg+CisjaW5jbHVkZSAidHlwZWRlZi5oIgorI2luY2x1ZGUgImJhc2ljX29wLmgiCisjaW5jbHVkZSAicV9wdWxzZS5oIgorCisjZGVmaW5lIE5CX1BPUyAxNiAgICAgICAgICAgICAgICAgICAgICAgICAgLyogcG9zIGluIHRyYWNrLCBtYXNrIGZvciBzaWduIGJpdCAqLworI2RlZmluZSBVTlVTRURfVkFSIF9fYXR0cmlidXRlX18oKHVudXNlZCkpCisKK1dvcmQzMiBxdWFudF8xcF9OMSggICAgICAgICAgICAgICAgICAgICAgICAvKiAobykgcmV0dXJuIE4rMSBiaXRzICAgICAgICAgICAgICovCisgICAgICAgIFdvcmQxNiBwb3MsICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIHBvc2l0aW9uIG9mIHRoZSBwdWxzZSAgICAgICAqLworICAgICAgICBXb3JkMTYgTikgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBudW1iZXIgb2YgYml0cyBmb3IgcG9zaXRpb24gKi8KK3sKKyAgICBXb3JkMTYgbWFzazsKKyAgICBXb3JkMzIgaW5kZXg7CisKKyAgICBtYXNrID0gKDEgPDwgTikgLSAxOyAgICAgICAgICAgICAgLyogbWFzayA9ICgoMTw8TiktMSk7ICovCisgICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKgorICAgICAqIFF1YW50aXphdGlvbiBvZiAxIHB1bHNlIHdpdGggTisxIGJpdHM6ICAgICAgICAgICAgICAgICoKKyAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworICAgIGluZGV4ID0gTF9kZXBvc2l0X2woKFdvcmQxNikgKHBvcyAmIG1hc2spKTsKKyAgICBpZiAoKHBvcyAmIE5CX1BPUykgIT0gMCkKKyAgICB7CisgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIExfZGVwb3NpdF9sKDEgPDwgTikpOyAgIC8qIGluZGV4ICs9IDEgPDwgTjsgKi8KKyAgICB9CisgICAgcmV0dXJuIChpbmRleCk7Cit9CisKKworV29yZDMyIHF1YW50XzJwXzJOMSggICAgICAgICAgICAgICAgICAgICAgIC8qIChvKSByZXR1cm4gKDIqTikrMSBiaXRzICAgICAgICAgKi8KKyAgICAgICAgV29yZDE2IHBvczEsICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgcG9zaXRpb24gb2YgdGhlIHB1bHNlIDEgICAgICovCisgICAgICAgIFdvcmQxNiBwb3MyLCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIHBvc2l0aW9uIG9mIHRoZSBwdWxzZSAyICAgICAqLworICAgICAgICBXb3JkMTYgTikgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBudW1iZXIgb2YgYml0cyBmb3IgcG9zaXRpb24gKi8KK3sKKyAgICBXb3JkMTYgbWFzaywgdG1wOworICAgIFdvcmQzMiBpbmRleDsKKyAgICBtYXNrID0gKDEgPDwgTikgLSAxOyAgICAgICAgICAgICAgLyogbWFzayA9ICgoMTw8TiktMSk7ICovCisgICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKgorICAgICAqIFF1YW50aXphdGlvbiBvZiAyIHB1bHNlcyB3aXRoIDIqTisxIGJpdHM6ICAgICAgICAgICAgICoKKyAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworICAgIGlmICgoKHBvczIgXiBwb3MxKSAmIE5CX1BPUykgPT0gMCkKKyAgICB7CisgICAgICAgIC8qIHNpZ24gb2YgMXN0IHB1bHNlID09IHNpZ24gb2YgMnRoIHB1bHNlICovCisgICAgICAgIGlmKHBvczEgPD0gcG9zMikgICAgICAgICAgLyogKChwb3MxIC0gcG9zMikgPD0gMCkgKi8KKyAgICAgICAgeworICAgICAgICAgICAgLyogaW5kZXggPSAoKHBvczEgJiBtYXNrKSA8PCBOKSArIChwb3MyICYgbWFzayk7ICovCisgICAgICAgICAgICBpbmRleCA9IExfZGVwb3NpdF9sKGFkZDEoKCgoV29yZDE2KSAocG9zMSAmIG1hc2spKSA8PCBOKSwgKChXb3JkMTYpIChwb3MyICYgbWFzaykpKSk7CisgICAgICAgIH0gZWxzZQorICAgICAgICB7CisgICAgICAgICAgICAvKiAoKHBvczIgJiBtYXNrKSA8PCBOKSArIChwb3MxICYgbWFzayk7ICovCisgICAgICAgICAgICBpbmRleCA9IExfZGVwb3NpdF9sKGFkZDEoKCgoV29yZDE2KSAocG9zMiAmIG1hc2spKSA8PCBOKSwgKChXb3JkMTYpIChwb3MxICYgbWFzaykpKSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKChwb3MxICYgTkJfUE9TKSAhPSAwKQorICAgICAgICB7CisgICAgICAgICAgICB0bXAgPSAoTiA8PCAxKTsKKyAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsICgxTCA8PCB0bXApKTsgICAgICAgLyogaW5kZXggKz0gMSA8PCAoMipOKTsgKi8KKyAgICAgICAgfQorICAgIH0gZWxzZQorICAgIHsKKyAgICAgICAgLyogc2lnbiBvZiAxc3QgcHVsc2UgIT0gc2lnbiBvZiAydGggcHVsc2UgKi8KKyAgICAgICAgaWYgKHZvX3N1YigoV29yZDE2KSAocG9zMSAmIG1hc2spLCAoV29yZDE2KSAocG9zMiAmIG1hc2spKSA8PSAwKQorICAgICAgICB7CisgICAgICAgICAgICAvKiBpbmRleCA9ICgocG9zMiAmIG1hc2spIDw8IE4pICsgKHBvczEgJiBtYXNrKTsgKi8KKyAgICAgICAgICAgIGluZGV4ID0gTF9kZXBvc2l0X2woYWRkMSgoKChXb3JkMTYpIChwb3MyICYgbWFzaykpIDw8IE4pLCAoKFdvcmQxNikgKHBvczEgJiBtYXNrKSkpKTsKKyAgICAgICAgICAgIGlmICgocG9zMiAmIE5CX1BPUykgIT0gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0bXAgPSAoTiA8PCAxKTsgICAgICAgICAgIC8qIGluZGV4ICs9IDEgPDwgKDIqTik7ICovCisgICAgICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgKDFMIDw8IHRtcCkpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgLyogaW5kZXggPSAoKHBvczEgJiBtYXNrKSA8PCBOKSArIChwb3MyICYgbWFzayk7ICAgICAqLworICAgICAgICAgICAgaW5kZXggPSBMX2RlcG9zaXRfbChhZGQxKCgoKFdvcmQxNikgKHBvczEgJiBtYXNrKSkgPDwgTiksICgoV29yZDE2KSAocG9zMiAmIG1hc2spKSkpOworICAgICAgICAgICAgaWYgKChwb3MxICYgTkJfUE9TKSAhPSAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRtcCA9IChOIDw8IDEpOworICAgICAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsICgxIDw8IHRtcCkpOyAgICAvKiBpbmRleCArPSAxIDw8ICgyKk4pOyAqLworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorICAgIHJldHVybiAoaW5kZXgpOworfQorCisKK1dvcmQzMiBxdWFudF8zcF8zTjEoICAgICAgICAgICAgICAgICAgICAgICAvKiAobykgcmV0dXJuICgzKk4pKzEgYml0cyAgICAgICAgICovCisgICAgICAgIFdvcmQxNiBwb3MxLCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIHBvc2l0aW9uIG9mIHRoZSBwdWxzZSAxICAgICAqLworICAgICAgICBXb3JkMTYgcG9zMiwgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBwb3NpdGlvbiBvZiB0aGUgcHVsc2UgMiAgICAgKi8KKyAgICAgICAgV29yZDE2IHBvczMsICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgcG9zaXRpb24gb2YgdGhlIHB1bHNlIDMgICAgICovCisgICAgICAgIFdvcmQxNiBOKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIG51bWJlciBvZiBiaXRzIGZvciBwb3NpdGlvbiAqLworeworICAgIFdvcmQxNiBuYl9wb3M7CisgICAgV29yZDMyIGluZGV4OworCisgICAgbmJfcG9zID0oMSA8PChOIC0gMSkpOyAgICAgICAgICAgIC8qIG5iX3BvcyA9ICgxPDwoTi0xKSk7ICovCisgICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKgorICAgICAqIFF1YW50aXphdGlvbiBvZiAzIHB1bHNlcyB3aXRoIDMqTisxIGJpdHM6ICAgICAgICAgICAgICoKKyAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworICAgIGlmICgoKHBvczEgXiBwb3MyKSAmIG5iX3BvcykgPT0gMCkKKyAgICB7CisgICAgICAgIGluZGV4ID0gcXVhbnRfMnBfMk4xKHBvczEsIHBvczIsIHN1YihOLCAxKSk7ICAgIC8qIGluZGV4ID0gcXVhbnRfMnBfMk4xKHBvczEsIHBvczIsIChOLTEpKTsgKi8KKyAgICAgICAgLyogaW5kZXggKz0gKHBvczEgJiBuYl9wb3MpIDw8IE47ICovCisgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIChMX2RlcG9zaXRfbCgoV29yZDE2KSAocG9zMSAmIG5iX3BvcykpIDw8IE4pKTsKKyAgICAgICAgLyogaW5kZXggKz0gcXVhbnRfMXBfTjEocG9zMywgTikgPDwgKDIqTik7ICovCisgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIChxdWFudF8xcF9OMShwb3MzLCBOKTw8KE4gPDwgMSkpKTsKKworICAgIH0gZWxzZSBpZiAoKChwb3MxIF4gcG9zMykgJiBuYl9wb3MpID09IDApCisgICAgeworICAgICAgICBpbmRleCA9IHF1YW50XzJwXzJOMShwb3MxLCBwb3MzLCBzdWIoTiwgMSkpOyAgICAvKiBpbmRleCA9IHF1YW50XzJwXzJOMShwb3MxLCBwb3MzLCAoTi0xKSk7ICovCisgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIChMX2RlcG9zaXRfbCgoV29yZDE2KSAocG9zMSAmIG5iX3BvcykpIDw8IE4pKTsKKyAgICAgICAgLyogaW5kZXggKz0gKHBvczEgJiBuYl9wb3MpIDw8IE47ICovCisgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIChxdWFudF8xcF9OMShwb3MyLCBOKSA8PCAoTiA8PCAxKSkpOworICAgICAgICAvKiBpbmRleCArPSBxdWFudF8xcF9OMShwb3MyLCBOKSA8PAorICAgICAgICAgKiAoMipOKTsgKi8KKyAgICB9IGVsc2UKKyAgICB7CisgICAgICAgIGluZGV4ID0gcXVhbnRfMnBfMk4xKHBvczIsIHBvczMsIChOIC0gMSkpOyAgICAvKiBpbmRleCA9IHF1YW50XzJwXzJOMShwb3MyLCBwb3MzLCAoTi0xKSk7ICovCisgICAgICAgIC8qIGluZGV4ICs9IChwb3MyICYgbmJfcG9zKSA8PCBOOyAgICAgICAgICAgICovCisgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIChMX2RlcG9zaXRfbCgoV29yZDE2KSAocG9zMiAmIG5iX3BvcykpIDw8IE4pKTsKKyAgICAgICAgLyogaW5kZXggKz0gcXVhbnRfMXBfTjEocG9zMSwgTikgPDwgKDIqTik7ICAgKi8KKyAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgKHF1YW50XzFwX04xKHBvczEsIE4pIDw8IChOIDw8IDEpKSk7CisgICAgfQorICAgIHJldHVybiAoaW5kZXgpOworfQorCisKK1dvcmQzMiBxdWFudF80cF80TjEoICAgICAgICAgICAgICAgICAgICAgICAvKiAobykgcmV0dXJuICg0Kk4pKzEgYml0cyAgICAgICAgICovCisgICAgICAgIFdvcmQxNiBwb3MxLCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIHBvc2l0aW9uIG9mIHRoZSBwdWxzZSAxICAgICAqLworICAgICAgICBXb3JkMTYgcG9zMiwgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBwb3NpdGlvbiBvZiB0aGUgcHVsc2UgMiAgICAgKi8KKyAgICAgICAgV29yZDE2IHBvczMsICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgcG9zaXRpb24gb2YgdGhlIHB1bHNlIDMgICAgICovCisgICAgICAgIFdvcmQxNiBwb3M0LCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIHBvc2l0aW9uIG9mIHRoZSBwdWxzZSA0ICAgICAqLworICAgICAgICBXb3JkMTYgTikgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBudW1iZXIgb2YgYml0cyBmb3IgcG9zaXRpb24gKi8KK3sKKyAgICBXb3JkMTYgbmJfcG9zOworICAgIFdvcmQzMiBpbmRleDsKKworICAgIG5iX3BvcyA9IDEgPDwgKE4gLSAxKTsgICAgICAgICAgICAvKiBuYl9wb3MgPSAoMTw8KE4tMSkpOyAgKi8KKyAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCisgICAgICogUXVhbnRpemF0aW9uIG9mIDQgcHVsc2VzIHdpdGggNCpOKzEgYml0czogICAgICAgICAgICAgKgorICAgICAqLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCisgICAgaWYgKCgocG9zMSBeIHBvczIpICYgbmJfcG9zKSA9PSAwKQorICAgIHsKKyAgICAgICAgaW5kZXggPSBxdWFudF8ycF8yTjEocG9zMSwgcG9zMiwgc3ViKE4sIDEpKTsgICAgLyogaW5kZXggPSBxdWFudF8ycF8yTjEocG9zMSwgcG9zMiwgKE4tMSkpOyAqLworICAgICAgICAvKiBpbmRleCArPSAocG9zMSAmIG5iX3BvcykgPDwgTjsgICAgKi8KKyAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgKExfZGVwb3NpdF9sKChXb3JkMTYpIChwb3MxICYgbmJfcG9zKSkgPDwgTikpOworICAgICAgICAvKiBpbmRleCArPSBxdWFudF8ycF8yTjEocG9zMywgcG9zNCwgTikgPDwgKDIqTik7ICovCisgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIChxdWFudF8ycF8yTjEocG9zMywgcG9zNCwgTikgPDwgKE4gPDwgMSkpKTsKKyAgICB9IGVsc2UgaWYgKCgocG9zMSBeIHBvczMpICYgbmJfcG9zKSA9PSAwKQorICAgIHsKKyAgICAgICAgaW5kZXggPSBxdWFudF8ycF8yTjEocG9zMSwgcG9zMywgKE4gLSAxKSk7CisgICAgICAgIC8qIGluZGV4ICs9IChwb3MxICYgbmJfcG9zKSA8PCBOOyAqLworICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCAoTF9kZXBvc2l0X2woKFdvcmQxNikgKHBvczEgJiBuYl9wb3MpKSA8PCBOKSk7CisgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzJwXzJOMShwb3MyLCBwb3M0LCBOKSA8PCAoMipOKTsgKi8KKyAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgKHF1YW50XzJwXzJOMShwb3MyLCBwb3M0LCBOKSA8PCAoTiA8PCAxKSkpOworICAgIH0gZWxzZQorICAgIHsKKyAgICAgICAgaW5kZXggPSBxdWFudF8ycF8yTjEocG9zMiwgcG9zMywgKE4gLSAxKSk7CisgICAgICAgIC8qIGluZGV4ICs9IChwb3MyICYgbmJfcG9zKSA8PCBOOyAqLworICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCAoTF9kZXBvc2l0X2woKFdvcmQxNikgKHBvczIgJiBuYl9wb3MpKSA8PCBOKSk7CisgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzJwXzJOMShwb3MxLCBwb3M0LCBOKSA8PCAoMipOKTsgKi8KKyAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgKHF1YW50XzJwXzJOMShwb3MxLCBwb3M0LCBOKSA8PCAoTiA8PCAxKSkpOworICAgIH0KKyAgICByZXR1cm4gKGluZGV4KTsKK30KKworCitXb3JkMzIgcXVhbnRfNHBfNE4oICAgICAgICAgICAgICAgICAgICAgICAgLyogKG8pIHJldHVybiA0Kk4gYml0cyAgICAgICAgICAgICAqLworICAgICAgICBXb3JkMTYgcG9zW10sICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBwb3NpdGlvbiBvZiB0aGUgcHVsc2UgMS4uNCAgKi8KKyAgICAgICAgV29yZDE2IE4pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgbnVtYmVyIG9mIGJpdHMgZm9yIHBvc2l0aW9uICovCit7CisgICAgV29yZDE2IG5iX3BvcywgbWFzayBVTlVTRURfVkFSLCBuXzEsIHRtcDsKKyAgICBXb3JkMTYgcG9zQVs0XSwgcG9zQls0XTsKKyAgICBXb3JkMzIgaSwgaiwgaywgaW5kZXg7CisKKyAgICBuXzEgPSAoV29yZDE2KSAoTiAtIDEpOworICAgIG5iX3BvcyA9ICgxIDw8IG5fMSk7ICAgICAgICAgICAgICAgICAgLyogbmJfcG9zID0gKDE8PG5fMSk7ICovCisgICAgbWFzayA9IHZvX3N1YigoMSA8PCBOKSwgMSk7ICAgICAgICAgICAgICAvKiBtYXNrID0gKCgxPDxOKS0xKTsgKi8KKworICAgIGkgPSAwOworICAgIGogPSAwOworICAgIGZvciAoayA9IDA7IGsgPCA0OyBrKyspCisgICAgeworICAgICAgICBpZiAoKHBvc1trXSAmIG5iX3BvcykgPT0gMCkKKyAgICAgICAgeworICAgICAgICAgICAgcG9zQVtpKytdID0gcG9zW2tdOworICAgICAgICB9IGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgcG9zQltqKytdID0gcG9zW2tdOworICAgICAgICB9CisgICAgfQorCisgICAgc3dpdGNoIChpKQorICAgIHsKKyAgICAgICAgY2FzZSAwOgorICAgICAgICAgICAgdG1wID0gdm9fc3ViKChOIDw8IDIpLCAzKTsgICAgICAgICAgIC8qIGluZGV4ID0gMSA8PCAoKDQqTiktMyk7ICovCisgICAgICAgICAgICBpbmRleCA9ICgxTCA8PCB0bXApOworICAgICAgICAgICAgLyogaW5kZXggKz0gcXVhbnRfNHBfNE4xKHBvc0JbMF0sIHBvc0JbMV0sIHBvc0JbMl0sIHBvc0JbM10sIG5fMSk7ICovCisgICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCBxdWFudF80cF80TjEocG9zQlswXSwgcG9zQlsxXSwgcG9zQlsyXSwgcG9zQlszXSwgbl8xKSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSAxOgorICAgICAgICAgICAgLyogaW5kZXggPSBxdWFudF8xcF9OMShwb3NBWzBdLCBuXzEpIDw8ICgoMypuXzEpKzEpOyAqLworICAgICAgICAgICAgdG1wID0gYWRkMSgoV29yZDE2KSgodm9fTF9tdWx0KDMsIG5fMSkgPj4gMSkpLCAxKTsKKyAgICAgICAgICAgIGluZGV4ID0gTF9zaGwocXVhbnRfMXBfTjEocG9zQVswXSwgbl8xKSwgdG1wKTsKKyAgICAgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzNwXzNOMShwb3NCWzBdLCBwb3NCWzFdLCBwb3NCWzJdLCBuXzEpOyAqLworICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgcXVhbnRfM3BfM04xKHBvc0JbMF0sIHBvc0JbMV0sIHBvc0JbMl0sIG5fMSkpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgMjoKKyAgICAgICAgICAgIHRtcCA9ICgobl8xIDw8IDEpICsgMSk7ICAgICAgICAgLyogaW5kZXggPSBxdWFudF8ycF8yTjEocG9zQVswXSwgcG9zQVsxXSwgbl8xKSA8PCAoKDIqbl8xKSsxKTsgKi8KKyAgICAgICAgICAgIGluZGV4ID0gTF9zaGwocXVhbnRfMnBfMk4xKHBvc0FbMF0sIHBvc0FbMV0sIG5fMSksIHRtcCk7CisgICAgICAgICAgICAvKiBpbmRleCArPSBxdWFudF8ycF8yTjEocG9zQlswXSwgcG9zQlsxXSwgbl8xKTsgKi8KKyAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIHF1YW50XzJwXzJOMShwb3NCWzBdLCBwb3NCWzFdLCBuXzEpKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIDM6CisgICAgICAgICAgICAvKiBpbmRleCA9IHF1YW50XzNwXzNOMShwb3NBWzBdLCBwb3NBWzFdLCBwb3NBWzJdLCBuXzEpIDw8IE47ICovCisgICAgICAgICAgICBpbmRleCA9IExfc2hsKHF1YW50XzNwXzNOMShwb3NBWzBdLCBwb3NBWzFdLCBwb3NBWzJdLCBuXzEpLCBOKTsKKyAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIHF1YW50XzFwX04xKHBvc0JbMF0sIG5fMSkpOyAgICAgICAgLyogaW5kZXggKz0gcXVhbnRfMXBfTjEocG9zQlswXSwgbl8xKTsgKi8KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIDQ6CisgICAgICAgICAgICBpbmRleCA9IHF1YW50XzRwXzROMShwb3NBWzBdLCBwb3NBWzFdLCBwb3NBWzJdLCBwb3NBWzNdLCBuXzEpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBpbmRleCA9IDA7CisgICAgICAgICAgICBmcHJpbnRmKHN0ZGVyciwgIkVycm9yIGluIGZ1bmN0aW9uIHF1YW50XzRwXzROXG4iKTsKKyAgICB9CisgICAgdG1wID0gKChOIDw8IDIpIC0gMik7ICAgICAgICAgICAgICAgLyogaW5kZXggKz0gKGkgJiAzKSA8PCAoKDQqTiktMik7ICovCisgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgTF9zaGwoKExfZGVwb3NpdF9sKGkpICYgKDNMKSksIHRtcCkpOworCisgICAgcmV0dXJuIChpbmRleCk7Cit9CisKKworCitXb3JkMzIgcXVhbnRfNXBfNU4oICAgICAgICAgICAgICAgICAgICAgICAgLyogKG8pIHJldHVybiA1Kk4gYml0cyAgICAgICAgICAgICAqLworICAgICAgICBXb3JkMTYgcG9zW10sICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBwb3NpdGlvbiBvZiB0aGUgcHVsc2UgMS4uNSAgKi8KKyAgICAgICAgV29yZDE2IE4pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgbnVtYmVyIG9mIGJpdHMgZm9yIHBvc2l0aW9uICovCit7CisgICAgV29yZDE2IG5iX3Bvcywgbl8xLCB0bXA7CisgICAgV29yZDE2IHBvc0FbNV0sIHBvc0JbNV07CisgICAgV29yZDMyIGksIGosIGssIGluZGV4LCB0bXAyOworCisgICAgbl8xID0gKFdvcmQxNikgKE4gLSAxKTsKKyAgICBuYl9wb3MgPSAoMSA8PCBuXzEpOyAgICAgICAgICAgICAgICAgIC8qIG5iX3BvcyA9ICgxPDxuXzEpOyAqLworCisgICAgaSA9IDA7CisgICAgaiA9IDA7CisgICAgZm9yIChrID0gMDsgayA8IDU7IGsrKykKKyAgICB7CisgICAgICAgIGlmICgocG9zW2tdICYgbmJfcG9zKSA9PSAwKQorICAgICAgICB7CisgICAgICAgICAgICBwb3NBW2krK10gPSBwb3Nba107CisgICAgICAgIH0gZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBwb3NCW2orK10gPSBwb3Nba107CisgICAgICAgIH0KKyAgICB9CisKKyAgICBzd2l0Y2ggKGkpCisgICAgeworICAgICAgICBjYXNlIDA6CisgICAgICAgICAgICB0bXAgPSB2b19zdWIoKFdvcmQxNikoKHZvX0xfbXVsdCg1LCBOKSA+PiAxKSksIDEpOyAgICAgICAgLyogKCg1Kk4pLTEpKSAqLworICAgICAgICAgICAgaW5kZXggPSBMX3NobCgxTCwgdG1wKTsgICAvKiBpbmRleCA9IDEgPDwgKCg1Kk4pLTEpOyAqLworICAgICAgICAgICAgdG1wID0gYWRkMSgoTiA8PCAxKSwgMSk7ICAvKiBpbmRleCArPSBxdWFudF8zcF8zTjEocG9zQlswXSwgcG9zQlsxXSwgcG9zQlsyXSwgbl8xKSA8PCAoKDIqTikrMSk7Ki8KKyAgICAgICAgICAgIHRtcDIgPSBMX3NobChxdWFudF8zcF8zTjEocG9zQlswXSwgcG9zQlsxXSwgcG9zQlsyXSwgbl8xKSwgdG1wKTsKKyAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIHRtcDIpOworICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgcXVhbnRfMnBfMk4xKHBvc0JbM10sIHBvc0JbNF0sIE4pKTsgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzJwXzJOMShwb3NCWzNdLCBwb3NCWzRdLCBOKTsgKi8KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIDE6CisgICAgICAgICAgICB0bXAgPSB2b19zdWIoKFdvcmQxNikoKHZvX0xfbXVsdCg1LCBOKSA+PiAxKSksIDEpOyAgICAgICAgLyogaW5kZXggPSAxIDw8ICgoNSpOKS0xKTsgKi8KKyAgICAgICAgICAgIGluZGV4ID0gTF9zaGwoMUwsIHRtcCk7CisgICAgICAgICAgICB0bXAgPSBhZGQxKChOIDw8IDEpLCAxKTsgICAvKiBpbmRleCArPSBxdWFudF8zcF8zTjEocG9zQlswXSwgcG9zQlsxXSwgcG9zQlsyXSwgbl8xKSA8PCgoMipOKSsxKTsgICovCisgICAgICAgICAgICB0bXAyID0gTF9zaGwocXVhbnRfM3BfM04xKHBvc0JbMF0sIHBvc0JbMV0sIHBvc0JbMl0sIG5fMSksIHRtcCk7CisgICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCB0bXAyKTsKKyAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIHF1YW50XzJwXzJOMShwb3NCWzNdLCBwb3NBWzBdLCBOKSk7ICAgICAgICAvKiBpbmRleCArPSBxdWFudF8ycF8yTjEocG9zQlszXSwgcG9zQVswXSwgTik7ICovCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSAyOgorICAgICAgICAgICAgdG1wID0gdm9fc3ViKChXb3JkMTYpKCh2b19MX211bHQoNSwgTikgPj4gMSkpLCAxKTsgICAgICAgIC8qICgoNSpOKS0xKSkgKi8KKyAgICAgICAgICAgIGluZGV4ID0gTF9zaGwoMUwsIHRtcCk7ICAgICAgICAgICAgLyogaW5kZXggPSAxIDw8ICgoNSpOKS0xKTsgKi8KKyAgICAgICAgICAgIHRtcCA9IGFkZDEoKE4gPDwgMSksIDEpOyAgICAgICAgICAgLyogaW5kZXggKz0gcXVhbnRfM3BfM04xKHBvc0JbMF0sIHBvc0JbMV0sIHBvc0JbMl0sIG5fMSkgPDwgKCgyKk4pKzEpOyAgKi8KKyAgICAgICAgICAgIHRtcDIgPSBMX3NobChxdWFudF8zcF8zTjEocG9zQlswXSwgcG9zQlsxXSwgcG9zQlsyXSwgbl8xKSwgdG1wKTsKKyAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIHRtcDIpOworICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgcXVhbnRfMnBfMk4xKHBvc0FbMF0sIHBvc0FbMV0sIE4pKTsgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzJwXzJOMShwb3NBWzBdLCBwb3NBWzFdLCBOKTsgKi8KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIDM6CisgICAgICAgICAg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ovCisgICAgICAgICAgICBpbmRleCA9IExfc2hsKHF1YW50XzNwXzNOMShwb3NBWzBdLCBwb3NBWzFdLCBwb3NBWzJdLCBuXzEpLCB0bXApOworICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgcXVhbnRfMnBfMk4xKHBvc0FbM10sIHBvc0FbNF0sIE4pKTsgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzJwXzJOMShwb3NBWzNdLCBwb3NBWzRdLCBOKTsgKi8KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgaW5kZXggPSAwOworICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJFcnJvciBpbiBmdW5jdGlvbiBxdWFudF81cF81TlxuIik7CisgICAgfQorCisgICAgcmV0dXJuIChpbmRleCk7Cit9CisKKworV29yZDMyIHF1YW50XzZwXzZOXzIoICAgICAgICAgICAgICAgICAgICAgIC8qIChvKSByZXR1cm4gKDYqTiktMiBiaXRzICAgICAgICAgKi8KKyAgICAgICAgV29yZDE2IHBvc1tdLCAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgcG9zaXRpb24gb2YgdGhlIHB1bHNlIDEuLjYgICovCisgICAgICAgIFdvcmQxNiBOKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIG51bWJlciBvZiBiaXRzIGZvciBwb3NpdGlvbiAqLworeworICAgIFdvcmQxNiBuYl9wb3MsIG5fMTsKKyAgICBXb3JkMTYgcG9zQVs2XSwgcG9zQls2XTsKKyAgICBXb3JkMzIgaSwgaiwgaywgaW5kZXg7CisKKyAgICAvKiAhISAgTiBhbmQgbl8xIGFyZSBjb25zdGFudHMgLT4gaXQgZG9lc24ndCBuZWVkIHRvIGJlIG9wZXJhdGVkIGJ5IEJhc2ljIE9wZXJhdG9ycyAqLworICAgIG5fMSA9IChXb3JkMTYpIChOIC0gMSk7CisgICAgbmJfcG9zID0gKDEgPDwgbl8xKTsgICAgICAgICAgICAgICAgICAvKiBuYl9wb3MgPSAoMTw8bl8xKTsgKi8KKworICAgIGkgPSAwOworICAgIGogPSAwOworICAgIGZvciAoayA9IDA7IGsgPCA2OyBrKyspCisgICAgeworICAgICAgICBpZiAoKHBvc1trXSAmIG5iX3BvcykgPT0gMCkKKyAgICAgICAgeworICAgICAgICAgICAgcG9zQVtpKytdID0gcG9zW2tdOworICAgICAgICB9IGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgcG9zQltqKytdID0gcG9zW2tdOworICAgICAgICB9CisgICAgfQorCisgICAgc3dpdGNoIChpKQorICAgIHsKKyAgICAgICAgY2FzZSAwOgorICAgICAgICAgICAgaW5kZXggPSAoMSA8PCAoV29yZDE2KSAoNiAqIE4gLSA1KSk7ICAgICAgICAvKiBpbmRleCA9IDEgPDwgKCg2Kk4pLTUpOyAqLworICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgKHF1YW50XzVwXzVOKHBvc0IsIG5fMSkgPDwgTikpOyAvKiBpbmRleCArPSBxdWFudF81cF81Tihwb3NCLCBuXzEpIDw8IE47ICovCisgICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCBxdWFudF8xcF9OMShwb3NCWzVdLCBuXzEpKTsgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzFwX04xKHBvc0JbNV0sIG5fMSk7ICovCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSAxOgorICAgICAgICAgICAgaW5kZXggPSAoMUwgPDwgKFdvcmQxNikgKDYgKiBOIC0gNSkpOyAgICAgICAgLyogaW5kZXggPSAxIDw8ICgoNipOKS01KTsgKi8KKyAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIChxdWFudF81cF81Tihwb3NCLCBuXzEpIDw8IE4pKTsgLyogaW5kZXggKz0gcXVhbnRfNXBfNU4ocG9zQiwgbl8xKSA8PCBOOyAqLworICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgcXVhbnRfMXBfTjEocG9zQVswXSwgbl8xKSk7ICAgICAgICAvKiBpbmRleCArPSBxdWFudF8xcF9OMShwb3NBWzBdLCBuXzEpOyAqLworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgMjoKKyAgICAgICAgICAgIGluZGV4ID0gKDFMIDw8IChXb3JkMTYpICg2ICogTiAtIDUpKTsgICAgICAgIC8qIGluZGV4ID0gMSA8PCAoKDYqTiktNSk7ICovCisgICAgICAgICAgICAvKiBpbmRleCArPSBxdWFudF80cF80Tihwb3NCLCBuXzEpIDw8ICgoMipuXzEpKzEpOyAqLworICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgKHF1YW50XzRwXzROKHBvc0IsIG5fMSkgPDwgKFdvcmQxNikgKDIgKiBuXzEgKyAxKSkpOworICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgcXVhbnRfMnBfMk4xKHBvc0FbMF0sIHBvc0FbMV0sIG5fMSkpOyAgICAgIC8qIGluZGV4ICs9IHF1YW50XzJwXzJOMShwb3NBWzBdLCBwb3NBWzFdLCBuXzEpOyAqLworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgMzoKKyAgICAgICAgICAgIGluZGV4ID0gKHF1YW50XzNwXzNOMShwb3NBWzBdLCBwb3NBWzFdLCBwb3NBWzJdLCBuXzEpIDw8IChXb3JkMTYpICgzICogbl8xICsgMSkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGluZGV4ID0gcXVhbnRfM3BfM04xKHBvc0FbMF0sIHBvc0FbMV0sIHBvc0FbMl0sIG5fMSkgPDwgKCgzKm5fMSkrMSk7ICovCisgICAgICAgICAgICBpbmRleCA9dm9fTF9hZGQoaW5kZXgsIHF1YW50XzNwXzNOMShwb3NCWzBdLCBwb3NCWzFdLCBwb3NCWzJdLCBuXzEpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzNwXzNOMShwb3NCWzBdLCBwb3NCWzFdLCBwb3NCWzJdLCBuXzEpOyAqLworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgNDoKKyAgICAgICAgICAgIGkgPSAyOworICAgICAgICAgICAgaW5kZXggPSAocXVhbnRfNHBfNE4ocG9zQSwgbl8xKSA8PCAoV29yZDE2KSAoMiAqIG5fMSArIDEpKTsgIC8qIGluZGV4ID0gcXVhbnRfNHBfNE4ocG9zQSwgbl8xKSA8PCAoKDIqbl8xKSsxKTsgKi8KKyAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIHF1YW50XzJwXzJOMShwb3NCWzBdLCBwb3NCWzFdLCBuXzEpKTsgICAgICAvKiBpbmRleCArPSBxdWFudF8ycF8yTjEocG9zQlswXSwgcG9zQlsxXSwgbl8xKTsgKi8KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIDU6CisgICAgICAgICAgICBpID0gMTsKKyAgICAgICAgICAgIGluZGV4ID0gKHF1YW50XzVwXzVOKHBvc0EsIG5fMSkgPDwgTik7ICAgICAgIC8qIGluZGV4ID0gcXVhbnRfNXBfNU4ocG9zQSwgbl8xKSA8PCBOOyAqLworICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgcXVhbnRfMXBfTjEocG9zQlswXSwgbl8xKSk7ICAgICAgICAvKiBpbmRleCArPSBxdWFudF8xcF9OMShwb3NCWzBdLCBuXzEpOyAqLworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgNjoKKyAgICAgICAgICAgIGkgPSAwOworICAgICAgICAgICAgaW5kZXggPSAocXVhbnRfNXBfNU4ocG9zQSwgbl8xKSA8PCBOKTsgICAgICAgLyogaW5kZXggPSBxdWFudF81cF81Tihwb3NBLCBuXzEpIDw8IE47ICovCisgICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGlu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L0xJQ0VOU0UtMi4wCisgKgorICogVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZQorICogZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gIkFTIElTIiBCQVNJUywKKyAqIFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgorICogU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAorICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworI2luY2x1ZGUgPHN0ZGRlZi5oPgorI2luY2x1ZGUgPHN0ZGludC5oPgorCit2b2lkIERlY29kZUFMYXcoaW50MTZfdCAqb3V0LCBjb25zdCB1aW50OF90ICppbiwgc2l6ZV90IGluU2l6ZSkgeworICBpZiAob3V0ICE9IG51bGxwdHIgJiYgaW4gIT0gbnVsbHB0cikgeworICAgIHdoaWxlIChpblNpemUgPiAwKSB7CisgICAgICBpblNpemUtLTsKKyAgICAgIGludDMyX3QgeCA9ICppbisrOworCisgICAgICBpbnQzMl90IGl4ID0geCBeIDB4NTU7CisgICAgICBpeCAmPSAweDdmOworCisgICAgICBpbnQzMl90IGlleHAgPSBpeCA+PiA0OworICAgICAgaW50MzJfdCBtYW50ID0gaXggJiAweDBmOworCisgICAgICBpZiAoaWV4cCA+IDApIHsKKyAgICAgICAgbWFudCArPSAxNjsKKyAgICAgIH0KKworICAgICAgbWFudCA9IChtYW50IDw8IDQpICsgODsKKworICAgICAgaWYgKGlleHAgPiAxKSB7CisgICAgICAgIG1hbnQgPSBtYW50IDw8IChpZXhwIC0gMSk7CisgICAgICB9CisKKyAgICAg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gU3lzdGVtcyBQdnQuIEx0ZCwgQmFuZ2Fsb3JlCisgKi8KKworcGFja2FnZSB7CisgICAgLy8gU2VlOiBodHRwOi8vZ28vYW5kcm9pZC1saWNlbnNlLWZhcQorICAgIC8vIEEgbGFyZ2Utc2NhbGUtY2hhbmdlIGFkZGVkICdkZWZhdWx0X2FwcGxpY2FibGVfbGljZW5zZXMnIHRvIGltcG9ydAorICAgIC8vIGFsbCBvZiB0aGUgJ2xpY2Vuc2Vfa2luZHMnIGZyb20gImZyYW1ld29ya3NfYXZfbGljZW5zZSIKKyAgICAvLyB0byBnZXQgdGhlIGJlbG93IGxpY2Vuc2Uga2luZHM6CisgICAgLy8gICBTUERYLWxpY2Vuc2UtaWRlbnRpZmllci1BcGFjaGUtMi4wCisgICAgZGVmYXVsdF9hcHBsaWNhYmxlX2xpY2Vuc2VzOiBbImZyYW1ld29ya3NfYXZfbGljZW5zZSJdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiZzcxMWFsYXdfZGVjX2Z1enplciIsCisgICAgaG9zdF9zdXBwb3J0ZWQ6IHRydWUsCisgICAgc3JjczogWworICAgICAgICAiZzcxMV9kZWNfZnV6emVyLmNwcCIsCisgICAgXSwKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAiY29kZWNzX2c3MTFkZWMiLAorICAgIF0sCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItREFMQVciLAorICAgIF0sCisgICAgZnV6el9jb25maWc6IHsKKyAgICAgICAgY2M6IFsKKyAgICAgICAgICAgICJhbmRyb2lkLW1lZGlhLWZ1enppbmctcmVwb3J0c0Bnb29nbGUuY29tIiwKKyAgICAgICAgXSwKKyAgICAgICAgY29tcG9uZW50aWQ6IDE1NTI3NiwKKyAgICB9LAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiZzcxMW1sYXdfZGVjX2Z1enplciIsCisgICAgaG9zdF9zdXBwb3J0ZWQ6IHRydWUsCisgICAgc3JjczogWworICAgICAgICAiZzcx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cmMvY29uY2VhbC5jcHAiLAorICAgICAgICAic3JjL2RhdGFwYXJ0X2RlY29kZS5jcHAiLAorICAgICAgICAic3JjL2RjYWNfcHJlZGljdGlvbi5jcHAiLAorICAgICAgICAic3JjL2RlY19wcmVkX2ludHJhX2RjLmNwcCIsCisgICAgICAgICJzcmMvZ2V0X3ByZWRfYWR2X2JfYWRkLmNwcCIsCisgICAgICAgICJzcmMvZ2V0X3ByZWRfb3V0c2lkZS5jcHAiLAorICAgICAgICAic3JjL2lkY3QuY3BwIiwKKyAgICAgICAgInNyYy9pZGN0X3ZjYS5jcHAiLAorICAgICAgICAic3JjL21iX21vdGlvbl9jb21wLmNwcCIsCisgICAgICAgICJzcmMvbWJfdXRpbHMuY3BwIiwKKyAgICAgICAgInNyYy9wYWNrZXRfdXRpbC5jcHAiLAorICAgICAgICAic3JjL3Bvc3RfZmlsdGVyLmNwcCIsCisgICAgICAgICJzcmMvcHZkZWNfYXBpLmNwcCIsCisgICAgICAgICJzcmMvc2NhbGluZ190YWIuY3BwIiwKKyAgICAgICAgInNyYy92bGNfZGVjb2RlLmNwcCIsCisgICAgICAgICJzcmMvdmxjX2RlcXVhbnQuY3BwIiwKKyAgICAgICAgInNyYy92bGNfdGFiLmNwcCIsCisgICAgICAgICJzcmMvdm9wLmNwcCIsCisgICAgICAgICJzcmMvemlnemFnX3RhYi5jcHAiLAorICAgIF0sCisKKyAgICBsb2NhbF9pbmNsdWRlX2RpcnM6IFsic3JjIl0sCisgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWyJpbmNsdWRlIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1XZXJyb3IiLAorICAgIF0sCisKKyAgICBzYW5pdGl6ZTogeworICAgICAgICBtaXNjX3VuZGVmaW5lZDogWworICAgICAgICAgICAgInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgXSwKKyAgICAgICAgY2ZpOiB0cnVlLAorICAgIH0sCisKKyAgICB0YXJ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tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisgICAgOyBGdW5jdGlvbiBib2R5IGhlcmUKKyAgICAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KKyAgICBpZiAobnpfY29lZnMgPD0gMTApCisgICAgeworICAgICAgICBibWFwciA9IChuel9jb2VmcyAtIDEpOworCisgICAgICAgICgqKGlkY3Rjb2xWQ0FbYm1hcHJdKSkoY29lZmZfaW4pOworICAgICAgICAoKihpZGN0Y29sVkNBW2JtYXByXVsxXSkpKGNvZWZmX2luICsgMSk7CisgICAgICAgICgqKGlkY3Rjb2xWQ0FbYm1hcHJdWzJdKSkoY29lZmZfaW4gKyAyKTsKKyAgICAgICAgKCooaWRjdGNvbFZDQVtibWFwcl1bM10pKShjb2VmZl9pbiArIDMpOworCisgICAgICAgICgqaWRjdHJvd1ZDQV9pbnRyYVtuel9jb2Vmcy0xXSkoY29lZmZfaW4sIGNfY29tcCwgd2lkdGgpOworICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICBpID0gODsKKyAgICAgICAgd2hpbGUgKGktLSkKKyAgICAgICAgeworICAgICAgICAgICAgYm1hcHIgPSAoaW50KWJpdG1hcGNvbFtpXTsKKyAgICAgICAgICAgIGlmIChibWFwcikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoKGJtYXByJjB4ZikgPT0gMCkgICAgICAgICAvKiAgMDcvMTgvMDEgKi8KKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICgqKGlkY3Rjb2xWQ0EyW2JtYXByPj40XSkpKGNvZWZmX2luICsgaSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICA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i8KKyAgICByZXR1cm47Cit9CisKKy8qICAwOC8wNC8wNSwgbm8gcmVzaWR1ZSwganVzdCBjb3B5IGZyb20gcHJlZCB0byBvdXRwdXQgKi8KK3ZvaWQgQ29weV9CbGtfdG9fVm9wKHVpbnQ4ICpkc3QsIHVpbnQ4ICpwcmVkLCBpbnQgd2lkdGgpCit7CisgICAgLyogY29weSA0IGJ5dGVzIGF0IGEgdGltZSAqLworICAgIHdpZHRoIC09IDQ7CisgICAgKigodWludDMyKilkc3QpID0gKigodWludDMyKilwcmVkKTsKKyAgICAqKCh1aW50MzIqKShkc3QgKz0gNCkpID0gKigodWludDMyKikocHJlZCArPSA0KSk7CisgICAgKigodWludDMyKikoZHN0ICs9IHdpZHRoKSkgPSAqKCh1aW50MzIqKShwcmVkICs9IDEyKSk7CisgICAgKigodWludDMyKikoZHN0ICs9IDQpKSA9ICooKHVpbnQzMiopKHByZWQgKz0gNCkpOworICAgICooKHVpbnQzMiopKGRzdCArPSB3aWR0aCkpID0gKigodWludDMyKikocHJlZCArPSAxMikpOworICAgICooKHVpbnQzMiopKGRzdCArPSA0KSkgPSAqKCh1aW50MzIqKShwcmVkICs9IDQpKTsKKyAgICAqKCh1aW50MzIqKShkc3QgKz0gd2lkdGgpKSA9ICooKHVpbnQzMiopKHByZWQgKz0gMTIpKTsKKyAgICAqKCh1aW50MzIqKShkc3QgKz0gNCkpID0gKigodWludDMyKikocHJlZCArPSA0KSk7CisgICAgKigodWludDMyKikoZHN0ICs9IHdpZHRoKSkgPSAqKCh1aW50MzIqKShwcmVkICs9IDEyKSk7CisgICAgKigodWludDMyKikoZHN0ICs9IDQpKSA9ICooKHVpbnQzMiopKHByZWQgKz0gNCkpOworICAgICooKHVpbnQzMiopKGRzdCArPSB3aWR0aCkpID0gKigodWludDMyKikocHJlZCArPSAxMikpOworICAgICooKHVpbnQzMiopKGRzdCArPSA0KSkgPSAqKCh1aW50MzIqKShwcmVkICs9IDQpKTsKKyAgICAqKCh1aW50MzIqKShk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tLSovCisgICAgaWYgKG56X2NvZWZzIDw9IDEwKQorICAgIHsKKyAgICAgICAgYm1hcHIgPSAobnpfY29lZnMgLSAxKTsKKyAgICAgICAgKCooaWRjdGNvbFZDQVtibWFwcl0pKShjb2VmZl9pbik7CisgICAgICAgICgqKGlkY3Rjb2xWQ0FbYm1hcHJdWzFdKSkoY29lZmZfaW4gKyAxKTsKKyAgICAgICAgKCooaWRjdGNvbFZDQVtibWFwcl1bMl0pKShjb2VmZl9pbiArIDIpOworICAgICAgICAoKihpZGN0Y29sVkNBW2JtYXByXVszXSkpKGNvZWZmX2luICsgMyk7CisKKyAgICAgICAgKCppZGN0cm93VkNBW256X2NvZWZzLTFdKShjb2VmZl9pbiwgcHJlZCwgZHN0LCB3aWR0aCk7CisgICAgICAgIHJldHVybiA7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIGkgPSA4OworCisgICAgICAgIHdoaWxlIChpLS0pCisgICAgICAgIHsKKyAgICAgICAgICAgIGJtYXByID0gKGludCliaXRtYXBjb2xbaV07CisgICAgICAgICAgICBpZiAoYm1hcHIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKChibWFwciYweGYpID09IDApICAgICAgICAgLyogIDA3LzE4LzAxICovCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAoKihpZGN0Y29sVkNBMltibWFwcj4+NF0pKShjb2VmZl9pbiArIGkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZGN0Y29sKGNvZWZmX2luICsgaSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICgoYml0bWFwY29sWzRdIHwgYml0bWFwY29sWzVdIHwgYml0bWFwY29sWzZdIHwgYml0bWFwY29sWzddKSA9PSAwKQorICAgICAgICB7CisgICAgICAgICAgICAoKihpZGN0cm93VkNBMlt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vcml6b250YWwpIElEQ1QKKyAgICAqCisgICAgKiA3ICAgICAgICAgICAgICAgICAgICAgICBwaSAgICAgICAgIDEgZHN0W2tdID0gc3VtIGNbbF0gKiBzcmNbbF0gKiBjb3MoIC0tICoKKyAgICAqICggayArIC0gKSAqIGwgKSBsPTAgICAgICAgICAgICAgICAgICAgICAgOCAgICAgICAgICAyCisgICAgKgorICAgICogd2hlcmU6IGNbMF0gICAgPSAxMjggY1sxLi43XSA9IDEyOCpzcXJ0KDIpICovCisKKyAgICAvKiBwcmVzZXQgdGhlIG9mZnNldCwgc3VjaCB0aGF0IHdlIGNhbiB0YWtlIGFkdmFudGFnZSBwcmUtb2Zmc2V0IGFkZHJlc3NpbmcgbW9kZSAgICovCisgICAgd2lkdGggLT0gNDsKKyAgICBkc3QgLT0gd2lkdGg7CisgICAgcHJlZCAtPSAxMjsKKyAgICBibGsgLT0gODsKKworICAgIHdoaWxlIChpLS0pCisgICAgeworICAgICAgICB4MSA9IChpbnQzMilibGtbMTJdIDw8IDg7CisgICAgICAgIGJsa1sxMl0gPSAwOworICAgICAgICB4MiA9IGJsa1sxNF07CisgICAgICAgIGJsa1sxNF0gPSAwOworICAgICAgICB4MyA9IGJsa1sxMF07CisgICAgICAgIGJsa1sxMF0gPSAwOworICAgICAgICB4NCA9IGJsa1s5XTsKKyAgICAgICAgYmxrWzldID0gMDsKKyAgICAgICAgeDUgPSBibGtbMTVdOworICAgICAgICBibGtbMTVdID0gMDsKKyAgICAgICAgeDYgPSBibGtbMTNdOworICAgICAgICBibGtbMTNdID0gMDsKKyAgICAgICAgeDcgPSBibGtbMTFdOworICAgICAgICBibGtbMTFdID0gMDsKKyAgICAgICAgeDAgPSAoKCooYmxrICs9IDgpKSA8PCA4KSArIDgxOTI7CisgICAgICAgIGJsa1swXSA9IDA7ICAgLyogZm9yIHByb3BlciByb3VuZGluZyBpbiB0aGUgZm91cnRoIHN0YWdlICovCisKKyAgICAgICAgLyogZmlyc3Qgc3RhZ2UgKi8KKyAgICAgICAgeDggPSBXNyAqICh4NCArIHg1KSArIDQ7CisgICAgICAgIHg0ID0gKHg4ICsgKFcxIC0gVzcpICogeDQpID4+IDM7CisgICAgICAgIHg1ID0gKHg4IC0gKFcxICsgVzcpICogeDUpID4+IDM7CisgICAgICAgIHg4ID0gVzMgKiAoeDYgKyB4NykgKyA0OworICAgICAgICB4NiA9ICh4OCAtIChXMyAtIFc1KSAqIHg2KSA+PiAzOworICAgICAgICB4NyA9ICh4OCAtIChXMyArIFc1KSAqIHg3KSA+PiAzOworCisgICAgICAgIC8qIHNlY29uZCBzdGFnZSAqLworICAgICAgICB4OCA9IHgwICsgeDE7CisgICAgICAgIHgwIC09IHgxOworICAgICAgICB4MSA9IFc2ICogKHgzICsgeDIpICsgNDsKKyAgICAgICAgeDIgPSAoeDEgLSAoVzIgKyBXNikgKiB4MikgPj4gMzsKKyAgICAgICAgeDMgPSAoeDEgKyAoVzIgLSBXNikgKiB4MykgPj4gMzsKKyAgICAgICAgeDEgPSB4NCArIHg2OworICAgICAgICB4NCAtPSB4NjsKKyAgICAgICAgeDYgPSB4NSArIHg3OworICAgICAgICB4NSAtPSB4NzsKKworICAgICAgICAvKiB0aGlyZCBzdGFnZSAqLworICAgICAgICB4NyA9IHg4ICsgeDM7CisgICAgICAgIHg4IC09IHgzOworICAgICAgICB4MyA9IHgwICsgeDI7CisgICAgICAgIHgwIC09IHgyOworICAgICAgICB4MiA9ICgxODEgKiAoeDQgKyB4NSkgKyAxMjgpID4+IDg7CisgICAgICAgIHg0ID0gKDE4MSAqICh4NCAtIHg1KSArIDEyOCkgPj4gODsKKworICAgICAgICAvKiBmb3VydGggc3RhZ2UgKi8KKyAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocHJlZCArPSAxMikpOyAvKiByZWFkIDQgYnl0ZXMgZnJvbSBwcmVkICovCisKKyAgICAgICAgcmVzID0gKHg3ICsgeDEpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVAxKHJlcyk7CisgICAgICAgIHJlczIgPSAoeDMgKyB4MikgPj4gMTQ7CisgICAgICAgIEFERF9BTkRfQ0xJUDIocmVzMik7CisgICAgICAgIGRzdF93b3JkID0gKHJlczIgPDwgOCkgfCByZXM7CisgICAgICAgIHJlcyA9ICh4MCArIHg0KSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQMyhyZXMpOworICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDE2KTsKKyAgICAgICAgcmVzID0gKHg4ICsgeDYpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVA0KHJlcyk7CisgICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMjQpOworICAgICAgICAqKCh1aW50MzIqKShkc3QgKz0gd2lkdGgpKSA9IGRzdF93b3JkOyAvKiBzYXZlIDQgYnl0ZXMgdG8gZHN0ICovCisKKyAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocHJlZCArPSA0KSk7IC8qIHJlYWQgNCBieXRlcyBmcm9tIHByZWQgKi8KKworICAgICAgICByZXMgPSAoeDggLSB4NikgPj4gMTQ7CisgICAgICAgIEFERF9BTkRfQ0xJUDEocmVzKTsKKyAgICAgICAgcmVzMiA9ICh4MCAtIHg0KSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQMihyZXMyKTsKKyAgICAgICAgZHN0X3dvcmQgPSAocmVzMiA8PCA4KSB8IHJlczsKKyAgICAgICAgcmVzID0gKHgzIC0geDIpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVAzKHJlcyk7CisgICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMTYpOworICAgICAgICByZXMgPSAoeDcgLSB4MSkgPj4gMTQ7CisgICAgICAgIEFERF9BTkRfQ0xJUDQocmVzKTsKKyAgICAgICAgZHN0X3dvcmQgfD0gKHJlcyA8PCAyNCk7CisgICAgICAgICooKHVpbnQzMiopKGRzdCArPSA0KSkgPSBkc3Rfd29yZDsgLyogc2F2ZSA0IGJ5dGVzIHRvIGR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S0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCisgICAgLyogcm93IChob3Jpem9udGFsKSBJRENUCisgICAgKgorICAgICogNyAgICAgICAgICAgICAgICAgICAgICAgcGkgICAgICAgICAxIGRzdFtrXSA9IHN1bSBjW2xdICogc3JjW2xdICogY29zKCAtLSAqCisgICAgKiAoIGsgKyAtICkgKiBsICkgbD0wICAgICAgICAgICAgICAgICAgICAgIDggICAgICAgICAgMgorICAgICoKKyAgICAqIHdoZXJlOiBjWzBdICAgID0gMTI4IGNbMS4uN10gPSAxMjgqc3FydCgyKSAqLworICAgIHdoaWxlIChpLS0pCisgICAgeworICAgICAgICB4MSA9IChpbnQzMilibGtbNF0gPDwgODsKKyAgICAgICAgYmxrWzRdID0gMDsKKyAgICAgICAgeDIgPSBibGtbNl07CisgICAgICAgIGJsa1s2XSA9IDA7CisgICAgICAgIHgzID0gYmxrWzJdOworICAgICAgICBibGtbMl0gPSAwOworICAgICAgICB4NCA9IGJsa1sxXTsKKyAgICAgICAgYmxrWzFdID0gMDsKKyAgICAgICAgeDUgPSBibGtbN107CisgICAgICAgIGJsa1s3XSA9IDA7CisgICAgICAgIHg2ID0gYmxrWzVdOworICAgICAgICBibGtbNV0gPSAwOworICAgICAgICB4NyA9IGJsa1szXTsKKyAgICAgICAgYmxrWzNdID0gMDsKKyNpZm5kZWYgRkFTVF9JRENUCisgICAgICAgIC8qIHNob3J0Y3V0ICovICAvKiBjb3ZlcmVkIGJ5IGlkY3Ryb3cxICAwMS85LzIwMDEgKi8KKyAgICAgICAgaWYgKCEoeDEgfCB4MiB8IHgzIHwgeDQgfCB4NSB8IHg2IHwgeDcpKQorICAgICAgICB7CisgICAgICAgICAgICBibGtbMF0gPSBibGtbMV0gPSBibGtbMl0gPSBibGtbM10gPSBibGtbNF0gPSBibGtbNV0gPSBibGtbNl0gPSBibGtbN10gPSAoYmxrWzBdICsgMzIpID4+IDY7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyNlbmRpZgorICAgICAgICB4MCA9ICgoaW50MzIpYmxrWzBdIDw8IDgpICsgODE5MjsKKyAgICAgICAgYmxrWzBdID0gMDsgIC8qIGZvciBwcm9wZXIgcm91bmRpbmcgaW4gdGhlIGZvdXJ0aCBzdGFnZSAqLworCisgICAgICAgIC8qIGZpcnN0IHN0YWdlICovCisgICAgICAgIHg4ID0gVzcgKiAoeDQgKyB4NSkgKyA0OworICAgICAgICB4NCA9ICh4OCArIChXMSAtIFc3KSAqIHg0KSA+PiAzOworICAgICAgICB4NSA9ICh4OCAtIChXMSArIFc3KSAqIHg1KSA+PiAzOworICAgICAgICB4OCA9IFczICogKHg2ICsgeDcpICsgNDsKKyAgICAgICAgeDYgPSAoeDggLSAoVzMgLSBXNSkgKiB4NikgPj4gMzsKKyAgICAgICAgeDcgPSAoeDggLSAoVzMgKyBXNSkgKiB4NykgPj4gMzsKKworICAgICAgICAvKiBzZWNvbmQgc3RhZ2UgKi8KKyAgICAgICAgeDggPSB4MCArIHgxOworICAgICAgICB4MCAtPSB4MTsKKyAgICAgICAgeDEgPSBXNiAqICh4MyArIHgyKSArIDQ7CisgICAgICAgIHgyID0gKHgxIC0gKFcyICsgVzYpICogeDIpID4+IDM7CisgICAgICAgIHgzID0gKHgxICsgKFcyIC0gVzYpICogeDMpID4+IDM7CisgICAgICAgIHgxID0geDQgKyB4NjsKKyAgICAgICAgeDQgLT0geDY7CisgICAgICAgIHg2ID0geDUgKyB4NzsKKyAgICAgICAgeDUgLT0geDc7CisKKyAgICAgICAgLyogdGhpcmQgc3RhZ2UgKi8KKyAgICAgICAgeDcgPSB4OCArIHgzOworICAgICAgICB4OCAtPSB4MzsKKyAgICAgICAgeDMgPSB4MCArIHgyOworICAgICAgICB4MCAtPSB4MjsKKyAgICAgICAgeDIgPSAoMTgxICogKHg0ICsgeDUpICsgMTI4KSA+PiA4OworICAgICAgICB4NCA9ICgxODEgKiAoeDQgLSB4NSkgKyAxMjgpID4+IDg7CisKKyAgICAgICAgLyogZm91cnRoIHN0YWdlICovCisgICAgICAgIHdvcmQgPSAoKHg3ICsgeDEpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQod29yZCkKKworICAgICAgICB0ZW1wID0gKCh4MyArIHgyKSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgOCk7CisKKyAgICAgICAgdGVtcCA9ICgoeDAgKyB4NCkgPj4gMTQpOworICAgICAgICBDTElQX1JFU1VMVCh0ZW1wKQorICAgICAgICB3b3JkID0gd29yZCB8ICh0ZW1wIDw8IDE2KTsKKworICAgICAgICB0ZW1wID0gKCh4OCArIHg2KSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgMjQpOworICAgICAgICAqKChpbnQzMiopKGNvbXApKSA9IHdvcmQ7CisKKyAgICAgICAgd29yZCA9ICgoeDggLSB4NikgPj4gMTQpOworICAgICAgICBDTElQX1JFU1VMVCh3b3JkKQorCisgICAgICAgIHRlbXAgPSAoKHgwIC0geDQpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCA4KTsKKworICAgICAgICB0ZW1wID0gKCh4MyAtIHgyKSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgMTYpOworCisgICAgICAgIHRlbXAgPSAoKHg3IC0geDEpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAyNCk7CisgICAgICAgICooKGludDMyKikoY29tcCArIDQpKSA9IHdvcm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A9IGJsa1sxNl07CisgICAgeDQgPSBibGtbOF07CisgICAgeDUgPSBibGtbNTZdOworICAgIHg2ID0gYmxrWzQwXTsKKyAgICB4NyA9IGJsa1syNF07CisjaWZuZGVmIEZBU1RfSURDVAorICAgIC8qIHNob3J0Y3V0ICovICAgICAgICAvKiBjb3ZlcmVkIGJ5IGlkY3Rjb2x1bW4xICAwMS85LzIwMDEgKi8KKyAgICBpZiAoISh4MSB8IHgyIHwgeDMgfCB4NCB8IHg1IHwgeDYgfCB4NykpCisgICAgeworICAgICAgICBibGtbMF0gPSBibGtbOF0gPSBibGtbMTZdID0gYmxrWzI0XSA9IGJsa1szMl0gPSBibGtbNDBdID0gYmxrWzQ4XSA9IGJsa1s1Nl0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IGJsa1swXSA8PCAzOworICAgICAgICByZXR1cm47CisgICAgfQorI2VuZGlmCisKKyAgICB4MCA9ICgoaW50MzIpYmxrWzBdIDw8IDExKSArIDEyODsKKworICAgIC8qIGZpcnN0IHN0YWdlICovCisgICAgeDggPSBXNyAqICh4NCArIHg1KTsKKyAgICB4NCA9IHg4ICsgKFcxIC0gVzcpICogeDQ7CisgICAgeDUgPSB4OCAtIChXMSArIFc3KSAqIHg1OworICAgIHg4ID0gVzMgKiAoeDYgKyB4Nyk7CisgICAgeDYgPSB4OCAtIChXMyAtIFc1KSAqIHg2OworICAgIHg3ID0geDggLSAoVzMgKyBXNSkgKiB4NzsKKworICAgIC8qIHNlY29uZCBzdGFnZSAqLworICAgIHg4ID0geDAgKyB4MTsKKyAgICB4MCAtPSB4MTsKKyAgICB4MSA9IFc2ICogKHgzICsgeDIpOworICAgIHgyID0geDEgLSAoVzIgKyBXNikgKiB4MjsKKyAgICB4MyA9IHgxICsgKFcyIC0gVzYpICogeDM7CisgICAgeDEgPSB4NCArIHg2OworICAgIHg0IC09IHg2OworICAgIHg2ID0geDUgKyB4NzsKKyAgICB4NSAtPSB4NzsKKwor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GVGcmFtZUNvbWJpbmVkTW9kZSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6IERlY29kZSBhIGZyYW1lIG9mIE1QRUc0IGJpdHN0cmVhbSBpbiBjb21iaW5lZCBtb2RlLiAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgIDAzLzMwLzIwMDAgOiBDbGVhbmVkIHVwIGFuZCBvcHRpbWl6ZWQgdGhlIGNvZGUuICAgICAgICAgICAgICovCisvKiAgICAgIDAzLzMxLzIwMDAgOiBBZGRlZCBwcm9wZXIgaGFuZGxpbmcgb2YgTUIgc3R1ZmZpbmcuICAgICAgICAgICovCisvKiAgICAgIDA0LzEzLzIwMDAgOiBSZXdyb3RlIHRoaXMgY29tYmluZWQgbW9kZSBwYXRoIGNvbXBsZXRlbHkgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvIHRoYXQgaXQgaGFuZGxlcyAiQ29tYmluZWQgTW9kZSBXaXRoIEVycm9yICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgUmVzaWxpZW5jZS4iICBOb3cgdGhlIGNvZGUgcmVzZW1ibGVzIHRoZSAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICBwc2V1ZG8gY29kZXMgaW4gTVBFRy00IHN0YW5kYXJkIGJldHRlci4gICAgICAgICovCisvKiAgICAgIDEwLzEzLzIwMDAgOiBBZGQgZmFzdCBWTEMrZGVxdWFudCAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgIDA0LzEzLzIwMDEgOiBmaXggTUJfc3R1ZmZpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgMDgvMDcvMjAwMSA6IHJlbW92ZSBNQnplcm8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworUFZfU1RBVFVTIERlY29kZUZyYW1lQ29tYmluZWRNb2RlKFZpZGVvRGVjRGF0YSAqdmlkZW8pCit7CisgICAgUFZfU1RBVFVTIHN0YXR1czsKKyAgICBpbnQgbWJudW07CisgICAgVm9wICpjdXJyVm9wID0gdmlkZW8tPmN1cnJWb3A7CisgICAgQml0c3RyZWFtRGVjVmlkZW8gKnN0cmVhbSA9IHZpZGVvLT5iaXRzdHJlYW07CisgICAgaW50IHNob3J0VmlkZW9IZWFkZXIgPSB2aWRlby0+c2hvcnRWaWRlb0hlYWRlcjsKKyAgICBpbnQxNiBRUCwgKlFQTUIgPSB2aWRlby0+UVBNQjsKKyAgICB1aW50OCAqTW9kZSA9IHZpZGVvLT5oZWFkZXJJbmZvLk1vZGU7CisgICAgaW50IG5Ub3RhbE1CID0gdmlkZW8tPm5Ub3RhbE1COworICAgIGludCBuTUJQZXJSb3cgPSB2aWRlby0+bk1CUGVyUm93OworICAgIGludCBzbGljZV9jb3VudGVyOworICAgIHVpbnQzMiB0bXB2YXIsIGxvbmdfemVyb19iaXRzOworICAgIHVpbnQgY29kZTsKKyAgICBpbnQgdmFsaWRfc3R1ZmZpbmc7CisgICAgaW50IHJlc3luY19tYXJrZXJfbGVuZ3RoOworICAgIGludCBzdHVmZmluZ19sZW5ndGg7CisKKyAgICAvKiBhZGQgdGhpcyBmb3IgZXJyb3IgcmVzaWxpZW50LCAwNS8xOC8yMDAwICovCisgICAgaW50MzIgc3RhcnRQYWNrZXQ7CisgICAgaW50IG1iX3N0YXJ0OworICAgIC8qIGNvcHkgYW5kIHBhZCB0byBwcmV2X1ZvcCBmb3IgSU5URVIgY29kaW5nICovCisgICAgc3dpdGNoIChjdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSkKKyAgICB7CisgICAgICAgIGNhc2UgSV9WT1AgOgorLy8gICAgICBvc2NsX21lbXNldChNb2RlLCBNT0RFX0lOVFJBLCBzaXplb2YodWludDgpKm5Ub3RhbE1CKTsKKyAgICAgICAgICAgIHJlc3luY19tYXJrZXJfbGVuZ3RoID0gMTc7CisgICAgICAgICAgICBzdHVmZmluZ19sZW5ndGggPSA5OworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgUF9WT1AgOgorICAgICAgICAgICAgb3NjbF9tZW1zZXQodmlkZW8tPm1vdFgsIDAsIHNpemVvZihNT1QpKjQqblRvdGFsTUIpOworICAgICAgICAgICAgb3NjbF9tZW1zZXQodmlkZW8tPm1vdFksIDAsIHNpemVvZihNT1QpKjQqblRvdGFsTUIpOworLy8gICAgICBvc2NsX21lbXNldChNb2RlLCBNT0RFX0lOVEVSLCBzaXplb2YodWludDgpKm5Ub3RhbE1CKTsKKyAgICAgICAgICAgIHJlc3luY19tYXJrZXJfbGVuZ3RoID0gMTYgKyBjdXJyVm9wLT5mY29kZUZvcndhcmQ7CisgICAgICAgICAgICBzdHVmZmluZ19sZW5ndGggPSAxMDsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0IDoKKyAgICAgICAgICAgIG1wNGRlY19sb2coIkRlY29kZUZyYW1lQ29tYmluZWRNb2RlKCk6IFZvcCB0eXBlIG5vdCBzdXBwb3J0ZWQuXG4iKTsKKyAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgIH0KKyNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKKyAgICBpZiAodmlkZW8tPnNob3J0VmlkZW9IZWFkZXIpCisgICAgeworICAgICAgICBpZiAodmlkZW8tPmFkdmFuY2VkX0lOVFJBKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAodmlkZW8tPm1vZGlmaWVkX3F1YW50KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZpZGVvLT52bGNEZWNDb2VmZkludHJhID0gJlZsY0RlY1RDT0VGU2hvcnRIZWFkZXJfQW5uZXhJVDsKKyAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRlciA9ICZWbGNEZWNUQ09FRlNob3J0SGVhZGVyX0FubmV4VDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRyYSA9ICZWbGNEZWNUQ09FRlNob3J0SGVhZGVyX0FubmV4STsKKyAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRlciA9ICZWbGNEZWNUQ09FRlNob3J0SGVhZGVyOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKHZpZGVvLT5tb2RpZmllZF9xdWFudCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRlciA9IHZpZGVvLT52bGNEZWNDb2VmZkludHJhID0gJlZsY0RlY1RDT0VGU2hvcnRIZWFkZXJfQW5uZXhUOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZpZGVvLT52bGNEZWNDb2VmZkludGVyID0gdmlkZW8tPnZsY0RlY0NvZWZmSW50cmEgPSAmVmxjRGVjVENPRUZTaG9ydEhlYWRlcjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworI2VuZGlmCisKKyAgICAvKiogSW5pdGlhbGl6ZSBzbGljZU5vICoqKi8KKyAgICBtYm51bSA9IHNsaWNlX2NvdW50ZXIgPSAwOworLy8gIG9zY2xfbWVtc2V0KHZpZGVvLT5zbGljZU5vLCAwLCBzaXplb2YodWludDgpKm5Ub3RhbE1CKTsKKyAgICBRUCA9IHZpZGVvLT5jdXJyVm9wLT5xdWFudGl6ZXI7CisKKyAgICBkbworICAgIHsKKyAgICAgICAgLyogVGhpcyBzZWN0aW9uIGlzIGVxdWl2YWxlbnQgdG8gbW90aW9uX3NoYXBlX3RleHR1cmUoKSAqLworICAgICAgICAvKiAgICBpbiB0aGUgTVBFRy00IHN0YW5kYXJkLiAgICAgMDQvMTMvMjAwMCAgICAgICAgICAqLworICAgICAgICBtYl9zdGFydCA9IG1ibnVtOworICAgICAgICB2aWRlby0+dXNlUHJldlFQID0gMDsgICAgICAgICAgICAgLyogIDA0LzI3LzAxICovCisgICAgICAgIHN0YXJ0UGFja2V0ID0gZ2V0UG9pbnRlcihzdHJlYW0pOworCisjaWZkZWYgUFZfQU5ORVhfSUpLVF9TVVBQT1JUCisgICAgICAgIGlmICh2aWRlby0+bW9kaWZpZWRfcXVhbnQpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZpZGVvLT5RUF9DSFIgPSBNUV9jaHJvbWFfUVBfdGFibGVbUVBdOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgdmlkZW8tPlFQX0NIUiA9IFFQOyAgICAgLyogQU5ORVhfVCAqLworICAgICAgICB9CisjZW5kaWYKKyAgICAgICAgLyogcmVtb3ZlIGFueSBzdHVmZmluZyBiaXRzICovCisgICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMTYoc3RyZWFtLCBzdHVmZmluZ19sZW5ndGgsICZjb2RlKTsKKyAgICAgICAgd2hpbGUgKGNvZGUgPT0gMSkKKyAgICAgICAgeworICAgICAgICAgICAgUFZfQml0c3RyZWFtRmx1c2hCaXRzKHN0cmVhbSwgc3R1ZmZpbmdfbGVuZ3RoKTsKKyAgICAgICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMTYoc3RyZWFtLCBzdHVmZmluZ19sZW5ndGgsICZjb2RlKTsKKyAgICAgICAgfQorCisgICAgICAgIGRvCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIHdlIG5lZWQgdmlkZW8tPm1ibnVtIGluIGxvd2VyIGxldmVsIGZ1bmN0aW9ucyAqLworICAgICAgICAgICAgdmlkZW8tPm1ibnVtID0gbWJudW07CisgICAgICAgICAgICB2aWRlby0+bWJudW1fcm93ID0gUFZfR0VUX1JPVyhtYm51bSwgbk1CUGVyUm93KTsKKyAgICAgICAgICAgIHZpZGVvLT5tYm51bV9jb2wgPSBtYm51bSAtIHZpZGVvLT5tYm51bV9yb3cgKiBuTUJQZXJSb3c7CisgICAgICAgICAgICAvKiBhc3NpZ24gc2xpY2UgbnVtYmVyIGZvciBlYWNoIG1hY3JvYmxvY2tzICovCisgICAgICAgICAgICB2aWRlby0+c2xpY2VOb1ttYm51bV0gPSAodWludDgpIHNsaWNlX2NvdW50ZXI7CisKKyAgICAgICAgICAgIC8qIGRlY29kZSBDT0QsIE1DQlBDLCBBQ3ByZWRfZmxhZywgQ1BCWSBhbmQgRFFVQU5UICovCisgICAgICAgICAgICAvKiBXZSBoYXZlIHRvIGRpc2NhcmQgc3R1ZmZlZCBNQiBoZWFkZXIgKi8KKyAgICAgICAgICAgIHN0YXR1cyA9IEdldE1CaGVhZGVyKHZpZGVvLCAmUVApOworCisgICAgICAgICAgICBpZiAoc3RhdHVzICE9IFBWX1NVQ0NFU1MpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7CisgICAgICAgICAgICAgICAgdmlkZW8tPm1ibnVtID0gbWJfc3RhcnQ7CisgICAgICAgICAgICAgICAgbW92ZVBvaW50ZXJUbyhzdHJlYW0sIChzdGFydFBhY2tldCAmIC04KSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8qIFN0b3JlIHRoZSBRUCB2YWx1ZSBmb3IgbGF0ZXIgdXNlIGluIEFDIHByZWRpY3Rpb24gKi8KKyAgICAgICAgICAgIFFQTUJbbWJudW1dID0gUVA7CisKKyAgICAgICAgICAgIGlmIChNb2RlW21ibnVtXSAhPSBNT0RFX1NLSVBQRUQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLyogZGVjb2RlIHRoZSBEQ1QgY29lZmljaWVudHMgZm9yIHRoZSBNQiAqLworICAgICAgICAgICAgICAgIHN0YXR1cyA9IEdldE1CRGF0YSh2aWRlbyk7CisgICAgICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBQVl9TVUNDRVNTKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7CisgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5tYm51bSA9IG1iX3N0YXJ0OworICAgICAgICAgICAgICAgICAgICBtb3ZlUG9pbnRlclRvKHN0cmVhbSwgKHN0YXJ0UGFja2V0ICYgLTgpKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSAvKiBNT0RFX1NLSVBQRUQgKi8KKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBTa2lwcGVkTUJNb3Rpb25Db21wKHZpZGVvKTsgLyogIDA4LzA0LzA1ICovCisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBNb3Rpb24gY29tcGVuc2F0aW9uIGFuZCBwdXQgdmlkZW8tPm1ibG9jay0+cHJlZF9ibG9jaworICAgICAgICAgICAgbWJudW0rKzsKKworICAgICAgICAgICAgLyogcmVtb3ZlIGFueSBzdHVmZmluZyBiaXRzICovCisgICAgICAgICAgICBCaXRzdHJlYW1TaG93Qml0czE2KHN0cmVhbSwgc3R1ZmZpbmdfbGVuZ3RoLCAmY29kZSk7CisgICAgICAgICAgICB3aGlsZSAoY29kZSA9PSAxKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIFBWX0JpdHN0cmVhbUZsdXNoQml0cyhzdHJlYW0sIHN0dWZmaW5nX2xlbmd0aCk7CisgICAgICAgICAgICAgICAgQml0c3RyZWFtU2hvd0JpdHMxNihzdHJlYW0sIHN0dWZmaW5nX2xlbmd0aCwgJmNvZGUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvKiBoYXZlIHdlIHJlYWNoZWQgdGhlIGVuZCBvZiB0aGUgdmlkZW8gcGFja2V0IG9yIHZvcD8gKi8KKyAgICAgICAgICAgIGlmIChzaG9ydFZpZGVvSGVhZGVyKQorICAgICAgICAgICAgeworI2lmZGVmIFBWX0FOTkVYX0lKS1RfU1VQUE9SVAorICAgICAgICAgICAgICAgIGlmICghdmlkZW8tPnNsaWNlX3N0cnVjdHVyZSkKKyAgICAgICAgICAgICAgICB7CisjZW5kaWYKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1ibnVtID49IChpbnQpKHZpZGVvLT5tYm51bV9yb3cgKyAxKSp2aWRlby0+bk1CaW5HT0IpICAgLyogIDEwLzExLzAxICovCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYm51bSA+PSBuVG90YWxNQikgcmV0dXJuIFBWX1NVQ0NFU1M7CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1TaG93Qml0czMyKHN0cmVhbSwgR09CX1JFU1lOQ19NQVJLRVJfTEVOR1RILCAmdG1wdmFyKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSBHT0JfUkVTWU5DX01BUktFUikKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9CaXRzdHJlYW1TaG93Qml0c0J5dGVBbGlnbihzdHJlYW0sIEdPQl9SRVNZTkNfTUFSS0VSX0xFTkdUSCwgJnRtcHZhcik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSBHT0JfUkVTWU5DX01BUktFUikgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKworICAgICAgICAgICAgICAgICAgICBpZiAobWJudW0gPj0gblRvdGFsTUIpICAvKiBpbiBjYXNlIG5vIHZhbGlkIHN0dWZmaW5nICAwNi8yMy8wMSAqLworICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZF9zdHVmZmluZyA9IHZhbGlkU3R1ZmZpbmdfaDI2MyhzdHJlYW0pOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZhbGlkX3N0dWZmaW5nID09IDApCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29uY2VhbFBhY2tldCh2aWRlbywgbWJfc3RhcnQsIG5Ub3RhbE1CLCBzbGljZV9jb3VudGVyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9TVUNDRVNTOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8qIEFOTkVYX0sgKi8KKyAgICAgICAgICAgICAgICAgICAgUFZfQml0c3RyZWFtU2hvd0JpdHNCeXRlQWxpZ25Ob0ZvcmNlU3R1ZmZpbmcoc3RyZWFtLCAxNywgJnRtcHZhcik7CisgICAgICAgICAgICAgICAgICAgIGlmICh0bXB2YXIgPT0gUkVTWU5DX01BUktFUikKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRfc3R1ZmZpbmcgPSB2YWxpZFN0dWZmaW5nX2gyNjMoc3RyZWFtKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2YWxpZF9zdHVmZmluZykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsgLyogIDA2LzIxLzAxICovCisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIH0KKyNlbmRpZgorICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChtYm51bSA+PSBuVG90YWxNQikgIC8qIGluIGNhc2Ugbm8gdmFsaWQgc3R1ZmZpbmcgIDA2LzIzLzAxICovCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAvKiAgMTEvMDEvMjAwMiBpZiB3ZSBhcmUgYXQgdGhlIGVuZCBvZiB0aGUgZnJhbWUgYW5kIHRoZXJlIGlzIHNvbWUgZ2FyYmFnZSBkYXRhCisgICAgICAgICAgICAgICAgICAgIGF0IHRoZSBlbmQgb2YgdGhlIGZyYW1lIChpLmUuIG5vIG5leHQgc3RhcnRjb2RlKSBicmVhayBpZiB0aGUgc3R1ZmZpbmcgaXMgdmFsaWQgKi8KKyAgICAgICAgICAgICAgICAgICAgdmFsaWRfc3R1ZmZpbmcgPSB2YWxpZFN0dWZmaW5nKHN0cmVhbSk7CisgICAgICAgICAgICAgICAgICAgIGlmICh2YWxpZF9zdHVmZmluZyA9PSAwKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAvKiBlbmQgMTEvMDEvMjAwMiAqLworICAgICAgICAgICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7CisgICAgICAgICAgICAgICAgICAgICAgICBDb25jZWFsUGFja2V0KHZpZGVvLCBtYl9zdGFydCwgblRvdGFsTUIsIHNsaWNlX2NvdW50ZXIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIFBWX0JpdHN0cmVhbUJ5dGVBbGlnbihzdHJlYW0pOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gUFZfU1VDQ0VTUzsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9CaXRzdHJlYW1TaG93Qml0c0J5dGVBbGlnbihzdHJlYW0sIDIzLCAmdG1wdmFyKTsgLyogdGhpcyBjYWxsIGlzIHZhbGlkIGZvciBmX2NvZGUgPCA4ICovCisgICAgICAgICAgICAgICAgbG9uZ196ZXJvX2JpdHMgPSAhdG1wdmFyOworCisgICAgICAgICAgICAgICAgaWYgKCh0bXB2YXIgPj4gKDIzIC0gcmVzeW5jX21hcmtlcl9sZW5ndGgpKSA9PSBSRVNZTkNfTUFSS0VSIHx8IGxvbmdfemVyb19iaXRzKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFsaWRfc3R1ZmZpbmcgPSB2YWxpZFN0dWZmaW5nKHN0cmVhbSk7CisgICAgICAgICAgICAgICAgICAgIGlmICh2YWxpZF9zdHVmZmluZykKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOyAvKiAgMDYvMjEvMDEgKi8KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB3aGlsZSAoVFJVRSk7CisKKyAgICAgICAgaWYgKHNob3J0VmlkZW9IZWFkZXIpCisgICAgICAgIHsgLyogV2UgbmVlZCB0byBjaGVjayBuZXdnb2IgdG8gcmVmcmVzaCBxdWFudGl6ZXIgKi8KKyNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKKyAgICAgICAgICAgIGlmICghdmlkZW8tPnNsaWNlX3N0cnVjdHVyZSkKKyAgICAgICAgICAgIHsKKyNlbmRpZgorICAgICAgICAgICAgICAgIHdoaWxlICgoc3RhdHVzID0gUFZfR29iSGVhZGVyKHZpZGVvKSkgPT0gUFZfRkFJTCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmICgoc3RhdHVzID0gcXVpY2tTZWFyY2hHT0JIZWFkZXIoc3RyZWFtKSkgIT0gUFZfU1VDQ0VTUykKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBtYm51bSA9IGN1cnJWb3AtPmdvYk51bWJlciAqIHZpZGVvLT5uTUJpbkdPQjsKKyNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB3aGlsZSAoKHN0YXR1cyA9IFBWX0gyNjNTbGljZUhlYWRlcih2aWRlbywgJm1ibnVtKSkgPT0gUFZfRkFJTCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmICgoc3RhdHVzID0gcXVpY2tTZWFyY2hIMjYzU2xpY2VIZWFkZXIoc3RyZWFtKSkgIT0gUFZfU1VDQ0VTUykKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyNlbmRpZgorICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgd2hpbGUgKChzdGF0dXMgPSBQVl9SZWFkVmlkZW9QYWNrZXRIZWFkZXIodmlkZW8sICZtYm51bSkpID09IFBWX0ZBSUwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKChzdGF0dXMgPSBxdWlja1NlYXJjaFZpZGVvUGFja2V0SGVhZGVyKHN0cmVhbSwgcmVzeW5jX21hcmtlcl9sZW5ndGgpKSAhPSBQVl9TVUNDRVNTKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKHN0YXR1cyA9PSBQVl9FTkRfT0ZfVk9QKQorICAgICAgICB7CisgICAgICAgICAgICBtYm51bSA9IG5Ub3RhbE1COworICAgICAgICB9CisKKyAgICAgICAgaWYgKG1ibnVtID4gdmlkZW8tPm1ibnVtICsgMSkKKyAgICAgICAgeworICAgICAgICAgICAgQ29uY2VhbFBhY2tldCh2aWRlbywgdmlkZW8tPm1ibnVtLCBtYm51bSwgc2xpY2VfY291bnRlcik7CisgICAgICAgIH0KKyAgICAgICAgUVAgPSB2aWRlby0+Y3VyclZvcC0+cXVhbnRpemVyOworICAgICAgICBzbGljZV9jb3VudGVyKys7CisgICAgICAgIGlmIChtYm51bSA+PSBuVG90YWxNQikgYnJlYWs7CisKKyAgICB9CisgICAgd2hpbGUgKFRSVUUpOworICAgIHJldHVybiBQVl9TVUNDRVNTOworfQorCisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IEdldE1CSGVhZGVyKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6IERlY29kZSBNQiBoZWFkZXIsIG5vdF9jb2RlZCwgbWNicGMsIGFjX3ByZWRfZmxhZywgY2JweSwgZHF1YW50LiAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgMy8yOS8wMCA6IENoYW5nZWQgdGhlIHJldHVybmVkIHZhbHVlIGFuZCBvcHRpbWl6ZWQgdGhlIGNvZGUuICAgICovCisvKiAgICAgIDQvMDEvMDEgOiBuZXcgQUNEQyBwcmVkaWN0aW9uIHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworUFZfU1RBVFVTIEdldE1CaGVhZGVyKFZpZGVvRGVjRGF0YSAqdmlkZW8sIGludDE2ICpRUCkKK3sKKyAgICBCaXRzdHJlYW1EZWNWaWRlbyAqc3RyZWFtID0gdmlkZW8tPmJpdHN0cmVhbTsKKyAgICBpbnQgbWJudW0gPSB2aWRlby0+bWJudW07CisgICAgdWludDggKk1vZGUgPSB2aWRlby0+aGVhZGVySW5mby5Nb2RlOworICAgIGludCB4X3BvcyA9IHZpZGVvLT5tYm51bV9jb2w7CisgICAgdHlwZURDU3RvcmUgKkRDID0gdmlkZW8tPnByZWREQyArIG1ibnVtOworICAgIHR5cGVEQ0FDU3RvcmUgKkRDQUNfcm93ID0gdmlkZW8tPnByZWREQ0FDX3JvdyArIHhfcG9zOworICAgIHR5cGVEQ0FDU3RvcmUgKkRDQUNfY29sID0gdmlkZW8tPnByZWREQ0FDX2NvbDsKKyAgICBjb25zdCBzdGF0aWMgaW50MTYgIERRX3RhYls0XSA9IHsgLTEsIC0yLCAxLCAyfTsKKworICAgIGludCBDQlBZLCBDQlBDOworICAgIGludCBNQnR5cGUsIFZvcFR5cGU7CisgICAgaW50IE1DQlBDOworICAgIHVpbnQgRFFVQU5UOworICAgIGludCBjb21wOworICAgIEJvb2wgbWJfY29kZWQ7CisKKyAgICBWb3BUeXBlID0gdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlOworICAgIG1iX2NvZGVkID0gKChWb3BUeXBlID09IElfVk9QKSA/IFRSVUUgOiAhQml0c3RyZWFtUmVhZDFCaXRzX0lOTElORShzdHJlYW0pKTsKKworICAgIGlmICghbWJfY29kZWQpCisgICAgeworICAgICAgICAvKiBza2lwcGVkIG1hY3JvYmxvY2sgKi8KKyAgICAgICAgTW9kZVttYm51bV0gPSBNT0RFX1NLSVBQRUQ7CisgICAgICAgIC8vb3NjbF9tZW1zZXQoRENBQ19yb3csIDAsIHNpemVvZih0eXBlRENBQ1N0b3JlKSk7ICAgLyogIFNLSVBQRURfQUNEQyAqLworICAgICAgICAvL29zY2xfbWVtc2V0KERDQUNfY29sLCAwLCBzaXplb2YodHlwZURDQUNTdG9yZSkpOworICAgICAgICBaRVJPX09VVF82NEJZVEVTKERDQUNfcm93KTsKKyAgICAgICAgWkVST19PVVRfNjRCWVRFUyhEQ0FDX2NvbCk7IC8qICAwOC8xMi8wNSAqLworCisgICAgICAgIGZvciAoY29tcCA9IDA7IGNvbXAgPCA2OyBjb21wKyspCisgICAgICAgIHsKKyAgICAgICAgICAgICgqREMpW2NvbXBdID0gbWlkX2dyYXk7CisgICAgICAgIH0KKyAgICB9CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgLyogY29kZWQgbWFjcm9ibG9jayAqLworICAgICAgICBpZiAoVm9wVHlwZSA9PSBJX1ZPUCkKKyAgICAgICAgeworICAgICAgICAgICAgTUNCUEMgPSBQVl9WbGNEZWNNQ0JQQ19jb21faW50cmEoc3RyZWFtKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKKyAgICAgICAgICAgIGlmICghdmlkZW8tPmRlYmxvY2tpbmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTUNCUEMgPSBQVl9WbGNEZWNNQ0JQQ19jb21faW50ZXIoc3RyZWFtKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBNQ0JQQyA9IFBWX1ZsY0RlY01DQlBDX2NvbV9pbnRlcl9IMjYzKHN0cmVhbSk7CisgICAgICAgICAgICB9CisjZWxzZQorICAgICAgICAgICAgTUNCUEMgPSBQVl9WbGNEZWNNQ0JQQ19jb21faW50ZXIoc3RyZWFtKTsKKyNlbmRpZgorICAgICAgICB9CisKKyAgICAgICAgaWYgKFZMQ19FUlJPUl9ERVRFQ1RFRChNQ0JQQykpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgICAgICB9CisKKyAgICAgICAgTW9kZVttYm51bV0gPSAodWludDgpKE1CdHlwZSA9IE1CdHlwZV9tb2RlW01DQlBDICYgN10pOworICAgICAgICBDQlBDID0gKE1DQlBDID4+IDQpICYgMzsKKworI2lmZGVmIFBWX0FOTkVYX0lKS1RfU1VQUE9SVAorICAgICAgICBpZiAoTUJ0eXBlICYgSU5UUkFfTUFTSykKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKCF2aWRlby0+c2hvcnRWaWRlb0hlYWRlcikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2aWRlby0+YWNQcmVkRmxhZ1ttYm51bV0gPSAodWludDgpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmICh2aWRlby0+YWR2YW5jZWRfSU5UUkEpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoIUJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+YWNQcmVkRmxhZ1ttYm51bV0gPSAwOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmFjUHJlZEZsYWdbbWJudW1dID0gMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+bWJsb2NrLT5kaXJlY3Rpb24gPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5tYmxvY2stPmRpcmVjdGlvbiA9IDE7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmFjUHJlZEZsYWdbbWJudW1dID0gMDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyNlbHNlCisgICAgICAgIGlmICgoTUJ0eXBlICYgSU5UUkFfTUFTSykgJiYgIXZpZGVvLT5zaG9ydFZpZGVvSGVhZGVyKQorICAgICAgICB7CisgICAgICAgICAgICB2aWRlby0+YWNQcmVkRmxhZ1ttYm51bV0gPSAodWludDgpIEJpdHN0cmVhbVJlYWQxQml0c19JTkxJTkUoc3RyZWFtKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHZpZGVvLT5hY1ByZWRGbGFnW21ibnVtXSA9IDA7CisgICAgICAgIH0KKyNlbmRpZgorICAgICAgICBDQlBZID0gUFZfVmxjRGVjQ0JQWShzdHJlYW0sIE1CdHlwZSAmIElOVFJBX01BU0spOyAvKiBJTlRSQSB8fCBJTlRSQV9RICovCisgICAgICAgIGlmIChDQlBZIDwgMCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgIH0KKworICAgICAgICAvLyBHVyAwNC8yMy85OQorICAgICAgICB2aWRlby0+aGVhZGVySW5mby5DQlBbbWJudW1dID0gKHVpbnQ4KShDQlBZIDw8IDIgfCAoQ0JQQyAmIDMpKTsKKyNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKKyAgICAgICAgaWYgKE1CdHlwZSAmIFFfTUFTSykKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKCF2aWRlby0+bW9kaWZpZWRfcXVhbnQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgRFFVQU5UID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDIpOworICAgICAgICAgICAgICAgICpRUCArPSBEUV90YWJbRFFVQU5UXTsKKworICAgICAgICAgICAgICAgIGlmICgqUVAgPCAxKSAqUVAgPSAxOworICAgICAgICAgICAgICAgIGVsc2UgaWYgKCpRUCA+IDMxKSAqUVAgPSAzMTsKKyAgICAgICAgICAgICAgICB2aWRlby0+UVBfQ0hSID0gKlFQOyAgLyogQU5ORVhfVCAqLworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgKlFQICs9IERRX3RhYl9Bbm5leF9UXzExWypRUF07CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAqUVAgKz0gRFFfdGFiX0FubmV4X1RfMTBbKlFQXTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoKlFQIDwgMSkgKlFQID0gMTsKKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoKlFQID4gMzEpICpRUCA9IDMxOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAqUVAgPSAoaW50MTYpQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB2aWRlby0+UVBfQ0hSID0gIE1RX2Nocm9tYV9RUF90YWJsZVsqUVBdOworICAgICAgICAgICAgfQorICAgICAgICB9CisjZWxzZQorICAgICAgICBpZiAoTUJ0eXBlICYgUV9NQVNLKQorICAgICAgICB7CisgICAgICAgICAgICBEUVVBTlQgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMik7CisgICAgICAgICAgICAqUVAgKz0gRFFfdGFiW0RRVUFOVF07CisKKyAgICAgICAgICAgIGlmICgqUVAgPCAxKSAqUVAgPSAxOworICAgICAgICAgICAgZWxzZSBpZiAoKlFQID4gMzEpICpRUCA9IDMxOworICAgICAgICB9CisjZW5kaWYKKyAgICB9CisgICAgcmV0dXJuIFBWX1NVQ0NFU1M7Cit9CisKKworCisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEJlZ2luKioqKioqCisqICAgICAgIDMvMTAvMDAgIDogaW5pdGlhbCBtb2RpZmljYXRpb24gdG8gdGhlCisqICAgICAgICAgICAgICAgIG5ldyBQVi1EZWNvZGVyIExpYiBmb3JtYXQuCisqICAgICAgIDQvMi8yMDAwIDogQ2xlYW51cCBhbmQgZXJyb3ItaGFuZGxpbmcgbW9kaWZpY2F0aW9uLiAgVGhpcworKiAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoYXMgYmVlbiBkaXZpZGVkIGludG8gc2V2ZXJhbCBzdWItZnVuY3Rpb25zIGZvcgorKiAgICAgICAgICAgICAgICAgICBiZXR0ZXIgY29kaW5nIHN0eWxlIGFuZCBtYWludGFpbmFuY2UgcmVhc29uLiAgSSBhbHNvCisqICAgICAgICAgICAgICAgICAgIGdyZWF0bHkgc2hydW5rIHRoZSBjb2RlIHNpemUgaGVyZS4KKyogICAgICAgOS8xOC8yMDAwIDogVmxjRGVjb2RlK0RlcXVhbnQgb3B0aW1pemF0aW9uICoKKyogICAgICAgNC8wMS8yMDAxIDogbmV3IEFDREMgcHJlZGljdGlvbiBzdHJ1Y3R1cmUKKyogICAgICAgMy8yOS8yMDAyIDogcmVtb3ZlZCBHZXRJbnRyYU1CIGFuZCBHZXRJbnRlck1CCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRFbmQqKioqKioqKi8KK1BWX1NUQVRVUyBHZXRNQkRhdGEoVmlkZW9EZWNEYXRhICp2aWRlbykKK3sKKyAgICBCaXRzdHJlYW1EZWNWaWRlbyAqc3RyZWFtID0gdmlkZW8tPmJpdHN0cmVhbTsKKyAgICBpbnQgbWJudW0gPSB2aWRlby0+bWJudW07CisgICAgTWFjcm9CbG9jayAqbWJsb2NrID0gdmlkZW8tPm1ibG9jazsKKyAgICBpbnQxNiAqZGF0YUJsb2NrOworICAgIFBJWEVMICpjX2NvbXA7CisgICAgdWludCBtb2RlID0gdmlkZW8tPmhlYWRlckluZm8uTW9kZVttYm51bV07CisgICAgdWludCBDQlAgPSB2aWRlby0+aGVhZGVySW5mby5DQlBbbWJudW1dOworICAgIHR5cGVEQ1N0b3JlICpEQyA9IHZpZGVvLT5wcmVkREMgKyBtYm51bTsKKyAgICBpbnQgaW50cmFfZGNfdmxjX3RociA9IHZpZGVvLT5jdXJyVm9wLT5pbnRyYURDVmxjVGhyOworICAgIGludDE2IFFQID0gdmlkZW8tPlFQTUJbbWJudW1dOworICAgIGludDE2IFFQX3RtcCA9IFFQOworICAgIGludCB3aWR0aCA9IHZpZGVvLT53aWR0aDsKKyAgICBpbnQgIGNvbXA7CisgICAgaW50ICBzd2l0Y2hlZDsKKyAgICBpbnQgbmNvZWZmc1s2XSA9IHswLCAwLCAwLCAwLCAwLCAwfTsKKyAgICBpbnQgKm5vX2NvZWZmID0gbWJsb2NrLT5ub19jb2VmZjsKKyAgICBpbnQxNiBEQ19jb2VmZjsKKyAgICBQVl9TVEFUVVMgc3RhdHVzOworCisgICAgaW50IHlfcG9zID0gdmlkZW8tPm1ibnVtX3JvdzsKKyAgICBpbnQgeF9wb3MgPSB2aWRlby0+bWJudW1fY29sOworICAgIGludDMyIG9mZnNldCA9IChpbnQzMikoeV9wb3MgPDwgNCkgKiB3aWR0aCArICh4X3BvcyA8PCA0KTsKKworICAgIC8qIERlY29kZSBlYWNoIDgtYnktOCBibG9ja3MuIGNvbXAgMCB+IDMgYXJlIGx1bWluYW5jZSBibG9ja3MsIDQgfiA1ICovCisgICAgLyogIGFyZSBjaHJvbWluYW5jZSBibG9ja3MuICAgMDQvMDMvMjAwMC4gICAgICAgICAgICAgICAgICAgICAgICAgICovCisKKyAgICAvKiAgb3NjbF9tZW1zZXQobWJsb2NrLT5ibG9jaywgMCwgc2l6ZW9mKHR5cGVNQlN0b3JlKSk7ICAgIEF1ZyA5LDIwMDUgKi8KKworICAgIGlmIChtb2RlICYgSU5UUkFfTUFTSykgLyogTU9ERV9JTlRSQSB8fCBNT0RFX0lOVFJBX1EgKi8KKyAgICB7CisgICAgICAgIHN3aXRjaGVkID0gMDsKKyAgICAgICAgaWYgKGludHJhX2RjX3ZsY190aHIpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICh2aWRlby0+dXNlUHJldlFQKQorICAgICAgICAgICAgICAgIFFQX3RtcCA9IHZpZGVvLT5RUE1CW21ibnVtLTFdOyAgIC8qIHJ1bm5pbmcgUVAgIDA0LzI2LzAxICovCisKKyAgICAgICAgICAgIHN3aXRjaGVkID0gKGludHJhX2RjX3ZsY190aHIgPT0gNyB8fCBRUF90bXAgPj0gaW50cmFfZGNfdmxjX3RociAqIDIgKyAxMSk7CisgICAgICAgIH0KKworICAgICAgICBtYmxvY2stPkRDU2NhbGFyTHVtID0gY2FsX2RjX3NjYWxlcihRUCwgTFVNSU5BTkNFX0RDX1RZUEUpOyAgIC8qICAzLzAxLzAxICovCisgICAgICAgIG1ibG9jay0+RENTY2FsYXJDaHIgPSBjYWxfZGNfc2NhbGVyKFFQLCBDSFJPTUlOQU5DRV9EQ19UWVBFKTsKKworICAgICAgICBmb3IgKGNvbXAgPSAwOyBjb21wIDwgNjsgY29tcCsrKQorICAgICAgICB7CisgICAgICAgICAgICBkYXRhQmxvY2sgPSBtYmxvY2stPmJsb2NrW2NvbXBdOyAgICAvKiAxMC8yMC8yMDAwICovCisKKyAgICAgICAgICAgIGlmICh2aWRlby0+c2hvcnRWaWRlb0hlYWRlcikKKyAgICAgICAgICAgIHsKKyNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKKyAgICAgICAgICAgICAgICBpZiAoIXZpZGVvLT5hZHZhbmNlZF9JTlRSQSkKKyAgICAgICAgICAgICAgICB7CisjZW5kaWYKKyAgICAgICAgICAgICAgICAgICAgRENfY29lZmYgPSAoaW50MTYpIEJpdHN0cmVhbVJlYWRCaXRzMTZfSU5MSU5FKHN0cmVhbSwgOCk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKChEQ19jb2VmZiAmIDB4N2YpID09IDApIC8qIDEyOCAmIDAgICovCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qIGN1cnJlbnRseSB3ZSB3aWxsIG9ubHkgc2lnbmFsIEZBSUwgZm9yIDEyOC4gV2Ugd2lsbCBpZ25vcmUgdGhlIDAgY2FzZSAgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChEQ19jb2VmZiA9PSAxMjgpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKERDX2NvZWZmID09IDI1NSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgRENfY29lZmYgPSAxMjg7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZGF0YUJsb2NrWzBdID0gKGludDE2KSBEQ19jb2VmZjsKKyNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKKyAgICAgICAgICAgICAgICB9CisjZW5kaWYKKyAgICAgICAgICAgICAgICBuY29lZmZzW2NvbXBdID0gVmxjRGVxdWFudEgyNjNJbnRyYUJsb2NrX1NIKHZpZGVvLCBjb21wLCBtYmxvY2stPmJpdG1hcGNvbFtjb21wXSwgJm1ibG9jay0+Yml0bWFwcm93W2NvbXBdKTsKKworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChzd2l0Y2hlZCA9PSAwKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRGVjb2RlUHJlZGljdGVkSW50cmFEQyhjb21wLCBzdHJlYW0sICZEQ19jb2VmZik7CisgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIFBWX0ZBSUw7CisKKyAgICAgICAgICAgICAgICAgICAgZGF0YUJsb2NrWzBdID0gKGludDE2KSBEQ19jb2VmZjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbmNvZWZmc1tjb21wXSA9IFZsY0RlcXVhbnRIMjYzSW50cmFCbG9jayh2aWRlbywgY29tcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoZWQsIG1ibG9jay0+Yml0bWFwY29sW2NvbXBdLCAmbWJsb2NrLT5iaXRtYXByb3dbY29tcF0pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoVkxDX0VSUk9SX0RFVEVDVEVEKG5jb2VmZnNbY29tcF0pKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChzd2l0Y2hlZCkKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgbmNvZWZmc1tjb21wXSA9IDE7CisgICAgICAgICAgICAgICAgICAgIG9zY2xfbWVtc2V0KChkYXRhQmxvY2sgKyAxKSwgMCwgc2l6ZW9mKGludDE2KSo2Myk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgbm9fY29lZmZbY29tcF0gPSBuY29lZmZzW2NvbXBdOworCisgICAgICAgIH0KKyAgICAgICAgTUJsb2NrSURDVCh2aWRlbyk7CisgICAgfQorICAgIGVsc2UgICAgICAvKiBJTlRFUiBtb2RlcyAqLworICAgIHsgICAvKiAgbW92ZWQgaXQgaGVyZSBBdWcgMTUsIDIwMDUgKi8KKyAgICAgICAgLyogZGVjb2RlIHRoZSBtb3Rpb24gdmVjdG9yIChpZiB0aGVyZSBhcmUgYW55KSAqLworICAgICAgICBzdGF0dXMgPSBQVl9HZXRNQnZlY3RvcnModmlkZW8sIG1vZGUpOworICAgICAgICBpZiAoc3RhdHVzICE9IFBWX1NVQ0NFU1MpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgICAgIH0KKworCisgICAgICAgIE1CTW90aW9uQ29tcCh2aWRlbywgQ0JQKTsKKyAgICAgICAgY19jb21wICA9IHZpZGVvLT5jdXJyVm9wLT55Q2hhbiArIG9mZnNldDsKKworI2lmZGVmIFBWX0FOTkVYX0lKS1RfU1VQUE9SVAorICAgICAgICBmb3IgKGNvbXAgPSAwOyBjb21wIDwgNDsgY29tcCsrKQorICAgICAgICB7CisgICAgICAgICAgICAoKkRDKVtjb21wXSA9IG1pZF9ncmF5OworICAgICAgICAgICAgaWYgKENCUCAmICgxIDw8ICg1IC0gY29tcCkpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG5jb2VmZnNbY29tcF0gPSBWbGNEZXF1YW50SDI2M0ludGVyQmxvY2sodmlkZW8sIGNvbXAsIG1ibG9jay0+Yml0bWFwY29sW2NvbXBdLCAmbWJsb2NrLT5iaXRtYXByb3dbY29tcF0pOworICAgICAgICAgICAgICAgIGlmIChWTENfRVJST1JfREVURUNURUQobmNvZWZmc1tjb21wXSkpIHJldHVybiBQVl9GQUlMOworCisgICAgICAgICAgICAgICAgQmxvY2tJRENUKGNfY29tcCArIChjb21wJjIpKih3aWR0aCA8PCAyKSArIDgqKGNvbXAmMSksIG1ibG9jay0+cHJlZF9ibG9jayArIChjb21wJjIpKjY0ICsgOCooY29tcCYxKSwgbWJsb2NrLT5ibG9ja1tjb21wXSwgd2lkdGgsIG5jb2VmZnNbY29tcF0sCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ibG9jay0+Yml0bWFwY29sW2NvbXBdLCBtYmxvY2stPmJpdG1hcHJvd1tjb21wXSk7CisKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZpZGVvLT5RUE1CW21ibnVtXSA9IHZpZGVvLT5RUF9DSFI7ICAgICAvKiBBTk5FWF9UICovCisKKworCisgICAgICAgICgqREMpWzRdID0gbWlkX2dyYXk7CisgICAgICAgIGlmIChDQlAgJiAyKQorICAgICAgICB7CisgICAgICAgICAgICBuY29lZmZzWzRdID0gVmxjRGVxdWFudEgyNjNJbnRlckJsb2NrKHZpZGVvLCA0LCBtYmxvY2stPmJpdG1hcGNvbFs0XSwgJm1ibG9jay0+Yml0bWFwcm93WzRdKTsKKyAgICAgICAgICAgIGlmIChWTENfRVJST1JfREVURUNURUQobmNvZWZmc1s0XSkpIHJldHVybiBQVl9GQUlMOworCisgICAgICAgICAgICBCbG9ja0lEQ1QodmlkZW8tPmN1cnJWb3AtPnVDaGFuICsgKG9mZnNldCA+PiAyKSArICh4X3BvcyA8PCAyKSwgbWJsb2NrLT5wcmVkX2Jsb2NrICsgMjU2LCBtYmxvY2stPmJsb2NrWzRdLCB3aWR0aCA+PiAxLCBuY29lZmZzWzRdLAorICAgICAgICAgICAgICAgICAgICAgIG1ibG9jay0+Yml0bWFwY29sWzRdLCBtYmxvY2stPmJpdG1hcHJvd1s0XSk7CisKKyAgICAgICAgfQorICAgICAgICAoKkRDKVs1XSA9IG1pZF9ncmF5OworICAgICAg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JTDsKKworICAgICAgICAgICAgICAgIEJsb2NrSURDVChjX2NvbXAgKyAoY29tcCYyKSood2lkdGggPDwgMikgKyA4Kihjb21wJjEpLCBtYmxvY2stPnByZWRfYmxvY2sgKyAoY29tcCYyKSo2NCArIDgqKGNvbXAmMSksIG1ibG9jay0+YmxvY2tbY29tcF0sIHdpZHRoLCBuY29lZmZzW2NvbXBdLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYmxvY2stPmJpdG1hcGNvbFtjb21wXSwgbWJsb2NrLT5iaXRtYXByb3dbY29tcF0pOworCisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAoKkRDKVs0XSA9IG1pZF9ncmF5OworICAgICAgICBpZiAoQ0JQICYgMikKKyAgICAgICAgeworICAgICAgICAgICAgbmNvZWZmc1s0XSA9IFZsY0RlcXVhbnRIMjYzSW50ZXJCbG9jayh2aWRlbywgNCwgbWJsb2NrLT5iaXRtYXBjb2xbNF0sICZtYmxvY2stPmJpdG1hcHJvd1s0XSk7CisgICAgICAgICAgICBpZiAoVkxDX0VSUk9SX0RFVEVDVEVEKG5jb2VmZnNbNF0pKSByZXR1cm4gUFZfRkFJTDsKKworICAgICAgICAgICAgQmxvY2tJRENUKHZpZGVvLT5jdXJyVm9wLT51Q2hhbiArIChvZmZzZXQgPj4gMikgKyAoeF9wb3MgPDwgMiksIG1ibG9jay0+cHJlZF9ibG9jayArIDI1NiwgbWJsb2NrLT5ibG9ja1s0XSwgd2lkdGggPj4gMSwgbmNvZWZmc1s0XSwKKyAgICAgICAgICAgICAgICAgICAgICBtYmxvY2stPmJpdG1hcGNvbFs0XSwgbWJsb2NrLT5iaXRtYXByb3dbNF0pOworCisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICAvKiBubyBJRENUIGZvciBhbGwgemVyb3MgYmxvY2tzICAwMy8yOC8yMDAyICovCisgICAgICAgICAgICAvKiAgICAgICAgICAgICAgQmxvY2tJRENUKCk7ICAgICAgICAgICAgICAgICovCisgICAgICAgIH0KKyAgICAgICAgKCpEQylbNV0gPSBtaWRfZ3JheTsKKyAgICAgICAgaWYgKENCUCAmIDEpCisgICAgICAgIHsKKyAgICAgICAgICAgIG5jb2VmZnNbNV0gPSBWbGNEZXF1YW50SDI2M0ludGVyQmxvY2sodmlkZW8sIDUsIG1ibG9jay0+Yml0bWFwY29sWzVdLCAmbWJsb2NrLT5iaXRtYXByb3dbNV0pOworICAgICAgICAgICAgaWYgKFZMQ19FUlJPUl9ERVRFQ1RFRChuY29lZmZzWzVdKSkgcmV0dXJuIFBWX0ZBSUw7CisKKyAgICAgICAgICAgIEJsb2NrSURDVCh2aWRlby0+Y3VyclZvcC0+dkNoYW4gKyAob2Zmc2V0ID4+IDIpICsgKHhfcG9zIDw8IDIpLCBtYmxvY2stPnByZWRfYmxvY2sgKyAyNjQsIG1ibG9jay0+YmxvY2tbNV0sIHdpZHRoID4+IDEsIG5jb2VmZnNbNV0sCisgICAgICAgICAgICAgICAgICAgICAgbWJsb2NrLT5iaXRtYXBjb2xbNV0sIG1ibG9jay0+Yml0bWFwcm93WzVdKTsKKworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgLyogbm8gSURDVCBmb3IgYWxsIHplcm9zIGJsb2NrcyAgMDMvMjgvMjAwMiAqLworICAgICAgICAgICAgLyogICAgICAgICAgICAgIEJsb2NrSURDVCgpOyAgICAgICAgICAgICAgICAqLworI2VuZGlmICAvLyBQVl9BTk5FWF9JSktUX1NVUFBPUlQKKworCisKKworCisKKyAgICB9CisKKyAgICB2aWRlby0+dXNlUHJldlFQID0gMTsgICAgICAgICAgLyogc2hvdWxkIGJlIHNldCBhZnRlciBkZWNvZGluZyB0aGUgZmlyc3QgQ29kZWQgIDA0LzI3LzAxICovCisgICAgcmV0dXJuIFBWX1NVQ0NFU1M7Cit9CisKKworCmRpZmYgLS1naXQgYS9tZWRpYS9saWJzdGFnZWZyaWdodC9jb2RlY3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RzQgYml0c3RyZWFtIGluIGRhdGFwYXJ0aXRpb25pbmcgbW9kZS4gICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgMDQvMjUvMjAwMCA6IFJld3JpdGUgdGhlIGRhdGEgcGFydGl0aW9uaW5nIHBhdGggY29tcGxldGVseSAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgYWNjb3JkaW5nIHRvIHRoZSBwc2V1ZG8gY29kZXMgaW4gTVBFRy00ICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFuZGFyZC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAwOS8xOC8yMDAwIGFkZCBmYXN0IFZsY0RlY29kZStEZXF1YW50ICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgMDQvMTcvMjAwMSBjbGVhbnVwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworUFZfU1RBVFVTIERlY29kZUZyYW1lRGF0YVBhcnRNb2RlKFZpZGVvRGVjRGF0YSAqdmlkZW8pCit7CisgICAgUFZfU1RBVFVTIHN0YXR1czsKKyAgICBWb3AgKmN1cnJW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RGVjb2RlRnJhbWVEYXRhUGFydE1vZGUoKTogVm9wIHR5cGUgbm90IHN1cHBvcnRlZC5cbiIpOworICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisgICAgfQorCisgICAgLyoqIEluaXRpYWxpemUgc2xpY2VObyAqKiovCisgICAgbWJudW0gPSBzbGljZV9jb3VudGVyID0gMDsKKy8vICBvc2NsX21lbXNldCh2aWRlby0+c2xpY2VObywgMCwgc2l6ZW9mKHVpbnQ4KSpuVG90YWxNQik7CisKKyAgICBkbworICAgIHsKKyAgICAgICAgLyogVGhpcyBzZWN0aW9uIGlzIGVxdWl2YWxlbnQgdG8gbW90aW9uX3NoYXBlX3RleHR1cmUoKSAqLworICAgICAgICAvKiBpbiB0aGUgTVBFRy00IHN0YW5kYXJkLiAgICAgICAgICAgIDA0LzEzLzIwMDAgICAgICAqLworICAgICAgICB2aWRlby0+bWJudW0gPSBtYm51bTsKKyAgICAgICAgdmlkZW8tPm1ibnVtX3JvdyA9IFBWX0dFVF9ST1cobWJudW0sIG5NQlBlclJvdyk7ICAgLyogIFRoaXMgaXMgbmVlZGVkIGlmIG5ibnVtIGlzIHJlYWQgZnJvbSB0aGUgcGFja2V0IGhlYWRlciAqLworICAgICAgICB2aWRlby0+bWJudW1fY29sID0gbWJudW0gLSB2aWRlby0+bWJudW1fcm93ICogbk1CUGVyUm93OworCisgICAgICAgIHN3aXRjaCAodm9wVHlwZSkKKyAgICAgICAgeworICAgICAgICAgICAgY2FzZSBJX1ZPUCA6CisgICAgICAgICAgICAgICAgc3RhdHVzID0gRGVjb2RlRGF0YVBhcnRfSV9WaWRlb1BhY2tldCh2aWRlbywgc2xpY2VfY291bnRlcik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgIGNhc2UgUF9WT1AgOgorICAgICAgICAgICAgICAgIHN0YXR1cyA9IERlY29kZURhdGFQYXJ0X1BfVmlkZW9QYWNrZXQodmlkZW8sIHNsaWNlX2NvdW50ZXIpOworICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBkZWZhdWx0IDoKKyAgICAgICAgICAgICAgICBtcDRkZWNfbG9nKCJEZWNvZGVGcmFtZURhdGFQYXJ0TW9kZSgpOiBWb3AgdHlwZSBub3Qgc3VwcG9ydGVkLlxuIik7CisgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgIH0KKworICAgICAgICB3aGlsZSAoKHN0YXR1cyA9IFBWX1JlYWRWaWRlb1BhY2tldEhlYWRlcih2aWRlbywgJm1ibnVtKSkgPT0gUFZfRkFJTCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKChzdGF0dXMgPSBxdWlja1NlYXJjaFZpZGVvUGFja2V0SGVhZGVyKHN0cmVhbSwgcmVzeW5jX21hcmtlcl9sZW5ndGgpKSAhPSBQVl9TVUNDRVNTKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKHN0YXR1cyA9PSBQVl9FTkRfT0ZfVk9QKQorICAgICAgICB7CisgICAgICAgICAgICBtYm51bSA9IG5Ub3RhbE1COworICAgICAgICB9CisKKyAgICAgICAgaWYgKG1ibnVtID4gdmlkZW8tPm1ibnVtICsgMSkKKyAgICAgICAgeworICAgICAgICAgICAgQ29uY2VhbFBhY2tldCh2aWRlbywgdmlkZW8tPm1ibnVtLCBtYm51bSwgc2xpY2VfY291bnRlcik7CisgICAgICAgIH0KKyAgICAgICAgc2xpY2VfY291bnRlcisrOworICAgICAgICBpZiAobWJudW0gPj0gblRvdGFsTUIpCisgICAgICAgIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKworICAgIH0KKyAgICB3aGlsZSAoVFJVRSk7CisKKyAgICByZXR1cm4gUFZfU1VDQ0VTUzsKK30KKworCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IERlY29kZURhdGFQYXJ0X0lfVmlkZW9QYWNrZXQoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDQvMjUvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiBEZWNvZGUgRGF0YSBQYXJ0aXRpb25lZCBNb2RlIFZpZGVvIFBhY2tldCBpbiBJLVZPUCAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfU1VDQ0VTUyBpZiBzdWNjZXNzZWQsIFBWX0ZBSUwgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAwOS8xOC8yMDAwIGFkZCBmYXN0IFZsY0RlY29kZStEZXF1YW50ICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgMDQvMDEvMjAwMSBmaXhlZCBNQl9zdHVmZmluZywgcmVtb3ZlZCB1bm5lY2Vzc2FyeSBjb2RlICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworUFZfU1RBVFVTIERlY29kZURhdGFQYXJ0X0lfVmlkZW9QYWNrZXQoVmlkZW9EZWNEYXRhICp2aWRlbywgaW50IHNsaWNlX2NvdW50ZXIpCit7CisgICAgUFZfU1RBVFVTIHN0YXR1czsKKyAgICB1aW50OCAqTW9kZSA9IHZpZGVvLT5oZWFkZXJJbmZvLk1vZGU7CisgICAgQml0c3RyZWFtRGVjVmlkZW8gKnN0cmVhbSA9IHZpZGVvLT5iaXRzdHJlYW07CisgICAgaW50ICBuVG90YWxNQiA9IHZpZGVv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NQnR5cGUgPSBNQnR5cGVfbW9kZVtNQ0JQQyAmIDddKTsKKyAgICAgICAgICAgIHZpZGVvLT5oZWFkZXJJbmZvLkNCUFttYm51bV0gPSAodWludDgpKChNQ0JQQyA+PiA0KSAmIDMpOworICAgICAgICAgICAgc3RhdHVzID0gR2V0TUJoZWFkZXJEYXRhUGFydF9EUVVBTlRfREModmlkZW8sICZRUCk7CisgICAgICAgICAgICB2aWRlby0+dXNlUHJldlFQID0gMTsgICAgICAgIC8qIHNldCBpdCBhZnRlciB0aGUgZmlyc3QgY29kZWQgTUIgICAgICAwNC8yNy8wMSAqLworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgLyogUmVwb3J0IHRoZSBlcnJvciB0byB0aGUgYXBwbGljYXRpb24uICAgMDYvMjAvMjAwMCAqLworICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7CisgICAgICAgICAgICB2aWRlby0+bWJudW0gPSBtYl9zdGFydDsKKyAgICAgICAgICAgIG1vdmVQb2ludGVyVG8oc3RyZWFtLCBzdGFydEZpcnN0UGFydCk7CisgICAgICAgICAgICByZXR1cm4gUFZfRkFJTDsKKyAgICAgICAgfQorCisgICAgICAgIHZpZGVvLT5zbGljZU5vW21ibnVtXSA9ICh1aW50OCkgc2xpY2VfY291bnRlcjsKKyAgICAgICAgUVBNQlttYm51bV0gPSBRUDsKKyAgICAgICAgdmlkZW8tPm1ibnVtID0gKyttYm51bTsKKworICAgICAgICBCaXRzdHJlYW1TaG93Qml0czE2KHN0cmVhbSwgOSwgJmNvZGUpOworICAgICAgICB3aGlsZSAoY29kZSA9PSAxKQorICAgICAgICB7CisgICAgICAgICAgICBQVl9CaXRzdHJlYW1GbHVzaEJpdHMoc3RyZWFtLCA5KTsKKyAgICAgICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMTYoc3RyZWFtLCA5LCAmY29kZSk7CisgICAgICAgIH0KKyAgICAgIC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9JTlRSQSB8fCBNT0RFX0lOVFJBX1EgKi8KKyAgICAgICAgaWYgKENCUFkgPCAwKQorICAgICAgICB7CisgICAgICAgICAgICAvKiBSZXBvcnQgdGhlIGVycm9yIHRvIHRoZSBhcHBsaWNhdGlvbi4gICAwNi8yMC8yMDAwICovCisgICAgICAgICAgICBWaWRlb0RlY29kZXJFcnJvckRldGVjdGVkKHZpZGVvKTsKKyAgICAgICAgICAgIG1vdmVQb2ludGVyVG8oc3RyZWFtLCBzdGFydFNlY29uZFBhcnQpOyAvKiAgKi8KKyAgICAgICAgICAgIC8qIENvbmNlYWwgcGFja2V0LCAgMDUvMTUvMjAwMCAqLworICAgICAgICAgICAgQ29uY2VhbFRleHR1cmVfSSh2aWRlbywgc3RhcnRGaXJzdFBhcnQsIG1iX3N0YXJ0LCBtYl9lbmQsIHNsaWNlX2NvdW50ZXIpOworICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgIH0KKworICAgICAgICB2aWRlby0+aGVhZGVySW5mby5DQlBbbWJudW1dIHw9ICh1aW50OCkoQ0JQWSA8PCAyKTsKKyAgICB9CisKKyAgICB2aWRlby0+dXNlUHJldlFQID0gMDsKKworICAgIGZvciAobWJudW0gPSBtYl9zdGFydDsgbWJudW0gPCBtYl9lbmQ7IG1ibnVtKyspCisgICAgeworICAgICAgICB2aWRlby0+bWJudW0gPSBtYm51bTsKKworICAgICAgICB2aWRlby0+bWJudW1fcm93ID0gUFZfR0VUX1JPVyhtYm51bSAsIG5NQlBlclJvdyk7ICAvKiAgVGhpcyBpcyBuZWVkZWQgaWYgbmJudW0gaXMgcmVhZCBmcm9tIHRoZSBwYWNrZXQgaGVhZGVyICovCisgICAgICAgIHZpZGVvLT5tYm51bV9jb2wgPSBtYm51bSAtIHZpZGVvLT5tYm51bV9yb3cgKiBuTUJQZXJSb3c7CisgICAgICAgIC8qIE5vIHNraXBwZWQgbW9kZSBpbiBJLXBhY2tldHMgIDMvMS8yMDAxICAgICovCisgIC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NvdW50ZXIpOworICAgICAgICByZXR1cm4gUFZfRkFJTDsKKyAgICB9CisgICAgcmV0dXJuIFBWX1NVQ0NFU1M7Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBEZWNvZGVEYXRhUGFydF9QX1ZpZGVvUGFja2V0KCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA0LzI1LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogRGVjb2RlIERhdGEgUGFydGl0aW9uZWQgTW9kZSBWaWRlbyBQYWNrZXQgaW4gUC1WT1AgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1NVQ0NFU1MgaWYgc3VjY2Vzc2VkLCBQVl9GQUlMIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAwOS8xOC8yMDAwLCAgZmFzdCBWbGNEZWNvZGUrRGVxdWFudCAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgMDQvMTMvMjAwMSwgIGZpeGVkIE1CX3N0dWZmaW5nLCBuZXcgQUNEQyBwcmVkIHN0cnVjdHVyZSwgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFudXAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAwOC8wNy8yMDAxLCAgcmVtb3ZlIE1CemVybyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT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ICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMTYoc3RyZWFtLCAxMCwgJmNvZGUpOworICAgIH0KKworICAgIGRvCisgICAgeworICAgICAgICAvKiBkZWNvZGUgQ09ELCBNQ0JQQywgQUNwcmVkX2ZsYWcsIENQQlkgYW5kIERRVUFOVCAqLworICAgICAgICAvKiBXZSBoYXZlIHRvIGRpc2NhcmQgc3R1ZmZlZCBNQiBoZWFkZXIgKi8KKworICAgICAgICBzdGF0dXMgPSBHZXRNQmhlYWRlckRhdGFQYXJ0X1AodmlkZW8pOworCisgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykKKyAgICAgICAgeworICAgICAgICAgICAgLyogUmVwb3J0IHRoZSBlcnJvciB0byB0aGUgYXBwbGljYXRpb24uICAgMDYvMjAvMjAwMCAqLworICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7CisgICAgICAgICAgICBtb3ZlUG9pbnRlclRvKHN0cmVhbSwgc3RhcnRGaXJzdFBhcnQpOworICAgICAgICAgICAgdmlkZW8tPm1ibnVtID0gbWJfc3RhcnQ7CisgICAgICAgICAgICByZXR1cm4gUFZfRkFJTDsKKyAgICAgICAgfQorCisgICAgICAgIC8qIHdlIG11c3QgdXBkYXRlIHNsaWNlX2NvdW50ZXIgYmVmb3JlIG1vdGlvbiB2ZWN0b3IgZGVjb2RpbmcuICAgKi8KKyAgICAgICAgdmlkZW8tPnNsaWNlTm9bdmlkZW8tPm1ibnVtXSA9ICh1aW50OCkgc2xpY2VfY291bnRlcjsKKworICAgICAgICBpZiAoTW9kZVt2aWRlby0+bWJudW1dICYgSU5URVJfTUFTSykgLyogSU5URVIgfHwgSU5URVJfUSB8fCBJTlRFUl80ViAqLworICAgICAgICB7CisgICAgICAgICAgICAvKiBkZWNvZGUgdGhlIG1vdGlvbiB2ZWN0b3IgKGlmIHRoZXJlIGFyZSBhbnkpICovCisgICAgICAgICAgICBzdGF0dXMgPSBQVl9HZXRNQnZlY3RvcnModmlkZW8sIE1vZGVbdmlkZW8tPm1ibnVtXSk7CisgICAgICAgICAgICBpZiAoc3RhdHVzICE9IFBWX1NVQ0NFU1MpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLyogUmVwb3J0IHRoZSBlcnJvciB0byB0aGUgYXBwbGljYXRpb24uICAgMDYvMjAvMjAwMCAqLworICAgICAgICAgICAgICAgIFZpZGVvRGVjb2RlckVycm9yRGV0ZWN0ZWQodmlkZW8pOworICAgICAgICAgICAgICAgIG1vdmVQb2ludGVyVG8oc3RyZWFtLCBzdGFydEZpcnN0UGFydCk7CisgICAgICAgICAgICAgICAgdmlkZW8tPm1ibnVtID0gbWJfc3RhcnQ7CisgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgdmlkZW8tPm1ibnVtKys7CisKKyAgICAgICAgdmlkZW8tPm1ibnVtX3JvdyA9IFBWX0dFVF9ST1codmlkZW8tPm1ibnVtLCBuTUJQZXJSb3cpOyAgIC8qICBUaGlzIGlzIG5lZWRlZCBpZiBtYm51bSBpcyByZWFkIGZyb20gdGhlIHBhY2tldCBoZWFkZXIgKi8KKyAgICAgICAgdmlkZW8tPm1ibnVtX2NvbCA9IHZpZGVvLT5tYm51bSAtIHZpZGVvLT5tYm51bV9yb3cgKiBuTUJQZXJSb3c7CisKKyAgICAgICAgQml0c3RyZWFtU2hvd0JpdHMxNihzdHJlYW0sIDEwLCAmY29kZSk7CisgICAgICAgIHdoaWxlIChjb2RlID09IDEpCisgICAgICAgIHsKKyAgICAgICAgICAgIFBWX0JpdHN0cmVhbUZsdXNoQml0cyhzdHJlYW0sIDEwKTsKKyAgICAgICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMTYoc3RyZWFtLCAxMCwgJmNvZGUpOworICAgICAgICB9CisgICAgICAgIC8qIGhhdmUgd2UgcmVhY2hlZCB0aGUgZW5kIG9mIHRoZ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GlzIHJlYWQgZnJvbSB0aGUgcGFja2V0IGhlYWRlciAqLworICAgICAgICB2aWRlby0+bWJudW1fY29sID0gbWJudW0gLSB2aWRlby0+bWJudW1fcm93ICogbk1CUGVyUm93OworCisgICAgICAgIC8qIHRoZXJlIGlzIGFsd2F5cyBhY2RjcHJlZGljdGlvbiBpbiBEYXRhUGFydCBtb2RlICAgIDA0LzEwLzAxICovCisgICAgICAgIGlmIChpbnRyYV9NQikKKyAgICAgICAgeworICAgICAgICAgICAgdmlkZW8tPmFjUHJlZEZsYWdbbWJudW1dID0gKHVpbnQ4KSBCaXRzdHJlYW1SZWFkMUJpdHNfSU5MSU5FKHN0cmVhbSk7CisgICAgICAgIH0KKworICAgICAgICBDQlBZID0gUFZfVmxjRGVjQ0JQWShzdHJlYW0sIGludHJhX01CKTsKKyAgICAgICAgaWYgKENCUFkgPCAwKQorICAgICAgICB7CisgICAgICAgICAgICAvKiBSZXBvcnQgdGhlIGVycm9yIHRvIHRoZSBhcHBsaWNhdGlvbi4gICAwNi8yMC8yMDAwICovCisgICAgICAgICAgICBWaWRlb0RlY29kZXJFcnJvckRldGVjdGVkKHZpZGVvKTsKKyAgICAgICAgICAgIC8qIENvbmNlYWwgc2Vjb25kIHBhcnRpdGlvbiwgIDUvMTUvMjAwMCAqLworICAgICAgICAgICAgbW92ZVBvaW50ZXJUbyhzdHJlYW0sIHN0YXJ0U2Vjb25kUGFydCk7CisgICAgICAgICAgICBDb25jZWFsVGV4dHVyZV9QKHZpZGVvLCBtYl9zdGFydCwgbWJfZW5kLCBzbGljZV9jb3VudGVyKTsKKyAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgICAgICB9CisKKyAgICAgICAgdmlkZW8tPmhlYWRlckluZm8uQ0JQW21ibnVtXSB8PSAodWludDgpKENCUFkgPDwgMik7CisgICAgICAgIGlmIChpbnRyYV9NQiB8fCBNQnR5cGUgPT0gTU9ERV9JTlRFUl9RKSAgICAgICAgICAgICAgICAgICAgIC8qICAwNC8yNi8wMSAqLworICAgICAgICB7CisgICAgICAgICAgICBzdGF0dXMgPSBHZXRNQmhlYWRlckRhdGFQYXJ0X0RRVUFOVF9EQyh2aWRlbywgJlFQKTsKKyAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIHN0YXR1czsKKyAgICAgICAgfQorICAgICAgICB2aWRlby0+dXNlUHJldlFQID0gMTsgICAgICAgIC8qICAwNC8yNy8wMSAqLworICAgICAgICBRUE1CW21ibnVtXSA9IFFQOworICAgIH0KKworICAgIHZpZGVvLT51c2VQcmV2UVAgPSAwOyAgLyogIDA0LzI3LzAxICovCisKKyAgICBmb3IgKG1ibnVtID0gbWJfc3RhcnQ7IG1ibnVtIDwgbWJfZW5kOyBtYm51bSsrKQorICAgIHsKKyAgICAgICAgdmlkZW8tPm1ibnVtID0gbWJudW07CisgICAgICAgIHZpZGVvLT5tYm51bV9yb3cgPSBQVl9HRVRfUk9XKG1ibnVtLCBuTUJQZXJSb3cpOyAgLyogIFRoaXMgaXMgbmVlZGVkIGlmIG5ibnVtIGlzIHJlYWQgZnJvbSB0aGUgcGFja2V0IGhlYWRlciAqLworICAgICAgICB2aWRlby0+bWJudW1fY29sID0gbWJudW0gLSB2aWRlby0+bWJudW1fcm93ICogbk1CUGVyUm93OworCisKKyAgICAgICAgaWYgKE1vZGVbbWJudW1dICE9IE1PREVfU0tJUFBFRCkKKyAgICAgICAgeworICAgICAgICAgICAgLyogZGVjb2RlIHRoZSBEQ1QgY29lZmljaWVudHMgZm9yIHRoZSBNQiAqLworICAgICAgICAgICAgc3RhdHVzID0gR2V0TUJEYXRhX0RhdGFQYXJ0KHZpZGVvKTsKKyAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvKiBSZXBvcnQgdGhlIGVycm9yIHRvIHRoZSBhcHBsaWNhdGlvbi4gICAwNi8yMC8yMDAwICovCisgICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7CisKKyAgICAgICAgICAgICAgICAvKiBDb25jZWFsIHNlY29uZCBwYXJ0aXRpb24sICA1LzE1LzIwMDAgKi8KKyAgICAgICAgICAgICAgICBtb3ZlUG9pbnRlclRvKHN0cmVhbSwgc3RhcnRTZWNvbmRQYXJ0KTsKKyAgICAgICAgICAgICAgICBDb25jZWFsVGV4dHVyZV9QKHZpZGVvLCBtYl9zdGFydCwgbWJfZW5kLCBzbGljZV9jb3VudGVyKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdmlkZW8tPnVzZVByZXZRUCA9IDE7ICAvKiAgMDQvMjcvMDEgKi8KKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsgICAvLyBTS0lQUEVECisKKyAgICAgICAgICAgIC8qIE1vdGlvbiBjb21wZW5zYXRpb24gYW5kIHB1dCBpdCB0byB2aWRlby0+bWJsb2NrLT5wcmVkX2Jsb2NrICovCisgICAgICAgICAgICBTa2lwcGVkTUJNb3Rpb25Db21wKHZpZGVvKTsKKworICAgICAgICAgICAgLy9vc2NsX21lbXNldCh2aWRlby0+cHJlZERDQUNfcm93ICsgdmlkZW8tPm1ibnVtX2NvbCwgMCwgc2l6ZW9mKHR5cGVEQ0FDU3RvcmUpKTsgLyogIFNLSVBQRURfQUNEQyAqLworICAgICAgICAgICAgLy9vc2NsX21lbXNldCh2aWRlby0+cHJlZERDQUNfY29sLCAwLCBzaXplb2YodHlwZURDQUNTdG9yZSkpOworICAgICAgICAgICAgLyogIDA4LzA4LzIwMDUgKi8KKyAgICAgICAgICAgIHBieXRlID0gKHVpbnQ4KikodmlkZW8tPnByZWREQ0FDX3JvdyArIHZpZGVvLT5tYm51bV9jb2wpOworICAgICAgICAgICAgWkVST19PVVRfNjRCWVRFUyhwYnl0ZSk7CisgICAgICAgICAgICBwYnl0ZSA9ICh1aW50OCopKHZpZGVvLT5wcmVkRENBQ19jb2wpOworICAgICAgICAgICAgWkVST19PVVRfNjRCWVRFUyhwYnl0ZSk7CisKKyAgICAgICAgfQorICAgIH0KKworICAgIHZhbGlkX3N0dWZmaW5nID0gdmFsaWRTdHVmZmluZyhzdHJlYW0pOyAgIC8qICAqLworICAgIGlmICghdmFsaWRfc3R1ZmZpbmcpCisgICAgeworICAgICAgICBWaWRlb0RlY29kZXJFcnJvckRldGVjdGVkKHZpZGVvKTsKKyAgICAgICAgbW92ZVBvaW50ZXJUbyhzdHJlYW0sIHN0YXJ0U2Vjb25kUGFydCk7IC8qICAqLworICAgICAgICBDb25jZWFsVGV4dHVyZV9QKHZpZGVvLCBtYl9zdGFydCwgbWJfZW5kLCBzbGljZV9jb3VudGVyKTsKKworICAgICAgICByZXR1cm4gUFZfRkFJTDsKKyAgICB9CisgICAgcmV0dXJuIFBWX1NVQ0NFU1M7Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBHZXRNQmhlYWRlckRhdGFQYXJ0X0RRVUFOVF9EQygpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA0LzI2LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogRGVjb2RlIERRVUFOVCBhbmQgREMgaW4gRGF0YSBQYXJ0aXRpb25lZCBNb2RlIGZvciBib3RoICAgICAgICovCisvKiAgICAgICAgICAgICBJLVZPUCBhbmQgUC1WT1AuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfU1VDQ0VTUyBpZiBzdWNjZXNzZWQsIFBWX0ZBSUwgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAwMi8xMy8yMDAxIG5ldyBBQ0RDIHByZWRpY3Rpb24gc3RydWN0dXJlLCAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYW51cCAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitQVl9TVEFUVVMgR2V0TUJoZWFkZXJEYXRhUGFydF9EUVVBTlRfREMoVmlkZW9EZWNEYXRhICp2aWRlbywgaW50MTYgKlFQKQoreworICAgIFBWX1NUQVRVUyBzdGF0dXMgPSBQVl9TVUNDRVNTOworICAgIEJpdHN0cmVhbURlY1ZpZGVvICpzdHJlYW0gPSB2aWRlby0+Yml0c3RyZWFtOworICAgIGludCBtYm51bSA9IHZpZGVvLT5tYm51bTsKKyAgICBpbnQgaW50cmFfZGNfdmxjX3RociA9IHZpZGVvLT5jdXJyVm9wLT5pbnRyYURDVmxjVGhyOworICAgIHVpbnQ4ICpNb2RlID0gdmlkZW8tPmhlYWRlckluZm8uTW9kZTsKKyAgICBpbnQgIE1CdHlwZSA9IE1vZGVbbWJudW1dOworICAgIHR5cGVEQ1N0b3JlICpEQyA9IHZpZGVvLT5wcmVkREMgKyBtYm51bTsKKyAgICBpbnQgIGNvbXA7CisgICAgQm9vbCBzd2l0Y2hlZDsKKyAgICB1aW50ICBEUVVBTlQ7CisgICAgaW50MTYgUVBfdG1wOworCisgICAgY29uc3Qgc3RhdGljIGludCAgRFFfdGFiWzRdID0geyAtMSwgLTIsIDEsIDJ9OworCisgICAgaWYgKE1CdHlwZSAmIFFfTUFTSykgICAgICAgICAgICAgLyogSU5UUkFfUSB8fCBJTlRFUl9RICovCisgICAgeworICAgICAgICBEUVVBTlQgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMik7CisgICAgICAgICpRUCArPSBEUV90YWJbRFFVQU5UXTsKKworICAgICAgICBpZiAoKlFQIDwgMSkgKlFQID0gMTsKKyAgICAgICAgZWxzZSBpZiAoKlFQID4gMzEpICpRUCA9IDMxOworICAgIH0KKyAgICBpZiAoTUJ0eXBlICYgSU5UUkFfTUFTSykgIC8qIElOVFJBIHx8IElOVFJBX1EgKi8gLyogbm8gc3dpdGNoLCBjb2RlIERDIHNlcGFyYXRlbHkgKi8KKyAgICB7CisgICAgICAgIFFQX3RtcCA9ICpRUDsgICAgICAgICAgICAgICAgICAgICAgLyogcnVubmluZyBRUCAgMDQvMjYvMDEqLworICAgICAgICBzd2l0Y2hlZCA9IDA7CisgICAgICAgIGlmIChpbnRyYV9kY192bGNfdGhyKSAgICAgICAgICAgICAgICAgLyogIDA0LzI3LzAxICovCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICh2aWRlby0+dXNlUHJldlFQKQorICAgICAgICAgICAgICAgIFFQX3RtcCA9IHZpZGVvLT5RUE1CW21ibnVtLTFdOworICAgICAgICAgICAgc3dpdGNoZWQgPSAoaW50cmFfZGNfdmxjX3RociA9PSA3IHx8IFFQX3RtcCA+PSBpbnRyYV9kY192bGNfdGhyICogMiArIDExKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoIXN3aXRjaGVkKQorICAgICAgICB7CisgICAgICAgICAgICBmb3IgKGNvbXAgPSAwOyBjb21wIDwgNjsgY29tcCsrKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0RlY29kZVByZWRpY3RlZEludHJhREMoY29tcCwgc3RyZWFtLCAoKkRDICsgY29tcCkpOyAgIC8qICAwMy8wMS8wMSAqLworICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBmb3IgKGNvbXAgPSAwOyBjb21wIDwgNjsgY29tcCsrKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICgqREMpW2NvbXBdID0gMDsgICAvKiAgMDQvMjYvMDEgbmVlZGVkIGZvciBzd2l0Y2hlZCBjYXNlKi8KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gc3RhdHVzOworfQorCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRCZWdpbioqKioqKgorKiAgICAgICAwNC8yNS8yMDAwIDogSW5pdGlhbCBtb2RpZmljYXRpb24gdG8gdGhlIG5ldyBQViBMaWIgZm9ybWF0LgorKiAgICAgICAwNC8xNy8yMDAxIDogbmV3IEFDREMgcHJlZCBzdHJ1Y3R1cmUKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEVuZCoqKioqKioqLworUFZfU1RBVFVTIEdldE1CaGVhZGVyRGF0YVBhcnRfUChWaWRlb0RlY0RhdGEgKnZpZGVvKQoreworICAgIEJpdHN0cmVhbURlY1ZpZGVvICpzdHJlYW0gPSB2aWRlby0+Yml0c3RyZWFtOworICAgIGludCBtYm51bSA9IHZpZGVvLT5tYm51bTsKKyAgICB1aW50OCAqTW9kZSA9IHZpZGVvLT5oZWFkZXJJbmZvLk1vZGU7CisgICAgdHlwZURDU3RvcmUgKkRDID0gdmlkZW8tPnByZWREQyArIG1ibnVtOworICAgIHVpbnQgbm9fZGN0X2ZsYWc7CisgICAgaW50IGNvbXA7CisgICAgaW50IE1DQlBDOworCisgICAgbm9fZGN0X2ZsYWcgPSBCaXRzdHJlYW1SZWFkMUJpdHNfSU5MSU5FKHN0cmVhbSk7CisKKyAgICBpZiAobm9fZGN0X2ZsYWcpCisgICAgeworICAgICAgICAvKiBza2lwcGVkIG1hY3JvYmxvY2sgKi8KKyAgICAgICAgTW9kZVttYm51bV0gPSBNT0RFX1NLSVBQRUQ7CisKKyAgICAgICAgZm9yIChjb21wID0gMDsgY29tcCA8IDY7IGNvbXArKykKKyAgICAgICAgeworICAgICAgICAgICAgKCpEQylbY29tcF0gPSBtaWRfZ3JheTsKKyAgICAgICAgICAgIC8qICBBQ0RDIFJFTU9WRSBBQyBjb2VmcyBhcmUgc2V0IGluIERlY29kZURhdGFQYXJ0X1AgKi8KKyAgICAgICAgfQorICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICAvKiBjb2RlZCBtYWNyb2Jsb2NrICovCisgICAgICAgIE1DQlBDID0gUFZfVmxjRGVjTUNCUENfY29tX2ludGVyKHN0cmVhbSk7CisKKyAgICAgICAgaWYgKFZMQ19FUlJPUl9ERVRFQ1RFRChNQ0JQQykpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgICAgICB9CisKKyAgICAgICAgTW9kZVttYm51bV0gPSAodWludDgpTUJ0eXBlX21vZGVbTUNCUEMgJiA3XTsKKyAgICAgICAgdmlkZW8tPmhlYWRlckluZm8uQ0JQW21ibnVtXSA9ICh1aW50OCkoKE1DQlBDID4+IDQpICYgMyk7CisgICAgfQorCisgICAgcmV0dXJuIFBWX1NVQ0NFU1M7Cit9CisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEJlZ2luKioqKioqCisqICAgICAgIDA0LzE3LzAxICBuZXcgQUNEQyBwcmVkIHN0cnVjdHVyZSwgcmVvcmdhbml6ZWQgY29kZSwgY2xlYW51cAorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipDb21tZW50RW5kKioqKioqKiovCitQVl9TVEFUVVMgR2V0TUJEYXRhX0RhdGFQYXJ0KFZpZGVvRGVjRGF0YSAqdmlkZW8pCit7CisgICAgaW50IG1ibnVtID0gdmlkZW8tPm1ibnVtOworICAgIGludDE2ICpkYXRhQmxvY2s7CisgICAgTWFjcm9CbG9jayAqbWJsb2NrID0gdmlkZW8tPm1ibG9jazsKKyAgICBpbnQgUVAgPSB2aWRlby0+UVBNQlttYm51bV07CisgICAgaW50MzIgb2Zmc2V0OworICAgIFBJWEVMICpjX2NvbXA7CisgICAgaW50IHdpZHRoID0gdmlkZW8tPndpZHRoOworICAgIGludCBpbnRyYV9kY192bGNfdGhyID0gdmlkZW8tPmN1cnJWb3AtPmludHJhRENWbGNUaHI7CisgICAgdWludCBDQlAgPSB2aWRlby0+aGVhZGVySW5mby5DQlBbbWJudW1dOworICAgIHVpbnQ4IG1vZGUgPSB2aWRlby0+aGVhZGVySW5mby5Nb2RlW21ibnVtXTsKKyAgICBpbnQgeF9wb3MgPSB2aWRlby0+bWJudW1fY29sOworICAgIHR5cGVEQ1N0b3JlICpEQyA9IHZpZGVvLT5wcmVkREMgKyBtYm51bTsKKyAgICBpbnQgIG5jb2VmZnNbNl0sICpub19jb2VmZiA9IG1ibG9jay0+bm9fY29lZmY7CisgICAgaW50ICBjb21wOworICAgIEJvb2wgIHN3aXRjaGVkOworICAgIGludCBRUF90bXAgPSBRUDsKKworICAgIGludCB5X3BvcyA9IHZpZGVvLT5tYm51bV9yb3c7CisKKworCisKKyAgICAvKiAgb3NjbF9tZW1zZXQobWJsb2NrLT5ibG9jaywgMCwgc2l6ZW9mKHR5cGVNQlN0b3JlKSk7ICAgIEF1ZyA5LDIwMDUgKi8KKworICAgIGlmIChtb2RlICYgSU5UUkFfTUFTSykgLyogTU9ERV9JTlRSQSB8fCBtb2RlID09IE1PREVfSU5UUkFfUSAqLworICAgIHsKKyAgICAgICAgc3dpdGNoZWQgPSAwOworICAgICAgICBpZiAoaW50cmFfZGNfdmxjX3RocikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKHZpZGVvLT51c2VQcmV2UVApCisgICAgICAgICAgICAgICAgUVBfdG1wID0gdmlkZW8tPlFQTUJbbWJudW0tMV07ICAgLyogcnVubmluZyBRUCAgMDQvMjYvMDEgKi8KKworICAgICAgICAgICAgc3dpdGNoZWQgPSAoaW50cmFfZGNfdmxjX3RociA9PSA3IHx8IFFQX3RtcCA+PSBpbnRyYV9kY192bGNfdGhyICogMiArIDExKTsKKyAgICAgICAgfQorCisgICAgICAgIG1ibG9jay0+RENTY2FsYXJMdW0gPSBjYWxfZGNfc2NhbGVyKFFQLCBMVU1JTkFOQ0VfRENfVFlQRSk7ICAgICAvKiAgIEFDREMgMDMvMDEvMDEgKi8KKyAgICAgICAgbWJsb2NrLT5EQ1NjYWxhckNociA9IGNhbF9kY19zY2FsZXIoUVAsIENIUk9NSU5BTkNFX0RDX1RZUEUpOworCisgICAgICAgIGZvciAoY29tcCA9IDA7IGNvbXAgPCA2OyBjb21wKyspCisgICAgICAgIHsKKyAgICAgICAgICAgIGRhdGFCbG9jayA9IG1ibG9jay0+YmxvY2tbY29tcF07ICAgIC8qLCAxMC8yMC8yMDAwICovCisKKyAgICAgICAgICAgIGRhdGFCbG9ja1swXSA9ICgqREMpW2NvbXBdOworCisgICAgICAgICAgICBuY29lZmZzW2NvbXBdID0gVmxjRGVxdWFudEgyNjNJbnRyYUJsb2NrKHZpZGVvLCBjb21wLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaGVkLCBtYmxvY2stPmJpdG1hcGNvbFtjb21wXSwgJm1ibG9jay0+Yml0bWFwcm93W2NvbXBdKTsKKworICAgICAgICAgICAgaWYgKFZMQ19FUlJPUl9ERVRFQ1RFRChuY29lZmZzW2NvbXBdKSkgICAgICAgICAvKiAgKi8KKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoc3dpdGNoZWQpCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIG5jb2VmZnNbY29tcF0gPSAxOworICAgICAgICAgICAgICAgICAgICBvc2NsX21lbXNldCgoZGF0YUJsb2NrICsgMSksIDAsIHNpemVvZihpbnQxNikqNjMpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG5vX2NvZWZmW2NvbXBdID0gbmNvZWZmc1tjb21wXTsKKyAgICAgICAgICAgIC8qICBtb2RpZmllZCB0byBuZXcgc2VtYXBob3JlIGZvciBwb3N0LXByb2MgKi8KKyAgICAgICAgICAgIC8vIEZ1dHVyZSB3b3JrOjogY2FuIGJlIGNvbWJpbmVkIGluIHRoZSBkZXF1YW50IGZ1bmN0aW9uCisgICAgICAgICAgICAvLyBAdG9kbyBEZWJsb2NraW5nIFNlbWFwaG9yZSBmb3IgSU5UUkEgYmxvY2sKKyAgICAgICAgfQorICAgICAgICBNQmxvY2tJRENUKHZpZGVvKTsKKyAgICB9CisgICAgZWxzZSAvKiBNT0RFIElOVEVSKi8KKyAgICB7CisKKworCisKKyAgICAgICAgTUJNb3Rpb25Db21wKHZpZGVvLCBDQlApOworICAgICAgICBvZmZzZXQgPSAoaW50MzIpKHlfcG9zIDw8IDQpICogd2lkdGggKyAoeF9wb3MgPDwgNCk7CisgICAgICAgIGNfY29tcCAgPSB2aWRlby0+Y3VyclZvcC0+eUNoYW4gKyBvZmZzZXQ7CisKKworICAgICAgICBmb3IgKGNvbXAgPSAwOyBjb21wIDwgNDsgY29tcCsrKQorICAgICAgICB7CisgICAgICAgICAgICAoKkRDKVtjb21wXSA9IG1pZF9ncmF5OworCisgICAgICAgICAgICBpZiAoQ0JQICYgKDEgPDwgKDUgLSBjb21wKSkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbmNvZWZmc1tjb21wXSA9IFZsY0RlcXVhbnRIMjYzSW50ZXJCbG9jayh2aWRlbywgY29tcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWJsb2NrLT5iaXRtYXBjb2xbY29tcF0sICZtYmxvY2stPmJpdG1hcHJvd1tjb21wXSk7CisgICAgICAgICAgICAgICAgaWYgKFZMQ19FUlJPUl9ERVRFQ1RFRChuY29lZmZzW2NvbXBdKSkKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisKKworICAgICAgICAgICAgICAgIEJsb2NrSURDVChjX2NvbXAgKyAoY29tcCYyKSood2lkdGggPDwgMikgKyA4Kihjb21wJjEpLCBtYmxvY2stPnByZWRfYmxvY2sgKyAoY29tcCYyKSo2NCArIDgqKGNvbXAmMSksIG1ibG9jay0+YmxvY2tbY29tcF0sIHdpZHRoLCBuY29lZmZzW2NvbXBdLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYmxvY2stPmJpdG1hcGNvbFtjb21wXSwgbWJsb2NrLT5iaXRtYXByb3dbY29tcF0pOworCisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbmNvZWZmc1tjb21wXSA9IDA7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8qICBAdG9kbyBEZWJsb2NraW5nIFNlbWFwaG9yZSBmb3IgSU5UUkEgYmxvY2ssIGZvciBpbnRlciBqdXN0IHRlc3QgZm9yIHJpbmdpbmcgICovCisgICAgICAgIH0KKworICAgICAgICAoKkRDKVs0XSA9IG1pZF9ncmF5OworICAgICAgICBpZiAoQ0JQICYgMikKKyAgICAgICAgeworICAgICAgICAgICAgbmNvZWZmc1s0XSA9IFZsY0RlcXVhbnRIMjYzSW50ZXJCbG9jayh2aWRlbywgNCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWJsb2NrLT5iaXRtYXBjb2xbNF0sICZtYmxvY2stPmJpdG1hcHJvd1s0XSk7CisgICAgICAgICAgICBpZiAoVkxDX0VSUk9SX0RFVEVDVEVEKG5jb2VmZnNbNF0pKQorICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworCisgICAgICAgICAgICBCbG9ja0lEQ1QodmlkZW8tPmN1cnJWb3AtPnVDaGFuICsgKG9mZnNldCA+PiAyKSArICh4X3BvcyA8PCAyKSwgbWJsb2NrLT5wcmVkX2Jsb2NrICsgMjU2LCBtYmxvY2stPmJsb2NrWzRdLCB3aWR0aCA+PiAxLCBuY29lZmZzWzRdLAorICAgICAgICAgICAgICAgICAgICAgIG1ibG9jay0+Yml0bWFwY29sWzRdLCBtYmxvY2stPmJpdG1hcHJvd1s0XSk7CisKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIG5jb2VmZnNbNF0gPSAwOworICAgICAgICB9CisgICAgICAgICgqREMpWzVdID0gbWlkX2dyYXk7CisgICAgICAgIGlmIChDQlAgJiAxKQorICAgICAgICB7CisgICAgICAgICAgICBuY29lZmZzWzVdID0gVmxjRGVxdWFudEgyNjNJbnRlckJsb2NrKHZpZGVvLCA1LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYmxvY2stPmJpdG1hcGNvbFs1XSwgJm1ibG9jay0+Yml0bWFwcm93WzVdKTsKKyAgICAgICAgICAgIGlmIChWTENfRVJST1JfREVURUNURUQobmNvZWZmc1s1XSkpCisgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisKKyAgICAgICAgICAgIEJsb2NrSURDVCh2aWRlby0+Y3VyclZvcC0+dkNoYW4gKyAob2Zmc2V0ID4+IDIpICsgKHhfcG9zIDw8IDIpLCBtYmxvY2stPnByZWRfYmxvY2sgKyAyNjQsIG1ibG9jay0+YmxvY2tbNV0sIHdpZHRoID4+IDEsIG5jb2VmZnNbNV0sCisgICAgICAgICAgICAgICAgICAgICAgbWJsb2NrLT5iaXRtYXBjb2xbNV0sIG1ibG9jay0+Yml0bWFwcm93WzVdKTsKKworICAgICAgICB9CisgICAgICAgIGVs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y9MSUNFTlNFLTIuMAorICoKKyAqIFVubGVzcyByZXF1aXJlZCBieSBhcHBsaWNhYmxlIGxhdyBvciBhZ3JlZWQgdG8gaW4gd3JpdGluZywgc29mdHdhcmUKKyAqIGRpc3RyaWJ1dGVkIHVuZGVyIHRoZSBMaWNlbnNlIGlzIGRpc3RyaWJ1dGVkIG9uIGFuICJBUyBJUyIgQkFTSVMsCisgKiBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyCisgKiBleHByZXNzIG9yIGltcGxpZWQuCisgKiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMKKyAqIGFuZCBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KKyAqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKyAqLworI2luY2x1ZGUgIm1wNGRlZi5oIgorI2luY2x1ZGUgImlkY3QuaCIKKyNpbmNsdWRlICJtb3Rpb25fY29tcC5oIgorCisjaWZkZWYgRkFTVF9JRENUCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqICAgICAgIHZjYV9pZGN0LmMgOiBjcmVhdGVkIDYvMS85OSBmb3Igc2V2ZXJhbCBvcHRpb25zCisqICAgICAgICAgICAgICAgICAgICAgb2YgaGFyZC1jb2RlZCByZWR1Y2VkIGlkY3QgZnVuY3Rpb24gKHVzaW5nIG56X2NvZWZzKQorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvL3ByZXRlc3RlZCB2ZXJzaW9uCit2b2lkIGlkY3Ryb3cwKGludDE2ICosIHVpbnQ4ICosIHVpbnQ4ICosIGludCkKK3sKKyAgICByZXR1cm4gOworfQordm9pZCBpZGN0Y29sMChpbnQxNiAqKQoreworICAgIHJldHVybiA7Cit9CisKK19fYXR0cmlidXRlX18oKG5vX3Nhbml0aXplKCJzaWduZWQtaW50ZWdlci1vdmVyZmxvdyIpKSkKK3ZvaWQgaWRjdHJvdzEoaW50MTYgKmJsaywgdWludDggKnByZWQsIHVpbnQ4ICpkc3QsIGludCB3aWR0aCkKK3sKKyAgICAvKiBzaG9ydGN1dCAqLworICAgIGludCB0bXA7CisgICAgaW50IGkgPSA4OworICAgIHVpbnQzMiBwcmVkX3dvcmQsIGRzdF93b3JkOworICAgIGludCByZXMsIHJlczI7CisKKyAgICAvKiBwcmVzZXQgdGhlIG9mZnNldCwgc3VjaCB0aGF0IHdlIGNhbiB0YWtlIGFkdmFudGFnZSBwcmUtb2Zmc2V0IGFkZHJlc3NpbmcgbW9kZSAgICovCisgICAgd2lkdGggLT0gNDsKKyAgICBkc3QgLT0gd2lkdGg7CisgICAgcHJlZCAtPSAxMjsKKyAgICBibGsgLT0gODsKKworICAgIHdoaWxlIChpLS0pCisgICAgeworICAgICAgICB0bXAgPSAoKihibGsgKz0gOCkgKyAzMikgPj4gNjsKKyAgICAgICAgKmJsayA9IDA7CisKKyAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocHJlZCArPSAxMikpOyAvKiByZWFkIDQgYnl0ZXMgZnJvbSBwcmVkICovCisgICAgICAgIHJlcyA9IHRtcCArIChwcmVkX3dvcmQgJiAweEZGKTsKKyAgICAgICAgQ0xJUF9SRVNVTFQocmVzKTsKKyAgICAgICAgcmVzMiA9IHRtcCArICgocHJlZF93b3JkID4+IDgpICYgMHhGRik7CisgICAgICAgIENMSVBfUkVTVUxUKHJlczIpOworICAgICAgICBkc3Rfd29yZCA9IChyZXMyIDw8IDgpIHwgcmVzOworICAgICAgICByZXMgPSB0bXAgKyAoKHByZWRfd29yZCA+PiAxNikgJiAweEZGKTsKKyAgICAgICAgQ0xJUF9SRVNVTFQocmVzKTsKKyAgICAgICAgZHN0X3dvcmQgfD0gKHJlcyA8PCAxNik7CisgICAgICAgIHJlcyA9IHRtcCArICgocHJlZF93b3JkID4+IDI0KSAmIDB4RkYpOworICAgICAgICBDTElQX1JFU1VMVChyZXMpOworICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDI0KTsKKyAgICAgICAgKigodWludDMyKikoZHN0ICs9IHdpZHRoKSkgPSBkc3Rfd29yZDsgLyogc2F2ZSA0IGJ5dGVzIHRvIGRzdCAqLworCisgICAgICAgIHByZWRfd29yZCA9ICooKHVpbnQzMiopKHByZWQgKz0gNCkpOyAvKiByZWFkIDQgYnl0ZXMgZnJvbSBwcmVkICovCisgICAgICAgIHJlcyA9IHRtcCArIChwcmVkX3dvcmQgJiAweEZGKTsKKyAgICAgICAgQ0xJUF9SRVNVTFQocmVzKTsKKyAgICAgICAgcmVzMiA9IHRtcCArICgocHJlZF93b3JkID4+IDgpICYgMHhGRik7CisgICAgICAgIENMSVBfUkVTVUxUKHJlczIpOworICAgICAgICBkc3Rfd29yZCA9IChyZXMyIDw8IDgpIHwgcmVzOworICAgICAgICByZXMgPSB0bXAgKyAoKHByZWRfd29yZCA+PiAxNikgJiAweEZGKTsKKyAgICAgICAgQ0xJUF9SRVNVTFQocmVzKTsKKyAgICAgICAgZHN0X3dvcmQgfD0gKHJlcyA8PCAxNik7CisgICAgICAgIHJlcyA9IHRtcCArICgocHJlZF93b3JkID4+IDI0KSAmIDB4RkYpOworICAgICAgICBDTElQX1JFU1VMVChyZXMpOworICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDI0KTsKKyAgICAgICAgKigodWludDMyKikoZHN0ICs9IDQpKSA9IGRzdF93b3JkOyAvKiBzYXZlIDQgYnl0ZXMgdG8gZHN0ICovCisgICAgfQorICAgIHJldHVybjsKK30KKwordm9pZCBpZGN0Y29sMShpbnQxNiAqYmxrKQoreyAvKiBzaG9ydGN1dCAqLworICAgIGJsa1swXSA9IGJsa1s4XSA9IGJsa1sxNl0gPSBibGtbMjRdID0gYmxrWzMyXSA9IGJsa1s0MF0gPSBibGtbNDhdID0gYmxrWzU2XSA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxrWzBdIDw8IDM7CisgICAgcmV0dXJuOworfQorCitfX2F0dHJpYnV0ZV9fKChub19zYW5pdGl6ZSgic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciKSkpCit2b2lkIGlkY3Ryb3cyKGludDE2ICpibGssIHVpbnQ4ICpwcmVkLCB1aW50OCAqZHN0LCBpbnQgd2lkdGgpCit7CisgICAgaW50MzIgeDAsIHgxLCB4MiwgeDQsIHg1OworICAgIGludCBpID0gODsKKyAgICB1aW50MzIgcHJlZF93b3JkLCBkc3Rfd29yZDsKKyAgICBpbnQgcmVzLCByZXMyOworCisgICAgLyogcHJlc2V0IHRoZSBvZmZzZXQsIHN1Y2ggdGhhdCB3ZSBjYW4gdGFrZSBhZHZhbnRhZ2UgcHJlLW9mZnNldCBhZGRyZXNzaW5nIG1vZGUgICAqLworICAgIHdpZHRoIC09IDQ7CisgICAgZHN0IC09IHdpZHRoOworICAgIHByZWQgLT0gMTI7CisgICAgYmxrIC09IDg7CisKKyAgICB3aGlsZSAoaS0tKQorICAgIHsKKyAgICAgICAgLyogc2hvcnRjdXQgKi8KKyAgICAgICAgeDQgPSBibGtbOV07CisgICAgICAgIGJsa1s5XSA9IDA7CisgICAgICAgIHgwID0gKCgqKGJsayArPSA4KSkgPDwgOCkgKyA4MTkyOworICAgICAgICAqYmxrID0gMDsgIC8qIGZvciBwcm9wZXIgcm91bmRpbmcgaW4gdGhlIGZvdXJ0aCBzdGFnZSAqLworCisgICAgICAgIC8qIGZpcnN0IHN0YWdlICovCisgICAgICAgIHg1ID0gKFc3ICogeDQgKyA0KSA+PiAzOworICAgICAgICB4NCA9IChXMSAqIHg0ICsgNCkgPj4gMzsKKworICAgICAgICAvKiB0aGlyZCBzdGFnZSAqLworICAgICAgICB4MiA9ICgxODEgKiAoeDQgKyB4NSkgKyAxMjgpID4+IDg7CisgICAgICAgIHgxID0gKDE4MSAqICh4NCAtIHg1KSArIDEyOCkgPj4gODsKKworICAgICAgICAvKiBmb3VydGggc3RhZ2UgKi8KKyAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocHJlZCArPSAxMikpOyAvKiByZWFkIDQgYnl0ZXMgZnJvbSBwcmVkICovCisgICAgICAgIHJlcyA9ICh4MCArIHg0KSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQMShyZXMpOworICAgICAgICByZXMyID0gKHgwICsgeDIpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVAyKHJlczIpOworICAgICAgICBkc3Rfd29yZCA9IChyZXMyIDw8IDgpIHwgcmVzOworICAgICAgICByZXMgPSAoeDAgKyB4MSkgPj4gMTQ7CisgICAgICAgIEFERF9BTkRfQ0xJUDMocmVzKTsKKyAgICAgICAgZHN0X3dvcmQgfD0gKHJlcyA8PCAxNik7CisgICAgICAgIHJlcyA9ICh4MCArIHg1KSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQNChyZXMpOworICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDI0KTsKKyAgICAgICAgKigodWludDMyKikoZHN0ICs9IHdpZHRoKSkgPSBkc3Rfd29yZDsgLyogc2F2ZSA0IGJ5dGVzIHRvIGRzdCAqLworCisgICAgICAgIHByZWRfd29yZCA9ICooKHVpbnQzMiopKHByZWQgKz0gNCkpOyAvKiByZWFkIDQgYnl0ZXMgZnJvbSBwcmVkICovCisgICAgICAgIHJlcyA9ICh4MCAtIHg1KSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQMShyZXMpOworICAgICAgICByZXMyID0gKHgwIC0geDEpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVAyKHJlczIpOworICAgICAgICBkc3Rfd29yZCA9IChyZXMyIDw8IDgpIHwgcmVzOworICAgICAgICByZXMgPSAoeDAgLSB4MikgPj4gMTQ7CisgICAgICAgIEFERF9BTkRfQ0xJUDMocmVzKTsKKyAgICAgICAgZHN0X3dvcmQgfD0gKHJlcyA8PCAxNik7CisgICAgICAgIHJlcyA9ICh4MCAtIHg0KSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQNChyZXMpOworICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDI0KTsKKyAgICAgICAgKigodWludDMyKikoZHN0ICs9IDQpKSA9IGRzdF93b3JkOyAvKiBzYXZlIDQgYnl0ZXMgdG8gZHN0ICovCisgICAgfQorICAgIHJldHVybiA7Cit9CisKK19fYXR0cmlidXRlX18oKG5vX3Nhbml0aXplKCJzaWduZWQtaW50ZWdlci1vdmVyZmxvdyIpKSkKK3ZvaWQgaWRjdGNvbDIoaW50MTYgKmJsaykKK3sKKyAgICBpbnQzMiB4MCwgeDEsIHgzLCB4NSwgeDc7Ly8sIHg4OworCisgICAgeDEgPSBibGtbOF07CisgICAgeDAgPSAoKGludDMyKWJsa1swXSA8PCAxMSkgKyAxMjg7CisgICAgLyogYm90aCB1cHBlciBhbmQgbG93ZXIqLworCisgICAgeDcgPSBXNyAqIHgxOworICAgIHgxID0gVzEgKiB4MTsKKworICAgIHgzID0geDc7CisgICAgeDUgPSAoMTgxICogKHgxIC0geDcpICsgMTI4KSA+PiA4OworICAgIHg3ID0gKDE4MSAqICh4MSArIHg3KSArIDEyOCkgPj4gODsKKworICAgIGJsa1swXSA9ICh4MCArIHgxKSA+PiA4OworICAgIGJsa1s4XSA9ICh4MCArIHg3KSA+PiA4OworICAgIGJsa1sxNl0gPSAoeDAgKyB4NSkgPj4gODsKKyAgICBibGtbMjRdID0gKHgwICsgeDMpID4+IDg7CisgICAgYmxrWzU2XSA9ICh4MCAtIHgxKSA+PiA4OworICAgIGJsa1s0OF0gPSAoeDAgLSB4NykgPj4gODsKKyAgICBibGtbNDBdID0gKHgwIC0geDUpID4+IDg7CisgICAgYmxrWzMyXSA9ICh4MCAtIHgzKSA+PiA4OworCisgICAgcmV0dXJuIDsKK30KKworX19hdHRyaWJ1dGVfXygobm9fc2FuaXRpemUoInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IikpKQordm9pZCBpZGN0cm93MyhpbnQxNiAqYmxrLCB1aW50OCAqcHJlZCwgdWludDggKmRzdCwgaW50IHdpZHRoKQoreworICAgIGludDMyIHgwLCB4MSwgeDIsIHgzLCB4NCwgeDUsIHg2LCB4NywgeDg7CisgICAgaW50IGkgPSA4OworICAgIHVpbnQzMiBwcmVkX3dvcmQsIGRzdF93b3JkOworICAgIGludCByZXMsIHJlczI7CisKKyAgICAvKiBwcmVzZXQgdGhlIG9mZnNldCwgc3VjaCB0aGF0IHdlIGNhbiB0YWtlIGFkdmFudGFnZSBwcmUtb2Zmc2V0IGFkZHJlc3NpbmcgbW9kZSAgICovCisgICAgd2lkdGggLT0gNDsKKyAgICBkc3QgLT0gd2lkdGg7CisgICAgcHJlZCAtPSAxMjsKKyAgICBibGsgLT0gODsKKworICAgIHdoaWxlIChpLS0pCisgICAgeworICAgICAgICB4MiA9IGJsa1sxMF07CisgICAgICAgIGJsa1sxMF0gPSAwOworICAgICAgICB4MSA9IGJsa1s5XTsKKyAgICAgICAgYmxrWzldID0gMDsKKyAgICAgICAgeDAgPSAoKCooYmxrICs9IDgpKSA8PCA4KSArIDgxOTI7CisgICAgICAgICpibGsgPSAwOyAgIC8qIGZvciBwcm9wZXIgcm91bmRpbmcgaW4gdGhlIGZvdXJ0aCBzdGFnZSAqLworICAgICAgICAvKiBib3RoIHVwcGVyIGFuZCBsb3dlciovCisgICAgICAgIC8qIGJvdGggeDJvcng2IGFuZCB4MG9yeDQgKi8KKworICAgICAgICB4NCA9IHgwOworICAgICAgICB4NiA9IChXNiAqIHgyICsgNCkgPj4gMzsKKyAgICAgICAgeDIgPSAoVzIgKiB4MiArIDQpID4+IDM7CisgICAgICAgIHg4ID0geDAgLSB4MjsKKyAgICAgICAgeDAgKz0geDI7CisgICAgICAgIHgyID0geDg7CisgICAgICAgIHg4ID0geDQgLSB4NjsKKyAgICAgICAgeDQgKz0geDY7CisgICAgICAgIHg2ID0geDg7CisKKyAgICAgICAgeDcgPSAoVzcgKiB4MSArIDQpID4+IDM7CisgICAgICAgIHgxID0gKFcxICogeDEgKyA0KSA+PiAzOworICAgICAgICB4MyA9IHg3OworICAgICAgICB4NSA9ICgxODEgKiAoeDEgLSB4NykgKyAxMjgpID4+IDg7CisgICAgICAgIHg3ID0gKDE4MSAqICh4MSArIHg3KSArIDEyOCkgPj4gODsKKworICAgICAgICBwcmVkX3dvcmQgPSAqKCh1aW50MzIqKShwcmVkICs9IDEyKSk7IC8qIHJlYWQgNCBieXRlcyBmcm9tIHByZWQgKi8KKyAgICAgICAgcmVzID0gKHgwICsgeDEpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVAxKHJlcyk7CisgICAgICAgIHJlczIgPSAoeDQgKyB4NykgPj4gMTQ7CisgICAgICAgIEFERF9BTkRfQ0xJUDIocmVzMik7CisgICAgICAgIGRzdF93b3JkID0gKHJlczIgPDwgOCkgfCByZXM7CisgICAgICAgIHJlcyA9ICh4NiArIHg1KSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQMyhyZXMpOworICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDE2KTsKKyAgICAgICAgcmVzID0gKHgyICsgeDMpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVA0KHJlcyk7CisgICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMjQpOworICAgICAgICAqKCh1aW50MzIqKShkc3QgKz0gd2lkdGgpKSA9IGRzdF93b3JkOyAvKiBzYXZlIDQgYnl0ZXMgdG8gZHN0ICovCisKKyAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocHJlZCArPSA0KSk7IC8qIHJlYWQgNCBieXRlcyBmcm9tIHByZWQgKi8KKyAgICAgICAgcmVzID0gKHgyIC0geDMpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVAxKHJlcyk7CisgICAgICAgIHJlczIgPSAoeDYgLSB4NSkgPj4gMTQ7CisgICAgICAgIEFERF9BTkRfQ0xJUDIocmVzMik7CisgICAgICAgIGRzdF93b3JkID0gKHJlczIgPDwgOCkgfCByZXM7CisgICAgICAgIHJlcyA9ICh4NCAtIHg3KSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQMyhyZXMpOworICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDE2KTsKKyAgICAgICAgcmVzID0gKHgwIC0geDEpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVA0KHJlcyk7CisgICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMjQpOworICAgICAgICAqKCh1aW50MzIqKShkc3QgKz0gNCkpID0gZHN0X3dvcmQ7IC8qIHNhdmUgNCBieXRlcyB0byBkc3QgKi8KKyAgICB9CisKKyAgICByZXR1cm4gOworfQorCitfX2F0dHJpYnV0ZV9fKChub19zYW5pdGl6ZSgic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciKSkpCit2b2lkIGlkY3Rjb2wzKGludDE2ICpibGspCit7CisgICAgaW50MzIgeDAsIHgxLCB4MiwgeDMsIHg0LCB4NSwgeDYsIHg3LCB4ODsKKworICAgIHgyID0gYmxrWzE2XTsKKyAgICB4MSA9IGJsa1s4XTsKKyAgICB4MCA9ICgoaW50MzIpYmxrWzBdIDw8IDExKSArIDEyODsKKworICAgIHg0ID0geDA7CisgICAgeDYgPSBXNiAqIHgyOworICAgIHgyID0gVzIgKiB4MjsKKyAgICB4OCA9IHgwIC0geDI7CisgICAgeDAgKz0geDI7CisgICAgeDIgPSB4ODsKKyAgICB4OCA9IHg0IC0geDY7CisgICAgeDQgKz0geDY7CisgICAgeDYgPSB4ODsKKworICAgIHg3ID0gVzcgKiB4MTsKKyAgICB4MSA9IFcxICogeDE7CisgICAgeDMgPSB4NzsKKyAgICB4NSA9ICgxODEgKiAoeDEgLSB4NykgKyAxMjgpID4+IDg7CisgICAgeDcgPSAoMTgxICogKHgxICsgeDcpICsgMTI4KSA+PiA4OworCisgICAgYmxrWzBdID0gKHgwICsgeDEpID4+IDg7CisgICAgYmxrWzhdID0gKHg0ICsgeDcpID4+IDg7CisgICAgYmxrWzE2XSA9ICh4NiArIHg1KSA+PiA4OworICAgIGJsa1syNF0gPSAoeDIgKyB4MykgPj4gODsKKyAgICBibGtbNTZdID0gKHgwIC0geDEpID4+IDg7CisgICAgYmxrWzQ4XSA9ICh4NCAtIHg3KSA+PiA4OworICAgIGJsa1s0MF0gPSAoeDYgLSB4NSkgPj4gODsKKyAgICBibGtbMzJdID0gKHgyIC0geDMpID4+IDg7CisKKyAgICByZXR1cm47Cit9CisKKworX19hdHRyaWJ1dGVfXygobm9fc2FuaXRpemUoInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IikpKQordm9pZCBpZGN0cm93NChpbnQxNiAqYmxrLCB1aW50OCAqcHJlZCwgdWludDggKmRzdCwgaW50IHdpZHRoKQoreworICAgIGludDMyIHgwLCB4MSwgeDIsIHgzLCB4NCwgeDUsIHg2LCB4NywgeDg7CisgICAgaW50IGkgPSA4OworICAgIHVpbnQzMiBwcmVkX3dvcmQsIGRzdF93b3JkOworICAgIGludCByZXMsIHJlczI7CisKKyAgICAvKiBwcmVzZXQgdGhlIG9mZnNldCwgc3VjaCB0aGF0IHdlIGNhbiB0YWtlIGFkdmFudGFnZSBwcmUtb2Zmc2V0IGFkZHJlc3NpbmcgbW9kZSAgICovCisgICAgd2lkdGggLT0gNDsKKyAgICBkc3QgLT0gd2lkdGg7CisgICAgcHJlZCAtPSAxMjsKKyAgICBibGsgLT0gODsKKworICAgIHdoaWxlIChpLS0pCisgICAgeworICAgICAgICB4MiA9IGJsa1sxMF07CisgICAgICAgIGJsa1sxMF0gPSAwOworICAgICAgICB4MSA9IGJsa1s5XTsKKyAgICAgICAgYmxrWzldID0gMDsKKyAgICAgICAgeDMgPSBibGtbMTFdOworICAgICAgICBibGtbMTFdID0gMDsKKyAgICAgICAgeDAgPSAoKCooYmxrICs9IDgpKSA8PCA4KSArIDgxOTI7CisgICAgICAgICpibGsgPSAwOyAgICAvKiBmb3IgcHJvcGVyIHJvdW5kaW5nIGluIHRoZSBmb3VydGggc3RhZ2UgKi8KKworICAgICAgICB4NCA9IHgwOworICAgICAgICB4NiA9IChXNiAqIHgyICsgNCkgPj4gMzsKKyAgICAgICAgeDIgPSAoVzIgKiB4MiArIDQpID4+IDM7CisgICAgICAgIHg4ID0geDAgLSB4MjsKKyAgICAgICAgeDAgKz0geDI7CisgICAgICAgIHgyID0geDg7CisgICAgICAgIHg4ID0geDQgLSB4NjsKKyAgICAgICAgeDQgKz0geDY7CisgICAgICAgIHg2ID0geDg7CisKKyAgICAgICAgeDcgPSAoVzcgKiB4MSArIDQpID4+IDM7CisgICAgICAgIHgxID0gKFcxICogeDEgKyA0KSA+PiAzOworICAgICAgICB4NSA9IChXMyAqIHgzICsgNCkgPj4gMzsKKyAgICAgICAgeDMgPSAoLSBXNSAqIHgzICsgNCkgPj4gMzsKKyAgICAgICAgeDggPSB4MSAtIHg1OworICAgICAgICB4MSArPSB4NTsKKyAgICAgICAgeDUgPSB4ODsKKyAgICAgICAgeDggPSB4NyAtIHgzOworICAgICAgICB4MyArPSB4NzsKKyAgICAgICAgeDcgPSAoMTgxICogKHg1ICsgeDgpICsgMTI4KSA+PiA4OworICAgICAgICB4NSA9ICgxODEgKiAoeDUgLSB4OCkgKyAxMjgpID4+IDg7CisKKyAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocHJlZCArPSAxMikpOyAvKiByZWFkIDQgYnl0ZXMgZnJvbSBwcmVkICovCisgICAgICAgIHJlcyA9ICh4MCArIHgxKSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQMShyZXMpOworICAgICAgICByZXMyID0gKHg0ICsgeDcpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVAyKHJlczIpOworICAgICAgICBkc3Rfd29yZCA9IChyZXMyIDw8IDgpIHwgcmVzOworICAgICAgICByZXMgPSAoeDYgKyB4NSkgPj4gMTQ7CisgICAgICAgIEFERF9BTkRfQ0xJUDMocmVzKTsKKyAgICAgICAgZHN0X3dvcmQgfD0gKHJlcyA8PCAxNik7CisgICAgICAgIHJlcyA9ICh4MiArIHgzKSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQNChyZXMpOworICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDI0KTsKKyAgICAgICAgKigodWludDMyKikoZHN0ICs9IHdpZHRoKSkgPSBkc3Rfd29yZDsgLyogc2F2ZSA0IGJ5dGVzIHRvIGRzdCAqLworCisgICAgICAgIHByZWRfd29yZCA9ICooKHVpbnQzMiopKHByZWQgKz0gNCkpOyAvKiByZWFkIDQgYnl0ZXMgZnJvbSBwcmVkICovCisgICAgICAgIHJlcyA9ICh4MiAtIHgzKSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQMShyZXMpOworICAgICAgICByZXMyID0gKHg2IC0geDUpID4+IDE0OworICAgICAgICBBRERfQU5EX0NMSVAyKHJlczIpOworICAgICAgICBkc3Rfd29yZCA9IChyZXMyIDw8IDgpIHwgcmVzOworICAgICAgICByZXMgPSAoeDQgLSB4NykgPj4gMTQ7CisgICAgICAgIEFERF9BTkRfQ0xJUDMocmVzKTsKKyAgICAgICAgZHN0X3dvcmQgfD0gKHJlcyA8PCAxNik7CisgICAgICAgIHJlcyA9ICh4MCAtIHgxKSA+PiAxNDsKKyAgICAgICAgQUREX0FORF9DTElQNChyZXMpOworICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDI0KTsKKyAgICAgICAgKigodWludDMyKikoZHN0ICs9IDQpKSA9IGRzdF93b3JkOyAvKiBzYXZlIDQgYnl0ZXMgdG8gZHN0ICovCisgICAgfQorICAgIHJldHVybiA7Cit9CisKK19fYXR0cmlidXRlX18oKG5vX3Nhbml0aXplKCJzaWduZWQtaW50ZWdlci1vdmVyZmxvdyIpKSkKK3ZvaWQgaWRjdGNvbDQoaW50MTYgKmJsaykKK3sKKyAgICBpbnQzMiB4MCwgeDEsIHgyLCB4MywgeDQsIHg1LCB4NiwgeDcsIHg4OworICAgIHgyID0gYmxrWzE2XTsKKyAgICB4MSA9IGJsa1s4XTsKKyAgICB4MyA9IGJsa1syNF07CisgICAgeDAgPSAoKGludDMyKWJsa1swXSA8PCAxMSkgKyAxMjg7CisKKyAgICB4NCA9IHgwOworICAgIHg2ID0gVzYgKiB4MjsKKyAgICB4MiA9IFcyICogeDI7CisgICAgeDggPSB4MCAtIHgyOworICAgIHgwICs9IHgyOworICAgIHgyID0geDg7CisgICAgeDggPSB4NCAtIHg2OworICAgIHg0ICs9IHg2OworICAgIHg2ID0geDg7CisKKyAgICB4NyA9IFc3ICogeDE7CisgICAgeDEgPSBXMSAqIHgxOworICAgIHg1ID0gVzMgKiB4MzsKKyAgICB4MyA9IC1XNSAqIHgzOworICAgIHg4ID0geDEgLSB4NTsKKyAgICB4MSArPSB4NTsKKyAgICB4NSA9IHg4OworICAgIHg4ID0geDcgLSB4MzsKKyAgICB4MyArPSB4NzsKKyAgICB4NyA9ICgxODEgKiAoeDUgKyB4OCkgKyAxMjgpID4+IDg7CisgICAgeDUgPSAoMTgxICogKHg1IC0geDgpICsgMTI4KSA+PiA4OworCisKKyAgICBibGtbMF0gPSAoeDAgKyB4MSkgPj4gODsKKyAgICBibGtbOF0gPSAoeDQgKyB4NykgPj4gODsKKyAgICBibGtbMTZdID0gKHg2ICsgeDUpID4+IDg7CisgICAgYmxrWzI0XSA9ICh4MiArIHgzKSA+PiA4OworICAgIGJsa1s1Nl0gPSAoeDAgLSB4MSkgPj4gODsKKyAgICBibGtbNDhdID0gKHg0IC0geDcpID4+IDg7CisgICAgYmxrWzQwXSA9ICh4NiAtIHg1KSA+PiA4OworICAgIGJsa1szMl0gPSAoeDIgLSB4MykgPj4gODsKKworICAgIHJldHVybiA7Cit9CisKK3ZvaWQgaWRjdHJvdzBfaW50cmEoaW50MTYgKiwgUElYRUwgKiwgaW50KQoreworICAgIHJldHVybiA7Cit9CisKK3ZvaWQgaWRjdHJvdzFfaW50cmEoaW50MTYgKmJsaywgUElYRUwgKmNvbXAsIGludCB3aWR0aCkKK3sKKyAgICAvKiBzaG9ydGN1dCAqLworICAgIGludDMyIHRtcDsKKyAgICBpbnQgaSA9IDg7CisgICAgaW50IG9mZnNldCA9IHdpZHRoOworICAgIHVpbnQzMiB3b3JkOworCisgICAgY29tcCAtPSBvZmZzZXQ7CisgICAgd2hpbGUgKGktLSkKKyAgICB7CisgICAgICAgIHRtcCA9ICgoYmxrWzBdICsgMzIpID4+IDYpOworICAgICAgICBibGtbMF0gPSAwOworICAgICAgICBDTElQX1JFU1VMVCh0bXApCisKKyAgICAgICAgd29yZCA9ICh0bXAgPDwgOCkgfCB0bXA7CisgICAgICAgIHdvcmQgPSAod29yZCA8PCAxNikgfCB3b3JkOworCisgICAgICAgICooKHVpbnQzMiopKGNvbXAgKz0gb2Zmc2V0KSkgPSB3b3JkOworICAgICAgICAqKCh1aW50MzIqKShjb21wICsgNCkpID0gd29yZDsKKworCisKKworICAgICAgICBibGsgKz0gQl9TSVpFOworICAgIH0KKyAgICByZXR1cm47Cit9CisKK19fYXR0cmlidXRlX18oKG5vX3Nhbml0aXplKCJzaWduZWQtaW50ZWdlci1vdmVyZmxvdyIpKSkKK3ZvaWQgaWRjdHJvdzJfaW50cmEoaW50MTYgKmJsaywgUElYRUwgKmNvbXAsIGludCB3aWR0aCkKK3sKKyAgICBpbnQzMiB4MCwgeDEsIHgyLCB4NCwgeDUsIHRlbXA7CisgICAgaW50IGkgPSA4OworICAgIGludCBvZmZzZXQgPSB3aWR0aDsKKyAgICBpbnQzMiB3b3JkOworCisgICAgY29tcCAtPSBvZmZzZXQ7CisgICAgd2hpbGUgKGktLSkKKyAgICB7CisgICAgICAgIC8qIHNob3J0Y3V0ICovCisgICAgICAgIHg0ID0gYmxrWzFdOworICAgICAgICBibGtbMV0gPSAwOworICAgICAgICB4MCA9ICgoaW50MzIpYmxrWzBdIDw8IDgpICsgODE5MjsKKyAgICAgICAgYmxrWzBdID0gMDsgICAvKiBmb3IgcHJvcGVyIHJvdW5kaW5nIGluIHRoZSBmb3VydGggc3RhZ2UgKi8KKworICAgICAgICAvKiBmaXJzdCBzdGFnZSAqLworICAgICAgICB4NSA9IChXNyAqIHg0ICsgNCkgPj4gMzsKKyAgICAgICAgeDQgPSAoVzEgKiB4NCArIDQpID4+IDM7CisKKyAgICAgICAgLyogdGhpcmQgc3RhZ2UgKi8KKyAgICAgICAgeDIgPSAoMTgxICogKHg0ICsgeDUpICsgMTI4KSA+PiA4OworICAgICAgICB4MSA9ICgxODEgKiAoeDQgLSB4NSkgKyAxMjgpID4+IDg7CisKKyAgICAgICAgLyogZm91cnRoIHN0YWdlICovCisgICAgICAgIHdvcmQgPSAoKHgwICsgeDQpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQod29yZCkKKworICAgICAgICB0ZW1wID0gKCh4MCArIHgyKSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgOCk7CisgICAgICAgIHRlbXAgPSAoKHgwICsgeDEpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAxNik7CisgICAgICAgIHRlbXAgPSAoKHgwICsgeDUpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAyNCk7CisgICAgICAgICooKGludDMyKikoY29tcCArPSBvZmZzZXQpKSA9IHdvcmQ7CisKKyAgICAgICAgd29yZCA9ICgoeDAgLSB4NSkgPj4gMTQpOworICAgICAgICBDTElQX1JFU1VMVCh3b3JkKQorICAgICAgICB0ZW1wID0gKCh4MCAtIHgxKSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgOCk7CisgICAgICAgIHRlbXAgPSAoKHgwIC0geDIpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAxNik7CisgICAgICAgIHRlbXAgPSAoKHgwIC0geDQpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAyNCk7CisgICAgICAgICooKGludDMyKikoY29tcCArIDQpKSA9IHdvcmQ7CisKKyAgICAgICAgYmxrICs9IEJfU0laRTsKKyAgICB9CisgICAgcmV0dXJuIDsKK30KKworX19hdHRyaWJ1dGVfXygobm9fc2FuaXRpemUoInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IikpKQordm9pZCBpZGN0cm93M19pbnRyYShpbnQxNiAqYmxrLCBQSVhFTCAqY29tcCwgaW50IHdpZHRoKQoreworICAgIGludDMyIHgwLCB4MSwgeDIsIHgzLCB4NCwgeDUsIHg2LCB4NywgeDgsIHRlbXA7CisgICAgaW50IGkgPSA4OworICAgIGludCBvZmZzZXQgPSB3aWR0aDsKKyAgICBpbnQzMiB3b3JkOworCisgICAgY29tcCAtPSBvZmZzZXQ7CisKKyAgICB3aGlsZSAoaS0tKQorICAgIHsKKyAgICAgICAgeDIgPSBibGtbMl07CisgICAgICAgIGJsa1syXSA9IDA7CisgICAgICAgIHgxID0gYmxrWzFdOworICAgICAgICBibGtbMV0gPSAwOworICAgICAgICB4MCA9ICgoaW50MzIpYmxrWzBdIDw8IDgpICsgODE5MjsKKyAgICAgICAgYmxrWzBdID0gMDsvKiBmb3IgcHJvcGVyIHJvdW5kaW5nIGluIHRoZSBmb3VydGggc3RhZ2UgKi8KKyAgICAgICAgLyogYm90aCB1cHBlciBhbmQgbG93ZXIqLworICAgICAgICAvKiBib3RoIHgyb3J4NiBhbmQgeDBvcng0ICovCisKKyAgICAgICAgeDQgPSB4MDsKKyAgICAgICAgeDYgPSAoVzYgKiB4MiArIDQpID4+IDM7CisgICAgICAgIHgyID0gKFcyICogeDIgKyA0KSA+PiAzOworICAgICAgICB4OCA9IHgwIC0geDI7CisgICAgICAgIHgwICs9IHgyOworICAgICAgICB4MiA9IHg4OworICAgICAgICB4OCA9IHg0IC0geDY7CisgICAgICAgIHg0ICs9IHg2OworICAgICAgICB4NiA9IHg4OworCisgICAgICAgIHg3ID0gKFc3ICogeDEgKyA0KSA+PiAzOworICAgICAgICB4MSA9IChXMSAqIHgxICsgNCkgPj4gMzsKKyAgICAgICAgeDMgPSB4NzsKKyAgICAgICAgeDUgPSAoMTgxICogKHgxIC0geDcpICsgMTI4KSA+PiA4OworICAgICAgICB4NyA9ICgxODEgKiAoeDEgKyB4NykgKyAxMjgpID4+IDg7CisKKyAgICAgICAgd29yZCA9ICgoeDAgKyB4MSkgPj4gMTQpOworICAgICAgICBDTElQX1JFU1VMVCh3b3JkKQorICAgICAgICB0ZW1wID0gKCh4NCArIHg3KSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgOCk7CisKKworICAgICAgICB0ZW1wID0gKCh4NiArIHg1KSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgMTYpOworCisgICAgICAgIHRlbXAgPSAoKHgyICsgeDMpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAyNCk7CisgICAgICAgICooKGludDMyKikoY29tcCArPSBvZmZzZXQpKSA9IHdvcmQ7CisKKyAgICAgICAgd29yZCA9ICgoeDIgLSB4MykgPj4gMTQpOworICAgICAgICBDTElQX1JFU1VMVCh3b3JkKQorCisgICAgICAgIHRlbXAgPSAoKHg2IC0geDUpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCA4KTsKKworICAgICAgICB0ZW1wID0gKCh4NCAtIHg3KSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgMTYpOworCisgICAgICAgIHRlbXAgPSAoKHgwIC0geDEpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAyNCk7CisgICAgICAgICooKGludDMyKikoY29tcCArIDQpKSA9IHdvcmQ7CisKKyAgICAgICAgYmxrICs9IEJfU0laRTsKKyAgICB9CisgICAgcmV0dXJuIDsKK30KKworX19hdHRyaWJ1dGVfXygobm9fc2FuaXRpemUoInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IikpKQordm9pZCBpZGN0cm93NF9pbnRyYShpbnQxNiAqYmxrLCBQSVhFTCAqY29tcCwgaW50IHdpZHRoKQoreworICAgIGludDMyIHgwLCB4MSwgeDIsIHgzLCB4NCwgeDUsIHg2LCB4NywgeDgsIHRlbXA7CisgICAgaW50IGkgPSA4OworICAgIGludCBvZmZzZXQgPSB3aWR0aDsKKyAgICBpbnQzMiB3b3JkOworCisgICAgY29tcCAtPSBvZmZzZXQ7CisKKyAgICB3aGlsZSAoaS0tKQorICAgIHsKKyAgICAgICAgeDIgPSBibGtbMl07CisgICAgICAgIGJsa1syXSA9IDA7CisgICAgICAgIHgxID0gYmxrWzFdOworICAgICAgICBibGtbMV0gPSAwOworICAgICAgICB4MyA9IGJsa1szXTsKKyAgICAgICAgYmxrWzNdID0gMDsKKyAgICAgICAgeDAgPSAoKGludDMyKWJsa1swXSA8PCA4KSArIDgxOTI7CisgICAgICAgIGJsa1swXSA9IDA7LyogZm9yIHByb3BlciByb3VuZGluZyBpbiB0aGUgZm91cnRoIHN0YWdlICovCisKKyAgICAgICAgeDQgPSB4MDsKKyAgICAgICAgeDYgPSAoVzYgKiB4MiArIDQpID4+IDM7CisgICAgICAgIHgyID0gKFcyICogeDIgKyA0KSA+PiAzOworICAgICAgICB4OCA9IHgwIC0geDI7CisgICAgICAgIHgwICs9IHgyOworICAgICAgICB4MiA9IHg4OworICAgICAgICB4OCA9IHg0IC0geDY7CisgICAgICAgIHg0ICs9IHg2OworICAgICAgICB4NiA9IHg4OworCisgICAgICAgIHg3ID0gKFc3ICogeDEgKyA0KSA+PiAzOworICAgICAgICB4MSA9IChXMSAqIHgxICsgNCkgPj4gMzsKKyAgICAgICAgeDUgPSAoVzMgKiB4MyArIDQpID4+IDM7CisgICAgICAgIHgzID0gKC0gVzUgKiB4MyArIDQpID4+IDM7CisgICAgICAgIHg4ID0geDEgLSB4NTsKKyAgICAgICAgeDEgKz0geDU7CisgICAgICAgIHg1ID0geDg7CisgICAgICAgIHg4ID0geDcgLSB4MzsKKyAgICAgICAgeDMgKz0geDc7CisgICAgICAgIHg3ID0gKDE4MSAqICh4NSArIHg4KSArIDEyOCkgPj4gODsKKyAgICAgICAgeDUgPSAoMTgxICogKHg1IC0geDgpICsgMTI4KSA+PiA4OworCisgICAgICAgIHdvcmQgPSAoKHgwICsgeDEpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQod29yZCkKKworICAgICAgICB0ZW1wID0gKCh4NCArIHg3KSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgOCk7CisKKworICAgICAgICB0ZW1wID0gKCh4NiArIHg1KSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgMTYpOworCisgICAgICAgIHRlbXAgPSAoKHgyICsgeDMpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAyNCk7CisgICAgICAgICooKGludDMyKikoY29tcCArPSBvZmZzZXQpKSA9IHdvcmQ7CisKKyAgICAgICAgd29yZCA9ICgoeDIgLSB4MykgPj4gMTQpOworICAgICAgICBDTElQX1JFU1VMVCh3b3JkKQorCisgICAgICAgIHRlbXAgPSAoKHg2IC0geDUpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCA4KTsKKworICAgICAgICB0ZW1wID0gKCh4NCAtIHg3KSA+PiAxNCk7CisgICAgICAgIENMSVBfUkVTVUxUKHRlbXApCisgICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgMTYpOworCisgICAgICAgIHRlbXAgPSAoKHgwIC0geDEpID4+IDE0KTsKKyAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKKyAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAyNCk7CisgICAgICAgICooKGludDMyKikoY29tcCArIDQpKSA9IHdvcmQ7CisKKyAgICAgICAgYmxrICs9IEJfU0laRTsKKyAgICB9CisKKyAgICByZXR1cm4gOworfQorCisjZW5kaWYKKwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGlic3RhZ2VmcmlnaHQvY29kZWNzL200dl9oMjYzL2RlYy9zcmMvbWF4X2xldmVsLmggYi9tZWRpYS9jb2RlY3MvbTR2X2gyNjMvZGVjL3NyYy9tYXhfbGV2ZWwuaApzaW1pbGFyaXR5IGluZGV4IDEwMCUKcmVuYW1lIGZyb20gbWVkaWEvbGlic3RhZ2VmcmlnaHQvY29kZWNzL200dl9oM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GluZyB4IHBvc2l0aW9uIGluIGN1cnJlbnQgTUI7IG9yaWdpbiBvZiBNQiAqLworICAgIHhwb3MgPSB2aWRlby0+bWJudW1fY29sIDw8IDQgOworCisgICAgLyogb2Zmc2V0IHRvICh4LHkpIHBvc2l0aW9uIGluIGN1cnJlbnQgbHVtaW5hbmNlIE1CICovCisgICAgLyogaW4gcGl4ZWwgcmVzb2x1dGlvbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgLyogeXBvcyp3aWR0aCAtPiByb3csICt4IC0+IGNvbHVtbiAqLworICAgIG9mZnNldCA9IChpbnQzMil5cG9zICogd2lkdGggKyB4cG9zOworCisgICAgLyogZ2V0IG1vZGUgZm9yIGN1cnJlbnQgTUIgKi8KKyAgICBtb2RlID0gdmlkZW8tPmhlYWRlckluZm8uTW9kZVttYm51bV07CisKKyAgICAvKiBibG9jayBpbmRleCAqLworICAgIC8qIGltdiA9ICh4cG9zLzgpICsgKCh5cG9zLzgpICogbXZ3aWR0aCkgKi8KKyAgICBpbXYgPSAob2Zmc2V0ID4+IDYpIC0gKHhwb3MgPj4gNikgKyAoeHBvcyA+PiAzKTsKKyAgICBpZiAobW9kZSAmIElOVEVSXzFWTUFTSykKKyAgICB7CisgICAgICAgIGR4ID0gcHhbMF0gPSBweFsxXSA9IHB4WzJdID0gcHhbM10gPSB2aWRlby0+bW90WFtpbXZdOworICAgICAgICBkeSA9IHB5WzBdID0gcHlbMV0gPSBweVsyXSA9IHB5WzNdID0gdmlkZW8tPm1vdFlbaW12XTsKKyAgICAgICAgaWYgKChkeCAmIDMpID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIGR4ID0gZHggPj4gMTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIHggY29tcG9uZW50IG9mIE1WIGlzIG9yJ2VkIGZvciByb3VuZGluZyAoPykgKi8KKyAgICAgICAgICAgIGR4ID0gKGR4ID4+IDEpIHwgMTsKKyAgICAgICAgfQorCisgICAgICAgIC8qIHkgY29tcG9uZW50IG9mIG1vdGlvbiB2ZWN0b3I7IGRpdmlkZSBieSAyIGZvciB0byAqLworICAgICAgICAvKiBjb252ZXJ0IHRvIGZ1bGwtcGVsIHJlc29sdXRpb24uICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgaWYgKChkeSAmIDMpID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIGR5ID0gZHkgPj4gMTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIHkgY29tcG9uZW50IG9mIE1WIGlzIG9yJ2VkIGZvciByb3VuZGluZyAoPykgKi8KKyAgICAgICAgICAgIGR5ID0gKGR5ID4+IDEpIHwgMTsKKyAgICAgICAgfQorICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICBweFswXSA9IHZpZGVvLT5tb3RYW2ltdl07CisgICAgICAgIHB4WzFdID0gdmlkZW8tPm1vdFhbaW12KzFdOworICAgICAgICBweFsyXSA9IHZpZGVvLT5tb3RYW2ltdittdndpZHRoXTsKKyAgICAgICAgcHhbM10gPSB2aWRlby0+bW90WFtpbXYrbXZ3aWR0aCsxXTsKKyAgICAgICAgeHN1bSA9IHB4WzBdICsgcHhbMV0gKyBweFsyXSArIHB4WzNdOworICAgICAgICBkeCA9IFBWX1NJR04oeHN1bSkgKiAocm91bmR0YWIxNlsoUFZfQUJTKHhzdW0pKSAmIDB4Rl0gKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCgoUFZfQUJTKHhzdW0pKSA+PiA0KSA8PCAxKSk7CisgICAgICAgIHB5WzBdID0gdmlkZW8tPm1vdFlbaW12XTsKKyAgICAgICAgcHlbMV0gPSB2aWRlby0+bW90WVtpbXYrMV07CisgICAgICAgIHB5WzJdID0gdmlkZW8tPm1vdFlbaW12K212d2lkdGhdOworICAgICAgICBweVszXSA9IHZpZGVvLT5tb3RZW2ltdittdndpZHRoKzFdOworICAgICAgICB4c3VtID0gcHlbMF0gKyBweVsxXSArIHB5WzJdICsgcHlbM107CisgICAgICAgIGR5ID0gUFZfU0lHTih4c3VtKSAqIChyb3VuZHRhYjE2WyhQVl9BQlMoeHN1bSkpICYgMHhGXSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKChQVl9BQlMoeHN1bSkpID4+IDQpIDw8IDEpKTsKKyAgICB9CisKKyAgICAvKiBQb2ludGVyIHRvIHByZXZpb3VzIGx1bWluYW5jZSBmcmFtZSAqLworICAgIGNfcHJldiAgPSBwcmV2LT55Q2hhbjsKKyAgICBpZiAoIWNfcHJldikgeworICAgICAgICBBTE9HRSgiYi8zNTI2OTYzNSIpOworICAgICAgICBhbmRyb2lkX2Vycm9yV3JpdGVMb2coMHg1MzRlNDU1NCwgIjM1MjY5NjM1Iik7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICBwcmVkX2Jsb2NrID0gdmlkZW8tPm1ibG9jay0+cHJlZF9ibG9jazsKKworICAgIC8qIHNvbWUgYmxvY2tzIGhhdmUgbm8gcmVzaWR1ZSBvciBJTlRFUjRWICovCisgICAgLyppZiAobW9kZSA9PSBNT0RFX0lOVEVSNFYpICAgMDUvMDgvMTUgKi8KKyAgICAvKiBNb3Rpb24gQ29tcGVuc2F0aW9uIGZvciBhbiA4eDggYmxvY2sgd2l0aGluIGEgTUIgKi8KKyAgICAvKiAoNCBNViBwZXIgTUIpICovCisKKworCisgICAgLyogQ2FsbCBmdW5jdGlvbiB0aGF0IHBlcmZvcm1zIGx1bWluYW5jZSBwcmVkaWN0aW9uICovCisgICAgLyogICAgICBsdW1pbmFuY2VfcHJlZF9tb2RlX2ludGVyNHYoeHBvcywgeXBvcywgcHgsIHB5LCBjX3ByZXYsCisgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5tYmxvY2stPnByZWRfYmxvY2ssIHdpZHRoLCBoZWlnaHQsCisgICAgICAgICAgICAgICAgICAgIHJvdW5kMSwgbXZ3aWR0aCwgJnhzdW0sICZ5c3VtKTsqLworICAgIGNfY29tcCA9IHZpZGVvLT5jdXJyVm9wLT55Q2hhbiArIG9mZnNldDsKKworCisgICAgeHByZWQgPSAoaW50KSgoeHBvcyA8PCAxKSArIHB4WzBdKTsKKyAgICB5cHJlZCA9IChpbnQpKCh5cG9zIDw8IDEpICsgcHlbMF0pOworCisgICAgaWYgKChDQlAgPj4gNSkmMSkKKyAgICB7CisgICAgICAgIHByZWQgPSBwcmVkX2Jsb2NrOworICAgICAgICBwcmVkX3dpZHRoID0gMTY7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIHByZWQgPSBjX2NvbXA7CisgICAgICAgIHByZWRfd2lkdGggPSB3aWR0aDsKKyAgICB9CisKKyAgICAvKiBjaGVjayB3aGV0aGVyIHRoZSBNViBwb2ludHMgb3V0c2lkZSB0aGUgZnJhbWUgKi8KKyAgICBpZiAoeHByZWQgPj0gMCAmJiB4cHJlZCA8PSAoKHdpZHRoIDw8IDEpIC0gKDIqQl9TSVpFKSkgJiYKKyAgICAgICAgICAgIHlwcmVkID49IDAgJiYgeXByZWQgPD0gKChoZWlnaHQgPDwgMSkgLSAoMipCX1NJWkUpKSkKKyAgICB7ICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgICAgICAvKiAoeCx5KSBpcyBpbnNpZGUgdGhlIGZyYW1lICovCisgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgOworICAgICAgICBHZXRQcmVkQWR2QlRhYmxlW3lwcmVkJjFdW3hwcmVkJjFdKGNfcHJldiArICh4cHJlZCA+PiAxKSArICgoeXByZWQgPj4gMSkqd2lkdGgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCAocHJlZF93aWR0aCA8PCAxKSB8IHJvdW5kMSk7CisgICAgfQorICAgIGVsc2UKKyAgICB7ICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgLyogKHgseSkgaXMgb3V0c2lkZSB0aGUgZnJhbWUgKi8KKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgR2V0UHJlZE91dHNpZGUoeHByZWQsIHlwcmVkLCBjX3ByZXYsCisgICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCBoZWlnaHQsIHJvdW5kMSwgcHJlZF93aWR0aCk7CisgICAgfQorCisKKyAgICAvKiBDb21wdXRlIHByZWRpY3Rpb24gdmFsdWVzIG92ZXIgY3VycmVudCBsdW1pbmFuY2UgTUIgKi8KKyAgICAvKiAoYmxvY2tzIDEpOyBhZGQgbW90aW9uIHZlY3RvciBwcmlvciB0byBpbnB1dDsgICAgICAgKi8KKyAgICAvKiBhZGQgOCB0byB4X3BvcyB0byBhZHZhbmNlIHRvIG5leHQgYmxvY2sgICAgICAgICAqLworICAgIHhwcmVkID0gKGludCkoKCh4cG9zICsgQl9TSVpFKSA8PCAxKSArIHB4WzFdKTsKKyAgICB5cHJlZCA9IChpbnQpKCh5cG9zIDw8IDEpICsgcHlbMV0pOworCisgICAgaWYgKChDQlAgPj4gNCkmMSkKKyAgICB7CisgICAgICAgIHByZWQgPSBwcmVkX2Jsb2NrICsgODsKKyAgICAgICAgcHJlZF93aWR0aCA9IDE2OworICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICBwcmVkID0gY19jb21wICsgODsKKyAgICAgICAgcHJlZF93aWR0aCA9IHdpZHRoOworICAgIH0KKworICAgIC8qIGNoZWNrIHdoZXRoZXIgdGhlIE1WIHBvaW50cyBvdXRzaWRlIHRoZSBmcmFtZSAqLworICAgIGlmICh4cHJlZCA+PSAwICYmIHhwcmVkIDw9ICgod2lkdGggPDwgMSkgLSAoMipCX1NJWkUpKSAmJgorICAgICAgICAgICAgeXByZWQgPj0gMCAmJiB5cHJlZCA8PSAoKGhlaWdodCA8PCAxKSAtICgyKkJfU0laRSkpKQorICAgIHsgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgICAgIC8qICh4LHkpIGlzIGluc2lkZSB0aGUgZnJhbWUgKi8KKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgICAgICBHZXRQcmVkQWR2QlRhYmxlW3lwcmVkJjFdW3hwcmVkJjFdKGNfcHJldiArICh4cHJlZCA+PiAxKSArICgoeXByZWQgPj4gMSkqd2lkdGgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCAocHJlZF93aWR0aCA8PCAxKSB8IHJvdW5kMSk7CisgICAgfQorICAgIGVsc2UKKyAgICB7ICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgLyogKHgseSkgaXMgb3V0c2lkZSB0aGUgZnJhbWUgKi8KKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgR2V0UHJlZE91dHNpZGUoeHByZWQsIHlwcmVkLCBjX3ByZXYsCisgICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCBoZWlnaHQsIHJvdW5kMSwgcHJlZF93aWR0aCk7CisgICAgfQorCisKKworICAgIC8qIENvbXB1dGUgcHJlZGljdGlvbiB2YWx1ZXMgb3ZlciBjdXJyZW50IGx1bWluYW5jZSBNQiAqLworICAgIC8qIChibG9ja3MgMik7IGFkZCBtb3Rpb24gdmVjdG9yIHByaW9yIHRvIGlucHV0ICAgICAgICAqLworICAgIC8qIGFkZCA4IHRvIHlfcG9zIHRvIGFkdmFuY2UgdG8gYmxvY2sgb24gbmV4dCByb3cgICAgICAqLworICAgIHhwcmVkID0gKGludCkoKHhwb3MgPDwgMSkgKyBweFsyXSk7CisgICAgeXByZWQgPSAoaW50KSgoKHlwb3MgKyBCX1NJWkUpIDw8IDEpICsgcHlbMl0pOworCisgICAgaWYgKChDQlAgPj4gMykmMSkKKyAgICB7CisgICAgICAgIHByZWQgPSBwcmVkX2Jsb2NrICsgMTI4OworICAgICAgICBwcmVkX3dpZHRoID0gMTY7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIHByZWQgPSBjX2NvbXAgKyAod2lkdGggPDwgMyk7CisgICAgICAgIHByZWRfd2lkdGggPSB3aWR0aDsKKyAgICB9CisKKyAgICAvKiBjaGVjayB3aGV0aGVyIHRoZSBNViBwb2ludHMgb3V0c2lkZSB0aGUgZnJhbWUgKi8KKyAgICBpZiAoeHByZWQgPj0gMCAmJiB4cHJlZCA8PSAoKHdpZHRoIDw8IDEpIC0gKDIqQl9TSVpFKSkgJiYKKyAgICAgICAgICAgIHlwcmVkID49IDAgJiYgeXByZWQgPD0gKChoZWlnaHQgPDwgMSkgLSAoMipCX1NJWkUpKSkKKyAgICB7ICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgICAgICAvKiAoeCx5KSBpcyBpbnNpZGUgdGhlIGZyYW1lICovCisgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgR2V0UHJlZEFkdkJUYWJsZVt5cHJlZCYxXVt4cHJlZCYxXShjX3ByZXYgKyAoeHByZWQgPj4gMSkgKyAoKHlwcmVkID4+IDEpKndpZHRoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVkLCB3aWR0aCwgKHByZWRfd2lkdGggPDwgMSkgfCByb3VuZDEpOworICAgIH0KKyAgICBlbHNlCisgICAgeyAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgICAgIC8qICh4LHkpIGlzIG91dHNpZGUgdGhlIGZyYW1lICovCisgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgICAgIEdldFByZWRPdXRzaWRlKHhwcmVkLCB5cHJlZCwgY19wcmV2LAorICAgICAgICAgICAgICAgICAgICAgICBwcmVkLCB3aWR0aCwgaGVpZ2h0LCByb3VuZDEsIHByZWRfd2lkdGgpOworICAgIH0KKworCisKKyAgICAvKiBDb21wdXRlIHByZWRpY3Rpb24gdmFsdWVzIG92ZXIgY3VycmVudCBsdW1pbmFuY2UgTUIgKi8KKyAgICAvKiAoYmxvY2tzIDMpOyBhZGQgbW90aW9uIHZlY3RvciBwcmlvciB0byBpbnB1dDsgICAgICAgKi8KKyAgICAvKiBhZGQgOCB0byB4X3BvcyBhbmQgeV9wb3MgdG8gYWR2YW5jZSB0byBuZXh0IGJsb2NrICAgKi8KKyAgICAvKiBvbiBuZXh0IHJvdyAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIHhwcmVkID0gKGludCkoKCh4cG9zICsgQl9TSVpFKSA8PCAxKSArIHB4WzNdKTsKKyAgICB5cHJlZCA9IChpbnQpKCgoeXBvcyArIEJfU0laRSkgPDwgMSkgKyBweVszXSk7CisKKyAgICBpZiAoKENCUCA+PiAyKSYxKQorICAgIHsKKyAgICAgICAgcHJlZCA9IHByZWRfYmxvY2sgKyAxMzY7CisgICAgICAgIHByZWRfd2lkdGggPSAxNjsKKyAgICB9CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgcHJlZCA9IGNfY29tcCArICh3aWR0aCA8PCAzKSArIDg7CisgICAgICAgIHByZWRfd2lkdGggPSB3aWR0aDsKKyAgICB9CisKKyAgICAvKiBjaGVjayB3aGV0aGVyIHRoZSBNViBwb2ludHMgb3V0c2lkZSB0aGUgZnJhbWUgKi8KKyAgICBpZiAoeHByZWQgPj0gMCAmJiB4cHJlZCA8PSAoKHdpZHRoIDw8IDEpIC0gKDIqQl9TSVpFKSkgJiYKKyAgICAgICAgICAgIHlwcmVkID49IDAgJiYgeXByZWQgPD0gKChoZWlnaHQgPDwgMSkgLSAoMipCX1NJWkUpKSkKKyAgICB7ICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgICAgICAvKiAoeCx5KSBpcyBpbnNpZGUgdGhlIGZyYW1lICovCisgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgR2V0UHJlZEFkdkJUYWJsZVt5cHJlZCYxXVt4cHJlZCYxXShjX3ByZXYgKyAoeHByZWQgPj4gMSkgKyAoKHlwcmVkID4+IDEpKndpZHRoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVkLCB3aWR0aCwgKHByZWRfd2lkdGggPDwgMSkgfCByb3VuZDEpOworICAgIH0KKyAgICBlbHNlCisgICAgeyAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgICAgIC8qICh4LHkpIGlzIG91dHNpZGUgdGhlIGZyYW1lICovCisgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgICAgIEdldFByZWRPdXRzaWRlKHhwcmVkLCB5cHJlZCwgY19wcmV2LAorICAgICAgICAgICAgICAgICAgICAgICBwcmVkLCB3aWR0aCwgaGVpZ2h0LCByb3VuZDEsIHByZWRfd2lkdGgpOworICAgIH0KKyAgICAvKiBDYWxsIGZ1bmN0aW9uIHRvIHNldCBkZS1ibG9ja2luZyBhbmQgZGUtcmluZ2luZyAqLworICAgIC8qICAgc2VtYXBob3JlcyBmb3IgbHVtaW5hbmNlICAgICAgICAgICAgICAgICAgICAgICovCisKKworCisgICAgLyogeHByZWQgYW5kIHlwcmVkIGNhbGN1bGF0aW9uIGZvciBDaHJvbWluYW5jZSBpcyAqLworICAgIC8qIGluIGZ1bGwtcGVsIHJlc29sdXRpb24uICAgICAgICAgICAgICAgICAgICAgICAgKi8KKworICAgIC8qIENocm9taW5hbmNlICovCisgICAgLyogd2lkdGggb2YgY2hyb21pbmFuY2UgZGF0YSBpbiBwaXhlbHMgKHkgYXhpcykgKi8KKyAgICB3aWR0aCA+Pj0gMTsKKworICAgIC8qIGhlaWd0aCBvZiBjaHJvbWluYW5jZSBkYXRhIGluIHBpeGVscyAoeCBheGlzKSAqLworICAgIGhlaWdodCA+Pj0gMTsKKworICAgIC8qIFBvaW50ZXIgdG8gcHJldmlvdXMgY2hyb21pbmFuY2UgYiBmcmFtZSAqLworICAgIGN1X3ByZXYgPSBwcmV2LT51Q2hhbjsKKworICAgIC8qIFBvaW50ZXIgdG8gcHJldmlvdXMgY2hyb21pbmFuY2UgciBmcmFtZSAqLworICAgIGN2X3ByZXYgPSBwcmV2LT52Q2hhbjsKKworICAgIC8qIHggcG9zaXRpb24gaW4gcHJlZGljdGlvbiBkYXRhIG9mZnNldCBieSBtb3Rpb24gdmVjdG9yICovCisgICAgLyogeHByZWQgY2FsY3VsYXRpb24gZm9yIENocm9taW5hbmNlIGlzIGluIGZ1bGwtcGVsICAgICAgKi8KKyAgICAvKiByZXNvbHV0aW9uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIHhwcmVkID0geHBvcyArIGR4OworCisgICAgLyogeSBwb3NpdGlvbiBpbiBwcmVkaWN0aW9uIGRhdGEgb2Zmc2V0IGJ5IG1vdGlvbiB2ZWN0b3IgKi8KKyAgICAvKiB5cHJlZCBjYWxjdWxhdGlvbiBmb3IgQ2hyb21pbmFuY2UgaXMgaW4gZnVsbC1wZWwgICAgICAqLworICAgIC8qIHJlc29sdXRpb24uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgeXByZWQgPSB5cG9zICsgZHk7CisKKyAgICBjdV9jb21wID0gdmlkZW8tPmN1cnJWb3AtPnVDaGFuICsgKG9mZnNldCA+PiAyKSArICh4cG9zID4+IDIpOworICAgIGN2X2NvbXAgPSB2aWRlby0+Y3VyclZvcC0+dkNoYW4gKyAob2Zmc2V0ID4+IDIpICsgKHhwb3MgPj4gMik7CisKKyAgICAvKiBDYWxsIGZ1bmN0aW9uIHRoYXQgcGVyZm9ybXMgY2hyb21pbmFuY2UgcHJlZGljdGlvbiAqLworICAgIC8qICAgICAgY2hyb21pbmFuY2VfcHJlZCh4cHJlZCwgeXByZWQsIGN1X3ByZXYsIGN2X3ByZXYsCisgICAgICAgICAgICBwcmVkX2Jsb2NrLCB3aWR0aF91diwgaGVpZ2h0X3V2LAorICAgICAgICAgICAgcm91bmQxKTsqLworICAgIGlmICh4cHJlZCA+PSAwICYmIHhwcmVkIDw9ICgod2lkdGggPDwgMSkgLSAoMipCX1NJWkUpKSAmJiB5cHJlZCA+PSAwICYmCisgICAgICAgICAgICB5cHJlZCA8PSAoKGhlaWdodCA8PCAxKSAtICgyKkJfU0laRSkpKQorICAgIHsKKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgICAgICAvKiAoeCx5KSBpcyBpbnNpZGUgdGhlIGZyYW1lICovCisgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgaWYgKChDQlAgPj4gMSkmMSkKKyAgICAgICAgeworICAgICAgICAgICAgcHJlZCA9IHByZWRfYmxvY2sgKyAyNTY7CisgICAgICAgICAgICBwcmVkX3dpZHRoID0gMTY7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBwcmVkID0gY3VfY29tcDsKKyAgICAgICAgICAgIHByZWRfd2lkdGggPSB3aWR0aDsKKyAgICAgICAgfQorCisgICAgICAgIC8qIENvbXB1dGUgcHJlZGljdGlvbiBmb3IgQ2hyb21pbmFuY2UgYiAoYmxvY2tbNF0pICovCisgICAgICAgIEdldFByZWRBZHZCVGFibGVbeXByZWQmMV1beHByZWQmMV0oY3VfcHJldiArICh4cHJlZCA+PiAxKSArICgoeXByZWQgPj4gMSkqd2lkdGgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCAocHJlZF93aWR0aCA8PCAxKSB8IHJvdW5kMSk7CisKKyAgICAgICAgaWYgKENCUCYxKQorICAgICAgICB7CisgICAgICAgICAgICBwcmVkID0gcHJlZF9ibG9jayArIDI2NDsKKyAgICAgICAgICAgIHByZWRfd2lkdGggPSAxNjsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHByZWQgPSBjdl9jb21wOworICAgICAgICAgICAgcHJlZF93aWR0aCA9IHdpZHRoOworICAgICAgICB9CisgICAgICAgIC8qIENvbXB1dGUgcHJlZGljdGlvbiBmb3IgQ2hyb21pbmFuY2UgciAoYmxvY2tbNV0pICovCisgICAgICAgIEdldFByZWRBZHZCVGFibGVbeXByZWQmMV1beHByZWQmMV0oY3ZfcHJldiArICh4cHJlZCA+PiAxKSArICgoeXByZWQgPj4gMSkqd2lkdGgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCAocHJlZF93aWR0aCA8PCAxKSB8IHJvdW5kMSk7CisKKyAgICAgICAgcmV0dXJuIDsKKyAgICB9CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgLyogKHgseSkgaXMgb3V0c2lkZSB0aGUgZnJhbWUgKi8KKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgaWYgKChDQlAgPj4gMSkmMSkKKyAgICAgICAgeworICAgICAgICAgICAgcHJlZCA9IHByZWRfYmxvY2sgKyAyNTY7CisgICAgICAgICAgICBwcmVkX3dpZHRoID0gMTY7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBwcmVkID0gY3VfY29tcDsKKyAgICAgICAgICAgIHByZWRfd2lkdGggPSB3aWR0aDsKKyAgICAgICAgfQorCisgICAgICAgIC8qIENvbXB1dGUgcHJlZGljdGlvbiBmb3IgQ2hyb21pbmFuY2UgYiAoYmxvY2tbNF0pICovCisgICAgICAgIEdldFByZWRPdXRzaWRlKHhwcmVkLCB5cHJlZCwgICAgY3VfcHJldiwKKyAgICAgICAgICAgICAgICAgICAgICAgcHJlZCwgd2lkdGgsIGhlaWdodCwgcm91bmQxLCBwcmVkX3dpZHRoKTsKKworICAgICAgICBpZiAoQ0JQJjEpCisgICAgICAgIHsKKyAgICAgICAgICAgIHByZWQgPSBwcmVkX2Jsb2NrICsgMjY0OworICAgICAgICAgICAgcHJlZF93aWR0aCA9IDE2OworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgcHJlZCA9IGN2X2NvbXA7CisgICAgICAgICAgICBwcmVkX3dpZHRoID0gd2lkdGg7CisgICAgICAgIH0KKworICAgICAgICAvKiBDb21wdXRlIHByZWRpY3Rpb24gZm9yIENocm9taW5hbmNlIHIgKGJsb2NrWzVdKSAqLworICAgICAgICBHZXRQcmVkT3V0c2lkZSh4cHJlZCwgeXByZWQsICAgIGN2X3ByZXYsCisgICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCBoZWlnaHQsIHJvdW5kMSwgcHJlZF93aWR0aCk7CisKKyAgICAgICAgcmV0dXJuIDsKKyAgICB9CisKK30KKworLyoqKiBzcGVjaWFsIGZ1bmN0aW9uIGZvciBza2lwcGVkIG1hY3JvYmxvY2ssICBBdWcgMTUsIDIwMDUgKi8KK3ZvaWQgIFNraXBwZWRNQk1vdGlvbkNvbXAoCisgICAgVmlkZW9EZWNEYXRhICp2aWRlbworKQoreworICAgIFZvcCAqcHJldiA9IHZpZGVvLT5wcmV2Vm9wOworICAgIFZvcCAqY29tcDsKKyAgICBpbnQgeXBvcywgeHBvczsKKyAgICBQSVhFTCAqY19jb21wLCAqY19wcmV2OworICAgIFBJWEVMICpjdV9jb21wLCAqY3VfcHJldjsKKyAgICBQSVhFTCAqY3ZfY29tcCwgKmN2X3ByZXY7CisgICAgaW50IHdpZHRoLCB3aWR0aF91djsKKyAgICBpbnQzMiBvZmZzZXQ7CisKKyAgICB3aWR0aCA9IHZpZGVvLT53aWR0aDsKKyAgICB3aWR0aF91diAgPSB3aWR0aCA+PiAxOworICAgIHlwb3MgPSB2aWRlby0+bWJudW1fcm93IDw8IDQgOworICAgIHhwb3MgPSB2aWRlby0+bWJudW1fY29sIDw8IDQgOworICAgIG9mZnNldCA9IChpbnQzMil5cG9zICogd2lkdGggKyB4cG9zOworCisKKyAgICAvKiB6ZXJvIG1vdGlvbiBjb21wZW5zYXRpb24gZm9yIHByZXZpb3VzIGZyYW1lICovCisgICAgLyptYnkqd2lkdGggKyBtYng7Ki8KKyAgICBjX3ByZXYgID0gcHJldi0+eUNoYW47CisgICAgaWYgKCFjX3ByZXYpIHsKKyAgICAgICAgQUxPR0UoImIvMzUyNjk2MzUiKTsKKyAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIzNTI2OTYzNSIpOworICAgICAgICByZXR1cm47CisgICAgfQorICAgIGNfcHJldiArPSBvZmZzZXQ7CisKKyAgICAvKmJ5KndpZHRoX3V2ICsgYng7Ki8KKyAgICBjdV9wcmV2ID0gcHJldi0+dUNoYW4gKyAob2Zmc2V0ID4+IDIpICsgKHhwb3MgPj4gMik7CisgICAgLypieSp3aWR0aF91diArIGJ4OyovCisgICAgY3ZfcHJldiA9IHByZXYtPnZDaGFuICsgKG9mZnNldCA+PiAyKSArICh4cG9zID4+IDIpOworCisgICAgY29tcCA9IHZpZGVvLT5jdXJyVm9wOworCisgICAgY19jb21wICA9IGNvbXAtPnlDaGFuICsgb2Zmc2V0OworICAgIGN1X2NvbXAgPSBjb21wLT51Q2hhbiArIChvZmZzZXQgPj4gMikgKyAoeHBvcyA+PiAyKTsKKyAgICBjdl9jb21wID0gY29tcC0+dkNoYW4gKyAob2Zmc2V0ID4+IDIpICsgKHhwb3MgPj4gMik7CisKKworICAgIC8qIENvcHkgcHJldmlvdXMgcmVjb25zdHJ1Y3RlZCBmcmFtZSBpbnRvIHRoZSBjdXJyZW50IGZyYW1lICovCisgICAgUHV0U0tJUFBFRF9NQihjX2NvbXAsICBjX3ByZXYsIHdpZHRoKTsKKyA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IC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworICAgIC8qIGRlZmluZWQgaW4gY2hyb21pbmFuY2VfcHJlZC5jICovCisgICAgdm9pZCBjaHJvbWluYW5jZV9wcmVkKAorICAgICAgICBpbnQgeHByZWQsICAgICAgICAgIC8qIGkgKi8KKyAgICAgICAgaW50IHlwcmVkLCAgICAgICAgICAvKiBpICovCisgICAgICAgIHVpbnQ4ICpjdV9wcmV2LCAgICAgLyogaSAqLworICAgICAgICB1aW50OCAqY3ZfcHJldiwgICAgIC8qIGkgKi8KKyAgICAgICAgdWludDggKnByZWRfYmxvY2ssICAvKiBpICovCisgICAgICAgIGludCB3aWR0aF91diwgICAgICAgLyogaSAqLworICAgICAgICBpbnQgaGVpZ2h0X3V2LCAgICAgIC8qIGkgKi8KKyAgICAgICAgaW50IHJvdW5kMQorICAgICk7CisKKyAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KKyAgICAvKiBkZWZpbmVkIGluIGx1bWluYW5jZV9wcmVkX21vZGVfaW50ZXIuYyAqLworICAgIHZvaWQgbHVtaW5hbmNlX3ByZWRfbW9kZV9pbnRlcigKKyAgICAgICAgaW50IHhwcmVkLCAgICAgICAgICAvKiBpICovCisgICAgICAgIGludCB5cHJlZCwgICAgICAgICAgLyogaSAqLworICAgICAgICB1aW50OCAqY19wcmV2LCAgICAgIC8qIGkgKi8KKyAgICAgICAgdWludDggKnByZWRfYmxvY2ssICAvKiBpICovCisgICAgICAgIGludCB3aWR0aCwgICAgICAgICAgLyogaSAqLworICAgICAgICBpbnQgaGVpZ2h0LCAgICAgICAgIC8qIGkgKi8KKyAgICAgICAgaW50IHJvdW5kMQorICAgICk7CisKKyAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KKyAgICAvKiBkZWZpbmVkIGluIGx1bWluYW5jZV9wcmVkX21vZGVfaW50ZXI0di5jICovCisgICAgdm9pZCBsdW1pbmFuY2VfcHJlZF9tb2RlX2ludGVyNHYoCisgICAgICAgIGludCB4cG9zLCAgICAgICAgICAgLyogaSAqLworICAgICAgICBpbnQgeXBvcywgICAgICAgICAgIC8qIGkgKi8KKyAgICAgICAgTU9UICpweCwgICAgICAgICAgICAvKiBpICovCisgICAgICAgIE1PVCAqcHksICAgICAgICAgICAgLyogaSAqLworICAgICAgICB1aW50OCAqY19wcmV2LCAgICAgIC8qIGkgKi8KKyAgICAgICAgdWludDggKnByZWRfYmxvY2ssICAvKiBpICovCisgICAgICAgIGludCB3aWR0aCwgICAgICAgICAgLyogaSAqLworICAgICAgICBpbnQgaGVpZ2h0LCAgICAgICAgIC8qIGkgKi8KKyAgICAgICAgaW50IHJvdW5kMSwgICAgICAgICAvKiBpICovCisgICAgICAgIGludCBtdndpZHRoLCAgICAgICAgICAgIC8qIGkgKi8KKyAgICAgICAgaW50ICp4c3VtX3B0ciwgICAgICAgICAgLyogaS9vICovCisgICAgICAgIGludCAqeXN1bV9wdHIgICAgICAgICAgIC8qIGkvbyAqLworICAgICk7CisKKyAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KKyAgICAvKiBkZWZpbmVkIGluIHBwX3NlbWFwaG9yZV9jaHJvbWFfaW50ZXIuYyAqLworICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworICAgIC8qIGRlZmluZWQgaW4gZ2V0X3ByZWRfYWR2X21iX2FkZC5jICovCisgICAgaW50IEdldFByZWRBZHZhbmNlZE1CKAorICAgICAgICBpbnQgeHBvcywKKyAgICAgICAgaW50IHlwb3MsCisgICAgICAgIHVpbnQ4ICpjX3ByZXYsCisgICAgICAgIHVpbnQ4ICpwcmVkX2Jsb2NrLAorICAgICAgICBpbnQgd2lkdGgsCisgICAgICAgIGludCBybmQxCisgICAgKTsKKworICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworICAgIC8qIGRlZmluZWQgaW4gZ2V0X3ByZWRfYWR2X2JfYWRkLmMgKi8KKyAgICBpbnQgR2V0UHJlZEFkdmFuY2VkQnkweDAoCisgICAgICAgIHVpbnQ4ICpjX3ByZXYsICAgICAgLyogaSAqLworICAgICAgICB1aW50OCAqcHJlZF9ibG9jaywgICAgICAvKiBpICovCisgICAgICAgIGludCB3aWR0aCwgICAgICAvKiBpICovCisgICAgICAgIGludCBwcmVkX3dpZHRoX3JuZCAvKiBpICovCisgICAgKTsKKworICAgIGludCBHZXRQcmVkQWR2YW5jZWRCeTB4MSgKKyAgICAgICAgdWludDggKmNfcHJldiwgICAgICAvKiBpICovCisgICAgICAgIHVpbnQ4ICpwcmVkX2Jsb2NrLCAgICAgIC8qIGkgKi8KKyAgICAgICAgaW50IHdpZHRoLCAgICAgIC8qIGkgKi8KKyAgICAgICAgaW50IHByZWRfd2lkdGhfcm5kIC8qIGkgKi8KKyAgICApOworCisgICAgaW50IEdldFByZWRBZHZhbmNlZEJ5MXgwKAorICAgICAgICB1aW50OCAqY19wcmV2LCAgICAgIC8qIGkgKi8KKyAgICAgICAgdWludDggKnByZWRfYmxvY2ssICAgICAgLyogaSAqLworICAgICAgICBpbnQgd2lkdGgsICAgICAgLyogaSAqLworICAgICAgICBpbnQgcHJlZF93aWR0aF9ybmQgLyogaSAqLworICAgICk7CisKKyAgICBpbnQgR2V0UHJlZEFkdmFuY2VkQnkxeDEoCisgICAgICAgIHVpbnQ4ICpjX3ByZXYsICAgICAgLyogaSAqLworICAgICAgICB1aW50OCAqcHJlZF9ibG9jaywgICAgICAvKiBpICovCisgICAgICAgIGludCB3aWR0aCwgICAgICAvKiBpICovCisgICAgICAgIGludCBwcmVkX3dpZHRoX3JuZCAvKiBpICovCisgICAgKTsKKworICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworICAgIC8qIGRlZmluZWQgaW4gZ2V0X3ByZWRfb3V0c2lkZS5jICovCisgICAgaW50IEdldFByZWRPdXRzaWRlKAorICAgICAgICBpbnQgeHBvcywKKyAgICAgICAgaW50IHlwb3MsCisgICAgICAgIHVpbnQ4ICpjX3ByZXYsCisgICAgICAgIHVpbnQ4ICpwcmVkX2Jsb2NrLAorICAgICAgICBpbnQgd2lkdGgsCisgICAgICAgIGludCBoZWlnaHQsCisgICAgICAgIGludCBybmQxLAorICAgICAgICBpbnQgcHJlZF93aWR0aAorICAgICk7CisKKyAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KKyAgICAvKiBkZWZpbmVkIGluIGZpbmRfcG12c0VyclJlcy5jICovCisgICAgdm9pZCBtdl9wcmVkaWN0aW9uKFZpZGVvRGVjRGF0YSAqdmlkZW8sIGludCBibG9jaywgTU9UICptdngsIE1PVCAqbXZ5KTsKKworICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLworCisgICAgLyotLS0tLS0tLS0tL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pZ2h0LCBpbnQxNiAqUVBfc3RvcmUsCisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgQ29tYmluZWQsIHVpbnQ4ICpwcF9tb2QpOworICAgIHZvaWQgRGVyaW5naW5nX0Nocm9tYSh1aW50OCAqUmVjX0MsIGludCB3aWR0aCwgaW50IGhlaWdodCwgaW50MTYgKlFQX3N0b3JlLAorICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgQ29tYmluZWQsIHVpbnQ4ICpwcF9tb2QpOworICAgIHZvaWQgQ29tYmluZWRIb3J6VmVydEZpbHRlcih1aW50OCAqcmVjLCBpbnQgd2lkdGgsIGludCBoZWlnaHQsIGludDE2ICpRUF9zdG9yZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNociwgdWludDggKnBwX21vZCk7CisgICAgdm9pZCBDb21iaW5lZEhvcnpWZXJ0RmlsdGVyX05vU29mdERlYmxvY2tpbmcodWludDggKnJlYywgaW50IHdpZHRoLCBpbnQgaGVpZ2h0LCBpbnQxNiAqUVBfc3RvcmUsCisgICAgICAgICAgICBpbnQgY2hyLCB1aW50OCAqcHBfbW9kKTsKKyAgICB2b2lkIENvbWJpbmVkSG9yelZlcnRSaW5nRmlsdGVyKHVpbnQ4ICpyZWMsIGludCB3aWR0aCwgaW50IGhlaWdodCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDE2ICpRUF9zdG9yZSwgaW50IGNociwgdWludDggKnBwX21vZCk7CisKKyAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KKyAgICAvKiBkZWZpbmVkIGluIGNvbmNlYWwuYyAqLworICAgIHZvaWQgQ29uY2VhbFRleHR1cmVfSShWaWRlb0RlY0RhdGEgKnZpZGVvLCBpbnQzMiBzdGFydEZpcnN0UGFydGl0aW9uLCBpbnQgbWJfc3RhcnQsIGludCBtYl9zdG9wLAorICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc2xpY2VfY291bnRlcik7CisgICAgdm9pZCBDb25jZWFsVGV4dHVyZV9QKFZpZGVvRGVjRGF0YSAqdmlkZW8sIGludCBtYl9zdGFydCwgaW50IG1iX3N0b3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBzbGljZV9jb3VudGVyKTsKKyAgICB2b2lkIENvbmNlYWxQYWNrZXQoVmlkZW9EZWNEYXRhICp2aWRlbywgaW50IG1iX3N0YXJ0LCBpbnQgbWJfc3RvcCwKKyAgICAgICAgICAgICAgICAgICAgICAgaW50IHNsaWNlX2NvdW50ZXIpOworICAgIHZvaWQgQ29weVZvcE1CKFZvcCAqY3VyciwgdWludDggKnByZXYsIGludCBtYm51bSwgaW50IHdpZHRoLCBpbnQgaGVpZ2h0KTsKKworICAgIC8qIGRlZmluZSBpbiB2bGNfZGVxdWFudC5jICwgIDA5LzE4LzIwMDAqLworI2lmZGVmIFBWX1NVUFBPUlRfTUFJTl9QUk9GSUxFCisgICAgaW50IFZsY0RlcXVhbnRNcGVnSW50cmFCbG9jayh2b2lkICp2aWRlbywgaW50IGNvbXAsIGludCBzd2l0Y2hlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ4ICpiaXRtYXBjb2wsIHVpbnQ4ICpiaXRtYXByb3cpOworICAgIGludCBWbGNEZXF1YW50TXBlZ0ludGVyQmxvY2sodm9pZCAqdmlkZW8sIGludCBjb21wLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDggKmJpdG1hcGNvbCwgdWludDggKmJpdG1hcHJvdyk7CisjZW5kaWYKKyAgICBpbnQgVmxjRGVxdWFudEgyNjNJbnRyYUJsb2NrKFZpZGVvRGVjRGF0YSAqdmlkZW8sIGludCBjb21wLCBpbnQgc3dpdGNoZWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50OCAqYml0b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QgVE8gTk9OLVNLSVBQRUQgTU9ERSovCisgICAgbWJudW0gPSAwOworCisgICAgaWYgKGNocikKKyAgICB7CisgICAgICAgIG5NQlBlclJvdyA9IHdpZHRoID4+IDM7CisgICAgICAgIG5NQlBlckNvbCA9IGhlaWdodCA+PiAzOworICAgICAgICBiX3NpemUgPSA4OworICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICBuTUJQZXJSb3cgPSB3aWR0aCA+PiA0OworICAgICAgICBuTUJQZXJDb2wgPSBoZWlnaHQgPj4gNDsKKyAgICAgICAgYl9zaXplID0gMTY7CisgICAgfQorCisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqIFZFUlRJQ0FMIEZJTFRFUklORyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qIHZlcnRpY2FsIGZpbHRlcmluZyBvZiBtaWQgc2VjdGlvbnMgbm8gbmVlZCB0byBjaGVjayBuZWlnaGJvcmluZyBRUCdzIGV0YyAqLworICAgIGlmICghY2hyKQorICAgIHsKKyAgICAgICAgcmVjX3kgPSByZWMgKyAod2lkdGggPDwgMyk7CisgICAgICAgIGZvciAoaSA9IDA7IGkgPCAoaGVpZ2h0ID4+IDQpOyBpKyspCisgICAgICAgIHsKKyAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCAod2lkdGggPj4gNCk7IGorKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAobW9kZVttYm51bV0gIT0gTU9ERV9TS0lQUEVEKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgayA9IDE2OworICAgICAgICAgICAgICAgICAgICBzdHJlbmd0aCA9IFNUUkVOR1RIX3RhYltRUF9zdG9yZVttYm51bV1dOworICAgICAgICAgICAgICAgICAgICB3aGlsZSAoay0tKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBBID0gICoocmVjX3kgLSB3aWR0aDIpOworICAgICAgICAgICAgICAgICAgICAgICAgRCA9ICoocmVjX3kgKyB3aWR0aCk7CisgICAgICAgICAgICAgICAgICAgICAgICBBX0QgPSBBIC0gRDsKKyAgICAgICAgICAgICAgICAgICAgICAgIEMgPSAqcmVjX3k7CisgICAgICAgICAgICAgICAgICAgICAgICBCID0gKihyZWNfeSAtIHdpZHRoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGQgPSAoKChDIC0gQikgPDwgMikgKyBBX0QpOworCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCA8IDApCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAtKC1kID4+IDMpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkMSA8IC0oc3RyZW5ndGggPDwgMSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGQxIDwgLXN0cmVuZ3RoKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAtZDEgLSAoc3RyZW5ndGggPDwgMSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxXzIgPSAtZDEgPj4gMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IGQgPj4gMzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDEgPiAoc3RyZW5ndGggPDwgMSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGQxID4gc3RyZW5ndGgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IChzdHJlbmd0aCA8PCAxKSAtIGQxOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMV8yID0gZDEgPj4gMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFfRCA8IDApCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSAtKC1BX0QgPj4gMik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQyIDwgLWQxXzIpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMiA9IC1kMV8yOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMiA9IEFfRCA+PiAyOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkMiA+IGQxXzIpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMiA9IGQxXzI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgICAgICAqKHJlY195IC0gd2lkdGgyKSA9IEEgLSBkMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRtcHZhciA9IEIgKyBkMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIENMSVBfUkVTVUxUKHRtcHZhcikKKyAgICAgICAgICAgICAgICAgICAgICAgICoocmVjX3kgLSB3aWR0aCkgPSB0bXB2YXI7CisgICAgICAgICAgICAgICAgICAgICAgICB0bXB2YXIgPSBDIC0gZDE7CisgICAgICAgICAgICAgICAgICAgICAgICBDTElQX1JFU1VMVCh0bXB2YXIpCisgICAgICAgICAgICAgICAgICAgICAgICAqcmVjX3kgPSB0bXB2YXI7CisgICAgICAgICAgICAgICAgICAgICAgICAqKHJlY195ICsgd2lkdGgpID0gRCArIGQyOworICAgICAgICAgICAgICAgICAgICAgICAgcmVjX3krKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICByZWNfeSArPSBiX3NpemU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1ibnVtKys7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZWNfeSArPSAoMTUgKiB3aWR0aCk7CisKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qIFZFUlRJQ0FMIGJvdW5kYXJ5IGJsb2NrcyAqLworCisKKyAgICByZWNfeSA9IHJlYyArIHdpZHRoICogYl9zaXplOworCisgICAgbWJudW0gPSBuTUJQZXJSb3c7CisgICAgZm9yIChpID0gMDsgaSA8IG5NQlBlckNvbCAtIDE7IGkrKykKKyAgICB7CisgICAgICAgIGZvciAoaiA9IDA7IGogPCBuTUJQZXJSb3c7IGorKykKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKG1vZGVbbWJudW1dICE9IE1PREVfU0tJUFBFRCB8fCBtb2RlW21ibnVtIC0gbk1CUGVyUm93XSAhPSBNT0RFX1NLSVBQRUQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgayA9IGJfc2l6ZTsKKyAgICAgICAgICAgICAgICBpZiAobW9kZVttYm51bV0gIT0gTU9ERV9TS0lQUEVEKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgc3RyZW5ndGggPSBTVFJFTkdUSF90YWJbKGFubmV4X1QgPyAgTVFfY2hyb21hX1FQX3RhYmxlW1FQX3N0b3JlW21ibnVtXV0gOiBRUF9zdG9yZVttYm51bV0pXTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgc3RyZW5ndGggPSBTVFJFTkdUSF90YWJbKGFubmV4X1QgPyAgTVFfY2hyb21hX1FQX3RhYmxlW1FQX3N0b3JlW21ibnVtIC0gbk1CUGVyUm93XV0gOiBRUF9zdG9yZVttYm51bSAtIG5NQlBlclJvd10pXTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB3aGlsZSAoay0tKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQSA9ICAqKHJlY195IC0gd2lkdGgyKTsKKyAgICAgICAgICAgICAgICAgICAgRCA9ICAqKHJlY195ICsgd2lkdGgpOworICAgICAgICAgICAgICAgICAgICBBX0QgPSBBIC0gRDsKKyAgICAgICAgICAgICAgICAgICAgQyA9ICpyZWNfeTsKKyAgICAgICAgICAgICAgICAgICAgQiA9ICoocmVjX3kgLSB3aWR0aCk7CisgICAgICAgICAgICAgICAgICAgIGQgPSAoKChDIC0gQikgPDwgMikgKyBBX0QpOworCisgICAgICAgICAgICAgICAgICAgIGlmIChkIDwgMCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAtKC1kID4+IDMpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQxIDwgLShzdHJlbmd0aCA8PCAxKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChkMSA8IC1zdHJlbmd0aCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IC1kMSAtIChzdHJlbmd0aCA8PCAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGQxXzIgPSAtZDEgPj4gMTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gZCA+PiAzOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQxID4gKHN0cmVuZ3RoIDw8IDEpKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGQxID4gc3RyZW5ndGgpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAoc3RyZW5ndGggPDwgMSkgLSBkMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGQxXzIgPSBkMSA+PiAxOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKEFfRCA8IDApCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGQyID0gLSgtQV9EID4+IDIpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQyIDwgLWQxXzIpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSAtZDFfMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGQyID0gQV9EID4+IDI7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDIgPiBkMV8yKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQyID0gZDFfMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgICoocmVjX3kgLSB3aWR0aDIpID0gQSAtIGQyOworICAgICAgICAgICAgICAgICAgICB0bXB2YXIgPSBCICsgZDE7CisgICAgICAgICAgICAgICAgICAgIENMSVBfUkVTVUxUKHRtcHZhcikKKyAgICAgICAgICAgICAgICAgICAgKihyZWNfeSAtIHdpZHRoKSA9IHRtcHZhcjsKKyAgICAgICAgICAgICAgICAgICAgdG1wdmFyID0gQyAtIGQxOworICAgICAgICAgICAgICAgICAgICBDTElQX1JFU1VMVCh0bXB2YXIpCisgICAgICAgICAgICAgICAgICAgICpyZWNfeSA9IHRtcHZhcjsKKyAgICAgICAgICAgICAgICAgICAgKihyZWNfeSArIHdpZHRoKSA9IEQgKyBkMjsKKyAgICAgICAgICAgICAgICAgICAgcmVjX3krKzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmVjX3kgKz0gYl9zaXplOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbWJudW0rKzsKKyAgICAgICAgfQorICAgICAgICByZWNfeSArPSAoKGJfc2l6ZSAtIDEpICogd2lkdGgpOworCisgICAgfQorCisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqSE9SSVpPTlRBTCBGSUxURVJJTkcgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgbWJudW0gPSAwOworICAgIC8qIEhPUklaT05UQUwgSU5ORVIgKi8KKyAgICBpZiAoIWNocikKKyAgICB7CisgICAgICAgIHJlY195ID0gcmVjICsgODsKKyAgICAgICAgb2Zmc2V0ID0gd2lkdGggKiBiX3NpemUgLSBiX3NpemU7CisKKyAgICAgICAgZm9yIChpID0gMDsgaSA8IG5NQlBlckNvbDsgaSsrKQorICAgICAgICB7CisgICAgICAgICAgICBmb3IgKGogPSAwOyBqIDwgbk1CUGVyUm93OyBqKyspCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKG1vZGVbbWJudW1dICE9IE1PREVfU0tJUFBFRCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGsgPSAxNjsKKyAgICAgICAgICAgICAgICAgICAgc3RyZW5ndGggPSBTVFJFTkdUSF90YWJbUVBfc3RvcmVbbWJudW1dXTsKKyAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGstLSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgQSA9ICAqKHJlY195IC0gMik7CisgICAgICAgICAgICAgICAgICAgICAgICBEID0gICoocmVjX3kgKyAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIEFfRCA9IEEgLSBEOworICAgICAgICAgICAgICAgICAgICAgICAgQyA9ICpyZWNfeTsKKyAgICAgICAgICAgICAgICAgICAgICAgIEIgPSAqKHJlY195IC0gMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBkID0gKCgoQyAtIEIpIDw8IDIpICsgQV9EKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgPCAwKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gLSgtZCA+PiAzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDEgPCAtKHN0cmVuZ3RoIDw8IDEpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChkMSA8IC1zdHJlbmd0aCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gLWQxIC0gKHN0cmVuZ3RoIDw8IDEpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMV8yID0gLWQxID4+IDE7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSBkID4+IDM7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQxID4gKHN0cmVuZ3RoIDw8IDEpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChkMSA+IHN0cmVuZ3RoKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAoc3RyZW5ndGggPDwgMSkgLSBkMTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDFfMiA9IGQxID4+IDE7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBX0QgPCAwKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQyID0gLSgtQV9EID4+IDIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkMiA8IC1kMV8yKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSAtZDFfMjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSBBX0QgPj4gMjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDIgPiBkMV8yKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSBkMV8yOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAgICAgKihyZWNfeSAtIDIpID0gQSAtIGQyOworICAgICAgICAgICAgICAgICAgICAgICAgdG1wdmFyID0gQiArIGQxOworICAgICAgICAgICAgICAgICAgICAgICAgQ0xJUF9SRVNVTFQodG1wdmFyKQorICAgICAgICAgICAgICAgICAgICAgICAgKihyZWNfeSAtIDEpID0gdG1wdmFyOworICAgICAgICAgICAgICAgICAgICAgICAgdG1wdmFyID0gQyAtIGQxOworICAgICAgICAgICAgICAgICAgICAgICAgQ0xJUF9SRVNVTFQodG1wdmFyKQorICAgICAgICAgICAgICAgICAgICAgICAgKnJlY195ID0gdG1wdmFyOworICAgICAgICAgICAgICAgICAgICAgICAgKihyZWNfeSArIDEpID0gRCArIGQyOworICAgICAgICAgICAgICAgICAgICAgICAgcmVjX3kgKz0gd2lkdGg7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmVjX3kgLT0gb2Zmc2V0OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICByZWNfeSArPSBiX3NpemU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1ibnVtKys7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZWNfeSArPSAoMTUgKiB3aWR0aCk7CisKKyAgICAgICAgfQorICAgIH0KKworCisKKyAgICAvKiBIT1JJWk9OVEFMIEVER0UgKi8KKyAgICByZWNfeSA9IHJlYyArIGJfc2l6ZTsKKyAgICBvZmZzZXQgPSB3aWR0aCAqIGJfc2l6ZSAtIGJfc2l6ZTsKKyAgICBtYm51bSA9IDE7CisgICAgZm9yIChpID0gMDsgaSA8IG5NQlBlckNvbDsgaSsrKQorICAgIHsKKyAgICAgICAgZm9yIChqID0gMDsgaiA8IG5NQlBlclJvdyAtIDE7IGorKykKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKG1vZGVbbWJudW1dICE9IE1PREVfU0tJUFBFRCB8fCBtb2RlW21ibnVtLTFdICE9IE1PREVfU0tJUFBFRCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBrID0gYl9zaXplOworICAgICAgICAgICAgICAgIGlmIChtb2RlW21ibnVtXSAhPSBNT0RFX1NLSVBQRUQpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBzdHJlbmd0aCA9IFNUUkVOR1RIX3RhYlsoYW5uZXhfVCA/ICBNUV9jaHJvbWFfUVBfdGFibGVbUVBfc3RvcmVbbWJudW1dXSA6IFFQX3N0b3JlW21ibnVtXSldOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBzdHJlbmd0aCA9IFNUUkVOR1RIX3RhYlsoYW5uZXhfVCA/ICBNUV9jaHJvbWFfUVBfdGFibGVbUVBfc3RvcmVbbWJudW0gLSAxXV0gOiBRUF9zdG9yZVttYm51bSAtIDFdKV07CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgd2hpbGUgKGstLSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIEEgPSAgKihyZWNfeSAtIDIpOworICAgICAgICAgICAgICAgICAgICBEID0gICoocmVjX3kgKyAxKTsKKyAgICAgICAgICAgICAgICAgICAgQV9EID0gQSAtIEQ7CisgICAgICAgICAgICAgICAgICAgIEMgPSAqcmVjX3k7CisgICAgICAgICAgICAgICAgICAgIEIgPSAqKHJlY195IC0gMSk7CisgICAgICAgICAgICAgICAgICAgIGQgPSAoKChDIC0gQikgPDwgMikgKyBBX0QpOworCisgICAgICAgICAgICAgICAgICAgIGlmIChkIDwgMCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAtKC1kID4+IDMpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQxIDwgLShzdHJlbmd0aCA8PCAxKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChkMSA8IC1zdHJlbmd0aCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IC1kMSAtIChzdHJlbmd0aCA8PCAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGQxXzIgPSAtZDEgPj4gMTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gZCA+PiAzOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQxID4gKHN0cmVuZ3RoIDw8IDEpKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGQxID4gc3RyZW5ndGgpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAoc3RyZW5ndGggPDwgMSkgLSBkMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGQxXzIgPSBkMSA+PiAxOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKEFfRCA8IDApCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGQyID0gLSgtQV9EID4+IDIpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQyIDwgLWQxXzIpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSAtZDFfMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGQyID0gQV9EID4+IDI7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDIgPiBkMV8yKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQyID0gZDFfMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgICoocmVjX3kgLSAyKSA9IEEgLSBkMjsKKyAgICAgICAgICAgICAgICAgICAgdG1wdmFyID0gQiArIGQxOworICAgICAgICAgICAgICAgICAgICBDTElQX1JFU1VMVCh0bXB2YXIpCisgICAgICAgICAgICAgICAgICAgICoocmVjX3kgLSAxKSA9IHRtcHZhcjsKKyAgICAgICAgICAgICAgICAgICAgdG1wdmFyID0gQyAtIGQxOworICAgICAgICAgICAgICAgICAgICBDTElQX1JFU1VMVCh0bXB2YXIpCisgICAgICAgICAgICAgICAgICAgICpyZWNfeSA9IHRtcHZhcjsKKyAgICAgICAgICAgICAgICAgICAgKihyZWNfeSArIDEpID0gRCArIGQyOworICAgICAgICAgICAgICAgICAgICByZWNfeSArPSB3aWR0aDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmVjX3kgLT0gb2Zmc2V0OworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJlY195ICs9IGJfc2l6ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1ibnVtKys7CisgICAgICAgIH0KKyAgICAgICAgcmVjX3kgKz0gKCh3aWR0aCAqIChiX3NpemUgLSAxKSkgKyBiX3NpemUpOworICAgICAgICBtYm51bSsrOworICAgIH0KKworICAgIHJldHVybjsKK30KKyNlbmRpZgorCmRpZmYgLS1naXQgYS9tZWRpYS9saWJzdGFnZWZyaWdodC9jb2RlY3MvbTR2X2gyNjMvZGVjL3NyYy9wb3N0X3Byb2MuaCBiL21lZGlhL2NvZGVjcy9tNHZfaDI2My9kZWMvc3JjL3Bvc3RfcHJvYy5oCnNpbWlsYXJpdHkgaW5kZXggMTAwJQpyZW5hbWUgZnJvbSBtZWRpYS9saWJzdGFnZWZyaWdodC9jb2RlY3MvbTR2X2gyNjMvZGVjL3NyYy9wb3N0X3Byb2MuaApyZW5hbWUgdG8gbWVkaWEvY29kZWNzL200dl9oMjYzL2RlYy9zcmMvcG9zdF9wcm9jLmgKZGlmZiAtLWdpdCBhL21lZGlhL2NvZGVjcy9tNHZfaDI2My9kZWMvc3JjL3B2ZGVjX2FwaS5jcHAgYi9tZWRpYS9jb2RlY3MvbTR2X2gyNjMvZGVjL3NyYy9wdmRlY19hcGkuY3BwCm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CAgICAgICAgICAgICAgICAgIElNRU1fbW90WFtRQ0lGX0JTXTsKK2V4dGVybiBNT1QgICAgICAgICAgICAgICAgICBJTUVNX21vdFlbUUNJRl9CU107CitleHRlcm4gQml0c3RyZWFtRGVjVmlkZW8gICAgSU1FTV9CaXRzdHJlYW1EZWNWaWRlb1s0XTsKK2V4dGVybiB0eXBlRENTdG9yZSAgICAgICAgICBJTUVNX3ByZWREQ1tRQ0lGX01CU107CitleHRlcm4gdHlwZURDQUNTdG9yZSAgICAgICAgSU1FTV9wcmVkRENBQ19jb2xbUUNJRl9NQl9ST1dTKzFdOworCitleHRlcm4gVmlkZW9EZWNEYXRhICAgICAgICAgSU1FTV9WaWRlb0RlY0RhdGFbMV07CitleHRlcm4gVm9wICAgICAgICAgICAgICAgICAgSU1FTV9jdXJyVm9wWzFdOworZXh0ZXJuIFZvcCAgICAgICAgICAgICAgICAgIElNRU1fcHJldlZvcFsxXTsKK2V4dGVybiBQSVhFTCAgICAgICAgICAgICAgICBJTUVNX2N1cnJWb3BfeUNoYW5bUUNJRl9NQlMqMTI4KjNdOworZXh0ZXJuIFBJWEVMICAgICAgICAgICAgICAgIElNRU1fcHJldlZvcF95Q2hhbltRQ0lGX01CUyoxMjgqM107CitleHRlcm4gdWludDggICAgICAgICAgICAgICAgSU1FTV9wc3RwcmNUeXBDdXJbNipRQ0lGX01CU107CitleHRlcm4gdWludDggICAgICAgICAgICAgICAgSU1FTV9wc3RwcmNUeXBQcnZbNipRQ0lGX01CU107CisKKworZXh0ZXJuIFZvcCAgICAgICAgICAgICAgICAgIElNRU1fdm9wSEVBREVSWzJdOworZXh0ZXJuIFZvbCAgICAgICAgICAgICAgICAgIElNRU1fVk9MWzJdOworZXh0ZXJuIFZvcCAgICAgICAgICAgICAgICAgIElNRU1fdm9wSGVhZGVyWzJdWzFdOworZXh0ZXJuIFZvbCAgICAgICAgICAgICAgICAgIElNRU1fdm9sWzJdWzFdOworCisjZW5kaWYKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkluaXRWaWRlb0RlY29kZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA0LzExLzIwMDAsIDA4LzI5LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogSW5pdGlhbGl6YXRpb24gb2YgdGhlIE1QRUctNCB2aWRlbyBkZWNvZGVyIGxpYnJhcnkuICAgICAgICAgICovCisvKiAgICAgICAgICAgICBUaGUgcmV0dXJuIHR5cGUgaXMgQm9vbCBpbnN0ZWFkIG9mIFBWX1NUQVRVUyBiZWNhdXNlICAgICAgICAgKi8KKy8qICAgICAgICAgICAgIHdlIGRvbid0IHdhbnQgdG8gZXhwb3NlIFBWX1NUQVRVUyB0byAob3V0c2lkZSkgcHJvZ3JhbW1lcnMgICAqLworLyogICAgICAgICAgICAgdGhhdCB1c2Ugb3VyIGRlY29kZXIgbGlicmFyeSBTREsuICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK09TQ0xfRVhQT1JUX1JFRiBCb29sIFBWSW5pdFZpZGVvRGVjb2Rl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bF9tZW1zZXQodmlkZW8sIDAsIHNpemVvZihWaWRlb0RlY0RhdGEpKTsKKyAgICAgICAgdmlkZW8tPm1lbW9yeVVzYWdlID0gc2l6ZW9mKFZpZGVvRGVjRGF0YSk7CisgICAgICAgIHZpZGVvLT5udW1iZXJPZkxheWVycyA9IG5MYXllcnM7CisjaWZkZWYgREVDX0lOVEVSTkFMX01FTU9SWV9PUFQKKyAgICAgICAgdmlkZW8tPnZvbCA9IChWb2wgKiopIElNRU1fVk9MOworI2Vsc2UKKyAgICAgICAgaWYgKChzaXplX3QpbkxheWVycyA+IFNJWkVfTUFYIC8gc2l6ZW9mKFZvbCAqKSkgeworICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7CisgICAgICAgICAgICBvc2NsX2ZyZWUodmlkZW8pOworICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICB9CisKKyAgICAgICAgdmlkZW8tPnZvbCA9IChWb2wgKiopIG9zY2xfbWFsbG9jKG5MYXllcnMgKiBzaXplb2YoVm9sICopKTsKKyNlbmRpZgorICAgICAgICBpZiAodmlkZW8tPnZvbCA9PSBOVUxMKSBzdGF0dXMgPSBQVl9GQUxTRTsKKyAgICAgICAgdmlkZW8tPm1lbW9yeVVzYWdlICs9IG5MYXllcnMgKiBzaXplb2YoVm9sICopOworCisgICAgICAgIC8qIGJlIHN1cmUgbm90IHRvIGxlYWsgYW55IHByZXZpb3VzIHN0YXRlICovCisgICAgICAgIFBWQ2xlYW5VcFZpZGVvRGVjb2RlcihkZWNDdHJsKTsKKyAgICAgICAgLyogd2UgbmVlZCB0byBzZXR1cCB0aGlzIHBvaW50ZXIgZm9yIHRoZSBhcHBsaWNhdGlvbiB0byAqLworICAgICAgICAvKiAgICBwYXNzIGl0IGFyb3VuZC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgIGRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGEgPSAodm9pZCAqKSB2aWRlbzsKKyAgICAgICAg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V0KHZpZGVvLT5jdXJyVm9wLCAwLCBzaXplb2YoVm9wKSk7CisgICAgICAgIHZpZGVvLT5wcmV2Vm9wID0gKFZvcCAqKSBvc2NsX21hbGxvYyhzaXplb2YoVm9wKSk7CisgICAgICAgIGlmICh2aWRlby0+cHJldlZvcCA9PSBOVUxMKSBzdGF0dXMgPSBQVl9GQUxTRTsKKyAgICAgICAgZWxzZSBvc2NsX21lbXNldCh2aWRlby0+cHJldlZvcCwgMCwgc2l6ZW9mKFZvcCkpOworICAgICAgICB2aWRlby0+bWVtb3J5VXNhZ2UgKz0gKHNpemVvZihWb3ApICogMik7CisKKyAgICAgICAgaWYgKChzaXplX3QpbkxheWVycyA+IFNJWkVfTUFYIC8gc2l6ZW9mKFZvcCAqKSkgeworICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7CisgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgIH0KKworICAgICAgICB2aWRlby0+dm9wSGVhZGVyID0gKFZvcCAqKikgb3NjbF9tYWxsb2Moc2l6ZW9mKFZvcCAqKSAqIG5MYXllcnMpOworI2VuZGlmCisgICAgICAgIGlmICh2aWRlby0+dm9wSGVhZGVyID09IE5VTEwpIHN0YXR1cyA9IFBWX0ZBTFNFOworICAgICAgICBlbHNlIG9zY2xfbWVtc2V0KHZpZGVvLT52b3BIZWFkZXIsIDAsIHNpemVvZihWb3AgKikqbkxheWVycyk7CisgICAgICAgIHZpZGVvLT5tZW1vcnlVc2FnZSArPSAoc2l6ZW9mKFZvcCAqKSAqIG5MYXllcnMpOworCisgICAgICAgIHZpZGVvLT5pbml0aWFsaXplZCA9IFBWX0ZBTFNFOworICAgICAgICAvKiBEZWNvZGUgdGhlIGhlYWRlciB0byBnZXQgYWxsIGluZm9ybWF0aW9uIHRvIGFsbG9jYXRlIGRhdGEgKi8KKyAgICAgICAgaWYgKHN0YXR1cyA9PSBQVl9UUlVFKQorICAgICAgICB7CisgICAgICAgICAgICAvKiBpbml0aWFsaXplIGRlY29kZWQgZnJhbWUgY291bnRlci4gICAwNC8yNC8yMDAxICovCisgICAgICAgICAgICB2aWRlby0+ZnJhbWVfaWR4ID0gLTE7CisKKworICAgICAgICAgICAgZm9yIChpZHggPSAwOyBpZHggPCBuTGF5ZXJzOyBpZHgrKykKKyAgICAgICAgICAgIHsKKworI2lmZGVmIERFQ19JTlRFUk5BTF9NRU1PUllfT1BUCisgICAgICAgICAgICAgICAgdmlkZW8tPnZvcEhlYWRlcltpZHhdID0gSU1FTV92b3BIZWFkZXJbaWR4XTsKKyNlbHNlCisgICAgICAgICAgICAgICAgdmlkZW8tPnZvcEhlYWRlcltpZHhdID0gKFZvcCAqKSBvc2NsX21hbGxvYyhzaXplb2YoVm9wKSk7CisjZW5kaWYKKyAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnZvcEhlYWRlcltpZHhdID09IE5VTEwpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUxTRTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIG9zY2xfbWVtc2V0KHZpZGVvLT52b3BIZWFkZXJbaWR4XSwgMCwgc2l6ZW9mKFZvcCkpOworICAgICAgICAgICAgICAgICAgICB2aWRlby0+dm9wSGVhZGVyW2lkeF0tPnRpbWVTdGFtcCA9IDA7CisgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5tZW1vcnlVc2FnZSArPSAoc2l6ZW9mKFZvcCkpOworICAgICAgICAgICAgICAgIH0KKyNpZmRlZiBERUNfSU5URVJOQUxfTUVNT1JZX09QVAorICAgICAgICAgICAgICAgIHZpZGVvLT52b2xbaWR4XSA9IElNRU1fdm9sW2lkeF07CisgICAgICAgICAgICAgICAgdmlkZW8tPm1lbW9yeVVzYWdlICs9IHNpemVvZihWb2wpOworICAgICAgICAgICAgICAgIGlmICh2aWRlby0+dm9sW2lkeF0gPT0gTlVMTCkgc3RhdHVzID0gUFZfRkFMU0U7CisgICAgICAgICAgICAgICAgZWxzZSBvc2NsX21lbXNldCh2aWRlby0+dm9sW2lkeF0sIDAsIHNpemVvZihWb2wpKTsKKyAgICAgICAgICAgICAgICBzdHJlYW0gPSBJTUVNX0JpdHN0cmVhbURlY1ZpZGVvOworI2Vsc2UKKyAgICAgICAgICAgICAgICB2aWRlby0+dm9sW2lkeF0gPSAoVm9sICopIG9zY2xfbWFsbG9jKHNpemVvZihWb2wpKTsKKyAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnZvbFtpZHhdID09IE5VTEwpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUxTRTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5tZW1vcnlVc2FnZSArPSBzaXplb2YoVm9sKTsKKyAgICAgICAgICAgICAgICAgICAgb3NjbF9tZW1zZXQodmlkZW8tPnZvbFtpZHhdLCAwLCBzaXplb2YoVm9sKSk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgc3RyZWFtID0gKEJpdHN0cmVhbURlY1ZpZGVvICopIG9zY2xfbWFsbG9jKHNpemVvZihCaXRzdHJlYW1EZWNWaWRlbykpOworI2VuZGlmCisgICAgICAgICAgICAgICAgdmlkZW8tPm1lbW9yeVVzYWdlICs9IHNpemVvZihCaXRzdHJlYW1EZWNWaWRlbyk7CisgICAgICAgICAgICAgICAgaWYgKHN0cmVhbSA9PSBOVUxMKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpbnQzMiBidWZmZXJfc2l6ZTsKKyAgICAgICAgICAgICAgICAgICAgb3NjbF9tZW1zZXQoc3RyZWFtLCAwLCBzaXplb2YoQml0c3RyZWFtRGVjVmlkZW8pKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKChidWZmZXJfc2l6ZSA9IEJpdHN0cmVhbU9wZW4oc3RyZWFtLCBpZHgpKSA8IDApCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1wNGRlY19sb2coIkluaXRWaWRlb0RlY29kZXIoKTogQ2FuJ3QgYWxsb2NhdGUgYml0c3RyZWFtIGJ1ZmZlci5cbiIpOworICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB2aWRlby0+bWVtb3J5VXNhZ2UgKz0gYnVmZmVyX3NpemU7CisgICAgICAgICAgICAgICAgICAgIHZpZGVvLT52b2xbaWR4XS0+Yml0c3RyZWFtID0gc3RyZWFtOworICAgICAgICAgICAgICAgICAgICB2aWRlby0+dm9sW2lkeF0tPnZvbElEID0gaWR4OworICAgICAgICAgICAgICAgICAgICB2aWRlby0+dm9sW2lkeF0tPnRpbWVJbmNfb2Zmc2V0ID0gMDsgIC8qICAxMS8xMi8wMSAqLworICAgICAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRyYSA9ICZWbGNEZWNUQ09FRlNob3J0SGVhZGVyOworICAgICAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRlciA9ICZWbGNEZWNUQ09FRlNob3J0SGVhZGVyOworICAgICAgICAgICAgICAgICAgICBpZiAobW9kZSA9PSBNUEVHNF9NT0RFKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAvKiBTZXQgdXAgVk9MIGhlYWRlciBiaXRzdHJlYW0gZm9yIGZyYW1lLWJhc2VkIGRlY29kaW5nLiAgMDgvMzAvMjAwMCAqLworICAgICAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVzZXQoc3RyZWFtLCBkZWNDdHJsLT52b2xidWZbaWR4XSwgZGVjQ3RybC0+dm9sYnVmX3NpemVbaWR4XSk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoRGVjb2RlVk9MSGVhZGVyKHZpZGVvLCBpZHgpKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgUFZfU1VDQ0VTUyA6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gUFZfVFJVRSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX1RSVUU7ICAgLyogIHdlIHdhbnQgdG8gbWFrZSBzdXJlIHRoYXQgaWYgZmlyc3QgbGF5ZXIgaXMgYmFkLCBzZWNvbmQgbGF5ZXIgaXMgZ29vZCByZXR1cm4gUFZfRkFJTCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUxTRTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisjaWZkZWYgUFZfVE9MRVJBVEVfVk9MX0VSUk9SUworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgUFZfQkFEX1ZPTEhFQURFUjoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfVFJVRTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisjZW5kaWYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0IDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+c2hvcnRWaWRlb0hlYWRlciA9IFBWX1RSVUU7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnNob3J0VmlkZW9IZWFkZXIgPT0gUFZfVFJVRSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgbW9kZSA9IEgyNjNfTU9ERTsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNldCBtYXggd2lkdGggYW5kIGhlaWdodC4gIEluIEguMjYzIG1vZGUsIHdlIHVzZSAgICAqLworICAgICAgICAgICAgICAgICAgICAgICAgLyogIHZvbGJ1Zl9zaXplWzBdIHRvIHBhc3MgaW4gd2lkdGggYW5kIHZvbGJ1Zl9zaXplWzFdICovCisgICAgICAgICAgICAgICAgICAgICAgICAvKiAgdG8gcGFzcyBpbiBoZWlnaHQuICAgICAgICAgICAgICAgICAgICAwNC8yMy8yMDAxICovCisgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+cHJldlZvcC0+dGVtcG9yYWxSZWYgPSAwOyAvKiAgMTEvMTIvMDEgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIC8qIENvbXB1dGUgc29tZSBjb252ZW5pZW5jZSB2YXJpYWJsZXM6ICAgMDQvMjMvMjAwMSAqLworICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZvbFtpZHhdLT5xdWFudFR5cGUgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZvbFtpZHhdLT5xdWFudFByZWNpc2lvbiA9IDU7CisgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+dm9sW2lkeF0tPmVycm9yUmVzRGlzYWJsZSA9IDE7CisgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+dm9sW2lkeF0tPmRhdGFQYXJ0aXRpb25pbmcgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZvbFtpZHhdLT51c2VSZXZlcnNlVkxDID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5pbnRyYV9hY2RjUHJlZERpc2FibGUgPSAxOworICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZvbFtpZHhdLT5zY2FsYWJpbGl0eSA9IDA7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5V2lkdGggPSB3aWR0aDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gaGVpZ2h0OworICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPndpZHRoID0gKHdpZHRoICsgMTUpICYgLTE2OworICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmhlaWdodCA9IChoZWlnaHQgKyAxNSkgJiAtMTY7CisgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+c2l6ZSA9IChpbnQzMil2aWRlby0+d2lkdGggKiB2aWRlby0+aGVpZ2h0OworCisjaWZkZWYgUFZfQU5ORVhfSUpLVF9TVVBQT1JUCisgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+bW9kaWZpZWRfcXVhbnQgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmFkdmFuY2VkX0lOVFJBID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5kZWJsb2NraW5nID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5zbGljZV9zdHJ1Y3R1cmUgPSAwOworI2VuZGlmCisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICB9CisgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfRkFMU0UpCisgICAgICAgIHsKKyAgICAgICAgICAgIHN0YXR1cyA9IFBWQWxsb2NWaWRlb0RhdGEoZGVjQ3RybCwgd2lkdGgsIGhlaWdodCwgbkxheWVycyk7CisgICAgICAgICAgICB2aWRlby0+aW5pdGlhbGl6ZWQgPSBQVl9UUlVFOworICAgICAgICB9CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIHN0YXR1cyA9IFBWX0ZBTFNFOworICAgIH0KKworZmFpbDoKKyAgICBpZiAoc3RhdHVzID09IFBWX0ZBTFNFKSBQVkNsZWFuVXBWaWRlb0RlY29kZXIoZGVjQ3RybCk7CisKKyAgICByZXR1cm4gc3RhdHVzOworfQorCitCb29sIFBWQWxsb2NWaWRlb0RhdGEoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgaW50IHdpZHRoLCBpbnQgaGVpZ2h0LCBpbnQgbkxheWVycykKK3sKKyAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKSBkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhOworICAgIEJvb2wgc3RhdHVzID0gUFZfVFJVRTsKKyAgICBpbnQgblRvdGFsTUI7CisgICAgaW50IG5NQlBlclJvdzsKKyAgICBpbnQzMiBzaXplOworCisgICAgaWYgKHZpZGVvLT5zaG9ydFZpZGVvSGVhZGVyID09IFBWX1RSVUUpCisgICAgeworICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gd2lkdGg7CisgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gaGVpZ2h0OworICAgICAgICB2aWRlby0+d2lkdGggPSAod2lkdGggKyAxNSkgJiAtMTY7CisgICAgICAgIHZpZGVvLT5oZWlnaH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GVvLT5wcmV2Vm9wLT51Q2hhbiwgMTI4LCBzaXplb2YodWludDgpKnNpemUgLyAyKTsKKworICAgIG9zY2xfbWVtc2V0KHZpZGVvLT5jdXJyVm9wLT55Q2hhbiwgMCwgc2l6ZW9mKHVpbnQ4KSpzaXplKjMgLyAyKTsKKyAgICBpZiAobkxheWVycyA+IDEpCisgICAgeworICAgICAgICBvc2NsX21lbXNldCh2aWRlby0+cHJldkVuaGNWb3AtPnlDaGFuLCAwLCBzaXplb2YodWludDgpKnNpemUqMyAvIDIpOworICAgICAgICB2aWRlby0+cHJldkVuaGNWb3AtPnRpbWVTdGFtcCA9IDA7CisgICAgfQorICAgIHZpZGVvLT5jb25jZWFsRnJhbWUgPSB2aWRlby0+cHJldlZvcC0+eUNoYW47ICAgICAgICAgICAgICAgLyogIDA3LzA3LzIwMDEgKi8KKyAgICBkZWNDdHJsLT5vdXRwdXRGcmFtZSA9IHZpZGVvLT5wcmV2Vm9wLT55Q2hhbjsgICAgICAgICAgICAgIC8qICAwNi8xOS8yMDAyICovCisjZW5kaWYKKworICAgIC8qIGFsd2F5cyBzdGFydCBmcm9tIGJhc2UgbGF5ZXIgKi8KKyAgICB2aWRlby0+Y3VyckxheWVyID0gMDsKKyAgICByZXR1cm4gc3RhdHVzOworfQorCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFBWUmVzZXRWaWRlb0RlY29kZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDEvMTQvMjAwMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiBSZXNldCB2aWRlbyB0aW1lc3RhbXBzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworQm9vbCBQVlJlc2V0VmlkZW9EZWNvZGVyKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwpCit7CisgICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKikgZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKKyAgICBpbnQgaWR4OworCisgICAgZm9yIChpZHggPSAwOyBpZHggPCBkZWNDdHJsLT5uTGF5ZXJzOyBpZHgrKykKKyAgICB7CisgICAgICAgIHZpZGVvLT52b3BIZWFkZXJbaWR4XS0+dGltZVN0YW1wID0gMDsKKyAgICB9CisgICAgdmlkZW8tPnByZXZWb3AtPnRpbWVTdGFtcCA9IDA7CisgICAgaWYgKGRlY0N0cmwtPm5MYXllcnMgPiAxKQorICAgICAgICB2aWRlby0+cHJldkVuaGNWb3AtPnRpbWVTdGFtcCA9IDA7CisKKyAgICBvc2NsX21lbXNldCh2aWRlby0+bWJsb2NrLT5ibG9jaywgMCwgc2l6ZW9mKGludDE2KSo2Kk5DT0VGRl9CTE9DSyk7IC8vICBBdWcgMjMsMjAwNQorCisgICAgcmV0dXJuIFBWX1RSVUU7Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkNsZWFuVXBWaWRlb0RlY29kZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA0LzExLzIwMDAsIDA4LzI5LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogQ2xlYW51cCBvZiB0aGUgTVBFRy00IHZpZGVvIGRlY29kZXIgbGlicmFyeS4gICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK09TQ0xfRVhQT1JUX1JFRiBCb29sIFBWQ2xlYW5VcFZpZGVvRGVjb2RlcihWaWRlb0RlY0NvbnRyb2xzICpkZWNDdHJsKQoreworICAgIGludCBpZHg7CisgICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKikgZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKKyNpZmRlZiBERUNfSU5URVJOQUxfTUVNT1JZX09QVAorICAgIGlmICh2aWRlbykKKyAgICB7CisKKyAgICAgICAgdmlkZW8tPmFjUHJlZEZsYWcgICAgICAgPSBOVUxMOworICAgICAgICB2aWRlby0+c2xpY2VObyAgICAgICAgICA9IE5VTEw7CisgICAgICAgIHZpZGVvLT5tb3RYICAgICAgICAgICAgID0gTlVMTDsKKyAgICAgICAgdmlkZW8tPm1vdFkgICAgICAgICAgICAgPSBOVUxMOworICAgICAgICB2aWRlby0+bWJsb2NrICAgICAgICAgICA9IE5VTEw7CisgICAgICAgIHZpZGVvLT5RUE1CICAgICAgICAgICAgID0gTlVMTDsKKyAgICAgICAgdmlkZW8tPnByZWREQyAgICAgICAgICAgPSBOVUxMOworICAgICAgICB2aWRlby0+cHJlZERDQUNfcm93ICAgICA9IE5VTEw7CisgICAgICAgIHZpZGVvLT5wcmVkRENBQ19jb2wgICAgID0gTlVMTDsKKyAgICAgICAgdmlkZW8tPmhlYWRlckluZm8uTW9kZSAgPSBOVUxMOworICAgICAgICB2aWRlby0+aGVhZGVySW5mby5DQlAgICA9IE5VTEw7CisgICAgICAgIGlmICh2aWRlby0+bnVtYmVyT2ZMYXllcnMgPiAxKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAodmlkZW8tPnByZXZFbmhjVm9wKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZpZGVvLT5wcmV2RW5oY1ZvcC0+dUNoYW4gPSBOVUxMOworICAgICAgICAgICAgICAgIHZpZGVvLT5wcmV2RW5oY1ZvcC0+dkNoYW4gPSBOVUxMOworICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cHJldkVuaGNWb3AtPnlDaGFuKSBvc2NsX2ZyZWUodmlkZW8tPnByZXZFbmhjVm9wLT55Q2hhbik7CisgICAgICAgICAgICAgICAgb3NjbF9mcmVlKHZpZGVvLT5wcmV2RW5oY1ZvcCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKHZpZGVvLT5jdXJyVm9wKQorICAgICAgICB7CisgICAgICAgICAgICB2aWRlby0+Y3VyclZvcC0+dUNoYW4gPSBOVUxMOworICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnZDaGFuID0gTlVMTDsKKyAgICAgICAgICAgIGlmICh2aWRlby0+Y3VyclZvcC0+eUNoYW4pCisgICAgICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnlDaGFuID0gTlVMTDsKKyAgICAgICAgICAgIHZpZGVvLT5jdXJyVm9wID0gTlVMTDsKKyAgICAgICAgfQorICAgICAgICBpZiAodmlkZW8tPnByZXZWb3ApCisgICAgICAgIHsKKyAgICAgICAgICAgIHZpZGVvLT5wcmV2Vm9wLT51Q2hhbiA9IE5VTEw7CisgICAgICAgICAgICB2aWRlby0+cHJldlZvcC0+dkNoYW4gPSBOVUxMOworICAgICAgICAgICAgaWYgKHZpZGVvLT5wcmV2Vm9wLT55Q2hhbikKKyAgICAgICAgICAgICAgICB2aWRlby0+cHJldlZvcC0+eUNoYW4gPSBOVUxMOworICAgICAgICAgICAgdmlkZW8tPnByZXZWb3AgPSBOVUxMOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHZpZGVvLT52b2wpCisgICAgICAgIHsKKyAgICAgICAgICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgdmlkZW8tPm51bWJlck9mTGF5ZXJzOyBpZHgrKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnZvbFtpZHhdKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtQ2xvc2UodmlkZW8tPnZvbFtpZHhdLT5iaXRzdHJlYW0pOworICAgICAgICAgICAgICAgICAgICB2aWRlby0+dm9sW2lkeF0tPmJpdHN0cmVhbSA9IE5VTEw7CisgICAgICAgICAgICAgICAgICAgIHZpZGVvLT52b2xbaWR4XSA9IE5VTEw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHZpZGVvLT52b3BIZWFkZXJbaWR4XSA9IE5VTEw7CisKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZpZGVvLT52b2wgPSBOVUxMOworICAgICAgICAgICAgdmlkZW8tPnZvcEhlYWRlciA9IE5VTEw7CisgICAgICAgIH0KKworICAgICAgICB2aWRlbyA9IE5VTEw7CisgICAgICAgIGRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGEgPSBOVUxMOworICAgIH0KKworI2Vsc2UKKworICAgIGlmICh2aWRlbykKKyAgICB7CisgICAgICAgIGlmICh2aWRlby0+cHJlZERDKSBvc2NsX2ZyZWUodmlkZW8tPnByZWREQyk7CisgICAgICAgIHZpZGVvLT5wcmVkRENBQ19yb3cgPSBOVUxMOworICAgICAgICBpZiAodmlkZW8tPnByZWREQ0FDX2NvbCkgb3NjbF9mcmVlKHZpZGVvLT5wcmVkRENBQ19jb2wpOworICAgICAgICBpZiAodmlkZW8tPm1vdFgpIG9zY2xfZnJlZSh2aWRlby0+bW90WCk7CisgICAgICAgIGlmICh2aWRlby0+bW90WSkgb3NjbF9mcmVlKHZpZGVvLT5tb3RZKTsKKyAgICAgICAgaWYgKHZpZGVvLT5tYmxvY2spIG9zY2xfZnJlZSh2aWRlby0+bWJsb2NrKTsKKyAgICAgICAgaWYgKHZpZGVvLT5RUE1CKSBvc2NsX2ZyZWUodmlkZW8tPlFQTUIpOworICAgICAgICBpZiAodmlkZW8tPmhlYWRlckluZm8uTW9kZSkgb3NjbF9mcmVlKHZpZGVvLT5oZWFkZXJJbmZvLk1vZGUpOworICAgICAgICBpZiAodmlkZW8tPmhlYWRlckluZm8uQ0JQKSBvc2NsX2ZyZWUodmlkZW8tPmhlYWRlckluZm8uQ0JQKTsKKyAgICAgICAgaWYgKHZpZGVvLT5zbGljZU5vKSBvc2NsX2ZyZWUodmlkZW8tPnNsaWNlTm8pOworICAgICAgICBpZiAodmlkZW8tPmFjUHJlZEZsYWcpIG9zY2xfZnJlZSh2aWRlby0+YWNQcmVkRmxhZyk7CisKKyAgICAgICAgaWYgKHZpZGVvLT5udW1iZXJPZkxheWVycyA+IDEpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICh2aWRlby0+cHJldkVuaGNWb3ApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmlkZW8tPnByZXZFbmhjVm9wLT51Q2hhbiA9IE5VTEw7CisgICAgICAgICAgICAgICAgdmlkZW8tPnByZXZFbmhjVm9wLT52Q2hhbiA9IE5VTEw7CisgICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5wcmV2RW5oY1ZvcC0+eUNoYW4pIG9zY2xfZnJlZSh2aWRlby0+cHJldkVuaGNWb3AtPnlDaGFuKTsKKyAgICAgICAgICAgICAgICBvc2NsX2ZyZWUodmlkZW8tPnByZXZFbmhjVm9wKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAodmlkZW8tPmN1cnJWb3ApCisgICAgICAgIHsKKworI2lmbmRlZiBQVl9NRU1PUllfUE9PTAorICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnVDaGFuID0gTlVMTDsKKyAgICAgICAgICAgIHZpZGVvLT5jdXJyVm9wLT52Q2hhbiA9IE5VTEw7CisgICAgICAgICAgICBpZiAodmlkZW8tPmN1cnJWb3AtPnlDaGFuKQorICAgICAgICAgICAgICAgIG9zY2xfZnJlZSh2aWRlby0+Y3VyclZvcC0+eUNoYW4pOworI2VuZGlmCisgICAgICAgICAgICBvc2NsX2ZyZWUodmlkZW8tPmN1cnJWb3ApOworICAgICAgICB9CisgICAgICAgIGlmICh2aWRlby0+cHJldlZvcCkKKyAgICAgICAgeworI2lmbmRlZiBQVl9NRU1PUllfUE9PTAorICAgICAgICAgICAgdmlkZW8tPnByZXZWb3AtPnVDaGFuID0gTlVMTDsKKyAgICAgICAgICAgIHZpZGVvLT5wcmV2Vm9wLT52Q2hhbiA9IE5VTEw7CisgICAgICAgICAgICBpZiAodmlkZW8tPnByZXZWb3AtPnlDaGFuKQorICAgICAgICAgICAgICAgIG9zY2xfZnJlZSh2aWRlby0+cHJldlZvcC0+eUNoYW4pOworI2VuZGlmCisgICAgICAgICAgICBvc2NsX2ZyZWUodmlkZW8tPnByZXZWb3ApOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHZpZGVvLT52b2wpCisgICAgICAgIHsKKyAgICAgICAgICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgdmlkZW8tPm51bWJlck9mTGF5ZXJzOyBpZHgrKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnZvbFtpZHhdKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHZpZGVvLT52b2xbaWR4XS0+Yml0c3RyZWFtKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBCaXRzdHJlYW1DbG9zZSh2aWRlby0+dm9sW2lkeF0tPmJpdHN0cmVhbSk7CisgICAgICAgICAgICAgICAgICAgICAgICBvc2NsX2ZyZWUodmlkZW8tPnZvbFtpZHhdLT5iaXRzdHJlYW0pOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIG9zY2xfZnJlZSh2aWRlby0+dm9sW2lkeF0pOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgfQorICAgICAgICAgICAgb3NjbF9mcmVlKHZpZGVvLT52b2wpOworICAgICAgICB9CisKKyAgICAgICAgZm9yIChpZHggPSAwOyBpZHggPCB2aWRlby0+bnVtYmVyT2ZMYXllcnM7IGlkeCsrKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAodmlkZW8tPnZvcEhlYWRlcltpZHhdKSBvc2NsX2ZyZWUodmlkZW8tPnZvcEhlYWRlcltpZHhdKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICh2aWRlby0+dm9wSGVhZGVyKSBvc2NsX2ZyZWUodmlkZW8tPnZvcEhlYWRlcik7CisKKyAgICAgICAgb3NjbF9mcmVlKHZpZGVvKTsKKyAgICAgICAgZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YSA9IE5VTEw7CisgICAgfQorI2VuZGlmCisgICAgcmV0dXJuIFBWX1RSVUU7Cit9CisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFBWR2V0VmlkZW9EaW1lbnNpb25zKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDQwNTA1ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogdGhlIGRpc3BsYXlfd2lkdGggYW5kIGRpc3BsYXlfaGVpZ2h0IG9mICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICB0aGUgZnJhbWUgaW4gdGhlIGN1cnJlbnQgbGF5ZXIuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBOb3RlICAgICA6IFRoaXMgaXMgbm90IGEgbWFjcm8gb3IgaW5saW5lIGZ1bmN0aW9uIGJlY2F1c2Ugd2UgZG8gICAgICAgICAqLworLyogICAgICAgICAgICAgIG5vdCB3YW50IHRvIGV4cG9zZSBvdXIgaW50ZXJuYWwgZGF0YSBzdHJ1Y3R1cmUuICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworT1NDTF9FWFBPUlRfUkVGIHZvaWQgUFZHZXRWaWRlb0RpbWVuc2lvbnMoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgaW50MzIgKmRpc3BsYXlfd2lkdGgsIGludDMyICpkaXNwbGF5X2hlaWdodCkKK3sKKyAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKWRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGE7CisgICAgKmRpc3BsYXlfd2lkdGggPSB2aWRlby0+ZGlzcGxheVdpZHRoOworICAgICpkaXNwbGF5X2hlaWdodCA9IHZpZGVvLT5kaXNwbGF5SGVpZ2h0OworfQorCitPU0NMX0VYUE9SVF9SRUYgdm9pZCBQVkdldEJ1ZmZlckRpbWVuc2lvbnMoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgaW50MzIgKndpZHRoLCBpbnQzMiAqaGVpZ2h0KSB7CisgICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKilkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhOworICAgICp3aWR0aCA9IHZpZGVvLT53aWR0aDsKKyAgICAqaGVpZ2h0ID0gdmlkZW8tPmhlaWdodDsKK30KKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkdldFZpZGVvVGltZVN0YW1wKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA0LzI3LzIwMDAsIDA4LzI5LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IGN1cnJlbnQgdGltZSBzdGFtcCBpbiBtaWxsaXNlY29uZC4gICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwordWludDMyIFBWR2V0VmlkZW9UaW1lU3RhbXAoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCkKK3sKKyAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKWRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGE7CisgICAgcmV0dXJuIHZpZGVvLT5jdXJyVGltZXN0YW1wOworfQorCisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogUFZTZXRQb3N0UHJvY1R5cGUoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRGF0ZSAgICAgOiAwNy8wNy8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiBTZXQgcG9zdC1wcm9jZXNzaW5nIGZpbHRlciB0eXBlLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBOb3RlICAgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogLiAwOC8yOS8yMDAwIGNoYW5nZXMgdGhlIG5hbWUgZm9yIGNvbnNpc3RlbmN5LiAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK09TQ0xfRVhQT1JUX1JFRiB2b2lkIFBWU2V0UG9zdFByb2NUeXBlKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwsIGludCBtb2RlKQoreworICAgIFZpZGVvRGVjRGF0YSAqdmlkZW8gPSAoVmlkZW9EZWNEYXRhICopZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKKyAgICBpZiAobW9kZSAhPSAwKSB7CisgICAgICAgIEFMT0dFKCJQb3N0IHByb2Nlc3NpbmcgZmlsdGVycyBhcmUgbm90IHN1cHBvcnRlZCIpOworICAgIH0KKyAgICB2aWRlby0+cG9zdEZpbHRlclR5cGUgPSAwOworfQorCisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogUFZHZXREZWNCaXRyYXRlKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRGF0ZSAgICAgOiAwOC8yMy8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiBUaGlzIGZ1bmN0aW9uIHJldHVybnMgdGhlIGF2ZXJhZ2UgYml0cyBwZXIgc2Vjb25kLiAgICAgICAgICAgKi8KKy8qICBOb3RlICAgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK2ludCBQVkdldERlY0JpdHJhdGUoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCkKK3sKKyAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKWRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGE7CisgICAgaW50ICAgICBpZHg7CisgICAgaW50MzIgICBzdW0gPSAwOworCisgICAgZm9yIChpZHggPSAwOyBpZHggPCBCSVRSQVRFX0FWRVJBR0VfV0lORE9XOyBpZHgrKykKKyAgICB7CisgICAgICAgIHN1bSArPSB2aWRlby0+bkJpdHNQZXJWb3BbaWR4XTsKKyAgICB9CisgICAgc3VtID0gKHN1bSAqIHZpZGVvLT5mcmFtZVJhdGUpIC8gKDEwICogQklUUkFURV9BVkVSQUdFX1dJTkRPVyk7CisgICAgcmV0dXJuIChpbnQpIHN1bTsKK30KKworCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFBWR2V0RGVjRnJhbWVyYXRlKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDgvMjMvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogVGhpcyBmdW5jdGlvbiByZXR1cm5zIHRoZSBhdmVyYWdlIGZyYW1lIHBlciAxMCBzZWNvbmQuICAgICAgICovCisvKiAgTm90ZSAgICAgOiBUaGUgZnBzIGNhbiBiZSBjYWxjdWxhdGVkIGJ5IFBWR2V0RGVjRnJhbWVyYXRlKCkvMTAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitpbnQgUFZHZXREZWNGcmFtZXJhdGUoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCkKK3sKKyAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKWRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGE7CisKKyAgICByZXR1cm4gdmlkZW8tPmZyYW1lUmF0ZTsKK30KKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkdldE91dHB1dEZyYW1lKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA1LzA3LzIwMDEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFRoaXMgZnVuY3Rpb24gcmV0dXJucyB0aGUgcG9pbnRlciB0byB0aGUgb3V0cHV0IGZyYW1lICAgICAgICAqLworLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwordWludDggKlBWR2V0RGVjT3V0cHV0RnJhbWUoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCkKK3sKKyAgICByZXR1cm4gZGVjQ3RybC0+b3V0cHV0RnJhbWU7Cit9CisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogUFZHZXRMYXllcklEKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRGF0ZSAgICAgOiAwNy8wOS8yMDAxICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiBUaGlzIGZ1bmN0aW9uIHJldHVybnMgZGVjb2RlZCBmcmFtZSBsYXllciBpZCAoQkFTRS9FTkhBTkNFKSAgKi8KKy8qICBOb3RlICAgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK2ludCBQVkdldExheWVySUQoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCkKK3sKKyAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKWRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGE7CisgICAgcmV0dXJuIHZpZGVvLT5jdXJyTGF5ZXI7Cit9CisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFBWR2V0RGVjTWVtb3J5VXNhZ2UoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDgvMjMvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogVGhpcyBmdW5jdGlvbiByZXR1cm5zIHRoZSBhbW91bnQgb2YgbWVtb3J5IHVzZWQuICAgICAgICAgICAgICovCisvKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitpbnQzMiBQVkdldERlY01lbW9yeVVzYWdlKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwpCit7CisgICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKilkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhOworICAgIHJldHVybiB2aWRlby0+bWVtb3J5VXNhZ2U7Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkdldERlY0JpdHN0cmVhbU1vZGUoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA4LzIzLzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFRoaXMgZnVuY3Rpb24gcmV0dXJucyB0aGUgZGVjb2RpbmcgbW9kZSBvZiB0aGUgYmFzZWxheWVyICAgICAqLworLyogICAgICAgICAgICAgIGJpdHN0cmVhbS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitPU0NMX0VYUE9SVF9SRUYgTVA0RGVjb2RpbmdNb2RlIFBWR2V0RGVjQml0c3RyZWFtTW9kZShWaWRlb0RlY0NvbnRyb2xzICpkZWNDdHJsKQoreworICAgIFZpZGVvRGVjRGF0YSAqdmlkZW8gPSAoVmlkZW9EZWNEYXRhICopZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKKyAgICBpZiAodmlkZW8tPnNob3J0VmlkZW9IZWFkZXIpCisgICAgeworICAgICAgICByZXR1cm4gSDI2M19NT0RFOworICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICByZXR1cm4gTVBFRzRfTU9ERTsKKyAgICB9Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkV4dHJhY3RWb2xIZWFkZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA4LzI5LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IEV4dHJhY3Qgdm9sIGhlYWRlciBvZiB0aGUgYml0c3RyZWFtIGZyb20gYnVmZmVyW10uICAgICAgICAgICAqLworLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworQm9vbCBQVkV4dHJhY3RWb2xIZWFkZXIodWludDggKnZpZGVvX2J1ZmZlciwgdWludDggKnZvbF9oZWFkZXIsIGludDMyICp2b2xfaGVhZGVyX3NpemUpCit7CisgICAgaW50IGlkeCA9IC0xOworICAgIHVpbnQ4IHN0YXJ0X2NvZGVfcHJlZml4W10gPSB7IDB4MDAsIDB4MDAsIDB4MDEgfTsKKyAgICB1aW50OCBoMjYzX3ByZWZpeFtdID0geyAweDAwLCAweDAwLCAweDgwIH07CisKKyAgICBpZiAob3NjbF9tZW1jbXAoaDI2M19wcmVmaXgsIHZpZGVvX2J1ZmZlciwgMykgPT0gMCkgLyogd2UgaGF2ZSBzaG9ydCBoZWFkZXIgc3RyZWFtICovCisgICAgeworICAgICAgICBvc2NsX21lbWNweSh2b2xfaGVhZGVyLCB2aWRlb19idWZmZXIsIDMyKTsKKyAgICAgICAgKnZvbF9oZWFkZXJfc2l6ZSA9IDMyOworICAgICAgICByZXR1cm4gVFJVRTsKKyAgICB9CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgaWYgKG9zY2xfbWVtY21wKHN0YXJ0X2NvZGVfcHJlZml4LCB2aWRlb19idWZmZXIsIDMpIHx8CisgICAgICAgICAgICAgICAgKHZpZGVvX2J1ZmZlclszXSAhPSAweGIwICYmIHZpZGVvX2J1ZmZlclszXSA+PSAweDIwKSkgcmV0dXJuIEZBTFNFOworCisgICAgICAgIGRvCisgICAgICAgIHsKKyAgICAgICAgICAgIGlkeCsrOworICAgICAgICAgICAgd2hpbGUgKG9zY2xfbWVtY21wKHN0YXJ0X2NvZGVfcHJlZml4LCB2aWRlb19idWZmZXIgKyBpZHgsIDMpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlkeCsrOworICAgICAgICAgICAgICAgIGlmIChpZHggKyAzID49ICp2b2xfaGVhZGVyX3NpemUpIGdvdG8gcXVpdDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB3aGlsZSAodmlkZW9fYnVmZmVyW2lkeCszXSAhPSAweGIzICYmIHZpZGVvX2J1ZmZlcltpZHgrM10gIT0gMHhiNik7CisKKyAgICAgICAgb3NjbF9tZW1jcHkodm9sX2hlYWRlciwgdmlkZW9fYnVmZmVyLCBpZHgpOworICAgICAgICAqdm9sX2hlYWRlcl9zaXplID0gaWR4OworICAgICAgICByZXR1cm4gVFJVRTsKKyAgICB9CisKK3F1aXQ6CisgICAgb3NjbF9tZW1jcHkodm9sX2hlYWRlciwgdmlkZW9fYnVmZmVyLCAqdm9sX2hlYWRlcl9zaXplKTsKKyAgICByZXR1cm4gRkFMU0U7Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkxvY2F0ZUZyYW1lSGVhZGVyKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA0LzgvMjAwNSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFJldHVybiB0aGUgb2Zmc2V0IHRvIHRoZSBmaXJzdCBTQyBpbiB0aGUgYnVmZmVyICAgICAgICAgICAgICAqLworLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworaW50MzIgUFZMb2NhdGVGcmFtZUhlYWRlcih1aW50OCAqcHRyLCBpbnQzMiBzaXplKQoreworICAgIGludCBjb3VudCA9IDA7CisgICAgaW50MzIgaSA9IHNpemU7CisKKyAgICBpZiAoc2l6ZSA8IDEpCisgICAgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisgICAgd2hpbGUgKGktLSkKKyAgICB7CisgICAgICAgIGlmICgoY291bnQgPiAxKSAmJiAoKnB0ciA9PSAweDAxKSkKKyAgICAgICAgeworICAgICAgICAgICAgaSArPSAyOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBpZiAoKnB0cisrKQorICAgICAgICAgICAgY291bnQgPSAwOworICAgICAgICBlbHNlCisgICAgICAgICAgICBjb3VudCsrOworICAgIH0KKyAgICByZXR1cm4gKHNpemUgLSAoaSArIDEpKTsKK30KKworCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFBWTG9jYXRlSDI2M0ZyYW1lSGVhZGVyKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDQvOC8yMDA1ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUmV0dXJuIHRoZSBvZmZzZXQgdG8gdGhlIGZpcnN0IFNDIGluIHRoZSBidWZmZXIgICAgICAgICAgICAgICovCisvKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitpbnQzMiBQVkxvY2F0ZUgyNjNGcmFtZUhlYWRlcih1aW50OCAqcHRyLCBpbnQzMiBzaXplKQoreworICAgIGludCBjb3VudCA9IDA7CisgICAgaW50MzIgaSA9IHNpemU7CisKKyAgICBpZiAoc2l6ZSA8IDEpCisgICAgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICB3aGlsZSAoaS0tKQorICAgIHsKKyAgICAgICAgaWYgKChjb3VudCA+IDEpICYmICgoKnB0ciAmIDB4RkMpID09IDB4ODApKQorICAgICAgICB7CisgICAgICAgICAgICBpICs9IDI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIGlmICgqcHRyKyspCisgICAgICAgICAgICBjb3VudCA9IDA7CisgICAgICAgIGVsc2UKKyAgICAgICAgICAgIGNvdW50Kys7CisgICAgfQorICAgIHJldHVybiAoc2l6ZSAtIChpICsgMSkpOworfQorCisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogUFZEZWNvZGVWaWRlb0ZyYW1lKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRGF0ZSAgICAgOiAwOC8yOS8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6IERlY29kZSBvbmUgdmlkZW8gZnJhbWUgYW5kIHJldHVybiBhIFlVVi0xMiBpbWFnZS4gICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBOb3RlICAgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogMDQvMTcvMjAwMSByZW1vdmVkIFBWX0VPUywgUFZfRU5EX09GX0JVRkZFUiAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICA6IDA4LzIyLzIwMDIgYnJlYWsgdXAgaW50byAyIGZ1bmN0aW9ucyBQVkRlY29kZVZvcEhlYWRlciBhbmQgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICBQVkRlY29kZVZvcEJvZHkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitPU0NMX0VYUE9SVF9SRUYgQm9vbCBQVkRlY29kZVZpZGVvRnJhbWUoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgdWludDggKmJ1ZmZlcltdLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMiB0aW1lc3RhbXBbXSwgaW50MzIgYnVmZmVyX3NpemVbXSwgdWludCB1c2VfZXh0X3RpbWVzdGFtcFtdLCB1aW50OCAqY3VycllVVikKK3sKKyAgICBQVl9TVEFUVVMgc3RhdHVzID0gUFZfRkFJTDsKKyAgICBWb3BIZWFkZXJJbmZvIGhlYWRlcl9pbmZvOworCisgICAgc3RhdHVzID0gKFBWX1NUQVRVUylQVkRlY29kZVZvcEhlYWRlcihkZWNDdHJsLCBidWZmZXIsIHRpbWVzdGFtcCwgYnVmZmVyX3NpemUsICZoZWFkZXJfaW5mbywgdXNlX2V4dF90aW1lc3RhbXAsIGN1cnJZVVYpOworICAgIGlmIChzdGF0dXMgIT0gUFZfVFJVRSkKKyAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOworCisgICAgaWYgKFBWRGVjb2RlVm9wQm9keShkZWNDdHJsLCBidWZmZXJfc2l6ZSkgIT0gUFZfVFJVRSkKKyAgICB7CisgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKyAgICB9CisKKyAgICByZXR1cm4gUFZfVFJVRTsKK30KKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkRlY29kZVZvcEhlYWRlcigpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA4LzIyLzIwMDIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogRGV0ZXJtaW5lIHRhcmdldCBsYXllciBhbmQgZGVjb2RlIHZvcCBoZWFkZXIsIG1vZGlmaWVkIGZyb20gICovCisvKiAgICAgICAgICAgICAgb3JpZ2luYWwgUFZEZWNvZGVWaWRlb0ZyYW1lLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitCb29sIFBWRGVjb2RlVm9wSGVhZGVyKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwsIHVpbnQ4ICpidWZmZXJbXSwKKyAgICAgICAgICAgICAgICAgICAgICAgdWludDMyIHRpbWVzdGFtcFtdLCBpbnQzMiBidWZmZXJfc2l6ZVtdLCBWb3BIZWFkZXJJbmZvICpoZWFkZXJfaW5mbywgdWludCB1c2VfZXh0X3RpbWVzdGFtcCBbXSwgdWludDggKmN1cnJZVVYpCit7CisgICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKikgZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKKyAgICBWb2wgKmN1cnJWb2w7CisgICAgVm9wICpjdXJyVm9wID0gdmlkZW8tPmN1cnJWb3A7CisgICAgVm9wICoqdm9wSGVhZGVyID0gdmlkZW8tPnZvcEhlYWRlcjsKKyAgICBCaXRzdHJlYW1EZWNWaWRlbyAqc3RyZWFtOworCisgICAgaW50IHRhcmdldF9sYXllcjsKKworI2lmZGVmIFBWX1NVUFBPUlRfVEVNUE9SQUxfU0NBTEFCSUxJVFkKKyAgICBQVl9TVEFUVVMgc3RhdHVzID0gUFZfRkFJTDsKKyAgICBpbnQgaWR4OworICAgIGludDMyIGRpc3BsYXlfdGltZTsKKworICAgIC8qIGRlY2lkZSB3aGljaCBmcmFtZSB0byBkZWNvZGUgbmV4dCAqLworICAgIGlmIChkZWNDdHJsLT5uTGF5ZXJzID4gMSkKKyAgICB7CisgICAgICAgIGRpc3BsYXlfdGltZSA9IHRhcmdldF9sYXllciA9IC0xOworICAgICAgICBmb3IgKGlkeCA9IDA7IGlkeCA8IGRlY0N0cmwtPm5MYXllcnM7IGlkeCsrKQorICAgICAgICB7CisgICAgICAgICAgICAvKiBkbyB3ZSBoYXZlIGRhdGEgZm9yIHRoaXMgbGF5ZXI/ICovCisgICAgICAgICAgICBpZiAoYnVmZmVyX3NpemVbaWR4XSA8PSAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRpbWVzdGFtcFtpZHhdID0gLTE7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8qIGRpZCB0aGUgYXBwbGljYXRpb24gcHJvdmlkZSBhIHRpbWVzdGFtcCBmb3IgdGhpcyB2b3A/ICovCisgICAgICAgICAgICBpZiAodGltZXN0YW1wW2lkeF0gPCAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmICh2b3BIZWFkZXJbaWR4XS0+dGltZVN0YW1wIDwgMCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIC8qIGRlY29kZSB0aGUgdGltZXN0YW1wIGluIHRoZSBiaXRzdHJlYW0gKi8KKyAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmN1cnJMYXllciA9IGlkeDsKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtID0gdmlkZW8tPnZvbFtpZHhdLT5iaXRzdHJlYW07CisgICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlc2V0KHN0cmVhbSwgYnVmZmVyW2lkeF0sIGJ1ZmZlcl9zaXplW2lkeF0pOworCisgICAgICAgICAgICAgICAgICAgIHdoaWxlICgoc3RhdHVzID0gRGVjb2RlVk9QSGVhZGVyKHZpZGVvLCB2b3BIZWFkZXJbaWR4XSwgRkFMU0UpKSAhPSBQVl9TVUNDRVNTKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAvKiBUcnkgdG8gZmluZCBhIFZPUCBoZWFkZXIgaW4gdGhlIGJ1ZmZlci4gICAwOC8zMC8yMDAwLiAqLworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFBWU2VhcmNoTmV4dE00VkZyYW1lKHN0cmVhbSkgIT0gUFZfU1VDQ0VTUykKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBpZiB3ZSBkb24ndCBoYXZlIGRhdGEgZm9yIGVuaGFuY2VtZW50IGxheWVyLCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qICAgIGRvbid0IGp1c3Qgc3RvcC4gICAwOS8wNy8yMDAwLiAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlcl9zaXplW2lkeF0gPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gUFZfU1VDQ0VTUykKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdm9wSGVhZGVyW2lkeF0tPnRpbWVTdGFtcCA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZXN0YW1wW2lkeF0gPSBDYWxjVm9wRGlzcGxheVRpbWUodmlkZW8tPnZvbFtpZHhdLCB2b3BIZWFkZXJbaWR4XSwgdmlkZW8tPnNob3J0VmlkZW9IZWFkZXIpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlkeCA9PSAwKSB2b3BIZWFkZXJbaWR4XS0+cmVmU2VsZWN0Q29kZSA9IDE7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLyogV2UndmUgZGVjb2RlZCB0aGlzIHZvcCBoZWFkZXIgaW4gdGhlIHByZXZpb3VzIHJ1biBhbHJlYWR5LiAqLworICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXBbaWR4XSA9IHZvcEhlYWRlcltpZHhdLT50aW1lU3RhbXA7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvKiBVc2UgdGltZXN0YW1wcyB0byBzZWxlY3QgdGhlIG5leHQgVk9QIHRvIGJlIGRlY29kZWQgKi8KKyAgICAgICAgICAgIGlmICh0aW1lc3RhbXBbaWR4XSA+PSAwICYmIChkaXNwbGF5X3RpbWUgPCAwIHx8IGRpc3BsYXlfdGltZSA+IHRpbWVzdGFtcFtpZHhdKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBkaXNwbGF5X3RpbWUgPSB0aW1lc3RhbXBbaWR4XTsKKyAgICAgICAgICAgICAgICB0YXJnZXRfbGF5ZXIgPSBpZHg7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmIChkaXNwbGF5X3RpbWUgPT0gdGltZXN0YW1wW2lkeF0pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLyogd2UgaGF2ZSB0byBoYW5kbGUgZWl0aGVyIFNOUiBvciBzcGF0aWFsIHNjYWxhYmlsaXR5IGhlcmUuICovCisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKHRhcmdldF9sYXllciA8IDApIHJldHVybiBQVl9GQUxTRTsKKworICAgICAgICAvKiBzZXQgdXAgZm9yIGRlY29kaW5nIHRoZSB0YXJnZXQgbGF5ZXIgKi8KKyAgICAgICAgdmlkZW8tPmN1cnJMYXllciA9IHRhcmdldF9sYXllcjsKKyAgICAgICAgY3VyclZvbCA9IHZpZGVvLT52b2xbdGFyZ2V0X2xheWVyXTsKKyAgICAgICAgdmlkZW8tPmJpdHN0cmVhbSA9IHN0cmVhbSA9IGN1cnJWb2wtPmJpdHN0cmVhbTsKKworICAgICAgICAvKiBXZSBuZWVkIHRvIGRlY29kZSB0aGUgdm9wIGhlYWRlciBpZiBleHRlcm5hbCB0aW1lc3RhbXAgICAqLworICAgICAgICAvKiAgICBpcyBwcm92aWRlZC4gICAgMTAvMDQvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICBpZiAodm9wSGVhZGVyW3RhcmdldF9sYXllcl0tPnRpbWVTdGFtcCA8IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIHN0cmVhbSA9IHZpZGVvLT52b2xbdGFyZ2V0X2xheWVyXS0+Yml0c3RyZWFtOworICAgICAgICAgICAgQml0c3RyZWFtUmVzZXQoc3RyZWFtLCBidWZmZXJbdGFyZ2V0X2xheWVyXSwgYnVmZmVyX3NpemVbdGFyZ2V0X2xheWVyXSk7CisKKyAgICAgICAgICAgIHdoaWxlIChEZWNvZGVWT1BIZWFkZXIodmlkZW8sIHZvcEhlYWRlclt0YXJnZXRfbGF5ZXJdLCBUUlVFKSAhPSBQVl9TVUNDRVNTKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8qIFRyeSB0byBmaW5kIGEgVk9QIGhlYWRlciBpbiB0aGUgYnVmZmVyLiAgIDA4LzMwLzIwMDAuICovCisgICAgICAgICAgICAgICAgaWYgKFBWU2VhcmNoTmV4dE00VkZyYW1lKHN0cmVhbSkgIT0gUFZfU1VDQ0VTUykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIC8qIGlmIHdlIGRvbid0IGhhdmUgZGF0YSBmb3IgZW5oYW5jZW1lbnQgbGF5ZXIsICovCisgICAgICAgICAgICAgICAgICAgIC8qICAgIGRvbid0IGp1c3Qgc3RvcC4gICAwOS8wNy8yMDAwLiAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICBidWZmZXJfc2l6ZVt0YXJnZXRfbGF5ZXJdID0gMDsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgdmlkZW8tPnZvbFt0YXJnZXRfbGF5ZXJdLT50aW1lSW5jX29mZnNldCA9IHZvcEhlYWRlclt0YXJnZXRfbGF5ZXJdLT50aW1lSW5jOworICAgICAgICAgICAgdmlkZW8tPnZvbFt0YXJnZXRfbGF5ZXJdLT5tb2R1bG9UaW1lQmFzZSA9IHRpbWVzdGFtcFt0YXJnZXRfbGF5ZXJdOworICAgICAgICAgICAgdm9wSGVhZGVyW3RhcmdldF9sYXllcl0tPnRpbWVTdGFtcCA9IHRpbWVzdGFtcFt0YXJnZXRfbGF5ZXJdOworICAgICAgICAgICAgaWYgKHRhcmdldF9sYXllciA9PSAwKSB2b3BIZWFkZXJbdGFyZ2V0X2xheWVyXS0+cmVmU2VsZWN0Q29kZSA9IDE7CisgICAgICAgIH0KKyAgICB9CisgICAgZWxzZSAvKiBiYXNlIGxheWVyIG9ubHkgZGVjb2RpbmcgKi8KKyAgICB7CisjZW5kaWYKKyAgICAgICAgdmlkZW8tPmN1cnJMYXllciA9IHRhcmdldF9sYXllciA9IDA7CisgICAgICAgIGN1cnJWb2wgPSB2aWRlby0+dm9sWzBdOworICAgICAgICB2aWRlby0+Yml0c3RyZWFtID0gc3RyZWFtID0gY3VyclZvbC0+Yml0c3RyZWFtOworICAgICAgICBpZiAoYnVmZmVyX3NpemVbMF0gPD0gMCkgcmV0dXJuIFBWX0ZBTFNFOworICAgICAgICBCaXRzdHJlYW1SZXNldChzdHJlYW0sIGJ1ZmZlclswXSwgYnVmZmVyX3NpemVbMF0pOworCisgICAgICAgIGlmICh2aWRlby0+c2hvcnRWaWRlb0hlYWRlcikKKyAgICAgICAgeworICAgICAgICAgICAgd2hpbGUgKERlY29kZVNob3J0SGVhZGVyKHZpZGVvLCB2b3BIZWFkZXJbMF0pICE9IFBWX1NVQ0NFU1MpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKFBWU2VhcmNoTmV4dEgyNjNGcmFtZShzdHJlYW0pICE9IFBWX1NVQ0NFU1MpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAvKiBUaGVyZSBpcyBubyB2b3AgaGVhZGVyIGluIHRoZSBidWZmZXIsICAgICovCisgICAgICAgICAgICAgICAgICAgIC8qICAgY2xlYW4gYml0c3RyZWFtIGJ1ZmZlci4gICAgIDIvNS8yMDAxICAgKi8KKyAgICAgICAgICAgICAgICAgICAgYnVmZmVyX3NpemVbMF0gPSAwOworICAgICAgICAgICAgICAgICAgICBpZiAodmlkZW8tPmluaXRpYWxpemVkID09IFBWX0ZBTFNFKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gdmlkZW8tPndpZHRoID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gdmlkZW8tPmhlaWdodCA9IDA7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKHVzZV9leHRfdGltZXN0YW1wWzBdKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8qIE1UQiBmb3IgSDI2MyBpcyBhYnNvbHV0ZSBUUiAqLworICAgICAgICAgICAgICAgIC8qIGZvbGxvd2luZyBsaW5lIGlzIGVxdWl2YWxlbnQgdG8gIHJvdW5kKCh0aW1lc3RhbXBbMF0qMzApLzEwMDEpOyAgIDExLzEzLzIwMDEgKi8KKyAgICAgICAgICAgICAgICB2aWRlby0+dm9sWzBdLT5tb2R1bG9UaW1lQmFzZSA9IDMwICogKCh0aW1lc3RhbXBbMF0gKyAxNykgLyAxMDAxKSArICgzMCAqICgodGltZXN0YW1wWzBdICsgMTcpICUgMTAwMSkgLyAxMDAxKTsKKyAgICAgICAgICAgICAgICB2b3BIZWFkZXJbMF0tPnRpbWVTdGFtcCA9IHRpbWVzdGFtcFswXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB2b3BIZWFkZXJbMF0tPnRpbWVTdGFtcCA9IENhbGNWb3BEaXNwbGF5VGltZShjdXJyVm9sLCB2b3BIZWFkZXJbMF0sIHZpZGVvLT5zaG9ydFZpZGVvSGVhZGVyKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHdoaWxlIChEZWNvZGVWT1BIZWFkZXIodmlkZW8sIHZvcEhlYWRlclswXSwgRkFMU0UpICE9IFBWX1NVQ0NFU1MpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLyogVHJ5IHRvIGZpbmQgYSBWT1AgaGVhZGVyIGluIHRoZSBidWZmZXIuICAgMDgvMzAvMjAwMC4gKi8KKyAgICAgICAgICAgICAgICBpZiAoUFZTZWFyY2hOZXh0TTRWRnJhbWUoc3RyZWFtKSAhPSBQVl9TVUNDRVNTKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLyogVGhlcmUgaXMgbm8gdm9wIGhlYWRlciBpbiB0aGUgYnVmZmVyLCAgICAqLworICAgICAgICAgICAgICAgICAgICAvKiAgIGNsZWFuIGJpdHN0cmVhbSBidWZmZXIuICAgICAyLzUvMjAwMSAgICovCisgICAgICAgICAgICAgICAgICAgIGJ1ZmZlcl9zaXplWzBdID0gMDsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKHVzZV9leHRfdGltZXN0YW1wWzBdKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZpZGVvLT52b2xbMF0tPnRpbWVJbmNfb2Zmc2V0ID0gdm9wSGVhZGVyWzBdLT50aW1lSW5jOworICAgICAgICAgICAgICAgIHZpZGVvLT52b2xbMF0tPm1vZHVsb1RpbWVCYXNlID0gdGltZXN0YW1wWzBdOyAgLyogIDExLzEyLzIwMDEgKi8KKyAgICAgICAgICAgICAgICB2b3BIZWFkZXJbMF0tPnRpbWVTdGFtcCA9IHRpbWVzdGFtcFswXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2b3BIZWFkZXJbMF0tPnRpbWVTdGFtcCA9IENhbGNWb3BEaXNwbGF5VGltZShjdXJyVm9sLCB2b3BIZWFkZXJbMF0sIHZpZGVvLT5zaG9ydFZpZGVvSGVhZGVyKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8qIHNldCB1cCBzb21lIGJhc2UtbGF5ZXIgb25seSBwYXJhbWV0ZXJzICovCisgICAgICAgIHZvcEhlYWRlclswXS0+cmVmU2VsZWN0Q29kZSA9IDE7CisjaWZkZWYgUFZfU1VQUE9SVF9URU1QT1JBTF9TQ0FMQUJJTElUWQorICAgIH0KKyNlbmRpZgorICAgIHRpbWVzdGFtcFt0YXJnZXRfbGF5ZXJdID0gdmlkZW8tPmN1cnJUaW1lc3RhbXAgPSB2b3BIZWFkZXJbdGFyZ2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ZWRpY3Rpb25UeXBlOworICAgIGhlYWRlcl9pbmZvLT5yZWZTZWxDb2RlID0gdm9wSGVhZGVyW3RhcmdldF9sYXllcl0tPnJlZlNlbGVjdENvZGU7CisgICAgaGVhZGVyX2luZm8tPnF1YW50aXplciA9IGN1cnJWb3AtPnF1YW50aXplcjsKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisgICAgcmV0dXJuIFBWX1RSVUU7Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkRlY29kZVZvcEJvZHkoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA4LzIyLzIwMDIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogRGVjb2RlIHZvcCBib2R5IGFmdGVyIHRoZSBoZWFkZXIgaXMgZGVjb2RlZCwgbW9kaWZpZWQgZnJvbSAgICovCisvKiAgICAgICAgICAgICAgb3JpZ2luYWwgUFZEZWNvZGVWaWRlb0ZyYW1lLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitCb29sIFBWRGVjb2RlVm9wQm9keShWaWRlb0RlY0NvbnRyb2xzICpkZWNDdHJsLCBpbnQzMiBidWZmZXJfc2l6ZVtdKQoreworICAgIFBWX1NUQVRVUyBzdGF0dXMgPSBQVl9GQUlMOworICAgIFZpZGVvRGVjRGF0YSAqdmlkZW8gPSAoVmlkZW9EZWNEYXRhICopIGRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGE7CisgICAgaW50IHRhcmdldF9sYXllciA9IHZpZGVvLT5jdXJyTGF5ZXI7CisgICAgVm9sICpjdXJyVm9sID0gdmlkZW8tPnZvbFt0YXJnZXRfbGF5ZXJdOworICAgIFZvcCAqY3VyclZvcCA9IHZpZGVvLT5jdXJyVm9wOworICAgIFZvcCAqcHJldlZvcCA9IHZpZGVvLT5wcmV2Vm9wOworICAgIFZvcCAqdGVtcFZvcFB0cjsKKyAgICBpbnQgYnl0ZXNfY29uc3VtZWQgPSAwOyAvKiBSZWNvcmQgaG93IG1hbnkgYml0cyB3ZSB1c2VkIGluIHRoZSBidWZmZXIuICAgMDQvMjQvMjAwMSAqLworCisgICAgaW50IGlkeDsKKworICAgIGlmIChjdXJyVm9wLT52b3BDb2RlZCA9PSAwKSAgICAgICAgICAgICAgICAgIC8qICAwNy8wMy8yMDAxICovCisgICAgeworICAgICAgICBQVl9CaXRzdHJlYW1CeXRlQWxpZ24oY3VyclZvbC0+Yml0c3RyZWFtKTsKKyAgICAgICAgLyogV2Ugc2hvdWxkIGFsd2F5cyBjbGVhciB1cCBiaXRzdHJlYW0gYnVmZmVyLiAgIDEwLzEwLzIwMDAgKi8KKyAgICAgICAgYnl0ZXNfY29uc3VtZWQgPSAoZ2V0UG9pbnRlcihjdXJyVm9sLT5iaXRzdHJlYW0pICsgNykgPj4gMzsKKworICAgICAgICBpZiAoYnl0ZXNfY29uc3VtZWQgPiBjdXJyVm9sLT5iaXRzdHJlYW0tPmRhdGFfZW5kX3BvcykKKyAgICAgICAgeworICAgICAgICAgICAgYnl0ZXNfY29uc3VtZWQgPSBjdXJyVm9sLT5iaXRzdHJlYW0tPmRhdGFfZW5kX3BvczsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChieXRlc19jb25zdW1lZCA8IGJ1ZmZlcl9zaXplW3RhcmdldF9sYXllcl0pCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIElmIHdlIG9ubHkgY29uc3VtZSBwYXJ0IG9mIHRoZSBiaXRzIGluIHRoZSBidWZmZXIsIHRha2UgdGhvc2UgKi8KKyAgICAgICAgICAgIC8qICBvdXQuICAgICAwNC8yNC8yMDAxICovCisgICAgICAgICAgICAvKiAgICAgICAgICBvc2NsX21lbWNweShidWZmZXJbdGFyZ2V0X2xheWVyXSwgYnVmZmVyW3RhcmdldF9sYXllcl0rYnl0ZXNfY29uc3VtZWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGJ1ZmZlcl9zaXplW3RhcmdldF9sYXllcl0tPWJ5dGVzX2NvbnN1bWVkKSk7ICovCisgICAgICAgICAgICBidWZmZXJfc2l6ZVt0YXJnZXRfbGF5ZXJdIC09IGJ5dGVzX2NvbnN1bWVkOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgYnVmZmVyX3NpemVbdGFyZ2V0X2xheWVyXSA9IDA7CisgICAgICAgIH0KKyNpZmRlZiBQVl9NRU1PUllfUE9PTAorCisgICAgICAgIGlmICh0YXJnZXRfbGF5ZXIpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICh2aWRlby0+cHJldkVuaGNWb3AtPnRpbWVTdGFtcCA+IHZpZGVvLT5wcmV2Vm9wLT50aW1lU3RhbXApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmlkZW8tPnByZXZWb3AgPSB2aWRlby0+cHJldkVuaGNWb3A7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpZiAoIXZpZGVvLT5wcmV2Vm9wLT55Q2hhbikgeworICAgICAgICAgICAgQUxPR0UoImIvMzUyNjk2MzUiKTsKKyAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiMzUyNjk2MzUiKTsKKyAgICAgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKyAgICAgICAgfQorICAgICAgICBvc2NsX21lbWNweShjdXJyVm9wLT55Q2hhbiwgdmlkZW8tPnByZXZWb3AtPnlDaGFuLCAoZGVjQ3RybC0+c2l6ZSozKSAvIDIpOworCisgICAgICAgIHZpZGVvLT5wcmV2Vm9wID0gcHJldlZvcDsKKworICAgICAgICB2aWRlby0+Y29uY2VhbEZyYW1lID0gY3VyclZvcC0+eUNoYW47ICAgICAgIC8qICAwNy8wNy8yMDAxICovCisKKyAgICAgICAgdmlkZW8tPnZvcF9jb2RpbmdfdHlwZSA9IGN1cnJWb3AtPnByZWRpY3Rpb25UeXBlOyAvKiAgMDcvMDkvMDEgKi8KKworICAgICAgICBkZWNDdHJsLT5vdXRwdXRGcmFtZSA9IGN1cnJWb3AtPnlDaGFuOworCisgICAgICAgIC8qIFN3YXAgVk9QIHBvaW50ZXJzLiAgTm8gZW5oYy4gZnJhbWUgb3NjbF9tZW1jcHkoKSBhbnltb3JlISAgIDA0LzI0LzIwMDEgKi8KKyAgICAgICAgaWYgKHRhcmdldF9sYXllcikKKyAgICAgICAgeworICAgICAgICAgICAgdGVtcFZvcFB0ciA9IHZpZGVvLT5wcmV2RW5oY1ZvcDsKKyAgICAgICAgICAgIHZpZGVvLT5wcmV2RW5oY1ZvcCA9IHZpZGVvLT5jdXJyVm9wOworICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AgPSB0ZW1wVm9wUHRyOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgdGVtcFZvcFB0ciA9IHZpZGVvLT5wcmV2Vm9wOworICAgICAgICAgICAgdmlkZW8tPnByZXZWb3AgPSB2aWRlby0+Y3VyclZvcDsKKyAgICAgICAgICAgIHZpZGVvLT5jdXJyVm9wID0gdGVtcFZvcFB0cjsKKyAgICAgICAgfQorI2Vsc2UKKyAgICAgICAgaWYgKHRhcmdldF9sYXllcikgICAgICAgLyogdGhpcyBpcyBuZWNlc3NhcnkgdG8gYXZvaWQgZmxhc2hiYWNrIHByb2JsZW1zICAgMDYvMjEvMjAwMiovCisgICAgICAgIHsKKyAgICAgICAgICAgIHZpZGVvLT5wcmV2RW5oY1ZvcC0+dGltZVN0YW1wID0gY3VyclZvcC0+dGltZVN0YW1wOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgdmlkZW8tPnByZXZWb3AtPnRpbWVTdGFtcCA9IGN1cnJWb3AtPnRpbWVTdGFtcDsKKyAgICAgICAgfQorI2VuZGlmCisgICAgICAgIHZpZGVvLT52b3BfY29kaW5nX3R5cGUgPSBjdXJyVm9wLT5wcmVkaWN0aW9uVHlwZTsgLyogIDA3LzA5LzAxICovCisgICAgICAgIC8qIHRoZSBmb2xsb3dpbmcgaXMgbmVjZXNzYXJ5IHRvIGF2b2lkIGRpc3BsYXlpbmcgYW4gbm90Q29kZWQgSS1WT1AgYXQgdGhlIGJlZ2lubmluZyBvZiBhIHNlc3Npb24KKyAgICAgICAgb3IgYWZ0ZXIgcmFuZG9tIHBvc2l0aW9uaW5nICAwNy8wMy8wMiovCisgICAgICAgIGlmIChjdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9PSBJX1ZPUCkKKyAgICAgICAgeworICAgICAgICAgICAgdmlkZW8tPnZvcF9jb2RpbmdfdHlwZSA9IFBfVk9QOworICAgICAgICB9CisKKworICAgICAgICByZXR1cm4gUFZfVFJVRTsKKyAgICB9CisgICAgLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworICAgIC8qICBEZWNvZGUgdm9wIGJvZHkgKGlmIHRoZXJlIGlzIG5vIGVycm9yIGluIHRoZSBoZWFkZXIhKSAgKi8KKyAgICAvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisKKyAgICAvKiBmaXJzdCwgd2UgbmVlZCB0byBzZWxlY3QgYSByZWZlcmVuY2UgZnJhbWUgKi8KKyAgICBpZiAoZGVjQ3RybC0+bkxheWVycyA+IDEpCisgICAgeworICAgICAgICBpZiAoY3VyclZvcC0+cHJlZGljdGlvblR5cGUgPT0gSV9WT1ApCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIGRvIG5vdGhpbmcgaGVyZSAqLworICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKGN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID09IFBfVk9QKQorICAgICAgICB7CisgICAgICAgICAgICBzd2l0Y2ggKGN1cnJWb3AtPnJlZlNlbGVjdENvZGUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgY2FzZSAwIDogLyogbW9zdCByZWNlbnRseSBkZWNvZGVkIGVuaGFuY2VtZW50IHZvcCAqLworICAgICAgICAgICAgICAgICAgICAvKiBTZXR1cCB2aWRlby0+cHJldlZvcCBiZWZvcmUgd2UgY2FsbCBQVl9EZWNvZGVWb3AoKS4gICAwNC8yNC8yMDAxICovCisgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cHJldkVuaGNWb3AtPnRpbWVTdGFtcCA+PSB2aWRlby0+cHJldlZvcC0+dGltZVN0YW1wKQorICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnByZXZWb3AgPSB2aWRlby0+cHJldkVuaGNWb3A7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSAxIDogLyogbW9zdCByZWNlbnRseSBkaXNwbGF5ZWQgYmFzZS1sYXllciB2b3AgKi8KKyAgICAgICAgICAgICAgICAgICAgaWYgKHRhcmdldF9sYXllcikKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5wcmV2RW5oY1ZvcC0+dGltZVN0YW1wID4gdmlkZW8tPnByZXZWb3AtPnRpbWVTdGFtcCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+cHJldlZvcCA9IHZpZGVvLT5wcmV2RW5oY1ZvcDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgMiA6IC8qIG5leHQgYmFzZS1sYXllciB2b3AgaW4gZGlzcGxheSBvcmRlciAqLworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgMyA6IC8qIHRlbXBvcmFsbHkgY29pbmNpZGVudCBiYXNlLWxheWVyIHZvcCAobm8gTVYncykgKi8KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZWxzZSAvKiB3ZSBoYXZlIGEgQi1Wb3AgKi8KKyAgICAgICAgeworICAgICAgICAgICAgbXA0ZGVjX2xvZygiRGVjb2RlVmlkZW9GcmFtZSgpOiBCLVZPUCBub3Qgc3VwcG9ydGVkLlxuIik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKiBUaGlzIGlzIGZvciB0aGUgY2FsY3VsYXRpb24gb2YgdGhlIGZyYW1lIHJhdGUgYW5kIGJpdHJhdGUuICovCisgICAgaWR4ID0gKyt2aWRlby0+ZnJhbWVfaWR4ICUgQklUUkFURV9BVkVSQUdFX1dJTkRPVzsKKworICAgIC8qIENhbGN1bGF0ZSBiaXRyYXRlIGZvciB0aGlzIGxheWVyLiAgIDA4LzIzLzIwMDAgKi8KKyAgICBzdGF0dXMgPSBQVl9EZWNvZGVWb3AodmlkZW8pOworICAgIHZpZGVvLT5uQml0c1BlclZvcFt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gICAgIDA1LzEwLzIwMDAgICAgICAgICAgICAgICAgICAgICAgKi8KKworICAgICAgICBjYXNlIFBWX1NVQ0NFU1MgOgorICAgICAgICAgICAgLyogTm9odGluZyBpcyB3cm9uZyA6KS4gKi8KKworCisgICAgICAgICAgICB2aWRlby0+Y29uY2VhbEZyYW1lID0gdmlkZW8tPmN1cnJWb3AtPnlDaGFuOyAgICAgICAvKiAgMDcvMDcvMjAwMSAqLworCisgICAgICAgICAgICB2aWRlby0+dm9wX2NvZGluZ190eXBlID0gdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlOyAvKiAgMDcvMDkvMDEgKi8KKworICAgICAgICAgICAgZGVjQ3RybC0+b3V0cHV0RnJhbWUgPSB2aWRlby0+Y3VyclZvcC0+eUNoYW47CisKKyAgICAgICAgICAgIC8qIFN3YXAgVk9QIHBvaW50ZXJzLiAgTm8gZW5oYy4gZnJhbWUgb3NjbF9tZW1jcHkoKSBhbnltb3JlISAgIDA0LzI0LzIwMDEgKi8KKyAgICAgICAgICAgIGlmICh0YXJnZXRfbGF5ZXIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGVtcFZvcFB0ciA9IHZpZGVvLT5wcmV2RW5oY1ZvcDsKKyAgICAgICAgICAgICAgICB2aWRlby0+cHJldkVuaGNWb3AgPSB2aWRlby0+Y3VyclZvcDsKKyAgICAgICAgICAgICAgICB2aWRlby0+Y3VyclZvcCA9IHRlbXBWb3BQdHI7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGVtcFZvcFB0ciA9IHZpZGVvLT5wcmV2Vm9wOworICAgICAgICAgICAgICAgIHZpZGVvLT5wcmV2Vm9wID0gdmlkZW8tPmN1cnJWb3A7CisgICAgICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AgPSB0ZW1wVm9wUHRyOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisKKyAgICAg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09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBWaWRlb0RlY29kZXJFcnJvckRldGVjdGVkKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA2LzIwLzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZXZlcnl0aW1lIGFuIGVycm9yIGludCB0aGUgICAgICAqLworLyogICAgICAgICAgICAgIGJpdHN0cmVhbSBpcyBkZXRlY3RlZC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCit1aW50IFZpZGVvRGVjb2RlckVycm9yRGV0ZWN0ZWQoVmlkZW9EZWNEYXRhICopCit7CisgICAgLyogVGhpcyBpcyBvbmx5IHVzZWQgZm9yIHRyYXBwaW5nIGJpdHN0cmVhbSBlcnJvciBmb3IgZGVidWdpbmcgKi8KKyAgICByZXR1cm4gMDsKK30KKworI2lmZGVmIEVOQUJMRV9MT0cKKyNpbmNsdWRlIDxzdGRpby5oPgorI2luY2x1ZGUgPHN0ZGFyZy5oPgorLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBtNHZkZWNfZHByaW50ZigpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA4LzE1LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogVGhpcyBpcyBhIGZ1bmN0aW9uIHRoYXQgbG9ncyBtZXNzYWdlcyBpbiB0aGUgbXBlZzQgdmlkZW8gICAgICovCisvKiAgICAgICAgICAgICBkZWNvZGVyLiAgV2UgY2FuIGNhbGwgdGhlIHN0YW5kYXJkIFBhY2tldFZpZGVvIFBWTWVzc2FnZSAgICAgKi8KKy8qICAgICAgICAgICAgIGZyb20gaW5zaWRlIHRoaXMgZnVuY3Rpb24gaWYgbmVjZXNzYXJ5LiAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBOb3RlICAgICA6IFRvIHR1cm4gb24gdGhlIGxvZ2dpbmcsIExPR19NUDRERUNfTUVTU0FHRSBtdXN0IGJlIGRlZmluZWQgICAqLworLyogICAgICAgICAgICAgIHdoZW4gY29tcGlsaW5nIHRoaXMgZmlsZSAob25seSB0aGlzIGZpbGUpLiAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwordm9pZCBtNHZkZWNfZHByaW50ZihjaGFyICpmb3JtYXQsIC4uLikKK3sKKyAgICBGSUxFICpsb2dfZnA7CisgICAgdmFfbGlzdCBhcmdzOworICAgIHZhX3N0YXJ0KGFyZ3MsIGZvcm1hdCk7CisKKyAgICAvKiBvcGVuIHRoZSBsb2cgZmlsZSAqLworICAgIGxvZ19mcCA9IGZvcGVuKCJcXG1wNGRlY19sb2cudHh0IiwgImErIik7CisgICAgaWYgKGxvZ19mcCA9PSBOVUxMKSByZXR1cm47CisgICAgLyogb3V0cHV0IHRoZSBtZXNzYWdlICovCisgICAgdmZwcmludGYobG9nX2ZwLCBmb3JtYXQsIGFyZ3MpOworICAgIGZjbG9zZShsb2dfZnApOworCisgICAgdmFfZW5kKGFyZ3MpOworfQorI2VuZGlmCisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBJc0ludHJhRnJhbWUoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA1LzI5LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFRoZSBtb3N0IHJlY2VudGx5IGRlY29kZWQgZnJhbWUgaXMgYW4gSW50cmEgZnJhbWUuICAgICAgICAgICAqLworLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworQm9vbCBJc0ludHJhRnJhbWUoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCkKK3sKKyAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKWRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGE7CisgICAgcmV0dXJuICh2aWRlby0+dm9wX2NvZGluZ190eXBlID09IElfVk9QKTsKK30KKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkRlY1Bvc3RQcm9jZXNzKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDAxLzA5LzIwMDIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogUG9zdFByb2Nlc3Mgb25lIHZpZGVvIGZyYW1lIGFuZCByZXR1cm4gYSBZVVYtMTIgaW1hZ2UuICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwordm9pZCBQVkRlY1Bvc3RQcm9jZXNzKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwsIHVpbnQ4ICpvdXRwdXRZVVYpCit7CisgICAgdWludDggKm91dHB1dEJ1ZmZlcjsKKyAgICBvdXRwdXRCdWZmZXIgPSBkZWNDdHJsLT5vdXRwdXRGcmFtZTsKKyAgICBvdXRwdXRZVVY7CisgICAgZGVjQ3RybC0+b3V0cHV0RnJhbWUgPSBvdXRwdXRCdWZmZXI7CisgICAgcmV0dXJuOworfQorCisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogUFZEZWNTZXRSZWZlcmVuY2UoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgdWludDggKnJlZllVViwgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyIHRpbWVzdGFtcCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA3LzIyLzIwMDMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogR2V0IFlVViByZWZlcmVuY2UgZnJhbWUgZnJvbSBleHRlcm5hbCBzb3VyY2UuICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiBZVVYgNC0yLTAgZnJhbWUgY29udGFpbmluZyBuZXcgcmVmZXJlbmNlIGZyYW1lIGluIHRoZSBzYW1lICAgKi8KKy8qICAgOiBkaW1lbnNpb24gYXMgb3JpZ2luYWwsIGkuZS4sIGRvZXNuJ3QgaGF2ZSB0byBiZSBtdWx0aXBsZSBvZiAxNiAhISEuICAqLworLyogIFJldHVybiAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitCb29sIFBWRGVjU2V0UmVmZXJlbmNlKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwsIHVpbnQ4ICpyZWZZVVYsIHVpbnQzMiB0aW1lc3RhbXApCit7CisgICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKikgZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKKyAgICBWb3AgKnByZXZWb3AgPSB2aWRlby0+cHJldlZvcDsKKyAgICBpbnQgd2lkdGggPSB2aWRlby0+d2lkdGg7CisgICAgdWludDggKmRzdFB0ciwgKm9yZ1B0ciwgKmRzdFB0cjIsICpvcmdQdHIyOworICAgIGludDMyIHNpemUgPSAoaW50MzIpd2lkdGggKiB2aWRlby0+aGVpZ2h0OworCisKKyAgICAvKiBzZXQgbmV3IHBhcmFtZXRlcnMgKi8KKyAgICBwcmV2Vm9wLT50aW1lU3RhbXAgPSB0aW1lc3RhbXA7CisgICAgcHJldlZvcC0+cHJlZGljdGlvblR5cGUgPSBJX1ZPUDsKKworICAgIGRzdFB0ciA9IHByZXZWb3AtPnlDaGFuOworICAgIG9yZ1B0ciA9IHJlZllVVjsKKyAgICBvc2NsX21lbWNweShkc3RQdHIsIG9yZ1B0ciwgc2l6ZSk7CisgICAgZHN0UHRyID0gcHJldlZvcC0+dUNoYW47CisgICAgZHN0UHRyMiA9IHByZXZWb3AtPnZDaGFuOworICAgIG9yZ1B0ciA9IHJlZllVViArIHNpemU7CisgICAgb3JnUHRyMiA9IG9yZ1B0ciArIChzaXplID4+IDIpOworICAgIG9zY2xfbWVtY3B5KGRzdFB0ciwgb3JnUHRyLCAoc2l6ZSA+PiAyKSk7CisgICAgb3NjbF9tZW1jcHkoZHN0UHRyMiwgb3JnUHRyMiwgKHNpemUgPj4gMikpOworCisgICAgdmlkZW8tPmNvbmNlYWxGcmFtZSA9IHZpZGVvLT5wcmV2Vm9wLT55Q2hhbjsKKyAgICB2aWRlby0+dm9wX2NvZGluZ190eXBlID0gSV9WT1A7CisgICAgZGVjQ3RybC0+b3V0cHV0RnJhbWUgPSB2aWRlby0+cHJldlZvcC0+eUNoYW47CisKKyAgICByZXR1cm4gUFZfVFJVRTsKK30KKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkRlY1NldEVuaFJlZmVyZW5jZShWaWRlb0RlY0NvbnRyb2xzICpkZWNDdHJsLCB1aW50OCAqcmVmWVVWLCAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyIHRpbWVzdGFtcCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA3LzIzLzIwMDMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogR2V0IFlVViBlbmhhbmNlIHJlZmVyZW5jZSBmcmFtZSBmcm9tIGV4dGVybmFsIHNvdXJjZS4gICAgICAgICovCisvKiAgSW4vb3V0ICAgOiBZVVYgNC0yLTAgZnJhbWUgY29udGFpbmluZyBuZXcgcmVmZXJlbmNlIGZyYW1lIGluIHRoZSBzYW1lICAgKi8KKy8qICAgOiBkaW1lbnNpb24gYXMgb3JpZ2luYWwsIGkuZS4sIGRvZXNuJ3QgaGF2ZSB0byBiZSBtdWx0aXBsZSBvZiAxNiAhISEuICAqLworLyogIFJldHVybiAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitCb29sIFBWRGVjU2V0RW5oUmVmZXJlbmNlKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwsIHVpbnQ4ICpyZWZZVVYsIHVpbnQzMiB0aW1lc3RhbXApCit7CisgICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKikgZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKKyAgICBWb3AgKnByZXZFbmhjVm9wID0gdmlkZW8tPnByZXZFbmhjVm9wOworICAgIHVpbnQ4ICpkc3RQdHIsICpvcmdQdHIsICpkc3RQdHIyLCAqb3JnUHRyMjsKKyAgICBpbnQzMiBzaXplID0gKGludDMyKSB2aWRlby0+d2lkdGggKiB2aWRlby0+aGVpZ2h0OworCisgICAgaWYgKHZpZGVvLT5udW1iZXJPZkxheWVycyA8PSAxKQorICAgICAgICByZXR1cm4gUFZfRkFMU0U7CisKKworICAgIC8qIHNldCBuZXcgcGFyYW1ldGVycyAqLworICAgIHByZXZFbmhjVm9wLT50aW1lU3RhbXAgPSB0aW1lc3RhbXA7CisgICAgcHJldkVuaGNWb3AtPnByZWRpY3Rpb25UeXBlID0gSV9WT1A7CisKKyAgICBkc3RQdHIgPSBwcmV2RW5oY1ZvcC0+eUNoYW47CisgICAgb3JnUHRyID0gcmVmWVVWOworICAgIG9zY2xfbWVtY3B5KGRzdFB0ciwgb3JnUHRyLCBzaXplKTsKKyAgICBkc3RQdHIgPSBwcmV2RW5oY1ZvcC0+dUNoYW47CisgICAgZHN0UHRyMiA9IHByZXZFbmhjVm9wLT52Q2hhbjsKKyAgICBvcmdQdHIgPSByZWZZVVYgKyBzaXplOworICAgIG9yZ1B0cjIgPSBvcmdQdHIgKyAoc2l6ZSA+PiAyKTsKKyAgICBvc2NsX21lbWNweShkc3RQdHIsIG9yZ1B0ciwgKHNpemUgPj4gMikpOworICAgIG9zY2xfbWVtY3B5KGRzdFB0cjIsIG9yZ1B0cjIsIChzaXplID4+IDIpKTsKKyAgICB2aWRlby0+Y29uY2VhbEZyYW1lID0gdmlkZW8tPnByZXZFbmhjVm9wLT55Q2hhbjsKKyAgICB2aWRlby0+dm9wX2NvZGluZ190eXBlID0gSV9WT1A7CisgICAgZGVjQ3RybC0+b3V0cHV0RnJhbWUgPSB2aWRlby0+cHJldkVuaGNWb3AtPnlDaGFuOworCisgICAgcmV0dXJuIFBWX1RSVUU7Cit9CisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkdldFZvbEluZm8oKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA4LzA2LzIwMDMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogR2V0IHRoZSB2b2wgaW5mbyhvbmx5IGJhc2UtbGF5ZXIpLiAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAwNi8yNC8yMDA0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworQm9vbCBQVkdldFZvbEluZm8oVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgVm9sSW5mbyAqcFZvbEluZm8pCit7CisgICAgVm9sICpjdXJyVm9sOworCisgICAgaWYgKHBWb2xJbmZvID09IE5VTEwgfHwgZGVjQ3RybCA9PSBOVUxMIHx8IGRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGEgPT0gTlVMTCB8fAorICAgICAgICAgICAgKChWaWRlb0RlY0RhdGEgKilkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhKS0+dm9sWzBdID09IE5VTEwpIHJldHVybiBQVl9GQUxTRTsKKworICAgIGN1cnJWb2wgPSAoKFZpZGVvRGVjRGF0YSAqKShkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhKSktPnZvbFswXTsKKworICAgIC8vIGdldCB0aGUgVk9MIGluZm8KKyAgICBwVm9sSW5mby0+c2hvcnRWaWRlb0hlYWRlciA9IChpbnQzMikoKFZpZGVvRGVjRGF0YSAqKShkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhKSktPnNob3J0Vmlk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yMywgMjUsIDI2LCAyNywgMjgsCisgICAgMjEsIDIyLCAyMywgMjQsIDI2LCAyNywgMjgsIDMwLAorICAgIDIyLCAyMywgMjQsIDI2LCAyNywgMjgsIDMwLCAzMSwKKyAgICAyMywgMjQsIDI1LCAyNywgMjgsIDMwLCAzMSwgMzMKK307CisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogQ2FsY051bUJpdHMoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogQ2FsY3VsYXRlIHRoZSBtaW5pbXVtIG51bWJlciBvZiBiaXRzIHJlcXVpcmVkIHRvICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgcmVwcmVzZW50IHguICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBOb3RlICAgICA6IFRoaXMgaXMgYW4gZXF1aXZhbGVudCBpbXBsZW1lbnRhdGlvbiBvZiAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgKGxvbmcpY2VpbChsb2coKGRvdWJsZSl4KS9sb2coMi4wKSkgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworaW50IENhbGNOdW1CaXRzKHVpbnQgeCkKK3sKKyAgICBpbnQgaSA9IDE7CisgICAgd2hpbGUgKHggPj49IDEpIGkrKzsKKyAgICByZXR1cm4gaTsKK30KKworCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRCZWdpbioqKioqKgorKgorKiAtLSBEZWNvZGVWb2xIZWFkZXIgLS0gRGVjb2RlIHRoZSBoZWFkZXIgb2YgYSBWT0wKKyoKKyogICAwNC8xMC8yMDAwIDogaW5pdGlhbCBtb2RpZmljYXRpb24gdG8gdGhlIG5ldyBQVi1EZWNvZGVyIExpYiBmb3JtYXQuCisqICAgMTAvMTIvMjAwMSA6IHJlamVjdCBub24gY29tcGxpYW50IGJpdHN0cmVhbXMKKyoKKyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEVuZCoqKioqKioqLworUFZfU1RBVFVTIERlY29kZVZPTEhlYWRlcihWaWRlb0RlY0RhdGEgKnZpZGVvLCBpbnQgbGF5ZXIpCit7CisgICAgUFZfU1RBVFVTIHN0YXR1czsKKyAgICBWb2wgKmN1cnJWb2w7CisgICAgQml0c3RyZWFtRGVjVmlkZW8gKnN0cmVhbTsKKyAgICB1aW50MzIgdG1wdmFyLCB2b2xfc2hhcGU7CisgICAgdWludDMyIHN0YXJ0Q29kZTsKKyAgICBpbnQgKnFtYXQsIGksIGo7CisgICAgaW50IHZlcnNpb25faWQgPSAxOworI2lmZGVmIFBWX1RPTEVSQVRFX1ZPTF9FUlJPUlMKKyAgICB1aW50MzIgcHJvZmlsZSA9IDB4MDE7CisjZW5kaWYKKyAgICAvKiAgVGhlcmUncyBhICJjdXJyTGF5ZXIiIHZhcmlhYmxlIGluc2lkZSB2aWRlb0RlY0RhdGEuICAgICAgICAgICovCisgICAgLyogICBIb3dldmVyLCB3ZSBkb24ndCBtYWludGFpbi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EwICYmIHRtcHZhciAhPSAweDExICYmIHRtcHZhciAhPSAweDEyICYmCisgICAgICAgICAgICAgICAgICAgIHRtcHZhciAhPSAweEExICYmIHRtcHZhciAhPSAweEEyICAmJiB0bXB2YXIgIT0gMHhBMy8qIENvcmUgU1BATDEtTDMgKi8pCisgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICAvKiBzdXBwb3J0IFNQTDAtMyAmIFNTUEwwLTIgICAqLworICAgICAgICAgICAgaWYgKHRtcHZhciAhPSAweDAxICYmIHRtcHZhciAhPSAweDAyICYmIHRtcHZhciAhPSAweDAzICYmIHRtcHZhciAhPSAweDA4ICYmCisgICAgICAgICAgICAgICAgICAgIC8qIFdoaWxlIG5vdCB0ZWNobmljYWxseSBzdXBwb3J0ZWQsIHRyeSB0byBkZWNvZGUgU1BMNCZTUEw1IGZpbGVzIGFzIHdlbGwuICovCisgICAgICAgICAgICAgICAgICAgIC8qIFdlJ2xsIGZhaWwgbGF0ZXIgaWYgdGhlIHNpemUgaXMgdG9vIGxhcmdlLiAgVGhpcyBpcyB0byBhbGxvdyBwbGF5YmFjayBvZiAqLworICAgICAgICAgICAgICAgICAgICAvKiBzb21lIDw9Q0lGIGZpbGVzIGdlbmVyYXRlZCBieSBvdGhlciBlbmNvZGVycy4gKi8KKyAgICAgICAgICAgICAgICAgICAgdG1wdmFyICE9IDB4MDQgJiYgdG1wdmFyICE9IDB4MDUgJiYKKyAgICAgICAgICAgICAgICAgICAgdG1wdmFyICE9IDB4MTAgJiYgdG1wdmFyICE9IDB4MTEgJiYgdG1wdmFyICE9IDB4MTIgJiYKKyAgICAgICAgICAgICAgICAgICAgdG1wdmFyICE9IDB4MjEgJiYgdG1wdmFyICE9IDB4MjIgJiYgIC8qIENvcmUgUHJvZmlsZSBMZXZlbHMgKi8KKyAgICAgICAgICAgICAgICAgICAgdG1wdmFyICE9IDB4QTEgJiYgdG1wdmFyICE9IDB4QTIgJiYgdG1wdmFyICE9IDB4QTMgJiYKKyAgICAgICAgICAgICAgICAgICAgdG1wdmFyICE9IDB4RjAgJiYgdG1wdmFyICE9IDB4RjEgJiYgLyogQWR2YW5jZWQgU2ltcGxlIFByb2ZpbGUgTGV2ZWxzKi8KKyAgICAgICAgICAgICAgICAgICAgdG1wdmFyICE9IDB4RjIgJiYgdG1wdmFyICE9IDB4RjMgJiYKKyAgICAgICAgICAgICAgICAgICAgdG1wdmFyICE9IDB4RjQgJiYgdG1wdmFyICE9IDB4RjUpCisgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgIH0KKyNlbHNlCisgICAgICAgIHByb2ZpbGUgPSB0bXB2YXI7CisjZW5kaWYKKworICAgICAgICAvLyBzYXZlIHRoZSBwcm9maWxlIGFuZCBsZXZlbCBmb3IgdGhlIHF1ZXJ5CisgICAgICAgIGN1cnJWb2wtPnByb2ZpbGVfbGV2ZWxfaWQgPSAodWludCl0bXB2YXI7IC8vICA2LzEwLzA0CisKKworCisgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVNob3dCaXRzMzJIQyhzdHJlYW0sICZ0bXB2YXIpOworICAgICAgICBpZiAodG1wdmFyID09IFVTRVJfREFUQV9TVEFSVF9DT0RFKQorICAgICAgICB7CisgICAgICAgICAgICAvKiBTb21ldGhpbmcgaGFzIHRvIGJlIGRvbmUgd2l0aCB1c2VyIGRhdGEgIDExLzExLzk5ICovCisgICAgICAgICAgICBzdGF0dXMgPSBEZWNvZGVVc2VyRGF0YShzdHJlYW0pOworICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBQVl9TVUNDRVNTKSByZXR1cm4gUFZfRkFJTDsKKyAgICAgICAgfQorICAgICAgICAvKiB2aXN1YWxfb2JqZWN0X3N0YXJ0X2NvZGUgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICBCaXRzdHJlYW1TaG93Qml0czMySEMoc3RyZWFtLCAmdG1wdmFyKTsKKyAgICAgICAgaWYgKHRtcHZhciAhPSBWSVNVQUxfT0JKRUNUX1NUQVJUX0NPREUpCisgICAgICAgIHsKKyAgICAgICAgICAgIGRvCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLyogU2VhcmNoIGZvciBWT0xfSEVBREVSICovCisgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZTZWFyY2hOZXh0TTRWRnJhbWUoc3RyZWFtKTsgLyogc2VhcmNoIDB4MDAgMHgwMCAweDAxICovCisgICAgICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBQVl9TVUNDRVNTKSByZXR1cm4gUFZfRkFJTDsgLyogYnJlYWtzIHRoZSBsb29wICovCisgICAgICAgICAgICAgICAgQml0c3RyZWFtU2hvd0JpdHMzMihzdHJlYW0sIFZPTF9TVEFSVF9DT0RFX0xFTkdUSCwgJnRtcHZhcik7CisgICAgICAgICAgICAgICAgUFZfQml0c3RyZWFtRmx1c2hCaXRzKHN0cmVhbSwgOCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB3aGlsZSAodG1wdmFyICE9IFZPTF9TVEFSVF9DT0RFKTsKKyAgICAgICAgICAgIGdvdG8gZGVjb2RlX3ZvbDsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIEJpdHN0cmVhbVJlYWRCaXRzMzJIQyhzdHJlYW0pOworICAgICAgICB9CisKKyAgICAgICAgLyogIGlzX3Zpc3VhbF9vYmplY3RfaWRlbnRpZmllciAgICAgICAgICAgICovCisgICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworICAgICAgICBpZiAodG1wdmFyKQorICAgICAgICB7CisgICAgICAgICAgICAvKiB2aXN1YWxfb2JqZWN0X3ZlcmlkICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNCk7CisgICAgICAgICAgICAvKiB2aXN1YWxfb2JqZWN0X3ByaW9yaXR5ICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMyk7CisgICAgICAgIH0KKyAgICAgICAgLyogdmlzdWFsX29iamVjdF90eXBlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgQml0c3RyZWFtU2hvd0JpdHMzMihzdHJlYW0sIDQsICZ0bXB2YXIpOworICAgICAgICBpZiAodG1wdmFyID09IDEpCisgICAgICAgIHsgLyogdmlkZW9fc2lnbmFsX3R5cGUgKi8KKyAgICAgICAgICAgIFBWX0JpdHN0cmVhbUZsdXNoQml0cyhzdHJlYW0sIDQpOworICAgICAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICBpZiAodG1wdmFyID09IDEpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLyogdmlkZW9fZm9ybWF0ICovCisgICAgICAgICAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpOworICAgICAgICAgICAgICAgIC8qIHZpZGVvX3JhbmdlICAqLworICAgICAgICAgICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworICAgICAgICAgICAgICAgIC8qIGNvbG9yX2Rlc2NyaXB0aW9uICovCisgICAgICAgICAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAxKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLyogY29sb3JfcHJpbWFyaWVzICovCisgICAgICAgICAgICAgICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKKyAgICAgICAgICAgICAgICAgICAgLyogdHJhbnNmZXJfY2hhcmFjdGVyaXN0aWNzICovCisgICAgICAgICAgICAgICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKKyAgICAgICAgICAgICAgICAgICAgLyogbWF0cml4X2NvZWZmaWNpZW50cyAqLworICAgICAgICAgICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgZG8KKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvKiBTZWFyY2ggZm9yIFZPTF9IRUFERVIgKi8KKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVlNlYXJjaE5leHRNNFZGcmFtZShzdHJlYW0pOyAvKiBzZWFyY2ggMHgwMCAweDAwIDB4MDEgKi8KKyAgICAgICAgICAgICAgICBpZiAoc3RhdHVzICE9IFBWX1NVQ0NFU1MpIHJldHVybiBQVl9GQUlMOyAvKiBicmVha3MgdGhlIGxvb3AgKi8KKyAgICAgICAgICAgICAgICBCaXRzdHJlYW1TaG93Qml0czMyKHN0cmVhbSwgVk9MX1NUQVJUX0NPREVfTEVOR1RILCAmdG1wdmFyKTsKKyAgICAgICAgICAgICAgICBQVl9CaXRzdHJlYW1GbHVzaEJpdHMoc3RyZWFtLCA4KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHdoaWxlICh0bXB2YXIgIT0gVk9MX1NUQVJUX0NPREUpOworICAgICAgICAgICAgZ290byBkZWNvZGVfdm9sOworICAgICAgICB9CisKKyAgICAgICAgLyogbmV4dF9zdGFydF9jb2RlKCkgKi8KKyAgICAgICAgc3RhdHVzID0gUFZfQml0c3RyZWFtQnl0ZUFsaWduKHN0cmVhbSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qICAxMC8xMi8wMSAqLworICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1TaG93Qml0czMySEMoc3RyZWFtLCAmdG1wdmFyKTsKKworICAgICAgICBpZiAodG1wdmFyID09IFVTRVJfREFUQV9TVEFSVF9DT0RFKQorICAgICAgICB7CisgICAgICAgICAgICAvKiBTb21ldGhpbmcgaGFzIHRvIGJlIGRvbmUgdG8gZGVhbCB3aXRoIHVzZXIgZGF0YSAocGFyc2UgaXQpICAxMS8xMS85OSAqLworICAgICAgICAgICAgc3RhdHVzID0gRGVjb2RlVXNlckRhdGEoc3RyZWFtKTsKKyAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgIH0KKyAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtU2hvd0JpdHMzMihzdHJlYW0sIDI3LCAmdG1wdmFyKTsgICAvKiAgMTAvMTIvMDEgKi8KKyAgICB9CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgLyogICAgICB0bXB2YXIgPSAwOyAgICovICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogIDEwLzEyLzAxICovCisgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVNob3dCaXRzMzIoc3RyZWFtLCAyNywgJnRtcHZhcik7ICAgICAvKiB1bmNvbW1lbnQgdGhpcyBsaW5lIGlmIHlvdSB3YW50CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0byBzdGFydCBkZWNvZGluZyB3aXRoIGEKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvX29iamVjdF9zdGFydF9jb2RlICovCisgICAgfQorCisgICAgaWYgKHRtcHZhciA9PSBWT19TVEFSVF9DT0RFKQorICAgIHsKKyAgICAgICAgLyoqKioqCisgICAgICAgICoKKyAgICAgICAgKiAgIFJlYWQgdGhlIFZPTCBoZWFkZXIgZW50cmllcyBmcm9tIHRoZSBiaXRzdHJlYW0KKyAgICAgICAgKgorICAgICAgICAqKioqKi8KKyAgICAgICAgLyogdmlkZW9fb2JqZWN0X3N0YXJ0X2NvZGUgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZEJpdHMzMihzdHJlYW0sIDI3KTsKKyAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDUpOworCisKKyAgICAgICAgLyogdmlkZW9fb2JqZWN0X2xheWVyX3N0YXJ0X2NvZGUgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgQml0c3RyZWFtU2hvd0JpdHMzMihzdHJlYW0sIFZPTF9TVEFSVF9DT0RFX0xFTkdUSCwgJnRtcHZhcik7CisgICAgICAgIGlmICh0bXB2YXIgIT0gVk9MX1NUQVJUX0NPREUpCisgICAgICAgIHsKKyAgICAgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbUNoZWNrRW5kQnVmZmVyKHN0cmVhbSk7CisgICAgICAgICAgICBpZiAoc3RhdHVzID09IFBWX0VORF9PRl9WT1ApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmlkZW8tPnNob3J0VmlkZW9IZWFkZXIgPSBUUlVFOworICAgICAgICAgICAgICAgIHJldHVybiBQVl9TVUNDRVNTOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGRvCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAvKiBTZWFyY2ggZm9yIFZPTF9IRUFERVIgKi8KKyAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZTZWFyY2hOZXh0TTRWRnJhbWUoc3RyZWFtKTsvKiBzZWFyY2ggMHgwMCAweDAwIDB4MDEgKi8KKyAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBQVl9TVUNDRVNTKSByZXR1cm4gUFZfRkFJTDsgLyogYnJlYWtzIHRoZSBsb29wICovCisgICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMzIoc3RyZWFtLCBWT0xfU1RBUlRfQ09ERV9MRU5HVEgsICZ0bXB2YXIpOworICAgICAgICAgICAgICAgICAgICBQVl9CaXRzdHJlYW1GbHVzaEJpdHMoc3RyZWFtLCA4KTsgLyogYWR2YW5jZSB0aGUgYnl0ZSBwdHIgKi8KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgd2hpbGUgKHRtcHZhciAhPSBWT0xfU1RBUlRfQ09ERSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBQVl9CaXRzdHJlYW1GbHVzaEJpdHMoc3RyZWFtLCA4KTsKKyAgICAgICAgfQorCitkZWNvZGVfdm9sOgorICAgICAgICBQVl9CaXRzdHJlYW1GbHVzaEJpdHMoc3RyZWFtLCBWT0xfU1RBUlRfQ09ERV9MRU5HVEggLSA4KTsKKyAgICAgICAgdmlkZW8tPnNob3J0VmlkZW9IZWFkZXIgPSAwOworCisgICAgICAgIC8qIHZvbF9pZCAoNCBiaXRzKSAqLworICAgICAgICBjdXJyVm9sLT52b2xJRCA9IChpbnQpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA0KTsKKworICAgICAgICAvKiBSYW5kb21BY2Nlc3NpYmxlIGZsYWcgKi8KKyAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisKKyAgICAgICAgLyogb2JqZWN0IHR5cGUgKi8KKyAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOyAgICAgICAgICAgICAgICAvKiAgKi8KKworI2lmZGVmIFBWX1RPTEVSQVRFX1ZPTF9FUlJPUlMKKyAgICAgICAgaWYgKHRtcHZhciA9PSAwKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAobGF5ZXIpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogICAgKi8KKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvKiBzdXBwb3J0IFNTUEwwLTIgICovCisgICAgICAgICAgICAgICAgaWYgKHByb2ZpbGUgIT0gMHgxMCAmJiBwcm9maWxlICE9IDB4MTEgJiYgcHJvZmlsZSAhPSAweDEyKQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gUFZfRkFJTDsKKyAgICAgICAgICAgICAgICB0bXB2YXIgPSAweDAyOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8qIHN1cHBvcnQgU1BMMC0zICYgU1NQTDAtMiAgICovCisgICAgICAgICAgICAgICAgaWYgKHByb2ZpbGUgIT0gMHgwMSAmJiBwcm9maWxlICE9IDB4MDIgJiYgcHJvZmlsZSAhPSAweDAzICYmIHByb2ZpbGUgIT0gMHgwOCAmJgorICAgICAgICAgICAgICAgICAgICAgICAgcHJvZmlsZSAhPSAweDEwICYmIHByb2ZpbGUgIT0gMHgxMSAmJiBwcm9maWxlICE9IDB4MTIpCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgICAgICAgICAgICAgIHRtcHZhciA9IDB4MDE7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBwcm9maWxlIHw9IDB4MDEwMDsKKyAgICAgICAgfQorI2VuZGlmCisKKyAgICAgICAgaWYgKGxheWVyKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAodG1wdmFyICE9IDB4MDIpIHJldHVybiBQVl9GQUlMOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgLy8gU2ltcGxlIGFuZCBhZHZhbmNlZCBzaW1wbGUgKGZvciBxdWFudC10eXBlIDEpCisgICAgICAgICAgICBpZiAodG1wdmFyICE9IDB4MDEgJiYgdG1wdmFyICE9IDB4MTEpIHJldHVybiBQVl9GQUlMOworICAgICAgICB9CisKKyAgICAgICAgLyogdmVyc2lvbiBpZCBzcGVjaWZpZWQ/ICovCisgICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworICAgICAgICBpZiAodG1wdmFyID09IDEpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIHZlcnNpb24gSUQgKi8KKyAgICAgICAgICAgIHZlcnNpb25faWQgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNCk7CisgICAgICAgICAgICAvKiBwcmlvcml0eSAqLworICAgICAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpOworCisgICAgICAgIH0KKworICAgICAgICAvKiBhc3BlY3QgcmF0aW8gaW5mbyAqLworICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNCk7CisgICAgICAgIGlmICh0bXB2YXIgPT0gMCkgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgIGlmICh0bXB2YXIgPT0gMHhmIC8qIGV4dGVuZGVkX3BhciAqLykKKyAgICAgICAgeworICAgICAgICAgICAgLyogd2lkdGggKi8KKyAgICAgICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKKyAgICAgICAgICAgIC8qIGhlaWdodCAqLworICAgICAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICB9CisKKworICAgICAgICAvKiBjb250cm9sIHBhcmFtZXRlcnMgcHJlc2VudD8gKi8KKyAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisKKyAgICAgICAgLyogIEdldCB0aGUgcGFyYW1ldGVycyAoc2tpcHBlZCkgKi8KKyAgICAgICAgLyogIDAzLzEwLzk5ICovCisgICAgICAgIGlmICh0bXB2YXIpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIGNocm9tYV9mb3JtYXQgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMik7CisgICAgICAgICAgICBpZiAodG1wdmFyICE9IDEpIHJldHVybiBQVl9GQUlMOworICAgICAgICAgICAgLyogbG93X2RlbGF5ICAqLworICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisKKyAgICAgICAgICAgIC8qIHZidl9wYXJhbWV0ZXJzIHByZXNlbnQ/ICovCisgICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKKyAgICAgICAgICAgIGlmICh0bXB2YXIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLyogZmlyc3RfaGFsZl9iaXRfcmF0ZSAgICAqLworICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAxNSk7CisgICAgICAgICAgICAgICAgaWYgKCFCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgLyogbGF0dGVyX2hhbGZfYml0X3JhdGUgICAqLworICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAxNSk7CisgICAgICAgICAgICAgICAgaWYgKCFCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgLyogZmlyc3RfaGFsZl92YnZfYnVmZmVyX3NpemUgICAqLworICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAxNSk7CisgICAgICAgICAgICAgICAgaWYgKCFCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgLyogbGF0dGVyX2hhbGZfdmJ2X2J1ZmZlcl9zaXplICAgKi8KKyAgICAgICAgICAgICAgICBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgIDMpOworICAgICAgICAgICAgICAgIC8qIGZpcnN0X2hhbGZfdmJ2X29jY3VwYW5jeSAgICAgKi8KKyAgICAgICAgICAgICAgICBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMTEpOworICAgICAgICAgICAgICAgIGlmICghQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpIHJldHVybiBQVl9GQUlMOworICAgICAgICAgICAgICAgIC8qIGxhdHRlcl9oYWxmX3Zidl9vY2N1cGFuY3kgICovCisgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDE1KTsKKyAgICAgICAgICAgICAgICBpZiAoIUJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pKSByZXR1cm4gUFZfRkFJTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8qIHZpZGVvX29iamVjdF9sYXllcl9zaGFwZSAoMiBiaXRzKSwgb25seSAwMCAocmVjdCkgaXMgc3VwcG9ydGVkIGZvciBub3cgKi8KKyAgICAgICAgdm9sX3NoYXBlID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZE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zMikgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICBpZiAodG1wdmFyKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG1wNGRlY19sb2coIkRlY29kZVZPTEhlYWRlcigpOiBTcHJpdGUgaXMgbm90IHN1cHBvcnRlZC5cbiIpOworICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgLyogRm9yIHZlcnNpb24gMiwgdm9sX3Nwcml0ZV91c2FnZSBoYXMgdHdvIGJpdHMuICovCisgICAgICAgICAgICAvKiBzcHJpdGVfZW5hYmxlICovCisgICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMik7CisgICAgICAgICAgICBpZiAodG1wdmFyKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG1wNGRlY19sb2coIkRlY29kZVZPTEhlYWRlcigpOiBTcHJpdGUgaXMgbm90IHN1cHBvcnRlZC5cbiIpOworICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLyogbm90XzhfYml0ICovCisgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKKyAgICAgICAgeworICAgICAgICAgICAgLyogcXVhbnRfcHJlY2lzaW9uICovCisgICAgICAgICAgICBjdXJyVm9sLT5xdWFudFByZWNpc2lvbiA9IEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA0KTsKKyAgICAgICAgICAgIC8qIGJpdHNfcGVyX3BpeGVsICAqLworICAgICAgICAgICAgY3VyclZvbC0+Yml0c1BlclBpeGVsID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDQpOworICAgICAgICAgICAgbXA0ZGVjX2xvZygiRGVjb2RlVk9MSGVhZGVyKCk6IG5vdCBhbiA4LWJpdCBzdHJlYW0uXG4iKTsgICAgLy8gRm9yIHRoZSB0aW1lIGJlaW5nIHdlIGRvIG5vdCBzdXBwb3J0ICE9IDggYml0cworCisgICAgICAgICAgICByZXR1cm4gUFZfRkFJTDsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIGN1cnJWb2wtPnF1YW50UHJlY2lzaW9uID0gNTsKKyAgICAgICAgICAgIGN1cnJWb2wtPmJpdHNQZXJQaXhlbCA9IDg7CisgICAgICAgIH0KKworICAgICAgICAvKiBxdWFudF90eXBlICgxIGJpdCkgKi8KKyAgICAgICAgY3VyclZvbC0+cXVhbnRUeXBlID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgIGlmIChjdXJyVm9sLT5xdWFudFR5cGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIGxvYWQgcXVhbnRpemF0aW9uIG1hdHJpY2VzLiAgIDUvMjIvMjAwMCAqLworICAgICAgICAgICAgLyogbG9hZF9pbnRyYV9xdWFudF9tYXQgKDEgYml0KSAqLworICAgICAgICAgICAgcW1hdCA9IGN1cnJWb2wtPmlxbWF0OworICAgICAgICAgICAgY3VyclZvbC0+bG9hZEludHJhUXVhbnRNYXQgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKKyAgICAgICAgICAgIGlmIChjdXJyVm9sLT5sb2FkSW50cmFRdWFudE1hdCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvKiBpbnRyYV9xdWFudF9tYXQgKDgqNjQgYml0cykgKi8KKyAgICAgICAgICAgICAgICBpID0gMDsKKyAgICAgICAgICAgICAgICBkbworICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcW1hdFsqKHppZ3phZ19pbnYraSldID0gKGludCkgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB3aGlsZSAoKHFtYXRbKih6aWd6YWdfaW52K2kpXSAhPSAwKSAmJiAoKytpIDwgNjQpKTsKKworICAgICAgICAgICAgICAgIC8qIHFtYXRyaXggbXVzdCBoYXZlIGF0IGxlYXN0IG9uZSBub24temVybyB2YWx1ZSwgd2hpY2ggbWVhbnMKKyAgICAgICAgICAgICAgICAgICBpIHdvdWxkIGJlIG5vbi16ZXJvIGluIHZhbGlkIGNhc2VzICovCisgICAgICAgICAgICAgICAgaWYgKGkgPT0gMCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGZvciAoaiA9IGk7IGogPCA2NDsgaisrKQorICAgICAgICAgICAgICAgICAgICBxbWF0WyooemlnemFnX2luditqKV0gPSBxbWF0WyooemlnemFnX2luditpLTEpXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBvc2NsX21lbWNweShxbWF0LCBtcGVnX2lxbWF0X2RlZiwgNjQqc2l6ZW9mKGludCkpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBxbWF0WzBdID0gMDsgICAgICAgICAgICAgLyogbmVjZXNzYXJ5IGZvciBzd2l0Y2hlZCAmJiBNUEVHIHF1YW50ICAwNy8wOS8wMSAqLworCisgICAgICAgICAgICAvKiBsb2FkX25vbmludHJhX3F1YW50X21hdCAoMSBiaXQpICovCisgICAgICAgICAgICBxbWF0ID0gY3VyclZvbC0+bmlxbWF0OworICAgICAgICAgICAgY3VyclZvbC0+bG9hZE5vbkludHJhUXVhbnRNYXQgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKKyAgICAgICAgICAgIGlmIChjdXJyVm9sLT5sb2FkTm9uSW50cmFRdWFudE1hdCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvKiBub25pbnRyYV9xdWFudF9tYXQgKDgqNjQgYml0cykgKi8KKyAgICAgICAgICAgICAgICBpID0gMDsKKyAgICAgICAgICAgICAgICBkbworICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcW1hdFsqKHppZ3phZ19pbnYraSldID0gKGludCkgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB3aGlsZSAoKHFtYXRbKih6aWd6YWdfaW52K2kpXSAhPSAwKSAmJiAoKytpIDwgNjQpKTsKKworICAgICAgICAgICAgICAgIC8qIHFtYXRyaXggbXVzdCBoYXZlIGF0IGxlYXN0IG9uZSBub24temVybyB2YWx1ZSwgd2hpY2ggbWVhbnMKKyAgICAgICAgICAgICAgICAgICBpIHdvdWxkIGJlIG5vbi16ZXJvIGluIHZhbGlkIGNhc2VzICovCisgICAgICAgICAgICAgICAgaWYgKGkgPT0gMCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGZvciAoaiA9IGk7IGogPCA2NDsgaisrKQorICAgICAgICAgICAgICAgICAgICBxbWF0WyooemlnemFnX2luditqKV0gPSBxbWF0WyooemlnemFnX2luditpLTEpXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBvc2NsX21lbWNweShxbWF0LCBtcGVnX25xbWF0X2RlZiwgNjQqc2l6ZW9mKGludCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKHZlcnNpb25faWQgIT0gMSkKKyAgICAgICAgeworICAgICAgICAgICAgLyogcXVhcnRlcl9zYW1wbGUgZW5hYmxlZCAqLworICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICBpZiAodG1wdmFyKSByZXR1cm4gUFZfRkFJTDsKKyAgICAgICAgfQorCisgICAgICAgIC8qIGNvbXBsZXhpdHlfZXN0aW1hdGlvbl9kaXNhYmxlICovCisgICAgICAgIGN1cnJWb2wtPmNvbXBsZXhpdHlfZXN0RGlzYWJsZSA9IEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworICAgICAgICBpZiAoY3VyclZvbC0+Y29tcGxleGl0eV9lc3REaXNhYmxlID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIGN1cnJWb2wtPmNvbXBsZXhpdHlfZXN0TWV0aG9kID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDIpOworCisgICAgICAgICAgICBpZiAoY3VyclZvbC0+Y29tcGxleGl0eV9lc3RNZXRob2QgPCAyKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8qIHNoYXBlX2NvbXBsZXhpdHlfZXN0aW1hdGlvbl9kaXNhYmxlICovCisgICAgICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAwKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgbXA0ZGVjX2xvZygiRGVjb2RlVk9MSGVhZGVyKCk6IFNoYXBlIENvbXBsZXhpdHkgZXN0aW1hdGlvbiBpcyBub3Qgc3VwcG9ydGVkLlxuIik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvKiB0ZXh0dXJlX2NvbXBsZXhpdHlfZXN0aW1hdGlvbl9zZXRfMV9kaXNhYmxlICovCisgICAgICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAwKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgY3VyclZvbC0+Y29tcGxleGl0eS50ZXh0XzEgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8qIG1hcmtlciBiaXQgKi8KKyAgICAgICAgICAgICAgICBpZiAoIUJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pKSByZXR1cm4gUFZfRkFJTDsKKyAgICAgICAgICAgICAgICAvKiB0ZXh0dXJlX2NvbXBsZXhpdHlfZXN0aW1hdGlvbl9zZXRfMl9kaXNhYmxlICovCisgICAgICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAwKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgY3VyclZvbC0+Y29tcGxleGl0eS50ZXh0XzIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8qIG1vdGlvbl9jb21wZW5zYXRpb25fY29tcGxleGl0eV9kaXNhYmxlICovCisgICAgICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAwKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgY3VyclZvbC0+Y29tcGxleGl0eS5tYyA9IEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA2KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgLyogbWFya2VyIGJpdCAqLworICAgICAgICAgICAgICAgIGlmICghQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpIHJldHVybiBQVl9GQUlMOworCisgICAgICAgICAgICAgICAgaWYgKGN1cnJWb2wtPmNvbXBsZXhpdHlfZXN0TWV0aG9kID09IDEpCisgICAgICAgICAgICAgICAgeyAgIC8qIHZlcnNpb24yX2NvbXBsZXhpdHlfZXN0aW1hdGlvbl9kaXNhYmxlICovCisgICAgICAgICAgICAgICAgICAgIHRtcHZhciA9IEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworICAgICAgICAgICAgICAgICAgICBpZiAodG1wdmFyID09IDApCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1wNGRlY19sb2coIkRlY29kZVZPTEhlYWRlcigpOiBzYWRjdCwgcXVhcnRlciBwZWwgbm90IHN1cHBvcnRlZC5cbiIpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvKiAgMDMvMTAvOTkgKi8KKyAgICAgICAgLyogcmVzeW5jX21hcmtlcl9kaXNhYmxlICovCisgICAgICAgIGN1cnJWb2wtPmVycm9yUmVzRGlzYWJsZSA9IChpbnQpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworICAgICAgICAvKiBkYXRhX3BhcnRpdGl0aW9uZWQgICAgKi8KKyAgICAgICAgY3VyclZvbC0+ZGF0YVBhcnRpdGlvbmluZyA9IChpbnQpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworCisgICAgICAgIHZpZGVvLT52bGNEZWNDb2VmZkludHJhID0gJlZsY0RlY1RDT0VGSW50cmE7CisgICAgICAgIHZpZGVvLT52bGNEZWNDb2VmZkludGVyID0gJlZsY0RlY1RDT0VGSW50ZXI7CisKKyAgICAgICAgaWYgKGN1cnJWb2wtPmRhdGFQYXJ0aXRpb25pbmcpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChsYXllcikgcmV0dXJuIFBWX0ZBSUw7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogICovCisgICAgICAgICAgICAvKiByZXZlcnNpYmxlX3ZsYyAqLworICAgICAgICAgICAgY3VyclZvbC0+dXNlUmV2ZXJzZVZMQyA9IChpbnQpQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICBpZiAoY3VyclZvbC0+dXNlUmV2ZXJzZVZMQykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRyYSA9ICZSdmxjRGVjVENPRUZJbnRyYTsKKyAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRlciA9ICZSdmxjRGVjVENPRUZJbnRlcjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGN1cnJWb2wtPmVycm9yUmVzRGlzYWJsZSA9IDA7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBjdXJyVm9sLT51c2VSZXZlcnNlVkxDID0gMDsKKyAgICAgICAgfQorCisgICAgICAgIGlmICh2ZXJzaW9uX2lkICE9IDEpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIG5ld3ByZWRfZW5hYmxlICovCisgICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKKyAgICAgICAgICAgIGlmICh0bXB2YXIpIHJldHVybiBQVl9GQUlMOworCisgICAgICAgICAgICAvKiByZWR1Y2VkX3Jlc29sdXRpb25fdm9wICovCisgICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKKyAgICAgICAgICAgIGlmICh0bXB2YXIpIHJldHVybiBQVl9GQUlMOworCisgICAgICAgIH0KKworICAgICAgICAvKiBJbnRyYSBBQy9EQyBwcmVkaWN0aW9uIGlzIGFsd2F5cyB0cnVlICovCisgICAgICAgIHZpZGVvLT5pbnRyYV9hY2RjUHJlZERpc2FibGUgPSAwOworICAgICAgICAvKiBzY2FsYWJpbGl0eSAqLworICAgICAgICBjdXJyVm9sLT5zY2FsYWJpbGl0eSA9IChpbnQpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworCisgICAgICAgIGlmIChjdXJyVm9sLT5zY2FsYWJpbGl0eSkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGxheWVyID09IDApICByZXR1cm4gUFZfRkFJTDsgICAgICAgICAgICAgICAgICAgICAvKiAgKi8KKyAgICAgICAgICAgIC8qIGhpZXJhcmNoeV90eXBlOiAxIDogdGVtcG9yYWwsIDAgOiBzcGF0aWFsICovCisgICAgICAgICAgICAvKiAgMDMvMTAvOTkgKi8KKyAgICAgICAgICAgIGN1cnJWb2wtPnNjYWxUeXBlID0gKGludCkgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7ICAgICAgICAgICAgICAvKiAgKi8KKyAgICAgICAgICAgIGlmICghY3VyclZvbC0+c2NhbFR5cGUpIHJldHVybiBQVl9GQUlMOworCisgICAgICAgICAgICAvKiByZWZfbGF5ZXJfaWQgKDQgYml0cykgKi8KKyAgICAgICAgICAgIGN1cnJWb2wtPnJlZlZvbElEID0gKGludCkgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDQpOworICAgICAgICAgICAgaWYgKGxheWVyKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qICAqLworICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChjdXJyVm9sLT5yZWZWb2xJRCAhPSB2aWRlby0+dm9sWzBdLT52b2xJRCkgcmV0dXJuIFBWX0ZBSUw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAvKiByZWZfbGF5ZXJfc2FtcGxpbmdfZGlyZWMgKDEgYml0cykgICAgICAgICAgICAgICovCisgICAgICAgICAgICAvKiAgIDEgOiByZWYuIGxheWVyIGhhcyBoaWdoZXIgcmVzb2x1dGlvbiAgICAgICAgICovCisgICAgICAgICAgICAvKiAgIDAgOiByZWYuIGxheWVyIGhhcyBlcXVhbCBvciBsb3dlciByZXNvbHV0aW9uICovCisgICAgICAgICAgICBjdXJyVm9sLT5yZWZTYW1wRGlyID0gKGludCkgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICBpZiAoY3VyclZvbC0+cmVmU2FtcERpcikgcmV0dXJuIFBWX0ZBSUw7CisKKyAgICAgICAgICAgIC8qIGhvcl9zYW1wbGluZ19mYWN0b3JfbiAoNSBiaXRzKSAqLworICAgICAgICAgICAgY3VyclZvbC0+aG9yU2FtcF9uID0gKGludCkgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDUpOworCisgICAgICAgICAgICAvKiBob3Jfc2FtcGxpbmdfZmFjdG9yX20gKDUgYml0cykgKi8KKyAgICAgICAgICAgIGN1cnJWb2wtPmhvclNhbXBfbSA9IChpbnQpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA1KTsKKworICAgICAgICAgICAgaWYgKGN1cnJWb2wtPmhvclNhbXBfbSA9PSAwKSByZXR1cm4gUFZfRkFJTDsKKyAgICAgICAgICAgIGlmIChjdXJyVm9sLT5ob3JTYW1wX24gIT0gY3VyclZvbC0+aG9yU2FtcF9tKSByZXR1cm4gUFZfRkFJTDsKKworICAgICAgICAgICAgLyogdmVyX3NhbXBsaW5nX2ZhY3Rvcl9uICg1IGJpdHMpICovCisgICAgICAgICAgICBjdXJyVm9sLT52ZXJTYW1wX24gPSAoaW50KSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNSk7CisKKyAgICAgICAgICAgIC8qIHZlcl9zYW1wbGluZ19mYWN0b3JfbSAoNSBiaXRzKSAqLworICAgICAgICAgICAgY3VyclZvbC0+dmVyU2FtcF9tID0gKGludCkgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDUpOworCisgICAgICAgICAgICBpZiAoY3VyclZv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NJWkU7CisgICAgICAgIHZpZGVvLT5uTUJQZXJDb2wgPSB2aWRlby0+aGVpZ2h0IC8gTUJfU0laRTsKKyAgICAgICAgdmlkZW8tPm5Ub3RhbE1CID0gdmlkZW8tPm5NQlBlclJvdyAqIHZpZGVvLT5uTUJQZXJDb2w7CisgICAgICAgIHZpZGVvLT5uQml0c0Zvck1CSUQgPSBDYWxjTnVtQml0cygodWludCl2aWRlby0+blRvdGFsTUIgLSAxKTsKKyNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKKyAgICAgICAgdmlkZW8tPm1vZGlmaWVkX3F1YW50ID0gMDsKKyAgICAgICAgdmlkZW8tPmFkdmFuY2VkX0lOVFJBID0gMDsKKyAgICAgICAgdmlkZW8tPmRlYmxvY2tpbmcgPSAwOworICAgICAgICB2aWRlby0+c2xpY2Vfc3RydWN0dXJlID0gMDsKKyNlbmRpZgorICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICAvKiBTSE9SVF9IRUFERVIgKi8KKyAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtU2hvd0JpdHMzMihzdHJlYW0sIFNIT1JUX1ZJREVPX1NUQVJUX01BUktFUl9MRU5HVEgsICZ0bXB2YXIpOworCisgICAgICAgIGlmICh0bXB2YXIgPT0gU0hPUlRfVklERU9fU1RBUlRfTUFSS0VSKQorICAgICAgICB7CisgICAgICAgICAgICB2aWRlby0+c2hvcnRWaWRlb0hlYWRlciA9IFRSVUU7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBkbworICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8qIFNlYXJjaCBmb3IgVk9MX0hFQURFUiAqLworICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWU2VhcmNoTmV4dE00VkZyYW1lKHN0cmVhbSk7IC8qIHNlYXJjaCAweDAwIDB4MDAgMHgwMSAqLworICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIFBWX0ZBSUw7IC8qIGJyZWFrcyB0aGUgbG9vcCAqLworICAgICAgICAgICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMzIoc3RyZWFtLCBWT0xfU1RBUlRfQ09ERV9MRU5HVEgsICZ0bXB2YXIpOworICAgICAgICAgICAgICAgIFBWX0JpdHN0cmVhbUZsdXNoQml0cyhzdHJlYW0sIDgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgd2hpbGUgKHRtcHZhciAhPSBWT0xfU1RBUlRfQ09ERSk7CisgICAgICAgICAgICBnb3RvIGRlY29kZV92b2w7CisgICAgICAgIH0KKyAgICB9CisjaWZkZWYgUFZfVE9MRVJBVEVfVk9MX0VSUk9SUworICAgIGlmIChwcm9maWxlID4gMHhGRiB8fCBwcm9maWxlID09IDApCisgICAgeworICAgICAgICByZXR1cm4gUFZfQkFEX1ZPTEhFQURFUjsKKyAgICB9CisjZW5kaWYKKworICAgIHJldHVybiBzdGF0dXM7Cit9CisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEJlZ2luKioqKioqCisqCisqIC0tIERlY29kZUdPViAtLSBEZWNvZGVzIHRoZSBHcm91cCBvZiBWT1BzIGZyb20gYml0c3RyZWFtCisqCisqICAgMDQvMjAvMjAwMCAgaW5pdGlhbCBtb2RpZmljYXRpb24gdG8gdGhlIG5ldyBQVi1EZWNvZGVyIExpYiBmb3JtYXQuCisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRFbmQqKioqKioqKi8KK1BWX1NUQVRVUyBEZWNvZGVHT1ZIZWFkZXIoQml0c3RyZWFtRGVjVmlkZW8gKnN0cmVhbSwgdWludDMyICp0aW1lX2Jhc2UpCit7CisgICAgdWludDMyIHRtcHZhciwgdGltZV9zOworICAgIGludCBjbG9zZWRfZ292LCBicm9rZW5fbGluaz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hc2UvMTAwMDsKKy8vICB0bXB2YXIgPSB0aW1lX3MgLSAqdGltZV9iYXNlOworLy8gIGlmICh0bXB2YXIgPD0gNjApICp0aW1lX2Jhc2UgPSB0aW1lX3M7CisvLyAgZWxzZSByZXR1cm4gUFZfRkFJTDsKKworICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworICAgIGNsb3NlZF9nb3YgPSB0bXB2YXI7CisgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgYnJva2VuX2xpbmsgPSB0bXB2YXI7CisKKyAgICBpZiAoKGNsb3NlZF9nb3YgPT0gMCkgJiYgKGJyb2tlbl9saW5rID09IDEpKQorICAgIHsKKyAgICAgICAgcmV0dXJuIFBWX1NVQ0NFU1M7ICAgICAgICAvKiAgMDMvMTUvMjAwMiAgeW91IGNhbiBhbHNvIHJldHVybiBQVl9GQUlMICovCisgICAgfQorCisgICAgUFZfQml0c3RyZWFtQnl0ZUFsaWduKHN0cmVhbSk7CisKKyAgICBCaXRzdHJlYW1TaG93Qml0czMySEMoc3RyZWFtLCAmdG1wdmFyKTsKKworICAgIHdoaWxlICh0bXB2YXIgPT0gVVNFUl9EQVRBX1NUQVJUX0NPREUpICAgICAgIC8qICAwMy8xNS8yMDAyICovCisgICAgeworICAgICAgICBEZWNvZGVVc2VyRGF0YShzdHJlYW0pOworICAgICAgICBCaXRzdHJlYW1TaG93Qml0czMySEMoc3RyZWFtLCAmdG1wdmFyKTsKKyAgICB9CisKKyAgICByZXR1cm4gUFZfU1VDQ0VTUzsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEJlZ2luKioqKioqCisqCisqIC0tIERlY29kZVZvcEhlYWRlciAtLSBEZWNvZGVzIHRoZSBWT1BoZWFkZXIgaW5mb3JtYXRpb24gZnJvbSB0aG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WFkMUJpdHMoc3RyZWFtKTsKKworCisgICAgaWYgKGN1cnJWb3AtPnZvcENvZGVkID09IDApCisgICAgeworICAgICAgICBzdGF0dXMgPSBQVl9TVUNDRVNTOworICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICB9CisKKworICAgIC8qIHJlYWQgdm9wX3JvdW5kaW5nX3R5cGUgKi8KKyAgICBpZiAoY3VyclZvcC0+cHJlZGljdGlvblR5cGUgPT0gUF9WT1ApCisgICAgeworICAgICAgICBjdXJyVm9wLT5yb3VuZGluZ1R5cGUgPSAoaW50KSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKKyAgICB9CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgY3VyclZvcC0+cm91bmRpbmdUeXBlID0gMDsKKyAgICB9CisKKyAgICBpZiAoY3VyclZvbC0+Y29tcGxleGl0eV9lc3REaXNhYmxlID09IDApCisgICAgeworICAgICAgICBpZiAoY3VyclZvbC0+Y29tcGxleGl0eV9lc3RNZXRob2QgPCAyKSAgIC8qICAgT0NUIDIwMDIgKi8KKyAgICAgICAgeworICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5LnRleHRfMSA+PiAzKSAmIDB4MSkgICAgLyogaW50cmEgICAgICAgICovCisgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgaWYgKGN1cnJWb2wtPmNvbXBsZXhpdHkudGV4dF8xICYgMHgxKSAgICAgICAgICAgLyogbm90X2NvZGVkICAgICovCisgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5LnRleHRfMiA+PiAzKSAmIDB4MSkgICAgLyogZGN0X2NvZWZzICAgICovCisgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5LnRleHRfMiA+PiAyKSAmIDB4MSkgICAgLyogZGN0X2xpbmVzICAgICovCisgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5LnRleHRfMiA+PiAxKSAmIDB4MSkgICAgLyogdmxjX3N5bWJvbHMgICovCisgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgaWYgKGN1cnJWb2wtPmNvbXBsZXhpdHkudGV4dF8yICYgMHgxKSAgICAgICAgICAgLyogdmxjX2JpdHMgICAgICovCisgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDQpOworCisgICAgICAgICAgICBpZiAoY3VyclZvcC0+cHJlZGljdGlvblR5cGUgIT0gSV9WT1ApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5LnRleHRfMSA+PiAyKSAmIDB4MSkgICAgLyogaW50ZXIgICAgKi8KKyAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgICAgIGlmICgoY3VyclZvbC0+Y29tcGxleGl0eS50ZXh0XzEgPj4gMSkgJiAweDEpICAgIC8qIGludGVyXzR2ICovCisgICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKKyAgICAgICAgICAgICAgICBpZiAoKGN1cnJWb2wtPmNvbXBsZXhpdHkubWMgPj4gNSkgJiAweDEpICAgICAgICAvKiBhcG0gICAgICAqLworICAgICAgICAgICAgICAgICAgICBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOCk7CisgICAgICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5Lm1jID4+IDQpICYgMHgxKSAgICAgICAgLyogbnBtICAgICAgKi8KKyAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgICAgIC8qIGludGVycG9sYXRlX21jX3EgKi8KKyAgICAgICAgICAgICAgICBpZiAoKGN1cnJWb2wtPmNvbXBsZXhpdHkubWMgPj4gMikgJiAweDEpICAgICAgICAvKiBmb3J3X2JhY2tfbWNfcSAqLworICAgICAgICAgICAgICAgICAgICBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOCk7CisgICAgICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5Lm1jID4+IDEpICYgMHgxKSAgICAgICAgLyogaGFsZnBlbDIgKi8KKyAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgICAgIGlmIChjdXJyVm9sLT5jb21wbGV4aXR5Lm1jICYgMHgxKSAgICAgICAgICAgICAgIC8qIGhhbGZwZWw0ICovCisgICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChjdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9PSBCX1ZPUCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoKGN1cnJWb2wtPmNvbXBsZXhpdHkubWMgPj4gMykgJiAweDEpICAgICAgICAvKiBpbnRlcnBvbGF0ZV9tY19xICovCisgICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qIHJlYWQgaW50cmFfZGNfdmxjX3RociAqLworICAgIGN1cnJWb3AtPmludHJhRENWbGNUaHIgPSAoaW50KSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMyk7CisKKyAgICAvKiByZWFkIHZvcF9xdWFudCAoY3VyclZvbC0+cXVhbnRQcmVjaXNpb24gYml0cykgKi8KKyAgICBjdXJyVm9wLT5xdWFudGl6ZXIgPSAoaW50MTYpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCBjdXJyVm9sLT5xdWFudFByZWNpc2lvbik7CisgICAgaWYgKGN1cnJWb3AtPnF1YW50aXplciA9PSAwKQorICAgIHsKKyAgICAgICAgY3VyclZvcC0+cXVhbnRpemVyID0gdmlkZW8tPnByZXZWb3AtPnF1YW50aXplcjsKKyAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgfQorCisKKyAgICAvKiByZWFkIHZvcF9mY29kZV9mb3J3YXJkICovCisgICAgaWYgKGN1cnJWb3AtPnByZWRpY3Rpb25UeXBlICE9IElfVk9QKQorICAgIHsKKyAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpOworICAgICAgICBpZiAodG1wdmFyIDwgMSkKKyAgICAgICAgeworICAgICAgICAgICAgY3VyclZvcC0+ZmNvZGVGb3J3YXJkID0gMTsKKyAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgfQorICAgICAgICBjdXJyVm9wLT5mY29kZUZvcndhcmQgPSB0bXB2YXI7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIGN1cnJWb3AtPmZjb2RlRm9yd2FyZCA9IDA7CisgICAgfQorCisgICAgLyogcmVhZCB2b3BfZmNvZGVfYmFja3dhcmQgKi8KKyAgICBpZiAoY3VyclZvcC0+cHJlZGljdGlvblR5cGUgPT0gQl9WT1ApCisgICAgeworICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMyk7CisgICAgICAgIGlmICh0bXB2YXIgPCAxKQorICAgICAgICB7CisgICAgICAgICAgICBjdXJyVm9wLT5mY29kZUJhY2t3YXJkID0gMTsKKyAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgfQorICAgICAgICBjdXJyVm9wLT5mY29kZUJhY2t3YXJkID0gdG1wdmFyOworICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICBjdXJyVm9wLT5mY29kZUJhY2t3YXJkID0gMDsKKyAgICB9CisKKyAgICBpZiAoY3VyclZvbC0+c2NhbGFiaWxpdHkpCisgICAgeworICAgICAgICBjdXJyVm9wLT5yZWZTZWxlY3RDb2RlID0gKGludCkgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDIpOworICAgIH0KKworcmV0dXJuX3BvaW50OgorICAgIHJldHVybiBzdGF0dXM7Cit9CisKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEJlZ2luKioqKioqCisqCisqIC0tIFZpZGVvUGxhbmVXaXRoU2hvcnRIZWFkZXIgLS0gRGVjb2RlcyB0aGUgc2hvcnRfdmlkZW9faGVhZGVyIGluZm9ybWF0aW9uIGZyb20gdGhlIGJpdHN0cmVhbQorKiBNb2RpZmllZCA6CisgICAgICAgICAgICAgMDQvMjMvMjAwMS4gIFJlbW92ZSB0aGUgY29kZXMgcmVsYXRlZCB0byB0aGUKKyAgICAgICAgICAgICAgICAgImZpcnN0IHBhc3MiIGRlY29kaW5nLiAgV2UgdXNlIGEgZGlmZmVyZW50IGZ1bmN0aW9uCisgICAgICAgICAgICAgICAgIHRvIHNldCB1cCB0aGUgZGVjb2RlciBub3cuCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq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1lcmEgbm90IHN1cHBvcnRlZC5cbiIpOworICAgICAgICBWaWRlb0RlY29kZXJFcnJvckRldGVjdGVkKHZpZGVvKTsKKyAgICB9CisKKyAgICAvKmZyZWV6ZV9waWN0dXJlX3JlbGVhc2UqLworICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKKyAgICB7CisgICAgICAgIG1wNGRlY19sb2coIkRlY29kZVNob3J0SGVhZGVyKCk6IEZyZWV6ZSBSZWxlYXNlIG5vdCBzdXBwb3J0ZWQuXG4iKTsKKyAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7CisgICAgfQorICAgIC8qIHNvdXJjZSBmb3JtYXQgKi8KKyAgICBzd2l0Y2ggKEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAzKSkKKyAgICB7CisgICAgICAgIGNhc2UgMToKKyAgICAgICAgICAgIGlmICh2aWRlby0+c2l6ZSA8IDEyOCo5NikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICAgICAgfQorICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9ICAxMjg7CisgICAgICAgICAgICB2aWRlby0+ZGlzcGxheUhlaWdodCA9IHZpZGVvLT5oZWlnaHQgID0gOTY7CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIDI6CisgICAgICAgICAgICBpZiAodmlkZW8tPnNpemUgPCAxNzYqMTQ0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gdmlkZW8tPndpZHRoICA9IDE3NjsKKyAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gdmlkZW8tPmhlaWdodCAgPSAxNDQ7CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIDM6CisgICAgICAgICAgICBpZiAodmlkZW8tPnNpemUgPCAzNTIqMjg4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gdmlkZW8tPndpZHRoID0gMzUyOworICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlIZWlnaHQgPSB2aWRlby0+aGVpZ2h0ID0gMjg4OworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSA0OgorICAgICAgICAgICAgaWYgKHZpZGVvLT5zaXplIDwgNzA0KjU3NikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICAgICAgfQorICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9IDcwNDsKKyAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gdmlkZW8tPmhlaWdodCA9IDU3NjsKKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGNhc2UgNToKKyAgICAgICAgICAgIGlmICh2aWRlby0+c2l6ZSA8IDE0MDgqMTE1MikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICAgICAgfQorICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9IDE0MDg7CisgICAgICAgICAgICB2aWRlby0+ZGlzcGxheUhlaWdodCA9IHZpZGVvLT5oZWlnaHQgPSAxMTUyOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSA3OgorICAgICAgICAgICAgZXh0ZW5kZWRfUFRZUEUgPSBUUlVFOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIC8qIE1zZygiSC4yNjMgc291cmNlIGZvcm1hdCBub3QgbGVnYWxcbiIpOyAqLworICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgIH0KKworCisgICAgY3VyclZvcC0+cm91bmRpbmdUeXBlID0gMDsKKworICAgIGlmIChleHRlbmRlZF9QVFlQRSA9PSBGQUxTRSkKKyAgICB7CisgICAgICAgIGN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID0gKGludCkgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisKKyAgICAgICAgLyogZm91cl9yZXNlcnZlZF96ZXJvX2JpdHMgKi8KKyAgICAgICAgaWYgKEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA0KSkKKyAgICAgICAgeworICAgICAgICAgICAgbXA0ZGVjX2xvZygiRGVjb2RlU2hvcnRIZWFkZXIoKTogUmVzZXJ2ZWQgYml0cyB3cm9uZy5cbiIpOworICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICB9CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIFVGRVAgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMyk7CisgICAgICAgIGlmIChVRkVQID09IDEpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIHNvdXJjZSBmb3JtYXQgKi8KKyAgICAgICAgICAgIHN3aXRjaCAoQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNhc2UgMToKKyAgICAgICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5zaXplIDwgMTI4Kjk2KQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9ICAxMjg7CisgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gdmlkZW8tPmhlaWdodCAgPSA5NjsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIDI6CisgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby0+c2l6ZSA8IDE3NioxNDQpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gdmlkZW8tPndpZHRoICA9IDE3NjsKKyAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlIZWlnaHQgPSB2aWRlby0+aGVpZ2h0ICA9IDE0NDsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIDM6CisgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby0+c2l6ZSA8IDM1MioyODgpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gdmlkZW8tPndpZHRoID0gMzUyOworICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGlzcGxheUhlaWdodCA9IHZpZGVvLT5oZWlnaHQgPSAyODg7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSA0OgorICAgICAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnNpemUgPCA3MDQqNTc2KQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9IDcwNDsKKyAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlIZWlnaHQgPSB2aWRlby0+aGVpZ2h0ID0gNTc2OworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgNToKKyAgICAgICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5zaXplIDwgMTQwOCoxMTUyKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9IDE0MDg7CisgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gdmlkZW8tPmhlaWdodCA9IDExNTI7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSA2OgorICAgICAgICAgICAgICAgICAgICBjdXN0b21fUEZNVCA9IFRSVUU7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgLyogTXNnKCJILjI2MyBzb3VyY2UgZm9ybWF0IG5vdCBsZWdhbFxuIik7ICovCisgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBjdXN0b21fUENGID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisgICAgICAgICAgICAvKiB1bnJlc3RyaWN0ZWQgTVYgKi8KKyAgICAgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICAgICAgfQorICAgICAgICAgICAgLyogU0FDICovCisgICAgICAgICAgICBpZiAoQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLyogQVAgKi8KKyAgICAgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2aWRlby0+YWR2YW5jZWRfSU5UUkEgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKKworICAgICAgICAgICAgdmlkZW8tPmRlYmxvY2tpbmcgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKKworICAgICAgICAgICAgdmlkZW8tPnNsaWNlX3N0cnVjdHVyZSA9IEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworCisgICAgICAgICAgICAvKiBSUFMsIElTRCwgQUlWICovCisgICAgICAgICAgICBpZiAoQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2aWRlby0+bW9kaWZpZWRfcXVhbnQgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKKworICAgICAgICAgICAgLyogTWFya2VyIEJpdCBhbmQgcmVzZXJ2ZWQqLworICAgICAgICAgICAgaWYgKEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA0KSAhPSA4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyNpZm5kZWYgUFZfQU5ORVhfSUpLVF9TVVBQT1JUCisgICAgICAgIGlmICh2aWRlby0+YWR2YW5jZWRfSU5UUkEgfCB2aWRlby0+ZGVibG9ja2luZyB8IHZpZGVvLT5tb2RpZmllZF9xdWFudCB8IHZpZGVvLT5tb2RpZmllZF9xdWFudCkKKyAgICAgICAgeworICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICB9CisjZW5kaWYKKworICAgICAgICBpZiAoVUZFUCA9PSAwIHx8IFVGRVAgPT0gMSkKKyAgICAgICAgeworICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpOworICAgICAgICAgICAgaWYgKHRtcHZhciA+IDEpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID0gdG1wdmFyOworICAgICAgICAgICAgLyogUlBSICovCisgICAgICAgICAgICBpZiAoQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLyogUlJVICovCisgICAgICAgICAgICBpZiAoQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGN1cnJWb3AtPnJvdW5kaW5nVHlwZSA9IChpbnQpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworICAgICAgICAgICAgaWYgKEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAzKSAhPSAxKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgIH0KKyAgICAgICAgLyogQ1BNICovCisgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKKyAgICAgICAgeworICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICB9CisgICAgICAgIC8qIENQRk1UICovCisgICAgICAgIGlmIChjdXN0b21fUEZNVCA9PSAxICYmIFVGRVAgPT0gMSkKKyAgICAgICAgeworICAgICAgICAgICAgLyogYXNwZWN0IHJhdGlvICovCisgICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNCk7CisgICAgICAgICAgICBpZiAodG1wdmFyID09IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8qIEV4dGVuZGVkIFBBUiAqLworICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAweEYpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLyogUmVhZCBwYXJfd2lkdGggYW5kIHBhcl9oZWlnaHQgYnV0IGRvIG5vdGhpbmcgKi8KKyAgICAgICAgICAgICAgICAvKiBwYXJfd2lkdGggKi8KKyAgICAgICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOCk7CisKKyAgICAgICAgICAgICAgICAvKiBwYXJfaGVpZ2h0ICovCisgICAgICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDkpOworCisgICAgICAgICAgICBpbnQgdG1wRGlzcGxheVdpZHRoID0gKHRtcHZhciArIDEpIDw8IDI7CisgICAgICAgICAgICAvKiBtYXJrZXIgYml0ICovCisgICAgICAgICAgICBpZiAoIUJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOSk7CisgICAgICAgICAgICBpZiAodG1wdmFyID09IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGludCB0bXBEaXNwbGF5SGVpZ2h0ID0gdG1wdmFyIDw8IDI7CisgICAgICAgICAgICBpbnQgdG1wSGVpZ2h0ID0gKHRtcERpc3BsYXlIZWlnaHQgKyAxNSkgJiAtMTY7CisgICAgICAgICAgICBpbnQgdG1wV2lkdGggPSAodG1wRGlzcGxheVdpZHRoICsgMTUpICYgLTE2OworCisgICAgICAgICAgICBpZiAodG1wV2lkdGggPiB2aWRlby0+d2lkdGgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLy8gd2hpbGUgYWxsb3dlZCBieSB0aGUgc3BlYywgdGhpcyBkZWNvZGVyIGRvZXMgbm90IGFjdHVhbGx5CisgICAgICAgICAgICAgICAgLy8gc3VwcG9ydCBhbiBpbmNyZWFzZSBpbiBzaXplLgorICAgICAgICAgICAgICAgIEFMT0dFKCJ3aWR0aCBpbmNyZWFzZSBub3Qgc3VwcG9ydGVkIik7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICh0bXBIZWlnaHQgKiB0bXBXaWR0aCA+IHZpZGVvLT5zaXplKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMganVzdCBwb3NzaWJseSAiYi8zNzA3OTI5NiIuCisgICAgICAgICAgICAgICAgQUxPR0UoImIvMzcwNzkyOTYiKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICAgICAgfQorICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHRtcERpc3BsYXlXaWR0aDsKKyAgICAgICAgICAgIHZpZGVvLT53aWR0aCA9IHRtcFdpZHRoOworICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlIZWlnaHQgPSB0bXBEaXNwbGF5SGVpZ2h0OworICAgICAgICAgICAgdmlkZW8tPmhlaWdodCA9IHRtcEhlaWdodDsKKworICAgICAgICAgICAgdmlkZW8tPm5Ub3RhbE1CID0gdmlkZW8tPndpZHRoIC8gTUJfU0laRSAqIHZpZGVvLT5oZWlnaHQgLyBNQl9TSVpFOworCisgICAgICAgICAgICBpZiAodmlkZW8tPm5Ub3RhbE1CIDw9IDQ4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZpZGVvLT5uQml0c0Zvck1CSUQgPSA2OworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZiAodmlkZW8tPm5Ub3RhbE1CIDw9IDk5KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZpZGVvLT5uQml0c0Zvck1CSUQgPSA3OworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZiAodmlkZW8tPm5Ub3RhbE1CIDw9IDM5NikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2aWRlby0+bkJpdHNGb3JNQklEID0gOTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYgKHZpZGVvLT5uVG90YWxNQiA8PSAxNTg0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZpZGVvLT5uQml0c0Zvck1CSUQgPSAxMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYgKHZpZGVvLT5uVG90YWxNQiA8PSA2MzM2KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZpZGVvLT5uQml0c0Zvck1CSUQgPSAxMyA7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmICh2aWRlby0+blRvdGFsTUIgPD0gOTIxNikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2aWRlby0+bkJpdHNGb3JNQklEID0gMTQgOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKFVGRVAgPT0gMSAmJiBjdXN0b21fUENGID09IDEpCisgICAgICAgIHsKKyAgICAgICAgICAgIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOworCisgICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNyk7CisgICAgICAgICAgICBpZiAodG1wdmFyID09IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChjdXN0b21fUENGID09IDEpCisgICAgICAgIHsKKyAgICAgICAgICAgIGN1cnJWb3AtPkVUUiA9IEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAyKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChVRkVQID09IDEgJiYgdmlkZW8tPnNsaWNlX3N0cnVjdHVyZSA9PSAxKQorICAgICAgICB7CisgICAgICAgICAgICAvKiBTU1MgKi8KKyAgICAgICAgICAgIHRtcHZhciA9IEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAyKTsKKyAgICAgICAgICAgIGlmICh0bXB2YXIgIT0gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyogUmVjYWxjdWxhdGUgbnVtYmVyIG9mIG1hY3JvYmxvY2tzIHBlciByb3cgJiBjb2wgc2luY2UgKi8KKyAgICAvKiAgdGhlIGZyYW1lIHNpemUgY2FuIGNoYW5nZS4gICAgICAgICAgIDA0LzIzLzIwMDEuICAgKi8KKyAgICB2aWRlby0+bk1CaW5HT0IgPSB2aWRlby0+bk1CUGVyUm93ID0gdmlkZW8tPndpZHRoIC8gTUJfU0laRTsKKyAgICB2aWRlby0+bkdPQmluVm9wID0gdmlkZW8tPm5NQlBlckNvbCA9IHZpZGVvLT5oZWlnaHQgLyBNQl9TSVpFOworICAgIHZpZGVvLT5uVG90YWxNQiA9IHZpZGVvLT5uTUJQZXJSb3cgKiB2aWRlby0+bk1CUGVyQ29sOworICAgIGlmIChjdXN0b21fUEZNVCA9PSAwICB8fCBVRkVQID09IDApCisgICAgeworICAgICAgICB2aWRlby0+bkJpdHNGb3JNQklEID0gQ2FsY051bUJpdHMoKHVpbnQpdmlkZW8tPm5Ub3RhbE1CIC0gMSk7IC8qIG90aGVyd2lzZSBjYWxjdWxhdGUgYWJvdmUgKi8KKyAgICB9CisgICAgc2l6ZSA9IChpbnQzMil2aWRlby0+d2lkdGggKiB2aWRlby0+aGVpZ2h0OworICAgIGlmIChjdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9PSBQX1ZPUCAmJiBzaXplID4gdmlkZW8tPnZpZGVvRGVjQ29udHJvbHMtPnNpemUpCisgICAgeworICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKKyAgICB9CisgICAgdmlkZW8tPnZpZGVvRGVjQ29udHJvbHMtPnNpemUgPSBzaXplOworICAgIHZpZGVvLT5jdXJyVm9wLT51Q2hhbiA9IHZpZGVvLT5jdXJyVm9wLT55Q2hhbiArIHNpemU7CisgICAgdmlkZW8tPmN1cnJWb3AtPnZDaGFuID0gdmlkZW8tPmN1cnJWb3AtPnVDaGFuICsgKHNpemUgPj4gMik7CisgICAgdmlkZW8tPnByZXZWb3AtPnVDaGFuID0gdmlkZW8tPnByZXZWb3AtPnlDaGFuICsgc2l6ZTsKKyAgICB2aWRlby0+cHJldlZvcC0+dkNoYW4gPSB2aWRlby0+cHJldlZvcC0+dUNoYW4gKyAoc2l6ZSA+PiAyKTsKKworCisgICAgY3VyclZvcC0+cXVhbnRpemVyID0gKGludDE2KSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNSk7CisKKyAgICBpZiAoY3VyclZvcC0+cXVhbnRpemVyID09IDApICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAgMDQvMDMvMDEgKi8KKyAgICB7CisgICAgICAgIGN1cnJWb3AtPnF1YW50aXplciA9IHZpZGVvLT5wcmV2Vm9wLT5xdWFudGl6ZXI7CisgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7CisgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgIH0KKworCisgICAgLyogWmVybyBiaXQgKi8KKyAgICBpZiAoZXh0ZW5kZWRfUFRZUEUgPT0gRkFMU0UpCisgICAgeworICAgICAgICBpZiAoQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpCisgICAgICAgIHsKKyAgICAgICAgICAgIG1wNGRlY19sb2coIkRlY29kZVNob3J0SGVhZGVyKCk6IFplcm8gYml0IHdyb25nLlxuIik7CisgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgIH0KKyAgICB9CisgICAgLyogcGVpICovCisgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7CisKKyAgICB3aGlsZSAodG1wdmFyKQorICAgIHsKKyAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOyAvKiAiUFNQQVJFIiAqLworICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsgLyogIlBFSSIgKi8KKyAgICB9CisKKyAgICBpZiAodmlkZW8tPnNsaWNlX3N0cnVjdHVyZSkgIC8qIEFOTkVYX0sgKi8KKyAgICB7CisgICAgICAgIGlmICghQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpICAvKiBTRVBCMSAqLworICAgICAgICB7CisgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOworICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7CisgICAgICAgIH0KKworICAgICAgICAvLyAgaWYgKGN1cnJWb2wtPm5CaXRzRm9yTUJJRCAvLworICAgICAgICBpZiAoQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIHZpZGVvLT5uQml0c0Zvck1CSUQpKQorICAgICAgICB7CisgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOyAgICAgICAgICAgICAvKiBubyBBU08sIFJTIHN1cHBvcnQgZm9yIEFubmV4IEsgKi8KKyAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICB9CisKKyAgICAgICAgaWYgKCFCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkgIC8qU0VQQjMgKi8KKyAgICAgICAgeworICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKKyAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OworICAgICAgICB9CisKKyAgICB9CisgICAgLyogU2V0dGluZyBvZiBvdGhlciBWT1AtaGVhZGVyIHBhcmFtZXRlcnMgKi8KKyAgICBjdXJyVm9wLT5nb2JOdW1iZXIgPSAwOworICAgIGN1cnJWb3AtPnZvcENvZGVkID0gMTsKKworICAgIGN1cnJWb3AtPmludHJhRENWbGNUaHIgPSAwOworICAgIGN1cnJWb3AtPmdvYkZyYW1lSUQgPSAwOyAvKiBpbml0aWFsIHZhbHVlLCAgMDUvMjIvMDAgKi8KKyAgICBjdXJyVm9sLT5lcnJvclJlc0Rpc2FibGUgPSAwOworICAgIC8qUHV0Vm9wSW50ZXJsYWNlZCgwLGN1cnJfdm9wKTsgbm8gaW1wbGVtZW50ZWQgeWV0ICovCisgICAgaWYgKGN1cnJWb3AtPnByZWRpY3Rpb25UeXBlICE9IElfVk9QKQorICAgICAgICBjdXJyVm9wLT5mY29kZUZvcndhcmQgPSAxOworICAgIGVsc2UKKyAgICAgICAgY3VyclZvcC0+ZmNvZGVGb3J3YXJkID0gMDsKKworcmV0dXJuX3BvaW50OgorCisgICAgcmV0dXJuIHN0YXR1czsKK30KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRCZWdpbioqKioqKgorKgorKiAtLSBQVl9EZWNvZGVWb3AgLS0gRGVjb2RlcyB0aGUgVk9QIGluZm9ybWF0aW9uIGZyb20gdGhlIGJpdHN0cmVhbQorKgorKiAgIDA0LzEyLzIwMDAKKyogICAgICAgICAgICAgICAgICAgSW5pdGlhbCBwb3J0IHRvIHRoZSBuZXcgUFYgZGVjb2RlciBsaWJyYXJ5IGZvcm1hdC4KKyogICAgICAgICAgICAgICAgICAgVGhpcyBmdW5jdGlvbiBpcyBkaWZmZXJlbnQgZnJvbSB0aGUgb25lIGluIE1vTXVTeXMgTVBFRy00CisqICAgICAgICAgICAgICAgICAgIHZpc3VhbCBkZWNvZGVyLiAgV2UgaGFuZGxlIGNvbWJpbmVkIG1vZGUgd2l0aCBvciB3aXRocHV0CisqICAgICAgICAgICAgICAgICAgIGVycm9yIHJlc2lsaWVuY2UgYW5kIEguMjYzIG1vZGUgdGhyb3VnaCB0aGUgc2FtIHBhdGggbm93LgorKgorKiAgIDA1LzA0LzIwMDAKKyogICAgICAgICAgICAgICAgICAgQWRkZWQgdGVtcG9yYWwgc2NhbGFiaWxpdHkgdG8gdGhlIGRlY29kZXIuCisqCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRFbmQqKioqKioqKi8KK1BWX1NUQVRVUyBQVl9EZWNvZGVWb3AoVmlkZW9EZWNEYXRhICp2aWRlbykKK3sKKyAgICBWb2wgKmN1cnJWb2wgPSB2aWRlby0+dm9sW3ZpZGVvLT5jdXJyTGF5ZXJdOworICAgIFBWX1NUQVRVUyBzdGF0dXM7CisgICAgdWludDMyIHRtcHZhcjsKKworICAgIC8qKioqKgorICAgICogICBEbyBzY2FsYWJsZSBvciBub24tc2NhbGFibGUgZGVjb2Rpbmcgb2YgdGhlIGN1cnJlbnQgVk9QCisgICAgKioqKiovCisKKyAgICBpZiAoIWN1cnJWb2wtPnNjYWxhYmlsaXR5KQorICAgIHsKKyAgICAgICAgaWYgKGN1cnJWb2wtPmRhdGFQYXJ0aXRpb25pbmcpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8qIERhdGEgcGFydGl0aW9uaW5nIG1vZGUgY29tZXMgaGVyZSAqLworICAgICAgICAgICAgc3RhdHVzID0gRGVjb2RlRnJhbWVEYXRhUGFydE1vZGUodmlkZW8pOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgLyogQ29tYmluZWQgbW9kZSB3aXRoIG9yIHdpdGhvdXQgZXJyb3IgcmVzaWxpZW5jZSAqLworICAgICAgICAgICAgLyogICAgYW5kIHNob3J0IHZpZGVvIGhlYWRlciBjb21lcyBoZXJlLiAgICAgICAgICAqLworICAgICAgICAgICAgc3RhdHVzID0gRGVjb2RlRnJhbWVDb21iaW5lZE1vZGUodmlkZW8pOworICAgICAgICB9CisgICAgfQorICAgIGVsc2UKKyAgICB7CisjaWZkZWYgRE9fTk9UX0ZPTExPV19TVEFOREFSRAorICAgICAgICAvKiBhY2NvcmRpbmcgdG8gdGhlIHN0YW5kYXJkLCBvbmx5IGNvbWJpbmVkIG1vZGUgaXMgYWxsb3dlZCAqLworICAgICAgICAvKiAgICBpbiB0aGUgZW5oYW5jZW1lbnQgbGF5ZXIuICAgICAgICAgIDA2LzAxLzIwMDAuICAgICAgICAqLworICAgICAgICBpZiAoY3VyclZvbC0+ZGF0YVBhcnRpdGlvbmluZykKKyAgICAgICAgeworICAgICAgICAgICAgLyogRGF0YSBwYXJ0aXRpb25pbmcgbW9kZSBjb21lcyBoZXJlICovCisgICAgICAgICAgICBzdGF0dXMgPSBEZWNvZGVGcmFtZURhdGFQYXJ0TW9kZSh2aWRlbyk7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICAvKiBDb21iaW5lZCBtb2RlIHdpdGggb3Igd2l0aG91dCBlcnJvciByZXNpbGllbmNlICovCisgICAgICAgICAgICAvKiAgICBhbmQgc2hvcnQgdmlkZW8gaGVhZGVyIGNvbWVzIGhlcmUuICAgICAgICAgICovCisgICAgICAgICAgICBzdGF0dXMgPSBEZWNvZGVGcmFtZUNvbWJpbmVkTW9kZSh2aWRlbyk7CisgICAgICAgIH0KKyNlbHNlCisgICAgICAgIHN0YXR1cyA9IERlY29kZUZyYW1lQ29tYmluZWRNb2RlKHZpZGVvKTsKKyNlbmRpZgorICAgIH0KKworICAgIC8qIFRoaXMgcGFydCBpcyBmb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AgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gc3RhdHVzOworfQorCisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRCZWdpbioqKioqKgorKgorKiAtLSBDYWxjVm9wRGlzcGxheVRpbWUgLS0gY2FsY3VsYXRlIGFic29sdXRlIHRpbWUgd2hlbiBWT1AgaXMgdG8gYmUgZGlzcGxheWVkCisqCisqICAgMDQvMTIvMjAwMCBJbml0aWFsIHBvcnQgdG8gdGhlIG5ldyBQViBkZWNvZGVyIGxpYnJhcnkgZm9ybWF0LgorKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipDb21tZW50RW5kKioqKioqKiovCit1aW50MzIgQ2FsY1ZvcERpc3BsYXlUaW1lKFZvbCAqY3VyclZvbCwgVm9wICpjdXJyVm9wLCBpbnQgc2hvcnRWaWRlb0hlYWRlcikKK3sKKyAgICB1aW50MzIgZGlzcGxheV90aW1lOworCisKKyAgICAvKioqKioKKyAgICAqICAgQ2FsY3VsYXRlIHRoZSB0aW1lIHdoZW4gdGhlIFZPUCBpcyB0byBiZSBkaXNwbGF5ZWQgbmV4dAorICAgICoqKioqLworCisgICAgaWYgKCFzaG9ydFZpZGVvSGVhZGVyKQorICAgIHsKKyAgICAgICAgZGlzcGxheV90aW1lID0gKHVpbnQzMikoY3VyclZvbC0+bW9kdWxvVGltZUJhc2UgKyAoKChpbnQzMiljdXJyVm9wLT50aW1lSW5jIC0gKGludDMyKWN1cnJWb2wtPnRpbWVJbmNfb2Zmc2V0KSAqIDEwMDApIC8gKChpbnQzMiljdXJyVm9sLT50aW1lSW5jcmVtZW50UmVzb2x1dGlvbikpOyAgLyogIDExLzEyLzIwMDEgKi8KKyAgICAgICAgaWYgKGN1cnJWb3AtPnRpbWVTdGFtcCA+PSBkaXNwbGF5X3RpbWUpCisgICAgICAgIHsKKy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YSBzaW5nbGUgYHRlc3RjYXNlc2AgZGlyZWN0b3J5LgorICAgIGNvbXBpbGVfbXVsdGlsaWI6ICJib3RoIiwKKyAgICBtdWx0aWxpYjogeworICAgICAgICBsaWIzMjogeworICAgICAgICAgICAgc3VmZml4OiAiMzIiLAorICAgICAgICB9LAorICAgICAgICBsaWI2NDogeworICAgICAgICAgICAgc3VmZml4OiAiNjQiLAorICAgICAgICB9LAorICAgIH0sCisKKyAgICAvLyB0aGlzIHVuaXQgdGVzdCBhbHNvIHJ1bnMgd2l0aGluIHRoZSBtYWlubGluZSB0ZXN0cyAoTVRTKSwKKyAgICAvLyBzbyBpdCBtdXN0IGJlIGNvbXBhdGlibGUgYmFjayB0byBBbmRyb2lkIFEvMTAgKHNkayAyOSkKKyAgICBtaW5fc2RrX3ZlcnNpb246ICIyOSIsCisKKyAgICBzcmNzOiBbCisgICAgICAgICJNcGVnNEgyNjNEZWNvZGVyVGVzdC5jcHAiLAorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGlibG9nIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X200dmgyNjNkZWMiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZm91bmRhdGlvbiIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLVdlcnJvciIsCisgICAgICAgICItV2FsbCIsCisgICAgXSwKKworICAgIHNhbml0aXplOiB7CisgICAgICAgIG1pc2NfdW5kZWZpbmVkOiBbCisgICAgICAgICAgICAidW5zaWduZWQtaW50ZWdlci1vdmVyZmxvdyIsCisgICAgICAgICAgICAic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICBdLAorICAgICAgICBjZmk6IHRydWUsCisgICAgfSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL2NvZGVjcy9tNHZfaDI2My9kZWMvdGVzdC9BbmRyb2lkVGVzdC54bWwgYi9tZWRp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KKyAgICAgICAgaWYgKHZvbEhlYWRlcikgeworICAgICAgICAgICAgUFZDbGVhblVwVmlkZW9EZWNvZGVyKG1EZWNIYW5kbGUpOworICAgICAgICAgICAgbUluaXRpYWxpemVkID0gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBpZiAoIW1Jbml0aWFsaXplZCkgeworICAgICAgICAgICAgdWludDhfdCAqdm9sRGF0YVsxXXt9OworICAgICAgICAgICAgaW50MzJfdCB2b2xTaXplID0gMDsKKworICAgICAgICAgICAgdWludDMyX3QgZmxhZ3MgPSBJbmZvW2ZyYW1lSW5kZXhdLmZsYWdzOworICAgICAgICAgICAgYm9vbCBjb2RlY0NvbmZpZyA9IGZsYWdzID09IENPREVDX0NPTkZJR19GTEFHOworICAgICAgICAgICAgaWYgKGNvZGVjQ29uZmlnIHx8IHZvbEhlYWRlcikgeworICAgICAgICAgICAgICAgIHZvbERhdGFbMF0gPSByZWludGVycHJldF9jYXN0PHVpbnQ4X3QgKj4obUlucHV0QnVmZmVyKTsKKyAgICAgICAgICAgICAgICB2b2xTaXplID0gYnl0ZXNDb3VudDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3RhdHVzID0gUFZJbml0VmlkZW9EZWNvZGVyKG1EZWNIYW5kbGUsIHZvbERhdGEsICZ2b2xTaXplLCAxLCBtYXhXaWR0aCwgbWF4SGVpZ2h0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0TW9kZSk7CisgICAgICAgICAgICBBU1NFUlRfVFJVRShzdGF0dXMpIDw8ICJQVkluaXRWaWRlb0RlY29kZXIgZmFpbGVkLiBVbnN1cHBvcnRlZCBjb250ZW50IjsKKworICAgICAgICAgICAgbUluaXRpYWxpemVkID0gdHJ1ZTsKKyAgICAgICAgICAgIE1QNERlY29kaW5nTW9kZSBhY3R1YWxNb2RlID0gUFZHZXREZWNCaXRzdHJlYW1Nb2RlKG1EZWNIYW5kbGUpOworICAgICAgICAgICAgQVNTR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lkZW9EZWNvZGVyKG1EZWNIYW5kbGUpOworCisgICAgICAgICAgICAgICAgICAgIHVpbnQ4X3QgKnZvbERhdGFbMV17fTsKKyAgICAgICAgICAgICAgICAgICAgaW50MzJfdCB2b2xTaXplID0gMDsKKworICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVkluaXRWaWRlb0RlY29kZXIobURlY0hhbmRsZSwgdm9sRGF0YSwgJnZvbFNpemUsIDEsIG1heFdpZHRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4SGVpZ2h0LCBIMjYzX01PREUpOworICAgICAgICAgICAgICAgICAgICBBU1NFUlRfVFJVRShzdGF0dXMpIDw8ICJQVkluaXRWaWRlb0RlY29kZXIgZmFpbGVkIGZvciBIMjYzIjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbUZyYW1lc0NvbmZpZ3VyZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGNvZGVjQ29uZmlnKSB7CisgICAgICAgICAgICAgICAgZnJhbWVJbmRleCsrOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdWludDMyX3QgeUZyYW1lU2l6ZSA9IHNpemVvZih1aW50OCkgKiBtRGVjSGFuZGxlLT5zaXplOworICAgICAgICBBU1NFUlRfR0Uob3V0cHV0QnVmZmVyU2l6ZSwgeUZyYW1lU2l6ZSAqIDMgLyAyKQorICAgICAgICAgICAgICAgIDw8ICJUb28gc21hbGwgb3V0cHV0IGJ1ZmZlcjogIiA8PCBvdXRwdXRCdWZmZXJTaXplIDw8ICIgYnl0ZXMiOworICAgICAgICBBU1NFUlRfTk9fRkFUQUxfRkFJTFVSRShhbGxvY091dHB1dEJ1ZmZlcihvdXRwdXRCdWZmZXJTaXplKSk7CisKKyAgICAgICAgaWYgKCFtRnJhbWVzQ29uZmlndXJlZCkgeworICAgICAgICAgICAgUFZTZXRSZWZlcmVuY2VZVVYobURlY0hhbmRsZSwgbU91dHB1dEJ1ZmZlclsxXSk7CisgICAgICAgICAgICBtRnJhbWVzQ29uZmlndXJlZCA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICAvLyBOZWVkIHRvIGNoZWNrIGlmIGhlYWRlciBjb250YWlucyBuZXcgaW5mbywgZS5nLiwgd2lkdGgvaGVpZ2h0LCBldGMuCisgICAgICAgIFZvcEhlYWRlckluZm8gaGVhZGVySW5mbzsKKyAgICAgICAgdWludDMyX3QgdXNlRXh0VGltZXN0YW1wID0gMTsKKyAgICAgICAgaW50MzJfdCBpbnB1dFNpemUgPSAoSW5mbylbZnJhbWVJbmRleF0uYnl0ZXNDb3VudDsKKyAgICAgICAgdWludDMyX3QgdGltZXN0YW1wID0gZnJhbWVJbmRleDsKKworICAgICAgICB1aW50OF90ICpiaXRzdHJlYW1UbXAgPSByZWludGVycHJldF9jYXN0PHVpbnQ4X3QgKj4obUlucHV0QnVmZmVyKTsKKworICAgICAgICBzdGF0dXMgPSBQVkRlY29kZVZvcEhlYWRlcihtRGVjSGFuZGxlLCAmYml0c3RyZWFtVG1wLCAmdGltZXN0YW1wLCAmaW5wdXRTaXplLCAmaGVhZGVySW5mbywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnVzZUV4dFRpbWVzdGFtcCwgbU91dHB1dEJ1ZmZlclttTnVtU2FtcGxlc091dHB1dCAmIDFdKTsKKyAgICAgICAgQVNTRVJUX0VRKHN0YXR1cywgUFZfVFJVRSkgPDwgImZhaWxlZCB0byBkZWNvZGUgdm9wIGhlYWRlciI7CisKKyAgICAgICAgLy8gSDI2MyBkb2Vzbid0IGhhdmUgVk9MIGhlYWRlciwgdGhlIGZyYW1lIHNpemUgaW5mb3JtYXRpb24gaXMgaW4gc2hvcnQgaGVhZGVyLCBpLmUuIHRoZQorICAgICAgICAvLyBkZWNvZGVyIG1heSBkZXRlY3Qgc2l6ZSB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nVmZmVyKCk7Cit9CisKK3ZvaWQgTXBlZzRIMjYzRGVjb2RlclRlc3Q6OmRlSW5pdERlY29kZXIoKSB7CisgICAgaWYgKG1Jbml0aWFsaXplZCkgeworICAgICAgICBpZiAobURlY0hhbmRsZSkgeworICAgICAgICAgICAgUFZDbGVhblVwVmlkZW9EZWNvZGVyKG1EZWNIYW5kbGUpOworICAgICAgICAgICAgZGVsZXRlIG1EZWNIYW5kbGU7CisgICAgICAgICAgICBtRGVjSGFuZGxlID0gbnVsbHB0cjsKKyAgICAgICAgfQorICAgICAgICBtSW5pdGlhbGl6ZWQgPSBmYWxzZTsKKyAgICB9CisgICAgZnJlZU91dHB1dEJ1ZmZlcigpOworfQorCit2b2lkIGdldEluZm8oc3RyaW5nIGluZm9GaWxlTmFtZSwgdmVjdG9yPEZyYW1lSW5mbz4gJkluZm8pIHsKKyAgICBpZnN0cmVhbSBlbGVJbmZvOworICAgIGVsZUluZm8ub3BlbihpbmZvRmlsZU5hbWUpOworICAgIEFTU0VSVF9FUShlbGVJbmZvLmlzX29wZW4oKSwgdHJ1ZSkgPDwgIkZhaWxlZCB0byBvcGVuICIgPDwgaW5mb0ZpbGVOYW1lOworICAgIGludDMyX3QgYnl0ZXNDb3VudCA9IDA7CisgICAgdWludDMyX3QgZmxhZ3MgPSAwOworICAgIHVpbnQzMl90IHRpbWVzdGFtcCA9IDA7CisgICAgd2hpbGUgKDEpIHsKKyAgICAgICAgaWYgKCEoZWxlSW5mbyA+PiBieXRlc0NvdW50KSkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgZWxlSW5mbyA+PiBmbGFnczsKKyAgICAgICAgZWxlSW5mbyA+PiB0aW1lc3RhbXA7CisgICAgICAgIEluZm8ucHVzaF9iYWNrKHtieXRlc0NvdW50LCBmbGFncywgdGltZXN0YW1wfSk7CisgICAgfQorICAgIGlmIChlbGVJbmZvLmlzX29wZW4oKSkgZWxlSW5mby5jbG9zZSgpOworfQorCitURVN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0byBuZXh0IGtleSBmcmFtZSBhbmQgc3RhcnQgZGVjb2RpbmcgdGlsbCB0aGUgZW5kCisgICAgaW50MzJfdCBpbmRleCA9IG51bUZyYW1lczsKKyAgICBib29sIGtleUZyYW1lID0gZmFsc2U7CisgICAgdWludDMyX3QgZmxhZ3MgPSAwOworICAgIHdoaWxlIChpbmRleCA8IChpbnQzMl90KUluZm8uc2l6ZSgpKSB7CisgICAgICAgIGlmIChJbmZvW2luZGV4XS5mbGFncykgZmxhZ3MgPSAxdSA8PCAoSW5mb1tpbmRleF0uZmxhZ3MgLSAxKTsKKyAgICAgICAgaWYgKChmbGFncyAmIFNZTkNfRlJBTUUpID09IFNZTkNfRlJBTUUpIHsKKyAgICAgICAgICAgIGtleUZyYW1lID0gdHJ1ZTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGZsYWdzID0gMDsKKyAgICAgICAgbUVsZVN0cmVhbS5pZ25vcmUoSW5mb1tpbmRleF0uYnl0ZXNDb3VudCk7CisgICAgICAgIGluZGV4Kys7CisgICAgfQorICAgIEFMT0dWKCJJbmRleD0gJWQiLCBpbmRleCk7CisgICAgaWYgKGtleUZyYW1lKSB7CisgICAgICAgIG1OdW1TYW1wbGVzT3V0cHV0ID0gMDsKKyAgICAgICAgQVNTRVJUX05PX0ZBVEFMX0ZBSUxVUkUocHJvY2Vzc01wZWc0SDI2M0RlY29kZXIoSW5mbywgaW5kZXgsIChpbnQzMl90KUluZm8uc2l6ZSgpIC0gaW5kZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1FbGVTdHJlYW0sIG9zdHJtLCBpbnB1dE1vZGUpKTsKKyAgICB9CisgICAgZGVJbml0RGVjb2RlcigpOworICAgIG9zdHJtLmNsb3NlKCk7CisgICAgSW5mby5jbGVhcigpOworfQorCitJTlNUQU5USUFURV9URVNUX1NVSVRFX1AoCisgICAgICAgIE1wZWc0SDI2M0RlY29k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VyLUJTRCIsCisgICAgXSwKKyAgICBsaWNlbnNlX3RleHQ6IFsKKyAgICAgICAgIk5PVElDRSIsCisgICAgXSwKK30KKworY2NfbGlicmFyeV9zdGF0aWMgeworICAgIG5hbWU6ICJsaWJzdGFnZWZyaWdodF9tNHZoMjYzZW5jIiwKKyAgICB2ZW5kb3JfYXZhaWxhYmxlOiB0cnVlLAorICAgIGFwZXhfYXZhaWxhYmxlOiBbCisgICAgICAgICIvL2FwZXhfYXZhaWxhYmxlOnBsYXRmb3JtIiwKKyAgICAgICAgImNvbS5hbmRyb2lkLm1lZGlhLnN3Y29kZWMiLAorICAgIF0sCisgICAgbWluX3Nka192ZXJzaW9uOiAiMjkiLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIHRhcmdldDogeworICAgICAgICBkYXJ3aW46IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgIH0sCisKKyAgICBzcmNzOiBbCisgICAgICAgICJzcmMvYml0c3RyZWFtX2lvLmNwcCIsCisgICAgICAgICJzcmMvY29tYmluZWRfZW5jb2RlLmNwcCIsICJzcmMvZGF0YXBhcnRfZW5jb2RlLmNwcCIsCisgICAgICAgICJzcmMvZGN0LmNwcCIsCisgICAgICAgICJzcmMvZmluZGhhbGZwZWwuY3BwIiwKKyAgICAgICAgInNyYy9mYXN0Y29kZW1iLmNwcCIsCisgICAgICAgICJzcmMvZmFzdGlkY3QuY3BwIiwKKyAgICAgICAgInNyYy9mYXN0cXVhbnQuY3BwIiwKKyAgICAgICAgInNyYy9tZV91dGlscy5jcHAiLAorICAgICAgICAic3JjL21wNGVuY19hcGkuY3BwIiwKKyAgICAgICAgInNyYy9yYXRlX2NvbnRyb2wuY3BwIiwKKyAgICAgICAgInNyYy9tb3Rpb25fZXN0LmNwcCIsCisgICAgICAgICJzcmMvbW90aW9uX2NvbXAuY3BwIiwKKyAgICAgICAgInNyYy9zYWQuY3BwIiwKKyAgICAgICAgInNyYy9zYWRfaGFsZnBlbC5jcHAiLAorICAgICAgICAic3JjL3ZsY19lbmNvZGUuY3BwIiwKKyAgICAgICAgInNyYy92b3AuY3BwIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItREJYX1JDIiwKKyAgICAgICAgIi1XZXJyb3IiLAorICAgIF0sCisKKyAgICBsb2NhbF9pbmNsdWRlX2RpcnM6IFsic3JjIl0sCisgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWyJpbmNsdWRlIl0sCisKKyAgICBzYW5pdGl6ZTogeworICAgICAgICBtaXNjX3VuZGVmaW5lZDogWworICAgICAgICAgICAgInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgXSwKKyAgICAgICAgY2ZpOiB0cnVlLAorICAgIH0sCit9CisKKy8vIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIworCitjY190ZXN0IHsKKyAgICBuYW1lOiAibGlic3RhZ2VmcmlnaHRfbTR2aDI2M2VuY190ZXN0IiwKKyAgICBndGVzdDogZmFsc2UsCisKKyAgICBzcmNzOiBbInRlc3QvbTR2X2gyNjNfZW5jX3Rlc3QuY3BwIl0sCisKKyAgICBsb2NhbF9pbmNsdWRlX2RpcnM6IFsic3JjIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1EQlhfUkMiLAorICAgICAgICAiLVdhbGwiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgXSwKKworICAgIHNhbml0aXplOiB7CisgICAgICAgIG1pc2NfdW5kZWZpbmVkOiBbCisgICAgICAgICAgICAic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICBdLAorICAgICAgICBjZmk6IHRydWUsCisgICAgfSwKKworICAgIHN0YXRpY19saWJzOiBbImxpYnN0YWdlZnJpZ2h0X200dmgyNjNlbmM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WQgZnVuY3Rpb25zIHRvIG1ha2UgUFZFbmNvZGVWb3AgbW9yZSByZWFkYWJsZS4gKi8KK0ludCBEZXRlcm1pbmVDb2RpbmdMYXllcihWaWRlb0VuY0RhdGEgKnZpZGVvLCBJbnQgKm5MYXllciwgVUxvbmcgbW9kVGltZSk7Cit2b2lkIERldGVybWluZVZvcFR5cGUoVmlkZW9FbmNEYXRhICp2aWRlbywgSW50IGN1cnJMYXllcik7CitJbnQgVXBkYXRlU2tpcE5leHRGcmFtZShWaWRlb0VuY0RhdGEgKnZpZGVvLCBVTG9uZyAqbW9kVGltZSwgSW50ICpzaXplLCBQVl9TVEFUVVMgc3RhdHVzKTsKK0Jvb2wgU2V0UHJvZmlsZV9CdWZmZXJTaXplKFZpZGVvRW5jRGF0YSAqdmlkZW8sIGZsb2F0IGRlbGF5LCBJbnQgYkluaXRpYWxpemVkKTsKKworI2lmZGVmIFBSSU5UX1JDX0lORk8KK2V4dGVybiBGSUxFICpmYWNjdDsKK2V4dGVybiBpbnQgdGlUb3RhbE51bUJpdHNHZW5lcmF0ZWQ7CitleHRlcm4gaW50IGlTdHVmZkJpdHM7CisjZW5kaWYKKworI2lmZGVmIFBSSU5UX0VDCitleHRlcm4gRklMRSAqZmVjOworI2VuZGlmCisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkdldERlZmF1bHRFbmNPcHRpb24oKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDEyLzEyLzIwMDUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworCitPU0NMX0VYUE9SVF9SRUYgQm9vbCBQVkdldERlZmF1bHRFbmNPcHRpb24oVmlkZW9FbmNPcHRpb25zICplbmNPcHRpb24sIEludCBlbmNVc2VDYXNlKQoreworICAgIFZpZGVvRW5jT3B0aW9ucyBkZWZhdWx0VXNlQ2FzZSA9IHtIMjYzX01PREUsIHByb2ZpbGVfbGV2ZWxfbWF4X3BhY2tldF9zaXplW1NJTVBMRV9QUk9GSUxFX0xFVkVMMF0gPj4gMywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU0lNUExFX1BST0ZJTEVfTEVWRUwwLCBQVl9PRkYsIDAsIDEsIDEwMDAsIDMzLCB7MTQ0LCAxNDR9LCB7MTc2LCAxNzZ9LCB7MTUsIDMwfSwgezY0MDAwLCAxMjgwMDB9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7MTAsIDEwfSwgezEyLCAxMn0sIHswLCAwfSwgQ0JSXzEsIDAuMCwgUFZfT0ZGLCAtMSwgMCwgUFZfT0ZGLCAxNiwgUFZfT0ZGLCAwLCBQVl9PTgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CisKKyAgICBPU0NMX1VOVVNFRF9BUkcoZW5jVXNlQ2FzZSk7IC8vIHVudXNlZCBmb3Igbm93LiBMYXRlciB3ZSBjYW4gYWRkIG1vcmUgZGVmYXVsdHMgc2V0dGluZyBhbmQgdXNlIHRoaXMKKyAgICAvLyBhcmd1bWVudCB0byBzZWxlY3QgdGhlIHJpZ2h0IG9uZS4KKyAgICAvKiBpbiB0aGUgZnV0dXJlIHdlIGNhbiBjcmVhdGUgbW9yZSBtZWFuaW5nZnVsIHVzZS1jYXNlcyAqLworICAgIGlmIChlbmNPcHRpb24gPT0gTlVMTCkKKyAgICB7CisgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKyAgICB9CisKKyAgICBNNFZFTkNfTUVNQ1BZKGVuY09wdGlvbiwgJmRlZmF1bHRVc2VDYXNlLCBzaXplb2YoVmlkZW9FbmNPcHRpb25zKSk7CisKKyAgICByZXR1cm4gUFZfVFJVRTsKK30KKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkluaXRWaWRlb0VuY29kZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA4LzIyLzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogSW5pdGlhbGl6YXRpb24gb2YgTVA0IEVuY29kZXIgYW5kIFZPIGJpdHN0cmVhbSAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogIDUvMjEvMDEsIGFsbG9jYXRlIG9ubHkgeUNoYW4gYW5kIGFzc2lnbiB1Q2hhbiAmIHZDaGFuICAgKi8KKy8qICAgICAgICAgICAgICAxMi8xMi8wNSwgYWRkIGVuY29kaW5nIG9wdGlvbiBhcyBpbnB1dCBhcmd1bWVudCAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK09TQ0xfRVhQT1JUX1JFRiBCb29sICAgIFBWSW5pdFZpZGVvRW5jb2RlcihWaWRlb0VuY0NvbnRyb2xzICplbmNvZGVyQ29udHJvbCwgVmlkZW9FbmNPcHRpb25zICplbmNPcHRpb24pCit7CisKKyAgICBCb29sICAgICAgICBzdGF0dXMgPSBQVl9UUlVFOworICAgIEludCAgICAgICAgIG5MYXllcnMsIGlkeCwgaSwgajsKKyAgICBJbnQgICAgICAgICBtYXggPSAwLCBtYXhfd2lkdGggPSAwLCBtYXhfaGVpZ2h0ID0gMCwgcGl0Y2gsIG9mZnNldDsKKyAgICBJbnQgICAgICAgICBzaXplID0gMCwgblRvdGFsTUIgPSAwOworICAgIFZpZGVvRW5jRGF0YSAqdmlkZW87CisgICAgVm9sICAgICAgICAgKnBWb2w7CisgICAgVmlkZW9FbmNQYXJhbXMgICpwRW5jUGFyYW1zOworICAgIEludCAgICAgICAgIHRlbXBfdywgdGVtcF9oLCBtYnNQZXJTZWM7CisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qICAgICAgdGhpcyBwYXJ0IHVzZSB0byBiZSBQVlNldEVuY29kZSgpICovCisgICAgSW50IHByb2ZpbGVfdGFibGVfaW5kZXgsICpwcm9maWxlX2xldmVsX3RhYmxlOworICAgIEludCBwcm9maWxlX2xldmVsID0gZW5jT3B0aW9uLT5wcm9maWxlX2xldmVsOworICAgIEludCBQYWNrZXRTaXplID0gZW5jT3B0aW9uLT5wYWNrZXRTaXplIDw8IDM7CisgICAgSW50IHRpbWVJbmMsIHRpbWVJbmNSZXM7CisgICAgZmxvYXQgcHJvZmlsZV9tYXhfZnJhbWVyYXRlOworICAgIFZpZGVvRW5jUGFyYW1zICplbmNQYXJhbXM7CisKKyAgICBpZiAoZW5jb2RlckNvbnRyb2wtPnZpZGVvRW5jb2RlckRhdGEpIC8qIHRoaXMgaGFzIGJlZW4gY2FsbGVkICovCisgICAgeworICAgICAgICBpZiAoZW5jb2RlckNvbnRyb2wtPnZpZGVvRW5jb2RlckluaXQpIC8qIGNoZWNrIGlmIFBWSW5pdFZpZGVvRW5jb2RlcigpIGhhcyBiZWVuIGNhbGxlZCAgKi8KKyAgICAgICAgeworICAgICAgICAgICAgUFZDbGVhblVwVmlkZW9FbmNvZGVyKGVuY29kZXJDb250cm9sKTsKKyAgICAgICAgICAgIGVuY29kZXJDb250cm9sLT52aWRlb0VuY29kZXJJbml0ID0gMDsKKyAgICAgICAgfQorCisgICAgICAgIE00VkVOQ19GUkVFKGVuY29kZXJDb250cm9sLT52aWRlb0VuY29kZXJEYXRhKTsKKyAgICAgICAgZW5jb2RlckNvbnRyb2wtPnZpZGVvRW5jb2RlckRhdGEgPSBOVUxMOworICAgIH0KKyAgICBlbmNvZGVyQ29udHJvbC0+dmlkZW9FbmNvZGVySW5pdCA9IDA7ICAgLyogcmVzZXQgdGhpcyB2YWx1ZSAqLworCisgICAgdmlkZW8gPSAoVmlkZW9FbmNEYXRhICopTTRWRU5DX01BTExPQyhzaXplb2YoVmlkZW9FbmNEYXRhKSk7IC8qIGFsbG9jYXRlIG1lbW9yeSBmb3IgZW5jRGF0YSAqLworCisgICAgaWYgKHZpZGVvID09IE5VTEwpCisgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKworICAgIE00VkVOQ19NRU1TRVQodmlkZW8sIDAsIHNpemVvZihWaWRlb0VuY0RhdGEpKTsKKworICAgIGVuY29kZXJDb250cm9sLT52aWRlb0VuY29kZX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QYXJhbXMtPkxheWVyTWF4TWJzUGVyU2VjWzBdID0gcHJvZmlsZV9sZXZlbF9tYXhfbWJzUGVyU2VjW3Byb2ZpbGVfdGFibGVfaW5kZXhdOworCisgICAgfQorICAgIGVsc2UgICAvKiBzY2FsYWJsZSBwcm9maWxlICovCisgICAgeworICAgICAgICBwcm9maWxlX2xldmVsX3RhYmxlID0gKEludCAqKXNjYWxhYmxlX3Byb2ZpbGVfbGV2ZWxfbWF4X3BhY2tldF9zaXplOworICAgICAgICBwcm9maWxlX3RhYmxlX2luZGV4ID0gKEludClwcm9maWxlX2xldmVsIC0gKEludCkoU0lNUExFX1NDQUxBQkxFX1BST0ZJTEVfTEVWRUwwKTsKKyAgICAgICAgaWYgKGVuY1BhcmFtcy0+bkxheWVycyA8IDIpCisgICAgICAgIHsKKyAgICAgICAgICAgIGdvdG8gQ0xFQU5fVVA7CisgICAgICAgIH0KKyAgICAgICAgZm9yIChpID0gMDsgaSA8IGVuY1BhcmFtcy0+bkxheWVyczsgaSsrKQorICAgICAgICB7CisgICAgICAgICAgICBlbmNQYXJhbXMtPkxheWVyTWF4TWJzUGVyU2VjW2ldID0gc2NhbGFibGVfcHJvZmlsZV9sZXZlbF9tYXhfbWJzUGVyU2VjW3Byb2ZpbGVfdGFibGVfaW5kZXhdOworICAgICAgICB9CisKKyAgICB9CisKKyAgICAvKiBjYW5ub3QgaGF2ZSB6ZXJvIHNpemUgcGFja2V0IHdpdGggdGhlc2UgbW9kZXMgKi8KKyAgICBpZiAoUGFja2V0U2l6ZSA9PSAwKQorICAgIHsKKyAgICAgICAgaWYgKGVuY09wdGlvbi0+ZW5jTW9kZSA9PSBEQVRBX1BBUlRJVElPTklOR19NT0RFKQorICAgICAgICB7CisgICAgICAgICAgICBnb3RvIENMRUFOX1VQOworICAgICAgICB9CisgICAgICAgIGlmIChlbmNPcHRpb24tPmVuY01vZGUgPT0gQ09NQklORV9NT0RFX1dJVEhfRVJSX1JFUykKKyAgICAgICAgeworICAgICAg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OworICAgIGVuY1BhcmFtcy0+UmVmcmVzaCA9IGVuY09wdGlvbi0+bnVtSW50cmFNQjsKKyAgICBlbmNQYXJhbXMtPlJlc3luY01hcmtlckRpc2FibGUgPSAwOyAvKiBFbmFibGUgUmVzeW5jIE1hcmtlciAqLworCisgICAgZm9yIChpID0gMDsgaSA8IGVuY09wdGlvbi0+bnVtTGF5ZXJzOyBpKyspCisgICAgeworI2lmZGVmIE5PX01QRUdfUVVBTlQKKyAgICAgICAgZW5jUGFyYW1zLT5RdWFudFR5cGVbaV0gPSAwOworI2Vsc2UKKyAgICAgICAgZW5jUGFyYW1zLT5RdWFudFR5cGVbaV0gPSBlbmNPcHRpb24tPnF1YW50VHlwZVtpXTsgICAgICAvKiBIMjYzICovCisjZW5kaWYKKyAgICAgICAgaWYgKGVuY09wdGlvbi0+cFF1YW50W2ldID49IDEgJiYgZW5jT3B0aW9uLT5wUXVhbnRbaV0gPD0gMzEpCisgICAgICAgIHsKKyAgICAgICAgICAgIGVuY1BhcmFtcy0+SW5pdFF1YW50UHZvcFtpXSA9IGVuY09wdGlvbi0+cFF1YW50W2ldOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgZ290byBDTEVBTl9VUDsKKyAgICAgICAgfQorICAgICAgICBpZiAoZW5jT3B0aW9uLT5pUXVhbnRbaV0gPj0gMSAmJiBlbmNPcHRpb24tPmlRdWFudFtpXSA8PSAzMSkKKyAgICAgICAgeworICAgICAgICAgICAgZW5jUGFyYW1zLT5Jbml0UXVhbnRJdm9wW2ldID0gZW5jT3B0aW9uLT5pUXVhbnRbaV07CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBnb3RvIENMRUFOX1VQOworICAgICAgICB9CisgICAgfQorCisgICAgZW5jUGFyYW1zLT5IYWxmUGVsX0VuYWJsZWQgPSAxOworICAgIGVuY1BhcmFtcy0+U2VhcmNoUmFuZ2UgPSBlbmNPcHRpb24tP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ZXJNYXhCaXRSYXRlWzBdID0gMDsKKyAgICBlbmNQYXJhbXMtPkxheWVyTWF4Qml0UmF0ZVsxXSA9IDA7CisgICAgZW5jUGFyYW1zLT5MYXllck1heEZyYW1lUmF0ZVswXSA9IChmbG9hdCkwLjA7CisgICAgZW5jUGFyYW1zLT5MYXllck1heEZyYW1lUmF0ZVsxXSA9IChmbG9hdCkwLjA7CisgICAgZW5jUGFyYW1zLT5WQlZfZGVsYXkgPSBlbmNPcHRpb24tPnZidkRlbGF5OyAgLyogMnNlYyBWQlYgYnVmZmVyIHNpemUgKi8KKworICAgIHN3aXRjaCAoZW5jT3B0aW9uLT5lbmNNb2RlKQorICAgIHsKKworICAgICAgICBjYXNlIFNIT1JUX0hFQURFUjoKKyAgICAgICAgY2FzZSBTSE9SVF9IRUFERVJfV0lUSF9FUlJfUkVTOgorCisgICAgICAgICAgICAvKiBGcm9tIFRhYmxlIDYtMjYgKi8KKyAgICAgICAgICAgIGVuY1BhcmFtcy0+bkxheWVycyA9IDE7CisgICAgICAgICAgICBlbmNQYXJhbXMtPlF1YW50VHlwZVswXSA9IDA7ICAgIC8qSDI2MyAqLworICAgICAgICAgICAgZW5jUGFyYW1zLT5SZXN5bmNNYXJrZXJEaXNhYmxlID0gMTsgLyogRGlzYWJsZSBSZXN5bmMgTWFya2VyICovCisgICAgICAgICAgICBlbmNQYXJhbXMtPkRhdGFQYXJ0aXRpb25pbmcgPSAwOyAvKiBDb21iaW5lZCBNb2RlICovCisgICAgICAgICAgICBlbmNQYXJhbXMtPlJldmVyc2libGVWTEMgPSAwOyAgIC8qIERpc2FibGUgUlZMQyAqLworICAgICAgICAgICAgZW5jUGFyYW1zLT5Sb3VuZGluZ1R5cGUgPSAwOworICAgICAgICAgICAgZW5jUGFyYW1zLT5JbnRyYURDVmxjVGhyID0gNzsgICAvKiB1c2VfaW50cmFfZGNfdmxjID0gMCAqLworICAgICAgICAgICAgZW5jUGFyYW1zLT5NVjh4OF9FbmFibGVkID0gMDsKKworICAgICAgICAgICAgZW5jUGFyYW1zLT5HT0JfSGVhZGVyX0ludGVydmFsID0gZW5jT3B0aW9uLT5nb2JIZWFkZXJJbnRlcnZhbDsKKyAgICAgICAgICAgIGVuY1BhcmFtcy0+SDI2M19FbmFibGVkID0gMjsKKyAgICAgICAgICAgIGVuY1BhcmFtcy0+R09WX0VuYWJsZWQgPSAwOworICAgICAgICAgICAgZW5jUGFyYW1zLT5UaW1lSW5jcmVtZW50UmVzID0gMzAwMDA7ICAgICAgICAvKiB0aW1lSW5jcmVtZW50UmVzIGZvciBIMjYzICovCisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIEgyNjNfTU9ERToKKyAgICAgICAgY2FzZSBIMjYzX01PREVfV0lUSF9FUlJfUkVTOgorCisgICAgICAgICAgICAvKiBGcm9tIFRhYmxlIDYtMjYgKi8KKyAgICAgICAgICAgIGVuY1BhcmFtcy0+bkxheWVycyA9IDE7CisgICAgICAgICAgICBlbmNQYXJhbXMtPlF1YW50VHlwZVswXSA9IDA7ICAgIC8qSDI2MyAqLworICAgICAgICAgICAgZW5jUGFyYW1zLT5SZXN5bmNNYXJrZXJEaXNhYmxlID0gMTsgLyogRGlzYWJsZSBSZXN5bmMgTWFya2VyICovCisgICAgICAgICAgICBlbmNQYXJhbXMtPkRhdGFQYXJ0aXRpb25pbmcgPSAwOyAvKiBDb21iaW5lZCBNb2RlICovCisgICAgICAgICAgICBlbmNQYXJhbXMtPlJldmVyc2libGVWTEMgPSAwOyAgIC8qIERpc2FibGUgUlZMQyAqLworICAgICAgICAgICAgZW5jUGFyYW1zLT5Sb3VuZGluZ1R5cGUgPSAwOworICAgICAgICAgICAgZW5jUGFyYW1zLT5JbnRyYURDVmxjVGhyID0gNzsgICAvKiB1c2VfaW50cmFfZGNfdmxjID0gMCAqLworICAgICAgICAgICAgZW5jUGFyYW1zLT5NVjh4OF9FbmFibGVkID0gMDsKKworICAgICAgICAgICAgZW5jUGFyYW1zLT5IMjYzX0VuYWJsZWQgPSAxOworICAgICAgICAgICAgZW5jUGFyYW1zLT5HT1ZfRW5hYmxlZCA9IDA7CisgICAgICAgICAgICBlbmNQYXJhbXMtPlRpbWVJbmNyZW1lbnRSZXMgPSAzMDAwMDsgICAgICAgIC8qIHRpbWVJbmNyZW1lbnRSZXMgZm9yIEgyNjMgKi8KKworICAgICAgICAgICAgYnJlYWs7CisjaWZuZGVmIEgyNjNfT05MWQorICAgICAgICBjYXNlIERBVEFfUEFSVElUSU9OSU5HX01PREU6CisKKyAgICAgICAgICAgIGVuY1BhcmFtcy0+RGF0YVBhcnRpdGlvbmluZyA9IDE7ICAgICAgICAvKiBCYXNlIExheWVyIERhdGEgUGFydGl0aW9uaW5nICovCisgICAgICAgICAgICBlbmNQYXJhbXMtPlJlc3luY01hcmtlckRpc2FibGUgPSAwOyAvKiBSZXN5bmMgTWFya2VyICovCisjaWZkZWYgTk9fUlZMQworICAgICAgICAgICAgZW5jUGFyYW1zLT5SZXZlcnNpYmxlVkxDID0gMDsKKyNlbHNlCisgICAgICAgICAgICBlbmNQYXJhbXMtPlJldmVyc2libGVWTEMgPSAoZW5jT3B0aW9uLT5ydmxjRW5hYmxlID09IFBWX09OKTsgLyogUlZMQyB3aGVuIERhdGEgUGFydGl0aW9uaW5nICovCisjZW5kaWYKKyAgICAgICAgICAgIGVuY1BhcmFtcy0+UmVzeW5jUGFja2V0c2l6ZSA9IFBhY2tldFNpemU7CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIENPTUJJTkVfTU9ERV9XSVRIX0VSUl9SRVM6CisKKyAgICAgICAgICAgIGVuY1BhcmFtcy0+RGF0YVBhcnRpdGlvbmluZyA9IDA7ICAgICAgICAvKiBDb21iaW5lZCBNb2RlICovCisgICAgICAgICAgICBlbmNQYXJhbXMtPlJlc3luY01hcmtlckRpc2FibGUgPSAwOyAvKiBSZXN5bmMgTWFya2VyICovCisgICAgICAgICAgICBlbmNQYXJhbXMtPlJldmVyc2libGVWTEMgPSAwOyAgICAgICAgICAgLyogTm8gUlZMQyAqLworICAgICAgICAgICAgZW5jUGFyYW1zLT5SZXN5bmNQYWNrZXRzaXplID0gUGFja2V0U2l6ZTsKKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGNhc2UgQ09NQklORV9NT0RFX05PX0VSUl9SRVM6CisKKyAgICAgICAgICAgIGVuY1BhcmFtcy0+RGF0YVBhcnRpdGlvbmluZyA9IDA7ICAgICAgICAvKiBDb21iaW5lZCBNb2RlICovCisgICAgICAgICAgICBlbmNQYXJhbXMtPlJlc3luY01hcmtlckRpc2FibGUgPSAxOyAvKiBEaXNhYmxlIFJlc3luYyBNYXJrZXIgKi8KKyAgICAgICAgICAgIGVuY1BhcmFtcy0+UmV2ZXJzaWJsZVZMQyA9IDA7ICAgICAgICAgICAvKiBObyBSVkxDICovCisgICAgICAgICAgICBicmVhazsKKyNlbmRpZgorICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgZ290byBDTEVBTl9VUDsKKyAgICB9CisgICAgLyogU2V0IHRoZSBjb25zdHJhaW50cyAobWF4aW11bSB2YWx1ZXMpIGFjY29yZGluZyB0byB0aGUgaW5wdXQgcHJvZmlsZSBhbmQgbGV2ZWwgKi8KKyAgICAvKiBOb3RlIHRoYXQgcHJvZmlsZV90YWJsZV9pbmRleCBpcyBhbHJlYWR5IGZpZ3VyZWQgb3V0IGFib3ZlICovCisKKyAgICAvKiBiYXNlIGxheWVyICovCisgICAgZW5jUGFyYW1zLT5wcm9maWxlX3RhYmxlX2luZGV4ICAgID0gcHJvZmlsZV90YWJsZV9pbmRleDsgLyogVXNlZCB0byBsaW1pdCB0aGUgcHJvZmlsZSBhbmQgbGV2ZWwgaW4gU2V0UHJvZmlsZV9CdWZmZXJTaXplKCkgKi8KKworICAgIC8qIGNoZWNrIHRpbWVJbmNSZXMgKi8KKyAgICB0aW1lSW5jUmVzID0gZW5jT3B0aW9uLT50aW1lSW5jUmVzOworICAgIHRpbWVJbmMgPSBlbmNPcHRpb24tPnRpY2tQZXJTcmM7CisKKyAgICBpZiAoKHRpbWVJbmNSZXMgPj0gMSkgJiYgKHRpbWVJbmNSZXMgPD0gNjU1MzYpICYmICh0aW1lSW5jIDwgdGltZUluY1JlcykgJiYgKHRpbWVJbmMgIT0gMCkpCisgICAgeworICAgICAgICBpZiAoIWVuY1BhcmFtcy0+SDI2M19FbmFibGVkKQorICAgICAgICB7CisgICAgICAgICAgICBlbmNQYXJhbXMtPlRpbWVJbmNyZW1lbnRSZXMgPSB0aW1lSW5jUmVzOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgZW5jUGFyYW1zLT5UaW1lSW5jcmVtZW50UmVzID0gMzAwMDA7CisvLyAgICAgICAgICB2aWRlby0+RnJhbWVSYXRlID0gMzAwMDAvKGZsb2F0KTEwMDE7IC8qIGZpeCBpdCB0byAyOS45NyBmcHMgKi8KKyAgICAgICAgfQorICAgICAgICB2aWRlby0+RnJhbWVSYXRlID0gdGltZUluY1JlcyAvICgoZmxvYXQpdGltZUluYyk7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIGdvdG8gQ0xFQU5fVVA7CisgICAgfQorCisgICAgLyogY2hlY2sgZnJhbWUgZGltZW5zaW9uICovCisgICAgaWYgKGVuY1BhcmFtcy0+SDI2M19FbmFibGVkKQorICAgIHsKKyAgICAgICAgc3dpdGNoIChlbmNPcHRpb24tPmVuY1dpZHRoWzBdKQorICAgICAgICB7CisgICAgICAgICAgICBjYXNlIDEyODoKKyAgICAgICAgICAgICAgICBpZiAoZW5jT3B0aW9uLT5lbmNIZWlnaHRbMF0gIT0gOTYpIC8qIHNvdXJjZV9mb3JtYXQgPSAxICovCisgICAgICAgICAgICAgICAgICAgIGdvdG8gQ0xFQU5fVVA7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIDE3NjoKKyAgICAgICAgICAgICAgICBpZiAoZW5jT3B0aW9uLT5lbmNIZWlnaHRbMF0gIT0gMTQ0KSAvKiBzb3VyY2VfZm9ybWF0ID0gMiAqLworICAgICAgICAgICAgICAgICAgICBnb3RvIENMRUFOX1VQOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSAzNTI6CisgICAgICAgICAgICAgICAgaWYgKGVuY09wdGlvbi0+ZW5jSGVpZ2h0WzBdICE9IDI4OCkgLyogc291cmNlX2Zvcm1hdCA9IDIgKi8KKyAgICAgICAgICAgICAgICAgICAgZ290byBDTEVBTl9VUDsKKyAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgY2FzZSA3MDQ6CisgICAgICAgICAgICAgICAgaWYgKGVuY09wdGlvbi0+ZW5jSGVpZ2h0WzBdICE9IDU3NikgLyogc291cmNlX2Zvcm1hdCA9IDIgKi8KKyAgICAgICAgICAgICAgICAgICAgZ290byBDTEVBTl9VUDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgMTQwODoKKyAgICAgICAgICAgICAgICBpZiAoZW5jT3B0aW9uLT5lbmNIZWlnaHRbMF0gIT0gMTE1MikgLyogc291cmNlX2Zvcm1hdCA9IDIgKi8KKyAgICAgICAgICAgICAgICAgICAgZ290byBDTEVBTl9VUDsKKyAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBnb3RvIENMRUFOX1VQOworICAgICAgICB9CisgICAgfQorICAgIGZvciAoaSA9IDA7IGkgPCBlbmNQYXJhbXMtPm5MYXllcnM7IGkrKykKKyAgICB7CisgICAgICAgIGlmIChlbmNPcHRpb24tPmVuY0hlaWdodFtpXSA9PSAwIHx8IGVuY09wdGlvbi0+ZW5jV2lkdGhbaV0gPT0gMCB8fAorICAgICAgICAgICAgICAgIGVuY09wdGlvbi0+ZW5jSGVpZ2h0W2ldICUgMTYgIT0gMCB8fCBlbmNPcHRpb24tPmVuY1dpZHRoW2ldICUgMTYgIT0gMCk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5ID09IDAuMCkgLyogc2V0IHRvIGRlZmF1bHQgKi8KKyAgICB7CisgICAgICAgIHN3aXRjaCAoZW5jT3B0aW9uLT5yY1R5cGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIGNhc2UgQ0JSXzE6CisgICAgICAgICAgICBjYXNlIENCUl8yOgorICAgICAgICAgICAgICAgIGVuY1BhcmFtcy0+VkJWX2RlbGF5ID0gKGZsb2F0KTIuMDsgLyogZGVmYXVsdCAyc2VjIFZCViBidWZmZXIgc2l6ZSAqLworICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBjYXNlIENCUl9MT1dERUxBWToKKyAgICAgICAgICAgICAgICBlbmNQYXJhbXMtPlZCVl9kZWxheSA9IChmbG9hdCkwLjU7IC8qIGRlZmF1bHQgMC41c2VjIFZCViBidWZmZXIgc2l6ZSAqLworICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBjYXNlIFZCUl8xOgorICAgICAgICAgICAgY2FzZSBWQlJfMjoKKyAgICAgICAgICAgICAgICBlbmNQYXJhbXMtPlZCVl9kZWxheSA9IChmbG9hdCkxMC4wOyAvKiBkZWZhdWx0IDEwc2VjIFZCViBidWZmZXIgc2l6ZSAqLworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKyAgICBlbHNlIC8qIGZvcmNlIHRoaXMgdmFsdWUgKi8KKyAgICB7CisgICAgICAgIGVuY1BhcmFtcy0+VkJWX2RlbGF5ID0gZW5jT3B0aW9uLT52YnZEZWxheTsKKyAgICB9CisKKyAgICAvKiBjaGVjayBzZWFyY2ggcmFuZ2UgKi8KKyAgICBpZiAoZW5jUGFyYW1zLT5IMjYzX0VuYWJsZWQgJiYgZW5jT3B0aW9uLT5zZWFyY2hSYW5nZSA+IDE2KQorICAgIHsKKyAgICAgICAgZW5jUGFyYW1zLT5TZWFyY2hSYW5n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gcHJpbnRmKCJUdXJuIG9uIE5vRnJhbWVTa2lwXG4iKTsKKyNlbmRpZgorICAgIH0KKworICAgIGlmICh2aWRlby0+ZW5jUGFyYW1zLT5Ob0ZyYW1lU2tpcF9FbmFibGVkID09IFBWX09OKSAvKiBpZiBubyBmcmFtZSBza2lwICovCisgICAgeworICAgICAgICB2aWRlby0+ZW5jUGFyYW1zLT5GaW5lRnJhbWVTa2lwX0VuYWJsZWQgPSBQVl9PRkY7CisjaWZkZWYgX1BSSU5UX1NUQVQKKyAgICAgICAgcHJpbnRmKCJOb0ZyYW1lU2tpcCAhISEgbWF5IHZpb2xhdGUgVkJWX0JVRkZFUiBjb25zdHJhaW50LlxuIik7CisgICAgICAgIHByaW50ZigiVHVybiBvZmYgRmluZUZyYW1lU2tpcFxuIik7CisjZW5kaWYKKyAgICB9CisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyAgICBuTGF5ZXJzID0gdmlkZW8tPmVuY1BhcmFtcy0+bkxheWVyczsgLyogTnVtYmVyIG9mIExheWVycyB0byBiZSBlbmNvZGVkICovCisKKyAgICAvKiBGaW5kIHRoZSBtYXhpbXVtIHdpZHRoKmhlaWdodCBmb3IgbWVtb3J5IGFsbG9jYXRpb24gb2YgdGhlIFZPUHMgKi8KKyAgICBmb3IgKGlkeCA9IDA7IGlkeCA8IG5MYXllcnM7IGlkeCsrKQorICAgIHsKKyAgICAgICAgdGVtcF93ID0gdmlkZW8tPmVuY1BhcmFtcy0+TGF5ZXJXaWR0aFtpZHhdOworICAgICAgICB0ZW1wX2ggPSB2aWRlby0+ZW5jUGFyYW1zLT5MYXllckhlaWdodFtpZHhdOworCisgICAgICAgIGlmICgodGVtcF93KnRlbXBfaCkgPiBtYXgpCisgICAgICAgIHsKKyAgICAgICAgICAgIG1heCA9IHRlbXBfdyAqIHRlbXBfaDsKKyAgICAgICAgICAgIG1heF93aWR0aCA9ICgodGVtcF93ICsgMTUpID4+IDQpIDw8IDQ7CisgICAgICAgICAgICBtYXhfaGVpZ2h0ID0gKCh0ZW1wX2ggKyAxNSkgPj4gNCkgPDwgNDsKKyAgICAgICAgICAgIGlmICgoKHVpbnQ2NF90KW1heF93aWR0aCAqIG1heF9oZWlnaHQpID4gKHVpbnQ2NF90KUlOVDMyX01BWAorICAgICAgICAgICAgICAgICAgICB8fCB0ZW1wX3cgPiBJTlQzMl9NQVggLSAxNSB8fCB0ZW1wX2ggPiBJTlQzMl9NQVggLSAxNSkgeworICAgICAgICAgICAgICAgIGdvdG8gQ0xFQU5fVVA7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBuVG90YWxNQiA9ICgobWF4X3dpZHRoICogbWF4X2hlaWdodCkgPj4gOCk7CisgICAgICAgIH0KKworICAgICAgICAvKiBDaGVjayBpZiB0aGUgdmlkZW8gc2l6ZSBhbmQgZnJhbWVyYXRlKE1Cc1BlclNlYykgYXJlIHZhbGQgKi8KKyAgICAgICAgbWJzUGVyU2VjID0gKEludCkoblRvdGFsTUIgKiB2aWRlby0+ZW5jUGFyYW1zLT5MYXllckZyYW1lUmF0ZVtpZHhdKTsKKyAgICAgICAgaWYgKG1ic1BlclNlYyA+IHZpZGVvLT5lbmNQYXJhbXMtPkxheWVyTWF4TWJzUGVyU2VjW2lkeF0pIHN0YXR1cyA9IFBWX0ZBTFNFOworICAgIH0KKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qIFNldCBQcm9maWxlIGFuZCBWaWRlbyBCdWZmZXIgU2l6ZSBmb3IgZWFjaCBsYXllciAqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIGlmICh2aWRlby0+ZW5jUGFyYW1zLT5SQ19UeXBlID09IENCUl9MT1dERUxBWSkgdmlkZW8tPmVuY1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Y2hlbWUuICAqLworICAgIGlmICgoc2l6ZV90KW5Ub3RhbE1CID4gU0laRV9NQVggLyBzaXplb2YodHlwZURDU3RvcmUpKSB7CisgICAgICAgIGdvdG8gQ0xFQU5fVVA7CisgICAgfQorICAgIHZpZGVvLT5wcmVkREMgPSAodHlwZURDU3RvcmUgKikgTTRWRU5DX01BTExPQyhuVG90YWxNQiAqIHNpemVvZih0eXBlRENTdG9yZSkpOworICAgIGlmICh2aWRlby0+cHJlZERDID09IE5VTEwpIGdvdG8gQ0xFQU5fVVA7CisKKyAgICBpZiAoIXZpZGVvLT5lbmNQYXJhbXMtPkgyNjNfRW5hYmxlZCkKKyAgICB7CisgICAgICAgIGlmICgoc2l6ZV90KSgobWF4X3dpZHRoID4+IDQpICsgMSkgPiBTSVpFX01BWCAvIHNpemVvZih0eXBlRENBQ1N0b3JlKSkgeworICAgICAgICAgICAgZ290byBDTEVBTl9VUDsKKyAgICAgICAgfQorICAgICAgICB2aWRlby0+cHJlZERDQUNfY29sID0gKHR5cGVEQ0FDU3RvcmUgKikgTTRWRU5DX01BTExPQygoKG1heF93aWR0aCA+PiA0KSArIDEpICogc2l6ZW9mKHR5cGVEQ0FDU3RvcmUpKTsKKyAgICAgICAgaWYgKHZpZGVvLT5wcmVkRENBQ19jb2wgPT0gTlVMTCkgZ290byBDTEVBTl9VUDsKKworICAgICAgICAvKiBlbGVtZW50IHplcm8gd2lsbCBiZSB1c2VkIGZvciBzdG9yaW5nIHZlcnRpY2FsIChjb2wpIEFDIGNvZWZmaWNpZW50cyAqLworICAgICAgICAvKiAgdGhlIHJlc3Qgd2lsbCBiZSB1c2VkIGZvciBzdG9yaW5nIGhvcml6b250YWwgKHJvdykgQUMgY29lZmZpY2llbnRzICAqLworICAgICAgICB2aWRlby0+cHJlZERDQUNfcm93ID0gdmlkZW8tPnByZWREQ0FDX2NvbCArIDE7ICAgICAgICAvKiAgQUNEQyAqLworCisgICAgICAgIGlmICgoc2l6ZV90KW5Ub3RhbE1CID4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cmVmVm9sSUQgPSAwOworICAgICAgICAvKiBJbml0aWFsaXplIGxheWVyIHJlc29sdXRpb24gdG8gc2FtZSBhcyB0aGUgcmVmZXJlbmNlICovCisgICAgICAgIHBWb2wtPnJlZlNhbXBEaXIgPSAwOworICAgICAgICBwVm9sLT5ob3JTYW1wX20gPSAxOworICAgICAgICBwVm9sLT5ob3JTYW1wX24gPSAxOworICAgICAgICBwVm9sLT52ZXJTYW1wX20gPSAxOworICAgICAgICBwVm9sLT52ZXJTYW1wX24gPSAxOworICAgICAgICBwVm9sLT5lbmhhbmNlbWVudFR5cGUgPSAwOyAvKiBXZSBhbHdheXMgZW5oYW5jZSB0aGUgZW50aXJlIHJlZ2lvbiAqLworCisgICAgICAgIHBWb2wtPm5NQlBlclJvdyA9IChwVm9sLT53aWR0aCArIDE1KSAvIDE2OworICAgICAgICBwVm9sLT5uTUJQZXJDb2wgPSAocFZvbC0+aGVpZ2h0ICsgMTUpIC8gMTY7CisgICAgICAgIHBWb2wtPm5Ub3RhbE1CID0gcFZvbC0+bk1CUGVyUm93ICogcFZvbC0+bk1CUGVyQ29sOworCisgICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSAxKQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTsKKyAgICAgICAgaWYgKHBWb2wtPm5Ub3RhbE1CID49IDMpCisgICAgICAgICAgICBwVm9sLT5uQml0c0Zvck1CSUQgPSAyOworICAgICAgICBpZiAocFZvbC0+blRvdGFsTUIgPj0gNSkKKyAgICAgICAgICAgIHBWb2wtPm5CaXRzRm9yTUJJRCA9IDM7CisgICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSA5KQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gNDsKKyAgICAgICAgaWYgKHBWb2wtPm5Ub3RhbE1CID49IDE3KQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gNTsKKyAgICAgICAgaWYgKHBWb2wtPm5Ub3RhbE1CID49IDMzKQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gNjsKKyAgICAgICAgaWYgKHBWb2wtPm5Ub3RhbE1CID49IDY1KQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gNzsKKyAgICAgICAgaWYgKHBWb2wtPm5Ub3RhbE1CID49IDEyOSkKKyAgICAgICAgICAgIHBWb2wtPm5CaXRzRm9yTUJJRCA9IDg7CisgICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSAyNTcpCisgICAgICAgICAgICBwVm9sLT5uQml0c0Zvck1CSUQgPSA5OworICAgICAgICBpZiAocFZvbC0+blRvdGFsTUIgPj0gNTEzKQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTA7CisgICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSAxMDI1KQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTE7CisgICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSAyMDQ5KQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTI7CisgICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSA0MDk3KQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTM7CisgICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSA4MTkzKQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTQ7CisgICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSAxNjM4NSkKKyAgICAgICAgICAgIHBWb2wtPm5CaXRzRm9yTUJJRCA9IDE1OworICAgICAgICBpZiAocFZvbC0+blRvdGFsTUIgPj0gMzI3NjkpCisgICAgICAgICAgICBwVm9sLT5uQml0c0Zvck1CSUQgPSAxNjsKKyAgICAgICAgaWYgKHBWb2wtPm5Ub3RhbE1CID49IDY1NTM3KQorICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTc7CisgICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSAxMzEwNzMpCisgICAgICAgICAgICBwVm9sLT5uQml0c0Zvck1CSUQgPSAxODsKKworICAgICAgICBpZiAocFZvbC0+c2hvcnRWaWRlb0hlYWRlcikKKyAgICAgICAgeworICAgICAgICAgICAgc3dpdGNoIChwVm9sLT53aWR0aCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjYXNlIDEyODoKKyAgICAgICAgICAgICAgICAgICAgaWYgKHBWb2wtPmhlaWdodCA9PSA5NikgIC8qIHNvdXJjZV9mb3JtYXQgPSAxICovCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBWb2wtPm5HT0JpblZvcCA9IDY7CisgICAgICAgICAgICAgICAgICAgICAgICBwVm9sLT5uTUJpbkdPQiA9IDg7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSAxNzY6CisgICAgICAgICAgICAgICAgICAgIGlmIChwVm9sLT5oZWlnaHQgPT0gMTQ0KSAgLyogc291cmNlX2Zvcm1hdCA9IDIgKi8KKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcFZvbC0+bkdPQmluVm9wID0gOTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBWb2wtPm5NQmluR09CID0gMTE7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgMzUyOgorICAgICAgICAgICAgICAgICAgICBpZiAocFZvbC0+aGVpZ2h0ID09IDI4OCkgIC8qIHNvdXJjZV9mb3JtYXQgPSAyICovCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBWb2wtPm5HT0JpblZvcCA9IDE4OworICAgICAgICAgICAgICAgICAgICAgICAgcFZvbC0+bk1CaW5HT0IgPSAyMjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUxTRTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIDcwNDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKHBWb2wtPmhlaWdodCA9PSA1NzYpICAvKiBzb3VyY2VfZm9ybWF0ID0gMiAqLworICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBwVm9sLT5uR09CaW5Wb3AgPSAxODsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBWb2wtPm5NQmluR09CID0gODg7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgMTQwODoKKyAgICAgICAgICAgICAgICAgICAgaWYgKHBWb2wtPmhlaWdodCA9PSAxMTUyKSAgLyogc291cmNlX2Zvcm1hdCA9IDIgKi8KKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcFZvbC0+bkdPQmluVm9wID0gMTg7CisgICAgICAgICAgICAgICAgICAgICAgICBwVm9sLT5uTUJpbkdPQiA9IDM1MjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUxTRTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUxTRTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qIGFsbG9jYXRlIGFuZCBpbml0aWFsaXplIHJhdGUgY29udHJvbCBwYXJhbWV0ZXJzICovCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIC8qIEJFR0lOIElOSVRJQUxJWkFUSU9OIE9GIEFOTkVYIEwgUkFURSBDT05UUk9MICovCisgICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPlJDX1R5cGUgIT0gQ09OU1RBTlRfUSkKKyAgICB7CisgICAgICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgbkxheWVyczsgaWR4KyspIC8qIDEyLzI1LzAwICovCisgICAgICAgIHsKKyAgICAgICAgICAgIHZpZGVvLT5yY1tpZHhdID0KKyAgICAgICAgICAgICAgICAocmF0ZUNvbnRyb2wgKilNNFZFTkNfTUFMTE9DKHNpemVvZihyYXRlQ29udHJvbCkpOworCisgICAgICAgICAgICBpZiAodmlkZW8tPnJjW2lkeF0gPT0gTlVMTCkgZ290byBDTEVBTl9VUDsKKworICAgICAgICAgICAgTTRWRU5DX01FTVNFVCh2aWRlby0+cmNbaWR4XSwgMCwgc2l6ZW9mKHJhdGVDb250cm9sKSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKFBWX1NVQ0NFU1MgIT0gUkNfSW5pdGlhbGl6ZSh2aWRlbykpCisgICAgICAgIHsKKyAgICAgICAgICAgIGdvdG8gQ0xFQU5fVVA7CisgICAgICAgIH0KKyAgICAgICAgLyogaW5pdGlh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b25Qb2ludGVyLT5TQURfQmxvY2sgPSAmU0FEX0Jsb2NrX0M7CisjZW5kaWYKKyAgICB2aWRlby0+ZnVuY3Rpb25Qb2ludGVyLT5TQURfTWFjcm9ibG9jayA9ICZTQURfTWFjcm9ibG9ja19DOworICAgIHZpZGVvLT5mdW5jdGlvblBvaW50ZXItPkNob29zZU1vZGUgPSAmQ2hvb3NlTW9kZV9DOworICAgIHZpZGVvLT5mdW5jdGlvblBvaW50ZXItPkdldEhhbGZQZWxNQlJlZ2lvbiA9ICZHZXRIYWxmUGVsTUJSZWdpb25fQzsKKy8vICB2aWRlby0+ZnVuY3Rpb25Qb2ludGVyLT5TQURfTUJfUEFERElORyA9ICZTQURfTUJfUEFERElORzsgLyogNC8yMS8wMSAqLworCisKKyAgICBlbmNvZGVyQ29udHJvbC0+dmlkZW9FbmNvZGVySW5pdCA9IDE7ICAvKiBpbml0IGRvbmUhICovCisKKyAgICByZXR1cm4gUFZfVFJVRTsKKworQ0xFQU5fVVA6CisgICAgUFZDbGVhblVwVmlkZW9FbmNvZGVyKGVuY29kZXJDb250cm9sKTsKKworICAgIHJldHVybiBQVl9GQUxTRTsKK30KKworCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFBWQ2xlYW5VcFZpZGVvRW5jb2RlcigpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDgvMjIvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiBEZWFsbG9jYXRlcyBhbGxvY2F0ZWQgbWVtb3J5IGZyb20gSW5pdFZpZGVvRW5jb2RlcigpICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiA1LzIxLzAxLCBmcmVlIG9ubHkgeUNoYW4gaW4gVm9wICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKworT1NDTF9FWFBPUlRfUkVGIEJvb2wgICAgUFZDbGVhblVwVmlkZW9FbmNvZGVyKFZpZGVvRW5jQ29udHJvbHMgKmVuY29kZXJDb250cm9sKQoreworICAgIEludCBpZHgsIGk7CisgICAgVmlkZW9FbmNEYXRhICp2aWRlbyA9IChWaWRlb0VuY0RhdGEgKillbmNvZGVyQ29udHJvbC0+dmlkZW9FbmNvZGVyRGF0YTsKKyAgICBpbnQgblRvdGFsTUI7CisgICAgaW50IG1heF93aWR0aCwgb2Zmc2V0OworCisjaWZkZWYgUFJJTlRfUkNfSU5GTworICAgIGlmIChmYWNjdCAhPSBOVUxMKQorICAgIHsKKyAgICAgICAgZnByaW50ZihmYWNjdCwgIkBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBcbiIpOworICAgICAgICBmcHJpbnRmKGZhY2N0LCAiVE9UQUwgTlVNIEJJVFMgR0VORVJBVEVEICVkXG4iLCB0aVRvdGFsTnVtQml0c0dlbmVyYXRlZCk7CisgICAgICAgIGZwcmludGYoZmFjY3QsICJAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAXG4iKTsKKyAg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m5Ub3RhbE1CID4gblRvdGFsTUIpCisgICAgICAgICAgICAgICAgICAgIG5Ub3RhbE1CID0gdmlkZW8tPnZvbFtpZHhdLT5uVG90YWxNQjsKKyAgICAgICAgICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgblRvdGFsTUI7IGlkeCsrKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmICh2aWRlby0+bW90W2lkeF0pCisgICAgICAgICAgICAgICAgICAgIE00VkVOQ19GUkVFKHZpZGVvLT5tb3RbaWR4XSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+bW90KTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICh2aWRlby0+aW50cmFBcnJheSkgTTRWRU5DX0ZSRUUodmlkZW8tPmludHJhQXJyYXkpOworCisgICAgICAgIGlmICh2aWRlby0+c2xpY2VObylNNFZFTkNfRlJFRSh2aWRlby0+c2xpY2VObyk7CisgICAgICAgIGlmICh2aWRlby0+YWNQcmVkRmxhZylNNFZFTkNfRlJFRSh2aWRlby0+YWNQcmVkRmxhZyk7CisvLyAgICAgIGlmKHZpZGVvLT5wcmVkRENBQylNNFZFTkNfRlJFRSh2aWRlby0+cHJlZERDQUMpOworICAgICAgICBpZiAodmlkZW8tPnByZWREQykgTTRWRU5DX0ZSRUUodmlkZW8tPnByZWREQyk7CisgICAgICAgIHZpZGVvLT5wcmVkRENBQ19yb3cgPSBOVUxMOworICAgICAgICBpZiAodmlkZW8tPnByZWREQ0FDX2NvbCkgTTRWRU5DX0ZSRUUodmlkZW8tPnByZWREQ0FDX2NvbCk7CisgICAgICAgIGlmICh2aWRlby0+b3V0cHV0TUIpTTRWRU5DX0ZSRUUodmlkZW8tPm91dHB1dE1CKTsKKworICAgICAgICBpZiAodmlkZW8tPmJpdHN0cmVhbTEpQml0c3RyZWFtQ2xvc2VFbmModmlkZW8tPmJpdHN0cmVhbTEpOworICAgICAgICBpZiAodmlkZW8tPmJpdHN0cmVhbTIpQml0c3RyZWFtQ2xvc2VFbmModmlkZW8tPmJpdHN0cmVhbTIpOworICAgICAgICBpZiAodmlkZW8tPmJpdHN0cmVhbTMpQml0c3RyZWFtQ2xvc2VFbmModmlkZW8tPmJpdHN0cmVhbTMpOworCisgICAgICAgIGlmICh2aWRlby0+b3ZlcnJ1bkJ1ZmZlcikgTTRWRU5DX0ZSRUUodmlkZW8tPm92ZXJydW5CdWZmZXIpOworCisgICAgICAgIG1heF93aWR0aCA9IHZpZGVvLT5lbmNQYXJhbXMtPkxheWVyV2lkdGhbMF07CisgICAgICAgIG1heF93aWR0aCA9ICgoKG1heF93aWR0aCArIDE1KSA+PiA0KSA8PCA0KTsgLyogMDkvMTkvMDUgKi8KKyAgICAgICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPkgyNjNfRW5hYmxlZCkKKyAgICAgICAgeworICAgICAgICAgICAgb2Zmc2V0ID0gMDsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIG9mZnNldCA9ICgobWF4X3dpZHRoICsgMzIpIDw8IDQpICsgMTY7CisgICAgICAgIH0KKworICAgICAgICBpZiAodmlkZW8tPmN1cnJWb3ApCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICh2aWRlby0+Y3VyclZvcC0+YWxsQ2hhbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+Y3VyclZvcC0+YWxsQ2hhbik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+Y3VyclZvcCk7CisgICAgICAgIH0KKworICAgICAgICBpZiAodmlkZW8tPm5leHRCYXNlVm9wKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAodmlkZW8tPm5leHRCYXNlVm9wLT5hbGxDaGFuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIE00VkVOQ19GUkVFKHZpZGVvLT5uZXh0QmFzZVZvcC0+YWxsQ2hhbik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+bmV4dEJhc2VWb3ApOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHZpZGVvLT5wcmV2QmFzZVZvcCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKHZpZGVvLT5wcmV2QmFzZVZvcC0+YWxsQ2hhbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+cHJldkJhc2VWb3AtPmFsbENoYW4pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8tPnByZXZCYXNlVm9wKTsKKyAgICAgICAgfQorICAgICAgICBpZiAodmlkZW8tPnByZXZFbmhhbmNlVm9wKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAodmlkZW8tPnByZXZFbmhhbmNlVm9wLT5hbGxDaGFuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIE00VkVOQ19GUkVFKHZpZGVvLT5wcmV2RW5oYW5jZVZvcC0+YWxsQ2hhbik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+cHJldkVuaGFuY2VWb3ApOworICAgICAgICB9CisKKyAgICAgICAgLyogMDQvMDkvMDEsIGZvciBWb3BzIGluIHRoZSB1c2UgbXVsdGlwYXNzIHByb2Nlc3NpbmcgKi8KKyAgICAgICAgZm9yIChpZHggPSAwOyBpZHggPCB2aWRlby0+ZW5jUGFyYW1zLT5uTGF5ZXJzOyBpZHgrKykKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKHZpZGVvLT5wTVBbaWR4XSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnBNUFtpZHhdLT5wUkRTYW1wbGVzKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IDMwOyBpKyspCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cE1QW2lkeF0tPnBSRFNhbXBsZXNbaV0pCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8tPnBNUFtpZHhdLT5wUkRTYW1wbGVzW2ldKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+cE1QW2lkeF0tPnBSRFNhbXBsZXMpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIE00VkVOQ19NRU1TRVQodmlkZW8tPnBNUFtpZHhdLCAwLCBzaXplb2YoTXVsdGlQYXNzKSk7CisgICAgICAgICAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8tPnBNUFtpZHhdKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvKiAvLyAgRW5kIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLyAqLworCisgICAgICAgIGlmICh2aWRlby0+dm9sKQorICAgICAgICB7CisgICAgICAgICAgICBmb3IgKGlkeCA9IDA7IGlkeCA8IHZpZGVvLT5lbmNQYXJhbXMtPm5MYXllcnM7IGlkeCsrKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmICh2aWRlby0+dm9sW2lkeF0pCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnZvbFtpZHhdLT5zdHJlYW0pCisgICAgICAgICAgICAgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+dm9sW2lkeF0tPnN0cmVhbSk7CisgICAgICAgICAgICAgICAgICAgIE00VkVOQ19GUkVFKHZpZGVvLT52b2xbaWR4XSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8tPnZvbCk7CisgICAgICAgIH0KKworICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgICAgICAvKiBzdG9wIHJhdGUgY29udHJvbCBwYXJhbWV0ZXJzICovCisgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyAgICAgICAgLyogQU5ORVggTCBSQVRFIENPTlRST0wgKi8KKyAgICAgICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPlJDX1R5cGUgIT0gQ09OU1RBTlRfUSkKKyAgICAgICAgeworICAgICAgICAgICAgUkNfQ2xlYW51cCh2aWRlby0+cmMsIHZpZGVvLT5lbmNQYXJhbXMtPm5MYXllcnMpOworCisgICAgICAgICAgICBmb3IgKGlkeCA9IDA7IGlkeCA8IHZpZGVvLT5lbmNQYXJhbXMtPm5MYXllcnM7IGlkeCsrKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cmNbaWR4XSkKKyAgICAgICAgICAgICAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8tPnJjW2lkeF0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKHZpZGVvLT5mdW5jdGlvblBvaW50ZXIpIE00VkVOQ19GUkVFKHZpZGVvLT5mdW5jdGlvblBvaW50ZXIpOworCisgICAgICAgIC8qIElmIGFwcGxpY2F0aW9uIGhhcyBjYWxsZWQgUFZDbGVhblVwVmlkZW9FbmNvZGVyIHRoZW4gd2UgZGVhbGxvY2F0ZSAqLworICAgICAgICAvKiBJZiBQVkluaXRWaWRlb0VuY29kZXIgY2xhc3MgaXQsIHRoZW4gd2UgRE8gTk9UIGRlYWxsb2NhdGUgKi8KKyAgICAgICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMpCisgICAgICAgIHsKKyAgICAgICAgICAgIE00VkVOQ19GUkVFKHZpZGVvLT5lbmNQYXJhbXMpOworICAgICAgICB9CisKKyAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8pOworICAgICAgICBlbmNvZGVyQ29udHJvbC0+dmlkZW9FbmNvZGVyRGF0YSA9IE5VTEw7IC8qIHZpZGVvICovCisgICAgfQorCisgICAgZW5jb2RlckNvbnRyb2wtPnZpZGVvRW5jb2RlckluaXQgPSAwOworCisgICAgcmV0dXJuIFBWX1RSVUU7Cit9CisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogUFZHZXRWb2xIZWFkZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRGF0ZSAgICAgOiA3LzE3LzIwMDEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKworT1NDTF9FWFBPUlRfUkVGIEJvb2wgUFZHZXRWb2xIZWFkZXIoVm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ByZXR1cm4gUFZfRkFMU0U7CisKKyAgICAvKiBSZXNldCBiaXRzdHJlYW0xIGJ1ZmZlciBwYXJhbWV0ZXJzICovCisgICAgQml0c3RyZWFtRW5jUmVzZXQoZW5jRGF0YS0+Yml0c3RyZWFtMSk7CisKKyAgICByZXR1cm4gUFZfVFJVRTsKK30KKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkdldE92ZXJydW5CdWZmZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6IEdldCB0aGUgb3ZlcnJ1biBidWZmZXIgYCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiBQb2ludGVyIHRvIG92ZXJydW4gYnVmZmVyLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisKK09TQ0xfRVhQT1JUX1JFRiBVQ2hhciogUFZHZXRPdmVycnVuQnVmZmVyKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwpCit7CisgICAgVmlkZW9FbmNEYXRhICp2aWRlbyA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOworICAgIEludCBjdXJyTGF5ZXIgPSB2aWRlby0+Y3VyckxheWVyOworICAgIFZvbCAqY3VyclZvbCA9IHZpZGVvLT52b2xbY3VyckxheWVyXTsKKworICAgIGlmIChjdXJyVm9sLT5zdHJlYW0tPmJpdHN0cmVhbUJ1ZmZlciAhPSB2aWRlby0+b3ZlcnJ1bkJ1ZmZlcikgLy8gbm90IHVzZWQKKyAgICB7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKworICAgIHJldHVybiB2aWRlby0+b3ZlcnJ1bkJ1ZmZlcjsKK30KKworCisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBFbmNvZGVWaWRlb0ZyYW1lKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA4LzIyLzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogRW5jb2RlIHZpZGVvIGZyYW1lIGFuZCByZXR1cm4gYml0c3RyZWFtICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgMDIuMTQuMjAwMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICBGaW5pc2hpbmcgbmV3IHRpbWVzdGFtcCAzMi1iaXQgaW5wdXQgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgIEFwcGxpY2F0aW9ucyBuZWVkIHRvIHRha2UgY2FyZSBvZiB3cmFwLWFyb3VuZCAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK09TQ0xfRVhQT1JUX1JFRiBCb29sIFBWRW5jb2RlVmlkZW9GcmFtZShWaWRlb0VuY0NvbnRyb2xzICplbmNDdHJsLCBWaWRlb0VuY0ZyYW1lSU8gKnZpZF9pbiwgVmlkZW9FbmNGcmFtZUlPICp2aWRfb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVMb25nICpuZXh0TW9kVGltZSwgVUNoYXIgKmJzdHJlYW0sIEludCAqc2l6ZSwgSW50ICpuTGF5ZXIpCit7CisgICAgQm9vbCBzdGF0dXMgPSBQVl9UUlVFOworICAgIFBWX1NUQVRVUyBwdl9zdGF0dXM7CisgICAgVmlkZW9FbmNEYXRhICp2aWRlbyA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOworICAgIFZpZGVvRW5jUGFyYW1zICplbmNQYXJhbXMgPSB2aWRlby0+ZW5jUGFyYW1zOworICAgIFZvbCAqY3VyclZvbDsKKyAgICBWb3AgKnRlbXBGb3J3UmVmVm9wID0gTlVMTDsKKyAgICBJbnQgdGVtcFJlZlNlbENvZGUgPSAwOworICAgIFBWX1NUQVRVUyAgIEVuY29kZVZPU19TdGFydChWaWRlb0VuY0NvbnRyb2xzICplbmNDdHJsKTsKKyAgICBJbnQgd2lkdGhfMTYsIGhlaWdodF8xNjsKKyAgICBJbnQgd2lkdGgsIGhlaWdodDsKKyAgICBWb3AgKnRlbXA7CisgICAgSW50IGVuY29kZVZvcCA9IDA7CisgICAgdm9pZCAgUGFkZGluZ0VkZ2UoVm9wICpwYWRWb3ApOworICAgIEludCBjdXJyTGF5ZXIgPSAtMTsKKyAgICAvL0ludCBuTGF5ZXJzID0gZW5jUGFyYW1zLT5uTGF5ZXJzOworCisgICAgVUxvbmcgbW9kVGltZSA9IHZpZF9pbi0+dGltZXN0YW1wOworCisjaWZkZWYgUkFORE9NX1JFRlNFTENPREUgICAvKiBhZGQgcmFuZG9tIHNlbGVjdGlvbiBvZiByZWZlcmVuY2UgVm9wICovCisgICAgSW50IHJhbmRvbV92YWxbMzBdID0gezAsIDEsIDEsIDEsIDAsIDAsIDEsIDAsIDEsIDAsIDAsIDAsIDEsIDEsIDAsIDAsIDAsIDAsIDEsIDEsIDEsIDEsIDEsIDEsIDAsIDEsIDAsIDEsIDAsIDB9OworICAgIHN0YXRpYyBJbnQgcmFuZF9pZHggPSAwOworI2VuZGlmCisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAvKiBEZXRlcm1pbmUgTmV4dCBWb3AgdG8gZW5jb2RlLCBpZiBhbnksIGFuZCBuTGF5ZXIgICAgKi8KKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAvL2kgPSBuTGF5ZXJzLTE7CisKKyAgICBpZiAodmlkZW8tPnZvbEluaXRpYWxpemVbMF0pIC8qIGZpcnN0IHZvbCB0byBjb2RlICovCisgICAgeworICAgICAgICB2aWRlby0+bmV4dE1vZFRpbWUgPSB2aWRlby0+bW9kVGltZVJlZiA9ICgobW9kVGltZSkgLSAoKG1vZFRpbWUpICUgMTAwMCkpOworICAgIH0KKworICAgIGVuY29kZVZvcCA9IERldGVybWluZUNvZGluZ0xheWVyKHZpZGVvLCBuTGF5ZXIsIG1vZFRpbWUpOworICAgIGN1cnJMYXllciA9ICpuTGF5ZXI7CisgICAgaWYgKChjdXJyTGF5ZXIgPCAwKSB8fCAoY3VyckxheWVyID4gZW5jUGFyYW1zLT5uTGF5ZXJzIC0gMSkpCisgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogSWYgcG9zdC1za2lwcGluZyBzdGlsbCBlZmZlY3RpdmUgLS0tIHJldHVybiAqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyAgICBpZiAoIWVuY29kZVZvcCkgLyogc2tpcCBlbmggbGF5ZXIsIG5vIGJhc2UgbGF5ZXIgY29kZWQgLS0tIHJldHVybiAqLworICAgIHsKKyNpZmRlZiBfUFJJTlRfU1RBVAorICAgICAgICBwcmludGYoIk5vIGZyYW1lIGNvZGVkLiBDb250aW51ZSB0byBuZXh0IGZyYW1lLiIpOworI2VuZGlmCisgICAgICAgIC8qIGV4cGVjdGVkIG5leHQgY29kZSB0aW1lLCBjb252ZXJ0IGJhY2sgdG8gbWlsbGlzZWMgKi8KKyAgICAgICAgKm5leHRNb2RUaW1lID0gdmlkZW8tPm5leHRNb2RUaW1lOworCisjaWZkZWYgQUxMT1dfVk9QX05PVF9DT0RFRAorICAgICAgICBpZiAodmlkZW8tPnZvbFswXS0+c2hvcnRWaWRlb0hlYWRlcikgLyogU2hvcnQgVmlkZW8gSGVhZGVyID0gMSAqLworICAgICAgICB7CisgICAgICAgICAgICAqc2l6ZSA9IDA7CisgICAgICAgICAgICAqbkxheWVyID0gLTE7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICAqbkxheWVyID0gMDsKKyAgICAgICAgICAgIEVuY29kZVZvcE5vdENvZGVkKHZpZGVvLCBic3RyZWFtLCBzaXplLCBtb2RUaW1lKTsKKyAgICAgICAgICAgICpzaXplID0gdmlkZW8tPnZvbFswXS0+c3RyZWFtLT5ieXRlQ291bnQ7CisgICAgICAgIH0KKyNlbHNlCisgICAgICAgICpzaXplID0gMDsKKyAgICAgICAgKm5MYXllciA9IC0xOworI2VuZGlmCisgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgfQorCisKKy8vRU5DT0RFX1ZPUF9BR0FJTjogIC8qIDEyLzMwLzAwICovCisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogSW5pdGlhbGl6ZSBWb2wgc3RyZWFtIHN0cnVjdHVyZSB3aXRoIGFwcGxpY2F0aW9uIGJpdHN0cmVhbSAqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIGN1cnJWb2wgPSB2aWRlby0+dm9sW2N1cnJMYXllcl07CisgICAgY3VyclZvbC0+c3RyZWFtLT5iaXRzdHJlYW1CdWZmZXIgPSBic3RyZWFtOworICAgIGN1cnJWb2wtPnN0cmVhbS0+YnVmZmVyU2l6ZSA9ICpzaXplOworICAgIEJpdHN0cmVhbUVuY1Jlc2V0KGN1cnJWb2wtPnN0cmVhbSk7CisgICAgQml0c3RyZWFtU2V0T3ZlcnJ1bkJ1ZmZlcihjdXJyVm9sLT5zdHJlYW0sIHZpZGVvLT5vdmVycnVuQnVmZmVyLCB2aWRlby0+b0JTaXplLCB2aWRlbyk7CisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogRW5jb2RlIFZPUyBhbmQgVk9MIEhlYWRlcnMgb24gZmlyc3QgY2FsbCBmb3IgZWFjaCBsYXllciAqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIGlmICh2aWRlby0+dm9sSW5pdGlhbGl6ZVtjdXJyTGF5ZXJdKQorICAgIHsKKyAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnRpbWVJbmMgPSAwOworICAgICAgICB2aWRlby0+cHJldkJhc2VWb3AtPnRpbWVJbmMgPSAwOworICAgICAgICBpZiAoIXZpZGVvLT5lbmNQYXJhbXMtPkdldFZvbEhlYWRlcltjdXJyTGF5ZXJdKQorICAgICAgICAgICAgcHZfc3RhdHVzID0gRW5jb2RlVk9TX1N0YXJ0KGVuY0N0cmwpOworICAgIH0KKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogQ29weSBJbnB1dCBWaWRlbyBGcmFtZSB0byBJbnRlcm5hbCBWaWRlbyBCdWZmZXIgKi8KKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qIERldGVybWluZSBXaWR0aCBhbmQgSGVpZ2h0IG9mIFZvcCBMYXllciAqLworCisgICAgd2lkdGggPSBlbmNQYXJhbXMtPkxheWVyV2lkdGhbY3VyckxheWVyXTsgICAvKiBHZXQgaW5wdXQgd2lkdGggKi8KKyAgICBoZWlnaHQgPSBlbmNQYXJhbXMtPkxheWVySGVpZ2h0W2N1cnJMYXllcl07IC8qIEdldCBpbnB1dCBoZWlnaHQgKi8KKyAgICAvKiBSb3VuZCBVcCB0byBuZWFyZXN0IG11bHRpcGxlIG9mIDE2IDogTVBFRy00IFN0YW5kYXJkICovCisKKyAgICB3aWR0aF8xNiA9ICgod2lkdGggKyAxNSkgLyAxNikgKiAxNjsgICAgICAgICAgICAvKiBSb3VuZCB1cCB0byBuZWFyZXN0IG11bHRpcGxlIG9mIDE2ICovCisgICAgaGVpZ2h0XzE2ID0gKChoZWlnaHQgKyAxNSkgLyAxNikgKiAxNjsgICAgICAgICAgLyogUm91bmQgdXAgdG8gbmVhcmVzdCBtdWx0aXBsZSBvZiAxNiAqLworCisgICAgdmlkZW8tPmlucHV0ID0gdmlkX2luOyAgLyogcG9pbnQgdG8gdGhlIGZyYW1lIGlucHV0ICovCisKKyAgICAvKi8vICBFbmQgLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vICovCisKKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAvKiBEZXRlcm1pbmUgVk9QIFR5cGUgICAgICAgICAgICAgICAgICovCisgICAgLyogNi8yLzIwMDEsIHNlcGFyYXRlIGZ1bmN0aW9uICAgICAgKi8KKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgRGV0ZXJtaW5lVm9wVHlwZSh2aWRlbywgY3VyckxheWVyKTsKKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qICAgIEluaXRpYWxpemUgVk9QICAgICAgICAqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIHZpZGVvLT5jdXJyVm9wLT52b2xJRCA9IGN1cnJWb2wtPnZvbElEOworICAgIHZpZGVvLT5jdXJyVm9wLT53aWR0aCA9IHdpZHRoXzE2OworICAgIHZpZGVvLT5jdXJyVm9wLT5oZWlnaHQgPSBoZWlnaHRfMTY7CisgICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPkgyNjNfRW5hYmxlZCkgLyogIDExLzI4LzA1ICovCisgICAgeworICAgICAgICB2aWRlby0+Y3VyclZvcC0+cGl0Y2ggPSB3aWR0aF8xNjsKKyAgICB9CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnBpdGNoID0gd2lkdGhfMTYgKyAzMjsKKyAgICB9CisgICAgdmlkZW8tPmN1cnJWb3AtPnRpbWVJbmMgPSBjdXJyVm9sLT50aW1lSW5jcmVtZW50OworICAgIHZpZGVvLT5jdXJyVm9wLT52b3BDb2RlZCA9IDE7CisgICAgdmlkZW8tPmN1cnJWb3AtPnJvdW5kaW5nVHlwZSA9IDA7CisgICAgdmlkZW8tPmN1cnJWb3AtPmludHJhRENWbGNUaHIgPSBlbmNQYXJhbXMtPkludHJhRENWbGNUaHI7CisKKyAgICBpZiAoY3VyckxheWVyID09IDAKKyNpZmRlZiBSQU5ET01fUkVGU0VMQ09ERSAgI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UmVmVm9wLT5yZWZTZWxlY3RDb2RlOworICAgIHZpZGVvLT5jdXJyVm9wLT5nb2JOdW1iZXIgPSAwOworICAgIHZpZGVvLT5jdXJyVm9wLT5nb2JGcmFtZUlEID0gdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlOworICAgIHZpZGVvLT5jdXJyVm9wLT50ZW1wb3JhbFJlZiA9IChtb2RUaW1lICogMzAgLyAxMDAxKSAlIDI1NjsKKworICAgIHZpZGVvLT5jdXJyVm9wLT50ZW1wb3JhbEludGVydmFsID0gMDsKKworICAgIGlmICh2aWRlby0+Y3VyclZvcC0+cHJlZGljdGlvblR5cGUgPT0gSV9WT1ApCisgICAgICAgIHZpZGVvLT5jdXJyVm9wLT5xdWFudGl6ZXIgPSBlbmNQYXJhbXMtPkluaXRRdWFudEl2b3BbY3VyckxheWVyXTsKKyAgICBlbHNlCisgICAgICAgIHZpZGVvLT5jdXJyVm9wLT5xdWFudGl6ZXIgPSBlbmNQYXJhbXMtPkluaXRRdWFudFB2b3BbY3VyckxheWVyXTsKKworCisgICAgLyoqKioqKioqKioqKioqKiovCisgICAgLyogRW5jb2RlIFZvcCAqLworICAgIC8qKioqKioqKioqKioqKioqLworICAgIHZpZGVvLT5zbGljZV9jb2RpbmcgPSAwOworCisgICAgcHZfc3RhdHVzID0gRW5jb2RlVm9wKHZpZGVvKTsKKyNpZmRlZiBfUFJJTlRfU1RBVAorICAgIGlmICh2aWRlby0+Y3VyclZvcC0+cHJlZGljdGlvblR5cGUgPT0gSV9WT1ApCisgICAgICAgIHByaW50ZigiIEktVk9QICIpOworICAgIGVsc2UKKyAgICAgICAgcHJpbnRmKCIgUC1WT1AgKHJlZi4lZCkiLCB2aWRlby0+Zm9yd2FyZFJlZlZvcC0+cmVmU2VsZWN0Q29kZSk7CisjZW5kaWYKKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogVXBkYXRlIFNraXAgTmV4dCBGcmFtZSAgICAgICAgICAgKi8KKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgICpuTGF5ZXIgPSBVcGRhdGVTa2lwTmV4dEZyYW1lKHZpZGVvLCBuZXh0TW9kVGltZSwgc2l6ZSwgcHZfc3RhdHVzKTsKKyAgICBpZiAoKm5MYXllciA9PSAtMSkgLyogc2tpcCBjdXJyZW50IGZyYW1lICovCisgICAgeworICAgICAgICAvKiBtYWtlIHN1cmUgdGhhdCBwb2ludGVycyBhcmUgcmVzdG9yZWQgdG8gdGhlIHByZXZpb3VzIHN0YXRlICovCisgICAgICAgIGlmIChjdXJyTGF5ZXIgPT0gMCkKKyAgICAgICAgeworICAgICAgICAgICAgdmlkZW8tPmZvcndhcmRSZWZWb3AgPSB0ZW1wRm9yd1JlZlZvcDsgLyogRm9yIFAtVm9wIGJhc2Ugb25seSAqLworICAgICAgICAgICAgaWYgKHZpZGVvLT5mb3J3YXJkUmVmVm9wICE9IE5VTEwpIHZpZGVvLT5mb3J3YXJkUmVmVm9wLT5yZWZTZWxlY3RDb2RlID0gdGVtcFJlZlNlbENvZGU7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gc3RhdHVzOworICAgIH0KKworICAgIC8qIElmIEktVk9QIHdhcyBlbmNvZGVkLCByZXNldCBJbnRyYVBlcmlvZCAqLworICAgIGlmICgoY3VyckxheWVyID09IDApICYmIChlbmNQYXJhbXMtPkludHJhUGVyaW9kID4gMCkgJiYgKHZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9PSBJX1ZPUCkpCisgICAgICAgIHZpZGVvLT5uZXh0RW5jSVZvcCA9IGVuY1BhcmFtcy0+SW50cmFQZXJpb2Q7CisKKyAgICAvKiBTZXQgSGludFRyYWNrIEluZm9ybWF0aW9uICovCisgICAgaWYgKGN1cnJMYXllciAhPSAtMSkKKyAgICB7CisgICAgICAgIGlmIChjdXJyVm9sLT5wcmV2TW9kdWxvVGltZUJhc2UpCisgICAgICAgICAgICB2aWRlby0+aGludFRyYWNrSW5mby5NVEIgPSAxOworICAgICAgICBlbHNlCisgICAgICAgICAgICB2aWRlby0+aGludFRyYWNrSW5mby5NVEIgPSAwOworICAgICAgICB2aWRlby0+aGludFRyYWNrSW5mby5MYXllcklEID0gKFVDaGFyKWN1cnJWb2wtPnZvbElEOworICAgICAgICB2aWRlby0+aGludFRyYWNrSW5mby5Db2RlVHlwZSA9IChVQ2hhcil2aWRlby0+Y3VyclZvcC0+cHJlZGljdGlvblR5cGU7CisgICAgICAgIHZpZGVvLT5oaW50VHJhY2tJbmZvLlJlZlNlbENvZGUgPSAoVUNoYXIpdmlkZW8tPmN1cnJWb3AtPnJlZlNlbGVjdENvZGU7CisgICAgfQorCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAvKiBEZXRlcm1pbmUgbkxheWVyIGFuZCB0aW1lSW5jIGZvciBuZXh0IGVuY29kZSAqLworICAgIC8qIDEyLzI3LzAwIGFsd2F5cyBnbyBieSB0aGUgaGlnaGVzdCBsYXllciovCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qIENvcHkgUmVjb25zdHJ1Y3RlZCBCdWZmZXIgdG8gT3V0cHV0IFZpZGVvIEZyYW1lIEJ1ZmZlciAqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIHZpZF9vdXQtPnlDaGFuID0gdmlkZW8tPmN1cnJWb3AtPnlDaGFuOworICAgIHZpZF9vdXQtPnVDaGFuID0gdmlkZW8tPmN1cnJWb3AtPnVDaGFuOworICAgIHZpZF9vdXQtPnZDaGFuID0gdmlkZW8tPmN1cnJWb3AtPnZDaGFuOworICAgIGlmICh2aWRlby0+ZW5jUGFyYW1zLT5IMjYzX0VuYWJsZWQpCisgICAgeworICAgICAgICB2aWRfb3V0LT5oZWlnaHQgPSB2aWRlby0+Y3VyclZvcC0+aGVpZ2h0OyAvKiBwYWRkZWQgaGVpZ2h0ICovCisgICAgICAgIHZpZF9vdXQtPnBpdGNoID0gdmlkZW8tPmN1cnJWb3AtPndpZHRoOyAvKiBwYWRkZWQgd2lkdGggKi8KKyAgICB9CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgdmlkX291dC0+aGVpZ2h0ID0gdmlkZW8tPmN1cnJWb3AtPmhlaWdodCArIDMyOyAvKiBwYWRkZWQgaGVpZ2h0ICovCisgICAgICAgIHZpZF9vdXQtPnBpdGNoID0gdmlkZW8tPmN1cnJWb3AtPndpZHRoICsgMzI7IC8qIHBhZGRlZCB3aWR0aCAqLworICAgIH0KKyAgICAvL3ZpZGVvX291dC0+dGltZXN0YW1wID0gdmlkZW8tPm1vZFRpbWU7CisgICAgdmlkX291dC0+dGltZXN0YW1wID0gKFVMb25nKSgoKHZpZGVvLT5wcmV2RnJhbWVOdW1bY3VyckxheWVyXSAqIDEwMDApIC8gZW5jUGFyYW1zLT5MYXllckZyYW1lUmF0ZVtjdXJyTGF5ZXJdKSArIHZpZGVvLT5tb2RUaW1lUmVmICsgMC41KTsKKworICAgIC8qLy8gRW5kIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vICovCisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogVXBkYXRlIE91cHV0IGJzdHJlYW0gYnl0ZSBjb3VudCAqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgICpzaXplID0gY3VyclZvbC0+c3RyZWFtLT5ieXRlQ291bnQ7CisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAvKiBTd2FwIFZvcCBQb2ludGVycyBmb3IgQmFzZSBMYXllciAgICAgKi8KKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICBpZiAoY3VyckxheWVyID09IDApCisgICAgeworICAgICAgICB0ZW1wID0gdmlkZW8tPnByZXZCYXNlVm9wOworICAgICAgICB2aWRlby0+cHJldkJhc2VWb3AgPSB2aWRlby0+Y3VyclZvcDsKKyAgICAgICAgdmlkZW8tPnByZXZCYXNlVm9wLT5wYWRkZWQgPSAwOyAvKiBub3QgcGFkZGVkICovCisgICAgICAgIHZpZGVvLT5jdXJyVm9wICA9IHRlbXA7CisgICAgICAgIHZpZGVvLT5mb3J3YXJkUmVmVm9wID0gdmlkZW8tPnByZXZCYXNlVm9wOyAvKiBGb3IgUC1Wb3AgYmFzZSBvbmx5ICovCisgICAgICAgIHZpZGVvLT5mb3J3YXJkUmVmVm9wLT5yZWZTZWxlY3RDb2RlID0gMTsKKyAgICB9CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgdGVtcCA9IHZpZGVvLT5wcmV2RW5oYW5jZVZvcDsKKyAgICAgICAgdmlkZW8tPnByZXZFbmhhbmNlVm9wID0gdmlkZW8tPmN1cnJWb3A7CisgICAgICAgIHZpZGVvLT5wcmV2RW5oYW5jZVZvcC0+cGFkZGVkID0gMDsgLyogbm90IHBhZGRlZCAqLworICAgICAgICB2aWRlby0+Y3VyclZvcCA9IHRlbXA7CisgICAgICAgIHZpZGVvLT5mb3J3YXJkUmVmVm9wID0gdmlkZW8tPnByZXZFbmhhbmNlVm9wOworICAgICAgICB2aWRlby0+Zm9yd2FyZFJlZlZvcC0+cmVmU2VsZWN0Q29kZSA9IDA7CisgICAgfQorCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogTW9kaWZ5IHRoZSBpbnRpYWxpemUgZmxhZyBhdCB0aGUgZW5kLiovCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgaWYgKHZpZGVvLT52b2xJbml0aWFsaXplW2N1cnJMYXllcl0pCisgICAgICAgIHZpZGVvLT52b2xJbml0aWFsaXplW2N1cnJMYXllcl0gPSAwOworCisgICAgcmV0dXJuIHN0YXR1czsKK30KKworI2lmbmRlZiBOT19TTElDRV9FTkNPREUKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogUFZFbmNvZGVGcmFtZVNldCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRGF0ZSAgICAgOiAwNC8xOC8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6IEVudGVyIGEgdmlkZW8gZnJhbWUgYW5kIHBlcmZvcm0gZnJvbnQtZW5kIHRpbWUgY2hlY2sgcGx1cyBNRSAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK09TQ0xfRVhQT1JUX1JFRiBCb29sIFBWRW5jb2RlRnJhbWVTZXQoVmlkZW9FbmNDb250cm9scyAqZW5jQ3RybCwgVmlkZW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aWYgYW55LCBhbmQgbkxheWVyICAgICovCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyAgICB2aWRlby0+bW9kVGltZSA9IG1vZFRpbWU7CisKKyAgICAvL2kgPSBuTGF5ZXJzLTE7CisKKyAgICBpZiAodmlkZW8tPnZvbEluaXRpYWxpemVbMF0pIC8qIGZpcnN0IHZvbCB0byBjb2RlICovCisgICAgeworICAgICAgICB2aWRlby0+bmV4dE1vZFRpbWUgPSB2aWRlby0+bW9kVGltZVJlZiA9ICgobW9kVGltZSkgLSAoKG1vZFRpbWUpICUgMTAwMCkpOworICAgIH0KKworCisgICAgZW5jb2RlVm9wID0gRGV0ZXJtaW5lQ29kaW5nTGF5ZXIodmlkZW8sIG5MYXllciwgbW9kVGltZSk7CisKKyAgICBjdXJyTGF5ZXIgPSAqbkxheWVyOworCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAvKiBJZiBwb3N0LXNraXBwaW5nIHN0aWxsIGVmZmVjdGl2ZSAtLS0gcmV0dXJuICovCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIGlmICghZW5jb2RlVm9wKSAvKiBza2lwIGVuaCBsYXllciwgbm8gYmFzZSBsYXllciBjb2RlZCAtLS0gcmV0dXJuICovCisgICAgeworI2lmZGVmIF9QUklOVF9TVEFUCisgICAgICAgIHByaW50ZigiTm8gZnJhbWUgY29kZWQuIENvbnRpbnVlIHRvIG5leHQgZnJhbWUuIik7CisjZW5kaWYKKyAgICAgICAgKm5MYXllciA9IC0xOworCisgICAgICAgIC8qIGV4cGVjdGVkIG5leHQgY29kZSB0aW1lLCBjb252ZXJ0IGJhY2sgdG8gbWlsbGlzZWMgKi8KKyAgICAgICAgKm5leHRNb2RUaW1lID0gdmlkZW8tPm5leHRNb2RUaW1lOzsKKyAgICAgICAgcmV0dXJuIHN0YXR1czsKKyAgICB9CisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogSW5pdGlhbGl6ZSBWb2wgc3RyZWFtIHN0cnVjdHVyZSB3aXRoIGFwcGxpY2F0aW9uIGJpdHN0cmVhbSAqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIGN1cnJWb2wgPSB2aWRlby0+dm9sW2N1cnJMYXllcl07CisgICAgY3VyclZvbC0+c3RyZWFtLT5idWZmZXJTaXplID0gMDsKKyAgICBCaXRzdHJlYW1FbmNSZXNldChjdXJyVm9sLT5zdHJlYW0pOworCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qIEVuY29kZSBWT1MgYW5kIFZPTCBIZWFkZXJzIG9uIGZpcnN0IGNhbGwgZm9yIGVhY2ggbGF5ZXIgKi8KKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyAgICBpZiAodmlkZW8tPnZvbEluaXRpYWxpemVbY3VyckxheWVyXSkKKyAgICB7CisgICAgICAgIHZpZGVvLT5jdXJyVm9wLT50aW1lSW5jID0gMDsKKyAgICAgICAgdmlkZW8tPnByZXZCYXNlVm9wLT50aW1lSW5jID0gMDsKKyAgICB9CisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qIENvcHkgSW5wdXQgVmlkZW8gRnJhbWUgdG8gSW50ZXJuYWwgVmlkZW8gQnVmZmVyICovCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAvKiBEZXRlcm1pbmUgV2lkdGggYW5kIEhlaWdodCBvZiBWb3AgTGF5ZXIgKi8KKworICAgIHdpZHRoID0gZW5jUGFyYW1zLT5MYXllcldpZHRoW2N1cnJMYXllcl07ICAgLyogR2V0IGlucHV0IHdpZHRoICovCisgICAgaGVpZ2h0ID0gZW5jUGFyYW1zLT5MYXllckhlaWdodFtjdXJyTGF5ZXJdOyAvKiBHZXQgaW5wdXQgaGVpZ2h0ICovCisgICAgLyogUm91bmQgVXAgdG8gbmVhcmVzdCBtdWx0aXBsZSBvZiAxNiA6IE1QRUctNCBTdGFuZGFyZCAqLworCisgICAgd2lkdGhfMTYgPSAoKHdpZHRoICsgMTUpIC8gMTYpICogMTY7ICAgICAgICAgICAgLyogUm91bmQgdXAgdG8gbmVhcmVzdCBtdWx0aXBsZSBvZiAxNiAqLworICAgIGhlaWdodF8xNiA9ICgoaGVpZ2h0ICsgMTUpIC8gMTYpICogMTY7ICAgICAgICAgIC8qIFJvdW5kIHVwIHRvIG5lYXJlc3QgbXVsdGlwbGUgb2YgMTYgKi8KKworICAgIHZpZGVvLT5pbnB1dCA9IHZpZF9pbjsgIC8qIHBvaW50IHRvIHRoZSBmcmFtZSBpbnB1dCAqLworCisgICAgLyovLyAgRW5kIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLyAqLworCisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogRGV0ZXJtaW5lIFZPUCBUeXBlICAgICAgICAgICAgICAgICAqLworICAgIC8qIDYvMi8yMDAxLCBzZXBhcmF0ZSBmdW5jdGlvbiAgICAgICovCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIERldGVybWluZVZvcFR5cGUodmlkZW8sIGN1cnJMYXllcik7CisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAvKiAgICBJbml0aWFsaXplIFZPUCAgICAgICAgKi8KKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioq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bXBvcmFsSW50ZXJ2YWwgPSAwOworCisgICAgaWYgKHZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9PSBJX1ZPUCkKKyAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnF1YW50aXplciA9IGVuY1BhcmFtcy0+SW5pdFF1YW50SXZvcFtjdXJyTGF5ZXJdOworICAgIGVsc2UKKyAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnF1YW50aXplciA9IGVuY1BhcmFtcy0+SW5pdFF1YW50UHZvcFtjdXJyTGF5ZXJdOworCisgICAgLyoqKioqKioqKioqKioqKiovCisgICAgLyogRW5jb2RlIFZvcCAgICovCisgICAgLyoqKioqKioqKioqKioqKiovCisgICAgdmlkZW8tPnNsaWNlX2NvZGluZyA9IDE7CisKKyAgICAvKnB2X3N0YXR1cyA9Ki8KKyAgICBFbmNvZGVWb3AodmlkZW8pOworCisjaWZkZWYgX1BSSU5UX1NUQVQKKyAgICBpZiAodmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID09IElfVk9QKQorICAgICAgICBwcmludGYoIiBJLVZPUCAiKTsKKyAgICBlbHNlCisgICAgICAgIHByaW50ZigiIFAtVk9QIChyZWYuJWQpIiwgdmlkZW8tPmZvcndhcmRSZWZWb3AtPnJlZlNlbGVjdENvZGUpOworI2VuZGlmCisKKyAgICAvKiBTZXQgSGludFRyYWNrIEluZm9ybWF0aW9uICovCisgICAgaWYgKGN1cnJWb2wtPnByZXZNb2R1bG9UaW1lQmFzZSkKKyAgICAgICAgdmlkZW8tPmhpbnRUcmFja0luZm8uTVRCID0gMTsKKyAgICBlbHNlCisgICAgICAgIHZpZGVvLT5oaW50VHJhY2tJbmZvLk1UQiA9IDA7CisKKyAgICB2aWRlby0+aGludFRyYWNrSW5mby5MYXllcklEID0gKFVDaGFyKWN1cnJWb2wtPnZvbElEOworICAgIHZpZGVvLT5oaW50VHJhY2tJbmZvLkNvZGVUeXBlID0gKFVDaGFyKXZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZTsKKyAgICB2aWRlby0+aGludFRyYWNrSW5mby5SZWZTZWxDb2RlID0gKFVDaGFyKXZpZGVvLT5jdXJyVm9wLT5yZWZTZWxlY3RDb2RlOworCisgICAgcmV0dXJuIHN0YXR1czsKK30KKyNlbmRpZiAvKiBOT19TTElDRV9FTkNPREUgKi8KKworI2lmbmRlZiBOT19TTElDRV9FTkNPREUKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogUFZFbmNvZGVQYWNrZXQoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRGF0ZSAgICAgOiAwNC8xOC8yMDAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6IEVuY29kZSBvbmUgcGFja2V0IGFuZCByZXR1cm4gYml0c3RyZWFtICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK09TQ0xfRVhQT1JUX1JFRiBCb29sIFBWRW5jb2RlU2xpY2UoVmlkZW9FbmNDb250cm9scyAqZW5jQ3RybCwgVUNoYXIgKmJzdHJlYW0sIEludCAqc2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSW50ICplbmRvZkZyYW1lLCBWaWRlb0VuY0ZyYW1lSU8gKnZpZF9vdXQsIFVMb25nICpuZXh0TW9kVGltZSkKK3sKKyAgICBQVl9TVEFUVVMgcHZfc3RhdHVzOworICAgIFZpZGVvRW5jRGF0YSAqdmlkZW8gPSAoVmlkZW9FbmNEYXRhICopZW5jQ3RybC0+dmlkZW9FbmNvZGVyRGF0YTsKKyAgICBWaWRlb0VuY1BhcmFtcyAqZW5jUGFyYW1zID0gdmlkZW8tPmVuY1BhcmFtczsKKyAgICBWb2wgKmN1cnJWb2w7CisgICAgUFZfU1RBVFVTICAgRW5jb2RlVk9TX1N0YXJ0KFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwpOworICAgIFZvcCAqdGVtcDsKKyAgICB2b2lkICBQYWRkaW5nRWRnZShWb3AgKnBhZFZvcCk7CisgICAgSW50IGN1cnJMYXllciA9IHZpZGVvLT5jdXJyTGF5ZXI7CisgICAgSW50IHByZV9za2lwOworICAgIEludCBwcmVfc2l6ZTsKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogSW5pdGlhbGl6ZSBWb2wgc3RyZWFtIHN0cnVjdHVyZSB3aXRoIGFwcGxpY2F0aW9uIGJpdHN0cmVhbSAqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIGN1cnJWb2wgPSB2aWRlby0+dm9sW2N1cnJMYXllcl07CisgICAgY3VyclZvbC0+c3RyZWFtLT5iaXRzdHJlYW1CdWZmZXIgPSBic3RyZWFtOworICAgIHByZV9zaXplID0gY3VyclZvbC0+c3RyZWFtLT5ieXRlQ291bnQ7CisgICAgY3VyclZvbC0+c3RyZWFtLT5idWZmZXJTaXplID0gcHJlX3NpemUgKyAoKnNpemUpOworCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qIEVuY29kZSBWT1MgYW5kIFZPTCBIZWFkZXJzIG9uIGZpcnN0IGNhbGwgZm9yIGVhY2ggbGF5ZXIgKi8KKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyAgICBpZiAodmlkZW8tPnZvbEluaXRpYWxpemVbY3VyckxheWVyXSkKKyAgICB7CisgICAgICAgIGlmICghdmlkZW8tPmVuY1BhcmFtcy0+R2V0Vm9sSGVhZGVyW2N1cnJMYXllcl0pCisgICAgICAgICAgICBwdl9zdGF0dXMgPSBFbmNvZGVWT1NfU3RhcnQoZW5jQ3RybCk7CisgICAgfQorCisgICAgLyoqKioqKioqKioqKioqKiovCisgICAgLyogRW5jb2RlIFNsaWNlICovCisgICAgLyoqKioqKioqKioqKioqKiovCisgICAgcHZfc3RhdHVzID0gRW5jb2RlU2xpY2UodmlkZW8pOworCisgICAgKmVuZG9mRnJhbWUgPSAwOworCisgICAgaWYgKHZpZGVvLT5tYm51bSA+PSBjdXJyVm9sLT5uVG90YWxNQiAmJiAhdmlkZW8tPmVuZF9vZl9idWYpCisgICAgeworICAgICAgICAqZW5kb2ZGcmFtZSA9IDE7CisKKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgLyogVXBkYXRlIFNraXAgTmV4dCBGcmFtZSAgICAgICAgICAgKi8KKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgcHJlX3NraXAgPSBVcGRhdGVTa2lwTmV4dEZyYW1lKHZpZGVvLCBuZXh0TW9kVGltZSwgc2l6ZSwgcHZfc3RhdHVzKTsgLyogbW9kaWZpZWQgc3VjaCB0aGF0IG5vIHByZS1za2lwcGVkICovCisKKyAgICAgICAgaWYgKHByZV9za2lwID09IC0xKSAvKiBlcnJvciAqLworICAgICAgICB7CisgICAgICAgICAgICAqZW5kb2ZGcmFtZSA9IC0xOworICAgICAgICAgICAgLyogbWFrZSBzdXJlIHRoYXQgcG9pbnRlcnMgYXJlIHJlc3RvcmVkIHRvIHRoZSBwcmV2aW91cyBzdGF0ZSAqLworICAgICAgICAgICAgaWYgKGN1cnJMYXllciA9PSAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZpZGVvLT5mb3J3YXJkUmVmVm9wID0gdmlkZW8tPnRlbXBGb3J3UmVmVm9wOyAvKiBGb3IgUC1Wb3AgYmFzZSBvbmx5ICovCisgICAgICAgICAgICAgICAgdmlkZW8tPmZvcndhcmRSZWZWb3AtPnJlZlNlbGVjdENvZGUgPSB2aWRlby0+dGVtcFJlZlNlbENvZGU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBwdl9zdGF0dXM7CisgICAgICAgIH0KKworICAgICAgICAvKiBJZiBJLVZPUCB3YXMgZW5jb2RlZCwgcmVzZXQgSW50cmFQZXJpb2QgKi8KKyAgICAgICAgaWYgKChjdXJyTGF5ZXIgPT0gMCkgJiYgKGVuY1BhcmFtcy0+SW50cmFQZXJpb2QgPiAwKSAmJiAodmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID09IElfVk9QKSkKKyAgICAgICAgICAgIHZpZGVvLT5uZXh0RW5jSVZvcCA9IGVuY1BhcmFtcy0+SW50cmFQZXJpb2Q7CisKKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgICAgIC8qIENvcHkgUmVjb25zdHJ1Y3RlZCBCdWZmZXIgdG8gT3V0cHV0IFZpZGVvIEZyYW1lIEJ1ZmZlciAqLworICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgdmlkX291dC0+eUNoYW4gPSB2aWRlby0+Y3VyclZvcC0+eUNoYW47CisgICAgICAgIHZpZF9vdXQtPnVDaGFuID0gdmlkZW8tPmN1cnJWb3AtPnVDaGFuOworICAgICAgICB2aWRfb3V0LT52Q2hhbiA9IHZpZGVvLT5jdXJyVm9wLT52Q2hhbjsKKyAgICAgICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPkgyNjNfRW5hYmxlZCkKKyAgICAgICAgeworICAgICAgICAgICAgdmlkX291dC0+aGVpZ2h0ID0gdmlkZW8tPmN1cnJWb3AtPmhlaWdodDsgLyogcGFkZGVkIGhlaWdodCAqLworICAgICAgICAgICAgdmlkX291dC0+cGl0Y2ggPSB2aWRlby0+Y3VyclZvcC0+d2lkdGg7IC8qIHBhZGRlZCB3aWR0aCAqLworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgdmlkX291dC0+aGVpZ2h0ID0gdmlkZW8tPmN1cnJWb3AtPmhlaWdodCArIDMyOyAvKiBwYWRkZWQgaGVpZ2h0ICovCisgICAgICAgICAgICB2aWRfb3V0LT5waXRjaCA9IHZpZGVvLT5jdXJyVm9wLT53aWR0aCArIDMyOyAvKiBwYWRkZWQgd2lkdGggKi8KKyAgICAgICAgfQorICAgICAgICAvL3ZpZF9vdXQtPnRpbWVzdGFtcCA9IHZpZGVvLT5tb2RUaW1lOworICAgICAgICB2aWRfb3V0LT50aW1lc3RhbXAgPSAoVUxvbmcpKCgodmlkZW8tPnByZXZGcmFtZU51bVtjdXJyTGF5ZXJdICogMTAwMCkgLyBlbmNQYXJhbXMtPkxheWVyRnJhbWVSYXRlW2N1cnJMYXllcl0pICsgdmlkZW8tPm1vZFRpbWVSZWYgKyAwLjUpOworCisgICAgICAgIC8qLy8gRW5kIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vICovCisKKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgICAgIC8qIFN3YXAgVm9wIFBvaW50ZXJzIGZvciBCYXNlIExheWVyICAgICAqLworICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgICAgICBpZiAoY3VyckxheWVyID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIHRlbXAgPSB2aWRlby0+cHJldkJhc2VWb3A7CisgICAgICAgICAgICB2aWRlby0+cHJldkJhc2VWb3AgPSB2aWRlby0+Y3VyclZvcDsKKyAgICAgICAgICAgIHZpZGVvLT5wcmV2QmFzZVZvcC0+cGFkZGVkID0gMDsgLyogbm90IHBhZGRlZCAqLworICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AgPSB0ZW1wOworICAgICAgICAgICAgdmlkZW8tPmZvcndhcmRSZWZWb3AgPSB2aWRlby0+cHJldkJhc2VWb3A7IC8qIEZvciBQLVZvcCBiYXNlIG9ubHkgKi8KKyAgICAgICAgICAgIHZpZGVvLT5mb3J3YXJkUmVmVm9wLT5yZWZTZWxlY3RDb2RlID0gMTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHRlbXAgPSB2aWRlby0+cHJldkVuaGFuY2VWb3A7CisgICAgICAgICAgICB2aWRlby0+cHJldkVuaGFuY2VWb3AgPSB2aWRlby0+Y3VyclZvcDsKKyAgICAgICAgICAgIHZpZGVvLT5wcmV2RW5oYW5jZVZvcC0+cGFkZGVkID0gMDsgLyogbm90IHBhZGRlZCAqLworICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AgPSB0ZW1wOworICAgICAgICAgICAgdmlkZW8tPmZvcndhcmRSZWZWb3AgPSB2aWRlby0+cHJldkVuaGFuY2VWb3A7CisgICAgICAgICAgICB2aWRlby0+Zm9yd2FyZFJlZlZvcC0+cmVmU2VsZWN0Q29kZSA9IDA7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgLyogVXBkYXRlIE91cHV0IGJzdHJlYW0gYnl0ZSBjb3VudCAqLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgICpzaXplID0gY3VyclZvbC0+c3RyZWFtLT5ieXRlQ291bnQgLSBwcmVfc2l6ZTsKKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIC8qIE1vZGlmeSB0aGUgaW50aWFsaXplIGZsYWcgYXQgdGhlIGVuZC4qLworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIGlmICh2aWRlby0+dm9sSW5pdGlhbGl6ZVtjdXJyTGF5ZXJdKQorICAgICAgICB2aWRlby0+dm9sSW5pdGlhbGl6ZVtjdXJyTGF5ZXJdID0gMDsKKworICAgIHJldHVybiBwdl9zdGF0dXM7Cit9CisjZW5kaWYgLyogTk9fU0xJQ0VfRU5DT0RFICovCisKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkdldEgyNjNQcm9maWxlTGV2ZWxJRCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDAyLzA1LzIwMDMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogR2V0IEguMjYzIFByb2ZpbGUgSUQgYW5kIGxldmVsIElEIGZvciBwcm9maWxlIDAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiBQcm9maWxlIElEPTAsIGxldmVsSUQgaXMgd2hhdCB3ZSB3YW50ICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTm90ZSAgICAgOiBoMjYzTGV2ZWxbOF0sIHJCUl9ib3VuZFs4XSwgbWF4X2gyNjNfZnJhbWVyYXRlWzJdICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgIG1heF9oMjYzX3dpZHRoWzJdLCBtYXhfaDI2M19oZWlnaHRbMl0gYXJlIGdsb2JhbCAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK09TQ0xfRVhQT1JUX1JFRiBCb29sIFBWR2V0SDI2M1Byb2ZpbGVMZXZlbElEKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwsIEludCAqcHJvZmlsZUlELCBJbnQgKmxldmVsSUQpCit7CisgICAgVmlkZW9FbmNEYXRhICplbmNEYXRhOworICAgIEludCB3aWR0aCwgaGVpZ2h0OworICAgIGZsb2F0IGJpdHJhdGVfciwgZnJhbWVyYXRlOworCisKKyAgICAvKiBGb3IgdGhpcyB2ZXJzaW9uLCB3ZSBvbmx5IHN1cHBvcnQgSC4yNjMgcHJvZmlsZSAwICovCisgICAgKnByb2ZpbGVJRCA9IDA7CisKKyAgICAqbGV2ZWxJRCA9IDA7CisgICAgZW5jRGF0YSA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOworCisgICAgaWYgKGVuY0RhdGEgPT0gTl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GJpdHJhdGVfciA8PSByQlJfYm91bmRbM10gPyBoMjYzTGV2ZWxbM10gOiBoMjYzTGV2ZWxbNF0pOworICAgICAgICAgICAgcmV0dXJuIFBWX1RSVUU7CisgICAgICAgIH0KKyAgICB9Cit9CisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogUFZHZXRNUEVHNFByb2ZpbGVMZXZlbElEKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRGF0ZSAgICAgOiAyNi8wNi8yMDA4ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6IEdldCBNUEVHNCBMZXZlbCBhZnRlciBpbml0aWFsaXplZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogcHJvZmlsZV9sZXZlbCBhY2NvcmRpbmcgdG8gaW50ZXJmYWNlICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KK09TQ0xfRVhQT1JUX1JFRiBCb29sIFBWR2V0TVBFRzRQcm9maWxlTGV2ZWxJRChWaWRlb0VuY0NvbnRyb2xzICplbmNDdHJsLCBJbnQgKnByb2ZpbGVfbGV2ZWwsIEludCBuTGF5ZXIpCit7CisgICAgVmlkZW9FbmNEYXRhKiB2aWRlbzsKKyAgICBJbnQgaTsKKworICAgIHZpZGVvID0gKFZpZGVvRW5jRGF0YSAqKWVuY0N0cmwtPnZpZGVvRW5jb2RlckRhdGE7CisKKyAgICBpZiAobkxheWVyID09IDApCisgICAgeworICAgICAgICBmb3IgKGkgPSAwOyBpIDwgODsgaSsrKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAodmlkZW8tPmVuY1BhcmFtcy0+UHJvZmlsZUxldmVsWzBdID09IHByb2ZpbGVfbGV2ZWxfY29kZVtpXSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAqcHJvZmlsZV9sZXZlbCA9IGk7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIGZvciAoaSA9IDA7IGkgPCA4OyBpKyspCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICh2aWRlby0+ZW5jUGFyYW1zLT5Qcm9maWxlTGV2ZWxbMF0gPT0gc2NhbGFibGVfcHJvZmlsZV9sZXZlbF9jb2RlW2ldKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgICpwcm9maWxlX2xldmVsID0gaSArIFNJTVBMRV9TQ0FMQUJMRV9QUk9GSUxFX0xFVkVMMDsKKyAgICB9CisKKyAgICByZXR1cm4gdHJ1ZTsKK30KKworI2lmbmRlZiBMSU1JVEVEX0FQSQorLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVlVwZGF0ZUVuY0ZyYW1lUmF0ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA0LzA4LzIwMDIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogVXBkYXRlIHRhcmdldCBmcmFtZSByYXRlcyBvZiB0aGUgZW5jb2RlZCBiYXNlIGFuZCBlbmhhbmNlICAgICovCisvKiAgICAgICAgICAgICBsYXllcihpZiBhbnkpIHdoaWxlIGVuY29kaW5nIG9wZXJhdGlvbiBpcyBvbmdvaW5nICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisKK09TQ0xfRVhQT1JUX1JFRiBCb29sIFBWVXBkYXRlRW5jRnJhbWVSYXRlKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwsIGZsb2F0ICpmcmFtZVJhdGUpCit7CisgICAgVmlkZW9FbmNEYXRhICAgICplbmNEYXRhOworICAgIEludCBpOy8vIG5Ub3RhbE1CLCBtYlBlclNlYzsKKworICAgIGVuY0RhdGEgPSAoVmlkZW9FbmNEYXRhICopZW5jQ3RybC0+dmlkZW9FbmNvZGVyRGF0YTsKKworICAgIGlmIChlbmNEYXRhID09IE5VTEwpCisgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKyAg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9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFBWVXBkYXRlQml0UmF0ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDQvMDgvMjAwMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiBVcGRhdGUgdGFyZ2V0IGJpdCByYXRlcyBvZiB0aGUgZW5jb2RlZCBiYXNlIGFuZCBlbmhhbmNlICAgICAgKi8KKy8qICAgICAgICAgICAgIGxheWVyKGlmIGFueSkgd2hpbGUgZW5jb2Rpbmcgb3BlcmF0aW9uIGlzIG9uZ29pbmcgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKworT1NDTF9FWFBPUlRfUkVGIEJvb2wgUFZVcGRhdGVCaXRSYXRlKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwsIEludCAqYml0UmF0ZSkKK3sKKyAgICBWaWRlb0VuY0RhdGEgICAgKmVuY0RhdGE7CisgICAgSW50IGk7CisKKyAgICBlbmNEYXRhID0gKFZpZGVvRW5jRGF0YSAqKWVuY0N0cmwtPnZpZGVvRW5jb2RlckRhdGE7CisKKyAgICBpZiAoZW5jRGF0YSA9PSBOVUxMKQorICAgICAgICByZXR1cm4gUFZfRkFMU0U7CisgICAgaWYgKGVuY0RhdGEtPmVuY1BhcmFtcyA9PSBOVUxMKQorICAgICAgICByZXR1cm4gUFZfRkFMU0U7CisKKyAgICAvKiBVcGRhdGUgdGhlIGJpdHJhdGVzIGZvciBhbGwgdGhlIGxheWVycyAqLworICAgIGZvciAoaSA9IDA7IGkgPCBlbmNEYXRhLT5lbmNQYXJhbXMtPm5MYXllcnM7IGkrKykKKyAgICB7CisgICAgICAgIGlmIChiaXRSYXRlW2ldID4gZW5jRGF0YS0+ZW5jUGFyYW1zLT5MYXllck1heEJpdFJhdGVbaV0pIC8qIHNldCBieSB1c2VycyBvciBwcm9maWxlICovCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKyAgICAgICAgfQorICAgICAgICBlbmNEYXRhLT5lbmNQYXJhbXMtPkxheWVyQml0UmF0ZVtpXSA9IGJpdFJhdGVbaV07CisgICAgfQorCisgICAgcmV0dXJuIFJDX1VwZGF0ZUJYUkNQYXJhbXMoKHZvaWQqKSBlbmNEYXRhKTsKKworfQorI2VuZGlmCisjaWZuZGVmIExJTUlURURfQVBJCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVlVwZGF0ZVZCVkRlbGF5KCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogNC8yMy8yMDA0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogVXBkYXRlIFZCViBidWZmZXIgc2l6ZShpbiBkZWxheSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworCitCb29sIFBWVXBkYXRlVkJWRGVsYXkoVmlkZW9FbmNDb250cm9scyAqZW5jQ3RybCwgZmxvYXQgZGVsYXkpCit7CisKKyAgICBWaWRlb0VuY0RhdGEgICAgKmVuY0RhdGE7CisgICAgSW50IHRvdGFsX2JpdHJhdGUsIG1heF9idWZmZXJfc2l6ZTsKKyAgICBpbnQgaW5kZXg7CisKKyAgICBlbmNEYXRhID0gKFZpZGVvRW5jRGF0YSAqKWVuY0N0cmwtPnZpZGVvRW5jb2RlckRhdGE7CisKKyAgICBpZiAoZW5jRGF0YSA9PSBOVUxMKQorICAgICAgICByZXR1cm4gUFZfRkFMU0U7CisgICAgaWYgKGVuY0RhdGEtPmVuY1BhcmFtcyA9PSBOVUxMKQorICAgICAgICByZXR1cm4gUFZfRkFMU0U7CisKKyAgICAvKiBDaGVjayB3aGV0aGVyIHRoZSBpbnB1dCBkZWxheSBpcyB2YWxpZCBiYXNlZCBvbiB0aGUgZ2l2ZW4gcHJvZmlsZSAqLworICAgIHRvdGFsX2JpdHJhdGUgICA9IChlbmNEYXRhLT5lbmNQYXJhbXMtPm5MYXllcnMgPT0gMSA/IGVuY0RhdGEtPmVuY1BhcmFtcy0+TGF5ZXJCaXRSYXRlWzBdIDoKKyAgICAgICAgICAgICAgICAgICAgICAgZW5jRGF0YS0+ZW5jUGFyYW1zLT5MYXllckJpdFJhdGVbMV0pOworICAgIGluZGV4ID0gZW5jRGF0YS0+ZW5jUGFyYW1zLT5wcm9maWxlX3RhYmxlX2luZGV4OworICAgIG1heF9idWZmZXJfc2l6ZSA9IChlbmNEYXRhLT5lbmNQYXJhbXMtPm5MYXllcnMgPT0gMSA/IHByb2ZpbGVfbGV2ZWxfbWF4X1ZCVl9zaXplW2luZGV4XSA6CisgICAgICAgICAgICAgICAgICAgICAgIHNjYWxhYmxlX3Byb2ZpbGVfbGV2ZWxfbWF4X1ZCVl9zaXplW2luZGV4XSk7CisKKyAgICBpZiAodG90YWxfYml0cmF0ZSpkZWxheSA+IChmbG9hdCltYXhfYnVmZmVyX3NpemUpCisgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKworICAgIGVuY0RhdGEtPmVuY1BhcmFtcy0+VkJWX2RlbGF5ID0gZGVsYXk7CisgICAgcmV0dXJuIFBWX1RSVUU7CisKK30KKyNlbmRpZgorI2lmbmRlZiBMSU1JVEVEX0FQSQorLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVlVwZGF0ZUlGcmFtZUludGVydmFsKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRGF0ZSAgICAgOiAwNC8xMC8yMDAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6IHVwZGF0ZXMgdGhlIElOVFJBIGZyYW1lIHJlZnJlc2ggaW50ZXJ2YWwgd2hpbGUgZW5jb2RpbmcgICAgICAqLworLyogICAgICAgICAgICAgaXMgb25nb2luZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworCitPU0NMX0VYUE9SVF9SRUYgQm9vbCBQVlVwZGF0ZUlGcmFtZUludGVydmFsKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwsIEludCBhSUZyYW1lUGVyaW9kKQoreworICAgIFZpZGVvRW5jRGF0YSAgICAqZW5jRGF0YTsKKworICAgIGVuY0RhdGEgPSAoVmlkZW9FbmNEYXRhICopZW5jQ3RybC0+dmlkZW9FbmNvZGVyRGF0YTsKKworICAgIGlmIChlbmNEYXRhID09IE5VTEwpCisgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKyAgICBpZiAoZW5jRGF0YS0+ZW5jUGFyYW1zID09IE5VTEwpCisgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKworICAgIGVuY0RhdGEtPmVuY1BhcmFtcy0+SW50cmFQZXJpb2QgPSBhSUZyYW1lUGVyaW9kOworICAgIHJldHVybiBQVl9UUlVFOworfQorI2VuZGlmCisjaWZuZGVmIExJTUlURURfQVBJCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFBWU2V0TnVtSW50cmFNQlJlZnJlc2goKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDgvMDUvMjAwMyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitPU0NMX0VYUE9SVF9SRUYgQm9vbCAgICBQVlVwZGF0ZU51bUludHJhTUJSZWZyZXNoKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwsIEludCBudW1NQikKK3sKKyAgICBWaWRlb0VuY0RhdGEgICAgKmVuY0RhdGE7CisKKyAgICBlbmNEYXRhID0gKFZpZGVvRW5jRGF0YSAqKWVuY0N0cmwtPnZpZGVvRW5jb2RlckRhdGE7CisKKyAgICBpZiAoZW5jRGF0YSA9PSBOVUxMKQorICAgICAgICByZXR1cm4gUFZfRkFMU0U7CisKKyAgICBlbmNEYXRhLT5lbmNQYXJhbXMtPlJlZnJlc2ggPSBudW1NQjsKKworICAgIHJldHVybiBQVl9UUlVFOworfQorI2VuZGlmCisjaWZuZGVmIExJTUlURURfQVBJCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFBWSUZyYW1lUmVxdWVzdCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDQvMTAvMjAwMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiBlbmNvZGVzIHRoZSBuZXh0IGJhc2UgZnJhbWUgYXMgYW4gSS1Wb3AgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisKK09TQ0xfRVhQT1JUX1JFRiBCb29sIFBWSUZyYW1lUmVxdWVzdChWaWRlb0VuY0NvbnRyb2xzICplbmNDdHJsKQoreworICAgIFZpZGVvRW5jRGF0YSAgICAqZW5jRGF0YTsKKworICAgIGVuY0RhdGEgPSAoVmlkZW9FbmNEYXRhICopZW5jQ3RybC0+dmlkZW9FbmNvZGVyRGF0YTsKKworICAgIGlmIChlbmNEYXRhID09IE5VTEwpCisgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKyAgICBpZiAoZW5jRGF0YS0+ZW5jUGFyYW1zID09IE5VTEwpCisgICAgICAgIHJldHVybiBQVl9GQUxTRTsKKworICAgIGVuY0RhdGEtPm5leHRFbmNJVm9wID0gMTsKKyAgICByZXR1cm4gUFZfVFJVRTsKK30KKyNlbmRpZgorI2lmbmRlZiBMSU1JVEVEX0FQSQorLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkdldEVuY01lbW9yeVVzYWdlKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDEwLzE3LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworCitPU0NMX0VYUE9SVF9SRUYgSW50IFBWR2V0RW5jTWVtb3J5VXNhZ2UoVmlkZW9FbmNDb250cm9scyAqZW5jQ3RybCkKK3sKKyAgICBWaWRlb0VuY0RhdGEgICAgKmVuY0RhdGE7CisKKyAgICBlbmNEYXRhID0gKFZpZGVvRW5jRGF0YSAqKWVuY0N0cmwtPnZpZGVvRW5jb2RlckRhdGE7CisKKyAgICBpZiAoZW5jRGF0YSA9PSBOVUxMKQorICAgICAgICByZXR1cm4gUFZfRkFMU0U7CisgICAgaWYgKGVuY0RhdGEtPmVuY1BhcmFtcyA9PSBOVUxMKQorICAgICAgICByZXR1cm4gUFZfRkFMU0U7CisgICAgcmV0dXJuIGVuY0RhdGEtPmVuY1BhcmFtcy0+TWVtb3J5VXNhZ2U7Cit9CisjZW5kaWYKKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkdldEhpbnRUcmFjaygpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDEvMTcvMjAwMSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworCitPU0NMX0VYUE9SVF9SRUYgQm9vbCBQVkdldEhpbnRUcmFjayhWaWRlb0VuY0NvbnRyb2xzICplbmNDdHJsLCBNUDRIaW50VHJhY2sgKmluZm8pCit7CisgICAgVmlkZW9FbmNEYXRhICAgICplbmNEYXRhOworCisgICAgZW5jRGF0YSA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOworCisgICAgaWYgKGVuY0RhdGEgPT0gTlVMTCkKKyAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOworICAgIGlmIChlbmNEYXRhLT5lbmNQYXJhbXMgPT0gTlVMTCkKKyAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOworICAgIGluZm8tPk1UQiA9IGVuY0RhdGEtPmhpbnRUcmFja0luZm8uTVRCOworICAgIGluZm8tPkxheWVySUQgPSBlbmNEYXRhLT5oaW50VHJhY2tJbmZvLkxheWVySUQ7CisgICAgaW5mby0+Q29kZVR5cGUgPSBlbmNEYXRhLT5oaW50VHJhY2tJbmZvLkNvZGVUeXBlOworICAgIGluZm8tPlJlZlNlbENvZGUgPSBlbmNEYXRhLT5oaW50VHJhY2tJbmZvLlJlZlNlbENvZGU7CisKKyAgICByZXR1cm4gUFZfVFJVRTsKK30KKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBQVkdldE1heFZpZGVvRnJhbWVTaXplKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDcvMTcvMjAwMSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogRnVuY3Rpb24gbWVyZWx5IHJldHVybnMgdGhlIG1heGltdW0gYnVmZmVyIHNpemUgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworCitPU0NMX0VYUE9SVF9SRUYgQm9vbCBQVkdldE1heFZpZGVvRnJhbWVTaXplKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwsIEludCAqbWF4VmlkZW9GcmFtZVNpemUpCit7CisgICAgVmlkZW9FbmNEYXRhICAgICplbmNEYXRhOworCisgICAgZW5jRGF0YSA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOworCisgICAgaWYgKGVuY0RhdGEgPT0gTlVMTCkKKyAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOworICAgIGlmIChlbmNEYXRhLT5lbmNQYXJhbXMgPT0gTlVMTCkKKyAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOworCisKKworICAgICptYXhWaWRlb0ZyYW1lU2l6ZSA9IGVuY0RhdGEtPmVuY1BhcmFtcy0+QnVmZmVyU2l6ZVswXTsKKworICAgIGlmIChlbmNEYXRhLT5lbmNQYXJhbXMtPm5MYXllcnMgPT0gMikKKyAgICAgICAgaWYgKCptYXhWaWRlb0ZyYW1lU2l6ZSA8IGVuY0RhdGEtPmVuY1BhcmFtcy0+QnVmZmVyU2l6ZVsxXSkKKyAgICAgICAgICAgICptYXhWaWRlb0ZyYW1lU2l6ZSA9IGVuY0RhdGEtPmVuY1BhcmFtcy0+QnVmZmVyU2l6ZVsxXTsKKyAgICAqbWF4VmlkZW9GcmFtZVNpemUgPj49IDM7ICAgLyogQ29udmVydCB0byBCeXRlcyAqLworCisgICAgaWYgKCptYXhWaWRlb0ZyYW1lU2l6ZSA8PSA0MDAwKQorICAgICAgICAqbWF4VmlkZW9GcmFtZVNpemUgPSA0MDAwOworCisgICAgcmV0dXJuIFBWX1RSVUU7Cit9CisjaWZuZGVmIExJTUlURURfQVBJCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFBWR2V0VkJWU2l6ZSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogNC8xNS8yMDAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiBGdW5jdGlvbiBtZXJlbHkgcmV0dXJucyB0aGUgbWF4aW11bSBidWZmZXIgc2l6ZSAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisKK09TQ0xfRVhQT1JUX1JFRiBCb29sIFBWR2V0VkJWU2l6ZShWaWRlb0VuY0NvbnRyb2xzICplbmNDdHJsLCBJbnQgKlZCVlNpemUpCit7CisgICAgVmlkZW9FbmNEYXRhICAgICplbmNEYXRhOworCisgICAgZW5jRGF0YSA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOworCisgICAgaWYgKGVuY0RhdGEgPT0gTlVMTCkKKyAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOworICAgIGlmIChlbmNEYXRhLT5lbmNQYXJhbXMgPT0gTlVMTCkKKyAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOworCisgICAgKlZCVlNpemUgPSBlbmNEYXRhLT5lbmNQYXJhbXMtPkJ1ZmZlclNpemVbMF07CisgICAgaWYgKGVuY0RhdGEtPmVuY1BhcmFtcy0+bkxheWVycyA9PSAyKQorICAgICAgICAqVkJWU2l6ZSArPSBlbmNEYXRhLT5lbmNQYXJhbXMtPkJ1ZmZlclNpemVbMV07CisKKyAgICByZXR1cm4gUFZfVFJVRTsKKworfQorI2VuZGlmCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IEVuY29kZVZPU19TdGFydCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDgvMjIvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiBFbmNvZGVzIHRoZSBWT1MsVk8sIGFuZCBWT0wgb3IgU2hvcnQgSGVhZGVycyAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCitQVl9TVEFUVVMgRW5jb2RlVk9TX1N0YXJ0KFZpZGVvRW5jQ29udHJvbHMgKmVuY29kZXJDb250cm9sKQoreworCisgICAgVmlkZW9FbmNEYXRhICp2aWRlbyA9IChWaWRlb0VuY0RhdGEgKillbmNvZGVyQ29udHJvbC0+dmlkZW9FbmNvZGVyRGF0YTsKKyAgICBWb2wgICAgICAgICAqY3VyclZvbCA9IHZpZGVvLT52b2xbdmlkZW8tPmN1cnJMYXllcl07CisgICAgUFZfU1RBVFVTIHN0YXR1cyA9IFBWX1NVQ0NFU1M7CisgICAgLy9pbnQgcHJvZmlsZV9sZXZlbD0weDAxOworICAgIEJpdHN0cmVhbUVuY1ZpZGVvICpzdHJlYW0gPSB2aWRlby0+Yml0c3RyZWFtMTsKKyAgICBpbnQgaSwgajsKKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAvKiBDaGVjayBmb3Igc2hvcnRfdmlkZW9faGVhZGVyICovCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworICAgIGlmIChjdXJyVm9sLT5zaG9ydFZpZGVvSGVhZGVyID09IDEpCisgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgLyogU2hvcnQgVmlkZW8gSGVhZGVyIG9yIE00ViAqLworCisgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICAgICAgLyogVmlzdWFsT2JqZWN0U2VxdWVuY2UgKCkqLworICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKiovCisgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dEdUMTZCaXRzKHN0cmVhbSwgMzIsIFNFU1NJT05fU1RBUlRfQ09ERSk7CisgICAgICAgIC8qICBEZXRlcm1pbmUgcHJvZmlsZV9sZXZlbCAqLworICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1QdXRCaXRzKHN0cmVhbSwgOCwgdmlkZW8tPmVuY1BhcmFtcy0+UHJvZmlsZUxldmVsW3ZpZGVvLT5jdXJyTGF5ZXJdKTsKKworICAgICAgICAvKioqKioqKioqKioqKioqKioqLworICAgICAgICAvKiBWaXN1YWxPYmplY3QoKSAqLworICAgICAgICAvKioqKioqKioqKioqKioqKioqLworCisgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dEdUMTZCaXRzKHN0cmVhbSwgMzIsIFZJU1VBTF9PQkpFQ1RfU1RBUlRfQ09ERSk7CisgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dDFCaXRzKHN0cmVhbSwgMHgwMCk7IC8qIHZpc3VhbCBvYmplY3QgaWRlbnRpZmllciAqLworICAgICAgIC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dHVzID0gQml0c3RyZWFtUHV0MUJpdHMoc3RyZWFtLCAweDAxKTsvKiBvYm1jX2Rpc2FibGUgPSAxICovCisgICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1QdXQxQml0cyhzdHJlYW0sIDB4MDApOy8qIHNwcml0ZV9lbmFibGUgPSAwICovCisgICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1QdXQxQml0cyhzdHJlYW0sIDB4MDApOy8qIG5vdF84X2JpdCA9IDAgKi8KKyAgICAgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dDFCaXRzKHN0cmVhbSwgY3VyclZvbC0+cXVhbnRUeXBlKTsvKiAgIHF1YW50X3R5cGUgKi8KKworICAgICAgICAgICAgaWYgKGN1cnJWb2wtPnF1YW50VHlwZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1QdXQxQml0cyhzdHJlYW0sIGN1cnJWb2wtPmxvYWRJbnRyYVF1YW50TWF0KTsgLyogSW50cmEgcXVhbnQgbWF0cml4ICovCisgICAgICAgICAgICAgICAgaWYgKGN1cnJWb2wtPmxvYWRJbnRyYVF1YW50TWF0KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChqID0gNjM7IGogPj0gMTsgai0tKQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGN1cnJWb2wtPmlxbWF0WyooemlnemFnX2kraildICE9IGN1cnJWb2wtPmlxbWF0WyooemlnemFnX2krai0xKV0pCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGlmICgoaiA9PSAxKSAmJiAoY3VyclZvbC0+aXFtYXRbKih6aWd6YWdfaStqKV0gPT0gY3VyclZvbC0+aXFtYXRbKih6aWd6YWdfaStqLTEpXSkpCisgICAgICAgICAgICAgICAgICAgICAgICBqID0gMDsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGogKyAxOyBpKyspCisgICAgICAgICAgICAgICAgICAgICAgICBCaXRzdHJlYW1QdXRCaXRzKHN0cmVhbSwgOCwgY3VyclZvbC0+aXFtYXRbKih6aWd6YWdfaStpKV0pOworICAgICAgICAgICAgICAgICAgICBpZiAoaiA8IDYzKQorICAgICAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtUHV0Qml0cyhzdHJlYW0sIDgsIDApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBmb3IgKGogPSAwOyBqIDwgNjQ7IGorKykKKyAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJWb2wtPmlxbWF0W2pdID0gbXBlZ19pcW1hdF9kZWZbal07CisKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtUHV0MUJpdHMoc3RyZWFtLCBjdXJyVm9sLT5sb2FkTm9uSW50cmFRdWFudE1hdCk7IC8qIE5vbi1JbnRyYSBxdWFudCBtYXRyaXggKi8KKyAgICAgICAgICAgICAgICBpZiAoY3VyclZvbC0+bG9hZE5vbkludHJhUXVhbnRNYXQpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBmb3IgKGogPSA2MzsgaiA+PSAxOyBqLS0pCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VyclZvbC0+bmlxbWF0WyooemlnemFnX2kraildICE9IGN1cnJWb2wtPm5pcW1hdFsqKHppZ3phZ19pK2otMSldKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBpZiAoKGogPT0gMSkgJiYgKGN1cnJWb2wtPm5pcW1hdFsqKHppZ3phZ19pK2opXSA9PSBjdXJyVm9sLT5uaXFtYXRbKih6aWd6YWdfaStqLTEpXSkpCisgICAgICAgICAgICAgICAgICAgICAgICBqID0gMDsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGogKyAxOyBpKyspCisgICAgICAgICAgICAgICAgICAgICAgICBCaXRzdHJlYW1QdXRCaXRzKHN0cmVhbSwgOCwgY3VyclZvbC0+bmlxbWF0WyooemlnemFnX2kraSldKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGogPCA2MykKKyAgICAgICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVB1dEJpdHMoc3RyZWFtLCA4LCAwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IDY0OyBqKyspCisgICAgICAgICAgICAgICAgICAgICAgICBjdXJyVm9sLT5uaXFtYXRbal0gPSBtcGVnX25xbWF0X2RlZltqXTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dDFCaXRzKHN0cmVhbSwgMHgwMSk7ICAgLyogY29tcGxleGl0eV9lc3RpbWF0aW9uX2Rpc2FibGUgPSAxICovCisgICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1QdXQxQml0cyhzdHJlYW0sIGN1cnJWb2wtPlJlc3luY01hcmtlckRpc2FibGUpOy8qIFJlc3luY19tYXJrZXJfZGlzYWJsZSAqLworICAgICAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtUHV0MUJpdHMoc3RyZWFtLCBjdXJyVm9sLT5kYXRhUGFydGl0aW9uaW5nKTsvKiBEYXRhIHBhcnRpdGlvbmVkICovCisKKyAgICAgICAgICAgIGlmIChjdXJyVm9sLT5kYXRhUGFydGl0aW9uaW5nKQorICAgICAgICAgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dDFCaXRzKHN0cmVhbSwgY3VyclZvbC0+dXNlUmV2ZXJzZVZMQyk7IC8qIFJldmVyc2libGVfdmx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tUHV0Qml0cyhzdHJlYW0sIDUsIGN1cnJWb2wtPnZlclNhbXBfbSk7Lyp2ZXJ0X3NhbXBsaW5nX2ZhY3Rvcl9tKi8KKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1QdXQxQml0cyhzdHJlYW0sIGN1cnJWb2wtPmVuaGFuY2VtZW50VHlwZSk7LyogZW5oYW5jZW1lbnRfdHlwZSovCisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIC8qIE5vIFNjYWxhYmlsaXR5ICovCisgICAgICAgICAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtUHV0MUJpdHMoc3RyZWFtLCBjdXJyVm9sLT5zY2FsYWJpbGl0eSk7LyogU2NhbGFiaWxpdHkgPSAwICovCisKKyAgICAgICAgICAgIC8qdGVtcCA9ICovCisgICAgICAgICAgICBCaXRzdHJlYW1NcGVnNEJ5dGVBbGlnblN0dWZmaW5nKHN0cmVhbSk7IC8qIEJ5dGUgYWxpZ24gSGVhZGVycyBmb3IgVk9QICovCisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gc3RhdHVzOworfQorCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFZPU19FbmQoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDgvMjIvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiBWaXN1YWwgT2JqZWN0IFNlcXVlbmNlIEVuZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCisvKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisKK1BWX1NUQVRVUyBWT1NfRW5kKFZpZGVvRW5jQ29udHJvbHMgKmVuY29kZXJDb250cm9sKQoreworICAgIFBWX1NUQVRVUyBzdGF0dXMgPSBQVl9TVUNDRVNTOworICAgIFZpZGVvRW5jRGF0YSAqdmlkZW8gPSAoVmlkZW9FbmNEYXRhICopZW5jb2RlckNvbnRyb2wtPnZpZGVvRW5jb2RlckRhdGE7CisgICAgVm9sICAgICAgICAgKmN1cnJWb2wgPSB2aWRlby0+dm9sW3ZpZGVvLT5jdXJyTGF5ZXJdOworICAgIEJpdHN0cmVhbUVuY1ZpZGVvICpzdHJlYW0gPSBjdXJyVm9sLT5zdHJlYW07CisKKworICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dEJpdHMoc3RyZWFtLCBTRVNTSU9OX0VORF9DT0RFLCAzMik7CisKKyAgICByZXR1cm4gc3RhdHVzOworfQorCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IERldGVybWluZUNvZGluZ0xheWVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDYvMDIvMjAwMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiBGaW5kIGxheWVyIHRvIGNvZGUgYmFzZWQgb24gY3VycmVudCBtb2QgdGltZSwgYXNzdW1pbmcgdGhhdAorICAgICAgICAgICAgICAgaXQncyB0aW1lIHRvIGVuY29kZSBlbmhhbmNlZCBsYXllci4gICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6IE51bWJlciBvZiBsYXllciB0byBjb2RlLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworCitJbnQgRGV0ZXJtaW5lQ29kaW5nTGF5ZXIoVmlkZW9FbmNEYXRhICp2aWRlbywgSW50ICpuTGF5ZXIsIFVMb25nIG1vZFRpbWUpCit7CisgICAgVm9sICoqdm9sID0gdmlkZW8tPnZvbDsKKyAgICBWaWRlb0VuY1BhcmFtcyAqZW5jUGFyYW1zID0gdmlkZW8tPmVuY1BhcmFtczsKKyAgICBJbnQgbnVtTGF5ZXJzID0gZW5jUGFyYW1zLT5uTGF5ZXJzOworICAgIFVJbnQgbW9kVGltZVJlZiA9IHZpZGVvLT5tb2RUaW1lUmVmOworICAgIGZsb2F0ICpMYXllckZyYW1lUmF0ZSA9IGVuY1BhcmFtcy0+TGF5ZXJGcmFtZVJhdGU7CisgICAgVUludCBmcmFtZU51bVs0XSwg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W1lbnQgPSBmcmFtZVRpY2sgLSB2aWRlby0+cmVmVGlja1tpXTsKKworCisgICAgdm9sW2ldLT5tb2R1bG9UaW1lQmFzZSA9IDA7CisgICAgd2hpbGUgKHZvbFtpXS0+dGltZUluY3JlbWVudCA+PSB2b2xbaV0tPnRpbWVJbmNyZW1lbnRSZXNvbHV0aW9uKQorICAgIHsKKyAgICAgICAgdm9sW2ldLT50aW1lSW5jcmVtZW50IC09IHZvbFtpXS0+dGltZUluY3JlbWVudFJlc29sdXRpb247CisgICAgICAgIHZvbFtpXS0+bW9kdWxvVGltZUJhc2UrKzsKKyAgICAgICAgLyogZG8gbm90IHVwZGF0ZSByZWZUaWNrIGFuZCBtb2RUaW1lUmVmIHlldCwgZG8gaXQgYWZ0ZXIgZW5jb2RpbmchISAqLworICAgIH0KKworICAgIGlmICh2aWRlby0+cmVsTGF5ZXJDb2RlVGltZVtpXSA8PSAwKSAgICAvKiBubyBza2lwcGluZyAqLworICAgIHsKKyAgICAgICAgZW5jb2RlVm9wID0gMTsKKyAgICAgICAgdmlkZW8tPmN1cnJMYXllciA9ICpuTGF5ZXIgPSBpOworICAgICAgICB2aWRlby0+cmVsTGF5ZXJDb2RlVGltZVtpXSArPSAxMDAwOworCisgICAgICAgIC8qIHRha2VzIGNhcmUgb2YgbW9yZSBkcm9wcGVkIGZyYW1lIHRoYW4gZXhwZWN0ZWQgKi8KKyAgICAgICAgZXh0cmFfc2tpcCA9IC0xOworICAgICAgICBmcmFtZUluYyA9IChmcmFtZU51bVtpXSAtIHZpZGVvLT5wcmV2RnJhbWVOdW1baV0pOworICAgICAgICBleHRyYV9za2lwICs9IGZyYW1lSW5jOworCisgICAgICAgIGlmIChleHRyYV9za2lwID4gMCkKKyAgICAgICAgeyAgIC8qIHVwZGF0ZSByYy0+TnIsIHJjLT5CLCAocmMtPlJyKSovCisgICAgICAgICAgICB2aWRlby0+bmV4dEVuY0lWb3AgLT0gZXh0cmFfc2tpcDsKKyAgICAgICAgICAgIHZpZGVvLT5udW1Wb3BzSW5HT1AgKz0gZXh0cmFfc2tpcDsKKyAgICAgICAgICAgIGlmIChlbmNQYXJhbXMtPlJDX1R5cGUgIT0gQ09OU1RBTlRfUSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBSQ19VcGRhdGVCdWZmZXIodmlkZW8sIGksIGV4dHJhX3NraXApOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICB9CisgICAgLyogdXBkYXRlIGZyYW1lIG5vLiAqLworICAgIHZpZGVvLT5wcmV2RnJhbWVOdW1baV0gPSBmcmFtZU51bVtpXTsKKworICAgIC8qIGdvIHRocm91Z2ggYWxsIGxvd2VyIGxheWVyICovCisgICAgZm9yIChpID0gKG51bUxheWVycyAtIDIpOyBpID49IDA7IGktLSkKKyAgICB7CisKKyAgICAgICAgdmlkZW8tPnJlbExheWVyQ29kZVRpbWVbaV0gLT0gMTAwMDsKKworICAgICAgICAvKiBmaW5kIHRpbWVJbmNyZW1lbnQgdG8gYmUgcHV0IGluIHRoZSBiaXRzdHJlYW0gKi8KKyAgICAgICAgdm9sW2ldLT50aW1lSW5jcmVtZW50ID0gZnJhbWVUaWNrIC0gdmlkZW8tPnJlZlRpY2tbaV07CisKKyAgICAgICAgaWYgKHZpZGVvLT5yZWxMYXllckNvZGVUaW1lW2ldIDw9IDApIC8qIHRpbWUgdG8gZW5jb2RlIGJhc2UgKi8KKyAgICAgICAgeworICAgICAgICAgICAgLyogMTIvMjcvMDAgKi8KKyAgICAgICAgICAgIGVuY29kZVZvcCA9IDE7CisgICAgICAgICAgICB2aWRlby0+Y3VyckxheWVyID0gKm5MYXllciA9IGk7CisgICAgICAgICAgICB2aWRlby0+cmVsTGF5ZXJDb2RlVGltZVtpXSArPQorICAgICAgICAgICAgICAgIChJbnQpKCgxMDAwLjAgKiBlbmNQYXJhbXMtPkxheWVyRnJhbWVSYXRlW251bUxheWVycy0xXSkgLyBlbmNQYXJhbXMtPkxheWVyRnJhbWVSYXRlW2ldKTsKKworICAgICAgICAgICAgdm9sW2ldLT5tb2R1bG9UaW1lQmFzZSA9IDA7CisgICAgICAgICAgICB3aGlsZSAodm9sW2ldLT50aW1lSW5jcmVtZW50ID49IHZvbFtpXS0+dGltZUluY3JlbWVudFJlc29sdXRpb24pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdm9sW2ldLT50aW1lSW5jcmVtZW50IC09IHZvbFtpXS0+dGltZUluY3JlbWVudFJlc29sdXRpb247CisgICAgICAgICAgICAgICAgdm9sW2ldLT5tb2R1bG9UaW1lQmFzZSsrOworICAgICAgICAgICAgICAgIC8qIGRvIG5vdCB1cGRhdGUgcmVmVGljayBhbmQgbW9kVGltZVJlZiB5ZXQsIGRvIGl0IGFmdGVyIGVuY29kaW5nISEgKi8KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLyogdGFrZXMgY2FyZSBvZiBtb3JlIGRyb3BwZWQgZnJhbWUgdGhhbiBleHBlY3RlZCAqLworICAgICAgICAgICAgZnJhbWVOdW1baV0gPSAoVUludCkoKGZyYW1lTW9kVGltZSAtIG1vZFRpbWVSZWYpICogZW5jUGFyYW1zLT5MYXllckZyYW1lUmF0ZVtpXSArIDUwMCkgLyAxMDAwOworICAgICAgICAgICAgaWYgKHZpZGVvLT52b2xJbml0aWFsaXplW2ldKQorICAgICAgICAgICAgICAgIHZpZGVvLT5wcmV2RnJhbWVOdW1baV0gPSBmcmFtZU51bVtpXSAtIDE7CisKKyAgICAgICAgICAgIGV4dHJhX3NraXAgPSAtMTsKKyAgICAgICAgICAgIGZyYW1lSW5jID0gKGZyYW1lTnVtW2ldIC0gdmlkZW8tPnByZXZGcmFtZU51bVtpXSk7CisgICAgICAgICAgICBleHRyYV9za2lwICs9IGZyYW1lSW5jOworCisgICAgICAgICAgICBpZiAoZXh0cmFfc2tpcCA+IDApCisgICAgICAgICAgICB7ICAgLyogdXBkYXRlIHJjLT5OciwgcmMtPkIsIChyYy0+UnIpKi8KKyAgICAgICAgICAgICAgICBpZiAoZW5jUGFyYW1zLT5SQ19UeXBlICE9IENPTlNUQU5UX1EpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBSQ19VcGRhdGVCdWZmZXIodmlkZW8sIGksIGV4dHJhX3NraXApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8qIHVwZGF0ZSBmcmFtZSBuby4gKi8KKyAgICAgICAgICAgIHZpZGVvLT5wcmV2RnJhbWVOdW1baV0gPSBmcmFtZU51bVtpXTsKKyAgICAgICAgfQorICAgIH0KKworI2lmZGVmIF9QUklOVF9TVEFUCisgICAgaWYgKGVuY29kZVZvcCkKKyAgICAgICAgcHJpbnRmKCIgVEk6ICVkICIsIHZvbFsqbkxheWVyXS0+dGltZUluY3JlbWVudCk7CisjZW5kaWYKKworICAgIHJldHVybiBlbmNvZGVWb3A7Cit9CisKKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworLyogIEZ1bmN0aW9uIDogRGV0ZXJtaW5lVm9wVHlwZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRGF0ZSAgICAgOiAwNi8wMi8yMDAxICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBQdXJwb3NlICA6IFRoZSBuYW1lIHNheXMgaXQgYWxsLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiB2b2lkIC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKwordm9pZCBEZXRlcm1pbmVWb3BUeXBlKFZpZGVvRW5jRGF0YSAqdmlkZW8sIEludCBjdXJyTGF5ZXIpCit7CisgICAgVmlkZW9FbmNQYXJhbXMgKmVuY1BhcmFtcyA9IHZpZGVvLT5lbmNQYXJhbXM7CisvLyAgVm9sICpjdXJyVm9sID0gdmlkZW8tPnZvbFtjdXJyTGF5ZXJdOworCisgICAgaWYgKGVuY1BhcmFtcy0+SW50cmFQZXJpb2QgPT0gMCkgLyogSS1WT1BzIG9ubHkgKi8KKyAgICB7CisgICAgICAgIGlmICh2aWRlby0+Y3VyckxheWVyID4gMCkKKyAgICAgICAgICAgIHZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9IFBfVk9QOworICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9IElfVk9QOworICAgICAgICAgICAgaWYgKHZpZGVvLT5udW1Wb3BzSW5HT1AgPj0gMTMyKQorICAgICAgICAgICAgICAgIHZpZGVvLT5udW1Wb3BzSW5HT1AgPSAwOworICAgICAgICB9CisgICAgfQorICAgIGVsc2UgaWYgKGVuY1BhcmFtcy0+SW50cmFQZXJpb2QgPT0gLTEpICAvKiBJUFBQUFAuLi4gKi8KKyAgICB7CisKKyAgICAgICAgLyogbWFpbnRhaW4gZnJhbWUgdHlwZSBpZiBwcmV2aW91cyBmcmFtZSBpcyBwcmUtc2tpcHBlZCwgMDYvMDIvMjAwMSAqLworICAgICAgICBpZiAoZW5jUGFyYW1zLT5SQ19UeXBlID09IENPTlNUQU5UX1EgfHwgdmlkZW8tPnJjW2N1cnJMYXllcl0tPnNraXBfbmV4dF9mcmFtZSAhPSAtMSkKKyAgICAgICAgICAgIHZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9IFBfVk9QOworCisgICAgICAgIGlmICh2aWRlby0+Y3VyckxheWVyID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICgvKnZpZGVvLT5udW1Wb3BzSW5HT1A+PTEzMiB8fCAqL3ZpZGVvLT52b2xJbml0aWFsaXplW2N1cnJMYXllcl0pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID0gSV9WT1A7CisgICAgICAgICAgICAgICAgdmlkZW8tPm51bVZvcHNJbkdPUCA9IDA7IC8qIGZvcmNlIElOVFJBIHVwZGF0ZSBldmVyeSAxMzIgYmFzZSBmcmFtZXMqLworICAgICAgICAgICAgICAgIHZpZGVvLT5uZXh0RW5jSVZvcCA9IDE7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmICh2aWRlby0+bmV4dEVuY0lWb3AgPT0gMCB8fCB2aWRlby0+Y3VyclZvcC0+cHJlZGljdGlvblR5cGUgPT0gSV9WT1ApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmlkZW8tPm51bVZvcHNJbkdPUCA9IDA7CisgICAgICAgICAgICAgICAgdmlkZW8tPm5leHRFbmNJVm9wID0gMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICBlbHNlICAgLyogSW50cmFQZXJpb2Q+MCA6IElQUFBQUElQUFBQUEkuLi4gKi8KKyAgICB7CisKKyAgICAgICAgLyogbWFpbnRhaW4gZnJhbWUgdHlwZSBpZiBwcmV2aW91cyBmcmFtZSBpcyBwcmUtc2tpcHBlZCwgMDYvMDIvMjAwMSAqLworICAgICAgICBpZiAoZW5jUGFyYW1zLT5SQ19UeXBlID09IENPTlNUQU5UX1EgfHwgdmlkZW8tPnJjW2N1cnJMYXllcl0tPnNraXBfbmV4dF9mcmFtZSAhPSAtMSkKKyAgICAgICAgICAgIHZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9IFBfVk9QOworCisgICAgICAgIGlmIChjdXJyTGF5ZXIgPT0gMCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKHZpZGVvLT5uZXh0RW5jSVZvcCA8PSAwIHx8IHZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9PSBJX1ZPUCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2aWRlby0+bmV4dEVuY0lWb3AgPSBlbmNQYXJhbXMtPkludHJhUGVyaW9kOworICAgICAgICAgICAgICAgIHZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9IElfVk9QOworICAgICAgICAgICAgICAgIHZpZGVvLT5udW1Wb3BzSW5HT1AgPSAwOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIDsKK30KKworLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCisvKiAgRnVuY3Rpb24gOiBVcGRhdGVTa2lwTmV4dEZyYW1lICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBEYXRlICAgICA6IDA2LzAyLzIwMDEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFB1cnBvc2UgIDogRnJvbSByYXRlIGNvbnRyb2wgZnJhbWUgc2tpcHBpbmcgZGVjaXNpb24sIHVwZGF0ZSB0aW1pbmcKKyAgICAgICAgICAgICAgICByZWxhdGVkIHBhcmFtZXRlcnMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUmV0dXJuICAgOiBDdXJyZW50IGNvZGVkIGxheWVyLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKworSW50IFVwZGF0ZVNraXBOZXh0RnJhbWUoVmlkZW9FbmNEYXRhICp2aWRlbywgVUxvbmcgKm1vZFRpbWUsIEludCAqc2l6ZSwgUFZfU1RBVFVTIHN0YXR1cykKK3sKKyAgICBJbnQgY3VyckxheWVyID0gdmlkZW8tPmN1cnJMYXllcjsKKyAgICBJbnQgbkxheWVyID0gY3VyckxheWVyOworICAgIFZpZGVvRW5jUGFyYW1zICplbmNQYXJhbXMgPSB2aWRlby0+ZW5jUGFyYW1zOworICAgIEludCBudW1MYXllcnMgPSBlbmNQYXJhbXMtPm5MYXllcnM7CisgICAgVm9sICpjdXJyVm9sID0gdmlkZW8tPnZvbFtjdXJyTGF5ZXJdOworICAgIFZvbCAqKnZvbCA9IHZpZGVvLT52b2w7CisgICAgSW50IG51bV9za2lwLCBleHRyYV9za2lwOworICAgIEludCBpOworICAgIFVJbnQgbmV3UmVmVGljaywgZGVsdGFNb2RUaW1lOworICAgIFVJbnQgdGVtcDsKKworICAgIGlmIChlbmNQYXJhbXMtPlJDX1R5cGUgIT0gQ09OU1RBTlRfUSkKKyAgICB7CisgICAgICAgIGlmICh2aWRlby0+dm9sSW5pdGlhbGl6ZVswXSAmJiBjdXJyTGF5ZXIgPT0gMCkgIC8qIGFsd2F5cyBlbmNvZGUgdGhlIGZpcnN0IGZyYW1lICovCisgICAgICAgIHsKKyAgICAgICAgICAgIFJDX1Jlc2V0U2tpcE5leHRGcmFtZSh2aWRlbywgY3VyckxheWVyKTsKKyAgICAgICAgICAgIC8vcmV0dXJuIGN1cnJMYXllcjsgIDA5LzE1LzA1CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoUkNfR2V0U2tpcE5leHRGcmFtZSh2aWRlbywgY3VyckxheWVyKSA8IDAgfHwgc3RhdHVzID09IFBWX0VORF9PRl9CVUYpICAgLyogU2tpcCBDdXJyZW50IEZyYW1lICovCisgICAgICAgICAgICB7CisKKyNpZmRlZiBfUFJJTlRfU1RBVAorICAgICAgICAgICAgICAgIHByaW50ZigiU2tpcCBjdXJyZW50IGZyYW1lIik7CisjZW5kaWYKKyAgICAgICAgICAgICAgICBjdXJyVm9sLT5tb2R1bG9UaW1lQmFzZSA9IGN1cnJWb2wtPnByZXZNb2R1bG9UaW1lQmFzZTsKKworICAgICAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKiovCisgICAgICAgICAgICAgICAgLyogcHJlcGFyZSB0byByZXR1cm4gKi8KKyAgICAgICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqLworICAgICAgICAgICAgICAgICpzaXplID0gMDsgIC8qIFNldCBCaXRzdHJlYW0gYnVmZmVyIHRvIHplcm8gKi8KKworICAgICAgICAgICAgICAgIC8qIERldGVybWluZSBuTGF5ZXIgYW5kIG1vZFRpbWUgZm9yIG5leHQgZW5jb2RlICovCisKKyAgICAgICAgICAgICAgICAqbW9kVGltZSA9IHZpZGVvLT5uZXh0TW9kVGltZTsKKyAgICAgICAgICAgICAgICBuTGF5ZXIgPSAtMTsKKworICAgICAgICAgICAgICAgIHJldHVybiBuTGF5ZXI7IC8qIHJldHVybiBpbW1lZGlhdGVseSB3aXRob3V0IHVwZGF0aW5nIFJlZlRpY2sgJiBtb2RUaW1lUmVmICovCisgICAgICAgICAgICAgICAgLyogSWYgSS1WT1Agd2FzIGF0dGVtcHRlZCwgdGhlbiBlbnN1cmUgbmV4dCBiYXNlIGlzIEktVk9QICovCisgICAgICAgICAgICAgICAgLyppZigoZW5jUGFyYW1zLT5JbnRyYVBlcmlvZD4wKSAmJiAodmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID09IElfVk9QKSkKKyAgICAgICAgICAgICAgICB2aWRlby0+bmV4dEVuY0lWb3AgPSAwOyBjb21tZW50ZWQgb3V0IGJ5IDA2LzA1LzAxICovCisKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYgKChudW1fc2tpcCA9IFJDX0dldFNraXBOZXh0RnJhbWUodmlkZW8sIGN1cnJMYXllcikpID4gMCkKKyAgICAgICAgICAgIHsKKworI2lmZGVmIF9QUklOVF9TVEFUCisgICAgICAgICAgICAgICAgcHJpbnRmKCJTa2lwIG5leHQgJWQgZnJhbWVzIiwgbnVtX3NraXApOworI2VuZGlmCisgICAgICAgICAgICAgICAgLyogdG8ga2VlcCB0aGUgTnIgb2YgZW5oIGxheWVyIHRoZSBzYW1lICovCisgICAgICAgICAgICAgICAgLyogYWRqdXN0IHJlbExheWVyQ29kZVRpbWUgb25seSwgZG8gbm90IGFkanVzdCBsYXllckNvZGVUaW1lW251bUxheWVycy0xXSAqLworICAgICAgICAgICAgICAgIGV4dHJhX3NraXAgPSAwOworICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBjdXJyTGF5ZXI7IGkrKykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cmVsTGF5ZXJDb2RlVGltZVtpXSA8PSAxMDAwKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBleHRyYV9za2lwID0gMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgZm9yIChpID0gY3VyckxheWVyOyBpIDwgbnVtTGF5ZXJzOyBpKyspCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB2aWRlby0+cmVsTGF5ZXJDb2RlVGltZVtpXSArPSAobnVtX3NraXAgKyBleHRyYV9za2lwKSAqCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoSW50KSgoMTAwMC4wICogZW5jUGFyYW1zLT5MYXllckZyYW1lUmF0ZVtudW1MYXllcnMtMV0pIC8gZW5jUGFyYW1zLT5MYXllckZyYW1lUmF0ZVtpXSkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfS8qIGZpcnN0IGZyYW1lICovCisgICAgfQorICAgIC8qKioqKiAgY3VycmVudCBmcmFtZSBpcyBlbmNvZGVkLCBub3cgdXBkYXRlIHJlZlRpY2sgKioqKioqLworCisgICAgdmlkZW8tPnJlZlRpY2tbY3VyckxheWVyXSArPSB2b2xbY3VyckxheWVyXS0+cHJldk1vZHVsb1RpbWVCYXNlICogdm9sW2N1cnJMYXllcl0tPnRpbWVJbmNyZW1lbnRSZXNvbHV0aW9uOworCisgICAgLyogUmVzZXQgbGF5ZXJDb2RlVGltZSBldmVyeSBJLVZPUCB0byBwcmV2ZW50IG92ZXJmbG93ICovCisgICAgaWYgKGN1cnJMYXllciA9PSAwKQorICAgIHsKKyAgICAgICAgLyogIDEyLzEyLzAyLCBmaXggZm9yIHdlaXJkIHRhcmdlciBmcmFtZSByYXRlIG9mIDkuOTkgZnBzIG9yIDMuMzMgZnBzICovCisgICAgICAgIGlmICgoKGVuY1BhcmFtcy0+SW50cmFQZXJpb2QgIT0gMCkgLyomJiAodmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlPT1JX1ZPUCkqLykgfHwKKyAgICAgICAgICAgICAgICAoKGVuY1BhcmFtcy0+SW50cmFQZXJpb2QgPT0gMCkgJiYgKHZpZGVvLT5udW1Wb3BzSW5HT1AgPT0gMCkpKQorICAgICAgICB7CisgICAgICAgICAgICBuZXdSZWZUaWNrID0gdmlkZW8tPnJlZlRpY2tbMF07CisKKyAgICAgICAgICAgIGZvciAoaSA9IDE7IGkgPCBudW1MYXllcnM7IGkrKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnJlZlRpY2tbaV0gPCBuZXdSZWZUaWNrKQorICAgICAgICAgICAgICAgICAgICBuZXdSZWZUaWNrID0gdmlkZW8tPnJlZlRpY2tbaV07CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8qIGNoZWNrIHRvIG1ha2Ugc3VyZSB0aGF0IHRoZSB1cGRhdGUgaXMgaW50ZWdlciBtdWx0aXBsZSBvZiBmcmFtZSBudW1iZXIgKi8KKyAgICAgICAgICAgIC8qIGhvdyBtYW55IG1zZWMgZWxhcHNlZCBmcm9tIGxhc3QgbW9kVGltZVJlZiAqLworICAgICAgICAgICAgZGVsdGFNb2RUaW1lID0gKG5ld1JlZlRpY2sgLyB2b2xbMF0tPnRpbWVJbmNyZW1lbnRSZXNvbHV0aW9uKSAqIDEwMDA7CisKKyAgICAgICAgICAgIGZvciAoaSA9IG51bUxheWVycyAtIDE7IGkgPj0gMDsgaS0tKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRlbXAgPSAoVUludCkoZGVsdGFNb2RUaW1lICogZW5jUGFyYW1zLT5MYXllckZyYW1lUmF0ZVtpXSk7IC8qIDEyLzEyLzAyICovCisgICAgICAgICAgICAgICAgaWYgKHRlbXAgJSAxMDAwKQorICAgICAgICAgICAgICAgICAgICBuZXdSZWZUaWNrID0gMDsKKworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG5ld1JlZlRpY2sgPiAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZpZGVvLT5tb2RUaW1lUmVmICs9IGRlbHRhTW9kVGltZTsKKyAgICAgICAgICAgICAgICBmb3IgKGkgPSBudW1MYXllcnMgLSAxOyBpID49IDA7IGktLSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5wcmV2RnJhbWVOdW1baV0gLT0gKFVJbnQpKGRlbHRhTW9kVGltZSAqIGVuY1BhcmFtcy0+TGF5ZXJGcmFtZVJhdGVbaV0pIC8gMTAwMDsKKyAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnJlZlRpY2tbaV0gLT0gbmV3UmVmVGljazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAqbW9kVGltZSA9ICB2aWRlby0+bmV4dE1vZFRpbWU7CisKKyAgICByZXR1cm4gbkxheWVyOworfQorCisKKyNpZm5kZWYgT1JJR0lOQUxfVkVSU0lPTgorCisvKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KKy8qICBGdW5jdGlvbiA6IFNldFByb2ZpbGVfQnVmZmVyU2l6ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIERhdGUgICAgIDogMDQvMDgvMjAwMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgUHVycG9zZSAgOiBTZXQgcHJvZmlsZSBhbmQgdmlkZW8gYnVmZmVyIHNpemUsIGNvcGllZCBmcm9tIEppbSdzIGNvZGUgICAgKi8KKy8qICAgICAgICAgICAgIGluIFBWSW5pdFZpZGVvRW5jb2RlciguKSwgc2luY2Ugd2UgaGF2ZSBkaWZmZXJlbnQgcGxhY2VzICAgICAqLworLyogICAgICAgICAgICAgdG8gcmVzZXQgcHJvZmlsZSBhbmQgdmlkZW8gYnVmZmVyIHNpemUgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBSZXR1cm4gICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLworCitCb29sIFNldFByb2ZpbGVfQnVmZmVyU2l6ZShWaWRlb0VuY0RhdGEgKnZpZGVvLCBmbG9hdCBkZWxheSwgSW50IGJJbml0aWFsaXplZCkKK3sKKyAgICBJbnQgaSwgaiwgc3RhcnQsIGVuZDsKKy8vICBJbnQgQmFzZU1Cc1BlclNlYyA9IDAsIEVuaE1Cc1BlclNlYyA9IDA7CisgICAgSW50IG5Ub3RhbE1CID0gMDsKKyAgICBJbnQgaWR4LCB0ZW1wX3csIHRlbXBfaCwgbWF4ID0gMCwgbWF4X3dpZHRoLCBtYXhfaGVpZ2h0OworCisgICAgSW50IG5MYXllcnMgPSB2aWRlby0+ZW5jUGFyYW1zLT5uTGF5ZXJzOyAvKiBOdW1iZXIgb2YgTGF5ZXJzIHRvIGJlIGVuY29kZWQgKi8KKworICAgIEludCB0b3RhbF9iaXRyYXRlID0gMCwgYmFzZV9iaXRyYXRlOworICAgIEludCB0b3RhbF9wYWNrZXRfc2l6ZSA9IDAsIGJhc2VfcGFja2V0X3NpemU7CisgICAgSW50IHRvdGFsX01Cc1BlclNlYyA9IDAsIGJhc2VfTUJzUGVyU2VjOworICAgIEludCB0b3R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RlW2luZGV4XSoxMDAxLjAgLyAzMDAwMC4wKSkKKyAgICAgICAgICAgICAgICByZXR1cm4gUFZfRkFMU0U7CisgICAgICAgIH0KKworICAgICAgICAvKiBTZWFyY2ggdGhlIGFwcHJvcHJpYXRlIHByb2ZpbGVAbGV2ZWwgaW5kZXggKi8KKyAgICAgICAgaWYgKCF2aWRlby0+ZW5jUGFyYW1zLT5IMjYzX0VuYWJsZWQgJiYKKyAgICAgICAgICAgICAgICAodmlkZW8tPmVuY1BhcmFtcy0+SW50cmFEQ1ZsY1RociAhPSAwIHx8IHZpZGVvLT5lbmNQYXJhbXMtPlNlYXJjaFJhbmdlID4gMTYpKQorICAgICAgICB7CisgICAgICAgICAgICBsb3dlc3RfbGV2ZWwgPSAxOyAvKiBjYW5ub3QgYWxsb3cgU1BMMCAqLworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgbG93ZXN0X2xldmVsID0gMDsgLyogU1BMMCAqLworICAgICAgICB9CisKKyAgICAgICAgZm9yIChpID0gbG93ZXN0X2xldmVsOyBpIDw9IGluZGV4OyBpKyspCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChpICE9IDQgJiYgLyogc2tpcCBDb3JlIFByb2ZpbGVATGV2ZWwxIGJlY2F1c2UgdGhlIHBhcmFtZXRlcnMgaW4gaXQgYXJlIHNtYWxsZXIgdGhhbiB0aG9zZSBpbiBTaW1wbGUgUHJvZmlsZUBMZXZlbDMgKi8KKyAgICAgICAgICAgICAgICAgICAgYmFzZV9iaXRyYXRlICAgICA8PSBwcm9maWxlX2xldmVsX21heF9iaXRyYXRlW2ldICAgICAmJgorICAgICAgICAgICAgICAgICAgICBiYXNlX3BhY2tldF9zaXplIDw9IHByb2ZpbGVfbGV2ZWxfbWF4X3BhY2tldF9zaXplW2ldICYmCisgICAgICAgICAgICAgICAgICAgIGJhc2VfTUJzUGVyU2VjICAgPD0gcHJvZmlsZV9sZXZlbF9tYXhfbWJzUGVyU2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ICAgICAgdG90YWxfTUJzUGVyU2VjICAgICA+IHNjYWxhYmxlX3Byb2ZpbGVfbGV2ZWxfbWF4X21ic1BlclNlY1tpbmRleF0gICB8fAorICAgICAgICAgICAgICAgIHRvdGFsX1ZCVl9zaXplICAgICAgPiBzY2FsYWJsZV9wcm9maWxlX2xldmVsX21heF9WQlZfc2l6ZVtpbmRleF0pCisKKyAgICAgICAgICAgIHJldHVybiBQVl9GQUxTRTsgLyogQmV5b25kIGdpdmVuIHByb2ZpbGUgYW5kIGxldmVsICovCisKKyAgICAgICAgLyogT25lLXRpbWUgY2hlY2s6IFNpbXBsZSBTY2FsYWJsZSBQcm9maWxlIG9yIENvcmUgU2NhbGFibGUgUHJvZmlsZSAqLworICAgICAgICBpZiAodG90YWxfYml0cmF0ZSAgICAgICA8PSBzY2FsYWJsZV9wcm9maWxlX2xldmVsX21heF9iaXRyYXRlWzJdICAgICAgICAmJgorICAgICAgICAgICAgICAgIHRvdGFsX3BhY2tldF9zaXplICAgPD0gc2NhbGFibGVfcHJvZmlsZV9sZXZlbF9tYXhfcGFja2V0X3NpemVbMl0gICAgJiYKKyAgICAgICAgICAgICAgICB0b3RhbF9NQnNQZXJTZWMgICAgIDw9IHNjYWxhYmxlX3Byb2ZpbGVfbGV2ZWxfbWF4X21ic1BlclNlY1syXSAgICAgICYmCisgICAgICAgICAgICAgICAgdG90YWxfVkJWX3NpemUgICAgICA8PSBzY2FsYWJsZV9wcm9maWxlX2xldmVsX21heF9WQlZfc2l6ZVsyXSkKKworICAgICAgICB7CisgICAgICAgICAgICBzdGFydCA9IDA7CisgICAgICAgICAgICBlbmQgPSBpbmRleDsKKyAgICAgICAgfQorCisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgc3RhcnQgPSA0OworICAgICAgICAgICAgZW5kID0gaW5kZXg7CisgICAgICAgIH0KKworCisgICAgICAgIC8qIFNlYXJjaCB0aGUgc2NhbGFibGUgcHJvZmlsZSAqLworICAgICAgICBmb3IgKGkgPSBzdGFydDsgaSA8PSBlbmQ7IGkrKykKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKHRvdGFsX2JpdHJhdGUgICAgICAgPD0gc2NhbGFibGVfcHJvZmlsZV9sZXZlbF9tYXhfYml0cmF0ZVtpXSAgICAgJiYKKyAgICAgICAgICAgICAgICAgICAgdG90YWxfcGFja2V0X3NpemUgICA8PSBzY2FsYWJsZV9wcm9maWxlX2xldmVsX21heF9wYWNrZXRfc2l6ZVtpXSAmJgorICAgICAgICAgICAgICAgICAgICB0b3RhbF9NQnNQZXJTZWMgICAgIDw9IHNjYWxhYmxlX3Byb2ZpbGVfbGV2ZWxfbWF4X21ic1BlclNlY1tpXSAgICYmCisgICAgICAgICAgICAgICAgICAgIHRvdGFsX1ZCVl9zaXplICAgICAgPD0gc2NhbGFibGVfcHJvZmlsZV9sZXZlbF9tYXhfVkJWX3NpemVbaV0pCisKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBpZiAoaSA+IGVuZCkgcmV0dXJuIFBWX0ZBTFNFOworCisgICAgICAgIC8qIFNlYXJjaCB0aGUgYmFzZSBwcm9maWxlICovCisgICAgICAgIGlmIChpID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIGogPSAwOworICAgICAgICAgICAgYkZvdW5kID0gMTsKKyAgICAgICAgfQorICAgICAgICBlbHNlICAgICAgICBiRm91bmQgPSAwOworCisgICAgICAgIGZvciAoaiA9IHN0YXJ0OyAhYkZvdW5kICYmIGogPD0gaTsgaisrKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoYmFzZV9iaXRyYXRlICAgICAgICA8PSBwcm9maWxlX2xldmVsX21heF9iaXRyYXRlW2pdICAgICAgJiYKKyAgICAgICAgICAgICAgICAgICAgYmFzZV9wYWNrZXRfc2l6ZSAgICA8PSBwcm9maWxlX2xldmVsX21heF9wYWNrZXRfc2l6ZVtqXSAgJiYKKyAgICAgICAgICAgICAgICAgICAgYmFzZV9NQnNQZ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kZWZhdWx0X2FwcGxpY2FibGVfbGljZW5zZXMnIHRvIGltcG9ydAorICAgIC8vIGFsbCBvZiB0aGUgJ2xpY2Vuc2Vfa2luZHMnIGZyb20gImZyYW1ld29ya3NfYXZfbWVkaWFfY29kZWNzX200dl9oMjYzX2VuY19saWNlbnNlIgorICAgIC8vIHRvIGdldCB0aGUgYmVsb3cgbGljZW5zZSBraW5kczoKKyAgICAvLyAgIFNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUFwYWNoZS0yLjAKKyAgICAvLyAgIFNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUJTRAorICAgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWworICAgICAgICAiZnJhbWV3b3Jrc19hdl9tZWRpYV9jb2RlY3NfbTR2X2gyNjNfZW5jX2xpY2Vuc2UiLAorICAgIF0sCit9CisKK2NjX3Rlc3QgeworICAgIG5hbWU6ICJNcGVnNEgyNjNFbmNvZGVyVGVzdCIsCisgICAgZ3Rlc3Q6IHRydWUsCisgICAgdGVzdF9zdWl0ZXM6IFsiZGV2aWNlLXRlc3RzIl0sCisKKyAgICBzcmNzIDogWyAiTXBlZzRIMjYzRW5jb2RlclRlc3QuY3BwIiBdLAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9tNHZoMjYzZW5jIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItRE9TQ0xfSU1QT1JUX1JFRj0iLAorICAgICAgICAiLVdhbGwiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgXSwKKworICAgIHNhbml0aXplOiB7CisgICAgICAgIG1pc2NfdW5kZWZpbmVkOiBbCisgICAgICAgICAgICAic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICAgICAgInVuc2lnbmVk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VBPUlRfUkVGPSIsCisgICAgXSwKKworICAgIGZ1enpfY29uZmlnOiB7CisgICAgICAgIGNjOiBbCisgICAgICAgICAgICAiYW5kcm9pZC1tZWRpYS1mdXp6aW5nLXJlcG9ydHNAZ29vZ2xlLmNvbSIsCisgICAgICAgIF0sCisgICAgICAgIGNvbXBvbmVudGlkOiAxNTUyNzYsCisgICAgfSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogIm1wZWc0X2RlY19mdXp6ZXIiLAorCisgICAgZGVmYXVsdHM6IFsKKyAgICAgICAgIm1wZWc0X2gyNjNfZGVjX2Z1enpfZGVmYXVsdHMiLAorICAgIF0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1ETVBFRzQiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJoMjYzX2RlY19mdXp6ZXIiLAorCisgICAgZGVmYXVsdHM6IFsKKyAgICAgICAgIm1wZWc0X2gyNjNfZGVjX2Z1enpfZGVmYXVsdHMiLAorICAgIF0sCit9CisKK2NjX2RlZmF1bHRzIHsKKyAgICBuYW1lOiAibXBlZzRfaDI2M19lbmNfZnV6el9kZWZhdWx0cyIsCisKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKworICAgIHNyY3M6IFsibXBlZzRfaDI2M19lbmNfZnV6emVyLmNwcCJdLAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9tNHZoMjYzZW5jIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV2FsbCIsCisgICAgICAgICItV2Vycm9yIiwKKyAgICBdLAorICAgIGZ1enpfY29uZmlnOiB7CisgICAgICAgIGNjOiBbCisgICAgICAgICAgICAiYW5kcm9pZC1tZWRpYS1mdXp6aW5nLXJlcG9ydH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mZpZyBwYXJ0ICovCisgICAgICB2b2xEYXRhWzBdID0gY29uc3RfY2FzdDx1aW50OF90ICo+KGRhdGEpOworICAgICAgdm9sU2l6ZSA9IHNpemU7CisgICAgfQorCisgICAgaWYgKCFQVkluaXRWaWRlb0RlY29kZXIobURlY0hhbmRsZSwgdm9sRGF0YSwgJnZvbFNpemUsIGtMYXllciwgbU1heFdpZHRoLCBtTWF4SGVpZ2h0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1JbnB1dE1vZGUpKSB7CisgICAgICByZXR1cm47CisgICAgfQorICAgIG1Jbml0aWFsaXplZCA9IHRydWU7CisgICAgTVA0RGVjb2RpbmdNb2RlIGFjdHVhbE1vZGUgPSBQVkdldERlY0JpdHN0cmVhbU1vZGUobURlY0hhbmRsZSk7CisgICAgaWYgKG1JbnB1dE1vZGUgIT0gYWN0dWFsTW9kZSkgeworICAgICAgcmV0dXJuOworICAgIH0KKworICAgIFBWU2V0UG9zdFByb2NUeXBlKG1EZWNIYW5kbGUsIDApOworICB9CisgIHNpemVfdCB5RnJhbWVTaXplID0gc2l6ZW9mKHVpbnQ4KSAqIG1EZWNIYW5kbGUtPnNpemU7CisgIGlmIChvdXRwdXRCdWZmZXJTaXplIDwgeUZyYW1lU2l6ZSAqIDMgLyAyKSB7CisgICAgcmV0dXJuOworICB9CisgIGlmICghYWxsb2NPdXRwdXRCdWZmZXIob3V0cHV0QnVmZmVyU2l6ZSkpIHsKKyAgICByZXR1cm47CisgIH0KKyAgc2l6ZV90IG51bURlY29kZUNhbGxzID0gMDsKKyAgd2hpbGUgKChzaXplID4gMCkgJiYgKG51bURlY29kZUNhbGxzIDwga01heE51bURlY29kZUNhbGxzKSkgeworICAgIGlmICghbUZyYW1lc0NvbmZpZ3VyZWQpIHsKKyAgICAgIFBWU2V0UmVmZXJlbmNlWVVWKG1EZWNIYW5kbGUsIG1PdXRwdXRCdWZmZXJbMV0pOworICAgICAgbUZyYW1lc0NvbmZpZ3VyZWQgPSB0c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VBREVSLCBTSE9SVF9IRUFERVJfV0lUSF9FUlJfUkVTLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREFUQV9QQVJUSVRJT05JTkdfTU9ERSwgQ09NQklORV9NT0RFX05PX0VSUl9SRVMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDT01CSU5FX01PREVfV0lUSF9FUlJfUkVTfTsKK2NvbnN0ZXhwciBzaXplX3Qga01heFdpZHRoID0gMTAyNDA7Citjb25zdGV4cHIgc2l6ZV90IGtNYXhIZWlnaHQgPSAxMDI0MDsKKyNlbHNlCitjb25zdGV4cHIgTVA0RW5jb2RpbmdNb2RlIGtFbmNvZGluZ01vZGVbXSA9IHtIMjYzX01PREUsIEgyNjNfTU9ERV9XSVRIX0VSUl9SRVN9OworY29uc3RleHByIGludCBrV2lkdGhbXSA9IHsxMjgsIDE3NiwgMzUyLCA3MDQsIDE0MDh9OworY29uc3RleHByIGludCBrSGVpZ2h0W10gPSB7OTYsIDE0NCwgMjg4LCA1NzYsIDExNTJ9OworY29uc3RleHByIHNpemVfdCBrV2lkdGhOdW0gPSBzdGQ6OnNpemUoa1dpZHRoKTsKK2NvbnN0ZXhwciBzaXplX3Qga0hlaWdodE51bSA9IHN0ZDo6c2l6ZShrSGVpZ2h0KTsKKyNlbmRpZgorCitjb25zdGV4cHIgc2l6ZV90IGtyY1R5cGVOdW0gPSBzdGQ6OnNpemUoa3JjVHlwZSk7Citjb25zdGV4cHIgc2l6ZV90IGtFbmNvZGluZ01vZGVOdW0gPSBzdGQ6OnNpemUoa0VuY29kaW5nTW9kZSk7Citjb25zdGV4cHIgc2l6ZV90IGtNYXhRUCA9IDUxOworCitlbnVtIHsKKyAgICBJRFhfV0RfQllURV8xLAorICAgIElEWF9XRF9CWVRFXzIsCisgICAgSURYX0hUX0JZVEVfMSwKKyAgICBJRFhfSFRfQllURV8yLAorICAgIElEWF9GUkFNRV9SQVRFLAorICAgI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ZW5kb3JfYXZhaWxhYmxlOiB0cnVlLAorICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKKworICAgIGhvc3Rfc3VwcG9ydGVkOnRydWUsCisgICAgc3JjczogWworICAgICAgICAic3JjL3B2bXAzX25vcm1hbGl6ZS5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX2FsaWFzX3JlZHVjdGlvbi5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX2NyYy5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX2RlY29kZV9oZWFkZXIuY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM19kZWNvZGVfaHVmZl9jdy5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX2dldGJpdHMuY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM19kZXF1YW50aXplX3NhbXBsZS5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX2ZyYW1lZGVjb2Rlci5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX2dldF9tYWluX2RhdGFfc2l6ZS5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX2dldF9zaWRlX2luZm8uY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM19nZXRfc2NhbGVfZmFjdG9ycy5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX21wZWcyX2dldF9zY2FsZV9kYXRhLmNwcCIsCisgICAgICAgICJzcmMvcHZtcDNfbXBlZzJfZ2V0X3NjYWxlX2ZhY3RvcnMuY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM19tcGVnMl9zdGVyZW9fcHJvYy5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX2h1ZmZtYW5fZGVjb2RpbmcuY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM19odWZmbWFuX3BhcnNpbmcuY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM190YWJsZXMuY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM19pbWRjdF9zeW50aC5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX21kY3RfNi5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX2RjdF82LmNwcCIsCisgICAgICAgICJzcmMvcHZtcDNfcG9seV9waGFzZV9zeW50aGVzaXMuY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM19lcXVhbGl6ZXIuY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM19zZWVrX3N5bmNoLmNwcCIsCisgICAgICAgICJzcmMvcHZtcDNfc3RlcmVvX3Byb2MuY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM19yZW9yZGVyLmNwcCIsCisKKyAgICAgICAgInNyYy9wdm1wM19wb2x5cGhhc2VfZmlsdGVyX3dpbmRvdy5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX21kY3RfMTguY3BwIiwKKyAgICAgICAgInNyYy9wdm1wM19kY3RfOS5jcHAiLAorICAgICAgICAic3JjL3B2bXAzX2RjdF8xNi5jcHAiLAorICAgIF0sCisKKyAgICBhcmNoOiB7CisgICAgICAgIGFybTogeworICAgICAgICAgICAgZXhjbHVkZV9zcmNzOiBbCisgICAgICAgICAgICAgICAgInNyYy9wdm1wM19wb2x5cGhhc2VfZmlsdGVyX3dpbmRvdy5jcHAiLAorICAgICAgICAgICAgICAgICJzcmMvcHZtcDNfbWRjdF8xOC5jcHAiLAorICAgICAgICAgICAgICAgICJzcmMvcHZtcDNfZGN0XzkuY3BwIiwKKyAgICAgICAgICAgICAgICAic3JjL3B2bXAzX2RjdF8xNi5jcHAiLAorICAgICAgICAgICAgXSwKKyAgICAgICAgICAgIHNyY3M6IFsKKyAgICAgICAgICAgICAgICAic3JjL2FzbS9wdm1wM19wb2x5cGhhc2VfZmlsdGVyX3dpbmRvd19nY2MucyIsCisgICAgICAgICAgICAgICAgInNyYy9hc20vcHZtcDNfbWRjdF8xOF9nY2MucyIsCisgICAgICAgICAgICAgICAgInNyYy9hc20vcHZtcDNfZGN0XzlfZ2NjLnMiLAorICAgICAgICAgICAgICAgICJzcmMvYXNtL3B2bXAzX2RjdF8xNl9nY2MucyIsCisgICAgICAgICAgICBdLAorCisgICAgICAgICAgICBpbnN0cnVjdGlvbl9zZXQ6ICJhcm0iLAorICAgICAgICB9LAorICAgIH0sCisKKyAgICBzYW5pdGl6ZTogeworICAgICAgICBtaXNjX3VuZGVmaW5lZDogWworICAgICAgICAgICAgInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgXSwKKyAgICAgICAgY2ZpOiB0cnVlLAorICAgIH0sCisKKyAgICBpbmNsdWRlX2RpcnM6IFsiZnJhbWV3b3Jrcy9hdi9tZWRpYS9saWJzdGFnZWZyaWdodC9pbmNsdWRlIl0sCisKKyAgICBoZWFkZXJfbGliczogWyJsaWJzdGFnZWZyaWdodF9tcDNkZWNfaGVhZGVycyJdLAorICAgIGV4cG9ydF9oZWFkZXJfbGliX2hlYWRlcnM6IFsibGlic3RhZ2VmcmlnaHRfbXAzZGVjX2hlYWRlcnMiXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURPU0NMX1VOVVNFRF9BUkcoeCk9KHZvaWQpKHgpIiwKKyAgICAgICAgIi1XZXJyb3IiLAorICAgIF0sCisKKyAgICB0YXJnZXQ6IHsKKyAgICAgICAgZGFyd2luOiB7CisgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSwKKyAgICAgICAgfSwKKyAgICB9LAorfQorCisvLyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMKK2NjX3Rlc3QgeworICAgIG5hbWU6ICJsaWJzdGFnZWZyaWdodF9tcDNkZWNfdGVzdCIsCisgICAgZ3Rlc3Q6IGZhbHNlLAorCisgICAgc3JjczogWworICAgICAgICAidGVzdC9tcDNkZWNfdGVzdC5jcHAiLAorICAgICAgICAidGVzdC9tcDNyZWFkZXIuY3BwIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbIi1XYWxsIiwgI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CBjbGFzc2ljYWwsICB0YWxrLCBmbGF0X307CisKK3N0YXRpYyBib29sIHBhcnNlTXAzSGVhZGVyKHVpbnQzMl90IGhlYWRlciwgc2l6ZV90ICpmcmFtZV9zaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgKm91dF9zYW1wbGluZ19yYXRlID0gbnVsbHB0ciwgdWludDMyX3QgKm91dF9jaGFubmVscyA9IG51bGxwdHIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAqb3V0X2JpdHJhdGUgPSBudWxscHRyLCB1aW50MzJfdCAqb3V0X251bV9zYW1wbGVzID0gbnVsbHB0cikgeworICAqZnJhbWVfc2l6ZSA9IDA7CisgIGlmIChvdXRfc2FtcGxpbmdfcmF0ZSkgKm91dF9zYW1wbGluZ19yYXRlID0gMDsKKyAgaWYgKG91dF9jaGFubmVscykgKm91dF9jaGFubmVscyA9IDA7CisgIGlmIChvdXRfYml0cmF0ZSkgKm91dF9iaXRyYXRlID0gMDsKKyAgaWYgKG91dF9udW1fc2FtcGxlcykgKm91dF9udW1fc2FtcGxlcyA9IDA7CisKKyAgaWYgKChoZWFkZXIgJiAweGZmZTAwMDAwKSAhPSAweGZmZTAwMDAwKSB7CisgICAgcmV0dXJuIGZhbHNlOworICB9CisgIHVuc2lnbmVkIHZlcnNpb24gPSAoaGVhZGVyID4+IDE5KSAmIDM7CisgIGlmICh2ZXJzaW9uID09IDB4MDEpIHsKKyAgICByZXR1cm4gZmFsc2U7CisgIH0KKyAgdW5zaWduZWQgbGF5ZXIgPSAoaGVhZGVyID4+IDE3KSAmIDM7CisgIGlmIChsYXllciA9PSAweDAwKSB7CisgICAgcmV0dXJuIGZhbHNlOworICB9CisgIHVuc2lnbmVkIGJpdHJhdGVfaW5kZXggPSAoaGVhZGVyID4+IDEyKSAmIDB4MGY7CisgIGlmIChiaXRyYXRlX2luZGV4ID09IDAgfHwgYml0cmF0ZV9pbmRleCA9PSAweDBmKSB7CisgICA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kZXggLSAxXSA6IGtCaXRyYXRlVjJbYml0cmF0ZV9pbmRleCAtIDFdOworCisgICAgaWYgKG91dF9iaXRyYXRlKSB7CisgICAgICAqb3V0X2JpdHJhdGUgPSBiaXRyYXRlOworICAgIH0KKyAgICAqZnJhbWVfc2l6ZSA9ICgxMjAwMCAqIGJpdHJhdGUgLyBzYW1wbGluZ19yYXRlICsgcGFkZGluZykgKiA0OworICAgIGlmIChvdXRfbnVtX3NhbXBsZXMpIHsKKyAgICAgICpvdXRfbnVtX3NhbXBsZXMgPSAzODQ7CisgICAgfQorICB9IGVsc2UgeyAgLy8gbGF5ZXIgSUkgb3IgSUlJCisgICAgc3RhdGljIGNvbnN0IGludCBrQml0cmF0ZVYxTDJbXSA9IHszMiwgIDQ4LCAgNTYsICA2NCwgIDgwLCAgOTYsICAxMTIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMjgsIDE2MCwgMTkyLCAyMjQsIDI1NiwgMzIwLCAzODR9OworICAgIHN0YXRpYyBjb25zdCBpbnQga0JpdHJhdGVWMUwzW10gPSB7MzIsICA0MCwgIDQ4LCAgNTYsICA2NCwgIDgwLCAgOTYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMTIsIDEyOCwgMTYwLCAxOTIsIDIyNCwgMjU2LCAzMjB9OworICAgIHN0YXRpYyBjb25zdCBpbnQga0JpdHJhdGVWMltdID0gezgsIDE2LCAyNCwgMzIsIDQwLCA0OCwgNTYsIDY0LCA4MCwgOTYsIDExMiwgMTI4LCAxNDQsIDE2MH07CisgICAgaW50IGJpdHJhdGU7CisgICAgaWYgKHZlcnNpb24gPT0gMyAvKiBWMSAqLykgeworICAgICAgYml0cmF0ZSA9CisgICAgICAgICAgKGxheWVyID09IDIgLyogTDIgKi8pID8ga0JpdHJhdGVWMUwyW2JpdHJhdGVfaW5kZXggLSAxXSA6IGtCaXRyYXRlVjFMM1tiaXRyYXRlX2luZGV4IC0gMV07CisKKyAgICAgIGlmIChvdXRfbnVtX3NhbXBsZXMpIHsKKyAgICAgICAgKm91dF9udW1fc2FtcGxlcyA9IDExNTI7CisgICAgICB9CisgICAgfSBlbHNlIHsgIC8vIFYyIChvciAyLjUpCisgICAgICBiaXRyYXRlID0ga0JpdHJhdGVWMltiaXRyYXRlX2luZGV4IC0gMV07CisgICAgICBpZiAob3V0X251bV9zYW1wbGVzKSB7CisgICAgICAgICpvdXRfbnVtX3NhbXBsZXMgPSAobGF5ZXIgPT0gMSAvKiBMMyAqLykgPyA1NzYgOiAxMTUyOworICAgICAgfQorICAgIH0KKworICAgIGlmIChvdXRfYml0cmF0ZSkgeworICAgICAgKm91dF9iaXRyYXRlID0gYml0cmF0ZTsKKyAgICB9CisKKyAgICBpZiAodmVyc2lvbiA9PSAzIC8qIFYxICovKSB7CisgICAgICAqZnJhbWVfc2l6ZSA9IDE0NDAwMCAqIGJpdHJhdGUgLyBzYW1wbGluZ19yYXRlICsgcGFkZGluZzsKKyAgICB9IGVsc2UgeyAgLy8gVjIgb3IgVjIuNQorICAgICAgc2l6ZV90IHRtcCA9IChsYXllciA9PSAxIC8qIEwzICovKSA/IDcyMDAwIDogMTQ0MDAwOworICAgICAgKmZyYW1lX3NpemUgPSB0bXAgKiBiaXRyYXRlIC8gc2FtcGxpbmdfcmF0ZSArIHBhZGRpbmc7CisgICAgfQorICB9CisKKyAgaWYgKG91dF9zYW1wbGluZ19yYXRlKSB7CisgICAgKm91dF9zYW1wbGluZ19yYXRlID0gc2FtcGxpbmdfcmF0ZTsKKyAgfQorCisgIGlmIChvdXRfY2hhbm5lbHMpIHsKKyAgICBpbnQgY2hhbm5lbF9tb2RlID0gKGhlYWRlciA+PiA2KSAmIDM7CisgICAgKm91dF9jaGFubmVscyA9IChjaGFubmVsX21vZGUgPT0gMykgPyAxIDogMjsKKyAgfQorCisgIHJldHVybiB0cnVlOworfQorCitzdGF0aWMgdWludDMyX3QgVTMyX0FUKGNvbnN0IHVpbnQ4X3QgKnB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bXAxOworICAgIGludDMyIHRtcDI7CisKKyAgICBpbnQzMiAqcHRfdmVjICAgPSB2ZWM7CisgICAgaW50MzIgKnB0X3ZlY19vID0gdmVjOworICAgIGNvbnN0IGludDMyICpwdF9jb3MgPSBjb3NUZXJtc18xX292X2Nvc19waGlfTjY7CisKKyAgICBmb3IgKGkgPSAyOyBpICE9IDA7IGktLSkKKyAgICB7CisgICAgICAgIHRtcCAgPSAqKHB0X3ZlYysrKTsKKyAgICAgICAgdG1wMSA9ICoocHRfdmVjKyspOworICAgICAgICB0bXAyID0gKihwdF92ZWMrKyk7CisgICAgICAgICoocHRfdmVjX28rKykgICA9IGZ4cF9tdWwzMl9RMjkodG1wLCAqKHB0X2NvcysrKSk7CisgICAgICAgICoocHRfdmVjX28rKykgICA9IGZ4cF9tdWwzMl9RMjkodG1wMSwgKihwdF9jb3MrKykpOworICAgICAgICAqKHB0X3ZlY19vKyspICAgPSBmeHBfbXVsMzJfUTI5KHRtcDIsICoocHRfY29zKyspKTsKKyAgICB9CisKKworICAgIHB2bXAzX2RjdF82KHZlYyk7ICAgIC8vIEV2ZW4gdGVybXMKKworCisgICAgdG1wID0gLSh2ZWNbMF0gKyB2ZWNbMV0pOworICAgIGhpc3RvcnlbM10gPSB0bXA7CisgICAgaGlzdG9yeVsyXSA9IHRtcDsKKyAgICB0bXAgPSAtKHZlY1sxXSArIHZlY1syXSk7CisgICAgdmVjWzBdID0gIHZlY1szXSArIHZlY1s0XTsKKyAgICB2ZWNbMV0gPSAgdmVjWzRdICsgdmVjWzVdOworICAgIGhpc3RvcnlbNF0gPSB0bXA7CisgICAgaGlzdG9yeVsxXSA9IHRtcDsKKyAgICB0bXAgPSAtKHZlY1syXSArIHZlY1szXSk7CisgICAgdmVjWzRdID0gLXZlY1sxXTsKKyAgICBoaXN0b3J5WzVdID0gdG1wOworICAgIGhpc3RvcnlbMF0gPSB0bXA7CisKKyAgICB2ZWNbMl0gPSAgdmVjWzVdOworICAgIHZlY1szXSA9IC12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zJyBmcm9tICJmcmFtZXdvcmtzX2F2X21lZGlhX2NvZGVjc19tcDNkZWNfbGljZW5zZSIKKyAgICAvLyB0byBnZXQgdGhlIGJlbG93IGxpY2Vuc2Uga2luZHM6CisgICAgLy8gICBTUERYLWxpY2Vuc2UtaWRlbnRpZmllci1BcGFjaGUtMi4wCisgICAgLy8gICBTUERYLWxpY2Vuc2UtaWRlbnRpZmllci1CU0QKKyAgICBkZWZhdWx0X2FwcGxpY2FibGVfbGljZW5zZXM6IFsiZnJhbWV3b3Jrc19hdl9tZWRpYV9jb2RlY3NfbXAzZGVjX2xpY2Vuc2UiXSwKK30KKworY2NfdGVzdCB7CisgICAgbmFtZTogIk1wM0RlY29kZXJUZXN0IiwKKyAgICBndGVzdDogdHJ1ZSwKKyAgICB0ZXN0X3N1aXRlczogWyJkZXZpY2UtdGVzdHMiXSwKKworICAgIHNyY3M6IFsKKyAgICAgICAgIm1wM3JlYWRlci5jcHAiLAorICAgICAgICAiTXAzRGVjb2RlclRlc3QuY3BwIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X21wM2RlYyIsCisgICAgICAgICJsaWJzbmRmaWxlIiwKKyAgICAgICAgImxpYmF1ZGlvdXRpbHMiLAorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGlibG9nIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV2Vycm9yIiwKKyAgICAgICAgIi1XYWxsIiwKKyAgICBdLAorCisgICAgc2FuaXRpemU6IHsKKyAgICAgICAgY2ZpOiB0cnVlLAorICAgICAgICBtaXNjX3VuZGVmaW5lZDogWworICAgICAgICAgICAgInVuc2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICAgICAgInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgXSwKKyAgICB9LAorfQpkaWZmIC0tZ2l0IGEvbWVkaW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dGluZzo6VGVzdFdpdGhQYXJhbTxzdHJpbmc+IHsKKyAgcHVibGljOgorICAgIE1wM0RlY29kZXJUZXN0KCkgOiBtQ29uZmlnKG51bGxwdHIpIHt9CisKKyAgICB+TXAzRGVjb2RlclRlc3QoKSB7CisgICAgICAgIGlmIChtQ29uZmlnKSB7CisgICAgICAgICAgICBkZWxldGUgbUNvbmZpZzsKKyAgICAgICAgICAgIG1Db25maWcgPSBudWxscHRyOworICAgICAgICB9CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkIFNldFVwKCkgb3ZlcnJpZGUgeworICAgICAgICBtQ29uZmlnID0gbmV3IHRQVk1QM0RlY29kZXJFeHRlcm5hbHt9OworICAgICAgICBBU1NFUlRfTkUobUNvbmZpZywgbnVsbHB0cikgPDwgIkZhaWxlZCB0byBpbml0aWFsaXplIGNvbmZpZy4gTm8gTWVtb3J5IGF2YWlsYWJsZSI7CisgICAgICAgIG1Db25maWctPmVxdWFsaXplclR5cGUgPSBmbGF0OworICAgICAgICBtQ29uZmlnLT5jcmNFbmFibGVkID0gZmFsc2U7CisgICAgfQorCisgICAgdFBWTVAzRGVjb2RlckV4dGVybmFsICptQ29uZmlnOworICAgIE1wM1JlYWRlciBtTXAzUmVhZGVyOworCisgICAgRVJST1JfQ09ERSBEZWNvZGVGcmFtZXModm9pZCAqZGVjb2RlcmJ1ZiwgU05ERklMRSAqb3V0RmlsZUhhbmRsZSwgU0ZfSU5GTyBzZkluZm8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBmcmFtZUNvdW50ID0gSU5UMzJfTUFYKTsKKyAgICBTTkRGSUxFICpvcGVuT3V0cHV0RmlsZShTRl9JTkZPICpzZkluZm8pOworfTsKKworRVJST1JfQ09ERSBNcDNEZWNvZGVyVGVzdDo6RGVjb2RlRnJhbWVzKHZvaWQgKmRlY29kZXJCdWYsIFNOREZJTEUgKm91dEZpbGVIYW5kbGUsIFNGX0lORk8gc2ZJbmZvLAorICAgICAgICAg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bnVsbHB0cjsKKyAgICB9Cit9CisKK0lOU1RBTlRJQVRFX1RFU1RfU1VJVEVfUChNcDNEZWNvZGVyVGVzdEFsbCwgTXAzRGVjb2RlclRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgOjp0ZXN0aW5nOjpWYWx1ZXMoKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfMzBzZWMubXAzIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfNW1pbnMubXAzIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCJidWdfMTM2MDUzODg1Lm1wMyIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgiYmJiXzJjaF80NGtIel9sYW1lX2NyYy5tcDMiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoImJiYl9tcDNfc3RlcmVvXzE5MmticHNfNDgwMDBoei5tcDMiKSkpOworCitpbnQgbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpIHsKKyAgICBnRW52ID0gbmV3IE1wM0RlY29kZXJUZXN0RW52aXJvbm1lbnQoKTsKKyAgICA6OnRlc3Rpbmc6OkFkZEdsb2JhbFRlc3RFbnZpcm9ubWVudChnRW52KTsKKyAgICA6OnRlc3Rpbmc6OkluaXRHb29nbGVUZXN0KCZhcmdjLCBhcmd2KTsKKyAgICBpbnQgc3RhdHVzID0gZ0Vudi0+aW5pdEZyb21PcHRpb25zKGFyZ2MsIGFyZ3YpOworICAgIGlmIChzdGF0dXMgPT0gMCkgeworICAgICAgICBzdGF0dXMgPSBSVU5fQUxMX1RFU1RTKCk7CisgICAgICAgIEFMT0dWKCJUZXN0IHJlc3VsdCA9ICVkXG4iLCBzdGF0dXMpOworICAgIH0KKyAgICByZXR1cm4gc3RhdHVzOworfQpkaWZmIC0tZ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hbmRyb2lkLWxpY2Vuc2UtZmFxCisgICAgLy8gQSBsYXJnZS1zY2FsZS1jaGFuZ2UgYWRkZWQgJ2RlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlcycgdG8gaW1wb3J0CisgICAgLy8gYWxsIG9mIHRoZSAnbGljZW5zZV9raW5kcycgZnJvbSAiZnJhbWV3b3Jrc19hdl9saWNlbnNlIgorICAgIC8vIHRvIGdldCB0aGUgYmVsb3cgbGljZW5zZSBraW5kczoKKyAgICAvLyAgIFNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUFwYWNoZS0yLjAKKyAgICBkZWZhdWx0X2FwcGxpY2FibGVfbGljZW5zZXM6IFsiZnJhbWV3b3Jrc19hdl9saWNlbnNlIl0sCit9CisKIGNjX2RlZmF1bHRzIHsKICAgICBuYW1lOiAiZXh0cmFjdG9yLWRlZmF1bHRzIiwKIApAQCAtMjEsNyArMzAsNiBAQAogCiAgICAgc2hhcmVkX2xpYnM6IFsKICAgICAgICAgImxpYmxvZyIsCi0gICAgICAgICJsaWJtZWRpYW5kayMyOSIsCiAgICAgXSwKIAogICAgIC8vIGV4dHJhY3RvcnMgYXJlIHN1cHBvc2VkIHRvIHdvcmsgb24gUSgyOSkKQEAgLTM5LDYgKzQ3LDIxIEBACiAKICAgICB2ZXJzaW9uX3NjcmlwdDogImV4cG9ydHMubGRzIiwKIAorICAgIHRhcmdldDogeworICAgICAgICBhbmRyb2lkOiB7CisgICAgICAgICAgICBzaGFyZWRfbGliczogWworICAgICAgICAgICAgICAgICJsaWJtZWRpYW5kayMyOSIsCisgICAgICAgICAgICBdLAorICAgICAgICB9LAorICAgICAgICBob3N0OiB7CisgICAgICAgICAgICBzdGF0aWNfbGliczogWworICAgICAgICAgICAgICAgICJsaWJ1dGlscyIsCisgICAgICAgICAgICAgICAgImxpYm1lZGlhbmRrX2Zvcm1hdCIsCisgICAgICAgICAgICAgICAgImxpYm1lZGlhX25ka2Zvcm1hdHByaXYiLAorICAgICAgICAgICA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nRlciIKKyAgICAgICAgICAgICAgICAgICAgc2Vla0ZyYW1lID0gKHNlZWtUaW1lVXMgKyBtRnJhbWVEdXJhdGlvblVzIC0gMSkgLyBtRnJhbWVEdXJhdGlvblVzOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFJlYWRPcHRpb25zOjpTRUVLX0NMT1NFU1RfU1lOQzoKKyAgICAgICAgICAgICAgICBjYXNlIFJlYWRPcHRpb25zOjpTRUVLX0NMT1NFU1Q6CisgICAgICAgICAgICAgICAgICAgIHNlZWtGcmFtZSA9IChzZWVrVGltZVVzICsgbUZyYW1lRHVyYXRpb25Vcy8yKSAvIG1GcmFtZUR1cmF0aW9uVXM7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgUmVhZE9wdGlvbnM6OlNFRUtfUFJFVklPVVNfU1lOQzoKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICAvLyAnYXQgb3IgYmVmb3JlJworICAgICAgICAgICAgICAgICAgICBzZWVrRnJhbWUgPSBzZWVrVGltZVVzIC8gbUZyYW1lRHVyYXRpb25VczsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAoc2Vla0ZyYW1lIDwgMCB8fCBzZWVrRnJhbWUgPj0gKGludDY0X3QpbU9mZnNldFZlY3Rvci5zaXplKCkpIHsKICAgICAgICAgICAgICAgICBhbmRyb2lkX2Vycm9yV3JpdGVMb2coMHg1MzRlNDU1NCwgIjcwMjM5NTA3Iik7CiAgICAgICAgICAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9NQUxGT1JNRUQ7CmRpZmYgLS1naXQgYS9tZWRpYS9leHRyYWN0b3JzL2FhYy9BbmRyb2lkLmJwIGIvbWVkaWEvZXh0cmFjdG9ycy9hYWMvQW5kcm9pZC5icAppbmRleCA2MGQzYWUxLi43Ym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gICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYmxvZyIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9mb3VuZGF0aW9uX2NvbG9ydXRpbHNfbmRrIiwKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2ZvdW5kYXRpb24iLAorICAgICAgICAibGlibWVkaWFuZGtfZm9ybWF0IiwKKyAgICAgICAgImxpYm1lZGlhX25ka2Zvcm1hdHByaXYiLAorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGlidXRpbHMiLAorICAgICAgICAibGliYmluZGVyIiwKKyAgICAgICAgImxpYmJhc2UiLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICBdLAorCisgICAgdGFyZ2V0OiB7CisgICAgICAgIGRhcndpbjogeworICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsCisgICAgICAgIH0sCisgICAgfSwKK30KKworY2NfZGVmYXVsdHMgeworICAgIG5hbWU6ICJleHRyYWN0b3ItZnV6emVyLWRlZmF1bHRzIiwKKyAgICBkZWZhdWx0czogWyJleHRyYWN0b3ItZnV6emVyYmFzZS1kZWZhdWx0cyJdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYmV4dHJhY3RvcmZ1enplcmJhc2UiLAorICAgIF0sCisKKyAgICBmdXp6X2NvbmZpZzogeworICAgICAgICBjYzogWworICAgICAgICAgICAgImFuZHJvaWQtbWVkaWEtZnV6emluZy1yZXBvcnRzQGdvb2dsZS5jb20iLAorICAgICAgICBdLAorICAgICAgICBjb21wb25lbnRpZDogMTU1Mjc2LAorICAgIH0sCit9CisKK2NjX2RlZmF1bHRzIHsKKyAgICBuYW1lOiAibXBlZzItZXh0cmFjdG9yLWZ1enplci1kZWZhdWx0cyIsCisgICAgZGVmYXVsdHM6IFsiZXh0cmFjdG9yLWZ1enplci1kZWZhdWx0cyJdLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL2V4dHJhY3RvcnMvbXBlZzIiLAorICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9saWJzdGFnZWZyaWdodCIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9mb3VuZGF0aW9uX3dpdGhvdXRfaW1lbW9yeSIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9tcGVnMnN1cHBvcnQiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfbXBlZzJleHRyYWN0b3IiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZXNkcyIsCisgICAgICAgICJsaWJtcGVnMmV4dHJhY3RvciIsCisgICAgICAgICJsaWJtZWRpYV9oZWxwZXIiLAorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5jYXNAMS4wIiwKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuY2FzLm5hdGl2ZUAxLjAiLAorICAgICAgICAiYW5kcm9pZC5oaWRsLnRva2VuQDEuMC11dGlscyIsCisgICAgICAgICJhbmRyb2lkLmhpZGwuYWxsb2NhdG9yQDEuMCIsCisgICAgICAgICJsaWJjcnlwdG8iLAorICAgICAgICAibGliaGlkbG1lbW9yeSIsCisgICAgICAgICJsaWJoaWRsYmFzZSIsCisgICAgXSwKK30KKworY2NfbGlicmFyeV9zdGF0aWMgeworICAgIG5hbWU6ICJsaWJleHRyYWN0b3JmdXp6ZXJiYXNlIiwKKyAgICBkZWZhdWx0czogWyJleHRyYWN0b3ItZnV6emVyYmFzZS1kZWZhdWx0cyJdLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorCisgICAgc3JjczogWworICAgICAgICAiRXh0cmFjdG9yRnV6emVyQmFzZS5jcHAiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJtcDRfZXh0cmFjdG9yX2Z1enplciIsCisgICAgZGVmYXVsdHM6IFsiZXh0cmFjdG9yLWZ1enplci1kZWZhdWx0cyJdLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorCisgICAgc3JjczogWworICAgICAgICAibXA0X2V4dHJhY3Rvcl9mdXp6ZXIuY3BwIiwKKyAgICBdLAorCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL2V4dHJhY3RvcnMvbXA0IiwKKyAgICBdLAorCisgICAgaGVhZGVyX2xpYnM6IFsKKyAgICAgICAgImxpYmF1ZGlvY2xpZW50X2hlYWRlcnMiLAorICAgIF0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGlic3RhZ2VmcmlnaHRfaWQzIiwKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2VzZHMiLAorICAgICAgICAibGlibXA0ZXh0cmFjdG9yIiwKKyAgICBdLAorCisgICAgZGljdGlvbmFyeTogIm1wNF9leHRyYWN0b3JfZnV6emVyLmRpY3QiLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAid2F2X2V4dHJhY3Rvcl9mdXp6ZXIiLAorICAgIGRlZmF1bHRzOiBbImV4dHJhY3Rvci1mdXp6ZXItZGVmYXVsdHMiXSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKworICAgIHNyY3M6IFsKKyAgICAgICAgIndhdl9leHRyYWN0b3JfZnV6emVyLmNwcCIsCisgICAgXSwKKworICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9leHRyYWN0b3JzL3dhdiIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJmaWZvIiwKKyAgICAgICAgImxpYndhdmV4dHJhY3RvciIsCisgICAgXSwKKworICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJiaW5kZXJfbmRrIiwKKyAgICBdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiYW1yX2V4dHJhY3Rvcl9mdXp6ZXIiLAorICAgIGRlZmF1bHRzOiBbImV4dHJhY3Rvci1mdXp6ZXItZGVmYXVsdHMiXSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKworICAgIHNyY3M6IFsKKyAgICAgICAgImFtcl9leHRyYWN0b3JfZnV6emVyLmNwcCIsCisgICAgXSwKKworICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9leHRyYWN0b3JzL2FtciIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJhbXJleHRyYWN0b3IiLAorICAgIF0sCisKKyAgICBkaWN0aW9uYXJ5OiAiYW1yX2V4dHJhY3Rvcl9mdXp6ZXIuZGljdCIsCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJta3ZfZXh0cmFjdG9yX2Z1enplciIsCisgICAgZGVmYXVsdHM6IFsiZXh0cmFjdG9yLWZ1enplci1kZWZhdWx0cyJdLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorCisgICAgc3JjczogWworICAgICAgICAibWt2X2V4dHJhY3Rvcl9mdXp6ZXIuY3BwIiwKKyAgICBdLAorCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL2V4dHJhY3RvcnMvbWt2IiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYndlYm0iLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZmxhY2RlYyIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9tZXRhZGF0YXV0aWxzIiwKKyAgICAgICAgImxpYm1rdmV4dHJhY3RvciIsCisgICAgICAgICJsaWJGTEFDIiwKKyAgICBdLAorCisgICAgZGljdGlvbmFyeTogIm1rdl9leHRyYWN0b3JfZnV6emVyLmRpY3QiLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAib2dnX2V4dHJhY3Rvcl9mdXp6ZXIiLAorICAgIGRlZmF1bHRzOiBbImV4dHJhY3Rvci1mdXp6ZXItZGVmYXVsdHMiXSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKworICAgIHNyY3M6IFsKKyAgICAgICAgIm9nZ19leHRyYWN0b3JfZnV6emVyLmNwcCIsCisgICAgXSwKKworICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9leHRyYWN0b3JzL29nZyIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9tZXRhZGF0YXV0aWxzIiwKKyAgICAgICAgImxpYnZvcmJpc2lkZWMiLAorICAgICAgICAibGlib2dnZXh0cmFjdG9yIiwKKyAgICBdLAorCisgICAgZGljdGlvbmFyeTogIm9nZ19leHRyYWN0b3JfZnV6emVyLmRpY3QiLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAibXBlZzJwc19leHRyYWN0b3JfZnV6emVyIiwKKyAgICBkZWZhdWx0czogWyJtcGVnMi1leHRyYWN0b3ItZnV6emVyLWRlZmF1bHRzIl0sCisKKyAgICBzcmNzOiBbCisgICAgICAgICJtcGVnMl9leHRyYWN0b3JfZnV6emVyLmNwcCIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURNUEVHMlBTIiwKKyAgICBdLAorCisgICAgZGljdGlvbmFyeTogIm1wZWcycHNfZXh0cmFjdG9yX2Z1enplci5kaWN0IiwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogIm1wZWcydHNfZXh0cmFjdG9yX2Z1enplciIsCisgICAgZGVmYXVsdHM6IFsibXBlZzItZXh0cmFjdG9yLWZ1enplci1kZWZhdWx0cyJdLAorCisgICAgc3JjczogWworICAgICAgICAibXBlZzJfZXh0cmFjdG9yX2Z1enplci5jcHAiLAorICAgIF0sCisKKyAgICBkaWN0aW9uYXJ5OiAibXBlZzJ0c19leHRyYWN0b3JfZnV6emVyLmRpY3QiLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAibXAzX2V4dHJhY3Rvcl9mdXp6ZXIiLAorICAgIGRlZmF1bHRzOiBbImV4dHJhY3Rvci1mdXp6ZXItZGVmYXVsdHMiXSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKworICAgIHNyY3M6IFsKKyAgICAgICAgIm1wM19leHRyYWN0b3JfZnV6emVyLmNwcCIsCisgICAgXSwKKworICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9leHRyYWN0b3JzL21wMyIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJmaWZvIiwKKyAgICAgICAgImxpYm1wM2V4dHJhY3RvciIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9pZDMiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJhYWNfZXh0cmFjdG9yX2Z1enplciIsCisgICAgZGVmYXVsdHM6IFsiZXh0cmFjdG9yLWZ1enplci1kZWZhdWx0cyJdLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorCisgICAgc3JjczogWworICAgICAgICAiYWFjX2V4dHJhY3Rvcl9mdXp6ZXIuY3BwIiwKKyAgICBdLAorCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL2V4dHJhY3RvcnMvYWFjIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYmFhY2V4dHJhY3RvciIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9tZXRhZGF0YXV0aWxzIiwKKyAgICBdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiZmxhY19leHRyYWN0b3JfZnV6emVyIiwKKyAgICBkZWZhdWx0czogWyJleHRyYWN0b3ItZnV6emVyLWRlZmF1bHRzIl0sCisgICAgaG9zdF9zdXBwb3J0ZWQ6IHRydWUsCisKKyAgICBzcmNzOiBbCisgICAgICAgICJmbGFjX2V4dHJhY3Rvcl9mdXp6ZXIuY3BwIiwKKyAgICBdLAorCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL2V4dHJhY3RvcnMvZmxhYyIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9tZXRhZGF0YXV0aWxzIiwKKyAgICAgICAgImxpYkZMQUMiLAorICAgICAgICAibGliZmxhY2V4dHJhY3RvciIsCisgICAgXSwKKworICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJiaW5kZXJfbmRrIiwKKyAgICBdLAorCisgICAgZGljdGlvbmFyeTogImZsYWNfZXh0cmFjdG9yX2Z1enplci5kaWN0IiwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogIm1pZGlfZXh0cmFjdG9yX2Z1enplciIsCisgICAgZGVmYXVsdHM6IFsiZXh0cmFjdG9yLWZ1enplci1kZWZhdWx0cyJdLAorCisgICAgc3JjczogWworICAgICAgICAibWlkaV9leHRyYWN0b3JfZnV6emVyLmNwcCIsCisgICAgXSwKKworICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9leHRyYWN0b3JzL21pZGkiLAorICAgIF0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGlic29uaXZveCIsCisgICAgICAgICJsaWJtZWRpYV9taWRpaW93cmFwcGVyIiwKKyAgICAgICAgImxpYm1pZGlleHRyYWN0b3IiLAorICAgICAgICAibGlid2F0Y2hkb2ciLAorICAgIF0sCisKKyAgICBkaWN0aW9uYXJ5OiAibWlkaV9leHRyYWN0b3JfZnV6emVyLmRpY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F1dG9Mb2NrKG1Mb2NrKTsKKyAgICAgIGlmICgob2Zmc2V0ID49IHN0YXRpY19jYXN0PG9mZjY0X3Q+KG1MZW5ndGgpKSB8fCAob2Zmc2V0IDwgMCkpIHsKKyAgICAgICAgcmV0dXJuIDA7ICAvLyByZWFkIGJleW9uZCBib3VuZHMuCisgICAgICB9CisgICAgICBzaXplX3QgbnVtQXZhaWxhYmxlID0gbUxlbmd0aCAtIHN0YXRpY19jYXN0PHNpemVfdD4ob2Zmc2V0KTsKKyAgICAgIGlmIChzaXplID4gbnVtQXZhaWxhYmxlKSB7CisgICAgICAgIHNpemUgPSBudW1BdmFpbGFibGU7CisgICAgICB9CisgICAgICByZXR1cm4gcmVhZEF0X2wob2Zmc2V0LCBkYXRhLCBzaXplKTsKKyAgICB9CisKKyAgICBzdGF0dXNfdCBnZXRTaXplKG9mZjY0X3QqIHNpemUpIHsKKyAgICAgIGlmICghbURhdGEpIHsKKyAgICAgICAgcmV0dXJuIE5PX0lOSVQ7CisgICAgICB9CisKKyAgICAgIE11dGV4OjpBdXRvbG9jayBhdXRvTG9jayhtTG9jayk7CisgICAgICAqc2l6ZSA9IHN0YXRpY19jYXN0PG9mZjY0X3Q+KG1MZW5ndGgpOworICAgICAgcmV0dXJuIE9LOworICAgIH0KKworICAgcHJvdGVjdGVkOgorICAgIHNzaXplX3QgcmVhZEF0X2wob2ZmNjRfdCBvZmZzZXQsIHZvaWQqIGRhdGEsIHNpemVfdCBzaXplKSB7CisgICAgICB2b2lkKiByZXN1bHQgPSBtZW1jcHkoZGF0YSwgbURhdGEgKyBvZmZzZXQsIHNpemUpOworICAgICAgcmV0dXJuIHJlc3VsdCAhPSBudWxscHRyID8gc2l6ZSA6IDA7CisgICAgfQorCisgICAgY29uc3QgdWludDhfdCogbURhdGEgPSBudWxscHRyOworICAgIHNpemVfdCBtTGVuZ3RoID0gMDsKKyAgICBNdXRleCBtTG9jazsKKyAgICB1aW50MzJfdCBtRmxhZ3MgPSAwOworCisgICB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GUgTGljZW5zZS4KKyAqCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqIE9yaWdpbmFsbHkgZGV2ZWxvcGVkIGFuZCBjb250cmlidXRlZCBieSBJdHRpYW0gU3lzdGVtcyBQdnQuIEx0ZCwgQmFuZ2Fsb3JlCisgKi8KKworI2luY2x1ZGUgIkV4dHJhY3RvckZ1enplckJhc2UuaCIKKworI2luY2x1ZGUgIk1QM0V4dHJhY3Rvci5oIgorCit1c2luZyBuYW1lc3BhY2UgYW5kcm9pZDsKKworY2xhc3MgTXAzRXh0cmFjdG9yIDogcHVibGljIEV4dHJhY3RvckZ1enplckJhc2UgeworIHB1YmxpYzoKKyAgTXAzRXh0cmFjdG9yKCkgPSBkZWZhdWx0OworICB+TXAzRXh0cmFjdG9yKCkgPSBkZWZhdWx0OworCisgIGJvb2wgY3JlYXRlRXh0cmFjdG9yKCk7Cit9OworCitib29sIE1wM0V4dHJhY3Rvcjo6Y3JlYXRlRXh0cmFjdG9yKCkgeworICBtRXh0cmFjdG9yID0gbmV3IE1QM0V4dHJhY3RvcihuZXcgRGF0YVNvdXJjZUhlbHBlcihtRGF0YVNvdXJjZS0+d3JhcCgpKSwgbnVsbHB0cik7CisgIGlmICghbUV4dHJhY3RvcikgeworICAgIHJldHVybiBmYWxzZTsKKyAgfQorICBtRXh0cmFjdG9yLT5uYW1lKCk7CisgIHJldHVybiB0cnVlOworfQorCitleHRlcm4gIkMiIGludCBMTFZNRnV6emVyVGVzdE9uZUlucHV0KGNvbnN0IHVpbnQ4X3QqIGRhdGEsIHNpemVfdCBzaXplKSB7CisgIGlmICgoIWRhdGEpIHx8IChzaXplID09IDApKSB7CisgICAgcmV0dXJuIDA7CisgIH0KKyAgTXAzRXh0cmFjdG9yKiBleHRyYWN0b3IgPSBuZXcgTXAzRXh0cmFjdG9yKCk7CisgIGlmIChleHRyYWN0b3IpIHsKKyAg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ICAgICByZXR1cm4gRVJST1JfTUFMRk9STUVEOwogICAgIH0KIAotICAgIHNpemVfdCBoZWFkZXJfc3RhcnQgPSAwOwotICAgIHNpemVfdCBoZWFkZXJfbGVudGggPSAwOworICAgIGxvbmcgaGVhZGVyX3N0YXJ0ID0gMDsKKyAgICBsb25nIGhlYWRlcl9sZW5ndGggPSAwOwogICAgIGZvciAoaGVhZGVyX3N0YXJ0ID0gMDsgaGVhZGVyX3N0YXJ0IDwgZnJhbWUubGVuIC0gNDsgaGVhZGVyX3N0YXJ0KyspIHsKICAgICAgICAgaWYgKG50b2hsKDB4MDAwMDAxYjMpID09ICoodWludDMyX3QqKSgodWludDhfdCopdG1wRGF0YS5nZXQoKSArIGhlYWRlcl9zdGFydCkpIHsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CiAgICAgfQogICAgIGJvb2wgaXNDb21wbGV0ZV9jc2QgPSBmYWxzZTsKLSAgICBmb3IgKGhlYWRlcl9sZW50aCA9IDA7IGhlYWRlcl9sZW50aCA8IGZyYW1lLmxlbiAtIDQgLSBoZWFkZXJfc3RhcnQ7IGhlYWRlcl9sZW50aCsrKSB7CisgICAgZm9yIChoZWFkZXJfbGVuZ3RoID0gMDsgaGVhZGVyX2xlbmd0aCA8IGZyYW1lLmxlbiAtIDQgLSBoZWFkZXJfc3RhcnQ7IGhlYWRlcl9sZW5ndGgrKykgewogICAgICAgICBpZiAobnRvaGwoMHgwMDAwMDFiOCkgPT0gKih1aW50MzJfdCopKCh1aW50OF90Kil0bXBEYXRhLmdldCgpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgaGVhZGVyX3N0YXJ0ICsgaGVhZGVyX2xlbnRoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGhlYWRlcl9zdGFydCArIGhlYWRlcl9sZW5ndGgpKSB7CiAgICAgICAgICAgICBpc0NvbXBsZXRlX2NzZCA9IHRydWU7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQpAQCAtMTcyMCw3ICsxNzIwLDcgQEAKICAgICAgICAgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKICAgICB9CiAgICAgYWRkRVNEU0Zyb21Db2RlY1ByaXZhdGUodHJhY2tJbmZvLT5tTWV0YSwgZmFsc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodWludDhfdCopKHRtcERhdGEuZ2V0KCkpICsgaGVhZGVyX3N0YXJ0LCBoZWFkZXJfbGVudGgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICh1aW50OF90KikodG1wRGF0YS5nZXQoKSkgKyBoZWFkZXJfc3RhcnQsIGhlYWRlcl9sZW5ndGgpOwogCiAgICAgcmV0dXJuIE9LOwogCkBAIC0xODg4LDEzICsxODg4LDEyIEBACiAKICAgICBmb3Ioc2l6ZV90IGkgPSAwOyBpIDwgdHJhY2stPkdldENvbnRlbnRFbmNvZGluZ0NvdW50KCk7IGkrKykgewogICAgICAgICBjb25zdCBta3ZwYXJzZXI6OkNvbnRlbnRFbmNvZGluZyAqZW5jb2RpbmcgPSB0cmFjay0+R2V0Q29udGVudEVuY29kaW5nQnlJbmRleChpKTsKLSAgICAgICAgZm9yKHNpemVfdCBqID0gMDsgaiA8IGVuY29kaW5nLT5HZXRFbmNyeXB0aW9uQ291bnQoKTsgaisrKSB7CisgICAgICAgIGlmIChlbmNvZGluZy0+R2V0RW5jcnlwdGlvbkNvdW50KCkgPiAwKSB7CiAgICAgICAgICAgICBjb25zdCBta3ZwYXJzZXI6OkNvbnRlbnRFbmNvZGluZzo6Q29udGVudEVuY3J5cHRpb24gKmVuY3J5cHRpb247Ci0gICAgICAgICAgICBlbmNyeXB0aW9uID0gZW5jb2RpbmctPkdldEVuY3J5cHRpb25CeUluZGV4KGopOworICAgICAgICAgICAgZW5jcnlwdGlvbiA9IGVuY29kaW5nLT5HZXRFbmNyeXB0aW9uQnlJbmRleCgwKTsKICAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRC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veChzb3VyY2UoKSk7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQorICAgICAgICBjYXNlIEZPVVJDQygiYXYxQyIpOgorICAgICAgICB7CisgICAgICAgICAgICBpdGVtUHJvcGVydHkgPSBuZXcgQXYxY0JveChzb3VyY2UoKSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQogICAgICAgICBkZWZhdWx0OgogICAgICAgICB7CiAgICAgICAgICAgICAvLyBwdXNoIGR1bW15IHRvIG1haW50YWluIGNvcnJlY3QgaXRlbSBwcm9wZXJ0eSBpbmRleApAQCAtMTAyNiw3ICsxMDcxLDIxIEBACiBzdHJ1Y3QgSXRlbUluZm8gewogICAgIHVpbnQzMl90IGl0ZW1JZDsKICAgICB1aW50MzJfdCBpdGVtVHlwZTsKKyAgICBTdHJpbmc4IGNvbnRlbnRUeXBlOwogICAgIGJvb2wgaGlkZGVuOworCisgICAgYm9vbCBpc1htcCgpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIGl0ZW1UeXBlID09IEZPVVJDQygibWltZSIpICYmIGNvbnRlbnRUeXBlID09IFN0cmluZzgoImFwcGxpY2F0aW9uL3JkZit4bWwiKTsKKyAgICB9CisgICAgYm9vbCBpc0V4aWYoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBpdGVtVHlwZSA9PSBGT1VSQ0MoIkV4aWYiKTsKKyAgICB9CisgICAgYm9vbCBpc0dyaWQoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBpdGVtVHlwZSA9PSBGT1VSQ0MoImdyaWQiKTsKKyAgICB9CisgICAgYm9vbCBpc1NhbXBsZSgpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIGl0ZW1UeXBlID09IEZPVVJDQygiYXYwMSIpIHx8IGl0ZW1UeXBlID09IEZPVVJDQygiaHZjMSIpOworICAgIH0KIH07CiAKIHN0cnVjdCBJbmZlQm94IDogcHVibGljIEZ1bGxCb3ggewpAQCAtMTExNiw2ICsxMTc1LDcgQEAKICA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ID0geworICAgICAgICAgICAgICAgICAgICAgICAgLmlzRXhpZiA9IGluZm8uaXNFeGlmKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAub2Zmc2V0ID0gb2Zmc2V0LAogICAgICAgICAgICAgICAgICAgICAgICAgLnNpemUgPSBzaXplLAogICAgICAgICAgICAgICAgIH07Ci0gICAgICAgICAgICAgICAgbUl0ZW1JZFRvRXhpZk1hcC5hZGQoaW5mby5pdGVtSWQsIGV4aWZJdGVtKTsKKyAgICAgICAgICAgICAgICBtSXRlbUlkVG9NZXRhTWFwLmFkZChpbmZvLml0ZW1JZCwgbWV0YUl0ZW0pOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgIH0KQEAgLTE0MjksNyArMTQ5MSw3IEBACiAgICAgfQogCiAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBtSXRlbVJlZmVyZW5jZXMuc2l6ZSgpOyBpKyspIHsKLSAgICAgICAgbUl0ZW1SZWZlcmVuY2VzW2ldLT5hcHBseShtSXRlbUlkVG9JdGVtTWFwLCBtSXRlbUlkVG9FeGlmTWFwKTsKKyAgICAgICAgbUl0ZW1SZWZlcmVuY2VzW2ldLT5hcHBseShtSXRlbUlkVG9JdGVtTWFwLCBtSXRlbUlkVG9NZXRhTWFwKTsKICAgICB9CiAKICAgICBib29sIGZvdW5kUHJpbWFyeSA9IGZhbHNlOwpAQCAtMTUwOSw3ICsxNTcxLDkgQEAKICAgICB9CiAKICAgICBBTWVkaWFGb3JtYXQgKm1ldGEgPSBBTWVkaWFGb3JtYXRfbmV3KCk7Ci0gICAgQU1lZGlhRm9ybWF0X3NldFN0cmluZyhtZXRhLCBBTUVESUFGT1JNQVRfS0VZX01JTUUsIE1FRElBX01JTUVUWVBFX0lNQUdFX0FORFJPSURfSEVJQyk7CisgICAgQU1lZGlhRm9ybWF0X3NldFN0cmluZygKKyAgICAgICAgbWV0YSwgQU1FRElBRk9STUFUX0tFWV9NSU1FLAorICAgICA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gIEFNRURJQUZPUk1BVF9LRVlfVEhVTUJOQUlMX0NTRF9IRVZDLAotICAgICAgICAgICAgICAgICAgICAgICAgdGh1bWJuYWlsLmh2Y2MtPmRhdGEoKSwgdGh1bWJuYWlsLmh2Y2MtPnNpemUoKSk7CisgICAgICAgICAgICAgICAgaWYgKHRodW1ibmFpbC5odmNjICE9IE5VTEwpIHsKKyAgICAgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEJ1ZmZlcihtZXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFNRURJQUZPUk1BVF9LRVlfVEhVTUJOQUlMX0NTRF9IRVZDLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRodW1ibmFpbC5odmNjLT5kYXRhKCksIHRodW1ibmFpbC5odmNjLT5zaXplKCkpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFdlIHVzZSBhIGhhcmQtY29kZWQgc3RyaW5nIGhlcmUgaW5zdGVhZCBvZgorICAgICAgICAgICAgICAgICAgICAvLyBBTUVESUFGT1JNQVRfS0VZX1RIVU1CTkFJTF9DU0RfQVYxQy4gVGhlIGtleSBpcyBhdmFpbGFibGUgb25seSBmcm9tIFNESyAzMS4KKyAgICAgICAgICAgICAgICAgICAgLy8gVGhlIG1wNCBleHRyYWN0b3IgaXMgcGFydCBvZiBtYWlubGluZSBhbmQgYnVpbGRzIGFnYWluc3QgU0RLIDI5IGFzIG9mCisgICAgICAgICAgICAgICAgICAgIC8vIHdyaXRpbmcuIFRoaXMgaGFyZC1jb2RlZCBzdHJpbmcgY2FuIGJlIHJlcGxhY2VkIHdpdGggdGhlIG5hbWVkIGNvbnN0YW50IG9uY2UKKyAgICAgICAgICAgICAgICAgICAgLy8gdGhlIG1wNCBleHRyYWN0b3IgaXMgYnVpbHQgYWdhaW5zdCBTREsgPj0gMzEuCisgICAgICAgICAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRCdWZmZXIobWV0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGh1bWJuYWlsLWNzZC1hdjFjIiwgdGh1bWJuYWlsLmF2MWMtPmRhdGEoKSwgdGh1bWJuYWlsLmF2MWMtPnNpemUoKSk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIEFMT0dWKCJpbWFnZVsldV06IHRodW1ibmFpbDogc2l6ZSAlZHglZCwgaXRlbSBpbmRleCAlemQiLAogICAgICAgICAgICAgICAgICAgICAgICAgaW1hZ2VJbmRleCwgdGh1bWJuYWlsLndpZHRoLCB0aHVtYm5haWwuaGVpZ2h0LCB0aHVtYkl0ZW1JbmRleCk7CiAgICAgICAgICAgICB9IGVsc2UgewpAQCAtMTU3NCwxMiArMTY0NywyMSBAQAogICAgICAgICAgICAgICAgIEFNRURJQUZPUk1BVF9LRVlfTUFYX0lOUFVUX1NJWkUsIGltYWdlLT53aWR0aCAqIGltYWdlLT5oZWlnaHQgKiAzIC8gMik7CiAgICAgfQogCi0gICAgaWYgKGltYWdlLT5odmNjID09IE5VTEwpIHsKLSAgICAgICAgQUxPR0UoIiVzOiBodmNjIGlzIG1pc3NpbmcgZm9yIGltYWdlWyV1XSEiLCBfX0ZVTkNUSU9OX18sIGltYWdlSW5kZXgpOwotICAgICAgICByZXR1cm4gTlVMTDsKKyAgICBpZiAobUlzSGVpZikgeworICAgICAgICBpZiAoaW1hZ2UtPmh2Y2MgPT0gTlVMTCkgeworICAgICAgICAgICAgQUxPR0UoIiVzOiBodmNjIGlzIG1pc3NpbmcgZm9yIGltYWdlWyV1XSEiLCBfX0ZVTkNUSU9OX18sIGltYWdlSW5kZXgpOworICAgICAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgICAgIH0KKyAgICAgICAgQU1lZGlhRm9ybWF0X3NldEJ1ZmZlcihtZXRhLAorICAgICAgICAgICAgICAgIEFNRURJQUZPUk1BVF9LRVlfQ1NEX0hFVkMsIGltYWdlLT5odmNjLT5kYXRhKCksIGltY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BhdWRpbwogICAgICAgICAgICAgcmV0dXJuIE1FRElBX01JTUVUWVBFX0FVRElPX01QRUc7CisgICAgICAgIGNhc2UgRk9VUkNDKCJtaGExIik6CisgICAgICAgICAgICByZXR1cm4gTUVESUFfTUlNRVRZUEVfQVVESU9fTVBFR0hfTUhBMTsKKyAgICAgICAgY2FzZSBGT1VSQ0MoIm1obTEiKToKKyAgICAgICAgICAgIHJldHVybiBNRURJQV9NSU1FVFlQRV9BVURJT19NUEVHSF9NSE0xOwogICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgQUxPR1coIlVua25vd24gZm91cmNjOiAlYyVjJWMlYyIsCiAgICAgICAgICAgICAgICAgICAgKGZvdXJjYyA+PiAyNCkgJiAweGZmLApAQCAtNDEzLDYgKzQzMSw3IEBACiAgICAgICBtSXNIZWlmKGZhbHNlKSwKICAgICAgIG1IYXNNb292Qm94KGZhbHNlKSwKICAgICAgIG1QcmVmZXJIZWlmKG1pbWUgIT0gTlVMTCAmJiAhc3RyY2FzZWNtcChtaW1lLCBNRURJQV9NSU1FVFlQRV9DT05UQUlORVJfSEVJRikpLAorICAgICAgbUlzQXZpZihmYWxzZSksCiAgICAgICBtRmlyc3RUcmFjayhOVUxMKSwKICAgICAgIG1MYXN0VHJhY2soTlVMTCkgewogICAgIEFMT0dWKCJtaW1lPSVzLCBtUHJlZmVySGVpZj0lZCIsIG1pbWUsIG1QcmVmZXJIZWlmKTsKQEAgLTYzNyw4ICs2NTYsNyBAQAogICAgICAgICB9CiAgICAgfQogCi0gICAgQU1lZGlhRm9ybWF0X2NvcHkobWV0YSwgdHJhY2stPm1ldGEpOwotICAgIHJldHVybiBBTUVESUFfT0s7CisgICAgcmV0dXJuIEFNZWRpYUZvcm1hdF9jb3B5KG1ldGEsIHRyYWNrLT5tZXRhKTsKIH0KIAogc3RhdHVzX3QgTVBFRzRFeHRyYWN0b3I6OnJlYWRNZXRhRGF0YSgpIHsKQEAgLTY2OSw3ICs2ODcsNyBAQAogICAgIC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BvZiAyOS4gVGhpcyBoYXJkLWNvZGVkIHN0cmluZyBjYW4gYmUgcmVwbGFjZWQgd2l0aCB0aGUgbmFtZWQgY29uc3RhbnQgb25jZQorICAgICAgICAgICAgLy8gdGhlIG1wNCBleHRyYWN0b3IgaXMgYnVpbHQgYWdhaW5zdCBBUEkgMzErLgorICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEludDY0KG1GaWxlTWV0YURhdGEsCisgICAgICAgICAgICAgICAgICAgICJ4bXAtb2Zmc2V0IiAvKkFNRURJQUZPUk1BVF9LRVlfWE1QX09GRlNFVCovLCAoaW50NjRfdCl4bXBPZmZzZXQpOworICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEludDY0KG1GaWxlTWV0YURhdGEsCisgICAgICAgICAgICAgICAgICAgICJ4bXAtc2l6ZSIgLypBTUVESUFGT1JNQVRfS0VZX1hNUF9TSVpFKi8sIChpbnQ2NF90KXhtcFNpemUpOworICAgICAgICB9CiAgICAgICAgIGZvciAodWludDMyX3QgaW1hZ2VJbmRleCA9IDA7CiAgICAgICAgICAgICAgICAgaW1hZ2VJbmRleCA8IG1JdGVtVGFibGUtPmNvdW50SW1hZ2VzKCk7IGltYWdlSW5kZXgrKykgewogICAgICAgICAgICAgQU1lZGlhRm9ybWF0ICptZXRhID0gbUl0ZW1UYWJsZS0+Z2V0SW1hZ2VNZXRhKGltYWdlSW5kZXgpOwpAQCAtNjk1LDcgKzcyNiw3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBtSW5pdENoZWNrID0gT0s7CiAKLSAgICAgICAgICAgIEFMT0dWKCJhZGRpbmcgSEVJRiBpbWFnZSB0cmFjayAldSIsIGltYWdlSW5kZXgpOworICAgICAgICAgICAgQUxPR1YoImFkZGluZyAlcyBpbWFnZSB0cmFjayAldSIsIG1Jc0hlaWYgPyAiSEVJRiIgOiAiQVZJRiIsIGltYWdlSW5kZXgpOwogICAgICAgICAgICAgVHJhY2sgKnRyYWNrID0gbmV3IFRyYWNrOwogICAgICAgICAgICAgaWYgKG1MYXN0VHJhY2sgIT0gTlVMTCkgewogICAgICAgICAgICAgICAgIG1MYXN0VHJhY2stPm5leHQgPSB0cmFjazsKQEAgLTcyMSw2ICs3NTIsMTAgQEAKICAgICAgICAgICAgICAgICBNRURJQV9NSU1FVFlQRV9JTUFHRV9BTkRST0lEX0hFSUMpICE9IE5VTEwpIHsKICAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRTdHJpbmcobUZpbGVNZXRhRGF0YSwKICAgICAgICAgICAgICAgICAgICAgQU1FRElBRk9STUFUX0tFWV9NSU1FLCBNRURJQV9NSU1FVFlQRV9DT05UQUlORVJfSEVJRik7CisgICAgICAgIH0gZWxzZSBpZiAoZmluZFRyYWNrQnlNaW1lUHJlZml4KAorICAgICAgICAgICAgICAgIE1FRElBX01JTUVUWVBFX0lNQUdFX0FWSUYpICE9IE5VTEwpIHsKKyAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRTdHJpbmcobUZpbGVNZXRhRGF0YSwKKyAgICAgICAgICAgICAgICAgICAgQU1FRElBRk9STUFUX0tFWV9NSU1FLCBNRURJQV9NSU1FVFlQRV9JTUFHRV9BVklGKTsKICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRTdHJpbmcobUZpbGVNZXRhRGF0YSwKICAgICAgICAgICAgICAgICAgICAgQU1FRElBRk9STUFUX0tFWV9NSU1FLCAiYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtIik7CkBAIC0xMDkyLDcgKzExMjcsOSBAQAogICAgICAgICAgICAgICAgICAgICB2b2lkICpkYXRhOwogICAgICAgICAgICAgICAgICAgICBzaXplX3Qgc2l6ZTsKIAotICAgICAgICAgICAgICAgICAgICBpZiAoQU1lZGlhRm9ybWF0X2dldEJ1ZmZlcihtTGFzdFRyYWNrLT5tZXRhLCBBTUVESUFGT1JNQVRfS0VZX0NTRF8yLCAmZGF0YSwgJnNpemUpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChBTWVkaWFGb3JtYXRfZ2V0QnVmZmVyKG1MYXN0VHJhY2stPm1ldGEsIEFNRURJQUZPUk1BVF9LRVlfQ1NEXzIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZkYXRhLCAmc2l6ZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICYmIHNpemUgPj0gNSkgewogICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCAqcHRyID0gKGNvbnN0IHVpbnQ4X3QgKilkYXRhOwogICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCBwcm9maWxlID0gcHRyWzJdID4+IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90IGJsX2NvbXBhdGliaWxpdHlfaWQgPSAocHRyWzRdKSA+PiA0OwpAQCAtMTEyOSw4ICsxMTY2LDEyIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3RUcmFjay0+bmV4dCA9IHRyYWNrX2I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tfYi0+bmV4dCA9IE5VTEw7CiAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdXRvIGlkID0gdHJhY2tfYi0+bWV0YS0+bUZvcm1hdC0+ZmluZEVudHJ5QnlOYW1lKEFNRURJQUZPUk1BVF9LRVlfQ1NEXzIpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrX2ItPm1ldGEtPm1Gb3JtYXQtPnJlbW92ZUVudHJ5QXQoaWQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdlIHdhbnQgdG8gcmVtb3ZlIHRoZSBjc2QtMiBrZXkgZnJvbSB0aGUgbWV0YWRhdGEsIGJ1dAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRvbid0IGhhdmUgYW4gQU1lZGlhRm9ybWF0XyogZnVuY3Rpb24gdG8gZG8gc28uIFNldHRsZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZvciByZXBsYWNpbmcgdGhpcyBjc2QtMiB3aXRoIGFuIGVtcHR5IGNzZC0yLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ4X3QgZW1wdHlidWZmZXJbOF0gPSB7fTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0QnVmZmVyKHRyYWNrX2ItPm1ldGEsIEFNRURJQUZPUk1BVF9LRVlfQ1NEXzIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbXB0eWJ1ZmZlciwgMCk7CiAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoNCA9PSBwcm9maWxlIHx8IDcgPT0gcHJvZmlsZSB8fCA4ID09IHByb2ZpbGUgKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRTdHJpbmcodHJhY2tfYi0+bWV0YSwKQEAgLTExNTAsNyArMTE5MSw3IEBACiAgICAgICAgICAgICB9IGVsc2UgaWYgKGNodW5rX3R5cGUgPT0gRk9VUkNDKCJtb292IikpIHsKICAgICAgICAgICAgICAgICBtSW5pdENoZWNrID0gT0s7CiAKLSAgICAgICAgICAgICAgICByZXR1cm4gVU5LTk9XTl9FUlJPUjsgIC8vIFJldHVybiBhIGR1bW15IGVycm9yLgorICAgICAgICAgICAgICAgIHJldHVybiBVTktOT1dOX0VSUk9SOyAgLy8gUmV0dXJuIGEgZ2VuZXJpYyBlcnJvci4KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CkBAIC0xNzU5LDYgKzE4MDAsOCBAQAogICAgICAgICBjYXNlIEZPVVJDQygiZkxhQyIpOgogICAgICAgICBjYXNlIEZPVVJDQygiLm1wMyIpOgogICAgICAgICBjYXNlIDB4NkQ3MzAwNTU6IC8vICJtcyBVIiBtcDMgYXVkaW8KKyAgICAgICAgY2FzZSBGT1VSQ0MoIm1oYTEiKToKKyAgICAgICAgY2FzZSBGT1VSQ0MoIm1obTEiKToKICAgICAgICAgewogICAgICAgICAgICAgaWYgKG1Jc1FUICYmIGRlcHRoID49IDEgJiYgbVBhdGhbZGVwdGggLSAxXSA9PSBGT1VSQ0MoIndhdmUiKSkgewogCkBAIC0xNzg4LDcgKzE4MzEsNyBAQAogICAgICAgICAgICAgICAgIHJldHVybiBFUlJPUl9JTzsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgdWludDE2X3QgZGF0YV9yZWZfaW5kZXggX191bnVzZWQgPSBVMTZfQVQoJmJ1ZmZlcls2XSk7CisgICAgICAgICAgICAvLyB3ZSBjYW4gZ2V0IGRhdGFfcmVmX2luZGV4IHZhbHVlIGZyb20gVTE2X0FUKCZidWZmZXJbNl0pCiAgICAgICAgICAgICB1aW50MTZfdCB2ZXJzaW9uID0gVTE2X0FUKCZidWZmZXJbOF0pOwogICAgICAgICAgICAgdWludDMyX3QgbnVtX2NoYW5uZWxzID0gVTE2X0FUKCZidWZmZXJbMTZdKTsKIApAQCAtMTk1OCw3ICsyMDAxLDk0IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQorICAgICAgICBjYXNlIEZPVVJDQygibWhhQyIpOgorICAgICAgICB7CisgICAgICAgICAgICAvLyBTZWUgSVNPX0lFQ18yMzAwOC0zOzIwMTkgTUhBRGVjb2RlckNvbmZpZ3VyYXRpb25SZWNvcmQKKyAgICAgICAgICAgIGNvbnN0ZXhwciB1aW50MzJfdCBtaGFjX2hlYWRlcl9zaXplID0gNCAvKiBzaXplICovICsgNCAvKiBib3h0eXBlICdtaGFDJyAqLworICAgICAgICAgICAgICAgICAgICArIDEgLyogY29uZmlndXJhdGlvblZlcnNpb24gKi8gKyAxIC8qIG1wZWdoM2RhUHJvZmlsZUxldmVsSW5kaWNhdGlvbiAqLworICAgICAgICAgICAgICAgICAgICArIDEgLyogcmVmZXJlbmNlQ2hhbm5lbExheW91dCAqLyArIDIgLyogbXBlZ2gzZGFDb25maWdMZW5ndGggKi87CisgICAgICAgICAgICB1aW50OF90IG1oYWNfaGVhZGVyW21oYWNfaGVhZGVyX3NpemVdOworICAgICAgICAgICAgb2ZmNjRfdCBkYXRhX29mZnNldCA9ICpvZmZzZXQ7CiAKKyAgICAgICAgICAgIGlmIChjaHVua19zaXplIDwgc2l6ZW9mKG1oYWNfaGVhZGVyKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBFUlJPUl9NQUxGT1JNRUQ7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChtRGF0YVNvdXJjZS0+cmVhZEF0KGRhdGFfb2Zmc2V0LCBtaGFjX2hlYWRlciwgc2l6ZW9mKG1oYWNfaGVhZGVyKSkKKyAgICAgICAgICAgICAgICAgICAgPCAoc3NpemVfdClzaXplb2YobWhhY19oZWFkZXIpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX0lPOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvL2dldCBtcGVnaDNkYVByb2ZpbGVMZXZlbEluZGljYXRpb24KKyAgICAgICAgICAgIGNvbnN0IHVpbnQzMl90IG1wZWdoM2RhUHJvZmlsZUxldmVsSW5kaWNhdGlvbiA9IG1oYWNfaGVhZGVyWzldOworICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEludDMyKG1MYXN0VHJhY2stPm1ldGEsCisgICAgICAgICAgICAgICAgICAgIEFNRURJQUZPUk1BVF9LRVlfTVBFR0hfUFJPRklMRV9MRVZFTF9JTkRJQ0FUSU9OLAorICAgICAgICAgICAgICAgICAgICBtcGVnaDNkYVByb2ZpbGVMZXZlbEluZGljYXRpb24pOworCisgICAgICAgICAgICAgLy9nZXQgcmVmZXJlbmNlQ2hhbm5lbExheW91dAorICAgICAgICAgICAgY29uc3QgdWludDMyX3QgcmVmZXJlbmNlQ2hhbm5lbExheW91dCA9IG1oYWNfaGVhZGVyWzEwXTsKKyAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRJbnQzMihtTGFzdFRyYWNrLT5tZXRhLAorICAgICAgICAgICAgICAgICAgICBBTUVESUFGT1JNQVRfS0VZX01QRUdIX1JFRkVSRU5DRV9DSEFOTkVMX0xBWU9VVCwKKyAgICAgICAgICAgICAgICAgICAgcmVmZXJlbmNlQ2hhbm5lbExheW91dCk7CisKKyAgICAgICAgICAgIC8vIGdldCBtcGVnaDNkYUNvbmZpZ0xlbmd0aAorICAgICAgICAgICAgY29uc3QgdWludDMyX3QgbWhhY19jb25maWdfc2l6ZSA9IFUxNl9BVCgmbWhhY19oZWFkZXJbMTFdKTsKKyAgICAgICAgICAgIGlmIChjaHVua19zaXplICE9IHNpemVvZihtaGFjX2hlYWRlcikgKyBtaGFjX2NvbmZpZ19zaXplKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZGF0YV9vZmZzZXQgKz0gc2l6ZW9mKG1oYWNfaGVhZGVyKTsKKyAgICAgICAgICAgIHVpbnQ4X3QgbWhhY19jb25maWdbbWhhY19jb25maWdfc2l6ZV07CisgICAgICAgICAgICBpZiAobURhdGFTb3VyY2UtPnJlYWRBdChkYXRhX29mZnNldCwgbWhhY19jb25maWcsIHNpemVvZihtaGFjX2NvbmZpZykpCisgICAgICAgICAgICAgICAgICAgIDwgKHNzaXplX3Qpc2l6ZW9mKG1oYWNfY29uZmlnKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBFUlJPUl9JTzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEJ1ZmZlcihtTGFzdFRyYWNrLT5tZXRhLAorICAgICAgICAgICAgICAgICAgICBBTUVESUFGT1JNQVRfS0VZX0NTRF8wLCBtaGFjX2NvbmZpZywgc2l6ZW9mKG1oYWNfY29uZmlnKSk7CisgICAgICAgICAgICBkYXRhX29mZnNldCArPSBzaXplb2YobWhhY19jb25maWcpOworICAgICAgICAgICAgKm9mZnNldCA9IGRhdGFfb2Zmc2V0OworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBGT1VSQ0MoIm1oYVAiKToKKyAgICAgICAgeworICAgICAgICAgICAgLy8gRkRBbWRfMiBvZiBJU09fSUVDXzIzMDA4LTM7MjAxOSBNSEFQcm9maWxlQW5kTGV2ZWxDb21wYXRpYmlsaXR5U2V0Qm94CisgICAgICAgICAgICBjb25zdGV4cHIgdWludDMyX3QgbWhhcF9oZWFkZXJfc2l6ZSA9IDQgLyogc2l6ZSAqLyArIDQgLyogYm94dHlwZSAnbWhhUCcgKi8KKyAgICAgICAgICAgICAgICAgICAgKyAxIC8qIG51bUNvbXBhdGlibGVTZXRzICovOworCisgICAgICAgICAgICB1aW50OF90IG1oYXBfaGVhZGVyW21oYXBfaGVhZGVyX3NpemVdOworICAgICAgICAgICAgb2ZmNjRfdCBkYXRhX29mZnNldCA9ICpvZmZzZXQ7CisKKyAgICAgICAgICAgIGlmIChjaHVua19zaXplIDwgKHNzaXplX3QpbWhhcF9oZWFkZXJfc2l6ZSkgeworICAgICAgICAgICAgICAgIHJldHVybiBFUlJPUl9NQUxGT1JNRUQ7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChtRGF0YVNvdXJjZS0+cmVhZEF0KGRhdGFfb2Zmc2V0LCBtaGFwX2hlYWRlciwgc2l6ZW9mKG1oYXBfaGVhZGVyKSkKKyAgICAgICAgICAgICAgICAgICAgPCAoc3NpemVfdClzaXplb2YobWhhcF9oZWFkZXIpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX0lPOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBtaGFwX2NvbXBhdGlibGVfc2V0c19zaXplID0gbnVtQ29tcGF0aWJsZVNldHMgKiBzaXplb2YodWludDhfdCkKKyAgICAgICAgICAgIGNvbnN0IHVpbnQzMl90IG1oYXBfY29tcGF0aWJsZV9zZXRzX3NpemUgPSBtaGFwX2hlYWRlcls4XTsKKyAgICAgICAgICAgIGlmIChjaHVua19zaXplICE9IHNpemVvZihtaGFwX2hlYWRlcikgKyBtaGFwX2NvbXBhdGlibGVfc2V0c19zaXplKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZGF0YV9vZmZzZXQgKz0gc2l6ZW9mKG1oYXBfaGVhZGVyKTsKKyAgICAgICAgICAgIHVpbnQ4X3QgbWhhcF9jb21wYXRpYmxlX3NldHNbbWhhcF9jb21wYXRpYmxlX3NldHNfc2l6ZV07CisgICAgICAgICAgICBpZiAobURhdGFTb3VyY2UtPnJlYWRBdCgKKyAgICAgICAgICAgICAgICAgICAgZGF0YV9vZmZzZXQsIG1oYXBfY29tcGF0aWJsZV9zZXRzLCBzaXplb2YobWhhcF9jb21wYXRpYmxlX3NldHMpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwgKHNzaXplX3Qpc2l6ZW9mKG1oYXBfY29tcGF0aWJsZV9zZXRzKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBFUlJPUl9JTzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEJ1ZmZlcihtTGFzdFRyYWNrLT5tZXRhLAorICAgICAgICAgICAgICAgICAgICBBTUVESUFGT1JNQVRfS0VZX01QRUdIX0NPTVBBVElCTEVfU0VUUywKKyAgICAgICAgICAgICAgICAgICAgbWhhcF9jb21wYXRpYmxlX3NldHMsIHNpemVvZihtaGFwX2NvbXBhdGlibGVfc2V0cykpOworICAgICAgICAgICAgZGF0YV9vZmZzZXQgKz0gc2l6ZW9mKG1oYXBfY29tcGF0aWJsZV9zZXRzKTsKKyAgICAgICAgICAgICpvZmZzZXQgPSBkYXRhX29mZnNldDsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CiAgICAgICAgIGNhc2UgRk9VUkNDKCJtcDR2Iik6CiAgICAgICAgIGNhc2UgRk9VUkNDKCJlbmN2Iik6CiAgICAgICAgIGNhc2UgRk9VUkNDKCJzMjYzIik6CkBAIC0xOTczLDYgKzIxMDMsNyBAQAogICAgICAgICBjYXNlIEZPVVJDQygiZHZoMSIpOgogICAgICAgICBjYXNlIEZPVVJDQygiZGF2MSIpOgogICAgICAgICBjYXNlIEZPVVJDQygiYXYwMSIpOgorICAgICAgICBjYXNlIEZPVVJDQygidnAwOSIpOgogICAgICAgICB7CiAgICAgICAgICAgICB1aW50OF90IGJ1ZmZlcls3OF07CiAgICAgICAgICAgICBpZiAoY2h1bmtfZGF0YV9zaXplIDwgKHNzaXplX3Qpc2l6ZW9mKGJ1ZmZlcikpIHsKQEAgLTE5ODUsNyArMjExNiw3IEBACiAgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX0lPOwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICB1aW50MTZfdCBkYXRhX3JlZl9pbmRleCBfX3VudXNlZCA9IFUxNl9BVCgmYnVmZmVyWzZdKTsKKyAgICAgICAgICAgIC8vIHdlIGNhbiBnZXQgZGF0YV9yZWZfaW5kZXggdmFsdWUgZnJvbSBVMTZfQVQoJmJ1ZmZlcls2XSkKICAgICAgICAgICAgIHVpbnQxNl90IHdpZHRoID0gVTE2X0FUKCZidWZmZXJbNiArIDE4XSk7CiAgICAgICAgICAgICB1aW50MTZfdCBoZWlnaHQgPSBVMTZfQVQoJmJ1ZmZlcls2ICsgMjBdKTsKIApAQCAtMjMyNSw3ICsyNDU2LDcgQEAKICAgICAgICAgICAgIGlmIChtTGFzdFRyYWNrID09IE5VTEwpCiAgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKIAotICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEJ1ZmZlcihtTGFzdFRyYWNrLT5tZXRhLCAKKyAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRCdWZmZXIobUxhc3RUcmFjay0+bWV0YSwKICAgICAgICAgICAgICAgICAgICAgQU1FRElBRk9STUFUX0tFWV9FU0RTLCAmYnVmZmVyWzRdLCBjaHVua19kYXRhX3NpemUgLSA0KTsKIAogICAgICAgICAgICAgaWYgKG1QYXRoLnNpemUoKSA+PSAyCkBAIC0yNDA3LDcgKzI1MzgsNyBAQAogICAgICAgICAgICAgaWYgKG1MYXN0VHJhY2sgPT0gTlVMTCkKICAgICAgICAgICAgICAgICByZXR1cm4gRVJST1JfTUFMRk9STUVEOwogCi0gICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0QnVmZmVyKG1MYXN0VHJhY2stPm1ldGEsIAorICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEJ1ZmZlcihtTGFzdFRyYWNrLT5tZXRhLAogICAgICAgICAgICAgICAgICAgICBBTUVESUFGT1JNQVRfS0VZX0NTRF9BVkMsIGJ1ZmZlci5nZXQoKSwgY2h1bmtfZGF0YV9zaXplKTsKIAogICAgICAgICAgICAgYnJlYWs7CkBAIC0yNDI5LDEyICsyNTYwLDE0IEBACiAgICAgICAgICAgICBpZiAobUxhc3RUcmFjayA9PSBOVUxMKQogICAgICAgICAgICAgICAgIHJldHVybiBFUlJPUl9NQUxGT1JNRUQ7CiAKLSAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRCdWZmZXIobUxhc3RUcmFjay0+bWV0YSwgCisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0QnVmZmVyKG1MYXN0VHJhY2stPm1ldGEsCiAgICAgICAgICAgICAgICAgICAgIEFNRURJQUZPUk1BVF9LRVlfQ1NEX0hFVkMsIGJ1ZmZlci5nZXQoKSwgY2h1bmtfZGF0YV9zaXplKTsKIAogICAgICAgICAgICAgKm9mZnNldCArPSBjaHVua19zaXplOwogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KKworICAgICAgICBjYXNlIEZPVVJDQygidnBjQyIpOgogICAgICAgICBjYXNlIEZPVVJDQygiYXYxQyIpOgogICAgICAgICB7CiAgICAgICAgICAgICBhdXRvIGJ1ZmZlciA9IGhlYXBidWZmZXI8dWludDhfdD4oY2h1bmtfZGF0YV9zaXplKTsKQEAgLTI0NjEsNyArMjU5NCw5IEBACiAgICAgICAgIGNhc2UgRk9VUkNDKCJkdmNDIik6CiAgICAgICAgIGNhc2UgRk9VUkNDKCJkdnZDIik6IHsKIAotICAgICAgICAgICAgQ0hFQ0tfRVEoY2h1bmtfZGF0YV9zaXplLCAyNCk7CisgICAgICAgICAgICBpZiAoY2h1bmtfZGF0YV9zaXplICE9IDI0KSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKKyAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgYXV0byBidWZmZXIgPSBoZWFwYnVmZmVyPHVpbnQ4X3Q+KGNodW5rX2RhdGFfc2l6ZSk7CiAKQEAgLTI1NzIsOSArMjcwNyw5IEBACiAgICAgICAgIGNhc2UgRk9VUkNDKCJpcmVmIik6CiAgICAgICAgIGNhc2UgRk9VUkNDKCJpcHJvIik6CiAgICAgICAgIHsKLSAgICAgICAgICAgIGlmIChtSXNIZWlmKSB7CisgICAgICAgICAgICBpZiAobUlzSGVpZiB8fCBtSXNBdmlmKSB7CiAgICAgICAgICAgICAgICAgaWYgKG1JdGVtVGFibGUgPT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICBtSXRlbVRhYmxlID0gbmV3IEl0ZW1UYWJsZShtRGF0YVNvdXJjZSk7CisgICAgICAgICAgICAgICAgICAgIG1JdGVtVGFibGUgPSBuZXcgSXRlbVRhYmxlKG1EYXRhU291cmNlLCBtSXNIZWlmKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgc3RhdHVzX3QgZXJyID0gbUl0ZW1UYWJsZS0+cGFyc2UoCiAgICAgICAgICAgICAgICAgICAgICAgICBjaHVua190eXBlLCBkYXRhX29mZnNldCwgY2h1bmtfZGF0YV9zaXplKTsKQEAgLTI4NzYsNiArMzAxMSwyMSBAQAogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KIAorICAgICAgICBjYXNlIEZPVVJDQygicGFzcCIpOgorICAgICAgICB7CisgICAgICAgICAgICAqb2Zmc2V0ICs9IGNodW5rX3NpemU7CisgICAgICAgICAgICAvLyB0aGlzIG11c3QgYmUgaW4gYSBWaXN1YWxTYW1wbGVFbnRyeSBib3ggdW5kZXIgdGhlIFNhbXBsZSBEZXNjcmlwdGlvbiBCb3ggKCdzdHNkJykKKyAgICAgICAgICAgIC8vIGlnbm9yZSBvdGhlcndpc2UKKyAgICAgICAgICAgIGlmIChkZXB0aCA+PSAyICYmIG1QYXRoW2RlcHRoIC0gMl0gPT0gRk9VUkNDKCJzdHNkIikpIHsKKyAgICAgICAgICAgICAgICBzdGF0dXNfdCBlcnIgPSBwYXJzZVBhc3BCb3goZGF0YV9vZmZzZXQsIGNodW5rX2RhdGFfc2l6ZSk7CisgICAgICAgICAgICAgICAgaWYgKGVyciAhPSBPSykgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZXJyOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKwogICAgICAgICBjYXNlIEZPVVJDQygidGl0bCIpOgogICAgICAgICBjYXNlIEZPVVJDQygicGVyZiIpOgogICAgICAgICBjYXNlIEZPVVJDQygiYXV0aCIpOgpAQCAtMzAwMCwxNCArMzE1MCwyMCBAQAogICAgICAgICAgICAgICAgICAgICBtSXNIZWlmID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgYnJhbmRTZXQuZXJhc2UoRk9VUkNDKCJtaWYxIikpOwogICAgICAgICAgICAgICAgICAgICBicmFuZFNldC5lcmFzZShGT1VSQ0MoImhlaWMiKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChicmFuZFNldC5jb3VudChGT1VSQ0MoImF2aWYiKSkgPiAwIHx8CisgICAgICAgICAgICAgICAgICAgICAgIGJyYW5kU2V0LmNvdW50KEZPVVJDQygiYXZpcyIpKSA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoImlkZW50aWZpZWQgQVZJRiBpbWFnZSIpOworICAgICAgICAgICAgICAgICAgICBtSXNBdmlmID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgYnJhbmRTZXQuZXJhc2UoRk9VUkNDKCJhdmlmIikpOworICAgICAgICAgICAgICAgICAgICBicmFuZFNldC5lcmFzZShGT1VSQ0MoImF2aXMiKSk7CiAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgaWYgKCFicmFuZFNldC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgbWVhbnMgdGhhdCB0aGUgZmlsZSBzaG91bGQgaGF2ZSBtb292IGJveC4KICAgICAgICAgICAgICAgICAgICAgLy8gSXQgY291bGQgYmUgYW55IGlzbyBmaWxlcyAobXA0LCBoZWlmcywgZXRjLikKICAgICAgICAgICAgICAgICAgICAgbUhhc01vb3ZCb3ggPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICBpZiAobUlzSGVpZikgewotICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoImlkZW50aWZpZWQgSEVJRiBpbWFnZSB3aXRoIG90aGVyIHRyYWNrcyIpOworICAgICAgICAgICAgICAgICAgICBpZiAobUlzSGVpZiB8fCBtSXNBdmlmKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiaWRlbnRpZmllZCAlcyBpbWFnZSB3aXRoIG90aGVyIHRyYWNrcyIsIG1Jc0hlaWYgPyAiSEVJRiIgOiAiQVZJRiIpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQpAQCAtMzQwOCw3ICszNTY0LDcgQ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GlmIChzaXplICE9IDI0IHx8ICgocHRyWzBdICE9IDEgfHwgcHRyWzFdICE9IDApICYmIChwdHJbMF0gIT0gMiB8fCBwdHJbMV0gIT0gMSkpKSB7CiAgICAgICAgICAgICByZXR1cm4gTlVMTDsKICAgICAgICAgfQotICAgfSBlbHNlIGlmICghc3RyY2FzZWNtcChtaW1lLCBNRURJQV9NSU1FVFlQRV9WSURFT19BVjEpKSB7CisgICB9IGVsc2UgaWYgKCFzdHJjYXNlY21wKG1pbWUsIE1FRElBX01JTUVUWVBFX1ZJREVPX0FWMSkKKyAgICAgICAgICAgfHwgIXN0cmNhc2VjbXAobWltZSwgTUVESUFfTUlNRVRZUEVfSU1BR0VfQVZJRikpIHsKICAgICAgICAgdm9pZCAqZGF0YTsKICAgICAgICAgc2l6ZV90IHNpemU7CiAgICAgICAgIGlmICghQU1lZGlhRm9ybWF0X2dldEJ1ZmZlcih0cmFjay0+bWV0YSwgQU1FRElBRk9STUFUX0tFWV9DU0RfMCwgJmRhdGEsICZzaXplKSkgewpAQCAtNDMzNSw3ICs0NTExLDIyIEBACiAKICAgICAgICAgY29uc3QgdWludDhfdCAqcHRyID0gKGNvbnN0IHVpbnQ4X3QgKilkYXRhOwogCi0gICAgICAgIGlmIChzaXplIDwgNSB8fCBwdHJbMF0gIT0gMHg4MSkgeyAgLy8gY29uZmlndXJhdGlvblZlcnNpb24gPT0gMQorICAgICAgICBpZiAoc2l6ZSA8IDQgfHwgcHRyWzBdICE9IDB4ODEpIHsgIC8vIGNvbmZpZ3VyYXRpb25WZXJzaW9uID09IDEKKyAgICAgICAgICAgIHJldHVybiBOVUxMOworICAgICAgICB9CisgICAgICAgIGlmICghc3RyY2FzZWNtcChtaW1lLCBNRURJQV9NSU1FVFlQRV9JTUFHRV9BVklGKSkgeworICAgICAgICAgICAgaXRlbVRhYmxlID0gbUl0ZW1UYWJsZTsKKyAgICAgICAgfQorICAgIH0gZWxzZSBpZiAoIXN0cmNhc2VjbXAobWltZSwgTUVESUFfTUlNRVRZUEVfVklERU9fVlA5KSkgeworICAgICAgICB2b2lkICpkYXRhOworICAgICAgICBzaXplX3Qgc2l6ZTsKKyAgICAgICAgaWYgKCFBTWVkaWFGb3JtYXRfZ2V0QnVmZmVyKHRyYWNrLT5tZXRhLCBBTUVESUFGT1JNQVRfS0VZX0NTRF8wLCAmZGF0YSwgJnNpemUpKSB7CisgICAgICAgICAgICByZXR1cm4gTlVMTDsKKyAgICAgICAgfQorCisgICAgICAgIGNvbnN0IHVpbnQ4X3QgKnB0ciA9IChjb25zdCB1aW50OF90ICopZGF0YTsKKworICAgICAgICBpZiAoc2l6ZSA8IDUgfHwgcHRyWzBdICE9IDB4MDEpIHsgIC8vIGNvbmZpZ3VyYXRpb25WZXJzaW9uID09IDEKICAgICAgICAgICAgIHJldHVybiBOVUxMOwogICAgICAgICB9CiAgICAgfQpAQCAtNDM5Miw2ICs0NTgzLDEwIEBACiAgICAgICAgIGlmICghQU1lZGlhRm9ybWF0X2dldEJ1ZmZlcih0cmFjay0+bWV0YSwgQU1FRElBRk9STUFUX0tFWV9DU0RfMCwgJmRhdGEsICZzaXplKSkgewogICAgICAgICAgICAgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKICAgICAgICAgfQorICAgIH0gZWxzZSBpZiAoIXN0cmNhc2VjbXAobWltZSwgTUVESUFfTUlNRVRZUEVfVklERU9fVlA5KSkgeworICAgICAgICBpZiAoIUFNZWRpYUZvcm1hdF9nZXRCdWZmZXIodHJhY2stPm1ldGEsIEFNRURJQUZPUk1BVF9LRVlfQ1NEXzAsICZkYXRhLCAmc2l6ZSkpIHsKKyAgICAgICAgICAgIHJldHVybiBFUlJPUl9NQUxGT1JNRUQ7CisgICAgICAgIH0KICAgICB9IGVsc2UgaWYgKCFzdHJjYXNlY21wKG1pbWUsIE1FRElBX01JTUVUWVBFX1ZJREVPX01QRUc0KQogICAgICAgICAgICAgfHwgIXN0cmNhc2VjbXAobWltZSwgTUVESUFfTUlNRVRZUEVfVkl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B7Ly9TQlIgc3BlY2lmaWMgY29uZmlnIHBlciAxNDQ5Ni0zIHRibCAxLjEzCiAgICAgICAgIGlmIChici5udW1CaXRzTGVmdCgpIDwgNCkgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKICAgICAgICAgdWludDMyX3QgZXh0RnJlcUluZGV4ID0gYnIuZ2V0Qml0cyg0KTsKLSAgICAgICAgaW50MzJfdCBleHRTYW1wbGVSYXRlIF9fdW51c2VkOwogICAgICAgICBpZiAoZXh0RnJlcUluZGV4ID09IDE1KSB7CiAgICAgICAgICAgICBpZiAoY3NkX3NpemUgPCA4KSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmIChici5udW1CaXRzTGVmdCgpIDwgMjQpIHJldHVybiBFUlJPUl9NQUxGT1JNRUQ7Ci0gICAgICAgICAgICBleHRTYW1wbGVSYXRlID0gYnIuZ2V0Qml0cygyNCk7CisgICAgICAgICAgICBici5za2lwQml0cygyNCk7IC8vIGV4dFNhbXBsZVJhdGUKICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIGlmIChleHRGcmVxSW5kZXggPT0gMTMgfHwgZXh0RnJlcUluZGV4ID09IDE0KSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGV4dFNhbXBsZVJhdGUgPSBrU2FtcGxpbmdSYXRlW2V4dEZyZXFJbmRleF07CisgICAgICAgICAgICAvL2V4dFNhbXBsZVJhdGUgPSBrU2FtcGxpbmdSYXRlW2V4dEZyZXFJbmRleF07CiAgICAgICAgIH0KICAgICAgICAgLy9UT0RPOiBzYXZlIHRoZSBleHRlbnNpb24gc2FtcGxpbmcgcmF0ZSB2YWx1ZSBpbiBtZXRhIGRhdGEgPT4KICAgICAgICAgLy8gICAgICBBTWVkaWFGb3JtYXRfc2V0SW50MzIobUxhc3RUcmFjay0+bWV0YSwga0tleUV4dFNhbXBsZVJhdGUsIGV4dFNhbXBsZVJhdGUpOwpAQCAtNDY5MywxMyArNDg5NCwxMyBAQAogICAgICAgICAgICAgICAgIG9iamVjdFR5cGUgPT0gQU9UX0VSX0FBQ19MRCB8fCBvYmplY3RUeXBlID09IEFPVF9FUl9BQUNfU0NBTCB8fAogICAgICAgICAgICAgICAgIG9iamVjdFR5cGUgPT0gQU9UX0VSX0JTQUMpIHsKICAgICAgICAgICAgIGlmIChici5udW1CaXRzTGVmdCgpIDwgMikgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKLSAgICAgICAgICAgIGNvbnN0IGludDMyX3QgZnJhbWVMZW5ndGhGbGFnIF9fdW51c2VkID0gYnIuZ2V0Qml0cygxKTsKKyAgICAgICAgICAgIGJyLnNraXBCaXRzKDEpOyAvLyBmcmFtZUxlbmd0aEZsYWcKIAogICAgICAgICAgICAgY29uc3QgaW50MzJfdCBkZXBlbmRzT25Db3JlQ29kZXIgPSBici5nZXRCaXRzKDEpOwogCiAgICAgICAgICAgICBpZiAoZGVwZW5kc09uQ29yZUNvZGVyICkgewogICAgICAgICAgICAgICAgIGlmIChici5udW1CaXRzTGVmdCgpIDwgMTQpIHJldHVybiBFUlJPUl9NQUxGT1JNRUQ7Ci0gICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBjb3JlQ29kZXJEZWxheSBfX3VudXNlZCA9IGJyLmdldEJpdHMoMTQpOworICAgICAgICAgICAgICAgIGJyLnNraXBCaXRzKDE0KTsgLy8gY29yZUNvZGVyRGVsYXkKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgaW50MzJfdCBleHRlbnNpb25GbGFnID0gLTE7CkBAIC00NzMxLDY0ICs0OTMyLDY0IEBACiAgICAgICAgICAgICAgICAgaWYgKGJyLm51bUJpdHNMZWZ0KCkgPCAzMikgewogICAgICAgICAgICAgICAgICAgICByZXR1cm4gRVJST1JfTUFMRk9STUVEOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjb25zdCBpbnQzMl90IEVsZW1lbnRJbnN0YW5jZVRhZyBfX3VudXNlZCA9IGJyLmdldEJpdHMoNCk7Ci0gICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBQcm9maWxlIF9fdW51c2VkID0gYnIuZ2V0Qml0cygyKTsKLSAgICAgICAgICAgICAgICBjb25zdCBpbnQzMl90IFNhbXBsaW5nRnJlcXVlbmN5SW5kZXggX191bnVzZWQgPSBici5nZXRCaXRzKDQpOworICAgICAgICAgICAgICAgIGJyLnNraXBCaXRzKDQpOyAvLyBFbGVtZW50SW5zdGFuY2VUYWcKKyAgICAgICAgICAgICAgICBici5za2lwQml0cygyKTsgLy8gUHJvZmlsZQorICAgICAgICAgICAgICAgIGJyLnNraXBCaXRzKDQpOyAvLyBTYW1wbGluZ0ZyZXF1ZW5jeUluZGV4CiAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBOdW1Gcm9udENoYW5uZWxFbGVtZW50cyA9IGJyLmdldEJpdHMoNCk7CiAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBOdW1TaWRlQ2hhbm5lbEVsZW1lbnRzID0gYnIuZ2V0Qml0cyg0KTsKICAgICAgICAgICAgICAgICBjb25zdCBpbnQzMl90IE51bUJhY2tDaGFubmVsRWxlbWVudHMgPSBici5nZXRCaXRzKDQpOwogICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3QgTnVtTGZlQ2hhbm5lbEVsZW1lbnRzID0gYnIuZ2V0Qml0cygyKTsKLSAgICAgICAgICAgICAgICBjb25zdCBpbnQzMl90IE51bUFzc29jRGF0YUVsZW1lbnRzIF9fdW51c2VkID0gYnIuZ2V0Qml0cygzKTsKLSAgICAgICAgICAgICAgICBjb25zdCBpbnQzMl90IE51bVZhbGlkQ2NFbGVtZW50cyBfX3VudXNlZCA9IGJyLmdldEJpdHMoNCk7CisgICAgICAgICAgICAgICAgYnIuc2tpcEJpdHMoMyk7IC8vIE51bUFzc29jRGF0YUVsZW1lbnRzCisgICAgICAgICAgICAgICAgYnIuc2tpcEJpdHMoNCk7IC8vIE51bVZhbGlkQ2NFbGVtZW50cwogCiAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBNb25vTWl4ZG93blByZXNlbnQgPSBici5nZXRCaXRzKDEpOwogCiAgICAgICAgICAgICAgICAgaWYgKE1vbm9NaXhkb3duUHJlc2VudCAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChici5udW1CaXRzTGVmdCgpIDwgNCkgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKLSAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBNb25vTWl4ZG93bkVsZW1lbnROdW1iZXIgX191bnVzZWQgPSBici5nZXRCaXRzKDQpOworICAgICAgICAgICAgICAgICAgICBici5za2lwQml0cyg0KTsgLy8gTW9ub01peGRvd25FbGVtZW50TnVtYmVyCiAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgaWYgKGJyLm51bUJpdHNMZWZ0KCkgPCAxKSByZXR1cm4gRVJST1JfTUFMRk9STUVEOwogICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3QgU3RlcmVvTWl4ZG93blByZXNlbnQgPSBici5nZXRCaXRzKDEpOwogICAgICAgICAgICAgICAgIGlmIChTdGVyZW9NaXhkb3duUHJlc2VudCAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChici5udW1CaXRzTGVmdCgpIDwgNCkgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKLSAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBTdGVyZW9NaXhkb3duRWxlbWVudE51bWJlciBfX3VudXNlZCA9IGJyLmdldEJpdHMoNCk7CisgICAgICAgICAgICAgICAgICAgIGJyLnNraXBCaXRzKDQpOyAvLyBTdGVyZW9NaXhkb3duRWxlbWVudE51bWJlcgogICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIGlmIChici5udW1CaXRzTGVmdCgpIDwgMSkgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKICAgICAgICAgICAgICAgICBjb25zdCBpbnQzMl90IE1hdHJpeE1peGRvd25JbmRleFByZXNlbnQgPSBici5nZXRCaXRzKDEpOwogICAgICAgICAgICAgICAgIGlmIChNYXRyaXhNaXhkb3duSW5kZXhQcmVzZW50ICE9IDApIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKGJyLm51bUJpdHNMZWZ0KCkgPCAzKSByZXR1cm4gRVJST1JfTUFMRk9STUVEOwotICAgICAgICAgICAgICAgICAgICBjb25zdCBpbnQzMl90IE1hdHJpeE1peGRvd25JbmRleCBfX3VudXNlZCA9IGJyLmdldEJpdHMoMik7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3QgUHNldWRvU3Vycm91bmRFbmFibGUgX191bnVzZWQgPSBici5nZXRCaXRzKDEpOworICAgICAgICAgICAgICAgICAgICBici5za2lwQml0cygyKTsgLy8gTWF0cml4TWl4ZG93bkluZGV4CisgICAgICAgICAgICAgICAgICAgIGJyLnNraXBCaXRzKDEpOyAvLyBQc2V1ZG9TdXJyb3VuZEVuYWJsZQogICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIGludCBpOwogICAgICAgICAgICAgICAgIGZvciAoaT0wOyBpIDwgTnVtRnJvbnRDaGFubmVsRWxlbWVudHM7IGkrKykgewogICAgICAgICAgICAgICAgICAgICBpZiAoYnIubnVtQml0c0xlZnQoKSA8IDUpIHJldHVybiBFUlJPUl9NQUxGT1JNRUQ7CiAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3QgRnJvbnRFbGVtZW50SXNDcGUgPSBici5nZXRCaXRzKDEpOwotICAgICAgICAgICAgICAgICAgICBjb25zdCBpbnQzMl90IEZyb250RWxlbWVudFRhZ1NlbGVjdCBfX3VudXNlZCA9IGJyLmdldEJpdHMoNCk7CisgICAgICAgICAgICAgICAgICAgIGJyLnNraXBCaXRzKDQpOyAvLyBGcm9udEVsZW1lbnRUYWdTZWxlY3QKICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbHNOdW0gKz0gRnJvbnRFbGVtZW50SXNDcGUgPyAyIDogMTsKICAgICAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgICAgICBmb3IgKGk9MDsgaSA8IE51bVNpZGVDaGFubmVsRWxlbWVudHM7IGkrKykgewogICAgICAgICAgICAgICAgICAgICBpZiAoYnIubnVtQml0c0xlZnQoKSA8IDUpIHJldHVybiBFUlJPUl9NQUxGT1JNRUQ7CiAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3QgU2lkZUVsZW1lbnRJc0NwZSA9IGJyLmdldEJpdHMoMSk7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3QgU2lkZUVsZW1lbnRUYWdTZWxlY3QgX191bnVzZWQgPSBici5nZXRCaXRzKDQpOworICAgICAgICAgICAgICAgICAgICBici5za2lwQml0cyg0KTsgLy8gU2lkZUVsZW1lbnRUYWdTZWxlY3QKICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbHNOdW0gKz0gU2lkZUVsZW1lbnRJc0NwZSA/IDIgOiAxOwogICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIGZvciAoaT0wOyBpIDwgTnVtQmFja0NoYW5uZWxFbGVtZW50czsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChici5udW1CaXRzTGVmdCgpIDwgNSkgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKICAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBCYWNrRWxlbWVudElzQ3BlID0gYnIuZ2V0Qml0cygxKTsKLSAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBCYWNrRWxlbWVudFRhZ1NlbGVjdCBfX3VudXNlZCA9IGJyLmdldEJpdHMoNCk7CisgICAgICAgICAgICAgICAgICAgIGJyLnNraXBCaXRzKDQpOyAvLyBCYWNrRWxlbWVudFRhZ1NlbGVjdAogICAgICAgICAgICAgICAgICAgICBjaGFubmVsc051bSArPSBCYWNrRWxlbWVudElzQ3BlID8gMiA6IDE7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGNoYW5uZWxzRWZmZWN0aXZlTnVtID0gY2hhbm5lbHNOdW07CiAKICAgICAgICAgICAgICAgICBmb3IgKGk9MDsgaSA8IE51bUxmZUNoYW5uZWxFbGVtZW50czsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChici5udW1CaXRzTGVmdCgpIDwgNCkgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKLSAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBMZmVFbGVtZW50VGFnU2VsZWN0IF9fdW51c2VkID0gYnIuZ2V0Qml0cyg0KTsKKyAgICAgICAgICAgICAgICAgICAgYnIuc2tpcEJpdHMoNCk7IC8vIExmZUVsZW1lbnRUYWdTZWxlY3QKICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbHNOdW0gKz0gMTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgQUxPR1YoIm1wZWc0IGF1ZGlvIGNoYW5uZWxzTnVtID0gJWQiLCBjaGFubmVsc051bSk7CkBAIC00ODg1LDcgKzUwODYsNiBAQAogICAgICAgbUJ1ZmZlcihOVUxMKSwKICAgICAgIG1TcmNCdWZmZXJTaXplKDApLAogICAgICAgbVNyY0J1ZmZlcihOVUxMKSwKLSAgICAgIG1Jc0hlaWYoaXRlbVRhYmxlICE9IE5VTEwpLAogICAgICAgbUl0ZW1UYWJsZShpdGVtVGFibGUpLAogICAgICAgbUVsc3RTaGlmdFN0YXJ0VGlja3MoZWxzdFNoaWZ0U3RhcnRUaWNrcyksCiAgICAgICBtRWxzdEluaXRpYWxFbXB0eUVkaXRUaWNrcyhlbHN0SW5pdGlhbEVtcHR5RWRpdFRpY2tzKSB7CkBAIC00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ogICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgIH0KIAotICAgICAgICAvLyBhcHBseSBzb21lIHNhbml0eSAodnMgc3RyaWN0IGxlZ2FsaXR5KSBjaGVja3MKKyAgICAgICAgLy8gYXBwbHkgc29tZSBxdWljayAodnMgc3RyaWN0IGxlZ2FsaXR5KSBjaGVja3MKICAgICAgICAgLy8KICAgICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50MzJfdCBrTWF4VHJ1blNhbXBsZUNvdW50ID0gMTAwMDA7CiAgICAgICAgIGlmIChzYW1wbGVDb3VudCA+IGtNYXhUcnVuU2FtcGxlQ291bnQpIHsKQEAgLTU5MTYsNyArNjEyMCw3IEBACiAKICAgICBpZiAob3B0aW9ucyAmJiBvcHRpb25zLT5nZXRTZWVrVG8oJnNlZWtUaW1lVXMsICZtb2RlKSkgewogICAgICAgICBBTE9HVigic2Vla1RpbWVVczolIiBQUklkNjQsIHNlZWtUaW1lVXMpOwotICAgICAgICBpZiAobUlzSGVpZikgeworICAgICAgICBpZiAobUlzSGVpZiB8fCBtSXNBdmlmKSB7CiAgICAgICAgICAgICBDSEVDSyhtU2FtcGxlVGFibGUgPT0gTlVMTCk7CiAgICAgICAgICAgICBDSEVDSyhtSXRlbVRhYmxlICE9IE5VTEwpOwogICAgICAgICAgICAgaW50MzJfdCBpbWFnZUluZGV4OwpAQCAtNTk4NiwxMCArNjE5MCwxMSBAQAogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICB1aW50MzJfdCBzeW5jU2FtcGxlSW5kZXggPSBzYW1wbGVJbmRleDsKLSAgICAgICAgICAgIC8vIGFzc3VtZSBldmVyeSBub24tVVNBQyBhdWRpbyBzYW1wbGUgaXMgYSBzeW5jIHNhbXBsZS4gVGhpcyB3b3JrcyBhcm91bmQKKyAgICAgICAgICAgIC8vIGFzc3VtZSBldmVyeSBub24tVVNBQy9ub24tTVBFR0ggYXVkaW8gc2FtcGxlIGlzIGEgc3luYyBzYW1wbGUuCisgICAgICAgICAgICAvLyBUaGlzIHdvcmtzIGFyb3VuZAogICAgICAgICAgICAgLy8gc2VlayBpc3N1ZXMgd2l0aCBmaWxlcyB0aGF0IHdlcmUgaW5jb3JyZWN0bHkgd3JpdHRlbiB3aXRoIGFuCiAgICAgICAgICAgICAvLyBlbXB0eSBvciBzaW5nbGUtc2FtcGxlIHN0c3MgYmxvY2sgZm9yIHRoZSBhdWRpbyB0cmFjawotICAgICAgICAgICAgaWYgKGVyciA9PSBPSyAmJiAoIW1Jc0F1ZGlvIHx8IG1Jc1VzYWMpKSB7CisgICAgICAgICAgICBpZiAoZXJyID09IE9LICYmICghbUlzQXVkaW8gfHwgbUlzVXNhYyB8fCBtSXNNcGVnSCkpIHsKICAgICAgICAgICAgICAgICBlcnIgPSBtU2FtcGxlVGFibGUtPmZpbmRTeW5jU2FtcGxlTmVhcigKICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsZUluZGV4LCAmc3luY1NhbXBsZUluZGV4LCBmaW5kRmxhZ3MpOwogICAgICAgICAgICAgfQpAQCAtNjA2MSw3ICs2MjY2LDcgQEAKICAgICAgICAgbmV3QnVmZmVyID0gdHJ1ZTsKIAogICAgICAgICBzdGF0dXNfdCBlcnI7Ci0gICAgICAgIGlmICghbUlzSGVpZikgeworICAgICAgICBpZiAoIW1Jc0hlaWYgJiYgIW1Jc0F2aWYpIHsKICAgICAgICAgICAgIGVyciA9IG1TYW1wbGVUYWJsZS0+Z2V0TWV0YURhdGFGb3JTYW1wbGUobUN1cnJlbnRTYW1wbGVJbmRleCwgJm9mZnNldCwgJnNpemUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHVpbnQ2NF90KikmY3RzLCAmaXNTeW5jU2FtcGxlLCAmc3R0cyk7CiAgICAgICAgICAgICBpZihlcnIgPT0gT0spIHsKQEAgLTYxMDgsOSArNjMxMywxMyBAQAogICAgICAgICBpZiAobmV3QnVmZmVyKSB7CiAgICAgICAgICAgICBpZiAobUlzUGNtKSB7CiAgICAgICAgICAgICAgICAgLy8gVGhlIHR3b3MnIFBDTSBibG9jayByZWFkZXIgYXNzdW1lcyB0aGF0IGFsbCBzYW1wbGVzIGhhcyB0aGUgc2FtZSBzaXplLgotCi0gICAgICAgICAgICAgICAgdWludDMyX3Qgc2FtcGxlc1RvUmVhZCA9IG1TYW1wbGVUYWJsZS0+Z2V0TGFzdFNhbXBsZUluZGV4SW5DaHVuaygpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIG1DdXJyZW50U2FtcGxlSW5kZXggKyAxOworICAgICAgICAgICAgICAgIHVpbnQzMl90IGxhc3RTYW1wbGVJbmRleEluQ2h1bmsgPSBtU2FtcGxlVGFibGUtPmdldExhc3RTYW1wbGVJbmRleEluQ2h1bmsoKTsKKyAgICAgICAgICAgICAgICBpZiAobGFzdFNhbXBsZUluZGV4SW5DaHVuayA8IG1DdXJyZW50U2FtcGxlSW5kZXgpIHsKKyAgICAgICAgICAgICAgICAgICAgbUJ1ZmZlci0+cmVsZWFzZSgpOworICAgICAgICAgICAgICAgICAgICBtQnVmZmVyID0gbnVsbHB0cjsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9VTktOT1dOOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB1aW50MzJfdCBzYW1wbGVzVG9SZWFkID0gbGFzdFNhbXBsZUluZGV4SW5DaHVuayAtIG1DdXJyZW50U2FtcGxlSW5kZXggKyAxOwogICAgICAgICAgICAgICAgIGlmIChzYW1wbGVzVG9SZWFkID4ga01heFBjbUZyYW1lU2l6ZSkgewogICAgICAgICAgICAgICAgICAgICBzYW1wbGVzVG9SZWFkID0ga01heFBjbUZyYW1lU2l6ZTsKICAgICAgICAgICAgICAgICB9CkBAIC02MTE5LDEzICs2MzI4LDE3IEBACiAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxlc1RvUmVhZCwgc2l6ZSwgbUN1cnJlbnRTYW1wbGVJbmRleCwKICAgICAgICAgICAgICAgICAgICAgICBtU2FtcGxlVGFibGUtPmdldExhc3RTYW1wbGVJbmRleEluQ2h1bmsoKSk7CiAKLSAgICAgICAgICAgICAgIHNpemVfdCB0b3RhbFNpemUgPSBzYW1wbGVzVG9SZWFkICogc2l6ZTsKKyAgICAgICAgICAgICAgICBzaXplX3QgdG90YWxTaXplID0gc2FtcGxlc1RvUmVhZCAqIHNpemU7CisgICAgICAgICAgICAgICAgaWYgKG1CdWZmZXItPnNpemUoKSA8IHRvdGFsU2l6ZSkgeworICAgICAgICAgICAgICAgICAgICBtQnVmZmVyLT5yZWxlYXNlKCk7CisgICAgICAgICAgICAgICAgICAgIG1CdWZmZXIgPSBudWxscHRyOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gQU1FRElBX0VSUk9SX1VOS05PV047CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHVpbnQ4X3QqIGJ1ZiA9ICh1aW50OF90ICopbUJ1ZmZlci0+ZGF0YSgpOwogICAgICAgICAgICAgICAgIHNzaXplX3QgYnl0ZXNSZWFkID0gbURhdGFTb3VyY2UtPnJlYWRBdChvZmZzZXQsIGJ1ZiwgdG90YWxTaXplKTsKICAgICAgICAgICAgICAgICBpZiAoYnl0ZXNSZWFkIDwgKHNzaXplX3QpdG90YWxTaXplKSB7CiAgICAgICAgICAgICAgICAgICAgIG1CdWZmZXItPnJlbGVhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgbUJ1ZmZlciA9IE5VTEw7Ci0KICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9JTzsKICAgICAgICAgICAgICAgICB9CiAKQEAgLTYxNzksNyArNjM5MiwxOSBAQAogICAgICAgICAgICAgICAgIGlmIChpc1N5bmNTYW1wbGUpIHsKICAgICAgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEludDMyKG1ldGEsIEFNRURJQUZPUk1BVF9LRVlfSVNfU1lOQ19GUkFNRSwgMSk7CiAgICAgICAgICAgICAgICAgfQotIAorCisgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEludDY0KAorICAgICAgICAgICAgICAgICAgICAgICAgbWV0YSwgInNhbXBsZS1maWxlLW9mZnNldCIgLypBTUVESUFGT1JNQVRfS0VZX1NBTVBMRV9GSUxFX09GRlNFVCovLAorICAgICAgICAgICAgICAgICAgICAgICAgb2Zmc2V0KTsKKworICAgICAgICAgICAgICAgIGlmIChtU2FtcGxlVGFibGUgIT0gbnVsbHB0ciAmJgorICAgICAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRTYW1wbGVJbmRleCA9PSBtU2FtcGxlVGFibGUtPmdldExhc3RTYW1wbGVJbmRleEluQ2h1bmsoKSkgeworICAgICAgICAgICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0SW50NjQoCisgICAgICAgICAgICAgICAgICAgIG1ldGEsCisgICAgICAgICAgICAgICAgICAgICJsYXN0LXNhbXBsZS1pbmRleC1pbi1jaHVuayIgLypBTUVESUFGT1JNQVRfS0VZX0xBU1RfU0FNUExFX0lOREVYX0lOX0NIVU5LKi8sCisgICAgICAgICAgICAgICAgICAgIG1TYW1wbGVUYWJsZS0+Z2V0TGFzdFNhbXBsZUluZGV4SW5DaHVuaygpKTsKKyAgICAgICAgICAgICAgICB9CisKICAgICAgICAgICAgICAgICArK21DdXJyZW50U2FtcGxlSW5kZXg7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KQEAgLTYyNTgsNyArNjQ4Myw2IEBACiAgICAgICAgIGlmIChudW1fYnl0ZXNfcmVhZCA8IChzc2l6ZV90KXNpemUpIHsKICAgICAgICAgICAgIG1CdWZmZXItPnJlbGVhc2UoKTsKICAgICAgICAgICAgIG1CdWZmZXIgPSBOVUxMOwotCiAgICAgICAgICAgICByZXR1cm4gbVNyY0J1ZmZlckZpdHNEYXRhVG9SZWFkID8gQU1FRElBX0VSUk9SX0lPIDogQU1FRElBX0VSUk9SX01BTEZPUk1FRDsKICAgICAgICAgfQogCkBAIC02MzM2LDYgKzY1NjAsMTcgQEAKICAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRJbnQzMihtZXRhLCBBTUVESUFGT1JNQVRfS0VZX0lTX1NZTkNfRlJBTUUsIDEpOwogICAgICAgICB9CiAKKyAgICAgICAgQU1lZGlhRm9ybWF0X3NldEludDY0KAorICAgICAgICAgICAgICAgIG1ldGEsICJzYW1wbGUtZmlsZS1vZmZzZXQiIC8qQU1FRElBRk9STUFUX0tFWV9TQU1QTEVfRklMRV9PRkZTRVQqLywgb2Zmc2V0KTsKKworICAgICAgICBpZiAobVNhbXBsZVRhYmxlICE9IG51bGxwdHIgJiYKKyAgICAgICAgICAgICAgICBtQ3VycmVudFNhbXBsZUluZGV4ID09IG1TYW1wbGVUYWJsZS0+Z2V0TGFzdFNhbXBsZUluZGV4SW5DaHVuaygpKSB7CisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0SW50NjQoCisgICAgICAgICAgICAgICAgICAgIG1ldGEsCisgICAgICAgICAgICAgICAgICAgICJsYXN0LXNhbXBsZS1pbmRleC1pbi1jaHVuayIgLypBTUVESUFGT1JNQVRfS0VZX0xBU1RfU0FNUExFX0lOREVYX0lOX0NIVU5LKi8sCisgICAgICAgICAgICAgICAgICAgIG1TYW1wbGVUYWJsZS0+Z2V0TGFzdFNhbXBsZUluZGV4SW5DaHVuaygpKTsKKyAgICAgICAgfQorCiAgICAgICAgICsrbUN1cnJlbnRTYW1wbGVJbmRleDsKIAogICAgICAgICAqb3V0ID0gbUJ1ZmZlcjsKQEAgLTY0OTYsOSArNjczMSw5IEBACiAgICAgaWYgKHNtcGwtPmVuY3J5cHRlZHNpemVzLnNpemUoKSkgewogICAgICAgICAvLyBzdG9yZSBjbGVhci9lbmNyeXB0ZWQgbGVuZ3RocyBpbiBtZXRhZGF0YQogICAgICAgICBBTWVkaWFGb3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ICAgaG9zdF9zdXBwb3J0ZWQ6IHRydWUsCisgICAgdGFyZ2V0OiB7CisgICAgICAgIGRhcndpbjogeworICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsCisgICAgICAgIH0sCisgICAgICAgIGFuZHJvaWQ6IHsKKyAgICAgICAgICAgIHNoYXJlZF9saWJzOiBbImxpYnZuZGtzdXBwb3J0IzI5Il0sCisgICAgICAgIH0sCisgICAgfSwKKwogICAgIGRlZmF1bHRzOiBbImV4dHJhY3Rvci1kZWZhdWx0cyJdLAogCiAgICAgc3JjczogWwpAQCAtMTIsMTQgKzQxLDEzIEBACiAgICAgc2hhcmVkX2xpYnM6IFsKICAgICAgICAgImxpYmJhc2UiLAogICAgICAgICAibGliY2dyb3VwcmMjMjkiLAotICAgICAgICAibGlidm5ka3N1cHBvcnQjMjkiLAogICAgIF0sCiAKICAgICBoZWFkZXJfbGliczogWwogICAgICAgICAibGliYXVkaW9jbGllbnRfaGVhZGVycyIsCiAgICAgICAgICJsaWJiYXNlX2hlYWRlcnMiLAogICAgICAgICAibGlic3RhZ2VmcmlnaHRfaGVhZGVycyIsCi0gICAgICAgICJsaWJtZWRpYV9oZWFkZXJzIiwKKyAgICAgICAgImxpYm1lZGlhX2RhdGFzb3VyY2VfaGVhZGVycyIsCiAgICAgXSwKIAogICAgIHN0YXRpY19saWJzOiBbCkBAIC0zNyw3ICs2NSw3IEBACiAgICAgICAgICJsaWJzdGFnZWZyaWdodF9lc2RzIiwKICAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2ZvdW5kYXRpb25fd2l0aG91dF9pbWVtb3J5IiwKICAgICAgICAgImxpYnN0YWdlZnJpZ2h0X21wZWcyZXh0cmFjdG9yIiwKLSAgICAgICAgImxpYnN0YWdlZnJpZ2h0X21wZWcyc3VwcG9ydCIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9tcGVnMnN1cHBvcnRfbm9jcnlwdG8iLAogICAgICAgICAibGlidXRpbHMiLAogICAgIF0sCiAKZG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N0cmluZyBpbnB1dEZpbGU7CisgICAgaW50MzJfdCBmaXJzdFBhcmFtOworICAgIGludDMyX3Qgc2Vjb25kUGFyYW07CisgICAgaW50MzJfdCBwcm9maWxlOworICAgIGludDMyX3QgZnJhbWVSYXRlOworfSBrSW5wdXREYXRhW10gPSB7CisgICAgICAgIHtBQUNfMSwgTUVESUFfTUlNRVRZUEVfQVVESU9fQUFDLCAidGVzdF9tb25vXzQ0MTAwSHpfYWFjLmFhYyIsIDQ0MTAwLCAxLCBBQUNPYmplY3RMQywKKyAgICAgICAgIGtVbmRlZmluZWR9LAorICAgICAgICB7QU1SX05CXzEsIE1FRElBX01JTUVUWVBFX0FVRElPX0FNUl9OQiwgImJiYl9tb25vXzhrSHpfYW1ybmIuYW1yIiwgODAwMCwgMSwga1VuZGVmaW5lZCwKKyAgICAgICAgIGtVbmRlZmluZWR9LAorICAgICAgICB7QU1SX1dCXzEsIE1FRElBX01JTUVUWVBFX0FVRElPX0FNUl9XQiwgImJiYl9tb25vXzE2a0h6X2FtcndiLmFtciIsIDE2MDAwLCAxLCBrVW5kZWZpbmVkLAorICAgICAgICAga1VuZGVmaW5lZH0sCisgICAgICAgIHtGTEFDXzEsIE1FRElBX01JTUVUWVBFX0FVRElPX1JBVywgImJiYl9zdGVyZW9fNDhrSHpfZmxhYy5mbGFjIiwgNDgwMDAsIDIsIGtVbmRlZmluZWQsCisgICAgICAgICBrVW5kZWZpbmVkfSwKKyAgICAgICAge0dTTV8xLCBNRURJQV9NSU1FVFlQRV9BVURJT19NU0dTTSwgInRlc3RfbW9ub184a0h6X2dzbS53YXYiLCA4MDAwLCAxLCBrVW5kZWZpbmVkLAorICAgICAgICAga1VuZGVmaW5lZH0sCisgICAgICAgIHtNSURJXzEsIE1FRElBX01JTUVUWVBFX0FVRElPX1JBVywgIm1pZGlfYS5taWQiLCAyMjA1MCwgMiwga1VuZGVmaW5lZCwga1VuZGVmaW5lZH0sCisgICAgICAgIHtNUDNfMSwgTUVESUFfTUlN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ICAgICAgIHsiYWFjIiwgQUFDfSwgICAgIHsiYW1yIiwgQU1SfSwgICAgICAgICB7Im1wMyIsIE1QM30sICAgICAgICB7Im9nZyIsIE9HR30sCi0gICAgICAgICAgICAgICAgeyJ3YXYiLCBXQVZ9LCAgICAgeyJta3YiLCBNS1Z9LCAgICAgICAgIHsiZmxhYyIsIEZMQUN9LCAgICAgIHsibWlkaSIsIE1JREl9LAotICAgICAgICAgICAgICAgIHsibXBlZzQiLCBNUEVHNH0sIHsibXBlZzJ0cyIsIE1QRUcyVFN9LCB7Im1wZWcycHMiLCBNUEVHMlBTfX07CisgICAgICAgICAgICAgICAgeyJhYWMiLCBBQUN9LAorICAgICAgICAgICAgICAgIHsiYW1yIiwgQU1SfSwKKyAgICAgICAgICAgICAgICB7ImZsYWMiLCBGTEFDfSwKKyAgICAgICAgICAgICAgICB7Im1pZCIsIE1JREl9LAorICAgICAgICAgICAgICAgIHsibWlkaSIsIE1JREl9LAorICAgICAgICAgICAgICAgIHsibWt2IiwgTUtWfSwKKyAgICAgICAgICAgICAgICB7Im1wMyIsIE1QM30sCisgICAgICAgICAgICAgICAgeyJtcDQiLCBNUEVHNH0sCisgICAgICAgICAgICAgICAgeyJtcGVnMnBzIiwgTVBFRzJQU30sCisgICAgICAgICAgICAgICAgeyJtcGVnMnRzIiwgTVBFRzJUU30sCisgICAgICAgICAgICAgICAgeyJtcGVnNCIsIE1QRUc0fSwKKyAgICAgICAgICAgICAgICB7Im1wZyIsIE1QRUcyUFN9LAorICAgICAgICAgICAgICAgIHsib2dnIiwgT0dHfSwKKyAgICAgICAgICAgICAgICB7Im9wdXMiLCBPR0d9LAorICAgICAgICAgICAgICAgIHsidHMiLCBNUEVHMlRTfSwKKyAgICAgICAgICAgICAgICB7IndhdiIsIFdBVn0sCisgICAgICAgICAgICAgICAgeyJ3ZWJtIiwgTUtWfX07CiAgICAgICAgIC8vIEZpbmQgdGhlIGNvbXBvbmVudCB0eXBlCi0gICAgICAgIHN0cmluZyB3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UGFyYW0ucHJvZmlsZSA9IGtJbnB1dERhdGFbaW5wdXRJZHhdLnByb2ZpbGU7CisgICAgY29uZmlnUGFyYW0uZnJhbWVSYXRlID0ga0lucHV0RGF0YVtpbnB1dElkeF0uZnJhbWVSYXRlOworICAgIHJldHVybjsKK30KKwordm9pZCByYW5kb21TZWVrVGVzdChNZWRpYVRyYWNrSGVscGVyICp0cmFjaywgaW50NjRfdCBjbGlwRHVyYXRpb24pIHsKKyAgICBpbnQzMl90IHN0YXR1cyA9IDA7CisgICAgaW50MzJfdCBzZWVrQ291bnQgPSAwOworICAgIGJvb2wgaGFzVGltZXN0YW1wID0gZmFsc2U7CisgICAgdmVjdG9yPGludDY0X3Q+IHNlZWtUb1RpbWVTdGFtcDsKKyAgICBzdHJpbmcgc2Vla1B0c1N0cmluZzsKKworICAgIHNyYW5kKGtSYW5kb21TZWVkKTsKKyAgICB3aGlsZSAoc2Vla0NvdW50IDwga01heENvdW50KSB7CisgICAgICAgIGludDY0X3QgdGltZVN0YW1wID0gKChkb3VibGUpcmFuZCgpIC8gUkFORF9NQVgpICogY2xpcER1cmF0aW9uOworICAgICAgICBzZWVrVG9UaW1lU3RhbXAucHVzaF9iYWNrKHRpbWVTdGFtcCk7CisgICAgICAgIHNlZWtQdHNTdHJpbmcuYXBwZW5kKHRvX3N0cmluZyh0aW1lU3RhbXApKTsKKyAgICAgICAgc2Vla1B0c1N0cmluZy5hcHBlbmQoIiwgIik7CisgICAgICAgIHNlZWtDb3VudCsrOworICAgIH0KKworICAgIGZvciAoaW50NjRfdCBzZWVrUHRzIDogc2Vla1RvVGltZVN0YW1wKSB7CisgICAgICAgIE1lZGlhVHJhY2tIZWxwZXI6OlJlYWRPcHRpb25zICpvcHRpb25zID0gbmV3IE1lZGlhVHJhY2tIZWxwZXI6OlJlYWRPcHRpb25zKAorICAgICAgICAgICAgICAgIENNZWRpYVRyYWNrUmVhZE9wdGlvbnM6OlNFRUtfQ0xPU0VTVCB8IENNZWRpYVRyYWNrUmVhZE9wdGlvbnM6OlNFRUssIHNlZWtQdHMpOworICAgICAgICBBU1NFUlRfTkUob3B0aW9ucywgbnVsbHB0cikgPDwgIkNhbm5vdCBjcmVhdGUgcmVhZCBvcHRpb24iOworCisgICAgICAgIE1lZGlhQnVmZmVySGVscGVyICpidWZmZXIgPSBudWxscHRyOworICAgICAgICBzdGF0dXMgPSB0cmFjay0+cmVhZCgmYnVmZmVyLCBvcHRpb25zKTsKKyAgICAgICAgaWYgKGJ1ZmZlcikgeworICAgICAgICAgICAgQU1lZGlhRm9ybWF0ICptZXRhRGF0YSA9IGJ1ZmZlci0+bWV0YV9kYXRhKCk7CisgICAgICAgICAgICBpbnQ2NF90IHRpbWVTdGFtcCA9IDA7CisgICAgICAgICAgICBoYXNUaW1lc3RhbXAgPSBBTWVkaWFGb3JtYXRfZ2V0SW50NjQobWV0YURhdGEsIEFNRURJQUZPUk1BVF9LRVlfVElNRV9VUywgJnRpbWVTdGFtcCk7CisgICAgICAgICAgICBBU1NFUlRfVFJVRShoYXNUaW1lc3RhbXApIDw8ICJFeHRyYWN0b3IgZGlkbid0IHNldCB0aW1lc3RhbXAgZm9yIHRoZSBnaXZlbiBzYW1wbGUiOworCisgICAgICAgICAgICBidWZmZXItPnJlbGVhc2UoKTsKKyAgICAgICAgICAgIEVYUEVDVF9MRShhYnModGltZVN0YW1wIC0gc2Vla1B0cyksIGtSYW5kb21TZWVrVG9sZXJhbmNlVXMpCisgICAgICAgICAgICAgICAgICAgIDw8ICJTZWVrIHVuc3VjY2Vzc2Z1bC4gRXhwZWN0ZWQgdGltZXN0YW1wIHJhbmdlIFsiCisgICAgICAgICAgICAgICAgICAgIDw8IHNlZWtQdHMgLSBrUmFuZG9tU2Vla1RvbGVyYW5jZVVzIDw8ICIsICIgPDwgc2Vla1B0cyArIGtSYW5kb21TZWVrVG9sZXJhbmNlVXMKKyAgICAgICAgICAgICAgICAgICAgPDwgIl0gIgorICAgICAgICAgICAgICAgICAgICA8PCAicmVjZW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HMuc2l6ZSgpLCAwKQorICAgICAgICAgICAgICAgIDw8ICJGYWlsZWQgdG8gZ2V0IHNlZWthYmxlIHBvaW50cyBmb3IgIiA8PCBtQ29udGFpbmVyIDw8ICIgZXh0cmFjdG9yIjsKKworICAgICAgICBib29sIGlzT3B1cyA9IGZhbHNlOworICAgICAgICBpbnQ2NF90IG9wdXNTZWVrUHJlUm9sbFVzID0gMDsKKyAgICAgICAgaWYgKCFzdHJjbXAobWltZSwgImF1ZGlvL29wdXMiKSkgeworICAgICAgICAgICAgaXNPcHVzID0gdHJ1ZTsKKyAgICAgICAgICAgIHZvaWQgKnNlZWtQcmVSb2xsQnVmID0gbnVsbHB0cjsKKyAgICAgICAgICAgIHNpemVfdCBzaXplID0gMDsKKyAgICAgICAgICAgIGlmICghQU1lZGlhRm9ybWF0X2dldEJ1ZmZlcih0cmFja0Zvcm1hdCwgImNzZC0yIiwgJnNlZWtQcmVSb2xsQnVmLCAmc2l6ZSkpIHsKKyAgICAgICAgICAgICAgICBzaXplX3Qgb3B1c0hlYWRTaXplID0gMDsKKyAgICAgICAgICAgICAgICBzaXplX3QgY29kZWNEZWxheUJ1ZlNpemUgPSAwOworICAgICAgICAgICAgICAgIHNpemVfdCBzZWVrUHJlUm9sbEJ1ZlNpemUgPSAwOworICAgICAgICAgICAgICAgIHZvaWQgKmNzZEJ1ZmZlciA9IG51bGxwdHI7CisgICAgICAgICAgICAgICAgdm9pZCAqb3B1c0hlYWRCdWYgPSBudWxscHRyOworICAgICAgICAgICAgICAgIHZvaWQgKmNvZGVjRGVsYXlCdWYgPSBudWxscHRyOworICAgICAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9nZXRCdWZmZXIodHJhY2tGb3JtYXQsICJjc2QtMCIsICZjc2RCdWZmZXIsICZzaXplKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfTkUoY3NkQnVmZmVyLCBudWxscHRyKTsKKworICAgICAgICAgICAgICAgIEdldE9wdXNIZWFkZXJCdWZmZXJzKCh1aW50OF90ICopY3NkQnVmZmVyLCBzaXplLCAmb3B1c0hlYWRCdWYsICZvcHVzSGVhZFNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmNvZGVjRGVsYXlCdWYsICZjb2RlY0RlbGF5QnVmU2l6ZSwgJnNlZWtQcmVSb2xsQnVmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzZWVrUHJlUm9sbEJ1ZlNpemUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQVNTRVJUX05FKHNlZWtQcmVSb2xsQnVmLCBudWxscHRyKQorICAgICAgICAgICAgICAgICAgICA8PCAiSW52YWxpZCB0cmFjayBmb3JtYXQuIFNlZWtQcmVSb2xsIGluZm8gbWlzc2luZyBmb3IgT3B1cyBmaWxlIjsKKyAgICAgICAgICAgIG9wdXNTZWVrUHJlUm9sbFVzID0gKigoaW50NjRfdCAqKXNlZWtQcmVSb2xsQnVmKTsKKyAgICAgICAgfQogICAgICAgICBBTWVkaWFGb3JtYXRfZGVsZXRlKHRyYWNrRm9ybWF0KTsKIAogICAgICAgICBpbnQzMl90IHNlZWtJZHggPSAwOwpAQCAtNDM5LDcgKzY4NSw4IEBACiAgICAgICAgICAgICAgICAgaWYgKHNlZWtJZHggPj0gc2Vla2FibGVQb2ludHNTaXplKSBzZWVrSWR4ID0gc2Vla2FibGVQb2ludHNTaXplIC0gMTsKIAogICAgICAgICAgICAgICAgIGludDY0X3Qgc2Vla1RvVGltZVN0YW1wID0gc2Vla2FibGVQb2ludHNbc2Vla0lkeF07Ci0gICAgICAgICAgICAgICAgaWYgKHNlZWthYmxlUG9pbnRzU2l6ZSA+IDEpIHsKKyAgICAgICAgICAgICAgICBpZiAoc2Vla0lkeCA+IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gcGljayBhIHRpbWUganVzdCBlYXJsaWVyIHRoYW4gdGhpcyBzZWVrIHBvaW50CiAgICAgICAgICAgICAgICAgICAgIGludDY0X3QgcHJldlRpbWVTdGFtcCA9IHNlZWthYmxlUG9pbnRzW3NlZWtJZHggLSAxXTsKICAgICAgICAgICAgICAgICAgICAgc2Vla1RvVGltZVN0YW1wID0gc2Vla1RvVGltZVN0YW1wIC0gKChzZWVrVG9UaW1lU3RhbXAgLSBwcmV2VGltZVN0YW1wKSA+PiAzKTsKICAgICAgICAgICAgICAgICB9CkBAIC00NDgsNyArNjk1LDcgQEAKICAgICAgICAgICAgICAgICAvLyBleHRyYWN0b3IgaXMgY2FsY3VsYXRlZCBiYXNlZCBvbiAoc2Vla1B0cyAtIHNlZWtQcmVSb2xsVXMpLgogICAgICAgICAgICAgICAgIC8vIFNvIHdlIGFkZCB0aGUgcHJlUm9sbCB2YWx1ZSB0byB0aGUgdGltZVN0YW1wIHdlIHdhbnQgdG8gc2VlayB0by4KICAgICAgICAgICAgICAgICBpZiAoaXNPcHVzKSB7Ci0gICAgICAgICAgICAgICAgICAgIHNlZWtUb1RpbWVTdGFtcCArPSBrT3B1c1NlZWtQcmVSb2xsVXM7CisgICAgICAgICAgICAgICAgICAgIHNlZWtUb1RpbWVTdGFtcCArPSBvcHVzU2Vla1ByZVJvbGxVczsKICAgICAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgICAgICBNZWRpYVRyYWNrSGVscGVyOjpSZWFkT3B0aW9ucyAqb3B0aW9ucyA9IG5ldyBNZWRpYVRyYWNrSGVscGVyOjpSZWFkT3B0aW9ucygKQEAgLTQ3MCwxMSArNzE3LDcgQEAKICAgICAgICAgICAgICAgICAgICAgLy8gQ01lZGlhVHJhY2tSZWFkT3B0aW9uczo6U0VFSyBpcyA4LiBVc2luZyBtYXNrIDAxMTFiIHRvIGdldCB0cnVlIG1vZGVzCiAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobW9kZSAmIDB4NykgewogICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDTWVkaWFUcmFja1JlYWRPcHRpb25zOjpTRUVLX1BSRVZJT1VTX1NZTkM6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNlZWthYmxlUG9pbnRzU2l6ZSA9PSAxKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVYUEVDVF9FUSh0aW1lU3RhbXAsIHNlZWthYmxlUG9pbnRzW3NlZWtJZHhdKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFWFBFQ1RfRVEodGltZVN0YW1wLCBzZWVrYWJsZVBvaW50c1tzZWVrSWR4IC0gMV0pOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBFWFBFQ1RfRVEodGltZVN0YW1wLCBzZWVrYWJsZVBvaW50c1tzZWVrSWR4ID4gMCA/IChzZWVrSWR4IC0gMSkgOiAwXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIENNZWRpYVRyYWNrUmVhZE9wdGlvbnM6OlNFRUtfTkVYVF9TWU5DOgogICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDTWVkaWFUcmFja1JlYWRPcHRpb25zOjpTRUVLX0NMT1NFU1RfU1lOQzoKQEAgLTQ5NiwyNCArNzM5LDUyMyBAQAogICAgIHNlZWthYmxlUG9pbnRzLmNsZWFyKCk7CiB9CiAKLS8vIFRPRE86IChiLzE0NTMzMjE4NSkKLS8vIEFkZCBNSURJIGlucHV0cwotSU5TVEFOVElBVEVfVEVTVF9TVUlURV9QKEV4dHJhY3RvclVuaXRUZXN0QWxsLCBFeHRyYWN0b3JVbml0VGVzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICA6OnRlc3Rpbmc6OlZhbHVlcyhtYWtlX3BhaXIoImFhYyIsICJsb3Vkc29mdGFhYy5hYWMiKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImFtciIsICJ0ZXN0YW1yLmFtciIpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYW1yIiwgImFtcndiLndhdiIpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigib2dnIiwgImpvaG5fY2FnZS5vZ2ciKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIndhdiIsICJtb25vdGVzdGdzbS53YXYiKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIm1wZWcydHMiLCAic2VnbWVudDAwMDAwMS50cyIpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiZmxhYyIsICJzaW5lc3dlZXBmbGFjLmZsYWMiKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIm9nZyIsICJ0ZXN0b3B1cy5vcHVzIiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJta3YiLCAic2luZXN3ZWVwdm9yYmlzLm1rdiIpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigibXBlZzQiLCAic2luZXN3ZWVwb2dnbXA0Lm1wNCIpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigibXAzIiwgInNpbmVzd2VlcG1wM2xhbWUubXAzIiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJta3YiLCAic3dpcmxfMTQ0eDEzNl92cDkud2VibSIpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2V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0cmluZyh0cmFja01ldGEsIEFNRURJQUZPUk1BVF9LRVlfTUlNRSwgJm1pbWUpKQorICAgICAgICAgICAgICAgIDw8ICJGYWlsZWQgdG8gZ2V0IG1pbWUiOworCisgICAgICAgIGludDY0X3QgY2xpcER1cmF0aW9uID0gMDsKKyAgICAgICAgQU1lZGlhRm9ybWF0X2dldEludDY0KHRyYWNrTWV0YSwgQU1FRElBRk9STUFUX0tFWV9EVVJBVElPTiwgJmNsaXBEdXJhdGlvbik7CisgICAgICAgIC8vIEltYWdlIGZvcm1hdHMgYXJlIG5vdCBleHBlY3RlZCB0byBoYXZlIGR1cmF0aW9uIGluZm9ybWF0aW9uCisgICAgICAgIEFTU0VSVF9UUlVFKGNsaXBEdXJhdGlvbiA+IDAgfHwgIXN0cm5jbXAobWltZSwgImltYWdlLyIsIDYpKSA8PCAiSW52YWxpZCBjbGlwIGR1cmF0aW9uICI7CisgICAgICAgIEFNZWRpYUZvcm1hdF9kZWxldGUodHJhY2tNZXRhKTsKKworICAgICAgICBpbnQ2NF90IHNlZWtUb1RpbWVTdGFtcFVzW10gPSB7LWNsaXBEdXJhdGlvbiwgY2xpcER1cmF0aW9uIC8gMiwgY2xpcER1cmF0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpcER1cmF0aW9uICogMn07CisgICAgICAgIGZvciAoaW50MzJfdCBtb2RlID0gQ01lZGlhVHJhY2tSZWFkT3B0aW9uczo6U0VFS19QUkVWSU9VU19TWU5DOworICAgICAgICAgICAgIG1vZGUgPD0gQ01lZGlhVHJhY2tSZWFkT3B0aW9uczo6U0VFS19DTE9TRVNUOyBtb2RlKyspIHsKKyAgICAgICAgICAgIGZvciAoaW50NjRfdCBzZWVrVGltZVVzIDogc2Vla1RvVGltZVN0YW1wVXMpIHsKKyAgICAgICAgICAgICAgICBNZWRpYVRyYWNrSGVscGVyOjpSZWFkT3B0aW9ucyAqb3B0aW9ucyA9IG5ldyBNZWRpYVRyYWNrSGVscGVyOjpSZWFkT3B0aW9ucygKKyAgICAgICAgICAgICAgICAgICAgICAgIG1vZGUgfCBDTWVkaWFUcmFja1JlYWRPcHRpb25zOjpTRUVLLCBzZWVrVGltZVVzKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfTkUob3B0aW9ucywgbnVsbHB0cikgPDwgIkNhbm5vdCBjcmVhdGUgcmVhZCBvcHRpb24iOworCisgICAgICAgICAgICAgICAgTWVkaWFCdWZmZXJIZWxwZXIgKmJ1ZmZlciA9IG51bGxwdHI7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gdHJhY2stPnJlYWQoJmJ1ZmZlciwgb3B0aW9ucyk7CisgICAgICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBBTUVESUFfRVJST1JfRU5EX09GX1NUUkVBTSkgeworICAgICAgICAgICAgICAgICAgICBkZWxldGUgb3B0aW9uczsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChidWZmZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0ICptZXRhRGF0YSA9IGJ1ZmZlci0+bWV0YV9kYXRhKCk7CisgICAgICAgICAgICAgICAgICAgIGludDY0X3QgdGltZVN0YW1wOworICAgICAgICAgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZ2V0SW50NjQobWV0YURhdGEsIEFNRURJQUZPUk1BVF9LRVlfVElNRV9VUywgJnRpbWVTdGFtcCk7CisgICAgICAgICAgICAgICAgICAgIEFMT0dWKCJTZWVrZWQgdG8gdGltZXN0YW1wIDogJWxsZCwgcmVxdWVzdGVkIDogJWxsZCIsIChsb25nIGxvbmcpdGltZVN0YW1wLAorICAgICAgICAgICAgICAgICAgICAgICAgICAobG9uZyBsb25nKXNlZWtUaW1lVXMpOworICAgICAgICAgICAgICAgICAgICBidWZmZXItPnJlbGVhc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIC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ZSBleHRyYWN0b3JzIGxpa2UgZmxhYywgbWlkaSBhbmQgd2F2IGRlY29kZXMgdGhlIGZpbGUuIFRoZXNlIGV4dHJhY3RvcnMKKyAgICAvLyBhZHZlcnRpc2UgdGhlIG1pbWUgdHlwZSBhcyByYXcuCisgICAgY29uc3QgY2hhciAqbWltZTsKKyAgICBBTWVkaWFGb3JtYXRfZ2V0U3RyaW5nKGV4dHJhY3RvckZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9NSU1FLCAmbWltZSk7CisgICAgaWYgKCFzdHJjbXAobWltZSwgTUVESUFfTUlNRVRZUEVfQVVESU9fUkFXKSkgeworICAgICAgICBpbnQ2NF90IGNsaXBEdXJhdGlvblVzID0gLTE7CisgICAgICAgIGludDMyX3QgY2hhbm5lbENvdW50ID0gLTE7CisgICAgICAgIGludDMyX3Qgc2FtcGxlUmF0ZSA9IC0xOworICAgICAgICBpbnQzMl90IGJpdHNQZXJTYW1wcGxlID0gLTE7CisgICAgICAgIGlmICghQU1lZGlhRm9ybWF0X2dldEludDMyKGV4dHJhY3RvckZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9DSEFOTkVMX0NPVU5ULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmY2hhbm5lbENvdW50KSB8fCBjaGFubmVsQ291bnQgPD0gMCkgeworICAgICAgICAgICAgQUxPR0UoIkludmFsaWQgY2hhbm5lbENvdW50IGZvciBpbnB1dCBmaWxlIDogJXMiLCBpbnB1dEZpbGVOYW1lLmNfc3RyKCkpOworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFBTWVkaWFGb3JtYXRfZ2V0SW50MzIoZXh0cmFjdG9yRm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX1NBTVBMRV9SQVRFLCAmc2FtcGxlUmF0ZSkgfHwKKyAgICAgICAgICAgIHNhbXBsZVJhdGUgPD0gMCkgeworICAgICAgICAgICAgQUxPR0UoIkludmFsaWQgc2FtcGxlUmF0ZSBmb3IgaW5wdXQgZmlsZSA6ICVzIiwgaW5wdXRGaWxlTmFtZS5jX3N0cigpKTsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisgICAgICAgIGlmICghQU1lZGlhRm9ybWF0X2dldEludDY0KGV4dHJhY3RvckZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9EVVJBVElPTiwgJmNsaXBEdXJhdGlvblVzKSB8fAorICAgICAgICAgICAgY2xpcER1cmF0aW9uVXMgPD0gMCkgeworICAgICAgICAgICAgQUxPR0UoIkludmFsaWQgY2xpcCBkdXJhdGlvbiBmb3IgaW5wdXQgZmlsZSA6ICVzIiwgaW5wdXRGaWxlTmFtZS5jX3N0cigpKTsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisgICAgICAgIGlmICghQU1lZGlhRm9ybWF0X2dldEludDMyKGV4dHJhY3RvckZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9QQ01fRU5DT0RJTkcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZiaXRzUGVyU2FtcHBsZSkgfHwgYml0c1BlclNhbXBwbGUgPD0gMCkgeworICAgICAgICAgICAgQUxPR0UoIkludmFsaWQgYml0cyBwZXIgc2FtcGxlIGZvciBpbnB1dCBmaWxlIDogJXMiLCBpbnB1dEZpbGVOYW1lLmNfc3RyKCkpOworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKyAgICAgICAgYnVmZmVyU2l6ZSA9IGJpdHNQZXJTYW1wcGxlICogY2hhbm5lbENvdW50ICogc2FtcGxlUmF0ZSAqIChjbGlwRHVyYXRpb25VcyAvIDEwMDAwMDAgKyAxKTsKKyAgICB9IGVsc2UgeworICAgICAgICBzdHJ1Y3Qgc3RhdCBidWY7CisgICAgICAgIGludDMyX3Qgc3RhdHVzID0gc3RhdChpbnB1dEZpbGVOYW1lLmNfc3RyKCksICZidWYpOworICAgICAgICBpZiAoc3RhdHVzIC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gIG9mZnNldCArPSBidWZmZXItPnJhbmdlX2xlbmd0aCgpOworICAgICAgICAgICAgICAgIGJ1ZmZlci0+cmVsZWFzZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHN0YXR1cyA9IGNUcmFjay0+c3RvcCh0cmFjayk7CisgICAgICAgIEFTU0VSVF9FUShPSywgc3RhdHVzKSA8PCAiRmFpbGVkIHRvIHN0b3AgdGhlIHRyYWNrIjsKKworICAgICAgICBmY2xvc2UobUlucHV0RnApOworICAgICAgICBkZWxldGUgYnVmZmVyR3JvdXA7CisgICAgICAgIGRlbGV0ZSB0cmFjazsKKyAgICAgICAgbURhdGFTb3VyY2UuY2xlYXIoKTsKKyAgICAgICAgZGVsZXRlIG1FeHRyYWN0b3I7CisgICAgICAgIG1JbnB1dEZwID0gbnVsbHB0cjsKKyAgICAgICAgbUV4dHJhY3RvciA9IG51bGxwdHI7CisgICAgfQorCisgICAgLy8gQ29tcGFyZSB0aGUgbWV0YSBkYXRhIGZyb20gYm90aCB0aGUgZXh0cmFjdG9ycworICAgIGNvbnN0IGNoYXIgKm1pbWVbMl07CisgICAgQU1lZGlhRm9ybWF0X2dldFN0cmluZyhleHRyYWN0b3JGb3JtYXRbMF0sIEFNRURJQUZPUk1BVF9LRVlfTUlNRSwgJm1pbWVbMF0pOworICAgIEFNZWRpYUZvcm1hdF9nZXRTdHJpbmcoZXh0cmFjdG9yRm9ybWF0WzFdLCBBTUVESUFGT1JNQVRfS0VZX01JTUUsICZtaW1lWzFdKTsKKyAgICBBU1NFUlRfU1RSRVEobWltZVswXSwgbWltZVsxXSkgPDwgIk1pc21hdGNoIGJldHdlZW4gZXh0cmFjdG9yJ3MgZm9ybWF0IjsKKworICAgIGlmICghc3RybmNtcChtaW1lWzBdLCAiYXVkaW8vIiwgNikpIHsKKyAgICAgICAgaW50MzJfdCBjaGFubmVsQ291bnQwLCBjaGFubmVsQ291bnQxOworICAgICAgICBpbnQzMl90IHNhbXBsZVJhdGUwLCBzYW1wbGVSYXRlMTsKKyAgICAgICAgQVNTRVJUX1RSVUUoQU1lZGlhRm9ybWF0X2dldEludDMyKGV4dHJhY3RvckZvcm1hdFswXSwgQU1FRElBRk9STUFUX0tFWV9DSEFOTkVMX0NPVU5ULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmNoYW5uZWxDb3VudDApKTsKKyAgICAgICAgQVNTRVJUX1RSVUUoQU1lZGlhRm9ybWF0X2dldEludDMyKGV4dHJhY3RvckZvcm1hdFswXSwgQU1FRElBRk9STUFUX0tFWV9TQU1QTEVfUkFURSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzYW1wbGVSYXRlMCkpOworICAgICAgICBBU1NFUlRfVFJVRShBTWVkaWFGb3JtYXRfZ2V0SW50MzIoZXh0cmFjdG9yRm9ybWF0WzFdLCBBTUVESUFGT1JNQVRfS0VZX0NIQU5ORUxfQ09VTlQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmY2hhbm5lbENvdW50MSkpOworICAgICAgICBBU1NFUlRfVFJVRShBTWVkaWFGb3JtYXRfZ2V0SW50MzIoZXh0cmFjdG9yRm9ybWF0WzFdLCBBTUVESUFGT1JNQVRfS0VZX1NBTVBMRV9SQVRFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNhbXBsZVJhdGUxKSk7CisgICAgICAgIEFTU0VSVF9FUShjaGFubmVsQ291bnQwLCBjaGFubmVsQ291bnQxKSA8PCAiTWlzbWF0Y2ggYmV0d2VlbiBleHRyYWN0b3IncyBjaGFubmVsQ291bnQiOworICAgICAgICBBU1NFUlRfRVEoc2FtcGxlUmF0ZTAsIHNhbXBsZVJhdGUxKSA8PCAiTWlzbWF0Y2ggYmV0d2VlbiBleHRyYWN0b3IncyBzYW1wbGVSYXRlIjsKKyAgICB9IGVsc2UgaWYgKCFzdHJuY21wKG1pbWVbMF0sICJ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1fdnA5XzMzM2ticHNfMjVmcHMud2VibSIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoInZpZGVvXzEyODB4NzIwX2F2MV9oZHJfc3RhdGljXzNtYnBzLm1wNCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmlkZW9fMTI4MHg3MjBfYXYxX2hkcl9zdGF0aWNfM21icHMud2VibSIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoInN3aXJsXzEzMngxMzBfbXBlZzQuM2dwIiwgInN3aXJsXzEzMngxMzBfbXBlZzQubWt2IiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigic3dpcmxfMTQ0eDEzNl9hdmMubWt2IiwgInN3aXJsXzE0NHgxMzZfYXZjLm1wNCIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoInN3aXJsXzEzMngxMzBfbXBlZzQubXA0IiwgInN3aXJsXzEzMngxMzBfbXBlZzQubWt2IiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiY3Jvd2RfNTA4eDI0MF8yNWZwc19oZXZjLm1wNCIsImNyb3dkXzUwOHgyNDBfMjVmcHNfaGV2Yy5ta3YiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfY2lmXzc2OGticHNfMzBmcHNfbXBlZzIubXA0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJiYmJfY2lmXzc2OGticHNfMzBmcHNfbXBlZzIudHMiKSwKKworICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImxvdWRzb2Z0YWFjLmFhYyIsICJsb3Vkc29mdGFhYy5ta3YiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJzaW5lc3dlZXBmbGFjbWt2Lm1rdiIsICJzaW5lc3dlZXBmbGFjbXA0Lm1wNCIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoInNpbmVzd2VlcG1wM2xhbWUubXAzIiwgInNpbmVzd2VlcG1wM2xhbWUubWt2IiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigic2luZXN3ZWVwb2dnbXA0Lm1wNCIsICJzaW5lc3dlZXBvZ2cub2dnIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigic2luZXN3ZWVwdm9yYmlzLm1wNCIsICJzaW5lc3dlZXB2b3JiaXMub2dnIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigic2luZXN3ZWVwdm9yYmlzLm1rdiIsICJzaW5lc3dlZXB2b3JiaXMub2dnIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigidGVzdG9wdXMubWt2IiwgInRlc3RvcHVzLm1wNCIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoInRlc3RvcHVzLm1wNCIsICJ0ZXN0b3B1cy5vcHVzIiksCisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJsb3Vkc29mdGFhYy5hYWMiLCAibG91ZHNvZnRhYWMuYWFjIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigidGVzdGFtci5hbXIiLCAidGVzdGFtci5hbXIiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJzaW5lc3dlZXBmbGFjLmZsYWMiLCAic2luZXN3ZWVwZmxhYy5mbGFjIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigibWlkaV9hLm1pZCIsICJtaWRpX2EubWlkIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigic2luZXN3ZWVwdm9yYmlzLm1rdiIsICJzaW5lc3dlZXB2b3JiaXMubWt2IiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigic2luZXN3ZWVwbXAzbGFtZS5tcDMiLCAic2luZXN3ZWVwbXAzbGFtZS5tcDMiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJzaW5lc3dlZXBvZ2dtcDQubXA0IiwgInNpbmVzd2VlcG9nZ21wNC5tcDQiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJ0ZXN0b3B1cy5vcHVzIiwgInRlc3RvcHVzLm9wdXMiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJqb2huX2NhZ2Uub2dnIiwgImpvaG5fY2FnZS5vZ2ciKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJtb25vdGVzdGdzbS53YXYiLCAibW9ub3Rlc3Rnc20ud2F2IiksCisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJzd2lybF8xNDR4MTM2X21wZWcyLm1wZyIsICJzd2lybF8xNDR4MTM2X21wZWcyLm1wZyIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoInN3aXJsXzEzMngxMzBfbXBlZzQubXA0IiwgInN3aXJsXzEzMngxMzBfbXBlZzQubXA0IiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigic3dpcmxfMTQ0eDEzNl92cDkud2VibSIsICJzd2lybF8xNDR4MTM2X3ZwOS53ZWJtIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigic3dpcmxfMTQ0eDEzNl92cDgud2VibSIsICJzd2lybF8xNDR4MTM2X3ZwOC53ZWJtIikpKTsKKworSU5TVEFOVElBVEVfVEVTVF9TVUlURV9QKENvbmZpZ1BhcmFtVGVzdEFsbCwgQ29uZmlnUGFyYW1UZXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgIDo6dGVzdGluZzo6VmFsdWVzKG1ha2VfcGFpcigiYWFjIiwgQUFDXzEpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYW1yIiwgQU1SX05CXzEpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYW1yIiwgQU1SX1dCXzEpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiZmxhYyIsIEZMQUNfMSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJ3YXYiLCBHU01fMSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJtaWRpIiwgTUlESV8xKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIm1wMyIsIE1QM18xKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIm9nZyIsIE9QVVNfMSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJvZ2ciLCBWT1JCSVNfMSksCisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIm1wZWc0IiwgSEVWQ18xKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIm1wZWc0IiwgSEVWQ18yKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIm1wZWcycHMiLCBNUEVHMl9QU18xKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIm1wZWcydHMiLCBNUEVHMl9UU18xKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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lKSwKKyAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJtcGVnNCIsICJ0ZXN0dmlkZW9fd2l0aF8yX3RpbWVkdGV4dF90cmFja3MuM2dwIiwgNCwgdHJ1ZSksCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgibXBlZzQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgInZpZGVvXzE3NngxNDRfM2dwX2gyNjNfMzAwa2Jwc18yNWZwc19hYWNfc3RlcmVvXzEyOGticHNfMTEwMjVoel8iCisgICAgICAgICAgICAgICAgICAgICAgICAgICAibWV0YWRhdGFfZ3lyb19jb21wbGlhbnQuM2dwIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsIHRydWUpLAorICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoCisgICAgICAgICAgICAgICAgICAgICAgICAibXBlZzQiLAorICAgICAgICAgICAgICAgICAgICAgICAgInZpZGVvXzE5MjB4MTA4MF9tcDRfbXBlZzJfMTIwMDBrYnBzXzMwZnBzX2FhY19zdGVyZW9fMTI4a2Jwc180ODAwMGh6Lm1wNCIsCisgICAgICAgICAgICAgICAgICAgICAgICAyLCB0cnVlKSwKKyAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJtcGVnNCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAidmlkZW9fNDgweDM2MF9tcDRfaGV2Y182NTBrYnBzXzMwZnBzX2FhY19zdGVyZW9fMTI4a2Jwc180ODAwMGh6Lm1wNCIsIDIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVlKSwKKyAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKAorICAgICAgICAgICAgICAgICAgICAgICAgIm1wZWc0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICJ2aWRlb180ODB4MzYwX21wNF9oMjY0XzEzNTBrYnBzXzMwZnBzX2FhY19zdGVyZW9fMTI4a2Jwc180NDEwMGh6X2Rhc2gubXA0IiwKKyAgICAgICAgICAgICAgICAgIC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gSU1NVU5FX0ZSQU1FX0NPVU5UOwotICAgICAgICAgICAgICAgICAgICBtSW5wdXRQaGFzZSA9IDAuMDsgLy8gcHJldmVudCBzcGlrZSBhdCBzdGFydAotICAgICAgICAgICAgICAgICAgICBtT3V0cHV0UGhhc2UgPSAwLjA7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIFNUQVRFX0lNTVVORToKLSAgICAgICAgICAgICAgICBtRG93bkNvdW50ZXItLTsKLSAgICAgICAgICAgICAgICBpZiAobURvd25Db3VudGVyIDw9IDApIHsKLSAgICAgICAgICAgICAgICAgICAgbVN0YXRlID0gU1RBVEVfV0FJVElOR19GT1JfU0lHTkFMOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBTVEFURV9XQUlUSU5HX0ZPUl9TSUdOQUw6Ci0gICAgICAgICAgICAgICAgaWYgKHBlYWsgPiBtVGhyZXNob2xkKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1TdGF0ZSA9IFNUQVRFX1dBSVRJTkdfRk9SX0xPQ0s7Ci0gICAgICAgICAgICAgICAgICAgIC8vQUxPR0QoIiU1ZDogc3dpdGNoIHRvIFNUQVRFX1dBSVRJTkdfRk9SX0xPQ0siLCBtRnJhbWVDb3VudGVyKTsKLSAgICAgICAgICAgICAgICAgICAgcmVzZXRBY2N1bXVsYXRvcigpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBTVEFURV9XQUlUSU5HX0ZPUl9MT0NLOgotICAgICAgICAgICAgICAgIG1TaW5BY2N1bXVsYXRvciArPSBzYW1wbGUgKiBzaW5mKG1JbnB1dFBoYXNlKTsKLSAgICAgICAgICAgICAgICBtQ29zQWNjdW11bGF0b3IgKz0gc2FtcGxlICogY29zZihtSW5wdXRQaGFzZSk7Ci0gICAgICAgICAgICAgICAgbUZyYW1lc0FjY3VtdWxhdGVkKys7Ci0gICAgICAgICAgICAgICAgLy8gTXVzdCBiZSBhIG11bHRpcGxlIG9mIHRoZSBwZXJpb2Qgb3IgdGhlIGNhbGN1bGF0aW9uIHdpbGwgbm90IGJlIGFjY3VyYXRlLgotICAgICAgICAgICAgICAgIGlmIChtRnJhbWVzQWNjdW11bGF0ZWQgPT0gbVNpbmVQZXJpb2QgKiBQRVJJT0RTX05FRURFRF9GT1JfTE9DSykgewotICAgICAgICAgICAgICAgICAgICBkb3VibGUgcGhhc2VPZmZzZXQgPSAwLjA7Ci0gICAgICAgICAgICAgICAgICAgIHNldE1hZ25pdHVkZShjYWxjdWxhdGVNYWduaXR1ZGUoJnBoYXNlT2Zmc2V0KSk7Ci0vLyAgICAgICAgICAgICAgICAgICAgQUxPR0QoIiVzKCkgbWFnID0gJWYsIG9mZnNldCA9ICVmLCBwcmV2ID0gJWYiLAotLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sIG1NYWduaXR1ZGUsIG1QaGFzZU9mZnNldCwgbVByZXZpb3VzUGhhc2VPZmZzZXQpOwotICAgICAgICAgICAgICAgICAgICBpZiAobU1hZ25pdHVkZSA+IG1UaHJlc2hvbGQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhYnMocGhhc2VPZmZzZXQpIDwga01heFBoYXNlRXJyb3IpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU3RhdGUgPSBTVEFURV9MT0NLRUQ7Ci0vLyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HRCgiJTVkOiBzd2l0Y2ggdG8gU1RBVEVfTE9DS0VEIiwgbUZyYW1lQ291bnRlcik7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBBZGp1c3QgbUlucHV0UGhhc2UgdG8gbWF0Y2ggbWVhc3VyZWQgcGhhc2UKLSAgICAgICAgICAgICAgICAgICAgICAgIG1JbnB1dFBoYXNlICs9IHBoYXNlT2Zmc2V0OwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHJlc2V0QWNjdW11bGF0b3IoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaW5jcmVtZW50SW5wdXRQaGFzZSgpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIFNUQVRFX0xPQ0tFRDogewotICAgICAgICAgICAgICAgIC8vIFByZWRpY3QgbmV4dCBzaW5lIHZhbHVlCi0gICAgICAgICAgICAgICAgZG91YmxlIHByZWRpY3RlZCA9IHNpbmYobUlucHV0UGhhc2UpICogbU1hZ25pdHVkZTsKLSAgICAgICAgICAgICAgICBkb3VibGUgZGlmZiA9IHByZWRpY3RlZCAtIHNhbXBsZTsKLSAgICAgICAgICAgICAgICBkb3VibGUgYWJzRGlmZiA9IGZhYnMoZGlmZik7Ci0gICAgICAgICAgICAgICAgbU1heEdsaXRjaERlbHRhID0gc3RkOjptYXgobU1heEdsaXRjaERlbHRhLCBhYnNEaWZmKTsKLSAgICAgICAgICAgICAgICBpZiAoYWJzRGlmZiA+IG1TY2FsZWRUb2xlcmFuY2UpIHsKLSAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gRVJST1JfR0xJVENIRVM7Ci0gICAgICAgICAgICAgICAgICAgIG9uR2xpdGNoU3RhcnQoKTsKLS8vICAgICAgICAgICAgICAgICAgICBMT0dJKCJkaWZmIGdsaXRjaCBkZXRlY3RlZCwgYWJzRGlmZiA9ICVnIiwgYWJzRGlmZik7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbVN1bVNxdWFyZVNpZ25hbCArPSBwcmVkaWN0ZWQgKiBwcmVkaWN0ZWQ7Ci0gICAgICAgICAgICAgICAgICAgIG1TdW1TcXVhcmVOb2lzZSArPSBkaWZmICogZGlmZjsKLSAgICAgICAgICAgICAgICAgICAgLy8gVHJhY2sgaW5jb21pbmcgc2lnbmFsIGFuZCBzbG93bHkgYWRqdXN0IG1hZ25pdHVkZSB0byBhY2NvdW50Ci0gICAgICAgICAgICAgICAgICAgIC8vIGZvciBkcmlmdCBpbiB0aGUgRFJDIG9yIEFHQy4KLSAgICAgICAgICAgICAgICAgICAgbVNpbkFjY3VtdWxhdG9yICs9IHNhbXBsZSAqIHNpbmYobUlucHV0UGhhc2UpOwotICAgICAgICAgICAgICAgICAgICBtQ29zQWNjdW11bGF0b3IgKz0gc2FtcGxlICogY29zZihtSW5wdXRQaGFzZSk7Ci0gICAgICAgICAgICAgICAgICAgIG1GcmFtZXNBY2N1bXVsYXRlZCsrOwotICAgICAgICAgICAgICAgICAgICAvLyBNdXN0IGJlIGEgbXVsdGlwbGUgb2YgdGhlIHBlcmlvZCBvciB0aGUgY2FsY3VsYXRpb24gd2lsbCBub3QgYmUgYWNjdXJhdGUuCi0gICAgICAgICAgICAgICAgICAgIGlmIChtRnJhbWVzQWNjdW11bGF0ZWQgPT0gbVNpbmVQZXJpb2QpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGRvdWJsZSBjb2VmZmljaWVudCA9IDAuMTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGRvdWJsZSBwaGFzZU9mZnNldCA9IDAuMDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGRvdWJsZSBtYWduaXR1ZGUgPSBjYWxjdWxhdGVNYWduaXR1ZGUoJnBoYXNlT2Zmc2V0KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIE9uZSBwb2xlIGF2ZXJhZ2luZyBmaWx0ZXIuCi0gICAgICAgICAgICAgICAgICAgICAgICBzZXRNYWduaXR1ZGUoKG1NYWduaXR1ZGUgKiAoMS4wIC0gY29lZmZpY2llbnQpKSArIChtYWduaXR1ZGUgKiBjb2VmZmljaWVudCkpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICBtTWVhblNxdWFyZU5vaXNlID0gbVN1bVNxdWFyZU5vaXNlICogbUludmVyc2VTaW5lUGVyaW9kOwotICAgICAgICAgICAgICAgICAgICAgICAgbU1lYW5TcXVhcmVTaWduYWwgPSBtU3VtU3F1YXJlU2lnbmFsICogbUludmVyc2VTaW5lUGVyaW9kOwotICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXRBY2N1bXVsYXRvcigpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYWJzKHBoYXNlT2Zmc2V0KSA+IGtNYXhQaGFzZUVycm9yKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gRVJST1JfR0xJVENIRVM7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgb25HbGl0Y2hTdGFydCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dEKCJwaGFzZSBnbGl0Y2ggZGV0ZWN0ZWQsIHBoYXNlT2Zmc2V0ID0gJWciLCBwaGFzZU9mZnNldCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1NYWduaXR1ZGUgPCBtVGhyZXNob2xkKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gRVJST1JfR0xJVENIRVM7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgb25HbGl0Y2hTdGFydCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dEKCJtYWduaXR1ZGUgZ2xpdGNoIGRldGVjdGVkLCBtTWFnbml0dWRlID0gJWciLCBtTWFnbml0dWRlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpbmNyZW1lbnRJbnB1dFBoYXNlKCk7Ci0gICAgICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIFNUQVRFX0dMSVRDSElORzogewotICAgICAgICAgICAgICAgIC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AgICAgICByZWxvY2soKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpbmNyZW1lbnRJbnB1dFBoYXNlKCk7Ci0gICAgICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIE5VTV9TVEFURVM6IC8vIG5vdCBhIHJlYWwgc3RhdGUKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotCi0gICAgICAgIG1GcmFtZUNvdW50ZXIrKzsKLQotICAgICAgICByZXR1cm4gcmVzdWx0OwotICAgIH0KLQotICAgIC8vIGFkdmFuY2UgYW5kIHdyYXAgcGhhc2UKLSAgICB2b2lkIGluY3JlbWVudElucHV0UGhhc2UoKSB7Ci0gICAgICAgIG1JbnB1dFBoYXNlICs9IG1QaGFzZUluY3JlbWVudDsKLSAgICAgICAgaWYgKG1JbnB1dFBoYXNlID4gTV9QSSkgewotICAgICAgICAgICAgbUlucHV0UGhhc2UgLT0gKDIuMCAqIE1fUEkpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLy8gYWR2YW5jZSBhbmQgd3JhcCBwaGFzZQotICAgIHZvaWQgaW5jcmVtZW50T3V0cHV0UGhhc2UoKSB7Ci0gICAgICAgIG1PdXRwdXRQaGFzZSArPSBtUGhhc2VJbmNyZW1lbnQ7Ci0gICAgICAgIGlmIChtT3V0cHV0UGhhc2UgPiBNX1BJKSB7Ci0gICAgICAgICAgICBtT3V0cHV0UGhhc2UgLT0gKDIuMCAqIE1fUEkpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogQHBhcmFtIGZyYW1lRGF0YSB1cG9uIHJldHVybiwgY29udGFpbnMgdGhlIHJlZmVyZW5jZSBzaW5lIHdhdmUKLSAgICAgKiBAcGFyYW0gY2hhbm5lbENvdW50Ci0gICAgICovCi0gICAgcmVzdWx0X2NvZGUgcHJvY2Vzc091dHB1dEZyYW1lKGZsb2F0ICpmcmFtZURh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JyZWxhdGlvbnM7IGkrKykgewotICAgICAgICBmbG9hdCB2YWx1ZSA9IGFicyhjb3JyZWxhdGlvbnNbaV0pOwotICAgICAgICBpZiAodmFsdWUgPiBwZWFrQ29ycmVsYXRpb24pIHsKLSAgICAgICAgICAgIHBlYWtDb3JyZWxhdGlvbiA9IHZhbHVlOwotICAgICAgICAgICAgcGVha0luZGV4ID0gaTsKLSAgICAgICAgfQotICAgIH0KLSAgICBpZiAocGVha0luZGV4IDwgMCkgewotICAgICAgICBBTE9HRSgiJXMoKSBubyBzaWduYWwgZm9yIGNvcnJlbGF0aW9uXG4iLCBfX2Z1bmNfXyk7Ci0gICAgICAgIHJldHVybiAtMjsKLSAgICB9Ci0KLSAgICByZXBvcnQtPmxhdGVuY3lJbkZyYW1lcyA9IHBlYWtJbmRleDsKLSAgICByZXBvcnQtPmNvbmZpZGVuY2UgPSBwZWFrQ29ycmVsYXRpb247Ci0KLSAgICByZXR1cm4gMDsKLX0KLQotLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci1jbGFzcyBMb29wYmFja1Byb2Nlc3NvciB7Ci1wdWJsaWM6Ci0gICAgdmlydHVhbCB+TG9vcGJhY2tQcm9jZXNzb3IoKSA9IGRlZmF1bHQ7Ci0KLSAgICBlbnVtIHJlc3VsdF9jb2RlIHsKLSAgICAgICAgUkVTVUxUX09LID0gMCwKLSAgICAgICAgRVJST1JfTk9JU1kgPSAtOTksCi0gICAgICAgIEVSUk9SX1ZPTFVNRV9UT09fTE9XLAotICAgICAgICBFUlJPUl9WT0xVTUVfVE9PX0hJR0gsCi0gICAgICAgIEVSUk9SX0NPTkZJREVOQ0UsCi0gICAgICAgIEVSUk9SX0lOVkFMSURfU1RBVEUsCi0gICAgICAgIEVSUk9SX0dMSVRDSEVTLAotICAgICAgICBFUlJPUl9OT19MT0NLCi0gICAgfTsKLQotICAgIHZpcnR1YWwgdm9pZCBwcmVwYXJlVG9UZXN0KCkgewotICAgICAgICByZXNldCgpOwotICAgIH0KLQotICAgIHZpcnR1YWwgdm9pZCByZXNldCgpIHsKLSAgICAgICAgbVJlc3VsdCA9IDA7Ci0gICAgICAgIG1SZXNldENvdW50Kys7Ci0gICAgfQotCi0gICAgdmlydHVhbCByZXN1bHRfY29kZSBwcm9jZXNzSW5wdXRGcmFtZShmbG9hdCAqZnJhbWVEYXRhLCBpbnQgY2hhbm5lbENvdW50KSA9IDA7Ci0gICAgdmlydHVhbCByZXN1bHRfY29kZSBwcm9jZXNzT3V0cHV0RnJhbWUoZmxvYXQgKmZyYW1lRGF0YSwgaW50IGNoYW5uZWxDb3VudCkgPSAwOwotCi0gICAgdm9pZCBwcm9jZXNzKGZsb2F0ICppbnB1dERhdGEsIGludCBpbnB1dENoYW5uZWxDb3VudCwgaW50IG51bUlucHV0RnJhbWVzLAotICAgICAgICAgICAgICAgICBmbG9hdCAqb3V0cHV0RGF0YSwgaW50IG91dHB1dENoYW5uZWxDb3VudCwgaW50IG51bU91dHB1dEZyYW1lcykgewotICAgICAgICBpbnQgbnVtQm90aCA9IHN0ZDo6bWluKG51bUlucHV0RnJhbWVzLCBudW1PdXRwdXRGcmFtZXMpOwotICAgICAgICAvLyBQcm9jZXNzIG9uZSBmcmFtZSBhdCBhIHRpbWUuCi0gICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtQm90aDsgaSsrKSB7Ci0gICAgICAgICAgICBwcm9jZXNzSW5wdXRGcmFtZShpbnB1dERhdGEsIGlucHV0Q2hhbm5lbENvdW50KTsKLSAgICAgICAgICAgIGlucHV0RGF0YSArPSBpbnB1dENoYW5uZWxDb3VudDsKLSAgICAgICAgICAgIHByb2Nlc3NPdXRwdXRGcmFtZShvdXRwdXREYXRhLCBvdXRwdXRDaGFubmVsQ291bnQpOwotICAgICAgICAgICAgb3V0cHV0RGF0YSArPSBvdXRwdXRDaGFubmVsQ291bnQ7Ci0gICA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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZtTGF0ZW5jeVJlcG9ydCk7Ci0KLSAgICAgICAgICAgIGlmIChtTGF0ZW5jeVJlcG9ydC5jb25maWRlbmNlIDwga01pbmltdW1Db25maWRlbmNlKSB7Ci0gICAgICAgICAgICAgICAgcmVwb3J0IDw8ICIgICBFUlJPUiAtIGNvbmZpZGVuY2UgdG9vIGxvdyEiOwotICAgICAgICAgICAgICAgIG5ld1Jlc3VsdCA9IEVSUk9SX0NPTkZJREVOQ0U7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1TaWduYWxSTVMgPSBjYWxjdWxhdGVSb290TWVhblNxdWFyZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICZtQXVkaW9SZWNvcmRpbmcuZ2V0RGF0YSgpW21MYXRlbmN5UmVwb3J0LmxhdGVuY3lJbkZyYW1lc10sIG1QdWxzZS5zaXplKCkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gZ2FpbjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGRvdWJsZSBsYXRlbmN5TWlsbGlzID0ga01pbGxpc1BlclNlY29uZCAqIChkb3VibGUpIG1MYXRlbmN5UmVwb3J0LmxhdGVuY3lJbkZyYW1lcwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvIGdldFNhbXBsZVJhdGUoKTsKLSAgICAgICAgICAgIHJlcG9ydCA8PCBMT09QQkFDS19SRVNVTFRfVEFHICJsYXRlbmN5LmZyYW1lcyAgICAgICAgID0gIiA8PCBzdGQ6OnNldHcoOCkKLSAgICAgICAgICAgICAgICAgICA8PCBtTGF0ZW5jeVJlcG9ydC5sYXRlbmN5SW5GcmFtZXMgPDwgIlxuIjsKLSAgICAgICAgICAgIHJlcG9ydCA8PCBMT09QQkFDS19SRVNVTFRfVEFHICJsYXRlbmN5Lm1zZWMgICAgICAgICAgID0gIiA8PCBzdGQ6OnNldHcoOCkKLSAgIC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RGcmFtZShmbG9hdCAqZnJhbWVEYXRhLCBpbnQgY2hhbm5lbENvdW50KSBvdmVycmlkZSB7Ci0gICAgICAgIGVjaG9fc3RhdGUgbmV4dFN0YXRlID0gbVN0YXRlOwotICAgICAgICBtTG9vcENvdW50ZXIrKzsKLQotICAgICAgICBzd2l0Y2ggKG1TdGF0ZSkgewotICAgICAgICAgICAgY2FzZSBTVEFURV9NRUFTVVJFX0JBQ0tHUk9VTkQ6Ci0gICAgICAgICAgICAgICAgLy8gTWVhc3VyZSBiYWNrZ3JvdW5kIFJNUyBvbiBjaGFubmVsIDAKLSAgICAgICAgICAgICAgICBtQmFja2dyb3VuZFN1bVNxdWFyZSArPSBmcmFtZURhdGFbMF0gKiBmcmFtZURhdGFbMF07Ci0gICAgICAgICAgICAgICAgbUJhY2tncm91bmRTdW1Db3VudCsrOwotICAgICAgICAgICAgICAgIG1Eb3duQ291bnRlci0tOwotICAgICAgICAgICAgICAgIGlmIChtRG93bkNvdW50ZXIgPD0gMCkgewotICAgICAgICAgICAgICAgICAgICBtQmFja2dyb3VuZFJNUyA9IHNxcnRmKG1CYWNrZ3JvdW5kU3VtU3F1YXJlIC8gbUJhY2tncm91bmRTdW1Db3VudCk7Ci0gICAgICAgICAgICAgICAgICAgIG5leHRTdGF0ZSA9IFNUQVRFX0lOX1BVTFNFOwotICAgICAgICAgICAgICAgICAgICBtUHVsc2VDdXJzb3IgPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBTVEFURV9JTl9QVUxTRToKLSAgICAgICAgICAgICAgICAvLyBSZWNvcmQgaW5wdXQgdW50aWwgdGhlIG1BdWRpb1JlY29yZGluZyBpcyBmdWxsLgotICAgICAgICAgICAgICAgIG1BdWRpb1JlY29yZGluZy53cml0ZShmcmFtZURhdGEsIGNoYW5uZWxDb3VudCwgMSk7Ci0gICAgICAgICAgICAgICAgaWYgKGhhc0Vub3VnaERhdGEoKSkgewotICAgICAgICAgICAgICAgICAgICBuZXh0U3RhdGUgPSBTVEFURV9HT1RfREFUQTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgU1RBVEVfR09UX0RBVEE6Ci0gICAgICAgICAgICBjYXNlIFNUQVRFX0RPTkU6Ci0gICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0KLSAgICAgICAgbVN0YXRlID0gbmV4dFN0YXRlOwotICAgICAgICByZXR1cm4gUkVTVUxUX09LOwotICAgIH0KLQotICAgIHJlc3VsdF9jb2RlIHByb2Nlc3NPdXRwdXRGcmFtZShmbG9hdCAqZnJhbWVEYXRhLCBpbnQgY2hhbm5lbENvdW50KSBvdmVycmlkZSB7Ci0gICAgICAgIHN3aXRjaCAobVN0YXRlKSB7Ci0gICAgICAgICAgICBjYXNlIFNUQVRFX0lOX1BVTFNFOgotICAgICAgICAgICAgICAgIGlmIChtUHVsc2VDdXJzb3IgPCBtUHVsc2Uuc2l6ZSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZsb2F0IHB1bHNlU2FtcGxlID0gbVB1bHNlLmdldERhdGEoKVttUHVsc2VDdXJzb3IrK107Ci0gICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY2hhbm5lbENvdW50OyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lRGF0YVtpXSA9IHB1bHNlU2FtcGxlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjaGFubmVsQ291bnQ7IGkrKykgewotICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWVEYXRhW2ldID0gMDsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBTVEFURV9NRUFTVVJFX0JBQ0tHUk9VTkQ6Ci0gICAgICAgICAgICBjYXNlIFNUQVRFX0dPVF9EQVRBOgotICAgICAgICAgICAgY2FzZSBTVEFURV9ET05FOgotICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNoYW5uZWxDb3VudDsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZyYW1lRGF0YVtpXSA9IDAuMGY7IC8vIHNpbGVuY2UKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gUkVTVUxUX09LOwotICAgIH0KLQotcHJpdmF0ZToKLQotICAgIGVudW0gZWNob19zdGF0ZSB7Ci0gICAgICAgIFNUQVRFX01FQVNVUkVfQkFDS0dST1VORCwKLSAgICAgICAgU1RBVEVfSU5fUFVMU0UsCi0gICAgICAgIFNUQVRFX0dPVF9EQVRBLCAvLyBtdXN0IG1hdGNoIFJvdW5kVHJpcExhdGVuY3lBY3Rpdml0eS5qYXZhCi0gICAgICAgIFNUQVRFX0RPTkUsCi0gICAgfTsKLQotICAgIGNvbnN0IGNoYXIgKmNvbnZlcnRTdGF0ZVRvVGV4dChlY2hvX3N0YXRlIHN0YXRlKSB7Ci0gICAgICAgIHN3aXRjaCAoc3RhdGUpIHsKLSAgICAgICAgICAgIGNhc2UgU1RBVEVfTUVBU1VSRV9CQUNLR1JPVU5EOgotICAgICAgICAgICAgICAgIHJldHVybiAiSU5JVCI7Ci0gICAgICAgICAgICBjYXNlIFNUQVRFX0lOX1BVTFNFOgotICAgICAgICAgICAgICAgIHJldHVybiAiUFVMU0UiOwotICAgICAgICAgICAgY2FzZSBTVEFURV9HT1RfREFUQToKLSAgICAgICAgICAgICAgICByZXR1cm4gIkdPVF9EQVRBIjsKLSAgICAgICAg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phdWRpb0J1ZmZlciA9IChpbnQxNl90ICopIGF1ZGlvRGF0YTsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtQWN0aXZlT3NjaWxhdG9yczsgKytpKSB7Ci0gICAgICAgICAgICAgICAgc2luZURhdGEtPnNpbmVPc2NpbGxhdG9yc1tpXS5yZW5kZXIoJmF1ZGlvQnVmZmVyW2ldLCBzYW1wbGVzUGVyRnJhbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtRnJhbWVzKTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtQWN0aXZlT3NjaWxsYXRvcnM7ICsraSkgeworICAgICAgICAgICAgICAgIHNpbmVEYXRhLT5zaW5lT3NjaWxsYXRvcnNbaV0ucmVuZGVyKCZhdWRpb0J1ZmZlcltpXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGVzUGVyRnJhbWUsIG51bUZyYW1lcyk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICBjYXNlIEFBVURJT19GT1JNQVRfUENNX0ZMT0FUOiB7CiAgICAgICAgICAgICBmbG9hdCAqYXVkaW9CdWZmZXIgPSAoZmxvYXQgKikgYXVkaW9EYXRhOwotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1BY3RpdmVPc2NpbGF0b3JzOyArK2kpIHsKLSAgICAgICAgICAgICAgICBzaW5lRGF0YS0+c2luZU9zY2lsbGF0b3JzW2ldLnJlbmRlcigmYXVkaW9CdWZmZXJbaV0sIHNhbXBsZXNQZXJGcmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudW1GcmFtZXMpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1BY3RpdmVPc2NpbGxhdG9yczsgKytpKSB7CisgICAgICAgICAgICAgICAgc2luZURhdGEtPnNpbmVPc2NpbGxhdG9yc1tpXS5yZW5kZXIoJmF1ZGlvQnVmZmVyW2ldLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsZXNQZXJGcmFtZSwgbnVtRnJhbWVzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQUFVRElPX0ZPUk1BVF9QQ01fSTI0X1BBQ0tFRDogeworICAgICAgICAgICAgdWludDhfdCAqYXVkaW9CdWZmZXIgPSAodWludDhfdCAqKSBhdWRpb0RhdGE7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUFjdGl2ZU9zY2lsbGF0b3JzOyArK2kpIHsKKyAgICAgICAgICAgICAgICBzdGF0aWMgY29uc3QgaW50IGJ5dGVzUGVyU2FtcGxlID0gZ2V0Qnl0ZXNQZXJTYW1wbGUoQUFVRElPX0ZPUk1BVF9QQ01fSTI0X1BBQ0tFRCk7CisgICAgICAgICAgICAgICAgc2luZURhdGEtPnNpbmVPc2NpbGxhdG9yc1tpXS5yZW5kZXIyNCgmYXVkaW9CdWZmZXJbaSAqIGJ5dGVzUGVyU2FtcGxlXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsZXNQZXJGcmFtZSwgbnVtRnJhbWVzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQUFVRElPX0ZPUk1BVF9QQ01fSTMyOiB7CisgICAgICAgICAgICBpbnQzMl90ICphdWRpb0J1ZmZlciA9IChpbnQzMl90ICopIGF1ZGlvRGF0YTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtQWN0aXZlT3NjaWxsYXRvc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kgKiBtQW1wbGl0dWRlKTsKKyAgICAgICAgICAgIGJ1ZmZlcltzYW1wbGVJbmRleF0gPSAoaW50MTZfdCkgKElOVDE2X01BWCAqIG5leHQoKSk7CiAgICAgICAgICAgICBzYW1wbGVJbmRleCArPSBjaGFubmVsU3RyaWRlOwotICAgICAgICAgICAgYWR2YW5jZVBoYXNlKCk7CiAgICAgICAgIH0KICAgICB9CisKICAgICB2b2lkIHJlbmRlcihmbG9hdCAqYnVmZmVyLCBpbnQzMl90IGNoYW5uZWxTdHJpZGUsIGludDMyX3QgbnVtRnJhbWVzKSB7CiAgICAgICAgIGludCBzYW1wbGVJbmRleCA9IDA7CiAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtRnJhbWVzOyBpKyspIHsKLSAgICAgICAgICAgIGJ1ZmZlcltzYW1wbGVJbmRleF0gPSBzaW4obVBoYXNlKSAqIG1BbXBsaXR1ZGU7CisgICAgICAgICAgICBidWZmZXJbc2FtcGxlSW5kZXhdID0gbmV4dCgpOwogICAgICAgICAgICAgc2FtcGxlSW5kZXggKz0gY2hhbm5lbFN0cmlkZTsKLSAgICAgICAgICAgIGFkdmFuY2VQaGFzZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCByZW5kZXIoaW50MzJfdCAqYnVmZmVyLCBpbnQzMl90IGNoYW5uZWxTdHJpZGUsIGludDMyX3QgbnVtRnJhbWVzKSB7CisgICAgICAgIGludCBzYW1wbGVJbmRleCA9IDA7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtRnJhbWVzOyBpKyspIHsKKyAgICAgICAgICAgIGJ1ZmZlcltzYW1wbGVJbmRleF0gPSAoaW50MzJfdCkgKElOVDMyX01BWCAqIG5leHQoKSk7CisgICAgICAgICAgICBzYW1wbGVJbmRleCArPSBjaGFubmVsU3RyaWRlOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCByZW5kZXIyNCh1aW50OF90ICpidWZmZXIsIGludDMyX3QgY2hhbm5lbFN0cmlkZSwgaW50MzJfdCBudW1GcmFtZXMpIHsKKyAgICAgICAgaW50IHNhbXBsZUluZGV4ID0gMDsKKyAgICAgICAgY29uc3RleHByIGludDMyX3QgSU5UMjRfTUFYID0gKDEgPDwgMjMpIC0gMTsKKyAgICAgICAgY29uc3RleHByIGludCBieXRlc1BlclNhbXBsZSA9IGdldEJ5dGVzUGVyU2FtcGxlKEFBVURJT19GT1JNQVRfUENNX0kyNF9QQUNLRUQpOworICAgICAgICBjb25zdCBib29sIGlzTGl0dGxlRW5kaWFuID0gaXNOYXRpdmVMaXR0bGVFbmRpYW4oKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1GcmFtZXM7IGkrKykgeworICAgICAgICAgICAgaW50MzJfdCBzYW1wbGUgPSAoaW50MzJfdCkgKElOVDI0X01BWCAqIG5leHQoKSk7CisgICAgICAgICAgICB1aW50MzJfdCB1c2FtcGxlID0gKHVpbnQzMl90KSBzYW1wbGU7CisgICAgICAgICAgICBpZiAoaXNMaXR0bGVFbmRpYW4pIHsKKyAgICAgICAgICAgICAgICBidWZmZXJbc2FtcGxlSW5kZXhdID0gdXNhbXBsZTsgLy8gbGl0dGxlIGVuZCBmaXJzdAorICAgICAgICAgICAgICAgIGJ1ZmZlcltzYW1wbGVJbmRleCArIDFdID0gdXNhbXBsZSA+PiA4OworICAgICAgICAgICAgICAgIGJ1ZmZlcltzYW1wbGVJbmRleCArIDJdID0gdXNhbXBsZSA+PiAxNjsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgYnVmZmVyW3NhbXBsZUluZGV4XSA9IHVzYW1wbGUgPj4gMTY7IC8vIGJpZyBlbmQgZmlyc3QKKyAgICAgICAgICAgICAgICBidWZmZXJbc2FtcGxlSW5kZXggKyAxXSA9IHVzYW1wbGUgPj4gODsKKyAgICAgICAgICAgICAgICBidWZmZXJbc2FtcGxlSW5kZXggKyAyXSA9IHVzYW1wbGU7CisgICAgICA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OTkVMUyA6IGFjdHVhbENoYW5uZWxDb3VudDsKICAgICB3aGlsZSAoZnJhbWVzTGVmdCA+IDApIHsKICAgICAgICAgLy8gUmVuZGVyIGFzIEZMT0FUIG9yIFBDTQotICAgICAgICBpZiAoYWN0dWFsRGF0YUZvcm1hdCA9PSBBQVVESU9fRk9STUFUX1BDTV9GTE9BVCkgewotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1BY3RpdmVPc2NpbGF0b3JzOyArK2kpIHsKLSAgICAgICAgICAgICAgICBteURhdGEuc2luZU9zY2lsbGF0b3JzW2ldLnJlbmRlcigmZmxvYXREYXRhW2ldLCBhY3R1YWxDaGFubmVsQ291bnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lc1BlcldyaXRlKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIGlmIChhY3R1YWxEYXRhRm9ybWF0ID09IEFBVURJT19GT1JNQVRfUENNX0kxNikgewotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1BY3RpdmVPc2NpbGF0b3JzOyArK2kpIHsKLSAgICAgICAgICAgICAgICBteURhdGEuc2luZU9zY2lsbGF0b3JzW2ldLnJlbmRlcigmc2hvcnREYXRhW2ldLCBhY3R1YWxDaGFubmVsQ291bnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lc1BlcldyaXRlKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgc3dpdGNoIChhY3R1YWxEYXRhRm9ybWF0KSB7CisgICAgICAgICAgICBjYXNlIEFBVURJT19GT1JNQVRfUENNX0ZMT0FUOgorICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtQWN0aXZlT3NjaWxsYXRvcnM7ICsraSkgeworICAgICAgICAgICAgICAgICAgICBteURhdGEuc2luZU9zY2lsbGF0b3JzW2ldLnJlbmRlcigmZmxvYXREYXRhW2ldLCBhY3R1YWxDaGFubmVsQ291bnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lc1BlcldyaXRlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFBVURJT19GT1JNQVRfUENNX0kxNjoKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUFjdGl2ZU9zY2lsbGF0b3JzOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgbXlEYXRhLnNpbmVPc2NpbGxhdG9yc1tpXS5yZW5kZXIoJnNob3J0RGF0YVtpXSwgYWN0dWFsQ2hhbm5lbENvdW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcmFtZXNQZXJXcml0ZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBQVVESU9fRk9STUFUX1BDTV9JMzI6CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1BY3RpdmVPc2NpbGxhdG9yczsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIG15RGF0YS5zaW5lT3NjaWxsYXRvcnNbaV0ucmVuZGVyKCZpbnQzMkRhdGFbaV0sIGFjdHVhbENoYW5uZWxDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWVzUGVyV3JpdGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQUFVRElPX0ZPUk1BVF9QQ01fSTI0X1BBQ0tFRDoKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUFjdGl2ZU9zY2lsbGF0b3JzOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgc3RhdGljIGNvbnN0IGludAorICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZXNQZXJTYW1wbGUgPSBnZXRCeXRlc1BlclNhbXBsZShBQVVESU9fRk9STUFUX1BDTV9JMjRfUEFDS0VEKTsKKyAgICAgICAgICAgICAgICAgICAgbXlEYXRhLnNpbmVPc2NpbGxhdG9yc1tpXS5yZW5kZXIyNCgmYnl0ZURhdGFbaSAqIGJ5dGVzUGVyU2FtcGxlXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3R1YWxDaGFubmVsQ291bnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWVzUGVyV3JpdGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogCiAgICAgICAgIC8vIFdyaXRlIGF1ZGlvIGRhdGEgdG8gdGhlIHN0cmVhbS4KICAgICAgICAgaW50NjRfdCB0aW1lb3V0TmFub3MgPSAxMDAwICogTkFOT1NfUEVSX01JTExJU0VDT05EOwogICAgICAgICBpbnQzMl90IG1pbkZyYW1lcyA9IChmcmFtZXNUb1BsYXkgPCBmcmFtZXNQZXJXcml0ZSkgPyBmcmFtZXNUb1BsYXkgOiBmcmFtZXNQZXJXcml0ZTsKICAgICAgICAgaW50MzJfdCBhY3R1YWwgPSAwOwotICAgICAgICBpZiAoYWN0dWFsRGF0YUZvcm1hdCA9PSBBQVVESU9fRk9STUFUX1BDTV9GTE9BVCkgewotICAgICAgICAgICAgYWN0dWFsID0gQUF1ZGlvU3RyZWFtX3dyaXRlKGFhdWRpb1N0cmVhbSwgZmxvYXREYXRhLCBtaW5GcmFtZXMsIHRpbWVvdXROYW5vcyk7Ci0gICAgICAgIH0gZWxzZSBpZiAoYWN0dWFsRGF0YUZvcm1hdCA9PSBBQVVESU9fRk9STUFUX1BDTV9JMTYpIHsKLSAgICAgICAgICAgIGFjdHVhbCA9IEFBdWRpb1N0cmVhbV93cml0ZShhYXVkaW9TdHJlYW0sIHNob3J0RGF0YSwgbWluRnJhbWVzLCB0aW1lb3V0TmFub3MpOworICAgICAgICBzd2l0Y2ggKGFjdHVhbERhdGFGb3JtYXQpIHsKKyAgICAgICAgICAgIGNhc2UgQUFVRElPX0ZPUk1BVF9QQ01fRkxPQVQ6CisgICAgICAgICAgICAgICAgYWN0dWFsID0gQUF1ZGlvU3RyZWFtX3dyaXRlKGFhdWRpb1N0cmVhbSwgZmxvYXREYXRhLCBtaW5GcmFtZXMsIHRpbWVvdXROYW5vcyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFBVURJT19GT1JNQVRfUENNX0kxNjoKKyAgICAgICAgICAgICAgICBhY3R1YWwgPSBBQXVkaW9TdHJlYW1fd3JpdGUoYWF1ZGlvU3RyZWFtLCBzaG9ydERhdGEsIG1pbkZyYW1lcywgdGltZW91dE5hbm9zKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQUFVRElPX0ZPUk1BVF9QQ01fSTMyOgorICAgICAgICAgICAgICAgIGFjdHVhbCA9IEFBdWRpb1N0cmVhbV93cml0ZShhYXVkaW9TdHJlYW0sIGludDMyRGF0YSwgbWluRnJhbWVzLCB0aW1lb3V0TmFub3MpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBQVVESU9fRk9STUFUX1BDTV9JMjRfUEFDS0VEOgorICAgICAgICAgICAgICAgIGFjdHVhbCA9IEFBdWRpb1N0cmVhbV93cml0ZShhYXVkaW9TdHJlYW0sIGJ5dGVEYXRhLCBtaW5GcmFtZXMsIHRpbWVvdXROYW5vcyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KICAgICAgICAgaWYgKGFjdHVhbCA8IDApIHsKICAgICAgICAgICAgIGZwcmludGY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Tk9XTiwKKworICAgIC8qKgorICAgICAqIFRoZSBzdHJlYW0gaXMgb3BlbiBhbmQgcmVhZHkgdG8gdXNlLgorICAgICAqLwogICAgIEFBVURJT19TVFJFQU1fU1RBVEVfT1BFTiwKKyAgICAvKioKKyAgICAgKiBUaGUgc3RyZWFtIGlzIGp1c3Qgc3RhcnRpbmcgdXAuCisgICAgICovCiAgICAgQUFVRElPX1NUUkVBTV9TVEFURV9TVEFSVElORywKKyAgICAvKioKKyAgICAgKiBUaGUgc3RyZWFtIGhhcyBzdGFydGVkLgorICAgICAqLwogICAgIEFBVURJT19TVFJFQU1fU1RBVEVfU1RBUlRFRCwKKyAgICAvKioKKyAgICAgKiBUaGUgc3RyZWFtIGlzIHBhdXNpbmcuCisgICAgICovCiAgICAgQUFVRElPX1NUUkVBTV9TVEFURV9QQVVTSU5HLAorICAgIC8qKgorICAgICAqIFRoZSBzdHJlYW0gaGFzIHBhdXNlZCwgY291bGQgYmUgcmVzdGFydGVkIG9yIGZsdXNoZWQuCisgICAgICovCiAgICAgQUFVRElPX1NUUkVBTV9TVEFURV9QQVVTRUQsCisgICAgLyoqCisgICAgICogVGhlIHN0cmVhbSBpcyBiZWluZyBmbHVzaGVkLgorICAgICAqLwogICAgIEFBVURJT19TVFJFQU1fU1RBVEVfRkxVU0hJTkcsCisgICAgLyoqCisgICAgICogVGhlIHN0cmVhbSBpcyBmbHVzaGVkLCByZWFkeSB0byBiZSByZXN0YXJ0ZWQuCisgICAgICovCiAgICAgQUFVRElPX1NUUkVBTV9TVEFURV9GTFVTSEVELAorICAgIC8qKgorICAgICAqIFRoZSBzdHJlYW0gaXMgc3RvcHBpbmcuCisgICAgICovCiAgICAgQUFVRElPX1NUUkVBTV9TVEFURV9TVE9QUElORywKKyAgICAvKioKKyAgICAgKiBUaGUgc3RyZWFtIGhhcyBiZWVuIHN0b3BwZWQuCisgICAgICovCiAgICAgQUFVRElPX1NUUkVBTV9TVEFURV9TVE9QUEVELAorICAgIC8qKgorICAg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GVfbGljZW5zZXM6IFsiZnJhbWV3b3Jrc19hdl9saWNlbnNlIl0sCit9CisKIGNjX2xpYnJhcnkgewogICAgIG5hbWU6ICJsaWJhYXVkaW8iLAogCkBAIC0yMSw2ICszMCw3IEBACiAgICAgXSwKIAogICAgIGNmbGFnczogWworICAgICAgICAiLVd0aHJlYWQtc2FmZXR5IiwKICAgICAgICAgIi1Xbm8tdW51c2VkLXBhcmFtZXRlciIsCiAgICAgICAgICItV2FsbCIsCiAgICAgICAgICItV2Vycm9yIiwKQEAgLTQyLDYgKzUyLDcgQEAKICAgICAgICAgImxpYmN1dGlscyIsCiAgICAgICAgICJsaWJ1dGlscyIsCiAgICAgICAgICJsaWJiaW5kZXIiLAorICAgICAgICAibGlicGVybWlzc2lvbiIsCiAgICAgXSwKIAogICAgIHNhbml0aXplOiB7CkBAIC03NSw2ICs4NiwxMCBAQAogICAgIF0sCiAgICAgZXhwb3J0X2hlYWRlcl9saWJfaGVhZGVyczogWyJsaWJhYXVkaW9faGVhZGVycyJdLAogCisgICAgZXhwb3J0X3NoYXJlZF9saWJfaGVhZGVyczogWworICAgICAgICAiZnJhbWV3b3JrLXBlcm1pc3Npb24tYWlkbC1jcHAiLAorICAgIF0sCisKICAgICBzaGFyZWRfbGliczogWwogICAgICAgICAibGliYXVkaW9jbGllbnQiLAogICAgICAgICAibGliYXVkaW91dGlscyIsCkBAIC04NSw2ICsxMDAsOSBAQAogICAgICAgICAibGliY3V0aWxzIiwKICAgICAgICAgImxpYnV0aWxzIiwKICAgICAgICAgImxpYmJpbmRlciIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCisgICAgICAgICJhYXVkaW8tYWlkbC1jcHAiLAorICAgICAgICAibGliYXVkaW9jbGllbnRfYWlkbF9jb252ZXJzaW9uIiwKICAgICBdLAogCiAgICAgY2ZsYWdzOiBbCkBAIC0xMTQsMTEgKzEzMiwxMCBAQAogICAgICAgICAiY2xpZW50L0F1ZGlvU3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pID09IG51bGxwdHIpIHJldHVybiBBQVVESU9fRVJST1JfTk9fU0VSVklDRTsKKwogICAgIHJldHVybiBzZXJ2aWNlLT5mbHVzaFN0cmVhbShzdHJlYW1IYW5kbGUpOwogfQogCkBAIC0xOTEsMTcgKzE5MSwxNiBAQAogYWF1ZGlvX3Jlc3VsdF90IEFBdWRpb0JpbmRlckNsaWVudDo6cmVnaXN0ZXJBdWRpb1RocmVhZChhYXVkaW9faGFuZGxlX3Qgc3RyZWFtSGFuZGxlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWRfdCBjbGllbnRUaHJlYWRJZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50NjRfdCBwZXJpb2ROYW5vc2Vjb25kcykgewotICAgIGNvbnN0IHNwPElBQXVkaW9TZXJ2aWNlPiBzZXJ2aWNlID0gZ2V0QUF1ZGlvU2VydmljZSgpOworICAgIHN0ZDo6c2hhcmVkX3B0cjxBQXVkaW9TZXJ2aWNlSW50ZXJmYWNlPiBzZXJ2aWNlID0gZ2V0QUF1ZGlvU2VydmljZSgpOwogICAgIGlmIChzZXJ2aWNlLmdldCgpID09IG51bGxwdHIpIHJldHVybiBBQVVESU9fRVJST1JfTk9fU0VSVklDRTsKLSAgICByZXR1cm4gc2VydmljZS0+cmVnaXN0ZXJBdWRpb1RocmVhZChzdHJlYW1IYW5kbGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50VGhyZWFkSWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVyaW9kTmFub3NlY29uZHMpOworCisgICAgcmV0dXJuIHNlcnZpY2UtPnJlZ2lzdGVyQXVkaW9UaHJlYWQoc3RyZWFtSGFuZGxlLCBjbGllbnRUaHJlYWRJZCwgcGVyaW9kTmFub3NlY29uZHMpOwogfQogCiBhYXVkaW9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Y2U+ICBtQUF1ZGlvU2VydmljZTsKLSAgICBhbmRyb2lkOjpzcDxBQXVkaW9DbGllbnQ+ICAgICAgIG1BQXVkaW9DbGllbnQ7CisgICAgICAgIHZpcnR1YWwgfkFkYXB0ZXIoKSB7CisgICAgICAgICAgICBpZiAobURlbGVnYXRlICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgICAgICBhbmRyb2lkOjpJSW50ZXJmYWNlOjphc0JpbmRlcihtRGVsZWdhdGUpLT51bmxpbmtUb0RlYXRoKG1BQXVkaW9DbGllbnQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gVGhpcyBzaG91bGQgbmV2ZXIgYmUgY2FsbGVkIChjYWxsIGlzIHJlamVjdGVkIGF0IHRoZSBBdWRpb0JpbmRlckNsaWVudCBsZXZlbCkuCisgICAgICAgIGFhdWRpb19yZXN1bHRfdCBzdGFydENsaWVudChhYXVkaW9faGFuZGxlX3Qgc3RyZWFtSGFuZGxlIF9fdW51c2VkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYW5kcm9pZDo6QXVkaW9DbGllbnQmIGNsaWVudCBfX3VudXNlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCogYXR0ciBfX3VudXNlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QqIGNsaWVudEhhbmRsZSBfX3VudXNlZCkgb3ZlcnJpZGUgeworICAgICAgICAgICAgTE9HX0FMV0FZU19GQVRBTCgiU2hvdWxkbid0IGdldCBoZXJlIik7CisgICAgICAgICAgICByZXR1cm4gQUFVRElPX0VSUk9SX1VOQVZBSUxBQkxFOworICAgICAgICB9CisKKyAgICAgICAgLy8gVGhpcyBzaG91bGQgbmV2ZXIgYmUgY2FsbGVkIChjYWxsIGlzIHJlamVjdGVkIGF0IHR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hIiwgX19mdW5jX18pOwotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXN1bHQgPSBzdG9wU3RyZWFtKHN0cmVhbUhhbmRsZSk7Ci0gICAgICAgICAgICBBTE9HVigiQm5BQXVkaW9TZXJ2aWNlOjpvblRyYW5zYWN0IFNUT1BfU1RSRUFNIDB4JTA4WCwgcmVzdWx0ID0gJWQiLAotICAgICAgICAgICAgICAgICAgc3RyZWFtSGFuZGxlLCByZXN1bHQpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIocmVzdWx0KTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIEZMVVNIX1NUUkVBTTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBQXVkaW9TZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBzdGF0dXMgPSBkYXRhLnJlYWRJbnQzMigmc3RyZWFtSGFuZGxlKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBBTE9HRSgiQm5BQXVkaW9TZXJ2aWNlOjolcyhGTFVTSF9TVFJFQU0pIHN0cmVhbUhhbmRsZSBmYWlsZWQhIiwgX19mdW5jX18pOwotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXN1bHQgPSBmbHVzaFN0cmVhbShzdHJlYW1IYW5kbGUpOwotICAgICAgICAgICAgQUxPR1YoIkJuQUF1ZGlvU2VydmljZTo6b25UcmFuc2FjdCBGTFVTSF9TVFJFQU0gMHglMDhYLCByZXN1bHQgPSAlZCIsCi0gICAgICAgICAgICAgICAgICAgIHN0cmVhbUhhbmRsZSwgcmVzdWx0KTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHJl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W9Gb3JtYXQ7ICAvLyAgICAgICAgICA9IEFVRElPX0ZPUk1BVF9ERUZBVUxUOworICAgIGludCAvKiBhYXVkaW9fZGlyZWN0aW9uX3QgKi8gICAgICAgICAgICAgIGRpcmVjdGlvbjsgIC8vICAgICAgICAgICAgPSBBQVVESU9fRElSRUNUSU9OX09VVFBVVDsKKyAgICBpbnQgLyogYWF1ZGlvX3VzYWdlX3QgKi8gICAgICAgICAgICAgICAgICB1c2FnZTsgIC8vICAgICAgICAgICAgICAgID0gQUFVRElPX1VOU1BFQ0lGSUVEOworICAgIGludCAvKiBhYXVkaW9fY29udGVudF90eXBlX3QgKi8gICAgICAgICAgIGNvbnRlbnRUeXBlOyAgLy8gICAgICAgICAgPSBBQVVESU9fVU5TUEVDSUZJRUQ7CisgICAgaW50IC8qIGFhdWRpb19pbnB1dF9wcmVzZXRfdCAqLyAgICAgICAgICAgaW5wdXRQcmVzZXQ7ICAvLyAgICAgICAgICA9IEFBVURJT19VTlNQRUNJRklFRDsKKyAgICBpbnQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXJDYXBhY2l0eTsgIC8vICAgICAgID0gQUFVRElPX1VOU1BFQ0lGSUVEOworICAgIGludCAvKiBhYXVkaW9fYWxsb3dlZF9jYXB0dXJlX3BvbGljeV90ICovIGFsbG93ZWRDYXB0dXJlUG9saWN5OyAgLy8gPSBBQVVESU9fVU5TUEVDSUZJRUQ7CisgICAgaW50IC8qIGFhdWRpb19zZXNzaW9uX2lkX3QgKi8gICAgICAgICAgICAgc2Vzc2lvbklkOyAgLy8gICAgICAgICAgICA9IEFBVURJT19TRVNTSU9OX0lEX05PTkU7CisgICAgYm9vbGVhbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNQcml2YWN5U2Vuc2l0aXZlOyAgLy8gICA9IGZhbHNlOworfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliYWF1ZGlvL3NyYy9iaW5kaW5nL2FpZGwvYWF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MTZfQklUCi0gICAgICAgICAgICAgICAgICAgJiYgZGVzdGluYXRpb25Gb3JtYXQgPT0gQVVESU9fRk9STUFUX1BDTV9GTE9BVCkgewotICAgICAgICAgICAgbWVtY3B5X3RvX2Zsb2F0X2Zyb21faTE2KAotICAgICAgICAgICAgICAgICAgICAoZmxvYXQgKikgZGVzdGluYXRpb24sCi0gICAgICAgICAgICAgICAgICAgIChjb25zdCBpbnQxNl90ICopIHdyYXBwaW5nQnVmZmVyLmRhdGFbcGFydEluZGV4XSwKLSAgICAgICAgICAgICAgICAgICAgbnVtU2FtcGxlcyk7Ci0gICAgICAgIH0gZWxzZSBpZiAoc291cmNlRm9ybWF0ID09IEFVRElPX0ZPUk1BVF9QQ01fRkxPQVQKLSAgICAgICAgICAgICAgICAgICAmJiBkZXN0aW5hdGlvbkZvcm1hdCA9PSBBVURJT19GT1JNQVRfUENNXzE2X0JJVCkgewotICAgICAgICAgICAgbWVtY3B5X3RvX2kxNl9mcm9tX2Zsb2F0KAotICAgICAgICAgICAgICAgICAgICAoaW50MTZfdCAqKSBkZXN0aW5hdGlvbiwKLSAgICAgICAgICAgICAgICAgICAgKGNvbnN0IGZsb2F0ICopIHdyYXBwaW5nQnVmZmVyLmRhdGFbcGFydEluZGV4XSwKLSAgICAgICAgICAgICAgICAgICAgbnVtU2FtcGxlcyk7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBBTE9HRSgiJXMoKSAtIEZvcm1hdCBjb252ZXJzaW9uIG5vdCBzdXBwb3J0ZWQhIGF1ZGlvX2Zvcm1hdF90IHNvdXJjZSA9ICV1LCBkZXN0ID0gJXUiLAotICAgICAgICAgICAgICAgIF9fZnVuY19fLCBzb3VyY2VGb3JtYXQsIGRlc3RpbmF0aW9uRm9ybWF0KTsKLSAgICAgICAgICAgIHJldHVybiBBQVVESU9fRVJST1JfSU5WQUxJRF9GT1JNQVQ7Ci0gICAgICAgIH0KKworICAgICAgICBtZW1jcHlfYnlfYXVkaW9fZ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WNzSWQpCisgICAgICAgICAgICAgICAgLnNldChBTUVESUFNRVRSSUNTX1BST1BfRlJBTUVTVFJBTlNGRVJSRUQsCisgICAgICAgICAgICAgICAgICAgICAgICBnZXREaXJlY3Rpb24oKSA9PSBBQVVESU9fRElSRUNUSU9OX0lOUFVUID8gZ2V0RnJhbWVzV3JpdHRlbigpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogZ2V0RnJhbWVzUmVhZCgpKQorICAgICAgICAgICAgICAgIC5zZXQoQU1FRElBTUVUUklDU19QUk9QX0VWRU5ULCBBTUVESUFNRVRSSUNTX1BST1BfRVZFTlRfVkFMVUVfRU5EQUFVRElPU1RSRUFNKQorICAgICAgICAgICAgICAgIC5yZWNvcmQoKTsKKyAgICB9Cit9CisKIHZvaWQgQXVkaW9TdHJlYW06OnNldFN0YXRlKGFhdWRpb19zdHJlYW1fc3RhdGVfdCBzdGF0ZSkgewogICAgIEFMT0dEKCIlcyhzIyVkKSBmcm9tICVkIHRvICVkIiwgX19mdW5jX18sIGdldElkKCksIG1TdGF0ZSwgc3RhdGUpOworICAgIGlmIChzdGF0ZSA9PSBtU3RhdGUpIHsKKyAgICAgICAgcmV0dXJuOyAvLyBubyBjaGFuZ2UKKyAgICB9CiAgICAgLy8gVHJhY2sgdHJhbnNpdGlvbiB0byBESVNDT05ORUNURUQgc3RhdGUuCi0gICAgaWYgKHN0YXRlID09IEFBVURJT19TVFJFQU1fU1RBVEVfRElTQ09OTkVDVEVEICYmIG1TdGF0ZSAhPSBzdGF0ZSkgeworICAgIGlmIChzdGF0ZSA9PSBBQVVESU9fU1RSRUFNX1NUQVRFX0RJU0NPTk5FQ1RFRCkgewogICAgICAgICBhbmRyb2lkOjptZWRpYW1ldHJpY3M6OkxvZ0l0ZW0obU1ldHJpY3NJZCkKICAgICAgICAgICAgICAgICAuc2V0KEFNRURJQU1FVFJJQ1NfUFJPUF9FVkVOVCwgQU1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wZXJpb2ROYW5vc2Vjb25kcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFhdWRpb19hdWRpb190aHJlYWRfcHJvY190IHRocmVhZFByb2MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICp0aHJlYWRBcmcpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFWENMVURFUyhtU3RyZWFtTG9jaykgeworICAgICAgICBzdGQ6OmxvY2tfZ3VhcmQ8c3RkOjptdXRleD4gbG9jayhtU3RyZWFtTG9jayk7CisgICAgICAgIHJldHVybiBjcmVhdGVUaHJlYWRfbChwZXJpb2ROYW5vc2Vjb25kcywgdGhyZWFkUHJvYywgdGhyZWFkQXJnKTsKKyAgICB9CiAKLSAgICBhYXVkaW9fcmVzdWx0X3Qgam9pblRocmVhZCh2b2lkICoqcmV0dXJuQXJnLCBpbnQ2NF90IHRpbWVvdXROYW5vc2Vjb25kcyk7CisgICAgYWF1ZGlvX3Jlc3VsdF90IGpvaW5UaHJlYWQodm9pZCAqKnJldHVybkFyZyk7CiAKICAgICB2aXJ0dWFsIGFhdWRpb19yZXN1bHRfdCByZWdpc3RlclRocmVhZCgpIHsKICAgICAgICAgcmV0dXJuIEFBVURJT19PSzsKQEAgLTIwMiwxMSArMTkyLDExIEBACiAgICAgfQogCiAgICAgdmlydHVhbCBpbnQzMl90IGdldEJ1ZmZlckNhcGFjaXR5KCkgY29uc3QgewotICAgICAgICByZXR1cm4gQUFVRElPX0VSUk9SX1VOSU1QTEVNRU5URUQ7CisgICAgICAgIHJldHVybiBtQnVmZmVyQ2FwYWNpdHk7CiAgICAgfQogCiAgICAgdmlydHVhbCBpbnQzMl90IGdldEZyYW1lc1BlckJ1cnN0KCkgY29uc3QgewotICAgICAgICByZXR1cm4gQUFVRElPX0VSUk9SX1VOSU1QTEVNRU5URUQ7CisgICAgICAgIHJldHVybiBtRnJhbWVzUGVyQnVyc3Q7CiAgICAgfQogCiAgICAgdmlydHVhb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hdGFTdG9yYWdlQWRkcmVzcykpCisgICAgICAgIDogRmlmb0J1ZmZlcihieXRlc1BlckZyYW1lKQorICAgICAgICAsIG1FeHRlcm5hbFN0b3JhZ2Uoc3RhdGljX2Nhc3Q8dWludDhfdCAqPihkYXRhU3RvcmFnZUFkZHJlc3MpKQogewogICAgIG1GaWZvID0gc3RkOjptYWtlX3VuaXF1ZTxGaWZvQ29udHJvbGxlckluZGlyZWN0PihjYXBhY2l0eUluRnJhbWVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FwYWNpdHlJbkZyYW1lcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRJbmRleEFkZHJlc3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0ZUluZGV4QWRkcmVzcyk7Ci0gICAgbVN0b3JhZ2VPd25lZCA9IGZhbHNlOwotfQotCi1GaWZvQnVmZmVyOjp+Rmlmb0J1ZmZlcigpIHsKLSAgICBpZiAobVN0b3JhZ2VPd25lZCkgewotICAgICAgICBkZWxldGVbXSBtU3RvcmFnZTsKLSAgICB9CiB9CiAKIGludDMyX3QgRmlmb0J1ZmZlcjo6Y29udmVydEZyYW1lc1RvQnl0ZXMoZmlmb19mcmFtZXNfdCBmcmFtZXMpIHsKQEAgLTc2LDE1ICs3MywxNiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBzdGFydEluZGV4KSB7CiAgICAgd3JhcHBpbmdCdWZmZXItPmRhdGFbMV0gPSBudWxscHRyOwogICAgIHdyYXBwaW5nQnVmZmVyLT5udW1GcmFtZXNbMV0gPSAwOworICAgIHVpbnQ4X3QgKnN0b3JhZ2UgPSBnZXRTdG9yYWdlKCk7CiAgICAgaWYgKGZyYW1lc0F2YWlsYWJsZSA+IDApIHsKICAgICAgICAgZmlmb19mcmFtZXNfdCBjYXBhY2l0eSA9IG1GaWZvLT5nZXRDYXB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VkZSAiU2lua0kzMi5oIgorCit1c2luZyBuYW1lc3BhY2UgZmxvd2dyYXBoOworCitTaW5rSTMyOjpTaW5rSTMyKGludDMyX3QgY2hhbm5lbENvdW50KQorICAgICAgICA6IEF1ZGlvU2luayhjaGFubmVsQ291bnQpIHt9CisKK2ludDMyX3QgU2lua0kzMjo6cmVhZCh2b2lkICpkYXRhLCBpbnQzMl90IG51bUZyYW1lcykgeworICAgIGludDMyX3QgKmludERhdGEgPSAoaW50MzJfdCAqKSBkYXRhOworICAgIGNvbnN0IGludDMyX3QgY2hhbm5lbENvdW50ID0gaW5wdXQuZ2V0U2FtcGxlc1BlckZyYW1lKCk7CisKKyAgICBpbnQzMl90IGZyYW1lc0xlZnQgPSBudW1GcmFtZXM7CisgICAgd2hpbGUgKGZyYW1lc0xlZnQgPiAwKSB7CisgICAgICAgIC8vIFJ1biB0aGUgZ3JhcGggYW5kIHB1bGwgZGF0YSB0aHJvdWdoIHRoZSBpbnB1dCBwb3J0LgorICAgICAgICBpbnQzMl90IGZyYW1lc1JlYWQgPSBwdWxsKGZyYW1lc0xlZnQpOworICAgICAgICBpZiAoZnJhbWVzUmVhZCA8PSAwKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjb25zdCBmbG9hdCAqc2lnbmFsID0gaW5wdXQuZ2V0QmxvY2soKTsKKyAgICAgICAgaW50MzJfdCBudW1TYW1wbGVzID0gZnJhbWVzUmVhZCAqIGNoYW5uZWxDb3VudDsKKyNpZmRlZiBfX0FORFJPSURfXworICAgICAgICBtZW1jcHlfdG9faTMyX2Zyb21fZmxvYXQoaW50RGF0YSwgc2lnbmFsLCBudW1TYW1wbGVzKTsKKyAgICAgICAgaW50RGF0YSArPSBudW1TYW1wbGVzOworICAgICAgICBzaWduYWwgKz0gbnVtU2FtcGxlczsKKyNlbHNlCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtU2FtcGxlczsgaSsrKSB7CisgICAgICAgICAgICAq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FNJWkVfU1RPUF9DQUxMQkFDS1MgaGVyZSBiZWNhdXNlIHRoYXQgd2lsbCBraWxsIHRoZSBzdHJlYW0gYW5kCisgICAgICAgICAgICAgICAgLy8gcHJldmVudCBpdCBmcm9tIGJlaW5nIHJlc3RhcnRlZC4gVGhpcyBjYW4gb2NjdXIgYmVjYXVzZSBvZiBhIHJhY2UgY29uZGl0aW9uCisgICAgICAgICAgICAgICAgLy8gY2F1c2VkIGJ5IExlZ2FjeSBjYWxsYmFja3MgcnVubmluZyBhZnRlciB0aGUgdHJhY2sgaXMgInN0b3BwZWQiLgorICAgICAgICAgICAgICAgIGF1ZGlvQnVmZmVyLT5zaXplID0gMDsKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgaWYgKGF1ZGlvQnVmZmVyLT5mcmFtZUNvdW50ID09IDApIHsKICAgICAgICAgICAgICAgICAgICAgQUxPR1coInByb2Nlc3NDYWxsYmFja0NvbW1vbigpIGRhdGEsIGZyYW1lQ291bnQgaXMgemVybyIpOwpAQCAtMTI0LDcgKzEyOSw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgY2FsbGJhY2tSZXN1bHQpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGF1ZGlvQnVmZmVyLT5zaXplID0gMDsKLSAgICAgICAgICAgICAgICAgICAgc3lzdGVtU3RvcEZyb21DYWxsYmFjaygpOworICAgICAgICAgICAgICAgICAgICBzeXN0ZW1TdG9wSW50ZXJuYWwoKTsKICAgICAgICAgICAgICAgICAgICAgLy8gRGlzYWJsZSB0aGUgY2FsbGJhY2sganVzdCBpbiBjYXNlIHRoZSBzeXN0ZW0ga2VlcHMgdHJ5aW5nIHRvIGNhbGwgdXMuCiAgICAgICAgICAgICAgICAgICAgIG1DYWxsYmFja0VuYWJsZWQuc3RvcmUoZmFsc2UpOwogICAgICAgICAgICAgICAgIH0KQEAgLTIyNiw3ICsyMzE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ZWFkKSB7CiAgICAgICAgICAgICBwcmludGYoIldBUk5JTkcgLSBVTkRFUkZMT1cgLSBkaWZmID0gJWQgISEhISEhISEhISEhXG4iLAogICAgICAgICAgICAgICAgICAgIChpbnQpIChmcmFtZXNXcml0dGVuIC0gZnJhbWVzUmVhZCkpOwogICAgICAgICB9CkBAIC0xMzIsOCArMTM1LDIzIEBACiAgICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgIH0KIAorICAgICAgICAvLyB1cGRhdGUgYW5kIHF1ZXJ5IHN0cmVhbSBzdGF0ZQorICAgICAgICBhYXVkaW9fc3RyZWFtX3N0YXRlX3Qgc3RhdGUgPSBBQVVESU9fU1RSRUFNX1NUQVRFX1VOS05PV047CisgICAgICAgIHN0YXRlID0gQUF1ZGlvU3RyZWFtX2dldFN0YXRlKGdldFN0cmVhbSgpKTsKKyAgICAgICAgaWYgKHN0YXRlIDwgMCkgeworICAgICAgICAgICAgcHJpbnRmKCJFUlJPUiAtIEFBdWRpb1N0cmVhbV9nZXRTdGF0ZSByZXR1cm5lZCAlZFxuIiwgc3RhdGUpOworICAgICAgICAgICAgcmV0dXJuIHN0YXRlOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHN0YXRlID09IEFBVURJT19TVFJFQU1fU1RBVEVfRElTQ09OTkVDVEVEKSB7CisgICAgICAgICAgICBwcmludGYoIiMlZCwgQ2xvc2luZyBkaXNjb25uZWN0ZWQgc3RyZWFtLlxuIiwgZ2V0SW5kZXgoKSk7CisgICAgICAgICAgICByZXN1bHQgPSBjbG9zZSgpOworICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgICAgfQorCiAgICAgICAgIGRvdWJsZSBkaWNlID0gbmV4dFJhbmRvbURvdWJsZSgpOwogICAgICAgICAvLyBTZWxlY3QgYW4gYWN0aW9uIGJhc2VkIG9uIGEgd2VpZ2h0ZWQgcHJvYmFiaWxpdHkuCisgICAgICAgIHByaW50ZigiICAgICIpOyAvLyBpbmRlbnQgY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Rpb19wZXJmb3JtYW5jZV9tb2RlX3QKKyAgICAgICAgICAgIGFjdHVhbFBlcmZNb2RlID0gQUF1ZGlvU3RyZWFtX2dldFBlcmZvcm1hbmNlTW9kZShtU3RyZWFtKTsKKyAgICAgICAgcHJpbnRmKCItLS0tLS0tLSBvcGVuZWQ6IGRldmljZUlkID0gJTNkLCBwZXJmTW9kZSA9ICVkXG4iLAorICAgICAgICAgICAgICAgZGV2aWNlSWQsCisgICAgICAgICAgICAgICBhY3R1YWxQZXJmTW9kZSk7CisKKyAgICAgICAgLy8gU3RhcnQgc3RyZWFtLgorICAgICAgICByZXN1bHQgPSBBQXVkaW9TdHJlYW1fcmVxdWVzdFN0YXJ0KG1TdHJlYW0pOworICAgICAgICBNWV9BU1NFUlRfRVEoQUFVRElPX09LLCByZXN1bHQpOworCisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIGJvb2wgd2FpdEZvckNhbGxiYWNrVG9TdGFydCgpIHsKKyAgICAgICAgLy8gV2FpdCBmb3IgY2FsbGJhY2sgdG8gc2F5IGl0IGhhcyBiZWVuIGNhbGxlZC4KKyAgICAgICAgaW50IGNvdW50RG93biA9IDEwICogMTAwMCAvIGtQb2xsU2xlZXBNaWxsaXM7CisgICAgICAgIHdoaWxlICghbUNhbGxiYWNrU3RhcnRlZCAmJiBjb3VudERvd24gPiAwKSB7CisgICAgICAgICAgICBpZiAoKGNvdW50RG93biAlIDUpID09IDApIHsKKyAgICAgICAgICAgICAgICBwcmludGYoIj09PT09IFBsZWFzZSBQTFVHIG9yIFVOUExVRyBoZWFkcGhvbmVzISA9PT09PT09ICVkXG4iLCBjb3VudERvd24pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdXNsZWVwKGtQb2xsU2xlZXBNaWxsaXMgKiAxMDAwKTsKKyAgICAgICAgICAgIGNvdW50RG93bi0tOworICAgICAgICB9CisgICAgICAgIE1ZX0FTU0VSVF9UUlVFKGNvdW50RG93biA+IDApOworICAgICAgICBNWV9BU1NFUlRfVFJVRShtQ2FsbGJhY2tTdGFydGVkKTsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisvLyBDYWxsYmFjayBmdW5jdGlvbiB0aGF0IGZpbGxzIHRoZSBhdWRpbyBvdXRwdXQgYnVmZmVyLgorICAgIHN0YXRpYyBhYXVkaW9fZGF0YV9jYWxsYmFja19yZXN1bHRfdCBzX215RGF0YUNhbGxiYWNrUHJvYygKKyAgICAgICAgICAgIEFBdWRpb1N0cmVhbSAqIC8qIHN0cmVhbSAqLywKKyAgICAgICAgICAgIHZvaWQgKiAvKiB1c2VyRGF0YSAqLywKKyAgICAgICAgICAgIHZvaWQgKiAvKiBhdWRpb0RhdGEgKi8sCisgICAgICAgICAgICBpbnQzMl90IC8qIG51bUZyYW1lcyAqLworICAgICkgeworICAgICAgICByZXR1cm4gQUFVRElPX0NBTExCQUNLX1JFU1VMVF9DT05USU5VRTsKKyAgICB9CisKKyAgICBzdGF0aWMgdm9pZCBzX215RXJyb3JDYWxsYmFja1Byb2MoCisgICAgICAgICAgICAgICAgQUF1ZGlvU3RyZWFtICogc3RyZWFtLAorICAgICAgICAgICAgICAgIHZvaWQgKnVzZXJEYXRhLAorICAgICAgICAgICAgICAgIGFhdWRpb19yZXN1bHRfdCBlcnJvcikgeworICAgICAgICBBdWRpb0VuZ2luZSAqZW5naW5lID0gKEF1ZGlvRW5naW5lICopdXNlckRhdGE7CisgICAgICAgIGVuZ2luZS0+bUVycm9yID0gZXJyb3I7CisgICAgICAgIGVuZ2luZS0+bUNhbGxiYWNrU3RhcnRlZCA9IHRydWU7CisgICAgICAgIHVzbGVlcChrQ2FsbGJhY2tTbGVlcE1pbGxpcyAqIDEwMDApOworICAgICAgICAvLyBpdCBpcyBpbGxlZ2FsIHRvIGNhbGwgc3RvcCgpIGZyb20gdGhlIGNhbGxiYWNrLiBJdCBzaG91bGQKKyAgICAgICAgLy8gcmV0dXJuIGFuIGVycm9yIGFuZCBub3QgaGFuZy4KKyAg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QgIC1XZXJyb3IsLVdzd2l0Y2gKKyAgICAgICAgY2FzZSBtZWRpYTo6QXVkaW9Qb3J0VHlwZTo6REVWSUNFOgorICAgICAgICAgICAgc3dpdGNoIChyb2xlKSB7CisgICAgICAgICAgICAgICAgY2FzZSBtZWRpYTo6QXVkaW9Qb3J0Um9sZTo6Tk9ORToKKyAgICAgICAgICAgICAgICAgICAgIGJyZWFrOyAgLy8gbXVzdCBiZSBsaXN0ZWQgIC1XZXJyb3IsLVdzd2l0Y2gKKyAgICAgICAgICAgICAgICBjYXNlIG1lZGlhOjpBdWRpb1BvcnRSb2xlOjpTT1VSQ0U6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBEaXJlY3Rpb246OklOUFVUOworICAgICAgICAgICAgICAgIGNhc2UgbWVkaWE6OkF1ZGlvUG9ydFJvbGU6OlNJTks6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBEaXJlY3Rpb246Ok9VVFBVVDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIG1lZGlhOjpBdWRpb1BvcnRUeXBlOjpNSVg6CisgICAgICAgICAgICBzd2l0Y2ggKHJvbGUpIHsKKyAgICAgICAgICAgICAgICBjYXNlIG1lZGlhOjpBdWRpb1BvcnRSb2xlOjpOT05FOgorICAgICAgICAgICAgICAgICAgICAgYnJlYWs7ICAvLyBtdXN0IGJlIGxpc3RlZCAgLVdlcnJvciwtV3N3aXRjaAorICAgICAgICAgICAgICAgIGNhc2UgbWVkaWE6OkF1ZGlvUG9ydFJvbGU6OlNPVVJDRToKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERpcmVjdGlvbjo6T1VUUFVUOworICAgICAgICAgICAgICAgIGNhc2UgbWVkaWE6OkF1ZGlvUG9ydFJvbGU6OlNJTks6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBEaXJlY3Rpb246OklOUFVUOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgfQorICAgIHJldHVybiB1bmV4cGVjdGVkKEJBRF9WQUxVRSk7Cit9CisKK0NvbnZlcnNpb25SZXN1bHQ8RGlyZWN0aW9uPiBkaXJlY3Rpb24oYXVkaW9fcG9ydF9yb2xlX3Qgcm9sZSwgYXVkaW9fcG9ydF90eXBlX3QgdHlwZSkgeworICAgIHN3aXRjaCAodHlwZSkgeworICAgICAgICBjYXNlIEFVRElPX1BPUlRfVFlQRV9OT05FOgorICAgICAgICBjYXNlIEFVRElPX1BPUlRfVFlQRV9TRVNTSU9OOgorICAgICAgICAgICAgYnJlYWs7ICAvLyBtdXN0IGJlIGxpc3RlZCAgLVdlcnJvciwtV3N3aXRjaAorICAgICAgICBjYXNlIEFVRElPX1BPUlRfVFlQRV9ERVZJQ0U6CisgICAgICAgICAgICBzd2l0Y2ggKHJvbGUpIHsKKyAgICAgICAgICAgICAgICBjYXNlIEFVRElPX1BPUlRfUk9MRV9OT05FOgorICAgICAgICAgICAgICAgICAgICAgYnJlYWs7ICAvLyBtdXN0IGJlIGxpc3RlZCAgLVdlcnJvciwtV3N3aXRjaAorICAgICAgICAgICAgICAgIGNhc2UgQVVESU9fUE9SVF9ST0xFX1NPVVJDRToKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERpcmVjdGlvbjo6SU5QVVQ7CisgICAgICAgICAgICAgICAgY2FzZSBBVURJT19QT1JUX1JPTEVfU0lOSzoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERpcmVjdGlvbjo6T1VUUFVUOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQVVESU9fUE9SVF9UWVBFX01JWDoKKyAgICAgICAgICAgIHN3aXRjaCAocm9sZSkgeworICAgICAgICAgICAgICAgIGNhc2UgQVVESU9fUE9SVF9ST0xFX05PTkU6CisgICAgICAgICAgICAgICAgICAgICBicmVhazsgIC8vIG11c3QgYmUgbGlzdGVkICAtV2Vycm9yLC1Xc3dpdGNoCisgICAgIC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ICAgICAgICAgICAgcmV0dXJuIEFVRElPX1NUUkVBTV9WT0lDRV9DQUxMOworICAgICAgICBjYXNlIG1lZGlhOjpBdWRpb1N0cmVhbVR5cGU6OlNZU1RFTToKKyAgICAgICAgICAgIHJldHVybiBBVURJT19TVFJFQU1fU1lTVEVNOworICAgICAgICBjYXNlIG1lZGlhOjpBdWRpb1N0cmVhbVR5cGU6OlJJTkc6CisgICAgICAgICAgICByZXR1cm4gQVVESU9fU1RSRUFNX1JJTkc7CisgICAgICAgIGNhc2UgbWVkaWE6OkF1ZGlvU3RyZWFtVHlwZTo6TVVTSUM6CisgICAgICAgICAgICByZXR1cm4gQVVESU9fU1RSRUFNX01VU0lDOworICAgICAgICBjYXNlIG1lZGlhOjpBdWRpb1N0cmVhbVR5cGU6OkFMQVJNOgorICAgICAgICAgICAgcmV0dXJuIEFVRElPX1NUUkVBTV9BTEFSTTsKKyAgICAgICAgY2FzZSBtZWRpYTo6QXVkaW9TdHJlYW1UeXBlOjpOT1RJRklDQVRJT046CisgICAgICAgICAgICByZXR1cm4gQVVESU9fU1RSRUFNX05PVElGSUNBVElPTjsKKyAgICAgICAgY2FzZSBtZWRpYTo6QXVkaW9TdHJlYW1UeXBlOjpCTFVFVE9PVEhfU0NPOgorICAgICAgICAgICAgcmV0dXJuIEFVRElPX1NUUkVBTV9CTFVFVE9PVEhfU0NPOworICAgICAgICBjYXNlIG1lZGlhOjpBdWRpb1N0cmVhbVR5cGU6OkVORk9SQ0VEX0FVRElCTEU6CisgICAgICAgICAgICByZXR1cm4gQVVESU9fU1RSRUFNX0VORk9SQ0VEX0FVRElCTEU7CisgICAgICAgIGNhc2UgbWVkaWE6OkF1ZGlvU3RyZWFtVHlwZTo6RFRNRjoKKyAgICAgICAgICAgIHJldHVybiBBVURJT19TVFJFQU1fRFRNRjsKKyAgICAgICAgY2FzZSBtZWRpYTo6QXVkaW9TdHJlYW1UeXBlOjpUVFM6CisgICAgICAgICAgICByZXR1cm4gQVVESU9fU1RSRU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F9BdWRpb1BvcnRDb25maWdFeHQoCisgICAgICAgIGNvbnN0IGF1ZGlvX3BvcnRfY29uZmlnX2V4dCYgbGVnYWN5LCBhdWRpb19wb3J0X3R5cGVfdCB0eXBlLCBhdWRpb19wb3J0X3JvbGVfdCByb2xlKSB7CisgICAgbWVkaWE6OkF1ZGlvUG9ydENvbmZpZ0V4dCBhaWRsOworCisgICAgc3dpdGNoICh0eXBlKSB7CisgICAgICAgIGNhc2UgQVVESU9fUE9SVF9UWVBFX05PTkU6CisgICAgICAgICAgICBVTklPTl9TRVQoYWlkbCwgdW5zcGVjaWZpZWQsIGZhbHNlKTsKKyAgICAgICAgICAgIHJldHVybiBhaWRsOworICAgICAgICBjYXNlIEFVRElPX1BPUlRfVFlQRV9ERVZJQ0U6CisgICAgICAgICAgICBVTklPTl9TRVQoYWlkbCwgZGV2aWNlLAorICAgICAgICAgICAgICAgICAgICAgIFZBTFVFX09SX1JFVFVSTigKKyAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2FjeTJhaWRsX2F1ZGlvX3BvcnRfY29uZmlnX2RldmljZV9leHRfQXVkaW9Qb3J0Q29uZmlnRGV2aWNlRXh0KAorICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdhY3kuZGV2aWNlKSkpOworICAgICAgICAgICAgcmV0dXJuIGFpZGw7CisgICAgICAgIGNhc2UgQVVESU9fUE9SVF9UWVBFX01JWDoKKyAgICAgICAgICAgIFVOSU9OX1NFVChhaWRsLCBtaXgsCisgICAgICAgICAgICAgICAgICAgICAgVkFMVUVfT1JfUkVUVVJOKGxlZ2FjeTJhaWRsX0F1ZGlvUG9ydENvbmZpZ01peEV4dChsZWdhY3kubWl4LCByb2xlKSkpOworICAgICAgICAgICAgcmV0dXJuIGFpZGw7CisgICAgICAgIGNhc2UgQVVESU9fUE9SVF9UWVBFX1NFU1NJT046CisgICAgICAgICAgICBVTklPTl9TRVQoYWlkbCwgc2Vzc2lvbiwKKyAgICAgICAgICAgICAgICAgICAgICBW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250ZW50X3R5cGVfdD4KK2FpZGwybGVnYWN5X0F1ZGlvQ29udGVudFR5cGVfYXVkaW9fY29udGVudF90eXBlX3QobWVkaWE6OkF1ZGlvQ29udGVudFR5cGUgYWlkbCkgeworICAgIHN3aXRjaCAoYWlkbCkgeworICAgICAgICBjYXNlIG1lZGlhOjpBdWRpb0NvbnRlbnRUeXBlOjpVTktOT1dOOgorICAgICAgICAgICAgcmV0dXJuIEFVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOOworICAgICAgICBjYXNlIG1lZGlhOjpBdWRpb0NvbnRlbnRUeXBlOjpTUEVFQ0g6CisgICAgICAgICAgICByZXR1cm4gQVVESU9fQ09OVEVOVF9UWVBFX1NQRUVDSDsKKyAgICAgICAgY2FzZSBtZWRpYTo6QXVkaW9Db250ZW50VHlwZTo6TVVTSUM6CisgICAgICAgICAgICByZXR1cm4gQVVESU9fQ09OVEVOVF9UWVBFX01VU0lDOworICAgICAgICBjYXNlIG1lZGlhOjpBdWRpb0NvbnRlbnRUeXBlOjpNT1ZJRToKKyAgICAgICAgICAgIHJldHVybiBBVURJT19DT05URU5UX1RZUEVfTU9WSUU7CisgICAgICAgIGNhc2UgbWVkaWE6OkF1ZGlvQ29udGVudFR5cGU6OlNPTklGSUNBVElPTjoKKyAgICAgICAgICAgIHJldHVybiBBVURJT19DT05URU5UX1RZUEVfU09OSUZJQ0FUSU9OOworICAgIH0KKyAgICByZXR1cm4gdW5leHBlY3RlZChCQURfVkFMVUUpOworfQorCitDb252ZXJzaW9uUmVzdWx0PG1lZGlhOjpBdWRpb0NvbnRlbnRUeXBlPgorbGVnYWN5MmFpZGxfYXVkaW9fY29udGVudF90eXBlX3RfQXVkaW9Db250ZW50VHlwZShhdWRpb19jb250ZW50X3R5cGVfdCBsZWdhY3kpIHsKKyAgICBzd2l0Y2ggKGxlZ2FjeSkgeworICAgICAgICBjYXNlIEFVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOOgorICAgICAgICAgICAgcmV0dX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19GTEFHX0hXX0hPVFdPUkQ6CisgICAgICAgICAgICByZXR1cm4gbWVkaWE6OkF1ZGlvRmxhZzo6SFdfSE9UV09SRDsKKyAgICAgICAgY2FzZSBBVURJT19GTEFHX0JZUEFTU19JTlRFUlJVUFRJT05fUE9MSUNZOgorICAgICAgICAgICAgcmV0dXJuIG1lZGlhOjpBdWRpb0ZsYWc6OkJZUEFTU19JTlRFUlJVUFRJT05fUE9MSUNZOworICAgICAgICBjYXNlIEFVRElPX0ZMQUdfQllQQVNTX01VVEU6CisgICAgICAgICAgICByZXR1cm4gbWVkaWE6OkF1ZGlvRmxhZzo6QllQQVNTX01VVEU7CisgICAgICAgIGNhc2UgQVVESU9fRkxBR19MT1dfTEFURU5DWToKKyAgICAgICAgICAgIHJldHVybiBtZWRpYTo6QXVkaW9GbGFnOjpMT1dfTEFURU5DWTsKKyAgICAgICAgY2FzZSBBVURJT19GTEFHX0RFRVBfQlVGRkVSOgorICAgICAgICAgICAgcmV0dXJuIG1lZGlhOjpBdWRpb0ZsYWc6OkRFRVBfQlVGRkVSOworICAgICAgICBjYXNlIEFVRElPX0ZMQUdfTk9fTUVESUFfUFJPSkVDVElPTjoKKyAgICAgICAgICAgIHJldHVybiBtZWRpYTo6QXVkaW9GbGFnOjpOT19NRURJQV9QUk9KRUNUSU9OOworICAgICAgICBjYXNlIEFVRElPX0ZMQUdfTVVURV9IQVBUSUM6CisgICAgICAgICAgICByZXR1cm4gbWVkaWE6OkF1ZGlvRmxhZzo6TVVURV9IQVBUSUM7CisgICAgICAgIGNhc2UgQVVESU9fRkxBR19OT19TWVNURU1fQ0FQVFVSRToKKyAgICAgICAgICAgIHJldHVybiBtZWRpYTo6QXVkaW9GbGFnOjpOT19TWVNURU1fQ0FQVFVSRTsKKyAgICAgICAgY2FzZSBBVURJT19GTEFHX0NBUFRVUkVfUFJJVkFURToKKyAgICAgICAgICAgIHJldHVybiBtZWRpYTo6QXVkaW9GbGFnOjpDQVBUVVJFX1BSSVZBVEU7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lcnJvciwtV3N3aXRjaCBtYXkgY29tcGlsZS10aW1lIGZhaWwKK30KKworQ29udmVyc2lvblJlc3VsdDxtZWRpYTo6QXVkaW9Qb3J0RXh0PiBsZWdhY3kyYWlkbF9BdWRpb1BvcnRFeHQoCisgICAgICAgIGNvbnN0IGF1ZGlvX3BvcnRfdjdfZXh0JiBsZWdhY3ksIGF1ZGlvX3BvcnRfdHlwZV90IHR5cGUpIHsKKyAgICBtZWRpYTo6QXVkaW9Qb3J0RXh0IGFpZGw7CisgICAgc3dpdGNoICh0eXBlKSB7CisgICAgICAgIGNhc2UgQVVESU9fUE9SVF9UWVBFX05PTkU6CisgICAgICAgICAgICBVTklPTl9TRVQoYWlkbCwgdW5zcGVjaWZpZWQsIGZhbHNlKTsKKyAgICAgICAgICAgIHJldHVybiBhaWRsOworICAgICAgICBjYXNlIEFVRElPX1BPUlRfVFlQRV9ERVZJQ0U6CisgICAgICAgICAgICBVTklPTl9TRVQoYWlkbCwgZGV2aWNlLAorICAgICAgICAgICAgICAgICAgICAgIFZBTFVFX09SX1JFVFVSTigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2FjeTJhaWRsX2F1ZGlvX3BvcnRfZGV2aWNlX2V4dF9BdWRpb1BvcnREZXZpY2VFeHQobGVnYWN5LmRldmljZSkpKTsKKyAgICAgICAgICAgIHJldHVybiBhaWRsOworICAgICAgICBjYXNlIEFVRElPX1BPUlRfVFlQRV9NSVg6CisgICAgICAgICAgICBVTklPTl9TRVQoYWlkbCwgbWl4LAorICAgICAgICAgICAgICAgICAgICAgIFZBTFVFX09SX1JFVFVSTihsZWdhY3kyYWlkbF9hdWRpb19wb3J0X21peF9leHRfQXVkaW9Qb3J0TWl4RXh0KGxlZ2FjeS5taXgpKSk7CisgICAgICAgICAgICByZXR1cm4gYWlkbDsKKyAgICAgICAgY2FzZSBBVURJT19QT1JUX1RZUEVfU0VTU0lPTjoKKyAgICAgICAgICAgIFVOSU9OX1NFVChhaWRsLCB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FjeS5mb3JtYXQpKTsKKworICAgIGlmIChsZWdhY3kubnVtX3NhbXBsZV9yYXRlcyA+IHN0ZDo6c2l6ZShsZWdhY3kuc2FtcGxlX3JhdGVzKSkgeworICAgICAgICByZXR1cm4gdW5leHBlY3RlZChCQURfVkFMVUUpOworICAgIH0KKyAgICBSRVRVUk5fSUZfRVJST1IoCisgICAgICAgICAgICBjb252ZXJ0UmFuZ2UobGVnYWN5LnNhbXBsZV9yYXRlcywgbGVnYWN5LnNhbXBsZV9yYXRlcyArIGxlZ2FjeS5udW1fc2FtcGxlX3JhdGVzLAorICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6YmFja19pbnNlcnRlcihhaWRsLnNhbXBsaW5nUmF0ZXMpLAorICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnZlcnRJbnRlZ3JhbDx1bnNpZ25lZCBpbnQsIGludDMyX3Q+KSk7CisKKyAgICBpZiAobGVnYWN5Lm51bV9jaGFubmVsX21hc2tzID4gc3RkOjpzaXplKGxlZ2FjeS5jaGFubmVsX21hc2tzKSkgeworICAgICAgICByZXR1cm4gdW5leHBlY3RlZChCQURfVkFMVUUpOworICAgIH0KKyAgICBSRVRVUk5fSUZfRVJST1IoCisgICAgICAgICAgICBjb252ZXJ0UmFuZ2UobGVnYWN5LmNoYW5uZWxfbWFza3MsIGxlZ2FjeS5jaGFubmVsX21hc2tzICsgbGVnYWN5Lm51bV9jaGFubmVsX21hc2tzLAorICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6YmFja19pbnNlcnRlcihhaWRsLmNoYW5uZWxNYXNrcyksCisgICAgICAgICAgICAgICAgICAgICAgICAgbGVnYWN5MmFpZGxfYXVkaW9fY2hhbm5lbF9tYXNrX3RfaW50MzJfdCkpOworCisgICAgYWlkbC5lbmNhcHN1bGF0aW9uVHlwZSA9IFZBTFVFX09SX1JFVFVSTigKKyAgICAgICAgICAgIGxlZ2FjeTJhaWRsX2F1ZGlvX2VuY2Fwc3VsYXRpb25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AorICAgICAgICAiYXVkaW9wb2xpY3ktYWlkbC1jcHAiLAorICAgICAgICAiYXYtdHlwZXMtYWlkbC1jcHAiLAorICAgIF0sCisgICAgdGFyZ2V0OiB7CisgICAgICAgIGRhcndpbjogeworICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsCisgICAgICAgIH0sCisgICAgfSwKIH0KIAogY2NfbGlicmFyeV9zaGFyZWQgewpAQCAtMjEsMTAgKzQ2LDE2IEBACiAgICAgICAgICJBdWRpb1BvbGljeS5jcHAiLAogICAgICAgICAiQXVkaW9Qcm9kdWN0U3RyYXRlZ3kuY3BwIiwKICAgICAgICAgIkF1ZGlvVm9sdW1lR3JvdXAuY3BwIiwKKyAgICAgICAgIlBvbGljeUFpZGxDb252ZXJzaW9uLmNwcCIKICAgICBdLAogICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJhdWRpb2NsaWVudC10eXBlcy1haWRsLWNwcCIsCisgICAgICAgICJhdWRpb2ZsaW5nZXItYWlkbC1jcHAiLAorICAgICAgICAiYXVkaW9wb2xpY3ktYWlkbC1jcHAiLAorICAgICAgICAiYXVkaW9wb2xpY3ktdHlwZXMtYWlkbC1jcHAiLAogICAgICAgICAiY2FwdHVyZV9zdGF0ZV9saXN0ZW5lci1haWRsLWNwcCIsCiAgICAgICAgICJsaWJhdWRpb2ZvdW5kYXRpb24iLAorICAgICAgICAibGliYXVkaW9jbGllbnRfYWlkbF9jb252ZXJzaW9uIiwKICAgICAgICAgImxpYmF1ZGlvdXRpbHMiLAogICAgICAgICAibGliYmluZGVyIiwKICAgICAgICAgImxpYmN1dGlscyIsCkBAIC0zOCwxOCArNjksMjUgQEAKICAgICBpbmNsdWRlX2RpcnM6IFsic3lzdGVtL21lZGlhL2F1ZGlvX3V0aWxzL2luY2x1ZGUiXSwKICAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUiXSwKICAgICBleHBvcnRfc2hhcmVkX2xpYl9oZWFkZXJzOiBbCisgICAgIC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NwcCIsCiAgICAgICAgICJjYXB0dXJlX3N0YXRlX2xpc3RlbmVyLWFpZGwtY3BwIiwKKyAgICAgICAgImxpYmF1ZGlvY2xpZW50X2FpZGxfY29udmVyc2lvbiIsCiAgICAgICAgICJsaWJhdWRpb2ZvdW5kYXRpb24iLAogICAgICAgICAibGliYXVkaW91dGlscyIsCiAgICAgICAgICJsaWJhdWRpb3BvbGljeSIsCkBAIC05NCwxNiArMTI5LDI0IEBACiAgICAgICAgICJsaWJtZWRpYXV0aWxzIiwKICAgICAgICAgImxpYm5ibG9nIiwKICAgICAgICAgImxpYnByb2Nlc3Nncm91cCIsCisgICAgICAgICJsaWJzaG1lbWNvbXBhdCIsCiAgICAgICAgICJsaWJ1dGlscyIsCiAgICAgICAgICJsaWJ2aWJyYXRvciIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCiAgICAgXSwKLSAgICBleHBvcnRfc2hhcmVkX2xpYl9oZWFkZXJzOiBbImxpYmJpbmRlciJdLAorICAgIGV4cG9ydF9zaGFyZWRfbGliX2hlYWRlcnM6IFsKKyAgICAgICAgImF1ZGlvZmxpbmdlci1haWRsLWNwcCIsCisgICAgICAgICJhdWRpb3BvbGljeS1haWRsLWNwcCIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCisgICAgICAgICJsaWJiaW5kZXIiLAorICAgIF0sCiAKICAgICBpbmNsdWRlX2RpcnM6IFsKICAgICAgICAgImZyYW1ld29ya3MvYXYvbWVkaWEvbGlibmJhaW8vaW5jbHVkZV9tb25vLyIsCiAgICAgXSwKICAgICBsb2NhbF9pbmNsdWRlX2RpcnM6IFsKLSAgICAgICAgImluY2x1ZGUvbWVkaWEiLCAiYWlkbCIKKyAgICAgICAgImluY2x1ZGUvbWVkaWEiLAorICAgICAgICAiYWlkbCIsCiAgICAgXSwKICAgICBoZWFkZXJfbGliczogWwogICAgICAgICAibGliYXVkaW9jbGllbnRfaGVhZGVycyIsCkBAIC0xMTEsMTAgKzE1NCwxNiBAQAogICAgICAgICAibGlibWVkaWFfaGVhZGVycyIsCiAgICAgXSwKICAgICBleHBvcnRfaGVhZGVyX2xpYl9oZWFkZXJzOiBbImxpYmF1ZGlvY2xpZW50X2hlYWRlcnMiXSwKKyAgICBleHBvcnRfc3RhdGljX2xpYl9oZWFkZXJzOiBbCisgICAgICAgICJlZmZlY3QtYWlkbC1jcHAiLAorICAgICAgICAic2hhcmVkLWZpbGUtcmVnaW9uLWFpZGwtY3BwIiwKKyAgICBdLAogCi0gICAgLy8gZm9yIG1lbW9yeSBoZWFwIGFuYWx5c2lzCiAgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImVmZmVjdC1haWRsLWNwcCIsCisgICAgICAgIC8vIGZvciBtZW1vcnkgaGVhcCBhbmFseXNpcwogICAgICAgICAibGliY19tYWxsb2NfZGVidWdfYmFja3RyYWNlIiwKKyAgICAgICAgInNoYXJlZC1maWxlLXJlZ2lvbi1haWRsLWNwcCIsCiAgICAgXSwKICAgICBjZmxhZ3M6IFsKICAgICAgICAgIi1XYWxsIiwKQEAgLTEyMiwxMyArMTcxLDkxIEBACiAgICAgICAgICItV25vLWVycm9yPWRlcHJlY2F0ZWQtZGVjbGFyYXRpb25zIiwKICAgICBdLAogICAgIHNhbml0aXplOiB7Ci0gICAgICAgIG1pc2NfdW5kZWZpbmVkIDogWworICAgICAgICBtaXNjX3VuZGVmaW5lZDogWwogICAgICAgICAgICAgInVuc2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAogICAgICAgICAgICAgInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKICAgICAgICAgXSwKICAgICB9LAogfQogCisvLyBUaGlzIGlzIGludGVuZGVkIGZvciBjbGllbnRzIG5lZWRpbmcgdG8gaW5jbHVkZSBBaWRsQ29udmVyc2lvblV0aWwuaCwgd2l0aG91dCBkcmFnZ2luZyBpbiBhIGxvdCBvZiBleHRyYQorLy8gZGVwZW5kZW5jaWVzLgorY2NfbGlicmFyeV9oZWFkZXJzIHsKKyAgICBuYW1lOiAibGliYXVkaW9jbGllbnRfYWlkbF9jb252ZXJzaW9uX3V0aWwiLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIHZlbmRvcl9hdmFpbGFibGU6IHRydWUsCisgICAgZG91YmxlX2xvYWRhYmxlOiB0cnVlLAorICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKKyAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJpbmNsdWRlIiwKKyAgICBdLAorICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJiYXNlX2hlYWRlcnMiLAorICAgIF0sCisgICAgZXhwb3J0X2hlYWRlcl9saWJfaGVhZGVyczogWworICAgICAgICAibGliYmFzZV9oZWFkZXJzIiwKKyAgICBdLAorICAgIGFwZXhfYXZhaWxhYmxlOiBbCisgICAgICAgICIvL2FwZXhfYXZhaWxhYmxlOnBsYXRmb3JtIiwKKyAgICAgICAgImNvbS5hbmRyb2lkLmJsdWV0b290aC51cGRhdGFibGUiLAorICAgICAgICAiY29tLmFuZHJvaWQubWVkaWEiLAorICAgICAgICAiY29tLmFuZHJvaWQubWVkaWEuc3djb2RlYyIsCisgICAgXSwKKyAgICB0YXJnZXQ6IHsKKyAgICAgICAgZGFyd2luOiB7CisgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSwKKyAgICAgICAgfSwKKyAgICB9LAorfQorCitjY19saWJyYXJ5IHsKKyAgICBuYW1lOiAibGliYXVkaW9jbGllbnRfYWlkbF9jb252ZXJzaW9uIiwKKyAgICBzcmNzOiBbIkFpZGxDb252ZXJzaW9uLmNwcCJdLAorICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsiaW5jbHVkZSJdLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIHZlbmRvcl9hdmFpbGFibGU6IHRydWUsCisgICAgZG91YmxlX2xvYWRhYmxlOiB0cnVlLAorICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKKyAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGliYXVkaW9jbGllbnRfYWlkbF9jb252ZXJzaW9uX3V0aWwiLAorICAgICAgICAibGliYXVkaW9fc3lzdGVtX2hlYWRlcnMiLAorICAgIF0sCisgICAgZXhwb3J0X2hlYWRlcl9saWJfaGVhZGVyczogWworICAgICAgICAibGliYXVkaW9jbGllbnRfYWlkbF9jb252ZXJzaW9uX3V0aWwiLAorICAgIF0sCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImF1ZGlvY2xpZW50LXR5cGVzLWFpZGwtY3BwIiwKKyAgICAgICAgImxpYmJhc2UiLAorICAgICAgICAibGliYmluZGVyIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgICAgICJsaWJzaG1lbWNvbXBhdCIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgICAgICJzaGFyZWQtZmlsZS1yZWdpb24tYWlkbC1jcHAiLAorICAgICAgICAiZnJhbWV3b3JrLXBlcm1pc3Npb24tYWlkbC1jcHAiLAorICAgIF0sCisgICAgZXhwb3J0X3NoYXJlZF9saWJfaGVhZGVyczogWworICAgICAgICAiYXVkaW9jbGllbnQtdHlwZXMtYWlkbC1jcHAiLAorICAgICAgICAibGliYmFzZSIsCisgICAgICAgICJzaGFyZWQtZmlsZS1yZWdpb24tYWlkbC1jcHAiLAorICAgIF0sCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV2FsbCIsCisgICAgICAgICItV2Vycm9yIiwKKyAgICAgICAgIi1Xbm8tZXJyb3I9ZGVwcmVjYXRlZC1kZWNsYXJhdGlvbnMiLAorICAgIF0sCisgICAgc2FuaXRpemU6IHsKKyAgICAgICAgbWlzY191bmRlZmluZWQ6IFsKKyAgICAgICAgICAgICJ1bnNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgICAgICJzaWduZWQtaW50ZWdlci1v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ICAgICAgICAiYWlkbC9hbmRyb2lkL21lZGlhL0V4dHJhQXVkaW9EZXNjcmlwdG9yLmFpZGwiLAorICAgICAgICAiYWlkbC9hbmRyb2lkL21lZGlhL1RyYWNrU2Vjb25kYXJ5T3V0cHV0SW5mby5haWRsIiwKKyAgICBdLAorICAgIGltcG9ydHM6IFsKKyAgICAgICAgImF1ZGlvX2NvbW1vbi1haWRsIiwKKyAgICAgICAgImZyYW1ld29yay1wZXJtaXNzaW9uLWFpZGwiLAorICAgIF0sCisgICAgYmFja2VuZDogeworICAgICAgICBjcHA6IHsKKyAgICAgICAgICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKKyAgICAgICAgICAgIGFwZXhfYXZhaWxhYmxlOiBbCisgICAgICAgICAgICAgICAgIi8vYXBleF9hdmFpbGFibGU6cGxhdGZvcm0iLAorICAgICAgICAgICAgICAgICJjb20uYW5kcm9pZC5tZWRpYSIsCisgICAgICAgICAgICBdLAorICAgICAgICB9LAorICAgIH0sCit9CithaWRsX2ludGVyZmFjZSB7CisgICAgbmFtZTogImF1ZGlvcG9saWN5LXR5cGVzLWFpZGwiLAorICAgIHVuc3RhYmxlOiB0cnVlLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIHZlbmRvcl9hdmFpbGFibGU6IHRydWUsCisgICAgZG91YmxlX2xvYWRhYmxlOiB0cnVlLAorICAgIGxvY2FsX2luY2x1ZGVfZGlyOiAiYWlkbCIsCisgICAgc3JjczogWworICAgICAgICAiYWlkbC9hbmRyb2lkL21lZGlhL0F1ZGlvQXR0cmlidXRlc0V4LmFpZGwiLAorICAgICAgICAiYWlkbC9hbmRyb2lkL21lZGlhL0F1ZGlvTWl4LmFpZGwiLAorICAgICAgICAiYWlkbC9hbmRyb2lkL21lZGlhL0F1ZGlvTWl4Q2FsbGJhY2tGbGFnLmFpZGwiLAorICAgICAgICAiYWlkbC9hbmRyb2lkL21lZGlhL0F1ZGlvTWl4TWF0Y2hDcml0ZXJ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ZGwiLAorICAgICAgICAiYWlkbC9hbmRyb2lkL21lZGlhL1JlbmRlclBvc2l0aW9uLmFpZGwiLAorCisgICAgICAgICJhaWRsL2FuZHJvaWQvbWVkaWEvSUF1ZGlvRmxpbmdlclNlcnZpY2UuYWlkbCIsCisgICAgICAgICJhaWRsL2FuZHJvaWQvbWVkaWEvSUF1ZGlvRmxpbmdlckNsaWVudC5haWRsIiwKKyAgICAgICAgImFpZGwvYW5kcm9pZC9tZWRpYS9JQXVkaW9SZWNvcmQuYWlkbCIsCisgICAgICAgICJhaWRsL2FuZHJvaWQvbWVkaWEvSUF1ZGlvVHJhY2suYWlkbCIsCisgICAgICAgICJhaWRsL2FuZHJvaWQvbWVkaWEvSUF1ZGlvVHJhY2tDYWxsYmFjay5haWRsIiwKKyAgICBdLAorICAgIGltcG9ydHM6IFsKKyAgICAgICAgImF1ZGlvX2NvbW1vbi1haWRsIiwKKyAgICAgICAgImF1ZGlvY2xpZW50LXR5cGVzLWFpZGwiLAorICAgICAgICAiYXYtdHlwZXMtYWlkbCIsCisgICAgICAgICJlZmZlY3QtYWlkbCIsCisgICAgICAgICJzaGFyZWQtZmlsZS1yZWdpb24tYWlkbCIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsIiwKKyAgICBdLAorICAgIGRvdWJsZV9sb2FkYWJsZTogdHJ1ZSwKKyAgICBiYWNrZW5kOiB7CisgICAgICAgIGNwcDogeworICAgICAgICAgICAgbWluX3Nka192ZXJzaW9uOiAiMjkiLAorICAgICAgICAgICAgYXBleF9hdmFpbGFibGU6IFsKKyAgICAgICAgICAgICAgICAiLy9hcGV4X2F2YWlsYWJsZTpwbGF0Zm9ybSIsCisgICAgICAgICAgICAgICAgImNvbS5hbmRyb2lkLm1lZGlhIiwKKyAgICAgICAgICAgIF0sCisgICAgICAgIH0sCisgICAgfSwKK30KKworYWlkbF9pbnRlcmZhY2UgeworICAgIG5hbWU6ICJhdWRpb3BvbGljeS1haWRsIiwKKyAgICB1bnN0YWJsZTogdHJ1ZSwKKyAgICBsb2NhbF9pbmNsdWRlX2RpcjogImFpZGwiLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIHZlbmRvcl9hdmFpbGFibGU6IHRydWUsCisgICAgc3JjczogWworICAgICAgICAiYWlkbC9hbmRyb2lkL21lZGlhL0dldElucHV0Rm9yQXR0clJlc3BvbnNlLmFpZGwiLAorICAgICAgICAiYWlkbC9hbmRyb2lkL21lZGlhL0dldE91dHB1dEZvckF0dHJSZXNwb25zZS5haWRsIiwKKyAgICAgICAgImFpZGwvYW5kcm9pZC9tZWRpYS9JbnQuYWlkbCIsCisgICAgICAgICJhaWRsL2FuZHJvaWQvbWVkaWEvUmVjb3JkQ2xpZW50SW5mby5haWRsIiwKKyAgICAgICAgImFpZGwvYW5kcm9pZC9tZWRpYS9JQXVkaW9Qb2xpY3lTZXJ2aWNlLmFpZGwiLAorICAgICAgICAiYWlkbC9hbmRyb2lkL21lZGlhL0lBdWRpb1BvbGljeVNlcnZpY2VDbGllbnQuYWlkbCIsCisgICAgXSwKKyAgICBpbXBvcnRzOiBbCisgICAgICAgICJhdWRpb19jb21tb24tYWlkbCIsCisgICAgICAgICJhdWRpb2NsaWVudC10eXBlcy1haWRsIiwKKyAgICAgICAgImF1ZGlvcG9saWN5LXR5cGVzLWFpZGwiLAorICAgICAgICAiY2FwdHVyZV9zdGF0ZV9saXN0ZW5lci1haWRsIiwKKyAgICAgICAgImZyYW1ld29yay1wZXJtaXNzaW9uLWFpZGwiLAorICAgIF0sCisKKyAgICBkb3VibGVfbG9hZGFibGU6IHRydWUsCisgICAgYmFja2VuZDogeworICAgICAgICBjcHA6IHsKKyAgICAgICAgICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKKyAgICAgICAgICAgIGFwZXhfYXZhaWxhYmxlOiBbCisgICAgICAgICAgICAgICAgIi8vYXBleF9hdmFpbGFibGU6cGxhdGZvcm0iLAorICAgICAgICAgICAgICAgICJj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hbS0+dnNpemU7CiAKICAgICBBTE9HVigic2V0UGFyYW1ldGVyOiBwYXJhbTogJWQsIHBhcmFtMjogJWQiLCAqKGludCAqKXBhcmFtLT5kYXRhLAogICAgICAgICAgICAgKHBhcmFtLT5wc2l6ZSA9PSA4KSA/ICooKGludCAqKXBhcmFtLT5kYXRhICsgMSk6IC0xKTsKIAotICAgIHJldHVybiBtSUVmZmVjdC0+Y29tbWFuZChFRkZFQ1RfQ01EX1NFVF9QQVJBTSwgc2l6ZW9mIChlZmZlY3RfcGFyYW1fdCkgKyBwc2l6ZSwgcGFyYW0sICZzaXplLAotICAgICAgICAgICAgJnBhcmFtLT5zdGF0dXMpOworICAgIHN0ZDo6dmVjdG9yPHVpbnQ4X3Q+IGNtZDsKKyAgICBhcHBlbmRUb0J1ZmZlcihwYXJhbSwgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHBzaXplLCAmY21kKTsKKyAgICBzdGQ6OnZlY3Rvcjx1aW50OF90PiByZXNwb25zZTsKKyAgICBzdGF0dXNfdCBzdGF0dXM7CisgICAgU3RhdHVzIGJzID0gbUlFZmZlY3QtPmNvbW1hbmQoRUZGRUNUX0NNRF9TRVRfUEFSQU0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihpbnQpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZyZXNwb25zZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmc3RhdHVzKTsKKyAgICBpZiAoIWJzLmlzT2soKSkgeworICAgICAgICBzdGF0dXMgPSBzdGF0dXNURnJvbUJpbmRlclN0YXR1cyhicyk7CisgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgfQorICAgIGFzc2VydChyZXNwb25zZS5zaXplKCkgPT0gc2l6ZW9mKGludCkpOworICAgIG1lbWNweSgmcGFyYW0tPnN0YXR1cywgcmVzcG9uc2UuZGF0YSgpLCByZXNwb25zZS5zaXplKCkpOworICAgIHJldHVybiBzdGF0dXM7CiB9CiAKIHN0YXR1c190IEF1ZGlvRWZmZWN0OjpzZXRQYXJhbWV0ZXJEZWZlcnJlZChlZmZlY3RfcGFyYW1fdCAqcGFyYW0pCkBAIC0zMzgsOCArNDE0LDE4IEBACiAgICAgaWYgKG1DYmxrLT5jbGllbnRJbmRleCA9PSAwKSB7CiAgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKICAgICB9Ci0gICAgdWludDMyX3Qgc2l6ZSA9IDA7Ci0gICAgcmV0dXJuIG1JRWZmZWN0LT5jb21tYW5kKEVGRkVDVF9DTURfU0VUX1BBUkFNX0NPTU1JVCwgMCwgTlVMTCwgJnNpemUsIE5VTEwpOworICAgIHN0ZDo6dmVjdG9yPHVpbnQ4X3Q+IGNtZDsKKyAgICBzdGQ6OnZlY3Rvcjx1aW50OF90PiByZXNwb25zZTsKKyAgICBzdGF0dXNfdCBzdGF0dXM7CisgICAgU3RhdHVzIGJzID0gbUlFZmZlY3QtPmNvbW1hbmQoRUZGRUNUX0NNRF9TRVRfUEFSQU1fQ09NTUlULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZyZXNwb25zZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmc3RhdHVzKTsKKyAgICBpZiAoIWJzLmlzT2soKSkgeworICAgICAgICBzdGF0dXMgPSBzdGF0dXNURnJvbUJpbmRlclN0YXR1cyhicyk7CisgICAgfQorICAgIHJldHVybiBzdGF0dXM7CiB9CiAKIHN0YXR1c190IEF1ZGlvRWZmZWN0OjpnZXRQYXJhbWV0ZXIoZWZmZWN0X3BhcmFtX3QgKnBhcmFtKQpAQCAtMzYxLDggKzQ0NywxOCBAQAogICAgIHVpbnQzMl90IHBzaXplID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gICAgICAgICAgICAgIHZvaWQgKmNtZERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgcmVwbHlTaXplIF9fdW51c2VkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgKnJlcGx5RGF0YSkKK3ZvaWQgQXVkaW9FZmZlY3Q6OmNvbW1hbmRFeGVjdXRlZChpbnQzMl90IGNtZENvZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8dWludDhfdD4mIGNtZERhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8dWludDhfdD4mIHJlcGx5RGF0YSkKIHsKLSAgICBpZiAoY21kRGF0YSA9PSBOVUxMIHx8IHJlcGx5RGF0YSA9PSBOVUxMKSB7CisgICAgaWYgKGNtZERhdGEuZW1wdHkoKSB8fCByZXBseURhdGEuZW1wdHkoKSkgewogICAgICAgICByZXR1cm47CiAgICAgfQogCiAgICAgaWYgKG1DYmYgIT0gTlVMTCAmJiBjbWRDb2RlID09IEVGRkVDVF9DTURfU0VUX1BBUkFNKSB7Ci0gICAgICAgIGVmZmVjdF9wYXJhbV90ICpjbWQgPSAoZWZmZWN0X3BhcmFtX3QgKiljbWREYXRhOwotICAgICAgICBjbWQtPnN0YXR1cyA9ICooaW50MzJfdCAqKXJlcGx5RGF0YTsKKyAgICAgICAgc3RkOjp2ZWN0b3I8dWludDhfdD4gY21kRGF0YUNvcHkoY21kRGF0YSk7CisgICAgICAgIGVmZmVjdF9wYXJhbV90KiBjbWQgPSByZWludGVycHJldF9jYXN0PGVmZmVjdF9wYXJhbV90ICo+KGNtZERhdGFDb3B5LmRhdGEoKSk7CisgICAgICAgIGNtZC0+c3RhdHVzID0gKnJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgaW50MzJfdCAqPihyZXBseURhdGEuZGF0YSgpKTsKICAgIC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ICBtTG9nU2Vzc2lvbklkID0gbG9nU2Vzc2lvbklkOworICAgICBtZWRpYW1ldHJpY3M6OkxvZ0l0ZW0obU1ldHJpY3NJZCkKKyAgICAgICAgIC5zZXQoQU1FRElBTUVUUklDU19QUk9QX0VWRU5ULCBBTUVESUFNRVRSSUNTX1BST1BfRVZFTlRfVkFMVUVfU0VUTE9HU0VTU0lPTklEKQorICAgICAgICAgLnNldChBTUVESUFNRVRSSUNTX1BST1BfTE9HU0VTU0lPTklELCBsb2dTZXNzaW9uSWQpCisgICAgICAgICAucmVjb3JkKCk7Cit9CisKK3N0YXR1c190IEF1ZGlvUmVjb3JkOjpzaGFyZUF1ZGlvSGlzdG9yeShjb25zdCBzdGQ6OnN0cmluZyYgc2hhcmVkUGFja2FnZU5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50NjRfdCBzaGFyZWRTdGFydE1zKQoreworICAgIEF1dG9NdXRleCBsb2NrKG1Mb2NrKTsKKyAgICBpZiAobUF1ZGlvUmVjb3JkID09IDApIHsKKyAgICAgICAgcmV0dXJuIE5PX0lOSVQ7CisgICAgfQorICAgIHN0YXR1c190IHN0YXR1cyA9IHN0YXR1c1RGcm9tQmluZGVyU3RhdHVzKAorICAgICAgICAgICAgbUF1ZGlvUmVjb3JkLT5zaGFyZUF1ZGlvSGlzdG9yeShzaGFyZWRQYWNrYWdlTmFtZSwgc2hhcmVkU3RhcnRNcykpOworICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKKyAgICAgICAgbVNoYXJlZEF1ZGlvUGFja2FnZU5hbWUgPSBzaGFyZWRQYWNrYWdlTmFtZTsKKyAgICAgICAgbVNoYXJlZEF1ZGlvU3RhcnRNcyA9IHNoYXJlZFN0YXJ0TXM7CisgICAgfQorICAgIHJldHVybiBzdGF0dXM7Cit9CisKIC8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT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9ydE5vRXJyb3IgPSBmYWxzZTsKICAgICB7CiAgICAgICAgIE11dGV4OjpBdXRvbG9jayBfbChnTG9jayk7CiAgICAgICAgIGlmIChnQXVkaW9GbGluZ2VyID09IDApIHsKLSAgICAgICAgICAgIHNwPElTZXJ2aWNlTWFuYWdlcj4gc20gPSBkZWZhdWx0U2VydmljZU1hbmFnZXIoKTsKICAgICAgICAgICAgIHNwPElCaW5kZXI+IGJpbmRlcjsKLSAgICAgICAgICAgIGRvIHsKLSAgICAgICAgICAgICAgICBiaW5kZXIgPSBzbS0+Z2V0U2VydmljZShTdHJpbmcxNigibWVkaWEuYXVkaW9fZmxpbmdlciIpKTsKLSAgICAgICAgICAgICAgICBpZiAoYmluZGVyICE9IDApCi0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIEFMT0dXKCJBdWRpb0ZsaW5nZXIgbm90IHB1Ymxpc2hlZCwgd2FpdGluZy4uLiIpOwotICAgICAgICAgICAgICAgIHVzbGVlcCg1MDAwMDApOyAvLyAwLjUgcwotICAgICAgICAgICAgfSB3aGlsZSAodHJ1ZSk7CisgICAgICAgICAgICBpZiAoZ0F1ZGlvRmxpbmdlckJpbmRlciAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgYmluZGVyID0gZ0F1ZGlvRmxpbmdlckJpbmRlcjsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc3A8SVNlcnZpY2VNYW5hZ2VyPiBzbSA9IGRlZmF1bHRTZXJ2aWNlTWFuYWdlcigpOworICAgICAgICAgICAgICAgIGRvIHsKKyAgICAgICAgICAgICAgICAgICAgYmluZGVyID0gc20tPmdldFNlcnZpY2UoU3RyaW5nMTYoSUF1ZGlvRmxpbmdlcjo6REVGQVVMVF9TRVJWSUNFX05BTUUpKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGJpbmRlciAhPSAwKQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgIC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ZXNjID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgbUlvRGVzY3JpcHRvcnMuYWRkKGlvRGVzYy0+bUlvSGFuZGxlLCBpb0Rlc2MpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGRldmljZUlkID0gb2xkRGVzYy0+Z2V0RGV2aWNlSWQoKTsKKyAgICAgICAgICAgICAgICAgICAgbUlvRGVzY3JpcHRvcnMucmVwbGFjZVZhbHVlRm9yKGlvRGVzYy0+bUlvSGFuZGxlLCBpb0Rlc2MpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChpb0Rlc2MtPmdldERldmljZUlkKCkgIT0gQVVESU9fUE9SVF9IQU5ETEVfTk9ORSkgeworICAgICAgICAgICAgICAgICAgICBkZXZpY2VJZCA9IGlvRGVzYy0+Z2V0RGV2aWNlSWQoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50ID09IEFVRElPX09VVFBVVF9PUEVORUQgfHwgZXZlbnQgPT0gQVVESU9fSU5QVVRfT1BFTkVEKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBhdXRvIGl0ID0gbUF1ZGlvRGV2aWNlQ2FsbGJhY2tzLmZpbmQoaW9EZXNjLT5tSW9IYW5kbGUpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0ICE9IG1BdWRpb0RldmljZUNhbGxiYWNrcy5lbmQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrcyA9IGl0LT5zZWNvbmQ7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgQUxPR1YoImlvQ29uZmlnQ2hhbmdlZCgpIG5ldyAlcyAlcyAlZCBzYW1wbGluZ1JhdGUgJXUsIGZvcm1hdCAlI3ggY2hhbm5lbCBtYXNrICUjeCAiCisgICAgICAgICAgICAgICAgICAgICAgImZyYW1lQ291bnQgJXp1IGRldmljZUlkICVkIiwKKyAgICAgICAgICAgICAgICAgICAgICBldmVudCA9PSBBVURJT19PVVRQVVRfT1BFTkVEIHx8IGV2ZW50ID09IEFVRElPX09VVFBVVF9SRUdJU1RFUkVEID8KKyAgICAgICAgICAgICAgICAgICAgICAib3V0cHV0IiA6ICJpbnB1dCIsCisgICAgICAgICAgICAgICAgICAgICAgZXZlbnQgPT0gQVVESU9fT1VUUFVUX09QRU5FRCB8fCBldmVudCA9PSBBVURJT19JTlBVVF9PUEVORUQgPworICAgICAgICAgICAgICAgICAgICAgICJvcGVuZWQiIDogInJlZ2lzdGVyZWQiLAorICAgICAgICAgICAgICAgICAgICAgIGlvRGVzYy0+bUlvSGFuZGxlLCBpb0Rlc2MtPm1TYW1wbGluZ1JhdGUsIGlvRGVzYy0+bUZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICBpb0Rlc2MtPm1DaGFubmVsTWFzaywKKyAgICAgICAgICAgICAgICAgICAgICBpb0Rlc2MtPm1GcmFtZUNvdW50LCBpb0Rlc2MtPmdldERldmljZUlkKCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBVURJT19PVVRQVVRfQ0xPU0VEOgorICAgICAgICAgICAgY2FzZSBBVURJT19JTlBVVF9DTE9TRUQ6IHsKKyAgICAgICAgICAgICAgICBpZiAoZ2V0SW9EZXNjcmlwdG9yX2woaW9EZXNjLT5tSW9IYW5kbGUpID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1coImlvQ29uZmlnQ2hhbmdlZCgpIGNsb3NpbmcgdW5rbm93biAlcyAlZCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50ID09IEFVRElPX09VVFBVVF9DTE9TRUQgPyAib3V0cHV0IiA6ICJpbnB1dCIsIGlvRGVzYy0+bUlvSGFuZGxlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIEFMT0dWKCJpb0NvbmZpZ0NoYW5nZWQoKSAlcyAlZCBjbG9zZWQiLAorICAgICAgICAgICAgICAgICAgICAgIGV2ZW50ID09IEFVRElPX09VVFBVVF9DTE9TRUQgPyAib3V0cHV0IiA6ICJpbnB1dCIsIGlvRGVzYy0+bUlvSGFuZGxlKTsKKworICAgICAgICAgICAgICAgIG1Jb0Rlc2NyaXB0b3JzLnJlbW92ZUl0ZW0oaW9EZXNjLT5tSW9IYW5kbGUpOworICAgICAgICAgICAgICAgIG1BdWRpb0RldmljZUNhbGxiYWNrcy5lcmFzZShpb0Rlc2MtPm1Jb0hhbmRsZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgIGNhc2UgQVVESU9fT1VUUFVUX0NPTkZJR19DSEFOR0VEOgorICAgICAgICAgICAgY2FzZSBBVURJT19JTlBVVF9DT05GSUdfQ0hBTkdFRDogeworICAgICAgICAgICAgICAgIHNwPEF1ZGlvSW9EZXNjcmlwdG9yPiBvbGREZXNjID0gZ2V0SW9EZXNjcmlwdG9yX2woaW9EZXNjLT5tSW9IYW5kbGUpOworICAgICAgICAgICAgICAgIGlmIChvbGREZXNjID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1coImlvQ29uZmlnQ2hhbmdlZCgpIG1vZGlmeWluZyB1bmtub3duICVzISAlZCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50ID09IEFVRElPX09VVFBVVF9DT05GSUdfQ0hBTkdFRCA/ICJvdXRwdXQiIDogImlucHV0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgaW9EZXNjLT5tSW9IYW5kbGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisKICAgICAgICAgICAgICAgICBkZXZpY2VJZCA9IG9sZERlc2MtPmdldERldmljZUlkKCk7CiAgICAgICAgICAgICAgICAgbUlvRGVzY3JpcHRvcnMucmVwbGFjZVZhbHVlRm9yKGlvRGVzYy0+bUlvSGFuZGxlLCBpb0Rlc2MpOwotICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBpZiAoaW9EZXNjLT5nZXREZXZpY2VJZCgpICE9IEFVRElPX1BPUlRfSEFORExFX05PTkUpIHsKLSAgICAgICAgICAgICAgICBkZXZpY2VJZCA9IGlvRGVzYy0+Z2V0RGV2aWNlSWQoKTsKLSAgICAgICAgICAgICAgICBpZiAoZXZlbnQgPT0gQVVESU9fT1VUUFVUX09QRU5FRCB8fCBldmVudCA9PSBBVURJT19JTlBVVF9PUEVORUQpIHsKKyAgICAgICAgICAgICAgICBpZiAoZGV2aWNlSWQgIT0gaW9EZXNjLT5nZXREZXZpY2VJZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIGRldmljZUlkID0gaW9EZXNjLT5nZXREZXZpY2VJZCgpOwogICAgICAgICAgICAgICAgICAgICBhdXRvIGl0ID0gbUF1ZGlvRGV2aWNlQ2FsbGJhY2tzLmZpbmQoaW9EZXNjLT5tSW9IYW5kbGUpOwogICAgICAgICAgICAgICAgICAgICBpZiAoaXQgIT0gbUF1ZGlvRGV2aWNlQ2FsbGJhY2tzLmVuZCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFja3MgPSBpdC0+c2Vjb25kOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIEFMT0dWKCJpb0NvbmZpZ0NoYW5nZWQoKSBuZXcgY29uZmlnIGZvciAlcyAlZCBzYW1wbGluZ1JhdGUgJXUsIGZvcm1hdCAlI3ggIgorICAgICAgICAgICAgICAgICAgICAgICJjaGFubmVsIG1hc2sgJSN4IGZyYW1lQ291bnQgJXp1IGZyYW1lQ291bnRIQUwgJXp1IGRldmljZUlkICVkIiwKKyAgICAgICAgICAgICAgICAgICAgICBldmVudCA9PSBBVURJT19PVVRQVVRfQ09ORklHX0NIQU5HRUQgPyAib3V0cHV0IiA6ICJpbnB1dCIsCisgICAgICAgICAgICAgICAgICAgICAgaW9EZXNjLT5tSW9IYW5kbGUsIGlvRGVzYy0+bVNhbXBsaW5nUmF0ZSwgaW9EZXNjLT5tRm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgIGlvRGVzYy0+bUNoYW5uZWxNYXNrLCBpb0Rlc2MtPm1GcmFtZUNvdW50LCBpb0Rlc2MtPm1GcmFtZUNvdW50SEFMLAorICAgICAgICAgICAgICAgICAgICAgIGlvRGVzYy0+Z2V0RGV2aWNlSWQoKSk7CisKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIEFMT0dWKCJpb0NvbmZpZ0NoYW5nZWQoKSBuZXcgJXMgJXMgJWQgc2FtcGxpbmdSYXRlICV1LCBmb3JtYXQgJSN4IGNoYW5uZWwgbWFzayAlI3ggIgotICAgICAgICAgICAgICAgICAgICAiZnJhbWVDb3VudCAlenUgZGV2aWNlSWQgJWQiLAotICAgICAgICAgICAgICAgICAgICBldmVudCA9PSBBVURJT19PVVRQVVRfT1BFTkVEIHx8IGV2ZW50ID09IEFVRElPX09VVFBVVF9SRUdJU1RFUkVEID8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAib3V0cHV0IiA6ICJpbnB1dCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQgPT0gQVVESU9fT1VUUFVUX09QRU5FRCB8fCBldmVudCA9PSBBVURJT19JTlBVVF9PUEVORUQgPwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICJvcGVuZWQiIDogInJlZ2lzdGVyZWQiLAotICAgICAgICAgICAgICAgICAgICBpb0Rlc2MtPm1Jb0hhbmRsZSwgaW9EZXNjLT5tU2FtcGxpbmdSYXRlLCBpb0Rlc2MtPm1Gb3JtYXQsIGlvRGVzYy0+bUNoYW5uZWxNYXNrLAotICAgICAgICAgICAgICAgICAgICBpb0Rlc2MtPm1GcmFtZUNvdW50LC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bGUpOwotICAgICAgICAgICAgaWYgKG9sZERlc2MgPT0gMCkgewotICAgICAgICAgICAgICAgIEFMT0dXKCJpb0NvbmZpZ0NoYW5nZWQoKSBtb2RpZnlpbmcgdW5rbm93biBvdXRwdXQhICVkIiwgaW9EZXNjLT5tSW9IYW5kbGUpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBkZXZpY2VJZCA9IG9sZERlc2MtPmdldERldmljZUlkKCk7Ci0gICAgICAgICAgICBtSW9EZXNjcmlwdG9ycy5yZXBsYWNlVmFsdWVGb3IoaW9EZXNjLT5tSW9IYW5kbGUsIGlvRGVzYyk7Ci0KLSAgICAgICAgICAgIGlmIChkZXZpY2VJZCAhPSBpb0Rlc2MtPmdldERldmljZUlkKCkpIHsKLSAgICAgICAgICAgICAgICBkZXZpY2VJZCA9IGlvRGVzYy0+Z2V0RGV2aWNlSWQoKTsKKyAgICAgICAgICAgIGNhc2UgQVVESU9fQ0xJRU5UX1NUQVJURUQ6IHsKKyAgICAgICAgICAgICAgICBzcDxBdWRpb0lvRGVzY3JpcHRvcj4gb2xkRGVzYyA9IGdldElvRGVzY3JpcHRvcl9sKGlvRGVzYy0+bUlvSGFuZGxlKTsKKyAgICAgICAgICAgICAgICBpZiAob2xkRGVzYyA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIEFMT0dXKCJpb0NvbmZpZ0NoYW5nZWQoKSBzdGFydCBjbGllbnQgb24gdW5rbm93biBpbyEgJWQiLCBpb0Rlc2MtPm1Jb0hhbmRsZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBBTE9HVigiaW9Db25maWdDaGFuZ2VkKCkgQVVESU9fQ0xJRU5UX1NUQVJURUQgIGlvICVkIHBvcnQgJWQgbnVtIGNhbGxiYWNrcyAlenUiLAorICAgICAgICAgICAgICAgICAgICAgIGlvRGVzYy0+bUlvSGFuZGxlLCBpb0Rlc2MtPm1Qb3J0SWQsIG1BdWRpb0RldmljZUNhbGxiYWNrcy5zaXplKCkpOworICAgICAgICAgICAgICAgIG9sZERlc2MtPm1QYXRjaCA9IGlvRGVzYy0+bVBhdGNoOwogICAgICAgICAgICAgICAgIGF1dG8gaXQgPSBtQXVkaW9EZXZpY2VDYWxsYmFja3MuZmluZChpb0Rlc2MtPm1Jb0hhbmRsZSk7CiAgICAgICAgICAgICAgICAgaWYgKGl0ICE9IG1BdWRpb0RldmljZUNhbGxiYWNrcy5lbmQoKSkgewotICAgICAgICAgICAgICAgICAgICBjYWxsYmFja3MgPSBpdC0+c2Vjb25kOworICAgICAgICAgICAgICAgICAgICBhdXRvIGNia3MgPSBpdC0+c2Vjb25kOworICAgICAgICAgICAgICAgICAgICBhdXRvIGl0MiA9IGNia3MuZmluZChpb0Rlc2MtPm1Qb3J0SWQpOworICAgICAgICAgICAgICAgICAgICBpZiAoaXQyICE9IGNia3MuZW5kKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrcy5lbXBsYWNlKGlvRGVzYy0+bVBvcnRJZCwgaXQyLT5zZWNvbmQpOworICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlSWQgPSBvbGREZXNjLT5nZXREZXZpY2VJZCgpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQotICAgICAgICAgICAgQUxPR1YoImlvQ29uZmlnQ2hhbmdlZCgpIG5ldyBjb25maWcgZm9yICVzICVkIHNhbXBsaW5nUmF0ZSAldSwgZm9ybWF0ICUjeCAiCi0gICAgICAgICAgICAgICAgICAgICJjaGFubmVsIG1hc2sgJSN4IGZyYW1lQ291bnQgJXp1IGZyYW1lQ291bnRIQUwgJXp1IGRldmljZUlkICVkIiwKLSAgICAgICAgICAgICAgICAgICAgZXZlbnQgPT0gQVVESU9fT1VUUFVUX0NPTkZJR19DSEFOR0VEID8gIm91dHB1dCIgOiAi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wotICAgICAgICAgICAgaWYgKGl0ICE9IG1BdWRpb0RldmljZUNhbGxiYWNrcy5lbmQoKSkgewotICAgICAgICAgICAgICAgIGF1dG8gY2JrcyA9IGl0LT5zZWNvbmQ7Ci0gICAgICAgICAgICAgICAgYXV0byBpdDIgPSBjYmtzLmZpbmQoaW9EZXNjLT5tUG9ydElkKTsKLSAgICAgICAgICAgICAgICBpZiAoaXQyICE9IGNia3MuZW5kKCkpIHsKLSAgICAgICAgICAgICAgICAgICBjYWxsYmFja3MuZW1wbGFjZShpb0Rlc2MtPm1Qb3J0SWQsIGl0Mi0+c2Vjb25kKTsKLSAgICAgICAgICAgICAgICAgICBkZXZpY2VJZCA9IG9sZERlc2MtPmdldERldmljZUlkKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9IGJyZWFrOwogICAgICAgICB9CiAKICAgICAgICAgZm9yIChhdXRvIHdwQ2JrIDogY2FsbGJhY2tzKSB7CkBAIC02MzksMTIgKzY1OCwxMyBAQAogICAgICAgICAvLyBJZiBjYWxsYmFja3NUb0NhbGwgaXMgbm90IGVtcHR5LCBpdCBpbXBsaWVzIGlvRGVzYy0+bUlvSGFuZGxlIGFuZCBkZXZpY2VJZCBhcmUgdmFsaWQKICAgICAgICAgY2ItPm9uQXVkaW9EZXZpY2VVcGRhdGUoaW9EZXNjLT5tSW9IYW5kbGUsIGRldmljZUlkKTsKICAgICB9CisKKyAgICByZXR1cm4gU3RhdHVzOjpvaygpOwogfQogCiBzdGF0dXNfdCBBdWRpb1N5c3RlbTo6QXVkaW9GbGluZ2VyQ2xpZW50OjpnZXRJbnB1dEJ1ZmZlclNpemUoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBzYW1wbGVSYXRlLCBhdWRpb19mb3JtYXRfdCBmb3JtYXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19j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hciAqZGV2aWNlX25hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1hdF90IGVuY29kZWRGb3JtYXQpCi17CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIqIGRldmljZV9hZGRyZXNzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyKiBkZXZpY2VfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZm9ybWF0X3QgZW5jb2RlZEZvcm1hdCkgewogICAgIGNvbnN0IHNwPElBdWRpb1BvbGljeVNlcnZpY2U+JiBhcHMgPSBBdWRpb1N5c3RlbTo6Z2V0X2F1ZGlvX3BvbGljeV9zZXJ2aWNlKCk7Ci0gICAgY29uc3QgY2hhciAqYWRkcmVzcyA9ICIiOwotICAgIGNvbnN0IGNoYXIgKm5hbWUgPSAiIjsKKyAgICBjb25zdCBjaGFyKiBhZGRyZXNzID0gIiI7CisgICAgY29uc3QgY2hhciogbmFtZSA9ICIiOwogCiAgICAgaWYgKGFwcyA9PSAwKSByZXR1cm4gUEVSTUlTU0lPTl9ERU5JRUQ7CiAKQEAgLTgyNiwyNiArODQ0LDQ2IEBACiAgICAgaWYgKGRldmljZV9uYW1lICE9IE5VTEwpIHsKICAgICAgICAgbmFtZSA9IGRldmljZV9uYW1lOwogICAgIH0KLSAgICByZXR1cm4gYXBzLT5zZXREZXZpY2VDb25uZWN0aW9uU3RhdGUoZGV2aWNlLCBzdGF0ZSwgYWRkcmVzcywgbmFtZSwgZW5jb2RlZEZvcm1hdCk7CisKKyAgICBtZWRpYTo6QXVkaW9EZXZpY2UgZGV2aWNlQWlkbDsKKyAgICBkZXZpY2VBaWRsLnR5cGUgPSBWQUxVRV9PUl9SRVRVUk5fU1RBVFVTKGxlZ2FjeTJhaWRsX2F1ZGlvX2RldmljZXNfdF9pbnQzMl90KGRldmljZSkpOworICAgIGRldmljZUFpZGwuYWRkcmVzcyA9IGFkZHJlc3M7CisKKyAgICByZXR1cm4gc3RhdHVzVEZyb21CaW5kZXJTdGF0dXMoCisgICAgICAgICAgICBhcHMtPnNldERldmljZUNvbm5lY3Rpb25TdGF0ZSgKKyAgICAgICAgICAgICAgICAgICAgZGV2aWNlQWlkbCwKKyAgICAgICAgICAgICAgICAgICAgVkFMVUVfT1JfUkVUVVJOX1NUQVRVUygKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdhY3kyYWlkbF9hdWRpb19wb2xpY3lfZGV2X3N0YXRlX3RfQXVkaW9Qb2xpY3lEZXZpY2VTdGF0ZShzdGF0ZSkpLAorICAgICAgICAgICAgICAgICAgICBuYW1lLAorICAgICAgICAgICAgICAgICAgICBWQUxVRV9PUl9SRVRVUk5fU1RBVFVTKGxlZ2FjeTJhaWRsX2F1ZGlvX2Zvcm1hdF90X0F1ZGlvRm9ybWF0KGVuY29kZWRGb3JtYXQpKSkpOwogfQogCiBhdWRpb19wb2xpY3lfZGV2X3N0YXRlX3QgQXVkaW9TeXN0ZW06OmdldERldmljZUNvbm5lY3Rpb25TdGF0ZShhdWRpb19kZXZpY2VzX3QgZGV2aWNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcykKLXsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIqIGRldmljZV9hZGRyZXNzKSB7CiAgICAgY29uc3Qgc3A8SUF1ZGlvUG9saWN5U2VydmljZT4mIGFwcyA9IEF1ZGlvU3lzdGVtOjpnZXRfYXVkaW9fcG9saWN5X3NlcnZpY2UoKTsKICAgICBpZiAoYXBzID09IDApIHJldHVybiBBVURJT19QT0xJQ1lfREVWSU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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqZGV2aWNlX25hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1hdF90IGVuY29kZWRGb3JtYXQpCi17CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIqIGRldmljZV9hZGRyZXNzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyKiBkZXZpY2VfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZm9ybWF0X3QgZW5jb2RlZEZvcm1hdCkgewogICAgIGNvbnN0IHNwPElBdWRpb1BvbGljeVNlcnZpY2U+JiBhcHMgPSBBdWRpb1N5c3RlbTo6Z2V0X2F1ZGlvX3BvbGljeV9zZXJ2aWNlKCk7Ci0gICAgY29uc3QgY2hhciAqYWRkcmVzcyA9ICIiOwotICAgIGNvbnN0IGNoYXIgKm5hbWUgPSAiIjsKKyAgICBjb25zdCBjaGFyKiBhZGRyZXNzID0gIiI7CisgICAgY29uc3QgY2hhciogbmFtZSA9ICIiOwogCiAgICAgaWYgKGFwcyA9PSAwKSByZXR1cm4gUEVSTUlTU0lPTl9ERU5JRUQ7CiAKQEAgLTg1NSwyOTQgKzg5Myw1MjggQEAKICAgICBpZiAoZGV2aWNlX25hbWUgIT0gTlVMTCkgewogICAgICAgICBuYW1lID0gZGV2aWNlX25hbWU7CiAgICAgfQotICAgIHJldHVybiBhcHMtPmhhbmRsZURldmljZUNvbmZpZ0NoYW5nZShkZXZpY2UsIGFkZHJlc3MsIG5hbWUsIGVuY29kZWRGb3JtYXQpOworCisgICAgbWVkaWE6OkF1ZGlvRGV2aWNlIGRldmljZUFpZGw7CisgICAgZGV2aWNlQWlkbC50eXBlID0gV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AgICByZXR1cm4gYWlkbDJsZWdhY3lfaW50MzJfdF9hdWRpb19pb19oYW5kbGVfdChvdXRwdXRBaWRsKTsKKyAgICB9KCk7CisKKyAgICByZXR1cm4gcmVzdWx0LnZhbHVlX29yKEFVRElPX0lPX0hBTkRMRV9OT05FKTsKIH0KIAotc3RhdHVzX3QgQXVkaW9TeXN0ZW06OmdldE91dHB1dEZvckF0dHIoYXVkaW9fYXR0cmlidXRlc190ICphdHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICpvdXRwdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc3RyZWFtX3R5cGVfdCAqc3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IHBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX3QgKmNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19vdXRwdXRfZmxhZ3NfdCBmbGFncywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90ICpzZWxlY3RlZERldmljZUlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnBvcnRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxhdWRpb19pb19oYW5kbGVfdD4gKnNlY29uZGFyeU91dHB1dHMpCi17CitzdGF0dXNfdCBBdWRpb1N5c3RlbTo6Z2V0T3V0cHV0Rm9yQXR0cihhdWRpb19hdHRyaWJ1dGVzX3QqIGF0dHIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCogb3V0cHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zdHJlYW1fdHlwZV90KiBzdHJlYW0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlJiBhdHRyaWJ1dGlvblNvdXJjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2NvbmZpZ190KiBjb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19vdXRwdXRfZmxhZ3NfdCBmbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QqIHNlbGVjdGVkRGV2aWNlSWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90KiBwb3J0SWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxhdWRpb19pb19oYW5kbGVfdD4qIHNlY29uZGFyeU91dHB1dHMpIHsKKyAgICBpZiAoYXR0ciA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dFKCIlcyBOVUxMIGF1ZGlvIGF0dHJpYnV0ZXMiLCBfX2Z1bmNfXyk7CisgICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgfQorICAgIGlmIChvdXRwdXQgPT0gbnVsbHB0cikgeworICAgICAgICBBTE9H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bmRsZV90ICppbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fdW5pcXVlX2lkX3QgcmlpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IHBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgdWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTdHJpbmcxNiYgb3BQYWNrYWdlTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqY29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pbnB1dF9mbGFnc190IGZsYWdzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90ICpzZWxlY3RlZERldmljZUlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90ICpwb3J0SWQpCi17CitzdGF0dXNfdCBBdWRpb1N5c3RlbTo6Z2V0SW5wdXRGb3JBdHRyKGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCogYXR0ciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QqIGlucHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb191bmlxdWVfaWRfdCByaWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSAmYXR0cmlidXRpb25Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2NvbmZpZ19iYXNlX3QqIGNvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW5wdXRfZmxhZ3NfdCBmbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCogc2VsZWN0ZWREZXZpY2VJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCogcG9ydElkKSB7CisgICAgaWYgKGF0dHIgPT0gTlVMTCkgeworICAgICAgICBBTE9HRSgiZ2V0SW5wdXRGb3JBdHRyIE5VTEwgYXR0ciAtIHNob3VsZG4ndCBoYXBwZW4iKTsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisgICAgaWYgKGlucHV0ID09IE5VTEwpIHsKKyAgICAgICAgQUxPR0UoImdldElucHV0Rm9yQXR0ciBOVUxMIGlucHV0IC0gc2hvdWxkbid0IGhhcHBlbiIpOworICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgIH0KKyAgICBpZiAoc2VsZWN0ZWREZXZpY2VJZCA9PSBOVUxMKSB7CisgICAgICAgIEFMT0dFKCJnZXRJbnB1dEZvckF0dHIgTlVMTCBzZWxlY3RlZERldmljZUlkIC0gc2hvdWxkbid0IGhhcHBlbiIpOworICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgIH0KKyAgICBpZiAocG9ydElkID09IE5VTEwpIHsKKyAgICAgICAgQUxPR0UoImdldElucHV0Rm9yQXR0ciBOVUxMIHBvcnRJZCAtIHNob3VsZG4ndCBoYXBwZW4iKTsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisKICAgICBjb25zdCBzcDxJQXVkaW9Qb2xpY3lTZXJ2aWNlPiYgYXBzID0gQXV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YW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXhNaW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXhNYXgpCi17CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXhNaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXhNYXgpIHsKICAgICBjb25zdCBzcDxJQXVkaW9Qb2xpY3lTZXJ2aWNlPiYgYXBzID0gQXVkaW9TeXN0ZW06OmdldF9hdWRpb19wb2xpY3lfc2VydmljZSgpOwogICAgIGlmIChhcHMgPT0gMCkgcmV0dXJuIFBFUk1JU1NJT05fREVOSUVEOwotICAgIHJldHVybiBhcHMtPmluaXRTdHJlYW1Wb2x1bWUoc3RyZWFtLCBpbmRleE1pbiwgaW5kZXhNYXgpOworCisgICAgbWVkaWE6OkF1ZGlvU3RyZWFtVHlwZSBzdHJlYW1BaWRsID0gVkFMVUVfT1JfUkVUVVJOX1NUQVRVUygKKyAgICAgICAgICAgIGxlZ2FjeTJhaWRsX2F1ZGlvX3N0cmVhbV90eXBlX3RfQXVkaW9TdHJlYW1UeXBlKHN0cmVhbSkpOworICAgIGludDMyX3QgaW5kZXhNaW5BaWRsID0gVkFMVUVfT1JfUkVUVVJOX1NUQVRVUyhjb252ZXJ0SW50ZWdyYWw8aW50MzJfdD4oaW5kZXhNaW4pKTsKKyAgICBpbnQzMl90IGluZGV4TWF4QWlkbCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMoY29udmVydEludGVncmFsPGludDMyX3Q+KGluZGV4TWF4KSk7CisgICAgcmV0dXJuIHN0YXR1c1RGcm9tQmluZGVyU3RhdHVzKAorICAgICAgICAgICAgYXBzLT5pbml0U3RyZWFtVm9sdW1lKHN0cmVhbUFpZGwsIGluZGV4TWluQWlkbCwgaW5kZXhNYXhBaWRsKSk7CiB9CiAKIHN0YX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Xgoc3RyZWFtQWlkbCwgZGV2aWNlQWlkbCwgaW5kZXhBaWRsKSk7CiB9CiAKIHN0YXR1c190IEF1ZGlvU3lzdGVtOjpnZXRTdHJlYW1Wb2x1bWVJbmRleChhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgKmluZGV4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UpCi17CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KiBpbmRleCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19kZXZpY2VzX3QgZGV2aWNlKSB7CiAgICAgY29uc3Qgc3A8SUF1ZGlvUG9saWN5U2VydmljZT4mIGFwcyA9IEF1ZGlvU3lzdGVtOjpnZXRfYXVkaW9fcG9saWN5X3NlcnZpY2UoKTsKICAgICBpZiAoYXBzID09IDApIHJldHVybiBQRVJNSVNTSU9OX0RFTklFRDsKLSAgICByZXR1cm4gYXBzLT5nZXRTdHJlYW1Wb2x1bWVJbmRleChzdHJlYW0sIGluZGV4LCBkZXZpY2UpOworCisgICAgbWVkaWE6OkF1ZGlvU3RyZWFtVHlwZSBzdHJlYW1BaWRsID0gVkFMVUVfT1JfUkVUVVJOX1NUQVRVUygKKyAgICAgICAgICAgIGxlZ2FjeTJhaWRsX2F1ZGlvX3N0cmVhbV90eXBlX3RfQXVkaW9TdHJlYW1UeXBlKHN0cmVhbSkpOworICAgIGludDMyX3QgZGV2aWNlQWlkbCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMobGVnYWN5MmFpZGxfYXVkaW9fZGV2aWNlc190X2ludDMyX3QoZGV2aWNlKSk7CisgICAgaW50MzJfdCBpbmRleEFpZGw7CisgICAgUkVUVVJOX1NUQVRVU19JRl9FUlJPUihzdGF0d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GVybmFsIGF0dHJBaWRsID0gVkFMVUVfT1JfUkVUVVJOX1NUQVRVUygKKyAgICAgICAgICAgIGxlZ2FjeTJhaWRsX2F1ZGlvX2F0dHJpYnV0ZXNfdF9BdWRpb0F0dHJpYnV0ZXNJbnRlcm5hbChhdHRyKSk7CisgICAgaW50MzJfdCBpbmRleEFpZGwgPSBWQUxVRV9PUl9SRVRVUk5fU1RBVFVTKGNvbnZlcnRJbnRlZ3JhbDxpbnQzMl90PihpbmRleCkpOworICAgIGludDMyX3QgZGV2aWNlQWlkbCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMobGVnYWN5MmFpZGxfYXVkaW9fZGV2aWNlc190X2ludDMyX3QoZGV2aWNlKSk7CisgICAgcmV0dXJuIHN0YXR1c1RGcm9tQmluZGVyU3RhdHVzKAorICAgICAgICAgICAgYXBzLT5zZXRWb2x1bWVJbmRleEZvckF0dHJpYnV0ZXMoYXR0ckFpZGwsIGRldmljZUFpZGwsIGluZGV4QWlkbCkpOwogfQogCi1zdGF0dXNfdCBBdWRpb1N5c3RlbTo6Z2V0Vm9sdW1lSW5kZXhGb3JBdHRyaWJ1dGVzKGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAmYXR0ciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ICZpbmRleCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190IGRldmljZSkKLXsKK3N0YXR1c190IEF1ZGlvU3lzdGVtOjpnZXRWb2x1bWVJbmRleEZvckF0dHJpYnV0ZXMoY29uc3QgYXVkaW9fYXR0cmlidXRlc190JiBhdHRyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQmIGluZGV4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19kZXZpY2V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AmcmV0QWlkbCkpKTsKKyAgICAgICAgcmV0dXJuIGFpZGwybGVnYWN5X2ludDMyX3RfYXVkaW9faW9faGFuZGxlX3QocmV0QWlkbCk7CisgICAgfSgpOworCisgICAgcmV0dXJuIHJlc3VsdC52YWx1ZV9vcihBVURJT19JT19IQU5ETEVfTk9ORSk7CiB9CiAKLXN0YXR1c190IEF1ZGlvU3lzdGVtOjpyZWdpc3RlckVmZmVjdChjb25zdCBlZmZlY3RfZGVzY3JpcHRvcl90ICpkZXNjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBpbywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3Qgc3RyYXRlZ3ksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaWQpCi17CitzdGF0dXNfdCBBdWRpb1N5c3RlbTo6cmVnaXN0ZXJFZmZlY3QoY29uc3QgZWZmZWN0X2Rlc2NyaXB0b3JfdCogZGVzYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBpbywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kdWN0X3N0cmF0ZWd5X3Qgc3RyYXRlZ3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGlkKSB7CiAgICAgY29uc3Qgc3A8SUF1ZGlvUG9saWN5U2VydmljZT4mIGFwcyA9IEF1ZGlvU3lzdGVtOjpnZXRfYXVkaW9fcG9saWN5X3NlcnZpY2UoKTsKICAgICBpZiAoYXBzID09IDApIHJldHVybiBQRVJNSVNTSU9OX0RFTklFRDsKLSAgICByZX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ICAgICAgICAgICAgICAgICAgIHVuc2lnbmVkIGludCAqbnVtX3BvcnRzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cnVjdCBhdWRpb19wb3J0ICpwb3J0cywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBpbnQgKmdlbmVyYXRpb24pCi17CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQgaW50KiBudW1fcG9ydHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0IGF1ZGlvX3BvcnRfdjcqIHBvcnRzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuc2lnbmVkIGludCogZ2VuZXJhdGlvbikgeworICAgIGlmIChudW1fcG9ydHMgPT0gbnVsbHB0ciB8fCAoKm51bV9wb3J0cyAhPSAwICYmIHBvcnRzID09IG51bGxwdHIpIHx8CisgICAgICAgIGdlbmVyYXRpb24gPT0gbnVsbHB0cikgeworICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgIH0KKwogICAgIGNvbnN0IHNwPElBdWRpb1BvbGljeVNlcnZpY2U+JiBhcHMgPSBBdWRpb1N5c3RlbTo6Z2V0X2F1ZGlvX3BvbGljeV9zZXJ2aWNlKCk7CiAgICAgaWYgKGFwcyA9PSAwKSByZXR1cm4gUEVSTUlTU0lPTl9ERU5JRUQ7Ci0gICAgcmV0dXJuIGFwcy0+bGlzdEF1ZGlvUG9ydHMocm9sZSwgdHlwZSwgbnVtX3BvcnRzLCBwb3J0cywgZ2VuZXJhdGlvbik7CisKKyAgICBtZWRpYTo6QXVkaW9Qb3J0Um9sZSByb2xlQWlkbCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMoCisgICAgICAgICAgICBsZWdhY3kyYWlkbF9hdWRpb19wb3J0X3JvbGVfdF9BdWRpb1BvcnRSb2xlKHJvbGUpKTsKKyAgICBtZWRpYTo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YgPSBBdWRpb1N5c3RlbTo6Z2V0X2F1ZGlvX2ZsaW5nZXIoKTsKLSAgaWYgKGFmID09IG51bGxwdHIpIHJldHVybiBQRVJNSVNTSU9OX0RFTklFRDsKLSAgcmV0dXJuIGFmLT5zZXRBdWRpb0hhbFBpZHMocGlkcyk7CisgICAgY29uc3Qgc3A8SUF1ZGlvRmxpbmdlcj4mIGFmID0gQXVkaW9TeXN0ZW06OmdldF9hdWRpb19mbGluZ2VyKCk7CisgICAgaWYgKGFmID09IG51bGxwdHIpIHJldHVybiBQRVJNSVNTSU9OX0RFTklFRDsKKyAgICByZXR1cm4gYWYtPnNldEF1ZGlvSGFsUGlkcyhwaWRzKTsKIH0KIAotc3RhdHVzX3QgQXVkaW9TeXN0ZW06OmdldFN1cnJvdW5kRm9ybWF0cyh1bnNpZ25lZCBpbnQgKm51bVN1cnJvdW5kRm9ybWF0cywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZm9ybWF0X3QgKnN1cnJvdW5kRm9ybWF0cywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCAqc3Vycm91bmRGb3JtYXRzRW5hYmxlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCByZXBvcnRlZCkKLXsKK3N0YXR1c190IEF1ZGlvU3lzdGVtOjpnZXRTdXJyb3VuZEZvcm1hdHModW5zaWduZWQgaW50KiBudW1TdXJyb3VuZEZvcm1hdHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1hdF90KiBzdXJyb3VuZEZvcm1hdHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wqIHN1cnJvdW5kRm9ybWF0c0VuYWJsZWQpIHsKKyAgICBpZiAobnVtU3Vycm91bmRGb3JtYXRzID09IG51bGxwdHIgfHwgKCpudW1TdXJyb3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XJuIGFwcy0+aXNDYWxsU2NyZWVuTW9kZVN1cHBvcnRlZCgpOworCisgICAgYXV0byByZXN1bHQgPSBbJl0oKSAtPiBDb252ZXJzaW9uUmVzdWx0PGJvb2w+IHsKKyAgICAgICAgYm9vbCByZXRBaWRsOworICAgICAgICBSRVRVUk5fSUZfRVJST1IoCisgICAgICAgICAgICAgICAgc3RhdHVzVEZyb21CaW5kZXJTdGF0dXMoYXBzLT5pc0NhbGxTY3JlZW5Nb2RlU3VwcG9ydGVkKCZyZXRBaWRsKSkpOworICAgICAgICByZXR1cm4gcmV0QWlkbDsKKyAgICB9KCk7CisgICAgcmV0dXJuIHJlc3VsdC52YWx1ZV9vcihmYWxzZSk7CiB9CiAKLXN0YXR1c190IEF1ZGlvU3lzdGVtOjpzZXRQcmVmZXJyZWREZXZpY2VGb3JTdHJhdGVneShwcm9kdWN0X3N0cmF0ZWd5X3Qgc3RyYXRlZ3ksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkciAmZGV2aWNlKQoteworc3RhdHVzX3QgQXVkaW9TeXN0ZW06OnNldERldmljZXNSb2xlRm9yU3RyYXRlZ3kocHJvZHVjdF9zdHJhdGVneV90IHN0cmF0ZWd5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlX3JvbGVfdCByb2xlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciYgZGV2aWNlcykgewogICAgIGNvbnN0IHNwPElBdWRpb1BvbGljeVNlcnZpY2U+JiBhcHMgPSBBdWRpb1N5c3RlbTo6Z2V0X2F1ZGlvX3BvbGljeV9zZXJ2aWNlKCk7CiAgICAgaWYgKGFwcyA9PSAwKSB7CiAgICAgICAgIHJldHVybiBQRVJNSVNTSU9OX0RF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VVJOX1NUQVRVUygKKyAgICAgICAgICAgIGNvbnZlcnRDb250YWluZXI8c3RkOjp2ZWN0b3I8bWVkaWE6OkF1ZGlvRGV2aWNlPj4oZGV2aWNlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVnYWN5MmFpZGxfQXVkaW9EZXZpY2VUeXBlQWRkcmVzcykpOworICAgIHJldHVybiBzdGF0dXNURnJvbUJpbmRlclN0YXR1cygKKyAgICAgICAgICAgIGFwcy0+c2V0RGV2aWNlc1JvbGVGb3JDYXB0dXJlUHJlc2V0KGF1ZGlvU291cmNlQWlkbCwgcm9sZUFpZGwsIGRldmljZXNBaWRsKSk7Cit9CisKK3N0YXR1c190IEF1ZGlvU3lzdGVtOjphZGREZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXQoYXVkaW9fc291cmNlX3QgYXVkaW9Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZV9yb2xlX3Qgcm9sZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciYgZGV2aWNlcykgeworICAgIGNvbnN0IHNwPElBdWRpb1BvbGljeVNlcnZpY2U+JiBhcHMgPSBBdWRpb1N5c3RlbTo6Z2V0X2F1ZGlvX3BvbGljeV9zZXJ2aWNlKCk7CisgICAgaWYgKGFwcyA9PSAwKSB7CisgICAgICAgIHJldHVybiBQRVJNSVNTSU9OX0RFTklFRDsKKyAgICB9CisgICAgbWVkaWE6OkF1ZGlvU291cmNlVHlwZSBhdWRpb1NvdXJjZUFpZGwgPSBWQUxVRV9PUl9SRVRVUk5fU1RBVFVTKAorICAgICAgICAgICAgbGVnYWN5MmFpZGxfYXVkaW9fc291cmNlX3RfQXVkaW9Tb3VyY2VUeXBlKGF1ZGl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lvU3lzdGVtOjpnTG9jayk7CkBAIC0xNzg3LDE5ICsyNDAxLDIwIEBACiAgICAgfQogCiAgICAgaWYgKGNiICE9IE5VTEwpIHsKLSAgICAgICAgY2IoRFlOQU1JQ19QT0xJQ1lfRVZFTlRfTUlYX1NUQVRFX1VQREFURSwgcmVnSWQsIHN0YXRlKTsKKyAgICAgICAgY2IoRFlOQU1JQ19QT0xJQ1lfRVZFTlRfTUlYX1NUQVRFX1VQREFURSwgcmVnSWRMZWdhY3ksIHN0YXRlTGVnYWN5KTsKICAgICB9CisgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKIH0KIAotdm9pZCBBdWRpb1N5c3RlbTo6QXVkaW9Qb2xpY3lTZXJ2aWNlQ2xpZW50OjpvblJlY29yZGluZ0NvbmZpZ3VyYXRpb25VcGRhdGUoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXZlbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCByZWNvcmRfY2xpZW50X2luZm9fdCAqY2xpZW50SW5mbywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2NvbmZpZ19iYXNlX3QgKmNsaWVudENvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGVmZmVjdF9kZXNjcmlwdG9yX3Q+IGNsaWVudEVmZmVjdHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdWRpb19jb25maWdfYmFzZV90ICpkZXZpY2VDb25maWcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxlZmZlY3RfZGVzY3JpcHRvcl90PiBlZmZlY3RzLAotICAgICAgICAgICAgICAgICAg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IEdFVF9BVURJT19IV19TWU5DX0ZPUl9TRVNTSU9OLAotICAgIFNZU1RFTV9SRUFEWSwKLSAgICBGUkFNRV9DT1VOVF9IQUwsCi0gICAgR0VUX01JQ1JPUEhPTkVTLAotICAgIFNFVF9NQVNURVJfQkFMQU5DRSwKLSAgICBHRVRfTUFTVEVSX0JBTEFOQ0UsCi0gICAgU0VUX0VGRkVDVF9TVVNQRU5ERUQsCi0gICAgU0VUX0FVRElPX0hBTF9QSURTCi19OwordXNpbmcgYWlkbF91dGlsczo6c3RhdHVzVEZyb21CaW5kZXJTdGF0dXM7Cit1c2luZyBiaW5kZXI6OlN0YXR1czsKIAogI2RlZmluZSBNQVhfSVRFTVNfUEVSX0xJU1QgMTAyNAogCisjZGVmaW5lIFZBTFVFX09SX1JFVFVSTl9CSU5ERVIoeCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgKHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgYXV0byBfdG1wID0gKHgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgaWYgKCFfdG1wLm9rKCkpIHJldHVybiBTdGF0dXM6OmZyb21TdGF0dXNUKF90bXAuZXJyb3IoKSk7ICBcCisgICAgICAgc3RkOjptb3ZlKF90bXAudmFsdWUoKSk7IFwKKyAgICAgfSkKIAotY2xhc3MgQnBBdWRpb0ZsaW5nZXIgOiBwdWJsaWMgQnBJbnRlcmZhY2U8SUF1ZGlvRmxpbmdlcj4KLXsKLXB1YmxpYzoKLSAgICBleHBsaWNpdCBCcEF1ZGlvRmxpbmdlcihjb25zdCBzcDxJQmluZGVyPiYgaW1wbCkKLSAgICAgICAgOiBCcEludGVyZmFjZTxJQXVkaW9GbGluZ2VyPihpbXBsKQotICAgIHsKKyNkZWZpbmUgUkVUVVJOX1NUQVRVU19JRl9FUlJPUih4KSAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgIGF1dG8gX3RtcCA9ICh4KTsgICAgICAgICAgICAgIFwKKyAgICAgICBpZiAoX3RtcCAhPSBPSykgcmV0dXJuIF90bXA7ICBcCiAgICAgfQogCi0gICAgdmlydHVhbCBzcDxJQXVkaW9UcmFjaz4gY3JlYXRlVHJhY2soY29uc3QgQ3JlYXRlVHJhY2tJbnB1dCYgaW5wdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ3JlYXRlVHJhY2tPdXRwdXQmIG91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXNfdCAqc3RhdHVzKQotICAgIHsKLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICBzcDxJQXVkaW9UcmFjaz4gdHJhY2s7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQXVkaW9GbGluZ2VyOjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOwotCi0gICAgICAgIGlmIChzdGF0dXMgPT0gbnVsbHB0cikgewotICAgICAgICAgICAgcmV0dXJuIHRyYWNrOwotICAgICAgICB9Ci0KLSAgICAgICAgaW5wdXQud3JpdGVUb1BhcmNlbCgmZGF0YSk7Ci0KLSAgICAgICAgc3RhdHVzX3QgbFN0YXR1cyA9IHJlbW90ZSgpLT50cmFuc2FjdChDUkVBVEVfVFJBQ0ssIGRhdGEsICZyZXBseSk7Ci0gICAgICAgIGlmIChsU3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICBBTE9HRSgiY3JlYXRlVHJhY2sgdHJhbnNhY3Rpb24gZXJyb3IgJWQiLCBsU3RhdHVzKTsKLSAgICAgICAgICAgICpzdGF0dXMgPSBERUFEX09CSkVDVDsKLSAgICAgICAgICAgIHJldHVybiB0cmFjazsKLSAgICAgICAgfQotICAgICAgICAqc3RhdHVzID0gcmVwbHkucmVhZEludDMyKCk7Ci0gICAgICAgIGlmICgqc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICBBTE9HRSgiY3JlYXRlVHJhY2sgcmV0dXJuZWQgZXJyb3IgJWQiLCAqc3RhdHVzKTsKLSAgICAgICAgICAgIHJldHVybiB0cmFjazsKLSAgICAgICAgfQotICAgICAgICB0cmFjayA9IGludGVyZmFjZV9jYXN0PElBdWRpb1RyYWNrPihyZXBseS5yZWFkU3Ryb25nQmluZGVyKCkpOwotICAgICAgICBpZiAodHJhY2sgPT0gMCkgewotICAgICAgICAgICAgQUxPR0UoImNyZWF0ZVRyYWNrIHJldHVybmVkIGFuIE5VTEwgSUF1ZGlvVHJhY2sgd2l0aCBzdGF0dXMgT0siKTsKLSAgICAgICAgICAgICpzdGF0dXMgPSBERUFEX09CSkVDVDsKLSAgICAgICAgICAgIHJldHVybiB0cmFjazsKLSAgICAgICAgfQotICAgICAgICBvdXRwdXQucmVhZEZyb21QYXJjZWwoJnJlcGx5KTsKLSAgICAgICAgcmV0dXJuIHRyYWNrOworI2RlZmluZSBSRVRVUk5fQklOREVSX0lGX0VSUk9SKHgpICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgYXV0byBfdG1wID0gKHgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgIGlmIChfdG1wICE9IE9LKSByZXR1cm4gU3RhdHVzOjpmcm9tU3RhdHVzVChfdG1wKTsgIFwKICAgICB9CiAKLSAgICB2aXJ0dWFsIHNwPG1lZGlhOjpJQXVkaW9SZWNvcmQ+IGNyZWF0ZVJlY29yZChjb25zdCBDcmVhdGVSZWNvcmRJbnB1dCYgaW5wdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ3JlYXRlUmVjb3JkT3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ZV90IGdldElucHV0QnVmZmVyU2l6ZSh1aW50MzJfdCBzYW1wbGVSYXRlLCBhdWRpb19mb3JtYXRfdCBmb3JtYXQsCi0gICAgICAgICAgICBhdWRpb19jaGFubmVsX21hc2tfdCBjaGFubmVsTWFzaykgY29uc3QKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb0ZsaW5nZXI6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzYW1wbGVSYXRlKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKGZvcm1hdCk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihjaGFubmVsTWFzayk7Ci0gICAgICAgIHJlbW90ZSgpLT50cmFuc2FjdChHRVRfSU5QVVRCVUZGRVJTSVpFLCBkYXRhLCAmcmVwbHkpOwotICAgICAgICByZXR1cm4gcmVwbHkucmVhZEludDY0KCk7Ci0gICAgfQotCi0gICAgdmlydHVhbCBzdGF0dXNfdCBvcGVuT3V0cHV0KGF1ZGlvX21vZHVsZV9oYW5kbGVfdCBtb2R1bGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICpvdXRwdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2NvbmZpZ190ICpjb25maWcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPERldmljZURlc2NyaXB0b3JCYXNlPiYgZGV2aWNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAqbGF0ZW5jeU1zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19vdXRwdXRfZmxhZ3NfdCBmbGFncykKLSAgICB7Ci0gICAgICAgIGlmIChvdXRwdXQgPT0gbnVsbHB0ciB8fCBjb25maWcgPT0gbnVsbHB0ciB8fCBkZXZpY2UgPT0gbnVsbHB0ciB8fCBsYXRlbmN5TXMgPT0gbnVsbHB0cikgewotICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKLSAgICAgICAgfQotICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQXVkaW9GbGluZ2VyOjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIobW9kdWxlKTsKLSAgICAgICAgZGF0YS53cml0ZShjb25maWcsIHNpemVvZihhdWRpb19jb25maWdfdCkpOwotICAgICAgICBkYXRhLndyaXRlUGFyY2VsYWJsZSgqZGV2aWNlKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKChpbnQzMl90KSBmbGFncyk7Ci0gICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHJlbW90ZSgpLT50cmFuc2FjdChPUEVOX09VVFBVVCwgZGF0YSwgJnJlcGx5KTsKLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgKm91dHB1dCA9IEFVRElPX0lPX0hBTkRMRV9OT05FOwotICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgfQotICAgICAgICBzdGF0dXMgPSAoc3RhdHVzX3QpcmVwbHkucmVhZEludDMyKCk7Ci0gICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICpvdXRwdXQgPSBBVURJT19JT19IQU5ETEVfTk9ORTsKLSAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgIH0KLSAgICAgICAgKm91dHB1dCA9IChhdWRpb19pb19oYW5kbGVfdClyZXBseS5yZWFkSW50MzIoKTsKLSAgICAgICAgQUxPR1YoIm9wZW5PdXRwdXQoKSByZXR1cm5lZCBvdXRwdXQsICVkIiwg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SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19jb25maWdfdCAqY29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCAqZGV2aWNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFN0cmluZzgmIGFkZHJlc3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc291cmNlX3Qgc291cmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lucHV0X2ZsYWdzX3QgZmxhZ3MpCi0gICAgewotICAgICAgICBpZiAoaW5wdXQgPT0gTlVMTCB8fCBjb25maWcgPT0gTlVMTCB8fCBkZXZpY2UgPT0gTlVMTCkgewotICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKLSAgICAgICAgfQotICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQXVkaW9GbGluZ2VyOjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIobW9kdWxlKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKCppbnB1dCk7Ci0gICAgICAgIGRhdGEud3JpdGUoY29uZmlnLCBzaXplb2YoYXVkaW9fY29uZmlnX3QpKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKCpkZXZpY2UpOwotICAgICAgICBkYXRhLndyaXRlU3RyaW5nOChhZGRyZXNzKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHNvdXJjZSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihmbGFncyk7Ci0gICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHJlbW90ZSgpLT50cmFuc2FjdChPUEVOX0lOUFVULCBkYXRhLCAmcmVwbHkpOwotICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SK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mFuc2FjdChHRVRfUkVOREVSX1BPU0lUSU9OLCBkYXRhLCAmcmVwbHkpOwotICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSByZXBseS5yZWFkSW50MzIoKTsKLSAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgdWludDMyX3QgdG1wID0gcmVwbHkucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBpZiAoaGFsRnJhbWVzICE9IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAqaGFsRnJhbWVzID0gdG1wOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdG1wID0gcmVwbHkucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBpZiAoZHNwRnJhbWVzICE9IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAqZHNwRnJhbWVzID0gdG1wOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgfQotCi0gICAgdmlydHVhbCB1aW50MzJfdCBnZXRJbnB1dEZyYW1lc0xvc3QoYXVkaW9faW9faGFuZGxlX3QgaW9IYW5kbGUpIGNvbnN0Ci0gICAgewotICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQXVkaW9GbGluZ2VyOjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoKGludDMyX3QpIGlvSGFuZGxlKTsKLSAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gcmVtb3RlKCktPnRyYW5zYWN0KEdFVF9JTlBVVF9GUkFNRVNfTE9TVCwgZGF0YSwgJnJlcGx5KTsKLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgcmV0dXJuIDA7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuICh1aW50MzJfdCkgcmVwbHkucmVhZ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R1c190IGdldEVmZmVjdERlc2NyaXB0b3IoY29uc3QgZWZmZWN0X3V1aWRfdCAqcFV1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVmZmVjdF91dWlkX3QgKnBUeXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBwcmVmZXJyZWRUeXBlRmxhZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0X2Rlc2NyaXB0b3JfdCAqcERlc2NyaXB0b3IpIGNvbnN0Ci0gICAgewotICAgICAgICBpZiAocFV1aWQgPT0gTlVMTCB8fCBwVHlwZSA9PSBOVUxMIHx8IHBEZXNjcmlwdG9yID09IE5VTEwpIHsKLSAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7Ci0gICAgICAgIH0KLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUF1ZGlvRmxpbmdlcjo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKLSAgICAgICAgZGF0YS53cml0ZShwVXVpZCwgc2l6ZW9mKGVmZmVjdF91dWlkX3QpKTsKLSAgICAgICAgZGF0YS53cml0ZShwVHlwZSwgc2l6ZW9mKGVmZmVjdF91dWlkX3QpKTsKLSAgICAgICAgZGF0YS53cml0ZVVpbnQzMihwcmVmZXJyZWRUeXBlRmxhZyk7Ci0gICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHJlbW90ZSgpLT50cmFuc2FjdChHRVRfRUZGRUNUX0RFU0NSSVBUT1IsIGRhdGEsICZyZXBseSk7Ci0gICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgIH0KLSAgICAgICAgc3RhdHVzID0gcmVwbHkucmVhZEludDMyKCk7Ci0gICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgIH0KLSAgICAgICAgcmVwbHkucmVhZChwRGVzY3JpcHRvciwgc2l6ZW9mKGVmZmVjdF9kZXNjcmlwdG9yX3QpKTsKLSAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgIH0KLQotICAgIHZpcnR1YWwgc3A8SUVmZmVjdD4gY3JlYXRlRWZmZWN0KAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0X2Rlc2NyaXB0b3JfdCAqcERlc2MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxJRWZmZWN0Q2xpZW50PiYgY2xpZW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBwcmlvcml0eSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90IG91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uSWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdWRpb0RldmljZVR5cGVBZGRyJiBkZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTdHJpbmcxNiYgb3BQYWNrYWdlTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IHBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcHJvYmUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXNfdCAqc3RhdHVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ICppZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCAqZW5hYmxlZCkKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgc3A8SUVmZmVjdD4gZWZmZWN0OwotICAgICAgICBpZiAocERlc2MgPT0gTlVMTCkgewotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOVUxMKSB7Ci0gICAgICAgICAgICAgICAgKnN0YXR1cyA9IEJBRF9WQUxVRTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBudWxscHRyOwotICAgICAgICB9Ci0KLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb0ZsaW5nZXI6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGUocERlc2MsIHNpemVvZihlZmZlY3RfZGVzY3JpcHRvcl90KSk7Ci0gICAgICAgIGRhdGEud3JpdGVTdHJvbmdCaW5kZXIoSUludGVyZmFjZTo6YXNCaW5kZXIoY2xpZW50KSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihwcmlvcml0eSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMigoaW50MzJfdCkgb3V0cHV0KTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHNlc3Npb25JZCk7Ci0gICAgICAgIGlmIChkYXRhLndyaXRlUGFyY2VsYWJsZShkZXZpY2UpICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAqc3RhdHVzID0gTk9fSU5JVDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBudWxscHRyOwotICAgICAgICB9Ci0gICAgICAgIGRhdGEud3JpdGVTdHJpbmcxNihvcFBhY2thZ2VOYW1lKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKChpbnQzMl90KSBwaWQpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIocHJvYmUgPyAxIDogMCk7Ci0KLSAgICAgICAgc3RhdHVzX3QgbFN0YXR1cyA9IHJlbW90ZSgpLT50cmFuc2FjdChDUkVBVEVfRUZGRUNULCBkYXRhLCAmcmVwbHkpOwotICAgICAgICBpZiAobFN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgQUxPR0UoImNyZWF0ZUVmZmVjdCBlcnJvcjogJXMiLCBzdHJlcnJvcigtbFN0YXR1cykpOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgbFN0YXR1cyA9IHJlcGx5LnJlYWRJbnQzMigpOwotICAgICAgICAgICAgaW50IHRtcCA9IHJlcGx5LnJlYWRJbnQzMigpOwotICAgICAgICAgICAgaWYgKGlkICE9IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAqaWQgPSB0bXA7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB0bXAgPSByZXBseS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIGlmIChlbmFibGVkICE9IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAqZW5hYmxlZCA9IHRtcDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVmZmVjdCA9IGludGVyZmFjZV9jYXN0PElFZmZlY3Q+KHJlcGx5LnJlYWRTdHJvbmdCaW5kZXIoKSk7Ci0gICAgICAgICAgICByZXBseS5yZWFkKHBEZXNjLCBzaXplb2YoZWZmZWN0X2Rlc2NyaXB0b3JfdCkpOwotICAgICAgICB9Ci0gICAgICAgIGlmIChzdGF0dXMgIT0gTlVMTCkgewotICAgICAgICAgICAgKnN0YXR1cyA9IGxTdGF0dXM7Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gZWZmZWN0OwotICAgIH0KLQotICAgIHZpcnR1YWwgc3RhdHVzX3QgbW92ZUVmZmVjdHMoYXVkaW9fc2Vzc2lvbl90IHNlc3Npb24sIGF1ZGlvX2lvX2hhbmRsZV90IHNyY091dHB1dCwKLSAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90IGRzdE91dHB1dCkKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb0ZsaW5nZXI6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzZXNzaW9uKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKChpbnQzMl90KSBzcmNPdXRwdXQpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoKGludDMyX3QpIGRzdE91dHB1dCk7Ci0gICAgICAgIHJlbW90ZSgpLT50cmFuc2FjdChNT1ZFX0VGRkVDVFMsIGRhdGEsICZyZXBseSk7Ci0gICAgICAgIHJldHVybiByZXBseS5yZWFkSW50MzIoKTsKLSAgICB9Ci0KLSAgICB2aXJ0dWFsIHZvaWQgc2V0RWZmZWN0U3VzcGVuZGVkKGludCBlZmZlY3RJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uSWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHN1c3BlbmRlZCkKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb0ZsaW5nZXI6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihlZmZlY3RJZCk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzZXNzaW9uSWQpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoc3VzcGVuZGVkID8gMSA6IDApOwotICAgICAgICByZW1vdGUoKS0+dHJhbnNhY3QoU0VUX0VGRkVDVF9TVVNQRU5ERUQsIGRhdGEsICZyZXBseSk7Ci0gICAgfQotCi0gICAgdmlydHVhbCBhdWRp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QsIGRhdGEsICZyZXBseSk7Ci0gICAgICAgIHJldHVybiByZXBseS5yZWFkSW50NjQoKTsKLSAgICB9Ci0KLSAgICB2aXJ0dWFsIHN0YXR1c190IHNldExvd1JhbURldmljZShib29sIGlzTG93UmFtRGV2aWNlLCBpbnQ2NF90IHRvdGFsTWVtb3J5KSBvdmVycmlkZQotICAgIHsKLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotCi0gICAgICAgIHN0YXRpY19hc3NlcnQoTk9fRVJST1IgPT0gMCwgIk5PX0VSUk9SIG11c3QgYmUgMCIpOwotICAgICAgICByZXR1cm4gZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb0ZsaW5nZXI6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSkKLSAgICAgICAgICAgICAgICA/OiBkYXRhLndyaXRlSW50MzIoKGludCkgaXNMb3dSYW1EZXZpY2UpCi0gICAgICAgICAgICAgICAgPzogZGF0YS53cml0ZUludDY0KHRvdGFsTWVtb3J5KQotICAgICAgICAgICAgICAgID86IHJlbW90ZSgpLT50cmFuc2FjdChTRVRfTE9XX1JBTV9ERVZJQ0UsIGRhdGEsICZyZXBseSkKLSAgICAgICAgICAgICAgICA/OiByZXBseS5yZWFkSW50MzIoKTsKLSAgICB9Ci0KLSAgICB2aXJ0dWFsIHN0YXR1c190IGxpc3RBdWRpb1BvcnRzKHVuc2lnbmVkIGludCAqbnVtX3BvcnRzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0IGF1ZGlvX3BvcnQgKnBvcnRzKQotICAgIHsKLSAgICAgICAgaWYgKG51bV9wb3J0cyA9PSBOVUxMIHx8ICpudW1fcG9ydHMgPT0gMCB8fCBwb3J0cyA9PSBOVUxMKSB7Ci0gICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICB9Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVy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Ci0gICAgICAgIGNhc2UgQ1JFQVRFX0FVRElPX1BBVENIOgotICAgICAgICBjYXNlIFJFTEVBU0VfQVVESU9fUEFUQ0g6Ci0gICAgICAgIGNhc2UgTElTVF9BVURJT19QQVRDSEVTOgotICAgICAgICBjYXNlIFNFVF9BVURJT19QT1JUX0NPTkZJRzoKLSAgICAgICAgY2FzZSBTRVRfUkVDT1JEX1NJTEVOQ0VEOgotICAgICAgICAgICAgQUxPR1coIiVzOiB0cmFuc2FjdGlvbiAlZCByZWNlaXZlZCBmcm9tIFBJRCAlZCIsCi0gICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgY29kZSwgSVBDVGhyZWFkU3RhdGU6OnNlbGYoKS0+Z2V0Q2FsbGluZ1BpZCgpKTsKLSAgICAgICAgICAgIC8vIHJldHVybiBzdGF0dXMgb25seSBmb3Igbm9uIHZvaWQgbWV0aG9kcwotICAgICAgICAgICAgc3dpdGNoIChjb2RlKSB7Ci0gICAgICAgICAgICAgICAgY2FzZSBTRVRfUkVDT1JEX1NJTEVOQ0VEOgotICAgICAgICAgICAgICAgIGNhc2UgU0VUX0VGRkVDVF9TVVNQRU5ERUQ6Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0PGludDMyX3Q+IChJTlZBTElEX09QRVJBVElPTikpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBPSzsKLSAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgIGJyZWFrOwotICAgIH0KLQotICAgIC8vIG1ha2Ugc3VyZSB0aGUgZm9sbG93aW5nIHRyYW5zYWN0aW9ucyBjb21lIGZyb20gc3lzdGVtIGNvbXBvbmVudHMKLSAgICBzd2l0Y2ggKGNvZGUpIHsKLSAgICAgICAgY2FzZSBTRVRfTUFTVEVSX1ZPTFVNRToKLSAgICAgICAgY2FzZSBTRVRfTUFTVEVSX01VVEU6Ci0gICAgICAgIGNhc2UgU0VUX01PREU6Ci0gICAgICAgIGNhc2UgU0VUX01JQ19NVVRFOgotICAgICAgICBjYXNlIFNFVF9MT1dfUkFNX0RFVklDRToKLSAgICAgICAgY2FzZSBTWVNURU1fUkVBRFk6Ci0gICAgICAgIGNhc2UgU0VUX0FVRElPX0hBTF9QSURTOiB7Ci0gICAgICAgICAgICBpZiAoIWlzU2VydmljZVVpZChJUENUaHJlYWRTdGF0ZTo6c2VsZigpLT5nZXRDYWxsaW5nVWlkKCkpKSB7Ci0gICAgICAgICAgICAgICAgQUxPR1coIiVzOiB0cmFuc2FjdGlvbiAlZCByZWNlaXZlZCBmcm9tIFBJRCAlZCB1bmF1dGhvcml6ZWQgVUlEICVkIiwKLSAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgY29kZSwgSVBDVGhyZWFkU3RhdGU6OnNlbGYoKS0+Z2V0Q2FsbGluZ1BpZCgpLAotICAgICAgICAgICAgICAgICAgICAgIElQQ1RocmVhZFN0YXRlOjpzZWxmKCktPmdldENhbGxpbmdVaWQoKSk7Ci0gICAgICAgICAgICAgICAgLy8gcmV0dXJuIHN0YXR1cyBvbmx5IGZvciBub24gdm9pZCBtZXRob2RzCi0gICAgICAgICAgICAgICAgc3dpdGNoIChjb2RlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgU1lTVEVNX1JFQURZOgotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0aWNfY2FzdDxpbnQzMl90PiAoSU5WQUxJRF9PUEVSQVRJT04pKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXR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0KLSAgICBzd2l0Y2ggKGNvZGUpIHsKLSAgICAgICAgY2FzZSBDUkVBVEVfVFJBQ0s6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0KLSAgICAgICAgICAgIENyZWF0ZVRyYWNrSW5wdXQgaW5wdXQ7Ci0gICAgICAgICAgICBpZiAoaW5wdXQucmVhZEZyb21QYXJjZWwoKFBhcmNlbCopJmRhdGEpICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoREVBRF9PQkpFQ1QpOwotICAgICAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzOwotICAgICAgICAgICAgQ3JlYXRlVHJhY2tPdXRwdXQgb3V0cHV0OwotCi0gICAgICAgICAgICBzcDxJQXVkaW9UcmFjaz4gdHJhY2s9IGNyZWF0ZVRyYWNrKGlucHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzdGF0dXMpOwotCi0gICAgICAgICAgICBMT0dfQUxXQVlTX0ZBVEFMX0lGKCh0cmFjayAhPSAwKSAhPSAoc3RhdHVzID09IE5PX0VSUk9SKSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJlcGx5LT53cml0ZVN0cm9uZ0JpbmRlcihJSW50ZXJmYWNlOjphc0JpbmRlcih0cmFjaykpOwotICAgICAgICAgICAgb3V0cHV0LndyaXRlVG9QYXJjZWwocmVwbHkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIENSRUFURV9SRUNPUkQ6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0KLSAgICAgICAgICAgIENyZWF0ZVJlY29yZElucHV0IGlucHV0OwotICAgICAgICAgICAgaWYgKGlucHV0LnJlYWRGcm9tUGFyY2VsKChQYXJjZWwqKSZkYXRhKSAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKERFQURfT0JKRUNUKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1czsKLSAgICAgICAgICAgIENyZWF0ZVJlY29yZE91dHB1dCBvdXRwdXQ7Ci0KLSAgICAgICAgICAgIHNwPG1lZGlhOjpJQXVkaW9SZWNvcmQ+IHJlY29yZCA9IGNyZWF0ZVJlY29yZChpbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnN0YXR1cyk7Ci0KLSAgICAgICAgICAgIExPR19BTFdBWVNfRkFUQUxfSUYoKHJlY29yZCAhPSAwKSAhPSAoc3RhdHVzID09IE5PX0VSUk9SKSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJlcGx5LT53cml0ZVN0cm9uZ0JpbmRlcihJSW50ZXJmYWNlOjphc0JpbmRlcihyZWNvcmQpKTsKLSAgICAgICAgICAgIG91dHB1dC53cml0ZVRvUGFyY2VsKHJlcGx5KTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBTQU1QTEVfUkFURTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKCBzYW1wbGVSYXRlKChhdWRpb19pb19oYW5kbGVfdCkgZGF0YS5yZWFkSW50MzIoKSkgKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICAvLyBSRVNFUlZFRCBmb3IgY2hhbm5lbENvdW50KCkKLQotICAgICAgICBjYXNlIEZPUk1BVDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKCBmb3JtYXQoKGF1ZGlvX2lvX2hhbmRsZV90KSBkYXRhLnJlYWRJbnQzMigpKSApOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIEZSQU1FX0NPVU5UOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvRmxpbmdlciwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50NjQoIGZyYW1lQ291bnQoKGF1ZGlvX2lvX2hhbmRsZV90KSBkYXRhLnJlYWRJbnQzMigpKSApOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIExBVEVOQ1k6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSR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RhLCByZXBseSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMiggbWFzdGVyTXV0ZSgpICk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0gICAgICAgIGNhc2UgU0VUX01BU1RFUl9CQUxBTkNFOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvRmxpbmdlciwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoIHNldE1hc3RlckJhbGFuY2UoZGF0YS5yZWFkRmxvYXQoKSkgKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBHRVRfTUFTVEVSX0JBTEFOQ0U6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBmbG9hdCBmOwotICAgICAgICAgICAgY29uc3Qgc3RhdHVzX3Qgc3RhdHVzID0gZ2V0TWFzdGVyQmFsYW5jZSgmZik7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMigoaW50MzJfdClzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgICh2b2lkKXJlcGx5LT53cml0ZUZsb2F0KGYpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIFNFVF9TVFJFQU1fVk9MVU1FOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvRmxpbmdlciwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgaW50IHN0cmVhbSA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBmbG9hdCB2b2x1bWUgPSBkYXRhLnJlYWRGbG9hdCgpOwotICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3Qgb3V0cHV0ID0gKGF1ZGlvX2lvX2hhbmRsZV90KSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoIHNldFN0cmVhbVZvbHVtZSgoYXVkaW9fc3RyZWFtX3R5cGVfdCkgc3RyZWFtLCB2b2x1bWUsIG91dHB1dCkgKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBTRVRfU1RSRUFNX01VVEU6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBpbnQgc3RyZWFtID0gZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKCBzZXRTdHJlYW1NdXRlKChhdWRpb19zdHJlYW1fdHlwZV90KSBzdHJlYW0sIGRhdGEucmVhZEludDMyKCkpICk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0gICAgICAgIGNhc2UgU1RSRUFNX1ZPTFVNRTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGludCBzdHJlYW0gPSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgaW50IG91dHB1dCA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVGbG9hdCggc3RyZWFtVm9sdW1lKChhdWRpb19zdHJlYW1fdHlwZV90KSBzdHJlYW0sIG91dHB1dCkgKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBTVFJFQU1fTVVURTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGludCBzdHJlYW0gPSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoIHN0cmVhbU11dGUoKGF1ZGlvX3N0cmVhbV90eXBlX3QpIHN0cmVhbSkgKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBTRVRfTU9ERTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGF1ZGlvX21vZGVfdCBtb2RlID0gKGF1ZGlvX21vZGVfdCkgZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKCBzZXRNb2RlKG1vZGUpICk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0gICAgICAgIGNhc2UgU0VUX01JQ19NVVRFOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvRmxpbmdlciwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgaW50IHN0YXRlID0gZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKCBzZXRNaWNNdXRlKHN0YXRlKSApOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIEdFVF9NSUNfTVVURTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKCBnZXR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CBsYXRlbmN5TXMgPSAwOwotICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3Qgb3V0cHV0ID0gQVVESU9fSU9fSEFORExFX05PTkU7Ci0gICAgICAgICAgICBzdGF0dXMgPSBvcGVuT3V0cHV0KG1vZHVsZSwgJm91dHB1dCwgJmNvbmZpZywgZGV2aWNlLCAmbGF0ZW5jeU1zLCBmbGFncyk7Ci0gICAgICAgICAgICBBTE9HVigiT1BFTl9PVVRQVVQgb3V0cHV0LCAlZCIsIG91dHB1dCk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMigoaW50MzJfdClzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKChpbnQzMl90KW91dHB1dCk7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlKCZjb25maWcsIHNpemVvZihhdWRpb19jb25maWdfdCkpOwotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGxhdGVuY3lNcyk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0gICAgICAgIGNhc2UgT1BFTl9EVVBMSUNBVEVfT1VUUFVUOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvRmxpbmdlciwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3Qgb3V0cHV0MSA9IChhdWRpb19pb19oYW5kbGVfdCkgZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90IG91dHB1dDIgPSAoYXVkaW9faW9faGFuZGxlX3QpIGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMigoaW50MzJfdCkgb3BlbkR1cGxpY2F0ZU91dHB1dCh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bW9kdWxlX2hhbmRsZV90IG1vZHVsZSA9IChhdWRpb19tb2R1bGVfaGFuZGxlX3QpZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90IGlucHV0ID0gKGF1ZGlvX2lvX2hhbmRsZV90KWRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBhdWRpb19jb25maWdfdCBjb25maWcgPSB7fTsKLSAgICAgICAgICAgIGlmIChkYXRhLnJlYWQoJmNvbmZpZywgc2l6ZW9mKGF1ZGlvX2NvbmZpZ190KSkgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBBTE9HRSgiYi8yMzkwNTk1MSIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190IGRldmljZSA9IChhdWRpb19kZXZpY2VzX3QpZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIFN0cmluZzggYWRkcmVzcyhkYXRhLnJlYWRTdHJpbmc4KCkpOwotICAgICAgICAgICAgYXVkaW9fc291cmNlX3Qgc291cmNlID0gKGF1ZGlvX3NvdXJjZV90KWRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBhdWRpb19pbnB1dF9mbGFnc190IGZsYWdzID0gKGF1ZGlvX2lucHV0X2ZsYWdzX3QpIGRhdGEucmVhZEludDMyKCk7Ci0KLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IG9wZW5JbnB1dChtb2R1bGUsICZpbnB1dCwgJmNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZGV2aWNlLCBhZGRyZXNzLCBzb3VyY2UsIGZsYWdzKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKChpbnQzMl90KSBzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKChpbnQzMl90KSBpbnB1dCk7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlKCZjb25maWcsIHNpemVvZihhdWRpb19jb25maWdfdCkpOwotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGRldmljZSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0gICAgICAgIGNhc2UgQ0xPU0VfSU5QVVQ6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihjbG9zZUlucHV0KChhdWRpb19pb19oYW5kbGVfdCkgZGF0YS5yZWFkSW50MzIoKSkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIElOVkFMSURBVEVfU1RSRUFNOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvRmxpbmdlciwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0gPSAoYXVkaW9fc3RyZWFtX3R5cGVfdCkgZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGludmFsaWRhdGVTdHJlYW0oc3RyZWFtKSk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0gICAgICAgIGNhc2UgU0VUX1ZPSUNFX1ZPTFVNRTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGZsb2F0IHZvbHVtZSA9IGRhdGEucmVhZEZsb2F0KCk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMiggc2V0Vm9pY2VWb2x1bWUodm9sdW1lKSApOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIEdFVF9SRU5ERVJfUE9TSVRJT046IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBvdXRwdXQgPSAoYXVkaW9faW9faGFuZGxlX3QpIGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICB1aW50MzJfdCBoYWxGcmFtZXMgPSAwOwotICAgICAgICAgICAgdWludDMyX3QgZHNwRnJhbWVzID0gMDsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGdldFJlbmRlclBvc2l0aW9uKCZoYWxGcmFtZXMsICZkc3BGcmFtZXMsIG91dHB1dCk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGhhbEZyYW1lcyk7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoZHNwRnJhbWVzKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfQotICAgICAgICBjYXNlIEdFVF9JTlBVVF9GUkFNRVNfTE9TVDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90IGlvSGFuZGxlID0gKGF1ZGlvX2lvX2hhbmRsZV90KSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoKGludDMyX3QpIG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F1ZGlvU2Vzc2lvbiA9IChhdWRpb19zZXNzaW9uX3QpIGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBpbnQgcGlkID0gZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHJlbGVhc2VBdWRpb1Nlc3Npb25JZChhdWRpb1Nlc3Npb24sIHBpZCk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0gICAgICAgIGNhc2UgUVVFUllfTlVNX0VGRkVDVFM6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICB1aW50MzJfdCBudW1FZmZlY3RzID0gMDsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHF1ZXJ5TnVtYmVyRWZmZWN0cygmbnVtRWZmZWN0cyk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKChpbnQzMl90KW51bUVmZmVjdHMpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9Ci0gICAgICAgIGNhc2UgUVVFUllfRUZGRUNUOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvRmxpbmdlciwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgZWZmZWN0X2Rlc2NyaXB0b3JfdCBkZXNjID0ge307Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBxdWVyeUVmZmVjdChkYXRhLnJlYWRJbnQzMigpLCAmZGVzYyk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA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dGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZSgmZGVzYywgc2l6ZW9mKGVmZmVjdF9kZXNjcmlwdG9yX3QpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfQotICAgICAgICBjYXNlIENSRUFURV9FRkZFQ1Q6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBlZmZlY3RfZGVzY3JpcHRvcl90IGRlc2MgPSB7fTsKLSAgICAgICAgICAgIGlmIChkYXRhLnJlYWQoJmRlc2MsIHNpemVvZihlZmZlY3RfZGVzY3JpcHRvcl90KSkgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBBTE9HRSgiYi8yMzkwNTk1MSIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3A8SUVmZmVjdENsaWVudD4gY2xpZW50ID0gaW50ZXJmYWNlX2Nhc3Q8SUVmZmVjdENsaWVudD4oZGF0YS5yZWFkU3Ryb25nQmluZGVyKCkpOwotICAgICAgICAgICAgaW50MzJfdCBwcmlvcml0eSA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBvdXRwdXQgPSAoYXVkaW9faW9faGFuZGxlX3QpIGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkID0gKGF1ZGlvX3Nlc3Npb25fdCkgZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIEF1ZGlvRGV2aWNlVHlwZUFkZHIgZGV2aWNlOwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gTk9fRVJST1I7Ci0gICAgICAgICAgICBpZiAoKHN0YXR1cyA9IGRhdGEucmVhZFBhcmNlbGFibGUoJmRldmljZSkpICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNvbnN0IFN0cmluZzE2IG9wUGFja2FnZU5hbWUgPSBkYXRhLnJlYWRTdHJpbmcxNigpOwotICAgICAgICAgICAgcGlkX3QgcGlkID0gKHBpZF90KWRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBib29sIHByb2JlID0gZGF0YS5yZWFkSW50MzIoKSA9PSAxOwotCi0gICAgICAgICAgICBpbnQgaWQgPSAwOwotICAgICAgICAgICAgaW50IGVuYWJsZWQgPSAwOwotCi0gICAgICAgICAgICBzcDxJRWZmZWN0PiBlZmZlY3QgPSBjcmVhdGVFZmZlY3QoJmRlc2MsIGNsaWVudCwgcHJpb3JpdHksIG91dHB1dCwgc2Vzc2lvbklkLCBkZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgIG9wUGFja2FnZU5hbWUsIHBpZCwgcHJvYmUsICZzdGF0dXMsICZpZCwgJmVuYWJsZWQpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGlkKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGVuYWJsZWQpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlU3Ryb25nQmluZGVyKElJbnRlcmZhY2U6OmFzQmluZGVyKGVmZmVjdCkpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlKCZkZXNjLCBzaXplb2YoZWZmZWN0X2Rlc2NyaXB0b3JfdCkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIE1PVkVfRUZGRUNUUzogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRh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ZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIobG9hZEh3TW9kdWxlKGRhdGEucmVhZENTdHJpbmcoKSkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIEdFVF9QUklNQVJZX09VVFBVVF9TQU1QTElOR19SQVRFOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvRmxpbmdlciwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoZ2V0UHJpbWFyeU91dHB1dFNhbXBsaW5nUmF0ZSgpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBHRVRfUFJJTUFSWV9PVVRQVVRfRlJBTUVfQ09VTlQ6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQ2NChnZXRQcmltYXJ5T3V0cHV0RnJhbWVDb3VudCgpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBTRVRfTE9XX1JBTV9ERVZJQ0U6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBpbnQzMl90IGlzTG93UmFtRGV2aWNlOwotICAgICAgICAgICAgaW50NjRfdCB0b3RhbE1lbW9yeTsKLSAgICAgICAgICAgIGNvbnN0IHN0YXR1c190IHN0YXR1cyA9Ci0gICAgICAgICAgICAgICAgICAgIGRhdGEucmVhZEludDMyKCZpc0xvd1JhbURldmljZSkgPzoKLSAgICAgICAgICAgICAgICAgICAgZGF0YS5yZWFkSW50NjQoJnRvdGFsTWVtb3J5KSA/OgotICAgICAgICAgICAgICAgICAgICBzZXRMb3dSYW1EZXZpY2UoaXNMb3dSYW1EZXZpY2UgIT0gMCwgdG90YWxNZW1vcnkpOwotICAgICAgICAgICAgKHZvaWQpcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBMSVNUX0FVRElPX1BPUlRTOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvRmxpbmdlciwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgdW5zaWduZWQgaW50IG51bVBvcnRzUmVxID0gZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIGlmIChudW1Qb3J0c1JlcSA+IE1BWF9JVEVNU19QRVJfTElTVCkgewotICAgICAgICAgICAgICAgIG51bVBvcnRzUmVxID0gTUFYX0lURU1TX1BFUl9MSVNUOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdW5zaWduZWQgaW50IG51bVBvcnRzID0gbnVtUG9ydHNSZXE7Ci0gICAgICAgICAgICBzdHJ1Y3QgYXVkaW9fcG9ydCAqcG9ydHMgPQotICAgICAgICAgICAgICAgICAgICAoc3RydWN0IGF1ZGlvX3BvcnQgKiljYWxsb2MobnVtUG9ydHNSZXEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihzdHJ1Y3QgYXVkaW9fcG9ydCkpOwotICAgICAgICAgICAgaWYgKHBvcnRzID09IE5VTEwpIHsKLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihOT19NRU1PUlkpOwotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKDApOwotICAgICAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGxpc3RBdWRpb1BvcnRzKCZudW1Qb3J0cywgcG9ydHMpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKG51bVBvcnRzKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBpZiAobnVtUG9ydHNSZXEgPiBudW1Qb3J0cykgewotICAgICAgICAgICAgICAgICAgICBudW1Qb3J0c1JlcSA9IG51bVBvcnRzOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGUocG9ydHMsIG51bVBvcnRzUmVxICogc2l6ZW9mKHN0cnVjdCBhdWRpb19wb3J0KSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBmcmVlKHBvcnRzKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBHRVRfQVVESU9fUE9SVDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHN0cnVjdCBhdWRpb19wb3J0IHBvcnQgPSB7fTsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGRhdGEucmVhZCgmcG9ydCwgc2l6ZW9mKHN0cnVjdCBhdWRpb19wb3J0KSk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgQUxPR0UoImIvMjM5MDU5NTEiKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RhdHVzID0gQXVkaW9TYW5pdGl6ZXI6OnNhbml0aXplQXVkaW9Qb3J0KCZwb3J0KTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBnZXRBdWRpb1BvcnQoJnBvcnQpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGUoJnBvcnQsIHNpemVvZihzdHJ1Y3QgYXVkaW9fcG9ydCkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIENSRUFURV9BVURJT19QQVRDSDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHN0cnVjdCBhdWRpb19wYXRjaCBwYXRjaDsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGRhdGEucmVhZCgmcGF0Y2gsIHNpemVvZihzdHJ1Y3QgYXVkaW9fcGF0Y2gpKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYXVkaW9fcGF0Y2hfaGFuZGxlX3QgaGFuZGxlID0gQVVESU9fUEFUQ0hfSEFORExFX05PTkU7Ci0gICAgICAgICAgICBzdGF0dXMgPSBkYXRhLnJlYWQoJmhhbmRsZSwgc2l6ZW9mKGF1ZGlvX3BhdGNoX2hhbmRsZV90KSk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgQUxPR0UoImIvMjM5MDU5NTEiKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RhdHVzID0gQXVkaW9TYW5pdGl6ZXI6OnNhbml0aXplQXVkaW9QYXRjaCgmcGF0Y2gpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IGNyZWF0ZUF1ZGlvUGF0Y2goJnBhdGNoLCAmaGFuZGxlKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXR1cyk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlKCZoYW5kbGUsIHNpemVvZihhdWRpb19wYXRjaF9oYW5kbGVfdCkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIFJFTEVBU0VfQVVESU9fUEFUQ0g6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBhdWRpb19wYXRjaF9oYW5kbGVfdCBoYW5kbGU7Ci0gICAgICAgICAgICBkYXRhLnJlYWQoJmhhbmRsZSwgc2l6ZW9mKGF1ZGlvX3BhdGNoX2hhbmRsZV90KSk7Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSByZWxlYXNlQXVkaW9QYXRjaChoYW5kbGUpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBMSVNUX0FVRElPX1BBVENIRVM6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICB1bnNpZ25lZCBpbnQgbnVtUGF0Y2hlc1JlcSA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBpZiAobnVtUGF0Y2hlc1JlcSA+IE1BWF9JVEVNU19QRVJfTElTVCkgewotICAgICAgICAgICAgICAgIG51bVBhdGNoZXNSZXEgPSBNQVhfSVRFTVNfUEVSX0xJU1Q7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB1bnNpZ25lZCBpbnQgbnVtUGF0Y2hlcyA9IG51bVBhdGNoZXNSZXE7Ci0gICAgICAgICAgICBzdHJ1Y3QgYXVkaW9fcGF0Y2ggKnBhdGNoZXMgPQotICAgICAgICAgICAgICAgICAgICAoc3RydWN0IGF1ZGlvX3BhdGNoICopY2FsbG9jKG51bVBhdGNoZXNSZXEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHN0cnVjdCBhdWRpb19wYXRjaCkpOwotICAgICAgICAgICAgaWYgKHBhdGNoZXMgPT0gTlVMTCkgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKE5PX01FTU9SWSk7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoMCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gbGlzdEF1ZGlvUGF0Y2hlcygmbnVtUGF0Y2hlcywgcGF0Y2hlcyk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIobnVtUGF0Y2hlcyk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG51bVBhdGNoZXNSZXEgPiBudW1QYXRjaGVzKSB7Ci0gICAgICAgICAgICAgICAgICAgIG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RVNTSU9OOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvRmxpbmdlciwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoZ2V0QXVkaW9Id1N5bmNGb3JTZXNzaW9uKChhdWRpb19zZXNzaW9uX3QpIGRhdGEucmVhZEludDMyKCkpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBTWVNURU1fUkVBRFk6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBzeXN0ZW1SZWFkeSgpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIEZSQU1FX0NPVU5UX0hBTDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb0ZsaW5nZXIsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDY0KCBmcmFtZUNvdW50SEFMKChhdWRpb19pb19oYW5kbGVfdCkgZGF0YS5yZWFkSW50MzIoKSkgKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBHRVRfTUlDUk9QSE9ORVM6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBzdGQ6OnZlY3RvcjxtZWRpYTo6TWljcm9waG9uZUluZm8+IG1pY3JvcGhvbmVzOwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gZ2V0TWljcm9waG9uZXMoJm1pY3JvcGhvbmVzKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXR1cyk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlUGFyY2VsYWJsZVZlY3RvcihtaWNyb3Bob25lcyk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLSAgICAgICAgY2FzZSBTRVRfQVVESU9fSEFMX1BJRFM6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9GbGluZ2VyLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBzdGQ6OnZlY3RvcjxwaWRfdD4gcGlkczsKLSAgICAgICAgICAgIGludDMyX3Qgc2l6ZTsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGRhdGEucmVhZEludDMyKCZzaXplKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHNpemUgPCAwKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChzaXplID4gTUFYX0lURU1TX1BFUl9MSVNUKSB7Ci0gICAgICAgICAgICAgICAgc2l6ZSA9IE1BWF9JVEVNU19QRVJfTElTVDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZvciAoaW50MzJfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgICAgIGludDMyX3QgcGlkOwotICAgICAgICAgICAgICAgIHN0YXR1cyA9ICBkYXRhLnJlYWRJbnQzMigmcGlkKTsKLSAgICAgICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgIC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NUQVRVUygKKyAgICAgICAgICAgICAgICBhaWRsMmxlZ2FjeV9FZmZlY3REZXNjcmlwdG9yX2VmZmVjdF9kZXNjcmlwdG9yX3QoYWlkbFJldCkpOworICAgIH0KKyAgICByZXR1cm4gT0s7Cit9CisKK3N0YXR1c190IEF1ZGlvRmxpbmdlckNsaWVudEFkYXB0ZXI6OmdldEVmZmVjdERlc2NyaXB0b3IoY29uc3QgZWZmZWN0X3V1aWRfdCogcEVmZmVjdFVVSUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVmZmVjdF91dWlkX3QqIHBUeXBlVVVJRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgcHJlZmVycmVkVHlwZUZsYWcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVmZmVjdF9kZXNjcmlwdG9yX3QqIHBEZXNjcmlwdG9yKSBjb25zdCB7CisgICAgbWVkaWE6OkF1ZGlvVXVpZCBlZmZlY3RVdWlkQWlkbCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMoCisgICAgICAgICAgICBsZWdhY3kyYWlkbF9hdWRpb191dWlkX3RfQXVkaW9VdWlkKCpwRWZmZWN0VVVJRCkpOworICAgIG1lZGlhOjpBdWRpb1V1aWQgdHlwZVV1aWRBaWRsID0gVkFMVUVfT1JfUkVUVVJOX1NUQVRVUygKKyAgICAgICAgICAgIGxlZ2FjeTJhaWRsX2F1ZGlvX3V1aWRfdF9BdWRpb1V1aWQoKnBUeXBlVVVJRCkpOworICAgIGludDMyX3QgcHJlZmVycmVkVHlwZUZsYWdBaWRsID0gVkFMVUVfT1JfUkVUVVJOX1NUQVRVUygKKyAgICAgICAgICAgIGNvbnZlcnRSZWludGVycHJldDxpbnQzMl90PihwcmVmZXJyZWRUeXBlRmxhZykpOworICAgIG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ICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgZHN0T3V0cHV0KSB7CisgICAgaW50MzJfdCBzZXNzaW9uQWlkbCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMobGVnYWN5MmFpZGxfYXVkaW9fc2Vzc2lvbl90X2ludDMyX3Qoc2Vzc2lvbikpOworICAgIGludDMyX3Qgc3JjT3V0cHV0QWlkbCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMoCisgICAgICAgICAgICBsZWdhY3kyYWlkbF9hdWRpb19pb19oYW5kbGVfdF9pbnQzMl90KHNyY091dHB1dCkpOworICAgIGludDMyX3QgZHN0T3V0cHV0QWlkbCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMoCisgICAgICAgICAgICBsZWdhY3kyYWlkbF9hdWRpb19pb19oYW5kbGVfdF9pbnQzMl90KGRzdE91dHB1dCkpOworICAgIHJldHVybiBzdGF0dXNURnJvbUJpbmRlclN0YXR1cygKKyAgICAgICAgICAgIG1EZWxlZ2F0ZS0+bW92ZUVmZmVjdHMoc2Vzc2lvbkFpZGwsIHNyY091dHB1dEFpZGwsIGRzdE91dHB1dEFpZGwpKTsKK30KKwordm9pZCBBdWRpb0ZsaW5nZXJDbGllbnRBZGFwdGVyOjpzZXRFZmZlY3RTdXNwZW5kZWQoaW50IGVmZmVjdElkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb25JZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgc3VzcGVuZGVkKSB7CisgICAgWyZdKCkgLT4gc3RhdHVzX3QgeworICAgICAgICBpbnQzMl90IGVmZmVjdElkQWlkbCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMoY29udmVydFJlaW50ZXJwcmV0PGludDMyX3Q+KGVmZmVjdElkKSk7CisgICAgICAgIGludDM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ICAgICAgICAgICAgICAgICAgICBjb25zdCBQYXJjZWwmIGRhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhcmNlbCogcmVwbHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGZsYWdzKSB7CisgICAgcmV0dXJuIG1EZWxlZ2F0ZS0+b25UcmFuc2FjdFdyYXBwZXIoc3RhdGljX2Nhc3Q8RGVsZWdhdGU6OlRyYW5zYWN0aW9uQ29kZT4oY29kZSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJl0geworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQm5BdWRpb0ZsaW5nZXJTZXJ2aWNlOjpvblRyYW5zYWN0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXBseSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFncyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7Cit9CisKK3N0YXR1c190IEF1ZGlvRmxpbmdlclNlcnZlckFkYXB0ZXI6OmR1bXAoaW50IGZkLCBjb25zdCBWZWN0b3I8U3RyaW5nMTY+JiBhcmdzKSB7CisgICAgcmV0dXJuIG1EZWxlZ2F0ZS0+ZHVtcChmZCwgYXJncyk7Cit9CisKK1N0YXR1cyBBdWRpb0ZsaW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Y3ksICZyZXN1bHQpKTsKKyAgICAqX2FpZGxfcmV0dXJuID0gVkFMVUVfT1JfUkVUVVJOX0JJTkRFUigKKyAgICAgICAgICAgIGxlZ2FjeTJhaWRsX2VmZmVjdF9kZXNjcmlwdG9yX3RfRWZmZWN0RGVzY3JpcHRvcihyZXN1bHQpKTsKKyAgICByZXR1cm4gU3RhdHVzOjpvaygpOworfQorCitTdGF0dXMgQXVkaW9GbGluZ2VyU2VydmVyQWRhcHRlcjo6Z2V0RWZmZWN0RGVzY3JpcHRvcihjb25zdCBtZWRpYTo6QXVkaW9VdWlkJiBlZmZlY3RVVUlELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgbWVkaWE6OkF1ZGlvVXVpZCYgdHlwZVVVSUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHByZWZlcnJlZFR5cGVGbGFnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWE6OkVmZmVjdERlc2NyaXB0b3IqIF9haWRsX3JldHVybikgeworICAgIGVmZmVjdF91dWlkX3QgZWZmZWN0VXVpZExlZ2FjeSA9IFZBTFVFX09SX1JFVFVSTl9CSU5ERVIoCisgICAgICAgICAgICBhaWRsMmxlZ2FjeV9BdWRpb1V1aWRfYXVkaW9fdXVpZF90KGVmZmVjdFVVSUQpKTsKKyAgICBlZmZlY3RfdXVpZF90IHR5cGVVdWlkTGVnYWN5ID0gVkFMVUVfT1JfUkVUVVJOX0JJTkRFUigKKyAgICAgICAgICAgIGFpZGwybGVnYWN5X0F1ZGlvVXVpZF9hdWRpb191dWlkX3QodHlwZVVVSUQpKTsKKyAgICB1aW50MzJfdCBwcmVmZXJyZWRUeXBlRmxhZ0xlZ2FjeSA9IFZBTFVFX09SX1JFVFVSTl9CSU5ERVIoCisgICAgICAgICAgICBjb252ZXJ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AgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb2xpY3lfZGV2X3N0YXRlX3Qgc3RhdGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIgKmRldmljZV9uYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZm9ybWF0X3QgZW5jb2RlZEZvcm1hdCkKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8dWludDMyX3Q+KGRldmljZSkpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoc3RhdGljX2Nhc3QgPHVpbnQzMl90PihzdGF0ZSkpOwotICAgICAgICBkYXRhLndyaXRlQ1N0cmluZyhkZXZpY2VfYWRkcmVzcyk7Ci0gICAgICAgIGRhdGEud3JpdGVDU3RyaW5nKGRldmljZV9uYW1lKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHN0YXRpY19jYXN0IDx1aW50MzJfdD4oZW5jb2RlZEZvcm1hdCkpOwotICAgICAgICByZW1vdGUoKS0+dHJhbnNhY3QoU0VUX0RFVklDRV9DT05ORUNUSU9OX1NUQVRFLCBkYXRhLCAmcmVwbHkpOwotICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3QgPHN0YXR1c190PiAocmVwbHkucmVhZEludDMyKCkpOwotICAgIH0KLQotICAgIHZpcnR1YWwgYXVkaW9fcG9saWN5X2Rldl9zdGF0ZV90IGdldERldmljZUNvbm5lY3Rpb25TdGF0ZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcykKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8dWludDMyX3Q+KGRldmljZSkpOwotICAgICAgICBkYXRhLndyaXRlQ1N0cmluZyhkZXZpY2VfYWRkcmVzcyk7Ci0gICAgICAgIHJlbW90ZSgpLT50cmFuc2FjdChHRVRfREVWSUNFX0NPTk5FQ1RJT05fU1RBVEUsIGRhdGEsICZyZXBseSk7Ci0gICAgICAgIHJldHVybiBzdGF0aWNfY2FzdCA8YXVkaW9fcG9saWN5X2Rldl9zdGF0ZV90PihyZXBseS5yZWFkSW50MzIoKSk7Ci0gICAgfQotCi0gICAgdmlydHVhbCBzdGF0dXNfdCBoYW5kbGVEZXZpY2VDb25maWdDaGFuZ2UoYXVkaW9fZGV2aWNlc190IGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19mb3JtYXRfdCBlbmNvZGVkRm9ybWF0KQotICAgIHsKLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5O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bHkucmVhZEludDMyKCkpOwotICAgIH0KLQotICAgIHZpcnR1YWwgYXVkaW9faW9faGFuZGxlX3QgZ2V0T3V0cHV0KGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtKQotICAgIHsKLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUF1ZGlvUG9saWN5U2VydmljZTo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHN0YXRpY19jYXN0IDx1aW50MzJfdD4oc3RyZWFtKSk7Ci0gICAgICAgIHJlbW90ZSgpLT50cmFuc2FjdChHRVRfT1VUUFVULCBkYXRhLCAmcmVwbHkpOwotICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3QgPGF1ZGlvX2lvX2hhbmRsZV90PiAocmVwbHkucmVhZEludDMyKCkpOwotICAgIH0KLQotICAgIHN0YXR1c190IGdldE91dHB1dEZvckF0dHIoYXVkaW9fYXR0cmlidXRlc190ICphdHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgKm91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc3RyZWFtX3R5cGVfdCAqc3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgdWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX3QgKmNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190IGZsYWdzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqc2VsZWN0ZWREZXZpY2VJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnBvcnRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGF1ZGlvX2lvX2hhbmRsZV90PiAqc2Vjb25kYXJ5T3V0cHV0cykgb3ZlcnJpZGUKLSAgICAgICAgewotICAgICAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgICAgICBpZiAoYXR0ciA9PSBudWxscHRyKSB7Ci0gICAgICAgICAgICAgICAgQUxPR0UoIiVzIE5VTEwgYXVkaW8gYXR0cmlidXRlcyIsIF9fZnVuY19fKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG91dHB1dCA9PSBudWxscHRyKSB7Ci0gICAgICAgICAgICAgICAgQUxPR0UoIiVzIE5VTEwgb3V0cHV0IC0gc2hvdWxkbid0IGhhcHBlbiIsIF9fZnVuY19fKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHNlbGVjdGVkRGV2aWNlSWQgPT0gbnVsbHB0cikgewotICAgICAgICAgICAgICAgIEFMT0dFKCIlcyBOVUxMIHNlbGVjdGVkRGV2aWNlSWQgLSBzaG91bGRuJ3QgaGFwcGVuIiwgX19mdW5jX18pOwotICAgICAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAocG9ydElkID09IG51bGxwdHIpIHsKLSAgICAgICAgICAgICAgICBBTE9HRSgiJXMgTlVMTCBwb3J0SWQgLSBzaG91bGRuJ3QgaGFwcGVuIiwgX19mdW5jX18pOwotICAgICAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoc2Vjb25kYXJ5T3V0cHV0cyA9PSBudWxscHRyKSB7Ci0gICAgICAgICAgICAgICAgQUxPR0UoIiVzIE5VTEwgc2Vjb25kYXJ5T3V0cHV0cyAtIHNob3VsZG4ndCBoYXBwZW4iLCBfX2Z1bmNfXyk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGRhdGEud3JpdGUoYXR0ciwgc2l6ZW9mKGF1ZGlvX2F0dHJpYnV0ZXNfdCkpOwotICAgICAgICAgICAgZGF0YS53cml0ZUludDMyKHNlc3Npb24pOwotICAgICAgICAgICAgaWYgKHN0cmVhbSA9PSBOVUxMKSB7Ci0gICAgICAgICAgICAgICAgZGF0YS53cml0ZUludDMyKDApOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBkYXRhLndyaXRlSW50MzIoMSk7Ci0gICAgICAgICAgICAgICAgZGF0YS53cml0ZUludDMyKCpzdHJlYW0pOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZGF0YS53cml0ZUludDMyKHBpZCk7Ci0gICAgICAgICAgICBkYXRhLndyaXRlSW50MzIodWlkKTsKLSAgICAgICAgICAgIGRhdGEud3JpdGUoY29uZmlnLCBzaXplb2YoYXVkaW9fY29uZmlnX3QpKTsKLSAgICAgICAgICAgIGRhdGEud3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8dWludDMyX3Q+KGZsYWdzKSk7Ci0gICAgICAgICAgICBkYXRhLndyaXRlSW50MzIoKnNlbGVjdGVkRGV2aWNlSWQpOwotICAgICAgICAgICAgZGF0YS53cml0ZUludDMyKCpwb3J0SWQpOwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gcmVtb3RlKCktPnRyYW5zYWN0KEdFVF9PVVRQVVRfRk9SX0FUVFIsIGRhdGEsICZyZXBseSk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0YXR1cyA9IChzdGF0dXNfdClyZXBseS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RhdHVzID0gKHN0YXR1c190KXJlcGx5LnJlYWQoJmF0dHIsIHNpemVvZihhdWRpb19hdHRyaWJ1dGVzX3QpKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgKm91dHB1dCA9IChhdWRpb19pb19oYW5kbGVfdClyZXBseS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIGF1ZGlvX3N0cmVhbV90eXBlX3QgbFN0cmVhbSA9IChhdWRpb19zdHJlYW1fdHlwZV90KXJlcGx5LnJlYWRJbnQzMigpOwotICAgICAgICAgICAgaWYgKHN0cmVhbSAhPSBOVUxMKSB7Ci0gICAgICAgICAgICAgICAgKnN0cmVhbSA9IGxTdHJlYW07Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICAqc2VsZWN0ZWREZXZpY2VJZCA9IChhdWRpb19wb3J0X2hhbmRsZV90KXJlcGx5LnJlYWRJbnQzMigpOwotICAgICAgICAgICAgKnBvcnRJZCA9IChhdWRpb19wb3J0X2hhbmRsZV90KXJlcGx5LnJlYWRJbnQzMigpOwotICAgICAgICAgICAgc2Vjb25kYXJ5T3V0cHV0cy0+cm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XN0IDxzdGF0dXNfdD4gKHJlcGx5LnJlYWRJbnQzMigpKTsKLSAgICB9Ci0KLSAgICB2aXJ0dWFsIHZvaWQgcmVsZWFzZU91dHB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCkKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMigoaW50MzJfdClwb3J0SWQpOwotICAgICAgICByZW1vdGUoKS0+dHJhbnNhY3QoUkVMRUFTRV9PVVRQVVQsIGRhdGEsICZyZXBseSk7Ci0gICAgfQotCi0gICAgdmlydHVhbCBzdGF0dXNfdCBnZXRJbnB1dEZvckF0dHIoY29uc3QgYXVkaW9fYXR0cmlidXRlc190ICphdHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICppbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb191bmlxdWVfaWRfdCByaWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IHBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nMTYmIG9wUGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqY29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lucHV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ybiBCQURfVkFMVUU7Ci0gICAgICAgIH0KLQotICAgICAgICBkYXRhLndyaXRlKGF0dHIsIHNpemVvZihhdWRpb19hdHRyaWJ1dGVzX3QpKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKCppbnB1dCk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihyaWlkKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHNlc3Npb24pOwotICAgICAgICBkYXRhLndyaXRlSW50MzIocGlkKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHVpZCk7Ci0gICAgICAgIGRhdGEud3JpdGVTdHJpbmcxNihvcFBhY2thZ2VOYW1lKTsKLSAgICAgICAgZGF0YS53cml0ZShjb25maWcsIHNpemVvZihhdWRpb19jb25maWdfYmFzZV90KSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihmbGFncyk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMigqc2VsZWN0ZWREZXZpY2VJZCk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMigqcG9ydElkKTsKLSAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gcmVtb3RlKCktPnRyYW5zYWN0KEdFVF9JTlBVVF9GT1JfQVRUUiwgZGF0YSwgJnJlcGx5KTsKLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgfQotICAgICAgICBzdGF0dXMgPSByZXBseS5yZWFkSW50MzIoKTsKLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgfQotICAgICAgICAqaW5wdXQgPSAoYXVkaW9faW9faGFuZGxlX3QpcmVwbHkucmVhZEludDMyKCk7Ci0gICAgICAgICpzZWxlY3RlZERldmljZUlkID0gKGF1ZGlvX3BvcnRfaGFuZGxlX3QpcmVwbHkucmVhZEludDMyKCk7Ci0gICA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KGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkKQotICAgIHsKLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUF1ZGlvUG9saWN5U2VydmljZTo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHBvcnRJZCk7Ci0gICAgICAgIHJlbW90ZSgpLT50cmFuc2FjdChSRUxFQVNFX0lOUFVULCBkYXRhLCAmcmVwbHkpOwotICAgIH0KLQotICAgIHZpcnR1YWwgc3RhdHVzX3QgaW5pdFN0cmVhbVZvbHVtZShhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleE1pbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleE1heCkKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8dWludDMyX3Q+KHN0cmVhbSkpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoaW5kZXhNaW4pOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoaW5kZXhNYXgpOwotICAgICAgICByZW1vdGUoKS0+dHJhbnNhY3QoSU5JVF9TVFJFQU1fVk9MVU1FLCBkYXRhLCAmcmVwbHkpOwotICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3QgPHN0YXR1c190PiAocmVwbHkucmVhZEludDMyKCkpOwotICAgIH0KLQotICAgIHZpcnR1YWwgc3RhdHVzX3Qgc2V0U3RyZWFtVm9sdW1lSW5kZXgoYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19kZXZpY2VzX3QgZGV2aWNlKQotICAgIHsKLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUF1ZGlvUG9saWN5U2VydmljZTo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHN0YXRpY19jYXN0IDx1aW50MzJfdD4oc3RyZWFtKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihpbmRleCk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8dWludDMyX3Q+KGRldmljZSkpOwotICAgICAgICByZW1vdGUoKS0+dHJhbnNhY3QoU0VUX1NUUkVBTV9WT0xVTUUsIGRhdGEsICZyZXBseSk7Ci0gICAgICAgIHJldHVybiBzdGF0aWNfY2FzdCA8c3RhdHVzX3Q+IChyZXBseS5yZWFkSW50MzIoKSk7Ci0gICAgfQotCi0gICAgdmlydHVhbCBzdGF0dXNfdCBnZXRTdHJlYW1Wb2x1bWVJbmRleChhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCAqaW5kZXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19kZXZpY2VzX3QgZGV2aWNlKQotICAgIHsKLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUF1ZGlvUG9saWN5U2VydmljZTo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKLSAgICAg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KTsKLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3QgPHN0YXR1c190PiAocmVwbHkucmVhZEludDMyKCkpOwotICAgIH0KLSAgICB2aXJ0dWFsIHN0YXR1c190IGdldFZvbHVtZUluZGV4Rm9yQXR0cmlidXRlcyhjb25zdCBhdWRpb19hdHRyaWJ1dGVzX3QgJmF0dHIsIGludCAmaW5kZXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190IGRldmljZSkKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGUoJmF0dHIsIHNpemVvZihhdWRpb19hdHRyaWJ1dGVzX3QpKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHN0YXRpY19jYXN0IDx1aW50MzJfdD4oZGV2aWNlKSk7Ci0gICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHJlbW90ZSgpLT50cmFuc2FjdChHRVRfVk9MVU1FX0FUVFJJQlVURVMsIGRhdGEsICZyZXBseSk7Ci0gICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgIH0KLSAgICAgICAgc3RhdHVzID0gc3RhdGljX2Nhc3QgPHN0YXR1c190PiAocmVwbHkucmVhZEludDMyKCkpOwotICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICB9Ci0gICAgICAgIGluZGV4ID0gcmVwb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NfdCByZWdpc3RlckVmZmVjdChjb25zdCBlZmZlY3RfZGVzY3JpcHRvcl90ICpkZXNjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90IGlvLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHN0cmF0ZWd5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpZCkKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGUoZGVzYywgc2l6ZW9mKGVmZmVjdF9kZXNjcmlwdG9yX3QpKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKGlvKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHN0cmF0ZWd5KTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHNlc3Npb24pOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoaWQpOwotICAgICAgICByZW1vdGUoKS0+dHJhbnNhY3QoUkVHSVNURVJfRUZGRUNULCBkYXRhLCAmcmVwbHkpOwotICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3QgPHN0YXR1c190PiAocmVwbHkucmVhZEludDMyKCkpOwotICAgIH0KLQotICAgIHZpcnR1YWwgc3RhdHVzX3QgdW5yZWdpc3RlckVmZmVjdChpbnQgaWQpCi0gICAgewotICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQXVkaW9Qb2xpY3lTZXJ2aWNlOjpnZXRJbn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PT0gTlVMTCB8fCBjb3VudCA9PSBOVUxMKSB7Ci0gICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICB9Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihhdWRpb1Nlc3Npb24pOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoKmNvdW50KTsKLSAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gcmVtb3RlKCktPnRyYW5zYWN0KFFVRVJZX0RFRkFVTFRfUFJFX1BST0NFU1NJTkcsIGRhdGEsICZyZXBseSk7Ci0gICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgIH0KLSAgICAgICAgc3RhdHVzID0gc3RhdGljX2Nhc3QgPHN0YXR1c190PiAocmVwbHkucmVhZEludDMyKCkpOwotICAgICAgICB1aW50MzJfdCByZXRDb3VudCA9IHJlcGx5LnJlYWRJbnQzMigpOwotICAgICAgICBpZiAocmV0Q291bnQgIT0gMCkgewotICAgICAgICAgICAgdWludDMyX3QgbnVtRGVzYyA9IChyZXRDb3VudCA8ICpjb3VudCkgPyByZXRDb3VudCA6ICpjb3VudDsKLSAgICAgICAgICAgIHJlcGx5LnJlYWQoZGVzY3JpcHRvcnMsIHNpemVvZihlZmZlY3RfZGVzY3JpcHRvcl90KSAqIG51bURlc2MpOwotICAgICAgICB9Ci0gICAgICAgICpjb3VudCA9IHJldENvdW50OwotICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgIH0KLQotICAgIHN0YXR1c190IHNldFN1cHBvcnRlZFN5c3RlbVVzYWdlcyhjb25zdCBzdGQ6OnZlY3RvcjxhdWRpb191c2FnZV90PiYgc3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IHJlbW90ZSgpLT50cmFuc2FjdChJU19ESVJFQ1RfT1VUUFVUX1NVUFBPUlRFRCwgZGF0YSwgJnJlcGx5KTsKLSAgICAgICAgcmV0dXJuIHN0YXR1cyA9PSBOT19FUlJPUiA/IHN0YXRpY19jYXN0PGJvb2w+KHJlcGx5LnJlYWRJbnQzMigpKSA6IGZhbHNlOwotICAgIH0KLQotICAgIHZpcnR1YWwgc3RhdHVzX3QgbGlzdEF1ZGlvUG9ydHMoYXVkaW9fcG9ydF9yb2xlX3Qgcm9sZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfdHlwZV90IHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBpbnQgKm51bV9wb3J0cywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cnVjdCBhdWRpb19wb3J0ICpwb3J0cywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuc2lnbmVkIGludCAqZ2VuZXJhdGlvbikKLSAgICB7Ci0gICAgICAgIGlmIChudW1fcG9ydHMgPT0gTlVMTCB8fCAoKm51bV9wb3J0cyAhPSAwICYmIHBvcnRzID09IE5VTEwpIHx8Ci0gICAgICAgICAgICAgICAgZ2VuZXJhdGlvbiA9PSBOVUxMKSB7Ci0gICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICB9Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIHVuc2lnbmVkIGludCBudW1Qb3J0c1JlcSA9IChwb3J0cyA9PSBOVUxMKSA/IDAgOiAqbnVtX3BvcnRzOwotICAgICAgICBkYXRhLndyaXRlSW50MzIocm9sZSk7Ci0gICAgICAgI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XR1czsKLSAgICB9Ci0KLSAgICB2aXJ0dWFsIHN0YXR1c190IGxpc3RBdWRpb1BhdGNoZXModW5zaWduZWQgaW50ICpudW1fcGF0Y2hlcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0IGF1ZGlvX3BhdGNoICpwYXRjaGVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBpbnQgKmdlbmVyYXRpb24pCi0gICAgewotICAgICAgICBpZiAobnVtX3BhdGNoZXMgPT0gTlVMTCB8fCAoKm51bV9wYXRjaGVzICE9IDAgJiYgcGF0Y2hlcyA9PSBOVUxMKSB8fAotICAgICAgICAgICAgICAgIGdlbmVyYXRpb24gPT0gTlVMTCkgewotICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKLSAgICAgICAgfQotICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQXVkaW9Qb2xpY3lTZXJ2aWNlOjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOwotICAgICAgICB1bnNpZ25lZCBpbnQgbnVtUGF0Y2hlc1JlcSA9IChwYXRjaGVzID09IE5VTEwpID8gMCA6ICpudW1fcGF0Y2hlczsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKG51bVBhdGNoZXNSZXEpOwotICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSByZW1vdGUoKS0+dHJhbnNhY3QoTElTVF9BVURJT19QQVRDSEVTLCBkYXRhLCAmcmVwbHkpOwotICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICBzdGF0dXMgPSAoc3RhdHVzX3QpcmVwbHkucmVhZEludDMyKCk7Ci0gICAgICAgICAgICAqbnVtX3BhdGNoZXMgPSAodW5zaWduZWQgaW50KXJlcGx5LnJlYWRJbnQzMigpOwotICAgICAgICB9Ci0gIC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dmlydHVhbCBzdGF0dXNfdCBnZXRNYXN0ZXJNb25vKGJvb2wgKm1vbm8pCi0gICAgewotICAgICAgICBpZiAobW9ubyA9PSBudWxscHRyKSB7Ci0gICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICB9Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0KLSAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gcmVtb3RlKCktPnRyYW5zYWN0KEdFVF9NQVNURVJfTU9OTywgZGF0YSwgJnJlcGx5KTsKLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgfQotICAgICAgICBzdGF0dXMgPSBzdGF0aWNfY2FzdDxzdGF0dXNfdD4ocmVwbHkucmVhZEludDMyKCkpOwotICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAqbW9ubyA9IHN0YXRpY19jYXN0PGJvb2w+KHJlcGx5LnJlYWRJbnQzMigpKTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgIH0KLQotICAgIHZpcnR1YWwgZmxvYXQgZ2V0U3RyZWFtVm9sdW1lREIoYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0sIGludCBpbmRleCwgYXVkaW9fZGV2aWNlc190IGRldmljZSkKLSAgICB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8aW50MzJfdD4oc3RyZWFtKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8aW50MzJfdD4oaW5kZXgpKTsKLSAgICAgICAgZGF0YS53cml0ZVVpbnQzMihzdGF0aWNfY2FzdCA8dWludDMyX3Q+KGRldmljZSkpOwotICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSByZW1vdGUoKS0+dHJhbnNhY3QoR0VUX1NUUkVBTV9WT0xVTUVfREIsIGRhdGEsICZyZXBseSk7Ci0gICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgIHJldHVybiBOQU47Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIHJlcGx5LnJlYWRGbG9hdCgpOwotICAgIH0KLQotICAgIHZpcnR1YWwgc3RhdHVzX3QgZ2V0U3Vycm91bmRGb3JtYXRzKHVuc2lnbmVkIGludCAqbnVtU3Vycm91bmRGb3JtYXRzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1hdF90ICpzdXJyb3VuZEZvcm1hdHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCAqc3Vycm91bmRGb3JtYXRzRW5hYmxlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHJlcG9ydGVkKQotICAgIHsKLSAgICAgICAgaWYgKG51bVN1cnJvdW5kRm9ybWF0cyA9PSBOVUxMIHx8ICgqbnVtU3Vycm91bmRGb3JtYXRzICE9IDAgJiYKLSAgICAgICAgICAgICAgICAoc3Vycm91bmRGb3JtYXRzID09IE5VTEwgfHwgc3Vycm91bmRGb3JtYXRzRW5hYmxlZCA9PSBOVUxMKSkpIHsKLSAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7Ci0gICAgICAgIH0KLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICBkYXRhLnd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dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gcmVwbHkucmVhZChzdXJyb3VuZEZvcm1hdHNFbmFibGVkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtU3Vycm91bmRGb3JtYXRzUmVxICogc2l6ZW9mKGJvb2wpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgIH0KLQotICAgIHZpcnR1YWwgc3RhdHVzX3Qgc2V0U3Vycm91bmRGb3JtYXRFbmFibGVkKGF1ZGlvX2Zvcm1hdF90IGF1ZGlvRm9ybWF0LCBib29sIGVuYWJsZWQpCi0gICAgewotICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQXVkaW9Qb2xpY3lTZXJ2aWNlOjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoYXVkaW9Gb3JtYXQpOwotICAgICAgICBkYXRhLndyaXRlQm9vbChlbmFibGVkKTsKLSAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gcmVtb3RlKCktPnRyYW5zYWN0KFNFVF9TVVJST1VORF9GT1JNQVRfRU5BQkxFRCwgZGF0YSwgJnJlcGx5KTsKLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gcmVwbHkucmVhZEludDMyKCk7Ci0gICAgfQotCi0gICAgdmlydHVhbCBzdGF0dXNfdCBnZXRId09mZmxvYWRFbmNvZGluZ0Zvcm1hdHNTdXBwb3J0ZWRGb3JBMkRQKAotICAgICAgICAgICAgICAgIHN0ZDo6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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZWZmZWN0X3V1aWRfdCAqdXVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBwcmlvcml0eSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fdXNhZ2VfdCB1c2FnZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fdW5pcXVlX2lkX3QqIGlkKQotICAgIHsKLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUF1ZGlvUG9saWN5U2VydmljZTo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKLSAgICAgICAgZGF0YS53cml0ZSh0eXBlLCBzaXplb2YoZWZmZWN0X3V1aWRfdCkpOwotICAgICAgICBkYXRhLndyaXRlU3RyaW5nMTYob3BQYWNrYWdlTmFtZSk7Ci0gICAgICAgIGRhdGEud3JpdGUodXVpZCwgc2l6ZW9mKGVmZmVjdF91dWlkX3QpKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKHByaW9yaXR5KTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKChpbnQzMl90KSB1c2FnZSk7Ci0gICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHJlbW90ZSgpLT50cmFuc2FjdChBRERfU1RSRUFNX0RFRkFVTFRfRUZGRUNULCBkYXRhLCAmcmVwbHkpOwotICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICB9Ci0gICAgICAgIHN0YXR1cyA9IHN0YXRpY19jYXN0IDxzdGF0dXNfdD4gKHJlcGx5LnJlYWRJbnQzMigpKTsKLSAgICAgICAgKmlkID0gcmVwbHkucmVhZEludDMyKCk7Ci0gICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgfQotCi0gICAgdmlydHVhbCBzdGF0dXNfdCByZW1vdmVTdHJlYW1EZWZhdWx0RWZmZWN0KGF1ZGlvX3VuaXF1ZV9pZF90IGlkKQotICAgIHsKLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUF1ZGlvUG9saWN5U2VydmljZTo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKLSAgICAgICAgZGF0YS53cml0ZUludDMyKGlkKTsKLSAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gcmVtb3RlKCktPnRyYW5zYWN0KFJFTU9WRV9TVFJFQU1fREVGQVVMVF9FRkZFQ1QsIGRhdGEsICZyZXBseSk7Ci0gICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0IDxzdGF0dXNfdD4gKHJlcGx5LnJlYWRJbnQzMigpKTsKLSAgICB9Ci0KLSAgICB2aXJ0dWFsIHN0YXR1c190IGFkZFNvdXJjZURlZmF1bHRFZmZlY3QoY29uc3QgZWZmZWN0X3V1aWRfdCAqdHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nMTYmIG9wUGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVmZmVjdF91dWlkX3QgKnV1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgcHJpb3JpdHksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3NvdXJjZV90IHNvdXJjZSwKLSAgICAgICAgICA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BpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgc2l6ZV90IHBvc2l0aW9uID0gZGF0YS5kYXRhUG9zaXRpb24oKTsKLSAgICAgICAgICAgIGlmIChkZXZpY2VzW2ldLndyaXRlVG9QYXJjZWwoJmRhdGEpICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgZGF0YS5zZXREYXRhUG9zaXRpb24ocG9zaXRpb24pOwotICAgICAgICAgICAgICAgIGZpbmFsU2l6ZS0tOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGlmIChzaXplICE9IGZpbmFsU2l6ZSkgewotICAgICAgICAgICAgc2l6ZV90IHBvc2l0aW9uID0gZGF0YS5kYXRhUG9zaXRpb24oKTsKLSAgICAgICAgICAgIGRhdGEuc2V0RGF0YVBvc2l0aW9uKHNpemVQb3NpdGlvbik7Ci0gICAgICAgICAgICBkYXRhLndyaXRlSW50MzIoZmluYWxTaXplKTsKLSAgICAgICAgICAgIGRhdGEuc2V0RGF0YVBvc2l0aW9uKHBvc2l0aW9uKTsKLSAgICAgICAgfQotCi0gICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHJlbW90ZSgpLT50cmFuc2FjdChTRVRfVUlEX0RFVklDRV9BRkZJTklUWSwgZGF0YSwgJnJlcGx5KTsKLSAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgc3RhdHVzID0gKHN0YXR1c190KXJlcGx5LnJlYWRJbnQzMigpOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgfQotCi0gICAgdmlydHVhbCBzdGF0dXNfdCByZW1vdmVVaWREZXZpY2VBZmZpbml0aWVzKHVpZF90IHVpZCkgewotICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQXVkaW9Qb2xpY3lTZXJ2aWNlOjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOwotCi0gICAgICAgIGRhdGEud3JpdGVJbnQzMigoaW50MzJfdCkgdWlkKTsKLQotICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPQotICAgICAgICAgICAgcmVtb3RlKCktPnRyYW5zYWN0KFJFTU9WRV9VSURfREVWSUNFX0FGRklOSVRZLCBkYXRhLCAmcmVwbHkpOwotICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICBzdGF0dXMgPSAoc3RhdHVzX3QpIHJlcGx5LnJlYWRJbnQzMigpOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgfQotCi0gICAgICAgIHZpcnR1YWwgc3RhdHVzX3Qgc2V0VXNlcklkRGV2aWNlQWZmaW5pdGllcyhpbnQgdXNlcklkLAotICAgICAgICAgICAgICAgIGNvbnN0IFZlY3RvcjxBdWRpb0RldmljZVR5cGVBZGRyPiYgZGV2aWNlcykKLSAgICAgICAgewotICAgICAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2U6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0KLSAgICAgICAgICAgIGRhdGEud3JpdGVJbnQzMigoaW50MzJfdCkgdXNlcklkKTsKLSAgICAgICAgICAgIHNpemVfdCBzaXplID0gZGV2aWNlcy5zaXplKCk7Ci0gICAgICAgICAgICBzaXplX3Qgc2l6ZVBvc2l0aW9uID0gZGF0YS5kYXRhUG9zaXRpb24oKTsKLSAgICAgICAgICAgIGRhdGEud3JpdGVJbnQzMigoaW50MzJfdCkgc2l6ZSk7Ci0gICAgICAgICAgICBzaXplX3QgZmluYWxTaXplID0gc2l6ZTsKLSAgICAgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgc2l6ZV90IHBvc2l0aW9uID0gZGF0YS5kYXRhUG9zaXRpb24oKTsKLSAgICAgICAgICAgICAgICBpZiAoZGV2aWNlc1tpXS53cml0ZVRvUGFyY2VsKCZkYXRhKSAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgICAgICBkYXRhLnNldERhdGFQb3NpdGlvbihwb3NpdGlvbik7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsU2l6ZS0tOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChzaXplICE9IGZpbmFsU2l6ZSkgewotICAgICAgICAgICAgICAgIHNpemVfdCBwb3NpdGlvbiA9IGRhdGEuZGF0YVBvc2l0aW9uKCk7Ci0gICAgICAgICAgICAgICAgZGF0YS5zZXREYXRhUG9zaXRpb24oc2l6ZVBvc2l0aW9uKTsKLSAgICAgICAgICAgICAgICBkYXRhLndyaXRlSW50MzIoZmluYWxTaXplKTsKLSAgICAgICAgICAgICAgICBkYXRhLnNldERhdGFQb3NpdGlvbihwb3NpdGlvbik7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHJlbW90ZSgpLT50cmFuc2FjdChTRVRfVVNFUklEX0RFVklDRV9BRkZJTklUWSwgZGF0YSwgJnJlcGx5KTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSAoc3RhdHVzX3QpcmVwbHkucmVhZEludDMyKCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICB9Ci0KLSAgICAgICAgdmlydHVhbCBzdGF0dXNfdCByZW1vdmVVc2VySWREZXZpY2VBZmZpbml0aWVzKGludCB1c2VySWQpIHsKLSAgICAgICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY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i0gICAgICAgICAgICBjb25zdCBzcDxtZWRpYTo6SUNhcHR1cmVTdGF0ZUxpc3RlbmVyPiYgbGlzdGVuZXIsCi0gICAgICAgICAgICBib29sKiByZXN1bHQpIG92ZXJyaWRlIHsKLSAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OwotICAgICAgICBzdGF0dXNfdCBzdGF0dXM7Ci0gICAgICAgIHN0YXR1cyA9Ci0gICAgICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUF1ZGlvUG9saWN5U2VydmljZTo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgc3RhdHVzID0gZGF0YS53cml0ZVN0cm9uZ0JpbmRlcihJSW50ZXJmYWNlOjphc0JpbmRlcihsaXN0ZW5lcikpOwotICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSByZXR1cm4gc3RhdHVzOwotICAgICAgICBzdGF0dXMgPQotICAgICAgICAgICAgcmVtb3RlKCktPnRyYW5zYWN0KFJFR0lTVEVSX1NPVU5EVFJJR0dFUl9DQVBUVVJFX1NUQVRFX0xJU1RFTkVSLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnJlcGx5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDApOwotICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSByZXR1cm4gc3RhdHVzOwotICAgICAgICBzdGF0dXMgPSByZXBseS5yZWFkQm9vbChyZXN1bHQpOwotICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSByZXR1cm4gc3RhdHVzOwotICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgfQotfTsKLQotSU1QTEVNRU5UX01FVEFfSU5URVJGQUNFKEF1ZGlvUG9saW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BCaW5kZXIgdHJhbnNhY3Rpb246IFNFVF9ERVZJQ0VfQ09OTkVDVElPTl9TVEFURSBmb3IgZGV2aWNlICV1IiwgZGV2aWNlKTsKLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0aWNfY2FzdDxpbnQzMl90PiAoQkFEX1ZBTFVFKSk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0PHVpbnQzMl90PiAoc2V0RGV2aWNlQ29ubmVjdGlvblN0YXRlKGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2VfYWRkcmVzcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2VfbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlY0Zvcm1hdCkpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIEdFVF9ERVZJQ0VfQ09OTkVDVElPTl9TVEFURTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UgPQotICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxhdWRpb19kZXZpY2VzX3Q+IChkYXRhLnJlYWRJbnQzMigpKTsKLSAgICAgICAgICAgIGNvbnN0IGNoYXIgKmRldmljZV9hZGRyZXNzID0gZGF0YS5yZWFkQ1N0cmluZygpOwotICAgICAgICAgICAgaWYgKGRldmljZV9hZGRyZXNzID09IG51bGxwdHIpIHsKLSAgICAgICAgICAgICAgICBBTE9HRSgiQmFkIEJpbmRlciB0cmFuc2FjdGlvbjogR0VUX0RFVklDRV9DT05ORUNUSU9OX1NUQVRFIGZvciBkZXZpY2UgJXUiLCBkZXZpY2UpOwotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0PGludDMyX3Q+IChBVURJT19QT0xJQ1lfREVWSUNFX1NUQVRFX1VOQVZBSUxBQkxFKSk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0PHVpbnQzMl90PiAoZ2V0RGV2aWNlQ29ubmVjdGlvblN0YXRlKGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2VfYWRkcmVzcykpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIEhBTkRMRV9ERVZJQ0VfQ09ORklHX0NIQU5HRTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UgPQotICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdCA8YXVkaW9fZGV2aWNlc190PihkYXRhLnJlYWRJbnQzMigpKTsKLSAgICAgICAgICAgIGNvbnN0IGNoYXIgKmRldmljZV9hZGRyZXNzID0gZGF0YS5yZWFkQ1N0cmluZygpOwotICAgICAgICAgICAgY29uc3QgY2hhciAqZGV2aWNlX25hbWUgPSBkYXRhLnJlYWRDU3RyaW5nKCk7Ci0gICAgICAgICAgICBhdWRpb19mb3JtYXRfdCBjb2RlY0Zvcm1hdCA9Ci0gICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0IDxhdWRpb19mb3JtYXRfdD4oZGF0YS5yZWFkSW50MzIoKSk7Ci0gICAgICAgICAgICBpZiAoZGV2aWNlX2FkZHJlc3MgPT0gbnVsbHB0ciB8fCBkZXZpY2VfbmFtZSA9PSBudWxscHRyKSB7Ci0gICAgICAgICAgICAgICAgQUxPR0UoIkJhZCBCaW5kZXIgdHJhbnNhY3Rpb246IEhBTkRMRV9ERVZJQ0VfQ09ORklHX0NIQU5HRSBmb3IgZGV2aWNlICV1IiwgZGV2aWNlKTsKLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0aWNfY2FzdDxpbnQzMl90PiAoQkFEX1ZBTFVFKSk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0PHVpbnQzMl90PiAoaGFuZGxlRGV2aWNlQ29uZmlnQ2hhbmdlKGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2VfYWRkcmVzcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2VfbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlY0Zvcm1hdCkpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIFNFVF9QSE9ORV9TVEFURTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0IDx1aW50MzJfdD4oc2V0UGhvbmVTdGF0ZSgKLSAgICAgICAgICAgICAgICAgICAgKGF1ZGlvX21vZGVfdCkgZGF0YS5yZWFkSW50MzIoKSwKLSAgICAgICAgICAgICAgICAgICAgKHVpZF90KSBkYXRhLnJlYWRJbnQzMigpKSkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgU0VUX0ZPUkNFX1VTRTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGF1ZGlvX3BvbGljeV9mb3JjZV91c2VfdCB1c2FnZSA9IHN0YXRpY19jYXN0IDxhdWRpb19wb2xpY3lfZm9yY2VfdXNlX3Q+KAotICAgICAgICAgICAgICAgICAgICBkYXRhLnJlYWRJbnQzMigpKTsKLSAgICAgICAgICAgIGF1ZGlvX3BvbGljeV9mb3JjZWRfY2ZnX3QgY29uZmlnID0KLSAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3QgPGF1ZGlvX3BvbGljeV9mb3JjZWRfY2ZnX3Q+KGRhdGEucmVhZEludDMyKCkpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdGljX2Nhc3QgPHVpbnQzMl90PihzZXRGb3JjZVVzZSh1c2FnZSwgY29uZmlnKSkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgR0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V0ZXNfdCBhdHRyID0gQVVESU9fQVRUUklCVVRFU19JTklUSUFMSVpFUjsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGRhdGEucmVhZCgmYXR0ciwgc2l6ZW9mKGF1ZGlvX2F0dHJpYnV0ZXNfdCkpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbiA9IChhdWRpb19zZXNzaW9uX3QpZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtID0gQVVESU9fU1RSRUFNX0RFRkFVTFQ7Ci0gICAgICAgICAgICBib29sIGhhc1N0cmVhbSA9IGRhdGEucmVhZEludDMyKCkgIT0gMDsKLSAgICAgICAgICAgIGlmIChoYXNTdHJlYW0pIHsKLSAgICAgICAgICAgICAgICBzdHJlYW0gPSAoYXVkaW9fc3RyZWFtX3R5cGVfdClkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcGlkX3QgcGlkID0gKHBpZF90KWRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICB1aWRfdCB1aWQgPSAodWlkX3QpZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIGF1ZGlvX2NvbmZpZ190IGNvbmZpZzsKLSAgICAgICAgICAgIG1lbXNldCgmY29uZmlnLCAwLCBzaXplb2YoYXVkaW9fY29uZmlnX3QpKTsKLSAgICAgICAgICAgIGRhdGEucmVhZCgmY29uZmlnLCBzaXplb2YoYXVkaW9fY29uZmlnX3QpKTsKLSAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190IGZsYWdzID0KLSAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3QgPGF1ZGlvX291dHB1dF9mbGFnc190PihkYXRhLnJlYWRJbnQzMigpKTsKLSAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3Qgc2VsZWN0ZWREZXZpY2VJZCA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCA9IChhdWRpb19wb3J0X2hhbmRsZV90KWRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBvdXRwdXQgPSAwOwotICAgICAgICAgICAgc3RkOjp2ZWN0b3I8YXVkaW9faW9faGFuZGxlX3Q+IHNlY29uZGFyeU91dHB1dHM7Ci0KLSAgICAgICAgICAgIHN0YXR1cyA9IEF1ZGlvU2FuaXRpemVyOjpzYW5pdGl6ZUF1ZGlvQXR0cmlidXRlcygmYXR0ciwgIjY4OTUzOTUwIik7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gZ2V0T3V0cHV0Rm9yQXR0cigmYXR0ciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZvdXRwdXQsIHNlc3Npb24sICZzdHJlYW0sIHBpZCwgdWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzLCAmc2VsZWN0ZWREZXZpY2VJZCwgJnBvcnRJZCwgJnNlY29uZGFyeU91dHB1dHMpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIHN0YXR1cyA9IHJlcGx5LT53cml0ZSgmYXR0ciwgc2l6ZW9mKGF1ZGlvX2F0dHJpYnV0ZXNfdCkpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihvdXRwdXQpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RyZWFtKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHNlbGVjdGVkRGV2aWNlSWQpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIocG9ydElkKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHNlY29uZGFyeU91dHB1dHMuc2l6ZSgpKTsKLSAgICAgICAgICAgIHJldHVybiByZXBseS0+d3JpdGUoc2Vjb25kYXJ5T3V0cHV0cy5kYXRhKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY29uZGFyeU91dHB1dHMuc2l6ZSgpICogc2l6ZW9mKGF1ZGlvX2lvX2hhbmRsZV90KSk7Ci0gICAgICAgIH0gYnJlYWs7Ci0KLSAgICAgICAgY2FzZSBTVEFSVF9PVVRQVVQ6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBjb25zdCBhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCA9IHN0YXRpY19jYXN0IDxhdWRpb19wb3J0X2hhbmRsZV90PihkYXRhLnJlYWRJbnQzMigpKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0IDx1aW50MzJfdD4oc3RhcnRPdXRwdXQocG9ydElkKSkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgU1RPUF9PVVRQVVQ6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXB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plcjo6c2FuaXRpemVBdWRpb0F0dHJpYnV0ZXMoJmF0dHIsICI2ODk1Mzk1MCIpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IGdldElucHV0Rm9yQXR0cigmYXR0ciwgJmlucHV0LCByaWlkLCBzZXNzaW9uLCBwaWQsIHVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3BQYWNrYWdlTmFtZSwgJmNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3MsICZzZWxlY3RlZERldmljZUlkLCAmcG9ydElkKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXR1cyk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoaW5wdXQpOwotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHNlbGVjdGVkRGV2aWNlSWQpOwotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHBvcnRJZCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0KLSAgICAgICAgY2FzZSBTVEFSVF9JTlBVVDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkID0gc3RhdGljX2Nhc3QgPGF1ZGlvX3BvcnRfaGFuZGxlX3Q+KGRhdGEucmVhZEludDMyKCkpOwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gc3RhcnRJbnB1dChwb3J0SWQpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdGljX2Nhc3QgPHVpbnQzMl90PihzdGF0dXMpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIFNUT1BfSU5QVVQ6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCA9IHN0YXRpY19jYXN0IDxhdWRpb19wb3J0X2hhbmRsZV90PihkYXRhLnJlYWRJbnQzMigpKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0IDx1aW50MzJfdD4oc3RvcElucHV0KHBvcnRJZCkpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIFJFTEVBU0VfSU5QVVQ6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCA9IHN0YXRpY19jYXN0IDxhdWRpb19wb3J0X2hhbmRsZV90PihkYXRhLnJlYWRJbnQzMigpKTsKLSAgICAgICAgICAgIHJlbGVhc2VJbnB1dChwb3J0SWQpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgSU5JVF9TVFJFQU1fVk9MVU1FOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0gPQotICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdCA8YXVkaW9fc3RyZWFtX3R5cGVfdD4oZGF0YS5yZWFkSW50MzIoKSk7Ci0gICAgICAgICAgICBpbnQgaW5kZXhNaW4gPSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgaW50IGluZGV4TWF4ID0gZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0IDx1aW50MzJfdD4oaW5pdFN0cmVhbVZvbHVtZShzdHJlYW0sIGluZGV4TWluLGluZGV4TWF4KSkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgU0VUX1NUUkVBTV9WT0xVTUU6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSA9Ci0gICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0IDxhdWRpb19zdHJlYW1fdHlwZV90PihkYXRhLnJlYWRJbnQzMigpKTsKLSAgICAgICAgICAgIGludCBpbmRleCA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBhdWRpb19kZXZpY2VzX3QgZGV2aWNlID0gc3RhdGljX2Nhc3QgPGF1ZGlvX2RldmljZXNfdD4oZGF0YS5yZWFkSW50MzIoKSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8dWludDMyX3Q+KHNldFN0cmVhbVZvbHVtZUluZGV4KHN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZSkpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIEdFVF9TVFJFQU1fVk9MVU1FOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0gPQotICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdCA8YXVkaW9fc3RyZWFtX3R5cGVfdD4oZGF0YS5yZWFkSW50MzIoKSk7Ci0gICAgICAgICAgICBhdWRpb19kZXZpY2VzX3QgZGV2aWNlID0gc3RhdGljX2Nhc3QgPGF1ZGlvX2RldmljZXNfdD4oZGF0YS5yZWFkSW50MzIoKSk7Ci0gICAgICAgICAgICBpbnQgaW5kZXggPSAwOwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gZ2V0U3RyZWFtVm9sdW1lSW5kZXgoc3RyZWFtLCAmaW5kZXgsIGRldmljZSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihpbmRleCk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8dWludDMyX3Q+KHN0YXR1cykpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgR0VUX1NUUkFURUdZX0ZPUl9TVFJFQU06IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSA9Ci0gICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0IDxhdWRpb19zdHJlYW1fdHlwZV90PihkYXRhLnJlYWRJbnQzMigpKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZVVpbnQzMihnZXRTdHJhdGVneUZvclN0cmVhbShzdHJlYW0pKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIFNFVF9WT0xVTUVfQVRUUklCVVRFUzogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGF1ZGlvX2F0dHJpYnV0ZXNfdCBhdHRyaWJ1dGVzID0ge307Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBkYXRhLnJlYWQoJmF0dHJpYnV0ZXMsIHNpemVvZihhdWRpb19hdHRyaWJ1dGVzX3QpKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpbnQgaW5kZXggPSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190IGRldmljZSA9IHN0YXRpY19jYXN0IDxhdWRpb19kZXZpY2VzX3Q+KGRhdGEucmVhZEludDMyKCkpOwotCi0gICAgICAgICAgICBzdGF0dXMgPSBBdWRpb1Nhbml0aXplcjo6c2FuaXRpemVBdWRpb0F0dHJpYnV0ZXMoJmF0dHJpYnV0ZXMsICIxNjk1NzI2NDEiKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBzZXRWb2x1bWVJbmRleEZvckF0dHJpYnV0ZXMoYXR0cmlidXRlcywgaW5kZXgsIGRldmljZSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQz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0gICAgICAgIH0gYnJlYWs7Ci0KLSAgICAgICAgY2FzZSBHRVRfREVWSUNFU19GT1JfU1RSRUFNOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0gPQotICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdCA8YXVkaW9fc3RyZWFtX3R5cGVfdD4oZGF0YS5yZWFkSW50MzIoKSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8aW50PihnZXREZXZpY2VzRm9yU3RyZWFtKHN0cmVhbSkpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIEdFVF9PVVRQVVRfRk9SX0VGRkVDVDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGVmZmVjdF9kZXNjcmlwdG9yX3QgZGVzYyA9IHt9OwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gZGF0YS5yZWFkKCZkZXNjLCBzaXplb2YoZGVzYykpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiNzMxMjYxMDYiKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3Qgb3V0cHV0ID0gQVVESU9fSU9fSEFORExFX05PTkU7Ci0gICAgICAgICAgICBzdGF0dXMgPSBBdWRpb1Nhbml0aXplcjo6c2FuaXRpemVFZmZlY3REZXNjcmlwdG9yKCZkZXNjLCAiNzMxMjYxMDYiKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBvdXRwdXQgPSBnZXRPdXRwdXRGb3JFZmZlY3QoJmRlc2MpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdGljX2Nhc3QgPGludDMyX3Q+KG91dHB1dCkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgUkVHSVNURVJfRUZGRUNUOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgZWZmZWN0X2Rlc2NyaXB0b3JfdCBkZXNjID0ge307Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBkYXRhLnJlYWQoJmRlc2MsIHNpemVvZihkZXNjKSk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICI3MzEyNjEwNiIpOwotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBpbyA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICB1aW50MzJfdCBzdHJhdGVneSA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbiA9IChhdWRpb19zZXNzaW9uX3QpIGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBpbnQgaWQgPSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgc3RhdHVzID0gQXVkaW9TY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ZWQoaWQsIGVuYWJsZWQpKSk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0KLSAgICAgICAgY2FzZSBNT1ZFX0VGRkVDVFNfVE9fSU86IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBzdGQ6OnZlY3RvcjxpbnQ+IGlkczsKLSAgICAgICAgICAgIGludDMyX3Qgc2l6ZTsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGRhdGEucmVhZEludDMyKCZzaXplKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHNpemUgPiBNQVhfSVRFTVNfUEVSX0xJU1QpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZm9yIChpbnQzMl90IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgaW50IGlkOwotICAgICAgICAgICAgICAgIHN0YXR1cyA9ICBkYXRhLnJlYWRJbnQzMigmaWQpOwotICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWRzLnB1c2hfYmFjayhpZCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90IGlvID0gZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0IDxpbnQzMl90Pihtb3ZlRWZmZWN0c1RvSW8oaWRzLCBpbykpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIElTX1NUUkVBTV9BQ1RJVkU6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSA9IChhdWRpb19zdHJlYW1fdHlwZV90KSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgdWludDMyX3QgaW5QYXN0TXMgPSAodWludDMyX3QpZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKCBpc1N0cmVhbUFjdGl2ZShzdHJlYW0sIGluUGFzdE1zKSApOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgSVNfU1RSRUFNX0FDVElWRV9SRU1PVEVMWTogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtID0gKGF1ZGlvX3N0cmVhbV90eXBlX3QpIGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICB1aW50MzJfdCBpblBhc3RNcyA9ICh1aW50MzJfdClkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoIGlzU3RyZWFtQWN0aXZlUmVtb3RlbHkoc3RyZWFtLCBpblBhc3RNcykgKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIElTX1NPVVJDRV9BQ1RJVkU6IHsKLSAgICAgICAg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dGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUiAmJiBzdGF0dXMgIT0gTk9fTUVNT1JZKSB7Ci0gICAgICAgICAgICAgICAgcmV0Q291bnQgPSAwOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIocmV0Q291bnQpOwotICAgICAgICAgICAgaWYgKHJldENvdW50ICE9IDApIHsKLSAgICAgICAgICAgICAgICBpZiAocmV0Q291bnQgPCBjb3VudCkgewotICAgICAgICAgICAgICAgICAgICBjb3VudCA9IHJldENvdW50OwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGUoZGVzY3JpcHRvcnMsIHNpemVvZihlZmZlY3RfZGVzY3JpcHRvcl90KSAqIGNvdW50KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGRlbGV0ZVtdIGRlc2NyaXB0b3JzOwotICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgfQotCi0gICAgICAgIGNhc2UgSVNfT0ZGTE9BRF9TVVBQT1JURUQ6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBhdWRpb19vZmZsb2FkX2luZm9fdCBpbmZvID0ge307Ci0gICAgICAgICAgICBkYXRhLnJlYWQoJmluZm8sIHNpemVvZihhdWRpb19vZmZsb2FkX2luZm9fdCkpOwotICAgICAgICAgICAgYm9vbCBpc1N1cHBvcnRlZCA9IGlzT2ZmbG9hZFN1cHBvcnRlZChpbmZvKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGlzU3VwcG9ydGVkKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfQotCi0gICAgICAgIGNhc2UgSVNfRElSRUNUX09VVFBVVF9TVVBQT1JURUQ6IH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MpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIobnVtUG9ydHMpOwotCi0gICAgICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG51bVBvcnRzUmVxID4gbnVtUG9ydHMpIHsKLSAgICAgICAgICAgICAgICAgICAgbnVtUG9ydHNSZXEgPSBudW1Qb3J0czsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlKHBvcnRzLCBudW1Qb3J0c1JlcSAqIHNpemVvZihzdHJ1Y3QgYXVkaW9fcG9ydCkpOwotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGdlbmVyYXRpb24pOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZnJlZShwb3J0cyk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLQotICAgICAgICBjYXNlIEdFVF9BVURJT19QT1JUOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgc3RydWN0IGF1ZGlvX3BvcnQgcG9ydCA9IHt9OwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gZGF0YS5yZWFkKCZwb3J0LCBzaXplb2Yoc3RydWN0IGF1ZGlvX3BvcnQpKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBBTE9HRSgiYi8yMzkxMjIwMiIpOwotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGF0dXMgPSBBdWRpb1Nhbml0aXplcjo6c2FuaXRpemVBdWRpb1BvcnQoJnBvcnQpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IGdldEF1ZGlvUG9ydCgmcG9ydCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZSgmcG9ydCwgc2l6ZW9mKHN0cnVjdCBhdWRpb19wb3J0KSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLQotICAgICAgICBjYXNlIENSRUFURV9BVURJT19QQVRDSDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHN0cnVjdCBhdWRpb19wYXRjaCBwYXRjaCA9IHt9OwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gZGF0YS5yZWFkKCZwYXRjaCwgc2l6ZW9mKHN0cnVjdCBhdWRpb19wYXRjaCkpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBhdWRpb19wYXRjaF9oYW5kbGVfdCBoYW5kbGUgPSBBVURJT19QQVRDSF9IQU5ETEVfTk9ORTsKLSAgICAgICAgICAgIHN0YXR1cyA9IGRhdGEucmVhZCgmaGFuZGxlLCBzaXplb2YoYXVkaW9fcGF0Y2hfaGFuZGxlX3QpKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBBTE9HRSgiYi8yMzkxMjIwMiIpOwotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGF0dXMgPSBBdWRpb1Nh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AgICAgICB1bnNpZ25lZCBpbnQgbnVtUGF0Y2hlc1JlcSA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBpZiAobnVtUGF0Y2hlc1JlcSA+IE1BWF9JVEVNU19QRVJfTElTVCkgewotICAgICAgICAgICAgICAgIG51bVBhdGNoZXNSZXEgPSBNQVhfSVRFTVNfUEVSX0xJU1Q7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB1bnNpZ25lZCBpbnQgbnVtUGF0Y2hlcyA9IG51bVBhdGNoZXNSZXE7Ci0gICAgICAgICAgICBzdHJ1Y3QgYXVkaW9fcGF0Y2ggKnBhdGNoZXMgPQotICAgICAgICAgICAgICAgICAgICAoc3RydWN0IGF1ZGlvX3BhdGNoICopY2FsbG9jKG51bVBhdGNoZXNSZXEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHN0cnVjdCBhdWRpb19wYXRjaCkpOwotICAgICAgICAgICAgaWYgKHBhdGNoZXMgPT0gTlVMTCkgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKE5PX01FTU9SWSk7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoMCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdW5zaWduZWQgaW50IGdlbmVyYXRpb247Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBsaXN0QXVkaW9QYXRjaGVzKCZudW1QYXRjaGVzLCBwYXRjaGVzLCAmZ2VuZXJhdGlvbik7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIobnVtUGF0Y2hlcyk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG51bVBhdGNoZXNSZXEgPiBudW1QYXRjaGVzKSB7Ci0gICAgICAgICAgICAgICAgICAgIG51bVBhdGNoZXNSZXEgPSBudW1QYXRjaGVzOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGUocGF0Y2hlcywgbnVtUGF0Y2hlc1JlcSAqIHNpemVvZihzdHJ1Y3QgYXVkaW9fcGF0Y2gpKTsKLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihnZW5lcmF0aW9uKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZyZWUocGF0Y2hlcyk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLQotICAgICAgICBjYXNlIFNFVF9BVURJT19QT1JUX0NPTkZJRzogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHN0cnVjdCBhdWRpb19wb3J0X2NvbmZpZyBjb25maWcgPSB7fTsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGRhdGEucmVhZCgmY29uZmlnLCBzaXplb2Yoc3RydWN0IGF1ZGlvX3BvcnRfY29uZmlnKSk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgICh2b2lkKUF1ZGlvU2FuaXRpemVyOjpzYW5pdGl6ZUF1ZGlvUG9ydENvbmZpZygmY29uZmlnKTsKLSAgICAgICAgICAgIHN0YXR1cyA9IHNldEF1ZGlvUG9ydENvbmZpZygmY29uZmlnKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXR1cyk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLQotICAgIC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ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb24gPSBBVURJT19TRVNTSU9OX05PTkU7Ci0gICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBpb0hhbmRsZSA9IEFVRElPX0lPX0hBTkRMRV9OT05FOwotICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190IGRldmljZSA9IEFVRElPX0RFVklDRV9OT05FOwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gYWNxdWlyZVNvdW5kVHJpZ2dlclNlc3Npb24oJnNlc3Npb24sICZpb0hhbmRsZSwgJmRldmljZSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHNlc3Npb24pOwotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGlvSGFuZGxlKTsKLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihkZXZpY2UpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgUkVMRUFTRV9TT1VORFRSSUdHRVJfU0VTU0lPTjogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uID0gKGF1ZGlvX3Nlc3Npb25fdClkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gcmVsZWFzZVNvdW5kVHJpZ2dlclNlc3Npb24oc2Vzc2lvbik7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgR0VUX1BIT05FX1NUQVRFOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoKGludDMyX3QpZ2V0UGhvbmVTdGF0ZSgpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIFJFR0lTVEVSX1BPTElDWV9NSVhFUzogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGJvb2wgcmVnaXN0cmF0aW9uID0gZGF0YS5yZWFkSW50MzIoKSA9PSAxOwotICAgICAgICAgICAgVmVjdG9yPEF1ZGlvTWl4PiBtaXhlczsKLSAgICAgICAgICAgIHNpemVfdCBzaXplID0gKHNpemVfdClkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgaWYgKHNpemUgPiBNQVhfTUlYRVNfUEVSX1BPTElDWSkgewotICAgICAgICAgICAgICAgIHNpemUgPSBNQVhfTUlYRVNfUEVSX1BPTElDWTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgQXVkaW9NaXggbWl4OwotICAgICAgICAgICAgICAgIGlmIChtaXgucmVhZEZyb21QYXJjZWwoKFBhcmNlbCopJmRhdGEpID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1peGVzLmFkZChtaXgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHJlZ2lzdGVyUG9saWN5TWl4ZXMobWl4ZXMsIHJlZ2lzdHJhdGlvbik7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgU1RBUlRfQVVESU9fU09VUkNFOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgc3RydWN0IGF1ZGlvX3BvcnRfY29uZmlnIHNvdXJjZSA9IHt9OwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gZGF0YS5yZWFkKCZzb3VyY2UsIHNpemVvZihzdHJ1Y3QgYXVkaW9fcG9ydF9jb25maWcpKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYXVkaW9fYXR0cmlidXRlc190IGF0dHJpYnV0ZXMgPSB7fTsKLSAgICAgICAgICAgIHN0YXR1cyA9IGRhdGEucmVhZCgmYXR0cmlidXRlcywgc2l6ZW9mKGF1ZGlvX2F0dHJpYnV0ZXNfdCkpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGF0dXMgPSBBdWRpb1Nhbml0aXplcjo6c2FuaXRpemVBdWRpb1BvcnRDb25maWcoJnNvdXJjZSk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgLy8gT0sgd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AgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgU0VUX01BU1RFUl9NT05POiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgYm9vbCBtb25vID0gc3RhdGljX2Nhc3Q8Ym9vbD4oZGF0YS5yZWFkSW50MzIoKSk7Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBzZXRNYXN0ZXJNb25vKG1vbm8pOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIEdFVF9NQVNURVJfTU9OTzogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGJvb2wgbW9ubzsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGdldE1hc3Rlck1vbm8oJm1vbm8pOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0aWNfY2FzdDxpbnQzMl90Pihtb25vKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0KLSAgICAgICAgY2FzZSBHRVRfU1RSRUFNX1ZPTFVNRV9EQjogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtID0KLSAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3QgPGF1ZGlvX3N0cmVhbV90eXBlX3Q+KGRhdGEucmVhZEludDMyKCkpOwotICAgICAgICAgICAgaW50IGluZGV4ID0gc3RhdGljX2Nhc3QgPGludD4oZGF0YS5yZWFkSW50MzIoKSk7Ci0gICAgICAgICAgICBhdWRpb19kZXZpY2VzX3QgZGV2aWNlID0KLSAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3QgPGF1ZGlvX2RldmljZXNfdD4oZGF0YS5yZWFkVWludDMyKCkpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlRmxvYXQoZ2V0U3RyZWFtVm9sdW1lREIoc3RyZWFtLCBpbmRleCwgZGV2aWNlKSk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLQotICAgICAgICBjYXNlIEdFVF9TVVJST1VORF9GT1JNQVRTOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgdW5zaWduZWQgaW50IG51bVN1cnJvdW5kRm9ybWF0c1JlcSA9IGRhdGEucmVhZFVpbnQzMigpOwotICAgICAgICAgICAgaWYgKG51bVN1cnJvdW5kRm9ybWF0c1JlcSA+IE1BWF9JVEVNU19QRVJfTElTVCkgewotICAgICAgICAgICAgICAgIG51bVN1cnJvdW5kRm9ybWF0c1JlcSA9IE1BWF9JVEVNU19QRVJfTElTVDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJvb2wgcmVwb3J0ZWQgPSBkYXRhLnJlYWRCb29sKCk7Ci0gICAgICAgICAgICB1bnNpZ25lZCBpbnQgbnVtU3Vycm91bmRGb3JtYXRzID0gbnVtU3Vycm91bmRGb3JtYXRzUmVxOwotICAgICAgICAgICAgYXVkaW9fZm9ybWF0X3QgKnN1cnJvdW5kRm9ybWF0cyA9IChhdWRpb19mb3JtYXRfdCAqKWNhbGxvYygKLSAgICAgICAgICAgICAgICAgICAgbnVtU3Vycm91bmRGb3JtYXRzLCBzaXplb2YoYXVkaW9fZm9ybWF0X3QpKTsKLSAgICAgICAgICAgIGJvb2wgKnN1cnJvdW5kRm9ybWF0c0VuYWJsZWQgPSAoYm9vbCAqKWNhbGxvYyhudW1TdXJyb3VuZEZvcm1hdHMsIHNpemVvZihib29sKSk7Ci0gICAgICAgICAgICBpZiAobnVtU3Vycm91bmRGb3JtYXRzUmVxID4gMCAmJgotICAgICAgICAgICAgICAgICAgICAoc3Vycm91bmRGb3JtYXRzID09IE5VTEwgfHwgc3Vycm91bmRGb3JtYXRzRW5hYmxlZCA9PSBOVUxMKSkgewotICAgICAgICAgICAgICAgIGZyZWUoc3Vycm91bmRGb3JtYXRzKTsKLSAgICAgICAgICAgICAgICBmcmVlKHN1cnJvdW5kRm9ybWF0c0VuYWJsZWQpOwotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKE5PX01FTU9SWSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gZ2V0U3Vycm91bmRGb3JtYXRzKAotICAgICAgICAgICAgICAgICAgICAmbnVtU3Vycm91bmRGb3JtYXRzLCBzdXJyb3VuZEZvcm1hdHMsIHN1cnJvdW5kRm9ybWF0c0VuYWJsZWQsIHJlcG9ydGVkKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXR1cyk7Ci0KLSAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGVVaW50MzIobnVtU3Vycm91bmRGb3JtYXRzKTsKLSAgICAgICAgICAgICAgICBpZiAobnVtU3Vycm91bmRGb3JtYXRzUmVxID4gbnVtU3Vycm91bmRGb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N0X3V1aWRfdCkpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBTdHJpbmcxNiBvcFBhY2thZ2VOYW1lOwotICAgICAgICAgICAgc3RhdHVzID0gZGF0YS5yZWFkU3RyaW5nMTYoJm9wUGFja2FnZU5hbWUpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlZmZlY3RfdXVpZF90IHV1aWQ7Ci0gICAgICAgICAgICBzdGF0dXMgPSBkYXRhLnJlYWQoJnV1aWQsIHNpemVvZihlZmZlY3RfdXVpZF90KSk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGludDMyX3QgcHJpb3JpdHkgPSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgYXVkaW9fdXNhZ2VfdCB1c2FnZSA9IChhdWRpb191c2FnZV90KSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgYXVkaW9fdW5pcXVlX2lkX3QgaWQgPSAwOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdGljX2Nhc3QgPGludDMyX3Q+KGFkZFN0cmVhbURlZmF1bHRFZmZlY3QoJnR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcFBhY2thZ2VOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnV1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmlvcml0eSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzYWdlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmlkKSkpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoaWQpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9Ci0KLSAgICAgICAgY2FzZSBSRU1PVkVfU1RSRUFNX0RFRkFVTFRfRUZGRUNUOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgYXVkaW9fdW5pcXVlX2lkX3QgaWQgPSBzdGF0aWNfY2FzdDxhdWRpb191bmlxdWVfaWRfdD4oZGF0YS5yZWFkSW50MzIoKSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8aW50MzJfdD4ocmVtb3ZlU3RyZWFtRGVmYXVsdEVmZmVjdChpZCkpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfQotCi0gICAgICAgIGNhc2UgQUREX1NPVVJDRV9ERUZBVUxUX0VGRkVDVDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGVmZmVjdF91dWlkX3QgdHlwZTsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGRhdGEucmVhZCgmdHlwZSwgc2l6ZW9mKGVmZmVjdF91dWlkX3QpKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgU3RyaW5nMTYgb3BQYWNrYWdlTmFtZTsKLSAgICAgICAgICAgIHN0YXR1cyA9IGRhdGEucmVhZFN0cmluZzE2KCZvcFBhY2thZ2VOYW1lKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWZmZWN0X3V1aWRfdCB1dWlkOwotICAgICAgICAgICAgc3RhdHVzID0gZGF0YS5yZWFkKCZ1dWlkLCBzaXplb2YoZWZmZWN0X3V1aWRfdCkpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpbnQzMl90IHByaW9yaXR5ID0gZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIGF1ZGlvX3NvdXJjZV90IHNvdXJjZSA9IChhdWRpb19zb3VyY2VfdCkgZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIGF1ZGlvX3VuaXF1ZV9pZF90IGlkID0gMDsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0IDxpbnQzMl90PihhZGRTb3VyY2VEZWZhdWx0RWZmZWN0KCZ0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3BQYWNrYWdlTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ1dWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpb3JpdHksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmaWQpKSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihpZCk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLQotICAgICAgICBjYXNlIFJFTU9WRV9TT1VSQ0VfREVGQVVMVF9FRkZFQ1Q6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBhdWRpb191bmlxdWVfaWRfdCBpZCA9IHN0YXRpY19jYXN0PGF1ZGlvX3VuaXF1ZV9pZF90PihkYXRhLnJlYWRJbnQzMigpKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXRpY19jYXN0IDxpbnQzMl90PihyZW1vdmVTb3VyY2VEZWZhdWx0RWZmZWN0KGlkKSkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9Ci0KLSAgICAgICAgY2FzZSBTRVRfQVNTSVNUQU5UX1VJRDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1BvbGljeVNlcnZpY2UsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGludDMyX3QgdWlkOwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gZGF0YS5yZWFkSW50MzIoJnVpZCk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0YXR1cyA9IHNldEFzc2lzdGFudFVpZCh1aWQpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdGljX2Nhc3QgPGludDMyX3Q+KHN0YXR1cykpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9Ci0KLSAgICAgICAgY2FzZSBTRVRfQTExWV9TRVJWSUNFU19VSURTOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgc3RkOjp2ZWN0b3I8dWlkX3Q+IHVpZHM7Ci0gICAgICAgICAgICBpbnQzMl90IHNpemU7Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBkYXRhLnJlYWRJbnQzMigmc2l6ZSk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChzaXplID4gTUFYX0lURU1TX1BFUl9MSVNUKSB7Ci0gICAgICAgICAgICAgICAgc2l6ZSA9IE1BWF9JVEVNU19QRVJfTElTVDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZvciAoaW50MzJfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgICAgIGludDMyX3QgdWlkOwotICAgICAgICAgICAgICAgIHN0YXR1cyA9ICBkYXRhLnJlYWRJbnQzMigmdWlkKTsKLSAgICAgICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHVpZHMucHVzaF9iYWNrKHVpZCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGF0dXMgPSBzZXRBMTF5U2VydmljZXNVaWRzKHVpZHMpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdGljX2Nhc3QgPGludDMyX3Q+KHN0YXR1cykpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9Ci0KLSAgICAgICAgY2FzZSBJU19IQVBUSUNfUExBWUJBQ0tfU1VQUE9SVEVEOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgYm9vbCBpc1N1cHBvcnRlZCA9IGlzSGFwdGljUGxheWJhY2tTdXBwb3J0ZWQoKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUJvb2woaXNTdXBwb3J0ZWQpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9Ci0gICAgICAgIGNhc2UgU0VUX1VJRF9ERVZJQ0VfQUZGSU5JVFk6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBjb25zdCB1aWRfdCB1aWQgPSAodWlkX3QpIGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBWZWN0b3I8QXVkaW9EZXZpY2VUeXBlQWRkcj4gZGV2aWNlczsKLSAgICAgICAgICAgIHNpemVfdCBzaXplID0gKHNpemVfdClkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKLSAgICAgICAgICAgICAgICBBdWRpb0RldmljZVR5cGVBZGRyIGRldmljZTsKLSAgICAgICAgICAgICAgICBpZiAoZGV2aWNlLnJlYWRGcm9tUGFyY2VsKChQYXJjZWwqKSZkYXRhKSA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgICAgICBkZXZpY2VzLmFkZChkZXZpY2UpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHNldFVpZERldmljZUFmZmluaXRpZXModWlkLCBkZXZpY2VzKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXR1cyk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLQotICAgICAgICBjYXNlIFJFTU9WRV9VSURfREVWSUNFX0FGRklOSVRZOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgY29uc3QgdWlkX3QgdWlkID0gKHVpZF90KSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gcmVtb3ZlVWlkRGV2aWNlQWZmaW5pdGllcyh1aWQpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfQotCi0gICAgICAgIGNhc2UgU0VUX1VTRVJJRF9ERVZJQ0VfQUZGSU5JVFk6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBjb25zdCBpbnQgdXNlcklkID0gKGludCkgZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIFZlY3RvcjxBdWRpb0RldmljZVR5cGVBZGRyPiBkZXZpY2VzOwotICAgICAgICAgICAgc2l6ZV90IHNpemUgPSAoc2l6ZV90KWRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgICAgIEF1ZGlvRGV2aWNlVHlwZUFkZHIgZGV2aWNlOwotICAgICAgICAgICAgICAgIGlmIChkZXZpY2UucmVhZEZyb21QYXJjZWwoKFBhcmNlbCopJmRhdGEpID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRldmljZXMuYWRkKGRldmljZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gc2V0VXNlcklkRGV2aWNlQWZmaW5pdGllcyh1c2VySWQsIGRldmljZXMpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfQotCi0gICAgICAgIGNhc2UgUkVNT1ZFX1VTRVJJRF9ERVZJQ0VfQUZGSU5JVFk6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBjb25zdCBpbnQgdXNlcklkID0gKGludCkgZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHJlbW92ZVVzZXJJZERldmljZUFmZmluaXRpZXModXNlcklkKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXR1cyk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLQotICAgICAgICBjYXNlIExJU1RfQVVESU9fUFJPRFVDVF9TVFJBVEVHSUVTOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgQXVkaW9Qcm9kdWN0U3RyYXRlZ3lWZWN0b3Igc3RyYXRlZ2llczsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGxpc3RBdWRpb1Byb2R1Y3RTdHJhdGVnaWVzKHN0cmF0ZWdpZXMpOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzaXplX3Qgc2l6ZSA9IHN0cmF0ZWdpZXMuc2l6ZSgpOwotICAgICAgICAgICAgc2l6ZV90IHNpemVQb3NpdGlvbiA9IHJlcGx5LT5kYXRhUG9zaXRpb24oKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHNpemUpOwotICAgICAgICAgICAgc2l6ZV90IGZpbmFsU2l6ZSA9IHNpemU7Ci0gICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgICAgIHNpemVfdCBwb3NpdGlvbiA9IHJlcGx5LT5kYXRhUG9zaXRpb24oKTsKLSAgICAgICAgICAgICAgICBpZiAoc3RyYXRlZ2llc1tpXS53cml0ZVRvUGFyY2VsKHJlcGx5KSAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgICAgICByZXBseS0+c2V0RGF0YVBvc2l0aW9uKHBvc2l0aW9uKTsKLSAgICAgICAgICAgICAgICAgICAgZmluYWxTaXplLS07Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHNpemUgIT0gZmluYWxTaXplKSB7Ci0gICAgICAgICAgICAgICAgc2l6ZV90IHBvc2l0aW9uID0gcmVwbHktPmRhdGFQb3NpdGlvbigpOwotICAgICAgICAgICAgICAgIHJlcGx5LT5zZXREYXRhUG9zaXRpb24oc2l6ZVBvc2l0aW9uKTsKLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihmaW5hbFNpemUpOwotICAgICAgICAgICAgICA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ZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgQXVkaW9Wb2x1bWVHcm91cFZlY3RvciBncm91cHM7Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBsaXN0QXVkaW9Wb2x1bWVHcm91cHMoZ3JvdXBzKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXR1cyk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc2l6ZV90IHNpemUgPSBncm91cHMuc2l6ZSgpOwotICAgICAgICAgICAgc2l6ZV90IHNpemVQb3NpdGlvbiA9IHJlcGx5LT5kYXRhUG9zaXRpb24oKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHNpemUpOwotICAgICAgICAgICAgc2l6ZV90IGZpbmFsU2l6ZSA9IHNpemU7Ci0gICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgICAgIHNpemVfdCBwb3NpdGlvbiA9IHJlcGx5LT5kYXRhUG9zaXRpb24oKTsKLSAgICAgICAgICAgICAgICBpZiAoZ3JvdXBzW2ldLndyaXRlVG9QYXJjZWwocmVwbHkpICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJlcGx5LT5zZXREYXRhUG9zaXRpb24ocG9zaXRpb24pOwotICAgICAgICAgICAgICAgICAgICBmaW5hbFNpemUtLTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoc2l6ZSAhPSBmaW5hbFNpemUpIHsKLSAgICAgICAgICAgICAgICBzaXplX3QgcG9zaXRpb24gPSByZXBseS0+ZGF0YVBvc2l0aW9uKCk7Ci0gICAgICAgICAgICAgICAgcmVwbHktPnNldERhdGFQb3NpdGlvbihzaXplUG9zaXRpb24pOwotICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGZpbmFsU2l6ZSk7Ci0gICAgICAgICAgICAgICAgcmVwbHktPnNldERhdGFQb3NpdGlvbihwb3NpdGlvbik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLQotICAgICAgICBjYXNlIEdFVF9WT0xVTUVfR1JPVVBfRk9SX0FUVFJJQlVURVM6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBBdWRpb0F0dHJpYnV0ZXMgYXR0cmlidXRlczsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGF0dHJpYnV0ZXMucmVhZEZyb21QYXJjZWwoJmRhdGEpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHZvbHVtZV9ncm91cF90IGdyb3VwOwotICAgICAgICAgICAgc3RhdHVzID0gZ2V0Vm9sdW1lR3JvdXBGcm9tQXVkaW9BdHRyaWJ1dGVzKGF0dHJpYnV0ZXMsIGdyb3VwKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXR1cyk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVVaW50MzIoc3RhdGljX2Nhc3Q8aW50Pihncm91cCkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9Ci0KLSAgICAgICAgY2FzZSBTRVRfU1VQUE9SVEVEX1NZU1RFTV9VU0FHRVM6IHsKLSAgICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGF1ZGlvX3VzYWdlX3Q+IHN5c3RlbVVzYWdlczsKLQotICAgICAgICAgICAgIGludDMyX3Qgc2l6ZTsKLSAgICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBkYXRhLnJlYWRJbnQzMigmc2l6ZSk7Ci0gICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICBpZiAoc2l6ZSA+IE1BWF9JVEVNU19QRVJfTElTVCkgewotICAgICAgICAgICAgICAgICBzaXplID0gTUFYX0lURU1TX1BFUl9MSVNUOwotICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgIGZvciAoaW50MzJfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgICAgICBpbnQzMl90IHN5c3RlbVVzYWdlSW50OwotICAgICAgICAgICAgICAgICBzdGF0dXMgPSBkYXRhLnJlYWRJbnQzMigmc3lzdGVtVXNhZ2VJbnQpOwotICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgYXVkaW9fdXNhZ2VfdCBzeXN0ZW1Vc2FnZSA9IHN0YXRpY19jYXN0PGF1ZGlvX3VzYWdlX3Q+KHN5c3RlbVVzYWdlSW50KTsKLSAgICAgICAgICAgICAgICAgc3lzdGVtVXNhZ2VzLnB1c2hfYmFjayhzeXN0ZW1Vc2FnZSk7Ci0gICAgICAgICAgICAgfQotICAgICAgICAgICAgIHN0YXR1cyA9IHNld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oc3RhdHVzKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfQotCi0gICAgICAgIGNhc2UgR0VUX0RFVklDRVNfRk9SX0FUVFJJQlVURVM6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBBdWRpb0F0dHJpYnV0ZXMgYXR0cmlidXRlczsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGF0dHJpYnV0ZXMucmVhZEZyb21QYXJjZWwoJmRhdGEpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBBdWRpb0RldmljZVR5cGVBZGRyVmVjdG9yIGRldmljZXM7Ci0gICAgICAgICAgICBzdGF0dXMgPSBnZXREZXZpY2VzRm9yQXR0cmlidXRlcyhhdHRyaWJ1dGVzLmdldEF0dHJpYnV0ZXMoKSwgJmRldmljZXMpOwotICAgICAgICAgICAgLy8gcmVwbHkgZGF0YSBmb3JtYXR0ZWQgYXM6Ci0gICAgICAgICAgICAvLyAgLSAoaW50MzIpIG1ldGhvZCBjYWxsIHJlc3VsdCBmcm9tIEFQTQotICAgICAgICAgICAgLy8gIC0gKGludDMyKSBudW1iZXIgb2YgZGV2aWNlcyAobikgaWYgbWV0aG9kIGNhbGwgcmV0dXJuZWQgTk9fRVJST1IKLSAgICAgICAgICAgIC8vICAtIG4gQXVkaW9EZXZpY2VUeXBlQWRkciAgICAgICAgIGlmIG1ldGhvZCBjYWxsIHJldHVybmVkIE5PX0VSUk9SCi0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0dXMpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0YXR1cyA9IHJlcGx5LT53cml0ZUludDMyKGRldmljZXMuc2l6ZSgpKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZm9yIChjb25zdCBhdXRvJiBkZXZpY2UgOiBkZXZpY2VzKSB7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gZGV2aWNlLndyaXRlVG9QYXJjZWwocmVwbHkpOwotICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfQotCi0gICAgICAgIGNhc2UgQVVESU9fTU9EVUxFU19VUERBVEVEOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgb25OZXdBdWRpb01vZHVsZXNBdmFpbGFibGUoKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIFNFVF9DVVJSRU5UX0lNRV9VSUQ6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJQXVkaW9Qb2xpY3lTZXJ2aWNlLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBpbnQzMl90IHVpZDsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGRhdGEucmVhZEludDMyKCZ1aWQpOwotICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGF0dXMgPSBzZXRDdXJyZW50SW1lVWlkKHVpZCk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzdGF0aWNfY2FzdCA8aW50MzJfdD4oc3RhdHVzKSk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0KLQotICAgICAgICBjYXNlIFJFR0lTVEVSX1NPVU5EVFJJR0dFUl9DQVBUVVJFX1NUQVRFX0xJU1RFTkVSOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvUG9saWN5U2VydmljZSwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgc3A8SUJpbmRlcj4gYmluZGVyID0gZGF0YS5yZWFkU3Ryb25nQmluZGVyKCk7Ci0gICAgICAgICAgICBpZiAoYmluZGVyID09IG51bGxwdHIpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3A8SUNhcHR1cmVTdGF0ZUxpc3RlbmVyPgotICAgICAgICAgICAgICAgIGxpc3RlbmVyID0gaW50ZXJmYWNlX2Nhc3Q8SUNhcHR1cmVTdGF0ZUxpc3RlbmVyPigKLSAgICAgICAgICAgICAgICBiaW5kZXIpOwotICAgICAgICAgICAgaWYgKGxpc3RlbmVyID09IG51bGxwdHIpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYm9vbCByZXQ7Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPQotICAgICAgICAgICAgICAgIHJlZ2lzdGVyU291bmRUcmlnZ2VyQ2FwdHVyZVN0YXRlTGlzdGVuZXIobGlzdGVuZXIsICZyZXQpOwotICAgICAgICAgICAgTE9HX0FMV0FZU19GQVRBTF9JRihzdGF0dXMgIT0gTk9fRVJST1IsCi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pZW50Q29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGVmZmVjdF9kZXNjcmlwdG9yX3Q+IGNsaWVudEVmZmVjdHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqZGV2aWNlQ29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGVmZmVjdF9kZXNjcmlwdG9yX3Q+IGVmZmVjdHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcGF0Y2hfaGFuZGxlX3QgcGF0Y2hIYW5kbGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc291cmNlX3Qgc291cmNlKSB7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElBdWRpb1BvbGljeVNlcnZpY2VDbGllbnQ6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihldmVudCk7Ci0gICAgICAgIHdyaXRlUmVjb3JkQ2xpZW50SW5mb1RvUGFyY2VsKGRhdGEsIGNsaWVudEluZm8pOwotICAgICAgICB3cml0ZUF1ZGlvQ29uZmlnQmFzZVRvUGFyY2VsKGRhdGEsIGNsaWVudENvbmZpZyk7Ci0gICAgICAgIHdyaXRlRWZmZWN0VmVjdG9yVG9QYXJjZWwoZGF0YSwgY2xpZW50RWZmZWN0cyk7Ci0gICAgICAgIHdyaXRlQXVkaW9Db25maWdCYXNlVG9QYXJjZWwoZGF0YSwgZGV2aWNlQ29uZmlnKTsKLSAgICAgICAgd3JpdGVFZmZlY3RWZWN0b3JUb1BhcmNlbChkYXRhLCBlZmZlY3RzKTsKLSAgICA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ZXI6Ok9wZXJhdGlvbj4mIG9wZXJhdGlvbikgewotICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQXVkaW9UcmFjazo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKLQotICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBjb25maWd1cmF0aW9uLmdldCgpID09IG51bGxwdHIKLSAgICAgICAgICAgICAgICA/IGRhdGEud3JpdGVJbnQzMigwKQotICAgICAgICAgICAgICAgIDogIGRhdGEud3JpdGVJbnQzMigxKQotICAgICAgICAgICAgICAgICAgICA/OiBjb25maWd1cmF0aW9uLT53cml0ZVRvUGFyY2VsKCZkYXRhKTsKLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgcmV0dXJuIFZvbHVtZVNoYXBlcjo6U3RhdHVzKHN0YXR1cyk7Ci0gICAgICAgIH0KLQotICAgICAgICBzdGF0dXMgPSBvcGVyYXRpb24uZ2V0KCkgPT0gbnVsbHB0cgotICAgICAgICAgICAgICAgID8gc3RhdHVzID0gZGF0YS53cml0ZUludDMyKDApCi0gICAgICAgICAgICAgICAgOiBkYXRhLndyaXRlSW50MzIoMSkKLSAgICAgICAgICAgICAgICAgICAgPzogb3BlcmF0aW9uLT53cml0ZVRvUGFyY2VsKCZkYXRhKTsKLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgcmV0dXJuIFZvbHVtZVNoYXBlcjo6U3RhdHVzKHN0YXR1cyk7Ci0gICAgICAgIH0KLQotICAgICAgICBpbnQzMl90IHJlbW90ZVZvbHVtZVNoYXBlclN0YXR1czsKLSAgICAgICAgc3RhdHVzID0gcmVtb3RlKCktPnRyYW5zYWN0KEFQUExZX1ZPTFVNRV9TSEFQRVIsIGRhdGEsICZyZXBseSkKLSAgICAgICAgICAgICAgICAgPzogcmVwbHkucmV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2UgR0VUX1RJTUVTVEFNUDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1RyYWNrLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBBdWRpb1RpbWVzdGFtcCB0aW1lc3RhbXA7Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBnZXRUaW1lc3RhbXAodGltZXN0YW1wKTsKLSAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHN0YXR1cyk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIodGltZXN0YW1wLm1Qb3NpdGlvbik7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIodGltZXN0YW1wLm1UaW1lLnR2X3NlYyk7Ci0gICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIodGltZXN0YW1wLm1UaW1lLnR2X25zZWMpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIFNJR05BTDogewotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElBdWRpb1RyYWNrLCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBzaWduYWwoKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBBUFBMWV9WT0xVTUVfU0hBUEVSOiB7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUF1ZGlvVHJhY2ssIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHNwPFZvbHVtZVNoYXBlcjo6Q29uZmlndXJhdGlvbj4gY29uZmlndXJhdGlvbjsKLSAgICAgICAgICAgIHNwPFZvbHVtZVNoYXBlcjo6T3BlcmF0aW9uPiBvcGVyYXRpb247Ci0KLSAgIC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AgICAgICAgICAgICAgICB1aW50MzJfdCBjbWRTaXplLAotICAgICAgICAgICAgICAgICAgICAgdm9pZCAqcENtZERhdGEsCi0gICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAqcFJlcGx5U2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgIHZvaWQgKnBSZXBseURhdGEpCi0gICAgewotICAgICAgICBBTE9HVigiY29tbWFuZCIpOwotICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJRWZmZWN0OjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoY21kQ29kZSk7Ci0gICAgICAgIGludCBzaXplID0gY21kU2l6ZTsKLSAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwpIHsKLSAgICAgICAgICAgIHNpemUgPSAwOwotICAgICAgICB9Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzaXplKTsKLSAgICAgICAgaWYgKHNpemUpIHsKLSAgICAgICAgICAgIGRhdGEud3JpdGUocENtZERhdGEsIHNpemUpOwotICAgICAgICB9Ci0gICAgICAgIGlmIChwUmVwbHlTaXplID09IE5VTEwpIHsKLSAgICAgICAgICAgIHNpemUgPSAwOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgc2l6ZSA9ICpwUmVwbHlTaXplOwotICAgICAgICB9Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihzaXplKTsKLQotICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSByZW1vdGUoKS0+dHJhbnNhY3QoQ09NTUFORCwgZGF0YSwgJnJlcGx5KTsKLSAgICAgICAgaWYgKHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgc3RhdHVzID0gcmVwbHkucmVhZEludDMyKCk7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgIC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seS0+d3JpdGVJbnQzMihkaXNhYmxlKCkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgQ09NTUFORDogewotICAgICAgICAgICAgQUxPR1YoIkNPTU1BTkQiKTsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJRWZmZWN0LCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICB1aW50MzJfdCBjbWRDb2RlID0gZGF0YS5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHVpbnQzMl90IGNtZFNpemUgPSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgY2hhciAqY21kID0gTlVMTDsKLSAgICAgICAgICAgIGlmIChjbWRTaXplKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGNtZFNpemUgPiBFRkZFQ1RfUEFSQU1fU0laRV9NQVgpIHsKLSAgICAgICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoTk9fTUVNT1JZKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjbWQgPSAoY2hhciAqKWNhbGxvYyhjbWRTaXplLCAxKTsKLSAgICAgICAgICAgICAgICBpZiAoY21kID09IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoTk9fTUVNT1JZKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBkYXRhLnJlYWQoY21kLCBjbWRTaXplKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHVpbnQzMl90IHJlcGx5U2l6ZSA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICB1aW50MzJfdCByZXBseVN6ID0gcmVwbHlTaXplOwotICAgICAgICAgICAgY2hhciAqcmVzcCA9IE5VTEw7Ci0gICAgICAgICAgICBpZiAocmVwbHlTaXplKSB7Ci0gICAgICAgICAgICAgICAgaWYgKHJlcGx5U2l6ZSA+IEVGRkVDVF9QQVJBTV9TSVpFX01BWCkgewotICAgICAgICAgICAgICAgICAgICBmcmVlKGNtZCk7Ci0gICAgICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKE5PX01FTU9SWSk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcmVzcCA9IChjaGFyICopY2FsbG9jKHJlcGx5U2l6ZSwgMSk7Ci0gICAgICAgICAgICAgICAgaWYgKHJlc3AgPT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICBmcmVlKGNtZCk7Ci0gICAgICAgICAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKE5PX01FTU9SWSk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBjb21tYW5kKGNtZENvZGUsIGNtZFNpemUsIGNtZCwgJnJlcGx5U3osIHJlc3ApOwotICAgICAgICAgICAgcmVwbHktPndyaXRlSW50MzIoc3RhdHVzKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICBpZiAocmVwbHlTeiA8IHJlcGx5U2l6ZSkgewotICAgICAgICAgICAgICAgICAgICByZXBseVNpemUgPSByZXBseVN6OwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihyZXBseVNpemUpOwotICAgICAgICAgICAgICAgIGlmIChyZXBseVNpemUpIHsKLSAgICAgICAgICAgICAgICAgICAgcmVwbHktPndyaXRlKHJlc3AsIHJlcGx5U2l6ZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKGNtZCkgewotICAgICAgICAgICAgICAgIGZyZWUoY21kKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChyZXNwKSB7Ci0gICAgICAgICAgICAgICAgZnJlZShyZXNwKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLQotICAgICAgICBjYXNlIERJU0NPTk5FQ1Q6IHsKLSAgICAgICAgICAgIEFMT0dWKCJESVNDT05ORUNUIik7Ci0gICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSUVmZmVjdCwgZGF0YSwgcmVwbHkpOwotICAgICAgICAgICAgZGlzY29ubmVjdCgpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9IGJyZWFrOwotCi0gICAgICAgIGNhc2UgR0VUX0NCTEs6IHsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJRWZmZWN0LCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICByZXBseS0+d3JpdGVTdHJvbmdCaW5kZXIoSUludGVyZmFjZTo6YXNCaW5kZXIoZ2V0Q2JsaygpKSk7Ci0gICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7Ci0gICAgICAgIH0gYnJlYWs7Ci0KLSAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgIHJldHVybiBCQmluZGVyOjpvblRyYW5zYWN0KGNvZGUsIGRhdGEsIHJlcGx5LCBmbGFncyk7Ci0gICAgfQotfQotCi0vLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCi0KLX0gLy8gbmFtZXNwYWNlIGFuZHJvaWQKZGlmZiAtLWdpdCBhL21lZGlhL2xpYmF1ZGlvY2xpZW50L0lFZmZ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BseSwgSUJpbmRlcjo6RkxBR19PTkVXQVkpOwotICAgIH0KLQotICAgIHZvaWQgZW5hYmxlU3RhdHVzQ2hhbmdlZChib29sIGVuYWJsZWQpCi0gICAgewotICAgICAgICBBTE9HVigiZW5hYmxlU3RhdHVzQ2hhbmdlZCIpOwotICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJRWZmZWN0Q2xpZW50OjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOwotICAgICAgICBkYXRhLndyaXRlSW50MzIoKHVpbnQzMl90KWVuYWJsZWQpOwotICAgICAgICByZW1vdGUoKS0+dHJhbnNhY3QoRU5BQkxFX1NUQVRVU19DSEFOR0VELCBkYXRhLCAmcmVwbHksIElCaW5kZXI6OkZMQUdfT05FV0FZKTsKLSAgICB9Ci0KLSAgICB2b2lkIGNvbW1hbmRFeGVjdXRlZCh1aW50MzJfdCBjbWRDb2RlLAotICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGNtZFNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAqcENtZERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgcmVwbHlTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgKnBSZXBseURhdGEpCi0gICAgewotICAgICAgICBBTE9HVigiY29tbWFuZEV4ZWN1dGVkIik7Ci0gICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKLSAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKElFZmZlY3RDbGllbnQ6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7Ci0gICAgICAgIGRhdGEud3JpdGVJbnQzMihjbWRDb2RlKTsKLSAgICAgICAgaW50IHNpemUgPSBjbWRTaXplOwotICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCkgewotICAgICAgICAgICAgc2l6ZSA9IDA7Ci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QsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIGJvb2wgaGFzQ29udHJvbCA9IChib29sKWRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBjb250cm9sU3RhdHVzQ2hhbmdlZChoYXNDb250cm9sKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBFTkFCTEVfU1RBVFVTX0NIQU5HRUQ6IHsKLSAgICAgICAgICAgIEFMT0dWKCJFTkFCTEVfU1RBVFVTX0NIQU5HRUQiKTsKLSAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJRWZmZWN0Q2xpZW50LCBkYXRhLCByZXBseSk7Ci0gICAgICAgICAgICBib29sIGVuYWJsZWQgPSAoYm9vbClkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgZW5hYmxlU3RhdHVzQ2hhbmdlZChlbmFibGVkKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBDT01NQU5EX0VYRUNVVEVEOiB7Ci0gICAgICAgICAgICBBTE9HVigiQ09NTUFORF9FWEVDVVRFRCIpOwotICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElFZmZlY3RDbGllbnQsIGRhdGEsIHJlcGx5KTsKLSAgICAgICAgICAgIHVpbnQzMl90IGNtZENvZGUgPSBkYXRhLnJlYWRJbnQzMigpOwotICAgICAgICAgICAgdWludDMyX3QgY21kU2l6ZSA9IGRhdGEucmVhZEludDMyKCk7Ci0gICAgICAgICAgICBjaGFyICpjbWQgPSBOVUxMOwotICAgICAgICAgICAgaWYgKGNtZFNpemUpIHsKLSAgICAgICAgICAgICAgICBjbWQgPSAoY2hhciAqKW1hbGxvYyhjbWRTaXplKTsKLSAgICAgICAgICAgICAgICBkYXRhLnJlYWQoY21kLCBjbWRTaXplKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICA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AgIGJvb2wgY2hhbmdlZCA9IGZhbHNlOworICAgICAgICB7CisgICAgICAgICAgICBNdXRleDo6QXV0b2xvY2sgX2wobURldmljZUlkTG9jayk7CisgICAgICAgICAgICBjaGFuZ2VkID0gbUxhc3RSZXBvcnRlZERldmljZUlkICE9IGRldmljZUlkOworICAgICAgICAgICAgbUxhc3RSZXBvcnRlZERldmljZUlkID0gZGV2aWNlSWQ7CisgICAgICAgIH0KKworICAgICAgICB7CisgICAgICAgICAgICBNdXRleDo6QXV0b2xvY2sgX2wobVBsYXllclN0YXRlTG9jayk7CisgICAgICAgICAgICAvLyBQTEFZRVJfVVBEQVRFX0RFVklDRV9JRCBpcyBub3Qgc2F2ZWQgYXMgYW4gYWN0dWFsIHN0YXRlLCBpbnN0ZWFkIGl0IGlzIHVzZWQgdG8gdXBkYXRlCisgICAgICAgICAgICAvLyBkZXZpY2UgSUQgb25seS4KKyAgICAgICAgICAgIGlmICgoZXZlbnQgIT0gUExBWUVSX1VQREFURV9ERVZJQ0VfSUQpICYmIChldmVudCAhPSBtTGFzdFJlcG9ydGVkRXZlbnQpKSB7CisgICAgICAgICAgICAgICAgbUxhc3RSZXBvcnRlZEV2ZW50ID0gZXZlbnQ7CisgICAgICAgICAgICAgICAgY2hhbmdlZCA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKGNoYW5nZWQgJiYgKG1QSUlkICE9IFBMQVlFUl9QSUlEX0lOVkFMSUQpKSB7CisgICAgICAgICAgICBtQXVkaW9NYW5hZ2VyLT5wbGF5ZXJFdmVudChtUElJZCwgZXZlbnQsIGRldmljZUlkKTsKICAgICAgICAgfQogICAgIH0KIH0KQEAgLTgyLDE0ICs5OCwxOCBAQAogfQogCiAvL0ZJWE1FIHRlbXBvcmFyeSBtZXRob2Qgd2hpbGUgc29tZSBwbGF5ZXIgc3RhdGUgaXMgb3V0c2lkZSBvZiB0aGlzIGNsYXNzCi12b2lkIFBsYXllckJhc2U6OnJlc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XVkaW9NaXhSb3V0ZUZsYWc6OlJFTkRFUjsKKyAgICAgICAgY2FzZSBNSVhfUk9VVEVfRkxBR19MT09QX0JBQ0s6CisgICAgICAgICAgICByZXR1cm4gbWVkaWE6OkF1ZGlvTWl4Um91dGVGbGFnOjpMT09QX0JBQ0s7CisgICAgfQorICAgIHJldHVybiB1bmV4cGVjdGVkKEJBRF9WQUxVRSk7Cit9CisKK0NvbnZlcnNpb25SZXN1bHQ8dWludDMyX3Q+CithaWRsMmxlZ2FjeV9BdWRpb01peFJvdXRlRmxhZ191aW50MzJfdF9tYXNrKGludDMyX3QgYWlkbCkgeworICAgIHJldHVybiBjb252ZXJ0Qml0bWFzazx1aW50MzJfdCwgaW50MzJfdCwgdWludDMyX3QsIG1lZGlhOjpBdWRpb01peFJvdXRlRmxhZz4oCisgICAgICAgICAgICBhaWRsLAorICAgICAgICAgICAgYWlkbDJsZWdhY3lfQXVkaW9NaXhSb3V0ZUZsYWdfdWludDMyX3QsCisgICAgICAgICAgICBpbmRleFRvRW51bV9pbmRleDxtZWRpYTo6QXVkaW9NaXhSb3V0ZUZsYWc+LAorICAgICAgICAgICAgZW51bVRvTWFza19iaXRtYXNrPHVpbnQzMl90LCB1aW50MzJfdD4pOworfQorCitDb252ZXJzaW9uUmVzdWx0PGludDMyX3Q+CitsZWdhY3kyYWlkbF91aW50MzJfdF9BdWRpb01peFJvdXRlRmxhZ19tYXNrKHVpbnQzMl90IGxlZ2FjeSkgeworICAgIHJldHVybiBjb252ZXJ0Qml0bWFzazxpbnQzMl90LCB1aW50MzJfdCwgbWVkaWE6OkF1ZGlvTWl4Um91dGVGbGFnLCB1aW50MzJfdD4oCisgICAgICAgICAgICBsZWdhY3ksCisgICAgICAgICAgICBsZWdhY3kyYWlkbF91aW50MzJfdF9BdWRpb01peFJvdXRlRmxhZywKKyAgICAgICAgICAgIGluZGV4VG9FbnVtX2JpdG1hc2s8dWludDMyX3Q+LAorICAgICAgICAgICAgZW51bVRvTWFza19pbmRle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ICAgICAgICAgICAgeyAuZHVyYXRpb24gPSAwICwgLndhdmVGcmVxID0geyAwIH0sIDAsIDB9fSwKICAgICAgICAgICAucmVwZWF0Q250ID0gVG9uZUdlbmVyYXRvcjo6VE9ORUdFTl9JTkYsCiAgICAgICAgICAgLnJlcGVhdFNlZ21lbnQgPSAwIH0sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVE9ORV9KQVBBTl9SQURJT19BQ0sKKyAgICAgICAgeyAuc2VnbWVudHMgPSB7IHsgLmR1cmF0aW9uID0gMTAwMCwgLndhdmVGcmVxID0geyA0MDAsIDAgfSwgMCwgMCB9LAorICAgICAgICAgICAgICAgICAgICAgICAgeyAuZHVyYXRpb24gPSAyMDAwLCAud2F2ZUZyZXEgPSB7IDAgfSwgMCwgMCB9LAorICAgICAgICAgICAgICAgICAgICAgICAgeyAuZHVyYXRpb24gPSAwICwgLndhdmVGcmVxID0geyAwIH0sIDAsIDB9fSwKKyAgICAgICAgICAucmVwZWF0Q250ID0gVG9uZUdlbmVyYXRvcjo6VE9ORUdFTl9JTkYsCisgICAgICAgICAgLnJlcGVhdFNlZ21lbnQgPSAwIH0sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVE9ORV9KQVBBTl9SSU5HVE9ORQogICAgICAgICB7IC5zZWdtZW50cyA9IHsgeyAuZHVyYXRpb24gPSAzNzUsIC53YXZlRnJlcSA9IHsgNDAwLCAwIH0sIDAsIDAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgIHsgLmR1cmF0aW9uID0gMzc1LCAud2F2ZUZyZXEgPSB7IDAgfSwgMCwgMCB9LAogICAgICAgICAgICAgICAgICAgICAgICAgeyAuZHVyYXRpb24gPSAwICwgLndhdmVGcmVxID0geyAwIH0sIDAsIDB9fSwKQEAgLTg4MSw3ICs4ODksNyBAQAogICAgICAgICAgICAgVE9ORV9TVVBfUkFESU9fTk9UQVZBSUwsICAgICAvLyBUT05FX1NVUF9SQURJT19OT1RBVkFJTAogICA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dGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQKKyAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLgorICovCitwYWNrYWdlIGFuZHJvaWQubWVkaWE7CisKKy8qKgorICoge0BoaWRlfQorICovCitAQmFja2luZyh0eXBlPSJpbnQiKQorZW51bSBBdWRpb091dHB1dEZsYWdzIHsKKyAgICBESVJFQ1QgICAgICAgICAgID0gMCwKKyAgICBQUklNQVJZICAgICAgICAgID0gMSwKKyAgICBGQVNUICAgICAgICAgICAgID0gMiwKKyAgICBERUVQX0JVRkZFUiAgICAgID0gMywKKyAgICBDT01QUkVTU19PRkZMT0FEID0gNCwKKyAgICBOT05fQkxPQ0tJTkcgICAgID0gNSwKKyAgICBIV19BVl9TWU5DICAgICAgID0gNiwKKyAgICBUVFMgICAgICAgICAgICAgID0gNywKKyAgICBSQVcgICAgICAgICAgICAgID0gOCwKKyAgICBTWU5DICAgICAgICAgICAgID0gOSwKKyAgICBJRUM5NThfTk9OQVVESU8gID0gMTAsCisgICAgRElSRUNUX1BDTSAgICAgICA9IDExLAorICAgIE1NQVBfTk9JUlEgICAgICAgPSAxMiwKKyAgICBWT0lQX1JYICAgICAgICAgID0gMTMsCisgICAgSU5DQUxMX01VU0lDICAgICA9IDE0LAorICAgIEdBUExFU1NfT0ZGTE9BRCAgPSAxNSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmF1ZGlvY2xpZW50L2FpZGwvYW5kcm9pZC9tZWRpYS9BdWRpb1BhdGNoLmFpZGwgYi9tZWRpYS9saWJhdWRpb2NsaWVudC9haWRsL2FuZHJvaWQvbWVkaWEvQXVkaW9QYXRjaC5haWRsCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjg1MTlmYWYKLS0tIC9kZXYvbnVsbAorKysgYi9tZWRpYS9saWJhdWRpb2NsaWVudC9haWRsL2FuZHJvaWQvbWVka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gICAgICAgICAgICAgICAgICAgICAgICBpbnQgLyogcGlkX3QgKi8gcGlkKTsKKworICAgIGludCBxdWVyeU51bWJlckVmZmVjdHMoKTsKKworICAgIEVmZmVjdERlc2NyaXB0b3IgcXVlcnlFZmZlY3QoaW50IGluZGV4KTsKKworICAgIC8qKiBwcmVmZXJyZWRUeXBlRmxhZyBpcyBpbnRlcnByZXRlZCBhcyBhIHVpbnQzMl90IHdpdGggdGhlICJlZmZlY3QgZmxhZyIgZm9ybWF0LiAqLworICAgIEVmZmVjdERlc2NyaXB0b3IgZ2V0RWZmZWN0RGVzY3JpcHRvcihpbiBBdWRpb1V1aWQgZWZmZWN0VVVJRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW4gQXVkaW9VdWlkIHR5cGVVVUlELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgcHJlZmVycmVkVHlwZUZsYWcpOworCisgICAgQ3JlYXRlRWZmZWN0UmVzcG9uc2UgY3JlYXRlRWZmZWN0KGluIENyZWF0ZUVmZmVjdFJlcXVlc3QgcmVxdWVzdCk7CisKKyAgICB2b2lkIG1vdmVFZmZlY3RzKGludCAvKiBhdWRpb19zZXNzaW9uX3QgKi8gc2Vzc2lvbiwKKyAgICAgICAgICAgICAgICAgICAgIGludCAvKiBhdWRpb19pb19oYW5kbGVfdCAqLyBzcmNPdXRwdXQsCisgICAgICAgICAgICAgICAgICAgICBpbnQgLyogYXVkaW9faW9faGFuZGxlX3QgKi8gZHN0T3V0cHV0KTsKKworICAgIHZvaWQgc2V0RWZmZWN0U3VzcGVuZGVkKGludCBlZmZlY3RJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgLyogYXVkaW9fc2Vzc2lvbl90ICovIHNlc3Npb25JZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIHN1c3BlbmRlZCk7CisKKyAgICBpbnQgLyogYXVkaW9fbW9kdWxlX2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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCAvKiBhdWRpb19zZXNzaW9uX3QgKi8gc2Vzc2lvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbiBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlIGF0dHJpYnV0aW9uU291cmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIEF1ZGlvQ29uZmlnIGNvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgLyogQml0bWFzaywgaW5kZXhlZCBieSBBdWRpb091dHB1dEZsYWdzICovIGZsYWdzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCAvKiBhdWRpb19wb3J0X2hhbmRsZV90ICovIHNlbGVjdGVkRGV2aWNlSWQpOworCisgICAgdm9pZCBzdGFydE91dHB1dChpbnQgLyogYXVkaW9fcG9ydF9oYW5kbGVfdCAqLyBwb3J0SWQpOworCisgICAgdm9pZCBzdG9wT3V0cHV0KGludCAvKiBhdWRpb19wb3J0X2hhbmRsZV90ICovIHBvcnRJZCk7CisKKyAgICB2b2lkIHJlbGVhc2VPdXRwdXQoaW50IC8qIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKi8gcG9ydElkKTsKKworICAgIEdldElucHV0Rm9yQXR0clJlc3BvbnNlIGdldElucHV0Rm9yQXR0cihpbiBBdWRpb0F0dHJpYnV0ZXNJbnRlcm5hbCBhdHRyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgLyogYXVkaW9faW9faGFuZGxlX3QgKi8gaW5wdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCAvKiBhdWRpb191bmlxdWVfaWRfdCAqLyByaWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgLyogYXVkaW9fc2Vzc2lvbl90ICovIHNlc3Npb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIEF0dHJpYnV0aW9uU291cmNlU3RhdGUgYXR0cmlidXRpb25Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIEF1ZGlvQ29uZmlnQmFzZSBjb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCAvKiBCaXRtYXNrLCBpbmRleGVkIGJ5IEF1ZGlvSW5wdXRGbGFncyAqLyBmbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IC8qIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKi8gc2VsZWN0ZWREZXZpY2VJZCk7CisKKworICAgIHZvaWQgc3RhcnRJbnB1dChpbnQgLyogYXVkaW9fcG9ydF9oYW5kbGVfdCAqLyBwb3J0SWQpOworCisgICAgdm9pZCBzdG9wSW5wdXQoaW50IC8qIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKi8gcG9ydElkKTsKKworICAgIHZvaWQgcmVsZWFzZUlucHV0KGludCAvKiBhdWRpb19wb3J0X2hhbmRsZV90ICovIHBvcnRJZCk7CisKKyAgICB2b2lkIGluaXRTdHJlYW1Wb2x1bWUoQXVkaW9TdHJlYW1UeXBlIHN0cmVhbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGluZGV4TWluLAorICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXhNYXgpOworCisgICAgdm9pZCBzZXRTdHJlYW1Wb2x1bWVJbmRleChBdWRpb1N0cmVhbVR5cGUgc3RyZWFtLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IC8qIGF1ZGlvX2RldmljZXNfdCAqLyBkZXZpY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW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IG91dHB1dCwgY291bnQgaXMgdGhlIHRvdGFsIG51bWJlciBvZiBlbGVtZW50cywgd2hpY2ggbWF5IGJlIGxhcmdlciB0aGFuIHRoZSBhcnJheSBzaXplLgorICAgICAqIFBhc3NpbmcgJzAnIG9uIGlucHV0IGFuZCBpbnNwZWN0aW5nIHRoZSB2YWx1ZSBvbiBvdXRwdXQgaXMgYSBjb21tb24gd2F5IG9mIGRldGVybWluaW5nIHRoZQorICAgICAqIG51bWJlciBvZiBlbGVtZW50cyB3aXRob3V0IGFjdHVhbGx5IHJldHJpZXZpbmcgdGhlbS4KKyAgICAgKi8KKyAgICBFZmZlY3REZXNjcmlwdG9yW10gcXVlcnlEZWZhdWx0UHJlUHJvY2Vzc2luZyhpbnQgLyogYXVkaW9fc2Vzc2lvbl90ICovIGF1ZGlvU2Vzc2lvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbm91dCBJbnQgY291bnQpOworCisgICAgaW50IC8qIGF1ZGlvX3VuaXF1ZV9pZF90ICovIGFkZFNvdXJjZURlZmF1bHRFZmZlY3QoaW4gQXVkaW9VdWlkIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQHV0ZjhJbkNwcCBTdHJpbmcgb3BQYWNrYWdlTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbiBBdWRpb1V1aWQgdXVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgcHJpb3JpdHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXVkaW9Tb3VyY2VUeXBlIHNvdXJjZSk7CisKKyAgICBpbnQgLyogYXVkaW9fdW5pcXVlX2lkX3QgKi8gYWRkU3RyZWFtRGVmYXVsdEVmZmVjdChpbiBBdWRpb1V1aWQgdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBAdXRmOEluQ3BwIFN0cmluZyBvcFBhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIEF1ZGlvVXVpZCB1dWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBwcmlvcml0eSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBdWRpb1VzYWdlIHVzYWdlKTsKKworICAgIHZvaWQgcmVtb3ZlU291cmNlRGVmYXVsdEVmZmVjdChpbnQgLyogYXVkaW9fdW5pcXVlX2lkX3QgKi8gaWQpOworCisgICAgdm9pZCByZW1vdmVTdHJlYW1EZWZhdWx0RWZmZWN0KGludCAvKiBhdWRpb191bmlxdWVfaWRfdCAqLyBpZCk7CisKKyAgICB2b2lkIHNldFN1cHBvcnRlZFN5c3RlbVVzYWdlcyhpbiBBdWRpb1VzYWdlW10gc3lzdGVtVXNhZ2VzKTsKKworICAgIHZvaWQgc2V0QWxsb3dlZENhcHR1cmVQb2xpY3koaW50IC8qIHVpZF90ICovIHVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCAvKiBCaXRtYXNrIG9mIEF1ZGlvRmxhZ3MgKi8gY2FwdHVyZVBvbGljeSk7CisKKyAgICAvKioKKyAgICAgKiBDaGVjayBpZiBvZmZsb2FkIGlzIHBvc3NpYmxlIGZvciBnaXZlbiBmb3JtYXQsIHN0cmVhbSB0eXBlLCBzYW1wbGUgcmF0ZSwKKyAgICAgKiBiaXQgcmF0ZSwgZHVyYXRpb24sIHZpZGVvIGFuZCBzdHJlYW1pbmcgb3Igb2ZmbG9hZCBwcm9wZXJ0eSBpcyBlbmFibGVkLgorICAgICAqLworICAgIE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kRlZmF1bHQpOworCisgICAgQXVkaW9Wb2x1bWVHcm91cFtdIGxpc3RBdWRpb1ZvbHVtZUdyb3VwcygpOworICAgIGludCAvKiB2b2x1bWVfZ3JvdXBfdCAqLyBnZXRWb2x1bWVHcm91cEZyb21BdWRpb0F0dHJpYnV0ZXMoaW4gQXVkaW9BdHRyaWJ1dGVzRXggYWEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGZhbGxiYWNrT25EZWZhdWx0KTsKKworICAgIHZvaWQgc2V0UnR0RW5hYmxlZChib29sZWFuIGVuYWJsZWQpOworCisgICAgYm9vbGVhbiBpc0NhbGxTY3JlZW5Nb2RlU3VwcG9ydGVkKCk7CisKKyAgICB2b2lkIHNldERldmljZXNSb2xlRm9yU3RyYXRlZ3koaW50IC8qIHByb2R1Y3Rfc3RyYXRlZ3lfdCAqLyBzdHJhdGVneSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlUm9sZSByb2xlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbiBBdWRpb0RldmljZVtdIGRldmljZXMpOworCisgICAgdm9pZCByZW1vdmVEZXZpY2VzUm9sZUZvclN0cmF0ZWd5KGludCAvKiBwcm9kdWN0X3N0cmF0ZWd5X3QgKi8gc3RyYXRlZ3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZXZpY2VSb2xlIHJvbGUpOworCisgICAgQXVkaW9EZXZpY2VbXSBnZXREZXZpY2VzRm9yUm9sZUFuZFN0cmF0ZWd5KGludCAvKiBwcm9kdWN0X3N0cmF0ZWd5X3QgKi8gc3RyYXRlZ3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERldmljZVJvbGUgcm9sZSk7CisKKyAgICB2b2lkIHNldERldmljZXNSb2xlRm9yQ2FwdHVyZVByZXNldChBdWRpb1NvdXJjZVR5cGUgYXVkaW9Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlUm9sZSByb2xlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIEF1ZGlvRGV2aWNlW10gZGV2aWNlcyk7CisKKyAgICB2b2lkIGFkZERldmljZXNSb2xlRm9yQ2FwdHVyZVByZXNldChBdWRpb1NvdXJjZVR5cGUgYXVkaW9Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlUm9sZSByb2xlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIEF1ZGlvRGV2aWNlW10gZGV2aWNlcyk7CisKKyAgICB2b2lkIHJlbW92ZURldmljZXNSb2xlRm9yQ2FwdHVyZVByZXNldChBdWRpb1NvdXJjZVR5cGUgYXVkaW9Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlUm9sZSByb2xlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIEF1ZGlvRGV2aWNlW10gZGV2aWNlcyk7CisKKyAgICB2b2lkIGNsZWFyRGV2aWNlc1JvbGVGb3JDYXB0dXJlUHJlc2V0KEF1ZGlvU291cmNlVHlwZSBhdWRpb1NvdXJjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERldmljZVJvbGUgcm9sZSk7CisKKyAgICBBdWRpb0RldmljZVtdIGdldERldmljZXNGb3JSb2xlQW5kQ2FwdHVyZVByZXNldChBdWRpb1NvdXJjZVR5cGUgYXVkaW9Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlUm9sZSByb2xlKTsKKworICAgIGJvb2xlYW4gcmVnaXN0ZXJTb3VuZFRyaWdnZXJDY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yoqIE5vdGlmaWVzIGEgY2hhbmdlIGluIHRoZSBtaXhpbmcgc3RhdGUgb2YgYSBzcGVjaWZpYyBtaXggaW4gYSBkeW5hbWljIGF1ZGlvIHBvbGljeS4gKi8KKyAgICB2b2lkIG9uRHluYW1pY1BvbGljeU1peFN0YXRlVXBkYXRlKEB1dGY4SW5DcHAgU3RyaW5nIHJlZ0lkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXRlKTsKKyAgICAvKiogTm90aWZpZXMgYSBjaGFuZ2Ugb2YgYXVkaW8gcmVjb3JkaW5nIGNvbmZpZ3VyYXRpb24uICovCisgICAgdm9pZCBvblJlY29yZGluZ0NvbmZpZ3VyYXRpb25VcGRhdGUoaW50IGV2ZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIFJlY29yZENsaWVudEluZm8gY2xpZW50SW5mbywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbiBBdWRpb0NvbmZpZ0Jhc2UgY2xpZW50Q29uZmlnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIEVmZmVjdERlc2NyaXB0b3JbXSBjbGllbnRFZmZlY3RzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluIEF1ZGlvQ29uZmlnQmFzZSBkZXZpY2VDb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW4gRWZmZWN0RGVzY3JpcHRvcltdIGVmZmVjdHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IC8qIGF1ZGlvX3BhdGNoX2hhbmRsZV90ICovIHBhdGNoSGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEF1ZGlvU291cmNlVHlwZSBzb3VyY2UpOworICAgICAvKiogTm90aWZpZXMgYSBjaGFuZ2Ugb2YgYX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ibGliY2dyb3VwcmNfZm9ybWF0IiwKKyAgICAgICAgImxpYmN1dGlscyIsCisgICAgICAgICJsaWJqc29uY3BwIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgICAgICJsaWJtZWRpYW1ldHJpY3MiLAorICAgICAgICAibGlibWVkaWFtZXRyaWNzc2VydmljZSIsCisgICAgICAgICJsaWJtZWRpYV9oZWxwZXIiLAorICAgICAgICAibGlicHJvY2Vzc2dyb3VwIiwKKyAgICAgICAgInNoYXJlZC1maWxlLXJlZ2lvbi1haWRsLWNwcCIsCisgICAgXSwKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5hdWRpby5jb21tb24tdXRpbCIsCisgICAgICAgICJhdWRpb2NsaWVudC10eXBlcy1haWRsLWNwcCIsCisgICAgICAgICJhdWRpb2ZsaW5nZXItYWlkbC1jcHAiLAorICAgICAgICAiYXVkaW9wb2xpY3ktYWlkbC1jcHAiLAorICAgICAgICAiYXVkaW9wb2xpY3ktdHlwZXMtYWlkbC1jcHAiLAorICAgICAgICAiYXYtdHlwZXMtYWlkbC1jcHAiLAorICAgICAgICAiY2FwdHVyZV9zdGF0ZV9saXN0ZW5lci1haWRsLWNwcCIsCisgICAgICAgICJsaWJhdWRpb2NsaWVudF9haWRsX2NvbnZlcnNpb24iLAorICAgICAgICAibGliYXVkaW9mbGluZ2VyIiwKKyAgICAgICAgImxpYmF1ZGlvZm91bmRhdGlvbiIsCisgICAgICAgICJsaWJhdWRpb21hbmFnZXIiLAorICAgICAgICAibGliYXVkaW9wb2xpY3kiLAorICAgICAgICAibGliYXVkaW91dGlscyIsCisgICAgICAgICJsaWJiaW5kZXIiLAorICAgICAgICAibGliZGwiLAorICAgICAgICAibGlibWVkaWF1dGlscyIsCisgICAgICAgICJsaWJuYmxvZyIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgICAgICJsaWJ4bWwyIiwKKyAgICAgICAgIm1lZGlhbWV0cmljc3NlcnZpY2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U9fVU5JUVVFX0lEX1VTRV9VTlNQRUNJRklFRCwgQVVESU9fVU5JUVVFX0lEX1VTRV9TRVNTSU9OLCBBVURJT19VTklRVUVfSURfVVNFX01PRFVMRSwKKyAgICBBVURJT19VTklRVUVfSURfVVNFX0VGRkVDVCwgICAgICBBVURJT19VTklRVUVfSURfVVNFX1BBVENILCAgIEFVRElPX1VOSVFVRV9JRF9VU0VfT1VUUFVULAorICAgIEFVRElPX1VOSVFVRV9JRF9VU0VfSU5QVVQsICAgICAgIEFVRElPX1VOSVFVRV9JRF9VU0VfQ0xJRU5ULCAgQVVESU9fVU5JUVVFX0lEX1VTRV9NQVgsCit9OworCitjb25zdGV4cHIgYXVkaW9fbW9kZV90IGtNb2Rlc1tdID0geworICAgIEFVRElPX01PREVfSU5WQUxJRCwgQVVESU9fTU9ERV9DVVJSRU5ULCAgICAgICAgICBBVURJT19NT0RFX05PUk1BTCwgICAgIEFVRElPX01PREVfUklOR1RPTkUsCisgICAgQVVESU9fTU9ERV9JTl9DQUxMLCBBVURJT19NT0RFX0lOX0NPTU1VTklDQVRJT04sIEFVRElPX01PREVfQ0FMTF9TQ1JFRU59OworCitjb25zdGV4cHIgYXVkaW9fc2Vzc2lvbl90IGtTZXNzaW9uSWRbXSA9IHtBVURJT19TRVNTSU9OX05PTkUsIEFVRElPX1NFU1NJT05fT1VUUFVUX1NUQUdFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU0VTU0lPTl9ERVZJQ0V9OworCitjb25zdGV4cHIgYXVkaW9fZW5jYXBzdWxhdGlvbl9tb2RlX3Qga0VuY2Fwc3VsYXRpb25bXSA9IHsKKyAgICBBVURJT19FTkNBUFNVTEFUSU9OX01PREVfTk9ORSwKKyAgICBBVURJT19FTkNBUFNVTEFUSU9OX01PREVfRUxFTUVOVEFSWV9TVFJFQU0sCisgICAgQVVESU9fRU5DQVBTVUxBVElPTl9NT0RFX0hBTkRMRSwKK307CisKK2NvbnN0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AgICByZWNvcmQtPmdldFBvcnRJZCgpOworfQorCitzdHJ1Y3QgRWZmZWN0Q2xpZW50IDogcHVibGljIGFuZHJvaWQ6Om1lZGlhOjpCbkVmZmVjdENsaWVudCB7CisgICAgRWZmZWN0Q2xpZW50KCkge30KKyAgICBiaW5kZXI6OlN0YXR1cyBjb250cm9sU3RhdHVzQ2hhbmdlZChib29sIGNvbnRyb2xHcmFudGVkIF9fdW51c2VkKSBvdmVycmlkZSB7CisgICAgICAgIHJldHVybiBiaW5kZXI6OlN0YXR1czo6b2soKTsKKyAgICB9CisgICAgYmluZGVyOjpTdGF0dXMgZW5hYmxlU3RhdHVzQ2hhbmdlZChib29sIGVuYWJsZWQgX191bnVzZWQpIG92ZXJyaWRlIHsKKyAgICAgICAgcmV0dXJuIGJpbmRlcjo6U3RhdHVzOjpvaygpOworICAgIH0KKyAgICBiaW5kZXI6OlN0YXR1cyBjb21tYW5kRXhlY3V0ZWQoaW50MzJfdCBjbWRDb2RlIF9fdW51c2VkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnZlY3Rvcjx1aW50OF90PiAmY21kRGF0YSBfX3VudXNlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8dWludDhfdD4gJnJlcGx5RGF0YSBfX3VudXNlZCkgb3ZlcnJpZGUgeworICAgICAgICByZXR1cm4gYmluZGVyOjpTdGF0dXM6Om9rKCk7CisgICAgfQorfTsKKworc3RhdHVzX3QgQXVkaW9GbGluZ2VyRnV6emVyOjppbnZva2VBdWRpb0VmZmVjdCgpIHsKKyAgICBlZmZlY3RfdXVpZF90IHR5cGU7CisgICAgdHlwZS50aW1lTG93ID0gbUZkcC5Db25zdW1lSW50ZWdyYWw8dWludDMyX3Q+KCk7CisgICAgdHlwZS50aW1lTWlkID0gbUZkcC5Db25zdW1lSW50ZWdyYWw8dWludDE2X3Q+KCk7CisgICAgdHlwZS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5lIFJFVFVSTl9JRl9FUlJPUihyZXN1bHQpIFwKKyAgICBpZiAoc3RhdHVzX3QgX3RtcCA9IChyZXN1bHQpOyBfdG1wICE9IE9LKSByZXR1cm4gYmFzZTo6dW5leHBlY3RlZChfdG1wKTsKKworI2RlZmluZSBWQUxVRV9PUl9SRVRVUk5fU1RBVFVTKHgpICAgICAgICAgICBcCisgICAgKHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICBhdXRvIF90bXAgPSAoeCk7ICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgIGlmICghX3RtcC5vaygpKSByZXR1cm4gX3RtcC5lcnJvcigpOyBcCisgICAgICAgc3RkOjptb3ZlKF90bXAudmFsdWUoKSk7ICAgICAgICAgICAgIFwKKyAgICAgfSkKKworI2RlZmluZSBWQUxVRV9PUl9GQVRBTChyZXN1bHQpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAoeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgYXV0byBfdG1wID0gKHJlc3VsdCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgIExPR19BTFdBWVNfRkFUQUxfSUYoIV90bXAub2soKSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICJGdW5jdGlvbjogJXMgTGluZTogJWQgRmFpbGVkIHJlc3VsdCAoJWQpIixcCisgICAgICAgICAgICAgICAgICAgICAgICAgICBfX0ZVTkNUSU9OX18sIF9fTElORV9fLCBfdG1wLmVycm9yKCkpOyAgICAgXAorICAgICAgIHN0ZDo6bW92ZShfdG1wLnZhbHVlKCkpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgfSkKKworLyoqCisgKiBBIGdlbmVyaWMgdGVtc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GEgYmluZGVyIHN0YXR1cy4KKyAqCisgKiBVc2VkIHRvIGhhbmRsZSBlcnJvcnMgZnJvbSBhIEFJREwgbWV0aG9kIGRlY2xhcmF0aW9uCisgKgorICogW29uZXdheV0gdm9pZCBtZXRob2QodHlwZTAgcGFyYW0wLCAuLi4pCisgKgorICogb3IgdGhlIGZvbGxvd2luZyAod2hlcmUgcmV0dXJuX3R5cGUgaXMgbm90IGEgc3RhdHVzX3QpCisgKgorICogcmV0dXJuX3R5cGUgbWV0aG9kKHR5cGUwIHBhcmFtMCwgLi4uKQorICovCitzdGF0aWMgaW5saW5lIHN0YXR1c190IHN0YXR1c1RGcm9tQmluZGVyU3RhdHVzKGNvbnN0IDo6YW5kcm9pZDo6YmluZGVyOjpTdGF0dXMgJnN0YXR1cykgeworICAgIHJldHVybiBzdGF0dXMuaXNPaygpID8gT0sgLy8gY2hlY2sgT0ssCisgICAgICAgIDogc3RhdHVzLnNlcnZpY2VTcGVjaWZpY0Vycm9yQ29kZSgpIC8vIHNlcnZpY2Utc2lkZSBlcnJvciwgbm90IHN0YW5kYXJkIEphdmEgZXhjZXB0aW9uCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIChmcm9tU2VydmljZVNwZWNpZmljRXJyb3IpCisgICAgICAgID86IHN0YXR1cy50cmFuc2FjdGlvbkVycm9yKCkgLy8gYSBuYXRpdmUgYmluZGVyIHRyYW5zYWN0aW9uIGVycm9yIChmcm9tU3RhdHVzVCkKKyAgICAgICAgPzogc3RhdHVzVEZyb21FeGNlcHRpb25Db2RlKHN0YXR1cy5leGNlcHRpb25Db2RlKCkpOyAvLyBhIHNlcnZpY2Utc2lkZSBlcnJvciB3aXRoIGEKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzdGFuZGFyZCBKYXZhIGV4Y2VwdGlvbiAoZnJvbUV4Y2VwdGlvbkNvZGUpCit9CisKKy8qKgorICogUmV0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pbnQzMl90IGNtZFNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAqcENtZERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgcmVwbHlTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgKnBSZXBseURhdGEpIHsKKyAgICAgICAgYmluZGVyOjpTdGF0dXMgY29tbWFuZEV4ZWN1dGVkKGludDMyX3QgY21kQ29kZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8dWludDhfdD4mIGNtZERhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6dmVjdG9yPHVpbnQ4X3Q+JiByZXBseURhdGEpIG92ZXJyaWRlIHsKICAgICAgICAgICAgIHNwPEF1ZGlvRWZmZWN0PiBlZmZlY3QgPSBtRWZmZWN0LnByb21vdGUoKTsKICAgICAgICAgICAgIGlmIChlZmZlY3QgIT0gMCkgewotICAgICAgICAgICAgICAgIGVmZmVjdC0+Y29tbWFuZEV4ZWN1dGVkKAotICAgICAgICAgICAgICAgICAgICBjbWRDb2RlLCBjbWRTaXplLCBwQ21kRGF0YSwgcmVwbHlTaXplLCBwUmVwbHlEYXRhKTsKKyAgICAgICAgICAgICAgICBlZmZlY3QtPmNvbW1hbmRFeGVjdXRlZChjbWRDb2RlLCBjbWREYXRhLCByZXBseURhdGEpOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGJpbmRlcjo6U3RhdHVzOjpvaygpOwogICAgICAgICB9CiAKICAgICAgICAgLy8gSUJpbmRlcjo6RGVhdGhSZWNpcGllbnQKQEAgLTYwNCwxMiArNjAyLDEwIEBACiAKICAgICB2b2lkIGJpbmRlckRpZWQoKTsKIAotICAgIHNwPElFZmZlY3Q+ICAgICAgICAgICAgIG1JRWZmZWN0OyAgICAgICAgICAgLy8g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2lucHV0X2NoYW5uZWwoY2hhbm5lbE1hc2spIGlzIHRydWUuCi0gICAgICogb3BQYWNrYWdlTmFtZTogICAgICBUaGUgcGFja2FnZSBuYW1lIHVzZWQgZm9yIGFwcCBvcHMuCisgICAgICogY2xpZW50OiAgICAgICAgICAgICBUaGUgYXR0cmlidXRpb24gc291cmNlIG9mIHRoZSBvd25lciBvZiB0aGUgcmVjb3JkCiAgICAgICogZnJhbWVDb3VudDogICAgICAgICBNaW5pbXVtIHNpemUgb2YgdHJhY2sgUENNIGJ1ZmZlciBpbiBmcmFtZXMuIFRoaXMgZGVmaW5lcyB0aGUKICAgICAgKiAgICAgICAgICAgICAgICAgICAgIGFwcGxpY2F0aW9uJ3MgY29udHJpYnV0aW9uIHRvIHRoZQogICAgICAqICAgICAgICAgICAgICAgICAgICAgbGF0ZW5jeSBvZiB0aGUgdHJhY2suICBUaGUgYWN0dWFsIHNpemUgc2VsZWN0ZWQgYnkgdGhlIEF1ZGlvUmVjb3JkIGNvdWxkCkBAIC0xODYsNyArMTg3LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHNhbXBsZVJhdGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19mb3JtYXRfdCBmb3JtYXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19jaGFubmVsX21hc2tfdCBjaGFubmVsTWFzaywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFN0cmluZzE2JiBvcFBhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYW5kcm9pZDo6Y29udGVudDo6QXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgY2xpZW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IGZyYW1lQ291bnQgPSAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2tfdCBjYmYgPSBOVUxMLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCogdXNlciA9IE5VTEwsCkBAIC0xOTQsOCArMTk1LDYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uSWQgPSBBVURJT19TRVNTSU9OX0FMTE9DQVRFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmZXJfdHlwZSB0cmFuc2ZlclR5cGUgPSBUUkFOU0ZFUl9ERUZBVUxULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW5wdXRfZmxhZ3NfdCBmbGFncyA9IEFVRElPX0lOUFVUX0ZMQUdfTk9ORSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCA9IEFVRElPX1VJRF9JTlZBTElELAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkID0gLTEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdWRpb19hdHRyaWJ1dGVzX3QqIHBBdHRyaWJ1dGVzID0gTlVMTCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3Qgc2VsZWN0ZWREZXZpY2VJZCA9IEFVRElPX1BPUlRfSEFORExFX05PTkUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19taWNyb3Bob25lX2RpcmVjdGlvbl90CkBAIC0yNDIsNyArMjQxLDggQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90IHNlbGVjdGVkRGV2aWNlSWQgPSBBVURJT19QT1JUX0hBTkRMRV9OT05FLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG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0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlJiBhdHRyaWJ1dGlvblNvdXJjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdWRpb19jb25maWdfdCAqY29uZmlnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190IGZsYWdzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnNlbGVjdGVkRGV2aWNlSWQsCkBAIC0yNTYsOSArMjg3LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICppbnB1dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3VuaXF1ZV9pZF90IHJpaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IHBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFN0cmluZzE2JiBvcFBhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUmIGF0dHJpYnV0aW9uU291cmNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZml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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1hdF90ICpzdXJyb3VuZEZvcm1hdHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sICpzdXJyb3VuZEZvcm1hdHNFbmFibGVkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCByZXBvcnRlZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sICpzdXJyb3VuZEZvcm1hdHNFbmFibGVkKTsKKyAgICBzdGF0aWMgc3RhdHVzX3QgZ2V0UmVwb3J0ZWRTdXJyb3VuZEZvcm1hdHModW5zaWduZWQgaW50ICpudW1TdXJyb3VuZEZvcm1hdHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1hdF90ICpzdXJyb3VuZEZvcm1hdHMpOwogICAgIHN0YXRpYyBzdGF0dXNfdCBzZXRTdXJyb3VuZEZvcm1hdEVuYWJsZWQoYXVkaW9fZm9ybWF0X3QgYXVkaW9Gb3JtYXQsIGJvb2wgZW5hYmxlZCk7CiAKICAgICBzdGF0aWMgc3RhdHVzX3Qgc2V0QXNzaXN0YW50VWlkKHVpZF90IHVpZCk7CisgICAgc3RhdGljIHN0YXR1c190IHNldEhvdHdvcmREZXRlY3Rpb25TZXJ2aWNlVWlkKHVpZF90IHVpZCk7CiAgICAgc3RhdGljIHN0YXR1c190IHNldEExMXlTZXJ2aWNlc1VpZHMoY29uc3Qgc3RkOjp2ZWN0b3I8dWlkX3Q+JiB1aWRzKTsKICAgICBzdGF0aWMgc3RhdHVzX3Qgc2V0Q3VycmVudEltZVVpZCh1aWRfdCB1aWQpOwogCiAgICAgc3RhdGljIGJvb2wgICAgIGlzSGFwdGljUGxheWJhY2tTdXBwb3J0ZWQoKTsKIAogICAgIHN0YXRpYyBzdGF0dXNfdCBsaXN0QXVkaW9Qc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ZXJ2aWNlQ2xpZW50CiAgICAgewogICAgIHB1YmxpYzoKICAgICAgICAgQXVkaW9Qb2xpY3lTZXJ2aWNlQ2xpZW50KCkgewpAQCAtNTgxLDE4ICs2MzIsMjEgQEAKICAgICAgICAgdmlydHVhbCB2b2lkIGJpbmRlckRpZWQoY29uc3Qgd3A8SUJpbmRlcj4mIHdobyk7CiAKICAgICAgICAgLy8gSUF1ZGlvUG9saWN5U2VydmljZUNsaWVudAotICAgICAgICB2aXJ0dWFsIHZvaWQgb25BdWRpb1BvcnRMaXN0VXBkYXRlKCk7Ci0gICAgICAgIHZpcnR1YWwgdm9pZCBvbkF1ZGlvUGF0Y2hMaXN0VXBkYXRlKCk7Ci0gICAgICAgIHZpcnR1YWwgdm9pZCBvbkF1ZGlvVm9sdW1lR3JvdXBDaGFuZ2VkKHZvbHVtZV9ncm91cF90IGdyb3VwLCBpbnQgZmxhZ3MpOwotICAgICAgICB2aXJ0dWFsIHZvaWQgb25EeW5hbWljUG9saWN5TWl4U3RhdGVVcGRhdGUoU3RyaW5nOCByZWdJZCwgaW50MzJfdCBzdGF0ZSk7Ci0gICAgICAgIHZpcnR1YWwgdm9pZCBvblJlY29yZGluZ0NvbmZpZ3VyYXRpb25VcGRhdGUoaW50IGV2ZW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlY29yZF9jbGllbnRfaW5mb190ICpjbGllbnRJbmZvLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2NvbmZpZ19iYXNlX3QgKmNsaWVudENvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxlZmZlY3RfZGVzY3JpcHRvcl90PiBjbGllbnRFZmZlY3RzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2NvbmZpZ19iYXNlX3QgKmRldmljZUNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxlZmZlY3RfZGVzY3JpcHRvcl90PiBlZmZlY3RzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BhdGNoX2hhbmRsZV90IHBhdGNoSGFuZGxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3NvdXJjZV90IHNvdXJjZSk7CisgICAgICAgIGJpbmRlcjo6U3RhdHVzIG9uQXVkaW9Wb2x1bWVHcm91cENoYW5nZWQoaW50MzJfdCBncm91cCwgaW50MzJfdCBmbGFncykgb3ZlcnJpZGU7CisgICAgICAgIGJpbmRlcjo6U3RhdHVzIG9uQXVkaW9Qb3J0TGlzdFVwZGF0ZSgpIG92ZXJyaWRlOworICAgICAgICBiaW5kZXI6OlN0YXR1cyBvbkF1ZGlvUGF0Y2hMaXN0VXBkYXRlKCkgb3ZlcnJpZGU7CisgICAgICAgIGJpbmRlcjo6U3RhdHVzIG9uRHluYW1pY1BvbGljeU1peFN0YXRlVXBkYXRlKGNvbnN0IHN0ZDo6c3RyaW5nJiByZWdJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBzdGF0ZSkgb3ZlcnJpZGU7CisgICAgICAgIGJpbmRlcjo6U3RhdHVzIG9uUmVjb3JkaW5nQ29uZmlndXJhdGlvblVwZGF0ZSgKKyAgICAgICAgICAgICAgICBpbnQzMl90IGV2ZW50LAorICAgICAgICAgICAgICAgIGNvbnN0IG1lZGlhOjpSZWNvcmRDbGllbnRJbmZvJiBjbGllbnRJbmZvLAorICAgICAgICAgICAgICAgIGNvbnN0IG1lZGlhOjpBdWR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bWVudCB0cmFja2luZywgb3IgLTEgZm9yCisgICAgICogICAgICAgICAgICAgICAgICAgICBjdXJyZW50IHVzZXIvcHJvY2VzcyBJRCwgcGx1cyB0aGUgcGFja2FnZSBuYW1lLgogICAgICAqIHBBdHRyaWJ1dGVzOiAgICAgICAgSWYgbm90IE5VTEwsIHN1cGVyc2VkZXMgc3RyZWFtVHlwZSBmb3IgdXNlIGNhc2Ugc2VsZWN0aW9uLgogICAgICAqIGRvTm90UmVjb25uZWN0OiAgICAgSWYgc2V0IHRvIHRydWUsIEF1ZGlvVHJhY2sgd29uJ3QgYXV0b21hdGljYWxseSByZWNyZWF0ZSB0aGUgSUF1ZGlvVHJhY2sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpbmRlciB0byBBdWRpb0ZsaW5nZXIuCkBAIC0yNTcsMTMgKzI2MiwxMiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb25JZCAgPSBBVURJT19TRVNTSU9OX0FMTE9DQVRFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmZXJfdHlwZSB0cmFuc2ZlclR5cGUgPSBUUkFOU0ZFUl9ERUZBVUxULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fb2ZmbG9hZF9pbmZvX3QgKm9mZmxvYWRJbmZvID0gTlVMTCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCA9IEFVRElPX1VJRF9JTlZBTElELAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkID0gLTEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlJiBhdHRyaWJ1dGlvblNvdXJjZSA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fYXR0cmlidXRlc190KiBwQXR0cmlidXRlcyA9IE5VTEwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGRvTm90UmVjb25uZWN0ID0gZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBtYXhSZXF1aXJlZFNwZWVkID0gMS4wZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3Qgc2VsZWN0ZWREZXZpY2VJZCA9IEFVRElPX1BPUlRfSEFORExFX05PTkUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgb3BQYWNrYWdlTmFtZSA9ICIiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3Qgc2VsZWN0ZWREZXZpY2VJZCA9IEFVRElPX1BPUlRfSEFORExFX05PTkUpOwogCiAgICAgLyogQ3JlYXRlcyBhbiBhdWRpbyB0cmFjayBhbmQgcmVnaXN0ZXJzIGl0IHdpdGggQXVkaW9GbGluZ2VyLgogICAgICAqIFdpdGggdGhpcyBjb25zdHJ1Y3RvciwgdGhlIHRyYWNrIGlzIGNvbmZpZ3VyZWQgZm9yIHN0YXRpYyBidWZmZXIgbW9kZS4KQEAgLTI4OSwxMiArMjkzLDExIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkICAgPSBBVURJT19TRVNTSU9OX0FMTE9DQVRFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmZXJfdHlwZSB0cmFuc2ZlclR5cGUgPSBUUkFOU0ZFUl9ERUZBVUxULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fb2ZmbG9hZF9pbmZvX3QgKm9mZmxvYWRJbmZvID0gTlVMTCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCA9IEFVRElPX1VJRF9JTlZBTElELAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkID0gLTEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlJiBhdHRyaWJ1dGlvblNvdXJjZSA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fYXR0cmlidXRlc190KiBwQXR0cmlidXRlcyA9IE5VTEwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGRvTm90UmVjb25uZWN0ID0gZmFsc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBtYXhSZXF1aXJlZFNwZWVkID0gMS4wZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBvcFBhY2thZ2VOYW1lID0gIiIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgbWF4UmVxdWlyZWRTcGVlZCA9IDEuMGYpOwogCiAgICAgLyogVGVybWluYXRlcyB0aGUgQXVkaW9UcmFjayBhbmQgdW5yZWdpc3RlcnMgaXQgZnJvbSBBdWRpb0ZsaW5nZXIuCiAgICAgICogQWxzbyBkZXN0cm95cyBhbGwgcmVzb3VyY2VzIGFzc29jaWF0ZWQgd2l0aCB0aGUgQXVkaW9UcmFjay4KQEAgLTMzOCw2ICszNDEsMjcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkICA9IEFVRElPX1NFU1NJT05fQUxMT0NBVEUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmZXJfdHlwZSB0cmFuc2ZlclR5cGUgPSBUUkFOU0ZFUl9ERUZBVUxULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX29mZmxvYWRfaW5mb190ICpvZmZsb2FkSW5mbyA9IE5VTEwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgYXR0cmlidXRpb25Tb3VyY2UgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fYXR0cmlidXRlc190KiBwQXR0cmlidXRlcyA9IE5VTEwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBkb05vdFJlY29ubmVjdCA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IG1heFJlcXVpcmVkU3BlZWQgPSAxLjBmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3Qgc2VsZWN0ZWREZXZpY2VJZCA9IEFVRElPX1BPUlRfSEFORExFX05PTkUpOworICAgIC8vIEZJWE1FKGIvMTY5ODg5NzE0KTogVmVuZG9yIGNvZGUgZGVwZW5kcyBvbiB0aGUgb2xkIG1ldGhvZCBzaWduYXR1cmUgYXQgbGluayB0aW1lCisgICAgICAgICAgICBzdGF0dXNfdCAgICBzZXQoYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW1UeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHNhbXBsZVJhdGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZm9ybWF0X3QgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGNoYW5uZWxNYXNrLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCBmcmFtZUNvdW50ICAgPSAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190IGZsYWdzID0gQVVESU9fT1VUUFVUX0ZMQUdfTk9ORSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFja190IGNiZiAgICAgID0gTlVMTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkKiB1c2VyICAgICAgICAgID0gTlVMTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IG5vdGlmaWNhdGlvbkZyYW1lcyA9IDAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8SU1lbW9yeT4mIHNoYXJlZEJ1ZmZlciA9IDAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCB0aHJlYWRDYW5DYWxsSmF2YSA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uSWQgID0gQVVESU9fU0VTU0lPTl9BTExPQ0FURSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2Zlcl90eXBlIHRyYW5zZmVyVHlwZSA9IFRSQU5TRkVSX0RFRkFVTFQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fb2ZmbG9hZF9pbmZvX3QgKm9mZmxvYWRJbmZvID0gTlVMTCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQgPSBBVURJT19VSURfSU5WQUxJRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWRfdCBwaWQgPSAtMSwKICAgICAgICAgICAg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Mgbm90IHNldC4KKyAgICAgKi8KKyAgICBzdGQ6OnN0cmluZyAgICAgICAgICAgICBtTG9nU2Vzc2lvbklke307CisKICAgICBtdXRhYmxlIE11dGV4ICAgICAgICAgICBtTG9jazsKIAogICAgIGludCAgICAgICAgICAgICAgICAgICAgIG1QcmV2aW91c1ByaW9yaXR5OyAgICAgICAgICAvLyBiZWZvcmUgc3RhcnQoKQpAQCAtMTI0Miw4ICsxMzM5LDYgQEAKIAogICAgIHNwPG1lZGlhOjpWb2x1bWVIYW5kbGVyPiAgICAgICBtVm9sdW1lSGFuZGxlcjsKIAotICAgIGNvbnN0IHN0ZDo6c3RyaW5nICAgICAgbU9wUGFja2FnZU5hbWU7Ci0KIHByaXZhdGU6CiAgICAgY2xhc3MgRGVhdGhOb3RpZmllciA6IHB1YmxpYyBJQmluZGVyOjpEZWF0aFJlY2lwaWVudCB7CiAgICAgcHVibGljOgpAQCAtMTI1NiwxMSArMTM1MSwxNCBAQAogCiAgICAgc3A8RGVhdGhOb3RpZmllcj4gICAgICAgbURlYXRoTm90aWZpZXI7CiAgICAgdWludDMyX3QgICAgICAgICAgICAgICAgbVNlcXVlbmNlOyAgICAgICAgICAgICAgLy8gaW5jcmVtZW50ZWQgZm9yIGVhY2ggbmV3IElBdWRpb1RyYWNrIGF0dGVtcHQKLSAgICB1aWRfdCAgICAgICAgICAgICAgICAgICBtQ2xpZW50VWlkOwotICAgIHBpZF90ICAgICAgICAgICAgICAgICAgIG1DbGllbnRQaWQ7CisgICAgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSBtQ2xpZW50QXR0cmlidXRpb25Tb3VyY2U7CiAKICAgICB3cDxBdWRpb1N5c3RlbTo6QXVkaW9EZXZpY2VDYWxsYmFjaz4gbURldmljZUNhbGxiYWNrOwogCisgICAgLy8gQ2FjaGVkIHZhbHVlcyB0byByZXN0b3JlIGFsb25nIHdpdGggdGhlIEF1ZGlvVHJhY2suCisgICAgYXVkaW9fZHVhbF9tb25vX21vZGVfd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mlnLCAwLCBzaXplb2YoYXVkaW9fY29uZmlnX3QpKTsKLSAgICAgICAgICAgIGlmIChwYXJjZWwtPnJlYWQoJmNvbmZpZywgc2l6ZW9mKGF1ZGlvX2NvbmZpZ190KSkgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gREVBRF9PQkpFQ1Q7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoY2xpZW50SW5mby5yZWFkRnJvbVBhcmNlbChwYXJjZWwpICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIERFQURfT0JKRUNUOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHBhcmNlbC0+cmVhZEludDMyKCkgIT0gMCkgewotICAgICAgICAgICAgICAgIC8vIFRPRE86IFVzaW5nIHVuc2VjdXJlUG9pbnRlcigpIGhhcyBzb21lIGFzc29jaWF0ZWQgc2VjdXJpdHkKLSAgICAgICAgICAgICAgICAvLyAgICAgICBwaXRmYWxscyAoc2VlIGRlY2xhcmF0aW9uIGZvciBkZXRhaWxzKS4KLSAgICAgICAgICAgICAgICAvLyAgICAgICBFaXRoZXIgZG9jdW1lbnQgd2h5IGl0IGlzIHNhZmUgaW4gdGhpcyBjYXNlIG9yIGFkZHJlc3MKLSAgICAgICAgICAgICAgICAvLyAgICAgICB0aGUgaXNzdWUgKGUuZy4gYnkgY29weWluZykuCi0gICAgICAgICAgICAgICAgc2hhcmVkQnVmZmVyID0gaW50ZXJmYWNlX2Nhc3Q8SU1lbW9yeT4ocGFyY2VsLT5yZWFkU3Ryb25nQmluZGVyKCkpOwotICAgICAgICAgICAgICAgIGlmIChzaGFyZWRCdWZmZXIgPT0gMCB8fCBzaGFyZWRCdWZmZXItPnVuc2VjdXJlUG9pbnRlcigpID09IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBub3RpZmljYXRpb25zUGVyQnVmZmVyID0gcGFyY2VsLT5yZWFkSW50MzIoKTsKLSAgICAgICAgICAgIHNwZWVkID0gcGFyY2VsLT5yZWFkRmxvYXQoKTsKLSAgICAgICAgICAgIGF1ZGlvVHJhY2tDYWxsYmFjayA9IGludGVyZmFjZV9jYXN0PG1lZGlhOjpJQXVkaW9UcmFja0NhbGxiYWNrPigKLSAgICAgICAgICAgICAgICAgICAgcGFyY2VsLT5yZWFkU3Ryb25nQmluZGVyKCkpOwotICAgICAgICAgICAgY29uc3QgY2hhciogb3BQYWNrYWdlTmFtZVB0ciA9IHBhcmNlbC0+cmVhZENTdHJpbmcoKTsKLSAgICAgICAgICAgIGlmIChvcFBhY2thZ2VOYW1lUHRyID09IG51bGxwdHIpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gRkFJTEVEX1RSQU5TQUNUSU9OOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgb3BQYWNrYWdlTmFtZSA9IG9wUGFja2FnZU5hbWVQdHI7Ci0KLSAgICAgICAgICAgIC8qIGlucHV0L291dHB1dCBhcmd1bWVudHMqLwotICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT5yZWFkKCZmbGFncywgc2l6ZW9mKGF1ZGlvX291dHB1dF9mbGFnc190KSk7Ci0gICAgICAgICAgICBmcmFtZUNvdW50ID0gcGFyY2VsLT5yZWFkSW50NjQoKTsKLSAgICAgICAgICAgIG5vdGlmaWNhdGlvbkZyYW1lQ291bnQgPSBwYXJjZWwtPnJlYWRJbnQ2NCgpOwotICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT5yZWFkKCZzZWxlY3RlZERldmljZUlkLCBzaXplb2YoYXVkaW9fcG9ydF9oYW5kbGVfdCkpOwotICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT5yZWFkKCZzZXNzaW9uSWQsIHNpemVvZihhdWRpb19zZXNzaW9uX3QpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfQotCi0gICAgICAgIHN0YXR1c190IHdyaXRlVG9QYXJjZWwoUGFyY2VsICpwYXJjZWwpIGNvbnN0IG92ZXJyaWRlIHsKLSAgICAgICAgICAgIC8qIGlucHV0IGFyZ3VtZW50cyovCi0gICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlKCZhdHRyLCBzaXplb2YoYXVkaW9fYXR0cmlidXRlc190KSk7Ci0gICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlKCZjb25maWcsIHNpemVvZihhdWRpb19jb25maWdfdCkpOwotICAgICAgICAgICAgKHZvaWQpY2xpZW50SW5mby53cml0ZVRvUGFyY2VsKHBhcmNlbCk7Ci0gICAgICAgICAgICBpZiAoc2hhcmVkQnVmZmVyICE9IDApIHsKLSAgICAgICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlSW50MzIoMSk7Ci0gICAgICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT53cml0ZVN0cm9uZ0JpbmRlcihJSW50ZXJmYWNlOjphc0JpbmRlcihzaGFyZWRCdWZmZXIpKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT53cml0ZUludDMyKDApOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT53cml0ZUludDMyKG5vdGlmaWNhdGlvbnNQZXJCdWZmZXIpOwotICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT53cml0ZUZsb2F0KHNwZWVkKTsKLSAgICAgICAgICAgICh2b2lkKXBhcmNlbC0+d3JpdGVTdHJvbmdCaW5kZXIoSUludGVyZmFjZTo6YXNCaW5kZXIoYXVkaW9UcmFja0NhbGxiYWNrKSk7Ci0gICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlQ1N0cmluZyhvcFBhY2thZ2VOYW1lLmNfc3RyKCkpOwotCi0gICAgICAgICAgICAvKiBpbnB1dC9vdXRwdXQgYXJ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dWRpb19pbnB1dF9mbGFnc190KSk7Ci0gICAgICAgICAgICBmcmFtZUNvdW50ID0gcGFyY2VsLT5yZWFkSW50NjQoKTsKLSAgICAgICAgICAgIG5vdGlmaWNhdGlvbkZyYW1lQ291bnQgPSBwYXJjZWwtPnJlYWRJbnQ2NCgpOwotICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT5yZWFkKCZzZWxlY3RlZERldmljZUlkLCBzaXplb2YoYXVkaW9fcG9ydF9oYW5kbGVfdCkpOwotICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT5yZWFkKCZzZXNzaW9uSWQsIHNpemVvZihhdWRpb19zZXNzaW9uX3QpKTsKLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKLSAgICAgICAgfQotCi0gICAgICAgIHN0YXR1c190IHdyaXRlVG9QYXJjZWwoUGFyY2VsICpwYXJjZWwpIGNvbnN0IG92ZXJyaWRlIHsKLSAgICAgICAgICAgIC8qIGlucHV0IGFyZ3VtZW50cyovCi0gICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlKCZhdHRyLCBzaXplb2YoYXVkaW9fYXR0cmlidXRlc190KSk7Ci0gICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlKCZjb25maWcsIHNpemVvZihhdWRpb19jb25maWdfYmFzZV90KSk7Ci0gICAgICAgICAgICAodm9pZCljbGllbnRJbmZvLndyaXRlVG9QYXJjZWwocGFyY2VsKTsKLSAgICAgICAgICAgICh2b2lkKXBhcmNlbC0+d3JpdGVTdHJpbmcxNihvcFBhY2thZ2VOYW1lKTsKLSAgICAgICAgICAgICh2b2lkKXBhcmNlbC0+d3JpdGUoJnJpaWQsIHNpemVvZihhdWRpb191bmlxdWVfaWRfdCkpOwotCi0gICAgICAgICAgICAvKiBpbnB1dC9vdXRwdXQgYXJndW1lbnRzKi8KLSAgICAgICAgICAgICh2b2lkKXBhcmNlbC0+d3JpdGUoJmZsYWdzLCBzaXplb2YoYXVkaW9faW5wdXRfZmxhZ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cGFyY2VsLT5yZWFkKCZzZXNzaW9uSWQsIHNpemVvZihhdWRpb19zZXNzaW9uX3QpKTsKLQotICAgICAgICAgICAgLyogb3V0cHV0IGFyZ3VtZW50cyovCi0gICAgICAgICAgICBzYW1wbGVSYXRlID0gcGFyY2VsLT5yZWFkVWludDMyKCk7Ci0gICAgICAgICAgICAodm9pZClwYXJjZWwtPnJlYWQoJmlucHV0SWQsIHNpemVvZihhdWRpb19pb19oYW5kbGVfdCkpOwotICAgICAgICAgICAgaWYgKHBhcmNlbC0+cmVhZEludDMyKCkgIT0gMCkgewotICAgICAgICAgICAgICAgIGNibGsgPSBpbnRlcmZhY2VfY2FzdDxJTWVtb3J5PihwYXJjZWwtPnJlYWRTdHJvbmdCaW5kZXIoKSk7Ci0gICAgICAgICAgICAgICAgLy8gVE9ETzogVXNpbmcgdW5zZWN1cmVQb2ludGVyKCkgaGFzIHNvbWUgYXNzb2NpYXRlZCBzZWN1cml0eQotICAgICAgICAgICAgICAgIC8vICAgICAgIHBpdGZhbGxzIChzZWUgZGVjbGFyYXRpb24gZm9yIGRldGFpbHMpLgotICAgICAgICAgICAgICAgIC8vICAgICAgIEVpdGhlciBkb2N1bWVudCB3aHkgaXQgaXMgc2FmZSBpbiB0aGlzIGNhc2Ugb3IgYWRkcmVzcwotICAgICAgICAgICAgICAgIC8vICAgICAgIHRoZSBpc3N1ZSAoZS5nLiBieSBjb3B5aW5nKS4KLSAgICAgICAgICAgICAgICBpZiAoY2JsayA9PSAwIHx8IGNibGstPnVuc2VjdXJlUG9pbnRlcigpID09IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAocGFyY2VsLT5yZWFkSW50MzIoKSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgYnVmZmVycyA9IGludGVyZmFjZV9jYXN0PElNZW1vcnk+KHBhcmNlbC0+cmVhZFN0cm9uZ0JpbmRlcigpKTsKLSAgICAgICAgICAgICAgICAvLyBUT0RPOiBVc2luZyB1bnNlY3VyZVBvaW50ZXIoKSBoYXMgc29tZSBhc3NvY2lhdGVkIHNlY3VyaXR5Ci0gICAgICAgICAgICAgICAgLy8gICAgICAgcGl0ZmFsbHMgKHNlZSBkZWNsYXJhdGlvbiBmb3IgZGV0YWlscykuCi0gICAgICAgICAgICAgICAgLy8gICAgICAgRWl0aGVyIGRvY3VtZW50IHdoeSBpdCBpcyBzYWZlIGluIHRoaXMgY2FzZSBvciBhZGRyZXNzCi0gICAgICAgICAgICAgICAgLy8gICAgICAgdGhlIGlzc3VlIChlLmcuIGJ5IGNvcHlpbmcpLgotICAgICAgICAgICAgICAgIGlmIChidWZmZXJzID09IDAgfHwgYnVmZmVycy0+dW5zZWN1cmVQb2ludGVyKCkgPT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgICh2b2lkKXBhcmNlbC0+cmVhZCgmcG9ydElkLCBzaXplb2YoYXVkaW9fcG9ydF9oYW5kbGVfdCkpOwotICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOwotICAgICAgICB9Ci0KLSAgICAgICAgc3RhdHVzX3Qgd3JpdGVUb1BhcmNlbChQYXJjZWwgKnBhcmNlbCkgY29uc3Qgb3ZlcnJpZGUgewotICAgICAgICAgICAgLyogaW5wdXQvb3V0cHV0IGFyZ3VtZW50cyovCi0gICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlKCZmbGFncywgc2l6ZW9mKGF1ZGlvX2lucHV0X2ZsYWdzX3QpKTsKLSAgICAgICAgICAgICh2b2lkKXBhcmNlbC0+d3JpdGVJbnQ2NChmcmFtZUNvdW50KTsKLSAgICAgICAgICAgICh2b2lkKXBhcmNlbC0+d3JpdGVJbnQ2NChub3RpZmljYXRpb25GcmFtZUNvdW50KTsKLSAgICAgICAgICAgICh2b2lkKXBhcmNlbC0+d3JpdGUoJnNlbGVjdGVkRGV2aWNlSWQsIHNpemVvZihhdWRpb19wb3J0X2hhbmRsZV90KSk7Ci0gICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlKCZzZXNzaW9uSWQsIHNpemVvZihhdWRpb19zZXNzaW9uX3QpKTsKLQotICAgICAgICAgICAgLyogb3V0cHV0IGFyZ3VtZW50cyovCi0gICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlVWludDMyKHNhbXBsZVJhdGUpOwotICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT53cml0ZSgmaW5wdXRJZCwgc2l6ZW9mKGF1ZGlvX2lvX2hhbmRsZV90KSk7Ci0gICAgICAgICAgICBpZiAoY2JsayAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT53cml0ZUludDMyKDEpOwotICAgICAgICAgICAgICAgICh2b2lkKXBhcmNlbC0+d3JpdGVTdHJvbmdCaW5kZXIoSUludGVyZmFjZTo6YXNCaW5kZXIoY2JsaykpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlSW50MzIoMCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoYnVmZmVycyAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgKHZvaWQpcGFyY2VsLT53cml0ZUludDMyKDEpOwotICAgICAgICAgICAgICAgICh2b2lkKXBhcmNlbC0+d3JpdGVTdHJvbmdCaW5kZXIoSUludGVyZmFjZTo6YXNCaW5kZXIoYnVmZmVycykpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlSW50MzIoMCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICAodm9pZClwYXJjZWwtPndyaXRlKCZwb3J0SWQsIHNpemVvZihhdWRpb19wb3J0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Mgd2lsbCByZWZsZWN0CisgICAgICogZmFpbHVyZS4KICAgICAgKi8KLSAgICB2aXJ0dWFsIHNwPElBdWRpb1RyYWNrPiBjcmVhdGVUcmFjayhjb25zdCBDcmVhdGVUcmFja0lucHV0JiBpbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDcmVhdGVUcmFja091dHB1dCYgb3V0cHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1c190ICpzdGF0dXMpID0gMDsKKyAgICB2aXJ0dWFsIHN0YXR1c190IGNyZWF0ZVRyYWNrKGNvbnN0IG1lZGlhOjpDcmVhdGVUcmFja1JlcXVlc3QmIGlucHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWE6OkNyZWF0ZVRyYWNrUmVzcG9uc2UmIG91dHB1dCkgPSAwOwogCi0gICAgdmlydHVhbCBzcDxtZWRpYTo6SUF1ZGlvUmVjb3JkPiBjcmVhdGVSZWNvcmQoY29uc3QgQ3JlYXRlUmVjb3JkSW5wdXQmIGlucHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENyZWF0ZVJlY29yZE91dHB1dCYgb3V0cHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1c190ICpzdGF0dXMpID0gMDsKKyAgICAvKiBjcmVhdGUgYW4gYXVkaW8gcmVjb3JkIGFuZCByZWdpc3RlcnMgaXQgd2l0aCBBdWRpb0ZsaW5nZXIuCisgICAgICogVGhlIGF1ZGlvUmVjb3JkIGZpZWxkIHdpbGwgYmUgbnVsbCBpZiB0aGUgdHJhY2sgY2Fubm90IGJlIGNyZWF0ZWQgYW5kIHRoZSBzdGF0dXMgd2lsbCByZWZsZWN0CisgICAgICogZmFpbHVyZS4KKyAgICAgKi8KKyAgICB2aXJ0dWFsIHN0YXR1c190IGNyZWF0ZVJlY29yZChjb25zdCBtZWRp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0ZSwgYXVkaW9fZm9ybWF0X3QgZm9ybWF0LAogICAgICAgICAgICAgYXVkaW9fY2hhbm5lbF9tYXNrX3QgY2hhbm5lbE1hc2spIGNvbnN0ID0gMDsKIAotICAgIHZpcnR1YWwgc3RhdHVzX3Qgb3Blbk91dHB1dChhdWRpb19tb2R1bGVfaGFuZGxlX3QgbW9kdWxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCAqb3V0cHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19jb25maWdfdCAqY29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxEZXZpY2VEZXNjcmlwdG9yQmFzZT4mIGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgKmxhdGVuY3lNcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fb3V0cHV0X2ZsYWdzX3QgZmxhZ3MpID0gMDsKKyAgICB2aXJ0dWFsIHN0YXR1c190IG9wZW5PdXRwdXQoY29uc3QgbWVkaWE6Ok9wZW5PdXRwdXRSZXF1ZXN0JiByZXF1ZXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYTo6T3Blbk91dHB1dFJlc3BvbnNlKiByZXNwb25zZSkgPSAwOwogICAgIHZpcnR1YWwgYXVkaW9faW9faGFuZGxlX3Qgb3BlbkR1cGxpY2F0ZU91dHB1dChhdWRpb19pb19oYW5kbGVfdCBvdXRwdXQxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3Qgb3V0cHV0MikgPSAwOwogICAgIHZpcnR1YWwgc3RhdHVzX3QgY2xvc2VPdXRwdXQoYXVkaW9faW9faGFuZGxlX3Qgb3V0cHV0KSA9IDA7CiAgICAgdmlydHVhbCBzdGF0dXNfdCBzdXNwZW5kT3V0cHV0KGF1ZGlvX2lvX2hhbmRsZV90IG91dHB1dCkgPSAwOwogICAgIHZpcnR1YWwgc3RhdHVzX3QgcmVzdG9yZU91dHB1dChhdWRpb19pb19oYW5kbGVfdCBvdXRwdXQpID0gMDsKIAotICAgIHZpcnR1YWwgc3RhdHVzX3Qgb3BlbklucHV0KGF1ZGlvX21vZHVsZV9oYW5kbGVfdCBtb2R1bGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgKmlucHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2NvbmZpZ190ICpjb25maWcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190ICpkZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nOCYgYWRkcmVzcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zb3VyY2VfdCBzb3VyY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW5wdXRfZmxhZ3NfdCBmbGFncykgPSAwOworICAgIHZpcnR1YWwgc3RhdHVzX3Qgb3BlbklucHV0KGNvbnN0IG1lZGlhOjpPcGVuSW5wdXRSZXF1ZXN0JiByZXF1ZXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhOjpPcGVuSW5wdXRSZXNwb25zZSogcmVzcG9uc2UpID0gMDsKKwogICAgIHZpcnR1YWwgc3RhdHVzX3QgY2xvc2VJbnB1dChhdWRpb19pb19oYW5kbGVfdCBpbnB1dCkgPSAwOwogCiAgICAgdmlydHVhbCBzdGF0dXNfdCBpbnZhbGlkYXRlU3RyZWFtKGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtKSA9IDA7CkBAIC00NzEsMjAgKzI4Myw4IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHByZWZlcnJlZFR5cGVGbGFnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlZmZlY3RfZGVzY3JpcHRvcl90ICpwRGVzY3JpcHRvcikgY29uc3QgPSAwOwogCi0gICAgdmlydHVhbCBzcDxJRWZmZWN0PiBjcmVhdGVFZmZlY3QoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlZmZlY3RfZGVzY3JpcHRvcl90ICpwRGVzYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPElFZmZlY3RDbGllbnQ+JiBjbGllbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHByaW9yaXR5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gQXVkaW9GbGluZ2VyIGRvZXNuJ3QgdGFrZSBvdmVyIGhhbmRsZSByZWZlcmVuY2UgZnJvbSBjbGllbnQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90IG91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uSWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdWRpb0RldmljZVR5cGVBZGRyJiBkZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTdHJpbmcxNiYgY2FsbGluZ1BhY2thZ2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWRfdCBwaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHByb2JlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzX3QgKnN0YXR1cywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCAqaW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gcGVybWlzc2lvbiBjaGVja3MuCisgICAgICAgICAqIFRoZSBpbXBsZW1lbnRlciBpcyByZXNwb25zaWJsZSB0byBpbnZva2UgdGhlIHByb3ZpZGVkIGRlbGVnYXRlIGZ1bmN0aW9uLCB3aGljaCBpcyB0aGUKKyAgICAgICAgICogYWN0dWFsIG9uVHJhbnNhY3QoKSwgdW5sZXNzIGFuIGVycm9yIG9jY3Vycy4KKyAgICAgICAgICogQnkgZGVmYXVsdCwgdGhpcyBpcyBqdXN0IGEgcGFzcy10aHJvdWdoIHRvIHRoZSBkZWxlZ2F0ZS4KKyAgICAgICAgICovCisgICAgICAgIHZpcnR1YWwgc3RhdHVzX3Qgb25UcmFuc2FjdFdyYXBwZXIoVHJhbnNhY3Rpb25Db2RlIGNvZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgUGFyY2VsJiBkYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGZsYWdzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6ZnVuY3Rpb248c3RhdHVzX3QoKT4mIGRlbGVnYXRlKSB7CisgICAgICAgICAgICAodm9pZCkgY29kZTsKKyAgICAgICAgICAgICh2b2lkKSBkYXRhOworICAgICAgICAgICAgKHZvaWQpIGZsYWdzOworICAgICAgICAgICAgcmV0dXJuIGRlbGVnYXRlKCk7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQW4gb3B0aW9uYWwgaG9vayBmb3IgaW1wbGVtZW50aW5nIGRpYWdub3N0aWNzIGR1bXBpbmcuCisgICAgICAgICAqLworICAgICAgICB2aXJ0dWFsIHN0YXR1c190IGR1bXAoaW50IGZkLCBjb25zdCBWZWN0b3I8U3RyaW5nMTY+JiBhcmdzKSB7CisgICAgICAgICAgICAodm9pZCkgZmQ7CisgICAgICAgICAgICAodm9pZCkgY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ICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvbGljeV9kZXZfc3RhdGVfdCBzdGF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19mb3JtYXRfdCBlbmNvZGVkRm9ybWF0KSA9IDA7Ci0gICAgdmlydHVhbCBhdWRpb19wb2xpY3lfZGV2X3N0YXRlX3QgZ2V0RGV2aWNlQ29ubmVjdGlvblN0YXRlKGF1ZGlvX2RldmljZXNfdCBkZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcykgPSAwOwotICAgIHZpcnR1YWwgc3RhdHVzX3QgaGFuZGxlRGV2aWNlQ29uZmlnQ2hhbmdlKGF1ZGlvX2RldmljZXNfdCBkZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqZGV2aWNlX2FkZHJlc3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqZGV2aWNlX25hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZm9ybWF0X3QgZW5jb2RlZEZvcm1hdCkgPSAwOwotICAgIHZpcnR1YWwgc3RhdHVzX3Qgc2V0UGhvbmVTdGF0ZShhdWRpb19tb2RlX3Qgc3RhdGUsIHVpZF90IHVpZCkgPSAwOwotICAgIHZpcnR1YWwgc3RhdHVzX3Qgc2V0Rm9yY2VVc2UoYXVkaW9fcG9saWN5X2ZvcmNlX3VzZV90IHVzYWdlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9saWN5X2ZvcmNlZF9jZmdfdCBjb25maWcpID0gMDsKLSAgICB2aXJ0dWFsIGF1ZGlvX3BvbGljeV9mb3JjZWRfY2ZnX3QgZ2V0Rm9yY2VVc2UoYXVkaW9fcG9saWN5X2ZvcmNlX3VzZV90IHVzYWdlKSA9IDA7Ci0gICAgdmlydHVhbCBhdWRpb19pb19oYW5kbGVfdCBnZXRPdXRwdXQoYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0pID0gMDsKLSAgICB2aXJ0dWFsIHN0YXR1c190IGdldE91dHB1dEZvckF0dHIoYXVkaW9fYXR0cmlidXRlc190ICphdHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCAqb3V0cHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc3RyZWFtX3R5cGVfdCAqc3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWRfdCBwaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX3QgKmNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fb3V0cHV0X2ZsYWdzX3QgZmxhZ3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnNlbGVjdGVkRGV2aWNlSWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnBvcnRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8YXVkaW9faW9faGFuZGxlX3Q+ICpzZWNvbmRhcnlPdXRwdXRzKSA9IDA7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCBzdGFydE91dHB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCkgPSAwOwotICAgIHZpcnR1YWwgc3RhdHVzX3Qgc3RvcE91dHB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCkgPSAwOwotICAgIHZpcnR1YWwgdm9pZCByZWxlYXNlT3V0cHV0KGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkKSA9IDA7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCAgZ2V0SW5wdXRGb3JBdHRyKGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAqYXR0ciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICppbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3VuaXF1ZV9pZF90IHJpaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IHBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFN0cmluZzE2JiBvcFBhY2thZ2VOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqY29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW5wdXRfZmxhZ3NfdCBmbGFncywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnNlbGVjdGVkRGV2aWNlSWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90ICpwb3J0SWQpID0gMDsKLSAgICB2aXJ0dWFsIHN0YXR1c190IHN0YXJ0SW5wdXQoYXVkaW9fcG9ydF9oYW5kbGVfdCBwb3J0SWQpID0gMDsKLSAgICB2aXJ0dWFsIHN0YXR1c190IHN0b3BJbnB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCkgPSAwOwotICAgIHZpcnR1YWwgdm9pZCByZWxlYXNlSW5wdXQoYXVkaW9fcG9ydF9oYW5kbGVfdCBwb3J0SWQpID0gMDsKLSAgICB2aXJ0dWFsIHN0YXR1c190IGluaXRTdHJlYW1Wb2x1bWUoYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleE1pbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGluZGV4TWF4KSA9IDA7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCBzZXRTdHJlYW1Wb2x1bWVJbmRleChhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UpID0gMDsKLSAgICB2aXJ0dWFsIHN0YXR1c190IGdldFN0cmVhbVZvbHVtZUluZGV4KGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ICppbmRleCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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7Ci0gICAgdmlydHVhbCBib29sICAgICBpc1N0cmVhbUFjdGl2ZVJlbW90ZWx5KGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtLCB1aW50MzJfdCBpblBhc3RNcyA9IDApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ID0gMDsKLSAgICB2aXJ0dWFsIGJvb2wgICAgIGlzU291cmNlQWN0aXZlKGF1ZGlvX3NvdXJjZV90IHNvdXJjZSkgY29uc3QgPSAwOwotICAgIHZpcnR1YWwgc3RhdHVzX3QgcXVlcnlEZWZhdWx0UHJlUHJvY2Vzc2luZyhhdWRpb19zZXNzaW9uX3QgYXVkaW9TZXNzaW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVmZmVjdF9kZXNjcmlwdG9yX3QgKmRlc2NyaXB0b3JzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICpjb3VudCkgPSAwOwotICAgIHZpcnR1YWwgc3RhdHVzX3QgYWRkU291cmNlRGVmYXVsdEVmZmVjdChjb25zdCBlZmZlY3RfdXVpZF90ICp0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTdHJpbmcxNiYgb3BQYWNrYWdlTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZWZmZWN0X3V1aWRfdCAqdXVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBwcmlvcml0eSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc291cmNlX3Qgc291cmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb191bmlxdWVfaWRfdCogaWQpID0gMDsKLSAgICB2aXJ0dWFsIHN0YXR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GljIElJbnRlcmZhY2UKLXsKLXB1YmxpYzoKLSAgICBERUNMQVJFX01FVEFfSU5URVJGQUNFKEVmZmVjdENsaWVudCk7Ci0KLSAgICB2aXJ0dWFsIHZvaWQgY29udHJvbFN0YXR1c0NoYW5nZWQoYm9vbCBjb250cm9sR3JhbnRlZCkgPSAwOwotICAgIHZpcnR1YWwgdm9pZCBlbmFibGVTdGF0dXNDaGFuZ2VkKGJvb2wgZW5hYmxlZCkgPSAwOwotICAgIHZpcnR1YWwgdm9pZCBjb21tYW5kRXhlY3V0ZWQodWludDMyX3QgY21kQ29kZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGNtZFNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICpwQ21kRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHJlcGx5U2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgKnBSZXBseURhdGEpID0gMDsKLX07Ci0KLS8vIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KLQotY2xhc3MgQm5FZmZlY3RDbGllbnQ6IHB1YmxpYyBCbkludGVyZmFjZTxJRWZmZWN0Q2xpZW50PgotewotcHVibGljOgotICAgIHZpcnR1YWwgc3RhdHVzX3QgICAgb25UcmFuc2FjdCggdWludDMyX3QgY29kZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFBhcmNlbCYgZGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhcmNlbCogcmVwbHksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBmbGFncyA9IDApOwotfTsKLQotfTsgLy8gbmFtZXNwYWNlIGFu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ICAgY29uc3QgbWVkaWE6OlZvbHVtZVNoYXBlcjo6T3BlcmF0aW9uJiBvcGVyYXRpb24pOworICAgICAgICAgICAgY29uc3QgbWVkaWE6OlZvbHVtZVNoYXBlckNvbmZpZ3VyYXRpb24mIGNvbmZpZ3VyYXRpb24sCisgICAgICAgICAgICBjb25zdCBtZWRpYTo6Vm9sdW1lU2hhcGVyT3BlcmF0aW9uJiBvcGVyYXRpb24pOwogCiAgICAgLy9GSVhNRSBtb3ZlIHRvIHByb3RlY3RlZCBmaWVsZCwgc28gZmFyIG1hZGUgcHVibGljIHRvIG1pbmltaXplIGNoYW5nZXMgdG8gQXVkaW9UcmFjayBsb2dpYwogICAgIHNwPEF1ZGlvVHJhY2s+IG1BdWRpb1RyYWNrOwpAQCAtNTMsOCArNTQsMjAgQEAKICAgICAgICAgICAgIHZvaWQgZG9EZXN0cm95KCk7CiAgICAgICAgICAgICBzdGF0dXNfdCBkb1NldFZvbHVtZSgpOwogCisgICAgICAgICAgICBjbGFzcyBTZWxmQXVkaW9EZXZpY2VDYWxsYmFjayA6IHB1YmxpYyBBdWRpb1N5c3RlbTo6QXVkaW9EZXZpY2VDYWxsYmFjayB7CisgICAgICAgICAgICBwdWJsaWM6CisgICAgICAgICAgICAgICAgU2VsZkF1ZGlvRGV2aWNlQ2FsbGJhY2soUGxheWVyQmFzZSYgc2VsZik7CisgICAgICAgICAgICAgICAgdmlydHVhbCB2b2lkIG9uQXVkaW9EZXZpY2VVcGRhdGUoYXVkaW9faW9faGFuZGxlX3QgYXVkaW9JbywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgZGV2aWNlSWQpOworICAgICAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgICAgICB2aXJ0dWFsIH5TZWxmQXVkaW9EZXZpY2VDYWxsYmFjaygpOworICAgICAgICAgICAgICAgIFBsYXllckJhc2UmIG1TZWxm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Rlc3RzX2RlZmF1bHRzIiwKICAgICBjZmxhZ3M6IFsKQEAgLTcsNiArMTYsMTggQEAKIH0KIAogY2NfdGVzdCB7CisgICAgbmFtZTogImF1ZGlvX2FpZGxfc3RhdHVzX3Rlc3RzIiwKKyAgICBkZWZhdWx0czogWyJsaWJhdWRpb2NsaWVudF90ZXN0c19kZWZhdWx0cyJdLAorICAgIHNyY3M6IFsiYXVkaW9fYWlkbF9zdGF0dXNfdGVzdHMuY3BwIl0sCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmF1ZGlvY2xpZW50X2FpZGxfY29udmVyc2lvbiIsCisgICAgICAgICJsaWJiaW5kZXIiLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICBdLAorfQorCitjY190ZXN0IHsKICAgICBuYW1lOiAidGVzdF9jcmVhdGVfYXVkaW90cmFjayIsCiAgICAgZGVmYXVsdHM6IFsibGliYXVkaW9jbGllbnRfdGVzdHNfZGVmYXVsdHMiXSwKICAgICBzcmNzOiBbInRlc3RfY3JlYXRlX2F1ZGlvdHJhY2suY3BwIiwKQEAgLTE2LDYgKzM3LDcgQEAKICAgICAgICAgImxpYm1lZGlhbWV0cmljc19oZWFkZXJzIiwKICAgICBdLAogICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCiAgICAgICAgICJsaWJhdWRpb2NsaWVudCIsCiAgICAgICAgICJsaWJiaW5kZXIiLAogICAgICAgICAibGliY3V0aWxzIiwKQEAgLTM4LDYgKzYwLDcgQEAKICAgICAgICAgImxpYmJpbmRlciIsCiAgICAgICAgICJsaWJjdXRpbHMiLAogICAgICAgICAibGlidXRpbHMiLAorICAgICAgICAiZnJhbWV3b3JrLXBlcm1pc3Npb24tYWlkbC1jcHAiLAogICAgIF0sCiAgICAgZGF0YTogWyJyZWNvcmRfdGVzdF9pbnB1dF8qLnR4dCJdL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MsIHN0YXR1c1RGcm9tQmluZGVyU3RhdHVzKGJpbmRlclN0YXR1c0Zyb21TdGF0dXNUKHN0YXR1cykpKTsKKyAgICB9Cit9CisKKy8vIFNwZWNpYWwgc3RhdHVzIHZhbHVlcyBhcmUgcHJlc2VydmVkIG9uIHJvdW5kIHRyaXAuCitURVNUKGF1ZGlvX2FpZGxfc3RhdHVzX3Rlc3RzLCBzdGF0dXNSb3VuZFRyaXBTcGVjaWFsVmFsdWVzKSB7CisgICAgZm9yIChzdGF0dXNfdCBzdGF0dXMgOiB7CisgICAgICAgICAgICBPSywKKyAgICAgICAgICAgIFVOS05PV05fRVJST1IsCisgICAgICAgICAgICBOT19NRU1PUlksCisgICAgICAgICAgICBJTlZBTElEX09QRVJBVElPTiwKKyAgICAgICAgICAgIEJBRF9WQUxVRSwKKyAgICAgICAgICAgIEJBRF9UWVBFLAorICAgICAgICAgICAgTkFNRV9OT1RfRk9VTkQsCisgICAgICAgICAgICBQRVJNSVNTSU9OX0RFTklFRCwKKyAgICAgICAgICAgIE5PX0lOSVQsCisgICAgICAgICAgICBBTFJFQURZX0VYSVNUUywKKyAgICAgICAgICAgIERFQURfT0JKRUNULAorICAgICAgICAgICAgRkFJTEVEX1RSQU5TQUNUSU9OLAorICAgICAgICAgICAgQkFEX0lOREVYLAorICAgICAgICAgICAgTk9UX0VOT1VHSF9EQVRBLAorICAgICAgICAgICAgV09VTERfQkxPQ0ssCisgICAgICAgICAgICBUSU1FRF9PVVQsCisgICAgICAgICAgICBVTktOT1dOX1RSQU5TQUNUSU9OLAorICAgICAgICAgICAgRkRTX05PVF9BTExPV0VEfSkgeworICAgICAgICBBU1NFUlRfRVEoc3RhdHVzLCBzdGF0dXNURnJvbUJpbmRlclN0YXR1cyhiaW5kZXJTdGF0dXNGcm9tU3RhdHVzVChzdGF0dXMpKSk7CisgICAgfQorfQorCisvLyBCaW5kZXIgZXhjZXB0aW9ucyBzaG93IGFzIGFuIGVycm9yIChub3QgZml4ZWQgYXQg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9UUkFOU0FDVElPTl9GQUlMRUQsIC0tIHRlc3RlZCBmcm9tU3RhdHVzVCgpLgorICAgICAgICAgICAgfSkgeworICAgICAgICBBU1NFUlRfTkUoT0ssIHN0YXR1c1RGcm9tQmluZGVyU3RhdHVzKFN0YXR1czo6ZnJvbUV4Y2VwdGlvbkNvZGUoZXhjZXB0aW9uQ29kZSkpKTsKKyAgICB9Cit9CisKKy8vIEJpbmRlciB0cmFuc2FjdGlvbiBlcnJvcnMgc2hvdyBleGFjdGx5IGluIHN0YXR1c190OyB0aGVzZSBjb21lIGZyb21TdGF0dXNUKCkuCitURVNUKGF1ZGlvX2FpZGxfc3RhdHVzX3Rlc3RzLCBiaW5kZXJTdGF0dXNUcmFuc2FjdGlvbkVycm9yKSB7CisgICAgZm9yIChzdGF0dXNfdCBzdGF0dXMgOiB7CisgICAgICAgICAgICBPSywgLy8gTm90ZTogZnJvbVN0YXR1c1QgZG9lcyBjaGVjayBpZiB0aGlzIGlzIDAsIHNvIHRoaXMgaXMgbm8gZXJyb3IuCisgICAgICAgICAgICBVTktOT1dOX0VSUk9SLAorICAgICAgICAgICAgTk9fTUVNT1JZLAorICAgICAgICAgICAgSU5WQUxJRF9PUEVSQVRJT04sCisgICAgICAgICAgICBCQURfVkFMVUUsCisgICAgICAgICAgICBCQURfVFlQRSwKKyAgICAgICAgICAgIE5BTUVfTk9UX0ZPVU5ELAorICAgICAgICAgICAgUEVSTUlTU0lPTl9ERU5JRUQsCisgICAgICAgICAgICBOT19JTklULAorICAgICAgICAgICAgQUxSRUFEWV9FWElTVFMsCisgICAgICAgICAgICBERUFEX09CSkVDVCwKKyAgICAgICAgICAgIEZBSUxFRF9UUkFOU0FDVElPTiwKKyAgICAgICAgICAgIEJBRF9JTkRFWCwKKyAgICAgICAgICAgIE5PVF9FTk9VR0hfREFUQSwKKyAgICAgICAgICAgIFdPVUxEX0JMT0NLLAorICAgICAgICAgICAgVElNRURfT1VULAorICAgICAgICAgICAgVU5LTk9XTl9UUk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lucHV0RmlsZSwgaW50IG91dHB1dEZpbGVGZCkKIHsKICAgICBjaGFyIGxpbmVbTUFYX0lOUFVUX0ZJTEVfTElORV9MRU5HVEhdOwogICAgIHVpbnQzMl90IHRlc3RDb3VudCA9IDA7CiAgICAgVmVjdG9yPFN0cmluZzE2PiBhcmdzOwogICAgIGludCByZXQgPSAwOworICAgIC8vIFRPRE8gYi8xODIzOTI3Njk6IHVzZSBhdHRyaWJ1dGlvbiBzb3VyY2UgdXRpbAorICAgIEF0dHJpYnV0aW9uU291cmNlU3RhdGUgYXR0cmlidXRpb25Tb3VyY2U7CisgICAgYXR0cmlidXRpb25Tb3VyY2UucGFja2FnZU5hbWUgPSBzdGQ6OnN0cmluZyhQQUNLQUdFX05BTUUpOworICAgIGF0dHJpYnV0aW9uU291cmNlLnRva2VuID0gc3A8QkJpbmRlcj46Om1ha2UoKTsKIAogICAgIGlmIChpbnB1dEZpbGUgPT0gbnVsbHB0cikgewogICAgICAgICBzcDxBdWRpb1JlY29yZD4gcmVjb3JkID0gbmV3IEF1ZGlvUmVjb3JkKEFVRElPX1NPVVJDRV9ERUZBVUxULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgLyogc2FtcGxlUmF0ZSAqLywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19GT1JNQVRfREVGQVVMVCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19DSEFOTkVMX0lOX01PTk8sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nMTYoUEFDS0FHRV9OQU1FKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRpb25Tb3VyY2UpOwogICAgICAgICBpZiAocmVjb3JkID09IDAgfHwgcmVjb3JkLT5pbml0Q2hlY2soKSAhPSBOT19FUlJPU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UsCisgICAgdGFyZ2V0OiB7CisgICAgICAgIGRhcndpbjogeworICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsCisgICAgICAgIH0sCisgICAgfSwKIH0KIAogY2NfbGlicmFyeSB7CkBAIC0yOSw2ICs1Miw4IEBACiAgICAgXSwKIAogICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJhdWRpb2NsaWVudC10eXBlcy1haWRsLWNwcCIsCisgICAgICAgICJsaWJhdWRpb2NsaWVudF9haWRsX2NvbnZlcnNpb24iLAogICAgICAgICAibGliYXVkaW91dGlscyIsCiAgICAgICAgICJsaWJiYXNlIiwKICAgICAgICAgImxpYmJpbmRlciIsCkBAIC0zNyw2ICs2MiwxMSBAQAogICAgICAgICAibGlidXRpbHMiLAogICAgIF0sCiAKKyAgICBleHBvcnRfc2hhcmVkX2xpYl9oZWFkZXJzOiBbCisgICAgICAgICJhdWRpb2NsaWVudC10eXBlcy1haWRsLWNwcCIsCisgICAgICAgICJsaWJhdWRpb2NsaWVudF9haWRsX2NvbnZlcnNpb24iLAorICAgIF0sCisKICAgICBoZWFkZXJfbGliczogWwogICAgICAgICAibGliYXVkaW9mb3VuZGF0aW9uX2hlYWRlcnMiLAogICAgIF0sCmRpZmYgLS1naXQgYS9tZWRpYS9saWJhdWRpb2ZvdW5kYXRpb24vQXVkaW9EZXZpY2VUeXBlQWRkci5jcHAgYi9tZWRpYS9saWJhdWRpb2ZvdW5kYXRpb24vQXVkaW9EZXZpY2VUeXBlQWRkci5jcHAKaW5kZXggYjQ0MDQzYS4uYzVkN2RhOCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliYXVkaW9mb3VuZGF0aW9uL0F1ZGlvRGV2aWNlVHlwZUFkZHIuY3BwCisrKyBiL21lZGlhL2xpYmF1ZGlvZm91bmRhdGlvbi9BdWRpb0RldmljZVR5cGVBZGRyLmNwcApAQCAtMTUsMTMgKzE1LDU5IEBACiAgKi8KIAogI2luY2x1ZGUgPG1lZGlhL0F1ZGlv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RlcyksCisgICAgICAgICAgICAgICAgcG9ydC5hdWRpb19wcm9maWxlc1tpXS5lbmNhcHN1bGF0aW9uX3R5cGUpOworICAgICAgICBpZiAoIW1Qcm9maWxlcy5jb250YWlucyhwcm9maWxlKSkgeworICAgICAgICAgICAgYWRkQXVkaW9Qcm9maWxlKHByb2ZpbGUpOworICAgICAgICB9CisgICAgfQorCisgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBwb3J0Lm51bV9leHRyYV9hdWRpb19kZXNjcmlwdG9yczsgKytpKSB7CisgICAgICAgIGF1dG8gY29udmVydGVkUmVzdWx0ID0gbGVnYWN5MmFpZGxfYXVkaW9fZXh0cmFfYXVkaW9fZGVzY3JpcHRvcl9FeHRyYUF1ZGlvRGVzY3JpcHRvcigKKyAgICAgICAgICAgICAgICBwb3J0LmV4dHJhX2F1ZGlvX2Rlc2NyaXB0b3JzW2ldKTsKKyAgICAgICAgaWYgKCFjb252ZXJ0ZWRSZXN1bHQub2soKSkgeworICAgICAgICAgICAgQUxPR0UoIiVzLCBmYWlsZWQgdG8gY29udmVydCBleHRyYSBhdWRpbyBkZXNjcmlwdG9yIiwgX19mdW5jX18pOworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHN0ZDo6ZmluZChtRXh0cmFBdWRpb0Rlc2NyaXB0b3JzLmJlZ2luKCksCisgICAgICAgICAgICAgICAgICAgICAgbUV4dHJhQXVkaW9EZXNjcmlwdG9ycy5lbmQoKSwKKyAgICAgICAgICAgICAgICAgICAgICBjb252ZXJ0ZWRSZXN1bHQudmFsdWUoKSkgPT0gbUV4dHJhQXVkaW9EZXNjcmlwdG9ycy5lbmQoKSkgeworICAgICAgICAgICAgbUV4dHJhQXVkaW9EZXNjcmlwdG9ycy5wdXNoX2JhY2soc3RkOjptb3ZlKGNvbnZlcnRlZFJlc3VsdC52YWx1ZSgpKSk7CisgICAgICAgIH0KKyAgICB9Cit9CisKIHZvaWQgQXVkaW9Qb3J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AgICAgICAgIHBvcnQtPm51bV9hdWRpb19wcm9maWxlcyA+PSBBVURJT19QT1JUX01BWF9BVURJT19QUk9GSUxFUykgeworICAgICAgICAgICAgICAgIEFMT0dFKCIlczogYmFpbGluZyBvdXQ6IGNhbm5vdCBleHBvcnQgcHJvZmlsZXMgdG8gcG9ydCBjb25maWciLCBfX2Z1bmNfXyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGF1dG8mIGRzdFByb2ZpbGUgPSBwb3J0LT5hdWRpb19wcm9maWxlc1twb3J0LT5udW1fYXVkaW9fcHJvZmlsZXMrK107CisgICAgICAgICAgICBkc3RQcm9maWxlLmZvcm1hdCA9IHByb2ZpbGUtPmdldEZvcm1hdCgpOworICAgICAgICAgICAgZHN0UHJvZmlsZS5udW1fc2FtcGxlX3JhdGVzID0gc2FtcGxlUmF0ZXMuc2l6ZSgpOworICAgICAgICAgICAgc3RkOjpjb3B5KHNhbXBsZVJhdGVzLmJlZ2luKCksIHNhbXBsZVJhdGVzLmVuZCgpLAorICAgICAgICAgICAgICAgICAgICBzdGQ6OmJlZ2luKGRzdFByb2ZpbGUuc2FtcGxlX3JhdGVzKSk7CisgICAgICAgICAgICBkc3RQcm9maWxlLm51bV9jaGFubmVsX21hc2tzID0gY2hhbm5lbE1hc2tzLnNpemUoKTsKKyAgICAgICAgICAgIHN0ZDo6Y29weShjaGFubmVsTWFza3MuYmVnaW4oKSwgY2hhbm5lbE1hc2tzLmVuZCgpLAorICAgICAgICAgICAgICAgICAgICBzdGQ6OmJlZ2luKGRzdFByb2ZpbGUuY2hhbm5lbF9tYXNrcykpOworICAgICAgICAgICAgZHN0UHJvZmlsZS5lbmNhcHN1bGF0aW9uX3R5cGUgPSBwcm9maWxlLT5nZXRFbmNhcHN1bGF0aW9uVHlwZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcG9ydC0+bnVtX2V4dHJhX2F1ZGlvX2Rlc2NyaXB0b3JzID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dWRpb01pY3JvcGhvbmVEaXJlY3Rpb25hbGl0eTo6VU5LTk9XTjoKLSAgICAgICAgICAgIHJldHVybiBBVURJT19NSUNST1BIT05FX0RJUkVDVElPTkFMSVRZX1VOS05PV047Ci0gICAgICAgIGNhc2UgQXVkaW9NaWNyb3Bob25lRGlyZWN0aW9uYWxpdHk6Ok9NTkk6Ci0gICAgICAgICAgICByZXR1cm4gQVVESU9fTUlDUk9QSE9ORV9ESVJFQ1RJT05BTElUWV9PTU5JOwotICAgICAgICBjYXNlIEF1ZGlvTWljcm9waG9uZURpcmVjdGlvbmFsaXR5OjpCSV9ESVJFQ1RJT05BTDoKLSAgICAgICAgICAgIHJldHVybiBBVURJT19NSUNST1BIT05FX0RJUkVDVElPTkFMSVRZX0JJX0RJUkVDVElPTkFMOwotICAgICAgICBjYXNlIEF1ZGlvTWljcm9waG9uZURpcmVjdGlvbmFsaXR5OjpDQVJESU9JRDoKLSAgICAgICAgICAgIHJldHVybiBBVURJT19NSUNST1BIT05FX0RJUkVDVElPTkFMSVRZX0NBUkRJT0lEOwotICAgICAgICBjYXNlIEF1ZGlvTWljcm9waG9uZURpcmVjdGlvbmFsaXR5OjpIWVBFUl9DQVJESU9JRDoKLSAgICAgICAgICAgIHJldHVybiBBVURJT19NSUNST1BIT05FX0RJUkVDVElPTkFMSVRZX0hZUEVSX0NBUkRJT0lEOwotICAgICAgICBjYXNlIEF1ZGlvTWljcm9waG9uZURpcmVjdGlvbmFsaXR5OjpTVVBFUl9DQVJESU9JRDoKLSAgICAgICAgICAgIHJldHVybiBBVURJT19NSUNST1BIT05FX0RJUkVDVElPTkFMSVRZX1NVUEVSX0NBUkRJT0lEOwotICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgTE9HX0FMV0FZU19GQVRBTCgiVW5rbm93biBkaXJlY3Rpb25hbGl0eVRvSGFsIGNvbnZlcnNpb24gJWQiLCBkaXIpOwotICAgIH0KLX0KLQotdm9pZCBtaWNyb3Bob25lSW5mb1RvSG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ZmZlci4gV2FpdCBmb3IgYSBub24tZW1wdHkgd3JpdGUgcmVxdWVzdC4KLSAgICAgICAgQUxPR1dfSUYobUNhbGxiYWNrLnVuc2FmZV9nZXQoKSwgIkZpcnN0IGNhbGwgdG8gYXN5bmMgd3JpdGUgd2l0aCAwIGJ5dGVzIik7CisgICAgICAgIEFMT0dXX0lGKG1DYWxsYmFjay5sb2FkKCkudW5zYWZlX2dldCgpLCAiRmlyc3QgY2FsbCB0byBhc3luYyB3cml0ZSB3aXRoIDAgYnl0ZXMiKTsKICAgICAgICAgcmV0dXJuIE9LOwogICAgIH0KIApAQCAtNDUzLDcgKzQ4Nyw3IEBACiAgICAgICAgICAgICAgICAgICAgIGNvbnN0IENvbW1hbmRNUTo6RGVzY3JpcHRvciYgY29tbWFuZE1RLAogICAgICAgICAgICAgICAgICAgICBjb25zdCBEYXRhTVE6OkRlc2NyaXB0b3ImIGRhdGFNUSwKICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RhdHVzTVE6OkRlc2NyaXB0b3ImIHN0YXR1c01RLAotICAgICAgICAgICAgICAgICAgICBjb25zdCBUaHJlYWRJbmZvJiBoYWxUaHJlYWRJbmZvKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1dG8mIGhhbFRocmVhZEluZm8pIHsKICAgICAgICAgICAgICAgICByZXR2YWwgPSByOwogICAgICAgICAgICAgICAgIGlmIChyZXR2YWwgPT0gUmVzdWx0OjpPSykgewogICAgICAgICAgICAgICAgICAgICB0ZW1wQ29tbWFuZE1RLnJlc2V0KG5ldyBDb21tYW5kTVEoY29tbWFuZE1RKSk7CkBAIC00NjIsOCArNDk2LDEyIEBACiAgICAgICAgICAgICAgICAgICAgIGlmICh0ZW1wRGF0YU1RLT5pc1ZhbGlkKCkgJiYgdGVtcERhdGFNUS0+Z2V0RXZlbnRGbGFnV29yZCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBFdmVudEZsYWc6OmNyZWF0ZUV2ZW50RmxhZyh0ZW1wRGF0YU1RLT5nZXRFdmVudEZsYWdXb3JkKCksICZtRWZHcm91cCk7CiAgICAgICAgICAgICAgICAgICAgIH0KKyNpZiBNQUpPUl9WRVJTSU9OIDw9IDYKICAgICAgICAgICAgICAgICAgICAgaGFsVGhyZWFkUGlkID0gaGFsVGhyZWFkSW5mby5waWQ7CiAgICAgICAgICAgICAgICAgICAgIGhhbFRocmVhZFRpZCA9IGhhbFRocmVhZEluZm8udGlkOworI2Vsc2UKKyAgICAgICAgICAgICAgICAgICAgaGFsVGhyZWFkVGlkID0gaGFsVGhyZWFkSW5mbzsKKyNlbmRpZgogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0pOwogICAgIGlmICghcmV0LmlzT2soKSB8fCByZXR2YWwgIT0gUmVzdWx0OjpPSykgewpAQCAtNDg0LDYgKzUyMiwxMSBAQAogICAgICAgICBBTE9HRV9JRighbUVmR3JvdXAsICJFdmVudCBmbGFnIGNyZWF0aW9uIGZvciB3cml0aW5nIGZhaWxlZCIpOwogICAgICAgICByZXR1cm4gTk9fSU5JVDsKICAgICB9CisjaWYgTUFKT1JfVkVSU0lPTiA+PSA3CisgICAgaWYgKHN0YXR1c190IHN0YXR1cyA9IGdldEhhbFBpZCgmaGFsVGhyZWFkUGlkKTsgc3RhdHVzICE9IE5PX0VSUk9SKSB7CisgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgfQorI2VuZGlmCiAgICAgcmVxdWVzdEhhbFRocmVhZFByaW9yaXR5KGhhbFRocmVhZFBpZCwgaGFsVGhyZWFkVGlkKTsKIAogICAgIG1Db21tYW5kTVEgPSBzdGQ6Om1vdmUodGVtcENvbW1hbmRNUSk7CkBAIC01OTcsMzEgKzY0MCw0NSBAQAogICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKIH0KICNlbGlmIE1BSk9SX1ZFUlNJT04gPj0gNAotLyoqIFRyYW5zZm9ybSBhIHN0YW5kYXJkIGNvbGxlY3Rpb24gdG8gYW4gS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dWRpb0Rlc2NyaXB0aW9uTWl4TGV2ZWwoCisgICAgICAgICAgICBbJl0oUmVzdWx0IHIsIGZsb2F0IGhpZGxMZXZlbGRCKSB7CisgICAgICAgICAgICAgICAgcmV0dmFsID0gcjsKKyAgICAgICAgICAgICAgICBpZiAocmV0dmFsID09IFJlc3VsdDo6T0spIHsKKyAgICAgICAgICAgICAgICAgICAgKmxldmVsZEIgPSBoaWRsTGV2ZWxkQjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICByZXR1cm4gcHJvY2Vzc1JldHVybigiZ2V0QXVkaW9EZXNjcmlwdGlvbk1peExldmVsIiwgcmV0LCByZXR2YWwpOworfQorCitzdGF0dXNfdCBTdHJlYW1PdXRIYWxIaWRsOjpzZXRBdWRpb0Rlc2NyaXB0aW9uTWl4TGV2ZWwoZmxvYXQgbGV2ZWxkQikgeworICAgIGlmIChtU3RyZWFtID09IDApIHJldHVybiBOT19JTklUOworICAgIHJldHVybiBwcm9jZXNzUmV0dXJuKAorICAgICAgICAgICAgInNldEF1ZGlvRGVzY3JpcHRpb25NaXhMZXZlbCIsIG1TdHJlYW0tPnNldEF1ZGlvRGVzY3JpcHRpb25NaXhMZXZlbChsZXZlbGRCKSk7Cit9CisKK3N0YXR1c190IFN0cmVhbU91dEhhbEhpZGw6OmdldFBsYXliYWNrUmF0ZVBhcmFtZXRlcnMoYXVkaW9fcGxheWJhY2tfcmF0ZV90KiBwbGF5YmFja1JhdGUpIHsKKyAgICBpZiAobVN0cmVhbSA9PSAwKSByZXR1cm4gTk9fSU5JVDsKKyAgICBSZXN1bHQgcmV0dmFsOworICAgIFJldHVybjx2b2lkPiByZXQgPSBtU3RyZWFtLT5nZXRQbGF5YmFja1JhdGVQYXJhbWV0ZXJzKAorICAgICAgICAgICAgWyZdKFJlc3VsdCByLCBQbGF5YmFja1JhdGUgaGlkbFBsYXliYWNrUmF0ZSkgeworICAgICAgICAgICAgICAgIHJldHZhbCA9IHI7CisgICAgICAgICAgICAgICAgaWYgKHJldHZhbCA9PSBSZXN1bHQ6Ok9LKSB7CisgICAgICAgICAgICAgICAgICAgIHBsYXliYWNrUmF0ZS0+bVNwZWVkID0gaGlkbFBsYXliYWNrUmF0ZS5zcGVlZDsKKyAgICAgICAgICAgICAgICAgICAgcGxheWJhY2tSYXRlLT5tUGl0Y2ggPSBoaWRsUGxheWJhY2tSYXRlLnBpdGNoOworICAgICAgICAgICAgICAgICAgICBwbGF5YmFja1JhdGUtPm1TdHJldGNoTW9kZSA9CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxhdWRpb190aW1lc3RyZXRjaF9zdHJldGNoX21vZGVfdD4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGlkbFBsYXliYWNrUmF0ZS50aW1lc3RyZXRjaE1vZGUpOworICAgICAgICAgICAgICAgICAgICBwbGF5YmFja1JhdGUtPm1GYWxsYmFja01vZGUgPQorICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8YXVkaW9fdGltZXN0cmV0Y2hfZmFsbGJhY2tfbW9kZV90PigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaWRsUGxheWJhY2tSYXRlLmZhbGxiYWNrTW9kZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgICAgcmV0dXJuIHByb2Nlc3NSZXR1cm4oImdldFBsYXliYWNrUmF0ZVBhcmFtZXRlcnMiLCByZXQsIHJldHZhbCk7Cit9CisKK3N0YXR1c190IFN0cmVhbU91dEhhbEhpZGw6OnNldFBsYXliYWNrUmF0ZVBhcmFtZXRlcnMoY29uc3QgYXVkaW9fcGxheWJhY2tfcmF0ZV90JiBwbGF5YmFja1JhdGUpIHsKKyAgICBpZiAobVN0cmVhbSA9PSAwKSByZXR1cm4gTk9fSU5JVDsKKyAgICByZXR1cm4gcHJvY2Vzc1JldHVybigKKyAgICAgICAgICAgICJzZXRQbGF5YmFja1JhdGVQYXJhbWV0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bE1hc2tzKG5hbWUsIHRyYWNrQ2hhbm5lbE1hc2ssCi0gICAgICAgICAgICAgICAgICAgICh0cmFjay0+bU1peGVyQ2hhbm5lbE1hc2sgfCB0cmFjay0+bU1peGVySGFwdGljQ2hhbm5lbE1hc2spKSkgeworICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxhdWRpb19jaGFubmVsX21hc2tfdD4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2stPm1NaXhlckNoYW5uZWxNYXNrIHwgdHJhY2stPm1NaXhlckhhcHRpY0NoYW5uZWxNYXNrKSkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigic2V0UGFyYW1ldGVyKFRSQUNLLCBDSEFOTkVMX01BU0ssICV4KSIsIHRyYWNrQ2hhbm5lbE1hc2spOwogICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKICAgICAgICAgICAgIH0KQEAgLTQwNyw3ICs0MTIsOCBAQAogICAgICAgICBjYXNlIE1JWEVSX0NIQU5ORUxfTUFTSzogewogICAgICAgICAgICAgY29uc3QgYXVkaW9fY2hhbm5lbF9tYXNrX3QgbWl4ZXJDaGFubmVsTWFzayA9CiAgICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PGF1ZGlvX2NoYW5uZWxfbWFza190Pih2YWx1ZUludCk7Ci0gICAgICAgICAgICBpZiAoc2V0Q2hhbm5lbE1hc2tzKG5hbWUsIHRyYWNrLT5jaGFubmVsTWFzayB8IHRyYWNrLT5tSGFwdGljQ2hhbm5lbE1hc2ssCisgICAgICAgICAgICBpZiAoc2V0Q2hhbm5lbE1hc2tzKG5hbWUsIHN0YXRpY19jYXN0PGF1ZGlvX2NoYW5uZWxfbWFza190PigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrLT5jaGFubmVsTWFzayB8IHRyYWNrLT5tSGFwdGljQ2hhbm5lbE1hc2spLAogICAgICAgICAgICAgICAgICAgICBtaXhlckNoYW5uZWxNY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gdC0+Y2hhbm5lbENvdW50ICsgdC0+bUhhcHRpY0NoYW5uZWxDb3VudDsKQEAgLTU5MCwxOSArNTk3LDEyIEBACiAgICAgICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8VHJhY2s+ICZ0ID0gZ2V0VHJhY2sobmFtZSk7CiAgICAgICAgICAgICBpZiAodC0+bUhhcHRpY1BsYXliYWNrRW5hYmxlZCkgewogICAgICAgICAgICAgICAgIHNpemVfdCBzYW1wbGVDb3VudCA9IG1GcmFtZUNvdW50ICogdC0+bU1peGVySGFwdGljQ2hhbm5lbENvdW50OwotICAgICAgICAgICAgICAgIGZsb2F0IGdhbW1hID0gdC0+Z2V0SGFwdGljU2NhbGVHYW1tYSgpOwotICAgICAgICAgICAgICAgIGZsb2F0IG1heEFtcGxpdHVkZVJhdGlvID0gdC0+Z2V0SGFwdGljTWF4QW1wbGl0dWRlUmF0aW8oKTsKICAgICAgICAgICAgICAgICB1aW50OF90KiBidWZmZXIgPSAodWludDhfdCopcGFpci5maXJzdCArIG1GcmFtZUNvdW50ICogYXVkaW9fYnl0ZXNfcGVyX2ZyYW1lKAogICAgICAgICAgICAgICAgICAgICAgICAgdC0+bU1peGVyQ2hhbm5lbENvdW50LCB0LT5tTWl4ZXJGb3JtYXQpOwogICAgICAgICAgICAgICAgIHN3aXRjaCAodC0+bU1peGVyRm9ybWF0KSB7CiAgICAgICAgICAgICAgICAgLy8gTWl4ZXIgZm9ybWF0IHNob3VsZCBiZSBBVURJT19GT1JNQVRfUENNX0ZMT0FULgogICAgICAgICAgICAgICAgIGNhc2UgQVVESU9fRk9STUFUX1BDTV9GTE9BVDogewotICAgICAgICAgICAgICAgICAgICBmbG9hdCogZm91dCA9IChmbG9hdCopIGJ1ZmZlcjsKLSAgICAgICAgICAgICAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBzYW1wbGVDb3VudDsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBtdWwg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OwotICAgICAgICAgICAgICAgICAgcERzdCArPSAyOwotICAgICAgICAgICAgICAgICAgbnVtRnJhbWVzLS07Ci0gICAgICAgICAgICAgIH0KLSAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICB3aGlsZSAobnVtRnJhbWVzKSB7Ci0gICAgICAgICAgICAgICAgICBwRHN0WzBdID0gcFNyY1swXTsKLSAgICAgICAgICAgICAgICAgIHBEc3RbMV0gPSBwU3JjWzFdOwotICAgICAgICAgICAgICAgICAgcFNyYyArPSBwRG93bm1peGVyLT5pbnB1dF9jaGFubmVsX2NvdW50OwotICAgICAgICAgICAgICAgICAgcERzdCArPSAyOwotICAgICAgICAgICAgICAgICAgbnVtRnJhbWVzLS07Ci0gICAgICAgICAgICAgIH0KLSAgICAgICAgICB9Ci0gICAgICAgICAgYnJlYWs7Ci0KLSAgICAgIGNhc2UgRE9XTk1JWF9UWVBFX0ZPTEQ6Ci0jaWZkZWYgRE9XTk1JWF9BTFdBWVNfVVNFX0dFTkVSSUNfRE9XTk1JWEVSCi0gICAgICAgICAgLy8gYnlwYXNzIHRoZSBvcHRpbWl6ZWQgZG93bm1peCByb3V0aW5lcyBmb3IgdGhlIGNvbW1vbiBmb3JtYXRzCi0gICAgICAgICAgaWYgKCFEb3dubWl4X2ZvbGRHZW5lcmljKAotICAgICAgICAgICAgICAgICAgZG93bm1peElucHV0Q2hhbm5lbE1hc2ssIHBTcmMsIHBEc3QsIG51bUZyYW1lcywgYWNjdW11bGF0ZSkpIHsKLSAgICAgICAgICAgICAgQUxPR0UoIk11bHRpY2hhbm5lbCBjb25maWd1cmF0aW9uIDB4JSIgUFJJeDMyICIgaXMgbm90IHN1cHBvcnRlZCIsIGRvd25taXhJbnB1dENoYW5uZWxNYXNrKTsKLSAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7Ci0gICAgICAgICAgfQotICAgICAgICAgIGJyZWFrOwotI2VuZGlmCi0gICAgICAgIC8vIG9wdGltaXplIGZvciB0aGUgY29tbW9uIGZvcm1hdHMKLSAgICAgICAgc3dpdGNoKChkb3dubWl4X2lucHV0X2NoYW5uZWxfbWFza190KWRvd25taXhJbnB1dENoYW5uZWxNYXNrKSB7Ci0gICAgICAgIGNhc2UgQ0hBTk5FTF9NQVNLX1FVQURfQkFDSzoKLSAgICAgICAgY2FzZSBDSEFOTkVMX01BU0tfUVVBRF9TSURFOgotICAgICAgICAgICAgRG93bm1peF9mb2xkRnJvbVF1YWQocFNyYywgcERzdCwgbnVtRnJhbWVzLCBhY2N1bXVsYXRlKTsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIENIQU5ORUxfTUFTS181UE9JTlQxX0JBQ0s6Ci0gICAgICAgIGNhc2UgQ0hBTk5FTF9NQVNLXzVQT0lOVDFfU0lERToKLSAgICAgICAgICAgIERvd25taXhfZm9sZEZyb201UG9pbnQxKHBTcmMsIHBEc3QsIG51bUZyYW1lcywgYWNjdW11bGF0ZSk7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSBDSEFOTkVMX01BU0tfN1BPSU5UMToKLSAgICAgICAgICAgIERvd25taXhfZm9sZEZyb203UG9pbnQxKHBTcmMsIHBEc3QsIG51bUZyYW1lcywgYWNjdW11bGF0ZSk7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgIGlmICghRG93bm1peF9mb2xkR2VuZXJpYygKLSAgICAgICAgICAgICAgICAgICAgZG93bm1peElucHV0Q2hhbm5lbE1hc2ssIHBTcmMsIHBEc3QsIG51bUZyYW1lcywgYWNjdW11bGF0ZSkpIHsKLSAgICAgICAgICAgICAgICBBTE9HRSgiTXVsdGljaGFubmVsIGNvbmZpZ3VyYXRpb24gMHglIiBQUkl4MzIgIiBpcyBub3Qgc3VwcG9ydGVkIiwgZG93bm1peElucHV0Q2hhbm5lbE1hc2spOwotICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwotICAgICAgICAgICAgfQotIC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ICAgICAgQUxPR0UoIkRvd25taXhfUHJvY2VzcyBlcnJvcjogdHJ5aW5nIHRvIHVzZSBhbiB1bmluaXRpYWxpemVkIGRvd25taXhlciIpOwotICAgICAgICByZXR1cm4gLUVJTlZBTDsKLSAgICB9IGVsc2UgaWYgKHBEb3dubWl4ZXItPnN0YXRlID09IERPV05NSVhfU1RBVEVfSU5JVElBTElaRUQpIHsKLSAgICAgICAgQUxPR0UoIkRvd25taXhfUHJvY2VzcyBlcnJvcjogdHJ5aW5nIHRvIHVzZSBhIG5vbi1jb25maWd1cmVkIGRvd25taXhlciIpOwotICAgICAgICByZXR1cm4gLUVOT0RBVEE7Ci0gICAgfQotCi0gICAgcFNyYyA9IChMVk1fRkxPQVQgKikgaW5CdWZmZXItPnMxNjsKLSAgICBwRHN0ID0gKExWTV9GTE9BVCAqKSBvdXRCdWZmZXItPnMxNjsKLSAgICBzaXplX3QgbnVtRnJhbWVzID0gb3V0QnVmZmVyLT5mcmFtZUNvdW50OwotCi0gICAgY29uc3QgYm9vbCBhY2N1bXVsYXRlID0KLSAgICAgICAgICAgIChwRHdtTW9kdWxlLT5jb25maWcub3V0cHV0Q2ZnLmFjY2Vzc01vZGUgPT0gRUZGRUNUX0JVRkZFUl9BQ0NFU1NfQUNDVU1VTEFURSk7Ci0gICAgY29uc3QgdWludDMyX3QgZG93bm1peElucHV0Q2hhbm5lbE1hc2sgPSBwRHdtTW9kdWxlLT5jb25maWcuaW5wdXRDZmcuY2hhbm5lbHM7Ci0KLSAgICBzd2l0Y2gocERvd25taXhlci0+dHlwZSkgewotCi0gICAgICBjYXNlIERPV05NSVhfVFlQRV9TVFJJUDoKLSAgICAgICAgICBpZiAoYWNjdW11bGF0ZSkgewotICAgICAgICAgICAgICB3aGlsZSAobnVtRnJhbWVzKSB7Ci0gICAgICAgICAgICAgICAgICBwRHN0WzBdID0gY2xhbXBfZmxvYXQocERzdFswXSArIHBTcmNbMF0pOwotICAgICAgICAgICAgICAgICAgcERzdFsxXSA9IGNsYW1wX2Zsb2F0KHBEc3RbMV0gKyBwU3JjWzFdKTsKLSAgICAgICAgICAgICAgICAgIHBTcmMgKz0gcERvd25taXhlci0+aW5wdXRfY2hhbm5lbF9jb3VudDsKLSAgICAgICAgICAgICAgICAgIHBEc3QgKz0gMjsKLSAgICAgICAgICAgICAgICAgIG51bUZyYW1lcy0tOwotICAgICAgICAgICAgICB9Ci0gICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgd2hpbGUgKG51bUZyYW1lcykgewotICAgICAgICAgICAgICAgICAgcERzdFswXSA9IHBTcmNbMF07Ci0gICAgICAgICAgICAgICAgICBwRHN0WzFdID0gcFNyY1sxXTsKLSAgICAgICAgICAgICAgICAgIHBTcmMgKz0gcERvd25taXhlci0+aW5wdXRfY2hhbm5lbF9jb3VudDsKLSAgICAgICAgICAgICAgICAgIHBEc3QgKz0gMjsKLSAgICAgICAgICAgICAgICAgIG51bUZyYW1lcy0tOwotICAgICAgICAgICAgICB9Ci0gICAgICAgICAgfQotICAgICAgICAgIGJyZWFrOwotCi0gICAgICBjYXNlIERPV05NSVhfVFlQRV9GT0xEOgotI2lmZGVmIERPV05NSVhfQUxXQVlTX1VTRV9HRU5FUklDX0RPV05NSVhFUgotICAgICAgICAgIC8vIGJ5cGFzcyB0aGUgb3B0aW1pemVkIGRvd25taXggcm91dGluZXMgZm9yIHRoZSBjb21tb24gZm9ybWF0cwotICAgICAgICAgIGlmICghRG93bm1peF9mb2xkR2VuZXJpYygKLSAgICAgICAgICAgICAgICAgIGRvd25taXhJbnB1dENoYW5uZWxNYXNrLCBwU3JjLCBwRHN0LCBudW1GcmFtZXMsIGFjY3VtdWxhdGUpKSB7Ci0gICAgICAgICAgICAgIEFMT0dFKCJNdWx0aWNoYW5uZWwgY29uZmlndXJhdGlvbiAweCUiIFBSSXgzMiAiIGlzIG5vdCBzdXBwb3J0ZWQiLAotICAgICAgICAgICAgICAgICAgICBkb3dubWl4SW5wdXRDaGFubmVsTWFzayk7Ci0gICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwotICAgICAgICAgIH0KLSAgICAgICAgICBicmVhazsKLSNlbmRpZgotICAgICAgICAvLyBvcHRpbWl6ZSBmb3IgdGhlIGNvbW1vbiBmb3JtYXRzCi0gICAgICAgIHN3aXRjaCgoZG93bm1peF9pbnB1dF9jaGFubmVsX21hc2tfdClkb3dubWl4SW5wdXRDaGFubmVsTWFzaykgewotICAgICAgICBjYXNlIENIQU5ORUxfTUFTS19RVUFEX0JBQ0s6Ci0gICAgICAgIGNhc2UgQ0hBTk5FTF9NQVNLX1FVQURfU0lERToKLSAgICAgICAgICAgIERvd25taXhfZm9sZEZyb21RdWFkKHBTcmMsIHBEc3QsIG51bUZyYW1lcywgYWNjdW11bGF0ZSk7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSBDSEFOTkVMX01BU0tfNVBPSU5UMV9CQUNLOgotICAgICAgICBjYXNlIENIQU5ORUxfTUFTS181UE9JTlQxX1NJREU6Ci0gICAgICAgICAgICBEb3dubWl4X2ZvbGRGcm9tNVBvaW50MShwU3JjLCBwRHN0LCBudW1GcmFtZXMsIGFjY3VtdWxhdGUpOwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgQ0hBTk5FTF9NQVNLXzdQT0lOVDE6Ci0gICAgICAgICAgICBEb3dubWl4X2ZvbGRGcm9tN1BvaW50MShwU3JjLCBwRHN0LCBudW1GcmFtZXMsIGFjY3VtdWxhdGUpOwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICBpZiAoIURvd25taXhfZm9sZEdlbmVyaWMoCi0gICAgICAgICAgICAgICAgICAgIGRvd25taXhJbnB1dENoYW5uZWxNYXNrLCBwU3JjLCBwRHN0LCBudW1GcmFtZXMsIGFjY3VtdWxhdGUpKSB7Ci0gICAgICAgICAgICAgICAgQUxPR0UoIk11bHRpY2hhbm5lbCBjb25maWd1cmF0aW9uIDB4JSIgUFJJeDMyICIgaXMgbm90IHN1cHBvcnRlZCIsCi0gICAgICAgICAgICAgICAgICAgICAgZG93bm1peElucHV0Q2hhbm5lbE1hc2spOwotICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLSAgICAgICAgYnJlYWs7Ci0KLSAgICAgIGRlZmF1bHQ6Ci0gICAgICAgIHJldHVybiAtRUlOVkFMOwotICAgIH0KLQotICAgIHJldHVybiAwOwotfQotI2VuZGlmCi0KLXN0YXRpYyBpbnQgRG93bm1peF9Db21tYW5kKGVmZmVjdF9oYW5kbGVfdCBzZWxmLCB1aW50MzJfdCBjbWRDb2RlLCB1aW50MzJfdCBjbWRTaXplLAotICAgICAgICB2b2lkICpwQ21kRGF0YSwgdWludDMyX3QgKnJlcGx5U2l6ZSwgdm9pZCAqcFJlcGx5RGF0YSkgewotCi0gICAgZG93bm1peF9tb2R1bGVfdCAqcER3bU1vZHVsZSA9IChkb3dubWl4X21vZHVsZV90ICopIHNlbGY7Ci0gICAgZG93bm1peF9vYmplY3RfdCAqcERvd25taXhlcjsKLQotICAgIGlmIChwRHdtTW9kdWxlID09IE5VTEwgfHwgcER3bU1vZHVsZS0+Y29udGV4dC5zdGF0ZSA9PSBET1dOTUlYX1NUQVRFX1VOSU5JVElBTElaRUQpIHsKLSAgICAgICAgcmV0dXJuIC1FSU5WQUw7Ci0gICAgfQotCi0gICAgcERvd25taXhlciA9IChkb3dubWl4X29iamVjdF90KikgJnBEd21Nb2R1bGUtPmNvbnRleHQ7Ci0KLSAgICBBTE9HVigiRG93bm1peF9Db21tYW5kIGNvbW1hbmQgJSIgUFJJdTMyICIgY21kU2l6ZSAlIiBQUkl1MzIsIGNtZENvZGUsIGNtZFNpemUpOwotCi0gICAgc3dpdGNoIChjbWRDb2RlKSB7Ci0gICAgY2FzZSBFRkZFQ1RfQ01EX0lOSVQ6Ci0gICAgICAgIGlmIChwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSkgewotICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7Ci0gICAgICAgIH0KLSAgICAgICAgKihpbnQgKikgcFJlcGx5RGF0YSA9IERvd25taXhfSW5pdChwRHdtTW9kdWxlKTsKLSAgICAgICAgYnJlYWs7Ci0KLSAgICBjYXNlIEVGRkVDVF9DTURfU0VUX0NPTkZJRzoKLSAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwgY21kU2l6ZSAhPSBzaXplb2YoZWZmZWN0X2NvbmZpZ190KQotICAgICAgICAgICAgICAgIHx8IHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQpKSB7Ci0gICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKLSAgICAgICAgfQotICAgICAgICAqKGludCAqKSBwUmVwbHlEYXRhID0gRG93bm1peF9Db25maWd1cmUocER3bU1vZHVsZSwKLSAgICAgICAgICAgICAgICAoZWZmZWN0X2NvbmZpZ190ICopcENtZERhdGEsIGZhbHNlKTsKLSAgICAgICAgYnJlYWs7Ci0KLSAgICBjYXNlIEVGRkVDVF9DTURfUkVTRVQ6Ci0gICAgICAgIERvd25taXhfUmVzZXQocERvd25taXhlciwgZmFsc2UpOwotICAgICAgICBicmVhazsKLQotICAgIGNhc2UgRUZGRUNUX0NNRF9HRVRfUEFSQU06Ci0gICAgICAgIEFMT0dWKCJEb3dubWl4X0NvbW1hbmQgRUZGRUNUX0NNRF9HRVRfUEFSQU0gcENtZERhdGEgJXAsICpyZXBseVNpemUgJSIgUFJJdTMyICIsIHBSZXBseURhdGE6ICVwIiwKLSAgICAgICAgICAgICAgICBwQ21kRGF0YSwgKnJlcGx5U2l6ZSwgcFJlcGx5RGF0YSk7Ci0gICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMIHx8IGNtZFNpemUgPCAoaW50KShzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgc2l6ZW9mKGludDMyX3QpKSB8fAotICAgICAgICAgICAgICAgIHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fAotICAgICAgICAgICAgICAgICpyZXBseVNpemUgPCAoaW50KSBzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgMiAqIHNpemVvZihpbnQzMl90KSkgewotICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7Ci0gICAgICAgIH0KLSAgICAgICAgZWZmZWN0X3BhcmFtX3QgKnJlcCA9IChlZmZlY3RfcGFyYW1fdCAqKSBwUmVwbHlEYXRhOwotICAgICAgICBtZW1jcHkocFJlcGx5RGF0YSwgcENtZERhdGEsIHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBzaXplb2YoaW50MzJfdCkpOwotICAgICAgICBBTE9HVigiRG93bm1peF9Db21tYW5kIEVGRkVDVF9DTURfR0VUX1BBUkFNIHBhcmFtICUiIFBSSWQzMiAiLCByZXBseVNpemUgJSIgUFJJdTMyLAotICAgICAgICAgICAgICAgICooaW50MzJfdCAqKXJlcC0+ZGF0YSwgcmVwLT52c2l6ZSk7Ci0gICAgICAgIHJlcC0+c3RhdHVzID0gRG93bm1peF9nZXRQYXJhbWV0ZXIocERvd25taXhlciwgKihpbnQzMl90ICopcmVwLT5kYXRhLCAmcmVwLT52c2l6ZSwKLSAgICAgICAgICAgICAgICByZXAtPmRhdGEgKyBzaXplb2YoaW50MzJfdCkpOwotICAgICAgICAqcmVwbHlTaXplID0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHNpemVvZihpbnQzMl90KSArIHJlcC0+dnNpemU7Ci0gICAgICAgIGJyZWFrOwotCi0gICAgY2FzZSBFRkZFQ1RfQ01EX1NFVF9QQVJBTToKLSAgICAgICAgQUxPR1YoIkRvd25taXhfQ29tbWFuZ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93bm1peGVyLT5zdGF0ZSAhPSBET1dOTUlYX1NUQVRFX0FDVElWRSkgewotICAgICAgICAgICAgcmV0dXJuIC1FTk9TWVM7Ci0gICAgICAgIH0KLSAgICAgICAgcERvd25taXhlci0+c3RhdGUgPSBET1dOTUlYX1NUQVRFX0lOSVRJQUxJWkVEOwotICAgICAgICBBTE9HVigiRUZGRUNUX0NNRF9ESVNBQkxFKCkgT0siKTsKLSAgICAgICAgKihpbnQgKilwUmVwbHlEYXRhID0gMDsKLSAgICAgICAgYnJlYWs7Ci0KLSAgICBjYXNlIEVGRkVDVF9DTURfU0VUX0RFVklDRToKLSAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwgY21kU2l6ZSAhPSAoaW50KXNpemVvZih1aW50MzJfdCkpIHsKLSAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwotICAgICAgICB9Ci0gICAgICAgIC8vIEZJWE1FIGNoYW5nZSB0eXBlIGlmIHBsYXlpbmcgb24gaGVhZHNldCB2cyBzcGVha2VyCi0gICAgICAgIEFMT0dWKCJEb3dubWl4X0NvbW1hbmQgRUZGRUNUX0NNRF9TRVRfREVWSUNFOiAweCUwOCIgUFJJeDMyLCAqKHVpbnQzMl90ICopcENtZERhdGEpOwotICAgICAgICBicmVhazsKLQotICAgIGNhc2UgRUZGRUNUX0NNRF9TRVRfVk9MVU1FOiB7Ci0gICAgICAgIC8vIGF1ZGlvIG91dHB1dCBpcyBhbHdheXMgc3RlcmVvID0+IDIgY2hhbm5lbCB2b2x1bWVzCi0gICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMIHx8IGNtZFNpemUgIT0gKGludClzaXplb2YodWludDMyX3QpICogMikgewotICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7Ci0gICAgICAgIH0KLSAgICAgICAgLy8gRklYTUUgY2hhbmdlIHZvbHVtZQotICAgICAgICBBTE9HVygiRG93bm1peF9Db21tYW5kIGNvbW1hbmQgRUZGRUNUX0NNRF9TRVRfV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iArIFJMCi0gICAgICAgICAgICBsdCA9IChwU3JjWzBdIDw8IDEyKSArIGNlbnRlclBsdXNMZmVDb250cmliICsgKHBTcmNbNF0gPDwgMTIpOwotICAgICAgICAgICAgLy8gRlIgKyBjZW50ZXJQbHVzTGZlQ29udHJpYiArIFJSCi0gICAgICAgICAgICBydCA9IChwU3JjWzFdIDw8IDEyKSArIGNlbnRlclBsdXNMZmVDb250cmliICsgKHBTcmNbNV0gPDwgMTIpOwotICAgICAgICAgICAgLy8gYWNjdW11bGF0ZSBpbiBkZXN0aW5hdGlvbgotICAgICAgICAgICAgcERzdFswXSA9IGNsYW1wMTYocERzdFswXSArIChsdCA+PiAxMykpOwotICAgICAgICAgICAgcERzdFsxXSA9IGNsYW1wMTYocERzdFsxXSArIChydCA+PiAxMykpOwotICAgICAgICAgICAgcFNyYyArPSA2OwotICAgICAgICAgICAgcERzdCArPSAyOwotICAgICAgICAgICAgbnVtRnJhbWVzLS07Ci0gICAgICAgIH0KLSAgICB9IGVsc2UgeyAvLyBzYW1lIGNvZGUgYXMgYWJvdmUgYnV0IHdpdGhvdXQgYWRkaW5nIGFuZCBjbGFtcGluZyBwRHN0W2ldIHRvIGl0c2VsZgotICAgICAgICB3aGlsZSAobnVtRnJhbWVzKSB7Ci0gICAgICAgICAgICAvLyBjZW50ZXJQbHVzTGZlQ29udHJpYiA9IEZDKC0zZEIpICsgTEZFKC0zZEIpCi0gICAgICAgICAgICBjZW50ZXJQbHVzTGZlQ29udHJpYiA9IChwU3JjWzJdICogTUlOVVNfM19EQl9JTl9RMTlfMTIpCi0gICAgICAgICAgICAgICAgICAgICsgKHBTcmNbM10gKiBNSU5VU18zX0RCX0lOX1ExOV8xMik7Ci0gICAgICAgICAgICAvLyBGTCArIGNlbnRlclBsdXNMZmVDb250cmliICsgUkwKLSAgICAgICAgICAgIGx0ID0gKHBTcmNbMF0gPDwgMTIpICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyAocFNyY1s0XSA8PCAxMik7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2l0aG91dCBhZGRpbmcgYW5kIGNsYW1waW5nIHBEc3RbaV0gdG8gaXRzZWxmCi0gICAgICAgIHdoaWxlIChudW1GcmFtZXMpIHsKLSAgICAgICAgICAgIC8vIGNlbnRlclBsdXNMZmVDb250cmliID0gRkMoLTNkQikgKyBMRkUoLTNkQikKLSAgICAgICAgICAgIGNlbnRlclBsdXNMZmVDb250cmliID0gKHBTcmNbMl0gKiBNSU5VU18zX0RCX0lOX0ZMT0FUKQotICAgICAgICAgICAgICAgICAgICArIChwU3JjWzNdICogTUlOVVNfM19EQl9JTl9GTE9BVCk7Ci0gICAgICAgICAgICAvLyBGTCArIGNlbnRlclBsdXNMZmVDb250cmliICsgUkwKLSAgICAgICAgICAgIGx0ID0gcFNyY1swXSArIGNlbnRlclBsdXNMZmVDb250cmliICsgcFNyY1s0XTsKLSAgICAgICAgICAgIC8vIEZSICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyBSUgotICAgICAgICAgICAgcnQgPSBwU3JjWzFdICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyBwU3JjWzVdOwotICAgICAgICAgICAgLy8gc3RvcmUgaW4gZGVzdGluYXRpb24KLSAgICAgICAgICAgIHBEc3RbMF0gPSBjbGFtcF9mbG9hdChsdCAvIDIuMGYpOyAvLyBkaWZmZXJzIGZyb20gd2hlbiBhY2N1bXVsYXRlIGlzIHRydWUgYWJvdmUKLSAgICAgICAgICAgIHBEc3RbMV0gPSBjbGFtcF9mbG9hdChydCAvIDIuMGYpOyAvLyBkaWZmZXJzIGZyb20gd2hlbiBhY2N1bXVsYXRlIGlzIHRydWUgYWJvdmUKLSAgICAgICAgICAgIHBTcmMgKz0gNjsKLSAgICAgICAgICAgIHBEc3QgKz0gMjsKLSAgICAgICAgICAgIG51bUZyYW1lcy0tOwotICAgICAgICB9Ci0gICAgfQotfQotI2VuZGlmCi0KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tL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gKHBTcmNbN10gPDwgMTIpICsgKHBTcmNbNV0gPDwgMTIpOwotICAgICAgICAgICAgLy9hY2N1bXVsYXRlIGluIGRlc3RpbmF0aW9uCi0gICAgICAgICAgICBwRHN0WzBdID0gY2xhbXAxNihwRHN0WzBdICsgKGx0ID4+IDEzKSk7Ci0gICAgICAgICAgICBwRHN0WzFdID0gY2xhbXAxNihwRHN0WzFdICsgKHJ0ID4+IDEzKSk7Ci0gICAgICAgICAgICBwU3JjICs9IDg7Ci0gICAgICAgICAgICBwRHN0ICs9IDI7Ci0gICAgICAgICAgICBudW1GcmFtZXMtLTsKLSAgICB9Ci0gICAgfSBlbHNlIHsgLy8gc2FtZSBjb2RlIGFzIGFib3ZlIGJ1dCB3aXRob3V0IGFkZGluZyBhbmQgY2xhbXBpbmcgcERzdFtpXSB0byBpdHNlbGYKLSAgICAgICAgd2hpbGUgKG51bUZyYW1lcykgewotICAgICAgICAgICAgLy8gY2VudGVyUGx1c0xmZUNvbnRyaWIgPSBGQygtM2RCKSArIExGRSgtM2RCKQotICAgICAgICAgICAgY2VudGVyUGx1c0xmZUNvbnRyaWIgPSAocFNyY1syXSAqIE1JTlVTXzNfREJfSU5fUTE5XzEyKQotICAgICAgICAgICAgICAgICAgICArIChwU3JjWzNdICogTUlOVVNfM19EQl9JTl9RMTlfMTIpOwotICAgICAgICAgICAgLy8gRkwgKyBjZW50ZXJQbHVzTGZlQ29udHJpYiArIFNMICsgUkwKLSAgICAgICAgICAgIGx0ID0gKHBTcmNbMF0gPDwgMTIpICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyAocFNyY1s2XSA8PCAxMikgKyAocFNyY1s0XSA8PCAxMik7Ci0gICAgICAgICAgICAvLyBGUiArIGNlbnRlclBsdXNMZmVDb250cmliICsgU1IgKyBSUgotICAgICAgICAgICAgcnQgPSAocFNyY1sxXSA8PCAxMikgKyBjZW50ZXJQbHVzTGZlQ29udHJpYiArIChwU3JjWzddIDw8IDEyKSArIChwU3JjWzVdI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bXVsYXRlIHRvIGF2b2lkIHJlcGVhdGluZyB0aGUgdGVzdAotICAgIC8vIGZvciBldmVyeSBzYW1wbGUKLSAgICBpZiAoYWNjdW11bGF0ZSkgewotICAgICAgICB3aGlsZSAobnVtRnJhbWVzKSB7Ci0gICAgICAgICAgICAvLyBjZW50ZXJQbHVzTGZlQ29udHJpYiA9IEZDKC0zZEIpICsgTEZFKC0zZEIpCi0gICAgICAgICAgICBjZW50ZXJQbHVzTGZlQ29udHJpYiA9IChwU3JjWzJdICogTUlOVVNfM19EQl9JTl9GTE9BVCkKLSAgICAgICAgICAgICAgICAgICAgKyAocFNyY1szXSAqIE1JTlVTXzNfREJfSU5fRkxPQVQpOwotICAgICAgICAgICAgLy8gRkwgKyBjZW50ZXJQbHVzTGZlQ29udHJpYiArIFNMICsgUkwKLSAgICAgICAgICAgIGx0ID0gcFNyY1swXSArIGNlbnRlclBsdXNMZmVDb250cmliICsgcFNyY1s2XSArIHBTcmNbNF07Ci0gICAgICAgICAgICAvLyBGUiArIGNlbnRlclBsdXNMZmVDb250cmliICsgU1IgKyBSUgotICAgICAgICAgICAgcnQgPSBwU3JjWzFdICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyBwU3JjWzddICsgcFNyY1s1XTsKLSAgICAgICAgICAgIC8vYWNjdW11bGF0ZSBpbiBkZXN0aW5hdGlvbgotICAgICAgICAgICAgcERzdFswXSA9IGNsYW1wX2Zsb2F0KHBEc3RbMF0gKyAobHQgLyAyLjBmKSk7Ci0gICAgICAgICAgICBwRHN0WzFdID0gY2xhbXBfZmxvYXQocERzdFsxXSArIChydCAvIDIuMGYpKTsKLSAgICAgICAgICAgIHBTcmMgKz0gODsKLSAgICAgICAgICAgIHBEc3QgKz0gMjsKLSAgICAgICAgICAgIG51bUZyYW1lcy0tOwotICAgICAgICB9Ci0gICAgfSBlbHNlIHsgLy8gc2FtZSBjb2RlIGFzIGFib3ZlIGJ1dCB3aXRob3V0IGFkZGluZyBhbmQgY2xhbXBp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IC8vIG1peCBpbiBzaWRlcyBhbmQgYmFja3MKLSAgICAgICAgICAgIGlmIChoYXNTaWRlcykgewotICAgICAgICAgICAgICAgIGx0ICs9IHBTcmNbaW5kZXhTTF0gPDwgMTI7Ci0gICAgICAgICAgICAgICAgcnQgKz0gcFNyY1tpbmRleFNSXSA8PCAxMjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChoYXNCYWNrcykgewotICAgICAgICAgICAgICAgIGx0ICs9IHBTcmNbaW5kZXhCTF0gPDwgMTI7Ci0gICAgICAgICAgICAgICAgcnQgKz0gcFNyY1tpbmRleEJSXSA8PCAxMjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGx0ICs9IGNlbnRlcnNMZmVDb250cmliOwotICAgICAgICAgICAgcnQgKz0gY2VudGVyc0xmZUNvbnRyaWI7Ci0gICAgICAgICAgICAvLyBhY2N1bXVsYXRlIGluIGRlc3RpbmF0aW9uCi0gICAgICAgICAgICBwRHN0WzBdID0gY2xhbXAxNihwRHN0WzBdICsgKGx0ID4+IDEzKSk7Ci0gICAgICAgICAgICBwRHN0WzFdID0gY2xhbXAxNihwRHN0WzFdICsgKHJ0ID4+IDEzKSk7Ci0gICAgICAgICAgICBwU3JjICs9IG51bUNoYW47Ci0gICAgICAgICAgICBwRHN0ICs9IDI7Ci0gICAgICAgICAgICBudW1GcmFtZXMtLTsKLSAgICAgICAgfQotICAgIH0gZWxzZSB7Ci0gICAgICAgIHdoaWxlIChudW1GcmFtZXMpIHsKLSAgICAgICAgICAgIC8vIGNvbXB1dGUgY29udHJpYnV0aW9uIG9mIEZDLCBCQyBhbmQgTEZFCi0gICAgICAgICAgICBjZW50ZXJzTGZlQ29udHJpYiA9IDA7Ci0gICAgICAgICAgICBpZiAoaGFzRkMpICB7IGNlbnRlcnNMZmVDb250cmliICs9IHBTcmNbaW5kZXhGQ107IH0KLSAgICAgICAgICAgIGlmIChoYXNMRkUpIHsgY2VudGVyc0xmZUNvbnRyaWIgKz0gcFNyY1tpbmRleExGRV07IH0KLSAgICAgICAgICAgIGlmIChoYXNCQykgIHsgY2VudGVyc0xmZUNvbnRyaWIgKz0gcFNyY1tpbmRleEJDXTsgfQotICAgICAgICAgICAgY2VudGVyc0xmZUNvbnRyaWIgKj0gTUlOVVNfM19EQl9JTl9RMTlfMTI7Ci0gICAgICAgICAgICAvLyBhbHdheXMgaGFzIEZML0ZSCi0gICAgICAgICAgICBsdCA9IChwU3JjWzBdIDw8IDEyKTsKLSAgICAgICAgICAgIHJ0ID0gKHBTcmNbMV0gPDwgMTIpOwotICAgICAgICAgICAgLy8gbWl4IGluIHNpZGVzIGFuZCBiYWNrcwotICAgICAgICAgICAgaWYgKGhhc1NpZGVzKSB7Ci0gICAgICAgICAgICAgICAgbHQgKz0gcFNyY1tpbmRleFNMXSA8PCAxMjsKLSAgICAgICAgICAgICAgICBydCArPSBwU3JjW2luZGV4U1JdIDw8IDEyOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKGhhc0JhY2tzKSB7Ci0gICAgICAgICAgICAgICAgbHQgKz0gcFNyY1tpbmRleEJMXSA8PCAxMjsKLSAgICAgICAgICAgICAgICBydCArPSBwU3JjW2luZGV4QlJdIDw8IDEyOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbHQgKz0gY2VudGVyc0xmZUNvbnRyaWI7Ci0gICAgICAgICAgICBydCArPSBjZW50ZXJzTGZlQ29udHJpYjsKLSAgICAgICAgICAgIC8vIHN0b3JlIGluIGRlc3RpbmF0aW9uCi0gICAgICAgICAgICBwRHN0WzBdID0gY2xhbXAxNihsdCA+PiAxMyk7IC8vIGRpZmZlcnMgZnJvbSB3aGVuIGFjY3VtdWxhdGUgaXMgdHJ1ZSBhYm92ZQotICAgICAgICAgICAgcERzdFsxXSA9IGNsYW1wMTYocnQgPj4gMTMpOyAvLyBkaWZmZXJzIGZyb20gd2hlbiBhY2N1bXVsYXRlIGlzIHRydWUgYWJvdmUKLSAgICAgICAgICAgIHBTcm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gdHdvIHZhbHVlcyBvZiBhY2N1bXVsYXRlIHRvIGF2b2lkIHJlcGVhdGluZyB0aGUgdGVzdAotICAgIC8vIGZvciBldmVyeSBzYW1wbGUKLSAgICBpZiAoYWNjdW11bGF0ZSkgewotICAgICAgICB3aGlsZSAobnVtRnJhbWVzKSB7Ci0gICAgICAgICAgICAvLyBjb21wdXRlIGNvbnRyaWJ1dGlvbiBvZiBGQywgQkMgYW5kIExGRQotICAgICAgICAgICAgY2VudGVyc0xmZUNvbnRyaWIgPSAwOwotICAgICAgICAgICAgaWYgKGhhc0ZDKSAgeyBjZW50ZXJzTGZlQ29udHJpYiArPSBwU3JjW2luZGV4RkNdOyB9Ci0gICAgICAgICAgICBpZiAoaGFzTEZFKSB7IGNlbnRlcnNMZmVDb250cmliICs9IHBTcmNbaW5kZXhMRkVdOyB9Ci0gICAgICAgICAgICBpZiAoaGFzQkMpICB7IGNlbnRlcnNMZmVDb250cmliICs9IHBTcmNbaW5kZXhCQ107IH0KLSAgICAgICAgICAgIGNlbnRlcnNMZmVDb250cmliICo9IE1JTlVTXzNfREJfSU5fRkxPQVQ7Ci0gICAgICAgICAgICAvLyBhbHdheXMgaGFzIEZML0ZSCi0gICAgICAgICAgICBsdCA9IHBTcmNbMF07Ci0gICAgICAgICAgICBydCA9IHBTcmNbMV07Ci0gICAgICAgICAgICAvLyBtaXggaW4gc2lkZXMgYW5kIGJhY2tzCi0gICAgICAgICAgICBpZiAoaGFzU2lkZXMpIHsKLSAgICAgICAgICAgICAgICBsdCArPSBwU3JjW2luZGV4U0xdOwotICAgICAgICAgICAgICAgIHJ0ICs9IHBTcmNbaW5kZXhTUl07Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoaGFzQmFja3MpIHsKLSAgICAgICAgICAgICAgICBsdCArPSBwU3JjW2luZGV4QkxdOwotICAgICAgICAgICAgICAgIHJ0ICs9IHBTcmNbaW5kZXhCUl07Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBsdCArPSBjZW50ZXJzTGZlQ29udHJpYjsKLSAgICAgICAgICAgIHJ0ICs9IGNlbnRlcnNMZmVDb250cmliOwotICAgICAgICAgICAgLy8gYWNjdW11bGF0ZSBpbiBkZXN0aW5hdGlvbgotICAgICAgICAgICAgcERzdFswXSA9IGNsYW1wX2Zsb2F0KHBEc3RbMF0gKyAobHQgLyAyLjBmKSk7Ci0gICAgICAgICAgICBwRHN0WzFdID0gY2xhbXBfZmxvYXQocERzdFsxXSArIChydCAvIDIuMGYpKTsKLSAgICAgICAgICAgIHBTcmMgKz0gbnVtQ2hhbjsKLSAgICAgICAgICAgIHBEc3QgKz0gMjsKLSAgICAgICAgICAgIG51bUZyYW1lcy0tOwotICAgICAgICB9Ci0gICAgfSBlbHNlIHsKLSAgICAgICAgd2hpbGUgKG51bUZyYW1lcykgewotICAgICAgICAgICAgLy8gY29tcHV0ZSBjb250cmlidXRpb24gb2YgRkMsIEJDIGFuZCBMRkUKLSAgICAgICAgICAgIGNlbnRlcnNMZmVDb250cmliID0gMDsKLSAgICAgICAgICAgIGlmIChoYXNGQykgIHsgY2VudGVyc0xmZUNvbnRyaWIgKz0gcFNyY1tpbmRleEZDXTsgfQotICAgICAgICAgICAgaWYgKGhhc0xGRSkgeyBjZW50ZXJzTGZlQ29udHJpYiArPSBwU3JjW2luZGV4TEZFXTsgfQotICAgICAgICAgICAgaWYgKGhhc0JDKSAgeyBjZW50ZXJzTGZlQ29udHJpYiArPSBwU3JjW2luZGV4QkNdOyB9Ci0gICAgICAgICAgICBjZW50ZXJzTGZlQ29udHJpYiAqPSBNSU5VU18zX0RCX0lOX0ZMT0FUOwotICAgICAgICAgICAgLy8gYWx3YXlzIGhhcyBGTC9GUgotICAgICAgICAgICAgbHQgPSBwU3JjWzBdOwotICAgICAgICAgICAgcnQgPSBwU3JjWzFdOwotICAgICAgICAgICAgLy8gbWl4IGluIHNpZGVzIGFuZCBiYWNrcwotICAgICAgICAgICAgaWYgKGhhc1NpZGVzKSB7Ci0gICAgICAgICAgICAgICAgbHQgKz0gcFNyY1tpbmRleFNMXTsKLSAgICAgICAgICAgICAgICBydCArPSBwU3JjW2luZGV4U1JdOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKGhhc0JhY2tzKSB7Ci0gICAgICAgICAgICAgICAgbHQgKz0gcFNyY1tpbmRleEJMXTsKLSAgICAgICAgICAgICAgICBydCArPSBwU3JjW2luZGV4QlJdOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbHQgKz0gY2VudGVyc0xmZUNvbnRyaWI7Ci0gICAgICAgICAgICBydCArPSBjZW50ZXJzTGZlQ29udHJpYjsKLSAgICAgICAgICAgIC8vIHN0b3JlIGluIGRlc3RpbmF0aW9uCi0gICAgICAgICAgICBwRHN0WzBdID0gY2xhbXBfZmxvYXQobHQgLyAyLjBmKTsgLy8gZGlmZmVycyBmcm9tIHdoZW4gYWNjdW11bGF0ZSBpcyB0cnVlIGFib3ZlCi0gICAgICAgICAgICBwRHN0WzFdID0gY2xhbXBfZmxvYXQocnQgLyAyLjBmKTsgLy8gZGlmZmVycyBmcm9tIHdoZW4gYWNjdW11bGF0ZSBpcyB0cnVlIGFib3ZlCi0gICAgICAgICAgICBwU3JjICs9IG51bUNoYW47Ci0gICAgICAgICAgICBwRHN0ICs9IDI7Ci0gICAgICAgICAgICBudW1GcmFtZXMtLTsKLSAgICAgICAgfQotICAgIH0KLSAgICByZXR1cm4gdHJ1ZTsKLX0KLSNlbmRpZgpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9kb3dubWl4L0VmZmVjdERvd25taXguY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9kb3dubWl4L0VmZmVjdERvd25taXguY3BwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmY1MDBiYzMKLS0tIC9kZXYvbnVsbAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2Rvd25taXgvRWZmZWN0RG93bm1peC5jcHAKQEAgLT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4TGliX0NyZWF0ZShjb25zdCBlZmZlY3RfdXVpZF90ICp1dWlkLAorICAgICAgICBpbnQzMl90IHNlc3Npb25JZCwKKyAgICAgICAgaW50MzJfdCBpb0lkLAorICAgICAgICBlZmZlY3RfaGFuZGxlX3QgKnBIYW5kbGUpOworc3RhdGljIGludDMyX3QgRG93bm1peExpYl9SZWxlYXNlKGVmZmVjdF9oYW5kbGVfdCBoYW5kbGUpOworc3RhdGljIGludDMyX3QgRG93bm1peExpYl9HZXREZXNjcmlwdG9yKGNvbnN0IGVmZmVjdF91dWlkX3QgKnV1aWQsCisgICAgICAgIGVmZmVjdF9kZXNjcmlwdG9yX3QgKnBEZXNjcmlwdG9yKTsKK3N0YXRpYyBpbnQzMl90IERvd25taXhfUHJvY2VzcyhlZmZlY3RfaGFuZGxlX3Qgc2VsZiwKKyAgICAgICAgYXVkaW9fYnVmZmVyX3QgKmluQnVmZmVyLAorICAgICAgICBhdWRpb19idWZmZXJfdCAqb3V0QnVmZmVyKTsKK3N0YXRpYyBpbnQzMl90IERvd25taXhfQ29tbWFuZChlZmZlY3RfaGFuZGxlX3Qgc2VsZiwKKyAgICAgICAgdWludDMyX3QgY21kQ29kZSwKKyAgICAgICAgdWludDMyX3QgY21kU2l6ZSwKKyAgICAgICAgdm9pZCAqcENtZERhdGEsCisgICAgICAgIHVpbnQzMl90ICpyZXBseVNpemUsCisgICAgICAgIHZvaWQgKnBSZXBseURhdGEpOworc3RhdGljIGludDMyX3QgRG93bm1peF9HZXREZXNjcmlwdG9yKGVmZmVjdF9oYW5kbGVfdCBzZWxmLAorICAgICAgICBlZmZlY3RfZGVzY3JpcHRvcl90ICpwRGVzY3JpcHRvcik7CisKKy8vIEludGVybmFsIG1ldGhvZHMKK3N0YXRpYyBpbnQgRG93bm1peF9Jbml0KGRvd25taXhfbW9kdWxlX3QgKnBEd21Nb2R1bGUpOworc3RhdGljIGludCBEb3dubWl4X0NvbmZpZ3VyZShkb3dubWl4X21vZHVsZV90ICpwRHd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hhbm5lbHMgbXVzdCBiZSBwcmVzZW50Iik7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgLy8gdmVyaWZ5IHVzZXMgU0lERSBhcyBhIHBhaXIgKG9rIGlmIG5vdCB1c2luZyBTSURFIGF0IGFsbCkKKyAgICBib29sIGhhc1NpZGVzID0gZmFsc2U7CisgICAgaWYgKChtYXNrICYga1NpZGVzKSAhPSAwKSB7CisgICAgICAgIGlmICgobWFzayAmIGtTaWRlcykgIT0ga1NpZGVzKSB7CisgICAgICAgICAgICBBTE9HRSgiU2lkZSBjaGFubmVscyBtdXN0IGJlIHVzZWQgYXMgYSBwYWlyIik7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgaGFzU2lkZXMgPSB0cnVlOworICAgIH0KKyAgICAvLyB2ZXJpZnkgdXNlcyBCQUNLIGFzIGEgcGFpciAob2sgaWYgbm90IHVzaW5nIEJBQ0sgYXQgYWxsKQorICAgIGJvb2wgaGFzQmFja3MgPSBmYWxzZTsKKyAgICBpZiAoKG1hc2sgJiBrQmFja3MpICE9IDApIHsKKyAgICAgICAgaWYgKChtYXNrICYga0JhY2tzKSAhPSBrQmFja3MpIHsKKyAgICAgICAgICAgIEFMT0dFKCJCYWNrIGNoYW5uZWxzIG11c3QgYmUgdXNlZCBhcyBhIHBhaXIiKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBoYXNCYWNrcyA9IHRydWU7CisgICAgfQorCisgICAgY29uc3QgaW50IG51bUNoYW4gPSBhdWRpb19jaGFubmVsX2NvdW50X2Zyb21fb3V0X21hc2sobWFzayk7CisgICAgY29uc3QgYm9vbCBoYXNGQyA9ICgobWFzayAmIEFVRElPX0NIQU5ORUxfT1VUX0ZST05UX0NFTlRFUikgPT0gQVVESU9fQ0hBTk5FTF9PVVRfRlJPTlRfQ0VOVEVSKTsKKyAgICBjb25zdCBib29sIGhhc0xGRSA9CisgICAgICAgICAgICAoKG1hc2sgJ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FOTkVMX09VVF9GUk9OVF9MRUZUIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19DSEFOTkVMX09VVF9TSURFX0xFRlQgfCBBVURJT19DSEFOTkVMX09VVF9TSURFX1JJR0hUKTsKKyNlbmRpZgorCisgICAgaWYgKHBIYW5kbGUgPT0gTlVMTCB8fCB1dWlkID09IE5VTEwpIHsKKyAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgfQorCisgICAgZm9yIChpID0gMCA7IGkgPCBrTmJFZmZlY3RzIDsgaSsrKSB7CisgICAgICAgIGRlc2MgPSBnRGVzY3JpcHRvcnNbaV07CisgICAgICAgIGlmIChtZW1jbXAodXVpZCwgJmRlc2MtPnV1aWQsIHNpemVvZihlZmZlY3RfdXVpZF90KSkgPT0gMCkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpZiAoaSA9PSBrTmJFZmZlY3RzKSB7CisgICAgICAgIHJldHVybiAtRU5PRU5UOworICAgIH0KKworICAgIG1vZHVsZSA9IG5ldyBkb3dubWl4X21vZHVsZV90e307CisKKyAgICBtb2R1bGUtPml0ZmUgPSAmZ0Rvd25taXhJbnRlcmZhY2U7CisKKyAgICBtb2R1bGUtPmNvbnRleHQuc3RhdGUgPSBET1dOTUlYX1NUQVRFX1VOSU5JVElBTElaRUQ7CisKKyAgICByZXQgPSBEb3dubWl4X0luaXQobW9kdWxlKTsKKyAgICBpZiAocmV0IDwgMCkgeworICAgICAgICBBTE9HVygiRG93bm1peExpYl9DcmVhdGUoKSBpbml0IGZhaWxlZCIpOworICAgICAgICBmcmVlKG1vZHVsZSk7CisgICAgICAgIHJldHVybiByZXQ7CisgICAgfQorCisgICAgKnBIYW5kbGUgPSAoZWZmZWN0X2hhbmRsZV90KSBtb2R1bGU7CisKKyAgICBBTE9HVigiRG93bm1peExpYl9DcmVhdGUoKSAlcCAsIHNpemUgJXp1IiwgbW9kdWxlLCBzaXplb2YoZG93bm1peF9tb2R1bGVfdCkpOworCisgICAgcmV0dXJuIDA7Cit9CisKK3N0YXRpYyBpbnQzMl90IERvd25taXhMaWJfUmVsZWFzZShlZmZlY3RfaGFuZGxlX3QgaGFuZGxlKSB7CisgICAgZG93bm1peF9tb2R1bGVfdCAqcER3bU1vZHVsZSA9IChkb3dubWl4X21vZHVsZV90ICopaGFuZGxlOworCisgICAgQUxPR1YoIkRvd25taXhMaWJfUmVsZWFzZSgpICVwIiwgaGFuZGxlKTsKKyAgICBpZiAoaGFuZGxlID09IE5VTEwpIHsKKyAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgfQorCisgICAgcER3bU1vZHVsZS0+Y29udGV4dC5zdGF0ZSA9IERPV05NSVhfU1RBVEVfVU5JTklUSUFMSVpFRDsKKworICAgIGRlbGV0ZSBwRHdtTW9kdWxlOworICAgIHJldHVybiAwOworfQorCitzdGF0aWMgaW50MzJfdCBEb3dubWl4TGliX0dldERlc2NyaXB0b3IoCisgICAgICAgIGNvbnN0IGVmZmVjdF91dWlkX3QgKnV1aWQsIGVmZmVjdF9kZXNjcmlwdG9yX3QgKnBEZXNjcmlwdG9yKSB7CisgICAgQUxPR1YoIkRvd25taXhMaWJfR2V0RGVzY3JpcHRvcigpIik7CisgICAgaW50IGk7CisKKyAgICBpZiAocERlc2NyaXB0b3IgPT0gTlVMTCB8fCB1dWlkID09IE5VTEwpeworICAgICAgICBBTE9HRSgiRG93bm1peExpYl9DcmVhdGUoKSBjYWxsZWQgd2l0aCBOVUxMIHBvaW50ZXIiKTsKKyAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgfQorICAgIEFMT0dWKCJEb3dubWl4TGliX0dldERlc2NyaXB0b3IoKSBuYiBlZmZlY3RzPSVkIiwga05iRWZmZWN0cyk7CisgICAgZm9yIChpID0gMDsgaSA8IGtOYkVmZmVjdHM7IGkrKykgeworICAgICAgICBBTE9HVigiRG93bm1peExpYl9HZXREZXNjcmlwdG9yKCkgaT0lZCIsIGkpOworICAgICAgICBpZiAobWVtY21wKHV1aWQsICZnRGVzY3JpcHRvcnNbaV0tPnV1aWQsIHNpemVvZihlZmZlY3RfdXVpZF90KSkgPT0gMCkgeworICAgICAgICAgICAgbWVtY3B5KHBEZXNjcmlwdG9yLCBnRGVzY3JpcHRvcnNbaV0sIHNpemVvZihlZmZlY3RfZGVzY3JpcHRvcl90KSk7CisgICAgICAgICAgICBBTE9HVigiRWZmZWN0R2V0RGVzY3JpcHRvciAtIFVVSUQgbWF0Y2hlZCBkb3dubWl4IHR5cGUgJWQsIFVVSUQgPSAlI3giLAorICAgICAgICAgICAgICAgICBpLCBnRGVzY3JpcHRvcnNbaV0tPnV1aWQudGltZUxvdyk7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHJldHVybiAtRUlOVkFMOworfQorCisvKi0tLSBFZmZlY3QgQ29udHJvbCBJbnRlcmZhY2UgSW1wbGVtZW50YXRpb24gLS0tKi8KKworc3RhdGljIGludDMyX3QgRG93bm1peF9Qcm9jZXNzKGVmZmVjdF9oYW5kbGVfdCBzZWxmLAorICAgICAgICBhdWRpb19idWZmZXJfdCAqaW5CdWZmZXIsIGF1ZGlvX2J1ZmZlcl90ICpvdXRCdWZmZXIpIHsKKworICAgIGRvd25taXhfb2JqZWN0X3QgKnBEb3dubWl4ZXI7CisgICAgZmxvYXQgKnBTcmMsICpwRHN0OworICAgIGRvd25taXhfbW9kdWxlX3QgKnBEd21Nb2R1bGUgPSAoZG93bm1peF9tb2R1bGVfdCAqKXNlbGY7CisKKyAgICBpZiAocER3bU1vZHVsZSA9PSBOVUxMKSB7CisgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgIH0KKworICAgIGlmIChpbkJ1ZmZlciA9PSBOVUxMIHx8IGluQnVmZmVyLT5yYXcgPT0gTlVMTCB8fAorICAgICAgICBvdXRCdWZmZXIgPT0gTlVMTCB8fCBvdXRCdWZmZXItPnJhdyA9PSBOVUxMIHx8CisgICAgICAgIGluQnVmZmVyLT5mcmFtZUNvdW50ICE9IG91dEJ1ZmZlci0+ZnJhbWVDb3VudCkgeworICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICB9CisKKyAgICBwRG93bm1peGVyID0gKGRvd25taXhfb2JqZWN0X3QqKSAmcER3bU1vZHVsZS0+Y29udGV4dDsKKworICAgIGlmIChwRG93bm1peGVyLT5zdGF0ZSA9PSBET1dOTUlYX1NUQVRFX1VOSU5JVElBTElaRUQpIHsKKyAgICAgICAgQUxPR0UoIkRvd25taXhfUHJvY2VzcyBlcnJvcjogdHJ5aW5nIHRvIHVzZSBhbiB1bmluaXRpYWxpemVkIGRvd25taXhlciIpOworICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICB9IGVsc2UgaWYgKHBEb3dubWl4ZXItPnN0YXRlID09IERPV05NSVhfU1RBVEVfSU5JVElBTElaRUQpIHsKKyAgICAgICAgQUxPR0UoIkRvd25taXhfUHJvY2VzcyBlcnJvcjogdHJ5aW5nIHRvIHVzZSBhIG5vbi1jb25maWd1cmVkIGRvd25taXhlciIpOworICAgICAgICByZXR1cm4gLUVOT0RBVEE7CisgICAgfQorCisgICAgcFNyYyA9IGluQnVmZmVyLT5mMzI7CisgICAgcERzdCA9IG91dEJ1ZmZlci0+ZjMyOworICAgIHNpemVfdCBudW1GcmFtZXMgPSBvdXRCdWZmZXItPmZyYW1lQ291bnQ7CisKKyAgICBjb25zdCBib29sIGFjY3VtdWxhdGUgPQorICAgICAgICAgICAgKHBEd21Nb2R1bGUtPmNvbmZpZy5vdXRwdXRDZmcuYWNjZXNzTW9kZSA9PSBFRkZFQ1RfQlVGRkVSX0FDQ0VTU19BQ0NVTVVMQVRFKTsKKyAgICBjb25zdCB1aW50MzJfdCBkb3dubWl4SW5wdXRDaGFubmVsTWFzayA9IHBEd21Nb2R1bGUtPmNvbmZpZy5pbnB1dENmZy5jaGFubmVsczsKKworICAgIHN3aXRjaChwRG93bm1peGVyLT50eXBlKSB7CisKKyAgICAgIGNhc2UgRE9XTk1JWF9UWVBFX1NUUklQOgorICAgICAgICAgIGlmIChhY2N1bXVsYXRlKSB7CisgICAgICAgICAgICAgIHdoaWxlIChudW1GcmFtZXMpIHsKKyAgICAgICAgICAgICAgICAgIHBEc3RbMF0gPSBjbGFtcF9mbG9hdChwRHN0WzBdICsgcFNyY1swXSk7CisgICAgICAgICAgICAgICAgICBwRHN0WzFdID0gY2xhbXBfZmxvYXQocERzdFsxXSArIHBTcmNbMV0pOworICAgICAgICAgICAgICAgICAgcFNyYyArPSBwRG93bm1peGVyLT5pbnB1dF9jaGFubmVsX2NvdW50OworICAgICAgICAgICAgICAgICAgcERzdCArPSAyOworICAgICAgICAgICAgICAgICAgbnVtRnJhbWVzLS07CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICB3aGlsZSAobnVtRnJhbWVzKSB7CisgICAgICAgICAgICAgICAgICBwRHN0WzBdID0gcFNyY1swXTsKKyAgICAgICAgICAgICAgICAgIHBEc3RbMV0gPSBwU3JjWzFdOworICAgICAgICAgICAgICAgICAgcFNyYyArPSBwRG93bm1peGVyLT5pbnB1dF9jaGFubmVsX2NvdW50OworICAgICAgICAgICAgICAgICAgcERzdCArPSAyOworICAgICAgICAgICAgICAgICAgbnVtRnJhbWVzLS07CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisgICAgICAgICAgYnJlYWs7CisKKyAgICAgIGNhc2UgRE9XTk1JWF9UWVBFX0ZPTEQ6CisjaWZkZWYgRE9XTk1JWF9BTFdBWVNfVVNFX0dFTkVSSUNfRE9XTk1JWEVSCisgICAgICAgICAgLy8gYnlwYXNzIHRoZSBvcHRpbWl6ZWQgZG93bm1peCByb3V0aW5lcyBmb3IgdGhlIGNvbW1vbiBmb3JtYXRzCisgICAgICAgICAgaWYgKCFEb3dubWl4X2ZvbGRHZW5lcmljKAorICAgICAgICAgICAgICAgICAgZG93bm1peElucHV0Q2hhbm5lbE1hc2ssIHBTcmMsIHBEc3QsIG51bUZyYW1lcywgYWNjdW11bGF0ZSkpIHsKKyAgICAgICAgICAgICAgQUxPR0UoIk11bHRpY2hhbm5lbCBjb25maWd1cmF0aW9uICUjeCBpcyBub3Qgc3VwcG9ydGVkIiwKKyAgICAgICAgICAgICAgICAgICAgZG93bm1peElucHV0Q2hhbm5lbE1hc2spOworICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgICB9CisgICAgICAgICAgYnJlYWs7CisjZW5kaWYKKyAgICAgICAgLy8gb3B0aW1pemUgZm9yIHRoZSBjb21tb24gZm9ybWF0cworICAgICAgICBzd2l0Y2ggKGRvd25taXhJbnB1dENoYW5uZWxNYXNrKSB7CisgICAgICAgIGNhc2UgQVVESU9fQ0hBTk5FTF9PVVRfUVVBRF9CQUNLOgorICAgICAgICBjYXNlIEFVRElPX0NIQU5ORUxfT1VUX1FVQURfU0lERToKKyAgICAgICAgICAgIERvd25taXhfZm9sZEZyb21RdWFkKHBTcmMsIHBEc3QsIG51bUZyYW1lcywgYWNjdW11bGF0ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBVURJT19DSEFOTkVMX09VVF81UE9JTlQxX0JBQ0s6CisgICAgICAgIGNhc2UgQVVESU9fQ0hBTk5FTF9PVVRfNVBPSU5UMV9TSURFOgorICAgICAgICAgICAgRG93bm1peF9mb2xkRnJvbTVQb2ludDEocFNyYywgcERzdCwgbnVtRnJhbWVzLCBhY2N1bXVsYXRlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFVRElPX0NIQU5ORUxfT1VUXzdQT0lOVDE6CisgICAgICAgICAgICBEb3dubWl4X2ZvbGRGcm9tN1BvaW50MShwU3JjLCBwRHN0LCBudW1GcmFtZXMsIGFjY3VtdWxhdGUpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBpZiAoIURvd25taXhfZm9sZEdlbmVyaWMoCisgICAgICAgICAgICAgICAgICAgIGRvd25taXhJbnB1dENoYW5uZWxNYXNrLCBwU3JjLCBwRHN0LCBudW1GcmFtZXMsIGFjY3VtdWxhdGUpKSB7CisgICAgICAgICAgICAgICAgQUxPR0UoIk11bHRpY2hhbm5lbCBjb25maWd1cmF0aW9uICUjeCBpcyBub3Qgc3VwcG9ydGVkIiwKKyAgICAgICAgICAgICAgICAgICAgICBkb3dubWl4SW5wdXRDaGFubmVsTWFzayk7CisgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBicmVhazsKKworICAgICAgZGVmYXVsdDoKKyAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgfQorCisgICAgcmV0dXJuIDA7Cit9CisKK3N0YXRpYyBpbnQzMl90IERvd25taXhfQ29tbWFuZChlZmZlY3RfaGFuZGxlX3Qgc2VsZiwgdWludDMyX3QgY21kQ29kZSwgdWludDMyX3QgY21kU2l6ZSwKKyAgICAgICAgdm9pZCAqcENtZERhdGEsIHVpbnQzMl90ICpyZXBseVNpemUsIHZvaWQgKnBSZXBseURhdGEpIHsKKworICAgIGRvd25taXhfbW9kdWxlX3QgKnBEd21Nb2R1bGUgPSAoZG93bm1peF9tb2R1bGVfdCAqKSBzZWxmOworICAgIGRvd25taXhfb2JqZWN0X3QgKnBEb3dubWl4ZXI7CisKKyAgICBpZiAocER3bU1vZHVsZSA9PSBOVUxMIHx8IHBEd21Nb2R1bGUtPmNvbnRleHQuc3RhdGUgPT0gRE9XTk1JWF9TVEFURV9VTklOSVRJQUxJWkVEKSB7CisgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgIH0KKworICAgIHBEb3dubWl4ZXIgPSAoZG93bm1peF9vYmplY3RfdCopICZwRHdtTW9kdWxlLT5jb250ZXh0OworCisgICAgQUxPR1YoIkRvd25taXhfQ29tbWFuZCBjb21tYW5kICV1IGNtZFNpemUgJXUiLCBjbWRDb2RlLCBjbWRTaXplKTsKKworICAgIHN3aXRjaCAoY21kQ29kZSkgeworICAgIGNhc2UgRUZGRUNUX0NNRF9JTklUOgorICAgICAgICBpZiAocFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMIHx8ICpyZXBseVNpemUgIT0gc2l6ZW9mKGludCkpIHsKKyAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgICAgICB9CisgICAgICAgICooaW50ICopIHBSZXBseURhdGEgPSBEb3dubWl4X0luaXQocER3bU1vZHVsZSk7CisgICAgICAgIGJyZWFrOworCisgICAgY2FzZSBFRkZFQ1RfQ01EX1NFVF9DT05GSUc6CisgICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMIHx8IGNtZFNpemUgIT0gc2l6ZW9mKGVmZmVjdF9jb25maWdfdCkKKyAgICAgICAgICAgICAgICB8fCBwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSkgeworICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgIH0KKyAgICAgICAgKihpbnQgKikgcFJlcGx5RGF0YSA9IERvd25taXhfQ29uZmlndXJlKHBEd21Nb2R1bGUsCisgICAgICAgICAgICAgICAgKGVmZmVjdF9jb25maWdfdCAqKXBDbWREYXRhLCBmYWxzZSk7CisgICAgICAgIGJyZWFrOworCisgICAgY2FzZSBFRkZFQ1RfQ01EX1JFU0VUOgorICAgICAgICBEb3dubWl4X1Jlc2V0KHBEb3dubWl4ZXIsIGZhbHNlKTsKKyAgICAgICAgYnJlYWs7CisKKyAgICBjYXNlIEVGRkVDVF9DTURfR0VUX1BBUkFNOiB7CisgICAgICAgIEFMT0dWKCJEb3dubWl4X0NvbW1hbmQgRUZGRUNUX0NNRF9HRVRfUEFSQU0gcENtZERhdGEgJXAsICpyZXBseVNpemUgJXUsIHBSZXBseURhdGE6ICVwIiwKKyAgICAgICAgICAgICAgICBwQ21kRGF0YSwgKnJlcGx5U2l6ZSwgcFJlcGx5RGF0YSk7CisgICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMIHx8IGNtZFNpemUgPCAoaW50KShzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgc2l6ZW9mKGludDMyX3QpKSB8fAorICAgICAgICAgICAgICAgIHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fAorICAgICAgICAgICAgICAgICpyZXBseVNpemUgPCAoaW50KSBzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgMiAqIHNpemVvZihpbnQzMl90KSkgeworICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgIH0KKyAgICAgICAgZWZmZWN0X3BhcmFtX3QgKnJlcCA9IChlZmZlY3RfcGFyYW1fdCAqKSBwUmVwbHlEYXRhOworICAgICAgICBtZW1jcHkocFJlcGx5RGF0YSwgcENtZERhdGEsIHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBzaXplb2YoaW50MzJfdCkpOworICAgICAgICBBTE9HVigiRG93bm1peF9Db21tYW5kIEVGRkVDVF9DTURfR0VUX1BBUkFNIHBhcmFtICVkLCByZXBseVNpemUgJXUiLAorICAgICAgICAgICAgICAgICooaW50MzJfdCAqKXJlcC0+ZGF0YSwgcmVwLT52c2l6ZSk7CisgICAgICAgIHJlcC0+c3RhdHVzID0gRG93bm1peF9nZXRQYXJhbWV0ZXIocERvd25taXhlciwgKihpbnQzMl90ICopcmVwLT5kYXRhLCAmcmVwLT52c2l6ZSwKKyAgICAgICAgICAgICAgICByZXAtPmRhdGEgKyBzaXplb2YoaW50MzJfdCkpOworICAgICAgICAqcmVwbHlTaXplID0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHNpemVvZihpbnQzMl90KSArIHJlcC0+dnNpemU7CisgICAgICAgIGJyZWFrOworICAgIH0KKyAgICBjYXNlIEVGRkVDVF9DTURfU0VUX1BBUkFNOiB7CisgICAgICAgIEFMT0dWKCJEb3dubWl4X0NvbW1hbmQgRUZGRUNUX0NNRF9TRVRfUEFSQU0gY21kU2l6ZSAlZCBwQ21kRGF0YSAlcCwgKnJlcGx5U2l6ZSAldSIKKyAgICAgICAgICAgICAgICAiLCBwUmVwbHlEYXRhICVwIiwgY21kU2l6ZSwgcENtZERhdGEsICpyZXBseVNpemUsIHBSZXBseURhdGEpOworICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCAoY21kU2l6ZSA8IChpbnQpKHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBzaXplb2YoaW50MzJfdCkpKQorICAgICAgICAgICAgICAgIHx8IHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IChpbnQpc2l6ZW9mKGludDMyX3QpKSB7CisgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgfQorICAgICAgICBlZmZlY3RfcGFyYW1fdCAqY21kID0gKGVmZmVjdF9wYXJhbV90ICopIHBDbWREYXRhOworICAgICAgICBpZiAoY21kLT5wc2l6ZSAhPSBzaXplb2YoaW50MzJfdCkpIHsKKyAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiNjM2NjI5MzgiKTsKKyAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgICAgICB9CisgICAgICAgICooaW50ICopcFJlcGx5RGF0YSA9IERvd25taXhfc2V0UGFyYW1ldGVyKHBEb3dubWl4ZXIsICooaW50MzJfdCAqKWNtZC0+ZGF0YSwKKyAgICAgICAgICAgICAgICBjbWQtPnZzaXplLCBjbWQtPmRhdGEgKyBzaXplb2YoaW50MzJfdCkpOworICAgICAgICBicmVhazsKKyAgICB9CisKKyAgICBjYXNlIEVGRkVDVF9DTURfU0VUX1BBUkFNX0RFRkVSUkVEOgorICAgICAgICAvL0ZJWE1FIGltcGxlbWVudAorICAgICAgICBBTE9HVygiRG93bm1peF9Db21tYW5kIGNvbW1hbmQgRUZGRUNUX0NNRF9TRVRfUEFSQU1fREVGRVJSRUQgbm90IHN1cHBvcnRlZCwgRklYTUUiKTsKKyAgICAgICAgYnJlYWs7CisKKyAgICBjYXNlIEVGRkVDVF9DTURfU0VUX1BBUkFNX0NPTU1JVDoKKyAgICAgICAgLy9GSVhNRSBpbXBsZW1lbnQKKyAgICAgICAgQUxPR1coIkRvd25taXhfQ29tbWFuZCBjb21tYW5kIEVGRkVDVF9DTURfU0VUX1BBUkFNX0NPTU1JVCBub3Qgc3VwcG9ydGVkLCBGSVhNRSIpOworICAgICAgICBicmVhazsKKworICAgIGNhc2UgRUZGRUNUX0NNRF9FTkFCTEU6CisgICAgICAgIGlmIChwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSkgeworICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHBEb3dubWl4ZXItPnN0YXRlICE9IERPV05NSVhfU1RBVEVfSU5JVElBTElaRUQpIHsKKyAgICAgICAgICAgIHJldHVybiAtRU5PU1lTOworICAgICAgICB9CisgICAgICAgIHBEb3dubWl4ZXItPnN0YXRlID0gRE9XTk1JWF9TVEFURV9BQ1RJVkU7CisgICAgICAgIEFMT0dWKCJFRkZFQ1RfQ01EX0VOQUJMRSgpIE9LIik7CisgICAgICAgICooaW50ICopcFJlcGx5RGF0YSA9IDA7CisgICAgICAgIGJyZWFrOworCisgICAgY2FzZSBFRkZFQ1RfQ01EX0RJU0FCTEU6CisgICAgICAgIGlmIChwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSkgeworICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHBEb3dubWl4ZXItPnN0YXRlICE9IERPV05NSVhfU1RBVEVfQUNUSVZFKSB7CisgICAgICAgICAgICByZXR1cm4gLUVOT1NZUzsKKyAgICAgICAgfQorICAgICAgICBwRG93bm1peGVyLT5zdGF0ZSA9IERPV05NSVhfU1RBVEVfSU5JVElBTElaRUQ7CisgICAgICAgIEFMT0dWKCJFRkZFQ1RfQ01EX0RJU0FCTEUoKSBPSyIpOworICAgICAgICAqKGludCAqKXBSZXBseURhdGEgPSAwOworICAgICAgICBicmVhazsKKworICAgIGNhc2UgRUZGRUNUX0NNRF9TRVRfREVWSUNFOgorICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCBjbWRTaXplICE9IChpbnQpc2l6ZW9mKHVpbnQzMl90KSkgeworICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgIH0KKyAgICAgICAgLy8gRklYTUUgY2hhbmdlIHR5cGUgaWYgcGxheWluZyBvbiBoZWFkc2V0IHZzIHNwZWFrZXIKKyAgICAgICAgQUxPR1YoIkRvd25taXhfQ29tbWFuZCBFRkZFQ1RfQ01EX1NFVF9ERVZJQ0U6ICUjeCIsICoodWludDMyX3QgKilwQ21kRGF0YSk7CisgICAgICAgIGJyZWFrOworCisgICAgY2FzZSBFRkZFQ1RfQ01EX1NFVF9WT0xVTUU6IHsKKyAgICAgICAgLy8gYXVkaW8gb3V0cHV0IGlzIGFsd2F5cyBzdGVyZW8gPT4gMiBjaGFubmVsIHZvbHVtZXMKKyAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwgY21kU2l6ZSAhPSAoaW50KXNpemVvZih1aW50MzJfdCkgKiAyKSB7CisgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgfQorICAgICAgICAvLyBGSVhNRSBjaGFuZ2Ugdm9sdW1lCisgICAgICAgIEFMT0dXKCJEb3dubWl4X0NvbW1hbmQgY29tbWFuZCBFRkZFQ1RfQ01EX1NFVF9WT0xVTUUgbm90IHN1cHBvcnRlZCwgRklYTUUiKTsKKyAgICAgICAgZmxvYXQgbGVmdCA9IChmbG9hdCkoKih1aW50MzJfdCAqKXBDbWREYXRhKSAvICgxIDw8IDI0KTsKKyAgICAgICAgZmxvYXQgcmlnaHQgPSAoZmxvYXQpKCooKHVpbnQzMl90ICopcENtZERhdGEgKyAxKSkgLyAoMSA8PCAyNCk7CisgICAgICAgIEFMT0dWKCJEb3dubWl4X0NvbW1hbmQgRUZGRUNUX0NNRF9TRVRfVk9MVU1FOiBsZWZ0ICVmLCByaWdodCAlZiAiLCBsZWZ0LCByaWdodCk7CisgICAgICAgIGJyZWFrOworICAgIH0KKworICAgIGNhc2UgRUZGRUNUX0NNRF9TRVRfQVVESU9fTU9ERToKKyAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwgY21kU2l6ZSAhPSAoaW50KXNpemVvZih1aW50MzJfdCkpIHsKKyAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgICAgICB9CisgICAgICAgIEFMT0dWKCJEb3dubWl4X0NvbW1hbmQgRUZGRUNUX0NNRF9TRVRfQVVESU9fTU9ERTogJXUiLCAqKHVpbnQzMl90ICopcENtZERhdGEpOworICAgICAgICBicmVhazsKKworICAgIGNhc2UgRUZGRUNUX0NNRF9TRVRfQ09ORklHX1JFVkVSU0U6CisgICAgY2FzZSBFRkZFQ1RfQ01EX1NFVF9JTlBVVF9ERVZJQ0U6CisgICAgICAgIC8vIHRoZXNlIGNvbW1hbmRzIGFyZSBpZ25vcmVkIGJ5IGEgZG93bm1peCBlZmZlY3QKKyAgICAgICAgYnJlYWs7CisKKyAgICBkZWZhdWx0OgorICAgICAgICBBTE9HVygiRG93bm1peF9Db21tYW5kIGludmFsaWQgY29tbWFuZCAldSIsIGNtZENvZGUpOworICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICB9CisKKyAgICByZXR1cm4gMDsKK30KKworc3RhdG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X0NvbmZpZ3VyZSBlcnJvcjogaW5wdXQgY2hhbm5lbCBtYXNrKDB4JXgpIG5vdCBzdXBwb3J0ZWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwQ29uZmlnLT5pbnB1dENmZy5jaGFubmVscyk7CisgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgfQorICAgICAgICBwRG93bm1peGVyLT5pbnB1dF9jaGFubmVsX2NvdW50ID0KKyAgICAgICAgICAgICAgICBhdWRpb19jaGFubmVsX2NvdW50X2Zyb21fb3V0X21hc2socENvbmZpZy0+aW5wdXRDZmcuY2hhbm5lbHMpOworICAgIH0KKworICAgIERvd25taXhfUmVzZXQocERvd25taXhlciwgaW5pdCk7CisKKyAgICByZXR1cm4gMDsKK30KKworCisvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKyAqIERvd25taXhfUmVzZXQoKQorICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisgKiBQdXJwb3NlOgorICogIFJlc2V0IGludGVybmFsIHN0YXRlcy4KKyAqCisgKiBJbnB1dHM6CisgKiAgcERvd25taXhlciAgIHBvaW50ZXIgdG8gZG93bm1peCBjb250ZXh0CisgKiAgaW5pdCAgICAgICAgIHRydWUgaWYgY2FsbGVkIGZyb20gaW5pdCBmdW5jdGlvbgorICoKKyAqIE91dHB1dHM6CisqCisgKiBSZXR1cm5zOgorICogIDAgICAgICAgICAgICBpbmRpY2F0ZXMgc3VjY2VzcworICoKKyAqIFNpZGUgRWZmZWN0czoKKyAqCisgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS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yYW0sIHVpbnQzMl90IHNpemUsIHZvaWQgKnBWYWx1ZSkgeworCisgICAgaW50MTZfdCB2YWx1ZTE2OworICAgIEFMT0dWKCJEb3dubWl4X3NldFBhcmFtZXRlciwgY29udGV4dCAlcCwgcGFyYW0gJWQsIHZhbHVlMTYgJWQsIHZhbHVlMzIgJWQiLAorICAgICAgICAgICAgcERvd25taXhlciwgcGFyYW0sICooaW50MTZfdCAqKXBWYWx1ZSwgKihpbnQzMl90ICopcFZhbHVlKTsKKworICAgIHN3aXRjaCAocGFyYW0pIHsKKworICAgICAgY2FzZSBET1dOTUlYX1BBUkFNX1RZUEU6CisgICAgICAgIGlmIChzaXplICE9IHNpemVvZihkb3dubWl4X3R5cGVfdCkpIHsKKyAgICAgICAgICAgIEFMT0dFKCJEb3dubWl4X3NldFBhcmFtZXRlcihET1dOTUlYX1BBUkFNX1RZUEUpIGludmFsaWQgc2l6ZSAldSwgc2hvdWxkIGJlICV6dSIsCisgICAgICAgICAgICAgICAgICAgIHNpemUsIHNpemVvZihkb3dubWl4X3R5cGVfdCkpOworICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgIH0KKyAgICAgICAgdmFsdWUxNiA9ICooaW50MTZfdCAqKXBWYWx1ZTsKKyAgICAgICAgQUxPR1YoInNldCBET1dOTUlYX1BBUkFNX1RZUEUsIHR5cGUgJWQiLCB2YWx1ZTE2KTsKKyAgICAgICAgaWYgKCEoKHZhbHVlMTYgPiBET1dOTUlYX1RZUEVfSU5WQUxJRCkgJiYgKHZhbHVlMTYgPD0gRE9XTk1JWF9UWVBFX0xBU1QpKSkgeworICAgICAgICAgICAgQUxPR0UoIkRvd25taXhfc2V0UGFyYW1ldGVyIGludmFsaWQgRE9XTk1JWF9QQVJBTV9UWVBFIHZhbHVlICVkIiwgdmFsdWUxNik7CisgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHBEb3dubWl4ZXIt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hbXBsZSBhdCBpbmRleCAyIGlzIFJMCisgICAgLy8gc2FtcGxlIGF0IGluZGV4IDMgaXMgUlIKKyAgICBpZiAoYWNjdW11bGF0ZSkgeworICAgICAgICB3aGlsZSAobnVtRnJhbWVzKSB7CisgICAgICAgICAgICAvLyBGTCArIFJMCisgICAgICAgICAgICBwRHN0WzBdID0gY2xhbXBfZmxvYXQocERzdFswXSArICgocFNyY1swXSArIHBTcmNbMl0pIC8gMi4wZikpOworICAgICAgICAgICAgLy8gRlIgKyBSUgorICAgICAgICAgICAgcERzdFsxXSA9IGNsYW1wX2Zsb2F0KHBEc3RbMV0gKyAoKHBTcmNbMV0gKyBwU3JjWzNdKSAvIDIuMGYpKTsKKyAgICAgICAgICAgIHBTcmMgKz0gNDsKKyAgICAgICAgICAgIHBEc3QgKz0gMjsKKyAgICAgICAgICAgIG51bUZyYW1lcy0tOworICAgICAgICB9CisgICAgfSBlbHNlIHsgLy8gc2FtZSBjb2RlIGFzIGFib3ZlIGJ1dCB3aXRob3V0IGFkZGluZyBhbmQgY2xhbXBpbmcgcERzdFtpXSB0byBpdHNlbGYKKyAgICAgICAgd2hpbGUgKG51bUZyYW1lcykgeworICAgICAgICAgICAgLy8gRkwgKyBSTAorICAgICAgICAgICAgcERzdFswXSA9IGNsYW1wX2Zsb2F0KChwU3JjWzBdICsgcFNyY1syXSkgLyAyLjBmKTsKKyAgICAgICAgICAgIC8vIEZSICsgUlIKKyAgICAgICAgICAgIHBEc3RbMV0gPSBjbGFtcF9mbG9hdCgocFNyY1sxXSArIHBTcmNbM10pIC8gMi4wZik7CisgICAgICAgICAgICBwU3JjICs9IDQ7CisgICAgICAgICAgICBwRHN0ICs9IDI7CisgICAgICAgICAgICBudW1GcmFtZXMtLTsKKyAgICAgICAgfQorICAgIH0KK30KKworLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t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ZGV4IDIgaXMgRkMKKyAgICAvLyBzYW1wbGUgYXQgaW5kZXggMyBpcyBMRkUKKyAgICAvLyBzYW1wbGUgYXQgaW5kZXggNCBpcyBSTAorICAgIC8vIHNhbXBsZSBhdCBpbmRleCA1IGlzIFJSCisgICAgLy8gY29kZSBpcyBtb3N0bHkgZHVwbGljYXRlZCBiZXR3ZWVuIHRoZSB0d28gdmFsdWVzIG9mIGFjY3VtdWxhdGUgdG8gYXZvaWQgcmVwZWF0aW5nIHRoZSB0ZXN0CisgICAgLy8gZm9yIGV2ZXJ5IHNhbXBsZQorICAgIGlmIChhY2N1bXVsYXRlKSB7CisgICAgICAgIHdoaWxlIChudW1GcmFtZXMpIHsKKyAgICAgICAgICAgIC8vIGNlbnRlclBsdXNMZmVDb250cmliID0gRkMoLTNkQikgKyBMRkUoLTNkQikKKyAgICAgICAgICAgIGNlbnRlclBsdXNMZmVDb250cmliID0gKHBTcmNbMl0gKiBNSU5VU18zX0RCX0lOX0ZMT0FUKQorICAgICAgICAgICAgICAgICAgICArIChwU3JjWzNdICogTUlOVVNfM19EQl9JTl9GTE9BVCk7CisgICAgICAgICAgICAvLyBGTCArIGNlbnRlclBsdXNMZmVDb250cmliICsgUkwKKyAgICAgICAgICAgIGx0ID0gcFNyY1swXSArIGNlbnRlclBsdXNMZmVDb250cmliICsgcFNyY1s0XTsKKyAgICAgICAgICAgIC8vIEZSICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyBSUgorICAgICAgICAgICAgcnQgPSBwU3JjWzFdICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyBwU3JjWzVdOworICAgICAgICAgICAgLy8gYWNjdW11bGF0ZSBpbiBkZXN0aW5hdGlvbgorICAgICAgICAgICAgcERzdFswXSA9IGNsYW1wX2Zsb2F0KHBEc3RbMF0gKyAobHQgLyAyLjBmKSk7CisgICAgICAgICAgICBwRHN0WzFdID0gY2xhbXBfZmxvYXQocERzdFsxXSArIChydCAvIDIuMGYpKTsKKyAgICAgICAgICAgIHBTcmMgKz0gNjsKKyAgICAgICAgICAgIHBEc3QgKz0gMjsKKyAgICAgICAgICAgIG51bUZyYW1lcy0tOworICAgICAgICB9CisgICAgfSBlbHNlIHsgLy8gc2FtZSBjb2RlIGFzIGFib3ZlIGJ1dCB3aXRob3V0IGFkZGluZyBhbmQgY2xhbXBpbmcgcERzdFtpXSB0byBpdHNlbGYKKyAgICAgICAgd2hpbGUgKG51bUZyYW1lcykgeworICAgICAgICAgICAgLy8gY2VudGVyUGx1c0xmZUNvbnRyaWIgPSBGQygtM2RCKSArIExGRSgtM2RCKQorICAgICAgICAgICAgY2VudGVyUGx1c0xmZUNvbnRyaWIgPSAocFNyY1syXSAqIE1JTlVTXzNfREJfSU5fRkxPQVQpCisgICAgICAgICAgICAgICAgICAgICsgKHBTcmNbM10gKiBNSU5VU18zX0RCX0lOX0ZMT0FUKTsKKyAgICAgICAgICAgIC8vIEZMICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyBSTAorICAgICAgICAgICAgbHQgPSBwU3JjWzBdICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyBwU3JjWzRdOworICAgICAgICAgICAgLy8gRlIgKyBjZW50ZXJQbHVzTGZlQ29udHJpYiArIFJSCisgICAgICAgICAgICBydCA9IHBTcmNbMV0gKyBjZW50ZXJQbHVzTGZlQ29udHJpYiArIHBTcmNbNV07CisgICAgICAgICAgICAvLyBzdG9yZSBpbiBkZXN0aW5hdGlvbgorICAgICAgICAgICAgcERzdFswXSA9IGNsYW1wX2Zsb2F0KGx0IC8gMi4wZik7IC8vIGRpZmZlcnMgZnJvbSB3aGVuIGFjY3VtdWxhdGUgaXMgdHJ1ZSBhYm92ZQorICAgICAgICAgICAgcERzdFsxXSA9IGNsYW1wX2Zsb2F0KHJ0IC8gMi4wZik7IC8vIGRpZmZlcnMgZnJvbSB3aGVuIGFjY3VtdWxhdGUgaXMgdHJ1ZSBhYm92ZQorICAgICAgICAgICAgcFNyYyArPSA2OworICAgIC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lIKKyAgICAgICAgICAgIHJ0ID0gcFNyY1sxXSArIGNlbnRlclBsdXNMZmVDb250cmliICsgcFNyY1s3XSArIHBTcmNbNV07CisgICAgICAgICAgICAvL2FjY3VtdWxhdGUgaW4gZGVzdGluYXRpb24KKyAgICAgICAgICAgIHBEc3RbMF0gPSBjbGFtcF9mbG9hdChwRHN0WzBdICsgKGx0IC8gMi4wZikpOworICAgICAgICAgICAgcERzdFsxXSA9IGNsYW1wX2Zsb2F0KHBEc3RbMV0gKyAocnQgLyAyLjBmKSk7CisgICAgICAgICAgICBwU3JjICs9IDg7CisgICAgICAgICAgICBwRHN0ICs9IDI7CisgICAgICAgICAgICBudW1GcmFtZXMtLTsKKyAgICAgICAgfQorICAgIH0gZWxzZSB7IC8vIHNhbWUgY29kZSBhcyBhYm92ZSBidXQgd2l0aG91dCBhZGRpbmcgYW5kIGNsYW1waW5nIHBEc3RbaV0gdG8gaXRzZWxmCisgICAgICAgIHdoaWxlIChudW1GcmFtZXMpIHsKKyAgICAgICAgICAgIC8vIGNlbnRlclBsdXNMZmVDb250cmliID0gRkMoLTNkQikgKyBMRkUoLTNkQikKKyAgICAgICAgICAgIGNlbnRlclBsdXNMZmVDb250cmliID0gKHBTcmNbMl0gKiBNSU5VU18zX0RCX0lOX0ZMT0FUKQorICAgICAgICAgICAgICAgICAgICArIChwU3JjWzNdICogTUlOVVNfM19EQl9JTl9GTE9BVCk7CisgICAgICAgICAgICAvLyBGTCArIGNlbnRlclBsdXNMZmVDb250cmliICsgU0wgKyBSTAorICAgICAgICAgICAgbHQgPSBwU3JjWzBdICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyBwU3JjWzZdICsgcFNyY1s0XTsKKyAgICAgICAgICAgIC8vIEZSICsgY2VudGVyUGx1c0xmZUNvbnRyaWIgKyBTUiArIFJSCisgICAgICAgICAgICBydCA9IHBTcmNbMV0gKyBjZW50ZXJQbHVzTGZlQ29udHJpYiArIHBTcmNbN10gKyBwU3JjWzVdOworICAgIC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MC4zNTMgMC41CisgICAgLy8gICAgICAgMC41IDAuMzUzIDAuMzUzICAgICAwLjUgMC4zNTMgICAgIDAuNQorCisgICAgLy8gZGVyaXZlIHRoZSBpbmRpY2VzIGZvciB0aGUgdHJhbnNmZXIgbWF0cml4IGNvbHVtbnMgdGhhdCBoYXZlIG5vbi16ZXJvIHZhbHVlcy4KKyAgICBpbnQgaW5kZXhGTCA9IC0xOworICAgIGludCBpbmRleEZSID0gLTE7CisgICAgaW50IGluZGV4RkMgPSAtMTsKKyAgICBpbnQgaW5kZXhMRkUgPSAtMTsKKyAgICBpbnQgaW5kZXhCTCA9IC0xOworICAgIGludCBpbmRleEJSID0gLTE7CisgICAgaW50IGluZGV4QkMgPSAtMTsKKyAgICBpbnQgaW5kZXhTTCA9IC0xOworICAgIGludCBpbmRleFNSID0gLTE7CisgICAgaW50IGluZGV4ID0gMDsKKyAgICBmb3IgKHVuc2lnbmVkIHRtcCA9IG1hc2s7CisgICAgICAgICAodG1wICYgKEFVRElPX0NIQU5ORUxfT1VUXzdQT0lOVDEgfCBBVURJT19DSEFOTkVMX09VVF9CQUNLX0NFTlRFUikpICE9IDA7CisgICAgICAgICArK2luZGV4KSB7CisgICAgICAgIGNvbnN0IHVuc2lnbmVkIGxvd2VzdEJpdCA9IHRtcCAmIC0oc2lnbmVkKXRtcDsKKyAgICAgICAgc3dpdGNoIChsb3dlc3RCaXQpIHsKKyAgICAgICAgY2FzZSBBVURJT19DSEFOTkVMX09VVF9GUk9OVF9MRUZUOgorICAgICAgICAgICAgaW5kZXhGTCA9IGluZGV4OworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQVVESU9fQ0hBTk5FTF9PVVRfRlJPTlRfUklHSFQ6CisgICAgICAgICAgICBpbmRleEZSID0gaW5kZXg7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBVURJT19DSEFOTkVMX09VVF9GUk9OVF9DRU5URVI6CisgICAgICAgICAgICBpbmRleEZDID0gaW5kZXg7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBVURJT19DSEFOTkVMX09VVF9MT1dfRlJFUVVFTkNZOgorICAgICAgICAgICAgaW5kZXhMRkUgPSBpbmRleDsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFVRElPX0NIQU5ORUxfT1VUX0JBQ0tfTEVGVDoKKyAgICAgICAgICAgIGluZGV4QkwgPSBpbmRleDsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFVRElPX0NIQU5ORUxfT1VUX0JBQ0tfUklHSFQ6CisgICAgICAgICAgICBpbmRleEJSID0gaW5kZXg7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBVURJT19DSEFOTkVMX09VVF9CQUNLX0NFTlRFUjoKKyAgICAgICAgICAgIGluZGV4QkMgPSBpbmRleDsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFVRElPX0NIQU5ORUxfT1VUX1NJREVfTEVGVDoKKyAgICAgICAgICAgIGluZGV4U0wgPSBpbmRleDsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFVRElPX0NIQU5ORUxfT1VUX1NJREVfUklHSFQ6CisgICAgICAgICAgICBpbmRleFNSID0gaW5kZXg7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICB0bXAgXj0gbG93ZXN0Qml0OworICAgIH0KKworICAgIC8vIFdpdGggZ29vZCBicmFuY2ggcHJlZGljdGlvbiwgdGhpcyBzaG91bGQgcnVuIHJlYXNvbmFibHkgZmFzdC4KKyAgICAvLyBBbHNvIGNvbnNpZGVyIHVzaW5nIGEgdHJhbnNmZXIgbWF0cml4IGZvcm0uCisgICAgd2hpbGUgKG51bUZyYW1lcykgeworICAgICAgICAvLyBjb21wdXRlIGNvbnRyaWJ1dGlvbiBvZiBGQywgQkMgYW5kIExGRQorICAgICAgICBmbG9hdCBjZW50ZXJzTGZlQ29udHJpYiA9IDA7CisgICAgICAgIGlmIChpbmRleEZDID49IDApIGNlbnRlcnNMZmVDb250cmliID0gcFNyY1tpbmRleEZDXTsKKyAgICAgICAgaWYgKGluZGV4TEZFID49IDApIGNlbnRlcnNMZmVDb250cmliICs9IHBTcmNbaW5kZXhMRkVdOworICAgICAgICBpZiAoaW5kZXhCQyA+PSAwKSBjZW50ZXJzTGZlQ29udHJpYiArPSBwU3JjW2luZGV4QkNdOworICAgICAgICBjZW50ZXJzTGZlQ29udHJpYiAqPSBNSU5VU18zX0RCX0lOX0ZMT0FUOworCisgICAgICAgIGZsb2F0IGNoWzJdOworICAgICAgICBjaFswXSA9IGNlbnRlcnNMZmVDb250cmliOworICAgICAgICBjaFsxXSA9IGNlbnRlcnNMZmVDb250cmliOworCisgICAgICAgIC8vIG1peCBpbiBsZWZ0IC8gcmlnaHQgY2hhbm5lbHMKKyAgICAgICAgaWYgKGluZGV4RkwgPj0gMCkgY2hbMF0gKz0gcFNyY1tpbmRleEZMXTsKKyAgICAgICAgaWYgKGluZGV4RlIgPj0gMCkgY2hbMV0gKz0gcFNyY1tpbmRleEZSXTsKKworICAgICAgICBpZiAoaW5kZXhTTCA+PSAwKSBjaFswXSArPSBwU3JjW2luZGV4U0xdOworICAgICAgICBpZiAoaW5kZXhTUiA+PSAwKSBjaFsxXSArPSBwU3JjW2luZGV4U1JdOyAvLyBub3RlIHBhaXIgY2hlY2tzIGVuZm9yY2UgdGhpcyBpZiBpbmRleFNMICE9IDAKKworICAgICAgICBpZiAoaW5kZXhCTCA+PSAwKSBjaFswXSArPSBwU3JjW2luZGV4QkxdOworICAgICAgICBpZiAoaW5kZXhCUiA+PSAwKSBjaFsxXSArPSBwU3JjW2luZGV4QlJdOyAvLyBub3RlIHBhaXIgY2hlY2tzIGVuZm9yY2UgdGhpcyBpZiBpbmRleEJMICE9IDAKKworICAgICAgICAvLyBzY2FsZSB0byBwcmV2ZW50IG92ZXJmbG93LgorICAgICAgICBjaFswXSAqPSAwLjVmOworICA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aWNhYmxlX2xpY2Vuc2VzOiBbCisgICAgICAgICJmcmFtZXdvcmtzX2F2X21lZGlhX2xpYmVmZmVjdHNfZG93bm1peF9saWNlbnNlIiwKKyAgICBdLAorfQorCitjY19iZW5jaG1hcmsgeworICAgIG5hbWU6ICJkb3dubWl4X2JlbmNobWFyayIsCisgICAgaG9zdF9zdXBwb3J0ZWQ6IGZhbHNlLAorICAgIHZlbmRvcjogdHJ1ZSwKKyAgICBpbmNsdWRlX2RpcnM6IFsKKyAgICAgICAgImZyYW1ld29ya3MvYXYvbWVkaWEvbGliZWZmZWN0cy9kb3dubWl4IiwKKyAgICBdLAorICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJhdWRpb2VmZmVjdHMiLAorICAgIF0sCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmxvZyIsCisgICAgXSwKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGliYXVkaW91dGlscyIsCisgICAgICAgICJsaWJkb3dubWl4IiwKKyAgICBdLAorICAgIHNyY3M6IFsKKyAgICAgICAgImRvd25taXhfYmVuY2htYXJrLmNwcCIsCisgICAgXSwKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1XYWxsIiwKKyAgICAgICAgIi1XZXJyb3IiLAorICAgICAgICAiLVdleHRyYSIsCisgICAgXSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvZG93bm1peC9iZW5jaG1hcmsvZG93bm1peF9iZW5jaG1hcmsuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9kb3dubWl4L2JlbmNobWFyay9kb3dubWl4X2JlbmNobWFyay5jcHAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uZWUxNjljMgotLS0gL2Rldi9udWxsCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvZG93bm1peC9iZW5jaG1hcmsvZG93bm1peF9iZW5jaG1hcmsuY3BwCkBAIC0wLDAgKzEsMj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gICAgMTUwOSBucyAgICAgICA0NjM0NTEKKyAgI0JNX0Rvd25taXgvNyAgICAgMTUxNiBucyAgICAxNTExIG5zICAgICAgIDQ2Mzg5OQorICAjQk1fRG93bm1peC84ICAgICA0NDQ1IG5zICAgIDQ0MzEgbnMgICAgICAgMTU3ODMxCisgICNCTV9Eb3dubWl4LzkgICAgIDUwODEgbnMgICAgNTA2NSBucyAgICAgICAxMzg0MTIKKyAgI0JNX0Rvd25taXgvMTAgICAgNDM1NCBucyAgICA0MzQxIG5zICAgICAgIDE2MTI0NworICAjQk1fRG93bm1peC8xMSAgICA0NDExIG5zICAgIDQzOTcgbnMgICAgICAgMTU4ODkzCisgICNCTV9Eb3dubWl4LzEyICAgIDQ0MzQgbnMgICAgNDQyMCBucyAgICAgICAxNTc5OTIKKyAgI0JNX0Rvd25taXgvMTMgICAgNDg0NSBucyAgICA0ODMwIG5zICAgICAgIDE0NDg3MworICAjQk1fRG93bm1peC8xNCAgICA0ODUxIG5zICAgIDQ4MzUgbnMgICAgICAgMTQ0OTU0CisgICNCTV9Eb3dubWl4LzE1ICAgIDQ4ODQgbnMgICAgNDg3MCBucyAgICAgICAxNDQyMzMKKyAgI0JNX0Rvd25taXgvMTYgICAgNTgzMiBucyAgICA1ODEzIG5zICAgICAgIDEyMDU2NQorICAjQk1fRG93bm1peC8xNyAgICA1MjQxIG5zICAgIDUyMjQgbnMgICAgICAgMTMzOTI3CisgICNCTV9Eb3dubWl4LzE4ICAgIDUwNDQgbnMgICAgNTAyOCBucyAgICAgICAxMzkxMzEKKyAgI0JNX0Rvd25taXgvMTkgICAgNTI0NCBucyAgICA1MjI3IG5zICAgICAgIDEzMjMxNQorICAjQk1fRG93bm1peC8yMCAgICA1OTQzIG5zICAgIDU5MjMgbnMgICAgICAgMTE3NzU5CisgICNCTV9Eb3dubWl4LzIxICAgIDU5OTAgbnMgICAgNTk3MSBucyAgICAgICAxMTcyNjMKKyAgI0JNX0Rvd25taXgvMjIgICAgNDQ2OCBucyAgICA0NDU0IG5zICAgICAgIDE1NjY4OQorICAjQk1fRG93bm1peC8yMyAgICA3MzA2IG5zICAgIDcyODYgbnMgICAgICAgIDk1OTExCistLQorZG93bm1peF9iZW5jaG1hcms6IChnZW5lcmljIGZvbGQpCisgICNCTV9Eb3dubWl4LzAgICAgIDQ3MjIgbnMgICAgNDcwNyBucyAgICAgICAxNDk4NDcKKyAgI0JNX0Rvd25taXgvMSAgICAgNDcxNCBucyAgICA0Njk4IG5zICAgICAgIDE0ODc0OAorICAjQk1fRG93bm1peC8yICAgICA0Nzk0IG5zICAgIDQ3NzkgbnMgICAgICAgMTQ1NjYxCisgICNCTV9Eb3dubWl4LzMgICAgIDUwNTMgbnMgICAgNTAzNSBucyAgICAgICAxMzkxNzIKKyAgI0JNX0Rvd25taXgvNCAgICAgNDY5NSBucyAgICA0Njc4IG5zICAgICAgIDE0OTc2MgorICAjQk1fRG93bm1peC81ICAgICA0MzgxIG5zICAgIDQzNjggbnMgICAgICAgMTU5Njc1CisgICNCTV9Eb3dubWl4LzYgICAgIDQzODcgbnMgICAgNDM3MyBucyAgICAgICAxNjAyNjcKKyAgI0JNX0Rvd25taXgvNyAgICAgNDczMiBucyAgICA0NzE3IG5zICAgICAgIDE0ODUxNAorICAjQk1fRG93bm1peC84ICAgICA0NDMwIG5zICAgIDQ0MTUgbnMgICAgICAgMTU4MTMzCisgICNCTV9Eb3dubWl4LzkgICAgIDUxMDEgbnMgICAgNTA4NCBucyAgICAgICAxMzgzNTMKKyAgI0JNX0Rvd25taXgvMTAgICAgNDM1NiBucyAgICA0MzQzIG5zICAgICAgIDE2MDgyMQorICAjQk1fRG93bm1peC8xMSAgICA0Mzk3IG5zICAgIDQzODMgbnMgICAgICAgMTU5OTk1CisgICNCTV9Eb3dubWl4LzEyICAgIDQ0MzggbnMgICAgNDQyNCBucyAgICAgICAxNTgxMTcKKyAgI0JNX0Rvd25taXgvMTMgICAgNTI0MyBucyAgICA1MjI2IG5zICAgICAgIDEzMzg2MworICAjQk1fRG93bm1peC8xNCAgICA1MjU5IG5zICAgIDUyNDIgbnMgICAgICAgMTMxODU1CisgICNCTV9Eb3dubWl4LzE1ICAgIDUyNDUgbnMgICAgNTIyOCBucyAgICAgICAxMzM2ODYKKyAgI0JNX0Rvd25taXgvMTYgICAgNTgyOSBucyAgICA1ODA5IG5zICAgICAgIDEyMDU0MworICAjQk1fRG93bm1peC8xNyAgICA1MjQ1IG5zICAgIDUyMjggbnMgICAgICAgMTMzNTMzCisgICNCTV9Eb3dubWl4LzE4ICAgIDU5MzUgbnMgICAgNTkxNiBucyAgICAgICAxMTgyODIKKyAgI0JNX0Rvd25taXgvMTkgICAgNTI2MyBucyAgICA1MjQ1IG5zICAgICAgIDEzMzY1NworICAjQk1fRG93bm1peC8yMCAgICA1OTk4IG5zICAgIDU5NzggbnMgICAgICAgMTE0NjkzCisgICNCTV9Eb3dubWl4LzIxICAgIDU5ODkgbnMgICAgNTk2OSBucyAgICAgICAxMTc0NTAKKyAgI0JNX0Rvd25taXgvMjIgICAgNDQ0MiBucyAgICA0NDMxIG5zICAgICAgIDE1NzkxMworICAjQk1fRG93bm1peC8yMyAgICA3MzA5IG5zICAgIDcyOTAgbnMgICAgICAgIDk1Nzk3CisqLworCitzdGF0aWMgdm9pZCBCTV9Eb3dubWl4KGJlbmNobWFyazo6U3RhdGUmIHN0YXRlKSB7CisgICAgY29uc3QgYXVkaW9fY2hhbm5lbF9tYXNrX3QgY2hhbm5lbE1hc2sgPSBrQ2hhbm5lbFBvc2l0aW9uTWFza3Nbc3RhdGUucmFuZ2UoMCldOworICAgIGNvbnN0IHNpemVfdCBjaGFubmVsQ291bnQgPSBhdWRpb19jaGFubmVsX2NvdW50X2Zyb21fb3V0X21hc2soY2hhbm5lbE1hc2spOworICAgIGNvbnN0IGludCBzYW1wbGVSYXRlID0gNDgwMDA7CisKKyAgICAvLyBJbml0aWFsaXplIGlucHV0IGJ1ZmZlciB3aXRoIGRldGVybWluaXN0aWMgcHNldWRvL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l6ZW9mKGVmZmVjdF9jb25maWdfdCksCisgICAgICAgICAgICAgICAgICAgICZjb25maWcsICZyZXBseVNpemUsICZyZXBseSk7CisgICAgICAgIHN0YXR1cyAhPSAwKSB7CisgICAgICAgIEFMT0dFKCJjb21tYW5kIHJldHVybmVkIGFuIGVycm9yID0gJWRcbiIsIHN0YXR1cyk7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICBpZiAoaW50IHN0YXR1cyA9ICgqZWZmZWN0SGFuZGxlKQorICAgICAgICAgICAgLT5jb21tYW5kKGVmZmVjdEhhbmRsZSwgRUZGRUNUX0NNRF9FTkFCTEUsIDAsIG51bGxwdHIsICZyZXBseVNpemUsICZyZXBseSk7CisgICAgICAgIHN0YXR1cyAhPSAwKSB7CisgICAgICAgIEFMT0dFKCJDb21tYW5kIGVuYWJsZSBjYWxsIHJldHVybmVkIGVycm9yICVkXG4iLCByZXBseSk7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICAvLyBSdW4gdGhlIHRlc3QKKyAgICBmb3IgKGF1dG8gXyA6IHN0YXRlKSB7CisgICAgICAgIGJlbmNobWFyazo6RG9Ob3RPcHRpbWl6ZShpbnB1dC5kYXRhKCkpOworICAgICAgICBiZW5jaG1hcms6OkRvTm90T3B0aW1pemUob3V0cHV0LmRhdGEoKSk7CisKKyAgICAgICAgYXVkaW9fYnVmZmVyX3QgaW5CdWZmZXIgPSB7LmZyYW1lQ291bnQgPSBrRnJhbWVDb3VudCwgLmYzMiA9IGlucHV0LmRhdGEoKX07CisgICAgICAgIGF1ZGlvX2J1ZmZlcl90IG91dEJ1ZmZlciA9IHsuZnJhbWVDb3VudCA9IGtGcmFtZUNvdW50LCAuZjMyID0gb3V0cHV0LmRhdGEoKX07CisgICAgICAgICgqZWZmZWN0SGFuZGxlKS0+cHJvY2VzcyhlZmZlY3RIYW5kbGUsICZpbkJ1ZmZlciwgJm91dEJ1ZmZlcik7CisKKyAgICAgICAgYmVuY2htYXJrOjpDbG9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JlYXRzIE1PTk8gYXMgRlJPTlRfTEVGVCBvbmx5LgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoZSBBdWRpb01peGVyIGludGVycHJldHMgTU9OTyBhcyBhIHNwZWNpYWwgY2FzZSByZXF1aXJpbmcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjaGFubmVsIHJlcGxpY2F0aW9uLCBieXBhc3NpbmcgdGhlIGRvd25taXggZWZmZWN0LgorICAgIEFVRElPX0NIQU5ORUxfT1VUX0ZST05UX0NFTlRFUiwKKyAgICBBVURJT19DSEFOTkVMX09VVF9TVEVSRU8sCisgICAgQVVESU9fQ0hBTk5FTF9PVVRfMlBPSU5UMSwKKyAgICBBVURJT19DSEFOTkVMX09VVF8yUE9JTlQwUE9JTlQyLAorICAgIEFVRElPX0NIQU5ORUxfT1VUX1FVQUQsCisgICAgQVVESU9fQ0hBTk5FTF9PVVRfUVVBRF9CQUNLLAorICAgIEFVRElPX0NIQU5ORUxfT1VUX1FVQURfU0lERSwKKyAgICBBVURJT19DSEFOTkVMX09VVF9TVVJST1VORCwKKyAgICBBVURJT19DSEFOTkVMX09VVF8yUE9JTlQxUE9JTlQyLAorICAgIEFVRElPX0NIQU5ORUxfT1VUXzNQT0lOVDBQT0lOVDIsCisgICAgQVVESU9fQ0hBTk5FTF9PVVRfUEVOVEEsCisgICAgQVVESU9fQ0hBTk5FTF9PVVRfM1BPSU5UMVBPSU5UMiwKKyAgICBBVURJT19DSEFOTkVMX09VVF81UE9JTlQxLAorICAgIEFVRElPX0NIQU5ORUxfT1VUXzVQT0lOVDFfQkFDSywKKyAgICBBVURJT19DSEFOTkVMX09VVF81UE9JTlQxX1NJREUsCisgICAgQVVESU9fQ0hBTk5FTF9PVVRfNlBPSU5UMSwKKyAgICBBVURJT19DSEFOTkVMX09VVF81UE9JTlQxUE9JTlQyLAorICAgIEFVRElPX0NIQU5ORUxfT1VUXzdQT0lOVDEsCisgICAgQVVESU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isKKyAgICB2b2lkIHRlc3RCYWxhbmNlKGludCBzYW1wbGVSYXRlLCBhdWRpb19jaGFubmVsX21hc2tfdCBjaGFubmVsTWFzaykgeworICAgICAgICB1c2luZyBuYW1lc3BhY2UgOjphbmRyb2lkOjphdWRpb191dGlsczo6Y2hhbm5lbHM7CisKKyAgICAgICAgc2l6ZV90IGZyYW1lcyA9IDEwMDsKKyAgICAgICAgdW5zaWduZWQgb3V0Q2hhbm5lbHMgPSAyOworICAgICAgICB1bnNpZ25lZCBpbkNoYW5uZWxzID0gYXVkaW9fY2hhbm5lbF9jb3VudF9mcm9tX291dF9tYXNrKGNoYW5uZWxNYXNrKTsKKyAgICAgICAgc3RkOjp2ZWN0b3I8ZmxvYXQ+IGlucHV0KGZyYW1lcyAqIGluQ2hhbm5lbHMpOworICAgICAgICBzdGQ6OnZlY3RvcjxmbG9hdD4gb3V0cHV0KGZyYW1lcyAqIG91dENoYW5uZWxzKTsKKworICAgICAgICBkb3VibGUgc2F2ZWRQb3dlclszMl1bMl17fTsKKyAgICAgICAgZm9yICh1bnNpZ25lZCBpID0gMCwgY2hhbm5lbCA9IGNoYW5uZWxNYXNrOyBjaGFubmVsICE9IDA7ICsraSkgeworICAgICAgICAgICAgY29uc3QgaW50IGluZGV4ID0gX19idWlsdGluX2N0eihjaGFubmVsKTsKKyAgICAgICAgICAgIEFTU0VSVF9MVChpbmRleCwgRkNDXzI0KTsKKyAgICAgICAgICAgIGNvbnN0IGludCBwYWlySW5kZXggPSBwYWlySWR4RnJvbUNoYW5uZWxJZHgoaW5kZXgpOworICAgICAgICAgICAgY29uc3QgQVVESU9fR0VPTUVUUllfU0lERSBzaWRlID0gc2lkZUZyb21DaGFubmVsSWR4KGluZGV4KTsKKyAgICAgICAgICAgIGNvbnN0IGludCBjaGFubmVsQml0ID0gMSA8PCBpbmRleDsKKyAgICAgICAgICAgIGNoYW5uZWwgJj0gfmNoYW5uZWxCaXQ7CisKKyAgICAgICAgICAgIC8vIEdlbmVyYX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mIHBhaXJJbmRleCA8IGluZGV4KSB7CisgICAgICAgICAgICAgICAgRVhQRUNUX05FQVJfRVBTSUxPTihwb3dlclswXSwgc2F2ZWRQb3dlcltwYWlySW5kZXhdWzFdKTsKKyAgICAgICAgICAgICAgICBFWFBFQ1RfTkVBUl9FUFNJTE9OKHBvd2VyWzFdLCBzYXZlZFBvd2VyW3BhaXJJbmRleF1bMF0pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc2F2ZWRQb3dlcltpbmRleF1bMF0gPSBwb3dlclswXTsKKyAgICAgICAgICAgIHNhdmVkUG93ZXJbaW5kZXhdWzFdID0gcG93ZXJbMV07CisKKyAgICAgICAgICAgIC8vIENvbmZpcm0gZXhhY3RseSB0aGUgbWl4IGFtb3VudCBwcmVzY3JpYmVkIGJ5IHRoZSBleGlzdGluZyBkb3dubWl4IGVmZmVjdC4KKyAgICAgICAgICAgIC8vIEZvciBmdXR1cmUgY2hhbmdlcyB0byB0aGUgZG93bm1peCBlZmZlY3QsIHRoZSBuZWFybmVzcyBuZWVkcyB0byBiZSByZWxheGVkCisgICAgICAgICAgICAvLyB0byBjb21wYXJlIGJlaGF2aW9yIFMgb3IgZWFybGllci4KKyAgICAgICAgICAgIGlmICgoY2hhbm5lbEJpdCAmIGtDb25zaWRlcmVkQ2hhbm5lbHMpID09IDApIHsKKyAgICAgICAgICAgICAgICAvLyBmb3IgY2hhbm5lbHMgbm90IGNvbnNpZGVyZWQsIGV4cGVjdCAwIHBvd2VyIGZvciBsZWdhY3kgZG93bm1peAorICAgICAgICAgICAgICAgIEVYUEVDVF9FUSgwLmYsIHBvd2VyWzBdKTsKKyAgICAgICAgICAgICAgICBFWFBFQ1RfRVEoMC5mLCBwb3dlclsxXSk7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjb25zdGV4cHIgZmxvYXQgUE9XRVJfVE9MRVJBTkNFID0gMC4wMTsgIC8vIGZvciB2YXJpYW5jZSBzdW0gZXJyb3IuCisgICAgICAgICAgICBzd2l0Y2ggKHNpZGUpIHsKKyAgICAgICAgICAgIGNhc2UgQVVESU9fR0VPTUVUUllfU0lERV9MRUZUOgorICAgICAgICAgICAgICAgIEVYUEVDVF9ORUFSKDAuMjVmLCBwb3dlclswXSwgUE9XRVJfVE9MRVJBTkNFKTsKKyAgICAgICAgICAgICAgICBFWFBFQ1RfRVEoMC5mLCBwb3dlclsxXSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFVRElPX0dFT01FVFJZX1NJREVfUklHSFQ6CisgICAgICAgICAgICAgICAgRVhQRUNUX0VRKDAuZiwgcG93ZXJbMF0pOworICAgICAgICAgICAgICAgIEVYUEVDVF9ORUFSKDAuMjVmLCBwb3dlclsxXSwgUE9XRVJfVE9MRVJBTkNFKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQVVESU9fR0VPTUVUUllfU0lERV9DRU5URVI6CisgICAgICAgICAgICAgICAgRVhQRUNUX05FQVIoMC4xMjVmLCBwb3dlclswXSwgUE9XRVJfVE9MRVJBTkNFKTsKKyAgICAgICAgICAgICAgICBFWFBFQ1RfTkVBUigwLjEyNWYsIHBvd2VyWzFdLCBQT1dFUl9UT0xFUkFOQ0UpOworICAgICAgICAgICAgICAgIEVYUEVDVF9ORUFSX0VQU0lMT04ocG93ZXJbMF0sIHBvd2VyWzFdKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgcnVuKGludCBzYW1wbGVSYXRlLCBhdWRpb19jaGFubmVsX21hc2tfdCBjaGFubmVsTWFzaywKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGZsb2F0PiYgaW5wdXQsIHN0ZDo6dmVjdG9yPGZsb2F0PiYgb3V0cHV0LCBzaXplX3QgZnJhbWVzKSB7CisgICAgICAgIHJlY29uZmlnKHNhbXBsZVJhdGUsIGNoYW5uZWxNYXNrKTsKKworICAgICAgICBBU1NFUlRfRVEoZnJhbWVzICogaW5wdXRDaGFubmVsQ291bnRfLCBpbnB1dC5zaXplKCkpOworICAgICAgICBBU1NFUlRfRVEoZnJhbWVzICogb3V0cHV0Q2hhbm5lbENvdW50Xywgb3V0cHV0LnNpemUoKSk7CisKKyAgICAgICAgY29uc3QgaW50MzJfdCBzZXNzaW9uSWQgPSAwOworICAgICAgICBjb25zdCBpbnQzMl90IGlvSWQgPSAwOworICAgICAgICBpbnQzMl90IGVyciA9IEFVRElPX0VGRkVDVF9MSUJSQVJZX0lORk9fU1lNLmNyZWF0ZV9lZmZlY3QoCisgICAgICAgICAgICAgICAgJmRvd25taXhfdXVpZF8sIHNlc3Npb25JZCwgaW9JZCwgICZoYW5kbGVfKTsKKyAgICAgICAgQVNTRVJUX0VRKDAsIGVycik7CisKKyAgICAgICAgY29uc3Qgc3RydWN0IGVmZmVjdF9pbnRlcmZhY2VfcyAqIGNvbnN0IGRvd25taXhBcGkgPSAqaGFuZGxlXzsKKyAgICAgICAgaW50MzJfdCByZXBseSA9IDA7CisgICAgICAgIHVpbnQzMl90IHJlcGx5U2l6ZSA9ICh1aW50MzJfdClzaXplb2YocmVwbHkpOworICAgICAgICBlcnIgPSAoZG93bm1peEFwaS0+Y29tbWFuZCkoCisgICAgICAgICAgICAgICAgaGFuZGxlXywgRUZGRUNUX0NNRF9TRVRfQ09ORklHLAorICAgICAgICAgICAgICAgIHNpemVvZihlZmZlY3RfY29uZmlnX3QpLCAmY29uZmlnXywgJnJlcGx5U2l6ZSwgJnJlcGx5KTsKKyAgICAgICAgQVNTRVJUX0VRKDAsIGVycik7CisgICAgICAgIGVyciA9IChkb3dubWl4QXBpLT5jb21tYW5kKSgKKyAgICAgICAgICAgICAgICBoYW5kbGVfLCBFRkZFQ1RfQ01EX0VOQUJMRSwKKyAgICAgICAgICAgICAgICAwLCBudWxscHRyLCAmcmVwbHlTaXplLCAmcmVwbHkpOworIC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0cmFuc2ZlciA9IHN0ZDo6bWluKGZyYW1lcyAtIHBvcywgRlJBTUVfTEVOR1RIKTsKKyAgICAgICAgICAgIGF1ZGlvX2J1ZmZlcl90IGluYnVmZmVyey5mcmFtZUNvdW50ID0gdHJhbnNmZXIsCisgICAgICAgICAgICAgICAgLmYzMiA9IGlucHV0LmRhdGEoKSArIHBvcyAqIGlucHV0Q2hhbm5lbENvdW50X307CisgICAgICAgICAgICBhdWRpb19idWZmZXJfdCBvdXRidWZmZXJ7LmZyYW1lQ291bnQgPSB0cmFuc2ZlciwKKyAgICAgICAgICAgICAgICAuZjMyID0gb3V0cHV0LmRhdGEoKSArIHBvcyAqIG91dHB1dENoYW5uZWxDb3VudF99OworICAgICAgICAgICAgY29uc3QgaW50MzJfdCBlcnIgPSAoZG93bm1peEFwaS0+cHJvY2VzcykoaGFuZGxlXywgJmluYnVmZmVyLCAmb3V0YnVmZmVyKTsKKyAgICAgICAgICAgIEFTU0VSVF9FUSgwLCBlcnIpOworICAgICAgICAgICAgcG9zICs9IHRyYW5zZmVyOworICAgICAgICB9CisgICAgfQorCisgICAgZWZmZWN0X2hhbmRsZV90IGhhbmRsZV97fTsKKyAgICBlZmZlY3RfY29uZmlnX3QgY29uZmlnX3t9OworICAgIGludCBvdXRwdXRDaGFubmVsQ291bnRfe307CisgICAgaW50IGlucHV0Q2hhbm5lbENvdW50X3t9OworfTsKKworVEVTVF9QKERvd25taXhUZXN0LCBiYXNpYykgeworICAgIHRlc3RCYWxhbmNlKGtTYW1wbGVSYXRlc1tzdGQ6OmdldDwwPihHZXRQYXJhbSgpKV0sCisgICAgICAgICAgICBrQ2hhbm5lbFBvc2l0aW9uTWFza3Nbc3RkOjpnZXQ8MT4oR2V0UGFyYW0oKSldKTsKK30KKworSU5TVEFOVElBVEVfVEVTVF9TVUlURV9QKAorICAgICAgICBEb3dubWl4VGVzdEFsbCwgRG93bm1peFRlc3QsCisgICAgICAgIDo6dGVzdGluZzo6Q29tYmluZSgKKyAgIC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maWcgIT0gY29uZmlnKSB7CisgICAgICAgIGNvbnRleHQtPnByb2Nlc3NpbmdDaGFpbi5jbGVhcigpOworICAgICAgICBjb250ZXh0LT5wcm9jZXNzb3JzUmVjb3JkLmZpbHRlcnMuY2xlYXIoKTsKKyAgICAgICAgY29udGV4dC0+cHJvY2Vzc29yc1JlY29yZC5yYW1wcy5jbGVhcigpOworICAgICAgICBjb250ZXh0LT5wcm9jZXNzb3JzUmVjb3JkLnNsb3dFbnZzLmNsZWFyKCk7CisgICAgICAgIGNvbnRleHQtPnByb2Nlc3NvcnNSZWNvcmQuZGlzdG9ydGlvbnMuY2xlYXIoKTsKKyAgICAgICAgbWVtY3B5KCZjb250ZXh0LT5jb25maWcsIGNvbmZpZywgc2l6ZW9mKGVmZmVjdF9jb25maWdfdCkpOworICAgICAgICBjb250ZXh0LT5wYXJhbS5hdWRpb0NoYW5uZWxDb3VudCA9IGF1ZGlvX2NoYW5uZWxfY291bnRfZnJvbV9vdXRfbWFzaygKKyAgICAgICAgICAgICAgICAoKGF1ZGlvX2NoYW5uZWxfbWFza190KSBjb25maWctPmlucHV0Q2ZnLmNoYW5uZWxzKSAmIH5BVURJT19DSEFOTkVMX0hBUFRJQ19BTEwpOworICAgICAgICBjb250ZXh0LT5wYXJhbS5oYXB0aWNDaGFubmVsQ291bnQgPSBhdWRpb19jaGFubmVsX2NvdW50X2Zyb21fb3V0X21hc2soCisgICAgICAgICAgICAgICAgKChhdWRpb19jaGFubmVsX21hc2tfdCkgY29uZmlnLT5vdXRwdXRDZmcuY2hhbm5lbHMpICYgQVVESU9fQ0hBTk5FTF9IQVBUSUNfQUxMKTsKKyAgICAgICAgQUxPR19BU1NFUlQoY29udGV4dC0+cGFyYW0uaGFwdGljQ2hhbm5lbENvdW50IDw9IDIsCisgICAgICAgICAgICAgICAgICAgICJoYXB0aWMgY2hhbm5lbCBjb3VudCglenUpIGlzIHRvbyBsYXJnZSIsCisgICAgICAgICAgICAgICAgICAgIGNvbnRleHQtPnBhcmFtLmhhcHRpY0NoYW5uZWxDb3VudCk7CisgICAgICAgIGNvbnRleHQtPmF1ZGlvRGF0YUJ5dGVzUGVyRnJhbWUgPSBhdWRpb19ieXRlc19wZXJfZnJhbWUoCisgICAgICAgICAgICAgICAgY29udGV4dC0+cGFyYW0uYXVkaW9DaGFubmVsQ291bnQsIChhdWRpb19mb3JtYXRfdCkgY29uZmlnLT5pbnB1dENmZy5mb3JtYXQpOworICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IGNvbnRleHQtPnBhcmFtLmhhcHRpY0NoYW5uZWxDb3VudDsgKytpKSB7CisgICAgICAgICAgICAvLyBCeSBkZWZhdWx0LCB1c2UgdGhlIGZpcnN0IGF1ZGlvIGNoYW5uZWwgdG8gZ2VuZXJhdGUgaGFwdGljIGNoYW5uZWxzLgorICAgICAgICAgICAgY29udGV4dC0+cGFyYW0uaGFwdGljQ2hhbm5lbFNvdXJjZVtpXSA9IDA7CisgICAgICAgIH0KKworICAgICAgICBIYXB0aWNHZW5lcmF0b3JfYnVpbGRQcm9jZXNzaW5nQ2hhaW4oY29udGV4dC0+cHJvY2Vzc2luZ0NoYWluLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dC0+cHJvY2Vzc29yc1JlY29yZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy0+aW5wdXRDZmcuc2FtcGxpbmdSYXRlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmNvbnRleHQtPnBhcmFtKTsKKyAgICB9CisgICAgcmV0dXJuIDA7Cit9CisKK2ludCBIYXB0aWNHZW5lcmF0b3JfUmVzZXQoc3RydWN0IEhhcHRpY0dlbmVyYXRvckNvbnRleHQgKmNvbnRleHQpIHsKKyAgICBmb3IgKGF1dG8mIGZpbHRlciA6IGNvbnRleHQtPnByb2Nlc3NvcnNSZWNvcmQuZmlsdGVycykgeworICAgICAgICBmaWx0ZXItPmNsZWFyKCk7CisgICAgfQorICAgIGZvciAoYXV0byYgc2xvd0VudiA6IGNvbnRleHQtPnByb2Nlc3NvcnNSZWNvcmQuc2xvd0VudnMpIHsKKyAgICAgICAgc2xvd0Vudi0+Y2xlYXIoKTsKKyAgICB9CisgICAgZm9yIChhdXRvJiBkaXN0b3J0aW9uIDogY29udGV4dC0+cHJvY2Vzc29yc1JlY29yZC5kaXN0b3J0aW9ucykgeworICAgICAgICBkaXN0b3J0aW9uLT5jbGVhcigpOworICAgIH0KKyAgICByZXR1cm4gMDsKK30KKworaW50IEhhcHRpY0dlbmVyYXRvcl9TZXRQYXJhbWV0ZXIoc3RydWN0IEhhcHRpY0dlbmVyYXRvckNvbnRleHQgKmNvbnRleHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHBhcmFtLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3Qgc2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgKnZhbHVlKSB7CisgICAgc3dpdGNoIChwYXJhbSkgeworICAgIGNhc2UgSEdfUEFSQU1fSEFQVElDX0lOVEVOU0lUWTogeworICAgICAgICBpZiAodmFsdWUgPT0gbnVsbHB0ciB8fCBzaXplICE9ICh1aW50MzJfdCkgKDIgKiBzaXplb2YoaW50KSkpIHsKKyAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgICAgICB9CisgICAgICAgIGludCBpZCA9ICooaW50ICopIHZhbHVlOworICAgICAgICBvczo6SGFwdGljU2NhbGUgaGFwdGljSW50ZW5zaXR5ID0gc3RhdGljX2Nhc3Q8b3M6OkhhcHRpY1NjYWxlPigqKChpbnQgKikgdmFsdWUgKyAxKSk7CisgICAgICAgIGlmIChoYXB0aWNJbnRlbnNpdHkgPT0gb3M6OkhhcHRpY1NjYWxlOjpNVVRFKSB7CisgICAgICAgICAgICBjb250ZXh0LT5wYXJhbS5pZDJJbnRlbnNpdHkuZXJhc2UoaWQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY29udGV4dC0+cGFyYW0uaWQySW50ZW5zaXR5LmVtcGxhY2UoaWQsIGhhcHRpY0ludGVuc2l0eSk7CisgICAgICAgIH0KKyAgICAgICAgY29udGV4dC0+cGFyYW0ubWF4SGFwdGljSW50ZW5zaXR5ID0gaGFwdGljSW50ZW5zaXR5OworICAgICAgICBmb3IgKGNvbnN0IGF1dG8mW2lkLCBpbnRlbnNpdHldIDogY29udGV4dC0+cGFyYW0uaWQySW50ZW5zaXR5KSB7CisgICAgICAgICAgICBjb250ZXh0LT5wYXJhbS5tYXhIYXB0aWNJbnRlbnNpdHkgPSBzdGQ6Om1heCgKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dC0+cGFyYW0ubWF4SGFwdGljSW50ZW5zaXR5LCBpbnRlbnNpdHkpOworICAgICAgICB9CisgICAgICAgIGJyZWFrOworICAgIH0KKyAgICBjYXNlIEhHX1BBUkFNX1ZJQlJBVE9SX0lORk86IHsKKyAgICAgICAgaWYgKHZhbHVlID09IG51bGxwdHIgfHwgc2l6ZSAhPSAyICogc2l6ZW9mKGZsb2F0KSkgeworICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgIH0KKyAgICAgICAgY29uc3QgZmxvYXQgcmVzb25hbnRGcmVxdWVuY3kgPSAqKGZsb2F0KikgdmFsdWU7CisgICAgICAgIGNvbnN0IGZsb2F0IHFGYWN0b3IgPSAqKChmbG9hdCAqKSB2YWx1ZSArIDEpOworICAgICAgICBjb250ZXh0LT5wYXJhbS5yZXNvbmFudEZyZXF1ZW5jeSA9CisgICAgICAgICAgICAgICAgaXNuYW4ocmVzb25hbnRGcmVxdWVuY3kpID8gREVGQVVMVF9SRVNPTkFOVF9GUkVRVUVOQ1kgOiByZXNvbmFudEZyZXF1ZW5jeTsKKyAgICAgICAgY29udGV4dC0+cGFyYW0uYnNmWmVyb1EgPSBpc25hbihxRmFjdG9yKSA/IERFRkFVTFRfQlNGX1BPTEVfUSA6IHFGYWN0b3I7CisgICAgICAgIGNvbnRleHQtPnBhcmFtLmJzZlBvbGVRID0gY29udGV4dC0+cGFyYW0uYnNmWmVyb1EgLyAyLjBmOworCisgICAgICAgIGlmIChjb250ZXh0LT5wcm9jZXNzb3JzUmVjb3JkLmJwZiAhPSBudWxscHRyKSB7CisgICAgICAgICAgICBjb250ZXh0LT5wcm9jZXNzb3JzUmVjb3JkLmJwZi0+c2V0Q29lZmZpY2llbnRzKAorICAgICAgICAgICAgICAgICAgICBicGZDb2Vmcyhjb250ZXh0LT5wYXJhbS5yZXNvbmFudEZyZXF1ZW5jeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dC0+cGFyYW0uYnBmUSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dC0+Y29uZmlnLmlucHV0Q2ZnLnNhbXBsaW5nUmF0ZSkpOworICAgICAgICB9CisgICAgICAgIGlmIChjb250ZXh0LT5wcm9jZXNzb3JzUmVjb3JkLmJzZiAhPSBudWxscHRyKSB7CisgICAgICAgICAgICBjb250ZXh0LT5wcm9jZXNzb3JzUmVjb3JkLmJzZi0+c2V0Q29lZmZpY2llbnRzKAorICAgICAgICAgICAgICAgICAgICBic2ZDb2Vmcyhjb250ZXh0LT5wYXJhbS5yZXNvbmFudEZyZXF1ZW5jeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dC0+cGFyYW0uYnNmWmVyb1EsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQtPnBhcmFtLmJzZlBvbGVRLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0LT5jb25maWcuaW5wdXRDZmcuc2FtcGxpbmdSYXRlKSk7CisgICAgICAgIH0KKyAgICAgICAgSGFwdGljR2VuZXJhdG9yX1Jlc2V0KGNvbnRleHQpOworICAgIH0gYnJlYWs7CisgIC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ckNvbnRleHQ7CisgICAgSGFwdGljR2VuZXJhdG9yX0luaXQoY29udGV4dCk7CisKKyAgICAqaGFuZGxlID0gKGVmZmVjdF9oYW5kbGVfdCkgY29udGV4dDsKKyAgICBBTE9HVigiJXMgY29udGV4dCBpcyAlcCIsIF9fZnVuY19fLCBjb250ZXh0KTsKKyAgICByZXR1cm4gMDsKK30KKworaW50MzJfdCBIYXB0aWNHZW5lcmF0b3JMaWJfUmVsZWFzZShlZmZlY3RfaGFuZGxlX3QgaGFuZGxlKSB7CisgICAgSGFwdGljR2VuZXJhdG9yQ29udGV4dCAqY29udGV4dCA9IChIYXB0aWNHZW5lcmF0b3JDb250ZXh0ICopIGhhbmRsZTsKKyAgICBkZWxldGUgY29udGV4dDsKKyAgICByZXR1cm4gMDsKK30KKworaW50MzJfdCBIYXB0aWNHZW5lcmF0b3JMaWJfR2V0RGVzY3JpcHRvcihjb25zdCBlZmZlY3RfdXVpZF90ICp1dWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlZmZlY3RfZGVzY3JpcHRvcl90ICpkZXNjcmlwdG9yKSB7CisKKyAgICBpZiAoZGVzY3JpcHRvciA9PSBudWxscHRyIHx8IHV1aWQgPT0gbnVsbHB0cikgeworICAgICAgICBBTE9HRSgiJXMoKSBjYWxsZWQgd2l0aCBOVUxMIHBvaW50ZXIiLCBfX2Z1bmNfXyk7CisgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgIH0KKworICAgIGlmIChtZW1jbXAodXVpZCwgJmdIZ0Rlc2NyaXB0b3IudXVpZCwgc2l6ZW9mKCp1dWlkKSkgPT0gMCkgeworICAgICAgICAqZGVzY3JpcHRvciA9IGdIZ0Rlc2NyaXB0b3I7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHJldHVybiAtRUlOVkFMOworfQorCisvKi0tLSBFZmZlY3QgQ29udHJvbCBJbnRlcmZhY2UgSW1wbGVtZW50YXRpb24gLS0tKi8KKworaW50MzJ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mVjdF9oYW5kbGVfdCBzZWxmLCB1aW50MzJfdCBjbWRDb2RlLCB1aW50MzJfdCBjbWRTaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICpjbWREYXRhLCB1aW50MzJfdCAqcmVwbHlTaXplLCB2b2lkICpyZXBseURhdGEpIHsKKyAgICBIYXB0aWNHZW5lcmF0b3JDb250ZXh0ICpjb250ZXh0ID0gKEhhcHRpY0dlbmVyYXRvckNvbnRleHQgKikgc2VsZjsKKworICAgIGlmIChjb250ZXh0ID09IG51bGxwdHIgfHwgY29udGV4dC0+c3RhdGUgPT0gSEFQVElDR0VORVJBVE9SX1NUQVRFX1VOSU5JVElBTElaRUQpIHsKKyAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgfQorCisgICAgQUxPR1YoIkhhcHRpY0dlbmVyYXRvcl9Db21tYW5kIGNvbW1hbmQgJXUgY21kU2l6ZSAldSIsIGNtZENvZGUsIGNtZFNpemUpOworCisgICAgc3dpdGNoIChjbWRDb2RlKSB7CisgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9JTklUOgorICAgICAgICAgICAgaWYgKHJlcGx5RGF0YSA9PSBudWxscHRyIHx8IHJlcGx5U2l6ZSA9PSBudWxscHRyIHx8ICpyZXBseVNpemUgIT0gc2l6ZW9mKGludCkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICooaW50ICopIHJlcGx5RGF0YSA9IEhhcHRpY0dlbmVyYXRvcl9Jbml0KGNvbnRleHQpOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX1NFVF9DT05GSUc6CisgICAgICAgICAgICBpZiAoY21kRGF0YSA9PSBudWxscHRyIHx8IGNtZFNpemUgIT0gc2l6ZW9mKGVmZmVjdF9jb25maWdfdCkKKyAgICAgICAgICAgICAgICB8fCByZXBseURhdGEgPT0gbnVsbHB0ciB8fCByZXBseVNpemUgPT0gbnVsbHB0ciB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAqKGludCAqKSByZXBseURhdGEgPSBIYXB0aWNHZW5lcmF0b3JfQ29uZmlndXJlKAorICAgICAgICAgICAgICAgICAgICBjb250ZXh0LCAoZWZmZWN0X2NvbmZpZ190ICopIGNtZERhdGEpOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX1JFU0VUOgorICAgICAgICAgICAgSGFwdGljR2VuZXJhdG9yX1Jlc2V0KGNvbnRleHQpOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX0dFVF9QQVJBTToKKyAgICAgICAgICAgIEFMT0dWKCJIYXB0aWNHZW5lcmF0b3JfQ29tbWFuZCBFRkZFQ1RfQ01EX0dFVF9QQVJBTSBjbWREYXRhICVwLCIKKyAgICAgICAgICAgICAgICAgICIqcmVwbHlTaXplICV1LCByZXBseURhdGE6ICVwIiwKKyAgICAgICAgICAgICAgICAgIGNtZERhdGEsICpyZXBseVNpemUsIHJlcGx5RGF0YSk7CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX1BBUkFNOiB7CisgICAgICAgICAgICBBTE9HVigiSGFwdGljR2VuZXJhdG9yX0NvbW1hbmQgRUZGRUNUX0NNRF9TRVRfUEFSQU0gY21kU2l6ZSAlZCBjbWREYXRhICVwLCAiCisgICAgICAgICAgICAgICAgICAiKnJlcGx5U2l6ZSAldSwgcmVwbHlEYXRhICVwIiwgY21kU2l6ZSwgY21kRGF0YSwKKyAgICAgICAgICAgICAgICAgIHJlcGx5U2l6ZSA/ICpyZXBseVNpemUgOiAwLCByZXBseURhdGEpOworICAgICAgICAgICAgaWYgKGNtZERhdGEgPT0gbnVsbHB0ciB8fCAoY21kU2l6ZSA8IChpbnQpIChzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgc2l6ZW9mKGludDMyX3QpKSkKKyAgICAgICAgICAgICAgICB8fCByZXBseURhdGEgPT0gbnVsbHB0ciB8fCByZXBseVNpemUgPT0gbnVsbHB0ciB8fAorICAgICAgICAgICAgICAgICpyZXBseVNpemUgIT0gKGludCkgc2l6ZW9mKGludDMyX3QpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlZmZlY3RfcGFyYW1fdCAqY21kID0gKGVmZmVjdF9wYXJhbV90ICopIGNtZERhdGE7CisgICAgICAgICAgICAqKGludCAqKSByZXBseURhdGEgPSBIYXB0aWNHZW5lcmF0b3JfU2V0UGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICBjb250ZXh0LCAqKGludDMyX3QgKikgY21kLT5kYXRhLCBjbWQtPnZzaXplLCBjbWQtPmRhdGEgKyBzaXplb2YoaW50MzJfdCkpOworICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIEVGRkVDVF9DTURfRU5BQkxFOgorICAgICAgICAgICAgaWYgKHJlcGx5RGF0YSA9PSBudWxscHRyIHx8IHJlcGx5U2l6ZSA9PSBudWxscHRyIHx8ICpyZXBseVNpemUgIT0gc2l6ZW9mKGludCkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChjb250ZXh0LT5zdGF0ZSAhPSBIQVBUSUNHRU5FUkFUT1JfU1RBVEVfSU5JVElBTElaRUQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gLUVOT1NZUzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNvbnRleHQtPnN0YXRlID0gSEFQVElDR0VORVJBVE9SX1NUQVRFX0FDVElWRTsKKyAgICAgICAgICAgIEFMT0dWKCJFRkZFQ1RfQ01EX0VOQUJMRSgpIE9LIik7CisgICAgICAgICAgICAqKGludCAqKSByZXBseURhdGEgPSAwOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX0RJU0FCTEU6CisgICAgICAgICAgICBpZiAocmVwbHlEYXRhID09IG51bGxwdHIgfHwgcmVwbHlTaXplID09IG51bGxwdHIgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSkgeworICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGNvbnRleHQtPnN0YXRlICE9IEhBUFRJQ0dFTkVSQVRPUl9TVEFURV9BQ1RJVkUpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gLUVOT1NZUzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNvbnRleHQtPnN0YXRlID0gSEFQVElDR0VORVJBVE9SX1NUQVRFX0lOSVRJQUxJWkVEOworICAgICAgICAgICAgQUxPR1YoIkVGRkVDVF9DTURfRElTQUJMRSgpIE9LIik7CisgICAgICAgICAgICAqKGludCAqKSByZXBseURhdGEgPSAwOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX1NFVF9WT0xVTUU6CisgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9TRVRfREVWSUNFOgorICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX0FVRElPX01PREU6CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgQUxPR1coIkhhcHRpY0dlbmVyYXRvcl9Db21tYW5kIGludmFsaWQgY29tbWFuZCAldSIsIGNtZENvZGUpOworICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgfQorCisgICAgcmV0dXJuIDA7Cit9CisKK2ludDMyX3QgSGFwdGljR2VuZXJhdG9yX0dldERlc2NyaXB0b3IoZWZ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0NyZWF0ZShjb25zdCBlZmZlY3RfdXVpZF90ICp1dWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3Qgc2Vzc2lvbklkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgaW9JZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlZmZlY3RfaGFuZGxlX3QgKmhhbmRsZSk7CisKK2ludDMyX3QgSGFwdGljR2VuZXJhdG9yTGliX1JlbGVhc2UoZWZmZWN0X2hhbmRsZV90IGhhbmRsZSk7CisKK2ludDMyX3QgSGFwdGljR2VuZXJhdG9yTGliX0dldERlc2NyaXB0b3IoY29uc3QgZWZmZWN0X3V1aWRfdCAqdXVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0X2Rlc2NyaXB0b3JfdCAqZGVzY3JpcHRvcik7CisKK2ludDMyX3QgSGFwdGljR2VuZXJhdG9yX1Byb2Nlc3MoZWZmZWN0X2hhbmRsZV90IHNlbGYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2J1ZmZlcl90ICppbkJ1ZmZlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fYnVmZmVyX3QgKm91dEJ1ZmZlcik7CisKK2ludDMyX3QgSGFwdGljR2VuZXJhdG9yX0NvbW1hbmQoZWZmZWN0X2hhbmRsZV90IHNlbGYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGNtZENvZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGNtZFNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgKmNtZERhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICpyZXBseVNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQg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FbMV0gKiBjb2VmczJbMF0sCisgICAgICAgICAgICBjb2VmczFbMV0gKiBjb2VmczJbMV0sCisgICAgICAgICAgICBjb2VmczFbM10gKyBjb2VmczJbM10sCisgICAgICAgICAgICBjb2VmczFbM10gKiBjb2VmczJbM119OworfQorCitCaXF1YWRGaWx0ZXJDb2VmZmljaWVudHMgbHBmQ29lZnMoY29uc3QgZmxvYXQgY29ybmVyRnJlcXVlbmN5LCBjb25zdCBmbG9hdCBzYW1wbGVSYXRlKSB7CisgICAgQmlxdWFkRmlsdGVyQ29lZmZpY2llbnRzIGNvZWZmaWNpZW50OworICAgIGZsb2F0IHJlYWxQb2xlWiA9IGdldFJlYWxQb2xlWihjb3JuZXJGcmVxdWVuY3ksIHNhbXBsZVJhdGUpOworICAgIC8vIFRoaXMgaXMgYSB6ZXJvIGF0IG55cXVpc3QKKyAgICBjb2VmZmljaWVudFswXSA9IDAuNWYgKiAoMSAtIHJlYWxQb2xlWik7CisgICAgY29lZmZpY2llbnRbMV0gPSBjb2VmZmljaWVudFswXTsKKyAgICBjb2VmZmljaWVudFsyXSA9IDAuMGY7CisgICAgY29lZmZpY2llbnRbM10gPSAtcmVhbFBvbGVaOyAvLyBUaGlzIGlzIHRyYWRpdGlvbmFsIDEvKHMrMSkgZmlsdGVyCisgICAgY29lZmZpY2llbnRbNF0gPSAwLjBmOworICAgIHJldHVybiBjb2VmZmljaWVudDsKK30KKworQmlxdWFkRmlsdGVyQ29lZmZpY2llbnRzIGJwZkNvZWZzKGNvbnN0IGZsb2F0IHJpbmdpbmdGcmVxdWVuY3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZmxvYXQgcSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCBzYW1wbGVSYXRlKSB7CisgICAgQmlxdWFkRmlsdGVyQ29lZmZpY2llbnRzIGNvZWZmaWNpZW50OworICAgIGNvbnN0IGF1dG8gW3JlYWwsIGltZ10gP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ZlcjsKKyAgICBmbG9hdCBtU2FtcGxlUmF0ZTsKKyAgICBmbG9hdCBtQ29ybmVyRnJlcXVlbmN5OworICAgIGZsb2F0IG1JbnB1dEdhaW47CisgICAgZmxvYXQgbUN1YmVUaHJlc2hvbGQ7CisgICAgZmxvYXQgbU91dHB1dEdhaW47CisgICAgY29uc3Qgc2l6ZV90IG1DaGFubmVsQ291bnQ7Cit9OworCisvLyBIZWxwZXIgZnVuY3Rpb25zCisKK0JpcXVhZEZpbHRlckNvZWZmaWNpZW50cyBjYXNjYWRlRmlyc3RPcmRlckZpbHRlcnMoY29uc3QgQmlxdWFkRmlsdGVyQ29lZmZpY2llbnRzICZjb2VmczEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEJpcXVhZEZpbHRlckNvZWZmaWNpZW50cyAmY29lZnMyKTsKKworQmlxdWFkRmlsdGVyQ29lZmZpY2llbnRzIGxwZkNvZWZzKGNvbnN0IGZsb2F0IGNvcm5lckZyZXF1ZW5jeSwgY29uc3QgZmxvYXQgc2FtcGxlUmF0ZSk7CisKK0JpcXVhZEZpbHRlckNvZWZmaWNpZW50cyBicGZDb2Vmcyhjb25zdCBmbG9hdCByaW5naW5nRnJlcXVlbmN5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZsb2F0IHEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZmxvYXQgc2FtcGxlUmF0ZSk7CisKK0JpcXVhZEZpbHRlckNvZWZmaWNpZW50cyBic2ZDb2Vmcyhjb25zdCBmbG9hdCByaW5naW5nRnJlcXVlbmN5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZsb2F0IHpxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZsb2F0IHBxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZsb2F0IHNhbXBsZVJhdGUpOworCitzdGQ6OnNoYXJlZF9wdHI8SGFwdGljQmlxdWFkRmlsdGVyPiBjcmVhdGVMUEYoY29uc3QgZmxvYXQgY29ybmVyRnJlcXVlbmN5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZsb2F0IHNhbXBsZVJhdGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2l6ZV90IGNoYW5uZWxDb3VudCk7CisKKy8vIENyZWF0ZSB0d28gY2FzY2FkZWQgTFBGIHdpdGggc2FtZSBjb3JuZXIgZnJlcXVlbmN5Lgorc3RkOjpzaGFyZWRfcHRyPEhhcHRpY0JpcXVhZEZpbHRlcj4gY3JlYXRlTFBGMihjb25zdCBmbG9hdCBjb3JuZXJGcmVxdWVuY3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZsb2F0IHNhbXBsZVJhdGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNpemVfdCBjaGFubmVsQ291bnQpOworCisvLyBDcmVhdGUgdHdvIGNhc2NhZGVkIEhQRiB3aXRoIHNhbWUgY29ybmVyIGZyZXF1ZW5jeS4KK3N0ZDo6c2hhcmVkX3B0cjxIYXB0aWNCaXF1YWRGaWx0ZXI+IGNyZWF0ZUhQRjIoY29uc3QgZmxvYXQgY29ybmVyRnJlcXVlbmN5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCBzYW1wbGVSYXRlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaXplX3QgY2hhbm5lbENvdW50KTsKKworc3RkOjpzaGFyZWRfcHRyPEhhcHRpY0JpcXVhZEZpbHRlcj4gY3JlYXRlQlBGKGNvbnN0IGZsb2F0IHJpbmdpbmdGcmVxdWVuY3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZmxvYXQgcSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCBzYW1wbGVSYXRlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNpemVfdCBjaGFubmVsQ291bnQpOworCitzdGQ6OnNoYXJlZF9wdHI8SGFwdGljQmlxdWFkRmlsdGVyPiBjcmVhdGVCU0YoY29uc3QgZmxvYXQgcmluZ2luZ0ZyZXF1ZW5jeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCB6cSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCBwcSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCBzYW1wbGVSYXRlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNpemVfdCBjaGFubmVsQ291bnQpOworCit9IC8vIG5hbWVzcGFjZSBhbmRyb2lkOjphdWRpb19lZmZlY3Q6OmhhcHRpY19nZW5lcmF0b3IKKworI2VuZGlmIC8vIF9FRkZFQ1RfSEFQVElDX0dFTkVSQVRPUl9QUk9DRVNTT1JTX0hfCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2xvdWRuZXNzL0FuZHJvaWQuYnAgYi9tZWRpYS9saWJlZmZlY3RzL2xvdWRuZXNzL0FuZHJvaWQuYnAKaW5kZXggNWExM2FmNi4uYmNkNjk0NyAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sb3VkbmVzcy9BbmRyb2lkLmJwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbG91ZG5lc3MvQW5kcm9pZC5icApAQCAtMSw0ICsxLDIzIEBACiAvLyBMb3VkbmVzc0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5zZSJdLAorfQorCitjY19iZW5jaG1hcmsgeworICAgIG5hbWU6ICJsdm1fYmVuY2htYXJrIiwKKyAgICB2ZW5kb3I6IHRydWUsCisgICAgaG9zdF9zdXBwb3J0ZWQ6IHRydWUsCisgICAgc3JjczogWyJsdm1fYmVuY2htYXJrLmNwcCJdLAorICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJidW5kbGV3cmFwcGVyIiwKKyAgICAgICAgImxpYm11c2ljYnVuZGxlIiwKKyAgICBdLAorICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJhdWRpb3V0aWxzIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgXSwKKyAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGliaGFyZHdhcmVfaGVhZGVycyIsCisgICAgXSwKK30KKworY2NfYmVuY2htYXJrIHsKKyAgICBuYW1lOiAicmV2ZXJiX2JlbmNobWFyayIsCisgICAgdmVuZG9yOiB0cnVlLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9saWJlZmZlY3RzL2x2bS93cmFwcGVyL1JldmVyYiIsCisgICAgXSwKKyAgICBzcmNzOiBbInJldmVyYl9iZW5jaG1hcmsuY3BwIl0sCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYnJldmVyYiIsCisgICAgICAgICJsaWJyZXZlcmJ3cmFwcGVyIiwKKyAgICBdLAorICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJhdWRpb3V0aWxzIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgXSwKKyAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGliYXVkaW9lZmZlY3RzIiwKKyAgICAgICAgImxpYmhhcmR3YXJlX2hlYWRlcnMiLAorICAgIF0sCit9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9iZW5ja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MgICAgICAgMTk5MTggbnMgICAgICAgIDE5ODYwIG5zICAgICAgICAzNTIzMAorICogQk1fTFZNLzIvMCAgICAgICA2MjQ1NSBucyAgICAgICAgNjIyODMgbnMgICAgICAgIDExMjE0CisgKiBCTV9MVk0vMi8xICAgICAgMTEwMDg2IG5zICAgICAgIDEwOTc1MSBucyAgICAgICAgIDYzNTAKKyAqIEJNX0xWTS8yLzIgICAgICAgNDQwMTcgbnMgICAgICAgIDQzODkwIG5zICAgICAgICAxNTk4MgorICogQk1fTFZNLzIvMyAgICAgICAyMTY2MCBucyAgICAgICAgMjE1OTYgbnMgICAgICAgIDMyNTY4CisgKiBCTV9MVk0vMy8wICAgICAgIDcxOTI1IG5zICAgICAgICA3MTY5OCBucyAgICAgICAgIDk3NDUKKyAqIEJNX0xWTS8zLzEgICAgICAxMTcwNDMgbnMgICAgICAgMTE2NzU0IG5zICAgICAgICAgNjAwNworICogQk1fTFZNLzMvMiAgICAgICA0ODg5OSBucyAgICAgICAgNDg3ODEgbnMgICAgICAgIDE0MzM0CisgKiBCTV9MVk0vMy8zICAgICAgIDIzNjA3IG5zICAgICAgICAyMzU0MCBucyAgICAgICAgMjk3MzkKKyAqIEJNX0xWTS80LzAgICAgICAgODEyOTYgbnMgICAgICAgIDgxMDk1IG5zICAgICAgICAgODYzMgorICogQk1fTFZNLzQvMSAgICAgIDEyMjQzNSBucyAgICAgICAxMjIxMzIgbnMgICAgICAgICA1NzMzCisgKiBCTV9MVk0vNC8yICAgICAgIDUzNzQ0IG5zICAgICAgICA1MzYxMiBucyAgICAgICAgMTMwNjgKKyAqIEJNX0xWTS80LzMgICAgICAgMjU4NDYgbnMgICAgICAgIDI1NzgzIG5zICAgICAgICAyNzE4OAorICogQk1fTFZNLzUvMCAgICAgICA5ODU1NyBucyAgICAgICAgOTgzMTEgbnMgICAgICAgICA3MTIwCisgKiBCTV9MVk0vNS8xICAgICAgMTMxNjI2IG5zICAgICAgIDEzMTI2OSBucyAgICAgICAgIDUyOTYKKyAqIEJNX0xWTS81LzIgICAgICAgNjY4OTIgbnMgICAgICAgIDY2NzMyIG5zICAgICAgICAxMDQ1OAorICogQk1fTFZNLzUvMyAgICAgICAzMTc5NyBucyAgICAgICAgMzE3MjEgbnMgICAgICAgIDIyMDkyCisgKiBCTV9MVk0vNi8wICAgICAgMTExODgwIG5zICAgICAgIDExMTU5NiBucyAgICAgICAgIDYyNzgKKyAqIEJNX0xWTS82LzEgICAgICAxNDAyMDcgbnMgICAgICAgMTM5ODQ2IG5zICAgICAgICAgNTAwMAorICogQk1fTFZNLzYvMiAgICAgICA3NTY4MyBucyAgICAgICAgNzU0OTYgbnMgICAgICAgICA5MjUzCisgKiBCTV9MVk0vNi8zICAgICAgIDM3NjY5IG5zICAgICAgICAzNzU3MSBucyAgICAgICAgMTg2NjMKKyAqIEJNX0xWTS83LzAgICAgICAxMjgyNjUgbnMgICAgICAgMTI3OTU3IG5zICAgICAgICAgNTQ3MAorICogQk1fTFZNLzcvMSAgICAgIDE0OTUyMiBucyAgICAgICAxNDkxNTkgbnMgICAgICAgICA0Njk5CisgKiBCTV9MVk0vNy8yICAgICAgIDkyMDI0IG5zICAgICAgICA5MTc5OCBucyAgICAgICAgIDc2MzEKKyAqIEJNX0xWTS83LzMgICAgICAgNDMzNzIgbnMgICAgICAgIDQzMjY4IG5zICAgICAgICAxNjE4MQorICogQk1fTFZNLzgvMCAgICAgIDE0MTg5NyBucyAgICAgICAxNDE1NDggbnMgICAgICAgICA0OTQ1CisgKiBCTV9MVk0vOC8xICAgICAgMTU4MDYyIG5zICAgICAgIDE1NzY2MSBucyAgICAgICAgIDQ0MzgKKyAqIEJNX0xWTS84LzIgICAgICAgOTgwNDIgbnMgICAgICAgIDk3ODAxIG5zICAgICAgICAgNzE1MQorICogQk1fTFZNLzgvMyAgICAgICA0OTA0NCBucyAgICAgICAgNDg5MjMgbnMgICAgICAgIDE0MzE0CisgKiBCTV9MVk0vOS8wICAgICAgMTc0NjkyIG5zICAgICAgIDE3NDIyOCBucyAgICAgICAgIDQwMjYKKyAqIEJNX0xWTS85LzEgICAgICAxODMwNDggbnMgICAgICAgMTgyNTYwIG5zICAgICAgICAgMzgzNAorICogQk1fTFZNLzkvMiAgICAgIDEzMTAyMCBucyAgICAgICAxMzA2NzUgbnMgICAgICAgICA1MzQ3CisgKiBCTV9MVk0vOS8zICAgICAgIDcxMTAyIG5zICAgICAgICA3MDkxNSBucyAgICAgICAgIDk4MDEKKyAqIEJNX0xWTS8xMC8wICAgICAxODkwNzkgbnMgICAgICAgMTg4NTc2IG5zICAgICAgICAgMzY5OQorICogQk1fTFZNLzEwLzEgICAgIDE4Nzk4OSBucyAgICAgICAxODc0NzIgbnMgICAgICAgICAzNzM3CisgKiBCTV9MVk0vMTAvMiAgICAgMTQwMDkzIG5zICAgICAgIDEzOTcxNyBucyAgICAgICAgIDUwMDcKKyAqIEJNX0xWTS8xMC8zICAgICAgNzgxNzUgbnMgICAgICAgIDc3OTYzIG5zICAgICAgICAgODkxOQorICogQk1fTFZNLzExLzAgICAgIDIwNzU3NyBucyAgICAgICAyMDcwMDcgbnMgICAgICAgICAzMzcxCisgKiBCTV9MVk0vMTEvMSAgICAgMTk4MTg2IG5zICAgICAgIDE5NzY0MCBucyAgICAgICAgIDM1MzUKKyAqIEJNX0xWTS8xMS8yICAgICAxNTcyMTQgbnMgICAgICAgMTU2Nzg2IG5zICAgICAgICAgNDQ1OQorICogQk1fTFZNLzExLzMgICAgICA4NTkxMiBucyAgICAgICAgODU2ODEgbnMgICAgICAgICA4MTUzCisgKiBCTV9MVk0vMTIvMCAgICAgMjIwODYxIG5zICAgICAgIDIyMDI2NSBucyAgICAgICAgIDMxNjkKKyAqIEJNX0xWTS8xMi8xICAgICAyMDg3NTkgbnMgICAgICAgMjA4MTg0IG5zICAgICAgICAgMzM1NQorICogQk1fTFZNLzEyLzIgICAgIDE2NTUzMyBucyAgICAgICAxNjUwODggbnMgICAgICAgICA0MjM0CisgKiBCTV9MVk0vMTIvMyAgICAgIDkyNjE2IG5zICAgICAgICA5MjM2NCBucyAgICAgICAgIDc1MjgKKyAqIEJNX0xWTS8xMy8wICAgICAyMzg1NzMgbnMgICAgICAgMjM3OTIwIG5zICAgICAgICAgMjk0NQorICogQk1fTFZNLzEzLzEgICAgIDIxOTEzMCBucyAgICAgICAyMTg1MjAgbnMgICAgICAgICAzMjA5CisgKiBCTV9MVk0vMTMvMiAgICAgMTgzMTkzIG5zICAgICAgIDE4MjY5MiBucyAgICAgICAgIDM4MzAKKyAqIEJNX0xWTS8xMy8zICAgICAxMDA1NDYgbnMgICAgICAgMTAwMjc0IG5zICAgICAgICAgNzAwNQorICogQk1fTFZNLzE0LzAgICAgIDI1NDgyMCBucyAgICAgICAyNTQxMzUgbnMgICAgICAgICAyNzQ4CisgKiBCTV9MVk0vMTQvMSAgICAgMjMwMTYxIG5zICAgICAgIDIyOTUzMCBucyAgICAgICAgIDMwNDkKKyAqIEJNX0xWTS8xNC8yICAgICAxOTIxOTUgbnMgICAgICAgMTkxNjcxIG5zICAgICAgICAgMzYzNQorICogQk1fTFZNLzE0LzMgICAgIDEwNzc3MCBucyAgICAgICAxMDc0NzcgbnMgICAgICAgICA2NTAyCisgKiBCTV9MVk0vMTUvMCAgICAgMjczNjk1IG5zICAgICAgIDI3Mjk1NCBucyAgICAgICAgIDI1MzEKKyAqIEJNX0xWTS8xNS8xICAgICAyNDA3MTggbnMgICAgICAgMjQwMDQ5IG5zICAgICAgICAgMjgwMQorICogQk1fTFZNLzE1LzIgICAgIDIyMDkxNCBucyAgICAgICAyMjAzMDkgbnMgICAgICAgICAzMTkxCisgKiBCTV9MVk0vMTUvMyAgICAgMTI0MzIxIG5zICAgICAgIDEyMzk3OCBucyAgICAgICAgIDU2NjQKKyAqIEJNX0xWTS8xNi8wICAgICAyODU3NjkgbnMgICAgICAgMjg0OTY5IG5zICAgICAgICAgMjQ1OQorICogQk1fTFZNLzE2LzEgICAgIDI1MTY5MiBucyAgICAgICAyNTA5ODMgbnMgICAgICAgICAyNzg5CisgKiBCTV9MVk0vMTYvMiAgICAgMjI0NTU0IG5zICAgICAgIDIyMzkxNyBucyAgICAgICAgIDMxMzIKKyAqIEJNX0xWTS8xNi8zICAgICAxMjIwNDggbnMgICAgICAgMTIxNzA2IG5zICAgICAgICAgNTc1MworICogQk1fTFZNLzE3LzAgICAgIDMxMDAyNyBucyAgICAgICAzMDkxNTQgbnMgICAgICAgICAyMjY2CisgKiBCTV9MVk0vMTcvMSAgICAgMjYyMDA4IG5zICAgICAgIDI2MTI1OSBucyAgICAgICAgIDI2ODEKKyAqIEJNX0xWTS8xNy8yICAgICAyNDc1MzAgbnMgICAgICAgMjQ2ODI3IG5zICAgICAgICAgMjg0MgorICogQk1fTFZNLzE3LzMgICAgIDEyOTUxMyBucyAgICAgICAxMjkxNDYgbnMgICAgICAgICA1NDE4CisgKiBCTV9MVk0vMTgvMCAgICAgMzIyNzU1IG5zICAgICAgIDMyMTg0NCBucyAgICAgICAgIDIxNzMKKyAqIEJNX0xWTS8xOC8xICAgICAyNjMyNjYgbnMgICAgICAgMjYyNTE0IG5zICAgICAgICAgMjY3MQorICogQk1fTFZNLzE4LzIgICAgIDI1NzYwNiBucyAgICAgICAyNTY4NzUgbnMgICAgICAgICAyNzMxCisgKiBCTV9MVk0vMTgvMyAgICAgMTM2NTUwIG5zICAgICAgIDEzNjE2NCBucyAgICAgICAgIDUxMjkKKyAqIEJNX0xWTS8xOS8wICAgICAzMzg1NTEgbnMgICAgICAgMzM3NTkxIG5zICAgICAgICAgMjA2OQorICogQk1fTFZNLzE5LzEgICAgIDI3NTkyOSBucyAgICAgICAyNzUxMzQgbnMgICAgICAgICAyNTM1CisgKiBCTV9MVk0vMTkvMiAgICAgMjcwMzMxIG5zICAgICAgIDI2OTU1NCBucyAgICAgICAgIDI1OTYKKyAqIEJNX0xWTS8xOS8zICAgICAxNDQ1NTEgbnMgICAgICAgMTQ0MTM4IG5zICAgICAgICAgNDgzOAorICogQk1fTFZNLzIwLzAgICAgIDM1MjYzMyBucyAgICAgICAzNTE2MTcgbnMgICAgICAgICAxOTkzCisgKiBCTV9MVk0vMjAvMSAgICAgMjg2NjA3IG5zICAgICAgIDI4NTcxMyBucyAgICAgICAgIDIzNzEKKyAqIEJNX0xWTS8yMC8yICAgICAyODM1NDEgbnMgICAgICAgMjgyNjg5IG5zICAgICAgICAgMjQwNworICogQk1fTFZNLzIwLzMgICAgIDE1MjM1NSBucyAgICAgICAxNTE5MDQgbnMgICAgICAgICA0NjA0CisgKiBCTV9MVk0vMjEvMCAgICAgMzcwNTU3IG5zICAgICAgIDM2OTQ1NiBucyAgICAgICAgIDE4ODkKKyAqIEJNX0xWTS8yMS8xICAgICAyOTgyNTEgbnMgICAgICAgMjk3MzUxIG5zICAgICAgICAgMjM1MgorICogQk1fTFZNLzIxLzIgICAgIDI5NjgwNiBucyAgICAgICAyOTU5MTcgbnMgICAgICAgICAyMzY0CisgKiBCTV9MVk0vMjEvMyAgICAgMTYwMjEyIG5zICAgICAgIDE1OTczNSBucyAgICAgICAgIDQzMzAKKyAqIEJNX0xWTS8yMi8wICAgICAzODY0MzEgbnMgICAgICAgMzg1MjI0IG5zICAgICAgICAgMTgyNgorICogQk1fTFZNLzIyLzEgICAgIDMwODkwMSBucyAgICAgICAzMDc5MjUgbnMgICAgICAgICAyMjczCisgKiBCTV9MVk0vMjIvMiAgICAgMzA5MDc3IG5zICAgICAgIDMwODE0MCBucyAgICAgICAgIDIyNzQKKyAqIEJNX0xWTS8yMi8zICAgICAxNjc0OTIgbnMgICAgICAgMTY2OTg3IG5zICAgICAgICAgNDE5NAorICogQk1fTFZNLzIzLzAgICAgIDQwNDQ1NSBucyAgICAgICA0MDMyMTggbnMgICAgICAgICAxNzI5CisgKiBCTV9MVk0vMjMvMSAgICAgMzIyMDI2IG5zICAgICAgIDMyMTAxNCBucyAgICAgICAgIDIxODcKKyAqIEJNX0xWTS8yMy8yICAgICAzMjY2MTYgbnMgICAgICAgMzI1NjIzIG5zICAg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nQpOworICAgIGZvciAoYXV0byYgaW4gOiBpbnB1dCkgeworICAgICAgICBpbiA9IGRpcyhnZW4pOworICAgIH0KKworICAgIGVmZmVjdF9oYW5kbGVfdCBlZmZlY3RIYW5kbGUgPSBudWxscHRyOworICAgIGlmIChpbnQgc3RhdHVzID0gQVVESU9fRUZGRUNUX0xJQlJBUllfSU5GT19TWU0uY3JlYXRlX2VmZmVjdCgmdXVpZCwgMSwgMSwgJmVmZmVjdEhhbmRsZSk7CisgICAgICAgIHN0YXR1cyAhPSAwKSB7CisgICAgICAgIEFMT0dFKCJjcmVhdGVfZWZmZWN0IHJldHVybmVkIGFuIGVycm9yID0gJWRcbiIsIHN0YXR1cyk7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICBlZmZlY3RfY29uZmlnX3QgY29uZmlne307CisgICAgY29uZmlnLmlucHV0Q2ZnLnNhbXBsaW5nUmF0ZSA9IGNvbmZpZy5vdXRwdXRDZmcuc2FtcGxpbmdSYXRlID0ga1NhbXBsZVJhdGU7CisgICAgY29uZmlnLmlucHV0Q2ZnLmNoYW5uZWxzID0gY29uZmlnLm91dHB1dENmZy5jaGFubmVscyA9IGNoTWFzazsKKyAgICBjb25maWcuaW5wdXRDZmcuZm9ybWF0ID0gY29uZmlnLm91dHB1dENmZy5mb3JtYXQgPSBBVURJT19GT1JNQVRfUENNX0ZMT0FUOworCisgICAgaW50IHJlcGx5ID0gMDsKKyAgICB1aW50MzJfdCByZXBseVNpemUgPSBzaXplb2YocmVwbHkpOworICAgIGlmIChpbnQgc3RhdHVzID0gKCplZmZlY3RIYW5kbGUpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0+Y29tbWFuZChlZmZlY3RIYW5kbGUsIEVGRkVDVF9DTURfU0VUX0NPTkZJRywgc2l6ZW9mKGVmZmVjdF9jb25maWdfdCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmY29uZmlnLCAmcmVwbHlTaXplLCAmcmVwbHkpOworICAgICAgICBzdGF0dXMgIT0gMCkgeworICAgICAgICBBTE9HRSgiY29tbWFuZCByZXR1cm5lZCBhbiBlcnJvciA9ICVkXG4iLCBzdGF0dXMpOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgaWYgKGludCBzdGF0dXMgPQorICAgICAgICAgICAgICAgICgqZWZmZWN0SGFuZGxlKQorICAgICAgICAgICAgICAgICAgICAgICAgLT5jb21tYW5kKGVmZmVjdEhhbmRsZSwgRUZGRUNUX0NNRF9FTkFCTEUsIDAsIG51bGxwdHIsICZyZXBseVNpemUsICZyZXBseSk7CisgICAgICAgIHN0YXR1cyAhPSAwKSB7CisgICAgICAgIEFMT0dFKCJDb21tYW5kIGVuYWJsZSBjYWxsIHJldHVybmVkIGVycm9yICVkXG4iLCByZXBseSk7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICAvLyBSdW4gdGhlIHRlc3QKKyAgICBmb3IgKGF1dG8gXyA6IHN0YXRlKSB7CisgICAgICAgIHN0ZDo6dmVjdG9yPGZsb2F0PiBvdXRwdXQoa0ZyYW1lQ291bnQgKiBjaGFubmVsQ291bnQpOworCisgICAgICAgIGJlbmNobWFyazo6RG9Ob3RPcHRpbWl6ZShpbnB1dC5kYXRhKCkpOworICAgICAgICBiZW5jaG1hcms6OkRvTm90T3B0aW1pemUob3V0cHV0LmRhdGEoKSk7CisKKyAgICAgICAgYXVkaW9fYnVmZmVyX3QgaW5CdWZmZXIgPSB7LmZyYW1lQ291bnQgPSBrRnJhbWVDb3VudCwgLmYzMiA9IGlucHV0LmRhdGEoKX07CisgICAgICAgIGF1ZGlvX2J1ZmZlcl90IG91dEJ1ZmZlciA9IHsuZnJhbWVDb3VudCA9IGtGcmFtZUNvdW50LCAuZjMyID0gb3V0cHV0LmRhdGEoKX07CisgICAgICAgICgqZWZmZWN0SGFuZGxlKS0+cHJvY2VzcyhlZmZlY3RIYW5kbGUsICZpbkJ1ZmZlciwgJm91dEJ1ZmZlcik7CisKKyAgICAg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0vYXVkaW8uaD4KKyNpbmNsdWRlICJFZmZlY3RSZXZlcmIuaCIKKworZXh0ZXJuIGF1ZGlvX2VmZmVjdF9saWJyYXJ5X3QgQVVESU9fRUZGRUNUX0xJQlJBUllfSU5GT19TWU07Citjb25zdGV4cHIgZWZmZWN0X3V1aWRfdCBrRWZmZWN0VXVpZHNbXSA9IHsKKyAgICAgICAgezB4MTcyY2RmMDAsCisgICAgICAgICAweGEzYmMsCisgICAgICAgICAweDExZGYsCisgICAgICAgICAweGE3MmYsCisgICAgICAgICB7MHgwMCwgMHgwMiwgMHhhNSwgMHhkNSwgMHhjNSwgMHgxYn19LCAgLy8gcHJlc2V0LWluc2VydCBtb2RlCisgICAgICAgIHsweGYyOWExNDAwLAorICAgICAgICAgMHhhM2JiLAorICAgICAgICAgMHgxMWRmLAorICAgICAgICAgMHg4ZGRjLAorICAgICAgICAgezB4MDAsIDB4MDIsIDB4YTUsIDB4ZDUsIDB4YzUsIDB4MWJ9fSwgIC8vIHByZXNldC1hdXggbW9kZQorfTsKKworY29uc3RleHByIHNpemVfdCBrTnVtRWZmZWN0VXVpZHMgPSBzdGQ6OnNpemUoa0VmZmVjdFV1aWRzKTsKKworY29uc3RleHByIHNpemVfdCBrRnJhbWVDb3VudCA9IDIwNDg7CisKK2NvbnN0ZXhwciBpbnQga1ByZXNldHNbXSA9IHsKKyAgICAgICAgUkVWRVJCX1BSRVNFVF9OT05FLCAgICAgIFJFVkVSQl9QUkVTRVRfU01BTExST09NLCAgUkVWRVJCX1BSRVNFVF9NRURJVU1ST09NLAorICAgICAgICBSRVZFUkJfUFJFU0VUX0xBUkdFUk9PTSwgUkVWRVJCX1BSRVNFVF9NRURJVU1IQUxMLCBSRVZFUkJfUFJFU0VUX0xBUkdFSEFMTCwKKyAgICAgICAgUkVWRVJCX1BSRVNFVF9QTEFURSwKK307CisKK2NvbnN0ZXhwciBzaXplX3Qga051bVByZXNldHMgPSBzdGQ6OnNpemUoa1ByZXNldHMpOworCitjb25zd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ZXQgY29uZmlnIHJldHVybmVkIGFuIGVycm9yID0gJWRcbiIsIHN0YXR1cyk7CisgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgfQorICAgIHJldHVybiByZXBseTsKK30KKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAqIEEgdGVzdCByZXN1bHQgcnVubmluZyBvbiBQaXhlbCAzIHdpdGggZm9yIGNvbXBhcmlzb24uCisgKiBUaGUgZmlyc3QgcGFyYW1ldGVyIGluZGljYXRlcyB0aGUgcHJlc2V0IGxldmVsIGlkLgorICogVGhlIHNlY29uZCBwYXJhbWV0ZXIgaW5kaWNhdGVzIHRoZSBlZmZlY3QuCisgKiAwOiBwcmVzZXQtaW5zZXJ0IG1vZGUsIDE6IHByZXNldC1hdXggbW9kZQorICogLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKyAqIEJlbmNobWFyayAgICAgICAgICAgICAgVGltZSAgICAgICAgICAgICBDUFUgICBJdGVyYXRpb25zCisgKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorICogQk1fUkVWRVJCLzAvMCAgICAgIDE5MzEyIG5zICAgICAgICAxOTI0OSBucyAgICAgICAgMzYyODIKKyAqIEJNX1JFVkVSQi8wLzEgICAgICAgNTYxMyBucyAgICAgICAgIDU1OTYgbnMgICAgICAgMTI1MDMyCisgKiBCTV9SRVZFUkIvMS8wICAgICA2MDU0NTMgbnMgICAgICAgNjAzNzE0IG5zICAgICAgICAgMTEzMQorICogQk1fUkVWRVJCLzEvMSAgICAgNTg5NDIxIG5zICAgICAgIDU4Nzc1OCBucyAgICAgICAgIDExNjEKKyAqIEJNX1JFVkVSQi8yLzAgICAgIDYwNTc2MCBucyAgICAgICA2MDQwMDYgbnMgICAgICAgICAxMTMxCisgKiBCTV9SRVZFUkIvMi8xICAgICA1ODk0MzQgbnMgICAgICAgNTg3Nzc3IG5zICAgICAgICAgMTE2MQorICogQk1fUkVWRVJCLzMvMCAgICAgNjA1NTc0IG5zICAgICAgIDYwMzgyOCBucyAgICAgICAgIDExMzEKKyAqIEJNX1JFVkVSQi8zLzEgICAgIDU4OTU2NiBucyAgICAgICA1ODc4NjIgbnMgICAgICAgICAxMTYyCisgKiBCTV9SRVZFUkIvNC8wICAgICA2MDU2MzQgbnMgICAgICAgNjAzODk0IG5zICAgICAgICAgMTEzMQorICogQk1fUkVWRVJCLzQvMSAgICAgNTg5NTA2IG5zICAgICAgIDU4Nzg1NiBucyAgICAgICAgIDExNjEKKyAqIEJNX1JFVkVSQi81LzAgICAgIDYwNTY0NCBucyAgICAgICA2MDM5MjkgbnMgICAgICAgICAxMTMxCisgKiBCTV9SRVZFUkIvNS8xICAgICA1ODk1OTIgbnMgICAgICAgNTg3ODYzIG5zICAgICAgICAgMTE2MQorICogQk1fUkVWRVJCLzYvMCAgICAgNjEwNTQ0IG5zICAgICAgIDYwODU2MSBucyAgICAgICAgIDExMzEKKyAqIEJNX1JFVkVSQi82LzEgICAgIDU4OTY4NiBucyAgICAgICA1ODc4NzEgbnMgICAgICAgICAxMTYxCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworc3RhdGljIHZvaWQgQk1fUkVWRVJCKGJlbmNobWFyazo6U3RhdGUmIHN0YXRlKSB7CisgICAgY29uc3Qgc2l6ZV90IGNoTWFzayA9IEFVRElPX0NIQU5ORUxfT1VUX1NURVJFTzsKKyAgICBjb25zdCBzaXplX3QgcHJlc2V0ID0ga1ByZXNldHNbc3RhdGUucmFuZ2UoMCldOworICAgIGNvbnN0IGVmZmVjdF91dWlkX3QgdXVpZCA9IGtFZmZlY3RVdWlkc1tzdGF0ZS5yYW5nZSgxKV07CisgICAgY29uc3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zJ4djMyLmNwcCIsCiAgICAgICAgICJDb21tb24vc3JjL0FkZDJfU2F0XzMyeDMyLmNwcCIsCiAgICAgICAgICJDb21tb24vc3JjL0pvaW5UbzJpXzMyeDMyLmNwcCIsCkBAIC0yMDMsMTAgKzE3NywxMSBAQAogICAgICAgICAiUmV2ZXJiL2xpYiIsCiAgICAgICAgICJDb21tb24vbGliIiwKICAgICBdLAotCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYmF1ZGlvdXRpbHMiLAorICAgIF0sCiAgICAgY3BwZmxhZ3M6IFsKICAgICAgICAgIi1mdmlzaWJpbGl0eT1oaWRkZW4iLAotCiAgICAgICAgICItV2FsbCIsCiAgICAgICAgICItV2Vycm9yIiwKICAgICBdLApkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0Jhc3MvbGliL0xWREJFLmggYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQmFzcy9saWIvTFZEQkUuaAppbmRleCA5NDhkNzljLi5lNjBhZDA3IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQmFzcy9saWIvTFZEQkUuaAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQmFzcy9saWIvTFZEQkUuaApAQCAtNjksMTUgKzY5LDEyIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0vKiBNZW1vcnkgdGFibGUqLwotI2RlZmluZSBMVkRCRV9OUl9NRU1PUllfUkVHSU9OUyAgICAgICAgNCAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBOdW1iZXIgb2YgbWVtb3J5IHJlZ2lvbnMgKi8KLQogLyogQmFzcyBFbmhhbmNlbWVudCBlZmZlY3QgbGV2ZWwgKi8KLSNkZWZpbmUgTFZEQkVfRUZGRUNUXzAzREIgICAgICAgICAgICAzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRWZmZWN0IGRlZmluZXMgZm9yIGJhY2t3YXJkcyBjb21wYXRpYmlsaXR5ICovCi0jZGVmaW5lIExWREJFX0VGRkVDVF8wNkRCICAgICAgICAgICAgNgotI2RlZmluZSBMVkRCRV9FRkZFQ1RfMDlEQiAgICAgICAgICAgIDkKLSNkZWZpbmUgTFZEQkVfRUZGRUNUXzEyREIgICAgICAgICAgICAxMgotI2RlZmluZSBMVkRCRV9FRkZFQ1RfMTVEQiAgICAgICAgICAgIDE1CisjZGVmaW5lIExWREJFX0VGRkVDVF8wM0RCIDMgLyogRWZmZWN0IGRlZmluZXMgZm9yIGJhY2t3YXJkcyBjb21wYXRpYmlsaXR5ICovCisjZGVmaW5lIExWREJFX0VGRkVDVF8wNkRCIDYKKyNkZWZpbmUgTFZEQkVfRUZGRUNUXzA5REIgOQorI2RlZmluZSBMVkRCRV9FRkZFQ1RfMTJEQiAxMgorI2RlZmluZSBMVkRCRV9FRkZFQ1RfMTVEQiAxNQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtODYsNTIgKzgzLDMxIEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAogLyogSW5zdGFuY2UgaGFuZGxlICovCi10eXBlZGVmIHZvaWQgICAgKkxWREJFX0hhbmRsZV90OwordHlwZWRl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llfTUFYICAgICAgPSBMVk1fTUFYSU5UXzMyCi0KLX0gTFZEQkVfTWVtb3J5VHlwZXNfZW47Ci0KIC8qIEZ1bmN0aW9uIHJldHVybiBzdGF0dXMgKi8KLXR5cGVkZWYgZW51bQotewotICAgIExWREJFX1NVQ0NFU1MgICAgICAgID0gMCwgICAgICAgICAgICAgICAgICAgICAgICAvKiBTdWNjZXNzZnVsIHJldHVybiBmcm9tIGEgcm91dGluZSAqLwotICAgIExWREJFX0FMSUdOTUVOVEVSUk9SID0gMSwgICAgICAgICAgICAgICAgICAgICAgICAvKiBNZW1vcnkgYWxpZ25tZW50IGVycm9yICovCi0gICAgTFZEQkVfTlVMTEFERFJFU1MgICAgPSAyLCAgICAgICAgICAgICAgICAgICAgICAgIC8qIE5VTEwgYWxsb2NhdGlvbiBhZGRyZXNzICovCi0gICAgTFZEQkVfVE9PTUFOWVNBTVBMRVMgPSAzLCAgICAgICAgICAgICAgICAgICAgICAgIC8qIE1heGltdW0gYmxvY2sgc2l6ZSBleGNlZWRlZCAqLwotICAgIExWREJFX1NJWkVFUlJPUiAgICAgID0gNCwgICAgICAgICAgICAgICAgICAgICAgICAvKiBJbmNvcnJlY3Qgc3RydWN0dXJlIHNpemUgKi8KLSAgICBMVkRCRV9TVEFUVVNfTUFYICAgICA9IExWTV9NQVhJTlRfMzIKK3R5cGVkZWYgZW51bSB7CisgICAgTFZEQkVfU1VDQ0VTUyA9IDAsICAgICAgICAvKiBTdWNjZXNzZnVsIHJldHVybiBmcm9tIGEgcm91dGluZSAqLworICAgIExWREJFX05VTExBRERSRVNTID0gMSwgICAgLyogTlVMTCBhbGxvY2F0aW9uIGFkZHJlc3MgKi8KKyAgICBMVkRCRV9UT09NQU5ZU0FNUExFUyA9IDIsIC8qIE1heGltdW0gYmxvY2sgc2l6ZSBleGNlZWRlZCAqLworICAgIExWREJFX1NUQVRVU19NQVggPSBMVk1fTUFYSU5UXzMyCiB9IExWREJFX1JldHVyblN0YXR1c19lbjsKIAogL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9GU185NjAwMCAxMDI0CisjZGVmaW5lIExWREJFX0NBUF9GU18xNzY0MDAgMjA0OAorI2RlZmluZSBMVkRCRV9DQVBfRlNfMTkyMDAwIDQwOTYKIAotdHlwZWRlZiBlbnVtCi17Ci0gICAgTFZEQkVfRlNfODAwMCAgPSAwLAordHlwZWRlZiBlbnVtIHsKKyAgICBMVkRCRV9GU184MDAwID0gMCwKICAgICBMVkRCRV9GU18xMTAyNSA9IDEsCiAgICAgTFZEQkVfRlNfMTIwMDAgPSAyLAogICAgIExWREJFX0ZTXzE2MDAwID0gMywKQEAgLTIwNCw3ICsxNzgsNyBAQAogICAgIExWREJFX0ZTXzk2MDAwID0gMTAsCiAgICAgTFZEQkVfRlNfMTc2NDAwID0gMTEsCiAgICAgTFZEQkVfRlNfMTkyMDAwID0gMTIsCi0gICAgTFZEQkVfRlNfTUFYICAgPSBMVk1fTUFYSU5UXzMyCisgICAgTFZEQkVfRlNfTUFYID0gTFZNX01BWElOVF8zMgogfSBMVkRCRV9Gc19lbjsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCkBAIC0yMTMsNDQgKzE4NywyNSBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotLyogTWVtb3J5IHJlZ2lvbiBkZWZpbml0aW9uICovCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9VSU5UMzIgICAgICAgICAgICAgICAgU2l6ZTsgICAgICAgICAgICAgICAgICAgICAgICAvKiBSZWdpb24gc2l6ZSBpbiBieXRlcyAqLwotICAgIExWTV9VSU5UMTYgICAgICAg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0aWVzICovCisgICAgTFZNX1VJTlQxNiBDZW50cmVGcmVxdWVuY3k7IC8qIENlbnRyZSBmcmVxdWVuY3kgY2FwYWJpbGl0aWVzICovCisgICAgTFZNX1VJTlQxNiBNYXhCbG9ja1NpemU7ICAgIC8qIE1heGltdW0gYmxvY2sgc2l6ZSBpbiBzYW1wbGUgcGFpcnMgKi8KIH0gTFZEQkVfQ2FwYWJpbGl0aWVzX3Q7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtMjYxLDc1ICsyMTYsMzkgQEAKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICAgTFZEQkVfTWVtb3J5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCBmb3IgbWVtb3J5IGFsbG9jYXRpb24gYW5kIGZyZWUuIEl0IGNhbiBiZSBjYWxsZWQgaW4gICAgICAgICAqLwotLyogICAgdHdvIHdheXM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICBoSW5zdGFuY2UgPSBOVUxMICAgICAgICAgICAgICAgIFJldHVybnMgdGhlIG1lbW9yeSByZXF1aXJlbWVudHMgICAgICAgICAgICAgICAqLwotLyogICAgICAgIGhJbnN0YW5jZSA9IEluc3RhbmNlIGhhbmRsZSAgICAgICAgUmV0dXJucyB0aGUgbWVtb3J5IHJlcXVpcmVtZW50cyBhbmQgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxvY2F0ZWQgYmFzZSBhZGRyZXNzZXMgZm9yIHRoZSBpbnN0YW5jZSAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgV2hlbiB0aGlzIGZ1bmN0aW9uIGlzIGNhbGxlZCBmb3IgbWVtb3J5IGFsbG9jYXRpb24gKGhJbnN0YW5jZT1OVUxMKSB0aGUgbWVtb3J5ICAgICovCi0vKiAgYmFzZSBhZGRyZXNzIHBvaW50ZXJzIGFyZSBOVUxMIG9uIHJldHVybi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgV2hlbiB0aGUgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciBmcmVlIChoSW5zdGFuY2UgPSBJbnN0YW5jZSBIYW5kbGUpIHRoZSBtZW1vcnkgICAgICovCi0vKiAgdGFibGUgcmV0dXJucyB0aGUgYWxsb2NhdGVkIG1lbW9yeSBhbmQgYmFzZSBhZGRyZXNzZXMgdXNlZCBkdXJpbmcgaW5pdGlhbGlzYXRpb24uICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlICAgICAgICAgICAgICAgIEluc3RhbmNlIEhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwTWVtb3J5VGFibGUgICAgICAgICAgICAgUG9pbnRlciB0byBhbiBlbXB0eSBtZW1vcnkgZGVmaW5pdGlvbiB0YWJsZSAgICAgICAgICAgICAgICAqLwotLyogICAgcENhcGFiaWxpdGllcyAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGRlZmF1bHQgY2FwYWJpbGl0ZXMgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIExWREJFX1NVQ0NFU1MgICAgICAgICAgICBTdWNjZWVkZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgMS4gICAgVGhpcyBmdW5jdGlvbiBtYXkgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWREJFX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi1MVkRCRV9SZXR1cm5TdGF0dXNfZW4gTFZEQkVfTWVtb3J5KExWREJFX0hhbmRsZV90ICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX01lbVRhYl90ICAgICAgICAgICAqcE1lbW9yeVRhYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9DYXBhYmlsaXRpZXNfdCAgICAgKnBDYXBhYmlsaXRpZXMpOwotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgICBMVkRCRV9Jbml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgQ3JlYXRlIGFuZCBpbml0aWFsaXNhdGlvbiBmdW5jdGlvbiBmb3IgdGhlIEJhc3MgRW5oYW5jZW1lbnQgbW9kdWxlICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgIFRoaXMgZnVuY3Rpb24gY2FuIGJlIHVzZWQgdG8gY3JlYXRlIGFuIGFsZ29yaXRobSBpbnN0YW5jZSBieSBjYWxsaW5nIHdpdGggICAgICAgICAqLwotLyogICAgaEluc3RhbmNlIHNldCB0byBOVUxMLiBJbiB0aGlzIGNhc2UgdGhlIGFsZ29yaXRobSByZXR1cm5zIHRoZSBuZXcgaW5zdGFuY2UgICAgICAgICovCi0vKiAgICBoYW5kbGUuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgVGhpcyBmdW5jdGlvbiBjYW4gYmUgdXNlZCB0byBmb3JjZSBhIGZ1bGwgcmUtaW5pdGlhbGlzYXRpb24gb2YgdGhlIGFsZ29yaXRobSAgICAgICovCi0vKiAgICBieSBjYWxsaW5nIHdpdGggaEluc3RhbmNlID0gSW5zdGFuY2UgSGFuZGxlLiBJbiB0aGlzIGNhc2UgdGhlIG1lbW9yeSB0YWJsZSAgICAgICAgKi8KLS8qICAgIHNob3VsZCBiZSBjb3JyZWN0IGZvciB0aGUgaW5zdGFuY2UsIHRoaXMgY2FuIGJlIGVuc3VyZWQgYnkgY2FsbGluZyB0aGUgZnVuY3Rpb24gICAqLwotLyogICAgTFZEQkVfTWVtb3J5IGJlZm9yZSBjYWxsaW5nIHRoaXMgZnVuY3Rpb24uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIGhJbnN0YW5jZSAgICAgICAgICAgICAgICAgIEluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcE1lbW9yeVRhYmxlICAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwaEluc3RhbmNlICAgICAgICAgICAgICAgUG9pbnRlciB0byBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogIHBDYXBhYmlsaXRpZXMgICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbml0aWFsaXNhdGlvbiBjYXBhYmlsaXRpZXMgICAgICAgICAgICAgICAgICovCisvKiAgcFNjcmF0Y2ggICAgICAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGJ1bmRsZSBzY3JhdGNoIGJ1ZmZlciAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZEQkVfU1VDQ0VTUyAgICAgICAgICAgICAgICBJbml0aWFsaXNhdGlvbiBzdWNjZWVkZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBMVkRCRV9BTElHTk1FTlRFUlJPUiAgICAgICAgSW5zdGFuY2Ugb3Igc2NyYXRjaCBtZW1vcnkgb24gaW5jb3JyZWN0IGFsaWdubWVudCAgICAgICAqLwotLyogICAgTFZEQkVfTlVMTEFERFJFU1MgICAgICAgICAgICBPbmUgb3IgbW9yZSBtZW1vcnkgaGFzIGEgTlVMTCBwb2ludGVyICAgICAgICAgICAgICAgICovCisvKiAgTFZEQkVfU1VDQ0VTUyAgICAgICAgICAgIEluaXRpYWxpc2F0aW9uIHN1Y2NlZWRlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBMVkRCRV9OVUxMQUREUkVTUyAgICAgICAgT25lIG9yIG1vcmUgbWVtb3J5IGhhcyBhIE5VTEwgcG9pbnRlciAtIG1hbGxvYyBmYWlsdXJlICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAxLiAgICAgVGhlIGluc3RhbmNlIGhhbmRsZSBpcyB0aGUgcG9pbnRlciB0byB0aGUgYmFzZSBhZGRyZXNzIG9mIHRoZSBmaXJzdCBtZW1vcnkgICAqLwotLyogICAgICAgIHJlZ2lvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAyLiAgICBUaGlzIGZ1bmN0aW9uIG11c3Qgbm90IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVkRCRV9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgKi8KKy8qICAxLiAgICBUaGlzIGZ1bmN0aW9uIG11c3Qgbm90IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVkRCRV9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK0xWREJFX1JldHVyblN0YXR1c19lbiBMVkRCRV9Jbml0KExWREJFX0hhbmRsZV90KiBwaEluc3RhbmNlLCBMVkRCRV9DYXBhYmlsaXRpZXNfdCogcENhcGFiaWxpdGllcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQqIHBTY3JhdGNoKTsKIAotTFZEQkVfUmV0dXJuU3RhdHVzX2VuIExWREJFX0luaXQoTFZEQkVfSGFuZGxlX3QgICAgICAgICAgICAgKnBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX01lbVRhYl90ICAgICAgICAgICAqcE1lbW9yeVRhYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9DYXBhYmlsaXRpZXNfdCAgICAgKnBDYXBhYmlsaXRpZXMpOworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICAgTFZEQkVfRGVJbml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgIEZyZWUgdGhlIG1lbW9yaWVzIGNyZWF0ZWQgZHVyaW5nIExWREJFX0luaXQgaW5jbHVkaW5nIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwaEluc3RhbmNlICAgICAgICAgICAgICAgUG9pbnRlciB0byBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3ZvaWQgTFZEQkVfRGVJbml0KExWREJFX0hhbmRsZV90KiBwaEluc3RhbmNlKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTM1MSw4ICsyNzAsNyBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZEQkVfUmV0dXJuU3RhdHVzX2VuIExWREJFX0dldFBhcmFtZXRlcnMoTFZEQkVfSGFuZGxlX3QgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfUGFyYW1zX3QgICAgICAqcFBhcmFtcyk7CitMVkRCRV9SZXR1cm5TdGF0dXNfZW4gTFZEQkVfR2V0UGFyYW1ldGVycyhMVkRCRV9IYW5kbGVfdCBoSW5zdGFuY2UsIExWREJFX1BhcmFtc190KiBwUGFyYW1zKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTM3NCw4ICsyOTIsOCBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZEQkVfUmV0dXJuU3RhdHVzX2VuIExWREJFX0dldENhcGFiaWxpdGllcyhMVkRCRV9IYW5kbGVfdCAgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9DYXBhYmlsaXRpZXNfdCAgICAqcENhcGFiaWxpdGllcyk7CitMVkRCRV9SZXR1cm5TdGF0dXNfZW4gTFZEQkVfR2V0Q2FwYWJpbGl0aWVzKExWREJFX0hhbmRsZV90IGhJbnN0YW5jZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfQ2FwYWJpbGl0aWVzX3QqIHBDYXBhYmlsaXRpZXMpOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNDE0LDggKzMzMiw3IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVkRCRV9SZXR1cm5TdGF0dXNfZW4gTFZEQkVfQ29udHJvbChMVkRCRV9IYW5kbGVfdCAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfUGFyYW1zX3QgICAgKnBQYXJhbXMpOworTFZEQkVfUmV0dXJuU3RhdHVzX2VuIExWREJFX0NvbnRyb2woTFZEQkVfSGFuZGxlX3QgaEluc3RhbmNlLCBMVkRCRV9QYXJhbXNfdCogcFBhcmFtcyk7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC00MzcsOSArMzU0LDcgQEAKIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWREJFX1JldHVyblN0YXR1c19lbiBMVkRCRV9Qcm9jZXNzKExWREJFX0hhbmRsZV90ICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICpwSW5EYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgKnBPdXREYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiAgICAgICAgICAgTnVtU2FtcGxlcyk7CitMVkRCRV9SZXR1cm5TdGF0dXNfZW4gTFZEQkVfUHJvY2VzcyhMVkRCRV9IYW5kbGVfdCBoSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogcEluRGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogcE91dERhdGEsIExWTV9VSU5UMTYgTnVtU2FtcGxlcyk7CiAKICNlbmRpZiAvKiBfX0xWREJFX0hfXyAqLwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0Jhc3Mvc3JjL0xWREJFX0NvZWZmcy5oIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0Jhc3Mvc3JjL0xWREJFX0NvZWZmcy5oCmluZGV4IGIzNjRkYWUuLjMwZTE2OTIgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CYXNzL3NyYy9MVkRCRV9Db2VmZnMuaAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQmFzcy9zcmMvTFZEQkVfQ29lZmZzLmgKQEAgLTI0LDcgKzI0LDcgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0jZGVmaW5lIExWREJFX1NDQUxFU0hJRlQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCAgICAgICAgIC8qIEFzIGEgcG93ZXIgb2YgMiAqLworI2RlZmluZSBMVkRCRV9TQ0FMRVNISUZUIDEwIC8qIEFzIGEgcG93ZXIgb2YgMiAqLwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTMyLDI4OSArMzIsMjg5IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotIC8qIENvZWZmaWNpZW50cyBmb3IgY2VudHJlIGZyZXF1ZW5jeSA1NUh6ICovCi0jZGVmaW5lIEhQRl9GczgwMDBfRmM1NV9BMCAgICAgICAgICAgICAgICAgICAgICAgIDAuOTU4ODQ5ZgotI2RlZmluZSBIUEZfRnM4MDAwX0ZjNTVfQTEgICAgICAgICAgICAgICAgICAgICAgICAoLTEuOTE3Njk4ZikKLSNkZWZpbmUgSFBGX0ZzODAwMF9GYzU1X0EyICAgICAgICAgICAgICAgICAgICAgICAgMC45NTg4NDlmCi0jZGVmaW5lIEhQRl9GczgwMDBfRmM1NV9CMSAgICAgICAgICAgICAgICAgICAgICAgICgtMS45MzkwMDFmKQotI2RlZmluZSBIUEZfRnM4MDAwX0ZjNTVfQjIgICAgICAgICAgICAgICAgICAgICAgICAwLjk0MDgwN2YKLSNkZWZpbmUgSFBGX0ZzMTEwMjVfRmM1NV9BMCAgICAgICAgICAgICAgICAgICAgICAgMC45NjY5MDlmCi0jZGVmaW5lIEhQRl9GczExMDI1X0ZjNTVfQTEgICAgICAgICAgICAgICAgICAgICAgICgtMS45MzM4MThmKQotI2RlZmluZSBIUEZfRnMxMTAyNV9GYzU1X0EyICAgICAgICAgICAgICAgICAgICAgICAwLjk2NjkwOWYKLSNkZWZpbmUgSFBGX0ZzMTEwMjVfRmM1NV9CMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjk1NTczMmYpCi0jZGVmaW5lIEhQRl9GczExMDI1X0ZjNTVfQjIgICAgICAgICAgICAgICAgICAgICAgIDAuOTU2NjkwZgotI2RlZmluZSBIUEZfRnMxMjAwMF9GYzU1X0EwICAgICAgICAgICAgICAgICAgICAgICAwLjk2ODY1MGYKLSNkZWZpbmUgSFBGX0ZzMTIwMDBfRmM1NV9BMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjkzNzMwMGYpCi0jZGVmaW5lIEhQRl9GczEyMDAwX0ZjNTVfQTIgICAgICAgICAgICAgICAgICAgICAgIDAuOTY4NjUwZgotI2RlZmluZSBIUEZfRnMxMjAwMF9GYzU1X0IxICAgICAgICAgICAgICAgICAgICAgICAoLTEuOTU5MzI3ZikKLSNkZWZpbmUgSFBGX0ZzMTIwMDBfRmM1NV9CMiAgICAgICAgICAgICAgICAgICAgICAgMC45NjAxMzhmCi0jZGVmaW5lIEhQRl9GczE2MDAwX0ZjNTVfQTAgICAgICAgICAgICAgICAgICAgICAgIDAuOTczNTg4ZgotI2RlZmluZSBIUEZfRnMxNjAwMF9GYzU1X0ExICAgICAgICAgICAgICAgICAgICAgICAoLTEuOTQ3MTc2ZikKLSNkZWZpbmUgSFBGX0ZzMTYwMDBfRmM1NV9BMiAgICAgICAgICAgICAgICAgICAgICAgMC45NzM1ODhmCi0jZGVmaW5lIEhQRl9GczE2MDAwX0ZjNTVfQjEgICAgICAgICAgICAgICAgICAgICAgICgtMS45Njk0OTRmKQotI2RlZmluZSBIUEZfRnMxNjAwMF9GYzU1X0IyICAgICAgICAgICAgICAgICAgICAgICAwLjk2OTk1MmYKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfRmM1NV9BMCAgICAgICAgICAgICAgICAgICAgICAgMC45Nzc2NzFmCi0jZGVmaW5lIEhQRl9GczIyMDUwX0ZjNTVfQTEgICAgICAgICAgICAgICAgICAgICAgICgtMS45NTUzNDNmKQotI2RlZmluZSBIUEZfRnMyMjA1MF9GYzU1X0EyICAgICAgICAgICAgICAgICAgICAgICAwLjk3NzY3MWYKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfRmM1NV9CMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjk3Nzg2M2YpCi0jZGVmaW5lIEhQRl9GczIyMDUwX0ZjNTVfQjIgICAgICAgICAgICAgICAgICAgICAgIDAuOTc4MTA1ZgotI2RlZmluZSBIUEZfRnMyNDAwMF9GYzU1X0EwICAgICAgICAgICAgICAgICAgICAgICAwLjk3ODU1MWYKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfRmM1NV9BMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjk1NzEwMmYpCi0jZGVmaW5lIEhQRl9GczI0MDAwX0ZjNTVfQTIgICAgICAgICAgICAgICAgICAgICAgIDAuOTc4NTUxZgotI2RlZmluZSBIUEZfRnMyNDAwMF9GYzU1X0IxICAgICAgICAgICAgICAgICAgICAgICAoLTEuOTc5NjYyZikKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfRmM1NV9CMiAgICAgICAgICAgICAgICAgICAgICAgMC45Nzk4NjZmCi0jZGVmaW5lIEhQRl9GczMyMDAwX0ZjNTVfQTAgICAgICAgICAgICAgICAgICAgICAgIDAuOTgxMDQyZgotI2RlZmluZSBIUEZfRnMzMjAwMF9GYzU1X0ExICAgICAgICAgICAgICAgICAgICAgICAoLTEuOTYyMDg0ZikKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfRmM1NV9BMiAgICAgICAgICAgICAgICAgICAgICAgMC45ODEwNDJmCi0jZGVmaW5lIEhQRl9GczMyMDAwX0ZjNTVfQjEgICAgICAgICAgICAgICAgICAgICAgICgtMS45ODQ3NDZmKQotI2RlZmluZSBIUEZfRnMzMjAwMF9GYzU1X0IyICAgICAgICAgICAgICAgICAgICAgICAwLjk4NDg2MWYKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfRmM1NV9BMCAgICAgICAgICAgICAgICAgICAgICAgMC45ODMwOTdmCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0ZjNTVfQTEgICAgICAgICAgICAgICAgICAgICAgICgtMS45NjYxOTRmKQotI2RlZmluZSBIUEZfRnM0NDEwMF9GYzU1X0EyICAgICAgICAgICAgICAgICAgICAgICAwLjk4MzA5N2YKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfRmM1NV9CMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjk4ODkzMWYpCi0jZGVmaW5lI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9BMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjk1MTAxOWYpCi0jZGVmaW5lIEhQRl9GczIyMDUwX0ZjNjZfQTIgICAgICAgICAgICAgICAgICAgICAgIDAuOTc1NTA5ZgotI2RlZmluZSBIUEZfRnMyMjA1MF9GYzY2X0IxICAgICAgICAgICAgICAgICAgICAgICAoLTEuOTczNDM2ZikKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfRmM2Nl9CMiAgICAgICAgICAgICAgICAgICAgICAgMC45NzM3ODRmCi0jZGVmaW5lIEhQRl9GczI0MDAwX0ZjNjZfQTAgICAgICAgICAgICAgICAgICAgICAgIDAuOTc2NTYzZgotI2RlZmluZSBIUEZfRnMyNDAwMF9GYzY2X0ExICAgICAgICAgICAgICAgICAgICAgICAoLTEuOTUzMTI1ZikKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfRmM2Nl9BMiAgICAgICAgICAgICAgICAgICAgICAgMC45NzY1NjNmCi0jZGVmaW5lIEhQRl9GczI0MDAwX0ZjNjZfQjEgICAgICAgICAgICAgICAgICAgICAgICgtMS45NzU1OTRmKQotI2RlZmluZSBIUEZfRnMyNDAwMF9GYzY2X0IyICAgICAgICAgICAgICAgICAgICAgICAwLjk3NTg4OWYKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfRmM2Nl9BMCAgICAgICAgICAgICAgICAgICAgICAgMC45Nzk1NDdmCi0jZGVmaW5lIEhQRl9GczMyMDAwX0ZjNjZfQTEgICAgICAgICAgICAgICAgICAgICAgICgtMS45NTkwOTNmKQotI2RlZmluZSBIUEZfRnMzMjAwMF9GYzY2X0EyICAgICAgICAgICAgICAgICAgICAgICAwLjk3OTU0N2YKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfRmM2Nl9CMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjk4MTY5NWYpCi0jZGVmaW5lIEhQRl9GczMyMDAwX0ZjNjZfQjIgICAgICAgICAgICAgICAgICAgICAgIDAuOTgxODYxZgotI2Rl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ICAgICAgICAgICAgICAgICgtMS45NTY3NDBmKQotI2RlZmluZSBIUEZfRnMxNjAwMF9GYzc4X0IyICAgICAgICAgICAgICAgICAgICAgICAwLjk1NzY1NmYKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfRmM3OF9BMCAgICAgICAgICAgICAgICAgICAgICAgMC45NzMxNTZmCi0jZGVmaW5lIEhQRl9GczIyMDUwX0ZjNzhfQTEgICAgICAgICAgICAgICAgICAgICAgICgtMS45NDYzMTNmKQotI2RlZmluZSBIUEZfRnMyMjA1MF9GYzc4X0EyICAgICAgICAgICAgICAgICAgICAgICAwLjk3MzE1NmYKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfRmM3OF9CMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjk2ODYwN2YpCi0jZGVmaW5lIEhQRl9GczIyMDUwX0ZjNzhfQjIgICAgICAgICAgICAgICAgICAgICAgIDAuOTY5MDkyZgotI2RlZmluZSBIUEZfRnMyNDAwMF9GYzc4X0EwICAgICAgICAgICAgICAgICAgICAgICAwLjk3NDM5OGYKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfRmM3OF9BMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjk0ODc5N2YpCi0jZGVmaW5lIEhQRl9GczI0MDAwX0ZjNzhfQTIgICAgICAgICAgICAgICAgICAgICAgIDAuOTc0Mzk4ZgotI2RlZmluZSBIUEZfRnMyNDAwMF9GYzc4X0IxICAgICAgICAgICAgICAgICAgICAgICAoLTEuOTcxMTU3ZikKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfRmM3OF9CMiAgICAgICAgICAgICAgICAgICAgICAgMC45NzE1NjhmCi0jZGVmaW5lIEhQRl9GczMyMDAwX0ZjNzhfQTAgICAgICAgICAgICAgICAgICAgICAgIDAuOTc3OTE4ZgotI2RlZmluZSBIUEZfRnMzMjAwMF9GYzc4X0ExICAgICAgICAgICAgICAgICAgICAgICAoLTEuOTU1ODM2ZikKLSNkZWZpbmUgSFBGX0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aW5lIEhQRl9GczgwMDBfRmM5MF9CMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjkwMDIzMWYpCi0jZGVmaW5lIEhQRl9GczgwMDBfRmM5MF9CMiAgICAgICAgICAgICAgICAgICAgICAgMC45MDQ5NzdmCi0jZGVmaW5lIEhQRl9GczExMDI1X0ZjOTBfQTAgICAgICAgICAgICAgICAgICAgICAgMC45NTMzODNmCi0jZGVmaW5lIEhQRl9GczExMDI1X0ZjOTBfQTEgICAgICAgICAgICAgICAgICAgICAgKC0xLjkwNjc2NmYpCi0jZGVmaW5lIEhQRl9GczExMDI1X0ZjOTBfQTIgICAgICAgICAgICAgICAgICAgICAgMC45NTMzODNmCi0jZGVmaW5lIEhQRl9GczExMDI1X0ZjOTBfQjEgICAgICAgICAgICAgICAgICAgICAgKC0xLjkyNzU3OWYpCi0jZGVmaW5lIEhQRl9GczExMDI1X0ZjOTBfQjIgICAgICAgICAgICAgICAgICAgICAgMC45MzAxMTFmCi0jZGVmaW5lIEhQRl9GczEyMDAwX0ZjOTBfQTAgICAgICAgICAgICAgICAgICAgICAgMC45NTYxOTNmCi0jZGVmaW5lIEhQRl9GczEyMDAwX0ZjOTBfQTEgICAgICAgICAgICAgICAgICAgICAgKC0xLjkxMjM4N2YpCi0jZGVmaW5lIEhQRl9GczEyMDAwX0ZjOTBfQTIgICAgICAgICAgICAgICAgICAgICAgMC45NTYxOTNmCi0jZGVmaW5lIEhQRl9GczEyMDAwX0ZjOTBfQjEgICAgICAgICAgICAgICAgICAgICAgKC0xLjkzMzQ1OWYpCi0jZGVmaW5lIEhQRl9GczEyMDAwX0ZjOTBfQjIgICAgICAgICAgICAgICAgICAgICAgMC45MzU2MDNmCi0jZGVmaW5lIEhQRl9GczE2MDAwX0ZjOTBfQTAgICAgICAgICAgICAgICAgICAgICAgMC45NjQxODNmCi0jZGVmaW5lIEhQRl9GczE2MDAwX0ZjOTBfQTEgICAgICAgICAgICAgICAgICAgICAgKC0xLjkyODM2NWYpCi0jZGVmaW5lIEhQRl9GczE2MDAwX0ZjOTBfQTIgICAgICAgICAgICAgICAgICAgICAgMC45NjQxODNmCi0jZGVmaW5lIEhQRl9GczE2MDAwX0ZjOTBfQjEgICAgICAgICAgICAgICAgICAgICAgKC0xLjk1MDA4N2YpCi0jZGVmaW5lIEhQRl9GczE2MDAwX0ZjOTBfQjIgICAgICAgICAgICAgICAgICAgICAgMC45NTEzMDNmCi0jZGVmaW5lIEhQRl9GczIyMDUwX0ZjOTBfQTAgICAgICAgICAgICAgICAgICAgICAgMC45NzA4MDlmCi0jZGVmaW5lIEhQRl9GczIyMDUwX0ZjOTBfQTEgICAgICAgICAgICAgICAgICAgICAgKC0xLjk0MTYxOGYpCi0jZGVmaW5lIEhQRl9GczIyMDUwX0ZjOTBfQTIgICAgICAgICAgICAgICAgICAgICAgMC45NzA4MDlmCi0jZGVmaW5lIEhQRl9GczIyMDUwX0ZjOTBfQjEgICAgICAgICAgICAgICAgICAgICAgKC0xLjk2Mzc3OGYpCi0jZGVmaW5lIEhQRl9GczIyMDUwX0ZjOTBfQjIgICAgICAgICAgICAgICAgICAgICAgMC45NjQ0MjNmCi0jZGVmaW5lIEhQRl9GczI0MDAwX0ZjOTBfQTAgICAgICAgICAgICAgICAgICAgICAgMC45NzIyMzlmCi0jZGVmaW5lIEhQRl9GczI0MDAwX0ZjOTBfQTEgICAgICAgICAgICAgICAgICAgICAgKC0xLjk0NDQ3N2YpCi0jZGVmaW5lIEhQRl9GczI0MDAwX0ZjOTBfQTIgICAgICAgICAgICAgICAgICAgICAgMC45NzIyMzlmCi0jZGVmaW5lIEhQRl9GczI0MDAwX0ZjOTBfQjEgICAgICAgICAgICAgICAgICAgICAgKC0xLjk2NjcyMWYpCi0jZGVmaW5lIEhQRl9GczI0MDAwX0ZjOTBfQjIgICAgICAgICAgICAgICAgICAgICAgMC45NjcyNjZmCi0jZGVmaW5lIEhQRl9GczMyMDAwX0ZjOTBfQTAgICAgICAgICAgICAgICAgICAgICAgMC45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ArMzIzLDI4OCBAQAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAogLyogQ29lZmZpY2llbnRzIGZvciBjZW50cmUgZnJlcXVlbmN5IDU1SHogKi8KLSNkZWZpbmUgQlBGX0ZzODAwMF9GYzU1X0EwICAgICAgICAgICAgICAgICAgICAgICAwLjAwOTE5N2YKLSNkZWZpbmUgQlBGX0ZzODAwMF9GYzU1X0ExICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMGYKLSNkZWZpbmUgQlBGX0ZzODAwMF9GYzU1X0EyICAgICAgICAgICAgICAgICAgICAgICAoLTAuMDA5MTk3ZikKLSNkZWZpbmUgQlBGX0ZzODAwMF9GYzU1X0IxICAgICAgICAgICAgICAgICAgICAgICAoLTEuOTc5NTQ1ZikKLSNkZWZpbmUgQlBGX0ZzODAwMF9GYzU1X0IyICAgICAgICAgICAgICAgICAgICAgICAwLjk4MTM5M2YKLSNkZWZpbmUgQlBGX0ZzMTEwMjVfRmM1NV9BMCAgICAgICAgICAgICAgICAgICAgICAwLjAwNjY5MWYKLSNkZWZpbmUgQlBGX0ZzMTEwMjVfRmM1NV9BMSAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMGYKLSNkZWZpbmUgQlBGX0ZzMTEwMjVfRmM1NV9BMiAgICAgICAgICAgICAgICAgICAgICAoLTAuMDA2NjkxZikKLSNkZWZpbmUgQlBGX0ZzMTEwMjVfRmM1NV9CMSAgICAgICAgICAgICAgICAgICAgICAoLTEuOTg1NDg4ZikKLSNkZWZpbmUgQlBGX0ZzMTEwMjVfRmM1NV9CMiAgICAgICAgICAgICAgICAgICAgICAwLjk4NjQ2NGYKLSNkZWZpbmUgQlBGX0ZzMTIwMDBfRmM1NV9BMCAgICAgICAgICAgICAgICAgICAgICAwLjAwNjE1MGYKLSNkZWZpbmUgQlBGX0ZzMTIwMDBfRmM1NV9BMSA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ICAgICAgICAgICAgICAgICAgKC0xLjk4NTcxNGYpCi0jZGVmaW5lIEJQRl9GczIyMDUwX0ZjNzhfQjIgICAgICAgICAgICAgICAgICAgICAwLjk4NjIwNGYKLSNkZWZpbmUgQlBGX0ZzMjQwMDBfRmM3OF9BMCAgICAgICAgICAgICAgICAgICAgIDAuMDA2MjY4ZgotI2RlZmluZSBCUEZfRnMyNDAwMF9GYzc4X0ExICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDBmCi0jZGVmaW5lIEJQRl9GczI0MDAwX0ZjNzhfQTIgICAgICAgICAgICAgICAgICAgICAoLTAuMDA2MjY4ZikKLSNkZWZpbmUgQlBGX0ZzMjQwMDBfRmM3OF9CMSAgICAgICAgICAgICAgICAgICAgICgtMS45ODY5MDRmKQotI2RlZmluZSBCUEZfRnMyNDAwMF9GYzc4X0IyICAgICAgICAgICAgICAgICAgICAgMC45ODczMThmCi0jZGVmaW5lIEJQRl9GczMyMDAwX0ZjNzhfQTAgICAgICAgICAgICAgICAgICAgICAwLjAwNDcwOWYKLSNkZWZpbmUgQlBGX0ZzMzIwMDBfRmM3OF9BMSAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwZgotI2RlZmluZSBCUEZfRnMzMjAwMF9GYzc4X0EyICAgICAgICAgICAgICAgICAgICAgKC0wLjAwNDcwOWYpCi0jZGVmaW5lIEJQRl9GczMyMDAwX0ZjNzhfQjEgICAgICAgICAgICAgICAgICAgICAoLTEuOTkwMjQwZikKLSNkZWZpbmUgQlBGX0ZzMzIwMDBfRmM3OF9CMiAgICAgICAgICAgICAgICAgICAgIDAuOTkwNDczZgotI2RlZmluZSBCUEZfRnM0NDEwMF9GYzc4X0EwICAgICAgICAgICAgICAgICAgICAgMC4wMDM0MjFmCi0jZGVmaW5lIEJQRl9GczQ0MTAwX0ZjNzhfQTEgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMGYKLSNkZWZpbmUgQlBGX0ZzNDQxMDBfRmM3OF9BMiAgICAgICA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kwX0IyICAgICAgICAgICAgICAgICAgICAgIDAuOTY2Mzc3ZgotI2RlZmluZSBCUEZfRnMxMjAwMF9GYzkwX0EwICAgICAgICAgICAgICAgICAgICAgIDAuMDE1Mjg5ZgotI2RlZmluZSBCUEZfRnMxMjAwMF9GYzkwX0ExICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwZgotI2RlZmluZSBCUEZfRnMxMjAwMF9GYzkwX0EyICAgICAgICAgICAgICAgICAgICAgICgtMC4wMTUyODlmKQotI2RlZmluZSBCUEZfRnMxMjAwMF9GYzkwX0IxICAgICAgICAgICAgICAgICAgICAgICgtMS45NjY4ODJmKQotI2RlZmluZSBCUEZfRnMxMjAwMF9GYzkwX0IyICAgICAgICAgICAgICAgICAgICAgIDAuOTY5MDY3ZgotI2RlZmluZSBCUEZfRnMxNjAwMF9GYzkwX0EwICAgICAgICAgICAgICAgICAgICAgIDAuMDExNTExZgotI2RlZmluZSBCUEZfRnMxNjAwMF9GYzkwX0ExICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwZgotI2RlZmluZSBCUEZfRnMxNjAwMF9GYzkwX0EyICAgICAgICAgICAgICAgICAgICAgICgtMC4wMTE1MTFmKQotI2RlZmluZSBCUEZfRnMxNjAwMF9GYzkwX0IxICAgICAgICAgICAgICAgICAgICAgICgtMS45NzU0NzdmKQotI2RlZmluZSBCUEZfRnMxNjAwMF9GYzkwX0IyICAgICAgICAgICAgICAgICAgICAgIDAuOTc2NzExZgotI2RlZmluZSBCUEZfRnMyMjA1MF9GYzkwX0EwICAgICAgICAgICAgICAgICAgICAgIDAuMDA4Mzc5ZgotI2RlZmluZSBCUEZfRnMyMjA1MF9GYzkwX0ExICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwZgotI2RlZmluZSBCUEZfRnMyMjA1MF9GYzkwX0EyICAgICAgICAgICAgICAgICAgICAgICgtMC4wMDgzNzlmKQotI2RlZmluZSBCUEZfRnMyMjA1MF9GYzkwX0IxICAgICAgICAgICAgICAgICAgICAgICgtMS45ODIzOTVmKQotI2RlZmluZSBCUEZfRnMyMjA1MF9GYzkwX0IyICAgICAgICAgICAgICAgICAgICAgIDAuOTgzMDQ3ZgotI2RlZmluZSBCUEZfRnMyNDAwMF9GYzkwX0EwICAgICAgICAgICAgICAgICAgICAgIDAuMDA3NzA0ZgotI2RlZmluZSBCUEZfRnMyNDAwMF9GYzkwX0ExICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwZgotI2RlZmluZSBCUEZfRnMyNDAwMF9GYzkwX0EyICAgICAgICAgICAgICAgICAgICAgICgtMC4wMDc3MDRmKQotI2RlZmluZSBCUEZfRnMyNDAwMF9GYzkwX0IxICAgICAgICAgICAgICAgICAgICAgICgtMS45ODM4NjNmKQotI2RlZmluZSBCUEZfRnMyNDAwMF9GYzkwX0IyICAgICAgICAgICAgICAgICAgICAgIDAuOTg0NDE0ZgotI2RlZmluZSBCUEZfRnMzMjAwMF9GYzkwX0EwICAgICAgICAgICAgICAgICAgICAgIDAuMDA1Nzg5ZgotI2RlZmluZSBCUEZfRnMzMjAwMF9GYzkwX0ExICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwZgotI2RlZmluZSBCUEZfRnMzMjAwMF9GYzkwX0EyICAgICAgICAgICAgICAgICAgICAgICgtMC4wMDU3ODlmKQotI2RlZmluZSBCUEZfRnMzMjAwMF9GYzkwX0IxICAgICAgICAgICAgICAgICAgICAgICgtMS45ODc5NzdmKQotI2RlZmluZSBCUEZfRnMzMjAwMF9GYzkwX0IyICAgICAgICAgICAgICAgICAgICAgIDAuOTg4Mjg4ZgotI2RlZmluZSBCUEZfRnM0NDEwMF9GYzkwX0EwICAgICAgICAgICAgICAgICAgICAgIDAuMDA0MjA3ZgotI2RlZmluZSBCUEZfRnM0NDEwMF9GYzkwX0ExICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwZgotI2RlZmluZSBCUEZfRnM0NDEwMF9GYzkwX0EyICAgICAgICAgICAgICAgICA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AgICAoLTEuOTk4MDc1ZikKLSNkZWZpbmUgQlBGX0ZzMTkyMDAwX0ZjOTBfQjIgICAgICAgICAgICAgICAgICAgICAwLjk5ODA4NWYKKyNkZWZpbmUgQlBGX0ZzMTkyMDAwX0ZjOTBfQTAgMC4wMDA5NThmCisjZGVmaW5lIEJQRl9GczE5MjAwMF9GYzkwX0ExIDAuMDAwMDAwZgorI2RlZmluZSBCUEZfRnMxOTIwMDBfRmM5MF9BMiAoLTAuMDAwOTU4ZikKKyNkZWZpbmUgQlBGX0ZzMTkyMDAwX0ZjOTBfQjEgKC0xLjk5ODA3NWYpCisjZGVmaW5lIEJQRl9GczE5MjAwMF9GYzkwX0IyIDAuOTk4MDg1ZgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTYxMyw3NCArNjEzLDc0IEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCiAvKiBBR0MgVGltZSBjb25zdGFudHMgKi8KLSNkZWZpbmUgQUdDX0FUVEFDS19GczgwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuODQxMzk1ZgotI2RlZmluZSBBR0NfQVRUQUNLX0ZzMTEwMjUgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC44ODIyMjNmCi0jZGVmaW5lIEFHQ19BVFRBQ0tfRnMxMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjg5MTI1MWYKLSNkZWZpbmUgQUdDX0FUVEFDS19GczE2MDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuOTE3Mjc2ZgotI2RlZmluZSBBR0NfQVR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gICAgICAgICAgICAgMC45OTIxOTlmCi0jZGVmaW5lIEFHQ19BVFRBQ0tfRnMxOTIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC45OTI4MzBmCisjZGVmaW5lIEFHQ19BVFRBQ0tfRnM4ODIwMCAwLjk4NDQ1OGYKKyNkZWZpbmUgQUdDX0FUVEFDS19Gczk2MDAwIDAuOTg1NzEyZgorI2RlZmluZSBBR0NfQVRUQUNLX0ZzMTc2NDAwIDAuOTkyMTk5ZgorI2RlZmluZSBBR0NfQVRUQUNLX0ZzMTkyMDAwIDAuOTkyODMwZgogCi0jZGVmaW5lIERFQ0FZX1NISUZUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAorI2RlZmluZSBERUNBWV9TSElGVCAxMAogCi0jZGVmaW5lIEFHQ19ERUNBWV9GczgwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDA0MmYKLSNkZWZpbmUgQUdDX0RFQ0FZX0ZzMTEwMjUgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDMwZgotI2RlZmluZSBBR0NfREVDQVlfRnMxMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMjhmCi0jZGVmaW5lIEFHQ19ERUNBWV9GczE2MDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAyMWYKLSNkZWZpbmUgQUdDX0RFQ0FZX0ZzMjIwNTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDE1ZgotI2RlZmluZSBBR0NfREVDQVlfRnMyNDAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMTRmCi0jZGVmaW5lIEFHQ19ERUNBWV9GczMyMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAxMGYKLSNkZWZpbmUgQUdDX0RFQ0FZX0ZzNDQxMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDA4ZgotI2R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AKIC8qIEFHQyBHYWluIHNldHRpbmdzICovCi0jZGVmaW5lIEFHQ19HQUlOX1NDQUxFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxICAgICAgICAgLyogQXMgYSBwb3dlciBvZiAyICovCi0jZGVmaW5lIEFHQ19HQUlOX1NISUZUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0ICAgICAgICAgLyogQXMgYSBwb3dlciBvZiAyICovCi0jZGVmaW5lIEFHQ19UQVJHRVRMRVZFTCAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjk4ODU1M2YKLSNkZWZpbmUgQUdDX0hQRkdBSU5fMGRCICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuNDEyNTM4ZgotI2RlZmluZSBBR0NfR0FJTl8wZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDBmCi0jZGVmaW5lIEFHQ19IUEZHQUlOXzFkQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjU4NDg5M2YKLSNkZWZpbmUgQUdDX0dBSU5fMWRCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMTIyMDE4ZgotI2RlZmluZSBBR0NfSFBGR0FJTl8yZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC43NzgyNzlmCi0jZGVmaW5lIEFHQ19HQUlOXzJkQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI1ODkyNWYKLSNkZWZpbmUgQUdDX0hQRkdBSU5fM2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuOTk1MjYyZgotI2RlZmluZSBBR0NfR0FJTl8zZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC40MTI1MzhmCi0jZGVmaW5lIEFHQ19IUEZHQUlOXzRkQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjIzODcyMWYKLSNkZWZpbmUgQUdDX0dBSU5fNGRCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuNTg0ODkzZgotI2RlZmluZSBBR0NfSFBGR0FJTl81ZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS41MTE4ODZmCi0jZGVmaW5lIEFHQ19HQUlOXzVkQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjc3ODI3OWYKLSNkZWZpbmUgQUdDX0hQRkdBSU5fNmRCICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuODE4MzgzZgotI2RlZmluZSBBR0NfR0FJTl82ZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC45OTUyNjJmCi0jZGVmaW5lIEFHQ19IUEZHQUlOXzdkQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjE2MjI3OGYKLSNkZWZpbmUgQUdDX0dBSU5fN2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMjM4NzIxZgotI2RlZmluZSBBR0NfSFBGR0FJTl84ZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMi41NDgxMzRmCi0jZGVmaW5lIEFHQ19HQUlOXzhkQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjUxMTg4NmYKLSNkZWZpbmUgQUdDX0hQRkdBSU5fOWRCICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIuOTgxMDcyZgotI2RlZmluZSBBR0NfR0FJTl85ZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS44MTgzODNmCi0jZGVmaW5lIEFHQ19IUEZHQUlOXzEwZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAzLjQ2NjgzNmYKLSNkZWZpbmUgQUdDX0dBSU5fMTBkQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIuMTYyMjc4ZgotI2RlZmluZSBBR0NfSFBGR0FJTl8xMWRCICAgICAgICAgICAgICAgICAgICAgICAgICAgNC4wMTE4NzJmCi0jZGVmaW5lIEFHQ19HQUlOXzExZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjU0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yNkZWZpbmUgQUdDX0dBSU5fMTRkQiA0LjAxMTg3MmYKKyNkZWZpbmUgQUdDX0hQRkdBSU5fMTVkQiA2Ljk0MzI4MmYKKyNkZWZpbmUgQUdDX0dBSU5fMTVkQiA0LjYyMzQxM2YKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC02ODksMzggKzY4OSwzOCBAQAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAogLyogVm9sdW1lIGNvbnRyb2wgZ2FpbiAqLwotI2RlZmluZSBWT0xVTUVfTUFYICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCAgICAgICAgIC8qIEluIGRCcyAqLwotI2RlZmluZSBWT0xVTUVfU0hJRlQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCAgICAgICAgIC8qIEluIGRCcyAqLworI2RlZmluZSBWT0xVTUVfTUFYIDAgICAvKiBJbiBkQnMgKi8KKyNkZWZpbmUgVk9MVU1FX1NISUZUIDAgLyogSW4gZEJzICovCiAKIC8qIFZvbHVtZSBjb250cm9sIHRpbWUgY29uc3RhbnRzICovCi0jZGVmaW5lIFZPTF9UQ19TSElGVCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxICAgICAgICAgLyogQXMgYSBwb3dlciBvZiAyICovCi0jZGVmaW5lIFZPTF9UQ19GczgwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDI0NjkwZgotI2RlZmluZSBWT0xfVENfRnMxMTAyNSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAxNzk3N2YKLSNkZWZpbmUgVk9MX1RDX0ZzMTIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMTY1MjlmCi0jZGVmaW5lIFZPTF9UQ19GczE2MDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDEyNDIyZgotI2RlZmluZSBWT0xfVENfRnMyMjA1MCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwOTAyOWYKLSNkZWZpbmUgVk9MX1RDX0ZzMjQwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDgyOTlmCi0jZGVmaW5lIFZPTF9UQ19GczMyMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDA2MjMxZgotI2RlZmluZSBWT0xfVENfRnM0NDEwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwNDUyNWYKLSNkZWZpbmUgVk9MX1RDX0ZzNDgwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDQxNThmCi0jZGVmaW5lIFZPTF9UQ19Gczg4MjAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAyMjYzZgotI2RlZmluZSBWT0xfVENfRnM5NjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMjA3OWYKLSNkZWZpbmUgVk9MX1RDX0ZzMTc2NDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDExMzFmCi0jZGVmaW5lIFZPTF9UQ19GczE5MjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAxMDM5ZgotI2RlZmluZSBNSVhfVENfRnM4MDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOTM2NSAgICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuODk2MTUxICovCi0jZGVmaW5lIE1JWF9UQ19GczExMDI1ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMwMjMwICAgICAgICAgLyogRmxvYXRpbmcgcG9pbnQgdmFsdWUgMC45MjI1NDggKi8KLSNkZWZpbmUgTUlYX1RDX0ZzMTIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzA0MjIgICAgICAgICAvKiBGbG9hdGluZyBwb2ludCB2YWx1ZSAwLjkyODQxNSAqLwotI2RlZmluZSBNSVhfVENfRnMxNjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMDk3OCAgICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuOTQ1Mzg3ICovCi0jZGVmaW5lIE1JWF9UQ19GczIyMDUwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxNDUxICAgICAgICAgLyogRmxvYXRpbmcgcG9pbnQgdmFsdWUgMC45NTk4MDQgKi8KLSNkZWZpbmUgTUlYX1RDX0ZzMjQwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzE1NTQgICAgICAgICAvKiBGbG9hdGluZyBwb2ludCB2YWx1ZSAwLjk2Mjk1NiAqLwotI2RlZmluZSBNSVhfVENfRnMzMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTg1MCAgICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuOTcxOTczICovCi0jZGVmaW5lIE1JWF9UQ19GczQ0MTAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMyMDk3ICAgICAgICAgLyogRmxvYXRpbmcgcG9pbnQgdmFsdWUgMC45Nzk1MTUgKi8KLSNkZWZpbmUgTUlYX1RDX0ZzNDgwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzIxNTAgICAgICAgICAvKiBGbG9hdGluZyBwb2ludCB2YWx1ZSAwLjk4MTE1MCAqLworI2RlZmluZSBWT0xfVENfU0hJRlQgMjEgLy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5lIE1JWF9UQ19GczE5MjAwMCAzMjYxMSAvKiBGbG9hdGluZyBwb2ludCB2YWx1ZSAwLjk5MjUyNCAqLwogCiAjZW5kaWYKZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CYXNzL3NyYy9MVkRCRV9Db250cm9sLmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CYXNzL3NyYy9MVkRCRV9Db250cm9sLmNwcAppbmRleCA1M2ZlYWU4Li45ZmU4MTE2IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQmFzcy9zcmMvTFZEQkVfQ29udHJvbC5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0Jhc3Mvc3JjL0xWREJFX0NvbnRyb2wuY3BwCkBAIC0yMSw2ICsyMSw4IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCisjaW5jbHVkZSA8YXVkaW9fdXRpbHMvQmlxdWFkRmlsdGVyLmg+CisjaW5jbHVkZSA8c3lzdGVtL2F1ZGlvLmg+CiAjaW5jbHVkZSAiTFZEQkUuaCIKICNpbmNsdWRlICJMVkRCRV9Qcml2YXRlLmgiCiAjaW5jbHVkZSAiVmVjdG9yQXJpdGhtZXRpYy5oIgpAQCAtNDcsMTUgKzQ5LDEyIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVkRCRV9SZXR1cm5TdGF0dXNfZW4gTFZEQkVfR2V0UGFyYW1ldGVycyhMVkRCRV9IYW5kbGVfdCAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9QYXJhbXNfdCAgICAgICAgKnBQYXJhbXMpCi17Ci0KLSAgICBMVkRCRV9JbnN0YW5jZV90ICAgICpwSW5zdGFuY2UgPShMVkRCRV9JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKK0xWREJFX1JldHVyblN0YXR1c19lbiBMVkRCRV9HZXRQYXJhbWV0ZXJzKExWREJFX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZEQkVfUGFyYW1zX3QqIHBQYXJhbXMpIHsKKyAgICBMVkRCRV9JbnN0YW5jZV90KiBwSW5zdGFuY2UgPSAoTFZEQkVfSW5zdGFuY2VfdCopaEluc3RhbmNlOwogCiAgICAgKnBQYXJhbXMgPSBwSW5zdGFuY2UtPlBhcmFtczsKIAotICAgIHJldHVybihMVkRCRV9TVUNDRVNTKTsKKyAgICByZXR1cm4gKExWREJFX1NVQ0NFU1MpOwogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtNzcsMTUgKzc2LDEzIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZEQkVfUmV0dXJuU3RhdHVzX2VuIExWREJFX0dldENhcGFiaWxpdGllcyhMVkRCRV9IYW5kbGVfdCAgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9DYXBhYmlsaXRpZXNfdCAgICAqcENhcGFiaWxpdGllcykKLXsKLQotICAgIExWREJFX0luc3RhbmNlX3QgICAgKnBJbnN0YW5jZSA9KExWREJFX0luc3RhbmNlX3QgICopaEluc3RhbmNlOworTFZEQkVfUmV0dXJuU3RhdHVzX2VuIExWREJFX0dldENhcGFiaWxpdGllcyhMVkRCRV9IYW5kbGVfdCBoSW5zdGFuY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX0NhcGFiaWxpdGllc190KiBwQ2FwYWJpbGl0aWVzKSB7CisgICAgTFZEQkVfSW5zdGFuY2VfdCogcEluc3RhbmNlID0gKExWREJFX0luc3RhbmNlX3QqKWhJbnN0YW5jZTsKIAogICAgICpwQ2FwYWJpbGl0aWVzID0gcEluc3RhbmNlLT5DYXBhYmlsaXRpZXM7CiAKLSAgICByZXR1cm4oTFZEQkVfU1VDQ0VTUyk7CisgICAgcmV0dXJuIChMVkRCRV9TVUNDRVNTKTsKIH0KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTEwMSwzNSArOTgsMzAgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi12b2lkICAgIExWREJFX1NldEZpbHRlcnMoTFZEQkVfSW5zdGFuY2VfdCAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9QYXJhbXNfdCAgICAgICAqcFBhcmFtcykKLXsKLQordm9pZCBMVkRCRV9TZXRGaWx0ZXJzKExWREJFX0luc3RhbmNlX3QqIHBJbnN0YW5jZSwgTFZEQkVfUGFyYW1zX3QqIHBQYXJhbXMpIHsKICAgICAvKgogICAgICAqIENhbGN1bGF0ZSB0aGUgdGFibGUgb2Zmc2V0cwogICAgICAqLwotICAgIExWTV9VSU5UMTYgT2Zmc2V0ID0gKExWTV9VSU5UMTYpKChMVk1fVUlOVDE2KXBQYXJhbXMtPlNhbXBsZVJhdGUgKyBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX1VJTlQxNikocFBhcmFtcy0+Q2VudHJlRnJlcXVlbmN5ICogKDErTFZEQkVfRlNfMTkyMDAwKSkpOworICAgIExWTV9VSU5UMTYgT2Zmc2V0ID0KKyAgICAgICAgICAgIChMVk1fVUlOVDE2KSgoTFZNX1VJTlQxNilwUGFyYW1zLT5TYW1wbGVSYXRlICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX1VJTlQxNikocFBhcmFtcy0+Q2VudHJlRnJlcXVlbmN5ICogKDEgKyBMVkRCRV9GU18xOTIwMDApKSk7CiAKICAgICAvKgogICAgICAqIFNldHVwIHRoZSBoaWdoIHBhc3MgZmlsdGVyCiAgICAgICovCi0gICAgTG9hZENvbnN0X0Zsb2F0KDAsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogQ2xlYXIgdGhlIGhpc3RvcnksIHZhbHVlIDAgKi8KLSAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUICopJnBJbnN0YW5jZS0+cERhdGEtPkhQRlRhcHMsICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICBzaXplb2YocEluc3RhbmNlLT5wRGF0YS0+SFBGVGFwcykgLyBzaXplb2YoTFZNX0ZMT0FUKSk7IC8qIE51bWJlciBvZiB3b3JkcyAqLwotICAgIEJRXzJJX0QzMkYzMkNsbF9UUkNfV1JBXzAxX0luaXQoJnBJbnN0YW5jZS0+cENvZWYtPkhQRkluc3RhbmNlLCAgICAvKiBJbml0aWFsaXNlIHRoZSBmaWx0ZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwSW5zdGFuY2UtPnBEYXRhLT5IUEZUYXBzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEJRX0ZMT0FUX0NvZWZzX3QgKikmTFZEQkVfSFBGX1RhYmxlW09mZnNldF0pOworICAgIHN0ZDo6YXJyYXk8TFZNX0ZMT0FULCBhbmRyb2lkOjphdWRpb191dGlsczo6a0JpcXVhZE51bUNvZWZzPiBjb2VmcyA9IHsKKyAgICAgICAgICAgIExWREJFX0hQRl9UYWJsZVtPZmZzZXRdLkEwLCBMVkRCRV9IUEZfVGFibGVbT2Zmc2V0XS5BMSwgTFZEQkVfSFBGX1RhYmxlW09mZnNldF0uQTIsCisgICAgICAgICAgICAtKExWREJFX0hQRl9UYWJsZVtPZmZzZXRdLkIxKSwgLShMVkRCRV9IUEZfVGFibGVbT2Zmc2V0XS5CMil9OworICAgIHBJbnN0YW5jZS0+cEhQRkJpcXVhZAorICAgICAgICAgICAgLT5zZXRDb2VmZmljaWVudHM8c3RkOjphcnJheTxMVk1fRkxPQVQsIGFuZHJvaWQ6OmF1ZGlvX3V0aWxzOjprQmlxdWFkTnVtQ29lZnM+Pihjb2Vmcyk7CiAKICAgICAvKgogICAgICAqIFNldHVwIHRoZSBiYW5kIHBhc3MgZmlsdGVyCiAgICAgICovCi0gICAgTG9hZENvbnN0X0Zsb2F0KDAsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIENsZWFyIHRoZSBoaXN0b3J5LCB2YWx1ZSAwICovCi0gICAgICAgICAgICAgICAgIChMVk1fRkxPQVQgKikmcEluc3RhbmNlLT5wRGF0YS0+QlBGVGFwcywgICAgICAgIC8qIERlc3RpbmF0aW9uICovCi0gICAgICAgICAgICAgICAgIHNpemVvZihwSW5zdGFuY2UtPnBEYXRhLT5CUEZUYXBzKSAvIHNpemVvZihMVk1fRkxPQVQpKTsgICAvKiBOdW1iZXIgb2Ygd29yZHMgKi8KLSAgICBCUF8xSV9EMzJGMzJDbGxfVFJDX1dSQV8wMl9Jbml0KCZwSW5zdGFuY2UtPnBDb2VmLT5CUEZJbnN0YW5jZSwgICAgLyogSW5pdGlhbGlzZSB0aGUgZmlsdGVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcEluc3RhbmNlLT5wRGF0YS0+QlBGVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChCUF9GTE9BVF9Db2Vmc190ICopJkxWREJFX0JQRl9UYWJsZVtPZmZzZXRdKTsKKyAgICBjb2VmcyA9IHtMVkRCRV9CUEZfVGFibGVbT2Zmc2V0XS5BMCwgMC4wLCAtKExWREJFX0JQRl9UYWJsZVtPZmZzZXRdLkEwKSwKKyAgICAgICAgICAgICAtKExWREJFX0JQRl9UYWJsZVtPZmZzZXRdLkIxKSwgLShMVkRCRV9CUEZfVGFibGVbT2Zmc2V0XS5CMil9OworICAgIHBJbnN0YW5jZS0+cEJQRkJpcXVhZAorICAgICAgICAgICAgLT5zZXRDb2VmZmljaWVudHM8c3RkOjphcnJheTxMVk1fRkxPQVQsIGFuZHJvaWQ6OmF1ZGlvX3V0aWxzOjprQmlxdWFkTnVtQ29lZnM+Pihjb2Vmcyk7CiB9CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCkBAIC0xNDUsMjkgKzEzNywyNiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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GFyZ2V0ID0gQUdDX1RBUkdFVExFVkVMOwotCiB9CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCkBAIC0xOTMsMjkgKzE4MiwyMiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLXZvaWQgICAgTFZEQkVfU2V0Vm9sdW1lKExWREJFX0luc3RhbmNlX3QgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9QYXJhbXNfdCAgICAgICAqcFBhcmFtcykKLXsKK3ZvaWQgTFZEQkVfU2V0Vm9sdW1lKExWREJFX0luc3RhbmNlX3QqIHBJbnN0YW5jZSwgTFZEQkVfUGFyYW1zX3QqIHBQYXJhbXMpIHsKKyAgICBMVk1fVUlOVDE2IGRCU2hpZnRzOyAgLyogNmRCIHNoaWZ0cyAqLworICAgIExWTV9VSU5UMTYgZEJPZmZzZXQ7ICAvKiBUYWJsZSBvZmZzZXQgKi8KKyAgICBMVk1fSU5UMTYgVm9sdW1lID0gMDsgLyogUmVxdWlyZWQgdm9sdW1lIGluIGRCcyAqLwogCi0gICAgTFZNX1VJTlQxNiAgICAgIGRCU2hpZnRzOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogNmRCIHNoaWZ0cyAqLwotICAgIExWTV9VSU5UMTYgICAgICBkQk9mZnNldDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFRhYmxlIG9mZnNldCAqLwotICAgIExWTV9JTlQxNiAgICAgICBWb2x1bWUgPSAwOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFJlcXVpcmVkIHZvbHVtZSBpbiBkQnMgKi8KLQotICAgIExWTV9GTE9BVCAgICAgICAgZEJTaGlmdHNfZmFjOworICAgIExWTV9GTE9BVCBkQlNoaWZ0c19mYWM7CiAgICAgLyoKICAgICAgKiBBcHBseSB0aGUgdm9sdW1lIGlmIGVuYWJsZWQKICAgICAgKi8KLSAgICBpZiAocFBhcmFtcy0+Vm9sdW1lQ29udHJvbCA9PSBMVkRCRV9WT0xVTUVfT04pCi0gICAgeworICAgIGlmIChwUGFyYW1zLT5Wb2x1bWVDb250cm9sID09IExWREJFX1ZPTFVNRV9PTikgewogICAgICAgICAvKgogICAgICAgICAgKiBMaW1pdCB0aGUgZ2FpbiB0byB0aGUgbWF4aW11bSBhbGxvd2VkCiAgICAgICAgICAqLwotICAgICAgICBpZiAgKHBQYXJhbXMtPlZvbHVtZWRCID4gVk9MVU1FX01BWCkKLSAgICAgICAgeworICAgICAgICBpZiAocFBhcmFtcy0+Vm9sdW1lZEIgPiBWT0xVTUVfTUFYKSB7CiAgICAgICAgICAgICBWb2x1bWUgPSBWT0xVTUVfTUFYOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgeworICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgVm9sdW1lID0gcFBhcmFtcy0+Vm9sdW1lZEI7CiAgICAgICAgIH0KICAgICB9CkBAIC0yMjMsOCArMjA1LDggQEAKICAgICAvKgogICAgICAqIENhbGN1bGF0ZSB0aGUgcmVxdWlyZWQgZ2FpbiBhbmQgc2hpZnRzCiAgICAgICovCi0gICAgZEJPZmZzZXQgPSAoTFZNX1VJTlQxNikoNiArIFZvbHVtZSAlIDYpOyAgICAgICAgICAgICAgICAgICAgLyogR2V0IHRoZSBkQnMgMC01ICovCi0gICAgZEJTaGlmdHMgPSAoTFZNX1VJTlQxNikoVm9sdW1lIC8gLTYpOyAgICAgICAgICAgICAgICAgICAgICAgLyogR2V0IHRoZSA2ZEIgc2hpZ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gIGlmIChkQlNoaWZ0cyA+IDApIHsKICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldCgmcEluc3RhbmNlLT5wRGF0YS0+QnlwYXNzVm9sdW1lLk1peGVyU3RyZWFtWzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX1ZvbHVtZVRhYmxlW2RCT2Zmc2V0XSAvIGRCU2hpZnRzX2ZhYyk7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7CisgICAgfSBlbHNlIHsKICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldCgmcEluc3RhbmNlLT5wRGF0YS0+QnlwYXNzVm9sdW1lLk1peGVyU3RyZWFtWzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX1ZvbHVtZVRhYmxlW2RCT2Zmc2V0XSk7CiAgICAgfQogCiAgICAgcEluc3RhbmNlLT5wRGF0YS0+QnlwYXNzVm9sdW1lLk1peGVyU3RyZWFtWzBdLkNhbGxiYWNrU2V0ID0gMTsKICAgICBMVkNfTWl4ZXJfVmFyU2xvcGVfU2V0VGltZUNvbnN0YW50KCZwSW5zdGFuY2UtPnBEYXRhLT5CeXBhc3NWb2x1bWUuTWl4ZXJTdHJlYW1bMF0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX01JWEVSX1RDLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0ZzX2VuKXBJbnN0YW5jZS0+UGFyYW1zLlNhbXBsZVJhdGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfTUlYRVJfVEMsIChMVk1fRnNfZW4pcEluc3RhbmNlLT5QYXJhbXMuU2FtcGxlUmF0ZSwgMik7CiB9CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtMjkyLDIxICsyNzAsMjUgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLUxWREJFX1JldHVyblN0YXR1c19lbiBMVkRCRV9Db250cm9sKExWREJFX0hhbmRsZV90ICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9QYXJhbXNfdCAgICAgICAgICpwUGFyYW1zKQoteworTFZEQkVfUmV0dXJuU3RhdHVzX2VuIExWREJFX0NvbnRyb2woTFZEQkVfSGFuZGxlX3QgaEluc3RhbmNlLCBMVkRCRV9QYXJhbXNfdCogcFBhcmFtcykgeworICAgIExWREJFX0luc3RhbmNlX3QqIHBJbnN0YW5jZSA9IChMVkRCRV9JbnN0YW5jZV90KiloSW5zdGFuY2U7CisgICAgTFZNaXhlcjNfMlN0X0ZMT0FUX3N0KiBwQnlwYXNzTWl4ZXJfSW5zdGFuY2UgPSAmcEluc3RhbmNlLT5wRGF0YS0+QnlwYXNzTWl4ZXI7CiAKLSAgICBMVkRCRV9JbnN0YW5jZV90ICAgICpwSW5zdGFuY2UgPShMVkRCRV9JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLSAgICBMVk1peGVyM18yU3RfRkxPQVRfc3QgICAgICpwQnlwYXNzTWl4ZXJfSW5zdGFuY2UgPSAmcEluc3RhbmNlLT5wRGF0YS0+QnlwYXNzTWl4ZXI7Ci0KKyAgICAvKgorICAgICAqIENyZWF0ZSBiaXF1YWQgaW5zdGFuY2UKKyAgICAgKi8KKyAgICBpZiAocEluc3RhbmNlLT5QYXJhbXMuTnJDaGFubmVscyAhPSBwUGFyYW1zLT5OckNoYW5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cGFzc01peGVyLk1peGVyU3RyZWFtWzFdLCAwKTsKICAgICB9CkBAIC0zNTQsNSArMzMxLDUgQEAKICAgICAgKi8KICAgICBwSW5zdGFuY2UtPlBhcmFtcyA9ICpwUGFyYW1zOwogCi0gICAgcmV0dXJuKExWREJFX1NVQ0NFU1MpOworICAgIHJldHVybiAoTFZEQkVfU1VDQ0VTUyk7CiB9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQmFzcy9zcmMvTFZEQkVfSW5pdC5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQmFzcy9zcmMvTFZEQkVfSW5pdC5jcHAKaW5kZXggYWQ3NzY5Ni4uYjExM2Y0OCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0Jhc3Mvc3JjL0xWREJFX0luaXQuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CYXNzL3NyYy9MVkRCRV9Jbml0LmNwcApAQCAtMjEsMjA5ICsyMSw5MyBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAorI2luY2x1ZGUgPHN5c3RlbS9hdWRpby5oPgorI2luY2x1ZGUgPHN0ZGxpYi5oPgogI2luY2x1ZGUgIkxWREJFLmgiCiAjaW5jbHVkZSAiTFZEQkVfUHJpdmF0ZS5oIgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgICBMVkRCRV9NZW1vcnkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgVGhpcyBmdW5jdGlvbiBpcyB1c2VkIGZvciBtZW1vcnkgYWxsb2NhdGlvbiBhbmQgZnJlZS4gSXQgY2FuIGJlIGNhbGxlZCBpbiAgICAgICAgICovCi0vKiAgICB0d28gd2F5czogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgIGhJbnN0YW5jZSA9IE5VTEwgICAgICAgICAgICAgICAgUmV0dXJucyB0aGUgbWVtb3J5IHJlcXVpcmVtZW50cyAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgaEluc3RhbmNlID0gSW5zdGFuY2UgaGFuZGxlICAgICAgICBSZXR1cm5zIHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzIGFuZCAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbG9jYXRlZCBiYXNlIGFkZHJlc3NlcyBmb3IgdGhlIGluc3RhbmNlICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICBXaGVuIHRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciBtZW1vcnkgYWxsb2NhdGlvbiAoaEluc3RhbmNlPU5VTEwpIHRoZSBtZW1vcnkgICAgKi8KLS8qICBiYXNlIGFkZHJlc3MgcG9pbnRlcnMgYXJlIE5VTEwgb24gcmV0dXJuLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICBXaGVuIHRoZSBmdW5jdGlvbiBpcyBjYWxsZWQgZm9yIGZyZWUgKGhJbnN0YW5jZSA9IEluc3RhbmNlIEhhbmRsZSkgdGhlIG1lbW9yeSAgICAgKi8KLS8qICB0YWJsZSByZXR1cm5zIHRoZSBhbGxvY2F0ZWQgbWVtb3J5IGFuZCBiYXNlIGFkZHJlc3NlcyB1c2VkIGR1cmluZyBpbml0aWFsaXNhdGlvbi4gICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2UgICAgICAgICAgICAgICAgSW5zdGFuY2UgSGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBNZW1vcnlUYWJsZSAgICAgICAgICAgICBQb2ludGVyIHRvIGFuIGVtcHR5IG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICovCi0vKiAgICBwQ2FwYWJpbGl0aWVzICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBjYXBhYmlsaXRpZXMgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZEQkVfU1VDQ0VTUyAgICAgICAgICAgIFN1Y2NlZWRlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAxLiAgICBUaGlzIGZ1bmN0aW9uIG1heSBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZEQkVfUHJvY2VzcyBmdW5jdGlvbiAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLUxWREJFX1JldHVyblN0YXR1c19lbiBMVkRCRV9NZW1vcnkoTFZEQkVfSGFuZGxlX3QgICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX01lbVRhYl90ICAgICAgICAgICAgKnBNZW1vcnlUYWJsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfQ2FwYWJpbGl0aWVzX3QgICAgICAqcENhcGFiaWxpdGllcykKLXsKLQotICAgIExWTV9VSU5UMzIgICAgICAgICAgU2NyYXRjaFNpemU7Ci0gICAgTFZEQkVfSW5zdGFuY2VfdCAgICAqcEluc3RhbmNlID0gKExWREJFX0luc3RhbmNlX3QgKiloSW5zdGFuY2U7Ci0KLSAgICAvKgotICAgICAqIEZpbGwgaW4gdGhlIG1lbW9yeSB0YWJsZQotICAgICAqLwotICAgIGlmIChoSW5zdGFuY2UgPT0gTFZNX05VTEwpCi0gICAgewotICAgICAgICAvKgotICAgICAgICAgKiBJbnN0YW5jZSBtZW1vcnkKLSAgICAgICAgICovCi0gICAgICAgIHBNZW1vcnlUYWJsZS0+UmVnaW9uW0xWREJFX01FTVJFR0lPTl9JTlNUQU5DRV0uU2l6ZSAgICAgICAgID0gc2l6ZW9mKExWREJFX0luc3RhbmNlX3QpOwotICAgICAgICBwTWVtb3J5VGFibGUtPlJlZ2lvbltMVkRCRV9NRU1SRUdJT05fSU5TVEFOQ0VdLkFsaWdubWVudCAgICA9IExWREJFX0lOU1RBTkNFX0FMSUdOOwotICAgICAgICBwTWVtb3J5VGFibGUtPlJlZ2lvbltMVkRCRV9NRU1SRUdJT05fSU5TVEFOQ0VdLlR5cGUgICAgICAgICA9IExWREJFX1BFUlNJU1RFTlQ7Ci0gICAgICAgIHBNZW1vcnlUYWJsZS0+UmVnaW9uW0xWREJFX01FTVJFR0lPTl9JTlNUQU5DRV0ucEJhc2VBZGRyZXNzID0gTFZNX05VTEw7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogRGF0YSBtZW1vcnkKLSAgICAgICAgICovCi0gICAgICAgIHBNZW1vcnlUYWJsZS0+UmVnaW9uW0xWREJFX01FTVJFR0lPTl9QRVJTSVNURU5UX0RBVEFdLlNpemUgICA9IHNpemVvZihMVkRCRV9EYXRhX0ZMT0FUX3QpOwotICAgICAgIC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WREJFX1NDUkFUQ0hCVUZGRVJTX0lOUExBQ0Uqc2l6ZW9mKExWTV9GTE9BVCkgKiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcENhcGFiaWxpdGllcy0+TWF4QmxvY2tTaXplKTsKLSAgICAgICAgcE1lbW9yeVRhYmxlLT5SZWdpb25bTFZEQkVfTUVNUkVHSU9OX1NDUkFUQ0hdLlNpemUgICAgICAgICA9IFNjcmF0Y2hTaXplOwotICAgICAgICBwTWVtb3J5VGFibGUtPlJlZ2lvbltMVkRCRV9NRU1SRUdJT05fU0NSQVRDSF0uQWxpZ25tZW50ICAgID0gTFZEQkVfU0NSQVRDSF9BTElHTjsKLSAgICAgICAgcE1lbW9yeVRhYmxlLT5SZWdpb25bTFZEQkVfTUVNUkVHSU9OX1NDUkFUQ0hdLlR5cGUgICAgICAgICA9IExWREJFX1NDUkFUQ0g7Ci0gICAgICAgIHBNZW1vcnlUYWJsZS0+UmVnaW9uW0xWREJFX01FTVJFR0lPTl9TQ1JBVENIXS5wQmFzZUFkZHJlc3MgPSBMVk1fTlVMTDsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgLyogUmVhZCBiYWNrIG1lbW9yeSBhbGxvY2F0aW9uIHRhYmxlICovCi0gICAgICAgICpwTWVtb3J5VGFibGUgPSBwSW5zdGFuY2UtPk1lbW9yeVRhYmxlOwotICAgIH0KLQotICAgIHJldHVybihMVkRCRV9TVUNDRVNTKTsKLX0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICAgTFZEQkVfSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgIENyZWF0ZSBhbmQgaW5pdGlhbGlzYXRpb24gZnVuY3Rpb24gZm9yIHRoZSBEeW5hbWljIEJhc3MgRW5oYW5jZW1lbnQgbW9kdWxlICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICBUaGlzIGZ1bmN0aW9uIGNhbiBiZSB1c2VkIHRvIGNyZWF0ZSBhbiBhbGdvcml0aG0gaW5zdGFuY2UgYnkgY2FsbGluZyB3aXRoICAgICAgICAgKi8KLS8qICAgIGhJbnN0YW5jZSBzZXQgdG8gTlVMTC4gSW4gdGhpcyBjYXNlIHRoZSBhbGdvcml0aG0gcmV0dXJucyB0aGUgbmV3IGluc3RhbmNlICAgICAgICAqLwotLyogICAgaGFuZGxlLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgIFRoaXMgZnVuY3Rpb24gY2FuIGJlIHVzZWQgdG8gZm9yY2UgYSBmdWxsIHJlLWluaXRpYWxpc2F0aW9uIG9mIHRoZSBhbGdvcml0aG0gICAgICAqLwotLyogICAgYnkgY2FsbGluZyB3aXRoIGhJbnN0YW5jZSA9IEluc3RhbmNlIEhhbmRsZS4gSW4gdGhpcyBjYXNlIHRoZSBtZW1vcnkgdGFibGUgICAgICAgICovCi0vKiAgICBzaG91bGQgYmUgY29ycmVjdCBmb3IgdGhlIGluc3RhbmNlLCB0aGlzIGNhbiBiZSBlbnN1cmVkIGJ5IGNhbGxpbmcgdGhlIGZ1bmN0aW9uICAgKi8KLS8qICAgIERCRV9NZW1vcnkgYmVmb3JlIGNhbGxpbmcgdGhpcyBmdW5jdGlvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgQ3JlYXRlIGFuZCBpbml0aWFsaXNhdGlvbiBmdW5jdGlvbiBmb3IgdGhlIEJhc3MgRW5oYW5jZW1lbnQgbW9kdWxlICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIGhJbnN0YW5jZSAgICAgICAgICAgICAgICAgIEluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcE1lbW9yeVRhYmxlICAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwQ2FwYWJpbGl0aWVzICAgICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBjYXBhYmlsaXRpZXMgICAgICAgICAgICAgICAgICAgICAqLworLyogIHBoSW5zdGFuY2UgICAgICAgICAgICAgICBQb2ludGVyIHRvIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgcENhcGFiaWxpdGllcyAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGluaXRpYWxpc2F0aW9uIGNhcGFiaWxpdGllcyAgICAgICAgICAgICAgICAgKi8KKy8qICBwU2NyYXRjaCAgICAgICAgICAgICAgICAgUG9pbnRlciB0byB0aGUgYnVuZGxlIHNjcmF0Y2ggYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICBMVkRCRV9TVUNDRVNTICAgICAgICAgICAgSW5pdGlhbGlzYXRpb24gc3VjY2VlZGVkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIExWREJFX0FMSUdOTUVOVEVSUk9SICAgIEluc3RhbmNlIG9yIHNjcmF0Y2ggbWVtb3J5IG9uIGluY29ycmVjdCBhbGlnbm1lbnQgICAgICAgICAgICovCi0vKiAgICBMVkRCRV9OVUxMQUREUkVTUyAgICAgICAgSW5zdGFuY2Ugb3Igc2NyYXRjaCBtZW1vcnkgaGFzIGEgTlVMTCBwb2ludGVyICAgICAgICAgICAgKi8KKy8qICBMVkRCRV9OVUxMQUREUkVTUyAgICAgICAgT25lIG9yIG1vcmUgbWVtb3J5IGhhcyBhIE5VTEwgcG9pbnRlciAtIG1hbGxvYyBmYWlsdXJlICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAxLiAgICAgVGhlIGluc3RhbmNlIGhhbmRsZSBpcyB0aGUgcG9pbnRlciB0byB0aGUgYmFzZSBhZGRyZXNzIG9mIHRoZSBmaXJzdCBtZW1vcnkgICAqLwotLyogICAgICAgIHJlZ2lvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAyLiAgICBUaGlzIGZ1bmN0aW9uIG11c3Qgbm90IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVkRCRV9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgKi8KKy8qICAxLiAgICBUaGlzIGZ1bmN0aW9uIG11c3Qgbm90IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVkRCRV9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotTFZEQkVfUmV0dXJuU3RhdHVzX2VuIExWREJFX0luaXQoTFZEQkVfSGFuZGxlX3QgICAgICAgICAqcGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfTWVtVGFiX3QgICAgICAgKnBNZW1vcnlUYWJsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfQ2FwYWJpbGl0aWVzX3QgKnBDYXBhYmlsaXRpZXMpCi17Ci0KLSAgICBMVkRCRV9JbnN0YW5jZV90ICAgICAgKnBJbnN0YW5jZTsKLSAgICBMVk1peGVyM18xU3RfRkxPQVRfc3QgICAgICAgKnBNaXhlcl9JbnN0YW5jZTsKLSAgICBMVk1peGVyM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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICAgTFZEQkVfRGVJbml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgIEZyZWUgdGhlIG1lbW9yaWVzIGNyZWF0ZWQgZHVyaW5nIExWREJFX0luaXQgaW5jbHVkaW5nIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwaEluc3RhbmNlICAgICAgICAgICAgICAgUG9pbnRlciB0byBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3ZvaWQgTFZEQkVfRGVJbml0KExWREJFX0hhbmRsZV90KiBwaEluc3RhbmNlKSB7CisgICAgTFZEQkVfSW5zdGFuY2VfdCogcEluc3RhbmNlID0gKExWREJFX0luc3RhbmNlX3QqKSpwaEluc3RhbmNlOworICAgIGlmIChwSW5zdGFuY2UgPT0gTFZNX05VTEwpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICBpZiAocEluc3RhbmNlLT5wRGF0YSAhPSBMVk1fTlVMTCkgeworICAgICAgICBmcmVlKHBJbnN0YW5jZS0+cERhdGEpOworICAgICAgICBwSW5zdGFuY2UtPnBEYXRhID0gTFZNX05VTEw7CisgICAgfQorICAgIGRlbGV0ZSBwSW5zdGFuY2U7CisgICAgKnBoSW5zdGFuY2UgPSBMVk1fTlVMTDsKIH0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CYXNzL3NyYy9MVkRCRV9Qcml2YXRlLmggYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQmFzcy9zcmMvTFZEQkVfUHJpdmF0ZS5oCmluZGV4IGYzZmFhZWQuLjdhYzVkYjMgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CYXNzL3NyYy9MVkRCRV9Qcml2YXRlLmgKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0Jhc3Mvc3JjL0xWREJFX1ByaXZhdGUuaApAQCAtMzMsNyArMzMsOCBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotI2luY2x1ZGUgIkxWREJFLmgiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBDYWxsaW5nIG9yIEFwcGxpY2F0aW9uIGxheWVyIGRlZmluaXRpb25zICovCisjaW5jbHVkZSA8YXVkaW9fdXRpbHMvQmlxdWFkRmlsdGVyLmg+CisjaW5jbHVkZSAiTFZEQkUuaCIgLyogQ2FsbGluZyBvciBBcHBsaWNhdGlvbiBsYXllciBkZWZpbml0aW9ucyAqLwogI2luY2x1ZGUgIkJJUVVBRC5oIgogI2luY2x1ZGUgIkxWQ19NaXhlci5oIgogI2luY2x1ZGUgIkFHQy5oIgpAQCAtNDUsMjggKzQ2LDEwIEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAogLyogR2VuZXJhbCAqLwotI2RlZmluZSAgICBMVkRCRV9JTlZBTElEICAgICAgICAgICAgMHhGRkZGICAgICAgICAvKiBJbnZhbGlkIGluaXQgcGFyYW1ldGVyICovCisjZGVmaW5lIExWREJFX0lOVkFMSUQgMHhGRkZGIC8qIEludmFsaWQgaW5pdCBwYXJhbWV0ZXIgKi8KIAotLyogTWVtb3J5ICovCi0jZGVmaW5lIExWREJFX01FTVJFR0lPTl9JTlNUQU5DRSAgICAgICAgIDAgICAgICAgLyogT2Zmc2V0IHRvIHRoZSBpbnN0YW5jZSBtZW1vcnkgcmVnaW9uICovCi0jZGVmaW5lIExWREJFX01FTVJFR0lPTl9QRVJTSVNURU5UX0RBVEEgIDEgICAgICAgLyogT2Zmc2V0IHRvIHBlcnNpc3RlbnQgZGF0YSBtZW1vcnkgcmVnaW9uICovCi0jZGVmaW5lIExWREJFX01FTVJFR0lPTl9QRVJTSVNURU5UX0NPRUYgIDIgICAgICAgLyogT2Zmc2V0IHRvIHBlcnNpc3RlbnQgY29lZmZpY2llbnQgcmVnaW9uICovCi0jZGVmaW5lIExWREJFX01FTVJFR0lPTl9TQ1JBVENIICAgICAgICAgIDMgICAgICAgLyogT2Zmc2V0IHRvIGRhdGEgc2NyYXRjaCBtZW1vcnkgcmVnaW9uICovCi0KLSNkZWZpbmUgTFZEQkVfSU5TVEFOQ0VfQUxJR04gICAgICAgICAgICAgNCAgICAgICAvKiAzMi1iaXQ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qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC03NiwzNyArNTksMzAgQEAKIAogLyogRGF0YSBzdHJ1Y3R1cmUgKi8KIC8qIERhdGEgc3RydWN0dXJlICovCi10eXBlZGVmIHN0cnVjdAotewordHlwZWRlZiBzdHJ1Y3QgewogICAgIC8qIEFHQyBwYXJhbWV0ZXJzICovCi0gICAgQUdDX01JWF9WT0xfMlN0MU1vbl9GTE9BVF90ICAgQUdDSW5zdGFuY2U7ICAgICAgICAvKiBBR0MgaW5zdGFuY2UgcGFyYW1ldGVycyAqLworICAgIEFHQ19NSVhfVk9MXzJTdDFNb25fRkxPQVRfdCBBR0NJbnN0YW5jZTsgLyogQUdDIGluc3RhbmNlIHBhcmFtZXRlcnMgKi8KIAogICAgIC8qIFByb2Nlc3MgdmFyaWFibGVzICovCi0gICAgQmlxdWFkXzJJX09yZGVyMl9GTE9BVF9UYXBzX3QgICAgIEhQRlRhcHM7ICAgICAgICAgICAgLyogSGlnaCBwYXNzIGZpbHRlciB0YXBzICovCi0gICAgQmlxdWFkXzFJX09yZGVyMl9GTE9BVF9UYXBzX3QgICAgIEJQRlRhcHM7ICAgICAgICAgICAgLyogQmFuZCBwYXNzIGZpbHRlciB0YXBzICovCi0gICAgTFZNaXhlcjNfMVN0X0ZMT0FUX3N0ICAgICAgICAgICAgIEJ5cGFzc1ZvbHVtZTsgICAgICAgLyogQnlwYXNzIHZvbHVtZSBzY2FsZXIgKi8KLSAgICBMVk1peGVyM18yU3RfRkxPQVRfc3QgICAgICAgICAgICAgQnlwYXNzTWl4ZXI7ICAgICAgICAvKiBCeXBhc3MgTWl4ZXIgZm9yIENsaWNrIFJlbW92YWwgKi8KKyAgICBMVk1peGVyM18xU3RfRkxPQVRfc3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Eluc3RhbmNlIHBhcmFtZXRlcnMgKi8KKyAgICBMVkRCRV9DYXBhYmlsaXRpZXNfdCBDYXBhYmlsaXRpZXM7IC8qIEluc3RhbmNlIGNhcGFiaWxpdGllcyAqLwogCiAgICAgLyogRGF0YSBhbmQgY29lZmZpY2llbnQgcG9pbnRlcnMgKi8KLSAgICBMVkRCRV9EYXRhX0ZMT0FUX3QgICAgICAgICAgICAgICAgKnBEYXRhOyAgICAgICAgICAgICAgICAvKiBJbnN0YW5jZSBkYXRhICovCi0gICAgTFZEQkVfQ29lZl9GTE9BVF90ICAgICAgICAgICAgICAgICpwQ29lZjsgICAgICAgICAgICAgICAgLyogSW5zdGFuY2UgY29lZmZpY2llbnRzICovCisgICAgTFZEQkVfRGF0YV9GTE9BVF90KiBwRGF0YTsgLyogSW5zdGFuY2UgZGF0YSAqLworICAgIHZvaWQqIHBTY3JhdGNoOyAgICAgICAgICAgIC8qIHNjcmF0Y2ggcG9pbnRlciAqLworICAgIHN0ZDo6dW5pcXVlX3B0cjxhbmRyb2lkOjphdWRpb191dGlsczo6QmlxdWFkRmlsdGVyPExWTV9GTE9BVD4+CisgICAgICAgICAgICBwSFBGQmlxdWFkOyAvKiBCaXF1YWQgZmlsdGVyIGluc3RhbmNlIGZvciBIUEYgKi8KKyAgICBzdGQ6OnVuaXF1ZV9wdHI8YW5kcm9pZDo6YXVkaW9fdXRpbHM6OkJpcXVhZEZpbHRlcjxMVk1fRkxPQVQ+PgorICAgICAgICAgICAgcEJQRkJpcXVhZDsgLyogQmlxdWFkIGZpbHRlciBpbnN0YW5jZSBmb3IgQlBGICovCiB9IExWREJFX0luc3RhbmNlX3Q7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtMTE1LDEzICs5MSwxMCBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotdm9pZCAgICBMVkRCRV9TZXRBR0MoTFZEQkVfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgTFZEQkVfUGFyYW1zX3QgICAgICAgICAqcFBhcmFtcyk7Cit2b2lkIExWREJFX1NldEFHQyhMVkRCRV9JbnN0YW5jZV90KiBwSW5zdGFuY2UsIExWREJFX1BhcmFtc190KiBwUGFyYW1zKTsKIAotdm9pZCAgICBMVkRCRV9TZXRWb2x1bWUoTFZEQkVfSW5zdGFuY2VfdCAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfUGFyYW1zX3QgICAgICAqcFBhcmFtcyk7Cit2b2lkIExWREJFX1NldFZvbHVtZShMVkRCRV9JbnN0YW5jZV90KiBwSW5zdGFuY2UsIExWREJFX1BhcmFtc190KiBwUGFyYW1zKTsKIAotdm9pZCAgICBMVkRCRV9TZXRGaWx0ZXJzKExWREJFX0luc3RhbmNlX3QgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX1BhcmFtc190ICAgICAqcFBhcmFtcyk7Cit2b2lkIExWREJFX1NldEZpbHRlcnMoTFZEQkVfSW5zdGFuY2VfdCogcEluc3RhbmNlLCBMVkRCRV9QYXJhbXNfdCogcFBhcmFtcyk7CiAKLSNlbmRpZiAgICAgIC8qIF9fTFZEQkVfUFJJVkFURV9IX18gKi8KKyNlbmRpZiAvKiBfX0xWREJFX1BSSVZBVEVfSF9fICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQmFzcy9zcmMvTFZEQkVfUHJvY2Vzcy5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQmFzcy9zcmMvTFZEQkVfUHJvY2Vzcy5jcHAKaW5kZXggYjRhNzFjNy4uMDk2OTA1MyAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0Jhc3Mvc3JjL0xWREJFX1Byb2Nlc3MuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CYXNzL3NyYy9MVkRCRV9Qcm9jZXNzLmNwcApAQCAtMjAsMTMgKzIwLDE0IEBACiAvKiAgICBJbmNsdWRlcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisjaW5jbHVkZSA8YXVkaW9fdXRpbHMvQmlxdWFkRmlsdGVyLmg+CiAKLSNpbmNsdWRlIDxzdHJpbmcuaD4gLy8gbWVtc2V0CisjaW5jbHVkZSA8c3RyaW5nLmg+ICAvLyBtZW1zZXQKICNpbmNsdWRlICJMVkRCRS5oIgogI2luY2x1ZGUgIkxWREJFX1ByaXZhdGUuaCIKICNpbmNsdWRlICJWZWN0b3JBcml0aG1ldGljLmgiCiAjaW5jbHVkZSAiQUdDLmgiCi0jaW5jbHVkZSAiTFZEQkVfQ29lZmZzLmgiICAgICAgICAgICAgICAgLyogRmlsdGVyIGNvZWZmaWNpZW50cyAqLworI2luY2x1ZGUgIkxWREJFX0NvZWZmcy5oIiAvKiBGaWx0ZXIgY29lZmZpY2llbnRzICovCiAjaW5jbHVkZSA8bG9nL2xvZy5oPgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCkBAIC03MywxNzkgKzc0LDEwMyBAQAogLyogICAgIG92ZXJhbGwgZW5kIHRvIGVuZCBnYWluIGlzIG9kQi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZEQkVfUmV0dXJuU3RhdHVzX2VuIExWREJFX1Byb2Nlc3MoTFZEQkVfSGFuZGxlX3QgaEluc3RhbmNlLAotICAgIGNvbnN0IExWTV9GTE9BVCAqcEluRGF0YSwKLSAgICBMVk1fRkxPQVQgKnBPdXREYXRhLAotICAgIGNvbnN0IExWTV9VSU5UMTYgTnJGcmFtZXMpIC8vIHVwZGF0ZWQgdG8gdXNlIHNhbXBsZXMgPSBmcmFtZXMgKiBjaGFubmVscy4KK0xWREJFX1JldHVyblN0YXR1c19lbiBMVkRCRV9Qcm9jZXNzKAorICAgICAgICBMVkRCRV9IYW5kbGVfdCBoSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogcEluRGF0YSwgTFZNX0ZMT0FUKiBwT3V0RGF0YSwKKyAgICAgICAgY29uc3QgTFZNX1VJTlQxNiBOckZyYW1lcykgIC8vIHVwZGF0ZWQgdG8gdXNlIHNhbXBsZXMgPSBmcmFtZXMgKiBjaGFubmVscy4KIHsKLSAgTFZEQkVfSW5zdGFuY2VfdCAqcEluc3RhbmNlID0oTFZEQkVfSW5zdGFuY2VfdCAqKWhJbnN0YW5jZTsKKyAgICBMVkRCRV9JbnN0YW5jZV90KiBwSW5zdGFu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JbnN0YW5jZSBwb2ludGVyICAgICAgKi8KLSAgICAgICAgcFNjcmF0Y2gsIC8qIFN0ZXJlbyBzb3VyY2UgICAgICAgICAqLwotICAgICAgICBwTW9ubywgLyogTW9ubyBiYW5kIHBhc3Mgc291cmNlICovCi0gICAgICAgIHBTY3JhdGNoLCAvKiBTdGVyZW8gZGVzdGluYXRpb24gICAgKi8KLSAgICAgICAgTnJGcmFtZXMpOwotI2VuZGlmCisgICAgICAgIC8qCisgICAgICAgICAqIENyZWF0ZSB0aGUgbW9ubyBzdHJlYW0KKyAgICAgICAgICovCisgICAgICAgIEZyb21NY1RvTW9ub19GbG9hdChwU2NyYXRjaCwgICAgICAgICAgICAvKiBTb3VyY2UgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHBNb25vLCAgICAgICAgICAgICAgIC8qIE1vbm8gZGVzdGluYXRpb24gKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnJGcmFtZXMsIC8qIE51bWJlciBvZiBmcmFtZXMgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnJDaGFubmVscyk7CiAKLSAgICBmb3IgKExWTV9JTlQzMiBpaSA9IDA7IGlpIDwgTnJTYW1wbGVzOyArK2lpKSB7Ci0gICAgICAvL1RPRE86IHJlcGxhY2Ugd2l0aCBleGlzdGluZyBjbGFtcGluZyBmdW5jdGlvbgotICAgICAgaWYgKHBTY3JhdGNoW2lpXSA8IC0xLjApIHsKLSAgICAgICAgcFNjcmF0Y2hbaWldID0gLTEuMDsKLSAgICAgIH0gZWxzZSBpZiAocFNjcmF0Y2hbaWldID4gMS4wKSB7Ci0gICAgICAgIHBTY3JhdGNoW2lpXSA9IDEuMDsKLSAgICAgIH0KKyAgICAgICAgLyoKKyAgICAgICAgICogQXBwbHkgdGhlIGJhbmQgcGFzcyBmaWx0ZXIKKyAgICAgICAgICovCisgICAgICAgIHBJbnN0YW5jZS0+cEJQRkJpcXVhZC0+cHJvY2VzcyhwTW9ubywgcE1vbm8sIE5yRnJhbWVzKTsKKworICAgICAgICAvKgorICAgICAgICAgKiBBcHBseSB0aGUgQUdDIGFuZCBtaXgKKyAgICAgICAgICovCisgICAgICAgIEFHQ19NSVhfVk9MX01jMU1vbl9EMzJfV1JBKCZwSW5zdGFuY2UtPnBEYXRhLT5BR0NJbnN0YW5jZSwgLyogSW5zdGFuY2UgcG9pbnRlciAgICAgICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoLCAgICAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcE1vbm8sICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBNb25vIGJhbmQgcGFzcyBzb3VyY2UgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFNjcmF0Y2gsICAgICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAgICAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOckZyYW1lcywgICAgICAgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBmcmFtZXMgICAgICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5yQ2hhbm5lbHMpOyAgICAgICAgICAgICAgICAgICAgLyogTnVtYmVyIG9mIGNoYW5uZWxzICAgICAqLworICAgIH0gZWxzZSB7CisgICAgICAgIC8vIGNsZWFyIERCRSBwcm9jZXNzZWQgcGF0aAorICAgICAgICBtZW1zZXQocFNjcmF0Y2gsIDAsIHNpemVvZigqcFNjcmF0Y2gpICogTnJTYW1wbGVzKTsKICAgICB9Ci0gIH0gZWxzZSB7Ci0gICAgLy8gY2xlYXIgREJFIHByb2Nlc3NlZCBwYXRoCi0gICAgbWVtc2V0KHBTY3JhdGNoLCAwLCBzaXplb2YoKnBTY3JhdGNoKSAqIE5yU2FtcGxlcyk7Ci0gI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SFBGR0FJTl8yZEIsICBBR0NfSFBGR0FJTl8zZEIsCisgICAgICAgIEFHQ19IUEZHQUlOXzRkQiwgIEFHQ19IUEZHQUlOXzVkQiwgIEFHQ19IUEZHQUlOXzZkQiwgIEFHQ19IUEZHQUlOXzdkQiwKKyAgICAgICAgQUdDX0hQRkdBSU5fOGRCLCAgQUdDX0hQRkdBSU5fOWRCLCAgQUdDX0hQRkdBSU5fMTBkQiwgQUdDX0hQRkdBSU5fMTFkQiwKKyAgICAgICAgQUdDX0hQRkdBSU5fMTJkQiwgQUdDX0hQRkdBSU5fMTNkQiwgQUdDX0hQRkdBSU5fMTRkQiwgQUdDX0hQRkdBSU5fMTVkQn07CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNTY2LDQ1ICszMTQsMjMgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKIC8qIGRCIHRvIGxpbmVhciBjb252ZXJzaW9uIHRhYmxlICovCi1jb25zdCBMVk1fRkxPQVQgTFZEQkVfVm9sdW1lVGFibGVbXSA9IHsKLSAgICAwLjUwMDAwMGYsICAgICAgICAgLyogLTZkQiAqLwotICAgIDAuNTYyMzQxZiwgICAgICAgICAvKiAtNWRCICovCi0gICAgMC42MzA5NTdmLCAgICAgICAgIC8qIC00ZEIgKi8KLSAgICAwLjcwNzk0NmYsICAgICAgICAgLyogLTNkQiAqLwotICAgIDAuNzk0MzI4ZiwgICAgICAgICAvKiAtMmRCICovCi0gICAgMC44OTEyNTFmLCAgICAgICAgIC8qIC0xZEIgKi8KLSAgICAxLjAwMDAwMGZ9OyAgICAgICAgLyogIDBkQiAqLworY29uc3QgTFZNX0ZMT0FUIExWREJFX1ZvbHVtZVRhYmxlW10gPSB7MC41MDAwMDBmLCAgLyogLTZkQiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC41NjIzNDFmLCAgLyogLTVkQiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC42MzA5NTdmLCAgLyogLTRkQiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC43MDc5NDZmLCAgLyogLTNkQiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC43OTQzMjhmLCAgLyogLTJkQiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC44OTEyNTFmLCAgLyogLTFkQiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4wMDAwMDBmfTsgLyogIDBkQiAqLwogCiBjb25zdCBMVk1fRkxPQVQgTFZEQkVfVm9sdW1lVENUYWJsZVtdID0gewotICAgIFZPTF9UQ19GczgwMDAsCi0gICAgVk9MX1RDX0ZzMTEwMjUsCi0gICAgVk9MX1RDX0ZzMTIwMDAsCi0gICAgVk9MX1RDX0ZzMTYwMDAsCi0gICAgVk9MX1RDX0ZzMjIwNTAsCi0gICAgVk9MX1RDX0ZzMjQwMDAsCi0gICAgVk9MX1RDX0ZzMzIwMDAsCi0gICAgVk9MX1RDX0ZzNDQxMDAsCi0gICAgVk9MX1RDX0ZzNDgwMDAKLSAgICAsVk9MX1RDX0ZzODgyMDAKLSAgICAsVk9MX1RDX0ZzOTYwMDAKLSAgICAsVk9MX1RDX0ZzMTc2NDAwCi0gICAgLFZPTF9UQ19GczE5MjAwMAotfTsKKyAgICAgICAgVk9MX1RDX0ZzODAwMCwgIFZPTF9UQ19GczExMDI1LCAgVk9MX1RDX0ZzMTIwMDAsIFZPTF9UQ19GczE2MDAwLCBWT0x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9MVk0uaAppbmRleCBlNGU4NDUwLi5jOTBjNWNjIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQnVuZGxlL2xpYi9MVk0uaAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQnVuZGxlL2xpYi9MVk0uaApAQCAtNjcsMzEgKzY3LDI4IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0vKiBNZW1vcnkgdGFibGUqLwotI2RlZmluZSBMVk1fTlJfTUVNT1JZX1JFR0lPTlMgICAgICAgICAgICAgICAgIDQgICAgIC8qIE51bWJlciBvZiBtZW1vcnkgcmVnaW9ucyAqLwotCiAvKiBDb25jZXJ0IFNvdW5kIGVmZmVjdCBsZXZlbCBwcmVzZXRzICovCi0jZGVmaW5lIExWTV9DU19FRkZFQ1RfTk9ORSAgICAgICAgICAgICAgICAgICAgMCAgICAgLyogMCUgZWZmZWN0LCBtaW5pbXVtIHZhbHVlICovCi0jZGVmaW5lIExWTV9DU19FRkZFQ1RfTE9XICAgICAgICAgICAgICAgICAxNjM4NCAgICAgLyogNTAlIGVmZmVjdCAqLwotI2RlZmluZSBMVk1fQ1NfRUZGRUNUX01FRCAgICAgICAgICAgICAgICAgMjQ1NzYgICAgIC8qIDc1JSBlZmZlY3QgKi8KLSNkZWZpbmUgTFZNX0NTX0VGRkVDVF9ISUdIICAgICAgICAgICAgICAgIDMyNzY3ICAgICAvKiAxMDAlIGVmZmVjdCwgbWF4aW11bSB2YWx1ZSAqLworI2RlZmluZSBMVk1fQ1NfRUZGRUNUX05PTkUgMCAgICAgLyogMCUgZWZmZWN0LCBtaW5pbXVtIHZhbHVlICovCisjZGVmaW5lIExWTV9DU19FRkZFQ1RfTE9XIDE2Mzg0ICAvKiA1MCUgZWZmZWN0ICovCisjZGVmaW5lIExWTV9DU19FRkZFQ1RfTUVEIDI0NTc2ICAvKiA3NSUgZWZmZWN0ICovCisjZGVmaW5lIExWTV9DU19FRkZFQ1RfSElHSCAzMjc2NyAvKiAxMDAlIGVmZmVjdCwgbWF4aW11bSB2YWx1ZSAqLwogCiAvKiBUcmVibGUgZW5oYW5jZW1lbnQgKi8KLSNkZWZpbmUgTFZNX1RFX0xPV19NSVBTICAgICAgICAgICAgICAgICAgIDMyNzY3CisjZGVmaW5lIExWTV9URV9MT1dfTUlQUyAzMjc2NwogCiAvKiBCYXNzIGVuaGFuY2VtZW50IGVmZmVjdCBsZXZlbCBwcmVzZXRzICovCi0jZGVmaW5lIExWTV9CRV8wREIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCAgICAgLyogMGRCIGJvb3N0LCBubyBlZmZlY3QgKi8KLSNkZWZpbmUgTFZNX0JFXzNEQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAzICAgICAvKiArM2RCIGJvb3N0ICovCi0jZGVmaW5lIExWTV9CRV82REIgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiAgICAgLyogKzZkQiBib29zdCAqLwotI2RlZmluZSBMVk1fQkVfOURCICAgICAgICAgICAgICAgICAgICAgICAgICAgIDkgICAgIC8qICs5ZEIgYm9vc3QgKi8KLSNkZWZpbmUgTFZNX0JFXzEyREIgICAgICAgICAgICAgICAgICAgICAgICAgIDEyICAgICAvKiArMTJkQiBib29zdCAqLwotI2RlZmluZSBMVk1fQkVfMTVEQiAgICAgICAgICAgICAgICAgICAgICAgICAgMTUgICAgIC8qICsxNWRCIGJvb3N0ICovCisjZGVmaW5lIExWTV9CRV8wREIgMCAgIC8qIDBkQiBib29zdCwgbm8gZWZmZWN0ICovCisjZGVmaW5lIExWTV9CRV8zREIgMyAgIC8qICszZEIgYm9vc3QgKi8KKyNkZWZpbmUgTFZNX0JFXzZEQiA2ICAgLyogKzZkQiBib29zdCAqLworI2RlZmluZSBMVk1fQkVfOURCIDkgICAvKiArOWRCIGJvb3N0ICovCisjZGVmaW5lIExWTV9CRV8xMkRCIDEyIC8qICsxMmRCIGJvb3N0ICovCisjZGVmaW5lIExWTV9CRV8xNURCIDE1IC8qICsxNWRCIGJvb3N0ICovCiAKIC8qIE4tQmFuZCBFcXVhbGl6ZXIgKi8KLSNkZWZpbmUgTFZNX0VRX05CQU5EUyAgICAgICAgICAgICAgICAgICAgICAgICA1ICAgIC8qIE51bWJlciBvZiBiYW5kcyBmb3IgZXF1YWxpemVyICovCisjZGVmaW5lIExWTV9FUV9OQkFORFMgNSAvKiBOdW1iZXIgb2YgYmFuZHMgZm9yIGVxdWFsaXplciAqLwogCiAvKiBIZWFkcm9vbSBtYW5hZ2VtZW50ICovCi0jZGVmaW5lIExWTV9IRUFEUk9PTV9NQVhfTkJBTkRTICAgICAgICAgICAgICAgNQorI2RlZmluZSBMVk1fSEVBRFJPT01fTUFYX05CQU5EUyA1CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0xMDAsMTIzICs5Nyw4OSBAQAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKIC8qIEluc3RhbmNlIGhhbmRsZSAqLwotdHlwZWRlZiB2b2lkICpMVk1fSGFuZGxlX3Q7Cit0eXBlZGVmIHZvaWQqIExWTV9IYW5kbGVfdDsKIAogLyogU3RhdHVzIHJldHVybiB2YWx1ZXMgKi8KLXR5cGVkZWYgZW51bQotewotICAgIExWTV9TVUNDRVNTICAgICAgICAgICAgPSAwLCAgICAgICAgICAgICAgICAgICAgIC8qIFN1Y2Nlc3NmdWwgcmV0dXJuIGZyb20gYSByb3V0aW5lICovCi0gICAgTFZNX0FMSUdOTUVOVEVSUk9SICAgICA9IDEsICAgICAgICAgICAgICAgICAgICAgLyogTWVtb3J5IGFsaWdubWVudCBlcnJvciAqLwotICAgIExWTV9OVUxMQUREUkVTUyAgICAgICAgPSAyLCAgICAgICAgICAgICAgICAgICAgIC8qIE5VTEwgYWxsb2NhdGlvbiBhZGRyZXNzICovCi0gICAgTFZNX09VVE9GUkFOR0UgICAgICAgICA9IDMsICAgICAgICAgICAgICAgICAgICAgLyogT3V0IG9mIHJhbmdlIGNvbnRyb2wgcGFyYW1ldGVyICovCi0gICAgTFZNX0lOVkFMSUROVU1TQU1QTEVTICA9IDQsICAgICAgICAgICAgICAgICAgICAgLyogSW52YWxpZCBudW1iZXIgb2Ygc2FtcGxlcyAqLwotICAgIExWTV9XUk9OR0FVRElPVElNRSAgICAgPSA1LCAgICAgICAgICAgICAgICAgICAgIC8qIFdyb25nIHRpbWUgdmFsdWUgZm9yIGF1ZGlvIHRpbWUqLwotICAgIExWTV9BTEdPUklUSE1ESVNBQkxFRCAgPSA2LCAgICAgICAgICAgICAgICAgICAgIC8qIEFsZ29yaXRobSBpcyBkaXNhYmxlZCovCi0gICAgTFZNX0FMR09SSVRITVBTQSAgICAgICA9IDcsICAgICAgICAgICAgICAgICAgICAgLyogQWxnb3JpdGhtIFBTQSByZXR1cm5zIGFuIGVycm9yICovCit0eXBlZGVmIGVudW0geworICAgIExWTV9TVUNDRVNTID0gMCwgICAgICAgICAgIC8qIFN1Y2Nlc3NmdWwgcmV0dXJuIGZyb20gYSByb3V0aW5lICovCisgICAgTFZNX0FMSUdOTUVOVEVSUk9SID0gMSwgICAgLyogTWVtb3J5IGFsaWdubWVudCBlcnJvciAqLworICAgIExWTV9OVUxMQUREUkVTUyA9IDIsICAgICAgIC8qIE5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pYnJhcnkgcGxhdGZvcm0gdHlwZSAqLwordHlwZWRlZiBzdHJ1Y3QgeworICAgIExWTV9DSEFSKiBwVmVyc2lvbk51bWJlcjsgLyogUG9pbnRlciB0byB0aGUgdmVyc2lvbiBudW1iZXIgaW4gdGhlIGZvcm1hdCBYLllZLlpaICovCisgICAgTFZNX0NIQVIqIHBQbGF0Zm9ybTsgICAgICAvKiBQb2ludGVyIHRvIHRoZSBsaWJyYXJ5IHBsYXRmb3JtIHR5cGUgKi8KIH0gTFZNX1ZlcnNpb25JbmZvX3N0OwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTIyNSw5MyArMTg4LDgwIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0vKiBNZW1vcnkgdGFibGUgY29udGFpbmluZyB0aGUgcmVnaW9uIGRlZmluaXRpb25zICovCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9NZW1vcnlSZWdpb25fc3QgICAgICAgICBSZWdpb25bTFZNX05SX01FTU9SWV9SRUdJT05TXTsgIC8qIE9uZSBkZWZpbml0aW9uIGZvciBlYWNoIHJlZ2lvbiAqLwotfSBMVk1fTWVtVGFiX3Q7Ci0KIC8qIE4tQmFuZCBlcXVhbGlzZXIgYmFuZCBkZWZpbml0aW9uICovCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgICBHYWluOyAgICAgICAgICAgICAgICAgICAvKiBCYW5kIGdhaW4gaW4gZEIgKi8KLSAgICBMVk1fVUlOVDE2ICAgIC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OVDE2IE5IZWFkcm9vbUJhbmRzOyAgICAgICAgICAgICAgICAgICAvKiBOdW1iZXIgb2YgaGVhZHJvb20gYmFuZHMgKi8KIAogfSBMVk1fSGVhZHJvb21QYXJhbXNfdDsKIApAQCAtMzM5LDU1ICsyODksMTggQEAKIC8qICAxLiAgVGhpcyBmdW5jdGlvbiBtYXkgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWTV9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX0dldFZlcnNpb25JbmZvKExWTV9WZXJzaW9uSW5mb19zdCAgKnBWZXJzaW9uKTsKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICBMVk1fR2V0TWVtb3J5VGFibGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgZm9yIG1lbW9yeSBhbGxvY2F0aW9uIGFuZCBmcmVlLiBJdCBjYW4gYmUgY2FsbGVkIGluICAgICAgICAgICAqLwotLyogIHR3byB3YXlzOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgaEluc3RhbmNlID0gTlVMTCAgICAgICAgICAgICAgICBSZXR1cm5zIHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzICAgICAgICAgICAgICAgICAqLwotLyogICAgICBoSW5zdGFuY2UgPSBJbnN0YW5jZSBoYW5kbGUgICAgIFJldHVybnMgdGhlIG1lbW9yeSByZXF1aXJlbWVudHMgYW5kICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb2NhdGVkIGJhc2UgYWRkcmVzc2VzIGZvciB0aGUgaW5zdGFuY2UgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFdoZW4gdGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgZm9yIG1lbW9yeSBhbGxvY2F0aW9uIChoSW5zdGFuY2U9TlVMTCkgdGhlIG1lbW9yeSAgICAgICovCi0vKiAgYmFzZSBhZGRyZXNzIHBvaW50ZXJzIGFyZSBOVUxMIG9uIHJldHVybi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFdoZW4gdGhlIGZ1bmN0aW9uIGlzIGNhbGxlZCBmb3IgZnJlZSAoaEluc3RhbmNlID0gSW5zdGFuY2UgSGFuZGxlKSB0aGUgbWVtb3J5ICAgICAgICovCi0vKiAgdGFibGUgcmV0dXJucyB0aGUgYWxsb2NhdGVkIG1lbW9yeSBhbmQgYmFzZSBhZGRyZXNzZXMgdXNlZCBkdXJpbmcgaW5pdGlhbGlzYXRpb24uICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlICAgICAgICAgICAgICAgSW5zdGFuY2UgSGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwTWVtb3J5VGFibGUgICAgICAgICAgICBQb2ludGVyIHRvIGFuIGVtcHR5IG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICAqLwotLyogIHBJbnN0UGFyYW1zICAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGluc3RhbmNlIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIExWTV9TVUNDRVNTICAgICAgICAgICAgIFN1Y2NlZWRlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZNX05VTExBRERSRVNTICAgICAgICAgV2hlbiBvbmUgb2YgcE1lbW9yeVRhYmxlIG9yIHBJbnN0UGFyYW1zIGlzIE5VTEwgICAgICAgICAgICAgKi8KLS8qICBMVk1fT1VUT0ZSQU5HRSAgICAgICAgICBXaGVuIGFueSBvZiB0aGUgSW5zdGFuY2UgcGFyYW1ldGVycyBhcmUgb3V0IG9mIHJhbmdlICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAxLiAgVGhpcyBmdW5jdGlvbiBtYXkgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWTV9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX0dldE1lbW9yeVRhYmxlKExWTV9IYW5kbGVfdCAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9NZW1UYWJfdCAgICAgICAgICpwTWVtb3J5VGFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSW5zdFBhcmFtc190ICAgICAqcEluc3RQYXJhbXMpOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0VmVyc2lvbkluZm8oTFZNX1ZlcnNpb25JbmZvX3N0KiBwVmVyc2lvbik7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBGVU5DVElPTjogICAgICAgICAgICAgICAgTFZNX0dldEluc3RhbmNlSGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgVGhpcyBmdW5jdGlvbiBpcyB1c2VkIHRvIGNyZWF0ZSBhIGJ1bmRsZSBpbnN0YW5jZS4gSXQgcmV0dXJucyB0aGUgY3JlYXRlZCBpbnN0YW5jZSAgKi8KLS8qICBoYW5kbGUgdGhyb3VnaCBwaEluc3RhbmNlLiBBbGwgcGFyYW1ldGVycyBhcmUgc2V0IHRvIHRoZWlyIGRlZmF1bHQsIGluYWN0aXZlIHN0YXRlLiAqLworLyogIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCB0byBjcmVhdGUgYSBidW5kbGUgaW5zdGFuY2UuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgQWxsIHBhcmFtZXRlcnMgYXJlIHNldCB0byB0aGVpciBkZWZhdWx0LCBpbmFjdGl2ZSBzdGF0ZS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcGhJbnN0YW5jZSAgICAgICAgICAgICAgcG9pbnRlciB0byB0aGUgaW5zdGFuY2UgaGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwTWVtb3J5VGFibGUgICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBtZW1vcnkgZGVmaW5pdGlvbiB0YWJsZSAgICAgICAgICAgICAgICAgICAgICAqLworLyogIHBoSW5zdGFuY2UgICAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgcEluc3RQYXJhbXMgICAgICAgICAgICAgUG9pbnRlciB0byB0aGUgaW5zdGFuY2UgcGFyYW1ldGVycyAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0zOTksOSArMzEyLDI0IEBACiAvKiAgMS4gVGhpcyBmdW5jdGlvbiBtdXN0IG5vdCBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZNX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9HZXRJbnN0YW5jZUhhbmRsZShMVk1fSGFuZGxlX3QgICAgICAgICpwaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX01lbVRhYl90ICAgICAgICAqcE1lbW9yeVRhYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0luc3RQYXJhbXNfdCAgICAqcEluc3RQYXJhbXMpOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0SW5zdGFuY2VIYW5kbGUoTFZNX0hhbmRsZV90KiBwaEluc3RhbmNlLCBMVk1fSW5zdFBhcmFtc190KiBwSW5zdFBhcmFtcyk7CisKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBGVU5DVElPTjogICAgICAgICAgICAgICAgTFZNX0RlbEluc3RhbmNlSGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgVGhpcyBmdW5jdGlvbiBpcyB1c2VkIHRvIGNyZWF0ZSBhIGJ1bmRsZSBpbnN0YW5jZS4gSXQgcmV0dXJucyB0aGUgY3JlYXRlZCBpbnN0YW5jZSAgKi8KKy8qICBoYW5kbGUgdGhyb3VnaCBwaEluc3RhbmNlLiBBbGwgcGFyYW1ldGVycyBhcmUgc2V0IHRvIHRoZWlyIGRlZmF1bHQsIGluYWN0aXZlIHN0YXRlLiAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwaEluc3RhbmNlICAgICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAxLiBUaGlzIGZ1bmN0aW9uIG11c3Qgbm90IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVk1fUHJvY2VzcyBmdW5jdGlvbiAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3ZvaWQgTFZNX0RlbEluc3RhbmNlSGFuZGxlKExWTV9IYW5kbGVfdCogcGhJbnN0YW5jZSk7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC00MjEsNyArMzQ5LDcgQEAKIC8qICAxLiBUaGlzIGZ1bmN0aW9uIG11c3Qgbm90IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVk1fUHJvY2VzcyBmdW5jdGlvbiAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX0NsZWFyQXVkaW9CdWZmZXJzKExWTV9IYW5kbGVfdCAgaEluc3RhbmNlKTsKK0xWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX0NsZWFyQXVkaW9CdWZmZXJzKExWTV9IYW5kbGVfdCBoSW5zdGFuY2UpOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNDQzLDggKzM3MSw3IEBACiAvKiAgMS4gIFRoaXMgZnVuY3Rpb24gbWF5IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVk1fUHJvY2VzcyBmdW5jdGlvbiAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9HZXRDb250cm9sUGFyYW1ldGVycyhMVk1fSGFuZGxlX3QgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9Db250cm9sUGFyYW1zX3QgICAgKnBQYXJhbXMpOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0Q29udHJvbFBhcmFtZXRlcnMoTFZNX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZNX0NvbnRyb2xQYXJhbXNfdCogcFBhcmFtcyk7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC00NjYsOCArMzkzLDcgQEAKIC8qICAxLiAgVGhpcyBmdW5jdGlvbiBtYXkgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWTV9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX1NldENvbnRyb2xQYXJhbWV0ZXJzKExWTV9IYW5kbGVfdCAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0NvbnRyb2xQYXJhbXNfdCAgICAqcFBhcmFtcyk7CitMVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9TZXRDb250cm9sUGFyYW1ldGVycyhMVk1fSGFuZGxlX3QgaEluc3RhbmNlLCBMVk1fQ29udHJvbFBhcmFtc190KiBwUGFyYW1zKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTQ5OSwxMSArNDI1LDggQEAKIC8qICAgICAgU1RFUkVPICAgICAgICAgICAgICB0aGUgbnVtYmVyIG9mIHNhbXBsZSBwYWlycyBpbiB0aGUgYmxvY2sgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX1Byb2Nlc3MoTFZNX0hhbmRsZV90ICAgICAgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICAgICAgICpwSW5EYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICAgKnBPdXREYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICAgTnVtU2FtcGxlcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQzMiAgICAgICAgICAgICAgICAgIEF1ZGlvVGltZSk7CitMVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9Qcm9jZXNzKExWTV9IYW5kbGVfdCBoSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogcEluRGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiBwT3V0RGF0YSwgTFZNX1VJTlQxNiBOdW1TYW1wbGVzLCBMVk1fVUlOVDMyIEF1ZGlvVGltZSk7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC01MjQsOCArNDQ3LDggQEAKIC8qICAxLiAgVGhpcyBmdW5jdGlvbiBtYXkgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWTV9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX1NldEhlYWRyb29tUGFyYW1zKCAgTFZNX0hhbmRsZV90ICAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSGVhZHJvb21QYXJhbXNfdCAgICAqcEhlYWRyb29tUGFyYW1zKTsKK0xWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX1NldEhlYWRyb29tUGFyYW1zKExWTV9IYW5kbGVfdCBoSW5zdGFuY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSGVhZHJvb21QYXJhbXNfdCogcEhlYWRyb29tUGFyYW1zKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTU0Niw4ICs0NjksOCBAQAogLyogIDEuICBUaGlzIGZ1bmN0aW9uIG1heSBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZNX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0SGVhZHJvb21QYXJhbXMoICBMVk1fSGFuZGxlX3QgICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9IZWFkcm9vbVBhcmFtc190ICAgICpwSGVhZHJvb21QYXJhbXMpOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0SGVhZHJvb21QYXJhbXMoTFZNX0hhbmRsZV90IGhJbnN0YW5jZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9IZWFkcm9vbVBhcmFtc190KiBwSGVhZHJvb21QYXJhbXMpOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNTc0LDEwICs0OTcsOCBAQAogLyogIDEuIFRoaXMgZnVuY3Rpb24gbWF5IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVk1fUHJvY2VzcyBmdW5jdGlvbiAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0U3BlY3RydW0oIExWTV9IYW5kbGVfdCAgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDggICAgICAgICAgICAgICAqcEN1cnJlbnRQZWFrcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDggICAgICAgICAgICAgICAqcFBhc3RQZWFrcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgICAgICAgICAgICAgICBBdWRpb1RpbWUpOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0U3BlY3RydW0oTFZNX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZNX1VJTlQ4KiBwQ3VycmVudFBlYWtzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQ4KiBwUGFzdFBlYWtzLCBMVk1fSU5UMzIgQXVkaW9UaW1lKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTU5OSw4ICs1MjAsNiBAQAogLyogIDEuIFRoaXMgZnVuY3Rpb24gbWF5IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVk1fUHJvY2VzcyBmdW5jdGlvbiAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZNX1JldHVyblN0YXR1c19lbiBMVk1fU2V0Vm9sdW1lTm9TbW9vdGhpbmcoIExWTV9IYW5kbGVfdCAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9Db250cm9sUGFyYW1zX3QgICAgKnBQYXJhbXMpOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fU2V0Vm9sdW1lTm9TbW9vdGhpbmcoTFZNX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZNX0NvbnRyb2xQYXJhbXNfdCogcFBhcmFtcyk7CiAKLSNlbmRpZiAgICAgIC8qIF9fTFZNX0hfXyAqLwotCisjZW5kaWYgLyogX19MVk1fSF9fICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQnVuZGxlL3NyYy9MVk1fQVBJX1NwZWNpYWxzLmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CdW5kbGUvc3JjL0xWTV9BUElfU3BlY2lhbHMuY3BwCmluZGV4IGUyNDFjZGQuLmNlYTk2NGMgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CdW5kbGUvc3JjL0xWTV9BUElfU3BlY2lhbHMuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CdW5kbGUvc3JjL0xWTV9BUElfU3BlY2lhbHMuY3BwCkBAIC00Nyw2OSArNDcsNTIgQEAKIC8qICAxLiBUaGlzIGZ1bmN0aW9uIG1heSBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZNX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX0dldFNwZWN0cnVtKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0hhbmRsZV90ICAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQ4ICAgICAgICAgICAgICAgKnBDdXJyZW50UGVha3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDggICAgICAgICAgICAgICAqcFBhc3RQZWFrcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQzMiAgICAgICAgICAgICAgIEF1ZGlvVGltZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKQotewotICAgIExWTV9JbnN0YW5jZV90ICAgICAgICAgICAqcEluc3RhbmNlICAgPSAoTFZNX0luc3RhbmNlX3QgICopaEluc3RhbmNlOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0U3BlY3RydW0oTFZNX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZNX1VJTlQ4KiBwQ3VycmVudFBlYWtzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQ4KiBwUGFzdFBlYWtzLCBMVk1fSU5UMzIgQXVkaW9UaW1lKSB7CisgICAgTFZNX0luc3RhbmNlX3QqIHBJbnN0YW5jZSA9IChMVk1fSW5zdGFuY2VfdCopaEluc3RhbmNlOwogCi0gICAgcExWUFNBX0hhbmRsZV90ICAgICAgICAqaFBTQUluc3RhbmNlOwotICAgIExWUFNBX1JFVFVSTiAgICAgICAgICAgTFZQU0FfU3RhdHVzOworICAgIHBMVlBTQV9IYW5kbGVfdCogaFBTQUluc3RhbmNlOworICAgIExWUFNBX1JFVFVSTiBMVlBTQV9TdGF0dXM7CiAKLSAgICBpZihwSW5zdGFuY2UgPT0gTFZNX05VTEwpCi0gICAgeworICAgIGlmIChwSW5zdGFuY2UgPT0gTFZNX05VTEwpIHsKICAgICAgICAgcmV0dXJuIExWTV9OVUxMQUREUkVTUzsKICAgICB9CiAKICAgICAvKklmIFBTQSBpcyBub3QgaW5jbHVkZWQgYXQgdGhlIHRpbWUgb2YgaW5zdGFuY2UgY3JlYXRpb24sIHJldHVybiB3aXRob3V0IGFueSBwcm9jZXNzaW5nKi8KLSAgICBpZihwSW5zdGFuY2UtPkluc3RQYXJhbXMuUFNBX0luY2x1ZGVkIT1MVk1fUFNBX09OKQotICAgIHsKKyAgICBpZiAocE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AgICBMVlBTQV9TdGF0dXMgPSBMVlBTQV9HZXRTcGVjdHJ1bShoUFNBSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWUFNBX1RpbWUpIChBdWRpb1RpbWUpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fVUlOVDgqKSBwQ3VycmVudFBlYWtzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fVUlOVDgqKSBwUGFzdFBlYWtzICk7CisgICAgTFZQU0FfU3RhdHVzID0gTFZQU0FfR2V0U3BlY3RydW0oaFBTQUluc3RhbmNlLCAoTFZQU0FfVGltZSkoQXVkaW9UaW1lKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX1VJTlQ4KilwQ3VycmVudFBlYWtzLCAoTFZNX1VJTlQ4KilwUGFzdFBlYWtzKTsKIAotICAgIGlmKExWUFNBX1N0YXR1cyAhPSBMVlBTQV9PSykKLSAgICB7Ci0gICAgICAgIGlmKExWUFNBX1N0YXR1cyA9PSBMVlBTQV9FUlJPUl9XUk9OR1RJTUUpCi0gICAgICAgIHsKLSAgICAgICAgICAgIHJldHVybiAoTFZNX1JldHVyblN0YXR1c19lbikgTFZNX1dST05HQVVESU9USU1FOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgcmV0dXJuIChMVk1fUmV0dXJuU3RhdHVzX2VuKSBMVk1fTlVMTEFERFJFU1M7CisgICAgaWYgKExWUFNBX1N0YXR1cyAhPSBMVlBTQV9PSykgeworICAgICAgICBpZiAoTFZQU0FfU3RhdHVzID09IExWUFNBX0VSUk9SX1dST05HVElNRSkgeworICAgICAgICAgICAgcmV0dXJuIChMVk1fUmV0dXJuU3RhdHVzX2VuKUxWTV9XUk9OR0FVRElPVElNRTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJldHVybiAoTFZNX1JldHVyblN0YXR1c19lbilMVk1fTlVMTEFERFJFU1M7CiAgICAgICAgIH0KICAgICB9CiAKLSAgICByZXR1cm4oTFZNX1NVQ0NFU1MpOworICAgIHJldHVybiAoTFZNX1NVQ0NFU1MpOwogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTEzMiwxNSArMTE1LDEyIEBACiAvKiAgMS4gVGhpcyBmdW5jdGlvbiBtYXkgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWTV9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9TZXRWb2x1bWVOb1Ntb290aGluZyggTFZNX0hhbmRsZV90ICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0NvbnRyb2xQYXJhbXNfdCAgICAqcFBhcmFtcykKLXsKLSAgICBMVk1fSW5zdGFuY2VfdCAgICAgICpwSW5zdGFuY2UgPShMVk1fSW5zdGFuY2VfdCAgKiloSW5zdGFuY2U7CitMVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9TZXRWb2x1bWVOb1Ntb290aGluZyhMVk1fSGFuZGxlX3QgaEluc3RhbmNlLCBMVk1fQ29udHJvbFBhcmFtc190KiBwUGFyYW1zKSB7CisgICAgTFZNX0luc3RhbmNlX3QqIHBJbnN0YW5jZSA9IChMVk1fSW5zdGFuY2VfdCopaEluc3RhbmNlOwogICAgIExWTV9SZXR1cm5TdGF0dXNfZW4gRXJyb3I7CiAKICAgICAvKkFwcGx5IG5ldyBjb250cm9scyovCi0gICAgRXJyb3IgPSBMVk1fU2V0Q29udHJvbFBhcmFtZXRlcnMoaEluc3RhbmNlLHBQYXJhbXMpOworICAgIEVycm9yID0gTFZNX1NldENvbnRyb2xQYXJhbWV0ZXJzKGhJbnN0YW5jZSwgcFBhcmFtcyk7CiAgICAgcEluc3RhbmNlLT5Ob1Ntb290aFZvbHVtZSA9IExWTV9UUlVFOwogICAgIHJldHVybiBFcnJvcjsKIH0KLQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0J1bmRsZS9zcmMvTFZNX0J1ZmZlcnMuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0J1bmRsZS9zcmMvTFZNX0J1ZmZlcnMuY3BwCmluZGV4IDNhZWRkYmIuLjFkOTEzZDcgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CdW5kbGUvc3JjL0xWTV9CdWZmZXJzLmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQnVuZGxlL3NyYy9MVk1fQnVmZmVycy5jcHAKQEAgLTQ5LDEwOSArNDksOTAgQEAKIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgTFZNX0J1ZmZlck1hbmFnZWRJbihMVk1fSGFuZGxlX3QgICAgICAgaEluc3RhbmNlLAotICAgICA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HRvIHByb2Nlc3MgdGhpcyBjYWxsICovCiAKICAgICAvKgogICAgICAqIENvcHkgc2FtcGxlcyBmcm9tIHRoZSBkZWxheSBidWZmZXIgYXMgcmVxdWlyZWQKICAgICAgKi8KLSAgICBpZiAoKChwQnVmZmVyLT5CdWZmZXJTdGF0ZSA9PSBMVk1fRklSU1RDQUxMKSB8fAotICAgICAgICAocEJ1ZmZlci0+QnVmZmVyU3RhdGUgPT0gTFZNX0ZJUlNUTEFTVENBTEwpKSAmJgotICAgICAgICAocEJ1ZmZlci0+SW5EZWxheVNhbXBsZXMgIT0gMCkpCi0gICAgewotICAgICAgICBDb3B5X0Zsb2F0KCZwQnVmZmVyLT5JbkRlbGF5QnVmZmVyWzBdLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICovCi0gICAgICAgICAgICAgICAgICAgcERlc3QsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKE51bUNoYW5uZWxzICogcEJ1ZmZlci0+SW5EZWxheVNhbXBsZXMpKTsgICAgLyogTnVtYmVyIG9mIGRlbGF5IFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxlcywgbGVmdCBhbmQgcmlnaHQgKi8KKyAgICBpZiAoKChwQnVmZmVyLT5CdWZmZXJTdGF0ZSA9PSBMVk1fRklSU1RDQUxMKSB8fCAocEJ1ZmZlci0+QnVmZmVyU3RhdGUgPT0gTFZNX0ZJUlNUTEFTVENBTEwpKSAmJgorICAgICAgICAocEJ1ZmZlci0+SW5EZWxheVNhbXBsZXMgIT0gMCkpIHsKKyAgICAgICAgQ29weV9GbG9hdCgmcEJ1ZmZlci0+SW5EZWxheUJ1ZmZlclswXSwgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNvdXJjZSAqLworICAgICAgICAgICAgICAgICAgIHBEZXN0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KKyAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShOdW1DaGFubmVscyAqIHBCdWZmZXItPkluRGVsYXlTYW1wbGVzKSk7IC8qIE51bWJlciBvZiBkZWxheSBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsZXMsIGxlZnQgYW5kIHJpZ2h0ICovCiAgICAgICAgIE51bVNhbXBsZXMgPSAoTFZNX0lOVDE2KShOdW1TYW1wbGVzIC0gcEJ1ZmZlci0+SW5EZWxheVNhbXBsZXMpOyAvKiBVcGRhdGUgc2FtcGxlIGNvdW50ICovCi0gICAgICAgIHBEZXN0ICs9IE51bUNoYW5uZWxzICogcEJ1ZmZlci0+SW5EZWxheVNhbXBsZXM7ICAgICAgLyogVXBkYXRlIHRoZSBkZXN0aW5hdGlvbiBwb2ludGVyICovCisgICAgICAgIHBEZXN0ICs9IE51bUNoYW5uZWxzICogcEJ1ZmZlci0+SW5EZWxheVNhbXBsZXM7IC8qIFVwZGF0ZSB0aGUgZGVzdGluYXRpb24gcG9pbnRlciAqLwogICAgIH0KIAogICAgIC8qCiAgICAgICogQ29weSB0aGUgcmVzdCBvZiB0aGUgc2FtcGxlcyBmb3IgdGhpcyBjYWxsIGZyb20gdGhlIGlucHV0IGJ1ZmZlcgogICAgICAqLwotICAgIGlmIChOdW1TYW1wbGVzID4gMCkKLSAgICB7Ci0gICAgICAgIENvcHlfRmxvYXQocFN0YXJ0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICovCi0gICAgICAgICAgICAgICAgICAgcERlc3QsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShOdW1DaGFubmVscyAqIE51bVNhbXBsZXMpKTsgICAgICAvKiBOdW1iZXIgb2YgaW5wdXQgc2FtcGxlcyAqLwotICAgICAgICBwU3RhcnQgKz0gTnVtQ2hhbm5lbHMgKiBOdW1TYW1wbGVzOyAgICAgICAgICAgICAgICAgICAgIC8qIFVwZGF0ZSB0aGUgaW5wdXQgcG9pbnRlciAqLworICAgIGlmIChOdW1TYW1wbGVzID4gMCkgeworICAgICAgICBDb3B5X0Zsb2F0KHBTdGFydCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KKyAgICAgICAgICAgICAgICAgICBwRGVzdCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KKyAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShOdW1DaGFubmVscyAqIE51bVNhbXBsZXMpKTsgLyogTnVtYmVyIG9mIGlucHV0IHNhbXBsZXMgKi8KKyAgICAgICAgcFN0YXJ0ICs9IE51bUNoYW5uZWxzICogTnVtU2FtcGxlczsgICAgICAgICAgICAgICAgLyogVXBkYXRlIHRoZSBpbnB1dCBwb2ludGVyICovCiAKICAgICAgICAgLyoKICAgICAgICAgICogVXBkYXRlIHRoZSBpbnB1dCBkYXRhIHBvaW50ZXIgYW5kIHNhbXBsZXMgdG8gb3V0cHV0CkBAIC0xNjEsMzMgKzE0MiwzMCBAQAogICAgIH0KIAogICAgIC8qCi0gICAgICAqIFVwZGF0ZSB0aGUgc2FtcGxlIGNvdW50IGFuZCBpbnB1dCBwb2ludGVyCisgICAgICogVXBkYXRlIHRoZSBzYW1wbGUgY291bnQgYW5kIGlucHV0IHBvaW50ZXIKICAgICAgKi8KICAgICAvKiBVcGRhdGUgdGhlIGNvdW50IG9mIHNhbXBsZXMgKi8KLSAgICBwSW5zdGFuY2UtPlNhbXBsZXNUb1Byb2Nlc3MgID0gKExWTV9JTlQx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Qgc2FtcGxlcyAqLwotICAgICAgICBpZiAoTnVtU2FtcGxlcyAhPSAwKQotICAgICAgICB7Ci0gICAgICAgICAgICBDb3B5X0Zsb2F0KHBTdGFydCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNvdXJjZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAmcEJ1ZmZlci0+SW5EZWxheUJ1ZmZlclswXSwgICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShOdW1DaGFubmVscyAqIE51bVNhbXBsZXMpKTsgICAvKiBOdW1iZXIgb2YgaW5wdXQgc2FtcGxlcyAqLworICAgICAgICBwU3RhcnQgPSBwQnVmZmVyLT5wU2NyYXRjaDsgICAgICAgICAgLyogU3RhcnQgb2YgdGhlIGJ1ZmZlciAqLworICAgICAgICBwU3RhcnQgKz0gTnVtQ2hhbm5lbHMgKiBTYW1wbGVDb3VudDsgLyogT2Zmc2V0IGJ5IHRoZSBudW1iZXIgb2YgcHJvY2Vzc2VkIHNhbXBsZXMgKi8KKyAgICAgICAgaWYgKE51bVNhbXBsZXMgIT0gMCkgeworICAgICAgICAgICAgQ29weV9GbG9hdChwU3RhcnQsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICovCisgICAgICAgICAgICAgICAgICAgICAgICZwQnVmZmVyLT5JbkRlbGF5QnVmZmVyWzBdLCAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLworICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShOdW1DaGFubmVscyAqIE51bVNhbXBsZXMpKTsgLyogTnVtYmVyIG9mIGlucHV0IHNhbXBsZXMgKi8KICAgICAgICAgfQogCiAgICAgICAgIC8qCiAgICAgICAgICAqIFVwZGF0ZSB0aGUgZGVsYXkgc2FtcGxlIGNvdW50CiAgICAgICAgICAqLwotICAgICAgICBwQnVmZmVyLT5JbkRlbGF5U2FtcGxlcyAgICAgPSBOdW1TYW1wbGVzOyAgICAgICAvKiBOdW1iZXIgb2YgZGVsYXkgc2FtcGxlIHBhaXJzICovCi0gICAgICAgIHBJbnN0YW5jZS0+U2FtcGxlc1RvUHJvY2VzcyA9IDA7ICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEFsbCBTYW1wbGVzIHVzZWQgKi8KKyAgICAgICAgcEJ1ZmZlci0+SW5EZWxheVNhbXBsZXMgPSBOdW1TYW1wbGVzOyAvKiBOdW1iZXIgb2YgZGVsYXkgc2FtcGxlIHBhaXJzICovCisgICAgICAgIHBJbnN0YW5jZS0+U2FtcGxlc1RvUHJvY2VzcyA9IDA7ICAgICAgLyogQWxsIFNhbXBsZXMgdXNlZCAqLwogICAgIH0KIH0KIApAQCAtMjEzLDMzICsxOTEsMjUgQEAKIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgTFZNX0J1ZmZlclVubWFuYWdlZEluKExWTV9IYW5kbGVfdCAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAqKnBUb1Byb2Nlc3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICoqcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgKnBOdW1TYW1wbGVzKQotewotCi0gICAgTFZNX0luc3RhbmNlX3Q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HRoZSBudW1iZXIgb2Ygc2FtcGxlcworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uIGZpcnN0IGNhbGwgKi8KKyAgICAgICAgcEluc3RhbmNlLT5wSW5wdXRTYW1wbGVzID0gKnBUb1Byb2Nlc3M7ICAgICAgICAgICAgICAgIC8qIEdldCB0aGUgSS9PIHBvaW50ZXJzICovCisgICAgICAgIHBJbnN0YW5jZS0+cE91dHB1dFNhbXBsZXMgPSAqcFByb2Nlc3NlZDsKIAogICAgICAgICAvKgogICAgICAgICAgKiBTZXQgdGUgYmxvY2sgc2l6ZSB0byBwcm9jZXNzCiAgICAgICAgICAqLwotICAgICAgICBpZiAocEluc3RhbmNlLT5TYW1wbGVzVG9Qcm9jZXNzID4gcEluc3RhbmNlLT5JbnRlcm5hbEJsb2NrU2l6ZSkKLSAgICAgICAgeworICAgICAgICBpZiAocEluc3RhbmNlLT5TYW1wbGVzVG9Qcm9jZXNzID4gcEluc3RhbmNlLT5JbnRlcm5hbEJsb2NrU2l6ZSkgewogICAgICAgICAgICAgKnBOdW1TYW1wbGVzID0gKExWTV9VSU5UMTYpcEluc3RhbmNlLT5JbnRlcm5hbEJsb2NrU2l6ZTsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICpwTnVtU2FtcGxlcyA9IChMVk1fVUlOVDE2KXBJbnN0YW5jZS0+U2FtcGxlc1RvUHJvY2VzczsKICAgICAgICAgfQogICAgIH0KQEAgLTMyOSwzMiArMjk5LDE3IEBACiAvKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIExWTV9CdWZmZXJJbihMVk1fSGFuZGxlX3QgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAqcEluRGF0YSwKLSAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICoqcFRvUHJvY2VzcywKLSAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICoqcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICpwTnVtU2FtcGxlcykKLXsKLQotICAgIExWTV9JbnN0YW5jZV90ICAgICpwSW5zdGFuY2UgPSAoTFZNX0luc3RhbmNlX3QgICopaEluc3RhbmNlOwordm9pZCBMVk1fQnVmZmVySW4oTFZNX0hhbmRsZV90IGhJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBwSW5EYXRhLCBMVk1fRkxPQVQqKiBwVG9Qcm9jZXNzLAorICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiogcFByb2Nlc3NlZCwgTFZNX1VJTlQxNiogcE51bVNhbXBsZXMpIHsKKyAgICBMVk1fSW5zdGFuY2VfdCogcEluc3RhbmNlID0gKExWTV9JbnN0YW5jZV90KiloSW5zdGFuY2U7CiAKICAgICAvKgogICAgICAqIENoZWNrIHdoaWNoIG1vZGUsIG1hbmFnZWQgb3IgdW5tYW5hZ2VkCiAgICAgICovCi0gICAgaWYgKHBJbnN0YW5jZS0+SW5zdFBhcmFtcy5CdWZmZXJNb2RlID09IExWTV9NQU5BR0VEX0JVRkZFUlMpCi0gICAgewotICAgICAgICBMVk1fQnVmZmVyTWFuYWdlZEluKGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwSW5EYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUb1Byb2Nlc3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwTnVtU2FtcGxlcyk7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIExWTV9CdWZmZXJVbm1hbmFnZWRJbihoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwVG9Qcm9jZXNzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBOdW1TYW1wbGVzKTsKKyAgICBpZiAocEluc3RhbmNlLT5JbnN0UGFyYW1zLkJ1ZmZlck1vZGUgPT0gTFZNX01BTkFHRURfQlVGRkVSUykgeworICAgICAgICBMVk1fQnVmZmVyTWFuYWdlZEluKGhJbnN0YW5jZSwgcEluRGF0YSwgcFRvUHJvY2VzcywgcFByb2Nlc3NlZCwgcE51bVNhbXBsZXMpOworICAgIH0gZWxzZSB7CisgICAgICAgIExWTV9CdWZmZXJVbm1hbmFnZWRJbihoSW5zdGFuY2UsIHBUb1Byb2Nlc3MsIHBQcm9jZXNzZWQsIHBOdW1TYW1wbGVzKTsKICAgICB9CiB9CiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTM3NywxOTYgKzMzMiwxMjQgQEAKIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgTFZNX0J1ZmZlck1hbmFnZWRPdXQoTFZNX0hhbmRsZV90ICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICpwT3V0RGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiAgICAgICAgKnBOdW1TYW1wbGVzKQotewotCi0gICAgTFZNX0luc3RhbmNlX3QgICpwSW5zdGFuY2UgID0gKExWTV9JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLSAgICBMVk1fQnVmZmVyX3QgICAgKnBCdWZmZXIgICAgPSBwSW5zdGFuY2UtPnBCdWZmZXJNYW5hZ2VtZW50OwotICAgIExWTV9JTlQxNiAgICAgICBTYW1wbGVDb3VudCA9IChMVk1fSU5UMTYpKnBOdW1TYW1wbGVzOwotICAgIExWTV9JTlQxNiAgICAgICBOdW1TYW1wbGVzOwotICAgIExWTV9GTE9BVCAgICAgICAqcFN0YXJ0OwotICAgIExWTV9GTE9BVCAgICAgICAqcERlc3Q7Ci0jaWZkZWYgU1VQUE9SVF9NQwotICAgIExWTV9JTlQzMiAgICAgICBOckNoYW5uZWxzID0gcEluc3RhbmNlLT5OckNoYW5uZWxzOwordm9pZCBMVk1fQnVmZmVyTWFuYWdlZE91dChMVk1fSGFuZGxlX3QgaEluc3RhbmNlLCBMVk1fRkxPQVQqIHBPdXREYXRhLCBMVk1fVUlOVDE2KiBwTnVtU2FtcGxlcykgeworICAgIExWTV9JbnN0YW5jZV90KiBwSW5zdGFuY2UgPSAoTFZNX0luc3RhbmNlX3QqKWhJbnN0YW5jZTsKKyAgICBMVk1fQnVmZmVyX3QqIHBCdWZmZXIgPSBwSW5zdGFuY2UtPnBCdWZmZXJNYW5hZ2VtZW50OworICAgIExWTV9JTlQxNiBT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lzZSB0aGUgZGVzdGluYXRpb24gKi8KKyAgICAgICAgcEluc3RhbmNlLT5wT3V0cHV0U2FtcGxlcyA9IHBPdXREYXRhOyAvKiBJbml0aWFsaXNlIHRoZSBkZXN0aW5hdGlvbiAqLwogICAgIH0KLSAgICBwRGVzdCA9IHBJbnN0YW5jZS0+cE91dHB1dFNhbXBsZXM7ICAgICAgICAgICAgICAgICAgICAgICAgLyogU2V0IHRoZSBvdXRwdXQgYWRkcmVzcyAqLworICAgIHBEZXN0ID0gcEluc3RhbmNlLT5wT3V0cHV0U2FtcGxlczsgLyogU2V0IHRoZSBvdXRwdXQgYWRkcmVzcyAqLwogCiAgICAgLyoKICAgICAgKiBJZiB0aGUgbnVtYmVyIG9mIHNhbXBsZXMgaXMgbm9uLXplcm8gdGhlbiB0aGVyZSBhcmUgc3RpbGwgc2FtcGxlcyB0byBzZW5kIHRvCiAgICAgICogdGhlIG91dHB1dCBidWZmZXIKICAgICAgKi8KLSAgICBpZiAoKE51bVNhbXBsZXMgIT0gMCkgJiYKLSAgICAgICAgKHBCdWZmZXItPk91dERlbGF5U2FtcGxlcyAhPSAwKSkKLSAgICB7CisgICAgaWYgKChOdW1TYW1wbGVzICE9IDApICYmIChwQnVmZmVyLT5PdXREZWxheVNhbXBsZXMgIT0gMCkpIHsKICAgICAgICAgLyoKICAgICAgICAgICogQ29weSB0aGUgZGVsYXllZCBvdXRwdXQgYnVmZmVyIHNhbXBsZXMgdG8gdGhlIG91dHB1dAogICAgICAgICAgKi8KLSAgICAgICAgaWYgKHBCdWZmZXItPk91dERlbGF5U2FtcGxlcyA8PSBOdW1TYW1wbGVzKQotICAgICAgICB7CisgICAgICAgIGlmIChwQnVmZmVyLT5PdXREZWxheVNhbXBsZXMgPD0gTnVtU2FtcGxlcykgewogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIENvcHkgYWxsIG91dHB1dCBkZWxheSBzYW1wbGVzIHRvIHRoZSBvdXRwdXQKICAgICAgICAgICAgICAqLwotI2lmZGVmIFNVUFBPUlRfTUMKLSAgICAgICAgICAgIENvcHlfRmxvYXQoJnBCdWZmZXItPk91dERlbGF5QnVmZmVyWzBdLCAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgcERlc3QsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLworICAgICAgICAgICAgQ29weV9GbG9hdCgmcEJ1ZmZlci0+T3V0RGVsYXlCdWZmZXJbMF0sIC8qIFNvdXJjZSAqLworICAgICAgICAgICAgICAgICAgICAgICBwRGVzdCwgICAgICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCiAgICAgICAgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBkZWxheSBzYW1wbGVzICovCiAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKE5yQ2hhbm5lbHMgKiBwQnVmZmVyLT5PdXREZWxheVNhbXBsZXMpKTsKLSNlbHNlCi0gICAgICAgICAgICBDb3B5X0Zsb2F0KCZwQnVmZmVyLT5PdXREZWxheUJ1ZmZlclswXSwgICAgICAgICAgICAgICAgLyogU291cmNlICovCi0gICAgICAgICAgICAgICAgICAgICAgIHBEZXN0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoMiAqIHBCdWZmZXItPk91dERlbGF5U2FtcGxlcykpOyAvKiBOdW1iZXIgb2YgZGVsYXkgc2FtcGxlcyAqLwotI2VuZGlmCiAKICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgKiBVcGRhdGUgdGhlIHBvaW50ZXIgYW5kIHNhbXBsZSBjb3VudHMKICAgICAgICAgICAgICAqLwotI2lmZGVmIFNVUFBPUlRfTUMKICAgICAgICAgICAgIHBEZXN0ICs9IE5yQ2hhbm5lbHMgKiBwQnVmZmVyLT5PdXREZWxheVNhbXBsZXM7IC8qIE91dHB1dCBzYW1wbGUgcG9pbnRlciAqLwotI2Vsc2UKLSAgICAgICAgICAgIHBEZXN0ICs9IDIgKiBwQnVmZmVyLT5PdXREZWxheVNhbXBsZXM7IC8qIE91dHB1dCBzYW1wbGUgcG9pbnRlciAqLwotI2VuZGlmCiAgICAgICAgICAgICBOdW1TYW1wbGVzID0gKExWTV9JTlQxNikoTnVtU2FtcGxlcyAtIHBCdWZmZXItPk91dERlbGF5U2FtcGxlcyk7IC8qIFNhbXBsZXMgbGVmdCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvIHNlbmQgKi8KICAgICAgICAgICAgIHBCdWZmZXItPk91dERlbGF5U2FtcGxlcyA9IDA7IC8qIE5vIHNhbXBsZXMgbGVmdCBpbiB0aGUgYnVmZmVyICovCi0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7CisgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICogQ29weSBvbmx5IHNvbWUgb2YgdGhlIG91cHV0IGRlbGF5IHNhbXBsZXMgdG8gdGhlIG91dHB1dAorICAgICAgICAgICAgICogQ29weSBvbmx5IHNvbWUgb2YgdGhlIG91dHB1dCBkZWxheSBzYW1wbGVzIHRvIHRoZSBvdXRwdXQKICAgICAgICAgICAgICAqLwotI2lmZGVmIFNVUFBPUlRfTUMKLSAgICAgICAgICAgIENvcHlfRmxvYXQoJnBCdWZmZXItPk91dERlbGF5QnVmZmVyWzBdLCAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICovCi0gICAgICAgICAgICAgICAgICAgICAgIHBEZXN0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCi0gICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKE5yQ2hhbm5lbHMgKiBOckZyYW1lcykpOyAgICAgICAvKiBOdW1iZXIgb2YgZGVsYXkgc2FtcGxlcyAqLwotI2Vsc2UKLSAgICAgICAgICAgIENvcHlfRmxvYXQoJnBCdWZmZXItPk91dERlbGF5QnVmZmVyWzBdLCAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICovCi0gICAgICAgICAgICAgICAgICAgICAgIHBEZXN0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCi0gICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKDIgKiBOdW1TYW1wbGVzKSk7ICAgICAgIC8qIE51bWJlciBvZiBkZWxheSBzYW1wbGVzICovCi0jZW5kaWYKKyAgICAgICAgICAgIENvcHlfRmxvYXQoJnBCdWZmZXItPk91dERlbGF5QnVmZmVyWzBdLCAgICAgICAgIC8qIFNvdXJjZSAqLworICAgICAgICAgICAgICAgICAgICAgICBwRGVzdCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KKyAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoTnJDaGFubmVscyAqIE5yRnJhbWVzKSk7IC8qIE51bWJlciBvZiBkZWxheSBzYW1wbGVzICovCiAKICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgKiBVcGRhdGUgdGhlIHBvaW50ZXIgYW5kIHNhbXBsZSBjb3VudHMKICAgICAgICAgICAgICAqLwotI2lmZGVmIFNVUFBPUlRfTUMKICAgICAgICAgICAgIHBEZXN0ICs9IE5yQ2hhbm5lbHMgKiBOckZyYW1lczsgLyogT3V0cHV0IHNhbXBsZSBwb2ludGVyICovCi0jZWxzZQotICAgICAgICAgICAgcERlc3QgKz0gMiAqIE51bVNhbXBsZXM7IC8qIE91dHB1dCBzYW1wbGUgcG9pbnRlciAqLwotI2VuZGlmCiAgICAgICAgICAgICAvKiBObyBzYW1wbGVzIGxlZnQgaW4gdGhlIGJ1ZmZlciAqLwogICAgICAgICAgICAgcEJ1ZmZlci0+T3V0RGVsYXlTYW1wbGVzID0gKExWTV9JTlQxNikocEJ1ZmZlci0+T3V0RGVsYXlTYW1wbGVzIC0gTnVtU2FtcGxlcyk7CiAKICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgKiBSZWFsaWduIHRoZSBkZWxheSBidWZmZXIgZGF0YSB0byBhdm9pZCB1c2luZyBjaXJjdWxhciBidWZmZXIgbWFuYWdlbWVudAogICAgICAgICAgICAgICovCi0jaWZkZWYgU1VQUE9SVF9NQwotICAgICAgICAgICAgQ29weV9GbG9hdCgmcEJ1ZmZlci0+T3V0RGVsYXlCdWZmZXJbTnJDaGFubmVscyAqIE5yRnJhbWVzXSwgICAgICAgICAvKiBTb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgJnBCdWZmZXItPk91dERlbGF5QnVmZmVyWzBdLCAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KKyAgICAgICAgICAgIENvcHlfRmxvYXQoJnBCdWZmZXItPk91dERlbGF5QnVmZmVyW05yQ2hhbm5lbHMgKiBOckZyYW1lc10sIC8qIFNvdXJjZSAqLworICAgICAgICAgICAgICAgICAgICAgICAmcEJ1ZmZlci0+T3V0RGVsYXlCdWZmZXJbMF0sICAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KICAgICAgICAgICAgICAgICAgICAgICAgLyogTnVtYmVyIG9mIHNhbXBsZXMgdG8gbW92ZSAqLwogICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShOckNoYW5uZWxzICogcEJ1ZmZlci0+T3V0RGVsYXlTYW1wbGVzKSk7Ci0jZWxzZQotICAgICAgICAgICAgQ29weV9GbG9hdCgmcEJ1ZmZlci0+T3V0RGVsYXlCdWZmZXJbMiAqIE51bVNhbXBsZXNdLCAgICAgICAgIC8qIFNvdXJjZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAmcEJ1ZmZlci0+T3V0RGVsYXlCdWZmZXJbMF0sICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KSgyICogcEJ1ZmZlci0+T3V0RGVsYXlTYW1wbGVzKSk7IC8qIE51bWJlciBvZiBzYW1wbGVzIHRvIG1vdmUgKi8KLSNlbmRpZgotICAgICAgICAgICAgTnVtU2FtcGxlcyA9IDA7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTYW1wbGVzIGxlZnQgdG8gc2VuZCAqLworICAgICAgICAgICAgTnVtU2FtcGxlcyA9IDA7IC8qIFNhbXBsZXMgbGVmdCB0byBzZW5kICovCiAgICAgICAgIH0KICAgICB9CiAKICAgICAvKgogICAgICAqIENvcHkgdGhlIHByb2Nlc3NlZCByZXN1bHRzIHRvIHRoZSBvdXRwdXQKICAgICAgKi8KLSAgICBpZiAoKE51bVNhbXBsZXMgIT0gMCkgJiYKLSAgICAgICAgKFNhbXBsZUNvdW50ICE9IDApKQotICAgIHsKLSAgICAgICAgaWYgKFNhbXBsZUNvdW50IDw9IE51bVNhbXBsZXMpCi0gICAgICAgIHsKKyAgICBpZiAoKE51bVNhbXBsZXMgIT0gMCkgJiYgKFNhbXBsZUNvdW50ICE9IDApKSB7CisgICAgICAgIGlmIChTYW1wbGVDb3VudCA8PSBOdW1TYW1wbGVzKSB7CiAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICogQ29weSBhbGwgcHJvY2Vzc2VkIHNhbXBsZXMgdG8gdGhlIG91dHB1dAogICAgICAgICAgICAgICovCi0jaWZkZWYgU1VQUE9SVF9NQwotICAgICAgICAgICAgQ29weV9GbG9hdChwU3RhcnQsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgcERlc3QsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KKyAgICAgICAgICAgIENvcHlfRmxvYXQocFN0YXJ0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICovCisgICAgICAgICAgICAgICAgICAgICAgIHBEZXN0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCiAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKE5yQ2hhbm5lbHMgKiBGcmFtZUNvdW50KSk7IC8qIE51bWJlciBvZiBwcm9jZXNzZWQgc2FtcGxlcyAqLwotI2Vsc2UKLSAgICAgICAgICAgIENvcHlfRmxvYXQocFN0YXJ0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICovCi0gICAgICAgICAgICAgICAgICAgICAgIHBEZXN0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCi0gICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKDIgKiBTYW1wbGVDb3VudCkpOyAvKiBOdW1iZXIgb2YgcHJvY2Vzc2VkIHNhbXBsZXMgKi8KLSNlbmRpZgogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIFVwZGF0ZSB0aGUgcG9pbnRlciBhbmQgc2FtcGxlIGNvdW50cwogICAgICAgICAgICAgICovCi0jaWZkZWYgU1VQUE9SVF9NQwotICAgICAgICAgICAgcERlc3QgICAgICArPSBOckNoYW5uZWxzICogRnJhbWVDb3VudDsgICAgICAgICAgICAgICAgIC8qIE91dHB1dCBzYW1wbGUgcG9pbnRlciAqLwotI2Vsc2UKLSAgICAgICAgICAgIHBEZXN0ICAgICAgKz0gMiAqIFNhbXBsZUNvdW50OyAgICAgICAgICAgICAgICAgICAgICAgICAgLyogT3V0cHV0IHNhbXBsZSBwb2ludGVyICovCi0jZW5kaWYKLSAgICAgICAgICAgIE51bVNhbXBsZXMgID0gKExWTV9JTlQxNikoTnVtU2FtcGxlcyAtIFNhbXBsZUNvdW50KTsgICAgLyogU2FtcGxlcyBsZWZ0IHRvIHNlbmQgKi8KLSAgICAgICAgICAgIFNhbXBsZUNvdW50ID0gMDsgLyogTm8gc2FtcGxlcyBsZWZ0IGluIHRoZSBidWZmZXIgKi8KLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKKyAgICAgICAgICAgIHBEZXN0ICs9IE5yQ2hhbm5lbHMgKiBGcmFtZUNvdW50OyAgICAgICAgICAgICAgICAgICAvKiBPdXRwdXQgc2FtcGxlIHBvaW50ZXIgKi8KKyAgICAgICAgICAgIE51bVNhbXBsZXMgPSAoTFZNX0lOVDE2KShOdW1TYW1wbGVzIC0gU2FtcGxlQ291bnQpOyAvKiBTYW1wbGVzIGxlZnQgdG8gc2VuZCAqLworICAgICAgICAgICAgU2FtcGxlQ291bnQgPSAwOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE5vIHNhbXBsZXMgbGVmdCBpbiB0aGUgYnVmZmVyICovCisgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICogQ29weSBvbmx5IHNvbWUgcHJvY2Vzc2VkIHNhbXBsZXMgdG8gdGhlIG91dHB1dAogICAgICAgICAgICAgICovCi0jaWZkZWYgU1VQUE9SVF9NQwotICAgICAgICAgICAgQ29weV9GbG9hdChwU3RhcnQsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgcERlc3QsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoTnJDaGFubmVscyAqIE5yRnJhbWVzKSk7ICAvKiBOdW1iZXIgb2YgcHJvY2Vzc2VkIHNhbXBsZXMgKi8KLSNlbHNlCi0gICAgICAgICAgICBDb3B5X0Zsb2F0KHBTdGFydCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNvdXJjZSAqLwotICAgICAgICAgICAgICAgICAgICAgICBwRGVzdCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KSgyICogTnVtU2FtcGxlcykpOyAgICAgLyogTnVtYmVyIG9mIHByb2Nlc3NlZCBzYW1wbGVzICovCi0jZW5kaWYKKyAgICAgICAgICAgIENvcHlfRmxvYXQocFN0YXJ0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNvdXJjZSAqLworICAgICAgICAgICAgICAgICAgICAgICBwRGVzdCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KKyAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoTnJDaGFubmVscyAqIE5yRnJhbWVzKSk7IC8qIE51bWJlciBvZiBwcm9jZXNzZWQgc2FtcGxlcyAqLwogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIFVwZGF0ZSB0aGUgcG9pbnRlcnMgYW5kIHNhbXBsZSBjb3VudHMKLSAgICAgICAgICAgICAgICovCi0jaWZkZWYgU1VQUE9SVF9NQwotICAgICAgICAgICAgcFN0YXJ0ICAgICAgKz0gTnJDaGFubmVscyAqIE5yRnJhbWVzOyAgICAgICAgICAgICAgIC8qIFByb2Nlc3NlZCBzYW1wbGUgcG9pbnRlciAqLwotICAgICAgICAgICAgcERlc3QgICAgICAgKz0gTnJDaGFubmVscyAqIE5yRnJhbWVzOyAgICAgICAgICAgICAgIC8qIE91dHB1dCBzYW1wbGUgcG9pbnRlciAqLwotI2Vsc2UKLSAgICAgICAgICAgIHBTdGFydCAgICAgICs9IDIgKiBOdW1TYW1wbGVzOyAgICAgICAgICAgICAgICAgICAgICAgIC8qIFByb2Nlc3NlZCBzYW1wbGUgcG9pbnRlciAqLwotICAgICAgICAgICAgcERlc3QgICAgICAgKz0gMiAqIE51bVNhbXBsZXM7ICAgICAgICAgICAgICAgICAgICAgICAgLyogT3V0cHV0IHNhbXBsZSBwb2ludGVyICovCi0jZW5kaWYKLSAgICAgICAgICAgIFNhbXBsZUNvdW50ICA9IChMVk1fSU5UMTYpKFNhbXBsZUNvdW50IC0gTnVtU2FtcGxlcyk7IC8qIFByb2Nlc3NlZCBzYW1wbGVzIGxlZnQgKi8KLSAgICAgICAgICAgIE51bVNhbXBsZXMgICA9IDA7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIENsZWFyIHRoZSBzYW1wbGUgY291bnQgKi8KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcFN0YXJ0ICs9IE5yQ2hhbm5lbHMgKiBOckZyYW1lczsgICAgICAgICAgICAgICAgICAgICAvKiBQcm9jZXNzZWQgc2FtcGxlIHBvaW50ZXIgKi8KKyAgICAgICAgICAgIHBEZXN0ICs9IE5yQ2hhbm5lbHMgKiBOckZyYW1lczsgICAgICAgICAgICAgICAgICAgICAgLyogT3V0cHV0IHNhbXBsZSBwb2ludGVyICovCisgICAgICAgICAgICBTYW1wbGVDb3VudCA9IChMVk1fSU5UMTYpKFNhbXBsZUNvdW50IC0gTnVtU2FtcGxlcyk7IC8qIFByb2Nlc3NlZCBzYW1wbGVzIGxlZnQgKi8KKyAgICAgICAgICAgIE51bVNhbXBsZXMgPSAwOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogQ2xlYXIgdGhlIHNhbXBsZSBjb3VudCAqLwogICAgICAgICB9CiAgICAgfQogCiAgICAgLyoKICAgICAgKiBDb3B5IHRoZSByZW1haW5pbmcgcHJvY2Vzc2VkIGRhdGEgdG8gdGhlIG91dHB1dCBkZWxheSBidWZmZXIKICAgICAgKi8KLSAgICBpZiAoU2FtcGxlQ291bnQgIT0gMCkKLSAgICB7Ci0jaWZkZWYgU1VQUE9SVF9NQwotICAgICAgICBDb3B5X0Zsb2F0KHBTdGFydCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICovCisgICAgaWYgKFNhbXBsZUNvdW50ICE9IDApIHsKKyAgICAgICAgQ29weV9GbG9hdChwU3RhcnQsIC8qIFNvdXJjZSAqLwogICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCiAgICAgICAgICAgICAgICAgICAgJnBCdWZmZXItPk91dERlbGF5QnVmZmVyW05yQ2hhbm5lbHMgKiBwQnVmZmVyLT5PdXREZWxheVNhbXBsZXNdLAotICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKE5yQ2hhbm5lbHMgKiBGcmFtZUNvdW50KSk7ICAgICAgLyogTnVtYmVyIG9mIHByb2Nlc3NlZCBzYW1wbGVzICovCi0jZWxzZQotICAgICAgICBDb3B5X0Zsb2F0KHBTdGFydCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICovCi0gICAgICAgICAgICAgICAgICAgJnBCdWZmZXItPk91dERlbGF5QnVmZmVyWzIgKiBwQnVmZmVyLT5PdXREZWxheVNhbXBsZXNdLCAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKDIgKiBTYW1wbGVDb3VudCkpOyAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBwcm9jZXNzZWQgc2FtcGxlcyAqLwotI2VuZGlmCisgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoTnJDaGFubmVscyAqIEZyYW1lQ291bnQpKTsgLyogTnVtYmVyIG9mIHByb2Nlc3NlZCBzYW1wbGVzICovCiAgICAgICAgIC8qIFVwZGF0ZSB0aGUgYnVmZmVyIGNvdW50ICovCiAgICAgICAgIHBCdWZmZXItPk91dERlbGF5U2FtcGxlcyA9IChMVk1fSU5UMTYpKHBCdWZmZXItPk91dERlbGF5U2FtcGxlcyArIFNhbXBsZUNvdW50KTsKICAgICB9CkBAIC01NzQsMTAgKzQ1NywxMCBAQAogICAgIC8qCiAgICAgICogcG9pbnRlcnMsIGNvdW50cyBhbmQgc2V0IGRlZmF1bHQgYnVmZmVyIHByb2Nlc3NpbmcKICAgICAgKi8KLSAgICBwQnVmZmVyLT5TYW1wbGVzVG9PdXRwdXQgID0gTnVtU2FtcGxlczsgICAgICAgICAgICAgICAgICAgICAgICAgLyogU2FtcGxlcyBsZWZ0IHRvIHNlbmQgKi8KLSAgICBwSW5zdGFuY2UtPnBPdXRwdXRTYW1wbGVzID0gcERlc3Q7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogT3V0cHV0IHNhbXBsZSBwb2ludGVyICovCi0gICAgcEJ1ZmZlci0+QnVmZmVyU3RhdGUgICAgICA9IExWTV9NQVhCTE9DS0NBTEw7ICAgICAgICAgICAgICAgICAgIC8qIFNldCBmb3IgdGhlIGRlZmF1bHQgY2FsbCBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgc2l6ZSAqLworICAgIHBCdWZmZXItPlNhbXBsZXNUb091dHB1dCA9IE51bVNhbXBsZXM7ICAgLyogU2FtcGxlcyBsZWZ0IHRvIHNlbmQgKi8KKyAgICBwSW5zdGFuY2UtPnBPdXRwdXRTYW1wbGVzID0gcERlc3Q7ICAgICAgIC8qIE91dHB1dCBzYW1wbGUgcG9pbnRlciAqLworICAgIHBCdWZmZXItPkJ1ZmZlclN0YXRlID0gTFZNX01BWEJMT0NLQ0FMTDsgLyogU2V0IGZvciB0aGUgZGVmYXVsdCBjYWxsIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2sgc2l6ZSAqLwogICAgIC8qIFRoaXMgd2lsbCB0ZXJtaW5hdGUgdGhlIGxvb3Agd2hlbiBhbGwgc2FtcGxlcyBwcm9jZXNzZWQgKi8KICAgICAqcE51bVNhbXBsZXMgPSAoTFZNX1VJTlQxNilwSW5zdGFuY2UtPlNhbXBsZXNUb1Byb2Nlc3M7CiB9CkBAIC02MDEsNDQgKzQ4NCwyNyBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotdm9pZCBMVk1fQnVmZmVyVW5tYW5hZ2VkT3V0KExWTV9IYW5kbGVfdCAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICAgKnBOdW1TYW1wbGVzKQotewotCi0gICAgTFZNX0luc3RhbmNlX3QgICAgICAqcEluc3RhbmNlICA9IChMVk1fSW5zdGFuY2VfdCAgKiloSW5zdGFuY2U7Ci0jaWZkZWYgU1VQUE9SVF9NQwotICAgIExWTV9JTlQxNiAgICAgICAgICAgTnVtQ2hhbm5lbHMgPSBwSW5zdGFuY2UtPk5yQ2hhbm5lbHM7Ci0gICAgaWYgKE51bUNoYW5uZWxzID09IDEpCi0gICAgewotICAgICAgICAvKiBNb25vIGlucHV0IGlzIHByb2Nlc3NlZCBhcyBzdGVyZW8gYnkgTFZNIG1vZHVsZSAqLwotICAgICAgICBOdW1DaGFubmVscyA9IDI7Ci0gICAgfQordm9pZCBMVk1fQnVmZmVyVW5tYW5hZ2VkT3V0KExWTV9IYW5kbGVfdCBoSW5zdGFuY2UsIExWTV9VSU5UMTYqIHBOdW1TYW1wbGVzKSB7CisgICAgTFZNX0luc3RhbmNlX3QqIHBJbnN0YW5jZSA9IChMVk1fSW5zdGFuY2VfdCopaEluc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5jZS0+cE91dHB1dFNhbXBsZXMgKz0gKExWTV9JTlQxNikoTnJGcmFtZXMgKiBOdW1DaGFubmVscyk7CisgICAgcEluc3RhbmNlLT5TYW1wbGVzVG9Qcm9jZXNzID0KKyAgICAgICAgICAgIChMVk1fSU5UMTYpKHBJbnN0YW5jZS0+U2FtcGxlc1RvUHJvY2VzcyAtICpwTnVtU2FtcGxlcyk7IC8qIFVwZGF0ZSB0aGUgc2FtcGxlIGNvdW50ICovCiAKICAgICAvKgogICAgICAqIFNldCB0ZSBibG9jayBzaXplIHRvIHByb2Nlc3MKICAgICAgKi8KLSAgICBpZiAocEluc3RhbmNlLT5TYW1wbGVzVG9Qcm9jZXNzID4gcEluc3RhbmNlLT5JbnRlcm5hbEJsb2NrU2l6ZSkKLSAgICB7CisgICAgaWYgKHBJbnN0YW5jZS0+U2FtcGxlc1RvUHJvY2VzcyA+IHBJbnN0YW5jZS0+SW50ZXJuYWxCbG9ja1NpemUpIHsKICAgICAgICAgKnBOdW1TYW1wbGVzID0gKExWTV9VSU5UMTYpcEluc3RhbmNlLT5JbnRlcm5hbEJsb2NrU2l6ZTsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKKyAgICB9IGVsc2UgewogICAgICAgICAqcE51bVNhbXBsZXMgPSAoTFZNX1VJTlQxNilwSW5zdGFuY2UtPlNhbXBsZXNUb1Byb2Nlc3M7CiAgICAgfQogfQpAQCAtNjk4LDI1ICs1NjQsMTUgQEAKIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq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5hZ2VkT3V0KGhJbnN0YW5jZSwgcE91dERhdGEsIHBOdW1TYW1wbGVzKTsKKyAgICB9IGVsc2UgeworICAgICAgICBMVk1fQnVmZmVyVW5tYW5hZ2VkT3V0KGhJbnN0YW5jZSwgcE51bVNhbXBsZXMpOwogICAgIH0KIH0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CdW5kbGUvc3JjL0xWTV9Db2VmZnMuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CdW5kbGUvc3JjL0xWTV9Db2VmZnMuaAppbmRleCA4MTJmOGU1Li5jMDJjYWExIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQnVuZGxlL3NyYy9MVk1fQ29lZmZzLmgKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0J1bmRsZS9zcmMvTFZNX0NvZWZmcy5oCkBAIC0yNCw4MzIgKzI0LDgzMiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSNkZWZpbmUgVHJlYmxlQm9vc3RDb3JuZXIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgODAwMAotI2RlZmluZSBUcmVibGVCb29zdE1pblJhdGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0Ci0jZGVmaW5lIFRyZWJsZUJvb3N0U3RlcHMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUKKyNkZWZpbmUgVHJlYmxlQm9vc3RDb3JuZXIgODAwMAorI2RlZmluZSBUcmVibGVCb29zdE1pblJhdGUgNAorI2RlZmluZSBUcmVibGVCb29zdFN0ZXBzIDE1CiAKIC8qIENvZWZmaWNpZW50cyBmb3Igc2FtcGxlIHJhdGUgMjIwNTBIeiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW4xX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMDM4NDM0Ci0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW4xX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMzMxNTk5Ci0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW4xX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW4xX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMzcwMDMzCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW4xX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMi4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjJfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4wODE1NTcKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjJfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4yODg0NzUKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjJfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjJfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4zNzAwMzMKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjJfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAzLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluM19BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjEyOTk0MwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluM19BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI0MDA5MAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluM19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluM19CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM3MDAzMwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluM19CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDQuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW40X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMTg0MjMyCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW40X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMTg1ODAxCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW40X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW40X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMzcwMDMzCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW40X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgNS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjVfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4yNDUxNDUKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjVfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4xMjQ4ODcKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjVfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjVfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4zNzAwMzMKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjVfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA2LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluNl9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjMxMzQ5MQotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluNl9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjA1NjU0MQotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluNl9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluNl9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM3MDAzMwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluNl9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDcuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW43X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMzkwMTc3Ci0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW43X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4wMjAxNDQpCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW43X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW43X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMzcwMDMzCi0jZGVmaW5lIEhQRl9GczIyMDUwX0dhaW43X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgOC4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjhfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS40NzYyMTkKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjhfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjEwNjE4NykKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjhfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjhfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4zNzAwMzMKLSNkZWZpbmUgSFBGX0ZzMjIwNTBfR2FpbjhfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA5LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluOV9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjU3Mjc2MQotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluOV9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMjAyNzI4KQotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluOV9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluOV9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM3MDAzMwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluOV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEwLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTBfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjY4MTA4MgotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTBfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMzExMDQ5KQotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTBfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTBfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM3MDAzMwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTBfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDExLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTFfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjgwMjYyMAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTFfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNDMyNTg4KQotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTFfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTFfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM3MDAzMwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTFfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEyLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTJfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjkzODk4OQotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTJfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNTY4OTU2KQotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTJfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTJfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM3MDAzMwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTJfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEzLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTNfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjA5MTk5NwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTNfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzIxOTY0KQotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTNfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTNfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM3MDAzMwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTNfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDE0LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTRfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjI2MzY3NAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTRfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuODkzNjQxKQotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTRfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTRfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM3MDAzMwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTRfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDE1LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTVfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjQ1NjMwMAotI2RlZmluZSBIUEZfRnMyMjA1MF9HYWluMTVfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuMDg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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAyLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMl9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjA5NDc3MwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMl9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjE3MzE3NgotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMl9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMl9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI2Nzk0OQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMl9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDMuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW4zX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMTUwOTk5Ci0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW4zX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMTE2OTUwCi0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW4zX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW4zX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMjY3OTQ5Ci0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW4zX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgNC4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjRfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4yMTQwODYKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjRfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wNTM4NjMKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjRfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjRfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4yNjc5NDkKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjRfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA1LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluNV9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjI4NDg3MAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluNV9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMDE2OTIxKQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluNV9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluNV9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI2Nzk0OQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluNV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDYuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW42X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4zNjQyOTEKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjZfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMDk2MzQyKQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluNl9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW42X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4yNjc5NDkKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjZfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDcuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW43X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuNDUzNDAzCi0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW43X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4xODU0NTQpCi0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW43X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW43X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMjY3OTQ5Ci0jZGVmaW5lIEhQRl9GczI0MDAwX0dhaW43X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgOC4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjhfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS41NTMzODkKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjhfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjI4NTQ0MCkKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjhfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjhfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4yNjc5NDkKLSNkZWZpbmUgSFBGX0ZzMjQwMDBfR2FpbjhfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA5LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluOV9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjY2NTU3NAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluOV9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMzk3NjI1KQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluOV9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluOV9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI2Nzk0OQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluOV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEwLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTBfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjc5MTQ0OQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTBfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNTIzNDk5KQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTBfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTBfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI2Nzk0OQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTBfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDExLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTFfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjkzMjY4MgotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTFfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNjY0NzMzKQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTFfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTFfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI2Nzk0OQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTFfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEyLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTJfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjA5MTE0OAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTJfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuODIzMTk5KQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTJfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTJfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI2Nzk0OQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTJfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEzLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTNfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjI2ODk1MAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTNfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuMDAxMDAxKQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTNfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTNfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI2Nzk0OQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTNfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDE0LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTRfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjQ2ODQ0NwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTRfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuMjAwNDk4KQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTRfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTRfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI2Nzk0OQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTRfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDE1LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTVfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjY5MjI4NwotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTVfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuNDI0MzM4KQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTVfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTVfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI2Nzk0OQotI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMTVfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAorLyogR2FpbiA9ICAxLjAwMDAwMCBkQiAqLworI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMV9BMCAxLjA0NDY2MgorI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMV9BMSAwLjIyMzI4NworI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMV9BMiAwLjAwMDAwMAorI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMV9CMSAwLjI2Nzk0OQorI2RlZmluZSBIUEZfRnMyNDAwMF9HYWluMV9CMiAwLjAwMDAwMAorLyogR2FpbiA9ICAyLjAwMDAwMCBkQiAqLworI2RlZmluZSBIUEZfRnMyNDAwM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AgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjFfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4wNjEwMDkKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjFfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjA2MTAwOSkKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjFfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjFfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjAwMDAwMCkKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjFfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAyLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluMl9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4xMjk0NjMKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjJfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4xMjk0NjMpCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4yX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluMl9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjAwMDAwMCkKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjJfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMy4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjNfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMjA2MjY3Ci0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4zX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMjA2MjY3KQotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluM19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjNfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4wMDAwMDApCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4zX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDQuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW40X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMjkyNDQ3Ci0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW40X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yOTI0NDcpCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW40X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW40X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4wMDAwMDApCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW40X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgNS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjVfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4zODkxNDAKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjVfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjM4OTE0MCkKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjVfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjVfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjAwMDAwMCkKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjVfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA2LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluNl9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS40OTc2MzEKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjZfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC40OTc2MzEpCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW42X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluNl9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjAwMDAwMCkKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjZfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgNy4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjdfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuNjE5MzYxCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW43X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNjE5MzYxKQotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluN19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjdfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4wMDAwMDApCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW43X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDguMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW44X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjc1NTk0MwotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluOF9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjc1NTk0MykKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjhfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW44X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMDAwMDAwKQotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluOF9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA5LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluOV9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS45MDkxOTEKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjlfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC45MDkxOTEpCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW45X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluOV9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjAwMDAwMCkKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjlfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTAuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xMF9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjA4MTEzOQotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluMTBfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0xLjA4MTEzOSkKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjEwX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xMF9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMDAwMDAwKQotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluMTBfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAxMS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjExX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMi4yNzQwNjcKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjExX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0xLjI3NDA2NykKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjExX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjExX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjAwMDAwMCkKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjExX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAxMi4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjEyX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAyLjQ5MDUzNgotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluMTJfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMS40OTA1MzYpCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xMl9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMzIwMDBfR2FpbjEyX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMDAwMDAwKQotI2RlZmluZSBIUEZfRnMzMjAwMF9HYWluMTJfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTMuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xM19BMCAgICAgICAgICAgICAgICAgICAgICAgICAgIDIuNzMzNDE4Ci0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xM19BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMS43MzM0MTgpCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xM19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xM19CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4wMDAwMDApCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xM19CMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTQuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xNF9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgIDMuMDA1OTM2Ci0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xNF9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMi4wMDU5MzYpCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xNF9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xNF9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4wMDAwMDApCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xNF9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTUuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczMyMDAwX0dhaW4xNV9BMCAgICAgICAgICAgICAgICAgICAgICA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bmUgSFBGX0ZzNDQxMDBfR2FpbjFfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjIxODg5NCkKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjFfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAyLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMl9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjE1NzgwMQotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMl9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMzc2Njk1KQotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMl9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMl9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMjE4ODk0KQotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMl9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDMuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4zX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4yNTE0MjAKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjNfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNDcwMzEzKQotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluM19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4zX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjIxODg5NCkKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjNfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDQuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW40X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMzU2NDYxCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW40X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC41NzUzNTUpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW40X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW40X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yMTg4OTQpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW40X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgNS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjVfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS40NzQzMjAKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjVfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjY5MzIxMykKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjVfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjVfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjIxODg5NCkKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjVfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA2LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluNl9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuNjA2NTU5Ci0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW42X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjgyNTQ1MykKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjZfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluNl9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yMTg4OTQpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW42X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA3LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluN19BMCAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuNzU0OTM1Ci0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW43X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjk3MzgyOCkKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjdfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluN19CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yMTg4OTQpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW43X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA4LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluOF9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjkyMTQxNAotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluOF9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuMTQwMzA4KQotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluOF9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluOF9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMjE4ODk0KQotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluOF9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDkuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW45X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIuMTA4MjA4Ci0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW45X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMS4zMjcxMDEpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW45X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW45X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yMTg4OTQpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW45X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTAuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xMF9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgMi4zMTc3OTMKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjEwX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuNTM2Njg3KQotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTBfQTIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xMF9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjIxODg5NCkKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjEwX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDExLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTFfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDIuNTUyOTUyCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xMV9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0xLjc3MTg0NikKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjExX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTFfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yMTg4OTQpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xMV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAxMi4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjEyX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAyLjgxNjgwNQotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTJfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMi4wMzU2OTgpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xMl9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjEyX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMjE4ODk0KQotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTJfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTMuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xM19BMCAgICAgICAgICAgICAgICAgICAgICAgICAgIDMuMTEyODUyCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xM19BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMi4zMzE3NDYpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xM19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xM19CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yMTg4OTQpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xM19CMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTQuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xNF9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgMy40NDUwMjMKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjE0X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTIuNjYzOTE2KQotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTRfQTIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xNF9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjIxODg5NCkKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjE0X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDE1LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTVfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDMuODE3NzI0Ci0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xNV9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0zLjAzNjYxOCkKLSNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjE1X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTVfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yMTg4OTQpCi0jZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xNV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKKy8qIEdhaW4gPSAgMS4wMDAwMDAgZEIgKi8KKyNkZWZpbmUgSFBGX0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0EyIDAuMDAwMDAwCisjZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xNF9CMSAoLTAuMjE4ODk0KQorI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTRfQjIgMC4wMDAwMDAKKy8qIEdhaW4gPSAgMTUuMDAwMDAwIGRCICovCisjZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xNV9BMCAzLjgxNzcyNAorI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTVfQTEgKC0zLjAzNjYxOCkKKyNkZWZpbmUgSFBGX0ZzNDQxMDBfR2FpbjE1X0EyIDAuMDAwMDAwCisjZGVmaW5lIEhQRl9GczQ0MTAwX0dhaW4xNV9CMSAoLTAuMjE4ODk0KQorI2RlZmluZSBIUEZfRnM0NDEwMF9HYWluMTVfQjIgMC4wMDAwMDAKIC8qIENvZWZmaWNpZW50cyBmb3Igc2FtcGxlIHJhdGUgNDgwMDBIeiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAxLjA3NzM1NwotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMV9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjM0NTMwNikKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjFfQTIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMjY3OTQ5KQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAyLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMl9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgMS4xNjQxNTIKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjJfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC40MzIxMDEpCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4yX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMl9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjI2Nzk0OSkKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjJfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMy4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjNfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMjYxNTM4Ci0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4zX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNTI5NDg4KQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluM19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjNfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yNjc5NDkpCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4zX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDQuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW40X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4zNzA4MDcKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjRfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNjM4NzU3KQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluNF9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW40X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjI2Nzk0OSkKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjRfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDUuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW41X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMS40OTM0MDkKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjVfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzYxMzU5KQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluNV9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW41X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjI2Nzk0OSkKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjVfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDYuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW42X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuNjMwOTcxCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW42X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC44OTg5MjApCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW42X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW42X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yNjc5NDkpCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW42X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgNy4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjdfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS43ODUzMTgKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjdfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0xLjA1MzI2NykKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjdfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjdfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjI2Nzk0OSkKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjdfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA4LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluOF9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuOTU4NDk4Ci0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW44X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0xLjIyNjQ0NykKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjhfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluOF9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yNjc5NDkpCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW44X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA5LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluOV9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgMi4xNTI4MDkKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjlfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMS40MjA3NTgpCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW45X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluOV9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjI2Nzk0OSkKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjlfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTAuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xMF9BMCAgICAgICAgICAgICAgICAgICAgICAgICAyLjM3MDgyOQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTBfQTEgICAgICAgICAgICAgICAgICAgICAgICAgKC0xLjYzODc3OCkKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjEwX0EyICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xMF9CMSAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMjY3OTQ5KQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTBfQjIgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAxMS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjExX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAyLjYxNTQ1MgotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTFfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMS44ODM0MDEpCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xMV9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjExX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMjY3OTQ5KQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTFfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTIuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xMl9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgMi44ODk5MjQKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjEyX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTIuMTU3ODczKQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTJfQTIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xMl9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjI2Nzk0OSkKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjEyX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEzLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTNfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLjE5Nzg4NgotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTNfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTIuNDY1ODM1KQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTNfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTNfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMjY3OTQ5KQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTNfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDE0LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTRfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDMuNTQzNDI1Ci0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xNF9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0yLjgxMTM3NCkKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjE0X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTRfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yNjc5NDkpCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xNF9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAxNS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjE1X0EwICAgICAgICAgICAgICAgICAgICAgICAgIDMuOTMxMTI3Ci0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xNV9BMSAgICAgICAgICAgICAgICAgICAgICAgICAoLTMuMTk5MDc2KQotI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMTVfQTIgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzNDgwMDBfR2FpbjE1X0IxICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yNjc5NDkpCi0jZGVmaW5lIEhQRl9GczQ4MDAwX0dhaW4xNV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAorLyogR2FpbiA9ICAxLjAwMDAwMCBkQiAqLworI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMV9BMCAxLjA3NzM1NworI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMV9BMSAoLTAuMzQ1MzA2KQorI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMV9BMiAwLjAwMDAwMAorI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMV9CMSAoLTAuMjY3OTQ5KQorI2RlZmluZSBIUEZfRnM0ODAwMF9HYWluMV9CMiAw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ICAwLjAwMDAwMGYKKyNkZWZpbmUgSFBGX0ZzODgyMDBfR2FpbjE1X0EwIDQuNTc1OTM4ZgorI2RlZmluZSBIUEZfRnM4ODIwMF9HYWluMTVfQTEgKC00LjEyMjgyMGYpCisjZGVmaW5lIEhQRl9Gczg4MjAwX0dhaW4xNV9BMiAwLjAwMDAwMGYKKyNkZWZpbmUgSFBGX0ZzODgyMDBfR2FpbjE1X0IxICgtMC41NDY4ODJmKQorI2RlZmluZSBIUEZfRnM4ODIwMF9HYWluMTVfQjIgMC4wMDAwMDBmCiAKIC8qIENvZWZmaWNpZW50cyBmb3Igc2FtcGxlIHJhdGUgOTYwMDBIeiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW4xX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAxLjA5NjIzMwotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMV9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjY3MzU4MykKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjFfQTIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW4xX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNTc3MzUwKQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAyLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMl9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgMS4yMDQyMDgKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjJfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC43ODE1NTgpCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW4yX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMl9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjU3NzM1MCkKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjJfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMy4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjNfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMzI1MzU4Ci0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW4zX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuOTAyNzA4KQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluM19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjNfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC41NzczNTApCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW4zX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDQuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW40X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMS40NjEyOTEKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjRfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuMDM4NjQxKQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluNF9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW40X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjU3NzM1MCkKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjRfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDUuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW41X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMS42MTM4MTAKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjVfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuMTkxMTYwKQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluNV9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW41X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjU3NzM1MCkKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjVfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDYuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW42X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuNzg0OTM5Ci0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW42X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMS4zNjIyODkpCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW42X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW42X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC41NzczNTApCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW42X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA3LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluN19BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjk3Njk0OQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluN19BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuNTU0Mjk5KQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluN19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluN19CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNTc3MzUwKQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluN19CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDguMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW44X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMi4xOTIzODcKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjhfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuNzY5NzM4KQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluOF9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW44X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjU3NzM1MCkKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjhfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgOS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjlfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDIuNDM0MTEzCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW45X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTIuMDExNDY0KQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluOV9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjlfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC41NzczNTApCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW45X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAxMC4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjEwX0EwICAgICAgICAgICAgICAgICAgICAgICAgMi43MDUzMzUKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjEwX0ExICAgICAgICAgICAgICAgICAgICAgICAgKC0yLjI4MjY4NSkKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjEwX0EyICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW4xMF9CMSAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNTc3MzUwKQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTBfQjIgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAxMS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjExX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAzLjAwOTY1MAotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTFfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMi41ODcwMDApCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW4xMV9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjExX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNTc3MzUwKQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTFfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEyLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTJfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDMuMzUxMDk3Ci0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW4xMl9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0yLjkyODQ0NykKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjEyX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTJfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC41NzczNTApCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW4xMl9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEzLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTNfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLjczNDIwNwotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTNfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTMuMzExNTU4KQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTNfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTNfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNTc3MzUwKQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTNfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDE0LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTRfQTAgICAgICAgICAgICAgICAgICAgICAgICAgNC4xNjQwNjQKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjE0X0ExICAgICAgICAgICAgICAgICAgICAgICAgICgtMy43NDE0MTQpCi0jZGVmaW5lIEhQRl9Gczk2MDAwX0dhaW4xNF9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzOTYwMDBfR2FpbjE0X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNTc3MzUwKQotI2RlZmluZSBIUEZfRnM5NjAwMF9HYWluMTRfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuM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wX0dhaW4xMV9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0yLjk3NzU2MWYpCi0jZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTFfQTIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwZgotI2RlZmluZSBIUEZfRnMxNzY0MDBfR2FpbjExX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzQ5MDk2ZikKLSNkZWZpbmUgSFBGX0ZzMTc2NDAwX0dhaW4xMV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDBmCisjZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTFfQTAgMy4yMjg0NjVmCisjZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTFfQTEgKC0yLjk3NzU2MWYpCisjZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTFfQTIgMC4wMDAwMDBmCisjZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTFfQjEgKC0wLjc0OTA5NmYpCisjZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTFfQjIgMC4wMDAwMDBmCiAvKiBHYWluID0gMTIuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTJfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDMuNjA3MDkwZgotI2RlZmluZSBIUEZfRnMxNzY0MDBfR2FpbjEyX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTMuMzU2MTg2ZikKLSNkZWZpbmUgSFBGX0ZzMTc2NDAwX0dhaW4xMl9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDBmCi0jZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTJfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC43NDkwOTZmKQotI2RlZmluZSBIUEZfRnMxNzY0MDBfR2FpbjEyX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMGYKKyNkZWZpbmUgS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kQiAqLwotI2RlZmluZSBIUEZfRnMxNzY0MDBfR2FpbjE0X0EwICAgICAgICAgICAgICAgICAgICAgICAgICA0LjUwODU3NWYKLSNkZWZpbmUgSFBGX0ZzMTc2NDAwX0dhaW4xNF9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC00LjI1NzY3MWYpCi0jZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTRfQTIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwZgotI2RlZmluZSBIUEZfRnMxNzY0MDBfR2FpbjE0X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzQ5MDk2ZikKLSNkZWZpbmUgSFBGX0ZzMTc2NDAwX0dhaW4xNF9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDBmCisjZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTRfQTAgNC41MDg1NzVmCisjZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTRfQTEgKC00LjI1NzY3MWYpCisjZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTRfQTIgMC4wMDAwMDBmCisjZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTRfQjEgKC0wLjc0OTA5NmYpCisjZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTRfQjIgMC4wMDAwMDBmCiAvKiBHYWluID0gMTUuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTVfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDUuMDQzMzk3ZgotI2RlZmluZSBIUEZfRnMxNzY0MDBfR2FpbjE1X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTQuNzkyNDkzZikKLSNkZWZpbmUgSFBGX0ZzMTc2NDAwX0dhaW4xNV9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDBmCi0jZGVmaW5lIEhQRl9GczE3NjQwMF9HYWluMTVfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC43NDkwOTZmKQotI2RlZmluZSBIUEZfRnMxNzY0MDBfR2FpbjE1X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMGYKKyNkZWZpbmUgSFBGX0ZzMTc2NDAwX0dhaW4xNV9BMCA1LjA0MzM5N2YKKyNkZWZpbmUgSFBGX0ZzMTc2NDAwX0dhaW4xNV9BMSAoLTQuNzkyNDkzZikKKyNkZWZpbmUgSFBGX0ZzMTc2NDAwX0dhaW4xNV9BMiAwLjAwMDAwMGYKKyNkZWZpbmUgSFBGX0ZzMTc2NDAwX0dhaW4xNV9CMSAoLTAuNzQ5MDk2ZikKKyNkZWZpbmUgSFBGX0ZzMTc2NDAwX0dhaW4xNV9CMiAwLjAwMDAwMGYKIAogLyogQ29lZmZpY2llbnRzIGZvciBzYW1wbGUgcmF0ZSAxOTIwMDBIeiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAxLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjFfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMTA3ODIzCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMV9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjg3NTE1MCkKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW4xX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjFfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC43NjczMjcpCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMi4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW4yX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAxLjIyODgwMwotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjJfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC45OTYxMzApCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMl9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW4yX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzY3MzI3KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjJfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAzLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjNfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMzY0NTQ0Ci0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluM19BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0xLjEzMTg3MSkKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW4zX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjNfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC43NjczMjcpCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluM19CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDQuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluNF9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgMS41MTY4NDkKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW40X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuMjg0MTc2KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjRfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjRfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzY3MzI3KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjRfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgNS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW41X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMS42ODc3MzcKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW41X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0xLjQ1NTA2NCkKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW41X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW41X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjc2NzMyNykKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW41X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDYuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluNl9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjg3OTQ3NwotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjZfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0xLjY0NjgwNCkKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW42X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluNl9CMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzY3MzI3KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjZfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA3LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjdfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMi4wOTQ2MTMKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW43X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMS44NjE5NDApCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluN19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjdfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjc2NzMyNykKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW43X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICA4LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjhfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjMzNTk5OQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjhfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTIuMTAzMzI2KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjhfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjhfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzY3MzI3KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjhfQjIgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgOS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW45X0EwICAgICAgICAgICAgICAgICAgICAgICAgICAyLjYwNjgzOQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjlfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMi4zNzQxNjYpCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluOV9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW45X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzY3MzI3KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjlfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTAuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMTBfQTAgICAgICAgICAgICAgICAgICAgICAgICAyLjkxMDcyNgotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjEwX0ExICAgICAgICAgICAgICAgICAgICAgICAgKC0yLjY3ODA1MykKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW4xMF9BMiAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjEwX0IxICAgICAgICAgICAgICAgICAgICAgICAgICgtMC43NjczMjcpCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMTBfQjIgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTEuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMTFfQTAgICAgICAgICAgICAgICAgICAgICAgICAgIDMuMjUxNjkzCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMTFfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMy4wMTkwMjApCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMTFfQTIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMTFfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC43NjczMjcpCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMTFfQjIgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDEyLjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjEyX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAzLjYzNDI2NAotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjEyX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTMuNDAxNTkxKQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjEyX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjEyX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzY3MzI3KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjEyX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdhaW4gPSAgMTMuMDAwMDAwIGRCICovCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMTNfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LjA2MzUxNgotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjEzX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0zLjgzMDg0MykKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW4xM19BMiAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMTNfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzY3MzI3KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjEzX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHYWluID0gIDE0LjAwMDAwMCBkQiAqLwotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjE0X0EwICAgICAgICAgICAgICAgICAgICAgICAgICA0LjU0NTE0NQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjE0X0ExICAgICAgICAgICAgICAgICAgICAgICAgICAoLTQuMzEyNDcyKQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjE0X0EyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjE0X0IxICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzY3MzI3KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjE0X0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiA9ICAxNS4wMDAwMDAgZEIgKi8KLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW4xNV9BMCAgICAgICAgICAgICAgICAgICAgICAgICA1LjA4NTU0MgotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjE1X0ExICAgICAgICAgICAgICAgICAgICAgICAgICgtNC44NTI4NjgpCi0jZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMTVfQTIgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW4xNV9CMSAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzY3MzI3KQotI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjE1X0IyICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCisvKiBHYWluID0gIDEuMDAwMDAwIGRCICovCisjZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMV9BMCAxLjEwNzgyMworI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjFfQTEgKC0wLjg3NTE1MCkKKyNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW4xX0EyIDAuMDAwMDAwCisjZGVmaW5lIEhQRl9GczE5MjAwMF9HYWluMV9CMSAoLTAuNzY3MzI3KQorI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjFfQjIgMC4wMDAwMDAKKy8qIEdhaW4g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DAKKyNkZWZpbmUgSFBGX0ZzMTkyMDAwX0dhaW4xNV9CMSAoLTAuNzY3MzI3KQorI2RlZmluZSBIUEZfRnMxOTIwMDBfR2FpbjE1X0IyIDAuMDAwMDAwCiAKICNlbmRpZgpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0J1bmRsZS9zcmMvTFZNX0NvbnRyb2wuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0J1bmRsZS9zcmMvTFZNX0NvbnRyb2wuY3BwCmluZGV4IGZmMmM5MGEuLmIyYTM1ZDggMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CdW5kbGUvc3JjL0xWTV9Db250cm9sLmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQnVuZGxlL3NyYy9MVk1fQ29udHJvbC5jcHAKQEAgLTUwLDc4ICs1MCw2MiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZNX1JldHVyblN0YXR1c19lbiBMVk1fU2V0Q29udHJvbFBhcmFtZXRlcnMoTFZNX0hhbmRsZV90ICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fQ29udHJvbFBhcmFtc190ICAgICpwUGFyYW1zKQotewotICAgIExWTV9JbnN0YW5jZV90ICAgICpwSW5zdGFuY2UgPShMVk1fSW5zdGFuY2VfdCAgKiloSW5zdGFuY2U7CitMVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9TZXRDb250cm9sUGFyYW1ldGVycyhMVk1fSGFuZGxlX3Qg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05VTExBRERSRVNTKTsKICAgICB9CiAKQEAgLTEyOSwzNSArMTEzLDMxIEBACiAgICAgICogQ29weSB0aGUgZmlsdGVyIGRlZmluaXRpb25zIGZvciB0aGUgRXF1YWxpc2VyCiAgICAgICovCiAgICAgewotICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgIGk7CisgICAgICAgIExWTV9JTlQxNiBpOwogCi0gICAgICAgIGlmIChwUGFyYW1zLT5FUU5CX05CYW5kcyAhPSAwKQotICAgICAgICB7Ci0gICAgICAgICAgICBmb3IgKGk9MDsgaTxwUGFyYW1zLT5FUU5CX05CYW5kczsgaSsrKQotICAgICAgICAgICAgeworICAgICAgICBpZiAocFBhcmFtcy0+RVFOQl9OQmFuZHMgIT0gMCkgeworICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHBQYXJhbXMtPkVRTkJfTkJhbmRzOyBpKyspIHsKICAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPnBFUU5CX0JhbmREZWZzW2ldID0gcFBhcmFtcy0+cEVRTkJfQmFuZERlZmluaXRpb25baV07CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBwSW5zdGFuY2UtPk5ld1BhcmFtcy5wRVFOQl9CYW5kRGVmaW5pdGlvbiA9IHBJbnN0YW5jZS0+cEVRTkJfQmFuZERlZnM7CiAgICAgICAgIH0KICAgICB9Ci0gICAgaWYoIC8qIE4tQmFuZCBFcXVhbGlzZXIgcGFyYW1ldGVycyAqLwotICAgICAgICAoKHBQYXJhbXMtPkVRTkJfT3BlcmF0aW5nTW9kZSAhPSBMVk1fRVFOQl9PRkYpICYmIChwUGFyYW1zLT5FUU5CX09wZXJhdGluZ01vZGUgIT0gTFZNX0VRTkJfT04pKSB8fAotICAgICAgICAocFBhcmFtcy0+RVFOQl9OQmFuZHMgPiBwSW5zdGFuY2UtPkluc3RQYXJhbXMuRVFOQl9OdW1CYW5kcykpCi0gICAgeworICAgIGlmICgvKiBOLUJhbmQgRXF1YWxpc2VyIHBhcmFtZ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ldy4KLSAgICAqLworICAgICAqIFNldCB0aGUgZmxhZyB0byBpbmRpY2F0ZSB0aGVyZSBhcmUgbmV3IHBhcmFtZXRlcnMgdG8gdXNlCisgICAgICoKKyAgICAgKiBQcm90ZWN0IHRoZSBjb3B5IG9mIHRoZSBuZXcgcGFyYW1ldGVycyBmcm9tIGludGVycnVwdHMgdG8gYXZvaWQgcG9zc2libGUgcHJvYmxlbXMKKyAgICAgKiB3aXRoIGxvc3MgY29udHJvbCBwYXJhbWV0ZXJzLiBUaGlzIHByb2JsZW0gY2FuIG9jY3VyIGlmIHRoaXMgY29udHJvbCBmdW5jdGlvbiBpcyBjYWxsZWQgbW9yZQorICAgICAqIHRoYW4gb25jZSBiZWZvcmUgYSBjYWxsIHRvIHRoZSBwcm9jZXNzIGZ1bmN0aW9uLiBJZiB0aGUgcHJvY2VzcyBmdW5jdGlvbiBpbnRlcnJ1cHRzCisgICAgICogdGhlIGNvcHkgdG8gTmV3UGFyYW1zIHRoZW4gb25lIGZyYW1lIG1heSBoYXZlIG1peGVkIHBhcmFtZXRlcnMsIHNvbWUgb2xkIGFuZCBzb21lIG5ldy4KKyAgICAgKi8KICAgICBwSW5zdGFuY2UtPkNvbnRyb2xQZW5kaW5nID0gTFZNX1RSVUU7CiAKLSAgICByZXR1cm4oTFZNX1NVQ0NFU1MpOworICAgIHJldHVybiAoTFZNX1NVQ0NFU1MpOwogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTIzMCwxNiArMjEwLDEzIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9HZXRDb250cm9sUGFyYW1ldGVycyhMVk1fSGFuZGxlX3QgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9Db250cm9sUGFyYW1zX3QgICAgKnBQYXJhbXMpCi17Ci0gICAgTFZNX0luc3RhbmNlX3QgICAgKnBJbnN0YW5jZSA9KExWTV9JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKK0xWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX0dldENvbnRyb2xQYXJhbWV0ZXJzKExWTV9IYW5kbGVfdCBoSW5zdGFuY2UsIExWTV9Db250cm9sUGFyYW1zX3QqIHBQYXJhbXMpIHsKKyAgICBMVk1fSW5zdGFuY2VfdCogcEluc3RhbmNlID0gKExWTV9JbnN0YW5jZV90KiloSW5zdGFuY2U7CiAKICAgICAvKgogICAgICAqIENoZWNrIHBvaW50ZXIKICAgICAgKi8KLSAgICBpZiAoKHBQYXJhbXMgPT0gTFZNX05VTEwpIHx8IChoSW5zdGFuY2UgPT0gTFZNX05VTEwpKQotICAgIHsKKyAgICBpZiAoKHBQYXJhbXMgPT0gTFZNX05VTEwpIHx8IChoSW5zdGFuY2UgPT0gTFZNX05VTEwpKSB7CiAgICAgICAgIHJldHVybiAoTFZNX05VTExBRERSRVNTKTsKICAgICB9CiAgICAgKnBQYXJhbXMgPSBwSW5zdGFuY2UtPk5ld1BhcmFtczsKQEAgLTI0OCwxNyArMjI1LDE2IEBACiAgICAgICogQ29weSB0aGUgZmlsdGVyIGRlZmluaXRpb25zIGZvciB0aGUgRXF1YWxpc2VyCiAgICAgICovCiAgICAgewotICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgIGk7CisgICAgICAgIExWTV9JTlQxNiBpOwogCiAgICAgICAgIGlmIChwSW5zdGFuY2UtPk5ld1BhcmFtcy5FUU5CX05CYW5kcyAhPSAwKQotICAgICAgICBmb3IgKGk9MDsgaTxwSW5zdGFuY2UtPk5ld1BhcmFtcy5FUU5CX05CYW5kczsgaSsrKQotICAgICAgICB7Ci0gICAgICAgICAgICBwSW5zdGFuY2UtPnBFUU5CX1VzZXJEZWZzW2ldID0gcEluc3RhbmNlLT5wRVFOQl9CYW5kRGVmc1tpXTsKLSAgICAgICAgfQorICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHBJbnN0YW5jZS0+TmV3UGFyYW1zLkVRTkJfTkJhbmRzOyBpKyspIHsKKyAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPnBFUU5CX1VzZXJEZWZzW2ldID0gcEluc3RhbmNlLT5wRVFOQl9CYW5kRGVmc1tpXTsKKyAgICAgICAgICAgIH0KICAgICAgICAgcFBhcmFtcy0+cEVRTkJfQmFuZERlZmluaXRpb24gPSBwSW5zdGFuY2UtPnBFUU5CX1VzZXJEZWZzOwogICAgIH0KIAotICAgIHJldHVybihMVk1fU1VDQ0VTUyk7CisgICAgcmV0dXJuIChMVk1fU1VDQ0VTUyk7CiB9CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtMjc0LDU2ICsyNTAsNDIgQEAKIC8qICBwUGFyYW1zICAgICAgICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBwYXJhbWV0ZXJzIHRvIHVzZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgTFZNX1NldFRyZWJsZUJvb3N0KExWTV9JbnN0YW5jZV90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9IRUFEUEhPTkVTKSkpCi0gICAgICAgIHsKKyAgICBpZiAoKHBQYXJhbXMtPlRFX09wZXJhdGluZ01vZGUgPT0gTFZNX1RFX09OKSAmJiAocFBhcmFtcy0+U2FtcGxlUmF0ZSA+PSBUcmVibGVCb29zdE1pblJhdGUpICYmCisgICAgICAgIChwUGFyYW1zLT5PcGVyYXRpbmdNb2RlID09IExWTV9NT0RFX09OKSAmJiAocFBhcmFtcy0+VEVfRWZmZWN0TGV2ZWwgPiAwKSkgeworICAgICAgICBpZiAoKHBQYXJhbXMtPlRFX0VmZmVjdExldmVsID09IExWTV9URV9MT1dfTUlQUykgJiYKKyAgICAgICAgICAgICgocFBhcmFtcy0+U3BlYWtlclR5cGUgPT0gTFZNX0hFQURQSE9ORVMpIHx8CisgICAgICAgICAgICAgKHBQYXJhbXMtPlNwZWFrZXJUeXBlID09IExWTV9FWF9IRUFEUEhPTkVTKSkpIHsKICAgICAgICAgICAgIHBJbnN0YW5jZS0+VEVfQWN0aXZlID0gTFZNX0ZBTFNFOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgeworICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgRWZmZWN0TGV2ZWwgPSBwUGFyYW1zLT5URV9FZmZlY3RMZXZlbDsKICAgICAgICAgICAgIHBJbnN0YW5jZS0+VEVfQWN0aXZlID0gTFZNX1RSVUU7CiAgICAgICAgIH0KIAotICAgICAgICBpZihwSW5zdGFuY2UtPlRFX0FjdGl2ZSA9PSBMVk1fVFJVRSkKLSAgICAgICAgeworICAgICAgICBpZiAocEluc3RhbmNlLT5URV9BY3RpdmUgPT0gTFZNX1RSVUUpIHsKICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgKiBMb2FkIHRoZSBjb2VmZmljaWVudHMgYW5kIGVuYWJsZWQgdGhlIHRyZWJsZSBib29zdAogICAgICAgICAgICAgICovCi0gICAgICAgICAgICBPZmZzZXQgPSAoTFZNX0lOVDE2KShFZmZlY3RMZXZlbCAtIDEgKyBUcmVibGVCb29zdFN0ZXBzICogKHBQYXJhbXMtPlNhbXBsZVJhdGUgLSBUcmVibGVCb29zdE1pblJhdGUpKTsKLSAgICAgICAgICAgIEZPXzJJX0QxNkYzMkNzc19MU2h4X1RSQ19XUkFfMDFfSW5pdCgmcEluc3RhbmNlLT5wVEVfU3RhdGUtPlRyZWJsZUJvb3N0X1N0YXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcEluc3RhbmNlLT5wVEVfVGFwcy0+VHJlYmxlQm9vc3RfVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkxWTV9UcmVibGVCb29zdENvZWZzW09mZnNldF0pOwotCisgICAgICAgICAgICBPZmZzZXQgPSAoTFZNX0lOVDE2KShFZmZlY3RMZXZlbCAtIDEgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVHJlYmxlQm9vc3RTdGVwcyAqIChwUGFyYW1zLT5TYW1wbGVSYXRlIC0gVHJlYmxlQm9vc3RNaW5SYXRlKSk7CiAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICogQ2xlYXIgdGhlIHRhcHMKKyAgICAgICAgICAgICAqIENyZWF0ZSBiaXF1YWQgaW5zdGFuY2UKICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgTG9hZENvbnN0X0Zsb2F0KChMVk1fRkxPQVQpMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogVmFsdWUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUICopJnBJbnN0YW5jZS0+cFRFX1RhcHMtPlRyZWJsZUJvb3N0X1RhcHMsICAvKiBEZXN0aW5hdGlvbi5cCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENhc3QgdG8gdm9pZDogbm8gZGVyZWZlcmVuY2luZyBpbiBmdW5jdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fVUlOVDE2KShzaXplb2YocEluc3RhbmNlLT5wVEVfVGFwcy0+VHJlYmxlQm9vc3RfVGFwcykgLyBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihMVk1fRkxPQVQpKSk7IC8qIE51bWJlciBvZiB3b3JkcyAqLworICAgICAgICAgICAgc3RkOjphcnJheTxMVk1fRkxPQVQsIGFuZHJvaWQ6OmF1ZGlvX3V0aWxzOjprQmlxdWFkTnVtQ29lZnM+IGNvZWZzID0geworICAgICAgICAgICAgICAgICAgICBMVk1fVHJlYmxlQm9vc3RDb2Vmc1tPZmZzZXRdLkEwLCBMVk1fVHJlYmxlQm9vc3RDb2Vmc1tPZmZzZXRdLkExLCAwLjAsCisgICAgICAgICAgICAgICAgICAgIC0oTFZNX1RyZWJsZUJvb3N0Q29lZnNbT2Zmc2V0XS5CMSksIDAuMH07CisgICAgICAgICAgICBwSW5zdGFuY2UtPnBURUJpcXVhZC5yZXNldCgKKyAgICAgICAgICAgICAgICAgICAgbmV3IGFuZHJvaWQ6OmF1ZGlvX3V0aWxzOjpCaXF1YWRGaWx0ZXI8TFZNX0ZMT0FUPihwUGFyYW1zLT5OckNoYW5uZWxzLCBjb2VmcykpOwogICAgICAgICB9Ci0gICAgfQotICAgIGVsc2UKLSAgICB7CisgICAgfSBlbHNlIHsKICAgICAgICAgLyoKICAgICAgICAgICogRGlzYWJsZSB0aGUgdHJlYmxlIGJvb3N0CiAgICAgICAgICAqLwpAQCAtMzQ1LDk0ICszMDcsNzYgQEAKIC8qICBwUGFyYW1zICAgICAgICAgICAgIEluaXRpYWxpc2F0aW9uIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgICAgTFZNX1NldFZvbHVtZShMVk1fSW5zdGFuY2VfdCAgICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgTFZNX0NvbnRyb2xQYXJhbXNfdCAgICAqcFBhcmFtcykKLXsKLQotICAgIExWTV9VSU5UMTYgICAgICBkQlNoaWZ0czsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIDZkQiBzaGlmdHMgKi8KLSAgICBMVk1fVUlOVDE2ICAgICAgZEJPZmZzZXQ7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBUYWJsZSBvZmZzZXQgKi8KLSAgICBMVk1fSU5UMTYgICAgICAgVm9sdW1lID0gMDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBSZXF1aXJlZCB2b2x1bWUgaW4gZEJzICovCi0gICAgTFZNX0ZMT0FUICAgICAgICBUZW1wOwordm9pZCBMVk1fU2V0Vm9sdW1lKExWTV9JbnN0YW5jZV90KiBwSW5zdGFuY2UsIExWTV9Db250cm9sUGFyYW1zX3QqIHBQYXJhbXMpIHsKKyAgICBMVk1fVUlOVDE2IGRCU2hpZnRzOyAgLyogNmRCIHNoaWZ0cyAqLworICAgIExWTV9VSU5UMTYgZEJPZmZzZXQ7ICAvKiBUYWJsZSBvZmZzZXQgKi8KKyAgICBMVk1fSU5UMTYgVm9sdW1lID0gMDsgLyogUmVxdWlyZWQgdm9sdW1lIGluIGRCcyAqLworICAgIExWTV9GTE9BVCBUZW1wOwogCiAgICAgLyoKICAgICAgKiBMaW1pdCB0aGUgZ2FpbiB0byB0aGUgbWF4aW11bSBhbGxvd2VkCiAgICAgICovCi0gICAgIGlmICAocFBhcmFtcy0+VkNfRWZmZWN0TGV2ZWwgPiAwKQotIC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G9wZV9TZXRUaW1lQ29uc3RhbnQoJnBJbnN0YW5jZS0+VkNfVm9sdW1lLk1peGVyU3RyZWFtWzBdLCBMVk1fVkNfTUlYRVJfVElNRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPlBhcmFtcy5TYW1wbGVSYXRlLCAyKTsKICAgICB9CiB9CiAKQEAgLTQ1Myw0MyArMzk3LDM5IEBACiAvKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkICAgIExWTV9TZXRIZWFkcm9vbShMVk1fSW5zdGFuY2VfdCAgICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICBMVk1fQ29udHJvbFBhcmFtc190ICAgICpwUGFyYW1zKQotewotICAgIExWTV9JTlQxNiAgIGlpLCBqajsKLSAgICBMVk1fSU5UMTYgICBIZWFkcm9vbSA9IDA7Ci0gICAgTFZNX0lOVDE2ICAgTWF4R2FpbiA9IDA7Cit2b2lkIExWTV9TZXRIZWFkcm9vbShMVk1fSW5zdGFuY2VfdCogcEluc3RhbmNlLCBMVk1fQ29udHJvbFBhcmFtc190KiBwUGFyYW1zKSB7CisgICAgTFZNX0lOVDE2IGlpLCBqajsKKyAgICBMVk1fSU5UMTYgSGVhZHJvb20gPSAwOworICAgIExWTV9JTlQxNiBNYXhHYWluID0gMDsKIAotICAgIGlmICgoKExWRVFOQl9Nb2RlX2VuKXBQYXJhbXMtPkVRTkJfT3BlcmF0aW5nTW9kZSA9PSBMVkVRTkJfT04pCi0gICAgICAgICAgICYmIChwSW5zdGFuY2UtPkhlYWRyb29tUGFyYW1zLkhlYWRyb29tX09wZXJhdGluZ01vZGUgPT0gTFZNX0hFQURST09NX09OKSkKLSAgICB7CisgICAgaWYgKCgoTFZFUU5CX01vZGVfZW4pcFBhcmFtcy0+RVFOQl9PcGVyYXRpbmdNb2RlID09IExWRVFOQl9PTikgJiYKKyAgICAgICAgKHBJbnN0YW5jZS0+SGVhZHJvb21QYXJhbXMuSGVhZHJvb21fT3BlcmF0aW5nTW9kZSA9PSBMVk1fSEVBRFJPT01fT04pKSB7CiAgICAgICAgIC8qIEZpbmQgdHlwaWNhbCBoZWFkcm9vbSB2YWx1ZSAqLwotICAgICAgICBmb3IoamogPSAwOyBqaiA8IHBJbnN0YW5jZS0+SGVhZHJvb21QYXJhbXMuTkhlYWRyb29tQmFuZHM7IGpqKyspCi0gICAgICAgIHsKKyAgICAgICAgZm9yIChqaiA9IDA7IGpqIDwgcEluc3RhbmNlLT5IZWFkcm9vbVBhcmFtcy5OSGVhZHJvb21CYW5kczsgamorKykgewogICAgICAgICAgICAgTWF4R2FpbiA9IDA7Ci0gICAgICAgICAgICBmb3IoIGlpID0gMDsgaWkgPCBwUGFyYW1zLT5FUU5CX05CYW5kczsgaWkrKykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZigocFBhcmFtcy0+cEVRTkJfQmFuZERlZmluaXRpb25baWldLkZyZXF1ZW5jeSA+PSBwSW5zdGFuY2UtPkhlYWRyb29tUGFyYW1zLnBIZWFkcm9vbURlZmluaXRpb25bampdLkxpbWl0X0xvdykgJiYKLSAgICAgICAgICAgICAgICAgICAocFBhcmFtcy0+cEVRTkJfQmFuZERlZmluaXRpb25baWldLkZyZXF1ZW5jeSA8PSBwSW5zdGFuY2UtPkhlYWRyb29tUGFyYW1zLnBIZWFkcm9vbURlZmluaXRpb25bampdLkxpbWl0X0hpZ2gpKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgaWYocFBhcmFtcy0+cEVRTkJfQmFuZERlZmluaXRpb25baWldLkdhaW4gPiBNYXhHYWluKQotICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICBmb3IgKGlpID0gMDsgaWkgPCBwUGFyYW1zLT5FUU5CX05CYW5kczsgaWkrKykgeworICAgICAgICAgICAgICAgIGlmICgocFBhcmFtcy0+cEVRTkJfQmFuZERlZmluaXRpb25baWldLkZyZXF1ZW5jeSA+PQorICAgICAgICAgICAgICAgICAgICAgcEluc3RhbmNlLT5IZWFkcm9vbVBhcmFtcy5wSGVhZHJvb21EZWZpbml0aW9uW2pqXS5MaW1pdF9Mb3cpICYmCisgICAgICAgICAgICAgICAgICAgIChwUGFyYW1zLT5wRVFOQl9CYW5kRGVmaW5pdGlvbltpaV0uRnJlcXVlbmN5IDw9CisgICAgICAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPkhlYWRyb29tUGFyYW1zLnBIZWFkcm9vbURlZmluaXRpb25bampdLkxpbWl0X0hpZ2gpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChwUGFyYW1zLT5wRVFOQl9CYW5kRGVmaW5pdGlvbltpaV0uR2FpbiA+IE1heEdhaW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIE1heEdhaW4gPSBwUGFyYW1zLT5wRVFOQl9CYW5kRGVmaW5pdGlvbltpaV0uR2FpbjsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgaWYoKE1heEdhaW4gLSBwSW5zdGFuY2UtPkhlYWRyb29tUGFyYW1zLnBIZWFkcm9vbURlZmluaXRpb25bampdLkhlYWRyb29tX09mZnNldCkgPiBIZWFkcm9vbSl7Ci0gICAgICAgICAgICAgICAgSGVhZHJvb20gPSAoTFZNX0lOVDE2KShNYXhHYWluIC0gcEluc3RhbmNlLT5IZWFkcm9vbVBhcmFtcy5wSGVhZHJvb21EZWZpbml0aW9uW2pqXS5IZWFkcm9vbV9PZmZzZXQpOworICAgICAgICAgICAgaWYgKChNYXhHYWluIC0gcEluc3RhbmNlLT5IZWFkcm9vbVBhcmFtcy5wSGVhZHJvb21EZWZpbml0aW9uW2pqXS5IZWFkcm9vbV9PZmZzZXQpID4KKyAgICAgICAgICAgICAgICBIZWFkcm9vbSkgeworICAgICAgICAgICAgICAgIEhlYWRyb29tID0gKExWTV9JTlQxNikoCisgICAgICAgICAgICAgICAgICAgICAgICBNYXhHYWluIC0KKyAgICAgICAgICAgICAgICAgICAgICAgIHBJbnN0YW5jZS0+SGVhZHJvb21QYXJhbXMucEhlYWRyb29tRGVmaW5pdGlvbltqal0uSGVhZHJvb21fT2Zmc2V0KTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCiAgICAgICAgIC8qIFNhdHVyYXRlICovCi0gICAgICAgIGlmKEhlYWRyb29tIDwgMCkKLSAgICAgICAgICAgIEhlYWRyb29tID0gMDsKKyAgICAgICAgaWYgKEhlYWRyb29tIDwgMCkgSGVhZHJvb20gPSAwOwogICAgIH0KLSAgICBwSW5zdGFuY2UtPkhlYWRyb29tID0gKExWTV9VSU5UMTYpSGVhZHJvb20gOwotCisgICAgcEluc3RhbmNlLT5IZWFkcm9vbSA9IChMVk1fVUlOVDE2KUhlYWRyb29tOwogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTUxMCwzMiArNDUwLDI2IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVk1fUmV0dXJuU3RhdHVz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gICAgICAgICAgICAgICAgJkxvY2FsUGFyYW1zKTsKKyAgICAgICAgKHBJbnN0YW5jZS0+UGFyYW1zLlNwZWFrZXJUeXBlICE9IExvY2FsUGFyYW1zLlNwZWFrZXJUeXBlKSkgeworICAgICAgICBMVk1fU2V0VHJlYmxlQm9vc3QocEluc3RhbmNlLCAmTG9jYWxQYXJhbXMpOwogICAgIH0KIAogICAgIC8qCiAgICAgICogVXBkYXRlIHRoZSBoZWFkcm9vbSBpZiByZXF1aXJlZAogICAgICAqLwotICAgICAgICBMVk1fU2V0SGVhZHJvb20ocEluc3RhbmNlLCAgICAgICAgICAgICAgICAgICAgICAvKiBJbnN0YW5jZSBwb2ludGVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAmTG9jYWxQYXJhbXMpOyAgICAgICAgICAgICAgICAgIC8qIE5ldyBwYXJhbWV0ZXJzICovCisgICAgTFZNX1NldEhlYWRyb29tKHBJbnN0YW5jZSwgICAgIC8qIEluc3RhbmNlIHBvaW50ZXIgKi8KKyAgICAgICAgICAgICAgICAgICAgJkxvY2FsUGFyYW1zKTsgLyogTmV3IHBhcmFtZXRlcnMgKi8KIAogICAgIC8qCiAgICAgICogVXBkYXRlIHRoZSB2b2x1bWUgaWYgcmVxdWlyZWQKICAgICAgKi8KICAgICB7Ci0gICAgICAgIExWTV9TZXRWb2x1bWUocEluc3RhbmNlLCAgICAgICAgICAgICAgICAgICAgICAvKiBJbnN0YW5jZSBwb2ludGVyICovCi0gICAgICAgICAgICAgICAgICAgICAgJkxvY2FsUGFyYW1zKTsgICAgICAgICAgICAgICAgICAvKiBOZXcgcGFyYW1ldGVycyAqLworICAgICAgICBMVk1fU2V0Vm9sdW1lKHBJbnN0YW5jZSwgICAgIC8qIEluc3RhbmNlIHBvaW50ZXIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAmTG9jYWxQYXJhbXMpOyAvKiBOZXcgcGFyYW1ldGVycyAqLwogICAgIH0KICAgICAvKiBBcHBseSBiYWxhbmNlI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gICAgICBMVkNfTWl4ZXJfVmFyU2xvcGVfU2V0VGltZUNvbnN0YW50KCZwSW5zdGFuY2UtPlZDX0JhbGFuY2VNaXguTWl4ZXJTdHJlYW1bMF0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9WQ19NSVhFUl9USU1FLExvY2FsUGFyYW1zLlNhbXBsZVJhdGUsIDEpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVkNfTUlYRVJfVElNRSwgTG9jYWxQYXJhbXMuU2FtcGxlUmF0ZSwgMSk7CiAKLSAgICAgICAgICAgIExWQ19NaXhlcl9TZXRUYXJnZXQoJnBJbnN0YW5jZS0+VkNfQmFsYW5jZU1peC5NaXhlclN0cmVhbVsxXSxUYXJnZXRfRmxvYXQpOworICAgICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldCgmcEluc3RhbmNlLT5WQ19CYWxhbmNlTWl4Lk1peGVyU3RyZWFtWzFdLCBUYXJnZXRfRmxvYXQpOwogICAgICAgICAgICAgTFZDX01peGVyX1ZhclNsb3BlX1NldFRpbWVDb25zdGFudCgmcEluc3RhbmNlLT5WQ19CYWxhbmNlTWl4Lk1peGVyU3RyZWFtWzFdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVkNfTUlYRVJfVElNRSxMb2NhbFBhcmFtcy5TYW1wbGVSYXRlLCAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1ZDX01JWEVSX1RJTUUsIExvY2FsUGFyYW1zLlNhbXBsZVJhdGUsIDEpOwogICAgICAgICB9CiAgICAgfQogICAgIC8qCiAgICAgICogVXBkYXRlIHRoZSBiYXNzIGVuaGFuY2VtZW50CiAgICAgICovCiAgICAgewotICAgICAgICBMVkRCRV9SZXR1cm5TdGF0dXNfZW4gICAgICAgREJFX1N0YXR1czsKLSAgICAgICAgTFZEQkVfUGFyYW1zX3QgICAgICAgICAgICAgIERCRV9QYXJhbXM7Ci0gICAgICAgIExWREJFX0hhbmRsZV90ICAgICAgICAgICAgICAqaERCRUluc3RhbmNlID0gKExWREJFX0hhbmRsZV90ICopcEluc3RhbmNlLT5oREJFSW5zdGFuY2U7CisgICAgICAgIExWREJFX1JldHVyblN0YXR1c19lbiBEQkVfU3RhdHVzOworICAgICAgICBMVkRCRV9QYXJhbXNfdCBEQkVfUGFyYW1zOworICAgICAgICBMVkRCRV9IYW5kbGVfdCogaERCRUluc3RhbmNlID0gKExWREJFX0hhbmRsZV90KilwSW5zdGFuY2UtPmhEQkVJbnN0YW5jZTsKIAogICAgICAgICAvKgogICAgICAgICAgKiBTZXQgdGhlIG5ldyBwYXJhbWV0ZXJzCiAgICAgICAgICAqLwotICAgICAgICBpZihMb2NhbFBhcmFtcy5PcGVyYXRpbmdNb2RlID09IExWTV9NT0RFX09GRikKLSAgICAgICAgeworICAgICAgICBpZiAoTG9jYWxQYXJhbXMuT3BlcmF0aW5nTW9kZSA9PSBMVk1fTU9ERV9PRkYpIHsKICAgICAgICAgICAgIERCRV9QYXJhbXMuT3BlcmF0aW5nTW9kZSA9IExWREJFX09GRjsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIERCRV9QYXJhbXMuT3BlcmF0aW5nTW9kZSA9IChMVkRCRV9Nb2RlX2VuKUxvY2FsUGFyYW1zLkJFX09wZXJhdGluZ01vZGU7CiAgICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICBEQkVfUGFyYW1zLk9wZXJhdGluZ01vZGUgICAgPSAoTFZEQkVfTW9kZV9lbilMb2NhbFBhcmFtcy5CRV9PcGVyYXRpbmdNb2RlOwotICAgICAgICB9Ci0gICAgICAgIERCRV9QYXJhbXMuU2FtcGxlUmF0ZSAgICAgICA9IChMVkRCRV9Gc19lbilMb2NhbFBhcmFtcy5TYW1wbGVSYXRlOwotIC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UNvbnRyb2wgPSBMVkRCRV9WT0xVTUVfT0ZGOworICAgICAgICBEQkVfUGFyYW1zLlZvbHVtZWRCID0gMDsKKyAgICAgICAgREJFX1BhcmFtcy5OckNoYW5uZWxzID0gTG9jYWxQYXJhbXMuTnJDaGFubmVsczsKIAogICAgICAgICAvKgogICAgICAgICAgKiBNYWtlIHRoZSBjaGFuZ2VzCiAgICAgICAgICAqLwotICAgICAgICBEQkVfU3RhdHVzID0gTFZEQkVfQ29udHJvbChoREJFSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZEQkVfUGFyYW1zKTsKKyAgICAgICAgREJFX1N0YXR1cyA9IExWREJFX0NvbnRyb2woaERCRUluc3RhbmNlLCAmREJFX1BhcmFtcyk7CiAKICAgICAgICAgLyoKICAgICAgICAgICogUXVpdCBpZiB0aGUgY2hhbmdlcyB3ZXJlIG5vdCBhY2NlcHRlZAogICAgICAgICAgKi8KLSAgICAgICAgaWYgKERCRV9TdGF0dXMgIT0gTFZEQkVfU1VDQ0VTUykKLSAgICAgICAgewotICAgICAgICAgICAgcmV0dXJuKChMVk1fUmV0dXJuU3RhdHVzX2VuKURCRV9TdGF0dXMpOworICAgICAgICBpZiAoREJFX1N0YXR1cyAhPSBMVkRCRV9TVUNDRVNTKSB7CisgICAgICAgICAgICByZXR1cm4gKChMVk1fUmV0dXJuU3RhdHVzX2VuKURCRV9TdGF0dXMpOwogICAgICAgICB9CiAKICAgICAgICAgLyoKQEAgLTY2NiwxNjggKzU4NSwxMzIgQEAKICAgICAgKiBVcGRhdGUgdGhlIE4tQmFuZCBFcXVhbGlzZXIKICAgICAgKi8KICAgICB7Ci0gICAgICAgIExWRVFOQl9SZXR1cm5TdGF0dXNfZW4gICAgICBFUU5CX1N0YXR1czsKLSAgICAgICAgTFZFUU5CX1BhcmFtc190ICAgICAgICAgICAgIEVRTkJfUGFyYW1zOwotICAgICAgICBMVkVRTkJfSGFuZGxlX3QgICAgICAgICAgICAg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KSB7CiAgICAgICAgICAgICBwSW5zdGFuY2UtPkVRTkJfQWN0aXZlID0gTFZNX1RSVUU7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7CisgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICBFUU5CX1BhcmFtcy5PcGVyYXRpbmdNb2RlID0gTFZFUU5CX0JZUEFTUzsKICAgICAgICAgfQogCiAgICAgICAgIC8qCiAgICAgICAgICAqIE1ha2UgdGhlIGNoYW5nZXMKICAgICAgICAgICovCi0gICAgICAgIEVRTkJfU3RhdHVzID0gTFZFUU5CX0NvbnRyb2woaEVRTkJJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmRVFOQl9QYXJhbXMpOworICAgICAgICBFUU5CX1N0YXR1cyA9IExWRVFOQl9Db250cm9sKGhFUU5CSW5zdGFuY2UsICZFUU5CX1BhcmFtcyk7CiAKICAgICAgICAgLyoKICAgICAgICAgICogUXVpdCBpZiB0aGUgY2hhbmdlcyB3ZXJlIG5vdCBhY2NlcHRlZAogICAgICAgICAgKi8KLSAgICAgICAgaWYgKEVRTkJfU3RhdHVzICE9IExWRVFOQl9TVUNDRVNTKQotICAgICAgICB7Ci0gICAgICAgICAgICByZXR1cm4oKExWTV9SZXR1cm5TdGF0dXNfZW4pRVFOQl9TdGF0dXMpOworICAgICAgICBpZiAoRVFOQl9TdGF0dXMgIT0gTFZFUU5CX1NVQ0NFU1MpIHsKKyAgICAgICAgICAgIHJldHVybiAoKExWTV9SZXR1cm5TdGF0dXNfZW4pRVFOQl9TdGF0dXMpOwogICAgICAgICB9Ci0KICAgICB9CiAKICAgICAvKgogICAgICAqIFVwZGF0ZSBjb25jZXJ0IHNvdW5kCiAgICAgICovCiAgICAgewotICAgICAgICBMVkNTX1JldHVyblN0YXR1c19lbiAgICAgICAgQ1NfU3RhdHVzOwotICAgICAgICBMVkNTX1BhcmFtc190ICAgICAgICAgICAgICAgQ1NfUGFyYW1zOwotICAgICAgICBMVkNTX0hhbmRsZV90ICAgICAgICAgICAgICAgKmhDU0luc3RhbmNlID0gKExWQ1NfSGFuZGxlX3QgKilwSW5zdGFuY2UtPmhDU0luc3RhbmNlOwotICAgICAgICBMVk1fTW9kZV9lbiAgICAgICAgICAgICAgICAgQ29tcHJlc3Nvck1vZGU9TFZNX01PREVfT047CisgICAgICAgIExWQ1NfUmV0dXJuU3RhdHVzX2VuIENTX1N0YXR1czsKKyAgICAgICAgTFZDU19QYXJhbXNfdCBDU19QYXJhbXM7CisgICAgICAgIExWQ1NfSGFuZGxlX3QqIGhDU0luc3RhbmNlID0gKExWQ1NfSGFuZGxlX3QqKXBJbnN0YW5jZS0+aENTSW5zdGFuY2U7CisgICAgICAgIExWTV9Nb2RlX2VuIENvbXByZXNzb3JNb2RlID0gTFZNX01PREVfT047CiAKICAgICAgICAgLyoKICAgICAgICAgICogU2V0IHRoZSBuZXcgcGFyYW1ldGVycwogICAgICAgICAgKi8KLSAgICAgICAgaWYoTG9jYWxQYXJhbXMuVmlydHVhbGl6ZXJPcGVyYXRpbmdNb2RlID09IExWTV9NT0RFX09OKQotICAgICAgICB7Ci0gICAgICAgICAgICBDU19QYXJhbXMuT3BlcmF0aW5nTW9kZSAgICA9IExWQ1NfT047Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICBDU19QYXJhbXMuT3BlcmF0aW5nTW9kZSAgICA9IExWQ1NfT0ZGOworICAgICAgICBpZiAoTG9jYWxQYXJhbXMuVmlydHVhbGl6ZXJPcGVyYXRpbmdNb2RlID09IExWTV9NT0RFX09OKSB7CisgICAgICAgICAgICBDU19QYXJhbXMuT3BlcmF0aW5nTW9kZSA9IExWQ1NfT047CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBDU19QYXJhbXMuT3BlcmF0aW5nTW9kZSA9IExWQ1NfT0ZGOwogICAgICAgICB9CiAKLSAgICAgICAgaWYoKExvY2FsUGFyYW1z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xzID0gTG9jYWxQYXJhbXMuTnJDaGFubmVsczsKIAogICAgICAgICAvKgogICAgICAgICAgKiBTZXQgdGhlIGNvbnRyb2wgZmxhZwogICAgICAgICAgKi8KICAgICAgICAgaWYgKCgoTFZNX01vZGVfZW4pTG9jYWxQYXJhbXMuT3BlcmF0aW5nTW9kZSA9PSBMVk1fTU9ERV9PTikgJiYKLSAgICAgICAgICAgICgoTFZDU19Nb2Rlc19lbilMb2NhbFBhcmFtcy5WaXJ0dWFsaXplck9wZXJhdGluZ01vZGUgIT0gTFZDU19PRkYpKQotICAgICAgICB7CisgICAgICAgICAgICAoKExWQ1NfTW9kZXNfZW4pTG9jYWxQYXJhbXMuVmlydHVhbGl6ZXJPcGVyYXRpbmdNb2RlICE9IExWQ1NfT0ZGKSkgewogICAgICAgICAgICAgcEluc3RhbmNlLT5DU19BY3RpdmUgPSBMVk1fVFJVRTsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIENTX1BhcmFtcy5PcGVyYXRpbmdNb2RlID0gTFZDU19PRkY7CiAgICAgICAgIH0KIAotICAgICAgICBDU19QYXJhbXMuQ29tcHJlc3Nvck1vZGU9Q29tcHJlc3Nvck1vZGU7CisgICAgICAgIENTX1BhcmFtcy5Db21wcmVzc29yTW9kZSA9IENvbXByZXNzb3JNb2RlOwogCiAgICAgICAgIC8qCiAgICAgICAgICAqIE1ha2UgdGhlIGNoYW5nZXMKICAgICAgICAgICovCi0gICAgICAgIENTX1N0YXR1cyA9IExWQ1NfQ29udHJvbChoQ1NJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZDU19QYXJhbXMpOworICAgICAgICBDU19TdGF0dXMgPSBMVkNTX0NvbnRyb2woaENTSW5zdGFuY2UsICZDU19QYXJhbXMpOwogCiAgICAgICAgIC8qCiAgICAgICAgICAqIFF1aXQgaWYgdGhlIGNoYW5nZXMgd2VyZSBub3QgYWNjZXB0ZWQKICAgICAgICAgICovCi0gICAgICAgIGlmIChDU19TdGF0dXMgIT0gTFZDU19TVUNDRVNTKQotICAgICAgICB7Ci0gICAgICAgICAgICByZXR1cm4oKExWTV9SZXR1cm5TdGF0dXNfZW4pQ1NfU3RhdHVzKTsKKyAgICAgICAgaWYgKENTX1N0YXR1cyAhPSBMVkNTX1NVQ0NFU1MpIHsKKyAgICAgICAgICAgIHJldHVybiAoKExWTV9SZXR1cm5TdGF0dXNfZW4pQ1NfU3RhdHVzKTsKICAgICAgICAgfQotCiAgICAgfQogCiAgICAgLyoKICAgICAgKiBVcGRhdGUgdGhlIFBvd2VyIFNwZWN0cnVtIEFuYWx5c2VyCiAgICAgICovCiAgICAgewotICAgICAgICBMVlBTQV9SRVRVUk4gICAgICAgICAgICAgICAgUFNBX1N0YXR1czsKLSAgICAgICAgTFZQU0FfQ29udHJvbFBhcmFtc190ICAgICAgIFBTQV9QYXJhbXM7Ci0gICAgICAgIHBMVlBTQV9IYW5kbGVfdCAgICAgICAgICAgICAqaFBTQUluc3RhbmNlID0gKHBMVlBTQV9IYW5kbGVfdCAqKXBJbnN0YW5jZS0+aFBTQUluc3RhbmNlOworICAgICAgICBMVlBTQV9SRVRVUk4gUFNBX1N0YXR1czsKKyAgICAgICAgTFZQU0FfQ29udHJvbFBhcmFtc190IFBTQV9QYXJhbXM7CisgICAgICAgIHBMVlBTQV9IYW5kbGVfdCogaFBTQUluc3RhbmNlID0gKHBMVlBTQV9IYW5kbGVfdCopcEluc3RhbmNlLT5oUFNBSW5zdGFuY2U7CiAKICAgICAgICAgLyoKICAgICAgICAgICogU2V0IHRoZSBuZXcgcGFyYW1ldGVycwpAQCAtODM4LDIzICs3MjEsMTkgQEAKICAgICAgICAgLyoKICAgICAgICAgICogTWFrZSB0aGUgY2hhbmdlcwogICAgICAgICAgKi8KLSAgICAgICAgaWYocEluc3RhbmNlLT5JbnN0UGFyYW1zLlBTQV9JbmNsdWRlZD09TFZNX1BTQV9PTikKLSAgICAgICAgewotICAgICAgICAgICAgUFNBX1N0YXR1cyA9IExWUFNBX0NvbnRyb2woaFBTQUluc3RhbmNlLAotICAgICAgICAgICAgICAgICZQU0FfUGFyYW1zKTsKKyAgICAgICAgaWYgKHBJbnN0YW5jZS0+SW5zdFBhcmFtcy5QU0FfSW5jbHVkZWQgPT0gTFZNX1BTQV9PTikgeworICAgICAgICAgICAgUFNBX1N0YXR1cyA9IExWUFNBX0NvbnRyb2woaFBTQUluc3RhbmNlLCAmUFNBX1BhcmFtcyk7CiAKLSAgICAgICAgICAgIGlmIChQU0FfU3RhdHVzICE9IExWUFNBX09LKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHJldHVybigoTFZNX1JldHVyblN0YXR1c19lbilQU0FfU3RhdHVzKTsKKyAgICAgICAgICAgIGlmIChQU0FfU3RhdHVzICE9IExWUFNBX09LKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuICgoTFZNX1JldHVyblN0YXR1c19lbilQU0FfU3RhdHVzKTsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIEFwcGx5IG5ldyBzZXR0aW5ncwogICAgICAgICAgICAgICovCi0gICAgICAgICAgICBQU0FfU3RhdHVzID0gTFZQU0FfQXBwbHlOZXdTZXR0aW5ncyAoKExWUFNBX0luc3RhbmNlUHJfdCopaFBTQUluc3RhbmNlKTsKLSAgICAgICAgICAgIGlmKFBTQV9TdGF0dXMgIT0gTFZQU0FfT0spCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuKChMVk1fUmV0dXJuU3RhdHVzX2VuKVBTQV9TdGF0dXMpOworICAgICAgICAgICAgUFNBX1N0YXR1cyA9IExWUFNBX0FwcGx5TmV3U2V0dGluZ3MoKExWUFNBX0luc3RhbmNlUHJfdCopaFBTQUluc3RhbmNlKTsKKyAgICAgICAgICAgIGlmIChQU0FfU3RhdHVzICE9IExWUFNBX09LKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuICgoTFZNX1JldHVyblN0YXR1c19lbilQU0FfU3RhdHVzKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KQEAgLTg2Myw5ICs3NDIsOSBAQAogICAgICAqIFVwZGF0ZSB0aGUgcGFyYW1ldGVycyBhbmQgY2xlYXIgdGhlIGZsYWcKICAgICAgKi8KICAgICBwSW5zdGFuY2UtPk5vU21vb3RoVm9sdW1lID0gTFZNX0ZBTFNFOwotICAgIHBJbnN0YW5jZS0+UGFyYW1zID0gIExvY2FsUGFyYW1zOworICAgIHBJbnN0YW5jZS0+UGFyYW1zID0gTG9jYWxQYXJhbXM7CiAKLSAgICByZXR1cm4oTFZNX1NVQ0NFU1MpOworICAgIHJldHVybiAoTFZNX1NVQ0NFU1MpOwogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTg4NywzNiArNzY2LDMwIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9TZXRIZWFkcm9vbVBhcmFtcyhMVk1fSGFuZGxlX3QgICAgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9IZWFkcm9vbVBhcmFtc190ICAgICAgKnBIZWFkcm9vbVBhcmFtcykKLXsKLSAgICBMVk1fSW5zdGFuY2VfdCAgICAgICpwSW5zdGFuY2UgPShMVk1fSW5zdGFuY2VfdCAgKiloSW5zdGFuY2U7Ci0gICAgTFZNX1VJTlQxNiAgICAgICAgICBpaSwgTkJhbmRzOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fU2V0SGVhZHJvb21QYXJhbXMoTFZNX0hhbmRsZV90IGhJbnN0YW5jZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9IZWFkcm9vbVBhcmFtc190KiBwSGVhZHJvb21QYXJhbXMpIHsKKyAgICBMVk1fSW5zdGFuY2VfdCogcEluc3RhbmNlID0gKExWTV9JbnN0YW5jZV90KiloSW5zdGFuY2U7CisgICAgTFZNX1VJTlQxNiBpaSwgTkJhbmRzOwogCiAgICAgLyogQ2hlY2sgZm9yIE5VTEwgcG9pbnRlcnMgKi8KLSAgICBpZiAoKGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkgfHwgKHBIZWFkcm9vbVBhcmFtcyA9PSBMVk1fTlVMTCkpCi0gICAgeworICAgIGlmICgoaEluc3RhbmNlID09IExWTV9OVUxMKSB8fCAocEhlYWRyb29tUGFyYW1zID09IExWTV9OVUxMKSkgewogICAgICAgICByZXR1cm4gKExWTV9OVUxMQUREUkVTUyk7CiAgICAgfQotICAgIGlmICgocEhlYWRyb29tUGFyYW1zLT5OSGVhZHJvb21CYW5kcyAhPSAwKSAmJiAocEhlYWRyb29tUGFyYW1zLT5wSGVhZHJvb21EZWZpbml0aW9uID09IExWTV9OVUxMKSkKLSAgICB7CisgICAgaWYgKChwSGVhZHJvb21QYXJhbXMtPk5IZWFkcm9vbUJhbmRzICE9IDApICYmCisgICAgICAgIChwSGVhZHJvb21QYXJhbXMtPnBIZWFkcm9vbURlZmluaXRpb24gPT0gTFZNX05VTEwpKSB7CiAgICAgICAgIHJldHVybiAoTFZNX05VTExBRERSRVNTKTsKICAgICB9CiAKICAgICAvKiBDb25zaWRlciBvbmx5IHRoZSBMVk1fSEVBRFJPT01fTUFYX05CQU5EUyBmaXJzdCBiYW5kcyovCi0gICAgaWYgKHBIZWFkcm9vbVBhcmFtcy0+TkhlYWRyb29tQmFuZHMgPiBMVk1fSEVBRFJPT01fTUFYX05CQU5EUykKLSAgICB7CisgICAgaWYgKHBIZWFkcm9vbVBhcmFtcy0+TkhlYWRyb29tQmFuZHMgPiBMVk1fSEVBRFJPT01fTUFYX05CQU5EUykgewogICAgICAgICBOQmFuZHMgPSBMVk1fSEVBRFJPT01fTUFYX05CQU5EUzsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKKyAgICB9IGVsc2UgewogICAgICAgICBOQmFuZHMgPSBwSGVhZHJvb21QYXJhbXMtPk5IZWFkcm9vbUJhbmRzOwogICAgIH0KICAgICBwSW5zdGFuY2UtPk5ld0hlYWRyb29tUGFyYW1zLk5IZWFkcm9vbUJhbmRzID0gTkJhbmRzOwogCiAgICAgLyogQ29weSBzZXR0aW5ncyBpbiBtZW1vcnkgKi8KLSAgICBmb3IoaWkgPSAwOyBpaSA8IE5CYW5kczsgaWkrKykKLSAgICB7CisgICAgZm9yIChpaSA9IDA7IGlpIDwgTkJhbmRzOyBpaSsrKSB7CiAgICAgICAgIHBJbnN0YW5jZS0+cEhlYWRyb29tX0JhbmREZWZzW2lpXSA9IHBIZWFkcm9vbVBhcmFtcy0+cEhlYWRyb29tRGVmaW5pdGlvbltpaV07CiAgICAgfQogCkBAIC05MjQsNyArNzk3LDcgQEAKICAgICBwSW5zdGFuY2UtPk5ld0hlYWRyb29tUGFyYW1zLkhlYWRyb29tX09wZXJhdGluZ01vZGUgPSBwSGVhZHJvb21QYXJhbXMtPkhlYWRyb29tX09wZXJhdGluZ01vZGU7CiAgICAgcEluc3RhbmNlLT5Db250cm9sUGVuZGluZyA9IExWTV9UUlVFOwogCi0gICAgcmV0dXJuKExWTV9TVUNDRVNTKTsKKyAgICByZXR1cm4gKExWTV9TVUNDRVNTKTsKIH0KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCkBAIC05NDcsMjkgKzgyMCwyNiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0SGVhZHJvb21QYXJhbXMoTFZNX0hhbmRsZV90ICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9IZWFkcm9vbVBhcmFtc190ICAqcEhlYWRyb29tUGFyYW1zKQotewotICAgIExWTV9JbnN0YW5jZV90ICAgICAgKnBJbnN0YW5jZSA9KExWTV9JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLSAgICBMVk1fVUlOVDE2ICAgICAgICAgIGlpOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0SGVhZHJvb21QYXJhbXMoTFZNX0hhbmRsZV90IGhJbnN0YW5jZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9IZWFkcm9vbVBhcmFtc190KiBwSGVhZHJvb21QYXJhbXMpIHsKKyAgICBMVk1fSW5zdGFuY2VfdCogcEluc3RhbmNlID0gKExWTV9JbnN0YW5jZV90KiloSW5zdGFuY2U7CisgICAgTFZNX1VJTlQxNiBpaTsKIAogICAgIC8qIENoZWNrIGZvciBOVUxMIHBvaW50ZXJzICovCi0gICAgaWYgKChoSW5zdGFuY2UgPT0gTFZNX05VTEwpIHx8IChwSGVhZHJvb21QYXJhbXMgPT0gTFZNX05VTEwpKQotICAgIHsKKyAgICBpZiAoKGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkgfHwgKHBIZWFkcm9vbVBhcmFtcyA9PSBMVk1fTlVMTCkpIHsKIC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ICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVk1fSU5UMzIgTFZNX0FsZ29DYWxsQmFjayggdm9pZCAgICAgICAgICAqcEJ1bmRsZUhhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICAgICpwRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgIGNhbGxiYWNrSWQpCi17Ci0gICAgTFZNX0luc3RhbmNlX3QgICAgICAqcEluc3RhbmNlID0oTFZNX0luc3RhbmNlX3QgICopcEJ1bmRsZUhhbmRsZTsKK0xWTV9JTlQzMiBMVk1fQWxnb0NhbGxCYWNrKHZvaWQqIHBCdW5kbGVIYW5kbGUsIHZvaWQqIHBEYXRhLCBMVk1fSU5UMTYgY2FsbGJhY2tJZCkgeworICAgIExWTV9JbnN0YW5jZV90KiBwSW5zdGFuY2UgPSAoTFZNX0luc3RhbmNlX3QqKXBCdW5kbGVIYW5kbGU7CiAKLSAgICAodm9pZCkgcERhdGE7CisgICAgKHZvaWQpcERhdGE7CiAKLSAgICBzd2l0Y2goY2FsbGJhY2tJZCAmIDB4RkYwMCl7CisgICAgc3dpdGNoIChjYWxsYmFja0lkICYgMHhGRjAwKSB7CiAgICAgICAgIGNhc2UgQUxHT1JJVEhNX0NTX0lEOgotICAgICAgICAgICAgc3dpdGNoKGNhbGxiYWNrSWQgJiAweDAwRkYpCi0gICAgICAgICAgICB7CisgICAgICAgICAgICBzd2l0Y2ggKGNhbGxiYWNrSWQgJiAweDAwRkYpIHsKICAgICAgICAgICAgICAgICBjYXNlIExWQ1NfRVZFTlRfQUxHT0ZGOgogICAgICAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPkNTX0FjdGl2ZSA9IExWTV9GQUxTRTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CkBAIC0xMDA4LDggKzg3NCw3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgY2FzZSBBTEdPUklUSE1fRVFOQl9JRDoKLSAgICAgICAgICAgIHN3aXRjaChjYWxsYmFja0lkICYgMHgwMEZGKQotICAgICAgICAgICAgeworICAgICAgICAgICAgc3dpdGNoIChjYWxsYmFja0lkICYgMHgwMEZGKSB7CiAgICAgICAgICAgICAgICAgY2FzZSBMVkVRTkJfRVZFTlRfQUxHT0ZGOgogICAgICAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPkVRTkJfQWN0aXZlID0gTFZNX0ZBTFNFOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTEwNDAsMjEgKzkwNSwxNyBAQAogLyogIDEuICBUaGlzIGZ1bmN0aW9uIG1heSBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZNX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZNX0lOVDMyICAgIExWTV9WQ0NhbGxCYWNrKHZvaWQqICAgcEJ1bmRsZUhhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkKiAgIHBHZW5lcmFsUHVycG9zZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG9ydCAgIENhbGxCYWNrUGFyYW0pCi17Ci0gICAgTFZNX0luc3RhbmNlX3QgKnBJbnN0YW5jZSA9KExWT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GliZWZmZWN0cy9sdm0vbGliL0J1bmRsZS9zcmMvTFZNX0luaXQuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CdW5kbGUvc3JjL0xWTV9Jbml0LmNwcApAQCAtMjAsNTc4ICsyMCw5NSBAQAogLyogIEluY2x1ZGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworI2luY2x1ZGUgPHN0ZGxpYi5oPgogCiAjaW5jbHVkZSAiTFZNX1ByaXZhdGUuaCIKICNpbmNsdWRlICJMVk1fVGFibGVzLmgiCiAjaW5jbHVkZSAiVmVjdG9yQXJpdGhtZXRpYy5oIgotI2luY2x1ZGUgIkluc3RBbGxvYy5oIgotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgIExWTV9HZXRNZW1vcnlUYWJsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCBmb3IgbWVtb3J5IGFsbG9jYXRpb24gYW5kIGZyZWUuIEl0IGNhbiBiZSBjYWxsZWQgaW4gICAgICAgICAgICovCi0vKiAgdHdvIHdheXM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICBoSW5zdGFuY2UgPSBOVUxMICAgICAgICAgICAgICAgIFJldHVybnMgdGhlIG1lbW9yeSByZXF1aXJlbWVudHMgICAgICAgICAgICAgICAgICovCi0vKiAgICAgIGhJbnN0YW5jZSA9IEluc3RhbmNlIGhhbmRsZSAgICAgUmV0dXJucyB0aGUgbWVtb3J5IHJlcXVpcmVtZW50cyBhbmQgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxvY2F0ZWQgYmFzZSBhZGRyZXNzZXMgZm9yIHRoZSBpbnN0YW5jZSAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgV2hlbiB0aGlzIGZ1bmN0aW9uIGlzIGNhbGxlZCBmb3IgbWVtb3J5IGFsbG9jYXRpb24gKGhJbnN0YW5jZT1OVUxMKSB0aGUgbWVtb3J5ICAgICAgKi8KLS8qICBiYXNlIGFkZHJlc3MgcG9pbnRlcnMgYXJlIE5VTEwgb24gcmV0dXJuLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgV2hlbiB0aGUgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciBmcmVlIChoSW5zdGFuY2UgPSBJbnN0YW5jZSBIYW5kbGUpIHRoZSBtZW1vcnkgICAgICAgKi8KLS8qICB0YWJsZSByZXR1cm5zIHRoZSBhbGxvY2F0ZWQgbWVtb3J5IGFuZCBiYXNlIGFkZHJlc3NlcyB1c2VkIGR1cmluZyBpbml0aWFsaXNhdGlvbi4gICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2UgICAgICAgICAgICAgICBJbnN0YW5jZSBIYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBNZW1vcnlUYWJsZSAgICAgICAgICAgIFBvaW50ZXIgdG8gYW4gZW1wdHkgbWVtb3J5IGRlZmluaXRpb24gdGFibGUgICAgICAgICAgICAgICAgICovCi0vKiAgcENhcGFiaWxpdGllcyAgICAgICAgICAgUG9pbnRlciB0byB0aGUgZGVmYXVsdCBjYXBhYmlsaXRpZXMgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZNX1NVQ0NFU1MgICAgICAgICAgICAgU3VjY2VlZGVkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBMVk1fTlVMTEFERFJFU1MgICAgICAgICBXaGVuIG9uZSBvZiBwTWVtb3J5VGFibGUgb3IgcEluc3RQYXJhbXMgaXMgTlVMTCAgICAgICAgICAgICAqLwotLyogIExWTV9PVVRPRlJBTkdFICAgICAgICAgIFdoZW4gYW55IG9mIHRoZSBJbnN0YW5jZSBwYXJhbWV0ZXJzIGFyZSBvdXQgb2YgcmFuZ2UgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIDEuICBUaGlzIGZ1bmN0aW9uIG1heSBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZNX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICAgICAgICovCi0vKiAgMi4gIFRoZSBzY3JhdGNoIG1lbW9yeSBpcyB0aGUgbGFyZ2VzdCByZXF1aXJlZCBieSBhbnkgb2YgdGhlIHN1Yi1tb2R1bGVzIHBsdXMgYW55ICAgKi8KLS8qICAgICAgYWRkaXRpb25hbCBzY3JhdGNoIHJlcXVpcmVtZW50cyBvZiB0aGUgYnVuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotLyoKLSAqIDQg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cmVxdWlyZW1lbnRzCi0gICAgICovCi0gICAgQWxnU2NyYXRjaFNpemUgICAgPSAwOwotICAgIGlmIChwSW5zdFBhcmFtcy0+QnVmZmVyTW9kZSA9PSBMVk1fTUFOQUdFRF9CVUZGRVJTKQotICAgIHsKLSAgICAgICAgQnVuZGxlU2NyYXRjaFNpemUgPSAzICogTFZNX01BWF9DSEFOTkVMUyBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKiAoTUlOX0lOVEVSTkFMX0JMT0NLU0laRSArIEludGVybmFsQmxvY2tTaXplKSBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBzaXplb2YoTFZNX0ZMT0FUKTsKLSAgICAgICAgSW5zdEFsbG9jX0FkZE1lbWJlcigmQWxsb2NNZW1bTFZNX01FTVJFR0lPTl9URU1QT1JBUllfRkFTVF0sICAgICAgICAvKiBTY3JhdGNoIGJ1ZmZlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJ1bmRsZVNjcmF0Y2hTaXplKTsKLSAgICAgICAgSW5zdEFsbG9jX0FkZE1lbWJlcigmQWxsb2NNZW1bTFZNX01FTVJFR0lPTl9QRVJTSVNURU5UX1NMT1dfREFUQV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKExWTV9CdWZmZXJfdCkpOwotICAgIH0KLQotICAgIC8qCi0gICAgICogVHJlYmxlIEVuaGFuY2VtZW50IHJlcXVpcmVtZW50cwotICAgICAqLwotICAgIEluc3RBbGxvY19BZGRNZW1iZXIoJkFsbG9jTWVtW0xWTV9NRU1SRUdJT05fUEVSU0lTVEVOVF9GQVNUX0RBVEFdLAotICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKExWTV9URV9EYXRhX3QpKTsKLSAgICBJbnN0QWxsb2NfQWRkTWVtYmVyKCZBbGxvY01lbVtMVk1fTUVNUkVHSU9OX1BFUlNJU1RFTlRfRkFTVF9DT0VGXSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihMVk1fVEVfQ29lZnNfdCkpOwotCi0gICAgLyoKLSAgICAgKiBOLUJhbmQgRXF1YWxpemVyIHJlcXVpcmVtZW50cwotICAgICAqLwotICAgIEluc3RBbGxvY19BZGRNZW1iZXIoJkFsbG9jTWVtW0xWTV9NRU1SRUdJT05fUEVSU0lTVEVOVF9GQVNUX0RBVEFdLCAgICAgIC8qIExvY2FsIHN0b3JhZ2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIChwSW5zdFBhcmFtcy0+RVFOQl9OdW1CYW5kcyAqIHNpemVvZihMVk1fRVFOQl9CYW5kRGVmX3QpKSk7Ci0gICAgSW5zdEFsbG9jX0FkZE1lbWJlcigmQWxsb2NNZW1bTFZNX01FTVJFR0lPTl9QRVJTSVNURU5UX0ZBU1RfREFUQV0sICAgICAgLyogVXNlciBzdG9yYWdlICovCi0gICAgICAgICAgICAgICAgICAgICAgICAocEluc3RQYXJhbXMtPkVRTkJfTnVtQmFuZHMgKiBzaXplb2YoTFZNX0VRTkJfQmFuZERlZl90KSkpOwotCi0gICAgLyoKLSAgICAgKiBDb25jZXJ0IFNvdW5kIHJlcXVpcmVtZW50cwotICAgICAqLwotICAgIHsKLSAgICAgICAgTFZDU19NZW1UYWJfdCAgICAgICAgICAgQ1NfTWVtVGFiOwotICAgICAgICBMVkNTX0NhcGFiaWxpdGllc190ICAgICBDU19DYXBhYmlsaXRpZXM7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogU2V0IHRoZSBjYXBhYmlsaXRpZXMKLSAgICAgICAgICovCi0gICAgICAgIENTX0NhcGFiaWxpdGllcy5NYXhCbG9ja1NpemUgICAgID0gSW50ZXJuYWxCbG9ja1NpemU7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogR2V0IHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzCi0gICAgICAgICAqLwotICAgICAgICBMVkNTX01lbW9yeShMVk1fTlVMTCwKLSAgICAgICAgICAgICAgICAgICAgJkNTX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aWVzCi0gICAgICAgICAqLwotICAgICAgICBEQkVfQ2FwYWJpbGl0aWVzLlNhbXBsZVJhdGUgICAgICA9IExWREJFX0NBUF9GU184MDAwIHwgTFZEQkVfQ0FQX0ZTXzExMDI1IHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9DQVBfRlNfMTIwMDAgfCBMVkRCRV9DQVBfRlNfMTYwMDAgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX0NBUF9GU18yMjA1MCB8IExWREJFX0NBUF9GU18yNDAwMCB8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfQ0FQX0ZTXzMyMDAwIHwgTFZEQkVfQ0FQX0ZTXzQ0MTAwIHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9DQVBfRlNfNDgwMDAgfCBMVkRCRV9DQVBfRlNfODgyMDAgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX0NBUF9GU185NjAwMCB8IExWREJFX0NBUF9GU18xNzY0MDAgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX0NBUF9GU18xOTIwMDA7Ci0gICAgICAgIERCRV9DYXBhYmlsaXRpZXMuQ2VudHJlRnJlcXVlbmN5ID0gTFZEQkVfQ0FQX0NFTlRSRV81NUh6IHwgTFZEQkVfQ0FQX0NFTlRSRV81NUh6IHwgTFZEQkVfQ0FQX0NFTlRSRV82Nkh6IHwgTFZEQkVfQ0FQX0NFTlRSRV83OEh6IHwgTFZEQkVfQ0FQX0NFTlRSRV85MEh6OwotICAgICAgICBEQkVfQ2FwYWJpbGl0aWVzLk1heEJsb2NrU2l6ZSAgICA9IEludGVybmFsQmxvY2tTaXplOwotCi0gICAgICAgIC8qCi0gICAgICAgICAqIEdldCB0aGUgbWVtb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ICovCi0gICAgICAgIExWRVFOQl9DYXBhYmlsaXRpZXNfdCAgIEVRTkJfQ2FwYWJpbGl0aWVzOwotCi0gICAgICAgIC8qCi0gICAgICAgICAqIFNldCB0aGUgY2FwYWJpbGl0aWVzCi0gICAgICAgICAqLwotICAgICAgICBFUU5CX0NhcGFiaWxpdGllcy5TYW1wbGVSYXRlICAgPSBMVkVRTkJfQ0FQX0ZTXzgwMDAgfCBMVkVRTkJfQ0FQX0ZTXzExMDI1IHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0NBUF9GU18xMjAwMCB8IExWRVFOQl9DQVBfRlNfMTYwMDAgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQ0FQX0ZTXzIyMDUwIHwgTFZFUU5CX0NBUF9GU18yNDAwMCB8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9DQVBfRlNfMzIwMDAgfCBMVkVRTkJfQ0FQX0ZTXzQ0MTAwIHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0NBUF9GU180ODAwMCB8IExWRVFOQl9DQVBfRlNfODgyMDAgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQ0FQX0ZTXzk2MDAwIHwgTFZFUU5CX0NBUF9GU18xNzY0MDAgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQ0FQX0ZTXzE5MjAwMDsKLSAgICAgICAgRVFOQl9DYXBhYmlsaXRpZXMuU291cmNlRm9ybWF0ID0gTFZFUU5CX0NBUF9TVEVSRU8gfCBMVkVRTkJfQ0FQX01PTk9JTlNURVJFTzsKLSAgICAgICAgRVFOQl9DYXBhYmlsaXRpZXMuTWF4QmxvY2tTaXplID0gSW50ZXJuYWxCbG9ja1NpemU7Ci0gICAgICA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pemUgICAgICAgICAgICA9IChMVk1fVUlOVDE2KSAxMDAwOwotICAgICAgICAgICAgUFNBX0luaXRQYXJhbXMubkJhbmRzICAgICAgICAgICAgICAgICAgICAgICA9IChMVk1fVUlOVDE2KSA5OwotCi0gICAgICAgICAgICBQU0FfSW5pdFBhcmFtcy5wRmlsdGVyc1BhcmFtcyA9ICZGaWx0ZXJzUGFyYW1zWzBdOwotICAgICAgICAgICAgZm9yKGkgPSAwOyBpIDwgUFNBX0luaXRQYXJhbXMubkJhbmRzOyBpKyspCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgRmlsdGVyc1BhcmFtc1tpXS5DZW50ZXJGcmVxdWVuY3kgICAgPSAoTFZNX1VJTlQxNikgMTAwMDsKLSAgICAgICAgICAgICAgICBGaWx0ZXJzUGFyYW1zW2ldLlFGYWN0b3IgICAgICAgICAgICA9IChMVk1fVUlOVDE2KSAyNTsKLSAgICAgICAgICAgICAgICBGaWx0ZXJzUGFyYW1zW2ldLlBvc3RHYWluICAgICAgICAgICA9IChMVk1fSU5UMTYpICAwOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvKgotICAgICAgICAgICAgKiBHZXQgdGhlIG1lbW9yeSByZXF1aXJlbWVudHMKLSAgICAgICAgICAgICovCi0gICAgICAgICAgICBQU0FfU3RhdHVzID0gTFZQU0FfTWVtb3J5IChoUFNBSW5zdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmUFNBX01lbVRhYiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmUFNBX0luaXRQYXJhbXMpOwotCi0gICAgICAgICAgICBpZiAoUFNBX1N0YXR1cyAhPSBMVlBTQV9PSykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICByZXR1cm4oKExWTV9SZXR1cm5TdGF0dXNfZW4pIExWTV9BTEdPUklUSE1QU0EpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvKgotICAgIC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Y2hTaXplKTsKLSAgICBwTWVtb3J5VGFibGUtPlJlZ2lvbltMVk1fTUVNUkVHSU9OX1RFTVBPUkFSWV9GQVNUXS5TaXplICAgICAgICAgICAgID0gSW5zdEFsbG9jX0dldFRvdGFsKCZBbGxvY01lbVtMVk1fTUVNUkVHSU9OX1RFTVBPUkFSWV9GQVNUXSk7Ci0gICAgcE1lbW9yeVRhYmxlLT5SZWdpb25bTFZNX01FTVJFR0lPTl9URU1QT1JBUllfRkFTVF0uVHlwZSAgICAgICAgICAgICA9IExWTV9URU1QT1JBUllfRkFTVDsKLSAgICBwTWVtb3J5VGFibGUtPlJlZ2lvbltMVk1fTUVNUkVHSU9OX1RFTVBPUkFSWV9GQVNUXS5wQmFzZUFkZHJlc3MgICAgID0gTFZNX05VTEw7Ci0gICAgaWYgKHBNZW1vcnlUYWJsZS0+UmVnaW9uW0xWTV9NRU1SRUdJT05fVEVNUE9SQVJZX0ZBU1RdLlNpemUgPCA0KQotICAgIHsKLSAgICAgICAgcE1lbW9yeVRhYmxlLT5SZWdpb25bTFZNX01FTVJFR0lPTl9URU1QT1JBUllfRkFTVF0uU2l6ZSA9IDA7Ci0gICAgfQotCi0gICAgcmV0dXJuKExWTV9TVUNDRVNTKTsKLQotfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgIExWTV9HZXRJbnN0YW5jZUhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCB0byBjcmVhdGUgYSBidW5kbGUgaW5zdGFuY2UuIEl0IHJldHVybnMgdGhlIGNyZWF0ZWQgaW5zdGFuY2UgICovCi0vKiAgaGFuZGxlIHRocm91Z2ggcGhJbnN0YW5jZS4gQWxsIHBhcmFtZXRlcnMgYXJlIHNldCB0byB0aGVpciBkZWZhdWx0LCBpbmFjdGl2ZSBzdGF0ZS4gKi8KKy8qICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgdG8gY3JlYXRlIGEgYnVuZGxlIGluc3RhbmNlLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIEFsbCBwYXJhbWV0ZXJzIGFyZSBzZXQgdG8gdGhlaXIgZGVmYXVsdCwgaW5hY3RpdmUgc3RhdGUuICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBoSW5zdGFuY2UgICAgICAgICAgICAgIHBvaW50ZXIgdG8gdGhlIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcE1lbW9yeVRhYmxlICAgICAgICAgICAgUG9pbnRlciB0byB0aGUgbWVtb3J5IGRlZmluaXRpb24gdGFibGUgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwSW5zdFBhcmFtcyAgICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbml0aWFsaXNhdGlvbiBjYXBhYmlsaXRpZXMgICAgICAgICAgICAgICAgICAqLworLyogIHBoSW5zdGFuY2UgICAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgcEluc3RQYXJhbXMgICAgICAgICAgICAgUG9pbnRlciB0byB0aGUgaW5zdGFuY2UgcGFyYW1ldGVycyAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgTFZNX1NVQ0NFU1MgICAgICAgICAgICAgSW5pdGlhbGlzYXRpb24gc3VjY2VlZGVkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBMVk1fTlVMTEFERFJFU1MgICAgICAgICBPbmUgb3IgbW9yZSBtZW1vcnkgaGFzIGEgTlVMTCBwb2ludGVyICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogIExWTV9PVVRPRlJBTkdFICAgICAgICAgIFdoZW4gYW55IG9mIHRoZSBJbnN0YW5jZSBwYXJhbWV0ZXJzIGFyZSBvdXQgb2YgcmFuZ2UgICAgICAgICovCi0vKiAgTFZNX05VTExBRERSRVNTICAgICAgICAgV2hlbiBvbmUgb2YgcGhJbnN0YW5jZSwgcE1lbW9yeVRhYmxlIG9yIHBJbnN0UGFyYW1zIGFyZSBOVUxMKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgMS4gVGhpcyBmdW5jdGlvbiBtdXN0IG5vdCBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZNX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLUxWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX0dldEluc3RhbmNlSGFuZGxlKExWTV9IYW5kbGVfdCAgICAgICAgICAgKnBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fTWVtVGFiX3QgICAgICAgICAgICpwTWVtb3J5VGFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSW5zdFBhcmFtc190ICAgICAgICpwSW5zdFBhcmFtcykKLXsKLQotICAgIExWTV9SZXR1cm5TdGF0dXNfZW4gICAgIFN0YXR1cyA9IExWTV9TVUNDRVNTOwotICAgIExWTV9JbnN0YW5jZV90ICAgICAgICAgICpwSW5zdGFuY2U7Ci0gICAgSU5TVF9BTExPQyAgICAgICAgICAgICAgQWxsb2NNZW1bTFZNX05SX01FTU9SWV9SRUdJT05TXTsKLSAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBpOwotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgIEludGVybmFsQmxvY2tTaXplOwotICAgIExWTV9JTlQzMiAgICAgICAgICAgICAgIEJ1bmRsZVNjcmF0Y2hTaXplOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fR2V0SW5zdGFuY2VIYW5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FYQkxPQ0tTSVpFKSkgewogICAgICAgICAgICAgcmV0dXJuIChMVk1fT1VUT0ZSQU5HRSk7CiAgICAgICAgIH0KLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgaWYoIChwSW5zdFBhcmFtcy0+TWF4QmxvY2tTaXplIDwgTFZNX01JTl9NQVhCTE9DS1NJWkUgKSB8fCAocEluc3RQYXJhbXMtPk1heEJsb2NrU2l6ZSA+IExWTV9VTk1BTkFHRURfTUFYX01BWEJMT0NLU0laRSkgKQotICAgICAgICB7CisgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKChwSW5zdFBhcmFtcy0+TWF4QmxvY2tTaXplIDwgTFZNX01JTl9NQVhCTE9DS1NJWkUpIHx8CisgICAgICAgICAgICAocEluc3RQYXJhbXMtPk1heEJsb2NrU2l6ZSA+IExWTV9VTk1BTkFHRURfTUFYX01BWEJMT0NLU0laRSkpIHsKICAgICAgICAgICAgIHJldHVybiAoTFZNX09VVE9GUkFOR0UpOwogICAgICAgICB9CiAgICAgfQogCi0gICAgaWYocEluc3RQYXJhbXMtPlBTQV9JbmNsdWRlZCA+IExWTV9QU0FfT04pCi0gICAgeworICAgIGlmIChwSW5zdFBhcmFtcy0+UFNBX0luY2x1ZGVkID4gTFZNX1BTQV9PTikgewogICAgICAgICByZXR1cm4gKExWTV9PVVRPRlJBTkdFKTsKICAgICB9CiAKICAgICAvKgotICAgICAqIEluaXRpYWxpc2UgdGhlIEFsbG9jTWVtIHN0cnVjdHVyZXMKKyAgICAgKiBDcmVhdGUgdGhlIGluc3RhbmNlIGhhbmRsZQogICAgICAqLwotICAgIGZvciAoaT0wOyBpPExWTV9OUl9NRU1PUllfUkVHSU9OUzsgaSsrKQotICAgIHsKLSAgICAgICAgSW5zdEFsbG9jX0luaXQoJkFsbG9jTWVtW2ldLAotICAgICAgICAgICAgICAgICAgICAgICBwTWVtb3J5VGFibGUtPlJlZ2lvbltpXS5wQmFzZUFkZHJlc3MpOwotICAgIH0K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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihMVk1fQnVmZmVyX3QpKTsKLSAgICAgICAgQnVuZGxlU2NyYXRjaFNpemUgPSAoTFZNX0lOVDMyKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICgzICogTFZNX01BWF9DSEFOTkVMUyBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICogKE1JTl9JTlRFUk5BTF9CTE9DS1NJWkUgKyBJbnRlcm5hbEJsb2NrU2l6ZSkgXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIHNpemVvZihMVk1fRkxPQVQpKTsKLSAgICAgICAgcEluc3RhbmNlLT5wQnVmZmVyTWFuYWdlbWVudC0+cFNjcmF0Y2ggPSAoTFZNX0ZMT0FUICopCi0gICAgICAgICAgICBJbnN0QWxsb2NfQWRkTWVtYmVyKAotICAgICAgICAgICAgICAgICAgICAgICAgICZBbGxvY01lbVtMVk1fTUVNUkVHSU9OX1RFTVBPUkFSWV9GQVNUXSwgLyogU2NyYXRjaCAxIGJ1ZmZlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX1VJTlQzMilCdW5kbGVTY3JhdGNoU2l6ZSk7Ci0gICAgICAgIExvYWRDb25zdF9GbG9hdCgwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogQ2xlYXIgdGhlIGlucHV0IGRlbGF5IGJ1ZmZlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCAqKSZwSW5zdGFuY2UtPnBCdWZmZXJNYW5hZ2VtZW50LT5JbkRlbGF5QnVmZmVyLAotICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoTFZNX01BWF9DSEFOTkVMUyAqIE1JTl9JTlRFUk5BTF9CTE9DS1NJWkUpKTsKLSAgICAgICAgcEluc3RhbmNlLT5wQnVmZmVyTWFuYWdlbWVudC0+SW5EZWxheVNhbXBsZXM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FUlNJU1RFTlRfRkFTVF9EQVRBXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBJbnN0UGFyYW1zLT5FUU5CX051bUJhbmRzICogc2l6ZW9mKExWTV9FUU5CX0JhbmREZWZfdCkpKTsKLSAgICBwSW5zdGFuY2UtPnBFUU5CX1VzZXJEZWZzID0KLSAgICAgICAgKExWTV9FUU5CX0JhbmREZWZfdCAqKUluc3RBbGxvY19BZGRNZW1iZXIoJkFsbG9jTWVtW0xWTV9NRU1SRUdJT05fUEVSU0lTVEVOVF9GQVNUX0RBVEFdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocEluc3RQYXJhbXMtPkVRTkJfTnVtQmFuZHMgKiBzaXplb2YoTFZNX0VRTkJfQmFuZERlZl90KSkpOworICAgIHBJbnN0YW5jZS0+cEVRTkJfQmFuZERlZnMgPSAoTFZNX0VRTkJfQmFuZERlZl90KiljYWxsb2MocEluc3RQYXJhbXMtPkVRTkJfTnVtQmFuZHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoKihwSW5zdGFuY2UtPnBFUU5CX0JhbmREZWZzKSkpOworICAgIGlmIChwSW5zdGFuY2UtPnBFUU5CX0JhbmREZWZzID09IExWTV9OVUxMKSB7CisgICAgICAgIHJldHVybiBMVk1fTlVMTEFERFJFU1M7CisgICAgfQorICAgIHBJbnN0YW5jZS0+cEVRTkJfVXNlckRlZnMgPSAoTFZNX0VRTkJfQmFuZERlZl90KiljYWxsb2MocEluc3RQYXJhbXMtPkVRTkJfTnVtQmFuZHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoKihwSW5zdGFuY2UtPnBFUU5CX1VzZXJEZWZzKSkpOworICAgIGlmIChwSW5zdGFuY2UtPnBFUU5CX1VzZXJEZWZzID09IExWTV9OVUxMKSB7CisgICAgICAgIHJldHVybiBMVk1fTlVMTEFERFJFU1M7CisgICAgfQogCiAgICAgLyoKICAgICAgKiBJbml0aWFsaXNlIHRoZSBDb25jZXJ0IFNvdW5kIG1vZHVsZQogICAgICAqLwogICAgIHsKLSAgICAgICAgTFZDU19IYW5kbGVfdCAgICAgICAgICAgaENTSW5zdGFuY2U7ICAgICAgICAgICAgICAgIC8qIEluc3RhbmNlIGhhbmRsZSAqLwotICAgICAgICBMVkNTX01lbVRhYl90ICAgICAgICAgICBDU19NZW1UYWI7ICAgICAgICAgICAgICAgICAgLyogTWVtb3J5IHRhYmxlICovCi0gICAgICAgIExWQ1NfQ2FwYWJpbGl0aWVzX3QgICAgIENTX0NhcGFiaWxpdGllczsgICAgICAgICAgICAvKiBJbml0aWFsIGNhcGFiaWxpdGllcyAqLwotICAgICAgICBMVkNTX1JldHVyblN0YXR1c19lbiAgICBMVkNTX1N0YXR1czsgICAgICAgICAgICAgICAgLyogRnVuY3Rpb24gY2FsbCBzdGF0dXMgKi8KKyAgICAgICAgTFZDU19IYW5kbGVfdCBoQ1NJbnN0YW5jZTsgICAgICAgICAgIC8qIEluc3RhbmNlIGhhbmRsZSAqLworICAgICAgICBMVkNTX0NhcGFiaWxpdGllc190IENTX0NhcGFiaWxpdGllczsgLyogSW5pdGlhbCBjYXBhYmlsaXRpZXMgKi8KKyAgICAgICAgTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19TdGF0dXM7ICAgIC8qIEZ1bmN0aW9uIGNhbGwgc3RhdHVzICovCiAKICAgICAgICAgLyoKICAgICAgICAgICogU2V0IGRlZmF1bHQgcGFyYW1ldGVycwogICAgICAgICAgKi8KLSAgICAgICAgcEluc3RhbmNlLT5QYXJhbXMuVmlydHVhbGl6ZXJSZXZlcmJMZXZlbCAgICA9IDEwMDsKLSAgICAgICAgcEluc3RhbmNlLT5QYXJhbXMuVmlydHVhbGl6ZXJUeXBlICAgICAgICAgICA9IExWTV9DT05DRVJUU09VTkQ7Ci0gICAg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ZDU19TdGF0dXMgPSBMVkNTX01lbW9yeShMVk1fTlVMTCwgICAgICAgICAgICAgICAgLyogR2V0IHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkNTX01lbVRhYiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmQ1NfQ2FwYWJpbGl0aWVzKTsKLSAgICAgICAgQ1NfTWVtVGFiLlJlZ2lvbltMVkNTX01FTVJFR0lPTl9QRVJTSVNURU5UX1NMT1dfREFUQV0ucEJhc2VBZGRyZXNzID0gJnBJbnN0YW5jZS0+Q1NfSW5zdGFuY2U7Ci0gICAgICAgIENTX01lbVRhYi5SZWdpb25bTFZDU19NRU1SRUdJT05fUEVSU0lTVEVOVF9GQVNUX0RBVEFdLnBCYXNlQWRkcmVzcyA9ICh2b2lkICopSW5zdEFsbG9jX0FkZE1lbWJlcigmQWxsb2NNZW1bTFZNX01FTVJFR0lPTl9QRVJTSVNURU5UX0ZBU1RfREFUQV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDU19NZW1UYWIuUmVnaW9uW0xWQ1NfTUVNUkVHSU9OX1BFUlNJU1RFTlRfRkFTVF9EQVRBXS5TaXplKTsKLSAgICAgICAgQ1NfTWVtVGFiLlJlZ2lvbltMVkNTX01FTVJFR0lPTl9QRVJTSVNURU5UX0ZBU1RfQ09FRl0ucEJhc2VBZGRyZXNzID0gKHZvaWQgKilJbnN0QWxsb2NfQWRkTWVtYmVyKCZBbGxvY01lbVtMVk1fTUVNUkVHSU9OX1BFUlNJU1RFTlRfRkFTVF9DT0VGXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENTX01lbVRhYi5SZWdpb25bTFZDU19NRU1SRUdJT05fUEVSU0lTVEVOVF9GQVNUX0NPRUZdLlNpemUpOwotICAgICAgICBDU19NZW1UYWIuUmVnaW9uW0xWQ1NfTUVNUkVHSU9OX1RFTVBPUkFSWV9GQVNUXS5wQmFzZUFkZHJlc3MgICAgICAgPSAodm9pZCAqKUluc3RBbGxvY19BZGRNZW1iZXIoJkFsbG9jTWVtW0xWTV9NRU1SRUdJT05fVEVNUE9SQVJZX0ZBU1RdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCk7Ci0KLSAgICAgICAgLyoKICAgICAgICAgICogSW5pdGlhbGlzZSB0aGUgQ29uY2VydCBTb3VuZCBpbnN0YW5jZSBhbmQgc2F2ZSB0aGUgaW5zdGFuY2UgaGFuZGxlCiAgICAgICAgICAqLwotICAgICAgICBoQ1NJbnN0YW5jZSA9IExWTV9OVUxMOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTZXQgdG8gTlVMTCB0byByZXR1cm4gaGFuZGxlICovCi0gICAgICAgIExWQ1NfU3RhdHVzID0gTFZDU19Jbml0KCZoQ1NJbnN0YW5jZSwgICAgICAgICAgICAgIC8qIEluaXRpYWlsc2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkNTX01lbVRhYiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkNTX0NhcGFiaWxpdGllcyk7Ci0gICAgICAgIGlmIChMVkNTX1N0YXR1cyAhPSBMVkNTX1NVQ0NFU1MpIHJldHVybigoTFZNX1JldHVyblN0YXR1c19lbilMVkNTX1N0YXR1cyk7Ci0gICAgICAgIHBJbnN0YW5jZS0+aENTSW5zdGFuY2UgPSBoQ1NJbnN0YW5jZTsgICAgICAgICAgICAgIC8qIFNhdmUgdGhlIGluc3RhbmNlIGhhbmRsZSAqLwotCisgICAgICAgIGhDU0luc3RhbmNlID0gTFZNX05VTEw7ICAgICAgICAgICAgICAgLyogU2V0IHRvIE5VTEwgdG8gcmV0dXJuIGhhbmRsZSAqLworICAgICAgICBMVkNTX1N0YXR1cyA9IExWQ1NfSW5pdCgmaENTSW5zdGFuY2UsIC8qIENyZWF0ZSBhbmQgaW5pdGlhaWxzZSAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmQ1NfQ2FwYWJpbGl0aWVzLCBwSW5zdGFuY2UtPnBTY3JhdGNoKTsKKyAgICAgICAgaWYgKExWQ1NfU3RhdHVzICE9IExWQ1NfU1VDQ0VTUykgcmV0dXJuICgoTFZNX1JldHVyblN0YXR1c19lbilMVkNTX1N0YXR1cyk7CisgICAgICAgIHBJbnN0YW5jZS0+aENTSW5zdGFuY2UgPSBoQ1NJbnN0YW5jZTsgLyogU2F2ZSB0aGUgaW5zdGFuY2UgaGFuZGxlICovCiAgICAgfQogCiAgICAgLyoKICAgICAgKiBJbml0aWFsaXNlIHRoZSBCYXNzIEVuaGFuY2VtZW50IG1vZHVsZQogICAgICAqLwogICAgIHsKLSAgICAgICAgTFZEQkVfSGFuZGxlX3QgICAgICAgICAgaERCRUluc3RhbmNlOyAgICAgICAgICAgICAgIC8qIEluc3RhbmNlIGhhbmRsZSAqLwotICAgICAgICBMVkRCRV9NZW1UYWJfdCAgICAgICAgICBEQkVfTWVtVGFiOyAgICAgICAgICAgICAgICAgLyogTWVtb3J5IHRhYmxlICovCi0gICAgICAgIExWREJFX0NhcGFiaWxpdGllc190ICAgIERCRV9DYXBhYmlsaXRpZXM7ICAgICAgICAgICAvKiBJbml0aWFsIGNhcGFiaWxpdGllcyAqLwotICAgICAgICBMVkRCRV9SZXR1cm5TdGF0dXNfZW4gICBMVkRCRV9TdGF0dXM7ICAgICAgICAgICAgICAgLyogRnVuY3Rpb24gY2FsbCBzdGF0dXMgKi8KKyAgICAgICAgTFZEQkVfSGF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gICAgICAgICovCi0gICAgICAgIERCRV9DYXBhYmlsaXRpZXMuU2FtcGxlUmF0ZSAgICAgID0gTFZEQkVfQ0FQX0ZTXzgwMDAgfCBMVkRCRV9DQVBfRlNfMTEwMjUgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX0NBUF9GU18xMjAwMCB8IExWREJFX0NBUF9GU18xNjAwMCB8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfQ0FQX0ZTXzIyMDUwIHwgTFZEQkVfQ0FQX0ZTXzI0MDAwIHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkRCRV9DQVBfRlNfMzIwMDAgfCBMVkRCRV9DQVBfRlNfNDQxMDAgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX0NBUF9GU180ODAwMCB8IExWREJFX0NBUF9GU184ODIwMCB8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfQ0FQX0ZTXzk2MDAwIHwgTFZEQkVfQ0FQX0ZTXzE3NjQwMCB8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfQ0FQX0ZTXzE5MjAwMDsKLSAgICAgICAgREJFX0NhcGFiaWxpdGllcy5DZW50cmVGcmVxdWVuY3kgPSBMVkRCRV9DQVBfQ0VOVFJFXzU1SHogfCBMVkRCRV9DQVBfQ0VOVFJFXzU1SHogfCBMVkRCRV9DQVBfQ0VOVFJFXzY2SHogfCBMVkRCRV9DQVBfQ0VOVFJFXzc4SHogfCBMVkRCRV9DQVBfQ0VOVFJFXzkwSHo7Ci0gICAgICAgIERCRV9DYXBhYmlsaXRpZXMuTWF4QmxvY2tTaXplICAgID0gKExWTV9VSU5UMTYpSW50ZXJuYWxCbG9ja1NpemU7CisgICAgICAgIERCRV9DYXBhYml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uY2UtPkRCRV9JbnN0YW5jZTsKLSAgICAgICAgREJFX01lbVRhYi5SZWdpb25bTFZEQkVfTUVNUkVHSU9OX1BFUlNJU1RFTlRfREFUQV0ucEJhc2VBZGRyZXNzID0gKHZvaWQgKilJbnN0QWxsb2NfQWRkTWVtYmVyKCZBbGxvY01lbVtMVk1fTUVNUkVHSU9OX1BFUlNJU1RFTlRfRkFTVF9EQVRBXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCRV9NZW1UYWIuUmVnaW9uW0xWREJFX01FTVJFR0lPTl9QRVJTSVNURU5UX0RBVEFdLlNpemUpOwotICAgICAgICBEQkVfTWVtVGFiLlJlZ2lvbltMVkRCRV9NRU1SRUdJT05fUEVSU0lTVEVOVF9DT0VGXS5wQmFzZUFkZHJlc3MgPSAodm9pZCAqKUluc3RBbGxvY19BZGRNZW1iZXIoJkFsbG9jTWVtW0xWTV9NRU1SRUdJT05fUEVSU0lTVEVOVF9GQVNUX0NPRUZdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJFX01lbVRhYi5SZWdpb25bTFZEQkVfTUVNUkVHSU9OX1BFUlNJU1RFTlRfQ09FRl0uU2l6ZSk7Ci0gICAgICAgIERCRV9NZW1UYWIuUmVnaW9uW0xWREJFX01FTVJFR0lPTl9TQ1JBVENIXS5wQmFzZUFkZHJlc3MgICAgICAgICA9ICh2b2lkICopSW5zdEFsbG9jX0FkZE1lbWJlcigmQWxsb2NNZW1bTFZNX01FTVJFR0lPTl9URU1QT1JBUllfRkFTVF0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwKTsKKyAgICAgICAgREJFX0NhcGFiaWxpdGllcy5DZW50cmVGcmVxdWVuY3kgPSBMVkRCRV9DQVBfQ0VOVFJFXzU1SHogfCBMVkRCRV9DQVBfQ0VOVFJFXzU1SHogfAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWREJFX0NBUF9DRU5UUkVfNjZIeiB8IExWREJFX0NBUF9DRU5UUkVfNzhIeiB8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZEQkVfQ0FQX0NFTlRSRV85MEh6OworICAgICAgICBEQkVfQ2FwYWJpbGl0aWVzLk1heEJsb2NrU2l6ZSA9IChMVk1fVUlOVDE2KUludGVybmFsQmxvY2tTaXplOwogCiAgICAgICAgIC8qCiAgICAgICAgICAqIEluaXRpYWxpc2UgdGhlIER5bmFtaWMgQmFzcyBFbmhhbmNlbWVudCBpbnN0YW5jZSBhbmQgc2F2ZSB0aGUgaW5zdGFuY2UgaGFuZGxlCiAgICAgICAgICAqLwotICAgICAgICBoREJFSW5zdGFuY2UgPSBMVk1fTlVMTDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU2V0IHRvIE5VTEwgdG8gcmV0dXJuIGhhbmRsZSAqLwotICAgICAgICBMVkRCRV9TdGF0dXMgPSBMVkRCRV9Jbml0KCZoREJFSW5zdGFuY2UsICAgICAgICAgICAgLyogSW5pdGlhaWxzZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZEQkVfTWVtVGFiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZEQkVfQ2FwYWJpbGl0aWVzKTsKLSAgICAgICAgaWYgKExWREJFX1N0YXR1cyAhPSBMVkRCRV9TVUNDRVNTKSByZXR1cm4oKExWTV9SZXR1cm5TdGF0dXNfZW4pTFZEQkVfU3RhdHVzKTsKLSAgICAgICAgcEluc3RhbmNlLT5oREJFSW5zdGFuY2UgPSBoREJFSW5zdGFuY2U7ICAgICAgICAgICAgIC8qIFNhdmUgdGhlIGluc3RhbmNlIGhhbmRsZSAqLworICAgICAgICBoREJFSW5zdGFuY2UgPSBMVk1fTlVMTDsgICAgICAgICAgICAgICAgIC8qIFNldCB0byBOVUxMIHRvIHJldHVybiBoYW5kbGUgKi8KKyAgICAgICAgTFZEQkVfU3RhdHVzID0gTFZEQkVfSW5pdCgmaERCRUluc3RhbmNlLCAvKiBDcmVhdGUgYW5kIGluaXRpYWlsc2UgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmREJFX0NhcGFiaWxpdGllcywgcEluc3RhbmNlLT5wU2NyYXRjaCk7CisgICAgICAgIGlmIChMVkRCRV9TdGF0dXMgIT0gTFZEQkVfU1VDQ0VTUykgcmV0dXJuICgoTFZNX1JldHVyblN0YXR1c19lbilMVkRCRV9TdGF0dXMpOworICAgICAgICBwSW5zdGFuY2UtPmhEQkVJbnN0YW5jZSA9IGhEQkVJbnN0YW5jZTsgLyogU2F2ZSB0aGUgaW5zdGFuY2UgaGFuZGxlICovCiAgICAgfQogCiAgICAgLyoKICAgICAgKiBJbml0aWFsaXNlIHRoZSBOLUJhbmQgRXF1YWxpc2VyIG1vZHVsZQogICAgICAqLwogICAgIHsKLSAgICAgICAgTFZFUU5CX0hhbmRsZV90ICAgICAgICAgIGhFUU5CSW5zdGFuY2U7ICAgICAgICAgICAgIC8qIEluc3RhbmNlIGhhbmRsZSAqLwotICAgICAgICBMVkVRTkJfTWVtVGFiX3QgICAgICAgICAgRVFOQl9NZW1UYWI7ICAgICAgICAgICAgICAgLyogTWVtb3J5IHRhYmxlICovCi0gICAgICAgIExWRVFOQl9DYXBhYmlsaXRpZXNfdCAgICBFUU5CX0NhcGFiaWxpdGllczsgICAgICAgICAvKiBJbml0aWFsIGNhcGFiaWxpdGllcyAqLwotICAgICAgICBMVkVRTkJfUmV0dXJuU3RhdHVzX2VuICAgTFZFUU5CX1N0YXR1czsgICAgICAg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A9IExWRVFOQl9DQVBfRlNfODAwMCB8IExWRVFOQl9DQVBfRlNfMTEwMjUgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQ0FQX0ZTXzEyMDAwIHwgTFZFUU5CX0NBUF9GU18xNjAwMCB8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9DQVBfRlNfMjIwNTAgfCBMVkVRTkJfQ0FQX0ZTXzI0MDAwIHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0NBUF9GU18zMjAwMCB8IExWRVFOQl9DQVBfRlNfNDQxMDAgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQ0FQX0ZTXzQ4MDAwIHwgTFZFUU5CX0NBUF9GU184ODIwMCB8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9DQVBfRlNfOTYwMDAgfCBMVkVRTkJfQ0FQX0ZTXzE3NjQwMCB8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9DQVBfRlNfMTkyMDAwOwotICAgICAgICBFUU5CX0NhcGFiaWxpdGllcy5NYXhCbG9ja1NpemUgICAgPSAoTFZNX1VJTlQxNilJbnRlcm5hbEJsb2NrU2l6ZTsKLSAgICAgICAgRVFOQl9DYXBhYmlsaXRpZXMuTWF4QmFuZHMgICAgICAgID0gcEluc3RQYXJhbXMtPkVRTkJfTnVtQmFuZHM7Ci0gICAgICAgIEVRTkJfQ2FwYWJpbGl0aWVzLlNvdXJjZUZvcm1hdCAgICA9IExWRVFOQl9DQVBfU1RFUkVPIHwgTFZFUU5CX0NBUF9NT05PSU5TVEVSRU87Ci0gICAgICAgIEVRTkJfQ2FwYWJpbGl0aWVzLkNhbGxCYWNrICAgICAgICA9IHBJbnN0Y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SRUdJT05fVEVNUE9SQVJZX0ZBU1RdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwKTsKKyAgICAgICAgRVFOQl9DYXBhYmlsaXRpZXMuTWF4QmxvY2tTaXplID0gKExWTV9VSU5UMTYpSW50ZXJuYWxCbG9ja1NpemU7CisgICAgICAgIEVRTkJfQ2FwYWJpbGl0aWVzLk1heEJhbmRzID0gcEluc3RQYXJhbXMtPkVRTkJfTnVtQmFuZHM7CisgICAgICAgIEVRTkJfQ2FwYWJpbGl0aWVzLlNvdXJjZUZvcm1hdCA9IExWRVFOQl9DQVBfU1RFUkVPIHwgTFZFUU5CX0NBUF9NT05PSU5TVEVSRU87CisgICAgICAgIEVRTkJfQ2FwYWJpbGl0aWVzLkNhbGxCYWNrID0gcEluc3RhbmNlLT5DYWxsQmFjazsKKyAgICAgICAgRVFOQl9DYXBhYmlsaXRpZXMucEJ1bmRsZUluc3RhbmNlID0gKHZvaWQqKXBJbnN0YW5jZTsKIAogICAgICAgICAvKgogICAgICAgICAgKiBJbml0aWFsaXNlIHRoZSBEeW5hbWljIEJhc3MgRW5oYW5jZW1lbnQgaW5zdGFuY2UgYW5kIHNhdmUgdGhlIGluc3RhbmNlIGhhbmRsZQogICAgICAgICAgKi8KLSAgICAgICAgaEVRTkJJbnN0YW5jZSA9IExWTV9OVUxMOyAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNldCB0byBOVUxMIHRvIHJldHVybiBoYW5kbGUgKi8KLSAgICAgICAgTFZFUU5CX1N0YXR1cyA9IExWRVFOQl9Jbml0KCZoRVFOQkluc3RhbmNlLCAgICAgICAgIC8qIEluaXRpYWlsc2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZFUU5CX01lbVRhYiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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VJTSVNURU5UX0ZBU1RfREFUQV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0hFQURST09NX01BWF9OQkFORFMgKiBzaXplb2YoTFZNX0hlYWRyb29tQmFuZERlZl90KSkpOwotICAgICAgICBwSW5zdGFuY2UtPnBIZWFkcm9vbV9Vc2VyRGVmcyA9IChMVk1fSGVhZHJvb21CYW5kRGVmX3QgKikKLSAgICAgICAgICAgICAgSW5zdEFsbG9jX0FkZE1lbWJlcigmQWxsb2NNZW1bTFZNX01FTVJFR0lPTl9QRVJTSVNURU5UX0ZBU1RfREFUQV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0hFQURST09NX01BWF9OQkFORFMgKiBzaXplb2YoTFZNX0hlYWRyb29tQmFuZERlZl90KSkpOworICAgICAgICBwSW5zdGFuY2UtPnBIZWFkcm9vbV9CYW5kRGVmcyA9IChMVk1fSGVhZHJvb21CYW5kRGVmX3QqKWNhbGxvYygKKyAgICAgICAgICAgICAgICBMVk1fSEVBRFJPT01fTUFYX05CQU5EUywgc2l6ZW9mKCoocEluc3RhbmNlLT5wSGVhZHJvb21fQmFuZERlZnMpKSk7CisgICAgICAgIGlmIChwSW5zdGFuY2UtPnBIZWFkcm9vbV9CYW5kRGVmcyA9PSBMVk1fTlVMTCkgeworICAgICAgICAgICAgcmV0dXJuIExWTV9OVUxMQUREUkVTUzsKKyAgICAgICAgfQorICAgICAgICBwSW5zdGFuY2UtPnBIZWFkcm9vbV9Vc2VyRGVmcyA9IChMVk1fSGVhZHJvb21CYW5kRGVmX3QqKWNhbGxvYygKKyAgICAgICAgICAgICAgICBMVk1fSEVBRFJPT01fTUFYX05CQU5EUywgc2l6ZW9mKCoocEluc3RhbmNlLT5wSGVhZHJvb21fVXNlckRlZnMpKSk7CisgICAgICAgIGlmIChwSW5zdGFuY2UtPnBIZWFkcm9vbV9Vc2VyRGVmcyA9PSBMVk1fTlVMTCkgeworICA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IChoUFNBSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmUFNBX01lbVRhYiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwSW5zdGFuY2UtPlBTQV9Jbml0UGFyYW1zKTsKLQotICAgICAgICAgICAgaWYgKFBTQV9TdGF0dXMgIT0gTFZQU0FfT0spCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuKChMVk1fUmV0dXJuU3RhdHVzX2VuKSBMVk1fQUxHT1JJVEhNUFNBKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgLyogU2xvdyBEYXRhICovCi0gICAgICAgICAgICBQU0FfTWVtVGFiLlJlZ2lvbltMVk1fUEVSU0lTVEVOVF9TTE9XX0RBVEFdLnBCYXNlQWRkcmVzcyA9ICh2b2lkICopSW5zdEFsbG9jX0FkZE1lbWJlcigmQWxsb2NNZW1bTFZNX01FTVJFR0lPTl9QRVJTSVNURU5UX1NMT1dfREFUQV0sCi0gICAgICAgICAgICAgICAgUFNBX01lbVRhYi5SZWdpb25bTFZNX1BFUlNJU1RFTlRfU0xPV19EQVRBXS5TaXplKTsKLQotICAgICAgICAgICAgLyogRmFzdCBEYXRhICovCi0gICAgICAgICAgICBQU0FfTWVtVGFiLlJlZ2lvbltMVk1fUEVSU0lTVEVOVF9GQVNUX0RBVEFdLnBCYXNlQWRkcmVzcyA9ICh2b2lkICopSW5zdEFsbG9jX0FkZE1lbWJlcigmQWxsb2NNZW1bTFZNX01FTVJFR0lPTl9QRVJTSVNURU5UX0ZBU1RfREFUQV0sCi0gICAgICAgICAgICAgICAgUFNBX01lbVRhYi5SZWdpb25bTFZNX1BFUlNJU1RFTlRfRkFTVF9EQVRBXS5TaXplKTsKLQotICAgICAgICAgICAgLyogRmFzdCBDb2VmICovCi0gICAgICAgICAgICBQU0FfTWVtVGFiLlJlZ2lvbltMVk1fUEVSU0lTVEVOVF9G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AgICAgICAgICBQU0FfU3RhdHVzID0gTFZQU0FfSW5pdCAoJmhQU0FJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwSW5zdGFuY2UtPlBTQV9Jbml0UGFyYW1zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBJbnN0YW5jZS0+UFNBX0NvbnRyb2xQYXJhbXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmUFNBX01lbVRhYik7CisgICAgICAgICAgICBwSW5zdGFuY2UtPlBTQV9Db250cm9sUGFyYW1zLkxldmVsRGV0ZWN0aW9uU3BlZWQgPSBMVlBTQV9TUEVFRF9NRURJVU07CisgICAgICAgICAgICBwSW5zdGFuY2UtPnBQU0FJbnB1dCA9IChMVk1fRkxPQVQqKWNhbGxvYyhNQVhfSU5URVJOQUxfQkxPQ0tTSVpFLCBzaXplb2YoTFZNX0ZMT0FUKSk7CisgICAgICAgICAgICBpZiAocEluc3RhbmNlLT5wUFNBSW5wdXQgPT0gTFZNX05VTEwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gTFZNX05VTExBRERSRVNTOworICAgICAgICAgICAgfQorICAgICAgICAgICAgUFNBX1N0YXR1cyA9IExWUFNBX0luaXQoJmhQU0FJbnN0YW5jZSwgJnBJbnN0YW5jZS0+UFNBX0luaXRQYXJhbXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcEluc3RhbmNlLT5QU0FfQ29udHJvbFBhcmFtcywgcEluc3RhbmNlLT5wU2NyYXRjaCk7CiAKLSAgICAgICAgICAgIGlmIChQU0FfU3RhdHVzICE9IExWUFNBX09LKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHJldHVybigoTFZNX1JldHVyblN0YXR1c19lbikgTFZNX0FMR09SSVRITVBTQSk7CisgICAgICAgICAgICBpZiAoUFNBX1N0YXR1cyAhPSBMVlBTQV9PSykgeworICAgICAgICAgICAgICAgI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U11bHRpcGxlID0gNDsKKyAgICB9IGVsc2UgeworICAgICAgICBwSW5zdGFuY2UtPkJsaWNrU2l6ZU11bHRpcGxlID0gMTsKICAgICB9CiAKLSAgICByZXR1cm4oU3RhdHVzKTsKKyAgICByZXR1cm4gKFN0YXR1cyk7Cit9CisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgIExWTV9EZWxJbnN0YW5jZUhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCB0byBjcmVhdGUgYSBidW5kbGUgaW5zdGFuY2UuIEl0IHJldHVybnMgdGhlIGNyZWF0ZWQgaW5zdGFuY2UgICovCisvKiAgaGFuZGxlIHRocm91Z2ggcGhJbnN0YW5jZS4gQWxsIHBhcmFtZXRlcnMgYXJlIHNldCB0byB0aGVpciBkZWZhdWx0LCBpbmFjdGl2ZSBzdGF0ZS4gKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgcGhJbnN0YW5jZSAgICAgICAgICAgICAgUG9pbnRlciB0byB0aGUgaW5zdGFuY2UgaGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgMS4gVGhpcyBmdW5jdGlvbiBtdXN0IG5vdCBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZNX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCit2b2lkIExWTV9EZWxJbnN0YW5jZUhhbmRsZShMVk1fSGFuZGxlX3QqIHBoSW5zdGFuY2UpIHsKKyAgICBMVk1fSW5zdGFuY2VfdCogcEluc3RhbmNlID0gKExWTV9JbnN0YW5jZV90KikqcGhJbnN0YW5jZTsKKworICAgIGlmIChwSW5zdGFuY2UtPnBTY3JhdGNoICE9IExWTV9OVUxMKSB7CisgICAgICAgIGZyZWUocEluc3RhbmNlLT5wU2NyYXRjaCk7CisgICAgICAgIHBJbnN0YW5jZS0+cFNjcmF0Y2ggPSBMVk1fTlVMTDsKKyAgICB9CisKKyAgICBpZiAocEluc3RhbmNlLT5JbnN0UGFyYW1zLkJ1ZmZlck1vZGUgPT0gTFZNX01BTkFHRURfQlVGRkVSUykgeworICAgICAgICAvKgorICAgICAgICAgKiBNYW5hZ2VkIGJ1ZmZlcnMgcmVxdWlyZWQKKyAgICAgICAgICovCisgICAgICAgIGlmIChwSW5zdGFuY2UtPnBCdWZmZXJNYW5hZ2VtZW50ICE9IExWTV9OVUxMKSB7CisgICAgICAgICAgICBmcmVlKHBJbnN0YW5jZS0+cEJ1ZmZlck1hbmFnZW1lbnQpOworICAgICAgICAgICAgcEluc3RhbmNlLT5wQnVmZmVyTWFuYWdlbWVudCA9IExWTV9OVUxMOworICAgICAgICB9CisgICAgfQorCisgICAgLyoKKyAgICAgKiBUcmVibGUgRW5oYW5jZW1lbnQKKyAgICAgKi8KKworICAgIC8qCisgICAgICogRnJlZSB0aGUgZGVmYXVsdCBFUU5CIHByZS1nYWluIGFuZCBwb2ludGVyIHRvIHRoZSBiYW5kIGRlZmluaXRpb25zCisgICAgICovCisgICAgaWYgKHBJbnN0YW5jZS0+cEVRTkJfQmFuZERlZnMgIT0gTFZNX05VTEwpIHsKKyAgICAgICAgZnJlZShwSW5zdGFuY2UtPnBFUU5CX0JhbmREZWZzKTsKKyAgICAgICAgcEluc3RhbmNlLT5wRVFOQl9CYW5kRGVmcyA9IExWTV9OVUxMOworICAgIH0KKyAgICBpZiAocEluc3RhbmNlLT5wRVFOQl9Vc2VyRGVmcyAhPSBMVk1fTlVMTCkgeworICAgICAgICBmcmVlKHBJbnN0YW5jZS0+cEVRTkJfVXNlckRlZnMpOworICAgICAgICBwSW5zdGFuY2UtPnBFUU5CX1VzZXJEZWZzID0gTFZNX05VTEw7CisgICAgfQorCisgICAgLyoKKyAgICAgKiBEZS1pbml0aWFsaXNlIHRoZSBDb25jZXJ0IFNvdW5kIG1vZHVsZQorICAgICAqLworICAgIGlmIChwSW5zdGFuY2UtPmhDU0luc3RhbmNlICE9IExWTV9OVUxMKSB7CisgICAgICAgIExWQ1NfRGVJbml0KCZwSW5zdGFuY2UtPmhDU0luc3RhbmNlKTsKKyAgICB9CisKKyAgICAvKgorICAgICAqIERlLWluaXRpYWxpc2UgdGhlIEJhc3MgRW5oYW5jZW1lbnQgbW9kdWxlCisgICAgICovCisgICAgaWYgKHBJbnN0YW5jZS0+aERCRUluc3RhbmNlICE9IExWTV9OVUxMKSB7CisgICAgICAgIExWREJFX0RlSW5pdCgmcEluc3RhbmNlLT5oREJFSW5zdGFuY2UpOworICAgIH0KKworICAgIC8qCisgICAgICogRGUtaW5pdGlhbGlzZSB0aGUgTi1CYW5kIEVxdWFsaXNlciBtb2R1bGUKKyAgICAgKi8KKyAgICBpZiAocEluc3RhbmNlLT5oRVFOQkluc3RhbmNlICE9IExWTV9OVUxMKSB7CisgICAgICAgIExWRVFOQl9EZUluaXQoJnBJbnN0YW5jZS0+aEVRTkJJbnN0YW5jZSk7CisgICAgfQorCisgICAgLyoKKyAgICAgKiBGcmVlIEhlYWRyb29tIG1hbmFnZW1lbnQgbWVtb3J5LgorICAgICAqLworICAgIGlmIChwSW5zdGFuY2UtPnBIZWFkcm9vbV9CYW5kRGVmcyAhPSBMVk1fTlVMTCkgeworICAgICAgICBmcmVlKHBJbnN0YW5jZS0+cEhlYWRyb29tX0JhbmREZWZzKTsKKyAgICAgICAgcEluc3RhbmNlLT5wSGVhZHJvb21fQmFuZERlZnMgPSBMVk1fTlVMTDsKKyAgICB9CisgICAgaWYgKHBJbnN0YW5jZS0+cEhlYWRyb29tX1VzZXJEZWZzICE9IExWTV9OVUxMKSB7CisgICAgICAgIGZyZWUocEluc3RhbmNlLT5wSGVhZHJvb21fVXNlckRlZnMpOworICAgICAgICBwSW5zdGFuY2UtPnBIZWFkcm9vbV9Vc2VyRGVmcyA9IExWTV9OVUxMOworICAgIH0KKworICAgIC8qCisgICAgICogRGUtaW5pdGlhbGlzZSB0aGUgUFNBIG1vZHVsZQorICAgICAqLworICAgIGlmIChwSW5zdGFuY2UtPmhQU0FJbnN0YW5jZSAhPSBMVk1fTlVMTCkgeworICAgICAgICBMVlBTQV9EZUluaXQoJnBJbnN0YW5jZS0+aFBTQUluc3RhbmNlKTsKKyAgICB9CisgICAgaWYgKHBJbnN0YW5jZS0+cFBTQUlucHV0ICE9IExWTV9OVUxMKSB7CisgICAgICAgIGZyZWUocEluc3RhbmNlLT5wUFNBSW5wdXQpOworICAgICAgICBwSW5zdGFuY2UtPnBQU0FJbnB1dCA9IExWTV9OVUxMOworICAgIH0KKworICAgIGRlbGV0ZSBwSW5zdGFuY2U7CisgICAgcmV0dXJuOwogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTEwMjcsNDggKzU2MiwzNiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZNX1JldHVyblN0YXR1c19lbiBMVk1fQ2xlYXJBdWRpb0J1ZmZlcnMoTFZNX0hhbmRsZV90ICBoSW5zdGFuY2UpCi17Ci0gICAgTFZNX01lbVRhYl90ICAgICAgICAgICAgTWVtVGFiOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBNZW1vcnkgdGFibGUgKi8KLSAgICBMVk1fSW5zdFBhcmFtc190ICAgICAgICBJbnN0UGFyYW1zOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEluc3RhbmNlIHBhcmFtZXRlcnMgKi8KLSAgICBMVk1fQ29udHJvbFBhcmFtc190ICAgICBQYXJhbXM7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIENvbnRyb2wgUGFyYW1ldGVycyAqLwotICAgIExWTV9JbnN0YW5jZV90ICAgICAgICAgICpwSW5zdGFuY2UgID0gKExWTV9JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsgLyogUG9pbnRlciB0byBJbnN0YW5jZSAqLwotICAgIExWTV9IZWFkcm9vbVBhcmFtc190ICAgIEhlYWRyb29tUGFyYW1zOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fQ2xlYXJBdWRpb0J1ZmZlcnMoTFZNX0hhbmRsZV90IGhJbnN0YW5jZSkgeworICAgIExWTV9JbnN0UGFyYW1zX3QgSW5zdFBhcmFtczsgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSW5zdGFuY2UgcGFyYW1ldGVycyAqLworICAgIExWTV9Db250cm9sUGFyYW1zX3QgUGFyYW1zOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogQ29udHJvbCBQYXJhbWV0ZXJzICovCisgICAgTFZNX0luc3RhbmNlX3QqIHBJbnN0YW5jZSA9IChMVk1fSW5zdGFuY2VfdCopaEluc3RhbmNlOyAvKiBQb2ludGVyIHRvIEluc3RhbmNlICovCisgICAgTFZNX0hlYWRyb29tUGFyYW1zX3QgSGVhZHJvb21QYXJhbXM7CiAKLSAgICBpZihoSW5zdGFuY2UgPT0gTFZNX05VTEwpeworICAgIGlmIChoSW5zdGFuY2UgPT0gTFZNX05VTEwpIHsKICAgICAgICAgcmV0dXJuIExWTV9OVUxMQUREUkVTUzsKICAgICB9CiAKLSAgICAvKiBTYXZlIHRoZSBjb250cm9sIHBhcmFtZXRlcnMgKi8gLyogY292ZXJpdHlbdW5jaGVja2VkX3ZhbHVlXSAqLyAvKiBEbyBub3QgY2hlY2sgcmV0dXJuIHZhbHVlIGludGVybmFsIGZ1bmN0aW9uIGNhbGxzICovCisgICAgLyogU2F2ZSB0aGUgY29udHJvbCBwYXJhbWV0ZXJzICovIC8qIGNvdmVyaXR5W3VuY2hlY2tlZF92YWx1ZV0gKi8gLyogRG8gbm90IGNoZWNrIHJldHVybiB2YWx1ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotI2luY2x1ZGUgIkxWTS5oIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTGlmZVZpYmVzICovCi0jaW5jbHVkZSAiTFZNX0NvbW1vbi5oIiAgICAgICAgICAgICAgICAgICAgICAgICAvKiBMaWZlVmliZXMgY29tbW9uICovCi0jaW5jbHVkZSAiQklRVUFELmgiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBCaXF1YWQgbGlicmFyeSAqLwotI2luY2x1ZGUgIkxWQ19NaXhlci5oIiAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTWl4ZXIgbGlicmFyeSAqLwotI2luY2x1ZGUgIkxWQ1NfUHJpdmF0ZS5oIiAgICAgICAgICAgICAgICAgICAgICAgLyogQ29uY2VydCBTb3VuZCAqLwotI2luY2x1ZGUgIkxWREJFX1ByaXZhdGUuaCIgICAgICAgICAgICAgICAgICAgICAgLyogRHluYW1pYyBCYXNzIEVuaGFuY2VtZW50ICovCi0jaW5jbHVkZSAiTFZFUU5CX1ByaXZhdGUuaCIgICAgICAgICAgICAgICAgICAgICAvKiBOLUJhbmQgZXF1YWxpc2VyICovCi0jaW5jbHVkZSAiTFZQU0FfUHJpdmF0ZS5oIiAgICAgICAgICAgICAgICAgICAgICAvKiBQYXJhbWV0cmljIFNwZWN0cnVtIEFuYWx5emVyICovCisjaW5jbHVkZSA8YXVkaW9fdXRpbHMvQmlxdWFkRmlsdGVyLmg+CisjaW5jbHVkZSAiTFZNLmgiICAgICAgICAgICAgLyogTGlmZVZpYmVzICovCisjaW5jbHVkZSAiTFZNX0NvbW1vbi5oIiAgICAgLyogTGlmZVZpYmVzIGNvbW1vbiAqLworI2luY2x1ZGUgIkJJUVVBRC5oIiAgICAgICAgIC8qIEJpcXVhZCBsaWJyYXJ5ICovCisjaW5jbHVkZSAiTFZDX01peGVyLmgiICAgICAgLyogTWl4ZXIgbGlicmFyeSAqLworI2luY2x1ZGUgIkxWQ1NfUHJpdmF0ZS5oIiAgIC8qIENvbmNlcnQgU291bmQgKi8KKyNpbmNsdWRlICJMVkRCRV9Qcml2YXRlLmgiICAvKiBEeW5hbWljIEJhc3MgRW5oYW5jZW1lbnQgKi8KKyNpbmNsdWRlICJMVkVRTkJfUHJpdmF0ZS5oIiAvKiBOLUJhbmQgZXF1YWxpc2VyICovCisjaW5jbHVkZSAiTFZQU0FfUHJpdmF0ZS5oIiAgLyogUGFyYW1ldHJpYyBTcGVjdHJ1bSBBbmFseXplciAqLwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTQ5LDYzICs1MCw2NCBAQAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAogLyogR2VuZXJhbCAqLwotI2RlZmluZSBMVk1fSU5WQUxJRCAgICAgICAgICAgICAgICAgICAgIDB4RkZGRiAgICAvKiBJbnZhbGlkIGluaXQgcGFyYW1ldGVyICovCisjZGVmaW5lIExWTV9JTlZBTElEIDB4RkZGRiAvKiBJbnZhbGlkIGluaXQgcGFyYW1ldGVyICovCiAKIC8qIE1lbW9yeSAqLwotI2RlZmluZSBMVk1fSU5TVEFOQ0VfQUxJR04gICAgICAgICAgICAgIDQgICAgICAgICAvKiAzMi1iaXQgZm9yIHN0cnVjdHVyZXMgKi8KLSNkZWZpbmUgTFZNX0ZJUlNUQ0FMTCAgICAgICAgICAgICAgICAgICAwICAgICAgICAgLyogRmlyc3QgY2FsbCB0byB0aGUgYnVmZmVyICovCi0jZGVmaW5lIExWTV9NQVhCTE9D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GVmaW5lIExWTV9QU0FfTUFTSyAyMDQ4CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMTEzLDEzMyArMTE1LDkzIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotLyogTWVtb3J5IHJlZ2lvbiBkZWZpbml0aW9uICovCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9VSU5UMzIgICAgICAgICAgICAgIFNpemU7ICAgICAgICAgICAgICAgLyogUmVnaW9uIHNpemUgaW4gYnl0ZXMgKi8KLSAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICBBbGlnbm1lbnQ7ICAgICAgICAgIC8qIEJ5dGUgYWxpZ25tZW50ICovCi0gICAgTFZNX01lbW9yeVR5cGVzX2VuICAgICAgVHlwZTsgICAgICAgICAgICAgICAvKiBSZWdpb24gdHlwZSAqLwotICAgIHZvaWQgICAgICAgICAgICAgICAgICAgICpwQmFzZUFkZHJlc3M7ICAgICAgLyogUG9pbnRlciB0byB0aGUgcmVnaW9uIGJhc2UgYWRkcmVzcyAqLwotfSBMVk1fSW50TWVtb3J5UmVnaW9uX3Q7Ci0KLS8qIE1lbW9yeSB0YWJsZSBjb250YWluaW5nIHRoZSByZWdpb24gZGVmaW5pdGlvbnMgKi8KLXR5cGVkZWYgc3RydWN0Ci17Ci0gICAgTFZNX0ludE1lbW9yeVJlZ2lvbl90ICAgUmVnaW9uW0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2IE5vU21vb3RoVm9sdW1lOyAvKiBFbmFibGUgb3IgZGlzYWJsZSBzbW9vdGggdm9sdW1lIGNoYW5nZXMqLwogCi0jaWZkZWYgU1VQUE9SVF9NQwotICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgTnJDaGFubmVsczsKLSAgICBMVk1fSU5UMzIgICAgICAgICAgICAgIENoTWFzazsKLSNlbmRpZgorICAgIExWTV9JTlQxNiBOckNoYW5uZWxzOworICAgIExWTV9JTlQzMiBDaE1hc2s7CisgICAgdm9pZCogcFNjcmF0Y2g7IC8qIFBvaW50ZXIgdG8gYnVuZGxlIHNjcmF0Y2ggYnVmZmVyKi8KIAogfSBMVk1fSW5zdGFuY2VfdDsKIApAQCAtMjQ5LDMyICsyMTEsMTkgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9BcHBseU5ld1NldHRpbmdzKExWTV9IYW5kbGVfdCAgICAgICBoSW5zdGFuY2UpOworTFZNX1JldHVyblN0YXR1c19lbiBMVk1fQXBwbHlOZXdTZXR0aW5ncyhMVk1fSGFuZGxlX3QgaEluc3RhbmNlKTsKIAotdm9pZCAgICBMVk1fU2V0VHJlYmxlQm9vc3QoIExWTV9JbnN0YW5jZV90ICAgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fQ29udHJvbFBhcmFtc190ICAgICpwUGFyYW1zKTsKK3ZvaWQgTFZNX1NldFRyZWJsZUJvb3N0KExWTV9JbnN0YW5jZV90KiBwSW5zdGFuY2UsIExWTV9Db250cm9sUGFyYW1zX3QqIHBQYXJhbXMpOwogCi12b2lkICAgIExWTV9TZXRWb2x1bWUoICBMVk1fSW5zdGFuY2VfdCAgICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICBMVk1fQ29udHJvbFBhcmFtc190ICAgICpwUGFyYW1zKTsKK3ZvaWQgTFZNX1NldFZvbHVtZShMVk1fSW5zdGFuY2VfdCogcEluc3RhbmNlLCBMVk1fQ29udHJvbFBhcmFtc190KiBwUGFyYW1zKTsKIAotTFZNX0lOVDMyICAgIExWTV9WQ0NhbGxCYWNrKHZvaWQqICAgcEJ1bmRsZUhhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkKiAgIHBHZW5lcmFsUHVycG9zZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG9ydCAgIENhbGxCYWNrUGFyYW0pOworTFZNX0lOVDMyIExWTV9WQ0NhbGxCYWNrKHZvaWQqIHBCdW5kbGVIYW5kbGUsIHZvaWQqIHBHZW5lcmFsUHVycG9zZSwgc2hvcnQgQ2FsbEJhY2tQYXJhbSk7CiAKLXZvaWQgICAgTFZNX1NldEhlYWRyb29tKCAgICBMVk1fSW5zdGFuY2VfdCAgICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0NvbnRyb2xQYXJhbXNfdCAgICAqcFBhcmFtcyk7Ci12b2lkICAgIExWTV9CdWZmZXJJbiggICBMVk1fSGFuZGxlX3QgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAqcEluRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICoqcFRvUHJvY2VzcywKLSAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICoqcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICpwTnVtU2FtcGxlcyk7Ci12b2lkICA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9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQnVuZGxlL3NyYy9MVk1fUHJvY2Vzcy5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQnVuZGxlL3NyYy9MVk1fUHJvY2Vzcy5jcHAKaW5kZXggZGM4NmNmZC4uNGVlYTA0ZiAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0J1bmRsZS9zcmMvTFZNX1Byb2Nlc3MuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CdW5kbGUvc3JjL0xWTV9Qcm9jZXNzLmNwcApAQCAtMjMsNiArMjMsNyBAQAogI2luY2x1ZGUgPHN5c3RlbS9hdWRpby5oPgogCiAjaW5jbHVkZSAiTFZNX1ByaXZhdGUuaCIKKyNpbmNsdWRlICJTY2FsYXJBcml0aG1ldGljLmgiCiAjaW5jbHVkZSAiVmVjdG9yQXJpdGhtZXRpYy5oIgogI2luY2x1ZGUgIkxWTV9Db2VmZnMuaCIKIApAQCAtNTEsMjc5ICs1MiwxNjYgQEAKIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9SZXR1cm5TdGF0dXNfZW4gTFZNX1Byb2Nlc3MoTFZNX0hhbmRsZV90ICAgICAgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICAgICAgICpwSW5EYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgKnBPdXREYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICAgTnVtU2FtcGxlcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQzMiAgICAgICAgICAgICAgICAgIEF1ZGlvVGltZSkKLXsKLQotICAgIExWTV9JbnN0YW5jZV90ICAgICAgKnBJbnN0YW5jZSAgPSAoTFZNX0luc3RhbmNlX3QgICopaEluc3RhbmNlOwotICAgIExWTV9VSU5UMTYgICAgICAgICAgU2FtcGxlQ291bnQgPSBOdW1TYW1wbGVzOwotICAgIExWTV9GTE9BVCAgICAgICAgICAgKnBJbnB1dCAgICAgPSAoTFZNX0ZMT0FUICopcEluRGF0YTsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgICpwVG9Qcm9jZXNzID0gKExWTV9GTE9BVCAqKXBJbkRhdGE7Ci0gICAgTFZNX0ZMT0FUICAgICAgICAgICAqcFByb2Nlc3NlZCA9IHBPdXREYXRhOwotICAgIExWTV9SZXR1cm5TdGF0dXNfZW4gIFN0YXR1czsKLSNpZmRlZiBTVVBQT1JUX01DCi0gICAgTFZNX0lOVDMyICAgICAgICAgICBOckNoYW5uZWxzICA9IHBJbnN0YW5jZS0+TnJDaGFubmVsczsKLSAgICBMVk1fSU5UMzIgICAgICAgICAgIENoTWFzayAgICAgID0gcEluc3RhbmNlLT5DaE1hc2s7CitMVk1fUmV0dXJuU3RhdHVzX2VuIExWTV9Qcm9jZXNzKExWTV9IYW5kbGVfdCBoSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogcEluRGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiBwT3V0RGF0YSwgTFZNX1VJTlQxNiBOdW1TYW1wbGVzLCBMVk1fVUlOVDMyIEF1ZGlvV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SA9PSBMVk1fTlVMTCkgfHwgKHBPdXREYXRhID09IExWTV9OVUxMKSkgewogICAgICAgICByZXR1cm4gKExWTV9OVUxMQUREUkVTUyk7CiAgICAgfQogCiAgICAgLyoKICAgICAgKiBGb3IgdW5tYW5hZ2VkIG1vZGUgb25seQogICAgICAqLwotICAgIGlmKHBJbnN0YW5jZS0+SW5zdFBhcmFtcy5CdWZmZXJNb2RlID09IExWTV9VTk1BTkFHRURfQlVGRkVSUykKLSAgICB7Ci0gICAgICAgICAvKgorICAgIGlmIChwSW5zdGFuY2UtPkluc3RQYXJhbXMuQnVmZmVyTW9kZSA9PSBMVk1fVU5NQU5BR0VEX0JVRkZFUlMpIHsKKyAgICAgICAgLyoKICAgICAgICAgICogQ2hlY2sgaWYgdGhlIG51bWJlciBvZiBzYW1wbGVzIGlzIGEgZ29vZCBtdWx0aXBsZSAodW5tYW5hZ2VkIG1vZGUgb25seSkKICAgICAgICAgICovCi0gICAgICAgIGlmKChOdW1TYW1wbGVzICUgcEluc3RhbmNlLT5CbGlja1NpemVNdWx0aXBsZSkgIT0gMCkKLSAgICAgICAgewotICAgICAgICAgICAgcmV0dXJuKExWTV9JTlZBTElETlVNU0FNUExFUyk7CisgICAgICAgIGlmICgoTnVtU2FtcGxlcyAlIHBJbnN0YW5jZS0+QmxpY2tTaXplTXVsdGlwbGUpICE9IDApIHsKKyAgICAgICAgICAgIHJldHVybiAoTFZNX0lOVkFMSUROVU1TQU1QTEVTKTsKICAgICAgICAgfQogCiAgICAgICAgIC8qCiAgICAgICAgICAqIENoZWNrIHRoZSBidWZmZXIgYWxpZ25tZW50CiAgICAgICAgICAqLwotICAgICAgICBpZigoKCh1aW50cHRyX3QpcEluRGF0YSAlIDQpICE9IDApIHx8ICgoKHVpbnRwdHJfdClwT3V0RGF0YSAlIDQpICE9IDApKQotICAgICAgICB7Ci0gICAgICAgICAgICByZXR1cm4oTFZNX0FMSUdOTUVOVEVSUk9SKTsKKyAgICAgICAgaWYgKCgoKHVp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bm9UbzJJX0Zsb2F0KHBJbkRhdGEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCi0gICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7ICAgICAgICAgICAgICAgICAvKiBOdW1iZXIgb2YgaW5wdXQgc2FtcGxlcyAqLwotICAgICAgICBwSW5wdXQgICAgID0gcE91dERhdGE7Ci0gICAgICAgIHBUb1Byb2Nlc3MgPSBwT3V0RGF0YTsKLSNpZmRlZiBTVVBQT1JUX01DCi0gICAgICAgIE5yQ2hhbm5lbHMgPSAyOwotICAgICAgICBDaE1hc2sgICAgID0gQVVESU9fQ0hBTk5FTF9PVVRfU1RFUkVPOwotI2VuZGlmCi0gICAgfQotCi0gICAgLyoKICAgICAgKiBQcm9jZXNzIHRoZSBkYXRhIHdpdGggbWFuYWdlZCBidWZmZXJzCiAgICAgICovCi0gICAgd2hpbGUgKFNhbXBsZUNvdW50ICE9IDApCi0gICAgeworICAgIHdoaWxlIChTYW1wbGVDb3VudCAhPSAwKSB7CiAgICAgICAgIC8qCiAgICAgICAgICAqIE1hbmFnZSB0aGUgaW5wdXQgYnVmZmVyIGFuZCBmcmFtZSBwcm9jZXNzaW5nCiAgICAgICAgICAqLwotICAgICAgICBMVk1fQnVmZmVySW4oaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgcElucHV0LAotICAgICAgICAgICAgICAgICAgICAgJnBUb1Byb2Nlc3MsCi0gICAgICAgICAgICAgICAgICAgICAmcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICZTYW1wbGVDb3VudCk7CisgICAgICAgIExWTV9CdWZmZXJJbihoSW5zdGFuY2UsIHBJbnB1dCwgJnBUb1Byb2Nlc3MsICZwUHJvY2Vzc2VkLCAmU2FtcGxlQ291bnQpOwogCiAgICAgICAgIC8qCiAgICAgICAgICAqIE9ubHkgcHJvY2VzcyBkYXRhIHdoZW4gU2FtcGxlQ291bnQgaXMgbm9uZSB6ZXJvLCBhIHplcm8gY291bnQgY2FuIG9jY3VyIHdoZW4KICAgICAgICAgICogdGhlIEJ1ZmZlckluIHJvdXRpbmUgaXMgd29ya2luZyBpbiBtYW5hZ2VkIG1vZGUuCiAgICAgICAgICAqLwotICAgICAgICBpZiAoU2FtcGxlQ291bnQgIT0gMCkKLSAgICAgICAgeworICAgICAgICBpZiAoU2FtcGxlQ291bnQgIT0gMCkgewogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIEFwcGx5IENvbmNlcnRTb3VuZCBpZiByZXF1aXJlZAogICAgICAgICAgICAgICovCi0gICAgICAgICAgICBpZiAocEluc3RhbmNlLT5DU19BY3RpdmUgPT0gTFZNX1RSVUUpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgKHZvaWQpTFZDU19Qcm9jZXNzKHBJbnN0YW5jZS0+aENTSW5zdGFuY2UsICAgICAvKiBDb25jZXJ0IFNvdW5kIGluc3RhbmNlIGhhbmRsZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwVG9Qcm9jZXNzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwUHJvY2Vzc2VkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTYW1wbGVDb3VudCk7CisgICAgICAgICAgICBpZiAocEluc3RhbmNlLT5DU19BY3RpdmUgPT0gTFZNX1RSVUUpIHsKKyAgICAgICAgICAgICAgICAodm9pZClMVkNTX1Byb2Nlc3MocEluc3RhbmNlLT5oQ1NJbnN0YW5jZSwgLyogQ29uY2VydCBTb3VuZCBpbnN0YW5jZSBoYW5kbGUgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFRvUHJvY2VzcywgcFByb2Nlc3NlZCwgU2FtcGxlQ291bnQpOwogICAgICAgICAgICAgICAgIHBUb1Byb2Nlc3MgPSBwUHJvY2Vzc2VkOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICogQXBwbHkgdm9sdW1lIGlmIHJlcXVpcmVkCiAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIGlmIChwSW5zdGFuY2UtPlZDX0FjdGl2ZSE9MCkKLSAgICAgICAgICAgIHsKLSNpZmRlZiBTVVBQT1JUX01DCi0gICAgICAgICAgICAgICAgTFZDX01peFNvZnRfTWNfRDE2QzMxX1NBVCgmcEluc3RhbmNlLT5WQ19Wb2x1bWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwVG9Qcm9jZXNzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKE5yRnJhbWVzKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5yQ2hhbm5lbHMpOwotI2Vsc2UKLSAgICAgICAgICAgICAgICBMVkNfTWl4U29mdF8xU3RfRDE2QzMxX1NBVCgmcEluc3RhbmNlLT5WQ19Wb2x1bWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwVG9Qcm9jZXNzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKDIgKiBTYW1wbGVDb3VudCkpOyAgICAgLyogTGVmdCBhbmQgcmlnaHQqLwotI2VuZGlmCisgICAgICAgICAgICBpZiAocEluc3RhbmNlLT5WQ19BY3RpdmUgIT0gMCkgeworICAgICAgICAgICAgICAgIExWQ19NaXhTb2Z0X01jX0QxNkMzMV9TQVQoJnBJbnN0YW5jZS0+VkNfVm9sdW1lLCBwVG9Qcm9jZXNzLCBwUHJvY2Vzc2VkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoTnJGcmFtZXMpLCBOckNoYW5uZWxzKTsKICAgICAgICAgICAgICAgICBwVG9Qcm9jZXNzID0gcFByb2Nlc3NlZDsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIENhbGwgTi1CYW5kIGVxdWFsaXNlciBpZiBlbmFibGVkCiAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIGlmIChwSW5zdGFuY2UtPkVRTkJfQWN0aXZlID09IExWTV9UUlVFKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIExWRVFOQl9Qcm9jZXNzKHBJbnN0YW5jZS0+aEVRTkJJbnN0YW5jZSwgICAgLyogTi1CYW5kIGVxdWFsaXNlciBpbnN0YW5jZSBoYW5kbGUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwVG9Qcm9jZXNzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2FtcGxlQ291bnQpOworICAgICAgICAgICAgaWYgKHBJbnN0YW5jZS0+RVFOQl9BY3RpdmUgPT0gTFZNX1RSVUUpIHsKKyAgICAgICAgICAgICAgICBMVkVRTkJfUHJvY2VzcyhwSW5zdGFuY2UtPmhFUU5CSW5zdGFuY2UsIC8qIE4tQmFuZCBlcXVhbGlzZXIgaW5zdGFuY2UgaGFuZGxlICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFRvUHJvY2VzcywgcFByb2Nlc3NlZCwgU2FtcGxlQ291bnQpOwogICAgICAgICAgICAgICAgIHBUb1Byb2Nlc3MgPSBwUHJvY2Vzc2VkOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICogQ2FsbCBiYXNzIGVuaGFuY2VtZW50IGlmIGVuYWJsZWQKICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgaWYgKHBJbnN0YW5jZS0+REJFX0FjdGl2ZSA9PSBMVk1fVFJVRSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBMVkRCRV9Qcm9jZXNzKHBJbnN0YW5jZS0+aERCRUluc3RhbmNlLCAgICAgICAvKiBEeW5hbWljIEJhc3MgRW5oYW5jZW1lbnQgXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluc3RhbmNlIGhhbmRsZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFRvUHJvY2VzcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTYW1wbGVDb3VudCk7CisgICAgICAgICAgICBpZiAocEluc3RhbmNlLT5EQkVfQWN0aXZlID09IExWTV9UUlVFKSB7CisgICAgICAgICAgICAgICAgTFZEQkVfUHJvY2VzcyhwSW5zdGFuY2UtPmhEQkVJbnN0YW5jZSwgLyogRHluYW1pYyBCYXNzIEVuaGFuY2VtZW50IFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnN0YW5jZSBoYW5kbGUgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUb1Byb2Nlc3MsIHBQcm9jZXNzZWQsIFNhbXBsZUNvdW50KTsKICAgICAgICAgICAgICAgICBwVG9Qcm9jZXNzID0gcFByb2Nlc3NlZDsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIEJ5cGFzcyBtb2RlIG9yIGV2ZXJ5dGhpbmcgb2ZmLCBzbyBjb3B5IHRoZSBpbnB1dCB0byB0aGUgb3V0cHV0CiAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIGlmIChwVG9Qcm9jZXNzICE9IHBQcm9jZXNzZWQpCi0gICAgICAgICAgICB7Ci0jaWZkZWYgU1VQUE9SVF9NQwotICAgICAgICAgICAgICAgIENvcHlfRmxvYXQocFRvUHJvY2VzcywgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNvdXJjZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByb2Nlc3NlZCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShOckNoYW5uZWxzICogTnJGcmFtZXMpKTsgICAgLyogQ29weSBhbGwgc2FtcGxlcyAqLwotI2Vsc2UKLSAgICAgICAgICAgICAgICBDb3B5X0Zsb2F0KHBUb1Byb2Nlc3MsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcm9jZXNzZWQsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoMiAqIFNhbXBsZUNvdW50KSk7ICAgICAgICAgIC8qIExlZnQgYW5kIHJpZ2h0ICovCi0jZW5kaWYKKyAgICAgICAgICAgIGlmIChwVG9Qcm9jZXNzICE9IHBQcm9jZXNzZWQpIHsKKyAgICAgICAgICAgICAgICBDb3B5X0Zsb2F0KHBUb1Byb2Nlc3MsICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcm9jZXNzZWQsICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoTnJDaGFubmVscyAqIE5yRnJhbWVzKSk7IC8qIENvcHkgYWxsIHNhbXBsZXMgKi8KICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIEFwcGx5IHRyZWJsZSBib29zdCBpZiByZXF1aXJlZAogICAgICAgICAgICAgICovCi0gICAgICAgICAgICBpZiAocEluc3RhbmNlLT5URV9BY3RpdmUgPT0gTFZNX1RSVUUpCi0gICAgICAgICAgICB7CisgICAgICAgICAgICBpZiAocEluc3RhbmNlLT5URV9BY3RpdmUgPT0gTFZNX1RSVUUpIHsKICAgICAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICAgICAqIEFwcGx5IHRoZSBmaWx0ZXIKICAgICAgICAgICAgICAgICAgKi8KLSNpZmRlZiBTVVBQT1JUX01DCi0gICAgICAgICAgICAgICAgRk9fTWNfRDE2RjMyQzE1X0xTaHhfVFJDX1dSQV8wMSgmcEluc3RhbmNlLT5wVEVfU3RhdGUtPlRyZWJsZUJvb3N0X1N0YXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU5yRnJhbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnJDaGFubmVscyk7Ci0jZWxzZQotICAgICAgICAgICAgICAgIEZPXzJJX0QxNkYzMkMxNV9MU2h4X1RSQ19XUkFfMDEoJnBJbnN0YW5jZS0+cFRFX1N0YXRlLT5UcmVibGVCb29zdF9TdGF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwUHJvY2Vzc2VkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilTYW1wbGVDb3VudCk7Ci0jZW5kaWYKLQorICAgICAgICAgICAgICAgIHBJbnN0YW5jZS0+cFRFQmlxdWFkLT5wcm9jZXNzKHBQcm9jZXNzZWQsIHBQcm9jZXNzZWQsIE5yRnJhbWVzKTsKKyAgICAgICAgICAgICAgICBmb3IgKGF1dG8gaSA9IDA7IGkgPCBOckNoYW5uZWxzICogTnJGcmFtZXM7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBwUHJvY2Vzc2VkW2ldID0gTFZNX0NsYW1wKHBQcm9jZXNzZWRbaV0pOworICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KLSNpZmRlZiBTVVBQT1JUX01DCiAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICogVm9sdW1lIGJhbGFuY2UKICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgTFZDX01peFNvZnRfMVN0X01DX2Zsb2F0X1NBVCgmcEluc3RhbmNlLT5WQ19CYWxhbmNlTWl4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5yQ2hhbm5lbHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDaE1hc2spOwotI2Vsc2UKLSAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgKiBWb2x1bWUgYmFsYW5jZQotICAgICAgICAgICAgICovCi0gICAgICAgICAgICBMVkNfTWl4U29mdF8xU3RfMmlfRDE2QzMxX1NBVCgmcEluc3RhbmNlLT5WQ19CYWxhbmNlTWl4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTYW1wbGVDb3VudCk7Ci0jZW5kaWYKKyAgICAgICAgICAgIExWQ19NaXhTb2Z0XzFTdF9NQ19mbG9hdF9TQVQoJnBJbnN0YW5jZS0+VkNfQmFsYW5jZU1peCwgcFByb2Nlc3NlZCwgcFByb2Nlc3NlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTnJGcmFtZXMsIE5yQ2hhbm5lbHMsIENoTWFzayk7CiAKICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgKiBQZXJmb3JtIFBhcmFtZXRyaWMgU3BlY3R1bSBBbmFseXNpcwogICAgICAgICAgICAgICovCiAgICAgICAgICAgICBpZiAoKHBJbnN0YW5jZS0+UGFyYW1zLlBTQV9FbmFibGUgPT0gTFZNX1BTQV9PTikgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBJbnN0YW5jZS0+SW5zdFBhcmFtcy5QU0FfSW5jbHVkZWQgPT0gTFZNX1BTQV9PTikpCi0gICAgICAgICAgICB7Ci0jaWZkZWYgU1VQUE9SVF9NQwotICAgICAgICAgICAgICAgIEZyb21NY1RvTW9ub19GbG9hdChwUHJvY2Vzc2VkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPnBQU0FJbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoTnJGcmFtZXMpLAorICAgICAgICAgICAgICAgIChwSW5zdGFuY2UtPkluc3RQYXJhbXMuUFNBX0luY2x1ZGVkID09IExWTV9QU0FfT04pKSB7CisgICAgICAgICAgICAgICAgRnJvbU1jVG9Nb25vX0Zsb2F0KHBQcm9jZXNzZWQsIHBJbnN0YW5jZS0+cFBTQUlucHV0LCAoTFZNX0lOVDE2KShOckZyYW1lcyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5yQ2hhbm5lbHMpOwotI2Vsc2UKLSAgICAgICAgICAgICAgICBGcm9tMmlUb01vbm9fRmxvYXQocFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcEluc3RhbmNlLT5wUFNBSW5wdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKFNhbXBsZUNvdW50KSk7Ci0jZW5kaWYKIAotICAgICAgICAgICAgICAgIExWUFNBX1Byb2Nlc3MocEluc3RhbmNlLT5oUFNBSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPnBQU0FJbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fVUlOVDE2KShTYW1wbGVDb3VudCksCi0gICAgICAgICAgICAgICAgICAgICAgICBBdWRpb1RpbWUpOworICAgICAgICAgICAgICAgIExWUFNBX1Byb2Nlc3MocEluc3RhbmNlLT5oUFNBSW5zdGFuY2UsIHBJbnN0YW5jZS0+cFBTQUlucHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9VSU5UMTYpKFNhbXBsZUNvdW50KSwgQXVkaW9UaW1lKTsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIERDIHJlbW92YWwKICAgICAgICAgICAgICAqLwotI2lmZGVmIFNVUFBPUlRfTUMKLSAgICAgICAgICAgIERDX01jX0QxNl9UUkNfV1JBXzAxKCZwSW5zdGFuY2UtPkRDX1JlbW92YWxJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwUHJvY2Vzc2VkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5yQ2hhbm5lbHMpOwotI2Vsc2UKLSAgICAgICAgICAgIERDXzJJX0QxNl9UUkNfV1JBXzAxKCZwSW5zdGFuY2UtPkRDX1JlbW92YWxJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwUHJvY2Vzc2VkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilTYW1wbGVDb3VudCk7Ci0jZW5kaWYKKyAgICAgICAgICAgIERDX01jX0QxNl9UUkNfV1JBXzAxKCZwSW5zdGFuY2UtPkRDX1JlbW92YWxJbnN0YW5jZSwgcFByb2Nlc3NlZCwgcFByb2Nlc3NlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnJGcmFtZXMsIE5yQ2hhbm5lbHMpOwogICAgICAgICB9CiAgICAgICAgIC8qCiAgICAgICAgICAqIE1hbmFnZSB0aGUgb3V0cHV0IGJ1ZmZlcgogICAgICAgICAgKi8KLSAgICAgICAgTFZNX0J1ZmZlck91dChoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgJlNhbXBsZUNvdW50KTsKLQorICAgICAgICBMVk1fQnVmZmVyT3V0KGhJbnN0YW5jZSwgcE91dERhdGEsICZTYW1wbGVDb3VudCk7CiAgICAgfQogCi0gICAgcmV0dXJuKExWTV9TVUNDRVNTKTsKKyAgICByZXR1cm4gKExWTV9TVUNDRVNTKTsKIH0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9CdW5kbGUvc3JjL0xWTV9UYWJsZXMuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0J1bmRsZS9zcmMvTFZNX1RhYmxlcy5jcHAKaW5kZXggNjYzOTJlMi4uODYwMTk2YiAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0J1bmRsZS9zcmMvTFZNX1RhYmxlcy5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0J1bmRsZS9zcmMvTFZNX1RhYmxlcy5jcHAKQEAgLTMwLDQzMSArMzAsMjk3IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotRk9fRkxPQVRfTFNoeF9Db2Vmc190ICAgIExWTV9UcmVibGVCb29zdENvZWZzW10gPSB7CitGT19GTE9BVF9MU2h4X0NvZWZzX3QgTFZNX1RyZWJsZUJvb3N0Q29lZnNbXSA9IHsKIAotICAgICAgICAgICAgICAgICAgICAvKiAyMmtIeiBzYW1wbGluZyByYXRlICovCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluMV9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDEgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczIyMDUwX0dhaW4xX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczIyMDUwX0dhaW4xX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczIyMDUwX0dhaW4yX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMiAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjJfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMjIwNTBfR2FpbjJfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMjIwNTBfR2FpbjNfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAzICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnMyMjA1MF9HYWluM19BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnMyMjA1MF9HYWluM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluNF9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDQgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczIyMDUwX0dhaW40X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczIyMDUwX0dhaW40X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczIyMDUwX0dhaW41X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgNSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjVfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMjIwNTBfR2FpbjVfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMjIwNTBfR2FpbjZfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyA2ICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnMyMjA1MF9HYWluNl9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnMyMjA1MF9HYWluNl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluN19BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDcgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczIyMDUwX0dhaW43X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczIyMDUwX0dhaW43X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczIyMDUwX0dhaW44X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgOCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjhfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMjIwNTBfR2FpbjhfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMjIwNTBfR2FpbjlfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyA5ICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnMyMjA1MF9HYWluOV9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnMyMjA1MF9HYWluOV9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluMTBfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjEwX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczIyMDUwX0dhaW4xMF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluMTFfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjExX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczIyMDUwX0dhaW4xMV9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluMTJfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMiAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjEyX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczIyMDUwX0dhaW4xMl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluMTNfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMyAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjEzX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczIyMDUwX0dhaW4xM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluMTRfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxNCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjE0X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczIyMDUwX0dhaW4xNF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluMTVfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxNSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjE1X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczIyMDUwX0dhaW4xNV9CMX0sCisgICAgICAgIC8qIDIya0h6IHNhbXBsaW5nIHJhdGUgKi8KKyAgICAgICAge0hQRl9GczIyMDUwX0dhaW4xX0ExLCAvKiBHYWluIHNldHRpbmcgMSAqLworICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjFfQTAsIC1IUEZfRnMyMjA1MF9HYWluMV9CMX0sCisgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluMl9BMSwgLyogR2FpbiBzZXR0aW5nIDIgKi8KKyAgICAgICAgIEhQRl9GczIyMDUwX0dhaW4yX0EwLCAtSFBGX0ZzMjIwNTBfR2FpbjJfQjF9LAorICAgICAgICB7SFBGX0ZzMjIwNTBfR2FpbjNfQTEsIC8qIEdhaW4gc2V0dGluZyAzICovCisgICAgICAgICBIUEZfRnMyMjA1MF9HYWluM19BMCwgLUhQRl9GczIyMDUwX0dhaW4zX0IxfSwKKyAgICAgICAge0hQRl9GczIyMDUwX0dhaW40X0ExLCAvKiBHYWluIHNldHRpbmcgNCAqLworICA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ICAgIHtIUEZfRnMyMjA1MF9HYWluMTJfQTEsIC8qIEdhaW4gc2V0dGluZyAxMiAqLworICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjEyX0EwLCAtSFBGX0ZzMjIwNTBfR2FpbjEyX0IxfSwKKyAgICAgICAge0hQRl9GczIyMDUwX0dhaW4xM19BMSwgLyogR2FpbiBzZXR0aW5nIDEzICovCisgICAgICAgICBIUEZfRnMyMjA1MF9HYWluMTNfQTAsIC1IUEZfRnMyMjA1MF9HYWluMTNfQjF9LAorICAgICAgICB7SFBGX0ZzMjIwNTBfR2FpbjE0X0ExLCAvKiBHYWluIHNldHRpbmcgMTQgKi8KKyAgICAgICAgIEhQRl9GczIyMDUwX0dhaW4xNF9BMCwgLUhQRl9GczIyMDUwX0dhaW4xNF9CMX0sCisgICAgICAgIHtIUEZfRnMyMjA1MF9HYWluMTVfQTEsIC8qIEdhaW4gc2V0dGluZyAxNSAqLworICAgICAgICAgSFBGX0ZzMjIwNTBfR2FpbjE1X0EwLCAtSFBGX0ZzMjIwNTBfR2FpbjE1X0IxfSwKIAotICAgICAgICAgICAgICAgICAgICAvKiAyNGtIeiBzYW1wbGluZyByYXRlICovCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluMV9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDEgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczI0MDAwX0dhaW4xX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczI0MDAwX0dhaW4xX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczI0MDAwX0dhaW4yX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMiAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjJfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMjQwMDBfR2FpbjJfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMjQwMDBfR2FpbjNfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAzICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnMyNDAwMF9HYWluM19BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnMyNDAwMF9HYWluM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluNF9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDQgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczI0MDAwX0dhaW40X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczI0MDAwX0dhaW40X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczI0MDAwX0dhaW41X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgNSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjVfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMjQwMDBfR2FpbjVfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMjQwMDBfR2FpbjZfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyA2ICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnMyNDAwMF9HYWluNl9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnMyNDAwMF9HYWluNl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluN19BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDcgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczI0MDAwX0dhaW43X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczI0MDAwX0dhaW43X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczI0MDAwX0dhaW44X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgOCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjhfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMjQwMDBfR2FpbjhfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMjQwMDBfR2FpbjlfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyA5ICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnMyNDAwMF9HYWluOV9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnMyNDAwMF9HYWluOV9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluMTBfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjEwX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczI0MDAwX0dhaW4xMF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluMTFfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjExX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczI0MDAwX0dhaW4xMV9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluMTJfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMiAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjEyX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczI0MDAwX0dhaW4xMl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluMTNfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMyAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjEzX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczI0MDAwX0dhaW4xM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluMTRfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxNCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjE0X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczI0MDAwX0dhaW4xNF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluMTVfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxNSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjE1X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczI0MDAwX0dhaW4xNV9CMX0sCisgICAgICAgIC8qIDI0a0h6IHNhbXBsaW5nIHJhdGUgKi8KKyAgICAgICAge0hQRl9GczI0MDAwX0dhaW4xX0ExLCAvKiBHYWluIHNldHRpbmcgMSAqLworICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjFfQTAsIC1IUEZfRnMyNDAwMF9HYWluMV9CMX0sCisgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluMl9BMSwgLyogR2FpbiBzZXR0aW5nIDIgKi8KKyAgICAgICAgIEhQRl9GczI0MDAwX0dhaW4yX0EwLCAtSFBGX0ZzMjQwMDBfR2FpbjJfQjF9LAorICAgICAgICB7SFBGX0ZzMjQwMDBfR2FpbjNfQTEsIC8qIEdhaW4gc2V0dGluZyAzICovCisgICAgICAgICBIUEZfRnMyNDAwMF9HYWluM19BMCwgLUhQRl9GczI0MDAwX0dhaW4zX0IxfSwKKyAgICAgICAge0hQRl9GczI0MDAwX0dhaW40X0ExLCAvKiBHYWluIHNldHRpbmcgNCAqLworICAgICAgICAgSFBGX0ZzMjQwMDBfR2F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TJfQTEsIC8qIEdhaW4gc2V0dGluZyAxMiAqLworICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjEyX0EwLCAtSFBGX0ZzMjQwMDBfR2FpbjEyX0IxfSwKKyAgICAgICAge0hQRl9GczI0MDAwX0dhaW4xM19BMSwgLyogR2FpbiBzZXR0aW5nIDEzICovCisgICAgICAgICBIUEZfRnMyNDAwMF9HYWluMTNfQTAsIC1IUEZfRnMyNDAwMF9HYWluMTNfQjF9LAorICAgICAgICB7SFBGX0ZzMjQwMDBfR2FpbjE0X0ExLCAvKiBHYWluIHNldHRpbmcgMTQgKi8KKyAgICAgICAgIEhQRl9GczI0MDAwX0dhaW4xNF9BMCwgLUhQRl9GczI0MDAwX0dhaW4xNF9CMX0sCisgICAgICAgIHtIUEZfRnMyNDAwMF9HYWluMTVfQTEsIC8qIEdhaW4gc2V0dGluZyAxNSAqLworICAgICAgICAgSFBGX0ZzMjQwMDBfR2FpbjE1X0EwLCAtSFBGX0ZzMjQwMDBfR2FpbjE1X0IxfSwKIAotICAgICAgICAgICAgICAgICAgICAvKiAzMmtIeiBzYW1wbGluZyByYXRlICovCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluMV9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDEgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczMyMDAwX0dhaW4xX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczMyMDAwX0dhaW4xX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczMyMDAwX0dhaW4yX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMiAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjJfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMzIwMDBfR2FpbjJfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMzIwMDBfR2FpbjNfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAzICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnMzMjAwMF9HYWluM19BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnMzMjAwMF9HYWluM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluNF9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDQgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczMyMDAwX0dhaW40X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczMyMDAwX0dhaW40X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczMyMDAwX0dhaW41X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgNSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjVfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMzIwMDBfR2FpbjVfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMzIwMDBfR2FpbjZfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyA2ICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnMzMjAwMF9HYWluNl9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnMzMjAwMF9HYWluNl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluN19BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDcgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczMyMDAwX0dhaW43X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczMyMDAwX0dhaW43X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczMyMDAwX0dhaW44X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgOCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjhfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMzIwMDBfR2FpbjhfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMzIwMDBfR2FpbjlfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyA5ICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnMzMjAwMF9HYWluOV9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnMzMjAwMF9HYWluOV9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluMTBfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjEwX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczMyMDAwX0dhaW4xMF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluMTFfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjExX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczMyMDAwX0dhaW4xMV9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluMTJfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMiAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjEyX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczMyMDAwX0dhaW4xMl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluMTNfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMyAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjEzX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczMyMDAwX0dhaW4xM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluMTRfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxNCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjE0X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczMyMDAwX0dhaW4xNF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluMTVfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxNSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjE1X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczMyMDAwX0dhaW4xNV9CMX0sCisgICAgICAgIC8qIDMya0h6IHNhbXBsaW5nIHJhdGUgKi8KKyAgICAgICAge0hQRl9GczMyMDAwX0dhaW4xX0ExLCAvKiBHYWluIHNldHRpbmcgMSAqLworICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjFfQTAsIC1IUEZfRnMzMjAwMF9HYWluMV9CMX0sCisgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluMl9BMSwgLyogR2FpbiBzZXR0aW5nIDIgKi8KKyAgICAgICAgIEhQRl9GczMyMDAwX0dhaW4yX0EwLCAtSFBGX0ZzMzIwMDBfR2FpbjJfQjF9LAorICAgICAgICB7SFBGX0ZzMzIwMDBfR2FpbjNfQTEsIC8qIEdhaW4gc2V0dGluZyAzICovCisgICAgICAgICBIUEZfRnMzMjAwMF9HYWluM19BMCwgLUhQRl9GczMyMDAwX0dhaW4zX0IxfSwKKyAgICAgICAge0hQRl9GczMyMDAwX0dhaW40X0ExLCAvKiBHYWluIHNldHRpbmcgNCAqLworICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjRfQTAsIC1IUEZfRnMzMjAwMF9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AxMiAqLworICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjEyX0EwLCAtSFBGX0ZzMzIwMDBfR2FpbjEyX0IxfSwKKyAgICAgICAge0hQRl9GczMyMDAwX0dhaW4xM19BMSwgLyogR2FpbiBzZXR0aW5nIDEzICovCisgICAgICAgICBIUEZfRnMzMjAwMF9HYWluMTNfQTAsIC1IUEZfRnMzMjAwMF9HYWluMTNfQjF9LAorICAgICAgICB7SFBGX0ZzMzIwMDBfR2FpbjE0X0ExLCAvKiBHYWluIHNldHRpbmcgMTQgKi8KKyAgICAgICAgIEhQRl9GczMyMDAwX0dhaW4xNF9BMCwgLUhQRl9GczMyMDAwX0dhaW4xNF9CMX0sCisgICAgICAgIHtIUEZfRnMzMjAwMF9HYWluMTVfQTEsIC8qIEdhaW4gc2V0dGluZyAxNSAqLworICAgICAgICAgSFBGX0ZzMzIwMDBfR2FpbjE1X0EwLCAtSFBGX0ZzMzIwMDBfR2FpbjE1X0IxfSwKIAotICAgICAgICAgICAgICAgICAgICAvKiA0NGtIeiBzYW1wbGluZyByYXRlICovCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0NDEwMF9HYWluMV9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDEgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW4xX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ0MTAwX0dhaW4xX0IxLH0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0NDEwMF9HYWluMl9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDIgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW4yX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ0MTAwX0dhaW4yX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczQ0MTAwX0dhaW4zX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMyAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDQxMDBfR2FpbjNfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzNDQxMDBfR2FpbjNfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDQxMDBfR2FpbjRfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyA0ICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnM0NDEwMF9HYWluNF9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0NDEwMF9HYWluNF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0NDEwMF9HYWluNV9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDUgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW41X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ0MTAwX0dhaW41X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczQ0MTAwX0dhaW42X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgNiAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDQxMDBfR2FpbjZfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzNDQxMDBfR2FpbjZfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDQxMDBfR2FpbjdfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyA3ICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnM0NDEwMF9HYWluN19BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0NDEwMF9HYWluN19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0NDEwMF9HYWluOF9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDggKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW44X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ0MTAwX0dhaW44X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczQ0MTAwX0dhaW45X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgOSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDQxMDBfR2FpbjlfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzNDQxMDBfR2FpbjlfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDQxMDBfR2FpbjEwX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMTAgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW4xMF9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0NDEwMF9HYWluMTBfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDQxMDBfR2FpbjExX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMTEgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW4xMV9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0NDEwMF9HYWluMTFfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDQxMDBfR2FpbjEyX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMTIgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW4xMl9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0NDEwMF9HYWluMTJfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDQxMDBfR2FpbjEzX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMTMgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW4xM19BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0NDEwMF9HYWluMTNfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDQxMDBfR2FpbjE0X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMTQgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW4xNF9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0NDEwMF9HYWluMTRfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDQxMDBfR2FpbjE1X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMTUgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW4xNV9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0NDEwMF9HYWluMTVfQjF9LAorICAgICAgICAvKiA0NGtIeiBzYW1wbGluZyByYXRlICovCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICBIUEZfRnM0NDEwMF9HYWluMV9BMSwgLyogR2FpbiBzZXR0aW5nIDEgKi8KKyAgICAgICAgICAgICAgICBIUEZfRnM0NDEwMF9HYWluMV9BMCwKKyAgICAgICAgICAgICAgICAtSFBGX0ZzNDQxMDBfR2FpbjFfQjEsCisgICAgICAgIH0sCisgICAgICAgIHtIUEZfRnM0NDEwMF9HYWluMl9BMSwgLyogR2FpbiBzZXR0aW5nIDIgKi8KKyAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW4yX0EwLCAtSFBGX0ZzNDQxMDBfR2FpbjJfQjF9LAorICAgICAgICB7SFBGX0ZzNDQxMDBfR2FpbjNfQTEsIC8qIEdhaW4gc2V0dGluZyAzICovCisgICAgICAgICBIUEZfRnM0NDEwMF9HYWluM19BMCwgLUhQRl9GczQ0MTAwX0dhaW4zX0IxfSwKKyAgICAgICAge0hQRl9GczQ0MTAwX0dhaW40X0ExLCAvKiBHYWluIHNldHRpbmcgNCAqLworICA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0sCisgICAgICAgIHtIUEZfRnM0NDEwMF9HYWluMTJfQTEsIC8qIEdhaW4gc2V0dGluZyAxMiAqLworICAgICAgICAgSFBGX0ZzNDQxMDBfR2FpbjEyX0EwLCAtSFBGX0ZzNDQxMDBfR2FpbjEyX0IxfSwKKyAgICAgICAge0hQRl9GczQ0MTAwX0dhaW4xM19BMSwgLyogR2FpbiBzZXR0aW5nIDEzICovCisgICAgICAgICBIUEZfRnM0NDEwMF9HYWluMTNfQTAsIC1IUEZfRnM0NDEwMF9HYWluMTNfQjF9LAorICAgICAgICB7SFBGX0ZzNDQxMDBfR2FpbjE0X0ExLCAvKiBHYWluIHNldHRpbmcgMTQgKi8KKyAgICAgICAgIEhQRl9GczQ0MTAwX0dhaW4xNF9BMCwgLUhQRl9GczQ0MTAwX0dhaW4xNF9CMX0sCisgICAgICAgIHtIUEZfRnM0NDEwMF9HYWluMTVfQTEsIC8qIEdhaW4gc2V0dGluZyAxNSAqLworICAgICAgICAgSFBGX0ZzNDQxMDBfR2FpbjE1X0EwLCAtSFBGX0ZzNDQxMDBfR2FpbjE1X0IxfSwKIAotICAgICAgICAgICAgICAgICAgICAvKiA0OGtIeiBzYW1wbGluZyByYXRlICovCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0ODAwMF9HYWluMV9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDEgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ4MDAwX0dhaW4xX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ4MDAwX0dhaW4xX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczQ4MDAwX0dhaW4yX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMiAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDgwMDBfR2FpbjJfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzNDgwMDBfR2FpbjJfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDgwMDBfR2FpbjNfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAzICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnM0ODAwMF9HYWluM19BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0ODAwMF9HYWluM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0ODAwMF9HYWluNF9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDQgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ4MDAwX0dhaW40X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ4MDAwX0dhaW40X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczQ4MDAwX0dhaW41X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgNSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDgwMDBfR2FpbjVfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzNDgwMDBfR2FpbjVfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDgwMDBfR2FpbjZfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyA2ICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnM0ODAwMF9HYWluNl9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0ODAwMF9HYWluNl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0ODAwMF9HYWluN19BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDcgKi8KLSAgICAgICAgICAgICAgICAgICAgIEhQRl9GczQ4MDAwX0dhaW43X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ4MDAwX0dhaW43X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczQ4MDAwX0dhaW44X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgOCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDgwMDBfR2FpbjhfQTAsCi0gICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzNDgwMDBfR2FpbjhfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzNDgwMDBfR2FpbjlfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyA5ICovCi0gICAgICAgICAgICAgICAgICAgICBIUEZfRnM0ODAwMF9HYWluOV9BMCwKLSAgICAgICAgICAgICAgICAgICAgIC1IUEZfRnM0ODAwMF9HYWluOV9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0ODAwMF9HYWluMTBfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDgwMDBfR2FpbjEwX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ4MDAwX0dhaW4xMF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0ODAwMF9HYWluMTFfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDgwMDBfR2FpbjExX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ4MDAwX0dhaW4xMV9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0ODAwMF9HYWluMTJfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMiAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDgwMDBfR2FpbjEyX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ4MDAwX0dhaW4xMl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0ODAwMF9HYWluMTNfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMyAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDgwMDBfR2FpbjEzX0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ4MDAwX0dhaW4xM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0ODAwMF9HYWluMTRfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxNCAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDgwMDBfR2FpbjE0X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ4MDAwX0dhaW4xNF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM0ODAwMF9HYWluMTVfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxNSAqLwotICAgICAgICAgICAgICAgICAgICAgSFBGX0ZzNDgwMDBfR2FpbjE1X0EwLAotICAgICAgICAgICAgICAgICAgICAgLUhQRl9GczQ4MDAwX0dhaW4xNV9CMX0KLSAgICAgICAgICAgICAgICAgICAgLAotICAgICAgICAgICAgICAgICAgICAvKiA4OGtIeiBTYW1wbGluZyByYXRlICovCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM4ODIwMF9HYWluMV9BMSwgICAgICAgICAgICAgLyogR2FpbiBTZXR0aW5nICAxICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9Gczg4MjAwX0dhaW4xX0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzODgyMDBfR2FpbjFfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzODgyMDBfR2FpbjJfQTEsICAgICAgICAgICAgIC8qIEdhaW4gU2V0dGluZyAgMiAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM4ODIwMF9HYWluMl9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczg4MjAwX0dhaW4yX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczg4MjAwX0dhaW4zX0ExLCAgICAgICAgICAgICAvKiBHYWluIFNldHRpbmcgIDMgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzODgyMDBfR2FpbjNfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnM4ODIwMF9HYWluM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM4ODIwMF9HYWluNF9BMSwgICAgICAgICAgICAgLyogR2FpbiBTZXR0aW5nICA0ICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9Gczg4MjAwX0dhaW40X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzODgyMDBfR2FpbjRfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzODgyMDBfR2FpbjVfQTEsICAgICAgICAgICAgIC8qIEdhaW4gU2V0dGluZyAgNSAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM4ODIwMF9HYWluNV9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczg4MjAwX0dhaW41X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczg4MjAwX0dhaW42X0ExLCAgICAgICAgICAgICAvKiBHYWluIFNldHRpbmcgIDYgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzODgyMDBfR2FpbjZfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnM4ODIwMF9HYWluNl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM4ODIwMF9HYWluN19BMSwgICAgICAgICAgICAgLyogR2FpbiBTZXR0aW5nICA3ICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9Gczg4MjAwX0dhaW43X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzODgyMDBfR2FpbjdfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzODgyMDBfR2FpbjhfQTEsICAgICAgICAgICAgIC8qIEdhaW4gU2V0dGluZyAgOCAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM4ODIwMF9HYWluOF9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczg4MjAwX0dhaW44X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczg4MjAwX0dhaW45X0ExLCAgICAgICAgICAgICAvKiBHYWluIFNldHRpbmcgIDkgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzODgyMDBfR2FpbjlfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnM4ODIwMF9HYWluOV9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM4ODIwMF9HYWluMTBfQTEsICAgICAgICAgICAgIC8qIEdhaW4gU2V0dGluZyAgMTAgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzODgyMDBfR2FpbjEwX0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzODgyMDBfR2FpbjEwX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczg4MjAwX0dhaW4xMV9BMSwgICAgICAgICAgICAgLyogR2FpbiBTZXR0aW5nICAxMSAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM4ODIwMF9HYWluMTFfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnM4ODIwMF9HYWluMTFfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzODgyMDBfR2FpbjEyX0ExLCAgICAgICAgICAgICAvKiBHYWluIFNldHRpbmcgIDEyICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9Gczg4MjAwX0dhaW4xMl9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczg4MjAwX0dhaW4xMl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM4ODIwMF9HYWluMTNfQTEsICAgICAgICAgICAgIC8qIEdhaW4gU2V0dGluZyAgMTMgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzODgyMDBfR2FpbjEzX0EwLAotICAgICAgIC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gICAgICB7SFBGX0ZzODgyMDBfR2FpbjEyX0ExLCAvKiBHYWluIFNldHRpbmcgIDEyICovCisgICAgICAgICBIUEZfRnM4ODIwMF9HYWluMTJfQTAsIC1IUEZfRnM4ODIwMF9HYWluMTJfQjF9LAorICAgICAgICB7SFBGX0ZzODgyMDBfR2FpbjEzX0ExLCAvKiBHYWluIFNldHRpbmcgIDEzICovCisgICAgICAgICBIUEZfRnM4ODIwMF9HYWluMTNfQTAsIC1IUEZfRnM4ODIwMF9HYWluMTNfQjF9LAorICAgICAgICB7SFBGX0ZzODgyMDBfR2FpbjE0X0ExLCAvKiBHYWluIFNldHRpbmcgIDE0ICovCisgICAgICAgICBIUEZfRnM4ODIwMF9HYWluMTRfQTAsIC1IUEZfRnM4ODIwMF9HYWluMTRfQjF9LAorICAgICAgICB7SFBGX0ZzODgyMDBfR2FpbjE1X0ExLCAvKiBHYWluIFNldHRpbmcgIDE1ICovCisgICAgICAgICBIUEZfRnM4ODIwMF9HYWluMTVfQTAsIC1IUEZfRnM4ODIwMF9HYWluMTVfQjF9LAogCi0gICAgICAgICAgICAgICAgICAgIC8qIDk2a0h6IHNhbXBsaW5nIHJhdGUgKi8KLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW4xX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMSAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM5NjAwMF9HYWluMV9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczk2MDAwX0dhaW4xX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW4yX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMiAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM5NjAwMF9HYWluMl9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczk2MDAwX0dhaW4yX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW4zX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMyAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM5NjAwMF9HYWluM19BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczk2MDAwX0dhaW4zX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW40X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgNCAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM5NjAwMF9HYWluNF9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczk2MDAwX0dhaW40X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW41X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgNSAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM5NjAwMF9HYWluNV9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczk2MDAwX0dhaW41X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW42X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgNiAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM5NjAwMF9HYWluNl9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczk2MDAwX0dhaW42X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW43X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgNyAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM5NjAwMF9HYWluN19BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczk2MDAwX0dhaW43X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW44X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgOCAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM5NjAwMF9HYWluOF9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczk2MDAwX0dhaW44X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW45X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgOSAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM5NjAwMF9HYWluOV9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczk2MDAwX0dhaW45X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW4xMF9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDEwICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9Gczk2MDAwX0dhaW4xMF9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9Gczk2MDAwX0dhaW4xMF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnM5NjAwMF9HYWluMTFfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMSAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnM5NjAwMF9HYWluMTFfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnM5NjAwMF9HYWluMTFfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzOTYwMDBfR2FpbjEyX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMTIgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzOTYwMDBfR2FpbjEyX0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzOTYwMDBfR2FpbjEyX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9Gczk2MDAwX0dhaW4xM19BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDEzICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9Gczk2MDAwX0dhaW4xM19BMCwKLSAgICAgICA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W5nIDEyICovCisgICAgICAgICBIUEZfRnM5NjAwMF9HYWluMTJfQTAsIC1IUEZfRnM5NjAwMF9HYWluMTJfQjF9LAorICAgICAgICB7SFBGX0ZzOTYwMDBfR2FpbjEzX0ExLCAvKiBHYWluIHNldHRpbmcgMTMgKi8KKyAgICAgICAgIEhQRl9Gczk2MDAwX0dhaW4xM19BMCwgLUhQRl9Gczk2MDAwX0dhaW4xM19CMX0sCisgICAgICAgIHtIUEZfRnM5NjAwMF9HYWluMTRfQTEsIC8qIEdhaW4gc2V0dGluZyAxNCAqLworICAgICAgICAgSFBGX0ZzOTYwMDBfR2FpbjE0X0EwLCAtSFBGX0ZzOTYwMDBfR2FpbjE0X0IxfSwKKyAgICAgICAge0hQRl9Gczk2MDAwX0dhaW4xNV9BMSwgLyogR2FpbiBzZXR0aW5nIDE1ICovCisgICAgICAgICBIUEZfRnM5NjAwMF9HYWluMTVfQTAsIC1IUEZfRnM5NjAwMF9HYWluMTVfQjF9LAogCi0gICAgICAgICAgICAgICAgICAgIC8qIDE3NmtIeiBTYW1wbGluZyByYXRlICovCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMxNzY0MDBfR2FpbjFfQTEsICAgICAgICAgICAgIC8qIEdhaW4gU2V0dGluZyAgMSAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnMxNzY0MDBfR2FpbjFfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnMxNzY0MDBfR2FpbjFfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMTc2NDAwX0dhaW4yX0ExLCAgICAgICAgICAgICAvKiBHYWluIFNldHRpbmcgIDIgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTc2NDAwX0dhaW4yX0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTc2NDAwX0dhaW4yX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE3NjQwMF9HYWluM19BMSwgICAgICAgICAgICAgLyogR2FpbiBTZXR0aW5nICAzICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9GczE3NjQwMF9HYWluM19BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9GczE3NjQwMF9HYWluM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMxNzY0MDBfR2FpbjRfQTEsICAgICAgICAgICAgIC8qIEdhaW4gU2V0dGluZyAgNCAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnMxNzY0MDBfR2FpbjRfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnMxNzY0MDBfR2FpbjRfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMTc2NDAwX0dhaW41X0ExLCAgICAgICAgICAgICAvKiBHYWluIFNldHRpbmcgIDUgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTc2NDAwX0dhaW41X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTc2NDAwX0dhaW41X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE3NjQwMF9HYWluNl9BMSwgICAgICAgICAgICAgLyogR2FpbiBTZXR0aW5nICA2ICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9GczE3NjQwMF9HYWluNl9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9GczE3NjQwMF9HYWluNl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMxNzY0MDBfR2FpbjdfQTEsICAgICAgICAgICAgIC8qIEdhaW4gU2V0dGluZyAgNyAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnMxNzY0MDBfR2FpbjdfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnMxNzY0MDBfR2FpbjdfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMTc2NDAwX0dhaW44X0ExLCAgICAgICAgICAgICAvKiBHYWluIFNldHRpbmcgIDggKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTc2NDAwX0dhaW44X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTc2NDAwX0dhaW44X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE3NjQwMF9HYWluOV9BMSwgICAgICAgICAgICAgLyogR2FpbiBTZXR0aW5nICA5ICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9GczE3NjQwMF9HYWluOV9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9GczE3NjQwMF9HYWluOV9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMxNzY0MDBfR2FpbjEwX0ExLCAgICAgICAgICAgICAvKiBHYWluIFNldHRpbmcgIDEwICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9GczE3NjQwMF9HYWluMTBfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnMxNzY0MDBfR2FpbjEwX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE3NjQwMF9HYWluMTFfQTEsICAgICAgICAgICAgIC8qIEdhaW4gU2V0dGluZyAgMTEgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTc2NDAwX0dhaW4xMV9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9GczE3NjQwMF9HYWluMTFfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMTc2NDAwX0dhaW4xMl9BMSwgICAgICAgICAgICAgLyogR2FpbiBTZXR0aW5nICAxMiAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnMxNzY0MDBfR2FpbjEyX0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTc2NDAwX0dhaW4xMl9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMxNzY0MDBfR2FpbjEzX0ExLCAgICAgICAgICAgICAvKiBHYWluIFNldHRpbmcgIDEzICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9GczE3NjQwMF9HYWluMTNfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnMxNzY0MDBfR2FpbjEzX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE3NjQwMF9HYWluMTRfQTEsICAgICAgICAgICAgIC8qIEdhaW4gU2V0dGluZyAgMTQgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTc2NDAwX0dhaW4xNF9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9GczE3NjQwMF9HYWluMTRfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMTc2NDAwX0dhaW4xNV9BMSwgICAgICAgICAgICAgLyogR2FpbiBTZXR0aW5nICAxNSAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnMxNzY0MDBfR2FpbjE1X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTc2NDAwX0dhaW4xNV9CMX0sCisgICAgICAgIC8qIDE3NmtIeiBTYW1wbGluZyByYXRlICovCisgICAgICAgIHtIUEZfRnMxNzY0MDBfR2FpbjFfQTEsIC8qIEdhaW4gU2V0dGluZyAgMSAqLworICAgICAgICAgSFBGX0ZzMTc2NDAwX0dhaW4xX0EwLCAtSFBGX0ZzMTc2NDAwX0dhaW4xX0IxfSwKKyAgICAgICAge0hQRl9GczE3NjQwMF9HYWluMl9BMSwgLyogR2FpbiBTZXR0aW5nICAyICovCisgICAgICAgICBIUEZfRnMxNzY0MDBfR2FpbjJfQTAsIC1IUEZfRnMxNzY0MDBfR2FpbjJfQjF9LAorICAgICAgICB7SFBGX0ZzMTc2NDAwX0dhaW4zX0ExLCAvKiBHYWluIFNldHRpbmcgIDMgKi8KKyAgICAgICAgIEhQRl9GczE3NjQwMF9HYWluM19BMCwgLUhQRl9GczE3NjQwMF9HYWluM19CMX0sCisgICAgICAgIHtIUEZfRnMxNzY0MDBfR2FpbjRfQTEsIC8qIEdhaW4gU2V0dGluZyAgNCAqLworICAgICAgICAgSFBGX0Z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SFBGX0ZzMTkyMDAwX0dhaW4yX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE5MjAwMF9HYWluM19BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDMgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW4zX0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTkyMDAwX0dhaW4zX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE5MjAwMF9HYWluNF9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDQgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW40X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTkyMDAwX0dhaW40X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE5MjAwMF9HYWluNV9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDUgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW41X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTkyMDAwX0dhaW41X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE5MjAwMF9HYWluNl9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDYgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW42X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTkyMDAwX0dhaW42X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE5MjAwMF9HYWluN19BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDcgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW43X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTkyMDAwX0dhaW43X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE5MjAwMF9HYWluOF9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDggKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW44X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTkyMDAwX0dhaW44X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE5MjAwMF9HYWluOV9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDkgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW45X0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTkyMDAwX0dhaW45X0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE5MjAwMF9HYWluMTBfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMCAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnMxOTIwMDBfR2FpbjEwX0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTkyMDAwX0dhaW4xMF9CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMxOTIwMDBfR2FpbjExX0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMTEgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW4xMV9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9GczE5MjAwMF9HYWluMTFfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMTkyMDAwX0dhaW4xMl9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDEyICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9GczE5MjAwMF9HYWluMTJfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnMxOTIwMDBfR2FpbjEyX0IxfSwKLSAgICAgICAgICAgICAgICAgICAge0hQRl9GczE5MjAwMF9HYWluMTNfQTEsICAgICAgICAgICAgIC8qIEdhaW4gc2V0dGluZyAxMyAqLwotICAgICAgICAgICAgICAgICAgICBIUEZfRnMxOTIwMDBfR2FpbjEzX0EwLAotICAgICAgICAgICAgICAgICAgICAtSFBGX0ZzMTkyMDAwX0dhaW4xM19CMX0sCi0gICAgICAgICAgICAgICAgICAgIHtIUEZfRnMxOTIwMDBfR2FpbjE0X0ExLCAgICAgICAgICAgICAvKiBHYWluIHNldHRpbmcgMTQgKi8KLSAgICAgICAgICAgICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW4xNF9BMCwKLSAgICAgICAgICAgICAgICAgICAgLUhQRl9GczE5MjAwMF9HYWluMTRfQjF9LAotICAgICAgICAgICAgICAgICAgICB7SFBGX0ZzMTkyMDAwX0dhaW4xNV9BMSwgICAgICAgICAgICAgLyogR2FpbiBzZXR0aW5nIDE1ICovCi0gICAgICAgICAgICAgICAgICAgIEhQRl9GczE5MjAwMF9HYWluMTVfQTAsCi0gICAgICAgICAgICAgICAgICAgIC1IUEZfRnMxOTIwMDBfR2FpbjE1X0IxfQotICAgICAgICAgICAgICAgICAgICB9OworICAgICAgICAvKiAxOTJrSHogc2FtcGxpbmcgcmF0ZSAqLworICAgICAgICB7SFBGX0ZzMTkyMDAwX0dhaW4xX0ExLCAvKiBHYWluIHNldHRpbmcgMSAqLworICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW4xX0EwLCAtSFBGX0ZzMTkyMDAwX0dhaW4xX0IxfSwKKyAgICAgICAge0hQRl9GczE5MjAwMF9HYWluMl9BMSwgLyogR2FpbiBzZXR0aW5nIDIgKi8KKyAgICAgICAgIEhQRl9GczE5MjAwMF9HYWluMl9BMCwgLUhQRl9GczE5MjAwMF9HYWluMl9CMX0sCisgICAgICAgIHtIUEZfRnMxOTIwMDBfR2FpbjNfQTEsIC8qIEdhaW4gc2V0dGluZyAzICovCisgICAgICAgICBIUEZfRnMxOTIwMDBfR2FpbjNfQTAsIC1IUEZfR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IwMDBfR2FpbjExX0ExLCAvKiBHYWluIHNldHRpbmcgMTEgKi8KKyAgICAgICAgIEhQRl9GczE5MjAwMF9HYWluMTFfQTAsIC1IUEZfRnMxOTIwMDBfR2FpbjExX0IxfSwKKyAgICAgICAge0hQRl9GczE5MjAwMF9HYWluMTJfQTEsIC8qIEdhaW4gc2V0dGluZyAxMiAqLworICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW4xMl9BMCwgLUhQRl9GczE5MjAwMF9HYWluMTJfQjF9LAorICAgICAgICB7SFBGX0ZzMTkyMDAwX0dhaW4xM19BMSwgLyogR2FpbiBzZXR0aW5nIDEzICovCisgICAgICAgICBIUEZfRnMxOTIwMDBfR2FpbjEzX0EwLCAtSFBGX0ZzMTkyMDAwX0dhaW4xM19CMX0sCisgICAgICAgIHtIUEZfRnMxOTIwMDBfR2FpbjE0X0ExLCAvKiBHYWluIHNldHRpbmcgMTQgKi8KKyAgICAgICAgIEhQRl9GczE5MjAwMF9HYWluMTRfQTAsIC1IUEZfRnMxOTIwMDBfR2FpbjE0X0IxfSwKKyAgICAgICAge0hQRl9GczE5MjAwMF9HYWluMTVfQTEsIC8qIEdhaW4gc2V0dGluZyAxNSAqLworICAgICAgICAgSFBGX0ZzMTkyMDAwX0dhaW4xNV9BMCwgLUhQRl9GczE5MjAwMF9HYWluMTVfQjF9fTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTQ2MywxNCArMzI5LDEzIEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCiAvKiBkQiB0byBsaW5lYXIgY29udmVyc2lvbiB0YWJsZSAqLwotY29uc3QgTFZNX0ZMT0FUIExWTV9Wb2x1bWVUYWJsZVtdID0gewotICAgIDEuMDAwZiwgICAgICAgICAgICAgLyogIDBkQiAqLwotICAgIDAuODkxZiwgICAgICAgICAgICAgLyogLTFkQiAqLwotICAgIDAuNzk0ZiwgICAgICAgICAgICAgLyogLTJkQiAqLwotICAgIDAuNzA4ZiwgICAgICAgICAgICAgLyogLTNkQiAqLwotICAgIDAuNjMxZiwgICAgICAgICAgICAgLyogLTRkQiAqLwotICAgIDAuNTYyZiwgICAgICAgICAgICAgLyogLTVkQiAqLwotICAgIDAuNTAxZn07ICAgICAgICAgICAgLyogLTZkQiAqLworY29uc3QgTFZNX0ZMT0FUIExWTV9Wb2x1bWVUYWJsZVtdID0gezEuMDAwZiwgIC8qICAwZEIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjg5MWYsICAvKiAtMWRCICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC43OTRmLCAgLyogLTJkQiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuNzA4ZiwgIC8qIC0zZEIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjYzMWYsICAvKiAtNGRCICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC41NjJmLCAgLyogLTVkQiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuNTAxZn07IC8qIC02ZEIgKi8KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC00NzgsMjQgKzM0MywxNiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSNkZWZpbmUgTFZNX01JWF9UQ19GczgwMDAgICAgICAzMjU4MCAgICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuOTk0MjYyNjk1ICovCi0jZGVmaW5lIExWTV9NSVhfVENfRnMxMTAyNSAgICAgMzI2MzIgICAgICAgICAvKiBGbG9hdGluZyBwb2ludCB2YWx1ZSAwLjk5NTg0OTYwOSAqLwotI2RlZmluZSBMVk1fTUlYX1RDX0ZzMTIwMDAgICAgIDMyNjQzICAgICAgICAgLyogRmxvYXRpbmcgcG9pbnQgdmFsdWUgMC45OTYxODUzMDMgKi8KLSNkZWZpbmUgTFZNX01JWF9UQ19GczE2MDAwICAgICAzMjY3NCAgICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuOTk3MTMxMzQ4ICovCi0jZGVmaW5lIExWTV9NSVhfVENfRnMyMjA1MCAgICAgMzI3MDAgICAgICAgICAvKiBGbG9hdGluZyBwb2ludCB2YWx1ZSAwLjk5NzkyNDgwNSAqLwotI2RlZmluZSBMVk1fTUlYX1RDX0ZzMjQwMDAgICAgIDMyNzA1ICAgICAgICAgLyogRmxvYXRpbmcgcG9pbnQgdmFsdWUgMC45OTgwNzczOTMgKi8KLSNkZWZpbmUgTFZNX01JWF9UQ19GczMyMDAwICAgICAzMjcyMSAgICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuOTk4NTY1Njc0ICovCi0jZGVmaW5lIExWTV9NSVhfVENfRnM0NDEwMCAgICAgMzI3MzQgICAgICAgICAvKiBGbG9hdGluZyBwb2ludCB2YWx1ZSAwLjk5ODk2MjQwMiAqLwotI2Rl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ICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotZXh0ZXJuIEZPX0ZMT0FUX0xTaHhfQ29lZnNfdCAgICAgTFZNX1RyZWJsZUJvb3N0Q29lZnNbXTsKK2V4dGVybiBGT19GTE9BVF9MU2h4X0NvZWZzX3QgTFZNX1RyZWJsZUJvb3N0Q29lZnNbXTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC00NSw0ICs0NSwzIEBACiBleHRlcm4gY29uc3QgTFZNX0lOVDE2IExWTV9NaXhlclRDVGFibGVbXTsKIAogI2VuZGlmIC8qIF9fTFZNX1RBQkxFU19IX18gKi8KLQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9saWIvQUdDLmggYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9BR0MuaAppbmRleCBiZWY3ZmExLi4zMWM4MjAwIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9BR0MuaAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9BR0MuaApAQCAtMzEsMTYgKzMxLDE1IEBACiAvKiAgICBUeXBlcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9GTE9BVCAgQUdDX0dhaW47ICAgICAgICAgICAgICAgICAgICAgICAgLyogVGhlIGN1cnJlbnQgQUdDIGdhaW4gKi8KLSAgICBMVk1fRkxPQVQgIEFHQ19NYXhHYWluOyAgICAgICAgICAgICAgICAgICAgIC8qIFRoZSBtYXhpbXVtIEFHQyBnYWluICovCi0gICAgTFZNX0ZMT0FUICBWb2x1bWU7ICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBUaGUgY3VycmVudCB2b2x1bWUgc2V0dGluZyAqLwotICAgIExWTV9GTE9BVCAgVGFyZ2V0OyAgICAgICAgICAgICAgICAgICAgICAgICAgLyogVGhlIHRhcmdldCB2b2x1bWUgc2V0dGluZyAqLwotICAgIExWTV9GTE9BVCAgQUdDX1RhcmdldDsgICAgICAgICAgICAgICAgICAgICAgLyogQUdDIHRhcmdldCBsZXZlbCAqLwotICAgIExWTV9GTE9BVCAgQUdDX0F0dGFjazsgICAgICAgICAgICAgICAgICAgICAgLyogQUdDIGF0dGFjayBzY2FsZXIgKi8KLSAgICBMVk1fRkxPQVQgIEFHQ19EZWNheTsgICAgICAgICAgICAgICAgICAgICAgIC8qIEFHQyBkZWNheSBzY2FsZXIgKi8KLSAgICBMVk1fRkxPQVQgIFZvbHVtZVRDOyAgICAgICAgICAgICAgICAgICAgICAgIC8qIFZvbHVtZSB1cGRhdGUgdGltZSBjb25zdGFudCAqLwordHlwZWRlZiBzdHJ1Y3QgeworICAgIExWTV9GTE9BVCBBR0NfR2FpbjsgICAgLyogVGhlIGN1cnJlbnQgQUdDIGdhaW4gKi8KKyAgICBMVk1fRkxPQVQgQUdDX01heEdhaW47IC8qIFRoZSBtYXhpbXVtIEFHQyBnYWluICovCisgICAgTFZNX0ZMT0FUIFZvbHVtZTsgICAgICAvKiBUaGUgY3VycmVudCB2b2x1bWUgc2V0dGluZyAqLworICAgIExWTV9GTE9BVCBUYXJnZXQ7ICAgICAgLyogVGhlIHRhcmdldCB2b2x1bWUgc2V0dGluZyAqLworICAgIExWTV9GTE9BVCBBR0NfVGFyZ2V0OyAgLyogQUdDIHRhcmdldCBsZXZlbCAqLworICAgIExWTV9GTE9BVCBBR0NfQXR0YWNrOyAgLyogQUdDIGF0dGFjayBzY2FsZXIgKi8KKyAgICBMVk1fRkxPQVQgQUdDX0RlY2F5OyAgIC8qIEFHQyBkZWNheSBzY2FsZXIgKi8KKyAgICBMVk1fRkxPQVQgVm9sdW1lVEM7ICAgIC8qIFZvbHVtZSB1cGRhdGUgdGltZSBjb25zdGFudCAqLwogCiB9IEFHQ19NSVhfVk9MXzJTdDFNb25fRkxPQVRfdDsKIApAQCAtNDksMTkgKzQ4LDExIEBACiAvKiAgICBGdW5jdGlvbiBQcm90b3R5cGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgQUdDX01JWF9WT0xfMlN0MU1vbl9EMzJfV1JBKEFHQ19NSVhfVk9MXzJTdDFNb25fRkxPQVRfdCAgKnBJbnN0YW5jZSwgICAgIC8qIEluc3RhbmNlIHBvaW50ZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAgICAgICpwU3RTcmMsICAgICAgICAvKiBTdGVyZW8gc291cmNlICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAgICAgICAqcE1vbm9TcmMsICAgICAgLyogTW9ubyBzb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICpwRHN0LCAgICAgICAgICAvKiBTdGVyZW8gZGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgIG4pOyAgICAgICAgICAgICAvKiBOdW1iZXIgb2Ygc2FtcGxlcyAqLwotI2lmZGVmIFNVUFBPUlRfTUMKLXZvaWQgQUdDX01JWF9WT0xfTWMxTW9uX0QzMl9XUkEoQUdDX01JWF9WT0xfMlN0MU1vbl9GTE9BVF90ICAqcEluc3RhbmNlLCAgLyogSW5zdGFuY2UgcG9pbnRlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICAgICAgKnBTdFNyYywgICAgICAvKiBTb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAgICAgICpwTW9ub1NyYywgICAgLyogTW9ubyBzb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICpwRHN0LCAgICAgICAgLyogRGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgIE5yRnJhbWVzLCAgICAgLyogTnVtYmVyIG9mIGZyYW1lcyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgICAgTnJDaGFubmVscyk7ICAvKiBOdW1iZXIgb2YgY2hhbm5lbHMgKi8KLSNlbmRpZgordm9pZCBBR0NfTUlYX1ZPTF9NYzFNb25fRDMyX1dSQShBR0NfTUlYX1ZPTF8yU3QxTW9uX0ZMT0FUX3QqIHBJbnN0YW5jZSwgIC8qIEluc3RhbmNlIHBvaW50ZXIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUKiBwU3RTcmMsICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUKiBwTW9ub1NyYywgICAgICAgICAgICAgICAvKiBNb25vIHNvdXJjZSAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIHBEc3QsICAgICAgICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgTnJGcmFtZXMsICAgICAgICAgICAgICAgICAgICAgLyogTnVtYmVyIG9mIGZyYW1lcyAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2IE5yQ2hhbm5lbHMpOyAgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBjaGFubmVscyAqLwogCi0jZW5kaWYgIC8qIF9fQUdDX0hfXyAqLwotCisjZW5kaWYgLyogX19BR0NfSF9fICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9CSVFVQUQuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL0JJUVVBRC5oCmluZGV4IGMwNTBjZDAuLjAwYjUzOWEgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL0JJUVVBRC5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL0JJUVVBRC5oCkBAIC0yMiwyODEgKzIyLDY3IEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgSU5TVEFOQ0UgTUVNT1JZIFRZUEUgREVGSU5JVElPTgogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi10eXBlZGVmIHN0cnVjdAotewotI2lmZGVmIFNVUFBPUlRfTUMKK3R5cGVkZWYgc3RydWN0IHsKICAgICAvKiBUaGUgbWVtb3J5IHJlZ2lvbiBjcmVhdGVkIGJ5IHRoaXMgc3RydWN0dXJlIGluc3RhbmNlIGlzIHR5cGVjYXN0CiAgICAgICogaW50byBhbm90aGVyIHN0cnVjdHVyZSBjb250YWluaW5nIGEgcG9pbnRlciBhbmQgYW4gYXJyYXkgb2YgZmlsdGVyCiAgICAgICogY29lZmZpY2llbnRzLiBJbiBvbmUgY2FzZSB0aGlzIG1lbW9yeSByZWdpb24gaXMgdXNlZCBmb3Igc3RvcmluZwogICAgICAqIERDIGNvbXBvbmVudCBvZiBjaGFubmVscwogICAgICAqLwotICAgIExWTV9GTE9BVCAqcFN0b3JhZ2U7CisgICAgTFZNX0ZMT0FUKiBwU3RvcmFnZTsKICAgICBMVk1fRkxPQVQgU3RvcmFnZVtMVk1fTUFYX0NIQU5ORUxTXTsKLSNlbHNlCi0gICAgTFZNX0ZMT0FUIFN0b3JhZ2VbNl07Ci0jZW5kaWYKIH0gQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3Q7CiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgQ09FRkZJQ0lFTlQgVFlQRSBERUZJTklUSU9OUwogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq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0KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9GTE9BVCBBMTsgICAgLyogIGExICAqLwotICAgIExWTV9GTE9BVCBBMDsgICAgLyogIGEwICAqLwotICAgIExWTV9GTE9BVCBCMTsgICAgLyogLWIxISAqLwordHlwZWRlZiBzdHJ1Y3QgeworICAgIExWTV9GTE9BVCBBMTsgLyogIGExICAqLworICAgIExWTV9GTE9BVCBBMDsgLyogIGEwICAqLworICAgIExWTV9GTE9BVCBCMTsgLyogLWIxISAqLwogfSBGT19GTE9BVF9MU2h4X0NvZWZzX3Q7CiAvKioqIEJhbmQgcGFzcyBjb2VmZmljaWVudHMgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXR5cGVkZWYgc3RydWN0Ci17Ci0gICAgTFZNX0ZMT0FUICBBMDsgICAvKiAgYTAgICovCi0gICAgTFZNX0ZMT0FUICBCMjsgICAvKiAtYjIhICovCi0gICAgTFZNX0ZMT0FUICBCMTsgICAvKiAtYjEhICovCit0eXBlZGVmIHN0cnVjdCB7CisgICAgTFZNX0ZMT0FUIEEwOyAvKiAgYTAgICovCisgICAgTFZNX0ZMT0FUIEIyOyAvKiAtYjIhICovCisgICAgTFZNX0ZMT0FUIEIxOyAvKiAtYjEhICovCiB9IEJQX0ZMT0FUX0NvZWZzX3Q7CiAKIC8qKiogUGVha2luZyBjb2VmZmljaWVudHMgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdHlwZWRlZiBzdHJ1Y3QKLXsKLSAgICBMVk1fRkxPQVQgQTA7ICAgLyogIGEwICAqLwotICAgIExWTV9GTE9BVCBCMjsgICAvKiAtYjIhICovCi0gICAgTFZNX0ZMT0FUIEIxOyAgIC8qIC1iMSEgKi8KLSAgICBMVk1fRkxPQVQgIEc7ICAgLyogR2FpbiAqLwordHlwZWRlZiBzdHJ1Y3QgeworICAgIExWTV9GTE9BVCBBMDsgLyogIGEwICAqLworICAgIExWTV9GTE9BVCBCMjsgLyogLWIyISAqLworICAgIExWTV9GTE9BVCBCMTsgLyogLWIxISAqLworICAgIExWTV9GTE9BVCBHOyAgLyogR2FpbiAqLwogfSBQS19GTE9BVF9Db2Vmc190OwogCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgVEFQUyBUWVBFIERFRklOSVRJT05TCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotLyoqKiBUeXBlcyB1c2VkIGZvciBmaXJzdCBvcmRlciBhbmQgc2hlbHZpbmcgZmlsdGVyICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9GTE9BVCBTdG9yYWdlWyAoMSAqIDIpIF07ICAvKiBPbmUgY2hhbm5lbCwgdHdvIHRhcHMgb2Ygc2l6ZSBMVk1fSU5UMzIgKi8KLX0gQmlxdWFkXzFJX09yZGVyMV9GTE9BVF9UYXBzX3Q7Ci0KLXR5cGVkZWYgc3RydWN0Ci17Ci0jaWZkZWYgU1VQUE9SVF9NQwotICAgIC8qIExWTV9NQVhfQ0hBTk5FTFMgY2hhbm5lbHMsIHR3byB0YXBzIG9mIHNpemUgTFZNX0ZMT0FUICovCi0gICAgTFZNX0ZMT0FUIFN0b3JhZ2VbIChMVk1fTUFYX0NIQU5ORUxTICogMikgXTsKLSNlbHNlCi0gICAgTFZNX0ZMT0FUIFN0b3JhZ2VbICgyICogMikgXTsgIC8qIFR3byBjaGFubmVscywgdHdvIHRhcHMgb2Ygc2l6ZSBMVk1fRkxPQVQgKi8KLSNlbmRpZgotfSBCaXF1YWRfMklfT3JkZ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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIEZVTkNUSU9OIFBST1RPVFlQRVM6IEJJUVVBRCBGSUxURVJTCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotLyoqKiAxNiBiaXQgZGF0YSBwYXRoICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLXZvaWQgQlFfMklfRDE2RjMyQ3NzX1RSQ19XUkFfMDFfSW5pdCAoICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCaXF1YWRfMklfT3JkZXIyX0ZMT0FUX1RhcHNfdCAgICpwVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlFfRkxPQVRfQ29lZnNfdCAgICAgICAgICAgICpwQ29lZik7Ci0KLXZvaWQgQlFfMklfRDE2RjMyQzE1X1RSQ19XUkFfMDEgKCAgICAgICAgICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgICAgTnJTYW1wbGVzKTsKLQotdm9pZCBCUV8ySV9EMTZGMzJDMTRfVFJDX1dSQV8wMSAoICAgICAgICAgICBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICBOclNhbXBsZXMpOwotCi12b2lkIEJRXzJJX0QxNkYzMkMxM19UUkNfV1JBXzAxICggICAgICAgICAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICAgKnBEYXRhT3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgIE5yU2FtcGxlcyk7Ci0KLXZvaWQgQlFfMklfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfSW5pdCAoICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCaXF1YWRfMklfT3JkZXIyX0ZMT0FUX1RhcHNfdCAgICpwVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlFfRkxPQVRfQ29lZnNfdCAgICAgICAgICAgICpwQ29lZik7Ci0KLXZvaWQgQlFfMklfRDE2RjE2QzE1X1RSQ19XUkFfMDEoIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yU2FtcGxlcyk7Ci0KLXZvaWQgQlFfMklfRDE2RjE2QzE0X1RSQ19XUkFfMDEoIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yU2FtcGxlcyk7Ci0KLXZvaWQgQlFfMUlfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfSW5pdCAoICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCaXF1YWRfMUlfT3JkZXIyX0ZMT0FUX1RhcHNfdCAgICpwVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlFfRkxPQVRfQ29lZnNfdCAgICAgICAgICAgICpwQ29lZik7Ci0KLXZvaWQgQlFfMUlfRDE2RjE2QzE1X1RSQ19XUkFfMDEgKCBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOclNhbXBsZXMpOwotCi12b2lkIEJRXzFJX0QxNkYzMkNzc19UUkNfV1JBXzAxX0luaXQgKCAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQmlxdWFkXzFJX09yZGVyMl9GTE9BVF9UYXBzX3QgICAqcFRhcHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJRX0ZMT0FUX0NvZWZzX3QgICAgICAgICAgICAqcENvZWYpOwotCi12b2lkIEJRXzFJX0QxNkYzMkMxNF9UUkNfV1JBXzAxICggQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOclNhbXBsZXMpOwotLyoqKiAzMiBiaXQgZGF0YSBwYXRoICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIEJRXzJJX0QzMkYzMkNsbF9UUkNfV1JBXzAxX0luaXQgKCAgICAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJpcXVhZF8ySV9PcmRlcjJfRkxPQVRfVGFwc190ICpwVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlFfRkxPQVRfQ29lZnNfdCAgICAgICAgICAqcENvZWYpOwotdm9pZCBCUV8ySV9EMzJGMzJDMzBfVFJDX1dSQV8wMSAoICAgICAgICAgICBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgTnJTYW1wbGVzKTsKLSNpZmRlZiBTVVBQT1JUX01DCi12b2lkIEJRX01DX0QzMkYzMkMzMF9UUkNfV1JBXzAxICggICAgICAgICAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgICAgTnJDaGFubmVscyk7Ci0jZW5kaWYKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIEZVTkNUSU9OIFBST1RPVFlQRVM6IEZJUlNUIE9SREVSIEZJTFRFUlMKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0vKioqIDE2IGJpdCBkYXRhIHBhdGggKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgRk9fMUlfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfSW5pdCggICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCaXF1YWRfMUlfT3JkZXIxX0ZMT0FUX1RhcHNfdCAgICpwVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRk9fRkxPQVRfQ29lZnNfdCAgICAgICAgICAgICpwQ29lZik7Ci0KLXZvaWQgRk9fMUlfRDE2RjE2QzE1X1RSQ19XUkFfMDEoIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yU2FtcGxlcyk7Ci0KLXZvaWQgRk9fMklfRDE2RjMyQ3NzX0xTaHhfVFJDX1dSQV8wMV9Jbml0KEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCaXF1YWRfMklfT3JkZXIxX0ZMT0FUX1RhcHNfdCAqcFRhcHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGT19GTE9BVF9MU2h4X0NvZWZzX3QgICAgICpwQ29lZik7Ci0KLXZvaWQgRk9fMklfRDE2RjMyQzE1X0xTaHhfVFJDX1dSQV8wMShCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOclNhbXBsZXMpOwotLyoqKiAzMiBiaXQgZGF0YSBwYXRoICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIEZPXzFJX0QzMkYzMkNsbF9UUkNfV1JBXzAxX0luaXQoIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJpcXVhZF8xSV9PcmRlcjFfRkxPQVRfVGFwc190ICpwVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRk9fRkxPQVRfQ29lZnNfdCAgICAgICAgICAqcENvZWYpOwotdm9pZCBGT18xSV9EMzJGMzJDMzFfVFJDX1dSQV8wMSggQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAgKnBEYXRhT3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICAgTnJTYW1wbGVzKTsKLSNpZmRlZiBTVVBQT1JUX01DCi12b2lkIEZPX01jX0QxNkYzMkMxNV9MU2h4X1RSQ19XUkFfMDEoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgIE5yRnJhbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICBOckNoYW5uZWxzKTsKLSNlbmRpZgotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIEZVTkNUSU9OIFBST1RPVFlQRVM6IEJBTkQgUEFTUyBGSUxURVJTCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotLyoqKiAxNiBiaXQgZGF0YSBwYXRoICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIEJQXzFJX0QxNkYxNkNzc19UUkNfV1JBXzAxX0luaXQoIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJpcXVhZF8xSV9PcmRlcjJfRkxPQVRfVGFwc190ICpwVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlBfRkxPQVRfQ29lZnNfdCAgICAgICAgICAgICAgKnBDb2VmKTsKLXZvaWQgQlBfMUlfRDE2RjE2QzE0X1RSQ19XUkFfMDEgKCAgICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICAgTnJTYW1wbGVzKTsKLXZvaWQgQlBfMUlfRDE2RjMyQ2xsX1RSQ19XUkFfMDFfSW5pdCAoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQmlxdWFkXzFJX09yZGVyMl9GTE9BVF9UYXBzX3QgKnBUYXBzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCUF9GTE9BVF9Db2Vmc190ICAgICAgICAgICAgICAqcENvZWYpOwotdm9pZCBCUF8xSV9EMTZGMzJDMzBfVFJDX1dSQV8wMSAoICAgICAgICAgICBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICBOclNhbXBsZXMpOwotLyoqKiAzMiBiaXQgZGF0YSBwYXRoICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIEJQXzFJX0QzMkYzMkNsbF9UUkNfV1JBXzAyX0luaXQgKCAgICAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJpcXVhZF8xSV9PcmRlcjJfRkxPQVRfVGFwc190ICpwVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlBfRkxPQVRfQ29lZnNfdCAgICAgICAgICAqcENvZWYpOwotdm9pZCBCUF8xSV9EMzJGMzJDMzBfVFJDX1dSQV8wMiggICAgICAgICAgICBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICBOclNhbXBsZXMpOwotCi0vKioqIDMyIGJpdCBkYXRhIHBhdGggU1RFUkVPICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgUEtfMklfRDMyRjMyQ3NzR3NzX1RSQ19XUkFfMDFfSW5pdCAoICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQmlxdWFkXzJJX09yZGVyMl9GTE9BVF9UYXBzX3QgKnBUYXBzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQS19GTE9BVF9Db2Vmc190ICAgICAgICAgICpwQ29lZik7Ci12b2lkIFBLXzJJX0QzMkYzMkMxNEcxMV9UUkNfV1JBXzAxKCBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOclNhbXBsZXMpOwotI2lmZGVmIFNVUFBPUlRfTUMKLXZvaWQgUEtfTWNfRDMyRjMyQzE0RzExX1RSQ19XUkFfMDEoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yQ2hhbm5lbHMpOwotI2VuZGlmCiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBGVU5DVElPTiBQUk9UT1RZUEVTOiBEQyBSRU1PVkFMIEZJTFRFUlMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCiAvKioqIDE2IGJpdCBkYXRhIHBhdGggU1RFUkVPICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSNpZmRlZiBTVVBQT1JUX01DCi12b2lkIERDX01jX0QxNl9UUkNfV1JBXzAxX0luaXQgICAgICggICAgICAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UpOwordm9pZCBEQ19NY19EMTZfVFJDX1dSQV8wMV9Jbml0KEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90KiBwSW5zdGFuY2UpOwogCi12b2lkIERDX01jX0QxNl9UUkNfV1JBXzAxICAgICAgICAgICggICAgICAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yRnJhbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOckNoYW5uZWxzKTsKLSNlbHNlCi12b2lkIERDXzJJX0QxNl9UUkNfV1JBXzAxX0luaXQgICAgICggICAgICAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UpOwotCi12b2lkIERDXzJJX0QxNl9UUkNfV1JBXzAxICAgICAgICAgICggICAgICAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yU2FtcGxlcyk7Ci0jZW5kaWYKK3ZvaWQgRENfTWNfRDE2X1RSQ19XUkFfMDEoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QqIHBJbnN0YW5jZSwgTFZNX0ZMT0FUKiBwRGF0YUluLAorICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIHBEYXRhT3V0LCBMVk1fSU5UMTYgTnJGcmFtZXMsIExWTV9JTlQxNiBOckNoYW5uZWxzKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIE5vbkxpbkNvbXBfRmxvYXQoTFZNX0ZMT0FUICAgICAgICBHYWluLAotICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDMyICAgICAgICBCbG9ja0xlbmd0aCk7Cit2b2lkIE5vbkxpbkNvbXBfRmxvYXQoTFZNX0ZMT0FUIEdhaW4sIExWTV9GTE9BVCogcERhdGFJbiwgTFZNX0ZMT0FUKiBwRGF0YU91dCwKKyAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgQmxvY2tMZW5ndGgpOwogCiAjZW5kaWYgLyogI2lmbmRlZiBfQ09NUF9MSU1fSCAqLwotCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9GaWx0ZXIuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL0ZpbHRlci5oCmluZGV4IDFlZWIzMjEuLjBiYTUyMjMgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL0ZpbHRlci5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL0ZpbHRlci5oCkBAIC0yNywyNiArMjcsMjAgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBERUZJTkVTCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSNkZWZpbmUgRklMVEVSX0xPU1MgICAgIDMyNzMwICAgICAgIC8qIC0wLjAxZEIgbG9zcyB0byBhdm9pZCB3cmFwcGluZyBkdWUgdG8gYmFuZCByaXBwbGUgKi8KLSNkZWZpbmUgRklMVEVSX0xPU1NfRkxPQVQgICAgMC45OTg4NDlmCisjZGVmaW5lIEZJTFRFUl9MT1NTIDMyNzMwIC8qIC0wLjAxZEIgbG9zcyB0byBhdm9pZCB3cmFwcGluZyBkdWUgdG8gYmFuZCByaXBwbGUgKi8KKyNkZWZpbmUgRklMVEVSX0xPU1NfRkxPQVQgMC45OTg4NDlmCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgRlVOQ1RJT04gUFJPVE9UWVBFUwogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLUxWTV9GTE9BVCBMVk1fUG93ZXIxMCggICBMVk1fRkxPQVQgIFgpOworTFZNX0ZMT0FUIExWTV9Qb3dlcjEwKExWTV9GTE9BVCBYKTsKIAotTFZNX0ZMT0FUIExWTV9Qb2x5bm9taWFsKExWTV9VSU5UMTYgTiwKLSAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICpwQ29lZmZpY2llbnRzLAotICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgWCk7Ci1MVk1fRkxPQVQgICBMVk1fR2V0T21lZ2EoTFZNX1VJTlQzMiAgRmMsCi0gICAgICAgICAg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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAqICBOYW1lICAgICAgICA6IEluc3RBbGxvY19Jbml0KCkKLSAqICBJbnB1dCAgICAgICA6IHBtcyAgLSBQb2ludGVyIHRvIHRoZSBJTlNUX0FMTE9DIGluc3RhbmNlCi0gICAgICAgICAgICAgICAgICBTdGFydEFkZHIgLSBCYXNlIGFkZHJlc3Mgb2YgdGhlIGluc3RhbmNlIG1lbW9yeQotICogIFJldHVybnMgICAgIDogRXJyb3IgY29kZQotICogIERlc2NyaXB0aW9uIDogSW5pdGlhbGl6ZXMgdGhlIGluc3RhbmNlIGRpc3RyaWJ1dGlvbiBhbmQgbWVtb3J5IHNpemUgY2FsY3VsYXRpb24gZnVuY3Rpb24KLSAqICBSZW1hcmtzICAgICA6Ci0gKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotdm9pZCAgIEluc3RBbGxvY19Jbml0KCBJTlNUX0FMTE9DICpwbXMsIHZvaWQgKlN0YXJ0QWRkciApOwotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICogIE5hbWUgICAgICAgIDogSW5zdEFsbG9jX0FkZE1lbWJlcigpCi0gKiAgSW5wdXQgICAgICAgOiBwbXMgIC0gUG9pbnRlciB0byB0aGUgSU5TVF9BTExPQyBpbnN0YW5jZQotICAgICAgICAgICAgICAgICAgU2l6ZSAtIFRoZSBzaXplIGluIGJ5dGVzIG9mIHRoZSBuZXcgYWRkZWQgbWVtYmVyCi0gKiAgUmV0dXJucyAgICAgOiBBIHBvaW50ZXIgdG8gdGhlIG5ldyBhZGRlZCBtZW1iZXIKLSAqICBEZXNjcmlwdGlvbiA6IEFsbG9jYXRlcyBzcGFjZSBmb3IgYSBuZXcgbWVtYmVyIGluIHRoZSBpbnN0YW5jZSBtZW1vcnkgYW5kIHJldHVybnMKLSAgICAgICAgICAgICAgICAgIGEgcG9pbnRlciB0byB0aGlzIG5ldyBtZW1iZXIuICBUaGUgc3RhcnQgYWRkcmVzcyBvZiBhbGwgbWVtYmVycyB3aWxsCi0gICAgICAgICAgICAgICAgICBiZSAzMiBiaXQgYWxsaWduZWQuCi0gKiAgUmVtYXJrcyAgICAgOgotICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLXZvaWQqIEluc3RBbGxvY19BZGRNZW1iZXIoIElOU1RfQUxMT0MgKnBtcywgTFZNX1VJTlQzMiBTaXplICk7Ci0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gKiAgTmFtZSAgICAgICAgOiBJbnN0QWxsb2NfR2V0VG90YWwoKQotICogIElucHV0ICAgICAgIDogcG1zICAtIFBvaW50ZXIgdG8gdGhlIElOU1RfQUxMT0MgaW5zdGFuY2UKLSAqICBSZXR1cm5zICAgICA6IFRoZSBpbnN0YW5jZSBtZW1vcnkgc2l6ZQotICogIERlc2NyaXB0aW9uIDogVGhpcyBmdW5jdGlvbnMgcmV0dXJucyB0aGUgY2FsY3VsYXRlZCBpbnN0YW5jZSBtZW1vcnkgc2l6ZQotICogIFJlbWFya3MgICAgIDoKLSAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi1MVk1fVUlOVDMyIEluc3RBbGxvY19HZXRUb3RhbCggSU5TVF9BTExPQyAqcG1zKTsKLQotdm9pZCogICBJbnN0QWxsb2NfQWRkTWVtYmVyQWxsUmV0KCAgICAgSU5TVF9BTExPQyAgICAgICAgICAgICAgICAgKnBtcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDMyICAgICAgICAgICAgICAgU2l6ZVtdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgICAgICAgICAgICoqcHRyKTsKLQotdm9pZCogICBJbnN0QWxsb2NfQWRkTWVtYmVyQWxsKCBJTlNUX0FMTE9DICAgICAgICAgICAgICAgICAgICAgKnBtcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMzIgICAgICAgICAgICAgICAgICAgU2l6ZVtdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX01lbW9yeVRhYmxlX3N0ICAgICAgICAgICAqcE1lbW9yeVRhYmxlKTsKLQotdm9pZCAgICBJbnN0QWxsb2NfSW5pdEFsbCggSU5TVF9BTExPQyAgICAgICAgICAgICAgICAgICAgICAqcG1zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX01lbW9yeVRhYmxlX3N0ICAgICAgICAgICAgICpwTWVtb3J5VGFibGUpOwotCi12b2lkICAgIEluc3RBbGxvY19Jbml0QWxsX05VTEwoIElOU1RfQUxMT0MgICAgICAgICAgICAgICpwbXMpOwotCi0jZW5kaWYgLyogX19KQlNfSU5TVEFMTE9DX0hfXyAqLwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9saWIvTFZNX0NvbW1vbi5oIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9saWIvTFZNX0NvbW1vbi5oCmluZGV4IDQ5ZjE2YWQuLmQzZDEyOGEgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL0xWTV9Db21tb24uaAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9MVk1fQ29tbW9uLmgKQEAgLTM5LDEyICszOSwxMSBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qIEFsZ29yaXRobSBpZGVudGlmaWNhdGlvbiAqLwotI2RlZmluZSBBTEdPUklUSE1fTk9ORV9JRCAgICAgIDB4MDAwMAotI2RlZmluZSBBTEdPUklUSE1fQ1NfSUQgICAgICAgIDB4MDEwMAotI2RlZmluZSBBTEdPUklUSE1fRVFOQl9JRCAgICAgIDB4MDIwMAotI2RlZmluZSBBTEdPUklUSE1fREJFX0lEICAgICAgIDB4MDMwMAotI2RlZmluZSBBTEdPUklUSE1fVkNfSUQgICAgICAgIDB4MDUwMAotI2RlZmluZSBBTEdPUklUSE1fVEVfSUQgICAgICAgIDB4MDYwMAorI2RlZmluZSBBTEdPUklUSE1fTk9ORV9JRCAweDAwMDAKKyNkZWZpbmUgQUxHT1JJVEhNX0NTX0lEIDB4MDEwMAorI2RlZmluZSBBTEdPUklUSE1fRVFOQl9JRCAweDAyMDAKKyNkZWZpbmUgQUxHT1JJVEhNX0RCRV9JRCAweDAzMDAKKyNkZWZpbmUgQUxHT1JJVEhNX1ZDX0lEIDB4MDUwMAorI2RlZmluZSBBTEdPUklUSE1fVEVfSUQgMHgwNjAwCiAKLSNlbmRpZiAgICAgIC8qIF9fTFZNX0NPTU1PTl9IX18gKi8KLQorI2VuZGlmIC8qIF9fTFZNX0NPTU1PTl9IX18gKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL0xWTV9NYWNyb3MuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGli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lRPMzJfTEw9KE1VTDMyeDMySU5UTzMyX0xMPj5zaGlmdFZhbHVlKSZNVUwzMngzMklOVE8zMl9tYXNrO1wKLSAgICAgICAgTVVMMzJ4MzJJTlRPMzJfdGVtcDI9TVVMMzJ4MzJJTlRPMzJfSEh8TVVMMzJ4MzJJTlRPMzJfTEw7XAotICAgICAgICB9XAotICAgICAgICBlbHNlXAotICAgICAgIHtcCi0gICAgICAgIE1VTDMyeDMySU5UTzMyX3RlbXAyPShMVk1fSU5UMzIpTVVMMzJ4MzJJTlRPMzJfSEg+PihzaGlmdFZhbHVlLTMyKTtcCi0gICAgICAgfVwKLSAgICAgICAoQykgPSBNVUwzMngzMklOVE8zMl90ZW1wMjtcCi0gICAgICAgfQorI2RlZmluZSBNVUwzMngzMklOVE8zMihBLCBCLCBDLCBTaGlmdFIpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgTFZNX0lOVDMyIE1VTDMyeDMySU5UTzMyX3RlbXAsIE1VTDMyeDMySU5UTzMyX3RlbXAyLCBNVUwzMngzMklOVE8zMl9tYXNrLCAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgIE1VTDMyeDMySU5UTzMyX0hILCBNVUwzMngzMklOVE8zMl9ITCwgTVVMMzJ4MzJJTlRPMzJfTEgsIE1VTDMyeDMySU5UTzMyX0xMOyAgICBcCisgICAgICAgIExWTV9JTlQzMiBzaGlmdFZhbHVlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgc2hpZnRWYWx1ZSA9IChTaGlmdFIpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBNVUwzMngzMklOVE8zMl9tYXNrID0gMHgwMDAwRkZGRjsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIE1VTDMyeDMySU5UTzMyX0hIID0gKChMVk1fSU5UMzIpKChMVk1fSU5UMTYpKChBKSA+PiAxNikpICogKChMVk1fSU5UMTYpKChCKSA+PiAxNikpKTsgIFwKKyAgICAgICAgTVVMMzJ4MzJJTlRPMzJfSEwgPSAoKExWTV9JTlQzMikoKEIpJk1VTDMyeDMySU5UTzMyX21hc2spICogKChMVk1fSU5UMTYpKChBKSA+PiAxNikpKTsgXAorICAgICAgICBNVUwzMngzMklOVE8zMl9MSCA9ICgoTFZNX0lOVDMyKSgoQSkmTVVMMzJ4MzJJTlRPMzJfbWFzaykgKiAoKExWTV9JTlQxNikoKEIpID4+IDE2KSkpOyBcCisgICAgICAgIE1VTDMyeDMySU5UTzMyX0xMID0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAoTFZNX0lOVDMyKSgoQSkmTVVMMzJ4MzJJTlRPMzJfbWFzaykgKiAoTFZNX0lOVDMyKSgoQikmTVVMMzJ4MzJJTlRPMzJfbWFzayk7ICAgXAorICAgICAgICBNVUwzMngzMklOVE8zMl90ZW1wID0gKExWTV9JTlQzMikoTVVMMzJ4MzJJTlRPMzJfSEwgJiBNVUwzMngzMklOVE8zMl9tYXNrKSArICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDMyKShNVUwzMngzMklOVE8zMl9MSCAmIE1VTDMyeDMySU5UTzMyX21hc2spICsgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMzIpKChNVUwzMngzMklOVE8zMl9MTCA+PiAxNikgJiBNVUwzMngzMklOVE8zMl9tYXNrKTsgICAgXAorICAgICAgICBNVUwzMngzMklOVE8zMl9ISCA9IE1VTDMyeDMySU5UTzMyX0hIICsgKExWTV9JTlQzMikoTVVMMzJ4MzJJTlRPMzJfSEwgPj4gMTYpICsgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQzMikoTVVMMzJ4MzJJTlRPMzJfTEggPj4gMTYpICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDMyKShNVUwzMngzMklOVE8zMl90ZW1wID4+IDE2KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBNVUwzMngzMklOVE8zMl9MTCA9IE1VTDMyeDMySU5UTzMyX0xMICsgKExWTV9JTlQzMikoTVVMMzJ4MzJJTlRPMzJfSEwgPDwgMTYpICsgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQzMikoTVVMMzJ4MzJJTlRPMzJfTEggPDwgMTYpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgaWYgKHNoaWZ0VmFsdWUgPCAzMikgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgTVVMMzJ4MzJJTlRPMzJfSEggPSBNVUwzMngzMklOVE8zMl9ISCA8PCAoMzIgLSBzaGlmdFZhbHVlKTsgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICBNVUwzMngzMklOVE8zMl9tYXNrID0gKChMVk1fSU5UMzIpMSA8PCAoMzIgLSBzaGlmdFZhbHVlKSkgLSAxOyAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIE1VTDMyeDMySU5UTzMyX0xMID0gKE1VTDMyeDMySU5UTzMyX0xMID4+IHNoaWZ0VmFsdWUpICYgTVVMMzJ4MzJJTlRPMzJfbWFzazsgICAgICAgXAorICAgICAgICAgICAgTVVMMzJ4MzJJTlRPMzJfdGVtcDIgPSBNVUwzMngzMklOVE8zMl9ISCB8IE1VTDMyeDMySU5UTzMyX0xMOyAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIH0gZWxzZSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIE1VTDMyeDMySU5UTzMyX3RlbXAyID0gKExWTV9JTlQzMilNVUwzMngzMklOVE8zMl9ISCA+PiAoc2hpZnRWYWx1ZSAtIDMyKTsgICAgICAgICAgXAorICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIChDKSA9IE1VTDMyeDMySU5UTzMyX3RlbXAyOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBNVUwzMngxNklOVE8zMihBLEIsQyxTaGlmdFIpCkBAIC02NSwyNSArNzAsMjQgQEAKICAgICAgICAgb2Ygb3ZlcmZsb3cgaXMgdW5kZWZpbmVkLgogCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSNkZWZpbmUgTVVMMzJ4MTZJTlRPMzIoQSxCLEMsU2hpZnRSKSAgIFwKLSAgICAgICAge0xWTV9JTlQzMiBNVUwzMngxNklOVE8zMl9tYXNrLE1VTDMyeDE2SU5UTzMyX0hILE1VTDMyeDE2SU5UTzMyX0xMO1wKLSAgICA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ICAgICAgICAgICAgICAgICAgICAgXAorICAgIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgTFZNX0lOVDMyIE1VTDMyeDE2SU5UTzMyX21hc2ssIE1VTDMyeDE2SU5UTzMyX0hILCBNVUwzMngxNklOVE8zMl9MTDsgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIExWTV9JTlQzMiBzaGlmdFZhbHVlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBzaGlmdFZhbHVlID0gKFNoaWZ0Uik7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgTVVMMzJ4MTZJTlRPMzJfbWFzayA9IDB4MDAwMEZGRkY7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIE1VTDMyeDE2SU5UTzMyX0hIID0gKChMVk1fSU5UMzIpKEIpICogKChMVk1fSU5UMTYpKChBKSA+PiAxNikpKTsgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBNVUwzMngxNklOVE8zMl9MTCA9ICgoTFZNX0lOVDMyKSgoQSkmTVVMMzJ4MTZJTlRPMzJfbWFzaykgKiAoQikpOyAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgaWYgKHNoaWZ0VmFsdWUgPCAxNikgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICBNVUwzMngxNklOVE8zMl9ISCA9IChMVk1fSU5UMzIpKChMVk1fVUlOVDMyKU1VTDMyeDE2SU5UTzMyX0hIIDw8ICgxNiAtIHNoaWZ0VmFsdWUpKTsgXAorICAgICAgICAgICAgKEMpID0gTVVMMzJ4MTZJTlRPMzJfSEggKyAoTFZNX0lOVDMyKShNVUwzMngxNklOVE8zMl9MTCA+PiBzaGlmdFZhbHVlKTsgICAgICAgICAgICAgIFwKKyAgICAgICAgfSBlbHNlIGlmIChzaGlmdFZhbHVlIDwgMzIpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICBNVUwzMngxNklOVE8zMl9ISCA9IChMVk1fSU5UMzIpKE1VTDMyeDE2SU5UTzMyX0hIID4+IChzaGlmdFZhbHVlIC0gMTYpKTsgICAgICAgICAgICAgXAorICAgICAgICAgICAgKEMpID0gTVVMMzJ4MTZJTlRPMzJfSEggKyAoTFZNX0lOVDMyKShNVUwzMngxNklOVE8zMl9MTCA+PiBzaGlmdFZhbHVlKTsgICAgICAgICAgICAgIFwKKyAgICAgICAgfSBlbHNlIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAoQykgPSBNVUwzMngxNklOVE8zMl9ISCA+PiAoc2hpZnRWYWx1ZSAtIDE2KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBBREQyX1NBVF8zMngzMihBLEIsQykKQEAgLTkxLDE2ICs5NSwxNiBAQAogCiAgICAgICAgIEEsQiBhbmQgQyBhcmUgMzIgYml0IFNJR05FRCBudW1iZXJzLgogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0jZGVmaW5lIEFERDJfU0FUXzMyeDMyKEEsQixDKSAgIFwKLSAgICAgICAgeyhDKT0oQSkrKEIpO1wKLSAgICAgICAgIGlmICgoKChDKSBeIChBKSkgJiAoKEMpIF4gKEIpKSkgPj4gMzEpXAotICAgICAgICAgICAge1wKLSAgICAgICAgICAgICAgICBpZigoQSk8MClcCi0gICAgICAgICAgICAgICAgICAgIChDKT0weDgwMDAwMDAwbDtcCi0gICAgICAgICAgICAgICAgZWxzZVwKLSAgICAgICAgICAgICAgICAgICAgKEMpPTB4N0ZGRkZGRkZsO1wKLSAgICAgICAgICAgIH1cCi0gICAgICAgIH0KKyNkZWZpbmUgQUREMl9TQVRfMzJ4MzIoQSwgQiwgQykgICAgICAgICAgICAgICAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAoQykgPSAoQSkgKyAoQik7ICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgaWYgKCgoKEMpIF4gKEEpKSAmICgoQykgXiAoQikpKSA+PiAzMSkgeyBcCisgICAgICAgICAgICBpZiAoKEEpIDwgMCkgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgIChDKSA9IDB4ODAwMDAwMDBsOyAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIGVsc2UgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgKEMpID0gMHg3RkZGRkZGRmw7ICAgICAgICAgICAgICAgXAorICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9CiAKICNlbmRpZiAvKiBfTFZNX01BQ1JPU19IXyAqLwogCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9sa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ykodm9pZCosdm9pZCosTFZNX0lOVDMyKTsKK3R5cGVkZWYgc3RydWN0IHsKKyAgICBMVk1fSU5UMzIgU2FtcGxpbmdSYXRlOworICAgIExWTV9JTlQxNiBUaW1lSW5NczsKKyAgICBMVk1fSU5UMzIgQ2FsbEJhY2tQYXJhbTsKKyAgICB2b2lkKiBwQ2FsbEJhY2tQYXJhbXM7CisgICAgdm9pZCogcENhbGxiYWNrSW5zdGFuY2U7CisgICAgdm9pZCAoKnBDYWxsQmFjaykodm9pZCosIHZvaWQqLCBMVk1fSU5UMzIpOwogCiB9IExWTV9UaW1lcl9QYXJhbXNfdDsKIApAQCAtNjYsMTQgKzY0LDEyIEBACiAvKiAgRlVOQ1RJT04gUFJPVE9UWVBFUyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi12b2lkIExWTV9UaW1lcl9Jbml0ICggICBMVk1fVGltZXJfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1RpbWVyX1BhcmFtc190ICAgICAgICAgKnBQYXJhbXMgICAgICk7Cit2b2lkIExWTV9UaW1lcl9Jbml0KExWTV9UaW1lcl9JbnN0YW5jZV90KiBwSW5zdGFuY2UsIExWTV9UaW1lcl9QYXJhbXNfdCogcFBhcmFtcyk7CiAKLXZvaWQgTFZNX1RpbWVyICAgICAgKCAgIExWTV9UaW1lcl9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgICAgIEJsb2NrU2l6ZSApOwordm9pZCBMVk1fVGltZXIoTFZNX1RpbWVyX0luc3RhbmNlX3QqIHBJbnN0YW5jZSwgTFZNX0lOVDE2IEJsb2NrU2l6ZSk7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogIEVORCBPRiBIRUFERVIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotI2VuZGlmICAvKiBfX0xWTV9USU1FUl9IX18gKi8KKyNlbmRpZiAvKiBfX0xWTV9USU1FUl9IX18gKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL0xWTV9UeXBlcy5oIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9saWIvTFZNX1R5cGVzLmgKaW5kZXggOGI2ODdmNi4uN2NmYWYyNyAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9saWIvTFZNX1R5cGVzLmgKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9saWIvTFZNX1R5cGVzLmgKQEAgLTI2LDUzICsyNiwzNCBAQAogI2RlZmluZSBMVk1fVFlQRVNfSAogCiAjaW5jbHVkZSA8c3RkaW50Lmg+Ci0KKyNpbmNsdWRlIDxzeXN0ZW0vYXVkaW8uaD4KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgZGVmaW5pdGlvbnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSNkZWZpbmUgTFZNX05VTEwgICAgICAgICAgICAgICAgMCAgICAgICAgICAgICAgICAgICAvKiBOVUxMIHBvaW50ZXIgKi8KKyNkZWZpbmUgTFZNX05VTEwgMCAvKiBOVUxMIHBvaW50ZXIgKi8KIAotI2RlZmluZSBMVk1fVFJVRSAgICAgICAgICAgICAgICAxICAgICAgICAgICAgICAgICAgIC8qIEJvb2xlYW5zICovCi0jZGVmaW5lIExWTV9GQUxTRSAgICAgICAgICAgICAgIDAKKyNkZWZpbmUgTFZNX1RSVUUgMSAvKiBCb29sZWFucyAqLworI2RlZmluZSBMVk1fRkFMU0UgMAogCi0jZGVmaW5lIExWTV9NQVhJTlRfOCAgICAgICAgICAgIDEyNyAgICAgICAgICAgICAgICAgLyogTWF4aW11bSBwb3NpdGl2ZSBpbnRlZ2VyIHNpemUgKi8KLSNkZWZpbmUgTFZNX01BWElOVF8xNiAgICAgICAgICAgMzI3NjcKLSNkZWZpbmUgTFZNX01BWElOVF8zMiAgICAgICAgICAgMjE0NzQ4MzY0NwotI2RlZmluZSBMVk1fTUFYRU5VTSAgICAgICAgICAgICAyMTQ3NDgzNjQ3CisjZGVmaW5lIExWTV9NQVhJTlRfOCAxMjcgLyogTWF4aW11bSBwb3NpdGl2ZSBpbnRlZ2VyIHNpemUgKi8KKyNkZWZpbmUgTFZNX01BWElOVF8xNiAzMjc2NworI2RlZmluZSBMVk1fTUFYSU5UXzMyIDIx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IExWTV9OUl9NRU1PUllfUkVHSU9OUyA0IC8qIE51bWJlciBvZiBtZW1vcnkgcmVnaW9ucyAqLwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtODAsMzMgKzYxLDI4IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi10eXBlZGVmICAgICBjaGFyICAgICAgICAgICAgICAgIExWTV9DSEFSOyAgICAgICAgICAgLyogQVNDSUkgY2hhcmFjdGVyICovCit0eXBlZGVmIGNoYXIgTFZNX0NIQVI7IC8qIEFTQ0lJIGNoYXJhY3RlciAqLwogCi10eXBlZGVmICAgICBpbnQ4X3QgICAgICAgICAgICAgIExWTV9JTlQ4OyAgICAgICAgICAgLyogU2lnbmVkIDgtYml0IHdvcmQgKi8KLXR5cGVkZWYgICAgIHVpbnQ4X3QgICAgICAgICAgICAgTFZNX1VJTlQ4OyAgICAgICAgICAvKiBVbnNpZ25lZCA4LWJpdCB3b3JkICovCit0eXBlZGVmIGludDhfdCBMVk1fSU5UODsgICAvKiBTaWduZWQgOC1iaXQgd29yZCAqLwordHlwZWRlZiB1aW50OF90IExWTV9VSU5UODsgLyogVW5zaWduZWQgOC1iaXQgd29yZCAqLwogCi10eXBlZGVmICAgICBpbnQxNl90ICAgICAgICAgICAgIExWTV9JTlQxNjsgICAgICAgICAgLyogU2lnbmVkIDE2LWJpdCB3b3Jk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CB3aGV0aGVyIHdlIGV4cG9zZSBpbnQxNl90IG9yIGZsb2F0IGJ1ZmZlcnMuCiAKLSNkZWZpbmUgICAgRUZGRUNUX0JVRkZFUl9GT1JNQVQgQVVESU9fRk9STUFUX1BDTV9GTE9BVAotdHlwZWRlZiAgICAgZmxvYXQgICAgICAgICAgICAgICBlZmZlY3RfYnVmZmVyX3Q7CisjZGVmaW5lIEVGRkVDVF9CVUZGRVJfRk9STUFUIEFVRElPX0ZPUk1BVF9QQ01fRkxPQVQKK3R5cGVkZWYgZmxvYXQgZWZmZWN0X2J1ZmZlcl90OwogCi0KLSNpZmRlZiBTVVBQT1JUX01DCi0jZGVmaW5lIExWTV9NQVhfQ0hBTk5FTFMgOCAvLyBGQ0NfOAotI2Vsc2UKLSNkZWZpbmUgTFZNX01BWF9DSEFOTkVMUyAyIC8vIEZDQ18yCi0jZW5kaWYKKyNkZWZpbmUgTFZNX01BWF9DSEFOTkVMUyBGQ0NfMjQKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTExNSwyOSArOTEsMjAgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCiAvKiBPcGVyYXRpbmcgbW9kZSAqLwotdHlwZWRlZiBlbnVtCi17Ci0gICAgTFZNX01PREVfT0ZGICAgID0gMCwKLSAgICBMVk1fTU9ERV9PTiAgICAgPSAxLAotICAgIExWTV9NT0RFX0RVTU1ZICA9IExWTV9NQVhFTlVNCi19IExWTV9Nb2RlX2VuOwordHlwZWRlZiBlbnVtIHsgTFZNX01PREVfT0ZGID0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TUVNT1JZX1JFR0lPTlNdOyAgLyogT25lIGRlZmluaXRpb24gZm9yIGVhY2ggcmVnaW9uICovCi19IExWTV9NZW1vcnlUYWJsZV9zdDsKK3N0YXRpYyBpbmxpbmUgTFZNX0ZzX2VuIGx2bUZzRm9yU2FtcGxlUmF0ZShpbnQgc2FtcGxlUmF0ZSkgeworICAgIHN0YXRpYyBjb25zdCBzdGQ6Om1hcDxpbnQsIExWTV9Gc19lbj4ga0xWTUZzTWFwID0geworICAgICAgICAgICAgezgwMDAsIExWTV9GU184MDAwfSwgICAgezExMDI1LCBMVk1fRlNfMTEwMjV9LCB7MTIwMDAsIExWTV9GU18xMjAwMH0sCisgICAgICAgICAgICB7MTYwMDAsIExWTV9GU18xNjAwMH0sICB7MjIwNTAsIExWTV9GU18yMjA1MH0sIHsyNDAwMCwgTFZNX0ZTXzI0MDAwfSwKKyAgICAgICAgICAgIHszMjAwMCwgTFZNX0ZTXzMyMDAwfSwgIHs0NDEwMCwgTFZNX0ZTXzQ0MTAwfSwgezQ4MDAwLCBMVk1fRlNfNDgwMDB9LAorICAgICAgICAgICAgezg4MjAwLCBMVk1fRlNfODgyMDB9LCAgezk2MDAwLCBMVk1fRlNfOTYwMDB9LCB7MTc2NDAwLCBMVk1fRlNfMTc2NDAwfSwKKyAgICAgICAgICAgIHsxOTIwMDAsIExWTV9GU18xOTIwMDB9fTsKKyAgICBpZiAoa0xWTUZzTWFwLmZpbmQoc2FtcGxlUmF0ZSkgIT0ga0xWTUZzTWFwLmVuZCgpKSB7CisgICAgICAgIHJldHVybiBrTFZNRnNNYXAuYXQoc2FtcGxlUmF0ZSk7CisgICAgfQorICAgIHJldHVybiBMVk1fRlNfSU5WQUxJRDsKK30KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICBTdGFuZGFyZCBGdW5jdGlvbiBQcm90b3R5cGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXR5cGVkZWYgTFZNX0lOVDMyICgqTFZNX0NhbGxiYWNrKSh2b2lkICAgICAgICAgICpwQ2FsbGJhY2tEYXRhLCAgICAgLyogUG9pbnRlciB0byB0aGUgY2FsbGJhY2sgZGF0YSBzdHJ1Y3R1cmUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICAgICpwR2VuZXJhbFB1cnBvc2UsICAgLyogR2VuZXJhbCBwdXJwb3NlIHBvaW50ZXIgKGUuZy4gdG8gYSBkYXRhIHN0cnVjdHVyZSBuZWVkZWQgaW4gdGhlIGNhbGxiYWNrKSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgR2VuZXJhbFB1cnBvc2UgKTsgICAvKiBHZW5lcmFsIHB1cnBvc2UgdmFyaWFibGUgKGUuZy4gdG8gYmUgdXNlZCBhcyBjYWxsYmFjayBJRCkgKi8KK3R5cGVkZWYgTFZNX0lOVDMyICgqTFZNX0NhbGxiYWNrKSgKKyAgICAgICAgdm9pZCogcENhbGxiYWNrRGF0YSwgICAvKiBQb2ludGVyIHRvIHRoZSBjYWxsYmFjayBkYXRhIHN0cnVjdHVyZSAqLworICAgICAgICB2b2lkKiBwR2VuZXJhbFB1cnBvc2UsIC8qIEdlbmVyYWwgcHVycG9zZSBwb2ludGVyIChlLmcuIHRvIGEgZGF0YSBzdHJ1Y3R1cmUgbmVlZGVkIGluIHRoZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrKSAqLworICAgICAgICBMVk1fSU5UMTYgR2VuZXJhbFB1cnBvc2UpOyAvKiBHZW5lcmFsIHB1cnBvc2UgdmFyaWFibGUgKGUuZy4gdG8gYmUgdXNlZCBhcyBjYWxsYmFjayBJRCkgKi8KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTE5Myw0ICsxNTEsNCBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotI2VuZGlmICAvKiBMVk1fVFlQRVNfSCAqLworI2VuZGlmIC8qIExWTV9UWVBFU19IICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9NaXhlci5oIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9saWIvTWl4ZXIuaAppbmRleCBiMmUwMTk1Li5iYTYwNWU1IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9NaXhlci5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL01peGVyLmgKQEAgLTI0LDgwICsyNCw2MiBAQAogICAgSU5TVEFOQ0UgTUVNT1JZIFRZUEUgREVGSU5JVElPTgogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLXR5cGVkZWYgc3RydWN0Ci17Ci0gICAgTFZNX0ZMT0FUICAgQWxwaGE7ICAgICAgICAgICAgICAgICAgIC8qIFRpbWUgY29uc3RhbnQuIFNldCBieSBjYWxsaW5nIGFwcGxpY2F0aW9uLiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENhbiBiZSBjaGFuZ2VkIGF0IGFueSB0aW1lICovCi0gICAgTFZNX0ZMT0FUICAgVGFyZ2V0OyAgICAgICAgICAgICAgICAgIC8qIFRhcmdldCB2YWx1ZS4gIFNldCBieSBjYWxsaW5nIGFwcGxpY2F0aW9uLiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENhbiBiZSBjaGFuZ2VkIGF0IGFueSB0aW1lICovCi0gICAgTFZNX0ZMT0FUICAgQ3VycmVudDsgICAgICAgICAgICAgICAgIC8qIEN1cnJlbnQgdmFsdWUuICBTZXQgYnkgdGhlIG1peGVyIGZ1bmN0aW9uLiAqLwotICAgIExWTV9JTlQxNiAgIENhbGxiYWNrU2V0OyAgICAgICAgICAgICAvKiBCb29sZWFuLiAgU2hvdWxkIGJlIHNldCBieSBjYWxsaW5nIGFwcGxpY2F0aW9uIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWFjaCB0aW1lIHRoZSB0YXJnZXQgdmFsdWUgaXMgdXBkYXRlZCAqLwotICAgIExWTV9JTlQxNiAgIENhbGxiYWNrUGFyYW07ICAgICAgICAgICAvKiBQYXJhbWV0ZXIgdGhhdCB3aWxsIGJlIHVzZWQgaW4gdGhlIGNhbGJhY2sgZnVuY3Rpb24gKi8KLSAgICB2b2lkICAgICA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AgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMzIgICBGcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICBOdW1DaGFubmVscyk7CitMVk1fRkxPQVQgTFZNX01peGVyX1RpbWVDb25zdGFudChMVk1fVUlOVDMyIHRjLCBMVk1fVUlOVDMyIEZzLCBMVk1fVUlOVDE2IE51bUNoYW5uZWxzKTsKIAotdm9pZCBNaXhTb2Z0XzFTdF9EMzJDMzFfV1JBKCAgICBNaXhfMVN0X0NsbF9GTE9BVF90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgIG4pOwordm9pZCBNaXhTb2Z0XzFTdF9EMzJDMzFfV1JBKE1peF8xU3RfQ2xsX0ZMT0FUX3QqIHBJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMsIExWTV9GTE9BVCogZHN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKTsKIAotdm9pZCBNaXhTb2Z0XzJTdF9EMzJDMzFfU0FUKCAgICBNaXhfMlN0X0NsbF9GTE9BVF90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgKnNyYzEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgKnNyYzIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICBuKTsKK3ZvaWQgTWl4U29mdF8yU3RfRDMyQzMxX1NBVChNaXhfMlN0X0NsbF9GTE9BVF90KiBwSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQqIHNyYzIsIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgbik7CiAKLXZvaWQgTWl4SW5Tb2Z0X0QzMkMzMV9TQVQoICAgICAgTWl4XzFTdF9DbGxfRkxPQVRfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICBuKTsKK3ZvaWQgTWl4SW5Tb2Z0X0QzMkMzMV9TQVQoTWl4XzFTdF9DbGxfRkxPQVRfdCogcEluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYywgTFZNX0ZMT0FUKiBkc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgIEZVTkNUSU9OIFBST1RPVFlQRVMgKExPVyBMRVZFTCBTVUJGVU5DVElPTlMpCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgQ29yZV9NaXhTb2Z0XzFTdF9EMzJDMzFfV1JBKCAgIE1peF8xU3RfQ2xsX0ZMT0FUX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgbik7Ci12b2lkIENvcmVfTWl4SGFyZF8yU3RfRDMyQzMxX1NBVCggICBNaXhfMlN0X0NsbF9GTE9BVF90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICpzcmMxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAqc3JjMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgbik7Ci12b2lkIENvcmVfTWl4SW5Tb2Z0X0QzMkMzMV9TQVQoICAgICBNaXhfMVN0X0NsbF9GTE9BVF90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgIG4pOwordm9pZCBDb3JlX01peFNvZnRfMVN0X0QzMkMzMV9XUkEoTWl4XzFTdF9DbGxfRkxPQVRfdCogcEluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgbik7Cit2b2lkIENvcmVfTWl4SGFyZF8yU3RfRDMyQzMxX1NBVChNaXhfMlN0X0NsbF9GTE9BVF90KiBwSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCogc3JjMiwgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBuKTsKK3ZvaWQgQ29yZV9NaXhJblNvZnRfRDMyQzMxX1NBVChNaXhfMVN0X0NsbF9GTE9BVF90KiBwSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjLCBMVk1fRkxPQVQqIGRzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbik7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9TY2FsYXJBcml0aG1ldGljLmggYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9TY2FsYXJBcml0aG1ldGljLmgKaW5kZXggYWU1NDQxOS4uMzZjNGNkMiAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9saWIvU2NhbGFyQXJpdGhtZXRpYy5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL1NjYWxhckFyaXRobWV0aWMuaApAQCAtMjEsNyArMjEsNyBAQAogLyojIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyovCiAvKiAgSW5jbHVkZSBmaWxlcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZNX0ZMT0FUIGRCX3RvX0xpbkZsb2F0KExWTV9JTlQxNiAgICBkYl9maXgpOworTFZNX0ZMT0FUIGRCX3RvX0xpbkZsb2F0KExWTV9JTlQxNiBkYl9maXgpOwogCi0jZW5kaWYgIC8qIF9fU0NBTEFSQVJJVEhNRVRJQ19IX18gKi8KLQorI2VuZGlmIC8qIF9fU0NBTEFSQVJJVEhNRVRJQ19IX18gKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL1ZlY3RvckFyaXRobWV0aWMuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vbGliL1ZlY3RvckFyaXRobWV0aWMuaAppbmRleCBiMjdiYWM1Li4xMGYzNTFlIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL2xpYi9WZWN0b3JBcml0aG1ldGljLmgKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9saWIvVmVjdG9yQXJpdGhtZXRpYy5oCkBAIC0yNCwxMjcgKzI0LDQxIEBACiAgICAgVkFSSU9VUyBGVU5DVElPTlMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi12b2lkIExvYWRDb25zdF9GbG9hdCggICAgICAgICAgY29uc3QgTFZNX0ZMT0FUIHZhbCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbiApOwordm9pZCBDb3B5X0Zsb2F0KGNvbnN0IExWTV9GTE9BVCogc3JjLCBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IG4pOwordm9pZCBDb3B5X0Zsb2F0X01jX1N0ZXJlbyhjb25zdCBMVk1fRkxPQVQqIHNyYywgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBOckZyYW1lcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDMyIE5yQ2hhbm5lbHMpOwordm9pZCBDb3B5X0Zsb2F0X1N0ZXJlb19NYyhjb25zdCBMVk1fRkxPQVQqIHNyYywgY29uc3QgTFZNX0ZMT0FUKiBTdGVyZW9PdXQsIExWTV9GTE9BVCogZHN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgTnJGcmFtZXMsIExWTV9JTlQzMiBOckNoYW5uZWxzKTsKIAotdm9pZCBDb3B5X0Zsb2F0KCAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuICk7Ci0jaWZkZWYgU1VQUE9SVF9NQwotdm9pZCBDb3B5X0Zsb2F0X01jX1N0ZXJlbyggICAgICAgY29uc3QgTFZNX0ZMT0FUICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQzMiBOckNoYW5uZWxzKTsKLXZvaWQgQ29weV9GbG9hdF9TdGVyZW9fTWMoICAgICAgIGNvbnN0IExWTV9GTE9BVCAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICpTdGVyZW9PdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQzMiBOckNoYW5uZWxzKTsKLSNlbmRpZgordm9pZCBNdWx0M3NfRmxvYXQoY29uc3QgTFZNX0ZMT0FUKiBzcmMsIGNvbnN0IExWTV9GTE9BVCB2YWwsIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgbik7CiAKLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAqIG5vdGU6IEluIE11bHQzc18xNngxNigpIHNhdHVyYXRpb24gb2YgcmVzdWx0IGlzIG5vdCB0YWtlbiBjYXJlIHdoZW4gICAgICAgICAgICoKLSAqICAgICAgIG92ZXJmbG93IG9jY3Vycy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAqICAgICAgIEZvciBleGFtcGxlIHdoZW4gKnNyYyA9IDB4ODAwMCwgdmFsID0gKjB4ODAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAqICAgICAgIFRoZSBmdW5jdGlvbiBnaXZlcyB0aGUgb3V0cHV0IGFzIDB4ODAwMCBpbnN0ZWFkIG9mIDB4N2ZmZiAgICAgICAgICAgICAgICoKLSAqICAgICAgIFRoaXMgaXMgdGhlIG9ubHkgY2FzZSB3aGljaCB3aWxsIGdpdmUgd3JvbmcgcmVzdWx0LiAgICAgICAgICAgICAgICAgICAgICoKLSAqICAgICAgIEZvciBtb3JlIGluZm9ybWF0aW9uIHJlZmVyIHRvIFZlY3Rvcl9Bcml0aG1ldGljLmRvYyBpbiAvZG9jIGZvbGRlciAgICAgICoKLSAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIE11bHQzc19GbG9hdCggICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCB2YWwsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKTsKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICogbm90ZTogSW4gTXVsdDNzXzMyeDE2KCkgc2F0dXJhdGlvbiBvZiByZXN1bHQgaXMgbm90IHRha2VuIGNhcmUgd2hlbiAgICAgICAgICAgKgotICogICAgICAgb3ZlcmZsb3cgb2NjdXJzLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICogICAgICAgRm9yIGV4YW1wbGUgd2hlbiAqc3JjID0gMHg4MDAwMDAwLCB2YWwgPSAqMHg4MDAwICAgICAgICAgICAgICAgICAgICAgICAgKgotICogICAgICAgVGhlIGZ1bmN0aW9uIGdpdmVzIHRoZSBvdXRwdXQgYXMgMHg4MDAwMDAwIGluc3RlYWQgb2YgMHg3ZmZmZmZmZiAgICAgICAgKgotICogICAgICAgVGhpcyBpcyB0aGUgb25seSBleHRyZW1lIGNvbmRpdGlvbiB3aGljaCBpcyBnaXZpbmcgdW5leHBlY3RlZCByZXN1bHQgICAgKgotICogICAgICAgRm9yIG1vcmUgaW5mb3JtYXRpb24gcmVmZXIgdG8gVmVjdG9yX0FyaXRobWV0aWMuZG9jIGluIC9kb2MgZm9sZGVyICAgICAgKgotICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgTXVsdDNzXzMyeDE2KCAgICAgICAgICAgIGNvbnN0IExWTV9JTlQzMiAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9JTlQxNiB2YWwsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbik7Ci12b2lkIERlbGF5TWl4X0Zsb2F0KGNvbnN0IExWTV9GTE9BVCAqc3JjLCAgICAgICAgICAgLyogU291cmNlIDEsIHRvIGJlIGRlbGF5ZWQgKi8KLSAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICpkZWxheSwgICAgICAgICAvKiBEZWxheSBidWZmZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IHNpemUsICAgICAgICAgICAvKiBEZWxheSBzaXplICovCi0gICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAqZHN0LCAgICAgICAgICAgLyogU291cmNlL2Rlc3RpbmF0aW9uICovCi0gICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAqcE9mZnNldCwgICAgICAgLyogRGVsYXkgb2Zmc2V0ICovCi0gICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKSAgOyAgICAgICAgICAgIC8qIE51bWJlciBvZiBzdGVyZW8gc2FtcGxlcyAqLwotdm9pZCBEZWxheVdyaXRlXzMyKCAgICAgICAgICAgY29uc3QgTFZNX0lOVDMyICAqc3JjLCAgICAgICAgICAgICAgIC8qIFNvdXJjZSAxLCB0byBiZSBkZWxheWVkICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgICpkZWxheSwgICAgICAgICAgICAgLyogRGVsYXkgYnVmZmVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2IHNpemUsICAgICAgICAgICAgICAgLyogRGVsYXkgc2l6ZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiAqcE9mZnNldCwgICAgICAgICAgIC8qIERlbGF5IG9mZnNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IG4pOwotdm9pZCBBZGQyX1NhdF9GbG9hdCggICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuICk7Ci12b2lkIE1hYzNzX1NhdF9GbG9hdCggICAgICAgICBjb25zdCBMVk1fRkxPQVQgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCB2YWwsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKTsKLXZvaWQgRGVsYXlBbGxQYXNzX1NhdF8zMngxNlRvMzIoICAgIExWTV9JTlQzMiAgKmRlbGF5LCAgICAgICAgICAgICAgLyogRGVsYXkgYnVmZmVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2IHNpemUsICAgICAgICAgICAgICAgIC8qIERlbGF5IHNpemUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBjb2VmZiwgICAgICAgICAgICAgICAgLyogQWxsIHBhc3MgZmlsdGVyIGNvZWZmaWNpZW50ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2IERlbGF5T2Zmc2V0LCAgICAgICAgIC8qIFNpbXBsZSBkZWxheSBvZmZzZXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMT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NiBuKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgICBTSElGVCBGVU5DVElPTlMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBTaGlmdF9TYXRfRmxvYXQgKGNvbnN0ICAgTFZNX0lOVDE2ICAgdmFsLAotICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICAgTFZNX0ZMT0FUICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgIG4pOwordm9pZCBTaGlmdF9TYXRfRmxvYXQoY29uc3QgTFZNX0lOVDE2IHZhbCwgY29uc3QgTFZNX0ZMT0FUKiBzcmMsIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgbik7CiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgIEFVRElPIEZPUk1BVCBDT05WRVJTSU9OIEZVTkNUSU9OUwogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIE1vbm9UbzJJX0Zsb2F0KCBjb25zdCBMVk1fRkxPQVQgICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbik7Ci12b2lkIEZyb20yaVRvTW9ub19GbG9hdCggICAgICAgICBjb25zdCBMVk1fRkxPQVQgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbik7Ci0jaWZkZWYgU1VQUE9SVF9NQwotdm9pZCBGcm9tTWNUb01vbm9fRmxvYXQoY29uc3QgTFZNX0ZMT0FUICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBOckZyYW1lcywKK3ZvaWQgTW9ub1RvMklfRmxvYXQoY29uc3QgTFZNX0ZMT0FUKiBzcmMsIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgbik7Cit2b2lkIEZyb20yaVRvTW9ub19GbG9hdChjb25zdCBMVk1fRkxPQVQqIHNyYywgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBuKTsKK3ZvaWQgRnJvbU1jVG9Nb25vX0Zsb2F0KGNvbnN0IExWTV9GTE9BVCogc3JjLCBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IE5yRnJhbWVzLAogICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IE5yQ2hhbm5lbHMpOwotI2VuZGlmCi12b2lkIE1TVG8yaV9TYXRfRmxvYXQoICAgICAgICBjb25zdCBMVk1fRkxPQVQgKnNyY00sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgKnNyY1MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuICk7Ci12b2lkIEZyb20yaVRvTVNfRmxvYXQoICAgICAgICBjb25zdCBMVk1fRkxPQVQgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAqZHN0TSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAqZHN0UywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuICk7Ci12b2lkIEpvaW5UbzJpX0Zsb2F0KCAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICpzcmNMLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAqc3JjUiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuICk7Ci0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgREFUQSBUWVBFIENPTlZFUlNJT04gRlVOQ1RJT05TCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotdm9pZCBJbnQxNkxTaGlmdFRvSW50MzJfMTZ4MzIoY29uc3QgTFZNX0lOVDE2ICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBzaGlmdCApOwotCi12b2lkIEludDMyUlNoaWZ0VG9JbnQxNl9TYXRfMzJ4MTYoY29uc3QgIExWTV9JTlQzMiAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IG4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgc2hpZnQgKTsKK3ZvaWQgTVNUbzJpX1NhdF9GbG9hdChjb25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bl9EMzJfV1JBLmNwcApAQCAtMjAsNyArMjAsNiBAQAogLyogICAgSW5jbHVkZXMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCiAjaW5jbHVkZSAiQUdDLmgiCiAjaW5jbHVkZSAiU2NhbGFyQXJpdGhtZXRpYy5oIgogCkBAIC0zMCwxNTEgKzI5LDEzIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0jZGVmaW5lIFZPTF9UQ19TSElGVCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMSAgICAgICAgICAvKiBBcyBhIHBvd2VyIG9mIDIgKi8KLSNkZWZpbmUgREVDQVlfU0hJRlQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAgICAgICAgICAgIC8qIEFzIGEgcG93ZXIgb2YgMiAqLwotI2RlZmluZSBWT0xfVENfRkxPQVQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIuMGYgICAgICAgICAgLyogQXMgYSBwb3dlciBvZiAyICovCi0jZGVmaW5lIERFQ0FZX0ZBQ19GTE9BVCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2NC4wZiAgICAgICAgICAvKiBBcyBhIHBvd2VyIG9mIDIgKi8KKyNkZWZpbmUgVk9MX1RDX1NISUZUIDIxICAgICAgIC8qIEFzIGEgcG93ZXIgb2YgMiAqLworI2RlZmluZSBERUNBWV9TSElGVCAxMCAgICAgICAgLyogQXMgYSBwb3dlciBvZiAyICovCisjZGVmaW5lIFZPTF9UQ19GTE9BVCAyLjBmICAgICAvKiBBcyBhIHBvd2VyIG9mIDIgKi8KKyNkZWZpbmUgREVDQVlfRkFDX0ZMT0FUIDY0LjBmIC8qIEFzIGEgcG93ZXIgb2YgMiAqLwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgICAgQUdDX01JWF9WT0xfMlN0MU1vbl9EMzJfV1JBICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgQXBwbHkgQUdDIGFuZCBtaXggc2lnbmFscyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFN0U3JjICAgLS0tLS0tLS0tLS0tLS0tLS0tfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICBfX19fX18gICAgICAgX3xfICAgICAgICBfX19fX19fXyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgfCAgICAgIHwgICAgIHwgICB8ICAgICAgfCAgICAgICAgfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9ub1NyYyAtLT58IEFHQyAgfC0tLS0+fCArIHwtLS0tLT58IFZvbHVtZSB8LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLT4gICAgKi8KLS8qICAgICAgICAgICAgIHwgR2FpbiB8ICAgICB8X19ffCAgICAgIHwgR2FpbiAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAqLwotLyogICAgICAgICAgICAgfF9fX19fX3wgICAgICAgICAgICAgICAgfF9fX19fX19ffCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAvfFwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19fX19fX19fXyAgICAgX19fX19fX18gICAgfCAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgICAgfCAgIHwgICAgICAgIHwgICB8ICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgIHwtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tfCBBR0MgR2FpbiB8PC0tfCBQZWFrICAgfDwtLXwgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IFVwZGF0ZSAgIHwgICB8IERldGVjdCB8ICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHxfX19fX19fX19ffCAgIHxfX19fX19fX3wgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBJbnN0YW5jZSAgICAgICAgICAgICAgIEluc3RhbmNlIHBvaW50ZXIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcFN0ZXJlb0luICAgICAgICAgICAgICAgU3RlcmVvIHNvdXJjZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwTW9ub0luICAgICAgICAgICAgICAgICBNb25vIGJhbmQgcGFzcyBzb3VyY2UgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBTdGVyZW9PdXQgICAgICAgICAgICAgIFN0ZXJlbyBkZXN0aW5hdGlvbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFZvaWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgQUdDX01JWF9WT0xfMlN0MU1vbl9EMzJfV1JBKEFHQ19NSVhfVk9MXzJTdDFNb25fRkxPQVRfdCAgKnBJbnN0YW5jZSwgICAgIC8qIEluc3RhbmNlIHBvaW50ZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAgICAgICpwU3RTcmMsICAgICAgICAvKiBTdGVyZW8gc291cmNlICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAgICAgICAqcE1vbm9TcmMsICAgICAgLyogTW9ubyBzb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICpwRHN0LCAgICAgICAgICAvKiBTdGVyZW8gZGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgIE51bVNhbXBsZXMpICAgICAvKiBOdW1iZXIgb2Ygc2FtcGxlcyAqLwotewotCi0gICAgLyoKLSAgICAgKiBHZW5lcmFsIHZhcmlhYmxlcwotICAgICAqLwotICAgIExWTV9VSU5UMTYgICAgICBpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNhbXBsZSBpbmRleCAqLwotICAgIExWTV9GTE9BVCAgICAgICBMZWZ0OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIExlZnQgc2FtcGxlICovCi0gICAgTFZNX0ZMT0FUICAgICAgIFJpZ2h0OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogUmlnaHQgc2FtcGxlICovCi0gICAgTFZNX0ZMT0FUICAgICAgIE1vbm87ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTW9ubyBzYW1wbGUgKi8KLSAgICBMVk1fRkxPQVQgICAgICAgQWJzUGVhazsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBBYnNvbHV0ZSBwZWFrIHNpZ25hbCAqLwotICAgIExWTV9GTE9BVCAgICAgICBBR0NfTXVsdDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNob3J0IEFHQyBnYWluICovCi0gICAgTFZNX0ZMT0FUICAgICAgIFZvbF9NdWx0OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU2hvcnQgdm9sdW1lICovCi0KLSAgICAvKgotICAgICAqIEluc3RhbmNlIGNvbnRyb2wgdmFyaWFibGVzCi0gICAgICovCi0gICAgTFZNX0ZMT0FUICAgICAgQUdDX0dhaW4gICAgICA9IHBJbnN0YW5jZS0+QUdDX0dhaW47ICAgICAgICAgLyogR2V0IHRoZSBjdXJyZW50IEFHQyBnYWluICovCi0gICAgTFZNX0Z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ZXJzCi0gICAgICAgICAqLwotICAgICAgICBBR0NfTXVsdCAgICA9IChMVk1fRkxPQVQpKEFHQ19HYWluKTsgICAgICAgICAgICAgIC8qIEdldCB0aGUgc2hvcnQgQUdDIGdhaW4gKi8KLSAgICAgICAgVm9sX011bHQgICAgPSAoTFZNX0ZMT0FUKShWb2xfQ3VycmVudCk7ICAgICAgICAgICAvKiBHZXQgdGhlIHNob3J0IHZvbHVtZSBnYWluICovCi0KLSAgICAgICAgLyoKLSAgICAgICAgICogR2V0IHRoZSBpbnB1dCBzYW1wbGVzCi0gICAgICAgICAqLwotICAgICAgICBMZWZ0ICA9ICpwU3RTcmMrKzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdldCB0aGUgbGVmdCBzYW1wbGUgKi8KLSAgICAgICAgUmlnaHQgPSAqcFN0U3JjKys7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBHZXQgdGhlIHJpZ2h0IHNhbXBsZSAqLwotICAgICAgICBNb25vICA9ICpwTW9ub1NyYysrOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEdldCB0aGUgbW9ubyBzYW1wbGUgKi8KLQotICAgICAgICAvKgotICAgICAgICAgKiBBcHBseSB0aGUgQUdDIGdhaW4gdG8gdGhlIG1vbm8gaW5wdXQgYW5kIG1peCB3aXRoIHRoZSBzdGVyZW8gc2lnbmFsCi0gICAgICAgICAqLwotICAgICAgICBMZWZ0ICArPSAoTW9ubyAqIEFHQ19NdWx0KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTWl4IGluIHRoZSBtb25vIHNpZ25hbCAqLwotICAgICAgICBSaWdodCArPSAoTW9ubyAqIEFHQ19NdWx0KTsKLQotICAgICAgICAvKgotICAgICAgICAgKiBBcHBseSB0aGUgdm9sdW1lIGFuZCB3cml0ZSB0byB0aGUgb3V0cHV0IHN0cmVhbQotICAgICAgICAgKi8KLSAgICAgICAgTGVmdCAgPSBMZWZ0ICAqIFZvbF9NdWx0OwotICAgICAgICBSaWdodCA9IFJpZ2h0ICogVm9sX011bHQ7Ci0gICAgICAgICpwRHN0KysgPSBMZWZ0OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU2F2ZSB0aGUgcmVzdWx0cyAqLwotICAgICAgICAqcERzdCsrID0gUmlnaHQ7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogVXBkYXRlIHRoZSBBR0MgZ2FpbgotICAgICAgICAgKi8KLSAgICAgICAgQWJzUGVhayA9IEFic19GbG9hdChMZWZ0KSA+IEFic19GbG9hdChSaWdodCkgPyBBYnNfRmxvYXQoTGVmdCkgOiBBYnNfRmxvYXQoUmlnaHQpOwotICAgICAgICBpZiAoQWJzUGVhayA+IEFHQ19UYXJnZXQpCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgKiBUaGUgc2lnbmFsIGlzIHRvbyBsYXJnZSBzbyBkZWNyZWFzZSB0aGUgZ2FpbgotICAgICAgICAgICAgICovCi0gICAgICAgICAgICBBR0NfR2FpbiA9IEFHQ19HYWluICogQUdDX0F0dGFjazsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgKiBUaGUgc2lnbmFsIGlzIHRvbyBzbWFsbCBzbyBpbmNyZWFzZSB0aGUgZ2FpbgotICAgICAgICAgICAgICovCi0gICAgICAgICAgICBpZiAoQUdDX0dhaW4gPiBBR0NfTWF4R2FpbikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBBR0NfR2FpbiAtPSAoQUdDX0RlY2F5KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBBR0NfR2FpbiArPSAoQUdDX0RlY2F5KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIC8qCi0gICAgICAgICAqIFVwZGF0ZSB0aGUgZ2FpbgotICAgICAgICAgKi8KLSAgICAgICAgVm9sX0N1cnJlbnQgKz0gIChWb2xfVGFyZ2V0IC0gVm9sX0N1cnJlbnQpICogKChMVk1fRkxPQVQpVm9sX1RDIC8gVk9MX1RDX0ZMT0FUKTsKLSAgICB9Ci0KLSAgICAvKgotICAgICAqIFVwZGF0ZSB0aGUgcGFyYW1ldGVycwotICAgICAqLwotICAgIHBJbnN0YW5jZS0+Vm9sdW1lID0gVm9sX0N1cnJlbnQ7ICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEFjdHVhbCB2b2x1bWUgc2V0dGluZyAqLwotICAgIHBJbnN0YW5jZS0+QUdDX0dhaW4gPSBBR0NfR2FpbjsKLQotICAgIHJldHVybjsKLX0KLSNpZmRlZiBTVVBQT1JUX01DCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgICAgQUdDX01JWF9WT0xfTWMxTW9uX0QzMl9XUkEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMjA5LDkzICs3MCw4MCBAQAogLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBBR0NfTUlYX1ZPTF9NYzFNb25fRDMyX1dSQShBR0NfTUlYX1ZPTF8yU3QxTW9uX0ZMT0FUX3QgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAgICAgICAqcE1jU3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICAgICAgKnBNb25vU3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgKnBEc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICBOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgIE5yQ2hhbm5lbHMpCi17Ci0KK3ZvaWQgQUdDX01JWF9WT0xfTWMxTW9uX0QzMl9XUkEoQUdDX01JWF9WT0xfMlN0MU1vbl9GTE9BVF90KiBwSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogcE1jU3JjLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQqIHBNb25vU3JjLCBMVk1fRkxPQVQqIHBEc3QsIExWTV9VSU5UMTYgTnJGcmFtZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgTnJDaGFubmVscykgewogICAgIC8qCiAgICAgICogR2VuZXJhbCB2YXJpYWJsZXMKICAgICAgKi8KLSAgICBMVk1fVUlOVDE2ICAgICAgaSwgamo7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTYW1wbGUgaW5kZXggKi8KLSAgICBMVk1fRkxPQVQgICAgICAgU2FtcGxlVmFsOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTYW1wbGUgdmFsdWUgKi8KLSAgICBMVk1fRkxPQVQgICAgICAgTW9ubzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBNb25vIHNhbXBsZSAqLwotICAgIExWTV9GTE9BVCAgICAgICBBYnNQZWFrOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEFic29sdXRlIHBlYWsgc2lnbmFsICovCi0gICAgTFZNX0ZMT0FUICAgICAgIEFHQ19NdWx0OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU2hvcnQgQUdDIGdhaW4gKi8KLSAgICBMVk1fRkxPQVQgICAgICAgVm9sX011bHQ7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTaG9ydCB2b2x1bWUgKi8KKyAgICBMVk1fVUlOVDE2IGksIGpqOyAgICAvKiBTYW1wbGUgaW5kZXggKi8KKyAgICBMVk1fRkxPQVQgU2FtcGxlVmFsOyAvKiBTYW1wbGUgdmFsdWUgKi8KKyAgICBMVk1fRkxPQVQgTW9ubzsgICAgICAvKiBNb25vIHNhbXBsZSAqLworICAgIExWTV9GTE9BVCBBYnNQZWFrOyAgIC8qIEFic29sdXRlIHBlYWsgc2lnbmFsICovCisgICAgTFZNX0ZMT0FUIEFHQ19NdWx0OyAgLyogU2hvcnQgQUdDIGdhaW4gKi8KKyAgICBMVk1fRkxPQVQgVm9sX011bHQ7ICAvKiBTaG9ydCB2b2x1bWUgKi8KIAogICAgIC8qCiAgICAgICogSW5zdGFuY2UgY29udHJvbCB2YXJpYWJsZXMK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HQ19NdWx0ICAgID0gKExWTV9GTE9BVCkoQUdDX0dhaW4pOyAgICAgICAgICAgICAgLyogR2V0IHRoZSBBR0MgZ2FpbiAqLwotICAgICAgICBWb2xfTXVsdCAgICA9IChMVk1fRkxPQVQpKFZvbF9DdXJyZW50KTsgICAgICAgICAgIC8qIEdldCB0aGUgdm9sdW1lIGdhaW4gKi8KKyAgICAgICAgQUdDX011bHQgPSAoTFZNX0ZMT0FUKShBR0NfR2Fpbik7ICAgIC8qIEdldCB0aGUgQUdDIGdhaW4gKi8KKyAgICAgICAgVm9sX011bHQgPSAoTFZNX0ZMT0FUKShWb2xfQ3VycmVudCk7IC8qIEdldCB0aGUgdm9sdW1lIGdhaW4gKi8KIAogICAgICAgICBBYnNQZWFrID0gMC4wZjsKICAgICAgICAgLyoKICAgICAgICAgICogR2V0IHRoZSBpbnB1dCBzYW1wbGVzCiAgICAgICAgICAqLwotICAgICAgICBmb3IgKGpqID0gMDsgamogPCBOckNoYW5uZWxzOyBqaisrKQotICAgICAgICB7Ci0gICAgICAgICAgICBTYW1wbGVWYWwgID0gKnBNY1NyYysrOyAgICAgICAgICAgICAgICAgICAgICAgLyogR2V0IHRoZSBzYW1wbGUgdmFsdWUgb2YgamogQ2hhbm5lbCovCi0gICAgICAgICAgICBNb25vICAgICAgID0gKnBNb25vU3JjOyAgICAgICAgICAgICAgICAgICAgICAgLyogR2V0IHRoZSBtb25vIHNhbXBsZSAqLworICAgICAgICBmb3IgKGpqID0gMDsgamogPCBOckNoYW5uZWxzOyBqaisrKSB7CisgICAgICAgICAgICBTYW1wbGVWYWwgPSAqcE1jU3JjKys7IC8qIEdldCB0aGUgc2FtcGxlIHZhbHVlIG9mIGpqIENoYW5uZWwqLworICAgICAgICAgICAgTW9ubyA9ICpwTW9ub1NyYzsgICAgICAvKiBHZXQgdGhlIG1vbm8gc2FtcGxlICovCiAKICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgKiBBcHBseSB0aGUgQUdDIGdhaW4gdG8gdGhlIG1vbm8gaW5wdXQgYW5kIG1peCB3aXRoIHRoZSBpbnB1dCBzaWduYWwKICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgU2FtcGxlVmFsICArPSAoTW9ubyAqIEFHQ19NdWx0KTsgICAgICAgICAgICAgICAgICAgICAgICAvKiBNaXggaW4gdGhlIG1vbm8gc2lnbmFsICovCisgICAgICAgICAgICBTYW1wbGVWYWwgKz0gKE1vbm8gKiBBR0NfTXVsdCk7IC8qIE1peCBpbiB0aGUgbW9ubyBzaWduYWwgKi8KIAogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIEFwcGx5IHRoZSB2b2x1bWUgYW5kIHdyaXRlIHRvIHRoZSBvdXRwdXQgc3RyZWFtCiAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIFNhbXBsZVZhbCAgPSBTYW1wbGVWYWwgICogVm9sX011bHQ7CisgICAgICAgICAgICBTYW1wbGVWYWwgPSBTYW1wbGVWYWwgKiBWb2xfTXVsdDsKIAotICAgICAgICAgICAgKnBEc3QrKyA9IFNhbXBsZVZhbDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNhdmUgdGhlIHJlc3VsdHMgKi8KKyAgICAgICAgICAgICpwRHN0KysgPSBMVk1fQ2xhbXAoU2FtcGxlVmFsKTsgLyogU2F2ZSB0aGUgcmVzdWx0cyAqLwogCiAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICogVXBkYXRlIHRoZSBBR0MgZ2FpbgogICAgICAgICAgICAgICovCiAgICAgICAgICAgICBBYnNQZWFrID0gQWJzX0Zsb2F0KFNhbXBsZVZhbCkgPiBBYnNQZWFrID8gQWJzX0Zsb2F0KFNhbXBsZVZhbCkgOiBBYnNQZWFrOwogICAgICAgICB9Ci0gICAgICAgIGlmIChBYnNQZWFrID4gQUdDX1RhcmdldCkKLSAgICAgICAgeworICAgICAgICBpZiAoQWJzUGVhayA+IEFHQ19UYXJnZXQpIHsKICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgKiBUaGUgc2lnbmFsIGlzIHRvbyBsYXJnZSBzbyBkZWNyZWFzZSB0aGUgZ2FpbgogICAgICAgICAgICAgICovCiAgICAgICAgICAgICBBR0NfR2FpbiA9IEFHQ19HYWluICogQUdDX0F0dGFjazsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgKiBUaGUgc2lnbmFsIGlzIHRvbyBzbWFsbCBzbyBpbmNyZWFzZSB0aGUgZ2FpbgogICAgICAgICAgICAgICovCi0gICAgICAgICAgICBpZiAoQUdDX0dhaW4gPiBBR0NfTWF4R2FpbikKLSAgICAgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChBR0NfR2FpbiA+IEFHQ19NYXhHYWluKSB7CiAgICAgICAgICAgICAgICAgQUdDX0dhaW4gLT0gKEFHQ19EZWNheSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7CisgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIEFHQ19HYWluICs9IChBR0NfRGVjYXkpOwogICAgICAgICAgICAgfQogICAgICAgICB9CkBAIC0zMDMsMTUgKzE1MSwxNCBAQAogICAgICAgICAvKgogICAgICAgICAgKiBVcGRhdGUgdGhlIGdhaW4KICAgICAgICAgICovCi0gICAgICAgIFZvbF9DdXJyZW50ICs9ICAoVm9sX1RhcmdldCAtIFZvbF9DdXJyZW50KSAqICgoTFZNX0ZMT0FUKVZvbF9UQyAvIFZPTF9UQ19GTE9BVCk7CisgICAgICAgIFZvbF9DdXJyZW50ICs9IChWb2xfVGFyZ2V0IC0gVm9sX0N1cnJlbnQpICogKChMVk1fRkxPQVQpVm9sX1RDIC8gVk9MX1RDX0ZMT0FUKTsKICAgICB9CiAKICAgICAvKgogICAgICAqIFVwZGF0ZSB0aGUgcGFyYW1ldGVycwogICA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qICBPdXRwdXQgICAgICA6Ci0gKiAgUmV0dXJucyAgICAgOiBBYnNvbHV0ZSB2YWx1ZQotICogIERlc2NyaXB0aW9uIDogQWJzb2x1dGUgdmFsdWUgd2l0aCBtYXhpbXVtIG5lZ2F0aXZlIHZhbHVlIGNvcm5lciBjYXNlCi0gKiAgUmVtYXJrcyAgICAgOgotICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLUxWTV9JTlQzMiAgICBBYnNfMzIoTFZNX0lOVDMyICAgIGlucHV0KQotewotICAgIGlmKGlucHV0IDwgIDApCi0gICAgewotICAgICAgICBpZiAoaW5wdXQgPT0gKExWTV9JTlQzMikoMHg4MDAwMDAwMFUpKQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBUaGUgY29ybmVyIGNhc2UsIHNvIHNldCB0byB0aGUgbWF4aW11bSBwb3NpdGl2ZSB2YWx1ZSAqLwotICAgICAgICAgICAgaW5wdXQ9KExWTV9JTlQzMikgMHg3ZmZmZmZmZjsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qIE5lZ2F0aXZlIGlucHV0LCBzbyBpbnZlcnQgKi8KLSAgICAgICAgICAgIGlucHV0ID0gKExWTV9JTlQzMikoLWlucHV0KTsKLSAgICAgICAgfQotICAgIH0KLSAgICByZXR1cm4gaW5wdXQ7Ci19Ci1MVk1fRkxPQVQgICAgQWJzX0Zsb2F0KExWTV9GTE9BVCAgICBpbnB1dCkKLXsKLSAgICBpZihpbnB1dCA8ICAwKQotICAgIHsKLSAgICAgICAgLyogTmVnYXRpdmUgaW5wdXQsIHNvIGludmVydCAqLwotICAgICAgICBpbnB1dCA9IChMVk1fRkxPQVQpKC1pbnB1dCk7Ci0gICAgfQotICAgIHJldHVybiBpbnB1dDsKLX0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZ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GhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCi0gKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KLSAqLwotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgSU5DTFVERSBGSUxFUwotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSNpbmNsdWRlICJWZWN0b3JBcml0aG1ldGljLmgiCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICBGVU5DVElPTiBBREQyX1NBVF8xNlgxNgotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLXZvaWQgQWRkMl9TYXRfMTZ4MTYoIGNvbnN0IExWTV9JTlQxNiAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgIG4gKQotewotICAgIExWTV9JTlQzMiBUZW1wOwotICAgIExWTV9JTlQxNiBpaTsKLSAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkKLSAgICB7Ci0gICAgICAgIFRlbXAgPSAoKExWTV9JTlQzMikgKnNyYykgKyAoKExWTV9JTlQzMikgKmRzdCk7Ci0gICAgICAgIHNyYysrOwotCi0gICAgICAgIGlmIChUZW1wID4gMHgwMDAwN0ZGRikKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9IDB4N0ZGRjsKLSAgICAgICAgfQotICAgICAgICBlbHNlIGlmIChUZW1wIDwgLTB4MDAwMDgwMDApCi0gICAgICAgIHsKLSAgICAgICAgICAgICpkc3QgPSAtIDB4ODAwMDsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgICpkc3QgPSAoTFZNX0lOVDE2KVRlbXA7Ci0gICAgICAgIH0KLSAgICAgICAgZHN0Kys7Ci0gICAgfQotICAgIHJldHVybjsKLX0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9BZGQyX1NhdF8zMngzMi5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9BZGQyX1NhdF8zMngzMi5jcHAKaW5kZXggYTQ4ZTY2OC4uMTk4MWVkZCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQWRkMl9TYXRfMzJ4MzIuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0FkZDJfU2F0XzMyeDMyLmNwcApAQCAtMTgsNjkgKzE4LDE1IEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgSU5DTFVERSBGSUxFUwogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KKyNpbmNsdWRlICJTY2FsYXJBcml0aG1ldGljLmgiCiAjaW5jbHVkZSAiVmVjdG9yQXJpdGhtZXRpYy5oIgogCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gQUREMl9TQVRfMzJYMzIKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIEFkZDJfU2F0XzMyeDMyKCBjb25zdCBMVk1fSU5UMzIgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgIG4gKQotewotICAgIExWTV9JTlQzMiBhLGIsYzsKLSAgICBMVk1fSU5UMTYgaWk7Ci0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICBhPSpzcmM7Ci0gICAgICAgIHNyYysrOwotCi0gICAgICAgIGI9KmRzdDsKLSAgICAgICAgYz1hK2I7Ci0gICAgICAgIGlmICgoKChjIF4gYSkgJiAoYyBeIGIpKSA+PiAzMSkhPTApICAgICAvKiBvdmVyZmxvdyAvIHVuZGVyZmxvdyAqLwotICAgICAgICB7Ci0gICAgICAgICAgICBpZihhPDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgYz0weDgwMDAwMDAwTDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBjPTB4N0ZGRkZGRkZMOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgKmRzdCA9IGM7Ci0gICAgICAgIGRzdCsrOwotICAgIH0KLSAgICByZXR1cm47Ci19Ci0KLXZvaWQgQWRkMl9TYXRfRmxvYXQoIGNvbnN0IExWTV9GTE9BVCAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgbiApCi17Cit2b2lkIEFkZDJfU2F0X0Zsb2F0KGNvbnN0IExWTV9GTE9BVCogc3JjLCBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IG4pIHsKICAgICBMVk1fRkxPQVQgVGVtcDsKICAgICBMVk1fSU5UMTYgaWk7Ci0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICBUZW1wID0gKChMVk1fRkxPQVQpICpzcmMpICsgKChMVk1fRkxPQVQpICpkc3QpOwotICAgICAgICBzcmMrKzsKLQotICAgICAgICBpZiAoVGVtcCA+IDEuMDAwMDAwZikKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9IDEuMDAwMDAwZjsKLSAgICAgICAgfQotICAgICAgICBlbHNlIGlmIChUZW1wIDwgLTEuMDAwMDAwZikKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9IC0xLjAwMDAwMGY7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICAqZHN0ID0gVGVtcDsKLSAgICAgICAgfQotICAgICAgICBkc3QrKzsKKyAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkgeworICAgICAgICBUZW1wID0gKnNyYysrICsgKmRzdDsKKyAgICAgICAgKmRzdCsrID0gTFZNX0NsYW1wKFRlbXApOwogICAgIH0KICAgICByZXR1cm47CiB9Ci0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0JQXzFJX0QxNkYxNkMxNF9UUkNfV1JBXzAxLmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0JQXzFJX0QxNkYxNkMxNF9UUkNfV1JBXzAxLmNwcApk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lciB0aGUgTGljZW5zZS4KLSAqLwotCi0jaW5jbHVkZSAiQklRVUFELmgiCi0jaW5jbHVkZSAiQlBfMUlfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfUHJpdmF0ZS5oIgotI2luY2x1ZGUgIkxWTV9NYWNyb3MuaCIKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gQVNTVU1QVElPTlM6Ci0gQ09FRlMtCi0gcEJpcXVhZFN0YXRlLT5jb2Vmc1swXSBpcyBBMCwKLSBwQmlxdWFkU3RhdGUtPmNvZWZzWzFdIGlzIC1CMiwKLSBwQmlxdWFkU3RhdGUtPmNvZWZzWzJdIGlzIC1CMSwgdGhlc2UgYXJlIGluIFExNCBmb3JtYXQKLQotIERFTEFZUy0KLSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF0gaXMgeChuLTEpTCBpbiBRMCBmb3JtYXQKLSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMV0gaXMgeChuLTIpTCBpbiBRMCBmb3JtYXQKLSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl0gaXMgeShuLTEpTCBpbiBRMCBmb3JtYXQKLSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM10gaXMgeShuLTIpTCBpbiBRMCBmb3JtYXQKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgQlBfMUlfRDE2RjE2QzE0X1RSQ19XUkFfMDEgKCBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOclNhbXBsZXMpCi0KLSAgICB7Ci0gICAgICAgIExWTV9GTE9BVCB5bkw7Ci0gICAgICAgIExWTV9JTlQxNiBpaTsKLSAgICAgICAgUEZpbHRlcl9TdGF0ZV9GTE9BVCBwQmlxdWFkU3RhdGUgPSAoUEZpbHRlcl9TdGF0ZV9GTE9BVCkgcEluc3RhbmNlOwotCi0gICAgICAgICBmb3IgKGlpID0gTnJTYW1wbGVzOyBpaSAhPSAwOyBpaS0tKQotICAgICAgICAgewotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9DRVNTSU5HIE9GIFRIRSBMRUZUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8vIHluTD0gKEEwICAqICh4KG4pTCAgLSB4KG4tMilMICApICkKLSAgICAgICAgICAgIHluTCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbMF0gKiAoKCpwRGF0YUluKS1wQmlxdWFkU3RhdGUtPnBEZWxheXNbMV0pOwotCi0gICAgICAgICAgICAvLyB5bkwrPSAoKC1CMiAgKiB5KG4tMilMICApICkKLSAgICAgICAgICAgIHluTCArPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzFdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzNdOwotCi0gICAgICAgICAgICAvLyB5bkwrPSAoKC1CMSAgKiB5KG4tMSlMICApICkKLSAgICAgICAgICAgIHluTCArPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzJdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdOwotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBVUERBVElORyBUSEUgREVMQVlTCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM10gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl07IC8vIHkobi0yKUw9eShuLTEpTAotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdOyAvLyB4KG4tMilMPXgobi0xKUwKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1syXSA9IHluTDsgLy8gVXBkYXRlIHkobi0xKUwKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXSA9ICgqcERhdGFJbisrKTsgLy8gVXBkYXRlIHgobi0xKUwKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgV1JJVElORyBUSEUgT1VUUFVUCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAqcERhdGFPdXQrKz15bkw7IC8vIFdyaXRlIExlZnQgb3V0cHV0Ci0KLSAgICAgICAgfQotCi0gICAgfQotCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9CUF8xSV9EMTZGMTZDc3NfVFJDX1d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WVkLgotICogU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAotICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCi0gKi8KLQotLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLSNpbmNsdWRlICJCSVFVQUQuaCIKLSNpbmNsdWRlICJCUF8xSV9EMTZGMTZDc3NfVFJDX1dSQV8wMV9Qcml2YXRlLmgiCi0KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi0vKiBGVU5DVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBCUF8xSV9EMTZGMTZDc3NfVFJDX1dSQV8wMV9Jbml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBUaGVzZSBmdW5jdGlvbnMgaW5pdGlhbGl6ZXMgYSBCSVFVQUQgZmlsdGVyIGRlZmluZWQgYXMgYSBjYXNjYWRlIG9mICAgKi8KLS8qICAgYmlxdWFkcmF0aWMgRmlsdGVyIFNlY3Rpb25zLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcEluc3RhbmNlICAgIC0gb3V0cHV0LCByZXR1cm5zIHRoZSBwb2ludGVyIHRvIHRoZSBTdGF0ZSBWYXJpYWJsZSAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICBUaGlzIHN0YXRlIHBvaW50ZXIgbXVzdCBiZSBwYXNzZWQgdG8gYW55IHN1YnNlcXVlbnQgICAqLwotLyogICAgICAgICAgICAgICAgICAgY2FsbCB0byAiQmlxdWFkIiBmdW5jdGlvbnMuICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcFRhcHMgICAgICAgICAtIGlucHV0LCBwb2ludGVyIHRvIHRoZSB0YXBzIG1lbW9yeSAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBDb2VmICAgICAgICAgLSBpbnB1dCwgcG9pbnRlciB0byB0aGUgY29lZmZpY2llbnQgc3RydWN0dXJlICAgICAgICAgICAqLwotLyogICBOICAgICAgICAgICAgIC0gTSBjb2VmZmljaWVudCBmYWN0b3Igb2YgUU0uTiAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHZvaWQgcmV0dXJuIGNvZGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLXZvaWQgQlBfMUlfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfSW5pdCAoICAgQmlxdWFkX0ZMT0FUX0luc3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ybWF0Ci0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIEJQXzFJX0QxNkYzMkMzMF9UUkNfV1JBXzAxICggQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgTnJTYW1wbGVzKQotewotICAgIExWTV9GTE9BVCB5bkwsdGVtcGw7Ci0gICAgTFZNX0lOVDE2IGlpOwotICAgIFBGaWx0ZXJfU3RhdGVfRkxPQVQgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfU3RhdGVfRkxPQVQpcEluc3RhbmNlOwotCi0gICAgZm9yIChpaSA9IE5yU2FtcGxlczsgaWkgIT0gMDsgaWktLSkKLSAgICB7Ci0gICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICBQUk9DRVNTSU5HIE9GIFRIRSBMRUZUIENIQU5ORUwKLSAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAvLyB5bkw9IChBMCAqICh4KG4pTCAtIHgobi0yKUwgKSkKLSAgICAgICAgdGVtcGwgPSAoTFZNX0ZMT0FUKSAqcERhdGFJbiAtIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXTsKLSAgICAgICAgeW5MID0gcEJpcXVhZFN0YXRlLT5jb2Vmc1swXSAqIHRlbXBsOwotCi0gICAgICAgIC8vIHluTCs9ICgoLUIyICAqIHkobi0yKUwgICkgKQotICAgICAgICB0ZW1wbCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbMV0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM107Ci0gICAgICAgIHluTCArPSB0ZW1wbDsKLQotICAgICAgICAvLyB5bkwrPSAoKC1CMSAgKiB5KG4tMSlMICApKQotICAgICAgICB0ZW1wbCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbMl0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl07Ci0gICAgICAgIHluTCArPSB0ZW1wbDsKLQotICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgIFVQREFUSU5HIFRIRSBERUxBWVMKLSAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM10gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl07IC8vIHkobi0yKUw9eShuLTEpTAotICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMV0gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF07IC8vIHgobi0yKUw9eChuLTEpTAotICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl0gPSB5bkw7IC8vIFVwZGF0ZSB5KG4tMSlMIGluIFExNgotICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF0gPSAoKnBEYXRhSW4rKyk7IC8vIFVwZGF0ZSB4KG4tMSlMIGluIFEwCi0KLSAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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ICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBUaGVzZSBmdW5jdGlvbnMgaW5pdGlhbGl6ZXMgYSBCYW5kIHBhc3MgZmlsdGVyIChCSVFVQUQpICAgICAgICAgICAgICAgKi8KLS8qICAgYmlxdWFkcmF0aWMgRmlsdGVyIFNlY3Rpb25zLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcEluc3RhbmNlICAgIC0gb3V0cHV0LCByZXR1cm5zIHRoZSBwb2ludGVyIHRvIHRoZSBTdGF0ZSBWYXJpYWJsZSAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICBUaGlzIHN0YXRlIHBvaW50ZXIgbXVzdCBiZSBwYXNzZWQgdG8gYW55IHN1YnNlcXVlbnQgICAqLwotLyogICAgICAgICAgICAgICAgICAgY2FsbCB0byAiQmlxdWFkIiBmdW5jdGlvbnMuICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcFRhcHMgICAgICAgICAtIGlucHV0LCBwb2ludGVyIHRvIHRoZSB0YXBzIG1lbW9yeSAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBDb2VmICAgICAgICAgLSBpbnB1dCwgcG9pbnRlciB0byB0aGUgY29lZmZpY2llbnQgc3RydWN0dXJlICAgICAgICAgICAqLwotLyogICBOICAgICAgICAgICAgIC0gTSBjb2VmZmljaWVudCBmYWN0b3Igb2YgUU0uTiAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgVGhlIGNvZWZmaWNpZW50cyBhcmUgbW9kaWZpZWQgaW4gdGhlIGluaXQoKSBmdW5jdGlvbiBzdWNoIHRoYXQgbG93ZXIgICAgICAgICAgICAgICAqLwotLyogICAgICAgIGhhbGYgd29yZCBpcyByaWdodCBzaGlmdGVkIGJ5IG9uZSBhbmQgbW9zdCBzaWduaWZpY2FudCBiaXQgb2YgdGhlIGxvd2VyICAgICAgICAgICAgKi8KLS8qICAgICAgICB3b3JkIGlzIG1hZGUgdG8gYmUgemVyby4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgUmVhc29uOiBGb3IgTUlQUyBlZmZjaWVuY3ksd2UgYXJlIHVzaW5nIERTUCAzMioxNiBtdWx0aXBsaWNhdGlvbiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgIGluc3RydWN0aW9uLiBCdXQgd2UgaGF2ZSAzMiozMiBtdWx0aXBsaWNhdGlvbi4gVGhpcyBjYW4gYmUgcmVhbGl6ZWQgYnkgdHdvIDMyKjE2ICAgICovCi0vKiAgICAgICBtdWx0aXBsaWNhdGlvbi4gQnV0IDE2dGggYml0IGluIHRoZSAzMiBiaXQgd29yZCBpcyBub3QgYSBzaWduIGJpdC4gU28gdGhpcyBpcyBkb25lICAqLwotLyogICAgICAgYnkgcHV0dGluZyAxNnRoIGJpdCB0byB6ZXJvIGFuZCBsb3NzaW5nIG9uZSBiaXQgcHJlY2lzaW9uIGJ5IGRpdmlzaW9uIG9mIGxvd2VyICAgICAgKi8KLS8qICAgICAgIGhhbGYgd29yZCBieSAyLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICB2b2lkIHJldHVybiBjb2RlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi12b2lkIEJQXzFJX0QxNkYzMkNsbF9UUkNfV1JBXzAxX0luaXQgKCAgICBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCaXF1YWRfMUlfT3JkZXIyX0ZMT0FUX1RhcHNfdCAgICpwVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJQX0ZMT0FUX0NvZWZzX3QgICAgICAgICAgICAgICAgKnBDb2VmKQotewotICAgIFBGaWx0ZXJfU3RhdGVfRkxPQVQgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfU3RhdGVfRkxPQVQpIHBJbnN0YW5jZTsKLSAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXMgICAgICAgPShMVk1fRkxPQVQgKikgcFRhcHM7Ci0KLSAgICBwQmlxdWFkU3RhdGUtPmNvZWZzWzBdID0gIHBDb2VmLT5BMDsKLSAgICBwQmlxdWFkU3RhdGUtPmNvZWZzWzFdID0gIHBDb2VmLT5CMjsKLSAgICBwQmlxdWFkU3RhdGUtPmNvZWZzWzJdID0gIHBDb2VmLT5CMTsKLX0KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tL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lczsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgewotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9DRVNTSU5HIE9GIFRIRSBMRUZUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8vIHluTD0gKEEwICAqICh4KG4pTCAgLSB4KG4tMilMICApICkKLSAgICAgICAgICAgIHRlbXBsID0gKCpwRGF0YUluKSAtIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXTsKLSAgICAgICAgICAgIHluTCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbMF0gKiB0ZW1wbDsKLQotICAgICAgICAgICAgLy8geW5MKz0gKCgtQjIgICogeShuLTIpTCAgKSApCi0gICAgICAgICAgICB0ZW1wbCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbMV0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM107Ci0gICAgICAgICAgICB5bkwgKz0gdGVtcGw7Ci0KLSAgICAgICAgICAgIC8vIHluTCs9ICgoLUIxICAqIHkobi0xKUwgICkgKQotICAgICAgICAgICAgdGVtcGwgPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzJdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdOwotICAgICAgICAgICAgeW5MICs9IHRlbXBsOwotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBVUERBVElORyBUSEUgREVMQVlTCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM10gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl07IC8vIHkobi0yKUw9eShuLTEpTAotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdOyAvLyB4KG4tMilMPXgobi0xKUwKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1syXSA9IHluTDsgLy8gVXBkYXRlIHkobi0xKUwKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXSA9ICgqcERhdGFJbisrKTsgLy8gVXBkYXRlIHgobi0xKUwKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgV1JJVElORyBUSEUgT1VUUFVUCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAqcERhdGFPdXQrKyA9IHluTDsgLy8gV3JpdGUgTGVmdCBvdXRwdXQgaW4gUTAKLQotICAgICAgICB9Ci0KLSAgICB9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9CUF8xSV9EMzJGMzJDbGxfVFJDX1dSQV8wMl9Jbml0LmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0JQXzFJX0QzMkYzMkNsbF9UUkNfV1JBXzAyX0luaXQuY3BwCmRlbGV0ZWQgZmlsZSBtb2RlIDEwMDY0NAppbmRleCA2ZjdkMGI1Li4wMDAwMDA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tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLSNpbmNsdWRlICJCSVFVQUQuaCIKLSNpbmNsdWRlICJCUF8xSV9EMzJGMzJDbGxfVFJDX1dSQV8wMl9Qcml2YXRlLmgiCi0KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi0vKiBGVU5DVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBCUF8xSV9EMzJGMzJDbGxfVFJDX1dSQV8wMl9Jbml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBUaGVzZSBmdW5jdGlvbnMgaW5pdGlhbGl6ZXMgYSBCSVFVQUQgZmlsdGVyIGRlZmluZWQgYXMgYSBjYXNjYWRlIG9mICAgKi8KLS8qICAgYmlxdWFkcmF0aWMgRmlsdGVyIFNlY3Rpb25zLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcEluc3RhbmNlICAgIC0gb3V0cHV0LCByZXR1cm5zIHRoZSBwb2ludGVyIHRvIHRoZSBTdGF0ZSBWYXJpYWJsZSAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICBUaGlzIHN0YXRlIHBvaW50ZXIgbXVzdCBiZSBwYXNzZWQgdG8gYW55IHN1YnNlcXVlbnQgICAqLwotLyogICAgICAgICAgICAgICAgICAgY2FsbCB0byAiQmlxdWFkIiBmdW5jdGlvbnMuICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcFRhcHMgICAgICAgICAtIGlucHV0LCBwb2ludGVyIHRvIHRoZSB0YXBzIG1lbW9yeSAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBDb2VmICAgICAgICAgLSBpbnB1dCwgcG9pbnRlciB0byB0aGUgY29lZmZpY2llbnQgc3RydWN0dXJlICAgICAgICAgICAqLwotLyogICBOICAgICAgICAgICAgIC0gTSBjb2VmZmljaWVudCBmYWN0b3Igb2YgUU0uTiAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHZvaWQgcmV0dXJuIGNvZGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLXZvaWQgQlBfMUlfRDMyRjMyQ2xsX1RSQ19XUkFfMDJfSW5pdCAoICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCaXF1YWRfMUlfT3JkZXIyX0ZMT0FUX1RhcHNfdCAgICpwVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlBf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BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBEYXRhT3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yU2FtcGxlcykKLSAgICB7Ci0gICAgICAgIExWTV9GTE9BVCAgeW5MOwotICAgICAgICBMVk1fSU5UMTYgaWk7Ci0gICAgICAgIFBGaWx0ZXJfU3RhdGVfRkxPQVQgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfU3RhdGVfRkxPQVQpIHBJbnN0YW5jZTsKLQotICAgICAgICAgZm9yIChpaSA9IE5yU2FtcGxlczsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgIHsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPQ0VTU0lORyBPRiBUSEUgTEVGVCBDSEFOTkVMCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvLyB5bkw9QTIgICogeChuLTIpTAotICAgICAgICAgICAgeW5MID0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzBdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdOwotCi0gICAgICAgICAgICAvLyB5bkwrPUExICogeChuLTEpTAotICAgICAgICAgICAgeW5MICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXTsKLQotICAgICAgICAgICAgLy8geW5MKz1BMCAqIHgobilMCi0gICAgICAgICAgICB5bkwgKz0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzJdICogKCpwRGF0YUluKTsKLQotICAgICAgICAgICAgLy8geW5MKz0gICgtQjIgICogeShuLTIpTCApCi0gICAgICAgICAgICB5bkwgKz0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzNdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzNdOwotCi0gICAgICAgICAgICAvLyB5bkwrPSAoLUIxICAqIHkobi0xKUwgICkKLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbNF0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl07Ci0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVQREFUSU5HIFRIRSBERUxBWVMKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1szXSA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1syXTsgLy8geShuLTIpTD15KG4tMSlMCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMV0gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF07IC8vIHgobi0yKUw9eChuLTEpTAotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdID0geW5MOyAvLyBVcGRhdGUgeShuLTEpTAotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdID0gKCpwRGF0YUluKyspOyAvLyBVcGRhdGUgeChuLTEpTAotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBXUklUSU5HIFRIRSBPVVRQVVQKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgICpwRGF0YU91dCsrID0gKExWTV9GTE9BVCl5bkw7IC8vIFdyaXRlIExlZnQgb3V0cHV0IGluIFEwCi0KLSAgICAgICAgfQotCi0gICAgfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQlFfMUlfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfSW5pdC5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9CUV8xSV9EMTZGMTZDc3NfVFJDX1dSQV8wMV9Jbml0LmNwcApkZWxldGVkIGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggZjBiNWQwNi4uMDAwMDAwMAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9CUV8xSV9EMTZGMTZDc3NfVFJDX1dSQV8wMV9Jbml0LmNwcAorKysgL2Rldi9udWxsCkBAIC0xLDYwICswLDAgQEAKLS8qCi0gKiBDb3B5cmlnaHQgKEMpIDIwMDQtMjAxMCBOWFAgU29mdHdhcmUKLSAqIENvcHlyaWdodCAoQykgMjAxMCBUaGUgQW5kcm9pZCBPcGVuIFNvdXJjZSBQcm9qZWN0Ci0gKgotICogTGljZW5zZWQgdW5kZXIgdGhlIEFwYWNoZSBMaWNlbnNlLCBWZXJzaW9uIDIuMCAodGhlICJMaWNlbnNlIik7Ci0gKiB5b3UgbWF5IG5vdC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ICAgQlFfMUlfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgVGhlc2UgZnVuY3Rpb25zIGluaXRpYWxpemVzIGEgQklRVUFEIGZpbHRlciBkZWZpbmVkIGFzIGEgY2FzY2FkZSBvZiAgICovCi0vKiAgIGJpcXVhZHJhdGljIEZpbHRlciBTZWN0aW9ucy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBJbnN0YW5jZSAgICAtIG91dHB1dCwgcmV0dXJucyB0aGUgcG9pbnRlciB0byB0aGUgU3RhdGUgVmFyaWFibGUgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgVGhpcyBzdGF0ZSBwb2ludGVyIG11c3QgYmUgcGFzc2VkIHRvIGFueSBzdWJzZXF1ZW50ICAgKi8KLS8qICAgICAgICAgICAgICAgICAgIGNhbGwgdG8gIkJpcXVhZCIgZnVuY3Rpb25zLiAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBUYXBzICAgICAgICAgLSBpbnB1dCwgcG9pbnRlciB0byB0aGUgdGFwcyBtZW1vcnkgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBwQ29lZiAgICAgICAgIC0gaW5wdXQsIHBvaW50ZXIgdG8gdGhlIGNvZWZmaWNpZW50IHN0cnVjdHVyZSAgICAgICAgICAgKi8KLS8qICAgTiAgICAgICAgICAgICAtIE0gY29lZmZpY2llbnQgZmFjdG9yIG9mIFFNLk4gICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICB2b2lkIHJldHVybiBjb2RlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi12b2lkIEJRXzFJX0QxNkYxNkNzc19UUkNfV1JBXzAxX0luaXQgKCAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQmlxdWFkXzFJX09yZGVyMl9GTE9BVF9UYXBzX3QgICAqcFRhcHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJRX0ZMT0FUX0NvZWZzX3QgICAgICAgICAgICAqcENvZWYpCi17Ci0gICAgTFZNX0ZMT0FUIHRlbXA7Ci0gICAgUEZpbHRlcl9TdGF0ZV9GTE9BVCBwQmlxdWFkU3RhdGUgPSAoUEZpbHRlcl9TdGF0ZV9GTE9BVCkgcEluc3RhbmNlOwotICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5cyAgICAgID0gKExWTV9GTE9BVCAqKSBwVGFwcyA7Ci0gICAgdGVtcCA9IHBDb2VmLT5BMjsKLSAgICBwQmlxdWFkU3RhdGUtPmNvZWZzWzBdID0gdGVtcDsKLSAgICB0ZW1wID0gcENvZWYtPkExOwotICAgIHBCaXF1YWRTdGF0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ICAgICAgICAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBEYXRhT3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yU2FtcGxlcykKLSAgICB7Ci0gICAgICAgIExWTV9GTE9BVCAgeW5MOwotICAgICAgICBMVk1fSU5UMTYgaWk7Ci0gICAgICAgIFBGaWx0ZXJfU3RhdGVfRkxPQVQgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfU3RhdGVfRkxPQVQpIHBJbnN0YW5jZTsKLQotICAgICAgICAgZm9yIChpaSA9IE5yU2FtcGxlczsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgIHsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPQ0VTU0lORyBPRiBUSEUgTEVGVCBDSEFOTkVMCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvLyB5bkw9QTIgICogeChuLTIpTAotICAgICAgICAgICAgeW5MID0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzBdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdOwotCi0gICAgICAgICAgICAvLyB5bkwrPUExICAqIHgobi0xKUwKLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMV0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF07Ci0KLSAgICAgICAgICAgIC8vIHluTCs9QTAgICogeChuKUwKLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMl0gKiAoKnBEYXRhSW4pOwotCi0gICAgICAgICAgICAvLyB5bkwrPSAoICgtQjIgICogeShuLTIpTCApCi0gICAgICAgICAgICB5bkwgKz0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzNdICogcEJpcXVhZFN0YXRlLT5jb2Vmc1szXTsKLQotICAgICAgICAgICAgLy8geW5MKz0gLUIxICAqIHkobi0xKUwKLSAgICAgICAgICAgIHluTCArPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl0gKiBwQmlxdWFkU3RhdGUtPmNvZWZzWzRdOwotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBVUERBVElORyBUSEUgREVMQVlTCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM10gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl07ICAvLyB5KG4tMilMPXkobi0xKUwKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXSA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXTsgIC8vIHgobi0yKUw9eChuLTEpTAotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdID0geW5MOyAgICAgICAgICAgICAgICAgICAgLy8gVXBkYXRlIHkobi0xKUwKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXSA9ICgqcERhdGFJbisrKTsgICAgICAgICAgICAgIC8vIFVwZGF0ZSB4KG4tMSlMCi0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioq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1ZGUgIkJRXzFJX0QxNkYzMkNzc19UUkNfV1JBXzAxX1ByaXZhdGUuaCIKLQotLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLS8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIEJRXzFJX0QxNkYzMkNzc19UUkNfV1JBXzAxX0luaXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIFRoZXNlIGZ1bmN0aW9ucyBpbml0aWFsaXplcyBhIEJJUVVBRCBmaWx0ZXIgZGVmaW5lZCBhcyBhIGNhc2NhZGUgb2YgICAqLwotLyogICBiaXF1YWRyYXRpYyBGaWx0ZXIgU2VjdGlvbnMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBwSW5zdGFuY2UgICAgLSBvdXRwdXQsIHJldHVybnMgdGhlIHBvaW50ZXIgdG8gdGhlIFN0YXRlIFZhcmlhYmxlICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgIFRoaXMgc3RhdGUgcG9pbnRlciBtdXN0IGJlIHBhc3NlZCB0byBhbnkgc3Vic2VxdWVudCAgICovCi0vKiAgICAgICAgICAgICAgICAgICBjYWxsIHRvICJCaXF1YWQiIGZ1bmN0aW9ucy4gICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBwVGFwcyAgICAgICAgIC0gaW5wdXQsIHBvaW50ZXIgdG8gdGhlIHRhcHMgbWVtb3J5ICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcENvZWYgICAgICAgICAtIGlucHV0LCBwb2ludGVyIHRvIHRoZSBjb2VmZmljaWVudCBzdHJ1Y3R1cmUgICAgICAgICAgICovCi0vKiAgIE4gICAgICAgICAgICAgLSBNIGNvZWZmaWNpZW50IGZhY3RvciBvZiBRTS5OICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgdm9pZCByZXR1cm4gY29kZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotdm9pZCBCUV8xSV9EMTZGMzJDc3NfVFJDX1dSQV8wMV9Jbml0ICggICBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJpcXVhZF8xSV9PcmRlcjJfRkxPQVRfVGFwc190ICAgKnBUYXBzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCUV9GTE9BVF9Db2Vmc190ICAgICAgICAgICAgKnBDb2VmKQotewotICAgIExWTV9GTE9BVCB0ZW1wOwotICAgIFBGaWx0ZXJfU3RhdGVfRkxPQVQgcEJpcXVhZFN0Y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RfVFJDX1dSQV8wMSAoIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBEYXRhT3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yU2FtcGxlcykKLSAgICB7Ci0gICAgICAgIExWTV9GTE9BVCAgeW5MLHluUjsKLSAgICAgICAgTFZNX0lOVDE2IGlpOwotICAgICAgICBQRmlsdGVyX1N0YXRlX0ZMT0FUIHBCaXF1YWRTdGF0ZSA9IChQRmlsdGVyX1N0YXRlX0ZMT0FUKSBwSW5zdGFuY2U7Ci0KLSAgICAgICAgIGZvciAoaWkgPSBOclNhbXBsZXM7IGlpICE9IDA7IGlpLS0pCi0gICAgICAgICB7Ci0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST0NFU1NJTkcgT0YgVEhFIExFRlQgQ0hBTk5FTAotICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgLy8geW5MPUEyICAqIHgobi0yKUwKLSAgICAgICAgICAgIHluTCA9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1swXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1syXTsKLQotICAgICAgICAgICAgLy8geW5MKz1BMSAgKiB4KG4tMSlMCi0gICAgICAgICAgICB5bkwgKz0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzFdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdOwotCi0gICAgICAgICAgICAvLyB5bkwrPUEwICAqIHgobilMCi0gICAgICAgICAgICB5bkwgKz0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzJdICogKCpwRGF0YUluKTsKLQotICAgICAgICAgICAgLy8geW5MKz0gKCAtQjIgICogeShuLTIpTCAgKQotICAgICAgICAgICAgeW5MICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1szXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s2XTsKLQotICAgICAgICAgICAgLy8geW5MKz0oIC1CMSAgKiB5KG4tMSlMICkKLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbNF0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNF07Ci0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST0NFU1NJTkcgT0YgVEhFIFJJR0hUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8vIHluUj1BMiAgKiB4KG4tMilSCi0gICAgICAgICAgICB5blIgPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMF0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM107Ci0KLSAgICAgICAgICAgIC8vIHluUis9QTEgICogeChuLTEpUgotICAgICAgICAgICAgeW5SICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXTsKLQotICAgICAgICAgICAgLy8geW5SKz1BMCAgKiB4KG4pUgotICAgICAgICAgICAgeW5SICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1syXSAqICgqKHBEYXRhSW4rMSkpOwotCi0gICAgICAgICAgICAvLyB5blIrPSAoIC1CMiAgKiB5KG4tMilSICApCi0gICAgICAgICAgICB5blIgKz0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzNdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzddOwotCi0gICAgICAgICAgICAvLyB5blIrPSggLUIxICAqIHkobi0xKVIgICkKLSAgICAgICAgICAgIHluUiArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbNF0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNV07Ci0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVQREFUSU5HIFRIRSBERUxBWVMKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s3XSA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s1XTsgIC8vIHkobi0yKVI9eShuLTEpUgotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzZdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzRdOyAgLy8geShuLTIpTD15KG4tMSlMCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM10gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMV07ICAvLyB4KG4tMilSPXgobi0xKVIKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1syXSA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXTsgIC8vIHgobi0yKUw9eChuLTEpTAotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdID0geW5SOyAgICAgICAgICAgICAgICAgICAgICAgLy8gVXBkYXRlIHkobi0xKVIKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s0XSA9IHluTDsgICAgICAgICAgICAgICAgICAgICAgIC8vIFVwZGF0ZSB5KG4tMSlMCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF0gPSAoKnBEYXRhSW4rKyk7ICAgICAgICAgICAgICAvLyBVcGRhdGUgeChuLTEpTAotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdID0gKCpwRGF0YUluKyspOyAgICAgICAgICAgICAgLy8gVXBkYXRlIHgobi0xKVIKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgV1JJVElORyBUSEUgT1VUUFVUCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAqcERhdGFPdXQrKyA9IChMVk1fRkxPQVQpeW5MOyAvLyBXcml0ZSBMZWZ0IG91dHB1dAotICAgICAgICAgICAgKnBEYXRhT3V0KysgPSAoTFZNX0ZMT0FUKXluUjsgLy8gV3JpdGUgUmlnaHQgb3VwdXQKLQotICAgICAgICB9Ci0KLSAgICB9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9CUV8ySV9EMTZGMTZDMTVfVFJDX1dSQV8wMS5jcHAgYi9tZWRpYS9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hdGUtPnBEZWxheXNbNl0gaXMgeShuLTIpTCBpbiBRMCBmb3JtYXQKLSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbN10gaXMgeShuLTIpUiBpbiBRMCBmb3JtYXQKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgQlFfMklfRDE2RjE2QzE1X1RSQ19XUkFfMDEgKCBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOclNhbXBsZXMpCi0gICAgewotICAgICAgICBMVk1fRkxPQVQgIHluTCx5blI7Ci0gICAgICAgIExWTV9JTlQxNiBpaTsKLSAgICAgICAgUEZpbHRlcl9TdGF0ZV9GTE9BVCBwQmlxdWFkU3RhdGUgPSAoUEZpbHRlcl9TdGF0ZV9GTE9BVCkgcEluc3RhbmNlOwotCi0gICAgICAgICBmb3IgKGlpID0gTnJTYW1wbGVzOyBpaSAhPSAwOyBpaS0tKQotICAgICAgICAgewotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9DRVNTSU5HIE9GIFRIRSBMRUZUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8vIHluTD1BMiAgKiB4KG4tMilMCi0gICAgICAgICAgICB5bkwgPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMF0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl07Ci0KLSAgICAgICAgICAgIC8vIHluTCs9QTEgICogeChuLTEpTAotICAgICAgICAgICAgeW5MICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXTsKLQotICAgICAgICAgICAgLy8geW5MKz1BMCAgKiB4KG4pTAotICAgICAgICAgICAgeW5MICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1syXSAqICgqcERhdGFJbik7Ci0KLSAgICAgICAgICAgIC8vIHluTCs9ICggLUIyICAqIHkobi0yKUwKLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbM10gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNl07Ci0KLSAgICAgICAgICAgIC8vIHluTCs9KCAtQjEgICogeShuLTEpTAotICAgICAgICAgICAgeW5MICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1s0XSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s0XTsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPQ0VTU0lORyBPRiBUSEUgUklHSFQgQ0hBTk5FTAotICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgLy8geW5SPUEyICAqIHgobi0yKVIKLSAgICAgICAgICAgIHluUiA9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1swXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1szXTsKLQotICAgICAgICAgICAgLy8geW5SKz1BMSAgKiB4KG4tMSlSCi0gICAgICAgICAgICB5blIgKz0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzFdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdOwotCi0gICAgICAgICAgICAvLyB5blIrPUEwICAqIHgobilSCi0gICAgICAgICAgICB5blIgKz0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzJdICogKCoocERhdGFJbisxKSk7Ci0KLSAgICAgICAgICAgIC8vIHluUis9ICggLUIyICAqIHkobi0yKVIgICkKLSAgICAgICAgICAgIHluUiArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbM10gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbN107Ci0KLSAgICAgICAgICAgIC8vIHluUis9KCAtQjEgICogeShuLTEpUiAgKQotICAgICAgICAgICAgeW5SICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1s0XSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s1XTsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgVVBEQVRJTkcgVEhFIERFTEFZUwotICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzddID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdOyAgLy8geShuLTIpUj15KG4tMSlSCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNl0gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNF07ICAvLyB5KG4tMilMPXkobi0xKUwKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1szXSA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXTsgIC8vIHgobi0yKVI9eChuLTEpUgotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdOyAgLy8geChuLTIpTD14KG4tMSlMCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNV0gPSB5blI7ICAgICAgICAgICAgICAgICAgICAgICAvLyBVcGRhdGUgeShuLTEpUgotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzRdID0geW5MOyAgICAgICAgICAgICAgICAgICAgICAgLy8gVXBkYXRlIHkobi0xKUwKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXSA9ICgqcERhdGFJbisrKTsgICAgICAgICAgICAgIC8vIFVwZGF0ZSB4KG4tMSlMCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMV0gPSAoKnBEYXRhSW4rKyk7ICAgICAgICAgICAgICAvLyBVcGRhdGUgeChuLTEpUgotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBXUklUSU5HIFRIRSBPVVRQVVQKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgICpwRGF0YU91dCsrID0gKExWTV9GTE9BVCl5bkw7IC8vIFdyaXRlIExlZnQgb3V0cHV0Ci0gICAgICAgICAgICAqcERhdGF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N0cmlidXRlZCB1bmRlciB0aGUgTGljZW5zZSBpcyBkaXN0cmlidXRlZCBvbiBhbiAiQVMgSVMiIEJBU0lTLAotICogV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuCi0gKiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCi0gKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KLSAqLwotCi0vKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotI2luY2x1ZGUgIkJJUVVBRC5oIgotI2luY2x1ZGUgIkJRXzJJX0QxNkYxNkNzc19UUkNfV1JBXzAxX1ByaXZhdGUuaCIKLQotLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLS8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIEJRXzJJX0QxNkYxNkNzc19UUkNfV1JBXzAxX0luaXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIFRoZXNlIGZ1bmN0aW9ucyBpbml0aWFsaXplcyBhIEJJUVVBRCBmaWx0ZXIgZGVmaW5lZCBhcyBhIGNhc2NhZGUgb2YgICAqLwotLyogICBiaXF1YWRyYXRpYyBGaWx0ZXIgU2VjdGlvbnMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBwSW5zdGFuY2UgICAgLSBvdXRwdXQsIHJldHVybnMgdGhlIHBvaW50ZXIgdG8gdGhlIFN0YXRlIFZhcmlhYmxlICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgIFRoaXMgc3RhdGUgcG9pbnRlciBtdXN0IGJlIHBhc3NlZCB0byBhbnkgc3Vic2VxdWVudCAgICovCi0vKiAgICAgICAgICAgICAgICAgICBjYWxsIHRvICJCaXF1YWQiIGZ1bmN0aW9ucy4gICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBwVGFwcyAgICAgICAgIC0gaW5wdXQsIHBvaW50ZXIgdG8gdGhlIHRhcHMgbWVtb3J5ICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcENvZWYgICAgICAgICAtIGlucHV0LCBwb2ludGVyIHRvIHRoZSBjb2VmZmljaWVudCBzdHJ1Y3R1cmUgICAgICAgICAgICovCi0vKiAgIE4gICAgICAgICAgICAgLSBNIGNvZWZmaWNpZW50IGZhY3RvciBvZiBRTS5OICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgdm9pZCByZXR1cm4gY29kZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKi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UluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICBOclNhbXBsZXMpCi0gICAgewotICAgICAgICBMVk1fRkxPQVQgIHluTCx5blI7Ci0gICAgICAgIExWTV9JTlQxNiBpaTsKLSAgICAgICAgUEZpbHRlcl9TdGF0ZV9GTE9BVCBwQmlxdWFkU3RhdGUgPSAoUEZpbHRlcl9TdGF0ZV9GTE9BVCkgcEluc3RhbmNlOwotCi0gICAgICAgIGZvciAoaWkgPSBOclNhbXBsZXM7IGlpICE9IDA7IGlpLS0pCi0gICAgICAgIHsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPQ0VTU0lORyBPRiBUSEUgTEVGVCBDSEFOTkVMCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvKiB5bkw9QTIgKiB4KG4tMilMICovCi0gICAgICAgICAgICB5bkwgPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMF0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl07Ci0KLSAgICAgICAgICAgIC8qIHluTCs9QTEqIHgobi0xKUwgKi8KLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMV0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF07Ci0KLSAgICAgICAgICAgIC8qIHluTCs9QTAqIHgobilMICAgKi8KLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMl0gKiAoKnBEYXRhSW4pOwotCi0gICAgICAgICAgICAvKiB5bkwrPS1CMip5KG4tMilMICovCi0gICAgICAgICAgICB5bkwgKz0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzZdICogcEJpcXVhZFN0YXRlLT5jb2Vmc1szXTsKLQotICAgICAgICAgICAgLyogeW5MKz0tQjEqeShuLTEpTCAqLwotICAgICAgICAgICAgeW5MICs9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s0XSAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbNF07Ci0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST0NFU1NJTkcgT0YgVEhFIFJJR0hUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8qIHluUj1BMiAqIHgobi0yKVIgKi8KLSAgICAgICAgICAgIHluUiA9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1swXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1szXTsKLQotICAgICAgICAgICAgLyogeW5SKz1BMSogeChuLTEpUiAqLwotICAgICAgICAgICAgeW5SICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXTsKLQotICAgICAgICAgICAgLyogeW5SKz1BMCogeChuKVIgICAqLwotICAgICAgICAgICAgeW5SICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1syXSAqICgqKHBEYXRhSW4rMSkpOwotCi0gICAgICAgICAgICAvKiB5blIrPS1CMiAqIHkobi0yKVIgKi8KLSAgICAgICAgICAgIHluUiArPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbN10gKiBwQmlxdWFkU3RhdGUtPmNvZWZzWzNdOwotCi0gICAgICAgICAgICAvKiB5blIrPS1CMSAqIHkobi0xKVIgKi8KLSAgICAgICAgICAgIHluUiArPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNV0gKiBwQmlxdWFkU3RhdGUtPmNvZWZzWzRdOwotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBVUERBVElORyBUSEUgREVMQVlTCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbN10gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNV07ICAvKiB5KG4tMilSPXkobi0xKVIqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzZdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzRdOyAgLyogeShuLTIpTD15KG4tMSlMKi8KLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1szXSA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXTsgIC8qIHgobi0yKVI9eChuLTEpUiovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl0gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF07ICAvKiB4KG4tMilMPXgobi0xKUwqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdID0geW5SOyAgICAgICAgICAgICAgICAgICAgICAgLyogVXBkYXRlIHkobi0xKVIgKi8KLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s0XSA9IHluTDsgICAgICAgICAgICAgICAgICAgICAgIC8qIFVwZGF0ZSB5KG4tMSlMICovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF0gPSAoKnBEYXRhSW4pOyAgICAgICAgICAgICAgICAvKiBVcGRhdGUgeChuLTEpTCAqLwotICAgICAgICAgICAgcERhdGFJbisrOwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdID0gKCpwRGF0YUluKTsgICAgICAgICAgICAgICAgLyogVXBkYXRlIHgobi0xKVIgKi8KLSAgICAgICAgICAgIHBEYXRhSW4rKzsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgV1JJVElORyBUSEUgT1VUUFVUCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAqcERhdGFPdXQgPSAoTFZNX0ZMT0FUKSh5bkwpOyAvKiBXcml0ZSBMZWZ0IG91dHB1dCAqLwotICAgICAgICAgICAgcERhdGFPdXQrKzsKLSAgICAgICAgICAgICpwRGF0YU91dCA9IChMVk1fRkxPQVQpKHluUik7IC8qIFdyaXRlIFJpZ2h0IG91cHV0ICovCi0gICAgICAgICAgICBwRGF0YU91dCsrOwotICAgICAgICB9Ci0gICAgfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQlFfMklfRDE2RjMyQzE0X1RSQ19XUkFfMDEuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQlFfMklfR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WF0Ci0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzddIGlzIHkobi0yKVIgaW4gUTE2IGZvcm1hdAotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBCUV8ySV9EMTZGMzJDMTRfVFJDX1dSQV8wMSAoICAgICAgICAgICBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICBOclNhbXBsZXMpCi0gICAgewotICAgICAgICBMVk1fRkxPQVQgIHluTCx5blI7Ci0gICAgICAgIExWTV9JTlQxNiBpaTsKLSAgICAgICAgUEZpbHRlcl9TdGF0ZV9GTE9BVCBwQmlxdWFkU3RhdGUgPSAoUEZpbHRlcl9TdGF0ZV9GTE9BVCkgcEluc3RhbmNlOwotCi0gICAgICAgIGZvciAoaWkgPSBOclNhbXBsZXM7IGlpICE9IDA7IGlpLS0pCi0gICAgICAgIHsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPQ0VTU0lORyBPRiBUSEUgTEVGVCBDSEFOTkVMCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvKiB5bkw9QTIgICogeChuLTIpTCAqLwotICAgICAgICAgICAgeW5MID0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzBdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdOwotCi0gICAgICAgICAgICAvKiB5bkwrPUExICAqIHgobi0xKUwgKi8KLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMV0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF07Ci0KLSAgICAgICAgICAgIC8qIHluTCs9QTAgICogeChuKUwgKi8KLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMl0gKiAoKnBEYXRhSW4pOwotCi0gICAgICAgICAgICAvKiB5bkwrPSAoICgtQjIgICogeShuLTIpTCAgKSkqLwotICAgICAgICAgICAgeW5MICs9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s2XSAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbM107Ci0KLSAgICAgICAgICAgIC8qIHluTCs9KCAoLUIxICAqIHkobi0xKUwgICkpICAqLwotICAgICAgICAgICAgeW5MICs9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s0XSAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbNF07Ci0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST0NFU1NJTkcgT0YgVEhFIFJJR0hUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8qIHluUj1BMiAgKiB4KG4tMilSICovCi0gICAgICAgICAgICB5blIgPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMF0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM107Ci0KLSAgICAgICAgICAgIC8qIHluUis9QTEgICogeChuLTEpUiAqLwotICAgICAgICAgICAgeW5SICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXTsKLQotICAgICAgICAgICAgLyogeW5SKz1BMCAgKiB4KG4pUiAqLwotICAgICAgICAgICAgeW5SICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1syXSAqICgqKHBEYXRhSW4rMSkpOwotCi0gICAgICAgICAgICAvKiB5blIrPSAoICgtQjIgICogeShuLTIpUiAgKSkqLwotICAgICAgICAgICAgeW5SICs9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s3XSAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbM107Ci0KLSAgICAgICAgICAgIC8qIHluUis9KCAoLUIxICAqIHkobi0xKVIgICkpICAqLwotICAgICAgICAgICAgeW5SICs9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s1XSAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbNF07Ci0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVQREFUSU5HIFRIRSBERUxBWVMKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s3XSA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s1XTsgIC8qIHkobi0yKVI9eShuLTEpUiovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNl0gPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNF07ICAvKiB5KG4tMilMPXkobi0xKUwqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzNdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdOyAgLyogeChuLTIpUj14KG4tMSlSKi8KLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1syXSA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXTsgIC8qIHgobi0yKUw9eChuLTEpTCovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNV0gPSB5blI7ICAgICAgICAgICAgICAgICAgICAvKiBVcGRhdGUgeShuLTEpUiAqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzRdID0geW5MOyAgICAgICAgICAgICAgICAgICAgLyogVXBkYXRlIHkobi0xKUwgKi8KLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXSA9ICgqcERhdGFJbik7ICAgICAgICAgICAgICAgIC8qIFVwZGF0ZSB4KG4tMSlMICovCi0gICAgICAgICAgICBwRGF0YUluKys7Ci0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMV0gPSAoKnBEYXRhSW4pOyAgICAgICAgICAgICAgICAvKiBVcGRhdGUgeChuLTEpUiAqLwotICAgICAgICAgICAgcERhdGFJbisrOwotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBXUklUSU5HIFRIRSBPVVRQVVQKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICA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GF0ZS0+cERlbGF5c1sxXSBpcyB4KG4tMSlSIGluIFEwIGZvcm1hdAotIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1syXSBpcyB4KG4tMilMIGluIFEwIGZvcm1hdAotIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1szXSBpcyB4KG4tMilSIGluIFEwIGZvcm1hdAotIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s0XSBpcyB5KG4tMSlMIGluIFExNiBmb3JtYXQKLSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNV0gaXMgeShuLTEpUiBpbiBRMTYgZm9ybWF0Ci0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzZdIGlzIHkobi0yKUwgaW4gUTE2IGZvcm1hdAotIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s3XSBpcyB5KG4tMilSIGluIFExNiBmb3JtYXQKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgQlFfMklfRDE2RjMyQzE1X1RSQ19XUkFfMDEgKCAgICAgICAgICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgICAgTnJTYW1wbGVzKQotICAgIHsKLSAgICAgICAgTFZNX0ZMT0FUICB5bkwseW5SOwotICAgICAgICBMVk1fSU5UMTYgaWk7Ci0gICAgICAgIFBGaWx0ZXJfU3RhdGVfRkxPQVQgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfU3RhdGVfRkxPQVQpIHBJbnN0YW5jZTsKLQotICAgICAgICAgZm9yIChpaSA9IE5yU2FtcGxlczsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgIHsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPQ0VTU0lORyBPRiBUSEUgTEVGVCBDSEFOTkVMCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvKiB5bkw9QTIgICogeChuLTIpTCAqLwotICAgICAgICAgICAgeW5MID0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzBdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdOwotCi0gICAgICAgICAgICAvKiB5bkwrPUExICAqIHgobi0xKUwgKi8KLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMV0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF07Ci0KLSAgICAgICAgICAgIC8qIHluTCs9QTAgICogeChuKUwgKi8KLSAgICAgICAgICAgIHluTCArPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMl0gKiAoKnBEYXRhSW4pOwotCi0gICAgICAgICAgICAvKiB5bkwrPSAoICgtQjIgICogeShuLTIpTCApICAqLwotICAgICAgICAgICAgeW5MICs9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s2XSAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbM107Ci0KLSAgICAgICAgICAgIC8qIHluTCs9KCAoLUIxICAqIHkobi0xKUwgICkpICAqLwotICAgICAgICAgICAgeW5MICs9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s0XSAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbNF07Ci0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST0NFU1NJTkcgT0YgVEhFIFJJR0hUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8qIHluUj1BMiAgKiB4KG4tMilSICovCi0gICAgICAgICAgICB5blIgPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMF0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM107Ci0KLSAgICAgICAgICAgIC8qIHluUis9QTEgICogeChuLTEpUiAqLwotICAgICAgICAgICAgeW5SICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXTsKLQotICAgICAgICAgICAgLyogeW5SKz1BMCAgKiB4KG4pUiAqLwotICAgICAgICAgICAgeW5SICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1syXSAqICgqKHBEYXRhSW4rMSkpOwotCi0gICAgICAgICAgICAvKiB5blIrPSAoICgtQjIgICogeShuLTIpUiApICovCi0gICAgICAgICAgICB5blIgKz0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzddICogcEJpcXVhZFN0YXRlLT5jb2Vmc1szXTsKLQotICAgICAgICAgICAgLyogeW5SKz0oICgtQjEgICogeShuLTEpUiAgKSkgaW4gUTE1ICovCi0gICAgICAgICAgICB5blIgKz0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdICogcEJpcXVhZFN0YXRlLT5jb2Vmc1s0XTsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgVVBEQVRJTkcgVEhFIERFTEFZUwotICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzddID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdOyAvKiB5KG4tMilSPXkobi0xKVIqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzZdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzRdOyAvKiB5KG4tMilMPXkobi0xKUwqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzNdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdOyAvKiB4KG4tMilSPXgobi0xKVIqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdOyAvKiB4KG4tMilMPXgobi0xKUwqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdID0geW5SOyAvKiBVcGRhdGUgeShuLTEpUiovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNF0gPSB5bkw7IC8qIFVwZGF0ZSB5KG4tMSlMKi8KLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXSA9ICgqcERhdGFJbik7IC8qIFVwZGF0ZSB4KG4tMSlMKi8KLSAgICAgICAgICAgIHBEYXRhSW4rKzsKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXSA9ICgqcERhdGFJbik7IC8qIFVwZGF0ZSB4KG4tMSlSKi8KLSAgICAgICAgICAgIHBEYXRhSW4rKzsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgV1JJVElORyBUSEUgT1VUUFVUCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAqcERhdGFPdXQgPSAoTFZNX0ZMT0FUKSh5bkwpOyAvKiBXcml0ZSBMZWZ0IG91dHB1dCovCi0gICAgICAgICAgICBwRGF0YU91dCsrOwotICAgICAgICAgICAgKnBEYXRhT3V0ID0gKExWTV9GTE9BVCkoeW5SKTsgLyogV3JpdGUgUmlnaHQgb3VwdXQqLwotICAgICAgICAgICAgcERhdGFPdXQrKzsKLSAgICAgICAgfQotCi0gICAgfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQlFfMklfRDE2RjMyQ3NzX1RSQ19XUkFfMDFfUHJpdmF0ZS5oIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQlFfMklfRDE2RjMyQ3NzX1RSQ19XUkFfMDFfUHJpdmF0ZS5oCmRlbGV0ZWQgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAzMTQzODhhLi4wMDAwMDAwCi0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0JRXzJJX0QxNkYzMkNzc19UUkNfV1JBXzAxX1ByaXZhdGUuaAorKysgL2Rldi9udWxsCkBAIC0xLDM5ICswLDAgQEAKLS8qCi0gKiBDb3B5cmlnaHQgKEMpIDIwMDQtMjAxMCBOWFAgU29mdHdhcmUKLSAqI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YW4gIkFTIElTIiBCQVNJUywKLSAqIFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgotICogU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAotICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCi0gKi8KLQotI2luY2x1ZGUgIkJJUVVBRC5oIgotI2luY2x1ZGUgIkJRXzJJX0QxNkYzMkNzc19UUkNfV1JBXzAxX1ByaXZhdGUuaCIKLQotLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLS8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIEJRXzJJX0QxNkYzMkNzc19UUkNfV1JBXzAxX0luaXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIFRoZXNlIGZ1bmN0aW9ucyBpbml0aWFsaXplcyBhIEJJUVVBRCBmaWx0ZXIgZGVmaW5lZCBhcyBhIGNhc2NhZGUgb2YgICAqLwotLyogICBiaXF1YWRyYXRpYyBGaWx0ZXIgU2VjdGlvbnMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBwSW5zdGFuY2UgICAgLSBvdXRwdXQsIHJldHVybnMgdGhlIHBvaW50ZXIgdG8gdGhlIFN0YXRlIFZhcmlhYmxlICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgIFRoaXMgc3RhdGUgcG9pbnRlciBtdXN0IGJlIHBhc3NlZCB0byBhbnkgc3Vic2VxdWVudCAgICovCi0vKiAgICAgICAgICAgICAgICAgICBjYWxsIHRvICJCaXF1YWQiIGZ1bmN0aW9ucy4gICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBwVGFwcyAgICAgICAgIC0gaW5wdXQsIHBvaW50ZXIgdG8gdGhlIHRhcHMgbWVtb3J5ICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcENvZWYgICAgICAgICAtIGlucHV0LCBwb2ludGVyIHRvIHRoZSBjb2VmZmljaWVudCBzdHJ1Y3R1cmUgICAgICAgICAgICovCi0vKiAgIE4gICAgICAgICAgICAgLSBNIGNvZWZmaWNpZW50IGZhY3RvciBvZiBRTS5OICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgdm9pZCByZXR1cm4gY29kZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotdm9pZCBCUV8ySV9EMTZGMzJDc3NfVFJDX1dSQV8wMV9Jbml0ICggICBCaXF1YWRf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gUTAgZm9ybWF0Ci0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdIGlzIHkobi0xKVIgaW4gUTAgZm9ybWF0Ci0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzZdIGlzIHkobi0yKUwgaW4gUTAgZm9ybWF0Ci0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzddIGlzIHkobi0yKVIgaW4gUTAgZm9ybWF0Ci0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIEJRXzJJX0QzMkYzMkMzMF9UUkNfV1JBXzAxICggICAgICAgICAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICAgKnBEYXRhT3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgIE5yU2FtcGxlcykKLQotICAgIHsKLSAgICAgICAgTFZNX0ZMT0FUIHluTCx5blIsdGVtcGwsdGVtcGQ7Ci0gICAgICAgIExWTV9JTlQxNiBpaTsKLSAgICAgICAgUEZpbHRlcl9TdGF0ZV9GTE9BVCBwQmlxdWFkU3RhdGUgPSAoUEZpbHRlcl9TdGF0ZV9GTE9BVCkgcEluc3RhbmNlOwotCi0gICAgICAgICBmb3IgKGlpID0gTnJTYW1wbGVzOyBpaSAhPSAwOyBpaS0tKQotICAgICAgICAgewotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9DRVNTSU5HIE9GIFRIRSBMRUZUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8qIHluTD0gKCBBMiAgKiB4KG4tMilMICApICovCi0gICAgICAgICAgICB5bkwgPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzBdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdOwotCi0gICAgICAgICAgICAvKiB5bkwrPSAoIEExICAqIHgobi0xKUwgICkqLwotICAgICAgICAgICAgdGVtcGwgPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzFdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdOwotICAgICAgICAgICAgeW5MICs9IHRlbXBsOwotCi0gICAgICAgICAgICAvKiB5bkwrPSAoIEEwICAqIHgobilMICApICovCi0gICAgICAgICAgICB0ZW1wbCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbMl0gKiAoKnBEYXRhSW4pOwotICAgICAgICAgICAgeW5MICs9IHRlbXBsOwotCi0gICAgICAgICAgICAgLyogeW5MKz0gKC1CMiAgKiB5KG4tMilMICApICovCi0gICAgICAgICAgICB0ZW1wbCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbM10gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNl07Ci0gICAgICAgICAgICB5bkwgKz0gdGVtcGw7Ci0KLSAgICAgICAgICAgIC8qIHluTCs9ICgtQjEgICogeShuLTEpTCAgKSovCi0gICAgICAgICAgICB0ZW1wbCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbNF0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNF07Ci0gICAgICAgICAgICB5bkwgKz0gdGVtcGw7Ci0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST0NFU1NJTkcgT0YgVEhFIFJJR0hUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8qIHluUj0gKCBBMiAgKiB4KG4tMilSICApICovCi0gICAgICAgICAgICB5blIgPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzBdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzNdOwotCi0gICAgICAgICAgICAvKiB5blIrPSAoIEExICAqIHgobi0xKVIgICkgKi8KLSAgICAgICAgICAgIHRlbXBsID0gcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXTsKLSAgICAgICAgICAgIHluUiArPSB0ZW1wbDsKLQotICAgICAgICAgICAgLyogeW5SKz0gKCBBMCAgKiB4KG4pUiAgKSAqLwotICAgICAgICAgICAgdGVtcGQgPSogKHBEYXRhSW4rMSk7Ci0gICAgICAgICAgICB0ZW1wbCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbMl0gKiB0ZW1wZDsKLSAgICAgICAgICAgIHluUiArPSB0ZW1wbDsKLQotICAgICAgICAgICAgLyogeW5SKz0gKC1CMiAgKiB5KG4tMilSICApICovCi0gICAgICAgICAgICB0ZW1wbCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbM10gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbN107Ci0gICAgICAgICAgICB5blIgKz0gdGVtcGw7Ci0KLSAgICAgICAgICAgIC8qIHluUis9ICgtQjEgICogeShuLTEpUiAgKSAgKi8KLSAgICAgICAgICAgIHRlbXBsID0gcEJpcXVhZFN0YXRlLT5jb2Vmc1s0XSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s1XTsKLSAgICAgICAgICAgIHluUiArPSB0ZW1wbDsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgVVBEQVRJTkcgVEhFIERFTEFZUwotICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzddID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdOyAvKiB5KG4tMilSPXkobi0xKVIqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzZdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzRdOyAvKiB5KG4tMilMPXkobi0xKUwqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzNdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdOyAvKiB4KG4tMilSPXgobi0xKVIqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdOyAvKiB4KG4tMilMPXgobi0xKUwqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdID0gKExWTV9GTE9BVCl5blI7IC8qIFVwZGF0ZSB5KG4tMSlSICovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbNF0gPSAoTFZNX0ZMT0FUKXluTDsgLyogVXBkYXRlIHkobi0xKUwgKi8KLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXSA9ICgqcERhdGFJbik7IC8qIFVwZGF0ZSB4KG4tMSlMICovCi0gICAgICAgICAgICBwRGF0YUluKys7Ci0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMV0gPSAoKnBEYXRhSW4pOyAvKiBVcGRhdGUgeChuLTEpUiAqLwotICAgICAgICAgICAgcERhdGFJbisrOwotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBXUklUSU5HIFRIRSBPVVRQVVQKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgICpwRGF0YU91dCA9IChMVk1fRkxPQVQpeW5MOyAvKiBXcml0ZSBMZWZ0IG91dHB1dCAqLwotICAgICAgICAgICAgcERhdGFPdXQrKzsKLSAgICAgICAgICAgICpwRGF0YU91dCA9IChMVk1fRkxPQVQpeW5SOyAvKiBXcml0ZSBSaWdodCBvdXB1dCAqLwotICAgICAgICAgICAgcERhdGFPdXQrKzsKLQotICAgICAgICB9Ci0KLSAgICB9Ci0KLSNpZmRlZiBTVVBQT1JUX01DCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSBBU1NVTVBUSU9OUzoKLSBDT0VGUy0KLSBwQmlxdWFkU3RhdGUtPmNvZWZzWzBdIGlzIEEyLCBwQmlxdWFkU3RhdGUtPmNvZWZzWzFdIGlzIEExCi0gcEJpcXVhZFN0YXRlLT5jb2Vmc1syXSBpcyBBMCwgcEJpcXVhZFN0YXRlLT5jb2Vmc1szXSBpcyAtQjIKLSBwQmlxdWFkU3RhdGUtPmNvZWZzWzRdIGlzIC1CMQotCi0gREVMQVlTLQotIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXSB0bwotIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1tOckNoYW5uZWxzIC0gMV0gaXMgeChuLTEpIGZvciBhbGwgTnJDaGFubmVscwotCi0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzW05yQ2hhbm5lbHNdIHRvCi0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzIqTnJDaGFubmVscyAtIDFdIGlzIHgobi0yKSBmb3IgYWxsIE5yQ2hhbm5lbHMKLQotIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1syKk5yQ2hhbm5lbHNdIHRvCi0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzMqTnJDaGFubmVscyAtIDFdIGlzIHkobi0xKSBmb3IgYWxsIE5yQ2hhbm5lbHMKLQotIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1szKk5yQ2hhbm5lbHNdIHRvCi0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzQqTnJDaGFubmVscyAtIDFdIGlzIHkobi0yKSBmb3IgYWxsIE5yQ2hhbm5lbHMKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgQlFfTUNfRDMyRjMyQzMwX1RSQ19XUkFfMDEgKCAgICAgICAgICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICBOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICBOckNoYW5uZWxzKQotCi0gICAgewotICAgICAgICBMVk1fRkxPQVQgeW4sIHRlbXA7Ci0gICAgICAgIExWTV9JTlQxNiBpaSwgamo7Ci0gICAgICAgIFBGaWx0ZXJfU3RhdGVfRkxPQVQgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfU3RhdGVfRkxPQVQpIHBJbnN0YW5jZTsKLQotICAgICAgICAgZm9yIChpaSA9IE5yRnJhbWVzOyBpaSAhPSAwOyBpaS0tKQotICAgICAgICAgewotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPQ0VTU0lORyBDSEFOTkVMLVdJU0UKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIGZvciAoamogPSAwOyBqaiA8IE5yQ2hhbm5lbHM7IGpqKyspCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLyogeW49IChBMiAgKiB4KG4tMikpICovCi0gICAgICAgICAgICAgICAgeW4gPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzBdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzW05yQ2hhbm5lbHMgKyBqal07Ci0KLSAgICAgICAgICAgICAgICAvKiB5bis9IChBMSAgKiB4KG4tMSkpICovCi0gICAgICAgICAgICAgICAgdGVtcCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbMV0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbampdOwotICAgICAgICAgICAgICAgIHluICs9IHRlbXA7Ci0KLSAgICAgICAgICAgICAgICAvKiB5bis9IChBMCAgKiB4KG4pKSAqLwotICAgICAgICAgICAgICAgIHRlbXAgPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzJdICogKCpwRGF0YUluKTsKLSAgICAgICAgICAgICAgICB5biArPSB0ZW1wOwotCi0gICAgICAgICAgICAgICAgIC8qIHluKz0gKC1CMiAgKiB5KG4tMikpICovCi0gICAgICAgICAgICAgICAgdGVtcCA9IHBCaXF1YWRTdGF0ZS0+Y29lZnNbM10gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbTnJDaGFubmVscyozICsgampdOwotICAgICAgICAgICAgICAgIHluICs9IHRlbXA7Ci0KLSAgICAgICAgICAgICAgICAvKiB5bis9ICgtQjEgICogeShuLTEpKSAqLwotICAgICAgICAgICAgICAgIHRlbXAgPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzRdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzW05yQ2hhbm5lbHMqMiArIGpqXTsKLSAgICAgICAgICAgICAgICB5biArPSB0ZW1wOwotCi0gICAgICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVQREFUSU5HIFRIRSBERUxBWVMKLSAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzW05yQ2hhbm5lbHMgKiAzICsgampdID0KLSAgICAgICAgICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzW05yQ2hhbm5lbHMgKiAyICsgampdOyAvKiB5KG4tMik9eShuLTEpKi8KLSAgICAgICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbTnJDaGFubmVscyAqIDEgKyBqal0gPQotICAgICAgICAgICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbampdOyAvKiB4KG4tMik9eChuLTEpKi8KLSAgICAgICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbTnJDaGFubmVscyAqIDIgKyBqal0gPSAoTFZNX0ZMT0FUKXluOyAvKiBVcGRhdGUgeShuLTEpKi8KLSAgICAgICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbampdID0gKCpwRGF0YUluKTsgLyogVXBkYXRlIHgobi0xKSovCi0gICAgICAgICAgICAgICAgcERhdGFJbisrOwotICAgICAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXUklUSU5HIFRIRSBPVVRQVVQKLSAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAgICAgKnBEYXRhT3V0ID0gKExWTV9GTE9BVCl5bjsgLyogV3JpdGUgamogQ2hhbm5lbCBvdXRwdXQgKi8KLSAgICAgICAgICAgICAgICBwRGF0YU91dCsrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICB9Ci0jZW5kaWYgLypTVVBQT1JUX01DKi8KLQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQlFfMklfRDMyRjMyQ2xsX1RSQ19XUkFfMDFfSW5pdC5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9CUV8ySV9EMzJGMzJDbGxfVFJDX1dSQV8wMV9Jbml0LmNwcApkZWxldGVkIGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggNDkyYTllMC4uMDAwMDAwMAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9CUV8ySV9EMzJGMzJDbGxfVFJDX1dSQV8w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tLSovCi0jaW5jbHVkZSAiQklRVUFELmgiCi0jaW5jbHVkZSAiQlFfMklfRDMyRjMyQ2xsX1RSQ19XUkFfMDFfUHJpdmF0ZS5oIgotCi0vKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgQlFfMklfRDMyRjMyQ2xsX1RSQ19XUkFfMDFfSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgVGhlc2UgZnVuY3Rpb25zIGluaXRpYWxpemVzIGEgQklRVUFEIGZpbHRlciBkZWZpbmVkIGFzIGEgY2FzY2FkZSBvZiAgICovCi0vKiAgIGJpcXVhZHJhdGljIEZpbHRlciBTZWN0aW9ucy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBJbnN0YW5jZSAgICAtIG91dHB1dCwgcmV0dXJucyB0aGUgcG9pbnRlciB0byB0aGUgU3RhdGUgVmFyaWFibGUgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgVGhpcyBzdGF0ZSBwb2ludGVyIG11c3QgYmUgcGFzc2VkIHRvIGFueSBzdWJzZXF1ZW50ICAgKi8KLS8qICAgICAgICAgICAgICAgICAgIGNhbGwgdG8gIkJpcXVhZCIgZnVuY3Rpb25zLiAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBUYXBzICAgICAgICAgLSBpbnB1dCwgcG9pbnRlciB0byB0aGUgdGFwcyBtZW1vcnkgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBwQ29lZiAgICAgICAgIC0gaW5wdXQsIHBvaW50ZXIgdG8gdGhlIGNvZWZmaWNpZW50IHN0cnVjdHVyZSAgICAgICAgICAgKi8KLS8qICAgTiAgICAgICAgICAgICAtIE0gY29lZmZpY2llbnQgZmFjdG9yIG9mIFFNLk4gICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICB2b2lkIHJldHVybiBjb2RlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi12b2lkIEJRXzJJX0QzMkYzMkNsbF9UUkNfV1JBXzAxX0luaXQgKCAgIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQmlxdWFkXzJJX09yZGVyMl9GTE9BVF9UYXBzX3QgICAqcFRhcHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJRX0ZMT0FUX0NvZWZzX3QgICAgICAgICAgICAqcENvZWYpCi17Ci0gICAgTFZNX0ZMT0FUIHRlbXA7Ci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gMgotI2RlZmluZSBHQUlOXzE4REIgICAzCi0jZGVmaW5lIEdBSU5fMjREQiAgIDQKKyNkZWZpbmUgR0FJTl82REIgMQorI2RlZmluZSBHQUlOXzEyREIgMgorI2RlZmluZSBHQUlOXzE4REIgMworI2RlZmluZSBHQUlOXzI0REIgNAogCiAjZW5kaWYgLyogI2lmbmRlZiBfQ09NUF9MSU1fUFJJVkFURV8gKi8KIAogLyoqKiBFbmQgb2YgZmlsZSAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0NvcHlfMTYuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQ29weV8xNi5jcHAKaW5kZXggM2E1MDU1NC4uMWZlNzQ3MCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQ29weV8xNi5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQ29weV8xNi5jcHAKQEAgLTE4LDEzMCArMTgsNjUgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBJTkNMVURFIEZJTEVTCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQorI2luY2x1ZGUgPHN0cmluZy5oPgogI2luY2x1ZGUgIlZlY3RvckFyaXRobWV0aWMuaCIKIAotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIEZVTkNUSU9OIENPUFlfMTYKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIENvcHlfMTYoIGNvbnN0IExWTV9JTlQxNiAqc3JjLAotICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICBuICkKLXsKLSAgICBMVk1fSU5UMTYgaWk7Ci0KLSAgICBpZiAoc3JjID4gZHN0KQotICAgIHsKLSAgICAgICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgICAgIHsKLSAgICAgICAgICAgICpkc3QgPSAqc3JjOwotICAgICAgICAgICAgZHN0Kys7Ci0gICAgICAgICAgICBzcmMrKzsKLSAgICAgICAgfQotICAgIH0KLSAgICBlbHNlCi0gICAgewotICAgICAgICBzcmMgKz0gbiAtIDE7Ci0gICAgICAgIGRzdCArPSBuIC0gMTsKLSAgICAgICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgICAgIHsKLSAgICAgICAgICAgICpkc3QgPSAqc3JjOwotICAgICAgICAgICAgZHN0LS07Ci0gICAgICAgICAgICBzcmMtLTsKLSAgICAgICAgfQotICAgIH0KLQordm9pZCBDb3B5X0Zsb2F0KGNvbnN0IExWTV9GTE9BVCogc3JjLCBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IG4pIHsKKyAgICBtZW1tb3ZlKGRzdCwgc3JjLCBuICogc2l6ZW9mKExWTV9GTE9BVCkpOwogICAgIHJldHVybjsKIH0KLXZvaWQgQ29weV9GbG9hdCggY29uc3QgTFZNX0ZMT0FUICpzcmMsCi0gICAgICAgICAgICAgICAgIExWTV9GTE9BVCAqZHN0LAotICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgIG4gKQotewotICAgIExWTV9JTlQxNiBpaTsKLQotICAgIGlmIChzcmMgPiBkc3QpCi0gICAgewotICAgICAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9ICpzcmM7Ci0gICAgICAgICAgICBkc3QrKzsKLSAgICAgICAgICAgIHNyYysrOwotICAgICAgICB9Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIHNyYyArPSBuIC0gMTsKLSAgICAgICAgZHN0ICs9IG4gLSAxOwotICAgICAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9ICpzcmM7Ci0gICAgICAgICAgICBkc3QtLTsKLSAgICAgICAgICAgIHNyYy0tOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcmV0dXJuOwotfQotI2lmZGVmIFNVUFBPUlRfTUMKIC8vIEV4dHJhY3Qgb3V0IHRoZSBzdGVyZW8gY2hhbm5lbCBwYWlyIGZyb20gbXVsdGljaGFubmVsIHNvdXJjZS4KLXZvaWQgQ29weV9GbG9hdF9NY19TdGVyZW8oY29uc3QgTFZNX0ZMT0FUICpzcmMsCi0gICAgICAgICAgICAgICAgIExWTV9GTE9BVCAqZHN0LAotICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgTnJGcmFtZXMsIC8qIE51bWJlciBvZiBmcmFtZXMgKi8KLSAgICAgICAgICAgICAgICAgTFZNX0lOVDMyIE5yQ2hhbm5lbHMpCi17Cit2b2lkIENvcHlfRmxvYXRfTWNfU3RlcmVvKGNvbnN0IExWTV9GTE9BVCogc3JjLCBMVk1fRkxPQVQqIGRzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IE5yRnJhbWVzLCAvKiBOdW1iZXIgb2YgZnJhbWVzICovCisgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQzMiBOckNoYW5uZWxzKSB7CiAgICAgTFZNX0lOVDE2IGlpOwogCi0gICAgaWYgKE5yQ2hhbm5lbHMgPj0gMikKLSAgICB7Ci0gICAgICAgIGZvciAoaWkgPSBOckZyYW1lczsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgeworICAgIGlmIChOckNoYW5uZWxzID49IDIpIHsKKyAgICAgICAgZm9yIChpaSA9IE5yRnJhbWVzOyBpaSAhPSAwOyBpaS0tKSB7CiAgICAgICAgICAgICBkc3RbMF0gPSBzcmNbMF07CiAgICAgICAgICAgICBkc3RbMV0gPSBzcmNbMV07CiAgICAgICAgICAgICBkc3QgKz0gMjsKICAgICAgICAgICAgIHNyYyArPSBOckNoYW5uZWxzOwogICAgICAgICB9Ci0gICAgfQotICAgIGVsc2UgaWYgKE5yQ2hhbm5lbHMgPT0gMSkKLSAgICB7ICAgLy8gbm90IGV4cGVjdGVkIHRvIG9jY3VyLCBwcm92aWRlZCBmb3IgY29tcGxldGVuZXNzLgorICAgIH0gZWxzZSBpZiAoTnJDaGFubmVscyA9PSAxKSB7ICAvLyBub3QgZXhwZWN0ZWQgdG8gb2NjdXIsIHByb3ZpZGVkIGZvciBjb21wbGV0ZW5lc3MuCiAgICAgICAgIHNyYyArPSAoTnJGcmFtZXMgLSAxKTsKICAgICAgICAgZHN0ICs9IDIgKiAoTnJGcmFtZXMgLSAxKTsKLSAgICAgICAgZm9yIChpaSA9IE5yRnJhbWVzOyBpaSAhPSAwOyBpaS0tKQotICAgICAgICB7CisgICAgICAgIGZvciAoaWkgPSBOckZyYW1lczsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICAgICAgZHN0WzBdID0gc3JjWzBdOwogICAgICAgICAgICAgZHN0WzFdID0gc3JjWzBdOwogICAgICAgICAgICAgZHN0IC09IDI7Ci0gICAgICAgICAgICBzcmMgLS07CisgICAgICAgICAgICBzcmMtLTsKICAgICAgICAgfQogICAgIH0KIH0KIAogLy8gTWVyZ2UgYSBtdWx0aWNoYW5uZWwgc291cmNlIHdpdGggc3RlcmVvIGNvbnRhaW5lZCBpbiBTdGVyZW9PdXQsIHRvIGRzdC4KLXZvaWQg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zID09IDMuCi0gICAgICAgIGZvciAoamogPSAyOyBqaiA8IE5yQ2hhbm5lbHM7IGpqKyspCi0gICAgICAgIHsKLSAgICAgICAgICAgIGRzdFtqal0gPSBzcmNbampdOworICAgIGlmIChOckNoYW5uZWxzID49IEZDQ18yKSB7CisgICAgICAgIC8vIHBhY2sgZHN0IHdpdGggc3RlcmVvIGluZm9ybWF0aW9uIG9mIFN0ZXJlb091dAorICAgICAgICAvLyB0b2dldGhlciB3aXRoIHRoZSB1cHBlciBjaGFubmVscyBvZiBzcmMuCisgICAgICAgIFN0ZXJlb091dCArPSAyICogKE5yRnJhbWVzIC0gMSk7CisgICAgICAgIGRzdCArPSBOckNoYW5uZWxzICogKE5yRnJhbWVzIC0gMSk7CisgICAgICAgIHNyYyArPSBOckNoYW5uZWxzICogKE5yRnJhbWVzIC0gMSk7CisKKyAgICAgICAgZm9yIChpaSA9IE5yRnJhbWVzOyBpaSAhPSAwOyBpaS0tKSB7CisgICAgICAgICAgICBkc3RbMV0gPSBTdGVyZW9PdXRbMV07CisgICAgICAgICAgICBkc3RbMF0gPSBTdGVyZW9PdXRbMF07ICAvLyBjb3B5IDEgYmVmb3JlIDAgaXMgcmVxdWlyZWQgZm9yIE5yQ2hhbm5lbHMgPT0gMy4KKyAgICAgICAgICAgIGZvciAoamogPSBGQ0NfMjsgamogPCBOckNoYW5uZWxzOyBqaisrKSB7CisgICAgICAgICAgICAgICAgZHN0W2pqXSA9IHNyY1tqal07CisgICAgICAgICAgICB9CisgICAgICAgICAgICBkc3QgLT0gTnJDaGFubmVsczsKKyAgICAgICAgICAgIHNyYyAtPSBOckNoYW5uZWxzOworICAgICAgICAgICAgU3RlcmVvT3V0IC09IDI7CiAgICAgICAgIH0KLSAgICAgICAgZHN0ICAgIC09IE5yQ2hhbm5lbHM7Ci0gICAgICAgIHNyYyAgICAtPSBOckNoYW5uZWxzOwotICAgICAgICBTdGVyZW9PdXQgLT0gMjsKKyAgICB9IGVsc2UgeworICAgICAgICBDb3B5X0Zsb2F0KChjb25zdCBMVk1fRkxPQVQqKVN0ZXJlb091dCwgLyogU291cmNlICovCisgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCopZHN0LCAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLworICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnJGcmFtZXMpOyAgICAgICAgLyogTnVtYmVyIG9mIGZyYW1lcyAqLwogICAgIH0KIH0KLSNlbmRpZgogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Db3JlX01peEhhcmRfMlN0X0QzMkMzMV9TQVQuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQ29yZV9NaXhIYXJkXzJTdF9EMzJDMzFfU0FULmNwcAppbmRleCA1ZTc3MzM1Li4yYzIwNjFhIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Db3JlX01peEhhcmRfMlN0X0QzMkMzMV9TQVQuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0NvcmVfTWl4SGFyZF8yU3RfRDMyQzMxX1NBVC5jcHAKQEAgLTI1LDEzICsyNSw5IEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgRlVOQ1RJT04gQ09SRV9NSVhIQVJEXzJTVF9EMzJDMzFfU0FUCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgQ29yZV9NaXhIYXJkXzJTdF9EMzJDMzFfU0FUKCAgIE1peF8yU3RfQ2xsX0ZMT0FUX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgKnNyYzEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICpzcmMyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICBuKQotewotICAgIExWTV9GTE9BVCAgVGVtcDEsVGVtcDIsVGVtcDM7Cit2b2lkIENvcmVfTWl4SGFyZF8yU3RfRDMyQzMxX1NBVChNaXhfMlN0X0NsbF9GTE9BVF90KiBwSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCogc3JjMiwgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBuKSB7CisgICAgTFZNX0ZMT0FUIFRlbXAxLCBUZW1wMiwgVGVtcDM7CiAgICAgTFZNX0lOVDE2IGlpOwogICAgIExWTV9GTE9BVCBDdXJyZW50MVNob3J0OwogICAgIExWTV9GTE9BVCBDdXJyZW50MlNob3J0OwpAQCAtMzksNyArMzUsNyBAQAogICAgIEN1cnJlbnQxU2hvcnQgPSAocEluc3RhbmNlLT5DdXJyZW50MSk7CiAgICAgQ3VycmVudDJTaG9ydCA9IChwSW5zdGFuY2UtPkN1cnJlbnQyKTsKIAotICAgIGZvciAoaWkgPSBuOyBpaSAhPSAwOyBpaS0tKXsKKyAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICBUZW1wMSA9ICpzcmMxKys7CiAgICAgICAgIFRlbXAzID0gVGVtcDEgKiBDdXJyZW50MVNob3J0OwogICAgICAgICBUZW1wMiA9ICpzcmMyKys7CkBAIC00NywxMSArNDMsMTEgQEAKICAgICAgICAgVGVtcDIgPSAoVGVtcDEgLyAyLjBmKSArIChUZW1wMyAvIDIuMGYpOwogICAgICAgICBpZiAoVGVtcDIgPiAwLjVmKQogICAgICAgICAgICAgVGVtcDIgPSAxLjBmOwotICAgICAgICBlbHNlIGlmIChUZW1wMiA8IC0wLjVmICkKKyAgICAgICAgZWxzZSBpZiAoVGVtcDIgPCAtMC41ZikKICAgICAgICAgICAgIFRlbXAyID0gLTEuMGY7CiAgICAgICAgIGVsc2UKICAgICAgICAgICAgIFRlbXAyID0gKFRlbXAyICogMik7Ci0gICAgICAgICAgICAqZHN0KysgPSBUZW1wMjsKKyAgICAgICAgKmRzdCsrID0gVGVtcDI7CiAgICAgfQogfQogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Db3JlX01peEluU29mdF9EMzJDMzFfU0FULmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0NvcmVfTWl4SW5Tb2Z0X0QzMkMzMV9TQVQuY3BwCmluZGV4IDhmNWMwYWUuLmI3ZjRiNTUgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0NvcmVfTWl4SW5Tb2Z0X0QzMkMzMV9TQVQuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0NvcmVfTWl4SW5Tb2Z0X0QzMkMzMV9TQVQuY3BwCkBAIC0xOCw3MiArMTgsNTQgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBJTkNMVURFIEZJTEVTCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQogI2luY2x1ZGUgIk1peGVyX3ByaXZhdGUuaCIKICNpbmNsdWRlICJMVk1fTWFjcm9zLmgiCisjaW5jbHVkZSAiU2NhbGFyQXJpdGhtZXRpYy5oIgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgRlVOQ1RJT04gQ09SRV9NSVhTT0ZUXzFTVF9EMzJDMzFfV1JBCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotdm9pZCBDb3JlX01peEluU29mdF9EMzJDMzFfU0FUKCAgICAgTWl4XzFTdF9DbGxfRkxPQVRfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICBuKQotewotICAgIExWTV9GTE9BVCAgICBUZW1wMSxUZW1wMixUZW1wMzsKLSAgICBMVk1fSU5UMTYgICAgIE91dExvb3A7Ci0gICAgTFZNX0lOVDE2ICAgICBJbkxvb3A7Ci0gICAgTFZNX0ZMT0FUICAgIFRhcmdldFRpbWVzT25lTWluQWxwaGE7Ci0gICAgTFZNX0ZMT0FUICAgIEN1cnJlbnRUaW1lc0FscGhhOwotICAgIExWTV9JTlQxNiAgICAgaWksamo7Cit2b2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ICBUZW1wMSA9ICpzcmMrKzsKICAgICAgICAgICAgIFRlbXAyID0gKmRzdDsKIAogICAgICAgICAgICAgVGVtcDMgPSBUZW1wMSAqIChwSW5zdGFuY2UtPkN1cnJlbnQpOwotICAgICAgICAgICAgVGVtcDEgPSBUZW1wMiArIFRlbXAzOworICAgICAgICAgICAgKmRzdCsrID0gTFZNX0NsYW1wKFRlbXAyICsgVGVtcDMpOworICAgICAgICB9CisgICAgfQogCi0gICAgICAgICAgICBpZiAoVGVtcDEgPiAxLjBmKQotICAgICAgICAgICAgICAgIFRlbXAxID0gMS4wZjsKLSAgICAgICAgICAgIGVsc2UgaWYgKFRlbXAxIDwgLTEuMGYpCi0gICAgICAgICAgICAgICAgVGVtcDEgPSAtMS4wZjsKLSAgICAgICAgICAgICpkc3QrKyA9IFRlbXAxOworICAgIGZvciAoaWkgPSBJbkxvb3A7IGlpICE9IDA7IGlpLS0pIHsKKyAgICAgICAgQ3VycmVudFRpbWVzQWxwaGEgPSBwSW5zdGFuY2UtPkN1cnJlbnQgKiBwSW5zdGFuY2UtPkFscGhhOworICAgICAgICBwSW5zdGFuY2UtPkN1cnJlbnQgPSBUYXJnZXRUaW1lc09uZU1pbkFscGhhICsgQ3VycmVudFRpbWVzQWxwaGE7CisKKyAgICAgICAgZm9yIChqaiA9IDQ7IGpqICE9IDA7IGpqLS0pIHsKKyAgICAgICAgICAgIFRlbXAxID0gKnNyYysrOworICAgICAgICAgICAgVGVtcDIgPSAqZHN0OworCisgICAgICAgICAgICBUZW1wMyA9IFRlbXAxICogKHBJbnN0YW5jZS0+Q3VycmVudCk7CisgICAgICAgICAgICAqZHN0KysgPSBMVk1fQ2xhbXAoVGVtcDIgKyBUZW1wMyk7CiAgICAgICAgIH0KICAgICB9CiB9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Db3JlX01peFNvZnRfMVN0X0QzMkMzMV9XUkEuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvQ29yZV9NaXhTb2Z0XzFTdF9EMzJDMzFfV1JBLmNwcAppbmRleCA2ZmY3ODUzLi42MWE0NzUyIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Db3JlX01peFNvZnRfMVN0X0QzMkMzMV9XUkEuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0NvcmVfTWl4U29mdF8xU3RfRDMyQzMxX1dSQS5jcHAKQEAgLTI1LDEyICsyNSw5IEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgRlVOQ1RJT04gQ09SRV9NSVhTT0ZUXzFTVF9EMzJDMzFfV1JBCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgQ29yZV9NaXhTb2Z0XzFTdF9EMzJDMzFfV1JBKCAgIE1peF8xU3RfQ2xsX0ZMT0FUX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgbikKLXsKLSAgICBMVk1fRkxPQVQgVGVtcDEsVGVtcDI7Cit2b2lkIENvcmVfTWl4U29mdF8xU3RfRDMyQzMxX1dSQShNaXhfMVN0X0NsbF9GTE9BVF90KiBwSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjLAorICAgICAgICAgICAgICAgICAgICAgICAgIC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YSk7CiAgICAgICAgIHBJbnN0YW5jZS0+Q3VycmVudCA9IFRhcmdldFRpbWVzT25lTWluQWxwaGEgKyBDdXJyZW50VGltZXNBbHBoYTsKIAotICAgICAgICBmb3IgKGlpID0gT3V0TG9vcDsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgeworICAgICAgICBmb3IgKGlpID0gT3V0TG9vcDsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICAgICAgVGVtcDEgPSAqc3JjOwogICAgICAgICAgICAgc3JjKys7CiAKQEAgLTYzLDM3ICs1OCwzNiBAQAogICAgICAgICB9CiAgICAgfQogCi0gICAgZm9yIChpaSA9IEluTG9vcDsgaWkgIT0gMDsgaWktLSkKLSAgICB7CisgICAgZm9yIChpaSA9IEluTG9vcDsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICBDdXJyZW50VGltZXNBbHBoYSA9IHBJbnN0YW5jZS0+Q3VycmVudCAqIHBJbnN0YW5jZS0+QWxwaGE7CiAgICAgICAgIHBJbnN0YW5jZS0+Q3VycmVudCA9IFRhcmdldFRpbWVzT25lTWluQWxwaGEgKyBDdXJyZW50VGltZXNBbHBoYTsKIAotICAgICAgICAgICAgVGVtcDEgPSAqc3JjOwotICAgICAgICAgICAgc3JjKys7CisgICAgICAgIFRlbXAxID0gKnNyYzsKKyAgICAgICAgc3JjKys7CiAKLSAgICAgICAgICAgIFRlbXAyID0gVGVtcDEgKiAocEluc3RhbmNlLT5DdXJyZW50KTsKLSAgICAgICAgICAgICpkc3QgPSBUZW1wMjsKLSAgICAgICAgICAgIGRzdCsrOworICAgICAgICBUZW1wMiA9IFRlbXAxICogKHBJbnN0YW5jZS0+Q3VycmVudCk7CisgICAgICAgICpkc3QgPSBUZW1wMjsKKyAgICAgICAgZHN0Kys7CiAKLSAgICAgICAgICAgIFRlbXAxID0gKnNyYzsKLSAgICAgICAgICAgIHNyYysrOworICAgICAgICBUZW1wMSA9ICpzcmM7CisgICAgICAgIHNyYysrOwogCi0gICAgICAgICAgICBUZW1wMiA9IFRlbXAxICogKHBJbnN0YW5jZS0+Q3VycmVudCk7Ci0gICAgICAgICAgICAqZHN0ID0gVGVtcDI7Ci0gICAgICAgICAgICBkc3QrKzsKKyAgICAgICAgVGVtcDIgPSBUZW1wMSAqIChwSW5zdGFuY2UtPkN1cnJlbnQpOworICAgICAgICAqZHN0ID0gVGVtcDI7CisgICAgICAgIGRzdCsrOwogCi0gICAgICAgICAgICBUZW1wMSA9ICpzcmM7Ci0gICAgICAgICAgICBzcmMrKzsKKyAgICAgICAgVGVtcDEgPSAqc3JjOworICAgICAgICBzcmMrKzsKIAotICAgICAgICAgICAgVGVtcDIgPSBUZW1wMSAqIChwSW5zdGFuY2UtPkN1cnJlbnQpOwotICAgICAgICAgICAgKmRzdCA9IFRlbXAyOwotICAgICAgICAgICAgZHN0Kys7CisgICAgICAgIFRlbXAyID0gVGVtcDEgKiAocEluc3RhbmNlLT5DdXJyZW50KTsKKyAgICAgICAgKmRzdCA9IFRlbXAyOworICAgICAgICBkc3QrKzsKIAotICAgICAgICAgICAgVGVtcDEgPSAqc3JjOwotICAgICAgICAgICAgc3JjKys7Ci0gICAgICAgICAgICBUZW1wMiA9IFRlbXAxICogKHBJbnN0YW5jZS0+Q3VycmVudCk7Ci0gICAgICAgICAgICAqZHN0ID0gVGVtcDI7Ci0gICAgICAgICAgICBkc3QrKzsKKyAgICAgICAgVGVtcDEgPSAqc3JjOworICAgICAgICBzcmMrKzsKKyAgICAgICAgVGVtcDIgPSBUZW1wMSAqIChwSW5zdGFuY2UtPkN1cnJlbnQpOworICAgICAgICAqZHN0ID0gVGVtcDI7CisgICAgICAgIGRzdCsrOwogICAgIH0KIH0KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvRENfMklfR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l9GTE9BVF9TdGF0ZSBwQmlxdWFkU3RhdGUgPSAoUEZpbHRlcl9GTE9BVF9TdGF0ZSkgcEluc3RhbmNlOwotCi0gICAgICAgIExlZnREQyA9IHBCaXF1YWRTdGF0ZS0+TGVmdERDOwotICAgICAgICBSaWdodERDID0gcEJpcXVhZFN0YXRlLT5SaWdodERDOwotICAgICAgICBmb3IoaiA9IE5yU2FtcGxlcy0xOyBqID49IDA7IGotLSkKLSAgICAgICAgewotICAgICAgICAgICAgLyogU3VidHJhY3QgREMgYW5kIHNhdHVyYXRlICovCi0gICAgICAgICAgICBEaWZmID0qIChwRGF0YUluKyspIC0gKExlZnREQyk7Ci0gICAgICAgICAgICBpZiAoRGlmZiA+IDEuMGYpIHsKLSAgICAgICAgICAgICAgICBEaWZmID0gMS4wZjsgfQotICAgICAgICAgICAgZWxzZSBpZiAoRGlmZiA8IC0xLjBmKSB7Ci0gICAgICAgICAgICAgICAgRGlmZiA9IC0xLjBmOyB9Ci0gICAgICAgICAgICAqKHBEYXRhT3V0KyspID0gKExWTV9GTE9BVClEaWZmOwotICAgICAgICAgICAgaWYgKERpZmYgPCAwKSB7Ci0gICAgICAgICAgICAgICAgTGVmdERDIC09IERDX0ZMT0FUX1NURVA7IH0KLSAgICAgICAgICAgIGVsc2UgewotICAgICAgICAgICAgICAgIExlZnREQyArPSBEQ19GTE9BVF9TVEVQOyB9Ci0KLSAgICAgICAgICAgIC8qIFN1YnRyYWN0IERDIGFuIHNhdHVyYXRlICovCi0gICAgICAgICAgICBEaWZmID0qIChwRGF0YUluKyspIC0gKFJpZ2h0REMpOwotICAgICAgICAgICAgaWYgKERpZmYgPiAxLjBmKSB7Ci0gICAgICAgICAgICAgICAgRGlmZiA9IDEuMGY7IH0KLSAgICAgICAgICAgIGVsc2UgaWYgKERpZmYgPCAtMS4wZikgewotICAgICAgICAgICAgICAgIERpZmYgPSAtMS4wZjsgfQotICAgICAgICAgICAgKihwRGF0YU91dCsrKSA9IChMVk1fRkxPQVQpRGlmZjsKLSAgICAgICAgICAgIGlmIChEaWZmIDwgMCkgewotICAgICAgICAgICAgICAgIFJpZ2h0REMgLT0gRENfRkxPQVRfU1RFUDsgfQotICAgICAgICAgICAgZWxzZSB7Ci0gICAgICAgICAgICAgICAgUmlnaHREQyArPSBEQ19GTE9BVF9TVEVQOyB9Ci0KLSAgICAgICAgfQotICAgICAgICBwQmlxdWFkU3RhdGUtPkxlZnREQyA9IExlZnREQzsKLSAgICAgICAgcEJpcXVhZFN0YXRlLT5SaWdodERDID0gUmlnaHREQzsKLQotICAgIH0KLSNpZmRlZiBTVVBQT1JUX01DCisjaW5jbHVkZSAiU2NhbGFyQXJpdGhtZXRpYy5oIgogLyoKICAqIEZVTkNUSU9OOiAgICAgICBEQ19NY19EMTZfVFJDX1dSQV8wMQogICoKQEAgLTc5LDM3ICszNSwyNSBAQAogICogIHZvaWQKICAqCiAgKi8KLXZvaWQgRENfTWNfRDE2X1RSQ19XUkFfMDEoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yQ2hhbm5lbHMpCi0gICAgewotICAgICAgICBMVk1fRkxPQVQgKkNoREM7Ci0gICAgICAgIExWTV9GTE9BVCBEaWZmOwotICAgICAgICBMVk1fSU5UMzIgajsKLSAgICAgICAgTFZNX0lOVDMyIGk7Ci0gICAgICAgIFBGaWx0ZXJfRkxPQVRfU3RhdGVfTWMgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfRkxPQVRfU3RhdGVfTWMpIHBJbnN0YW5jZTsKK3ZvaWQgRENfTWNfRDE2X1RSQ19XUkFfMDEoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QqIHBJbnN0YW5jZSwgTFZNX0ZMT0FUKiBwRGF0YUluLAorICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIHBEYXRhT3V0LCBMVk1fSU5UMTYgTnJGcmFtZXMsIExWTV9JTlQxNiBOckNoYW5uZWxzKSB7CisgICAgTFZNX0ZMT0FUKiBDaERDOworICAgIExWTV9GTE9BVCBEaWZmOworICAgIExWTV9JTlQzMiBqOworICAgIExWTV9JTlQzMiBpOworICAgIFBGaWx0ZXJfRkxPQVRfU3RhdGVfTWMgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfRkxPQVRfU3RhdGVfTWMpcEluc3RhbmNlOwogCi0gICAgICAgIENoREMgPSAmcEJpcXVhZFN0YXRlLT5DaERDWzBdOwotICAgICAgICBmb3IgKGogPSBOckZyYW1lcyAtIDE7IGogPj0gMDsgai0tKQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBTdWJ0cmFjdCBEQyBhbmQgc2F0dXJhdGUgKi8KLSAgICAgICAgICAgIGZvciAoaSA9IE5yQ2hhbm5lbHMgLSAxOyBpID49IDA7IGktLSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBEaWZmID0gKihwRGF0YUluKyspIC0gKENoRENbaV0pOwotICAgICAgICAgICAgICAgIGlmIChEaWZmID4gMS4wZikgewotICAgICAgICAgICAgICAgICAgICBEaWZmID0gMS4wZjsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKERpZmYgPCAtMS4wZikgewotICAgICAgICAgICAgICAgICAgICBEaWZmID0gLTEuMGY7IH0KLSAgICAgICAgICAgICAgICAqKHBEYXRhT3V0KyspID0gKExWTV9GTE9BVClEaWZmOwotICAgICAgICAgICAgICAgIGlmIChEaWZmIDwgMCkgewotICAgICAgICAgICAgICAgICAgICBDaERDW2ldIC09IERDX0ZMT0FUX1NURVA7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgQ2hEQ1tpXSArPSBEQ19GTE9BVF9TVEVQOyB9CisgICAgQ2hEQyA9ICZwQmlxdWFkU3RhdGUtPkNoRENbMF07CisgICAgZm9yIChqID0gTnJGcmFtZXMgLSAxOyBqID49IDA7IGotLSkgeworICAgICAgICAvKiBTdWJ0cmFjdCBEQyBhbmQgc2F0dXJhdGUgKi8KKyAgICAgICAgZm9yIChpID0gTnJDaGFubmVscyAtIDE7IGkgPj0gMDsgaS0tKSB7CisgICAgICAgICAgICBEaWZmID0gKihwRGF0YUluKyspIC0gKENoRENbaV0pOworICAgICAgICAgICAgKihwRGF0YU91dCsrKSA9IExWTV9DbGFtcChEaWZmKTsKKyAgICAgICAgICAgIGlmIChEaWZmIDwgMCkgeworICAgICAgICAgICAgICAgIENoRENbaV0gLT0gRENfRkxPQVRfU1RFUDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgQ2hEQ1tpXSArPSBEQ19GTE9BVF9TVEVQOwogICAgICAgICAgICAgfQotCiAgICAgICAgIH0KLQogICAgIH0KLSNlbmRpZgorfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvRENfMklfRDE2X1RSQ19XUkFfMDFfSW5pdC5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9EQ18ySV9EMTZfVFJDX1dSQV8wMV9Jbml0LmNwcAppbmRleCBiZWVlMTEyLi5jMTY3MThjIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9EQ18ySV9EMTZfVFJDX1dSQV8wMV9Jbml0LmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyY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WQuCi0gKiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCi0gKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KLSAqLwotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgSU5DTFVERSBGSUxFUwotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSNpbmNsdWRlICJMVk1fVHlwZXMuaCIKLSNpbmNsdWRlICJMVk1fTWFjcm9zLmgiCi0jaW5jbHVkZSAiVmVjdG9yQXJpdGhtZXRpYy5oIgotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gRGVsYXlBbGxQYXNzXzMyeDMyCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotdm9pZCBEZWxheUFsbFBhc3NfU2F0XzMyeDE2VG8zMiggIExWTV9JTlQzMiAgKmRlbGF5LCAgICAgICAgICAgICAgICAgICAgLyogRGVsYXkgYnVmZmVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiBzaXplLCAgICAgICAgICAgICAgICAgICAgICAvKiBEZWxheSBzaXplICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IGNvZWZmLCAgICAgICAgICAgICAgICAgICAgICAvKiBBbGwgcGFzcyBmaWx0ZXIgY29lZmZpY2llbnQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2IERlbGF5T2Zmc2V0LCAgICAgICAgICAgICAgIC8qIFNpbXBsZSBkZWxheSBvZmZzZXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2ICpwQWxsUGFzc09mZnNldCwgICAgICAgICAgIC8qIEFsbCBwYXNzIGZpbHRlciBkZWxheSBvZmZzZXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgICpkc3QsICAgICAgICAgICAgICAgICAgICAgIC8qIFNvdXJjZS9kZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKSAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTnVtYmVyIG9mICBzYW1wbGVzICovCi17Ci0gICAgTFZNX0lOVDE2ICAgaTsKLSAgICBMVk1fVUlOVDE2ICAgQWxsUGFzc09mZnNldCA9ICpwQWxsUGFzc09mZnNldDsKLSAgICBMVk1fSU5UMzIgICAgdGVtcDsKLSAgICBMVk1fSU5UMzIgICAgYSxiLGM7Ci0KLSAgICBmb3IgKGkgPSAwOyBpIDwgbjsgaSsrKQotICAgIHsKLQotICAgICAgICBNVUwzMngxNklOVE8zMihkZWxheVtBbGxQYXNzT2Zmc2V0XSwgY29lZmYsIHRlbXAsIDE1KQotICAgICAgICBhID0gdGVtcDsKLSAgICAgICAgYiA9IGRlbGF5W0RlbGF5T2Zmc2V0XTsKLSAgICAgICAgRGVsYXlPZmZzZXQrKzsKLQotICAgICAgICBjID0gYSArIGI7Ci0gICAgICAgIGlmICgoKChjIF4gYSkgJiAoYyBeIGIpKSA+PiAzMSkgIT0gMCkgIC8qIG92ZXJmbG93IC8gdW5kZXJmbG93ICovCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmKGEgPCAwKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGMgPSAweDgwMDAwMDAwTDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBjID0gMHg3RkZGRkZGRkw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgKmRzdCA9IGM7Ci0gICAgICAgIGRzdCsrOwotCi0gICAgICAgIE1VTDMyeDE2SU5UTzMyKGMsIC1jb2VmZiwgdGVtcCwgMTUpCi0gICAgICAgIGEgPSB0ZW1wOwotICAgICAgICBiID0gZGVsYXlbQWxsUGFzc09mZnNldF07Ci0gICAgICAgIGMgPSBhICsgYjsKLSAgICAgICAgaWYgKCgoKGMgXiBhKSAmIChjIF4gYikpID4+IDMxKSE9MCkgIC8qIG92ZXJmbG93IC8gdW5kZXJmbG93ICovCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmKGEgPCAwKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGMgPSAweDgwMDAwMDAwTDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBjID0gMHg3RkZGRkZGRkw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgZGVsYXlbQWxsUGFzc09mZnNldF0gPSBjOwotICAgICAgICBBbGxQYXNzT2Zmc2V0Kys7Ci0KLSAgICAgICAgLyogTWFrZSB0aGUgZGVsYXkgYnVmZmVyIGEgY2lyY3VsYXIgYnVmZmVyICovCi0gICAgICAgIGlmIChEZWxheU9mZnNldCA+PSBzaXplKQotICAgICAgICB7Ci0gICAgICAgICAgICBEZWxheU9mZnNldCA9IDA7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoQWxsUGFzc09mZnNldCA+PSBzaXplKQotICAgICAgICB7Ci0gICAgICAgICAgICBBbGxQYXNzT2Zmc2V0ID0gMDsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qIFVwZGF0ZSB0aGUgb2Zmc2V0ICovCi0gICAgKnBBbGxQYXNzT2Zmc2V0ID0gQWxsUGFzc09mZnNldDsKLQotICAgIHJldHVybjsKLX0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0RlbGF5TWl4XzE2eDE2LmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0RlbGF5TWl4XzE2eDE2LmNwcAppbmRleCA1MmQyNjNmLi5hMzQ2NjM2IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9EZWxheU1peF8xNngxNi5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvRGVsYXlNaXhfMTZ4MTYuY3BwCkBAIC0yMSw0NSArMjEsNTUgQEAKIAogI2luY2x1ZGUgIlZlY3RvckFyaXRobWV0aWMuaCIKIAotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIEZVTkNUSU9OIERlbGF5TWl4XzE2eDE2Ci0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotdm9pZCBEZWxheU1peF8xNngxNihjb25zdCBMVk1fSU5UMTYgKnNyYywgICAgICAgICAgIC8qIFNvdXJjZSAxLCB0byBiZSBkZWxheWVkICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAqZGVsYXksICAgICAgICAgLyogRGVsYXkgYnVmZmVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBzaXplLCAgICAgICAgICAgLyogRGVsYXkgc2l6ZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgKmRzdCwgICAgICAgICAgIC8qIFNvdXJjZS9kZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgKnBPZmZzZXQsICAgICAgIC8qIERlbGF5IG9mZnNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbikgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBzdGVyZW8gc2FtcGxlcyAqLwordm9pZCBEZWxheU1peF9GbG9hdChjb25zdCBMVk1fRkxPQVQqIHNyYywgLyogU291cmNlIDEsIHRvIGJlIGRlbGF5ZWQgKi8KKyAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiBkZWxheSwgICAgIC8qIERlbGF5IGJ1ZmZlciAqLworICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgc2l6ZSwgICAgICAgLyogRGVsYXkgc2l6ZSAqLworICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIGRzdCwgICAgICAgLyogU291cmNlL2Rlc3RpbmF0aW9uICovCisgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiogcE9mZnNldCwgICAvKiBEZWxheSBvZmZzZXQgKi8KKyAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IG4sICAgICAgICAgIC8qIE51bWJlciBvZiBzYW1wbGVzICovCisgICAgICAgICAgICAgICAgICAgIExWTV9JTlQzMiBOckNoYW5uZWxzKSAvKiBOdW1iZXIgb2YgY2hhbm5lbHMgKi8KIHsKLSAgICBMVk1fSU5UMTYgICBpOwotICAgIExWTV9JTlQxNiAgIE9mZnNldCAgPSAqcE9mZnNldDsKLSAgICBMVk1fSU5UMTYgICB0ZW1wOworICAgIExWTV9JTlQxNiBpOworICAgIExWTV9JTlQxNiBPZmZzZXQgPSAqcE9mZnNldDsKKyAgICBMVk1fRkxPQVQgdGVtcDsKIAotICAgIGZvciAoaSA9IDA7IGkgPCBuOyBpKyspCi0gICAgewotICAgICAgICAvKiBMZWZ0IGNoYW5uZWwgKi8KLSAgICAgICAgdGVtcCA9IChMVk1fSU5UMTYpKChMVk1fVUlOVDMyKSgoTFZNX0lOVDMyKSgqZHN0KSArIChMVk1fSU5UMzIpZGVsYXlbT2Zmc2V0XSkgPj4gMSk7Ci0gICAgICAgICpkc3QgPSB0ZW1wOwotICAgICAgICBkc3QrKzsKKyAgICBmb3IgKGkgPSAwOyBpIDwgbjsgaSsrKSB7CisgICAgICAgIGlmIChOckNoYW5uZWxzID09IEZDQ18xKSB7CisgICAgICAgICAgICB0ZW1wID0gKExWTV9GTE9BVCkoKmRzdCArIChMVk1fRkxPQVQpZGVsYXlbT2Zmc2V0XSkgLyAyLjBmOworICAgICAgICAgICAgKmRzdCA9IHRlbXA7CisgICAgICAgICAgICBkc3QrKzsKIAotICAgICAgICBkZWxheVtPZmZzZXRdID0gKnNyYzsKLSAgICAgICAgT2Zmc2V0Kys7Ci0gICAgICAgIHNyYysrOworICAgICAgICAgICAgZGVsYXlbT2Zmc2V0XSA9ICpzcmM7CisgICAgICAgICAgICBPZmZzZXQrKzsKKyAgICAgICAgICAgIHNyYysrOwogCi0gICAgICAgIC8qIFJpZ2h0IGNoYW5uZWwgKi8KLSAgICAgICAgdGVtcCA9IChMVk1fSU5UMTYpKChMVk1fVUlOVDMyKSgoTFZNX0lOVDMyKSgqZHN0KSAtIChMVk1fSU5UMzIpZGVsYXlbT2Zmc2V0XSkgPj4gMSk7Ci0gICAgICAgICpkc3QgPSB0ZW1wOwotICAgICAgICBkc3QrKzsKKyAgICAgICAgICAgIC8qIE1ha2UgdGhlIHJldmVyYiBkZWxheSBidWZmZXIgYSBjaXJjdWxhciBidWZmZXIgKi8KKyAgICAgICAgICAgIGlmIChPZmZzZXQgPj0gc2l6ZSkgeworICAgICAgICAgICAgICAgIE9mZnNldCA9IDA7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvKiBMZWZ0IGNoYW5uZWwgKi8KKyAgICAgICAgICAgIHRlbXAgPSAoTFZNX0ZMT0FUKSgqZHN0ICsgKExWTV9GTE9BVClkZWxheVtPZmZzZXRdKSAvIDIuMGY7CisgICAgICAgICAgICAqZHN0ID0gdGVtcDsKKyAgICAgICAgICAgIGRzdCsrOwogCi0gICAgICAgIGRlbGF5W09mZnNldF0gPSAqc3JjOwotICAgICAgICBPZmZzZXQrKzsKLSAgICAgICAgc3JjKys7CisgICAgICAgICAgICBkZWxheVtPZmZzZXRdID0gKnNyYzsKKyAgICAgICAgICAgIE9mZnNldCsrOworICAgICAgICAgICAgc3JjKys7CiAKLSAgICAgICAgLyogTWFrZSB0aGUgcmV2ZXJiIGRlbGF5IGJ1ZmZlciBhIGNpcmN1bGFyIGJ1ZmZlciAqLwotICAgICAgICBpZiAoT2Zmc2V0ID49IHNpemUpCi0gICAgICAgIHsKLSAgICAgICAgICAgIE9mZnNldCA9IDA7CisgICAgICAgICAgICAvKiBSaWdodCBjaGFubmVsICovCisgICAgICAgICAgICB0ZW1wID0gKExWTV9GTE9BVCkoKmRzdCAtIChMVk1fRkxPQVQpZGVsYXlbT2Zmc2V0XSkgLyAyLjBmOworICAgICAgICAgICAgKmRzdCA9IHRlbXA7CisgICAgICAgICAgICBkc3QrKzsKKworICAgICAgICAgICAgZGVsYXlbT2Zmc2V0XSA9ICpzcmM7CisgICAgICAgICAgICBPZmZzZXQrKzsKKyAgICAgICAgICAgIHNyYysrOworCisgICAgICAgICAgICAvKiBNYWtlIHRoZSByZXZlcmIgZGVsYXkgYnVmZmVyIGEgY2lyY3VsYXIgYnVmZmVyICovCisgICAgICAgICAgICBpZiAoT2Zmc2V0ID49IHNpemUpIHsKKyAgICAgICAgICAgICAgICBPZmZzZXQgPSAwOworICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQogCkBAIC02OCw0NyArNzgsMyBAQAogCiAgICAgcmV0dXJuOwogfQotdm9pZCBEZWxheU1peF9GbG9hdChjb25zdCBMVk1fRkxPQVQgKnNyYywgICAgICAgICAgIC8qIFNvdXJjZSAxLCB0byBiZSBkZWxheWVkICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAqZGVsYXksICAgICAgICAgLyogRGVsYXkgYnVmZmVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBzaXplLCAgICAgICAgICAgLyogRGVsYXkgc2l6ZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwgICAgICAgICAgIC8qIFNvdXJjZS9kZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgKnBPZmZzZXQsICAgICAgIC8qIERlbGF5IG9mZnNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbikgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBzdGVyZW8gc2FtcGxlcyAqLwotewotICAgIExWTV9JTlQxNiAgIGk7Ci0gICAgTFZNX0lOVDE2ICAgT2Zmc2V0ICA9ICpwT2Zmc2V0OwotICAgIExWTV9GTE9BVCAgIHRlbXA7Ci0KLSAgICBmb3IgKGk9MDsgaTxuOyBpKyspCi0gICAgewotICAgICAgICAvKiBMZWZ0IGNoYW5uZWwgKi8KLSAgICAgICAgdGVtcCAgICAgICAgICAgID0gKExWTV9GTE9BVCkoKExWTV9GTE9BVCkoKmRzdCArIChMVk1fRkxPQVQpZGVsYXlbT2Zmc2V0XSkgLyAyLjBmKTsKLSAgICAgICAgKmRzdCAgICAgICAgICAgID0gdGVtcDsKLSAgICAgICAgZHN0Kys7Ci0KLSAgICAgICAgZGVsYXlbT2Zmc2V0XSA9ICpzcmM7Ci0gICAgICAgIE9mZnNldCsrOwotICAgICAgICBzcmMrKzsKLQotICAgICAgICAvKiBSaWdodCBjaGFubmVsICovCi0gICAgICAgIHRlbXAgICAgICAgICA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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gRGVsYXlNaXhfMTZ4MTYKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIERlbGF5V3JpdGVfMzIoY29uc3QgTFZNX0lOVDMyICAqc3JjLCAgICAgICAgICAgICAgIC8qIFNvdXJjZSAxLCB0byBiZSBkZWxheWVkICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDMyICAqZGVsYXksICAgICAgICAgICAgIC8qIERlbGF5IGJ1ZmZlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgc2l6ZSwgICAgICAgICAgICAgICAvKiBEZWxheSBzaXplICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiAqcE9mZnNldCwgICAgICAgICAgIC8qIERlbGF5IG9mZnNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgbikgICAgICAgICAgICAgICAgICAvKiBOdW1iZXIgb2Ygc2FtcGxlcyAqLwotewotICAgIExWTV9JTlQxNiAgIGk7Ci0gICAgTFZNX0lOVDE2ICAgT2Zmc2V0ICA9IChMVk1fSU5UMTYpKnBPZmZzZXQ7Ci0KLSAgICBmb3IgKGk9MDsgaTxuOyBpKyspCi0gICAgewotICAgICAgICBkZWxheVtPZmZzZXRdID0gKnNyYzsKLSAgICAgICAgT2Zmc2V0Kys7Ci0gICAgICAgIHNyYysrOwotCi0gICAgICAgIC8qIE1ha2UgdGhlIGRlbGF5IGJ1ZmZlciBhIGNpcmN1bGFyIGJ1ZmZlciAqLwotICAgICAgICBpZiAoT2Zmc2V0ID49IHNpemUpCi0gICAgICAgIHsKLSAgICAgICAgICAgIE9mZnNldCA9IDA7Ci0gICAgICAgIH0KLSAgICB9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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLXZvaWQgRk9fMUlfRDE2RjE2QzE1X1RSQ19XUkFfMDEoIEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE5yU2FtcGxlcykKLSAgICB7Ci0gICAgICAgIExWTV9GTE9BVCAgeW5MOwotICAgICAgICBMVk1fSU5UMTYgaWk7Ci0gICAgICAgIFBGaWx0ZXJfU3RhdGVfRkxPQVQgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfU3RhdGVfRkxPQVQpIHBJbnN0YW5jZTsKLQotICAgICAgICAgZm9yIChpaSA9IE5yU2FtcGxlczsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgIHsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPQ0VTU0lORyBPRiBUSEUgTEVGVCBDSEFOTkVMCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvLyB5bkw9QTEgICogeChuLTEpTAotICAgICAgICAgICAgeW5MID0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzBdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdOwotCi0gICAgICAgICAgICAvLyB5bkwrPUEwICAqIHgobilMCi0gICAgICAgICAgICB5bkwgKz0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzFdICogKCpwRGF0YUluKTsKLQotICAgICAgICAgICAgLy8geW5MKz0gICgtQjEgICogeShuLTEpTAotICAgICAgICAgICAgeW5MICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1syXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXTsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgVVBEQVRJTkcgVEhFIERFTEFZUwotICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdID0geW5MOyAvLyBVcGRhdGUgeShuLTEpTAotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdID0gKCpwRGF0YUluKyspOyAvLyBVcGRhdGUgeChuLTEpTAotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBXUklUSU5HIFRIRSBPVVRQVVQKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgICpwRGF0YU91dCsrID0gKExWTV9GTE9BVCl5bkw7IC8vIFdyaXRlIExlZnQgb3V0cHV0Ci0KLSAgICAgICAgfQotCi0gICAgfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9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RVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4KLSAqIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQKLSAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLgotICovCi0KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi0jaW5jbHVkZSAiQklRVUFELmgiCi0jaW5jbHVkZSAiRk9fMUlfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfUHJpdmF0ZS5oIgotCi0vKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgRk9fMUlfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgVGhlc2UgZnVuY3Rpb25zIGluaXRpYWxpemVzIGEgQklRVUFEIGZpbHRlciBkZWZpbmVkIGFzIGEgY2FzY2FkZSBvZiAgICovCi0vKiAgIGJpcXVhZHJhdGljIEZpbHRlciBTZWN0aW9ucy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBJbnN0YW5jZSAgICAtIG91dHB1dCwgcmV0dXJucyB0aGUgcG9pbnRlciB0byB0aGUgU3RhdGUgVmFyaWFibGUgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgVGhpcyBzdGF0ZSBwb2ludGVyIG11c3QgYmUgcGFzc2VkIHRvIGFueSBzdWJzZXF1ZW50ICAgKi8KLS8qICAgICAgICAgICAgICAgICAgIGNhbGwgdG8gIkJpcXVhZCIgZnVuY3Rpb25zLiAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBUYXBzICAgICAgICAgLSBpbnB1dCwgcG9pbnRlciB0byB0aGUgdGFwcyBtZW1vcnkgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBwQ29lZiAgICAgICAgIC0gaW5wdXQsIHBvaW50ZXIgdG8gdGhlIGNvZWZmaWNpZW50IHN0cnVjdHVyZSAgICAgICAgICAgKi8KLS8qICAgTiAgICAgICAgICAgICAtIE0gY29lZmZpY2llbnQgZmFjdG9yIG9mIFFNLk4gICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICB2b2lkIHJldHVybiBjb2RlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi12b2lk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TAgZm9ybWF0Ci0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdIGlzIHkobi0xKUwgaW4gUTAgZm9ybWF0Ci0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIEZPXzFJX0QzMkYzMkMzMV9UUkNfV1JBXzAxKCBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOclNhbXBsZXMpCi0gICAgewotICAgICAgICBMVk1fRkxPQVQgIHluTCx0ZW1wbDsKLSAgICAgICAgTFZNX0lOVDE2ICBpaTsKLSAgICAgICAgUEZpbHRlcl9TdGF0ZV9GTE9BVCBwQmlxdWFkU3RhdGUgPSAoUEZpbHRlcl9TdGF0ZV9GTE9BVCkgcEluc3RhbmNlOwotCi0gICAgICAgIGZvciAoaWkgPSBOclNhbXBsZXM7IGlpICE9IDA7IGlpLS0pCi0gICAgICAgIHsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPQ0VTU0lORyBPRiBUSEUgTEVGVCBDSEFOTkVMCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvLyB5bkw9QTEgICogeChuLTEpTAotICAgICAgICAgICAgeW5MID0gcEJpcXVhZFN0YXRlLT5jb2Vmc1swXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1swXTsKLQotICAgICAgICAgICAgLy8geW5MKz1BMCAgKiB4KG4pTAotICAgICAgICAgICAgdGVtcGwgPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzFdICogKCpwRGF0YUluKTsKLSAgICAgICAgICAgIHluTCArPSB0ZW1wbDsKLQotICAgICAgICAgICAgLy8geW5MKz0gICgtQjEgICogeShuLTEpTAotICAgICAgICAgICAgdGVtcGwgPSBwQmlxdWFkU3RhdGUtPmNvZWZzWzJdICogcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdOwotICAgICAgICAgICAgeW5MICs9IHRlbXBsOwotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBVUERBVElORyBUSEUgREVMQVlTCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMV0gPSB5bkw7IC8vIFVwZGF0ZSB5KG4tMSlMCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF0gPSAoKnBEYXRhSW4rKyk7IC8vIFVwZGF0ZSB4KG4tMSlMCi0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdSSVRJTkcgVEhFIE9VVFBVVAotICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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BhZ3JlZWQgdG8gaW4gd3JpdGluZywgc29mdHdhcmUKLSAqIGRpc3RyaWJ1dGVkIHVuZGVyIHRoZSBMaWNlbnNlIGlzIGRpc3RyaWJ1dGVkIG9uIGFuICJBUyBJUyIgQkFTSVMsCi0gKiBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4KLSAqIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQKLSAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLgotICovCi0KLSNpbmNsdWRlICJCSVFVQUQuaCIKLSNpbmNsdWRlICJGT18xSV9EMzJGMzJDbGxfVFJDX1dSQV8wMV9Qcml2YXRlLmgiCi0KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi0vKiBGVU5DVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBGT18xSV9EMzJGMzJDbGxfVFJDX1dSQV8wMV9Jbml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBUaGVzZSBmdW5jdGlvbnMgaW5pdGlhbGl6ZXMgYSBCSVFVQUQgZmlsdGVyIGRlZmluZWQgYXMgYSBjYXNjYWRlIG9mICAgKi8KLS8qICAgYmlxdWFkcmF0aWMgRmlsdGVyIFNlY3Rpb25zLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcEluc3RhbmNlICAgIC0gb3V0cHV0LCByZXR1cm5zIHRoZSBwb2ludGVyIHRvIHRoZSBTdGF0ZSBWYXJpYWJsZSAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICBUaGlzIHN0YXRlIHBvaW50ZXIgbXVzdCBiZSBwYXNzZWQgdG8gYW55IHN1YnNlcXVlbnQgICAqLwotLyogICAgICAgICAgICAgICAgICAgY2FsbCB0byAiQmlxdWFkIiBmdW5jdGlvbnMuICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgcFRhcHMgICAgICAgICAtIGlucHV0LCBwb2ludGVyIHRvIHRoZSB0YXBzIG1lbW9yeSAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBDb2VmICAgICAgICAgLSBpbnB1dCwgcG9pbnRlciB0byB0aGUgY29lZmZpY2llbnQgc3RydWN0dXJlICAgICAgICAgICAqLwotLyogICBOICAgICAgICAgICAgIC0gTSBjb2VmZmljaWVudCBmYWN0b3Igb2YgUU0uTiAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHZvaWQgcmV0dXJuIGNvZGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0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+cERlbGF5c1sxXSBpcyB5KG4tMSlMIGluIFEzMCBmb3JtYXQKLXBCaXF1YWRTdGF0ZS0+cERlbGF5c1syXSBpcyB4KG4tMSlSIGluIFExNSBmb3JtYXQKLXBCaXF1YWRTdGF0ZS0+cERlbGF5c1szXSBpcyB5KG4tMSlSIGluIFEzMCBmb3JtYXQKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgRk9fMklfRDE2RjMyQzE1X0xTaHhfVFJDX1dSQV8wMShCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOclNhbXBsZXMpCi0gICAgewotICAgICAgICBMVk1fRkxPQVQgICB5bkwseW5SOwotICAgICAgICBMVk1fRkxPQVQgICBUZW1wOwotICAgICAgICBMVk1fRkxPQVQgICBOZWdTYXRWYWx1ZTsKLSAgICAgICAgTFZNX0lOVDE2ICAgaWk7Ci0KLSAgICAgICAgUEZpbHRlcl9GbG9hdF9TdGF0ZSBwQmlxdWFkU3RhdGUgPSAoUEZpbHRlcl9GbG9hdF9TdGF0ZSkgcEluc3RhbmNlOwotCi0gICAgICAgIE5lZ1NhdFZhbHVlID0gLTEuMGY7Ci0KLSAgICAgICAgZm9yIChpaSA9IE5yU2FtcGxlczsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgewotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9DRVNTSU5HIE9GIFRIRSBMRUZUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotICAgICAgICAgICAgLy8geW5MID1BMSAgKiB4KG4tMSlMCi0gICAgICAgICAgICB5bkwgPSAoTFZNX0ZMT0FUKXBCaXF1YWRTdGF0ZS0+Y29lZnNbMF0gKiBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF07Ci0gICAgICAgICAgICAvLyB5blIgPUExICAqIHgobi0xKVIKLSAgICAgICAgICAgIHluUiA9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1swXSAqIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1syXTsKLQotICAgICAgICAgICAgLy8geW5MKz1BMCAgKiB4KG4pTAotICAgICAgICAgICAgeW5MICs9IChMVk1fRkxPQVQpcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXSAqICgqcERhdGFJbik7Ci0gICAgICAgICAgICAvLyB5blIrPUEwICAqIHgobilMCi0gICAgICAgICAgICB5blIgKz0gKExWTV9GTE9BVClwQmlxdWFkU3RhdGUtPmNvZWZzWzFdICogKCoocERhdGFJbisxKSk7Ci0KLSAgICAgICAgICAgIC8vIHluTCArPSAgKC1CMSAgKiB5KG4tMSlMICApCi0gICAgICAgICAgICBUZW1wID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdICogcEJpcXVhZFN0YXRlLT5jb2Vmc1syXTsKLSAgICAgICAgICAgIHluTCArPSBUZW1wOwotICAgICAgICAgICAgLy8geW5SICs9ICAoLUIxICAqIHkobi0xKVIgKSApCi0gICAgICAgICAgICBUZW1wID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzNdICogcEJpcXVhZFN0YXRlLT5jb2Vmc1syXTsKLSAgICAgICAgICAgIHluUiArPSBUZW1wOwotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBVUERBVElORyBUSEUgREVMQVlTCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMV0gPSB5bkw7IC8vIFVwZGF0ZSB5KG4tMSlMCi0gICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMF0gPSAoKnBEYXRhSW4rKyk7IC8vIFVwZGF0ZSB4KG4tMSlMCi0KLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1szXSA9IHluUjsgLy8gVXBkYXRlIHkobi0xKVIKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1syXSA9ICgqcERhdGFJbisrKTsgLy8gVXBkYXRlIHgobi0xKVIKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgV1JJVElORyBUSEUgT1VUUFVUCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSAgICAgICAgICAgIC8qU2F0dXJhdGUgcmVzdWx0cyovCi0gICAgICAgICAgICBpZih5bkwgPiAxLjBmKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHluTCA9IDEuMGY7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgaWYoeW5MIDwgTmVnU2F0VmFsdWUpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICB5bkwgPSBOZWdTYXRWYWx1ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmKHluUiA+IDEuMGYpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgeW5SID0gMS4wZjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZih5blIgPCBOZWdTYXRWYWx1ZSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHluUiA9IE5lZ1NhdFZhbHVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgKnBEYXRhT3V0KysgPSAoTFZNX0ZMT0FUKXluTDsKLSAgICAgICAgICAgICpwRGF0YU91dCsrID0gKExWTV9GTE9BVCl5blI7Ci0gICAgICAgIH0KLQotICAgIH0KLSNpZmRlZiBTVVBQT1JUX01DCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLUFTU1VNUFRJT05TOgotQ09FRlMtCi1wQmlxdWFkU3RhdGUtPmNvZWZzWzBdIGlzIEExLAotcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXSBpcyBBMCwKLXBCaXF1YWRTdGF0ZS0+Y29lZnNbMl0gaXMgLUIxLAotREVMQVlTLQotcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzIqY2ggKyAwXSBpcyB4KG4tMSkgb2YgdGhlICdjaCcgLSBjaGFubmVsCi1wQmlxdWFkU3RhdGUtPnBEZWxheXNbMipjaCArIDFdIGlzIHkobi0xKSBvZiB0aGUgJ2NoJyAtIGNoYW5uZWwKLVRoZSBpbmRleCAnY2gnIHJ1bnMgZnJvbSAwIHRvIChOckNoYW5uZWxzIC0gMSkKLQotUEFSQU1FVEVSUzoKLSBwSW5zdGFuY2UgICAgICAgIFBvaW50ZXIgSW5zdGFuY2UKLSBwRGF0YUluICAgICAgICAgIElucHV0L1NvdXJjZQotIHBEYXRhT3V0ICAgICAgICAgT3V0cHV0L0Rlc3RpbmF0aW9uCi0gTnJGcmFtZXMgICAgICAgICBOdW1iZXIgb2YgZnJhbWVzCi0gTnJDaGFubmVscyAgICAgICBOdW1iZXIgb2YgY2hhbm5lbHMKLQotUkVUVVJOUzoKLSB2b2lkCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIEZPX01jX0QxNkYzMkMxNV9MU2h4X1RSQ19XUkFfMDEoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgTnJDaGFubmVscykKLSAgICB7Ci0gICAgICAgIExWTV9GTE9BVCAgIHluOwotICAgICAgICBMVk1fRkxPQVQgICBUZW1wOwotICAgICAgICBMVk1fSU5UMTYgICBpaTsKLSAgICAgICAgTFZNX0lOVDE2ICAgY2g7Ci0gICAgICAgIFBGaWx0ZXJfRmxvYXRfU3RhdGUgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfRmxvYXRfU3RhdGUpIHBJbnN0YW5jZTsKLQotICAgICAgICBMVk1fRkxPQVQgICAqcERlbGF5cyA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5czsKLSAgICAgICAgTFZNX0ZMT0FUICAgKnBDb2VmcyAgPSAmcEJpcXVhZFN0YXRlLT5jb2Vmc1swXTsKLSAgICAgICAgTFZNX0ZMT0FUICAgQTAgPSBwQ29lZnNbMV07Ci0gICAgICAgIExWTV9GTE9BVCAgIEExID0gcENvZWZzWzBdOwotICAgICAgICBMVk1fRkxPQVQgICBCMSA9IHBDb2Vmc1syXTsKLQotICAgICAgICBmb3IgKGlpID0gTnJGcmFtZXM7IGlpICE9IDA7IGlpLS0pCi0gICAgICAgIHsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPQ0VTU0lORyBPRiBUSEUgQ0hBTk5FTFMKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIGZvciAoY2ggPSAwOyBjaCA8IE5yQ2hhbm5lbHM7IGNoKyspCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLy8geW4gPUExICAqIHgobi0xKQotICAgICAgICAgICAgICAgIHluID0gKExWTV9GTE9BVClBMSAqIHBEZWxheXNbMF07Ci0KLSAgICAgICAgICAgICAgICAvLyB5bis9QTAgICogeChuKQotICAgICAgICAgICAgICAgIHluICs9IChMVk1fRkxPQVQpQTAgKiAoKnBEYXRhSW4pOwotCi0gICAgICAgICAgICAgICAgLy8geW4gKz0gICgtQjEgICogeShuLTEpKQotICAgICAgICAgICAgICAgIFRlbXAgPSBCMSAqIHBEZWxheXNbMV07Ci0gICAgICAgICAgICAgICAgeW4gKz0gVGVtcDsKLQotICAgICAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVUERBVElORyBUSEUgREVMQVlTCi0gICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgICAgIHBEZWxheXNbMV0gPSB5bjsgLy8gVXBkYXRlIHkobi0xKQotICAgICAgICAgICAgICAgIHBEZWxheXNbMF0gPSAoKnBEYXRhSW4rKyk7IC8vIFVwZGF0ZSB4KG4tMSkKLQotICAgICAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXUklUSU5HIFRIRSBPVVRQVVQKLSAgICAgICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSAgICAgICAgICAgICAgICAvKlNhdHVyYXRlIHJlc3VsdHMqLwotICAgICAgICAgICAgICAgIGlmICh5biA+IDEuMGYpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICB5biA9IDEuMGY7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmICh5biA8IC0xLjBmKSB7Ci0gICAgICAgICAgICAgICAgICAgIHluID0gLTEuMGY7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgKnBEYXRhT3V0KysgPSAoTFZNX0ZMT0FUKXluOwotICAgICAgICAgICAgICAgIHBEZWxheXMgKz0gMjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHBEZWxheXMgLT0gTnJDaGFubmVscyAqIDI7Ci0gICAgICAgIH0KLSAg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lZCBvbiBhbiAiQVMgSVMiIEJBU0lTLAotICogV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuCi0gKiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCi0gKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KLSAqLwotCi0vKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotI2luY2x1ZGUgIkJJUVVBRC5oIgotI2luY2x1ZGUgIkZPXzJJX0QxNkYzMkNzc19MU2h4X1RSQ19XUkFfMDFfUHJpdmF0ZS5oIgotCi0vKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgRk9fMklfRDE2RjMyQ3NzX0xTaHhfVFJDX1dSQV8wMV9Jbml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgVGhlc2UgZnVuY3Rpb25zIGluaXRpYWxpemVzIGEgQklRVUFEIGZpbHRlciBkZWZpbmVkIGFzIGEgY2FzY2FkZSBvZiAgICovCi0vKiAgIGJpcXVhZHJhdGljIEZpbHRlciBTZWN0aW9ucy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBJbnN0YW5jZSAgICAtIG91dHB1dCwgcmV0dXJucyB0aGUgcG9pbnRlciB0byB0aGUgU3RhdGUgVmFyaWFibGUgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgVGhpcyBzdGF0ZSBwb2ludGVyIG11c3QgYmUgcGFzc2VkIHRvIGFueSBzdWJzZXF1ZW50ICAgKi8KLS8qICAgICAgICAgICAgICAgICAgIGNhbGwgdG8gIkJpcXVhZCIgZnVuY3Rpb25zLiAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgIHBUYXBzICAgICAgICAgLSBpbnB1dCwgcG9pbnRlciB0byB0aGUgdGFwcyBtZW1vcnkgICAgICAgICAgICAgICAgICAgICAqLwotLyogICBwQ29lZiAgICAgICAgIC0gaW5wdXQsIHBvaW50ZXIgdG8gdGhlIGNvZWZmaWNpZW50IHN0cnVjdHVyZSAgICAgICAgICAgKi8KLS8qICAgTiAgICAgICAgICAgICAtIE0gY29lZmZpY2llbnQgZmFjdG9yIG9mIFFNLk4gICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICB2b2lkIHJldHVybiBjb2RlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0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qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIEZyb20yaVRvTVNfMTZ4MTYoIGNvbnN0IExWTV9JTlQxNiAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAqZHN0TSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAqZHN0UywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICBuICkKLXsKLSAgICBMVk1fSU5UMzIgdGVtcDEsbGVmdCxyaWdodDsKK3ZvaWQgRnJvbTJpVG9NU19GbG9hdChjb25zdCBMVk1fRkxPQVQqIHNyYywgTFZNX0ZMT0FUKiBkc3RNLCBMVk1fRkxPQVQqIGRzdFMsIExWTV9JTlQxNiBuKSB7CisgICAgTFZNX0ZMT0FUIHRlbXAxLCBsZWZ0LCByaWdodDsKICAgICBMVk1fSU5UMTYgaWk7Ci0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICBsZWZ0ID0gKExWTV9JTlQzMikqc3JjOwotICAgICAgICBzcmMrKzsKLQotICAgICAgICByaWdodCA9IChMVk1fSU5UMzIpKnNyYzsKLSAgICAgICAgc3JjKys7Ci0KLSAgICAgICAgLyogQ29tcHV0ZSBNIHNpZ25hbCovCi0gICAgICAgIHRlbXAxID0gIChsZWZ0K3JpZ2h0KT4+MTsKLSAgICAgICAgKmRzdE0gPSAoTFZNX0lOVDE2KXRlbXAxOwotICAgICAgICBkc3RNKys7Ci0KLSAgICAgICAgLyogQ29tcHV0ZSBTIHNpZ25hbCovCi0gICAgICAgIHRlbXAxID0gIChsZWZ0LXJpZ2h0KT4+MTsKLSAgICAgICAgKmRzdFMgPSAoTFZNX0lOVDE2KXRlbXAxOwotICAgICAgICBkc3RTKys7Ci0gICAgfQotCi0gICAgcmV0dXJuOwotfQotdm9pZCBGcm9tMmlUb01TX0Zsb2F0KCBjb25zdCBMVk1fRkxPQVQgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgKmRzdE0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgKmRzdFMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgbiApCi17Ci0gICAgTFZNX0ZMT0FUIHRlbXAxLGxlZnQscmlnaHQ7Ci0gICAgTFZNX0lOVDE2IGlpOwotICAgIGZvciAoaWkgPSBuOyBpaSAhPSAwOyBpaS0tKQotICAgIHsKKyAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICBsZWZ0ID0gKExWTV9GTE9BVCkqc3JjOwogICAgICAgICBzcmMrKzsKIApAQCAtNjksMTYgKzMyLDE1IEBACiAgICAgICAgIHNyYysrOwogCiAgICAgICAgIC8qIENvbXB1dGUgTSBzaWduYWwqLwotICAgICAgICB0ZW1wMSA9ICAobGVmdCArIHJpZ2h0KSAvIDIuMGY7CisgICAgICAgIHRlbXAxID0gKGxlZnQgKyByaWdodCkgLyAyLjBmOwogICAgICAgICAqZHN0TSA9IChMVk1fRkxPQVQpdGVtcDE7CiAgICAgICAgIGRzdE0rKzsKIAogICAgICAgICAvKiBDb21wdXRlIFMgc2lnbmFsKi8KLSAgICAgICAgdGVtcDEgPSAgKGxlZnQgLSByaWdodCkgLyAyLjBmOworICAgICAgICB0ZW1wMSA9IChsZWZ0IC0gcmlnaHQpIC8gMi4wZjsKICAgICAgICAgKmRzdFMgPSAoTFZNX0ZMT0FUKXRlbXAxOwogICAgICAgICBkc3RTKys7CiAgICAgfQogCiAgICAgcmV0dXJuOwogfQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9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B0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAotICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCi0gKi8KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIElOQ0xVREUgRklMRVMKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0jaW5jbHVkZSAiVmVjdG9yQXJpdGhtZXRpYy5oIgotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gRnJvbTJpVG9Nb25vXzE2Ci0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotdm9pZCBGcm9tMmlUb01vbm9fMTYoIGNvbnN0IExWTV9JTlQxNiAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKQotewotICAgIExWTV9JTlQxNiBpaTsKLSAgICBMVk1fSU5UMzIgVGVtcDsKLSAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkKLSAgICB7Ci0gICAgICAgIFRlbXAgPSAoTFZNX0lOVDMyKSpzcmM7Ci0gICAgICAgIHNyYysrOwotCi0gICAgICAgIFRlbXAgKz0gKExWTV9JTlQzMikqc3JjOwotICAgICAgICBzcmMrKzsKLQotICAgICAgICAqZHN0ICA9IChMVk1fSU5UMTYpKFRlbXAgPj4xKTsKLSAgICAgICAgZHN0Kys7Ci0gICAgfQotCi0gICAgcmV0dXJuOwotfQotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0Zyb20yaVRvTW9ub18zMi5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Gcm9tMmlUb01vbm9fMzIuY3BwCmluZGV4IGE4Njg4YjQuLjAzOWVlMTQgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0Zyb20yaVRvTW9ub18zMi5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvRnJvbTJpVG9Nb25vXzMyLmNwcApAQCAtMjEsNDAgKzIxLDExIEBACiAKICNpbmNsdWRlICJWZWN0b3JBcml0aG1ldGljLmgiCiAKLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICBGVU5DVElPTiBGcm9tMmlUb01vbm9fMzIKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIEZyb20yaVRvTW9ub18zMiggY29uc3QgTFZNX0lOVDMyICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDMyICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IG4pCi17Ci0gICAgTFZNX0lOVDE2IGlpOwotICAgIExWTV9JTlQzMiBUZW1wOwotCi0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICBUZW1wID0gKCpzcmM+PjEpOwotICAgICAgICBzcmMrKzsKLQotICAgICAgICBUZW1wICs9KCpzcmM+PjEpOwotICAgICAgICBzcmMrKzsKLQotICAgICAgICAqZHN0ID0gVGVtcDsKLSAgICAgICAgZHN0Kys7Ci0gICAgfQotCi0gICAgcmV0dXJuOwotfQotdm9pZCBGcm9tMmlUb01vbm9fRmxvYXQoIGNvbnN0IExWTV9GTE9BVCAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKQotewordm9pZCBGcm9tMmlUb01vbm9fRmxvYXQoY29uc3QgTFZNX0ZMT0FUKiBzcmMsIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgbikgewogICAgIExWTV9JTlQxNiBpaTsKICAgICBMVk1fRkxPQVQgVGVtcDsKIAotICAgIGZvciAoaWkgPSBuOyBpaSAhPSAwOyBpaS0tKQotICAgIHsKKyAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICBUZW1wID0gKCpzcmMpOwogICAgICAgICBzcmMrKzsKIApAQCAtNjcsNyArMzgsNiBAQAogCiAgICAgcmV0dXJuOwogfQotI2lmZGVmIFNVUFBPUlRfTUMKIC8qCiAgKiBGVU5DVElPTjogICAgICAgRnJvbU1jVG9Nb25vX0Zsb2F0CiAgKgpAQCAtODUsMTkgKzU1LDE0IEBACiAgKiAgdm9pZAogICoKICAqLwotdm9pZCBGcm9tTWNUb01vbm9fRmxvYXQoY29uc3QgTFZNX0ZMT0FUICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBOckNoYW5uZWxzKQotewordm9pZCBGcm9tTWNUb01vbm9fRmxvYXQoY29uc3QgTFZNX0ZMT0FUKiBzcmMsIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgTnJGcmFtZXMsCisgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgTnJDaGFubmVscykgewogICAgIExWTV9JTlQxNiBpaSwgamo7CiAgICAgTFZNX0ZMT0FUIFRlbXA7CiAKLSAgICBmb3IgKGlpID0gTnJGcmFtZXM7IGlpICE9IDA7IGlpLS0pCi0gICAgeworICAgIGZvciAoaWkgPSBOckZyYW1lczsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICBUZW1wID0gMC4wZjsKLSAgICAgICAgZm9yIChqaiA9IE5yQ2hhbm5lbHM7IGpqICE9MDsgamotLSkKLSAgICAgICAgeworICAgICAgICBmb3IgKGpqID0gTnJDaGFubmVsczsgamogIT0gMDsgamotLSkgewogICAgICAgICAgICAgVGVtcCArPSAoKnNyYyk7CiAgICAgICAgICAgICBzcmMrKzsKICAgICAgICAgfQpAQCAtMTA3LDYgKzcyLDMgQEAKIAogICAgIHJldHVybjsKIH0KLSNlbmRpZgotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0luc3RBbGxvYy5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9JbnN0QWxsb2MuY3BwCmRlbGV0ZWQgZmlsZSBtb2RlIDEwMDY0NAppbmRleCBhMDM5YmY1Li4wMDAwMDAwCi0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0luc3RBbGxvYy5jcHAKKysrIC9kZXYvbnVsbApAQCAtMSwxNzcgKzAsMCBAQAotLyoKLSAqIENvcHlyaWdodCAoQykgMjAwNC0yMDEwIE5YUCBTb2Z0d2FyZQotICogQ29weXJpZ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GFuY2UKLSAgICAgICAgICAgICAgICAgIFN0YXJ0QWRkciAtIEJhc2UgYWRkcmVzcyBvZiB0aGUgaW5zdGFuY2UgbWVtb3J5Ci0gKiAgUmV0dXJucyAgICAgOiBFcnJvciBjb2RlCi0gKiAgRGVzY3JpcHRpb24gOiBJbml0aWFsaXplcyB0aGUgaW5zdGFuY2UgZGlzdHJpYnV0aW9uIGFuZCBtZW1vcnkgc2l6ZSBjYWxjdWxhdGlvbiBmdW5jdGlvbgotICogIFJlbWFya3MgICAgIDoKLSAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkICAgIEluc3RBbGxvY19Jbml0KCBJTlNUX0FMTE9DICAgICAgKnBtcywKLSAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgICAqU3RhcnRBZGRyICkKLXsKLSAgICBwbXMtPlRvdGFsU2l6ZSA9IDM7Ci0gICAgcG1zLT5wTmV4dE1lbWJlciA9ICgoKHVpbnRwdHJfdClTdGFydEFkZHIgKyAzKSAmICh1aW50cHRyX3QpfjMpOwotfQotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICogIE5hbWUgICAgICAgIDogSW5zdEFsbG9jX0FkZE1lbWJlcigpCi0gKiAgSW5wdXQgICAgICAgOiBwbXMgIC0gUG9pbnRlciB0byB0aGUgSU5TVF9BTExPQyBpbnN0YW5jZQotICAgICAgICAgICAgICAgICAgU2l6ZSAtIFRoZSBzaXplIGluIGJ5dGVzIG9mIHRoZSBuZXcgYWRkZWQgbWVtYmVyCi0gKiAgUmV0dXJucyAgICAgOiBBIHBvaW50ZXIgdG8gdGhlIG5ldyBhZGRlZCBtZW1iZXIKLSAqICBEZXNjcmlwdGlvbiA6IEFsbG9jYXRlcyBzcGFjZSBmb3IgYSBuZXcgbWVtYmVyIGluIHRoZSBpbnN0YW5jZSBtZW1vcnkgYW5kIHJldHVybnMKLSAgICAgICAgICAgICAgICAgIGEgcG9pbnRlciB0byB0aGlzIG5ldyBtZW1iZXIuICBUaGUgc3RhcnQgYWRkcmVzcyBvZiBhbGwgbWVtYmVycyB3aWxsCi0gICAgICAgICAgICAgICAgICBiZSAzMiBiaXQgYWxsaWduZWQuCi0gKiAgUmVtYXJrcyAgICAgOgotICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLXZvaWQqICAgSW5zdEFsbG9jX0FkZE1lbWJlciggSU5TVF9BTExPQyAgICAgICAgICpwbXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMzIgICAgICAgICAgIFNpemUgKQotewotICAgIHZvaWQgKk5ld01lbWJlckFkZHJlc3M7IC8qIFZhcmlhYmxlIHRvIHRlbXBvcmFyaWx5IHN0b3JlIHRoZSByZXR1cm4gdmFsdWUgKi8KLSAgICBOZXdNZW1iZXJBZGRyZXNzID0gKHZvaWQqKXBtcy0+cE5leHRNZW1iZXI7Ci0KLSAgICBTaXplID0gKChTaXplICsgMykgJiAoTFZNX1VJTlQzMil+Myk7IC8qIENlaWwgdGhlIHNpemUgdG8gYSBtdWx0aXBsZSBvZiBmb3VyICovCi0KLSAgICBwbXMtPlRvdGFsU2l6ZSArPSBTaXplOwotICAgIHBtcy0+cE5leHRNZW1iZXIgKz0gU2l6ZTsKLQotICAgIHJldHVybihOZXdNZW1iZXJBZGRyZXNzKTsKLX0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAqICBOYW1lICAgICAgICA6IEluc3RBbGxvY19HZXRUb3RhbCgpCi0gKiAgSW5wdXQgICAgICAgOiBwbXMgIC0gUG9pbnRlciB0byB0aGUgSU5TVF9BTExPQyBpbnN0YW5jZQotICogIFJldHVybnMgICAgIDogVGhlIGluc3RhbmNlIG1lbW9yeSBzaXplCi0gKiAgRGVzY3JpcHRpb24gOiBUaGlzIGZ1bmN0aW9ucyByZXR1cm5zIHRoZSBjYWxjdWxhdGVkIGluc3RhbmNlIG1lbW9yeSBzaXplCi0gKiAgUmVtYXJrcyAgICAgOgotICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLUxWTV9VSU5UMzIgSW5zdEFsbG9jX0dldFRvdGFsKCBJTlNUX0FMTE9DICpwbXMpCi17Ci0gICAgaWYgKHBtcy0+VG90YWxTaXplID4gMykKLSAgICB7Ci0gICAgICAgIHJldHVybihwbXMtPlRvdGFsU2l6ZSk7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIHJldHVybiAwOyAgICAgICAgICAgLyogTm8gbWVtb3J5IGFkZGVkICovCi0gICAgfQotfQotCi12b2lkICAgIEluc3RBbGxvY19Jbml0QWxsKCBJTlNUX0FMTE9DICAgICAgICAgICAgICAgICAgICAgICpwbXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fTWVtb3J5VGFibGVfc3QgICAgICAgICAgICAgKnBNZW1vcnlUYWJsZSkKLXsKLSAgICB1aW50cHRyX3QgU3RhcnRBZGRyOwotCi0gICAgU3RhcnRBZGRyID0gKHVpbnRwdHJfdClwTWVtb3J5VGFibGUtPlJlZ2lvbltMVk1fUEVSU0lTVEVOVF9TTE9XX0RBVEFdLnBCYXNlQWRkcmVzczsKLQotICAgIHBtc1swXS5Ub3RhbFNpemUgPSAzOwotICAgIHBtc1swXS5wTmV4dE1lbWJlciA9ICgoU3RhcnRBZGRyICsgMykgJiAodWludHB0cl90KX4zKTsKLQotICAgIFN0YXJ0QWRkciA9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ZWdpb25zIGFuZAotICogICAgICAgICAgICAgICAgaW50aWFsaXplcyBwTmV4dE1lbWJlciBmb3IgYWxsIHJlZ2lvbnMgdG8gMAotICogIFJlbWFya3MgICAgIDoKLSAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkICAgIEluc3RBbGxvY19Jbml0QWxsX05VTEwoIElOU1RfQUxMT0MgICpwbXMpCi17Ci0gICAgcG1zWzBdLlRvdGFsU2l6ZSA9IDM7Ci0gICAgcG1zWzBdLnBOZXh0TWVtYmVyID0gMDsKLQotICAgIHBtc1sxXS5Ub3RhbFNpemUgPSAzOwotICAgIHBtc1sxXS5wTmV4dE1lbWJlciA9IDA7Ci0KLSAgICBwbXNbMl0uVG90YWxTaXplID0gMzsKLSAgICBwbXNbMl0ucE5leHRNZW1iZXIgPSAwOwotCi0gICAgcG1zWzNdLlRvdGFsU2l6ZSA9IDM7Ci0gICAgcG1zWzNdLnBOZXh0TWVtYmVyID0gMDsKLQotfQotCi12b2lkKiAgIEluc3RBbGxvY19BZGRNZW1iZXJBbGwoIElOU1RfQUxMT0MgICAgICAgICAgICAgICAgICAgICAqcG1zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQzMiAgICAgICAgICAgICAgICAgICBTaXplW10sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fTWVtb3J5VGFibGVfc3QgICAgICAgICAgICpwTWVtb3J5VGFibGUpCi17Ci0gICAgdm9pZCAqTmV3TWVtYmVyQWRkcmVzczsgLyogVmFyaWFibGUgdG8gdGVtcG9yYXJpbHkgc3RvcmUgdGhlIHJldHVybiB2YWx1ZSAqLwotCi0gICAgLyogY292ZXJpdHlbcmV0dXJuZWRfcG9pbnRlcl0gSWdub3JlIGNvdmVyaXR5IHdhcm5pbmcgdGhhdCBwdHIgaXMgbm90IHVzZWQ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qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgSU5DTFVERSBGSUxFUwotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSNpbmNsdWRlICJWZWN0b3JBcml0aG1ldGljLmgiCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICBGVU5DVElPTiBJTlQxNkxTSElGVFRPSU5UMzJfMTZYMzIKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIEludDE2TFNoaWZ0VG9JbnQzMl8xNngzMihjb25zdCBMVk1fSU5UMTYgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDMyICAgICAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgIG4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICBzaGlmdCApCi17Ci0gICAgTFZNX0lOVDE2IGlpOwotCi0gICAgc3JjICs9IG4tMTsKLSAgICBkc3QgKz0gbi0xOwotCi0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICAqZHN0ID0gKCAoKExWTV9JTlQzMikqc3JjKSA8PCBzaGlmdCk7Ci0gICAgICAgIHNyYy0tOwotICAgICAgICBkc3QtLTsKLSAgICB9Ci0KLSAgICByZXR1cm47Ci19Ci0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq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gQkFTSVMsCi0gKiBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4KLSAqIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQKLSAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLgotICovCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICBJTkNMVURFIEZJTEVTCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotI2luY2x1ZGUgIlZlY3RvckFyaXRobWV0aWMuaCIKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIEZVTkNUSU9OIElOVDMyUlNISUZUVE9JTlQxNl9TQVRfMzJYMTYKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIEludDMyUlNoaWZ0VG9JbnQxNl9TYXRfMzJ4MTYoY29uc3QgTFZNX0lOVDMyICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBzaGlmdCApCi17Ci0gICAgTFZNX0lOVDMyIHRlbXA7Ci0gICAgTFZNX0lOVDE2IGlpOwotCi0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICB0ZW1wID0gKnNyYyA+PiBzaGlmdDsKLSAgICAgICAgc3JjKys7Ci0KLSAgICAgICAgaWYgKHRlbXAgPiAweDAwMDA3RkZGKQotICAgICAgICB7Ci0gICAgICAgICAgICAqZHN0ID0gMHg3RkZGOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UgaWYgKHRlbXAgPCAtMHgwMDAwODAwMCkKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9IC0gMHg4MDAwOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9IChMVk1fSU5UMTYpdGVtcDsKLSAgICAgICAgfQotCi0gICAgICAgIGRzdCsrOwotICAgIH0KLQotICAgIHJldHVybjsKLX0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Kb2luVG8yaV8zMngzMi5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Kb2luVG8yaV8zMngzMi5jcHAKaW5kZXggMDVkZjY1Ni4uNmM3YzhhZSAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvSm9pblRvMmlfMzJ4MzIuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0pvaW5UbzJpXzMyeDMyLmNwcApAQCAtMjEsNDcgKzIxLDE0IEBACiAKICNpbmNsdWRlICJWZWN0b3JBcml0aG1ldGljLmgiCiAKLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICBGVU5DVElPTiBKb2luVG8yaV8zMngzMgotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLXZvaWQgSm9pblRvMmlfMzJ4MzIoIGNvbnN0IExWTV9JTlQzMiAgICAqc3JjTCwKLSAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9JTlQzMiAgICAqc3JjUiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQzMiAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgIG4gKQotewotICAgIExWTV9JTlQxNiBpaTsKLQotICAgIHNyY0wgKz0gbi0xOwotICAgIHNyY1IgKz0gbi0xOwotICAgIGRzdCAgKz0gKCgyKm4pLTEpOwotCi0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICAqZHN0ID0gKnNyY1I7Ci0gICAgICAgIGRzdC0tOwotICAgICAgICBzcmNSLS07Ci0KLSAgICAgICAgKmRzdCA9ICpzcmNMOwotICAgICAgICBkc3QtLTsKLSAgICAgICAgc3JjTC0tOwotICAgIH0KLQotICAgIHJldHVybjsKLX0KLXZvaWQgSm9pblRvMmlfRmxvYXQoIGNvbnN0IExWTV9GTE9BVCAgICAqc3JjTCwKLSAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAqc3JjUiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgIG4gKQotewordm9pZCBKb2luVG8yaV9GbG9hdChjb25zdCBMVk1fRkxPQVQqIHNyY0wsIGNvbnN0IExWTV9GTE9BVCogc3JjUiwgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBuKSB7CiAgICAgTFZNX0lOVDE2IGlpOwogCiAgICAgc3JjTCArPSBuIC0gMTsKICAgICBzcmNSICs9IG4gLSAxOwotICAgIGRzdCAgKz0gKCgyICogbikgLSAxKTsKKyAgICBkc3QgKz0gKCgyICogbikgLSAxKTsKIAotICAgIGZvciAoaWkgPSBuOyBpaSAhPSAwOyBpaS0tKQotICAgIHsKKyAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICAqZHN0ID0gKnNyY1I7CiAgICAgICAgIGRzdC0tOwogICAgICAgICBzcmNSLS07CkBAIC03NCw0ICs0MSwzIEBACiAgICAgcmV0dXJuOwogfQogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19Db3JlX01peEhhcmRfMVN0XzJpX0QxNkMzMV9TQVQuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX0NvcmVfTWl4SGFyZF8xU3RfMmlfRDE2QzMxX1NBVC5jcHAKaW5kZXggMTRkNjFiZC4uZDY3MGIzZCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX0NvcmVfTWl4SGFyZF8xU3RfMmlfRDE2QzMxX1NBVC5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX0NvcmVfTWl4SGFyZF8xU3RfMmlfRDE2QzMxX1NBVC5jcHAKQEAgLTE4LDY3ICsxOCwxOSBAQAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgIElOQ0xVREUgRklMRVMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCiAjaW5jbHVkZSAiTFZDX01peGVyX1ByaXZhdGUuaCIKICNpbmNsdWRlICJMVk1fTWFjcm9zLmgiCiAjaW5jbHVkZSAiU2NhbGFyQXJpdGhtZXRpYy5oIgogCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gTFZDX0NvcmVfTWl4SGFyZF8xU3RfMmlfRDE2QzMxX1NBVAotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIExWQ19Db3JlX01peEhhcmRfMVN0XzJpX0QxNkMzMV9TQVQoIExWTWl4ZXIzX0ZMT0FUX3N0ICAgICAgICAqcHRySW5zdGFuY2UxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1peGVyM19GTE9BVF9zdCAgICAgICAgKnB0ckluc3RhbmNlMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgbikKLXsKLSAgICBMVk1fRkxPQVQgIFRlbXA7Ci0gICAgTFZNX0lOVDE2IGlpOwotICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0ICAqcEluc3RhbmNlMSA9IChNaXhfUHJpdmF0ZV9GTE9BVF9zdCAqKShwdHJJbnN0YW5jZTEtPlByaXZhdGVQYXJhbXMpOwotICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0ICAqcEluc3RhbmNlMiA9IChNaXhfUHJpdmF0ZV9GTE9BVF9zdCAqKShwdHJJbnN0YW5jZTItPlByaXZhdGVQYXJhbXMpOwotICAgIGZvciAoaWkgPSBuOyBpaSAhPSAwOyBpaS0tKQotICAgIHsKLSAgICAgICAgVGVtcCA9ICgoTFZNX0ZMT0FUKSooc3JjKyspICogKExWTV9GTE9BVClwSW5zdGFuY2UxLT5DdXJyZW50KTsKLSAgICAgICAgaWYgKFRlbXAgPiAxLjBmKQotICAgICAgICAgICAgKmRzdCsrID0gMS4wZjsKLSAgICAgICAgZWxzZSBpZiAoVGVtcCA8IC0xLjBmKQotICAgICAgICAgICAgKmRzdCsrID0gLTEuMGY7Ci0gICAgICAgIGVsc2UKLSAgICAgICAgICAgICpkc3QrKyA9IChMVk1fRkxPQVQpVGVtcDsKLQotICAgICAgICBUZW1wID0gKChMVk1fRkxPQVQpKihzcmMrKykgKiAoTFZNX0ZMT0FUKXBJbnN0YW5jZTItPkN1cnJlbnQpOwotICAgICAgICBpZiAoVGVtcCA+IDEuMGYpCi0gICAgICAgICAgICAqZHN0KysgPSAxLjBmOwotICAgICAgICBlbHNlIGlmIChUZW1wIDwgLTEuMGYpCi0gICAgICAgICAgICAqZHN0KysgPSAtMS4wZjsKLSAgICAgICAgZWxzZQotICAgICAgICAgICAgKmRzdCsrID0gKExWTV9GTE9BVClUZW1wOwotICAgIH0KLQotfQotI2lmZGVmIFNVUFBPUlRfTUMKLXZvaWQgTFZDX0NvcmVfTWl4SGFyZF8xU3RfTUNfZmxvYXRfU0FUIChNaXhfUHJpdmF0ZV9GTE9BVF9zdCAqKnB0ckluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICBOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgTnJDaGFubmVscykKLXsKLSAgICBMVk1fRkxPQVQgIFRlbXA7Cit2b2lkIExWQ19Db3JlX01peEhhcmRfMVN0X01DX2Zsb2F0X1NBVChNaXhfUHJpdmF0ZV9GTE9BVF9zdCoqIHB0ckluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgTnJGcmFtZXMsIExWTV9JTlQxNiBOckNoYW5uZWxzKSB7CisgICAgTFZNX0ZMT0FUIFRlbXA7CiAgICAgTFZNX0lOVDE2IGlpLCBqajsKLSAgICBmb3IgKGlpID0gTnJGcmFtZXM7IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICBmb3IgKGpqID0gMDsgamogPCBOckNoYW5uZWxzOyBqaisrKQotICAgICAgICB7Ci0gICAgICAgICAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCAgKnBJbnN0YW5jZTEgPSAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKikocHRySW5zdGFuY2VbampdKTsKLSAgICAgICAgICAgIFRlbXAgPSAoKExWTV9GTE9BVCkqKHNyYysrKSAqIChMVk1fRkxPQVQpcEluc3RhbmNlMS0+Q3VycmVudCk7Ci0gICAgICAgICAgICBpZiAoVGVtcCA+IDEuMGYpCi0gICAgICAgICAgICAgICAgKmRzdCsrID0gMS4wZjsKLSAgICAgICAgICAgIGVsc2UgaWYgKFRlbXAgPCAtMS4wZikKLSAgICAgICAgICAgICAgICAqZHN0KysgPSAtMS4wZjsKLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAqZHN0KysgPSAoTFZNX0ZMT0FUKVRlbXA7CisgICAgZm9yIChpaSA9IE5yRnJhbWVzOyBpaSAhPSAwOyBpaS0tKSB7CisgICAgICAgIGZvciAoamogPSAwOyBqaiA8IE5yQ2hhbm5lbHM7IGpqKyspIHsKKyAgICAgICAgICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0KiBwSW5zdGFuY2UxID0gKE1peF9Qcml2YXRlX0ZMT0FUX3N0KikocHRySW5zdGFuY2VbampdKTsKKyAgICAgICAgICAgIFRlbXAgPSAgKnNyYysrICogcEluc3RhbmNlMS0+Q3VycmVudDsKKyAgICAgICAgICAgICpkc3QrKyA9IExWTV9DbGFtcChUZW1wKTsKICAgICAgICAgfQogICAgIH0KIH0KLSNlbmRpZgotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfQ29yZV9NaXhIYXJkXzJTdF9EMTZDMzFfU0FULmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19Db3JlX01peEhhcmRfMlN0X0QxNkMzMV9TQVQuY3BwCmluZGV4IDg0MWZhMWUuLjQxN2MxZjAgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19Db3JlX01peEhhcmRfMlN0X0QxNkMzMV9TQVQuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19Db3JlX01peEhhcmRfMlN0X0QxNkMzMV9TQVQuY3BwCkBAIC0xOCwzOCArMTgsMjggQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBJTkNMVURFIEZJTEVTCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQogI2luY2x1ZGUgIkxWQ19NaXhlcl9Qcml2YXRlLmgiCisjaW5jbHVkZSAiU2NhbGFyQXJpdGhtZXRpYy5oIgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgRlVOQ1RJT04gTFZDb3JlX01JWEhBUkRfMlNUX0QxNkMzMV9TQVQKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBMVkNfQ29yZV9NaXhIYXJkXzJTdF9EMTZDMzFfU0FUKCBMVk1peGVyM19GTE9BVF9zdCAqcHRySW5zdGFuY2UxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNaXhlcjNfRkxPQVRfc3QgICAgICAgICAqcHRySW5zdGFuY2UyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAqc3JjMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgKnNyYzIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgIG4pCi17Ci0gICAgTFZNX0ZMT0FUICBUZW1wOwordm9pZCBMVkNfQ29yZV9NaXhIYXJkXzJTdF9EMTZDMzFfU0FUKExWTWl4ZXIzX0ZMT0FUX3N0KiBwdHJJbnN0YW5jZTEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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ULmNwcApAQCAtMTgsMTAyICsxOCw3MiBAQAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgIElOQ0xVREUgRklMRVMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCiAjaW5jbHVkZSAiTFZDX01peGVyX1ByaXZhdGUuaCIKICNpbmNsdWRlICJMVk1fTWFjcm9zLmgiCisjaW5jbHVkZSAiU2NhbGFyQXJpdGhtZXRpYy5oIgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgRlVOQ1RJT04gTFZDb3JlX01JWFNPRlRfMVNUX0QxNkMzMV9XUkEKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBMVkNfQ29yZV9NaXhJblNvZnRfRDE2QzMxX1NBVChMVk1peGVyM19GTE9BVF9zdCAqcHRySW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgIG4pCi17Ci0KLSAgICBMVk1fSU5UMTYgICBPdXRMb29wOwotICAgIExWTV9JTlQxNiAgIEluTG9vcDsKLSAgICBMVk1fSU5UMzIgICBpaSxqajsKLSAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCAgKnBJbnN0YW5jZSA9IChNaXhfUHJpdmF0ZV9GTE9BVF9z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AgICAgIGlmIChPdXRMb29wKXsKKyAgICBpZiAoQ3VycmVudCA8IFRhcmdldCkgeworICAgICAgICBpZiAoT3V0TG9vcCkgewogICAgICAgICAgICAgVGVtcCA9IEN1cnJlbnQgKyBEZWx0YTsKICAgICAgICAgICAgIEN1cnJlbnQgPSBUZW1wOwotICAgICAgICAgICAgaWYgKEN1cnJlbnQgPiBUYXJnZXQpCi0gICAgICAgICAgICAgICAgQ3VycmVudCA9IFRhcmdldDsKKyAgICAgICAgICAgIGlmIChDdXJyZW50ID4gVGFyZ2V0KSBDdXJyZW50ID0gVGFyZ2V0OwogCi0gICAgICAgICAgIGZvciAoaWkgPSBPdXRMb29wOyBpaSAhPSAwOyBpaS0tKXsKLSAgICAgICAgICAgICAgICBUZW1wID0gKChMVk1fRkxPQVQpKmRzdCkgKyAoKChMVk1fRkxPQVQpKihzcmMrKykgKiBDdXJyZW50KSk7Ci0gICAgICAgICAgICAgICAgaWYgKFRlbXAgPiAxLjBmKQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAxLjBmOwotICAgICAgICAgICAgICAgIGVsc2UgaWYgKFRlbXAgPCAtMS4wZikKLSAgICAgICAgICAgICAgICAgICAgKmRzdCsrID0gLTEuMGY7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAoTFZNX0ZMT0FUKVRlbXA7CisgICAgICAgICAgICBmb3IgKGlpID0gT3V0TG9vcDsgaWkgIT0gMDsgaWktLSkgeworICAgICAgICAgICAgICAgIFRlbXAgPSAqZHN0ICsgKnNyYysrICogQ3VycmVudDsKKyAgICAgICAgICAgICAgICAqZHN0KysgPSBMVk1fQ2xhbXAoVGVtcCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAotICAgICAgICBmb3IgKGlpID0gSW5Mb29wOyBpaSAhPSAwOyBpaS0tKXsKKyAgICAgICAgZm9yIChpaSA9IEluTG9vcDsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICAgICAgVGVtcCA9IEN1cnJlbnQgKyBEZWx0YTsKICAgICAgICAgICAgIEN1cnJlbnQgPSBUZW1wOwotICAgICAgICAgICAgaWYgKEN1cnJlbnQgPiBUYXJnZXQpCi0gICAgICAgICAgICAgICAgQ3VycmVudCA9IFRhcmdldDsKKyAgICAgICAgICAgIGlmIChDdXJyZW50ID4gVGFyZ2V0KSBDdXJyZW50ID0gVGFyZ2V0OwogCi0gICAgICAgICAgICBmb3IgKGpqID0gNDsgamogIT0gMCA7IGpqLS0pewotICAgICAgICAgICAgICAgIFRlbXAgPSAoKExWTV9GTE9BVCkqZHN0KSArICgoKExWTV9GTE9BVCkqKHNyYysrKSAqIEN1cnJlbnQpKTsKLSAgICAgICAgICAgICAgICBpZiAoVGVtcCA+IDEuMGYpCi0gICAgICAgICAgICAgICAgICAgICpkc3QrKyA9IDEuMGY7Ci0gICAgICAgICAgICAgICAgZWxzZSBpZiAoVGVtcCA8IC0xLjBmKQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAtMS4wZjsKLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICpkc3QrKyA9IChMVk1fRkxPQVQpVGVtcDsKKyAgICAgICAgICAgIGZvciAoamogPSA0OyBqaiAhPSAwOyBqai0tKSB7CisgICAgICAgICAgICAgICAgVGVtcCA9ICpkc3QgKyAqc3JjKysgKiBDdXJyZW50OworICAgICAgICAgICAgICAgICpkc3QrKyA9IExWTV9DbGFtcChUZW1wKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgIH0KLSAgICBlbHNlewotICAgICAgICBpZiAoT3V0TG9vcCl7CisgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKE91dExvb3ApIHsKICAgICAgICAgICAgIEN1cnJlbnQgLT0gRGVsdGE7Ci0gICAgICAgICAgICBpZiAoQ3VycmVudCA8IFRhcmdldCkKLSAgICAgICAgICAgICAgICBDdXJyZW50ID0gVGFyZ2V0OworICAgICAgICAgICAgaWYgKEN1cnJlbnQgPCBUYXJnZXQpIEN1cnJlbnQgPSBUYXJnZXQ7CiAKLSAgICAgICAgICAgIGZvciAoaWkgPSBPdXRMb29wOyBpaSAhPSAwOyBpaS0tKXsKLSAgICAgICAgICAgICAgICBUZW1wID0gKChMVk1fRkxPQVQpKmRzdCkgKyAoKChMVk1fRkxPQVQpKihzcmMrKykgKiBDdXJyZW50KSk7Ci0gICAgICAgICAgICAgICAgaWYgKFRlbXAgPiAxLjBmKQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAxLjBmOwotICAgICAgICAgICAgICAgIGVsc2UgaWYgKFRlbXAgPCAtMS4wZikKLSAgICAgICAgICAgICAgICAgICAgKmRzdCsrID0gLTEuMGY7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAoTFZNX0ZMT0FUKVRlbXA7CisgICAgICAgICAgICBmb3IgKGlpID0gT3V0TG9vcDsgaWkgIT0gMDsgaWktLSkgeworICAgICAgICAgICAgICAgIFRlbXAgPSAqZHN0ICsgKnNyYysrICogQ3VycmVudDsKKyAgICAgICAgICAgICAgICAqZHN0KysgPSBMVk1fQ2xhbXAoVGVtcCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAotICAgICAgICBmb3IgKGlpID0gSW5Mb29wOyBpaSAhPSAwOyBpaS0tKXsKKyAgICAgICAgZm9yIChpaSA9IEluTG9vcDsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICAgICAgQ3VycmVudCAtPSBEZWx0YTsKLSAgICAgICAgICAgIGlmIChDdXJyZW50IDwgVGFyZ2V0KQotICAgICAgICAgICAgICAgIEN1cnJlbnQgPSBUYXJnZXQ7CisgICAgICAgICAgICBpZiAoQ3VycmVudCA8IFRhcmdldCkgQ3VycmVudCA9IFRhcmdldDsKIAotICAgICAgICAgICAgZm9yIChqaiA9IDQ7IGpqICE9IDAgOyBqai0tKXsKLSAgICAgICAgICAgICAgICBUZW1wID0gKChMVk1fRkxPQVQpKmRzdCkgKyAoKChMVk1fRkxPQVQpKihzcmMrKykgKiBDdXJyZW50KSk7Ci0gICAgICAgICAgICAgICAgaWYgKFRlbXAgPiAxLjBmKQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAxLjBmOwotICAgICAgICAgICAgICAgIGVsc2UgaWYgKFRlbXAgPCAtMS4wZikKLSAgICAgICAgICAgICAgICAgICAgKmRzdCsrID0gLTEuMGY7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAoTFZNX0ZMT0FUKVRlbXA7CisgICAgICAgICAgICBmb3IgKGpqID0gNDsgamogIT0gMDsgamotLSkgeworICAgICAgICAgICAgICAgIFRlbXAgPSAqZHN0ICsgKnNyYysrICogQ3VycmVudDsKKyAgICAgICAgICAgICAgICAqZHN0KysgPSBMVk1fQ2xhbXAoVGVtcCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAgICAgcEluc3RhbmNlLT5DdXJyZW50ID0gQ3VycmVudDsKIH0KLSNpZmRlZiBTVVBQT1JUX01DCiAvKgogICogRlVOQ1RJT046ICAgICAgIExWQ19Db3JlX01peEluU29mdF9NY19EMTZDMzFfU0FUCiAgKgpAQCAtMTMxLDIxICsxMDEsMTYgQEAKICAqICB2b2lkCiAgKgogICovCi12b2lkIExWQ19Db3JlX01peEluU29mdF9NY19EMTZDMzFfU0FUKExWTWl4ZXIzX0ZMT0FUX3N0ICpwdHJJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAg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gVGFyZ2V0ID0gcEluc3RhbmNlLT5UYXJnZXQ7CisgICAgTFZNX0ZMT0FUIFRlbXA7CiAKICAgICAvKgogICAgICAqIFNhbWUgb3BlcmF0aW9uIGlzIHBlcmZvcm1lZCBvbiBjb25zZWN1dGl2ZSBmcmFtZXMuCkBAIC0xNjAsOTAgKzEyNSw1MiBAQAogICAgICAgICBpZiAoT3V0TG9vcCkgewogICAgICAgICAgICAgVGVtcCA9IEN1cnJlbnQgKyBEZWx0YTsKICAgICAgICAgICAgIEN1cnJlbnQgPSBUZW1wOwotICAgICAgICAgICAgaWYgKEN1cnJlbnQgPiBUYXJnZXQpCi0gICAgICAgICAgICAgICAgQ3VycmVudCA9IFRhcmdldDsKKyAgICAgICAgICAgIGlmIChDdXJyZW50ID4gVGFyZ2V0KSBDdXJyZW50ID0gVGFyZ2V0OwogCi0gICAgICAgICAgIGZvciAoaWkgPSBPdXRMb29wKk5yQ2hhbm5lbHM7IGlpICE9IDA7IGlpLS0pIHsKLSAgICAgICAgICAgICAgICBUZW1wID0gKCpkc3QpICsgKCooc3JjKyspICogQ3VycmVudCk7Ci0gICAgICAgICAgICAgICAgaWYgKFRlbXAgPiAxLjBmKQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAxLjBmOwotICAgICAgICAgICAgICAgIGVsc2UgaWYgKFRlbXAgPCAtMS4wZikKLSAgICAgICAgICAgICAgICAgICAgKmRzdCsrID0gLTEuMGY7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSBUZW1wOworICAgICAgICAgICAgZm9yIChpaSA9IE91dExvb3AgKiBOckNoYW5uZWxzOyBpaSAhPSAwOyBpaS0tKSB7CisgICAgICAgICAgICAgICAgVGVtcCA9ICpkc3QgKyAqc3JjKysgKiBDdXJyZW50OworICAgICAgICAgICAgICAgICpkc3QrKyA9IExWTV9DbGFtcChUZW1wKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCiAgICAgICAgIGZvciAoaWkgPSBJbkxvb3A7IGlpICE9IDA7IGlpLS0pIHsKICAgICAgICAgICAgIFRlbXAgPSBDdXJyZW50ICsgRGVsdGE7CiAgICAgICAgICAgICBDdXJyZW50ID0gVGVtcDsKLSAgICAgICAgICAgIGlmIChDdXJyZW50ID4gVGFyZ2V0KQotICAgICAgICAgICAgICAgIEN1cnJlbnQgPSBUYXJnZXQ7CisgICAgICAgICAgICBpZiAoQ3VycmVudCA+IFRhcmdldCkgQ3VycmVudCA9IFRhcmdldDsKIAotICAgICAgICAgICAgZm9yIChqaiA9IE5yQ2hhbm5lbHM7IGpqICE9IDAgOyBqai0tKSB7Ci0gICAgICAgICAgICAgICAgVGVtcCA9ICgqZHN0KSArICgqKHNyYysrKSAqIEN1cnJlbnQpOwotICAgICAgICAgICAgICAgIGlmIChUZW1wID4gMS4wZikKLSAgICAgICAgICAgICAgICAgICAgKmRzdCsrID0gMS4wZjsKLSAgICAgICAgICAgICAgICBlbHNlIGlmIChUZW1wIDwgLTEuMGYpCi0gICAgICAgICAgICAgICAgICAgICpkc3QrKyA9IC0xLjBmOwotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgKmRzdCsrID0gVGVtcDsKKyAgICAgICAgICAgIGZvciAoamogPSBOckNoYW5uZWxzOyBqaiAhPSAwOyBqai0tKSB7CisgICAgICAgICAgICAgICAgVGVtcCA9ICpkc3QgKyAqc3JjKysgKiBDdXJyZW50OworICAgICAgICAgICAgICAgICpkc3QrKyA9IExWTV9DbGFtcChUZW1wKTsKIAotICAgICAgICAgICAgICAgIFRlbXAgPSAoKmRzdCkgKyAoKihzcmMrKykgKiBDdXJyZW50KTsKLSAgICAgICAgICAgICAgICBpZiAoVGVtcCA+IDEuMGYpCi0gICAgICAgICAgICAgICAgICAgICpkc3QrKyA9IDEuMGY7Ci0gICAgICAgICAgICAgICAgZWxzZSBpZiAoVGVtcCA8IC0xLjBmKQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAtMS4wZjsKLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICpkc3QrKyA9IFRlbXA7Ci0KKyAgICAgICAgICAgICAgICBUZW1wID0gKmRzdCArICpzcmMrKyAqIEN1cnJlbnQ7CisgICAgICAgICAgICAgICAgKmRzdCsrID0gTFZNX0NsYW1wKFRlbXApOwogICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgfQotICAgIGVsc2V7CisgICAgfSBlbHNlIHsKICAgICAgICAgaWYgKE91dExvb3ApIHsKICAgICAgICAgICAgIEN1cnJlbnQgLT0gRGVsdGE7Ci0gICAgICAgICAgICBpZiAoQ3VycmVudCA8IFRhcmdldCkKLSAgICAgICAgICAgICAgICBDdXJyZW50ID0gVGFyZ2V0OworICAgICAgICAgICAgaWYgKEN1cnJlbnQgPCBUYXJnZXQpIEN1cnJlbnQgPSBUYXJnZXQ7CiAKLSAgICAgICAgICAgIGZvciAoaWkgPSBPdXRMb29wKk5yQ2hhbm5lbHM7IGlpICE9IDA7IGlpLS0pIHsKLSAgICAgICAgICAgICAgICBUZW1wID0gKCpkc3QpICsgKCooc3JjKyspICogQ3VycmVudCk7Ci0gICAgICAgICAgICAgICAgaWYgKFRlbXAgPiAxLjBmKQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAxLjBmOwotICAgICAgICAgICAgICAgIGVsc2UgaWYgKFRlbXAgPCAtMS4wZikKLSAgICAgICAgICAgICAgICAgICAgKmRzdCsrID0gLTEuMGY7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSBUZW1wOworICAgICAgICAgICAgZm9yIChpaSA9IE91dExvb3AgKiBOckNoYW5uZWxzOyBpaSAhPSAwOyBpaS0tKSB7CisgICAgICAgICAgICAgICAgVGVtcCA9ICpkc3QgKyAqc3JjKysgKiBDdXJyZW50OworICAgICAgICAgICAgICAgICpkc3QrKyA9IExWTV9DbGFtcChUZW1wKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCiAgICAgICAgIGZvciAoaWkgPSBJbkxvb3A7IGlpICE9IDA7IGlpLS0pIHsKICAgICAgICAgICAgIEN1cnJlbnQgLT0gRGVsdGE7Ci0gICAgICAgICAgICBpZiAoQ3VycmVudCA8IFRhcmdldCkKLSAgICAgICAgICAgICAgICBDdXJyZW50ID0gVGFyZ2V0OworICAgICAgICAgICAgaWYgKEN1cnJlbnQgPCBUYXJnZXQpIEN1cnJlbnQgPSBUYXJnZXQ7CiAKLSAgICAgICAgICAgIGZvciAoamogPSBOckNoYW5uZWxzOyBqaiAhPSAwIDsgamotLSkgewotICAgICAgICAgICAgICAgIFRlbXAgPSAoKmRzdCkgKyAoKihzcmMrKykgKiBDdXJyZW50KTsKLSAgICAgICAgICAgICAgICBpZiAoVGVtcCA+IDEuMGYpCi0gICAgICAgICAgICAgICAgICAgICpkc3QrKyA9IDEuMGY7Ci0gICAgICAgICAgICAgICAgZWxzZSBpZiAoVGVtcCA8IC0xLjBmKQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAtMS4wZjsKLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICpkc3QrKyA9IFRlbXA7CisgICAgICAgICAgICBmb3IgKGpqID0gTnJDaGFubmVsczsgamogIT0gMDsgamotLSkgeworICAgICAgICAgICAgICAgIFRlbXAgPSAqZHN0ICsgKnNyYysrICogQ3VycmVudDsKKyAgICAgICAgICAgICAgICAqZHN0KysgPSBMVk1fQ2xhbXAoVGVtcCk7CiAKLSAgICAgICAgICAgICAgICBUZW1wID0gKCpkc3QpICsgKCooc3JjKyspICogQ3VycmVudCk7Ci0gICAgICAgICAgICAgICAgaWYgKFRlbXAgPiAxLjBmKQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSAxLjBmOwotICAgICAgICAgICAgICAgIGVsc2UgaWYgKFRlbXAgPCAtMS4wZikKLSAgICAgICAgICAgICAgICAgICAgKmRzdCsrID0gLTEuMGY7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAqZHN0KysgPSBUZW1wOwotCisgICAgICAgICAgICAgICAgVGVtcCA9ICpkc3QgKyAqc3JjKysgKiBDdXJyZW50OworICAgICAgICAgICAgICAgICpkc3QrKyA9IExWTV9DbGFtcChUZW1wKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KICAgICBwSW5zdGFuY2UtPkN1cnJlbnQgPSBDdXJyZW50OwogfQogCi0jZW5kaWYKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX0NvcmVfTWl4U29mdF8xU3RfMmlfRDE2QzMxX1dSQS5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfQ29yZV9NaXhTb2Z0XzFTdF8yaV9EMTZDMzFfV1JBLmNwcAppbmRleCAxZjRiMDhhLi4wOTY4Y2Y4IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfQ29yZV9NaXhTb2Z0XzFTdF8yaV9EMTZDMzFfV1JBLmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfQ29yZV9NaXhTb2Z0XzFTdF8yaV9EMTZDMzFfV1JBLmNwcApAQCAtMTgsMTc2ICsxOCwzOCBAQAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgIElOQ0xVREUgRklMRVMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCiAjaW5jbHVkZSAiTFZDX01peGVyX1ByaXZhdGUuaCIKLSNpbmNsdWRlICJTY2FsYXJBcml0aG1ldGljLmgiCiAjaW5jbHVkZSAiTFZNX01hY3Jvcy5oIgorI2luY2x1ZGUgIlNjYWxhckFyaXRobWV0aWMuaCIKIAotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIEZVTkNUSU9OIExWQ19Db3JlX01peFNvZnRfMVN0XzJpX0QxNkMzMV9XUkEKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotc3RhdGljIExWTV9GTE9BVCBBREQyX1NBVF9GTE9BVChMVk1fRkxPQVQgYSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUIGIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCBjKQotewotICAgIExWTV9GTE9BVCB0ZW1wOwotICAgIHRlbXAgPSBhICsgYiA7Ci0gICAgaWYgKHRlbXAgPCAtMS4wZikKLSAgICAgICAgYyA9IC0xLjBmOwotICAgIGVsc2UgaWYgKHRlbXAgPiAxLjBmKQotICAgICAgICBjID0gMS4wZjsKLSAgICBlbHNlCi0gICAgICAgIGMgPSB0ZW1wOwotICAgIHJldHVybiBjOworc3RhdGljIGlubGluZSBMVk1fRkxPQVQgQUREMl9TQVRfRkxPQVQoTFZNX0ZMT0FUIGEsIExWTV9GTE9BVCBiKSB7CisgICAgcmV0dXJuIExWTV9DbGFtcChhICsgYik7CiB9Ci12b2lkIExWQ19Db3JlX01peFNvZnRfMVN0XzJpX0QxNkMzMV9XUkEoIExWTWl4ZXIzX0ZMT0FUX3N0ICAgICAgICAqcHRySW5zdGFuY2UxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1peGVyM19GTE9BVF9zdCAgICAgICAgKnB0ckluc3RhbmNlMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgbikKLXsKLSAgICBMVk1fSU5UMTYgICBPdXRMb29wOwotICAgIExWTV9JTlQxNiAgIEluTG9vcDsKLSAgICBMVk1fSU5UMzIgICBpaTsKLSAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCAgKnBJbnN0YW5jZUwgPSAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKikocHRySW5zdGFuY2UxLT5Qcml2YXRlUGFyYW1zKTsKLSAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCAgKnBJbnN0YW5jZVIgPSAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKikocHRySW5zdGFuY2UyLT5Qcml2YXRlUGFyYW1zKTsKLQotICAgIExWTV9GTE9BVCAgIERlbHRhTCA9IHBJbnN0YW5jZUwtPkRlbHRhOwotICAgIExWTV9GTE9BVCAgIEN1cnJlbnRMID0gcEluc3RhbmNlTC0+Q3VycmVudDsKLSAgICBMVk1fRkxPQVQgICBUYXJnZXRMID0gcEluc3RhbmNlTC0+VGFyZ2V0OwotCi0gICAgTFZNX0ZMT0FUICAgRGVsdGFSID0gcEluc3RhbmNlUi0+RGVsdGE7Ci0gICAgTFZNX0ZMT0FUICAgQ3VycmVudFIgPSBwSW5zdGFuY2VSLT5DdXJyZW50OwotICAgIExWTV9GTE9BVCAgIFRhcmdldFIgPSBwSW5zdGFuY2VSLT5UYXJnZXQ7Ci0KLSAgICBMVk1fRkxPQVQgICBUZW1wID0gMDsKLQotICAgIEluTG9vcCA9IChMVk1fSU5UMTYpKG4gPj4gMik7IC8qIFByb2Nlc3MgcGVyIDQgc2FtcGxlcyAqLwotICAgIE91dExvb3AgPSAoTFZNX0lOVDE2KShuIC0gKEluTG9vcCA8PCAyKSk7Ci0KLSAgICBpZiAoT3V0TG9vcCkKLSAgICB7Ci0gICAgICAgIGlmKEN1cnJlbnRMIDwgVGFyZ2V0TCkKLSAgICAgICAgewotICAgICAgICAgICAgQUREMl9TQVRfRkxPQVQoQ3VycmVudEwsIERlbHRhTCwgVGVtcCk7Ci0gICAgICAgICAgICBDdXJyZW50TCA9IFRlbXA7Ci0gICAgICAgICAgICBpZiAoQ3VycmVudEwgPiBUYXJnZXRMKQotICAgICAgICAgICAgICAgIEN1cnJlbnRMID0gVGFyZ2V0TDsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIEN1cnJlbnRMIC09IERlbHRhTDsKLSAgICAgICAgICAgIGlmIChDdXJyZW50TCA8IFRhcmdldEwpCi0gICAgICAgICAgICAgICAgQ3VycmVudEwgPSBUYXJnZXRMOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYoQ3VycmVudFIgPCBUYXJnZXRSKQotICAgICAgICB7Ci0gICAgICAgICAgICBBREQyX1NBVF9GTE9BVChDdXJyZW50UiwgRGVsdGFSLCBUZW1wKTsKLSAgICAgICAgICAgIEN1cnJlbnRSID0gVGVtcDsKLSAgICAgICAgICAgIGlmIChDdXJyZW50UiA+IFRhcmdldFIpCi0gICAgICAgICAgICAgICAgQ3VycmVudFIgPSBUYXJnZXRSOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgQ3VycmVudFIgLT0gRGVsdGFSOwotICAgICAgICAgICAgaWYgKEN1cnJlbnRSIDwgVGFyZ2V0UikKLSAgICAgICAgICAgICAgICBDdXJyZW50UiA9IFRhcmdldFI7Ci0gICAgICAgIH0KLQotICAgICAgICBmb3IgKGlpID0gT3V0TG9vcCAqIDI7IGlpICE9IDA7IGlpIC09IDIpCi0gICAgICAgIHsKLSAgICAgICAgICAgICooZHN0KyspID0gKExWTV9GTE9BVCkoKChMVk1fRkxPQVQpKihzcmMrKykgKiAoTFZNX0ZMT0FUKUN1cnJlbnRMKSk7Ci0gICAgICAgICAgICAqKGRzdCsrKSA9IChMVk1fRkxPQVQpKCgoTFZNX0ZMT0FUKSooc3JjKyspICogKExWTV9GTE9BVClDdXJyZW50UikpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgZm9yIChpaSA9IEluTG9vcCAqIDI7IGlpICE9IDA7IGlpLT0yKQotICAgIHsKLSAgICAgICAgaWYoQ3VycmVudEwgPCBUYXJnZXRMKQotICAgICAgICB7Ci0gICAgICAgICAgICBBREQyX1NBVF9GTE9BVChDdXJyZW50TCwgRGVsdGFMLCBUZW1wKTsKLSAgICAgICAgICAgIEN1cnJlbnRMID0gVGVtcDsKLSAgICAgICAgICAgIGlmIChDdXJyZW50TCA+IFRhcmdldEwpCi0gICAgICAgICAgICAgICAgQ3VycmVudEwgPSBUYXJnZXRMOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgQ3VycmVudEwgLT0gRGVsdGFMOwotICAgICAgICAgICAgaWYgKEN1cnJlbnRMIDwgVGFyZ2V0TCkKLSAgICAgICAgICAgICAgICBDdXJyZW50TCA9IFRhcmdldEw7Ci0gICAgICAgIH0KLQotICAgICAgICBpZihDdXJyZW50UiA8IFRhcmdldFIpCi0gICAgICAgIHsKLSAgICAgICAgICAgIEFERDJfU0FUX0ZMT0FUKEN1cnJlbnRSLCBEZWx0YVIsIFRlbXApOwotICAgICAgICAgICAgQ3VycmVudFIgPSBUZW1wOwotICAgICAgICAgICAgaWYgKEN1cnJlbnRSID4gVGFyZ2V0UikKLSAgICAgICAgICAgICAgICBDdXJyZW50UiA9IFRhcmdldFI7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICA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LX0KLSNpZmRlZiBTVVBQT1JUX01DCi12b2lkIExWQ19Db3JlX01peFNvZnRfMVN0X01DX2Zsb2F0X1dSQSAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKipwdHJJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgIE5yQ2hhbm5lbHMpCi17Ci0gICAgTFZNX0lOVDMyICAgaWksIGNoOwotICAgIExWTV9GTE9BVCAgIFRlbXAgPTAuMGY7Ci0gICAgTFZNX0ZMT0FUICAgdGVtcEN1cnJlbnRbTnJDaGFubmVsc107Ci0gICAgZm9yIChjaCA9IDA7IGNoIDwgTnJDaGFubmVsczsgY2grKykKLSAgICB7Cit2b2lkIExWQ19Db3JlX01peFNvZnRfMVN0X01DX2Zsb2F0X1dSQShNaXhfUHJpdmF0ZV9GTE9BVF9zdCoqIHB0ckluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgTnJGcmFtZXMsIExWTV9JTlQxNiBOckNoYW5uZWxzKSB7CisgICAgTFZNX0lOVDMyIGlpLCBjaDsKKyAgICBMVk1fRkxPQVQgdGVtcEN1cnJlbnRbTnJDaGFubmVsc107CisgICAgZm9yIChjaCA9IDA7IGNoIDwgTnJDaGFubmVsczsgY2grKykgewogICAgICAgICB0ZW1wQ3VycmVudFtjaF0gPSBwdHJJbnN0YW5jZVtjaF0tPkN1cnJlbnQ7CiAgICAgfQotICAgIGZvciAoaWkgPSBOckZyYW1lczsgaWkgPiAwOyBpaS0tKQotICAgIHsKLSAgICAgICAgZm9yIChjaCA9IDA7IGNoIDwgTnJDaGFubmVsczsgY2grKykKLSAgICAgICAgewotICAgICAgICAgICAgTWl4X1ByaXZhdGVfRkxPQVRfc3QgKnBJbnN0YW5jZSA9IHB0ckluc3RhbmNlW2NoXTsKLSAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgIERlbHRhID0gcEluc3RhbmNlLT5EZWx0YTsKLSAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgIEN1cnJlbnQgPSB0ZW1wQ3VycmVudFtjaF07Ci0gICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICBUYXJnZXQgPSBwSW5zdGFuY2UtPlRhcmdldDsKLSAgICAgICAgICAgIGlmIChDdXJyZW50IDwgVGFyZ2V0KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIEFERDJfU0FUX0ZMT0FUKEN1cnJlbnQsIERlbHRhLCBUZW1wKTsKLSAgICAgICAgICAgICAgICBDdXJyZW50ID0gVGVtcDsKLSAgICAgICAgICAgICAgICBpZiAoQ3VycmVudCA+IFRhcmdldCkKLSAgICAgICAgICAgICAgICAgICAgQ3VycmVudCA9IFRhcmdldDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKKyAgICBmb3IgKGlpID0gTnJGcmFtZXM7IGlpID4gMDsgaWktLSkgeworICAgICAgICBmb3IgKGNoID0gMDsgY2ggPCBOckNoYW5uZWxzOyBjaCsrKSB7CisgICAgICAgICAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCogcEluc3RhbmNlID0gcHRySW5zdGFuY2VbY2hdOworICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUIERlbHRhID0gcEluc3RhbmNlLT5EZWx0YTsKKyAgICAgICAgICAgIExWTV9GTE9BVCBDdXJyZW50ID0gdGVtcEN1cnJlbnRbY2hdOworICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUIFRhcmdldCA9IHBJbnN0YW5jZS0+VGFyZ2V0OworICAgICAgICAgICAgaWYgKEN1cnJlbnQgPCBUYXJnZXQpIHsKKyAgICAgICAgICAgICAgICBDdXJyZW50ID0gQUREMl9TQVRfRkxPQVQoQ3VycmVudCwgRGVsdGEpOworICAgICAgICAgICAgICAgIGlmIChDdXJyZW50ID4gVGFyZ2V0KSBDdXJyZW50ID0gVGFyZ2V0OworICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBDdXJyZW50IC09IERlbHRhOwotICAgICAgICAgICAgICAgIGlmIChDdXJyZW50IDwgVGFyZ2V0KQotICAgICAgICAgICAgICAgICAgICBDdXJyZW50ID0gVGFyZ2V0OworICAgICAgICAgICAgICAgIGlmIChDdXJyZW50IDwgVGFyZ2V0KSBDdXJyZW50ID0gVGFyZ2V0OwogICAgICAgICAgICAgfQogICAgICAgICAgICAgKmRzdCsrID0gKnNyYysrICogQ3VycmVudDsKICAgICAgICAgICAgIHRlbXBDdXJyZW50W2NoXSA9IEN1cnJlbnQ7CiAgICAgICAgIH0KICAgICB9Ci0gICAgZm9yIChjaCA9IDA7IGNoIDwgTnJDaGFubmVsczsgY2grKykKLSAgICB7CisgICAgZm9yIChjaCA9IDA7IGNoIDwgTnJDaGFubmVsczsgY2grKykgewogICAgICAgICBwdHJJbnN0YW5jZVtjaF0tPkN1cnJlbnQgPSB0ZW1wQ3VycmVudFtjaF07CiAgICAgfQogfQotI2VuZGlmCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19Db3JlX01peFNvZnRfMVN0X0QxNkMzMV9XUkEuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX0NvcmVfTWl4U29mdF8xU3RfRDE2QzMxX1dSQS5jcHAKaW5kZXggNWQ4YWFkYy4uZmM0NjRlNiAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX0NvcmVfTWl4U29mdF8xU3RfRDE2QzMxX1dSQS5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX0NvcmVfTWl4U29mdF8xU3RfRDE2QzMxX1dSQS5jcHAKQEAgLTE4LDcgKzE4LDYgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBJTkNMVURFIEZJTEVTCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQogI2luY2x1ZGUgIkxWQ19NaXhlcl9Qcml2YXRlLmgiCiAjaW5jbHVkZSAiTFZNX01hY3Jvcy5oIgogI2luY2x1ZGUgIlNjYWxhckFyaXRobWV0aWMuaCIKQEAgLTI2LDg2ICsyNSw2MiBAQAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgIEZVTkNUSU9OIExWQ29yZV9NSVhTT0ZUXzFTVF9EMTZDMzFfV1JBCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgTFZDX0NvcmVfTWl4U29mdF8xU3RfRDE2QzMxX1dSQShMVk1peGVyM19GTE9BVF9zdCAqcHRySW5zdGFuY2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S0+UHJpdmF0ZVBhcmFtcyk7CisgICAgTFZNX0ZMT0FUIERlbHRhID0gKExWTV9GTE9BVClwSW5zdGFuY2UtPkRlbHRhOworICAgIExWTV9GTE9BVCBDdXJyZW50ID0gKExWTV9GTE9BVClwSW5zdGFuY2UtPkN1cnJlbnQ7CisgICAgTFZNX0ZMT0FUIFRhcmdldCA9IChMVk1fRkxPQVQpcEluc3RhbmNlLT5UYXJnZXQ7CiAKICAgICBJbkxvb3AgPSAoTFZNX0lOVDE2KShuID4+IDIpOyAvKiBQcm9jZXNzIHBlciA0IHNhbXBsZXMgKi8KICAgICBPdXRMb29wID0gKExWTV9JTlQxNikobiAtIChJbkxvb3AgPDwgMikpOwogCi0gICAgaWYoQ3VycmVudDxUYXJnZXQpewotICAgICAgICBpZiAoT3V0TG9vcCl7CisgICAgaWYgKEN1cnJlbnQgPCBUYXJnZXQpIHsKKyAgICAgICAgaWYgKE91dExvb3ApIHsKKyAgICAgICAgICAgIEN1cnJlbnQgPSBMVk1fQ2xhbXAoQ3VycmVudCArIERlbHRhKTsKKyAgICAgICAgICAgIGlmIChDdXJyZW50ID4gVGFyZ2V0KSBDdXJyZW50ID0gVGFyZ2V0OwogCi0gICAgICAgICAgICBUZW1wID0gQ3VycmVudCArIERlbHRhOwotICAgICAgICAgICAgaWYgKFRlbXAgPiAxLjBmKQotICAgICAgICAgICAgICAgIFRlbXAgPSAxLjBmOwotICAgICAgICAgICAgZWxzZSBpZiAoVGVtcCA8IC0xLjBmKQotICAgICAgICAgICAgICAgIFRlbXAgPSAtMS4wZjsKLQotICAgICAgICAgICAgQ3VycmVudD1UZW1wOwotICAgICAgICAgICAgaWYgKEN1cnJlbnQgPiBUYXJnZXQpCi0gICAgICAgICAgICAgICAgQ3VycmVudCA9IFRhcmdldDsKLQotICAgICAgICAgICAgZm9yIChpaSA9IE91dExvb3A7IGlpICE9IDA7IGlpLS0pewotICAgICAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSooc3JjKyspICogKExWTV9GTE9BVClDdXJyZW50KSk7CisgICAgICAgICAgICBmb3IgKGlpID0gT3V0TG9vcDsgaWkgIT0gMDsgaWktLSkgeworICAgICAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSAqIChzcmMrKykgKiAoTFZNX0ZMT0FUKUN1cnJlbnQpKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCi0gICAgICAgIGZvciAoaWkgPSBJbkxvb3A7IGlpICE9IDA7IGlpLS0peworICAgICAgICBmb3IgKGlpID0gSW5Mb29wOyBpaSAhPSAwOyBpaS0tKSB7CisgICAgICAgICAgICBDdXJyZW50ID0gTFZNX0NsYW1wKEN1cnJlbnQgKyBEZWx0YSk7CiAKLSAgICAgICAgICAgIFRlbXAgPSBDdXJyZW50ICsgRGVsdGE7CisgICAgICAgICAgICBpZiAoQ3VycmVudCA+IFRhcmdldCkgQ3VycmVudCA9IFRhcmdldDsKIAotICAgICAgICAgICAgaWYgKFRlbXAgPiAxLjBmKQotICAgICAgICAgICAgICAgIFRlbXAgPSAxLjBmOwotICAgICAgICAgICAgZWxzZSBpZiAoVGVtcCA8IC0xLjBmKQotICAgICAgICAgICAgICAgIFRlbXAgPSAtMS4wZjsKLQotICAgICAgICAgICAgQ3VycmVudD1UZW1wOwotICAgICAgICAgICAgaWYgKEN1cnJlbnQgPiBUYXJnZXQpCi0gICAgICAgICAgICAgICAgQ3VycmVudCA9IFRhcmdldDsKLQotICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpKihzcmMrKykgKiBDdXJyZW50KSApOwotICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpKihzcmMrKykgKiBDdXJyZW50KSApOwotICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpKihzcmMrKykgKiBDdXJyZW50KSApOwotICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpKihzcmMrKykgKiBDdXJyZW50KSApOworICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpICogKHNyYysrKSAqIEN1cnJlbnQpKTsKKyAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSAqIChzcmMrKykgKiBDdXJyZW50KSk7CisgICAgICAgICAgICAqKGRzdCsrKSA9ICgoKExWTV9GTE9BVCkgKiAoc3JjKyspICogQ3VycmVudCkpOworICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpICogKHNyYysrKSAqIEN1cnJlbnQpKTsKICAgICAgICAgfQotICAgIH0KLSAgICBlbHNlewotICAgICAgICBpZiAoT3V0TG9vcCl7CisgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKE91dExvb3ApIHsKICAgICAgICAgICAgIEN1cnJlbnQgLT0gRGVsdGE7Ci0gICAgICAgICAgICBpZiAoQ3VycmVudCA8IFRhcmdldCkKLSAgICAgICAgICAgICAgICBDdXJyZW50ID0gVGFyZ2V0OworICAgICAgICAgICAgaWYgKEN1cnJlbnQgPCBUYXJnZXQpIEN1cnJlbnQgPSBUYXJnZXQ7CiAKLSAgICAgICAgICAgIGZvciAoaWkgPSBPdXRMb29wOyBpaSAhPSAwOyBpaS0tKXsKLSAgICAgICAgICAgICAgICAqKGRzdCsrKSA9ICgoKExWTV9GTE9BVCkqKHNyYysrKSAqIEN1cnJlbnQpKTsKKyAgICAgICAgICAgIGZvciAoaWkgPSBPdXRMb29wOyBpaSAhPSAwOyBpaS0tKSB7CisgICAgICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpICogKHNyYysrKSAqIEN1cnJlbnQpKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCi0gICAgICAgIGZvciAoaWkgPSBJbkxvb3A7IGlpICE9IDA7IGlpLS0peworICAgICAgICBmb3IgKGlpID0gSW5Mb29wOyBpaSAhPSAwOyBpaS0tKSB7CiAgICAgICAgICAgICBDdXJyZW50IC09IERlbHRhOwotICAgICAgICAgICAgaWYgKEN1cnJlbnQgPCBUYXJnZXQpCi0gICAgICAgICAgICAgICAgQ3VycmVudCA9IFRhcmdldDsKKyAgICAgICAgICAgIGlmIChDdXJyZW50IDwgVGFyZ2V0KSBDdXJyZW50ID0gVGFyZ2V0OwogCi0gICAgICAgICAgICAqKGRzdCsrKSA9ICgoKExWTV9GTE9BVCkqKHNyYysrKSAqIEN1cnJlbnQpKTsKLSAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSooc3JjKyspICogQ3VycmVudCkpOwotICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpKihzcmMrKykgKiBDdXJyZW50KSk7Ci0gICAgICAgICAgICAqKGRzdCsrKSA9ICgoKExWTV9GTE9BVCkqKHNyYysrKSAqIEN1cnJlbnQpKTsKKyAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSAqIChzcmMrKykgKiBDdXJyZW50KSk7CisgICAgICAgICAgICAqKGRzdCsrKSA9ICgoKExWTV9GTE9BVCkgKiAoc3JjKyspICogQ3VycmVudCkpOworICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpICogKHNyYysrKSAqIEN1cnJlbnQpKTsKKyAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSAqIChzcmMrKykgKiBDdXJyZW50KSk7CiAgICAgICAgIH0KICAgICB9Ci0gICAgcEluc3RhbmNlLT5DdXJyZW50PUN1cnJlbnQ7CisgICAgcEluc3RhbmNlLT5DdXJyZW50ID0gQ3VycmVudDsKIH0KIAotI2lmZGVmIFNVUFBPUlRfTUMKIC8qCiAgKiBGVU5DVElPTjogICAgICAgTFZDX0NvcmVfTWl4U29mdF9NY19EMTZDMzFfV1JBCiAgKgpAQCAtMTIzLDIwICs5OCwxNSBAQAogICogIHZvaWQKICAqCiAgKi8KLXZvaWQgTFZDX0NvcmVfTWl4U29mdF9NY19EMTZDMzFfV1JBKExWTWl4ZXIzX0ZMT0FUX3N0ICpwdHJJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICBOckNoYW5uZWxzKQotewotICAgIExWTV9JTlQxNiAgIE91dExvb3A7Ci0gICAgTFZNX0lOVDE2ICAgSW5Mb29wOwotICAgIExWTV9JTlQzMiAgIGlpLCBqajsKLSAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCAgKnBJbnN0YW5jZT0oTWl4X1ByaXZhdGVfRkxPQVRfc3QgKikocHRySW5zdGFuY2UtPlByaXZhdGVQYXJhbXMpOwotICAgIExWTV9GTE9BVCAgIERlbHRhPSAoTFZNX0ZMT0FUKXBJbnN0YW5jZS0+RGVsdGE7Ci0gICAgTFZNX0ZMT0FUICAgQ3VycmVudCA9IChMVk1fRkxPQVQpcEluc3RhbmNlLT5DdXJyZW50OwotICAgIExWTV9GTE9BVCAgIFRhcmdldD0gKExWTV9GTE9BVClwSW5zdGFuY2UtPlRhcmdldDsKLSAgICBMVk1fRkxPQVQgICBUZW1wOwordm9pZCBMVkNfQ29yZV9NaXhTb2Z0X01jX0QxNkMzMV9XUkEoTFZNaXhlcjNfRkxPQVRfc3QqIHB0ckluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgTnJGcmFtZXMsIExWTV9JTlQxNiBOckNoYW5uZWxzKSB7CisgICAgTFZNX0lOVDE2IE91dExvb3A7Cisg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gVGFyZ2V0KQotICAgICAgICAgICAgICAgIEN1cnJlbnQgPSBUYXJnZXQ7CisgICAgICAgICAgICBDdXJyZW50ID0gTFZNX0NsYW1wKEN1cnJlbnQgKyBEZWx0YSk7CisgICAgICAgICAgICBpZiAoQ3VycmVudCA+IFRhcmdldCkgQ3VycmVudCA9IFRhcmdldDsKIAogICAgICAgICAgICAgZm9yIChpaSA9IE91dExvb3A7IGlpICE9IDA7IGlpLS0pIHsKLSAgICAgICAgICAgICAgICBmb3IgKGpqID0gTnJDaGFubmVsczsgamogIT0wOyBqai0tKSB7Ci0gICAgICAgICAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSooc3JjKyspICogKExWTV9GTE9BVClDdXJyZW50KSk7CisgICAgICAgICAgICAgICAgZm9yIChqaiA9IE5yQ2hhbm5lbHM7IGpqICE9IDA7IGpqLS0pIHsKKyAgICAgICAgICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpICogKHNyYysrKSAqIChMVk1fRkxPQVQpQ3VycmVudCkpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfQogCiAgICAgICAgIGZvciAoaWkgPSBJbkxvb3A7IGlpICE9IDA7IGlpLS0pIHsKKyAgICAgICAgICAgIEN1cnJlbnQgPSBMVk1fQ2xhbXAoQ3VycmVudCArIERlbHRhKTsKKyAgICAgICAgICAgIGlmIChDdXJyZW50ID4gVGFyZ2V0KSBDdXJyZW50ID0gVGFyZ2V0OwogCi0gICAgICAgICAgICBUZW1wID0gQ3VycmVudCArIERlbHRhOwotCi0gICAgICAgICAgICBpZiAoVGVtcCA+IDEuMGYpCi0gICAgICAgICAgICAgICAgVGVtcCA9IDEuMGY7Ci0gICAgICAgICAgICBlbHNlIGlmIChUZW1wIDwgLTEuMGYpCi0gICAgICAgICAgICAgICAgVGVtcCA9IC0xLjBmOwotCi0gICAgICAgICAgICBDdXJyZW50PVRlbXA7Ci0gICAgICAgICAgICBpZiAoQ3VycmVudCA+IFRhcmdldCkKLSAgICAgICAgICAgICAgICBDdXJyZW50ID0gVGFyZ2V0OwotCi0gICAgICAgICAgICBmb3IgKGpqID0gTnJDaGFubmVsczsgamogIT0gMCA7IGpqLS0pCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpKihzcmMrKykgKiBDdXJyZW50KSk7Ci0gICAgICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpKihzcmMrKykgKiBDdXJyZW50KSk7CisgICAgICAgICAgICBmb3IgKGpqID0gTnJDaGFubmVsczsgamogIT0gMDsgamotLSkgeworICAgICAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSAqIChzcmMrKykgKiBDdXJyZW50KSk7CisgICAgICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpICogKHNyYysrKSAqIEN1cnJlbnQpKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgIH0KLSAgICBlbHNleworICAgIH0gZWxzZSB7CiAgICAgICAgIGlmIChPdXRMb29wKSB7CiAgICAgICAgICAgICBDdXJyZW50IC09IERlbHRhOwotICAgICAgICAgICAgaWYgKEN1cnJlbnQgPCBUYXJnZXQpCi0gICAgICAgICAgICAgICAgQ3VycmVudCA9IFRhcmdldDsKKyAgICAgICAgICAgIGlmIChDdXJyZW50IDwgVGFyZ2V0KSBDdXJyZW50ID0gVGFyZ2V0OwogCiAgICAgICAgICAgICBmb3IgKGlpID0gT3V0TG9vcDsgaWkgIT0gMDsgaWktLSkgewotICAgICAgICAgICAgICAgIGZvciAoamogPSBOckNoYW5uZWxzOyBqaiAhPTA7IGpqLS0pIHsKLSAgICAgICAgICAgICAgICAgICAgKihkc3QrKykgPSAoKChMVk1fRkxPQVQpKihzcmMrKykgKiAoTFZNX0ZMT0FUKUN1cnJlbnQpKTsKKyAgICAgICAgICAgICAgICBmb3IgKGpqID0gTnJDaGFubmVsczsgamogIT0gMDsgamotLSkgeworICAgICAgICAgICAgICAgICAgICAqKGRzdCsrKSA9ICgoKExWTV9GTE9BVCkgKiAoc3JjKyspICogKExWTV9GTE9BVClDdXJyZW50KSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9CiAKICAgICAgICAgZm9yIChpaSA9IEluTG9vcDsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICAgICAgQ3VycmVudCAtPSBEZWx0YTsKLSAgICAgICAgICAgIGlmIChDdXJyZW50IDwgVGFyZ2V0KQotICAgICAgICAgICAgICAgIEN1cnJlbnQgPSBUYXJnZXQ7CisgICAgICAgICAgICBpZiAoQ3VycmVudCA8IFRhcmdldCkgQ3VycmVudCA9IFRhcmdldDsKIAotICAgICAgICAgICAgZm9yIChqaiA9IE5yQ2hhbm5lbHM7IGpqICE9IDAgOyBqai0tKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSooc3JjKyspICogQ3VycmVudCkpOwotICAgICAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSooc3JjKyspICogQ3VycmVudCkpOworICAgICAgICAgICAgZm9yIChqaiA9IE5yQ2hhbm5lbHM7IGpqICE9IDA7IGpqLS0pIHsKKyAgICAgICAgICAgICAgICAqKGRzdCsrKSA9ICgoKExWTV9GTE9BVCkgKiAoc3JjKyspICogQ3VycmVudCkpOworICAgICAgICAgICAgICAgICooZHN0KyspID0gKCgoTFZNX0ZMT0FUKSAqIChzcmMrKykgKiBDdXJyZW50KSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgcEluc3RhbmNlLT5DdXJyZW50PUN1cnJlbnQ7CisgICAgcEluc3RhbmNlLT5DdXJyZW50ID0gQ3VycmVudDsKIH0KLSNlbmRpZgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhJblNvZnRfRDE2QzMxX1NBVC5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfTWl4SW5Tb2Z0X0QxNkMzMV9TQVQuY3BwCmluZGV4IDJiZWMzYmUuLjI3MGM3ZTAgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhJblNvZnRfRDE2QzMxX1NBVC5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peEluU29mdF9EMTZDMzFfU0FULmNwcApAQCAtMjcsMzkgKzI3LDM1IEBACiAgICBERUZJTklUSU9OUwogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSNkZWZpbmUgVFJVRSAgICAgICAgICAxCi0jZGVmaW5lIEZBTFNFICAgICAgICAgMAorI2RlZmluZSBUUlVFIDEKKyNkZWZpbmUgRkFMU0UgMAogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgRlVOQ1RJT04gTUlYSU5TT0ZUX0QxNkMzMV9TQVQKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBMVkNfTWl4SW5Tb2Z0X0QxNkMzMV9TQVQoTFZNaXhlcjNfMVN0X0ZMT0FUX3N0ICpwdHJJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgbikKLXsKLSAgICBjaGFyICAgICAgICBIYXJkTWl4aW5nID0gVFJVRTsKLSAgICBMVk1fRkxPQVQgICBUYXJnZXRHYWluOwotICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0ICAqcEluc3RhbmNlID0gXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKikocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLlByaXZhdGVQYXJhbXMpOwordm9pZCBMVkNfTWl4SW5Tb2Z0X0QxNkMzMV9TQVQoTFZNaXhlcjNfMVN0X0ZMT0FUX3N0KiBwdHJJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IG4pIHsKKyAgICBjaGFyIEhhcmRNaXhpbmcgPSBUUlVFOworICAgIExWTV9GTE9BVCBUYXJnZXRHYWluOworICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0KiBwSW5zdGFuY2UgPQorICAgICAgICAgICAgKE1peF9Qcml2YXRlX0ZMT0FUX3N0KikocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLlByaXZhdGVQYXJhbXMpOwogCi0gICAgaWYobiA8PSAwKSAgICByZXR1cm47CisgICAgaWYgKG4gPD0gMCkgcmV0dXJuOwogCiAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgICAgIFNPRlQgTUlYSU5HCiAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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XQoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLCBUYXJnZXRHYWluKTsKLSAgICAgICAgfWVsc2V7CisgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAvKiBTb2Z0IG1peGluZyBoYXMgdG8gYmUgYXBwbGllZCAqLwogICAgICAgICAgICAgSGFyZE1peGluZyA9IEZBTFNFOwogICAgICAgICAgICAgTFZDX0NvcmVfTWl4SW5Tb2Z0X0QxNkMzMV9TQVQoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLCBzcmMsIGRzdCwgbik7CkBAIC03MCwxMTEgKzY2LDEyIEBACiAgICAgICAgSEFSRCBNSVhJTkcKICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0gICAgaWYgKEhhcmRNaXhpbmcpewotICAgICAgICBpZiAocEluc3RhbmNlLT5UYXJnZXQgIT0gMCl7IC8qIE5vdGhpbmcgdG8gZG8gaW4gY2FzZSBUYXJnZXQgPSAwICovCi0gICAgICAgICAgICBpZiAoKHBJbnN0YW5jZS0+VGFyZ2V0KSA9PSAxLjBmKXsKLSAgICAgICAgICAgICAgICBBZGQyX1NhdF9GbG9hdChzcmMsIGRzdCwgbik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlewotICAgICAgICAgICAgICAgIE1hYzNzX1NhdF9GbG9hdChzcmMsIChwSW5zdGFuY2UtPlRhcmdldCksIGRzdCwgbik7Ci0gICAgICAgICAgICAgICAgLyogSW4gY2FzZSB0aGUgTFZDb3JlIGZ1bmN0aW9uIHdvdWxkIGhhdmUgY2hhbmdlZCB0aGUgQ3VycmVudCB2YWx1ZSAqLwotICAgICAgICAgICAgICAgIHBJbnN0YW5jZS0+Q3VycmVudCA9IHBJbnN0YW5jZS0+VGFyZ2V0OwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgIENBTEwgQkFDSwotICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSAgICBpZiAocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLkNhbGxiYWNrU2V0KXsKLSAgICAgICAgaWYgKEFic19GbG9hdChwSW5zdGFuY2UtPkN1cnJlbnQgLSBwSW5zdGFuY2UtPlRhcmdldCkgPCBwSW5zdGFuY2UtPkRlbHRhKXsKLSAgICAgICAgICAgIHBJbnN0YW5jZS0+Q3VycmVudCA9IHBJbnN0YW5jZS0+VGFyZ2V0OyAvKiBEaWZmZXJlbmNlIGlzIG5vdCBzaWduaWZpY2FudCBhbnltb3JlLiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFrZSB0aGVtIGVxdWFsLiAqLwotICAgICAgICAgICAgVGFyZ2V0R2FpbiA9IHBJbnN0YW5jZS0+VGFyZ2V0OwotICAgICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldChwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW0sIFRhcmdldEdhaW4pOwotICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLkNhbGxiYWNrU2V0ID0gRkFMU0U7Ci0gICAgICAgICAgICBpZiAocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBDYWxsQmFjayAhPSAwKXsKLSAgICAgICAgICAgICAgICAoKnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2spICggXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBDYWxsYmFja0hhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wR2VuZXJhbFB1cnBvc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tQYXJhbSApOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi19Ci0KLSNpZmRlZiBTVVBQT1JUX01DCi0vKgotICogRlVOQ1RJT046ICAgICAgIExWQ19NaXhJblNvZnRfTWNfRDE2QzMxX1NBVAotICoKLSAqIERFU0NSSVBUSU9OOgotICogIE1peGVyIGZ1bmN0aW9uIHdpdGggc3VwcG9ydCBmb3IgcHJvY2Vzc2luZyBtdWx0aWNoYW5uZWwgaW5wdXQKLSAqCi0gKiBQQVJBTUVURVJTOgotICogIHB0ckluc3RhbmNlICAgIEluc3RhbmNlIHBvaW50ZXIKLSAqICBzcmMgICAgICAgICAgICBTb3VyY2UKLSAqICBkc3QgICAgICAgICAgICBEZXN0aW5hdGlvbgotICogIE5yRnJhbWVzICAgICAgIE51bWJlciBvZiBmcmFtZXMKLSAqICBOckNoYW5uZWxzICAgICBOdW1iZXIgb2YgY2hhbm5lbHMKLSAqCi0gKiBSRVRVUk5TOgotICogIHZvaWQKLSAqCi0gKi8KLXZvaWQgTFZDX01peEluU29mdF9NY19EMTZDMzFfU0FUKExWTWl4ZXIzXzFTdF9GTE9BVF9zdCAqcHRySW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgIE5yRnJhbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgIE5yQ2hhbm5lbHMpCi17Ci0gICAgY2hhciAgICAgICAgSGFyZE1peGluZyA9IFRSVUU7Ci0gICAgTFZNX0ZMT0FUICAgVGFyZ2V0R2FpbjsKLSAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCAgKnBJbnN0YW5jZSA9IFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKE1peF9Qcml2YXRlX0ZMT0FUX3N0ICopKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5Qcml2YXRlUGFyYW1zKTsKLQotICAgIGlmIChOckZyYW1lcyA8PSAwKSAgICByZXR1cm47Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgU09GVCBNSVhJTkcKLSAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIGlmIChwSW5zdGFuY2UtPkN1cnJlbnQgIT0gcEluc3RhbmNlLT5UYXJnZXQpCi0gICAgewotICAgICAgICBpZiAocEluc3RhbmNlLT5EZWx0YSA9PSAxLjBmKSB7Ci0gICAgICAgICAgICBwSW5zdGFuY2UtPkN1cnJlbnQgPSBwSW5zdGFuY2UtPlRhcmdldDsKLSAgICAgICAgICAgIFRhcmdldEdhaW4gPSBwSW5zdGFuY2UtPlRhcmdldDsKLSAgICAgICAgICAgIExWQ19NaXhlcl9TZXRUYXJnZXQoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLCBUYXJnZXRHYWluKTsKLSAgICAgICAgfWVsc2UgaWYgKEFic19GbG9hdChwSW5zdGFuY2UtPkN1cnJlbnQgLSBwSW5zdGFuY2UtPlRhcmdldCkgPCBwSW5zdGFuY2UtPkRlbHRhKSB7Ci0gICAgICAgICAgICBwSW5zdGFuY2UtPkN1cnJlbnQgPSBwSW5zdGFuY2UtPlRhcmdldDsgLyogRGlmZmVyZW5jZSBpcyBub3Qgc2lnbmlmaWNhbnQgYW55bW9yZS4gXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1ha2UgdGhlbSBlcXVhbC4gKi8KLSAgICAgICAgICAgIFRhcmdldEdhaW4gPSBwSW5zdGFuY2UtPlRhcmdldDsKLSAgICAgICAgICAgIExWQ19NaXhlcl9TZXRUYXJnZXQoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLCBUYXJnZXRHYWluKTsKLSAgICAgICAgfWVsc2V7Ci0gICAgICAgICAgICAvKiBTb2Z0IG1peGluZyBoYXMgdG8gYmUgYXBwbGllZCAqLwotICAgICAgICAgICAgSGFyZE1peGluZyA9IEZBTFNFOwotICAgICAgICAgICAgTFZDX0NvcmVfTWl4SW5Tb2Z0X01jX0QxNkMzMV9TQVQoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOckNoYW5uZWxzKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICBIQVJEIE1JWElORwotICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KICAgICBpZiAoSGFyZE1peGluZykgewogICAgICAgICBpZiAocEluc3RhbmNlLT5UYXJnZXQgIT0gMCkgeyAvKiBOb3RoaW5nIHRvIGRvIGluIGNhc2UgVGFyZ2V0ID0gMCAqLwogICAgICAgICAgICAgaWYgKChwSW5zdGFuY2UtPlRhcmdldCkgPT0gMS4wZikgewotICAgICAgICAgICAgICAgIEFkZDJfU2F0X0Zsb2F0KHNyYywgZHN0LCBOckZyYW1lcypOckNoYW5uZWxzKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2V7Ci0gICAgICAgICAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KHNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBJbnN0YW5jZS0+VGFyZ2V0KSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOckZyYW1lcyAqIE5yQ2hhbm5lbHMpOworICAgICAgICAgICAgICAgIEFkZDJfU2F0X0Zsb2F0KHNyYywgZHN0LCBuKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KHNyYywgKHBJbnN0YW5jZS0+VGFyZ2V0KSwgZHN0LCBuKTsKICAgICAgICAgICAgICAgICAvKiBJbiBjYXNlIHRoZSBMVkNvcmUgZnVuY3Rpb24gd291bGQgaGF2ZSBjaGFuZ2VkIHRoZSBDdXJyZW50IHZhbHVlICovCiAgICAgICAgICAgICAgICAgcEluc3RhbmNlLT5DdXJyZW50ID0gcEluc3RhbmNlLT5UYXJnZXQ7CiAgICAgICAgICAgICB9CkBAIC0xOTMsMTUgKzkwLDk3IEBACiAgICAgICAgICAgICBMVkNfTWl4ZXJfU2V0VGFyZ2V0KHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbSwgVGFyZ2V0R2Fpbik7CiAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tTZXQgPSBGQUxTRTsKICAgICAgICAgICAgIGlmIChwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0ucENhbGxCYWNrICE9IDApIHsKLSAgICAgICAgICAgICAgICAoKnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2spIChcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0ucENhbGxiYWNrSGFuZGxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBHZW5lcmFsUHVycG9zZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5DYWxsYmFja1BhcmFtKTsKKyAgICAgICAgICAgICAgICAoKnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2spKAorICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBDYWxsYmFja0hhbmRsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wR2VuZXJhbFB1cnBvc2UsCisgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tQYXJhbSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CisKKy8qCisgKiBGVU5DVElPTjogICAgICAgTFZDX01peEluU29mdF9NY19EMTZDMzFfU0FUCisgKgorICogREVTQ1JJUFRJT046CisgKiAgTWl4ZXIgZnVuY3Rpb24gd2l0aCBzdXBwb3J0IGZvciBwcm9jZXNzaW5nIG11bHRpY2hhbm5lbCBpbnB1dAorICoKKyAqIFBBUkFNRVRFUlM6CisgKiAgcHRySW5zdGFuY2UgICAgSW5zdGFuY2UgcG9pbnRlcgorICogIHNyYyAgICAgICAgICAgIFNvdXJjZQorICogIGRzdCAgICAgICAgICAgIERlc3RpbmF0aW9uCisgKiAgTnJGcmFtZXMgICAgICAgTnVtYmVyIG9mIGZyYW1lcworICogIE5yQ2hhbm5lbHMgICAgIE51bWJlciBvZiBjaGFubmVscworICoKKyAqIFJFVFVSTlM6CisgKiAgdm9pZAorICoKKyAqLwordm9pZCBMVkNfTWl4SW5Tb2Z0X01jX0QxNkMzMV9TQVQoTFZNaXhlcjNfMVN0X0ZMT0FUX3N0KiBwdHJJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IE5yRnJhbWVzLCBMVk1fSU5UMTYgTnJDaGFubmVscykgeworICAgIGNoYXIgSGFyZE1peGluZyA9IFRSVUU7CisgICAgTFZNX0ZMT0FUIFRhcmdldEdhaW47CisgICAgTWl4X1ByaXZhdGVfRkxPQVRfc3QqIHBJbnN0YW5jZSA9CisgICAgICAgICAgICAoTWl4X1ByaXZhdGVfRkxPQVRfc3QqKShwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uUHJpdmF0ZVBhcmFtcyk7CisKKyAgICBpZiAoTnJGcmFtZXMgPD0gMCkgcmV0dXJuOworCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICAgICAgIFNPRlQgTUlYSU5HCisgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKyAgICBpZ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lcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5yQ2hhbm5lbHMpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICAgICAgIEhBUkQgTUlYSU5HCisgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIGlmIChIYXJkTWl4aW5nKSB7CisgICAgICAgIGlmIChwSW5zdGFuY2UtPlRhcmdldCAhPSAwKSB7IC8qIE5vdGhpbmcgdG8gZG8gaW4gY2FzZSBUYXJnZXQgPSAwICovCisgICAgICAgICAgICBpZiAoKHBJbnN0YW5jZS0+VGFyZ2V0KSA9PSAxLjBmKSB7CisgICAgICAgICAgICAgICAgQWRkMl9TYXRfRmxvYXQoc3JjLCBkc3QsIE5yRnJhbWVzICogTnJDaGFubmVscyk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIE1hYzNzX1NhdF9GbG9hdChzcmMsIChwSW5zdGFuY2UtPlRhcmdldCksIGRzdCwgTnJGcmFtZXMgKiBOckNoYW5uZWxzKTsKKyAgICAgICAgICAgICAgICAvKiBJbiBjYXNlIHRoZSBMVkNvcmUgZnVuY3Rpb24gd291bGQgaGF2ZSBjaGFuZ2VkIHRoZSBDdXJyZW50IHZhbHVlICovCisgICAgICAgICAgICAgICAgcEluc3RhbmNlLT5DdXJyZW50ID0gcEluc3RhbmNlLT5UYXJnZXQ7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgICAgICAgQ0FMTCBCQUNLCisgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIGlmIChwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tTZXQpIHsKKyAgICAgICAgaWYgKEFic19GbG9hdChwSW5zdGFuY2UtPkN1cnJlbnQgLSBwSW5zdGFuY2UtPlRhcmdldCkgPCBwSW5zdGFuY2UtPkRlbHRhKSB7CisgICAgICAgICAgICBwSW5zdGFuY2UtPkN1cnJlbnQgPSBwSW5zdGFuY2UtPlRhcmdldDsgLyogRGlmZmVyZW5jZSBpcyBub3Qgc2lnbmlmaWNhbnQgYW55bW9yZS4gXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1ha2UgdGhlbSBlcXVhbC4gKi8KKyAgICAgICAgICAgIFRhcmdldEdhaW4gPSBwSW5zdGFuY2UtPlRhcmdldDsKKyAgICAgICAgICAgIExWQ19NaXhlcl9TZXRUYXJnZXQocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtLCBUYXJnZXRHYWluKTsKKyAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5DYWxsYmFja1NldCA9IEZBTFNFOworICAgICAgICAgICAgaWYgKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2sgIT0gMCkgeworICAgICAgICAgICAgICAgICgqcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBDYWxsQmFjaykoCisgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0ucENhbGxiYWNrSGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBHZW5lcmFsUHVycG9zZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5DYWxsYmFja1BhcmFtKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KIH0KLSNlbmRpZgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhTb2Z0XzFTdF8yaV9EMTZDMzFfU0FULmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhTb2Z0XzFTdF8yaV9EMTZDMzFfU0FULmNwcAppbmRleCAzMTUzYWRhLi5iMGFhMTcyIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfTWl4U29mdF8xU3RfMmlfRDE2QzMxX1NBVC5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peFNvZnRfMVN0XzJpX0QxNkMzMV9TQVQuY3BwCkBAIC0yOSwxNDQgKzI5LDExOCBAQAogICAgREVGSU5JVElPTlMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0jZGVmaW5lIFRSVUUgICAgICAgICAgMQotI2RlZmluZSBGQUxTRSAgICAgICAgIDAKKyNkZWZpbmUgVFJVRSAxCisjZGVmaW5lIEZBTFNFIDAKIAogI2RlZmluZSBBUlJBWV9TSVpFKGEpICgoc2l6ZW9mKGEpKSAvIChzaXplb2YoKihhKSkpKQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gTFZDX01peFNvZnRfMVN0XzJpX0QxNkMzMV9TQVQKKyAgIEZVTkNUSU9OIExWQ19NaXhTb2Z0XzFTdF9NQ19mbG9hdF9TQVQKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotI2lmZGVmIFNVUFBPUlRfTUMKIC8qIFRoaXMgdGhyZXNob2xkIGlzIHVzZWQgdG8gZGVjaWRlIG9uIHRoZSBwcm9jZXNzaW5nIHRvIGJlIGFwcGxpZWQgb24KICAqIGZyb250IGNlbnRlciBhbmQgYmFjayBjZW50ZXIgY2hhbm5lbHMKICAqLwogI2RlZmluZSBMVk1fVk9MX0JBTF9USFIgKDAuMDAwMDE2ZikKLXZvaWQgTFZDX01peFNvZnRfMVN0X01DX2Zsb2F0X1NBVCAoTFZNaXhlcjNfMlN0X0ZMT0FUX3N0ICpwdHJJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgICAgICAgICAgICAgTnJDaGFubmVscywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQzMiAgICAgICAgICAgICBDaE1hc2spCi17Ci0gICAgY2hhciAgICAgICAgSGFyZE1peGluZyA9IFRSVUU7Ci0gICAgTFZNX0ZMT0FUICAgVGFyZ2V0R2FpbjsKLSAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCAgVGFyZ2V0X2xmZSA9IHtMVk1fTUFYRkxPQVQsIExWTV9NQVhGT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CkgeworICAgICAgICBpbnQgbG9vcExpbWl0ID0gKE5yQ2hhbm5lbHMgPT0gRkNDXzEpID8gTnJDaGFubmVscyA6IEZDQ18yOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxvb3BMaW1pdDsgaSsrKSB7CiAgICAgICAgICAgICBwSW5zdGFuY2VbaV0gPSBwTWl4UHJpdkluc3RbaV07CiAgICAgICAgIH0KLSAgICAgICAgZm9yIChpbnQgaSA9IDI7IGkgPCBOckNoYW5uZWxzOyBpKyspCi0gICAgICAgIHsKKyAgICAgICAgZm9yIChpbnQgaSA9IGxvb3BMaW1pdDsgaSA8IE5yQ2hhbm5lbHM7IGkrKykgewogICAgICAgICAgICAgcEluc3RhbmNlW2ldID0gcE1peFByaXZJbnN0WzJdOwogICAgICAgICB9Ci0gICAgfQotICAgIGVsc2UKLSAgICB7CisgICAgfSBlbHNlIHsKICAgICAgICAgLy8gVE9ETzogQ29tYmluZSB3aXRoIHN5c3RlbS9tZWRpYS9hdWRpb191dGlscy9CYWxhbmNlLmNwcAogICAgICAgICAvLyBDb25zdGFudHMgaW4gc3lzdGVtL21lZGlhL2F1ZGlvL2luY2x1ZGUvc3lzdGVtL2F1ZGlvLWJhc2UuaAogICAgICAgICAvLyAnbWl4SW5zdElkeCcgaXMgdXNlZCB0byBtYXAgdGhlIGFwcHJvcHJpYXRlIG1peGVyIGluc3RhbmNlIGZvciBlYWNoIGNoYW5uZWwuCiAgICAgICAgIGNvbnN0IGludCBtaXhJbnN0SWR4W10gPSB7Ci0gICAgICAgICAgICAwLCAvLyBBVURJT19DSEFOTkVMX09VVF9GUk9OVF9MRUZUICAgICAgICAgICAgPSAweDF1LAotICAgICAgICAgICAgMSwgLy8gQVVESU9fQ0hBTk5FTF9PVVRfRlJPTlRfUklHSFQgICAgICAgICAgID0gMHgydSwKLSAgICAgICAgICAgIDIsIC8vIEFVRElPX0NIQU5ORUxfT1VUX0ZST05UX0NFTlRFUiAgICAgICAgICA9IDB4NHUsCi0gICAgICAgICAgICAzLCAvLyBBVURJT19DSEFOTkVMX09VVF9MT1dfRlJFUVVFTkNZICAgICAgICAgPSAweDh1LAotICAgICAgICAgICAgMCwgLy8gQVVESU9fQ0hBTk5FTF9PVVRfQkFDS19MRUZUICAgICAgICAgICAgID0gMHgxMHUsCi0gICAgICAgICAgICAxLCAvLyBBVURJT19DSEFOTkVMX09VVF9CQUNLX1JJR0hUICAgICAgICAgICAgPSAweDIwdSwKLSAgICAgICAgICAgIDAsIC8vIEFVRElPX0NIQU5ORUxfT1VUX0ZST05UX0xFRlRfT0ZfQ0VOVEVSICA9IDB4NDB1LAotICAgICAgICAgICAgMSwgLy8gQVVESU9fQ0hBTk5FTF9PVVRfRlJPTlRfUklHSFRfT0ZfQ0VOVEVSID0gMHg4MHUsCi0gICAgICAgICAgICAyLCAvLyBBVURJT19DSEFOTkVMX09VVF9CQUNLX0NFTlRFUiAgICAgICAgICAgPSAweDEwMHUsCi0gICAgICAgICAgICAwLCAvLyBBVURJT19DSEFOTkVMX09VVF9TSURFX0xFRlQgICAgICAgICAgICAgPSAweDIwMHUsCi0gICAgICAgICAgICAxLCAvLyBBVURJT19DSEFOTkVMX09VVF9TSURFX1JJR0hUICAgICAgICAgICAgPSAweDQwMHUsCi0gICAgICAgICAgICAyLCAvLyBBVURJT19DSEFOTkVMX09VVF9UT1BfQ0VOVEVSICAgICAgICAgICAgPSAweDgwMHUsCi0gICAgICAgICAgICAwLCAvLyBBVURJT19DSEFOTkVMX09VVF9UT1BfRlJPTlRfTEVGVCAgICAgICAgPSAweDEwMDB1LAotICAgICAgICAgICAgMiwgLy8gQVVESU9fQ0hBTk5FTF9PVVRfVE9QX0ZST05UX0NFTlRFUiAgICAgID0gMHgyMDAwdSwKLSAgICAgICAgICAgIDEsIC8vIEFVRElPX0NIQU5ORUxfT1VUX1RPUF9GUk9OVF9SSUdIVCAgICAgICA9IDB4NDAwMHUsCi0gICAgICAgICAgICAwLCAvLyBBVURJT19DSEFOTkVMX09VVF9UT1BfQkFDS19MRUZUICAgICAgICAgPSAweDgwMDB1LAotICAgICAgICAgICAgMiwgLy8gQVVESU9fQ0hBTk5FTF9PVVRfVE9QX0JBQ0tfQ0VOVEVSICAgICAgID0gMHgxMDAwMHUsCi0gICAgICAgICAgICAxLCAvLyBBVURJT19DSEFOTkVMX09VVF9UT1BfQkFDS19SSUdIVCAgICAgICAgPSAweDIwMDAwdSwKLSAgICAgICAgICAgIDAsIC8vIEFVRElPX0NIQU5ORUxfT1VUX1RPUF9TSURFX0xFRlQgICAgICAgICA9IDB4NDAwMDB1LAotICAgICAgICAgICAgMSwgLy8gQVVESU9fQ0hBTk5FTF9PVVRfVE9QX1NJREVfUklHSFQgICAgICAgID0gMHg4MDAwMHUKKyAgICAgICAgICAgICAgICAwLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfRlJPTlRfTEVGVCAgICAgICAgICAgID0gMHgxdSwKKyAgICAgICAgICAgICAgICAxLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfRlJPTlRfUklHSFQgICAgICAgICAgID0gMHgydSwKKyAgICAgICAgICAgICAgICAyLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfRlJPTlRfQ0VOVEVSICAgICAgICAgID0gMHg0dSwKKyAgICAgICAgICAgICAgICAzLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfTE9XX0ZSRVFVRU5DWSAgICAgICAgID0gMHg4dSwKKyAgICAgICAgICAgICAgICAwLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfQkFDS19MRUZUICAgICAgICAgICAgID0gMHgxMHUsCisgICAgICAgICAgICAgICAgMSwgIC8vIEFVRElPX0NIQU5ORUxfT1VUX0JBQ0tfUklHSFQgICAgICAgICAgICA9IDB4MjB1LAorICAgICAgICAgICAgICAgIDAsICAvLyBBVURJT19DSEFOTkVMX09VVF9GUk9OVF9MRUZUX09GX0NFTlRFUiAgPSAweDQwdSwKKyAgICAgICAgICAgICAgICAxLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfRlJPTlRfUklHSFRfT0ZfQ0VOVEVSID0gMHg4MHUsCisgICAgICAgICAgICAgICAgMiwgIC8vIEFVRElPX0NIQU5ORUxfT1VUX0JBQ0tfQ0VOVEVSICAgICAgICAgICA9IDB4MTAwdSwKKyAgICAgICAgICAgICAgICAwLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfU0lERV9MRUZUICAgICAgICAgICAgID0gMHgyMDB1LAorICAgICAgICAgICAgICAgIDEsICAvLyBBVURJT19DSEFOTkVMX09VVF9TSURFX1JJR0hUICAgICAgICAgICAgPSAweDQwMHUsCisgICAgICAgICAgICAgICAgMiwgIC8vIEFVRElPX0NIQU5ORUxfT1VUX1RPUF9DRU5URVIgICAgICAgICAgICA9IDB4ODAwdSwKKyAgICAgICAgICAgICAgICAwLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfVE9QX0ZST05UX0xFRlQgICAgICAgID0gMHgxMDAwdSwKKyAgICAgICAgICAgICAgICAyLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfVE9QX0ZST05UX0NFTlRFUiAgICAgID0gMHgyMDAwdSwKKyAgICAgICAgICAgICAgICAxLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfVE9QX0ZST05UX1JJR0hUICAgICAgID0gMHg0MDAwdSwKKyAgICAgICAgICAgICAgICAwLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfVE9QX0JBQ0tfTEVGVCAgICAgICAgID0gMHg4MDAwdSwKKyAgICAgICAgICAgICAgICAyLCAgLy8gQVVESU9fQ0hBTk5FTF9PVVRfVE9QX0JBQ0tfQ0VOVEVSICAgICAgID0gMHgxMDAwMHUsCisgICAgICAgICAgICAgICAgMSwgIC8vIEFVRElPX0NIQU5ORUxfT1VUX1RPUF9CQUNLX1JJR0hUICAgICAgICA9IDB4MjAwMDB1LAorICAgICAgICAgICAgICAgIDAsICAvLyBBVURJT19DSEFOTkVMX09VVF9UT1BfU0lERV9MRUZUICAg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ICAgICAgICAgICAgeworICAgICAgICAgICAgaWYgKGlkeCA8IGlkeEFyclNpemUpIHsKICAgICAgICAgICAgICAgICBwSW5zdGFuY2VbaV0gPSBwTWl4UHJpdkluc3RbbWl4SW5zdElkeFtpZHhdXTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKKyAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgcEluc3RhbmNlW2ldID0gcE1peFByaXZJbnN0WzJdOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgY2hhbm5lbCAmPSB+KDEgPDwgaWR4KTsKICAgICAgICAgfQogICAgIH0KIAotICAgIGlmIChOckZyYW1lcyA8PSAwKSAgICByZXR1cm47CisgICAgaWYgKE5yRnJhbWVzIDw9IDApIHJldHVybjsKIAogICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgICAgICBTT0ZUIE1JWElORwogICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKICAgICBpZiAoKHBJbnN0YW5jZTEtPkN1cnJlbnQgIT0gcEluc3RhbmNlMS0+VGFyZ2V0KSB8fAotICAgICAgICAocEluc3RhbmNlMi0+Q3VycmVudCAhPSBwSW5zdGFuY2UyLT5UYXJnZXQpKQotICAgIHsKKyAgICAgICAgKHBJbnN0YW5jZTItPkN1cnJlbnQgIT0gcEluc3RhbmNlMi0+VGFyZ2V0KSkgewogICAgICAgICAvLyBUT0RPOiBjb21iaW5lIHNpbWlsYXIgY2hlY2tzIGJlbG93LgotICAgICAgICBpZiAocEluc3RhbmNlMS0+RGVsdGEgPT0gTFZNX01BWEZMT0FUCi0gICAgICAgICAgICAgICAgfHwgQWJzX0Zsb2F0KHBJbnN0YW5jZTEtPkN1cnJlbnQgLSBwSW5zdGFuY2UxLT5UYXJnZXQpIDwgcEluc3RhbmNlMS0+RGVsdGEpCi0gICAgICAgIHsKKyAgICAgICAgaWYgKHBJbnN0YW5jZTEtPkRlbHRhID09IExWTV9NQVhGTE9BVCB8fAorICAgICAgICAgICAgQWJzX0Zsb2F0KHBJbnN0YW5jZTEtPkN1cnJlbnQgLSBwSW5zdGFuY2UxLT5UYXJnZXQpIDwgcEluc3RhbmNlMS0+RGVsdGEpIHsKICAgICAgICAgICAgIC8qIERpZmZlcmVuY2UgaXMgbm90IHNpZ25pZmljYW50IGFueW1vcmUuIE1ha2UgdGhlbSBlcXVhbC4gKi8KICAgICAgICAgICAgIHBJbnN0YW5jZTEtPkN1cnJlbnQgPSBwSW5zdGFuY2UxLT5UYXJnZXQ7CiAgICAgICAgICAgICBUYXJnZXRHYWluID0gcEluc3RhbmNlMS0+VGFyZ2V0OwogICAgICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldCgmKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXSksIFRhcmdldEdhaW4pOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgeworICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgLyogU29mdCBtaXhpbmcgaGFzIHRvIGJlIGFwcGxpZWQgKi8KICAgICAgICAgICAgIEhhcmRNaXhpbmcgPSBGQUxTRTsKICAgICAgICAgfQogCi0gICAgICAgIGlmIChIYXJkTWl4aW5nID09IFRSVUUpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmIChwSW5zdGFuY2UyLT5EZWx0YSA9PSBMVk1fTUFYRkxPQVQKLSAgICAgICAgICAgICAgICAgICAgfHwgQWJzX0Zsb2F0KHBJbnN0YW5jZTItPkN1cnJlbnQgLSBwSW5zdGFuY2UyLT5UYXJnZXQpIDwgcEluc3RhbmNlMi0+RGVsdGEpCi0gICAgICAgICAgICB7CisgICAgICAgIGlmIChIYXJkTWl4aW5nID09IFRSVUUpIHsKKyAgICAgICAgICAgIGlmIChwSW5zdGFuY2UyLT5EZWx0YSA9PSBMVk1fTUFYRkxPQVQgfHwKKyAgICAgICAgICAgICAgICBBYnNfRmxvYXQocEluc3RhbmNlMi0+Q3VycmVudCAtIHBJbnN0YW5jZTItPlRhcmdldCkgPCBwSW5zdGFuY2UyLT5EZWx0YSkgewogICAgICAgICAgICAgICAgIC8qIERpZmZlcmVuY2UgaXMgbm90IHNpZ25pZmljYW50IGFueW1vcmUuIE1ha2UgdGhlbSBlcXVhbC4gKi8KICAgICAgICAgICAgICAgICBwSW5zdGFuY2UyLT5DdXJyZW50ID0gcEluc3RhbmNlMi0+VGFyZ2V0OwogICAgICAgICAgICAgICAgIFRhcmdldEdhaW4gPSBwSW5zdGFuY2UyLT5UYXJnZXQ7CiAgICAgICAgICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldCgmKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXSksIFRhcmdldEdhaW4pOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgeworICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAvKiBTb2Z0IG1peGluZyBoYXMgdG8gYmUgYXBwbGllZCAqLwogICAgICAgICAgICAgICAgIEhhcmRNaXhpbmcgPSBGQUxTRTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCi0gICAgICAgIGlmIChIYXJkTWl4aW5nID09IEZBTFNFKQotICAgICAgICB7Ci0gICAgICAgICAgICAgTFZDX0NvcmVfTWl4U29mdF8xU3RfTUNfZmxvYXRfV1JBICgmcEluc3RhbmNlWzBdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYywgZHN0LCBOckZyYW1lcywgTnJDaGFubmVscyk7CisgICAgICAgIGlmIChIYXJkTWl4aW5nID09IEZBTFNFKSB7CisgICAgICAgICAgICBMVkNfQ29yZV9NaXhTb2Z0XzFTdF9NQ19mbG9hdF9XUkEoJnBJbnN0YW5jZVswXSwgc3JjLCBkc3QsIE5yRnJhbWVzLCBOckNoYW5uZWxzKTsKICAgICAgICAgfQogICAgIH0KIApAQCAtMTc0LDE5ICsxNDgsMTMgQEAKICAgICAgICBIQVJEIE1JWElORwogICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSAgICBpZiAoSGFyZE1peGluZyA9PSBUUlVFKQotICAgIHsKLSAgICAgICAgaWYgKChwSW5zdGFuY2UxLT5UYXJnZXQgPT0gTFZNX01BWEZMT0FUKSAmJiAocEluc3RhbmNlMi0+VGFyZ2V0ID09IExWTV9NQVhGTE9BVCkpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmIChzcmMgIT0gZHN0KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIENvcHlfRmxvYXQoc3JjLCBkc3QsIE5yRnJhbWVzKk5yQ2hhbm5lbHMpOworICAgIGlmIChIYXJkTWl4aW5nID09IFRSVUUpIHsKKyAgICAgICAgaWYgKChwSW5zdGFuY2UxLT5UYXJnZXQgPT0gTFZNX01BWEZMT0FUKSAmJiAocEluc3RhbmNlMi0+VGFyZ2V0ID09IExWTV9NQVhGTE9BVCkpIHsKKyAgICAgICAgICAgIGlmIChzcmMgIT0gZHN0KSB7CisgICAgICAgICAgICAgICAgQ29weV9GbG9hdChzcmMsIGRzdCwgTnJGcmFtZXMgKiBOckNoYW5uZWxzKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIExWQ19Db3JlX01peEhhcmRfMVN0X01DX2Zsb2F0X1NBVCgmKHBJbnN0YW5jZVswXSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYywgZHN0LCBOckZyYW1lcywgTnJDaGFubmVscyk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBMVkNfQ29yZV9NaXhIYXJkXzFTdF9NQ19mbG9hdF9TQVQoJihwSW5zdGFuY2VbMF0pLCBzcmMsIGRzdCwgTnJGcmFtZXMsIE5yQ2hhbm5lbHMpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0xOTQsMTcyICsxNjIsMzQgQEAKICAgICAgICBDQUxMIEJBQ0sKICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0gICAgaWYgKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5DYWxsYmFja1NldCkKLSAgICB7Ci0gICAgICAgIGlmIChBYnNfRmxvYXQocEluc3RhbmNlMS0+Q3VycmVudCAtIHBJbnN0YW5jZTEtPlRhcmdldCkgPCBwSW5zdGFuY2UxLT5EZWx0YSkKLSAgICAgICAgeworICAgIGlmIChwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tTZXQpIHsKKyAgICAgICAgaWYgKEFic19GbG9hdChwSW5zdGFuY2UxLT5DdXJyZW50IC0gcEluc3RhbmNlMS0+VGFyZ2V0KSA8IHBJbnN0YW5jZTEtPkRlbHRhKSB7CiAgICAgICAgICAgICBwSW5zdGFuY2UxLT5DdXJyZW50ID0gcEluc3RhbmNlMS0+VGFyZ2V0OyAvKiBEaWZmZXJlbmNlIGlzIG5vdCBzaWduaWZpY2FudCBhbnltb3JlLiBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYWtlIHRoZW0gZXF1YWwuICovCiAgICAgICAgICAgICBUYXJnZXRHYWluID0gcEluc3RhbmNlMS0+VGFyZ2V0OwogICAgICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldCgmcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLCBUYXJnZXRHYWluKTsKICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5DYWxsYmFja1NldCA9IEZBTFNFOwotICAgICAgICAgICAgaWYgKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2sgIT0gMCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAoKnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2spIChcCi0gICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbGJhY2tIYW5kbGUsCi0gICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wR2VuZXJhbFB1cnBvc2UsCi0gICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5DYWxsYmFja1BhcmFtKTsKKyAgICAgICAgICAgIGlmIChwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0ucENhbGxCYWNrICE9IDApIHsKKyAgICAgICAgICAgICAgICAoKnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2spKAorICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBDYWxsYmFja0hhbmRsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wR2VuZXJhbFB1cnBvc2UsCisgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tQYXJhbSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgaWYgKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXS5DYWxsYmFja1NldCkKLSAgICB7Ci0gICAgICAgIGlmIChBYnNfRmxvYXQocEluc3RhbmNlMi0+Q3VycmVudCAtIHBJbnN0YW5jZTItPlRhcmd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0+TWl4ZXJTdHJlYW1bMV0uQ2FsbGJhY2tQYXJhbSk7CisgICAgICAgICAgICBpZiAocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdLnBDYWxsQmFjayAhPSAwKSB7CisgICAgICAgICAgICAgICAgKCpwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMV0ucENhbGxCYWNrKSgKKyAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXS5wQ2FsbGJhY2tIYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMV0ucEdlbmVyYWxQdXJwb3NlLAorICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdLkNhbGxiYWNrUGFyYW0pOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQogfQotI2VuZGlmCi12b2lkIExWQ19NaXhTb2Z0XzFTdF8yaV9EMTZDMzFfU0FUKCBMVk1peGVyM18yU3RfRkxPQVRfc3QgKnB0ckluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICAgICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICBuKQotewotICAgIGNoYXIgICAgICAgIEhhcmRNaXhpbmcgPSBUUlVFOwotICAgIExWTV9GTE9BVCAgIFRhcmdldEdhaW47Ci0gICAgTWl4X1ByaXZhdGVfRkxPQVRfc3QgICpwSW5zdGFuY2UxID0gXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKE1peF9Qcml2YXRlX0ZMT0FUX3N0ICopKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5Qcml2YXRlUGFyYW1zKTsKLSAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCAgKnBJbnN0YW5jZTIgPSBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKikocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdLlByaXZhdGVQYXJhbXMpOwotCi0gICAgaWYobiA8PSAwKSAgICByZXR1cm47Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgU09GVCBNSVhJTkcKLSAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIGlmICgocEluc3RhbmNlMS0+Q3VycmVudCAhPSBwSW5zdGFuY2UxLT5UYXJnZXQpIHx8IChwSW5zdGFuY2UyLT5DdXJyZW50ICE9IHBJbnN0YW5jZTItPlRhcmdldCkpCi0gICAgewotICAgICAgICBpZihwSW5zdGFuY2UxLT5EZWx0YSA9PSAxLjBmKQotICAgICAgICB7Ci0gICAgICAgICAgICBwSW5zdGFuY2UxLT5DdXJyZW50ID0gcEluc3RhbmNlMS0+VGFyZ2V0OwotICAgICAgICAgICAgVGFyZ2V0R2FpbiA9IHBJbnN0YW5jZTEtPlRhcmdldDsKLSAgICAgICAgICAgIExWQ19NaXhlcl9TZXRUYXJnZXQoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLCBUYXJnZXRHYWluKTsKLSAgICAgICAgfQotICAgICAgICBlbHNlIGlmIChBYnNfRmxvYXQocEluc3RhbmNlMS0+Q3VycmVudCAtIHBJbnN0YW5jZTEtPlRhcmdldCkgPCBwSW5zdGFuY2UxLT5EZWx0YSkKLSAgICAgICAgewotICAgICAgICAgICAgcEluc3RhbmNlMS0+Q3VycmVudCA9IHBJbnN0YW5jZTEtPlRhcmdldDsgLyogRGlmZmVyZW5jZSBpcyBub3Qgc2lnbmlmaWNhbnQgYW55bW9yZS4gXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFrZSB0aGVtIGVxdWFsLiAqLwotICAgICAgICAgICAgVGFyZ2V0R2FpbiA9IHBJbnN0YW5jZTEtPlRhcmdldDsKLSAgICAgICAgICAgIExWQ19NaXhlcl9TZXRUYXJnZXQoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLCBUYXJnZXRHYWluKTsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qIFNvZnQgbWl4aW5nIGhhcyB0byBiZSBhcHBsaWVkICovCi0gICAgICAgICAgICBIYXJkTWl4aW5nID0gRkFMU0U7Ci0gICAgICAgIH0KLQotICAgICAgICBpZihIYXJkTWl4aW5nID09IFRSVUUpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmKHBJbnN0YW5jZTItPkRlbHRhID09IDEuMGYpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgcEluc3RhbmNlMi0+Q3VycmVudCA9IHBJbnN0YW5jZTItPlRhcmdldDsKLSAgICAgICAgICAgICAgICBUYXJnZXRHYWluID0gcEluc3RhbmNlMi0+VGFyZ2V0OwotICAgICAgICAgICAgICAgIExWQ19NaXhlcl9TZXRUYXJnZXQoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMV0pLCBUYXJnZXRHYWluKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgaWYgKEFic19GbG9hdChwSW5zdGFuY2UyLT5DdXJyZW50IC0gcEluc3RhbmNlMi0+VGFyZ2V0KSA8IHBJbnN0YW5jZTItPkRlbHRhKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHBJbnN0YW5jZTItPkN1cnJlbnQgPSBwSW5zdGFuY2UyLT5UYXJnZXQ7IC8qIERpZmZlcmVuY2UgaXMgbm90IHNpZ25pZmljYW50IGFueW1vcmUuIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYWtlIHRoZW0gZXF1YWwuICovCi0gICAgICAgICAgICAgICAgVGFyZ2V0R2FpbiA9IHBJbnN0YW5jZTItPlRhcmdldDsKLSAgICAgICAgICAgICAgICBMVkNfTWl4ZXJfU2V0VGFyZ2V0KCYocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdKSwgVGFyZ2V0R2Fpbik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLyogU29mdCBtaXhpbmcgaGFzIHRvIGJlIGFwcGxpZWQgKi8KLSAgICAgICAgICAgICAgICBIYXJkTWl4aW5nID0gRkFMU0U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZihIYXJkTWl4aW5nID09IEZBTFNFKQotICAgICAgICB7Ci0gICAgICAgICAgICAgTFZDX0NvcmVfTWl4U29mdF8xU3RfMmlfRDE2QzMxX1dSQSggJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMsIGRzdCwgbik7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgSEFSRCBNSVhJTkcKLSAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0gICAgaWYgKEhhcmRNaXhpbmcpCi0gICAgewotICAgICAgICBpZiAoKHBJbnN0YW5jZTEtPlRhcmdldCA9PSAxLjBmKSAmJiAocEluc3RhbmNlMi0+VGFyZ2V0ID09IDEuMGYpKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZihzcmMgIT0gZHN0KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIENvcHlfRmxvYXQoc3JjLCBkc3QsIG4pOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgTFZDX0NvcmVfTWl4SGFyZF8xU3RfMmlfRDE2QzMxX1NBVCgmKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjLCBkc3QsIG4pOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgIENBTEwgQkFDSwotICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSAgICBpZiAocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLkNhbGxiYWNrU2V0KQotICAgIHsKLSAgICAgICAgaWYgKEFic19GbG9hdChwSW5zdGFuY2UxLT5DdXJyZW50IC0gcEluc3RhbmNlMS0+VGFyZ2V0KSA8IHBJbnN0YW5jZTEtPkRlbHRhKQotICAgICAgICB7Ci0gICAgICAgICAgICBwSW5zdGFuY2UxLT5DdXJyZW50ID0gcEluc3RhbmNlMS0+VGFyZ2V0OyAvKiBEaWZmZXJlbmNlIGlzIG5vdCBzaWduaWZpY2FudCBhbnltb3JlLiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYWtlIHRoZW0gZXF1YWwuICovCi0gICAgICAgICAgICBUYXJnZXRHYWluID0gcEluc3RhbmNlMS0+VGFyZ2V0OwotICAgICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldCgmcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLCBUYXJnZXRHYWluKTsKLSAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5DYWxsYmFja1NldCA9IEZBTFNFOwotICAgICAgICAgICAgaWYgKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2sgIT0gMCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAoKnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2spICggXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBDYWxsYmFja0hhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wR2VuZXJhbFB1cnBvc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tQYXJhbSApOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotICAgIGlmIChwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMV0uQ2FsbGJhY2tTZXQpCi0gICAgewotICAgICAgICBpZiAoQWJzX0Zsb2F0KHBJbnN0YW5jZTItPkN1cnJlbnQgLSBwSW5zdGFuY2UyLT5UYXJnZXQpIDwgcEluc3RhbmNlMi0+RGVsdGEpCi0gICAgICAgIHsKLSAgICAgICAgICAgIHBJbnN0YW5jZTItPkN1cnJlbnQgPSBwSW5zdGFuY2UyLT5UYXJnZXQ7IC8qIERpZmZlcmVuY2UgaXMgbm90IHNpZ25pZmljYW50IGFueW1vcmUuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYWtlIHRoZW0gZXF1YWwuICovCi0gICAgICAgICAgICBUYXJnZXRHYWluID0gcEluc3RhbmNlMi0+VGFyZ2V0OwotICAgICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldCgmcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdLCBUYXJnZXRHYWluKTsKLSAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXS5DYWxsYmFja1NldCA9IEZBTFNFOwotICAgICAgICAgICAgaWYgKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXS5wQ2FsbEJhY2sgIT0gMCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAoKnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXS5wQ2FsbEJhY2spICgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXS5wQ2FsbGJhY2tIYW5kbGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMV0ucEdlbmVyYWxQdXJwb3NlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdLkNhbGxiYWNrUGFyYW0gKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLX0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peFNvZnRfMVN0X0QxNkMzMV9TQVQuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peFNvZnRfMVN0X0QxNkMzMV9TQVQuY3BwCmluZGV4IDRkMjI5ZGEuLjVhNjdiZGEgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhTb2Z0XzFTdF9EMTZDMzFfU0FULmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfTWl4U29mdF8xU3RfRDE2QzMxX1NBVC5jcHAKQEAgLTE5LDYgKzE5LDcgQEAKICAgIElOQ0xVREUgRklMRVMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCisjaW5jbHVkZSA8c3RyaW5nLmg+CiAjaW5jbHVkZSAiTFZDX01peGVyX1ByaXZhdGUuaCIKICNpbmNsdWRlICJWZWN0b3JBcml0aG1ldGljLmgiCiAjaW5jbHVkZSAiU2NhbGFyQXJpdGhtZXRpYy5oIgpAQCAtMjcsMzkgKzI4LDM1IEBACiAgICBERUZJTklUSU9OUwogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSNkZWZpbmUgVFJVRSAgICAgICAgICAxCi0jZGVmaW5lIEZBTFNFICAgICAgICAgMAorI2RlZmluZSBUUlVFIDEKKyNkZWZpbmUgRkFMU0UgMAogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgRlVOQ1RJT04gTFZNaXhlcjNfTUlYU09GVF8xU1RfRDE2QzMxX1NBVAogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIExWQ19NaXhTb2Z0XzFTdF9EMTZDMzFfU0FUKCBMVk1peGVyM18xU3RfRkxPQVRfc3QgKnB0ckluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAgICAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICBuKQotewotICAgIGNoYXIgICAgICAgIEhhcmRNaXhpbmcgPSBUUlVFOwotICAgIExWTV9GTE9BVCAgIFRhcmdldEdhaW47Ci0gICAgTWl4X1ByaXZhdGVfRkxPQVRfc3QgICpwSW5zdGFuY2UgPSBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgIChNaXhfUHJpdmF0ZV9GTE9BVF9zdCAqKShwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uUHJpdmF0ZVBhcmFtcyk7Cit2b2lkIExWQ19NaXhTb2Z0XzFTdF9EMTZDMzFfU0FUKExWTWl4ZXIzXzFTdF9GTE9BVF9zdCogcHRySW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IG4pIHsKKyAgICBjaGFyIEhhcmRNaXhpbmcgPSBUUlVFOworICAgIExWTV9GTE9BVCBUYXJnZXRHYWluOworICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0KiBwSW5zdGFuY2UgPQorICAgICAgICAgICAgKE1peF9Qcml2YXRlX0ZMT0FUX3N0KikocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLlByaXZhdGVQYXJhbXMpOwogCi0gICAgaWYobiA8PSAwKSAgICByZXR1cm47CisgICAgaWYgKG4gPD0gMCkgcmV0dXJuOwogCiAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgICAgIFNPRlQgTUlYSU5HCiAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICBpZiAocEluc3RhbmNlLT5DdXJyZW50ICE9IHBJbnN0YW5jZS0+VGFyZ2V0KQotICAgIHsKLSAgICAgICAgaWYocEluc3RhbmNlLT5EZWx0YSA9PSAxLjBmKXsKKyAgICBpZiAocEluc3RhbmNlLT5DdXJyZW50ICE9IHBJbnN0YW5jZS0+VGFyZ2V0KSB7CisgICAgICAgIGlmIChwSW5zdGFuY2UtPkRlbHRhID09IDEuMGYpIHsKICAgICAgICAgICAgIHBJbnN0YW5jZS0+Q3VycmVudCA9IHBJbnN0YW5jZS0+VGFyZ2V0OwogICAgICAgICAgICAgVGFyZ2V0R2FpbiA9IHBJbnN0YW5jZS0+VGFyZ2V0OwogICAgICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldCgmKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXSksIFRhcmdldEdhaW4pOwotICAgICAgICB9ZWxzZSBpZiAoQWJzX0Zsb2F0KHBJbnN0YW5jZS0+Q3VycmVudCAtIHBJbnN0YW5jZS0+VGFyZ2V0KSA8IHBJbnN0YW5jZS0+RGVsdGEpeworICAgICAgICB9IGVsc2UgaWYgKEFic19GbG9hdChwSW5zdGFuY2UtPkN1cnJlbnQgLSBwSW5zdGFuY2UtPlRhcmdldCkgPCBwSW5zdGFuY2UtPkRlbHRhKSB7CiAgICAgICAgICAgICBwSW5zdGFuY2UtPkN1cnJlbnQgPSBwSW5zdGFuY2UtPlRhcmdldDsgLyogRGlmZmVyZW5jZSBpcyBub3Qgc2lnbmlmaWNhbnQgYW55bW9yZS4gXAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1ha2UgdGhlbSBlcXVhbC4gKi8KICAgICAgICAgICAgIFRhcmdldEdhaW4gPSBwSW5zdGFuY2UtPlRhcmdldDsKICAgICAgICAgICAgIExWQ19NaXhlcl9TZXRUYXJnZXQoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLCBUYXJnZXRHYWluKTsKLSAgICAgICAgfWVsc2V7CisgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAvKiBTb2Z0IG1peGluZyBoYXMgdG8gYmUgYXBwbGllZCAqLwogICAgICAgICAgICAgSGFyZE1peGluZyA9IEZBTFNFOwogICAgICAgICAgICAgTFZDX0NvcmVfTWl4U29mdF8xU3RfRDE2QzMxX1dSQSgmKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXSksIHNyYywgZHN0LCBuKTsKQEAgLTcwLDM5ICs2NywzNyBAQAogICAgICAgIEhBUkQgTUlYSU5HCiAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotICAgIGlmIChIYXJkTWl4aW5nKXsKKyAgICBpZiAoSGFyZE1peGluZykgewogICAgICAgICBpZiAocEluc3RhbmNlLT5UYXJnZXQgPT0gMCkKLSAgICAgICAgICAgIExvYWRDb25zdF9GbG9hdCgwLjAsIGRzdCwgbik7CisgICAgICAgICAgICBtZW1zZXQoZHN0LCAwLCBuICogc2l6ZW9mKCpkc3QpKTsKICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICBpZiAoKHBJbnN0YW5jZS0+VGFyZ2V0KSAhPSAxLjBmKQogICAgICAgICAgICAgICAgIE11bHQzc19GbG9hdChzcmMsIChwSW5zdGFuY2UtPlRhcmdldCksIGRzdCwgbik7Ci0gICAgICAgICAgICBlbHNlIGlmKHNyYyAhPSBkc3QpCisgICAgICAgICAgICBlbHNlIGlmIChzcmMgIT0gZHN0KQogICAgICAgICAgICAgICAgIENvcHlfRmxvYXQoc3JjLCBkc3QsIG4pOwogICAgICAgICB9Ci0KICAgICB9CiAKICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICAgICAgQ0FMTCBCQUNLCiAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotICAgIGlmIChwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tTZXQpewotICAgICAgICBpZiAoQWJzX0Zsb2F0KHBJbnN0YW5jZS0+Q3VycmVudCAtIHBJbnN0YW5jZS0+VGFyZ2V0KSA8IHBJbnN0YW5jZS0+RGVsdGEpeworICAgIGlmIChwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tTZXQpIHsKKyAgICAgICAgaWYgKEFic19GbG9hdChwSW5zdGFuY2UtPkN1cnJlbnQgLSBwSW5zdGFuY2UtPlRhcmdldCkgPCBwSW5zdGFuY2UtPkRlbHRhKSB7CiAgICAgICAgICAgICBwSW5zdGFuY2UtPkN1cnJlbnQgPSBwSW5zdGFuY2UtPlRhcmdldDsgLyogRGlmZmVyZW5jZSBpcyBub3Qgc2lnbmlmaWNhbnQgYW55bW9yZS4gXAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1ha2UgdGhlbSBlcXVhbC4gKi8KICAgICAgICAgICAgIFRhcmdldEdhaW4gPSBwSW5zdGFuY2UtPlRhcmdldDsKICAgICAgICAgICAgIExWQ19NaXhlcl9TZXRUYXJnZXQocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtLCBUYXJnZXRHYWluKTsKICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5DYWxsYmFja1NldCA9IEZBTFNFOwotICAgICAgICAgICAgaWYgKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2sgIT0gMCl7Ci0gICAgICAgICAgICAgICAgKCpwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0ucENhbGxCYWNrKSAoIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbGJhY2tIYW5kbGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0ucEdlbmVyYWxQdXJwb3NlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLkNhbGxiYWNrUGFyYW0gKTsKKyAgICAgICAgICAgIGlmIChwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0ucENhbGxCYWNrICE9IDApIHsKKyAgICAgICAgICAgICAgICAoKnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbEJhY2spKAorICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBDYWxsYmFja0hhbmRsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wR2VuZXJhbFB1cnBvc2UsCisgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tQYXJhbSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiB9Ci0jaWZkZWYgU1VQUE9SVF9NQwogLyoKICAqIEZVTkNUSU9OOiAgICAgICBMVkNfTWl4U29mdF9NY19EMTZDMzFfU0FUCiAgKgpAQCAtMTIwLDQwICsxMTUsMzIgQEAKICAqICB2b2lkCiAgKgogICovCi12b2lkIExWQ19NaXhTb2Z0X01jX0QxNkMzMV9TQVQoTFZNaXhlcjNfMVN0X0ZMT0FUX3N0ICpwdHJJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgTnJDaGFubmVscykKLXsKLSAgICBjaGFyICAgICAgICBIYXJkTWl4aW5nID0gVFJVRTsKLSAgICBMVk1fRkxPQVQgICBUYXJnZXRHYWluOwotICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0ICAqcEluc3RhbmNlID0gXAotICAgICAgICAgICAgICAgICAgICAgICAgICAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKikocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLlByaXZhdGVQYXJhbXMpOwordm9pZCBMVkNfTWl4U29mdF9NY19EMTZDMzFfU0FUKExWTWl4ZXIzXzFTdF9GTE9BVF9zdCogcHRySW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgTnJGcmFtZXMsIExWTV9JTlQxNiBOckNoYW5uZWxzKSB7CisgICAgY2hhciBIYXJkTWl4aW5nID0gVFJVRTsKKyAgICBMVk1fRkxPQVQgVGFyZ2V0R2FpbjsKKyAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCogcEluc3RhbmNlID0KKyAgICAgICAgICAgIChNaXhfUHJpdmF0ZV9GTE9BVF9zdCopKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5Qcml2YXRlUGFyYW1zKTsKIAotICAgIGlmIChOckZyYW1lcyA8PSAwKSAgICByZXR1cm47CisgICAgaWYgKE5yRnJhbWVzIDw9IDApIHJldHVybjsKIAogICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgICAgICBTT0ZUIE1JWElORwogICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgaWYgKHBJbnN0YW5jZS0+Q3VycmVudCAhPSBwSW5zdGFuY2UtPlRhcmdldCkKLSAgICB7CisgICAgaWYgKHBJbnN0YW5jZS0+Q3VycmVudCAhPSBwSW5zdGFuY2UtPlRhcmdldCkgewogICAgICAgICBpZiAocEluc3RhbmNlLT5EZWx0YSA9PSAxLjBmKSB7CiAgICAgICAgICAgICBwSW5zdGFuY2UtPkN1cnJlbnQgPSBwSW5zdGFuY2UtPlRhcmdldDsKICAgICAgICAgICAgIFRhcmdldEdhaW4gPSBwSW5zdGFuY2UtPlRhcmdldDsKICAgICAgICAgICAgIExWQ19NaXhlcl9TZXRUYXJnZXQoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLCBUYXJnZXRHYWluKTsKLSAgICAgICAgfWVsc2UgaWYgKEFic19GbG9hdChwSW5zdGFuY2UtPkN1cnJlbnQgLSBwSW5zdGFuY2UtPlRhcmdldCkgPCBwSW5zdGFuY2UtPkRlbHRhKSB7CisgICAgICAgIH0gZWxzZSBpZiAoQWJzX0Zsb2F0KHBJbnN0YW5jZS0+Q3VycmVudCAtIHBJbnN0YW5jZS0+VGFyZ2V0KSA8IHBJbnN0YW5jZS0+RGVsdGEpIHsKICAgICAgICAgICAgIHBJbnN0YW5jZS0+Q3VycmVudCA9IHBJbnN0YW5jZS0+VGFyZ2V0OyAvKiBEaWZmZXJlbmNlIGlzIG5vdCBzaWduaWZpY2FudCBhbnltb3JlLiBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFrZSB0aGVtIGVxdWFsLiAqLwogICAgICAgICAgICAgVGFyZ2V0R2FpbiA9IHBJbnN0YW5jZS0+VGFyZ2V0OwogICAgICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldCgmKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXSksIFRhcmdldEdhaW4pOwotICAgICAgICB9ZWxzZXsKKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIC8qIFNvZnQgbWl4aW5nIGhhcyB0byBiZSBhcHBsaWVkICovCiAgICAgICAgICAgICBIYXJkTWl4aW5nID0gRkFMU0U7Ci0gICAgICAgICAgICBMVkNfQ29yZV9NaXhTb2Z0X01jX0QxNkMzMV9XUkEoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTnJGcmFtZXMsCisgICAgICAgICAgICBMVkNfQ29yZV9NaXhTb2Z0X01jX0QxNkMzMV9XUkEoJihwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLCBzcmMsIGRzdCwgTnJGcmFtZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTnJDaGFubmVscyk7CiAgICAgICAgIH0KICAgICB9CkBAIC0xNjQsMTQgKzE1MSwxMyBAQAogCiAgICAgaWYgKEhhcmRNaXhpbmcpIHsKICAgICAgICAgaWYgKHBJbnN0YW5jZS0+VGFyZ2V0ID09IDApCi0gICAgICAgICAgICBMb2FkQ29uc3RfRmxvYXQoMC4wLCBkc3QsIE5yRnJhbWVzICogTnJDaGFubmVscyk7CisgICAgICAgICAgICBtZW1zZXQoZHN0LCAwLCBOckZyYW1lcyAqIE5yQ2hhbm5lbHMgKiBzaXplb2YoKmRzdCkpOwogICAgICAgICBlbHNlIHsKICAgICAgICAgICAgIGlmICgocEluc3RhbmNlLT5UYXJnZXQpICE9IDEuMGYpCiAgICAgICAgICAgICAgICAgTXVsdDNzX0Zsb2F0KHNyYywgKHBJbnN0YW5jZS0+VGFyZ2V0KSwgZHN0LCBOckZyYW1lcyAqIE5yQ2hhbm5lbHMpOwogICAgICAgICAgICAgZWxzZSBpZiAoc3JjICE9IGRzdCkKICAgICAgICAgICAgICAgICBDb3B5X0Zsb2F0KHNyYywgZHN0LCBOckZyYW1lcyAqIE5yQ2hhbm5lbHMpOwogICAgICAgICB9Ci0KICAgICB9CiAKICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCkBAIC0xODYsMTUgKzE3MiwxMyBAQAogICAgICAgICAgICAgTFZDX01peGVyX1NldFRhcmdldChwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW0sIFRhcmdldEdhaW4pOwogICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLkNhbGxiYWNrU2V0ID0gRkFMU0U7CiAgICAgICAgICAgICBpZiAocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBDYWxsQmFjayAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgKCpwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0ucENhbGxCYWNrKSAoXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLnBDYWxsYmFja0hhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wR2VuZXJhbFB1cnBvc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tQYXJhbSk7CisgICAgICAgICAgICAgICAgKCpwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0ucENhbGxCYWNrKSgKKyAgICAgICAgICAgICAgICAgICAgICAgIHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5wQ2FsbGJhY2tIYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICBwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0ucEdlbmVyYWxQdXJwb3NlLAorICAgICAgICAgICAgICAgICAgICAgICAgcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLkNhbGxiYWNrUGFyYW0pOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQogfQogCi0jZW5kaWYKLQogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfTWl4U29mdF8yU3RfRDE2QzMxX1NBVC5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfTWl4U29mdF8yU3RfRDE2QzMxX1NBVC5jcHAKaW5kZXggNTRhYjc5ZC4uODgyYThjZSAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peFNvZnRfMlN0X0QxNkMzMV9TQVQuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhTb2Z0XzJTdF9EMTZDMzFfU0FULmNwcApAQCAtMjUsNDkgKzI1LDM5IEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgRlVOQ1RJT04gTFZDX01peFNvZnRfMlN0X0QxNkMzMV9TQVQuYwogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIExWQ19NaXhTb2Z0XzJTdF9EMTZDMzFfU0FUKExWTWl4ZXIzXzJTdF9GTE9BVF9zdCAqcHRySW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqc3JjMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICpzcmMyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgIG4pCi17Ci0gICAgTWl4X1ByaXZhdGVfRkxPQVRfc3QgICpwSW5zdGFuY2UxID0gXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKikocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLlByaXZhdGVQYXJhbXMpOwotICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0ICAqcEluc3RhbmNlMiA9IFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKE1peF9Qcml2YXRlX0ZMT0FUX3N0ICopKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXS5Qcml2YXRlUGFyYW1zKTsKK3ZvaWQgTFZDX01peFNvZnRfMlN0X0QxNkMzMV9TQVQoTFZNaXhlcjNfMlN0X0ZMT0FUX3N0KiBwdHJJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQqIHNyYzIsIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgbikgeworICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0KiBwSW5zdGFuY2UxID0KKyAgICAgICAgICAgIChNaXhfUHJpdmF0ZV9GTE9BVF9zdCopKHB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXS5Qcml2YXRlUGFyYW1zKTsKKyAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCogcEluc3RhbmNlMiA9CisgICAgICAgICAgICAoTWl4X1ByaXZhdGVfRkxPQVRfc3QqKShwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMV0uUHJpdmF0ZVBhcmFtcyk7CiAKLSAgICBpZihuIDw9IDApICAgIHJldHVybjsKKyAgICBpZiAobiA8PSAwKSByZXR1cm47CiAKICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICAgICAgU09GVCBNSVhJTkcKICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIGlmICgocEluc3RhbmNlMS0+Q3VycmVudCA9PSBwSW5zdGFuY2UxLT5UYXJnZXQpICYmIChwSW5zdGFuY2UxLT5DdXJyZW50ID09IDApKXsKLSAgICAgICAgTFZDX01peFNvZnRfMVN0X0QxNkMzMV9TQVQoKExWTWl4ZXIzXzFTdF9GTE9BVF9zdCAqKSgmcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYzIsIGRzdCwgbik7Ci0gICAgfQotICAgIGVsc2UgaWYgKChwSW5zdGFuY2UyLT5DdXJyZW50ID09IHBJbnN0YW5jZTItPlRhcmdldCkgJiYgKHBJbnN0YW5jZTItPkN1cnJlbnQgPT0gMCkpewotICAgICAgICBMVkNfTWl4U29mdF8xU3RfRDE2QzMxX1NBVCgoTFZNaXhlcjNfMVN0X0ZMT0FUX3N0ICopKCZwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjMSwgZHN0LCBuKTsKLSAgICB9Ci0gICAgZWxzZSBpZiAoKHBJbnN0YW5jZTEtPkN1cnJlbnQgIT0gcEluc3RhbmNlMS0+VGFyZ2V0KSB8fCBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocEluc3RhbmNlMi0+Q3VycmVudCAhPSBwSW5zdGFuY2UyLT5UYXJnZXQpKQotICAgIHsKLSAgICAgICAgTFZDX01peFNvZnRfMVN0X0QxNkMzMV9TQVQoKExWTWl4ZXIzXzFTdF9GTE9BVF9zdCAqKSgmcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjMSwgZHN0LCBuKTsKLSAgICAgICAgTFZDX01peEluU29mdF9EMTZDMzFfU0FUKChMVk1peGVyM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sIG4pOworICAgICAgICBMVkNfTWl4SW5Tb2Z0X0QxNkMzMV9TQVQoKExWTWl4ZXIzXzFTdF9GTE9BVF9zdCopKCZwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMV0pLCBzcmMyLCBkc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKTsKKyAgICB9IGVsc2UgewogICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICAgICAgICAgIEhBUkQgTUlYSU5HCiAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgIExWQ19Db3JlX01peEhhcmRfMlN0X0QxNkMzMV9TQVQoICZwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYzEsIHNyYzIsIGRzdCwgbik7CisgICAgICAgIExWQ19Db3JlX01peEhhcmRfMlN0X0QxNkMzMV9TQVQoJnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXSwgJnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMxLCBzcmMyLCBkc3QsIG4pOwogICAgIH0KIH0KIAotI2lmZGVmIFNVUFBPUlRfTUMKIC8qCiAgKiBGVU5DVElPTjogICAgICAgTFZDX01peFNvZnRfMk1jX0QxNkMzMV9TQVQKICAqCkBAIC04Niw0OCArNzYsMzggQEAKICAqICB2b2lkCiAgKgogICovCi12b2lkIExWQ19NaXhTb2Z0XzJNY19EMTZDMzFfU0FUKExWTWl4ZXIzXzJTdF9GTE9BVF9zdCAqcHRySW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqc3JjMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICpzcmMyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgIE5yRnJhbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgTnJDaGFubmVscykKLXsKLSAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCAgKnBJbnN0YW5jZTEgPSBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIChNaXhfUHJpdmF0ZV9GTE9BVF9zdCAqKShwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uUHJpdmF0ZVBhcmFtcyk7Ci0gICAgTWl4X1ByaXZhdGVfRkxPQVRfc3QgICpwSW5zdGFuY2UyID0gXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKikocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdLlByaXZhdGVQYXJhbXMpOwordm9pZCBMVkNfTWl4U29mdF8yTWNfRDE2QzMxX1NBVChMVk1peGVyM18yU3RfRkxPQVRfc3QqIHB0ckluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYzEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCogc3JjMiwgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBOckZyYW1lcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IE5yQ2hhbm5lbHMpIHsKKyAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCogcEluc3RhbmNlMSA9CisgICAgICAgICAgICAoTWl4X1ByaXZhdGVfRkxPQVRfc3QqKShwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0uUHJpdmF0ZVBhcmFtcyk7CisgICAgTWl4X1ByaXZhdGVfRkxPQVRfc3QqIHBJbnN0YW5jZTIgPQorICAgICAgICAgICAgKE1peF9Qcml2YXRlX0ZMT0FUX3N0KikocHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdLlByaXZhdGVQYXJhbXMpOwogCi0gICAgaWYgKE5yRnJhbWVzIDw9IDApICAgIHJldHVybjsKKyAgICBpZiAoTnJGcmFtZXMgPD0gMCkgcmV0dXJuOwogCiAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgICAgIFNPRlQgTUlYSU5HCiAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KICAgICBpZiAoKHBJbnN0YW5jZTEtPkN1cnJlbnQgPT0gcEluc3RhbmNlMS0+VGFyZ2V0KSAmJiAocEluc3RhbmNlMS0+Q3VycmVudCA9PSAwKSkgewotICAgICAgICBMVkNfTWl4U29mdF9NY19EMTZDMzFfU0FUKChMVk1peGVyM18xU3RfRkxPQVRfc3QgKikoJnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMyLCBkc3QsIE5yRnJhbWVzLCBOckNoYW5uZWxzKTsKLSAgICB9Ci0gICAgZWxzZSBpZiAoKHBJbnN0YW5jZTItPkN1cnJlbnQgPT0gcEluc3RhbmNlMi0+VGFyZ2V0KSAmJiAocEluc3RhbmNlMi0+Q3VycmVudCA9PSAwKSkgewotICAgICAgICBMVkNfTWl4U29mdF9NY19EMTZDMzFfU0FUKChMVk1peGVyM18xU3RfRkxPQVRfc3QgKikoJnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMxLCBkc3QsIE5yRnJhbWVzLCBOckNoYW5uZWxzKTsKLSAgICB9Ci0gICAgZWxzZSBpZiAoKHBJbnN0YW5jZTEtPkN1cnJlbnQgIT0gcEluc3RhbmNlMS0+VGFyZ2V0KSB8fCBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocEluc3RhbmNlMi0+Q3VycmVudCAhPSBwSW5zdGFuY2UyLT5UYXJnZXQpKQotICAgIHsKLSAgICAgICAgTFZDX01peFNvZnRfTWNfRDE2QzMxX1NBVCgoTFZNaXhlcjNfMVN0X0ZMT0FUX3N0ICopKCZwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMxLCBkc3QsIE5yRnJhbWVzLCBOckNoYW5uZWxzKTsKLSAgICAgICAgTFZDX01peEluU29mdF9NY19EMTZDMzFfU0FUKChMVk1peGVyM18xU3RfRkxPQVRfc3QgKikoJnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYzIsIGRzdCwgTnJGcmFtZXMsIE5yQ2hhbm5lbHMpOwotICAgIH0KLSAgICBlbHNleworICAgICAgICBMVkNfTWl4U29mdF9NY19EMTZDMzFfU0FUKChMVk1peGVyM18xU3RfRkxPQVRfc3QqKSgmcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdKSwgc3JjMiwgZHN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5yRnJhbWVzLCBOckNoYW5uZWxzKTsKKyAgICB9IGVsc2UgaWYgKChwSW5zdGFuY2UyLT5DdXJyZW50ID09IHBJbnN0YW5jZTItPlRhcmdldCkgJiYgKHBJbnN0YW5jZTItPkN1cnJlbnQgPT0gMCkpIHsKKyAgICAgICAgTFZDX01peFNvZnRfTWNfRDE2QzMxX1NBVCgoTFZNaXhlcjNfMVN0X0ZMT0FUX3N0KikoJnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVswXSksIHNyYzEsIGRzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOckZyYW1lcywgTnJDaGFubmVscyk7CisgICAgfSBlbHNlIGlmICgocEluc3RhbmNlMS0+Q3VycmVudCAhPSBwSW5zdGFuY2UxLT5UYXJnZXQpIHx8CisgICAgICAgICAgICAgICAocEluc3RhbmNlMi0+Q3VycmVudCAhPSBwSW5zdGFuY2UyLT5UYXJnZXQpKSB7CisgICAgICAgIExWQ19NaXhTb2Z0X01jX0QxNkMzMV9TQVQoKExWTWl4ZXIzXzFTdF9GTE9BVF9zdCopKCZwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0pLCBzcmMxLCBkc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTnJGcmFtZXMsIE5yQ2hhbm5lbHMpOworICAgICAgICBMVkNfTWl4SW5Tb2Z0X01jX0QxNkMzMV9TQVQoKExWTWl4ZXIzXzFTdF9GTE9BVF9zdCopKCZwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMV0pLCBzcmMyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHN0LCBOckZyYW1lcywgTnJDaGFubmVscyk7CisgICAgfSBlbHNlIHsKICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgICAgICAgICBIQVJEIE1JWElORwogICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICBMVkNfQ29yZV9NaXhIYXJkXzJTdF9EMTZDMzFfU0FUKCZwdHJJbnN0YW5jZS0+TWl4ZXJTdHJlYW1bMF0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnB0ckluc3RhbmNlLT5NaXhlclN0cmVhbVsxXSwKKyAgICAgICAgTFZDX0NvcmVfTWl4SGFyZF8yU3RfRDE2QzMxX1NBVCgmcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzBdLCAmcHRySW5zdGFuY2UtPk1peGVyU3RyZWFtWzFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYzEsIHNyYzIsIGRzdCwgTnJGcmFtZXMgKiBOckNoYW5uZWxzKTsKICAgICB9CiB9Ci0jZW5kaWYKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfTWl4ZXIuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhlci5oCmluZGV4IGNlNDJkMmUuLjFlYjJkZWEgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhlci5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhlci5oCkBAIC0yNSwzNCArMjUsMzEgQEAKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCiAvKiBMVk1peGVyM19zdCBzdHJ1Y3R1cmUgc3RvcmVzIEluc3RhbmN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ywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgTnVtQ2hhbm5lbHMpOwogCi12b2lkIExWQ19NaXhlcl9WYXJTbG9wZV9TZXRUaW1lQ29uc3RhbnQoIExWTWl4ZXIzX0ZMT0FUX3N0ICpwU3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgICAgICAgICAgIFRjX21pbGxpc2VjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRnNfZW4gICAgICAgICAgIEZzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgIE51bUNoYW5uZWxzKTsKK3ZvaWQgTFZDX01peGVyX1ZhclNsb3BlX1NldFRpbWVDb25zdGFudChMVk1peGVyM19GTE9BVF9zdCogcFN0cmVhbSwgTFZNX0lOVDMyIFRjX21pbGxpc2VjLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9Gc19lbiBGcywgTFZNX0lOVDE2IE51bUNoYW5uZWxzKTsKIAogLyoqKiAxNiBiaXQgZnVuY3Rpb25zICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLXZvaWQgTFZDX01peFNvZnRfMVN0X0QxNkMzMV9TQVQoTFZNaXhlcjNfMVN0X0ZMT0FUX3N0ICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgIG4pOwotI2lmZGVmIFNVUFBPUlRfTUMKLXZvaWQgTFZDX01peFNvZnRfTWNfRDE2QzMxX1NBVChMVk1peGVyM18xU3RfRkxPQVRfc3QgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgIE5yQ2hhbm5lbHMpOwotI2VuZGlmCit2b2lkIExWQ19NaXhTb2Z0XzFTdF9EMTZDMzFfU0FUKExWTWl4ZXIzXzFTdF9GTE9BVF9zdCogcEluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBuKTsKK3ZvaWQgTFZDX01peFNvZnRfTWNfRDE2QzMxX1NBVChMVk1peGVyM18xU3RfRkxPQVRfc3QqIHBJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBOckZyYW1lcywgTFZNX0lOVDE2IE5yQ2hhbm5lbHMpOwogCi12b2lkIExWQ19NaXhJblNvZnRfRDE2QzMxX1NBVChMVk1peGVyM18xU3RfRkxPQVRfc3QgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgbik7Ci0jaWZkZWYgU1VQUE9SVF9NQwotdm9pZCBMVkNfTWl4SW5Tb2Z0X01jX0QxNkMzMV9TQVQoTFZNaXhlcjNfMVN0X0ZMT0FUX3N0ICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgIE5yRnJhbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgIE5yQ2hhbm5lbHMpOwotI2VuZGlmCit2b2lkIExWQ19NaXhJblNvZnRfRDE2QzMxX1NBVChMVk1peGVyM18xU3RfRkxPQVRfc3QqIHBJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IG4pOwordm9pZCBMVkNfTWl4SW5Tb2Z0X01jX0QxNkMzMV9TQVQoTFZNaXhlcjNfMVN0X0ZMT0FUX3N0KiBwSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBOckZyYW1lcywgTFZNX0lOVDE2IE5yQ2hhbm5lbHMpOwogCi12b2lkIExWQ19NaXhTb2Z0XzJTdF9EMTZDMzFfU0FUKExWTWl4ZXIzXzJTdF9GTE9BVF9zdCAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAgKnNyYzEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqc3JjMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICpkc3QsICAvKiBkc3QgY2Fubm90IGJlIGVxdWFsIHRvIHNyYzIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgIG4pOwotI2lmZGVmIFNVUFBPUlRfTUMKLXZvaWQgTFZDX01peFNvZnRfMk1jX0QxNkMzMV9TQVQoTFZNaXhlcjNfMlN0X0ZMT0FUX3N0ICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqc3JjMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICpzcmMyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgKmRzdCwgIC8qIGRzdCBjYW5ub3QgYmUgZXF1YWwgdG8gc3JjMiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICBOckNoYW5uZWxzKTsKLSNlbmRpZgordm9pZCBMVkNfTWl4U29mdF8yU3RfRDE2QzMxX1NBVChMVk1peGVyM18yU3RfRkxPQVRfc3QqIHBJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQqIHNyYzIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogZHN0LCAvKiBkc3QgY2Fubm90IGJlIGVxdWFsIHRvIHNyYzIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IG4pOwordm9pZCBMVkNfTWl4U29mdF8yTWNfRDE2QzMxX1NBVChMVk1peGVyM18yU3RfRkxPQVRfc3QqIHBJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQqIHNyYzIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogZHN0LCAvKiBkc3QgY2Fubm90IGJlIGVxdWFsIHRvIHNyYzIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IE5yRnJhbWVzLCBMVk1fSU5UMTYgTnJDaGFubmVscyk7CiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qIEZvciBhcHBseWluZyBkaWZmZXJlbnQgZ2FpbnMgdG8gTGVmdCBhbmQgcmlnaHQgY2hlbm5hbHMgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogTWl4ZXJTdHJlYW1bMF0gYXBwbGllcyB0byBMZWZ0IGNoYW5uZWwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBNaXhlclN0cmVhbVsxXSBhcHBsaWVzIHRvIFJpZ2h0IGNoYW5uZWwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIEdhaW4gdmFsdWVzIHNob3VsZCBub3QgYmUgbW9yZSB0aGF0IDEuMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0jaWZkZWYgU1VQUE9SVF9NQwotdm9pZCBMVkNfTWl4U29mdF8xU3RfTUNfZmxvYXRfU0FUKExWTWl4ZXIzXzJTdF9GTE9BVF9zdCAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAgIExWTV9GTE9BVCAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICpkc3QsICAgLyogZHN0IGNhbiBiZSBlcXVhbCB0byBzcmMgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgIE5yRnJhbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgICAgICAgICAgICAgTnJDaGFubmVscywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDMyICAgICAgICAgICAgIENoTWFzayk7Ci0jZW5kaWYKLXZvaWQgTFZDX01peFNvZnRfMVN0XzJpX0QxNkMzMV9TQVQoTFZNaXhlcjNfMlN0X0ZMT0FUX3N0ICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICAgTFZNX0ZMT0FUICAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgKmRzdCwgICAvKiBkc3QgY2FuIGJlIGVxdWFsIHRvIHNyYyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgbik7ICAgICAvKiBOdW1iZXIgb2Ygc3RlcmVvIHNhbXBsZXMgKi8KK3ZvaWQgTFZDX01peFNvZnRfMVN0X01DX2Zsb2F0X1NBVChMVk1peGVyM18yU3RfRkxPQVRfc3QqIHBJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiBkc3QsIC8qIGRzdCBjYW4gYmUgZXF1YWwgdG8gc3JjICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IE5yRnJhbWVzLCBMVk1fSU5UMzIgTnJDaGFubmVscywgTFZNX0lOVDMyIENoTWFzayk7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0jZW5kaWYgLy8jaWZuZGVmIF9fTFZDX01JWEVSX0hfXwotCisjZW5kaWYgIC8vI2lmbmRlZiBfX0xWQ19NSVhFUl9IX18KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhlcl9HZXRDdXJyZW50LmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhlcl9HZXRDdXJyZW50LmNwcAppbmRleCBkMGI1MGU2Li4wM2RlOGIwIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfTWl4ZXJfR2V0Q3VycmVudC5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peGVyX0dldEN1cnJlbnQuY3BwCkBAIC0zMCwxMCArMzAsOSBAQAogLyogIEN1cnJlbnRHYWluICAgICAgLSBDdXJyZW50R2FpbiB2YWx1ZSBpbiBRIDE2LjE1IGZvcm1hdCAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZNX0ZMT0FUIExWQ19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WEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peGVyX0luaXQuY3BwCkBAIC00NCwxNCArNDQsMTAgQEAKIC8qICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgTFZDX01peGVyX0luaXQoIExWTWl4ZXIzX0ZMT0FUX3N0ICpwU3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICBUYXJnZXRHYWluLAotICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICBDdXJyZW50R2FpbikKLXsKK3ZvaWQgTFZDX01peGVyX0luaXQoTFZNaXhlcjNfRkxPQVRfc3QqIHBTdHJlYW0sIExWTV9GTE9BVCBUYXJnZXRHYWluLCBMVk1fRkxPQVQgQ3VycmVudEdhaW4pIHsKICAgICBMVk1fRkxPQVQgTWF4R2FpbiA9IFRhcmdldEdhaW47Ci0gICAgTWl4X1ByaXZhdGVfRkxPQVRfc3QgKnBJbnN0YW5jZSA9IChNaXhfUHJpdmF0ZV9GTE9BVF9zdCAqKXBTdHJlYW0tPlByaXZhdGVQYXJhbXM7Ci0gICAgaWYoQ3VycmVudEdhaW4gPiBNYXhHYWluKQotICAgICAgICBNYXhHYWluID0gQ3VycmVudEdhaW47Ci0gICAgcEluc3RhbmNlLT5UYXJnZXQgPSBUYXJnZXRHYWluOyAgIC8vIFVwZGF0ZSBmcmFjdGlvbmFsIGdhaW4gVGFyZ2V0Ci0gICAgcEluc3RhbmNlLT5DdXJyZW50ID0gQ3VycmVudEdhaW47IC8vIFVwZGF0Z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Igc3BlY2lmeWluZyB2YWx1ZSBvZiBUYXJnZXQgR2FpbiAqLwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICAgICAgQ3VycmVudDsgICAgICAgICAgLypudW1iZXIgc3BlY2lmeWluZyB2YWx1ZSBvZiBDdXJyZW50IEdhaW4gKi8KLSAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICAgIERlbHRhOyAgICAgICAgICAgIC8qbnVtYmVyIHNwZWNpZnlpbmcgdmFsdWUgb2YgRGVsdGEgR2FpbiAqLworICAgIExWTV9GTE9BVCBUYXJnZXQ7ICAvKm51bWJlciBzcGVjaWZ5aW5nIHZhbHVlIG9mIFRhcmdldCBHYWluICovCisgICAgTFZNX0ZMT0FUIEN1cnJlbnQ7IC8qbnVtYmVyIHNwZWNpZnlpbmcgdmFsdWUgb2YgQ3VycmVudCBHYWluICovCisgICAgTFZNX0ZMT0FUIERlbHRhOyAgIC8qbnVtYmVyIHNwZWNpZnlpbmcgdmFsdWUgb2YgRGVsdGEgR2FpbiAqLwogfSBNaXhfUHJpdmF0ZV9GTE9BVF9zdDsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgIERFRklOSVRJT05TCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSNkZWZpbmUgTFZDb3JlX01peEluU29mdF9EMzJDMzFfU0FUICAgIExWQ29yZV9JblNvZnRfRDMyQzMxX1NBVAotI2RlZmluZSBMVkNvcmVfTWl4U29mdF8xU3RfRDMyQzMxX1dSQSAgTFZDb3JlX1NvZnRfMVN0X0QzMkMzMV9XUkEKLSNkZWZpbmUgTFZDb3JlX01peEhhcmRfMlN0X0QzMkMzMV9TQVQgIExWQ29yZV9IYXJkXzJTdF9EMzJDMzFfU0FUCisjZGVmaW5lIExWQ29yZV9NaXhJblNvZnRfRDMyQzMxX1NBVCBMVkNvcmVfSW5Tb2Z0X0QzMkMzMV9TQVQKKyNkZWZpbmUgTFZDb3JlX01peFNvZnRfMVN0X0QzMkMzMV9XUkEgTFZDb3JlX1NvZnRfMVN0X0QzMkMzMV9XUkEKKyNkZWZpbmUgTFZDb3JlX01peEhhcmRfMlN0X0QzMkMzMV9TQVQgTFZDb3JlX0hhcmRfMlN0X0QzMkMzMV9TQVQKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgIEZVTkNUSU9OIFBST1RPVFlQRVMgKExPVyBMRVZFTCBTVUJGVU5DVElPTlMpCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAogLyoqKiAxNiBiaXQgZnVuY3Rpb25zICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIExWQ19Db3JlX01peEluU29mdF9EMTZDMzFfU0FUKCBMVk1peGVyM19GTE9BVF9zdCAqcHRySW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgIG4pOwotI2lmZGVmIFNVUFBPUlRfTUMKLXZvaWQgTFZDX0NvcmVfTWl4SW5Tb2Z0X01jX0QxNkMzMV9TQVQoTFZNaXhlcjNfRkxPQVRfc3QgKnB0ckluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICBOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgTnJDaGFubmVscyk7Ci0jZW5kaWYKLXZvaWQgTFZDX0NvcmVfTWl4U29mdF8xU3RfRDE2QzMxX1dSQSggTFZNaXhlcjNfRkxPQVRfc3QgKnB0ckluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICBuKTsKLSNpZmRlZiBTVVBQT1JUX01DCi12b2lkIExWQ19Db3JlX01peFNvZnRfTWNfRDE2QzMxX1dSQShMVk1peGVyM19GTE9BVF9zdCAqcHRySW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgIE5yRnJhbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICBOckNoYW5uZWxzKTsKLSNlbmRpZgotdm9pZCBMVkNfQ29yZV9NaXhIYXJkXzJTdF9EMTZDMzFfU0FUKCBMVk1peGVyM19GTE9BVF9zdCAqcEluc3RhbmNlMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNaXhlcjNfRkxPQVRfc3QgICAgICAgICAqcEluc3RhbmNlMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAqc3JjMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAqc3JjMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgIG4pOwordm9pZCBMVkNfQ29yZV9NaXhJblNvZnRfRDE2QzMxX1NBVChMVk1peGVyM19GTE9BVF9zdCogcHRySW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IG4pOwordm9pZCBMVkNfQ29yZV9NaXhJblNvZnRfTWNfRDE2QzMxX1NBVChMVk1peGVyM19GTE9BVF9zdCogcHRySW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IE5yRnJhbWVzLCBMVk1fSU5UMTYgTnJDaGFubmVscyk7Cit2b2lkIExWQ19Db3JlX01peFNvZnRfMVN0X0QxNkMzMV9XUkEoTFZNaXhlcjNfRkxPQVRfc3QqIHB0ckluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IG4pOwordm9pZCBMVkNfQ29yZV9NaXhTb2Z0X01jX0QxNkMzMV9XUkEoTFZNaXhlcjNfRkxPQVRfc3QqIHB0ckluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgTnJGcmFtZXMsIExWTV9JTlQxNiBOckNoYW5uZWxzKTsKK3ZvaWQgTFZDX0NvcmVfTWl4SGFyZF8yU3RfRDE2QzMxX1NBVChMVk1peGVyM19GTE9BVF9zdCogcEluc3RhbmNlMSwgTFZNaXhlcjNfRkxPQVRfc3QqIHBJbnN0YW5jZTIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUKiBzcmMxLCBjb25zdCBMVk1fRkxPQVQqIHNyYzIsIExWTV9GTE9BVCogZHN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiBGb3IgYXBwbHlpbmcgZGlmZmVyZW50IGdhaW5zIHRvIExlZnQgYW5kIHJpZ2h0IGNoZW5uYWxzICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTgxLDE4ICs2Myw4IEBACiAvKiBwdHJJbnN0YW5jZTIgYXBwbGllcyB0byBSaWdodCBjaGFubmVsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIEdhaW4gdmFsdWVzIHNob3VsZCBub3QgYmUgbW9yZSB0aGF0IDEuMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0jaWZkZWYgU1VQUE9SVF9NQwotdm9pZCBMVkNfQ29yZV9NaXhTb2Z0XzFTdF9NQ19mbG9hdF9XUkEoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKipwdHJJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgIE5yQ2hhbm5lbHMpOwotI2VuZGlmCi12b2lkIExWQ19Db3JlX01peFNvZnRfMVN0XzJpX0QxNkMzMV9XUkEoIExWTWl4ZXIzX0ZMT0FUX3N0ICAgICAgICAqcHRySW5zdGFuY2UxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1peGVyM19GTE9BVF9zdCAgICAgICAgKnB0ckluc3RhbmNlMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgbik7Cit2b2lkIExWQ19Db3JlX01peFNvZnRfMVN0X01DX2Zsb2F0X1dSQShNaXhfUHJpdmF0ZV9GTE9BVF9zdCoqIHB0ckluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgTnJGcmFtZXMsIExWTV9JTlQxNiBOckNoYW5uZWxzKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiBGb3IgYXBwbHlpbmcgZGlmZmVyZW50IGdhaW5zIHRvIExlZnQgYW5kIHJpZ2h0IGNoZW5uYWxzICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTEwMCwyMSArNzIsNyBAQAogLyogcHRySW5zdGFuY2UyIGFwcGxpZXMgdG8gUmlnaHQgY2hhbm5lbCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBHYWluIHZhbHVlcyBzaG91bGQgbm90IGJlIG1vcmUgdGhhdCAxLjAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotI2lmZGVmIFNVUFBPUlRfTUMKLXZvaWQgTFZDX0NvcmVfTWl4SGFyZF8xU3RfTUNfZmxvYXRfU0FUKE1peF9Qcml2YXRlX0ZMT0FUX3N0ICoqcHRySW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgIE5yRnJhbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICBOckNoYW5uZWxzKTsKLSNlbmRpZgotdm9pZCBMVkNfQ29yZV9NaXhIYXJkXzFTdF8yaV9EMTZDMzFfU0FUKCBMVk1peGVyM19GTE9BVF9zdCAgICAgICAgKnB0ckluc3RhbmNlMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNaXhlcjNfRkxPQVRfc3QgICAgICAgICpwdHJJbnN0YW5jZTIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgIG4pOwordm9pZCBMVkNfQ29yZV9NaXhIYXJkXzFTdF9NQ19mbG9hdF9TQVQoTWl4X1ByaXZhdGVfRkxPQVRfc3QqKiBwdHJJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IE5yRnJhbWVzLCBMVk1fSU5UMTYgTnJDaGFubmVscyk7CiAKLS8qKiogMzIgYml0IGZ1bmN0aW9ucyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSNlbmRpZiAvLyNpZm5kZWYgX19MVkNfTUlYRVJfUFJJVkFURV9IX18KLQorI2VuZGlmICAvLyNpZm5kZWYgX19MVkNfTUlYRVJfUFJJVkFURV9IX18KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWQ19NaXhlcl9TZXRUYXJnZXQuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peGVyX1NldFRhcmdldC5jcHAKaW5kZXggNDdiMGNlYy4uZDgwMTVjNCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peGVyX1NldFRhcmdldC5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peGVyX1NldFRhcmdldC5jcHAKQEAgLTQzLDkgKzQzLDcgQEAKIC8qICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgTFZDX01peGVyX1NldFRhcmdldChMVk1peGVyM19GTE9BVF9zdCAqcFN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICBUYXJnZXRHYWluKQotewotICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0ICpwSW5zdGFuY2UgPSAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKilwU3RyZWFtLT5Qcml2YXRlUGFyYW1zOwotICAgIHBJbnN0YW5jZS0+VGFyZ2V0ID0gVGFyZ2V0R2FpbjsgICAgICAgICAgICAgICAvLyBVcGRhdGUgZ2FpbiBUYXJnZXQKK3ZvaWQgTFZDX01peGVyX1NldFRhcmdldChMVk1peGVyM19GTE9BVF9zdCogcFN0cmVhbSwgTFZNX0ZMT0FUIFRhcmdldEdhaW4pIHsKKyAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCogcEluc3RhbmNlID0gKE1peF9Qcml2YXRlX0ZMT0FUX3N0KilwU3RyZWFtLT5Qcml2YXRlUGFyYW1zOworICAgIHBJbnN0YW5jZS0+VGFyZ2V0ID0gVGFyZ2V0R2FpbjsgIC8vIFVwZGF0ZSBnYWluIFRhcmdldAogfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peGVyX1NldFRpbWVDb25zdGFudC5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfTWl4ZXJfU2V0VGltZUNvbnN0YW50LmNwcAppbmRleCAxYThkYTdhLi43MTViOTA4IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfTWl4ZXJfU2V0VGltZUNvbnN0YW50LmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVkNfTWl4ZXJfU2V0VGltZUNvbnN0YW50LmNwcApAQCAtNDQsMzYgKzQ0LDMzIEBACiAvKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogIHZvaWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIExWQ19NaXhlcl9TZXRUaW1lQ29uc3RhbnQoTFZNaXhlcjNfRkxPQVRfc3QgKnBTdHJlYW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDMyICAgICAgICAgICBUY19taWxsaXNlYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRnNfZW4gICAgICAgICAgIEZzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgTnVtQ2hhbm5lbHMpCi17Ci0gICAgTFZNX0ZMT0FUICAgRGVsdGFUYWJsZVsxM10gPSB7MC41MDAwMDBmLC8qODAwMCovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4zNjI4MTJmLC8qMTEwMjUqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMzMzMzMzZiwvKjEyMDAwKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI1MDAwMGYsLyoxNjAwMCovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4xODE0MDZmLC8qMjIwNTAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMTY2NjY2ZiwvKjI0MDAwKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjEyNTAwMGYsLyozMjAwMCovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wOTA3MDNmLC8qNDQxMDAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDgzMzMzZiwvKjQ4MDAwKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjA0NTM1MmYsLyo4ODIwMCovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wNDE2NjdmLC8qOTYwMDAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDIyNjc2ZiwvKjE3NjQwMCovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMjA4MzNmfTsvKjE5MjAwMCovCit2b2lkIExWQ19NaXhlcl9TZXRUaW1lQ29uc3RhbnQoTFZNaXhlcjNfRkxPQVRfc3QqIHBTdHJlYW0sIExWTV9JTlQzMiBUY19taWxsaXNlYywgTFZNX0ZzX2VuIEZzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBOdW1DaGFubmVscykgeworICAgIExWTV9GTE9BVCBEZWx0YVRhYmxlWzEzXSA9IHswLjUwMDAwMGYsICAvKjgwMDAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM2MjgxMmYsICAvKjExMDI1Ki8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4zMzMzMzNmLCAgLyoxMjAwMCovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMjUwMDAwZiwgIC8qMTYwMDAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjE4MTQwNmYsICAvKjIyMDUwKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4xNjY2NjZmLCAgLyoyNDAwMCovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMTI1MDAwZiwgIC8qMzIwMDAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjA5MDcwM2YsICAvKjQ0MTAwKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wODMzMzNmLCAgLyo0ODAwMCovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDQ1MzUyZiwgIC8qODgyMDAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjA0MTY2N2YsICAvKjk2MDAwKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMjI2NzZmLCAgLyoxNzY0MDAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAyMDgzM2Z9OyAvKjE5MjAwMCovCiAKLSAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCAqcEluc3RhbmNlID0gKE1peF9Qcml2YXRlX0ZMT0FUX3N0ICopcFN0cmVhbS0+UHJpdmF0ZVBhcmFtczsKKyAgICBNaXhfUHJpdmF0ZV9GTE9BVF9zdCogcEluc3RhbmNlID0gKE1peF9Qcml2YXRlX0ZMT0FU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bWVDb25zdGFudC5jcHAKaW5kZXggZjMzNWExZS4uY2Y4NDYxMyAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peGVyX1ZhclNsb3BlX1NldFRpbWVDb25zdGFudC5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZDX01peGVyX1ZhclNsb3BlX1NldFRpbWVDb25zdGFudC5jcHAKQEAgLTQ0LDU3ICs0NCw1MCBAQAogLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBMVkNfTWl4ZXJfVmFyU2xvcGVfU2V0VGltZUNvbnN0YW50KCBMVk1peGVyM19GTE9BVF9zdCAqcFN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDMyICAgICAgICAgICBUY19taWxsaXNlYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZzX2VuICAgICAgICAgICBGcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICBOdW1DaGFubmVscykKLXsKLSAgICAgTFZNX0ZMT0FUICAgRGVsdGFUYWJsZVsxM10gPSB7MC41MDAwMDBmLC8qODAwMCovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMzYyODEyZiwvKjExMDI1Ki8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4zMzMzMzNmLC8qMTIwMDAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI1MDAwMGYsLyoxNjAwMCovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMTgxNDA2ZiwvKjIyMDUwKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4xNjY2NjZmLC8qMjQwMDAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjEyNTAwMGYsLyozMjAwMCovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDkwNzAzZiwvKjQ0MTAwKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wODMzMzNmLC8qNDgwMDAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjA0NTM1MmYsLyo4ODIwMCovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDQxNjY2ZiwvKjk2MDAwKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMjI2NzZmLC8qMTc2NDAwKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMjA4MzNmfTsvKjE5MjAwMCovCit2b2lkIExWQ19NaXhlcl9WYXJTbG9wZV9TZXRUaW1lQ29uc3RhbnQoTFZNaXhlcjNfRkxPQVRfc3QqIHBTdHJlYW0sIExWTV9JTlQzMiBUY19taWxsaXNlYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRnNfZW4gRnMsIExWTV9JTlQxNiBOdW1DaGFubmVscykgeworICAgIExWTV9GTE9BVCBEZWx0YVRhYmxlWzEzXSA9IHswLjUwMDAwMGYsICAvKjgwMDAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM2MjgxMmYsICAvKjExMDI1Ki8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4zMzMzMzNmLCAgLyoxMjAwMCovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMjUwMDAwZiwgIC8qMTYwMDAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjE4MTQwNmYsICAvKjIyMDUwKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4xNjY2NjZmLCAgLyoyNDAwMCovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMTI1MDAwZiwgIC8qMzIwMDAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjA5MDcwM2YsICAvKjQ0MTAwKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wODMzMzNmLCAgLyo0ODAwMCovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDQ1MzUyZiwgIC8qODgyMDAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjA0MTY2NmYsICAvKjk2MDAwKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMjI2NzZmLCAgLyoxNzY0MDAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAyMDgzM2Z9OyAvKjE5MjAwMCovCiAgICAgTFZNX0ZMT0FUIFRjX21pbGxpc2VjX2Zsb2F0OwotICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0ICpwSW5zdGFuY2UgPSAoTWl4X1ByaXZhdGVfRkxPQVRfc3QgKilwU3RyZWFtLT5Qcml2YXRlUGFyYW1zOworICAgIE1peF9Qcml2YXRlX0ZMT0FUX3N0KiBwSW5zdGFuY2UgPSAoTWl4X1ByaXZhdGVfRkxPQVRfc3QqKXBTdHJlYW0tPlByaXZhdGVQYXJhbXM7CiAgICAgTFZNX0ZMT0FUIERlbHRhID0gRGVsdGFUYWJsZVtGc107CiAKLSAgICBMVk1fRkxPQVQgICBDdXJyZW50OwotICAgIExWTV9GTE9BVCAgIFRhcmdldDsKKyAgICBMVk1f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orKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVk1fRk9fSFBGLmNwcApAQCAtNjcsMzEgKzY3LDE5IEBACiAvKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi1MVk1fRkxPQVQgTFZNX0ZPX0hQRiggICBMVk1fRkxPQVQgICAgICAgdywKLSAgICAgICAgICAgICAgICAgICAgICAgIEZPX0ZMT0FUX0NvZWZzX3QgICpwQ29lZmZzKQotewotICAgIExWTV9GTE9BVCBZLENvZWZmaWNpZW50c1sxM10gPSB7LTAuOTk5OTk2ZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuOTk5ODAxZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0wLjQ5NzgyNGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjMyMjkzN2YsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMC4xODA4ODBmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wODc2NThmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTAuMDMyMTAyZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDA4MTYzZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0wLjAwMTI1MmYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDA4OWYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB9OwotICAgIFk9TFZNX1BvbHlub21pYWwoKExWTV9VSU5UMTYpOSwgQ29lZmZpY2llbnRzLCB3KTsKK0xWTV9GTE9BVCBMVk1fRk9fSFBGKExWTV9GTE9BVCB3LCBGT19GTE9BVF9Db2Vmc190KiBwQ29lZmZzKSB7CisgICAgTFZNX0ZMT0FUIFksIENvZWZmaWNpZW50c1sxM10gPSB7LTAuOTk5OTk2ZiwgMC45OTk4MDFmLCAgLTAuNDk3ODI0ZiwgMC4zMjI5MzdmLCAgLTAuMTgwODgwZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjA4NzY1OGYsICAtMC4wMzIxMDJmLCAwLjAwODE2M2YsICAtMC4wMDEyNTJmLCAwLjAwMDA4OWYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgICAgICAgICAgMCwgICAgICAgICAgMH07CisgICAgWSA9IExWTV9Qb2x5bm9taWFsKChMVk1fVUlOVDE2KTksIENvZWZmaWNpZW50cywgdyk7CiAKLSAgICBwQ29lZmZzLT5CMSA9IC1ZOyAgICAgICAgIC8qIFN0b3JlIC1CMSBpbiBmaWx0ZXIgc3RydWN0dXJlIGluc3RlYWQgb2YgQjEhKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBBMD0oMS1CMSkvMj0gQjEvMiAtIDAuNSovCi0gICAgWSA9IFkgLyAyLjBmOyAgICAgICAgICAgICAgICAgLyogQTA9WT1CMS8yKi8KLSAgICBZID0gWSAtIDAuNWY7ICAgICAgICAgLyogQTA9WT0oQjEvMiAtIDAuNSkqLworICAgIHBDb2VmZnMtPkIxID0gLVk7IC8qIFN0b3JlIC1CMSBpbiBmaWx0ZXIgc3RydWN0dXJlIGluc3RlYWQgb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ogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi1MVk1fRkxPQVQgTFZNX0ZPX0xQRiggICBMVk1fRkxPQVQgICAgICAgdywKLSAgICAgICAgICAgICAgICAgICAgICAgIEZPX0ZMT0FUX0NvZWZzX3QgICpwQ29lZmZzKQotewotICAgIExWTV9GTE9BVCBZLENvZWZmaWNpZW50c1sxM10gPSB7LTAuOTk5OTk2ZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuOTk5ODAxZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0wLjQ5NzgyNGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjMyMjkzN2YsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMC4xODA4ODBmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wODc2NThmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTAuMDMyMTAyZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDA4MTYzZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0wLjAwMTI1MmYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDA4OWYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwfTsKLSAgICBZPUxWTV9Qb2x5bm9taWFsKChMVk1fVUlOVDE2KTksIENvZWZmaWNpZW50cywgdyk7Ci0gICAgcENvZWZmcy0+QjEgPSAtWTsgICAgIC8vIFN0b3JlIC1CMSBpbiBmaWx0ZXIgc3RydWN0dXJ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ETF8yUGlCeV84MDAwX2YsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlZETF8yUGlCeV8xMTAyNV9mLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZWRExfMlBpQnlfMTIwMDBfZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWVkRMXzJQaUJ5XzE2MDAwX2YsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlZETF8yUGlCeV8yMjA1MF9mLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZWRExfMlBpQnlfMjQwMDBfZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWVkRMXzJQaUJ5XzMyMDAwX2YsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlZETF8yUGlCeV80NDEwMF9mLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZWRExfMlBpQnlfNDgwMDBfZgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsTFZWRExfMlBpQnlfODgyMDBfZgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsTFZWRExfMlBpQnlfOTYwMDBfZgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsTFZWRExfMlBpQnlfMTc2NDAwX2YKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLExWVkRMXzJQaUJ5XzE5MjAwMF9mCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKKyNkZWZpbmUgTFZWRExfMlBpQnlfODgyMDBfZiAwLjAwMDA3MTIzOGYKKyNkZWZpbmUgTFZWRExfMlBpQnlfOTYwMDBfZiAwLjAwMDA2NTQ1MGYKKyNkZWZpbmUgTFZWRExfMlBpQnlfMTc2NDAwX2YgMC4wMDAwMzU2MTlmCisjZGVmaW5lIExWVkRMXzJQaUJ5XzE5MjAwMF9mIDAuMDAwMDMyNzI1ZgorY29uc3QgTFZNX0ZMT0FUIExWVkRMXzJQaU9uRnNUYWJsZVtdID0geworICAgICAgICBMVlZETF8yUGlCeV84MDAwX2YsICBMVlZETF8yUGlCeV8xMTAyNV9mLCBMVlZETF8yUGlCeV8xMjAwMF9mLCBMVlZETF8yUGlCeV8xNjAwMF9mLAorICAgICAgICBMVlZETF8yUGlCeV8yMjA1MF9mLCBMVlZETF8yUGlCeV8yNDAwMF9mLCBMVlZETF8yUGlCeV8zMjAwMF9mLCBMVlZETF8yUGlCeV80NDEwMF9mLAorICAgICAgICBMVlZETF8yUGlCeV80ODAwMF9mLCBMVlZETF8yUGlCeV84ODIwMF9mLCBMVlZETF8yUGlCeV85NjAwMF9mLCBMVlZETF8yUGlCeV8xNzY0MDBfZiwKKyAgICAgICAgTFZWRExfMlBpQnlfMTkyMDAwX2Z9OwogLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KIC8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgIExWTV9HZXRPbWVnYSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNzcsMTAgKzY4LDggQEAKIC8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgIHc9MipwaSpGYy9GcyBpbiBRMi4yOSBmb3JtYXQgICAgICAgICAgICAgICAgICAgICAg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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotI2RlZmluZSBBbHBoYV9UYWJsZVNpemUgICAgICAgICAgICAgICAgICAgICAgICA1MCAgICAgIC8qIFRoZSBudW1iZXIgb2YgdGFibGUgZW50aXJlcyAqLwotI2RlZmluZSBBTFBIQV8wICAgICAgICAgICAgICAgICAgICAgICAgMjE0NzQ4MDc2OSAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC45OTk5OTkgKi8KLSNkZWZpbmUgQUxQSEFfMSAgICAgICAgICAgICAgICAgICAgICAgIDIxNDc0Nzk1NzcgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuOTk5OTk4ICovCi0jZGVmaW5lIEFMUEhBXzIgICAgICAgICAgICAgICAgICAgICAgICAyMTQ3NDc3ODkyICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjk5OTk5NyAqLwotI2RlZmluZSBBTFBIQV8zICAgICAgICAgICAgICAgICAgICAgICAgMjE0NzQ3NTUxMCAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC45OTk5OTYgKi8KLSNkZWZpbmUgQUxQSEFfNCAgICAgICAgICAgICAgICAgICAgICAgIDIxNDc0NzIxNDEgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuOTk5OTk1ICovCi0jZGVmaW5lIEFMUEhBXzUgICAgICAgICAgICAgICAgICAgICAgICAyMTQ3NDY3Mzc3ICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjk5OTk5MiAqLwotI2RlZmluZSBBTFBIQV82ICAgICAgICAgICAgICAgICAgICAgICAgMjE0NzQ2MDY0MiAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC45OTk5ODkgKi8KLSNkZWZpbmUgQUxQSEFfNyAgICAgICAgICAgICAgICAgICAgICAgIDIxNDc0NTExMTggICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuOTk5OTg1ICovCi0jZGVmaW5lIEFMUEhBXzggICAgICAgICAgICAgICAgICAgICAgICAyMTQ3NDM3NjUxICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjk5OTk3OSAqLwotI2RlZmluZSBBTFBIQV85ICAgICAgICAgICAgICAgICAgICAgICAgMjE0NzQxODYwOCAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC45OTk5NzAgKi8KLSNkZWZpbmUgQUxQSEFfMTAgICAgICAgICAgICAgICAgICAgICAgIDIxNDczOTE2ODMgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuOTk5OTU3ICovCi0jZGVmaW5lIEFMUEhBXzExICAgICAgICAgICAgICAgICAgICAgICAyMTQ3MzUzNjExICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjk5OTkzOSAqLwotI2RlZmluZSBBTFBIQV8xMiAgICAgICAgICAgICAgICAgICAgICAgMjE0NzI5OTc3OSAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC45OTk5MTQgKi8KLSNkZWZpbmUgQUxQSEFfMTMgICAgICAgICAgICAgICAgICAgICAgIDIxNDcyMjM2NjIgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuOTk5ODc5ICovCi0jZGVmaW5lIEFMUEhBXzE0ICAgICAgICAgICAgICAgICAgICAgICAyMTQ3MTE2MDM3ICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjk5OTgyOSAqLwotI2RlZmluZSBBTFBIQV8xNSAgICAgICAgICAgICAgICAgICAgICAgMjE0Njk2Mzg2NSAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC45OTk3NTggKi8KLSNkZWZpbmUgQUxQSEFfMTYgICAgICAgICAgICAgICAgICAgICAgIDIxNDY3NDg3MTIgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA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SA9IDAuOTkyMjk1ICovCi0jZGVmaW5lIEFMUEhBXzI2ICAgICAgICAgICAgICAgICAgICAgICAyMTI0MTI1MTUzICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjk4OTEyMyAqLwotI2RlZmluZSBBTFBIQV8yNyAgICAgICAgICAgICAgICAgICAgICAgMjExNDUyOTI2MyAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC45ODQ2NTQgKi8KLSNkZWZpbmUgQUxQSEFfMjggICAgICAgICAgICAgICAgICAgICAgIDIxMDEwMzQ2MTIgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuOTc4MzcwICovCi0jZGVmaW5lIEFMUEhBXzI5ICAgICAgICAgICAgICAgICAgICAgICAyMDgyMTAwMDMwICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjk2OTU1MyAqLwotI2RlZmluZSBBTFBIQV8zMCAgICAgICAgICAgICAgICAgICAgICAgMjA1NTYxNzM5OCAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC45NTcyMjEgKi8KLSNkZWZpbmUgQUxQSEFfMzEgICAgICAgICAgICAgICAgICAgICAgIDIwMTg3NDQ4MjQgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuOTQwMDUxICovCi0jZGVmaW5lIEFMUEhBXzMyICAgICAgICAgICAgICAgICAgICAgICAxOTY3NzMzMDE1ICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjkxNjI5NyAqLwotI2RlZmluZSBBTFBIQV8zMyAgICAgICAgICAgICAgICAgICAgICAgMTg5Nzc5NDU4NyAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC44ODM3MjkgKi8KLSNkZWZpbmUgQUxQSEFfMzQgICAgICAgICAgICAgICAgICAgICAgIDE4MDMxMjMyMzQgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuODM5NjQ1ICovCi0jZGVmaW5lIEFMUEhBXzM1ICAgICAgICAgICAgICAgICAgICAgICAxNjc3MjYyMjIwICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjc4MTAzNiAqLwotI2RlZmluZSBBTFBIQV8zNiAgICAgICAgICAgICAgICAgICAgICAgMTUxNDE0MjY3NSAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC43MDUwNzggKi8KLSNkZWZpbmUgQUxQSEFfMzcgICAgICAgICAgICAgICAgICAgICAgIDEzMTAxOTc4NzUgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuNjEwMTA4ICovCi0jZGVmaW5lIEFMUEhBXzM4ICAgICAgICAgICAgICAgICAgICAgICAxMDY3ODEzNDgwICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjQ5NzIzOSAqLwotI2RlZmluZSBBTFBIQV8zOSAgICAgICAgICAgICAgICAgICAgICAgIDc5OTYwMTM3MSAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC4zNzIzNDMgKi8KLSNkZWZpbmUgQUxQSEFfNDAgICAgICAgICAgICAgICAgICAgICAgICA1MzExODMwNDkgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuMjQ3MzUxICovCi0jZGVmaW5lIEFMUEhBXzQxICAgICAgICAgICAgICAgICAgICAgICAgMjk3OTA0MDA3ICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjEzODcyMiAqLwotI2RlZmluZSBBTFBIQV80MiAgICAgICAgICAgICAgICAgICAgICAgIDEzMTQ5OTc2OCAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC4wNjEyMzQgKi8KLSNkZWZpbmUgQUxQSEFfNDMgICAgICAgICAgICAgICAgICAgICAgICAgNDEzNzUyODIgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuMDE5MjY3ICovCi0jZGVmaW5lIEFMUEhBXzQ0ICAgICAgICAgICAgICAgICAgICAgICAgICA4MDY1ODk5ICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjAwMzc1NiAqLwotI2RlZmluZSBBTFBIQV80NSAgICAgICAgICAgICAgICAgICAgICAgICAgIDc5OTA3NiAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC4wMDAzNzIgKi8KLSNkZWZpbmUgQUxQSEFfNDYgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzAzOTggICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuMDAwMDE0ICovCi0jZGVmaW5lIEFMUEhBXzQ3ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjk5ICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjAwMDAwMCAqLwotI2RlZmluZSBBTFBIQV80OCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCAgICAgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC4wMDAwMDAgKi8KLSNkZWZpbmUgQUxQSEFfNDkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgICAgICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuMDAwMDAwICovCi0jZGVmaW5lIEFMUEhBXzUwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjAwMDAwMCAqLworI2RlZmluZSBBbHBoYV9UYWJsZVNpemUgNTAgIC8qIFRoZSBudW1iZXIgb2YgdGFibGUgZW50aXJlcyAqLworI2RlZmluZSBBTFBIQV8wIDIxNDc0ODA3NjkgIC8qIEZsb2F0aW5nIHBvaW50IEFscGhhID0gMC45OTk5OTkgKi8KKyNkZWZpbmUgQUxQSEFfMSAyMTQ3NDc5NTc3ICAvKiBGbG9hdGluZyBwb2ludCBBbHBoYSA9IDAuO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VmaW5lIEFMUEhBXzUwIDAgICAgICAgICAgLyogRmxvYXRpbmcgcG9pbnQgQWxwaGEgPSAwLjAwMDAwMCAqLwogCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzAgICAgICAgICAgICAgICAgICAgICAgICAwLjk5OTk5OWYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMSAgICAgICAgICAgICAgICAgICAgICAgIDAuOTk5OTk4ZgotI2RlZmluZSBBTFBIQV9GbG9hdF8yICAgICAgICAgICAgICAgICAgICAgICAgMC45OTk5OTdmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzMgICAgICAgICAgICAgICAgICAgICAgICAwLjk5OTk5NmYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfNCAgICAgICAgICAgICAgICAgICAgICAgIDAuOTk5OTk1ZgotI2RlZmluZSBBTFBIQV9GbG9hdF81ICAgICAgICAgICAgICAgICAgICAgICAgMC45OTk5OTJmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzYgICAgICAgICAgICAgICAgICAgICAgICAwLjk5OTk4OWYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfNyAgICAgICAgICAgICAgICAgICAgICAgIDAuOTk5OTg1ZgotI2RlZmluZSBBTFBIQV9GbG9hdF84ICAgICAgICAgICAgICAgICAgICAgICAgMC45OTk5NzlmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzkgICAgICAgICAgICAgICAgICAgICAgICAwLjk5OTk3MGYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMTAgICAgICAgICAgICAgICAgICAgICAgIDAuOTk5OTU3ZgotI2RlZmluZSBBTFBIQV9GbG9hdF8xMSAgICAgICAgICAgICAgICAgICAgICAgMC45OTk5MzlmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzEyICAgICAgICAgICAgICAgICAgICAgICAwLjk5OTkxNGYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMTMgICAgICAgICAgICAgICAgICAgICAgIDAuOTk5ODc5ZgotI2RlZmluZSBBTFBIQV9GbG9hdF8xNCAgICAgICAgICAgICAgICAgICAgICAgMC45OTk4MjlmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzE1ICAgICAgICAgICAgICAgICAgICAgICAwLjk5OTc1OGYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMTYgICAgICAgICAgICAgICAgICAgICAgIDAuOTk5NjU4ZgotI2RlZmluZSBBTFBIQV9GbG9hdF8xNyAgICAgICAgICAgICAgICAgICAgICAgMC45OTk1MTZmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzE4ICAgICAgICAgICAgICAgICAgICAgICAwLjk5OTMxNmYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMTkgICAgICAgICAgICAgICAgICAgICAgIDAuOTk5MDMzZgotI2RlZmluZSBBTFBIQV9GbG9hdF8yMCAgICAgICAgICAgICAgICAgICAgICAgMC45OTg2MzNmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzIxICAgICAgICAgICAgICAgICAgICAgICAwLjk5ODA2N2YKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMjIgICAgICAgICAgICAgICAgICAgICAgIDAuOTk3MjY4ZgotI2RlZmluZSBBTFBIQV9GbG9hdF8yMyAgICAgICAgICAgICAgICAgICAgICAgMC45OTYxMzlmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzI0ICAgICAgICAgICAgICAgICAgICAgICAwLjk5NDU0NWYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMjUgICAgICAgICAgICAgICAgICAgICAgIDAuOTkyMjk1ZgotI2RlZmluZSBBTFBIQV9GbG9hdF8yNiAgICAgICAgICAgICAgICAgICAgICAgMC45ODkxMjNmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzI3ICAgICAgICAgICAgICAgICAgICAgICAwLjk4NDY1NGYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMjggICAgICAgICAgICAgICAgICAgICAgIDAuOTc4MzcwZgotI2RlZmluZSBBTFBIQV9GbG9hdF8yOSAgICAgICAgICAgICAgICAgICAgICAgMC45Njk1NTNmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzMwICAgICAgICAgICAgICAgICAgICAgICAwLjk1NzIyMWYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMzEgICAgICAgICAgICAgICAgICAgICAgIDAuOTQwMDUxZgotI2RlZmluZSBBTFBIQV9GbG9hdF8zMiAgICAgICAgICAgICAgICAgICAgICAgMC45MTYyOTdmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzMzICAgICAgICAgICAgICAgICAgICAgICAwLjg4MzcyOWYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMzQgICAgICAgICAgICAgICAgICAgICAgIDAuODM5NjQ1ZgotI2RlZmluZSBBTFBIQV9GbG9hdF8zNSAgICAgICAgICAgICAgICAgICAgICAgMC43ODEwMzZmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzM2ICAgICAgICAgICAgICAgICAgICAgICAwLjcwNTA3OGYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfMzcgICAgICAgICAgICAgICAgICAgICAgIDAuNjEwMTA4ZgotI2RlZmluZSBBTFBIQV9GbG9hdF8zOCAgICAgICAgICAgICAgICAgICAgICAgMC40OTcyMzlmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzM5ICAgICAgICAgICAgICAgICAgICAgICAwLjM3MjM0M2YKLSNkZWZpbmUgQUxQSEFfRmxvYXRfNDAgICAgICAgICAgICAgICAgICAgICAgIDAuMjQ3MzUxZgotI2RlZmluZSBBTFBIQV9GbG9hdF80MSAgICAgICAgICAgICAgICAgICAgICAgMC4xMzg3MjJmCi0jZGVmaW5lIEFMUEhBX0Zsb2F0XzQyICAgICAgICAgICAgICAgICAgICAgICAwLjA2MTIzNGYKLSNkZWZpbmUgQUxQSEFfRmxvYXRfNDMgICAgICAgICAgICAgICAgICAgICAgIDAuMDE5MjY3ZgotI2RlZmluZSBBTFBIQV9GbG9hdF80NCAgICAgICAgICAgIC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l9UaW1lQ29uc3RhbnQuY3BwCkBAIC01Niw4MyArNTYsMzcgQEAKIC8qICBBbHBoYSAgIC0gdGhlIGZpbHRlciBjb2VmZmljaWVudCBRMzEgZm9ybWF0ICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9GTE9BVCBMVk1fTWl4ZXJfVGltZUNvbnN0YW50KExWTV9VSU5UMzIgICB0YywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDMyICAgRnMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiAgIE51bUNoYW5uZWxzKQotewotCi0gICAgTFZNX1VJTlQzMiAgUHJvZHVjdDsKLSAgICBMVk1fRkxPQVQgIFByb2R1Y3RGbG9hdDsKLSAgICBMVk1fSU5UMTYgICBJbnRlcnBvbGF0ZVNob3J0OwotICAgIExWTV9GTE9BVCAgIEludGVycG9sYXRlOwotICAgIExWTV9VSU5UMTYgIFNoaWZ0OwotICAgIExWTV9GTE9BVCAgIERpZmY7Ci0gICAgTFZNX0ZMT0FUICBUYWJsZVtdID0ge0FMUEhBX0Zsb2F0XzAsICAgICAgICAgICAgIC8qIExvZyBzcGFjZWQgbG9vay11cCB0YWJsZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8xLAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8yLAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8zLAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF80LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF81LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF82LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF83LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF84LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF85LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8xMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfMTEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzEyLAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8xMywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfMTQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzE1LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8xNiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfMTcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzE4LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8xOSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfMjAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzIxLAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8yMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfMjMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzI0LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8yNSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfMjYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzI3LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8yOCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfMjksCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzMwLAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8zMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfMzIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzMzLAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8zNCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfMzUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzM2LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF8zNywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfMzgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzM5LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF80MCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfNDEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzQyLAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF80MywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfNDQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIEFMUEhBX0Zsb2F0XzQ1LAotICAgICAgICAgICAgICAgICAgICAgICAgICBBTFBIQV9GbG9hdF80NiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgQUxQSEFfRmxvYXRfNDcsCi0gICAgICA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PSAtMS4wZikKLSAgICB7CisgICAgaWYgKFggPT0gLTEuMGYpIHsKICAgICAgICAgVGVtcCA9IC0xOwogICAgICAgICBzaWduID0gVGVtcDsKLSAgICAgICAgZm9yKGkgPSAxOyBpIDw9IE47IGkrKykKLSAgICAgICAgeworICAgICAgICBmb3IgKGkgPSAxOyBpIDw9IE47IGkrKykgewogICAgICAgICAgICAgWSArPSAoKCpwQ29lZmZpY2llbnRzKSAqIHNpZ24pOwogICAgICAgICAgICAgcENvZWZmaWNpZW50cysrOwogICAgICAgICAgICAgc2lnbiAqPSBUZW1wOwogICAgICAgICB9CiAKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKKyAgICB9IGVsc2UgewogICAgICAgICBYVGVtcCA9IFg7Ci0gICAgICAgIGZvcihpID0gTi0xOyBpID49IDA7IGktLSkKLSAgICAgICAgeworICAgICAgICBmb3IgKGkgPSBOIC0gMTsgaSA+PSAwOyBpLS0pIHsKICAgICAgICAgICAgIEEgPSAqcENvZWZmaWNpZW50czsKICAgICAgICAgICAgIHBDb2VmZmljaWVudHMrKzsKIApkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZNX1Bvd2VyMTAuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZNX1Bvd2VyMTAuY3BwCmluZGV4IGFlOGU5ZDEuLjg1NTk2YWEgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWTV9Qb3dlcjEwLmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVk1fUG93ZXIxMC5jcHAKQEAgLTUzLDIzICs1MywxMCBAQAogLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgVGhlIHJlc3VsdCBvZiB0aGUgMTB4IGV4cGFuc2lvbiBpbiBROC4yNCBmb3JtYXQgICAgICAgICAgICAgICAgICAgICAgICovCiAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotTFZNX0ZMT0FUIExWTV9Qb3dlcjEwKExWTV9GTE9BVCAgICAgWCkKLXsKLSAgICBMVk1fRkxPQVQgWSxDb2VmZmljaWVudHNbMTNdPXswLjk5OTkwNmYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMi4zMDI0NzVmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIuNjUyNzY1ZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjAzNTQ5NGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4xNjU2NjdmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuNTM3Njc2ZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjIxMzE5MmYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wNjk2MDNmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDE2NTUzZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwNDM3M2YsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDE4MTdmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMzY3ZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwfTsKLSAgICBZPUxWTV9Qb2x5bm9taWFsKChMVk1fVUlOVDE2KTExLAotICAgICAgICAgICAgICAgICAgICAgQ29lZmZpY2llbnRzLAotICAgICAgICAgICAgICAgICAgICAgWCk7CitMVk1fRkxPQVQgTFZNX1Bvd2VyMTAoTFZNX0ZMT0FUIFgpIHsKKyAgICBMVk1fRkxPQVQgWSwgQ29lZmZpY2llbnRzWzEzXSA9IHswLjk5OTkwNmYsIDIuMzAyNDc1ZiwgMi42NTI3NjVmLCAyLjAzNTQ5NGYsIDEuMTY1NjY3ZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjUzNzY3NmYsIDAuMjEzMTkyZiwgMC4wNjk2MDNmLCAwLjAxNjU1M2YsIDAuMDA0MzczZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMTgxN2YsIDAuMDAwMzY3ZiwgMH07CisgICAgWSA9IExWTV9Qb2x5bm9taWFsKChMVk1fVUlOVDE2KTExLCBDb2VmZmljaWVudHMsIFgpOwogICAgIHJldHVybiBZOwogfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZNX1RpbWVyLmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWTV9UaW1lci5jcHAKaW5kZXggNTk5NWY1NC4uYmU3YzhlNCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZNX1RpbWVyLmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVk1fVGltZXIuY3BwCkBAIC0yNiwxOSArMjYsMTYgQEAKIC8qICBUSU1FUiBGVU5DVElPTiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLXZvaWQgTFZNX1RpbWVyICAgICAgKCAgIExWTV9UaW1lcl9JbnN0YW5jZV90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICBCbG9ja1NpemUgKXsKK3ZvaWQgTFZNX1RpbWVyKExWTV9UaW1lcl9JbnN0YW5jZV90KiBwSW5zdGFuY2UsIExWTV9JTlQxNiBCbG9ja1NpemUpIHsKKyAgICBMVk1fVGltZXJfSW5zdGFuY2VfUHJpdmF0ZV90KiBwSW5zdGFuY2VQcjsKKyAgICBwSW5zdGFuY2VQciA9IChMVk1fVGltZXJfSW5zdGFuY2VfUHJpdmF0ZV90KilwSW5zdGFuY2U7CiAKLSAgICBMVk1fVGltZXJfSW5zdGFuY2VfUHJpdmF0ZV90ICpwSW5zdGFuY2VQcjsKLSAgICBwSW5zdGFuY2VQciA9IChMVk1fVGltZXJfSW5zdGFuY2VfUHJpdmF0ZV90ICopcEluc3RhbmNlOwotCi0gICAgaWYgKHBJbnN0YW5jZVByLT5UaW1lckFybWVkKXsKKyAgICBpZiAocEluc3RhbmNlUHItPlRpbWVyQXJtZWQpIHsKICAgICAgICAgcEluc3RhbmNlUHItPlJlbWFpbmluZ1RpbWVJblNhbXBsZXMgLT0gQmxvY2tTaXplOwotICAgICAgICBpZiAocEluc3RhbmNlUHItPlJlbWFpbmluZ1RpbWVJblNhbXBsZXMgPD0gMCl7CisgICAgICAgIGlmIChwSW5zdGFuY2VQci0+UmVtYWluaW5nVGltZUluU2FtcGxlcyA8PSAwKSB7CiAgICAgICAgICAgICBwSW5zdGFuY2VQci0+VGltZXJBcm1lZCA9IDA7Ci0gICAgICAgICAgICAoKnBJbnN0YW5jZVByLT5wQ2FsbEJhY2spICggcEluc3RhbmNlUHItPnBDYWxsYmFja0luc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBJbnN0YW5jZVByLT5wQ2FsbEJhY2tQYXJhbXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcEluc3RhbmNlUHItPkNhbGxCYWNrUGFyYW0gKTsKKyAgICAgICAgICAgICgqcEluc3RhbmNlUHItPnBDYWxsQmFjaykocEluc3RhbmNlUHItPnBDYWxsYmFja0luc3RhbmNlLCBwSW5zdGFuY2VQci0+cENhbGxCYWNrUGFyYW1zLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwSW5zdGFuY2VQci0+Q2FsbEJhY2tQYXJhbSk7CiAgICAgICAgIH0KICAgICB9CiB9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVk1fVGltZXJfSW5pdC5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVk1fVGltZXJfSW5pdC5jcHAKaW5kZXggMzAxNTA1Ny4uYmZkNmJjZiAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZNX1RpbWVyX0luaXQuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWTV9UaW1lcl9Jbml0LmNwcApAQCAtMzMsMjAgKzMzLDIwIEBACiAvKiAgSU5JVCBGVU5DVElPTiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi12b2lkIExWTV9UaW1lcl9Jbml0ICggICBMVk1fVGltZXJfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1RpbWVyX1BhcmFtc190ICAgICAgICAgKnBQYXJhbXMgICAgICl7Cit2b2lkIExWTV9UaW1lcl9Jbml0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klOVE8zMihwUGFyYW1zLT5TYW1wbGluZ1JhdGUsT25lT3ZlclRob3VzYW5kSW5RMjQscEluc3RhbmNlUHItPlJlbWFpbmluZ1RpbWVJblNhbXBsZXMsMTYpOyAgLyogKFEwICogUTI0KSA+PjE2IGludG8gUTgqLwotICAgIE1VTDMyeDE2SU5UTzMyKHBJbnN0YW5jZVByLT5SZW1haW5pbmdUaW1lSW5TYW1wbGVzLHBQYXJhbXMtPlRpbWVJbk1zLHBJbnN0YW5jZVByLT5SZW1haW5pbmdUaW1lSW5TYW1wbGVzLDgpOyAgLyogKFE4ICogUTApID4+OCBpbnRvIFEwKi8KKyAgICBNVUwzMngxNklOVE8zMihwUGFyYW1zLT5TYW1wbGluZ1JhdGUsIE9uZU92ZXJUaG91c2FuZEluUTI0LCBwSW5zdGFuY2VQci0+UmVtYWluaW5nVGltZUluU2FtcGxlcywKKyAgICAgICAgICAgICAgICAgICAxNik7IC8qIChRMCAqIFEyNCkgPj4xNiBpbnRvIFE4Ki8KKyAgICBNVUwzMngxNklOVE8zMihwSW5zdGFuY2VQci0+UmVtYWluaW5nVGltZUluU2FtcGxlcywgcFBhcmFtcy0+VGltZUluTXMsCisgICAgICAgICAgICAgICAgICAgcEluc3RhbmNlUHItPlJlbWFpbmluZ1RpbWVJblNhbXBsZXMsIDgpOyAvKiAoUTggKiBRMCkgPj44IGludG8gUTAqLwogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWTV9UaW1lcl9Qcml2YXRlLmggYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9MVk1fVGltZXJfUHJpdmF0ZS5oCmluZGV4IGEzNzJiODIuLjNlOGFiYTggMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL0xWTV9UaW1lcl9Qcml2YXRlLmgKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTFZNX1RpbWVyX1ByaXZhdGUuaApAQCAtMjQsMTQgKzI0LDEzIEBACiAvKiAgVFlQRSBERUZJTklUSU9OUyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9JTlQzMiAgUmVtYWluaW5nVGltZUluU2FtcGxlczsKLSAgICBMVk1fSU5UMzIgIENhbGxCYWNrUGFyYW07Ci0gICAgTFZNX0lOVDMyICAqcENhbGxCYWNrUGFyYW1zOwotICAgIHZvaWQgICpwQ2FsbGJhY2tJbnN0YW5jZTsKLSAgICB2b2lkICAoKnBDYWxsQmFjaykodm9pZCosdm9pZCosTFZNX0lOVDMyKTsKLSAgICBMVk1fSU5UMTYgVGltZXJBcm1lZDsgICAgICAgICAgICAgICAgICAgICAgICAvKiBCb29sZWFuLCB0cnVlIGJldHdlZW4gaW5pdCBhbmQgY2FsbGJhY2sgKi8KK3R5cGVkZWYgc3RydWN0IHsKKyAgICBMVk1fSU5UMzIgUmVtYWluaW5nVGltZUluU2FtcGxlczsKKyAgICBMVk1fSU5UMzIgQ2FsbEJhY2tQYXJhbTsKKyAgICBMVk1fSU5UMzIqIHBDYWxsQmFja1BhcmFtczsKKyAgICB2b2lkKiBwQ2FsbGJhY2tJbnN0YW5jZTsKKyAgICB2b2lkICgqcENhbGxCYWNrKSh2b2lkKiwgdm9pZCosIExWTV9JTlQzMik7CisgICAgTFZNX0lOVDE2IFRpbWVyQXJtZWQ7IC8qIEJvb2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aWNlbnNlLgotICogWW91IG1heSBvYnRhaW4gYSBjb3B5IG9mIHRoZSBMaWNlbnNlIGF0Ci0gKgotICogICAgICBodHRwOi8vd3d3LmFwYWNoZS5vcmcvbGljZW5zZXMvTElDRU5TRS0yLjAKLSAqCi0gKiBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlCi0gKiBkaXN0cmlidXRlZCB1bmRlciB0aGUgTGljZW5zZSBpcyBkaXN0cmlidXRlZCBvbiBhbiAiQVMgSVMiIEJBU0lTLAotICogV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuCi0gKiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCi0gKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KLSAqLwotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgSU5DTFVERSBGSUxFUwotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSNpbmNsdWRlICJWZWN0b3JBcml0aG1ldGljLmgiCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICBGVU5DVElPTiBMb2FkQ29uc3RfMTYKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIExvYWRDb25z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kgb2YgdGhlIExpY2Vuc2UgYXQKLSAqCi0gKiAgICAgIGh0dHA6Ly93d3cuYXBhY2hlLm9yZy9saWNlbnNlcy9MSUNFTlNFLTIuMAotICoKLSAqIFVubGVzcyByZXF1aXJlZCBieSBhcHBsaWNhYmxlIGxhdyBvciBhZ3JlZWQgdG8gaW4gd3JpdGluZywgc29mdHdhcmUKLSAqIGRpc3RyaWJ1dGVkIHVuZGVyIHRoZSBMaWNlbnNlIGlzIGRpc3RyaWJ1dGVkIG9uIGFuICJBUyBJUyIgQkFTSVMsCi0gKiBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4KLSAqIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQKLSAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLgotICovCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICBJTkNMVURFIEZJTEVTCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotI2luY2x1ZGUgIlZlY3RvckFyaXRobWV0aWMuaCIKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIEZVTkNUSU9OIExvYWRDb25zdF8zMgotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIExvYWRDb25zdF9GbG9hdChjb25zdCBMVk1fRkxPQVQgICB2YWwsCi0gICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbiApCi17Ci0gICAgTFZNX0lOVDE2IGlpOwotCi0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICAqZHN0ID0gdmFsOwotICAgICAgICBkc3QrKzsKLSAgICB9Ci0KLSAgICByZXR1cm47Ci19Ci0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTVNUbzJpX1NhdF8xNngxNi5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9NU1RvMmlfU2F0XzE2eDE2LmNwcAppbmRleCAxZWE3NjVhLi5lNWM2ZjE1IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9NU1RvMmlfU2F0XzE2eDE2LmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9NU1RvMmlfU2F0XzE2eDE2LmNwcApAQCAtMTgsNzQgKzE4LDE0IEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgSU5DTFVERSBGSUxFUwogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KKyNpbmNsdWRlICJTY2FsYXJBcml0aG1ldGljLmgiCiAjaW5jbHVkZSAiVmVjdG9yQXJpdGhtZXRpYy5oIgogCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gIE1TVE8ySV9TQVRfMTZYMTYKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIE1TVG8yaV9TYXRfMTZ4MTYoY29uc3QgTFZNX0lOVDE2ICAqc3JjTSwKLSAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fSU5UMTYgICpzcmNTLAotICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgIG4gKQotewotICAgIExWTV9JTlQzMiB0ZW1wLG1WYWwsc1ZhbDsKK3ZvaWQgTVNUbzJpX1NhdF9GbG9hdChjb25zdCBMVk1fRkxPQVQqIHNyY00sIGNvbnN0IExWTV9GTE9BVCogc3JjUywgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBuKSB7CisgICAgTFZNX0ZMT0FUIHRlbXAsIG1WYWwsIHNWYWw7CiAgICAgTFZNX0lOVDE2IGlpOwogCi0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICBtVmFsPShMVk1fSU5UMzIpKnNyY007Ci0gICAgICAgIHNyY00rKzsKLQotICAgICAgICBzVmFsPShMVk1fSU5UMzIpKnNyY1M7Ci0gICAgICAgIHNyY1MrKzsKLQotICAgICAgICB0ZW1wID0gbVZhbCArIHNWYWw7Ci0KLSAgICAgICAgaWYgKHRlbXAgPiAweDAwMDA3RkZGKQotICAgICAgICB7Ci0gICAgICAgICAgICAqZHN0ID0gMHg3RkZGOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UgaWYgKHRlbXAgPCAtMHgwMDAwODAwMCkKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9IC0gMHg4MDAwOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9IChMVk1fSU5UMTYpdGVtcDsKLSAgICAgICAgfQotICAgICAgICBkc3QrKzsKLQotICAgICAgICB0ZW1wID0gbVZhbCAtIHNWYWw7Ci0KLSAgICAgICAgaWYgKHRlbXAgPiAweDAwMDA3RkZGKQotICAgICAgICB7Ci0gICAgICAgICAgICAqZHN0ID0gMHg3RkZGOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UgaWYgKHRlbXAgPCAtMHgwMDAwODAwMCkKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9IC0gMHg4MDAwOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgKmRzdCA9IChMVk1fSU5UMTYpdGVtcDsKLSAgICAgICAgfQotICAgICAgICBkc3QrKzsKLSAgICB9Ci0KLSAgICByZXR1cm47Ci19Ci12b2lkIE1TVG8yaV9TYXRfRmxvYXQoY29uc3QgTFZNX0ZMT0FUICAqc3JjTSwKLSAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICpzcmNTLAotICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgKmRzdCwKLSAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgIG4gKQotewotICAgIExWTV9GTE9BVCB0ZW1wLG1WYWwsc1ZhbDsKLSAgICBMVk1fSU5UMTYgaWk7Ci0KLSAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkKLSAgICB7CisgICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pIHsKICAgICAgICAgbVZhbCA9IChMVk1fRkxPQVQpKnNyY007CiAgICAgICAgIHNyY00rKzsKIApAQCAtOTMsMzggKzMzLDExIEBACiAgICAgICAgIHNyY1MrKzsKIAogICAgICAgICB0ZW1wID0gbVZhbCArIHNWYWw7Ci0KLSAgICAgICAgaWYgKHRlbXAgPiAxLjBmKQotICAgICAgICB7Ci0gICAgICAgICAgICAqZHN0ID0gMS4wZjsKLSAgICAgICAgfQotICAgICAgICBlbHNlIGlmICh0ZW1wIDwgLTEuMGYpCi0gICAgICAgIHsKLSAgICAgICAgICAgICpkc3QgPSAtMS4wZjsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgICpkc3QgPSAoTFZNX0ZMT0FUKXRlbXA7Ci0gICAgICAgIH0KLSAgICAgICAgZHN0Kys7CisgICAgICAgICpkc3QrKyA9IExWTV9DbGFtcCh0ZW1wKTsKIAogICAgICAgICB0ZW1wID0gbVZhbCAtIHNWYWw7Ci0KLSAgICAgICAgaWYgKHRlbXAgPiAxLjBmKQotICAgICAgICB7Ci0gICAgICAgICAgICAqZHN0ID0gMS4wZjsKLSAgICAgICAgfQotICAgICAgICBlbHNlIGlmICh0ZW1wIDwgLTEuMGYpCi0gICAgICAgIHsKLSAgICAgICAgICAgICpkc3QgPSAtIDEuMGY7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICAqZHN0ID0gKExWTV9GTE9BVCl0ZW1wOwotICAgICAgICB9Ci0gICAgICAgIGRzdCsrOworICAgICAgICAqZHN0KysgPSBMVk1fQ2xhbXAodGVtcCk7CiAgICAgfQogCiAgICAgcmV0dXJuOwogfQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9NYWMzc19TYXRfMTZ4MTYuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTWFjM3NfU2F0XzE2eDE2LmNwcApkZWxldGVkIGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggNjU4NDI1MS4uMDAwMDAwM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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLQotICAgICAlY3JlYXRlZF9ieTogICAgc3JhICUgKENNL1MpCi0gICAgICVuYW1lOiAgICAgICAgICBNYWMzc19TYXRfMTZ4MTYuYyAlIChDTS9TKQotICAgICAldmVyc2lvbjogICAgICAgMSAlIChDTS9TKQotICAgICAlZGF0ZV9jcmVhdGVkOiAgRnJpIE5vdiAxMyAxMjowNzoxMyAyMDA5ICUgKENNL1MpCi0KLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgSU5DTFVERSBGSUxFUwotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSNpbmNsdWRlICJWZWN0b3JBcml0aG1ldGljLmgiCi0jaW5jbHVkZSAiTFZNX01hY3Jvcy5oIgotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gTWFjM1NfMTZYMTYKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIE1hYzNzX1NhdF8xNngxNiggY29uc3QgTFZNX0lOVDE2ICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fSU5UMTYgdmFsLAotICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbikKLXsKLSAgICBMVk1fSU5UM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AorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9NYWMzc19TYXRfMzJ4MTYuY3BwCkBAIC0xOCw4NSArMTgsMTkgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBJTkNMVURFIEZJTEVTCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQorI2luY2x1ZGUgIlNjYWxhckFyaXRobWV0aWMuaCIKICNpbmNsdWRlICJWZWN0b3JBcml0aG1ldGljLmgiCiAjaW5jbHVkZSAiTFZNX01hY3Jvcy5oIgogCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gTUFDM1NfMTZYMTYKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIE1hYzNzX1NhdF8zMngxNiggIGNvbnN0IExWTV9JTlQzMiAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0lOVDE2IHZhbCwKLSAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQzMiAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IG4pCi17Cit2b2lkIE1hYzNzX1NhdF9GbG9hdChjb25zdCBMVk1fRkxPQVQqIHNyYywgY29uc3QgTFZNX0ZMT0FUIHZhbCwgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBuKSB7CiAgICAgTFZNX0lOVDE2IGlpOwotICAgIExWTV9JTlQzMiBzcmN2YWwsdGVtcCwgZEluVmFsLCBkT3V0VmFsOwogCi0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICBzcmN2YWw9KnNyYzsKLSAgICAgICAgc3JjKys7CisgICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pIHsKKyAgICAgICAgTFZNX0ZMT0FUIFRlbXAgPSAqc3JjKysgKiB2YWw7CisgICAgICAgIFRlbXAgKz0gKmRzdDsKIAotICAgICAgICBNVUwzMngxNklOVE8zMihzcmN2YWwsdmFsLHRlbXAsMTUpCi0KLSAgICAgICAgICAgIGRJblZhbCAgPSAqZHN0OwotICAgICAgICBkT3V0VmFsID0gdGVtcCArIGRJblZhbDsKLQotICAgICAgICBpZiAoKCgoZE91dFZhbCBeIHRlbXApICYgKGRPdXRWYWwgXiBkSW5WYWwpKSA+PiAzMSkhPTApICAgICAvKiBvdmVyZmxvdyAvIHVuZGVyZmxvdyAqLwotICAgICAgICB7Ci0gICAgICAgICAgICBpZih0ZW1wPDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgZE91dFZhbD0weDgwMDAwMDAwTDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBkT3V0VmFsPTB4N0ZGRkZGRkZMOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgKmRzdCA9IGRPdXRWYWw7Ci0gICAgICAgIGRzdCsrOworICAgICAgICAqZHN0KysgPSBMVk1fQ2xhbXAoVGVtcCk7CiAgICAgfQogCiAgICAgcmV0dXJuOwogfQotdm9pZCBNYWMzc19TYXRfRmxvYXQoY29uc3QgTFZNX0ZMT0FUICpzcmMsCi0gICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgdmFsLAotICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgbikKLXsKLSAgICBMVk1fSU5UMTYgaWk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vbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTWl4SW5Tb2Z0X0QzMkMzMV9TQVQuY3BwCkBAIC0yNiwzMyArMjYsMjkgQEAKICAgIERFRklOSVRJT05TCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotI2RlZmluZSBUUlVFICAgICAgICAgIDEKLSNkZWZpbmUgRkFMU0UgICAgICAgICAwCisjZGVmaW5lIFRSVUUgMQorI2RlZmluZSBGQUxTRSAwCiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBGVU5DVElPTiBNSVhJTlNPRlRfRDMyQzMxX1NBVAogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIE1peEluU29mdF9EMzJDMzFfU0FUKCBNaXhfMVN0X0NsbF9GTE9BVF90ICAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICBuKQotewordm9pZCBNaXhJblNvZnRfRDMyQzMxX1NBVChNaXhfMVN0X0NsbF9GTE9BVF90KiBwSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogc3JjLCBMVk1fRkxPQVQqIGRzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IG4pIHsKICAgICBjaGFyIEhhcmRNaXhpbmcgPSBUUlVFOwogCi0gICAgaWYobiA8PSAwKSAgICByZXR1cm47CisgICAgaWYgKG4gPD0gMCkgcmV0dXJuOwogCiAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgICAgIFNPRlQgTUlYSU5HCiAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICBpZiAocEluc3RhbmNlLT5DdXJyZW50ICE9IHBJbnN0YW5jZS0+VGFyZ2V0KQotICAgIHsKLSAgICAgICAgaWYocEluc3RhbmNlLT5BbHBoYSA9PSAwKXsKKyAgICBpZiAocEluc3RhbmNlLT5DdXJyZW50ICE9IHBJbnN0YW5jZS0+VGFyZ2V0KSB7CisgICAgICAgIGlmIChwSW5zdGFuY2UtPkFscGhhID09IDApIHsKICAgICAgICAgICAgIHBJbnN0YW5jZS0+Q3VycmVudCA9IHBJbnN0YW5jZS0+VGFyZ2V0OwotICAgICAgICB9ZWxzZSBpZiAoKHBJbnN0YW5jZS0+Q3VycmVudC1wSW5zdGFuY2UtPlRhcmdldCA8IFBPSU5UX1pFUk9fT05FX0RCX0ZMT0FUKSAmJgotICAgICAgICAgICAgICAgICAocEluc3RhbmNlLT5DdXJyZW50LXBJbnN0YW5jZS0+VGFyZ2V0ID4gLVBPSU5UX1pFUk9fT05FX0RCX0ZMT0FUKSl7CisgICAgICAgIH0gZWxzZSBpZiAoKHBJbnN0YW5jZS0+Q3VycmVudCAtIHBJbnN0YW5jZS0+VGFyZ2V0IDwgUE9JTlRfWkVST19PTkVfREJfRkxPQVQpICYmCisgICAgICAgICAgICAgICAgICAgKHBJbnN0YW5jZS0+Q3VycmVudCAtIHBJbnN0YW5jZS0+VGFyZ2V0ID4gLVBPSU5UX1pFUk9fT05FX0RCX0ZMT0FUKSkgewogICAgICAgICAgICAgcEluc3RhbmNlLT5DdXJyZW50ID0gcEluc3RhbmNlLT5UYXJnZXQ7IC8qIERpZmZlcmVuY2UgaXMgbm90IHNpZ25pZmljYW50IGFueW1vcmUuIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYWtlIHRoZW0gZXF1YWwuICovCi0gICAgICAgIH1lbHNleworICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgLyogU29mdCBtaXhpbmcgaGFzIHRvIGJlIGFwcGxpZWQgKi8KICAgICAgICAgICAgIEhhcmRNaXhpbmcgPSBGQUxTRTsKICAgICAgICAgICAgIENvcmVfTWl4SW5Tb2Z0X0QzMkMzMV9TQVQocEluc3RhbmNlLCBzcmMsIGRzdCwgbik7CkBAIC02MywxMSArNTksMTEgQEAKICAgICAgICBIQVJEIE1JWElORwogICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSAgICBpZiAoSGFyZE1peGluZyl7Ci0gICAgICAgIGlmIChwSW5zdGFuY2UtPlRhcmdldCAhPSAwKXsgLyogTm90aGluZyB0byBkbyBpbiBjYXNlIFRhcmdldCA9IDAgKi8KKyAgICBpZiAoSGFyZE1peGluZykgeworICAgICAgICBpZiAocEluc3RhbmNlLT5UYXJnZXQgIT0gMCkgeyAvKiBOb3RoaW5nIHRvIGRvIGluIGNhc2UgVGFyZ2V0ID0gMCAqLwogICAgICAgICAgICAgaWYgKChwSW5zdGFuY2UtPlRhcmdldCkgPT0gMS4wZikKICAgICAgICAgICAgICAgICBBZGQyX1NhdF9GbG9hdChzcmMsIGRzdCwgbik7Ci0gICAgICAgICAgICBlbHNleworICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgQ29yZV9NaXhJblNvZnRfRDMyQzMxX1NBVChwSW5zdGFuY2UsIHNyYywgZHN0LCBuKTsKICAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPkN1cnJlbnQgPSBwSW5zdGFuY2UtPlRhcmd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C0xOSw2ICsxOSw3IEBACiAgICBJTkNMVURFIEZJTEVTCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAorI2luY2x1ZGUgPHN0cmluZy5oPgogI2luY2x1ZGUgIk1peGVyX3ByaXZhdGUuaCIKICNpbmNsdWRlICJWZWN0b3JBcml0aG1ldGljLmgiCiAKQEAgLTI2LDMzICsyNywyOSBAQAogICAgREVGSU5JVElPTlMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0jZGVmaW5lIFRSVUUgICAgICAgICAgMQotI2RlZmluZSBGQUxTRSAgICAgICAgIDAKKyNkZWZpbmUgVFJVRSAxCisjZGVmaW5lIEZBTFNFIDAKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgIEZVTkNUSU9OIE1JWFNPRlRfMVNUX0QzMkMzMV9XUkEKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBNaXhTb2Z0XzFTdF9EMzJDMzFfV1JBKCAgICBNaXhfMVN0X0NsbF9GTE9BVF90ICAgICAgICpwSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgKnNyYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgIG4pCi17Cit2b2lkIE1peFNvZnRfMVN0X0QzMkMzMV9XUkEoTWl4XzFTdF9DbGxfRkxPQVRfdCogcEluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHNyYywgTFZNX0ZMT0FUKiBkc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IG4pIHsKICAgICBjaGFyIEhhcmRNaXhpbmcgPSBUUlVFOwogCi0gICAgaWYobiA8PSAwKSAgICByZXR1cm47CisgICAgaWYgKG4gPD0gMCkgcmV0dXJuOwogCiAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgICAgIFNPRlQgTUlYSU5HCiAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICBpZiAocEluc3RhbmNlLT5DdXJyZW50ICE9IHBJbnN0YW5jZS0+VGFyZ2V0KQotICAgIHsKLSAgICAgICAgaWYocEluc3RhbmNlLT5BbHBoYSA9PSAwKXsKKyAgICBpZiAocEluc3RhbmNlLT5DdXJyZW50ICE9IHBJbnN0YW5jZS0+VGFyZ2V0KSB7CisgICAgICAgIGlmIChwSW5zdGFuY2UtPkFscGhhID09IDApIHsKICAgICAgICAgICAgIHBJbnN0YW5jZS0+Q3VycmVudCA9IHBJbnN0YW5jZS0+VGFyZ2V0OwotICAgICAgICB9ZWxzZSBpZiAoKHBJbnN0YW5jZS0+Q3VycmVudCAtIHBJbnN0YW5jZS0+VGFyZ2V0IDwgUE9JTlRfWkVST19PTkVfREJfRkxPQVQpICYmCi0gICAgICAgICAgICAgICAgIChwSW5zdGFuY2UtPkN1cnJlbnQgLSBwSW5zdGFuY2UtPlRhcmdldCA+IC1QT0lOVF9aRVJPX09ORV9EQl9GTE9BVCkpeworICAgICAgICB9IGVsc2UgaWYgKChwSW5zdGFuY2UtPkN1cnJlbnQgLSBwSW5zdGFuY2UtPlRhcmdldCA8IFBPSU5UX1pFUk9fT05FX0RCX0ZMT0FUKSAmJgorICAgICAgICAgICAgICAgICAgIChwSW5zdGFuY2UtPkN1cnJlbnQgLSBwSW5zdGFuY2UtPlRhcmdldCA+IC1QT0lOVF9aRVJPX09ORV9EQl9GTE9BVCkpIHsKICAgICAgICAgICAgIHBJbnN0YW5jZS0+Q3VycmVudCA9IHBJbnN0YW5jZS0+VGFyZ2V0OyAvKiBEaWZmZXJlbmNlIGlzIG5vdCBzaWduaWZpY2FudCBhbnltb3JlLiBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFrZSB0aGVtIGVxdWFsLiAqLwotICAgICAgICB9ZWxzZXsKKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIC8qIFNvZnQgbWl4aW5nIGhhcyB0byBiZSBhcHBsaWVkICovCiAgICAgICAgICAgICBIYXJkTWl4aW5nID0gRkFMU0U7CiAgICAgICAgICAgICBDb3JlX01peFNvZnRfMVN0X0QzMkMzMV9XUkEocEluc3RhbmNlLCBzcmMsIGRzdCwgbik7CkBAIC02MywxNCArNjAsMTIgQEAKICAgICAgICBIQVJEIE1JWElORwogICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSAgICBpZiAoSGFyZE1peGluZyl7CisgICAgaWYgKEhhcmRNaXhpbmcpIHsKICAgICAgICAgaWYgKHBJbnN0YW5jZS0+VGFyZ2V0ID09IDApCi0gICAgICAgICAgICBMb2FkQ29uc3RfRmxvYXQoMCwgZHN0LCBuKTsKLSAgICAgICAgZWxzZSBpZiAoKHBJbnN0YW5jZS0+VGFyZ2V0KSA9PSAxLjBmKXsKLSAgICAgICAgICAgIGlmIChzcmMgIT0gZHN0KQotICAgICAgICAgICAgICAgIENvcHlfRmxvYXQoKExWTV9GTE9BVCopc3JjLCAoTFZNX0ZMT0FUKilkc3QsIChMVk1fSU5UMTYpKG4pKTsKLSAgICAgICAgfQotICAgICAgICBlbHNlCisgICAgICAgICAgICBtZW1zZXQoZHN0LCAwLCBuICogc2l6ZW9mKCpkc3QpKTsKKyAgICAgICAgZWxzZSBpZiAoKHBJbnN0YW5jZS0+VGFyZ2V0KSA9PSAxLjBmKSB7CisgICAgICAgICAgICBpZiAoc3JjICE9IGRzdCkgQ29weV9GbG9hdCgoTFZNX0ZMT0FUKilzcmMsIChMVk1fRkxPQVQqKWRzdCwgKExWTV9JTlQxNikobikpOworICAgICAgICB9IGVsc2UKICAgICAgICAgICAgIE11bHQzc19GbG9hdChzcmMsIHBJbnN0YW5jZS0+Q3VycmVudCwgZHN0LCBuKTsKICAgICB9CiAKQEAgLTc4LDE2ICs3MywxNSBAQAogICAgICAgIENBTEwgQkFDSwogICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSAgICBpZiAocEluc3RhbmNlLT5DYWxsYmFja1NldCl7CisgICAgaWYgKHBJbnN0YW5jZS0+Q2FsbGJhY2tTZXQpIHsKICAgICAgICAgaWYgKChwSW5zdGFuY2UtPkN1cnJlbnQgLSBwSW5zdGFuY2UtPlRhcmdldCA8IFBPSU5UX1pFUk9fT05FX0RCX0ZMT0FUKSAmJgotICAgICAgICAgICAgKHBJbnN0YW5jZS0+Q3VycmVudCAtIHBJbnN0YW5jZS0+VGFyZ2V0ID4gLVBPSU5UX1pFUk9fT05FX0RCX0ZMT0FUKSl7CisgICAgICAgICAgICAocEluc3RhbmNlLT5DdXJyZW50IC0gcEluc3RhbmNlLT5UYXJnZXQgPiAtUE9JTlRfWkVST19PTkVfREJfRkxPQVQpKSB7CiAgICAgICAgICAgICBwSW5zdGFuY2UtPkN1cnJlbnQgPSBwSW5zdGFuY2UtPlRhcmdldDsgLyogRGlmZmVyZW5jZSBpcyBub3Qgc2lnbmlmaWNhbnQgYW55bW9yZS4gXAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1ha2UgdGhlbSBlcXVhbC4gKi8KICAgICAgICAgICAgIHBJbnN0YW5jZS0+Q2FsbGJhY2tTZXQgPSBGQUxTRTsKLSAgICAgICAgICAgIGlmIChwSW5zdGFuY2UtPnBDYWxsQmFjayAhPSAwKXsKLSAgICAgICAgICAgICAgICAoKnBJbnN0YW5jZS0+cENhbGxCYWNrKSAoIHBJbnN0YW5jZS0+cENhbGxiYWNrSGFuZGxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcEluc3RhbmNlLT5wR2VuZXJhbFB1cnBvc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPkNhbGxiYWNrUGFyYW0gKTsKKyAgICAgICAgICAgIGlmIChwSW5zdGFuY2UtPnBDYWxsQmFjayAhPSAwKSB7CisgICAgICAgICAgICAgICAgKCpwSW5zdGFuY2UtPnBDYWxsQmFjaykocEluc3RhbmNlLT5wQ2FsbGJhY2tIYW5kbGUsIHBJbnN0YW5jZS0+cEdlbmVyYWxQdXJwb3NlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBJbnN0YW5jZS0+Q2FsbGJhY2tQYXJhbSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9NaXhTb2Z0XzJTdF9EMzJDMzFfU0FULmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL01peFNvZnRfMlN0X0QzMkMzMV9TQVQuY3BwCmluZGV4IGIwMDI3MzguLmFiYTg1MzcgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL01peFNvZnRfMlN0X0QzMkMzMV9TQVQuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL01peFNvZnRfMlN0X0QzMkMzMV9TQVQuY3BwCkBAIC0yNSw0MiArMjUsMzUgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBGVU5DVElPTiBNSVhTT0ZUXzJTVF9EMzJDMzFfU0FUCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgTWl4U29mdF8yU3RfRDMyQzMxX1NBVCggICAgTWl4XzJTdF9DbGxfRkxPQVRfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICpzcmMxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICpzcmMyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgbikKLXsKLQotICAgIGlmKG4gPD0gMCkgICAgcmV0dXJuOwordm9pZCBNaXhTb2Z0XzJTdF9EMzJDMzFfU0FUKE1peF8yU3RfQ2xsX0ZMT0FUX3QqIHBJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBzcmMxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCogc3JjMiwgTFZNX0ZMT0FUKiBkc3QsIExWTV9JTlQxNiBuKSB7CisgICAgaWYgKG4gPD0gMCkgcmV0dXJuOwogCiAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgICAgIFNPRlQgTUlYSU5HCiAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICBpZiAoKHBJbnN0YW5jZS0+Q3VycmVudDEgIT0gcEluc3RhbmNlLT5UYXJnZXQxKSB8fCAocEluc3RhbmNlLT5DdXJyZW50MiAhPSBwSW5zdGFuY2UtPlRhcmdldDIpKQotICAgIHsKKyAgICBpZiAoKHBJbnN0YW5jZS0+Q3VycmVudDEgIT0gcEluc3RhbmNlLT5UYXJnZXQxKSB8fAorICAgICAgICAocEluc3RhbmNlLT5DdXJyZW50MiAhPSBwSW5zdGFuY2UtPlRhcmdldDIpKSB7CiAgICAgICAgIE1peFNvZnRfMVN0X0QzMkMzMV9XUkEoKE1peF8xU3RfQ2xsX0ZMT0FUX3QqKXBJbnN0YW5jZSwgc3JjMSwgZHN0LCBuKTsKLSAgICAgICAgTWl4SW5Tb2Z0X0QzMkMzMV9TQVQoKE1peF8xU3RfQ2xsX0ZMT0FUX3QgKikmcEluc3RhbmNlLT5BbHBoYTIsIC8qIENhc3QgdG8gdm9pZDogXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBubyBkZXJlZmVyZW5jaW5nIGluIGZ1bmN0aW9uKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYzIsIGRzdCwgbik7CisgICAgICAgIE1peEluU29mdF9EMzJDMzFfU0FUKChNaXhfMVN0X0NsbF9GTE9BVF90KikmcEluc3RhbmNlLT5BbHBoYTIsIC8qIENhc3QgdG8gdm9pZDogXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vIGRlcmVmZXJlbmNpbmcgaW4gZnVuY3Rpb24qLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMyLCBkc3QsIG4pOwogICAgIH0KIAogICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgICAgICBIQVJEIE1JWElORwogICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSAgICBlbHNlCi0gICAgeworICAgIGVsc2UgewogICAgICAgICBpZiAocEluc3RhbmNlLT5DdXJyZW50MSA9PSAwKQogICAgICAgICAgICAgTWl4U29mdF8xU3RfRDMyQzMxX1dSQSgKLSAgICAgICAgICAgICAgICAgICAgKE1peF8xU3RfQ2xsX0ZMT0FUX3QgKikgJnBJbnN0YW5jZS0+QWxwaGEyLCAvKiBDYXN0IHRvIHZvaWQ6IG5vIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXJlZmVyZW5jaW5nIGluIGZ1bmN0aW9uKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYzIsIGRzdCwgbik7CisgICAgICAgICAgICAgICAgICAgIChNaXhfMVN0X0NsbF9GTE9BVF90KikmcEluc3RhbmNlLT5BbHBoYTIsIC8qIENhc3QgdG8gdm9pZDogbm8gXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXJlZmVyZW5jaW5nIGluIGZ1bmN0aW9uKi8KKyAgICAgICAgICAgICAgICAgICAgc3JjMiwgZHN0LCBuKTsKICAgICAgICAgZWxzZSBpZiAocEluc3RhbmNlLT5DdXJyZW50MiA9PSAwKQotICAgICAgICAgICAgTWl4U29mdF8xU3RfRDMyQzMxX1dSQSgoTWl4XzFTdF9DbGxfRkxPQVRfdCopIHBJbnN0YW5jZSwgc3JjMSwgZHN0LCBuK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RfWkVST19PTkVfREJfRkxPQVQgICAgICAgICBcCisgICAgMC4wMDExNTIgLyogMC4wMSBkQiBvbiBhIGZ1bGwgc2NhbGUgXAorICAgICAgICAgICAgICAgIHNpZ25hbCA9ICgxMF4oMC4wMS8yMCkgLTEpICogMl4zMSAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgIERFRklOSVRJT05TCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSNlbmRpZiAvLyNpZm5kZWYgX19NSVhFUl9QUklWQVRFX0hfXwotCisjZW5kaWYgIC8vI2lmbmRlZiBfX01JWEVSX1BSSVZBVEVfSF9fCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Nb25vVG8ySV8xNi5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Nb25vVG8ySV8xNi5jcHAKZGVsZXRlZCBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IGVhZDc5OGQuLjAwMDAwMDAKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTW9ub1RvMklfMTYuY3BwCisrKyAvZGV2L251bGwKQEAgLTEsNDkgKzAsMCBAQAotLyoKLSAqIENvcHlyaWdodCAoQykgMjAwNC0yMDEwIE5YUCBTb2Z0d2FyZQotICogQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY3QKLSAqCi0gKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsKLSAqIHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0IGluIGNvbXBsaWFuY2Ugd2l0aCB0aGUgTGljZW5zZS4KLSAqIFlvdSBtYXkgb2J0YWluIGEgY29weSBvZiB0aGUgTGljZW5zZSBhdAotICoKLSAqICAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wCi0gKgotICogVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZQotICogZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gIkFTIElTIiBCQVNJUywKLSAqIFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgotICogU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAotICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCi0gKi8KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIElOQ0xVREUgRklMRVMKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0jaW5jbHVkZSAiVmVjdG9yQXJpdGhtZXRpYy5oIgotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gTW9ub1RvMklfMTYKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi12b2lkIE1vbm9UbzJJXzE2KCBjb25zdCBMVk1fSU5UMTYgKnNyYywKLSAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICpkc3QsCi0gICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKQotewotICAgIExWTV9JTlQxNiBpaTsKLSAgICBzcmMgKz0gKG4tMSk7Ci0gICAgZHN0ICs9ICgobioyKS0xKTsKLQotICAgIGZvciAoaWkgPSBuOyBpaSAhPSAwOyBpaS0tKQotICAgIHsKLSAgICAgICAgKmRzdCA9ICpzcmM7Ci0gICAgICAgIGRzdC0tOwotCi0gICAgICAgICpkc3QgPSAqc3JjOwotICAgICAgICBkc3QtLTsKLSAgICAgICAgc3JjLS07Ci0gICAgfQotCi0gICAgcmV0dXJuOwotfQotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL01vbm9UbzJJXzMyLmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL01vbm9UbzJJXzMyLmNwcAppbmRleCA2MDNkMWZjLi5lZjNlNjMzIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Nb25vVG8ySV8zMi5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTW9ub1RvMklfMzIuY3BwCkBAIC0yMSw0MCArMjEsMTIgQEAKIAogI2luY2x1ZGUgIlZlY3RvckFyaXRobWV0aWMuaCIKIAotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIEZVTkNUSU9OIE1vbm9UbzJJXzMyCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotdm9pZCBNb25vVG8ySV8zMiggY29uc3QgTFZNX0lOVDMyICAqc3JjLAotICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgICpkc3QsCi0gICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKQotewotICAgIExWTV9JTlQxNiBpaTsKLSAgICBzcmMgKz0gKG4tMSk7Ci0gICAgZHN0ICs9ICgobioyKS0xKTsKLQotICAgIGZvciAoaWkgPSBuOyBpaSAhPSAwOyBpaS0tKQotICAgIHsKLSAgICAgICAgKmRzdCA9ICpzcmM7Ci0gICAgICAgIGRzdC0tOwotCi0gICAgICAgICpkc3QgPSAqc3JjOwotICAgICAgICBkc3QtLTsKLSAgICAgICAgc3JjLS07Ci0gICAgfQotCi0gICAgcmV0dXJuOwotfQotdm9pZCBNb25vVG8ySV9GbG9hdCggY29uc3QgTFZNX0ZMT0FUICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAqZHN0LAotICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IG4pCi17Cit2b2lkIE1vbm9UbzJJX0Zsb2F0KGNvbnN0IExWTV9GTE9BVCogc3JjLCBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IG4pIHsKICAgICBMVk1fSU5UMTYgaWk7CiAgICAgc3JjICs9IChuIC0gMSk7CiAgICAgZHN0ICs9ICgobiAqIDIpIC0gMSk7CiAKLSAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkKLSAgICB7CisgICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pIHsKICAgICAgICAgKmRzdCA9ICpzcmM7CiAgICAgICAgIGRzdC0tOwogCkBAIC02NSw0ICszNywzIEBACiAKICAgICByZXR1cm47CiB9Ci0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL011bHQzc18zMngxNi5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9NdWx0M3NfMzJ4MTYuY3BwCmluZGV4IDM3MGMzOWEuLmJhYmZlZjMgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL011bHQzc18zMngxNi5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTXVsdDNzXzMyeDE2LmNwcApAQCAtMjIsNDEgKzIyLDExIEBACiAjaW5jbHVkZSAiVmVjdG9yQXJpdGhtZXRpYy5oIgogI2luY2x1ZGUgIkxWTV9NYWNyb3MuaCIKIAotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLUZVTkNUSU9OIE1VTFQzU18xNlgxNgotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLXZvaWQgTXVsdDNzXzMyeDE2KCBjb25zdCBMVk1fSU5UMzIgKnNyYywKLSAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9JTlQxNiB2YWwsCi0gICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgKmRzdCwKLSAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKQotewotICAgIExWTV9JTlQxNiBpaTsKLSAgICBMVk1fSU5UMzIgc3JjdmFsLHRlbXA7Ci0KLSAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkKLSAgICB7Ci0gICAgICAgIHNyY3ZhbD0qc3JjOwotICAgICAgICBzcmMrKzsKLQotICAgICAgICBNVUwzMngxNklOVE8zMihzcmN2YWwsdmFsLHRlbXAsMTUpCi0KLSAgICAgICAgKmRzdCA9IHRlbXA7Ci0gICAgICAgIGRzdCsrOwotICAgIH0KLQotICAgIHJldHVybjsKLX0KLXZvaWQgTXVsdDNzX0Zsb2F0KCBjb25zdCBMVk1fRkxPQVQgKnNyYywKLSAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgdmFsLAotICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAqZHN0LAotICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBuKQotewordm9pZCBNdWx0M3NfRmxvYXQoY29uc3QgTFZNX0ZMT0FUKiBzcmMsIGNvbnN0IExWTV9GTE9BVCB2YWwsIExWTV9GTE9BVCogZHN0LCBMVk1fSU5UMTYgbikgewogICAgIExWTV9JTlQxNiBpaTsKICAgICBMVk1fRkxPQVQgdGVtcDsKIAotICAgIGZvciAoaWkgPSBuOyBpaSAhPSAwOyBpaS0tKQotICAgIHsKKyAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICB0ZW1wID0gKCpzcmMpICogdmFsOwogICAgICAgICBzcmMrKzsKICAgICAgICAgKmRzdCA9IHRlbXA7CkBAIC02NCw0ICszNCwzIEBACiAgICAgfQogICAgIHJldHVybjsKIH0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTm9uTGluQ29tcF9EMTYuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvTm9uTGluQ29tcF9EMTYuY3BwCmluZGV4IDM2ZDExNDkuLmYzYTFhNjcgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL05vbkxpbkNvbXBfRDE2LmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9Ob25MaW5Db21wX0QxNi5jcHAKQEAgLTYxLDIyICs2MSwxNiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotdm9pZCBOb25MaW5Db21wX0QxNihMVk1fSU5UMTYgICAgICAgIEdhaW4sCi0gICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAqcERhdGFJbiwKLSAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgIExWTV9JTlQzMiAgICAgICAgQmxvY2tMZW5ndGgpCi17Ci0KLSAgICBMVk1fSU5UMTYgICAgICAgICAgICBTYW1wbGU7ICAgICAgICAgICAgICAgICAgICAvKiBJbnB1dCBzYW1wbGVzICovCi0gICAgTFZNX0lOVDMyICAgICAgICAgICAgU2FtcGxlTm87ICAgICAgICAgICAgICAgIC8qIFNhbXBsZSBpbmRleCAqLwotICAgIExWTV9JTlQxNiAgICAgICAgICAgIFRlbXA7Cit2b2lkIE5vbkxpbkNvbXBfRmxvYXQoTFZNX0ZMT0FUIEdhaW4sIExWTV9GTE9BVCogcERhdGFJbiwgTFZNX0ZMT0FUKiBwRGF0YU91dCwKKyAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMzIgQmxvY2tMZW5ndGgpIHsKKyAgICBMVk1fRkxPQVQgU2FtcGxlOyAgIC8qIElucHV0IHNhbXBsZXMgKi8KKyAgICBMVk1fSU5UMzIgU2FtcGxlTm87IC8qIFNhbXBsZSBpbmRleCAqLworICAgIExWTV9GTE9BVCBUZW1wOwogCiAgICAgLyoKICAgICAgKiBQcm9jZXNzIGEgYmxvY2sgb2Ygc2FtcGxlcwogICAgICAqLwotICAgIGZvcihTYW1wbGVObyA9IDA7IFNhbXBsZU5vPEJsb2NrTGVuZ3RoOyBTYW1wbGVObysrKQotICAgIHsKLQorICAgIGZvciAoU2FtcGxlTm8gPSAwOyBTYW1wbGVObyA8IEJsb2NrTGVuZ3RoOyBTYW1wbGVObysrKSB7CiAgICAgICAgIC8qCiAgICAgICAgICAqIFJlYWQgdGhlIGlucHV0CiAgICAgICAgICAqLwpAQCAtODgsNjQgKzgyLDEyIEBACiAgICAgICAgICAqIGhhcm1vbmljIGRpc3RvcnRpb24uIFRoZSBhbW91bnQgb2YgY29tcHJlc3Npb24gaXMgY29udHJvbCBieSB0aGUKICAgICAgICAgICogZ2FpbiBmYWN0b3IKICAgICAgICAgICovCi0gICAgICAgIGlmICgoTFZNX0lOVDMyKVNhbXBsZSAhPSAtMzI3NjgpCi0gICAgICAgIHsKLSAgICAgICAgICAgIFRlbXAgPSAoTFZNX0lOVDE2KSgoU2FtcGxlICogU2FtcGxlKSA+PiAxNSk7Ci0gICAgICAgICAgICBpZihTYW1wbGUgPjApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgU2FtcGxlID0gKExWTV9JTlQxNikoU2FtcGxlICsgKChHYWluICogKFNhbXBsZSAtIFRlbXApKSA+PiAxNSkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIFNhbXBsZSA9IChMVk1fSU5UMTYpKFNhbXBsZSArICgoR2FpbiAqIChTYW1wbGUgKyBUZW1wKSkgPj4gMTUpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIC8qCi0gICAgICAgICAqIFNhdmUgdGhlIG91dHB1dAotICAgICAgICAgKi8KLSAgICAgICAgKnBEYXRhT3V0ID0gU2FtcGxlOwotICAgICAgICBwRGF0YU91dCsrOwotCi0gICAgfQotCi19Ci12b2lkIE5vbkxpbkNvbXBfRmxvYXQoTFZNX0ZMT0FUICAgICAgICBHYWluLAotICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgKnBEYXRhSW4sCi0gICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAqcERhdGFPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDMyICAgICAgICBCbG9ja0xlbmd0aCkKLXsKLQotICAgIExWTV9GTE9BVCAgICAgICAgICAgIFNhbXBsZTsgICAgICAgICAgICAgICAgICAgIC8qIElucHV0IHNhbXBsZXMgKi8KLSAgICBMVk1fSU5UMzIgICAgICAgICAgICBTYW1wbGVObzsgICAgICAgICAgICAgICAgLyogU2FtcGxlIGluZGV4ICovCi0gICAgTFZNX0ZMT0FUICAgICAgICAgICAgVGVtcDsKLQotICAgIC8qCi0gICAgICogUHJvY2VzcyBhIGJsb2NrIG9mIHNhbXBsZXMKLSAgICAgKi8KLSAgICBmb3IoU2FtcGxlTm8gPSAwOyBTYW1wbGVObyA8IEJsb2NrTGVuZ3RoOyBTYW1wbGVObysrKQotICAgIHsKLSAgICAgICAgLyoKLSAgICAgICAgICogUmVhZCB0aGUgaW5wdXQKLSAgICAgICAgICovCi0gICAgICAgIFNhbXBsZSA9ICpwRGF0YUluOwotICAgICAgICBwRGF0YUluKys7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogQXBwbHkgdGhlIGNvbXBhbmRlciwgdGhpcyBjb21wcmVzc2VzIHRoZSBzaWduYWwgYXQgdGhlIGV4cGVuc2Ugb2YKLSAgICAgICAgICogaGFybW9uaWMgZGlzdG9ydGlvbi4gVGhlIGFtb3VudCBvZiBjb21wcmVzc2lvbiBpcyBjb250cm9sIGJ5IHRoZQotICAgICAgICAgKiBnYWluIGZhY3RvcgotICAgICAgICAgKi8KLSAgICAgICAgaWYgKFNhbXBsZSAhPSAtMS4wZikKLSAgICAgICAgeworICAgICAgICBpZiAoU2FtcGxlICE9IC0xLjBmKSB7CiAgICAgICAgICAgICBUZW1wID0gKChTYW1wbGUgKiBTYW1wbGUpKTsKLSAgICAgICAgICAgIGlmKFNhbXBsZSA+IDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgU2FtcGxlID0gKFNhbXBsZSArICgoR2FpbiAqIChTYW1wbGUgLSBUZW1wKSkgKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgU2FtcGxlID0gKFNhbXBsZSArICgoR2FpbiAqIChTYW1wbGUgKyBUZW1wKSkgKSk7CisgICAgICAgICAgICBpZiAoU2FtcGxlID4gMCkgeworICAgICAgICAgICAgICAgIFNhbXBsZSA9IChTYW1wbGUgKyAoKEdhaW4gKiAoU2FtcGxlIC0gVGVtcCkpKSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIFNhbXBsZSA9IChTYW1wbGUgKyAoKEdhaW4gKiAoU2FtcGxlICsgVGVtcCkpKSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIApkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvUEtfMklfRDMyRjMyQzE0RzExX1RSQ19XUkFfMDEuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvUEtfMklfRDMyRjMyQzE0RzExX1RSQ19XUkFfMDEuY3BwCmRlbGV0ZWQgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAzZjYyZjk5Li4wMDAwMDAwCi0tLSBhL21lZGl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KioqKioqKioqKioqKi8KLXZvaWQgUEtfMklfRDMyRjMyQzE0RzExX1RSQ19XUkFfMDEgKCBCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCAgICAgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YU91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOclNhbXBsZXMpCi0gICAgewotICAgICAgICBMVk1fRkxPQVQgeW5MLHluUix5bkxPLHluUk8sdGVtcGw7Ci0gICAgICAgIExWTV9JTlQxNiBpaTsKLSAgICAgICAgUEZpbHRlcl9TdGF0ZV9GbG9hdCBwQmlxdWFkU3RhdGUgPSAoUEZpbHRlcl9TdGF0ZV9GbG9hdCkgcEluc3RhbmNlOwotCi0gICAgICAgICBmb3IgKGlpID0gTnJTYW1wbGVzOyBpaSAhPSAwOyBpaS0tKQotICAgICAgICAgewotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9DRVNTSU5HIE9GIFRIRSBMRUZUIENIQU5ORUwKLSAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8qIHluTD0gKEEwICAqICh4KG4pTCAtIHgobi0yKUwgICkgKSovCi0gICAgICAgICAgICB0ZW1wbCA9ICgqcERhdGFJbikgLSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbMl07Ci0gICAgICAgICAgICB5bkwgPSB0ZW1wbCAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbMF07Ci0KLSAgICAgICAgICAgIC8qIHluTCs9ICgoLUIyICAqIHkobi0yKUwgICkpICovCi0gICAgICAgICAgICB0ZW1wbCA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s2XSAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbMV07Ci0gICAgICAgICAgICB5bkwgKz0gdGVtcGw7Ci0KLSAgICAgICAgICAgIC8qIHluTCs9ICgoLUIxICogeShuLTEpTCAgKSApICovCi0gICAgICAgICAgICB0ZW1wbCA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1s0XSAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbMl07Ci0gICAgICAgICAgICB5bkwgKz0gdGVtcGw7Ci0KLSAgICAgICAgICAgIC8qIHluTE89ICgoR2FpbiAqIHluTCApKSAqLwotICAgICAgICAgICAgeW5MTyA9IHluTCAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbM107Ci0KLSAgICAgICAgICAgIC8qIHluTE89KCB5bkxPICsgeChuKUwgICkqLwotICAgICAgICAgICAgeW5MTyArPSAoKnBEYXRhSW4pOwotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9DRVNTSU5HIE9GIFRIRSBSSUdIVCBDSEFOTkVMCi0gICAgICAgICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvKiB5blI9IChBMCAgKiAoeChuKVIgIC0geChuLTIpUiAgKSApICovCi0gICAgICAgICAgICB0ZW1wbCA9ICgqKHBEYXRhSW4gKyAxKSkgLSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbM107Ci0gICAgICAgICAgICB5blIgPSB0ZW1wbCAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbMF07Ci0KLSAgICAgICAgICAgIC8qIHluUis9ICgoLUIyICAqIHkobi0yKVIgICkgKSAgKi8KLSAgICAgICAgICAgIHRlbXBsID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzddICogcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXTsKLSAgICAgICAgICAgIHluUiArPSB0ZW1wbDsKLQotICAgICAgICAgICAgLyogeW5SKz0gKCgtQjEgICogeShuLTEpUiAgKSApICAgKi8KLSAgICAgICAgICAgIHRlbXBsID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdICogcEJpcXVhZFN0YXRlLT5jb2Vmc1syXTsKLSAgICAgICAgICAgIHluUiArPSB0ZW1wbDsKLQotICAgICAgICAgICAgLyogeW5STz0gKChHYWluICAqIHluUiApKSAqLwotICAgICAgICAgICAgeW5STyA9IHluUiAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbM107Ci0KLSAgICAgICAgICAgIC8qIHluUk89KCB5blJPICsgeChuKVIgICkqLwotICAgICAgICAgICAgeW5STyArPSAoKihwRGF0YUluKzEpKTsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgVVBEQVRJTkcgVEhFIERFTEFZUwotICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzddID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdOyAvKiB5KG4tMilSPXkobi0xKVIqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzZdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzRdOyAvKiB5KG4tMilMPXkobi0xKUwqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzNdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzFdOyAvKiB4KG4tMilSPXgobi0xKVIqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzJdID0gcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdOyAvKiB4KG4tMilMPXgobi0xKUwqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzVdID0geW5SOyAvKiBVcGRhdGUgeShuLTEpUiAqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzRdID0geW5MOyAvKiBVcGRhdGUgeShuLTEpTCAqLwotICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzBdID0gKCpwRGF0YUluKTsgLyogVXBkYXRlIHgobi0xKUwgKi8KLSAgICAgICAgICAgIHBEYXRhSW4rKzsKLSAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1sxXSA9ICgqcERhdGFJbik7IC8qIFVwZGF0ZSB4KG4tMSlSICovCi0gICAgICAgICAgICBwRGF0YUluKys7Ci0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdSSVRJTkcgVEhFIE9VVFBVVAotICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgKnBEYXRhT3V0ID0geW5MTzsgLyogV3JpdGUgTGVmdCBvdXRwdXQqLwotICAgICAgICAgICAgcERhdGFPdXQrKzsKLSAgICAgICAgICAgICpwRGF0YU91dCA9IHluUk87IC8qIFdyaXRlIFJpZ2h0IG91cHV0Ki8KLSAgICAgICAgICAgIHBEYXRhT3V0Kys7Ci0KLSAgICAgICAgfQotCi0gICAgfQotCi0jaWZkZWYgU1VQUE9SVF9NQwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi1ERUxBWVMtCi1wQmlxdWFkU3RhdGUtPnBEZWxheXNbMF0gdG8KLXBCaXF1YWRTdGF0ZS0+cERlbGF5c1tOckNoYW5uZWxzIC0gMV0gaXMgeChuLTEpIGZvciBhbGwgTnJDaGFubmVscwotCi1wQmlxdWFkU3RhdGUtPnBEZWxheXNbTnJDaGFubmVsc10gdG8KLXBCaXF1YWRTdGF0ZS0+cERlbGF5c1syKk5yQ2hhbm5lbHMgLSAxXSBpcyB4KG4tMikgZm9yIGFsbCBOckNoYW5uZWxzCi0KLXBCaXF1YWRTdGF0ZS0+cERlbGF5c1syKk5yQ2hhbm5lbHNdIHRvCi1wQmlxdWFkU3RhdGUtPnBEZWxheXNbMypOckNoYW5uZWxzIC0gMV0gaXMgeShuLTEpIGZvciBhbGwgTnJDaGFubmVscwotCi1wQmlxdWFkU3RhdGUtPnBEZWxheXNbMypOckNoYW5uZWxzXSB0bwotcEJpcXVhZFN0YXRlLT5wRGVsYXlzWzQqTnJDaGFubmVscyAtIDFdIGlzIHkobi0yKSBmb3IgYWxsIE5yQ2hhbm5lbHMKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotdm9pZCBQS19NY19EMzJGMzJDMTRHMTFfVFJDX1dSQV8wMSAoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwRGF0YUluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBEYXRhT3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgTnJGcmFtZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBOckNoYW5uZWxzKQotICAgIHsKLSAgICAgICAgTFZNX0ZMT0FUIHluLCB5bk8sIHRlbXA7Ci0gICAgICAgIExWTV9JTlQxNiBpaSwgamo7Ci0gICAgICAgIFBGaWx0ZXJfU3RhdGVfRmxvYXQgcEJpcXVhZFN0YXRlID0gKFBGaWx0ZXJfU3RhdGVfRmxvYXQpIHBJbnN0YW5jZTsKLQotICAgICAgICAgZm9yIChpaSA9IE5yRnJhbWVzOyBpaSAhPSAwOyBpaS0tKQotICAgICAgICAgewotCi0gICAgICAgICAgICBmb3IgKGpqID0gMDsgamogPCBOckNoYW5uZWxzOyBqaisrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9DRVNTSU5HIE9GIFRIRSBqaiBDSEFOTkVMCi0gICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgICAgIC8qIHluPSAoQTAgICogKHgobikgLSB4KG4tMikpKSovCi0gICAgICAgICAgICAgICAgdGVtcCA9ICgqcERhdGFJbikgLSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbTnJDaGFubmVscyArIGpqXTsKLSAgICAgICAgICAgICAgICB5biA9IHRlbXAgKiBwQmlxdWFkU3RhdGUtPmNvZWZzWzBdOwotCi0gICAgICAgICAgICAgICAgLyogeW4rPSAoKC1CMiAgKiB5KG4tMikpKSAqLwotICAgICAgICAgICAgICAgIHRlbXAgPSBwQmlxdWFkU3RhdGUtPnBEZWxheXNbTnJDaGFubmVscyozICsgampdICogcEJpcXVhZFN0YXRlLT5jb2Vmc1sxXTsKLSAgICAgICAgICAgICAgICB5biArPSB0ZW1wOwotCi0gICAgICAgICAgICAgICAgLyogeW4rPSAoKC1CMSAqIHkobi0xKSkpICovCi0gICAgICAgICAgICAgICAgdGVtcCA9IHBCaXF1YWRTdGF0ZS0+cERlbGF5c1tOckNoYW5uZWxzKjIgKyBqal0gKiBwQmlxdWFkU3RhdGUtPmNvZWZzWzJdOwotICAgICAgICAgICAgICAgIHluICs9IHRlbXA7Ci0KLSAgICAgICAgICAgICAgICAvKiB5bk89ICgoR2FpbiAqIHluKSkgKi8KLSAgICAgICAgICAgICAgICB5bk8gPSB5biAqIHBCaXF1YWRTdGF0ZS0+Y29lZnNbM107Ci0KLSAgICAgICAgICAgICAgICAvKiB5bk89KHluTyArIHgobikpKi8KLSAgICAgICAgICAgICAgICB5bk8gKz0gKCpwRGF0YUluKTsKLQotICAgICAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVUERBVElORyBUSEUgREVMQVlTCi0gICAgICAgICAgICAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1tOckNoYW5uZWxzICogMyArIGpqXSA9Ci0gICAgICAgICAgICAgICAgICAgIHBCaXF1YWRTdGF0ZS0+cERlbGF5c1tOckNoYW5uZWxzICogMiArIGpqXTsgLyogeShuLTIpPXkobi0xKSovCi0gICAgICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzW05yQ2hhbm5lbHMgKiAxICsgampdID0KLSAgICAgICAgICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzW2pqXTsgLyogeChuLTIpPXgobi0xKSovCi0gICAgICAgICAgICAgICAgcEJpcXVhZFN0YXRlLT5wRGVsYXlzW05yQ2hhbm5lbHMgKiAyICsgampdID0geW47IC8qIFVwZGF0ZSB5KG4tMSkgKi8KLSAgICAgICAgICAgICAgICBwQmlxdWFkU3RhdGUtPnBEZWxheXNbampdID0gKCpwRGF0YUluKTsgLyogVXBkYXRlIHgobi0xKSovCi0gICAgICAgICAgICAgICAgcERhdGFJbisrOwotCi0gICAgICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdSSVRJTkcgVEhFIE9VVFBVVAotICAgICAgICAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgICAgICAqcERhdGFPdXQgPSB5bk87IC8qIFdyaXRlIG91dHB1dCovCi0gICAgICAgICAgICAgICAgcERhdGFPdXQrKzsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgfQotI2VuZGlmCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9QS18ySV9EMzJGMzJDMzBHMTFfVFJDX1dSQV8wMS5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9QS18ySV9EMzJGMzJDMzBHMTFfVFJDX1dSQV8wMS5jcHAKZGVsZXRlZCBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDQxZGUxZGUuLjAwMDAwMDAKLS0tIGEvbWVkaWEvbGliZWZmZWN0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JlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9TaGlmdF9TYXRfdjMyeHYzMi5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvU2hpZnRfU2F0X3YzMnh2MzIuY3BwCkBAIC0yNCw1NSArMjQsMzkgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBGVU5DVElPTiBTaGlmdF9TYXRfdjMyeHYzMgogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIFNoaWZ0X1NhdF9GbG9hdCAoY29uc3QgICBMVk1fSU5UMTYgICB2YWwsCi0gICAgICAgICAgICAgICAgICAgICAgY29uc3QgICBMVk1fRkxPQVQgICAqc3JjLAotICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICpkc3QsCi0gICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgbikKLXsKLSAgICBMVk1fRkxPQVQgICB0ZW1wOwotICAgIExWTV9JTlQzMiAgIGlpLGlqOwotICAgIExWTV9JTlQxNiAgIFJTaGlmdDsKK3ZvaWQgU2hpZnRfU2F0X0Zsb2F0KGNvbnN0IExWTV9JTlQxNiB2YWwsIGNvbnN0IExWTV9GTE9BVCogc3JjLCBMVk1fRkxPQVQqIGRzdCwgTFZNX0lOVDE2IG4pIHsKKyAgICBMVk1fRkxPQVQgdGVtcDsKKyAgICBMVk1fSU5UMzIgaWksIGlqOworICAgIExWTV9JTlQxNiBSU2hpZnQ7CiAKLSAgICBpZih2YWwgPiAwKQotICAgIHsKLSAgICAgICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgICAgIHsKKyAgICBpZiAodmFsID4gMCkgeworICAgICAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICAgICAgdGVtcCA9IChMVk1fRkxPQVQpKnNyYzsKICAgICAgICAgICAgIHNyYysrOwotICAgICAgICAgICAgZm9yKGlqID0gMDsgaWogPCB2YWw7IGlqKyspCi0gICAgICAgICAgICB7CisgICAgICAgICAgICBmb3IgKGlqID0gMDsgaWogPCB2YWw7IGlqKyspIHsKICAgICAgICAgICAgICAgICB0ZW1wID0gdGVtcCAqIDI7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmKHRlbXAgPiAxLjApCi0gICAgICAgICAgICAgICAgdGVtcCA9IDEuMDsKLSAgICAgICAgICAgIGlmKHRlbXAgPCAtMS4wKQotICAgICAgICAgICAgICAgIHRlbXAgPSAtMS4wOworICAgICAgICAgICAgaWYgKHRlbXAgPiAxLjApIHRlbXAgPSAxLjA7CisgICAgICAgICAgICBpZiAodGVtcCA8IC0xLjApIHRlbXAgPSAtMS4wOwogCiAgICAgICAgICAgICAqZHN0ID0gKExWTV9GTE9BVCl0ZW1wOwogICAgICAgICAgICAgZHN0Kys7CiAgICAgICAgIH0KLSAgICB9Ci0gICAgZWxzZSBpZih2YWwgPCAwKQotICAgIHsKLSAgICAgICAgUlNoaWZ0PShMVk1fSU5UMTYpKC12YWwpOworICAgIH0gZWxzZSBpZiAodmFsIDwgMCkgeworICAgICAgICBSU2hpZnQgPSAoTFZNX0lOVDE2KSgtdmFsKTsKIAotICAgICAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkKLSAgICAgICAgeworICAgICAgICBmb3IgKGlpID0gbjsgaWkgIT0gMDsgaWktLSkgewogICAgICAgICAgICAgdGVtcCA9IChMVk1fRkxPQVQpKnNyYzsKICAgICAgICAgICAgIHNyYysrOwotICAgICAgICAgICAgZm9yKGlqID0gMDsgaWogPCBSU2hpZnQ7IGlqKyspCi0gICAgICAgICAgICB7CisgICAgICAgICAgICBmb3IgKGlqID0gMDsgaWogPCBSU2hpZnQ7IGlqKyspIHsKICAgICAgICAgICAgICAgICB0ZW1wID0gdGVtcCAvIDI7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAqZHN0ID0gKExWTV9GTE9BVCl0ZW1wOwogICAgICAgICAgICAgZHN0Kys7CiAgICAgICAgIH0KLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgaWYoc3JjICE9IGRzdCkKLSAgICAgICAgeworICAgIH0gZWxzZSB7CisgICAgICAgIGlmIChzcmMgIT0gZHN0KSB7CiAgICAgICAgICAgICBDb3B5X0Zsb2F0KHNyYywgZHN0LCBuKTsKICAgICAgICAgfQogICAgIH0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL2RCX3RvX0xpbjMyLmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9Db21tb24vc3JjL2RCX3RvX0xpbjMyLmNwcAppbmRleCA0ZGEyMDEzLi4yMTQzNDY1IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvQ29tbW9uL3NyYy9kQl90b19MaW4zMi5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9zcmMvZEJfdG9fTGluMzIuY3BwCkBAIC01NywxNyArNTcsMTYgQEAKICAqCiAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotI2RlZmluZSBGT1VSX09WRVJfU0lYICAgIDIxODQ2ICAgICAgICAgICAgICAgICAgLyogKDQgLyA2KSAqIDJeMTUgKi8KLSNkZWZpbmUgU0lYX0RCICAgICAgICAgICA5NiAgICAgICAgICAgICAgICAgICAgIC8qIDYgKiAxNiBvciA2ZEIgaW4gUTExLjQgZm9ybWF0ICovCi0jZGVmaW5lIEZJUlNUX0NPRUZfTkVHICAgMTQ4ODQzMDUKLSNkZW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m1pc3Npb25zIGFuZAotICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCi0gKi8KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgIElOQ0xVREUgRklMRVMKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0jaW5jbHVkZSAiVmVjdG9yQXJpdGhtZXRpYy5oIgotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICAgRlVOQ1RJT04gTVVMVDNTXzE2WDE2Ci0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotdm9pZCBNdWx0M3NfMTZ4MTYoIGNvbnN0IExWTV9JTlQxNiAqc3JjLAotICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0lOVDE2IHZhbCwKLSAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAqZHN0LAotICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IG4pCi17Ci0gICAgTFZNX0lOVDE2IGlpOwotICAgIExWTV9JTlQzMiB0ZW1wOwotCi0gICAgZm9yIChpaSA9IG47IGlpICE9IDA7IGlpLS0pCi0gICAgewotICAgICAgICB0ZW1wID0gKExWTV9JTlQzMikoKnNyYykgKiAoTFZNX0lOVDMyKXZhbDsKLSAgICAgICAgc3JjKys7Ci0KLSAgICAgICAgKmRzdCA9IChMVk1fSU5UMTYpKHRlbXAgPj4gMTUpOwotICAgICAgICBkc3QrKzsKLSAgICB9Ci0KLSAgICByZXR1cm47Ci19Ci0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0VxL2xpYi9MVkVRTkIuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9FcS9saWIvTFZFUU5CLmgKaW5kZXggYzVkZGY3Ny4uZjFhZmNkNiAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0VxL2xpYi9MVkVRTkIuaAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvRXEvbGliL0xWRVFOQi5oCkBAIC04NiwxNiArODYsOSBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotLyogTWVtb3J5IHRhYmxlICovCi0jZGVmaW5lIExWRVFOQl9NRU1SRUdJT05fSU5TVEFOQ0UgICAgICAgICAgMCAgIC8qIE9mZnNldCB0byB0aGUgaW5zdGFuY2UgbWVtb3J5IHJlZ2lvbiAqLwotI2RlZmluZSBMVkVRTkJfTUVNUkVHSU9OX1BFUlNJU1RFTlRfREFUQSAgIDEgICAvKiBPZmZzZXQgdG8gcGVyc2lzdGVudCBkYXRhIG1lbW9yeSByZWdpb24gKi8KLSNkZWZpbmUgTFZFUU5CX01FTVJFR0lPTl9QRVJTSVNURU5UX0NPRUYgICAyICAgLyogT2Zmc2V0IHRvIHBlcnNpc3RlbnQgY29lZmZpY2llbnQgcmVnaW9uICovCi0jZGVmaW5lIExWRVFOQl9NRU1SRUdJT05fU0NSQVRDSCAgICAgICAgICAgMyAgIC8qIE9mZnNldCB0byBkYXRhIHNjcmF0Y2ggbWVtb3J5IHJlZ2lvbiAqLwotI2RlZmluZSBMVkVRTkJfTlJfTUVNT1JZX1JFR0lPTlMgICAgICAgICAgIDQgICAvKiBOdW1iZXIgb2YgbWVtb3J5IHJlZ2lvbnMgKi8KLQogLyogQ2FsbGJhY2sgZXZlbnRzICovCi0jZGVmaW5lIExWRVFOQl9FVkVOVF9OT05FICAgICAgICAgICAgICAgICAgIDB4MDAwMCAgICAvKiBOb3QgYSB2YWxpZCBldmVudCAqLwotI2RlZmluZSBMVkVRTkJfRVZFTlRfQUxHT0ZGICAgICAgICAgICAgICAgICAweDAwMDEgICAgLyogRVFOQiBoYXMgY29tcGxldGVkIHN3aXRjaCBvZmYgKi8KKyNkZWZpbmUgTFZFUU5CX0VWRU5UX05PTkUgMHgwMDAwICAgLyogTm90IGEgdmFsaWQgZXZlbnQgKi8KKyNkZWZpbmUgTFZFUU5CX0VWRU5UX0FMR09GRiAweDAwMDEgLyogRVFOQiBoYXMgY29tcGxldGVkIHN3aXRjaCBvZmYgKi8KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTEwNCw0MiArOTcsMjUgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCiAvKiBJbnN0YW5jZSBoYW5kbGUgKi8KLXR5cGVkZWYgdm9pZCAqTFZFUU5CX0hhbmRsZV90OwordHlwZWRlZiB2b2lkKiBMVkVRTkJfSGFuZGxlX3Q7CiAKIC8qIE9wZXJhdGluZyBtb2RlcyAqLwotdHlwZWRlZiBlbnVtCi17Ci0gICAgTFZFUU5CX0JZUEFTUyAgID0gMCw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wgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE1lbW9yeSBhbGlnbm1lbnQgZXJyb3IgKi8KLSAgICBMVkVRTkJfTlVMTEFERFJFU1MgICAgPSAyLCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTlVMTCBhbGxvY2F0aW9uIGFkZHJlc3MgKi8KLSAgICBMVkVRTkJfVE9PTUFOWVNBTVBMRVMgPSAzLCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTWF4aW11bSBibG9jayBzaXplIGV4Y2VlZGVkICovCi0gICAgTFZFUU5CX1NUQVRVU19NQVggICAgID0gTFZNX01BWElOVF8zMgordHlwZWRlZiBlbnVtIHsKKyAgICBMVkVRTkJfU1VDQ0VTUyA9IDAsICAgICAgICAvKiBTdWNjZXNzZnVsIHJldHVybiBmcm9tIGEgcm91dGluZSAqLworICAgIExWRVFOQl9BTElHTk1FTlRFUlJPUiA9IDEsIC8qIE1lbW9yeSBhbGlnbm1lbnQgZXJyb3IgKi8KKyAgICBMVkVRTkJfTlVMTEFERFJFU1MgPSAyLCAgICAvKiBOVUxMIGFsbG9jYXRpb24gYWRkcmVzcyAqLworICAgIExWRVFOQl9UT09NQU5ZU0FNUExFUyA9IDMsIC8qIE1heGltdW0gYmxvY2sgc2l6ZSBleGNlZWRlZCAqLworICAgIExWRVFOQl9TVEFUVVNfTUFYID0gTFZNX01BWElOVF8zMgogfSBMVkVRTkJfUmV0dXJuU3RhdHVzX2VuOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTE2NiwzOSArMTQyLDM1IEBACiAvKgogICogU3VwcG9ydGVkIHNvdXJjZSBkYXRhIGZvcm1hdHMKICAqLwotI2RlZmluZSBMVkVRTkJfQ0FQX1NURVJFTyAgICAgICAgICAgICAgICAgIDEKLSNkZWZpbmUgTFZFUU5CX0NBUF9NT05PSU5TVEVSRU8gIC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iAgICAgTFZFUU5CX0ZTXzk2MDAwID0gMTAsCiAgICAgTFZFUU5CX0ZTXzE3NjQwMCA9IDExLAogICAgIExWRVFOQl9GU18xOTIwMDAgPSAxMiwKLSAgICBMVkVRTkJfRlNfTUFYICAgPSBMVk1fTUFYSU5UXzMyCisgICAgTFZFUU5CX0ZTX01BWCA9IExWTV9NQVhJTlRfMzIKIH0gTFZFUU5CX0ZzX2VuOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTIyMCw1OCArMTkyLDM4IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0vKiBNZW1vcnkgcmVnaW9uIGRlZmluaXRpb24gKi8KLXR5cGVkZWYgc3RydWN0Ci17Ci0gICAgTFZNX1VJTlQzMiAgICAgICAgICAgICAgICAgIFNpemU7ICAgICAgICAgICAgICAgICAgIC8qIFJlZ2lvbiBzaXplIGluIGJ5dGVzICovCi0gICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgICAgIEFsaWdubWVudDsgICAgICAgICAgICAgIC8qIFJlZ2lvbiBhbGlnbm1lbnQgaW4gYnl0ZXMgKi8KLSAgICBMVkVRTkJfTWVtb3J5VHlwZXNfZW4gICAgICAgVHlwZTsgICAgICAgICAgICAgICAgICAgLyogUmVnaW9uIHR5cGUgKi8KLSAgICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgKnBCYXNlQWRkcmVzczsgICAgICAgICAgLyogUG9pbnRlciB0byB0aGUgcmVnaW9uIGJhc2UgYWRkcmVzcyAqLwotfSBMVkVRTkJfTW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nb2RlX2VuICAgICAgICAgICAgICBPcGVyYXRpbmdNb2RlOwotICAgIExWRVFOQl9Gc19lbiAgICAgICAgICAgICAgICBTYW1wbGVSYXRlOwotICAgIExWRVFOQl9Tb3VyY2VGb3JtYXRfZW4gICAgICBTb3VyY2VGb3JtYXQ7CisgICAgTFZFUU5CX01vZGVfZW4gT3BlcmF0aW5nTW9kZTsKKyAgICBMVkVRTkJfRnNfZW4gU2FtcGxlUmF0ZTsKKyAgICBMVkVRTkJfU291cmNlRm9ybWF0X2VuIFNvdXJjZUZvcm1hdDsKIAogICAgIC8qIEVxdWFsaXNlciBwYXJhbWV0ZXJzICovCi0gICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgICAgIE5CYW5kczsgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBiYW5kcyAqLwotICAgIExWRVFOQl9CYW5kRGVmX3QgICAgICAgICAgICAqcEJhbmREZWZpbml0aW9uOyAgICAgICAvKiBQb2ludGVyIHRvIGVxdWFsaXNlciBkZWZpbml0aW9ucyAqLwotI2lmZGVmIFNVUFBPUlRfTUMKLSAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgTnJDaGFubmVsczsKLSNlbmRpZgorICAgIExWTV9VSU5UMTYgTkJhbmRzOyAgICAgICAgICAgICAgICAgLyogTnVtYmVyIG9mIGJhbmRzICovCisgICAgTFZFUU5CX0JhbmREZWZfdCogcEJhbmREZWZpbml0aW9uOyAvKiBQb2ludGVyIHRvIGVxdWFsaXNlciBkZWZpbml0aW9ucyAqLworICAgIExWTV9JTlQxNiBOckNoYW5uZWxzOwogfSBMVkVRTkJfUGFyYW1zX3Q7CiAKIC8qIENhcGFiaWxpdHkgc3RydWN0dXJlICovCi10eXBlZGVmIHN0cnVjdAotewordHlwZWRlZiBzdHJ1Y3QgewogICAgIC8qIEdlbmVyYWwgcGFyYW1ldGVycyAqLwotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgICBTYW1wbGVSYXRlOworICAgIExWTV9VSU5UMTYgU2FtcGxlUmF0ZTsKIAotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgICBTb3VyY2VGb3JtYXQ7Ci0gICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgICAgIE1heEJsb2NrU2l6ZTsKLSAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICAgTWF4QmFuZHM7CisgICAgTFZNX1VJTlQxNiBTb3VyY2VGb3JtYXQ7CisgICAgTFZNX1VJTlQxNiBNYXhCbG9ja1NpemU7CisgICAgTFZNX1VJTlQxNiBNYXhCYW5kczsKIAogICAgIC8qIENhbGxiYWNrIHBhcmFtZXRlcnMgKi8KLSAgICBMVk1fQ2FsbGJhY2sgICAgICAgICAgICAgICAgQ2FsbEJhY2s7ICAgICAgICAgICAgICAgLyogQnVuZGxlIGNhbGxiYWNrICovCi0gICAgdm9pZCAgICAgICAgICAgICAgICAgICAgICAgICpwQnVuZGxlSW5zdGFuY2U7ICAgICAgIC8qIEJ1bmRsZSBpbnN0YW5jZSBoYW5kbGUgKi8KKyAgICBMVk1fQ2FsbGJhY2sgQ2FsbEJhY2s7IC8qIEJ1bmRsZSBjYWxsYmFjayAqLworICAgIHZvaWQqIHBCdW5kbGVJbnN0YW5jZTsgLyogQnVuZGxlIGluc3RhbmNlIGhhbmRsZSAqLwogCiB9IExWRVFOQl9DYXBhYmlsaXRpZXNfdDsKIApAQCAtMjgzLDc4ICsyMzUsNDMgQEAKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICBMVkVRTkJfTWVtb3J5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgZm9yIG1lbW9yeSBhbGxvY2F0aW9uIGFuZCBmcmVlLiBJdCBjYW4gYmUgY2FsbGVkIGluICAgICAgICAgICAqLwotLyogIHR3byB3YXlzOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgaEluc3RhbmNlID0gTlVMTCAgICAgICAgICAgICAgICBSZXR1cm5zIHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzICAgICAgICAgICAgICAgICAqLwotLyogICAgICBoSW5zdGFuY2UgPSBJbnN0YW5jZSBoYW5kbGUgICAgIFJldHVybnMgdGhlIG1lbW9yeSByZXF1aXJlbWVudHMgYW5kICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb2NhdGVkIGJhc2UgYWRkcmVzc2VzIGZvciB0aGUgaW5zdGFuY2UgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFdoZW4gdGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgZm9yIG1lbW9yeSBhbGxvY2F0aW9uIChoSW5zdGFuY2U9TlVMTCkgdGhlIG1lbW9yeSAgICAgICovCi0vKiAgYmFzZSBhZGRyZXNzIHBvaW50ZXJzIGFyZSBOVUxMIG9uIHJldHVybi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFdoZW4gdGhlIGZ1bmN0aW9uIGlzIGNhbGxlZCBmb3IgZnJlZSAoaEluc3RhbmNlID0gSW5zdGFuY2UgSGFuZGxlKSB0aGUgbWVtb3J5ICAgICAgICovCi0vKiAgdGFibGUgcmV0dXJucyB0aGUgYWxsb2NhdGVkIG1lbW9yeSBhbmQgYmFzZSBhZGRyZXNzZXMgdXNlZCBkdXJpbmcgaW5pdGlhbGlzYXRpb24uICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlICAgICAgICAgICAgICAgSW5zdGFuY2UgSGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwTWVtb3J5VGFibGUgICAgICAgICAgICBQb2ludGVyIHRvIGFuIGVtcHR5IG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICAqLwotLyogIHBDYXBhYmlsaXRpZXMgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGRlZmF1bHQgY2FwYWJpbGl0aWVzICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIExWRVFOQl9TVUNDRVNTICAgICAgICAgIFN1Y2NlZWRlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZFUU5CX05VTExBRERSRVNTICAgICAgV2hlbiBhbnkgb2YgcE1lbW9yeVRhYmxlIGFuZCBwQ2FwYWJpbGl0aWVzIGlzIE5VTEwgYWRkcmVzcyAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgMS4gIFRoaXMgZnVuY3Rpb24gbWF5IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVkVRTkJfUHJvY2VzcyBmdW5jdGlvbiAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLUxWRVFOQl9SZXR1cm5TdGF0dXNfZW4gTFZFUU5CX01lbW9yeShMVkVRTkJfSGFuZGxlX3QgICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX01lbVRhYl90ICAgICAgICAgICAgKnBNZW1vcnlUYWJsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQ2FwYWJpbGl0aWVzX3QgICAgICAqcENhcGFiaWxpdGllcyk7Ci0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBGVU5DVElPTjogICAgICAgICAgICAgICAgTFZFUU5CX0luaXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgQ3JlYXRlIGFuZCBpbml0aWFsaXNhdGlvbiBmdW5jdGlvbiBmb3IgdGhlIE4tQmFuZCBlcXVhbGxpc2VyIG1vZHVsZSAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFRoaXMgZnVuY3Rpb24gY2FuIGJlIHVzZWQgdG8gY3JlYXRlIGFuIGFsZ29yaXRobSBpbnN0YW5jZSBieSBjYWxsaW5nIHdpdGggICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlIHNldCB0byBOVUxMLiBJbiB0aGlzIGNhc2UgdGhlIGFsZ29yaXRobSByZXR1cm5zIHRoZSBuZXcgaW5zdGFuY2UgICAgICAgICAgKi8KLS8qICBoYW5kbGUuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgVGhpcyBmdW5jdGlvbiBjYW4gYmUgdXNlZCB0byBmb3JjZSBhIGZ1bGwgcmUtaW5pdGlhbGlzYXRpb24gb2YgdGhlIGFsZ29yaXRobSAgICAgICAgKi8KLS8qICBieSBjYWxsaW5nIHdpdGggaEluc3RhbmNlID0gSW5zdGFuY2UgSGFuZGxlLiBJbiB0aGlzIGNhc2UgdGhlIG1lbW9yeSB0YWJsZSAgICAgICAgICAqLwotLyogIHNob3VsZCBiZSBjb3JyZWN0IGZvciB0aGUgaW5zdGFuY2UsIHRoaXMgY2FuIGJlIGVuc3VyZWQgYnkgY2FsbGluZyB0aGUgZnVuY3Rpb24gICAgICovCi0vKiAgTFZFUU5CX01lbW9yeSBiZWZvcmUgY2FsbGluZyB0aGlzIGZ1bmN0aW9uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBDcmVhdGUgYW5kIGluaXRpYWxpc2F0aW9uIGZ1bmN0aW9uIGZvciB0aGUgTi1CYW5kIGVxdWFsaXNlciBtb2R1bGUuICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2UgICAgICAgICAgICAgICBJbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBNZW1vcnlUYWJsZSAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgcGhJbnN0YW5jZSAgICAgICAgICAgICAgUG9pbnRlciB0byBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICBwQ2FwYWJpbGl0aWVzICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbml0aWFsaXNhdGlvbiBjYXBhYmlsaXRpZXMgICAgICAgICAgICAgICAgICAqLworLyogIHBTY3JhdGNoICAgICAgICAgICAgICAgIFBvaW50ZXIgdG8gYnVuZGxlIHNjcmF0Y2ggYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogIExWRVFOQl9TVUNDRVNTICAgICAgICAgIEluaXRpYWxpc2F0aW9uIHN1Y2NlZWRlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZFUU5CX05VTExBRERSRVNTICAgICAgICBXaGVuIHBDYXBhYmlsaXRpZXMgb3IgcE1lbW9yeVRhYmxlaXMgb3IgcGhJbnN0YW5jZSBhcmUgTlVMTCAqLwotLyogIExWRVFOQl9OVUxMQUREUkVTUyAgICAgICAgT25lIG9yIG1vcmUgb2YgdGhlIG1lbW9yeSByZWdpb25zIGhhcyBhIE5VTEwgYmFzZSBhZGRyZXNzICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVyIGZvciBhIG1lbW9yeSByZWdpb24gd2l0aCBhIG5vbi16ZXJvIHNpemUuICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTFZFUU5CX05VTExBRERSRVNTICAgICAgV2hlbiBwQ2FwYWJpbGl0aWVzIG9yIHBoSW5zdGFuY2UgYXJlIE5VTEwgICAgICAgICAgICAgICAgICAgKi8KKy8qICBMVkVRTkJfTlVMTEFERFJFU1MgICAgICBXaGVuIGFsbG9jYXRlZCBtZW1vcnkgaGFzIGEgTlVMTCBiYXNlIGFkZHJlc3MgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAxLiAgVGhlIGluc3RhbmNlIGhhbmRsZSBpcyB0aGUgcG9pbnRlciB0byB0aGUgYmFzZSBhZGRyZXNzIG9mIHRoZSBmaXJzdCBtZW1vcnkgICAgICAqLwotLyogICAgICByZWdpb24uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgMi4gIFRoaXMgZnVuY3Rpb24gbXVzdCBub3QgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWRVFOQl9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgKi8KKy8qICAxLiAgVGhpcyBmdW5jdGlvbiBtdXN0IG5vdCBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZFUU5CX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK0xWRVFOQl9SZXR1cm5TdGF0dXNfZW4gTFZFUU5CX0luaXQoTFZFUU5CX0hhbmRsZV90KiBwaEluc3RhbmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQ2FwYWJpbGl0aWVzX3QqIHBDYXBhYmlsaXRpZXMsIHZvaWQqIHBTY3JhdGNoKTsKIAotTFZFUU5CX1JldHVyblN0YXR1c19lbiBMVkVRTkJfSW5pdChMVkVRTkJfSGFuZGxlX3QgICAgICAgICAgKnBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9NZW1UYWJfdCAgICAgICAgICAqcE1lbW9yeVRhYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQ2FwYWJpbGl0aWVzX3QgICAgKnBDYXBhYmlsaXRpZXMpOworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICBMVkVRTkJfRGVJbml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgIEZyZWUgdGhlIG1lbW9yaWVzIGNyZWF0ZWQgZHVyaW5nIExWRVFOQl9Jbml0IGluY2x1ZGluZyBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwaEluc3RhbmNlICAgICAgICAgICAgICBQb2ludGVyIHRvIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAxLiAgVGhpcyBmdW5jdGlvbiBtdXN0IG5vdCBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZFUU5CX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3ZvaWQgTFZFUU5CX0RlSW5pdChMVkVRTkJfSGFuZGxlX3QqIHBoSW5zdGFuY2UpOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMzc3LDggKzI5NCw3IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVkVRTkJfUmV0dXJuU3RhdHVzX2VuIExWRVFOQl9HZXRQYXJhbWV0ZXJzKExWRVFOQl9IYW5kbGVfdCAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfUGFyYW1zX3QgICAgICpwUGFyYW1zKTsKK0xWRVFOQl9SZXR1cm5TdGF0dXNfZW4gTFZFUU5CX0dldFBhcmFtZXRlcnMoTFZFUU5CX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZFUU5CX1BhcmFtc190KiBwUGFyYW1zKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTQwMSw4ICszMTcsOCBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZFUU5CX1JldHVyblN0YXR1c19lbiBMVkVRTkJfR2V0Q2FwYWJpbGl0aWVzKExWRVFOQl9IYW5kbGVfdCAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9DYXBhYmlsaXRpZXNfdCAgICAgKnBDYXBhYmlsaXRpZXMpOworTFZFUU5CX1JldHVyblN0YXR1c19lbiBMVkVRTkJfR2V0Q2FwYWJpbGl0aWVzKExWRVFOQl9IYW5kbGVfdCBoSW5zdGFuY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0NhcGFiaWxpdGllc190KiBwQ2FwYWJpbGl0aWVzKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTQyNiw4ICszNDIsNyBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZFUU5CX1JldHVyblN0YXR1c19lbiBMVkVRTkJfQ29udHJvbChMVkVRTkJfSGFuZGxlX3QgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfUGFyYW1zX3QgICAgICAgKnBQYXJhbXMpOworTFZFUU5CX1JldHVyblN0YXR1c19lbiBMVkVRTkJfQ29udHJvbChMVkVRTkJfSGFuZGxlX3QgaEluc3RhbmNlLCBMVkVRTkJfUGFyYW1zX3QqIHBQYXJhbXMpOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNDUxLDEwICszNjYsNyBAQAogLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZFUU5CX1JldHVyblN0YXR1c19lbiBMVkVRTkJfUHJvY2VzcyhMVkVRTkJfSGFuZGxlX3QgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAgKnBJbkRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAqcE91dERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICAgICBOdW1TYW1wbGVzKTsKK0xWRVFOQl9SZXR1cm5TdGF0dXNfZW4gTFZFUU5CX1Byb2Nlc3MoTFZFUU5CX0hhbmRsZV90IGhJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBwSW5EYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIHBPdXREYXRhLCBMVk1fVUlOVDE2IE51bVNhbXBsZXMpOwogCi0jZW5kaWYgICAgICAvKiBfX0xWRVFOQl9fICovCi0KKyNlbmRpZiAvKiBfX0xWRVFOQl9fICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvRXEvc3JjL0xWRVFOQl9DYWxjQ29lZi5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvRXEvc3JjL0xWRVFOQl9DYWxjQ29lZi5jcHAKaW5kZXggYzNjMGZhZC4uZjhhNWYyYSAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0VxL3NyYy9MVkVRTkJfQ2FsY0NvZWYuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9FcS9zcmMvTFZFUU5CX0NhbGNDb2VmLmNwcApAQCAtMTExLDQzICsxMTEsMzcgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLUxWRVFOQl9SZXR1cm5TdGF0dXNfZW4gTFZFUU5CX1NpbmdsZVByZWNDb2VmcyhMVk1fVUlOVDE2ICAgICAgICBGcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQmFuZERlZl90ICAqcEZpbHRlckRlZmluaXRpb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEtf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MjMsNzggQEAKIC8qIEdhaW4gdGFibGUgZm9yICgxMF4oR2Fpbi8yMCkgLSAxKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSNkZWZpbmUgTFZFUU5CX0dhaW5fTmVnMTVfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC44MjIxNzJmKQotI2RlZmluZSBMVkVRTkJfR2Fpbl9OZWcxNF9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjgwMDQ3NGYpCi0jZGVmaW5lIExWRVFOQl9HYWluX05lZzEzX2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNzc2MTI4ZikKLSNkZWZpbmUgTFZFUU5CX0dhaW5fTmVnMTJfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC43NDg4MTFmKQotI2RlZmluZSBMVkVRTkJfR2Fpbl9OZWcxMV9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjcxODE2MmYpCi0jZGVmaW5lIExWRVFOQl9HYWluX05lZzEwX2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNjgzNzcyZikKLSNkZWZpbmUgTFZFUU5CX0dhaW5fTmVnOV9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC42NDUxODdmKQotI2RlZmluZSBMVkVRTkJfR2Fpbl9OZWc4X2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjYwMTg5M2YpCi0jZGVmaW5lIExWRVFOQl9HYWluX05lZzdfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuNTUzMzE2ZikKLSNkZWZpbmUgTFZFUU5CX0dhaW5fTmVnNl9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC40OTg4MTNmKQotI2RlZmluZSBMVkVRTkJfR2Fpbl9OZWc1X2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjQzNzY1OWYpCi0jZGVmaW5lIExWRVFOQl9HYWluX05lZzRfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMzY5MDQzZikKLSNkZWZpbmUgTFZFUU5CX0dhaW5fTmVnM19kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yOTIwNTRmKQotI2RlZmluZSBMVkVRTkJfR2Fpbl9OZWcyX2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjIwNTY3MmYpCi0jZGVmaW5lIExWRVFOQl9HYWluX05lZzFfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMTA4NzQ5ZikKLSNkZWZpbmUgTFZFUU5CX0dhaW5fMF9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMGYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fMV9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjEyMjAxOGYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fMl9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI1ODkyNWYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fM19kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjQxMjUzOGYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fNF9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjU4NDg5M2YKLSNkZWZpbmUgTFZFUU5CX0dhaW5fNV9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjc3ODI3OWYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fNl9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjk5NTI2MmYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fN19kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjIzODcyMWYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fOF9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjUxMTg4NmYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fOV9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjgxODM4M2YKLSNkZWZpbmUgTFZFUU5CX0dhaW5fMTBfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjE2MjI3OGYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fMTFfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjU0ODEzNGYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fMTJfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjk4MTA3MmYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fMTNfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLjQ2NjgzNmYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fMTRfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LjAxMTg3MmYKLSNkZWZpbmUgTFZFUU5CX0dhaW5fMTVfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LjYyMzQxM2YKKyNkZWZpbmUgTFZFUU5CX0dhaW5fTmVnMTVfZEIgKC0wLjgyMjE3MmYpCisjZGVmaW5lIExWRVFOQl9HYWluX05lZzE0X2RCICgtMC44MDA0NzRmKQorI2RlZmluZSBMVkVRTkJfR2Fpbl9OZWcxM19kQiAoLTAuNzc2MTI4ZikKKyNkZWZpbmUgTFZFUU5CX0dhaW5fTmVnMTJfZEIgKC0wLjc0ODgxMWYpCisjZGVmaW5lIExWRVFOQl9HYW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FZFUU5CX0dhaW5fOV9kQiAxLjgxODM4M2YKKyNkZWZpbmUgTFZFUU5CX0dhaW5fMTBfZEIgMi4xNjIyNzhmCisjZGVmaW5lIExWRVFOQl9HYWluXzExX2RCIDIuNTQ4MTM0ZgorI2RlZmluZSBMVkVRTkJfR2Fpbl8xMl9kQiAyLjk4MTA3MmYKKyNkZWZpbmUgTFZFUU5CX0dhaW5fMTNfZEIgMy40NjY4MzZmCisjZGVmaW5lIExWRVFOQl9HYWluXzE0X2RCIDQuMDExODcyZgorI2RlZmluZSBMVkVRTkJfR2Fpbl8xNV9kQiA0LjYyMzQxM2YKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBGcmVxdWVuY3kgdGFibGUgZm9yIDIqUGkvRnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0jZGVmaW5lIExWRVFOQl8yUGlPbl84MDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDc4NWYKLSNkZWZpbmUgTFZFUU5CXzJQaU9uXzExMDI1ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwNTcwZgotI2RlZmluZSBMVkVRTkJfMlBpT25fMTIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDA1MjRmCi0jZGVmaW5lI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gICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDA2NWYKLSNkZWZpbmUgTFZFUU5CXzJQaU9uXzE3NjQwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDM2ZgotI2RlZmluZSBMVkVRTkJfMlBpT25fMTkyMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMzNmCisjZGVmaW5lIExWRVFOQl8yUGlPbl84ODIwMCAwLjAwMDA3MWYKKyNkZWZpbmUgTFZFUU5CXzJQaU9uXzk2MDAwIDAuMDAwMDY1ZgorI2RlZmluZSBMVkVRTkJfMlBpT25fMTc2NDAwIDAuMDAwMDM2ZgorI2RlZmluZSBMVkVRTkJfMlBpT25fMTkyMDAwIDAuMDAwMDMzZgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIDUwRCB0YWJsZSBmb3IgNTAgLyAoIDEgKyBHYWluICkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSNkZWZpbmUgTFZFUU5CXzEwMERfTmVnMTVfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUuNjIzNDEzZgotI2RlZmluZSBMVkVRTkJfMTAwRF9OZWcxNF9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNS4wMTE4NzJmCi0jZGVmaW5lIExWRVFOQl8xMDBEX05lZzEzX2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LjQ2NjgzNmYKLSNkZWZpbmUgTFZFUU5CXzEwMERfTmVnMTJfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMuOTgxMDcyZgotI2RlZmluZSBMVkVRTkJfMTAwRF9OZWcxMV9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMy41NDgxMzRmCi0jZGVmaW5lIExWRVFOQl8xMDBEX05lZzEwX2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLjE2MjI3OGYKLSNkZWZpbmUgTFZFUU5CXzEwMERfTmVnOV9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIuODE4MzgzZgotI2RlZmluZSBMVkVRTkJfMTAwRF9OZWc4X2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMi41MTE4ODZmCi0jZGVmaW5lIExWRVFOQl8xMDBEX05lZzdfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjIzODcyMWYKLSNkZWZpbmUgTFZFUU5CXzEwMERfTmVnNl9kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuOTk1MjYyZgotI2RlZmluZSBMVkVRTkJfMTAwRF9OZWc1X2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS43NzgyNzlmCi0jZGVmaW5lIExWRVFOQl8xMDBEX05lZzRfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjU4NDg5M2YKLSNkZWZpbmUgTFZFUU5CXzEwMERfTmVnM19kQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuNDEyNTM4ZgotI2RlZmluZSBMVkVRTkJfMTAwRF9OZWcyX2RCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS4yNTg5MjVmCi0jZGVmaW5lIExWRVFOQl8xMDBEX05lZzFfZEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjEyMjAxOGYKLSNkZWZp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TkJfQ29udHJvbC5jcHAKaW5kZXggNmJiNGE3ZS4uN2U1Y2FlZCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0VxL3NyYy9MVkVRTkJfQ29udHJvbC5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0VxL3NyYy9MVkVRTkJfQ29udHJvbC5jcHAKQEAgLTIxLDYgKzIxLDcgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKKyNpbmNsdWRlIDxzeXN0ZW0vYXVkaW8uaD4KICNpbmNsdWRlICJMVkVRTkIuaCIKICNpbmNsdWRlICJMVkVRTkJfUHJpdmF0ZS5oIgogI2luY2x1ZGUgIlZlY3RvckFyaXRobWV0aWMuaCIKQEAgLTMyLDggKzMzLDggQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSNkZWZpbmUgICAgIExPV19GUkVRICAgICAgICAgICAgMjk4ICAgICAgICAgICAgIC8qIDMyNzY4LzExMCBmb3IgbG93IHRlc3QgZnJlcXVlbmN5ICovCi0jZGVmaW5lICAgICBISUdIX0ZSRVEgICAgICAgICAgIDM4NiAgICAgICAgICAgICAvKiAzMjc2OC84NSBmb3IgaGlnaCB0ZXN0IGZyZXF1ZW5jeSAqLworI2RlZmluZSBMT1dfRlJFUSAyOTggIC8qIDMyNzY4LzExMCBmb3IgbG93IHRlc3QgZnJlcXVlbmN5ICovCisjZGVmaW5lIEhJR0hfRlJFUSAzODYgLyogMzI3NjgvODUgZm9yIGhpZ2ggdGVzdCBmcmVxdWVuY3kgKi8KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTU2LDIzICs1NywxOSBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZFUU5CX1JldHVyblN0YXR1c19lbiBMVkVRTkJfR2V0UGFyYW1ldGVycyhMVkVRTkJfSGFuZGxlX3QgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX1BhcmFtc190ICAgICAqcFBhcmFtcykKLXsKK0xWRVFOQl9SZXR1cm5TdGF0dXNfZW4gTFZFUU5CX0dldFBhcmFtZXRlcnMoTFZFUU5CX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZFUU5CX1BhcmFtc190KiBwUGFyYW1zKSB7CisgICAgTFZFUU5CX0luc3RhbmNlX3QqIHBJbnN0YW5jZSA9IChMVkVRTkJfSW5zdGFuY2VfdCopaEluc3RhbmNlOwogCi0gICAgTFZFUU5CX0luc3RhbmNlX3QgICAgKnBJbnN0YW5jZSA9KExWRVFOQl9JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLQotICAgLyoKKyAgICAvKgogICAgICAqIENoZWNrIGZvciBlcnJvciBjb25kaXRpb25zCiAgICAgICovCi0gICAgaWYoKGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkgfHwgKHBQYXJhbXMgPT0gTFZNX05VTEwpKQotICAgIHsKKyAgICBpZiAoKGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkgfHwgKHBQYXJhbXMgPT0gTFZNX05VTEwpKSB7CiAgICAgICAgIHJldHVybiBMVkVRTkJfTlVMTEFERFJFU1M7CiAgICAgfQogCiAgICAgKnBQYXJhbXMgPSBwSW5zdGFuY2UtPlBhcmFtczsKIAotICAgIHJldHVybihMVkVRTkJfU1VDQ0VTUyk7CisgICAgcmV0dXJuIChMVkVRTkJfU1VDQ0VTUyk7CiB9CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCkBAIC05NiwyMCArOTMsMTcgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVkVRTkJfUmV0dXJuU3RhdHVzX2VuIExWRVFOQl9HZXRDYXBhYmlsaXRpZXMoTFZFUU5CX0hhbmRsZV90ICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0NhcGFiaWxpdGllc190ICAgICAqcENhcGFiaWxpdGllcykKLXsKK0xWRVFOQl9SZXR1cm5TdGF0dXNfZW4gTFZFUU5CX0dldENhcGFiaWxpdGllcyhMVkVRTkJfSGFuZGxlX3QgaEluc3RhbmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9DYXBhYmlsaXRpZXNfdCogcENhcGFiaWxpdGllcykgeworICAgIExWRVFOQl9JbnN0YW5jZV90KiBwSW5zdGFuY2UgPSAoTFZFUU5CX0luc3RhbmNlX3QqKWhJbnN0YW5jZTsKIAotICAgIExWRVFOQl9JbnN0YW5jZV90ICAgICpwSW5zdGFuY2UgPShMVkVRTkJfSW5zdGFuY2VfdCAgKiloSW5zdGFuY2U7Ci0KLSAgICBpZigoaEluc3RhbmNlID09IExWTV9OVUxMKSB8fCAocENhcGFiaWxpdGllcyA9PSBMVk1fTlVMTCkpCi0gICAgeworICAgIGlmICgoaEluc3RhbmNlID09IExWTV9OVUxMKSB8fCAocENhcGFiaWxpdGllcyA9PSBMVk1fTlVMTCkpIHsKICAgICAgICAgcmV0dXJuIExWRVFOQl9OVUxMQUREUkVTUzsKICAgICB9CiAKICAgICAqcENhcGFiaWxpdGllcyA9IHBJbnN0YW5jZS0+Q2FwYWJpbGl0aWVzOwogCi0gICAgcmV0dXJuKExWRVFOQl9TVUNDRVNTKTsKKyAgICByZXR1cm4gKExWRVFOQl9TVUNDRVNTKTsKIH0KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTEzNCwzMyArMTI4LDMwIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotdm9pZCAgICBMVkVRTkJfU2V0RmlsdGVycyhMVkVRTkJfSW5zdGFuY2VfdCAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX1BhcmFtc190ICAgICAgICpwUGFyY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gICAgICAgKi8KLSAgICAgICAgaWYgKGZjID4gKGZzID4+IDEpKQotICAgICAgICB7CisgICAgICAgIGlmIChmYyA+IChmcyA+PiAxKSkgewogICAgICAgICAgICAgcEluc3RhbmNlLT5wQmlxdWFkVHlwZVtpXSA9IExWRVFOQl9PdXRPZlJhbmdlOwogICAgICAgICB9CiAKQEAgLTE2OCw3ICsxNTksNiBAQAogICAgICAgICAgKiBDb3B5IHRoZSBmaWx0ZXIgZGVmaW5pdGlvbiB0byBwZXJzaXN0YW50IG1lbW9yeQogICAgICAgICAgKi8KICAgICAgICAgcEluc3RhbmNlLT5wQmFuZERlZmluaXRpb25zW2ldID0gcFBhcmFtcy0+cEJhbmREZWZpbml0aW9uW2ldOwotCiAgICAgfQogfQogCkBAIC0xODYsNDYgKzE3Niw0NCBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLXZvaWQgICAgTFZFUU5CX1NldENvZWZmaWNpZW50cyhMVkVRTkJfSW5zdGFuY2VfdCAgICAgKnBJbnN0YW5jZSkKLXsKK3ZvaWQgTFZFUU5CX1NldENvZWZmaWNpZW50cyhMVkVRTkJfSW5zdGFuY2VfdCogcEluc3RhbmNlKSB7CisgICAgTFZNX1VJTlQxNiBpOyAgICAgICAgICAgICAgICAgICAgLyogRmlsdGVyIGJhbmQgaW5kZXggKi8KKyAgICBMVkVRTkJfQmlxdWFkVHlwZV9lbiBCaXF1YWRUeXBlOyAvKiBGaWx0ZXIgYmlxdWFkIHR5cGUgKi8KIAotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgIGk7ICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBGaWx0ZXIgYmFuZCBpbmRleCAqLwotICAgIExWR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aW5nbGUgcHJlY2lzaW9uIGNvZWZmaWNpZW50cwogICAgICAgICAgICAgICAgICAqLwogICAgICAgICAgICAgICAgIExWRVFOQl9TaW5nbGVQcmVjQ29lZnMoKExWTV9VSU5UMTYpcEluc3RhbmNlLT5QYXJhbXMuU2FtcGxlUmF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwSW5zdGFuY2UtPnBCYW5kRGVmaW5pdGlvbnNbaV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmQ29lZmZpY2llbnRzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwSW5zdGFuY2UtPnBCYW5kRGVmaW5pdGlvbnNbaV0sICZDb2VmZmljaWVudHMpOwogICAgICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgICAgICogU2V0IHRoZSBjb2VmZmljaWVudHMKICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBQS18ySV9EMzJGMzJDc3NHc3NfVFJDX1dSQV8wMV9Jbml0KCZwSW5zdGFuY2UtPnBFUU5CX0ZpbHRlclN0YXRlX0Zsb2F0W2ldLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBJbnN0YW5jZS0+cEVRTkJfVGFwc19GbG9hdFtpXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZDb2VmZmljaWVudHMpOworICAgICAgICAgICAgICAgIHBJbnN0YW5jZS0+Z2FpbltpXSA9IENvZWZmaWNpZW50cy5HOworICAgICAgICAgICAgICAgIHN0ZDo6YXJyYXk8TFZNX0ZMT0FULCBhbmRyb2lkOjphdWRpb191dGlsczo6a0JpcXVhZE51bUNvZWZzPiBjb2VmcyA9IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIENvZWZmaWNpZW50cy5BMCwgMC4wLCAtKENvZWZmaWNpZW50cy5BMCksIC0oQ29lZmZpY2llbnRzLkIxKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIC0oQ29lZmZpY2llbnRzLkIyKX07CisgICAgICAgICAgICAgICAgcEluc3RhbmNlLT5lcUJpcXVhZFtpXQorICAgICAgICAgICAgICAgICAgICAgICAgLnNldENvZWZmaWNpZW50czwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjphcnJheTxMVk1fRkxPQVQsIGFuZHJvaWQ6OmF1ZGlvX3V0aWxzOjprQmlxdWFkTnVtQ29lZnM+PigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29lZnMpOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogICAgIH0KLQogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtMjM5LDIwICsyMjcsOSBAQAogLyogIHBJbnN0YW5jZSAgICAgICAgICAgUG9pbnRlciB0byB0aGUgaW5zdGFuY2UgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCAgICBMVkVRTkJfQ2xlYXJGaWx0ZXJIaXN0b3J5KExWRVFOQl9JbnN0YW5jZV90ICAgICAqcEluc3RhbmNlKQotewotICAgIExWTV9GTE9BVCAgICAgICAqcFRhcEFkZHJlc3M7Ci0gICAgTFZNX0lOVDE2ICAgICAgIE51bVRhcHM7Ci0KLSAgICBwVGFwQWRkcmVzcyA9IChMVk1fRkxPQVQgKilwSW5zdGFuY2UtPnBFUU5CX1RhcHNfRmxvYXQ7Ci0gICAgTnVtVGFwcyAgICAgPSAoTFZNX0lOVDE2KSgocEluc3RhbmNlLT5DYXBhYmlsaXRpZXMuTWF4QmFuZHMgKiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoQmlxdWFkXzJJX09yZGVyMl9GTE9BVF9UYXBzX3QpKSAvIHNpemVvZihMVk1fRkxPQVQpKTsKLQotICAgIGlmIChOdW1UYXBzICE9IDApCi0gICAgewotICAgICAgICBMb2FkQ29uc3RfRmxvYXQoMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBDbGVhciB0aGUgaGlzdG9yeSwgdmFsdWUgMCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgcFRhcEFkZHJlc3MsICAgICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgTnVtVGFwcyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBOdW1iZXIgb2Ygd29yZHMgKi8KK3ZvaWQgTFZFUU5CX0NsZWFyRmlsdGVySGlzdG9yeShMVkVRTkJfSW5zdGFuY2VfdCogcEluc3RhbmNlKSB7CisgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBwSW5zdGFuY2UtPmVxQmlxdWFkLnNpemUoKTsgaSsrKSB7CisgICAgICAgIHBJbnN0YW5jZS0+ZXFCaXF1YWRbaV0uY2xlYXIoKTsKICAgICB9CiB9CiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTI3Nyw1NiArMjU0LDQ3IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVkVRTkJfUmV0dXJuU3RhdHVzX2VuIExWRVFOQl9Db250cm9sKExWRVFOQl9IYW5kbGVfdCAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfUGFyYW1zX3QgICAgICAgICpwUGFyYW1zKQotewotCi0gICAgTFZFUU5CX0luc3RhbmNlX3QgICAgKnBJbnN0YW5jZSA9IChMVkVRTkJfSW5zdGFuY2VfdCAgKiloSW5zdGFuY2U7Ci0gICAgTFZNX0lOVDE2ICAgICAgICAgICAgYkNoYW5nZSAgICA9IExWTV9GQUxTRTsKLSAgICBMVk1fSU5UMTYgICAgICAgICAgICBpID0gMDsKLSAgICBMVkVRTkJfTW9kZV9lbiAgICAgICBPcGVyYXRpbmdNb2RlU2F2ZSA7CitMVkVRTkJfUmV0dXJuU3RhdHVzX2VuIExWRVFOQl9Db250cm9sKExWRVFOQl9IYW5kbGVfdCBoSW5zdGFuY2UsIExWRVFOQl9QYXJhbXNfdCogcFBhcmFtcykgeworICAgIExWRVFOQl9JbnN0YW5jZV90KiBwSW5zdGFuY2UgPSAoTFZFUU5CX0luc3RhbmNlX3QqKWhJbnN0YW5jZTsKKyAgICBMVk1fSU5UMTYgYkNoYW5nZSA9IExWTV9GQUxTRTsKKyAgICBMVk1fSU5UMTYgaSA9IDA7CisgICAgTFZFUU5CX01vZGVfZW4gT3BlcmF0aW5nTW9kZVNhdmU7CiAKICAgICAvKgogICAgICAqIENoZWNrIGZvciBlcnJvciBjb25kaXRpb25zCiAgICAgICovCi0gICAgaWYoKGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkgfHwgKHBQYXJhbXMgPT0gTFZNX05VTEwpKQotICAgIHsKKyAgICBpZiAoKGhJbnN0YW5jZSA9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19NaXhlcl9WYXJTbG9wZV9TZXRUaW1lQ29uc3RhbnQoJnBJbnN0YW5jZS0+QnlwYXNzTWl4ZXIuTWl4ZXJTdHJlYW1bMF0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0JZUEFTU19NSVhFUl9UQywgKExWTV9Gc19lbilwUGFyYW1zLT5TYW1wbGVSYXRlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIpOworICAgICAgICBMVkNfTWl4ZXJfVmFyU2xvcGVfU2V0VGltZUNvbnN0YW50KCZwSW5zdGFuY2UtPkJ5cGFzc01peGVyLk1peGVyU3RyZWFtWzFdLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9CWVBBU1NfTUlYRVJfVEMsIChMVk1fRnNfZW4pcFBhcmFtcy0+U2FtcGxlUmF0ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyKTsKICAgICB9CiAKLSAgICBpZiggKHBJbnN0YW5jZS0+UGFyYW1zLk5CYW5kcyAgICAgICAgICAgICE9ICBwUGFyYW1zLT5OQmFuZHMgICAgICAgICAgKSB8fAotICAgICAgICAocEluc3RhbmNlLT5QYXJhbXMuT3BlcmF0aW5nTW9kZSAgICAgIT0gIHBQYXJhbXMtPk9wZXJhdGluZ01vZGUgICApIHx8Ci0gICAgICAgIChwSW5zdGFuY2UtPlBhcmFtcy5wQmFuZERlZmluaXRpb24gICAhPSAgcFBhcmFtcy0+cEJhbmREZWZpbml0aW9uICkgfHwKLSAgICAgICAgKHBJbnN0YW5jZS0+UGFyYW1zLlNhbXBsZVJhdGUgICAgICAgICE9ICBwUGFyYW1zLT5TYW1wbGVSYXRlICAgICAgKSB8fAotICAgICAgICAocEluc3RhbmNlLT5QYXJhbXMuU291cmNlRm9ybWF0ICAgICAgIT0gIHBQYXJhbXMtPlNvdXJjZUZvcm1hdCAgIC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2xlYXJGaWx0ZXJIaXN0b3J5KHBJbnN0YW5jZSk7ICAgICAgICAgICAvKiBDbGVhciB0aGUgaGlzdG9yeSAqLworICAgICAgICBpZiAocEluc3RhbmNlLT5QYXJhbXMuU2FtcGxlUmF0ZSAhPSBwUGFyYW1zLT5TYW1wbGVSYXRlKSB7CisgICAgICAgICAgICBMVkVRTkJfQ2xlYXJGaWx0ZXJIaXN0b3J5KHBJbnN0YW5jZSk7IC8qIENsZWFyIHRoZSBoaXN0b3J5ICovCiAgICAgICAgIH0KIAogICAgICAgICAvKgpAQCAtMzU4LDQ1ICszMzEsNDUgQEAKICAgICAgICAgLyoKICAgICAgICAgICogUmVzZXQgdGhlIGZpbHRlcnMgZXhjZXB0IGlmIHRoZSBhbGdvIGlzIHN3aXRjaGVkIG9mZgogICAgICAgICAgKi8KLSAgICAgICAgaWYocFBhcmFtcy0+T3BlcmF0aW5nTW9kZSAhPSBMVkVRTkJfQllQQVNTKXsKKyAgICAgICAgaWYgKHBQYXJhbXMtPk9wZXJhdGluZ01vZGUgIT0gTFZFUU5CX0JZUEFTUykgewogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIFJlc2V0IHRoZSBmaWx0ZXJzIGFzIGFsbCBwYXJhbWV0ZXJzIGNvdWxkIGhhdmUgY2hhbmdlZAogICAgICAgICAgICAgICovCi0gICAgICAgICAgICBMVkVRTkJfU2V0RmlsdGVycyhwSW5zdGFuY2UsICAgICAgICAgICAgICAgICAgICAgICAgLyogSW5zdGFuY2UgcG9pbnRlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFBhcmFtcyk7ICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE5ldyBwYXJhbWV0ZXJzICovCisgICAgICAgICAgICBMVkVRTkJfU2V0RmlsdGVycyhwSW5zdGFuY2UsIC8qIEluc3RhbmNlIHBvaW50ZXIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQYXJhbXMpOyAgLyogTmV3IHBhcmFtZXRlcnMgKi8KIAogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIFVwZGF0ZSB0aGUgZmlsdGVycwogICAgICAgICAgICAgICovCi0gICAgICAgICAgICBMVkVRTkJfU2V0Q29lZmZpY2llbnRzKHBJbnN0YW5jZSk7ICAgICAgICAgICAgICAgICAgLyogSW5zdGFuY2UgcG9pbnRlciAqLworICAgICAgICAgICAgTFZFUU5CX1NldENvZWZmaWNpZW50cyhwSW5zdGFuY2UpOyAvKiBJbnN0YW5jZSBwb2ludGVyICovCiAgICAgICAgIH0KIAogICAgICAgICBpZiAobW9kZUNoYW5nZSkgewotICAgICAgICAgICAgaWYocFBhcmFtcy0+T3BlcmF0aW5nTW9kZSA9PSBMVkVRTkJfT04pCi0gICAgICAgICAgICB7CisgICAgICAgICAgICBpZiAocFBhcmFtcy0+T3BlcmF0aW5nTW9kZSA9PSBMVkVRTkJfT04pIHsKICAgICAgICAgICAgICAgICBMVkNfTWl4ZXJfU2V0VGFyZ2V0KCZwSW5zdGFuY2UtPkJ5cGFzc01peGVyLk1peGVyU3RyZWFtWzBdLCAxLjBmKTsKICAgICAgICAgICAgICAgICBMVkNfTWl4ZXJfU2V0VGFyZ2V0KCZwSW5zdGFuY2UtPkJ5cGFzc01peGVyLk1peGVyU3RyZWFtWzFdLCAwLjBmKTsKLSAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPkJ5cGFzc01peGVyLk1peGVyU3RyZWFtWzBdLkNhbGxiYWNrU2V0ICAgICAgICA9IDE7Ci0gICAgICAgICAgICAgICAgcEluc3RhbmNlLT5CeXBhc3NNaXhlci5NaXhlclN0cmVhbVsxXS5DYWxsYmFja1NldCAgICAgICAgPSAxOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHBJbnN0YW5jZS0+QnlwYXNzTWl4ZXIuTWl4ZXJTdHJlYW1bMF0uQ2FsbGJhY2tTZXQgPSAxOworICAgICAgICA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0+QnlwYXNzTWl4ZXIuTWl4ZXJTdHJlYW1bMV0uQ2FsbGJhY2tTZXQgPSAxOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgTFZDX01peGVyX1ZhclNsb3BlX1NldFRpbWVDb25zdGFudCgmcEluc3RhbmNlLT5CeXBhc3NNaXhlci5NaXhlclN0cmVhbVswXSxMVkVRTkJfQllQQVNTX01JWEVSX1RDLChMVk1fRnNfZW4pcFBhcmFtcy0+U2FtcGxlUmF0ZSwyKTsKLSAgICAgICAgICAgIExWQ19NaXhlcl9WYXJTbG9wZV9TZXRUaW1lQ29uc3RhbnQoJnBJbnN0YW5jZS0+QnlwYXNzTWl4ZXIuTWl4ZXJTdHJlYW1bMV0sTFZFUU5CX0JZUEFTU19NSVhFUl9UQywoTFZNX0ZzX2VuKXBQYXJhbXMtPlNhbXBsZVJhdGUsMik7CisgICAgICAgICAgICBMVkNfTWl4ZXJfVmFyU2xvcGVfU2V0VGltZUNvbnN0YW50KCZwSW5zdGFuY2UtPkJ5cGFzc01peGVyLk1peGVyU3RyZWFtWzBdLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQllQQVNTX01JWEVSX1RDLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0ZzX2VuKXBQYXJhbXMtPlNhbXBsZVJhdGUsIDIpOworICAgICAgICAgICAgTFZDX01peGVyX1ZhclNsb3BlX1NldFRpbWVDb25zdGFudCgmcEluc3RhbmNlLT5CeXBhc3NNaXhlci5NaXhlclN0cmVhbVsxXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0JZUEFTU19NSVhFUl9UQywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9Gc19lbilwUGFyYW1zLT5TYW1wbGVSYXRlLCAyKTsKICAgICAgICAgICAgIHBJbnN0YW5jZS0+YkluT3BlcmF0aW5nTW9kZVRyYW5zaXRpb24gPSBMVk1fVFJVRTsKICAgICAgICAgfQotCiAgICAgfQotICAgIHJldHVybihMVkVRTkJfU1VDQ0VTUyk7CisgICAgcmV0dXJuIChMVkVRTkJfU1VDQ0VTUyk7CiB9CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtNDA4LDIzICszODEsMjIgQEAKIC8qICB0cmFuc2l0aW9uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9JTlQzMiBMVkVRTkJfQnlwYXNzTWl4ZXJDYWxsQmFjayAodm9pZCogaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICpwR2VuZXJhbFB1cnBvc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBDYWxsYmFja1BhcmFtKQotewotICAgIExWRVFOQl9JbnN0YW5jZV90ICAgICAgKnBJbnN0YW5jZSA9KExWRVFOQl9JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLSAgICBMVk1fQ2FsbGJhY2sgICAgICAgICAgICBDYWxsQmFjayAgPSBwSW5zdGFuY2UtPkNhcGFiaWxpdGllcy5DYWxsQmFjazsKK0xWTV9JTlQzMiBMVkVRTkJfQnlwYXNzTWl4ZXJDYWxsQmFjayh2b2lkKiBoSW5zdGF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mg+IC8qIEZvciBtZW1zZXQgKi8KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICBMVkVRTkJfTWVtb3J5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgZm9yIG1lbW9yeSBhbGxvY2F0aW9uIGFuZCBmcmVlLiBJdCBjYW4gYmUgY2FsbGVkIGluICAgICAgICAgICAqLwotLyogIHR3byB3YXlzOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgaEluc3RhbmNlID0gTlVMTCAgICAgICAgICAgICAgICBSZXR1cm5zIHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzICAgICAgICAgICAgICAgICAqLwotLyogICAgICBoSW5zdGFuY2UgPSBJbnN0YW5jZSBoYW5kbGUgICAgIFJldHVybnMgdGhlIG1lbW9yeSByZXF1aXJlbWVudHMgYW5kICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb2NhdGVkIGJhc2UgYWRkcmVzc2VzIGZvciB0aGUgaW5zdGFuY2UgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFdoZW4gdGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgZm9yIG1lbW9yeSBhbGxvY2F0aW9uIChoSW5zdGFuY2U9TlVMTCkgdGhlIG1lbW9yeSAgICAgICovCi0vKiAgYmFzZSBhZGRyZXNzIHBvaW50ZXJzIGFyZSBOVUxMIG9uIHJldHVybi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFdoZW4gdGhlIGZ1bmN0aW9uIGlzIGNhbGxlZCBmb3IgZnJlZSAoaEluc3RhbmNlID0gSW5zdGFuY2UgSGFuZGxlKSB0aGUgbWVtb3J5ICAgICAgICovCi0vKiAgdGFibGUgcmV0dXJucyB0aGUgYWxsb2NhdGVkIG1lbW9yeSBhbmQgYmFzZSBhZGRyZXNzZXMgdXNlZCBkdXJpbmcgaW5pdGlhbGlzYXRpb24uICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlICAgICAgICAgICAgICAgSW5zdGFuY2UgSGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwTWVtb3J5VGFibGUgICAgICAgICAgICBQb2ludGVyIHRvIGFuIGVtcHR5IG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICAqLwotLyogIHBDYXBhYmlsaXRpZXMgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGluc3RhbmNlIGNhcGFiaWxpdGllcyAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIExWRVFOQl9TVUNDRVNTICAgICAgICAgIFN1Y2NlZWRlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZFUU5CX05VTExBRERSRVNTICAgICAgV2hlbiBhbnkgb2YgcE1lbW9yeVRhYmxlIGFuZCBwQ2FwYWJpbGl0aWVzIGlzIE5VTEwgYWRkcmVzcyAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgMS4gIFRoaXMgZnVuY3Rpb24gbWF5IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVkVRTkJfUHJvY2VzcyBmdW5jdGlvbiAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLUxWRVFOQl9SZXR1cm5TdGF0dXNfZW4gTFZFUU5CX01lbW9yeShMVkVRTkJfSGFuZGxlX3QgICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX01lbVRhYl90ICAgICAgICAgICAgKnBNZW1vcnlUYWJsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQ2FwYWJpbGl0aWVzX3QgICAgICAqcENhcGFiaWxpdGllcykKLXsKLQotICAgIElOU1RfQUxMT0MgICAgICAgICAgQWxsb2NNZW07Ci0gICAgTFZFUU5CX0luc3RhbmNlX3QgICAqcEluc3RhbmNlID0gKExWRVFOQl9JbnN0YW5jZV90ICopaEluc3RhbmNlOwotCi0gICAgaWYoKHBNZW1vcnlUYWJsZSA9PSBMVk1fTlVMTCl8fCAocENhcGFiaWxpdGllcyA9PSBMVk1fTlVMTCkpCi0gICAgewotICAgICAgICByZXR1cm4gTFZFUU5CX05VTExBRERSRVNTOwotICAgIH0KLQotICAgIC8qCi0gICAgICogRmlsbCBpbiB0aGUgbWVtb3J5IHRhYmxlCi0gICAgICovCi0gICAgaWYgKGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkKLSAgICB7Ci0gICAgICAgIC8qCi0gICAgICAgICAqIEluc3RhbmNlIG1lbW9yeQotICAgICAgICAgKi8KLSAgICAgICAgSW5zdEFsbG9jX0luaXQoJkFsbG9jTWVtLAotICAgICAgICAgICAgICAgICAgICAgICBMVk1fTlVMTCk7Ci0gICAgICAgIEluc3RBbGxvY19BZGRNZW1iZXIoJkFsbG9jTWVtLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIExvdyBwYXNzIGZpbHRlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihMVkVRTkJfSW5zdGFuY2VfdCkpOwotICAgICAgICBwTWVtb3J5VGFibGUtPlJlZ2lvbltMVkVRTkJfTUVNUkVHSU9OX0lOU1RBTkNFXS5TaXplICAgICAgICAgPSBJbnN0QWxsb2NfR2V0VG90YWwoJkFsbG9jTWVtKTsKLSAgICAgICAgcE1lbW9yeVRhYmxlLT5SZWdpb25bTFZFUU5CX01FTVJFR0lPTl9JTlNUQU5DRV0uQWxpZ25tZW50ICAgID0gTFZFUU5CX0lOU1RBTkNFX0FMSUdOOwotICAgICAgICBwTWVtb3J5VGFibGUtPlJlZ2lvbltMVkVRTkJfTUVNUkVHSU9OX0lOU1RBTkNFXS5UeXBlICAgICAgICAgPSBMVkVRTkJfUEVSU0lTVEVOVDsKLSAgICAgICAgcE1lbW9yeVRhYmxlLT5SZWdpb25bTFZFUU5CX01FTVJFR0lPTl9JTlNUQU5DRV0ucEJhc2VBZGRyZXNzID0gTFZNX05VTEw7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogUGVyc2lzdGFudCBkYXRhIG1lbW9yeQotICAgICAgICAgKi8KLSAgICAgICAgSW5zdEFsbG9jX0luaXQoJkFsbG9jTWVtLAotICAgICAgICAgICAgICAgICAgICAgICBMVk1fTlVMTCk7Ci0gICAgICAgIEluc3RBbGxvY19BZGRNZW1iZXIoJkFsbG9jTWVtLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIExvdyBwYXNzIGZpbHRlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihCaXF1YWRfMklfT3JkZXIyX0ZMT0FUX1RhcHNfdCkpOwotICAgICAgICBJbnN0QWxsb2NfQWRkTWVtYmVyKCZBbGxvY01lbSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBIaWdoIHBhc3MgZmlsdGVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKEJpcXVhZF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5VGFibGUtPlJlZ2lvbltMVkVRTkJfTUVNUkVHSU9OX1BFUlNJU1RFTlRfREFUQV0ucEJhc2VBZGRyZXNzID0gTFZNX05VTEw7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogUGVyc2lzdGFudCBjb2VmZmljaWVudCBtZW1vcnkKLSAgICAgICAgICovCi0gICAgICAgIEluc3RBbGxvY19Jbml0KCZBbGxvY01lbSwKLSAgICAgICAgICAgICAgICAgICAgICAgTFZNX05VTEwpOwotICAgICAgICBJbnN0QWxsb2NfQWRkTWVtYmVyKCZBbGxvY01lbSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBMb3cgcGFzcyBmaWx0ZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QpKTsKLSAgICAgICAgSW5zdEFsbG9jX0FkZE1lbWJlcigmQWxsb2NNZW0sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSGlnaCBwYXNzIGZpbHRlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCkpOwotICAgICAgICAvKiBFcXVhbGlzZXIgQmlxdWFkIEluc3RhbmNlICovCi0gICAgICAgIEluc3RBbGxvY19BZGRNZW1iZXIoJkFsbG9jTWVtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBDYXBhYmlsaXRpZXMtPk1heEJhbmRzICogc2l6ZW9mKEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90KSk7Ci0gICAgICAgIHBNZW1vcnlUYWJsZS0+UmVnaW9uW0xWRVFOQl9NRU1SRUdJT05fUEVSU0lTVEVOVF9DT0VGXS5TaXplICAgICAgICAgPSBJbnN0QWxsb2NfR2V0VG90YWwoJkFsbG9jTWVtKTsKLSAgICAgICAgcE1lbW9yeVRhYmxlLT5SZWdpb25bTFZFUU5CX01FTVJFR0lPTl9QRVJTSV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CX01FTVJFR0lPTl9TQ1JBVENIXS5UeXBlICAgICAgICAgICAgICA9IExWRVFOQl9TQ1JBVENIOwotICAgICAgICBwTWVtb3J5VGFibGUtPlJlZ2lvbltMVkVRTkJfTUVNUkVHSU9OX1NDUkFUQ0hdLnBCYXNlQWRkcmVzcyAgICAgID0gTFZNX05VTEw7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIC8qIFJlYWQgYmFjayBtZW1vcnkgYWxsb2NhdGlvbiB0YWJsZSAqLwotICAgICAgICAqcE1lbW9yeVRhYmxlID0gcEluc3RhbmNlLT5NZW1vcnlUYWJsZTsKLSAgICB9Ci0KLSAgICByZXR1cm4oTFZFUU5CX1NVQ0NFU1MpOwotfQotCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgIExWRVFOQl9Jbml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIENyZWF0ZSBhbmQgaW5pdGlhbGlzYXRpb24gZnVuY3Rpb24gZm9yIHRoZSBOLUJhbmQgZXF1YWxpc2VyIG1vZHVsZSAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBUaGlzIGZ1bmN0aW9uIGNhbiBiZSB1c2VkIHRvIGNyZWF0ZSBhbiBhbGdvcml0aG0gaW5zdGFuY2UgYnkgY2FsbGluZyB3aXRoICAgICAgICAgICAqLwotLyogIGhJbnN0YW5jZSBzZXQgdG8gTlVMTC4gSW4gdGhpcyBjYXNlIHRoZSBhbGdvcml0aG0gcmV0dXJucyB0aGUgbmV3IGluc3RhbmNlICAgICAgICAgICovCi0vKiAgaGFuZGxlLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFRoaXMgZnVuY3Rpb24gY2FuIGJlIHVzZWQgdG8gZm9yY2UgYSBmdWxsIHJlLWluaXRpYWxpc2F0aW9uIG9mIHRoZSBhbGdvcml0aG0gICAgICAgICovCi0vKiAgYnkgY2FsbGluZyB3aXRoIGhJbnN0YW5jZSA9IEluc3RhbmNlIEhhbmRsZS4gSW4gdGhpcyBjYXNlIHRoZSBtZW1vcnkgdGFibGUgICAgICAgICAgKi8KLS8qICBzaG91bGQgYmUgY29ycmVjdCBmb3IgdGhlIGluc3RhbmNlLCB0aGlzIGNhbiBiZSBlbnN1cmVkIGJ5IGNhbGxpbmcgdGhlIGZ1bmN0aW9uICAgICAqLwotLyogIERCRV9NZW1vcnkgYmVmb3JlIGNhbGxpbmcgdGhpcyBmdW5jdGlvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgQ3JlYXRlIGFuZCBpbml0aWFsaXNhdGlvbiBmdW5jdGlvbiBmb3IgdGhlIE4tQmFuZCBlcXVhbGlzZXIgbW9kdWxlLiAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlICAgICAgICAgICAgICAgSW5zdGFuY2UgaGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwTWVtb3J5VGFibGUgICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBtZW1vcnkgZGVmaW5pdGlvbiB0YWJsZSAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBDYXBhYmlsaXRpZXMgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGluc3RhbmNlIGNhcGFiaWxpdGllcyAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgcGhJbnN0YW5jZSAgICAgICAgICAgICAgUG9pbnRlciB0byBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwQ2FwYWJpbGl0aWVzICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbml0aWFsaXNhdGlvbiBjYXBhYmlsaXRpZXMgICAgICAgICAgICAgICAgICAqLworLyogIHBTY3JhdGNoICAgICAgICAgICAgICAgIFBvaW50ZXIgdG8gYnVuZGxlIHNjcmF0Y2ggYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogIExWRVFOQl9TVUNDRVNTICAgICAgICAgIEluaXRpYWxpc2F0aW9uIHN1Y2NlZWRlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZFUU5CX05VTExBRERSRVNTICAgICAgICBXaGVuIHBDYXBhYmlsaXRpZXMgb3IgcE1lbW9yeVRhYmxlaXMgb3IgcGhJbnN0YW5jZSBhcmUgTlVMTCAqLwotLyogIExWRVFOQl9OVUxMQUREUkVTUyAgICAgICAgT25lIG9yIG1vcmUgb2YgdGhlIG1lbW9yeSByZWdpb25zIGhhcyBhIE5VTEwgYmFzZSBhZGRyZXNzICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVyIGZvciBhIG1lbW9yeSByZWdpb24gd2l0aCBhIG5vbi16ZXJvIHNpemUuICAgICAgICAgICAqLworLyogIExWRVFOQl9OVUxMQUREUkVTUyAgICAgIE9uZSBvciBtb3JlIG1lbW9yeSBoYXMgYSBOVUxMIHBvaW50ZXIgLSBtYWxsb2MgZmFpbHVyZSAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIDEuICBUaGUgaW5zdGFuY2UgaGFuZGxlIGlzIHRoZSBwb2ludGVyIHRvIHRoZSBiYXNlIGFkZHJlc3Mgb2YgdGhlIGZpcnN0IG1lbW9yeSAgICAgICovCi0vKiAgICAgIHJlZ2lvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAyLiAgVGhpcyBmdW5jdGlvbiBtdXN0IG5vdCBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZFUU5CX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAqLworLyogIDEuICBUaGlzIGZ1bmN0aW9uIG11c3Qgbm90IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVkVRTkJfUHJvY2VzcyBmdW5jdGlvbiAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVkVRTkJfUmV0dXJuU3RhdHVzX2VuIExWRVFOQl9Jbml0KExWRVFOQl9IYW5kbGVfdCAgICAgICAgICAqcGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX01lbVRhYl90ICAgICAgICAgICpwTWVtb3J5VGFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9DYXBhYmlsaXRpZXNfdCAgICAqcENhcGFiaWxpdGllcykKLXsKK0xWRVFOQl9SZXR1cm5TdGF0dXNfZW4gTFZFUU5CX0luaXQoTFZFUU5CX0hhbmRsZV90KiBwaEluc3RhbmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfQ2FwYWJpbGl0aWVzX3QqIHBDYXBhYmlsaXRpZXMsIHZvaWQqIHBTY3JhdGNoKSB7CisgICAgTFZFUU5CX0luc3RhbmNlX3QqIHBJbnN0YW5jZTsKIAotICAgIExWRVFOQl9JbnN0YW5jZV90ICAgKnBJbnN0YW5jZTsKLSAgICBMVk1fVUlOVDMyICAgICAgICAgIE1lbVNpemU7Ci0gICAgSU5TVF9BTExPQyAgICAgICAgICBBbGxvY01lbTsKLSAgICBMVk1fSU5UMzIgICAgICAgICAgIGk7CisgICAgKnBoSW5zdGFuY2UgPSBuZXcgTFZFUU5CX0luc3RhbmNlX3R7fTsKKyAgICBwSW5zdGFuY2UgPSAoTFZFUU5CX0luc3RhbmNlX3QqKSpwaEluc3RhbmNlOwogCi0gICAgLyoKLSAgICAgKiBDaGVjayBmb3IgTlVMTCBwb2ludGVycwotICAgICAqLwotICAgIGlmKChwaEluc3RhbmNlID09IExWTV9OVUxMKSB8fCAocE1lbW9yeVRhYmxlID09IExWTV9OVUxMKSB8fCAocENhcGFiaWxpdGllcyA9PSBMVk1fTlVMTCkpCi0gICAgewotICAgICAgICByZXR1cm4gTFZFUU5CX05VTExBRERSRVNTOwotICAgIH0KLQotICAgIC8qCi0gICAgICogQ2hlY2sgdGhlIG1lbW9yeSB0YWJsZSBmb3IgTlVMTCBwb2ludGVycwotICAgICAqLwotICAgIGZvciAoaSA9IDA7IGkgPCBMVkVRTkJfTlJfTUVNT1JZX1JFR0lPTlM7IGkrKykKLSAgICB7Ci0gICAgICAgIGlmIChwTWVtb3J5VGFibGUtPlJlZ2lvbltpXS5TaXplIT0wKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAocE1lbW9yeVRhYmxlLT5SZWdpb25baV0ucEJhc2VBZGRyZXNzPT1MVk1fTlVMTCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICByZXR1cm4oTFZFUU5CX05VTExBRERSRVNTKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qCi0gICAgICogU2V0IHRoZSBpbnN0YW5jZSBoYW5kbGUgaWYgbm90IGFscmVhZHkgaW5pdGlhbGlzZWQKLSAgICAgKi8KLQotICAgIEluc3RBbGxvY19Jbml0KCZBbGxvY01lbSwgIHBNZW1vcnlUYWJsZS0+UmVnaW9uW0xWRVFOQl9NRU1SRUdJT05fSU5TVEFOQ0VdLnBCYXNlQWRkcmVzcyk7Ci0KLSAgICBpZiAoKnBoSW5zdGFuY2UgPT0gTFZNX05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YXhCYW5kcyAqIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QpKTsKLQotICAgIC8qCi0gICAgICogQWxsb2NhdGUgZGF0YSBtZW1vcnkKLSAgICAgKi8KLSAgICBJbnN0QWxsb2NfSW5pdCgmQWxsb2NNZW0sCi0gICAgICAgICAgICAgICAgICAgcE1lbW9yeVRhYmxlLT5SZWdpb25bTFZFUU5CX01FTVJFR0lPTl9QRVJTSVNURU5UX0RBVEFdLnBCYXNlQWRkcmVzcyk7Ci0KLSAgICBNZW1TaXplID0gKHBDYXBhYmlsaXRpZXMtPk1heEJhbmRzICogc2l6ZW9mKEJpcXVhZF8ySV9PcmRlcjJfRkxPQVRfVGFwc190KSk7Ci0gICAgcEluc3RhbmNlLT5wRVFOQl9UYXBzX0Zsb2F0ID0gKEJpcXVhZF8ySV9PcmRlcjJfRkxPQVRfVGFwc190ICopSW5zdEFsbG9jX0FkZE1lbWJlcigmQWxsb2NNZW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNZW1TaXplKTsKLSAgICBNZW1TaXplID0gKHBDYXBhYmlsaXRpZXMtPk1heEJhbmRzICogc2l6ZW9mKExWRVFOQl9CYW5kRGVmX3QpKTsKLSAgICBwSW5zdGFuY2UtPnBCYW5kRGVmaW5pdGlvbnMgID0gKExWRVFOQl9CYW5kRGVmX3QgKilJbnN0QWxsb2NfQWRkTWVtYmVyKCZBbGxvY01lbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1lbVNpemUpOworICAgIExWTV9VSU5UMzIgTWVtU2l6ZSA9IHBDYXBhYmlsaXRpZXMtPk1heEJhbmRzICogc2l6ZW9mKCooc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qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBGVU5DVElPTjogICAgICAgICAgICAgICAgTFZFUU5CX0RlSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICBGcmVlIHRoZSBtZW1vcmllcyBjcmVhdGVkIGR1cmluZyBMVkVRTkJfSW5pdCBpbmNsdWRpbmcgaW5zdGFuY2UgaGFuZGxlICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgcGhJbnN0YW5jZSAgICAgICAgICAgICAgUG9pbnRlciB0byBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgMS4gIFRoaXMgZnVuY3Rpb24gbXVzdCBub3QgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWRVFOQl9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKK3ZvaWQgTFZFUU5CX0RlSW5pdChMVkVRTkJfSGFuZGxlX3QqIHBoSW5zdGFuY2UpIHsKKyAgICBMVkVRTkJfSW5zdGFuY2VfdCogcEluc3RhbmNlOworICAgIGlmIChwaEluc3RhbmNlID09IExWTV9OVUxMKSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgcEluc3RhbmNlID0gKExWRVFOQl9JbnN0YW5jZV90KikqcGhJbnN0YW5jZTsKKworICAgIGlmIChwSW5zdGFuY2UtPnBCYW5kRGVmaW5pdGlvbnMgIT0gTFZNX05VTEwpIHsKKyAgICAgICAgZnJlZShwSW5zdGFuY2UtPnBCYW5kRGVmaW5pdGlvbnMpOworICAgICAgICBwSW5zdGFuY2UtPnBCYW5kRGVmaW5pdGlvbnMgPSBMVk1fTlVMTDsKKyAgICB9CisgICAgaWYgKHBJbnN0YW5jZS0+cEJpcXVhZFR5cGUgIT0gTFZNX05VTEwpIHsKKyAgICAgICAgZnJlZShwSW5zdGFuY2UtPnBCaXF1YWRUeXBlKTsKKyAgICAgICAgcEluc3RhbmNlLT5wQmlxdWFkVHlwZSA9IExWTV9OVUxMOworICAgIH0KKyAgICBkZWxldGUgcEluc3RhbmNlOworICAgICpwaEluc3RhbmNlID0gTFZNX05VTEw7Cit9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvRXEvc3JjL0xWRVFOQl9Qcml2YXRlLmggYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvRXEvc3JjL0xWRVFOQl9Qcml2YXRlLmgKaW5kZXggNDBmYWNmYi4uMjIyNWZlYyAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0VxL3NyYy9MVkVRTkJfUHJpdmF0ZS5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9FcS9zcmMvTFZFUU5CX1ByaXZhdGUuaApAQCAtMjQsNyArMjQsOCBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotI2luY2x1ZGUgIkxWRVFOQi5oIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBDYWxsaW5nIG9yIEFwcGxpY2F0aW9uIGxheWVyIGRlZmluaXRpb25zICovCisjaW5jbHVkZSA8YXVkaW9fdXRpbHMvQmlxdWFkRmlsdGVyLmg+CisjaW5jbHVkZSAiTFZFUU5CLmgiIC8qIENhbGxpbmcgb3IgQXBwbGljYXRpb24gbGF5ZXIgZGVmaW5pdGlvbnMgKi8KICNpbmNsdWRlICJCSVFVQUQuaCIKICNpbmNsdWRlICJMVkNfTWl4ZXIuaCIKIApAQCAtMzUsMjEgKzM2LDggQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCiAvKiBHZW5lcmFsICovCi0jZGVmaW5lIExWRVFOQl9JTlZBTElEICAgICAgICAgICAgICAweEZGRkYgICAgICAgICAgICAgIC8qIEludmFsaWQgaW5pdCBwYXJhb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RVFOQl9CWVBBU1NfTUlYRVJfVEMgMTAwIC8qIEJ5cGFzcyBNaXhlciBUQyAqLwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNTgsMTMgKzQ2LDEyIEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAogLyogRmlsdGVyIGJpcXVhZCB0eXBlcyAqLwotdHlwZWRlZiBlbnVtCi17Cit0eXBlZGVmIGVudW0gewogICAgIExWRVFOQl9TaW5nbGVQcmVjaXNpb25fRmxvYXQgPSAtMSwKICAgICBMVkVRTkJfU2luZ2xlUHJlY2lzaW9uID0gMCwKICAgICBMVkVRTkJfRG91YmxlUHJlY2lzaW9uID0gMSwKLSAgICBMVkVRTkJfT3V0T2ZSYW5nZSAgICAgID0gMiwKLSAgICBMVkVRTkJfQklRVUFEVFlQRV9NQVggID0gTFZNX01BWElOVF8zMgorICAgIExWRVFOQl9PdXRPZlJhbmdlID0gMiwKKyAgICBMVkVRTkJfQklRVUFEVFlQRV9NQVggPSBMVk1fTUFYSU5UXzMyCiB9IExWRVFOQl9CaXF1YWRUeXBlX2VuOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTc0LDI4ICs2MSwyOCBAQAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKIC8qIEluc3Rhbm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pYWJsZSAqLwotICAgIExWTWl4ZXIzXzJTdF9GTE9BVF9zdCAgICAgQnlwYXNzTWl4ZXI7CisgICAgTFZNaXhlcjNfMlN0X0ZMT0FUX3N0IEJ5cGFzc01peGVyOwogCi0gICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgYkluT3BlcmF0aW5nTW9kZVRyYW5zaXRpb247IC8qIE9wZXJhdGluZyBtb2RlIHRyYW5zaXRpb24gZmxhZyAqLworICAgIExWTV9JTlQxNiBiSW5PcGVyYXRpbmdNb2RlVHJhbnNpdGlvbjsgLyogT3BlcmF0aW5nIG1vZGUgdHJhbnNpdGlvbiBmbGFnICovCiAKIH0gTFZFUU5CX0luc3RhbmNlX3Q7CiAKQEAgLTEwNSwxNyArOTIsMTUgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLXZvaWQgICAgTFZFUU5CX1NldEZpbHRlcnMoTFZFUU5CX0luc3RhbmNlX3QgICAqcEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfUGFyYW1zX3QgICAgICpwUGFyYW1zKTsKK3ZvaWQgTFZFUU5CX1NldEZpbHRlcnMoTFZFUU5CX0luc3RhbmNlX3QqIHBJbnN0YW5jZSwgTFZFUU5CX1BhcmFtc190KiBwUGFyYW1zKTsKIAotdm9pZCAgICBMVkVRTkJfU2V0Q29lZmZpY2llbnRzKExWRVFOQl9JbnN0YW5jZV90ICAgICpwSW5zdGFuY2UpOwordm9pZCBMVkVRTkJfU2V0Q29lZmZpY2llbnRzKExWRVFOQl9JbnN0YW5jZV90KiBwSW5zdGFuY2UpOwogCi12b2lkICAgIExWRVFOQl9DbGVhckZpbHRlck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N0cy9sdm0vbGliL0VxL3NyYy9MVkVRTkJfUHJvY2Vzcy5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvRXEvc3JjL0xWRVFOQl9Qcm9jZXNzLmNwcAppbmRleCA2NWVmZjUzLi5iMTc3ZGQ0IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvRXEvc3JjL0xWRVFOQl9Qcm9jZXNzLmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvRXEvc3JjL0xWRVFOQl9Qcm9jZXNzLmNwcApAQCAtMzQsNyArMzQsNyBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotI2RlZmluZSBTSElGVCAgICAgICAxMworI2RlZmluZSBTSElGVCAxMwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNTgsODkgKzU4LDYwIEBACiAvKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVkVRTkJfUmV0dXJuU3RhdHVzX2VuIExWRVFOQl9Qcm9jZXNzKExWRVFOQl9IYW5kbGVfdCAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqcEluRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICpwT3V0RGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX1VJTlQxNiAgICAgIE5yRnJhbWVzKQoteyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB1cGRhdGVkIHRvIHVzZSBzYW1wbGVzID0gZnJhbWVzICogY2hhbm5lbHMuCi0gICAgTFZFUU5CX0luc3RhbmNlX3QgICAqcEluc3RhbmNlID0gKExWRVFOQl9JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLQotI2lmZGVmIFNVUFBPUlRfTUMKLSAgICAvLyBNb25vIHBhc3NlZCBpbiBhcyBzdGVyZW8KLSAgICBjb25zdCBMVk1fSU5UMzIgTnJDaGFubmVscyA9IHBJbnN0YW5jZS0+UGFyYW1zLk5yQ2hhbm5lbHMgPT0gMQotICAgICAgICA/IDIgOiBwSW5zdGFuY2UtPlBhcmFtcy5OckNoYW5uZWxzOwotI2Vsc2UKLSAgICBjb25zdCBMVk1fSU5UMzIgTnJDaGFubmVscyA9IDI7IC8vIEZDQ18yCi0jZW5kaWYKK0xWRVFOQl9SZXR1cm5TdGF0dXNfZW4gTFZFUU5CX1Byb2Nlc3MoCisgICAgICAgIExWRVFOQl9IYW5kbGVfdCBoSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogcEluRGF0YSwgTFZNX0ZMT0FUKiBwT3V0RGF0YSwKKyAgICAgICAgY29uc3QgTFZNX1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AgIChMVk1fSU5UMTYpTnJTYW1wbGVzKTsKIAogICAgICAgICAvKgogICAgICAgICAgKiBGb3IgZWFjaCBzZWN0aW9uIGV4ZWN0ZSB0aGUgZmlsdGVyIHVubGVzcyB0aGUgZ2FpbiBpcyAwZEIKICAgICAgICAgICovCi0gICAgICAgIGlmIChwSW5zdGFuY2UtPk5CYW5kcyAhPSAwKQotICAgICAgICB7Ci0gICAgICAgICAgICBmb3IgKExWTV9VSU5UMTYgaSA9IDA7IGkgPCBwSW5zdGFuY2UtPk5CYW5kczsgaSsrKQotICAgICAgICAgICAgeworICAgICAgICBpZiAocEluc3RhbmNlLT5OQmFuZHMgIT0gMCkgeworICAgICAgICAgICAgZm9yIChMVk1fVUlOVDE2IGkgPSAwOyBpIDwgcEluc3RhbmNlLT5OQmFuZHM7IGkrKykgewogICAgICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgICAgICogQ2hlY2sgaWYgYmFuZCBpcyBub24temVybyBkQiBnYWluCiAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgaWYgKHBJbnN0YW5jZS0+cEJhbmREZWZpbml0aW9uc1tpXS5HYWluICE9IDApCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAgICAgKiBHZXQgdGhlIGFkZHJlc3Mgb2YgdGhlIGJpcXVhZCBpbnN0YW5jZQotICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgKnBCaXF1YWQgPSAmcEluc3RhbmNlLT5wRVFOQl9GaWx0ZXJTdGF0ZV9GbG9hdFtpXTsKLQorICAgICAgICAgICAgICAgIGlmIChwSW5zdGFuY2UtPnBCYW5kRGVmaW5pdGlvbnNbaV0uR2FpbiAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgICAgICAgICAqIFNlbGVjdCBzaW5nbGUgb3IgZG91YmxlIHByZWNpc2lvbiBhcyByZXF1aXJlZAogICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChwSW5zdGFuY2UtPnBCaXF1YWRUeXBlW2ldKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIExWRVFOQl9TaW5nbGVQcmVjaXNpb25fRmxvYXQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0jaWZkZWYgU1VQUE9SVF9NQwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBLX01jX0QzMkYzMkMxNEcxMV9UUkNfV1JBXzAxKHBCaXF1YWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFNjcmF0Y2gsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFNjcmF0Y2gsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU5yQ2hhbm5lbHMpOwotI2Vsc2UKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBQS18ySV9EMzJGMzJDMTRHMTFfVFJDX1dSQV8wMShwQmlxdWFkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnJGcmFtZXMpOwotI2VuZGlmCisgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAocEluc3RhbmNlLT5wQmlxdWFkVHlwZVtpXSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBMVkVRTkJfU2luZ2xlUHJlY2lzaW9uX0Zsb2F0OiB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiBwVGVtcCA9IHBTY3JhdGNoICsgTnJTYW1wbGVzOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBJbnN0YW5jZS0+ZXFCaXF1YWRbaV0ucHJvY2VzcyhwVGVtcCwgcFNjcmF0Y2gsIE5yRnJhbWVzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdXRvIGdhaW4gPSBwSW5zdGFuY2UtPmdhaW5baV07CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh1bnNpZ25lZCBqID0gMDsgaiA8IE5yU2FtcGxlczsgKytqKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoW2pdICs9IHBUZW1wW2pdICogZ2FpbjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgpAQCAtMTUwLDQ0ICsxMjEsMjcgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCi0gICAgICAgIGlmKHBJbnN0YW5jZS0+YkluT3BlcmF0aW5nTW9kZVRyYW5zaXRpb24gPT0gTFZNX1RSVUUpewotI2lmZGVmIFNVUFBPUlRfTUMKLSAgICAgICAgICAgIExWQ19NaXhTb2Z0XzJNY19EMTZDMzFfU0FUKCZwSW5zdGFuY2UtPkJ5cGFzc01peGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFNjcmF0Y2gsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwSW5EYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFNjcmF0Y2gsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU5yRnJhbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOckNoYW5uZWxzKTsKLSNlbHNlCi0gICAgICAgICAgICBMVkNfTWl4U29mdF8yU3RfRDE2QzMxX1NBVCgmcEluc3RhbmNlLT5CeXBhc3NNaXhlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcEluRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOclNhbXBsZXMpOwotI2VuZGlmCisgICAgICAgIGlmIChwSW5zdGFuY2UtPmJJbk9wZXJhdGluZ01vZGVUcmFuc2l0aW9uID09IExWTV9UUlVFKSB7CisgICAgICAgICAgICBMVkNfTWl4U29mdF8yTWNfRDE2QzMxX1NBVCgmcEluc3RhbmNlLT5CeXBhc3NNaXhlciwgcFNjcmF0Y2gsIHBJbkRhdGEsIHBTY3JhdGNoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOckZyYW1lcywgKExWTV9JTlQxNilOckNoYW5uZWxzKTsKICAgICAgICAgICAgIC8vIGR1cGxpY2F0ZSB3aXRoIGVsc2UgY2xhdXNlKHMpCi0gICAgICAgICAgICBDb3B5X0Zsb2F0KHBTY3JhdGNoLCAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsICAgICAgICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCi0gICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnJTYW1wbGVzKTsgICAgICAgICAgICAvKiBBbGwgY2hhbm5lbCBzYW1wbGVzICovCi0gICAgICAgIH0KLSAgICAgICAgZWxzZXsKKyAgICAgICAgICAgIENvcHlfRmxvYXQocFNjcmF0Y2gsICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLworICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU5yU2FtcGxlcyk7IC8qIEFsbCBjaGFubmVsIHNhbXBsZXMgKi8KKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIENvcHlfRmxvYXQocFNjcmF0Y2gsICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KICAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwogICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU5yU2FtcGxlcyk7IC8qIEFsbCBjaGFubmVsIHNhbXBsZXMgKi8KICAgICAgICAgfQotICAgIH0KLSAgICBlbHNlCi0gICAgeworICAgIH0gZWxzZSB7CiAgICAgICAgIC8qCiAgICAgICAgICAqIE1vZGUgaXMgT0ZGIHNvIGNvcHkgdGhlIGRhdGEgaWYgbmVjZXNzYXJ5CiAgICAgICAgICAqLwotICAgICAgICBpZiAocEluRGF0YSAhPSBwT3V0RGF0YSkKLSAgICAgICAgewotICAgICAgICAgICAgQ29weV9GbG9hdChwSW5EYXRhLCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU291cmNlICovCi0gICAgICAgICAgICAgICAgICAgICAgIHBPdXREYXRhLCAgICAgICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU5yU2FtcGxlcyk7ICAgICAgICAgICAgLyogQWxsIGNoYW5uZWwgc2FtcGxlcyAqLworICAgICAgICBpZiAocEluRGF0YSAhPSBwT3V0RGF0YSkgeworICAgICAgICAgICAgQ29weV9GbG9hdChwSW5EYXRhLCAgICAgICAgICAgICAgIC8qIFNvdXJjZSAqLworICAgICAgICAgICAgICAgICAgICAgICBwT3V0RGF0YSwgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCisgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnJTYW1wbGVzKTsgLyogQWxsIGNoYW5uZWwgc2FtcGxlcyAqLwogICAgICAgICB9CiAgICAgfQogICAgIHJldHVybiBMVkVRTkJfU1VDQ0VTUzsKLQogfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0VxL3NyYy9MVkVRTkJfVGFibGVzLmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9FcS9zcmMvTFZFUU5CX1RhYmxlcy5jcHAKaW5kZXggMDYyODExNC4uZDc5ZDdjOSAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0VxL3NyYy9MVkVRTkJfVGFibGVzLmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvRXEvc3JjL0xWRVFOQl9UYWJsZXMuY3BwCkBAIC0zNSwyMCArMzUsOSBAQAogICogU2FtcGxlIHJhdGUgdGFibGUgZm9yIGNvbnZlcnRpbmcgYmV0d2VlbiB0aGUgZW51bWVyYXRlZCB0eXBlIGFuZCB0aGUgYWN0dWFsCiAgKiBmcmVxdWVuY3kKICAqLwotY29uc3QgTFZNX1VJTlQzMiAgICBMVkVRTkJfU2FtcGxlUmF0ZVRhYltdID0gezgwMDAsICAgICAgICAgICAgICAgICAgICAvKiA4a1MvcyAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMTAyNSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMjAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNjAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMjA1MCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNDAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMjAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDEwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0ODAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4ODIwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5NjAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNzY0MDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTkyMDAwCi19OworY29uc3QgTFZNX1VJTlQzMiBMVkVRTkJfU2FtcGxlUmF0ZVRhYltdID0gezgwMDAsIC8qIDhrUy9zICAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDExMDI1LCAxMjAwMCwgMTYwMDAsIDIyMDUwLCAyNDAwMCwgIDMyMDAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0MTAwLCA0ODAwMCwgODgyMDAsIDk2MDAwLCAxNzY0MDAsIDE5MjAwMH07CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNTksNzQgKzQ4LDM0IEBACiAvKgogICogVGFibGUgZm9yIDIgKiBQaSAvIEZzCiAgKi8KLWNvbnN0IExWTV9GTE9BVCAgICAgTFZFUU5CX1R3b1BpT25Gc1RhYmxlW10gPSB7TFZFUU5CXzJQaU9uXzgwMDAsICAgICAgLyogOGtTL3MgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CXzJQaU9uXzExMDI1LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMlBpT25fMTIwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl8yUGlPbl8xNjAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CXzJQaU9uXzIyMDUwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMlBpT25fMjQwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl8yUGlPbl8zMjAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CXzJQaU9uXzQ0MTAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMlBpT25fNDgwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsTFZFUU5CXzJQaU9uXzg4MjAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLExWRVFOQl8yUGlPbl85NjAwMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICxMVkVRTkJfMlBpT25fMTc2NDAwCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLExWRVFOQl8yUGlPbl8xOTIwMDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKK2NvbnN0IExWTV9GTE9BVCBMVkVRTkJfVHdvUGlPbkZzVGFibGVbXSA9IHsKKyAgICAgICAgTFZFUU5CXzJQaU9uXzgwMDAsIC8qIDhrUy9zICovCisgICAgICAgIExWRVFOQl8yUGlPbl8xMTAyNSwgTFZFUU5CXzJQaU9uXzEyMDAwLCBMVkVRTkJfMlBpT25fMTYwMDAsICBMVkVRTkJfMlBpT25fMjIwNTAsCisgICAgICAgIExWRVFOQl8yUGlPbl8yNDAwMCwgTFZFUU5CXzJQaU9uXzMyMDAwLCBMVkVRTkJfMlBpT25fNDQxMDAsICBMVkVRTkJfMlBpT25fNDgwMDAsCisgICAgICAgIExWRVFOQl8yUGlPbl84ODIwMCwgTFZFUU5CXzJQaU9uXzk2MDAwLCBMVkVRTkJfMlBpT25fMTc2NDAwLCBMVkVRTkJfMlBpT25fMTkyMDAwfTsKIAogLyoKICAqIEdhaW4gdGFibGUKICAqLwotY29uc3QgTFZNX0ZMT0FUICAgICBMVkVRTkJfR2FpblRhYmxlW10gPSB7TFZFUU5CX0dhaW5fTmVnMTVfZEIsICAgICAgICAvKiAtMTVkQiBnYWluICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfR2Fpbl9OZWcxNF9kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9HYWluX05lZzEzX2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0dhaW5fTmVnMTJfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfR2Fpbl9OZWcxMV9kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9HYWluX05lZzEwX2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0dhaW5fTmVnOV9kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9HYWluX05lZzhfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfR2Fpbl9OZWc3X2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0dhaW5fTmVnNl9kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9HYWluX05lZzVfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfR2Fpbl9OZWc0X2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0dhaW5fTmVnM19kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9HYWluX05lZzJfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfR2Fpbl9OZWcxX2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0dhaW5fMF9kQiwgICAgICAgICAgICAvKiAwZEIgZ2FpbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0dhaW5fMV9kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9HYWluXzJfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfR2Fpbl8zX2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0dhaW5fNF9kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9HYWluXzVfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfR2Fpbl82X2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0dhaW5fN19kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9HYWluXzhfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfR2Fpbl85X2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0dhaW5fMTBfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfR2Fpbl8xMV9kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9HYWluXzEyX2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CX0dhaW5fMTNfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfR2Fpbl8xNF9kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl9HYWluXzE1X2RCfTsgICAgICAgICAgLyogKzE1ZEIgZ2FpbiAqLworY29uc3QgTFZNX0ZMT0FUIExWRVFOQl9HYWluVGFibGVbXSA9IHsKKyAgICAgICAgTFZFUU5CX0dhaW5fTmVnMTVfZEIsIC8qIC0xNWRCIGdhaW4gKi8KKyAgICAgICAgTFZFUU5CX0dhaW5fTmVnMTRfZEIsIExWRVFOQl9HYWluX05lZz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NWRCIGdhaW4gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CXzEwMERfTmVnMTRfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl8xMDBEX05lZzEzX2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF9OZWcxMl9kQiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZFUU5CXzEwMERfTmVnMTFfZEIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWRVFOQl8xMDBEX05lZzEwX2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF9OZWc5X2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF9OZWc4X2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF9OZWc3X2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF9OZWc2X2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF9OZWc1X2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF9OZWc0X2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF9OZWczX2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF9OZWcyX2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF9OZWcxX2RCLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkVRTkJfMTAwRF8wX2RCfTsgICAgICAgICAgICAgICAvKiAwZEIgZ2FpbiAqLworY29uc3QgTFZNX0ZMT0FUIExWRVFOQl9EVGFibGVbXSA9IHsKKyAgICAgICAgTFZFUU5CXzEwMERfTmVnMTVfZEIsIC8qIC0xNWRCIGdhaW4gKi8KKyAgICAgICAgTFZFUU5CXzEwMERfTmVnMTRfZEIsIExWRVFOQl8xMDBEX05lZzEzX2RCLCBMVkVRTkJfMTAwRF9OZWcxMl9kQiwgTFZFUU5CXzEwMERfTmVnMTFfZEIsCisgICAgICAgIExWRVFOQl8xMDBEX05lZzEwX2RCLCBMVkVRTkJfMTAwRF9OZWc5X2RCLCAgTFZFUU5CXzEwMERfTmVnOF9kQiwgIExWRVFOQl8xMDBEX05lZzdfZEIsCisgICAgICAgIExWRVFOQl8xMDBEX05lZzZfZEIsICBMVkVRTkJfMTAwRF9OZWc1X2RCLCAgTFZFUU5CXzEwMERfTmVnNF9kQiwgIExWRVFOQl8xMDBEX05lZzNfZEIsCisgICAgICAgIExWRVFOQl8xMDBEX05lZzJfZEIsICBMVkVRTkJfMTAwRF9OZWcxX2RCLCAgTFZFUU5CXzEwMERfMF9kQn07IC8qIDBkQiBnYWluICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgIEZpbHRlciBwb2x5bm9taWFsIGNvZWZmaWNpZW50cyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0xNDIsMTMgKzkxLDEzIEBACiAgKiBhIHJhbmdlIG9mIDAgdG8gUGkuIFRoZSBvdXRwdXQgaXMgaW4gdGhlIHJhbmdlIDMyNzY3IHRvIC0zMjc2OCByZXByZXNlbnRpbmcgdGhlIHJhbmdlCiAgKiArMS4wIHRvIC0xLjAKICAqLwotY29uc3QgTFZNX0lOVDE2ICAgICBMVkVRTkJfQ29zQ29lZltdID0gezMsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTaGlmdHMgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MDk2LCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogYTAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMzYsICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogYTEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMTk3MjUsICAgICAgICAgICAgICAgICAgICAgICAgLyogYTIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMjY3MSwgICAgICAgICAgICAgICAgICAgICAgICAgLyogYTMgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMzczMCwgICAgICAgICAgICAgICAgICAgICAgICAgLyogYTQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtOTQ5MH07ICAgICAgICAgICAgICAgICAgICAgICAgLyogYTUgKi8KK2NvbnN0IExWTV9JTlQxNiBMVkVRTkJfQ29zQ29lZltdID0gezMsICAgICAgLyogU2hpZnRzICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MDk2LCAgIC8qIGEwICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMzYsICAgIC8qIGExICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMTk3MjUsIC8qIGEyICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMjY3MSwgIC8qIGEzICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMzczMCwgIC8qIGE0ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtOTQ5MH07IC8qIGE1ICovCiAKIC8qCiAgKiBDb2VmZmljaWVudHMgZm9yIGNhbGN1bGF0aW5nIHRoZSBjb3NpbmUgZXJyb3Igd2l0aCB0aGUgZXF1YXRpb246CkBAIC0xNjQsOSArMTEzLDggQEAKICAqCiAgKiBDb3MoeCkgPSAxLjAgLSBDb3NFcnIoeCkKICAqLwotY29uc3QgTFZNX0lOVDE2ICAgICBMVkVRTkJfRFBDb3NDb2VmW10gPSB7MSwgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTaGlmdHMgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogYTAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC02LCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogYTEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE2NTg2LCAgICAgICAgICAgICAgICAgICAgICAgLyogYTIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC00NH07ICAgICAgICAgICAgICAgICAgICAgICAgLyogYTMgKi8KLQorY29uc3QgTFZNX0lOVDE2IExWRVFOQl9EUENvc0NvZWZbXSA9IHsxLCAgICAgLyogU2hpZnRzICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsICAgICAvKiBhMCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtNiwgICAgLyogYTEgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTY1ODYsIC8qIGEyICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC00NH07ICAvKiBhMyAqLwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0VxL3NyYy9MVkVRTkJfVGFibGVzLmggYi9tZWRpYS9saW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lW107CiAKIC8qCiAgKiBEIHRhYmxlIGZvciAxMDAgLyAoR2FpbiArIDEpCiAgKi8KLWV4dGVybiBjb25zdCBMVk1fRkxPQVQgICAgIExWRVFOQl9EVGFibGVbXTsKK2V4dGVybiBjb25zdCBMVk1fRkxPQVQgTFZFUU5CX0RUYWJsZVtdOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTY1LDcgKzY1LDcgQEAKICAqIGEgcmFuZ2Ugb2YgMCB0byBQaS4gVGhlIG91dHB1dCBpcyBpbiB0aGUgcmFuZ2UgMzI3NjcgdG8gLTMyNzY4IHJlcHJlc2VudGluZyB0aGUgcmFuZ2UKICAqICsxLjAgdG8gLTEuMAogICovCi1leHRlcm4gY29uc3QgTFZNX0lOVDE2ICAgICBMVkVRTkJfQ29zQ29lZltdOworZXh0ZXJuIGNvbnN0IExWTV9JTlQxNiBMVkVRTkJfQ29zQ29lZltdOwogCiAvKgogICogQ29lZmZpY2llbnRzIGZvciBjYWxjdWxhdGluZyB0aGUgY29zaW5lIGVycm9yIHdpdGggdGhlIGVxdWF0aW9uOgpAQCAtODEsNiArODEsNiBAQAogICoKICAqIENvcyh4KSA9IDEuMCAtIENvc0Vycih4KQogICovCi1leHRlcm4gY29uc3QgTFZNX0lOVDE2ICAgICBMVkVRTkJfRFBDb3NDb2VmW107CitleHRlcm4gY29uc3QgTFZNX0lOVDE2IExWRVFOQl9EUENvc0NvZWZbXTsKIAogI2VuZGlmIC8qIF9fTFZFUU5CX1RBQkxFU19IX18gKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvbGliL0xWUkVWLmggYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvUmV2ZXJiL2xpYi9MVlJFVi5oCmluZGV4IDhjOTFlYTkuLjgyZTk0ZGEgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvbGliL0xWUkVWLmgKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1JldmVyYi9saWIvTFZSRVYuaApAQCAtNDEsMTEgKzQxLDExIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogR2VuZXJhbCAqLwotI2RlZmluZSBMVlJFVl9CTE9DS1NJWkVfTVVMVElQTEUgICAgICAgICAgICAgICAgMSAgICAgICAvKiBQcm9jZXNzaW5nIGJsb2NrIHNpemUgbXVsdGlwbGUgKi8KLSNkZWZpbmUgTFZSRVZfTUFYX1Q2MCAgICAgICAgICAgICAgICAgICAgICAgIDcwMDAgICAgICAgLyogTWF4aW11bSBkZWNheSB0aW1lIGlzIDcwMDBtcyAqLworI2RlZmluZSBMVlJFVl9CTE9DS1NJWkVfTVVMVElQTEUgMSAvKiBQcm9jZXNzaW5nIGJsb2NrIHNpemUgbXVsdGlwbGUgKi8KKyNkZWZpbmUgTFZSRVZfTUFYX1Q2MCA3MDAwICAgICAgICAgLyogTWF4aW11bSBkZWNheSB0aW1lIGlzIDcwMDBtcyAqLwogCiAvKiBNZW1vcnkgdGFibGUqLwotI2RlZmluZSBMVlJFVl9OUl9NRU1PUllfUkVHSU9OUyAgICAgICAgICAgICAgICAgNCAgICAgICAvKiBOdW1iZXIgb2YgbWVtb3J5IHJlZ2lvbnMgKi8KKyNkZWZpbmUgTFZSRVZfTlJfTUVNT1JZX1JFR0lPTlMgNCAvKiBOdW1iZXIgb2YgbWVtb3J5IHJlZ2lvbnMgKi8KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTUzLDI0ICs1MywyMiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qIEluc3RhbmNlIGhhbmRsZSAqLwotdHlwZWRlZiB2b2lkICpMVlJFVl9IYW5kbGVfdDsKK3R5cGVkZWYgdm9pZCogTFZSRVZfSGFuZGxlX3Q7CiAKIC8qIFN0YXR1cyByZXR1cm4gdmFsdWVzICovCi10eXBlZGVmIGVudW0KLXsKLSAgICBMVlJFVl9TVUNDRVNTICAgICAgICAgICAgPSAwLCAgICAgICAgICAgICAgICAgICAgICAgLyogU3VjY2Vzc2Z1bCByZXR1cm4gZnJvbSBhIHJvdXRpbmUgKi8KLSAgICBMVlJFVl9OVUxMQUREUkVTUyAgICAgICAgPSAxLCAgICAgICAgICAgICAgICAgICAgICAgLyogTlVMTCBhbGxvY2F0aW9uIGFkZHJlc3MgKi8KLSAgICBMVlJFVl9PVVRPRlJBTkdFICAgICAgICAgPSAyLCAgICAgICAgICAgICAgICAgICAgICAgLyogT3V0IG9mIHJhbmdlIGNvbnRyb2wgcGFyYW1ldGVyICovCi0gICAgTFZSRVZfSU5WQUxJRE5VTVNBTVBMRVMgID0gMywgICAgICAgICAgICAgICAgICAgICAgIC8qIEludmFsaWQgbnVtYmVyIG9mIHNhbXBsZXMgKi8KK3R5cGVkZWYgZW51bSB7CisgICAgTFZSRVZfU1VDQ0VTUyA9IDAsICAgICAgICAgICAvKiBTdWNjZXNzZnVsIHJldHVybiBmcm9tIGEgcm91dGluZSAqLworICAgIExWUkVWX05VTExBRERSRVNTID0gMSwgICAgICAgLyogTlVMTCBhbGxvY2F0aW9uIGFkZHJlc3MgKi8KKyAgICBMVlJFVl9PVVRPRlJBTkdFID0gMiwgICAgICAgIC8qIE91dCBvZiByYW5nZSBjb250cm9sIHBhcmFtZXRlciAqLworICAgIExWUkVWX0lOVkFMSUROVU1TQU1QTEVTID0gMywgLyogSW52YWxpZCBudW1iZXIgb2Ygc2FtcGxlcyAqLwogICAgIExWUkVWX1JFVFVSTlNUQVRVU19EVU1NWSA9IExWTV9NQVhFTlVNCiB9IExWUkVWX1JldHVyblN0YXR1c19lbjsKIAogLyogUmV2ZXJiIGRlbGF5IGxpbmVzICovCi10eXBlZGVmIGVudW0KLXsKLSAgICBMVlJFVl9ERUxBWUxJTkVTXzEgICAgID0gMSwgICAgICAgICAgICAgICAgICAgICAgICAgLyogT25lIGRlbGF5IGxpbmUgKi8KLSAgICBMVlJFVl9ERUxBWUxJTkVTXzIgICAgID0gMiwgICAgICAgICAgICAgICAgICAgICAgICAgLyogVHdvIGRlbGF5IGxpbmVzICovCi0gICAgTFZSRVZfREVMQVlMSU5FU180ICAgICA9IDQsICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEZvdXIgZGVsYXkgbGluZXMgKi8KK3R5cGVkZWYgZW51bSB7CisgICAgTFZSRVZfREVMQVlMSU5FU18xID0gMSwgLyogT25lIGRlbGF5IGxpbmUgKi8KKyAgICBMVlJFVl9ERUxBWUxJTkVTXzIgPSAyLCAvKiBUd28gZGVsYXkgbGluZXMgKi8KKyAgICBMVlJFVl9ERUxBWUxJTkVTXzQgPSA0LCAvKiBGb3VyIGRlbGF5IGxpbmVzICovCiAgICAgTFZSRVZfREVMQVlMSU5FU19EVU1NWSA9IExWTV9NQVhFTlVNCiB9IExWUkVWX051bURlbGF5TGluZXNfZW47CiAKQEAgLTgwLDQxICs3OCwzMyBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotLyogTWVtb3J5IHRhYmxlIGNvbnRhaW5pbmcgdGhlIHJlZ2lvbiBkZWZpbml0aW9ucyAqLwotdHlwZWRlZiBzdHJ1Y3QKLXsKLSAgICBMVk1fTWVtb3J5UmVnaW9uX3N0ICAgICAgICBSZWdpb25bTFZSRVZfTlJfTUVNT1JZX1JFR0lPTlNdOyAgLyogT25lIGRlZmluaXRpb24gZm9yIGVhY2ggcmVnaW9uICovCi19IExWUkVWX01lbW9yeVRhYmxlX3N0OwotCiAvKiBDb250cm9sIFBhcmFtZXRlciBzdHJ1Y3R1cmUgKi8KLXR5cGVkZWYgc3RydWN0Ci17Cit0eXBlZGVmIHN0cnVjdCB7CiAgICAgLyogR2VuZXJhbCBwYXJhbWV0ZXJzICovCi0gICAgTFZNX01vZGVfZW4gICAgICAgICAgICAgICAgIE9wZXJhdGluZ01vZGU7ICAgICAgICAgIC8qIE9wZXJhdGluZyBtb2RlICovCi0gICAgTFZNX0ZzX2VuICAgICAgICAgICAgICAgICAgIFNhbXBsZVJhdGU7ICAgICAgICAgICAgIC8qIFNhbXBsZSByYXRlICovCi0gICAgTFZNX0Zvcm1hdF9lbiAgICAgICAgICAgICAgIFNvdXJjZUZvcm1hdDsgICAgICAgICAgIC8qIFNvdXJjZSBkYXRhIGZvcm1hdCAqLworICAgIExWTV9Nb2RlX2VuIE9wZXJhdGluZ01vZGU7ICAvKiBPcGVyYXRpbmcgbW9kZSAqLworICAgIExWTV9Gc19lbiBTYW1wbGVSYXRlOyAgICAgICAvKiBTYW1wbGUgcmF0ZSAqLworICAgIExWTV9Gb3JtYXRfZW4gU291cmNlRm9ybWF0OyAvKiBTb3VyY2UgZGF0YSBmb3JtYXQgKi8KIAogICAgIC8qIFBhcmFtZXRlcnMgZm9yIFJFViAqLwotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgICBMZXZlbDsgICAgICAgICAgICAgICAgICAvKiBMZXZlbCwgMCB0byAxMDAgcmVwcmVzZW50aW5nIHBlcmNlbnRhZ2Ugb2YgcmV2ZXJiICovCi0gICAgTFZNX1VJTlQzMiAgICAgICAgICAgICAgICAgIExQRjsgICAgICAgICAgICAgICAgICAgIC8qIExvdyBwYXNzIGZpbHRlciwgaW4gSHogKi8KLSAgICBMVk1fVUlOVDMyICAgICAgICAgICAgICAgICAgSFBGOyAgICAgICAgICAgICAgICAgICAgLyogSGlnaCBwYXNzIGZpbHRlciwgaW4gSHogKi8KKyAgICBMVk1fVUlOVDE2IExldmVsOyAvKiBMZXZlbCwgMCB0byAxMDAgcmVwcmVzZW50aW5nIHBlcmNlbnRhZ2Ugb2YgcmV2ZXJiICovCisgICAgTFZNX1VJTlQzMiBMUEY7ICAgLyogTG93IHBhc3MgZmlsdGVyLCBpbiBIeiAqLworICAgIExWTV9VSU5UMzIgSFBGOyAgIC8qIEhpZ2ggcGFzcyBmaWx0ZXIsIGluIEh6ICovCiAKLSAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICAgVDYwOyAgICAgICAgICAgICAgICAgICAgLyogRGVjYXkgdGltZSBjb25zdGFudCwgaW4gbXMgKi8KLSAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICAgRGVuc2l0eTsgICAgICAgICAgICAgICAgLyogRWNobyBkZW5zaXR5LCAwIHRvIDEwMCBmb3IgbWluaW11bSB0byBtYXhpbXVtIGRlbnNpdHkgKi8KLSAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICAgRGFtcG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VWX051bURlbGF5TGluZXNfZW4gICAgICBOdW1EZWxheXM7ICAgICAgICAgICAgICAvKiBUaGUgbnVtYmVyIG9mIGRlbGF5IGxpbmVzLCAxLCAyIG9yIDQgKi8KKyAgICBMVk1fRm9ybWF0X2VuIFNvdXJjZUZvcm1hdDsgICAgICAgLyogU291cmNlIGRhdGEgZm9ybWF0cyB0byBzdXBwb3J0ICovCisgICAgTFZSRVZfTnVtRGVsYXlMaW5lc19lbiBOdW1EZWxheXM7IC8qIFRoZSBudW1iZXIgb2YgZGVsYXkgbGluZXMsIDEsIDIgb3IgNCAqLwogCiB9IExWUkVWX0luc3RhbmNlUGFyYW1zX3N0OwogCkBAIC0xMjYsNDYgKzExNiw2IEBACiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBGVU5DVElPTjogICAgICAgICAgICAgICAgTFZSRVZfR2V0TWVtb3J5VGFibGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgVGhpcyBmdW5jdGlvbiBpcyB1c2VkIHRvIG9idGFpbiB0aGUgTFZSRVYgbW9kdWxlIG1lbW9yeSByZXF1aXJlbWVudHMgdG8gc3VwcG9ydCAgICAgKi8KLS8qICBtZW1vcnkgYWxsb2NhdGlvbi4gSXQgY2FuIGFsc28gYmUgdXNlZCB0byByZXR1cm4gdGhlIG1lbW9yeSBiYXNlIGFkZHJlc3MgcHJvdmlkZWQgICAqLwotLyogIGR1cmluZyBtZW1vcnkgYWxsb2NhdGlvbiB0byBzdXBwb3J0IGZyZWVpbmcgb2YgbWVtb3J5IHdoZW4gdGhlIExWUkVWIG1vZHVsZSBpcyBubyAgICovCi0vKiAgbG9uZ2VyIHJlcXVpcmVkLiBJdCBpcyBjYWxsZWQgaW4gdHdvIHdheXM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIGhJbnN0YW5jZSA9IE5VTEwgICAgICAgICAgICAgICAgUmV0dXJucyB0aGUgbWVtb3J5IHJlcXVpcmVtZW50cyAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlID0gSW5zdGFuY2UgaGFuZGxlICAgICBSZXR1cm5zIHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzIGFuZCBhbGxvY2F0ZWQgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJhc2UgYWRkcmVzc2VzLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgV2hlbiB0aGlzIGZ1bmN0aW9uIGlzIGNhbGxlZCB3aXRoIGhJbnN0YW5jZSA9IE5VTEwgdGhlIG1lbW9yeSBiYXNlIGFkZHJlc3MgcG9pbnRlcnMgKi8KLS8qICB3aWxsIGJlIE5VTEwgb24gcmV0dXJuLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgV2hlbiB0aGUgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciBmcmVlaW5nIG1lbW9yeSwgaEluc3RhbmNlID0gSW5zdGFuY2UgSGFuZGxlIHRoZSAgICAgKi8KLS8qICBtZW1vcnkgdGFibGUgcmV0dXJucyB0aGUgYWxsb2NhdGVkIG1lbW9yeSBhbmQgYmFzZSBhZGRyZXNzZXMgdXNlZCBkdXJpbmcgICAgICAgICAgICAqLwotLyogIGluaXRpYWxpc2F0aW9uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIGhJbnN0YW5jZSAgICAgICAgICAgICAgIEluc3RhbmNlIEhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcE1lbW9yeVRhYmxlICAgICAgICAgICAgUG9pbnRlciB0byBhbiBlbXB0eSBtZW1vcnkgdGFibGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwSW5zdGFuY2VQYXJhbXMgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBwYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBMVlJFVl9TVUNDRVNTICAgICAgICAgICBTdWNjZWVkZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIExWUkVWX05VTExBRERSRVNTICAgICAgIFdoZW4gcE1lbW9yeVRhYmxlIGlzIE5VTEwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZSRVZfTlVMTEFERFJFU1MgICAgICAgV2hlbiByZXF1ZXN0aW5nIG1lbW9yeSByZXF1aXJlbWVudHMgYW5kIHBJbnN0YW5jZVBhcmFtcyAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICBpcyBOVUxMICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAxLiAgVGhpcyBmdW5jdGlvbiBtYXkgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWUkVWX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWUkVWX1JldHVyblN0YXR1c19lbiBMVlJFVl9HZXRNZW1vcnlUYWJsZShMVlJFVl9IYW5kbGVfdCAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUkVWX01lbW9yeVRhYmxlX3N0ICAgICAqcE1lbW9yeVRhYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUkVWX0luc3RhbmNlUGFyYW1zX3N0ICAqcEluc3RhbmNlUGFyYW1zKTsKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICBMVlJFVl9HZXRJbnN0YW5jZUhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTE3OSw3ICsxMjksNiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICBwaEluc3RhbmNlICAgICAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBNZW1vcnlUYWJsZSAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgcEluc3RhbmNlUGFyYW1zICAgICAgICAgUG9pbnRlciB0byB0aGUgaW5zdGFuY2UgcGFyYW1ldGVycyAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0xOTAsOSArMTM5LDI1IEBACiAvKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlJFVl9SZXR1cm5TdGF0dXNfZW4gTFZSRVZfR2V0SW5zdGFuY2VIYW5kbGUoTFZSRVZfSGFuZGxlX3QgICAgICAgICAgICAqcGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9NZW1vcnlUYWJsZV9zdCAgICAgICpwTWVtb3J5VGFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZSRVZfSW5zdGFuY2VQYXJhbXNfc3QgICAqcEluc3RhbmNlUGFyYW1zKTsKK0xWUkVWX1JldHVyblN0YXR1c19lbiBMVlJFVl9HZXRJbnN0YW5jZUhhbmRsZShMVlJFVl9IYW5kbGVfdCogcGhJbnN0YW5jZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9JbnN0YW5jZVBhcmFtc19zdCogcEluc3RhbmNlUGFyYW1zKTsKKworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICBMVlJFVl9GcmVlSW5zdGFuY2UgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgdG8gZnJlZSB0aGUgaW50ZXJuYWwgYWxsb2NhdGlvbnMgb2YgdGhlIG1vZHVsZS4gICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBoSW5zdGFuY2UgICAgICAgICAgICAgICBJbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBMVlJFVl9TVUNDRVNTICAgICAgICAgIGZyZWUgaW5zdGFuY2Ugc3VjY2VlZGVkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIExWUkVWX05VTExBRERSRVNTICAgICAgSW5zdGFuY2UgaXMgTlVMTCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworTFZSRVZfUmV0dXJuU3RhdHVzX2VuIExWUkVWX0ZyZWVJbnN0YW5jZShMVlJFVl9IYW5kbGVfdCBoSW5zdGFuY2UpOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMjE0LDggKzE3OSw4IEBACiAvKiAgMS4gIFRoaXMgZnVuY3Rpb24gbWF5IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVlJFVl9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlJFVl9SZXR1cm5TdGF0dXNfZW4gTFZSRVZfR2V0Q29udHJvbFBhcmFtZXRlcnMoTFZSRVZfSGFuZGxlX3QgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9Db250cm9sUGFyYW1zX3N0ICAgKnBDb250cm9sUGFyYW1zKTsKK0xWUkVWX1JldHVyblN0YXR1c19lbiBMVlJFVl9HZXRDb250cm9sUGFyYW1ldGVycyhMVlJFVl9IYW5kbGVfdCBoSW5zdGFuY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZSRVZfQ29udHJvbFBhcmFtc19zdCogcENvbnRyb2xQYXJhbXMpOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMjM2LDggKzIwMSw4IEBACiAvKiAgMS4gIFRoaXMgZnVuY3Rpb24gbWF5IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVlJFVl9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlJFVl9SZXR1cm5TdGF0dXNfZW4gTFZSRVZfU2V0Q29udHJvbFBhcmFtZXRlcnMoTFZSRVZfSGFuZGxlX3QgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9Db250cm9sUGFyYW1zX3N0ICAgKnBOZXdQYXJhbXMpOworTFZSRVZfUmV0dXJuU3RhdHVzX2VuIExWUkVWX1NldENvbnRyb2xQYXJhbWV0ZXJzKExWUkVWX0hhbmRsZV90IGhJbnN0YW5jZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9Db250cm9sUGFyYW1zX3N0KiBwTmV3UGFyYW1zKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTI1Nyw3ICsyMjIsNyBAQAogLyogIDEuIFRoaXMgZnVuY3Rpb24gbXVzdCBub3QgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWUkVWX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZSRVZfUmV0dXJuU3RhdHVzX2VuIExWUkVWX0NsZWFyQXVkaW9CdWZmZXJzKExWUkVWX0hhbmRsZV90ICBoSW5zdGFuY2UpOworTFZSRVZfUmV0dXJuU3RhdHVzX2VuIExWUkVWX0NsZWFyQXVkaW9CdWZmZXJzKExWUkVWX0hhbmRsZV90IGhJbnN0YW5jZSk7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0yODAsMTEgKzI0NSw5IEBACiAvKiAgMS4gVGhlIGlucHV0IGFuZCBvdXRwdXQgYnVmZmVycyBtdXN0IGJlIDMyLWJpdCBhbGlnbmVkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlJFVl9SZXR1cm5TdGF0dXNfZW4gTFZSRVZfUHJvY2VzcyhMVlJFVl9IYW5kbGVfdCAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgKnBJbkRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICpwT3V0RGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9VSU5UMTYgICAgICAgICAgTnVtU2FtcGxlcyk7CitMVlJFVl9SZXR1cm5TdGF0dXNfZW4gTFZSRVZfUHJvY2VzcyhMVlJFVl9IYW5kbGVfdCBoSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogcEluRGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogcE91dERhdGEsIGNvbnN0IExWTV9VSU5UMTYgTnVtU2FtcGxlcyk7CiAKLSNlbmRpZiAgICAgIC8qIF9fTFZSRVZfSF9fICovCisjZW5kaWYgLyogX19MVlJFVl9IX18gKi8KIAogLyogRW5kIG9mIGZpbGUgKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvc3JjL0xWUkVWX0FwcGx5TmV3U2V0dGluZ3MuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1JldmVyYi9zcmMvTFZSRVZfQXBwbHlOZXdTZXR0aW5ncy5jcHAKaW5kZXggMWYwZDM5Yi4uYjc4ODNmNSAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1JldmVyYi9zcmMvTFZSRVZfQXBwbHlOZXdTZXR0aW5ncy5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1JldmVyYi9zcmMvTFZSRVZfQXBwbHlOZXdTZXR0aW5ncy5jcHAKQEAgLTIwLDYgKzIwLDggQEAKIC8qICBJbmNsdWRlcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworI2luY2x1ZGUgPHN5c3RlbS9hdWRpby5oPgogI2luY2x1ZGUgIkxWUkVWX1ByaXZhdGUuaCIKICNpbmNsdWRlICJGaWx0ZXIuaCIKIApAQCAtNDEsMTYwICs0MywxMzAgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLUxWUkVWX1JldHVyblN0YXR1c19lbiBMVlJFVl9BcHBseU5ld1NldHRpbmdzIChMVlJFVl9JbnN0YW5jZV9zdCAgICAgKnBQcml2YXRlKQotewotCi0gICAgTFZNX01vZGVfZW4gIE9wZXJhdGluZ01vZGU7Ci0gICAgTFZNX0lOVDMyICAgIE51bWJlck9mRGVsYXlMaW5lczsKK0xWUkVWX1JldHVyblN0YXR1c19lbiBMVlJFVl9BcHBseU5ld1NldHRpbmdzKExWUkVWX0luc3RhbmNlX3N0KiBwUHJpdmF0ZSkgeworICAgIExWTV9Nb2RlX2VuIE9wZXJhdGluZ01vZGU7CisgICAgTFZNX0lOVDMyIE51bWJlck9mRGVsYXlMaW5lczsKIAogICAgIC8qIENoZWNrIGZvciBOVUxMIHBvaW50ZXIgKi8KLSAgICBpZihwUHJpdmF0ZSA9PSBMVk1fTlVMTCkKLSAgICB7CisgICAgaWYgKHBQcml2YXRlID09IExWTV9OVUxMKSB7CiAgICAgICAgIHJldHVybiBMVlJFVl9OVUxMQUREUkVTUzsKICAgICB9CiAKICAgICBPcGVyYXRpbmdNb2RlID0gcFByaXZhdGUtPk5ld1BhcmFtcy5PcGVyYXRpbmdNb2RlOwogCi0gICAgaWYocFByaXZhdGUtPkluc3RhbmNlUGFyYW1zL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MyX29uXzQsIExWUkVWX1RfM19Qb3dlcl9taW51czNfb25fNH07Ci0gICAgICAgIExWTV9JTlQxNiAgIE1heFRfRGVsYXlbXSAgPSB7TFZSRVZfTUFYX1QwX0RFTEFZLCBMVlJFVl9NQVhfVDFfREVMQVksIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9NQVhfVDJfREVMQVksIExWUkVWX01BWF9UM19ERUxBWX07Ci0gICAgICAgIExWTV9JTlQxNiAgIE1heEFQX0RlbGF5W10gPSB7TFZSRVZfTUFYX0FQMF9ERUxBWSwgTFZSRVZfTUFYX0FQMV9ERUxBWSwgXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUkVWX01BWF9BUDJfREVMQVksIExWUkVWX01BWF9BUDNfREVMQVl9OworICAgICAgICAocFByaXZhdGUtPmJGaXJzdENvbnRyb2wgPT0gTFZNX1RSVUUpKSB7CisgICAgICAgIExWTV9VSU5UMzIgVGVtcDsKKyAgICAgICAgTFZNX0lOVDMyIEFQRGVsYXlTaXplOworICAgICAgICBMVk1fSU5UMzIgRnMgPSBMVk1fR2V0RnNGcm9tVGFibGUocFByaXZhdGUtPk5ld1BhcmFtcy5TYW1wbGVSYXRlKTsKKyAgICAgICAgTFZNX1VJTlQzMiBEZWxheUxlbmd0aFNhbXBsZXMgPSAoTFZNX1VJTlQzMikoRnMgKiBwUHJpdmF0ZS0+Um9vbVNpemVJbm1zKTsKKyAgICAgICAgTFZNX0lOVDE2IGk7CisgICAgICAgIExWTV9GTE9BVCBTY2FsZVRhYmxlW10gPSB7TFZSRVZfVF8zX1Bvd2VyX21pbnVzMF9vbl80LCBMVlJFVl9UXzNfUG93ZXJfbWludXMxX29uXzQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZSRVZfVF8zX1Bvd2VyX21pbnVzMl9vbl80LCBMVlJFVl9UXzNfUG93ZXJfbWludXMzX29uXzR9OwogCiAgICAgICAgIC8qCiAgICAgICAgICAqIEZvciBlYWNoIGRlbGF5IGxpbmUKICAgICAgICAgICovCi0gICAgICAgIGZvciAoaSA9IDA7IGkgPCBOdW1iZXJPZkRlbGF5TGluZXM7IGkrKykKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKGkgIT0gMCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBMVk1fRkxPQVQgVGVtcDE7ICAvKiB0byBhdm9pZCBRQUMgd2FybmluZyBvbiB0eXBlIGNvbnZlcnNpb24gKi8KKyAgICAgICAgZm9yIChpID0gMDsgaSA8IE51bWJlck9mRGVsYXlMaW5lczsgaSsrKSB7CisgICAgICAgICAgICBpZiAoaSAhPSAwKSB7CisgICAgICAgICAgICAgICAgTFZNX0ZMT0FUIFRlbXAxOyAvKiB0byBhdm9pZCBRQUMgd2FybmluZyBvbiB0eXBlIGNvbnZlcnNpb24gKi8KIAotICAgICAgICAgICAgICAgIFRlbXAxPShMVk1fRkxPQVQpRGVsYXlMZW5ndGhTYW1wbGVzOworICAgICAgICAgICAgICAgIFRlbXAxID0gKExWTV9GTE9BVClEZWxheUxlbmd0aFNhbXBsZXM7CiAgICAgICAgICAgICAgICAgVGVtcCA9IChMVk1fVUlOVDMyKShUZW1wMSAqIFNjYWxlVGFibGVbaV0pOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBUZW1wID0gRGVsYXlMZW5ndGhTYW1wbGVzOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgVGVtcCA9IERlbGF5TGVuZ3RoU2FtcGxlczsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIEFQRGVsYXlTaXplID0gVGVtcCAgLyAxNTAwOworICAgICAgICAgICAgQVBEZWxheVNpemUgPSBUZW1wIC8gMTUwMDsKIAogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIFNldCB0aGUgZml4ZWQgZGVsYXkKICAgICAgICAgICAgICAqLwogCi0gICAgICAgICAgICBUZW1wICA9IChNYXhUX0RlbGF5W2ldIC0gTWF4QVBfRGVsYXlbaV0pICogRnMgLyAxOTIwMDA7CisgICAgICAgICAgICBUZW1wID0gKExWUkVWX01BWF9UX0RFTEFZW2ldIC0gTFZSRVZfTUFYX0FQX0RFTEFZW2ldKSAqIEZzIC8gMTkyMDAwOwogICAgICAgICAgICAgcFByaXZhdGUtPkRlbGF5X0FQW2ldID0gcFByaXZhdGUtPlRbaV0gLSBUZW1wOwogCiAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICogU2V0IHRoZSB0YXAgc2VsZWN0aW9uCiAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIGlmIChwUHJpdmF0ZS0+QUJfU2VsZWN0aW9uKQotICAgICAgICAgICAgeworICAgICAgICAgICAgaWYgKHBQcml2YXRlLT5BQl9TZWxlY3Rpb24pIHsKICAgICAgICAgICAgICAgICAvKiBTbW9vdGggZnJvbSB0YXAgQSB0byB0YXAgQiAqLwotICAgICAgICAgICAgICAgIHBQcml2YXRlLT5wT2Zmc2V0QltpXSAgICAgICAgICAgICA9ICZwUHJpdmF0ZS0+cERlbGF5X1RbaV1bcFByaXZhdGUtPlRbaV0gLSBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZW1wIC0gQVBEZWxheVNpemVdOwotICAgICAgICAgICAgICAgIHBQcml2YXRlLT5CX0RlbGF5U2l6ZVtpXSAgICAgICAgICA9IEFQRGVsYXlTaXplOworICAgICAgICAgICAgICAgIHBQcml2YXRlLT5wT2Zmc2V0QltpXSA9ICZwUHJpdmF0ZS0+cERlbGF5X1RbaV1bcFByaXZhdGUtPlRbaV0gLSBUZW1wIC0gQVBEZWxheVNpemVdOworICAgICAgICAgICAgICAgIHBQcml2YXRlLT5CX0RlbGF5U2l6ZVtpXSA9IEFQRGVsYXlTaXplOwogICAgICAgICAgICAgICAgIHBQcml2YXRlLT5NaXhlcl9BUFRhcHNbaV0uVGFyZ2V0MSA9IDA7CiAgICAgICAgICAgICAgICAgcFByaXZhdGUtPk1peGVyX0FQVGFwc1tpXS5UYXJnZXQyID0gMS4wZjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKKyAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgLyogU21vb3RoIGZyb20gdGFwIEIgdG8gdGFwIEEgKi8KLSAgICAgICAgICAgICAgICBwUHJpdmF0ZS0+cE9mZnNldEFbaV0gICAgICAgICAgICAgPSAmcFByaXZhdGUtPnBEZWxheV9UW2ldW3BQcml2YXRlLT5UW2ldIC0gXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGVtcCAtIEFQRGVsYXlTaXplXTsKLSAgICAgICAgICAgICAgICBwUHJpdmF0ZS0+QV9EZWxheVNpemVbaV0gICAgICAgICAgPSBBUERlbGF5U2l6ZTsKKyAgICAgICAgICAgICAgICBwUHJpdmF0ZS0+cE9mZnNldEFbaV0gPSAmcFByaXZhdGUtPnBEZWxheV9UW2ldW3BQcml2YXRlLT5UW2ldIC0gVGVtcCAtIEFQRGVsYXlTaXplXTsKKyAgICAgICAgICAgICAgICBwUHJpdmF0ZS0+QV9EZWxheVNpemVbaV0gPSBBUERlbGF5U2l6ZTsKICAgICAgICAgICAgICAgICBwUHJpdmF0ZS0+TWl4ZXJfQVBUYXBzW2ldLlRhcmdldDIgPSAwOwogICAgICAgICAgICAgICAgIHBQcml2YXRlLT5NaXhlcl9BUFRhcHNbaV0uVGFyZ2V0MSA9IDEuMGY7CiAgICAgICAgICAgICB9CkBAIC0yMDIsMjIgKzE3NCwxNyBAQAogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIFNldCB0aGUgbWF4aW11bSBibG9jayBzaXplIHRvIHRoZSBzbWFsbGVzdCBkZWxheSBzaXplCiAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIHBQcml2YXRlLT5NYXhCbGtMZW4gICA9IFRlbXA7Ci0gICAgICAgICAgICBpZiAocFByaXZhdGUtPk1heEJsa0xlbiA+IHBQcml2YXRlLT5BX0RlbGF5U2l6ZVtpXSkKLSAgICAgICAgICAgIHsKKyAgICAgICAgICAgIHBQcml2YXRlLT5NYXhCbGtMZW4gPSBUZW1wOworICAgICAgICAgICAgaWYgKHBQcml2YXRlLT5NYXhCbGtMZW4gPiBwUHJpdmF0ZS0+QV9EZWxheVNpemVbaV0pIHsKICAgICAgICAgICAgICAgICBwUHJpdmF0ZS0+TWF4QmxrTGVuID0gcFByaXZhdGUtPkFfRGVsYXlTaXplW2ldOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHBQcml2YXRlLT5NYXhCbGtMZW4gPiBwUHJpdmF0ZS0+Ql9EZWxheVNpemVbaV0pCi0gICAgICAgICAgICB7CisgICAgICAgICAgICBpZiAocFByaXZhdGUtPk1heEJsa0xlbiA+IHBQcml2YXRlLT5CX0RlbGF5U2l6ZVtpXSkgewogICAgICAgICAgICAgICAgIHBQcml2YXRlLT5NYXhCbGtMZW4gPSBwUHJpdmF0ZS0+Ql9EZWxheVNpemVbaV07CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgICAgaWYgKHBQcml2YXRlLT5BQl9TZWxlY3Rpb24pCi0gICAgICAgIHsKKyAgICAgICAgaWYgKHBQcml2YXRlLT5BQl9TZWxlY3Rpb24pIHsKICAgICAgICAgICAgIHBQcml2YXRlLT5BQl9TZWxlY3Rpb24gPSAwOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgeworICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgcFByaXZhdGUtPkFCX1NlbGVjdGlvbiA9IDE7CiAgICAgICAgIH0KIApAQCAtMjI2LDggKzE5Myw3IEBACiAgICAgICAgICAqLwogICAgICAgIC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AgTFZNX0ZMT0FUICAgICAgIE9tZWdhOwotICAgICAgICBGT19GTE9BVF9Db2Vmc190ICBDb2VmZnM7Ci0gICAgICAgIExWTV9JTlQxNiAgICAgICBpOwotICAgICAgICBMVk1fSU5UMTYgICAgICAgRGFtcGluZyAgICAgID0gKExWTV9JTlQxNikoKHBQcml2YXRlLT5OZXdQYXJhbXMuRGFtcGluZyAqIDEwMCkgKyAxMDAwKTsKLSAgICAgICAgTFZNX0ZMT0FUICAgICAgIFNjYWxlVGFibGVbXSA9IHtMVlJFVl9UXzNfUG93ZXJfMF9vbl80LCBMVlJFVl9UXzNfUG93ZXJfMV9vbl80LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUkVWX1RfM19Qb3dlcl8yX29uXzQsIExWUkVWX1RfM19Qb3dlcl8zX29uXzR9OworICAgICAgICAocFByaXZhdGUtPmJGaXJzdENvbnRyb2wgPT0gTFZNX1RSVUUpKSB7CisgICAgICAgIExWTV9JTlQzMiBUZW1wOworICAgICAgICBMVk1fRkxPQVQgT21lZ2E7CisgICAgICAgIEZPX0ZMT0FUX0NvZWZzX3QgQ29lZmZzOworICAgICAgICBMVk1fSU5UMTYgaTsKKyAgICAgICAgTFZNX0lOVDE2IERhbXBpbmcgPSAoTFZNX0lOVDE2KSgocFByaXZhdGUtPk5ld1BhcmFtcy5EYW1waW5nICogMTAwKSArIDEwMDApOworICAgICAgICBMVk1fRkxPQVQgU2NhbGVUYWJsZVtdID0ge0xWUkVWX1RfM19Qb3dlcl8wX29uXzQsIExWUkVWX1RfM19Qb3dlcl8xX29uXzQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZSRVZfVF8zX1Bvd2VyXzJfb25fNCwgTFZSRVZfVF8zX1Bvd2VyXzNfb25fNH07CiAKICAgICAgICAgLyoKICAgICAgICAgICogRm9yIGVhY2ggZmlsdGVyCiAgICAgICAgICAqLwotICAgICAgICBmb3IgKGkgPSAwOyBpIDwgTnVtYmVyT2ZEZWxheUxpbmVzOyBpKyspCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmIChpICE9IDApCi0gICAgICAgICAgICB7CisgICAgICAgIGZvciAoaSA9IDA7IGkgPCBOdW1iZXJPZkRlbGF5TGluZXM7IGkrKykgeworICAgICAgICAgICAgaWYgKGkgIT0gMCkgewogICAgICAgICAgICAgICAgIFRlbXAgPSAoTFZNX0lOVDMyKShTY2FsZVRhYmxlW2ldICogRGFtcGluZyk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7CisgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIFRlbXAgPSBEYW1waW5nOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYoVGVtcCA8PSAoTFZNX0lOVDMyKShMVk1fRnNUYWJsZVtwUHJpdmF0ZS0+TmV3UGFyYW1zLlNhbXBsZVJhdGVdID4+IDEpKQotICAgICAgICAgICAgeworICAgICAgICAgICAgaWYgKFRlbXAgPD0gKExWTV9JTlQzMikoTFZNX0ZzVGFibGVbcFByaXZhdGUtPk5ld1BhcmFtcy5TYW1wbGVSYXRlXSA+PiAxKSkgewogICAgICAgICAgICAgICAgIE9tZWdhID0gTFZNX0dldE9tZWdhKFRlbXAsIHBQcml2YXRlLT5OZXdQYXJhbXMuU2FtcGxlUmF0ZSk7CiAgICAgICAgICAgICAgICAgTFZNX0ZPX0xQRihPbWVnYSwgJkNvZWZmcyk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7CisgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIENvZWZmcy5BMCA9IDE7CiAgICAgICAgICAgICAgICAgQ29lZmZzLkExID0gMDsKICAgICAgICAgICAgICAgICBDb2VmZnMuQjEgPSAwOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgRk9fMUlfRDMyRjMyQ2xsX1RSQ19XUkFfMDFfSW5pdCgmcFBya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gIHsKLSAgICAgICAgTFZNX0lOVDE2ICAgaTsKLSAgICAgICAgTFZNX0ZMT0FUICAgQWxwaGE7Ci0gICAgICAgIExWTV9GTE9BVCAgIEFscGhhVGFwOworICAgICAgICAocFByaXZhdGUtPk5ld1BhcmFtcy5EZW5zaXR5ICE9IHBQcml2YXRlLT5DdXJyZW50UGFyYW1zLkRlbnNpdHkpKSB7CisgICAgICAgIExWTV9JTlQxNiBpOworICAgICAgICBMVk1fRkxPQVQgQWxwaGE7CisgICAgICAgIExWTV9GTE9BVCBBbHBoYVRhcDsKIAogICAgICAgICBBbHBoYSA9IExWTV9NaXhlcl9UaW1lQ29uc3RhbnQoTFZSRVZfQUxMUEFTU19UQywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9HZXRGc0Zyb21UYWJsZShwUHJpdmF0ZS0+TmV3UGFyYW1zLlNhbXBsZVJhdGUpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fR2V0RnNGcm9tVGFibGUocFByaXZhdGUtPk5ld1BhcmFtcy5TYW1wbGVSYXRlKSwgMSk7CiAKICAgICAgICAgQWxwaGFUYXAgPSBMVk1fTWl4ZXJfVGltZUNvbnN0YW50KExWUkVWX0FMTFBBU1NfVEFQX1RDLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0dldEZzRnJvbVRhYmxlKHBQcml2YXRlLT5OZXdQYXJhbXMuU2FtcGxlUmF0ZSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9HZXRGc0Zyb21UYWJsZShwUHJpdmF0ZS0+TmV3UGFyYW1zLlNhbXBsZVJhdGUpLCAxKTsKIAotICAgICAgICBmb3IgKGkgPSAwOyBpIDwgN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RlLT5OZXdQYXJhbXMuVDYwICAgICAgICAhPSBwUHJpdmF0ZS0+Q3VycmVudFBhcmFtcy5UNjApICAgICAgICB8fAotICAgICAgICAocFByaXZhdGUtPmJGaXJzdENvbnRyb2wgICAgICAgID09IExWTV9UUlVFKSkKLSAgICB7CisgICAgICAgIChwUHJpdmF0ZS0+TmV3UGFyYW1zLlQ2MCAhPSBwUHJpdmF0ZS0+Q3VycmVudFBhcmFtcy5UNjApIHx8CisgICAgICAgIChwUHJpdmF0ZS0+YkZpcnN0Q29udHJvbCA9PSBMVk1fVFJVRSkpIHsKKyAgICAgICAgTFZNX0ZMT0FUIEdbNF07IC8qIEZlZWRiYWNrIGdhaW4gKFE3LjI0KSAqLwogCi0gICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgIEdbNF07ICAgICAgICAgICAgICAgICAgICAgICAvKiBGZWVkYmFjayBnYWluIChRNy4yNCkgKi8KLQotICAgICAgICBpZihwUHJpdmF0ZS0+TmV3UGFyYW1zLlQ2MCA9PSAwKQotICAgICAgICB7CisgICAgICAgIGlmIChwUHJpdmF0ZS0+TmV3UGFyYW1zLlQ2MCA9PSAwKSB7CiAgICAgICAgICAgICBHWzNdID0gMDsKICAgICAgICAgICAgIEdbMl0gPSAwOwogICAgICAgICAgICAgR1sxXSA9IDA7CiAgICAgICAgICAgICBHWzBdID0gMDsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIExWTV9GTE9BVCAgIFRlbXAxOwotICAgICAgICAgICAgTFZNX0ZMT0FUICAgVGVtcDI7Ci0gICAgICAgICAgICBMVk1fSU5UMTYgICBpOwotICAgICAgICAgICAgTFZNX0ZMT0FUICAgU2NhbGVUYWJsZVtdID0ge0xWUkVWX1RfM19Qb3dlcl9taW51czBfb25fNCwgTFZSRVZfVF8zX1Bvd2VyX21pbnVzMV9vbl80LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUkVWX1RfM19Qb3dlcl9taW51czJfb25fNCwgTFZSRVZfVF8zX1Bvd2VyX21pbnVzM19vbl80fTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIExWTV9GTE9BVCBUZW1wMTsKKyAgICAgICAgICAgIExWTV9GTE9BVCBUZW1wMjsKKyAgICAgICAgICAgIExWTV9JTlQxNiBpOworICAgICAgICAgICAgTFZNX0ZMT0FUIFNjYWxlVGFibGVbXSA9IHtMVlJFVl9UXzNfUG93ZXJfbWludXMwX29uXzQsIExWUkVWX1RfM19Qb3dlcl9taW51czFfb25fNCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZSRVZfVF8zX1Bvd2VyX21pbnVzMl9vbl80LCBMVlJFVl9UXzNfUG93ZXJfbWludXMzX29uXzR9OwogCiAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICogRm9yIGVhY2ggZGVsYXkgbGluZQogICAgICAgICAgICAgICovCi0gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgTnVtYmVyT2ZEZWxheUxpbmVzOyBpKyspCi0gICAgICAgICAgICB7CisgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgTnVtYmVyT2ZEZWxheUxpbmVzOyBpKyspIHsKICAgICAgICAgICAgICAgICBUZW1wMSA9ICgzICogcFByaXZhdGUtPlJvb21TaXplSW5tcyAqIFNjYWxlVGFibGVbaV0pIC8gcFByaXZhdGUtPk5ld1BhcmFtcy5UNjA7Ci0gICAgICAgICAgICAgICAgaWYoVGVtcDEgPj0gKDQpKQotICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoVGVtcDEgPj0gKDQpKSB7CiAgICAgICAgICAgICAgICAgICAgIEdbaV0gPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlIGlmKChUZW1wMSA+PSAoMikpKQotICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKChUZW1wMSA+PSAoMikpKSB7CiAgICAgICAgICAgICAgICAgICAgIFRlbXAyID0gTFZNX1Bvd2VyMTAoLShUZW1wMSAvIDIuMGYpKTsKICAgICAgICAgICAgICAgICAgICAgVGVtcDEgPSBMVk1fUG93ZXIxMCgtKFRlbXAxIC8gMi4wZikpOwogICAgICAgICAgICAgICAgICAgICBUZW1wMSA9IFRlbXAxICogVGVtcDI7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgVGVtcDEgPSBMVk1fUG93ZXIxMCgtKFRlbXAxKSk7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChOdW1iZXJPZkRlbGF5TGluZXMgPT0gMSkKLSAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKE51bWJlck9mRGVsYXlMaW5lcyA9PSAxKSB7CiAgICAgICAgICAgICAgICAgICAgIEdbaV0gPSBUZW1wMTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgVGVtcEc7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUIFRlbXBHOwogICAgICAgICAgICAgICAgICAgICBUZW1wRyA9IFRlbXAxICogT05FX09WRVJfU1FSVF9UV087Ci0gICAgICAgICAgICAgICAgICAgIEdbaV09VGVtcEc7CisgICAgICAgICAgICAgICAgICAgIEdbaV0gPSBUZW1wRzsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICAvKiBTZXQgdXAgdGhlIGZlZWRiYWNrIG1peGVycyBmb3IgZm91ciBkZWxheSBsaW5lcyAqLwotICAgICAgICBwUHJpdmF0Z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GFyYW1zLkxldmVsICE9IHBQcml2YXRlLT5DdXJyZW50UGFyYW1zLkxldmVsKSB8fAorICAgICAgICAocFByaXZhdGUtPk5ld1BhcmFtcy5UNjAgIT0gcFByaXZhdGUtPkN1cnJlbnRQYXJhbXMuVDYwKSkgeworICAgICAgICBMVk1fSU5UMzIgSW5kZXggPSAwOwogICAgICAgICBMVk1fRkxPQVQgSW5kZXhfRkxPQVQ7Ci0gICAgICAgIExWTV9JTlQzMiBpPTA7Ci0gICAgICAgIExWTV9GTE9BVCBHYWluPTA7Ci0gICAgICAgIExWTV9JTlQzMiBSb29tU2l6ZT0wOworICAgICAgICBMVk1fSU5UMzIgaSA9IDA7CisgICAgICAgIExWTV9GTE9BVCBHYWluID0gMDsKKyAgICAgICAgTFZNX0lOVDMyIFJvb21TaXplID0gMDsKICAgICAgICAgTFZNX0ZMT0FUIFQ2MDsKICAgICAgICAgTFZNX0ZMT0FUIENvZWZzWzVdOwogCi0gICAgICAgIGlmKHBQcml2YXRlLT5OZXdQYXJhbXMuUm9vbVNpemUgPT0gMCkKLSAgICAgICAgeworICAgICAgICBpZiAocFByaXZhdGUtPk5ld1BhcmFtcy5Sb29tU2l6ZSA9PSAwKSB7CiAgICAgICAgICAgICBSb29tU2l6ZSA9IDE7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7CisgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICBSb29tU2l6ZSA9IChMVk1fSU5UMzIpcFByaXZhdGUtPk5ld1BhcmFtcy5Sb29tU2l6ZTsKICAgICAgICAgfQogCi0gICAgICAgIGlmKHBQcml2YXRlLT5OZXdQYXJhbXMuVDYwIDwgMTAwKQotICAgICAgICB7CisgICAgICAgIGlmIChwUHJpdmF0ZS0+TmV3UGFyYW1zLlQ2MCA8IDEwMCkgewogICAgICAgICAgICAgVDYwID0gMTAwICogTFZSRVZfVDYwX1NDQUxFOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgeworICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgVDYwID0gcFByaXZhdGUtPk5ld1BhcmFtcy5UNjAgKiBMVlJFVl9UNjBfU0NBTEU7CiAgICAgICAgIH0KIAogICAgICAgICAvKiBGaW5kIHRoZSBuZWFyZXN0IHJvb20gc2l6ZSBpbiB0YWJsZSAqLwotICAgICAgICBmb3IoaSA9IDA7IGkgPCAyNDsgaSsrKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZihSb29tU2l6ZSA8PSBMVlJFVl9HYWluUG9seVRhYmxlW2ldWzBdKQotICAgICAgICAgICAgeworICAgICAgICBmb3IgKGkgPSAwOyBpIDwgMjQ7IGkrKykgeworICAgICAgICAgICAgaWYgKFJvb21TaXplIDw9IExWUkVWX0dhaW5Qb2x5VGFibGVbaV1bMF0pIHsKICAgICAgICAgICAgICAgICBJbmRleCA9IGk7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAotICAgICAgICBpZihSb29tU2l6ZSA9PSBMVlJFVl9HYWluUG9seVRhYmxlW0luZGV4XVswXSkKLSAgICAgICAgeworICAgICAgICBpZiAoUm9vbVNpemUgPT0gTFZSRVZfR2FpblBvbHlUYWJsZVtJbmRleF1bMF0pIHsKICAgICAgICAgICAgIC8qIFRha2UgdGFibGUgdmFsdWVzIGlmIHRoZSByb29tIHNpemUgaXMgaW4gdGFibGUgKi8KLSAgICAgICAgICAgIGZvcihpID0gMTsgaSA8IDU7IGkrKykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBDb2Vmc1tpLTFdID0gTFZSRVZfR2FpblBvbHlUYWJsZVtJbmRleF1baV07CisgICAgICAgICAgICBmb3IgKGkgPSAxOyBpIDwgNTsgaSsrKSB7CisgICAgICAgICAgICAgICAgQ29lZnNbaSAtIDFdID0gTFZSRVZfR2FpblBvbHlUYWJsZVtJbmRleF1baV07CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBDb2Vmc1s0XS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gICAgICAgICAgIGZvcihpID0gMTsgaSA8IDU7IGkrKykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBDb2Vmc1tpLTFdID0gTFZSRVZfR2FpblBvbHlUYWJsZVtJbmRleC0xXVtpXTsKKyAgICAgICAgICAgIGZvciAoaSA9IDE7IGkgPCA1OyBpKyspIHsKKyAgICAgICAgICAgICAgICBDb2Vmc1tpIC0gMV0gPSBMVlJFVl9HYWluUG9seVRhYmxlW0luZGV4IC0gMV1baV07CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBDb2Vmc1s0XSA9IDA7CiAKLSAgICAgICAgICAgIEdhaW4xID0gTFZNX1BvbHlub21pYWwoMywgQ29lZnMsIFQ2MCk7ICAgICAgLyogUS4yNCByZXN1bHQgKi8KKyAgICAgICAgICAgIEdhaW4xID0gTFZNX1BvbHlub21pYWwoMywgQ29lZnMsIFQ2MCk7IC8qIFEuMjQgcmVzdWx0ICovCiAKICAgICAgICAgICAgIC8qIEdldCBnYWluIGZvciBzZWNvbmQgKi8KLSAgICAgICAgICAgIGZvcihpID0gMTsgaSA8IDU7IGkrKykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBDb2Vmc1tpLTFdID0gTFZSRVZfR2FpblBvbHlUYWJsZVtJbmRleF1baV07CisgICAgICAgICAgICBmb3IgKGkgPSAxOyBpIDwgNTsgaSsrKSB7CisgICAgICAgICAgICAgICAgQ29lZnNbaSAtIDFdID0gTFZSRVZfR2FpblBvbHlUYWJsZVtJbmRleF1baV07CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBDb2Vmc1s0XSA9IDA7CiAKLSAgICAgICAgICAgIEdhaW4yID0gTFZNX1BvbHlub21pYWwoMywgQ29lZnMsIFQ2MCk7ICAgICAgLyogUS4yNCByZXN1bHQgKi8KKyAgICAgICAgICAgIEdhaW4yID0gTFZNX1BvbHlub21pYWwoMywgQ29lZnMsIFQ2MCk7IC8qIFEuMjQgcmVzdWx0ICovCiAKICAgICAgICAgICAgIC8qIExpbmVhciBJbnRlcnBvbGF0ZSB0aGUgZ2FpbiAqLwogICAgICAgICAgICAgR2FpbiA9IEdhaW4xICsgKCgoR2FpbjIgLSBHYWluMSkgKiBEaXN0KSAvIChUb3RfRGlzdCkpOwpAQCAtNDYxLDMyICszODcsMjcgQEAKICAgICAgICAgICogR2V0IHRoZSBpbnZlcnNlIG9mIGdhaW46IFEuMTUKICAgICAgICAgICogR2FpbiBpcyBtb3N0bHkgYWJvdmUgb25lIGV4Y2VwdCBmZXcgY2FzZXMsIHRha2Ugb25seSBnYWlucyBhYm92ZSAxCiAgICAgICAgICAqLwotICAgICAgICBpZihHYWluIDwgMSkKLSAgICAgICAgeworICAgICAgICBpZiAoR2FpbiA8IDEpIHsKICAgICAgICAgICAgIHBQcml2YXRlLT5HYWluID0gMTsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIHBQcml2YXRlLT5HYWluID0gMSAvIEdhaW47CiAgICAgICAgIH0KIAogICAgICAgICBJbmRleF9GTE9BVCA9IDEwMC4wZiAvIChMVk1fRkxPQVQpKDEwMCArIHBQcml2YXRlLT5OZXdQYXJhbXMuTGV2ZWwpOwogICAgICAgICBwUHJpdmF0ZS0+R2FpbiA9IHBQcml2YXRlLT5HYWluICogSW5kZXhfRkxPQVQ7Ci0gICAgICAgIHBQcml2YXRlLT5HYWluTWl4ZXIuVGFyZ2V0ID0gKHBQcml2YXRlLT5HYWluKkluZGV4X0ZMT0FUKSAvIDI7CisgICAgICAgIHBQcml2YXRlLT5HYWluTWl4ZXIuVGFyZ2V0ID0gKHBQcml2YXRlLT5HYWluICogSW5kZXhfRkxPQVQpIC8gMjsKICAgICB9CiAKICAgICAvKgogICAgICAqIFVwZGF0ZSB0aGUgYWxsIHBhc3MgY29tYiBmaWx0ZXIgY29lZmZpY2llbnQKICAgICAgKi8KLSAgICBpZiggKHBQcml2YXRlLT5OZXdQ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UtPmJEaXNhYmxlUmV2ZXJiID0gTFZNX1RSVUU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7CisgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIHBQcml2YXRlLT5iRGlzYWJsZVJldmVyYiA9IExWTV9GQUxTRTsKICAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBlbHNlIGlmIChwUHJpdmF0ZS0+YkZpcnN0Q29udHJvbCA9PSBMVk1fRkFMU0UpCi0gICAgICAgIHsKKyAgICAgICAgfSBlbHNlIGlmIChwUHJpdmF0ZS0+YkZpcnN0Q29udHJvbCA9PSBMVk1fRkFMU0UpIHsKICAgICAgICAgICAgIHBQcml2YXRlLT5CeXBhc3NNaXhlci5UYXJnZXQyID0gMHgwMDAwMDAwMDsKICAgICAgICAgICAgIHBQcml2YXRlLT5CeXBhc3NNaXhlci5UYXJnZXQxID0gMHgwMDAwMDAwMDsKICAgICAgICAgICAgIHBQcml2YXRlLT5CeXBhc3NNaXhlci5DYWxsYmFja1NldDIgPSBMVk1fVFJVRTsKLSAgICAgICAgICAgIHBQcml2YXRlLT5HYWluTWl4ZXIuVGFyZ2V0ICAgID0gMC4wMzEyNWY7CisgICAgICAgICAgICBwUHJpdmF0ZS0+R2Fpbk1peGVyLlRhcmdldCA9IDAuMDMxMjVmOwogICAgICAgICAgICAgT3BlcmF0aW5nTW9kZSA9IExWTV9NT0RFX09OOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgeworICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgT3BlcmF0aW5nTW9kZSA9IExWTV9NT0RFX09GRjsKICAgICAgICAgfQogICAgIH0KIAogICAgIC8qICBJZiBpdCBpcyB0aGUgZmlyc3QgY2FsbCB0byBBcHBseU5ldyBzZXR0aW5ncyBmb3JjZSB0aGUgY3VycmVudCB0byB0aGUgdGFyZ2V0IFwKICAgICAgICAgdG8gYmVnaW4gaW1tZWRpYXRlIHBsYXliYWNrIG9mIHRoZSBlZmZlY3QgKi8KLSAgICBpZihwUHJpdmF0ZS0+YkZpcnN0Q29udHJvbCA9PSBMVk1fVFJVRSkKLSAgICB7CisgICAgaWYgKHBQcml2YXRlLT5iRmlyc3RDb250cm9sID09IExWTV9UUlVFKSB7CiAgICAgICAgIHBQcml2YXRlLT5CeXBhc3NNaXhlci5DdXJyZW50MSA9IHBQcml2YXRlLT5CeXBhc3NNaXhlci5UYXJnZXQxOwogICAgICAgICBwUHJpdmF0ZS0+QnlwYXNzTWl4ZXIuQ3VycmVudDIgPSBwUHJpdmF0ZS0+QnlwYXNzTWl4ZXIuVGFyZ2V0MjsKICAgICB9CkBAIC01ODIsOCArNDkwLDcgQEAKICAgICAvKgogICAgICAqIFVwZGF0ZSBmbGFnCiAgICAgICovCi0gICAgaWYocFByaXZhdGUtPmJGaXJzdENvbnRyb2wgPT0gTFZNX1RSVUUpCi0gICAgeworICAgIGlmIChwUHJpdmF0ZS0+YkZpcnN0Q29udHJvbCA9PSBMVk1fVFJVRSkgewogICAgICAgICBwUHJpdmF0ZS0+YkZpcnN0Q29udHJvbCA9IExWTV9GQUxTRTsKICAgICB9CiAKQEAgLTYwNiwxMiArNTEzLDkgQEAKIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9JTlQzMiBCeXBhc3NNaXhlcl9DYWxsYmFjayAodm9pZCAqcENhbGxiYWNrRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgIC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ZXJiL3NyYy9MVlJFVl9HZXRDb250cm9sUGFyYW1ldGVycy5jcHAKaW5kZXggZTBiMDE0Mi4uZjg1OGI3NCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1JldmVyYi9zcmMvTFZSRVZfR2V0Q29udHJvbFBhcmFtZXRlcnMuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvc3JjL0xWUkVWX0dldENvbnRyb2xQYXJhbWV0ZXJzLmNwcApAQCAtNDIsMTcgKzQyLDE0IEBACiAvKiAgMS4gIFRoaXMgZnVuY3Rpb24gbWF5IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVlJFVl9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlJFVl9SZXR1cm5TdGF0dXNfZW4gTFZSRVZfR2V0Q29udHJvbFBhcmFtZXRlcnMoTFZSRVZfSGFuZGxlX3QgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9Db250cm9sUGFyYW1zX3N0ICAgKnBDb250cm9sUGFyYW1zKQotewotCi0gICAgTFZSRVZfSW5zdGFuY2Vfc3QgICpwTFZSRVZfUHJpdmF0ZSA9IChMVlJFVl9JbnN0YW5jZV9zdCAqKWhJbnN0YW5jZTsKK0xWUkVWX1JldHVyblN0YXR1c19lbiBMVlJFVl9HZXRDb250cm9sUGFyYW1ldGVycyhMVlJFVl9IYW5kbGVfdCBoSW5zdGFuY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZSRVZfQ29udHJvbFBhcmFtc19zdCogcENvbnRyb2xQYXJhbXMpIHsKKyAgICBMVlJFVl9JbnN0YW5jZV9zdCogcExWUkVWX1ByaXZhdGUgPSAoTFZSRVZfSW5zdGFuY2Vfc3QqKWhJbnN0YW5jZTsKIAogICAgIC8qCiAgICAgICogQ2hlY2sgZm9yIGVycm9yIGNvbmRpdGlvbnMKICAgICAgKi8KLSAgICBpZigoaEluc3RhbmNlID09IExWTV9OVUxMKSB8fCAocENvbnRyb2xQYXJhbXMgPT0gTFZNX05VTEwpKQotICAgIHsKKyAgICBpZiAoKGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkgfHwgKHBDb250cm9sUGFyYW1zID09IExWTV9OVUxMKSkgewogICAgICAgICByZXR1cm4gTFZSRVZfTlVMTEFERFJFU1M7CiAgICAgfQogCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvUmV2ZXJiL3NyYy9MVlJFVl9HZXRJbnN0YW5jZUhhbmRsZS5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvUmV2ZXJiL3NyYy9MVlJFVl9HZXRJbnN0YW5jZUhhbmRsZS5jcHAKaW5kZXggNjhmODgzYS4uM2E2MzY5OCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1JldmVyYi9zcmMvTFZSRVZfR2V0SW5zdGFuY2VIYW5kbGUuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvc3JjL0xWUkVWX0dldEluc3RhbmNlSGFuZGxlLmNwcApAQCAtMjEsNyArMjEsNiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KICNpbmNsdWRlICJMVlJFVl9Qcml2YXRlLmgiCi0jaW5jbHVkZSAiSW5zdEFsbG9jLmgiCiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0zNCw3ICszMyw2IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogIHBoSW5zdGFuY2UgICAgICAgICAgICAgIHBvaW50ZXIgdG8gdGhlIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcE1lbW9yeVRhYmxlICAgICAgICAgICAgUG9pbnRlciB0byB0aGUgbWVtb3J5IGRlZmluaXRpb24gdGFibGUgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICBwSW5zdGFuY2VQYXJhbXMgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBwYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTQ1LDIwMSArNDMsNzIgQEAKIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWUkVWX1JldHVyblN0YXR1c19lbiBMVlJFVl9HZXRJbnN0YW5jZUhhbmRsZShMVlJFVl9IYW5kbGVfdCAgICAgICAgICAgICpwaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUkVWX01lbW9yeVRhYmxlX3N0ICAgICAgKnBNZW1vcnlUYWJsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9JbnN0YW5jZVBhcmFtc19zdCAgICpwSW5zdGFuY2VQYXJhbXMpCi17Ci0KLSAgICBJTlNUX0FMTE9DICAgICAgICAgICAgICBTbG93RGF0YTsKLSAgICBJTlNUX0FMTE9DICAgICAgICAgICAgICBGYXN0RGF0YTsKLSAgICBJTlNUX0FMTE9DICAgICAgICAgICAgICBGYXN0Q29lZjsKLSAgICBJTlNUX0FMTE9DICAgICAgICAgICAgICBUZW1wb3Jhcnk7Ci0gICAgTFZSRVZfSW5zdGFuY2Vfc3QgICAgICAgKnBMVlJFVl9Qcml2YXRlOwotICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIGk7Ci0gICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgTWF4QmxvY2tTaXplOworTFZSRVZfUmV0dXJuU3RhdHVzX2VuIExWUkVWX0dldEluc3RhbmNlSGFuZGxlKExWUkVWX0hhbmRsZV90KiBwaEluc3RhbmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUkVWX0luc3RhbmNlUGFyYW1zX3N0KiBwSW5zdGFuY2VQYXJhbXMpIHsKKyAgICBMVlJFVl9JbnN0YW5jZV9zdCogcExWUkVWX1ByaXZhdGU7CisgICAgTFZNX0lOVDE2IGk7CisgICAgTFZNX1VJTlQxNiBNYXhCbG9ja1NpemU7CiAKICAgICAvKgogICAgICAqIENoZWNrIGZvciBlcnJvciBjb25kaXRpb25zCiAgICAgICovCiAgICAgLyogQ2hlY2sgZm9yIE5VTEwgcG9pbnRlcnMgKi8KLSAgICBpZigocGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkgfHwgKHBNZW1vcnlUYWJsZSA9PSBMVk1fTlVMTCkgfHwgKHBJbnN0YW5jZVBhcmFtcyA9PSBMVk1fTlVMTCkpCi0gICAgeworICAgIGlmICgocGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkgfHwgKHBJbnN0YW5jZVBhcmFtcyA9PSBMVk1fTlVMTCkpIHsKICAgICAgICAgcmV0dXJuIExWUkVWX05VTExBRERSRVNTOwogICAgIH0KLSAgICAvKiBDaGVjayB0aGUgbWVtb3J5IHRhYmxlIGZvciBOVUxMIHBvaW50ZXJzICovCi0gICAgZm9yIChpID0gMDsgaSA8IExWUkVWX05SX01FTU9SWV9SRUdJT05TOyBpKyspCi0gICAgewotICAgICAgICBpZiAocE1lbW9yeVRhYmxlLT5SZWdpb25baV0uU2l6ZSE9MCkKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKHBNZW1vcnlUYWJsZS0+UmVnaW9uW2ldLnBCYXNlQWRkcmVzcz09TFZNX05VTEwpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuKExWUkVWX05VTExBRERSRVNTKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQogICAgIC8qCiAgICA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QRVJTSVNURU5UX0ZBU1RfREFUQV0uU2l6ZSkgLyBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKExWTV9GTE9BVCkpKTsKLSAgICBMb2FkQ29uc3RfRmxvYXQoMCwKLSAgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCAqKXBNZW1vcnlUYWJsZS0+UmVnaW9uW0xWTV9QRVJTSVNURU5UX0ZBU1RfQ09FRl0ucEJhc2VBZGRyZXNzLAotICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KSgocE1lbW9yeVRhYmxlLT5SZWdpb25bTFZNX1BFUlNJU1RFTlRfRkFTVF9DT0VGXS5TaXplKSAvIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoTFZNX0ZMT0FUKSkpOwotICAgIExvYWRDb25zdF9GbG9hdCgwLAotICAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUICopcE1lbW9yeVRhYmxlLT5SZWdpb25bTFZNX1RFTVBPUkFSWV9GQVNUXS5wQmFzZUFkZHJlc3MsCi0gICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKChwTWVtb3J5VGFibGUtPlJlZ2lvbltMVk1fVEVNUE9SQVJZX0ZBU1RdLlNpemUpIC8gXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihMVk1fRkxPQVQpKSk7Ci0gICAgLyoKICAgICAgKiBTZXQgdGhlIGluc3RhbmNlIGhhbmRsZSBpZiBub3QgYWxyZWFkeSBpbml0aWFsaXNlZAogICAgICAqLwotICAgIGlmICgqcGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkKLSAgICB7Ci0gICAgICAgICpwaEluc3RhbmNlID0gSW5zdEFsbG9jX0FkZE1lbWJlcigmU2xvd0RhdGEsIHNpemVvZihMVlJFVl9JbnN0YW5jZV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AgKExWTV9GTE9BVCAqKUluc3RBbGxvY19BZGRNZW1iZXIoJkZhc3REYXRhLCBMVlJFVl9NQVhfVDJfREVMQVkgKiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihMVk1fRkxPQVQpKTsKLSAgICAgICAgcExWUkVWX1ByaXZhdGUtPnBEZWxheV9UWzFdICAgICA9Ci0gICAgICAgICAgICAoTFZNX0ZMT0FUICopSW5zdEFsbG9jX0FkZE1lbWJlcigmRmFzdERhdGEsIExWUkVWX01BWF9UMV9ERUxBWSAqIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKExWTV9GTE9BVCkpOwotICAgICAgICBwTFZSRVZfUHJpdmF0ZS0+cERlbGF5X1RbMF0gICAgID0KLSAgICAgICAgICAgIChMVk1fRkxPQVQgKilJbnN0QWxsb2NfQWRkTWVtYmVyKCZGYXN0RGF0YSwgTFZSRVZfTUFYX1QwX0RFTEFZICogXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoTFZNX0ZMT0FUKSk7Ci0KLSAgICAgICAgZm9yKGkgPSAwOyBpIDwgNDsgaSsrKQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBTY3JhdGNoIGZvciBlYWNoIGRlbGF5IGxpbmUgb3V0cHV0ICovCi0gICAgICAgICAgICBwTFZSRVZfUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbaV0gPSAoTFZNX0ZMT0FUICopSW5zdEFsbG9jX0FkZE1lbWJlcigmVGVtcG9yYXJ5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoTFZNX0ZMT0FUKSAqIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWF4QmxvY2tTaXplKTsKLSAgICAgICAgfQotCi0gICAgICAgIExvYWRDb25zdF9GbG9hdCgwLCBwTFZSRVZfUHJpdmF0ZS0+cERlbGF5X1RbM10sIExWUkVWX01BWF9UM19ERUxBWSk7Ci0gICAgICAgIExvYWRDb25zdF9GbG9hdCgwLCBwTFZSRVZfUHJpdmF0ZS0+cERlbGF5X1RbMl0sIExWUkVWX01BWF9UMl9ERUxBWSk7Ci0gICAgICAgIExvYWRDb25zdF9GbG9hdCgwLCBwTFZSRVZfUHJpdmF0ZS0+cERlbGF5X1RbMV0sIExWUkVWX01BWF9UMV9ERUxBWSk7Ci0gICAgICAgIExvYWRDb25zdF9GbG9hdCgwLCBwTFZSRVZfUHJpdmF0ZS0+cERlbGF5X1RbMF0sIExWUkVWX01BWF9UMF9ERUxBWSk7Ci0gICAgfQotCi0gICAgaWYocEluc3RhbmNlUGFyYW1zLT5OdW1EZWxheXMgPT0gTFZSRVZfREVMQVlMSU5FU18yKQotICAgIHsKLSAgICAgICAgcExWUkVWX1ByaXZhdGUtPnBEZWxheV9UWzFdICA9IChMVk1fRkxPQVQgKikKLSAgICAgICAgICAgICAgICBJbnN0QWxsb2NfQWRkTWVtYmVyKCZGYXN0RGF0YSwgTFZSRVZfTUFYX1QxX0RFTEFZICogXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoTFZNX0ZMT0FUKSk7Ci0gICAgICAgIHBMVlJFVl9Qcml2YXRlLT5wRGVsYXlfVFswXSAgPSAoTFZNX0ZMT0FUICopCi0gICAgICAgICAgICAgICAgSW5zdEFsbG9jX0FkZE1lbWJlcigmRmFzdERhdGEsIExWUkVWX01BWF9UMF9ERUxBWSAqIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKExWTV9GTE9BVCkpOwotCi0gICAgICAgIGZvcihpID0gMDsgaSA8IDI7IGkrKykKLSAgICAgICAgewotICAgICAgICAgICAgLyogU2NyYXRjaCBmb3IgZWFjaCBkZWxheSBsaW5lIG91dHB1dCAqLwotICAgICAgICAgICAgcExWUkVWX1ByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lW2ldID0gKExWTV9GTE9BVCAqKUluc3RBbGxvY19BZGRNZW1iZXIoJlRlbXBvcmFyeSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKExWTV9GTE9BVCkgKiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1heEJsb2NrU2l6ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBMb2FkQ29uc3RfRmxvYXQoMCwgcExWUkVWX1ByaXZhdGUtPnBEZWxheV9UWzFdLCAoTFZNX0lOVDE2KUxWUkVWX01BWF9UMV9ERUxBWSk7Ci0gICAgICAgIExvYWRDb25zdF9GbG9hdCgwLCBwTFZSRVZfUHJpdmF0ZS0+cERlbGF5X1RbMF0sIChMVk1fSU5UMTYpTFZSRVZfTUFYX1QwX0RFTEFZKTsKLSAgICB9Ci0KLSAgICBpZihwSW5zdGFuY2VQYXJhbXMtPk51bURlbGF5cyA9PSBMVlJFVl9ERUxBWUxJTkVTXzEpCi0gICAgewotICAgICAgICBwTFZSRVZfUHJpdmF0ZS0+cERlbGF5X1RbMF0gID0gKExWTV9GTE9BVCAqKUluc3RBbGxvY19BZGRNZW1iZXIoJkZhc3REYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9NQVhfVDBfREVMQVkgKiBzaXplb2YoTFZNX0ZMT0FUKSk7Ci0KLSAgICAgICAgZm9yK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hbmRyb2lkOjphdWRpb191dGlsczo6QmlxdWFkRmlsdGVyPExWTV9GTE9BVD4oTFZNX01BWF9DSEFOTkVMUykpOworICAgIH0KIAogICAgIExWUkVWX0NsZWFyQXVkaW9CdWZmZXJzKCpwaEluc3RhbmNlKTsKIAogICAgIHJldHVybiBMVlJFVl9TVUNDRVNTOwogfQogCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgIExWUkVWX0ZyZWVJbnN0YW5jZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCB0byBmcmVlIHRoZSBpbnRlcm5hbCBhbGxvY2F0aW9ucyBvZiB0aGUgbW9kdWxlLiAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIGhJbnN0YW5jZSAgICAgICAgICAgICAgIEluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIExWUkVWX1NVQ0NFU1MgICAgICAgICAgZnJlZSBpbnN0YW5jZSBzdWNjZWVkZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTFZSRVZfTlVMTEFERFJFU1MgICAgICBJbnN0YW5jZSBpcyBOVUxMICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCitMVlJFVl9SZXR1cm5TdGF0dXNfZW4gTFZSRVZfRnJlZUluc3RhbmNlKExWUkVWX0hhbmRsZV90IGhJbnN0YW5jZSkgeworICAgIGlmIChoSW5zdGFuY2UgPT0gTFZNX05VTEwpIHsKKyAgICAgICAgcmV0dXJuIExWUkVWX05VTExBRERSRVNTOworICAgIH0KKworICAgIExWUkVWX0luc3RhbmNlX3N0KiBwTFZSRVZfUHJpdmF0ZSA9IChMVlJFVl9JbnN0YW5jZV9zdCopaEluc3RhbmNlOworCisgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBwTFZSRVZfUHJpdmF0ZS0+SW5zdGFuY2VQYXJhbXMuTnVtRGVsYXlzOyBpKyspIHsKKyAgICAgICAgaWYgKHBMVlJFVl9Qcml2YXRl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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbmNsdWRlcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSNpbmNsdWRlICJMVlJFVl9Qcml2YXRlLmgiCi0jaW5jbHVkZSAiSW5zdEFsbG9jLmgiCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBGVU5DVElPTjogICAgICAgICAgICAgICAgTFZSRVZfR2V0TWVtb3J5VGFibGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgVGhpcyBmdW5jdGlvbiBpcyB1c2VkIGZvciBtZW1vcnkgYWxsb2NhdGlvbiBhbmQgZnJlZS4gSXQgY2FuIGJlIGNhbGxlZCBpbiAgICAgICAgICAgKi8KLS8qICB0d28gd2F5czogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlID0gTlVMTCAgICAgICAgICAgICAgICBSZXR1cm5zIHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2UgPSBJbnN0YW5jZSBoYW5kbGUgICAgIFJldHVybnMgdGhlIG1lbW9yeSByZXF1aXJlbWVudHMgYW5kIGFsbG9jYXRlZCAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFzZSBhZGRyZXNzZXMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBXaGVuIHRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciBtZW1vcnkgYWxsb2NhdGlvbiAoaEluc3RhbmNlPU5VTEwpIHRoZSBtZW1vcnkgICAgICAqLwotLyogIGJhc2UgYWRkcmVzcyBwb2ludGVycyBhcmUgTlVMTCBvbiByZXR1cm4uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBXaGVuIHRoZSBmdW5jdGlvbiBpcyBjYWxsZWQgZm9yIGZyZWUgKGhJbnN0YW5jZSA9IEluc3RhbmNlIEhhbmRsZSkgdGhlIG1lbW9yeSAgICAgICAqLwotLyogIHRhYmxlIHJldHVybnMgdGhlIGFsbG9jYXRlZCBtZW1vcnkgYW5kIGJhc2UgYWRkcmVzc2VzIHVzZWQgZHVyaW5nIGluaXRpYWxpc2F0aW9uLiAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIGhJbnN0YW5jZSAgICAgICAgICAgICAgIEluc3RhbmNlIEhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcE1lbW9yeVRhYmxlICAgICAgICAgICAgUG9pbnRlciB0byBhbiBlbXB0eSBtZW1vcnkgdGFibGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwSW5zdGFuY2VQYXJhbXMgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBwYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBMVlJFVl9TdWNjZXNzICAgICAgICAgICBTdWNjZWVkZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIExWUkVWX05VTExBRERSRVNTICAgICAgIFdoZW4gcE1lbW9yeVRhYmxlIGlzIE5VTEwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZSRVZfTlVMTEFERFJFU1MgICAgICAgV2hlbiByZXF1ZXN0aW5nIG1lbW9yeSByZXF1aXJlbWVudHMgYW5kIHBJbnN0YW5jZVBhcmFtcyAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICBpcyBOVUxMICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAxLiAgVGhpcyBmdW5jdGlvbiBtYXkgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWUkVWX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWUkVWX1JldHVyblN0YXR1c19lbiBMVlJFVl9HZXRNZW1vcnlUYWJsZShMVlJFVl9IYW5kbGVfdCAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUkVWX01lbW9yeVRhYmxlX3N0ICAgICAqcE1lbW9yeVRhYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUkVWX0luc3RhbmNlUGFyYW1zX3N0ICAqcEluc3RhbmNlUGFyYW1zKQotewotCi0gICAgSU5TVF9BTExPQyAgICAgICAgICAgICAgU2xvd0RhdGE7Ci0gICAgSU5TVF9BTExPQyAgICAgICAgICAgICAgRmFzdERhdGE7Ci0gICAgSU5TVF9BTExPQyAgICAgICAgICAgICAgRmFzdENvZWY7Ci0gICAgSU5TVF9BTExPQyAgICAgICAgICAgICAgVGVtcG9yYXJ5OwotICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIGk7Ci0gICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgTWF4QmxvY2tTaXplOwotCi0gICAgLyoKLSAgICAgKiBDaGVjayBmb3IgZXJyb3IgY29uZGl0aW9ucwotICAgICAqLwotICAgIC8qIENoZWNrIGZvciBOVUxMIHBvaW50ZXIgKi8KLSAgICBpZiAocE1lbW9yeVRhYmxlID09IExWTV9OVUxMKQotICAgIHsKLSAgICAgICAgcmV0dXJuKExWUkVWX05VTExBRERSRVNTKTsKLSAgICB9Ci0KLSAgICAvKgotICAgICAqIENoZWNrIGFsbCBpbnN0YW5jZSBwYXJhbWV0ZXJzIGFyZSBpbiByYW5nZQotICAgICAqLwotICAgIGlmIChwSW5zdGFuY2VQYXJhbXMgIT0gTFZNX05VTEwpCi0gICAgewotICAgICAgICAvKgotICAgICAgICAgKiBDYWxsIGZvciBtZW1vcnkgYWxsb2NhdGlvbiwgc28gY2hlY2sgdGhlIHBhcmFtZXRlcnMKLSAgICAgICAgICovCi0gICAgICAgIC8qIENoZWNrIGZvciBhIG5vbi16ZXJvIGJsb2NrIHNpemUgKi8KLSAgICAgICAgaWYgKHBJbnN0YW5jZVBhcmFtcy0+TWF4QmxvY2tTaXplID09IDApCi0gICAgICAgIHsKLSAgICAgICAgICAgIHJldHVybiBMVlJFVl9PVVRPRlJBTkdFOwotICAgICAgICB9Ci0KLSAgICAgICAgLyogQ2hlY2sgZm9yIGEgdmFsaWQgbnVtYmVyIG9mIGRlbGF5IGxpbmVzICovCi0gICAgICAgIGlmICgocEluc3RhbmNlUGFyYW1zLT5OdW1EZWxheXMgIT0gTFZSRVZfREVMQVlMSU5FU18xKSAmJgotICAgICAgICAgICAgKHBJbnN0YW5jZVBhcmFtcy0+TnVtRGVsYXlzICE9IExWUkVWX0RFTEFZTElORVNfMikgJiYKLSAgICAgICAgICAgIChwSW5zdGFuY2VQYXJhbXMtPk51bURlbGF5cyAhPSBMVlJFVl9ERUxBWUxJTkVTXzQpKQotICAgICAgICB7Ci0gICAgICAgICAgICByZXR1cm4gTFZSRVZfT1VUT0ZSQU5HRTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qCi0gICAgICogSW5pdGlhbGlzZSB0aGUgSW5zdEFsbG9jIGluc3RhbmNlcwotICAgICAqLwotICAgIEluc3RBbGxvY19Jbml0KCZTbG93RGF0YSwgICh2b2lkICopTFZNX05VTEwpOwotICAgIEluc3RBbGxvY19Jbml0KCZGYXN0RGF0YSwgICh2b2lkICopTFZNX05VTEwpOwotICAgIEluc3RBbGxvY19Jbml0KCZGYXN0Q29lZiwgICh2b2lkICopTFZNX05VTEwpOwotICAgIEluc3RBbGxvY19Jbml0KCZUZW1wb3JhcnksICh2b2lkICopTFZNX05VTEwpOwotCi0gICAgLyoKLSAgICAgKiBGaWxsIGluIHRoZSBtZW1vcnkgdGFibGUKLSAgICAgKi8KLSAgICBpZiAoaEluc3RhbmNlID09IExWTV9OVUxMKQotICAgIHsKLSAgICAgICAgLyoKLSAgICAgICAgICogQ2hlY2sgZm9yIG51bGwgcG9pbnRlcnMKLSAgICAgICAgICovCi0gICAgICAgIGlmIChwSW5zdGFuY2VQYXJhbXMgPT0gTFZNX05VTEwpCi0gICAgICAgIHsKLSAgICAgICAgICAgIHJldHVybihMVlJFVl9OVUxMQUREUkVTUyk7Ci0gICAgICAgIH0KLQotICAgICAgICAvKgotICAgICAgICAgKiBTZWxlY3QgdGhlIG1heGltdW0gaW50ZXJuYWwgYmxvY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ICAgICAgLyoKLSAgICAgICAgICogUmVhZCBiYWNrIG1lbW9yeSBhbGxvY2F0aW9uIHRhYmxlCi0gICAgICAgICAqLwotICAgICAgICAqcE1lbW9yeVRhYmxlID0gcExWUkVWX1ByaXZhdGUtPk1lbW9yeVRhYmxlOwotICAgIH0KLQotICAgIHJldHVybihMVlJFVl9TVUNDRVNTKTsKLX0KLQotLyogRW5kIG9mIGZpbGUgKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvc3JjL0xWUkVWX1ByaXZhdGUuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvc3JjL0xWUkVWX1ByaXZhdGUuaAppbmRleCAyYzI3YzZlLi45YTJmOWNhIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvUmV2ZXJiL3NyYy9MVlJFVl9Qcml2YXRlLmgKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1JldmVyYi9zcmMvTFZSRVZfUHJpdmF0ZS5oCkBAIC0yMyw2ICsyMyw4IEBACiAvKiAgSW5jbHVkZXMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyNpbmNsdWRlIDxhdWRpb191dGlscy9CaXF1YWRGaWx0ZXIuaD4KICNpbmNsdWRlICJMVlJFVi5oIgogI2luY2x1ZGUgIkxWUkVWX1RhYmxlcy5oIgogI2luY2x1ZGUgIkJJUVVBRC5oIgpAQCAtMzcsNjMgKzM5LDYzIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogR2VuZXJhbCAqLwotI2RlZmluZSBPTkVfT1ZFUl9TUVJUX1RXTyAgICAgICAgICAgIDAuNzA3MTA3ZiAgICAgICAgICAgLyogMS9zcXJ0KDIpICogMl4xNSAqLwotI2RlZmluZSBMVlJFVl9CXzhfb25fMTAwMCAgICAgICAgICAgICAgIDAuMDA4ZiAgICAgICAgICAgLyogMC44ICogMl4zMSAqLwotI2RlZmluZSBMVlJFVl9IRUFEUk9PTSAgICAgICAgICAgICAgICAgICAwLjI1ZiAgICAgICAgICAgLyogLTEyZEIgKiAyXjE1ICovCi0jZGVmaW5lIExWUkVWXzJfOV9JTlEyOSAgICAgICAgICAgICAgICAgICAyLjlmICAgICAgICAgICAvKiAyLjkgaW4gUTI5IGZvcm1hdCAqLwotI2RlZmluZSBMVlJFVl9NSU4zREIgICAgICAgICAgICAgICAgMC43MDc5NDU3ZiAgICAgICAgICAgLyogLTNkQiBpbiBRMTUgZm9ybWF0ICovCisjZGVmaW5lIE9ORV9PVkVSX1NRUlRfVFdPIDAuNzA3MTA3ZiAvKiAxL3NxcnQoMikgKiAyXjE1ICovCisjZGVmaW5lIExWUkVWX0JfOF9vbl8xMDAwIDAuMDA4ZiAgICAvKiAwLjggKiAyXjMxICovCisjZGVmaW5lIExWUkVWX0hFQURST09NIDAuMjVmICAgICAgICAvKiAtMTJkQiAqIDJeMTUgKi8KKyNkZWZpbmUgTFZSRVZfMl85X0lOUTI5IDIuOWYgICAgICAgIC8qIDIuOSBpbiBRMjkgZm9ybWF0ICovCisjZGVmaW5lIExWUkVWX01JTjNEQiAwLjcwNzk0NTdmICAgIC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BzaXplIGxvdyBsaW1pdCAqLwotI2RlZmluZSBMVlJFVl9NQVhfTEVWRUwgICAgICAgICAgICAgICAgICAgMTAwICAgICAgICAgICAvKiBNYXhpbXVtIGxldmVsLCAxMDAlICovCi0jZGVmaW5lIExWUkVWX01JTl9MUEZfQ09STkVSICAgICAgICAgICAgICAgNTAgICAgICAgICAgIC8qIExvdyBwYXNzIGZpbHRlciBsaW1pdHMgKi8KLSNkZWZpbmUgTFZSRVZfTUFYX0xQRl9DT1JORVIgICAgICAgICAgICAyMzk5OQotI2RlZmluZSBMVlJFVl9NSU5fSFBGX0NPUk5FUiAgICAgICAgICAgICAgIDIwICAgICAgICAgICAvKiBIaWdoIHBhc3MgZmlscmVyIGxpbWl0cyAqLwotI2RlZmluZSBMVlJFVl9NQVhfSFBGX0NPUk5FUiAgICAgICAgICAgICAxMDAwCi0jZGVmaW5lIExWUkVWX01BWF9UNjAgICAgICAgICAgICAgICAgICAgIDcwMDAgICAgICAgICAgIC8qIE1heGltdW0gVDYwIHRpbWUgaW4gbXMgKi8KLSNkZWZpbmUgTFZSRVZfTUFYX0RFTlNJVFkgICAgICAgICAgICAgICAgIDEwMCAgICAgICAgICAgLyogTWF4aW11bSBkZW5zaXR5LCAxMDAlICovCi0jZGVmaW5lIExWUkVWX01BWF9EQU1QSU5HICAgICAgICAgICAgICAgICAxMDAgICAgICAgICAgIC8qIE1heGltdW0gZGFtcGluZywgMTAwJSAqLwotI2RlZmluZSBMVlJFVl9NQVhfUk9PTVNJWkUgICAgICAgICAgICAgICAgMTAwICAgICAgICAgICAvKiBNYXhpbXVtIHJvb20gc2l6ZSwgMTAwJSAqLworI2RlZmluZSBMVlJFVl9NQVhCTEtTSVpFX0xJTUlUIDY0IC8qIE1heGltdW0gYmxvY2sgc2l6ZSBsb3cgbGltaXQgKi8KKyNkZWZpbmUgTFZSRVZfTUFYX0xFVkVMIDEwMCAgICAgICAvKiBNYXhpbXVtIGxldmVsLCAxMDAlICovCisjZGVmaW5lIExWUkVWX01JTl9MUEZfQ09STkVSIDUwICAgLyogTG93IHBhc3MgZmlsdGVyIGxpbWl0cyAqLworI2RlZmluZSBMVlJFVl9NQVhfTFBGX0NPUk5FUiAyMzk5OQorI2RlZmluZSBMVlJFVl9NSU5fSFBGX0NPUk5FUiAyMCAvKiBIaWdoIHBhc3MgZmlscmVyIGxpbWl0cyAqLworI2RlZmluZSBMVlJFVl9NQVhfSFBGX0NPUk5FUiAxMDAwCisjZGVmaW5lIExWUkVWX01BWF9UNjAgNzAwMCAgICAgLyogTWF4aW11bSBUNjAgdGltZSBpbiBtcyAqLworI2RlZmluZSBMVlJFVl9NQVhfREVOU0lUWSAxMDAgIC8qIE1heGltdW0gZGVuc2l0eSwgMTAwJSAqLworI2RlZmluZSBMVlJFVl9NQVhfREFNUElORyAxMDAgIC8qIE1heGltdW0gZGFtcGluZywgMTAwJSAqLworI2RlZmluZSBMVlJFVl9NQVhfUk9PTVNJWkUgMTAwIC8qIE1heGltdW0gcm9vbSBzaXplLCAxMDAlICovCiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0xMDEsNzMgKzEwMyw1NyBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotLyogRmFzdCBkYXRhIHN0cnVjdHVyZSAqLwotdHlwZWRlZiBzdHJ1Y3QKLXsKLSAgICBCaXF1YWRfMUlfT3JkZXIxX0ZM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WVtb3J5VGFibGU7ICAgICAgICAgICAgICAvKiBNZW1vcnkgdGFibGUgKi8KLSAgICBMVlJFVl9Db250cm9sUGFyYW1zX3N0ICBDdXJyZW50UGFyYW1zOyAgICAgICAgICAgIC8qIFBhcmFtZXRlcnMgYmVpbmcgdXNlZCAqLwotICAgIExWUkVWX0NvbnRyb2xQYXJhbXNfc3QgIE5ld1BhcmFtczsgICAgICAgICAgICAgICAgLyogTmV3IHBhcmFtZXRlcnMgZnJvbSB0aGUgXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGluZyBhcHBsaWNhdGlvbiAqLwotICAgIExWTV9DSEFSICAgICAgICAgICAgICAgIGJDb250cm9sUGVuZGluZzsgICAgICAgICAgLyogRmxhZyB0byBpbmRpY2F0ZSBuZXcgcGFyYW1ldGVycyBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmUgYXZhaWxhYmxlICovCi0gICAgTFZNX0NIQVIgICAgICAgICAgICAgICAgYkZpcnN0Q29udHJvbDsgICAgICAgICAgICAvKiBGbGFnIHRvIGluZGljYXRlIHRoYXQgdGhlIGNvbnRyb2wgXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciB0aGUgZmlyc3QgdGltZSAqLwotICAgIExWTV9DSEFSICAgICAgICAgICAgICAgIGJEaXNhYmxlUmV2ZXJiOyAgICAgICAgICAgLyogRmxhZyB0byBpbmRpY2F0ZSB0aGF0IHRoZSBtaXggbGV2ZWwgaXMKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAlIGFuZCB0aGUgcmV2ZXJiIGNhbiBiZSBkaXNhYmxlZCAqLwotICAgIExWTV9JTlQzMiAgICAgICAgICAgICAgIFJvb21TaXplSW5tczsgICAgICAgICAgICAgLyogUm9vbSBzaXplIGluIG1zZWMgKi8KLSAgICBMVk1fSU5UMzIgICAgICAgICAgICAgICBNYXhCbGtMZW47ICAgICAgICAgICAgICAgIC8qIE1heGltdW0gYmxvY2sgc2l6ZSBmb3IgaW50ZXJuYWwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2Nlc3NpbmcgKi8KKyAgICBMVlJFVl9JbnN0YW5jZVBhcmFtc19zdCBJbnN0YW5jZVBhcmFtczsgLyogSW5pdGlhbGlzYXRpb24gdGltZSBpbnN0YW5jZSBwYXJhbWV0ZXJzICovCisgICAgTFZSRVZfQ29udHJvbFBhcmFtc19zdCBDdXJyZW50UGFyYW1zOyAgIC8qIFBhcmFtZXRlcnMgYmVpbmcgdXNlZCAqLworICAgIExWUkVWX0NvbnRyb2xQYXJhbXNfc3QgTmV3UGFyYW1zOyAgICAgICAvKiBOZXcgcGFyYW1ldGVycyBmcm9tIHRoZSBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxpbmcgYXBwbGljYXRpb24gKi8KKyAgICBMVk1fQ0hBUiBiQ29udHJvbFBlbmRpbmc7ICAgICAgICAgICAgICAgLyogRmxhZyB0byBpbmRpY2F0ZSBuZXcgcGFyYW1ldGVycyBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZSBhdmFpbGFibGUgKi8KKyAgICBMVk1fQ0hBUiBiRmlyc3RDb250cm9sOyAgICAgICAgICAgICAgICAgLyogRmxhZyB0byBpbmRpY2F0ZSB0aGF0IHRoZSBjb250cm9sIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciB0aGUgZmlyc3QgdGltZSAqLworICAgIExWTV9DSEFSIGJEaXNhYmxlUmV2ZXJiOyAgICAgICAgICAgICAgICAvKiBGbGFnIHRvIGluZGljYXRlIHRoYXQgdGhlIG1peCBsZXZlbCBpcworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwJSBhbmQgdGhlIHJldmVyYiBjYW4gYmUgZGlzYWJsZWQgKi8KKyAgICBMVk1fSU5UMzIgUm9vbVNpemVJbm1zOyAgICAgICAgICAgICAgICAgLyogUm9vbSBzaXplIGluIG1zZWMgKi8KKyAgICBMVk1fSU5UMzIgTWF4QmxrTGVuOyAgICAgICAgICAgICAgICAgICAgLyogTWF4aW11bSBibG9jayBzaXplIGZvciBpbnRlcm5hbAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzaW5nICovCiAKICAgICAvKiBBbGlnbmVkIG1lbW9yeSBwb2ludGVycyAqLwotICAgIExWUkVWX0Zhc3REYXRhX3N0ICAgICAgICpwRmFzdERhdGE7ICAgICAgICAgICAgICAgLyogRmFzdCBkYXRhIG1lbW9yeSBiYXNlIGFkZHJlc3MgKi8KLSAgICBMVlJFVl9GYXN0Q29lZl9zdCAgICAgICAqcEZhc3RDb2VmOyAgICAgICAgICAgICAgIC8qIEZhc3QgY29lZmZpY2llbnQgbWVtb3J5IGJhc2UgYWRkcmVzcyAqLwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwU2NyYXRjaERlbGF5TGluZVs0XTsgICAgLyogRGVsYXkgbGluZSBzY3JhdGNoIG1lbW9yeSAqLwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwU2NyYXRjaDsgICAgICAgICAgICAgICAgLyogTXVsdGkgdXNzZ2Ugc2NyYXRjaCAqLwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwSW5wdXRTYXZlOyAgICAgICAgICAgICAgLyogUmV2ZXJiIGJsb2NrIGlucHV0IHNhdmUgZm9yIGRyeS93ZXQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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gICAgICAgICAvKiBNaXhlciBmb3IgUG9wIGFuZCBDbGljayBTdXByZXNzaW9uIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdXNlZCBieSBmZWVkYmFjayBHYWluICovCisgICAgTWl4XzFTdF9DbGxfRkxPQVRfdCBGZWVkYmFja01peGVyW0xWUkVWX0RFTEFZTElORVNfNF07IC8qIE1peGVyIGZvciBQb3AgYW5kIENsaWNrIFN1cHByZXNzaW9uIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdXNlZCBieSBmZWVkYmFjayBHYWluICovCiAKICAgICAvKiBBbGwtUGFzcyBGaWx0ZXIgKi8KLSAgICBMVk1fSU5UMzIgICAgICAgICAgICAgICBUWzRdOyAgICAgICAgICAgICAgICAgICAgIC8qIE1heGltdW0gZGVsYXkgc2l6ZSBvZiBidWZmZXIgKi8KLSAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcERlbGF5X1RbNF07ICAgICAgICAgICAgIC8qIFBvaW50ZXIgdG8gZGVsYXkgYnVmZmVycyAqLwotICAgIExWTV9JTlQzMiAgICAgICAgICAgICAgIERlbGF5X0FQWzRdOyAgICAgICAgICAgICAgLyogT2Zmc2V0IHRvIEFQIGRlbGF5IGJ1ZmZlciBzdGFydCAqLwotICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIEFCX1NlbGVjdGlvbjsgICAgICAgICAgICAgLyogU21vb3RoIGZyb20gdGFwIEEgdG8gQiB3aGVuIDEgXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3RoZXJ3aXNlIEIgdG8gQSAqLwotICAgIExWTV9JTlQzMiAgICAgICAgICAgICAgIEFfRGVsYXlTaXplWzRdOyAgICAgICAgICAgLyogQSBkZWxheSBsZW5ndGggaW4gc2FtcGxlcyAqLwotICAgIExWTV9JTlQzMiAgICAgICAgICAgICAgIEJfRGVsYXlTaXplWzRdOyAgICAgICAgICAgLyogQiBkZWxheSBsZW5ndGggaW4gc2FtcGxlcyAqLwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwT2Zmc2V0QVs0XTsgICAgICAgICAgICAgLyogT2Zmc2V0IGZvciB0aGUgQSBkZWxheSB0YXAgKi8KLSAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAqcE9mZnNldEJbNF07ICAgICAgICAgICAgIC8qIE9mZnNldCBmb3IgdGhlIEIgZGVsYXkgdGFwICovCi0gICAgTWl4XzJTdF9DbGxfRkxPQVRfdCAgICAgTWl4ZXJfQVBUYXBzWzRdOyAgICAgICAgICAvKiBTbW9vdGhlZCBBUCBkZWxheSBtaXhlciAqLwotICAgIE1peF8xU3RfQ2xsX0ZMT0FUX3QgICAgIE1peGVyX1NHRmVlZGJhY2tbNF07ICAgICAgLyogU21vb3RoZWQgU0FmZWVkYmFjayBnYWluICovCi0gICAgTWl4XzFTdF9DbGxfRkxPQVRfdCAgICAgTWl4ZXJfU0dGZWVkZm9yd2FyZFs0XTsgICAvKiBTbW9vdGhlZCBBUCBmZWVkZm9yd2FyZCBnYWluICovCisgICAgTFZNX0lOVDMyIFRbTFZSRVZfREVMQVlMSU5FU180XTsgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE1heGltdW0gZGVsYXkgc2l6ZSBvZiBidWZmZXIgKi8KKyAgICBMVk1fRkxPQVQqIHBEZWxheV9UW0xWUkVWX0RFTEFZTElORVNfNF07ICAgICAgICAgICAgICAgICAgLyogUG9pbnRlciB0byBkZWxheSBidWZmZXJzICovCisgICAgTFZNX0lOVDMyIERlbGF5X0FQW0xWUkVWX0RFTEFZTElORVNfNF07ICAgICAgICAgICAgICAgICAgIC8qIE9mZnNldCB0byBBUCBkZWxheSBidWZmZXIgc3RhcnQgKi8KKyAgICBMVk1fSU5UMTYgQUJfU2VsZWN0aW9uOyAgICAgICAgICAgICAgICAgICAgIC8qIFNtb290a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01peGVyOyAgICAgICAgICAgICAgLyogRHJ5L3dldCBtaXhlciAqLwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgIEdhaW47ICAgICAgICAgICAgICAgICAgICAgLyogR2FpbiBhcHBsaWVkIHRvIG91dHB1dCB0byBtYWludGFpbgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXZlcmFnZSBzaWduYWwgcG93ZXIgKi8KLSAgICBNaXhfMVN0X0NsbF9GTE9BVF90ICAgICBHYWluTWl4ZXI7ICAgICAgICAgICAgICAgIC8qIEdhaW4gc21vb3RoaW5nICovCisgICAgTWl4XzJTdF9DbGxfRkxPQVRfdCBCeXBhc3NNaXhlcjsgLyogRHJ5L3dldCBtaXhlciAqLworICAgIExWTV9GTE9BVCBHYWluOyAgICAgICAgICAgICAgICAgIC8qIEdhaW4gYXBwbGllZCB0byBvdXRwdXQgdG8gbWFpbnRhaW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmVyYWdlIHNpZ25hbCBwb3dlciAqLworICAgIE1peF8xU3RfQ2xsX0ZMT0FUX3QgR2Fpbk1peGVyOyAgIC8qIEdhaW4gc21vb3RoaW5nICovCiAKIH0gTFZSRVZfSW5zdGFuY2Vfc3Q7CiAKQEAgLTE3NywxNSArMTYzLDEyIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVlJFVl9SZXR1cm5TdGF0dXNfZW4gICBMVlJFVl9BcHBseU5ld1NldHRpbmdzKExWUkVWX0luc3RhbmNlX3N0ICAgICAqcFByaXZhdGUpOwotdm9pZCAgICAgICAgICAgICAgICAgICAgUmV2ZXJiQmxvY2soTFZNX0ZMT0FUICAgICAgICAgICAqcElucHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAqcE91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUkVWX0luc3RhbmNlX3N0ICAgKnBQcml2YXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiAgICAgICAgICBOdW1TYW1wbGVzKTsKLUxWTV9JTlQzMiAgICAgICAgICAgICAgIEJ5cGFzc01peGVyX0NhbGxiYWNrKHZvaWQgICAgICAgKnBDYWxsYmFja0RhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICpwR2VuZXJhbFB1cnBvc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgIEdlbmVyYWxQdXJwb3NlICk7CitMVlJFVl9SZXR1cm5TdGF0dXNfZW4gTFZSRVZfQXBwbHlOZXdTZXR0aW5ncyhMVlJFVl9JbnN0YW5jZV9zdCogcFByaXZhdGUpOwordm9pZCBSZXZlcmJCbG9jayhMVk1fRkxPQVQqIHBJbnB1dCwgTFZNX0ZMT0FUKiBwT3V0cHV0LCBMVlJFVl9JbnN0YW5jZV9zdCogcFByaXZhdGUsCisgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgTnVtU2FtcGxlcyk7CitMVk1fSU5UMzIgQnlwYXNzTWl4ZXJfQ2FsbGJhY2sodm9pZCogcENhbGxiYWNrRGF0YSwgdm9pZCogcEdlbmVyYWxQdXJwb3NlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiBHZW5lcmFsUHVycG9zZSk7CiAKLSNlbmRpZiAgLyoqIF9fTFZSRVZfUFJJVkFURV9IX18gKiovCisjZW5kaWYgLyoqIF9fTFZSRVZfUFJJVkFURV9IX18gKiovCiAKIC8qIEVuZCBvZiBmaWxlICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvUmV2ZXJiL3NyYy9MVlJFVl9Qcm9jZXNzLmNwcCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvc3JjL0xWUkVWX1Byb2Nlc3MuY3BwCmluZGV4IDM1ZjlhZDguLmY5YzMyNjYgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvc3JjL0xWUkVWX1Byb2Nlc3MuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvc3JjL0xWUkVWX1Byb2Nlc3MuY3BwCkBAIC00NSw0MyArNDUsMzcgQEAKIC8qICAxLiBUaGUgaW5wdXQgYW5kIG91dHB1dCBidWZmZXJzIG11c3QgYmUgMzItYml0IGFsaWduZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWUkVWX1JldHVyblN0YXR1c19lbiBMVlJFVl9Qcm9jZXNzKExWUkVWX0hhbmRsZV90ICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAqcEluRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgKnBPdXREYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX1VJTlQxNiAgICBOdW1TYW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JvckNvZGU7CiAgICAgICAgIH0KICAgICB9CkBAIC04OSwyNyArODMsMjMgQEAKICAgICAvKgogICAgICAqIFRyYXAgdGhlIGNhc2Ugd2hlcmUgdGhlIG51bWJlciBvZiBzYW1wbGVzIGlzIHplcm8uCiAgICAgICovCi0gICAgaWYgKE51bVNhbXBsZXMgPT0gMCkKLSAgICB7CisgICAgaWYgKE51bVNhbXBsZXMgPT0gMCkgewogICAgICAgICByZXR1cm4gTFZSRVZfU1VDQ0VTUzsKICAgICB9CiAKICAgICAvKgogICAgICAqIElmIE9GRiBjb3B5IGFuZCByZWZvcm1hdCB0aGUgZGF0YSBhcyBuZWNlc3NhcnkKICAgICAgKi8KLSAgICBpZiAocExWUkVWX1ByaXZhdGUtPkN1cnJlbnRQYXJhbXMuT3BlcmF0aW5nTW9kZSA9PSBMVk1fTU9ERV9PRkYpCi0gICAgewotICAgICAgICBpZihwSW5wdXQgIT0gcE91dHB1dCkKLSAgICAgICAgeworICAgIGlmIChwTFZSRVZfUHJpdmF0ZS0+Q3VycmVudFBhcmFtcy5PcGVyYXRpbmdNb2RlID09IExWTV9NT0RFX09GRikgeworICAgICAgICBpZiAocElucHV0ICE9IHBPdXRwdXQpIHsKICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgKiBDb3B5IHRoZSBkYXRhIHRvIHRoZSBvdXRwdXQgYnVmZmVyLCBjb252ZXJ0IHRvIHN0ZXJlbyBpcyByZXF1aXJlZAogICAgICAgICAgICAgICovCi0gICAgICAgICAgICBpZihwTFZSRVZfUHJpdmF0ZS0+Q3VycmVudFBhcmFtcy5Tb3VyY2VGb3JtYXQgPT0gTFZNX01PTk8peworICAgICAgICAgICAgaWYgKHBMVlJFVl9Qcml2YXRlLT5DdXJyZW50UGFyYW1zLlNvdXJjZUZvcm1hdCA9PSBMVk1fTU9OTykgewogICAgICAgICAgICAgICAgIE1vbm9UbzJJX0Zsb2F0KHBJbnB1dCwgcE91dHB1dCwgTnVtU2FtcGxlcyk7CiAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIENvcHlfRmxvYXQocElucHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgcE91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKE51bVNhbXBsZXMgPDwgMSkpOyAvLyAzMiBiaXQgZGF0YSwgc3RlcmVvCisgICAgICAgICAgICAgICAgQ29weV9GbG9hdChwSW5wdXQsIHBPdXRwdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShOdW1TYW1wbGVzIDw8IDEpKTsgIC8vIDMyIGJpdCBkYXRhLCBzdGVyZW8KICAgICAgICAgICAgIH0KICAgICAgICAgfQogCkBAIC0xMTgsMzEgKzEwOCwyNiBAQAogCiAgICAgUmVtYWluaW5nU2FtcGxlcyA9IChMVk1fSU5UMzIpTnVtU2FtcGxlczsKIAotICAgIGlmIChwTFZSRVZfUHJpdmF0ZS0+Q3VycmVudFBhcmFtcy5Tb3VyY2VGb3JtYXQgIT0gTFZNX01PTk8pCi0gICAgeworICAgIGlmIChwTFZSRVZfUHJpdmF0ZS0+Q3VycmVudFBhcmFtcy5Tb3VyY2VGb3JtYXQgIT0gTFZNX01PTk8pIHsKICAgICAgICAgZm9ybWF0ID0gMjsKICAgICB9CiAKLSAgICB3aGlsZSAoUmVtYWluaW5nU2FtcGxlcyE9MCkKLSAgICB7CisgICAgd2hpbGUgKFJlbWFpbmluZ1NhbXBsZXMgIT0gMCkgewogICAgICAgICAvKgogICAgICAgICAgKiBQcm9jZXNzIHRoZSBkYXRhCiAgICAgICAgICAqLwogCi0gICAgICAgIGlmKFJlbWFpbmluZ1NhbXBsZXMgPiAgcExWUkVWX1ByaXZhdGUtPk1heEJsa0xlbikKLSAgICAgICAgewotICAgICAgICAgICAgU2FtcGxlc1RvUHJvY2VzcyA9ICBwTFZSRVZfUHJpdmF0ZS0+TWF4QmxrTGVuOworICAgICAgICBpZiAoUmVtYWlua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bnB1dCBhbmQgb3V0cHV0IGJ1ZmZlcnMgbXVzdCBiZSAzMi1iaXQgYWxpZ25lZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBSZXZlcmJCbG9jayhMVk1fRkxPQVQgKnBJbnB1dCwgTFZNX0ZMT0FUICpwT3V0cHV0LAotICAgICAgICAgICAgICAgICBMVlJFVl9JbnN0YW5jZV9zdCAqcFByaXZhdGUsIExWTV9VSU5UMTYgTnVtU2FtcGxlcykKLXsKLSAgICBMVk1fSU5UMTYgICBqLCBzaXplOwotICAgIExWTV9GTE9BVCAgICpwRGVsYXlMaW5lOwotICAgIExWTV9GTE9BVCAgICpwRGVsYXlMaW5lSW5wdXQgPSBwUHJpdmF0ZS0+cFNjcmF0Y2g7Ci0gICAgTFZNX0ZMT0FUICAgKnBTY3JhdGNoID0gcFByaXZhdGUtPnBTY3JhdGNoOwotICAgIExWTV9GTE9BVCAgICpwSW47Ci0gICAgTFZNX0ZMT0FUICAgKnBUZW1wID0gcFByaXZhdGUtPnBJbnB1dFNhdmU7Ci0gICAgTFZNX0lOVDMyICAgTnVtYmVyT2ZEZWxheUxpbmVzOwordm9pZCBSZXZlcmJCbG9jayhMVk1fRkxPQVQqIHBJbnB1dCwgTFZNX0ZMT0FUKiBwT3V0cHV0LCBMVlJFVl9JbnN0YW5jZV9zdCogcFByaXZhdGUsCisgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgTnVtU2FtcGxlcykgeworICAgIExWTV9JTlQxNiBqLCBzaXplOworICAgIExWTV9GTE9BVCogcERlbGF5TGluZTsKKyAgICBMVk1fRkxPQVQqIHBEZWxheUxpbmVJbnB1dCA9IHBQcml2YXRlLT5wU2NyYXRjaDsKKyAgICBMVk1fRkxPQVQqIHBTY3JhdGNoID0gcFByaXZhdGUtPnBTY3JhdGNoOworICAgIExWTV9GTE9BVCogcEluOworICAgIExWTV9GTE9BVCogcFRlbXAgPSBwUHJpdmF0ZS0+cElucHV0U2F2ZTsKKyAgICBMVk1fSU5UMzIgTnVtYmVyT2ZEZWxheUxpbmVzOwogCiAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgICAqIEFsbCBjYWxjdWxhdGlvbnMgd2lsbCBnbyBpbnRvIHRoZSBidWZmZXIgcG9pbnRlZCB0byBieSBwVGVtcCwgdGhpcyB3aWxsICAgICoKQEAgLTE5Niw4NSArMTgwLDYxIEBACiAgICAgICogYW5kIHRoZSBmaW5hbCBvdXRwdXQgaXMgY29udmVydGVkIHRvIFNURVJFTyBhZnRlciB0aGUgbWl4ZXIgICAgICAgICAgICAgICAgKgogICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSAgICBpZihwUHJpdmF0ZS0+SW5zdGFuY2VQYXJhbXMuTnVtRGVsYXlzID09IExWUkVWX0RFTEFZTElORVNfNCkKLSAgICB7CisgICAgaWYgKHBQcml2YXRlLT5JbnN0YW5jZVBhcmFtcy5OdW1EZWxheXMgPT0gTFZSRVZfREVMQVlMSU5FU180KSB7CiAgICAgICAgIE51bWJlck9mRGVsYXlMaW5lcyA9IDQ7Ci0gICAgfQotICAgIGVsc2UgaWYocFByaXZhdGUtPkluc3RhbmNlUGFyYW1zLk51bURlbGF5cyA9PSBMVlJFVl9ERUxBWUxJTkVTXzIpCi0gICAgeworICAgIH0gZWxzZSBpZiAocFByaXZhdGUtPkluc3RhbmNlUGFyYW1zLk51bURlbGF5cyA9PSBMVlJFVl9ERUxBWUxJTkVTXzIpIHsKICAgICAgICAgTnVtYmVyT2ZEZWxheUxpbmVzID0gMjsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKKyAgICB9IGVsc2UgewogICAgICAgICBOdW1iZXJPZkRlbGF5TGluZXMgPSAxOwogICAgIH0KIAotICAgIGlmKHBQcml2YXRlLT5DdXJyZW50UGFyYW1zLlNvdXJjZUZvcm1hdCA9PSBMVk1fTU9OTykKLSAgICB7CisgICAgaWYgKHBQcml2YXRlLT5DdXJyZW50UGFyYW1zLlNvdXJjZUZvcm1hdCA9PSBMVk1fTU9OTykgewogICAgICAgICBwSW4gPSBwSW5wdXQ7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7CisgICAgfSBlbHNlIHsKICAgICAgICAgLyoKICAgICAgICAgICogIFN0ZXJlbyB0byBtb25vIGNvbnZlcnNpb24KICAgICAgICAgICovCiAKLSAgICAgICAgRnJvbTJpVG9Nb25vX0Zsb2F0KHBJbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUZW1wLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKKyAgICAgICAgRnJvbTJpVG9Nb25vX0Zsb2F0KHBJbnB1dCwgcFRlbXAsIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CiAgICAgICAgIHBJbiA9IHBUZW1wOwogICAgIH0KIAotICAgIE11bHQzc19GbG9hdChwSW4sCi0gICAgICAgICAgICAgICAgIChMVk1fRkxPQVQpTFZSRVZfSEVBRFJPT00sCi0gICAgICAgICAgICAgICAgIHBUZW1wLAotICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgIE11bHQzc19GbG9hdChwSW4sIChMVk1fRkxPQVQpTFZSRVZfSEVBRFJPT00sIHBUZW1wLCAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOwogCiAgICAgLyoKICAgICAgKiAgSGlnaCBwYXNzIGZpbHRlcgogICAgICAqLwotICAgIEZPXzFJX0QzMkYzMkMzMV9UUkNfV1JBXzAxKCZwUHJpdmF0ZS0+cEZhc3RDb2VmLT5IUENvZWZzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUZW1wLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUZW1wLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgcFByaXZhdGUtPnBSZXZIUEZCaXF1YWQtPnByb2Nlc3MocFRlbXAsIHBUZW1wLCBOdW1TYW1wbGVzKTsKKwogICAgIC8qCiAgICAgICogIExvdyBwYXNzIGZpbHRlcgogICAgICAqLwotICAgIEZPXzFJX0QzMkYzMkMzMV9UUkNfV1JBXzAxKCZwUHJpdmF0ZS0+cEZhc3RDb2VmLT5MUENvZWZzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUZW1wLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUZW1wLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgcFByaXZhdGUtPnBSZXZMUEZCaXF1YWQtPnByb2Nlc3MocFRlbXAsIHBUZW1wLCBOdW1TYW1wbGVzKTsKIAogICAgIC8qCiAgICAgICogIFByb2Nlc3MgYWxsIGRlbGF5IGxpbmVzCiAgICAgICovCiAKLSAgICBmb3IoaiA9IDA7IGogPCBOdW1iZXJPZkRlbGF5TGluZXM7IGorKykKLSAgICB7CisgICAgZm9yIChqID0gMDsgaiA8IE51bWJlck9mRGVsYXlMaW5lczsgaisrKSB7CiAgICAgICAgIHBEZWxheUxpbmUgPSBwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbal07CiAKICAgICAgICAgLyoKICAgICAgICAgICogQWxsLXBhc3MgZmlsdGVyIHdpdGggcG9wIGFuZCBjbGljayBzdXBwcmVzc2lvbgogICAgICAgICAgKi8KICAgICAgICAgLyogR2V0IHRoZSBzbW9vdGhlZCwgZGVsYXllZCBvdXRwdXQuIFB1dCBpdCBpbiB0aGUgb3V0cHV0IGJ1ZmZlciAqLwotICAgICAgICBNaXhTb2Z0XzJTdF9EMzJDMzFfU0FUKCZwUHJpdmF0ZS0+TWl4ZXJfQVBUYXBzW2pdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcml2YXRlLT5wT2Zmc2V0QVtqXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwUHJpdmF0ZS0+cE9mZnNldEJbal0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcERlbGF5TGluZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICBNaXhTb2Z0XzJTdF9EMzJDMzFfU0FUKCZwUHJpdmF0ZS0+TWl4ZXJfQVBUYXBzW2pdLCBwUHJpdmF0ZS0+cE9mZnNldEFbal0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByaXZhdGUtPnBPZmZzZXRCW2pdLCBwRGVsYXlMaW5lLCAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOwogICAgICAgICAvKiBSZS1hbGlnbiB0aGUgYWxsIHBhc3MgZmlsdGVyIGRlbGF5IGJ1ZmZlciBhbmQgY29weWluZyB0aGUgZml4ZWQgZGVsYXkgZGF0YSBcCiAgICAgICAgICAgIHRvIHRoZSBBUCBkZWxheSBpbiB0aGUgcHJvY2VzcyAqLwotICAgICAgICBDb3B5X0Zsb2F0KCZwUHJpdmF0ZS0+cERlbGF5X1Rbal1bTnVtU2FtcGxlc10sCi0gICAgICAgICAgICAgICAgICAgcFByaXZhdGUtPnBEZWxheV9UW2pdLAotICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKHBQcml2YXRlLT5UW2pdIC0gTnVtU2FtcGxlcykpOyAgICAgICAgIC8qIDMyLWJpdCBkYXRhICovCisgICAgICAgIENvcHlfRmxvYXQoJnBQcml2YXRlLT5wRGVsYXlfVFtqXVtOdW1TYW1wbGVzXSwgcFByaXZhdGUtPnBEZWxheV9UW2pdLAorICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKHBQcml2YXRlLT5UW2pdIC0gTnVtU2FtcGxlcykpOyAvKiAzMi1iaXQgZGF0YSAqLwogICAgICAgICAvKiBBcHBseSB0aGUgc21vb3RoZWQgZmVlZGJhY2sgYW5kIHNhdmUgdG8gZml4ZWQgZGVsYXkgaW5wdXQgKGN1cnJlbnRseSBlbXB0eSkgKi8KLSAgICAgICAgTWl4U29mdF8xU3RfRDMyQzMxX1dSQSgmcFByaXZhdGUtPk1peGVyX1NHRmVlZGJhY2tbal0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcERlbGF5TGluZSwKKyAgICAgICAgTWl4U29mdF8xU3RfRDMyQzMxX1dSQSgmcFByaXZhdGUtPk1peGVyX1NHRmVlZGJhY2tbal0sIHBEZWxheUxpbmUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBQcml2YXRlLT5wRGVsYXlfVFtqXVtwUHJpdmF0ZS0+VFtqXSAtIE51bVNhbXBsZXNdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CiAgICAgICAgIC8qIFN1bSBpbnRvIHRoZSBBUCBkZWxheSBsaW5lICovCiAgICAgICAgIE1hYzNzX1NhdF9GbG9hdCgmcFByaXZhdGUtPnBEZWxheV9UW2pdW3BQcml2YXRlLT5UW2pdIC0gTnVtU2FtcGxlc10sCi0gICAgICAgICAgICAgICAgICAgICAgICAtMS4wZiwgICAgLyogSW52ZXJ0IHNpbmNlIHRoZSBmZWVkYmFjayBjb2VmZmljaWVudCBpcyBuZWdhdGl2ZSAqLworICAgICAgICAgICAgICAgICAgICAgICAgLTEuMGYsIC8qIEludmVydCBzaW5jZSB0aGUgZmVlZGJhY2sgY29lZmZpY2llbnQgaXMgbmVnYXRpdmUgKi8KICAgICAgICAgICAgICAgICAgICAgICAgICZwUHJpdmF0ZS0+cERlbGF5X1Rbal1bcFByaXZhdGUtPkRlbGF5X0FQW2pdIC0gTnVtU2FtcGxlc10sCiAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOwogICAgICAgICAvKiBBcHBseSBzbW9vdGhlZCBmZWVkZm9yd2FyZCBzYW5kIHNhdmUgdG8gZml4ZWQgZGVsYXkgaW5wdXQgKGN1cnJlbnRseSBlbXB0eSkgKi8KQEAgLTI4Myw5ICsyNDMsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwUHJpdmF0ZS0+cERlbGF5X1Rbal1bcFByaXZhdGUtPlRbal0gLSBOdW1TYW1wbGVzXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOwogICAgICAgICAvKiBTdW0gaW50byB0aGUgQVAgb3V0cHV0ICovCi0gICAgICAgIE1hYzNzX1NhdF9GbG9hdCgmcFByaXZhdGUtPnBEZWxheV9UW2pdW3BQcml2YXRlLT5UW2pdIC0gTnVtU2FtcGxlc10sCi0gICAgICAgICAgICAgICAgICAgICAgICAxLjBmLAotICAgICAgICAgICAgICAgICAgICAgICAgcERlbGF5TGluZSwKKyAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KCZwUHJpdmF0ZS0+cERlbGF5X1Rbal1bcFByaXZhdGUtPlRbal0gLSBOdW1TYW1wbGVzXSwgMS4wZiwgcERlbGF5TGluZSwKICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CiAKICAgICAgICAgLyoKQEAgLTI5NiwzNCArMjU0LDI2IEBACiAgICAgICAgIC8qCiAgICAgICAgICAqICBMb3cgcGFzcyBmaWx0ZXIKICAgICAgICAgICovCi0gICAgICAgIEZPXzFJX0QzMkYzMkMzMV9UUkNfV1JBXzAxKCZwUHJpdmF0ZS0+cEZhc3RDb2VmLT5SZXZMUENvZWZzW2pdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwRGVsYXlMaW5lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwRGVsYXlMaW5lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICBwUHJpdmF0ZS0+cmV2TFBGQmlxdWFkW2pdLT5wcm9jZXNzKHBEZWxheUxpbmUsIHBEZWxheUxpbmUsIE51bVNhbXBsZXMpOwogICAgIH0KIAogICAgIC8qCiAgICAgICogIEFwcGx5IHJvdGF0aW9uIG1hdHJpeCBhbmQgZGVsYXkgc2FtcGxlcwogICAgICAqLwotICAgIGZvcihqID0gMDsgaiA8IE51bWJlck9mRGVsYXlMaW5lczsgaisrKQotICAgIHsKLQotICAgICAgICBDb3B5X0Zsb2F0KHBUZW1wLAotICAgICAgICAgICAgICAgICAgIHBEZWxheUxpbmVJbnB1dCwKLSAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShOdW1TYW1wbGVzKSk7CisgICAgZm9yIChqID0gMDsgaiA8IE51bWJlck9mRGVsYXlMaW5lczsgaisrKSB7CisgICAgICAgIENvcHlfRmxvYXQocFRlbXAsIHBEZWxheUxpbmVJbnB1dCwgKExWTV9JTlQxNikoTnVtU2FtcGxlcykpOwogICAgICAgICAvKgogICAgICAgICAgKiAgUm90YXRpb24gbWF0cml4IG1peAogICAgICAgICAgKi8KLSAgICAgICAgc3dpdGNoKGopCi0gICAgICAgIHsKKyAgICAgICAgc3dpdGNoIChqKSB7CiAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAgICAgKiAgQWRkIGRlbGF5IGxpbmUgMSBhbmQgMiBjb250cmlidXRpb24KICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVsxXSwgLTEuMGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwRGVsYXlMaW5lSW5wdXQsIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7Ci0gICAgICAgICAgICAgICAgIE1hYzNzX1NhdF9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMl0sIC0xLjBmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcERlbGF5TGluZUlucHV0LCAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICAgICAgICAgIE1hYzNzX1NhdF9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMV0sIC0xLjBmLCBwRGVsYXlMaW5lSW5wdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgICAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVsyXSwgLTEuMGYsIHBEZWxheUxpbmVJbnB1dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKIAogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSAyOgpAQCAtMzMxLDYxICsyODEsNTIgQEAKICAgICAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICAgICAqICBBZGQgZGVsYXkgbGluZSAwIGFuZCAzIGNvbnRyaWJ1dGlvbgogICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgICBNYWMzc19TYXRfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzBdLCAtMS4wZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBEZWxheUxpbmVJbnB1dCwgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKLSAgICAgICAgICAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVszXSwgLTEuMGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwRGVsYXlMaW5lSW5wdXQsIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgICAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVswXSwgLTEuMGYsIHBEZWxheUxpbmVJbnB1dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKKyAgICAgICAgICAgICAgICBNYWMzc19TYXRfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzNdLCAtMS4wZiwgcERlbGF5TGluZUlucHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOwogCiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIDE6Ci0gICAgICAgICAgICAgICAgaWYocFByaXZhdGUtPkluc3RhbmNlUGFyYW1zLk51bURlbGF5cyA9PSBMVlJFVl9ERUxBWUxJTkVTXzQpCi0gICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChwUHJpdmF0ZS0+SW5zdGFuY2VQYXJhbXMuTnVtRGVsYXlzID09IExWUkVWX0RFTEFZTElORVNfNCkgewogICAgICAgICAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICAgICAgICAgKiAgQWRkIGRlbGF5IGxpbmUgMCBhbmQgMyBjb250cmlidXRpb24KICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgIE1hYzNzX1NhdF9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMF0sIC0xLjBmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcERlbGF5TGluZUlucHV0LCAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICAgICAgICAgICAgICBNYWMzc19TYXRfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzBdLCAtMS4wZiwgcERlbGF5TGluZUlucHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKICAgICAgICAgICAgICAgICAgICAgQWRkMl9TYXRfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzNdLCBwRGVsYXlMaW5lSW5wdXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CiAKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICAgICAgICAgKiAgQWRkIGRlbGF5IGxpbmUgMCBhbmQgMSBjb250cmlidXRpb24KICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgICBNYWMzc19TYXRfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzBdLCAtMS4wZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwRGVsYXlMaW5lSW5wdXQsIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7Ci0gICAgICAgICAgICAgICAgICAgICBNYWMzc19TYXRfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzFdLCAtMS4wZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwRGVsYXlMaW5lSW5wdXQsIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7Ci0KKyAgICAgICAgICAgICAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVswXSwgLTEuMGYsIHBEZWxheUxpbmVJbnB1dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgICAgICAgICAgICAgIE1hYzNzX1NhdF9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMV0sIC0xLjBmLCBwRGVsYXlMaW5lSW5wdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgMDoKLSAgICAgICAgICAgICAgICBpZihwUHJpdmF0ZS0+SW5zdGFuY2VQYXJhbXMuTnVtRGVsYXlzID09IExWUkVWX0RFTEFZTElORVNfNCkKLSAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKHBQcml2YXRlLT5JbnN0YW5jZVBhcmFtcy5OdW1EZWxheXMgPT0gTFZSRVZfREVMQVlMSU5FU180KSB7CiAgICAgICAgICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgICAgICAgICAqICBBZGQgZGVsYXkgbGluZSAxIGFuZCAyIGNvbnRyaWJ1dGlvbgogICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVsxXSwgLTEuMGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwRGVsYXlMaW5lSW5wdXQsIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgICAgICAgICAgICAgIE1hYzNzX1NhdF9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMV0sIC0xLjBmLCBwRGVsYXlMaW5lSW5wdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOwogICAgICAgICAgICAgICAgICAgICBBZGQyX1NhdF9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMl0sIHBEZWxheUxpbmVJbnB1dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKIAotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlIGlmKHBQcml2YXRlLT5JbnN0YW5jZVBhcmFtcy5OdW1EZWxheXMgPT0gTFZSRVZfREVMQVlMSU5FU18yKQotICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHBQcml2YXRlLT5JbnN0YW5jZVBhcmFtcy5OdW1EZWxheXMgPT0gTFZSRVZfREVMQVlMSU5FU18yKSB7CiAgICAgICAgICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgICAgICAgICAqICBBZGQgZGVsYXkgbGluZSAwIGFuZCAxIGNvbnRyaWJ1dGlvbgogICAgICAgICAgICAgICAgICAgICAgKi8KICAgICAgICAgICAgICAgICAgICAgQWRkMl9TYXRfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzBdLCBwRGVsYXlMaW5lSW5wdXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7Ci0gICAgICAgICAgICAgICAgICAgIE1hYzNzX1NhdF9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMV0sIC0xLjBmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcERlbGF5TGluZUlucHV0LCAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICAgICAgICAgICAgICBNYWMzc19TYXRfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzFdLCAtMS4wZiwgcERlbGF5TGluZUlucHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKIAotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgICAgICAgICAqICBBZGQgZGVsYXkgbGluZSAwIGNvbnRyaWJ1dGlvbgogICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTQwMiw1NCArMzQzLDM3IEBACiAgICAgICAgIC8qCiAgICAgICAgICAqICBEZWxheSBzYW1wbGVzCiAgICAgICAgICAqLwotICAgICAgICBDb3B5X0Zsb2F0KHBEZWxheUxpbmVJbnB1dCwKLSAgICAgICAgICAgICAgICAgICAmcFByaXZhdGUtPnBEZWxheV9UW2pdW3BQcml2YXRlLT5UW2pdIC0gTnVtU2FtcGxlc10sCi0gICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoTnVtU2FtcGxlcykpOyAgICAgICAgICAgICAgLyogMzItYml0IGRhdGEgKi8KKyAgICAgICAgQ29weV9GbG9hdChwRGVsYXlMaW5lSW5wdXQsICZwUHJpdmF0ZS0+cERlbGF5X1Rbal1bcFByaXZhdGUtPlRbal0gLSBOdW1TYW1wbGVzXSwKKyAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShOdW1TYW1wbGVzKSk7IC8qIDMyLWJpdCBkYXRhICovCiAgICAgfQogCiAgICAgLyoKICAgICAgKiAgQ3JlYXRlIHN0ZXJlbyBvdXRwdXQKICAgICAgKi8KLSAgICBzd2l0Y2gocFByaXZhdGUtPkluc3RhbmNlUGFyYW1zLk51bURlbGF5cykKLSAgICB7CisgICAgc3dpdGNoIChwUHJpdmF0ZS0+SW5zdGFuY2VQYXJhbXMuTnVtRGVsYXlzKSB7CiAgICAgICAgIGNhc2UgTFZSRVZfREVMQVlMSU5FU180OgotICAgICAgICAgICAgIEFkZDJfU2F0X0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVszXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMF0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKLSAgICAgICAgICAgICBBZGQyX1NhdF9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMl0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzFdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgICAgICBBZGQyX1NhdF9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbM10sIHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVswXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgICAgICBBZGQyX1NhdF9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMl0sIHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVsxXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CiAKLSAgICAgICAgICAgIEpvaW5UbzJpX0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVswXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVsxXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUZW1wLAorICAgICAgICAgICAgSm9pblRvMmlfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzBdLCBwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMV0sIHBUZW1wLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKIAogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIGNhc2UgTFZSRVZfREVMQVlMSU5FU18yOgogCi0gICAgICAgICAgICAgQ29weV9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMV0sCi0gICAgICAgICAgICAgICAgICAgICAgICBwU2NyYXRjaCwKLSAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKE51bVNhbXBsZXMpKTsKKyAgICAgICAgICAgIENvcHlfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzFdLCBwU2NyYXRjaCwgKExWTV9JTlQxNikoTnVtU2FtcGxlcykpOwogCi0gICAgICAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVswXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMS4wZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwU2NyYXRjaCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICAgICAgTWFjM3NfU2F0X0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVswXSwgLTEuMGYsIHBTY3JhdGNoLCAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOwogCi0gICAgICAgICAgICAgQWRkMl9TYXRfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzFdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVswXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICAgICAgQWRkMl9TYXRfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzFdLCBwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMF0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOwogCi0gICAgICAgICAgICAgSm9pblRvMmlfRmxvYXQocFByaXZhdGUtPnBTY3JhdGNoRGVsYXlMaW5lWzBdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUZW1wLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgICAgICBKb2luVG8yaV9GbG9hdChwUHJpdmF0ZS0+cFNjcmF0Y2hEZWxheUxpbmVbMF0sIHBTY3JhdGNoLCBwVGVtcCwgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICBjYXNlIExWUkVWX0RFTEFZTElORVNfMToKLSAgICAgICAgICAgIE1vbm9UbzJJX0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVswXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUZW1wLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKKyAgICAgICAgICAgIE1vbm9UbzJJX0Zsb2F0KHBQcml2YXRlLT5wU2NyYXRjaERlbGF5TGluZVswXSwgcFRlbXAsIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgIGJyZWFrOwpAQCAtNDYwLDI1ICszODQsMTQgQEAKICAgICAgKi8KIAogICAgIHNpemUgPSAoTFZNX0lOVDE2KShOdW1TYW1wbGVzIDw8IDEpOwotICAgIE1peFNvZnRfMlN0X0QzMkMzMV9TQVQoJnBQcml2YXRlLT5CeXBhc3NNaXhlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBUZW1wLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgcFRlbXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0cHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZSk7CisgICAgTWl4U29mdF8yU3RfRDMyQzMxX1NBVCgmcFByaXZhdGUtPkJ5cGFzc01peGVyLCBwVGVtcCwgcFRlbXAsIHBPdXRwdXQsIHNpemUpOwogCiAgICAgLyogQXBwbHkgR2FpbiovCiAKLSAgICBTaGlmdF9TYXRfRmxvYXQoTFZSRVZfT1VUUFVUR0FJTl9TSElGVCwKLSAgICAgICAgICAgICAgICAgICAgcE91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgcE91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgc2l6ZSk7CisgICAgU2hpZnRfU2F0X0Zsb2F0KExWUkVWX09VVFBVVEdBSU5fU0hJRlQsIHBPdXRwdXQsIHBPdXRwdXQsIHNpemUpOwogCi0gICAgTWl4U29mdF8xU3RfRDMyQzMxX1dSQSgmcFByaXZhdGUtPkdhaW5NaXhlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXRwdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0cHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZSk7CisgICAgTWl4U29mdF8xU3RfRDMyQzMxX1dSQSgmcFByaXZhdGUtPkdhaW5NaXhlciwgcE91dHB1dCwgcE91dHB1dCwgc2l6ZSk7CiAKICAgICByZXR1cm47CiB9CiAvKiBFbmQgb2YgZmlsZSAqLwotCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvUmV2ZXJiL3NyYy9MVlJFVl9TZXRDb250cm9sUGFyYW1ldGVycy5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvUmV2ZXJiL3NyYy9MVlJFVl9TZXRDb250cm9sUGFyYW1ldGVycy5jcHAKaW5kZXggMmE3NTU1OS4uZTVhMGJjOCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1JldmVyYi9zcmMvTFZSRVZfU2V0Q29udHJvbFBhcmFtZXRlcnMuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9SZXZlcmIvc3JjL0xWUkVWX1NldENvbnRyb2xQYXJhbWV0ZXJzLmNwcApAQCAtNDIsODQgKzQyLDY3IEBACiAvKiAgMS4gIFRoaXMgZnVuY3Rpb24gbWF5IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVlJFVl9Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlJFVl9SZXR1cm5TdGF0dXNfZW4gTFZSRVZfU2V0Q29udHJvbFBhcmFtZXRlcnMoTFZSRVZfSGFuZGxlX3QgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9Db250cm9sUGFyYW1zX3N0ICAgKnBOZXdQYXJhbXMpCi17Ci0KLSAgICBMVlJFVl9JbnN0YW5jZV9zdCAgICAgKnBMVlJFVl9Qcml2YXRlID0gKExWUkVWX0luc3RhbmNlX3N0ICopaEluc3RhbmNlOworTFZSRVZfUmV0dXJuU3RhdHVzX2VuIExWUkVWX1NldENvbnRyb2xQYXJhbWV0ZXJzKExWUkVWX0hhbmRsZV90IGhJbnN0YW5jZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlJFVl9Db250cm9sUGFyYW1zX3N0KiBwTmV3UGFyYW1zKSB7CisgICAgTFZSRVZfSW5zdGFuY2Vfc3QqIHBMVlJFVl9Qcml2YXRlID0gKExWUkVWX0luc3RhbmNlX3N0KiloSW5zdGFuY2U7CiAKICAgICAvKgogICAgICAqIENoZWNrIGZvciBlcnJvciBjb25kaXRpb25zCiAgICAgICovCi0gICAgaWYoKGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkgfHwgKHBOZXdQYXJhbXMgPT0gTFZNX05VTEwpKQotICAgIHsKKyAgICBpZiAoKGhJbnN0YW5jZSA9PSBMVk1fTlVMTCkgfHwgKHBOZXdQYXJhbXMgPT0gTFZNX05VTEwpKSB7CiAgICAgICAgIHJldHVybiBMVlJFVl9OVUxMQUREUkVTUzsKICAgICB9CiAKICAgICAvKgogICAgICAqIENoZWNrIGFsbCBuZXcgY29udHJvbCBwYXJhbWV0ZXJzIGFyZSBpbiByYW5nZQogICAgICAqLwotICAgIGlmKCAgICAoKHBOZXdQYXJhbXMtPk9wZXJhdGluZ01vZGUgIT0gTFZNX01PREVfT0ZGKSAmJiAocE5ld1BhcmFtcy0+T3BlcmF0aW5nTW9kZSAhPSBMVk1fTU9ERV9PTikpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fAotICAgICAgICAoCi0gICAgICAgIChwTmV3UGFyYW1zLT5TYW1wbGVSYXRlICE9IExWTV9GU184MDAwKSAmJiAocE5ld1BhcmFtcy0+U2FtcGxlUmF0ZSAhPSBMVk1fRlNfMTEwMjUpICYmIChwTmV3UGFyYW1zLT5TYW1wbGVSYXRlICE9IExWTV9GU18xMjAwMCkgIC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AgaWYgKEZzSW5kZXggPiBMVk1fRlNfMTkyMDAwKSByZXR1cm4gMDsKIAogICAgIHJldHVybiAoTFZNX0ZzVGFibGVbRnNJbmRleF0pOwogfQpAQCAtNzMsMzAgKzY0LDE3NCBAQAogICAqLwogCiAvKiBOb3JtYWxpemluZyBvdXRwdXQgaW5jbHVkaW5nIFJldmVyYiBMZXZlbCBwYXJ0IChvbmx5IHNoaWZ0IHVwKSovCi1jb25zdCBMVk1fRkxPQVQgTFZSRVZfR2FpblBvbHlUYWJsZVsyNF1bNV09e3sxLDEuMDQ1OTA5Ziw3LjY4MTA5OGYsLTcuMjExNTAwZiwzLjAyNTYwNWYsfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgezIsMS4wODgxOTRmLDEwLjI5MTc0OWYsLTExLjUxMzc4N2YsNS4yNjU4MTdmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHszLDAuOTg4OTE5Ziw4LjI5OTk1NmYsLTguOTIwODYyZiwzLjk3OTgwNmYsfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgezQsMS4wMzU5MjdmLDEwLjE4MjU2N2YsLTEwLjM0NjEzNGYsNC41NDY1MzNmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs1LDEuMTMwMzEzZiwxMi41Mzg3MjdmLC0xMy42MjcwMjNmLDYuMTY1MjA4Zix9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7NiwxLjA2MDc0M2YsOC4wOTE3MTNmLC04LjU4ODA3OWYsMy44MzQyMzBmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs3LDEuMDQwMzgxZiwxMC40MDY1NjZmLC0xMS4xNzY2NTBmLDUuMDc1MTMyZix9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7OCwxLjAyNjk0NGYsOC4zODczMDJmLC04LjY4OTc5NmYsMy44OTU4NjNmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs5LDEuMDEzMzEyZiw5LjcyNzIzNmYsLTEwLjUzNDE2NWYsNC43NDIyNzJmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsxMCwwLjk5NjA5NWYsOC40OTIyNDlmLC03Ljk0NzY3N2YsMy40Nzg5MTdmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsxMywxLjA3OTM0NmYsOC44OTQ0MjVmLC05LjY0MTc2OGYsNC40MzQ0NDJmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsxNSwwLjk5NDMyN2YsNy40NDEzMzVmLC04LjAwMzk3OWYsMy41ODExNzdmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsxNywwLjk5MTA2N2YsNy4yMDgzNzNmLC03LjI1Nzg1OWYsMy4xNjc3NzRmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsyMCwxLjAzMzQ0NWYsNy40NzYzNzFmLC03LjU0Njk2MGYsMy4zNjk3MDNmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsyNSwwLjk4MjgzMGYsNS45MTM4NjdmLC01LjYzODQ0OGYsMi40MjA5MzJmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHszMCwwLjkyODc4MmYsNS4wMzUzNDNmLC00LjQ5MjEwNGYsMS44NDQ5MDRmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs0MCwwLjk1MzcxNGYsNS4wNjAyMzJmLC00LjQ3MjIwNGYsMS44Mjk2NDJmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs1MCwwLjg5OTI1OGYsNC4yNzMzNTdmLC0zLjUzNzQ5MmYsMS4zODc1NzZmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs2MCwwLjk0MzU4NGYsNC4wOTMyMjhmLC0zLjQ2OTY1OGYsMS40MTA5MTFmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs3MCwwLjkyNjAyMWYsMy45NzMxMjVmLC0zLjMzMTk4NWYsMS4zNDQ2OTBmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs3NSwwLjg5NDg1M2YsMi44NzE3NDdmLC0xLjQzODc1OGYsMC4zMTE4NTZmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs4MCwwLjkzNTEyMmYsMi45OTE4NTdmLC0yLjAzODg4MmYsMC42ODYzOTVmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs5MCwwLjk1Mzg3MmYsMi44ODAzMTVmLC0yLjEyMjM2NWYsMC43ODQwMzJmLH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsxMDAsMC45NTEwMDVmLDIuODk0Mjk0ZiwtMi4wMDkwODZmLDAuNjk4MzE2Zix9LAorY29uc3QgTFZNX0ZMT0FUIExWUkVWX0dhaW5Qb2x5VGFibGVbMjRdWzVdID0geworICAgICAgICB7CisgICAgICAgICAgICAgICAgMSwKKyAgICAgICAgICAgICAgICAxLjA0NTkwOWYsCisgICAgICAgICAgICAgICAgNy42ODEwOThmLAorICAgICAgICAgICAgICAgIC03LjIxMTUwMGYsCisgICAgICAgICAgICAgICAgMy4wMjU2MDVmLAorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAgICAgMiwKKyAgICAgICAgICAgICAgICAxLjA4ODE5NGYsCisgICAgICAgICAgICAgICAgMTAuMjkxNzQ5ZiwKKyAgICAgICAgICAgICAgICAtMTEuNTEzNzg3ZiwKKyAgICAgICAgICAgICAgICA1LjI2NTgxN2YsCisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICAzLAorICAgICAgICAgICAgICAgIDAuOTg4OTE5ZiwKKyAgICAgICAgICAgICAgICA4LjI5OTk1NmYsCisgICAgICAgICAgICAgICAgLTguOTIwODYyZiwKKyAgICAgICAgICAgICAgICAzLjk3OTgwNmYsCisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICA0LAorICAgICAgICAgICAgICAgIDEuMDM1OTI3ZiwKKyAgICAgICAgICAgICAgICAxMC4xODI1NjdmLAorICAgICAgICAgICAgICAgIC0xMC4zNDYxMzRmLAorICAgICAgICAgICAgICAgIDQuNTQ2NTMzZiwKKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgICAgICAgIDUsCisgICAgICAgICAgICAgICAgMS4xMzAzMTNmLAorICAgICAgICAgICAgICAgIDEyLjUzODcyN2YsCisgICAgICAgICAgICAgICAgLTEzLjYyNzAyM2YsCisgICAgICAgICAgICAgICAgNi4xNjUyMDhmLAorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAgICAgNiwKKyAgICAgICAgICAgICAgICAxLjA2MDc0M2YsCisgICAgICAgICAgICAgICAgOC4wOTE3MTNmLAorICAgICAgICAgICAgICAgIC04LjU4ODA3OWYsCisgICAgICAgICAgICAgICAgMy44MzQyMzBmLAorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAgICAgNywKKyAgICAgICAgICAgICAgICAxLjA0MDM4MWYsCisgICAgICAgICAgICAgICAgMTAuNDA2NTY2ZiwKKyAgICAgICAgICAgICAgICAtMTEuMTc2NjUwZiwKKyAgICAgICAgICAgICAgICA1LjA3NTEzMmYsCisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICA4LAorICAgICAgICAgICAgICAgIDEuMDI2OTQ0ZiwKKyAgICAgICAgICAgICAgICA4LjM4NzMwMmYsCisgICAgICAgICAgICAgICAgLTguNjg5Nzk2ZiwKKyAgICAgICAgICAgICAgICAzLjg5NTg2M2YsCisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICA5LAorICAgICAgICAgICAgICAgIDEuMDEzMzEyZiwKKyAgICAgICAgICAgICAgICA5LjcyNzIzNmYsCisgICAgICAgICAgICAgICAgLTEwLjUzNDE2NWYsCisgICAgICAgICAgICAgICAgNC43NDIyNzJmLAorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAgICAgMTAsCisgICAgICAgICAgICAgICAgMC45OTYwOTVmLAorICAgICAgICAgICAgICAgIDguNDkyMjQ5ZiwKKyAgICAgICAgICAgICAgICAtNy45NDc2NzdmLAorICAgICAgICAgICAgICAgIDMuNDc4OTE3ZiwKKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgICAgICAgIDEzLAorICAgICAgICAgICAgICAgIDEuMDc5MzQ2ZiwKKyAgICAgICAgICAgICAgICA4Ljg5NDQyNWYsCisgICAgICAgICAgICAgICAgLTkuNjQxNzY4ZiwKKyAgICAgICAgICAgICAgICA0LjQzNDQ0MmYsCisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICAxNSwKKyAgICAgICAgICAgICAgICAwLjk5NDMyN2YsCisgICAgICAgICAgICAgICAgNy40NDEzMzVmLAorICAgICAgICAgICAgICAgIC04LjAwMzk3OWYsCisgICAgICAgICAgICAgICAgMy41ODExNzdmLAorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAgICAgMTcsCisgICAgICAgICAgICAgICAgMC45OTEwNjdmLAorICAgICAgICAgICAgICAgIDcuMjA4MzczZiwKKyAgICAgICAgICAgICAgICAtNy4yNTc4NTlmLAorICAgICAgICAgICAgICAgIDMuMTY3Nzc0ZiwKKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgICAgICAgIDIwLAorICAgICAgICAgICAgICAgIDEuMDMzNDQ1ZiwKKyAgICAgICAgICAgICAgICA3LjQ3NjM3MWYsCisgICAgICAgICAgICAgICAgLTcuNTQ2OTYwZiwKKyAgICAgICAgICAgICAgICAzLjM2OTcwM2YsCisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICAyNSwKKyAgICAgICAgICAgICAgICAwLjk4MjgzMGYsCisgICAgICAgICAgICAgICAgNS45MTM4NjdmLAorICAgICAgICAgICAgICAgIC01LjYzODQ0OGYsCisgICAgICAgICAgICAgICAgMi40MjA5MzJmLAorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAgICAgMzAsCisgICAgICAgICAgICAgICAgMC45Mjg3ODJmLAorICAgICAgICAgICAgICAgIDUuMDM1MzQzZiwKKyAgICAgICAgICAgICAgICAtNC40OTIxMDRmLAorICAgICAgICAgICAgICAgIDEuODQ0OTA0ZiwKKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgICAgICAgIDQwLAorICAgICAgICAgICAgICAgIDAuOTUzNzE0ZiwKKyAgICAgICAgICAgICAgICA1LjA2MDIzMmYsCisgICAgICAgICAgICAgICAgLTQuNDcyMjA0ZiwKKyAgICAgICAgICAgICAgICAxLjgyOTY0MmYsCisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICA1MCwKKyAgICAgICAgICAgICAgICAwLjg5OTI1OGYsCisgICAgICAgICAgICAgICAgNC4yNzMzNTdmLAorICAgICAgICAgICAgICAgIC0zLjUzNzQ5MmYsCisgICAgICAgICAgICAgICAgMS4zODc1NzZmLAorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAgICAgNjAsCisgICAgICAgICAgICAgICAgMC45NDM1ODRmLAorICAgICAgICAgICAgICAgIDQuMDkzMjI4ZiwKKyAgICAgICAgICAgICAgICAtMy40Njk2NThmLAorICAgICAgICAgICAgICAgIDEuNDEwOTExZiwKKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgICAgICAgIDcwLAorICAgICAgICAgICAgICAgIDAuOTI2MDIxZiwKKyAgICAgICAgICAgICAgICAzLjk3MzEyNWYsCisgICAgICAgICAgICAgICAgLTMuMzMxOTg1ZiwKKyAgICAgICAgICAgICAgICAxLjM0NDY5MGYsCisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICA3NSwKKyAgICAgICAgICAgICAgICAwLjg5NDg1M2YsCisgICAgICAgICAgICAgICAgMi44NzE3NDdmLAorICAgICAgICAgICAgICAgIC0xLjQzODc1OGYsCisgICAgICAgICAgICAgICAgMC4zMTE4NTZmLAorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAgICAgODAsCisgICAgICAgICAgICAgICAgMC45MzUxMjJmLAorICAgICAgICAgICAgICAgIDIuOTkxODU3ZiwKKyAgICAgICAgICAgICAgICAtMi4wMzg4ODJmLAorICAgICAgICAgICAgICAgIDAuNjg2Mzk1ZiwKKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgICAgICAgIDkwLAorICAgICAgICAgICAgICAgIDAuOTUzODcyZiwKKyAgICAgICAgICAgICAgICAyLjg4MDMxNWYsCisgICAgICAgICAgICAgICAgLTIuMTIyMzY1ZiwKKyAgICAgICAgICAgICAgICAwLjc4NDAzMmYsCisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAgICAgICAxMDAsCisgICAgICAgICAgICAgICAgMC45NTEwMDVmLAorICAgICAgICAgICAgICAgIDIuODk0Mjk0ZiwKKyAgICAgICAgICAgICAgICAtMi4wMDkwODZmLAorICAgICAgICAgICAgICAgIDAuNjk4MzE2ZiwKKyAgICAgICAgfSwKIH07CiAvKiBFbmQgb2YgZmlsZSAqLwotCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIv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W107CiAKLSNlbmRpZiAgLyoqIF9MVlJFVl9UQUJMRVNfSF8gKiovCisjZW5kaWYgLyoqIF9MVlJFVl9UQUJMRVNfSF8gKiovCiAKIC8qIEVuZCBvZiBmaWxlICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3BlY3RydW1BbmFseXplci9saWIvTFZQU0EuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TcGVjdHJ1bUFuYWx5emVyL2xpYi9MVlBTQS5oCmluZGV4IGM5ZmE3YWQuLjg1ZTNhYjkgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TcGVjdHJ1bUFuYWx5emVyL2xpYi9MVlBTQS5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TcGVjdHJ1bUFuYWx5emVyL2xpYi9MVlBTQS5oCkBAIC0yMiwyNTUgKzIyLDE5MSBAQAogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIENPTlNUQU5UUyBERUZJTklUSU9OUyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0vKiBNZW1vcnkgdGFibGUqLwotI2RlZmluZSAgICAgTFZQU0FfTlJfTUVNT1JZX1JFR0lPTlMgICAgICAgICAgICAgICAgICA0ICAgICAgLyogTnVtYmVyIG9mIG1lbW9yeSByZWdpb25zICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICBUWVBFUyBERUZJTklUSU9OUyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qIE1lbW9yeSBUeXBlcyAqLwotdHlwZWRlZiBlbnVtCi17Ci0gICAgTFZQU0FfUEVSU0lTVEVOVCAgICAgID0gTFZNX1BFUlNJU1RFTlQsCi0gICAgTFZQU0FfUEVSU0lTVEVOVF9EQVRBID0gTFZNX1BFUlNJU1RFTlRfREFUQSwKLSAgICBMVlBTQV9QRVJTSVNURU5UX0NPRUYgPSBMVk1fUEVSU0lTVEVOVF9DT0VGLAotICAgIExWUFNBX1NDUkFUQ0ggICAgICAgICA9IExWTV9TQ1JBVENILAotICAgIExWUFNBX01FTU9SWV9EVU1NWSA9IExWTV9NQVhJTlRfMzIgICAgICAgICAgICAgICAgICAgICAgLyogRm9yY2UgMzIgYml0cyBlbnVtLCBkb24ndCB1c2UgaXQhICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLX0gTFZQU0FfTWVtb3J5VHlwZXNfZW47Ci0KIC8qIExldmVsIGRldGVjdGlvbiBzcGVlZCBjb250cm9sIHBhcmFtZXRlcnMgKi8KLXR5cGVkZWYgZW51bQotewotICAgIExWUFNBX1NQRUVEX0xPVywgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTG93IHNwZWVkIGxldmVsICAgZGV0ZWN0aW9uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBMVlBTQV9TUEVFRF9NRURJVU0sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE1lZGl1bSBzcGVlZCBsZXZlbCAgIGRldGVjdGlvbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgTFZQU0FfU1BFRURfSElHSCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBIaWdoIHNwZWVkIGxldmVsICAgZGV0ZWN0aW9uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIExWUFNBX1NQRUVEX0RVTU1ZID0gTFZNX01BWElOVF8zMiAgICAgICAgICAgICAgICAgICAgICAgLyogRm9yY2UgMzIgYml0cyBlbnVtLCBkb24ndCB1c2UgaXQhICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KK3R5cGVkZWYgZW51bSB7CisgICAgTFZQU0FfU1BFRURfTE9XLCAgICAvKiBMb3cgc3BlZWQgbGV2ZWwgICBkZXRlY3Rpb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIExWUFNBX1NQRUVEX01FRElVTSwgLyogTWVkaXVtIHNwZWVkIGxldmVsICAgZGV0ZWN0aW9uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICBMVlBTQV9TUEVFRF9ISUdILCAgIC8qIEhpZ2ggc3BlZWQgbGV2ZWwgICBkZXRlY3Rpb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgTFZQU0FfU1BFRURfRFVNTVkgPSBMVk1fTUFYSU5UXzMyIC8qIEZvcmNlIDMyIGJpdHMgZW51bSwgZG9uJ3QgdXNlIGl0ISAqLwogfSBMVlBTQV9MZXZlbERldGVjdFNwZWVkX2VuOwogCiAvKiBGaWx0ZXIgY29udHJvbCBwYXJhbWV0ZXJzICovCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgIENlbnRlckZyZXF1ZW5jeTsgICAgICAgICAgICAgLyogQ2VudGVyIGZyZXF1ZW5jeSBvZiB0aGUgYmFuZC1wYXNzIGZpbHRlciAoaW4gSHopICAgICAgICAgICAgICAgICAgKi8KLSAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICBRRmFjdG9yOyAgICAgICAgICAgICAgICAgICAgIC8qIFF1YWxpdHkgZmFjdG9yIG9mIHRoZSBmaWx0ZXIgICAgICAgICAgICAgKGluIDEvMTAwKSAgICAgICAgICAgICAgICovCi0gICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgUG9zdEdhaW47ICAgICAgICAgICAgICAgICAgICAvKiBQb3N0Z2FpbiB0byBhcHBseSBhZnRlciB0aGUgZmlsdGVyaW5nICAgIChpbiBkQiBRMTYuMCkgICAgICAgICAgICAqLwordHlwZWRlZiBzdHJ1Y3QgeworICAgIExWTV9VSU5UMTYgQ2VudGVyRnJlcXVlbmN5OyAvKiBDZW50ZXIgZnJlcXVlbmN5IG9mIHRoZSBiYW5kLXBhc3MgZmlsdGVyIChpbiBIeikgKi8KKyAgICBMVk1fVUlOVDE2IFFGYWN0b3I7IC8qIFF1YWxpdHkgZmFjdG9yIG9mIHRoZSBmaWx0ZXIgICAgICAgICAgICAgKGluIDEvMTAwKSAgICAgICAgICAgICAgICovCisgICAgTFZNX0lOVDE2IFBvc3RHYWluOyAvKiBQb3N0Z2FpbiB0byBhcHBseSBhZnRlciB0aGUgZmlsdGVyaW5nICAgIChpbiBkQiBRMTYuMCkgICAgICAgICAgICAqLwogCiB9IExWUFNBX0ZpbHRlclBhcmFtX3Q7CiAKIC8qIExWUFNBIGluaXRpYWxpemF0aW9uIHBhcmFtZXRlcnMgKi8KLXR5cGVkZWYgc3RydWN0Ci17Ci0gICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgICAgU3BlY3RyYWxEYXRhQnVmZmVyRHVyYXRpb247ICAvKiBTcGVjdHJhbCBkYXRhIGJ1ZmZlciBkdXJhdGlvbiBpbiB0aW1lIChtcyBpbiBRMTYuMCkgICAgICAgICAgICAgICAqLwotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgIE1heElucHV0QmxvY2tTaXplOyAgICAgICAgICAgLyogTWF4aW11bSBleHBlY3RlZCBpbnB1dCBibG9jayBzaXplIChpbiBzYW1wbGVzKSAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICBuQmFuZHM7ICAgICAgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBiYW5kcyBvZiB0aGUgU0EgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgTFZQU0FfRmlsdGVyUGFyYW1fdCAgICAgICAqcEZpbHRlcnNQYXJhbXM7ICAgICAgICAgICAgICAvKiBQb2ludHMgdG8gbkJhbmRzIGZpbHRlciBwYXJhbSBzdHJ1Y3R1cmVzIGZvciBmaWx0ZXJzIHNldHRpbmdzICAgICAqLwordHlwZWRlZiBzdHJ1Y3QgeworICAgIExWTV9VSU5UMTYKKyAgICAgICAgICAgIFNwZWN0cmFsRGF0YUJ1ZmZlckR1cmF0aW9uOyAvKiBTcGVjdHJhbCBkYXRhIGJ1ZmZlciBkdXJhdGlvbiBpbiB0aW1lIChtcyBpbiBRMTYuMCkgKi8KKyAgICBMVk1fVUlOVDE2IE1heElucHV0QmxvY2tTaXplOyAgICAgICAvKiBNYXhpbXVtIGV4cGVjdGVkIGlucHV0IGJsb2NrIHNpemUgKGluIHNhbXBsZXMpICAgICAgICovCisgICAgTFZNX1VJTlQxNiBuQmFuZHM7IC8qIE51bWJlciBvZiBiYW5kcyBvZiB0aGUgU0EgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgTFZQU0FfRmlsdGVyUGFyYW1fdCoKKyAgICAgICAgICAgIHBGaWx0ZXJzUGFyYW1zOyAvKiBQb2ludHMgdG8gbkJhbmRzIGZpbHRlciBwYXJhbSBzdHJ1Y3R1cmVzIGZvciBmaWx0ZXJzIHNldHRpbmdzICAgICAqLwogCiB9IExWUFNBX0luaXRQYXJhbXNfdCwgKnBMVlBTQV9Jbml0UGFyYW1zX3Q7CiAKIC8qIExWUFNBIGNvbnRyb2wgcGFyYW1ldGVycyAqLwotdHlwZWRlZiBzdHJ1Y3QKLXsKLSAgICBMVk1fRnNfZW4gICAgICAgICAgICAgICAgICBGczsgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIElucHV0IHNhbXBsaW5nIHJhdGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgTFZQU0FfTGV2ZWxEZXRlY3RTcGVlZF9lbiAgTGV2ZWxEZXRlY3Rpb25TcGVlZDsgICAgICAgICAvKiBMZXZlbCBkZXRlY3Rpb24gc3BlZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwordHlwZWRlZiBzdHJ1Y3QgeworICAgIExWTV9Gc19lbiBGczsgLyogSW5wdXQgc2FtcGxpbmcgcmF0ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICBMVlBTQV9MZXZlbERldGVjdFNwZWVkX2VuIExldmVsRGV0ZWN0aW9uU3BlZWQ7IC8qIExldmVsIGRldGVjdGlvbiBzcGVlZCAqLwogCiB9IExWUFNBX0NvbnRyb2xQYXJhbXNfdCwgKnBMVlBTQV9Db250cm9sUGFyYW1zX3Q7CiAKLS8qIE1lbW9yeSByZWdpb24gZGVmaW5pdGlvbiAqLwotdHlwZWRlZiBzdHJ1Y3QKLXsKLSAgICBMVk1fVUlOVDMyICAgICAgICAgICAgICAgICBTaXplOyAgICAgICAgICAgICAgICAgICAgICAgIC8qIFJlZ2lvbiBzaXplIGluIGJ5dGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgTFZQU0FfTWVtb3J5VHlwZXNfZW4gICAgICAgVHlwZTsgICAgICAgICAgICAgICAgICAgICAgICAvKiBSZWdpb24gdHlwZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIHZvaWQgICAgICAgICAgICAgICAgICAgICAgICpwQmFzZUFkZHJlc3M7ICAgICAgICAgICAgICAgLyogUG9pbnRlciB0byB0aGUgcmVnaW9uIGJhc2UgYWRkcmVzcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLX0gTFZQU0FfTWVtb3J5UmVnaW9uX3Q7Ci0KLS8qIE1lbW9yeSB0YWJsZSBjb250YWluaW5nIHRoZSByZWdpb24gZGVmaW5pdGlvbnMgKi8KLXR5cGVkZWYgc3RydWN0Ci17Ci0gICAgTFZQU0FfTWVtb3J5UmVnaW9uX3QgICAgICAgUmVnaW9uW0xWUFNBX05SX01FTU9SWV9SRUdJT05TXTsvKiBPbmUgZGVmaW5pdGlvbiBmb3IgZWFjaCByZWdpb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotfSBMVlBTQV9NZW1UYWJfdDsKLQogLyogQXVkaW8gdGltZSB0eXBlICovCiB0eXBlZGVmIExWTV9JTlQzMiBMVlBTQV9UaW1lOwogCiAvKiBNb2R1bGUgaW5zdGFuY2UgSGFuZGxlICovCi10eXBlZGVmIHZvaWQgKnBMVlBTQV9IYW5kbGVfdDsKK3R5cGVkZWYgdm9pZCogcExWUFNBX0hhbmRsZV90OwogCiAvKiBMVlBTQSByZXR1cm4gY29kZXMgKi8KLXR5cGVkZWYgZW51bQotewotICAgIExWUFNBX09LLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogVGhlIGZ1bmN0aW9uIHJhbiB3aXRob3V0IGFueSBwcm9ibGVtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBMVlBTQV9FUlJPUl9JTlZBTElEUEFSQU0sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEEgcGFyYW1ldGVyIGlzIGluY29ycmVjdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgTFZQU0FfRVJST1JfV1JPTkdUSU1FLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBBbiBpbmNvcnJlY3QgQXVkaW9UaW1lIGlzIHVzZWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIExWUFNBX0VSUk9SX05VTExBRERSRVNTLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogQSBwb2ludGVyIGhhcyBhIE5VTEwgdmFsdWUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBMVlBTQV9SRVRVUk5fRFVNTVkgPSBMVk1fTUFYSU5UXzMyICAgICAgICAgICAgICAgICAgICAgIC8qIEZvcmNlIDMyIGJpdHMgZW51bSwgZG9uJ3QgdXNlIGl0ISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCit0eXBlZGVmIGVudW0geworICAgIExWUFNBX09LLCAvKiBUaGUgZnVuY3Rpb24gcmFuIHdpdGhvdXQgYW55IHByb2JsZW0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIExWUFNBX0VSUk9SX0lOVkFMSURQQVJBTSwgLyogQSBwYXJhbWV0ZXIgaXMgaW5jb3JyZWN0ICovCisgICAgTFZQU0FfRVJST1JfV1JPTkdUSU1FLCAgIC8qIEFuIGluY29ycmVjdCBBdWRpb1RpbWUgaXMgdXNlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgTFZQU0FfRVJST1JfTlVMTEFERFJFU1MsIC8qIEEgcG9pbnRlciBoYXMgYSBOVUxMIHZhbHVlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgTFZQU0FfUkVUVVJOX0RVTU1ZID0gTFZNX01BWElOVF8zMiAvKiBGb3JjZSAzMiBiaXRzIGVudW0sIGRvbid0IHVzZSBpdCEgKi8KIH0gTFZQU0FfUkVUVVJOOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAgICBGVU5DVElPTlMgUFJPVE9UWVBFCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBGVU5DVElPTjogICAgICAgICAgICBMVlBTQV9NZW1vcnkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgZm9yIG1lbW9yeSBhbGxvY2F0aW9uIGFuZCBmcmVlLiBJdCBjYW4gYmUgY2FsbGVkIGluICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgdHdvIHdheXM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgaEluc3RhbmNlID0gTlVMTCAgICAgICAgICAgICAgICBSZXR1cm5zIHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgIGhJbnN0YW5jZSA9IEluc3RhbmNlIGhhbmRsZSAgICAgUmV0dXJucyB0aGUgbWVtb3J5IHJlcXVpcmVtZW50cyBhbmQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbG9jYXRlZCBiYXNlIGFkZHJlc3NlcyBmb3IgdGhlIGluc3RhbmNlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgV2hlbiB0aGlzIGZ1bmN0aW9uIGlzIGNhbGxlZCBmb3IgbWVtb3J5IGFsbG9jYXRpb24gKGhJbnN0YW5jZT1OVUxMKSB0aGUgbWVtb3J5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIGJhc2UgYWRkcmVzcyBwb2ludGVycyBhcmUgTlVMTCBvbiByZXR1cm4uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgV2hlbiB0aGUgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciBmcmVlIChoSW5zdGFuY2UgPSBJbnN0YW5jZSBIYW5kbGUpIHRoZSBtZW1vcnkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHRhYmxlIHJldHVybnMgdGhlIGFsbG9jYXRlZCBtZW1vcnkgYW5kIGJhc2UgYWRkcmVzc2VzIHVzZWQgZHVyaW5nIGluaXRpYWxpc2F0aW9uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIGhJbnN0YW5jZSAgICAgICAgICAgSW5zdGFuY2UgSGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwTWVtb3J5VGFibGUgICAgICAgIFBvaW50ZXIgdG8gYW4gZW1wdHkgbWVtb3J5IGRlZmluaXRpb24gdGFibGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcEluaXRQYXJhbXMgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBpbml0IHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZQU0FfT0sgICAgICAgICAgICBTdWNjZWVkcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIG90aGVyd2lzZSAgICAgICAgICAgRXJyb3IgZHVlIHRvIGJhZCBwYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZQU0FfUkVUVVJOIExWUFNBX01lbW9yeSAgICAgICAgICAgICggcExWUFNBX0hhbmRsZV90ICAgICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUFNBX01lbVRhYl90ICAgICAgICAgICAgICpwTWVtb3J5VGFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9Jbml0UGFyYW1zX3QgICAgICAgICAqcEluaXRQYXJhbXMgICAgKTsKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRlVOQ1RJT046ICAgICAgICAgICAgTFZQU0FfSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIENyZWF0ZSBhbmQgSW5pdGlhbGl6ZSB0aGUgTFZQU0EgbW9kdWxlIGluY2x1ZGluZyBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwaEluc3RhbmNlICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgSW5pdFBhcmFtcyAgICAgICAgICBJbml0IHBhcmFtZXRlcnMgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIENvbnRyb2xQYXJhbXMgICAgICAgQ29udHJvbCBwYXJhbWV0ZXJzIHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwU2NyYXRjaCAgICAgICAgICAgIFBvaW50ZXIgdG8gYnVuZGxlIHNjcmF0Y2ggbWVtb3J5IGFyZWEgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgTFZQU0FfT0sgICAgICAgICAgICBTdWNjZWVkcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIG90aGVyd2lzZSAgICAgICAgICAgRXJyb3IgZHVlIHRvIGJhZCBwYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworTFZQU0FfUkVUVVJOIExWUFNBX0luaXQocExWUFNBX0hhbmRsZV90KiBwaEluc3RhbmNlLCBMVlBTQV9Jbml0UGFyYW1zX3QqIHBJbml0UGFyYW1zLAorICAgICAgICAgICAgICAgICAgICAgICAgTFZQU0FfQ29udHJvbFBhcmFtc190KiBwQ29udHJvbFBhcmFtcywgdm9pZCogcFNjcmF0Y2gpOworCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIEZVTkNUSU9OOiAgICAgICAgICAgIExWUFNBX0RlSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgIEZyZWUgdGhlIG1lbW9yaWVzIGNyZWF0ZWQgaW4gTFZQU0FfSW5pdCBjYWxsIGluY2x1ZGluZyBpbnN0YW5jZSBoYW5kbGUgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwaEluc3RhbmNlICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3ZvaWQgTFZQU0FfRGVJbml0KHBMVlBTQV9IYW5kbGVfdCogcGhJbnN0YW5jZSk7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogRlVOQ1RJT046ICAgICAgICAgICAgTFZQU0FfSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIEZVTkNUSU9OOiAgICAgICAgICAgIExWUFNBX0NvbnRyb2wgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluaXRpYWxpemVzIHRoZSBMVlBTQSBtb2R1bGUuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERFU0NSSVBUSU9OOiAqLworLyogIENvbnRyb2xzIHRoZSBMVlBTQSBtb2R1bGUuICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUEFSQU1FVEVSUzogKi8KKy8qICBoSW5zdGFuY2UgICAgICAgICAgIEluc3RhbmNlIEhhbmRsZSAqLworLyogIHBOZXdQYXJhbXMgICAgICAgICAgUG9pbnRlciB0byB0aGUgaW5zdGFuY2UgbmV3IGNvbnRyb2wgcGFyYW1ldGVycyAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcGhJbnN0YW5jZSAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBIYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBJbml0UGFyYW1zICAgICAgICAgUG9pbnRlciB0byB0aGUgaW5zdGFuY2UgaW5pdCBwYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwQ29udHJvbFBhcmFtcyAgICAgIFBvaW50ZXIgdG8gdGhlIGluc3RhbmNlIGNvbnRyb2wgcGFyYW1ldGVycyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcE1lbW9yeVRhYmxlICAgICAgICBQb2ludGVyIHRvIHRoZSBtZW1vcnkgZGVmaW5pdGlvbiB0YWJsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIExWUFNBX09LICAgICAgICAgICAgU3VjY2VlZHMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBvdGhlcndpc2UgICAgICAgICAgIEVycm9yIGR1ZSB0byBiYWQgcGFyYW1ldGVycyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSRVRVUk5TOiAqLworLyogIExWUFNBX09LICAgICAgICAgICAgU3VjY2VlZHMgKi8KKy8qICBvdGhlcndpc2UgICAgICAgICAgIEVycm9yIGR1ZSB0byBiYWQgcGFyYW1ldGVycyAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlBTQV9SRVRVUk4gTFZQU0FfSW5pdCAgICAgICAgICAgICAgKCBwTFZQU0FfSGFuZGxlX3QgICAgICAgICAgICAgKnBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9Jbml0UGFyYW1zX3QgICAgICAgICAgKnBJbml0UGFyYW1zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZQU0FfQ29udHJvbFBhcmFtc190ICAgICAgICpwQ29udHJvbFBhcmFtcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUFNBX01lbVRhYl90ICAgICAgICAgICAgICAqcE1lbW9yeVRhYmxlICApOworTFZQU0FfUkVUVVJOIExWUFNBX0NvbnRyb2wocExWUFNBX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZQU0FfQ29udHJvbFBhcmFtc190KiBwTmV3UGFyYW1zKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBGVU5DVElPTjogICAgICAgICAgICBMVlBTQV9Db250cm9sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRlVOQ1RJT046ICAgICAgICAgICAgTFZQU0FfUHJvY2VzcyAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgQ29udHJvbHMgdGhlIExWUFNBIG1vZHVsZS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogREVTQ1JJUFRJT046ICovCisvKiAgVGhlIHByb2Nlc3MgY2FsY3VsYXRlcyB0aGUgbGV2ZWxzIG9mIHRoZSBmcmVxdWVuY3kgYmFuZHMuICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2UgICAgICAgICAgIEluc3RhbmNlIEhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcE5ld1BhcmFtcyAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBuZXcgY29udHJvbCBwYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUEFSQU1FVEVSUzogKi8KKy8qICBoSW5zdGFuY2UgICAgICAgICAgIEluc3RhbmNlIEhhbmRsZSAqLworLyogIHBMVlBTQV9JbnB1dFNhbXBsZXMgUG9pbnRlciB0byB0aGUgaW5wdXQgc2FtcGxlcyBidWZmZXIgKi8KKy8qICBJbnB1dEJsb2NrU2l6ZSAgICAgIE51bWJlciBvZiBtb25vIHNhbXBsZXMgdG8gcHJvY2VzcyAqLworLyogIEF1ZGlvVGltZSAgICAgICAgICAgUGxheWJhY2sgdGltZSBvZiB0aGUgZmlyc3QgaW5wdXQgc2FtcGxlICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBMVlBTQV9PSyAgICAgICAgICAgIFN1Y2NlZWRzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgb3RoZXJ3aXNlICAgICAgICAgICBFcnJvciBkdWUgdG8gYmFkIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFJFVFVSTlM6ICovCisvKiAgTFZQU0FfT0sgICAgICAgICAgICBTdWNjZWVkcyAqLworLyogIG90aGVyd2lzZSAgICAgICAgICAgRXJyb3IgZHVlIHRvIGJhZCBwYXJhbWV0ZXJzICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWUFNBX1JFVFVSTiBMVlBTQV9Db250cm9sICAgICAgICAgICAoIHBMVlBTQV9IYW5kbGVfdCAgICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9Db250cm9sUGFyYW1zX3QgICAgICAqcE5ld1BhcmFtcyAgICAgKTsKK0xWUFNBX1JFVFVSTiBMVlBTQV9Qcm9jZXNzKHBMVlBTQV9IYW5kbGVfdCBoSW5zdGFuY2UsIExWTV9GTE9BVCogcExWUFNBX0lucHV0U2FtcGxlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgSW5wdXRCbG9ja1NpemUsIExWUFNBX1RpbWUgQXVkaW9UaW1lKTsKKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRlVOQ1RJT046ICAgICAgICAgICAgTFZQU0FfR2V0U3BlY3RydW0gKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBERVNDUklQVElPTjogKi8KKy8qICBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgZm9yIG1lbW9yeSBhbGxvY2F0aW9uIGFuZCBmcmVlLiAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBQQVJBTUVURVJTOiAqLworLyogIGhJbnN0YW5jZSAgICAgICAgICAgIEluc3RhbmNlIEhhbmRsZSAqLworLyogIEdldFNwZWN0cnVtQXVkaW9UaW1lIFRpbWUgdG8gcmV0cmlldmUgdGhlIHZhbHVlcyBhdCAqLworLyogIHBDdXJyZW50VmFsdWVzICAgICAgIFBvaW50ZXIgdG8gYW4gZW1wdHkgYnVmZmVyIDogQ3VycmVudCBsZXZlbCB2YWx1ZXMgb3V0cHV0ICovCisvKiAgcFBlYWtWYWx1ZXMgICAgICAgICAgUG9pbnRlciB0byBhbiBlbXB0eSBidWZmZXIgOiBQZWFrIGxldmVsIHZhbHVlcyBvdXRwdXQgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUkVUVVJOUzogKi8KKy8qICBMVlBTQV9PSyAgICAgICAgICAgIFN1Y2NlZWRzICovCisvKiAgb3RoZXJ3aXNlICAgICAgICAgICBFcnJvciBkdWUgdG8gYmFkIHBhcmFtZXRlcnMgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworTFZQU0FfUkVUVVJOIExWUFNBX0dldFNwZWN0cnVtKHBMVlBTQV9IYW5kbGVfdCBoSW5zdGFuY2UsIExWUFNBX1RpbWUgR2V0U3BlY3RydW1BdWRpb1RpbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQ4KiBwQ3VycmVudFZhbHVlcywgTFZNX1VJTlQ4KiBwUGVha1ZhbHVlcyk7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogRlVOQ1RJT046ICAgICAgICAgICAgTFZQU0FfUHJvY2VzcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIEZVTkNUSU9OOiAgICAgICAgICAgIExWUFNBX0dldENvbnRyb2xQYXJhbXMgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFRoZSBwcm9jZXNzIGNhbGN1bGF0ZXMgdGhlIGxldmVscyBvZiB0aGUgZnJlcXVlbmN5IGJhbmRzLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERFU0NSSVBUSU9OOiAqLworLyogIEdldCB0aGUgY3VycmVudCBjb250cm9sIHBhcmFtZXRlcnMgb2YgdGhlIExWUFNBIG1vZHVsZS4gKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIGhJbnN0YW5jZSAgICAgICAgICAgSW5zdGFuY2UgSGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwTFZQU0FfSW5wdXRTYW1wbGVzIFBvaW50ZXIgdG8gdGhlIGlucHV0IHNhbXBsZXMgYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW5wdXRCbG9ja1NpemUgICAgICBOdW1iZXIgb2YgbW9ubyBzYW1wbGVzIHRvIHByb2Nlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEF1ZGlvVGltZSAgICAgICAgICAgUGxheWJhY2sgdGltZSBvZiB0aGUgZmlyc3QgaW5wdXQgc2FtcGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBMVlBTQV9PSyAgICAgICAgICAgIFN1Y2NlZWRzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgb3RoZXJ3aXNlICAgICAgICAgICBFcnJvciBkdWUgdG8gYmFkIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUEFSQU1FVEVSUzogKi8KKy8qICBoSW5zdGFuY2UgICAgICAgICAgIEluc3RhbmNlIEhhbmRsZSAqLworLyogIHBQYXJhbXMgICAgICAgICAgICAgUG9pbnRlciB0byBhbiBlbXB0eSBjb250cm9sIHBhcmFtZXRlcnMgc3RydWN0dXJlICovCisvKiBSRVRVUk5TOiAqLworLyogIExWUFNBX09LICAgICAgICAgICAgU3VjY2VlZHMgKi8KKy8qICBvdGhlcndpc2UgICAgICAgICAgIEVycm9yIGR1ZSB0byBiYWQgcGFyYW1ldGVycyAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlBTQV9SRVRVUk4gTFZQU0FfUHJvY2VzcyAgICAgICAgICAgKCBwTFZQU0FfSGFuZGxlX3QgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICpwTFZQU0FfSW5wdXRTYW1wbGVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiAgICAgICAgICAgSW5wdXRCbG9ja1NpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9UaW1lICAgICAgICAgICBBdWRpb1RpbWUgICAgICAgICAgICAgKTsKLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogRlVOQ1RJT046ICAgICAgICAgICAgTFZQU0FfR2V0U3BlY3RydW0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCBmb3IgbWVtb3J5IGFsbG9jYXRpb24gYW5kIGZyZWUuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2UgICAgICAgICAgICBJbnN0YW5jZSBIYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgR2V0U3BlY3RydW1BdWRpb1RpbWUgVGltZSB0byByZXRyaWV2ZSB0aGUgdmFsdWVzIGF0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBDdXJyZW50VmFsdWVzICAgICAgIFBvaW50ZXIgdG8gYW4gZW1wdHkgYnVmZmVyIDogQ3VycmVudCBsZXZlbCB2YWx1ZXMgb3V0cHV0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwUGVha1ZhbHVlcyAgICAgICAgICBQb2ludGVyIHRvIGFuIGVtcHR5IGJ1ZmZlciA6IFBlYWsgbGV2ZWwgdmFsdWVzIG91dHB1dCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZQU0FfT0sgICAgICAgICAgICBTdWNjZWVkcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIG90aGVyd2lzZSAgICAgICAgICAgRXJyb3IgZHVlIHRvIGJhZCBwYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZQU0FfUkVUVVJOIExWUFNBX0dldFNwZWN0cnVtICAgICAgICggcExWUFNBX0hhbmRsZV90ICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZQU0FfVGltZSAgICAgICAgICAgR2V0U3BlY3RydW1BdWRpb1RpbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDggICAgICAgICAgICpwQ3VycmVudFZhbHVlcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UOCAgICAgICAgICAgKnBQZWFrVmFsdWVzICAgICAgICAgICApOworTFZQU0FfUkVUVVJOIExWUFNBX0dldENvbnRyb2xQYXJhbXMocExWUFNBX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZQU0FfQ29udHJvbFBhcmFtc190KiBwUGFyYW1zKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBGVU5DVElPTjogICAgICAgICAgICBMVlBTQV9HZXRDb250cm9sUGFyYW1zICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogRlVOQ1RJT046ICAgICAgICAgICAgTFZQU0FfR2V0SW5pdFBhcmFtcyAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgR2V0IHRoZSBjdXJyZW50IGNvbnRyb2wgcGFyYW1ldGVycyBvZiB0aGUgTFZQU0EgbW9kdWxlLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogREVTQ1JJUFRJT046ICovCisvKiAgR2V0IHRoZSBpbml0aWFsaXphdGlvbiBwYXJhbWV0ZXJzIG9mIHRoZSBMVlBTQSBtb2R1bGUuICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2UgICAgICAgICAgIEluc3RhbmNlIEhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcFBhcmFtcyAgICAgICAgICAgICBQb2ludGVyIHRvIGFuIGVtcHR5IGNvbnRyb2wgcGFyYW1ldGVycyBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBMVlBTQV9PSyAgICAgICAgICAgIFN1Y2NlZWRzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgb3RoZXJ3aXNlICAgICAgICAgICBFcnJvciBkdWUgdG8gYmFkIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUEFSQU1FVEVSUzogKi8KKy8qICBoSW5zdGFuY2UgICAgICAgICAgIEluc3RhbmNlIEhhbmRsZSAqLworLyogIHBQYXJhbXMgICAgICAgICAgICAgUG9pbnRlciB0byBhbiBlbXB0eSBpbml0IHBhcmFtZXRlcnMgc3RydWN0dXJlICovCisvKiBSRVRVUk5TOiAqLworLyogIExWUFNBX09LICAgICAgICAgICAgU3VjY2VlZHMgKi8KKy8qICBvdGhlcndpc2UgICAgICAgICAgIEVycm9yIGR1ZSB0byBiYWQgcGFyYW1ldGVycyAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlBTQV9SRVRVUk4gTFZQU0FfR2V0Q29udHJvbFBhcmFtcyAgKCAgICBwTFZQU0FfSGFuZGxlX3QgICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9Db250cm9sUGFyYW1zX3QgICAgICpwUGFyYW1zICAgICAgKTsKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBGVU5DVElPTjogICAgICAgICAgICBMVlBTQV9HZXRJbml0UGFyYW1zICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgR2V0IHRoZSBpbml0aWFsaXphdGlvbiBwYXJhbWV0ZXJzIG9mIHRoZSBMVlBTQSBtb2R1bGUuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlICAgICAgICAgICBJbnN0YW5jZSBIYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBQYXJhbXMgICAgICAgICAgICAgUG9pbnRlciB0byBhbiBlbXB0eSBpbml0IHBhcmFtZXRlcnMgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZQU0FfT0sgICAgICAgICAgICBTdWNjZWVkcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIG90aGVyd2lzZSAgICAgICAgICAgRXJyb3IgZHVlIHRvIGJhZCBwYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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FNBX1NldFFQRkNvZWZmaWNpZW50cyhMVlBTQV9JbnN0YW5jZVByX3QqIHBJbnN0LCBMVlBTQV9Db250cm9sUGFyYW1zX3QqIHBQYXJhbXMpOwogCi1MVlBTQV9SRVRVUk4gTFZQU0FfQlBTaW5nbGVQcmVjQ29lZnMoICBMVk1fVUlOVDE2ICAgICAgICAgICAgIEZzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZQU0FfRmlsdGVyUGFyYW1fdCAgICpwRmlsdGVyUGFyYW1zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlBfRkxPQVRfQ29lZnNfdCAgICAgICAgKnBDb2VmZmljaWVudHMpOworTFZQU0FfUkVUVVJOIExWUFNBX0JQU2luZ2xlUHJlY0NvZWZzKExWTV9VSU5UMTYgRnMsIExWUFNBX0ZpbHRlclBhcmFtX3QqIHBGaWx0ZXJQYXJhbXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlBfRkxPQVRfQ29lZnNfdCogcENvZWZmaWNpZW50cyk7CiAKLUxWUFNBX1JFVFVSTiBMVlBTQV9CUERvdWJsZVByZWNDb2VmcyggIExWTV9VSU5UMTYgICAgICAgICAgICBGcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUFNBX0ZpbHRlclBhcmFtX3QgICpwRmlsdGVyUGFyYW1zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlBfRkxPQVRfQ29lZnNfdCAgICAgICAqcENvZWZmaWNpZW50cyk7Ci1MVlBTQV9SRVRVUk4gTFZQU0FfU2V0QlBGQ29lZmZpY2llbnRzKCBMVlBTQV9JbnN0YW5jZVByX3QgICAgICAgICpwSW5zdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUFNBX0NvbnRyb2xQYXJhbXNfdCAgICAgICpwUGFyYW1zICApOworTFZQU0FfUkVUVVJOIExWUFNBX0JQRG91YmxlUHJlY0NvZWZzKExWTV9VSU5UMTYgRnMsIExWUFNBX0ZpbHRlclBhcmFtX3QqIHBGaWx0ZXJQYXJhbXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlBfRkxPQVRfQ29lZnNfdCogcENvZWZmaWNpZW50cyk7CitMVlBTQV9SRVRVUk4gTFZQU0FfU2V0QlBGQ29lZmZpY2llbnRzKExWUFNBX0luc3RhbmNlUHJfdCogcEluc3QsIExWUFNBX0NvbnRyb2xQYXJhbXNfdCogcFBhcmFtcyk7CiAKLUxWUFNBX1JFVFVSTiBMVlBTQV9DbGVhckZpbHRlckhpc3RvcnkoIExWUFNBX0luc3RhbmNlUHJfdCAgICAgICAgKnBJbnN0KTsKK0xWUFNBX1JFVFVSTiBMVlBTQV9DbGVhckZpbHRlckhpc3RvcnkoTFZQU0FfSW5zdGFuY2VQcl90KiBwSW5zdCk7CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNTYsMjkgKzUyLDIzIEBACiAvKiAgb3RoZXJ3aXNlICAgICAgICAgICBFcnJvciBkdWUgdG8gYmFkIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlBTQV9SRVRVUk4gTFZQU0FfQ29udHJvbCAgICAgICAgICAgKCBwTFZQU0FfSGFuZGxlX3QgICAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZQU0FfQ29udHJvbFBhcmFtc190ICAgICAgKnBOZXdQYXJhbXMgICAgICkKLXsKK0xWUFNBX1JFVFVSTiBMVlBTQV9Db250cm9sKHBMVlBTQV9IYW5kbGVfdCBoSW5zdGFuY2UsIExWUFNBX0NvbnRyb2xQYXJhbXNfdCogcE5ld1BhcmFtcykgeworICAgIExWUFNBX0luc3RhbmNlUHJfdCogcExWUFNBX0luc3QgPSAoTFZQU0FfSW5zdGFuY2VQcl90KiloSW5zdGFuY2U7CiAKLSAgICBMVlBTQV9JbnN0YW5jZVByX3QgICAgICpwTFZQU0FfSW5zdCAgICA9IChMVlBTQV9JbnN0YW5jZVByX3QqKWhJbnN0YW5jZTsKLQotICAgIGlmKChoSW5zdGFuY2UgPT0gTFZNX05VTEwpIHx8IChwTmV3UGFyYW1zID09IExWTV9OVUxMKSkKLSAgICB7Ci0gICAgICAgIHJldHVybihMVlBTQV9FUlJPUl9OVUxMQUREUkVTUyk7CisgICAgaWYgKChoSW5zdGFuY2UgPT0gTFZNX05VTEwpIHx8IChwTmV3UGFyYW1zID09IExWTV9OVUxMKSkgeworICAgICAgICByZXR1cm4gKExWUFNBX0VSUk9SX05VTExBRERSRVNTKTsKICAgICB9Ci0gICAgaWYocE5ld1BhcmFtcy0+RnMgPj0gTFZQU0FfTlJfU1VQUE9SVEVEX1JBVEUpCi0gICAgewotICAgICAgICByZXR1cm4oTFZQU0FfRVJST1JfSU5WQUxJRFBBUkFNKTsKKyAgICBpZiAocE5ld1BhcmFtcy0+RnMgPj0gTFZQU0FfTlJfU1VQUE9SVEVEX1JBVEUpIHsKKyAgICAgICAgcmV0dXJuIChMVlBTQV9FUlJPUl9JTlZBTElEUEFSQU0pOwogICAgIH0KLSAgICBpZihwTmV3UGFyYW1zLT5MZXZlbERldGVjdGlvblNwZWVkID49IExWUFNBX05SX1NVUFBPUlRFRF9TUEVFRCkKLSAgICB7Ci0gICAgICAgIHJldHVybihMVlBTQV9FUlJPUl9JTlZBTElEUEFSQU0pOworICAgIGlmIChwTmV3UGFyYW1zLT5MZXZlbERldGVjdGlvblNwZWVkID49IExWUFNBX05SX1NVUFBPUlRFRF9TUEVFRCkgeworICAgICAgICByZXR1cm4gKExWUFNBX0VSUk9SX0lOVkFMSURQQVJBTSk7CiAgICAgfQogCiAgICAgcExWUFNBX0luc3QtPk5ld1BhcmFtcyA9ICpwTmV3UGFyYW1zOwogICAgIHBMVlBTQV9JbnN0LT5iQ29udHJvbFBlbmRpbmcgPSBMVk1fVFJVRTsKIAotICAgIHJldHVybihMVlBTQV9PSyk7CisgICAgcmV0dXJuIChMVlBTQV9PSyk7CiB9CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCkBAIC05NiwyMCArODYsMTcgQEAKIC8qICBvdGhlcndpc2UgICAgICAgICAgIEVycm9yIGR1ZSB0byBiYWQgcGFyYW1ldGVycyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWUFNBX1JFVFVSTiBMVlBTQV9HZXRDb250cm9sUGFyYW1zICAgICAgICAgKCAgICBwTFZQU0FfSGFuZGxlX3QgICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZQU0FfQ29udHJvbFBhcmFtc190ICAgICAqcFBhcmFtcyApCi17Ci0gICAgTFZQU0FfS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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTEyNywyMiArMTE0LDE5IEBACiAvKiAgb3RoZXJ3aXNlICAgICAgICAgICBFcnJvciBkdWUgdG8gYmFkIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlBTQV9SRVRVUk4gTFZQU0FfR2V0SW5pdFBhcmFtcyAgICAgICAgICggICAgcExWUFNBX0hhbmRsZV90ICAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUFNBX0luaXRQYXJhbXNfdCAgICAgICAgKnBQYXJhbXMgKQotewotICAgIExWUFNBX0luc3RhbmNlUHJfdCAgICAgKnBMVlBTQV9JbnN0ICAgID0gKExWUFNBX0luc3RhbmNlUHJfdCopaEluc3RhbmNlOworTFZQU0FfUkVUVVJOIExWUFNBX0dldEluaXRQYXJhbXMocExWUFNBX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZQU0FfSW5pdFBhcmFtc190KiBwUGFyYW1zKSB7CisgICAgTFZQU0FfSW5zdGFuY2VQcl90KiBwTFZQU0FfSW5zdCA9IChMVlBTQV9JbnN0YW5jZVByX3QqKWhJbnN0YW5jZTsKIAotICAgIGlmKChoSW5zdGFuY2UgPT0gTFZNX05VTEwpIHx8IChwUGFyYW1zID09IExWTV9OVUxMKSkKLSAgICB7Ci0gICAgICAgIHJldHVybihMVlBTQV9FUlJPUl9OVUxMQUREUkVTUyk7CisgICAgaWYgKChoSW5zdGFuY2UgPT0gTFZNX05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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlBTQV9SRVRVUk4gTFZQU0FfQXBwbHlOZXdTZXR0aW5ncyAoTFZQU0FfSW5zdGFuY2VQcl90ICAgICAqcEluc3QpCi17CitMVlBTQV9SRVRVUk4gTFZQU0FfQXBwbHlOZXdTZXR0aW5ncyhMVlBTQV9JbnN0YW5jZVByX3QqIHBJbnN0KSB7CiAgICAgTFZNX1VJTlQxNiBpaTsKICAgICBMVk1fVUlOVDE2IEZyZXE7Ci0gICAgTFZQU0FfQ29udHJvbFBhcmFtc190ICAgUGFyYW1zOwotICAgIGV4dGVybiBMVk1fSU5UMTYgICAgICAgIExWUFNBX25TYW1wbGVzQnVmZmVyVXBkYXRlW107Ci0gICAgZXh0ZXJuIExWTV9VSU5UMzIgICAgICAgTFZQU0FfU2FtcGxlUmF0ZVRhYltdOwotICAgIGV4dGVybiBMVk1fVUlOVDE2ICAgICAgIExWUFNBX0Rvd25TYW1wbGluZ0ZhY3RvcltdOworICAgIExWUFNBX0NvbnRyb2xQYXJhbXNfdCBQYXJhbXM7CisgICAgZXh0ZXJuIExWTV9JTlQxNiBMVlBTQV9uU2FtcGxlc0J1ZmZlclVwZGF0ZVtdOworICAgIGV4dGVybiBMVk1fVUlOVDMyIExWUFNBX1NhbXBsZVJhdGVUYWJbXTsKKyAgICBleHRlcm4gTFZNX1VJTlQxNiBMVlBTQV9Eb3duU2FtcGxpbmdGYWN0b3JbXTsKIAotICAgIGlmKHBJbnN0ID09IDApCi0gICAgewotICAgICAgICByZXR1cm4oTFZQU0FfRVJST1JfTlVMTEFERFJ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KLSAgICAgICAgZm9yKGlpID0gMDsgaWkgPCBwSW5zdC0+bkJhbmRzOyBpaSsrKQotICAgICAgICB7CisgICAgICAgIGZvciAoaWkgPSAwOyBpaSA8IHBJbnN0LT5uQmFuZHM7IGlpKyspIHsKICAgICAgICAgICAgIHBJbnN0LT5wUHJldmlvdXNQZWFrc1tpaV0gPSAwOwogICAgICAgICB9Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIGlmKFBhcmFtcy5MZXZlbERldGVjdGlvblNwZWVkICE9IHBJbnN0LT5DdXJyZW50UGFyYW1zLkxldmVsRGV0ZWN0aW9uU3BlZWQpCi0gICAgICAgIHsKKyAgICB9IGVsc2UgeworICAgICAgICBpZiAoUGFyYW1zLkxldmVsRGV0ZWN0aW9uU3BlZWQgIT0gcEluc3QtPkN1cnJlbnRQYXJhbXMuTGV2ZWxEZXRlY3Rpb25TcGVlZCkgewogICAgICAgICAgICAgTFZQU0FfU2V0UVBGQ29lZmZpY2llbnRzKHBJbnN0LCAmUGFyYW1zKTsKICAgICAgICAgfQogICAgIH0KQEAgLTI1Myw0NyArMjMzLDQzIEBACiAvKiAgICAgICAgICBTaW5nbGUgcHJlY2lzaW9uICAgIG90aGVyd2lzZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlBTQV9SRVRVUk4gTFZQU0FfU2V0QlBGaWx0ZXJzVHlwZSAoICAgTFZQU0FfSW5zdGFuY2VQcl90ICAgICAgICAqcEluc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZQU0FfQ29udHJvbFBhcmFtc190ICAgICAgKnBQYXJhbXMgICkKLXsKLSAgICBleHRlcm4gTFZNX1VJTlQzMiAgIExWUFNBX1NhbXBsZVJhdGVUYWJbXTsgICAgICAgICAgICAgICAgIC8qIFNhbXBsZSByYXRlIHRhYmxlICovCi0gICAgTFZNX1VJTlQxNiAgICAgICAgICBpaTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBGaWx0ZXIgYmFuZCBpbmRleCAqLwotICAgIExWTV9VSU5UMzIgICAgICAgICAgZnMgPSAoTFZNX1VJTlQzMilMVlBTQV9TYW1wbGVSYXRlVGFiWyhMVk1fVUlOVDE2KXBQYXJhbXMtPkZzXTsgICAgICAvKiBTYW1wbGUgcmF0ZSAqLwotICAgIExWTV9VSU5UMzIgICAgICAgICAgZmM7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRmlsdGVyIGNlbnRyZSBmcmVxdWVuY3kgKi8KLSAgICBMVk1fSU5UMTYgICAgICAgICAgIFFGYWN0b3I7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEZpbHRlciBRIGZhY3RvciAqLworTFZQU0FfUkVUVVJOIExWUFNBX1NldEJQRmlsdGVyc1R5cGUoTFZQU0FfSW5zdGFuY2VQcl90KiBwSW5zdCwgTFZQU0FfQ29udHJvbFBhcmFtc190KiBwUGFyYW1zKSB7CisgICAgZXh0ZXJuIExWTV9VSU5UMzIgTFZQU0FfU2FtcGxlUmF0ZVRhYltdOyAvKiBTYW1wbGUgcmF0ZSB0YWJsZSAqLworICAgIExWTV9VSU5UMTYgaWk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRmlsdGVyIGJhbmQgaW5kZXggKi8KKyAgICBMVk1fVUlOVDMyIGZzID0gKExWTV9VSU5UMzIpTFZQU0FfU2FtcGxlUmF0ZVRhYlsoTFZNX1VJTlQxNilw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1YWQgcmVxdWlyZWQKICAgICAgICAgICovCi0gICAgICAgIHBJbnN0LT5wQlBGaWx0ZXJzUHJlY2lzaW9uW2lpXSA9IExWUFNBX1NpbXBsZVByZWNpc2lvbkZpbHRlcjsgICAgIC8qIERlZmF1bHQgdG8gc2luZ2xlIHByZWNpc2lvbiAqLwotICAgICAgICBpZiAoKExPV19GUkVRICogZnMpID49IChmYyA8PCAxNSkpCi0gICAgICAgIHsKKyAgICAgICAgcEluc3QtPnBCUEZpbHRlcnNQcmVjaXNpb25baWldID0KKyAgICAgICAgICAgICAgICBMVlBTQV9TaW1wbGVQcmVjaXNpb25GaWx0ZXI7IC8qIERlZmF1bHQgdG8gc2luZ2xlIHByZWNpc2lvbiAqLworICAgICAgICBpZiAoKExPV19GUkVRICogZnMpID49IChmYyA8PCAxNSkpIHsKICAgICAgICAgICAgIC8qCiAgICAgICAgICAgICAgKiBmYyA8PSBmcy8xMTAKICAgICAgICAgICAgICAqLwogICAgICAgICAgICAgcEluc3QtPnBCUEZpbHRlcnNQcmVjaXNpb25baWldID0gTFZQU0FfRG91YmxlUHJlY2lzaW9uRmlsdGVyOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKCgoTE9XX0ZSRVEgKiBmcykgPCAoZmMgPDwgMTUpKSAmJiAoKGZjIDw8IDE1KSA8IChISUdIX0ZSRVEgKiBmcykpICYmIChRRmFjdG9yID4gMzAwKSkKLSAgICAgICAgICAgIHsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGlmICgoKExPV19GUkVRICogZnMpIDwgKGZjIDw8IDE1KSkgJiYgKChmYyA8PCAxNSkgPCAoSElHSF9GUkVRICogZnMpKSAmJgorICAgICAgICAgICAgICAgIChRRmFjdG9yID4gMzAwKSkgewogICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgKiAoZnMvMTEwIDwgZmMgPCBmcy84NSkgJiAoUT4zKQotICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICogKGZzLzExMCA8IGZjIDwgZnMvODUpICYgKFE+MykKKyAgICAgICAgICAgICAgICAgKi8KICAgICAgICAgICAgICAgICBwSW5zdC0+cEJQRmlsdGVyc1ByZWNpc2lvbltpaV0gPSBMVlBTQV9Eb3VibGVQcmVjaXNpb25GaWx0ZXI7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKLSAgICByZXR1cm4oTFZQU0FfT0spOworICAgIHJldHVybiAoTFZQU0FfT0spOwogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtMzE0LDYwICsyOTAsNTkgQEAKIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWUFNBX1JFVFVSTiBMVlBTQV9TZXRCUEZDb2VmZmljaWVudHMoICBMVlBTQV9JbnN0YW5jZVByX3QgICAgICAgICpwSW5zdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9Db250cm9sUGFyYW1zX3QgICAgICAqcFBhcmFtcykKLXsKLQotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgICAgICAgaWk7CitMVlBTQV9SRVRVUk4gTFZQU0FfU2V0QlBGQ29lZmZpY2llbnRzKExWUFNBX0luc3RhbmNlUHJfdCogcEluc3QsIExWUFNBX0NvbnRyb2xQYXJhbXNfdCogcFBhcmFtcykgeworICAgIExWTV9VSU5UMTYgaWk7CiAKICAgICAvKgogICAgICAqIFNldCB0aGUgY29lZmZpY2llbnRzIGZvciBlYWNoIGJhbmQgYnkgdGhlIGluaXQgZnVuY3Rpb24KICAgICAgKi8KLSAgICBmb3IgKGlpID0gMDsgaWkgPCBwSW5zdC0+blJlbGV2YW50RmlsdGVyczsgaWkrKykKLSAgICB7Ci0gICAgICAgIHN3aXRjaCAgKHBJbnN0LT5wQlBGaWx0ZXJzUHJlY2lzaW9uW2lpXSkKLSAgICAgICAgewotICAgICAgICAgICAgY2FzZSAgICBMVlBTQV9Eb3VibGVQcmVjaXNpb25GaWx0ZXI6Ci0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgQlBfRkxPQVRfQ29lZnNfdCAgICAgIENvZWZmaWNpZW50czsKKyAgICBmb3IgKGlpID0gMDsgaWkgPCBwSW5zdC0+blJlbGV2YW50RmlsdGVyczsgaWkrKykgeworICAgICAgICBzd2l0Y2ggKHBJbnN0LT5wQlBGaWx0ZXJzUHJlY2lzaW9uW2lpXSkgeworICAgICAgICAgICAgY2FzZSBMVlBTQV9Eb3VibGVQcmVjaXNpb25GaWx0ZXI6IHsKKyAgICAgICAgICAgICAgICBCUF9GTE9BVF9Db2Vmc190IENvZWZmaWNpZW50czsKICAgICAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICAgICAqIENhbGN1bGF0ZSB0aGUgZG91YmxlIHByZWNpc2lvbiBjb2VmZmljaWVudHMKICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBMVlBTQV9CUERvdWJsZVByZWNDb2VmcygoTFZNX1VJTlQxNilwUGFyYW1zLT5GcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcEluc3QtPnBGaWx0ZXJzUGFyYW1zW2lpXSwKKyAgICAgICAgICAgICAgICBMVlBTQV9CUERvdWJsZVByZWNDb2VmcygoTFZNX1VJTlQxNilwUGFyYW1zLT5GcywgJnBJbnN0LT5wRmlsdGVyc1BhcmFtc1tpaV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkNvZWZmaWNpZW50cyk7CiAgICAgICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAgICAgKiBTZXQgdGhlIGNvZWZmaWNpZW50cwogICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIEJQXzFJX0QxNkYzMkNsbF9UUkNfV1JBXzAxX0luaXQgKCAmcEluc3QtPnBCUF9JbnN0YW5jZXNbaWldLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcEluc3QtPnBCUF9UYXBzW2lpXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkNvZWZmaWNpZW50cyk7CisgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjphcnJheTxMVk1fRkxPQVQsIGFuZHJvaWQ6OmF1ZGlvX3V0aWxzOjprQmlxdWFkTnVtQ29lZnM+IGNvZWZzID0geworICAgICAgICAgICAgICAgICAgICAgICAgQ29lZmZpY2llbnRzLkEwLCAwLjAsIC0oQ29lZmZpY2llbnRzLkEwKSwgLShDb2VmZmljaWVudHMuQjEpLAorICAgICAgICAgICAgICAgICAgICAgICAgLShDb2VmZmljaWVudHMuQjIpfTsKKyAgICAgICAgICAgICAgICBwSW5zdC0+c3BlY0JpcXVhZFtpaV0KKyAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRDb2VmZmljaWVudHM8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6YXJyYXk8TFZNX0ZMT0FULCBhbmRyb2lkOjphdWRpb191dGlsczo6a0JpcXVhZE51bUNvZWZzPj4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZWZzKTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgY2FzZSAgICBMVlBTQV9TaW1wbGVQcmVjaXNpb25GaWx0ZXI6Ci0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgQlBfRkxPQVRfQ29lZnNfdCAgICAgIENvZWZmaWNpZW50czsKKyAgICAgICAgICAgIGNhc2UgTFZQU0FfU2ltcGxlUHJlY2lzaW9uRmlsdGVyOiB7CisgICAgICAgICAgICAgICAgQlBfRkxPQVRfQ29lZnNfdCBDb2VmZmljaWVudHM7CiAKICAgICAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICAgICAqIENhbGN1bGF0ZSB0aGUgc2luZ2xlIHByZWNpc2lvbiBjb2VmZmljaWVudHMKICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBMVlBTQV9CUFNpbmdsZVByZWNDb2VmcygoTFZNX1VJTlQxNilwUGFyYW1zLT5GcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcEluc3QtPnBGaWx0ZXJzUGFyYW1zW2lpXSwKKyAgICAgICAgICAgICAgICBMVlBTQV9CUFNpbmdsZVByZWNDb2VmcygoTFZNX1VJTlQxNilwUGFyYW1zLT5GcywgJnBJbnN0LT5wRmlsdGVyc1BhcmFtc1tpaV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkNvZWZmaWNpZW50cyk7CiAKICAgICAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICAgICAqIFNldCB0aGUgY29lZmZpY2llbnRzCiAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgQlBfMUlfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfSW5pdCAoJnBJbnN0LT5wQlBfSW5zdGFuY2VzW2lpXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBJbnN0LT5wQlBfVGFwc1tpaV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZDb2VmZmljaWVudHMpOworICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6YXJyYXk8TFZNX0ZMT0FULCBhbmRyb2lkOjphdWRpb191dGlsczo6a0JpcXVhZE51bUNvZWZzPiBjb2VmcyA9IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIENvZWZmaWNpZW50cy5BMCwgMC4wLCAtKENvZWZmaWNpZW50cy5BMCksIC0oQ29lZmZpY2llbnRzLkIxKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIC0oQ29lZmZpY2llbnRzLkIyKX07CisgICAgICAgICAgICAgICAgcEluc3QtPnNwZWNCaXF1YWRbaWldCisgICAgICAgICAgICAgICAgICAgICAgICAuc2V0Q29lZmZpY2llbnRzPAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OmFycmF5PExWTV9GTE9BVCwgYW5kcm9pZDo6YXVkaW9fdXRpbHM6OmtCaXF1YWROdW1Db2Vmcz4+KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2Vmcyk7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKLSAgICByZXR1cm4oTFZQU0FfT0spOworICAgIHJldHVybiAoTFZQU0FfT0spOwogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtMzg4LDI2ICszNjMsMjAgQEAKIC8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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c107CiAKLSAgICBmb3IgKGlpID0gMDsgaWkgPCBwSW5zdC0+blJlbGV2YW50RmlsdGVyczsgaWkrKykKLSAgICB7Ci0gICAgICAgIExWUFNBX1FQRF9Jbml0X0Zsb2F0ICgmcEluc3QtPnBRUERfU3RhdGVzW2lpXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwSW5zdC0+cFFQRF9UYXBzW2lpXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBDb2VmZmljaWVudHMgKTsKKyAgICBmb3IgKGlpID0gMDsgaWkgPCBwSW5zdC0+blJlbGV2YW50RmlsdGVyczsgaWkrKykgeworICAgICAgICBMVlBTQV9RUERfSW5pdF9GbG9hdCgmcEluc3QtPnBRUERfU3RhdGVzW2lpXSwgJnBJbnN0LT5wUVBEX1RhcHNbaWldLCBwQ29lZmZpY2llbnRzKTsKICAgICB9CiAKLSAgICByZXR1cm4oTFZQU0FfT0spOwotCisgICAgcmV0dXJuIChMVlBTQV9PSyk7CiB9CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtNDQzLDQ5ICs0MTIsNDYgQEAKIC8qICAgICBvZiB0aGUgbiBiYW5kcyBlcXVhbGl6ZXIgKExWRVFOQiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWUFNBX1JFVFVSTiBMVlBTQV9CUFNpbmdsZVByZWNDb2VmcyggICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgRnMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUFNBX0ZpbHRlclBhcmFtX3QgICAgICpwRmlsdGVyUGFyYW1zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCUF9GTE9BVF9Db2Vmc190ICAgICAgICAqcENvZWZmaWNpZW50cykKLXsKLQotICAgIGV4dGVybiBMVk1fRkxPQVQgICAgTFZQU0FfRmxvYXRfVHdvUGlPbkZzVGFibGVbXTsKLSAgICBleHRlcm4gTFZNX0ZMT0FUICAgIExWUFNBX0Zsb2F0X0Nvc0NvZWZbXTsKK0xWUFNBX1JFVFVSTiBMVlBTQV9CUFNpbmdsZVByZWNDb2VmcyhMVk1fVUlOVDE2IEZzLCBMVlBTQV9GaWx0ZXJQYXJhbV90KiBwRmlsdGVyUGFyYW1zLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJQX0ZMT0FUX0NvZWZzX3QqIHBDb2VmZmljaWVudHMpIHsKKyAgICBleHRlcm4gTFZNX0ZMT0FUIExWUFNBX0Zsb2F0X1R3b1BpT25Gc1RhYmxlW107CisgICAgZXh0ZXJuIExWTV9GTE9BVCBMVlBTQV9GbG9hdF9Db3NDb2VmW107CiAKICAgICAvKgogICAgICAqIEludGVybWVkaWF0ZSB2YXJpYWJsZXMgYW5kIHRlbXBvcmFyeSB2YWx1ZXMKICAgICAgKi8KLSAgICBMVk1fRkxPQVQgICAgICAgICAgIFQwOwotICAgIExWTV9GTE9BVCAgICAgICAgICAgRDsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgIEEwOwotICAgIExWTV9GTE9BVCAgICAgICAgICAgQjE7Ci0gICAgTFZNX0ZMT0FUICAgICAgICAgICBCMjsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgIER0MDsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgIEIyX0RlbjsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgIEIyX051bTsKLSAgICBMVk1f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DAgLSBRRmFjdG9yOwogICAgIEIyID0gQjJfTnVtIC8gKDIgKiBCMl9EZW4pOwpAQCAtNDk1LDIwICs0NjEsMTkgQEAKICAgICAgKgogICAgICAqICBDb3MgKz0gY29lZihuKSAqIHQwXm4gICAgICAgICAgICAgICAgICAgRm9yIG4gPSAwIHRvIDYKICAgICAgKi8KLSAgICBUMCA9IChUMCAvIDIwNDgpICogMC42MzY1ODU1OGY7ICAgICAgICAgICAgICAvKiBTY2FsZSB0byAxLjAgaW4gMTYtYml0IGZvciByYW5nZSAwIHRvIGZzLzIgKi8KLSAgICB0MCA9IFQwIDsKLSAgICBmYWN0b3IgPSAxLjBmOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBJbml0aWFsaXNlIHRvIDEuMCBmb3IgdGhlIGEwIGNvZWZmaWNpZW50ICovCi0gICAgQ09TX1QwID0gMC4wZjsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBJbml0aWFsaXNlIHRoZSBlcnJvciB0byB6ZXJvICovCi0gICAgZm9yIChpID0gMTsgaSA8IDc7IGkrKykKLSAgICB7Ci0gICAgICAgIGNvZWYgICAgPSBMVlBTQV9GbG9hdF9Db3NDb2VmW2ldOyAgICAgICAgICAgICAgICAvKiBHZXQgdGhlIG50aCBjb2VmZmljaWVudCAqLwotICAgICAgICBDT1NfVDAgKz0gKGZhY3RvciAqIGNvZWYpOyAgICAgICAgIC8qIFRoZSBudGggcGFydGlhbCBzdW0gKi8KLSAgICAgICAgZmFjdG9yICA9IChmYWN0b3IgKiB0MCkgOyAgICAgICAgICAgLyogQ2FsY3VsYXRlIHQwXm4gKi8KKyAgICBUMCA9IChUMCAvIDIwNDgpICogMC42MzY1ODU1OGY7IC8qIFNjYWxlIHRvIDEuMCBpbiAxNi1iaXQgZm9yIHJhbmdlIDAgdG8gZnMvMiAqLworICAgIHQwID0gVDA7CisgICAgZmFjdG9yID0gMS4wZjsgLyogSW5pdGlhbGlzZSB0byAxLjAgZm9yIHRoZSBhMCBjb2VmZmljaWVudCAqLworICAgIENPU19UMCA9IDAuMGY7IC8qIEluaXRpYWxpc2UgdGhlIGVycm9yIHRvIHplcm8gKi8KKyAgICBmb3IgKGkgPSAxOyBpIDwgNzsgaSsrKSB7CisgICAgICAgIGNvZWYgPSBMVlBTQV9GbG9hdF9Db3NDb2VmW2ldOyAvKiBHZXQgdGhlIG50aCBjb2VmZmljaWVudCAqLworICAgICAgICBDT1NfVDAgKz0gKGZhY3RvciAqIGNvZWYpOyAgICAgLyogVGhlIG50aCBwYXJ0aWFsIHN1bSAqLworICAgICAgICBmYWN0b3IgPSAoZmFjdG9yICogdDApOyAgICAgICAgLyogQ2FsY3VsYXRlIHQwXm4gKi8KICAgICB9Ci0gICAgQ09TX1QwID0gQ09TX1QwICogODsgICAgLypMVlBTQV9Db3NDb2VmX2Zsb2F0WzBdKi8gICAgICAvKiBDb3JyZWN0IHRoZSBzY2FsaW5nICovCisgICAgQ09TX1QwID0gQ09TX1QwICogODsgLypMVlBTQV9Db3NDb2VmX2Zsb2F0WzBdKi8gLyogQ29ycmVjdCB0aGUgc2NhbGluZyAqLwogCi0gICAgQjEgPSAoKExWTV9GTE9BVCkwLjUgLSBCMikgKiAoQ09TX1QwKTsgICAgLyogQjEgPSAoMC41IC0gYjIpICogY29zKHQwKSAqLwotICAgIEEwID0gKChMVk1fRkxPQVQpMC41ICsgQjIpIC8gMjsgICAgICAgICAgICAgICAgICAgICAgICAvKiBBMCA9ICgwLjUgKyBiMikgLyAyICovCisgICAgQjEgPSAoKExWTV9GTE9BVCkwLjUgLSBCMikgKiAoQ09TX1QwKTsgLyogQjEgPSAoMC41IC0gYjIpICogY29zKHQwKSAqLworICAgIEEwID0gKChMVk1fRkxPQVQpMC41ICsgQjIpIC8gMjsgICAgICAgIC8qIEEwID0gKDAuNSArIGIyKSAvIDIgKi8KIAogICAgIC8qCiAgICAgICogV3JpdGUgY29lZmYgaW50byB0aGUgZGF0YSBzdHJ1Y3R1cmUKQEAgLTUxNyw3ICs0ODIsNyBAQAogICAgIHBDb2VmZmljaWVudHMtPkIxID0gQjEgKiAyOwogICAgIHBDb2VmZmljaWVudHMtPkIyID0gQjIgKiAyOwogCi0gICAgcmV0dXJuKExWUFNBX09LKTsKKyAgICByZXR1cm4gKExWUFNBX09LKTsKIH0KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC01NjEsNDkgKzUyNiw0NiBAQAogLyogICAgIG9mIHRoZSBuIGJhbmRzIGVxdWFsaXplciAoTFZFUU5CICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZQU0FfUkVUVVJOIExWUFNBX0JQRG91YmxlUHJlY0NvZWZzKCAgIExWTV9VSU5UMTYgICAgICAgICAgICBGcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9GaWx0ZXJQYXJhbV90ICAgKnBGaWx0ZXJQYXJhbXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQlBfRkxPQVRfQ29lZnNfdCAgICAgICpwQ29lZmZpY2llbnRzKQotewotCi0gICAgZXh0ZXJuIExWTV9GTE9BVCAgICBMVlBTQV9GbG9hdF9Ud29QaU9uRnNUYWJsZVtdOwotICAgIGV4dGVybiBMVk1fRkxPQVQgICAgTFZQU0FfRmxvYXRfRFBDb3NDb2VmW107CitMVlBTQV9SRVRVUk4gTFZQU0FfQlBEb3VibGVQcmVjQ29lZnMoTFZNX1VJTlQxNiBGcywgTFZQU0FfRmlsdGVyUGFyYW1fdCogcEZpbHRlclBhcmFtcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCUF9GTE9BVF9Db2Vmc190KiBwQ29lZmZpY2llbnRzKSB7CisgICAgZXh0ZXJuIExWTV9GTE9BVCBMVlBTQV9GbG9hdF9Ud29QaU9uRnNUYWJsZVtdOworICAgIGV4dGVybiBMVk1fRkxPQVQgTFZQU0FfRmxvYXRfRFBDb3NDb2VmW107CiAKICAgICAvKgogICAgICAqIEludGVybWVkaWF0ZSB2YXJpYWJsZXMgYW5kIHRlbXBvcmFyeSB2YWx1ZXMKICAgICAgKi8KLSAgICBMVk1fRkxPQVQgICAgICAgICAgIFQwOwotICAgIExWTV9GTE9BVCAgICAgICAgICAgRDsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgIEEwOwotICAgIExWTV9GTE9BVCAgICAgICAgICAgQjE7Ci0gICAgTFZNX0ZMT0FUICAgICAgICAgICBCMjsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgIER0MDsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgIEIyX0RlbjsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgIEIyX051bTsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgIENvc0VycjsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgIGNvZWY7Ci0gICAgTFZNX0ZMT0FUICAgICAgICAgICBmYWN0b3I7Ci0gICAgTFZNX0ZMT0FUICAgICAgICAgICB0MDsKLSAgICBMVk1fSU5UMTYgICAgICAgICAgIGk7CisgICAgTFZNX0ZMT0FUIFQwOworICAgIExWTV9GTE9BVCBEOworICAgIExWTV9GTE9BVCBBMDsKKyAgICBMVk1fRkxPQVQgQjE7CisgICAgTFZNX0ZMT0FUIEIyO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tpbmcgZmlsdGVyLgotICAgICAgICAgICAgICAgICAgICBUaGUgRCBwYXJhbWV0ZXIgZG8gbm90IGV4aXN0IGZvciBhIEJhbmRQYXNzIGZpbHRlciBjb2VmZmljaWVudHMgKi8KKyAgICBUMCA9IEZyZXF1ZW5jeSAqIExWUFNBX0Zsb2F0X1R3b1BpT25Gc1RhYmxlW0ZzXTsgLyogVDAgPSAyICogUGkgKiBGYyAvIEZzICovCisgICAgRCA9IDMyMDA7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDEuMDAwMDAwICgxKjEwMCoyXjUpICovCisgICAgLyogRm9yY2UgRCA9IDEgOiB0aGUgZnVuY3Rpb24gd2FzIG9yaWdpbmFsbHkgdXNlZCBmb3IgYSBwZWFraW5nIGZpbHRlci4KKyAgICAgICBUaGUgRCBwYXJhbWV0ZXIgZG8gbm90IGV4aXN0IGZvciBhIEJhbmRQYXNzIGZpbHRlciBjb2VmZmljaWVudHMgKi8KIAogICAgIC8qCiAgICAgICogQ2FsY3VsYXRlIHRoZSBCMiBjb2VmZmljaWVudAogICAgICAqLwotICAgIER0MCA9ICBUMCAvIDIwNDggOworICAgIER0MCA9IFQwIC8gMjA0ODsKICAgICBCMl9EZW4gPSBRRmFjdG9yICsgRHQwOwogICAgIEIyX051bSA9IER0MCAtIFFGYWN0b3I7CiAgICAgQjIgPSBCMl9OdW0gLyAoMiAqIEIyX0Rlbik7CkBAIC02MTMsMjUgKzU3NSwyNCBAQAogICAgICAqCiAgICAgICogIENvc0VyciArPSBjb2VmKG4pICogdDBebiAgICAgICAgICAgICAgICBGb3IgbiA9IDAgdG8gNAogICAgICAqLwotICAgIFQwID0gVDAgKiAwLjk5NDc1MGY7ICAgICAgICAgICAgICAgICAgICAvKiBTY2FsZSB0byAxLjAgaW4gMTYtYml0IGZvciByYW5nZSAwIHRvIGZzLzUwICovCisgICAgVDAgPSBUMCAqIDAuOTk0NzUwZjsgLyogU2NhbGUgdG8gMS4wIGluIDE2LWJpdCBmb3IgcmFuZ2UgMCB0byBmcy81MCAqLwogICAgIHQwID0gVDA7Ci0gICAgZmFjdG9yID0gMS4wZjsgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSW5pdGlhbGlzZSB0byAxLjAgZm9yIHRoZSBhMCBjb2VmZmljaWVudCAqLwotICAgIENvc0VyciA9IDAuMGY7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSW5pdGlhbGlzZSB0aGUgZXJyb3IgdG8gemVybyAqLwotICAgIGZvciAoaSA9IDE7IGkgPCA1OyBpKyspCi0gICAgewotICAgICAgICBjb2VmID0gTFZQU0FfRmxvYXRfRFBDb3NDb2VmW2ldOyAgICAgICAgICAgICAgLyogR2V0IHRoZSBudGggY29lZmZpY2llbnQgKi8KKyAgICBmYWN0b3IgPSAxLjBmOyAvKiBJbml0aWFsaXNlIHRvIDEuMCBmb3IgdGhlIGEwIGNvZWZmaWNpZW50ICovCisgICAgQ29zRXJyID0gMC4wZjsgLyogSW5pdGlhbGlzZSB0aGUgZXJyb3IgdG8gemVybyAqLworICAgIGZvciAoaSA9IDE7IGkgPCA1OyBpKyspIHsKKyAgICAgICAgY29lZiA9IExWUFNBX0Zsb2F0X0RQQ29zQ29lZltpXTsgLyogR2V0IHRoZSBudGggY29lZmZpY2llbnQgKi8KICAgICAgICAgQ29zRXJyICs9IGZhY3RvciAqIGNvZWY7ICAgICAgICAgLyogVGhlIG50aCBwYXJ0aWFsIHN1bSAqLwotICAgICAgICBmYWN0b3IgPSBmYWN0b3IgKiB0MDsgICAgICAgICAgIC8qIENhbGN1bGF0ZSB0MF5uICovCisgICAgICAgIGZhY3RvciA9IGZhY3RvciAqIHQwOyAgICAgICAgICAgIC8qIENhbGN1bGF0ZSB0MF5uICovCiAgICAgfQotICAgIENvc0VyciA9IENvc0VyciAqIDI7ICAgICAgICAgIC8qIENvcnJlY3QgdGhlIHNjYWxpbmcgKi8KKyAgICBDb3NFcnIgPSBDb3NFcnIgKiAyOyAvKiBDb3JyZWN0IHRoZSBzY2FsaW5nICovCiAKICAgICAvKgogICAgICAqIENhbGN1bGF0ZSB0aGUgQjEgYW5kIEEwIGNvZWZmaWNpZW50cwogICAgICAqLwotICAgIEIxID0gKChMVk1fRkxPQVQpMC41IC0gQjIpOyAgICAgICAgICAgICAgICAgICAgIC8qIEIxID0gKDAuNSAtIGIyKSAqLwotICAgIEEwID0gQjEgKiBDb3NFcnIgOyAgICAvKiBUZW1wb3Jhcnkgc3RvcmFnZSBmb3IgKDAuNSAtIGIyKSAqIGNvc2Vycih0MCkgKi8KLSAgICBCMSAtPSBBMDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEIxID0gKDAuNSAtIGIyKSAqICgxIC0gY29zZXJyKHQwKSkgICovCi0gICAgQTAgPSAoKExWTV9GTE9BVCkwLjUgICsgQjIpIC8gMjsgICAgICAgICAgICAgICAgLyogQTAgPSAoMC41ICsgYjIpIC8gMiAqLworICAgIEIxID0gKChMVk1fRkxPQVQpMC41IC0gQjIpOyAgICAgLyogQjEgPSAoMC41IC0gYjIpICovCisgICAgQTAgPSBCMSAqIENvc0VycjsgICAgICAgICAgICAgICAvKiBUZW1wb3Jhcnkgc3RvcmFnZSBmb3IgKDAuNSAtIGIyKSAqIGNvc2Vycih0MCkgKi8KKyAgICBCMSAtPSBBMDsgICAgICAgICAgICAgICAgICAgICAgIC8qIEIxID0gKDAuNSAtIGIyKSAqICgxIC0gY29zZXJyKHQwKSkgICovCisgICAgQTAgPSAoKExWTV9GTE9BVCkwLjUgKyBCMikgLyAyOyAvKiBBMCA9ICgwLjUgKyBiMikgLyAyICovCiAKICAgICAvKgogICAgICAqIFdyaXRlIGNvZWZmIGludG8gdGhlIGRhdGEgc3RydWN0dXJlCkBAIC02NDAsNyArNjAxLDcgQEAKICAgICBwQ29lZmZpY2llbnRzLT5CMSA9IEIxOwogICAgIHBDb2VmZmljaWVudHMtPkIyID0gQjI7CiAKLSAgICByZXR1cm4oTFZQU0FfT0spOworICAgIHJldHVybiAoTFZQU0FfT0spOwogfQogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC02NTgsMjQgKzYxOSwxMCBAQAogLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZQU0FfUkVUVVJOIExWUFNBX0NsZWFyRmlsdGVySGlzdG9yeShMVlBTQV9JbnN0YW5jZVByX3QgICAgICAgICpwSW5zdCkKLXsKLSAgICBMVk1fSU5UOCAgICAgICAqcFRhcEFkZHJlc3M7Ci0gICAgTFZNX1VJTlQzMiAgICAgICBpOwotCi0gICAgLyogQmFuZCBQYXNzIGZpbHRlcnMgdGFwcyAqLwotICAgIHBUYXBBZGRyZXNzID0gKExWTV9JTlQ4ICopcEluc3QtPnBCUF9UYXBzOwotICAgIGZvcihpID0gMDsgaSA8IHBJbnN0LT5uQmFuZHMgKiBzaXplb2YoQmlxdWFkXzFJX09yZGVyMl9GTE9BVF9UYXBzX3QpOyBpKyspCi0gICAgewotICAgICAgICBwVGFwQWRkcmVzc1tpXSA9IDA7Ci0gICAgfQotICAgIC8qIFF1YXNpLXBlYWsgZmlsdGVycyB0YXBzICovCi0gICAgcFRhcEFkZH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A8c3RkbGliLmg+CisjaW5jbHVkZSAiTFZQU0EuaCIKKyNpbmNsdWRlICJMVlBTQV9Qcml2YXRlLmgiCiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogRlVOQ1RJT046ICAgICAgICAgICAgTFZQU0FfSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluaXRpYWxpemUgdGhlIExWUFNBIG1vZHVsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBDcmVhdGUgYW5kIEluaXRpYWxpemUgdGhlIExWUFNBIG1vZHVsZSBpbmNsdWRpbmcgaW5zdGFuY2UgaGFuZGxlICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcGhJbnN0YW5jZSAgICAgICAgICBQb2ludGVyIHRvIHBvaW50ZXIgdG8gdGhlIGluc3RhbmNlICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIHBoSW5zdGFuY2UgICAgICAgICAgUG9pbnRlciB0byB0aGUgaW5zdGFuY2UgaGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICBJbml0UGFyYW1zICAgICAgICAgIEluaXQgcGFyYW1ldGVycyBzdHJ1Y3R1cmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgQ29udHJvbFBhcmFtcyAgICAgICBDb250cm9sIHBhcmFtZXRlcnMgc3RydWN0dXJlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBNZW1vcnlUYWJsZSAgICAgICAgTWVtb3J5IHRhYmxlIHRoYXQgY29udGFpbnMgbWVtb3J5IGFyZWFzIGRlZmluaXRpb24gICAgICAgICAgKi8KKy8qICBwU2NyYXRjaCAgICAgICAgICAgIFBvaW50ZXIgdG8gYnVuZGxlIHNjcmF0Y2ggbWVtb3J5IGFyZWEgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0zOSw3NSArMzksMTkgQEAKIC8qICBvdGhlcndpc2UgICAgICAgICAgIEVycm9yIGR1ZSB0byBiYWQgcGFyYW1ldGVycyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWUFNBX1JFVFVSTiBMVlBTQV9Jbml0ICAgICAgICAgICAgICAoIHBMVlBTQV9IYW5kbGVfdCAgICAgICAgICAgICAqcGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWUFNBX0luaXRQYXJhbXNfdCAgICAgICAgICAqcEluaXRQYXJhbXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9Db250cm9sUGFyYW1zX3QgICAgICAgKnBDb250cm9sUGFyYW1zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZQU0FfTWVtVGFiX3QgICAgICAgICAgICAgICpwTWVtb3J5VGFibGUgKQotewotICAgIExWUFNBX0luc3RhbmNlUHJfdCAgICAgICAgICAqcExWUFNBX0luc3Q7Ci0gICAgTFZQU0FfUkVUVVJOICAgICAgICAgICAgICAgIGVycm9yQ29kZSAgICAgICA9IExWUFNBX09LOwotICAgIExWTV9VSU5UMzIgICAgICAgICAgICAgICAgICBpaTsKLSAgICBleHRlcm4gTFZNX0ZMT0FUICAgICAgICAgICAgTFZQU0FfRmxvYXRfR2FpblRhYmxlW107Ci0gICAgTFZNX1VJTlQzMiAgICAgICAgICAgICAgICAgIEJ1ZmZlckxlbmd0aCA9IDA7Ci0KLSAgICAvKiBJbnRzX0FsbG9jIGluc3RhbmNlcywgbmVlZGVkIGZvciBtZW1vcnkgYWxpZ25tZW50IG1hbmFnZW1lbnQgKi8KLSAgICBJTlNUX0FMTE9DICAgICAgICAgIEluc3RhbmNlOwotICAgIElOU1RfQUxMT0MgICAgICAgICAgU2NyYXRjaDsKLSAgICBJTlNUX0FMTE9DICAgICAgICAgIERhdGE7Ci0gICAgSU5TVF9BTExPQyAgICAgICAgICBDb2VmOwotCi0gICAgLyogQ2hlY2sgcGFyYW1ldGVycyAqLwotICAgIGlmKChwaEluc3RhbmNlID09IExWTV9OVUxMKSB8fCAocEluaXRQYXJhbXMgPT0gTFZNX05VTEwpIHx8IChwQ29udHJvbFBhcmFtcyA9PSBMVk1fTlVMTCkgfHwgKHBNZW1vcnlUYWJsZSA9PSBMVk1fTlVMTCkpCi0gICAgewotICAgICAgICByZXR1cm4oTFZQU0FfRVJST1JfTlVMTEFERFJFU1MpOwotICAgIH0KLSAgICBpZiggKHBJbml0UGFyYW1zLT5TcGVjdHJhbERhdGFCdWZmZXJEdXJhdGlvbiA+IExWUFNBX01BWEJVRkZFUkRVUkFUSU9OKSAgIHx8Ci0gICAgICAgIChwSW5pdFBhcmFtcy0+U3BlY3RyYWxEYXRhQnVmZmVyRHVyYXRpb24gPT0gMCkgICAgICAgICAgICAgICAgICAgICAgICB8fAotICAgICAgICAocEluaXRQYXJhbXMtPk1heElucHV0QmxvY2tTaXplID4gTFZQU0FfTUFYSU5QVVRCTE9DS1NJWkUpICAgICAgfHwKLSAgICAgICAgKHBJbml0UGFyYW1zLT5NYXhJbnB1dEJsb2NrU2l6ZSA9PSAwKSAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8Ci0gICAgICAgIChwSW5pdFBhcmFtcy0+bkJhbmRzIDwgTFZQU0FfTkJBTkRTTUlOKSAgICAgICAgICAgICAgICAgICAgICAgICB8fAotICAgICAgICAocEluaXRQYXJhbXMtPm5CYW5kcyA+IExWUFNBX05CQU5EU01BWCkgICAgICAgICAgICAgICAgICAgICAgICAgfHwKLSAgICAgICAgKHBJbml0UGFyYW1zLT5wRmlsdGVyc1BhcmFtcyA9PSAwKSkKLSAgICB7Ci0gICAgICAgIHJldHVybihMVlBTQV9FUlJPUl9JTlZBTElEUEFSQU0pOwotICAgIH0KLSAgICBmb3IoaWkgPSAwOyBpaSA8IHBJbml0UG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HRlclByZWNpc2lvbl9lbiAqKQotICAgICAgICAgICAgICAgICAgSW5zdEFsbG9jX0FkZE1lbWJlcigmSW5zdGFuY2UsIHBJbml0UGFyYW1zLT5uQmFuZHMgKiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKExWUFNBX0JQRmlsdGVyUHJlY2lzaW9uX2VuKSk7Ci0gICAgcExWUFNBX0luc3QtPnBCUF9JbnN0YW5jZXMgICAgICAgICAgPSAoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QgKikKLSAgICAgICAgICAgICAgICAgIEluc3RBbGxvY19BZGRNZW1iZXIoJkNvZWYsIHBJbml0UGFyYW1zLT5uQmFuZHMgKiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90KSk7Ci0gICAgcExWUFNBX0luc3QtPnBRUERfU3RhdGVzICAgICAgICAgICAgPSAoUVBEX0ZMT0FUX1N0YXRlX3QgKikKLSAgICAgICAgICAgICAgICAgIEluc3RBbGxvY19BZGRNZW1iZXIoJkNvZWYsIHBJbml0UGFyYW1zLT5uQmFuZHMgKiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKFFQRF9GTE9BVF9TdGF0ZV90KSk7Ci0KLSAgICBwTFZQU0FfSW5zdC0+cEJQX1RhcHMgICAgICAgICAgICAgICA9IChCaXF1YWRfMUlfT3JkZXIyX0ZMT0FUX1RhcHNfdCAqKQotICAgICAgICBJbnN0QWxsb2NfQWRkTWVtYmVyKCZEYXRhLCBwSW5pdFBhcmFtcy0+bkJhbmRzICogXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoQmlxdWFkXzFJX09yZGVyMl9GTE9BVF9UYXBzX3QpKTsKLSAgICBwTFZQU0FfSW5zdC0+cFFQRF9UYXBzICAgICAgICAgICAgICA9IChRUERfRkxPQVRfVGFwc190ICopCi0gICAgICAgIEluc3RBbGxvY19BZGRNZW1iZXIoJkRhdGEsIHBJbml0UGFyYW1zLT5uQmFuZHMgKiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKFFQRF9GTE9BVF9UYXBzX3QpKTsKKyAgICBwTFZQU0FfSW5zdC0+cFBvc3RHYWlucyA9CisgICAgICAgICAgICAoTFZNX0ZMT0FUKiljYWxsb2MocEluaXRQYXJhbXMtPm5CYW5kcywgc2l6ZW9mKCoocExWUFNBX0luc3QtPnBQb3N0R2FpbnMpKSk7CisgICAgaWYgKHBMVlBTQV9JbnN0LT5wUG9zdEdhaW5zID09IExWTV9OVUxMKSB7CisgICAgICAgIHJldHVybiBMVlBTQV9FUlJPUl9OVUxMQUREUkVTUzsKKyAgICB9CisgICAgcExWUFNBX0luc3QtPnBGaWx0ZXJzUGFyYW1zID0gKExWUFNBX0ZpbHRlclBhcmFtX3QqKWNhbGxvYygKKyAgICAgICAgICAgIHBJbml0UGFyYW1zLT5uQmFuZHMsIHNpemVvZigqKHBMVlBTQV9JbnN0LT5wRmlsdGVyc1BhcmFtcykpKTsKKyAgICBpZiAocExWUFNBX0luc3QtPnBGaWx0ZXJzUGFyYW1zID09IExWTV9OVUxMKSB7CisgICAgICAgIHJldHVybiBMVlBTQV9FUlJPUl9OVUxMQUREUkVTUzsKKyAgICB9CisgICAgcExWUFNBX0luc3QtPnBTcGVjdHJhbERhdGFCdWZmZXJTdGFydCA9IChMVk1fVUlOVDgqKWNhbGxvYygKKyAgICAgICAgICAgIHBJbml0UGFyYW1zLT5uQmFuZHMsIHBMVlBTQV9JbnN0LT5TcGVjdHJhbERhdGFCdWZmZXJMZW5ndGggKgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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FZNX05VTEwpIHsKKyAgICAgICAgcmV0dXJuIExWUFNBX0VSUk9SX05VTExBRERSRVNTOworICAgIH0KKyAgICBwTFZQU0FfSW5zdC0+cFFQRF9UYXBzID0KKyAgICAgICAgICAgIChRUERfRkxPQVRfVGFwc190KiljYWxsb2MocEluaXRQYXJhbXMtPm5CYW5kcywgc2l6ZW9mKCoocExWUFNBX0luc3QtPnBRUERfVGFwcykpKTsKKyAgICBpZiAocExWUFNBX0luc3QtPnBRUERfVGFwcyA9PSBMVk1fTlVMTCkgeworICAgICAgICByZXR1cm4gTFZQU0FfRVJST1JfTlVMTEFERFJFU1M7CisgICAgfQogCiAgICAgLyogQ29weSBmaWx0ZXJzIHBhcmFtZXRlcnMgaW4gdGhlIHByaXZhdGUgaW5zdGFuY2UgKi8KLSAgICBmb3IoaWkgPSAwOyBpaSA8IHBMVlBTQV9JbnN0LT5uQmFuZHM7IGlpKyspCi0gICAgeworICAgIGZvciAoaWkgPSAwOyBpaSA8IHBMVlBTQV9JbnN0LT5uQmFuZHM7IGlpKyspIHsKICAgICAgICAgcExWUFNBX0luc3QtPnBGaWx0ZXJzUGFyYW1zW2lpXSA9IHBJbml0UGFyYW1zLT5wRmlsdGVyc1BhcmFtc1tpaV07CiAgICAgfQogCiAgICAgLyogU2V0IFBvc3QgZmlsdGVycyBnYWlucyovCi0gICAgZm9yKGlpID0gMDsgaWkgPCBwTFZQU0FfSW5zdC0+bkJhbmRzOyBpaSsrKQotICAgIHsKLSAgICAgICAgcExWUFNBX0luc3QtPnBQb3N0R2FpbnNbaWldID0gTFZQU0FfRmxvYXRfR2FpblRhYmxlWzE1ICsgXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwSW5pdFBhcmFtcy0+cEZpbHRlcnNQYXJhbXNbaWldLlBvc3RHYWluXTsKKyAgICBmb3IgKGlpID0gMDsgaWkgPCBwTFZQU0FfSW5zdC0+bkJhbmRzOyBpaSsrKSB7CisgICAgICAgIHBMVlBTQV9JbnN0LT5wUG9zdEdhaW5zW2lpXSA9CisgICAgICAgICAgICAgICAgTFZQU0FfRmxvYXRfR2FpblRhYmxlWzE1ICsgcEluaXRQYXJhbXMtPnBGaWx0ZXJzUGFyYW1zW2lpXS5Qb3N0R2Fpbl07CiAgICAgfQogICAgIHBMVlBTQV9JbnN0LT5wU3BlY3RyYWxEYXRhQnVmZmVyV3JpdGVQb2ludGVyID0gcExWUFNBX0luc3QtPnBTcGVjdHJhbERhdGFCdWZmZXJTdGFydDsKIAogICAgIC8qIEluaXRpYWxpemUgY29udHJvbCBkZXBlbmRhbnQgaW50ZXJuYWwgcGFyYW1ldGVycyAqLwotICAgIGVycm9yQ29kZSA9IExWUFNBX0NvbnRyb2wgKCpwaEluc3RhbmNlLCBwQ29udHJvbFBhcmFtcyk7CisgICAgZXJyb3JDb2RlID0gTFZQU0FfQ29udHJvbCgqcGhJbnN0YW5jZSwgcENvbnRyb2xQYXJhbXMpOwogCi0gICAgaWYoZXJyb3JDb2RlIT0wKQotICAgIHsKKyAgICBpZiAoZXJyb3JDb2RlICE9IDApIHsKICAgICAgICAgcmV0dXJuIGVycm9yQ29kZTsKICAgICB9CiAKLSAgICBlcnJvckNvZGUgPSBMVlBTQV9BcHBseU5ld1NldHRpbmdzIChwTFZQU0FfSW5zdCk7CisgICAgZXJyb3JDb2RlID0gTFZQU0FfQXBwbHlOZXdTZXR0aW5ncyhwTFZQU0FfSW5zdCk7CiAKLSAgICBpZihlcnJvckNvZGUhPTApCi0gICAgeworICAgIGlmIChlcnJvckNvZGUgIT0gMCkgewogICAgICAgICByZXR1cm4gZXJyb3JDb2RlOwogICAgIH0KIAotICAgIHJldHVybihlcnJvckNvZGUpOworICAgIHJldHVybiAoZXJyb3JDb2RlKTsKIH0KIAorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBGVU5DVElPTjogICAgICAgICAgICBMVlBTQV9EZUluaXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICBGcmVlIHRoZSBtZW1vcmllcyBjcmVhdGVkIGluIExWUFNBX0luaXQgY2FsbCBpbmNsdWRpbmcgaW5zdGFuY2UgaGFuZGxlICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgcGhJbnN0YW5jZSAgICAgICAgICBQb2ludGVyIHRvIHRoZSBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCit2b2lkIExWUFNBX0RlSW5pdChwTFZQU0FfSGFuZGxlX3QqIHBoSW5zdGFuY2UpIHsKKyAgICBMVlBTQV9JbnN0YW5jZVByX3QqIHBMVlBTQV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AgICAgIExWRVFOQl9NZW1vcnkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCBmb3IgbWVtb3J5IGFsbG9jYXRpb24gYW5kIGZyZWUuIEl0IGNhbiBiZSBjYWxsZWQgaW4gICAgICAgICAgICovCi0vKiAgdHdvIHdheXM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICBoSW5zdGFuY2UgPSBOVUxMICAgICAgICAgUmV0dXJucyB0aGUgbWVtb3J5IHJlcXVpcmVtZW50cyAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgIGhJbnN0YW5jZSA9IEluc3RhbmNlIGhhbmRsZSAgICAgUmV0dXJucyB0aGUgbWVtb3J5IHJlcXVpcmVtZW50cyBhbmQgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxvY2F0ZWQgYmFzZSBhZGRyZXNzZXMgZm9yIHRoZSBpbnN0YW5jZSAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgV2hlbiB0aGlzIGZ1bmN0aW9uIGlzIGNhbGxlZCBmb3IgbWVtb3J5IGFsbG9jYXRpb24gKGhJbnN0YW5jZT1OVUxMKSB0aGUgbWVtb3J5ICAgICAgKi8KLS8qICBiYXNlIGFkZHJlc3MgcG9pbnRlcnMgYXJlIE5VTEwgb24gcmV0dXJuLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgV2hlbiB0aGUgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciBmcmVlIChoSW5zdGFuY2UgPSBJbnN0YW5jZSBIYW5kbGUpIHRoZSBtZW1vcnkgICAgICAgKi8KLS8qICB0YWJsZSByZXR1cm5zIHRoZSBhbGxvY2F0ZWQgbWVtb3J5IGFuZCBiYXNlIGFkZHJlc3NlcyB1c2VkIGR1cmluZyBpbml0aWFsaXNhdGlvbi4gICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2UgICAgICAgICAgICAgICBJbnN0YW5jZSBIYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBNZW1vcnlUYWJsZSAgICAgICAgICAgIFBvaW50ZXIgdG8gYW4gZW1wdHkgbWVtb3J5IGRlZmluaXRpb24gdGFibGUgICAgICAgICAgICAgICAgICovCi0vKiAgSW5pdFBhcmFtcyAgICAgICAgICAgICAgUG9pbnRlciB0byB0aGUgaW5zdGFuY2UgaW5pdCBwYXJhbWV0ZXJzICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZQU0FfT0sgICAgICAgICAgICBTdWNjZWVkcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBvdGhlcndpc2UgICAgICAgICAgIEVycm9yIGR1ZSB0byBiYWQgcGFyYW1ldGVycyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWUFNBX1JFVFVSTiBMVlBTQV9NZW1vcnkgICAgICAgICAgICAoIHBMVlBTQV9IYW5kbGVfdCAgICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9NZW1UYWJfdCAgICAgICAgICAgICAqcE1lbW9yeVRhYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZQU0FfSW5pdFBhcmFtc190ICAgICAgICAgKnBJbml0UGFyYW1zICAgICkKLXsKLSAgICBMVk1fVUlOVDMyICAgICAgICAgIGlpOwotICAgIExWTV9VSU5UMzIgICAgICAgICAgQnVmZmVyTGVuZ3RoOwotICAgIElOU1RfQUxMT0MgICAgICAgICAgSW5zdGFuY2U7Ci0gICAgSU5TVF9BTExPQyAgICAgICAgICBTY3Jhd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SW5pdFBhcmFtcy0+TWF4SW5wdXRCbG9ja1NpemUgPT0gMCkgICAgICAgICAgICAgICAgICAgICAgICAgICB8fAotICAgICAgICAgICAgKHBJbml0UGFyYW1zLT5uQmFuZHMgPCBMVlBTQV9OQkFORFNNSU4pICAgICAgICAgICAgICAgICAgICAgICAgIHx8Ci0gICAgICAgICAgICAocEluaXRQYXJhbXMtPm5CYW5kcyA+IExWUFNBX05CQU5EU01BWCkgICAgICAgICAgICAgICAgICAgICAgICAgfHwKLSAgICAgICAgICAgIChwSW5pdFBhcmFtcy0+cEZpbHRlcnNQYXJhbXMgPT0gMCkpCi0gICAgICAgIHsKLSAgICAgICAgICAgIHJldHVybihMVlBTQV9FUlJPUl9JTlZBTElEUEFSQU0pOwotICAgICAgICB9Ci0gICAgICAgIGZvcihpaSA9IDA7IGlpIDwgcEluaXRQYXJhbXMtPm5CYW5kczsgaWkrKykKLSAgICAgICAgewotICAgICAgICAgICAgaWYoKHBJbml0UGFyYW1zLT5wRmlsdGVyc1BhcmFtc1tpaV0uQ2VudGVyRnJlcXVlbmN5ID4gTFZQU0FfTUFYQ0VOVEVSRlJFUSkgfHwKLSAgICAgICAgICAgICAgIChwSW5pdFBhcmFtcy0+cEZpbHRlcnNQYXJhbXNbaWldLlBvc3RHYWluICAgICAgICA+IExWUFNBX01BWFBPU1RHQUlOKSAgIHx8Ci0gICAgICAgICAgICAgICAocEluaXRQYXJhbXMtPnBGaWx0ZXJzUGFyYW1zW2lpXS5Qb3N0R2FpbiAgICAgICAgPCBMVlBTQV9NSU5QT1NUR0FJTikgICB8fAotICAgICAgICAgICAgICAgKHBJbml0UGFyYW1zLT5wRmlsdGVyc1BhcmFtc1tpaV0uUUZhY3RvciA8IExWUFNBX01JTlFGQUNUT1IpICAgICAgICAgICAgfHwKLSAgICAgICAgICAgICAgIChwSW5pdFBhcmFtcy0+cEZpbHRlcnNQYXJhbXNbaWldLlFGYWN0b3IgPiBMVlBTQV9NQVhRRkFDVE9SKSkKLSA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Yy9MVlBTQV9Qcml2YXRlLmgKaW5kZXggNjE5ODdiNS4uNjA1YTIyZSAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1NwZWN0cnVtQW5hbHl6ZXIvc3JjL0xWUFNBX1ByaXZhdGUuaAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3BlY3RydW1BbmFseXplci9zcmMvTFZQU0FfUHJpdmF0ZS5oCkBAIC0xOCw2ICsxOCw3IEBACiAjaWZuZGVmIF9MVlBTQV9QUklWQVRFX0hfCiAjZGVmaW5lIF9MVlBTQV9QUklWQVRFX0hfCiAKKyNpbmNsdWRlIDxhdWRpb191dGlscy9CaXF1YWRGaWx0ZXIuaD4KICNpbmNsdWRlICJMVlBTQS5oIgogI2luY2x1ZGUgIkJJUVVBRC5oIgogI2luY2x1ZGUgIkxWUFNBX1FQRC5oIgpAQCAtMjcsOTUgKzI4LDk5IEBACiAgICBDT05TVEFOVCBERUZJTklUSU9OUwogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLS8qIE1lbW9yeSAqLwotI2RlZmluZSBMVlBTQV9JTlNUQU5DRV9BTElHTiAgICAgICAgICAgICA0ICAgICAgLyogMzItYml0IGFsaWdubWVudCBmb3Igc3RydWN0dXJlcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotI2RlZmluZSBMVlBTQV9TQ1JBVENIX0FMSUdOICAgICAgICAgICAgICA0ICAgICAgLyogMzItYml0IGFsaWdubWVudCBmb3IgbG9uZyBkYXRhICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotI2RlZmluZSBMVlBTQV9DT0VGX0FMSUdOICAgICAgICAgICAgICAgICA0ICAgICAgLyogMzItYml0IGFsaWdubWVudCBmb3IgbG9uZyB3b3JkcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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IDgwMDBIeiB0byAxOTIwMDBIeiovCi0jZGVmaW5lIExWUFNBX05SX1NVUFBPUlRFRF9TUEVFRCAgICAgICAgIDMgICAgICAvKiBMT1csIE1FRElVTSwgSElHSCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIExWUFNBX01BWEJVRkZFUkRVUkFUSU9OIFwKKyAgICA0MDAwIC8qIE1heGltdW0gbGVuZ3RoIGluIG1zIG9mIHRoZSBsZXZlbHMgYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgTFZQU0FfTUFYSU5QVVRCTE9DS1NJWkUgXAorICAgIDUwMDAgICAgICAgICAgICAgICAgICAgLyogTWF4aW11bSBsZW5ndGggaW4gbW9ubyBzYW1wbGVzIG9mIHRoZSBibG9jayB0byBwcm9jZXNzICAgICAgICAgICAqLworI2RlZmluZSBMVlBTQV9OQkFORFNNSU4gMSAgLyogTWluaW11bSBudW1iZXIgb2YgZnJlcXVlbmN5IGJhbmQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBMVlBTQV9OQkFORFNNQVggMzAgLyogTWF4aW11bSBudW1iZXIgb2YgZnJlcXVlbmN5IGJhbmQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBMVlBTQV9NQVhDRU5URVJGUkVRIFwKKyAgICAyMDAwMCAvKiBNYXhpbXVtIHBvc3NpYmxlIGNlbnRlciBmcmVxdWVuY3kgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIExWUFNBX01JTlBPU1RHQUlOIFwKKyAgICAoLTE1KSAgICAgICAgICAgICAgICAgICAgIC8qIE1pbmltdW0gcG9zc2libGUgcG9zdCBnYWluICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyNkZWZpbmUgTFZQU0FfTUFYUE9TVEdBSU4gMTUgIC8qIE1heGltdW0gcG9zc2libGUgcG9zdCBnYWluICAqLworI2RlZmluZSBMVlBTQV9NSU5RRkFDVE9SIDI1ICAgLyogTWluaW11bSBwb3NzaWJsZSBRIGZhY3RvciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworI2RlZmluZSBMVlBTQV9NQVhRRkFDVE9SIDEyMDAgLyogTWF4aW11bSBwb3NzaWJsZSBRIGZhY3RvciAqLwogCi0jZGVmaW5lIExWUFNBX01BWEJVRkZFUkRVUkFUSU9OICAgICAgICAgIDQwMDAgICAvKiBNYXhpbXVtIGxlbmd0aCBpbiBtcyBvZiB0aGUgbGV2ZWxzIGJ1ZmZlciAgICAgICAgICAgICAgICAgICAgICAgICovCi0jZGVmaW5lIExWUFNBX01BWElOUFVUQkxPQ0tTSVpFICAgICAgICAgIDUwMDAgICAvKiBNYXhpbXVtIGxlbmd0aCBpbiBtb25vIHNhbXBsZXMgb2YgdGhlIGJsb2NrIHRvIHByb2Nlc3MgICAgICAgICAgICovCi0jZGVmaW5lIExWUFNBX05CQU5EU01JTiAgICAgICAgICAgICAgICAgIDEgICAgICAvKiBNaW5pbXVtIG51bWJlciBvZiBmcmVxdWVuY3kgYmFuZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0jZGVmaW5lIExWUFNBX05CQU5EU01BWCAgICAgICAgICAgICAgICAgIDMwICAgICAvKiBNYXhpbXVtIG51bWJlciBvZiBmcmVxdWVuY3kgYmFuZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0jZGVmaW5lIExWUFNBX01BWENFTlRFUkZSRVEgICAgICAgICAgICAgIDIwMDAwICAvKiBNYXhpbXVtIHBvc3NpYmxlIGNlbnRlciBmcmVxdWVuY3kgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0jZGVmaW5lIExWUFNBX01JTlBPU1RHQUlOICAgICAgICAgICAgICAoLTE1KSAgICAvKiBNaW5pbXVtIHBvc3NpYmxlIHBvc3QgZ2FpbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0jZGVmaW5lIExWUFNBX01BWFBPU1RHQUlOICAgICAgICAgICAgICAgIDE1ICAgICAvKiBNYXhpbXVtIHBvc3NpYmxlIHBvc3QgZ2FpbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0jZGVmaW5lIExWUFNBX01JTlFGQUNUT1IgICAgICAgICAgICAgICAgIDI1ICAgICAvKiBNaW5pbXVtIHBvc3NpYmxlIFEgZmFjdG9yICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0jZGVmaW5lIExWUFNBX01BWFFGQUNUT1IgICAgICAgICAgICAgICAgIDEyMDAgICAvKiBNYXhpbXVtIHBvc3NpYmxlIFEgZmFjdG9yICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIExWUFNBX01BWExFVkVMREVDQVlGQUNUT1IgXAorICAgIDB4NDExMSAvKiBEZWNheSBmYWN0b3IgZm9yIHRoZSBtYXhpbXVtIHZhbHVlcyBjYWxjdWxhdGlvbiAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIExWUFNBX01BWExFVkVMREVDQVlTSElGVCBcCisgICAgMTQgLyogRGVjYXkgc2hpZnQgZm9yIHRoZSBtYXhpbXVtIHZhbHVlcyBjYWxjdWxhdGlvbiAgICAgICAgICAgICAgICAgICAqLwogCi0jZGVmaW5lIExWUFNBX01BWExFVkVMREVDQVlGQUNUT1IgICAgICAgIDB4NDExMSAvKiBEZWNheSBmYWN0b3IgZm9yIHRoZSBtYXhpbXVtIHZhbHVlcyBjYWxjdWxhdGlvbiAgICAgICAgICAgICAgICAgICovCi0jZGVmaW5lIExWUFNBX01BWExFVkVMREVDQVlTSElGVCAgICAgICAgIDE0ICAgICAvKiBEZWNheSBzaGlmdCBmb3IgdGhlIG1heGltdW0gdmFsdWVzIGNhbGN1bGF0aW9uICAgICAgICAgICAgICAgICAgICovCisjZGVmaW5lIExWUFNBX01BWFVOU0lHTkVEQ0hBUiAweEZGCiAKLSNkZWZpbmUgTFZQU0FfTUFYVU5TSUdORURDSEFSICAgICAgICAgICAgMHhGRgotCi0jZGVmaW5lIExWUFNBX0ZzSW52ZXJ0U2hpZnQgICAgICAgICAgICAgIDMxCi0jZGVmaW5lIExWUFNBX0dBSU5TSElGVCAgICAgICAgICAgICAgICAgIDExCi0jZGVmaW5lIExWUFNBX0ZSRVFTSElGVCAgICAgICAgICAgICAgICAgIDI1CisjZGVmaW5lIExWUFNBX0ZzSW52ZXJ0U2hpZnQgMzEKKyNkZWZpbmUgTFZQU0FfR0FJTlNISUZUIDExCisjZGVmaW5lIExWUFNBX0ZSRVFTSElGVCAyNQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgVFlQRVMgREVGSU5JVElPTlMKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0jZGVmaW5lIExWUFNBX0ludGVybmFsUmVmcmVzaFRpbWUgICAgICAgMHgwMDE0ICAgIC8qIDIwIG1zICg1MEh6KSBpbiBRMTYuMCAgICAgICovCi0jZGVmaW5lIExWUFNBX0ludGVybmFsUmVmcmVzaFRpbWVJbnYgICAgMHgwNjY2ICAgIC8qIDEvMjBtcyBsZWZ0IHNoaWZ0ZWQgYnkgMTUgICovCi0jZGVmaW5lIExWUFNBX0ludGVybmFsUmVmcmVzaFRpbWVTaGlmdCAgMTUKKyNkZWZpbmUgTFZQU0FfSW50ZXJuYWxSZWZyZXNoVGltZSAweDAwMTQgICAgLyogMjAgbXMgKDUwSHopIGluIFExNi4wICAgICAgKi8KKyNkZWZpbmUgTFZQU0FfSW50ZXJuYWxSZWZyZXNoVGltZUludiAweDA2NjYgLyogMS8yMG1zIGxlZnQgc2hpZnRlZCBieSAxNSAgKi8KKyNkZWZpbmUgTFZQU0FfSW50ZXJuYWxSZWZyZXNoVGltZVNoaWZ0IDE1CiAKIC8qIFByZWNpc2lvbiBvZiB0aGUgZmlsdGVyICovCi10eXBlZGVmIGVudW0KLXsKLSAgICBMVlBTQV9TaW1wbGVQcmVjaXNpb25GaWx0ZXIsICAgIC8qIFNpbXBsZSBwcmVjaXNpb24gKi8KLSAgICBMVlBTQV9Eb3VibGVQcmVjaXNpb25GaWx0ZXIgICAgIC8qIERvdWJsZSBwcmVjaXNpb24gKi8KK3R5cGVkZWYgZW51bSB7CisgICAgTFZQU0FfU2ltcGxlUHJlY2lzaW9uRmlsdGVyLCAvKiBTaW1wbGUgcHJlY2lzaW9uICovCisgICAgTFZQU0FfRG91YmxlUHJlY2lzaW9uRmlsdGVyICAvKiBEb3VibGUgcHJlY2lzaW9uICovCiB9IExWUFNBX0JQRmlsdGVyUHJlY2lzaW9uX2VuOwogCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9DSEFSICAgICAgICAgICAgICAgICAgICBiQ29udHJvbFBlbmRpbmc7ICAgICAgICAgICAgICAgICAgICAvKiBGbGFnIGluY2F0aW5nIGEgY2hhbmdlIG9mIHRoZSBjb250cm9sIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgICBuQmFuZHM7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBOdW1iZXIgb2YgYmFuZHMgb2YgdGhlIHNwZWN0cnVtIGFuYWx5emVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgICBNYXhJbnB1dEJsb2NrU2l6ZTsgICAgICAgICAgICAgICAgICAvKiBNYXhpbXVtIGlucHV0IGRhdGEgYnVmZmVyIHNpemUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwordHlwZWRlZiBzdHJ1Y3QgeworICAgIExWTV9DSEFSIGJDb250cm9sUGVuZGluZzsgICAgIC8qIEZsYWcgaW5jYXRpbmcgYSBjaGFuZ2Ugb2YgdGhlIGNvbnRyb2wgcGFyYW1ldGVycyAgICAgKi8KKyAgICBMVk1fVUlOVDE2IG5CYW5kczsgICAgICAgICAgICAvKiBOdW1iZXIgb2YgYmFuZHMgb2YgdGhlIHNwZWN0cnVtIGFuYWx5emVyICAgICAgICAgICAgKi8KKyAgICBMVk1fVUlOVDE2IE1heElucHV0QmxvY2tTaXplOyAvKiBNYXhpbXVtIGlucHV0IGRhdGEgYnVmZmVyIHNpemUgKi8KIAotICAgIExWUFNBX0NvbnRyb2xQYXJhbXNfdCAgICAgICBDdXJyZW50UGFyYW1zOyAgICAgICAgICAgICAgICAgICAgICAvKiBDdXJyZW50IGNvbnRyb2wgcGFyYW1ldGVycyBvZiB0aGUgbW9kdWxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIExWUFNBX0NvbnRyb2xQYXJhbXNfdCAgICAgICBOZXdQYXJhbXM7ICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBOZXcgY29udHJvbCBwYXJhbWV0ZXJzIGdpdmVuIGJ5IHRoZSB1c2VyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIExWUFNBX01lbVRhYl90ICAgICAgICAgICAgICBNZW1vcnlUYWJsZTsKKyAgICBMVlBTQV9Db250cm9sUGFyYW1zX3QgQ3VycmVudFBhcmFtczsgLyogQ3VycmVudCBjb250cm9sIHBhcmFtZXRlcnMgb2YgdGhlIG1vZHVsZSAqLworICAgIExWUFNBX0NvbnRyb2xQYXJhbXNfdCBOZXdQYXJhbXM7ICAgICAvKiBOZXcgY29udHJvbCBwYXJ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AgICAgIC8qIE51bWJlciBvZiBzYW1wbGVzIHRvIG1ha2UgMjBtcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgTFZNX0lOVDMyICAgICAgICAgICAgICAgICAgIEJ1ZmZlclVwZGF0ZVNhbXBsZXNDb3VudDsgICAgICAgICAgIC8qIENvdW50ZXIgdXNlZCB0byBrbm93IHdoZW4gdG8gcHV0IGEgbmV3IHZhbHVlIGluIHRoZSBidWZmZXIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgICAgIG5SZWxldmFudEZpbHRlcnM7ICAgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiByZWxldmVudCBmaWx0ZXJzIGRlcGVuZGluZyBvbiBzYW1wbGluZyBmcmVxdWVuY3kgYW5kIGJhbmRzIGNlbnRlciBmcmVxdWVuY3kgICAgICAgICovCi0gICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgICAgIExvY2FsU2FtcGxlc0NvdW50OyAgICAgICAgICAgICAgICAgIC8qIENvdW50ZXIgdXNlZCB0byB1cGRhdGUgdGhlIFNwZWN0cmFsRGF0YUJ1ZmZlckF1ZGlvVGltZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgTFZNX1VJTlQxNiBuU2FtcGxlc0J1ZmZlclVwZGF0ZTsgICAgLyogTnVtYmVyIG9mIHNhbXBsZXMgdG8gbWFrZSAyMG1zICAgICovCisgICAgTFZNX0lOVDMyIEJ1ZmZlclVwZGF0ZVNhbXBsZXNDb3VudDsgLyogQ291bnRlciB1c2VkIHRvIGtub3cgd2hlbiB0byBwdXQgYSBuZXcgdmFsdWUgaW4gdGhlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIExWTV9VSU5UMTYgblJlbGV2YW50RmlsdGVyczsgIC8qIE51bWJlciBvZiByZWxldmFudCBmaWx0ZXJzIGRlcGVuZGluZyBvbiBzYW1wbGluZyBmcmVxdWVuY3kgYW5kCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFuZHMgY2VudGVyIGZyZXF1ZW5jeSAgICAgICAgKi8KKyAgICBMVk1fVUlOVDE2IExvY2FsU2FtcGxlc0NvdW50OyAvKiBDb3VudGVyIHVzZWQgdG8gdXBkYXRlIHRoZSBTcGVjdHJhbERhdGFCdWZmZXJBdWRpb1RpbWUgKi8KIAotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgICBEb3duU2FtcGxpbmdGYWN0b3I7ICAgICAgICAgICAgICAgICAvKiBEb3duIHNhbXBsaW5nIGZhY3RvciBkZXBlbmRpbmcgb24gdGhlIHNhbXBsaW5nIGZyZXF1ZW5jeSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgICBEb3duU2FtcGxpbmdDb3VudDsgICAgICAgICAgICAgICAgICAvKiBDb3VudGVyIHVzZWQgZm9yIHRoZSBkb3duc2FtcGxpbmcgaGFuZGxpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIExWTV9VSU5UMTYgRG93blNhbXBsaW5nRmFjdG9yOyAvKiBEb3duIHNhbXBsaW5nIGZhY3RvciBkZXBlbmRpbmcgb24gdGhlIHNhbXBsaW5nIGZyZXF1ZW5jeSAqLworICAgIExWTV9VSU5UMTYgRG93blNhbXBsaW5nQ291bnQ7ICAvKiBDb3VudGVyIHVzZWQgZm9yIHRoZSBkb3duc2FtcGxpbmcgaGFuZGxpbmcgICovCiAKLSAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICAgU3BlY3RyYWxEYXRhQnVmZmVyRHVyYXRpb247ICAgICAgICAgLyogTGVuZ3RoIG9mIHRoZSBidWZmZXIgaW4gdGltZSAobXMpIGRlZmluZWQgYnkgdGhlIGFwcGxpY2F0aW9uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBMVk1fVUlOVDggICAgICAgICAgICAgICAgICAqcFNwZWN0cmFsRGF0YUJ1ZmZlclN0YXJ0OyAgICAgICAgICAgLyogU3RhcnRpbmcgYWRkcmVzcyBvZiB0aGUgYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBMVk1fVUlOVDggICAgICAgICAgICAgICAgICAqcFNwZWN0cmFsRGF0YUJ1ZmZlcldyaXRlUG9pbnRlcjsgICAgLyogQ3VycmVudCBwb3NpdGlvbiBvZiB0aGUgd3JpdHRpbmcgcG9pbnRlciBvZiB0aGUgYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBMVlBTQV9UaW1lICAgICAgICAgICAgICAgICAgU3BlY3RyYWxEYXRhQnVmZmVyQXVkaW9UaW1lOyAgICAgICAgLyogQXVkaW9UaW1lIGF0IHdoaWNoIHRoZSBsYXN0IHZhbHVlIHNhdmUgb2NjdXJlZCBpbiB0aGUgYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBMVk1fVUlOVDMyICAgICAgICAgICAgICAgICAgU3BlY3RyYWxEYXRhQnVmZmVyTGVuZ3RoOyAgICAgICAgICAgLyogTnVtYmVyIG9mIHNwZWN0cnVtIGRhdGEgdmFsdWUgdGhhdCB0aGUgYnVmZmVyIGNhbiBjb250YWluIChwZXIgYmFuZCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPSBTcGVjdHJhbERhdGFCdWZmZXJEdXJhdGlvbi8yMG1zICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICBMVk1fVUlOVDE2IFNwZWN0cmFsRGF0YUJ1ZmZlckR1cmF0aW9uOyAgICAgIC8qIExlbmd0aCBvZiB0aGUgYnVmZmVyIGluIHRpbWUgKG1zKSBkZWZpbmVkIGJ5IHRoZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBwbGljYXRpb24gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIExWTV9VSU5UOCogcFNwZWN0cmFsRGF0YUJ1ZmZlclN0YXJ0OyAgICAgICAgLyogU3RhcnRpbmcgYWRkcmVzcyBvZiB0aGUgYnVmZmVyICAgICAgICAqLworICAgIExWTV9VSU5UOCogcFNwZWN0cmFsRGF0YUJ1ZmZlcldyaXRlUG9pbnRlcjsgLyogQ3VycmVudCBwb3NpdGlvbiBvZiB0aGUgd3JpdGluZyBwb2ludGVyIG9mIHRoZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICBMVlBTQV9UaW1lIFNwZWN0cmFsRGF0YUJ1ZmZlckF1ZGlvVGltZTsgLyogQXVkaW9UaW1lIGF0IHdoaWNoIHRoZSBsYXN0IHZhbHVlIHNhdmUgb2NjdXJyZWQgaW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhlIGJ1ZmZlciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgTFZNX1VJTlQzMgorICAgICAgICAgICAgU3BlY3RyYWxEYXRhQnVmZmVyTGVuZ3RoOyAvKiBOdW1iZXIgb2Ygc3BlY3RydW0gZGF0YSB2YWx1ZSB0aGF0IHRoZSBidWZmZXIgY2FuIGNvbnRhaW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBlciBiYW5kKSA9IFNwZWN0cmFsRGF0YUJ1ZmZlckR1cmF0aW9uLzIwbXMgKi8KIAotICAgIExWTV9VSU5UOCAgICAgICAgICAgICAgICAgICpwUHJldmlvdXNQZWFrczsgICAgICAgICAgICAgICAgICAgICAvKiBQb2ludHMgdG8gYSBuQmFuZHMgZWxlbWVudHMgYXJyYXkgdGhhdCBjb250YWlucyB0aGUgcHJldmlvdXMgcGVhayB2YWx1ZSBvZiB0aGUgbGV2ZWwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldGVjdGlvbi4gVGhvc2UgdmFsdWVzIGFyZSBkZWNyZW1lbnRlZCBhZnRlciBlYWNoIGNhbGwgdG8gdGhlIEdldFNwZWN0cnVtIGZ1bmN0aW9uICAgICAgICAgICovCisgICAgTFZNX1VJTlQ4KiBwUHJldmlvdXNQZWFrczsgLyogUG9pbnRzIHRvIGEgbkJhbmRzIGVsZW1lbnRzIGFycmF5IHRoYXQgY29udGFpbnMgdGhlIHByZXZpb3VzIHBlYWsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUgb2YgdGhlIGxldmVsIGRldGVjdGlvbi4gVGhvc2UgdmFsdWVzIGFyZSBkZWNyZW1lbnRlZCBhZnRlcgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlYWNoIGNhbGwgdG8gdGhlIEdldFNwZWN0cnVtIGZ1bmN0aW9uICAgICAgICAgICovCiAKLX1MVlBTQV9JbnN0YW5jZVByX3QsICpwTFZQU0FfSW5zdGFuY2VQcl90OworfSBMVlBTQV9JbnN0YW5jZVByX3QsICpwTFZQU0FfSW5zdGFuY2VQcl90OwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgRlVOQ1RJT05TIFBST1RPVFlQRQpAQCAtMTM1LDYgKzE0MCw2IEBACiAvKiAgTFZQU0FfT0sgICAgICAgICAgICBBbHdheXMgc3VjY2VlZHMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlBTQV9SRVRVUk4gTFZQU0FfQXBwbHlOZXdTZXR0aW5ncyAoTFZQU0FfSW5zdGFuY2VQcl90ICAgICAqcEluc3QpOworTFZQU0FfUkVUVVJOIExWUFNBX0FwcGx5TmV3U2V0dGluZ3MoTFZQU0FfSW5zdGFuY2VQcl90KiBwSW5zdCk7CiAKICNlbmRpZiAvKiBfTFZQU0FfUFJJVkFURV9IICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3BlY3RydW1BbmFseXplci9zcmMvTFZQU0FfUHJvY2Vzcy5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3BlY3RydW1BbmFseXplci9zcmMvTFZQU0FfUHJvY2Vzcy5jcHAKaW5kZXggODFhODhjNS4uYzg5YzRmNiAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1NwZWN0cnVtQW5hbHl6ZXIvc3JjL0xWUFNBX1Byb2Nlc3MuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TcGVjdHJ1bUFuYWx5emVyL3NyYy9MVlBTQV9Qcm9jZXNzLmNwcApAQCAtMTUsMjMgKzE1LDIzIEBACiAgKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KICAqLwogCi0jaW5jbHVkZSAgICAiTFZQU0EuaC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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtNTQsNDIgKzU0LDM2IEBACiAvKiAgb3RoZXJ3aXNlICAgICAgICAgICBFcnJvciBkdWUgdG8gYmFkIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlBTQV9SRVRVUk4gTFZQU0FfUHJvY2VzcyAgICAgICAgICAgKCBwTFZQU0FfSGFuZGxlX3QgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICpwTFZQU0FfSW5wdXRTYW1wbGVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiAgICAgICAgICAgSW5wdXRCbG9ja1NpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9UaW1lICAgICAgICAgICBBdWRpb1RpbWUgICAgICAgICAgICApCitMVlBTQV9SRVRVUk4gTFZQU0FfUHJvY2VzcyhwTFZQU0FfSGFuZGxlX3QgaEluc3RhbmNlLCBMVk1fRkxPQVQqIHBMVlBTQV9JbnB1dFNhbXBsZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2IElucHV0QmxvY2tTaXplLCBMVlBTQV9UaW1lIEF1ZGlvVGltZSkKIAogewotICAgIExWUFNBX0luc3RhbmNlUHJfdCAgICAgKnBMVlBTQV9JbnN0ID0gKExWUFNBX0luc3RhbmNlUHJfdCopaEluc3RhbmNlOwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICpwU2NyYXRjaDsKLSAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBpaTsKLSAgICBMVk1fSU5UMzIgICAgICAgICAgICAgICBBdWRpb1RpbWVJbmM7Ci0gICAgZXh0ZXJuIExWTV9VSU5UMzIgICAgICAgTFZQU0FfU2FtcGxlUmF0ZUludlRhYltdOwotICAgIExWTV9VSU5UOCAgICAgICAgICAgICAgICpwV3JpdGVfU2F2ZTsgICAgICAgICAvKiBQb3NpdGlvbiBvZiB0aGUgd3JpdGUgcG9pbnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdCB0aGUgYmVnaW5uaW5nIG9mIHRoZSBwcm9jZXNzICAqLworICAgIExWUFNBX0luc3RhbmNlUHJfdCogcExWUFNBX0luc3QgPSAoTFZQU0FfSW5zdGFuY2VQcl90KiloSW5zdGFuY2U7CisgICAgTFZNX0ZMT0FUKiBwU2NyYXRjaDsKKyAgICBMVk1fSU5UMTYgaWk7CisgICAgTFZNX0lOVDMyIEF1ZGlvVGltZUluYzsKKyAgICBleHRlcm4gTFZNX1VJTlQzMiBMVlBTQV9TYW1wbGVSYXRlSW52VGFiW107CisgICAgTFZNX1VJTlQ4KiBwV3JpdGVfU2F2ZTsgLyogUG9zaXRpb24gb2YgdGhlIHdyaXRlIHBvaW50ZXIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdCB0aGUgYmVnaW5uaW5nIG9mIHRoZSBwcm9jZXNzICAqLwogCiAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogICAgICAgIENIRUNLIFBBUkFNRVRFUlMKICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIGlmKGhJbnN0YW5jZS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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICBpZiAocExWUFNBX0luc3QtPmJDb250cm9sUGVuZGluZyA9PSBMVk1fVFJVRSkKLSAgICB7CisgICAgaWYgKHBMVlBTQV9JbnN0LT5iQ29udHJvbFBlbmRpbmcgPT0gTFZNX1RSVUUpIHsKICAgICAgICAgcExWUFNBX0luc3QtPmJDb250cm9sUGVuZGluZyA9IDA7Ci0gICAgICAgIExWUFNBX0FwcGx5TmV3U2V0dGluZ3MoIHBMVlBTQV9JbnN0KTsKKyAgICAgICAgTFZQU0FfQXBwbHlOZXdTZXR0aW5ncyhwTFZQU0FfSW5zdCk7CiAgICAgfQogCiAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgpAQCAtOTksMzkgKzkzLDMwIEBACiAgICAgQ29weV9GbG9hdChwTFZQU0FfSW5wdXRTYW1wbGVzLCBwU2NyYXRjaCwgKExWTV9JTlQxNilJbnB1dEJsb2NrU2l6ZSk7CiAgICAgU2hpZnRfU2F0X0Zsb2F0KC0xLCBwU2NyYXRjaCwgcFNjcmF0Y2gsIChMVk1fSU5UMTYpSW5wdXRCbG9ja1NpemUpOwogCi0gICAgZm9yIChpaSA9IDA7IGlpIDwgcExWUFNBX0luc3QtPm5SZWxldmFudEZpbHRlcnM7IGlpKyspCi0gICAgewotICAgICAgICBzd2l0Y2gocExWUFNBX0luc3QtPnBCUEZpbHRlcnNQcmVjaXNpb25baWldKQotICAgICAgICB7CisgICAgZm9yIChpaSA9IDA7IGlpIDwgcExWUFNBX0luc3QtPm5SZWxldmFudEZpbHRlcnM7IGlpKyspIHsKKyAgICAgICAgc3dpdGNoIChwTFZQU0FfSW5zdC0+cEJQRmlsdGVyc1ByZWNpc2lvbltpaV0pIHsKICAgICAgICAgICAgIGNhc2UgTFZQU0FfU2ltcGxlUHJlY2lzaW9uRmlsdGVyOgotICAgICAgICAgICAgICAgIEJQXzFJX0QxNkYxNkMxNF9UUkNfV1JBXzAxICAoICZwTFZQU0FfSW5zdC0+cEJQX0luc3RhbmNlc1tpaV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFNjcmF0Y2gsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFNjcmF0Y2ggKyBJbnB1dEJsb2NrU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KUlucHV0QmxvY2tTaXplKTsKKyAgICAgICAgICAgICAgICBwTFZQU0FfSW5zdC0+c3BlY0JpcXVhZFtpaV0ucHJvY2VzcyhwU2NyYXRjaCArIElucHV0QmxvY2tTaXplLCBwU2NyYXRjaCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KUlucHV0QmxvY2tTaXplKTsKICAgICAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICAgICAgY2FzZSBMVlBTQV9Eb3VibGVQcmVjaXNpb25GaWx0ZXI6Ci0gICAgICAgICAgICAgICAgQlBfMUlfRDE2RjMyQzMwX1RSQ19XUkFfMDEgICggJnBMVlBTQV9JbnN0LT5wQlBfSW5zdGFuY2VzW2lpXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwU2NyYXRjaCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwU2NyYXRjaCArIElucHV0QmxvY2tTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpSW5wdXRCbG9ja1NpemUpOworICAgICAgICAgICAgICAgIHBMVlBTQV9JbnN0LT5zcGVjQmlxdWFkW2lpXS5wcm9jZXNzKHBTY3JhdGNoICsgSW5wdXRCbG9ja1NpemUsIHBTY3JhdGNoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpSW5wdXRCbG9ja1NpemUpOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogCi0gICAgICAgIExWUFNBX1FQRF9Qcm9jZXNzX0Zsb2F0ICAgKCBwTFZQU0FfSW5zdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoICsgSW5wdXRCbG9ja1NpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KUlucHV0QmxvY2tTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWkpOworICAgICAgICBMVlBTQV9RUERfUHJvY2Vzc19GbG9hdChwTFZQU0FfSW5zdCwgcFNjcmF0Y2ggKyBJbnB1dEJsb2NrU2l6ZSwgKExWTV9JTlQxNilJbnB1dEJsb2NrU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWkpOwogICAgIH0KIAogICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgICAgICBVUERBVEUgU3BlY3RyYWxEYXRhQnVmZmVyQXVkaW9UaW1lCiAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotICAgIGlmKHBMVlBTQV9JbnN0LT5wU3BlY3RyYWxEYXRhQnVmZmVyV3JpdGVQb2ludGVyICE9IHBXcml0ZV9TYXZlKQotICAgIHsKKyAgICBpZiAocExWUFNBX0luc3QtPnBTcGVjdHJhbERhdGFCdWZmZXJXcml0ZVBvaW50ZXIgIT0gcFdyaXRlX1NhdmUpIHsKICAgICAgICAgQXVkaW9UaW1lSW5jID0gbXVsdDMyeDMyaW4zMl9zaGlmdHIoCiAgICAgICAgICAgICAgICAgKEF1ZGlvVGltZSArICgoTFZNX0lOVDMyKXBMVlBTQV9JbnN0LT5Mb2NhbFNhbXBsZXNDb3VudCAqIDEwMDApKSwKICAgICAgICAgICAgICAgICAoTFZNX0lOVDMyKUxWUFNBX1NhbXBsZVJhdGVJbnZUYWJbcExWUFNBX0luc3QtPkN1cnJlbnRQYXJhbXMuRnNdLApAQCAtMTM5LDcgKzEyNCw3IEBACiAgICAgICAgIHBMVlBTQV9JbnN0LT5TcGVjdHJhbERhdGFCdWZmZXJBdWRpb1RpbWUgPSBBdWRpb1RpbWUgKyBBdWRpb1RpbWVJbmM7CiAgICAgfQogCi0gICAgcmV0dXJuKExWUFNBX09LKTsKKyAgICByZXR1cm4gKExWUFNBX09LKTsKIH0KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTE2Miw5OSArMTQ3LDk1IEBACiAvKiAgb3RoZXJ3aXNlICAgICAgICAgICBFcnJvciBkdWUgdG8gYmFkIHBhcmFtZXRlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVlBTQV9SRVRVUk4gTFZQU0FfR2V0U3BlY3RydW0gICAgICAgKCBwTFZQU0FfSGFuZGxlX3QgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9UaW1lICAgICAgICAgICBHZXRTcGVjdHJ1bUF1ZGlvVGltZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UOCAgICAgICAgICAgKnBDdXJyZW50VmFsdWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQ4ICAgICAgICAgICAqcFBlYWtWYWx1ZXMgICAgICAgICAgICkKK0xWUFNBX1JFVFVSTiBMVlBTQV9HZXRTcGVjdHJ1bShwTFZQU0FfSGFuZGxlX3QgaEluc3RhbmNlLCBMVlBTQV9UaW1lIEdldFNwZWN0cnVtQXVkaW9UaW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UOCogcEN1cnJlbnRWYWx1ZXMsIExWTV9VSU5UOCogcFBlYWtWYWx1ZXMpCiAKIHsKKyAgICBMVlBTQV9JbnN0YW5jZVByX3QqIHBMVlBTQV9JbnN0ID0gKExWUFNBX0luc3RhbmNlUHJfdCopaEluc3RhbmNlOworICAgIExWTV9JTlQzMiBTdGF0dXNEZWx0YSwgaWk7CisgICAgTFZNX1VJTlQ4KiBwUmVhZDsKIAotICAgIExWUFNBX0luc3RhbmNlUHJfdCAgICAgICpwTFZQU0FfSW5zdCA9IChMVlBTQV9JbnN0YW5jZVByX3QqKWhJbnN0YW5jZTsKLSAgICBMVk1fSU5UMzIgICAgICAgICAgICAgICBTdGF0dXNEZWx0YSwgaWk7Ci0gICAgTFZNX1VJTlQ4ICAgICAgICAgICAgICAgKnBSZWFkOwotCi0gICAgaWYoaEluc3RhbmNlID09IExWTV9OVUxMIHx8IHBDdXJyZW50VmFsdWVzID09IExWTV9OVUxMIHx8IHBQZWFrVmFsdWVzID09IExWTV9OVUxMKQotICAgIHsKLSAgICAgICAgcmV0dXJuKExWUFNBX0VSUk9SX05VTExBRERSRVNTKTsKKyAgICBpZiAoaEluc3RhbmNlID09IExWTV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NX01JTklOVF8zMikgKworICAgICAgICAgICAgICAgICAoKExWTV9JTlQzMilMVk1fTUFYSU5UXzMyIC0gR2V0U3BlY3RydW1BdWRpb1RpbWUpKSwKKyAgICAgICAgICAgICAgICBMVlBTQV9JbnRlcm5hbFJlZnJlc2hUaW1lSW52LCBTdGF0dXNEZWx0YSwKKyAgICAgICAgICAgICAgICBMVlBTQV9JbnRlcm5hbFJlZnJlc2hUaW1lU2hpZnQpIGlmICgoKExWTV9JTlQzMikoU3RhdHVzRGVsdGEgKgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVlBTQV9JbnRlcm5hbFJlZnJlc2hUaW1lKSkgIT0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKExWTV9JTlQzMikoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocExWUFNBX0luc3QKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0+U3BlY3RyYWxEYXRhQnVmZmVyQXVkaW9UaW1lIC0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDMyKUxWTV9NSU5JTlRfMzIpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoTFZNX0lOVDMyKUxWTV9NQVhJTlRfMzIgLQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdldFNwZWN0cnVtQXVkaW9UaW1lKSkpKSB7CiAgICAgICAgICAgICBTdGF0dXNEZWx0YSArPSAxOwogICAgICAgICB9CiAgICAgfQogICAgIC8qIENoZWNrIHdoZXRoZXIgdGhlIGRlc2l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9saWIvU3BlY3RydW1BbmFseXplci9zcmMvTFZQU0FfUVBELmgKQEAgLTIwLDQxICsyMCwzNSBAQAogCiAjaW5jbHVkZSAiTFZNX1R5cGVzLmgiCiAKLXR5cGVkZWYgc3RydWN0Ci17Ci0gIExWTV9JTlQzMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqcERlbGF5OyAgICAgICAgLyogcG9pbnRlciB0byB0aGUgZGVsYXllZCBzYW1wbGVzIChkYXRhIG9mIDMyIGJpdHMpICAgKi8KLSAgTFZNX0lOVDMyICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvZWZzWzJdOyAgICAgICAvKiBwb2ludGVyIHRvIHRoZSBmaWx0ZXIgY29lZmZpY2llbnRzICovCi19UVBEX1N0YXRlX3QsICpwUVBEX1N0YXRlX3Q7Cit0eXBlZGVmIHN0cnVjdCB7CisgICAgTFZNX0lOVDMyKiBwRGVsYXk7ICAvKiBwb2ludGVyIHRvIHRoZSBkZWxheWVkIHNhbXBsZXMgKGRhdGEgb2YgMzIgYml0cykgICAqLworICAgIExWTV9JTlQzMiBDb2Vmc1syXTsgLyogcG9pbnRlciB0byB0aGUgZmlsdGVyIGNvZWZmaWNpZW50cyAqLworfSBRUERfU3RhdGVfdCwgKnBRUERfU3RhdGVfdDsKIAotdHlwZWRlZiBzdHJ1Y3QKLXsKK3R5cGVkZWYgc3RydWN0IHsKICAgICAvKiBwb2ludGVyIHRvIHRoZSBkZWxheWVkIHNhbXBsZXMgKGRhdGEgb2YgMzIgYml0cykgICAqLwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICAgICAgICAgICAqcERlbGF5OwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb2Vmc1syXTsgICAgICAgLyogcG9pbnRlciB0byB0aGUgZmlsdGVyIGNvZWZmaWNpZW50cyAqLwotfVFQRF9GTE9BVF9TdGF0ZV90LCAqcFFQRF9GTE9BVF9TdGF0ZV90OworICAgIExWTV9GTE9B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wc190OwpAQCAtNzIsMTUgKzY2LDExIEBACiAvKiBSRVRVUk5TOiAgICAgICAgICAgICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIExWUFNBX1FQRF9Qcm9jZXNzICggICAgICAgICAgICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgICAgICAgICpwSW5TYW1wcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bVNhbXBsZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgICAgICAgICBCYW5kSW5kZXgpOwordm9pZCBMVlBTQV9RUERfUHJvY2Vzcyh2b2lkKiBoSW5zdGFuY2UsIExWTV9JTlQxNiogcEluU2FtcHMsIExWTV9JTlQxNiBudW1TYW1wbGVzLAorICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgQmFuZEluZGV4KTsKIAotdm9pZCBMVlBTQV9RUERfUHJvY2Vzc19GbG9hdCAoICAgICAgdm9pZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAgICAgICAgICAqcEluU2FtcHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgICAgICAgICBudW1TYW1wbGVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICAgICAgICAgQmFuZEluZGV4KTsKK3ZvaWQgTFZQU0FfUVBEX1Byb2Nlc3NfRmxvYXQodm9pZCogaEluc3RhbmNlLCBMVk1fRkxPQVQqIHBJblNhbXBzLCBMVk1fSU5UMTYgbnVtU2FtcGxlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IEJhbmRJbmRleCk7CiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIEZVTkNUSU9OOiAgICAgICAgICAgIExWUFNBX1FQRF9Jbml0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC05NiwxMyArODYsOSBAQAogLyogUkVUVVJOUzogICAgIHZvaWQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBMVlBTQV9RUERfSW5pdCAoICAgUVBEX1N0YXRlX3QgICAgICAgKnBJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIFFQRF9UYXBzX3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uY3BwCkBAIC0zMiwyMCArMzIsMTUgQEAKIC8qIFJFVFVSTlM6ICAgICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLXZvaWQgTFZQU0FfUVBEX0luaXQgKCAgIHBRUERfU3RhdGVfdCAgICAgICBwUVBEX1N0YXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgUVBEX1RhcHNfdCAgICAgICAgKnBUYXBzLAotICAgICAgICAgICAgICAgICAgICAgICAgUVBEX0MzMl9Db2VmcyAgICAgKnBDb2VmICAgICApCi17Ci0gICAgcFFQRF9TdGF0ZS0+cERlbGF5ICA9IHBUYXBzLT5TdG9yYWdlOwotICAgIHBRUERfU3RhdGUtPkNvZWZzWzBdICA9IHBDb2VmLT5LUDsKLSAgICBwUVBEX1N0YXRlLT5Db2Vmc1sxXSAgPSBwQ29lZi0+S007Cit2b2lkIExWUFNBX1FQRF9Jbml0KHBRUERfU3RhdGVfdCBwUVBEX1N0YXRlLCBRUERfVGFwc190KiBwVGFwcywgUVBEX0MzMl9Db2VmcyogcENvZWYpIHsKKyAgICBwUVBEX1N0YXRlLT5wRGVsYXkgPSBwVGFwcy0+U3RvcmFnZTsKKyAgICBwUVBEX1N0YXRlLT5Db2Vmc1swXSA9IHBDb2VmLT5LUDsKKyAgICBwUVBEX1N0YXRlLT5Db2Vmc1sxXSA9IHBDb2VmLT5LTTsKIH0KIAotdm9pZCBMVlBTQV9RUERfSW5pdF9GbG9hdCAoICAgcFFQRF9GTE9BVF9TdGF0ZV90ICAgICAgIHBRUERfU3RhdGUsCi0gICAgICA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hL2xpYmVmZmVjdHMvbHZtL2xpYi9TcGVjdHJ1bUFuYWx5emVyL3NyYy9MVlBTQV9RUERfUHJvY2Vzcy5jcHAKQEAgLTM0LDE1ICszNCwxMSBAQAogLyogUkVUVVJOUzogICAgICAgICAgICAgdm9pZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBMVlBTQV9RUERfV3JpdGVQZWFrKCAgIHBMVlBTQV9JbnN0YW5jZVByX3QgICAgICAgcExWUFNBX0luc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQ4ICAgICAgICAgICAgICAgICAqKnBwV3JpdGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICBCYW5kSW5kZXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICBWYWx1ZSAgICk7Cit2b2lkIExWUFNBX1FQRF9Xcml0ZVBlYWsocExWUFNBX0luc3RhbmNlUHJfdCBwTFZQU0FfSW5zdCwgTFZNX1VJTlQ4KiogcHBXcml0ZSwgTFZNX0lOVDE2IEJhbmRJbmRleCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgVmFsdWUpOwogCi12b2lkIExWUFNBX1FQRF9Xcml0ZVBlYWtfRmxvYXQoICAgcExWUFNBX0luc3RhbmNlUHJfdCAgICAgICBwTFZQU0FfSW5zdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDggICAgICAgICAgICAgKipwcFdyaXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIEJhbmRJbmRleCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICBWYWx1ZSAgICk7Cit2b2lkIExWUFNBX1FQRF9Xcml0ZVBlYWtfRmxvYXQocExWUFNBX0luc3RhbmNlUHJfdCBwTFZQU0FfSW5zdCwgTFZNX1VJTlQ4KiogcHBXcml0ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgQmFuZEluZGV4LCBMVk1fRkxPQVQgVmFsdWUpOwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBGVU5DVElPTjogICAgICAgICAgICBMVlBTQV9RUERfUHJvY2VzcyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNTYsMzggKzUyLDM0IEBACiAvKiBSRVRVUk5TOiAgICAgICAgICAgICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIExWUFNBX1FQRF9Qcm9jZXNzX0Zsb2F0ICggICAgICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgICAgICAgICpwSW5TYW1wcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bVNhbXBsZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgICAgICAgICBCYW5kSW5kZXgpCi17Ci0KK3ZvaWQgTFZQU0FfUVBEX1Byb2Nlc3NfRmxvYXQodm9pZCogaEluc3RhbmNlLCBMVk1fRkxPQVQqIHBJblNhbXBzLCBMVk1fSU5UMTYgbnVtU2FtcGxlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IEJhbmRJbmRleCkgewogICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICAgICAgICBQQVJBTUVURVJTCiAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICBMVlBTQV9JbnN0YW5jZVByX3QgICAgICpwTFZQU0FfSW5zdCA9IChMVlBTQV9JbnN0YW5jZVByX3QqKWhJbnN0YW5jZTsKLSAgICBRUERfRkxPQVRfU3RhdGVfdCAqcFFQRFN0YXRlID0gIChRUERfRkxPQVRfU3RhdGVfdCopJnBMVlBTQV9JbnN0LT5wUVBEX1N0YXRlc1tCYW5kSW5kZXhdOworICAgIExWUFNBX0luc3RhbmNlUHJfdCogcExWUFNBX0luc3QgPSAoTFZQU0FfSW5zdGFuY2VQcl90KiloSW5zdGFuY2U7CisgICAgUVBEX0ZMT0FUX1N0YXRlX3QqIHBRUERTdGF0ZSA9IChRUERfRkxPQVRfU3RhdGVfdC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yogLSAxIHRvIGNvbXBlbnNhdGUgc2NhbGluZyBpbiBwcm9jZXNzIGZ1bmN0aW9uKi8KICAgICAgICAgWDAgPSAoKnBJblNhbXBzKSAqIHBMVlBTQV9JbnN0LT5wUG9zdEdhaW5zW0JhbmRJbmRleF07CiAgICAgICAgIHBJblNhbXBzID0gcEluU2FtcHMgKyBEb3duU2FtcGxpbmdGYWN0b3I7CiAKICAgICAgICAgLyogU2F0dXJhdGUgYW5kIHRha2UgYWJzb2x1dGUgdmFsdWUgKi8KLSAgICAgICAgaWYoWDAgPCAwLjBmKQotICAgICAgICAgICAgWDAgPSAtWDA7CisgICAgICAgIGlmIChYMCA8IDAuMGYpIFgwID0gLVgwOwogICAgICAgICBpZiAoWDAgPiAxLjBmKQogICAgICAgICAgICAgWGcwID0gMS4wZjsKICAgICAgICAgZWxzZQotICAgICAgICAgICAgWGcwID1YMDsKKyAgICAgICAgICAgIFhnMCA9IFgwOwogCiAgICAgICAgIC8qIFF1YXNpIHBlYWsgZmlsdGVyIGNhbGN1bGF0aW9uICovCi0gICAgICAgIEQwICA9IFhnMCAtIFYwOworICAgICAgICBEMCA9IFhnMCAtIFYwOwogCiAgICAgICAgIHRlbXAyID0gRDA7CiAKICAgICAgICAgYWNjdSA9IHRlbXAyICogS3A7Ci0gICAgICAgIEQwICAgID0gRDAgLyAyLjBmOwotICAgICAgICBpZiAoRDAgPCAwLjBmKXsKKyAgICAgICAgRDAgPSBEMCAvIDIuMGY7CisgICAgICAgIGlmIChEMCA8IDAuMGYpIHsKICAgICAgICAgICAgIEQwID0gLUQwOwogICAgICAgICB9CiAKQEAgLTEzMCwxNyArMTIwLDEzIEBACiAKICAgICAgICAgaWYgKGFjY3UgPiAxLjBmKQogICAgICAgICAgICAgYWNjdSA9IDEuMGY7Ci0gICAgICAgIGVsc2UgaWYoYWNjdSA8IDAuMGYpCisgICAgICAgIGVsc2UgaWYgKGFjY3UgPCAwLjBmKQogICAgICAgICAgICAgYWNjdSA9IDAuMGY7CiAKICAgICAgICAgVjAgPSBhY2N1OwogCi0gICAgICAgIGlmKCgocExWUFNBX0luc3QtPm5TYW1wbGVzQnVmZmVyVXBkYXRlIC0gQnVmZmVyVXBkYXRlU2FtcGxlc0NvdW50KSA8IERvd25TYW1wbGluZ0ZhY3RvcikpCi0gICAgICAgIHsKLSAgICAgICAgICAgIExWUFNBX1FQRF9Xcml0ZVBlYWtfRmxvYXQoIHBMVlBTQV9JbnN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBXcml0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJhbmRJbmRleCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFYwKTsKKyAgICAgICAgaWYgKCgocExWUFNBX0luc3QtPm5TYW1wbGVzQnVmZmVyVXBkYXRlIC0gQnVmZmVyVXBkYXRlU2FtcGxlc0NvdW50KSA8IERvd25TYW1wbGluZ0ZhY3RvcikpIHsKKyAgICAgICAgICAgIExWUFNBX1FQRF9Xcml0ZVBlYWtfRmxvYXQocExWUFNBX0luc3QsICZwV3JpdGUsIEJhbmRJbmRleCwgVjApOwogCiAgICAgICAgICAgICBCdWZmZXJVcGRhdGVTYW1wbGVzQ291bnQgLT0gcExWUFNBX0luc3QtPm5TYW1wbGVzQnVmZmVyVXBkYXRlOwogICAgICAgICAgICAgcExWUFNBX0luc3QtPkxvY2FsU2FtcGxlc0NvdW50ID0gKExWTV9VSU5UMTYpKG51bVNhbXBsZXMgLSBpaSk7CkBAIC0xNDgsNyArMTM0LDYgQEAKICAgICAgICAgQnVmZmVyVXBkYXRlU2FtcGxlc0NvdW50ICs9IERvd25TYW1wbGluZ0ZhY3RvcjsKIAogICAgICAgICBpaSA9IChMVk1fSU5UMTYpKGlpIC0gRG93blNhbXBsaW5nRmFjdG9yKTsKLQogICAgIH0KIAogICAgIC8qIFN0b3JlIGxhc3QgdGFwcyBpbiBtZW1vcnkgKi8KQEAg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ChwTFZQU0FfSW5zdC0+blNhbXBsZXNCdWZmZXJVcGRhdGUgPT0gMjIwKSB7CiAgICAgICAgICAgICAgICAgcExWUFNBX0luc3QtPm5TYW1wbGVzQnVmZmVyVXBkYXRlID0gMjIxOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgeworICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBwTFZQU0FfSW5zdC0+blNhbXBsZXNCdWZmZXJVcGRhdGUgPSAyMjA7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KQEAgLTE5NCwzNyArMTc0LDI5IEBACiAvKiBSRVRVUk5TOiAgICAgICAgICAgICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi12b2lkIExWUFNBX1FQRF9Xcml0ZVBlYWsoICAgcExWUFNBX0luc3RhbmNlUHJfdCAgICAgICBwTFZQU0FfSW5zdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDggICAgICAgICAgICAgKipwcFdyaXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIEJhbmRJbmRleCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBWYWx1ZSAgICkKLXsKLSAgICBMVk1fVUlOVDggKnBXcml0ZSA9ICpwcFdyaXRlOwordm9pZCBMVlBTQV9RUERfV3JpdGVQZWFrKHBMVlBTQV9JbnN0YW5jZVByX3QgcExWUFNBX0luc3QsIExWTV9VSU5UOCo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TFZQU0FfSW5zdC0+cFNwZWN0cmFsRGF0YUJ1ZmZlclN0YXJ0OwogICAgIH0KIApkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1NwZWN0cnVtQW5hbHl6ZXIvc3JjL0xWUFNBX1RhYmxlcy5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3BlY3RydW1BbmFseXplci9zcmMvTFZQU0FfVGFibGVzLmNwcAppbmRleCA5ZjBhYTAyLi40ZmJmZjZmIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3BlY3RydW1BbmFseXplci9zcmMvTFZQU0FfVGFibGVzLmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3BlY3RydW1BbmFseXplci9zcmMvTFZQU0FfVGFibGVzLmNwcApAQCAtMzQsMTkgKzM0LDkgQEAKICAqIFNhbXBsZSByYXRlIHRhYmxlIGZvciBjb252ZXJ0aW5nIGJldHdlZW4gdGhlIGVudW1lcmF0ZWQgdHlwZSBhbmQgdGhlIGFjdHVhbAogICogZnJlcXVlbmN5CiAgKi8KLWNvbnN0IExWTV9VSU5UMzIgICAgTFZQU0FfU2FtcGxlUmF0ZVRhYltdID0geyAgIDgwMDAsICAgICAgICAgICAgICAgICAgICAvKiA4a1MvcyAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDExMDI1LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNjAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIyMDUwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjQwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMjAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0MTAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDgwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4ODIwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDk2MDAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNzY0MDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5MjAwMH07ICAgICAgICAgICAgICAgICAgLyogMTkya1MvcyAqLworY29uc3QgTFZNX1VJTlQzMiBMVlBTQV9TYW1wbGVSYXRlVGFiW10gPSB7ODAwMCwgLyogOGtTL3MgICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMTAyNSwgMTIwMDAsIDE2MDAwLCAyMjA1MCwgMjQwMDAsICAzMjAwMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0MTAwLCA0ODAwMCwgODgyMDAsIDk2MDAwLCAxNzY0MDAsIDE5MjAwMH07IC8qIDE5MmtTL3MgKi8KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC01OCwyMCArNDgsMTEgQEAKICAqIFNhbXBsZSByYXRlIHRhYmxlIGZvciBjb252ZXJ0aW5nIGJldHdlZW4gdGhlIGVudW1lcmF0ZWQgdHlwZSBhbmQgdGhlIGFjdHVhbAogICogZnJlcXVlbmN5CiAgKi8KLWNvbnN0IExWTV9VSU5UMzIgICAgTFZQU0FfU2FtcGxlUmF0ZUludlRhYltdID0geyAgICAyNjg0MzUsICAgICAgICAgICAgICAgICAgICAvKiA4a1MvcyAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOTQ3ODMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTc4OTU3LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEzNDIxOCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5NzM5MSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4OTQ3OCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2NzEwOSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0ODY5NiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDczOQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwyNDM0OAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwyMjM2OQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwxMjE3NAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwxMTE4NSAgICAgICAgICAgICAgICAgIC8qIDE5MmtTL3MgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKK2NvbnN0IExWTV9VSU5UMzIgTFZQU0FfU2FtcGxlUmF0ZUludlRhYltdID0geworICAgICAgICAyNjg0MzUsIC8qIDhrUy9zICAqLworICAgICAgICAxOTQ3ODMsIDE3ODk1NywgMTM0MjE4LCA5NzM5MSwgODk0NzgsIDY3MTA5LAorICAgICAgICA0ODY5NiwgIDQ0NzM5LCAgMjQzNDgsICAyMjM2OSwgMTIxNzQsIDExMTg1IC8qIDE5MmtTL3MgKi8KK307CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtODMsMjAgKzY0LDEwIEBACiAgKiBUYWJsZSBmb3IgY29udmVydGluZyBiZXR3ZWVuIHRoZSBlbnVtZXJhdGVkIHR5cGUgYW5kIHRoZSBudW1iZXIgb2Ygc2FtcGxlcwogICogZHVyaW5nIDIwbXMKICAqLwotY29uc3QgTFZNX1VJTlQxNiAgICBMVlBTQV9uU2FtcGxlc0J1ZmZlclVwZGF0ZVtdICA9IHsgICAxNjAsICAgICAgICAgICAgICAgICAgIC8qIDhrUy9zICAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMjAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI0MCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzIwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ4MCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjQwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4ODIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDk2MAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsMTc2NAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsMTkyMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsMzUyOAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsMzg0MCAgICAgICAgICAgICAgICAgIC8qIDE5MmtTL3MgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OworY29uc3QgTFZNX1VJTlQxNiBMVlBTQV9uU2FtcGxlc0J1ZmZlclVwZGF0ZVtdID0geworICAgICAgICAxNjAsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiA4a1MvcyAgKi8KKyAgICAgICAgMjIwLCAyNDAsIDMyMCwgNDQxLCA0ODAsIDY0MCwgODgyLCA5NjAsIDE3NjQsIDE5MjAsIDM1MjgsIDM4NDAgLyogMTkya1MvcyAqLworfTsKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogIERvd24gc2FtcGxpbmcgZmFjdG9ycyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTEwNiwyMCArNzcsMjUgQEAKIC8qCiAgKiBUYWJsZSBmb3IgY29udmVydGluZyBiZXR3ZWVuIHRoZSBlbnVtZXJhdGVkIHR5cGUgYW5kIHRoZSBkb3duIHNhbXBsaW5nIGZhY3RvcgogICovCi1jb25zdCBMVk1fVUlOVDE2ICAgIExWUFNBX0Rvd25TYW1wbGluZ0ZhY3RvcltdICA9IHsgICAgIDUsICAgICAgICAgICAgICAgICAgICAvKiA4MDAwICBTL3MgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsICAgICAgICAgICAgICAgICAgICAvKiAxMTAyNSBTL3MgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsICAgICAgICAgICAgICAgICAgICAvKiAxMjAwMCBTL3MgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLCAgICAgICAgICAgICAgICAgICAvKiAxNjAwMCBTL3MgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LCAgICAgICAgICAgICAgICAgICAvKiAyMjA1MCBTL3MgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE2LCAgICAgICAgICAgICAgICAgICAvKiAyNDAwMCBTL3MgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxLCAgICAgICAgICAgICAgICAgICAvKiAzMjAwMCBTL3MgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMwLCAgICAgICAgICAgICAgICAgICAvKiA0NDEwMCBTL3MgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMyICAgICAgICAgICAgICAgICAgICAvKiA0ODAwMCBTL3MgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLDYwICAgICAgICAgICAgICAgICAgIC8qIDg4MjAwIFMvcyAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsNjQgICAgICAgICAgICAgICAgICAgLyogOTYwMDAgUy9zICAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwxMjAgICAgICAgICAgICAgICAgICAvKiAxNzY0MDAgUy9zICAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwxMjggICAgICAgICAgICAgICAgICAvKjE5MjAwMCBTL3MgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07Citjb25zdCBMVk1fVUlOVDE2IExWUFNBX0Rvd25TYW1wbGluZ0ZhY3RvcltdID0geworICAgICAgICA1LCAgLyogODAwMCAgUy9zICAqLworICAgICAgICA3LCAgLyogMTEwMjUgUy9zICAqLworICAgICAgICA4LCAgLyogMTIwMDAgUy9zICAqLworICAgICAgICAxMCwgLyogMTYwMDAgUy9zICAqLworICAgICAgICAxNSwgLyogMjIwNTAgUy9zICAqLworICAgICAgICAxNiwgLyogMjQwMDAgUy9zICAqLworICAgICAgICAyMSwgLyogMzIwMDAgUy9zICAqLworICAgICAgICAzMCwgLyogNDQxMDAgUy9zICAqLworICAgICAgICAzMiAgLyogNDgwMDAgUy9zICAqLworICAgICAgICAsCisgICAgICAgIDYwIC8qIDg4MjAwIFMvcyAgKi8KKyAgICAgICAgLAorICAgICAgICA2NCAvKiA5NjAwMCBTL3MgICovCisgICAgICAgICwKKyAgICAgICAgMTIwIC8qIDE3NjQwMCBTL3MgICovCisgICAgICAgICwKKyAgICAgICAgMTI4IC8qMTkyMDAwIFMvcyAgKi8KK307CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMTMwLDEwMiArMTA2LDM0IEBACiAvKgogICogVGFibGUgZm9yIDIgKiBQaSAvIEZzCiAgKi8KLWNvbnN0IExWTV9JTlQxNiAgICAgTFZQU0FfVHdvUGlPbkZzVGFibGVbXSA9IHsgIDI2MzU0LCAgICAgIC8qIDhrUy9zICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOTEyMywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE3NTY5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTMxNzcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOTU2MSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4Nzg1LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDY1ODgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDc4MSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MzkyCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsMjM5MAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLDIxOTYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwxMTk1Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsMTA5OCAgICAvKiAxOTJrUy9zICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OworY29uc3QgTFZNX0lOVDE2IExWUFNBX1R3b1BpT25Gc1RhYmxlW10gPSB7CisgICAgICAgIDI2MzU0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogOGtTL3MgKi8KKyAgICAgICAgMTkxMjMsIDE3NTY5LCAxMzE3NywgOTU2MSwgODc4NSwgNjU4OCwgNDc4MSwgNDM5MiwgMjM5MCwgMjE5NiwgMTE5NSwgMTA5OCAvKiAxOTJrUy9zICovCit9OwogCi1jb25zdCBMVk1fRkxPQVQgICAgIExWUFNBX0Zsb2F0X1R3b1BpT25Gc1RhYmxlW10gPSB7ICAwLjgwNDI4NDdmLCAgICAgIC8qIDhrUy9zICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjU4MzYwNTRmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC41MzYxNzk2ZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuNDAyMTQyM2YsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjI5MTc4NzRmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4yNjgxMDUxZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMjAxMDU1OWYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjE0NTkwODlmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4xMzQwMzcyZgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsMC4wNzI5NDc2ZgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsMC4wNjcwMTg2ZgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsMC4wMzY0NzM4ZgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsMC4wMzM1MDkzZiAgICAvKiAxOTJrUy9zICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OworY29uc3QgTFZNX0ZMT0FUIExWUFNBX0Zsb2F0X1R3b1BpT25Gc1RhYmxlW10gPSB7CisgICAgICAgIDAuODA0Mjg0N2YsIC8qIDhrUy9zICovCisgICAgICAgIDAuNTgzNjA1NGYsIDAuNTM2MTc5NmYsIDAuNDAyMTQyM2YsIDAuMjkxNzg3NGYsIDAuMjY4MTA1MWYsIDAuMjAxMDU1OWYsCisgICAgICAgIDAuMTQ1OTA4OWYsIDAuMTM0MDM3MmYsIDAuMDcyOTQ3NmYsIDAuMDY3MDE4NmYsIDAuMDM2NDczOGYsIDAuMDMzNTA5M2YgLyogMTkya1MvcyAqLworfTsKIAogLyoKICAqIEdhaW4gdGFibGUKICAqLwotY29uc3QgTFZNX0lOVDE2ICAgICBMVlBTQV9HYWluVGFibGVbXSA9IHsgICAzNjQsICAgICAgICAgIC8qIC0xNWRCIGdhaW4gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDA4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NTgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUxNCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTc3LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2NDcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcyNiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgODE1LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5MTQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMjYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDExNTEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyOTIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE0NDksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE2MjYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE4MjUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwNDgsICAgICAgICAgLyogMGRCIGdhaW4gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjI5NywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjU3OCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjg5MiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzI0NSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzY0MSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDA5NiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDU4NCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTE0NCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTc3MiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjQ3NiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNzI2NiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgODE1MywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOTE0OCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAyNjQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDExNTc2fTsgICAgICAgIC8qICsxNWRCIGdhaW4gKi8KK2NvbnN0IExWTV9JTlQxNiBMVlBTQV9HYWluVGFibGVbXSA9IHszNjQsIC8qIC0xNWRCIGdhaW4gKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MDgsICA0NTgsICA1MTQsICA1NzcsICA2NDcsICA3MjYsICAgODE1LCAgOTE0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMjYsIDExNTEsIDEyOTIsIDE0NDksIDE2MjYsIDE4MjUsICAyMDQ4LCAvKiAwZEIgZ2FpbiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIyOTcsIDI1NzgsIDI4OTIsIDMyNDUsIDM2NDEsIDQwOTYsICA0NTg0LCA1MTQ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU3NzIsIDY0NzYsIDcyNjYsIDgxNTMsIDkxNDgsIDEwMjY0LCAxMTU3Nn07IC8qICsxNWRCIGdhaW4gKi8KIAotY29uc3QgTFZNX0ZMT0FUICBMVlBTQV9GbG9hdF9HYWluVGFibGVbXT17ICAwLjE3NzczNDM3NWYsICAgICAgICAgIC8qIC0xNWRCIGdhaW4gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4xOTkyMTg3NTBmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjIyMzYzMjgxMmYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMjUwOTc2NTYyZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4yODE3MzgyODFmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjMxNTkxNzk2OGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMzU0NDkyMTg3ZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4zOTc5NDkyMThmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjQ0NjI4OTA2MmYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuNTAwOTc2NTYyZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC41NjIwMTE3MThmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjYzMDg1OTM3NWYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuNzA3NTE5NTMxZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC43OTM5NDUzMTJmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjg5MTExMzI4MWYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMDAwMDAwMDAwZiwgICAgICAgICAvKiAwZEIgZ2FpbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjEyMTU4MjAzMWYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuMjU4Nzg5MDYyZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMS40MTIxMDkzNzVmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLjU4NDQ3MjY1NmYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEuNzc3ODMyMDMxZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMi4wMDAwMDAwMDBmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLjIzODI4MTI1MGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIuNTExNzE4NzUwZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMi44MTgzNTkzNzVmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLjE2MjEwOTM3NWYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMuNTQ3ODUxNTYyZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMy45ODA5NTcwMzFmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LjQ2Njc5Njg3NWYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUuMDExNzE4NzUwZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNS42NTIzNDM3NTBmfTsgICAgICAgIC8qICsxNWRCIGdhaW4gKi8KK2NvbnN0IExWTV9GTE9BVCBMVlBTQV9GbG9hdF9HYWluVGFibGVbXSA9IHsKKyAgICAgICAgMC4xNzc3MzQzNzVmLCAvKiAtMTVkQiBnYWluICovCisgICAgICAgIDAuMTk5MjE4NzUwZiwgMC4yMjM2MzI4MTJmLCAwLjI1MDk3NjU2MmYsIDAuMjgxNzM4MjgxZiwgMC4zMTU5MTc5NjhmLAorICAgICAgICAwLjM1NDQ5MjE4N2YsIDAuMzk3OTQ5MjE4ZiwgMC40NDYyODkwNjJmLCAwLjUwMDk3NjU2MmYsIDAuNTYyMDExNzE4ZiwKKyAgICAgICAgMC42MzA4NTkzNzVmLCAwLjcwNzUxOTUzMWYsIDAuNzkzOTQ1MzEyZiwgMC44OTExMTMyODFmLCAxLjAwMDAwMDAwMGYsIC8qIDBkQiBnYWluICovCisgICAgICAgIDEuMTIxNTgyMDMxZiwgMS4yNTg3ODkwNjJmLCAxLjQxMjEwOTM3NWYsIDEuNTg0NDcyNjU2ZiwgMS43Nzc4MzIwMzFmLAorICAgICAgICAyLjAwMDAwMDAwMGYsIDIuMjM4MjgxMjUwZiwgMi41MTE3MTg3NTBmLCAyLjgxODM1OTM3NWYsIDMuMTYyMTA5Mzc1ZiwKKyAgICAgICAgMy41NDc4NTE1NjJmLCAzLjk4MDk1NzAzMWYsIDQuNDY2Nzk2ODc1ZiwgNS4wMTE3MTg3NTBmLCA1LjY1MjM0Mzc1MGZ9OyAvKiArMTVkQiBnYWluICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICBDb3NvbmUgcG9seW5vbWlhbCBjb2VmZmljaWVudHMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0yNDEsMjAgKzE0OSwyMCBAQAogICogYSByYW5nZSBvZiAwIHRvIFBpLiBUaGUgb3V0cHV0IGlzIGluIHRoZSByYW5nZSAzMjc2NyB0byAtMzI3NjggcmVwcmVzZW50aW5nIHRoZSByYW5nZQogICogKzEuMCB0byAtMS4wCiAgKi8KLWNvbnN0IExWTV9JTlQxNiAgICAgTFZQU0FfQ29zQ29lZltdID0geyAzLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU2hpZnRzICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDA5NiwgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGEwICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTM2LCAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGExICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTE5NzI1LCAgICAgICAgICAgICAgICAgICAgICAgIC8qIGEyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTI2NzEsICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGEzICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjM3MzAsICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGE0ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTk0OTB9OyAgICAgICAgICAgICAgICAgICAgICAgIC8qIGE1ICovCi1jb25zdCBMVk1fRkxPQVQgICAgIExWUFNBX0Zsb2F0X0Nvc0NvZWZbXSA9IHsgMywgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNoaWZ0cyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMTI1MDAzOGYsICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBhMCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0wLjAwMTA5ODZmLCAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGExICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTAuNjAxOTc3NWYsICAgICAgICAgICAgICAgICAgICAgICAgLyogYTIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMC4wODE1MTQ5ZiwgICAgICAgICAgICAgICAgICAgICAgICAgLyogYTMgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjcyNDIwNDJmLCAgICAgICAgICAgICAgICAgICAgICAgICAvKiBhNCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0wLjI4OTYyMDZmfTsgICAgICAgICAgICAgICAgICAgICAgICAvKiBhNSAqLworY29uc3QgTFZNX0lOVDE2IExWUFNBX0Nvc0NvZWZbXSA9IHszLCAgICAgICAgICAgICAgICAgIC8qIFNoaWZ0cyAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MDk2LCAgICAgICAgICAgICAgIC8qIGEwICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0zNiwgICAgICAgICAgICAgICAgLyogYTEgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTE5NzI1LCAgICAgICAgICAgICAvKiBhMiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMjY3MSwgICAgICAgICAgICAgIC8qIGEzICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIzNzMwLCAgICAgICAgICAgICAgLyogYTQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTk0OTB9OyAgICAgICAgICAgICAvKiBhNSAqLworY29uc3QgTFZNX0ZMT0FUIExWUFNBX0Zsb2F0X0Nvc0NvZWZbXSA9IHszLCAgICAgICAgICAgIC8qIFNoaWZ0cyAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjEyNTAwMzhmLCAgIC8qIGEwICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0wLjAwMTA5ODZmLCAgLyogYTEgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTAuNjAxOTc3NWYsICAvKiBhMiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMC4wODE1MTQ5ZiwgIC8qIGEzICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuNzI0MjA0MmYsICAgLyogYTQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTAuMjg5NjIwNmZ9OyAvKiBhNSAqLwogLyoKICAqIENvZWZmaWNpZW50cyBmb3IgY2FsY3VsYXRpbmcgdGhlIGNvc2luZSBlcnJvciB3aXRoIHRoZSBlcXVhdGlvbjoKICAqCkBAIC0yNjksMTAxICsxNzcsMTAwIEBACiAgKgogICogQ29zKHgpID0gMS4wIC0gQ29zRXJyKHgpCiAgKi8KLWNvbnN0IExWTV9JTlQxNiAgICAgTFZQU0FfRFBDb3NDb2VmW10gPSB7ICAgMSwgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTaGlmdHMgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBhMCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtNiwgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGExICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE2NTg2LCAgICAgICAgICAgICAgICAgICAgICAgLyogYTIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTQ0fTsgICAgICAgICAgICAgICAgICAgICAgICAvKiBhMyAqLwotY29uc3QgTFZNX0ZMT0FUICAgIExWUFNBX0Zsb2F0X0RQQ29zQ29lZltdID0gezEuMGYsICAgICAgICAgICAgICAgICAgICAgICAgLyogU2hpZnRzICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wZiwgICAgICAgICAgICAgICAgICAgICAgICAvKiBhMCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0wLjAwMDA4MzExZiwgICAgICAgICAgICAgICAgIC8qIGExICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC41MDYxNzk5OWYsICAgICAgICAgICAgICAgICAvKiBhMiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0wLjAwMTM0MjgxZn07ICAgICAgICAgICAgICAgIC8qIGEzICovCitjb25zdCBMVk1fSU5UMTYgTFZQU0FfRFBDb3NDb2VmW10gPSB7MSwgICAgICAgICAgICAgICAgICAgLyogU2hpZnRzICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgICAgICAgICAgICAgICAgICAgLyogYTAgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtNiwgICAgICAgICAgICAgICAgICAvKiBhMSAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE2NTg2LCAgICAgICAgICAgICAgIC8qIGEyICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTQ0fTsgICAgICAgICAgICAgICAgLyogYTMgKi8KK2NvbnN0IExWTV9GTE9BVCBMVlBTQV9GbG9hdF9EUENvc0NvZWZbXSA9IHsxLjBmLCAgICAgICAgICAvKiBTaGlmdHMgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjBmLCAgICAgICAgICAvKiBhMCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0wLjAwMDA4MzExZiwgIC8qIGExICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC41MDYxNzk5OWYsICAgLyogYTIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMC4wMDEzNDI4MWZ9OyAvKiBhMyAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgUXVhc2kgcGVhayBmaWx0ZXIgY29lZmZpY2llbnRzIHRhYmxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1jb25zdCBRUERfQzMyX0NvZWZzICAgICBMVlBTQV9RUERfQ29lZnNbXSA9IHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogOGtTL3MgICovICAgIC8qIExWUFNBX1NQRUVEX0xPVyAgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBDRUZEMkIsMHgwMENCOUIxN30sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBEMjQyRTcsMHgwMENFRDExRH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBEQ0JBRjUsMHgwMEQ5MTY3OX0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBDRUZEMkIsMHgwMENCOUIxN30sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBFMTM3MzksMHgwMEREN0NEM30sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBEQ0JBRjUsMHgwMEQ5MTY3OX0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBEOTRCQUYsMHgwMEQ1QjdFN30sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBFMTM3MzksMHgwMEREN0NEM30sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBEQ0JBRjUsMHgwMEQ5MTY3OX0sICAvKiA0OGtTL3MgKi8KK2NvbnN0IFFQRF9DMzJfQ29lZnMgTFZQU0FfUVBEX0NvZWZzW10gPSB7CisgICAgICAgIC8qIDhrUy9zICAqLyAvKiBMVlBTQV9TUEVFRF9MT1cgICAqLworICAgICAgICB7KExWTV9JTlQzMikweDgwQ0VGRDJCLCAweDAwQ0I5QjE3fSwKKyAgICAgICAgeyhMVk1fSU5UMzIpMHg4MEQyNDJFNywgMHgwMENFRDExRH0sCisgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBEQ0JBRjUsIDB4MDBEOTE2Nzl9LAorICAgICAgICB7KExWTV9JTlQzMikweDgwQ0VGRDJCLCAweDAwQ0I5QjE3fSwKKyAgICAgICAgeyhMVk1fSU5UMzIpMHg4MEUxMzczOSwgMHgwMEREN0NEM30sCisgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBEQ0JBRjUsIDB4MDBEOTE2Nzl9LAorICAgICAgICB7KExWTV9JTlQzMikweDgwRDk0QkFGLCAweDAwRDVCN0U3fSwKKyAgICAgICAgeyhMVk1fSU5UMzIpMHg4MEUxMzczOSwgMHgwMEREN0NEM30sCisgICAgICAgIHsoTFZNX0lOVDMyKTB4ODBEQ0JBRjUsIDB4MDBEOTE2Nzl9LCAvKiA0OGtTL3MgKi8KIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiA4a1MvcyAgKi8gICAgLyogTFZQU0FfU1BFRURfTUVESVVNICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODU4NzUxM0QsMHgwNTVDMjJDRn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODU5RDI5NjcsMHgwNTcwRjAwN30sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODVFMkVGQUMsMHgwNUIzNEQ3OX0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODU4NzUxM0QsMHgwNTVDMjJDRn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODYwMEM3QjksMHgwNUNGQTZDRn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODVFMkVGQUMsMHgwNUIzNEQ3OX0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODVDQzEwMTgsMHgwNTlEOEY2OX0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODYwMEM3QjksMHgwNUNGQTZDRn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4ODVFMkVGQUMsMHgwNUIzNEQ3OX0sICAvKiA0OGtTL3MgKi8KKyAgICAgICAgLyogOGtTL3MgICovIC8qIExWUFNBX1NQRUVEX01FRElVTSAqLworICAgICAgICB7KExWTV9JTlQzMikweDg1ODc1MTNELCAweDA1NUMyMkNGfSwKKyAgICAgICAgeyhMVk1fSU5UMzIpMHg4NTlEMjk2NywgMHgwNTcwRjAwN30sCisgICAgICAgIHsoTFZNX0lOVDMyKTB4ODVFMkVGQUMsIDB4MDVCMzRENzl9LAorICAgICAgICB7KExWTV9JTlQzMikweDg1ODc1MTNELCAweDA1NUMyMkNGfSwKKyAgICAgICAgeyhMVk1fSU5UMzIpMHg4NjAwQzdCOSwgMHgwNUNGQTZDRn0sCisgICAgICAgIHsoTFZNX0lOVDMyKTB4ODVFMkVGQUMsIDB4MDVCMzRENzl9LAorICAgICAgICB7KExWTV9JTlQzMikweDg1Q0MxMDE4LCAweDA1OUQ4RjY5fSwKKyAgICAgICAgeyhMVk1fSU5UMzIpMHg4NjAwQzdCOSwgMHgwNUNGQTZDRn0sCisgICAgICAgIHsoTFZNX0lOVDMyKTB4ODVFMkVGQUMsIDB4MDVCMzRENzl9LCAvKiA0OGtTL3MgKi8KIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiA4a1MvcyAgKi8gICAvKiBMVlBTQV9TUEVFRF9ISUdIICAgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4QTExNUVBN0EsMHgxQ0RCM0Y1Q30sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4QTE4NDc1RjAsMHgxRDJDODNBMn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4QTJFMUU5NTAsMHgxRTJBNTMyRX0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4QTExNUVBN0EsMHgxQ0RCM0Y1Q30sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4QTM3NUIyQzYsMHgxRTk0M0JCQ30sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4QTJFMUU5NTAsMHgxRTJBNTMyRX0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4QTI2RkY2QkQsMHgxREQ4MTUzMH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4QTM3NUIyQzYsMHgxRTk0M0JCQ30sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsoTFZNX0lOVDMyKTB4QTJFMUU5NTAsMHgxRTJBNTMyRX19OyAvKiA0OGtTL3MgKi8KKyAgICAgICAgLyogOGtTL3MgICovIC8qIExWUFNBX1NQRUVEX0hJR0ggICAgKi8KKyAgICAgICAgeyhMVk1fSU5UMzIpMHhBMTE1RUE3QSwgMHgxQ0RCM0Y1Q30sCisgICAgICAgIHsoTFZNX0lOVDMyKTB4QTE4NDc1RjAsIDB4MUQyQzgzQTJ9LAorICAgICAgICB7KExWTV9JTlQzMikweEEyRTFFOTUwLCAweDFFMkE1MzJFfSwKKyAgICAgICAgeyhMVk1fSU5UMzIpMHhBMTE1RUE3QSwgMHgxQ0RCM0Y1Q30sCisgICAgICAgIHsoTFZNX0lOVDMyKTB4QTM3NUIyQzYsIDB4MUU5NDNCQkN9LAorICAgICAgICB7KExWTV9JTlQzMikweEEyRTFFOTUwLCAweDFFMkE1MzJFfSwKKyAgICAgICAgeyhMVk1fSU5UMzIpMHhBMjZGRjZCRCwgMHgxREQ4MTUzMH0sCisgICAgICAgIHsoTFZNX0lOVDMyKTB4QTM3NUIyQzYsIDB4MUU5NDNCQkN9LAorICAgICAgICB7KExWTV9JTlQzMikweEEyRTFFOTUwLCAweDFFMkE1MzJFfX07IC8qIDQ4a1MvcyAqLwogCi1jb25zdCBRUERfRkxPQVRfQ29lZnMgICAgIExWUFNBX1FQRF9GbG9hdF9Db2Vmc1tdID0geworY29uc3QgUVBEX0ZMT0FUX0NvZWZzIExWUFNBX1FQRF9GbG9hdF9Db2Vmc1tdID0gewogCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIDhrUy9zICAqLyAgICAvKiBMVlBTQV9TUEVFRF9MT1cgICAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuOTkzNjgzMTk4OTMyNTU4M2YsMC4wMDYyMTM1NTY1MDk0NjUwZn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45OTM1ODMzMzMyMTI4ODIzZiwwLjAwNjMxMTU0OTMzOTQ0MzRmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgey0wLjk5MzI2Mzg0NTc5NzYyODJmLDAuMDA2NjI0OTkzNDAyNTEwOWZ9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuOTkzNjgzMTk4OTMyNTU4M2YsMC4wMDYyMTM1NTY1MDk0NjUwZn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45OTMxMjY5NjE4NjgyNTYzZiwwLjAwNjc1OTI2NDk3MjA2MDlmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgey0wLjk5MzI2Mzg0NTc5NzYyODJmLDAuMDA2NjI0OTkzNDAyNTEwOWZ9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuOTkzMzY4NjYzMzU5NDMzNGYsMC4wMDY1MjIxNjcwMDgzNzAyZn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45OTMxMjY5NjE4NjgyNTYzZiwwLjAwNjc1OTI2NDk3MjA2MDlmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIDQ4a1MvcyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuOTkzMjYzODQ1Nzk3NjI4MmYsMC4wMDY2MjQ5OTM0MDI1MTA5Zn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45OTMxMjY5NjE4NjgyNTYzZiwwLjAwNjc1OTI2NDk3MjA2MDlmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgey0wLjk5MzI2Mzg0NTc5NzYyODJmLDAuMDA2NjI0OTkzNDAyNTEwOWZ9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuOTkzMTI2OTYxODY4MjU2M2YsMC4wMDY3NTkyNjQ5NzIwNjA5Zn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45OTMyNjM4NDU3OTc2MjgyZiwwLjAwNjYyNDk5MzQwMjUxMDlmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogOGtTL3MgICovICAgIC8qIExWUFNBX1NQRUVEX01FRElVTSAgICAgICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45NTY4MDc5NDI1OTUzMzI5ZiwwLjA0MTg3NDI2NjY5NTIzMTJmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgey0wLjk1NjE0MTMwNDY5MDM5MDhmLDAuMDQyNTA5MDgyMjM5MTIxMmZ9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuOTU0MDExOTU2MjI5ODA1OWYsMC4wNDQ1MzQzODE5NDQ2ODYyZn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45NTY4MDc5NDI1OTUzMzI5ZiwwLjA0MTg3NDI2NjY5NTIzMTJmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgey0wLjk1MzEwMTE5MTIwNDA0MTJmLDAuMDQ1Mzk5NTIzODA1ODI2OWZ9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuOTU0MDExOTU2MjI5ODA1OWYsMC4wNDQ1MzQzODE5NDQ2ODYyZn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45NTQ3MDk5OTU1Mzc5OTYzZiwwLjA0Mzg3MDg1NTU4ODQ2NTlmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vezB4ODYwMEM3QjksMHgwNUNGQTZDRn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45NTMxMDExOTEyMDQwNDEyZiwwLjA0NTM5OTUyMzgwNTgyNjlmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIDQ4a1MvcyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuOTU0MDExOTU2MjI5ODA1OWYsMC4wNDQ1MzQzODE5NDQ2ODYyZn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45NTMxMDExOTEyMDQwNDEyZiwwLjA0NTM5OTUyMzgwNTgyNjlmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgey0wLjk1NDAxMTk1NjIyOTgwNTlmLDAuMDQ0NTM0MzgxOTQ0Njg2MmZ9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuOTUzMTAxMTkxMjA0MDQxMmYsMC4wNDUzOTk1MjM4MDU4MjY5Zn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC45NTQwMTE5NTYyMjk4MDU5ZiwwLjA0NDUzNDM4MTk0NDY4NjJmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIDhrUy9zICAqLyAgIC8qIExWUFNBX1NQRUVEX0hJR0ggICAgICAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuNzQxNTE4Njc5MDc0OTQzMWYsMC4yMjU0NDA5MDI2MzU0NTUxZn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC43MzgxNDUxMjA0NDE5MTM2ZiwwLjIyNzkyMDk2NTI5MTU1OTdmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgey0wLjcyNzQ4MDczMTkwNDUwNjdmLDAuMjM1NjY2NjU0MDcyNzAxOWZ9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuNzQxNTE4Njc5MDc0OTQzMWYsMC4yMjU0NDA5MDI2MzU0NTUxZn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC43MjI5NzA2MzE5MDQ5MDAxZiwwLjIzODg5ODcyMjQ1NDkwNTVmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgey0wLjcyNzQ4MDczMTkwNDUwNjdmLDAuMjM1NjY2NjU0MDcyNzAxOWZ9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7LTAuNzMwOTU4MTM1MzMyOTEyMmYsMC4yMzMxNTY4MjI2MjE4MjI0Zn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHstMC43MjI5NzA2MzE5MDQ5MDAxZiwwLjIzODg5ODcyMjQ1NDkwNTVmfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiA0OGtTL3MgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgey0wLjcyNzQ4MDczMTkwNDUwNjdmLDAuMjM1NjY2NjU0MDcyNzAxOWZ9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLHstMC43MjI5NzA2MzE5MDQ5MDAxZiwwLjIzODg5ODcyMjQ1NDkwNTVmfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICx7LTAuNzI3NDgwNzMxOTA0NTA2N2YsMC4yMzU2NjY2NTQwNzI3MDE5Zn0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsey0wLjcyMjk3MDYzMTkwNDkwMDFmLDAuMjM4ODk4NzIyNDU0OTA1NWZ9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLHstMC43Mjc0ODA3MzE5MDQ1MDY3ZiwwLjIzNTY2NjY1NDA3MjcwMTlmfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CisgICAgICAgIC8qIDhrUy9zICAqLyAvKiBMVlBTQV9TUEVFRF9MT1cgICAqLworICAgICAgICB7LTAuOTkzNjgzMTk4OTMyNTU4M2YsIDAuMDA2MjEzNTU2NTA5NDY1MGZ9LAorICAgICAgICB7LTAuOTkzNTgzMzMzMjEyODgyM2YsIDAuMDA2MzExNTQ5MzM5NDQzNGZ9LAorICAgICAgICB7LTAuOTkzMjYzODQ1Nzk3NjI4MmYsIDAuMDA2NjI0OTkzNDA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L1NwZWN0cnVtQW5hbHl6ZXIvc3JjL0xWUFNBX1RhYmxlcy5oCkBAIC0yNyw3ICsyNyw3IEBACiAgKiBTYW1wbGUgcmF0ZSB0YWJsZSBmb3IgY29udmVydGluZyBiZXR3ZWVuIHRoZSBlbnVtZXJhdGVkIHR5cGUgYW5kIHRoZSBhY3R1YWwKICAqIGZyZXF1ZW5jeQogICovCi1leHRlcm4gY29uc3QgTFZNX1VJTlQzMiAgICBMVlBTQV9TYW1wbGVSYXRlVGFiW107CitleHRlcm4gY29uc3QgTFZNX1VJTlQzMiBMVlBTQV9TYW1wbGVSYXRlVGFiW107CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMzksNyArMzksNyBAQAogICogU2FtcGxlIHJhdGUgdGFibGUgZm9yIGNvbnZlcnRpbmcgYmV0d2VlbiB0aGUgZW51bWVyYXRlZCB0eXBlIGFuZCB0aGUgYWN0dWFsCiAgKiBmcmVxdWVuY3kKICAqLwotZXh0ZXJuIGNvbnN0IExWTV9VSU5UMzIgICAgTFZQU0FfU2FtcGxlUmF0ZUludlRhYltdOworZXh0ZXJuIGNvbnN0IExWTV9VSU5UMzIgTFZQU0FfU2FtcGxlUmF0ZUludlRhYltdOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTUxLDcgKzUxLDcgQEAKICAqIFRhYmxlIGZvciBjb252ZXJ0aW5nIGJldHdlZW4gdGhlIGVudW1lcmF0ZWQgdHlwZSBhbmQgdGhlIG51bWJlciBvZiBzYW1wbGVzCiAgKiBkdXJpbmcgMjBtcwogICovCi1leHRlcm4gY29uc3QgTFZNX1VJTlQxNiAgICBMVlBTQV9uU2FtcGxlc0J1ZmZlclVwZGF0ZVtdOworZXh0ZXJuIGNvbnN0IExWTV9VSU5UMTYgTFZQU0FfblNhbXBsZXNCdWZmZXJVcGRhdGVbXTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC02Miw3ICs2Miw3IEBACiAvKgogICogVGFibGUgZm9yIGNvbnZlcnRpbmcgYmV0d2VlbiB0aGUgZW51bWVyYXRlZCB0eXBlIGFuZCB0aGUgZG93biBzYW1wbGluZyBmYWN0b3IKICAqLwotZXh0ZXJuIGNvbnN0IExWTV9VSU5UMTYgICAgTFZQU0FfRG93blNhbXBsaW5nRmFjdG9yW107CitleHRlcm4gY29uc3QgTFZNX1VJTlQxNiBMVlBTQV9Eb3duU2FtcGxpbmdGYWN0b3JbXTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC03MywxNCArNzMsMTQgQEAKIC8qCiAgKiBUYWJsZSBmb3IgMiAqIFBpIC8gRnMKICAqLwotZXh0ZXJuIGNvbnN0IExWTV9JTlQxNiAgICAgTFZQU0FfVHdvUGlPbkZzVGFibGVbXTsKLWV4dGVybiBjb25zdCBMVk1fRkxPQVQgICAgIExWUFNBX0Zsb2F0X1R3b1BpT25Gc1RhYmxlW107CitleHRlcm4gY29uc3QgTFZNX0lOVDE2IExWUFNBX1R3b1BpT25Gc1RhYmxlW107CitleHRlcm4gY29uc3QgTFZNX0ZMT0FUIExWUFNBX0Zsb2F0X1R3b1BpT25Gc1RhYmxlW107CiAKIC8qCiAgKiBHYWluIHRhYmxlCiAgKi8KLWV4dGVybiBjb25zdCBMVk1fSU5UMTYgICAgIExWUFNBX0dhaW5UYWJsZVtdOwotZXh0ZXJuIGNvbnN0IExWTV9GTE9BVCAgICAgTFZQU0FfRmxvYXRfR2FpblRhYmxlW107CitleHRlcm4gY29uc3QgTFZNX0lOVDE2IExWUFNBX0dhaW5UYWJsZVtdOworZXh0ZXJuIGNvbnN0IExWTV9GTE9BVCBMVlBTQV9GbG9hdF9HYWluVGFibGVbXTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC05Nyw4ICs5Nyw4IEBACiAgKiBhIHJhbmdlIG9mIDAgdG8gUGkuIFRoZSBvdXRwdXQgaXMgaW4gdGhlIHJhbmdlIDMyNzY3IHRvIC0zMjc2OCByZXByZXNlbnRpbmcgdGhlIHJhbmdlCiAgKiArMS4wIHRvIC0xLjAKICAqLwotZXh0ZXJuIGNvbnN0IExWTV9JTlQxNiAgICAgTFZQU0FfQ29zQ29lZltdOwotZXh0ZXJuIGNvbnN0IExWTV9GTE9BVCAgICAgTFZQU0FfRmxvYXRfQ29zQ29lZltdOworZXh0ZXJuIGNvbnN0IExWTV9JTlQxNiBMVlBTQV9Db3NDb2VmW107CitleHRlcm4gY29uc3QgTFZNX0ZMT0FUIExWUFNBX0Zsb2F0X0Nvc0NvZWZbXTsKIAogLyoKICAqIENvZWZmaWNpZW50cyBmb3IgY2FsY3VsYXRpbmcgdGhlIGNvc2luZSBlcnJvciB3aXRoIHRoZSBlcXVhdGlvbjoKQEAgLTExNCwxNSArMTE0LDE1IEBACiAgKgogICogQ29zKHgpID0gMS4wIC0gQ29zRXJyKHgpCiAgKi8KLWV4dGVybiBjb25zdCBMVk1fSU5UMTYgICAgIExWUFNBX0RQQ29zQ29lZltdOwotZXh0ZXJuIGNvbnN0IExWTV9GTE9BVCAgICBMVlBTQV9GbG9hdF9EUENvc0NvZWZbXTsKK2V4dGVybiBjb25zdCBMVk1fSU5UMTYgTFZQU0FfRFBDb3NDb2VmW107CitleHRlcm4gY29uc3QgTFZNX0ZMT0FUIExWUFNBX0Zsb2F0X0RQQ29zQ29lZltdOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICBRdWFzaSBwZWFrIGZpbHRlciBjb2VmZmljaWVudHMgdGFibGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLWV4dGVybiBjb25zdCBRUERfQzMyX0NvZWZzICAgICBMVlBTQV9RUERfQ29lZnNbXTsKLWV4dGVybiBjb25zdCBRUERfRkxPQVRfQ29lZnMgICAgIExWUFNBX1FQRF9GbG9hdF9Db2Vmc1tdOworZXh0ZXJuIGNvbnN0IFFQRF9DMzJfQ29lZnMgTFZQU0FfUVBEX0NvZWZzW107CitleHRlcm4gY29uc3QgUVBEX0ZMT0FUX0NvZWZzIExWUFNBX1FQRF9GbG9hdF9Db2Vmc1tdOwogCiAjZW5kaWYgLyogX19MVlBTQV9UQUJMRVNfSF9fICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvbGliL0xWQ1MuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9saWIvTFZDUy5oCmluZGV4IDBhZGZkMWIuLmZmZTc5MDIgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9saWIvTFZDUy5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9saWIvTFZDUy5oCkBAIC03MSwyMSArNzEsMTQgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLS8qIE1lbW9yeSB0YWJsZSAqLwotI2RlZmluZSBMVkNTX01FTVJFR0lPTl9QRVJTSVNURU5UX1NMT1dfREFUQSAgICAwICAgIC8qIE9mZnNldCB0byB0aGUgaW5zdGFuY2UgbWVtb3J5IHJlZ2lvbiAqLwotI2RlZmluZSBMVkNTX01FTVJFR0lPTl9QRVJTSVNURU5UX0ZBU1RfREFUQSAgICAxICAgIC8qIE9mZnNldCB0byB0aGUgcGVyc2lzdGVudCBkYXRhIG1lbW9yeSByZWdpb24gKi8KLSNkZWZpbmUgTFZDU19NRU1SRUdJT05fUEVSU0lTVEVOVF9G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AgMHgwMDAxICAgIC8qIENTIGhhcyBjb21wbGV0ZWQgc3dpdGNoIG9mZiAqLworI2RlZmluZSBMVkNTX0VWRU5UX05PTkUgMHgwMDAwICAgLyogTm90IGEgdmFsaWQgZXZlbnQgKi8KKyNkZWZpbmUgTFZDU19FVkVOVF9BTEdPRkYgMHgwMDAxIC8qIENTIGhhcyBjb21wbGV0ZWQgc3dpdGNoIG9mZiAqLwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtOTQsNzAgKzg3LDQ5IEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAogLyogSW5zdGFuY2UgaGFuZGxlICovCi10eXBlZGVmIHZvaWQgKkxWQ1NfSGFuZGxlX3Q7Cit0eXBlZGVmIHZvaWQqIExWQ1NfSGFuZGxlX3Q7CiAKIC8qIE9wZXJhdGluZyBtb2RlcyAqLwotdHlwZWRlZiBlbnVtCi17Ci0gICAgTFZDU19PRkYgPSAwLAotICAgIExWQ1NfT04gID0gMTUsCi0gICAgTFZDU19NQVggPSBMVk1fTUFYRU5VTQotfSBMVkNTX01vZGVzX2VuOwotCi0vKiBNZW1vcnkgVHlwZXMgKi8KLXR5cGVkZWYgZW51bQotewotICAgIExWQ1NfU0NSQVRDSCAgICAgICAgPSAwLAotICAgIExWQ1NfREFUQSAgICAgICAgICAgPSAxLAotICAgIExWQ1NfQ09FRkZJQ0lFTlQgICAgPSAyLAotICAgIExWQ1NfUEVSU0lTVEVOVCAgICAgPSAzLAotICAgIExWQ1NfTUVNT1JZVFlQRV9NQVggPSBMVk1fTUFYRU5VTQotfSBMVkNTX01lbW9yeVR5cGVzX2VuOwordHlwZWRlZiBlbnVtIHsgTFZDU19PRkYgPSAwLCBMVkNTX09OID0gMTUsIExWQ1NfTUFYID0gTFZNX01BWEVOVU0gfSBMVkNTX01vZGVzX2VuOwogCiAvKiBGdW5jdGlvbiByZXR1cm4gc3RhdHVzICovCi10eXBlZGVmIGVudW0KLXsKLSAgICBMVkNTX1NVQ0NFU1MgICAgICAgID0gMCwgICAgICAgICAgICAgICAgICAgICAgICAvKiBTdWNjZXNzZnVsIHJldHVybiBmcm9tIGEgcm91dGluZSAqLwotICAgIExWQ1NfQUxJR05NRU5URVJST1IgPSAxLCAgICAgICAgICAgICAgICAgICAgICAgIC8qIE1lbW9yeSBhbGlnbm1lbnQgZXJyb3IgKi8KLSAgICBMVkNTX05VTExBRERSRVNTICAgID0gMiwgICAgICAgICAgICAgICAgICAgICAgICAvKiBOVUxMIGFsbG9jYXRpb24gYWRkcmVzcyAqLwotICAgIExWQ1NfVE9PTUFOWVNBTVBMRVMgPSAzLCAgICAgICAgICAgICAgICAgICAgICAgIC8qIE1heGltdW0gYmxvY2sgc2l6ZSBleGNlZWRlZCAqLwotICAgIExWQ1NfSU5WQUxJREJVRkZFUiAgPSA0LCAgICAgICAgICAgICAgICAgICAgICAgIC8qIEludmFsaWQgYnVmZmVyIHByb2Nlc3NpbmcgcmVxdWVzdCAqLwotICAgIExWQ1NfU1RBVFVTTUFYICAgICAgPSBMVk1fTUFYRU5VTQordHlwZWRlZiBlbnVtIHsKKyAgICBMVkNTX1NVQ0NFU1MgPSAwLCAgICAgICAgLyogU3VjY2Vzc2Z1bCByZXR1cm4gZnJvbSBhIHJvdXRpbmUgKi8KKyAgICBMVkNTX05VTExBRERSRVNTID0gMSwgICAgLyogTlVMTCBhbGxvY2F0aW9uIGFkZHJlc3MgKi8KKyAgICBMVkNTX1RPT01BTllTQU1QTEVTID0gMiwgLyogTWF4aW11bSBibG9jayBzaXplIGV4Y2VlZG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otICAgIHZvaWQgICAgKnBUYWJsZTg7Cit0eXBlZGVmIHN0cnVjdCB7CisgICAgdm9pZCogcFRhYmxlMTsKKyAgICB2b2lkKiBwVGFibGUyOworICAgIHZvaWQqIHBUYWJsZTM7CisgICAgdm9pZCogcFRhYmxlNDsKKyAgICB2b2lkKiBwVGFibGU1OworICAgIHZvaWQqIHBUYWJsZTY7CisgICAgdm9pZCogcFRhYmxlNzsKKyAgICB2b2lkKiBwVGFibGU4OwogfSBMVkNTX0NTTVNfQ29lZl9UYWJsZXNfdDsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCkBAIC0xNjYsNDQgKzEzOCwyNiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotLyogTWVtb3J5IHJlZ2lvbiBkZWZpbml0aW9uICovCi10eXBlZGVmIHN0cnVjdAotewotICAgIExWTV9VSU5UMzIgICAgICAgICAgICAgIFNpemU7ICAgICAgICAgICAgICAgICAgIC8qIFJlZ2lvbiBzaXplIGluIGJ5dGVzICovCi0gICAgTFZDU19NZW1vcnlUeXBlc19lbiAgICAgVHlwZTsgICAgICAgICAgICAgICAgICAgLyogUmVnaW9uIHR5cGUgKi8KLSAgICB2b2lkICAgICAgICAgICAgICAgICAgICAqcEJhc2VBZGRyZXNzOyAgICAgICAgICAvKiBQb2ludGVyIHRvIHRoZSByZWdpb24gYmFzZSBhZGRyZXNzICovCi19IExWQ1NfTWVtb3J5UmVnaW9uX3Q7Ci0KLS8qIE1lbW9yeSB0YWJsZSBjb250YWluaW5nIHRoZSByZWdpb24gZGV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JhY2s7ICAgICAgICAgICAgICAgLyogQnVuZGxlIGNhbGxiYWNrICovCi0gICAgdm9pZCAgICAgICAgICAgICAgICAgICAgKnBCdW5kbGVJbnN0YW5jZTsgICAgICAgLyogQnVuZGxlIGluc3RhbmNlIGhhbmRsZSAqLworICAgIExWTV9DYWxsYmFjayBDYWxsQmFjazsgLyogQnVuZGxlIGNhbGxiYWNrICovCisgICAgdm9pZCogcEJ1bmRsZUluc3RhbmNlOyAvKiBCdW5kbGUgaW5zdGFuY2UgaGFuZGxlICovCiAKIH0gTFZDU19DYXBhYmlsaXRpZXNfdDsKIApAQCAtMjEzLDgyICsxNjcsNDQgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBGVU5DVElPTjogICAgICAgICAgICAgICAgTFZDU19NZW1vcnkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgVGhpcyBmdW5jdGlvbiBpcyB1c2VkIGZvciBtZW1vcnkgYWxsb2NhdGlvbiBhbmQgZnJlZS4gSXQgY2FuIGJlIGNhbGxlZCBpbiAgICAgICAgICAgKi8KLS8qICB0d28gd2F5czogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgIGhJbnN0YW5jZSA9IE5VTEwgICAgICAgICAgICAgICAgUmV0dXJucyB0aGUgbWVtb3J5IHJlcXVpcmVtZW50cyAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgaEluc3RhbmNlID0gSW5zdGFuY2UgaGFuZGxlICAgICBSZXR1cm5zIHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzIGFuZCAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbG9jYXRlZCBiYXNlIGFkZHJlc3NlcyBmb3IgdGhlIGluc3RhbmNlICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBXaGVuIHRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciBtZW1vcnkgYWxsb2NhdGlvbiAoaEluc3RhbmNlPU5VTEwpIGl0IGlzICAgICAgICAgICAqLwotLyogIHBhc3NlZCB0aGUgZGVmYXVsdCBjYXBhYmlsaXRpZXMsIG9mIHRoZXNlIG9ubHkgdGhlIGJ1ZmZlciBwcm9jZXNzaW5nIHNldHRpbmcgaXMgICAgICovCi0vKiAgdXNlZC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFdoZW4gY2FsbGVkIGZvciBtZW1vcnkgYWxsb2NhdGlvbiB0aGUgbWVtb3J5IGJhc2UgYWRkcmVzcyBwb2ludGVycyBhcmUgTlVMTCBvbiAgICAgICovCi0vKiAgcmV0dXJuLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFdoZW4gdGhlIGZ1bmN0aW9uIGlzIGNhbGxlZCBmb3IgZnJlZSAoaEluc3RhbmNlID0gSW5zdGFuY2UgSGFuZGxlKSB0aGUgICAgICAgICAgICAgICovCi0vKiAgY2FwYWJpbGl0aWVzIGFyZSBpZ25vcmVkIGFuZCB0aGUgbWVtb3J5IHRhYmxlIHJldHVybnMgdGhlIGFsbG9jYXRlZCBtZW1vcnkgYW5kICAgICAgKi8KLS8qICBiYXNlIGFkZHJlc3NlcyB1c2VkIGR1cmluZyBpbml0aWFsaXNhdGlvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2UgICAgICAgICAgICAgICBJbnN0YW5jZSBIYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBNZW1vcnlUYWJsZSAgICAgICAgICAgIFBvaW50ZXIgdG8gYW4gZW1wdHkgbWVtb3J5IGRlZmluaXRpb24gdGFibGUgICAgICAgICAgICAgICAgICovCi0vKiAgcENhcGFiaWxpdGllcyAgICAgICAgICAgUG9pbnRlciB0byB0aGUgZGVmYXVsdCBjYXBhYmlsaXRlcyAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZDU19TdWNjZXNzICAgICAgICAgICAgU3VjY2VlZGVkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgMS4gIFRoaXMgZnVuY3Rpb24gbWF5IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVkNTX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICBMVkNTX0luaXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBDcmVhdGUgYW5kIGluaXRpYWxpc2F0aW9uIGZ1bmN0aW9uIGZvciB0aGUgQ29uY2VydCBTb3VuZCBtb2R1bGUgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwaEluc3RhbmNlICAgICAgICAgICAgICBQb2ludGVyIHRvIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgcENhcGFiaWxpdGllcyAgICAgICAgICAgUG9pbnRlciB0byB0aGUgY2FwYWJpbGl0aWVzIHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAqLworLyogIHBTY3JhdGNoICAgICAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIHNjcmF0Y2ggYnVmZmVyICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIExWQ1NfU3VjY2VzcyAgICAgICAgICAgIEluaXRpYWxpc2F0aW9uIHN1Y2NlZWRlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBMVkRCRV9OVUxMQUREUkVTUyAgICAgICBPbmUgb3IgbW9yZSBtZW1vcnkgaGFzIGEgTlVMTCBwb2ludGVyICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAxLiAgVGhpcyBmdW5jdGlvbiBtdXN0IG5vdCBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZDU19Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK0xWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfSW5pdChMVkNTX0hhbmRsZV90KiBwaEluc3RhbmNlLCBMVkNTX0NhcGFiaWxpdGllc190KiBwQ2FwYWJpbGl0aWVzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQqIHBTY3JhdGNoKTsKIAotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19NZW1vcnkoTFZDU19IYW5kbGVfdCAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX01lbVRhYl90ICAgICAgICAgICpwTWVtb3J5VGFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX0NhcGFiaWxpdGllc190ICAgICpwQ2FwYWJpbGl0aWVzKTsKLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICBMVkNTX0luaXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBERVNDUklQVElPTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBDcmVhdGUgYW5kIGluaXRpYWxpc2F0aW9uIGZ1bmN0aW9uIGZvciB0aGUgQ29uY2VydCBTb3VuZCBtb2R1bGUgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgVGhpcyBmdW5jdGlvbiBjYW4gYmUgdXNlZCB0byBjcmVhdGUgYW4gYWxnb3JpdGhtIGluc3RhbmNlIGJ5IGNhbGxpbmcgd2l0aCAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2Ugc2V0IHRvIE5VTEwuIEluIHRoaXMgY2FzZSB0aGUgYWxnb3JpdGhtIHJldHVybnMgdGhlIG5ldyBpbnN0YW5jZSAgICAgICAgICAqLwotLyogIGhhbmRsZS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBUaGlzIGZ1bmN0aW9uIGNhbiBiZSB1c2VkIHRvIGZvcmNlIGEgZnVsbCByZS1pbml0aWFsaXNhdGlvbiBvZiB0aGUgYWxnb3JpdGhtICAgICAgICAqLwotLyogIGJ5IGNhbGxpbmcgd2l0aCBoSW5zdGFuY2UgPSBJbnN0YW5jZSBIYW5kbGUuIEluIHRoaXMgY2FzZSB0aGUgbWVtb3J5IHRhYmxlICAgICAgICAgICovCi0vKiAgc2hvdWxkIGJlIGNvcnJlY3QgZm9yIHRoZSBpbnN0YW5jZSwgdGhpcyBjYW4gYmUgZW5zdXJlZCBieSBjYWxsaW5nIHRoZSBmdW5jdGlvbiAgICAgKi8KLS8qICBMVkNTX01lbW9yeSBiZWZvcmUgY2FsbGluZyB0aGlzIGZ1bmN0aW9uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBQQVJBTUVURVJTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBoSW5zdGFuY2UgICAgICAgICAgICAgICBJbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBNZW1vcnlUYWJsZSAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgcENhcGFiaWxpdGllcyAgICAgICAgICAgUG9pbnRlciB0byB0aGUgaW5pdGlhbGlzYXRpb24gY2FwYWJpbGl0aWVzICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUkVUVVJOUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTFZDU19TdWNjZXNzICAgICAgICAgICAgSW5pdGlhbGlzYXRpb24gc3VjY2VlZGVkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBMVkNTX0FsaWdubWVudEVycm9yICAgICBJbnN0YW5jZSBvciBzY3JhdGNoIG1lbW9yeSBvbiBpbmNvcnJlY3QgYWxpZ25tZW50ICAgICAgICAgICAqLwotLyogIExWQ1NfTnVsbEFkZHJlc3MgICAgICAgIEluc3RhbmNlIG9yIHNjcmF0Y2ggbWVtb3J5IGhhcyBhIE5VTEwgcG9pbnRlciAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIDEuICBUaGUgaW5zdGFuY2UgaGFuZGxlIGlzIHRoZSBwb2ludGVyIHRvIHRoZSBiYXNlIGFkZHJlc3Mgb2YgdGhlIGZpcnN0IG1lbW9yeSAgICAgICovCi0vKiAgICAgIHJlZ2lvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAyLiAgVGhpcyBmdW5jdGlvbiBtdXN0IG5vdCBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZDU19Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19Jbml0KExWQ1NfSGFuZGxlX3QgICAgICAgICAgICAqcGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX01lbVRhYl90ICAgICAgICAgICAgKnBNZW1vcnlUYWJsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX0NhcGFiaWxpdGllc190ICAgICAgKnBDYXBhYmlsaXRpZXMpOworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKy8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBGVU5DVElPTjogICAgICAgICAgICAgICAgTFZDU19EZUluaXQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgRnJlZSBtZW1vcmllcyBjcmVhdGVkIGR1cmluZyB0aGUgTFZDU19Jbml0IGNhbGwgaW5jbHVkaW5nIGluc3RhbmNlIGhhbmRsZSAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgcGhJbnN0YW5jZSAgICAgICAgICAgICAgUG9pbnRlciB0byBpbnN0YW5jZSBoYW5kbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgMS4gIFRoaXMgZnVuY3Rpb24gbXVzdCBub3QgYmUgaW50ZXJydXB0ZWQgYnkgdGhlIExWQ1NfUHJvY2VzcyBmdW5jdGlvbiAgICAgICAgICAqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCit2b2lkIExWQ1NfRGVJbml0KExWQ1NfSGFuZGxlX3QqIHBoSW5zdGFuY2UpOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMzEwLDggKzIyNiw3IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX0dldFBhcmFtZXRlcnMoTFZDU19IYW5kbGVfdCAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX1BhcmFtc190ICAgKnBQYXJhbXMpOworTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19HZXRQYXJhbWV0ZXJzKExWQ1NfSGFuZGxlX3QgaEluc3RhbmNlLCBMVkNTX1BhcmFtc190KiBwUGFyYW1zKTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTMzMiw4ICsyNDcsNyBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19Db250cm9sKExWQ1NfSGFuZGxlX3QgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX1BhcmFtc190ICAgICAqcFBhcmFtcyk7CitMVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX0NvbnRyb2woTFZDU19IYW5kbGVfdCBoSW5zdGFuY2UsIExWQ1NfUGFyYW1zX3QqIHBQYXJhbXMpOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMzU2LDkgKzI3MCw3IEBACiAvKiBOT1RFUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX1Byb2Nlc3MoTFZDU19IYW5kbGVfdCAgICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICAgICAqcEluRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICpwT3V0RGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgIE51bVNhbXBsZXMpOworTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19Qcm9jZXNzKExWQ1NfSGFuZGxlX3QgaEluc3RhbmNlLCBjb25zdCBMVk1fRkxPQVQqIHBJbkRhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiBwT3V0RGF0YSwgTFZNX1VJTlQxNiBOdW1TYW1wbGVzKTsKIAotI2VuZGlmICAvKiBMVkNTX0ggKi8KKyNlbmRpZiAvKiBMVkNTX0ggKi8KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19CeXBhc3NNaXguY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX0J5cGFzc01peC5jcHAKaW5kZXggYmExNTJjMC4uZjgwNWZjYSAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX0J5cGFzc01peC5jcHAKKysrIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX0J5cGFzc01peC5jcHAKQEAgLTMyLDkgKzMyLDggQEAKIC8qICBGdW5jdGlvbiBQcm90b3R5cGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWTV9JTlQzMiBMVkNTX01peGVyQ2FsbGJhY2soICAgTFZDU19IYW5kbGVfdCAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAgICpwR2VuZXJhbFB1cnBvc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICBDYWxsYmFja1BhcmFtKTsKK0xWTV9JTlQzMiBMVkNTX01peGVyQ2FsbGJhY2soTFZDU19IYW5kbGVfdCBoSW5zdGFuY2UsIHZvaWQqIHBHZW5lcmFsUHVycG9zZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IENhbGxiYWNrUGFyYW0pOwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTY1LDI5ICs2NCwyMiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLUxWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfQnlwYXNzTWl4SW5pdChMVkNTX0hhbmRsZV90ICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX1BhcmFtc190ICAgICAgICpwUGFyYW1zKQotewotCi0gICAgTFZNX1VJTlQxNiAgICAgICAgICBPZmZzZXQ7Ci0gICAgTFZNX0ZMT0FUICAgICAgICAgICBHYWluOwotICAgIExWTV9GTE9BVCAgICAgICAgICAgQ3VycmVudDsKLSAgICBMVkNTX0luc3RhbmNlX3QgICAgICpwSW5zdGFuY2UgPSAoTFZDU19JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLSAgICBMVkNTX0J5cGFzc01peF90ICAgICpwQ29uZmlnICAgPSAoTFZDU19CeXBhc3NNaXhfdCAqKSZwSW5zdGFuY2UtPkJ5cGFzc01peDsKLSAgICBjb25zdCBHYWluX3QgICAgICAgICpwT3V0cHV0R2FpblRhYmxlOworTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19CeXBhc3NNaXhJbml0KExWQ1NfSGFuZGxlX3QgaEluc3RhbmNlLCBMVkNTX1BhcmFtc190KiBwUGFyYW1zKSB7CisgICAgTFZNX1VJTlQxNiBPZmZzZXQ7CisgICAgTFZNX0ZMT0FUIEdhaW47CisgICAgTFZNX0ZMT0FUIEN1cnJlbnQ7CisgICAgTFZDU19JbnN0YW5jZV90KiBwSW5zdGFuY2UgPSAoTFZDU19JbnN0YW5jZV90KiloSW5zdGFuY2U7CisgICAgTFZDU19CeXBhc3NNaXhfdCogcENvbmZpZyA9IChMVkNTX0J5cGFzc01peF90KikmcEluc3RhbmNlLT5CeXBhc3NNaXg7CisgICAgY29uc3QgR2Fpbl90KiBwT3V0cHV0R2FpblRhYmxlOwogCiAgICAgLyoKICAgICAgKiBTZXQgdGhlIHRyYW5zaXRpb24gZ2FpbgogICAgICAqLwotICAgIGlmICgocFBhcmFtcy0+T3BlcmF0aW5nTW9kZSA9PSBMVkNTX09OKSAmJgotICAgICAgICAocEluc3RhbmNlLT5iVGltZXJEb25lID09IExWTV9UUlVFKQotICAgICAgICAmJiAocEluc3RhbmNlLT5NU1RhcmdldDEgIT0gMHg3RkZGKSAvKiB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GVyX0luc3RhbmNlLk1peGVyU3RyZWFtWzFdLnBDYWxsQmFjayA9IExWQ1NfTWl4ZXJDYWxsYmFjazsKIAogICAgIC8qCkBAIC0xMzcsNDUgKzEzMCw0MiBAQAogICAgICAqIENvcnJlY3QgZ2FpbiBmb3IgdGhlIGVmZmVjdCBsZXZlbAogICAgICAqLwogICAgIHsKLSAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICBHYWluQ29ycmVjdDsKLSAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICBHYWluMTsKLSAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICBHYWluMjsKKyAgICAgICAgTFZNX0ZMT0FUIEdhaW5Db3JyZWN0OworICAgICAgICBMVk1fRkxPQVQgR2FpbjE7CisgICAgICAgIExWTV9GTE9BVCBHYWluMjsKIAogICAgICAgICBHYWluMSA9IExWQ19NaXhlcl9HZXRUYXJnZXQoJnBDb25maWctPk1peGVyX0luc3RhbmNlLk1peGVyU3RyZWFtWzBdKTsKICAgICAgICAgR2FpbjIgPSBMVkNfTWl4ZXJfR2V0VGFyZ2V0KCZwQ29uZmlnLT5NaXhlcl9JbnN0YW5jZS5NaXhlclN0cmVhbVsxXSk7CiAgICAgICAgIC8qCiAgICAgICAgICAqIENhbGN1bGF0ZSB0aGUgZ2FpbiBjb3JyZWN0aW9uCiAgICAgICAgICAqLwotICAgICAgICBpZiAocEluc3RhbmNlLT5QYXJhbXMuQ29tcHJlc3Nvck1vZGUgPT0gTFZNX01PREVfT04pCi0gICAgICAgIHsKLSAgICAgICAgR2FpbkNvcnJlY3QgPSAoTFZNX0ZMT0FUKSggIHBJbnN0YW5jZS0+Vm9sQ29ycmVjdC5HYWluTWluCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtICgoKExWTV9GTE9BVClwSW5zdGFuY2UtPlZvbENvcnJlY3QuR2Fpbk1pbiAqIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoTFZNX0ZMT0FUKXBJbnN0YW5jZS0+VHJhbnNpdGlvbkdhaW4pKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgKCgoTFZNX0ZMT0FUKXBJbnN0YW5jZS0+Vm9sQ29ycmVjdC5HYWluRnVsbCAqIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChMVk1fRkxPQVQpcEluc3RhbmNlLT5UcmFuc2l0aW9uR2FpbikpKSk7CisgICAgICAgIGlmIChwSW5zdGFuY2UtPlBhcmFtcy5Db21wcmVzc29yTW9kZSA9PSBMVk1fTU9ERV9PTikgeworICAgICAgICAgICAgR2FpbkNvcnJlY3QgPSAoTFZNX0ZMT0FUKShwSW5zdGFuY2UtPlZvbENvcnJlY3QuR2Fpbk1pbiAtCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoKExWTV9GTE9BVClwSW5zdGFuY2UtPlZvbENvcnJlY3QuR2Fpbk1pbiAqCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChMVk1fRkxPQVQpcEluc3RhbmNlLT5UcmFuc2l0aW9uR2FpbikpKSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoKExWTV9GTE9BVClwSW5zdGFuY2UtPlZvbENvcnJlY3QuR2FpbkZ1bGwgKgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoTFZNX0ZMT0FUKXBJbnN0YW5jZS0+VHJhbnNpdGlvbkdhaW4pKSkpOwogCi0gICAgICAgIC8qCi0gICAgICAgICAqIEFwcGx5IHRoZSBnYWluIGNvcnJlY3Rpb24KLSAgICAgICAgICovCi0gICAgICAgIEdhaW4xID0gKEdhaW4xICogR2FpbkNvcnJlY3QpOwotICAgICAgICBHYWluMiA9IChHYWluMiAqIEdhaW5Db3JyZWN0KTsKLQorICAgICAgICAgICAgLyoK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iAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZDU19CWVBBU1NfTUlYRVJfVEMsIHBQYXJhbXMtPlNhbXBsZVJhdGUsIDIpOwogICAgIH0KIAotICAgIHJldHVybihMVkNTX1NVQ0NFU1MpOwotCisgICAgcmV0dXJuIChMVkNTX1NVQ0NFU1MpOwogfQogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtMjA1LDM5ICsxOTUsMzEgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX0J5cGFzc01peGVyKExWQ1NfSGFuZGxlX3QgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICpwVW5wcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAqcE91dERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICAgICBOdW1TYW1wbGVzKQotewotCi0gICAgTFZDU19JbnN0YW5jZV90ICAgICAqcEluc3RhbmNlICAgICAgPSAoTFZDU19JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLSAgICBMVkNTX0J5cGFzc01peF90ICA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ICovCi0gICAgICAgIExWQ19NaXhTb2Z0XzJTdF9EMTZDMzFfU0FUKCZwQ29uZmlnLT5NaXhlcl9JbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFByb2Nlc3NlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCAqKSBwVW5wcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXREYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KSgyICogTnVtU2FtcGxlcykpOworICAgICAgICBMVkNfTWl4U29mdF8yU3RfRDE2QzMxX1NBVCgmcENvbmZpZy0+TWl4ZXJfSW5zdGFuY2UsIHBQcm9jZXNzZWQsIChMVk1fRkxPQVQqKXBVbnByb2Nlc3NlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsIChMVk1fSU5UMTYpZGVzdE51bVNhbXBsZXMpOwogICAgICAgICAvKgogICAgICAgICAgKiBBcHBseSBvdXRwdXQgZ2FpbiBjb3JyZWN0aW9uIHNoaWZ0CiAgICAgICAgICAqLwotICAgICAgICBTaGlmdF9TYXRfRmxvYXQoKExWTV9JTlQxNilwQ29uZmlnLT5PdXRwdXRfU2hpZnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUKilwT3V0RGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fRkxPQVQqKXBPdXREYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoMiAqIE51bVNhbXBsZXMpKTsgICAgICAgICAgLyogTGVmdCBhbmQgcmlnaHQqLworICAgICAgICBTaGlmdF9TYXRfRmxvYXQoKExWTV9JTlQxNilwQ29uZmlnLT5PdXRwdXRfU2hpZnQsIChMVk1fRkxPQVQqKXBPdXREYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCopcE91dERhdGEsIChMVk1fSU5UMTYpZGVzdE51bVNhbXBsZXMpOwogICAgIH0KIAotICAgIHJldHVybihMVkNTX1NVQ0NFU1MpOworICAgIHJldHVybiAoTFZDU19TVUNDRVNTKTsKIH0KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTI0NSwyMiArMjI3LDE4IEBACiAvKiBGVU5DVElPTjogICAgICAgICAgICAgICAgTFZDU19NaXhlckNhbGxiYWNrICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVk1fSU5UMzIgTFZDU19NaXhlckNhbGxiYWNrKExWQ1NfSGFuZGxlX3QgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAgICAgICAqcEdlbmVyYWxQdXJwb3NlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9JTlQxNiAgICAgICAgICAgQ2FsbGJhY2tQYXJhbSkKLXsKLSAgICBMVkNTX0luc3RhbmNlX3QgICAgICpwSW5zdGFuY2UgPSAoTFZDU19JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKK0xWTV9JTlQzMiBMVkNTX01peGVyQ2FsbGJhY2soTFZDU19IYW5kbGVfdCBoSW5zdGFuY2UsIHZvaWQqIHBHZW5lcmFsUHVycG9zZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0lOVDE2IENhbGxiYWNrUGFyYW0pIHsKKyAgICBMVkN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XRfU2hpZnQ7ICAgICAgICAgICAgICAvKiBDb3JyZWN0aW5nIGdhaW4gb3V0cHV0IHNoaWZ0ICovCiAKIH0gTFZDU19CeXBhc3NNaXhfdDsKIAotdHlwZWRlZiBzdHJ1Y3QKLXsKK3R5cGVkZWYgc3RydWN0IHsKICAgICAvKiBPdXRwdXQgZ2FpbiBzZXR0aW5ncywgR2FpbiA9IChMb3NzLzMyNzY4KSAqIDJeU2hpZnQgKi8KLSAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgIFNoaWZ0OyAgICAgICAgICAgICAgICAgICAgICAvKiBMZWZ0IHNoaWZ0cyByZXF1aXJlZCAqLwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgTG9zczsgICAgICAgICAgICAgICAgICAgICAgIC8qIExvc3MgcmVxdWlyZWQgKi8KLSAgICBMVk1fRkxPQVQgICAgICAgICAgICAgIFVucHJvY0xvc3M7ICAgICAgICAgICAgICAgICAvKiBVbnByb2Nlc3NlZCBwYXRoIGxvc3MgKi8KKyAgICBMVk1fVUlOVDE2IFNoaWZ0OyAgICAgLyogTGVmdCBzaGlmdHMgcmVxdWlyZWQgKi8KKyAgICBMVk1fRkxPQVQgTG9zczsgICAgICAgLyogTG9zcyByZXF1aXJlZCAqLworICAgIExWTV9GTE9BVCBVbnByb2NMb3NzOyAvKiBVbnByb2Nlc3NlZCBwYXRoIGxvc3MgKi8KIH0gR2Fpbl90OwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTU0LDEzICs1MiwxMCBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19CeXBhc3NNaXhJbml0KExWQ1NfSGFuZGxlX3QgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfUGFyYW1zX3QgICAgKnBQYXJhbXMpOworTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19CeXBhc3NNaXhJbml0KExWQ1NfSGFuZGxlX3QgaEluc3RhbmNlLCBMVkNTX1BhcmFtc190KiBwUGFyYW1zKTsKIAotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19CeXBhc3NNaXhlcihMVkNTX0hhbmRsZV90ICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBMVk1fRkxPQVQgICAgICAgKnBQcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAqdW5Qcm9jZXNzZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAqcE91dERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICBOdW1TYW1wbGVzKTsKK0xWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfQnlwYXNzTWl4ZXIoTFZDU19IYW5kbGVfdCBoSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogcFByb2Nlc3NlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUKiB1blByb2Nlc3NlZCwgTFZNX0ZMT0FUKiBwT3V0RGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiBOdW1TYW1wbGVzKTsKIAotI2VuZGlmICAvKiBCWVBBU1NNSVhfSCAqLworI2VuZGlmIC8qIEJZUEFTU01JWF9IICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfQ29udHJvbC5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfQ29udHJvbC5jcHAKaW5kZXggNTBkYjAzZC4uODlmMmYzYiAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX0NvbnRyb2wuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19Db250cm9sLmNwcApAQCAtNDUsMTUgKzQ1LDEyIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19HZXRQYXJhbWV0ZXJzKExWQ1NfSGFuZGxlX3QgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZDU19QYXJhbXNfdCAgICpwUGFyYW1zKQotewotCi0gICAgTFZDU19JbnN0YW5jZV90ICAgICAqcEluc3RhbmNlID0oTFZDU19JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKK0xWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfR2V0UGFyYW1ldGVycyhMVkNTX0hhbmRsZV90IGhJbnN0YW5jZSwgTFZDU19QYXJhbXNfdCogcFBhcmFtcykgeworICAgIExWQ1NfSW5zdGFuY2VfdCogcEluc3RhbmNlID0gKExWQ1NfSW5zdGFuY2VfdCopaEluc3RhbmNlOwogCiAgICAgKnBQYXJhbXMgPSBwSW5zdGFuY2UtPlBhcmFtczsKIAotICAgIHJldHVybihMVkNTX1NVQ0NFU1MpOworICAgIHJldHVybiAoTFZDU19TVUNDRVNTKTsKIH0KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTc1LDM0ICs3MiwyOSBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLUxWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfQ29udHJvbChMVkNTX0hhbmRsZV90ICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfUGFyYW1zX3QgICAgICAqcFBhcmFtcykKLXsKLSAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgT2Zmc2V0OwotICAgIExWQ1NfSW5zdGFuY2VfdCAgICAgICAgICAgICAqcEluc3RhbmNlID0oTFZDU19JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLSAgICBMVkNTX1JldHVyblN0YXR1c19lbiAgICAgICAgZXJyOwotICAgIExWQ1NfTW9kZXNfZW4gICAgICAgICAgICAgICBPcGVyYXRpbmdNb2RlU2F2ZSA9IHBJbnN0YW5jZS0+UGFyYW1zLk9wZXJhdGluZ01vZGU7CitMVkNTX1JldHVybl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hbVswXSwKLSAgICAgICAgICAgICAgICAgICAgTFZDU19CWVBBU1NfTUlYRVJfVEMsIHBQYXJhbXMtPlNhbXBsZVJhdGUsIDIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX0JZUEFTU19NSVhFUl9UQywgcFBhcmFtcy0+U2FtcGxlUmF0ZSwgMik7CiAgICAgICAgICAgICBMVkNfTWl4ZXJfVmFyU2xvcGVfU2V0VGltZUNvbnN0YW50KCZwSW5zdGFuY2UtPkJ5cGFzc01peC5NaXhlcl9JbnN0YW5jZS5NaXhlclN0cmVhbVsxXSwKLSAgICAgICAgICAgICAgICAgICAgTFZDU19CWVBBU1NfTUlYRVJfVEMsIHBQYXJhbXMtPlNhbXBsZVJhdGUsIDIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX0JZUEFTU19NSVhFUl9UQywgcFBhcmFtcy0+U2FtcGxlUmF0ZSwgMik7CiAgICAgICAgIH0KIAotICAgICAgICBlcnI9TFZDU19TRW5oYW5jZXJJbml0KGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQYXJhbXMpOworICAgICAgICBlcnIgPSBMVkNTX1NFbmhhbmNlckluaXQoaEluc3RhbmNlLCBwUGFyYW1zKTsKIAotICAgICAgICBlcnI9TFZDU19SZXZlcmJHZW5lcmF0b3JJbml0KGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQYXJhbXMpOworICAgICAgICBlcnIgPSBMVkNTX1JldmVyYkdlbmVyYXRvckluaXQoaEluc3RhbmNlLCBwUGFyYW1zKTsKIAotICAgICAgICBlcnI9TFZDU19FcXVhbGlzZXJJbml0KGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQYXJhbXMpOworICAgICAgICBlcnIgPSBMVkNTX0VxdWFsaXNlckluaXQoaEluc3RhbmNlLCBw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VHlwZSArIHBQYXJhbXMtPlNvdXJjZUZvcm1hdCooMStMVkNTX0VYX0hFQURQSE9ORVMpKTsKKyAgICAgICAgT2Zmc2V0ID0gKExWTV9JTlQxNikocFBhcmFtcy0+U3BlYWtlclR5cGUgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwUGFyYW1zLT5Tb3VyY2VGb3JtYXQgKiAoMSArIExWQ1NfRVhfSEVBRFBIT05FUykpOwogCiAgICAgICAgIHBJbnN0YW5jZS0+Vm9sQ29ycmVjdCA9IHBMVkNTX1ZvbENvcnJlY3RUYWJsZVtPZmZzZXRdOwogCiAgICAgICAgIC8qIFVwZGF0ZSB0aGUgZWZmZWN0IGxldmVsIGFuZCBhbHBoYS1taXhlciBnYWlucyAqLwotICAgICAgICBlcnI9TFZDU19CeXBhc3NNaXhJbml0KGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBQYXJhbXMpOworICAgICAgICBlcnIgPSBMVkNTX0J5cGFzc01peEluaXQoaEluc3RhbmNlLCBwUGFyYW1zKTsKIAotICAgICAgICBpZihlcnIgIT0gTFZDU19TVUNDRVNTKQotICAgICAgICB7CisgICAgICAgIGlmIChlcnIgIT0gTFZDU19TVUNDRVNTKSB7CiAgICAgICAgICAgICByZXR1cm4gZXJyOwogICAgICAgICB9Ci0gICAgfQotICAgIGVsc2UKLSAgICB7CisgICAgfSBlbHNlIHsKICAgICAgICAgcEluc3RhbmNlLT5QYXJhbXMgPSAqcFBhcmFtczsKICAgICB9CiAKQEAgLTE4OSw0MCArMTc0LDM4IEBACiAgICAgcEluc3RhbmNlLT5QYXJhbXMgPSAqcFBhcmFtczsKIAogICAgIC8qIFN0YXkgb24gdGhlIGN1cnJlbnQgb3BlcmF0aW5nIG1vZGUgdW50aWwgdGhlIHRyYW5zaXRpb24gaXMgZG9uZSAqLwotICAgIGlmKChwUGFyYW1zLT5PcGVyYXRpbmdNb2RlICE9IE9wZXJhdGluZ01vZGVTYXZlKSB8f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5U2l6ZSA8PCAzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHBJbnN0YW5jZS0+UmV2ZXJiZXJhdGlvbi5EZWxheVNpemUgPDwgMikgLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcEluc3RhbmNlLT5UaW1lclBhcmFtcy5TYW1wbGluZ1JhdGUpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSk7CisgICAgICAgICAgICBMVk1fVGltZXJfSW5pdCgmcEluc3RhbmNlLT5UaW1lckluc3RhbmNlLCAmcEluc3RhbmNlLT5UaW1lclBhcmFtcyk7CiAgICAgICAgIH0KIAogICAgICAgICAvKiBVcGRhdGUgdGhlIGVmZmVjdCBsZXZlbCBhbmQgYWxwaGEtbWl4ZXIgZ2FpbnMgKi8KLSAgICAgICAgZXJyPUxWQ1NfQnlwYXNzTWl4SW5pdChoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBwUGFyYW1zKTsKKyAgICAgICAgZXJyID0gTFZDU19CeXBhc3NNaXhJbml0KGhJbnN0YW5jZSwgcFBhcmFtcyk7CiAKICAgICAgICAgLyogQ2hhbmdlIHRyYW5zaXRpb24gYnlwYXNzIG1peGVyIHNldHRpbmdzIGlmIG5lZWRlZCBkZXBlbmRpbmcgb24gdHJhbnNpdGlvbiB0eXBlICovCi0gICAgICAgIGlmKHBQYXJhbXMtPk9wZXJhdGluZ01vZGUgIT0gTFZDU19PRkYpewotICAgICAgICAgICAgcEluc3RhbmNlLT5NU1RhcmdldDA9TFZNX01BWElOVF8xNjsKLSAgICAgICAgICAgIHBJbnN0YW5jZS0+TVNUYXJnZXQxPTA7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7CisgICAgICAgIGlmIChwUGFyYW1zLT5PcGVyYXRpbmdNb2RlICE9IExWQ1NfT0ZGKSB7CisgICAgICAgICAgICBwSW5zdGFuY2UtPk1TVGFyZ2V0MCA9IExWTV9NQVhJTlRfMTY7CisgICAgICAgICAgICBwSW5zdGFuY2UtPk1TVGFyZ2V0MSA9IDA7CisgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICBwSW5zdGFuY2UtPlBhcmFtcy5PcGVyYXRpbmdNb2RlID0gT3BlcmF0aW5nTW9kZVNhdmU7Ci0gICAgICAgICAgICBwSW5zdGFuY2UtPk1TVGFyZ2V0MT1MVk1fTUFYSU5UXzE2OwotICAgICAgICAgICAgcEluc3RhbmNlLT5NU1RhcmdldDA9MDsKKyAgICAgICAgICAgIHBJbnN0YW5jZS0+TVNUYXJnZXQxID0gTFZNX01BWElOVF8xNjsKKyAgICAgICAgICAgIHBJbnN0YW5jZS0+TVNUYXJnZXQwID0gMDsKICAgICAgICAgfQogCiAgICAgICAgIC8qIFNldCB0cmFuc2l0aW9uIGZsYWcgKi8KICAgICAgICAgcEluc3RhbmNlLT5iSW5PcGVyYXRpbmdNb2RlVHJhbnNpdGlvbiA9IExWTV9UUlVFOwogICAgIH0KIAotICAgIHJldHVybihMVkNTX1NVQ0NFU1MpOworICAgIHJldHVybiAoTFZDU19TVUNDRVNTKTsKIH0KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCkBAIC0yMzMsMTIgKzIxNiwxMSBAQAogLyogIENhbGxCYWNrIGZ1bmN0aW9uIG9mIHRoZSBUaW1lci4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotdm9pZCBMVkNTX1R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MDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfRXF1YWxpc2VyLmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfRXF1YWxpc2VyLmNwcApAQCAtMjEsNiArMjEsNyBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKKyNpbmNsdWRlIDxzeXN0ZW0vYXVkaW8uaD4KICNpbmNsdWRlICJMVkNTLmgiCiAjaW5jbHVkZSAiTFZDU19Qcml2YXRlLmgiCiAjaW5jbHVkZSAiTFZDU19FcXVhbGlzZXIuaCIKQEAgLTUzLDY4ICs1NCwzMSBAQAogLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19FcXVhbGlzZXJJbml0KExWQ1NfSGFuZGxlX3QgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfUGFyYW1zX3QgICAgICAgKnBQYXJhbXMpCi17CitMVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX0VxdWF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29lZmZzLkEyID0gKExWTV9GTE9BVCkgcEVxdWFsaXNlckNvZWZUYWJsZVtPZmZzZXRdLkEyOwotICAgICAgICBDb2VmZnMuQjEgPSAoTFZNX0ZMT0FUKS1wRXF1YWxpc2VyQ29lZlRhYmxlW09mZnNldF0uQjE7Ci0gICAgICAgIENvZWZmcy5CMiA9IChMVk1fRkxPQVQpLXBFcXVhbGlzZXJDb2VmVGFibGVbT2Zmc2V0XS5CMjsKLQotICAgICAgICBMb2FkQ29uc3RfRmxvYXQoKExWTV9JTlQxNikwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogVmFsdWUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fRkxPQVQgKikmcERhdGEtPkVxdWFsaXNlckJpcXVhZFRhcHMsIC8qIERlc3RpbmF0aW9uICovCi0gICAgICAgICAgICAgICAgICAgICAgICAvKiBOdW1iZXIgb2Ygd29yZHMgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fVUlOVDE2KShzaXplb2YocERhdGEtPkVxdWFsaXNlckJpcXVhZFRhcHMpIC8gc2l6ZW9mKExWTV9GTE9BVCkpKTsKLQotICAgICAgICBCUV8ySV9EMTZGMzJDc3NfVFJDX1dSQV8wMV9Jbml0KCZwQ29lZmZpY2llbnRzLT5FcXVhbGlzZXJCaXF1YWRJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcERhdGEtPkVxdWFsaXNlckJpcXVhZFRhcHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkNvZWZmcyk7Ci0KLSAgICAgICAgLyogQ2FsbGJhY2tzICovCi0gICAgICAgIHN3aXRjaChwRXF1YWxpc2VyQ29lZlRhYmxlW09mZnNldF0uU2NhbGUpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGNhc2UgMTM6Ci0gICAgICAgICAgICAgICAgcENvbmZpZy0+cEJpcXVhZENh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KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMTM1LDMwICs5OSwxNyBAQAogLyogIDEuICBBbHdheXMgcHJvY2Vzc2VzIGluIHBsYWNlLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19FcXVhbGlzZXIoTFZDU19IYW5kbGVfdCAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICpwSW5wdXRPdXRwdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2ICAgICAgICAgIE51bVNhbXBsZXMpCi17Ci0KLSAgICBMVkNTX0luc3RhbmNlX3QgICAgICpwSW5zdGFuY2UgPSAoTFZDU19JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLSAgICBMVkNTX0VxdWFsaXNlcl90ICAgICpwQ29uZmlnICAgPSAoTFZDU19FcXVhbGlzZXJfdCAgKikmcEluc3RhbmNlLT5FcXVhbGlzZXI7Ci0gICAgTFZDU19Db2VmZmljaWVudF90ICAqcENvZWZmaWNpZW50czsKLQotICAgIHBDb2VmZmljaWVudHMgPSAoTFZDU19Db2VmZmljaWVudF90ICopIFwKLSAgICAgICAgICAgICAg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ucHV0T3V0cHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgIHBJbnN0YW5jZS0+cEVxQmlxdWFkLT5wcm9jZXNzKHBJbnB1dE91dHB1dCwgcElucHV0T3V0cHV0LCBOdW1TYW1wbGVzKTsKICAgICB9CiAKLSAgICByZXR1cm4oTFZDU19TVUNDRVNTKTsKKyAgICByZXR1cm4gKExWQ1NfU1VDQ0VTUyk7CiB9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfRXF1YWxpc2VyLmggYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfRXF1YWxpc2VyLmgKaW5kZXggOTE4ZDkzMS4uNTIzNzM0NCAxMDA2NDQKLS0tIGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX0VxdWFsaXNlci5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19FcXVhbGlzZXIuaApAQCAtMjMsMjMgKzIzLDE0IEBACiAvKiAgICBTdHJ1Y3R1cmVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLS8qIEVxdWFsaXNlciBzdHJ1Y3R1cmUgKi8KLXR5cGVkZWYgc3RydWN0Ci17Ci0gICAgdm9pZCAoKnBCaXF1YWRDYWxsQmFjaykgKEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90KiwgTFZNX0ZMT0FUKiwgTFZNX0ZMT0FUKiwgTFZNX0lOVDE2KTsKLX0gTFZDU19FcXVhbGlzZXJfdDsKLQogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICBGdW5jdGlvbiBwcm90b3R5cGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLUxWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfRXF1YWxpc2VySW5pdChMVkNTX0hhbmRsZV90ICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX1BhcmFtc190ICAgICAgICpwUGFyYW1zKTsKLUxWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfRXF1YWxpc2VyKExWQ1NfSGFuZGxlX3QgICAgICAgICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgKnBJbnB1dE91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgICAgTnVtU2FtcGxlcyk7CitMVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX0VxdWFsaXNlckluaXQoTFZDU19IYW5kbGVfdCBoSW5zdGFuY2UsIExWQ1NfUGFyYW1zX3QqIHBQYXJhbXMpOworTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19FcXVhbGlzZXIoTFZDU19IYW5kbGVfdCBoSW5zdGFuY2UsIExWTV9GTE9BVCogcElucHV0T3V0cHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiBOdW1TYW1wbGVzKTsKIAotI2VuZGlmICAvKiBFUVVBTElTRVJfSCAqLworI2VuZGlmIC8qIEVRVUFMSVNFUl9IICovCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfSGVhZHBob25lX0NvZWZmcy5oIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX0hlYWRwaG9uZV9Db2VmZnMuaAppbmRleCBjN2VlMjMyLi42OWM0NmM2IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfSGVhZHBob25lX0NvZWZmcy5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19IZWFkcGhvbmVfQ29lZmZzLmgKQEAgLTI0LDIwMSArMjQsMjAxIEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qIFN0ZXJlbyBFbmhhbmNlciBjb2VmZmljaWVudHMgZm9yIDgwMDAgSHogc2FtcGxlIHJhdGUsIHNjYWxlZCB3aXRoIDAuMTYxMjU4ICovCi0jZGVmaW5lIENTX01JRERMRV84MDAwX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4yMjc3MjAKLSNkZWZpbmUgQ1NfTUlERExFXzgwMDBfQTEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yMTUxMjUpCi0jZGVmaW5lIENTX01JRERMRV84MDAwX0EyICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgQ1NfTUlERExFXzgwMDBfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC45MjE4OTkpCi0jZGVmaW5lIENTX01JRERMRV84MDAwX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgQ1NfTUlERExFXzgwMDBfU0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAxNQotI2RlZmluZSBDU19TSURFXzgwMDBfQTAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuNjExNDQxCi0jZGVmaW5lIENTX1NJREVfODAwMF9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMzgwMzQ0KQotI2RlZmluZSBDU19TSURFXzgwMDBfQTIgICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjIzMTA5NykKLSNkZWZpbmUgQ1NfU0lERV84MDAwX0IxICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC42MjI0NzApCi0jZGVmaW5lIENTX1NJREVfODAwMF9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMTMwNzU5KQotI2RlZmluZSBDU19TSURFXzgwMDBfU0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAgMTUKKyNkZWZpbmUgQ1NfTUlERExFXzgwMDBfQTAgMC4yMjc3MjAKKyNkZWZpbmUgQ1NfTUlERExFXzgwMDBfQTEgKC0wLjIxNTEyNSkKKyNkZWZpbmUgQ1NfTUlERExFXzgwMDBfQTIgMC4wMDAwMDAKKyNkZWZpbmUgQ1NfTUlERExFXzgwMDBfQjEgKC0wLjkyMTg5OSkKKyNkZWZpbmUgQ1NfTUlERExFXzgwMDBfQjIgMC4wMDAwMDAKKyNkZWZpbmUgQ1NfTUlERExFXzgwMDBfU0NBTEUgMTUKKyNkZWZpbmUgQ1NfU0lERV84MDAwX0EwIDAuNjExNDQxCisjZGVmaW5lIENTX1NJREVfODAwMF9BMSAoLTAuMzgwMzQ0KQorI2RlZmluZSBDU19TSURFXzgwMDBfQTIgKC0wLjIzMTA5NykKKyNkZWZpbmUgQ1NfU0lERV84MDAwX0IxICgtMC42MjI0NzApCisjZGVmaW5lIENTX1NJREVfODAwMF9CMiAoLTAuMTMwNzU5KQorI2RlZmluZSBDU19TSURFXzgwMDBfU0NBTEUgMTUKIAogLyogU3RlcmVvIEVuaGFuY2VyIGNvZWZmaWNpZW50cyBmb3IgMTEwMjVIeiBzYW1wbGUgcmF0ZSwgc2NhbGVkIHdpdGggMC4xNjI5NDMgKi8KLSNkZWZpbmUgQ1NfTUlERExFXzExMDI1X0EwICAgICAgICAgICAgICAgICAgICAgICAwLjIzMDgzOAotI2RlZmluZSBDU19NSURETEVfMTEwMjVfQTEgICAgICAgICAgICAgICAgICAgICAgKC0wLjIyMTU1OSkKLSNkZWZpbmUgQ1NfTUlERExFXzExMDI1X0EyICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBDU19NSURETEVfMTEwMjVfQjEgICAgICAgICAgICAgICAgICAgICAgKC0wLjk0MzA1NikKLSNkZWZpbmUgQ1NfTUlERExFXzExMDI1X0IyICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBDU19NSURETEVfMTEwMjVfU0NBTEUgICAgICAgICAgICAgICAgICAgIDE1Ci0jZGVmaW5lIENTX1NJREVfMTEwMjVfQTAgICAgICAgICAgICAgICAgICAgICAgICAgMC41NTczNzIKLSNkZWZpbmUgQ1NfU0lERV8xMTAyNV9BMSAgICAgICAgICAgICAgICAgICAgICAgICgtMC4zOTE0OTApCi0jZGVmaW5lIENTX1NJREVfMTEwMjVfQTIgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMTY1ODgxKQotI2RlZmluZSBDU19TSURFXzExMDI1X0IxICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjg4MDYwOCkKLSNkZWZpbmUgQ1NfU0lERV8xMTAyNV9CMiAgICAgICAgICAgICAgICAgICAgICAgICAwLjAzMjM5NwotI2RlZmluZSBDU19TSURFXzExMDI1X1NDQUxFICAgICAgICAgICAgICAgICAgICAgIDE1CisjZGVmaW5lIENTX01JRERMRV8xMTAyNV9BMCAwLjIzMDgzOAorI2RlZmluZSBDU19NSURETEVfMTEwMjVfQTEgKC0wLjIyMTU1OSkKKyNkZWZpbmUgQ1NfTUlERExFXzExMDI1X0EyIDAuMDAwMDAwCisjZGVmaW5lIENTX01JRERMRV8xMTAyNV9CMSAoLTAuOTQzMDU2KQorI2RlZmluZSBDU19NSURETEVfMTEwMjVfQjIgMC4wMDAwMDAKKyNkZWZpbmUgQ1NfTUlERExFXzExMDI1X1NDQUxFIDE1CisjZGVmaW5lIENTX1NJREVfMTEwMjVfQTAgMC41NTczNzIKKyNkZWZpbmUgQ1NfU0lERV8xMTAyNV9BMSAoLTAuMzkxNDkwKQorI2RlZmluZSBDU19TSURFXzExMDI1X0EyICgtMC4xNjU4ODEpCisjZGVmaW5lIENTX1NJREVfMTEwMjVfQjEgKC0wLjg4MDYwOCkKKyNkZWZpbmUgQ1NfU0lERV8xMTAyNV9CMiAwLjAzMjM5NworI2RlZmluZSBDU19TSURFXzExMDI1X1NDQUxFIDE1CiAKIC8qIFN0ZXJlbyBFbmhhbmNlciBjb2VmZmljaWVudHMgZm9yIDEyMDAwSHogc2FtcGxlIHJhdGUsIHNjYWxlZCB3aXRoIDAuMTYyMTkxICovCi0jZGVmaW5lIENTX01JRERMRV8xMjAwMF9BMCAgICAgICAgICAgICAgICAgICAgICAgIDAuMjI5OTMyCi0jZGVmaW5lIENTX01JRERMRV8xMjAwMF9BMSAgICAgICAgICAgICAgICAgICAgICAgKC0wLjIyMTQzNikKLSNkZWZpbmUgQ1NfTUlERExFXzEyMDAwX0EyICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgQ1NfTUlERExFXzEyMDAwX0IxICAgICAgICAgICAgICAgICAgICAgICAoLTAuOTQ3NjE2KQotI2RlZmluZSBDU19NSURETEVfMTIwMDBfQjIgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBDU19NSURETEVfMTIwMDBfU0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAxNQotI2RlZmluZSBDU19TSURFXzEyMDAwX0EwICAgICAgICAgICAgICAgICAgICAgICAgIDAuNTU4Mzk4Ci0jZGVmaW5lIENTX1NJREVfMTIwMDBfQTEgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMzkyMjExKQotI2RlZmluZSBDU19TSURFXzEyMDAwX0EyICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjE2NjE4NykKLSNkZWZpbmUgQ1NfU0lERV8xMjAwMF9CMSAgICAgICAgICAgICAgICAgICAgICAgICgtMC44OTI1NTApCi0jZGVmaW5lIENTX1NJREVfMTIwMDBfQjIgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMzI4NTYKLSNkZWZpbmUgQ1NfU0lERV8xMjAwMF9TQ0FMRSAgICAgICAgICAgICAgICAgICAgICAgICAgMTUKKyNkZWZpbmUgQ1NfTUlERExFXzEyMDAwX0EwIDAuMjI5OTMyCisjZGVmaW5lIENTX01JRERMRV8xMjAwMF9BMSAoLTAuMjIxNDM2KQorI2RlZmluZSBDU19NSURETEVfMTIwMDBfQTIgMC4wMDAwMDAKKyNkZWZpbmUgQ1NfTUlERExFXzEyMDAwX0IxICgtMC45NDc2MTYpCisjZGVmaW5lIENTX01JRERMRV8xMjAwMF9CMiAwLjAwMDAwMAorI2RlZmluZSBDU19NSURETEVfMTIwMDBfU0NBTEUgMTUKKyNkZWZpbmUgQ1NfU0lERV8xMjAwMF9BMCAwLjU1ODM5OAorI2RlZmluZSBDU19TSURFXzEyMDAwX0ExICgtMC4zOTIyMTEpCisjZGVmaW5lIENTX1NJREVfMTIwMDBfQTIgKC0wLjE2NjE4NykKKyNkZWZpbmUgQ1NfU0lERV8xMjAwMF9CMSAoLTAuODkyNTUwKQorI2RlZmluZSBDU19TSURFXzEyMDAwX0IyIDAuMDMyODU2CisjZGVmaW5lIENTX1NJREVfMTIwMDBfU0NBTEUgMTUKIAogLyogU3RlcmVvIEVuaGFuY2VyIGNvZWZmaWNpZW50cyBmb3IgMTYwMDBIeiBzYW1wbGUgcmF0ZSwgc2NhbGVkIHdpdGggMC4xNjIzNzEgKi8KLSNkZWZpbmUgQ1NfTUlERExFXzE2MDAwX0EwICAgICAgICAgICAgICAgICAgICAgICAwLjIzMDYzOAotI2RlZmluZSBDU19NSURETEVfMTYwMDBfQTEgICAgICAgICAgICAgICAgICAgICAgKC0wLjIyNDIzMikKLSNkZWZpbmUgQ1NfTUlERExFXzE2MDAwX0EyICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBDU19NSURETEVfMTYwMDBfQjEgICAgICAgICAgICAgICAgICAgICAgKC0wLjk2MDU1MCkKLSNkZWZpbmUgQ1NfTUlERExFXzE2MDAwX0IyICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBDU19NSURETEVfMTYwMDBfU0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAxNQotI2RlZmluZSBDU19TSURFXzE2MDAwX0EwICAgICAgICAgICAgICAgICAgICAgICAgIDAuNDk5Njk1Ci0jZGVmaW5lIENTX1NJREVfMTYwMDBfQTEgICAgICAgICAgICAgICAgICAgICAgICAoLTAuMzU1NTQzKQotI2RlZmluZSBDU19TSURFXzE2MDAwX0Ey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AgICAgICAgKC0wLjIyNDEyOCkKLSNkZWZpbmUgQ1NfTUlERExFXzIyMDUwX0EyICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBDU19NSURETEVfMjIwNTBfQjEgICAgICAgICAgICAgICAgICAgICAgKC0wLjk3MTI2MikKLSNkZWZpbmUgQ1NfTUlERExFXzIyMDUwX0IyICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBDU19NSURETEVfMjIwNTBfU0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAxNQotI2RlZmluZSBDU19TSURFXzIyMDUwX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAwLjQ0MDExMgotI2RlZmluZSBDU19TSURFXzIyMDUwX0ExICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4yNjEwOTYpCi0jZGVmaW5lIENTX1NJREVfMjIwNTBfQTIgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjE3OTAxNikKLSNkZWZpbmUgQ1NfU0lERV8yMjA1MF9CMSAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuMTE2Nzg2KQotI2RlZmluZSBDU19TSURFXzIyMDUwX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAwLjE4MjUwNwotI2RlZmluZSBDU19TSURFXzIyMDUwX1NDQUxFICAgICAgICAgICAgICAgICAgICAgICAgICAxNAorI2RlZmluZSBDU19NSURETEVfMjIwNTBfQTAgMC4yMjg3NDkKKyNkZWZpbmUgQ1NfTUlERExFXzIyMDUwX0ExICgtMC4yMjQxMjgpCisjZGVmaW5lIENTX01JRERMRV8yMjA1MF9BMiAwLjAwMDAwMAorI2RlZmluZSBDU19NSURETEVfMjIwNTBfQjEgKC0wLjk3MTI2MikKKyNkZWZpbmUgQ1NfTUlERExFXzIyMDUwX0IyIDAuMDAwMDAwCisjZGVmaW5lIENTX01JRERMRV8yMjA1MF9TQ0FMRSAxNQorI2RlZmluZSBDU19TSURFXzIyMDUwX0EwIDAuNDQwMTEyCisjZGVmaW5lIENTX1NJREVfMjIwNTBfQTEgKC0wLjI2MTA5NikKKyNkZWZpbmUgQ1NfU0lERV8yMjA1MF9BMiAoLTAuMTc5MDE2KQorI2RlZmluZSBDU19TSURFXzIyMDUwX0IxICgtMS4xMTY3ODYpCisjZGVmaW5lIENTX1NJREVfMjIwNTBfQjIgMC4xODI1MDcKKyNkZWZpbmUgQ1NfU0lERV8yMjA1MF9TQ0FMRSAxNAogCiAvKiBTdGVyZW8gRW5oYW5jZXIgY29lZmZpY2llbnRzIGZvciAyNDAwMEh6IHNhbXBsZSByYXRlLCBzY2FsZWQgd2l0aCAwLjE2MTg4MiAqLwotI2RlZmluZSBDU19NSURETEVfMjQwMDBfQTAgICAgICAgICAgICAgICAgICAgICAgICAgMC4yMzAzOTUKLSNkZWZpbmUgQ1NfTUlERExFXzI0MDAwX0ExICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjIyNjExNykKLSNkZWZpbmUgQ1NfTUlERExFXzI0MDAwX0EyICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIENTX01JRERMRV8yNDAwMF9CMSAgICAgICAgICAgICAgICAgICAgICAgICgtMC45NzM1NzMpCi0jZGVmaW5lIENTX01JRERMRV8yNDAwMF9CMiAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBDU19NSURETEVfMjQwMDBfU0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAxNQotI2RlZmluZSBDU19TSURFXzI0MDAwX0EwICAgICAgICAgICAgICAgICAgICAgICAgICAgMC40MTQ3NzAKLSNkZWZpbmUgQ1NfU0lERV8yNDAwMF9BMSAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjI4NzE4MikKLSNkZWZpbmUgQ1NfU0lERV8yNDAwMF9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjEyNzU4OCkKLSNkZWZpbmUgQ1NfU0lERV8yNDAwMF9CMSAgICAgICAgIC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AgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgQ1NfTUlERExFXzMyMDAwX0IxICAgICAgICAgICAgICAgICAgICAgICAgICgtMC45ODAxMjYpCi0jZGVmaW5lIENTX01JRERMRV8zMjAwMF9CMiAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgQ1NfTUlERExFXzMyMDAwX1NDQUxFICAgICAgICAgICAgICAgICAgICAgICAgMTUKLSNkZWZpbmUgQ1NfU0lERV8zMjAwMF9BMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjM2NDU3OQotI2RlZmluZSBDU19TSURFXzMyMDAwX0ExICAgICAgICAgICAgICAgICAgICAgICAgICAgKC0wLjIwNzM1NSkKLSNkZWZpbmUgQ1NfU0lERV8zMjAwMF9BMiAgICAgICAgICAgICAgICAgICAgICAgICAgICgtMC4xNTcyMjQpCi0jZGVmaW5lIENTX1NJREVfMzIwMDBfQjEgICAgICAgICAgICAgICAgICAgICAgICAgICAoLTEuMjc0MjMxKQotI2RlZmluZSBDU19TSURFXzMyMDAwX0IyICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMzEyNDk1Ci0jZGVmaW5lIENTX1NJREVfMzIwMDBfU0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAgIDE0CisjZGVmaW5lIENTX01JRERMRV8zMjAwMF9BMCAwLjIyODQwMAorI2RlZmluZSBDU19NSURETEVfMzIwMDBfQTEgKC0wLjIyNTIxNCkKKyNkZWZpbmUgQ1NfTUlERExFXzMyMDAwX0EyIDAuMDAwMDAwCisjZGVmaW5lIENTX01JRERMRV8zMjAwMF9CMSAoLTAuOTgwMTI2KQorI2RlZmluZSBDU19NSURETEVfMzIwMDBfQjIgMC4wMDAwMDAKKyNkZWZpbmUgQ1NfTUlERExFXzMyMDAwX1NDQUxFIDE1CisjZGVmaW5lIENTX1NJREVfMzIwMDBfQTAgMC4zNjQ1NzkKKyNkZWZpbmUgQ1NfU0lERV8zMjAwMF9BMSAoLTAuMjA3MzU1KQorI2RlZmluZSBDU19TSURFXzMyMDAwX0EyICgtMC4xNTcyMjQpCisjZGVmaW5lIENTX1NJREVfMzIwMDBfQjEgKC0xLjI3NDIzMSkKKyNkZWZpbmUgQ1NfU0lERV8zMjAwMF9CMiAwLjMxMjQ5NQorI2RlZmluZSBDU19TSURFXzMyMDAwX1NDQUxFIDE0CiAKIC8qIFN0ZXJlbyBFbmhhbmNlciBjb2VmZmljaWVudHMgZm9yIDQ0MTAwSHogc2FtcGxlIHJhdGUsIHNjYWxlZCB3aXRoIDAuMTYzODM0ICovCi0jZGVmaW5lIENTX01JRERMRV80NDEwMF9BMCAgICAgICAgICAgICAgICAgICAgIDAuMjMzNTkzCi0jZGVmaW5lIENTX01JRERMRV80NDEwMF9BMSAgICAgICAgICAgICAgICAgICAgKC0wLjIzMTIyNSkKLSNkZWZpbmUgQ1NfTUlERExFXzQ0MTAwX0EyICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgQ1NfTUlERExFXzQ0MTAwX0IxICAgICAgICAgICAgICAgICAgICAoLTAuOTg1NTQ1KQotI2RlZmluZSBDU19NSURETEVfNDQxMDBfQjIgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBDU19NSURETEVfNDQxMDBfU0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAxNQotI2RlZmluZSBDU19TSURFXzQ0MTAwX0EwICAgICAgICAgICAgICAgICAgICAgICAwLjI4NDU3MwotI2RlZmluZSBDU19TSURFXzQ0MTAwX0ExICAgICAgICAgICAgICAgICAgICAgICgtMC4yNTg5MTApCi0jZGVmaW5lIENTX1NJREVfNDQxMDBfQTIgICAgICAgICAgICAgICAgICAgICAgKC0wLjAyNTY2MikKLSNkZWZpbmUgQ1NfU0lERV80NDEwMF9CMSAgICAgICAgICAgICAgICAgICAgICAoLTEuNTcyMjQ4KQotI2RlZmluZSBDU19TSURFXzQ0MTAwX0IyICAgICAgICAgICA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TX01JRERMRV80ODAwMF9CMiAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIENTX01JRERMRV80ODAwMF9TQ0FMRSAgICAgICAgICAgICAgICAgICAgICAgIDE1Ci0jZGVmaW5lIENTX1NJREVfNDgwMDBfQTAgICAgICAgICAgICAgICAgICAgICAwLjI3MjYwNgotI2RlZmluZSBDU19TSURFXzQ4MDAwX0ExICAgICAgICAgICAgICAgICAgICAoLTAuMjY2OTUyKQotI2RlZmluZSBDU19TSURFXzQ4MDAwX0EyICAgICAgICAgICAgICAgICAgICAoLTAuMDA1NjU0KQotI2RlZmluZSBDU19TSURFXzQ4MDAwX0IxICAgICAgICAgICAgICAgICAgICAoLTEuNjE3MTQxKQotI2RlZmluZSBDU19TSURFXzQ4MDAwX0IyICAgICAgICAgICAgICAgICAgICAgMC42MzA0MDUKLSNkZWZpbmUgQ1NfU0lERV80ODAwMF9TQ0FMRSAgICAgICAgICAgICAgICAgICAgICAgICAgMTQKKyNkZWZpbmUgQ1NfTUlERExFXzQ4MDAwX0EwIDAuMjM0NDQ1CisjZGVmaW5lIENTX01JRERMRV80ODAwMF9BMSAoLTAuMjMyMjYxKQorI2RlZmluZSBDU19NSURETEVfNDgwMDBfQTIgMC4wMDAwMDAKKyNkZWZpbmUgQ1NfTUlERExFXzQ4MDAwX0IxICgtMC45ODY3MTMpCisjZGVmaW5lIENTX01JRERMRV80ODAwMF9CMiAwLjAwMDAwMAorI2RlZmluZSBDU19NSURETEVfNDgwMDBfU0NBTEUgMTUKKyNkZWZpbmUgQ1NfU0lERV80ODAwMF9BMCAwLjI3MjYwNgorI2RlZmluZSBDU19TSURFXzQ4MDAwX0ExICgtMC4yNjY5NTIpCisjZGVmaW5lIENTX1NJREVfNDgwMDBfQTIgKC0wLjAwNTY1NCkKKyNkZWZpbmUgQ1NfU0lERV80ODAwMF9CMSAoLTEuNjE3MTQxKQorI2RlZmluZSBDU19TSURFXzQ4MDAwX0IyIDAuNjMwNDA1CisjZGVmaW5lIENTX1NJREVfNDgwMDBfU0NBTEUgMTQKIAogLyogQ29lZmZpY2llbnRzIGZvciA4ODIwMEh6IHNhbXBsZSByYXRlLgogICogVGhlIGZpbHRlciBjb2VmZmljaWVudHMgYXJlIG9idGFpbmVkIGJ5IGNhcnJ5aW5nIG91dAogICogc3RhdGUtc3BhY2UgYW5hbHlzaXMgdXNpbmcgdGhlIGNvZWZmaWNpZW50cyBhdmFpbGFibGUKICAqIGZvciA0NDEwMEh6LgogICovCi0jZGVmaW5lIENTX01JRERMRV84ODIwMF9BMCAgICAgICAgICAgICAgICAgICAgIDAuMjMzODQ2ZgotI2RlZmluZSBDU19NSURETEVfODgyMDBfQTEgICAgICAgICAgICAgICAgICAgICAoLTAuMjMyNjU3ZikKLSNkZWZpbmUgQ1NfTUlERExFXzg4MjAwX0EyICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDBmCi0jZGVmaW5lIENTX01JRERMRV84ODIwMF9CMSAgICAgICAgICAgICAgICAgICAgICgtMC45OTI3NDdmKQotI2RlZmluZSBDU19NSURETEVfODgyMDBfQjIgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMGYKLSNkZWZpbmUgQ1NfTUlERExFXzg4MjAwX1NDQUxFICAgICAgICAgICAgICAgICAgMTUKLSNkZWZpbmUgQ1NfU0lERV84ODIwMF9BMCAgICAgICAgICAgICAgICAgICAgICAgMC4yMzE1NDFmCi0jZGVmaW5lIENTX1NJREVfODgyMDBfQTEgICAgICAgICAgICAgICAgICAgICAgICgtMC4yODk1ODZmKQotI2RlZmluZSBDU19TSURFXzg4MjAwX0EyICAgICAgICAgICAgICAgICAgICAgICAwLjA1ODA0NWYKLSNkZWZpbmUgQ1NfU0lERV84ODIwMF9CMSAgICAgICAgICAgICAgICAgICAgICAgKC0xLjc2NTMwMGYpCi0jZGVmaW5lIENTX1NJREVfODgyMDBfQjIgICAgICAgICAgICAgICAgICAgICAgIDAuNzY5ODE2ZgotI2RlZmluZSBDU19TSUR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gICAoLTAuOTkzMzM0KQotI2RlZmluZSBDU19NSURETEVfOTYwMDBfQjIgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMAotI2RlZmluZSBDU19NSURETEVfOTYwMDBfU0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAxNQorI2RlZmluZSBDU19NSURETEVfOTYwMDBfQTAgMC4yMzU1MzIKKyNkZWZpbmUgQ1NfTUlERExFXzk2MDAwX0ExICgtMC4yMzQ0MzIpCisjZGVmaW5lIENTX01JRERMRV85NjAwMF9BMiAwLjAwMDAwMAorI2RlZmluZSBDU19NSURETEVfOTYwMDBfQjEgKC0wLjk5MzMzNCkKKyNkZWZpbmUgQ1NfTUlERExFXzk2MDAwX0IyIDAuMDAwMDAwCisjZGVmaW5lIENTX01JRERMRV85NjAwMF9TQ0FMRSAxNQogLyogQ29lZmZpY2llbnRzIGNhbGN1bGF0ZWQgdXNpbmcgdGYyc3MgYW5kIHNzMnRmIGZ1bmN0aW9ucyBiYXNlZCBvbgogICogY29lZmZpY2llbnRzIGF2YWlsYWJsZSBmb3IgNDgwMDBIeiBzYW1wbGluZyBmcmVxdWVuY3kKICAqLwotI2RlZmluZSBDU19TSURFXzk2MDAwX0EwICAgICAgICAgICAgICAgICAgICAgMC4yMjQzMjZmCi0jZGVmaW5lIENTX1NJREVfOTYwMDBfQTEgICAgICAgICAgICAgICAgICAgICAoLTAuMjk0OTM3ZikKLSNkZWZpbmUgQ1NfU0lERV85NjAwMF9BMiAgICAgICAgICAgICAgICAgICAgIDAuMDcwNjExZgotI2RlZmluZSBDU19TSURFXzk2MDAwX0IxICAgICAgICAgICAgICAgICAgICAgKC0xLjc5MjE2NmYpCi0jZGVmaW5lIENTX1NJREVfOTYwMDBfQjIgICAgICAgICAgICAgICAgICAgICAwLjc5NTgzMGYKLSNkZWZpbmUgQ1NfU0lERV85NjAwMF9TQ0FMRSAgICAgICAgICAgICAgICAgIDE0CisjZGVmaW5lIENTX1NJREVfOTYwMDBfQTAgMC4yMjQzMjZmCisjZGVmaW5lIENTX1NJREVfOTYwMDBfQTEgKC0wLjI5NDkzN2YpCisjZGVmaW5lIENTX1NJREVfOTYwMDBfQTIgMC4wNzA2MTFmCisjZGVmaW5lIENTX1NJREVfOTYwMDBfQjEgKC0xLjc5MjE2NmYpCisjZGVmaW5lIENTX1NJREVfOTYwMDBfQjIgMC43OTU4MzBmCisjZGVmaW5lIENTX1NJREVfOTYwMDBfU0NBTEUgMTQKIAogLyogU3RlcmVvIEVuaGFuY2VyIGNvZWZmaWNpZW50cyBmb3IgMTc2NDAwSHogc2FtcGxlIHJhdGUuCiAgKiBUaGUgZmlsdGVyIGNvZWZmaWNpZW50cyBhcmUgb2J0YWluZWQgYnkgY2Fycnlpbmcgb3V0CiAgKiBzdGF0ZS1zcGFjZSBhbmFseXNpcyB1c2luZyB0aGUgY29lZmZpY2llbnRzIGF2YWlsYWJsZQogICogZm9yIDQ0MTAwSHouCiAgKi8KLSNkZWZpbmUgQ1NfTUlERExFXzE3NjQwMF9BMCAgICAgICAgICAgICAgICAgICAgIDAuMjMzOTczZgotI2RlZmluZSBDU19NSURETEVfMTc2NDAwX0ExICAgICAgICAgICAgICAgICAgICAgKC0wLjIzMzM3OGYpCi0jZGVmaW5lIENTX01JRERMRV8xNzY0MDBfQTIgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMGYKLSNkZWZpbmUgQ1NfTUlERExFXzE3NjQwMF9CMSAgICAgICAgICAgICAgICAgICAgICgtMC45OTYzNjdmKQotI2RlZmluZSBDU19NSURETEVfMTc2NDAwX0IyICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDBmCi0jZGVmaW5lIENTX01JRERMRV8xNzY0MDBfU0NBTEUgICAgICAgICAgICAgICAgICAxNQotI2RlZmluZSBDU19TSURFXzE3NjQwMF9BMCAgICAgICAgICAgICAgICAgICAgICAgMC4xOTk4MzZmCi0jZGVmaW5lIENTX1NJREVfMTc2NDAwX0ExICAgICAgICAgICAgICAgICAgICAgICAoLTA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gICAwLjI0MTIxOQotI2RlZmluZSBDU19NSURETEVfMTkyMDAwX0ExICAgICAgICAgICAgICAgICAgICAoLTAuMjQwNjU2KQotI2RlZmluZSBDU19NSURETEVfMTkyMDAwX0EyICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDAKLSNkZWZpbmUgQ1NfTUlERExFXzE5MjAwMF9CMSAgICAgICAgICAgICAgICAgICAgKC0wLjk5NjY2MSkKLSNkZWZpbmUgQ1NfTUlERExFXzE5MjAwMF9CMiAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwCi0jZGVmaW5lIENTX01JRERMRV8xOTIwMDBfU0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAxNQorI2RlZmluZSBDU19NSURETEVfMTkyMDAwX0EwIDAuMjQxMjE5CisjZGVmaW5lIENTX01JRERMRV8xOTIwMDBfQTEgKC0wLjI0MDY1NikKKyNkZWZpbmUgQ1NfTUlERExFXzE5MjAwMF9BMiAwLjAwMDAwMAorI2RlZmluZSBDU19NSURETEVfMTkyMDAwX0IxICgtMC45OTY2NjEpCisjZGVmaW5lIENTX01JRERMRV8xOTIwMDBfQjIgMC4wMDAwMDAKKyNkZWZpbmUgQ1NfTUlERExFXzE5MjAwMF9TQ0FMRSAxNQogLyogQ29lZmZpY2llbnRzIGNhbGN1bGF0ZWQgdXNpbmcgdGYyc3MgYW5kIHNzMnRmIGZ1bmN0aW9ucyBiYXNlZCBvbgogICogY29lZmZpY2llbnRzIGF2YWlsYWJsZSBmb3IgNDgwMDBIeiBzYW1wbGluZyBmcmVxdWVuY3kKICAqLwotI2RlZmluZSBDU19TSURFXzE5MjAwMF9BMCAgICAgICAgICAgICAgICAgICAgMC4xOTYwMzlmCi0jZGVmaW5lIENTX1NJREVfMTkyMDAwX0ExICAgICAgICAgICAgICAgICAgICAoLTAuMzExMDI3ZikKLSNkZWZpbmUgQ1NfU0lERV8xOTIwMDBfQTIgICAgICAgICAgICAgICAgICAgIDAuMTE0OTg4ZgotI2RlZmluZSBDU19TSURFXzE5MjAwMF9CMSAgICAgICAgICAgICAgICAgICAgKC0xLjg5MTM4MGYpCi0jZGVmaW5lIENTX1NJREVfMTkyMDAwX0IyICAgICAgICAgICAgICAgICAgICAwLjg5MjM0NjBmCi0jZGVmaW5lIENTX1NJREVfMTkyMDAwX1NDQUxFICAgICAgICAgICAgICAgICAxNAorI2RlZmluZSBDU19TSURFXzE5MjAwMF9BMCAwLjE5NjAzOWYKKyNkZWZpbmUgQ1NfU0lERV8xOTIwMDBfQTEgKC0wLjMxMTAyN2YpCisjZGVmaW5lIENTX1NJREVfMTkyMDAwX0EyIDAuMTE0OTg4ZgorI2RlZmluZSBDU19TSURFXzE5MjAwMF9CMSAoLTEuODkxMzgwZikKKyNkZWZpbmUgQ1NfU0lERV8xOTIwMDBfQjIgMC44OTIzNDYwZgorI2RlZmluZSBDU19TSURFXzE5MjAwMF9TQ0FMRSAxNAogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTIyNywxMzMgKzIyNywxMzMgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKIC8qIFJldmVyYiBkZWxheSBzZXR0aW5ncyBpbiBzYW1wbGVzICovCi0jZGVmaW5lIExWQ1NfU1RFUkVPREVMQVlfQ1NfOEtIWiAgICAgICAgICAgICAgICAgICAgIDkzICAgICAgICAgLyogU2FtcGxlIHJhdGUgOGtTL3MgKi8KLSNkZWZpbmUgTFZDU19TVEVSRU9ERUxBWV9DU18xMUtIWiAgICAgICAgICAgICAgICAgICAxMjggICAgICAgICAvKiBTYW1wbGUgcmF0ZSAxMWtTL3MgKi8KLSNkZWZpbmUgTFZDU19TVEVSRU9ERUxBWV9DU18xMktIWiAgICAgICAgICAgICAgICAgICAxMzkgICAgICAgICAvKiBTYW1wbGUgcmF0ZSAxMmtTL3MgKi8KLSNkZWZpbmUgTFZDU19TVEVSRU9ERUxBWV9DU18xNktIWiAgICAgICAgICAgICAgICAgICAxODYgICAgICAgICAvKiBTYW1wbGUgcmF0ZSAxNmtTL3MgKi8KLSNkZWZpbmUgTFZDU19TVEVSRU9ERUxBWV9DU18yMktIWiAgICAgICAgICAgICAgICAgICAyNTYgICAgICAgICAvKiBTYW1wbGUgcmF0ZSAyMmtTL3MgKi8KLSNkZWZpbmUgTFZDU19TVEVSRU9ERUxBWV9DU18yNEtIWiAgICAgICAgICAgICAgICAgICAyNzkgICAgICAgICAvKiBTYW1wbGUgcmF0ZSAyNGtTL3MgKi8KLSNkZWZpbmUgTFZDU19TVEVSRU9ERUxBWV9DU18zMktIWiAgICAgICAgICAgICAgICAgICAzNzIgICAgICAgICAvKiBTYW1wbGUgcmF0ZSAzMmtTL3MgKi8KLSNkZWZpbmUgTFZDU19TVEVSRU9ERUxBWV9DU180NEtIWiAgICAgICAgICAgICAgICAgICA1MTIgICAgICAgICAvKiBTYW1wbGUgcmF0ZSA0NGtTL3MgKi8KLSNkZWZpbmUgTFZDU19TVEVSRU9ERUxBWV9DU180OEtIWiAgICAgICAgICAgICAgICAgICA1NTcgICAgICAgICAvKiBTYW1wbGUgcmF0ZSA0OGtTL3MgKi8KLSNkZWZpbmUgTFZDU19TVEVSRU9ERUxBWV9DU184OEtIWiAgICAgICAgICAgICAgICAgICAxMDI0ICAgICAgICAvKiBTYW1wbGUgcmF0ZSA4OC4ya1MvcyAqLwotI2RlZmluZSBMVkNTX1NURVJFT0RFTEFZX0NTXzk2S0haICAgICAgICAgICAgICAgICAgIDExMTUgICAgICAgIC8qIFNhbXBsZSByYXRlIDk2a1MvcyAqLwotI2RlZmluZSBMVkNTX1NURVJFT0RFTEFZ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QVlHQUlOICAgICAgICAgICAgICAgMC44MDAwMDAgICAgICAgICAvKiBBbGdvcml0aG0gZGVsYXkgcGF0aCBnYWluICovCi0jZGVmaW5lIExWQ1NfSEVBRFBIT05FX09VVFBVVEdBSU4gICAgICAgICAgICAgIDEuMDAwMDAwICAgICAgICAgLyogQWxnb3JpdGhtIG91dHB1dCBnYWluICovCi0jZGVmaW5lIExWQ1NfSEVBRFBIT05FX1BST0NHQUlOICAgICAgICAgICAgICAgICAgIDE4NDAzICAgICAgICAgLyogUHJvY2Vzc2VkIHBhdGggZ2FpbiAqLwotI2RlZmluZSBMVkNTX0hFQURQSE9ORV9VTlBST0NHQUlOICAgICAgICAgICAgICAgICAxODQwMyAgICAgICAgIC8qIFVucHJvY2Vzc2VkIHBhdGggZ2FpbiAqLwotI2RlZmluZSBMVkNTX0hFQURQSE9ORV9HQUlOQ09SUkVDVCAgICAgICAgICAgICAxLjAwOTM0MyAgICAgICAgIC8qIERlbGF5IG1peGVyIGdhaW4gY29ycmVjdGlvbiAqLworI2RlZmluZSBMVkNTX0hFQURQSE9ORV9ERUxBWUdBSU4gMC44MDAwMDAgICAvKiBBbGdvcml0aG0gZGVsYXkgcGF0aCBnYWluICovCisjZGVmaW5lIExWQ1NfSEVBRFBIT05FX09VVFBVVEdBSU4gMS4wMDAwMDAgIC8qIEFsZ29yaXRobSBvdXRwdXQgZ2FpbiAqLworI2RlZmluZSBMVkNTX0hFQURQSE9ORV9QUk9DR0FJTiAxODQwMyAgICAgICAvKiBQcm9jZXNzZWQgcGF0aCBnYWluICovCisjZGVmaW5lIExWQ1NfSEVBRFBIT05FX1VOUFJPQ0dBSU4gMTg0MDMgICAgIC8qIFVucHJvY2Vzc2VkIHBhdGggZ2FpbiAqLworI2RlZmluZSBMVkNTX0hFQURQSE9ORV9HQUlOQ09SUkVDVCAxLjAwOTM0MyAvKiBEZWxheSBtaXhlciBnYWluIGNvcnJlY3Rpb24gKi8KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0zNjMsMjA1ICszNjMsMjA0IEBACiAKIC8qIEVxdWFsaXNlciBjb2VmZmljaWVudHMgZm9yIDgwMDAgSHogc2FtcGxlIHJhdGUsIFwKICAgIENTIHNjYWxlZCB3aXRoIDEuMDM4NDk3IGFuZCBDU0VYIHNjYWxlZCB3aXRoIDAuNzc1NDgwICovCi0jZGVmaW5lIENTX0VRVUFMSVNFUl84MDAwX0EwICAgICAgICAgICAgICAgICAgICAgMS4yNjMzMTIKLSNkZWZpbmUgQ1NfRVFVQUxJU0VSXzgwMDBfQTEgICAgICAgICAgICAgICAgICAgICgtMC42MDE3NDgpCi0jZGVmaW5lIENTX0VRVUFMSVNFUl84MDAwX0EyICAgICAgICAgICAgICAgICAgICAoLTAuMjgwNjgxKQotI2RlZmluZSBDU19FUVVBTElTRVJfODAwMF9CMSAgICAgICAgICAgICAgICAgICAgKC0wLjQ3NTg2NSkKLSNkZWZpbmUgQ1NfRVFVQUxJU0VSXzgwMDBfQjIgICAgICAgICAgICAgICAgICAgICgtMC40MDgxNTQpCi0jZGVmaW5lIENTX0VRVUFMSVNFUl84MDAwX1NDQUxFICAgICAgICAgICAgICAgICAgICAgIDE0Ci0jZGVmaW5lIENTRVhfRVFVQUxJU0VSXzgwMDBfQTAgICAgICAgICAgICAgICAgICAgIDAuOTQzMzU3Ci0jZGVmaW5lIENTRVhfRVFVQUxJU0VSXzgwMDBfQTEgICAgICAgICAgICAgICAgICAgKC0wLjQ0OTM0NSkKLSNkZWZpbmUgQ1NFWF9FUVVBTElTRVJfODAwMF9BMiAgICAgICAgICAgICAgICAgICAoLTAuMjA5NTk0KQotI2RlZmluZSBDU0VYX0VRVUFMSVNFUl84MDAwX0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c3RhdGUtc3BhY2UgYW5hbHlzaXMgdXNpbmcgdGhlIGNvZWZmaWNpZW50cyBhdmFpbGFibGUKICAqIGZvciA0NDEwMEh6LgogICovCi0jZGVmaW5lIENTX0VRVUFMSVNFUl84ODIwMF9BMCAgICAgICAgICAgICAgICAgICAxLjc3MTg5OWYKLSNkZWZpbmUgQ1NfRVFVQUxJU0VSXzg4MjAwX0ExICAgICAgICAgICAgICAgICAgICgtMi45MzA3NjJmKQotI2RlZmluZSBDU19FUVVBTElTRVJfODgyMDBfQTIgICAgICAgICAgICAgICAgICAgMS4xNzIxNzVmCi0jZGVmaW5lIENTX0VRVUFMSVNFUl84ODIwMF9CMSAgICAgICAgICAgICAgICAgICAoLTEuNDM4MzQ5ZikKLSNkZWZpbmUgQ1NfRVFVQUxJU0VSXzg4MjAwX0IyICAgICAgICAgICAgICAgICAgIDAuNDQyNTIwZgotI2RlZmluZSBDU19FUVVBTElTRVJfODgyMDBfU0NBTEUgICAgICAgICAgICAgICAgMTMKLSNkZWZpbmUgQ1NFWF9FUVVBTElTRVJfODgyMDBfQTAgICAgICAgICAgICAgICAgIDIuNjc1MjQxZgotI2RlZmluZSBDU0VYX0VRVUFMSVNFUl84ODIwMF9BMSAgICAgICAgICAgICAgICAgKC00LjQ2NjE1NGYpCi0jZGVmaW5lIENTRVhfRVFVQUxJU0VSXzg4MjAwX0EyICAgICAgICAgICAgICAgICAxLjgxMDMwNWYKLSNkZWZpbmUgQ1NFWF9FUVVBTElTRVJfODgyMDBfQjEgICAgICAgICAgICAgICAgICgtMC45MjUzNTBmKQotI2RlZmluZSBDU0VYX0VRVUFMSVNFUl84ODIwMF9CMiAgICAgICAgICAgICAgICAgKC0wLjA2NjYxNmYpCi0jZGVmaW5lIENTRVhfRVFVQUxJU0VSXzg4MjAwX1NDQUxFICAgICAgICAgICAgICAxMworI2RlZmluZSBDU19FUVVBTElTRVJfODgyMDBfQTAgMS43NzE4OTlmCisjZGVmaW5lIENTX0VRVUFMSVNFUl84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NikKKyNkZWZpbmUgQ1NFWF9FUVVBTElTRVJfMTkyMDAwX0EyIDIuODcyMAorI2RlZmluZSBDU0VYX0VRVUFMSVNFUl8xOTIwMDBfQjEgKC0xLjMxMDc0KQorI2RlZmluZSBDU0VYX0VRVUFMSVNFUl8xOTIwMDBfQjIgMC4zMTMxMgorI2RlZmluZSBDU0VYX0VRVUFMSVNFUl8xOTIwMDBfU0NBTEUgMTMKIAotI2RlZmluZSBMVkNTX0hFQURQSE9ORV9TSElGVCAgICAgICAgICAgICAgICAgICAgICAgICAgMiAgICAgICAgICAgICAgLyogT3V0cHV0IFNoaWZ0ICovCi0jZGVmaW5lIExWQ1NfSEVBRFBIT05FX1NISUZUTE9TUyAgICAgICAgICAgICAgICAgIDAuODQ3NzczNSAgICAgICAgICAvKiBPdXRwdXQgU2hpZnQgbG9zcyAqLwotI2RlZmluZSBMVkNTX0hFQURQSE9ORV9HQUlOICAgICAgICAgICAgICAgICAgICAgICAwLjIwODc0NjUgICAgICAgICAgLyogVW5wcm9jZXNzZWQgcGF0aCBnYWluICovCi0jZGVmaW5lIExWQ1NfRVhfSEVBRFBIT05FX1NISUZUICAgICAgICAgICAgICAgICAgICAgICAzICAgICAgICAgICAgICAvKiBFWCBPdXRwdXQgU2hpZnQgKi8KLSNkZWZpbmUgTFZDU19FWF9IRUFEUEhPTkVfU0hJRlRMT1NTICAgICAgICAgICAgICAgMC41NjkyMjUgICAgICAgICAgIC8qIEVYIE91dHB1dCBTaGlmdCBsb3NzICovCi0jZGVmaW5lIExWQ1NfRVhfSEVBRFBIT05FX0dBSU4gICAgICAgICAgICAgICAgICAgIDAuMDc3OTQ0MjUgICAgICAgICAvKiBFWCBVbnByb2Nlc3NlZCBwYXRoIGdhaW4gKi8KKyNkZWZpbmUgTFZDU19IRUFEUEhPTkVfU0hJRlQgMiAgICAgICAgICAgICAgIC8qIE91dHB1dCBTaGlmdCAqLworI2RlZmluZSBMVkNTX0hFQURQSE9ORV9TSElGVExPU1MgMC44N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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCisjaW5jbHVkZSA8c3RkbGliLmg+CiAjaW5jbHVkZSAiTFZDUy5oIgogI2luY2x1ZGUgIkxWQ1NfUHJpdmF0ZS5oIgogI2luY2x1ZGUgIkxWQ1NfVGFibGVzLmgiCiAKLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiBGVU5DVElPTjogICAgICAgICAgICAgICAgTFZDU19NZW1vcnkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgVGhpcyBmdW5jdGlvbiBpcyB1c2VkIGZvciBtZW1vcnkgYWxsb2NhdGlvbiBhbmQgZnJlZS4gSXQgY2FuIGJlIGNhbGxlZCBpbiAgICAgICAgICAgKi8KLS8qICB0d28gd2F5czogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgIGhJbnN0YW5jZSA9IE5VTEwgICAgICAgICAgICAgICAgUmV0dXJucyB0aGUgbWVtb3J5IHJlcXVpcmVtZW50cyAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgaEluc3RhbmNlID0gSW5zdGFuY2UgaGFuZGxlICAgICBSZXR1cm5zIHRoZSBtZW1vcnkgcmVxdWlyZW1lbnRzIGFuZCAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbG9jYXRlZCBiYXNlIGFkZHJlc3NlcyBmb3IgdGhlIGluc3RhbmNlICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBXaGVuIHRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGZvciBtZW1vcnkgYWxsb2NhdGlvbiAoaEluc3RhbmNlPU5VTEwpIGl0IGlzICAgICAgICAgICAqLwotLyogIHBhc3NlZCB0aGUgZGVmYXVsdCBjYXBhYmlsaXRpZXMuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBXaGVuIGNhbGxlZCBmb3IgbWVtb3J5IGFsbG9jYXRpb24gdGhlIG1lbW9yeSBiYXNlIGFkZHJlc3MgcG9pbnRlcnMgYXJlIE5VTEwgb24gICAgICAqLwotLyogIHJldHVybi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBXaGVuIHRoZSBmdW5jdGlvbiBpcyBjYWxsZWQgZm9yIGZyZWUgKGhJbnN0YW5jZSA9IEluc3RhbmNlIEhhbmRsZSkgdGhlICAgICAgICAgICAgICAqLwotLyogIGNhcGFiaWxpdGllcyBhcmUgaWdub3JlZCBhbmQgdGhlIG1lbW9yeSB0YWJsZSByZXR1cm5zIHRoZSBhbGxvY2F0ZWQgbWVtb3J5IGFuZCAgICAgICovCi0vKiAgYmFzZSBhZGRyZXNzZXMgdXNlZCBkdXJpbmcgaW5pdGlhbGlzYXRpb24uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlICAgICAgICAgICAgICAgSW5zdGFuY2UgSGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBwTWVtb3J5VGFibGUgICAgICAgICAgICBQb2ludGVyIHRvIGFuIGVtcHR5IG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICAqLwotLyogIHBDYXBhYmlsaXRpZXMgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIGRlZmF1bHQgY2FwYWJpbGl0ZXMgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIFJFVFVSTlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIExWQ1NfU3VjY2VzcyAgICAgICAgICAgIFN1Y2NlZWRlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qIE5PVEVTOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIDEuICBUaGlzIGZ1bmN0aW9uIG1heSBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZDU19Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi1MVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX01lbW9yeShMVkNTX0hhbmRsZV90ICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfTWVtVGFiX3QgICAgICAgICAgKnBNZW1vcnlUYWJsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfQ2FwYWJpbGl0aWVzX3QgICAgKnBDYXBhYmlsaXRpZXMpCi17Ci0KLSAgICBMVk1fVUlOVDMyICAgICAgICAgIFNjcmF0Y2hTaXplOwotICAgIExWQ1NfSW5zdGFuY2VfdCAgICAgKnBJbnN0YW5jZSA9IChMVkNTX0luc3RhbmNlX3QgKiloSW5zdGFuY2U7Ci0KLSAgICAvKgotICAgICAqIEZpbGwgaW4gdGhlIG1lbW9yeSB0YWJsZQotICAgICAqLwotICAgIG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J5IGFsbG9jYXRpb24gdGFibGUgKi8KLSAgICAgICAgKnBNZW1vcnlUYWJsZSA9IHBJbnN0YW5jZS0+TWVtb3J5VGFibGU7Ci0gICAgfQotCi0gICAgcmV0dXJuKExWQ1NfU1VDQ0VTUyk7Ci19Ci0KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogRlVOQ1RJT046ICAgICAgICAgICAgICAgIExWQ1NfSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTEyMCw5MSArMzIsOTUgQEAKIC8qIERFU0NSSVBUSU9OOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgQ3JlYXRlIGFuZCBpbml0aWFsaXNhdGlvbiBmdW5jdGlvbiBmb3IgdGhlIENvbmNlcnQgU291bmQgbW9kdWxlICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBUaGlzIGZ1bmN0aW9uIGNhbiBiZSB1c2VkIHRvIGNyZWF0ZSBhbiBhbGdvcml0aG0gaW5zdGFuY2UgYnkgY2FsbGluZyB3aXRoICAgICAgICovCi0vKiAgaEluc3RhbmNlIHNldCB0byBMVk1fTlVMTC4gSW4gdGhpcyBjYXNlIHRoZSBhbGdvcml0aG0gcmV0dXJucyB0aGUgbmV3IGluc3RhbmNlICAqLwotLyogIGhhbmRsZS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgVGhpcyBmdW5jdGlvbiBjYW4gYmUgdXNlZCB0byBmb3JjZSBhIGZ1bGwgcmUtaW5pdGlhbGlzYXRpb24gb2YgdGhlIGFsZ29yaXRobSAgICAqLwotLyogIGJ5IGNhbGxpbmcgd2l0aCBoSW5zdGFuY2UgPSBJbnN0YW5jZSBIYW5kbGUuIEluIHRoaXMgY2FzZSB0aGUgbWVtb3J5IHRhYmxlICAgICAgKi8KLS8qICBzaG91bGQgYmUgY29ycmVjdCBmb3IgdGhlIGluc3RhbmNlLCB0aGlzIGNhbiBiZSBlbnN1cmVkIGJ5IGNhbGxpbmcgdGhlIGZ1bmN0aW9uICovCi0vKiAgTFZDU19NZW1vcnkgYmVmb3JlIGNhbGxpbmcgdGhpcyBmdW5jdGlvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qIFBBUkFNRVRFUlM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgaEluc3RhbmNlICAgICAgICAgICAgICAgSW5zdGFuY2UgaGFuZGxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIHBNZW1vcnlUYWJsZSAgICAgICAgICAgIFBvaW50ZXIgdG8gdGhlIG1lbW9yeSBkZWZpbml0aW9uIHRhYmxlICAgICAgICAgICAgICAgICAgKi8KKy8qICBwaEluc3RhbmNlICAgICAgICAgICAgICBQb2ludGVyIHRvIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgcENhcGFiaWxpdGllcyAgICAgICAgICAgUG9pbnRlciB0byB0aGUgY2FwYWJpbGl0aWVzIHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAqLworLyogIHBTY3JhdGNoICAgICAgICAgICAgICAgIFBvaW50ZXIgdG8gc2NyYXRjaCBidWZmZXIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiBSRVRVUk5TOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogIExWQ1NfU3VjY2VzcyAgICAgICAgICAgIEluaXRpYWxpc2F0aW9uIHN1Y2NlZWRlZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBMVkRCRV9OVUxMQUREUkVTUyAgICAgICBPbmUgb3IgbW9yZSBtZW1vcnkgaGFzIGEgTlVMTCBwb2ludGVyIC0gbWFsbG9jIGZhaWx1cmUgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAxLiAgVGhlIGluc3RhbmNlIGhhbmRsZSBpcyB0aGUgcG9pbnRlciB0byB0aGUgYmFzZSBhZGRyZXNzIG9mIHRoZSBmaXJzdCBtZW1vcnkgICovCi0vKiAgICAgIHJlZ2lvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIDIuICBUaGlzIGZ1bmN0aW9uIG11c3Qgbm90IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVkNTX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgKi8KLS8qICAzLiAgVGhpcyBmdW5jdGlvbiBtdXN0IGJlIGNhbGxlZCB3aXRoIHRoZSBzYW1lIGNhcGFiaWxpdGllcyBhcyB1c2VkIGZvciB0aGUgICAgICovCi0vKiAgICAgIGNhbGwgdG8gdGhlIG1lbW9yeSBmdW5jdGlvbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogIDEuICBUaGlzIGZ1bmN0aW9uIG11c3Qgbm90IGJlIGludGVycnVwdGVkIGJ5IHRoZSBMVkNTX1Byb2Nlc3MgZnVuY3Rpb24gICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX0luaXQoTFZDU19IYW5kbGVfdCAgICAgICAgICpwaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfTWVtVGFiX3QgICAgICAgICAqcE1lbW9yeVRhYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfQ2FwYWJpbGl0aWVzX3QgICAqcENhcGFiaWxpdGllcykKLXsKLQotICAgIExWQ1NfSW5zdGFuY2VfdCAgICAgICAgICAgICAgICAgKnBJbnN0YW5jZTsKLSAgICBMVkNTX1ZvbENvcnJlY3RfdCAgICAgICAgICAgICAgICpwTFZDU19Wb2xDb3JyZWN0VGFibGU7CitMVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX0luaXQoTFZDU19IYW5kbGVfdCogcGhJb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U7CisgICAgcEluc3RhbmNlLT5iVGltZXJEb25lID0gTFZNX0ZBTFNFOworICAgIHBJbnN0YW5jZS0+VGltZXJQYXJhbXMuQ2FsbEJhY2tQYXJhbSA9IDA7CisgICAgcEluc3RhbmNlLT5UaW1lclBhcmFtcy5wQ2FsbEJhY2sgPSBMVkNTX1RpbWVyQ2FsbEJhY2s7CisgICAgcEluc3RhbmNlLT5UaW1lclBhcmFtcy5wQ2FsbGJhY2tJbnN0YW5jZSA9IHBJbnN0YW5jZTsKKyAgICBwSW5zdGFuY2UtPlRpbWVyUGFyYW1zLnBDYWxsQmFja1BhcmFtcyA9IExWTV9OVUxMOwogCi0gICAgcmV0dXJuKExWQ1NfU1VDQ0VTUyk7CisgICAgcmV0dXJuIChMVkNTX1NVQ0NFU1MpOwogfQogCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qIEZVTkNUSU9OOiAgICAgICAgICAgICAgICBMVkNTX0RlSW5pdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogREVTQ1JJUFRJT046ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBGcmVlIG1lbW9yaWVzIGNyZWF0ZWQgZHVyaW5nIHRoZSBMVkNTX0luaXQgY2FsbCBpbmNsdWRpbmcgaW5zdGFuY2UgaGFuZGxlICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogUEFSQU1FVEVSUzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICBwaEluc3RhbmNlICAgICAgICAgICAgICBQb2ludGVyIHRvIGluc3RhbmNlIGhhbmRsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKy8qICAxLiAgVGhpcyBmdW5jdGlvbiBtdXN0IG5vdCBiZSBpbnRlcnJ1cHRlZCBieSB0aGUgTFZDU19Qcm9jZXNzIGZ1bmN0aW9uICAgICAgICAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KK3ZvaWQgTFZDU19EZUluaXQoTFZDU19IYW5kbGVfdCogcGhJbnN0YW5jZSkgeworICAgIExWQ1NfSW5zdGFuY2VfdCogcEluc3RhbmNlID0gKExWQ1NfSW5zdGFuY2VfdCopKnBoSW5zdGFuY2U7CisgICAgaWYgKHBJbnN0YW5jZSA9PSBMVk1fTlVMTCkgeworICAgICAgICByZXR1cm47CisgICAgfQorICAgIGRlbGV0ZSBwSW5zdGFuY2U7CisgICAgKnBoSW5zdGFuY2UgPSBMVk1fTlVMTDsKKyAgICByZXR1cm47Cit9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfUHJpdmF0ZS5oIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX1ByaXZhdGUuaAppbmRleCAxNTRlYTU1Li41OGUyMWJkIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfUHJpdmF0ZS5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19Qcml2YXRlLmgKQEAgLTMzLDExICszMywxMiBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLSNpbmNsdWRlICJMVkNTLmgiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIENhbGxpbmcgb3IgQXBwbGljYXRpb24gbGF5ZXIgZGVmaW5pdGlvbnMgKi8KLSNpbmNsdWRlICJMVkNTX1N0ZXJlb0VuaGFuY2VyLmgiICAgICAgICAgICAgICAgIC8qIFN0ZXJlbyBlbmhhbmNlciBtb2R1bGUgZGVmaW5pdGlvbnMgKi8KLSNpbmNsdWRlICJMVkNTX1JldmVyYkdlbmVyYXRvci5oIiAgICAgICAgICAgICAgIC8qIFJldmVyYmVyYXRpb24gbW9kdWxlIGRlZmluaXRpb25zICovCi0jaW5jbHVkZSAiTFZDU19FcXVhbGlzZXIuaCIgICAgICAgICAgICAgICAgICAgICAvKiBFcXVhbGlzZXIgbW9kdWxlIGRlZmluaXRpb25zICovCi0jaW5jbHVkZSAiTFZDU19CeXBhc3NNaXguaCIgICAgICAgICAgICAgICAgICAgICAvKiBCeXBhc3MgTWl4ZXIgbW9kdWxlIGRlZmluaXRpb25zICovCisjaW5jbHVkZSA8YXVkaW9fdXRpbHMvQmlxdWFkRmlsdGVyLmg+CisjaW5jbHVkZSAiTFZDUy5oIiAgICAgICAgICAgICAgICAgLyogQ2FsbGluZyBvciBBcHBsaWNhdGlvbiBsYXllciBkZWZpbml0aW9ucyAqLworI2luY2x1ZGUgIkxWQ1NfU3RlcmVvRW5oYW5jZXIuaCIgIC8qIFN0ZXJlbyBlbmhhbmNlciBtb2R1bGUgZGVmaW5pdGlvbnMgKi8KKyNpbmNsdWRlICJMVkNTX1JldmVyYkdlbmVyYXRvci5oIiAvKiBSZXZlcmJlcmF0aW9uIG1vZHVsZSBkZWZpbml0aW9ucyAqLworI2luY2x1ZGUgIkxWQ1NfRXF1YWxpc2VyLmgiICAgICAgIC8qIEVxdWFsaXNlciBtb2R1bGUgZGVmaW5pdGlvbnMgKi8KKyNpbmNsdWRlICJMVkNTX0J5cGFzc01peC5oIiAgICAgICAvKiBCeXBhc3MgTWl4ZXIgbW9kdWxlIGRlZmluaXRpb25zICovCiAjaW5jbHVkZSAiTFZNX1RpbWVyLmgiCiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCkBAIC00NywzNSArNDgsMjkgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKIC8qIENvbmZpZ3VyYXRpb24gc3dpdGNoIGNvbnRyb2xzICovCi0jZGVmaW5lIExWQ1NfU1RFUkVPRU5IQU5DRVNXSVRDSCAgICAweDAwMDEgICAgICAvKiBTdGVyZW8gZW5oYW5jZW1lbnQgZW5hYmxlIGNvbnRyb2wgKi8KLSNkZWZpbmUgTFZDU19SRVZFUkJTV0lUQ0gg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JZUEFTU19NSVhFUl9UQyAxMDAgLyogQnlwYXNzIG1peGVyIHRpbWUgKi8KIAogLyogQWNjZXNzIHRvIGV4dGVybmFsIGNvZWZmaWNpZW50cyB0YWJsZSAqLwotI2RlZmluZSBMVkNTX05SX09GX0ZTICAgICAgICAgICAgICAgICAgICA5Ci0jZGVmaW5lIExWQ1NfTlJfT0ZfQ0hBTl9DRkcgICAgICAgICAgICAgIDIKKyNkZWZpbmUgTFZDU19OUl9PRl9GUyA5CisjZGVmaW5lIExWQ1NfTlJfT0ZfQ0hBTl9DRkcgMgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTgzLDEzICs3OCw5IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotdHlwZWRlZiBMVk1fVUlOVDE2ICBMVkNTX0NvbmZpZ3VyYXRpb25fdDsgICAgICAgLyogSW50ZXJuYWwgYWxnb3JpdGhtIGNvbmZpZ3VyYXRpb24gKi8KK3R5cGVkZWYgTFZNX1VJTlQxNiBMVkNTX0NvbmZpZ3VyYXRpb25fdDsgLyogSW50ZXJuYWwgYWxnb3JpdGhtIGNvbmZpZ3VyYXRpb24gKi8KIAotdHlwZWRlZiBlbnVtCi17Ci0gICAgTFZDU19IRUFEUEhPTkUgID0gMCwKLSAgICBMVkNTX0RFVklDRV9NQVggPSBMVk1fTUFYRU5VTQotfSBMVkNTX091dHB1dERldmljZV9lbjsKK3R5cGVkZWYgZW51bSB7IExWQ1NfSEVBRFBIT05FID0gMCwgTFZDU19ERVZJQ0VfTUFYID0gTFZNX01BWEVOVU0gfSBMVkNTX091dHB1dERldmljZV9lbjsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC05OCw2NSArODksNTAgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKIC8qIFZvbHVtZSBjb3JyZWN0aW9uIHN0cnVjdHVyZSAqLwotdHlwZWRlZiBzdHJ1Y3QKLXsKLSAgICBMVk1fRkxPQVQgICBDb21wRnVsbDsgICAgICAgICAgICAgICAgICAgICAgIC8qIFBvc3QgQ1MgY29tcHJlc3Npb24gMTAwJSBlZmZlY3QgKi8KLSAgICBMVk1fRkxPQVQgICBDb21wTWluOyAgICAgICAgICAgICAgICAgICAgICAgIC8qIFBvc3QgQ1MgY29tcHJlc3Npb24gMCUgZWZmZWN0ICovCi0gICAgTFZNX0ZMT0FUICAgR2FpbkZ1bGw7ICAgICAgICAgICAgICAgICAgICAgICAvKiBDUyBnYWluIGNvcnJlY3QgMTAwJSBlZmZlY3QgKi8KLSAgICBMVk1fRkxPQVQgICBHYWluTWluOyAgICAgICAgICAgICAgICAgICAgICAgIC8qIENTIGdhaW4gY29ycmVjdCAwJSBlZmZlY3QgKi8KK3R5cGVkZWYgc3RydWN0IHsKKyAgICBMVk1fRkxPQVQgQ29tcEZ1bGw7IC8qIFBvc3QgQ1MgY29tcHJlc3Npb24gMTAwJSBlZmZlY3QgKi8KKyAgICBMVk1fRkxPQVQgQ29tcE1pbjsgIC8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dGVyZW9FbmhhbmNlcl90IFN0ZXJlb0VuaGFuY2VyOyAvKiBTdGVyZW8gZW5oYW5jZXIgY29uZmlndXJhdGlvbiAqLworICAgIExWQ1NfUmV2ZXJiR2VuZXJhdG9yX3QgUmV2ZXJiZXJhdGlvbjsgLyogUmV2ZXJiZXJhdGlvbiBjb25maWd1cmF0aW9uICovCisgICAgTFZDU19CeXBhc3NNaXhfdCBCeXBhc3NNaXg7ICAgICAgICAgICAvKiBCeXBhc3MgbWl4ZXIgY29uZmlndXJhdGlvbiAqLwogCiAgICAgLyogQnlwYXNzIHZhcmlhYmxlICovCi0gICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgTVNUYXJnZXQwOyAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTWl4ZXIgc3RhdGUgY29udHJvbCB2YXJpYWJsZSBmb3Igc21vb3RoIHRyYW5zdGlvbiAqLwotICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgIE1TVGFyZ2V0MTsgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE1peGVyIHN0YXRlIGNvbnRyb2wgdmFyaWFibGUgZm9yIHNtb290aCB0cmFuc3Rpb24gKi8KLSAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBiSW5PcGVyYXRpbmdNb2RlVHJhbnNpdGlvbjsgICAgICAgICAvKiBPcGVyYXRpbmcgbW9kZSB0cmFuc2l0aW9uIGZsYWcgKi8KLSAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICBiVGltZXJEb25lOyAgICAgICAgICAgICAgICAgICAgICAgICAvKiBUaW1lciBjb21wbGV0aW9uIGZsYWcgKi8KLSAgICBMVk1fVGltZXJfUGFyYW1zX3QgICAgICBUaW1lclBhcmFtczsgICAgICAgICAgICAgICAgICAgICAgICAvKiBUaW1lciBwYXJhbWV0ZXJzICovCi0gICAgTFZNX1RpbWVyX0luc3RhbmNlX3QgICAgVGltZXJJbnN0YW5jZTsgICAgICAgICAgICAgICAgICAgICAgLyogVGltZXIga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AgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX1Byb2Nlc3NfQ1MoTFZDU19IYW5kbGVfdCAgICAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAgICAgICpwSW5EYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICpwT3V0RGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICAgICBOdW1TYW1wbGVzKQotewotICAgIGNvbnN0IExWTV9GTE9BVCAgICAgKnBJbnB1dDsKLSAgICBMVkNTX0luc3RhbmNlX3QgICAgICpwSW5zdGFuY2UgPSAoTFZDU19JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgICpwU2NyYXRjaDsKK0xWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfUHJvY2Vzc19DUyhMVkNTX0hhbmRsZV90IGhJbnN0YW5jZSwgY29uc3QgTFZNX0ZMT0FUKiBwSW5EYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogcE91dERhdGEsIExWTV9VSU5UMTYgTnVtU2FtcGxlcykgeworICAgIGNvbnN0IExWTV9GTE9BVCogcElucHV0OworICAgIExWQ1NfSW5zdGFuY2VfdCogcEluc3RhbmNlID0gKExWQ1NfSW5zdGFuY2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ZMT0FUKilwSW5wdXQsIE5yRnJhbWVzLCBjaGFubmVscyk7CisgICAgICAgIENvcHlfRmxvYXQoKExWTV9GTE9BVCopcElucHV0LCAoTFZNX0ZMT0FUKilwU3RJbiwgKExWTV9JTlQxNikoRkNDXzIgKiBOckZyYW1lcykpOwogICAgIH0KLSAgICBlbHNlCi0gICAgewotICAgICAgICAvKiBQcm9jZXNzaW5nIG91dHBsYWNlICovCi0gICAgICAgIHBJbnB1dCA9IHBJbkRhdGE7Ci0gICAgfQotI2VuZGlmCiAgICAgLyoKICAgICAgKiBDYWxsIHRoZSBzdGVyZW8gZW5oYW5jZXIKICAgICAgKi8KLSNpZmRlZiBTVVBQT1JUX01DCi0gICAgZXJyID0gTFZDU19TdGVyZW9FbmhhbmNlcihoSW5zdGFuY2UsICAgICAgICAgICAgICAvKiBJbnN0YW5jZSBoYW5kbGUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTdEluLCAgICAgICAgICAgICAgICAgIC8qIFBvaW50ZXIgdG8gdGhlIGlucHV0IGRhdGEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXREYXRhLCAgICAgICAgICAgICAgIC8qIFBvaW50ZXIgdG8gdGhlIG91dHB1dCBkYXRhICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOckZyYW1lcyk7ICAgICAgICAgICAgICAvKiBOdW1iZXIgb2YgZnJhbWVzIHRvIHByb2Nlc3MgKi8KLSNlbHNlCi0gICAgZXJyID0gTFZDU19TdGVyZW9FbmhhbmNlcihoSW5zdGFuY2UsICAgICAgICAgICAgICAvKiBJbnN0YW5jZSBoYW5kbGUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBJbkRhdGEsICAgICAgICAgICAgICAgICAgICAvKiBQb2ludGVyIHRvIHRoZSBpbnB1dCBkYXRhICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0RGF0YSwgICAgICAgICAgICAgICAgICAgLyogUG9pbnRlciB0byB0aGUgb3V0cHV0IGRhdGEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE51bVNhbXBsZXMpOyAgICAgICAgICAgICAgICAvKiBOdW1iZXIgb2Ygc2FtcGxlcyB0byBwcm9jZXNzICovCi0jZW5kaWYKKyAgICBlcnIgPSBMVkNTX1N0ZXJlb0VuaGFuY2VyKGhJbnN0YW5jZSwgLyogSW5zdGFuY2UgaGFuZGxlICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwU3RJbiwgICAgIC8qIFBvaW50ZXIgdG8gdGhlIGlucHV0IGRhdGEgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXREYXRhLCAgLyogUG9pbnRlciB0byB0aGUgb3V0cHV0IGRhdGEgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5yRnJhbWVzKTsgLyogTnVtYmVyIG9mIGZyYW1lcyB0byBwcm9jZXNzICovCiAKICAgICAvKgogICAgICAqIENhbGwgdGhlIHJldmVyYiBnZW5lcmF0b3IKICAgICAgKi8KLSAgICBlcnIgPSBMVkNTX1JldmVyYkdlbmVyYXRvcihoSW5zdGFuY2UsICAgICAgICAgICAgIC8qIEluc3RhbmNlIGhhbmRsZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXREYXRhLCAgICAgICAgICAgICAgICAgIC8qIFBvaW50ZXIgdG8gdGhlIGlucHV0IGRhdGEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0RGF0YSwgICAgICAgICAgICAgICAgICAvKiBQb2ludGVyIHRvIHRoZSBvdXRwdXQgZGF0YSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE51bVNhbXBsZXMpOyAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBzYW1wbGVzIHRvIHByb2Nlc3MgKi8KKyAgICBlcnIgPSBMVkNTX1JldmVyYkdlbmVyYXRvcihoSW5zdGFuY2UsICAgLyogSW5zdGFuY2UgaGFuZGxlICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsICAgIC8qIFBvaW50ZXIgdG8gdGhlIGlucHV0IGRhdGEgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0RGF0YSwgICAgLyogUG9pbnRlciB0byB0aGUgb3V0cHV0IGRhdGEgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOdW1TYW1wbGVzKTsgLyogTnVtYmVyIG9mIHNhbXBsZXMgdG8gcHJvY2VzcyAqLwogCiAgICAgLyoKICAgICAgKiBDYWxsIHRoZSBlcXVhbGlzZXIKICAgICAgKi8KLSAgICBlcnIgPSBMVkNTX0VxdWFsaXNlcihoSW5zdGFuY2UsICAgICAgICAgICAgICAgICAgIC8qIEluc3RhbmNlIGhhbmRsZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXREYXRhLCAgICAgICAgICAgICAgICAgICAgICAgIC8qIFBvaW50ZXIgdG8gdGhlIGlucHV0IGRhdGEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICBOdW1TYW1wbGVzKTsgICAgICAgICAgICAgICAgICAgICAvKiBOdW1iZXIgb2Ygc2FtcGxlcyB0byBwcm9jZXNzICovCisgICAgZXJyID0gTFZDU19FcXVhbGlzZXIoaEluc3RhbmNlLCAgIC8qIEluc3RhbmNlIGhhbmRsZSAqLworICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXREYXRhLCAgICAvKiBQb2ludGVyIHRvIHRoZSBpbnB1dCBkYXRhICovCisgICAgICAgICAgICAgICAgICAgICAgICAgTnVtU2FtcGxlcyk7IC8qIE51bWJlciBvZiBzYW1wbGVzIHRvIHByb2Nlc3MgKi8KIAogICAgIC8qCiAgICAgICogQ2FsbCB0aGUgYnlwYXNzIG1peGVyCiAgICAgICovCi0gICAgZXJyID0gTFZDU19CeXBhc3NNaXhlcihoSW5zdGFuY2UsICAgICAgICAgICAgICAgICAvKiBJbnN0YW5jZSBoYW5kbGUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXREYXRhLCAgICAgICAgICAgICAgICAgICAgICAvKiBQb2ludGVyIHRvIHRoZSBwcm9jZXNzZWQgZGF0YSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgcElucHV0LCAgICAgICAgICAgICAgICAgICAgICAgIC8qIFBvaW50ZXIgdG8gdGhlIGlucHV0ICh1bnByb2Nlc3NlZCkgZGF0YSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsICAgICAgICAgICAgICAgICAgICAgIC8qIFBvaW50ZXIgdG8gdGhlIG91dHB1dCBkYXRhICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBOdW1TYW1wbGVzKTsgICAgICAgICAgICAgICAgICAgLyogTnVtYmVyIG9mIHNhbXBsZXMgdG8gcHJvY2VzcyAqLworICAgIGVyciA9IExWQ1NfQnlwYXNzTWl4ZXIoaEluc3RhbmNlLCAgIC8qIEluc3RhbmNlIGhhbmRsZSAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsICAgIC8qIFBvaW50ZXIgdG8gdGhlIHByb2Nlc3NlZCBkYXRhICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICBwSW5wdXQsICAgICAgLyogUG9pbnRlciB0byB0aGUgaW5wdXQgKHVucHJvY2Vzc2VkKSBkYXRhICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0RGF0YSwgICAgLyogUG9pbnRlciB0byB0aGUgb3V0cHV0IGRhdGEgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgIE51bVNhbXBsZXMpOyAvKiBOdW1iZXIgb2Ygc2FtcGxlcyB0byBwcm9jZXNzICovCiAKLSAgICBpZihlcnIgIT0gTFZDU19TVUNDRVNTKQotICAgIHsKKyAgICBpZiAoZXJyICE9IExWQ1NfU1VDQ0VTUykgewogICAgICAgICByZXR1cm4gZXJyOwogICAgIH0KIAotICAgIHJldHVybihMVkNTX1NVQ0NFU1MpOworICAgIHJldHVybiAoTFZDU19TVUNDRVNTKTsKIH0KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMjAyLDE3MSArMTYxLDExNyBAQAogLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19Qcm9jZXNzKExWQ1NfSGFuZGxlX3QgICAgICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IExWTV9GTE9BVCAgICAgICAgICAgKnBJbkRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgICAqcE91dERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX1VJTlQxNiAgICAgICAgICAgICAgICBOdW1TYW1wbGVzKQotewotCi0gICAgTFZDU19JbnN0YW5jZV90ICpwSW5zdGFuY2UgPSAoTFZDU19JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKK0xWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfUHJvY2VzcyhMVkNTX0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MgYnkgcElucHV0IGFuZCBwU3RJbiBpbiBMVkNTX1Byb2Nlc3NfQ1MuCisgICAgICAgICAgICAgKiBIZW5jZSwgcFN0ZXJlb091dCBpcyBwb2ludGVkIHRvIHVzZSB1bnVzZWQgdGhpcmQgcG9ydGlvbiBvZiBzY3JhdGNoIG1lbW9yeS4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcFN0ZXJlb091dCA9IChMVk1fRkxPQVQqKXBJbnN0YW5jZS0+cFNjcmF0Y2ggKyAoKExWQ1NfU0NSQVRDSEJVRkZFUlMgLSA0KSAqIE5yRnJhbWVzKTsKKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIHBTdGVyZW9PdXQgPSBwT3V0RGF0YTsKICAgICAgICAgfQogCiAgICAgICAgIC8qCiAgICAgICAgICAqIENhbGwgQ1MgcHJvY2VzcyBmdW5jdGlvbgogICAgICAgICAgKi8KLSAgICAgICAgICAgIGVyciA9IExWQ1NfUHJvY2Vzc19DUyhoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcEluRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwU3RlcmVvT3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5yRnJhbWVzKTsKLSNlbHNlCi0gICAgICAgICAgICBlcnIgPSBMVkNTX1Byb2Nlc3NfQ1MoaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBJbkRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTnVtU2FtcGxlcyk7Ci0jZW5kaWYKKyAgICAgICAgZXJyID0gTFZDU19Qcm9jZXNzX0NTKGhJbnN0YW5jZSwgcEluRGF0YSwgcFN0ZXJlb091dCwgTnJGcmFtZXMpOwogCiAgICAgICAgIC8qCiAgICAgICAgICAqIENvbXByZXNzIHRvIHJlZHVjZSBleHBhbnNpb24gZWZmZWN0IG9mIENvbmNlcnQgU291bmQgYW5kIGNvcnJlY3Qgdm9sdW1lCiAgICAgICAgICAqIGRpZmZlcmVuY2VzIGZvciBkaWZmZXJlbmNlIHNldHRpbmdzLiBOb3QgYXBwbGllZCBpbiB0ZXN0IG1vZGVzCiAgICAgICAgICAqLwotICAgICAgICBpZiAoKHBJbnN0YW5jZS0+UGFyYW1zLk9wZXJhdGluZ01vZGUgPT0gTFZDU19PTikmJiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBJbnN0YW5jZS0+UGFyYW1zLkNvbXByZXNzb3JNb2RlID09IExWTV9NT0RFX09OKSkKLSAgICAgICAgeworICAgICAgICBpZiAoKHBJbnN0YW5jZS0+UGFyYW1zLk9wZXJhdGluZ01vZGUgPT0gTFZDU19PTikgJiYKKyAgICAgICAgICAgIChwSW5zdGFuY2UtPlBhcmFtcy5Db21wcmVzc29yTW9kZSA9PSBMVk1fTU9ERV9PTikpIHsKICAgICAgICAgICAgIExWTV9GTE9BVCBHYWluID0gcEluc3RhbmNlLT5Wb2xDb3JyZWN0LkNvbXBNaW47CiAgICAgICAgICAgICBMVk1fRkxPQVQgQ3VycmVudDE7CiAKICAgICAgICAgICAgIEN1cnJlbnQxID0gTFZDX01peGVyX0dldEN1cnJlbnQoJnBJbnN0YW5jZS0+QnlwYXNzTWl4Lk1peGVyX0luc3RhbmNlLk1peGVyU3RyZWFtWzBdKTsKLSAgICAgICAgICAgIEdhaW4gPSAoTFZNX0ZMT0FUKSggIHBJbnN0YW5jZS0+Vm9sQ29ycmVjdC5Db21wTWluCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSAoKChMVk1fRkxPQVQpcEluc3RhbmNlLT5Wb2xDb3JyZWN0LkNvbXBNaW4gICogKEN1cnJlbnQxKSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAoKChMVk1fRkxPQVQpcEluc3RhbmNlLT5Wb2xDb3JyZWN0LkNvbXBGdWxsICogKEN1cnJlbnQxKSkpKTsKKyAgICAgICAgICAgIEdhaW4gPSAoTFZNX0ZMT0FUKShwSW5zdGFuY2UtPlZvbENvcnJlY3QuQ29tcE1pbiAtCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCgoTFZNX0ZMT0FUKXBJbnN0YW5jZS0+Vm9sQ29ycmVjdC5Db21wTWluICogKEN1cnJlbnQxKSkpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKChMVk1fRkxPQVQpcEluc3RhbmNlLT5Wb2xDb3JyZWN0LkNvbXBGdWxsICogKEN1cnJlbnQxKSkpKTsKIAotICAgICAgICAgICAgaWYoTnVtU2FtcGxlcyA8IExWQ1NfQ09NUEdBSU5GUkFNRSkKLSAgICAgICAgICAgIHsKLSNpZmRlZiBTVVBQT1JUX01DCi0gICAgICAgICAgICAgICAgTm9uTGluQ29tcF9GbG9hdChHYWluLCAgICAgICAgICAgICAgICAgICAgLyogQ29tcHJlc3NvciBnYWluIHNldHRpbmcgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTdGVyZW9PdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwU3RlcmVvT3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQzMikoMiAqIE5yRnJhbWVzKSk7Ci0jZWxzZQotICAgICAgICAgICAgICAgIE5vbkxpbkNvbXBfRmxvYXQoR2FpbiwgICAgICAgICAgICAgICAgICAgIC8qIENvbXByZXNzb3IgZ2FpbiBzZXR0aW5nICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0RGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXREYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQzMikoMiAqIE51bVNhbXBsZXMpKTsKLSNlbmRpZgotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgR2FpblN0ZXA7Ci0gICAgICAgICAgICAgICAgTFZNX0ZMT0FUICBGaW5hbEdhaW47Ci0gICAgICAgICAgICAgICAgTFZNX0lOVDE2ICBTYW1wbGVUb1Byb2Nlc3MgPSBOdW1TYW1wbGVzOwotICAgICAgICAgICAgICAgIExWTV9GTE9BVCAgKnBPdXRQdHI7CisgICAgICAgICAgICBpZiAoTnVtU2FtcGxlcyA8IExWQ1NfQ09NUEdBSU5GUkFNRSkgeworICAgICAgICAgICAgICAgIE5vbkxpbkNvbXBfRmxvYXQoR2FpbiwgLyogQ29tcHJlc3NvciBnYWluIHNldHRpbmcgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTdGVyZW9PdXQsIHBTdGVyZW9PdXQsIChMVk1fSU5UMzIpZGVzdE51bVNhbXBsZXMpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBMVk1fRkxPQVQgR2FpblN0ZXA7CisgICAgICAgICAgICAgICAgTFZNX0ZMT0FUIEZpbmFsR2FpbjsKKyAgICAgICAgICAgICAgICBMVk1fSU5UMTYgU2FtcGxlVG9Qcm9jZXNzID0gTnVtU2FtcGxlczsKKyAgICAgICAgICAgICAgICBMVk1fRkxPQVQqIHBPdXRQdHI7CiAKICAgICAgICAgICAgICAgICAvKiBMYXJnZSBjaGFuZ2VzIGluIEdhaW4gY2FuIGNhdXNlIGNsaWNrcyBpbiBvdXRwdXQKICAgICAgICAgICAgICAgICAgICBTcGxpdCBkYXRhIGludG8gc21hbGwgYmxvY2tzIGFuZCB1c2UgaW50ZXJwb2xhdGVkIGdhaW4gdmFsdWVzICovCiAKLSAgICAgICAgICAgICAgICBHYWluU3RlcCA9IChMVk1fRkxPQVQpKCgoR2Fpbi1wSW5zdGFuY2UtPkNvbXByZXNzR2FpbikgKiBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX0NPTVBHQUlORlJBTUUpIC8gTnVtU2FtcGxlcyk7CisgICAgICAgICAgICAgICAgR2FpblN0ZXAgPSAoTFZNX0ZMT0FUKSgoKEdhaW4gLSBwSW5zdGFuY2UtPkNvbXByZXNzR2FpbikgKiBMVkNTX0NPTVBHQUlORlJBTUUpIC8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE51bVNhbXBsZXMpOwogCi0gICAgICAgICAgICAgICAgaWYoKEdhaW5TdGVwID09IDApICYmIChwSW5zdGFuY2UtPkNvbXByZXNzR2FpbiA8IEdhaW4pKQotICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoKEdhaW5TdGVwID09IDApICYmIChwSW5zdGFuY2UtPkNvbXByZXNzR2FpbiA8IEdhaW4pKSB7CiAgICAgICAgICAgICAgICAgICAgIEdhaW5TdGVwID0gMTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgaWYoKEdhaW5TdGVwID09IDApICYmIChwSW5zdGFuY2UtPkNvbXByZXNzR2FpbiA+IEdhaW4pKQotICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKChHYWluU3RlcCA9PSAwKSAmJiAocEluc3RhbmNlLT5Db21wcmVzc0dhaW4gPiBHYWluKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgR2FpblN0ZXAgPSAtMTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIEZpbmFsR2FpbiA9IEdhaW47CiAgICAgICAgICAgICAgICAgR2FpbiA9IHBJbnN0YW5jZS0+Q29tcHJlc3NHYWluOwotI2lmZGVmIFNVUFBPUlRfTUMKICAgICAgICAgICAgICAgICBwT3V0UHRyID0gcFN0ZXJlb091dDsKLSNlbHNlCi0gICAgICAgICAgICAgICAgcE91dFB0ciA9IHBPdXREYXRhOwotI2VuZGlmCiAKLSAgICAgICAgICAgICAgICB3aGlsZShTYW1wbGVUb1Byb2Nlc3MgPiAwKQotICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB3aGlsZSAoU2FtcGxlVG9Qcm9jZXNzID4gMCkgewogICAgICAgICAgICAgICAgICAgICBHYWluID0gKExWTV9GTE9BVCkoR2FpbiArIEdhaW5TdGVwKTsKLSAgICAgICAgICAgICAgICAgICAgaWYoKEdhaW5TdGVwID4gMCkgJiYgKEZpbmFsR2FpbiA8PSBHYWluKSkKLSAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoKEdhaW5TdGVwID4gMCkgJiYgKEZpbmFsR2FpbiA8PSBHYWluKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgR2FpbiA9IEZpbmFsR2FpbjsKICAgICAgICAgICAgICAgICAgICAgICAgIEdhaW5TdGVwID0gMDsKICAgICAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgICAgIGlmKChHYWluU3RlcCA8IDApICYmIChGaW5hbEdhaW4gPiBHYWluKSkKLSAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoKEdhaW5TdGVwIDwgMCkgJiYgKEZpbmFsR2FpbiA+IEdhaW4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBHYWluID0gRmluYWxHYWluOwogICAgICAgICAgICAgICAgICAgICAgICAgR2FpblN0ZXAgPSAwOwogICAgICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICAgICAgaWYoU2FtcGxlVG9Qcm9jZXNzID4gTFZDU19DT01QR0FJTkZSQU1FKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBOb25MaW5Db21wX0Zsb2F0KEdhaW4sICAgICAgICAgICAgICAgICAgICAvKiBDb21wcmVzc29yIGdhaW4gc2V0dGluZyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0UHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0UHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDMyKSgyICogTFZDU19DT01QR0FJTkZSQU1FKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBwT3V0UHRyICs9ICgyICogTFZDU19DT01QR0FJTkZSQU1FKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKFNhbXBsZVRvUHJvY2VzcyA+IExWQ1NfQ09NUEdBSU5GUkFNRSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTm9uTGluQ29tcF9GbG9hdChHYWluLCAvKiBDb21wcmVzc29yIGdhaW4gc2V0dGluZyAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0UHRyLCBwT3V0UHRyLCBjb21wR2FpbkludGVydmFsKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBPdXRQdHIgKz0gY29tcEdhaW5JbnRlcnZhbDsKICAgICAgICAgICAgICAgICAgICAgICAgIFNhbXBsZVRvUHJvY2VzcyA9IChMVk1fSU5UMTYpKFNhbXBsZVRvUHJvY2VzcyAtIExWQ1NfQ09NUEdBSU5GUkFNRSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBOb25MaW5Db21wX0Zsb2F0KEdhaW4sICAgICAgICAgICAgICAgICAgICAvKiBDb21wcmVzc29yIGdhaW4gc2V0dGluZyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0UHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0UHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDMyKSgyICogU2FtcGxlVG9Qcm9jZXNzKSk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBOb25MaW5Db21wX0Zsb2F0KEdhaW4sIC8qIENvbXByZXNzb3IgZ2FpbiBzZXR0aW5nICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXRQdHIsIHBPdXRQdHIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjaGFubmVscyA9PSBGQ0NfMSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IChMVk1fSU5UMzIpKFNhbXBsZVRvUHJvY2VzcykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IChMVk1fSU5UMzIpKEZDQ18yICogU2FtcGxlVG9Qcm9jZXNzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICBTYW1wbGVUb1Byb2Nlc3MgPSAwOwogICAgICAgICAgICAgICAgICAgICB9Ci0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAKQEAgLTM3NCw1NyArMjc5LDMzIEBACiAgICAgICAgICAgICBwSW5zdGFuY2UtPkNvbXByZXNzR2FpbiA9IEdhaW47CiAgICAgICAgIH0KIAotICAgICAgICBpZihwSW5zdGFuY2UtPmJJbk9wZXJhdGluZ01vZGVUcmFuc2l0aW9uID09IExWTV9UUlVFKXsKLQorICAgICAgICBpZiAocEluc3RhbmNlLT5iSW5PcGVyYXRpbmdNb2RlVHJhbnNpdGlvbiA9PSBMVk1fVFJVRSkgewogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIFJlLWluaXQgYnlwYXNzIG1peCB3aGVuIHRpbWVyIGhhcyBjb21wbGV0ZWQKICAgICAgICAgICAgICAqLwogICAgICAgICAgICAgaWYgKChwSW5zdGFuY2UtPmJUaW1lckRvbmUgPT0gTFZNX1RSVUUpICYmCi0gICAgICAgICAgICAgICAgKHBJbnN0YW5jZS0+QnlwYXNzTWl4Lk1peGVyX0luc3RhbmNlLk1peGVyU3RyZWFtWzFdLkNhbGxiYWNrU2V0ID09IDApKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGVyciA9IExWQ1NfQnlwYXNzTWl4SW5pdChoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwSW5zdGFuY2UtPlBhcmFtcyk7CisgICAgICAgICAgICAgICAgKHBJbnN0YW5jZS0+QnlwYXNzTWl4Lk1peGVyX0luc3RhbmNlLk1peGVyU3RyZWFtWzFdLkNhbGxiYWNrU2V0ID09IDApKSB7CisgICAgICAgICAgICAgICAgZXJyID0gTFZDU19CeXBhc3NNaXhJbml0KGhJbnN0YW5jZSwgJnBJbnN0YW5jZS0+UGFyYW1zKTsKIAotICAgICAgICAgICAgICAgIGlmKGVyciAhPSBMVkNTX1NVQ0NFU1MpCi0gICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChlcnIgIT0gTFZDU19TVUNDRVNTKSB7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlcnI7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlewotICAgICAgICAgICAgICAgIExWTV9UaW1lciAoICZwSW5zdGFuY2UtPlRpbWVySW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgTFZNX1RpbWVyKCZwSW5zdGFuY2UtPlRpbWVySW5zdGFuY2UsIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KLSNpZmRlZiBTVVBQT1JUX01DCi0gICAgICAgIENvcHlfRmxvYXRfU3RlcmVvX01jKHBJbkRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBTdGVyZW9PdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBPdXREYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOckZyYW1lcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbHMpOwotI2VuZGlmCi0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIGlmIChwSW5EYXRhICE9IHBPdXREYXRhKQotICAgICAgICB7Ci0jaWZkZWYgU1VQUE9SVF9NQworICAgICAgICBDb3B5X0Zsb2F0X1N0ZXJlb19NYyhwSW5EYXRhLCAoY29uc3QgTFZNX0ZMT0FUKilwU3RlcmVvT3V0LCBwT3V0RGF0YSwgTnJGcmFtZXMsIGNoYW5uZWxzKTsKKyAgICB9IGVsc2UgeworICAgICAgICBpZiAocEluRGF0YSAhPSBwT3V0RGF0YSkgewogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIFRoZSBhbGdvcml0aG0gaXMgZGlzYWJsZWQgc28ganVzdCBjb3B5IHRoZSBkYXRhCiAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIENvcHlfRmxvYXQoKExWTV9GTE9BVCAqKXBJbkRhdGEsICAgICAgICAgICAgICAgLyogU291cmNlICovCi0gICAgICAgICAgICAgICAgICAgICAgIChMVk1fRkxPQVQgKilwT3V0RGF0YSwgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KShjaGFubmVscyAqIE5yRnJhbWVzKSk7ICAgIC8qIEFsbCBDaGFubmVscyovCi0jZWxzZQotICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAqIFRoZSBhbGdvcml0aG0gaXMgZGlzYWJsZWQgc28ganVzdCBjb3B5IHRoZSBkYXRhCi0gICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIENvcHlfRmxvYXQoKExWTV9GTE9BVCAqKXBJbkRhdGEsICAgICAgICAgICAgICAgLyogU291cmNlICovCi0gICAgICAgICAgICAgICAgICAgICAgIChMVk1fRkxPQVQgKilwT3V0RGF0YSwgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KSgyICogTnVtU2FtcGxlcykpOyAgICAgICAgICAgICAvKiBMZWZ0IGFuZCByaWdodCAqLwotI2VuZGlmCisgICAgICAgICAgICBDb3B5X0Zsb2F0KChMVk1fRkxPQVQqKXBJbkRhdGEsICAgICAgICAgICAgICAgLyogU291cmNlICovCisgICAgICAgICAgICAgICAgICAgICAgIChMVk1fRkxPQVQqKXBPdXREYXRhLCAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KKyAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoY2hhbm5lbHMgKiBOckZyYW1lcykpOyAvKiBBbGwgQ2hhbm5lbHMqLwogICAgICAgICB9CiAgICAgfQogCi0gICAgcmV0dXJuKExWQ1NfU1VDQ0VTUyk7CisgICAgcmV0dXJuIChMVkNTX1NVQ0NFU1MpOwogfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX1JldmVyYkdlbmVyYXRvci5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfUmV2ZXJiR2VuZXJhdG9yLmNwcAppbmRleCBkMGU2ZTA5Li5kZTIzZDA3IDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfUmV2ZXJiR2VuZXJhdG9yLmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfUmV2ZXJiR2VuZXJhdG9yLmNwcApAQCAtMjAsNyArMjAsOCBAQAogLyogIEluY2x1ZGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCisjaW5jbHVkZSA8c3lzdGVtL2F1ZGlvLmg+CisjaW5jbHVkZSA8c3RkbGliLmg+CiAjaW5jbHVkZSAiTFZDUy5oIgogI2luY2x1ZGUgIkxWQ1NfUHJpdmF0ZS5oIgogI2luY2x1ZGUgIkxWQ1NfUmV2ZXJiR2VuZXJhdG9yLmgiCkBAIC01NywzMSArNTgsMTkgQEAKIC8qICAyLiAgVGhlIG51bWVyYXRvciBjb2VmZmljaWVudHMgb2YgdGhlIGZpbHRlciBhcmUgbmVnYXRlZCB0byBjYXVzZSBhbiBpbnZlcnNpb24uICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLUxWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfUmV2ZXJiR2VuZXJhdG9ySW5pdChMVkNTX0hhbmRsZV90ICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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F5KTsKLSAgICAgICAgcENvbmZpZy0+RGVsYXlPZmZzZXQgICAgPSAwOwotICAgICAgICBMb2FkQ29uc3RfRmxvYXQoMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFZhbHVlICovCi0gICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUICopJnBDb25maWctPlN0ZXJlb1NhbXBsZXNbMF0sICAgICAgLyogRGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiB3b3JkcyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9VSU5UMTYpKHNpemVvZihwQ29uZmlnLT5TdGVyZW9TYW1wbGVzKSAvIHNpemVvZihMVk1fRkxPQVQpKSk7CisgICAgICAgIHBDb25maWctPkRlbGF5U2l6ZSA9CisgICAgICAgICAgICAgICAgKHBQYXJhbXMtPk5yQ2hhbm5lbHMgPT0gRkNDXzEpID8gKExWTV9JTlQxNilEZWxheSA6IChMVk1fSU5UMTYpKEZDQ18yICogRGVsYXkpOworICAgICAgICBwQ29uZmlnLT5EZWxheU9mZnNldCA9IDA7CisgICAgICAgIG1lbXNldChwQ29uZmlnLT5TdGVyZW9TYW1wbGVzLCAwLCBzaXplb2YocENvbmZpZy0+U3RlcmVvU2FtcGxlcykpOwogICAgICAgICAvKgogICAgICAgICAgKiBTZXR1cCB0aGUgZmlsdGVycwogICAgICAgICAgKi8KICAgICAgICAgT2Zmc2V0ID0gKExWTV9VSU5UMTYpcFBhcmFtcy0+U2FtcGxlUmF0ZTsKICAgICAgICAgcFJldmVyYkNvZWZUYWJsZSA9IChCaXF1YWRBMDEyQjEyQ29lZnNTUF90KikmTFZDU19SZXZlcmJDb2VmVGFibGVbMF07CiAKLSAgICAgICAgLyogQ29udmVydCBpbmNvbWluZyBjb2VmZmljaWVudHMgdG8gdGhlIHJlcXVpcmVkIGZvcm1hdC9vcmRlcmluZyAqLwotICAgICAgICBDb2VmZnMuQTAgPSAoTFZNX0ZMT0FUKXBSZXZlcmJDb2VmVGFibGVbT2Zmc2V0XS5BMDsKLSAgICAgICAgQ29lZmZzLkExID0gKExWTV9GTE9BVClwUmV2ZXJiQ29lZlRhYmxlW09mZnNldF0uQTE7Ci0gICAgICAgIENvZWZmcy5BMiA9IChMVk1fRkxPQVQpcFJldmVyYkNvZWZUYWJsZVtPZmZzZXRdLkEyOwotICAgICAgICBDb2VmZnMuQjEgPSAoTFZNX0ZMT0FUKS1wUmV2ZXJiQ29lZlRhYmxlW09mZnNldF0uQjE7Ci0gICAgICAgIENvZWZmcy5CMiA9IChMVk1fRkxPQVQpLXBSZXZlcmJDb2VmVGFibGVbT2Zmc2V0XS5CMjsKLQotICAgICAgICBMb2FkQ29uc3RfRmxvYXQoMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBWYWx1ZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCAqKSZwRGF0YS0+UmV2ZXJiQmlxdWFkVGFwcywgLyogRGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiB3b3JkcyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9VSU5UMTYpKHNpemVvZihwRGF0YS0+UmV2ZXJiQmlxdWFkVGFwcykgLyBzaXplb2YoTFZNX0ZMT0FUKSkpOwotCi0gICAgICAgIEJRXzJJX0QxNkYxNkNzc19UUkNfV1JBXzAxX0luaXQoJnBDb2VmZmljaWVudHMtPlJldmVyYkJpcXVhZEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwRGF0YS0+UmV2ZXJiQmlxdWFkVGFwcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmQ29lZmZzKTsKLQotICAgICAgICAvKiBDYWxsYmFja3MgKi8KLSAgICAgICAgc3dpdGNoKHBSZXZlcmJDb2VmVGFibGVbT2Zmc2V0XS5TY2FsZSkKLSAgICAgICAgewotICAgICAgICAgICAgY2FzZSAxNDoKLSAgICAgICAgICAgICAgICBwQ29uZmlnLT5wQmlxdWFkQ2FsbEJhY2sgID0gQlFfMklfRDE2RjE2QzE0X1RSQ19XUkFfMDE7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICBjYXNlIDE1OgotICAgICAgICAgICAgICAgIHBDb25maWctPnBCaXF1YWRDYWxsQmFjayAgPSBCUV8ySV9EMTZGMTZDMTVfVFJDX1dSQV8wMTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQorICAgICAgICBzdGQ6OmFycmF5PExWTV9GTE9BVCwgYW5kcm9pZDo6YXVkaW9fdXRpbHM6OmtCaXF1YWROdW1Db2Vmcz4gY29lZnMgPSB7CisgICAgICAgICAgICAgICAgcFJldmVyYkNvZWZUYWJsZVtPZmZzZXRdLkEwLCBwUmV2ZXJiQ29lZlRhYmxlW09mZnNldF0uQTEsCisgICAgICAgICAgICAgICAgcFJldmVyYkNvZWZUYWJsZVtPZmZzZXRdLkEyLCBwUmV2ZXJiQ29lZlRhYmxlW09mZnNldF0uQjEsCisgICAgICAgICAgICAgICAgcFJldmVyYkNvZWZUYWJsZVtPZmZzZXRdLkIyfTsKKyAgICAgICAgcEluc3RhbmNlLT5wUmV2QmlxdWFkLnJlc2V0KG5ldyBhbmRyb2lkOjphdWRpb191dGlsczo6QmlxdWFkRmlsdGVyPExWTV9GTE9BVD4oCisgICAgICAgICAgICAgICAgKHBQYXJhbXMtPk5yQ2hhbm5lbHMgPT0gRkNDXzEpID8gRkNDXzEgOiBGQ0NfMiwgY29lZnMpKTsKIAogICAgICAgICAvKgogICAgICAgICAgKiBTZXR1cCB0aGUgbWl4ZXIKICAgICAgICAgICovCiAgICAgICAgIHBDb25maWctPlByb2NHYWluID0gKExWTV9VSU5UMTYpKEhFQURQSE9ORUdBSU5QUk9DKTsKLSAgICAgICAgcENvbmZpZy0+V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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTE4MSw0NiArMTQ3LDM4IEBACiAvKiAgMi4gIFRoZSBHYWluIGlzIGNvbWJpbmVkIHdpdGggdGhlIExQRiBhbmQgaW5jb3Jwb3JhdGVkIGluIHRvIHRoZSBjb2VmZmljaWVudHMgICAqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi1MVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX1JldmVyYkdlbmVyYXRvcihMVkNTX0hhbmRsZV90ICAgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICpwSW5EYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICpwT3V0RGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICAgICBOdW1TYW1wbGVzKQoteworTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19SZXZlcmJHZW5lcmF0b3IoTFZDU19IYW5kbGVfdCBoSW5zdGFuY2UsIGNvbnN0IExWTV9GTE9BVCogcEluRGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCogcE91dERhdGEsIExWTV9VSU5UMTYgTnVtU2FtcGxlcykgeworICAgIExWQ1NfSW5zdGFuY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WQ1NfTUVNUkVHSU9OX1RFTVBPUkFSWV9GQVNUXS5wQmFzZUFkZHJlc3M7CisgICAgcFNjcmF0Y2ggPSAoTFZNX0ZMT0FUKilwSW5zdGFuY2UtPnBTY3JhdGNoOwogCiAgICAgLyoKICAgICAgKiBDb3B5IHRoZSBkYXRhIHRvIHRoZSBvdXRwdXQgaW4gb3V0cGxhY2UgcHJvY2Vzc2luZwogICAgICAqLwotICAgIGlmIChwSW5EYXRhICE9IHBPdXREYXRhKQotICAgIHsKKyAgICBpZiAocEluRGF0YSAhPSBwT3V0RGF0YSkgewogICAgICAgICAvKgogICAgICAgICAgKiBSZXZlcmIgbm90IHJlcXVpcmVkIHNvIGp1c3QgY29weSB0aGUgZGF0YQogICAgICAgICAgKi8KLSAgICAgICAgQ29weV9GbG9hdCgoTFZNX0ZMT0FUICopcEluRGF0YSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUICopcE91dERhdGEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpKDIgKiBOdW1TYW1wbGVzKSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTGVmdCBhbmQgcmlnaHQgKi8KKyAgICAgICAgQ29weV9GbG9hdCgoTFZNX0ZMT0FUKilwSW5EYXRhLCAgICAgICAgLyogU291cmNlICovCisgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCopcE91dERhdGEsICAgICAgIC8qIERlc3RpbmF0aW9uICovCisgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilkZXN0TnVtU2FtcGxlcyk7IC8qIE51bWJlciBvZiBmcmFtZXMgKi8KICAgICB9CiAKICAgICAvKgogICAgICAqIENoZWNrIGlmIHRoZSByZXZlcmIgaXMgcmVxdWlyZWQKICAgICAgKi8KICAgICAvKiBEaXNhYmxlIHdoZW4gQ1M0TVMgaW4gc3RlcmVvIG1vZGUgKi8KLSAgICBpZiAoKCgoTFZDU19PdXRwdXREZXZpY2VfZW4pcEluc3RhbmNlLT5QYXJhbXMuU3BlYWtlclR5cGUgPT0gTFZDU19IRUFEUEhPTkUpIHx8IFwKKyAgICBpZiAoKCgoTFZDU19PdXRwdXREZXZpY2VfZW4pcEluc3RhbmNlLT5QYXJhbXMuU3BlYWtlclR5cGUgPT0gTFZDU19IRUFEUEhPTkUpIHx8CiAgICAgICAgICAocEluc3RhbmNlLT5QYXJhbXMuU3BlYWtlclR5cGUgPT0gTFZDU19FWF9IRUFEUEhPTkVTKSB8fAotICAgICAgICAgKHBJbnN0YW5jZS0+UGFyYW1zLlNvdXJjZUZvcm1hdCAhPSBMVkNTX1NURVJFTykpICAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRm9yIHZhbGlkYXRpb24gdGVzdGluZyAqLwotICAgICAgICAoKHBJbnN0YW5jZS0+UGFyYW1zLk9wZXJhdGluZ01vZGUgJiBMVkNTX1JFVkVSQlNXSVRDSCkgIT0wKSkKLSAgICB7CisgICAgICAgICAocEluc3RhbmNlLT5QYXJhbXMuU291cmNlRm9ybWF0ICE9IExWQ1NfU1RFUkVPKSkgJiYKKyAgICAgICAgLyogRm9yIHZhbGlkYXRpb24gdGVzdGluZyAqLworICAgICAgICAoKHBJbnN0YW5jZS0+UGFyYW1zLk9wZXJhdGluZ01vZGUgJiBMVkNTX1JFVkVSQlNXSVRDSCkgIT0gMCkpIHsKICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogICAgICAgICAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAgICAgICAgIC8qIENvcHkgdGhlIGlucHV0IGRhdGEgdG8gc2NyYXRjaCBtZW1vcnkgYW5kIGZpbHRlciBpdCAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTIzMCwzNCArMTg4LDI0IEBACiAgICAgICAgIC8qCiAgICAgICAgICAqIENvcHkgdGhlIGlucHV0IGRhdGEgdG8gdGhlIHNjcmF0Y2ggbWVtb3J5CiAgICAgICAgICAqLwotICAgICAgICBDb3B5X0Zsb2F0KChMVk1fRkxPQVQgKilwSW5EYXRhLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KLSAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUICopcFNjcmF0Y2gsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KSgyICogTnVtU2FtcGxlcykpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBMZWZ0IGFuZCByaWdodCAqLworICAgICAgICBDb3B5X0Zsb2F0KChMVk1fRkxPQVQqKXBJbkRhdGEsICAgICAgICAvKiBTb3VyY2UgKi8KKyAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUKilwU2NyYXRjaCwgICAgICAgLyogRGVzdGluYXRpb24gKi8KKyAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KWRlc3ROdW1TYW1wbGVzKTsgLyogTnVtYmVyIG9mIGZyYW1lcyAqLwogCiAgICAgICAgIC8qCiAgICAgICAgICAqIEZpbHRlciB0aGUgZGF0YQogICAgICAgICAgKi8KLSAgICAgICAgKHBDb25maWctPnBCaXF1YWRDYWxsQmFjaykoKEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90KikmcENvZWZmaWNpZW50cy0+UmV2ZXJiQmlxdWFkSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fRkxPQVQgKilwU2NyYXRjaCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCAqKXBTY3JhdGNoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICBwSW5zdGFuY2UtPnBSZXZCaXF1YWQtPnByb2Nlc3MocFNjcmF0Y2gsIHBTY3JhdGNoLCBOdW1TYW1wbGVzKTsKIAotICAgICAgICBNdWx0M3NfRmxvYXQoIChMVk1fRkxPQVQgKilwU2NyYXRjaCwKLSAgICAgICAgICAgICAgICAgICAgICBwQ29uZmlnLT5SZXZlcmJMZXZlbCwKLSAgICAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUICopcFNjcmF0Y2gsCi0gICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNikoMiAqIE51bVNhbXBsZXMpKTsKKyAgICAgICAgTXVsdDNzX0Zsb2F0KChMVk1fRkxPQVQqKXBTY3JhdGNoLCBwQ29uZmlnLT5SZXZlcmJMZXZlbCwgKExWTV9GTE9BVCopcFNjcmF0Y2gsCisgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KWRlc3ROdW1TYW1wbGVzKTsgLyogTnVtYmVyIG9mIGZyYW1lcyAqLwogCiAgICAgICAgIC8qCiAgICAgICAgICAqIEFwcGx5IHRoZSBkZWxheSBtaXgKICAgICAgICAgICovCi0gICAgICAgIERlbGF5TWl4X0Zsb2F0KChMVk1fRkxPQVQgKilwU2NyYXRjaCwKLSAgICAgICAgICAgICAgICAgICAgICAgJnBDb25maWctPlN0ZXJlb1NhbXBsZXNbMF0sCi0gICAgICAgICAgICAgICAgICAgICAgIHBDb25maWctPkRlbGF5U2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICZwQ29uZmlnLT5EZWxheU9mZnNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKLQorICAgICAgICBEZWxheU1peF9GbG9hdCgoTFZNX0ZMT0FUKilwU2NyYXRjaCwgJnBDb25maWctPlN0ZXJlb1NhbXBsZXNbMF0sIHBDb25maWctPkRlbGF5U2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgcE91dERhdGEsICZwQ29uZmlnLT5EZWxheU9mZnNldCwgKExWTV9JTlQxNilOdW1TYW1wbGVzLCBOdW1DaGFubmVscyk7CiAgICAgfQogCi0gICAgcmV0dXJuKExWQ1NfU1VDQ0VTUyk7CisgICAgcmV0dXJuIChMVkNTX1NVQ0NFU1MpOwogfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX1JldmVyYkdlbmVyYXRvci5oIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX1JldmVyYkdlbmVyYXRvci5oCmluZGV4IDFiYzQzMzguLjA0OWVlZjIgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19SZXZlcmJHZW5lcmF0b3IuaAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfUmV2ZXJiR2VuZXJhdG9yLmgKQEAgLTMyLDggKzMyLDggQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0jZGVmaW5lICAgICBIRUFEUEhPTkVHQUlOUFJPQyAgICAgICAgICAgTFZDU19IRUFEUEhPTkVfUFJPQ0dBSU4KLSNkZWZpbmUgICAgIEhFQURQSE9ORUdBSU5VTlBST0MgICAgICAgICBMVkNTX0hFQURQSE9ORV9VTlBST0NHQUlOCisjZGVmaW5lIEhFQURQSE9ORUdBSU5QUk9DIExWQ1NfSEVBRFBIT05FX1BST0NHQUlOCisjZGVmaW5lIEhFQURQSE9ORUdBSU5VTlBST0MgTFZDU19IRUFEUEhPTkVfVU5QUk9DR0FJTgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KQEAgLTQyLDIwICs0MiwxNSBAQAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAogLyogUmV2ZXJiZXJhdGlvbiBtb2R1bGUgc3RydWN0dXJlICovCi10eXBlZGVmIHN0cnVjdAotewotCit0eXBlZGVmIHN0cnVjdCB7CiAgICAgLyogU3RlcmVvIGRlbGF5ICovCi0gICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgIERlbGF5U2l6ZTsKLSAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgRGVsYXlPZmZzZXQ7Ci0gICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgIFByb2NHYWluOwotICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgICBVbnByb2NHYWluOwotICAgIExWTV9GTE9BVCAgICAgICAgICAgICAgICAgICBTdGVyZW9TYW1wbGVzWzIgKiBMVkNTX1NURVJFT0RFTEFZX0NTX01BWF9WQUxdOworICAgIExWTV9JTlQxNiBEZWxheVNpemU7CisgICAgTFZNX0lOVDE2IERlbGF5T2Zmc2V0OworICAgIExWTV9JTlQxNiBQcm9jR2FpbjsKKyAgICBMVk1fSU5UMTYgVW5wcm9jR2FpbjsKKyAgICBMVk1fRkxPQVQgU3RlcmVvU2FtcGxlc1syICogTFZDU19TVEVSRU9ERUxBWV9DU19NQVhfVkFMXTsKICAgICAvKiBSZXZlcmIgTGV2ZWwgKi8KLSAgICBMVk1fRkxPQVQgICAgICAgICAgICAgICAgICAgUmV2ZXJiTGV2ZWw7Ci0gICAgLyogRmlsdGVyICovCi0gICAgdm9pZCAgICAgICAgICAgICAgICAgICAgICAgICgqcEJpcXVhZENhbGxCYWNrKSAoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QqLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCosIExWTV9GTE9BVCosIExWTV9JTlQxNik7CisgICAgTFZNX0ZMT0FUIFJldmVyYkxldmVsOwogfSBMVkNTX1JldmVyYkdlbmVyYXRvcl90OwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtNjQsMTEgKzU5LDggQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLUxWQ1NfUmV0dXJuU3RhdHVzX2VuIExWQ1NfUmV2ZXJiR2VuZXJhdG9ySW5pdChMVkNTX0hhbmRsZV90ICAgICBoSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZDU19QYXJhbXNfdCAgKnBQYXJhbXMpOwotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19SZXZlcmJH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RW5oYW5jZXIuY3BwCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19TdGVyZW9FbmhhbmNlci5jcHAKQEAgLTIxLDYgKzIxLDcgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCisjaW5jbHVkZSA8c3lzdGVtL2F1ZGlvLmg+CiAjaW5jbHVkZSAiTFZDUy5oIgogI2luY2x1ZGUgIkxWQ1NfUHJpdmF0ZS5oIgogI2luY2x1ZGUgIkxWQ1NfU3RlcmVvRW5oYW5jZXIuaCIKQEAgLTQ5LDk2ICs1MCwzOSBAQAogLyogTk9URVM6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19TRW5oYW5jZXJJbml0KExWQ1NfSGFuZGxlX3QgICAgICAgaEluc3RhbmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfUGFyYW1zX3QgICAgICAgKnBQYXJhbXMpCi17Ci0KLSAgICBMVk1fVUlOVDE2ICAgICAgICAgICAgICBPZmZzZXQ7Ci0gICAgTFZDU19JbnN0YW5jZV90ICAgICAgICAgKnBJbnN0YW5jZSA9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bG9hdCgwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBWYWx1ZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCAqKSZwRGF0YS0+U0VCaXF1YWRUYXBzTWlkLCAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgLyogTnVtYmVyIG9mIHdvcmRzICovCi0gICAgICAgICAgICAgICAgICAgICAgICAoTFZNX1VJTlQxNikoc2l6ZW9mKHBEYXRhLT5TRUJpcXVhZFRhcHNNaWQpIC8gc2l6ZW9mKExWTV9GTE9BVCkpKTsKLQotICAgICAgICBGT18xSV9EMTZGMTZDc3NfVFJDX1dSQV8wMV9Jbml0KCZwQ29lZmZpY2llbnQtPlNFQmlxdWFkSW5zdGFuY2VNaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBEYXRhLT5TRUJpcXVhZFRhcHNNaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkNvZWZmc01pZCk7Ci0KLSAgICAgICAgLyogQ2FsbGJhY2tzICovCi0gICAgICAgIGlmKExWQ1NfU0VNaWRDb2VmVGFibGVbT2Zmc2V0XS5TY2FsZSA9PSAxNSkKLSAgICAgICAgewotICAgICAgICAgICAgcENvbmZpZy0+cEJpcXVhZENhbGxCYWNrX01pZCAgPSBGT18xSV9EMTZGMTZDMTVfVFJDX1dSQV8wMTsKLSAgICAgICAgfQorICAgICAgICBzdGQ6OmFycmF5PExWTV9GTE9BVCwgYW5kcm9pZDo6YXVkaW9fdXRpbHM6OmtCaXF1YWROdW1Db2Vmcz4gY29lZnMgPSB7CisgICAgICAgICAgICAgICAgTFZDU19TRU1pZENvZWZUYWJsZVtPZmZzZXRdLkEwLCBMVkNTX1NFTWlkQ29lZlRhYmxlW09mZnNldF0uQTEsIDAuMCwKKyAgICAgICAgICAgICAgICBMVkNTX1NFTWlkQ29lZlRhYmxlW09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wRGF0YS0+U0VCaXF1YWRUYXBzU2lkZSwgLyogRGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiB3b3JkcyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9VSU5UMTYpKHNpemVvZihwRGF0YS0+U0VCaXF1YWRUYXBzU2lkZSkgLyBzaXplb2YoTFZNX0ZMT0FUKSkpOwotICAgICAgICAvKiBDYWxsYmFja3MgKi8KLSAgICAgICAgc3dpdGNoKHBTRVNpZGVDb2Vmc1tPZmZzZXRdLlNjYWxlKQotICAgICAgICB7Ci0gICAgICAgICAgICBjYXNlIDE0OgotICAgICAgICAgICAgICAgIEJRXzFJX0QxNkYzMkNzc19UUkNfV1JBXzAxX0luaXQoJnBDb2VmZmljaWVudC0+U0VCaXF1YWRJbnN0YW5jZVNpZGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcERhdGEtPlNFQmlxdWFkVGFwc1NpZGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmQ29lZmZzU2lkZSk7Ci0KLSAgICAgICAgICAgICAgICBwQ29uZmlnLT5wQmlxdWFkQ2FsbEJhY2tfU2lkZSAgPSBCUV8xSV9EMTZGMzJDMTRfVFJDX1dSQV8wMTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgMTU6Ci0gICAgICAgICAgICAgICAgQlFfMUlfRDE2RjE2Q3NzX1RSQ19XUkFfMDFfSW5pdCgmcENvZWZmaWNpZW50LT5TRUJpcXVhZEluc3RhbmNlU2lkZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwRGF0YS0+U0VCaXF1YWRUYXBzU2lkZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZDb2VmZnNTaWRlKTsKLQotICAgICAgICAgICAgICAgIHBDb25maWctPnBCaXF1YWRDYWxsQmFja19TaWRlICA9IEJRXzFJX0QxNkYxNkMxNV9UUkNfV1JBXzAxOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0KKyAgICAgICAgY29lZnMgPSB7cFNFU2lkZUNvZWZzW09mZnNldF0uQTAsIHBTRVNpZGVDb2Vmc1tPZmZzZXRdLkExLCBwU0VTaWRlQ29lZnNbT2Zmc2V0XS5BMiwKKyAgICAgICAgICAgICAgICAgcFNFU2lkZUNvZWZzW09mZnNldF0uQjEsIHBTRVNpZGVDb2Vmc1tPZmZzZXRdLkIyfTsKKyAgICAgICAgcEluc3RhbmNlLT5wU0VTaWRlQmlxdWFkLnJlc2V0KAorICAgICAgICAgICAgICAgIG5ldyBhbmRyb2lkOjphdWRpb191dGlsczo6QmlxdWFkRmlsdGVyPExWTV9GTE9BVD4oRkNDXzEsIGNvZWZzKSk7CiAgICAgfQogCi0gICAgcmV0dXJuKExWQ1NfU1VDQ0VTUyk7CisgICAgcmV0dXJuIChMVkNTX1NVQ0NFU1MpOwogfQogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0xNzgsODUgKzEyMiw2NyBAQAogLyogIDEuICBUaGUgc2lkZSBmaWx0ZXIgaXMgbm90IHVzZWQgaW4gTW9iaWxlIFNwZWFrZXIgbW9kZSAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19TdGVyZW9FbmhhbmNlcihMVkNTX0hhbmRsZV90ICAgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTFZNX0ZMT0FUICAgICAgICAqcEluRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAqcE91dERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9VSU5UMTYgICAgICAgICAgICAgTnVtU2FtcGxlcykKLXsKLQotICAgIExWQ1NfSW5zdGFuY2VfdCAgICAgICAgICpwSW5zdGFuY2UgPSAoTFZDU19JbnN0YW5jZV90ICAqKWhJbnN0YW5jZTsKLSAgICBMVkNTX1N0ZXJlb0VuaGFuY2VyX3QgICAqcENvbmZpZyAgID0gKExWQ1NfU3RlcmVvRW5oYW5jZXJfdCAqKSZwSW5zdGFuY2UtPlN0ZXJlb0VuaGFuY2VyOwotICAgIExWQ1NfQ29lZmZpY2llbnRfdCAgICAgICpwQ29lZmZpY2llbnQ7Ci0gICAgTFZNX0ZMT0FUICAgICAgICAgICAgICAgKnBTY3JhdGNoOwotCi0gICAgcENvZWZmaWNpZW50ID0gKExWQ1NfQ29lZmZpY2llbnRfdCAqKSBcCi0gICAgICAgICAgICAgICAgICAgcEluc3RhbmNlLT5NZW1vcnlUYWJsZS5SZWdpb25bTFZDU19NRU1SRUdJT05fUEVSU0lTVEVOVF9GQVNUX0NPRUZdLnBCYXNlQWRkcmVzczsKLQotICAgIHBTY3JhdGNoICA9IChMVk1fRkxPQVQgKikgXAotICAgICAgICAgICAgICAgICAgICBwSW5zdGFuY2UtPk1lbW9yeVRhYmxlLlJlZ2lvbltMVkNTX01FTVJFR0lPTl9URU1QT1JBUllfRkFTVF0ucE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ZXJ0IGZyb20gc3RlcmVvIHRvIG1pZGRsZSBhbmQgc2lkZQogICAgICAgICAgKi8KLSAgICAgICAgRnJvbTJpVG9NU19GbG9hdChwSW5EYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoLAotICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoICsgTnVtU2FtcGxlcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICBpZiAoTnVtQ2hhbm5lbHMgPT0gMSkgeworICAgICAgICAgICAgLy8gQ29weSBzYW1lIGlucHV0IHRvIHNjcmF0Y2ggYXMgTWlkZGxlIGRhdGEKKyAgICAgICAgICAgIENvcHlfRmxvYXQoKExWTV9GTE9BVCopcEluRGF0YSwgKExWTV9GTE9BVCopcFNjcmF0Y2gsIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBGcm9tMmlUb01TX0Zsb2F0KHBJbkRhdGEsIHBTY3JhdGNoLCBwU2NyYXRjaCArIE51bVNhbXBsZXMsIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgIH0KIAogICAgICAgICAvKgogICAgICAgICAgKiBBcHBseSBmaWx0ZXIgdG8gdGhlIG1pZGRsZSBzaWduYWwKICAgICAgICAgICovCi0gICAgICAgIGlmIChwSW5zdGFuY2UtPk91dHB1dERldmljZSA9PSBMVkNTX0hFQURQSE9ORSkKLSAgICAgICAgewotICAgICAgICAgICAgKHBDb25maWctPnBCaXF1YWRDYWxsQmFja19NaWQpKChCaXF1YWRfRkxPQVRfSW5zdGFuY2VfdCopXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcENvZWZmaWNpZW50LT5TRUJpcXVhZEluc3RhbmNlTWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUICopcFNjcmF0Y2gsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fRkxPQVQgKilwU2NyYXRjaCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIE11bHQzc19GbG9hdChwU2NyYXRjaCwgICAgICAgICAgICAgIC8qIFNvdXJjZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fRkxPQVQpcENvbmZpZy0+TWlkR2FpbiwgICAgICAvKiBHYWluICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgcFNjcmF0Y2gsICAgICAgICAgICAgICAvKiBEZXN0aW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7ICAgICAgICAgICAvKiBOdW1iZXIgb2Ygc2FtcGxlcyAqLworICAgICAgICBpZiAocEluc3RhbmNlLT5PdXRwdXREZXZpY2UgPT0gTFZDU19IRUFEUEhPTkUpIHsKKyAgICAgICAgICAgIHBJbnN0YW5jZS0+cFNFTWlkQmlxdWFkLT5wcm9jZXNzKHBTY3JhdGNoLCBwU2NyYXRjaCwgTnVtU2FtcGxlcyk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBNdWx0M3NfRmxvYXQocFNjcmF0Y2gsICAgICAgICAgICAgICAgICAgICAvKiBTb3VyY2UgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUKXBDb25maWctPk1pZEdhaW4sIC8qIEdhaW4gKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICBwU2NyYXRjaCwgICAgICAgICAgICAgICAgICAgIC8qIERlc3RpbmF0aW9uICovCisgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsgICAgICAvKiBOdW1iZXIgb2Ygc2FtcGxlcyAqLwogICAgICAgICB9CiAKICAgICAgICAgLyoKICAgICAgICAgICogQXBwbHkgdGhlIGZpbHRlciB0aGUgc2lkZSBzaWduYWwgb25seSBpbiBzdGVyZW8gbW9kZSBmb3IgaGVhZHBob25lcwogICAgICAgICAgKiBhbmQgaW4gYWxsIG1vZGVzIGZvciBtb2JpbGUgc3BlYWtlcnMKICAgICAgICAgICovCi0gICAgICAgIGlmIChwSW5zdGFuY2UtPlBhcmFtcy5Tb3VyY2VGb3JtYXQgPT0gTFZDU19TVEVSRU8pCi0gICAgICAgIHsKLSAgICAgICAgICAgIChwQ29uZmlnLT5wQmlxdWFkQ2FsbEJhY2tfU2lkZSkoKEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90KikgXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcENvZWZmaWNpZW50LT5TRUJpcXVhZEluc3RhbmNlU2lkZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCAqKShwU2NyYXRjaCArIE51bVNhbXBsZXMpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0ZMT0FUICopKHBTY3JhdGNoICsgTnVtU2FtcGxlcyksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChMVk1fSU5UMTYpTnVtU2FtcGxlcyk7CisgICAgICAgIGlmIChwSW5zdGFuY2UtPlBhcmFtcy5Tb3VyY2VGb3JtYXQgPT0gTFZDU19TVEVSRU8pIHsKKyAgICAgICAgICAgIHBJbnN0YW5jZS0+cFNFU2lkZUJpcXVhZC0+cHJvY2VzcyhwU2NyYXRjaCArIE51bVNhbXBsZXMsIHBTY3JhdGNoICsgTnVtU2FtcGxlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOdW1TYW1wbGVzKTsKICAgICAgICAgfQogCi0gICAgICAgIC8qCi0gICAgICAgICAqIENvbnZlcnQgZnJvbSBtaWRkbGUgYW5kIHNpZGUgdG8gc3RlcmVvCi0gICAgICAgICAqLwotICAgICAgICBNU1RvMmlfU2F0X0Zsb2F0KHBTY3JhdGNoLAotICAgICAgICAgICAgICAgICAgICAgICAgIHBTY3JhdGNoICsgTnVtU2FtcGxlcywKLSAgICAgICAgICAgICAgICAgICAgICAgICBwT3V0RGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICBpZiAoTnVtQ2hhbm5lbHMgPT0gMSkgeworICAgICAgICAgICAgLy8gQ29weSBwcm9jZXNzZWQgTWlkZGxlIGRhdGEgZnJvbSBzY3JhdGNoIHRvIHBPdXREYXRhCisgICAgICAgICAgICBDb3B5X0Zsb2F0KChMVk1fRkxPQVQqKXBTY3JhdGNoLCAoTFZNX0ZMT0FUKilwT3V0RGF0YSwgKExWTV9JTlQxNilOdW1TYW1wbGVzKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgKiBDb252ZXJ0IGZyb20gbWlkZGxlIGFuZCBzaWRlIHRvIHN0ZXJlbworICAgICAgICAgICAgICovCisgICAgICAgICAgICBNU1RvMmlfU2F0X0Zsb2F0KHBTY3JhdGNoLCBwU2NyYXRjaCArIE51bVNhbXBsZXMsIHBPdXREYXRhLCAoTFZNX0lOVDE2KU51bVNhbXBsZXMpOworICAgICAgICB9CiAKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKKyAgICB9IGVsc2UgewogICAgICAgICAvKgogICAgICAgICAgKiBUaGUgc3RlcmVvIGVuaGFuY2VyIGlzIGRpc2FibGVkIHNvIGp1c3QgY29weSB0aGUgZGF0YQogICAgICAgICAgKi8KLSAgICAgICAgQ29weV9GbG9hdCgoTFZNX0ZMT0FUICopcEluRGF0YSwgICAgICAgICAgIC8qIFNvdXJjZSAqLwotICAgICAgICAgICAgICAgICAgIChMVk1fRkxPQVQgKilwT3V0RGF0YSwgICAgICAgICAgLyogRGVzdGluYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDE2KSgyICogTnVtU2FtcGxlcykpOyAgICAgLyogTGVmdCBhbmQgcmlnaHQgKi8KKyAgICAgICAgQ29weV9GbG9hdCgoTFZNX0ZMT0FUKilwSW5EYXRhLCAgICAgICAgLyogU291cmNlICovCisgICAgICAgICAgICAgICAgICAgKExWTV9GTE9BVCopcE91dERhdGEsICAgICAgIC8qIERlc3RpbmF0aW9uICovCisgICAgICAgICAgICAgICAgICAgKExWTV9JTlQxNilkZXN0TnVtU2FtcGxlcyk7IC8qIE51bWJlciBvZiBmcmFtZXMgKi8KICAgICB9CiAKLSAgICByZXR1cm4oTFZDU19TVUNDRVNTKTsKKyAgICByZXR1cm4gKExWQ1NfU1VDQ0VTUyk7CiB9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfU3RlcmVvRW5oYW5jZXIuaCBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19TdGVyZW9FbmhhbmNlci5oCmluZGV4IDEyYTU5ODIuLjBiZWQ1OTEgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19TdGVyZW9FbmhhbmNlci5oCisrKyBiL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19TdGVyZW9FbmhhbmNlci5oCkBAIC0yNCw4ICsyNCw4IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotI2luY2x1ZGUgIkZpbHRlcnMuaCIgICAgICAgICAgICAgICAgICAgICAgICAvKiBGaWx0ZXIgZGVmaW5pdGlvbnMgKi8KLSNpbmNsdWRlICJMVkNTX0hlYWRwaG9uZV9Db2VmZnMuaCIgICAgICAgICAgLyogSGVhZHBob25lIGNvZWZmaWNpZW50cyAqLworI2luY2x1ZGUgIkZpbHRlcnMuaCIgICAgICAgICAgICAgICAvKiBGaWx0ZXIgZGVmaW5pdGlvbnMgKi8KKyNpbmNsdWRlICJMVkNTX0hlYWRwaG9uZV9Db2VmZnMuaCIgLyogSGVhZHBob25lIGNvZWZmaWNpZW50cyAqLwogI2luY2x1ZGUgIkJJUVVBRC5oIgogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtMzUsMjEgKzM1LDggQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKIC8qIFN0ZXJlbyBlbmhhbmNlciBzdHJ1Y3R1cmUgKi8KLXR5cGVkZWYgc3RydWN0Ci17Ci0KLSAgICAvKgotICAgICAqIE1pZGRsZSBmaWx0ZXIKLSAgICAgKi8KLSAgICB2b2lkICAgICAgICAgICAgICAgICAgICAoKnBCaXF1YWRDYWxsQmFja19NaWQpKEJpcXVhZF9GTE9BVF9JbnN0YW5jZV90KiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9GTE9BVCosIExWTV9GTE9BVCosIExWTV9JTlQxNik7Ci0KLSAgICAvKgotICAgICAqIFNpZGUgZmlsdGVyCi0gICAgICovCi0gICAgdm9pZCAgICAgICAgICAgICAgICAgICAgKCpwQmlxdWFkQ2FsbEJhY2tfU2lkZSkoQmlxdWFkX0ZMT0FUX0luc3RhbmNlX3QqLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZNX0ZMT0FUKiwgTFZNX0ZMT0FUKiwgTFZNX0lOVDE2KTsKLSAgICBMVk1fRkxPQVQgICAgICAgICAgICAgIE1pZEdhaW47ICAgICAgICAgICAgLyogTWlkZGxlIGdhaW4gaW4gbW9iaWxlIHNwZWFrZXIgbW9kZSAqLwordHlwZWRlZiBzdHJ1Y3QgeworICAgIExWTV9GTE9BVCBNaWRHYWluOyAvKiBNaWRkbGUgZ2FpbiBpbiBtb2JpbGUgc3BlYWtlciBtb2RlICovCiB9IExWQ1NfU3RlcmVvRW5oYW5jZXJfdDsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KQEAgLTU4LDEyICs0NSw5IEBACiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIAotTFZDU19SZXR1cm5TdGF0dXNfZW4gTFZDU19TRW5oYW5jZXJJbml0KExWQ1NfSGFuZGxlX3QgICAgICAgIGhJbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX1BhcmFtc190ICAgICAgICAqcFBhcmFtcyk7CitMVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX1NFbmhhbmNlckluaXQoTFZDU19IYW5kbGVfdCBoSW5zdGFuY2UsIExWQ1NfUGFyYW1zX3QqIHBQYXJhbXMpOwogCi1MVkNTX1JldHVyblN0YXR1c19lbiBMVkNTX1N0ZXJlb0Vu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UgIkxWQ1NfUHJpdmF0ZS5oIgogI2luY2x1ZGUgIkxWQ1NfVGFibGVzLmgiCi0jaW5jbHVkZSAiRmlsdGVycy5oIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBGaWx0ZXIgZGVmaW5pdGlvbnMgKi8KLSNpbmNsdWRlICJCSVFVQUQuaCIgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEJpcXVhZCBkZWZpbml0aW9ucyAqLwotI2luY2x1ZGUgIkxWQ1NfSGVhZHBob25lX0NvZWZmcy5oIiAgICAgICAgICAgICAgLyogSGVhZHBob25lIGNvZWZmaWNpZW50cyAqLworI2luY2x1ZGUgIkZpbHRlcnMuaCIgICAgICAgICAgICAgICAvKiBGaWx0ZXIgZGVmaW5pdGlvbnMgKi8KKyNpbmNsdWRlICJCSVFVQUQuaCIgICAgICAgICAgICAgICAgLyogQmlxdWFkIGRlZmluaXRpb25zICovCisjaW5jbHVkZSAiTFZDU19IZWFkcGhvbmVfQ29lZmZzLmgiIC8qIEhlYWRwaG9uZSBjb2VmZmljaWVudHMgKi8KIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC0zNSwxNDQgKzM1LDc1IEBACiAKIC8qIENvZWZmaWNpZW50IHRhYmxlIGZvciB0aGUgbWlkZGxlIGZpbHRlciAqLwogY29uc3QgQmlxdWFkQTAxQjFDb2Vmc1NQX3QgTFZDU19TRU1pZENvZWZUYWJsZVtdID0gewotICAgIHtDU19NSURETEVfODAwMF9BMCwgICAgICAgICAvKiA4a1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfTUlERExFXzgwMDBfQTEsCi0gICAgIENTX01JRERMRV84MDAwX0IxLAotICAgICAoTFZNX1VJTlQxNiApQ1NfTUlERExFXzgwMDBfU0NBTEV9LAotICAgIHtDU19NSURETEVfMTEwMjVfQTAsICAgICAgICAvKiAxMWtTL3MgY29lZmZpY2llbnRzICovCi0gICAgIENTX01JRERMRV8xMTAyNV9BMSwKLSAgICAgQ1NfTUlERExFXzExMDI1X0IxLAotICAgICAoTFZNX1VJTlQxNiApQ1NfTUlERExFXzExMDI1X1NDQUxFfSwKLSAgICB7Q1NfTUlERExFXzEyMDAwX0EwLCAgICAgICAgLyogMTJrUy9zIGNvZWZmaWNpZW50cyAqLwotICAgICBDU19NSURETEVfMTIwMDBfQTEsCi0gICAgIENTX01JRERMRV8xMjAwMF9CMSwKLSAgICAgKExWTV9VSU5UMTYgKUNTX01JRERMRV8xMjAwMF9TQ0FMRX0sCi0gICAge0NTX01JRERMRV8xNjAwMF9BMCwgICAgICAgIC8qIDE2a1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfTUlERExFXzE2MDAwX0ExLAotICAgICBDU19NSURETEVfMTYwMDBfQjEsCi0gICAgIChMVk1fVUlOVDE2IClDU19NSURETEVfMTYwMDBfU0NBTEV9LAotICAgIHtDU19NSURETEVfMjIwNTBfQTAsICAgICAgICAvKiAyMmtTL3MgY29lZmZpY2llbnRzICovCi0gICAgIENTX01JRERMRV8yMjA1MF9BMSwKLSAgICAgQ1NfTUlERExFXzIyMDUwX0IxLAotICAgICAoTFZNX1VJTlQxNiApQ1NfTUlERExFXzIyMDUwX1NDQUxFfSwKLSAgICB7Q1NfTUlERExFXzI0MDAwX0EwLCAgICAgICAgLyogMjRrUy9zIGNvZWZmaWNpZW50cyAqLwotICAgICBDU19NSURETEVfMjQwMDBfQTEsCi0gICAgIENTX01JRERMRV8yNDAwMF9CMSwKLSAgICAgKExWTV9VSU5UMTYgKUNTX01JRERMRV8yNDAwMF9TQ0FMRX0sCi0gICAge0NTX01JRERMRV8zMjAwMF9BMCwgICAgICAgIC8qIDMya1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfTUlERExFXzMyMDAwX0ExLAotICAgICBDU19NSURETEVfMzIwMDBfQjEsCi0gICAgIChMVk1fVUlOVDE2IClDU19NSURETEVfMzIwMDBfU0NBTEV9LAotICAgIHtDU19NSURETEVfNDQxMDBfQTAsICAgICAgICAvKiA0NGtTL3MgY29lZmZpY2llbnRzICovCi0gICAgIENTX01JRERMRV80NDEwMF9BMSwKLSAgICAgQ1NfTUlERExFXzQ0MTAwX0IxLAotICAgICAoTFZNX1VJTlQxNiApQ1NfTUlERExFXzQ0MTAwX1NDQUxFfSwKLSAgICB7Q1NfTUlERExFXzQ4MDAwX0EwLCAgICAgICAgLyogNDhrUy9zIGNvZWZmaWNpZW50cyAqLwotICAgICBDU19NSURETEVfNDgwMDBfQTEsCi0gICAgIENTX01JRERMRV80ODAwMF9CMSwKLSAgICAgKExWTV9VSU5UMTYgKUNTX01JRERMRV80ODAwMF9TQ0FMRX0KLSAgICAsCi0gICAge0NTX01JRERMRV84ODIwMF9BMCwgICAgICAgIC8qIDg4a1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfTUlERExFXzg4MjAwX0ExLAotICAgICBDU19NSURETEVfODgyMDBfQjEsCi0gICAgIChMVk1fVUlOVDE2KUNTX01JRERMRV84ODIwMF9TQ0FMRX0sCi0gICAge0NTX01JRERMRV85NjAwMF9BMCwgICAgICAgIC8qIDk2a1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfTUlERExFXzk2MDAwX0ExLAotICAgICBDU19NSURETEVfOTYwMDBfQjEsCi0gICAgIChMVk1fVUlOVDE2IClDU19NSURETEVfOTYwMDBfU0NBTEV9LAotICAgIHtDU19NSURETEVfMTc2NDAwX0EwLCAgICAgICAgLyogMTc2a1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfTUlERExFXzE3NjQwMF9BMSwKLSAgICAgQ1NfTUlERExFXzE3NjQwMF9CMSwKLSAgICAgKExWTV9VSU5UMTYpQ1NfTUlERExFXzE3NjQwMF9TQ0FMRX0sCi0gICAge0NTX01JRERMRV8xOTIwMDBfQTAsICAgICAgICAvKiAxOTJrUy9zIGNvZWZmaWNpZW50cyAqLwotICAgICBDU19NSURETEVfMTkyMDAwX0ExLAotICAgICBDU19NSURETEVfMTkyMDAwX0IxLAotICAgICAoTFZNX1VJTlQxNiApQ1NfTUlERExFXzE5MjAwMF9TQ0FMRX0KLSAgICB9OworICAgICAgICB7Q1NfTUlERExFXzgwMDBfQTAsIC8qIDhrUy9zIGNvZWZmaWNpZW50cyAqLworICAgICAgICAgQ1NfTUlERExFXzgwMDBfQTEsIENTX01JRERMRV84MDAwX0IxLCAoTFZNX1VJTlQxNilDU19NSURETEVfODAwMF9TQ0FMRX0sCisgICAgICAgIHtDU19NSURETEVfMTEwMjVfQTAsIC8qIDExa1MvcyBjb2VmZmljaWVudHMgKi8KKyAgICAgICAgIENTX01JRERMRV8xMTAyNV9BMSwgQ1NfTUlERExFXzExMDI1X0IxLCAoTFZNX1VJTlQxNilDU19NSURETEVfMTEwMjVfU0NBTEV9LAorICAgICAgICB7Q1NfTUlERExFXzEyMDAwX0EwLCAvKiAxMmtTL3MgY29lZmZpY2llbnRzICovCisgICAgICAgICBDU19NSURETEVfMTIwMDBfQTEsIENTX01JRERMRV8xMjAwMF9CMSwgKExWTV9VSU5UMTYpQ1NfTUlERExFXzEyMDAwX1NDQUxFfSwKKyAgICAgICAge0NTX01JRERMRV8xNjAwMF9BMCwgLyogMTZrUy9zIGNvZWZmaWNpZW50cyAqLworICAgICAgICAgQ1NfTUlERExFXzE2MDAwX0ExLCBDU19NSURETEVfMTYwMDBfQjEsIChMVk1fVUlOVDE2KUNTX01JRERMRV8xNjAwMF9TQ0FMRX0sCisgICAgICAgIHtDU19NSURETEVfMjIwNTBfQTAsIC8qIDIya1MvcyBjb2VmZmljaWVudHMgKi8KKyAgICAgICAgIENTX01JRERMRV8yMjA1MF9BMSwgQ1NfTUlERExFXzIyMDUwX0IxLCAoTFZNX1VJTlQxNilDU19NSURETEVfMjIwNTBfU0NBTEV9LAorICAgICAgICB7Q1NfTUlERExFXzI0MDAwX0EwLCAvKiAyNGtTL3MgY29lZmZpY2llbnRzICovCisgICAgICAgICBDU19NSURETEVfMjQwMDBfQTEsIENTX01JRERMRV8yNDAwMF9CMSwgKExWTV9VSU5UMTYpQ1NfTUlERExFXzI0MDAwX1NDQUxFfSwKKyAgICAgICAge0NTX01JRERMRV8zMjAwMF9BMCwgLyogMzJrUy9zIGNvZWZmaWNpZW50cyAqLworICAgICAgICAgQ1NfTUlERExFXzMyMDAwX0ExLCBDU19NSURETEVfMzIwMDBfQjEsIChMVk1fVUlOVDE2KUNTX01JRERMRV8zMjAwMF9TQ0FMRX0sCisgICAgICAgIHtDU19NSURETEVfNDQxMDBfQTAsIC8qIDQ0a1MvcyBjb2VmZmljaWVudHMgKi8KKyAgICAgICAgIENTX01JRERMRV80NDEwMF9BMSwgQ1NfTUlERExFXzQ0MTAwX0IxLCAoTFZNX1VJTlQxNilDU19NSURETEVfNDQxMDBfU0NBTEV9LAorICAgICAgICB7Q1NfTUlERExFXzQ4MDAwX0EwLCAvKiA0OGtTL3MgY29lZmZpY2llbnRzICovCisgICAgICAgICBDU19NSURETEVfNDgwMDBfQTEsIENTX01JRERMRV80ODAwMF9CMSwgKExWTV9VSU5UMTYpQ1NfTUlERExFXzQ4MDAwX1NDQUxFfSwKKyAgICAgICAge0NTX01JRERMRV84ODIwMF9BMCwgLyogODhrUy9zIGNvZWZmaWNpZW50cyAqLworICAgICAgICAgQ1NfTUlERExFXzg4MjAwX0ExLCBDU19NSURETEVfODgyMDBfQjEsIChMVk1fVUlOVDE2KUNTX01JRERMRV84ODIwMF9TQ0FMRX0sCisgICAgICAgIHtDU19NSURETEVfOTYwMDBfQTAsIC8qIDk2a1MvcyBjb2VmZmljaWVudHMgKi8KKyAgICAgICAgIENTX01JRERMRV85NjAwMF9BMSwgQ1NfTUlERExFXzk2MDAwX0IxLCAoTFZNX1VJTlQxNilDU19NSURETEVfOTYwMDBfU0NBTEV9LAorICAgICAgICB7Q1NfTUlERExFXzE3NjQwMF9BMCwgLyogMTc2a1MvcyBjb2VmZmljaWVudHMgKi8KKyAgICAgICAgIENTX01JRERMRV8xNzY0MDBfQTEsIENTX01JRERMRV8xNzY0MDBfQjEsIChMVk1fVUlOVDE2KUNTX01JRERMRV8xNzY0MDBfU0NBTEV9LAorICAgICAgICB7Q1NfTUlERExFXzE5MjAwMF9BMCwgLyogMTkya1MvcyBjb2VmZmljaWVudHMgKi8KKyAgICAgICAgIENTX01JRERMRV8xOTIwMDBfQTEsIENTX01JRERMRV8xOTIwMDBfQjEsIChMVk1fVUlOVDE2KUNTX01JRERMRV8xOTIwMDBfU0NBTEV9fTsKIAogLyogQ29lZmZpY2llbnQgdGFibGUgZm9yIHRoZSBzaWRlIGZpbHRlciAqLwogY29uc3QgQmlxdWFkQTAxMkIxMkNvZWZzU1BfdCBMVkNTX1NFU2lkZUNvZWZUYWJsZVtdID0gewotICAgIC8qIEhlYWRwaG9uZSBTaWRlIGNvZWZmaWNpZW50cyAqLwotICAgIHtDU19TSURFXzgwMDBfQTAsICAgICAgICAgICAvKiA4a1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfU0lERV84MDAwX0ExLAotICAgICBDU19TSURFXzgwMDBfQTIsCi0gICAgIENTX1NJREVfODAwMF9CMSwKLSAgICAgQ1NfU0lERV84MDAwX0IyLAotICAgICAoTFZNX1VJTlQxNiApQ1NfU0lERV84MDAwX1NDQUxFfSwKLSAgICB7Q1NfU0lERV8xMTAyNV9BMCwgICAgICAgICAgLyogMTFrUy9zIGNvZWZmaWNpZW50cyAqLwotICAgICBDU19TSURFXzExMDI1X0ExLAotICAgICBDU19TSURFXzExMDI1X0EyLAotICAgICBDU19TSURFXzExMDI1X0IxLAotICAgICBDU19TSURFXzExMDI1X0IyLAotICAgICAoTFZNX1VJTlQxNiApQ1NfU0lERV8xMTAyNV9TQ0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llbnRzICovCi0gICAgIENTX1NJREVfMzIwMDBfQTEsCi0gICAgIENTX1NJREVfMzIwMDBfQTIsCi0gICAgIENTX1NJREVfMzIwMDBfQjEsCi0gICAgIENTX1NJREVfMzIwMDBfQjIsCi0gICAgIChMVk1fVUlOVDE2IClDU19TSURFXzMyMDAwX1NDQUxFfSwKLSAgICB7Q1NfU0lERV80NDEwMF9BMCwgICAgICAgICAgLyogNDRrUy9zIGNvZWZmaWNpZW50cyAqLwotICAgICBDU19TSURFXzQ0MTAwX0ExLAotICAgICBDU19TSURFXzQ0MTAwX0EyLAotICAgICBDU19TSURFXzQ0MTAwX0IxLAotICAgICBDU19TSURFXzQ0MTAwX0IyLAotICAgICAoTFZNX1VJTlQxNiApQ1NfU0lERV80NDEwMF9TQ0FMRX0sCi0gICAge0NTX1NJREVfNDgwMDBfQTAsICAgICAgICAgIC8qIDQ4a1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfU0lERV80ODAwMF9BMSwKLSAgICAgQ1NfU0lERV80ODAwMF9BMiwKLSAgICAgQ1NfU0lERV80ODAwMF9CMSwKLSAgICAgQ1NfU0lERV80ODAwMF9CMiwKLSAgICAgKExWTV9VSU5UMTYgKUNTX1NJREVfNDgwMDBfU0NBTEV9Ci0gICAgICwKLSAgICB7Q1NfU0lERV84ODIwMF9BMCwgICAgICAgICAgLyogODhrUy9zIGNvZWZmaWNpZW50cyAqLwotICAgICBDU19TSURFXzg4MjAwX0ExLAotICAgICBDU19TSURFXzg4MjAwX0EyLAotICAgICBDU19TSURFXzg4MjAwX0IxLAotICAgICBDU19TSURFXzg4MjAwX0IyLAotICAgICAoTFZNX1VJTlQxNilDU19TSURFXzg4MjAwX1NDQUxFfSwKLSAgICAge0NTX1NJREVfOTYwMDBfQTAsICAgICAgICAgIC8qIDk2a1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfU0lERV85NjAwMF9BMSwKLSAgICAgQ1NfU0lERV85NjAwMF9BMiwKLSAgICAgQ1NfU0lERV85NjAwMF9CMSwKLSAgICAgQ1NfU0lERV85NjAwMF9CMiwKLSAgICAgKExWTV9VSU5UMTYgKUNTX1NJREVfOTYwMDBfU0NBTEV9LAotICAgIHtDU19TSURFXzE3NjQwMF9BMCwgICAgICAgICAgLyoxNzZrUy9zIGNvZWZmaWNpZW50cyAqLwotICAgICBDU19TSURFXzE3NjQwMF9BMSwKLSAgICAgQ1NfU0lERV8xNzY0MDBfQTIsCi0gICAgIENTX1NJREVfMTc2NDAwX0IxLAotICAgICBDU19TSURFXzE3NjQwMF9CMiwKLSAgICAgKExWTV9VSU5UMTYpQ1NfU0lERV8xNzY0MDBfU0NBTEV9LAotICAgICB7Q1NfU0lERV8xOTIwMDBfQTAsICAgICAgICAgIC8qIDE5MmtTL3MgY29lZmZpY2llbnRzICovCi0gICAgIENTX1NJREVfMTkyMDAwX0ExLAotICAgICBDU19TSURFXzE5MjAwMF9BMiwKLSAgICAgQ1NfU0lERV8xOTIwMDBfQjEsCi0gICAgIENTX1NJREVfMTkyMDAwX0IyLAotICAgICAoTFZNX1VJTlQxNiApQ1NfU0lERV8xOTIwMDBfU0NBTEV9Ci19OworICAgICAgICAvKiBIZWFkcGhvbmUgU2lkZSBjb2VmZmljaWVudHMgKi8KKyAgICAgICAge0NTX1NJREVfODAwMF9BMCwgLyogOGtTL3MgY29lZmZpY2llbnRzICovCisgICAgICAgICBDU19TSURFXzgwMDBfQTEsIENTX1NJREVfODAwMF9BMiwgQ1NfU0lERV84MDAwX0IxLCBDU19TSURFXzgwMDBfQjIsCisgICAgICAgICAoTFZNX1VJTlQxNilDU19TSURFXzgwMDBfU0NBTEV9LAorICAgICAgICB7Q1NfU0lERV8xMTAyNV9BMCwgLyogMTFrUy9zIGNvZWZmaWNpZW50cyAqLworICAgICAgICAgQ1NfU0lERV8xMTAyNV9BMSwgQ1NfU0lERV8xMTAyNV9BMiwgQ1NfU0lERV8xMTAyNV9CMSwgQ1NfU0lERV8xMTAyNV9CMiwKKy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BTEV9LAorICAgICAgICB7Q1NfU0lERV8xNzY0MDBfQTAsIC8qMTc2a1MvcyBjb2VmZmljaWVudHMgKi8KKyAgICAgICAgIENTX1NJREVfMTc2NDAwX0ExLCBDU19TSURFXzE3NjQwMF9BMiwgQ1NfU0lERV8xNzY0MDBfQjEsIENTX1NJREVfMTc2NDAwX0IyLAorICAgICAgICAgKExWTV9VSU5UMTYpQ1NfU0lERV8xNzY0MDBfU0NBTEV9LAorICAgICAgICB7Q1NfU0lERV8xOTIwMDBfQTAsIC8qIDE5MmtTL3MgY29lZmZpY2llbnRzICovCisgICAgICAgICBDU19TSURFXzE5MjAwMF9BMSwgQ1NfU0lERV8xOTIwMDBfQTIsIENTX1NJREVfMTkyMDAwX0IxLCBDU19TSURFXzE5MjAwMF9CMiwKKyAgICAgICAgIChMVk1fVUlOVDE2KUNTX1NJREVfMTkyMDAwX1NDQUxFfX07CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMTgxLDE2NyArMTEyLDg3IEBACiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCiBjb25zdCBCaXF1YWRBMDEyQjEyQ29lZnNTUF90IExWQ1NfRXF1YWxpc2VyQ29lZlRhYmxlW10gPSB7Ci0gICAgLyogSGVhZHBob25lIGNvZWZmaWNpZW50cyAqLwotICAgIHtDU19FUVVBTElTRVJfODAwMF9BMCwgICAgICAvKiA4a1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfRVFVQUxJU0VSXzgwMDBfQTEsCi0gICAgIENTX0VRVUFMSVNFUl84MDAwX0EyLA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jAwMF9CMSwKKyAgICAgICAgIENTRVhfRVFVQUxJU0VSXzE5MjAwMF9CMiwgKExWTV9VSU5UMTYpQ1NFWF9FUVVBTElTRVJfMTkyMDAwX1NDQUxFfX07CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMzUwLDIwICsyMDEsMTIgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKIC8qIFN0ZXJlbyBkZWxheSB0YWJsZSBmb3IgQ29uY2VydCBTb3VuZCAqLwotY29uc3QgTFZNX1VJTlQxNiAgICBMVkNTX1N0ZXJlb0RlbGF5Q1NbXSA9IHsKLSAgICBMVkNTX1NURVJFT0RFTEFZX0NTXzhLSFosCi0gICAgTFZDU19TVEVSRU9ERUxBWV9DU18xMUtIWiwKLSAgICBMVkNTX1NURVJFT0RFTEFZX0NTXzEyS0haLAotICAgIExWQ1NfU1RFUkVPREVMQVlfQ1NfMTZLSFosCi0gICAgTFZDU19TVEVSRU9ERUxBWV9DU18yMktIWiwKLSAgICBMVkNTX1NURVJFT0RFTEFZX0NTXzI0S0haLAotICAgIExWQ1NfU1RFUkVPREVMQVlfQ1NfMzJLSFosCi0gICAgTFZDU19TVEVSRU9ERUxBWV9DU180NEtIWiwKLSAgICBMVkNTX1NURVJFT0RFTEFZX0NTXzQ4S0haLAotICAgIExWQ1NfU1RFUkVPREVMQVlfQ1NfODhLSFosCi0gICAgTFZDU19TVEVSRU9ERUxBWV9DU185NktIWiwKLSAgICBMVkNTX1NURVJFT0RFTEFZX0NTXzE3NktIWiwKLSAgICBMVkNTX1NURVJFT0RFTEFZX0NTXzE5MktIWiwKK2NvbnN0IExWTV9VSU5UMTYgTFZDU19TdGVyZW9EZWxheUNTW10gPSB7CisgICAgICAgIExWQ1NfU1RFUkVPREVMQVlfQ1NfOEtIWiwgICBMVkNTX1NURVJFT0RFTEFZX0NTXzExS0haLCBMVkNTX1NURVJFT0RFTEFZX0NTXzEyS0haLAorICAgICAgICBMVkNTX1NURVJFT0RFTEFZX0NTXzE2S0haLCAgTFZDU19TVEVSRU9ERUxBWV9DU18yMktIWiwgTFZDU19TVEVSRU9ERUxBWV9DU18yNEtIWiwKKyAgICAgICAgTFZDU19TVEVSRU9ERUxBWV9DU18zMktIWiwgIExWQ1NfU1RFUkVPREVMQVlfQ1NfNDRLSFosIExWQ1NfU1RFUkVPREVMQVlfQ1NfNDhLSFosCisgICAgICAgIExWQ1NfU1RFUkVPREVMQVlfQ1NfODhLSFosICBMVkNTX1NURVJFT0RFTEFZX0NTXzk2S0haLCBMVkNTX1NURVJFT0RFTEFZX0NTXzE3NktIWiwKKyAgICAgICAgTFZDU19TVEVSRU9ERUxBWV9DU18xOTJLSFosCiB9OwogCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwpAQCAtMzczLDg3ICsyMTYsNDYgQEAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKIGNvbnN0IEJpcXVhZEEwMTJCMTJDb2Vmc1NQX3QgTFZDU19SZXZlcmJDb2VmVGFibGVbXSA9IHsKLSAgICAvKiBIZWFkcGhvbmUgY29lZmZpY2llbnRzICovCi0gICAge0NTX1JFVkVSQl84MDAwX0EwLCAgICAgICAgICAgICAvKiA4a1MvcyBjb2VmZmljaWVudHMgKi8KLSAgICAgQ1NfUkVWRVJCXzgwMDBfQTEsCi0gICAgIENTX1JFVkVS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LAorICAgICAgICAgKExWTV9VSU5UMTYpQ1NfUkVWRVJCXzE3NjQwMF9TQ0FMRX0sCisgICAgICAgIHtDU19SRVZFUkJfMTkyMDAwX0EwLCAvKiAxOTJrUy9zIGNvZWZmaWNpZW50cyAqLworICAgICAgICAgQ1NfUkVWRVJCXzE5MjAwMF9BMSwgQ1NfUkVWRVJCXzE5MjAwMF9BMiwgQ1NfUkVWRVJCXzE5MjAwMF9CMSwgQ1NfUkVWRVJCXzE5MjAwMF9CMiwKKyAgICAgICAgIChMVk1fVUlOVDE2KUNTX1JFVkVSQl8xOTIwMDBfU0NBTEV9fTsKIAogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCkBAIC00NjEsMjAgKzI2MywxNCBAQAogLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAKLWNvbnN0IEdhaW5fdCBMVkNTX091dHB1dEdhaW5UYWJsZVtdID0gewotICAgIHtMVkNTX0hFQURQSE9ORV9TSElGVCwgICAgICAgICAvKiBIZWFkcGhvbmUsIHN0ZXJlbyBtb2RlICovCi0gICAgIExWQ1NfSEVBRFBIT05FX1NISUZUTE9TUywKLSAgICAgTFZDU19IRUFEUEhPTkVfR0FJTn0sCi0gICAge0xWQ1NfRVhfSEVBRFBIT05FX1NISUZULCAgICAgIC8qIEVYIEhlYWRwaG9uZSwgc3RlcmVvIG1vZGUgKi8KLSAgICAgTFZDU19FWF9IRUFEUEhPTkVfU0hJRlRMT1NTLAotICAgICBMVkNTX0VYX0hFQURQSE9ORV9HQUlOfSwKLSAgICB7TFZDU19IRUFEUEhPTkVfU0hJRlQsICAgICAgICAgLyogSGVhZHBob25lLCBtb25vIG1vZGUgKi8KLSAgICAgTFZDU19IRUFEUEhPTkVfU0hJRlRMT1NTLAotICAgICBMVkNTX0hFQURQSE9ORV9HQUlOfSwKLSAgICB7TFZDU19FWF9IRUFEUEhPTkVfU0hJRlQsICAgICAgLyogRVggSGVhZHBob25lLCBtb25vIG1vZGUgKi8KLSAgICAgTFZDU19FWF9IRUFEUEhPTkVfU0hJRlRMT1NTLAotICAgICBMVkNTX0VYX0hFQURQSE9ORV9HQUlOfQotfTsKK2NvbnN0IEdhaW5fdCBMVkNTX091dHB1dEdhaW5UYWJsZVtdID0ge3tMVkNTX0hFQURQSE9ORV9TSElGVCwgLyogSGVhZHBob25lLCBzdGVyZW8gbW9kZSAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfSEVBRFBIT05FX1NISUZUTE9TUywgTFZDU19IRUFEUEhPTkVfR0FJTn0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7TFZDU19FWF9IRUFEUEhPTkVfU0hJRlQsIC8qIEVYIEhlYWRwaG9uZSwgc3RlcmVvIG1vZGUgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX0VYX0hFQURQSE9ORV9TSElGVExPU1MsIExWQ1NfRVhfSEVBRFBIT05FX0dBSU59LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge0xWQ1NfSEVBRFBIT05FX1NISUZULCAvKiBIZWFkcGhvbmUsIG1vbm8gbW9kZSAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfSEVBRFBIT05FX1NISUZUTE9TUywgTFZDU19IRUFEUEhPTkVfR0FJTn0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7TFZDU19FWF9IRUFEUEhPTkVfU0hJRlQsIC8qIEVYIEhlYWRwaG9uZSwgbW9ubyBtb2RlICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZDU19FWF9IRUFEUEhPTkVfU0hJRlRMT1NTLCBMVkNTX0VYX0hFQURQSE9ORV9HQUlOfX07CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNTAxLDI0ICsyOTcsMTQgQEAKIC8qICAgICAgICAgIDEwMjQgICAgaXMgLTEyZEIgZ2FpbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLWNvbnN0IExWQ1NfVm9sQ29ycmVjdF90IExWQ1NfVm9sQ29ycmVjdFRhYmxlW10gPSB7Ci0gICAgezAuNDMzMzYyZiwgICAgICAgICAgLyogSGVhZHBob25lLCBzdGVyZW8gbW9kZSAqLwotICAgICAwLjAwMDAwMGYsCi0gICAgIDEuMDAwMDI0ZiwKLSAgICAgMS40MTI2NDBmfSwKLSAgICB7MC40MzMzNjJmLCAgICAgICAgICAvKiBFWCBIZWFkcGhvbmUsIHN0ZXJlbyBtb2RlICovCi0gICAgIDAuMDAwMDAwZiwKLSAgICAgMS4wMDAwMjRmLAotICAgICAxLjQxMjY0MGZ9LAotICAgIHsxLjAwMDAwMGYsICAgICAgICAgLyogSGVhZHBob25lLCBtb25vIG1vZGUgKi8KLSAgICAgMC4wMDAwMDBmLAotICAgICAxLjAwMDAyNGYsCi0gICAgIDEuNDEyNjQwZn0sCi0gICAgezEuMDAwMDAwZiwgICAgICAgICAvKiBFWCBIZWFkcGhvbmUsIG1vbm8gbW9kZSAqLwotICAgICAwLjAwMDAwMGYsCi0gICAgIDEuMDAwMDI0ZiwKLSAgICAgMS40MTI2NDBmfQotfTsKK2NvbnN0IExWQ1NfVm9sQ29ycmVjdF90IExWQ1NfVm9sQ29ycmVjdFRhYmxlW10gPSB7ezAuNDMzMzYyZiwgLyogSGVhZHBob25lLCBzdGVyZW8gbW9kZSAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDBmLCAxLjAwMDAyNGYsIDEuNDEyNjQwZn0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHswLjQzMzM2MmYsIC8qIEVYIEhlYWRwaG9uZSwgc3RlcmVvIG1vZGUgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAwMDAwZiwgMS4wMDAwMjRmLCAxLjQxMjY0MGZ9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7MS4wMDAwMDBmLCAvKiBIZWFkcGhvbmUsIG1vbm8gbW9kZSAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAwMDBmLCAxLjAwMDAyNGYsIDEuNDEyNjQwZn0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsxLjAwMDAwMGYsIC8qIEVYIEhlYWRwaG9uZSwgbW9ubyBtb2RlICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDAwMGYsIDEuMDAwMDI0ZiwgMS40MTI2NDBmfX07CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtNTI2LDUxICszMTIsMzIgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0jZGVmaW5lIExWQ1NfVk9MX1RDX0ZzODAwMCAgICAgIDMyNTgwICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuOTk0MjYyNjk1ICovCi0jZGVmaW5lIExWQ1NfVk9MX1RDX0ZzMTEwMjUgICAgIDMyNjMyICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuOTk1ODQ5NjA5ICovCi0jZGVmaW5lIExWQ1NfVk9MX1RDX0ZzMTIwMDAgICAgIDMyNjQzICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuOTk2MTg1MzAzICovCi0jZGVmaW5lIExWQ1NfVk9MX1RDX0ZzMTYwMDAgICAgIDMyNjc0ICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuOTk3MTMxMzQ4ICovCi0jZGVmaW5lIExWQ1NfVk9MX1RDX0ZzMjIwNTAgICAgIDMyNzAwICAgICAgIC8qIEZsb2F0aW5nIHBvaW50IHZhbHVlIDAuOTk3OTI0ODA1ICovCi0jZGVmaW5lIExWQ1NfVk9MX1RDX0Z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WZpbmUgTFZDU19WT0xfVENfRnMxNzY0MDAgMzI3NTkgICAgICAgICAgICAgICAvKiBGbG9hdGluZyBwb2ludCB2YWx1ZSAwLjk5OTc0MDQ5OSAqLworI2RlZmluZSBMVkNTX1ZPTF9UQ19GczE5MjAwMCBcCisgICAgMzI3NjMgLyogRmxvYXRpbmcgcG9pbnQgdmFsdWUgMC45OTk4Nzc5MjUgKi8gLyogVG9kbyBAIG5lZWQgdG8gcmUgY2hlY2sgdGhpcyB2YWx1ZSovCiAKLWNvbnN0IExWTV9JTlQxNiBMVkNTX1ZvbHVtZVRDVGFibGVbMTNdID0ge0xWQ1NfVk9MX1RDX0ZzODAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfVk9MX1RDX0ZzMTEwMjUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX1ZPTF9UQ19GczEyMDAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZDU19WT0xfVENfRnMxNjAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfVk9MX1RDX0ZzMjIwNTAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX1ZPTF9UQ19GczI0MDAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZDU19WT0xfVENfRnMzMjAwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfVk9MX1RDX0ZzNDQxMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX1ZPTF9UQ19GczQ4MDAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFZDU19WT0xfVENfRnM4ODIwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfVk9MX1RDX0ZzOTYwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMVkNTX1ZPTF9UQ19GczE3NjQwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWQ1NfVk9MX1RDX0ZzMTkyMDAwCi19OworY29uc3QgTFZNX0lOVDE2IExWQ1NfVm9sdW1lVENUYWJsZVsxM10gPSB7CisgICAgICAgIExWQ1NfVk9MX1RDX0ZzODAwMCwgIExWQ1NfVk9MX1RDX0ZzMTEwMjUsIExWQ1NfVk9MX1RDX0ZzMTIwMDAsIExWQ1NfVk9MX1RDX0ZzMTYwMDAsCisgICAgICAgIExWQ1NfVk9MX1RDX0ZzMjIwNTAsIExWQ1NfVk9MX1RDX0ZzMjQwMDAsIExWQ1NfVk9MX1RDX0ZzMzIwMDAsIExWQ1NfVk9MX1RDX0ZzNDQxMDAsCisgICAgICAgIExWQ1NfVk9MX1RDX0ZzNDgwMDAsIExWQ1NfVk9MX1RDX0ZzODgyMDAsIExWQ1NfVk9MX1RDX0ZzOTYwMDAsIExWQ1NfVk9MX1RDX0ZzMTc2NDAwLAorICAgICAgICBMVkNTX1ZPTF9UQ19GczE5MjAwMH07CiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwogLyogIFNhbXBsZSByYXRlIHRhYmxlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotY29uc3QgTFZNX0lOVDMyICAgTFZDU19TYW1wbGVSYXRlVGFibGVbMTNdID0gezgwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTEwMjUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTYwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjIwNTAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjQwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzIwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDQxMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDgwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgODgyMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOTYwMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTc2NDAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5MjAwMAotfTsKK2NvbnN0IExWTV9JTlQzMiBMVkNTX1NhbXBsZVJhdGVUYWJsZVsxM10gPSB7ODAwMCwgIDExMDI1LCAxMjAwMCwgMTYwMDAsIDIyMDUwLCAgMjQwMDAsIDMyMDAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDEwMCwgNDgwMDAsIDg4MjAwLCA5NjAwMCwgMTc2NDAwLCAxOTIwMDB9OwpkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX1RhYmxlcy5oIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL1N0ZXJlb1dpZGVuaW5nL3NyYy9MVkNTX1RhYmxlcy5oCmluZGV4IDU0OTA2OTkuLjc2NmY1ZjIgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL2xpYi9TdGVyZW9XaWRlbmluZy9zcmMvTFZDU19UYWJsZXMuaAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS9saWIvU3RlcmVvV2lkZW5pbmcvc3JjL0xWQ1NfVGFibGVzLmgKQEAgLTI0LDcgKzI0LDcgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCiAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi0jaW5jbHVkZSAiQklRVUFELmgiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBCaXF1YWQgZGVmaW5pdGlvbnMgKi8KKyNpbmNsdWRlICJCSVFVQUQuaCIgLyogQmlxdWFkIGRlZmluaXRpb25zICovCiAKIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCiAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwpAQCAtMTA2LDM1ICsxMDYsMzQgQEAKIC8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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RUZXN0SGVscGVyLmNwcCIsCisgICAgXSwKKyAgICBpbmNsdWRlX2RpcnM6IFsKKyAgICAgICAgImZyYW1ld29ya3MvYXYvbWVkaWEvbGliZWZmZWN0cy9sdm0vbGliL0NvbW1vbi9saWIiLAorICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9saWJlZmZlY3RzL2x2bS93cmFwcGVyL1JldmVyYiIsCisgICAgXSwKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGliYXVkaW91dGlscyIsCisgICAgICAgICJsaWJyZXZlcmIiLAorICAgICAgICAibGlicmV2ZXJid3JhcHBlciIsCisgICAgXSwKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGlibG9nIiwKKyAgICBdLAorICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJhdWRpb2VmZmVjdHMiLAorICAgICAgICAibGliaGFyZHdhcmVfaGVhZGVycyIsCisgICAgXSwKK30KKworY2NfdGVzdCB7CisgICAgbmFtZTogIkVmZmVjdEJ1bmRsZVRlc3QiLAorICAgIHZlbmRvcjogdHJ1ZSwKKyAgICBndGVzdDogdHJ1ZSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKyAgICB0ZXN0X3N1aXRlczogWyJkZXZpY2UtdGVzdHMiXSwKKyAgICBzcmNzOiBbCisgICAgICAgICJFZmZlY3RCdW5kbGVUZXN0LmNwcCIsCisgICAgICAgICJFZmZlY3RUZXN0SGVscGVyLmNwcCIsCisgICAgXSwKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGliYXVkaW91dGlscyIsCisgICAgICAgICJsaWJidW5kbGV3cmFwcGVyIiwKKyAgICAgICAgImxpYm11c2ljYnVuZGxlIiwKKyAgICBdLAorICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJsb2ciLAorICAgIF0sCisgICAgaGVhZGVyX2xpYnM6IFsKKyAgICAgICAgImxpYmhhcmR3YXJlX2hlYWRlcnMiLAorICAgIF0sCit9CisKIGNjX3Rlc3QgewogICAgIG5hbWU6ICJsdm10ZXN0IiwKICAgICBob3N0X3N1cHBvcnRlZDogZmFsc2UsCkBAIC00NCw2ICsxMDMsNDAgQEAKIH0KIAogY2NfdGVzdCB7CisgICAgbmFtZTogInJldmVyYl90ZXN0IiwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKyAgICBwcm9wcmlldGFyeTogdHJ1ZSwKKyAgICBndGVzdDogZmFsc2UsCisKKyAgICBpbmNsdWRlX2RpcnM6IFsKKyAgICAgICAgImZyYW1ld29ya3MvYXYvbWVkaWEvbGliZWZmZWN0cy9sdm0vd3JhcHBlci9SZXZlcmIiLAorICAgIF0sCisKKyAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGliYXVkaW9lZmZlY3RzIiwKKyAgICBdLAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmF1ZGlvdXRpbHMiLAorICAgICAgICAibGlibG9nIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYnJldmVyYiIsCisgICAgICAgICJsaWJyZXZlcmJ3cmFwcGVyIiwKKyAgICBdLAorICAgIHNyY3M6IFsKKyAgICAgICAgInJldmVyYl90ZXN0LmNwcCIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLVdhbGwiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgICAgICItV2V4dHJhIiwKKyAgICBdLAorfQorCitjY190ZXN0IHsKICAgICBuYW1lOiAic25yIiwKICAgICBob3N0X3N1cHBvcnRlZDogZmFsc2UsCiAKZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvbHZtL3Rlc3RzL0VmZmVjdEJ1bmRsZVRlc3QuY3BwIGIvbWVkaWEvbGliZWZmZWN0cy9sdm0vdGVzdHMvRWZmZWN0QnVuZGxlVGVzdC5jcHAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uOD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ICJTTlIgIiA8PCBzbnIgPDwgImlzIGxvd2VyIHRoYW4gIiA8PCBFZmZlY3RUZXN0SGVscGVyOjprU05SVGhyZXNob2xkOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgQVNTRVJUX0VRKDAsCisgICAgICAgICAgICAgICAgICAgICAgbWVtY21wKHN0ZXJlb1JlZkkxNi5kYXRhKCksIHN0ZXJlb1Rlc3RJMTYuZGF0YSgpLCBtVG90YWxGcmFtZUNvdW50ICogRkNDXzIpKQorICAgICAgICAgICAgICAgICAgICA8PCAiRmlyc3QgdHdvIGNoYW5uZWxzIGRvIG5vdCBtYXRjaCB3aXRoIHN0ZXJlbyBvdXRwdXQgXG4iOworICAgICAgICB9CisgICAgfQorfQorCitJTlNUQU5USUFURV9URVNUX1NVSVRFX1AoCisgICAgICAgIEVmZmVjdEJ1bmRsZVRlc3RBbGwsIFNpbmdsZUVmZmVjdENvbXBhcmlzb25UZXN0LAorICAgICAgICA6OnRlc3Rpbmc6OkNvbWJpbmUoOjp0ZXN0aW5nOjpSYW5nZSgwLCAoaW50KUVmZmVjdFRlc3RIZWxwZXI6OmtOdW1TYW1wbGVSYXRlcyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICA6OnRlc3Rpbmc6OlJhbmdlKDAsIChpbnQpRWZmZWN0VGVzdEhlbHBlcjo6a051bUZyYW1lQ291bnRzKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIDo6dGVzdGluZzo6UmFuZ2UoMCwgKGludClFZmZlY3RUZXN0SGVscGVyOjprTnVtTG9vcENvdW50cyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICA6OnRlc3Rpbmc6OlJhbmdlKDAsIChpbnQpa051bUVmZmVjdFV1aWRzKSkpOworCitpbnQgbWFpbihpbnQgYXJnYywgY2hhcioqIGFyZ3YpIHsKKyAgICA6OnRlc3Rpbmc6OkluaXRHb29nbGVUZXN0KCZhcmdjLCBhcmd2KTsKKyAgICBpbnQgc3RhdHVzID0gUlVOX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GluQ2hNYXNrLCBzaXplX3Qgb3V0Q2hNYXNrLAorICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IHNhbXBsZVJhdGUsIHNpemVfdCBmcmFtZUNvdW50LCBzaXplX3QgbG9vcENvdW50KQorICAgICAgICA6IG1VdWlkKHV1aWQpLAorICAgICAgICAgIG1JbkNoTWFzayhpbkNoTWFzayksCisgICAgICAgICAgbUluQ2hhbm5lbENvdW50KGF1ZGlvX2NoYW5uZWxfY291bnRfZnJvbV9vdXRfbWFzayhtSW5DaE1hc2spKSwKKyAgICAgICAgICBtT3V0Q2hNYXNrKG91dENoTWFzayksCisgICAgICAgICAgbU91dENoYW5uZWxDb3VudChhdWRpb19jaGFubmVsX2NvdW50X2Zyb21fb3V0X21hc2sobU91dENoTWFzaykpLAorICAgICAgICAgIG1TYW1wbGVSYXRlKHNhbXBsZVJhdGUpLAorICAgICAgICAgIG1GcmFtZUNvdW50KGZyYW1lQ291bnQpLAorICAgICAgICAgIG1Mb29wQ291bnQobG9vcENvdW50KSB7fQorICAgIHZvaWQgY3JlYXRlRWZmZWN0KCk7CisgICAgdm9pZCByZWxlYXNlRWZmZWN0KCk7CisgICAgdm9pZCBzZXRDb25maWcoKTsKKyAgICB2b2lkIHNldFBhcmFtKHVpbnQzMl90IHR5cGUsIHVpbnQzMl90IHZhbCk7CisgICAgdm9pZCBwcm9jZXNzKGZsb2F0KiBpbnB1dCwgZmxvYXQqIG91dHB1dCk7CisKKyAgICAvLyBDb3JyZXNwb25kcyB0byBTTlIgZm9yIDEgYml0IGRpZmZlcmVuY2UgYmV0d2VlbiB0d28gaW50MTZfdCBzaWduYWxzCisgICAgc3RhdGljIGNvbnN0ZXhwciBmbG9hdCBrU05SVGhyZXNob2xkID0gOTAuMzA4OTk4OworCisgICAgc3RhdGljIGNvbnN0ZXhwciBhdWRpb19jaGFubmVsX21hc2tfdCBrQ2hNYXNrc1tdID0geworICAgICAgICAgICAgQVVESU9fQ0hBTk5FTF9PVVRfTU9OTyw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ICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzksCisgICAgICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTAsICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTEsCisgICAgICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTIsICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTMsCisgICAgICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTQsICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTUsCisgICAgICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTYsICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTcsCisgICAgICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTgsICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTksCisgICAgICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMjAsICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMjEsCisgICAgICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMjIsICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMjMsCisgICAgICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMjQsCisgICAgfTsKKworICAgIHN0YXRpYyBjb25zdGV4cHIgc2l6ZV90IGtOdW1DaE1hc2tzID0gc3RkOjpzaXplKGtDaE1hc2tzKTsKKworICAgIHN0YXRpYyBjb25zdGV4cHIgc2l6ZV90IGtTYW1wbGVSYXRlc1tdID0gezgwMDAsICAxMTAyNSwgMTIwMDAsIDE2MDAwLCAyMjA1MCwgIDI0MDAwLCAzMjAwMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDEwMCwgNDgwMDAsIDg4MjAwLCA5NjAwMCwgMTc2NDAwLCAxOTIwMDB9OworCisgICAgc3RhdGljIGNvbnN0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oTWFzayBpbiB7MC4uMzh9CisgICAgICAgICAgICAgICAgZG8KKyAgICAgICAgICAgICAgICAgICAgYWRiIHNoZWxsICR0ZXN0ZGlyL3JldmVyYl90ZXN0IFwKKyAgICAgICAgICAgICAgICAgICAgICAgIC0taW5wdXQgJHRlc3RkaXIvc2luZXN3ZWVwcmF3LnJhdyBcCisgICAgICAgICAgICAgICAgICAgICAgICAtLW91dHB1dCAkdGVzdGRpci9zaW5lc3dlZXBfJCgoY2hNYXNrKSlfJCgoZnMpKS5yYXcgXAorICAgICAgICAgICAgICAgICAgICAgICAgLS1jaE1hc2sgJGNoTWFzayAkZmxhZ3MgLS1mcyAkZnMgLS1wcmVzZXQgJHByZXNldF92YWwKKworICAgICAgICAgICAgICAgICAgICBzaGVsbF9yZXQ9JD8KKyAgICAgICAgICAgICAgICAgICAgaWYgWyAkc2hlbGxfcmV0IC1uZSAwIF07IHRoZW4KKyAgICAgICAgICAgICAgICAgICAgICAgIGVjaG8gImVycm9yOiAkc2hlbGxfcmV0IgorICAgICAgICAgICAgICAgICAgICAgICAgKCgrK2Vycm9yX2NvdW50KSkKKyAgICAgICAgICAgICAgICAgICAgZmkKKworICAgICAgICAgICAgICAgICAgICBpZiBbWyAiJGNoTWFzayIgLWd0IDAgXV0gJiYgW1sgJGZsYWdzICE9ICoiLS1mY2ggMiIqIF1dCisgICAgICAgICAgICAgICAgICAgIHRoZW4KKyAgICAgICAgICAgICAgICAgICAgICAgICMgc2luZ2xlIGNoYW5uZWwgZmlsZXMgc2hvdWxkIGJlIGlkZW50aWNhbCB0byBoaWdoZXIgY2hhbm5lbAorICAgICAgICAgICAgICAgICAgICAgICAgIyBjb21wdXRhdGlvbiAoZmlyc3QgY2hhbm5lbCkuCisgICAgICAgICAgICAgICAgICAgICAgICBhZGIgc2hlbGwgY21wICR0ZXN0ZGlyL3NpbmVzd2VlcF8wXyQoKGZzKSkucmF3IFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGVzdGRpci9zaW5lc3dlZXBfJCgoY2hNYXNrKSlfJCgoZnMpKS5yYXcKKyAgICAgICAgICAgICAgICAgICAgZWxpZiBbWyAiJGNoTWFzayIgLWd0IDEgXV0KKyAgICAgICAgICAgICAgICAgICAgdGhlbgorICAgICAgICAgICAgICAgICAgICAgICAgIyB0d28gY2hhbm5lbCBmaWxlcyBzaG91bGQgYmUgaWRlbnRpY2FsIHRvIGhpZ2hlciBjaGFubmVsCisgICAgICAgICAgICAgICAgICAgICAgICAjIGNvbXB1dGF0aW9uIChmaXJzdCAyIGNoYW5uZWxzKS4KKyAgICAgICAgICAgICAgICAgICAgICAgIGFkYiBzaGVsbCBjbXAgJHRlc3RkaXIvc2luZXN3ZWVwXzFfJCgoZnMpKS5yYXcgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0ZXN0ZGlyL3NpbmVzd2VlcF8kKChjaE1hc2spKV8kKChmcykpLnJhdworICAgICAgICAgICAgICAgICAgICBmaQorCisgICAgICAgICAgICAgICAgICAgICMgY21wIHJldHVybnMgRVhJVF9GQUlMVVJFIG9uIG1pc21hdGNoLgorICAgICAgICAgICAgICAgICAgICBzaGVsbF9yZXQ9JD8KKyAgICAgICAgICAgICAgICAgICAgaWYgWyAkc2hlbGxfcmV0IC1uZSAwIF07IHRoZW4KKyAgICAgICAgICAgICAgICAgICAgICAgIGVjaG8gImVycm9yOiAkc2hlbGxfcmV0IgorICAgICAgICAgICAgICAgICAgICAgICAgKCgrK2Vycm9yX2NvdW50KSkKKyAgICAgICAgICAgICAgICAgICAgZmkKKyAgICAgICAgICAgICAgICAgICAgKCgrK3Rlc3RjYXNlX2NvdW50KSkKKyAgICAgICAgICAgICAgICBkb25lCisgICAgICAgICAgICBkb25lCisgICAgICAgIGRvbmUKKyAgICBkb25lCitkb25lCisKK2FkYiBzaGVsbCBybSAtciAkdGVzdGRpcgorZWNobyAiJHRlc3RjYXNlX2NvdW50IHRlc3RzIHBlcmZvcm1lZCIKK2VjaG8gIiRlcnJvcl9jb3VudCBlcnJvcnMiCitleGl0ICRlcnJvcl9jb3VudApkaWZmIC0tZ2l0IGEvbWVkaWEvbGliZWZmZWN0cy9sdm0vdGVzdHMvbHZtdGVzdC5jcHAgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS90ZXN0cy9sdm10ZXN0LmNwcAppbmRleCBhNGFjZTZjLi5lNjUyMjhjIDEwMDY0NAotLS0gYS9tZWRpYS9saWJlZmZlY3RzL2x2bS90ZXN0cy9sdm10ZXN0LmNwcAorKysgYi9tZWRpYS9saWJlZmZlY3RzL2x2bS90ZXN0cy9sdm10ZXN0LmNwcApAQCAtMzMsMTk4ICszMywxNjUgQEAKICNkZWZpbmUgQUxPR1ZWIEFMT0dWCiAjZWxzZQogI2RlZmluZSBBTE9HVlYoYS4uLikgXAotICBkbyB7ICAgICAgICAgICAgICAgXAotICB9IHdoaWxlIChmYWxzZSkKKyAgICBkbyB7ICAgICAgICAgICAgIFwKKyAgICB9IHdoaWxlIChmYWxzZSkKICNlbmRpZgogCi0jZGVmaW5lIENIRUNLX0FSRyhjb25kKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICBpZiAoIShjb25kKSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICBBTE9HRSgiXHRMVk1fRVJST1IgOiBJbnZhbGlkIGFyZ3VtZW50OiAiICNjb25kKTsgXAotICAgICAgcmV0dXJuIC1FSU5WQUw7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gIFwKLX0KKyNkZWZpbmUgQ0hFQ0tfQVJHKGNvbmQpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBpZiAoIShjb25kKSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIEFMT0dFKCJcdExWTV9FUlJPUiA6IEludmFsaWQgYXJndW1lbnQ6ICIgI2NvbmQpOyBcCisgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9CiAKLSNkZWZpbmUgTFZNX0VSUk9SX0NIRUNLKEx2bVN0YXR1cywgY2FsbGluZ0Z1bmMsIGNhbGxlZEZ1bmMpICAgICBcCi0gIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIGlmICgoTHZtU3RhdHVzKSA9PSBMVk1fTlVMTEFERFJFU1MpIHsgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICAgIEFMT0dFKCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgICAgIlx0TFZNX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICAgICJudWxsIHBvaW50ZXIgcmV0dXJuZWQgYnkgJXMgaW4gJXNcblxuXG5cbiIsICAgICAgICAgIFwKLSAgICAgICAgICBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIGlmICgoTHZtU3RhdHVzKSA9PSBMVk1fQUxJR05NRU5URVJST1IpIHsgICAgICAgICAgICAgICAgICAgIFwKLSAgICAgIEFMT0dFKCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgICAgIlx0TFZNX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICAgICJiYWQgYWxpZ25tZW50IHJldHVybmVkIGJ5ICVzIGluICVzXG5cblxuXG4iLCAgICAgICAgIFwKLSAgICAgICAgICBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIGlmICgoTHZtU3RhdHVzKSA9PSBMVk1fSU5WQUxJRE5VTVNBTVBMRVMpIHsgICAgICAgICAgICAgICAgIFwKLSAgICAgIEFMT0dFKCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgICAgIlx0TFZNX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICAgICJiYWQgbnVtYmVyIG9mIHNhbXBsZXMgcmV0dXJuZWQgYnkgJXMgaW4gJXNcblxuXG5cbiIsIFwKLSAgICAgICAgICBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIGlmICgoTHZtU3RhdHVzKSA9PSBMVk1fT1VUT0ZSQU5HRSkgeyAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICAgIEFMT0dFKCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgICAgIlx0TFZNX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICAgICJvdXQgb2YgcmFuZ2UgcmV0dXJuZWQgYnkgJXMgaW4gJXNcbiIsICAgICAgICAgICAgICAgIFwKLSAgICAgICAgICBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICB9CisjZGVmaW5lIExWTV9FUlJPUl9DSEVDSyhMdm1TdGF0dXMsIGNhbGxpbmdGdW5jLCBjYWxsZWRGdW5jKSAgICAgICAgICAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIGlmICgoTHZtU3RhdHVzKSA9PSBMVk1fTlVMTEFERFJFU1MpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICBBTE9HRSgiXHRMVk1fRVJST1IgOiBQYXJhbWV0ZXIgZXJyb3IgLSAiICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAibnVsbCBwb2ludGVyIHJldHVybmVkIGJ5ICVzIGluICVzXG5cblxuXG4iLCAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIGlmICgoTHZtU3RhdHVzKSA9PSBMVk1fQUxJR05NRU5URVJST1IpIHsgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICBBTE9HRSgiXHRMVk1fRVJST1IgOiBQYXJhbWV0ZXIgZXJyb3IgLSAiICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAiYmFkIGFsaWdubWVudCByZXR1cm5lZCBieSAlcyBpbiAlc1xuXG5cblxuIiwgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIGlmICgoTHZtU3RhdHVzKSA9PSBMVk1fSU5WQUxJRE5VTVNBTVBMRVMpIHsgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICBBTE9HRSgiXHRMVk1fRVJST1IgOiBQYXJhbWV0ZXIgZXJyb3IgLSAiICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAiYmFkIG51bWJlciBvZiBzYW1wbGVzIHJldHVybmVkIGJ5ICVzIGluICVzXG5cblxuXG4iLCBcCisgICAgICAgICAgICAgICAgICBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIGlmICgoTHZtU3RhdHVzKSA9PSBMVk1fT1VUT0ZSQU5HRSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICBBTE9HRSgiXHRMVk1fRVJST1IgOiBQYXJhbWV0ZXIgZXJyb3IgLSAiICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAib3V0IG9mIHJhbmdlIHJldHVybmVkIGJ5ICVzIGluICVzXG4iLCAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgfQogCiBzdHJ1Y3QgbHZtQ29uZmlnUGFyYW1zX3QgewotICBpbnQgICAgICAgICAgICAgIHNhbXBsaW5nRnJlcSAgICA9IDQ0MTAwOwotICBpbnQgICAgICAgICAgICAgIG5yQ2hhbm5lbHMgICAgICA9IDI7Ci0gIGludCAgICAgICAgICAgICAgY2hNYXNrICAgICAgICAgID0gQVVESU9fQ0hBTk5FTF9PVVRfU1RFUkVPOwotICBpbnQgICAgICAgICAgICAgIHZjQmFsICAgICAgICAgICA9IDA7Ci0gIGludCAgICAgICAgICAgICAgZkNoYW5uZWxzICAgICAgID0gMjsKLSAgYm9vbCAgICAgICAgICAgICBtb25vTW9kZSAgICAgICAgPSBmYWxzZTsKLSAgaW50ICAgICAgICAgICAgICBiYXNzRWZmZWN0TGV2ZWwgPSAwOwotICBpbnQgICAgICAgICAgICAgIGVxUHJlc2V0TGV2ZWwgICA9IDA7Ci0gIGludCAgICAgICAgICAgICAgZnJhbWVMZW5ndGggICAgID0gMjU2OwotICBMVk1fQkVfTW9kZV9lbiAgIGJhc3NFbmFibGUgICAgICA9IExWTV9CRV9PRkY7Ci0gIExWTV9URV9Nb2RlX2VuICAgdHJlYmxlRW5hYmxlICAgID0gTFZNX1RFX09GRjsKLSAgTFZNX0VRTkJfTW9kZV9lbiBlcUVuYWJsZSAgICAgICAgPSBMVk1fRVFOQl9PRkY7Ci0gIExWTV9Nb2RlX2VuICAgICAgY3NFbmFibGUgICAgICAgID0gTFZNX01PREVfT0ZGOworICAgIGludCBzYW1wbGluZ0ZyZXEgPSA0NDEwMDsKKyAgICBpbnQgbnJDaGFubmVscyA9IDI7CisgICAgaW50IGNoTWFzayA9IEFVRElPX0NIQU5ORUxfT1VUX1NURVJFTzsKKyAgICBpbnQgdmNCYWwgPSAwOworICAgIGludCBmQ2hhbm5lbHMgPSAyOworICAgIGJvb2wgbW9ub01vZGUgPS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TlQxX0JBQ0ssCisgICAgICAgIEFVRElPX0NIQU5ORUxfT1VUXzVQT0lOVDFfU0lERSwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzYsCisgICAgICAgIEFVRElPX0NIQU5ORUxfT1VUXzZQT0lOVDEsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS183LAorICAgICAgICBBVURJT19DSEFOTkVMX09VVF81UE9JTlQxUE9JTlQyLAorICAgICAgICBBVURJT19DSEFOTkVMX09VVF83UE9JTlQxLAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfOCwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzksCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS18xMCwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzExLAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTIsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS18xMywKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzE0LAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTUsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS18xNiwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzE3LAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTgsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS18xOSwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzIwLAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMjEsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS18yMiwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzIzLAorICAgICAgICBB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xvdXRfZmlsZT4gW29wdGlvbnNdXG4iKTsKKyAgICBwcmludGYoIlxud2hlcmUsIFxuICAgICA8aW5wdXRmaWxlPiAgaXMgdGhlIGlucHV0IGZpbGUgbmFtZSIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgICAgICAgICBvbiB3aGljaCBMVk0gZWZmZWN0cyBhcmUgYXBwbGllZCIpOworICAgIHByaW50ZigiXG4gICAgIDxvdXRwdXRmaWxlPiBwcm9jZXNzZWQgb3V0cHV0IGZpbGUiKTsKKyAgICBwcmludGYoIlxuICAgICBhbmQgb3B0aW9ucyBhcmUgbWVudGlvbmVkIGJlbG93Iik7CisgICAgcHJpbnRmKCJcbiIpOworICAgIHByaW50ZigiXG4gICAgIC1oZWxwIChvcikgLWgiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICBQcmludHMgdGhpcyB1c2FnZSBpbmZvcm1hdGlvbiIpOworICAgIHByaW50ZigiXG4iKTsKKyAgICBwcmludGYoIlxuICAgICAtY2hNYXNrOjxjaGFubmVsX21hc2s+XG4iKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgMCAgLSBBVURJT19DSEFOTkVMX09VVF9NT05PIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgIDEgIC0gQVVESU9fQ0hBTk5FTF9PVVRfU1RFUkVPIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgIDIgIC0gQVVESU9fQ0hBTk5FTF9PVVRfMlBPSU5UMSIpOworICAgIHByaW50ZigiXG4gICAgICAgICAzICAtIEFVRElPX0NIQU5ORUxfT1VUXzJQT0lOVDBQT0lOVDIiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgNCAgLSBBVURJT19DSEFOTkVMX09VVF9RVUFEIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgIDUgIC0gQVVESU9fQ0hBTk5FTF9PVVRfUVVBRF9CQUNLIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgIDYgIC0gQVVESU9fQ0hBTk5FTF9PVVRfUVVBRF9TSURFIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgIDcgIC0gQVVESU9fQ0hBTk5FTF9PVVRfU1VSUk9VTkQiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgOCAgLSBjYW5vbmljYWwgY2hhbm5lbCBpbmRleCBtYXNrIGZvciA0IGNoOiAoMSA8PCA0KSAtIDEiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgOSAgLSBBVURJT19DSEFOTkVMX09VVF8yUE9JTlQxUE9JTlQyIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgIDEwIC0gQVVESU9fQ0hBTk5FTF9PVVRfM1BPSU5UMFBPSU5UMiIpOworICAgIHByaW50ZigiXG4gICAgICAgICAxMSAtIEFVRElPX0NIQU5ORUxfT1VUX1BFTlRBIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgIDEyIC0gY2Fub25pY2FsIGNoYW5uZWwgaW5kZXggbWFzayBmb3IgNSBjaDogKDEgPDwgNSkgLSAxIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgIDEzIC0gQVVESU9fQ0hBTk5FTF9PVVRfM1BPSU5UMVBPSU5UMiIpOworICAgIHByaW50ZigiXG4gICAgICAgICAxNCAtIEFVRElPX0NIQU5ORUxfT1VUXzVQT0lOVDEiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgMTUgLSBBVURJT19DSEFOTkVMX09VVF81UE9JTlQxX0JBQ0siKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgMTYgLSBBVURJT19DSEFOTkVMX09VVF81UE9JTlQxX1NJREUiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgMTcgLSBjYW5vbmljYWwgY2hhbm5lbCBpbmRleCBtYXNrIGZvciA2IGNoOiAoMSA8PCA2KSAtIDEiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgMTggLSBBVURJT19DSEFOTkVMX09VVF82UE9JTlQxIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgIDE5IC0gY2Fub25p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1RMRVZFTCwKKyAgICAgICAgICAgTFZNX0JFX01BWF9FRkZFQ1RMRVZFTCk7CisgICAgcHJpbnRmKCJcbiIpOworICAgIHByaW50ZigiXG4gICAgIC1lcVByZXNldDo8cHJlc2V0IFZhbHVlPiIpOworICAgIGNvbnN0IHNpemVfdCBudW1QcmVzZXRMdmxzID0gc3RkOjpzaXplKGdFcXVhbGl6ZXJQcmVzZXRzKTsKKyAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG51bVByZXNldEx2bHM7ICsraSkgeworICAgICAgICBwcmludGYoIlxuICAgICAgICAgICAlenUgLSAlcyIsIGksIGdFcXVhbGl6ZXJQcmVzZXRzW2ldLm5hbWUpOwogICAgIH0KLSAgfQotfSAvKiBlbmQgTHZtRWZmZWN0X2ZyZWUgKi8KKyAgICBwcmludGYoIlxuICAgICAgICAgICBkZWZhdWx0IC0gMCIpOworICAgIHByaW50ZigiXG4gICAgIC1iRSAiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICBFbmFibGUgRHluYW1pYyBCYXNzIEVuaGFuY2VtZW50Iik7CisgICAgcHJpbnRmKCJcbiIpOworICAgIHByaW50ZigiXG4gICAgIC10RSAiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICBFbmFibGUgVHJlYmxlIEJvb3N0Iik7CisgICAgcHJpbnRmKCJcbiIpOworICAgIHByaW50ZigiXG4gICAgIC1jc0UgIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgICAgRW5hYmxlIENvbmNlcnQgU3Vycm91bmQiKTsKKyAgICBwcmludGYoIlxuIik7CisgICAgcHJpbnRmKCJcbiAgICAgLWVxRSAiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICBFbmFibGUgRXF1YWxpemVyIik7Cit9CiAKIC8vLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogLy8gTHZtQn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h0LAotICAgICAgICAgICAgICAgbHZtQ29uZmlnUGFyYW1zX3QgKnBsdm1Db25maWdQYXJhbXMpIHsKLSAgY29uc3QgaW50IGZyYW1lTGVuZ3RoID0gcGx2bUNvbmZpZ1BhcmFtcy0+ZnJhbWVMZW5ndGg7Ci0gIHJldHVybgotICAgICAgTFZNX1Byb2Nlc3MocENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+aEluc3RhbmNlLCAvKiBJbnN0YW5jZSBoYW5kbGUgKi8KLSAgICAgICAgICAgICAgICAgIGZsb2F0SW4sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSW5wdXQgYnVmZmVyICovCi0gICAgICAgICAgICAgICAgICBmbG9hdE91dCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE91dHB1dCBidWZmZXIgKi8KLSAgICAgICAgICAgICAgICAgIChMVk1fVUlOVDE2KWZyYW1lTGVuZ3RoLCAvKiBOdW1iZXIgb2Ygc2FtcGxlcyB0byByZWFkICovCi0gICAgICAgICAgICAgICAgICAwKTsgICAgICAgICAgICAgICAgICAgICAgLyogQXVkaW8gVGltZSAqLwotfQotCi1pbnQgbHZtTWFpblByb2Nlc3MoRWZmZWN0Q29udGV4dCAqcENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgTFZNX0NvbnRyb2xQYXJhbXNfdCAqcFBhcmFtcywKLSAgICAgICAgICAgICAgICAgICBsdm1Db25maWdQYXJhbXNfdCAqcGx2bUNvbmZpZ1BhcmFtcywKLSAgICAgICAgICAgICAgICAgICBGSUxFICpmaW5wLAotICAgICAgICAgICAgICAgICAgIEZJTEUgKmZvdXQpIHsKLSAgaW50IGVyckNvZGUgPSBsdm1Db250cm9sKHBDb250ZXh0LCBwbHZtQ29uZmlnUGFyYW1zLCBwUGFyYW1zKTsKLSAgaWYgKGVyckNvZGUpIHsKLSAgICBBTE9HRSgiRXJyb3I6IGx2bUNvbnRyb2wgcmV0dXJuZWQgd2l0aCAlZFxuIiwgZXJ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2bUV4ZWN1dGUoZmxvYXQqIGZsb2F0SW4sIGZsb2F0KiBmbG9hdE91dCwgc3RydWN0IEVmZmVjdENvbnRleHQqIHBDb250ZXh0LAorICAgICAgICAgICAgICAgbHZtQ29uZmlnUGFyYW1zX3QqIHBsdm1Db25maWdQYXJhbXMpIHsKKyAgICBjb25zdCBpbnQgZnJhbWVMZW5ndGggPSBwbHZtQ29uZmlnUGFyYW1zLT5mcmFtZUxlbmd0aDsKKyAgICByZXR1cm4gTFZNX1Byb2Nlc3MocENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+aEluc3RhbmNlLCAvKiBJbnN0YW5jZSBoYW5kbGUgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgZmxvYXRJbiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBJbnB1dCBidWZmZXIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgZmxvYXRPdXQsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBPdXRwdXQgYnVmZmVyICovCisgICAgICAgICAgICAgICAgICAgICAgIChMVk1fVUlOVDE2KWZyYW1lTGVuZ3RoLCAgICAgICAgICAgICAgLyogTnVtYmVyIG9mIHNhbXBsZXMgdG8gcmVhZCAqLworICAgICAgICAgICAgICAgICAgICAgICAwKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEF1ZGlvIFRpbWUgKi8KK30KKworaW50IGx2bU1haW5Qcm9jZXNzKEVmZmVjdENvbnRleHQqIHBDb250ZXh0LCBMVk1fQ29udHJvbFBhcmFtc190KiBwUGFyYW1zLAorICAgICAgICAgICAgICAgICAgIGx2bUNvbmZpZ1BhcmFtc190KiBwbHZtQ29uZmlnUGFyYW1zLCBGSUxFKiBmaW5wLCBGSUxFKiBmb3V0KSB7CisgICAgaW50IGVyckNvZGUgPSBsdm1Db250cm9sKHBDb250ZXh0LCBwbHZtQ29uZmlnUGFyYW1zLCBwUGFyYW1zKTsKKyAgICBpZiAoZXJyQ29k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H0KKyAgICBwcmludGYoImZyYW1lQ291bnRlcjogWyVkXVxuIiwgZnJhbWVDb3VudGVyKTsKKyAgICByZXR1cm4gMDsKK30KKworaW50IG1haW4oaW50IGFyZ2MsIGNvbnN0IGNoYXIqIGFyZ3ZbXSkgeworICAgIGlmIChhcmdjID09IDEpIHsKKyAgICAgICAgcHJpbnRVc2FnZSgpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgbHZtQ29uZmlnUGFyYW1zX3QgbHZtQ29uZmlnUGFyYW1ze307ICAvLyBkZWZhdWx0IGluaXRpYWxpemUKKyAgICBjb25zdCBjaGFyKiBpbmZpbGUgPSBudWxscHRyOworICAgIGNvbnN0IGNoYXIqIG91dGZpbGUgPSBudWxscHRyOworCisgICAgZm9yIChpbnQgaSA9IDE7IGkgPCBhcmdjOyBpKyspIHsKKyAgICAgICAgcHJpbnRmKCIlcyAiLCBhcmd2W2ldKTsKKyAgICAgICAgaWYgKCFzdHJuY21wKGFyZ3ZbaV0sICItaToiLCAzKSkgeworICAgICAgICAgICAgaW5maWxlID0gYXJndltpXSArIDM7CisgICAgICAgIH0gZWxzZSBpZiAoIXN0cm5jbXAoYXJndltpXSwgIi1vOiIsIDMpKSB7CisgICAgICAgICAgICBvdXRmaWxlID0gYXJndltpXSArIDM7CisgICAgICAgIH0gZWxzZSBpZiAoIXN0cm5jbXAoYXJndltpXSwgIi1mczoiLCA0KSkgeworICAgICAgICAgICAgY29uc3QgaW50IHNhbXBsaW5nRnJlcSA9IGF0b2koYXJndltpXSArIDQpOworICAgICAgICAgICAgaWYgKHNhbXBsaW5nRnJlcSAhPSA4MDAwICYmIHNhbXBsaW5nRnJlcSAhPSAxMTAyNSAmJiBzYW1wbGluZ0ZyZXEgIT0gMTIwMDAgJiYKKyAgICAgICAgICAgICAgICBzYW1wbGluZ0ZyZXEgIT0gMTYwMDAgJiYgc2FtcGxpbmdGcmVxICE9IDIyMDUwICYmIHNhbXBsaW5nRnJlcSAhPSAyNDAwM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dJZHhdOworICAgICAgICAgICAgbHZtQ29uZmlnUGFyYW1zLmNoTWFzayA9IGNoTWFzazsKKyAgICAgICAgICAgIGx2bUNvbmZpZ1BhcmFtcy5uckNoYW5uZWxzID0gYXVkaW9fY2hhbm5lbF9jb3VudF9mcm9tX291dF9tYXNrKGNoTWFzayk7CisgICAgICAgIH0gZWxzZSBpZiAoIXN0cm5jbXAoYXJndltpXSwgIi12Y0JhbDoiLCA3KSkgeworICAgICAgICAgICAgY29uc3QgaW50IHZjQmFsYW5jZSA9IGF0b2koYXJndltpXSArIDcpOworICAgICAgICAgICAgaWYgKHZjQmFsYW5jZSA+IDk2IHx8IHZjQmFsYW5jZSA8IC05NikgeworICAgICAgICAgICAgICAgIEFMT0dFKCJcbkVycm9yOiBVbnN1cHBvcnRlZCB2b2x1bWUgYmFsYW5jZSB2YWx1ZTogJWRcbiIsIHZjQmFsYW5jZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBsdm1Db25maWdQYXJhbXMudmNCYWwgPSB2Y0JhbGFuY2U7CisgICAgICAgIH0gZWxzZSBpZiAoIXN0cm5jbXAoYXJndltpXSwgIi1mY2g6IiwgNSkpIHsKKyAgICAgICAgICAgIGNvbnN0IGludCBmQ2hhbm5lbHMgPSBhdG9pKGFyZ3ZbaV0gKyA1KTsKKyAgICAgICAgICAgIGlmIChmQ2hhbm5lbHMgPiA4IHx8IGZDaGFubmVscyA8IDEpIHsKKyAgICAgICAgICAgICAgICBwcmludGYoIkVycm9yOiBVbnN1cHBvcnRlZCBudW1iZXIgb2YgZmlsZSBjaGFubmVscyA6ICVkXG4iLCBmQ2hhbm5lbHMpOworICAgICAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGx2bUNvbmZpZ1BhcmFtcy5mQ2hhbm5lbHMgPSBmQ2hhbm5lbHM7CisgICAgICAgIH0gZWxzZSBpZiAoIXN0cmNtcChhcmd2W2ldLCAiLU0iKSkgeworICAgICAgICAgICAgbHZtQ29uZmlnUGFyYW1zLm1vbm9Nb2RlID0gdHJ1ZTsKKyAgICAgICAgfSBlbHNlIGlmICghc3RybmNtcChhcmd2W2ldLCAiLWJhc3Nsdmw6IiwgOSkpIHsKKyAgICAgICAgICAgIGNvbnN0IGludCBiYXNzRWZmZWN0TGV2ZWwgPSBhdG9pKGFyZ3ZbaV0gKyA5KTsKKyAgICAgICAgICAgIGlmIChiYXNzRWZmZWN0TGV2ZWwgPiBMVk1fQkVfTUFYX0VGRkVDVExFVkVMIHx8CisgICAgICAgICAgICAgICAgYmFzc0VmZmVjdExldmVsIDwgTFZNX0JFX01JTl9FRkZFQ1RMRVZFTCkgeworICAgICAgICAgICAgICAgIHByaW50ZigiRXJyb3I6IFVuc3VwcG9ydGVkIEJhc3MgRWZmZWN0IExldmVsIDogJWRcbiIsIGJhc3NFZmZlY3RMZXZlbCk7CisgICAgICAgICAgICAgICAgcHJpbnRVc2FnZSgpOworICAgICAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGx2bUNvbmZpZ1BhcmFtcy5iYXNzRWZmZWN0TGV2ZWwgPSBiYXNzRWZmZWN0TGV2ZWw7CisgICAgICAgIH0gZWxzZSBpZiAoIXN0cm5jbXAoYXJndltpXSwgIi1lcVByZXNldDoiLCAxMCkpIHsKKyAgICAgICAgICAgIGNvbnN0IGludCBlcVByZXNldExldmVsID0gYXRvaShhcmd2W2ldICsgMTApOworICAgICAgICAgICAgY29uc3QgaW50IG51bVByZXNldEx2bHMgPSBzdGQ6OnNpemUoZ0VxdWFsaXplclByZXNldHMpOworICAgICAgICAgICAgaWYgKGVxUHJlc2V0TGV2ZWwgPj0gbnVtUHJlc2V0THZscyB8fCBlcVByZXNldExldmVsIDwgMCkgeworICAgICAgICAgICAgICAgIHByaW50ZigiRXJyb3I6IFVuc3VwcG9ydGVkIEVxdWFsaXplciBQcmVzZXQgOiAlZFxuIiwgZXFQcmVzZXRMZXZlbCk7CisgICAgICAgICAgICAgICAgcHJpbnRVc2FnZSgpOworICAgICAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGx2bUNvbmZpZ1BhcmFtcy5lcVByZXNldExldmVsID0gZXFQcmVzZXRMZXZlbDsKKyAgICAgICAgfSBlbHNlIGlmICghc3RybmNtcChhcmd2W2ldLCAiLXRyZWJsZUx2bDoiLCAxMSkpIHsKKyAgICAgICAgICAgIGNvbnN0IGludCB0cmVibGVFZmZlY3RMZXZlbCA9IGF0b2koYXJndltpXSArIDExKTsKKyAgICAgICAgICAgIGlmICh0cmVibGVFZmZlY3RMZXZlbCA+IExWTV9URV9NQVhfRUZGRUNUTEVWRUwgfHwKKyAgICAgICAgICAgICAgICB0cmVibGVFZmZlY3RMZXZlbCA8IExWTV9URV9NSU5fRUZGRUNUTEVWRUwpIHsKKyAgICAgICAgICAgICAgICBwcmludGYoIkVycm9yOiBVbnN1cHBvcnRlZCBUcmVibGUgRWZmZWN0IExldmVsIDogJWRcbiIsIHRyZWJsZUVmZmVjdExldmVsKTsKKyAgICAgICAgICAgICAgICBwcmludFVzYWdlKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbHZtQ29uZmlnUGFyYW1zLnRyZWJsZUVmZmVjdExldmVsID0gdHJlYmxlRWZmZWN0TGV2ZWw7CisgICAgICAgIH0gZWxzZSBpZiAoIXN0cmNtcChhcmd2W2ldLCAiLWJFIikpIHsKKyAgICAgICAgICAgIGx2bUNvbmZpZ1BhcmFtcy5iYXNzRW5hYmxlID0gTFZNX0JFX09OOworICAgICAgICB9IGVsc2UgaWYgKCFzdHJjbXAoYXJndltpXSwgIi1lcUUiKSkgeworICAgICAgICAgICAgbHZtQ29uZmlnUGFyYW1zLmVxRW5hYmxlID0gTFZNX0VRTkJfT047CisgICAgICAgIH0gZWxzZSBpZiAoIXN0cmNtcChhcmd2W2ldLCAiLXRF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ZSBpZiAoIXN0cmNtcChhcmd2W2ldLCItTSIpKSB7Ci0gICAgICAgICAgbHZtQ29uZmlnUGFyYW1zLm1vbm9Nb2RlID0gdHJ1ZTsKLSAgICB9IGVsc2UgaWYgKCFzdHJuY21wKGFyZ3ZbaV0sICItYmFzc2x2bDoiLCA5KSkgewotICAgICAgY29uc3QgaW50IGJhc3NFZmZlY3RMZXZlbCA9IGF0b2koYXJndltpXSArIDkpOwotICAgICAgaWYgKGJhc3NFZmZlY3RMZXZlbCA+IExWTV9CRV9NQVhfRUZGRUNUTEVWRUwgfHwgYmFzc0VmZmVjdExldmVsIDwgTFZNX0JFX01JTl9FRkZFQ1RMRVZFTCkgewotICAgICAgICBwcmludGYoIkVycm9yOiBVbnN1cHBvcnRlZCBCYXNzIEVmZmVjdCBMZXZlbCA6ICVkXG4iLAotICAgICAgICAgICAgICAgYmFzc0VmZmVjdExldmVsKTsKKyAgICBpZiAoaW5maWxlID09IG51bGxwdHIgfHwgb3V0ZmlsZSA9PSBudWxscHRyKSB7CisgICAgICAgIHByaW50ZigiRXJyb3I6IG1pc3NpbmcgaW5wdXQvb3V0cHV0IGZpbGVzXG4iKTsKICAgICAgICAgcHJpbnRVc2FnZSgpOwogICAgICAgICByZXR1cm4gLTE7Ci0gICAgICB9Ci0gICAgICBsdm1Db25maWdQYXJhbXMuYmFzc0VmZmVjdExldmVsID0gYmFzc0VmZmVjdExldmVsOwotICAgIH0gZWxzZSBpZiAoIXN0cm5jbXAoYXJndltpXSwgIi1lcVByZXNldDoiLCAxMCkpIHsKLSAgICAgIGNvbnN0IGludCBlcVByZXNldExldmVsID0gYXRvaShhcmd2W2ldICsgMTApOwotICAgICAgY29uc3QgaW50IG51bVByZXNldEx2bHMgPSBzdGQ6OnNpemUoZ0VxdWFsaXplclByZXNldHMpOwotICAgICAgaWYgKGVxUHJlc2V0TGV2ZWwgPj0gbnVtUHJlc2V0THZscyB8fCBlcVByZXNldExldmVsIDwgMCkgewotICAgICAgICBwcmludGY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vbCB0aGF0IG5lZWRzIHRvIGJlIGV4cG9ydGVkCitleHRlcm4gYXVkaW9fZWZmZWN0X2xpYnJhcnlfdCBBVURJT19FRkZFQ1RfTElCUkFSWV9JTkZPX1NZTTsKKworLy8gR2xvYmFsIFZhcmlhYmxlcworZW51bSBSZXZlcmJQYXJhbXMgeworICAgIEFSR19IRUxQID0gMSwKKyAgICBBUkdfSU5QVVQsCisgICAgQVJHX09VVFBVVCwKKyAgICBBUkdfRlMsCisgICAgQVJHX0NIX01BU0ssCisgICAgQVJHX1BSRVNFVCwKKyAgICBBUkdfQVVYLAorICAgIEFSR19NT05PX01PREUsCisgICAgQVJHX0ZJTEVfQ0gsCit9OworCitjb25zdCBlZmZlY3RfdXVpZF90IGtSZXZlcmJVdWlkc1tdID0geworICAgICAgICB7MHgxNzJjZGYwMCwKKyAgICAgICAgIDB4YTNiYywKKyAgICAgICAgIDB4MTFkZiwKKyAgICAgICAgIDB4YTcyZiwKKyAgICAgICAgIHsweDAwLCAweDAyLCAweGE1LCAweGQ1LCAweGM1LCAweDFifX0sICAvLyBwcmVzZXQtaW5zZXJ0IG1vZGUKKyAgICAgICAgezB4ZjI5YTE0MDAsCisgICAgICAgICAweGEzYmIsCisgICAgICAgICAweDExZGYsCisgICAgICAgICAweDhkZGMsCisgICAgICAgICB7MHgwMCwgMHgwMiwgMHhhNSwgMHhkNSwgMHhjNSwgMHgxYn19LCAgLy8gcHJlc2V0LWF1eCBtb2RlCit9OworCisvLyBzdHJ1Y3R1cmVzCitzdHJ1Y3QgcmV2ZXJiQ29uZmlnUGFyYW1zX3QgeworICAgIGludCBmQ2hhbm5lbHMgPSAyOworICAgIGludCBtb25vTW9kZSA9IGZhbHNlOworICAgIGludCBmcmFtZUxlbmd0aCA9IDI1NjsKKyAgICBpbnQgcHJlc2V0ID0gMDsKKyAgICBpbnQgbnJDaGFubmVscyA9IDI7CisgICAgaW50IHNhbXBsZVJhdGUgPSA0ODAwMDsKKyAgICBpbnQgYXV4aWxpYXJ5ID0gMDsKKyAgICBhdWRpb19jaGFubmVsX21hc2tfdCBjaE1hc2sgPSBBVURJT19DSEFOTkVMX09VVF9TVEVSRU87Cit9OworCitjb25zdGV4cHIgYXVkaW9fY2hhbm5lbF9tYXNrX3Qga1JldmVyYkNvbmZpZ0NoTWFza1tdID0geworICAgICAgICBBVURJT19DSEFOTkVMX09VVF9NT05PLAorICAgICAgICBBVURJT19DSEFOTkVMX09VVF9TVEVSRU8sCisgICAgICAgIEFVRElPX0NIQU5ORUxfT1VUXzJQT0lOVDEsCisgICAgICAgIEFVRElPX0NIQU5ORUxfT1VUXzJQT0lOVDBQT0lOVDIsCisgICAgICAgIEFVRElPX0NIQU5ORUxfT1VUX1FVQUQsCisgICAgICAgIEFVRElPX0NIQU5ORUxfT1VUX1FVQURfQkFDSywKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9PVVRfUVVBRF9TSURFLAorICAgICAgICBBVURJT19DSEFOTkVMX09VVF9TVVJST1VORCwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzQsCisgICAgICAgIEFVRElPX0NIQU5ORUxfT1VUXzJQT0lOVDFQT0lOVDIsCisgICAgICAgIEFVRElPX0NIQU5ORUxfT1VUXzNQT0lOVDBQT0lOVDIsCisgICAgICAgIEFVRElPX0NIQU5ORUxfT1VUX1BFTlRBLAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfNSwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9PVVRfM1BPSU5UMVBPSU5UMiwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9PVVRfNVBPSU5UMSwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9PVVRfNVBPSU5UMV9CQUNLLAorICAgICAgICBBVURJT19DSEFOTkVMX09VVF81UE9JTlQxX1NJREUsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS182LAorICAgICAgICBBVURJT19DSEFOTkVMX09VVF82UE9JTlQxLAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfNywKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9PVVRfNVBPSU5UMVBPSU5UMiwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9PVVRfN1BPSU5UMSwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzgsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS185LAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTAsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS18xMSwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzEyLAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTMsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS18xNCwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzE1LAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTYsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS18xNywKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzE4LAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMTksCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS18yMCwKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzIxLAorICAgICAgICBBVURJT19DSEFOTkVMX0lOREVYX01BU0tfMjIsCisgICAgICAgIEFVRElPX0NIQU5ORUxfSU5ERVhfTUFTS18yMywKKyAgICAgICAgQVVESU9fQ0hBTk5FTF9JTkRFWF9NQVNLXzI0LAorfTsKKworY29uc3RleHByIGludCBrUmV2ZXJiQ29uZmlnQ2hNYXNrQ291bnQgPSBzdGQ6OnNpemUoa1JldmVyYkNvbmZpZ0NoTWFzayk7CisKK2ludCByZXZlcmJDcmVhdGVFZmZlY3QoZWZmZWN0X2hhbmRsZV90KiBwRWZmZWN0SGFuZGxlLCBlZmZlY3RfY29uZmlnX3QqIHBDb25maWcsIGludCBzZXNzaW9uSWQsCisgICAgICAgICAgICAgICAgICAgICAgIGludCBpb0lkLCBpbnQgYXV4RmxhZykgeworICAgIGlmIChpbnQgc3RhdHVzID0gQVVESU9fRUZGRUNUX0xJQlJBUllfSU5GT19TWU0uY3JlYXRlX2VmZmVjdCgma1JldmVyYlV1aWRzW2F1eEZsYWddLCBzZXNzaW9uSWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlvSWQsIHBFZmZlY3RIYW5kbGUpOworICAgICAgICBzdGF0dXMgIT0gMCkgeworICAgICAgICBBTE9HRSgiUmV2ZXJiIGNyZWF0ZSByZXR1cm5lZCBhbiBlcnJvciA9ICVkXG4iLCBzdGF0dXMpOworICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOworICAgIH0KKyAgICBpbnQgcmVwbHkgPSAwOworICAgIHVpbnQzMl90IHJlcGx5U2l6ZSA9IHNpemVvZihyZXBseSk7CisgICAgKCoqcEVmZmVjdEhhbmRsZSkKKyAgICAgICAgICAgIC0+Y29tbWFuZCgqcEVmZmVjdEhhbmRsZSwgRUZGRUNUX0NNRF9TRVRfQ09ORklHLCBzaXplb2YoZWZmZWN0X2NvbmZpZ190KSwgcENvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgICAmcmVwbHlTaXplLCAmcmVwbHkpOworICAgIHJldHVybiByZXBseTsKK30KKworaW50IHJldmVyYlNldENvbmZpZ1BhcmFtKHVpbnQzMl90IHBhcmFtVHlwZSwgdWludDMyX3QgcGFyYW1WYWx1ZSwgZWZmZWN0X2hhbmRsZV90IGVmZmVjdEhhbmRsZSkgeworICAgIGludCByZXBseSA9IDA7CisgICAgdWludDMyX3QgcmVwbHlTaXplID0gc2l6ZW9mKHJlcGx5KTs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dXG4iKTsKKyAgICBwcmludGYoIlxud2hlcmUgb3B0aW9ucyBhcmUsICIpOworICAgIHByaW50ZigiXG4gICAgIC0taW5wdXQgPGlucHV0ZmlsZT4iKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICBwYXRoIHRvIHRoZSBpbnB1dCBmaWxlIik7CisgICAgcHJpbnRmKCJcbiAgICAgLS1vdXRwdXQgPG91dHB1dGZpbGU+Iik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgICAgcGF0aCB0byB0aGUgb3V0cHV0IGZpbGUiKTsKKyAgICBwcmludGYoIlxuICAgICAtLWhlbHAiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICBwcmludHMgdGhpcyB1c2FnZSBpbmZvcm1hdGlvbiIpOworICAgIHByaW50ZigiXG4gICAgIC0tY2hNYXNrIDxjaGFubmVsX21hc2s+XG4iKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICAwICAtIEFVRElPX0NIQU5ORUxfT1VUX01PTk8iKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICAxICAtIEFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDIgIC0gQVVESU9fQ0hBTk5FTF9PVVRfMlBPSU5UMSIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDMgIC0gQVVESU9fQ0hBTk5FTF9PVVRfMlBPSU5UMFBPSU5UMiIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDQgIC0gQVVESU9fQ0hBTk5FTF9PVVRfUVVBRCIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDUgIC0gQVVESU9fQ0hBTk5FTF9PVVRfUVVBRF9CQUNLIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgICAgNiAgLSBBVURJT19DSEFOTkVMX09VVF9RVUFEX1NJREUiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICA3ICAtIEFVRElPX0NIQU5ORUxfT1VUX1NVUlJPVU5EIik7Cis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0gMSIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDIwIC0gQVVESU9fQ0hBTk5FTF9PVVRfNVBPSU5UMVBPSU5UMiIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDIxIC0gQVVESU9fQ0hBTk5FTF9PVVRfN1BPSU5UMSIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDIyIC0gY2Fub25pY2FsIGNoYW5uZWwgaW5kZXggbWFzayBmb3IgOCBjaDogKDEgPDwgOCkgLSAxIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgICAgZGVmYXVsdCAwIik7CisgICAgcHJpbnRmKCJcbiAgICAgLS1mcyA8c2FtcGxpbmdfZnJlcT4iKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICBTYW1wbGluZyBmcmVxdWVuY3kgaW4gSHosIGRlZmF1bHQgNDgwMDAuIik7CisgICAgcHJpbnRmKCJcbiAgICAgLS1wcmVzZXQgPHByZXNldF92YWx1ZT4iKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICAwIC0gTm9uZSIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDEgLSBTbWFsbCBSb29tIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgICAgMiAtIE1lZGl1bSBSb29tIik7CisgICAgcHJpbnRmKCJcbiAgICAgICAgICAgMyAtIExhcmdlIFJvb20iKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICA0IC0gTWVkaXVtIEhhbGwiKTsKKyAgICBwcmludGYoIlxuICAgICAgICAgICA1IC0gTGFyZ2UgSGFsbCIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDYgLSBQbGF0ZSIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIGRlZmF1bHQgMCIpOworICAgIHByaW50ZigiXG4gICAgIC0tZmNoIDxmaWxlX2NoYW5uZWxzPiIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIG51bWJlciBvZiBjaGFubmVscyBpbiBpbnB1dCBmaWxlICgxIHRocm91Z2ggOCksIGRlZmF1bHQgMSIpOworICAgIHByaW50ZigiXG4gICAgIC0tTSIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIE1vbm8gbW9kZSAoZm9yY2UgYWxsIGlucHV0IGF1ZGlvIGNoYW5uZWxzIHRvIGJlIGlkZW50aWNhbCkiKTsKKyAgICBwcmludGYoIlxuICAgICAtLWF1eCA8YXV4aWxpYXJ5X2ZsYWc+ICIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDAgLSBJbnNlcnQgTW9kZSBvbiIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIDEgLSBhdXhpbGlhcnkgTW9kZSBvbiIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIGRlZmF1bHQgMCIpOworICAgIHByaW50ZigiXG4iKTsKK30KKworaW50IG1haW4oaW50IGFyZ2MsIGNvbnN0IGNoYXIqIGFyZ3ZbXSkgeworICAgIGlmIChhcmdjID09IDEpIHsKKyAgICAgICAgcHJpbnRVc2FnZSgpOworICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOworICAgIH0KKyAgICBmb3IgKGludCBpID0gMTsgaSA8IGFyZ2M7IGkrKykgeworICAgICAgICBwcmludGYoIiVzICIsIGFyZ3ZbaV0pOworICAgIH0KKyAgICByZXZlcmJDb25maWdQYXJhbXNfdCByZXZDb25maWdQYXJhbXN7fTsgIC8vIGRlZmF1bHQgaW5pdGlhbGl6ZQorICAgIGNvbnN0IGNoYXIqIGlucHV0RmlsZSA9IG51bGxwdHI7CisgICAgY29uc3QgY2hhciogb3V0cHV0RmlsZSA9IG51bGxwdHI7CisKKyAgICBjb25zdCBvcHRpb24gbG9uZ19vcHRzW10gPSB7CisgICAgICAgICAgICB7ImhlbHAiLCBub19hcmd1bWVudCwgbnVsbHB0ciwgQVJHX0hFTFB9LAorICAgICAgICAgICAgeyJpbnB1dCIsIHJlcXVpcmVkX2FyZ3VtZW50LCBudWxscHRyLCBBUkdfSU5QVVR9LAorICAgICAgICAgICAgeyJvdXRwdXQiLCByZXF1aXJlZF9hcmd1bWVudCwgbnVsbHB0ciwgQVJHX09VVFBVVH0sCisgICAgICAgICAgICB7ImZzIiwgcmVxdWlyZWRfYXJndW1lbnQsIG51bGxwdHIsIEFSR19GU30sCisgICAgICAgICAgICB7ImNoTWFzayIsIHJlcXVpcmVkX2FyZ3VtZW50LCBudWxscHRyLCBBUkdfQ0hfTUFTS30sCisgICAgICAgICAgICB7InByZXNldCIsIHJlcXVpcmVkX2FyZ3VtZW50LCBudWxscHRyLCBBUkdfUFJFU0VUfSwKKyAgICAgICAgICAgIHsiYXV4IiwgcmVxdWlyZWRfYXJndW1lbnQsIG51bGxwdHIsIEFSR19BVVh9LAorICAgICAgICAgICAgeyJNIiwgbm9fYXJndW1lbnQsICZyZXZDb25maWdQYXJhbXMubW9ub01vZGUsIHRydWV9LAorICAgICAgICAgICAgeyJmY2giLCByZXF1aXJlZF9hcmd1bWVudCwgbnVsbHB0ciwgQVJHX0ZJTEVfQ0h9LAorICAgICAgICAgICAge251bGxwdHIsIDAsIG51bGxwdHIsIDB9LAorICAgIH07CisKKyAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICBjb25zdCBpbnQgb3B0ID0gZ2V0b3B0X2xvbmcoYXJnYywgKGNoYXIqIGNvbnN0Kilhcmd2LCAiaTpvOiIsIGxvbmdfb3B0cywgbnVsbHB0cik7CisgICAgICAgIGlmIChvcHQgPT0gLTEpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIHN3aXRjaCAob3B0KSB7CisgICAgICAgICAgICBjYXNlIEFSR19IRUxQOgorICAgICAgICAgICAgICAgIHByaW50VXNhZ2UoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gRVhJVF9TVUNDRVNTOworICAgICAgICAgICAgY2FzZSBBUkdfSU5QVVQ6IHsKKyAgICAgICAgICAgICAgICBpbnB1dEZpbGUgPSAoY2hhciopb3B0YXJnOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfT1VUUFVUOiB7CisgICAgICAgICAgICAgICAgb3V0cHV0RmlsZSA9IChjaGFyKilvcHRhcmc7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEFSR19GUzogeworICAgICAgICAgICAgICAgIHJldkNvbmZpZ1BhcmFtcy5zYW1wbGVSYXRlID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfQ0hfTUFTSzogeworICAgICAgICAgICAgICAgIGludCBjaE1hc2tJZHggPSBhdG9pKG9wdGFyZyk7CisgICAgICAgICAgICAgICAgaWYgKGNoTWFza0lkeCA8IDAgb3IgY2hNYXNrSWR4ID4ga1JldmVyYkNvbmZpZ0NoTWFza0NvdW50KSB7CisgICAgICAgICAgICAgICAgICAgIEFMT0dFKCJDaGFubmVsIE1hc2sgaW5kZXggbm90IGluIGNvcnJlY3QgcmFuZ2VcbiIpOworICAgICAgICAgICAgICAgICAgICBwcmludFVzYWdlKCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldkNvbmZpZ1BhcmFtcy5jaE1hc2sgPSBrUmV2ZXJiQ29uZmlnQ2hNYXNrW2NoTWFza0lkeF07CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEFSR19QUkVTRVQ6IHsKKyAgICAgICAgICAgICAgICByZXZDb25maWdQYXJhbXMucHJlc2V0ID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfQVVYOiB7CisgICAgICAgICAgICAgICAgcmV2Q29uZmlnUGFyYW1zLmF1eGlsaWFyeSA9IGF0b2kob3B0YXJnKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgQVJHX01PTk9fTU9ERTogeworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfRklMRV9DSDogeworICAgICAgICAgICAgICAgIHJldkNvbmZpZ1BhcmFtcy5mQ2hhbm5lbHMgPSBhdG9pKG9wdGFyZyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCisgICAgaWYgKGlucHV0RmlsZSA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dFKCJFcnJvcjogbWlzc2luZyBpbnB1dCBmaWxlc1xuIik7CisgICAgICAgIHByaW50VXNhZ2UoKTsKKyAgICAgICAgcmV0dXJuIEVYSVRfRkFJTFVSRTsKKyAgICB9CisgICAgc3RkOjp1bmlxdWVfcHRyPEZJTEUsIGRlY2x0eXBlKCZmY2xvc2UpPiBpbnB1dEZwKGZvcGVuKGlucHV0RmlsZSwgInJiIiksICZmY2xvc2UpOworCisgICAgaWYgKGlucHV0RnAgPT0gbnVsbHB0cikgeworICAgICAgICBBTE9HRSgiQ2Fubm90IG9wZW4gaW5wdXQgZmlsZSAlc1xuIiwgaW5wdXRGaWxlKTsKKyAgICAgICAgcmV0dXJuIEVYSVRfRkFJTFVSRTsKKyAgICB9CisKKyAgICBpZiAob3V0cHV0RmlsZSA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dFKCJFcnJvcjogbWlzc2luZyBvdXRwdXQgZmlsZXNcbiIpOworICAgICAgICBwcmludFVzYWdlKCk7CisgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgfQorICAgIHN0ZDo6dW5pcXVlX3B0cjxGSUxFLCBkZWNsdHlwZSgmZmNsb3N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pbihyZWFkX3NhbXBsZXNfaW4sIHJlYWRfc2FtcGxlc19yZWYpOworICAgICAgICB9CisgICAgICAgIGlmIChyZWFkX3NhbXBsZXNfaW4gPT0gMCkgeworICAgICAgICAgICAgcmV0dXJuIHtzaWduYWwsIG5vaXNlfTsKKyAgICAgICAgfQorICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHJlYWRfc2FtcGxlc19pbjsgKytpKSB7CisgICAgICAgICAgICBjb25zdCBBIHZhbHVlKHJlZltpXSk7CisgICAgICAgICAgICBjb25zdCBBIGRpZmYoQShpbltpXSkgLSB2YWx1ZSk7CisgICAgICAgICAgICBzaWduYWwgKz0gdmFsdWUgKiB2YWx1ZTsKKyAgICAgICAgICAgIG5vaXNlICs9IGRpZmYgKiBkaWZmOworICAgICAgICB9CiAgICAgfQotICAgIGlmIChyZWFkX3NhbXBsZXNfaW4gPT0gMCkgewotICAgICAgICByZXR1cm4geyBzaWduYWwsIG5vaXNlIH07Ci0gICAgfQotICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgcmVhZF9zYW1wbGVzX2luOyArK2kpIHsKLSAgICAgICBjb25zdCBBIHZhbHVlKHJlZltpXSk7Ci0gICAgICAgY29uc3QgQSBkaWZmKEEoaW5baV0pIC0gdmFsdWUpOwotICAgICAgIHNpZ25hbCArPSB2YWx1ZSAqIHZhbHVlOwotICAgICAgIG5vaXNlICs9IGRpZmYgKiBkaWZmOwotICAgIH0KLSAgfQogfQogCiB2b2lkIHByaW50VXNhZ2UoKSB7Ci0gIHByaW50ZigiXG5Vc2FnZTogIik7Ci0gIHByaW50ZigiXG4gICAgIHNuciA8cmVmX2ZpbGU+IDx0ZXN0X2ZpbGU+IFtvcHRpb25zXVxuIik7Ci0gIHByaW50ZigiXG53aGVyZSwgXG4gICAgIDxyZWZfZmlsZT4gIGlzIHRoZSByZWZlcmVuY2UgZmlsZSBuYW1lIik7Ci0gIHByaW50ZigiXG4gICAgICAgICAgICAgICAgICBvbiB3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sKKyAgICAgICAgaWYgKCFzdHJuY21wKGFyZ3ZbaV0sICItcGNtX2Zvcm1hdDoiLCAxMikpIHsKKyAgICAgICAgICAgIHBjbV9mb3JtYXQgPSBhdG9pKGFyZ3ZbaV0gKyAxMik7CisgICAgICAgIH0gZWxzZSBpZiAoIXN0cm5jbXAoYXJndltpXSwgIi10aHI6IiwgNSkpIHsKKyAgICAgICAgICAgIHRociA9IGF0b2YoYXJndltpXSArIDUpOworICAgICAgICB9CiAgICAgfQotICB9Ci0gIGZjbG9zZShmaW5wKTsKLSAgZmNsb3NlKGZyZWYpOworICAgIGlmIChmaW5wID09IG51bGxwdHIgfHwgZnJlZiA9PSBudWxscHRyKSB7CisgICAgICAgIHByaW50ZigiXG5FcnJvcjogbWlzc2luZyBpbnB1dC9yZWZlcmVuY2UgZmlsZXNcbiIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIGludCByZXQgPSBFWElUX1NVQ0NFU1M7CisgICAgYXV0byBzbiA9CisgICAgICAgICAgICBwY21fZm9ybWF0ID09IDAgPyBnZXRTaWduYWxOb2lzZTxzaG9ydD4oZmlucCwgZnJlZikgOiBnZXRTaWduYWxOb2lzZTxmbG9hdD4oZmlucCwgZnJlZik7CisgICAgaWYgKHNuLmZpcnN0ID4gMC5mICYmIHNuLnNlY29uZCA+IDAuZikgeworICAgICAgICBmbG9hdCBzbnIgPSAxMC5mICogbG9nKHNuLmZpcnN0IC8gc24uc2Vjb25kKTsKKyAgICAgICAgLy8gY29tcGFyZSB0aGUgbWVhc3VyZWQgc25yIHZhbHVlIHdpdGggdGhyZXNob2xkCisgICAgICAgIGlmIChzbnIgPCB0aHIpIHsKKyAgICAgICAgICAgIHByaW50ZigiJS42ZiBsZXNzIHRoYW4gdGhyZXNob2xkICUuNmZcbiIsIHNuciwgdGhyKTsKKyAgICAgICAgICAgIHJldCA9IEVYSVRfRkFJTFVSRTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHByaW50Zigi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gICAgICAgICJOT1RJQ0UiLAorICAgIF0sCit9CisKK2NjX2xpYnJhcnkgewogICAgIG5hbWU6ICJsaWJidW5kbGV3cmFwcGVyIiwKIAogICAgIGFyY2g6IHsKQEAgLTksMTEgKzI4LDExIEBACiAgICAgfSwKIAogICAgIHZlbmRvcjogdHJ1ZSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKICAgICBzcmNzOiBbIkJ1bmRsZS9FZmZlY3RCdW5kbGUuY3BwIl0sCiAKICAgICBjcHBmbGFnczogWwogICAgICAgICAiLWZ2aXNpYmlsaXR5PWhpZGRlbiIsCi0gICAgICAgICItRFNVUFBPUlRfTUMiLAogCiAgICAgICAgICItV2FsbCIsCiAgICAgICAgICItV2Vycm9yIiwKQEAgLTI2LDcgKzQ1LDYgQEAKICAgICBzaGFyZWRfbGliczogWwogICAgICAgICAibGliYXVkaW91dGlscyIsCiAgICAgICAgICJsaWJjdXRpbHMiLAotICAgICAgICAibGliZGwiLAogICAgICAgICAibGlibG9nIiwKICAgICBdLAogCkBAIC0zOSw3ICs1Nyw3IEBACiB9CiAKIC8vIHJldmVyYiB3cmFwcGVyCi1jY19saWJyYXJ5X3NoYXJlZCB7CitjY19saWJyYXJ5IHsKICAgICBuYW1lOiAibGlicmV2ZXJid3JhcHBlciIsCiAKICAgICBhcmNoOiB7CkBAIC00OSw2ICs2Nyw3IEBACiAgICAgfSwKIAogICAgIHZlbmRvcjogdHJ1ZSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKICAgICBzcmNzOiBbIlJldmVyYi9FZmZlY3RSZXZlcmIuY3BwIl0sCiAKICAgICBjcHBmbGFnczogWwpAQCAtNjUsNyArODQsNiBAQAogICAgIHNoYXJlZF9saWJzOiBbCiAgICAgICAgICJsaWJhdWRpb3V0aWxzIiwKICAgICAgICAgImxpYmN1dGlscyIsCi0gICAgICAgICJsaWJkbCIsCiAgICAgICAgICJsaWJsb2ciLAogICAgIF0sCiAKZGlmZiAtLWd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1cykgPT0gTFZNX05VTExBRERSRVNTKXtcCi0gICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBQYXJhbWV0ZXIgZXJyb3IgLSAiXAotICAgICAgICAgICAgICAgICAgICAibnVsbCBwb2ludGVyIHJldHVybmVkIGJ5ICVzIGluICVzXG5cblxuXG4iLCBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7XAotICAgICAgICB9XAotICAgICAgICBpZiAoKEx2bVN0YXR1cykgPT0gTFZNX0FMSUdOTUVOVEVSUk9SKXtcCi0gICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBQYXJhbWV0ZXIgZXJyb3IgLSAiXAotICAgICAgICAgICAgICAgICAgICAiYmFkIGFsaWdubWVudCByZXR1cm5lZCBieSAlcyBpbiAlc1xuXG5cblxuIiwgY2FsbGluZ0Z1bmMsIGNhbGxlZEZ1bmMpO1wKLSAgICAgICAgfVwKLSAgICAgICAgaWYgKChMdm1TdGF0dXMpID09IExWTV9JTlZBTElETlVNU0FNUExFUyl7XAotICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIlwKLSAgICAgICAgICAgICAgICAgICAgImJhZCBudW1iZXIgb2Ygc2FtcGxlcyByZXR1cm5lZCBieSAlcyBpbiAlc1xuXG5cblxuIiwgY2FsbGluZ0Z1bmMsIGNhbGxlZEZ1bmMpO1wKLSAgICAgICAgfVwKLSAgICAgICAgaWYgKChMdm1TdGF0dXMpID09IExWTV9PVVRPRlJBTkdFKXtcCi0gICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBQYXJhbWV0ZXIgZXJyb3IgLSAiXAotICAgICAgICAgICAgICAgICAgICAib3V0IG9mIHJhbmdlIHJldHVybmVkIGJ5ICVzIGluICVzXG4iLCBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7XAotICAgICAgICB9XAorI2RlZmluZSBMVk1fRVJST1JfQ0hFQ0soTHZtU3RhdHVzLCBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYykgICAgICAgICAgICAgXAorICAgIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBpZiAoKEx2bVN0YXR1cykgPT0gTFZNX05VTExBRERSRVNTKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgIm51bGwgcG9pbnRlciByZXR1cm5lZCBieSAlcyBpbiAlc1xuXG5cblxuIiwgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgY2FsbGluZ0Z1bmMsIGNhbGxlZEZ1bmMpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBpZiAoKEx2bVN0YXR1cykgPT0gTFZNX0FMSUdOTUVOVEVSUk9SKSB7ICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgImJhZCBhbGlnbm1lbnQgcmV0dXJuZWQgYnkgJXMgaW4gJXNcblxuXG5cbiIsICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgY2FsbGluZ0Z1bmMsIGNhbGxlZEZ1bmMpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBpZiAoKEx2bVN0YXR1cykgPT0gTFZNX0lOVkFMSUROVU1TQU1QTEVTKSB7ICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgImJhZCBudW1iZXIgb2Ygc2FtcGxlcyByZXR1cm5lZCBieSAlcyBpbiAlc1xuXG5cblxuIiwgXAorICAgICAgICAgICAgICAgICAgY2FsbGluZ0Z1bmMsIGNhbGxlZEZ1bmMpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBpZiAoKEx2bVN0YXR1cykgPT0gTFZNX09VVE9GUkFOR0UpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgIm91dCBvZiByYW5nZSByZXR1cm5lZCBieSAlcyBpbiAlc1xuIiwgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgY2FsbGluZ0Z1bmMsIGNhbGxlZEZ1bmMpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgIH0KIAogLy8gTmFtZXNwYWNlcwpAQCAtNzQsMjAgKzgxLDIxIEBACiBpbnQgU2Vzc2lvbkluZGV4W0xWTV9NQVhfU0VTU0lPTlNdOwogCiAvKiBsb2NhbCBmdW5jdGlvbnMgKi8KLSNkZWZpbmUgQ0hFQ0tfQVJHKGNvbmQpIHsgICAgICAgICAgICAgICAgICAgICBcCi0gICAgaWYgKCEoY29uZCkpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBJbnZhbGlkIGFyZ3VtZW50OiAiI2NvbmQpOyAgICAgIFwKLSAgICAgICAgcmV0dXJuIC1FSU5WQUw7ICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotfQorI2RlZmluZSBDSEVDS19BUkcoY29uZCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIGlmICghKGNvbmQpKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogSW52YWxpZCBhcmd1bWVudDogIiAjY29uZCk7IFwKKyAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIH0KIAogLy8gTlhQIFNXIEJhc3NCb29zdCBVVUlECiBjb25zdCBlZmZlY3RfZGVzY3JpcHRvcl90IGdCYXNzQm9vc3REZXNjcmlwdG9yID0gewotICAgICAgICB7MHgwNjM0ZjIyMCwgMHhkZGQ0LCAweDExZGIsIDB4YTBmYywgeyAweDAwLCAweDAyLCAweGE1LCAweGQ1LCAweGM1LCAweDFiIH19LAotICAgICAgICB7MHg4NjMxZjMwMCwgMHg3MmUyLCAweDExZGYsIDB4YjU3ZSwgezB4MDAsIDB4MDIsIDB4YTUsIDB4ZDUsIDB4YzUsIDB4MWJ9fSwgLy8gdXVpZAorICAgICAgICB7MHgwNjM0ZjIyMCwgMHhkZGQ0LCAweDExZGIsIDB4YTBmYywgezB4MDAsIDB4MD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0ICAgICAgKHZvaWQpOwotaW50ICBMdm1CdW5kbGVfaW5pdCAgICAgICAgICAgIChFZmZlY3RDb250ZXh0ICpwQ29udGV4dCk7Ci1pbnQgIEx2bUVmZmVjdF9lbmFibGUgICAgICAgICAgKEVmZmVjdENvbnRleHQgKnBDb250ZXh0KTsKLWludCAgTHZtRWZmZWN0X2Rpc2FibGUgICAgICAgICAoRWZmZWN0Q29udGV4dCAqcENvbnRleHQpOwotdm9pZCBMdm1FZmZlY3RfZnJlZSAgICAgICAgICAgIChFZmZlY3RDb250ZXh0ICpwQ29udGV4dCk7Ci1pbnQgIEVmZmVjdF9zZXRDb25maWcgICAgICAgICAgKEVmZmVjdENvbnRleHQgKnBDb250ZXh0LCBlZmZlY3RfY29uZmlnX3QgKnBDb25maWcpOwotdm9pZCBFZmZlY3RfZ2V0Q29uZmlnICAgICAgICAgIChFZmZlY3RDb250ZXh0ICpwQ29udGV4dCwgZWZmZWN0X2NvbmZpZ190ICpwQ29uZmlnKTsKLWludCAgQmFzc0Jvb3N0X3NldFBhcmFtZXRlciAgICAoRWZmZWN0Q29udGV4dCAqcENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICAgICAgIHBhcmFtU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFBhcmFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICB2YWx1ZVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBWYWx1ZSk7Ci1pbnQgIEJhc3NCb29zdF9nZXRQYXJhbWV0ZXIgICAgKEVmZmVjdENvbnRleHQgKnBDb250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICBwYXJhbVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBQYXJhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAqcFZhbHVlU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFZhbHVlKTsKLWludCAgVmlydHVhbGl6ZXJfc2V0UGFyYW1ldGVyICAoRWZmZWN0Q29udGV4dCAqcENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICAgICAgIHBhcmFtU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFBhcmFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICB2YWx1ZVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBWYWx1ZSk7Ci1pbnQgIFZpcnR1YWxpemVyX2dldFBhcmFtZXRlciAgKEVmZmVjdENvbnRleHQgKnBDb250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICBwYXJhbVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBQYXJhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAqcFZhbHVlU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFZhbHVlKTsKLWludCAgRXF1YWxpemVyX3NldFBhcmFtZXRlciAgICAoRWZmZWN0Q29udGV4dCAqcENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICAgICAgIHBhcmFtU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFBhcmFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICB2YWx1ZVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBWYWx1ZSk7Ci1pbnQgIEVxdWFsaXplcl9nZXRQYXJhbWV0ZXIgICAgKEVmZmVjdENvbnRleHQgKnBDb250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICBwYXJhbVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBQYXJhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAqcFZhbHVlU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFZhbHVlKTsKLWludCAgVm9sdW1lX3NldFBhcmFtZXRlciAgICAgICAoRWZmZWN0Q29udGV4dCAqcENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICAgICAgIHBhcmFtU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFBhcmFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICB2YWx1ZVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBWYWx1ZSk7Ci1pbnQgIFZvbHVtZV9nZXRQYXJhbWV0ZXIgICAgICAgKEVmZmVjdENvbnRleHQgKnBDb250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICBwYXJhbVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBQYXJhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAqcFZhbHVlU2l6ZSwKLS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AgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgdmFsdWVTaXplLCB2b2lkKiBwVmFsdWUpOworaW50IFZpcnR1YWxpemVyX2dldFBhcmFtZXRlcihFZmZlY3RDb250ZXh0KiBwQ29udGV4dCwgdWludDMyX3QgcGFyYW1TaXplLCB2b2lkKiBwUGFyYW0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90KiBwVmFsdWVTaXplLCB2b2lkKiBwVmFsdWUpOworaW50IEVxdWFsaXplcl9zZXRQYXJhbWV0ZXIoRWZmZWN0Q29udGV4dCogcENvbnRleHQsIHVpbnQzMl90IHBhcmFtU2l6ZSwgdm9pZCogcFBhcmFtLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgdmFsdWVTaXplLCB2b2lkKiBwVmFsdWUpOworaW50IEVxdWFsaXplcl9nZXRQYXJhbWV0ZXIoRWZmZWN0Q29udGV4dCogcENvbnRleHQsIHVpbnQzMl90IHBhcmFtU2l6ZSwgdm9pZCogcFBhcmFtLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QqIHBWYWx1ZVNpemUsIHZvaWQqIHBWYWx1ZSk7CitpbnQgVm9sdW1lX3NldFBhcmFtZXRlcihFZmZlY3RDb250ZXh0KiBwQ29udGV4dCwgdWludDMyX3QgcGFyYW1TaXplLCB2b2lkKiBwUGFyYW0sCisgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCB2YWx1ZVNpemUsIHZvaWQqIHBWYWx1ZSk7CitpbnQgVm9sdW1lX2dldFBhcmFtZXRlcihFZmZlY3RDb250ZXh0KiBwQ29udGV4dCwgdWludDMyX3QgcGFyYW1TaXplLCB2b2lkKiBwUGFyYW0sCisgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCogcFZhbHVlU2l6ZSwgdm9pZCogcFZhbHVlKTsKK2ludCBFZmZlY3Rfc2V0RW5hYmxlZChFZmZlY3RDb250ZXh0KiBwQ29udGV4dCwgYm9vbCBlbmFibGVkKTsKIAogLyogRWZmZWN0IExpYnJhcnkgSW50ZXJmYWNlIEltcGxlbWVudGF0aW9uICovCiAKLWV4dGVybiAiQyIgaW50IEVmZmVjdENyZWF0ZShjb25zdCBlZmZlY3RfdXVpZF90ICp1dWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgICAgICAgICAgICAgc2Vzc2lvbklkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgICAgICAgICAgICAgaW9JZCBfX3VudXNlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBlZmZlY3RfaGFuZGxlX3QgICpwSGFuZGxlKXsKK2V4dGVybiAiQyIgaW50IEVmZmVjdENyZWF0ZShjb25zdCBlZmZlY3RfdXVpZF90KiB1dWlkLCBpbnQzMl90IHNlc3Npb25JZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IC8qIGlvSWQgX191bnVzZWQgKi8sIGVmZmVjdF9oYW5kbGVfdCogcEhhbmRsZSkgewogICAgIGludCByZXQgPSAwOwogICAgIGludCBzZXNzaW9uTm8gPSAtMTsKICAgICBpbnQgaTsKLSAgICBFZmZlY3RDb250ZXh0ICpwQ29udGV4dCA9IE5VTEw7CisgICAgRWZmZWN0Q29udGV4dCogcENvbnRleHQgPSBOVUxMOwogICAgIGJvb2wgbmV3QnVuZGxlID0gZmFsc2U7Ci0gICAgU2Vzc2lvbkNvbnRleHQgKnBTZXNzaW9uQ29udGV4dDsKKyAgICBTZXNzaW9uQ29udGV4dCogcFNlc3Npb25Db250ZXh0OwogCiAgICAgQUxPR1YoIlxuXHRFZmZlY3RDcmVhdGUgc3RhcnQgc2Vzc2lvbiAlZCIsIHNlc3Npb25JZCk7CiAKLSAgICBpZiAocEhhbmRsZSA9PSBOVUxMIHx8IHV1aWQgPT0gTlVMTCl7CisgICAgaWYgKHBIYW5kbGUgPT0gTlVMTCB8fCB1dWlkID09IE5VTEwpIHsKICAgIC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ChwU2Vzc2lvbkNvbnRleHQtPmJFcXVhbGl6ZXJJbnN0YW50aWF0ZWQgPT1MVk1fRkFMU0UpICYmCi0gICAgICAgICAgICAocFNlc3Npb25Db250ZXh0LT5iVmlydHVhbGl6ZXJJbnN0YW50aWF0ZWQ9PUxWTV9GQUxTRSkpCi0gICAgewotCisgICAgICAgIChwU2Vzc2lvbkNvbnRleHQtPmJWb2x1bWVJbnN0YW50aWF0ZWQgPT0gTFZNX0ZBTFNFKSAmJgorICAgICAgICAocFNlc3Npb25Db250ZXh0LT5iRXF1YWxpemVySW5zdGFudGlhdGVkID09IExWTV9GQUxTRSkgJiYKKyAgICAgICAgKHBTZXNzaW9uQ29udGV4dC0+YlZpcnR1YWxpemVySW5zdGFudGlhdGVkID09IExWTV9GQUxTRSkpIHsKICAgICAgICAgLy8gQ2xlYXIgdGhlIFNlc3Npb25JbmRleAotICAgICAgICBmb3IoaW50IGk9MDsgaTxMVk1fTUFYX1NFU1NJT05TOyBpKyspewotICAgICAgICAgICAgaWYoU2Vzc2lvbkluZGV4W2ldID09IHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPlNlc3Npb25JZCl7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTFZNX01BWF9TRVNTSU9OUzsgaSsrKSB7CisgICAgICAgICAgICBpZiAoU2Vzc2lvbkluZGV4W2ldID09IHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPlNlc3Npb25JZCkgewogICAgICAgICAgICAgICAgIFNlc3Npb25JbmRleFtpXSA9IExWTV9VTlVTRURfU0VTU0lPTjsKLSAgICAgICAgICAgICAgICBBTE9HVigiXHRFZmZlY3RSZWxlYXNlOiBDbGVhcmluZyBTZXNzaW9uSW5kZXggU2Vzc2lvbk5vICVkIGZvciBTZXNzaW9uSWQgJWRcbiIsCi0gICAgICAgICAgICAgICAgICAgICAgICBpLCBwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5TZXNzaW9uSWQpOworICAgICAgIC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ICAgICAgICAgICAgLyogSW5zdGFuY2UgcGFyYW1ldGVycyAqLwotICAgIExWTV9FUU5CX0JhbmREZWZfdCAgICAgIEJhbmREZWZzW01BWF9OVU1fQkFORFNdOyAgICAgICAgLyogRXF1YWxpc2VyIGJhbmQgZGVmaW5pdGlvbnMgKi8KLSAgICBMVk1fSGVhZHJvb21QYXJhbXNfdCAgICBIZWFkcm9vbVBhcmFtczsgICAgICAgICAgICAgICAgIC8qIEhlYWRyb29tIHBhcmFtZXRlcnMgKi8KLSAgICBMVk1fSGVhZHJvb21CYW5kRGVmX3QgICBIZWFkcm9vbUJhbmREZWZbTFZNX0hFQURST09NX01BWF9OQkFORFNdOwotICAgIExWTV9NZW1UYWJfdCAgICAgICAgICAgIE1lbVRhYjsgICAgICAgICAgICAgICAgICAgICAgICAgLyogTWVtb3J5IGFsbG9jYXRpb24gdGFibGUgKi8KLSAgICBib29sICAgICAgICAgICAgICAgICAgICBiTWFsbG9jRmFpbHVyZSA9IExWTV9GQUxTRTsKKyAgICBMVk1fUmV0dXJuU3RhdHVzX2VuIEx2bVN0YXR1cyA9IExWTV9TVUNDRVNTOyAvKiBGdW5jdGlvbiBjYWxsIHN0YXR1cyAqLworICAgIExWTV9Db250cm9sUGFyYW1zX3QgcGFyYW1zOyAgICAgICAgICAgICAgICAgIC8qIENvbnRyb2wgUGFyYW1ldGVycyAqLworICAgIExWTV9JbnN0UGFyYW1zX3QgSW5zdFBhcmFtczsgICAgICAgICAgICAgICAgIC8qIEluc3RhbmNlIHBhcmFtZXRlcnMgKi8KKyAgICBMVk1fRVFOQl9CYW5kRGVmX3QgQmFuZERlZnNbTUFYX05VTV9CQU5EU107ICAvKiBFcXVhbGlzZXIgYmFuZCBkZWZpbml0aW9ucyAqLworICAgIExWTV9IZWFkcm9vbVBhcmFtc190IEhlYWRyb29tUGFyYW1zOyAgICAgICAgIC8qIEhlYWRyb29tIHBhcmFtZXRlcnMgKi8KKyAgICBMVk1fSGVhZHJvb21CYW5kRGVm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AgIH0KICAgICAgICAgICAgIHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPndvcmtCdWZmZXIgPQotICAgICAgICAgICAgICAgICAgICAoZWZmZWN0X2J1ZmZlcl90ICopY2FsbG9jKGZyYW1lQ291bnQsIHNpemVvZihlZmZlY3RfYnVmZmVyX3QpICogTnJDaGFubmVscyk7CisgICAgICAgICAgICAgICAgICAgIChlZmZlY3RfYnVmZmVyX3QqKWNhbGxvYyhmcmFtZUNvdW50LCBzaXplb2YoZWZmZWN0X2J1ZmZlcl90KSAqIE5yQ2hhbm5lbHMpOwogICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPndvcmtCdWZmZXIgPT0gTlVMTCkgewogICAgICAgICAgICAgICAgIHJldHVybiAtRU5PTUVNOwogICAgICAgICAgICAgfQpAQCAtNzQ5LDcgKzY1NSw2IEBACiAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgIH0KIAotCiAgICAgLyogUHJvY2VzcyB0aGUgc2FtcGxlcyAqLwogICAgIEx2bVN0YXR1cyA9IExWTV9Qcm9jZXNzKHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPmhJbnN0YW5jZSwgLyogSW5zdGFuY2UgaGFuZGxlICovCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcEluLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBJbnB1dCBidWZmZXIgKi8KQEAgLTc1NywxNiArNjYyLDE1IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9VSU5UMTYpZnJhbWVDb3VudCwgICAgICAgICAgICAgICAvKiBOdW1iZXIgb2Ygc2FtcGxlcyB0byByZWFkICovCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBBdWRpbyBUaW1lICovCiAgICAgTFZNX0VSUk9SX0NIRUNLKEx2bVN0YXR1cywgIkxWTV9Qcm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1bmN0aW9uIGNhbGwgc3RhdHVzICovCi0gICAgTFZNX01lbVRhYl90ICAgICAgICAgICAgTWVtVGFiOwotCi0gICAgLyogRnJlZSB0aGUgYWxnb3JpdGhtIG1lbW9yeSAqLwotICAgIEx2bVN0YXR1cyA9IExWTV9HZXRNZW1vcnlUYWJsZShwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5oSW5zdGFuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZNZW1UYWIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExWTV9OVUxMKTsKLQotICAgIExWTV9FUlJPUl9DSEVDSyhMdm1TdGF0dXMsICJMVk1fR2V0TWVtb3J5VGFibGUiLCAiTHZtRWZmZWN0X2ZyZWUiKQotCi0gICAgZm9yIChpbnQgaT0wOyBpPExWTV9OUl9NRU1PUllfUkVHSU9OUzsgaSsrKXsKLSAgICAgICAgaWYgKE1lbVRhYi5SZWdpb25baV0uU2l6ZSAhPSAwKXsKLSAgICAgICAgICAgIGlmIChNZW1UYWIuUmVnaW9uW2ldLnBCYXNlQWRkcmVzcyAhPSBOVUxMKXsKLSAgICAgICAgICAgICAgICBmcmVlKE1lbVRhYi5SZWdpb25baV0ucEJhc2VBZGRyZXNzKTsKLSAgICAgICAgICAgIH1lbHNlewotICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IEx2bUVmZmVjdF9mcmVlIC0gdHJ5aW5nIHRvIGZyZWUgd2l0aCBOVUxMIHBvaW50ZXIgJSIgUFJJdTMyCi0gICAgICAgICAgICAgICAgICAgICAgICAiIGJ5dGVzIGZvciByZWdpb24gJXUgYXQgJXAgRVJST1JcbiIsCi0gICAgICAgICAgICAgICAgICAgICAgICBNZW1UYWIuUmVnaW9uW2ldLlNpemUsIGksIE1lbVRhYi5SZWdpb25baV0ucEJhc2VBZGRyZXNzKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLX0gICA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tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KIAotaW50IEJhc3NCb29zdF9nZXRQYXJhbWV0ZXIoRWZmZWN0Q29udGV4dCAqcENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICBwYXJhbVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICAgICpwUGFyYW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICpwVmFsdWVTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFZhbHVlKSB7CitpbnQgQmFzc0Jvb3N0X2dldFBhcmFtZXRlcihFZmZlY3RDb250ZXh0KiBwQ29udGV4dCwgdWludDMyX3QgcGFyYW1TaXplLCB2b2lkKiBwUGFyYW0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCogcFZhbHVlU2l6ZSwgdm9pZCogcFZhbHVlKSB7CiAgICAgaW50IHN0YXR1cyA9IDA7Ci0gICAgaW50MzJfdCAqcGFyYW1zID0gKGludDMyX3QgKilwUGFyYW07CisgICAgaW50MzJfdCogcGFyYW1zID0gKGludDMyX3QqKXBQYXJhbTsKIAogICAgIEFMT0dWVigiJXMgc3RhcnQiLCBfX2Z1bmNfXyk7CiAKQEAgLTIwNTUsMjggKzE4NjMsMjcgQEAKICAgICBzd2l0Y2ggKHBhcmFtc1swXSkgewogICAgICAgICBjYXNlIEJBU1NCT09TVF9QQVJBTV9TVFJFTkdUSF9TVVBQT1JURUQ6CiAgICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgIT0gc2l6ZW9mKHVpbnQzMl90KSkgeyAgLy8gbGVnYWN5OiBjaGVjayBlcXVhbGl0eSBoZXJlLgotICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBCQVNTQk9PU1RfUEFSQU1fU1RSRU5HVEhfU1VQUE9SVEVEIGludmFsaWQgKnBWYWx1ZVNpemUgJXUiLAotICAgICAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sICpwVmFsdWVTaXplKTsKKyAgICAgICAgICAgICAgICBBTE9HVigiJXMgQkFTU0JPT1NUX1BBUkFNX1NUUkVOR1RIX1NVUFBPUlRFRCBpbnZhbGlkICpwVmFsdWVTaXplICV1IiwgX19mdW5jX18sCisgICAgICAgICAgICAgICAgICAgICAgKnBWYWx1ZVNpemUpOwogICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAvLyBubyBuZWVkIHRvIHNldCAqcFZhbHVlU2l6ZQogCi0gICAgICAgICAgICAqKHVpbnQzMl90ICopcFZhbHVlID0gMTsKLSAgICAgICAgICAgIEFMT0dWVigiJXMgQkFTU0JPT1NUX1BBUkFNX1NUUkVOR1RIX1NVUFBPUlRFRCAldSIsIF9fZnVuY19fLCAqKHVpbnQzMl90ICopcFZhbHVlKTsKKyAgICAgICAgICAgICoodWludDMyX3QqKXBWYWx1ZSA9IDE7CisgICAgICAgICAgICBBTE9HVlYoIiVzIEJBU1NCT09TVF9QQVJBTV9TVFJFTkdUSF9TVVBQT1JURUQgJXUiLCBfX2Z1bmNfXywgKih1aW50MzJfdCopcFZhbHVlKTsKICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgIGNhc2UgQkFTU0JPT1NUX1BBUkFNX1NUUkVOR1RIOgogICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZihpbnQxNl90KSkgeyAgLy8gbGVnYWN5OiBjaGVjayBlcXVhbGl0eSBoZXJlLgotICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBCQVNTQk9PU1RfUEFSQU1fU1RSRU5HVEggaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgKnBWYWx1ZVNpemUpOworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBCQVNTQk9PU1RfUEFSQU1fU1RSRU5HVEggaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsIF9fZnVuY19fLCAqcFZhbHVlU2l6ZSk7CiAgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIC8vIG5vIG5lZWQgdG8gc2V0ICpwVmFsdWVTaXplCiAKLSAgICAgICAgICAgICooaW50MTZfdCAqKXBWYWx1ZSA9IEJhc3NHZXRTdHJlbmd0aChwQ29udGV4dCk7Ci0gICAgICAgICAgICBBTE9HVlYoIiVzIEJBU1NCT09TVF9QQVJBTV9TVFJFTkdUSCAlZCIsIF9fZnVuY19fLCAqKGludDE2X3QgKilwVmFsdWUpOworICAgICAgICAgICAgKihpbnQxNl90KilwVmFsdWUgPSBCYXNzR2V0U3RyZW5ndGgocENvbnRleHQpOworICAgICAgICAgICAgQUxPR1ZWKCIlcyBCQVNTQk9PU1RfUEFSQU1fU1RSRU5HVEggJWQiLCBfX2Z1bmNfXywgKihpbnQxNl90KilwVmFsdWUpOwogICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgZGVmYXVsdDoKQEAgLTIxMDQsMTMgKzE5MTEsMTAgQEAKIC8vCiAvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KIAotaW50IEJhc3NCb29zdF9zZXRQYXJhbWV0ZXIoRWZmZWN0Q29udGV4dCAqcENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICBwYXJhbVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICAgICpwUGFyYW0sCi0gICAgICAgICAgICAgICAg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S0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogCi1pbnQgVmlydHVhbGl6ZXJfZ2V0UGFyYW1ldGVyKEVmZmVjdENvbnRleHQgKnBDb250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICBwYXJhbVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBQYXJhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAqcFZhbHVlU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFZhbHVlKSB7CitpbnQgVmlydHVhbGl6ZXJfZ2V0UGFyYW1ldGVyKEVmZmVjdENvbnRleHQqIHBDb250ZXh0LCB1aW50MzJfdCBwYXJhbVNpemUsIHZvaWQqIHBQYXJhbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QqIHBWYWx1ZVNpemUsIHZvaWQqIHBWYWx1ZSkgewogICAgIGludCBzdGF0dXMgPSAwOwotICAgIGludDMyX3QgKnBhcmFtcyA9IChpbnQzMl90ICopcFBhcmFtOworICAgIGludDMyX3QqIHBhcmFtcyA9IChpbnQzMl90KilwUGFyYW07CiAKICAgICBBTE9HVlYoIiVzIHN0YXJ0IiwgX19mdW5jX18pOwogCkBAIC0yMTgwLDQ3ICsxOTgxLDQ3IEBACiAgICAgfQogICAgIHN3aXRjaCAocGFyYW1zWzBdKSB7CiAgICAgICAgIGNhc2UgVklSVFVBTElaRVJfUEFSQU1fU1RSRU5HVEhfU1VQUE9SVEVEOgotICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZih1aW50MzJfdCkpIHsgLy8gbGVnYWN5OiBjaGVjayBlcXVhbGl0eSBoZXJlLgotICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBWSVJUVUFMSVpFUl9QQVJBTV9TVFJFTkdUSF9TVVBQT1JURUQgaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgKnBWYWx1ZVNpemUpOworICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZih1aW50MzJfdCkpIHsgIC8vIGxlZ2FjeTogY2hlY2sgZXF1YWxpdHkgaGVyZS4KKyAgICAgICAgICAgICAgICBBTE9HVigiJXMgVklSVFVBTElaRVJfUEFSQU1fU1RSRU5HVEhfU1VQUE9SVEVEIGludmFsaWQgKnBWYWx1ZVNpemUgJXUiLCBfX2Z1bmNfXywKKyAgICAgICAgICAgICAgICAgICAgICAqcFZhbHVlU2l6ZSk7CiAgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIC8vIG5vIG5lZWQgdG8gc2V0ICpwVmFsdWVTaXplCiAKLSAgICAgICAgICAgICoodWludDMyX3QgKilwVmFsdWUgPSAxOwotICAgICAgICAgICAgQUxPR1ZWKCIlcyBWSVJUVUFMSVpFUl9QQVJBTV9TVFJFTkdUSF9TVVBQT1JURUQgJWQiLCBfX2Z1bmNfXywgKih1aW50MzJfdCAqKXBWYWx1ZSk7CisgICAgICAgICAgICAqKHVpbnQzMl90KilwVmFsdWUgPSAxOworICAgICAgICAgICAgQUxPR1ZWKCIlcyBWSVJUVUFMSVpFUl9QQVJBTV9TVFJFTkdUSF9TVVBQT1JURUQgJWQiLCBfX2Z1bmNfXywgKih1aW50MzJfdCopcFZhbHVlKTsKICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgIGNhc2UgVklSVFVBTElaRVJfUEFSQU1fU1RSRU5HVEg6Ci0gICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgIT0gc2l6ZW9mKGludDE2X3QpKSB7IC8vIGxlZ2FjeTogY2hlY2sgZXF1YWxpdHkgaGVyZS4KLSAgICAgICAgICAgICAgICBBTE9HVigiJXMgVklSVFVBTElaRVJfUEFSQU1fU1RSRU5HVEggaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgKnBWYWx1ZVNpemUpOworICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZihpbnQxNl90KSkgeyAgLy8gbGVnYWN5OiBjaGVjayBlcXVhbGl0eSBoZXJlLgorICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBWSVJUVUFMSVpFUl9QQVJBTV9TVFJFTkdUSCBpbnZhbGlkICpwVmFsdWVTaXplICV1IiwgX19mdW5jX18sCisgICAgICAgICAgICAgICAgICAgICAgKnBWYWx1ZVNpemUpOwogICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAvLyBubyBuZWVkIHRvIHNldCAqcFZhbHVlU2l6ZQogCi0gICAgICAgICAgICAqKGludDE2X3QgKilwVmFsdWUgPSBWaXJ0dWFsaXplckdldFN0cmVuZ3RoKHBDb250ZXh0KTsKKyAgICAgICAgICAgICooaW50MTZfdCopcFZhbHVlID0gVmlydHVhbGl6ZXJHZXRTdHJlbmd0aChwQ29udGV4dCk7CiAKLSAgICAgICAgICAgIEFMT0dWVigiJXMgVklSVFVBTElaRVJfUEFSQU1fU1RSRU5HVEggJWQiLCBfX2Z1bmNfXywgKihpbnQxNl90ICopcFZhbHVlKTsKKyAgICAgICAgICAgIEFMT0dWVigiJXMgVklSVFVBTElaRVJfUEFSQU1fU1RSRU5HVEggJWQiLCBfX2Z1bmNfXywgKihpbnQxNl90KilwVmFsdWUpOwogICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgY2FzZSBWSVJUVUFMSVpFUl9QQVJBTV9WSVJUVUFMX1NQRUFLRVJfQU5HTEVTOiB7CiAgICAgICAgICAgICBpZiAocGFyYW1TaXplIDwgMyAqIHNpemVvZihpbnQzMl90KSkgewotICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBWSVJUVUFMSVpFUl9QQVJBTV9TUEVBS0VSX0FOR0xFUyBpbnZhbGlkIHBhcmFtU2l6ZTogJXUiLAotICAgICAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sIHBhcmFtU2l6ZSk7CisgICAgICAgICAgICAgICAgQUxPR1YoIiVzIFZJUlRVQUxJWkVSX1BBUkFNX1NQRUFLRVJfQU5HTEVTIGludmFsaWQgcGFyYW1TaXplOiAldSIsIF9fZnVuY19fLAorICAgICAgICAgICAgICAgICAgICAgIHBhcmFtU2l6ZSk7CiAgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgY29uc3QgYXVkaW9fY2hhbm5lbF9tYXNrX3QgY2hhbm5lbE1hc2sgPSAoYXVkaW9fY2hhbm5lbF9tYXNrX3QpIHBhcmFtc1sxXTsKLSAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2RldmljZXNfdCBkZXZpY2VUeXBlID0gKGF1ZGlvX2RldmljZXNfdCkgcGFyYW1zWzJdOworICAgICAgICAgICAgY29uc3QgYXVkaW9fY2hhbm5lbF9tYXNrX3QgY2hhbm5lbE1hc2sgPSAoYXVkaW9fY2hhbm5lbF9tYXNrX3QpcGFyYW1zWzFdOworICAgICAgICAgICAgY29uc3QgYXVkaW9fZGV2aWNlc190IGRldmljZVR5cGUgPSAoYXVkaW9fZGV2aWNlc190KXBhcmFtc1syXTsKICAgICAgICAgICAgIGNvbnN0IHVpbnQzMl90IG5iQ2hhbm5lbHMgPSBhdWRpb19jaGFubmVsX2NvdW50X2Zyb21fb3V0X21hc2soY2hhbm5lbE1hc2spOwogICAgICAgICAgICAgY29uc3QgdWludDMyX3QgdmFsdWVTaXplUmVxdWlyZWQgPSAzICogbmJDaGFubmVscyAqIHNpemVvZihpbnQzMl90KTsKICAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSA8IHZhbHVlU2l6ZVJlcXVpcmVkKSB7Ci0gICAgICAgICAgICAgICAgQUxPR1YoIiVzIFZJUlRVQUxJWkVSX1BBUkFNX1NQRUFLRVJfQU5HTEVTIGludmFsaWQgKnBWYWx1ZVNpemUgJXUiLAotICAgICAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sICpwVmFsdWVTaXplKTsKKyAgICAgICAgICAgICAgICBBTE9HVigiJXMgVklSVFVBTElaRVJfUEFSQU1fU1BFQUtFUl9BTkdMRVMgaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsIF9fZnVuY19fLAorICAgICAgICAgICAgICAgICAgICAgICpwVmFsdWVTaXplKTsKICAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQpAQCAtMjIyOSwyMyArMjAzMCwyMyBAQAogICAgICAgICAgICAgLy8gdmVyaWZ5IHRoZSBjb25maWd1cmF0aW9uIGlzIHN1cHBvcnRlZAogICAgICAgICAgICAgc3RhdHVzID0gVmlydHVhbGl6ZXJJc0NvbmZpZ3VyYXRpb25TdXBwb3J0ZWQoY2hhbm5lbE1hc2ssIGRldmljZVR5cGUpOwogICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgQUxPR1YoIiVzIFZJUlRVQUxJWkVSX1BBUkFNX1ZJUlRVQUxfU1BFQUtFUl9BTkdMRVMgbWFzaz0weCV4IGRldmljZT0weCV4IiwKLSAgICAgICAgICAgICAgICAgICAgICAgIF9fZnVuY19fLCBjaGFubmVsTWFzaywgZGV2aWNlVHlwZSk7CisgICAgICAgICAgICAgICAgQUxPR1YoIiVzIFZJUlRVQUxJWkVSX1BBUkFNX1ZJUlRVQUxfU1BFQUtFUl9BTkdMRVMgbWFzaz0weCV4IGRldmljZT0weCV4IiwgX19mdW5jX18sCisgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbE1hc2ssIGRldmljZVR5cGUpOwogICAgICAgICAgICAgICAgIC8vIGNvbmZpZ3VyYXRpb24gaXMgc3VwcG9ydGVkLCBnZXQgdGhlIGFuZ2xlcwotICAgICAgICAgICAgICAgIFZpcnR1YWxpemVyR2V0U3BlYWtlckFuZ2xlcyhjaGFubmVsTWFzaywgZGV2aWNlVHlwZSwgKGludDMyX3QgKilwVmFsdWUpOworICAgICAgICAgICAgICAgIFZpcnR1YWxpemVyR2V0U3BlYWtlckFuZ2xlcyhjaGFubmVsTWFzaywgZGV2aWNlVHlwZSwgKGludDMyX3QqKXBWYWx1ZSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0gYnJlYWs7CiAKICAgICAgICAgY2FzZSBWSVJUVUFMSVpFUl9QQVJBTV9WSVJUVUFMSVpBVElPTl9NT0RFOgotICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZih1aW50MzJfdCkpIHsgLy8gbGVnYWN5OiBjaGVjayBlcXVhbGl0eSBoZXJlLgotICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBWSVJUVUFMSVpFUl9QQVJBTV9WSVJUVUFMSVpBVElPTl9NT0RFIGludmFsaWQgKnBWYWx1ZVNpemUgJXUiLAotICAgICAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sICpwVmFsdWVTaXplKTsKKyAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSAhPSBzaXplb2YodWludDMyX3QpKSB7ICAvLyBsZWdhY3k6IGNoZWNrIGVxdWFsaXR5IGhlcmUuCisgICAgICAgICAgICAgICAgQUxPR1YoIiVzIFZJUlRVQUxJWkVSX1BBUkFNX1ZJUlRVQUxJWkFUSU9OX01PREUgaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsIF9fZnVuY19fLAorICAgICAgICAgICAgICAgICAgICAgICpwVmFsdWVTaXplKTsKICAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgLy8gbm8gbmVlZCB0byBzZXQgKnBWYWx1ZVNpemUKIAotICAgICAgICAgICAgKih1aW50MzJfdCAqKXBWYWx1ZSA9ICh1aW50MzJfdCkgVmlydHVhbGl6ZXJHZXRWaXJ0dWFsaXphdGlvbk1vZGUocENvbnRleHQpOworICAgICAgICAgICAgKih1aW50MzJfdCopcFZhbHVlID0gKHVpbnQzMl90KVZpcnR1YWxpemVyR2V0VmlydHVhbGl6YXRpb25Nb2RlKHBDb250ZXh0KTsKICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgIGRlZmF1bHQ6CkBAIC0yMjczLDE3ICsyMDc0LDE0IEBACiAvLwogLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiAKLWludCBWaXJ0dWFsaXplcl9zZXRQYXJhbWV0ZXIoRWZmZWN0Q29udGV4dCAqcENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICAgICAgIHBhcmFtU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFBhcmFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICB2YWx1ZVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBWYWx1ZSkgeworaW50IFZpcnR1YWxpemVyX3NldFBhcmFtZXRlcihFZmZlY3RDb250ZXh0KiBwQ29udGV4dCwgdWludDMyX3QgcGFyYW1TaXplLCB2b2lkKiBwUGFyYW0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHZhbHVlU2l6ZSwgdm9pZ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AgICAgICAgY2FzZSBWSVJUVUFMSVpFUl9QQVJBTV9GT1JDRV9WSVJUVUFMSVpBVElPTl9NT0RFOiB7CiAgICAgICAgICAgICBpZiAodmFsdWVTaXplIDwgc2l6ZW9mKGludDMyX3QpKSB7CiAgICAgICAgICAgICAgICAgQUxPR1YoIiVzIFZJUlRVQUxJWkVSX1BBUkFNX0ZPUkNFX1ZJUlRVQUxJWkFUSU9OX01PREUgaW52YWxpZCB2YWx1ZVNpemU6ICV1IiwKLSAgICAgICAgICAgICAgICAgICAgICAgIF9fZnVuY19fLCB2YWx1ZVNpemUpOworICAgICAgICAgICAgICAgICAgICAgIF9fZnVuY19fLCB2YWx1ZVNpemUpOwogICAgICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiNjQ0NzgwMDMiKTsKICAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBjb25zdCBhdWRpb19kZXZpY2VzX3QgZGV2aWNlVHlwZSA9IChhdWRpb19kZXZpY2VzX3QpKihpbnQzMl90ICopcFZhbHVlOworICAgICAgICAgICAgY29uc3QgYXVkaW9fZGV2aWNlc190IGRldmljZVR5cGUgPSAoYXVkaW9fZGV2aWNlc190KSAqIChpbnQzMl90KilwVmFsdWU7CiAgICAgICAgICAgICBzdGF0dXMgPSBWaXJ0dWFsaXplckZvcmNlVmlydHVhbGl6YXRpb25Nb2RlKHBDb250ZXh0LCBkZXZpY2VUeXBlKTsKLSAgICAgICAgICAgIEFMT0dWVigiJXMgVklSVFVBTElaRVJfUEFSQU1fRk9SQ0VfVklSVFVBTElaQVRJT05fTU9ERSBkZXZpY2U9JSN4IHJlc3VsdD0lZCIsCi0gICAgICAgICAgICAgICAgICAgIF9fZnVuY19fLCBkZXZpY2VUeXBlLCBzdGF0dXMpOworICAgICAgICAgICAgQUxPR1ZWKCIlcyBWSVJUVUFMSVpFUl9QQVJBTV9GT1JDRV9WSVJUVUFMSVpBVElPTl9NT0RFIGRldmljZT0lI3ggcmVzdWx0PSVkIiwgX19mdW5jX18sCisgICAgICAgICAgICAgICAgICAgZGV2aWNlVHlwZSwgc3RhdHVzKTsKICAgICAgICAgfSBicmVhazsKIAogICAgICAgICBkZWZhdWx0OgpAQCAtMjM0NywxMyArMjE0NSwxMCBAQAogLy8gU2lkZSBFZmZlY3RzOgogLy8KIC8vLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQotaW50IEVxdWFsaXplcl9nZXRQYXJhbWV0ZXIoRWZmZWN0Q29udGV4dCAqcENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICBwYXJhbVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICAgICpwUGFyYW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICpwVmFsdWVTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFZhbHVlKSB7CitpbnQgRXF1YWxpemVyX2dldFBhcmFtZXRlcihFZmZlY3RDb250ZXh0KiBwQ29udGV4dCwgdWludDMyX3QgcGFyYW1TaXplLCB2b2lkKiBwUGFyYW0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCogcFZhbHVlU2l6ZSwgdm9pZCogcFZhbHVlKSB7CiAgICAgaW50IHN0YXR1cyA9IDA7Ci0gICAgaW50MzJfdCAqcGFyYW1zID0gKGludDMyX3QgKilwUGFyYW07CisgICAgaW50MzJfdCogcGFyYW1zID0gKGludDMyX3QqKXBQYXJhbTsKIAogICAgIEFMT0dWVigiJXMgc3RhcnQiLCBfX2Z1bmNfXyk7CiAKQEAgLTIzNjIsMjExICsyM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gICAgICAgc3RhdHVzID0gLUVJTlZBTDsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0gICAgICAgICpwVmFsdWVTaXplID0gc2l6ZW9mKGludDE2X3QpOwotCi0gICAgICAgIGNvbnN0IGludDMyX3QgYmFuZCA9IHBhcmFtc1sxXTsKLSAgICAgICAgaWYgKGJhbmQgPCAwIHx8IGJhbmQgPj0gRklWRUJBTkRfTlVNQkFORFMpIHsKLSAgICAgICAgICAgIGlmIChiYW5kIDwgMCkgewotICAgICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiMzI0Mzg1OTgiKTsKLSAgICAgICAgICAgICAgICBBTE9HVygiJXMgRVFfUEFSQU1fQkFORF9MRVZFTCBpbnZhbGlkIGJhbmQgJWQiLCBfX2Z1bmNfXywgYmFuZCk7CisgICAgICAgIGNhc2UgRVFfUEFSQU1fTlVNX0JBTkRTOgorICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplIDwgc2l6ZW9mKHVpbnQxNl90KSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9OVU1fQkFORFMgaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsIF9fZnVuY19fLCAqcFZhbHVlU2l6ZSk7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotICAgICAgICAqKGludDE2X3QgKilwVmFsdWUgPSAoaW50MTZfdClFcXVhbGl6ZXJHZXRCYW5kTGV2ZWwocENvbnRleHQsIGJhbmQpOwotICAgICAgICBBTE9HVlYoIiVzIEVRX1BBUkFNX0JBTkRfTEVWRUwgYmFuZCAlZCwgbGV2ZWwgJWQiLAotICAgICAgICAgICAgICAgIF9fZnVuY19fLCBiYW5kLCAqKGludDE2X3QgKilwVmFsdWUpOwotICAgIH0gYnJlYWs7CisgICAgICAgICAgICAqcFZhbHVlU2l6ZSA9IHNpemVvZih1aW50MTZfdCk7CiAKLSAgICBjYXNlIEVRX1BBUkFNX0xFVkVMX1JBTkdFOgotICAgICAgICBpZiAoKnBWYWx1ZVNpemUgPCAyICogc2l6ZW9mKGludDE2X3QpKSB7Ci0gICAgICAgICAgICBBTE9HVigiJXMgRVFfUEFSQU1fTEVWRUxfUkFOR0UgaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsIF9fZnVuY19fLCAqcFZhbHVlU2l6ZSk7Ci0gICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgKih1aW50MTZfdCopcFZhbHVlID0gKHVpbnQxNl90KUZJVkVCQU5EX05VTUJBTkRTOworICAgICAgICAgICAgQUxPR1ZWKCIlcyBFUV9QQVJBTV9OVU1fQkFORFMgJXUiLCBfX2Z1bmNfXywgKih1aW50MTZfdCopcFZhbHVlKTsKICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0gICAgICAgICpwVmFsdWVTaXplID0gMiAqIHNpemVvZihpbnQxNl90KTsKIAotICAgICAgICAqKGludDE2X3QgKilwVmFsdWUgPSAtMTUwMDsKLSAgICAgICAgKigoaW50MTZfdCAqKXBWYWx1ZSArIDEpID0gMTUwMDsKLSAgICAgICAgQUxPR1ZWKCIlcyBFUV9QQVJBTV9MRVZFTF9SQU5HRSBtaW4gJWQsIG1heCAlZCIsCi0gICAgICAgICAgICAgICAgX19mdW5jX18sICooaW50MTZfdCAqKXBWYWx1ZSwgKigoaW50MTZfdCAqKXBWYWx1ZSArIDEpKTsKLSAgICAgICAgYnJlYWs7Ci0KLSAgICBjYXNlIEVRX1BBUkFNX0JBTkRfRlJFUV9SQU5HRTogewotICAgICAgICBpZiAocGFyYW1TaXplIDwgMiAqIHNpemVvZihpbnQzMl90KSkgewotICAgICAgICAgICAgQUxPR1YoIiVz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SIsIF9fZnVuY19fLCAqcFZhbHVlU2l6ZSk7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotICAgICAgICBFcXVhbGl6ZXJHZXRCYW5kRnJlcVJhbmdlKHBDb250ZXh0LCBiYW5kLCAodWludDMyX3QgKilwVmFsdWUsICgodWludDMyX3QgKilwVmFsdWUgKyAxKSk7Ci0gICAgICAgIEFMT0dWVigiJXMgRVFfUEFSQU1fQkFORF9GUkVRX1JBTkdFIGJhbmQgJWQsIG1pbiAlZCwgbWF4ICVkIiwKLSAgICAgICAgICAgICAgICBfX2Z1bmNfXywgYmFuZCwgKihpbnQzMl90ICopcFZhbHVlLCAqKChpbnQzMl90ICopcFZhbHVlICsgMSkpOworICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSBzaXplb2YodWludDE2X3QpOwogCi0gICAgfSBicmVhazsKLQotICAgIGNhc2UgRVFfUEFSQU1fQ0VOVEVSX0ZSRVE6IHsKLSAgICAgICAgaWYgKHBhcmFtU2l6ZSA8IDIgKiBzaXplb2YoaW50MzJfdCkpIHsKLSAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9DRU5URVJfRlJFUSBpbnZhbGlkIHBhcmFtU2l6ZTogJXUiLCBfX2Z1bmNfXywgcGFyYW1TaXplKTsKLSAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CisgICAgICAgICAgICAqKHVpbnQxNl90KilwVmFsdWUgPSAodWludDE2X3QpRXF1YWxpemVyR2V0UHJlc2V0KHBDb250ZXh0KTsKKyAgICAgICAgICAgIEFMT0dWVigiJXMgRVFfUEFSQU1fQ1VSX1BSRVNFVCAldSIsIF9fZnVuY19fLCAqKHVpbnQxNl90KilwVmFsdWUpOwogICAgICAgICAgICAgYn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LSAgICAgICAgfQogCi0gICAgICAgIGNvbnN0IGludDMyX3QgcHJlc2V0ID0gcGFyYW1zWzFdOwotICAgICAgICBpZiAoKHByZXNldCA8IDAgJiYgcHJlc2V0ICE9IFBSRVNFVF9DVVNUT00pIHx8ICBwcmVzZXQgPj0gRXF1YWxpemVyR2V0TnVtUHJlc2V0cygpKSB7Ci0gICAgICAgICAgICBpZiAocHJlc2V0IDwgMCkgewotICAgICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiMzI0NDgyNTgiKTsKLSAgICAgICAgICAgICAgICBBTE9HRSgiJXMgRVFfUEFSQU1fR0VUX1BSRVNFVF9OQU1FIHByZXNldCAlZCIsIF9fZnVuY19fLCBwcmVzZXQpOworICAgICAgICBjYXNlIEVRX1BBUkFNX0dFVF9CQU5EOiB7CisgICAgICAgICAgICBpZiAocGFyYW1TaXplIDwgMiAqIHNpemVvZihpbnQzMl90KSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9HRVRfQkFORCBpbnZhbGlkIHBhcmFtU2l6ZTogJXUiLCBfX2Z1bmNfXywgcGFyYW1TaXplKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplIDwgc2l6ZW9mKHVpbnQxNl90KSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9HRVRfQkFORCBpbnZhbGlkICpwVmFsdWVTaXplICV1IiwgX19mdW5jX18sICpwVmFsdWVTaXplKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSBzaXplb2YodWludDE2X3QpOworCisgICAgICAgICAgICBjb25zdCBpbnQzMl90IGZyZXF1ZW5jeSA9IHBhcmFtc1sxXTsKKyAgICAgICAgICAgICoodWludDE2X3QqKXBWYWx1ZSA9ICh1aW50MTZfdClFcXVhbGl6ZXJHZXRCYW5kKHBDb250ZXh0LCBmcmVxdWVuY3kpOworICAgICAgICAgICAgQUxPR1ZWKCIlcyBFUV9QQVJBTV9HRVRfQkFORCBmcmVxdWVuY3kgJWQsIGJhbmQgJXUiLCBfX2Z1bmNfXywgZnJlcXVlbmN5LAorICAgICAgICAgICAgICAgICAgICoodWludDE2X3QqKXBWYWx1ZSk7CisgICAgICAgIH0gYnJlYWs7CisKKyAgICAgICAgY2FzZSBFUV9QQVJBTV9CQU5EX0xFVkVMOiB7CisgICAgICAgICAgICBpZiAocGFyYW1TaXplIDwgMiAqIHNpemVvZihpbnQzMl90KSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9CQU5EX0xFVkVMIGludmFsaWQgcGFyYW1TaXplICV1IiwgX19mdW5jX18sIHBhcmFtU2l6ZSk7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSA8IHNpemVvZihpbnQxNl90KSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9CQU5EX0xFVkVMIGludmFsaWQgKnBWYWx1ZVNpemUgJXUiLCBfX2Z1bmNfXywgKnBWYWx1ZVNpemUpOworICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAqcFZhbHVlU2l6ZSA9IHNpemVvZihpbnQxNl90KTsKKworICAgICAgICAgICAgY29uc3QgaW50MzJfdCBiYW5kID0gcGFyYW1zWzFdOworICAgICAgICAgICAgaWYgKGJhbmQgPCAwIHx8IGJhbmQgPj0gRklWRUJBTkRfTlVNQkFORFMpIHsKKyAgICAgICAgICAgICAgICBpZiAoYmFuZCA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIzMjQzODU5OCIpOworICAgICAgICAgICAgICAgICAgICBBTE9HVygiJXMgRVFfUEFSQU1fQkFORF9MRVZFTCBpbnZhbGlkIGJhbmQgJWQiLCBfX2Z1bmNfXywgYmFuZCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAqKGludDE2X3QqKXBWYWx1ZSA9IChpbnQxNl90KUVxdWFsaXplckdldEJhbmRMZXZlbChwQ29udGV4dCwgYmFuZCk7CisgICAgICAgICAgICBBTE9HVlYoIiVzIEVRX1BBUkFNX0JBTkRfTEVWRUwgYmFuZCAlZCwgbGV2ZWwgJWQiLCBfX2Z1bmNfXywgYmFuZCwgKihpbnQxNl90KilwVmFsdWUpOworICAgICAgICB9IGJyZWFrOworCisgICAgICAgIGNhc2UgRVFfUEFSQU1fTEVWRUxfUkFOR0U6CisgICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgPCAyICogc2l6ZW9mKGludDE2X3QpKSB7CisgICAgICAgICAgICAgICAgQUxPR1YoIiVzIEVRX1BBUkFNX0xFVkVMX1JBTkdFIGludmFsaWQgKnBWYWx1ZVNpemUgJXUiLCBfX2Z1bmNfXywgKnBWYWx1ZVNpemUpOworICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAqcFZhbHVlU2l6ZSA9IDIgKiBzaXplb2YoaW50MTZfdCk7CisKKyAgICAgICAgICAgICooaW50MTZfdCopcFZhbHVlID0gLTE1MDA7CisgICAgICAgICAgICAqKChpbnQxNl90KilwVmFsdWUgKyAxKSA9IDE1MDA7CisgICAgICAgICAgICBBTE9HVlYoIiVzIEVRX1BBUkFNX0xFVkVMX1JBTkdFIG1pbiAlZCwgbWF4ICVkIiwgX19mdW5jX18sICooaW50MTZfdCopcFZhbHVlLAorICAgICAgICAgICAgICAgICAgICooKGludDE2X3QqKXBWYWx1ZSArIDEpKTsKKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGNhc2UgRVFfUEFSQU1fQkFORF9GUkVRX1JBTkdFOiB7CisgICAgICAgICAgICBpZiAocGFyYW1TaXplIDwgMiAqIHNpemVvZihpbnQzMl90KSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9CQU5EX0ZSRVFfUkFOR0UgaW52YWxpZCBwYXJhbVNpemU6ICV1IiwgX19mdW5jX18sIHBhcmFtU2l6ZSk7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSA8IDIgKiBzaXplb2YoaW50MzJfdCkpIHsKKyAgICAgICAgICAgICAgICBBTE9HVigiJXMgRVFfUEFSQU1fQkFORF9GUkVRX1JBTkdFIGludmFsaWQgKnBWYWx1ZVNpemUgJXUiLCBfX2Z1bmNfXywgKnBWYWx1ZVNpemUpOworICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAqcFZhbHVlU2l6ZSA9IDIgKiBzaXplb2YoaW50MzJfdCk7CisKKyAgICAgICAgICAgIGNvbnN0IGludDMyX3QgYmFuZCA9IHBhcmFtc1sxXTsKKyAgICAgICAgICAgIGlmIChiYW5kIDwgMCB8fCBiYW5kID49IEZJVkVCQU5EX05VTUJBTkRTKSB7CisgICAgICAgICAgICAgICAgaWYgKGJhbmQgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiMzIyNDc5NDgiKTsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1coIiVzIEVRX1BBUkFNX0JBTkRfRlJFUV9SQU5HRSBpbnZhbGlkIGJhbmQgJWQiLCBfX2Z1bmNfXywgYmFuZCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFcXVhbGl6ZXJHZXRCYW5kRnJlcVJhbmdlKHBDb250ZXh0LCBiYW5kLCAodWludDMyX3QqKXBWYWx1ZSwgKCh1aW50MzJfdCopcFZhbHVlICsgMSkpOworICAgICAgICAgICAgQUxPR1ZWKCIlcyBFUV9QQVJBTV9CQU5EX0ZSRVFfUkFOR0UgYmFuZCAlZCwgbWluICVkLCBtYXggJWQiLCBfX2Z1bmNfXywgYmFuZCwKKyAgICAgICAgICAgICAgICAgICAqKGludDMyX3QqKXBWYWx1ZSwgKigoaW50MzJfdCopcFZhbHVlICsgMSkpOworCisgICAgICAgIH0gYnJlYWs7CisKKyAgICAgICAgY2FzZSBFUV9QQVJBTV9DRU5URVJfRlJFUTogeworICAgICAgICAgICAgaWYgKHBhcmFtU2l6ZSA8IDIgKiBzaXplb2YoaW50MzJfdCkpIHsKKyAgICAgICAgICAgICAgICBBTE9HVigiJXMgRVFfUEFSQU1fQ0VOVEVSX0ZSRVEgaW52YWxpZCBwYXJhbVNpemU6ICV1IiwgX19mdW5jX18sIHBhcmFtU2l6ZSk7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSA8IHNpemVvZihpbnQzMl90KSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9DRU5URVJfRlJFUSBpbnZhbGlkICpwVmFsdWVTaXplICV1IiwgX19mdW5jX18sICpwVmFsdWVTaXplKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSBzaXplb2YoaW50MzJfdCk7CisKKyAgICAgICAgICAgIGNvbnN0IGludDMyX3QgYmFuZCA9IHBhcmFtc1sxXTsKKyAgICAgICAgICAgIGlmIChiYW5kIDwgMCB8fCBiYW5kID49IEZJVkVCQU5EX05VTUJBTkRTKSB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgICAgICBpZiAoYmFuZCA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIzMjQzNjM0MSIpOworICAgICAgICAgICAgICAgICAgICBBTE9HVygiJXMgRVFfUEFSQU1fQ0VOVEVSX0ZSRVEgaW52YWxpZCBiYW5kICVkIiwgX19mdW5jX18sIGJhbmQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICooaW50MzJfdCopcFZhbHVlID0gRXF1YWxpemVyR2V0Q2VudHJlRnJlcXVlbmN5KHBDb250ZXh0LCBiYW5kKTsKKyAgICAgICAgICAgIEFMT0dWVigiJXMgRVFfUEFSQU1fQ0VOVEVSX0ZSRVEgYmFuZCAlZCwgZnJlcXVlbmN5ICVkIiwgX19mdW5jX18sIGJhbmQsCisgICAgICAgICAgICAgICAgICAgKihpbnQzMl90KilwVmFsdWUpOworICAgICAgICB9IGJyZWFrOworCisgICAgICAgIGNhc2UgRVFfUEFSQU1fR0VUX1BSRVNFVF9OQU1FOiB7CisgICAgICAgICAgICBpZiAocGFyYW1TaXplIDwgMiAqIHNpemVvZihpbnQzMl90KSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9QUkVTRVRfTkFNRSBpbnZhbGlkIHBhcmFtU2l6ZTogJXUiLCBfX2Z1bmNfXywgcGFyYW1TaXplKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplIDwgMSkgeworICAgICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiMzc1MzY0MDciKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBjb25zdCBpbnQzMl90IHByZXNldCA9IHBhcmFtc1sxXTsKKyAgICAgICAgICAgIGlmICgocHJlc2V0IDwgMCAmJiBwcmVzZXQgIT0gUFJFU0VUX0NVU1RPTSkgfHwgcHJlc2V0ID49IEVxdWFsaXplckdldE51bVByZXNldHMoKSkgeworICAgICAgICAgICAgICAgIGlmIChwcmVzZXQgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiMzI0NDgyNTgiKTsKKyAgICAgICAgICAgICAgICAgICAgQUxPR0UoIiVzIEVRX1BBUkFNX0dFVF9QUkVTRVRfTkFNRSBwcmVzZXQgJWQiLCBfX2Z1bmNfXywgcHJlc2V0KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgY2hhciogY29uc3QgbmFtZSA9IChjaGFyKilwVmFsdWU7CisgICAgICAgICAgICBzdHJuY3B5KG5hbWUsIEVxdWFsaXplckdldFByZXNldE5hbWUocHJlc2V0KSwgKnBWYWx1ZVNpemUgLSAxKTsKKyAgICAgICAgICAgIG5hbWVbKnBWYWx1ZVNpemUgLSAxXSA9IDA7CisgICAgICAgICAgICAqcFZhbHVlU2l6ZSA9IHN0cmxlbihuYW1lKSArIDE7CisgICAgICAgICAgICBBTE9HVlYoIiVzIEVRX1BBUkFNX0dFVF9QUkVTRVRfTkFNRSBwcmVzZXQgJWQsIG5hbWUgJXMgbGVuICVkIiwgX19mdW5jX18sIHByZXNldCwgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAqcFZhbHVlU2l6ZSk7CisKKyAgICAgICAgfSBicmVhazsKKworICAgICAgICBjYXNlIEVRX1BBUkFNX1BST1BFUlRJRVM6IHsKKyAgICAgICAgICAgIGNvbnN0ZXhwciB1aW50MzJfdCByZXF1aXJlZFZhbHVlU2l6ZSA9ICgyICsgRklWRUJBTkRfTlVNQkFORFMpICogc2l6ZW9mKHVpbnQxNl90KTsKKyAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSA8IHJlcXVpcmVkVmFsdWVTaXplKSB7CisgICAgICAgICAgICAgICAgQUxPR1YoIiVzIEVRX1BBUkFNX1BST1BFUlRJRVMgaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsIF9fZnVuY19fLCAqcFZhbHVlU2l6ZSk7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICpwVmFsdWVTaXplID0gcmVxdWlyZWRWYWx1ZVNpemU7CisKKyAgICAgICAgICAgIGludDE2X3QqIHAgPSAoaW50MTZfdCopcFZhbHVlOworICAgICAgICAgICAgQUxPR1YoIiVzIEVRX1BBUkFNX1BST1BFUlRJRVMiLCBfX2Z1bmNfXyk7CisgICAgICAgICAgICBwWzBdID0gKGludDE2X3QpRXF1YWxpemVyR2V0UHJlc2V0KHBDb250ZXh0KTsKKyAgICAgICAgICAgIHBbMV0gPSAoaW50MTZfdClGSVZFQkFORF9OVU1CQU5EUzsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgRklWRUJBTkRfTlVNQkFORFM7IGkrKykgeworICAgICAgICAgICAgICAgIHBbMiArIGldID0gKGludDE2X3QpRXF1YWxpemVyR2V0QmFuZExldmVsKHBDb250ZXh0LCBpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBicmVhazsKKworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgQUxPR1YoIiVzIGludmFsaWQgcGFyYW0gJWQiLCBfX2Z1bmNfXywgcGFyYW1zWzBdKTsKICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CiAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotCi0gICAgICAgIGNoYXIgKiBjb25zdCBuYW1lID0gKGNoYXIgKilwVmFsdWU7Ci0gICAgICAgIHN0cm5jcHkobmFtZSwgRXF1YWxpemVyR2V0UHJlc2V0TmFtZShwcmVzZXQpLCAqcFZhbHVlU2l6ZSAtIDEpOwotICAgICAgICBuYW1lWypwVmFsdWVTaXplIC0gMV0gPSAwOwotICAgICAgICAqcFZhbHVlU2l6ZSA9IHN0cmxlbihuYW1lKSArIDE7Ci0gICAgICAgIEFMT0dWVigiJXMgRVFfUEFSQU1fR0VUX1BSRVNFVF9OQU1FIHByZXNldCAlZCwgbmFtZSAlcyBsZW4gJWQiLAotICAgICAgICAgICAgICAgX19mdW5jX18sIHByZXNldCwgbmFtZSwgKnBWYWx1ZVNpemUpOwotCi0gICAgfSBicmVhazsKLQotICAgIGNhc2UgRVFfUEFSQU1fUFJPUEVSVElFUzogewotICAgICAgICBjb25zdGV4cHIgdWludDMyX3QgcmVxdWlyZWRWYWx1ZVNpemUgPSAoMiArIEZJVkVCQU5EX05VTUJBTkRTKSAqIHNpemVvZih1aW50MTZfdCk7Ci0gICAgICAgIGlmICgqcFZhbHV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S0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQotaW50IEVxdWFsaXplcl9zZXRQYXJhbWV0ZXIoRWZmZWN0Q29udGV4dCAqcENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICBwYXJhbVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICAgICpwUGFyYW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICB2YWx1ZVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICAgICpwVmFsdWUpIHsKK2ludCBFcXVhbGl6ZXJfc2V0UGFyYW1ldGVyKEVmZmVjdENvbnRleHQqIHBDb250ZXh0LCB1aW50MzJfdCBwYXJhbVNpemUsIHZvaWQqIHBQYXJhbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHZhbHVlU2l6ZSwgdm9pZCogcFZhbHVlKSB7CiAgICAgaW50IHN0YXR1cyA9IDA7Ci0gICAgaW50MzJfdCAqcGFyYW1zID0gKGludDMyX3QgKilwUGFyYW07CisgICAgaW50MzJfdCogcGFyYW1zID0gKGludDMyX3QqKXBQYXJhbTsKIAogICAgIEFMT0dWVigiJXMgc3RhcnQiLCBfX2Z1bmNfXyk7CiAKQEAgLTI2MDQsODcgKzIzOTUsODcgQEAKICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgfQogICAgIHN3aXRjaCAocGFyYW1zWzBdKSB7Ci0gICAgY2FzZSBFUV9QQVJBTV9DVVJfUFJFU0VUOiB7Ci0gICAgICAgIGlmICh2YWx1ZVNpemUgPCBzaXplb2YoaW50MTZfdCkpIHsKLSAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9DVVJfUFJFU0VUIGludmFsaWQgdmFsdWVTaXplICV1IiwgX19mdW5jX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NpemUpOwotICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0gICAgICAgIGludDE2X3QgKnAgPSAoaW50MTZfdCAqKXBWYWx1ZTsKLSAgICAgICAgaWYgKChpbnQpcFswXSA+PSBFcXVhbGl6ZXJHZXROdW1QcmVzZXRzKCkpIHsKLSAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9QUk9QRVJUSUVTIGludmFsaWQgcHJlc2V0ICVkIiwgX19mdW5jX18sIChpbnQpcFswXSk7Ci0gICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKHBbMF0gPj0gMCkgewotICAgICAgICAgICAgRXF1YWxpemVyU2V0UHJlc2V0KHBDb250ZXh0LCAoaW50KXBbMF0pOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgY29uc3RleHByIHVpbnQzMl90IHZhbHVlU2l6ZVJlcXVpcmVkID0gKDIgKyBGSVZFQkFORF9OVU1CQU5EUykgKiBzaXplb2YoaW50MTZfdCk7Ci0gICAgICAgICAgICBpZiAodmFsdWVTaXplIDwgdmFsdWVTaXplUmVxdWlyZWQpIHsKLSAgICAgICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIzNzU2MzM3MSIpOwotICAgICAgICAgICAgICBBTE9HRSgiJXMgRVFfUEFSQU1fUFJPUEVSVElFUyBpbnZhbGlkIHZhbHVlU2l6ZSAldSA8ICV1IiwKLSAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgdmFsdWVTaXplLCB2YWx1ZVNpemVSZXF1aXJlZCk7Ci0gICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7Ci0gICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKChpbnQpcFsxXSAhPSBGSVZFQkFORF9OVU1CQU5EUykgewotICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9QUk9QRVJUSUVTIGludmFsaWQgYmFuZHMgJWQiLCBfX2Z1bmNfXywgKGludClwWzFdKTsKKyAgICAgICAgY2FzZSBFUV9QQVJBTV9DVVJfUFJFU0VUOiB7CisgICAgICAgICAgICBpZiAodmFsdWVTaXplIDwgc2l6ZW9mKGludDE2X3QpKSB7CisgICAgICAgICAgICAgICAgQUxPR1YoIiVzIEVRX1BBUkFNX0NVUl9QUkVTRVQgaW52YWxpZCB2YWx1ZVNpemUgJXUiLCBfX2Z1bmNfXywgdmFsdWVTaXplKTsKICAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBGSVZFQkFORF9OVU1CQU5EUzsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgRXF1YWxpemVyU2V0QmFuZExldmVsKHBDb250ZXh0LCBpLCAoaW50KXBbMiArIGldKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0gYnJlYWs7CisgICAgICAgICAgICBjb25zdCBpbnQzMl90IHByZXNldCA9IChpbnQzMl90KSAqICh1aW50MTZfdCopcFZhbHVlOwogCi0gICAgZGVmYXVsdDoKLSAgICAgICAgQUxPR1YoIiVzIGludmFsaWQgcGFyYW0gJWQiLCBfX2Z1bmNfXywgcGFyYW1zWzBdKTsKLSAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKLSAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBBTE9HVlYoIiVzIEVRX1BBUkFNX0NVUl9QUkVTRVQgJWQiLCBfX2Z1bmNfXywgcHJlc2V0KTsKKyAgICAgICAgICAgIGlmIChwcmVzZXQgPj0gRXF1YWxpemVyR2V0TnVtUHJlc2V0cygpIHx8IHByZXNldCA8IDApIHsKKyAgICAgICAgICAgICAgICBBTE9HVigiJXMgRVFfUEFSQU1fQ1VSX1BSRVNFVCBpbnZhbGlkIHByZXNldCAlZCIsIF9fZnVuY19fLCBwcmVzZXQpOworICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFcXVhbGl6ZXJTZXRQcmVzZXQocENvbnRleHQsIHByZXNldCk7CisgICAgICAgIH0gYnJlYWs7CisKKyAgICAgICAgY2FzZSBFUV9QQVJBTV9CQU5EX0xFVkVMOiB7CisgICAgICAgICAgICBpZiAocGFyYW1TaXplIDwgMiAqIHNpemVvZihpbnQzMl90KSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBFUV9QQVJBTV9CQU5EX0xFVkVMIGludmFsaWQgcGFyYW1TaXplOiAldSIsIF9fZnVuY19fLCBwYXJhbVNpemUpOworICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAodmFsdWVTaXplIDwgc2l6ZW9mKGludDE2X3QpKSB7CisgICAgICAgICAgICAgICAgQUxPR1YoIiVzIEVRX1BBUkFNX0JBTkRfTEVWRUwgaW52YWxpZCB2YWx1ZVNpemUgJXUiLCBfX2Z1bmNfXywgdmFsdWVTaXplKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY29uc3QgaW50MzJfdCBiYW5kID0gcGFyYW1zWzFdOworICAgICAgICAgICAgY29uc3QgaW50MzJfdCBsZXZlbCA9IChpbnQzMl90KSAqIChpbnQxNl90KilwVmFsdWU7CisgICAgICAgICAgICBBTE9HVlYoIiVzIEVRX1BBUkFNX0JBTkRfTEVWRUwgYmFuZCAlZCwgbGV2ZWwgJWQiLCBfX2Z1bmNfXywgYmFuZCwgbGV2ZWwpOworICAgICAgICAgICAgaWYgKGJhbmQgPCAwIHx8IGJhbmQgPj0gRklWRUJBTkRfTlVNQkFORFMpIHsKKyAgICAgICAgICAgICAgICBpZiAoYmFuZCA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIzMjA5NTYyNiIpOworICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXMgRVFfUEFSQU1fQkFORF9MRVZFTCBpbnZhbGlkIGJhbmQgJWQiLCBfX2Z1bmNfXywgYmFuZCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFcXVhbGl6ZXJTZXRCYW5kTGV2ZWwocENvbnRleHQsIGJhbmQsIGxldmVsKTsKKyAgICAgICAgfSBicmVhazsKKworICAgICAgICBjYXNlIEVRX1BBUkFNX1BST1BFUlRJRVM6IHsKKyAgICAgICAgICAgIEFMT0dWVigiJXMgRVFfUEFSQU1fUFJPUEVSVElFUyIsIF9fZnVuY19fKTsKKyAgICAgICAgICAgIGlmICh2YWx1ZVNpemUgPCBzaXplb2YoaW50MTZfdCkpIHsKKyAgICAgICAgICAgICAgICBBTE9HVigiJXMgRVFfUEFSQU1fUFJPUEVSVElFUyBpbnZhbGlkIHZhbHVlU2l6ZSAldSIsIF9fZnVuY19fLCB2YWx1ZVNpemUpOworICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpbnQxNl90KiBwID0gKGludDE2X3QqKXBWYWx1ZTsKKyAgICAgICAgICAgIGlmICgoaW50KXBbMF0gPj0gRXF1YWxpemVyR2V0TnVtUHJlc2V0cygpKSB7CisgICAgICAgICAgICAgICAgQUxPR1YoIiVzIEVRX1BBUkFNX1BST1BFUlRJRVMgaW52YWxpZCBwcmVzZXQgJWQiLCBfX2Z1bmNfXywgKGludClwWzBdKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHBbMF0gPj0gMCkgeworICAgICAgICAgICAgICAgIEVxdWFsaXplclNldFByZXNldChwQ29udGV4dCwgKGludClwWzBdKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgY29uc3RleHByIHVpbnQzMl90IHZhbHVlU2l6ZVJlcXVpcmVkID0gKDIgKyBGSVZFQkFORF9OVU1CQU5EUykgKiBzaXplb2YoaW50MTZfdCk7CisgICAgICAgICAgICAgICAgaWYgKHZhbHVlU2l6ZSA8IHZhbHVlU2l6ZVJlcXVpcmVkKSB7CisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiMzc1NjMzNzEiKTsKKyAgICAgICAgICAgICAgICAgICAgQUxPR0UoIiVzIEVRX1BBUkFNX1BST1BFUlRJRVMgaW52YWxpZCB2YWx1ZVNpemUgJXUgPCAldSIsIF9fZnVuY19fLCB2YWx1ZVNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlU2l6ZVJlcXVpcmVkKTsKKyAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmICgoaW50KXBbMV0gIT0gRklWRUJBTkRfTlVNQkFORFMpIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoIiVzIEVRX1BBUkFNX1BST1BFUlRJRVMgaW52YWxpZCBiYW5kcyAlZCIsIF9fZnVuY19fLCAoaW50KXBbMV0pOworICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBGSVZFQkFORF9OVU1CQU5EUzsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIEVxdWFsaXplclNldEJhbmRMZXZlbChwQ29udGV4dCwgaSwgKGludClwWzIgKyBpXSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9IGJyZWFrOworCisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBBTE9HVigiJXMgaW52YWxpZCBwYXJhbSAlZCIsIF9fZnVuY19fLCBwYXJhbXNbMF0pOworICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgIGJyZWFrOwogICAgIH0KIAogICAgIEFMT0dWVigiJXMgZW5kIHBhcmFtOiAlZCwgc3RhdHVzOiAlZCIsIF9fZnVuY19fLCBwYXJhbXNbMF0sIHN0YXR1cyk7CkBAIC0yNzEyLDEzICsyNTAzLDEwIEBACiAvLwogLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiAKLWludCBWb2x1bWVfZ2V0UGFyYW1ldGVyKEVmZmVjdENvbnRleHQgKnBDb250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAgcGFyYW1TaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAqcFBhcmFtLAotICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAqcFZhbHVlU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBWYWx1ZSkgeworaW50IFZvbHVtZV9nZXRQYXJhbWV0ZXIoRWZmZWN0Q29udGV4dCogcENvbnRleHQsIHVpbnQzMl90IHBhcmFtU2l6ZSwgdm9pZCogcFBhcmFtLAorICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QqIHBWYWx1ZVNpemUsIHZvaWQqIHBWYWx1ZSkgewogICAgIGludCBzdGF0dXMgPSAwOwotICAgIGludDMyX3QgKnBhcmFtcyA9IChpbnQzMl90ICopcFBhcmFtOworICAgIGludDMyX3QqIHBhcmFtcyA9IChpbnQzMl90KilwUGFyYW07CiAKICAgICBBTE9HVlYoIiVzIHN0YXJ0IiwgX19mdW5jX18pOwogCkBAIC0yNzI4LDE5ICsyNTE2LDE5IEBACiAgICAgfQogICAgIHN3aXRjaCAocGFyYW1zWzBdKSB7CiAgICAgICAgIGNhc2UgVk9MVU1FX1BBUkFNX0xFVkVMOgotICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZihpbnQxNl90KSkgeyAvLyBsZWdhY3k6IGNoZWNrIGVxdWFsaXR5IGhlcmUuCisgICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgIT0gc2l6ZW9mKGludDE2X3QpKSB7ICAvLyBsZWdhY3k6IGNoZWNrIGVxdWFsaXR5IGhlcmUuCiAgICAgICAgICAgICAgICAgQUxPR1YoIiVzIFZPTFVNRV9QQVJBTV9MRVZFTCBpbnZhbGlkICpwVmFsdWVTaXplICV1IiwgX19mdW5jX18sICpwVmFsdWVTaXplKTsKICAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgLy8gbm8gbmVlZCB0byBzZXQgKnBWYWx1ZVNpemUKIAotICAgICAgICAgICAgc3RhdHVzID0gVm9sdW1lR2V0Vm9sdW1lTGV2ZWwocENvbnRleHQsIChpbnQxNl90ICopKHBWYWx1ZSkpOwotICAgICAgICAgICAgQUxPR1ZWKCIlcyBWT0xVTUVfUEFSQU1fTEVWRUwgJWQi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zIFZPTFVNRV9QQVJBTV9NQVhMRVZFTCAlZCIsIF9fZnVuY19fLCAqKGludDE2X3QqKXBWYWx1ZSk7CiAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIFZPTFVNRV9QQVJBTV9TVEVSRU9QT1NJVElPTjoKLSAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSAhPSBzaXplb2YoaW50MTZfdCkpIHsgLy8gbGVnYWN5OiBjaGVjayBlcXVhbGl0eSBoZXJlLgotICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBWT0xVTUVfUEFSQU1fU1RFUkVPUE9TSVRJT04gaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgKnBWYWx1ZVNpemUpOworICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZihpbnQxNl90KSkgeyAgLy8gbGVnYWN5OiBjaGVjayBlcXVhbGl0eSBoZXJlLgorICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBWT0xVTUVfUEFSQU1fU1RFUkVPUE9TSVRJT04gaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsIF9fZnVuY19fLAorICAgICAgICAgICAgICAgICAgICAgICpwVmFsdWVTaXplKTsKICAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgLy8gbm8gbmVlZCB0byBzZXQgKnBWYWx1ZVNpemUKIAotICAgICAgICAgICAgVm9sdW1lR2V0U3RlcmVvUG9zaXRpb24ocENvbnRleHQsIChpbnQxNl90ICopcFZhbHVlKTsKLSAgICAgICAgICAgIEFMT0dWVigiJXMgVk9MVU1FX1BBUkFNX1NURVJFT1BPU0lUSU9OICVkIiwgX19mdW5jX18sICooaW50MTZfdCAqKXBWYWx1ZSk7CisgICAgICAgICAgICBWb2x1bWVHZXRTdGVyZW9Qb3NpdGlvbihwQ29udGV4dCwgKGludDE2X3QqKXBWYWx1ZSk7CisgICAgICAgICAgICBBTE9HVlYoIiVzIFZPTFVNRV9QQVJBTV9TVEVSRU9QT1NJVElPTiAlZCIsIF9fZnVuY19fLCAqKGludDE2X3QqKXBWYWx1ZSk7CiAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIFZPTFVNRV9QQVJBTV9NVVRFOgpAQCAtMjc3MywyMSArMjU2MSwyMSBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSBzaXplb2YodWludDMyX3QpOwogCi0gICAgICAgICAgICBzdGF0dXMgPSBWb2x1bWVHZXRNdXRlKHBDb250ZXh0LCAodWludDMyX3QgKilwVmFsdWUpOwotICAgICAgICAgICAgQUxPR1YoIiVzIFZPTFVNRV9QQVJBTV9NVVRFICV1IiwgX19mdW5jX18sICoodWludDMyX3QgKilwVmFsdWUpOworICAgICAgICAgICAgc3RhdHVzID0gVm9sdW1lR2V0TXV0ZShwQ29udGV4dCwgKHVpbnQzMl90KilwVmFsdWUpOworICAgICAgICAgICAgQUxPR1YoIiVzIFZPTFVNRV9QQVJBTV9NVVRFICV1IiwgX19mdW5jX18sICoodWludDMyX3QqKXBWYWx1ZSk7CiAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIFZPTFVNRV9QQVJBTV9FTkFCTEVTVEVSRU9QT1NJVElPTjoKICAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSA8IHNpemVvZihpbnQzMl90KSkgewotICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBWT0xVTUVfUEFSQU1fRU5BQkxFU1RFUkVPUE9TSVRJT04gaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgKnBWYWx1ZVNpemUpOworICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBWT0xVTUVfUEFSQU1fRU5BQkxFU1RFUkVPUE9TSVRJT04gaW52YWxpZCAqcFZhbHVlU2l6ZSAldSIsIF9fZnVuY19fLAorICAgICAgICAgICAgICAgICAgICAgICpwVmFsdWVTaXplKTsKICAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSBzaXplb2YoaW50MzJfdCk7CiAKLSAgICAgICAgICAgICooaW50MzJfdCAqKXBWYWx1ZSA9IHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPmJTdGVyZW9Qb3NpdGlvbkVuYWJsZWQ7Ci0gICAgICAgICAgICBBTE9HVlYoIiVzIFZPTFVNRV9QQVJBTV9FTkFCTEVTVEVSRU9QT1NJVElPTiAlZCIsIF9fZnVuY19fLCAqKGludDMyX3QgKilwVmFsdWUpOworICAgICAgICAgICAgKihpbnQzMl90KilwVmFsdWUgPSBwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5iU3RlcmVvUG9zaXRpb25FbmFibGVkOworICAgICAgICAgICAgQUxPR1ZWKCIlcyBWT0xVTUVfUEFSQU1fRU5BQkxFU1RFUkVPUE9TSVRJT04gJWQiLCBfX2Z1bmNfXywgKihpbnQzMl90KilwVmFsdWUpOwogCiAgICAgICAgICAgICBicmVhazsKIApAQCAtMjgxNiwxMyArMjYwNCwxMCBAQAogLy8KIC8vLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogCi1pbnQgVm9sdW1lX3NldFBhcmFtZXRlcihFZmZlY3RDb250ZXh0ICpwQ29udGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICAgICAgIHBhcmFtU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBQYXJhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICAgICAgIHZhbHVlU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgKnBWYWx1ZSkgeworaW50IFZvbHVtZV9zZXRQYXJhbWV0ZXIoRWZmZWN0Q29udGV4dCogcENvbnRleHQsIHVpbnQzMl90IHBhcmFtU2l6ZSwgdm9pZCogcFBhcmFtLAorICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgdmFsdWVTaXplLCB2b2lkKiBwVmFsdWUpIHsKICAgICBpbnQgc3RhdHVzID0gMDsKLSAgICBpbnQzMl90ICpwYXJhbXMgPSAoaW50MzJfdCAqKXBQYXJhbTsKKyAgICBpbnQzMl90KiBwYXJhbXMgPSAoaW50MzJfdCopcFBhcmFtOwogCiAgICAgQUxPR1ZWKCIlcyBzdGFydCIsIF9fZnVuY19fKTsKIApAQCAtMjgzOCw3ICsyNjIzLDcgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgY29uc3QgaW50MTZfdCBsZXZlbCA9ICooaW50MTZfdCAqKXBWYWx1ZTsKKyAgICAgICAgICAgIGNvbnN0IGludDE2X3QgbGV2ZWwgPSAqKGludDE2X3QqKXBWYWx1ZTsKICAgICAgICAgICAgIEFMT0dWVigiJXMgVk9MVU1FX1BBUkFNX0xFVkVMICVkIiwgX19mdW5jX18sIGxldmVsKTsKICAgICAgICAgICAgIEFMT0dWVigiJXMgVk9MVU1FX1BBUkFNX0xFVkVMIENhbGxpbmcgVm9sdW1lU2V0Vm9sdW1lTGV2ZWwiLCBfX2Z1bmNfXyk7CiAgICAgICAgICAgICBzdGF0dXMgPSBWb2x1bWVTZXRWb2x1bWVMZXZlbChwQ29udGV4dCwgbGV2ZWwpOwpAQCAtMjg1Myw3ICsyNjM4LDcgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgY29uc3QgdWludDMyX3QgbXV0ZSA9ICoodWludDMyX3QgKilwVmFsdWU7CisgICAgICAgICAgICBjb25zdCB1aW50MzJfdCBtdXRlID0gKih1aW50MzJfdCopcFZhbHVlOwogICAgICAgICAgICAgQUxPR1ZWKCIlcyBWT0xVTUVfUEFSQU1fTVVURSAlZCIsIF9fZnVuY19fLCBtdXRlKTsKICAgICAgICAgICAgIEFMT0dWVigiJXMgVk9MVU1FX1BBUkFNX01VVEUgQ2FsbGluZyBWb2x1bWVTZXRNdXRlIiwgX19mdW5jX18pOwogICAgICAgICAgICAgc3RhdHVzID0gVm9sdW1lU2V0TXV0ZShwQ29udGV4dCwgbXV0ZSk7CkBAIC0yODYyLDE1ICsyNjQ3LDE2IEBACiAKICAgICAgICAgY2FzZSBWT0xVTUVfUEFSQU1fRU5BQkxFU1RFUkVPUE9TSVRJT046IHsKICAgICAgICAgICAgIGlmICh2YWx1ZVNpemUgPCBzaXplb2YodWludDMyX3QpKSB7Ci0gICAgICAgICAgICAgICAgQUxPR1YoIiVzIFZPTFVNRV9QQVJBTV9FTkFCTEVTVEVSRU9QT1NJVElPTiBpbnZhbGlkIHZhbHVlU2l6ZSAldSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgdmFsdWVTaXplKTsKKyAgICAgICAgICAgICAgICBBTE9HVigiJXMgVk9MVU1FX1BBUkFNX0VOQUJMRVNURVJFT1BPU0lUSU9OIGludmFsaWQgdmFsdWVTaXplICV1IiwgX19mdW5jX18sCisgICAgICAgICAgICAgICAgICAgICAgdmFsdWVTaXplKTsKICAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBjb25zdCB1aW50MzJfdCBwb3NpdGlvbkVuYWJsZWQgPSAqKHVpbnQzMl90ICopcFZhbHVlOworICAgICAgICAgICAgY29uc3QgdWludDMyX3QgcG9zaXRpb25FbmFibGVkID0gKih1aW50MzJfdCopcFZhbHVlOwogICAgICAgICAgICAgc3RhdHVzID0gVm9sdW1lRW5hYmxlU3RlcmVvUG9zaXRpb24ocENvbnRleHQsIHBvc2l0aW9uRW5hYmxlZCkKLSAgICAgICAgICAgICAgICAgICAgPzogVm9sdW1lU2V0U3RlcmVvUG9zaXRpb24ocENvbnRleHQsIHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPnBvc2l0aW9uU2F2ZWQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/OiBWb2x1bWVTZXRTdGVyZW9Qb3NpdGlvbihwQ29udGV4dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+cG9zaXRpb25TYXZlZCk7CiAgICAgICAgICAgICBBTE9HVlYoIiVzIFZPTFVNRV9QQVJBTV9FTkFCTEVTVEVSRU9QT1NJVElPTiBjYWxsZWQiLCBfX2Z1bmNfXyk7CiAgICAgICAgIH0gYnJlYWs7CiAKQEAgLTI4ODEsMTMgKzI2NjcsMTEgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgY29uc3QgaW50MTZfdCBwb3NpdGlvbiA9ICooaW50MTZfdCAqKXBWYWx1ZTsKKyAgICAgICAgICAgIGNvbnN0IGludDE2X3QgcG9zaXRpb24gPSAqKGludDE2X3QqKXBWYWx1ZTsKICAgICAgICAgICAgIEFMT0dWVigiJXMgVk9MVU1FX1BBUkFNX1NURVJFT1BPU0lUSU9OICVkIiwgX19mdW5jX18sIHBvc2l0aW9uKTsKLSAgICAgICAgICAgIEFMT0dWVigiJXMgVk9MVU1FX1BBUkFNX1NURVJFT1BPU0lUSU9OIENhbGxpbmcgVm9sdW1lU2V0U3RlcmVvUG9zaXRpb24iLAotICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXyk7CisgICAgICAgICAgICBBTE9HVlYoIiVzIFZPTFVNRV9QQVJBTV9TVEVSRU9QT1NJVElPTiBDYWxsaW5nIFZvbHVtZVNldFN0ZXJlb1Bvc2l0aW9uIiwgX19mdW5jX18pOwogICAgICAgICAgICAgc3RhdHVzID0gVm9sdW1lU2V0U3RlcmVvUG9zaXRpb24ocENvbnRleHQsIHBvc2l0aW9uKTsKLSAgICAgICAgICAgIEFMT0dWVigiJXMgVk9MVU1FX1BBUkFNX1NURVJFT1BPU0lUSU9OIENhbGxlZCBWb2x1bWVTZXRTdGVyZW9Qb3NpdGlvbiIsCi0gICAgICAgICAgICAgICAgICAgIF9fZnVuY19fKTsKKyAgICAgICAgICAgIEFMT0dWVigiJXMgVk9MVU1FX1BBUkFNX1NURVJFT1BPU0lUSU9OIENhbGxlZCBWb2x1bWVTZXRTdGVyZW9Qb3NpdGlvbiIsIF9fZnVuY19fKTsKICAgICAgICAgfSBicmVhazsKIAogICAgICAgICBkZWZhdWx0OgpAQCAtMjkxMiwxOCArMjY5NiwxNSBAQAogICogIFJlbWFya3MgICAgIDoKICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogCi1MVk1fSU5UMTYgTFZDX1RvREJfczMyVG9zMTYoTFZNX0lOVDMyIExpbl9maXgpCi17Ci0gICAgTFZNX0lOVDE2ICAgZGJfZml4OwotICAgIExWTV9JTlQxNiAgIFNoaWZ0OwotICAgIExWTV9JTlQxNiAgIFNtYWxsUmVtYWluZGVyOwotICAgIExWTV9VSU5UMzIgIFJlbWFpbmRlciA9IChMVk1fVUlOVDMyKUxpbl9maXg7CitMVk1fSU5UMTYgTFZDX1RvREJfczMyVG9zMTYoTFZNX0lOVDMyIExpbl9maXgpIHsKKyAgICBMVk1fSU5UMTYgZGJfZml4OworICAgIExWTV9JTlQxNiBTaGlmdDsKKyAgICBMVk1fSU5UMTYgU21hbGxSZW1haW5kZXI7CisgICAgTFZNX1VJTlQzMi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yYWluOwogICAgIGlmIChlbmFibGVkKSB7CiAgICAgICAgIC8vIEJhc3MgYm9vc3Qgb3IgVmlydHVhbGl6ZXIgY2FuIGJlIHRlbXBvcmFyaWx5IGRpc2FibGVkIGlmIHBsYXlpbmcgb3ZlciBkZXZpY2Ugc3BlYWtlciBkdWUKICAgICAgICAgLy8gdG8gdGhlaXIgbmF0dXJlLgpAQCAtMjk3MiwxNSArMjc1MiwxNSBAQAogICAgICAgICBzd2l0Y2ggKHBDb250ZXh0LT5FZmZlY3RUeXBlKSB7CiAgICAgICAgICAgICBjYXNlIExWTV9CQVNTX0JPT1NUOgogICAgICAgICAgICAgICAgIGlmIChwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5iQmFzc0VuYWJsZWQgPT0gTFZNX1RSVUUpIHsKLSAgICAgICAgICAgICAgICAgICAgIEFMT0dWKCJcdEVmZmVjdF9zZXRFbmFibGVkKCkgTFZNX0JBU1NfQk9PU1QgaXMgYWxyZWFkeSBlbmFibGVkIik7Ci0gICAgICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlx0RWZmZWN0X3NldEVuYWJsZWQoKSBMVk1fQkFTU19CT09TVCBpcyBhbHJlYWR5IGVuYWJsZWQiKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmKHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPlNhbXBsZXNUb0V4aXRDb3VudEJiIDw9IDApeworICAgICAgICAgICAgICAgIGlmIChwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5TYW1wbGVzVG9FeGl0Q291bnRCYiA8PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPk51bWJlckVmZmVjdHNFbmFibGVkKys7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGVmZmVjdEluRHJhaW4gJj0gfigxIDw8IExWTV9CQVNTX0JPT1NUKTsKICAgICAgICAgICAgICAgICBwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5TYW1wbGVzVG9FeGl0Q291bnRCYiA9Ci0gICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDMyKShwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5TYW1wbGVzUGVyU2Vjb25kKjAuMSk7CisgICAgICAgICAgICAgICAgICAgICAgICAoTFZNX0lOVDMyKShwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5TYW1wbGVzUGVyU2Vjb25kICogMC4xKTsKICAgICAgICAgICAgICAgICBwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5iQmFzc0VuYWJsZWQgPSBMVk1fVFJVRTsKICAgICAgICAgICAgICAgICB0ZW1wRGlzYWJsZWQgPSBwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5iQmFzc1RlbXBEaXNhYmxlZDsKICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTI5ODksMTIgKzI3NjksMTIgQEAKICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlx0RWZmZWN0X3NldEVuYWJsZWQoKSBMVk1fRVFVQUxJWkVSIGlzIGFscmVhZHkgZW5hYmxlZCIpOwogICAgICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYocENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+U2FtcGxlc1RvRXhpdENvdW50RXEgPD0gMCl7CisgICAgICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPlNhbXBsZXNUb0V4aXRDb3VudEVxIDw9IDApIHsKICAgICAgICAgICAgICAgICAgICAgcENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+TnVtYmVyRWZmZWN0c0VuYWJsZWQrKzsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgZWZmZWN0SW5EcmFpbiAmPSB+KDEgPDwgTFZNX0VRVUFMSVpFUik7CiAgICAgICAgICAgICAgICAgcENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+U2FtcGxlc1RvRXhpdENvdW50RXEgPQotICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQzMikocENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+U2FtcGxlc1BlclNlY29uZCowLjEpOworICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQzMikocENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+U2FtcGxlc1BlclNlY29uZCAqIDAuMSk7CiAgICAgICAgICAgICAgICAgcENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+YkVxdWFsaXplckVuYWJsZWQgPSBMVk1fVFJVRTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgTFZNX1ZJUlRVQUxJWkVSOgpAQCAtMzAwMiwxMiArMjc4MiwxMiBAQAogICAgICAgICAgICAgICAgICAgICBBTE9HVigiXHRFZmZlY3Rfc2V0RW5hYmxlZCgpIExWTV9WSVJUVUFMSVpFUiBpcyBhbHJlYWR5IGVuYWJsZWQiKTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmKHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPlNhbXBsZXNUb0V4aXRDb3VudFZpcnQgPD0gMCl7CisgICAgICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPlNhbXBsZXNUb0V4aXRDb3VudFZpcnQgPD0gMCkgewogICAgICAgICAgICAgICAgICAgICBwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5OdW1iZXJFZmZlY3RzRW5hYmxlZCsrOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBlZmZlY3RJbkRyYWluICY9IH4oMSA8PCBMVk1fVklSVFVBTElaRVIpOwogICAgICAgICAgICAgICAgIHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPlNhbXBsZXNUb0V4aXRDb3VudFZpcnQgPQotICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQzMikocENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+U2FtcGxlc1BlclNlY29uZCowLjEpOworICAgICAgICAgICAgICAgICAgICAgICAgKExWTV9JTlQzMikocENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+U2FtcGxlc1BlclNlY29uZCAqIDAuMSk7CiAgICAgICAgICAgICAgICAgcENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+YlZpcnR1YWxpemVyRW5hYmxlZCA9IExWTV9UUlVFOwogICAgICAgICAgICAgICAgIHRlbXBEaXNhYmxlZCA9IHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPmJWaXJ0dWFsaXplclRlbXBEaXNhYmxlZDsKICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTMwODQsNDEgKzI4NjQsMzkgQEAKIC8vCiAvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiAKLWludDE2X3QgTFZDX0NvbnZlcnRfVm9sVG9EYih1aW50MzJfdCB2b2wpewotICAgIGludDE2X3QgIGRCOworaW50MTZfdCBMVkNfQ29udmVydF9Wb2xUb0RiKHVpbnQzMl90IHZvbCkgeworICAgIGludDE2X3QgZEI7CiAKLSAgICBkQiA9IExWQ19Ub0RCX3MzMlRvczE2KHZvbCA8PDcpOwotICAgIGRCID0gKGRCICs4KT4+NDsKLSAgICBkQiA9IChkQiA8LTk2KSA/IC05NiA6IGRCIDsKKyAgICBkQiA9IExWQ19Ub0RCX3MzMlRvczE2KHZvbCA8PCA3KTsKKyAgICBkQiA9I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ID0gMDsKICAgICAgICAgLyogUHJvY2VzcyBhbGwgdGhlIGF2YWlsYWJsZSBmcmFtZXMsIGJsb2NrIHByb2Nlc3NpbmcgaXMKICAgICAgICAgICAgaGFuZGxlZCBpbnRlcm5hbExZIGJ5IHRoZSBMVk0gYnVuZGxlICovCi0gICAgICAgIHByb2Nlc3NTdGF0dXMgPSBhbmRyb2lkOjpMdm1CdW5kbGVfcHJvY2VzcyhpbkJ1ZmZlci0+ZjMyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0QnVmZmVyLT5mMzIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRCdWZmZXItPmZyYW1lQ291bnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwQ29udGV4dCk7Ci0gICAgICAgIGlmIChwcm9jZXNzU3RhdHVzICE9IDApeworICAgICAgICBwcm9jZXNzU3RhdHVzID0gYW5kcm9pZDo6THZtQnVuZGxlX3Byb2Nlc3MoaW5CdWZmZXItPmYzMiwgb3V0QnVmZmVyLT5mMzIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRCdWZmZXItPmZyYW1lQ291bnQsIHBDb250ZXh0KTsKKyAgICAgICAgaWYgKHByb2Nlc3NTdGF0dXMgIT0gMCkgewogICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogTHZtQnVuZGxlX3Byb2Nlc3MgcmV0dXJuZWQgZXJyb3IgJWQiLCBwcm9jZXNzU3RhdHVzKTsKICAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gMCkgewogICAgICAgICAgICAgICAgIHN0YXR1cyA9IHByb2Nlc3NTdGF0dXM7CkBAIC0zMjY0LDEzMyArMzAzNywxMjYgQEAKICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7CiAgICAgICAgIH0KICAgIC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ZmFjZSBJbXBsZW1lbnRhdGlvbjogQ29tbWFuZCAqLwotaW50IEVmZmVjdF9jb21tYW5kKGVmZmVjdF9oYW5kbGVfdCAgc2VsZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICAgICAgICAgICAgY21kQ29kZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICAgICAgICAgICAgY21kU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgICAgICAgICAgKnBDbWREYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAgICAgICAqcmVwbHlTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAgICAgICAqcFJlcGx5RGF0YSl7Ci0gICAgRWZmZWN0Q29udGV4dCAqIHBDb250ZXh0ID0gKEVmZmVjdENvbnRleHQgKikgc2VsZjsKK2ludCBFZmZlY3RfY29tbWFuZChlZmZlY3RfaGFuZGxlX3Qgc2VsZiwgdWludDMyX3QgY21kQ29kZSwgdWludDMyX3QgY21kU2l6ZSwgdm9pZCogcENtZERhdGEsCisgICAgICAgICAgICAgICAgICAgdWludDMyX3QqIHJlcGx5U2l6ZSwgdm9pZCogcFJlcGx5RGF0YSkgeworICAgIEVmZmVjdENvbnRleHQqIHBDb250ZXh0ID0gKEVmZmVjdENvbnRleHQqKXNlbGY7CiAKLSAgICAvL0FMT0dWKCJcdFxuRWZmZWN0X2NvbW1hbmQgc3RhcnQiKTsKKyAgICAvLyBBTE9HVigiXHRcbkVmZmVjdF9jb21tYW5kIHN0YXJ0Iik7CiAKLSAgICBpZihwQ29udGV4dC0+RWZmZWN0VHlwZSA9PSBMVk1fQkFTU19CT09TVCl7Ci0gICAgICAgIC8vQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgc2V0dGluZyBjb21tYW5kIGZvciBMVk1fQkFTU19CT09TVCIpOworICAgI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C0+cEJ1bmRsZWRDb250ZXh0LT5OdW1iZXJFZmZlY3RzRW5hYmxlZCk7CiAKLSAgICBzd2l0Y2ggKGNtZENvZGUpeworICAgIHN3aXRjaCAoY21kQ29kZSkgewogICAgICAgICBjYXNlIEVGRkVDVF9DTURfSU5JVDoKLSAgICAgICAgICAgIGlmIChwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSl7CisgICAgICAgICAgICBpZiAocFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMIHx8ICpyZXBseVNpemUgIT0gc2l6ZW9mKGludCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IsIEVGRkVDVF9DTURfSU5JVDogRVJST1IgZm9yIGVmZmVjdCB0eXBlICVkIiwKLSAgICAgICAgICAgICAgICAgICAgICAgIHBDb250ZXh0LT5FZmZlY3RUeXBlKTsKKyAgICAgICAgICAgICAgICAgICAgICBwQ29udGV4dC0+RWZmZWN0VHlwZSk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAqKGludCAqKSBwUmVwbHlEYXRhID0gMDsKLSAgICAgICAgICAgIC8vQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX0lOSVQgc3RhcnQiKTsKLSAgICAgICAgICAgIGlmKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9CQVNTX0JPT1NUKXsKLSAgICAgICAgICAgICAgICAvL0FMT0dWKCJcdEVmZmVjdF9jb21tYW5kIGNtZENvZGUgQ2FzZTogRUZGRUNUX0NNRF9JTklUIGZvciBMVk1fQkFTU19CT09TVCIpOworICAgICAgICAgICAgKihpbnQqKXBSZXBseURhdGEgPSAwOworICAgICAgICAgICAgLy8gQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX0lOSVQgc3RhcnQiKTsKKyAgICAgICAgICAgIGlmIChwQ29udGV4dC0+RWZmZWN0VHlwZSA9PSBMVk1fQkFTU19CT09TVCkgeworICAgICAgICAgICAgICAgIC8vIEFMT0dWKCJcdEVmZmVjdF9jb21tYW5kIGNtZENvZGUgQ2FzZTogRUZGRUNUX0NNRF9JTklUIGZvciBMVk1fQkFTU19CT09TVCIpOwogICAgICAgICAgICAgICAgIGFuZHJvaWQ6OkJhc3NTZXRTdHJlbmd0aChwQ29udGV4dCwgMCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZihwQ29udGV4dC0+RWZmZWN0VHlwZSA9PSBMVk1fVklSVFVBTElaRVIpewotICAgICAgICAgICAgICAgIC8vQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX0lOSVQgZm9yIExWTV9WSVJUVUFMSVpFUiIpOworICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9WSVJUVUFMSVpFUikgeworICAgICAgICAgICAgICAgIC8vIEFMT0dWKCJcdEVmZmVjdF9jb21tYW5kIGNtZENvZGUgQ2FzZTogRUZGRUNUX0NNRF9JTklUIGZvciBMVk1fVklSVFVBTElaRVIiKTsKICAgICAgICAgICAgICAgICBhbmRyb2lkOjpWaXJ0dWFsaXplclNldFN0cmVuZ3RoKHBDb250ZXh0LCAwKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9FUVVBTElaRVIpewotICAgICAgICAgICAgICAgIC8vQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX0lOSVQgZm9yIExWTV9FUVVBTElaRVIiKTsKKyAgICAgICAgICAgIGlmIChwQ29udGV4dC0+RWZmZWN0VHlwZSA9PSBMVk1fRVFVQUxJWkVSKSB7CisgICAgICAgICAgICAgICAgLy8gQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX0lOSVQgZm9yIExWTV9FUVVBTElaRVIiKTsKICAgICAgICAgICAgICAgICBhbmRyb2lkOjpFcXVhbGl6ZXJTZXRQcmVzZXQocENvbnRleHQsIDApOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYocENvbnRleHQtPkVmZmVjdFR5cGUgPT0gTFZNX1ZPTFVNRSl7Ci0gICAgICAgICAgICAgICAgLy9BTE9HVigiXHRFZmZlY3RfY29tbWFuZCBjbWRDb2RlIENhc2U6IEVGRkVDVF9DTURfSU5JVCBmb3IgTFZNX1ZPTFVNRSIpOwotICAgICAgICAgICAgICAgICooaW50ICopIHBSZXBseURhdGEgPSBhbmRyb2lkOjpWb2x1bWVTZXRWb2x1bWVMZXZlbChwQ29udGV4dCwgMCk7CisgICAgICAgICAgICBpZiAocENvbnRleHQtPkVmZmVjdFR5cGUgPT0gTFZNX1ZPTFVNRSkgeworICAgICAgICAgICAgICAgIC8vIEFMT0dWKCJcdEVmZmVjdF9jb21tYW5kIGNtZENvZGUgQ2FzZTogRUZGRUNUX0NNRF9JTklUIGZvciBMVk1fVk9MVU1FIik7CisgICAgICAgICAgICAgICAgKihpbnQqKXBSZXBseURhdGEgPSBhbmRyb2lkOjpWb2x1bWVTZXRWb2x1bWVMZXZlbChwQ29udGV4dCwgMCk7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX0NPTkZJRzoKLSAgICAgICAgICAgIC8vQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX1NFVF9DT05GSUcgc3RhcnQiKTsKLSAgICAgICAgICAgIGlmIChwQ21kRGF0YSAgICA9PSBOVUxMIHx8IGNtZFNpemUgICAgICE9IHNpemVvZihlZmZlY3RfY29uZmlnX3QpIHx8Ci0gICAgICAgICAgICAgICAgICAgIHBSZXBseURhdGEgID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAgIT0gc2l6ZW9mKGludCkpIHsKKyAgICAgICAgICAgIC8vIEFMT0dWKCJcdEVmZmVjdF9jb21tYW5kIGNtZENvZGUgQ2FzZTogRUZGRUNUX0NNRF9TRVRfQ09ORklHIHN0YXJ0Iik7CisgICAgICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCBjbWRTaXplICE9IHNpemVvZihlZmZlY3RfY29uZmlnX3QpIHx8IHBSZXBseURhdGEgPT0gTlVMTCB8fAorICAgICAgICAgICAgICAgIHJlcGx5U2l6ZSA9PSBOVUxMIHx8ICpyZXBseVNpemUgIT0gc2l6ZW9mKGludCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBFZmZlY3RfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9DT05GSUc6IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfU0VUX0NPTkZJRzogRVJST1IiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICooaW50ICopIHBSZXBseURhdGEgPSBhbmRyb2lkOjpFZmZlY3Rfc2V0Q29uZmlnKHBDb250ZXh0LCAoZWZmZWN0X2NvbmZpZ190ICopIHBDbWREYXRhKTsKLSAgICAgICAgICAgIC8vQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX1NFVF9DT05GSUcgZW5kIik7CisgICAgICAgICAgICAqKGludCopcFJlcGx5RGF0YSA9IGFuZHJvaWQ6OkVmZmVjdF9zZXRDb25maWcocENvbnRleHQsIChlZmZlY3RfY29uZmlnX3QqKXBDbWREYXRhKTsKKyAgICAgICAgICAgIC8vIEFMT0dWKCJcdEVmZmVjdF9jb21tYW5kIGNtZENvZGUgQ2FzZTogRUZGRUNUX0NNRF9TRVRfQ09ORklHIGVuZCIpOwogICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX0dFVF9DT05GSUc6CiAgICAgICAgICAgICBpZiAocFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMIHx8ICpyZXBseVNpemUgIT0gc2l6ZW9mKGVmZmVjdF9jb25maWdfdCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBFZmZlY3RfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX0dFVF9DT05GSUc6IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfR0VUX0NPTkZJRzogRVJST1IiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgYW5kcm9pZDo6RWZmZWN0X2dldENvbmZpZyhwQ29udGV4dCwgKGVmZmVjdF9jb25maWdfdCAqKXBSZXBseURhdGEpOworICAgICAgICAgICAgYW5kcm9pZDo6RWZmZWN0X2dldENvbmZpZyhwQ29udGV4dCwgKGVmZmVjdF9jb25maWdfdCopcFJlcGx5RGF0YSk7CiAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIEVGRkVDVF9DTURfUkVTRVQ6Ci0gICAgICAgICAgICAvL0FMT0dWKCJcdEVmZmVjdF9jb21tYW5kIGNtZENvZGUgQ2FzZTogRUZGRUNUX0NNRF9SRVNFVCBzdGFydCIpOworICAgICAgICAgICAgLy8gQUxPR1YoIlx0RWZm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gICBwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwKLSAgICAgICAgICAgICAgICAgICAgKnJlcGx5U2l6ZSA8IChzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgcC0+cHNpemUpKSB7CisgICAgICAgICAgICAgICAgY21kU2l6ZSA8IChzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgcC0+cHNpemUpIHx8IHBSZXBseURhdGEgPT0gTlVMTCB8fAorICAgICAgICAgICAgICAgIHJlcGx5U2l6ZSA9PSBOVUxMIHx8ICpyZXBseVNpemUgPCAoc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHAtPnBzaXplKSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IEVGRkVDVF9DTURfR0VUX1BBUkFNOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQpAQCAtMzQwMSw3NSArMzE2Nyw2MiBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgY29uc3QgdWludDMyX3QgcGFkZGVkUGFyYW1TaXplID0gY29tcHV0ZVBhcmFtVk9mZnNldChwKTsKICAgICAgICAgICAgIGlmICgoRUZGRUNUX1BBUkFNX1NJWkVfTUFYIC0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSA8IHBhZGRlZFBhcmFtU2l6ZSkgfHwKLSAgICAgICAgICAgICAgICAoRUZGRUNUX1BBUkFNX1NJWkVfTUFYIC0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSAtIHBhZGRlZFBhcmFtU2l6ZSA8Ci0gICAgICAgICAgICAgICAgICAgIHAtPnZzaXplKSkgeworICAgICAgICAgICAgICAgIChFRkZFQ1RfUEFSQU1fU0laRV9NQVggLSBzaXplb2YoZWZmZWN0X3BhcmFtX3QpIC0gcGFkZGVkUGFyYW1TaXplIDwgcC0+dnNpemUpKSB7CiAgICAgICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogRUZGRUNUX0NNRF9HRVRfUEFSQU06IHBhZGRlZF9wc2l6ZSBvciB2c2l6ZSB0b28gYmlnIik7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICB1aW50MzJfdCBleHBlY3RlZFJlcGx5U2l6ZSA9IHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBwYWRkZWRQYXJhbVNpemUgKyBwLT52c2l6ZTsKICAgICAgICAgICAgIGlmICgqcmVwbHlTaXplIDwgZXhwZWN0ZWRSZXBseVNpemUpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBFRkZFQ1RfQ01EX0dFVF9QQVJBTTogbWluLiByZXBseVNpemUgJXUsIGdvdCAldSBieXRlcyIsCi0gICAgICAgICAgICAgICAgICAgICAgICBleHBlY3RlZFJlcGx5U2l6ZSwgKnJlcGx5U2l6ZSk7CisgICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRSZXBseVNpemUsICpyZXBseVNpemUpOwogICAgICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiMzI3MDU0MzgiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgbWVtY3B5KHBSZXBseURhdGEsIHBDbWREYXRhLCBzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgcC0+cHNpemUpOwogCi0gICAgICAgICAgICBwID0gKGVmZmVjdF9wYXJhbV90ICopcFJlcGx5RGF0YTsKKyAgICAgICAgICAgIHAgPSAoZWZmZWN0X3BhcmFtX3QqKXBSZXBseURhdGE7CiAKICAgICAgICAgICAgIHVpbnQzMl90IHZvZmZzZXQgPSBwYWRkZWRQYXJhbVNpemU7Ci0gICAgICAgICAgICBpZihwQ29udGV4dC0+RWZmZWN0VHlwZSA9PSBMVk1fQkFTU19CT09TVCl7Ci0gICAgICAgICAgICAgICAgcC0+c3RhdHVzID0gYW5kcm9pZDo6QmFzc0Jvb3N0X2dldFBhcmFtZXRlcihwQ29udGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPnBzaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC0+ZGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwLT52c2l6ZSwKKyAgICAgICAgICAgIGlmIChwQ29udGV4dC0+RWZmZWN0VHlwZSA9PSBMVk1fQkFTU19CT09TVCkgeworICAgICAgICAgICAgICAgIHAtPnN0YXR1cyA9IGFuZHJvaWQ6OkJhc3NCb29zdF9nZXRQYXJhbWV0ZXIocENvbnRleHQsIHAtPnBzaXplLCBwLT5kYXRhLCAmcC0+dnNpemUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLT5kYXRhICsgdm9mZnNldCk7Ci0gICAgICAgICAgICAgICAgLy9BTE9HVigiXHRCYXNzQm9vc3RfY29tbWFuZCBFRkZFQ1RfQ01EX0dFVF9QQVJBTSAiCisgICAgICAgICAgICAgICAgLy8gQUxPR1YoIlx0QmFzc0Jvb3N0X2NvbW1hbmQgRUZGRUNUX0NNRF9HRVRfUEFSQU0gIgogICAgICAgICAgICAgICAgIC8vICAgICAgICAiKnBDbWREYXRhICVkLCAqcmVwbHlTaXplICVkLCAqcFJlcGx5RGF0YSAlZCAiLAogICAgICAgICAgICAgICAgIC8vICAgICAgICAqKGludDMyX3QgKikoKGNoYXIgKilwQ21kRGF0YSArIHNpemVvZihlZmZlY3RfcGFyYW1fdCkpLAogICAgICAgICAgICAgICAgIC8vICAgICAgICAqcmVwbHlTaXplLAogICAgICAgICAgICAgICAgIC8vICAgICAgICAqKGludDE2X3QgKikoKGNoYXIgKilwUmVwbHlEYXRhICsgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHZvZmZzZXQpKTsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgaWYocENvbnRleHQtPkVmZmVjdFR5cGUgPT0gTFZNX1ZJUlRVQUxJWkVSKXsKLSAgICAgICAgICAgICAgICBwLT5zdGF0dXMgPSBhbmRyb2lkOjpWaXJ0dWFsaXplcl9nZXRQYXJhbWV0ZXIocENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPnBzaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCAqKXAtPmRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwLT52c2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC0+ZGF0YSArIHZvZmZzZXQpOworICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9WSVJUVUFMSVpFUikgeworICAgICAgICAgICAgICAgIHAtPnN0YXR1cyA9IGFuZHJvaWQ6OlZpcnR1YWxpemVyX2dldFBhcmFtZXRlcihwQ29udGV4dCwgcC0+cHNpemUsICh2b2lkKilwLT5kYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcC0+dnNpemUsIHAtPmRhdGEgKyB2b2Zmc2V0KTsKIAotICAgICAgICAgICAgICAgIC8vQUxPR1YoIlx0VmlydHVhbGl6ZXJfY29tbWFuZCBFRkZFQ1RfQ01EX0dFVF9QQVJBTSAiCisgICAgICAgICAgICAgICAgLy8gQUxPR1YoIlx0VmlydHVhbGl6ZXJfY29tbWFuZCBFRkZFQ1RfQ01EX0dFVF9QQVJBTSAiCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICIqcENtZERhdGEgJWQsICpyZXBseVNpemUgJWQsICpwUmVwbHlEYXRhICVkICIsCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICooaW50MzJfdCAqKSgoY2hhciAqKXBDbWREYXRhICsgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSksCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICpyZXBseVNpemUsCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICooaW50MTZfdCAqKSgoY2hhciAqKXBSZXBseURhdGEgKyBzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgdm9mZnNldCkpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYocENvbnRleHQtPkVmZmVjdFR5cGUgPT0gTFZNX0VRVUFMSVpFUil7Ci0gICAgICAgICAgICAgICAgLy9BTE9HVigiXHRFcXVhbGl6ZXJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKKyAgICAgICAgICAgIGlmIChwQ29udGV4dC0+RWZmZWN0VHlwZSA9PSBMVk1fRVFVQUxJWkVSKSB7CisgICAgICAgICAgICAgICAgLy8gQUxPR1YoIlx0RXF1YWxpemVyX2NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICJFRkZFQ1RfQ01EX0dFVF9QQVJBTSBzdGFydCIpOwotICAgICAgICAgICAgICAgIHAtPnN0YXR1cyA9IGFuZHJvaWQ6OkVxdWFsaXplcl9nZXRQYXJhbWV0ZXIocENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLT5wc2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPmRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcC0+dnNpemUsCisgICAgICAgICAgICAgICAgcC0+c3RhdHVzID0gYW5kcm9pZDo6RXF1YWxpemVyX2dldFBhcmFtZXRlcihwQ29udGV4dCwgcC0+cHNpemUsIHAtPmRhdGEsICZwLT52c2l6ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPmRhdGEgKyB2b2Zmc2V0KTsKIAotICAgICAgICAgICAgICAgIC8vQUxPR1YoIlx0RXF1YWxpemVyX2NvbW1hbmQgRUZGRUNUX0NNRF9HRVRfUEFSQU0gKnBDbWREYXRhICVkLCAqcmVwbHlTaXplICVkLCAiCisgICAgICAgICAgICAgICAgLy8gQUxPR1YoIlx0RXF1YWxpemVyX2NvbW1hbmQgRUZGRUNUX0NNRF9HRVRfUEFSQU0gKnBDbWREYXRhICVkLCAqcmVwbHlTaXplICVkLCAiCiAgICAgICAgICAgICAgICAgLy8gICAgICAgIipwUmVwbHlEYXRhICUwOHggJTA4eCIsCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICooaW50MzJfdCAqKSgoY2hhciAqKXBDbWREYXRhICsgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSksICpyZXBseVNpemUsCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICooaW50MzJfdCAqKSgoY2hhciAqKXBSZXBseURhdGEgKyBzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgdm9mZnNldCksCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICooaW50MzJfdCAqKSgoY2hhciAqKXBSZXBseURhdGEgKyBzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgdm9mZnNldCArCiAgICAgICAgICAgICAgICAgLy8gICAgICAgIHNpemVvZihpbnQzMl90KSkpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYocENvbnRleHQtPkVmZmVjdFR5cGUgPT0gTFZNX1ZPTFVNRSl7Ci0gICAgICAgICAgICAgICAgLy9BTE9HVigiXHRWb2x1bWVfY29tbWFuZCBjbWRDb2RlIENhc2U6IEVGRkVDVF9DTURfR0VUX1BBUkFNIHN0YXJ0Iik7Ci0gICAgICAgICAgICAgICAgcC0+c3RhdHVzID0gYW5kcm9pZDo6Vm9sdW1lX2dldFBhcmFtZXRlcihwQ29udGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPnBzaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgKilwLT5kYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnAtPnZzaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC0+ZGF0YSArIHZvZmZzZXQpOworICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9WT0xVTUUpIHsKKyAgICAgICAgICAgICAgICAvLyBBTE9HVigiXHRWb2x1bWVfY29tbWFuZCBjbWRDb2RlIENhc2U6IEVGRkVDVF9DTURfR0VUX1BBUkFNIHN0YXJ0Iik7CisgICAgICAgICAgICAgICAgcC0+c3RhdHVzID0gYW5kcm9pZDo6Vm9sdW1lX2dldFBhcmFtZXRlcihwQ29udGV4dCwgcC0+cHNpemUsICh2b2lkKilwLT5kYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnAtPnZzaXplLCBwLT5kYXRhICsgdm9mZnNldCk7CiAKLSAgICAgICAgICAgICAgICAvL0FMT0dWKCJcdFZvbHVtZV9jb21tYW5kIEVGRkVDVF9DTURfR0VUX1BBUkFNICIKKyAgICAgICAgICAgICAgICAvLyBBTE9HVigiXHRWb2x1bWVfY29tbWFuZCBFRkZFQ1RfQ01EX0dFVF9QQVJBTSAiCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICIqcENtZERhdGEgJWQsICpyZXBseVNpemUgJWQsICpwUmVwbHlEYXRhICVkICIsCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICooaW50MzJfdCAqKSgoY2hhciAqKXBDbWREYXRhICsgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSksCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICpyZXBseVNpemUsCkBAIC0zNDc3LDEyMyArMzIzMCwxMTQgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgICAgICpyZXBseVNpemUgPSBzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgdm9mZnNldCArIHAtPnZzaXplOwogCi0gICAgICAgICAgICAvL0FMT0dWKCJcdEVmZmVjdF9jb21tYW5kIGNtZENvZGUgQ2FzZTogRUZGRUNUX0NNRF9HRVRfUEFSQU0gZW5kIik7CisgICAgICAgICAgICAvLyBBTE9HVigiXHRFZmZlY3RfY29tbWFuZCBjbWRDb2RlIENhc2U6IEVGRkVDVF9DTURfR0VUX1BBUkFNIGVuZCIpOwogICAgICAgICB9IGJyZWFrOwotICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX1BBUkFNOnsKLSAgICAgICAgICAgIC8vQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX1NFVF9QQVJBTSBzdGFydCIpOwotICAgICAgICAgICAgaWYocENvbnRleHQtPkVmZmVjdFR5cGUgPT0gTFZNX0JBU1NfQk9PU1QpewotICAgICAgICAgICAgICAgIC8vQUxPR1YoIlx0QmFzc0Jvb3N0X2NvbW1hbmQgRUZGRUNUX0NNRF9TRVRfUEFSQU0gcGFyYW0gJWQsICpyZXBseVNpemUgJWQsIHZhbHVlICVkIiwKKyAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX1NFVF9QQVJBTTogeworICAgICAgICAgICAgLy8gQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX1NFVF9QQVJBTSBzdGFydCIpOworICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9CQVNTX0JPT1NUKSB7CisgICAgICAgICAgICAgICAgLy8gQUxPR1YoIlx0QmFzc0Jvb3N0X2NvbW1hbmQgRUZGRUNUX0NNRF9TRVRfUEFSQU0gcGFyYW0gJWQsICpyZXBseVNpemUgJWQsIHZhbHVlCisgICAgICAgICAgICAgICAgLy8gJWQiLAogICAgICAgICAgICAgICAgIC8vICAgICAgICooaW50MzJfdCAqKSgoY2hhciAqKXBDbWREYXRhICsgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSksCiAgICAgICAgICAgICAgICAgLy8gICAgICAgKnJlcGx5U2l6ZSwKICAgICAgICAgICAgICAgICAvLyAgICAgICAqKGludDE2X3QgKikoKGNoYXIgKilwQ21kRGF0YSArIHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBzaXplb2YoaW50MzJfdCkpKTsKIAotICAgICAgICAgICAgICAgIGlmIChwQ21kRGF0YSAgID09IE5VTEwgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNtZFNpemUgICAgIT0gKHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBzaXplb2YoaW50MzJfdCkgK3NpemVvZihpbnQxNl90KSkgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQzMl90KSkgeworICAgICAgICAgICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMIHx8CisgICAgICAgICAgICAgICAgICAgIGNtZFNpemUgIT0gKHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBzaXplb2YoaW50MzJfdCkgKyBzaXplb2YoaW50MTZfdCkpIHx8CisgICAgICAgICAgICAgICAgICAgIHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQzMl90KSkgewogICAgICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBCYXNzQm9vc3RfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfUEFSQU06IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9QQVJBTTogRVJST1IiKTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgZWZmZWN0X3BhcmFtX3QgKiBjb25zdCBwID0gKGVmZmVjdF9wYXJhbV90ICopIHBDbWREYXRhOworICAgICAgICAgICAgICAgIGVmZmVjdF9wYXJhbV90KiBjb25zdCBwID0gKGVmZmVjdF9wYXJhbV90KilwQ21kRGF0YTsKICAgICAgICAgICAgICAgICBjb25zdCB1aW50MzJfdCB2b2Zmc2V0ID0gY29tcHV0ZVBhcmFtVk9mZnNldChwKTsKIAotICAgICAgICAgICAgICAgIC8vQUxPR1YoIlx0bkJhc3NCb29zdF9jb21tYW5kIGNtZFNpemUgaXMgJWRcbiIKKyAgICAgICAgICAgICAgICAvLyBBTE9HVigiXHRuQmFzc0Jvb3N0X2NvbW1hbmQgY21kU2l6ZSBpcyAlZFxuIgogICAgICAgICAgICAgICAgIC8vICAgICAgICAiXHRzaXplb2YoZWZmZWN0X3BhcmFtX3QpIGlzICAlZFxuIgogICAgICAgICAgICAgICAgIC8vICAgICAgICAiXHRwLT5wc2l6ZSBpcyAlZFxuIgogICAgICAgICAgICAgICAgIC8vICAgICAgICAiXHRwLT52c2l6ZSBpcyAlZCIKICAgICAgICAgICAgICAgICAvLyAgICAgICAgIlxuIiwKICAgICAgICAgICAgICAgICAvLyAgICAgICAgY21kU2l6ZSwgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSwgcC0+cHNpemUsIHAtPnZzaXplICk7CiAKLSAgICAgICAgICAgICAgICAqKGludCAqKXBSZXBseURhdGEgPSBhbmRyb2lkOjpCYXNzQm9vc3Rfc2V0UGFyYW1ldGVyKHBDb250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC0+cHNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCAqKXAtPmRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLT52c2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPmRhdGEgKyB2b2Zmc2V0KTsKKyAgICAgICAgICAgICAgICAqKGludCopcFJlcGx5RGF0YSA9IGFuZHJvaWQ6OkJhc3NCb29zdF9zZXRQYXJhbWV0ZXIoCisgICAgICAgICAgICAgICAgICAgICAgICBwQ29udGV4dCwgcC0+cHNpemUsICh2b2lkKilwLT5kYXRhLCBwLT52c2l6ZSwgcC0+ZGF0YSArIHZvZmZzZXQpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYocENvbnRleHQtPkVmZmVjdFR5cGUgPT0gTFZNX1ZJUlRVQUxJWkVSKXsKLSAgICAgICAgICAgICAgLy8gV2FybmluZyB0aGlzIGxvZyB3aWxsIGZhaWwgdG8gcHJvcGVybHkgcmVhZCBhbiBpbnQzMl90IHZhbHVlLCBhc3N1bWVzIGludDE2X3QKLSAgICAgICAgICAgICAgLy9BTE9HVigiXHRWaXJ0dWFsaXplcl9jb21tYW5kIEVGRkVDVF9DTURfU0VUX1BBUkFNIHBhcmFtICVkLCAqcmVwbHlTaXplICVkLCB2YWx1ZSAlZCIsCi0gICAgICAgICAgICAgIC8vICAgICAgICAqKGludDMyX3QgKikoKGNoYXIgKilwQ21kRGF0YSArIHNpemVvZihlZmZlY3RfcGFyYW1fdCkpLAotICAgICAgICAgICAgICAvLyAgICAgICAgKnJlcGx5U2l6ZSwKLSAgICAgICAgICAgICAgLy8gICAgICAgICooaW50MTZfdCAqKSgoY2hhciAqKXBDbWREYXRhICsgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHNpemVvZihpbnQzMl90KSkpOworICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9WSVJUVUFMSVpFUikgeworICAgICAgICAgICAgICAgIC8vIFdhcm5pbmcgdGhpcyBsb2cgd2lsbCBmYWlsIHRvIHByb3Blcmx5IHJlYWQgYW4gaW50MzJfdCB2YWx1ZSwgYXNzdW1lcyBpbnQxNl90CisgICAgICAgICAgICAgICAgLy8gQUxPR1YoIlx0VmlydHVhbGl6ZXJfY29tbWFuZCBFRkZFQ1RfQ01EX1NFVF9QQVJBTSBwYXJhbSAlZCwgKnJlcGx5U2l6ZSAlZCwgdmFsdWUKKyAgICAgICAgICAgICAgICAvLyAlZCIsCisgICAgICAgICAgICAgICAgLy8gICAgICAgICooaW50MzJfdCAqKSgoY2hhciAqKXBDbWREYXRhICsgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSksCisgICAgICAgICAgICAgICAgLy8gICAgICAgICpyZXBseVNpemUsCisgICAgICAgICAgICAgICAgLy8gICAgICAgICooaW50MTZfdCAqKSgoY2hhciAqKXBDbWREYXRhICsgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArCisgICAgICAgICAgICAgICAgLy8gICAgICAgIHNpemVvZihpbnQzMl90KSkpOwogCi0gICAgICAgICAgICAgICAgaWYgKHBDbWREYXRhICAgPT0gTlVMTCB8fAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gbGVnYWwgcGFyYW1ldGVycyBhcmUgaW50MTZfdCBvciBpbnQzMl90Ci0gICAgICAgICAgICAgICAgICAgICAgICBjbWRTaXplICAgID4gKHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBzaXplb2YoaW50MzJfdCkgK3NpemVvZihpbnQzMl90KSkgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNtZFNpemUgICAgPCAoc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHNpemVvZihpbnQzMl90KSArc2l6ZW9mKGludDE2X3QpKSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgcFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMIHx8ICpyZXBseVNpemUgIT0gc2l6ZW9mKGludDMyX3QpKSB7CisgICAgICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwKKyAgICAgICAgICAgICAgICAgICAgLy8gbGVnYWwgcGFyYW1ldGVycyBhcmUgaW50MTZfdCBvciBpbnQzMl90CisgICAgICAgICAgICAgICAgICAgIGNtZFNpemUgPiAoc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHNpemVvZihpbnQzMl90KSArIHNpemVvZihpbnQzMl90KSkgfHwKKyAgICAgICAgICAgICAgICAgICAgY21kU2l6ZSA8IChzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgc2l6ZW9mKGludDMyX3QpICsgc2l6ZW9mKGludDE2X3QpKSB8fAorICAgICAgICAgICAgICAgICAgICBwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50MzJfdCkpIHsKICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogVmlydHVhbGl6ZXJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfUEFSQU06IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9QQVJBTTogRVJST1IiKTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgZWZmZWN0X3BhcmFtX3QgKiBjb25zdCBwID0gKGVmZmVjdF9wYXJhbV90ICopIHBDbWREYXRhOworICAgICAgICAgICAgICAgIGVmZmVjdF9wYXJhbV90KiBjb25zdCBwID0gKGVmZmVjdF9wYXJhbV90KilwQ21kRGF0YTsKICAgICAgICAgICAgICAgICBjb25zdCB1aW50MzJfdCB2b2Zmc2V0ID0gY29tcHV0ZVBhcmFtVk9mZnNldChwKTsKIAotICAgICAgICAgICAgICAgIC8vQUxPR1YoIlx0blZpcnR1YWxpemVyX2NvbW1hbmQgY21kU2l6ZSBpcyAlZFxuIgorICAgICAgICAgICAgICAgIC8vIEFMT0dWKCJcdG5WaXJ0dWFsaXplcl9jb21tYW5kIGNtZFNpemUgaXMgJWRcbiIKICAgICAgICAgICAgICAgICAvLyAgICAgICAgIlx0c2l6ZW9mKGVmZmVjdF9wYXJhbV90KSBpcyAgJWRcbiIKICAgICAgICAgICAgICAgICAvLyAgICAgICAgIlx0cC0+cHNpemUgaXMgJWRcbiIKICAgICAgICAgICAgICAgICAvLyAgICAgICAgIlx0cC0+dnNpemUgaXMgJWQiCiAgICAgICAgICAgICAgICAgLy8gICAgICAgICJcbiIsCiAgICAgICAgICAgICAgICAgLy8gICAgICAgIGNtZFNpemUsIHNpemVvZihlZmZlY3RfcGFyYW1fdCksIHAtPnBzaXplLCBwLT52c2l6ZSApOwogCi0gICAgICAgICAgICAgICAgKihpbnQgKilwUmVwbHlEYXRhID0gYW5kcm9pZDo6VmlydHVhbGl6ZXJfc2V0UGFyYW1ldGVyKHBDb250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLT5wc2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgKilwLT5kYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLT52c2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC0+ZGF0YSArIHZvZmZzZXQpOworICAgICAgICAgICAgICAgICooaW50KilwUmVwbHlEYXRhID0gYW5kcm9pZDo6VmlydHVhbGl6ZXJfc2V0UGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgcENvbnRleHQsIHAtPnBzaXplLCAodm9pZCopcC0+ZGF0YSwgcC0+dnNpemUsIHAtPmRhdGEgKyB2b2Zmc2V0KTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9FUVVBTElaRVIpewotICAgICAgICAgICAgICAgLy9BTE9HVigiXHRFcXVhbGl6ZXJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgIC8vICAgICAgICAiRUZGRUNUX0NNRF9TRVRfUEFSQU0gc3RhcnQiKTsKLSAgICAgICAgICAgICAgIC8vQUxPR1YoIlx0RXF1YWxpemVyX2NvbW1hbmQgRUZGRUNUX0NNRF9TRVRfUEFSQU0gcGFyYW0gJWQsICpyZXBseVNpemUgJWQsIHZhbHVlICVkICIsCi0gICAgICAgICAgICAgICAvLyAgICAgICAgKihpbnQzMl90ICopKChjaGFyICopcENtZERhdGEgKyBzaXplb2YoZWZmZWN0X3BhcmFtX3QpKSwKLSAgICAgICAgICAgICAgIC8vICAgICAgICAqcmVwbHlTaXplLAotICAgICAgICAgICAgICAgLy8gICAgICAgICooaW50MTZfdCAqKSgoY2hhciAqKXBDbWREYXRhICsgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHNpemVvZihpbnQzMl90KSkpOworICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9FUVVBTElaRVIpIHsKKyAgICAgICAgICAgICAgICAvLyBBTE9HVigiXHRFcXVhbGl6ZXJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKKyAgICAgICAgICAgICAgICAvLyAgICAgICAgIkVGRkVDVF9DTURfU0VUX1BBUkFNIHN0YXJ0Iik7CisgICAgICAgICAgICAgICAgLy8gQUxPR1YoIlx0RXF1YWxpemVyX2NvbW1hbmQgRUZGRUNUX0NNRF9TRVRfUEFSQU0gcGFyYW0gJWQsICpyZXBseVNpemUgJWQsIHZhbHVlICVkCisgICAgICAgICAgICAgICAgLy8gIiwKKyAgICAgICAgICAgICAgICAvLyAgICAgICAgKihpbnQzMl90ICopKChjaGFyICopcENtZERhdGEgKyBzaXplb2YoZWZmZWN0X3BhcmFtX3QpKSwKKyAgICAgICAgICAgICAgICAvLyAgICAgICAgKnJlcGx5U2l6ZSwKKyAgICAgICAgICAgICAgICAvLyAgICAgICAgKihpbnQxNl90ICopKChjaGFyICopcENtZERhdGEgKyBzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsKKyAgICAgICAgICAgICAgICAvLyAgICAgICAgc2l6ZW9mKGludDMyX3QpKSk7CiAKICAgICAgICAgICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCBjbWRTaXplIDwgKHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBzaXplb2YoaW50MzJfdCkpIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICBwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50MzJfdCkpIHsKKyAgICAgICAgICAgICAgICAgICAgcFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMIHx8ICpyZXBseVNpemUgIT0gc2l6ZW9mKGludDMyX3QpKSB7CiAgICAgICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IEVxdWFsaXplcl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9QQVJBTTogRVJST1IiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfU0VUX1BBUkFNOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBlZmZlY3RfcGFyYW1fdCAqIGNvbnN0IHAgPSAoZWZmZWN0X3BhcmFtX3QgKikgcENtZERhdGE7CisgICAgICAgICAgICAgICAgZWZmZWN0X3BhcmFtX3QqIGNvbnN0IHAgPSAoZWZmZWN0X3BhcmFtX3QqKXBDbWREYXRhOwogICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQzMl90IHZvZmZzZXQgPSBjb21wdXRlUGFyYW1WT2Zmc2V0KHApOwogCi0gICAgICAgICAgICAgICAgKihpbnQgKilwUmVwbHlEYXRhID0gYW5kcm9pZDo6RXF1YWxpemVyX3NldFBhcmFtZXRlcihwQ29udGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPnBzaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgKilwLT5kYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC0+dnNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLT5kYXRhICsgdm9mZnNldCk7CisgICAgICAgICAgICAgICAgKihpbnQqKXBSZXBseURhdGEgPSBhbmRyb2lkOjpFcXVhbGl6ZXJfc2V0UGFyYW1ldGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgcENvbnRleHQsIHAtPnBzaXplLCAodm9pZCopcC0+ZGF0YSwgcC0+dnNpemUsIHAtPmRhdGEgKyB2b2Zmc2V0KTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9WT0xVTUUpewotICAgICAgICAgICAgICAgIC8vQUxPR1YoIlx0Vm9sdW1lX2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX1NFVF9QQVJBTSBzdGFydCIpOwotICAgICAgICAgICAgICAgIC8vQUxPR1YoIlx0Vm9sdW1lX2NvbW1hbmQgRUZGRUNUX0NNRF9TRVRfUEFSQU0gcGFyYW0gJWQsICpyZXBseVNpemUgJWQsIHZhbHVlICVkICIsCisgICAgICAgICAgICBpZiAocENvbnRleHQtPkVmZmVjdFR5cGUgPT0gTFZNX1ZPTFVNRSkgeworICAgICAgICAgICAgICAgIC8vIEFMT0dWKCJcdFZvbHVtZV9jb21tYW5kIGNtZENvZGUgQ2FzZTogRUZGRUNUX0NNRF9TRVRfUEFSQU0gc3RhcnQiKTsKKyAgICAgICAgICAgICAgICAvLyBBTE9HVigiXHRWb2x1bWVfY29tbWFuZCBFRkZFQ1RfQ01EX1NFVF9QQVJBTSBwYXJhbSAlZCwgKnJlcGx5U2l6ZSAlZCwgdmFsdWUgJWQgIiwKICAgICAgICAgICAgICAgICAvLyAgICAgICAgKihpbnQzMl90ICopKChjaGFyICopcENtZERhdGEgKyBzaXplb2YoZWZmZWN0X3BhcmFtX3QpKSwKICAgICAgICAgICAgICAgICAvLyAgICAgICAgKnJlcGx5U2l6ZSwKICAgICAgICAgICAgICAgICAvLyAgICAgICAgKihpbnQxNl90ICopKChjaGFyICopcENtZERhdGEgKyBzaXplb2YoZWZmZWN0X3BhcmFtX3QpICtzaXplb2YoaW50MzJfdCkpKTsKIAotICAgICAgICAgICAgICAgIGlmIChwQ21kRGF0YSAgID09IE5VTEwgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNtZFNpemUgICAgPCAoc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHNpemVvZihpbnQzMl90KSkgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fAotICAgICAgICAgICAgICAgICAgICAgICAgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50MzJfdCkpIHsKKyAgICAgICAgICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCBjbWRTaXplIDwgKHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBzaXplb2YoaW50MzJfdCkpIHx8CisgICAgICAgICAgICAgICAgICAgIHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQzMl90KSkgewogICAgICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBWb2x1bWVfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfUEFSQU06IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9QQVJBTTogRVJST1IiKTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgZWZmZWN0X3BhcmFtX3QgKiBjb25zdCBwID0gKGVmZmVjdF9wYXJhbV90ICopIHBDbWREYXRhOworICAgICAgICAgICAgICAgIGVmZmVjdF9wYXJhbV90KiBjb25zdCBwID0gKGVmZmVjdF9wYXJhbV90KilwQ21kRGF0YTsKICAgICAgICAgICAgICAgICBjb25zdCB1aW50MzJfdCB2b2Zmc2V0ID0gY29tcHV0ZVBhcmFtVk9mZnNldChwKTsKIAotICAgICAgICAgICAgICAgICooaW50ICopcFJlcGx5RGF0YSA9IGFuZHJvaWQ6OlZvbHVtZV9zZXRQYXJhbWV0ZXIocENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLT5wc2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkICopcC0+ZGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPnZzaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC0+ZGF0YSArIHZvZmZzZXQpOworICAgICAgICAgICAgICAgICooaW50KilwUmVwbHlEYXRhID0gYW5kcm9pZDo6Vm9sdW1lX3NldFBhcmFtZXRlcihwQ29udGV4dCwgcC0+cHNpemUsICh2b2lkKilwLT5kYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLT52c2l6ZSwgcC0+ZGF0YSArIHZvZmZzZXQpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgLy9BTE9HVigiXHRFZmZlY3RfY29tbWFuZCBjbWRDb2RlIENhc2U6IEVGRkVDVF9DTURfU0VUX1BBUkFNIGVuZCIpOworICAgICAgICAgICAgLy8gQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX1NFVF9QQVJBTSBlbmQiKTsKICAgICAgICAgfSBicmVhazsKIAogICAgICAgICBjYXNlIEVGRkVDVF9DTURfRU5BQkxFOgpAQCAtMzYwMyw1NyArMzM0Nyw1NiBAQAogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAqKGludCAqKXBSZXBseURhdGEgPSBhbmRyb2lkOjpFZmZlY3Rfc2V0RW5hYmxlZChwQ29udGV4dCwgTFZNX1RSVUUpOworICAgICAgICAgICAgKihpbnQqKXBSZXBseURhdGEgPSBhbmRyb2lkOjpFZmZlY3Rfc2V0RW5hYmxlZChwQ29udGV4dCwgTFZNX1RSVUUpOwogICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX0RJU0FCTEU6Ci0gICAgICAgICAgICAvL0FMT0dWKCJcdEVmZmVjdF9jb21tYW5kIGNtZENvZGUgQ2FzZTogRUZGRUNUX0NNRF9ESVNBQkxFIHN0YXJ0Iik7CisgICAgICAgICAgICAvLyBBTE9HVigiXHRFZmZlY3RfY29tbWFuZCBjbWRDb2RlIENhc2U6IEVGRkVDVF9DTURfRElTQUJMRSBzdGFydCIpOwogICAgICAgICAgICAgaWYgKHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQpKSB7CiAgICAgICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogRWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX0RJU0FCTEU6IEVSUk9SIik7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAqKGludCAqKXBSZXBseURhdGEgPSBhbmRyb2lkOjpFZmZlY3Rfc2V0RW5hYmxlZChwQ29udGV4dCwgTFZNX0ZBTFNFKTsKKyAgICAgICAgICAgICooaW50KilwUmVwbHlEYXRhID0gYW5kcm9pZDo6RWZmZWN0X3NldEVuYWJsZWQocENvbnRleHQsIExWTV9GQUxTRSk7CiAgICAgICAgICAgICBicmVhazsKIAotICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX0RFVklDRToKLSAgICAgICAgeworICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX0RFVklDRTogewogICAgICAgICAgICAgQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX1NFVF9ERVZJQ0Ugc3RhcnQiKTsKLSAgICAgICAgICAgIGlmIChwQ21kRGF0YSAgID09IE5VTEwpeworICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBFZmZlY3RfY29tbWFuZCBjbWRDb2RlIENhc2U6IEVGRkVDVF9DTURfU0VUX0RFVklDRTogRVJST1IiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgdWludDMyX3QgZGV2aWNlID0gKih1aW50MzJfdCAqKXBDbWREYXRhOwotICAgICAgICAgICAgcENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+bk91dHB1dERldmljZSA9IChhdWRpb19kZXZpY2VzX3QpIGRldmljZTsKKyAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UgPSAqKGF1ZGlvX2RldmljZXNfdCAqKXBDbWREYXRhOworICAgICAgICAgICAgcENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+bk91dHB1dERldmljZSA9IGRldmljZTsKIAogICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5FZmZlY3RUeXBlID09IExWTV9CQVNTX0JPT1NUKSB7Ci0gICAgICAgICAgICAgICAgaWYoKGRldmljZSA9PSBBVURJT19ERVZJQ0VfT1VUX1NQRUFLRVIpIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAoZGV2aWNlID09IEFVRElPX0RFVklDRV9PVVRfQkxVRVRPT1RIX1NDT19DQVJLSVQpIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAoZGV2aWNlID09IEFVRElPX0RFVklDRV9PVVRfQkxVRVRPT1RIX0EyRFBfU1BFQUtFUikpeworICAgICAgICAgICAgICAgIGlmICgoZGV2aWNlID09IEFVRElPX0RFVklDRV9PVVRfU1BFQUtFUikgfHwKKyAgICAgICAgICAgICAgICAgICAgKGRldmljZSA9PSBBVURJT19ERVZJQ0VfT1VUX0JMVUVUT09USF9TQ09fQ0FSS0lUKSB8fAorICAgICAgICAgICAgICAgICAgICAoZGV2aWNlID09IEFVRElPX0RFVklDRV9PVVRfQkxVRVRPT1RIX0EyRFBfU1BFQUtFUikpIHsKICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlx0RUZGRUNUX0NNRF9TRVRfREVWSUNFIGRldmljZSBpcyBpbnZhbGlkIGZvciBMVk1fQkFTU19CT09TVCAlZCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICooaW50MzJfdCAqKXBDbWREYXRhKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgKihpbnQzMl90KilwQ21kRGF0YSk7CiAgICAgICAgICAgICAgICAgICAgIEFMT0dWKCJcdEVGRkVDVF9DTURfU0VUX0RFVklDRSB0ZW1wb3JhcnkgZGlzYWJsZSBMVk1fQkFTX0JPT1NUIik7CiAKLSAgICAgICAgICAgICAgICAgICAgLy8gSWYgYSBkZXZpY2UgZG9lc250IHN1cHBvcnQgYmFzc2Jvb3N0IHRoZSBlZmZlY3QgbXVzdCBiZSB0ZW1wb3JhcmlseSBkaXNhYmxlZAorICAgICAgICAgICAgICAgICAgICAvLyBJZiBhIGRldmljZSBkb2Vzbid0IHN1cHBvcnQgYmFzc2Jvb3N0IHRoZSBlZmZlY3QgbXVzdCBiZSB0ZW1wb3JhcmlseSBkaXNhYmxlZAogICAgICAgICAgICAgICAgICAgICAvLyB0aGUgZWZmZWN0IG11c3Qgc3RpbGwgcmVwb3J0IGl0cyBvcmlnaW5hbCBzdGF0ZSBhcyB0aGlzIGNhbiBvbmx5IGJlIGNoYW5nZWQKICAgICAgICAgICAgICAgICAgICAgLy8gYnkgdGhlIEVOQUJMRS9ESVNBQkxFIGNvbW1hbmQKIAogICAgICAgICAgICAgICAgICAgICBpZiAocENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+YkJhc3NFbmFibGVkID09IExWTV9UUlVFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiXHRFRkZFQ1RfQ01EX1NFVF9ERVZJQ0UgZGlzYWJsZSBMVk1fQkFTU19CT09TVCAlZCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICooaW50MzJfdCAqKXBDbWREYXRhKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICooaW50MzJfdCopcENtZERhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDo6THZtRWZmZWN0X2Rpc2FibGUocENvbnRleHQpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPmJCYXNzVGVtcERpc2FibGVkID0gTFZNX1RSVUU7CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlx0RUZGRUNUX0NNRF9TRVRfREVWSUNFIGRldmljZSBpcyB2YWxpZCBmb3IgTFZNX0JBU1NfQk9PU1QgJWQiLAotICAgICAgICAgICAgICAgICAgICAgICAgICooaW50MzJfdCAqKXBDbWREYXRhKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgKihpbnQzMl90KilwQ21kRGF0YSk7CiAKICAgICAgICAgICAgICAgICAgICAgLy8gSWYgYSBkZXZpY2Ugc3VwcG9ydHMgYmFzc2Jvb3N0IGFuZCB0aGUgZWZmZWN0IGhhcyBiZWVuIHRlbXBvcmFyaWx5IGRpc2FibGVkCiAgICAgICAgICAgICAgICAgICAgIC8vIHByZXZpb3VzbHkgdGhlbiByZS1lbmFibGUgaXQKIAogICAgICAgICAgICAgICAgICAgICBpZiAocENvbnRleHQtPnBCdW5kbGVkQ29udGV4dC0+YkJhc3NFbmFibGVkID09IExWTV9UUlVFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiXHRFRkZFQ1RfQ01EX1NFVF9ERVZJQ0UgcmUtZW5hYmxlIExWTV9CQVNTX0JPT1NUICVkIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihpbnQzMl90ICopcENtZERhdGEpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihpbnQzMl90KilwQ21kRGF0YSk7CiAgICAgICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOjpMdm1FZmZlY3RfZW5hYmxlKHBDb250ZXh0KTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5iQmFzc1RlbXBEaXNhYmxlZCA9IExWTV9GQUxTRTsKQEAgLTM2NjQsMTI5ICszNDA3LDEyOCBAQAogICAgICAgICAgICAgICAgICAgICAvLyBkZWZhdWx0IGNhc2UgdW5sZXNzIGNvbmZpZ3VyYXRpb24gaXMgZm9yY2VkCiAgICAgICAgICAgICAgICAgICAgIGlmIChhbmRyb2lkOjpWaXJ0dWFsaXplcklzRGV2aWNlU3VwcG9ydGVkKGRldmljZSkgIT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlx0RUZGRUNUX0NNRF9TRVRfREVWSUNFIGRldmljZSBpcyBpbnZhbGlkIGZvciBMVk1fVklSVFVBTElaRVIgJWQiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKGludDMyX3QgKilwQ21kRGF0YSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKGludDMyX3QqKXBDbWREYXRhKTsKICAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dWKCJcdEVGRkVDVF9DTURfU0VUX0RFVklDRSB0ZW1wb3JhcnkgZGlzYWJsZSBMVk1fVklSVFVBTElaRVIiKTsKIAotICAgICAgICAgICAgICAgICAgICAgICAgLy9JZiBhIGRldmljZSBkb2VzbnQgc3VwcG9ydCB2aXJ0dWFsaXplciB0aGUgZWZmZWN0IG11c3QgYmUgdGVtcG9yYXJpbHkKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIGEgZGV2aWNlIGRvZXNuJ3Qgc3VwcG9ydCB2aXJ0dWFsaXplciB0aGUgZWZmZWN0IG11c3QgYmUgdGVtcG9yYXJpbHkKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRpc2FibGVkIHRoZSBlZmZlY3QgbXVzdCBzdGlsbCByZXBvcnQgaXRzIG9yaWdpbmFsIHN0YXRlIGFzIHRoaXMgY2FuCiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IGJlIGNoYW5nZWQgYnkgdGhlIEVOQUJMRS9ESVNBQkxFIGNvbW1hbmQKIAogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPmJWaXJ0dWFsaXplckVuYWJsZWQgPT0gTFZNX1RSVUUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiXHRFRkZFQ1RfQ01EX1NFVF9ERVZJQ0UgZGlzYWJsZSBMVk1fVklSVFVBTElaRVIgJWQiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihpbnQzMl90ICopcENtZERhdGEpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICooaW50MzJfdCopcENtZERhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6Okx2bUVmZmVjdF9kaXNhYmxlKHBDb250ZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPmJWaXJ0dWFsaXplclRlbXBEaXNhYmxlZCA9IExWTV9UUlVFOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlx0RUZGRUNUX0NNRF9TRVRfREVWSUNFIGRldmljZSBpcyB2YWxpZCBmb3IgTFZNX1ZJUlRVQUxJWkVSICVkIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihpbnQzMl90ICopcENtZERhdGEpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihpbnQzMl90KilwQ21kRGF0YSk7CiAKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIGEgZGV2aWNlIHN1cHBvcnRzIHZpcnR1YWxpemVyIGFuZCB0aGUgZWZmZWN0IGhhcyBiZWVuIHRlbXBvcmFyaWx5CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkaXNhYmxlZCBwcmV2aW91c2x5IHRoZW4gcmUtZW5hYmxlIGl0CiAKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmKHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPmJWaXJ0dWFsaXplckVuYWJsZWQgPT0gTFZNX1RSVUUpeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5wQnVuZGxlZENvbnRleHQtPmJWaXJ0dWFsaXplckVuYWJsZWQgPT0gTFZNX1RSVUUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiXHRFRkZFQ1RfQ01EX1NFVF9ERVZJQ0UgcmUtZW5hYmxlIExWTV9WSVJUVUFMSVpFUiAlZCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKGludDMyX3QgKilwQ21kRGF0YSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihpbnQzMl90KilwQ21kRGF0YSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDo6THZtRWZmZWN0X2VuYWJsZShwQ29udGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBwQ29udGV4dC0+cEJ1bmRsZWRDb250ZXh0LT5iVmlydHVhbGl6ZXJUZW1wRGlzYWJsZWQgPSBMVk1fRkFMU0U7CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IC8vIGVsc2UgdmlydHVhbGl6YXRpb24gbW9kZSBpcyBmb3JjZWQgdG8gYSBjZXJ0YWluIGRldmljZSwgbm90aGluZyB0byBkbworICAgICAgICAgICAgICAgIH0gIC8vIGVsc2UgdmlydHVhbGl6YXRpb24gbW9kZSBpcyBmb3JjZWQgdG8gYSBjZXJ0YWluIGRldmljZSwgbm90aGluZyB0byBkbwogICAgICAgICAgICAgfQogICAgICAgICAgICAgQUxPR1YoIlx0RWZmZWN0X2NvbW1hbmQgY21kQ29kZSBDYXNlOiBFRkZFQ1RfQ01EX1NFVF9ERVZJQ0UgZW5kIik7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQotICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX1ZPTFVNRToKLSAgICAgICAgeworICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX1ZPTFVNRTogewogICAgICAgICAgICAgdWludDMyX3QgbGVmdFZvbHVtZSwgcmlnaHRWb2x1bWU7Ci0gICAgICAgICAgICBpbnQxNl90ICBsZWZ0ZEIsIHJpZ2h0ZEI7Ci0gICAgICAgICAgICBpbnQxNl90ICBtYXhkQiwgcGFuZEI7Ci0gICAgICAgICAgICBpbnQzMl90ICB2b2xfcmV0WzJdID0gezE8PDI0LDE8PDI0fTsgLy8gQXBwbHkgbm8gdm9sdW1lCi0gICAgICAgICAgICBMVk1fQ29udHJvbFBhcmFtc190ICAgICBBY3RpdmVQYXJhbXM7ICAgICAgICAgICAvKiBDdXJyZW50IGNvbnRyb2wgUGFyYW1ldGVycyAqLwotICAgICAgICAgICAgTFZNX1JldHVyblN0YXR1c19lbiAgICAgTHZtU3RhdHVzPUxWTV9TVUNDRVNTOyAgLyogRnVuY3Rpb24gY2FsbCBzdGF0dXMgKi8KKyAgICAgICAgICAgIGludDE2X3QgbGVmdGRCLCByaWdodGRCOworICAgICAgICAgICAgaW50MTZfdCBtYXhkQiwgcGFuZEI7CisgICAgICAgICAgICBpbnQzMl90IHZvbF9yZXRbMl0gPSB7MSA8PCAyNCwgMSA8PCAyNH07ICAgICAvLyBBcHBseSBubyB2b2x1bWUKKyAgICAgICAgICAgIExWTV9Db250cm9sUGFyYW1zX3QgQWN0aXZlUGFyYW1zOyAgICAgICAgICAgIC8qIEN1cnJlbnQgY29udHJvbCBQYXJhbWV0ZXJzICovCisgICAgICAgICAgICBMVk1fUmV0dXJuU3RhdHVzX2VuIEx2bVN0YXR1cyA9IExWTV9TVUNDRVNTOyAvKiBGdW5jdGlvbiBjYWxsIHN0YXR1cyAqLwogCiAgICAgICAgICAgICAvLyBpZiBwUmVwbHlEYXRhIGlzIE5VTEwsIFZPTF9DVFJMIGlzIGRlbGVnYXRlZCB0byBhbm90aGVyIGVmZmVjdAotICAgICAgICAgICAgaWYocFJlcGx5RGF0YSA9PSBMVk1fTlVMTCl7CisgICAgICAgICAgICBpZiAocFJlcGx5RGF0YSA9PSBMVk1fTlVMTCkgewogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCBjbWRTaXplICE9IDIgKiBzaXplb2YodWludDMyX3QpIHx8IHBSZXBseURhdGEgPT0gTlVMTCB8fAotICAgICAgICAgICAgICAgICAgICByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplIDwgMipzaXplb2YoaW50MzJfdCkpIHsKKyAgICAgICAgICAgICAgICByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplIDwgMiAqIHNpemVvZihpbnQzMl90KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IEVmZmVjdF9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfU0VUX1ZPTFVNRTogRVJST1IiKTsKKyAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfVk9MVU1FOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBsZWZ0Vm9sdW1lICA9ICgoKih1aW50MzJfdCAqKXBDbWREYXRhKSk7Ci0gICAgICAgICAgICByaWdodFZvbHVtZSA9ICgoKigodWludDMyX3QgKilwQ21kRGF0YSArIDEpKSk7CisgICAgICAgICAgICBsZWZ0Vm9sdW1lID0gKCgqKHVpbnQzMl90KilwQ21kRGF0YSkpOworICAgICAgICAgICAgcmlnaHRWb2x1bWUgPSAoKCooKHVpbnQzMl90KilwQ21kRGF0YSArIDEpKSk7CiAKLSAgICAgICAgICAgIGlmKGxlZnRWb2x1bWUgPT0gMHgxMDAwMDAwKXsKKyAgICAgICAgICAgIGlmIChsZWZ0Vm9sdW1lID09IDB4MTAwMDAwMCkgewogICAgICAgICAgICAgICAgIGxlZnRWb2x1bWUgLT0gMTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmKHJpZ2h0Vm9sdW1lID09IDB4MTAwMDAwMCl7CisgICAgICAgICAgICBpZiAocmlnaHRWb2x1bWUgPT0gMHgxMDAwMDAwKSB7CiAgICAgICAgICAgICAgICAgcmlnaHRWb2x1bWUgLT0gMTsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgLy8gQ29udmVydCB2b2x1bWUgdG8gZEIKLSAgICAgICAgICAgIGxlZnRkQiAgPSBhbmRyb2lkOjpMVkNfQ29udmVydF9Wb2xUb0RiKGxlZnRWb2x1bWUpOworICAgICAgICAgIC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gogc3RydWN0IFByZXNldENvbmZpZyB7CiAgICAgLy8gSHVtYW4tcmVhZGFibGUgbmFtZS4KLSAgICBjb25zdCBjaGFyICogbmFtZTsKKyAgICBjb25zdCBjaGFyKiBuYW1lOwogICAgIC8vIEFuIGFycmF5IG9mIHNpemUgbkJhbmRzIHdoZXJlIGVhY2ggZWxlbWVudCBpcyBhIGNvbmZpZ3VyYXRpb24gZm9yIHRoZQogICAgIC8vIGNvcnJlc3BvbmRpbmcgYmFuZC4KLSAgICAvL2NvbnN0IEJhbmRDb25maWcgKiBiYW5kQ29uZmlnczsKKyAgICAvLyBjb25zdCBCYW5kQ29uZmlnICogYmFuZENvbmZpZ3M7CiB9OwogCiAvKiBCdW5kbGVkRWZmZWN0Q29udGV4dCA6IE9uZSBwZXIgc2Vzc2lvbiAqLwotc3RydWN0IEJ1bmRsZWRFZmZlY3RDb250ZXh0ewotICAgIExWTV9IYW5kbGVfdCAgICAgICAgICAgICAgICAgICAgaEluc3RhbmNlOyAgICAgICAgICAgICAgICAvKiBJbnN0YW5jZSBoYW5kbGUgKi8KLSAgICBpbnQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNlc3Npb25ObzsgICAgICAgICAgICAgICAgLyogQ3VycmVudCBzZXNzaW9uIG51bWJlciAqLwotICAgIGludCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2Vzc2lvbklkOyAgICAgICAgICAgICAgICAvKiBDdXJyZW50IHNlc3Npb24gaWQgKi8KLSAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJWb2x1bWVFbmFibGVkOyAgICAgICAgICAgLyogRmxhZyBmb3IgVm9sdW1lICovCi0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBiRXF1YWxpemVyRW5hYmxlZDsgICAgICAgIC8qIEZsYWcgZm9yIEVRICovCi0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBiQmFzc0VuYWJsZWQ7ICAgICAgICAgICAgIC8qIEZsYWcgZm9yIEJhc3MgKi8KLSAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJCYXNzVGVtcERpc2FibGVkOyAgICAgICAgLyogRmxhZyBmb3IgQmFzcyB0byBiZSByZS1lbmFibGVkICovCi0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBiVmlydHVhbGl6ZXJFbmFibGVkOyAgICAgIC8qIEZsYWcgZm9yIFZpcnR1YWxpemVyICovCi0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBiVmlydHVhbGl6ZXJUZW1wRGlzYWJsZWQ7IC8qIEZsYWcgZm9yIGVmZmVjdCB0byBiZSByZS1lbmFibGVkICovCi0gICAgYXVkaW9fZGV2aWNlc190ICAgICAgICAgICAgICAgICBuT3V0cHV0RGV2aWNlOyAgICAgICAgICAgIC8qIE91dHB1dCBkZXZpY2UgZm9yIHRoZSBlZmZlY3QgKi8KLSAgICBhdWRpb19kZXZpY2VzX3QgICAgICAgICAgICAgICAgIG5WaXJ0dWFsaXplckZvcmNlZERldmljZTsgLyogRm9yY2VkIGRldmljZSB2aXJ0dWFsaXphdGlvbiBtb2RlKi8KLSAgICBpbnQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE51bWJlckVmZmVjdHNFbmFibGVkOyAgICAgLyogRWZmZWN0cyBpbiB0aGlzIHNlc3Npb24gKi8KLSAgICBpbnQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE51bWJlckVmZmVjdHNDYWxsZWQ7ICAgICAgLyogRWZmZWN0cyBjYWxsZWQgc28gZmFyICovCi0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdFZvbHVtZTsgICAgICAgICAgICAgIC8qIE5vIHNtb290aGluZyBvbiBmaXJzdCBWb2wgY2hhbmdlICovCitzdHJ1Y3QgQnVuZGxlZEVmZmVjdENvbnRleHQgeworICAgIExWTV9IYW5kbGVfdCBoSW5zdGFuY2U7ICAgICAgICAgICAgICAgICAgIC8qIEluc3RhbmNlIGhhbmRsZSAqLworICAgIGludCBTZXNzaW9uTm87ICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEN1cnJlbnQgc2Vzc2lvbiBudW1iZXIgKi8KKyAgICBpbnQgU2Vzc2lvbklkOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBDdXJyZW50IHNlc3Npb24gaWQgKi8KKyAgICBib29sIGJWb2x1bWVFbmFibGVkOyAgICAgICAgICAgICAgICAgICAgICAvKiBGbGFnIGZvciBWb2x1bWUgKi8KKyAgICBib29sIGJFcXVhbGl6ZXJFbmFibGVkOyAgICAgICAgICAgICAgICAgICAvKiBGbGFnIGZvciBFUSAqLworICAgIGJvb2wgYkJhc3NFbmFibGVkOyAgICAgICAgICAgICAgICAgICAgICAgIC8qIEZsYWcgZm9yIEJhc3MgKi8KKyAgICBib29sIGJCYXNzVGVtcERpc2FibGVkOyAgICAgICAgICAgICAgICAgICAvKiBGbGFnIGZvciBCYXNzIHRvIGJlIHJlLWVuYWJsZWQgKi8KKyAgICBib29sIGJWaXJ0dWFsaXplckVuYWJsZWQ7ICAgICAgICAgICAgICAgICAvKiBGbGFnIGZvciBWaXJ0dWFsaXplciAqLworICAgIGJvb2wgYlZpcnR1YWxpemVyVGVtcERpc2FibGVkOyAgICAgICAgICAgIC8qIEZsYWcgZm9yIGVmZmVjdCB0byBiZSByZS1lbmFibGVkICovCisgICAgYXVkaW9fZGV2aWNlc190IG5PdXRwdXREZXZpY2U7ICAgICAgICAgICAgLyogT3V0cHV0IGRldmljZSBmb3IgdGhlIGVmZmVjdCAqLworICAgIGF1ZGlvX2RldmljZXNfdCBuVmlydHVhbGl6ZXJGb3JjZWREZXZpY2U7IC8qIEZvcmNlZCBkZXZpY2UgdmlydHVhbGl6YXRpb24gbW9kZSovCisgICAgaW50IE51bWJlckVmZmVjdHNFbmFibGVkOyAgICAgICAgICAgICAgICAgLyogRWZmZWN0cyBpbiB0aGlzIHNlc3Npb24gKi8KKyAgICBpbnQgTnVtYmVyRWZmZWN0c0NhbGxlZDsgICAgICAgICAgICAgICAgICAvKiBFZmZlY3RzIGNhbGxlZCBzbyBmYXIgKi8KKyAgICBib29sIGZpcnN0Vm9sdW1lOyAgICAgICAgICAgICAgICAgICAgICAgICAvKiBObyBzbW9vdGhpbmcgb24gZmlyc3QgVm9sIGNoYW5nZSAqLwogICAgIC8vIFNhdmVkIHBhcmFtZXRlcnMgZm9yIGVhY2ggZWZmZWN0ICovCiAgICAgLy8gQmFzcyBCb29zdAotICAgIGludCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQmFzc1N0cmVuZ3RoU2F2ZWQ7ICAgICAgICAvKiBDb252ZXJzaW9uIGJldHdlZW4gR2V0L1NldCAqLworICAgIGludCBCYXNzU3RyZW5ndGhTYXZlZDsgLyogQ29udmVyc2lvbiBiZXR3ZWVuIEdldC9TZXQgKi8KICAgICAvLyBFcXVhbGl6ZXIKLSAgICBpbnQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEN1clByZXNldDsgICAgICAgICAgICAgICAgLyogQ3VycmVudCBwcmVzZXQgYmVpbmcgdXNlZCAqLworICAgIGludCBDdXJQcmVzZXQ7IC8qIEN1cnJlbnQgcHJlc2V0IGJlaW5nIHVzZWQgKi8KICAgICAvLyBWaXJ0dWFsemVyCi0gICAgaW50ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaXJ0U3RyZW5ndGhTYXZlZDsgICAgICAgIC8qIENvbnZlcnNpb24gYmV0d2VlbiBHZXQvU2V0ICovCisgICAgaW50IFZpcnRTdHJlbmd0aFNhdmVkOyAvKiBDb252ZXJzaW9uIGJldHdlZW4gR2V0L1NldCAqLwogICAgIC8vIFZvbHVtZQotICAgIGludCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV2ZWxTYXZlZDsgICAgIC8qIGZvciB3aGVuIG11dGUgaXMgc2V0LCBsZXZlbCBtdXN0IGJlIHNhdmVkICovCi0gICAgaW50ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3NpdGlvblNhdmVkOwotICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgICAgICAgYk11dGVFbmFibGVkOyAgIC8qIE11c3Qgc3RvcmUgYXMgbXV0ZSA9IC05NmRCIGxldmVsICovCi0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBiU3RlcmVvUG9zaXRpb25FbmFibGVkOwotICAgIExWTV9Gc19lbiAgICAgICAgICAgICAgICAgICAgICAgU2FtcGxlUmF0ZTsKLSAgICBpbnQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNhbXBsZXNQZXJTZWNvbmQ7Ci0gICAgaW50ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTYW1wbGVzVG9FeGl0Q291bnRFcTsKLSAgICBpbnQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNhbXBsZXNUb0V4aXRDb3VudEJiOwotICAgIGludCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2FtcGxlc1RvRXhpdENvdW50VmlydDsKLSAgICBlZmZlY3RfYnVmZmVyX3QgICAgICAgICAgICAgICAgICp3b3JrQnVmZmVyOwotICAgIGludCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWVDb3VudDsKLSAgICBpbnQzMl90ICAgICAgICAgICAgICAgICAgICAgICAgIGJhbmRHYWluZEJbRklWRUJBTkRfTlVNQkFORFNdOwotICAgIGludCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9sdW1lOwotI2lmZGVmIFNVUFBPUlRfTUMKLSAgICBMVk1fSU5UMzIgICAgICAgICAgICAgICAgICAgICAgIENoTWFzazsKLSNlbmRpZgorICAgIGludCBsZXZlbFNhdmVkOyAvKiBmb3Igd2hlbiBtdXRlIGlzIHNldCwgbGV2ZWwgbXVzdCBiZSBzYXZlZCAqLworICAgIGludCBwb3NpdGlvblNhdmVkOworICAgIGJvb2wgYk11dGVFbmFibGVkOyAvKiBNdXN0IHN0b3JlIGFzIG11dGUgPSAtO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zc2lvbiAqLwotc3RydWN0IFNlc3Npb25Db250ZXh0ewotICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgICAgICAgYkJ1bmRsZWRFZmZlY3RzRW5hYmxlZDsKLSAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJWb2x1bWVJbnN0YW50aWF0ZWQ7Ci0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBiRXF1YWxpemVySW5zdGFudGlhdGVkOwotICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgICAgICAgYkJhc3NJbnN0YW50aWF0ZWQ7Ci0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBiVmlydHVhbGl6ZXJJbnN0YW50aWF0ZWQ7Ci0gICAgQnVuZGxlZEVmZmVjdENvbnRleHQgICAgICAgICAgICAqcEJ1bmRsZWRDb250ZXh0Oworc3RydWN0IFNlc3Npb25Db250ZXh0IHsKKyAgICBib29sIGJCdW5kbGVkRWZmZWN0c0VuYWJsZWQ7CisgICAgYm9vbCBiVm9sdW1lSW5zdGFudGlhdGVkOworICAgIGJvb2wgYkVxdWFsaXplckluc3RhbnRpYXRlZDsKKyAgICBib29sIGJCYXNzSW5zdGFudGlhdGVkOworICAgIGJvb2wgYlZpcnR1YWxpemVySW5zdGFudGlhdGVkOworICAgIEJ1bmRsZWRFZmZlY3RDb250ZXh0KiBwQnVuZGxlZENvbnRleHQ7CiB9OwogCi1zdHJ1Y3QgRWZmZWN0Q29udGV4dHsKLSAgICBjb25zdCBzdHJ1Y3QgZWZmZWN0X2ludGVyZmFjZV9zICppdGZlOwotICAgIGVmZmVjdF9jb25maWdfdCAgICAgICAgICAgICAgICAgY29uZmlnOwotICAgIGx2bV9lZmZlY3RfZW4gICAgICAgICAgICAgICAgICAgRWZmZWN0VHlwZTsKLSAgICBCdW5kbGVkRWZmZWN0Q29udGV4dCAgICAgICAgICAgICpwQnVuZGxlZENvbnRleHQ7CitzdHJ1Y3QgRWZmZWN0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SQU1fTUFYTEVWRUwsICAgICAgICAgICAgICAvLyB0eXBlIFNMbWlsbGliZWwgPSB0eXBlZGVmIFNMdWludDE2IChnZXQpCisgICAgVk9MVU1FX1BBUkFNX01VVEUsICAgICAgICAgICAgICAgICAgLy8gdHlwZSBTTGJvb2xlYW4gID0gdHlwZWRlZiBTTHVpbnQzMiAoc2V0ICYgZ2V0KQorICAgIFZPTFVNRV9QQVJBTV9FTkFCTEVTVEVSRU9QT1NJVElPTiwgIC8vIHR5cGUgU0xib29sZWFuICA9IHR5cGVkZWYgU0x1aW50MzIgKHNldCAmIGdldCkKKyAgICBWT0xVTUVfUEFSQU1fU1RFUkVPUE9TSVRJT04sICAgICAgICAvLyB0eXBlIFNMcGVybWlsbGUgPSB0eXBlZGVmIFNMdWludDE2IChzZXQgJiBnZXQpCiB9IHRfdm9sdW1lX3BhcmFtczsKIAogc3RhdGljIGNvbnN0IGludCBQUkVTRVRfQ1VTVE9NID0gLTE7CiAKLXN0YXRpYyBjb25zdCB1aW50MzJfdCBiYW5kRnJlcVJhbmdlW0ZJVkVCQU5EX05VTUJBTkRTXVsyXSA9IHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHszMDAwMCwgMTIwMDAwfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsxMjAwMDEsIDQ2MDAwMH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7NDYwMDAxLCAxODAwMDAwfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsxODAwMDAxLCA3MDAwMDAwfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs3MDAwMDAxLCAyMDAwMDAwMH19Oworc3RhdGljIGNvbnN0IHVpbnQzMl90IGJhbmRGcmVxUmFuZ2VbRklWRUJBTkRfTlVNQkFORFNdWzJdID0ge3szMDAwMCwgMTIwMDAwfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7MTIwMDAxLCA0NjAwMDB9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHs0NjAwMDEsIDE4MDAwMDB9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsxODAwMDAxLCA3MDAwMDAwfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7NzAwMDAwMSwgMjAwMDAwMDB9fTsKIAotLy9Ob3RlOiBJZiB0aGVzZSBmcmVxdWVuY2llcyBjaGFuZ2UsIHBsZWFzZSB1cGRhdGUgTGltaXRMZXZlbCB2YWx1ZXMgYWNjb3JkaW5nbHkuCi1zdGF0aWMgY29uc3QgTFZNX1VJTlQxNiAgRVFOQl81QmFuZFByZXNldHNGcmVxdWVuY2llc1tdID0gewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjAsICAgICAgICAgICAvKiBGcmVxdWVuY2llcyBpbiBIeiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjMwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOTEwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzYwMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE0MDAwfTsKKy8vIE5vdGU6IElmIHRoZXNlIGZyZXF1ZW5jaWVzIGNoYW5nZSwgcGxlYXNlIHVwZGF0ZSBMaW1pdExldmVsIHZhbHVlcyBhY2NvcmRpbmdseS4KK3N0YXRpYyBjb25zdCBMVk1fVUlOVDE2IEVRTkJfNUJhbmRQcmVzZXRzRnJlcXVlbmNpZXNbXSA9IHs2MCwgLyogRnJlcXVlbmNpZXMgaW4gSHogKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMzAsIDkxMCwgMzYwMCwgMTQwMDB9OwogCi1zdGF0aWMgY29uc3QgTFZNX1VJTlQxNiBFUU5CXzVCYW5kUHJlc2V0c1FGYWN0b3JzW10gPSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5NiwgICAgICAgICAgICAgICAvKiBRIGZhY3RvciBtdWx0aXBsaWVkIGJ5IDEwMCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOTYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5NiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDk2LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOTZ9Oworc3RhdGljIGNvbnN0IExWTV9VSU5UMTYgRVFOQl81QmFuZFByZXNldHNRRmFjdG9yc1tdID0gezk2LCAvKiBRIGZhY3RvciBtdWx0aXBsaWVkIGJ5IDEwMCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDk2LCA5NiwgOTYsIDk2fTsKIAotc3RhdGljIGNvbnN0IExWTV9JTlQxNiBFUU5CXzVCYW5kTm9ybWFsUHJlc2V0c1tdID0gewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywgMCwgMCwgMCwgMywgICAgICAgLyogTm9ybWFsIFByZXNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwgNSwgLTMsIDUsIDYsICAgICAgLyogQ2xhc3NpY2FsIFByZXNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsIC02LCA3LCAxMywgMTAsICAgLyogRGFuY2UgUHJlc2V0ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCAwLCAwLCAwLCAwLCAgICAgICAvKiBGbGF0IFByZXNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwgLTIsIC0yLCA2LCAtMywgICAgLyogRm9sayBQcmVzZXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsIC04LCAxMywgLTEsIC00LCAgIC8qIEhlYXZ5IE1ldGFsIFByZXNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsIDYsIC00LCA1LCA4LCAgICAgLyogSGlwIEhvcCBQcmVzZXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsIDUsIC00LCA1LCA5LCAgICAgIC8qIEphenogUHJlc2V0ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC02LCA0LCA5LCA0LCAtNSwgICAgICAvKiBQb3AgUHJlc2V0ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwgNiwgLTEsIDgsIDEwfTsgICAvKiBSb2NrIFByZXNldCAqLworc3RhdGljIGNvbnN0IExWTV9JTlQxNiBFUU5CXzVCYW5kTm9ybWFsUHJlc2V0c1tdID0gezMsICAwLCAgMCwgIDAsICAzLCAgIC8qIE5vcm1hbCBQcmVzZXQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LCAgNSwgIC0zLCA1LCAgNiwgICAvKiBDbGFzc2ljYWwgUHJlc2V0ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsIC02LCA3LCAgMTMsIDEwLCAgLyogRGFuY2UgUHJlc2V0ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgIDAsICAwLCAgMCwgIDAsICAgLyogRmxhdCBQcmVzZXQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LCAgLTIsIC0yLCA2LCAgLTMsICAvKiBGb2xrIFByZXNldCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsICAtOCwgMTMsIC0xLCAtNCwgIC8qIEhlYXZ5IE1ldGFsIFByZXNldCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLCA2LCAgLTQsIDUsICA4LCAgIC8qIEhpcCBIb3AgUHJlc2V0ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwgIDUsICAtNCwgNSwgIDksICAgLyogSmF6eiBQcmVzZXQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtNiwgNCwgIDksICA0LCAgLTUsICAvKiBQb3AgUHJlc2V0ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsIDYsICAtMSwgOCwgIDEwfTsgLyogUm9jayBQcmVzZXQgKi8KIAotc3RhdGljIGNvbnN0IExWTV9JTlQxNiBFUU5CXzVCYW5kU29mdFByZXNldHNbXSA9IHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLCAwLCAwLCAwLCAzLCAgICAgIC8qIE5vcm1hbCBQcmVzZXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1LCAzLCAtMiwgNCwgNCwgICAgIC8qIENsYXNzaWNhbCBQcmVzZXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LCAwLCAyLCA0LCAxLCAgICAgIC8qIERhbmNlIFByZXNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIDAsIDAsIDAsIDAsICAgICAgLyogRmxhdCBQcmVzZXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLCAwLCAwLCAyLCAtMSwgICAgIC8qIEZvbGsgUHJlc2V0ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwgMSwgOSwgMywgMCwgICAgICAvKiBIZWF2eSBNZXRhbCBQcmVzZXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1LCAzLCAwLCAxLCAzLCAgICAgIC8qIEhpcCBIb3AgUHJlc2V0ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwgMiwgLTIsIDIsIDUsICAgICAvKiBKYXp6IFByZXNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEsIDIsIDUsIDEsIC0yLCAgICAgLyogUG9wIFByZXNldCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUsIDMsIC0xLCAzLCA1fTsgICAgLyogUm9jayBQcmVzZXQgKi8KK3N0YXRpYyBjb25zdCBMVk1fSU5UMTYgRVFOQl81QmFuZFNvZnRQcmVzZXRzW10gPSB7MywgIDAsIDAsICAwLCAzLCAgLyogTm9ybWFsIFByZXNldCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1LCAgMywgLTIsIDQsIDQsICAvKiBDbGFzc2ljYWwgUHJlc2V0ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsICAwLCAyLCAgNCwgMSwgIC8qIERhbmNlIFByZXNldCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCAgMCwgMCwgIDAsIDAsICAvKiBGbGF0IFByZXNldCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLCAgMCwgMCwgIDIsIC0xLCAvKiBGb2xrIFByZXNldCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LCAgMSwgOSwgIDMsIDAsICAvKiBIZWF2eSBNZXRhbCBQcmVzZXQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNSwgIDMsIDAsICAxLCAzLCAgLyogSGlwIEhvcCBQcmVzZXQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwgIDIsIC0yLCAyLCA1LCAgLyogSmF6eiBQcmVzZXQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEsIDIsIDUsICAxLCAtMiwgLyogUG9wIFByZXNldCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1LCAgMywgLTEsIDMsIDV9OyAvKiBSb2NrIFByZXNldCAqLwogCi1zdGF0aWMgY29uc3QgUHJlc2V0Q29uZmlnIGdFcXVhbGl6ZXJQcmVzZXRzW10gPSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJOb3JtYWwifSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IkNsYXNzaWNhbCJ9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsiRGFuY2UifSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IkZsYXQifSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IkZvbGsifSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IkhlYXZ5IE1ldGFsIn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJIaXAgSG9wIn0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJKYXp6In0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJQb3AifSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IlJvY2sifX07CitzdGF0aWMgY29uc3QgUHJlc2V0Q29uZmlnIGdFcXVhbGl6ZXJQcmVzZXRzW10gPSB7eyJOb3JtYWwifSwgeyJDbGFzc2ljYWwifSwgICB7IkRhbmNlIn0sICAgeyJGbGF0In0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJGb2xrIn0sICAgeyJIZWF2eSBNZXRhbCJ9LCB7IkhpcCBIb3AifSwgeyJKYXp6In0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJQb3AifSwgICAgeyJSb2NrIn19OwogCiAvKiBUaGUgZm9sbG93aW5nIHRhYmxlcyBoYXZlIGJlZW4gY29tcHV0ZWQgdXNpbmcgdGhlIGFjdHVhbCBsZXZlbHMgbWVhc3VyZWQgYnkgdGhlIG91dHB1dCBvZgogICogd2hpdGUgbm9pc2Ugb3IgcGluayBub2lzZSAoSUVDMjY4LTEpIGZvciB0aGUgRVEgYW5kIEJhc3NCb29zdCBFZmZlY3RzLiBUaGVzZSBhcmUgZXN0aW1hdGVzIG9mCkBAIC0yMDEsMTQgKzE3MywxNCBAQAogICogdXBkYXRlZC4KICAqLwogCi1zdGF0aWMgY29uc3QgZmxvYXQgTGltaXRMZXZlbF9iYW5kRW5lcmd5Q29lZmZpY2llbnRbRklWRUJBTkRfTlVNQkFORFNdID0gewotICAgICAgICA3LjU2LCA5LjY5LCA5LjU5LCA3LjM3LCAyLjg4fTsKK3N0YXRpYyBjb25zdCBmbG9hdCBMaW1pdExldmVsX2JhbmRFbmVyZ3lDb2VmZmljaWVudFtGSVZFQkFORF9OVU1CQU5EU10gPS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GluICVzXG5cblxuXG4iLCBjYWxsaW5nRnVuYywgY2FsbGVkRnVuYyk7XAotICAgICAgICB9XAotICAgICAgICBpZiAoKEx2bVN0YXR1cykgPT0gTFZSRVZfSU5WQUxJRE5VTVNBTVBMRVMpe1wKLSAgICAgICAgICAgIEFMT0dWKCJcdExWUkVWX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIlwKLSAgICAgICAgICAgICAgICAgICAgImJhZCBudW1iZXIgb2Ygc2FtcGxlcyByZXR1cm5lZCBieSAlcyBpbiAlc1xuXG5cblxuIiwgY2FsbGluZ0Z1bmMsIGNhbGxlZEZ1bmMpO1wKLSAgICAgICAgfVwKLSAgICAgICAgaWYgKChMdm1TdGF0dXMpID09IExWUkVWX09VVE9GUkFOR0Upe1wKLSAgICAgICAgICAgIEFMT0dWKCJcdExWUkVWX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIlwKLSAgICAgICAgICAgICAgICAgICAgIm91dCBvZiByYW5nZSByZXR1cm5lZCBieSAlcyBpbiAlc1xuIiwgY2FsbGluZ0Z1bmMsIGNhbGxlZEZ1bmMpO1wKLSAgICAgICAgfVwKKyNkZWZpbmUgTFZNX0VSUk9SX0NIRUNLKEx2bVN0YXR1cywgY2FsbGluZ0Z1bmMsIGNhbGxlZEZ1bmMpICAgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgaWYgKChMdm1TdGF0dXMpID09IExWUkVWX05VTExBRERSRVNTKSB7ICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIEFMT0dWKCJcdExWUkVWX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICJudWxsIHBvaW50ZXIgcmV0dXJuZWQgYnkgJXMgaW4gJXNcblxuXG5cbiIsICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIGNhbGxpbmdGdW5jLCBjYWxsZWRGdW5jKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgaWYgKChMdm1TdGF0dXMpID09IExWUkVWX0lOVkFMSUROVU1TQU1QTEVTKSB7ICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIEFMT0dWKCJcdExWUkVWX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICJiYWQgbnVtYmVyIG9mIHNhbXBsZXMgcmV0dXJuZWQgYnkgJXMgaW4gJXNcblxuXG5cbiIsIFwKKyAgICAgICAgICAgICAgICAgIGNhbGxpbmdGdW5jLCBjYWxsZWRGdW5jKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgaWYgKChMdm1TdGF0dXMpID09IExWUkVWX09VVE9GUkFOR0UpIHsgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIEFMT0dWKCJcdExWUkVWX0VSUk9SIDogUGFyYW1ldGVyIGVycm9yIC0gIiAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICJvdXQgb2YgcmFuZ2UgcmV0dXJuZWQgYnkgJXMgaW4gJXNcbiIsICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIGNhbGxpbmdGdW5jLCBjYWxsZWRGdW5jKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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3IsCi0gICAgICAgICZnSW5zZXJ0RW52UmV2ZXJiRGVzY3JpcHRvciwKLSAgICAgICAgJmdBdXhQcmVzZXRSZXZlcmJEZXNjcmlwdG9yLAotICAgICAgICAmZ0luc2VydFByZXNldFJldmVyYkRlc2NyaXB0b3IKLX07CitzdGF0aWMgY29uc3QgZWZmZWN0X2Rlc2NyaXB0b3JfdCogY29uc3QgZ0Rlc2NyaXB0b3JzW10gPSB7CisgICAgICAgICZnQXV4RW52UmV2ZXJiRGVzY3JpcHRvciwgJmdJbnNlcnRFbnZSZXZlcmJEZXNjcmlwdG9yLCAmZ0F1eFByZXNldFJldmVyYkRlc2NyaXB0b3IsCisgICAgICAgICZnSW5zZXJ0UHJlc2V0UmV2ZXJiRGVzY3JpcHRvcn07CiAKLXR5cGVkZWYgICAgIGZsb2F0ICAgICAgICAgICAgICAgcHJvY2Vzc19idWZmZXJfdDsgLy8gcHJvY2VzcyBpbiBmbG9hdAordHlwZWRlZiBmbG9hdCBwcm9jZXNzX2J1ZmZlcl90OyAgLy8gcHJvY2VzcyBpbiBmbG9hdAogCi1zdHJ1Y3QgUmV2ZXJiQ29udGV4dHsKLSAgICBjb25zdCBzdHJ1Y3QgZWZmZWN0X2ludGVyZmFjZV9zICppdGZlOwotICAgIGVmZmVjdF9jb25maWdfdCAgICAgICAgICAgICAgICAgY29uZmlnOwotICAgIExWUkVWX0hhbmRsZV90ICAgICAgICAgICAgICAgICAgaEluc3RhbmNlOwotICAgIGludDE2X3QgICAgICAgICAgICAgICAgICAgICAgICAgU2F2ZWRSb29tTGV2ZWw7Ci0gICAgaW50MTZfdCAgICAgICAgICAgICAgICAgICAgICAgICBTYXZlZEhmTGV2ZWw7Ci0gICAgaW50MTZfdCAgICAgICAgICAgICAgICAgICAgICAgICBTYXZlZERlY2F5VGltZTsKLSAgICBpbnQxNl90ICAgICAgICAgICAgICAgICAgICAgICAgIFNhdmVkRGVjYXlIZlJhdGlvOwotICAgIGludDE2X3QgICAgICAgICAgICAgICAgICAgICAgICAgU2F2ZWRSZXZlcmJMZXZlbDsKLSAgICBpbnQxNl90ICAgICAgICAgICAgICAgICAgICAgICAgIFNhdmVkRGlmZnVzaW9uOwotICAgIGludDE2X3QgICAgICAgICAgICAgICAgICAgICAgICAgU2F2ZWREZW5zaXR5OwotICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgICAgICAgYkVuYWJsZWQ7Ci0gICAgTFZNX0ZzX2VuICAgICAgICAgICAgICAgICAgICAgICBTYW1wbGVSYXRlOwotICAgIHByb2Nlc3NfYnVmZmVyX3QgICAgICAgICAgICAgICAgKkluRnJhbWVzOwotICAgIHByb2Nlc3NfYnVmZmVyX3QgICAgICAgICAgICAgICAgKk91dEZyYW1lczsKLSAgICBzaXplX3QgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlclNpemVJbjsKLSAgICBzaXplX3QgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlclNpemVPdXQ7Ci0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdXhpbGlhcnk7Ci0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVzZXQ7Ci0gICAgdWludDE2X3QgICAgICAgICAgICAgICAgICAgICAgICBjdXJQcmVzZXQ7Ci0gICAgdWludDE2X3QgICAgICAgICAgICAgICAgICAgICAgICBuZXh0UHJlc2V0OwotICAgIGludCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2FtcGxlc1RvRXhpdENvdW50OwotICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgICAgICAgbGVmdFZvbHVtZTsKLSAgICBMVk1fSU5UMTYgICAgICAgICAgICAgICAgICAgICAgIHJpZ2h0Vm9sdW1lOwotICAgIExWTV9JTlQxNiAgICAgICAgICAgICAgICAgICAgICAgcHJldkxlZnRWb2x1bWU7Ci0gICAgTFZNX0lOVDE2ICAgICAgICAgICAgICAgICAgICAgICBwcmV2UmlnaHRWb2x1bWU7Ci0gICAgaW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CkgeyAgICAgICAgICAgICAgICAgICAgIFwKLSAgICBpZiAoIShjb25kKSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IEludmFsaWQgYXJndW1lbnQ6ICIjY29uZCk7ICAgICAgXAotICAgICAgICByZXR1cm4gLUVJTlZBTDsgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi19CisjZGVmaW5lIENIRUNLX0FSRyhjb25kKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgaWYgKCEoY29uZCkpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBJbnZhbGlkIGFyZ3VtZW50OiAiICNjb25kKTsgXAorICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgfQogCiAvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KIC8vIHByb2Nlc3MoKQpAQCAtMzM1LDkxICszMzEsMTAxIEBACiAvLyAgcE91dDogICAgICAgcG9pbnRlciB0byB1cGRhdGVkIHN0ZXJlbyAxNiBiaXQgb3V0cHV0IGRhdGEKIC8vCiAvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS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yk+Ojp2YWx1ZSwKLSAgICAgICAgICAgICAgICAicEluIGFuZCBJbkZyYW1lcyBtdXN0IGJlIHNhbWUgdHlwZSIpOworICAgICAgICAgICAgICAgICAgICAgICJwSW4gYW5kIEluRnJhbWVzIG11c3QgYmUgc2FtZSB0eXBlIik7CiAgICAgICAgIG1lbWNweShwQ29udGV4dC0+SW5GcmFtZXMsIHBJbiwgZnJhbWVDb3VudCAqIGNoYW5uZWxzICogc2l6ZW9mKCpwSW4pKTsKKyAgICB9IGVsc2UgeworICAgICAgICAvLyBtb25vIGlucHV0IGlzIGR1cGxpY2F0ZWQKKyAgICAgICAgaWYgKGNoYW5uZWxzID49IEZDQ18yKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGZyYW1lQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIHBDb250ZXh0LT5JbkZyYW1lc1tGQ0NfMiAqIGldID0KKyAgICAgICAgICAgICAgICAgICAgICAgIChwcm9jZXNzX2J1ZmZlcl90KXBJbltjaGFubmVscyAqIGldICogUkVWRVJCX1NFTkRfTEVWRUw7CisgICAgICAgICAgICAgICAgcENvbnRleHQtPkluRnJhbWVzW0ZDQ18yICogaSArIDFdID0KKyAgICAgICAgICAgICAgICAgICAgICAgIChwcm9jZXNzX2J1ZmZlcl90KXBJbltjaGFubmVscyAqIGkgKyAxXSAqIFJFVkVSQl9TRU5EX0xFVkVMOworICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewotICAgICAgICAvLyBpbnNlcnQgcmV2ZXJiIGlucHV0IGlzIGFsd2F5cyBzdGVyZW8KLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBmcmFtZUNvdW50OyBpKyspIHsKLSAgICAgICAgICAgIHBDb250ZXh0LT5JbkZyYW1lc1syICogaV0gPSAocHJvY2Vzc19idWZmZXJfdClwSW5bMiAqIGldICogUkVWRVJCX1NFTkRfTEVWRUw7Ci0gICAgICAgICAgICBwQ29udGV4dC0+SW5GcmFtZXNbMiAqIGkgKyAxXSA9IChwcm9jZXNzX2J1ZmZlcl90KXBJblsyICogaSArIDFdICogUkVWRVJCX1NFTkRfTEVWRUw7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGZyYW1lQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIHBDb250ZXh0LT5JbkZyYW1lc1tGQ0NfMiAqIGldID0gcENvbnRleHQtPkluRnJhbWVzW0ZDQ18yICogaSArIDFdID0KKyAgICAgICAgICAgICAgICAgICAgICAgIChwcm9jZXNzX2J1ZmZlcl90KXBJbltpXSAqIFJFVkVSQl9TRU5EX0xFVkVMOworICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQogCiAgICAgaWYgKHBDb250ZXh0LT5wcmVzZXQgJiYgcENvbnRleHQtPmN1clByZXNldCA9PSBSRVZFUkJfUFJFU0VUX05PTkUpIHsKICAgICAgICAgbWVtc2V0KHBDb250ZXh0LT5PdXRGcmFtZXMsIDAsCi0gICAgICAgICAgICAgICAgZnJhbWVDb3VudCAqIHNpemVvZigqcENvbnRleHQtPk91dEZyYW1lcykgKiBGQ0NfMik7IC8vYWx3YXlzIHN0ZXJlbyBoZXJlCisgICAgICAgICAgICAgICBmcmFtZUNvdW50ICogc2l6ZW9mKCpwQ29udGV4dC0+T3V0RnJhbWVzKSAqIEZDQ18yKTsgIC8vIGFsd2F5cyBzdGVyZW8gaGVyZQogICAgIH0gZWxzZSB7Ci0gICAgICAgIGlmKHBDb250ZXh0LT5iRW5hYmxlZCA9PSBMVk1fRkFMU0UgJiYgcENvbnRleHQtPlNhbXBsZXNUb0V4aXRDb3VudCA+IDApIHsKLSAgICAgICAgICAgIG1lbXNldChwQ29udGV4dC0+SW5GcmFtZXMsIDAsCi0gICAgICAgICAgICAgICAgICAgIGZyYW1lQ291bnQgKiBzaXplb2YoKnBDb250ZXh0LT5PdXRGcmFtZXMpICogY2hhbm5lbHMpOworICAgICAgICBpZiAocENvbnRleHQtPmJFbmFibGVkID09IExWTV9GQUxTRSAmJiBwQ29udGV4dC0+U2FtcGxlc1RvRXhpdENvdW50ID4gMCkgeworICAgICAgICAgICAgbWVtc2V0KHBDb250ZXh0LT5JbkZyYW1lcywgMCwgZnJhbWVDb3VudCAqIHNpemVvZigqcENvbnRleHQtPk91dEZyYW1lcykgKiBjaGFubmVscyk7CiAgICAgICAgICAgICBBTE9HVigiXHRaZXJvaW5nICVkIHNhbXBsZXMgcGVyIGZyYW1lIGF0IHRoZSBlbmQgb2YgY2FsbCIsIGNoYW5uZWxzKTsKICAgICAgICAgfQogCiAgICAgICAgIC8qIFByb2Nlc3MgdGhlIHNhbXBsZXMsIHByb2R1Y2luZyBhIHN0ZXJlbyBvdXRwdXQgKi8KLSAgICAgICAgTHZtU3RhdHVzID0gTFZSRVZfUHJvY2VzcyhwQ29udGV4dC0+aEluc3RhbmNlLCAgICAgIC8qIEluc3RhbmNlIGhhbmRsZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBDb250ZXh0LT5JbkZyYW1lcywgICAgIC8qIElucHV0IGJ1ZmZlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBDb250ZXh0LT5PdXRGcmFtZXMsICAgIC8qIE91dHB1dCBidWZmZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcmFtZUNvdW50KTsgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBzYW1wbGVzIHRvIHJlYWQgKi8KKyAgICAgICAgTHZtU3RhdHVzID0gTFZSRVZfUHJvY2VzcyhwQ29udGV4dC0+aEluc3RhbmNlLCAvKiBJbnN0YW5jZSBoYW5kbGUgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwQ29udGV4dC0+SW5GcmFtZXMsICAvKiBJbnB1dCBidWZmZXIgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwQ29udGV4dC0+T3V0RnJhbWVzLCAvKiBPdXRwdXQgYnVmZmVyICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWVDb3VudCk7ICAgICAgICAgLyogTnVtYmVyIG9mIHNhbXBsZXMgdG8gcmVhZCAqLwogICAgIH0KIAogICAgIExWTV9FUlJPUl9DSEVDSyhMdm1TdGF0dXMsICJMVlJFVl9Qcm9jZXNzIiwgInByb2Nlc3MiKQotICAgIGlmKEx2bVN0YXR1cyAhPSBMVlJFVl9TVUNDRVNTKSByZXR1cm4gLUVJTlZBTDsKKyAgICBpZiAoTHZtU3RhdHVzICE9IExWUkVWX1NVQ0NFU1MpIHJldHVybiAtRUlOVkFMOwogCiAgICAgLy8gQ29udmVydCB0byAxNiBiaXRzCiAgICAgaWYgKHBDb250ZXh0LT5hdXhpbGlhcnkpIHsKICAgICAgICAgLy8gbm90aGluZyB0byBkbyBoZXJlCiAgICAgfSBlbHNlIHsKLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBmcmFtZUNvdW50ICogRkNDXzI7IGkrKykgeyAvLyBhbHdheXMgc3RlcmVvIGhlcmUKLSAgICAgICAgICAgIC8vIE1peCB3aXRoIGRyeSBpbnB1dAotICAgICAgICAgICAgcENvbnRleHQtPk91dEZyYW1lc1tpXSArPSBwSW5baV07CisgICAgICAgIGlmIChjaGFubmVscyA+PSBGQ0NfMikgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBmcmFtZUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICAvLyBNaXggd2l0aCBkcnkgaW5wdXQKKyAgICAgICAgICAgICAgICBwQ29udGV4dC0+T3V0RnJhbWVzW0ZDQ18yICogaV0gKz0gcEluW2NoYW5uZWxzICogaV07CisgICAgICAgICAgICAgICAgcENvbnRleHQtPk91dEZyYW1lc1tGQ0NfMiAqIGkgKyAxXSArPSBwSW5bY2hhbm5lbHMgKiBpICsgMV07CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGZyYW1lQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIC8vIE1peCB3aXRoIGRyeSBpbnB1dAorICAgICAgICAgICAgICAgIHBDb250ZXh0LT5PdXRGcmFtZXNbRkNDXzIgKiBpXSArPSBwSW5baV07CisgICAgICAgICAgICAgICAgcENvbnRleHQtPk91dEZyYW1lc1tGQ0NfMiAqIGkgKyAxXSArPSBwSW5baV07CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICAgICAgLy8gYXBwbHkgdm9sdW1lIHdpdGggcmFtcCBpZiBuZWVkZWQKICAgICAgICAgaWYgKChwQ29udGV4dC0+bGVmdFZvbHVtZSAhPSBwQ29udGV4dC0+cHJldkxlZnRWb2x1bWUgfHwKLSAgICAgICAgICAgICAgICBwQ29udGV4dC0+cmlnaHRWb2x1bWUgIT0gcENvbnRleHQtPnByZXZSaWdodFZvbHVtZSkgJiYKLSAgICAgICAgICAgICAgICBwQ29udGV4dC0+dm9sdW1lTW9kZSA9PSBSRVZFUkJfVk9MVU1FX1JBTVApIHsKKyAgICAgICAgICAgICBwQ29udGV4dC0+cmlnaHRWb2x1bWUgIT0gcENvbnRleHQtPnByZXZSaWdodFZvbHVtZSkgJiYKKyAgICAgICAgICAgIHBDb250ZXh0LT52b2x1bWVNb2RlID09IFJFVkVSQl9WT0xVTUVfUkFNUCkgewogICAgICAgICAgICAgLy8gRklYTUU6IHN0aWxsIHVzaW5nIGludDE2IHZvbHVtZXMuCiAgICAgICAgICAgICAvLyBGb3IgcmVmZXJlbmNlOiBSRVZFUkJfVU5JVF9WT0xVTUUgICgweDEwMDApIC8vIDEuMCBpbiA0LjEyIGZvcm1hdAogICAgICAgICAgICAgZmxvYXQgdmwgPSAoZmxvYXQpcENvbnRleHQtPnByZXZMZWZ0Vm9sdW1lIC8gNDA5NjsKQEAgLTQ1MCwyMCArNDU2LDUxIEBACiAgICAgICAgIH0KICAgICB9CiAKLQotICAgIC8vIEFjY3Vtd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ICsgMV0gPSBwQ29udGV4dC0+T3V0RnJhbWVzW0ZDQ18yICogaSArIDFdOworICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgfWVsc2V7Ci0gICAgICAgIC8vQUxPR1YoIlx0QnVmZmVyIGFjY2VzcyBpcyBXUklURSIpOwotICAgICAgICBtZW1jcHkocE91dCwgcENvbnRleHQtPk91dEZyYW1lcywgZnJhbWVDb3VudCAqIHNpemVvZigqcE91dCkgKiBGQ0NfMik7CisgICAgICAgIGlmICghcENvbnRleHQtPmF1eGlsaWFyeSkgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBmcmFtZUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICAvLyBjaGFubmVscyBhbmQgb3V0Q2hhbm5lbHMgYXJlIGV4cGVjdGVkIHRvIGJlIHNhbWUuCisgICAgICAgICAgICAgICAgZm9yIChpbnQgaiA9IEZDQ18yOyBqIDwgb3V0Q2hhbm5lbHM7IGorKykgeworICAgICAgICAgICAgICAgICAgICBwT3V0W291dENoYW5uZWxzICogaSArIGpdID0gcEluW291dENoYW5uZWxzICogaSArIGpdOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0gZWxzZSB7CisgICAgICAgIGlmIChwQ29udGV4dC0+Y29uZmlnLm91dHB1dENmZy5hY2Nlc3NNb2RlID09IEVGRkVDVF9CVUZGRVJfQUNDRVNTX0FDQ1VNVUxBVEUpIHsKKyAgICAgICAgICAgIGlmIChvdXRDaGFubmVscyA9PSBGQ0NfMSkgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZnJhbWVDb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHBPdXRbaV0gKz0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKHBDb250ZXh0LT5PdXRGcmFtZXNbaSAqIEZDQ18yXSArIHBDb250ZXh0LT5PdXRGcmFtZXNbaSAqIEZDQ18yICsgMV0pICoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC41Zik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGZyYW1lQ291bnQgKiBGQ0NfMjsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHBPdXRbaV0gKz0gcENvbnRleHQtPk91dEZyYW1lc1tpXTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpZiAob3V0Q2hhbm5lbHMgPT0gRkNDXzEpIHsKKyAgICAgICAgICAgICAgICBGcm9tMmlUb01vbm9fRmxvYXQoKGNvbnN0IHByb2Nlc3NfYnVmZmVyX3QqKXBDb250ZXh0LT5PdXRGcmFtZXMsIHBPdXQsIGZyYW1lQ291bnQpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBtZW1jcHkocE91dCwgcENvbnRleHQtPk91dEZyYW1lcywgZnJhbWVDb3VudCAqIHNpemVvZigqcE91dCkgKiBGQ0NfMik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KICAgICB9CiAKICAgICByZXR1cm4gMDsKLX0gICAgLyogZW5kIHByb2Nlc3MgKi8KK30gLyogZW5kIHByb2Nlc3MgKi8KIAogLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiAvLyBSZXZlcmJfZnJlZSgpCkBAIC00NzcsMzAgKzUxNCwxMiBAQAogLy8KIC8vLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogCi12b2lkIFJldmVyYl9mcmVlKFJldmVyYkNvbnRleHQgKnBDb250Z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N0aW9ucyBhcmUKK2ludCBSZXZlcmJfTG9hZFByZXNldChSZXZlcmJDb250ZXh0KiBwQ29udGV4dCkgeworICAgIC8vIFRPRE86IGFkZCByZWZsZWN0aW9ucyBkZWxheSwgbGV2ZWwgYW5kIHJldmVyYiBkZWxheSB3aGVuIGVhcmx5IHJlZmxlY3Rpb25zIGFyZQogICAgIC8vIGltcGxlbWVudGVkCiAgICAgcENvbnRleHQtPmN1clByZXNldCA9IHBDb250ZXh0LT5uZXh0UHJlc2V0OwogCiAgICAgaWYgKHBDb250ZXh0LT5jdXJQcmVzZXQgIT0gUkVWRVJCX1BSRVNFVF9OT05FKSB7Ci0gICAgICAgIGNvbnN0IHRfcmV2ZXJiX3NldHRpbmdzICpwcmVzZXQgPSAmc1JldmVyYlByZXNldHNbcENvbnRleHQtPmN1clByZXNldF07CisgICAgICAgIGNvbnN0IHRfcmV2ZXJiX3NldHRpbmdzKiBwcmVzZXQgPSAmc1JldmVyYlByZXNldHNbcENvbnRleHQtPmN1clByZXNldF07CiAgICAgICAgIFJldmVyYlNldFJvb21MZXZlbChwQ29udGV4dCwgcHJlc2V0LT5yb29tTGV2ZWwpOwogICAgICAgICBSZXZlcmJTZXRSb29tSGZMZXZlbChwQ29udGV4dCwgcHJlc2V0LT5yb29tSEZMZXZlbCk7CiAgICAgICAgIFJldmVyYlNldERlY2F5VGltZShwQ29udGV4dCwgcHJlc2V0LT5kZWNheVRpbWUpOwogICAgICAgICBSZXZlcmJTZXREZWNheUhmUmF0aW8ocENvbnRleHQsIHByZXNldC0+ZGVjYXlIRlJhdGlvKTsKLSAgICAgICAgLy9yZWZsZWN0aW9uc0xldmVsCi0gICAgICAgIC8vcmVmbGVjdGlvbnNEZWxheQorICAgICAgICAvLyByZWZsZWN0aW9uc0xldmVsCisgICAgICAgIC8vIHJlZmxlY3Rpb25zRGVsYXkKICAgICAgICAgUmV2ZXJiU2V0UmV2ZXJiTGV2ZWwocENvbnRleHQsIHByZXNldC0+cmV2ZXJiT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ogICAgICAgICBpZiAocGFyYW0gIT0gUkVWRVJCX1BBUkFNX1BSRVNFVCB8fCAqcFZhbHVlU2l6ZSA8IHNpemVvZih1aW50MTZfdCkpIHsKICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICB9CiAKLSAgICAgICAgKih1aW50MTZfdCAqKXBWYWx1ZSA9IHBDb250ZXh0LT5uZXh0UHJlc2V0OworICAgICAgICAqKHVpbnQxNl90KilwVmFsdWUgPSBwQ29udGV4dC0+bmV4dFByZXNldDsKICAgICAgICAgQUxPR1YoImdldCBSRVZFUkJfUEFSQU1fUFJFU0VULCBwcmVzZXQgJWQiLCBwQ29udGV4dC0+bmV4dFByZXNldCk7CiAgICAgICAgIHJldHVybiAwOwogICAgIH0KIAotICAgIHN3aXRjaCAocGFyYW0peworICAgIHN3aXRjaCAocGFyYW0pIHsKICAgICAgICAgY2FzZSBSRVZFUkJfUEFSQU1fUk9PTV9MRVZFTDoKLSAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSAhPSBzaXplb2YoaW50MTZfdCkpeworICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZihpbnQxNl90KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9nZXRQYXJhbWV0ZXIoKSBpbnZhbGlkIHBWYWx1ZVNpemUxICVkIiwgKnBWYWx1ZVNpemUpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSBzaXplb2YoaW50MTZfdCk7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgY2FzZSBSRVZFUkJfUEFSQU1fUk9PTV9IRl9MRVZFTDoKLSAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSAhPSBzaXplb2YoaW50MTZfdCkpeworICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZihpbnQxNl90KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9nZXRQYXJhbWV0ZXIoKSBpbnZhbGlkIHBWYWx1ZVNpemUxMiAlZCIsICpwVmFsdWVTaXplKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgICpwVmFsdWVTaXplID0gc2l6ZW9mKGludDE2X3QpOwogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIGNhc2UgUkVWRVJCX1BBUkFNX0RFQ0FZX1RJTUU6Ci0gICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgIT0gc2l6ZW9mKHVpbnQzMl90KSl7CisgICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgIT0gc2l6ZW9mKHVpbnQzMl90KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9nZXRQYXJhbWV0ZXIoKSBpbnZhbGlkIHBWYWx1ZVNpemUzICVkIiwgKnBWYWx1ZVNpemUpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSBzaXplb2YodWludDMyX3QpOwogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIGNhc2UgUkVWRVJCX1BBUkFNX0RFQ0FZX0hGX1JBVElPOgotICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZihpbnQxNl90KSl7CisgICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgIT0gc2l6ZW9mKGludDE2X3QpKSB7CiAgICAgICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUmV2ZXJiX2dldFBhcmFtZXRlcigpIGludmFsaWQgcFZhbHVlU2l6ZTQgJWQiLCAqcFZhbHVlU2l6ZSk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAqcFZhbHVlU2l6ZSA9IHNpemVvZihpbnQxNl90KTsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICBjYXNlIFJFVkVSQl9QQVJBTV9SRUZMRUNUSU9OU19MRVZFTDoKLSAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSAhPSBzaXplb2YoaW50MTZfdCkpeworICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZihpbnQxNl90KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9nZXRQYXJhbWV0ZXIoKSBpbnZhbGlkIHBWYWx1ZVNpemU1ICVkIiwgKnBWYWx1ZVNpemUpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSBzaXplb2YoaW50MTZfdCk7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgY2FzZSBSRVZFUkJfUEFSQU1fUkVGTEVDVElPTlNfREVMQVk6Ci0gICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgIT0gc2l6ZW9mKHVpbnQzMl90KSl7CisgICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgIT0gc2l6ZW9mKHVpbnQzMl90KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9nZXRQYXJhbWV0ZXIoKSBpbnZhbGlkIHBWYWx1ZVNpemU2ICVkIiwgKnBWYWx1ZVNpemUpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSBzaXplb2YodWludDMyX3QpOwogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIGNhc2UgUkVWRVJCX1BBUkFNX1JFVkVSQl9MRVZFTDoKLSAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSAhPSBzaXplb2YoaW50MTZfdCkpeworICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZihpbnQxNl90KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9nZXRQYXJhbWV0ZXIoKSBpbnZhbGlkIHBWYWx1ZVNpemU3ICVkIiwgKnBWYWx1ZVNpemUpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSBzaXplb2YoaW50MTZfdCk7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgY2FzZSBSRVZFUkJfUEFSQU1fUkVWRVJCX0RFTEFZOgotICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZih1aW50MzJfdCkpeworICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZih1aW50MzJfdCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBSZXZlcmJfZ2V0UGFyYW1ldGVyKCkgaW52YWxpZCBwVmFsdWVTaXplOCAlZCIsICpwVmFsdWVTaXplKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgICpwVmFsdWVTaXplID0gc2l6ZW9mKHVpbnQzMl90KTsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICBjYXNlIFJFVkVSQl9QQVJBTV9ESUZGVVNJT046Ci0gICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgIT0gc2l6ZW9mKGludDE2X3QpKXsKKyAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSAhPSBzaXplb2YoaW50MTZfdCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBSZXZlcmJfZ2V0UGFyYW1ldGVyKCkgaW52YWxpZCBwVmFsdWVTaXplOSAlZCIsICpwVmFsdWVTaXplKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgICpwVmFsdWVTaXplID0gc2l6ZW9mKGludDE2X3QpOwogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIGNhc2UgUkVWRVJCX1BBUkFNX0RFTlNJVFk6Ci0gICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgIT0gc2l6ZW9mKGludDE2X3QpKXsKKyAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSAhPSBzaXplb2YoaW50MTZfdCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBSZXZlcmJfZ2V0UGFyYW1ldGVyKCkgaW52YWxpZCBwVmFsdWVTaXplMTAgJWQiLCAqcFZhbHVlU2l6ZSk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAqcFZhbHVlU2l6ZSA9IHNpemVvZihpbnQxNl90KTsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICBjYXNlIFJFVkVSQl9QQVJBTV9QUk9QRVJUSUVTOgotICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZih0X3JldmVyYl9zZXR0aW5ncykpeworICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplICE9IHNpemVvZih0X3JldmVyYl9zZXR0aW5ncykpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBSZXZlcmJfZ2V0UGFyYW1ldGVyKCkgaW52YWxpZCBwVmFsdWVTaXplMTEgJWQiLCAqcFZhbHVlU2l6ZSk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CkBAIC0xNTU4LDkgKzE0ODgsOSBAQAogICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgfQogCi0gICAgcFByb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ZXJ0aWVzLT5yZXZlcmJEZWxheSk7CisgICAgICAgICAgICAgICAgICBwUHJvcGVydGllcy0+cmV2ZXJiRGVsYXkpOwogICAgICAgICAgICAgQUxPR1YoIlx0UmV2ZXJiX2dldFBhcmFtZXRlcigpIFJFVkVSQl9QQVJBTV9QUk9QRVJUSUVTIFZhbHVlIGlzIHJldmVyYkxldmVsICAgICAgJWQiLAotICAgICAgICAgICAgICAgIHBQcm9wZXJ0aWVzLT5yZXZlcmJMZXZlbCk7CisgICAgICAgICAgICAgICAgICBwUHJvcGVydGllcy0+cmV2ZXJiTGV2ZWwpOwogICAgICAgICAgICAgQUxPR1YoIlx0UmV2ZXJiX2dldFBhcmFtZXRlcigpIFJFVkVSQl9QQVJBTV9QUk9QRVJUSUVTIFZhbHVlIGlzIGRpZmZ1c2lvbiAgICAgICAgJWQiLAotICAgICAgICAgICAgICAgIHBQcm9wZXJ0aWVzLT5kaWZmdXNpb24pOworICAgICAgICAgICAgICAgICAgcFByb3BlcnRpZXMtPmRpZmZ1c2lvbik7CiAgICAgICAgICAgICBBTE9HVigiXHRSZXZlcmJfZ2V0UGFyYW1ldGVyKCkgUkVWRVJCX1BBUkFNX1BST1BFUlRJRVMgVmFsdWUgaXMgZGVuc2l0eSAgICAgICAgICAlZCIsCi0gICAgICAgICAgICAgICAgcFByb3BlcnRpZXMtPmRlbnNpdHkpOworICAgICAgICAgICAgICAgICAgcFByb3BlcnRpZXMtPmRlbnNpdHkpOwogICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgY2FzZSBSRVZFUkJfUEFSQU1fUk9PTV9MRVZFTDoKLSAgICAgICAgICAgICooaW50MTZfdCAqKXBWYWx1ZSA9IFJldmVyYkdldFJvb21MZXZlbChwQ29udGV4dCk7CisgICAgICAgICAgICAqKGludDE2X3QqKXBWYWx1ZSA9IFJldmVyYkdldFJvb21MZXZlbChwQ29udGV4dCk7CiAKLSAgICAgICAgICAgIC8vQUxPR1YoIlx0UmV2ZXJiX2dldFB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ZSBpcyAlZCIsCisgICAgICAgICAgICAvLyBBTE9HVigiXHRSZXZlcmJfZ2V0UGFyYW1ldGVyKCkgUkVWRVJCX1BBUkFNX1JFVkVSQl9MRVZFTCBWYWx1ZSBpcyAlZCIsCiAgICAgICAgICAgICAvLyAgICAgICAgKihpbnQxNl90ICopcFZhbHVlKTsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICBjYXNlIFJFVkVSQl9QQVJBTV9ESUZGVVNJT046Ci0gICAgICAgICAgICAqKGludDE2X3QgKilwVmFsdWUgPSBSZXZlcmJHZXREaWZmdXNpb24ocENvbnRleHQpOworICAgICAgICAgICAgKihpbnQxNl90KilwVmFsdWUgPSBSZXZlcmJHZXREaWZmdXNpb24ocENvbnRleHQpOwogCi0gICAgICAgICAgICAvL0FMT0dWKCJcdFJldmVyYl9nZXRQYXJhbWV0ZXIoKSBSRVZFUkJfUEFSQU1fREVDQVlfRElGRlVTSU9OIFZhbHVlIGlzICVkIiwKKyAgICAgICAgICAgIC8vIEFMT0dWKCJcdFJldmVyYl9nZXRQYXJhbWV0ZXIoKSBSRVZFUkJfUEFSQU1fREVDQVlfRElGRlVTSU9OIFZhbHVlIGlzICVkIiwKICAgICAgICAgICAgIC8vICAgICAgICAqKGludDE2X3QgKilwVmFsdWUpOwogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIGNhc2UgUkVWRVJCX1BBUkFNX0RFTlNJVFk6Ci0gICAgICAgICAgICAqKGludDE2X3QgKilwVmFsdWUgPSBSZXZlcmJHZXREZW5zaXR5KHBDb250ZXh0KTsKLSAgICAgICAgICAgIC8vQUxPR1YoIlx0UmV2ZXJiX2dldFBhcmFtZXRlcigpIFJFVkVSQl9QQVJBTV9ERU5TSVRZIFZhbHVlIGlzICVkIiwKKyAgICAgICAgICAgICooaW50MTZfdCopcFZhbHVlID0gUmV2ZXJiR2V0RGVuc2l0eShwQ29udGV4dCk7CisgICAgICAgICAgICAvLyBBTE9HVigiXHRSZXZlcmJfZ2V0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mcmFtZUNvdW50KTsKICAgICAvKiBQcm9jZXNzIGFsbCB0aGUgYXZhaWxhYmxlIGZyYW1lcywgYmxvY2sgcHJvY2Vzc2luZyBpcyBoYW5kbGVkIGludGVybmFsTFkgYnkgdGhlIExWTSBidW5kbGUgKi8KLSAgICBzdGF0dXMgPSBwcm9jZXNzKCAgICBpbkJ1ZmZlci0+ZjMyLAotICAgICAgICAgICAgICAgICAgICAgICAgIG91dEJ1ZmZlci0+ZjMyLAotICAgICAgICAgICAgICAgICAgICAgICAgIG91dEJ1ZmZlci0+ZnJhbWVDb3VudCwKLSAgICAgICAgICAgICAgICAgICAgICAgICBwQ29udGV4dCk7CisgICAgc3RhdHVzID0gcHJvY2VzcyhpbkJ1ZmZlci0+ZjMyLCBvdXRCdWZmZXItPmYzMiwgb3V0QnVmZmVyLT5mcmFtZUNvdW50LCBwQ29udGV4dCk7CiAKICAgICBpZiAocENvbnRleHQtPmJFbmFibGVkID09IExWTV9GQUxTRSkgewogICAgICAgICBpZiAocENvbnRleHQtPlNhbXBsZXNUb0V4aXRDb3VudCA+IDApIHsKQEAgLTE4NDAsNzIgKzE3NjQsNjcgQEAKICAgICB9CiAKICAgICByZXR1cm4gc3RhdHVzOwotfSAgIC8qIGVuZCBSZXZlcmJfcHJvY2VzcyAqLworfSAvKiBlbmQgUmV2ZXJiX3Byb2Nlc3MgKi8KIAogLyogRWZmZWN0IENvbnRyb2wgSW50ZXJmYWNlIEltcGxlbWVudGF0aW9uOiBDb21tYW5kICovCi1pbnQgUmV2ZXJiX2NvbW1hbmQoZWZmZWN0X2hhbmRsZV90ICBzZWxmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAgICAgICBjbWRDb2RlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAgICAgICBjbWRTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAgICAgICAqcENtZERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICAgICAgICpyZXBseVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICAgICAgICAgICpwUmVwbHlEYXRhKXsKLSAgICBhbmRyb2lkOjpSZXZlcmJDb250ZXh0ICogcENvbnRleHQgPSAoYW5kcm9pZDo6UmV2ZXJiQ29udGV4dCAqKSBzZWxmOwotICAgIExWUkVWX0NvbnRyb2xQYXJhbXNfc3QgICAgQWN0aXZlUGFyYW1zOyAgICAgICAgICAgICAgLyogQ3VycmVudCBjb250cm9sIFBhcmFtZXRlcnMgKi8KLSAgICBMVlJFVl9SZXR1cm5TdGF0dXNfZW4gICAgIEx2bVN0YXR1cz1MVlJFVl9TVUNDRVNTOyAgICAgLyogRnVuY3Rpb24gY2FsbCBzdGF0dXMgKi8KK2ludCBSZXZlcmJfY29tbWFuZChlZmZlY3RfaGFuZGxlX3Qgc2VsZiwgdWludDMyX3QgY21kQ29kZSwgdWludDMyX3QgY21kU2l6ZSwgdm9pZCogcENtZERhdGEsCisgICAgICAgICAgICAgICAgICAgdWludDMyX3QqIHJlcGx5U2l6ZSwgdm9pZCogcFJlcGx5RGF0YSkgeworICAgIGFuZHJvaWQ6OlJldmVyYkNvbnRleHQqIHBDb250ZXh0ID0gKGFuZHJvaWQ6OlJldmVyYkNvbnRleHQqKXNlbGY7CisgICAgTFZSRVZfQ29udHJvbFBhcmFtc19zdCBBY3RpdmVQYXJhbXM7ICAgICAgICAgICAgIC8qIEN1cnJlbnQgY29udHJvbCBQYXJhbWV0ZXJzICovCisgICAgTFZSRVZfUmV0dXJuU3RhdHVzX2VuIEx2bVN0YXR1cyA9IExWUkVWX1NVQ0NFU1M7IC8qIEZ1bmN0aW9uIGNhbGwgc3RhdHVzICovCiAKLSAgICBpZiAocENvbnRleHQgPT0gTlVMTCl7CisgICAgaWYgKHBDb250ZXh0ID09IE5VTEwpIHsKICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUmV2ZXJiX2NvbW1hbmQgRVJST1IgcENvbnRleHQgPT0gTlVMTCIpOwogICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICB9CiAKLSAgICAvL0FMT0dWKCJcdFJldmVyYl9jb21tYW5kIElOUFVUUyBhcmU6IGNvbW1hbmQgJWQgY21kU2l6ZSAlZCIsY21kQ29kZSwgY21kU2l6ZSk7CisgICAgLy8gQUxPR1YoIlx0UmV2ZXJiX2NvbW1hbmQgSU5QVVRTIGFyZTogY29tbWFuZCAlZCBjbWRTaXplICVkIixjbWRDb2RlLCBjbWRTaXplKTsKIAotICAgIHN3aXRjaCAoY21kQ29kZSl7CisgICAgc3dpdGNoIChjbWRDb2RlKSB7CiAgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9JTklUOgotICAgICAgICAgICAgLy9BTE9HVigiXHRSZXZlcmJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKKyAgICAgICAgICAgIC8vIEFMT0dWKCJcdFJldmVyYl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgogICAgICAgICAgICAgLy8gICAgICAgICJFRkZFQ1RfQ01EX0lOSVQgc3RhcnQiKTsKIAotICAgICAgICAgICAgaWYgKHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQpKXsKKyAgICAgICAgICAgIGlmIChwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfSU5JVDogRVJST1IiKTsKKyAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9JTklUOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgKihpbnQgKikgcFJlcGx5RGF0YSA9IDA7CisgICAgICAgICAgICAqKGludCopcFJlcGx5RGF0YSA9IDA7CiAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX0NPTkZJRzoKLSAgICAgICAgICAgIC8vQUxPR1YoIlx0UmV2ZXJiX2NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCisgICAgICAgICAgICAvLyBBTE9HVigiXHRSZXZlcmJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKICAgICAgICAgICAgIC8vICAgICAgICAiRUZGRUNUX0NNRF9TRVRfQ09ORklHIHN0YXJ0Iik7Ci0gICAgICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCBjbWRTaXplICE9IHNpemVvZihlZmZlY3RfY29uZmlnX3QpIHx8Ci0gICAgICAgICAgICAgICAgICAgIHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQpKSB7CisgICAgICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCBjbWRTaXplICE9IHNpemVvZihlZmZlY3RfY29uZmlnX3QpIHx8IHBSZXBseURhdGEgPT0gTlVMTCB8fAorICAgICAgICAgICAgICAgIHJlcGx5U2l6ZSA9PSBOVUxMIHx8ICpyZXBseVNpemUgIT0gc2l6ZW9mKGludCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBSZXZlcmJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9DT05GSUc6IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfU0VUX0NPTkZJRzogRVJST1IiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICooaW50ICopIHBSZXBseURhdGEgPSBhbmRyb2lkOjpSZXZlcmJfc2V0Q29uZmlnKHBDb250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGVmZmVjdF9jb25maWdfdCAqKSBwQ21kRGF0YSk7CisgICAgICAgICAgICAqKGludCopcFJlcGx5RGF0YSA9IGFuZHJvaWQ6OlJldmVyYl9zZXRDb25maWcocENvbnRleHQsIChlZmZlY3RfY29uZmlnX3QqKXBDbWREYXRhKTsKICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9HRVRfQ09ORklHOgogICAgICAgICAgICAgaWYgKHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihlZmZlY3RfY29uZmlnX3QpKSB7CiAgICAgICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUmV2ZXJiX2NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9HRVRfQ09ORklHOiBFUlJPUiIpOworICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX0dFVF9DT05GSUc6IEVSUk9SIik7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGFuZHJvaWQ6OlJldmVyYl9nZXRDb25maWcocENvbnRleHQsIChlZmZlY3RfY29uZmlnX3QgKilwUmVwbHlEYXRhKTsKKyAgICAgICAgICAgIGFuZHJvaWQ6OlJldmVyYl9nZXRDb25maWcocENvbnRleHQsIChlZmZlY3RfY29uZmlnX3QqKXBSZXBseURhdGEpOwogICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX1JFU0VUOgotICAgICAgICAgICAgLy9BTE9HVigiXHRSZXZlcmJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKKyAgICAgICAgICAgIC8vIEFMT0dWKCJcdFJldmVyYl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgogICAgICAgICAgICAgLy8gICAgICAgICJFRkZFQ1RfQ01EX1JFU0VUIHN0YXJ0Iik7CiAgICAgICAgICAgICBSZXZlcmJfc2V0Q29uZmlnKHBDb250ZXh0LCAmcENvbnRleHQtPmNvbmZpZyk7CiAgICAgICAgICAgICBicmVhazsKIAotICAgICAgICBjYXNlIEVGRkVDVF9DTURfR0VUX1BBUkFNOnsKLSAgICAgICAgICAgIC8vQUxPR1YoIlx0UmV2ZXJiX2NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCisgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9HRVRfUEFSQU06IHsKKyAgICAgICAgICAgIC8vIEFMT0dWKCJcdFJldmVyYl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgogICAgICAgICAgICAgLy8gICAgICAgICJFRkZFQ1RfQ01EX0dFVF9QQVJBTSBzdGFydCIpOwotICAgICAgICAgICAgZWZmZWN0X3BhcmFtX3QgKnAgPSAoZWZmZWN0X3BhcmFtX3QgKilwQ21kRGF0YTsKKyAgICAgICAgICAgIGVmZmVjdF9wYXJhbV90KiBwID0gKGVmZmVjdF9wYXJhbV90KilwQ21kRGF0YTsKICAgICAgICAgICAgIGlmIChwQ21kRGF0YSA9PSBudWxscHRyKSB7CiAgICAgICAgICAgICAgICAgQUxPR1coIlx0TFZNX0VSUk9SIDogcENtZERhdGEgaXMgTlVMTCIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwpAQCAtMTkxNCwxNjMgKzE4MzMsMTU2IEBACiAgICAgICAgICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIyNjM0NzUwOSIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKGNtZFNpemUgPCBzaXplb2YoZWZmZWN0X3BhcmFtX3QpIHx8Ci0gICAgICAgICAgICAgICAgICAgIGNtZFNpemUgPCAoc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHAtPnBzaXplKSB8fAotICAgICAgICAgICAgICAgICAgICBwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwKLSAgICAgICAgICAgICAgICAgICAgKnJlcGx5U2l6ZSA8IChzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgcC0+cHNpemUpKSB7CisgICAgICAgICAgICBpZiAoY21kU2l6ZSA8IHNpemVvZihlZmZlY3RfcGFyYW1fdCkgfHwgY21kU2l6ZSA8IChzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgcC0+cHNpemUpIHx8CisgICAgICAgICAgICAgICAgcFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMIHx8CisgICAgICAgICAgICAgICAgKnJlcGx5U2l6ZSA8IChzaXplb2YoZWZmZWN0X3BhcmFtX3QpICsgcC0+cHNpemUpKSB7CiAgICAgICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUmV2ZXJiX2NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9HRVRfUEFSQU06IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfR0VUX1BBUkFNOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBtZW1jcHkocFJlcGx5RGF0YSwgcENtZERhdGEsIHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBwLT5wc2l6ZSk7CiAKLSAgICAgICAgICAgIHAgPSAoZWZmZWN0X3BhcmFtX3QgKilwUmVwbHlEYXRhOworICAgICAgICAgICAgcCA9IChlZmZlY3RfcGFyYW1fdCopcFJlcGx5RGF0YTsKIAogICAgICAgICAgICAgaW50IHZvZmZzZXQgPSAoKHAtPnBzaXplIC0gMSkgLyBzaXplb2YoaW50MzJfdCkgKyAxKSAqIHNpemVvZihpbnQzMl90KTsKIAotICAgICAgICAgICAgcC0+c3RhdHVzID0gYW5kcm9pZDo6UmV2ZXJiX2dldFBhcmFtZXRlcihwQ29udGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkICopcC0+ZGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcC0+dnNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC0+ZGF0YSArIHZvZmZzZXQpOworICAgICAgICAgICAgcC0+c3RhdHVzID0gYW5kcm9pZDo6UmV2ZXJiX2dldFBhcmFtZXRlcihwQ29udGV4dCwgKHZvaWQqKXAtPmRhdGEsICZwLT52c2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC0+ZGF0YSArIHZvZmZzZXQpOwogCiAgICAgICAgICAgICAqcmVwbHlTaXplID0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHZvZmZzZXQgKyBwLT52c2l6ZTsKIAotICAgICAgICAgICAgLy9BTE9HVigiXHRSZXZlcmJfY29tbWFuZCBFRkZFQ1RfQ01EX0dFVF9QQVJBTSAiCisgICAgICAgICAgICAvLyBBTE9HVigiXHRSZXZlcmJfY29tbWFuZCBFRkZFQ1RfQ01EX0dFVF9QQVJBTSAiCiAgICAgICAgICAgICAvLyAgICAgICAgIipwQ21kRGF0YSAlZCwgKnJlcGx5U2l6ZSAlZCwgKnBSZXBseURhdGEgJWQgIiwKICAgICAgICAgICAgIC8vICAgICAgICAqKGludDMyX3QgKikoKGNoYXIgKilwQ21kRGF0YSArIHNpemVvZihlZmZlY3RfcGFyYW1fdCkpLAogICAgICAgICAgICAgLy8gICAgICAgICpyZXBseVNpemUsCiAgICAgICAgICAgICAvLyAgICAgICAgKihpbnQxNl90ICopKChjaGFyICopcFJlcGx5RGF0YSArIHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyB2b2Zmc2V0KSk7CiAKICAgICAgICAgfSBicmVhazsKLSAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX1NFVF9QQVJBTTp7Ci0KLSAgICAgICAgICAgIC8vQUxPR1YoIlx0UmV2ZXJiX2NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCisgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9TRVRfUEFSQU06IHsKKyAgICAgICAgICAgIC8vIEFMT0dWKCJcdFJldmVyYl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgogICAgICAgICAgICAgLy8gICAgICAgICJFRkZFQ1RfQ01EX1NFVF9QQVJBTSBzdGFydCIpOwotICAgICAgICAgICAgLy9BTE9HVigiXHRSZXZlcmJfY29tbWFuZCBFRkZFQ1RfQ01EX1NFVF9QQVJBTSBwYXJhbSAlZCwgKnJlcGx5U2l6ZSAlZCwgdmFsdWUgJWQgIiwKKyAgICAgICAgICAgIC8vIEFMT0dWKCJcdFJldmVyYl9jb21tYW5kIEVGRkVDVF9DTURfU0VUX1BBUkFNIHBhcmFtICVkLCAqcmVwbHlTaXplICVkLCB2YWx1ZSAlZCAiLAogICAgICAgICAgICAgLy8gICAgICAgICooaW50MzJfdCAqKSgoY2hhciAqKXBDbWREYXRhICsgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSksCiAgICAgICAgICAgICAvLyAgICAgICAgKnJlcGx5U2l6ZSwKICAgICAgICAgICAgIC8vICAgICAgICAqKGludDE2X3QgKikoKGNoYXIgKilwQ21kRGF0YSArIHNpemVvZihlZmZlY3RfcGFyYW1fdCkgKyBzaXplb2YoaW50MzJfdCkpKTsKIAogICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwgKGNtZFNpemUgPCAoc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHNpemVvZihpbnQzMl90KSkpIHx8Ci0gICAgICAgICAgICAgICAgICAgIHBSZXBseURhdGEgPT0gTlVMTCB8fCAgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50MzJfdCkpIHsKKyAgICAgICAgICAgICAgICBwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50MzJfdCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBSZXZlcmJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9QQVJBTTogRVJST1IiKTsKKyAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfUEFSQU06IEVSUk9SIik7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGVmZmVjdF9wYXJhbV90ICpwID0gKGVmZmVjdF9wYXJhbV90ICopIHBDbWREYXRhOworICAgICAgICAgICAgZWZmZWN0X3BhcmFtX3QqIHAgPSAoZWZmZWN0X3BhcmFtX3QqKXBDbWREYXRhOwogCi0gICAgICAgICAgICBpZiAocC0+cHNpemUgIT0gc2l6ZW9mKGludDMyX3QpKXsKKyAgICAgICAgICAgIGlmIChwLT5wc2l6ZSAhPSBzaXplb2YoaW50MzJfdCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiXHQ0TFZNX0VSUk9SIDogUmV2ZXJiX2NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfUEFSQU06IEVSUk9SLCBwc2l6ZSBpcyBub3Qgc2l6ZW9mKGludDMyX3QpIik7CisgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfU0VUX1BBUkFNOiBFUlJPUiwgcHNpemUgaXMgbm90IHNpemVvZihpbnQzMl90KSIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAvL0FMT0dWKCJcdG41UmV2ZXJiX2NvbW1hbmQgY21kU2l6ZSBpcyAlZFxuIgorICAgICAgICAgICAgLy8gQUxPR1YoIlx0bjVSZXZlcmJfY29tbWFuZCBjbWRTaXplIGlzICVkXG4iCiAgICAgICAgICAgICAvLyAgICAgICAgIlx0c2l6ZW9mKGVmZmVjdF9wYXJhbV90KSBpcyAgJWRcbiIKICAgICAgICAgICAgIC8vICAgICAgICAiXHRwLT5wc2l6ZSBpcyAlZFxuIgogICAgICAgICAgICAgLy8gICAgICAgICJcdHAtPnZzaXplIGlzICVkIgogICAgICAgICAgICAgLy8gICAgICAgICJcbiIsCiAgICAgICAgICAgICAvLyAgICAgICAgY21kU2l6ZSwgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSwgcC0+cHNpemUsIHAtPnZzaXplICk7CiAKLSAgICAgICAgICAgICooaW50ICopcFJlcGx5RGF0YSA9IGFuZHJvaWQ6OlJldmVyYl9zZXRQYXJhbWV0ZXIocENvbnRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgKilwLT5kYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLT5kYXRhICsgcC0+cHNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPnZzaXplKTsKKyAgICAgICAgICAgICooaW50KilwUmVwbHlEYXRhID0gYW5kcm9pZDo6UmV2ZXJiX3NldFBhcmFtZXRlcihwQ29udGV4dCwgKHZvaWQqKXAtPmRhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC0+ZGF0YSArIHAtPnBzaXplLCBwLT52c2l6ZSk7CiAgICAgICAgIH0gYnJlYWs7CiAKICAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX0VOQUJMRToKLSAgICAgICAgICAgIC8vQUxPR1YoIlx0UmV2ZXJiX2NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCisgICAgICAgICAgICAvLyBBTE9HVigiXHRSZXZlcmJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKICAgICAgICAgICAgIC8vICAgICAgICAiRUZGRUNUX0NNRF9FTkFCTEUgc3RhcnQiKTsKIAotICAgICAgICAgICAgaWYgKHBSZXBseURhdGEgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQpKXsKKyAgICAgICAgICAgIGlmIChwUmVwbHlEYXRhID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfRU5BQkxFOiBFUlJPUiIpOworICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX0VOQUJMRTogRVJST1IiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmKHBDb250ZXh0LT5iRW5hYmxlZCA9PSBMVk1fVFJVRSl7Ci0gICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX0VOQUJMRTogRVJST1ItRWZmZWN0IGlzIGFscmVhZHkgZW5hYmxlZCIpOwotICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKLSAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAqKGludCAqKXBSZXBseURhdGEgPSAwOworICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5iRW5hYmxlZCA9PSBMVk1fVFJVRSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgorICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX0VOQUJMRTogRVJST1ItRWZmZWN0IGlzIGFscmVhZHkgZW5hYmxlZCIpOworICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgICAgICAgICAgfQorICAgICAgICAgICAgKihpbnQqKXBSZXBseURhdGEgPSAwOwogICAgICAgICAgICAgcENvbnRleHQtPmJFbmFibGVkID0gTFZNX1RSVUU7CiAgICAgICAgICAgICAvKiBHZXQgdGhlIGN1cnJlbnQgc2V0dGluZ3MgKi8KICAgICAgICAgICAgIEx2bVN0YXR1cyA9IExWUkVWX0dldENvbnRyb2xQYXJhbWV0ZXJzKHBDb250ZXh0LT5oSW5zdGFuY2UsICZBY3RpdmVQYXJhbXMpOwogICAgICAgICAgICAgTFZNX0VSUk9SX0NIRUNLKEx2bVN0YXR1cywgIkxWUkVWX0dldENvbnRyb2xQYXJhbWV0ZXJzIiwgIkVGRkVDVF9DTURfRU5BQkxFIikKICAgICAgICAgICAgIHBDb250ZXh0LT5TYW1wbGVzVG9FeGl0Q291bnQgPQotICAgICAgICAgICAgICAgICAgICAoQWN0aXZlUGFyYW1zLlQ2MCAqIHBDb250ZXh0LT5jb25maWcuaW5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gICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUmV2ZXJiX2NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9ESVNBQkxFOiBFUlJPUiIpOworICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX0RJU0FCTEU6IEVSUk9SIik7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZihwQ29udGV4dC0+YkVuYWJsZWQgPT0gTFZNX0ZBTFNFKXsKLSAgICAgICAgICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogUmV2ZXJiX2NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfRElTQUJMRTogRVJST1ItRWZmZWN0IGlzIG5vdCB5ZXQgZW5hYmxlZCIpOwotICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKLSAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAqKGludCAqKXBSZXBseURhdGEgPSAwOworICAgICAgICAgICAgaWYgKHBDb250ZXh0LT5iRW5hYmxlZCA9PSBMVk1fRkFMU0UpIHsKKyAgICAgICAgICAgICAgICBBTE9HVigiXHRMVk1fRVJST1IgOiBSZXZlcmJfY29tbWFuZCBjbWRDb2RlIENhc2U6ICIKKyAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9ESVNBQkxFOiBFUlJPUi1FZmZlY3QgaXMgbm90IHlldCBlbmFibGVkIik7CisgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAqKGludCopcFJlcGx5RGF0YSA9IDA7CiAgICAgICAgICAgICBwQ29udGV4dC0+YkVuYWJsZWQgPSBMVk1fRkFMU0U7CiAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX1ZPTFVNRToKLSAgICAgICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMIHx8Ci0gICAgICAgICAgICAgICAgY21kU2l6ZSAhPSAyICogc2l6ZW9mKHVpbnQzMl90KSkgeworICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwgY21kU2l6ZSAhPSAyICogc2l6ZW9mKHVpbnQzMl90KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfU0VUX1ZPTFVNRTogRVJST1IiKTsKKyAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfVk9MVU1FOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBpZiAocFJlcGx5RGF0YSAhPSBOVUxMKSB7IC8vIHdlIGhhdmUgdm9sdW1lIGNvbnRyb2wKLSAgICAgICAgICAgICAgICBwQ29udGV4dC0+bGVmdFZvbHVtZSA9IChMVk1fSU5UMTYpKCgqKHVpbnQzMl90ICopcENtZERhdGEgKyAoMSA8PCAxMSkpID4+IDEyKTsKLSAgICAgICAgICAgICAgICBwQ29udGV4dC0+cmlnaHRWb2x1bWUgPSAoTFZNX0lOVDE2KSgoKigodWludDMyX3QgKilwQ21kRGF0YSArIDEpICsgKDEgPDwgMTEpKSA+PiAxMik7Ci0gICAgICAgICAgICAgICAgKih1aW50MzJfdCAqKXBSZXBseURhdGEgPSAoMSA8PCAyNCk7Ci0gICAgICAgICAgICAgICAgKigodWludDMyX3QgKilwUmVwbHlEYXRhICsgMSkgPSAoMSA8PCAyNCk7CisgICAgICAgICAgICBpZiAocFJlcGx5RGF0YSAhPSBOVUxMKSB7ICAvLyB3ZSBoYXZlIHZvbHVtZSBjb250cm9sCisgICAgICAgICAgICAgICAgcENvbnRleHQtPmxlZnRWb2x1bWUgPSAoTFZNX0lOVDE2KSgoKih1aW50MzJfdCopcENtZERhdGEgKyAoMSA8PCAxMSkpID4+IDEyKTsKKyAgICAgICAgICAgICAgICBwQ29udGV4dC0+cmlnaHRWb2x1bWUgPSAoTFZNX0lOVDE2KSgoKigodWludDMyX3QqKXBDbWREYXRhICsgMSkgKyAoMSA8PCAxMSkpID4+IDEyKTsKKyAgICAgICAgICAgICAgICAqKHVpbnQzMl90KilwUmVwbHlEYXRhID0gKDEgPDwgMjQpOworICAgICAgICAgICAgICAgICooKHVpbnQzMl90KilwUmVwbHlEYXRhICsgMSkgPSAoMSA8PCAyNCk7CiAgICAgICAgICAgICAgICAgaWYgKHBDb250ZXh0LT52b2x1bWVNb2RlID09IGFuZHJvaWQ6OlJFVkVSQl9WT0xVTUVfT0ZGKSB7CiAgICAgICAgICAgICAgICAgICAgIC8vIGZvcmNlIG5vIHZvbHVtZSByYW1wIGZvciBmaXJzdCBidWZmZXIgcHJvY2Vzc2VkIGFmdGVyIGdldHRpbmcgdm9sdW1lIGNvbnRyb2wKICAgICAgICAgICAgICAgICAgICAgcENvbnRleHQtPnZvbHVtZU1vZGUgPSBhbmRyb2lkOjpSRVZFUkJfVk9MVU1FX0ZMQVQ7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIHsgLy8gd2UgZG9uJ3QgaGF2ZSB2b2x1bWUgY29udHJvbAorICAgICAgICAgICAgfSBlbHNlIHsgIC8vIHdlIGRvbid0IGhhdmUgdm9sdW1lIGNvbnRyb2wKICAgICAgICAgICAgICAgICBwQ29udGV4dC0+bGVmdFZvbHVtZSA9IFJFVkVSQl9VTklUX1ZPTFVNRTsKICAgICAgICAgICAgICAgICBwQ29udGV4dC0+cmlnaHRWb2x1bWUgPSBSRVZFUkJfVU5JVF9WT0xVTUU7CiAgICAgICAgICAgICAgICAgcENvbnRleHQtPnZvbHVtZU1vZGUgP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dDoKICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFJldmVyYl9jb21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAiREVGQVVMVCBzdGFydCAlZCBFUlJPUiIsY21kQ29kZSk7CisgICAgICAgICAgICAgICAgICAiREVGQVVMVCBzdGFydCAlZCBFUlJPUiIsCisgICAgICAgICAgICAgICAgICBjbWRDb2RlKTsKICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgIH0KIAotICAgIC8vQUxPR1YoIlx0UmV2ZXJiX2NvbW1hbmQgZW5kXG5cbiIpOworICAgIC8vIEFMT0dWKCJcdFJldmVyYl9jb21tYW5kIGVuZFxuXG4iKTsKICAgICByZXR1cm4gMDsKLX0gICAgLyogZW5kIFJldmVyYl9jb21tYW5kICovCit9IC8qIGVuZCBSZXZlcmJfY29tbWFuZCAqLwogCiAvKiBFZmZlY3QgQ29udHJvbCBJbnRlcmZhY2UgSW1wbGVtZW50YXRpb246IGdldF9kZXNjcmlwdG9yICovCi1pbnQgUmV2ZXJiX2dldERlc2NyaXB0b3IoZWZmZWN0X2hhbmRsZV90ICAgc2VsZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVmZmVjdF9kZXNjcmlwdG9yX3QgKnBEZXNjcmlwdG9yKQotewotICAgIGFuZHJvaWQ6OlJldmVyYkNvbnRleHQgKiBwQ29udGV4dCA9IChhbmRyb2lkOjpSZXZlcmJDb250ZXh0ICopc2VsZjsKLSAgICBjb25zdCBlZmZlY3RfZGVzY3JpcHRvcl90ICpkZXNjOworaW50IFJldmVyYl9nZXREZXNjcmlwdG9yKGVmZmVjdF9oYW5kbGVfdCBzZWxmLCBlZmZlY3RfZGVzY3JpcHRvcl90KiBwRGVzY3JpcHRvcikgeworICAgIGFuZHJvaWQ6OlJldmVyYkNvbnRleHQqIHBDb250ZXh0ID0gKGFuZHJvaWQ6OlJldmVyYkNvbnRleHQqKXNlbG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L3dlYnJ0Yy93ZWJydGMvbW9kdWxlcy9hdWRpb19wcm9jZXNzaW5nL2luY2x1ZGUiLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIGNmbGFnczogWworICAgICAgICAiLVdhbGwiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgICAgICItV2V4dHJhIiwKKyAgICAgICAgIi1Xbm8tdW51c2VkLXBhcmFtZXRlciIsCiAgICAgXSwKIAogICAgIHNoYXJlZF9saWJzOiBbCi0gICAgICAgICJsaWJ3ZWJydGNfYXVkaW9fcHJlcHJvY2Vzc2luZyIsCi0gICAgICAgICJsaWJzcGVleHJlc2FtcGxlciIsCi0gICAgICAgICJsaWJ1dGlscyIsCiAgICAgICAgICJsaWJsb2ciLAorICAgICAgICAibGlidXRpbHMiLAogICAgIF0sCiAKLSAgICBjZmxhZ3M6IFsKLSAgICAgICAgIi1EV0VCUlRDX1BPU0lYIiwKLSAgICAgICAgIi1mdmlzaWJpbGl0eT1oaWRkZW4iLAotICAgICAgICAiLVdhbGwiLAotICAgICAgICAiLVdlcnJvciIsCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgIndlYnJ0Y19hdWRpb19wcm9jZXNzaW5nIiwKICAgICBdLAogCiAgICAgaGVhZGVyX2xpYnM6IFsKICAgICAgICAgImxpYmF1ZGlvZWZmZWN0cyIsCiAgICAgICAgICJsaWJoYXJkd2FyZV9oZWFkZXJzIiwKICAgICBdLAorICAgIHRhcmdldDogeworICAgICAgICBkYXJ3aW46IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgIH0sCit9CisKK2NjX2xpYnJhcnkgeworICAgIG5hbWU6ICJsaWJhdWRpb3ByZXByb2Nlc3NpbmciLAorICAgIGRlZmF1bHRzOiBbImxpYmF1ZGlvcHJlcHJvY2Vzc2luZy1kZWZhdWx0cyJdLAorICAgIHJlbGF0aXZlX2luc3RhbGxfcGF0aDogInNvdW5kZngiLA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lQRV9QUkVfUFJPQyB8IEVGRkVDVF9GTEFHX0RFVklDRV9JTkQpLAorICAgICAgICAwLCAgLy8gRklYTUUgaW5kaWNhdGUgQ1BVIGxvYWQKKyAgICAgICAgMCwgIC8vIEZJWE1FIGluZGljYXRlIG1lbW9yeSB1c2FnZQogICAgICAgICAiTm9pc2UgU3VwcHJlc3Npb24iLAotICAgICAgICAiVGhlIEFuZHJvaWQgT3BlbiBTb3VyY2UgUHJvamVjdCIKLX07CisgICAgICAgICJUaGUgQW5kcm9pZCBPcGVuIFNvdXJjZSBQcm9qZWN0In07CiAKLQotc3RhdGljIGNvbnN0IGVmZmVjdF9kZXNjcmlwdG9yX3QgKnNEZXNjcmlwdG9yc1tQUkVQUk9DX05VTV9FRkZFQ1RTXSA9IHsKLSAgICAgICAgJnNBZ2NEZXNjcmlwdG9yLAotICAgICAgICAmc0FlY0Rlc2NyaXB0b3IsCi0gICAgICAgICZzTnNEZXNjcmlwdG9yCi19Oworc3RhdGljIGNvbnN0IGVmZmVjdF9kZXNjcmlwdG9yX3QqIHNEZXNjcmlwdG9yc1tQUkVQUk9DX05VTV9FRkZFQ1RTXSA9IHsmc0FnY0Rlc2NyaXB0b3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzQWdjMkRlc2NyaXB0b3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzQWVjRGVzY3JpcHRvciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNOc0Rlc2NyaXB0b3J9OwogCiAvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogLy8gSGVscGV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FSU5WQUw7Ci0gICAgICAgIH0KLSAgICAgICAgYnJlYWs7Ci0gICAgY2FzZSBBR0NfUEFSQU1fTElNSVRFUl9FTkE6Ci0gICAgICAgIGlmICgqcFZhbHVlU2l6ZSA8IHNpemVvZihib29sKSkgewotICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSAwOwotICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7Ci0gICAgICAgIH0KLSAgICAgICAgYnJlYWs7Ci0gICAgY2FzZSBBR0NfUEFSQU1fUFJPUEVSVElFUzoKLSAgICAgICAgaWYgKCpwVmFsdWVTaXplIDwgc2l6ZW9mKHRfYWdjX3NldHRpbmdzKSkgewotICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSAwOwotICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7Ci0gICAgICAgIH0KLSAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQUdDMl9QQVJBTV9GSVhFRF9ESUdJVEFMX0dBSU46CisgICAgICAgICAgICBpZiAoKnBWYWx1ZVNpemUgPCBzaXplb2YoZmxvYXQpKSB7CisgICAgICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSAwLmY7CisgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBR0MyX1BBUkFNX0FEQVBUX0RJR0lfTEVWRUxfRVNUSU1BVE9SOgorICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplIDwgc2l6ZW9mKGludDMyX3QpKSB7CisgICAgICAgICAgICAgICAgKnBWYWx1ZVNpemUgPSAwOworICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQUdDMl9QQVJBTV9BREFQVF9ESUdJX0VYVFJBX1NBVFVSQVRJT05fTUFSR0lOOgorICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplIDwgc2l6ZW9mKGZsb2F0KSkgeworICAgICAgICAgICAgICAgICpwVmFsdWVTaXplID0gMC5mOworICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQUdDMl9QQVJBTV9QUk9QRVJUSUVTOgorICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplIDwgc2l6ZW9mKGFnYzJfc2V0dGluZ3NfdCkpIHsKKyAgICAgICAgICAgICAgICAqcFZhbHVlU2l6ZSA9IDA7CisgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKIAotICAgIGRlZmF1bHQ6Ci0gICAgICAgIEFMT0dXKCJBZ2NHZXRQYXJhbWV0ZXIoKSB1bmtub3duIHBhcmFtICUwOHgiLCBwYXJhbSk7Ci0gICAgICAgIHN0YXR1cyA9IC1FSU5WQUw7Ci0gICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgQUxPR1coIkFnYzJHZXRQYXJhbWV0ZXIoKSB1bmtub3duIHBhcmFtICUwOHgiLCBwYXJhbSk7CisgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgYnJlYWs7CiAgICAgfQogCisgICAgZWZmZWN0LT5zZXNzaW9uLT5jb25maWcgPSBlZmZlY3QtPnNlc3Npb24tPmFwbS0+R2V0Q29uZmlnKCk7CiAgICAgc3dpdGNoIChwYXJhbSkgewotICAgIGNhc2UgQUdDX1BBUkFNX1RBUkdFVF9MRVZFTDoKLSAgICAgICAgKihpbnQxNl90ICopIHBWYWx1ZSA9IChpbnQxNl90KShhZ2MtPnRhcmdldF9sZXZlbF9kYmZzKCkgKiAtMTAwKTsKLSAgICAgICAgQUxPR1YoIkFnY0dldFBhcmFtZXRlcigpIHRhcmdldCBsZXZlbCAlZCBtaWxsaUJlbHMiLCAqKGludD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yAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZXh0cmFfc2F0dXJhdGlvbl9tYXJnaW5fZGIpOworICAgICAgICAgICAgQUxPR1YoIkFnYzJHZXRQYXJhbWV0ZXIoKSBleHRyYSBzYXR1cmF0aW9uIG1hcmdpbiAlZiBkQiIsICooZmxvYXQqKXBWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBR0MyX1BBUkFNX1BST1BFUlRJRVM6CisgICAgICAgICAgICBwUHJvcGVydGllcy0+Zml4ZWREaWdpdGFsR2FpbiA9CisgICAgICAgICAgICAgICAgICAgIChmbG9hdCkoZWZmZWN0LT5zZXNzaW9uLT5jb25maWcuZ2Fpbl9jb250cm9sbGVyMi5maXhlZF9kaWdpdGFsLmdhaW5fZGIpOworICAgICAgICAgICAgcFByb3BlcnRpZXMtPmxldmVsX2VzdGltYXRvciA9ICh1aW50MzJfdCkoCisgICAgICAgICAgICAgICAgICAgIGVmZmVjdC0+c2Vzc2lvbi0+Y29uZmlnLmdhaW5fY29udHJvbGxlcjIuYWRhcHRpdmVfZGlnaXRhbC5sZXZlbF9lc3RpbWF0b3IpOworICAgICAgICAgICAgcFByb3BlcnRpZXMtPmV4dHJhU2F0dXJhdGlvbk1hcmdpbiA9CisgICAgICAgICAgICAgICAgICAgIChmbG9hdCkoZWZmZWN0LT5zZXNzaW9uLT5jb25maWcuZ2Fpbl9jb250cm9sbGVyMi5hZGFwdGl2ZV9kaWdpdGFsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZXh0cmFfc2F0dXJhdGlvbl9tYXJnaW5fZGIpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBBTE9HVygiQWdjMkdldFBhcmFtZXRlcigpIHVua25vd24gcGFyYW0gJWQiLCBwYXJhbSk7CisgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgYnJlYWs7CisgICAgfQorCisgICAgcmV0dXJuIHN0YXR1czsKK30KKworaW50IEFnY0dldFBhcmFtZXRlcihwcmVwcm9jX2VmZmVjdF90KiBlZmZlY3QsIHZvaWQqIHBQYXJhbSwgdWludDMyX3QqIHBWYWx1ZVNpemUsIHZvaWQqIHBWYWx1ZSkgeworICAgIGludCBzdGF0dXMgPSAwOworICAgIHVpbnQzMl90IHBhcmFtID0gKih1aW50MzJfdCopcFBhcmFtOworICAgIHRfYWdjX3NldHRpbmdzKiBwUHJvcGVydGllcyA9ICh0X2FnY19zZXR0aW5ncyopcFZhbHVlOworCisgICAgc3dpdGNoIChwYXJhbSkgeworICAgICAgICBjYXNlIEFHQ19QQVJBTV9UQVJHRVRfTEVWRUw6CisgICAgICAgIGNhc2UgQUdDX1BBUkFNX0NPTVBfR0FJTjoKKyAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSA8IHNpemVvZihpbnQxNl90KSkgeworICAgICAgICAgICAgICAgICpwVmFsdWVTaXplID0gMDsKKyAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFHQ19QQVJBTV9MSU1JVEVSX0VOQToKKyAgICAgICAgICAgIGlmICgqcFZhbHVlU2l6ZSA8IHNpemVvZihib29sKSkgeworICAgICAgICAgICAgICAgICpwVmFsdWVTaXplID0gMDsKKyAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFHQ19QQVJBTV9QUk9QRVJUSUVTOgorICAgICAgICAgICAgaWYgKCpwVmFsdWVTaXplIDwgc2l6ZW9mKHRfYWdjX3NldHRpbmdzKSkgeworICAgICAgICAgICAgICAgICpwVmFsdWVTaXplID0gMDsKKyAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBBTE9HVygiQWdjR2V0UGFyYW1ldGVyKCkgdW5rbm93biBwYXJhbSAlMDh4IiwgcGFyYW0pOworICAgICAgICAgICAgc3RhdHVzID0gLUVJTlZBTDsKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKworICAgIGVmZmVjdC0+c2Vzc2lvbi0+Y29uZmlnID0gZWZmZWN0LT5zZXNzaW9uLT5hcG0tPkdldENvbmZpZygpOworICAgIHN3aXRjaCAocGFyYW0pIHsKKyAgICAgICAgY2FzZSBBR0NfUEFSQU1fVEFSR0VUX0xFVkVMOgorICAgICAgICAgICAgKihpbnQxNl90KilwVmFsdWUgPQorICAgICAgICAgICAgICAgICAgICAoaW50MTZfdCkoZWZmZWN0LT5zZXNzaW9uLT5jb25maWcuZ2Fpbl9jb250cm9sbGVyMS50YXJnZXRfbGV2ZWxfZGJmcyAqIC0xMDApOworICAgICAgICAgICAgQUxPR1YoIkFnY0dldFBhcmFtZXRlcigpIHRhcmdldCBsZXZlbCAlZCBtaWxsaUJlbHMiLCAqKGludDE2X3QqKXBWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBR0NfUEFSQU1fQ09NUF9HQUlOOgorICAgICAgICAgICAgKihpbnQxNl90KilwVmFsdWUgPQorICAgICAgICAgICAgICAgICAgICAoaW50MTZfdCkoZWZmZWN0LT5zZXNzaW9uLT5jb25maWcuZ2Fpbl9jb250cm9sbGVyMS5jb21wcmVzc2lvbl9nYWluX2RiICogLTEwMCk7CisgICAgICAgICAgICBBTE9HVigiQWdjR2V0UGFyYW1ldGVyKCkgY29tcCBnYWluICVkIG1pbGxpQmVscyIsICooaW50MTZfdCopcFZhbHVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFHQ19QQVJBTV9MSU1JVEVSX0VOQToKKyAgICAgICAgICAgICooYm9vbCopcFZhbHVlID0gKGJvb2wpKGVmZmVjdC0+c2Vzc2lvbi0+Y29uZmlnLmdhaW5fY29udHJvbGxlcjEuZW5hYmxlX2xpbWl0ZXIpOworICAgICAgICAgICAgQUxPR1YoIkFnY0dldFBhcmFtZXRlcigpIGxpbWl0ZXIgZW5hYmxlZCAlcyIsCisgICAgICAgICAgICAgICAgICAoKihpbnQxNl90KilwVmFsdWUgIT0gMCkgPyAidHJ1ZSIgOiAiZmFsc2UiKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFHQ19QQVJBTV9QUk9QRVJUSUVTOgorICAgICAgICAgICAgcFByb3BlcnRpZXMtPnRhcmdldExldmVsID0KKyAgICAgICAgICAgICAgICAgICAgKGludDE2X3QpKGVmZmVjdC0+c2Vzc2lvbi0+Y29uZmlnLmdhaW5fY29udHJvbGxlcjEudGFyZ2V0X2xldmVsX2RiZnMgKiAtMTAwKTsKKyAgICAgICAgICAgIHBQcm9wZXJ0aWVzLT5jb21wR2FpbiA9CisgICAgICAgICAgICAgICAgICAgIChpbnQxNl90KShlZmZlY3QtPnNlc3Npb24tPmNvbmZpZy5nYWluX2NvbnRyb2xsZXIxLmNvbXByZXNzaW9uX2dhaW5fZGIgKiAtMTAwKTsKKyAgICAgICAgICAgIHBQcm9wZXJ0aWVzLT5saW1pdGVyRW5hYmxlZCA9CisgICAgICAgICAgICAgICAgICAgIChib29sKShlZmZlY3QtPnNlc3Npb24tPmNvbmZpZy5nYWluX2NvbnRyb2xsZXIxLmVuYWJsZV9saW1pdGVyKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgQUxPR1coIkFnY0dldFBhcmFtZXRlcigpIHVua25vd24gcGFyYW0gJWQiLCBwYXJhbSk7CisgICAgICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOworICAgICAgICAgICAgYnJlYWs7CiAgICAgfQogICAgIHJldHVybiBzdGF0dXM7CiB9CiAKLWludCBBZ2NTZXR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5zdHJlYW1fZGVsYXlfbXMoKTsKLSAgICAgICAgQUxPR1YoIkFlY0dldFBhcmFtZXRlcigpIGVjaG8gZGVsYXkgJWQgdXMiLCAqKHVpbnQzMl90ICopcFZhbHVlKTsKLSAgICAgICAgYnJlYWs7Ci0gICAgZGVmYXVsdDoKLSAgICAgICAgQUxPR1coIkFlY0dldFBhcmFtZXRlcigpIHVua25vd24gcGFyYW0gJTA4eCB2YWx1ZSAlMDh4IiwgcGFyYW0sICoodWludDMyX3QgKilwVmFsdWUpOwotICAgICAgICBzdGF0dXMgPSAtRUlOVkFMOwotICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBRUNfUEFSQU1fRUNIT19ERUxBWToKKyAgICAgICAgY2FzZSBBRUNfUEFSQU1fUFJPUEVSVElFUzoKKyAgICAgICAgICAgICoodWludDMyX3QqKXBWYWx1ZSA9IDEwMDAgKiBlZmZlY3QtPnNlc3Npb24tPmFwbS0+c3RyZWFtX2RlbGF5X21zKCk7CisgICAgICAgICAgICBBTE9HVigiQWVjR2V0UGFyYW1ldGVyKCkgZWNobyBkZWxheSAlZCB1cyIsICoodWludDMyX3QqKXBWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBRUNfUEFSQU1fTU9CSUxFX01PREU6CisgICAgICAgICAgICBlZmZlY3QtPnNlc3Npb24tPmNvbmZpZyA9IGVmZmVjdC0+c2Vzc2lvbi0+YXBtLT5HZXRDb25maWcoKTsKKyAgICAgICAgICAgICoodWludDMyX3QqKXBWYWx1ZSA9IGVmZmVjdC0+c2Vzc2lvbi0+Y29uZmlnLmVjaG9fY2FuY2VsbGVyLm1vYmlsZV9tb2RlOworICAgICAgICAgICAgQUxPR1YoIkFlY0dldFBhcmFtZXRlcigpIG1vYmlsZSBtb2RlICVkIHVzIiwgKih1aW50MzJfdCopcFZhbHVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgQUxPR1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gICAgICAgY2FzZSBQUkVQUk9DX0VGRkVDVF9TVEFURV9BQ1RJVkU6CisgICAgICAgICAgICAgICAgICAgIGVmZmVjdC0+b3BzLT5kaXNhYmxlKGVmZmVjdCk7CisgICAgICAgICAgICAgICAgICAgIFNlc3Npb25fU2V0UHJvY0VuYWJsZWQoZWZmZWN0LT5zZXNzaW9uLCBlZmZlY3QtPnByb2NJZCwgZmFsc2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFBSRVBST0NfRUZGRUNUX1NUQVRFX0NPTkZJRzoKKyAgICAgICAgICAgICAgICBjYXNlIFBSRVBST0NfRUZGRUNUX1NUQVRFX0NSRUFURUQ6CisgICAgICAgICAgICAgICAgY2FzZSBQUkVQUk9DX0VGRkVDVF9TVEFURV9JTklUOgorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICBCQURfU1RBVEVfQUJPUlQoZWZmZWN0LT5zdGF0ZSwgc3RhdGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgUFJFUFJPQ19FRkZFQ1RfU1RBVEVfQ1JFQVRFRDoKKyAgICAgICAgICAgIHN3aXRjaCAoZWZmZWN0LT5zdGF0ZSkgeworICAgICAgICAgICAgICAgIGNhc2UgUFJFUFJPQ19FRkZFQ1RfU1RBVEVfSU5JVDoKKyAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gZWZmZWN0LT5vcHMtPmNyZWF0ZShlZmZlY3QpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFBSRVBST0NfRUZGRUNUX1NUQVRFX0NSRUFURUQ6CisgICAgICAgICAgICAgICAgY2FzZSBQUkVQUk9DX0VGRkVDVF9TVEFURV9BQ1RJVkU6CisgICAgICAgICAgICAgICAgY2FzZSBQUkVQUk9DX0VGRkVDVF9TVEFURV9DT05GSUc6CisgICAgICAgICAgICAgICAgICAgIEFMT0dFKCJFZmZlY3RfU2V0U3RhdGUgaW52YWxpZCB0cmFuc2l0aW9uIik7CisgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FTk9TWVM7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIEJBRF9TVEFURV9BQk9SVChlZmZlY3QtPnN0YXRlLCBzdGF0ZSk7CisgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgY2FzZSBQUkVQUk9DX0VGRkVDVF9TVEFURV9DT05GSUc6Ci0gICAgICAgIGNhc2UgUFJFUFJPQ19FRkZFQ1RfU1RBVEVfQ1JFQVRFRDoKLSAgICAgICAgY2FzZSBQUkVQUk9DX0VGRkVDVF9TVEFURV9JTklUOgorICAgICAgICAgICAgc3dpdGNoIChlZmZlY3QtPnN0YXRlKSB7CisgICAgICAgICAgICAgICAgY2FzZSBQUkVQUk9DX0VGRkVDVF9TVEFURV9JTklUOgorICAgICAgICAgICAgICAgICAgICBBTE9HRSgiRWZmZWN0X1NldFN0YXRlIGludmFsaWQgdHJhbnNpdGlvbiIpOworICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSAtRU5PU1lTOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFBSRVBST0NfRUZGRUNUX1NUQVRFX0FDVElWRToKKyAgICAgICAgICAgICAgICAgICAgZWZmZWN0LT5vcHMtPmRpc2FibGUoZWZmZWN0KTsKKyAgICAgICAgICAgICAgICAgICAgU2Vzc2lvbl9TZXRQcm9jRW5hYmxlZChlZmZlY3QtPnNlc3Npb24sIGVmZmVjdC0+cHJvY0lkLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgUFJFUFJPQ19FRkZFQ1RfU1RBVEVfQ1JFQVRFRDoKKyAgICAgICAgICAgICAgICBjYXNlIFBSRVBST0NfRUZGRUNUX1NUQVRFX0NPTkZJRzoKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgQkFEX1NUQVRFX0FCT1JUKGVmZmVjdC0+c3RhdGUsIHN0YXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIFBSRVBST0NfRUZGRUNUX1NUQVRFX0FDVElWRToKKyAgICAgICAgICAgIHN3aXRjaCAoZWZmZWN0LT5zdGF0ZSkgeworICAgICAgICAgICAgICAgIGNhc2UgUFJFUFJPQ19FRkZFQ1RfU1RBVEVfSU5JVDoKKyAgICAgICAgICAgICAgICBjYXNlIFBSRVBST0NfRUZGRUNUX1NUQVRFX0NSRUFURUQ6CisgICAgICAgICAgICAgICAgICAgIEFMT0dFKCJFZmZlY3RfU2V0U3RhdGUgaW52YWxpZCB0cmFuc2l0aW9uIik7CisgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IC1FTk9TWVM7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgUFJFUFJPQ19FRkZFQ1RfU1RBVEVfQUNUSVZFOgorICAgICAgICAgICAgICAgICAgICAvLyBlbmFibGluZyBhbiBhbHJlYWR5IGVuYWJsZWQgZWZmZWN0IGlzIGp1c3QgaWdub3JlZAorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFBSRVBST0NfRUZGRUNUX1NUQVRFX0NPTkZJRzoKKyAgICAgICAgICAgICAgICAgICAgZWZmZWN0LT5vcHMtPmVuYWJsZShlZmZlY3QpOworICAgICAgICAgICAgICAgICAgICBTZXNzaW9uX1NldFByb2NFbmFibGVkKGVmZmVjdC0+c2Vzc2lvbiwgZWZmZWN0LT5wcm9jSWQsIHRydWU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gICAgICAgIFJFU0FNUExFUl9RVUFMSVRZLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcik7Ci0gICAgICAgIGlmIChzZXNzaW9uLT5pblJlc2FtcGxlciA9PSBOVUxMKSB7Ci0gICAgICAgICAgICBBTE9HVygiU2Vzc2lvbl9TZXRDb25maWcgQ2Fubm90IGNyZWF0ZSBzcGVleCByZXNhbXBsZXI6ICVzIiwKLSAgICAgICAgICAgICAgICAgc3BlZXhfcmVzYW1wbGVyX3N0cmVycm9yKGVycm9yKSk7Ci0gICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKLSAgICAgICAgfQotICAgICAgICBzZXNzaW9uLT5vdXRSZXNhbXBsZXIgPSBzcGVleF9yZXNhbXBsZXJfaW5pdChzZXNzaW9uLT5vdXRDaGFubmVsQ291bnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbi0+YXBtU2FtcGxpbmdSYXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24tPnNhbXBsaW5nUmF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRVNBTVBMRVJfUVVBTElUWSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpOwotICAgICAgICBpZiAoc2Vzc2lvbi0+b3V0UmVzYW1wbGVyID09IE5VTEwpIHsKLSAgICAgICAgICAgIEFMT0dXKCJTZXNzaW9uX1NldENvbmZpZyBDYW5ub3QgY3JlYXRlIHNwZWV4IHJlc2FtcGxlcjogJXMiLAotICAgICAgICAgICAgICAgICBzcGVleF9yZXNhbXBsZXJfc3RyZXJyb3IoZXJyb3IpKTsKLSAgICAgICAgICAgIHNwZWV4X3Jlc2FtcGxlcl9kZXN0cm95KHNlc3Npb24tPmluUmVzYW1wbGVyKTsKLSAgICAgICAgICAgIHNlc3Npb24tPmluUmVzYW1wbGVyID0gTlVMTDsKLSAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwotICAgICAgICB9Ci0gICAgICAgIHNlc3Npb24tPnJldlJlc2FtcGxlciA9IHNwZWV4X3Jlc2FtcGxlcl9pbml0KHNlc3Npb24tPmluQ2hhbm5lbENvdW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24tPnNhbXBsaW5nUmF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5hcG1TYW1wbGluZ1JhdGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVTQU1QTEVSX1FVQUxJVFksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmVycm9yKTsKLSAgICAgICAgaWYgKHNlc3Npb24tPnJldlJlc2FtcGxlciA9PSBOVUxMKSB7Ci0gICAgICAgICAgICBBTE9HVygiU2Vzc2lvbl9TZXRDb25maWcgQ2Fubm90IGNyZWF0ZSBzcGVleCByZXNhbXBsZXI6ICVzIiwKLSAgICAgICAgICAgICAgICAgc3BlZXhfcmVzYW1wbGVyX3N0cmVycm9yKGVycm9yKSk7Ci0gICAgICAgICAgICBzcGVleF9yZXNhbXBsZXJfZGVzdHJveShzZXNzaW9uLT5pblJlc2FtcGxlcik7Ci0gICAgICAgICAgICBzZXNzaW9uLT5pblJlc2FtcGxlciA9IE5VTEw7Ci0gICAgICAgICAgICBzcGVleF9yZXNhbXBsZXJfZGVzdHJveShzZXNzaW9uLT5vdXRSZXNhbXBsZXIpOwotICAgICAgICAgICAgc2Vzc2lvbi0+b3V0UmVzYW1wbGVyID0gTlVMTDsKLSAgICAgICAgICAgIHJldHVybiAtRU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ICAgICBmciAqIHNlc3Npb24tPm91dENoYW5uZWxDb3VudCAqIHNpemVvZihpbnQxNl90KSk7Ci0gICAgICAgICAgICBtZW1jcHkoc2Vzc2lvbi0+b3V0QnVmLAotICAgICAgICAgICAgICAgICAgc2Vzc2lvbi0+b3V0QnVmICsgZnIgKiBzZXNzaW9uLT5vdXRDaGFubmVsQ291bnQsCi0gICAgICAgICAgICAgICAgICAoc2Vzc2lvbi0+ZnJhbWVzT3V0IC0gZnIpICogc2Vzc2lvbi0+b3V0Q2hhbm5lbENvdW50ICogc2l6ZW9mKGludDE2X3QpKTsKLSAgICAgICAgICAgIHNlc3Npb24tPmZyYW1lc091dCAtPSBmcjsKLSAgICAgICAgICAgIGZyYW1lc1dyICs9IGZyOworICAgICAgICBpZiAoaW50IHN0YXR1cyA9IGVmZmVjdC0+c2Vzc2lvbi0+YXBtLT5Qcm9jZXNzU3RyZWFtKAorICAgICAgICAgICAgICAgICAgICAoY29uc3QgaW50MTZfdCogY29uc3QpaW5CdWZmZXItPnMxNiwKKyAgICAgICAgICAgICAgICAgICAgKGNvbnN0IHdlYnJ0Yzo6U3RyZWFtQ29uZmlnKWVmZmVjdC0+c2Vzc2lvbi0+aW5wdXRDb25maWcsCisgICAgICAgICAgICAgICAgICAgIChjb25zdCB3ZWJydGM6OlN0cmVhbUNvbmZpZyllZmZlY3QtPnNlc3Npb24tPm91dHB1dENvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgKGludDE2X3QqIGNvbnN0KW91dEJ1ZmZlci0+czE2KTsKKyAgICAgICAgICAgIHN0YXR1cyAhPSAwKSB7CisgICAgICAgICAgICBBTE9HRSgiUHJvY2VzcyBTdHJlYW0gZmFpbGVkIHdpdGggZXJyb3IgJWRcbiIsIHN0YXR1cyk7CisgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwogICAgICAgICB9Ci0gICAgICAgIG91dEJ1ZmZlci0+ZnJhbWVDb3VudCA9IGZyYW1lc1dyOwotICAgICAgICBpZiAoZnJhbWVzV3IgPT0gZnJhbWVzUnEpIHsKLSAgICAgICAgICAgIGluQnVmZmVyLT5mcmFtZUNvdW50ID0gMDsKLSAgICAgICAgICAgIHJldHVybiAwOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHNlc3Npb24tPmluUmVzYW1wbGVyICE9IE5VTEwpIHsKLSAgICAgICAgICAgIHNpemVfdCBmciA9IHNlc3Npb24tPmZyYW1lQ291bnQgLSBzZXNzaW9uLT5mcmFtZXNJbjsKLSAgICAgICAgICAgIGlmIChpbkJ1ZmZlci0+ZnJhbWVDb3VudCA8IGZyKSB7Ci0gICAgICAgICAgICAgICAgZnIgPSBpbkJ1ZmZlci0+ZnJhbWVDb3VudDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChzZXNzaW9uLT5pbkJ1ZlNpemUgPCBzZXNzaW9uLT5mcmFtZXNJbiArIGZyKSB7Ci0gICAgICAgICAgICAgICAgaW50MTZfdCAqYnVmOwotICAgICAgICAgICAgICAgIHNlc3Npb24tPmluQnVmU2l6ZSA9IHNlc3Npb24tPmZyYW1lc0luICsgZnI7Ci0gICAgICAgICAgICAgICAgYnVmID0gKGludDE2X3QgKilyZWFsbG9jKHNlc3Npb24tPmluQnVmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbi0+aW5CdWZTaXplICogc2Vzc2lvbi0+aW5DaGFubmVsQ291bnQgKiBzaXplb2YoaW50MTZfdCkpOwotICAgICAgICAgICAgICAgIGlmIChidWYgPT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5mcmFtZXNJbiA9IDA7Ci0gICAgICAgICAgICAgICAgICAgIGZyZWUoc2Vzc2lvbi0+aW5CdWYpOwotICAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5pbkJ1ZiA9IE5VTEw7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiAtRU5PTUVNOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBzZXNzaW9uLT5pbkJ1ZiA9IGJ1ZjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1lbWNweShzZXNzaW9uLT5pbkJ1ZiArIHNlc3Npb24tPmZyYW1lc0luICogc2Vzc2lvbi0+aW5DaGFubmVsQ291bnQsCi0gICAgICAgICAgICAgICAgICAgaW5CdWZmZXItPnMxNiwKLSAgICAgICAgICAgICAgICAgICBmciAqIHNlc3Npb24tPmluQ2hhbm5lbENvdW50ICogc2l6ZW9mKGludDE2X3QpKTsKLSNpZmRlZiBEVUFMX01JQ19URVNUCi0gICAgICAgICAgICBwdGhyZWFkX211dGV4X2xvY2soJmdQY21EdW1wTG9jayk7Ci0gICAgICAgICAgICBpZiAoZ1BjbUR1bXBGaCAhPSBOVUxMKSB7Ci0gICAgICAgICAgICAgICAgZndyaXRlKGluQnVmZmVyLT5yYXcsCi0gICAgICAgICAgICAgICAgICAgICAgIGZyICogc2Vzc2lvbi0+aW5DaGFubmVsQ291bnQgKiBzaXplb2YoaW50MTZfdCksIDEsIGdQY21EdW1wRmgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcHRocmVhZF9tdXRleF91bmxvY2soJmdQY21EdW1wTG9jayk7Ci0jZW5kaWYKLQotICAgICAgICAgICAgc2Vzc2lvbi0+ZnJhbWVzSW4gKz0gZnI7Ci0gICAgICAgICAgICBpbkJ1ZmZlci0+ZnJhbWVDb3VudCA9IGZyOwotICAgICAgICAgICAgaWYgKHNlc3Npb24tPmZyYW1lc0luIDwgc2Vzc2lvbi0+ZnJhbWVDb3VudCkgewotICAgICAgICAgICAgICAgIHJldHVybiAwOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3B4X3VpbnQzMl90IGZySW4gPSBzZXNzaW9uLT5mcmFtZXNJbjsKLSAgICAgICAgICAgIHNweF91aW50MzJfdCBmck91dCA9IHNlc3Npb24tPmFwbUZyYW1lQ291bnQ7Ci0gICAgICAgICAgICBpZiAoc2Vzc2lvbi0+aW5DaGFubmVsQ291bnQgPT0gMSkgewotICAgICAgICAgICAgICAgIHNwZWV4X3Jlc2FtcGxlcl9wcm9jZXNzX2ludChzZXNzaW9uLT5pblJlc2FtcGxlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbi0+aW5CdWYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmckluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5wcm9jRnJhbWUtPmRhdGFfLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZnJPdXQpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBzcGVleF9yZXNhbXBsZXJfcHJvY2Vzc19pbnRlcmxlYXZlZF9pbnQoc2Vzc2lvbi0+aW5SZXNhbXBsZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24tPmluQnVmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZnJJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbi0+cHJvY0ZyYW1lLT5kYXRhXywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZyT3V0KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1lbWNweShzZXNzaW9uLT5pbkJ1ZiwKLSAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5pbkJ1ZiArIGZySW4gKiBzZXNzaW9uLT5pbkNoYW5uZWxDb3VudCwKLSAgICAgICAgICAgICAgICAgICAoc2Vzc2lvbi0+ZnJhbWVzSW4gLSBmckluKSAqIHNlc3Npb24tPmluQ2hhbm5lbENvdW50ICogc2l6ZW9mKGludDE2X3QpKTsKLSAgICAgICAgICAgIHNlc3Npb24tPmZyYW1lc0luIC09IGZySW47Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBzaXplX3QgZnIgPSBzZXNzaW9uLT5mcmFtZUNvdW50IC0gc2Vzc2lvbi0+ZnJhbWVzSW47Ci0gICAgICAgICAgICBpZiAoaW5CdWZmZXItPmZyYW1lQ291bnQgPCBmcikgewotICAgICAgICAgICAgICAgIGZyID0gaW5CdWZmZXItPmZyYW1lQ291bnQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtZW1jcHkoc2Vzc2lvbi0+cHJvY0ZyYW1lLT5kYXRhXyArIHNlc3Npb24tPmZyYW1lc0luICogc2Vzc2lvbi0+aW5DaGFubmVsQ291bnQsCi0gICAgICAgICAgICAgICAgICAgaW5CdWZmZXItPnMxNiwKLSAgICAgICAgICAgICAgICAgICBmciAqIHNlc3Npb24tPmluQ2hhbm5lbENvdW50ICogc2l6ZW9mKGludDE2X3QpKTsKLQotI2lmZGVmIERVQUxfTUlDX1RFU1QKLSAgICAgICAgICAgIHB0aHJlYWRfbXV0ZXhfbG9jaygmZ1BjbUR1bXBMb2NrKTsKLSAgICAgICAgICAgIGlmIChnUGNtRHVtcEZoICE9IE5VTEwpIHsKLSAgICAgICAgICAgICAgICBmd3JpdGUoaW5CdWZmZXItPnJhdywKLSAgICAgICAgICAgICAgICAgICAgICAgZnIgKiBzZXNzaW9uLT5pbkNoYW5uZWxDb3VudCAqIHNpemVvZihpbnQxNl90KSwgMSwgZ1BjbUR1bXBGaCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBwdGhyZWFkX211dGV4X3VubG9jaygmZ1BjbUR1bXBMb2NrKTsKLSNlbmRpZgotCi0gICAgICAgICAgICBzZXNzaW9uLT5mcmFtZXNJbiArPSBmcjsKLSAgICA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ICAgICAgIHJldHVybiAtRU5PTUVNOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc2Vzc2lvbi0+b3V0QnVmID0gYnVmOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHNlc3Npb24tPm91dFJlc2FtcGxlciAhPSBOVUxMKSB7Ci0gICAgICAgICAgICBzcHhfdWludDMyX3QgZnJJbiA9IHNlc3Npb24tPmFwbUZyYW1lQ291bnQ7Ci0gICAgICAgICAgICBzcHhfdWludDMyX3QgZnJPdXQgPSBzZXNzaW9uLT5mcmFtZUNvdW50OwotICAgICAgICAgICAgaWYgKHNlc3Npb24tPmluQ2hhbm5lbENvdW50ID09IDEpIHsKLSAgICAgICAgICAgICAgICBzcGVleF9yZXNhbXBsZXJfcHJvY2Vzc19pbnQoc2Vzc2lvbi0+b3V0UmVzYW1wbGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24tPnByb2NGcmFtZS0+ZGF0YV8sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZnJJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24tPm91dEJ1ZiArIHNlc3Npb24tPmZyYW1lc091dCAqIHNlc3Npb24tPm91dENoYW5uZWxDb3VudCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmck91dCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHNwZWV4X3Jlc2FtcGxlcl9wcm9jZXNzX2ludGVybGVhdmVkX2ludChzZXNzaW9uLT5vdXRSZXNhbXBsZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5wcm9jRnJhbWUtPmRhdGFfLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZySW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5vdXRCdWYgKyBzZXNzaW9uLT5mcmFtZXNPdXQgKiBzZXNzaW9uLT5vdXRDaGFubmVsQ291bnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZnJPdXQpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc2Vzc2lvbi0+ZnJhbWVzT3V0ICs9IGZyT3V0OwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgbWVtY3B5KHNlc3Npb24tPm91dEJ1ZiArIHNlc3Npb24tPmZyYW1lc091dCAqIHNlc3Npb24tPm91dENoYW5uZWxDb3VudCwKLSAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5wcm9jRnJhbWUtPmRhdGFfLAotICAgICAgICAgICAgICAgICAgIHNlc3Npb24tPmZyYW1lQ291bnQgKiBzZXNzaW9uLT5vdXRDaGFubmVsQ291bnQgKiBzaXplb2YoaW50MTZfdCkpOwotICAgICAgICAgICAgc2Vzc2lvbi0+ZnJhbWVzT3V0ICs9IHNlc3Npb24tPmZyYW1lQ291bnQ7Ci0gICAgICAgIH0KLSAgICAgICAgc2l6ZV90IGZyID0gc2Vzc2lvbi0+ZnJhbWVzT3V0OwotICAgICAgICBpZiAoZnJhbWVzUnEgLSBmcmFtZXNXciA8IGZyKSB7Ci0gICAgICAgICAgICBmciA9IGZyYW1lc1JxIC0gZnJhbWVzV3I7Ci0gICAgICAgIH0KLSAgICAgICAgbWVtY3B5KG91dEJ1ZmZlci0+czE2ICsgZnJhbWVzV3IgKiBzZXNzaW9uLT5vdXRDaGFubmVsQ291bnQsCi0gICAgICAgICAgICAgIHNlc3Npb24tPm91dEJ1ZiwKLSAgICAgICAgICAgICAgZnIgKiBzZXNzaW9uLT5vdXRDaGFubmVsQ291bnQgKiBzaXplb2YoaW50MTZfdCkpOwotICAgICAgICBtZW1jcHkoc2Vzc2lvbi0+b3V0QnVmLAotICAgICAgICAgICAgICBzZXNzaW9uLT5vdXRCdWYgKyBmciAqIHNlc3Npb24tPm91dENoYW5uZWxDb3VudCwKLSAgICAgICAgICAgICAgKHNlc3Npb24tPmZyYW1lc091dCAtIGZyKSAqIHNlc3Npb24tPm91dENoYW5uZWxDb3VudCAqIHNpemVvZihpbnQxNl90KSk7Ci0gICAgICAgIHNlc3Npb24tPmZyYW1lc091dCAtPSBmcjsKLSAgICAgICAgb3V0QnVmZmVyLT5mcmFtZUNvdW50ICs9IGZyOwotCiAgICAgICAgIHJldHVybiAwOwogICAgIH0gZWxzZSB7CiAgICAgICAgIHJldHVybiAtRU5PREFUQTsKICAgICB9CiB9CiAKLWludCBQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZChlZmZlY3RfaGFuZGxlX3QgIHNlbGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgICAgICAgICBjbWRDb2RlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICAgICAgICAgICAgY21kU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICAgICAgICAgICpwQ21kRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAgICAgICAgICAgICpyZXBseVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAgICAgICAqcFJlcGx5RGF0YSkKLXsKLSAgICBwcmVwcm9jX2VmZmVjdF90ICogZWZmZWN0ID0gKHByZXByb2NfZWZmZWN0X3QgKikgc2VsZjsKK2ludCBQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZChlZmZlY3RfaGFuZGxlX3Qgc2VsZiwgdWludDMyX3QgY21kQ29kZSwgdWludDMyX3QgY21kU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkKiBwQ21kRGF0YSwgdWludDMyX3QqIHJlcGx5U2l6ZSwgdm9pZCogcFJlcGx5RGF0YSkgeworICAgIHByZXByb2NfZWZmZWN0X3QqIGVmZmVjdCA9IChwcmVwcm9jX2VmZmVjdF90KilzZWxmOwogCi0gICAgaWYgKGVmZmVjdCA9PSBOVUxMKXsKKyAgICBpZiAoZWZmZWN0ID09IE5VTEwpIHsKICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgfQogCi0gICAgLy9BTE9HVigiUHJlUHJvY2Vzc2luZ0Z4X0NvbW1hbmQ6IGNvbW1hbmQgJWQgY21kU2l6ZSAlZCIsY21kQ29kZSwgY21kU2l6ZSk7CisgICAgLy8gQUxPR1YoIlByZVByb2Nlc3NpbmdGeF9Db21tYW5kOiBjb21tYW5kICVkIGNtZFNpemUgJWQiLGNtZENvZGUsIGNtZFNpemUpOwogCi0gICAgc3dpdGNoIChjbWRDb2RlKXsKKyAgICBzd2l0Y2ggKGNtZENvZGUpIHsKICAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX0lOSVQ6Ci0gICAgICAgICAgICBpZiAocFJlcGx5RGF0YSA9PSBOVUxMIHx8ICpyZXBseVNpemUgIT0gc2l6ZW9mKGludCkpeworICAgICAgICAgICAgaWYgKHBSZXBseURhdGEgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQpKSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAoZWZmZWN0LT5vcHMtPmluaXQpIHsKICAgICAgICAgICAgICAgICBlZmZlY3QtPm9wcy0+aW5pdChlZmZlY3QpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgKihpbnQgKilwUmVwbHlEYXRhID0gMDsKKyAgICAgICAgICAgICooaW50KilwUmVwbHlEYXRhID0gMDsKICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9TRVRfQ09ORklHOiB7Ci0gICAgICAgICAgICBpZiAocENtZERhdGEgICAgPT0gTlVMTHx8Ci0gICAgICAgICAgICAgICAgY21kU2l6ZSAgICAgIT0gc2l6ZW9mKGVmZmVjdF9jb25maWdfdCl8fAotICAgICAgICAgICAgICAgIHBSZXBseURhdGEgID09IE5VTEx8fAotICAgICAgICAgICAgICAgICpyZXBseVNpemUgICE9IHNpemVvZihpbnQpKXsKKyAgICAgICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMIHx8IGNtZFNpemUgIT0gc2l6ZW9mKGVmZmVjdF9jb25maWdfdCkgfHwgcFJlcGx5RGF0YSA9PSBOVUxMIHx8CisgICAgICAgICAgICAgICAgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9DT05GSUc6IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfU0VUX0NPTkZJRzogRVJST1IiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KICNpZmRlZiBEVUFMX01JQ19URVNUCkBAIC0xNDM2LDU1ICsxMTMxLDUxIEBACiAgICAgICAgICAgICAgICAgZWZmZWN0LT5zZXNzaW9uLT5lbmFibGVkTXNrID0gMDsKICAgICAgICAgICAgIH0KICNlbmRpZgotICAgICAgICAgICAgKihpbnQgKilwUmVwbHlEYXRhID0gU2Vzc2lvbl9TZXRDb25maWcoZWZmZWN0LT5zZXNzaW9uLCAoZWZmZWN0X2NvbmZpZ190ICopcENtZERhdGEpOworICAgICAgICAgICAgKihpbnQqKXBSZXBseURhdGEgPSBTZXNzaW9uX1NldENvbmZpZyhlZmZlY3QtPnNlc3Npb24sIChlZmZlY3RfY29uZmlnX3QqKXBDbWREYXRhKTsKICNpZmRlZiBEVUFMX01JQ19URVNUCiAgICAgICAgICAgICBpZiAoZ0R1YWxNaWNFbmFibGVkKSB7CiAgICAgICAgICAgICAgICAgZWZmZWN0LT5zZXNzaW9uLT5lbmFibGVkTXNrID0gZW5hYmxlZE1zazsKICAgICAgICAgICAgIH0KICNlbmRpZgotICAgICAgICAgICAgaWYgKCooaW50ICopcFJlcGx5RGF0YSAhPSAwKSB7CisgICAgICAgICAgICBpZiAoKihpbnQqKXBSZXBseURhdGEgIT0gMCkgewogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKGVmZmVjdC0+c3RhdGUgIT0gUFJFUFJPQ19FRkZFQ1RfU1RBVEVfQUNUSVZFKSB7Ci0gICAgICAgICAgICAgICAgKihpbnQgKilwUmVwbHlEYXRhID0gRWZmZWN0X1NldFN0YXRlKGVmZmVjdCwgUFJFUFJPQ19FRkZFQ1RfU1RBVEVfQ09ORklHKTsKKyAgICAgICAgICAgICAgICAqKGludCopcFJlcGx5RGF0YSA9IEVmZmVjdF9TZXRTdGF0ZShlZmZlY3QsIFBSRVBST0NfRUZGRUNUX1NUQVRFX0NPTkZJRyk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGJyZWFrOworICAgICAgICB9IGJyZWFrOwogCiAgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9HRVRfQ09ORklHOgotICAgICAgICAgICAgaWYgKHBSZXBseURhdGEgPT0gTlVMTCB8fAotICAgICAgICAgICAgICAgICpyZXBseVNpemUgIT0gc2l6ZW9mKGVmZmVjdF9jb25maWdfdCkpIHsKKyAgICAgICAgICAgIGlmIChwUmVwbHlEYXRhID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoZWZmZWN0X2NvbmZpZ190KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJcdExWTV9FUlJPUiA6IFByZVByb2Nlc3NpbmdGeF9Db21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfR0VUX0NPTkZJRzogRVJST1IiKTsKKyAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9HRVRfQ09ORklHOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBTZXNzaW9uX0dldENvbmZpZyhlZmZlY3QtPnNlc3Npb24sIChlZmZlY3RfY29uZmlnX3QgKilwUmVwbHlEYXRhKTsKKyAgICAgICAgICAgIFNlc3Npb25fR2V0Q29uZmlnKGVmZmVjdC0+c2Vzc2lvbiwgKGVmZmVjdF9jb25maWdfdCopcFJlcGx5RGF0YSk7CiAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX0NPTkZJR19SRVZFUlNFOgotICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwKLSAgICAgICAgICAgICAgICBjbWRTaXplICE9IHNpemVvZihlZmZlY3RfY29uZmlnX3QpIHx8Ci0gICAgICAgICAgICAgICAgcFJlcGx5RGF0YSA9PSBOVUxMIHx8CisgICAgICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCBjbWRTaXplICE9IHNpemVvZihlZmZlY3RfY29uZmlnX3QpIHx8IHBSZXBseURhdGEgPT0gTlVMTCB8fAogICAgICAgICAgICAgICAgICpyZXBseVNpemUgIT0gc2l6ZW9mKGludCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiUHJlUHJvY2Vzc2luZ0Z4X0NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfQ09ORklHX1JFVkVSU0U6IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfU0VUX0NPTkZJR19SRVZFUlNFOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgKihpbnQgKilwUmVwbHlEYXRhID0gU2Vzc2lvbl9TZXRSZXZlcnNlQ29uZmlnKGVmZmVjdC0+c2Vzc2lvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZWZmZWN0X2NvbmZpZ190ICopcENtZERhdGEpOwotICAgICAgICAgICAgaWYgKCooaW50ICopcFJlcGx5RGF0YSAhPSAwKSB7CisgICAgICAgICAgICAqKGludCopcFJlcGx5RGF0YSA9CisgICAgICAgICAgICAgICAgICAgIFNlc3Npb25fU2V0UmV2ZXJzZUNvbmZpZyhlZmZlY3QtPnNlc3Npb24sIChlZmZlY3RfY29uZmlnX3QqKXBDbWREYXRhKTsKKyAgICAgICAgICAgIGlmICgqKGludCopcFJlcGx5RGF0YSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIEVGRkVDVF9DTURfR0VUX0NPTkZJR19SRVZFUlNFOgotICAgICAgICAgICAgaWYgKHBSZXBseURhdGEgPT0gTlVMTCB8fAotICAgICAgICAgICAgICAgICpyZXBseVNpemUgIT0gc2l6ZW9mKGVmZmVjdF9jb25maWdfdCkpeworICAgICAgICAgICAgaWYgKHBSZXBseURhdGEgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihlZmZlY3RfY29uZmlnX3QpKSB7CiAgICAgICAgICAgICAgICAgQUxPR1YoIlByZVByb2Nlc3NpbmdGeF9Db21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfR0VUX0NPTkZJR19SRVZFUlNFOiBFUlJPUiIpOworICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX0dFVF9DT05GSUdfUkVWRVJTRTogRVJST1IiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAg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VmZmVjdF9wYXJhbV90KSArIHAtPnBzaXplKSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX0dFVF9QQVJBTTogRVJST1IiKTsKKyAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9HRVRfUEFSQU06IEVSUk9SIik7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIG1lbWNweShwUmVwbHlEYXRhLCBwQ21kRGF0YSwgc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHAtPnBzaXplKTsKIAotICAgICAgICAgICAgcCA9IChlZmZlY3RfcGFyYW1fdCAqKXBSZXBseURhdGE7CisgICAgICAgICAgICBwID0gKGVmZmVjdF9wYXJhbV90KilwUmVwbHlEYXRhOwogCiAgICAgICAgICAgICBpbnQgdm9mZnNldCA9ICgocC0+cHNpemUgLSAxKSAvIHNpemVvZihpbnQzMl90KSArIDEpICogc2l6ZW9mKGludDMyX3QpOwogCiAgICAgICAgICAgICBpZiAoZWZmZWN0LT5vcHMtPmdldF9wYXJhbWV0ZXIpIHsKLSAgICAgICAgICAgICAgICBwLT5zdGF0dXMgPSBlZmZlY3QtPm9wcy0+Z2V0X3BhcmFtZXRlcihlZmZlY3QsIHAtPmRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnAtPnZzaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPmRhdGEgKyB2b2Zmc2V0KTsKKyAgICAgICAgICAgICAgICBwLT5zdGF0dXMgPQorICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0LT5vcHMtPmdldF9wYXJhbWV0ZXIoZWZmZWN0LCBwLT5kYXRhLCAmcC0+dnNpemUsIHAtPmRhdGEgKyB2b2Zmc2V0KTsKICAgICAgICAgICAgICAgICAqcmVwbHlTaXplID0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSArIHZvZmZzZXQgKyBwLT52c2l6ZTsKICAgICAgICAgICAgIH0KICAgICAgICAgfSBicmVhazsKIAotICAgICAgICBjYXNlIEVGRkVDVF9DTURfU0VUX1BBUkFNOnsKLSAgICAgICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMfHwKLSAgICAgICAgICAgICAgICAgICAgY21kU2l6ZSA8IHNpemVvZihlZmZlY3RfcGFyYW1fdCkgfHwKLSAgICAgICAgICAgICAgICAgICAgcFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMIHx8Ci0gICAgICAgICAgICAgICAgICAgICpyZXBseVNpemUgIT0gc2l6ZW9mKGludDMyX3QpKXsKKyAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX1NFVF9QQVJBTTogeworICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwgY21kU2l6ZSA8IHNpemVvZihlZmZlY3RfcGFyYW1fdCkgfHwgcFJlcGx5RGF0YSA9PSBOVUxMIHx8CisgICAgICAgICAgICAgICAgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50MzJfdCkpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiUHJlUHJvY2Vzc2luZ0Z4X0NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfUEFSQU06IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfU0VUX1BBUkFNOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgZWZmZWN0X3BhcmFtX3QgKnAgPSAoZWZmZWN0X3BhcmFtX3QgKikgcENtZERhdGE7CisgICAgICAgICAgICBlZmZlY3RfcGFyYW1fdCogcCA9IChlZmZlY3RfcGFyYW1fdCopcENtZERhdGE7CiAKLSAgICAgICAgICAgIGlmIChwLT5wc2l6ZSAhPSBzaXplb2YoaW50MzJfdCkpeworICAgICAgICAgICAgaWYgKHAtPnBzaXplICE9IHNpemVvZihpbnQzMl90KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9QQVJBTTogRVJST1IsIHBzaXplIGlzIG5vdCBzaXplb2YoaW50MzJfdCkiKTsKKyAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfUEFSQU06IEVSUk9SLCBwc2l6ZSBpcyBub3Qgc2l6ZW9mKGludDMyX3QpIik7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAoZWZmZWN0LT5vcHMtPnNldF9wYXJhbWV0ZXIpIHsKLSAgICAgICAgICAgICAgICAqKGludCAqKXBSZXBseURhdGEgPSBlZmZlY3QtPm9wcy0+c2V0X3BhcmFtZXRlcihlZmZlY3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgKilwLT5kYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAtPmRhdGEgKyBwLT5wc2l6ZSk7CisgICAgICAgICAgICAgICAgKihpbnQqKXBSZXBseURhdGEgPQorICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0LT5vcHMtPnNldF9wYXJhbWV0ZXIoZWZmZWN0LCAodm9pZCopcC0+ZGF0YSwgcC0+ZGF0YSArIHAtPnBzaXplKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfSBicmVhazsKIAogICAgICAgICBjYXNlIEVGRkVDVF9DTURfRU5BQkxFOgotICAgICAgICAgICAgaWYgKHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQpKXsKKyAgICAgICAgICAgIGlmIChwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBjbWRDb2RlIENhc2U6IEVGRkVDVF9DTURfRU5BQkxFOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgKihpbnQgKilwUmVwbHlEYXRhID0gRWZmZWN0X1NldFN0YXRlKGVmZmVjdCwgUFJFUFJPQ19FRkZFQ1RfU1RBVEVfQUNUSVZFKTsKKyAgICAgICAgICAgICooaW50KilwUmVwbHlEYXRhID0gRWZmZWN0X1NldFN0YXRlKGVmZmVjdCwgUFJFUFJPQ19FRkZFQ1RfU1RBVEVfQUNUSVZFKTsKICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9ESVNBQkxFOgotICAgICAgICAgICAgaWYgKHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCB8fCAqcmVwbHlTaXplICE9IHNpemVvZihpbnQpKXsKKyAgICAgICAgICAgIGlmIChwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSAhPSBzaXplb2YoaW50KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBjbWRDb2RlIENhc2U6IEVGRkVDVF9DTURfRElTQUJMRTogRVJST1IiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICooaW50ICopcFJlcGx5RGF0YSAgPSBFZmZlY3RfU2V0U3RhdGUoZWZmZWN0LCBQUkVQUk9DX0VGRkVDVF9TVEFURV9DT05GSUcpOworICAgICAgICAgICAgKihpbnQqKXBSZXBseURhdGEgPSBFZmZlY3RfU2V0U3RhdGUoZWZmZWN0LCBQUkVQUk9DX0VGRkVDVF9TVEFURV9DT05GSUcpOwogICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgY2FzZSBFRkZFQ1RfQ01EX1NFVF9ERVZJQ0U6CiAgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9TRVRfSU5QVVRfREVWSUNFOgotICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwKLSAgICAgICAgICAgICAgICBjbWRTaXplICE9IHNpemVvZih1aW50MzJfdCkpIHsKKyAgICAgICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMIHx8IGNtZFNpemUgIT0gc2l6ZW9mKHVpbnQzMl90KSkgewogICAgICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBjbWRDb2RlIENhc2U6IEVGRkVDVF9DTURfU0VUX0RFVklDRTogRVJST1IiKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgaWYgKGVmZmVjdC0+b3BzLT5zZXRfZGV2aWNlKSB7Ci0gICAgICAgICAgICAgICAgZWZmZWN0LT5vcHMtPnNldF9kZXZpY2UoZWZmZWN0LCAqKHVpbnQzMl90ICopcENtZERhdGEpOworICAgICAgICAgICAgICAgIGVmZmVjdC0+b3BzLT5zZXRfZGV2aWNlKGVmZmVjdCwgKih1aW50MzJfdCopcENtZERhdGEpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7CiAKQEAgLTE1NzgsMzAgKzEyNjMsMzAgQEAKICNpZmRlZiBEVUFMX01JQ19URVNUCiAgICAgICAgIC8vLy8vIHRlc3QgY29tbWFuZHMgc3RhcnQKICAgICAgICAgY2FzZSBQUkVQUk9DX0NNRF9EVUFMX01JQ19FTkFCTEU6IHsKLSAgICAgICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMfHwgY21kU2l6ZSAhPSBzaXplb2YodWludDMyX3QpIHx8Ci0gICAgICAgICAgICAgICAgICAgIHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCkgeworICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEwgfHwgY21kU2l6ZSAhPSBzaXplb2YodWludDMyX3QpIHx8IHBSZXBseURhdGEgPT0gTlVMTCB8fAorICAgICAgICAgICAgICAgIHJlcGx5U2l6ZSA9PSBOVUxMKSB7CiAgICAgICAgICAgICAgICAgQUxPR0UoIlByZVByb2Nlc3NpbmdGeF9Db21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgIlBSRVBST0NfQ01EX0RVQUxfTUlDX0VOQUJMRTogRVJST1IiKTsKKyAgICAgICAgICAgICAgICAgICAgICAiUFJFUFJPQ19DTURfRFVBTF9NSUNfRU5BQkxFOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgICpyZXBseVNpemUgPSAwOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgZ0R1YWxNaWNFbmFibGVkID0gKihib29sICopcENtZERhdGE7CisgICAgICAgICAgICBnRHVhbE1pY0VuYWJsZWQgPSAqKGJvb2wqKXBDbWREYXRhOwogICAgICAgICAgICAgaWYgKGdEdWFsTWljRW5hYmxlZCkgewogICAgICAgICAgICAgICAgIGVmZmVjdC0+YXV4X2NoYW5uZWxzX29uID0gc0hhc0F1eENoYW5uZWxzW2VmZmVjdC0+cHJvY0lkXTsKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgZWZmZWN0LT5hdXhfY2hhbm5lbHNfb24gPSBmYWxzZTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVmZmVjdC0+Y3VyX2NoYW5uZWxfY29uZmlnID0gKGVmZmVjdC0+c2Vzc2lvbi0+aW5DaGFubmVsQ291bnQgPT0gMSkgPwotICAgICAgICAgICAgICAgICAgICBDSEFOTkVMX0NGR19NT05PIDogQ0hBTk5FTF9DRkdfU1RFUkVPOworICAgICAgICAgICAgZWZmZWN0LT5jdXJfY2hhbm5lbF9jb25maWcgPQorICAgICAgICAgICAgICAgICAgICAoZWZmZWN0LT5zZXNzaW9uLT5pbkNoYW5uZWxDb3VudCA9PSAxKSA/IENIQU5ORUxfQ0ZHX01PTk8gOiBDSEFOTkVMX0NGR19TVEVSRU87CiAKICAgICAgICAgICAgIEFMT0dWKCJQUkVQUk9DX0NNRF9EVUFMX01JQ19FTkFCTEU6ICVzIiwgZ0R1YWxNaWNFbmFibGVkID8gImVuYWJsZWQiIDogImRpc2FibGVkIik7CiAgICAgICAgICAgICAqcmVwbHlTaXplID0gc2l6ZW9mKGludCk7Ci0gICAgICAgICAgICAqKGludCAqKXBSZXBseURhdGEgPSAwOwotICAgICAgICAgICAgfSBicmVhazsKKyAgICAgICAgICAgICooaW50KilwUmVwbHlEYXRhID0gMDsKKyAgICAgICAgfSBicmVhazsKICAgICAgICAgY2FzZSBQUkVQUk9DX0NNRF9EVUFMX01JQ19QQ01fRFVNUF9TVEFSVDogewotICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEx8fCBwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwpIHsKKyAgICAgICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMIHx8IHBSZXBseURhdGEgPT0gTlVMTCB8fCByZXBseVNpemUgPT0gTlVMTCkgewogICAgICAgICAgICAgICAgIEFMT0dFKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICJQUkVQUk9DX0NNRF9EVUFMX01JQ19QQ01fRFVNUF9TVEFSVDogRVJST1IiKTsKKyAgICAgICAgICAgICAgICAgICAgICAiUFJFUFJPQ19DTURfRFVBTF9NSUNfUENNX0RVTVBfU1RBUlQ6IEVSUk9SIik7CiAgICAgICAgICAgICAgICAgKnJlcGx5U2l6ZSA9IDA7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CkBAIC0xNjEwLDIwICsxMjk1LDE5IEBACiAgICAgICAgICAgICAgICAgZmNsb3NlKGdQY21EdW1wRmgpOwogICAgICAgICAgICAgICAgIGdQY21EdW1wRmggPSBOVUxMOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgY2hhciAqcGF0aCA9IHN0cm5kdXAoKGNoYXIgKilwQ21kRGF0YSwgY21kU2l6ZSk7Ci0gICAgICAgICAgICBnUGNtRHVtcEZoID0gZm9wZW4oKGNoYXIgKilwYXRoLCAid2IiKTsKKyAgICAgICAgICAgIGNoYXIqIHBhdGggPSBzdHJuZHVwKChjaGFyKilwQ21kRGF0YSwgY21kU2l6ZSk7CisgICAgICAgICAgICBnUGNtRHVtcEZoID0gZm9wZW4oKGNoYXIqKXBhdGgsICJ3YiIpOwogICAgICAgICAgICAgcHRocmVhZF9tdXRleF91bmxvY2soJmdQY21EdW1wTG9jayk7Ci0gICAgICAgICAgICBBTE9HVigiUFJFUFJPQ19DTURfRFVBTF9NSUNfUENNX0RVTVBfU1RBUlQ6IHBhdGggJXMgZ1BjbUR1bXBGaCAlcCIsCi0gICAgICAgICAgICAgICAgICBwYXRoLCBnUGNtRHVtcEZoKTsKKyAgICAgICAgICAgIEFMT0dWKCJQUkVQUk9DX0NNRF9EVUFMX01JQ19QQ01fRFVNUF9TVEFSVDogcGF0aCAlcyBnUGNtRHVtcEZoICVwIiwgcGF0aCwgZ1BjbUR1bXBGaCk7CiAgICAgICAgICAgICBBTE9HRV9JRihnUGNtRHVtcEZoIDw9IDAsICJnUGNtRHVtcEZoIG9wZW4gZXJyb3IgJWQgJXMiLCBlcnJubywgc3RyZXJyb3IoZXJybm8pKTsKICAgICAgICAgICAgIGZyZWUocGF0aCk7CiAgICAgICAgICAgICAqcmVwbHlTaXplID0gc2l6ZW9mKGludCk7Ci0gICAgICAgICAgICAqKGludCAqKXBSZXBseURhdGEgPSAwOwotICAgICAgICAgICAgfSBicmVhazsKKyAgICAgICAgICAgICooaW50KilwUmVwbHlEYXRhID0gMDsKKyAgICAgICAgfSBicmVhazsKICAgICAgICAgY2FzZSBQUkVQUk9DX0NNRF9EVUFMX01JQ19QQ01fRFVNUF9TVE9QOiB7CiAgICAgICAgICAgICBpZiAocFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMKSB7CiAgICAgICAgICAgICAgICAgQUxPR0UoIlByZVByb2Nlc3NpbmdGeF9Db21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgIlBSRVBST0NfQ01EX0RVQUxfTUlDX1BDTV9EVU1QX1NUT1A6IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgIlBSRVBST0NfQ01EX0RVQUxfTUlDX1BDTV9EVU1QX1NUT1A6IEVSUk9SIik7CiAgICAgICAgICAgICAgICAgKnJlcGx5U2l6ZSA9IDA7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CkBAIC0xNjM1LDExOCArMTMxOSwxMTYgQEAKICAgICAgICAgICAgIHB0aHJlYWRfbXV0ZXhfdW5sb2NrKCZnUGNtRHVtcExvY2spOwogICAgICAgICAgICAgQUxPR1YoIlBSRVBST0NfQ01EX0RVQUxfTUlDX1BDTV9EVU1QX1NUT1AiKTsKICAgICAgICAgICAgICpyZXBseVNpemUgPSBzaXplb2YoaW50KTsKLSAgICAgICAgICAgICooaW50ICopcFJlcGx5RGF0YSA9IDA7Ci0gICAgICAgICAgICB9IGJyZWFrOwotICAgICAgICAvLy8vLyB0ZXN0IGNvbW1hbmRzIGVuZAorICAgICAgICAgICAgKihpbnQqKXBSZXBseURhdGEgPSAwOworICAgICAgICB9IGJyZWFrOworICAgICAgICAgICAgLy8vLy8gdGVzdCBjb21tYW5kcyBlbmQKIAogICAgICAgICBjYXNlIEVGRkVDVF9DTURfR0VUX0ZFQVRVUkVfU1VQUE9SVEVEX0NPTkZJR1M6IHsKLSAgICAgICAgICAgIGlmKCFnRHVhbE1pY0VuYWJsZWQpIHsKKyAgICAgICAgICAgIGlmICghZ0R1YWxNaWNFbmFibGVkKSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTHx8IGNtZFNpemUgIT0gMiAqIHNpemVvZih1aW50MzJfdCkgfHwKLSAgICAgICAgICAgICAgICAgICAgcFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMKSB7CisgICAgICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCBjbWRTaXplICE9IDIgKiBzaXplb2YodWludDMyX3QpIHx8IHBSZXBseURhdGEgPT0gTlVMTCB8fAorICAgICAgICAgICAgICAgIHJlcGx5U2l6ZSA9PSBOVUxMKSB7CiAgICAgICAgICAgICAgICAgQUxPR0UoIlByZVByb2Nlc3NpbmdGeF9Db21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfR0VUX0ZFQVRVUkVfU1VQUE9SVEVEX0NPTkZJR1M6IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfR0VUX0ZFQVRVUkVfU1VQUE9SVEVEX0NPTkZJR1M6IEVSUk9SIik7CiAgICAgICAgICAgICAgICAgKnJlcGx5U2l6ZSA9IDA7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoKih1aW50MzJfdCAqKXBDbWREYXRhICE9IEVGRkVDVF9GRUFUVVJFX0FVWF9DSEFOTkVMUyB8fAotICAgICAgICAgICAgICAgICAgIWVmZmVjdC0+YXV4X2NoYW5uZWxzX29uKSB7CisgICAgICAgICAgICBpZiAoKih1aW50MzJfdCopcENtZERhdGEgIT0gRUZGRUNUX0ZFQVRVUkVfQVVYX0NIQU5ORUxTIHx8ICFlZmZlY3QtPmF1eF9jaGFubmVsc19vbikgewogICAgICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBmZWF0dXJlIEVGRkVDVF9GRUFUVVJFX0FVWF9DSEFOTkVMUyBub3Qgc3VwcG9ydGVkIGJ5IgotICAgICAgICAgICAgICAgICAgICAgICAgIiBmeCAlZCIsIGVmZmVjdC0+cHJvY0lkKTsKLSAgICAgICAgICAgICAgICAqKHVpbnQzMl90ICopcFJlcGx5RGF0YSA9IC1FTk9TWVM7CisgICAgICAgICAgICAgICAgICAgICAgIiBmeCAlZCIsCisgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0LT5wcm9jSWQpOworICAgICAgICAgICAgICAgICoodWludDMyX3QqKXBSZXBseURhdGEgPSAtRU5PU1lTOwogICAgICAgICAgICAgICAgICpyZXBseVNpemUgPSBzaXplb2YodWludDMyX3QpOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgc2l6ZV90IG51bV9jb25maWdzID0gKigodWludDMyX3QgKilwQ21kRGF0YSArIDEpOwotICAgICAgICAgICAgaWYgKCpyZXBseVNpemUgPCAoMiAqIHNpemVvZih1aW50MzJfdCkgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtX2NvbmZpZ3MgKiBzaXplb2YoY2hhbm5lbF9jb25maWdfdCkpKSB7CisgICAgICAgICAgICBzaXplX3QgbnVtX2NvbmZpZ3MgPSAqKCh1aW50MzJfdCopcENtZERhdGEgKyAxKTsKKyAgICAgICAgICAgIGlmICgqcmVwbHlTaXplIDwgKDIgKiBzaXplb2YodWludDMyX3QpICsgbnVtX2NvbmZpZ3MgKiBzaXplb2YoY2hhbm5lbF9jb25maWdfdCkpKSB7CiAgICAgICAgICAgICAgICAgKnJlcGx5U2l6ZSA9IDA7CiAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICooKHVpbnQzMl90ICopcFJlcGx5RGF0YSArIDEpID0gQ0hBTk5FTF9DRkdfQ05UOworICAgICAgICAgICAgKigodWludDMyX3QqKXBSZXBseURhdGEgKyAxKSA9IENIQU5ORUxfQ0ZHX0NOVDsKICAgICAgICAgICAgIGlmIChudW1fY29uZmlncyA8IENIQU5ORUxfQ0ZHX0NOVCB8fAotICAgICAgICAgICAgICAgICAgICAqcmVwbHlTaXplIDwgKDIgKiBzaXplb2YodWludDMyX3QpICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDSEFOTkVMX0NGR19DTlQgKiBzaXplb2YoY2hhbm5lbF9jb25maWdfdCkpKSB7Ci0gICAgICAgICAgICAgICAgKih1aW50MzJfdCAqKXBSZXBseURhdGEgPSAtRU5PTUVNOworICAgICAgICAgICAgICAgICpyZXBseVNpemUgPCAoMiAqIHNpemVvZih1aW50MzJfdCkgKyBDSEFOTkVMX0NGR19DTlQgKiBzaXplb2YoY2hhbm5lbF9jb25maWdfdCkpKSB7CisgICAgICAgICAgICAgICAgKih1aW50MzJfdCopcFJlcGx5RGF0YSA9IC1FTk9NRU07CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIG51bV9jb25maWdzID0gQ0hBTk5FTF9DRkdfQ05UOwotICAgICAgICAgICAgICAgICoodWludDMyX3QgKilwUmVwbHlEYXRhID0gMDsKKyAgICAgICAgICAgICAgICAqKHVpbnQzMl90KilwUmVwbHlEYXRhID0gMDsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBFRkZFQ1RfQ01EX0dFVF9GRUFUVVJFX1NVUFBPUlRFRF9DT05GSUdTIG51bSBjb25maWcgJWQiLAogICAgICAgICAgICAgICAgICAgbnVtX2NvbmZpZ3MpOwogCiAgICAgICAgICAgICAqcmVwbHlTaXplID0gMiAqIHNpemVvZih1aW50MzJfdCkgKyBudW1fY29uZmlncyAqIHNpemVvZihjaGFubmVsX2NvbmZpZ190KTsKLSAgICAgICAgICAgICooKHVpbnQzMl90ICopcFJlcGx5RGF0YSArIDEpID0gbnVtX2NvbmZpZ3M7Ci0gICAgICAgICAgICBtZW1jcHkoKHVpbnQzMl90ICopcFJlcGx5RGF0YSArIDIsICZzRHVhbE1pY0NvbmZpZ3MsIG51bV9jb25maWdzICogc2l6ZW9mKGNoYW5uZWxfY29uZmlnX3QpKTsKLSAgICAgICAgICAgIH0gYnJlYWs7CisgICAgICAgICAgICAqKCh1aW50MzJfdCopcFJlcGx5RGF0YSArIDEpID0gbnVtX2NvbmZpZ3M7CisgICAgICAgICAgICBtZW1jcHkoKHVpbnQzMl90KilwUmVwbHlEYXRhICsgMiwgJnNEdWFsTWljQ29uZmlncywKKyAgICAgICAgICAgICAgICAgICBudW1fY29uZmlncyAqIHNpemVvZihjaGFubmVsX2NvbmZpZ190KSk7CisgICAgICAgIH0gYnJlYWs7CiAgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9HRVRfRkVBVFVSRV9DT05GSUc6Ci0gICAgICAgICAgICBpZighZ0R1YWxNaWNFbmFibGVkKSB7CisgICAgICAgICAgICBpZiAoIWdEdWFsTWljRW5hYmxlZCkgewogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEx8fCBjbWRTaXplICE9IHNpemVvZih1aW50MzJfdCkgfHwKLSAgICAgICAgICAgICAgICAgICAgcFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMIHx8Ci0gICAgICAgICAgICAgICAgICAgICpyZXBseVNpemUgPCBzaXplb2YodWludDMyX3QpICsgc2l6ZW9mKGNoYW5uZWxfY29uZmlnX3QpKSB7CisgICAgICAgICAgICBpZiAocENtZERhdGEgPT0gTlVMTCB8fCBjbWRTaXplICE9IHNpemVvZih1aW50MzJfdCkgfHwgcFJlcGx5RGF0YSA9PSBOVUxMIHx8CisgICAgICAgICAgICAgICAgcmVwbHlTaXplID09IE5VTEwgfHwgKnJlcGx5U2l6ZSA8IHNpemVvZih1aW50MzJfdCkgKyBzaXplb2YoY2hhbm5lbF9jb25maWdfdCkpIHsKICAgICAgICAgICAgICAgICBBTE9HRSgiUHJlUHJvY2Vzc2luZ0Z4X0NvbW1hbmQgY21kQ29kZSBDYXNlOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9HRVRfRkVBVFVSRV9DT05GSUc6IEVSUk9SIik7CisgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfR0VUX0ZFQVRVUkVfQ09ORklHOiBFUlJPUiIpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCoodWludDMyX3QgKilwQ21kRGF0YSAhPSBFRkZFQ1RfRkVBVFVSRV9BVVhfQ0hBTk5FTFMgfHwgIWVmZmVjdC0+YXV4X2NoYW5uZWxzX29uKSB7Ci0gICAgICAgICAgICAgICAgKih1aW50MzJfdCAqKXBSZXBseURhdGEgPSAtRU5PU1lTOworICAgICAgICAgICAgaWYgKCoodWludDMyX3QqKXBDbWREYXRhICE9IEVGRkVDVF9GRUFUVVJFX0FVWF9DSEFOTkVMUyB8fCAhZWZmZWN0LT5hdXhfY2hhbm5lbHNfb24pIHsKKyAgICAgICAgICAgICAgICAqKHVpbnQzMl90KilwUmVwbHlEYXRhID0gLUVOT1NZUzsKICAgICAgICAgICAgICAgICAqcmVwbHlTaXplID0gc2l6ZW9mKHVpbnQzMl90KTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBFRkZFQ1RfQ01EX0dFVF9GRUFUVVJFX0NPTkZJRyIpOwotICAgICAgICAgICAgKih1aW50MzJfdCAqKXBSZXBseURhdGEgPSAwOworICAgICAgICAgICAgKih1aW50MzJfdCopcFJlcGx5RGF0YSA9IDA7CiAgICAgICAgICAgICAqcmVwbHlTaXplID0gc2l6ZW9mKHVpbnQzMl90KSArIHNpemVvZihjaGFubmVsX2NvbmZpZ190KTsKLSAgICAgICAgICAgIG1lbWNweSgodWludDMyX3QgKilwUmVwbHlEYXRhICsgMSwKLSAgICAgICAgICAgICAgICAgICAmc0R1YWxNaWNDb25maWdzW2VmZmVjdC0+Y3VyX2NoYW5uZWxfY29uZmlnXSwKKyAgICAgICAgICAgIG1lbWNweSgodWludDMyX3QqKXBSZXBseURhdGEgKyAxLCAmc0R1YWxNaWNDb25maWdzW2VmZmVjdC0+Y3VyX2NoYW5uZWxfY29uZmlnXSwKICAgICAgICAgICAgICAgICAgICBzaXplb2YoY2hhbm5lbF9jb25maWdfdCkpOwogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIGNhc2UgRUZGRUNUX0NNRF9TRVRfRkVBVFVSRV9DT05GSUc6IHsKICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBFRkZFQ1RfQ01EX1NFVF9GRUFUVVJFX0NPTkZJRzogIgotICAgICAgICAgICAgICAgICAgICAiZ0R1YWxNaWNFbmFibGVkICVkIGVmZmVjdC0+YXV4X2NoYW5uZWxzX29uICVkIiwKKyAgICAgICAgICAgICAgICAgICJnRHVhbE1pY0VuYWJsZWQgJWQgZWZmZWN0LT5hdXhfY2hhbm5lbHNfb24gJWQiLAogICAgICAgICAgICAgICAgICAgZ0R1YWxNaWNFbmFibGVkLCBlZmZlY3QtPmF1eF9jaGFubmVsc19vbik7Ci0gICAgICAgICAgICBpZighZ0R1YWxNaWNFbmFibGVkKSB7CisgICAgICAgICAgICBpZiAoIWdEdWFsTWljRW5hYmxlZCkgewogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHBDbWREYXRhID09IE5VTEx8fCBjbWRTaXplICE9IChzaXplb2YodWludDMyX3QpICsgc2l6ZW9mKGNoYW5uZWxfY29uZmlnX3QpKSB8fAotICAgICAgICAgICAgICAgICAgICBwUmVwbHlEYXRhID09IE5VTEwgfHwgcmVwbHlTaXplID09IE5VTEwgfHwKLSAgICAgICAgICAgICAgICAgICAgKnJlcGx5U2l6ZSA8IHNpemVvZih1aW50MzJfdCkpIHsKKyAgICAgICAgICAgIGlmIChwQ21kRGF0YSA9PSBOVUxMIHx8IGNtZFNpemUgIT0gKHNpemVvZih1aW50MzJfdCkgKyBzaXplb2YoY2hhbm5lbF9jb25maWdfdCkpIHx8CisgICAgICAgICAgICAgICAgcFJlcGx5RGF0YSA9PSBOVUxMIHx8IHJlcGx5U2l6ZSA9PSBOVUxMIHx8ICpyZXBseVNpemUgPCBzaXplb2YodWludDMyX3QpKSB7CiAgICAgICAgICAgICAgICAgQUxPR0UoIlByZVByb2Nlc3NpbmdGeF9Db21tYW5kIGNtZENvZGUgQ2FzZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgIkVGRkVDVF9DTURfU0VUX0ZFQVRVUkVfQ09ORklHOiBFUlJPUlxuIgotICAgICAgICAgICAgICAgICAgICAgICAgInBDbWREYXRhICVwIGNtZFNpemUgJWQgcFJlcGx5RGF0YSAlcCByZXBseVNpemUgJXAgKnJlcGx5U2l6ZSAlZCIsCi0gICAgICAgICAgICAgICAgICAgICAgICBwQ21kRGF0YSwgY21kU2l6ZSwgcFJlcGx5RGF0YSwgcmVwbHlTaXplLCByZXBseVNpemUgPyAqcmVwbHlTaXplIDogLTEpOworICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9GRUFUVVJFX0NPTkZJRzogRVJST1JcbiIKKyAgICAgICAgICAgICAgICAgICAgICAicENtZERhdGEgJXAgY21kU2l6ZSAlZCBwUmVwbHlEYXRhICVwIHJlcGx5U2l6ZSAlcCAqcmVwbHlTaXplICVkIiwKKyAgICAgICAgICAgICAgICAgICAgICBwQ21kRGF0YSwgY21kU2l6ZSwgcFJlcGx5RGF0YSwgcmVwbHlTaXplLCByZXBseVNpemUgPyAqcmVwbHlTaXplIDogLTEpOwogICAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgKnJlcGx5U2l6ZSA9IHNpemVvZih1aW50MzJfdCk7Ci0gICAgICAgICAgICBpZiAoKih1aW50MzJfdCAqKXBDbWREYXRhICE9IEVGRkVDVF9GRUFUVVJFX0FVWF9DSEFOTkVMUyB8fCAhZWZmZWN0LT5hdXhfY2hhbm5lbHNfb24pIHsKLSAgICAgICAgICAgICAgICAqKHVpbnQzMl90ICopcFJlcGx5RGF0YSA9IC1FTk9TWVM7CisgICAgICAgICAgICBpZiAoKih1aW50MzJfdCopcENtZERhdGEgIT0gRUZGRUNUX0ZFQVRVUkVfQVVYX0NIQU5ORUxTIHx8ICFlZmZlY3QtPmF1eF9jaGFubmVsc19vbikgeworICAgICAgICAgICAgICAgICoodWludDMyX3QqKXBSZXBseURhdGEgPSAtRU5PU1lTOwogICAgICAgICAgICAgICAgIEFMT0dWKCJQcmVQcm9jZXNzaW5nRnhfQ29tbWFuZCBjbWRDb2RlIENhc2U6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRUZGRUNUX0NNRF9TRVRfRkVBVFVSRV9DT05GSUc6IEVSUk9SXG4iCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNtZERhdGEgJWQgZWZmZWN0LT5hdXhfY2hhbm5lbHNfb24gJWQiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoodWludDMyX3QgKilwQ21kRGF0YSwgZWZmZWN0LT5hdXhfY2hhbm5lbHNfb24pOworICAgICAgICAgICAgICAgICAgICAgICJFRkZFQ1RfQ01EX1NFVF9GRUFUVVJFX0NPTkZJRzogRVJST1JcbiIKKyAgICAgICAgICAgICAgICAgICAgICAiQ21kRGF0YSAlZCBlZmZlY3QtPmF1eF9jaGFubmVsc19vbiAlZCIsCisgICAgICAgICAgICAgICAgICAgICAgKih1aW50MzJfdCopcENtZERhdGEsIGVmZmVjdC0+YXV4X2NoYW5uZWxzX29uKTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHNpemVfdCBpOwotICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IENIQU5ORUxfQ0ZHX0NOVDtpKyspIHsKLSAgICAgICAgICAgICAgICBpZiAobWVtY21wKCh1aW50MzJfdCAqKXBDbWREYXRhICsgMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICZzRHVhbE1pY0NvbmZpZ3NbaV0sIHNpemVvZihjaGFubmVsX2NvbmZpZ190KSkgPT0gMCkgeworICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IENIQU5ORUxfQ0ZHX0NOVDsgaSsrKSB7CisgICAgICAgICAgICAgICAgaWYgKG1lbWNtcCgodWludDMyX3QqKXBDbWREYXRhICsgMSwgJnNEdWFsTWljQ29uZmlnc1tpXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihjaGFubmVsX2NvbmZpZ190KSkgPT0gMCkgewogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAoaSA9PSBDSEFOTkVMX0NGR19DTlQpIHsKLSAgICAgICAgICAgICAgICAqKHVpbnQzMl90ICopcFJlcGx5RGF0YSA9IC1FSU5WQUw7CisgICAgICAgICAgICAgICAgKih1aW50MzJfdCopcFJlcGx5RGF0YSA9IC1FSU5WQUw7CiAgICAgICAgICAgICAgICAgQUxPR1coIlByZVByb2Nlc3NpbmdGeF9Db21tYW5kIEVGRkVDVF9DTURfU0VUX0ZFQVRVUkVfQ09ORklHIGludmFsaWQgY29uZmlnIgotICAgICAgICAgICAgICAgICAgICAgICAgIlslMDh4XS5bJTA4eF0iLCAqKCh1aW50MzJfdCAqKXBDbWREYXRhICsgMSksICooKHVpbnQzMl90ICopcENtZERhdGEgKyAyKSk7CisgICAgICAgICAgICAgICAgICAgICAgIlslMDh4XS5bJTA4eF0iLAorICAgICAgICAgICAgICAgICAgICAgICooKHVpbnQzMl90KilwQ21kRGF0YSArIDEpLCAqKCh1aW50MzJfdCopcENtZERhdGEgKyAyKSk7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIGVmZmVjdC0+Y3VyX2NoYW5uZWxfY29uZmlnID0gaTsKLSAgICAgICAgICAgICAgICAqKHVpbnQzMl90ICopcFJlcGx5RGF0YSA9IDA7CisgICAgICAgICAgICAgICAgKih1aW50MzJfdCopcFJlcGx5RGF0YSA9IDA7CiAgICAgICAgICAgICAgICAgQUxPR1YoIlByZVByb2Nlc3NpbmdGeF9Db21tYW5kIEVGRkVDVF9DTURfU0VUX0ZFQVRVUkVfQ09ORklHIE5ldyBjb25maWciCi0gICAgICAgICAgICAgICAgICAgICAgICAiWyUwOHhdLlslMDh4XSIsIHNEdWFsTWljQ29uZmlnc1tpXS5tYWluX2NoYW5uZWxzLCBzRHVhbE1pY0NvbmZpZ3NbaV0uYXV4X2NoYW5uZWxzKTsKKyAgICAgICAgICAgICAgICAgICAgICAiWyUwOHhdLlslMDh4XSIsCisgICAgICAgICAgICAgICAgICAgICAgc0R1YWxNaWNDb25maWdzW2ldLm1haW5fY2hhbm5lbHMsIHNEdWFsTWljQ29uZmlnc1tpXS5hdXhfY2hhbm5lbHMpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBicmVhazsKKyAgICAgICAgfSBicmVhazsKICNlbmRpZgogICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CkBAIC0xNzU0LDExICsxNDM2LDggQEAKICAgICByZXR1cm4gMDsKIH0KIAotCi1pbnQgUHJlUHJvY2Vzc2luZ0Z4X0dldERlc2NyaXB0b3IoZWZmZWN0X2hhbmRsZV90ICAgc2VsZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlZmZlY3RfZGVzY3JpcHRvcl90ICpwRGVzY3JpcHRvcikKLXsKLSAgICBwcmVwcm9jX2VmZmVjdF90ICogZWZmZWN0ID0gKHByZXByb2NfZWZmZWN0X3QgKikgc2VsZjsKK2ludCBQcmVQcm9jZXNzaW5nRnhfR2V0RGVzY3JpcHRvcihlZmZlY3RfaGFuZGxlX3Qgc2VsZiwgZWZmZWN0X2Rlc2NyaXB0b3JfdCogcERlc2NyaXB0b3IpIHsKKyAgICBwcmVwcm9jX2VmZmVjdF90KiBlZmZlY3QgPSAocHJlcHJvY19lZmZlY3RfdCopc2VsZjsKIAogICAgIGlmIChlZmZlY3QgPT0gTlVMTCB8fCBwRGVzY3JpcHRvciA9PSBOVUxMKSB7CiAgICAgICAgIHJldHVybiAtRUlOVkFMOwpAQCAtMTc2OSwxMzcgKzE0NDgsODEgQEAKICAgICByZXR1cm4gMDsKIH0KIAotaW50IFByZVByb2Nlc3NpbmdGeF9Qcm9jZXNzUmV2ZXJzZShlZmZlY3RfaGFuZGxlX3QgICAgIHNlbGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIC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T5yZXZCdWYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5yZXZCdWZTaXplICogc2Vzc2lvbi0+aW5DaGFubmVsQ291bnQgKiBzaXplb2YoaW50MTZfdCkpOwotICAgICAgICAgICAgICAgIGlmIChidWYgPT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5mcmFtZXNSZXYgPSAwOwotICAgICAgICAgICAgICAgICAgICBmcmVlKHNlc3Npb24tPnJldkJ1Zik7Ci0gICAgICAgICAgICAgICAgICAgIHNlc3Npb24tPnJldkJ1ZiA9IE5VTEw7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiAtRU5PTUVNOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBzZXNzaW9uLT5yZXZCdWYgPSBidWY7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtZW1jcHkoc2Vzc2lvbi0+cmV2QnVmICsgc2Vzc2lvbi0+ZnJhbWVzUmV2ICogc2Vzc2lvbi0+aW5DaGFubmVsQ291bnQsCi0gICAgICAgICAgICAgICAgICAgaW5CdWZmZXItPnMxNiwKLSAgICAgICAgICAgICAgICAgICBmciAqIHNlc3Npb24tPmluQ2hhbm5lbENvdW50ICogc2l6ZW9mKGludDE2X3QpKTsKLQotICAgICAgICAgICAgc2Vzc2lvbi0+ZnJhbWVzUmV2ICs9IGZyOwotICAgICAgICAgICAgaW5CdWZmZXItPmZyYW1lQ291bnQgPSBmcjsKLSAgICAgICAgICAgIGlmIChzZXNzaW9uLT5mcmFtZXNSZXYgPCBzZXNzaW9uLT5mcmFtZUNvdW50KSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIDA7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzcHhfdWludDMyX3QgZnJJbiA9IHNlc3Npb24tPmZyYW1lc1JldjsKLSAgICAgICAgICAgIHNweF91aW50MzJfdCBmck91dCA9IHNlc3Npb24tPmFwbUZyYW1lQ291bnQ7Ci0gICAgICAgICAgICBpZiAoc2Vzc2lvbi0+aW5DaGFubmVsQ291bnQgPT0gMSkgewotICAgICAgICAgICAgICAgIHNwZWV4X3Jlc2FtcGxlcl9wcm9jZXNzX2ludChzZXNzaW9uLT5yZXZSZXNhbXBsZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24tPnJldkJ1ZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZySW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24tPnJldkZyYW1lLT5kYXRhXywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZyT3V0KTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgc3BlZXhfcmVzYW1wbGVyX3Byb2Nlc3NfaW50ZXJsZWF2ZWRfaW50KHNlc3Npb24tPnJldlJlc2FtcGxlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbi0+cmV2QnVmLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZnJJbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbi0+cmV2RnJhbWUtPmRhdGFfLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZnJPdXQpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbWVtY3B5KHNlc3Npb24tPnJldkJ1ZiwKLSAgICAgICAgICAgICAgICAgICBzZXNzaW9uLT5yZXZCdWYgKyBmckluICogc2Vzc2lvbi0+aW5DaGFubmVsQ291bnQsCi0gICAgICAgICAgICAgICAgICAgKHNlc3Npb24tPmZyYW1lc1JldiAtIGZySW4pICogc2Vzc2lvbi0+aW5DaGFubmVsQ291bnQgKiBzaXplb2YoaW50MTZfdCkpOwotICAgICAgICAgICAgc2Vzc2lvbi0+ZnJhbWVzUmV2IC09IGZySW47Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBzaXplX3QgZnIgPSBzZXNzaW9uLT5mcmFtZUNvdW50IC0gc2Vzc2lvbi0+ZnJhbWVzUmV2OwotICAgICAgICAgICAgaWYgKGluQnVmZmVyLT5mcmFtZUNvdW50IDwgZnIpIHsKLSAgICAgICAgICAgICAgICBmciA9IGluQnVmZmVyLT5mcmFtZUNvdW50OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbWVtY3B5KHNlc3Npb24tPnJldkZyYW1lLT5kYXRhXyArIHNlc3Npb24tPmZyYW1lc1JldiAqIHNlc3Npb24tPmluQ2hhbm5lbENvdW50LAotICAgICAgICAgICAgICAgICAgIGluQnVmZmVyLT5zMTYsCi0gICAgICAgICAgICAgICAgICAgZnIgKiBzZXNzaW9uLT5pbkNoYW5uZWxDb3VudCAqIHNpemVvZihpbnQxNl90KSk7Ci0gICAgICAgICAgICBzZXNzaW9uLT5mcmFtZXNSZXYgKz0gZnI7Ci0gICAgICAgICAgICBpbkJ1ZmZlci0+ZnJhbWVDb3VudCA9IGZyOwotICAgICAgICAgICAgaWYgKHNlc3Npb24tPmZyYW1lc1JldiA8IHNlc3Npb24tPmZyYW1lQ291bnQpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gMDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHNlc3Npb24tPmZyYW1lc1JldiA9IDA7CisgICAgICAgIGlmIChpbnQgc3RhdHVzID0gZWZmZWN0LT5zZXNzaW9uLT5hcG0tPlByb2Nlc3NSZXZlcnNlU3RyZWFtKAorICAgICAgICAgICAgICAgICAgICAoY29uc3QgaW50MTZ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yBucyAgICAgICA0Njc2ODcgbnMgICAgICAgICAxNTA2CisgKiBCTV9QUkVQUk9DRVNTSU5HLzkvMiAgICAgIDE1MzE3MCBucyAgICAgICAxNTI3MzcgbnMgICAgICAgICA0NTE5CisgKiBCTV9QUkVQUk9DRVNTSU5HLzkvMyAgICAgICAgODM5MyBucyAgICAgICAgIDgzNjMgbnMgICAgICAgIDgzNjAzCisgKiBCTV9QUkVQUk9DRVNTSU5HLzEwLzAgICAgIDQ3MjQ0MCBucyAgICAgICA0NzA5MjYgbnMgICAgICAgICAxNDg5CisgKiBCTV9QUkVQUk9DRVNTSU5HLzEwLzEgICAgIDUxNjk4NCBucyAgICAgICA1MTU0ODAgbnMgICAgICAgICAxMDAwCisgKiBCTV9QUkVQUk9DRVNTSU5HLzEwLzIgICAgIDE2ODgwMiBucyAgICAgICAxNjgzNDggbnMgICAgICAgICA0MDk3CisgKiBCTV9QUkVQUk9DRVNTSU5HLzEwLzMgICAgICAgOTEyNyBucyAgICAgICAgIDkxMDAgbnMgICAgICAgIDc2OTEzCisgKiBCTV9QUkVQUk9DRVNTSU5HLzExLzAgICAgIDUwOTY5MCBucyAgICAgICA1MDgxMTMgbnMgICAgICAgICAxMzYwCisgKiBCTV9QUkVQUk9DRVNTSU5HLzExLzEgICAgIDU2OTA3NiBucyAgICAgICA1NjczOTAgbnMgICAgICAgICAxMzEwCisgKiBCTV9QUkVQUk9DRVNTSU5HLzExLzIgICAgIDE4NTY3OCBucyAgICAgICAxODUxNjUgbnMgICAgICAgICAzNzI5CisgKiBCTV9QUkVQUk9DRVNTSU5HLzExLzMgICAgICAgOTc4OSBucyAgICAgICAgIDk3NjAgbnMgICAgICAgIDcxMzQyCisgKiBCTV9QUkVQUk9DRVNTSU5HLzEyLzAgICAgIDU2Mzg1OCBucyAgICAgICA1NjIxMDggbnMgICAgICAgICAxMjcwCisgKiBCTV9QUkVQUk9DRVNTSU5HLzEyLzEgICAgIDYxOTY1NiBucyAgICAgICA2MTc3OTEgbn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mZmVjdEhhbmRsZSwgdWludDMyX3QgZWZmZWN0VHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGVmZmVjdF9jb25maWdfdCogcENvbmZpZywgaW50IHNlc3Npb25JZCwgaW50IGlvSWQpIHsKKyAgICBpZiAoaW50IHN0YXR1cyA9IEFVRElPX0VGRkVDVF9MSUJSQVJZX0lORk9fU1lNLmNyZWF0ZV9lZmZlY3QoJmtFZmZlY3RVdWlkc1tlZmZlY3RUeXBlXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbklkLCBpb0lkLCBwRWZmZWN0SGFuZGxlKTsKKyAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgQUxPR0UoIkF1ZGlvIFByZXByb2Nlc3NpbmcgY3JlYXRlIHJldHVybmVkIGFuIGVycm9yID0gJWRcbiIsIHN0YXR1cyk7CisgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgfQorICAgIGludCByZXBseSA9IDA7CisgICAgdWludDMyX3QgcmVwbHlTaXplID0gc2l6ZW9mKHJlcGx5KTsKKyAgICBpZiAoZWZmZWN0VHlwZSA9PSBQUkVQUk9DX0FFQykgeworICAgICAgICBpZiAoaW50IHN0YXR1cyA9ICgqKnBFZmZlY3RIYW5kbGUpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtPmNvbW1hbmQoKnBFZmZlY3RIYW5kbGUsIEVGRkVDVF9DTURfU0VUX0NPTkZJR19SRVZFUlNFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihlZmZlY3RfY29uZmlnX3QpLCBwQ29uZmlnLCAmcmVwbHlTaXplLCAmcmVwbHkpOworICAgICAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgICAgIEFMT0dFKCJTZXQgY29uZmlnIHJldmVyc2UgY29tbWFuZCByZXR1cm5lZCBh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J1ZmZlciA9IHsuZnJhbWVDb3VudCA9IChzaXplX3QpZnJhbWVMZW5ndGgsIC5zMTYgPSBmYXJJbi5kYXRhKCl9OworCisgICAgICAgIGlmIChQUkVQUk9DX0FFQyA9PSBlZmZlY3RUeXBlKSB7CisgICAgICAgICAgICBpZiAoaW50IHN0YXR1cyA9CisgICAgICAgICAgICAgICAgICAgICAgICBwcmVQcm9jU2V0Q29uZmlnUGFyYW0oZWZmZWN0SGFuZGxlLCBBRUNfUEFSQU1fRUNIT19ERUxBWSwga1N0cmVhbURlbGF5TXMpOworICAgICAgICAgICAgICAgIHN0YXR1cyAhPSAwKSB7CisgICAgICAgICAgICAgICAgQUxPR0UoInByZVByb2NTZXRDb25maWdQYXJhbSByZXR1cm5lZCBFcnJvciAlZFxuIiwgc3RhdHVzKTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKGludCBzdGF0dXMgPSAoKmVmZmVjdEhhbmRsZSktPnByb2Nlc3MoZWZmZWN0SGFuZGxlLCAmaW5CdWZmZXIsICZvdXRCdWZmZXIpOworICAgICAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgICAgIEFMT0dFKCJcbkVycm9yOiBQcm9jZXNzIGkgPSAlZCByZXR1cm5lZCB3aXRoIGVycm9yICVkXG4iLCAoaW50KXN0YXRlLnJhbmdlKDEpLCBzdGF0dXMpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGlmIChQUkVQUk9DX0FFQyA9PSBlZmZlY3RUeXBlKSB7CisgICAgICAgICAgICBpZiAoaW50IHN0YXR1cyA9CisgICAgICAgICAgICAgICAgICAgICAgICAoKmVmZmVjdEhhbmRsZSktPnByb2Nlc3NfcmV2ZXJzZShlZmZlY3RIYW5kbGUsICZmYXJJbkJ1ZmZlciwgJm91dEJ1ZmZlcik7CisgICAgICAgICAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgICAgICAgICBBTE9HRSgiXG5FcnJvcjogUHJvY2VzcyByZXZlcnNlIGkgPSAlZCByZXR1cm5lZCB3aXRoIGVycm9yICVkXG4iLAorICAgICAgICAgICAgICAgICAgICAgIChpbnQpc3RhdGUucmFuZ2UoMSksIHN0YXR1cyk7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorICAgIGJlbmNobWFyazo6Q2xvYmJlck1lbW9yeSgpOworCisgICAgc3RhdGUuU2V0Q29tcGxleGl0eU4oc3RhdGUucmFuZ2UoMCkpOworCisgICAgaWYgKGludCBzdGF0dXMgPSBBVURJT19FRkZFQ1RfTElCUkFSWV9JTkZPX1NZTS5yZWxlYXNlX2VmZmVjdChlZmZlY3RIYW5kbGUpOyBzdGF0dXMgIT0gMCkgeworICAgICAgICBBTE9HRSgicmVsZWFzZV9lZmZlY3QgcmV0dXJuZWQgYW4gZXJyb3IgPSAlZFxuIiwgc3RhdHVzKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KK30KKworc3RhdGljIHZvaWQgcHJlcHJvY2Vzc2luZ0FyZ3MoYmVuY2htYXJrOjppbnRlcm5hbDo6QmVuY2htYXJrKiBiKSB7CisgICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gKGludClrTnVtQ2hNYXNrczsgaSsrKSB7CisgICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgKGludClrTnVtRWZmZWN0VXVpZHM7ICsraikgeworICAgICAgICAgICAgYi0+QXJncyh7aSwgan0pOworICAgICAgICB9CisgICAgfQorfQorCitCRU5DSE1BUksoQk1fUFJFUFJPQ0VTU0lORyktPkFwcGx5KHByZXByb2Nlc3NpbmdBcmdzKTsKKworQkVOQ0hNQVJLX01BSU4oKTsKZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvcHJlcHJvY2Vzc2luZy90ZXN0cy9BbmRyb2lkLmJwIGIvbWVkaWEvbGliZWZmZWN0cy9wcmVwcm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hbXMpOworICAgICAgICB9CisgICAgfQorCisgICAgZm9yIChjb25zdCBhdXRvIGZpeGVkRGlnaXRhbEdhaW4gOiBrQUdDMkZpeGVkRGlnaXRhbEdhaW5zKSB7CisgICAgICAgIGZvciAoY29uc3QgYXV0byBhZGFwdERpZ2lMZXZlbEVzdGltYXRvciA6IGtBR0MyQWRhcHRHaWdpdGFsTGV2ZWxFc3RpbWF0b3JzKSB7CisgICAgICAgICAgICBmb3IgKGNvbnN0IGF1dG8gZXh0cmFTYXR1cmF0aW9uTWFyZ2luIDoga0FHQzJFeHRyYVNhdHVyYXRpb25NYXJnaW5zKSB7CisgICAgICAgICAgICAgICAgQUdDMlBhcmFtcyBhZ2MyUGFyYW1zID0gey5maXhlZERpZ2l0YWxHYWluID0gZml4ZWREaWdpdGFsR2FpbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmFkYXB0RGlnaUxldmVsRXN0aW1hdG9yID0gYWRhcHREaWdpTGV2ZWxFc3RpbWF0b3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5leHRyYVNhdHVyYXRpb25NYXJnaW4gPSBleHRyYVNhdHVyYXRpb25NYXJnaW59OworICAgICAgICAgICAgICAgIFByZVByb2NQYXJhbXMgcGFyYW1zID0gey51dWlkID0gJmtBR0MyVXVpZCwgLmFnYzJQYXJhbXMgPSBhZ2MyUGFyYW1zfTsKKyAgICAgICAgICAgICAgICByZXN1bHQucHVzaF9iYWNrKHBhcmFtcyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBmb3IgKGNvbnN0IGF1dG8gZWNob0RlbGF5IDoga0FFQ0VjaG9EZWxheXMpIHsKKyAgICAgICAgQUVDUGFyYW1zIGFlY1BhcmFtcyA9IHsuZWNob0RlbGF5ID0gZWNob0RlbGF5fTsKKyAgICAgICAgUHJlUHJvY1BhcmFtcyBwYXJhbXMgPSB7LnV1aWQgPSAma0FFQ1V1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6OnZlY3RvcjxpbnQxNl90PiB0ZXN0RmFySW5wdXQobVRvdGFsRnJhbWVDb3VudCAqIGNoYW5uZWxDb3VudCk7CisKKyAgICAgICAgLy8gUmVwZWF0IG1vbm8gY2hhbm5lbCBkYXRhIHRvIGFsbCB0aGUgY2hhbm5lbHMKKyAgICAgICAgLy8gYWRqdXN0X2NoYW5uZWxzKCkgemVybyBmaWxscyBjaGFubmVscyA+IDIsIGhlbmNlIGNhbid0IGJlIHVzZWQgaGVyZQorICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG1Ub3RhbEZyYW1lQ291bnQ7ICsraSkgeworICAgICAgICAgICAgYXV0byogZnBJbnB1dCA9ICZ0ZXN0SW5wdXRbaSAqIGNoYW5uZWxDb3VudF07CisgICAgICAgICAgICBzdGQ6OmZpbGwoZnBJbnB1dCwgZnBJbnB1dCArIGNoYW5uZWxDb3VudCwgbW9ub0lucHV0W2ldKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoaXNBRUNFZmZlY3QobVV1aWQpKSB7CisgICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG1Ub3RhbEZyYW1lQ291bnQ7ICsraSkgeworICAgICAgICAgICAgICAgIGF1dG8qIGZwRmFySW5wdXQgPSAmdGVzdEZhcklucHV0W2kgKiBjaGFubmVsQ291bnRdOworICAgICAgICAgICAgICAgIHN0ZDo6ZmlsbChmcEZhcklucHV0LCBmcEZhcklucHV0ICsgY2hhbm5lbENvdW50LCBtb25vRmFySW5wdXRbaV0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgc3RkOjp2ZWN0b3I8aW50MTZfdD4gdGVzdE91dHB1dChtVG90YWxGcmFtZUNvdW50ICogY2hhbm5lbENvdW50KTsKKyAgICAgICAgQVNTRVJUX05PX0ZBVEFMX0ZBSUxVUkUoCisgICAgICAgICAgICAgICAgdGVzdEVmZmVjdC5wcm9jZXNzKHRlc3RJbnB1dC5kYXRhKCksIHRlc3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yZXBseVNpemUsICZyZXBseSk7CisgICAgQVNTRVJUX0VRKHN0YXR1cywgMCkgPDwgInNldF9jb25maWcgcmV0dXJuZWQgYW4gZXJyb3IgIiA8PCBzdGF0dXM7CisgICAgQVNTRVJUX0VRKHJlcGx5LCAwKSA8PCAic2V0X2NvbmZpZyByZXBseSBub24gemVybyAiIDw8IHJlcGx5OworCisgICAgaWYgKGNvbmZpZ1JldmVyc2UpIHsKKyAgICAgICAgaW50IHN0YXR1cyA9ICgqbUVmZmVjdEhhbmRsZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLT5jb21tYW5kKG1FZmZlY3RIYW5kbGUsIEVGRkVDVF9DTURfU0VUX0NPTkZJR19SRVZFUlNFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKGVmZmVjdF9jb25maWdfdCksICZjb25maWcsICZyZXBseVNpemUsICZyZXBseSk7CisgICAgICAgIEFTU0VSVF9FUShzdGF0dXMsIDApIDw8ICJzZXRfY29uZmlnX3JldmVyc2UgcmV0dXJuZWQgYW4gZXJyb3IgIiA8PCBzdGF0dXM7CisgICAgICAgIEFTU0VSVF9FUShyZXBseSwgMCkgPDwgInNldF9jb25maWdfcmV2ZXJzZSByZXBseSBub24gemVybyAiIDw8IHJlcGx5OworICAgIH0KKworICAgIHN0YXR1cyA9ICgqbUVmZmVjdEhhbmRsZSkKKyAgICAgICAgICAgICAgICAgICAgIC0+Y29tbWFuZChtRWZmZWN0SGFuZGxlLCBFRkZFQ1RfQ01EX0VOQUJMRSwgMCwgbnVsbHB0ciwgJnJlcGx5U2l6ZSwgJnJlcGx5KTsKKyAgICBBU1NFUlRfRVEoc3RhdHVzLCAwKSA8PCAiY21kX2VuYWJsZSByZXR1cm5lZCBhbiBlcnJvciAiIDw8IHN0YXR1czsKKyAgICBBU1NFUlRfRVEocmVwbHksIDApIDw8ICJjbWRfZW5hYmxlIHJlcGx5IG5vbiB6ZXJvICIgPDwgcmVwbHk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gLS1hZWNfZGVsYXkgPGRlbGF5PiIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIEFFQyBkZWxheSB2YWx1ZSBpbiBtcywgZGVmYXVsdCB2YWx1ZSAwbXMiKTsKKyAgICBwcmludGYoIlxuICAgICAtLWZjaCA8ZmlsZUNoYW5uZWxzPiIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIG51bWJlciBvZiBjaGFubmVscyBpbiB0aGUgaW5wdXQgZmlsZSIpOworICAgIHByaW50ZigiXG4gICAgIC0tbW9ubyA8TW9ubyBNb2RlPiIpOworICAgIHByaW50ZigiXG4gICAgICAgICAgIE1vZGUgdG8gbWFrZSBkYXRhIG9mIGFsbCBjaGFubmVscyB0aGUgc2FtZSBhcyBmaXJzdCBjaGFubmVsIik7CisgICAgcHJpbnRmKCJcbiIpOworfQorCitjb25zdGV4cHIgZmxvYXQga1Rlbk1pbGxpU2VjVmFsID0gMC4wMTsKKworaW50IHByZVByb2NDcmVhdGVFZmZlY3QoZWZmZWN0X2hhbmRsZV90KiBwRWZmZWN0SGFuZGxlLCB1aW50MzJfdCBlZmZlY3RUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0X2NvbmZpZ190KiBwQ29uZmlnLCBpbnQgc2Vzc2lvbklkLCBpbnQgaW9JZCkgeworICAgIGlmIChpbnQgc3RhdHVzID0gQVVESU9fRUZGRUNUX0xJQlJBUllfSU5GT19TWU0uY3JlYXRlX2VmZmVjdCgma1ByZVByb2NVdWlkc1tlZmZlY3RUeXBlXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbklkLCBpb0lkLCBwRWZmZWN0SGFuZGxlKTsKKyAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgQUxPR0UoIkF1ZGlvIFByZXByb2Nlc3NpbmcgY3JlYXRlIHJldHVybmVkIGFuIGVycm9yID0gJWRcbiIsIHN0YXR1cyk7CisgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgfQorICAgIGludCByZXBseSA9IDA7CisgICAgdWludDMyX3QgcmVwbHlTaXplID0gc2l6ZW9mKHJlcGx5KTsKKyAgICBpZiAoZWZmZWN0VHlwZSA9PSBQUkVQUk9DX0FFQykgeworICAgICAgICAoKipwRWZmZWN0SGFuZGxlKQorICAgICAgICAgICAgICAgIC0+Y29tbWFuZCgqcEVmZmVjdEhhbmRsZSwgRUZGRUNUX0NNRF9TRVRfQ09ORklHX1JFVkVSU0UsIHNpemVvZihlZmZlY3RfY29uZmlnX3QpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBwQ29uZmlnLCAmcmVwbHlTaXplLCAmcmVwbHkpOworICAgIH0KKyAgICAoKipwRWZmZWN0SGFuZGxlKQorICAgICAgICAgICAgLT5jb21tYW5kKCpwRWZmZWN0SGFuZGxlLCBFRkZFQ1RfQ01EX1NFVF9DT05GSUcsIHNpemVvZihlZmZlY3RfY29uZmlnX3QpLCBwQ29uZmlnLAorICAgICAgICAgICAgICAgICAgICAgICZyZXBseVNpemUsICZyZXBseSk7CisgICAgcmV0dXJuIHJlcGx5OworfQorCitpbnQgcHJlUHJvY1NldENvbmZpZ1BhcmFtKHVpbnQzMl90IHBhcmFtVHlwZSwgdWludDMyX3QgcGFyYW1WYWx1ZSwgZWZmZWN0X2hhbmRsZV90IGVmZmVjdEhhbmRsZSkgeworICAgIGludCByZXBseSA9IDA7CisgICAgdWludDMyX3QgcmVwbHlTaXplID0gc2l6ZW9mKHJlcGx5KTsKKyAgICB1aW50MzJfdCBwYXJhbURhdGFbMl0gPSB7cGFyYW1UeXBlLCBwYXJhbVZhbHVlfTsKKyAgICBlZmZlY3RfcGFyYW1fdCogZWZmZWN0UGFyYW0gPSAoZWZmZWN0X3BhcmFtX3QqKW1hbGxvYyhzaXplb2YoKmVmZmVjdFBhcmFtKSArIHNpemVvZihwYXJhbURhdGEpKTsKKyAgICBtZW1jcHkoJm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fTFZMfSwKKyAgICAgICAgICAgIHsiYWVjIiwgbm9fYXJndW1lbnQsICZlZmZlY3RFbltQUkVQUk9DX0FFQ10sIDF9LAorICAgICAgICAgICAgeyJhZ2MiLCBub19hcmd1bWVudCwgJmVmZmVjdEVuW1BSRVBST0NfQUdDXSwgMX0sCisgICAgICAgICAgICB7ImFnYzIiLCBub19hcmd1bWVudCwgJmVmZmVjdEVuW1BSRVBST0NfQUdDMl0sIDF9LAorICAgICAgICAgICAgeyJucyIsIG5vX2FyZ3VtZW50LCAmZWZmZWN0RW5bUFJFUFJPQ19OU10sIDF9LAorICAgICAgICAgICAgeyJmY2giLCByZXF1aXJlZF9hcmd1bWVudCwgbnVsbHB0ciwgQVJHX0ZJTEVfQ0hBTk5FTFN9LAorICAgICAgICAgICAgeyJtb25vIiwgbm9fYXJndW1lbnQsICZwcmVQcm9jQ2ZnUGFyYW1zLm1vbm9Nb2RlLCAxfSwKKyAgICAgICAgICAgIHtudWxscHRyLCAwLCBudWxscHRyLCAwfSwKKyAgICB9OworCisgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgY29uc3QgaW50IG9wdCA9IGdldG9wdF9sb25nKGFyZ2MsIChjaGFyKiBjb25zdCopYXJndiwgImk6bzoiLCBsb25nX29wdHMsIG51bGxwdHIpOworICAgICAgICBpZiAob3B0ID09IC0xKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBzd2l0Y2ggKG9wdCkgeworICAgICAgICAgICAgY2FzZSBBUkdfSEVMUDoKKyAgICAgICAgICAgICAgICBwcmludFVzYWdlKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgICAgICBjYXNlIEFSR19JTlBVVDogeworICAgICAgICAgICAgICAgIGlucHV0RmlsZSA9IChjaGFyKilvcHRhcmc7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEFSR19PVVRQVVQ6IHsKKyAgICAgICAgICAgICAgICBvdXRwdXRGaWxlID0gKGNoYXIqKW9wdGFyZzsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgQVJHX0ZBUjogeworICAgICAgICAgICAgICAgIGZhckZpbGUgPSAoY2hhciopb3B0YXJnOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfRlM6IHsKKyAgICAgICAgICAgICAgICBwcmVQcm9jQ2ZnUGFyYW1zLnNhbXBsaW5nRnJlcSA9IGF0b2kob3B0YXJnKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgQVJHX0NIX01BU0s6IHsKKyAgICAgICAgICAgICAgICBpbnQgY2hNYXNrSWR4ID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGlmIChjaE1hc2tJZHggPCAwIG9yIGNoTWFza0lkeCA+IGtQcmVQcm9jQ29uZmlnQ2hNYXNrQ291bnQpIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR0UoIkNoYW5uZWwgTWFzayBpbmRleCBub3QgaW4gY29ycmVjdCByYW5nZVxuIik7CisgICAgICAgICAgICAgICAgICAgIHByaW50VXNhZ2UoKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVYSVRfRkFJTFVSRTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcHJlUHJvY0NmZ1BhcmFtcy5jaE1hc2sgPSBrUHJlUHJvY0NvbmZpZ0NoTWFza1tjaE1hc2tJZHhdOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfQUdDX1RHVF9MVkw6IHsKKyAgICAgICAgICAgICAgICBwcmVQcm9jQ2ZnUGFyYW1zLmFnY1RhcmdldExldmVsID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfQUdDX0NPTVBfTFZMOiB7CisgICAgICAgICAgICAgICAgcHJlUHJvY0NmZ1BhcmFtcy5hZ2NDb21wTGV2ZWwgPSBhdG9pKG9wdGFyZyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEFSR19BR0MyX0dBSU46IHsKKyAgICAgICAgICAgICAgICBwcmVQcm9jQ2ZnUGFyYW1zLmFnYzJHYWluID0gYXRvZihvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfQUdDMl9MVkw6IHsKKyAgICAgICAgICAgICAgICBwcmVQcm9jQ2ZnUGFyYW1zLmFnYzJMZXZlbCA9IGF0b2kob3B0YXJnKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgQVJHX0FHQzJfU0FUX01HTjogeworICAgICAgICAgICAgICAgIHByZVByb2NDZmdQYXJhbXMuYWdjMlNhdHVyYXRpb25NYXJnaW4gPSBhdG9mKG9wdGFyZyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEFSR19BRUNfREVMQVk6IHsKKyAgICAgICAgICAgICAgICBwcmVQcm9jQ2ZnUGFyYW1zLmFlY0RlbGF5ID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfTlNfTFZMOiB7CisgICAgICAgICAgICAgICAgcHJlUHJvY0NmZ1BhcmFtcy5uc0xldmVsID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfRklMRV9DSEFOTkVMUzogeworICAgICAgICAgICAgICAgIHByZVByb2NDZmdQYXJhbXMuZmlsZUNoYW5uZWxzID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBBUkdfTU9OT19NT0RFOiB7CisgICAgICAgICAgICAgICAgcHJlUHJvY0NmZ1BhcmFtcy5tb25vTW9kZSA9IDE7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCisgICAgaWYgKGlucHV0RmlsZSA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dFKCJFcnJvcjogbWlzc2luZyBpbnB1dCBmaWxlXG4iKTsKKyAgICAgICAgcHJpbnRVc2FnZSgpOworICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOworICAgIH0KKworICAgIHN0ZDo6dW5pcXVlX3B0cjxGSUxFLCBkZWNsdHlwZSgmZmNsb3NlKT4gaW5wdXRGcChmb3BlbihpbnB1dEZpbGUsICJyYiIpLCAmZmNsb3NlKTsKKyAgICBpZiAoaW5wdXRGcCA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dFKCJDYW5ub3Qgb3BlbiBpbnB1dCBmaWxlICVzXG4iLCBpbnB1dEZpbGUpOworICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOworICAgIH0KKworICAgIHN0ZDo6dW5pcXVlX3B0cjxGSUxFLCBkZWNsdHlwZSgmZmNsb3NlKT4gZmFyRnAoZm9wZW4oZmFyRmlsZSwgInJiIiksICZmY2xvc2UpOworICAgIHN0ZDo6dW5pcXVlX3B0cjxGSUxFLCBkZWNsdHlwZSgmZmNsb3NlKT4gb3V0cHV0RnAoZm9wZW4ob3V0cHV0RmlsZSwgIndiIiksICZmY2xvc2UpOworICAgIGlmIChlZmZlY3RFbltQUkVQUk9DX0FFQ10pIHsKKyAgICAgICAgaWYgKGZhckZpbGUgPT0gbnVsbHB0cikgeworICAgICAgICAgICAgQUxPR0UoIkZhciBlbmQgc2lnbmFsIGZpbGUgcmVxdWlyZWQgZm9yIGVjaG8gY2FuY2VsbGF0aW9uIFxuIik7CisgICAgICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOworICAgICAgICB9CisgICAgICAgIGlmIChmYXJGcCA9PSBudWxscHRyKSB7CisgICAgICAgICAgICBBTE9HRSgiQ2Fubm90IG9wZW4gZmFyIGVuZCBzdHJlYW0gZmlsZSAlc1xuIiwgZmFyRmlsZSk7CisgICAgICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOworICAgICAgICB9CisgICAgICAgIHN0cnVjdCBzdGF0IHN0YXRJbnB1dCwgc3RhdEZhcjsKKyAgICAgICAgKHZvaWQpZnN0YXQoZmlsZW5vKGlucHV0RnAuZ2V0KCkpLCAmc3RhdElucHV0KTsKKyAgICAgICAgKHZvaWQpZnN0YXQoZmlsZW5vKGZhckZwLmdldCgpKSwgJnN0YXRGYXIpOworICAgICAgICBpZiAoc3RhdElucHV0LnN0X3NpemUgIT0gc3RhdEZhci5zdF9zaXplKSB7CisgICAgICAgICAgICBBTE9HRSgiTmVhciBhbmQgZmFyIGVuZCBzaWduYWxzIGFyZSBvZiBkaWZmZXJlbnQgc2l6ZXMiKTsKKyAgICAgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgICAgIH0KKyAgICB9CisgICAgaWYgKG91dHB1dEZpbGUgIT0gbnVsbHB0ciAmJiBvdXRwdXRGcCA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dFKCJDYW5ub3Qgb3BlbiBvdXRwdXQgZmlsZSAlc1xuIiwgb3V0cHV0RmlsZSk7CisgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgfQorCisgICAgaW50MzJfdCBzZXNzaW9uSWQgPSAxOworICAgIGludDMyX3QgaW9JZCA9IDE7CisgICAgZWZmZWN0X2hhbmRsZV90IG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kpOworICAgICAgICAgICAgKCplZmZlY3RIYW5kbGVbaV0pCisgICAgICAgICAgICAgICAgICAgIC0+Y29tbWFuZChlZmZlY3RIYW5kbGVbaV0sIEVGRkVDVF9DTURfRU5BQkxFLCAwLCBudWxscHRyLCAmcmVwbHlTaXplLCAmcmVwbHkpOworICAgICAgICAgICAgaWYgKHJlcGx5ICE9IDApIHsKKyAgICAgICAgICAgICAgICBBTE9HRSgiQ29tbWFuZCBlbmFibGUgY2FsbCByZXR1cm5lZCBlcnJvciAlZFxuIiwgcmVwbHkpOworICAgICAgICAgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBTZXQgQ29uZmlnIFBhcmFtcyBvZiB0aGUgZWZmZWN0cworICAgIGlmIChlZmZlY3RFbltQUkVQUk9DX0FHQ10pIHsKKyAgICAgICAgaWYgKGludCBzdGF0dXMgPSBwcmVQcm9jU2V0Q29uZmlnUGFyYW0oQUdDX1BBUkFNX1RBUkdFVF9MRVZFTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHVpbnQzMl90KXByZVByb2NDZmdQYXJhbXMuYWdjVGFyZ2V0TGV2ZWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVmZmVjdEhhbmRsZVtQUkVQUk9DX0FHQ10pOworICAgICAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgICAgIEFMT0dFKCJJbnZhbGlkIEFHQyBUYXJnZXQgTGV2ZWwuIEVycm9yICVkXG4iLCBzdGF0dXMpOworICAgICAgICAgICAgcmV0dXJuIEVYSVRfRkFJTFVSRTsKKyAgICAgICAgfQorICAgICAgICBpZiAoaW50IHN0YXR1cyA9IHByZVByb2NTZXRDb25maWdQYXJhbShBR0NfUEFSQU1fQ09NUF9HQUlOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodWludDMyX3QpcHJlUHJvY0NmZ1BhcmFtcy5hZ2NDb21wTGV2ZWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVmZmVjdEhhbmRsZVtQUkVQUk9DX0FHQ10pOworICAgICAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgICAgIEFMT0dFKCJJbnZhbGlkIEFHQyBDb21wIEdhaW4uIEVycm9yICVkXG4iLCBzdGF0dXMpOworICAgICAgICAgICAgcmV0dXJuIEVYSVRfRkFJTFVSRTsKKyAgICAgICAgfQorICAgIH0KKyAgICBpZiAoZWZmZWN0RW5bUFJFUFJPQ19BR0MyXSkgeworICAgICAgICBpZiAoaW50IHN0YXR1cyA9IHByZVByb2NTZXRDb25maWdQYXJhbShBR0MyX1BBUkFNX0ZJWEVEX0RJR0lUQUxfR0FJTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZsb2F0KXByZVByb2NDZmdQYXJhbXMuYWdjMkdhaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVmZmVjdEhhbmRsZVtQUkVQUk9DX0FHQzJdKTsKKyAgICAgICAgICAgIHN0YXR1cyAhPSAwKSB7CisgICAgICAgICAgICBBTE9HRSgiSW52YWxpZCBBR0MyIEZpeGVkIERpZ2l0YWwgR2Fpbi4gRXJyb3IgJWRcbiIsIHN0YXR1cyk7CisgICAgICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOworICAgICAgICB9CisgICAgICAgIGlmIChpbnQgc3RhdHVzID0gcHJlUHJvY1NldENvbmZpZ1BhcmFtKEFHQzJfUEFSQU1fQURBUFRfRElHSV9MRVZFTF9FU1RJTUFUT1IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh1aW50MzJfdClwcmVQcm9jQ2ZnUGFyYW1zLmFnYzJMZXZlbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0SGFuZGxlW1BSRVBST0NfQUdDMl0pOworICAgICAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgICAgIEFMT0dFKCJJbnZhbGlkIEFHQzIgTGV2ZWwgRXN0aW1hdG9yLiBFcnJvciAlZFxuIiwgc3RhdHVzKTsKKyAgICAgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGludCBzdGF0dXMgPSBwcmVQcm9jU2V0Q29uZmlnUGFyYW0oQUdDMl9QQVJBTV9BREFQVF9ESUdJX0VYVFJBX1NBVFVSQVRJT05fTUFSR0lOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZmxvYXQpcHJlUHJvY0NmZ1BhcmFtcy5hZ2MyU2F0dXJhdGlvbk1hcmdpbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0SGFuZGxlW1BSRVBST0NfQUdDMl0pOworICAgICAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgICAgIEFMT0dFKCJJbnZhbGlkIEFHQzIgU2F0dXJhdGlvbiBNYXJnaW4uIEVycm9yICVkXG4iLCBzdGF0dXMpOworICAgICAgICAgICAgcmV0dXJuIEVYSVRfRkFJTFVSRTsKKyAgICAgICAgfQorICAgIH0KKyAgICBpZiAoZWZmZWN0RW5bUFJFUFJPQ19OU10pIHsKKyAgICAgICAgaWYgKGludCBzdGF0dXMgPSBwcmVQcm9jU2V0Q29uZmlnUGFyYW0oTlNfUEFSQU1fTEVWRUwsICh1aW50MzJfdClwcmVQcm9jQ2ZnUGFyYW1zLm5zTGV2ZWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVmZmVjdEhhbmRsZVtQUkVQUk9DX05TXSk7CisgICAgIC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lU2l6ZSwgZnJhbWVMZW5ndGgsIGlucHV0RnAuZ2V0KCkpOworICAgICAgICBpZiAoc2FtcGxlc1JlYWQgPT0gMCkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGZpbGVDaGFubmVsQ291bnQgIT0gaW9DaGFubmVsQ291bnQpIHsKKyAgICAgICAgICAgIGFkanVzdF9jaGFubmVscyhpbi5kYXRhKCksIGZpbGVDaGFubmVsQ291bnQsIGluLmRhdGEoKSwgaW9DaGFubmVsQ291bnQsIHNpemVvZihzaG9ydCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWVMZW5ndGggKiBpbkZyYW1lU2l6ZSk7CisgICAgICAgICAgICBpZiAocHJlUHJvY0NmZ1BhcmFtcy5tb25vTW9kZSA9PSAxKSB7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBmcmFtZUxlbmd0aDsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIGF1dG8qIGZwID0gJmluW2kgKiBpb0NoYW5uZWxDb3VudF07CisgICAgICAgICAgICAgICAgICAgIHN0ZDo6ZmlsbChmcCArIDEsIGZwICsgaW9DaGFubmVsQ291bnQsICpmcCk7ICAvLyByZXBsaWNhdGUgY2ggMAorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBhdWRpb19idWZmZXJfdCBpbnB1dEJ1ZmZlciwgb3V0cHV0QnVmZmVyOworICAgICAgICBhdWRpb19idWZmZXJfdCBmYXJJbkJ1ZmZlcnt9OworICAgICAgICBpbnB1dEJ1ZmZlci5mcmFtZUNvdW50ID0gZnJhbWVMZW5ndGg7CisgICAgICAgIG91dHB1dEJ1ZmZlci5mcmFtZUNvdW50ID0gZnJhbWVMZW5ndGg7CisgICAgICAgIGlucHV0QnVmZmVyLnMxNiA9IGluLmRhdGEoKTsKKyAgICAgICAgb3V0cHV0QnVmZmVyLnMxNiA9IG91dC5kYXRhKCk7CisKKyAgICAgICAgaWYgKGZhckZwICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgIHNhbXBsZXNSZWFkID0gZnJlYWQoZmFySW4uZGF0YSgpLCBpbkZyYW1lU2l6ZSwgZnJhbWVMZW5ndGgsIGZhckZwLmdldCgpKTsKKyAgICAgICAgICAgIGlmIChzYW1wbGVzUmVhZCA9PSAwKSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZmlsZUNoYW5uZWxDb3VudCAhPSBpb0NoYW5uZWxDb3VudCkgeworICAgICAgICAgICAgICAgIGFkanVzdF9jaGFubmVscyhmYXJJbi5kYXRhKCksIGZpbGVDaGFubmVsQ291bnQsIGZhckluLmRhdGEoKSwgaW9DaGFubmVsQ291bnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihzaG9ydCksIGZyYW1lTGVuZ3RoICogaW5GcmFtZVNpemUpOworICAgICAgICAgICAgICAgIGlmIChwcmVQcm9jQ2ZnUGFyYW1zLm1vbm9Nb2RlID09IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBmcmFtZUxlbmd0aDsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBhdXRvKiBmcCA9ICZmYXJJbltpICogaW9DaGFubmVsQ291bnRdOworICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpmaWxsKGZwICsgMSwgZnAgKyBpb0NoYW5uZWxDb3VudCwgKmZwKTsgIC8vIHJlcGxpY2F0ZSBjaCAwCisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZhckluQnVmZmVyLmZyYW1lQ291bnQgPSBmcmFtZUxlbmd0aDsKKyAgICAgICAgICAgIGZhckluQnVmZmVyLnMxNiA9IGZhckluLmRhdGEoKTsKKyAgICAgICAgfQorCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgUFJFUFJPQ19OVU1fRUZGRUNUUzsgaSsrKSB7CisgICAgICAgICAgICBpZiAoZWZmZWN0RW5baV0gPT0gMSkgeworICAgICAgICAgICAgICAgIGlmIChpID09IFBSRVBST0NfQUVDKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChpbnQgc3RhdHVzID0gcHJlUHJvY1NldENvbmZpZ1BhcmFtKEFFQ19QQVJBTV9FQ0hPX0RFTEFZLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodWludDMyX3QpcHJlUHJvY0NmZ1BhcmFtcy5hZWNEZWxheSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0SGFuZGxlW1BSRVBST0NfQUVDXSk7CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgQUxPR0UoInByZVByb2NTZXRDb25maWdQYXJhbSByZXR1cm5lZCBFcnJvciAlZFxuIiwgc3RhdHVzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGludCBzdGF0dXMgPSAoKmVmZmVjdEhhbmRsZVtpXSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLT5wcm9jZXNzKGVmZmVjdEhhbmRsZVtpXSwgJmlucHV0QnVmZmVyLCAmb3V0cHV0QnVmZmVyKTsKKyAgICAgICAgICAgICAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR0UoIlxuRXJyb3I6IFByb2Nlc3MgaSA9ICVkIHJldHVybmVkIHdpdGggZXJyb3IgJWRcbiIsIGksIHN0YXR1cyk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChpID09IFBSRVBST0NfQUVDKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChpbnQgc3RhdHVzID0gKCplZmZlY3RIYW5kbGVbaV0pCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtPnByb2Nlc3NfcmV2ZXJzZShlZmZlY3RIYW5kbGVbaV0sICZmYXJJbkJ1ZmZlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZvdXRwdXRCdWZmZXIpOworICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dFKCJcbkVycm9yOiBQcm9jZXNzIHJldmVyc2UgaSA9ICVkIHJldHVybmVkIHdpdGggZXJyb3IgJWRcbiIsIGksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVYSVRfRkFJTFVSRTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAob3V0cHV0RnAgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgaWYgKGZpbGVDaGFubmVsQ291bnQgIT0gaW9DaGFubmVsQ291bnQpIHsKKyAgICAgICAgICAgICAgICBhZGp1c3RfY2hhbm5lbHMob3V0LmRhdGEoKSwgaW9DaGFubmVsQ291bnQsIG91dC5kYXRhKCksIGZpbGVDaGFubmVsQ291bnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihzaG9ydCksIGZyYW1lTGVuZ3RoICogaW9GcmFtZVNpemUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc2l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0ZWQuIgorICAgIGV4aXQgJEVfVkFMCitmaQorCitmbGFnc19hcnI9KAorICAgICItLWFnYyAtLW1vbm8iCisgICAgIi0tbnMgLS1tb25vIgorICAgICItLWFnYzIgLS1tb25vIgorICAgICItLWFlYyAtLW1vbm8iCispCisKK2ZzX2Fycj0oCisgICAgODAwMAorICAgIDExMDI1CisgICAgMTIwMDAKKyAgICAxNjAwMAorICAgIDIyMDUwCisgICAgMjQwMDAKKyAgICAzMjAwMAorICAgIDQ0MTAwCisgICAgNDgwMDAKKykKKworIyBydW4gbXVsdGljaGFubmVsIGVmZmVjdHMgYXQgZGlmZmVyZW50IGNvbmZpZ3MsIHNhdmluZyBvbmx5IHRoZSBtb25vIGNoYW5uZWwKK2Vycm9yX2NvdW50PTAKK3Rlc3RfY291bnQ9MAorZm9yIGNtZCBpbiAiJHtjbWRzW0BdfSIKK2RvCisgICAgJGNtZAorICAgIGZvciBmbGFncyBpbiAiJHtmbGFnc19hcnJbQF19IgorICAgIGRvCisgICAgICAgIGZvciBmcyBpbiAke2ZzX2FyclsqXX0KKyAgICAgICAgZG8KKyAgICAgICAgICAgIGZvciBjaE1hc2sgaW4gezAuLjd9CisgICAgICAgICAgICBkbworICAgICAgICAgICAgICAgIGFkYiBzaGVsbCAkdGVzdGRpci9BdWRpb1ByZVByb2Nlc3NpbmdUZXN0ICRmbGFncyBcCisgICAgICAgICAgICAgICAgICAgIC0taSAkdGVzdGRpci9zaW5lc3dlZXByYXcucmF3IC0tZmFyICR0ZXN0ZGlyL3NpbmVzd2VlcHJhdy5yYXcgXAorICAgICAgICAgICAgICAgICAgICAtLW91dHB1dCAkdGVzdGRpci9zaW5lc3dlZXBfJCgoY2hNYXNrKSlfJCgoZnMpKS5yYXcgLS1jaF9tYXNrICRjaE1hc2sgXAorICAgICAgICAgICAgICAgICAgICAtLWZzICRmcyAtLWZjaCAxCisKKyAgICAgICAgICAgICAgICBzaGVsbF9yZXQ9JD8KKyAgICAgICAgICAgICAgICBpZiBbICRzaGVsbF9yZXQgLW5lIDAgXTsgdGhlbgorICAgICAgICAgICAgICAgICAgICBlY2hvICJlcnJvciBzaGVsbF9yZXQgaGVyZSBpcyB6ZXJvOiAkc2hlbGxfcmV0IgorICAgICAgICAgICAgICAgICAgICAoKCsrZXJyb3JfY291bnQpKQorICAgICAgICAgICAgICAgIGZpCisKKworICAgICAgICAgICAgICAgICMgc2luZ2xlIGNoYW5uZWwgZmlsZXMgc2hvdWxkIGJlIGlkZW50aWNhbCB0byBoaWdoZXIgY2hhbm5lbAorICAgICAgICAgICAgICAgICMgY29tcHV0YXRpb24gKGZpcnN0IGNoYW5uZWwpLgorICAgICAgICAgICAgICAgIGlmICBbWyAiJGNoTWFzayIgLWd0IDEgXV0KKyAgICAgICAgICAgICAgICB0aGVuCisgICAgICAgICAgICAgICAgICAgIGFkYiBzaGVsbCBjbXAgJHRlc3RkaXIvc2luZXN3ZWVwXzFfJCgoZnMpKS5yYXcgXAorICAgICAgICAgICAgICAgICAgICAgICAgJHRlc3RkaXIvc2luZXN3ZWVwXyQoKGNoTWFzaykpXyQoKGZzKSkucmF3CisgICAgICAgICAgICAgICAgZmkKKworICAgICAgICAgICAgICAgICMgY21wIHJldHVybiBFWElUX0ZBSUxVUkUgb24gbWlzbWF0Y2guCisgICAgICAgICAgICAgICAgc2hlbGxfcmV0PSQ/CisgICAgICAgICAgICAgICAgaWYgWyAkc2hlbGxfcmV0IC1uZSAwIF07IHRoZW4KKyAgICAgICAgICAgICAgICAgICAgZWNobyAiZXJyb3I6ICRzaGVsbF9yZXQiCisgICAgICAgICAgICAgICAgICAgICgoKytlcnJvcl9jb3VudCkpCisgICAgICAgICAgICAgICAgZmkKKyAgICAgICAgICAgICAgICAoKCsrdGVzdF9jb3VudCkpCisgICAgICAgICAgICBkb25lCisgICAgICAgIGRvbmUKKyAgICBkb25lCitkb25lCisKK2FkYiBzaGVsbCBybSAtciAkdGVzdGRpcgorZWNobyAiJHRlc3RfY291bnQgdGVzdHMgcGVyZ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kIHRvIG1hdGNoIHdpdGggd2F2ZSBwZXJpb2QuCisgICAgICAgIC8vIFRoZSBmb2xsb3dpbmcgYmxvY2sgb2YgY29kZSBzYXZlcyB0aGUgZmlyc3Qga051bVBlYWtzIG51bWJlciBvZiBwZWFrcyBhbmQgdGhlIGluZGV4IGF0CisgICAgICAgIC8vIHdoaWNoIHRoZXkgb2NjdXIuCisgICAgICAgIGlmIChwZWFrSW5kZXggPCBrTnVtUGVha3MpIHsKKyAgICAgICAgICAgIGlmIChjb3JyVmFsID4gcHJldkNvcnJWYWwpIHsKKyAgICAgICAgICAgICAgICBwZWFrSW5kZXhWZWN0W3BlYWtJbmRleF0gPSBpOworICAgICAgICAgICAgICAgIHBlYWtWYWx1ZVZlY3RbcGVha0luZGV4XSA9IGNvcnJWYWw7CisgICAgICAgICAgICAgICAgZmxhZyA9IDA7CisgICAgICAgICAgICB9IGVsc2UgaWYgKDAgPT0gZmxhZykgeworICAgICAgICAgICAgICAgIHBlYWtJbmRleCsrOworICAgICAgICAgICAgICAgIGZsYWcgPSAxOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChwZWFrSW5kZXggPT0ga051bVBlYWtzKSBicmVhazsKKyAgICAgICAgcHJldkNvcnJWYWwgPSBjb3JyVmFsOworICAgIH0KKyAgICByZXR1cm4ge3BlYWtJbmRleFZlY3QsIHBlYWtWYWx1ZVZlY3R9OworfQorCit2b2lkIHByaW50VXNhZ2UoKSB7CisgICAgcHJpbnRmKCJcblVzYWdlOiAiKTsKKyAgICBwcmludGYoIlxuICAgICBjb3JyZWxhdGlvbiA8Zmlyc3RGaWxlPiA8c2Vjb25kRmlsZT4gW2VuYWJsZUNyb3NzQ29ycl1cbiIpOworICAgIHByaW50ZigiXG53aGVyZSwgXG4gICAgIDxmaXJzdEZpbGU+ICAgICAgIGlzIHRoZSBmaXJzdCBmaWxlIG5hbWUiKTsKKyAgICBwcmludGYoIlxuICAgICA8c2Vjb25kRmlsZT4gICAgICBpcy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gICAgICAgICAgICAgICAgICAgIFwKLSAgICAgICAgICAgICAgICAyMC4wICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICApCi0KLSNkZWZpbmUgICAgTEZPX0dBSU5fVE9fQ0VOVFMgICAgKGludDMyX3QpICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICAgICAgICAgICAgICBET1VCTEVfTEZPX0dBSU5fVE9fQ0VOVFMgKiAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICAgICAgICAgICgweDFMIDw8IE5VTV9FRzFfRlJBQ19CSVRTKSAgICAgICAgICAgICAgICAgICAgXAotICAgICkKLSNlbmRpZgogCiAjZGVmaW5lIExGT19HQUlOX1RPX0NFTlRTIChpbnQzMl90KSAoMTY3MTk4MTE1NkwgPj4gKDIzIC0gTlVNX0VHMV9GUkFDX0JJVFMpKQogCmRpZmYgLS1naXQgYS9tZWRpYS9saWJlZmZlY3RzL3Zpc3VhbGl6ZXIvQW5kcm9pZC5icCBiL21lZGlhL2xpYmVmZmVjdHMvdmlzdWFsaXplci9BbmRyb2lkLmJwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjhkZDY3ODkKLS0tIC9kZXYvbnVsbAorKysgYi9tZWRpYS9saWJlZmZlY3RzL3Zpc3VhbGl6ZXIvQW5kcm9pZC5icApAQCAtMCwwICsxLDUxIEBACisvLyBWaXN1YWxpemVyIGxpYnJhcnkKK3BhY2thZ2UgeworICAgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWworICAgICAgICAiZnJhbWV3b3Jrc19hdl9tZWRpYV9saWJlZmZlY3RzX3Zpc3VhbGl6ZXJfbGljZW5zZSIsCisgICAgXSwKK30KKworLy8gQWRkZWQgYXV0b21hdGljYWxseSBieSBhIGxhcmdlLXNjYWxlLWNoYW5nZQorLy8gU2VlOiBodHRwOi8vZ28vYW5kcm9pZC1saWNlbnNlLWZhcQorbGljZW5zZSB7CisgICAgbmFtZTogImZyYW1ld29ya3NfYXZfbWVkaWFfbGliZWZmZWN0c192aXN1YWxpemVyX2xpY2Vuc2UiLAorICAgIHZpc2liaWxpdHk6IFsiOl9fc3VicGFja2FnZXNfXyJdLAorICAgIGxpY2Vuc2Vfa2luZHM6IFsKKyAgICAgICAgIlNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUFwYWNoZS0yLjAiLAorICAgIF0sCisgICAgbGljZW5zZV90ZXh0OiBbCisgICAgICAgICJOT1RJQ0UiLAorICAgIF0sCit9CisKK2NjX2xpYnJhcnlfc2hhcmVkIHsKKyAgICBuYW1lOiAibGlidmlzdWFsaXplciIsCisKKyAgICB2ZW5kb3I6IHRydWUsCisKKyAgICBzcmNzOiBbCisgICAgICAgICJFZmZlY3RWaXN1YWxpemVyLmNwcCIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLU8yIiwKKyAgICAgICAgIi1mdmlzaWJpbGl0eT1oaWRkZW4iLAorCisgICAgICAgICItREJVSUxEX0ZMT0FUIiwKKyAgICAgICAgIi1EU1VQUE9SVF9NQyIsCisKKyAgICAgICAgIi1XYWxsIiwKKyAgICAgICAgIi1XZXJyb3IiLAorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGlibG9nIiwKKyAgICBdLAorCisgICAgcmVsYXRpdmVfaW5zdGFsbF9wYXRoOiAic291bmRmeCIsCisKKyAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGliYXVkaW9lZmZlY3RzIiwKKyAgICAgICAgImxpYmF1ZGlvdXRpbHNfaGVhZGVycyIsCisgICAgXSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL2xpYmVmZmVjdHMvdmlzdWFsaXplci9BbmRyb2lkLm1rIGIvbWVkaWEvbGliZWZmZWN0cy92aXN1YWxpemVyL0FuZHJvaWQubWsKZGVsZXRlZC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ICAgICAgICJTUERYLWxpY2Vuc2UtaWRlbnRpZmllci1BcGFjaGUtMi4wIiwKKyAgICBdLAorICAgIGxpY2Vuc2VfdGV4dDogWworICAgICAgICAiTk9USUNFIiwKKyAgICBdLAorfQorCiBjY19saWJyYXJ5X2hlYWRlcnMgewogICAgIG5hbWU6ICJsaWJtZWRpYV9oZWFkZXJzIiwKICAgICB2ZW5kb3JfYXZhaWxhYmxlOiB0cnVlLApAQCAtNSwxOCArMjIsNDIgQEAKIAogICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsiaW5jbHVkZSJdLAogICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJhdi1oZWFkZXJzIiwKICAgICAgICAgImxpYmJhc2VfaGVhZGVycyIsCiAgICAgICAgICJsaWJndWlfaGVhZGVycyIsCiAgICAgICAgICJsaWJzdGFnZWZyaWdodF9oZWFkZXJzIiwKICAgICAgICAgIm1lZGlhX3BsdWdpbl9oZWFkZXJzIiwKICAgICBdLAogICAgIGV4cG9ydF9oZWFkZXJfbGliX2hlYWRlcnM6IFsKKyAgICAgICAgImF2LWhlYWRlcnMiLAogICAgICAgICAibGliZ3VpX2hlYWRlcnMiLAogICAgICAgICAibGlic3RhZ2VmcmlnaHRfaGVhZGVycyIsCiAgICAgICAgICJtZWRpYV9wbHVnaW5faGVhZGVycyIsCiAgICAgXSwKIH0KIAorY2NfbGlicmFyeV9oZWFkZXJzIHsKKyAgICBuYW1lOiAibGlibWVkaWFfZGF0YXNvdXJjZV9oZWFkZXJzIiwKKyAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUiXSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKyAgICB0YXJnZXQ6IHsKKyAgICAgICAgZGFyd2luOiB7CisgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSwKKyAgICAgICAgfSwKKyAgICB9LAorICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJiaW5kZXJfaGVhZGV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YmxlOiB0cnVlLAotICAgIGxvY2FsX2luY2x1ZGVfZGlyOiAiYWlkbCIsCi0gICAgc3JjczogWwotICAgICAgICAiOnJlc291cmNlbWFuYWdlcl9haWRsIiwKLSAgICBdLAotfQotCiBjY19saWJyYXJ5X3NoYXJlZCB7CiAgICAgbmFtZTogImxpYm1lZGlhX29teCIsCiAgICAgdmVuZG9yX2F2YWlsYWJsZTogdHJ1ZSwKQEAgLTIwMyw3ICsyMjIsNyBAQAogICAgIF0sCiAKICAgICBoZWFkZXJfbGliczogWwotICAgICAgICAibGlibWVkaWFfaGVhZGVycyIsCisgICAgICAgICJsaWJtZWRpYV9kYXRhc291cmNlX2hlYWRlcnMiLAogICAgICAgICAibWVkaWFfbmRrX2hlYWRlcnMiLAogICAgIF0sCiAKQEAgLTIyMCw2ICsyMzksMTQgQEAKICAgICAgICAgXSwKICAgICAgICAgY2ZpOiB0cnVlLAogICAgIH0sCisKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKworICAgIHRhcmdldDogeworICAgICAgICBkYXJ3aW46IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgIH0sCiB9CiAKIGNjX2xpYnJhcnlfc2hhcmVkIHsKQEAgLTMwOSwxNSArMzM2LDE5IEBACiAgICAgaGVhZGVyX2xpYnM6IFsKICAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2hlYWRlcnMiLAogICAgICAgICAibWVkaWFfbmRrX2hlYWRlcnMiLAorICAgICAgICAiam5pX2hlYWRlcnMiLAogICAgIF0sCiAKICAgICBleHBvcnRfaGVhZGVyX2xpYl9oZWFkZXJzOiBbCiAgICAgICAgICJsaWJzdGFnZWZyaWdodF9oZWFkZXJzIiwKICAgICAgICAgIm1lZGlhX25ka19oZWFkZXJzIiwKKyAgICAgICAgImpuaV9oZWFkZXJzIiwKICAgICBdLAogCiAgICAgc2hhcmVkX2xpYnM6IFsKICAgICAgICAgImFuZHJvaWQuaGlkbC50b2tlbkAxLjAtdXRpbHMiLAorICAgICAgICAiYXVkaW9jbGllbnQtdHlwZXMtYWlkbC1jcHAiLAorICAgICAgICAiYXYtdHlwZXMtYWlkbC1jcHAiLAogICAgICAgICAibGlibG9nIiwKICAgICAgICAgImxpYmN1dGlscyIsCiAgICAgICAgICJsaWJwcm9jZXNzZ3JvdXAiLApAQCAtMzM0LDYgKzM2NSw3IEBACiAgICAgICAgICJsaWJhdWRpb2NsaWVudCIsCiAgICAgICAgICJsaWJtZWRpYV9jb2RlY2xpc3QiLAogICAgICAgICAibGlibWVkaWFfb214IiwKKyAgICAgICAgImZyYW1ld29yay1wZXJtaXNzaW9uLWFpZGwtY3BwIiwKICAgICBdLAogCiAgICAgZXhwb3J0X3NoYXJlZF9saWJfaGVhZGVyczogWwpAQCAtMzQyLDE0ICszNzQsMTcgQEAKICAgICAgICAgImxpYmFuZHJvaWRpY3UiLAogICAgICAgICAvLyJsaWJzb25pdm94IiwKICAgICAgICAgImxpYm1lZGlhX29teCIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCiAgICAgXSwKIAogICAgIHN0YXRpY19saWJzOiBbCiAgICAgICAgICJyZXNvdXJjZW1hbmFnZXJfYWlkbF9pbnRlcmZhY2UtbmRrX3BsYXRmb3JtIiwKKyAgICAgICAgImZyYW1ld29yay1wZXJtaXNzaW9uLWFpZGwtY3BwIiwKICAgICBdLAogCiAgICAgZXhwb3J0X3N0YXRpY19saWJfaGVhZGVyczogWwogICAgICAgICAicmVzb3VyY2VtYW5hZ2VyX2FpZGxfaW50ZXJmYWNlLW5ka19wbGF0Zm9ybSIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCiAgICAgXSwKIAogICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsKQEAgLTM3MiwzICs0MDcsMzkgQEAKICAgICAgICAgY2ZpOiB0cnVlLAogICAgIH0sCiB9CisKK2NjX2xpYn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GljIEJwSW50ZXJmYWNlPElNZWRpYUV4dHJhY3Rvcj4gewpAQCAtMTUwLDYgKzE1MSwxMyBAQAogICAgICAgICBkYXRhLndyaXRlSW50MzIoc3RhdGljX2Nhc3Q8aW50MzJfdD4oZW50cnlQb2ludCkpOwogICAgICAgICByZXR1cm4gcmVtb3RlKCktPnRyYW5zYWN0KFNFVEVOVFJZUE9JTlQsIGRhdGEsICZyZXBseSk7CiAgICAgfQorCisgICAgdmlydHVhbCBzdGF0dXNfdCBzZXRMb2dTZXNzaW9uSWQoY29uc3QgU3RyaW5nOCYgbG9nU2Vzc2lvbklkKSB7CisgICAgICAgIFBhcmNlbCBkYXRhLCByZXBseTsKKyAgICAgICAgZGF0YS53cml0ZUludGVyZmFjZVRva2VuKEJwTWVkaWFFeHRyYWN0b3I6OmdldEludGVyZmFjZURlc2NyaXB0b3IoKSk7CisgICAgICAgIGRhdGEud3JpdGVTdHJpbmc4KGxvZ1Nlc3Npb25JZCk7CisgICAgICAgIHJldHVybiByZW1vdGUoKS0+dHJhbnNhY3QoU0VUTE9HU0VTU0lPTklELCBkYXRhLCAmcmVwbHkpOworICAgIH0KIH07CiAKIElNUExFTUVOVF9NRVRBX0lOVEVSRkFDRShNZWRpYUV4dHJhY3RvciwgImFuZHJvaWQubWVkaWEuSU1lZGlhRXh0cmFjdG9yIik7CkBAIC0yNTAsNiArMjU4LDE2IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICByZXR1cm4gZXJyOwogICAgICAgICB9CisgICAgICAgIGNhc2UgU0VUTE9HU0VTU0lPTklEOiB7CisgICAgICAgICAgICBBTE9HVigic2V0TG9nU2Vzc2lvbklkIik7CisgICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSU1lZGlhRXh0cmFjdG9yLCBkYXRhLCByZXBseSk7CisgICAgICAgICAgICBTdHJpbmc4IGxvZ1Nlc3Npb25JZDsKKyAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGRhdGEucmVhZFN0cm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CAtMTg4LDYgKzE0MSwxNSBAQAogICAgICAgICByZXR1cm4gcmVwbHkucmVhZEludDMyKCk7CiAgICAgfQogCisgICAgc3RhdHVzX3Qgc2V0RGF0YVNvdXJjZShjb25zdCBTdHJpbmc4JiBydHBQYXJhbXMpIHsKKyAgICAgICAgUGFyY2VsIGRhdGEsIHJlcGx5OworICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSU1lZGlhUGxheWVyOjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOworICAgICAgICBkYXRhLndyaXRlU3RyaW5nOChydHBQYXJhbXMpOworICAgICAgICByZW1vdGUoKS0+dHJhbnNhY3QoU0VUX0RBVEFfU09VUkNFX1JUUCwgZGF0YSwgJnJlcGx5KTsKKworICAgICAgICByZXR1cm4gcmVwbHkucmVhZEludDMyKCk7CisgICAgfQorCiAgICAgLy8gcGFzcyB0aGUgYnVmZmVyZWQgSUdyYXBoaWNCdWZmZXJQcm9kdWNlciB0byB0aGUgbWVkaWEgcGxheWVyIHNlcnZpY2UKICAgICBzdGF0dXNfdCBzZXRWaWRlb1N1cmZhY2VUZXh0dXJlKGNvbnN0IHNwPElHcmFwaGljQnVmZmVyUHJvZHVjZXI+JiBidWZmZXJQcm9kdWNlcikKICAgICB7CkBAIC03MTIsNiArNjc0LDEyIEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7CiAgICAgICAgIH0KKyAgICAgICAgY2FzZSBTRVRfREFUQV9TT1VSQ0VfUlRQOiB7CisgICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSU1lZGlhUGxheWVyLCBkYXRhLCByZXBseSk7CisgICAgICAgICAgICBTdHJpbmc4IHJ0cFBhcmFtcyA9IGRhdGEucmVhZFN0cmluZzgoKTsKKyAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKHNldERhdGFTb3VyY2UocnRwUGFyYW1zKSk7CisgICAgICAgICAgICByZXR1cm4gTk9fR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lfU0VOU0lUSVZFLApAQCAtNDc2LDYgKzQ3NywyMyBAQAogICAgICAgICAqcG9ydElkID0gKGF1ZGlvX3BvcnRfaGFuZGxlX3QpcmVwbHkucmVhZEludDMyKCk7CiAgICAgICAgIHJldHVybiBOT19FUlJPUjsKICAgICB9CisKKyAgICBzdGF0dXNfdCBnZXRSdHBEYXRhVXNhZ2UodWludDY0X3QgKmJ5dGVzKQorICAgIHsKKyAgICAgICAgQUxPR1YoImdldFJ0cERhdGFVc2FnZSIpOworICAgICAgICBpZiAoYnl0ZXMgPT0gbnVsbHB0cikgeworICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICAgICAgfQorICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7CisgICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJTWVkaWFSZWNvcmRlcjo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKKyAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gcmVtb3RlKCktPnRyYW5zYWN0KEdFVF9SVFBfREFUQV9VU0FHRSwgZGF0YSwgJnJlcGx5KTsKKyAgICAgICAgaWYgKHN0YXR1cyAhPSBPSworICAgICAgICAgICAgICAgIHx8IChzdGF0dXMgPSAoc3RhdHVzX3QpcmVwbHkucmVhZEludDMyKCkpICE9IE5PX0VSUk9SKSB7CisgICAgICAgICAgICAqYnl0ZXMgPSAwOworICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcmVwbHkucmVhZFVpbnQ2NChieXRlcyk7CisgICAgfQogfTsKIAogSU1QTEVNRU5UX01FVEFfSU5URVJGQUNFKE1lZGlhUmVjb3JkZXIsICJhbmRyb2lkLm1lZGlhLklNZWRpYVJlY29yZGVyIik7CkBAIC03NTksNiArNzc3LDE3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7CiAgICAgICAgIH0KKyAgIC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CkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG9mZnNldCArIHNpemUgPj0gbUNhY2hlQnVmUmFuZ2VMZW5ndGgpIHsKKyAgICAgICAgICAgICAgICAgICAgbWVtY3B5KGJ1ZmZlciwgKHZvaWQqKShtQ2FjaGVCdWZmZXIgKyBvZmZzZXQpLCBtQ2FjaGVCdWZSYW5nZUxlbmd0aCAtIG9mZnNldCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBtQ2FjaGVCdWZSYW5nZUxlbmd0aCAtIG9mZnNldDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtZW1jcHkoYnVmZmVyLCAodm9pZCopKG1DYWNoZUJ1ZmZlciArIG9mZnNldCksIHNpemUpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2l6ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiBhY3R1YWxOdW1CeXRlc1JlYWQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9IGVsc2UgeworICAgICAgICByZXR1cm4gdW5idWZmZXJlZFJlYWRBdChidWZmZXIsIG9mZnNldCwgc2l6ZSk7CisgICAgfQorfQorCitpbnQgTWlkaUlvV3JhcHBlcjo6dW5idWZmZXJlZFJlYWRBdCh2b2lkICpidWZmZXIsIGludCBvZmZzZXQsIGludCBzaXplKSB7CisgICAgQUxPR1YoInVuYnVmZmVyZWRSZWFkQXQoJXAsICVkLCAlZCkiLCBidWZmZXIsIG9mZnNldCwgc2l6ZSk7CiAgICAgaWYgKG1EYXRhU291cmNlICE9IE5VTEwpIHsKICAgICAgICAgcmV0dXJuIG1EYXRhU291cmNlLT5yZWFkQXQob2Zmc2V0LCBidWZmZXIsIHNpemUpOwogICAgIH0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYm1lZGlhL05ka01lZG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VjdGVkOgorCisgICAgZnJpZW5kIGNsYXNzIElNZWRpYVBsYXllclRlc3Q7CisgICAgZW51bSB7CisgICAgICAgIERJU0NPTk5FQ1QgPSBJQmluZGVyOjpGSVJTVF9DQUxMX1RSQU5TQUNUSU9OLAorICAgICAgICBTRVRfREFUQV9TT1VSQ0VfVVJMLAorICAgICAgICBTRVRfREFUQV9TT1VSQ0VfRkQsCisgICAgICAgIFNFVF9EQVRBX1NPVVJDRV9TVFJFQU0sCisgICAgICAgIFNFVF9EQVRBX1NPVVJDRV9DQUxMQkFDSywKKyAgICAgICAgU0VUX0RBVEFfU09VUkNFX1JUUCwKKyAgICAgICAgU0VUX0JVRkZFUklOR19TRVRUSU5HUywKKyAgICAgICAgR0VUX0JVRkZFUklOR19TRVRUSU5HUywKKyAgICAgICAgUFJFUEFSRV9BU1lOQywKKyAgICAgICAgU1RBUlQsCisgICAgICAgIFNUT1AsCisgICAgICAgIElTX1BMQVlJTkcsCisgICAgICAgIFNFVF9QTEFZQkFDS19TRVRUSU5HUywKKyAgICAgICAgR0VUX1BMQVlCQUNLX1NFVFRJTkdTLAorICAgICAgICBTRVRfU1lOQ19TRVRUSU5HUywKKyAgICAgICAgR0VUX1NZTkNfU0VUVElOR1MsCisgICAgICAgIFBBVVNFLAorICAgICAgICBTRUVLX1RPLAorICAgICAgICBHRVRfQ1VSUkVOVF9QT1NJVElPTiwKKyAgICAgICAgR0VUX0RVUkFUSU9OLAorICAgICAgICBSRVNFVCwKKyAgICAgICAgTk9USUZZX0FULAorICAgICAgICBTRVRfQVVESU9fU1RSRUFNX1RZUEUsCisgICAgICAgIFNFVF9MT09QSU5HLAorICAgICAgICBTRVRfVk9MVU1FLAorICAgICAgICBJTlZPS0UsCisgICAgICAgIFNFVF9NRVRBREFUQV9GSUxURVIsCisgICAgICAgIEdFVF9NRVRBREFUQSwKKyAgICAgICAgU0VUX0FVWF9FRkZFQ1RfU0VORF9MRVZFTCwKKyAgICAgICAgQVRUQUNIX0FVWF9F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nJhbWVXaWR0aCBmcmFtZSB3aWR0aCBpbiBwaXhlbHMKKyAgICAgICAgICogQHBhcmFtIGZyYW1lSGVpZ2h0IGZyYW1lIGhlaWdodCBpbiBwaXhlbHMKKyAgICAgICAgICogQHBhcmFtIGZyYW1lUmF0ZSBmcmFtZSByYXRlIGluIGZwcworICAgICAgICAgKiBAcGFyYW0gcHJvZmlsZSBjb2RlYyBwcm9maWxlIChmb3IgTWVkaWFDb2RlYykgb3IgLTEgZm9yIG5vbmUKKyAgICAgICAgICovCisgICAgICAgIFZpZGVvQ29kZWModmlkZW9fZW5jb2RlciBjb2RlYywgaW50IGJpdHJhdGUsIGludCBmcmFtZVdpZHRoLCBpbnQgZnJhbWVIZWlnaHQsIGludCBmcmFtZVJhdGUsCisgICAgICAgICAgICAgICAgICAgaW50IHByb2ZpbGUgPSAtMSkKKyAgICAgICAgICAgIDogbUNvZGVjKGNvZGVjKSwKKyAgICAgICAgICAgICAgbUJpdFJhdGUoYml0cmF0ZSksCisgICAgICAgICAgICAgIG1GcmFtZVdpZHRoKGZyYW1lV2lkdGgpLAorICAgICAgICAgICAgICBtRnJhbWVIZWlnaHQoZnJhbWVIZWlnaHQpLAorICAgICAgICAgICAgICBtRnJhbWVSYXRlKGZyYW1lUmF0ZSksCisgICAgICAgICAgICAgIG1Qcm9maWxlKHByb2ZpbGUpIHsKKyAgICAgICAgfQorCisgICAgICAgIFZpZGVvQ29kZWMoY29uc3QgVmlkZW9Db2RlYyYpID0gZGVmYXVsdDsKKworICAgICAgICB+VmlkZW9Db2RlYygpIHt9CisKKyAgICAgICAgLyoqIFJldHVybnMgdGhlIGNvZGVjIHR5cGUuICovCisgICAgICAgIHZpZGVvX2VuY29kZXIgZ2V0Q29kZWMoKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gbUNvZGVjOworICAgICAgICB9CisKKyAgICAgICAgLyoqIFJldHVybnMgdGhlIGJpdHJhdGUgaW4gYnBzLiAqLworICAgICAgICBpbnQgZ2V0Qml0cmF0ZSgpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBtQml0UmF0ZTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKiBSZXR1cm5zIHRoZSBmcmFtZSB3aWR0aCBpbiBwaXhlbHMuICovCisgICAgICAgIGludCBnZXRGcmFtZVdpZHRoKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIG1GcmFtZVdpZHRoOworICAgICAgICB9CisKKyAgICAgICAgLyoqIFJldHVybnMgdGhlIGZyYW1lIGhlaWdodCBpbiBwaXhlbHMuICovCisgICAgICAgIGludCBnZXRGcmFtZUhlaWdodCgpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBtRnJhbWVIZWlnaHQ7CisgICAgICAgIH0KKworICAgICAgICAvKiogUmV0dXJucyB0aGUgZnJhbWUgcmF0ZSBpbiBmcHMuICovCisgICAgICAgIGludCBnZXRGcmFtZVJhdGUoKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gbUZyYW1lUmF0ZTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKiBSZXR1cm5zIHRoZSBjb2RlYyBwcm9maWxlIChvciAtMSBmb3Igbm8gcHJvZmlsZSkuICovCisgICAgICAgIGludCBnZXRQcm9maWxlKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIG1Qcm9maWxlOworICAgICAgICB9CisKKyAgICBwcml2YXRlOgorICAgICAgICB2aWRlb19lbmNvZGVyIG1Db2RlYzsKKyAgICAgICAgaW50IG1CaXRSYXRlOworICAgICAgICBpbnQgbUZyYW1lV2lkdGg7CisgICAgICAgIGludCBtRnJhbWVIZWlnaHQ7CisgICAgICAgIGludCBtRnJhbWVSYXRlOworICAgICAgICBpbnQgbVByb2ZpbGU7CisgICAgICAgIGZyaWVuZCBjbGFzcyBNZWRpYVByb2ZpbGVzOworICAgIH07CisKKyAgICAvKioKKyAgICAgKiBDb25maWd1cmF0aW9uIGZvciBhbiBhdWRpbyBlbmNvZGVyLgorICAgICAqLworICAgIHN0cnVjdCBBdWRpb0NvZGVjIHsKKyAgICBwdWJsaWM6CisgICAgICAgIC8qKgorICAgICAgICAgKiBDb25zdHJ1Y3RzIGFuIGF1ZGlvIGVuY29kZXIgY29uZmlndXJhdGlvbi4KKyAgICAgICAgICoKKyAgICAgICAgICogQHBhcmFtIGNvZGVjIGNvZGVjIHR5cGUKKyAgICAgICAgICogQHBhcmFtIGJpdHJhdGUgYml0cmF0ZSBpbiBicHMKKyAgICAgICAgICogQHBhcmFtIHNhbXBsZVJhdGUgc2FtcGxlIHJhdGUgaW4gSHoKKyAgICAgICAgICogQHBhcmFtIGNoYW5uZWxzIG51bWJlciBvZiBjaGFubmVscworICAgICAgICAgKiBAcGFyYW0gcHJvZmlsZSBjb2RlYyBwcm9maWxlIChmb3IgTWVkaWFDb2RlYykgb3IgLTEgZm9yIG5vbmUKKyAgICAgICAgICovCisgICAgICAgIEF1ZGlvQ29kZWMoYXVkaW9fZW5jb2RlciBjb2RlYywgaW50IGJpdHJhdGUsIGludCBzYW1wbGVSYXRlLCBpbnQgY2hhbm5lbHMsIGludCBwcm9maWxlID0gLTEpCisgICAgICAgICAgICA6IG1Db2RlYyhjb2RlYyksCisgICAgICAgICAgICAgIG1CaXRSYXRlKGJpdHJhdGUpLAorICAgICAgICAgICAgICBtU2FtcGxlUmF0ZShzYW1wbGVSYXRlKSwKKyAgICAgICAgICAgICAgbUNoYW5uZWxzKGNoYW5uZWxzKSwKKyAgICAgICAgICAgICAgbVByb2ZpbGUocHJvZmlsZSkgeworICAgICAgICB9CisKKyAgICAgICAgQXVkaW9Db2RlYyhjb25zdCBBdWRpb0NvZGVjJikgPSBkZWZhdWx0OworCisgICAgICAgIH5BdWRpb0NvZGVjKCkge30KKworICAgICAgICAvKiogUmV0dXJucyB0aGUgY29kZWMgdHlwZS4gKi8KKyAgICAgICAgYXVkaW9fZW5jb2RlciBnZXRDb2RlYygpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBtQ29kZWM7CisgICAgICAgIH0KKworICAgICAgICAvKiogUmV0dXJucyB0aGUgYml0cmF0ZSBpbiBicHMuICovCisgICAgICAgIGludCBnZXRCaXRyYXRlKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIG1CaXRSYXRlOworICAgICAgICB9CisKKyAgICAgICAgLyoqIFJldHVybnMgdGhlIHNhbXBsZSByYXRlIGluIEh6LiAqLworICAgICAgICBpbnQgZ2V0U2FtcGxlUmF0ZSgpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBtU2FtcGxlUmF0ZTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKiBSZXR1cm5zIHRoZSBudW1iZXIgb2YgY2hhbm5lbHMuICovCisgICAgICAgIGludCBnZXRDaGFubmVscygpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBtQ2hhbm5lbHM7CisgICAgICAgIH0KKworICAgICAgICAvKiogUmV0dXJucyB0aGUgY29kZWMgcHJvZmlsZSAob3IgLTEgZm9yIG5vIHByb2ZpbGUpLiAqLworICAgICAgICBpbnQgZ2V0UHJvZmlsZSgpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBtUHJvZmlsZTsKKyAgICAgICAgfQorCisgICAgcHJpdmF0ZToKKyAgICAgICAgYXVkaW9fZW5jb2RlciBtQ29kZWM7CisgICAgICAgIGludCBtQml0UmF0ZTsKKyAgICAgICAgaW50IG1TYW1wbGVSYXRlOworICAgICAgICBpbnQgbUNoYW5uZWxzOworICAgICAgICBpbnQgbVByb2ZpbGU7CisgICAgICAgIGZyaWVuZCBjbGFzcyBNZWRpYVByb2ZpbGVzOworICAgIH07CisKKyAgICAvKioKKyAgICAgKiBDb25maWd1cmF0aW9uIGZvciBhIGNhbWNvcmRlciBwcm9maWxlL2VuY29kZXIgcHJvZmlsZXMgb2JqZWN0LgorICAgICAqLworICAgIHN0cnVjdCBDYW1jb3JkZXJQcm9maWxlIHsKKyAgICAgICAgLyoqCisgICAgICAgICAqICBSZXR1c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WxlKAorICAgICAgICAgICAgaW50IGNhbWVyYUlkLCBjYW1jb3JkZXJfcXVhbGl0eSBxdWFsaXR5KSBjb25zdDsKKworICAgIC8qKgogICAgICAqIFJldHVybnMgdGhlIHZhbHVlIGZvciB0aGUgZ2l2ZW4gcGFyYW0gbmFtZSBmb3IgdGhlIGdpdmVuIGNhbWVyYSBhdAogICAgICAqIHRoZSBnaXZlbiBxdWFsaXR5IGxldmVsLCBvciAtMSBpZiBlcnJvci4KICAgICAgKgpAQCAtMjAwLDg0ICszOTEsNiBAQAogICAgIE1lZGlhUHJvZmlsZXMoKSB7fSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBEdW1teSBkZWZhdWx0IGNvbnN0cnVjdG9yCiAgICAgfk1lZGlhUHJvZmlsZXMoKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIERvbid0IGRlbGV0ZSBtZQogCi0gICAgc3RydWN0IFZpZGVvQ29kZWMgewotICAgICAgICBWaWRlb0NvZGVjKHZpZGVvX2VuY29kZXIgY29kZWMsIGludCBiaXRSYXRlLCBpbnQgZnJhbWVXaWR0aCwgaW50IGZyYW1lSGVpZ2h0LCBpbnQgZnJhbWVSYXRlKQotICAgICAgICAgICAgOiBtQ29kZWMoY29kZWMpLAotICAgICAgICAgICAgICBtQml0UmF0ZShiaXRSYXRlKSwKLSAgICAgICAgICAgICAgbUZyYW1lV2lkdGgoZnJhbWVXaWR0aCksCi0gICAgICAgICAgICAgIG1GcmFtZUhlaWdodChmcmFtZUhlaWdodCksCi0gICAgICAgICAgICAgIG1GcmFtZVJhdGUoZnJhbWVSYXRlKSB7fQotCi0gICAgICAgIFZpZGVvQ29kZWMoY29uc3QgVmlkZW9Db2RlYyYgY29weSkgewotICAgICAgICAgICAgbUNvZGVjID0gY29weS5tQ29kZWM7Ci0gICAgICAgICAgICBtQml0UmF0ZSA9IGNvcHkubUJpdFJhdGU7Ci0gICAgICAgICAgICBtRnJhbWVXaWR0aCA9IGNvc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ICAgICAgZGllZCgpOwogICAgICAgICAgICAgdm9pZCAgICAgICAgICAgIGRpc2Nvbm5lY3QoKTsKQEAgLTIxOSw2ICsyMjUsNyBAQAogCiAgICAgICAgICAgICBzdGF0dXNfdCAgICAgICAgc2V0RGF0YVNvdXJjZShpbnQgZmQsIGludDY0X3Qgb2Zmc2V0LCBpbnQ2NF90IGxlbmd0aCk7CiAgICAgICAgICAgICBzdGF0dXNfdCAgICAgICAgc2V0RGF0YVNvdXJjZShjb25zdCBzcDxJRGF0YVNvdXJjZT4gJnNvdXJjZSk7CisgICAgICAgICAgICBzdGF0dXNfdCAgICAgICAgc2V0RGF0YVNvdXJjZShjb25zdCBTdHJpbmc4JiBydHBQYXJhbXMpOwogICAgICAgICAgICAgc3RhdHVzX3QgICAgICAgIHNldFZpZGVvU3VyZmFjZVRleHR1cmUoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxJR3JhcGhpY0J1ZmZlclByb2R1Y2VyPiYgYnVmZmVyUHJvZHVjZXIpOwogICAgICAgICAgICAgc3RhdHVzX3QgICAgICAgIHNldExpc3RlbmVyKGNvbnN0IHNwPE1lZGlhUGxheWVyTGlzdGVuZXI+JiBsaXN0ZW5lcik7CkBAIC0zMTAsNyArMzE3LDcgQEAKICAgICBmbG9hdCAgICAgICAgICAgICAgICAgICAgICAgbVNlbmRMZXZlbDsKICAgICBzdHJ1Y3Qgc29ja2FkZHJfaW4gICAgICAgICAgbVJldHJhbnNtaXRFbmRwb2ludDsKICAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgbVJldHJhbnNtaXRFbmRwb2ludFZhbGlkOwotICAgIGNvbnN0IHN0ZDo6c3RyaW5nICAgICAgICAgICBtT3BQYWNrYWdlTmFtZTsKKyAgICBjb25zdCBhbmRyb2lkOjpjb250ZW50OjpBdHRyaWJ1dGlvblNvdXJjZVN0YXRlIG1BdHRyaWJ1dGlvblNvdXJjZTsKIH07CiAKIH07IC8vIG5hbWVz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AgICAgICAgICAgICBwbGF5ZXIuY2xlYXIoKTsKQEAgLTE5NSw2ICsxOTcsMjIgQEAKICAgICByZXR1cm4gZXJyOwogfQogCitzdGF0dXNfdCBNZWRpYVBsYXllcjo6c2V0RGF0YVNvdXJjZShjb25zdCBTdHJpbmc4JiBydHBQYXJhbXMpCit7CisgICAgQUxPR1YoInNldERhdGFTb3VyY2UocnRwUGFyYW1zKSIpOworICAgIHN0YXR1c190IGVyciA9IFVOS05PV05fRVJST1I7CisgICAgY29uc3Qgc3A8SU1lZGlhUGxheWVyU2VydmljZT4gc2VydmljZShnZXRNZWRpYVBsYXllclNlcnZpY2UoKSk7CisgICAgaWYgKHNlcnZpY2UgIT0gMCkgeworICAgICAgICBzcDxJTWVkaWFQbGF5ZXI+IHBsYXllcihzZXJ2aWNlLT5jcmVhdGUodGhpcywgbUF1ZGlvU2Vzc2lvbklkLCBtQXR0cmlidXRpb25Tb3VyY2UpKTsKKyAgICAgICAgaWYgKChOT19FUlJPUiAhPSBkb1NldFJldHJhbnNtaXRFbmRwb2ludChwbGF5ZXIpKSB8fAorICAgICAgICAgICAgKE5PX0VSUk9SICE9IHBsYXllci0+c2V0RGF0YVNvdXJjZShydHBQYXJhbXMpKSkgeworICAgICAgICAgICAgcGxheWVyLmNsZWFyKCk7CisgICAgICAgIH0KKyAgICAgICAgZXJyID0gYXR0YWNoTmV3UGxheWVyKHBsYXllcik7CisgICAgfQorICAgIHJldHVybiBlcnI7Cit9CisKIHN0YXR1c190IE1lZGlhUGxheWVyOjppbnZva2UoY29uc3QgUGFyY2VsJiByZXF1ZXN0LCBQYXJjZWwgKnJlcGx5KQogewogICAgIE11dGV4OjpBdXRvbG9jayBfbChtTG9jayk7CkBAIC05NDMsNiArOTYxLDkgQEAKICAgICBjYXNlIE1FRElBX01FVEFfREFUQToKICAgICAgICAgQUxPR1YoIlJlY2VpdmVkIHRpbWVkIG1ldGFkYXRhIG1lc3NhZ2UiKTsKICAgICAgICAgYnJlYWs7CisgICA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XBhYmlsaXRpZXMtPmdldFN1cHBvcnRlZFByb2ZpbGVMZXZlbHMoJnByb2ZpbGVMZXZlbHMpOworICAgICAgICAgICAgaWYgKCFwcm9maWxlTGV2ZWxzLmVtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBBTE9HVigic3VwcG9ydGVkIHByb2ZpbGVsZXZlbCBmb3IgbWVkaWEgdHlwZTogJXMiLCBtZWRpYVR5cGUuY19zdHIoKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmb3IgKGF1dG8gcHJvZmlsZUxldmVsIDogcHJvZmlsZUxldmVscykgeworICAgICAgICAgICAgICAgIEFMT0dWKCJwcm9maWxlOiAlZCwgbGV2ZWw6ICVkIiwgcHJvZmlsZUxldmVsLm1Qcm9maWxlLCBwcm9maWxlTGV2ZWwubUxldmVsKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3A8QU1lc3NhZ2U+IGRldGFpbHMgPSBjYXBhYmlsaXRpZXMtPmdldERldGFpbHMoKTsKKyAgICAgICAgICAgIEFTU0VSVF9ORShkZXRhaWxzLCBudWxscHRyKSA8PCAiRGV0YWlscyBpbiBjb2RlYyBjYXBhYmlsaXRpZXMgaXMgbnVsbCI7CisgICAgICAgICAgICBBTE9HVigibm8uIG9mIGVudHJpZXMgaW4gZGV0YWlsczogJXp1IiwgZGV0YWlscy0+Y291bnRFbnRyaWVzKCkpOworCisgICAgICAgICAgICBmb3IgKHNpemVfdCBpZHhEZXRhaWwgPSAwOyBpZHhEZXRhaWwgPCBkZXRhaWxzLT5jb3VudEVudHJpZXMoKTsgaWR4RGV0YWlsKyspIHsKKyAgICAgICAgICAgICAgICBBTWVzc2FnZTo6VHlwZSB0eXBlOworICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIgKm5hbWUgPSBkZXRhaWxzLT5nZXRFbnRyeU5hbWVBdChpZHhEZXRhaWwsICZ0eXBlKTsKKyAgICAgICAgICAgICAgICBBTE9HVigiZGV0YWlscyBlbnRyeSBuYW1lOiAlcyIsIG5hbWUpOworICAgICAgICAgICAgICAgIEFNZXNzYWdlOjpJdGVtRGF0YSBpdGVtRGF0YSA9IGRldGFpbHMtPmdldEVudHJ5QXQoaWR4RGV0YWlsKTsKKyAgICAgICAgICAgICAgICBzd2l0Y2ggKHR5cGUpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBBTWVzc2FnZTo6a1R5cGVJbnQzMjoKKyAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgdmFsMzI7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbURhdGEuZmluZCgmdmFsMzIpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoImVudHJ5IGludCB2YWw6ICVkIiwgdmFsMzIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1dG8gc2VhcmNoQXR0ciA9IGF0dHJpYnV0ZU1hcC5maW5kKG5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWFyY2hBdHRyID09IGF0dHJpYnV0ZU1hcC5lbmQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVygiUGFyc2VyIGRvZXNuJ3QgaGF2ZSBrZXk6ICVzIiwgbmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdG9pKHNlYXJjaEF0dHItPnNlY29uZCkgIT0gdmFsMzIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coIlZhbHVlcyBkaWRuJ3QgbWF0Y2ggZm9yIGtleTogJXMiLCBuYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlZhbHVlcyBhY3QvZXhwOiAlZCAvICVkIiwgdmFsMzIsIHN0b2koc2VhcmNoQXR0ci0+c2Vjb25kKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgQU1lc3NhZ2U6OmtUeXBlU3RyaW5nOgorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFTdHJpbmcgdmFsU3RyOyBpdGVtRGF0YS5maW5kKCZ2YWxTdHIpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoImVudHJ5IHN0ciB2YWw6ICVzIiwgdmFsU3RyLmNfc3RyKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1dG8gc2VhcmNoQXR0ciA9IGF0dHJpYnV0ZU1hcC5maW5kKG5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWFyY2hBdHRyID09IGF0dHJpYnV0ZU1hcC5lbmQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVygiUGFyc2VyIGRvZXNuJ3QgaGF2ZSBrZXk6ICVzIiwgbmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzZWFyY2hBdHRyLT5zZWNvbmQgIT0gdmFsU3RyLmNfc3RyKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coIlZhbHVlcyBkaWRuJ3QgbWF0Y2ggZm9yIGtleTogJXMiLCBuYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlZhbHVlcyBhY3QvZXhwOiAlcyAvICVzIiwgdmFsU3RyLmNfc3RyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlYXJjaEF0dHItPnNlY29uZC5jX3N0cigpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgIC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IuaD4KKyNpbmNsdWRlIDxtZWRpYS9NZXRhZGF0YS5oPgorI2luY2x1ZGUgPGJpbmRlci9QYXJjZWwuaD4KKwordXNpbmcgbmFtZXNwYWNlIGFuZHJvaWQ7Cit1c2luZyBuYW1lc3BhY2UgbWVkaWE7CisKK3N0YXRpYyBjb25zdCBmbG9hdCB3YW50X3Byb2IgPSAwLjU7CisKK2Jvb2wgYnl0ZXNSZW1haW4oRnV6emVkRGF0YVByb3ZpZGVyICpmZHApOworCitleHRlcm4gIkMiIGludCBMTFZNRnV6emVyVGVzdE9uZUlucHV0KGNvbnN0IHVpbnQ4X3QgKmRhdGEsIHNpemVfdCBzaXplKSB7CisgICAgRnV6emVkRGF0YVByb3ZpZGVyIGZkcChkYXRhLCBzaXplKTsKKyAgICBQYXJjZWwgcDsKKyAgICBNZXRhZGF0YSBtZCA9IE1ldGFkYXRhKCZwKTsKKworICAgIG1kLmFwcGVuZEhlYWRlcigpOworICAgIHdoaWxlIChieXRlc1JlbWFpbigmZmRwKSkgeworCisgICAgICAgIGZsb2F0IGdvdF9wcm9iID0gZmRwLkNvbnN1bWVQcm9iYWJpbGl0eTxmbG9hdD4oKTsKKyAgICAgICAgaWYgKCFieXRlc1JlbWFpbigmZmRwKSkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBpZiAoZ290X3Byb2IgPCB3YW50X3Byb2IpIHsKKyAgICAgICAgICAgIGludDMyX3Qga2V5X2Jvb2wgPSBmZHAuQ29uc3VtZUludGVncmFsPGludDMyX3Q+KCk7CisgICAgICAgICAgICBpZiAoIWJ5dGVzUmVtYWluKCZmZHApKSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBib29sIHZhbF9ib29sID0gZmRwLkNvbnN1bWVCb29sKCk7CisgICAgICAgICAgICBtZC5hcHBlbmRCb29sKGtleV9ib29sLCB2YWxfYm9vbCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpbnQzMl90IGtleV9pbnQzMiA9IGZkcC5Db25zdW1lSW50ZWdyYWw8aW50MzJfdD4oKTsKKyAgICAgICAgICAgIGlmICghYnl0ZXNSZW1haW4oJmZkcCkpIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJvb2wgdmFsX2ludDMyID0gZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQzMl90PigpOworICAgICAgICAgICAgbWQuYXBwZW5kSW50MzIoa2V5X2ludDMyLCB2YWxfaW50MzIpOworICAgICAgICB9CisgICAgICAgIG1kLnVwZGF0ZUxlbmd0aCgpOworICAgIH0KKyAgICBtZC5yZXNldFBhcmNlbCgpOworICAgIHJldHVybiAwOworfQorCitib29sIGJ5dGVzUmVtYWluKEZ1enplZERhdGFQcm92aWRlciAqZmRwKXsKKyAgICByZXR1cm4gZmRwIC0+IHJlbWFpbmluZ19ieXRlcygpID4gMDsKK30KXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBmaWxlCmRpZmYgLS1naXQgYS9tZWRpYS9saWJtZWRpYS90ZXN0cy9tZWRpYXBsYXllci9BbmRyb2lkLmJwIGIvbWVkaWEvbGlibWVkaWEvdGVzdHMvbWVkaWFwbGF5ZXIvQW5kcm9pZC5icApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi41MGYzNWVhCi0tLSAvZGV2L251bGwKKysrIGIvbWVkaWEvbGlibWVkaWEvdGVzdHMvbWVkaWFwbGF5ZXIvQW5kcm9pZC5icApAQCAtMCwwICsxLDQ5IEBACisvKgorICogQ29weXJpZ2h0IDIwMjEgVGhlIEFuZHJvaWQgT3BlbiBTb3VyY2UgUHJvamVjdAorICoKKyAqIExpY2Vuc2VkIHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAgKHRoZSAiTGljZW5zZSIpOworICogeW91IG1heSBub3QgdXNlIHRoaXMgZmlsZSBleGN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lbnRpZmllci1BcGFjaGUtMi4wCisgICAgZGVmYXVsdF9hcHBsaWNhYmxlX2xpY2Vuc2VzOiBbImZyYW1ld29ya3NfYXZfbGljZW5zZSJdLAorfQorCitjY19saWJyYXJ5X2hlYWRlcnMgeworICAgIG5hbWU6ICJsaWJtZWRpYWZvcm1hdHNoYXBlcl9oZWFkZXJzIiwKKyAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUiXSwKKyAgICBhcGV4X2F2YWlsYWJsZTogWworICAgICAgICAiLy9hcGV4X2F2YWlsYWJsZTpwbGF0Zm9ybSIsCisgICAgICAgICJjb20uYW5kcm9pZC5tZWRpYSIsCisgICAgXSwKKyAgICBtaW5fc2RrX3ZlcnNpb246ICIyOSIsCisgICAgaG9zdF9zdXBwb3J0ZWQ6IHRydWUsCisgICAgdGFyZ2V0OiB7CisgICAgICAgIGRhcndpbjogeworICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsCisgICAgICAgIH0sCisgICAgfSwKK30KKworY2NfZGVmYXVsdHMgeworICAgIG5hbWU6ICJsaWJtZWRpYWZvcm1hdHNoYXBlcl9kZWZhdWx0cyIsCisgICAgc3JjczogWworICAgICAgICAiQ29kZWNQcm9wZXJ0aWVzLmNwcCIsCisgICAgICAgICJDb2RlY1NlZWRpbmcuY3BwIiwKKyAgICAgICAgIkZvcm1hdFNoYXBlci5jcHAiLAorICAgICAgICAiTWFuYWdlU2hhcGluZ0NvZGVjcy5jcHAiLAorICAgICAgICAiVmlkZW9TaGFwZXIuY3BwIiwKKyAgICAgICAgIlZRQXBwbHkuY3BwIiwKKyAgICBdLAorCisgICAgbG9jYWxfaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJpbmNsdWRlIiwKKyAgICBdLAorCisgICAgaGVhZGVyX2xpYnM6IFsKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2hlYWRlcnMiLAorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGlibG9nIiwKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV2Vycm9yIiwKKyAgICAgICAgIi1XYWxsIiwKKyAgICAgICAgIi1mdmlzaWJpbGl0eT1oaWRkZW4iLAorICAgICAgICAiLVd0aHJlYWQtc2FmZXR5IiwgICAgICAgICAgICAgICAgICAgICAgLy8gZW5hYmxlcyBHVUFSREVEX0JZKCkKKyAgICBdLAorCisgICAgdGFyZ2V0OiB7CisgICAgICAgIGFuZHJvaWQ6IHsKKyAgICAgICAgICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICAgICAgICAgImxpYm1lZGlhbmRrIzI5IiwKKyAgICAgICAgICAgIF0sCisgICAgICAgIH0sCisgICAgfSwKKworICAgIHNhbml0aXplOiB7CisgICAgICAgIGNmaTogdHJ1ZSwKKyAgICAgICAgbWlzY191bmRlZmluZWQ6IFsKKyAgICAgICAgICAgICJ1bnNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgICAgICJzaWduZWQtaW50ZWdlci1vdmVyZmxvdyIsCisgICAgICAgIF0sCisgICAgfSwKK30KKworY2NfbGlicmFyeSB7CisgICAgbmFtZTogImxpYm1lZGlhZm9ybWF0c2hhcGVyIiwKKyAgICBkZWZhdWx0czogWyJsaWJtZWRpYWZvcm1hdHNoYXBlcl9kZWZhdWx0cyJdLAorCisgICAgbWluX3Nka192ZXJzaW9uOiAiMjkiLAorCisgICAgYXBleF9hdmFpbGFibGU6IFsKKyAgICAgICAgIi8vYXBleF9hdmFpbGFibGU6cGxhdGZvcm0iLAorICAgICAgICAiY29tLmFuZHJvaWQubWVkaWEiLAorICAgIF0sCisKKyAgICB2ZXJzaW9uX3NjcmlwdDogImV4cG9ydHMubGRzIiwKKworfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGlibWVkaWFmb3JtYXRzaGFwZXIvQ29kZWNQcm9wZXJ0aWVzLmNwcCBiL21lZGlhL2xpYm1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V5LCBzdGQ6OnN0cmluZyB2YWx1ZSkgeworICAgIEFMT0dEKCJzZXRUdW5pbmdWYWx1ZSglcywlcykiLCBrZXkuY19zdHIoKSwgdmFsdWUuY19zdHIoKSk7CisgICAgbVR1bmluZ3MuaW5zZXJ0KHtrZXksIHZhbHVlfSk7CisKKyAgICBib29sIGxlZ2FsID0gZmFsc2U7CisgICAgLy8gTkI6IG9sZCBzY2hvb2wgc3RydG9sKCkgYmVjYXVzZSBzdGQ6OnN0b2koKSB0aHJvd3MgZXhjZXB0aW9ucworICAgIGlmICghc3RyY21wKGtleS5jX3N0cigpLCAidnEtdGFyZ2V0LXFwbWF4IikpIHsKKyAgICAgICAgY29uc3QgY2hhciAqcCA9IHZhbHVlLmNfc3RyKCk7CisgICAgICAgIGNoYXIgKnE7CisgICAgICAgIGludDMyX3QgaVZhbHVlID0gIHN0cnRvbChwLCAmcSwgMCk7CisgICAgICAgIGlmIChxICE9IHApIHsKKyAgICAgICAgICAgIHNldFRhcmdldFFwTWF4KGlWYWx1ZSk7CisgICAgICAgICAgICBsZWdhbCA9IHRydWU7CisgICAgICAgIH0KKyAgICB9IGVsc2UgaWYgKCFzdHJuY21wKGtleS5jX3N0cigpLCAidnEtdGFyZ2V0LXFwbWF4LSIsIHN0cmxlbigidnEtdGFyZ2V0LXFwbWF4LSIpKSkgeworICAgICAgICAgICAgc3RkOjpzdHJpbmcgcmVzb2x1dGlvbiA9IGtleS5zdWJzdHIoc3RybGVuKCJ2cS10YXJnZXQtcXBtYXgtIikpOworICAgICAgICAgICAgaWYgKHFwTWF4UG9pbnQocmVzb2x1dGlvbiwgdmFsdWUpKSB7CisgICAgICAgICAgICAgICAgbGVnYWwgPSB0cnVlOworICAgICAgICAgICAgfQorICAgIH0gZWxzZSBpZiAoIXN0cmNtcChrZXkuY19zdHIoKSwgInZxLXRhcmdldC1icHAiKSkgeworICAgICAgICBjb25zdCBjaGFyICpwID0gdmFsdWUuY19zdHIoKTsKKyAgICAgICAgY2hhciAqcTsKKyAgICAgICAgZG91YmxlIGJwcCA9IHN0cnRvZChwLCAmcSk7CisgICAgICAgIGlmIChxICE9IHApIHsKKyAgICAgICAgICAgIHNldEJwcChicHApOworICAgICAgICAgICAgbGVnYWwgPSB0cnVlOworICAgICAgICB9CisgICAgfSBlbHNlIGlmICghc3RybmNtcChrZXkuY19zdHIoKSwgInZxLXRhcmdldC1icHAtIiwgc3RybGVuKCJ2cS10YXJnZXQtYnBwLSIpKSkgeworICAgICAgICAgICAgc3RkOjpzdHJpbmcgcmVzb2x1dGlvbiA9IGtleS5zdWJzdHIoc3RybGVuKCJ2cS10YXJnZXQtYnBwLSIpKTsKKyAgICAgICAgICAgIGlmIChicHBQb2ludChyZXNvbHV0aW9uLCB2YWx1ZSkpIHsKKyAgICAgICAgICAgICAgICBsZWdhbCA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgfSBlbHNlIGlmICghc3RyY21wKGtleS5jX3N0cigpLCAidnEtdGFyZ2V0LWJwcHgxMDAiKSkgeworICAgICAgICAvLyBsZWdhY3ksIHByb3RvdHlwaW5nCisgICAgICAgIGNvbnN0IGNoYXIgKnAgPSB2YWx1ZS5jX3N0cigpOworICAgICAgICBjaGFyICpxOworICAgICAgICBpbnQzMl90IGlWYWx1ZSA9ICBzdHJ0b2wocCwgJnEsIDApOworICAgICAgICBpZiAocSAhPSBwKSB7CisgICAgICAgICAgICBkb3VibGUgYnBwID0gaVZhbHVlIC8gMTAwLjA7CisgICAgICAgICAgICBzZXRCcHAoYnBwKTsKKyAgICAgICAgICAgIGxlZ2FsID0gdHJ1ZTsKKyAgICAgICAgfQorICAgIH0gZWxzZSBpZiAoIXN0cmNtcChrZXkuY19zdHIoKSwgInZxLWJpdHJhdGUtcGhhc2VvdXQiKSkgeworICAgICAgICBjb25zdCBjaGFyICpwID0gdmFsdWUuY19zdHIoKTsKKyAgICAgICAgY2hhciAqcTsKKyAgICAgICAgZG91YmxlIHBoYXNlb3V0ID0gc3RydG9kKHAsICZxKTsKKyAgICAgICAgaWYgKHEgIT0gcCkgeworICAgICAgICAgICAgc2V0UGhhc2VPdXQocGhhc2VvdXQpOworICAgICAgICAgICAgbGVnYWwgPSB0cnVlOworICAgICAgICB9CisgICAgfSBlbHNlIGlmICghc3RyY21wKGtleS5jX3N0cigpLCAidnEtYm9vc3QtbWlzc2luZy1xcCIpKSB7CisgICAgICAgIGNvbnN0IGNoYXIgKnAgPSB2YWx1ZS5jX3N0cigpOworICAgICAgICBjaGFyICpxOworICAgICAgICBkb3VibGUgYm9vc3QgPSBzdHJ0b2QocCwgJnEpOworICAgICAgICBpZiAocSAhPSBwKSB7CisgICAgICAgICAgICBzZXRNaXNzaW5nUXBCb29zdChib29zdCk7CisgICAgICAgICAgICBsZWdhbCA9IHRydWU7CisgICAgICAgIH0KKyAgICB9IGVsc2UgeworICAgICAgICBsZWdhbCA9IHRydWU7CisgICAgfQorCisgICAgaWYgKCFsZWdhbCkgeworICAgICAgICBBTE9HVygic2V0VHVuaW5nVmFsdWUoKSB1bmFibGUgdG8gYXBwbHkgdHVuaW5nICclcycgd2l0aCB2YWx1ZSAnJXMnIiwKKyAgICAgICAgICAgICAga2V5LmNfc3RyKCksIHZhbHVlLmNfc3RyKCkpOworICAgIH0KKyAgICByZXR1cm47Cit9CisKK2Jvb2wgQ29kZWNQcm9wZXJ0aWVzOjpnZXRUdW5pbmdWYWx1ZShzdGQ6OnN0cmluZyBrZXksIHN0ZDo6c3RyaW5nICZ2YWx1ZSkgeworICAgIEFMT0dWKCJnZXRUdW5pbmdWYWx1ZSglcykiLCBrZXkuY19zdHIoKSk7CisgICAgYXV0byBtYXBwZWQgPSBtRmVhdHVyZXMuZmluZChrZXkpOworICAgIGlmIChtYXBwZWQgIT0gbUZlYXR1cmVzLmVuZCgpKSB7CisgICAgICAgIHZhbHVlID0gbWFwcGVkLT5zZWNvbmQ7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKyAgICByZXR1cm4gZmFsc2U7Cit9CisKK2Jvb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9IHJlc29sdXRpb24uc3Vic3RyKDAsIHNlcCk7CisgICAgICAgIHN0ZDo6c3RyaW5nIGggPSByZXNvbHV0aW9uLnN1YnN0cihzZXArMSk7CisKKyAgICAgICAgY2hhciAqcTsKKyAgICAgICAgY29uc3QgY2hhciAqcCA9IHcuY19zdHIoKTsKKyAgICAgICAgd2lkdGggPSBzdHJ0b2wocCwgJnEsIDApOworICAgICAgICBpZiAocSA9PSBwKSB7CisgICAgICAgICAgICAgICAgd2lkdGggPSAtMTsKKyAgICAgICAgfQorICAgICAgICBwID0gaC5jX3N0cigpOworICAgICAgICBoZWlnaHQgPSBzdHJ0b2wocCwgJnEsIDApOworICAgICAgICBpZiAocSA9PSBwKSB7CisgICAgICAgICAgICAgICAgaGVpZ2h0ID0gLTE7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHdpZHRoIDw9IDAgfHwgaGVpZ2h0IDw9IDAgfHwgd2lkdGggPiBESU1FTlNJT05fTElNSVQgfHwgaGVpZ2h0ID4gRElNRU5TSU9OX0xJTUlUKSB7CisgICAgICAgICAgICBBTE9HVygidW5wYXJzZWFibGU6IHdpZHRoLCBoZWlnaHQgJyVzJyIsIHJlc29sdXRpb24uY19zdHIoKSk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjb25zdCBjaGFyICpwID0gdmFsdWUuY19zdHIoKTsKKyAgICBjaGFyICpxOworICAgIGJwcCA9IHN0cnRvZChwLCAmcSk7CisgICAgaWYgKHEgPT0gcCkgeworICAgICAgICBBTE9HVygidW5wYXJzZWFibGUgYnBwICclcyciLCB2YWx1ZS5jX3N0cigpKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHN0cnVjdCBicHBfcG9pbnQgKnBvaW50ID0gKHN0cnVjdCBicHBfcG9pbnQqKSBtYWxsb2Moc2l6ZW9mKCpwb2ludCkpOworICAgIGlmIChwb2ludCA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dXKCJ1bmFibGUgdG8gYWxsb2NhdGUgbWVtb3J5IGZvciBicHAgcG9pbnQiKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHBvaW50LT5waXhlbHMgPSB3aWR0aCAqIGhlaWdodDsKKyAgICBwb2ludC0+d2lkdGggPSB3aWR0aDsKKyAgICBwb2ludC0+aGVpZ2h0ID0gaGVpZ2h0OworICAgIHBvaW50LT5icHAgPSBicHA7CisKKyAgICBpZiAobUJwcFBvaW50cyA9PSBudWxscHRyKSB7CisgICAgICAgIHBvaW50LT5uZXh0ID0gbnVsbHB0cjsKKyAgICAgICAgbUJwcFBvaW50cyA9IHBvaW50OworICAgIH0gZWxzZSBpZiAocG9pbnQtPnBpeGVscyA8IG1CcHBQb2ludHMtPnBpeGVscykgeworICAgICAgICAvLyBhdCB0aGUgZnJvbnQKKyAgICAgICAgcG9pbnQtPm5leHQgPSBtQnBwUG9pbnRzOworICAgICAgICBtQnBwUG9pbnRzID0gcG9pbnQ7CisgICAgfSBlbHNlIHsKKyAgICAgICAgc3RydWN0IGJwcF9wb2ludCAqYWZ0ZXIgPSBtQnBwUG9pbnRzOworICAgICAgICB3aGlsZSAoYWZ0ZXItPm5leHQpIHsKKyAgICAgICAgICAgIGlmIChwb2ludC0+cGl4ZWxzID4gYWZ0ZXItPm5leHQtPnBpeGVscykgeworICAgICAgICAgICAgICAgIGFmdGVyID0gYWZ0ZXItPm5leHQ7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIGluc2VydCBiZWZvcmUgYWZ0ZXItPm5leHQKKyAgICAgICAgICAgIHBvaW50LT5uZXh0ID0gYWZ0ZXItPm5leHQ7CisgICAgICAgICAgICBhZnRlci0+bmV4dCA9IHBvaW50OworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGFmdGVyLT5uZXh0ID09IG51bGxwdHIpIHsKKyAgICAgICAgICAgIC8vIGhhc24ndCBnb25lIGluIHlldAorICAgICAgICAgICAgcG9pbnQtPm5leHQgPSBudWxscHRyOworICAgICAgICAgICAgYWZ0ZXItPm5leHQgPSBwb2ludDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHJldHVybiB0cnVlOworfQorCitkb3VibGUgQ29kZWNQcm9wZXJ0aWVzOjpnZXRCcHAoaW50MzJfdCB3aWR0aCwgaW50MzJfdCBoZWlnaHQpIHsKKyAgICAvLyBsb29rIGluIHRoZSBwZXItcmVzb2x1dGlvbiBsaXN0CisKKyAgICBpbnQzMl90IHBpeGVscyA9IHdpZHRoICogaGVpZ2h0OworCisgICAgaWYgKG1CcHBQb2ludHMpIHsKKyAgICAgICAgc3RydWN0IGJwcF9wb2ludCAqcG9pbnQgPSBtQnBwUG9pbnRzOworICAgICAgICB3aGlsZSAocG9pbnQgJiYgcG9pbnQtPnBpeGVscyA8IHBpeGVscykgeworICAgICAgICAgICAgcG9pbnQgPSBwb2ludC0+bmV4dDsKKyAgICAgICAgfQorICAgICAgICBpZiAocG9pbnQpIHsKKyAgICAgICAgICAgIEFMT0dWKCJnZXRCcHAodz0lZCxoPSVkKSByZXR1cm5zICVmIGZyb20gYnBwcG9pbnQgdz0lZCBoPSVkIiwKKyAgICAgICAgICAgICAgICB3aWR0aCwgaGVpZ2h0LCBwb2ludC0+YnBwLCBwb2ludC0+d2lkdGgsIHBvaW50LT5oZWlnaHQpOworICAgICAgICAgICAgcmV0dXJuIHBvaW50LT5icHA7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBBTE9HVigiZGVmYXVsdGluZyB0byAlZiBicHAiLCBtQnBwKTsKKyAgICByZXR1cm4gbUJwcDsKK30KKworYm9vbCBDb2RlY1Byb3BlcnRpZXM6OnFwTWF4UG9pbnQoc3RkOjpzdHJpbmcgcmVzb2x1dGlvbiwgc3RkOjpzdHJpbmcgdmFsdWUpIHsKKworICAgIGludDMyX3Qgd2lkdGggPSAwOworICAgIGludDMyX3QgaGVpZ2h0ID0gMDsKKyAgICBpbnQgcXBNYXggPSBJTlQzMl9NQVg7CisKKyAgICAvLyByZXNvbHV0aW9uIGlzICJXeEgiLCAiVypIIiBvciBhIHN0YW5kYXJkIG5hbWUgbGlrZSAiNzIwcCIKKyAgICBpZiAocmVzb2x1dGlvbiA9PSAiMTA4MHAiKSB7CisgICAgICAgIHdpZHRoID0gMTA4MDsgaGVpZ2h0ID0gMTkyMDsKKyAgICB9IGVsc2UgaWYgKHJlc29sdXRpb24gPT0gIjcyMHAiKSB7CisgICAgICAgIHdpZHRoID0gNzIwOyBoZWlnaHQgPSAxMjgwOworICAgIH0gZWxzZSBpZiAocmVzb2x1dGlvbiA9PSAiNTQwcCIpIHsKKyAgICAgICAgd2lkdGggPSA1NDA7IGhlaWdodCA9IDk2MDsKKyAgICB9IGVsc2UgaWYgKHJlc29sdXRpb24gPT0gIjQ4MHAiKSB7CisgICAgICAgIHdpZHRoID0gNDgwOyBoZWlnaHQgPSA4NTQ7CisgICAgfSBlbHNlIHsKKyAgICAgICAgc2l6ZV90IHNlcCA9IHJlc29sdXRpb24uZmluZCgneCcpOworICAgICAgICBpZiAoc2VwID09IHN0ZDo6c3RyaW5nOjpucG9zKSB7CisgICAgICAgICAgICBzZXAgPSByZXNvbHV0aW9uLmZpbmQoJyonKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoc2VwID09IHN0ZDo6c3RyaW5nOjpucG9zKSB7CisgICAgICAgICAgICBBTE9HVygidW5hYmxlIHRvIHBhcnNlIHJlc29sdXRpb246ICclcyciLCByZXNvbHV0aW9uLmNfc3RyKCkpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIHN0ZDo6c3RyaW5nIHcgPSByZXNvbHV0aW9uLnN1YnN0cigwLCBzZXApOworICAgICAgICBzdGQ6OnN0cmluZyBoID0gcmVzb2x1dGlvbi5zdWJzdHIoc2VwKzEpOworCisgICAgICAgIGNoYXIgKnE7CisgICAgICAgIGNvbnN0IGNoYXIgKnAgPSB3LmNfc3RyKCk7CisgICAgICAgIHdpZHRoID0gc3RydG9sKHAsICZxLCAwKTsKKyAgICAgICAgaWYgKHEgPT0gcCkgeworICAgICAgICAgICAgICAgIHdpZHRoID0gLTE7CisgICAgICAgIH0KKyAgICAgICAgcCA9IGguY19zdHIoKTsKKyAgICAgICAgaGVpZ2h0ID0gc3RydG9sKHAsICZxLCAwKTsKKyAgICAgICAgaWYgKHEgPT0gcCkgeworICAgICAgICAgICAgICAgIGhlaWdodCA9IC0xOworICAgICAgICB9CisgICAgICAgIGlmICh3aWR0aCA8PSAwIHx8IGhlaWdodCA8PSAwIHx8IHdpZHRoID4gRElNRU5TSU9OX0xJTUlUIHx8IGhlaWdodCA+IERJTUVOU0lPTl9MSU1JVCkgeworICAgICAgICAgICAgQUxPR1coInVucGFyc2VhYmxlOiB3aWR0aCwgaGVpZ2h0ICclcyciLCByZXNvbHV0aW9uLmNfc3RyKCkpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgY29uc3QgY2hhciAqcCA9IHZhbHVlLmNfc3RyKCk7CisgICAgY2hhciAqcTsKKyAgICBxcE1heCA9IHN0cnRvbChwLCAmcSwgMCk7CisgICAgaWYgKHEgPT0gcCkgeworICAgICAgICBBTE9HVygidW5wYXJzZWFibGUgcXBtYXggJyVzJyIsIHZhbHVlLmNfc3RyKCkpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLy8gY29udmVydCB0byBvdXIgaW50ZXJuYWwgJ3Vuc3BlY2lmaWVkJyBub3RhdGlvbgorICAgIGlmIChxcE1heCA9PSAtMSkKKyAgICAgICAgcXBNYXggPSBJTlQzMl9NQVg7CisKKyAgICBzdHJ1Y3QgcXBtYXhfcG9pbnQgKnBvaW50ID0gKHN0cnVjdCBxcG1heF9wb2ludCopIG1hbGxvYyhzaXplb2YoKnBvaW50KSk7CisgICAgaWYgKHBvaW50ID09IG51bGxwdHIpIHsKKyAgICAgICAgQUxPR1coInVuYWJsZSB0byBhbGxvY2F0ZSBtZW1vcnkgZm9yIHFwbWF4IHBvaW50Iik7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBwb2ludC0+cGl4ZWxzID0gd2lkdGggKiBoZWlnaHQ7CisgICAgcG9pbnQtPndpZHRoID0gd2lkdGg7CisgICAgcG9pbnQtPmhlaWdodCA9IGhlaWdodDsKKyAgICBwb2ludC0+cXBNYXggPSBxcE1heDsKKworICAgIGlmIChtUXBNYXhQb2ludHMgPT0gbnVsbHB0cikgeworICAgICAgICBwb2ludC0+bmV4dCA9IG51bGxwdHI7CisgICAgICAgIG1RcE1heFBvaW50cyA9IHBvaW50OworICAgIH0gZWxzZSBpZiAocG9pbnQtPnBpeGVscyA8IG1RcE1heFBvaW50cy0+cGl4ZWxzKSB7CisgICAgICAgIC8vIGF0IHRoZSBmcm9udAorICAgICAgICBwb2ludC0+bmV4dCA9IG1RcE1heFBvaW50czsKKyAgICAgICAgbVFwTWF4UG9pbnRzID0gcG9pbnQ7CisgICAgfSBlbHNlIHsKKyAgICAgICAgc3RydWN0IHFwbWF4X3BvaW50ICphZnRlciA9IG1RcE1heFBvaW50czsKKyAgICAgICAgd2hpbGUgKGFmdGVyLT5uZXh0KSB7CisgICAgICAgICAgICBpZiAocG9pbnQtPnBpeGVscyA+IGFmdGVyLT5uZXh0LT5waXhlbHMpIHsKKyAgICAgICAgICAgICAgICBhZnRlciA9IGFmdGVyLT5uZXh0OworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBpbnNlcnQgYmVmb3JlIGFmdGVyLT5uZXh0CisgICAgICAgICAgICBwb2ludC0+bmV4dCA9IGFmdGVyLT5uZXh0OworICAgICAgICAgICAgYWZ0ZXItPm5leHQgPSBwb2ludDsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGlmIChhZnRlci0+bmV4dCA9PSBudWxscHRyKSB7CisgICAgICAgICAgICAvLyBoYXNuJ3QgZ29uZSBpbiB5ZXQKKyAgICAgICAgICAgIHBvaW50LT5uZXh0ID0gbnVsbHB0cjsKKyAgICAgICAgICAgIGFmdGVyLT5uZXh0ID0gcG9pbnQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gdHJ1ZTsKK30KKworaW50IENvZGVjUHJvcGVydGllczo6dGFyZ2V0UXBNYXgoaW50MzJfdCB3aWR0aCwgaW50MzJfdCBoZWlnaHQpIHsKKyAgICAvLyBsb29rIGluIHRoZSBwZXItcmVzb2x1dGlvbiBsaXN0CisKKyAgICBpbnQzMl90IHBpeGVscyA9IHdpZHRoICogaGVpZ2h0OworCisgICAgaWYgKG1RcE1heFBvaW50cykgeworICAgICAgICBzdHJ1Y3QgcXBtYXhfcG9pbnQgKnBvaW50ID0gbVFwTWF4UG9pbnRzOworICAgICAgICB3aGlsZSAocG9pbnQgJiYgcG9pbnQtPnBpeGVscyA8IHBpeGVscykgeworICAgICAgICAgICAgcG9pbnQgPSBwb2ludC0+bmV4dDsKKyAgICAgICAgfQorICAgICAgICBpZiAocG9pbnQpIHsKKyAgICAgICAgICAgIEFMT0dWKCJ0YXJnZXRRcE1heCh3PSVkLGg9JWQpIHJldHVybnMgJWQgZnJvbSBxcG1heF9wb2ludCB3PSVkIGg9JWQiLAorICAgICAgICAgICAgICAgIHdpZHRoLCBoZWlnaHQsIHBvaW50LT5xcE1heCwgcG9pbnQtPndpZHRoLCBwb2ludC0+aGVpZ2h0KTsKKyAgICAgICAgICAgIHJldHVybiBwb2ludC0+cXBNYXg7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBBTE9HVigiZGVmYXVsdGluZyB0byAlZCBxcG1heCIsIG1UYXJnZXRRcE1heCk7CisgICAgcmV0dXJuIG1UYXJnZXRRcE1heDsKK30KKwordm9pZCBDb2RlY1Byb3BlcnRpZXM6OnNldFRhcmdldFFwTWF4KGludCB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0dXJuIG1hcHBpbmdzIik7CisgICAgICAgIHJldHVybiBudWxscHRyOworICAgIH0KKyAgICBtZW1zZXQocmVzdWx0LCAnXDAnLCBzaXplKTsKKworICAgIGNvbnN0IGNoYXIgKipwcCA9IHJlc3VsdDsKKyAgICBmb3IgKGNvbnN0IGF1dG8mIFtrZXksIHZhbHVlXSA6IG1NYXBwaW5ncykgeworICAgICAgICAvLyBzcGxpdCBvdXQgdGhlIGtpbmQva2V5CisgICAgICAgIHNpemVfdCBwb3MgPSBrZXkuZmluZCgnLScpOworICAgICAgICBpZiAocG9zID09IHN0ZDo6c3RyaW5nOjpucG9zKSB7CisgICAgICAgICAgICBBTE9HRCgiaWdub3JpbmcgbWFsZm9ybWVkIGtleTogJXMiLCBrZXkuY19zdHIoKSk7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBzdGQ6OnN0cmluZyBhY3R1YWxLaW5kID0ga2V5LnN1YnN0cigwLHBvcyk7CisgICAgICAgIGlmIChraW5kLmxlbmd0aCgpICE9IDAgJiYga2luZCAhPSBhY3R1YWxLaW5kKSB7CisgICAgICAgICAgICBBTE9HRCgia2luZHMgZG9uJ3QgbWF0Y2g6IHdhbnQgJyVzJyBnb3QgJyVzJyIsIGtpbmQuY19zdHIoKSwgYWN0dWFsS2luZC5jX3N0cigpKTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGlmIChyZXZlcnNlKSB7CisgICAgICAgICAgICAvLyBjb2RlYyBzcGVjaWZpYyAtPiBzdGQgYWthICd1bm1hcHBpbmcnCisgICAgICAgICAgICBwcFswXSA9IHN0cmR1cCggdmFsdWUuY19zdHIoKSk7CisgICAgICAgICAgICBwcFsxXSA9IHN0cmR1cCgga2V5LnN1YnN0cihwb3MrMSkuY19zdHIoKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyBzdGQgLT4gY29kZWMgc3BlY2lmaWMKKyAgICAgICAgICAgIHB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W5pbXVtIGJwcAorICAgIHN0cnVjdCBicHBfcG9pbnQgeworICAgICAgICBzdHJ1Y3QgYnBwX3BvaW50ICpuZXh0OworICAgICAgICBpbnQzMl90IHBpeGVsczsKKyAgICAgICAgaW50MzJfdCB3aWR0aCwgaGVpZ2h0OworICAgICAgICBkb3VibGUgYnBwOworICAgIH07CisgICAgc3RydWN0IGJwcF9wb2ludCAqbUJwcFBvaW50cyA9IG51bGxwdHI7CisgICAgYm9vbCBicHBQb2ludChzdGQ6OnN0cmluZyByZXNvbHV0aW9uLCBzdGQ6OnN0cmluZyB2YWx1ZSk7CisKKyAgICAvLyBzYW1lIHRoaW5nIGZvciBxcG1heCAtLSBhbGxvdyBkaWZmZXJlbnQgb25lcyBiYXNlZCBvbiByZXNvbHV0aW9uCisgICAgLy8gYWxsb3cgZGlmZmVyZW50IHRhcmdldCBiaXRzLXBlci1waXhlbCBiYXNlZCBvbiByZXNvbHV0aW9uCisgICAgLy8gc2ltaWxhciB0byBjb2RlYyAncGVyZm9ybWFuY2UgcG9pbnRzJworICAgIC8vIHVzZXMgJ25leHQgbGFyZ2VzdCcgKGJ5IHBpeGVsIGNvdW50KSBwb2ludCBhcyBtaW5pbXVtIGJwcAorICAgIHN0cnVjdCBxcG1heF9wb2ludCB7CisgICAgICAgIHN0cnVjdCBxcG1heF9wb2ludCAqbmV4dDsKKyAgICAgICAgaW50MzJfdCBwaXhlbHM7CisgICAgICAgIGludDMyX3Qgd2lkdGgsIGhlaWdodDsKKyAgICAgICAgaW50IHFwTWF4OworICAgIH07CisgICAgc3RydWN0IHFwbWF4X3BvaW50ICptUXBNYXhQb2ludHMgPSBudWxscHRyOworICAgIGJvb2wgcXBNYXhQb2ludChzdGQ6OnN0cmluZyByZXNvbHV0aW9uLCBzdGQ6OnN0cmluZyB2YWx1ZSk7CisKKyAgICBzdGQ6Om11dGV4IG1NYXBwaW5nTG9jazsKKyAgICAvLyBYWFggZmlndXJlIG91dCB3aHkgSSdtIGhhdmluZyBwc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HZW5lcmljVmlkZW9bMF19LAorCisgICAgeyBudWxscHRyLCBudWxscHRyfQorfTsKKwordm9pZCBDb2RlY1Byb3BlcnRpZXM6OmFkZE1lZGlhRGVmYXVsdHMoYm9vbCBvdmVycmlkZWFibGUpIHsKKyAgICBBTE9HRCgiU2VlZDogY29kZWMgJXMsIG1lZGlhdHlwZSAlcywgb3ZlcnJpZGVhYmxlICVkIiwKKyAgICAgICAgICBtTmFtZS5jX3N0cigpLCBtTWVkaWFUeXBlLmNfc3RyKCksIG92ZXJyaWRlYWJsZSk7CisKKyAgICAvLyBsb2FkIG1lIHVwIHdpdGggaW5pdGlhbCBjb25maWd1cmF0aW9uIGRhdGEKKyAgICBpbnQgY291bnQgPSAwOworICAgIGZvciAoaW50IGkgPSAwOyA7IGkrKykgeworICAgICAgICBwcmVsb2FkVHVuaW5nc190ICpwID0gJnByZWxvYWRUdW5pbmdzW2ldOworICAgICAgICBpZiAocC0+bWVkaWFUeXBlID09IG51bGxwdHIpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGJvb2wgZm91bmQgPSBmYWxzZTsKKyAgICAgICAgaWYgKHN0cmNtcChwLT5tZWRpYVR5cGUsIG1NZWRpYVR5cGUuY19zdHIoKSkgPT0gMCkgeworICAgICAgICAgICAgZm91bmQgPSB0cnVlOworICAgICAgICB9CisgICAgICAgIGNvbnN0IGNoYXIgKnI7CisgICAgICAgIGlmICghZm91bmQgJiYgKHIgPSBzdHJjaHIocC0+bWVkaWFUeXBlLCAnKicpKSAhPSBOVUxMKSB7CisgICAgICAgICAgICAvLyB3aWxkY2FyZDsgY2hlY2sgdGhlIHByZWZpeAorICAgICAgICAgICAgc2l6ZV90IGxlbiA9IHIgLSBwLT5tZWRpYVR5cGU7CisgICAgICAgICAgICBpZiAoc3RybmNtcChwLT5tZWRpYVR5cGUsIG1NZWRpYVR5cGUuY19zdHIoKSwgbGVuKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgZm91bmQgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKCFmb3VuZCkgeworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKyAgICAgICAgQUxPR1YoInNlZWRpbmcgZnJvbSBtZWRpYVR5cGUgJyVzJyIsIHAtPm1lZGlhVHlwZSk7CisKKyAgICAgICAgLy8gd2FsayB0aHJvdWdoLCBmaWxsaW5nIHRoaW5ncworICAgICAgICBpZiAocC0+ZmVhdHVyZXMgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgZm9yIChpbnQgaj0wOzsgaisrKSB7CisgICAgICAgICAgICAgICAgcHJlbG9hZFR1bmluZ190ICpxID0gJnAtPmZlYXR1cmVzW2pdOworICAgICAgICAgICAgICAgIGlmIChxLT5rZXkgPT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKHEtPm92ZXJyaWRlYWJsZSAhPSBvdmVycmlkZWFibGUpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNldFR1bmluZ1ZhbHVlKHEtPmtleSwgcS0+dmFsdWUpOworICAgICAgICAgICAgICAgIGNvdW50Kys7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKyAgICBBTE9HVigibG9hZGVkICVkIHByZXNldCB2YWx1ZXMiLCBjb3VudCk7Cit9CisKKy8vIGEgY2hhbmNlLCBhcyB3ZSBjcmVhdGUgdGhlIGNvZGVjIHRvIGluamVjdCBhbnkgZGVmYXVsdCBiZWhhdmlvcnMgd2Ugd2FudC4KKy8vIFhYWDogY29uc2lkZXIgd2hldGhlciB3ZSBuZWVkIHByZS9wb3N0IG9yIGp1c3QgcG9zdC4gaXQgYWZmZWN0cyB3aGF0IGNhbiBiZQorLy8gb3ZlcnJpZGRlbiBieSB3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R1cm4gMDsKK30KKworaW50IHNldE1hcChzaGFwZXJIYW5kbGVfdCBzaGFwZXIsICBjb25zdCBjaGFyICpraW5kLCBjb25zdCBjaGFyICprZXksIGNvbnN0IGNoYXIgKnZhbHVlKSB7CisgICAgQUxPR1YoInNldE1hcDoga2luZCAlcyBrZXkgJXMgLT4gdmFsdWUgJXMiLCBraW5kLCBrZXksIHZhbHVlKTsKKyAgICBDb2RlY1Byb3BlcnRpZXMgKmNvZGVjID0gKENvZGVjUHJvcGVydGllcyopIHNoYXBlcjsKKyAgICBpZiAoY29kZWMgPT0gbnVsbHB0cikgeworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIC8vIG11c3Qgbm90IHlldCBiZSByZWdpc3RlcmVkCisgICAgaWYgKGNvZGVjLT5pc1JlZ2lzdGVyZWQoKSkgeworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgY29kZWMtPnNldE1hcHBpbmcoa2luZCwga2V5LCB2YWx1ZSk7CisgICAgcmV0dXJuIDA7Cit9CisKK2ludCBzZXRGZWF0dXJlKHNoYXBlckhhbmRsZV90IHNoYXBlciwgY29uc3QgY2hhciAqZmVhdHVyZSwgaW50IHZhbHVlKSB7CisgICAgQUxPR1YoInNldF9mZWF0dXJlOiBmZWF0dXJlICVzIHZhbHVlICVkIiwgZmVhdHVyZSwgdmFsdWUpOworICAgIENvZGVjUHJvcGVydGllcyAqY29kZWMgPSAoQ29kZWNQcm9wZXJ0aWVzKikgc2hhcGVyOworICAgIGlmIChjb2RlYyA9PSBudWxscHRyKSB7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgLy8gbXVzdCBub3QgeWV0IGJlIHJlZ2lzdGVyZWQKKyAgICBpZiAoY29kZWMtPmlzUmVnaXN0ZXJlZCgpKSB7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICAvLyBzYXZlIGEgbWFwIG9mIGFsbCBmZWF0dXJlcworICAgIGNvZGVjLT5zZXRGZWF0dX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HZhbHVlKTsKKyAgICAgICAgfQorICAgICAgICB7CisgICAgICAgICAgICBpbnQzMl90IG1heFAgPSBJTlQzMl9NQVg7CisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZ2V0SW50MzIoZm9ybWF0LCBBTUVESUFGT1JNQVRfVklERU9fUVBfUF9NQVgsICZtYXhQKTsKKyAgICAgICAgICAgIGludDMyX3QgdmFsdWUgPSBzdGQ6Om1pbih7KHN0ZDo6bWluKHFwT2ZmZXJlZCwgSU5UMzJfTUFYLTEqZGVsdGEpICsgMSpkZWx0YSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXBoaWdoLCBtYXhQfSk7CisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0SW50MzIoZm9ybWF0LCBBTUVESUFGT1JNQVRfVklERU9fUVBfUF9NQVgsIHZhbHVlKTsKKyAgICAgICAgfQorICAgICAgICB7CisgICAgICAgICAgICBpbnQzMl90IG1heEIgPSBJTlQzMl9NQVg7CisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZ2V0SW50MzIoZm9ybWF0LCBBTUVESUFGT1JNQVRfVklERU9fUVBfQl9NQVgsICZtYXhCKTsKKyAgICAgICAgICAgIGludDMyX3QgdmFsdWUgPSBzdGQ6Om1pbih7KHN0ZDo6bWluKHFwT2ZmZXJlZCwgSU5UMzJfTUFYLTIqZGVsdGEpICsgMipkZWx0YSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXBoaWdoLCBtYXhCfSk7CisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0SW50MzIoZm9ybWF0LCBBTUVESUFGT1JNQVRfVklERU9fUVBfQl9NQVgsIHZhbHVlKTsKKyAgICAgICAgfQorICAgIH0KK30KKwordm9pZCBxcFNwcmVhZE1pblBlckZyYW1lVHlwZShBTWVkaWFGb3JtYXQgKmZvcm1hdCwgaW50IHFwbG93LCBib29sIG92ZXJyaWRlKSB7CisgICAgQUxPR1YoImZ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aCYgcGF0Y2gsIHN0ZDo6c3RyaW5nX3ZpZXcgYnVnTnVtYmVyKQoreworICAgIHN0YXR1c190IHN0YXR1cyA9IE5PX0VSUk9SOworICAgIGlmIChwYXRjaC5udW1fc291cmNlcyA+IEFVRElPX1BBVENIX1BPUlRTX01BWCkgeworICAgICAgICBzdGF0dXMgPSBCQURfVkFMVUU7CisgICAgfQorICAgIGlmIChwYXRjaC5udW1fc2lua3MgPiBBVURJT19QQVRDSF9QT1JUU19NQVgpIHsKKyAgICAgICAgc3RhdHVzID0gQkFEX1ZBTFVFOworICAgIH0KKyAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHBhdGNoLm51bV9zb3VyY2VzOyBpKyspIHsKKyAgICAgICAgaWYgKHZhbGlkYXRlQXVkaW9Qb3J0Q29uZmlnKHBhdGNoLnNvdXJjZXNbaV0pICE9IE5PX0VSUk9SKSB7CisgICAgICAgICAgICBzdGF0dXMgPSBCQURfVkFMVUU7CisgICAgICAgIH0KKyAgICB9CisgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBwYXRjaC5udW1fc2lua3M7IGkrKykgeworICAgICAgICBpZiAodmFsaWRhdGVBdWRpb1BvcnRDb25maWcocGF0Y2guc2lua3NbaV0pICE9IE5PX0VSUk9SKSB7CisgICAgICAgICAgICBzdGF0dXMgPSBCQURfVkFMVUU7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIHNhZmV0eU5ldExvZyhzdGF0dXMsIGJ1Z051bWJlcik7Cit9CisKKy8qIHN0YXRpYyAqLworc3RhdHVzX3QgQXVkaW9WYWxpZGF0b3I6OnZhbGlkYXRlQXVkaW9EZXNjcmlwdGlvbk1peExldmVsKGZsb2F0IGxldmVsZEIpCit7CisgICAgY29uc3RleHByIGZsb2F0IE1BWF9BVURJT19ERVNDUklQVElPTl9NSVhfTEVWRUwgPSA0OC5mOworICAgIHJldHVybiBzdGQ6OmlzbmFuKGxldmVsZEIpIHx8IGxldmVsZEIgPiBNQV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ciAoc2l6ZV90IGkgPSAwOyBtVGFibGVbaV0ubGl0ZXJhbDsgaSsrKSB7Ci0gICAgICAgICAgICB1aW50MzJfdCB2YWx1ZSA9IHN0YXRpY19jYXN0PHVpbnQzMl90PihtVGFibGVbaV0udmFsdWUpOwotICAgICAgICAgICAgaWYgKG1UYWJsZVtpXS52YWx1ZSAhPSAwICYmICgobWFzayAmIHZhbHVlKSA9PSB2YWx1ZSkpIHsKLSAgICAgICAgICAgICAgICBpZiAoIWZpcnN0X2ZsYWcpIHN0ciArPSBkZWw7Ci0gICAgICAgICAgICAgICAgZmlyc3RfZmxhZyA9IGZhbHNlOwotICAgICAgICAgICAgICAgIHN0ciArPSBtVGFibGVbaV0ubGl0ZXJhbDsKKyAgICAgICAgZm9yIChzaXplX3QgYml0ID0gMDsgYml0IDwgc2l6ZW9mKHVpbnQzMl90KSAqIDg7ICsrYml0KSB7CisgICAgICAgICAgICB1aW50MzJfdCBmbGFnID0gMXUgPDwgYml0OworICAgICAgICAgICAgaWYgKChmbGFnICYgbWFzaykgPT0gZmxhZykgeworICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGZsYWdfc3RyOworICAgICAgICAgICAgICAgIGlmICh0b1N0cmluZyhzdGF0aWNfY2FzdDx0eXBlbmFtZSBUcmFpdHM6OlR5cGU+KGZsYWcpLCBmbGFnX3N0cikpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFmaXJzdF9mbGFnKSBzdHIgKz0gZGVsOworICAgICAgICAgICAgICAgICAgICBmaXJzdF9mbGFnID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIHN0ciArPSBmbGFnX3N0cjsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9IGVsc2UgewpAQCAtMjAwLDYgKzIxNiw3IEBACiAgICAgfQogfQogCit0eXBlZGVmIFR5cGVDb252ZXJ0ZXI8RGV2aWNlVHJhaXRzPiBEZXZpY2VDb252ZXJ0ZXI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tMTUsNyArMzQsMTIgQEAKICAgICBzaGFyZWRfbGliczogWwogICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5jMkAxLjAiLAogICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5vbXhAMS4wIiwKKyAgICAgICAgImF2LXR5cGVzLWFpZGwtY3BwIiwKKyAgICAgICAgImZyYW1ld29yay1wZXJtaXNzaW9uLWFpZGwtY3BwIiwKKyAgICAgICAgImxpYmF1ZGlvY2xpZW50X2FpZGxfY29udmVyc2lvbiIsCiAgICAgICAgICJsaWJiYXNlIiwKKyAgICAgICAgImxpYmFjdGl2aXR5bWFuYWdlcl9haWRsIiwKKyAgICAgICAgImxpYmFuZHJvaWRfbmV0IiwKICAgICAgICAgImxpYmF1ZGlvY2xpZW50IiwKICAgICAgICAgImxpYmJpbmRlciIsCiAgICAgICAgICJsaWJjYW1lcmFfY2xpZW50IiwKQEAgLTUyLDkgKzc2LDEzIEBACiAgICAgICAgICJsaWJzdGFnZWZyaWdodF9udXBsYXllciIsCiAgICAgICAgICJsaWJzdGFnZWZyaWdodF9ydHNwIiwKICAgICAgICAgImxpYnN0YWdlZnJpZ2h0X3RpbWVkdGV4dCIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCiAgICAgXSwKIAotICAgIGV4cG9ydF9zaGFyZWRfbGliX2hlYWRlcnM6IFsibGlibWVkaWEiXSwKKyAgICBleHBvcnRfc2hhcmVkX2xpYl9oZWFkZXJzOiBbCisgICAgICAgICJsaWJtZWRpYSIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCisgICAgXSwKIAogICAgIGluY2x1ZGVfZGlyczogWwogICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9saWJzdGFnZWZyaWdodC9ydHNwIiwKQEAgLTc2LDQgKzEwNCwzIEBACiAgICAgfSwKIAogfQotCmRpZmYgLS1naXQgYS9tZW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KIAogICAgIHdwPENsaWVudD4gdyA9IGM7CiAgICAgewpAQCAtNTQzLDggKzU1Nyw4IEBACiAgICAgY2hhciBidWZmZXJbU0laRV07CiAgICAgU3RyaW5nOCByZXN1bHQ7CiAgICAgcmVzdWx0LmFwcGVuZCgiIENsaWVudFxuIik7Ci0gICAgc25wcmludGYoYnVmZmVyLCAyNTUsICIgIHBpZCglZCksIGNvbm5JZCglZCksIHN0YXR1cyglZCksIGxvb3BpbmcoJXMpXG4iLAotICAgICAgICAgICAgbVBpZCwgbUNvbm5JZCwgbVN0YXR1cywgbUxvb3A/InRydWUiOiAiZmFsc2UiKTsKKyAgICBzbnByaW50ZihidWZmZXIsIDI1NSwgIiAgQXR0cmlidXRpb25Tb3VyY2UoJXMpLCBjb25uSWQoJWQpLCBzdGF0dXMoJWQpLCBsb29waW5nKCVzKVxuIiwKKyAgICAgICAgbUF0dHJpYnV0aW9uU291cmNlLnRvU3RyaW5nKCkuY19zdHIoKSwgbUNvbm5JZCwgbVN0YXR1cywgbUxvb3A/InRydWUiOiAiZmFsc2UiKTsKICAgICByZXN1bHQuYXBwZW5kKGJ1ZmZlcik7CiAKICAgICBzcDxNZWRpYVBsYXllckJhc2U+IHA7CkBAIC02MDgsNyArNjIyLDggQEAKICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwLCBuID0gbU1lZGlhUmVjb3JkZXJDbGllbnRzLnNpemUoKTsgaSA8IG47ICsraSkgewogICAgICAgICAgICAgICAgIHNwPE1lZGlhUmVjb3JkZXJDbGllbnQ+IGMgPSBtTWVkaWFSZWNvcmRlckNsaWVudHNbaV0ucHJvbW90ZSgpOwogICAgICAgICAgICAgICAgIGlmIChjICE9IDApIHsKLSAgICAgICAgICAgICAgICAgICAgc25wcmludGYoYnVmZmVyLCAyNTUsICIgTWVkaWFSZWNvcmRlckNsaWVudCBwaWQoJWQpXG4iLCBjLT5tUGlkKTsKKyAgICAgICAgICAgICAgICAgICAgc25wcmludGYoYnVmZmVyLCAyNTUsIC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MgYnVmZmVyIHVuZGVycnVuIGZvciBlbXVsYXRvcgogICAgIH0KQEAgLTIxNzQsMTMgKzIxOTgsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgbVNlc3Npb25JZCwKICAgICAgICAgICAgICAgICAgICAgQXVkaW9UcmFjazo6VFJBTlNGRVJfQ0FMTEJBQ0ssCiAgICAgICAgICAgICAgICAgICAgIG9mZmxvYWRJbmZvLAotICAgICAgICAgICAgICAgICAgICBtVWlkLAotICAgICAgICAgICAgICAgICAgICBtUGlkLAorICAgICAgICAgICAgICAgICAgICBtQXR0cmlidXRpb25Tb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJ1dGVzLAogICAgICAgICAgICAgICAgICAgICBkb05vdFJlY29ubmVjdCwKICAgICAgICAgICAgICAgICAgICAgMS4wZiwgIC8vIGRlZmF1bHQgdmFsdWUgZm9yIG1heFJlcXVpcmVkU3BlZWQKLSAgICAgICAgICAgICAgICAgICAgbVNlbGVjdGVkRGV2aWNlSWQsCi0gICAgICAgICAgICAgICAgICAgIG1PcFBhY2thZ2VOYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgbVNlbGVjdGVkRGV2aWNlSWQpOwogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgLy8gVE9ETzogRHVlIHRvIGJ1ZmZlciBtZW1vcnkgY29uY2VybnMsIHdlIHVzZSBhIG1heCB0YXJnZXQgcGxheWJhY2sgc3BlZWQKICAgICAgICAgICAgIC8vIGJhc2VkIG9uIG1QbGF5YmFja1JhdGUgYXQgdGhlIHRpbWUgb2Ygb3BlbiAoaW5zdGVhZCBvZiBrTWF4UmVxdWlyZWRTcGVlZCksCkBAIC0yMjAzLDEzICsyMjI1LDExIEBACiAgICAgICAgICAgICAgICAgICAgIG1TZXNzaW9uSWQsCiAgICAgICAgICAgICAgICAgICAgIEF1ZGlvVHJhY2s6OlRSQU5TRkVSX0RFRkFVTFQsCiAgICAgICAgICAgICAgICAgICAgIE5VTEwsIC8vIG9mZmxvYWQgaW5mbwotICAgICAgICAgICAgICAgICAgICBtVWlkLAotICAgICAgICAgICAgICAgICAgICBtUGlkLAorICAgICAgICAgICAgICAgICAgICBtQXR0cmlidXRpb25Tb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJ1dGVzLAogICAgICAgICAgICAgICAgICAgICBkb05vdFJlY29ubmVjdCwKICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0U3BlZWQsCi0gICAgICAgICAgICAgICAgICAgIG1TZWxlY3RlZERldmljZUlkLAotICAgICAgICAgICAgICAgICAgICBtT3BQYWNrYWdlTmFtZSk7CisgICAgICAgICAgICAgICAgICAgIG1TZWxlY3RlZERldmljZUlkKTsKICAgICAgICAgfQogICAgICAgICAvLyBTZXQgY2FsbGVyIG5hbWUgc28gaXQgY2FuIGJlIGxvZ2dlZCBpbiBkZXN0cnVjdG9yLgogICAgICAgICAvLyBNZWRpYU1ldHJpY3NDb25zdGFudHMuaDogQU1FRElBTUVUUklDU19QUk9QX0NBTExFUk5BTUVfVkFMVUVfTUVESUEKQEAgLTIyMzUsNiArMjI1NSwxMiBAQAogICAgICAgICAgICAgICAgICAgICAgIG1SZWN5Y2xlZFRyYWNrLT5mcmFtZUNvdW50KCksIHQtPmZyYW1lQ291bnQoKSk7CiAgICAgICAgICAgICAgICAgcmV1c2UgPSBmYWxzZTsKICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIElmIHJlY3ljbGVkIGFuZCBuZXcgdHJhY2tzIGFyZSBub3Qgb24gdGhlIHNhbWUgb3V0cHV0LAorICAgICAgICAgICAgLy8gZG9uJ3QgcmV1c2UgdGhlIHJlY3ljbGVkIG9uZS4KKyAgICAgICAgICAgIGlmIChtUmVjeWNsZWRUcmFjay0+Z2V0T3V0cHV0KCkgIT0gdC0+Z2V0T3V0cHV0KCkpIHsKKyAgICAgICAgICAgICAgICBBTE9HVigib3V0cHV0IGhhcyBjaGFuZ2VkLCBkb24ndCByZXVzZSB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7CiBzdHJ1Y3QgQVZTeW5jU2V0dGluZ3M7CiBjbGFzcyBEZWF0aE5vdGlmaWVyOwpAQCAtNzksMTEgKzgyLDkgQEAKICAgICAgcHVibGljOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBdWRpb091dHB1dCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgcGlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUmIGF0dHJpYnV0aW9uU291cmNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAqIGF0dHIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8QXVkaW9TeXN0ZW06OkF1ZGlvRGV2aWNlQ2FsbGJhY2s+JiBkZXZpY2VDYWxsYmFjaywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgb3BQYWNrYWdlTmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8QXVkaW9TeXN0ZW06OkF1ZGlvRGV2aWNlQ2FsbGJhY2s+JiBkZXZpY2VDYWxsYmFjayk7CiAgICAgICAgIHZpcnR1YWwgICAgICAgICAgICAgICAgIH5BdWRpb091dHB1dCgpOwogCiAgICAgICAgIHZpcnR1YWwgYm9vbCAgICAgICAgICAgIHJlYWR5KCkgY29uc3QgeyByZXR1cm4gbVRyYWNrICE9IDA7IH0KQEAgLTEwMCw2ICsxMDEsNyBAQAogICAgICAgICB2aXJ0dWFsIGF1ZGlvX3Nlc3Npb25fdCBnZXRTZXNzaW9uSWQoKSBjb25zdDsKICAgICAgICAgdmlydHVhbCB1aW50MzJfdCAgICAgICAgZ2V0U2FtcGxlUmF0ZSgpIGNvbnN0OwogICAgICAgICB2aXJ0dWFsIGludDY0X3QgICAgICAgICBnZXRCdWZmZXJEdXJhdGlvbkluVXMoKSBjb25zdDsKKyAgICAgICAgdmlydHVhbCBhdWRpb19vdXRwdXRfZmxhZ3NfdCBnZXRGbGFncygpIGNvbnN0IHsgcmV0dXJuIG1GbGFnczsgfQogCiAgICAgICAgIHZpcnR1YWwgc3RhdHVzX3QgICAgICAgIG9wZW4oCiAgICAgICAgICAgICAgICAgdWludDMyX3Qgc2FtcGxlUmF0ZSwgaW50IGNoYW5uZWxDb3VudCwgYXVkaW9fY2hhbm5lbF9tYXNrX3QgY2hhbm5lbE1hc2ssCkBAIC0xNjksOCArMTcxLDcgQEAKICAgICAgICAgZmxvYXQgICAgICAgICAgICAgICAgICAgbU1zZWNzUGVyRnJhbWU7CiAgICAgICAgIHNpemVfdCAgICAgICAgICAgICAgICAgIG1GcmFtZVNpemU7CiAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCAgICAgICAgIG1TZXNzaW9uSWQ7Ci0gICAgICAgIHVpZF90ICAgICAgICAgICAgICAgICAgIG1VaWQ7Ci0gICAgICAgIGludCAgICAgICAgICAgICAgICAgICAgIG1QaWQ7CisgICAgICAgIEF0dHJpYnV0aW9uU291cmNlU3RhdGUgIG1BdHRyaWJ1dGlvblNvdXJjZTsKICAgICAgICAgZmxvYXQgICAgICAgICAgICAgICAgICAgbVNlbmRMZXZlbDsKICAgICAgICAgaW50ICAgICAgICAgICAgICAgICAgICAgbUF1eEVmZmVjdElkOwogICAgICAgICBhdWRpb19vdXRwdXRfZmxhZ3NfdCAgICBtRmxhZ3M7CkBAIC0xODAsNyArMTgxLDYgQEAKICAgICAgICAgYm9vbCAgICAgICAgIC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LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IGF1ZGlvU2Vzc2lvbklkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcgb3BQYWNrYWdlTmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlJiBhdHRyaWJ1dGlvblNvdXJjZSk7CiAKICAgICB2aXJ0dWFsIHNwPElNZWRpYUNvZGVjTGlzdD4gZ2V0Q29kZWNMaXN0KCkgY29uc3Q7CiAKQEAgLTM3Miw2ICszNzIsNyBAQAogCiAgICAgICAgIHZpcnR1YWwgc3RhdHVzX3QgICAgICAgIHNldERhdGFTb3VyY2UoY29uc3Qgc3A8SVN0cmVhbVNvdXJjZT4gJnNvdXJjZSk7CiAgICAgICAgIHZpcnR1YWwgc3RhdHVzX3QgICAgICAgIHNldERhdGFTb3VyY2UoY29uc3Qgc3A8SURhdGFTb3VyY2U+ICZzb3VyY2UpOworICAgICAgICB2aXJ0dWFsIHN0YXR1c190ICAgICAgICBzZXREYXRhU291cmNlKGNvbnN0IFN0cmluZzgmIHJ0cFBhcmFtcyk7CiAKIAogICAgICAgICBzcDxNZWRpYVBsYXllckJhc2U+ICAgICBzZXREYXRhU291cmNlX3ByZShwbGF5ZXJfdHlwZSBwbGF5ZXJUeXBlKTsKQEAgLTM4MCw3ICszODEsOSBAQAogCiAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAgIG5vdGlmeShpbnQgbXNnLCBpbnQgZXh0MSwgaW50IGV4dDIsIGNvbnN0IFBhcmNlbCAqb2JqKTsKIAotICAgICAgICAgICAgICAgIHBpZF90ICAgICAgICAgICBwaWQoKSBjb25zdCB7IHJldHVybiBtUGlkOyB9CisgICAgICAgICAgICAgICAgcGlkX3QgICAgICAgICAgIHBpZCgpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFZBTFVFX09SX0ZBVEFMKGFpZGwybGVnYWN5X2ludDMyX3RfcGlkX3QobUF0dHJpYnV0aW9uU291cmNlLnBpZCkpOworICAgICAgICAgICAgICAgIH0KICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCAgICAgICAgZHVtcChpbnQgZmQsIGNvbnN0IFZlY3RvcjxTdHJpbmcxNj4mIGFyZ3MpOwogCiAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IGdldEF1ZGlvU2Vzc2lvbklkKCkgeyByZXR1cm4gbUF1ZGlvU2Vzc2lvbklkOyB9CkBAIC00MTAsMTIgKzQxMywxMCBAQAogCiAgICAgICAgIGZyaWVuZCBjbGFzcyBNZWRpYVBsYXllclNlcnZpY2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENsaWVudCggY29uc3Qgc3A8TWVkaWFQbGF5ZXJTZXJ2aWNlPiYgc2VydmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWRfdCBwaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgYXR0cmlidXRpb25Tb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBjb25uSWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8SU1lZGlhUGxheWVyQ2xpZW50PiYgY2xpZW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBhdWRpb1Nlc3Npb25JZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcmIG9wUGFja2FnZU5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBhdWRpb1Nlc3Npb25JZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENsaWVudCgpOwogICAgICAgICB2aXJ0dWFsICAgICAgICAgICAgICAgICB+Q2xpZW50KCk7CiAKQEAgLTQ1OSwyMCArNDYwLDE4IEBACiAgICAgICAgICAgICAgICAgICAgIHNwPE1lZGlhUGxheWVyU2VydmljZT4gICAgICAgIG1TZXJ2aWNlOwogICAgICAgICAgICAgICAgICAgICBzcDxJTWVkaWFQbGF5ZXJDbGllbnQ+ICAgICAgICBtQ2xpZW50OwogICAgICAgICAgICAgICAgICAgICBzcDxBdWRpb091dHB1dD4gICAgICAgICAgICAgICBtQXVkaW9PdXRwdXQ7Ci0gICAgICAgICAgICAgICAgICAgIHBpZF90ICAgICAgICAgICAgICAgICAgICAgICAgIG1QaWQ7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUgIG1BdHRyaWJ1dGlvblNvdXJjZTsKICAgICAgICAgICAgICAgICAgICAgc3RhdHVzX3QgICAgICAgICAgICAgICAgICAgICAgbVN0YXR1czsKICAgICAgICAgICAgICAgICAgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgbUxvb3A7CiAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgICAgICAgICAgICAgICAgICAgICAgIG1Db25uSWQ7CiAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCAgICAgICAgICAgICAgIG1BdWRpb1Nlc3Npb25JZDsKICAgICAgICAgICAgICAgICAgICAgYXVkaW9fYXR0cmlidXRlc190ICogICAgICAgICAgbUF1ZGlvQXR0cmlidXRlczsKLSAgICAgICAgICAgICAgICAgICAgdWlkX3QgICAgICAgICAgICAgICAgICAgICAgICAgbVVpZDsKICAgICAgICAgICAgICAgICAgICAgc3A8QU5hdGl2ZVdpbmRvdz4gICAgICAgICAgICAgbUNvbm5lY3RlZFdpbmRvdzsKICAgICAgICAgICAgICAgICAgICAgc3A8SUJpbmRlcj4gICAgICAgICAgICAgICAgICAgbUNvbm5lY3RlZFdpbmRvd0JpbmRlcjsKICAgICAgICAgICAgICAgICAgICAgc3RydWN0IHNvY2thZGRyX2luICAgICAgICAgICAgbVJldHJhbnNtaXRFbmRwb2ludDsKICAgICAgICAgICAgICAgICAgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgbVJldHJhbnNtaXRFbmRwb2ludFZhbGlkOwogICAgICAgICAgICAgICAgICAgICBzcDxDbGllbnQ+ICAgICAgICAgICAgICAgICAgICBtTmV4dENsaWVudDsKICAgICAgICAgICAgICAgICAgICAgc3A8TWVkaWFQbGF5ZXJCYXNlOjpMaXN0ZW5lcj4gbUxpc3RlbmVyOwotICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyAgICAgICAgICAgICBtT3BQYWNrYWdlTmFtZTsKIAogICAgICAgICAvLyBNZXRhZGF0YSBmaWx0ZXJzLgogICAgICAgICBtZWRpYTo6TWV0YWRhdGE6OkZpbHRlciBtTWV0YWRhdGFBbGxvdzsgIC8vIHByb3RlY3RlZCBieSBtTG9jawpkaWZmIC0tZ2l0IGEvbWVkaWEvbGlibWVkaWFwbGF5ZXJzZXJ2aWNlL01lZGlhUmVjb3JkZXJDbGllbnQuY3BwIGIvbWVkaWEvbGlibWVkaWFwbGF5ZXJzZXJ2aWNlL01lZGlhUmVjb3JkZXJDbGllbnQuY3BwCmluZGV4IDFjYzI1NWQuLmE5MTQwMDYgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYm1lZGlhcGxheWVyc2VydmljZS9NZWRpYVJlY29yZGVyQ2xpZW50LmNwcAorKysgYi9tZWRpYS9saWJtZWRpYXBsYXllcnNlcnZpY2UvTWVkaWFSZWNvcmRlckNsaWVudC5jcHAKQEA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Y2U7ICAvLyBmb3IgYWNjZXNzaW5nIHByaXZhdGUgY29uc3RydWN0b3IKIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgTWVkaWFSZWNvcmRlckNsaWVudCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8TWVkaWFQbGF5ZXJTZXJ2aWNlPiYgc2VydmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IHBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFN0cmluZzE2JiBvcFBhY2thZ2VOYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY29udGVudDo6QXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgYXR0cmlidXRpb25Tb3VyY2UpOwogICAgIHZpcnR1YWwgICAgICAgICAgICAgICAgfk1lZGlhUmVjb3JkZXJDbGllbnQoKTsKIAogICAgIHN0ZDo6dmVjdG9yPERlYXRoTm90aWZpZXI+IG1EZWF0aE5vdGlmaWVyczsKICAgICBzcDxBdWRpb0RldmljZVVwZGF0ZWROb3RpZmllcj4gbUF1ZGlvRGV2aWNlVXBkYXRlZE5vdGlmaWVyOwogCi0gICAgcGlkX3QgICAgICAgICAgICAgICAgICBtUGlkOworICAgIGNvbnRlbnQ6OkF0dHJpYnV0aW9uU291cmNlU3RhdGUgbUF0dHJpYnV0aW9uU291cmNlOwogICAgIG11dGFibGUgTXV0ZXggICAgICAgICAgbUxvY2s7CiAgICAgTWVkaWFSZWNvcmRlckJhc2UgICAgICAqbVJlY29yZGVyOwogICAgIHNwPE1lZGlhUGxheWVyU2VydmljZT4gbU1lZGlhUGxheWVyU2VydmljZTsKZGlmZiAtLWdpdCBhL21lZGlhL2xpYm1lZGlhcGxheWVyc2VydmljZS9TdGFnZWZyaWdodE1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0+ZmluZEludDMyKGtLZXlSb3RhdGlvbiwgJnJvdGF0aW9uQW5nbGUpKSB7CiAgICAgICAgICAgICAgICAgICAgIHJvdGF0aW9uQW5nbGUgPSAwOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBpZiAoIXRyYWNrTWV0YS0+ZmluZEludDMyKGtLZXlGcmFtZUNvdW50LCAmdmlkZW9GcmFtZUNvdW50KSkgewogICAgICAgICAgICAgICAgICAgICB2aWRlb0ZyYW1lQ291bnQgPSAwOwogICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIHBhcnNlQ29sb3JBc3BlY3RzKHRyYWNrTWV0YSk7CisgICAgICAgICAgICAgICAgaWYgKHRyYWNrTWV0YS0+ZmluZEludDMyKGtLZXlXaWR0aCwgJnZpZGVvV2lkdGgpCisgICAgICAgICAgICAgICAgICAgICYmIHRyYWNrTWV0YS0+ZmluZEludDMyKGtLZXlIZWlnaHQsICZ2aWRlb0hlaWdodCkpIHsKKyAgICAgICAgICAgICAgICAgICAgaGFzVmlkZW8gPSB0cnVlOworICAgICAgICAgICAgICAgICAgICB2aWRlb01pbWUgPSBTdHJpbmc4KG1pbWUpOworICAgICAgICAgICAgICAgICAgICBwYXJzZUNvbG9yQXNwZWN0cyh0cmFja01ldGEpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIEFMT0dFKCJ2aWRlbyB0cmFjayBpZ25vcmVkIGZvciBtaXNzaW5nIGRpbWVuc2lvbnMiKTsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9IGVsc2UgaWYgKCFzdHJuY2FzZWNtcCgiaW1hZ2UvIiwgbWltZSwgNikpIHsKICAgICAgICAgICAgICAgICBpbnQzMl90IGlzUHJpbWFyeTsKICAgICAgICAgICAgICAgICBpZiAodHJhY2tNZXRhLT5maW5kSW50MzIoCiAgICAgICAgICAgICAgICAgICAgICAgICBrS2V5VHJhY2tJc0RlZmF1bHQsICZpc1ByaW1hcnkpICYmIGlzUHJpbWFyeSkgewotICAgICAgICAgICAgICAgICAgICBpbWFnZVByaW1hcnkgPSBpbWFnZUNvdW50OwotICAgICAgICAgICAgICAgICAgICBDSEVDSyh0cmFja01ldGEtPmZpbmRJbnQzMihrS2V5V2lkdGgsICZpbWFnZVdpZHRoKSk7Ci0gICAgICAgICAgICAgICAgICAgIENIRUNLKHRyYWNrTWV0YS0+ZmluZEludDMyKGtLZXlIZWlnaHQsICZpbWFnZUhlaWdodCkpOwogICAgICAgICAgICAgICAgICAgICBpZiAoIXRyYWNrTWV0YS0+ZmluZEludDMyKGtLZXlSb3RhdGlvbiwgJmltYWdlUm90YXRpb24pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBpbWFnZVJvdGF0aW9uID0gMDsKICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAodHJhY2tNZXRhLT5maW5kSW50MzIoa0tleVdpZHRoLCAmaW1hZ2VXaWR0aCkKKyAgICAgICAgICAgICAgICAgICAgICAgICYmIHRyYWNrTWV0YS0+ZmluZEludDMyKGtLZXlIZWlnaHQsICZpbWFnZUhlaWdodCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGltYWdlUHJpbWFyeSA9IGltYWdlQ291bnQ7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBBTE9HRSgicHJpbWFyeSBpbWFnZSB0cmFjayBpZ25vcmVkIGZvciBtaXNzaW5nIGRpbWVuc2lvbnMiKTsKKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBpbWFnZUNvdW50Kys7CiAgICAgICAgICAgICB9IGVsc2UgaWYgKCFzdHJjYXNlY21wKG1pbWUsIE1FRElBX01JTUVUWVBFX1RFWFRfM0dQUCkpIHsKQEAgLTYxOCw3ICs2MzgsOCBAQAogICAgIH0KIAogICAgIC8vIFRoZSBkdXJ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taXAiKSB7CisgICAgICAgIHJldHVybiBzZXRQYXJhbVJ0cFJlbW90ZUlwKHZhbHVlKTsKKyAgICB9IGVsc2UgaWYgKGtleSA9PSAicnRwLXBhcmFtLXJlbW90ZS1wb3J0IikgeworICAgICAgICBpbnQzMl90IHJlbW90ZVBvcnQ7CisgICAgICAgIGlmIChzYWZlX3N0cnRvaTMyKHZhbHVlLnN0cmluZygpLCAmcmVtb3RlUG9ydCkpIHsKKyAgICAgICAgICAgIHJldHVybiBzZXRQYXJhbVJ0cFJlbW90ZVBvcnQocmVtb3RlUG9ydCk7CisgICAgICAgIH0KKyAgICB9IGVsc2UgaWYgKGtleSA9PSAicnRwLXBhcmFtLXNlbGYtaWQiKSB7CisgICAgICAgIGludDMyX3Qgc2VsZklEOworICAgICAgICBpbnQ2NF90IHRlbXA7CisgICAgICAgIGlmIChzYWZlX3N0cnRvaTY0KHZhbHVlLnN0cmluZygpLCAmdGVtcCkpIHsKKyAgICAgICAgICAgIHNlbGZJRCA9IHN0YXRpY19jYXN0PGludDMyX3Q+KHRlbXApOworICAgICAgICAgICAgcmV0dXJuIHNldFBhcmFtU2VsZklEKHNlbGZJRCk7CisgICAgICAgIH0KKyAgICB9IGVsc2UgaWYgKGtleSA9PSAicnRwLXBhcmFtLW9wcG9uZW50LWlkIikgeworICAgICAgICBpbnQzMl90IG9wbklkOworICAgICAgICBpbnQ2NF90IHRlbXA7CisgICAgICAgIGlmIChzYWZlX3N0cnRvaTY0KHZhbHVlLnN0cmluZygpLCAmdGVtcCkpIHsKKyAgICAgICAgICAgIG9wbklkID0gc3RhdGljX2Nhc3Q8aW50MzJfdD4odGVtcCk7CisgICAgICAgICAgICByZXR1cm4gc2V0UGFyYW1WaWRlb09wcG9uZW50SUQob3BuSWQpOworICAgICAgICB9CisgICAgfSBlbHNlIGlmIChrZXkgPT0gInJ0cC1wYXJhbS1wYXlsb2FkLXR5cGUiKSB7CisgICAgICAgIGludDMyX3QgcGF5bG9hZFR5cGU7CisgICA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Ck7Ci0KICAgICBzdGF0dXNfdCBzdGF0dXMgPSBPSzsKIAogICAgIHN3aXRjaCAobU91dHB1dEZvcm1hdCkgewpAQCAtMTA1MCw2ICsxMjU5LDE3IEBACiAgICAgICAgICAgICBzcDxNZXRhRGF0YT4gbWV0YSA9IG5ldyBNZXRhRGF0YTsKICAgICAgICAgICAgIGludDY0X3Qgc3RhcnRUaW1lVXMgPSBzeXN0ZW1UaW1lKCkgLyAxMDAwOwogICAgICAgICAgICAgbWV0YS0+c2V0SW50NjQoa0tleVRpbWUsIHN0YXJ0VGltZVVzKTsKKyAgICAgICAgICAgIG1ldGEtPnNldEludDMyKGtLZXlTZWxmSUQsIG1TZWxmSUQpOworICAgICAgICAgICAgbWV0YS0+c2V0SW50MzIoa0tleVBheWxvYWRUeXBlLCBtUGF5bG9hZFR5cGUpOworICAgICAgICAgICAgbWV0YS0+c2V0SW50NjQoa0tleVNvY2tldE5ldHdvcmssIG1SVFBTb2NrTmV0d29yayk7CisgICAgICAgICAgICBpZiAobVJUUENWT0V4dE1hcCA+IDApIHsKKyAgICAgICAgICAgICAgICBtZXRhLT5zZXRJbnQzMihrS2V5UnRwRXh0TWFwLCBtUlRQQ1ZPRXh0TWFwKTsKKyAgICAgICAgICAgICAgICBtZXRhLT5zZXRJbnQzMihrS2V5UnRwQ3ZvRGVncmVlcywgbVJUUENWT0RlZ3JlZXMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1SVFBTb2NrRHNjcCA+IDApIHsKKyAgICAgICAgICAgICAgICBtZXRhLT5zZXRJbnQzMihrS2V5UnRwRHNjcCwgbVJUUFNvY2tEc2NwKTsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgc3RhdHVzID0gbVdyaXRlci0+c3RhcnQobWV0YS5nZXQoKSk7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQpAQCAtMTExMyw3ICsxMzMzLDcgQEAKICAgICBpZiAobVByaXZhY3lTZW5zaXRpdmUgPT0gUFJ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gICAgICAgICAgICAgICAgbU9wUGFja2FnZU5hbWUsCisgICAgICAgICAgICAgICAgbUF0dHJpYnV0aW9uU291cmNlLAogICAgICAgICAgICAgICAgIHNvdXJjZVNhbXBsZVJhdGUsCiAgICAgICAgICAgICAgICAgbUF1ZGlvQ2hhbm5lbHMsCiAgICAgICAgICAgICAgICAgbVNhbXBsZVJhdGUsCi0gICAgICAgICAgICAgICAgbUNsaWVudFVpZCwKLSAgICAgICAgICAgICAgICBtQ2xpZW50UGlkLAogICAgICAgICAgICAgICAgIG1TZWxlY3RlZERldmljZUlkLAogICAgICAgICAgICAgICAgIG1TZWxlY3RlZE1pY0RpcmVjdGlvbiwKICAgICAgICAgICAgICAgICBtU2VsZWN0ZWRNaWNGaWVsZERpbWVuc2lvbik7CkBAIC0xMzMwLDcgKzE1NDgsNyBAQAogICAgICAgICBtVmlkZW9FbmNvZGVyU291cmNlID0gc291cmNlOwogICAgIH0KIAotICAgIG1Xcml0ZXIgPSBuZXcgQVJUUFdyaXRlcihtT3V0cHV0RmQpOworICAgIG1Xcml0ZXIgPSBuZXcgQVJUUFdyaXRlcihtT3V0cHV0RmQsIG1Mb2NhbElwLCBtTG9jYWxQb3J0LCBtUmVtb3RlSXAsIG1SZW1vdGVQb3J0LCBtTGFzdFNlcU5vKTsKICAgICBtV3JpdGVyLT5hZGRTb3VyY2Uoc291cmNlKTsKICAgICBtV3JpdGVyLT5zZXRMaXN0ZW5lcihtTGlzdGVuZXIpOwogCkBAIC0xNjYzLDYgKzE4ODEsMTAgQEAKICAgICBTaXplIHZpZGVvU2l6ZTsKICAgICB2aWRlb1NpemUud2lkdGggPSBtVmlkZW9XaWR0aDsKICAgICB2aWRlb1NpemUuaGVpZ2h0ID0gbVZpZGVvSGVpZ2h0OworICAgIHVpZF90IHVpZCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMoYWlkbDJsZWdhY3lfaW50MzJfdF91aWRfdChtQXR0cmlidXRpb25Tb3VyY2UudWlkKSk7CisgIC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gICAgQUxPR1coImNvdWxkIG5vdCBnZXQgdGhlIHBvd2VyIG1hbmFnZXIgc2VydmljZSIpOwogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBtUG93ZXJNYW5hZ2VyID0gaW50ZXJmYWNlX2Nhc3Q8SVBvd2VyTWFuYWdlcj4oYmluZGVyKTsKKyAgICAgICAgICAgICAgICBtUG93ZXJNYW5hZ2VyID0gaW50ZXJmYWNlX2Nhc3Q8b3M6OklQb3dlck1hbmFnZXI+KGJpbmRlcik7CiAgICAgICAgICAgICAgICAgYmluZGVyLT5saW5rVG9EZWF0aChtRGVhdGhSZWNpcGllbnQpOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIGlmIChtUG93ZXJNYW5hZ2VyICE9IE5VTEwpIHsKICAgICAgICAgICAgIHNwPElCaW5kZXI+IGJpbmRlciA9IG5ldyBCQmluZGVyKCk7CiAgICAgICAgICAgICBpbnQ2NF90IHRva2VuID0gSVBDVGhyZWFkU3RhdGU6OnNlbGYoKS0+Y2xlYXJDYWxsaW5nSWRlbnRpdHkoKTsKLSAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IG1Qb3dlck1hbmFnZXItPmFjcXVpcmVXYWtlTG9jaygKLSAgICAgICAgICAgICAgICAgICAgUE9XRVJNQU5BR0VSX1BBUlRJQUxfV0FLRV9MT0NLLAotICAgICAgICAgICAgICAgICAgICBiaW5kZXIsIFN0cmluZzE2KCJBV2FrZUxvY2siKSwgU3RyaW5nMTYoIm1lZGlhIikpOworICAgICAgICAgICAgYmluZGVyOjpTdGF0dXMgc3RhdHVzID0gbVBvd2VyTWFuYWdlci0+YWNxdWlyZVdha2VMb2NrKAorICAgICAgICAgICAgICAgICAgICBiaW5kZXIsIFBPV0VSTUFOQUdFUl9QQVJUSUFMX1dBS0VfTE9DSywKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nMTYoIkFXYWtlTG9jayIpLCBTdHJpbmcxNigibWVkaWEi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ICAgICAgIGJyZWFrOwogICAgICAgICB9CiAKKyAgICAgICAgY2FzZSBTb3VyY2U6OmtXaGF0SU1TUnhOb3RpY2U6CisgICAgICAgIHsKKyAgICAgICAgICAgIHNwPEFNZXNzYWdlPiBJTVNSeE5vdGljZTsKKyAgICAgICAgICAgIENIRUNLKG1zZy0+ZmluZE1lc3NhZ2UoIm1lc3NhZ2UiLCAmSU1TUnhOb3RpY2UpKTsKKyAgICAgICAgICAgIHNlbmRJTVNSeE5vdGljZShJTVNSeE5vdGljZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCiAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICBUUkVTUEFTUygpOwogICAgIH0KQEAgLTI4MTcsMTEgKzI4NTEsMTE5IEBACiAgICAgfQogfQogCit2b2lkIE51UGxheWVyOjpzZW5kSU1TUnhOb3RpY2UoY29uc3Qgc3A8QU1lc3NhZ2U+ICZtc2cpIHsKKyAgICBpbnQzMl90IHBheWxvYWRUeXBlOworCisgICAgQ0hFQ0sobXNnLT5maW5kSW50MzIoInBheWxvYWQtdHlwZSIsICZwYXlsb2FkVHlwZSkpOworCisgICAgaW50MzJfdCBydHBTZXEgPSAwLCBydHBUaW1lID0gMDsKKyAgICBpbnQ2NF90IG50cFRpbWUgPSAwLCByZWN2VGltZVVzID0gMDsKKworICAgIFBhcmNlbCBpbjsKKyAgICBpbi53cml0ZUludDMyKHBheWxvYWRUeXBlKTsKKworICAgIHN3aXRjaCAocGF5bG9hZFR5cGUpIHsKKyAgICAgICAgY2FzZSBBUlRQU291cmNlOjpSVFBfRklSU1RfUEFDS0VUOgorICAgICAgICB7CisgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQzMigicnRwLXRpbWUiLCAmcnRwVGltZSkpOworICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50MzIoInJ0cC1zZXEtbnVtIiwgJnJ0cFNlcSkpOworICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50NjQoInJlY3YtdGltZS11cyIsICZyZWN2VGltZVVzKSk7CisgICAgICAgICAgICBpbi53cml0ZUludDMyKHJ0cFRpbWUpOworICAgICAgICAgICAgaW4ud3JpdGVJbnQzMihydHBTZXEpOworICAgICAgICAgICAgaW4ud3JpdGVJbnQzMihyZWN2VGltZVVzID4+IDMyKTsKKyAgICAgICAgICAgIGluLndyaXRlSW50MzIocmVjdlRpbWVVcyAmIDB4RkZGRkZGRkYpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBBUlRQU291cmNlOjpSVENQX0ZJUlNUX1BBQ0tFVDoKKyAgICAgICAgeworICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50NjQoInJlY3YtdGltZS11cyIsICZyZWN2VGltZVVzKSk7CisgICAgICAgICAgICBpbi53cml0ZUludDMyKHJlY3ZUaW1lVXMgPj4gMzIpOworICAgICAgICAgICAgaW4ud3JpdGVJbnQzMihyZWN2VGltZVVzICYgMHhGRkZGRkZGRik7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIEFSVFBTb3VyY2U6OlJUQ1BfU1I6CisgICAgICAgIHsKKyAgICAgICAgICAgIENIRUNLKG1zZy0+ZmluZEludDMyKCJydHAtdGltZSIsICZydHBUaW1lKSk7CisgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQ2NCgibnRwLXRpbWUiLCAmbnRwVGltZSkpOworICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50NjQoInJlY3YtdGltZS11cyIsICZyZWN2VGltZVVzKSk7CisgICAgICAgICAgICBpbi53cml0ZUludDMyKHJ0cFRpbWUpOworICAgICAgICAgICAgaW4ud3JpdGVJbnQzMihudHBUaW1lID4+IDMyKTsKKyAgICAgICAgICAgIGluLndyaXRlSW50MzIobnRwVGltZSAmIDB4RkZGRkZGRkYpOworICAgICAgICAgICAgaW4ud3JpdGVJbnQzMihyZWN2VGltZVVzID4+IDMyKTsKKyAgICAgICAgICAgIGluLndyaXRlSW50MzIocmVjdlRpbWVVcyAmIDB4RkZGRkZGRkYpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBBUlRQU291cmNlOjpSVENQX1RTRkI6ICAgLy8gUlRDUCBUU0ZCCisgICAgICAgIGNhc2UgQVJUUFNvdXJjZTo6UlRDUF9QU0ZCOiAgIC8vIFJUQ1AgUFNGQgorICAgICAgICBjYXNlIEFSVFBTb3VyY2U6OlJUUF9BVVRPRE9XTjoKKyAgICAgICAgeworICAgICAgICAgICAgaW50MzJfdCBmZWVkYmFja1R5cGUsIGlkOworICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50MzIoImZlZWRiYWNrLXR5cGUiLCAmZmVlZGJhY2tUeXBlKSk7CisgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQzMigic2VuZGVyIiwgJmlkKSk7CisgICAgICAgICAgICBpbi53cml0ZUludDMyKGZlZWRiYWNrVHlwZSk7CisgICAgICAgICAgICBpbi53cml0ZUludDMyKGlkKTsKKyAgICAgICAgICAgIGlmIChwYXlsb2FkVHlwZSA9PSBBUlRQU291cmNlOjpSVENQX1RTRkIpIHsKKyAgICAgICAgICAgICAgICBpbnQzMl90IGJpdHJhdGU7CisgICAgICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50MzIoImJpdC1yYXRlIiwgJmJpdHJhdGUpKTsKKyAgICAgICAgICAgICAgICBpbi53cml0ZUludDMyKGJpdHJhdGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBBUlRQU291cmNlOjpSVFBfUVVBTElUWToKKyAgICAgICAgY2FzZSBBUlRQU291cmNlOjpSVFBfUVVBTElUWV9FTUM6CisgICAgICAgIHsKKyAgICAgICAgICAgIGludDMyX3QgZmVlZGJhY2tUeXBlLCBiaXRyYXRlOworICAgICAgICAgICAgaW50MzJfdCBoaWdoZXN0U2VxTnVtLCBiYXNlU2VxTnVtLCBwcmV2RXhwZWN0ZWQ7CisgICAgICAgICAgICBpbnQzMl90IG51bUJ1ZlJlY3YsIHByZXZOdW1CdWZSZWN2OworICAgICAgICAgICAgaW50MzJfdCBsYXRlc3RSdHBUaW1lLCBqYlRpbWVNcywgcnRwUnRjcFNyVGltZUdhcE1zOworICAgICAgICAgICAgaW50NjRfdCByZWN2VGltZVVzOworICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50MzIoImZlZWRiYWNrLXR5cGUiLCAmZmVlZGJhY2tUeXBlKSk7CisgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQzMigiYml0LXJhdGUiLCAmYml0cmF0ZSkpOworICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50MzIoImhpZ2hlc3Qtc2VxLW51bSIsICZoaWdoZXN0U2VxTnVtKSk7CisgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQzMigiYmFzZS1zZXEtbnVtIiwgJmJhc2VTZXFOdW0pKTsKKyAgICAgICAgICAgIENIRUNLKG1zZy0+ZmluZEludDMyKCJwcmV2LWV4cGVjdGVkIiwgJnByZXZFeHBlY3RlZCkpOworICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50MzIoIm51bS1idWYtcmVjdiIsICZudW1CdWZSZWN2KSk7CisgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQzMigicHJldi1udW0tYnVmLXJlY3YiLCAmcHJldk51bUJ1ZlJlY3YpKTsKKyAgICAgICAgICAgIENIRUNLKG1zZy0+ZmluZEludDMyKCJsYXRlc3QtcnRwLXRpbWUiLCAmbGF0ZXN0UnRwVGltZSkpOworICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50NjQoInJlY3YtdGltZS11cyIsICZyZWN2VGltZVVzKSk7CisgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQzMigicnRwLWppdHRlci10aW1lLW1zIiwgJmpiVGltZU1zKSk7CisgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQzMigicnRwLXJ0Y3Bzci10aW1lLWdhcC1tcyIsICZydHBSdGNwU3JUaW1lR2FwTXMpKTsKKyAgICAgICAgICAgIGluLndyaXRlSW50MzIoZmVlZGJhY2tUeXBlKTsKKyAgICAgICAgICAgIGluLndyaXRlSW50MzIoYml0cmF0ZSk7CisgICAgICAgICAgICBpbi53cml0ZUludDMyKGhpZ2hlc3RTZXFOdW0pOworICAgICAgICAgICAgaW4ud3JpdGVJbnQzMihiYXNlU2VxTnVtKTsKKyAgICAgICAgICAgIGluLndyaXRlSW50MzIocHJldkV4cGVjdGVkKTsKKyAgICAgICAgICAgIGluLndyaXRlSW50MzIobnVtQnVmUmVjdik7CisgICAgICAgICAgICBpbi53cml0ZUludDMyKHByZXZOdW1CdWZSZWN2KTsKKyAgICAgICAgICAgIGluLndyaXRlSW50MzIobGF0ZXN0UnRwVGltZSk7CisgICAgICAgICAgICBpbi53cml0ZUludDMyKHJlY3ZUaW1lVXMgPj4gMzIpOworICAgICAgICAgICAgaW4ud3JpdGVJbnQzMihyZWN2VGltZVVzICYgMHhGRkZGRkZGRik7CisgICAgICAgICAgICBpbi53cml0ZUludDMyKGpiVGltZU1zKTsKKyAgICAgICAgICAgIGluLndyaXRlSW50MzIocnRwUnRjcFNyVGltZUdhcE1zKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgQVJUUFNvdXJjZTo6UlRQX0NWTzoKKyAgICAgICAgeworICAgICAgICAgICAgaW50MzJfdCBjdm87CisgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQzMigiY3ZvIiwgJmN2bykpOworICAgICAgICAgICAgaW4ud3JpdGVJbnQzMihjdm8pOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgYnJlYWs7CisgICAgfQor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GZvciBkZWNvZGVyCiAgICAgICAgIGlmIChidWZmZXItPm1ldGEoKS0+ZmluZEludDMyKCJlb3MiLCAmZW9zKSAmJiBlb3MpIHsKICAgICAgICAgICAgIGZsYWdzIHw9IE1lZGlhQ29kZWM6OkJVRkZFUl9GTEFHX0VPUzsKQEAgLTEwNTgsNiArMTA2NCwyNCBAQAogICAgICAgICAgICAgZmxhZ3MgfD0gTWVkaWFDb2RlYzo6QlVGRkVSX0ZMQUdfQ09ERUNDT05GSUc7CiAgICAgICAgIH0KIAorICAgICAgICBpZiAoYnVmZmVyLT5tZXRhKCktPmZpbmRJbnQzMigiY3ZvIiwgKGludDMyX3QqKSZjdm8pKSB7CisgICAgICAgICAgICBBTE9HVigiWyVzXSBjdm8oJWQpIGZvdW5kIGF0ICVsbGQgdXMiLCBtQ29tcG9uZW50TmFtZS5jX3N0cigpLCBjdm8sIChsb25nIGxvbmcpdGltZVVzKTsKKyAgICAgICAgICAgIHN3aXRjaCAoY3ZvKSB7CisgICAgICAgICAgICAgICAgY2FzZSAwOgorICAgICAgICAgICAgICAgICAgICBjb2RlY0J1ZmZlci0+bWV0YSgpLT5zZXRJbnQzMigiY3ZvIiwgTWVkaWFDb2RlYzo6Q1ZPX0RFR1JFRV8wKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSAxOgorICAgICAgICAgICAgICAgICAgICBjb2RlY0J1ZmZlci0+bWV0YSgpLT5zZXRJbnQzMigiY3ZvIiwgTWVkaWFDb2RlYzo6Q1ZPX0RFR1JFRV85MCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgMjoKKyAgICAgICAgICAgICAgICAgICAgY29kZWNCdWZmZXItPm1ldGEoKS0+c2V0SW50MzIoImN2byIsIE1lZGlhQ29kZWM6OkNWT19ERUdSRUVfMTgwKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY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XJjZSA9IG5ldyBBUGFja2V0U291cmNlKGRlc2MsIGkgKyAxKTsKKworICAgICAgICBpbnQzMl90IHRpbWVTY2FsZTsKKyAgICAgICAgc3A8TWV0YURhdGE+IGZvcm1hdCA9IGdldFRyYWNrRm9ybWF0KGksICZ0aW1lU2NhbGUpOworICAgICAgICBzcDxBbm90aGVyUGFja2V0U291cmNlPiBzb3VyY2UgPSBuZXcgQW5vdGhlclBhY2tldFNvdXJjZShmb3JtYXQpOworCisgICAgICAgIGlmIChpbmZvLT5tSXNBdWRpbykgeworICAgICAgICAgICAgbUF1ZGlvVHJhY2sgPSBzb3VyY2U7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtVmlkZW9UcmFjayA9IHNvdXJjZTsKKyAgICAgICAgfQorCisgICAgICAgIGluZm8tPm1Tb3VyY2UgPSBzb3VyY2U7CisgICAgICAgIGluZm8tPm1SVFBUaW1lID0gMDsKKyAgICAgICAgaW5mby0+bU5vcm1hbFBsYXl0aW1lVXMgPSAwOworICAgICAgICBpbmZvLT5tTlBUTWFwcGluZ1ZhbGlkID0gZmFsc2U7CisgICAgfQorCisgICAgaWYgKG1JblByZXBhcmF0aW9uUGhhc2UpIHsKKyAgICAgICAgbUluUHJlcGFyYXRpb25QaGFzZSA9IGZhbHNlOworICAgICAgICBub3RpZnlQcmVwYXJlZCgpOworICAgIH0KK30KKwordm9pZCBOdVBsYXllcjo6UlRQU291cmNlOjpzdGFydCgpIHsKK30KKwordm9pZCBOdVBsYXllcjo6UlRQU291cmNlOjpwYXVzZSgpIHsKKyAgICBtU3RhdGUgPSBQQVVTRUQ7Cit9CisKK3ZvaWQgTnVQbGF5ZXI6OlJUUFNvdXJjZTo6cmVzdW1lKCkgeworICAgIG1TdGF0ZSA9IENPTk5FQ1RJTkc7Cit9CisKK3ZvaWQgTnVQbGF5ZXI6OlJUUFNvdXJjZTo6c3RvcCgpIHsKKyAgICBpZiAobUxvb3BlciA9PSBOVUxMKSB7CisgICAgICAgIH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kaW9UcmFjayAhPSBOVUxMICYmIG1BdWRpb1RyYWNrLT5pc0ZpbmlzaGVkKG1lZGlhRHVyYXRpb25VcykpCisgICAgICAgICAgICB8fCAobVZpZGVvVHJhY2sgIT0gTlVMTCAmJiBtVmlkZW9UcmFjay0+aXNGaW5pc2hlZChtZWRpYUR1cmF0aW9uVXMpKSkgeworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBzdGF0dXNfdCBlcnI7CisgICAgaW50NjRfdCBkdXJhdGlvblVzOworICAgIGlmIChtQXVkaW9UcmFjayAhPSBOVUxMCisgICAgICAgICAgICAmJiAoZHVyYXRpb25VcyA9IG1BdWRpb1RyYWNrLT5nZXRCdWZmZXJlZER1cmF0aW9uVXMoJmVycikpCisgICAgICAgICAgICAgICAgICAgIDwga01pbkR1cmF0aW9uVXMKKyAgICAgICAgICAgICYmIGVyciA9PSBPSykgeworICAgICAgICBBTE9HVigiYXVkaW8gdHJhY2sgZG9lc24ndCBoYXZlIGVub3VnaCBkYXRhIHlldC4gKCUuMmYgc2VjcyBidWZmZXJlZCkiLAorICAgICAgICAgICAgICBkdXJhdGlvblVzIC8gMUU2KTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGlmIChtVmlkZW9UcmFjayAhPSBOVUxMCisgICAgICAgICAgICAmJiAoZHVyYXRpb25VcyA9IG1WaWRlb1RyYWNrLT5nZXRCdWZmZXJlZER1cmF0aW9uVXMoJmVycikpCisgICAgICAgICAgICAgICAgICAgIDwga01pbkR1cmF0aW9uVXMKKyAgICAgICAgICAgICYmIGVyciA9PSBPSykgeworICAgICAgICBBTE9HVigidmlkZW8gdHJhY2sgZG9lc24ndCBoYXZlIGVub3VnaCBkYXRhIHlldC4gKCUuMmYgc2VjcyBidWZmZXJlZCkiLAorICAgICAgICAgICAgICBkdXJhdGlvblVzIC8gMUU2KTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHJldHVybiB0c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NKSB7CisgICAgICAgICAgICAgICAgc291cmNlLT5zaWduYWxFT1MoRVJST1JfRU5EX09GX1NUUkVBTSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX0VORF9PRl9TVFJFQU07CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIElmIHRoaXMgc291cmNlIGhhcyBkZXRlY3RlZCBuZWFyIGVuZCwgZ2l2ZSBpdCBzb21lIHRpbWUgdG8gcmV0cmlldmUgbW9yZQorICAgICAgICAgICAgLy8gZGF0YSBiZWZvcmUgc2lnbmFsaW5nIEVPUworICAgICAgICAgICAgaWYgKHNvdXJjZS0+aXNGaW5pc2hlZChtZWRpYUR1cmF0aW9uVXMpKSB7CisgICAgICAgICAgICAgICAgaW50NjRfdCBlb3NUaW1lb3V0ID0gYXVkaW8gPyBtRU9TVGltZW91dEF1ZGlvIDogbUVPU1RpbWVvdXRWaWRlbzsKKyAgICAgICAgICAgICAgICBpZiAoZW9zVGltZW91dCA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIHNldEVPU1RpbWVvdXQoYXVkaW8sIEFMb29wZXI6OkdldE5vd1VzKCkpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoKEFMb29wZXI6OkdldE5vd1VzKCkgLSBlb3NUaW1lb3V0KSA+IGtOZWFyRU9TVGltZW91dFVzKSB7CisgICAgICAgICAgICAgICAgICAgIHNldEVPU1RpbWVvdXQoYXVkaW8sIDApOworICAgICAgICAgICAgICAgICAgICBzb3VyY2UtPnNpZ25hbEVPUyhFUlJPUl9FTkRfT0ZfU1RSRUFNKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX0VORF9PRl9TVFJFQU07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiAtRVdPVUxEQkxPQ0s7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICghKG90aGVyU291cmNlICE9IE5VTEwgJiYgb3RoZXJTb3VyY2Ut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b25Qb2xsQnVmZmVyaW5nKCkgeworICAgIHNjaGVkdWxlUG9sbEJ1ZmZlcmluZygpOworfQorCitib29sIE51UGxheWVyOjpSVFBTb3VyY2U6OmlzUmVhbFRpbWUoKSBjb25zdCB7CisgICAgQUxPR0QoIlJUUFNvdXJjZTo6aXNSZWFsVGltZT0lZCIsIHRydWUpOworICAgIHJldHVybiB0cnVlOworfQorCit2b2lkIE51UGxheWVyOjpSVFBTb3VyY2U6Om9uTWVzc2FnZVJlY2VpdmVkKGNvbnN0IHNwPEFNZXNzYWdlPiAmbXNnKSB7CisgICAgQUxPR1YoIm9uTWVzc2FnZVJlY2VpdmVkID0lZCIsIG1zZy0+d2hhdCgpKTsKKworICAgIHN3aXRjaCAobXNnLT53aGF0KCkpIHsKKyAgICAgICAgY2FzZSBrV2hhdEFjY2Vzc1VuaXRDb21wbGV0ZToKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBDT05ORUNUSU5HKSB7CisgICAgICAgICAgICAgICAgbVN0YXRlID0gQ09OTkVDVEVEOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQzMl90IHRpbWVVcGRhdGU7CisgICAgICAgICAgICAvLyJ0aW1lLXVwZGF0ZSIgcmFpc2VkIGZyb20gQVJUUENvbm5lY3Rpb246OnBhcnNlU1IoKQorICAgICAgICAgICAgaWYgKG1zZy0+ZmluZEludDMyKCJ0aW1lLXVwZGF0ZSIsICZ0aW1lVXBkYXRlKSAmJiB0aW1lVXBkYXRlKSB7CisgICAgICAgICAgICAgICAgc2l6ZV90IHRyYWNrSW5kZXg7CisgICAgICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kU2l6ZSgidHJhY2tJbmRleCIsICZ0cmFja0luZGV4KSk7CisKKyAgICAgICAgICAgICAgICB1aW50MzJfdCBydHBUaW1lOworICAgICAgICAgICAgICAgIHVpbnQ2NF90IG50cFRpbWU7CisgICAgICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50MzIoInJ0cC10aW1lIiwgKGludDMyX3QgKikmcnRwVGltZSkpOworICAgICAgICAgICAgICAgIENIRUNLKG1zZy0+ZmluZEludDY0KCJudHAtdGltZSIsIChpbnQ2NF90ICopJm50cFRpbWUpKTsKKworICAgICAgICAgICAgICAgIG9uVGltZVVwZGF0ZSh0cmFja0luZGV4LCBydHBUaW1lLCBudHBUaW1lKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaW50MzJfdCBJTVNSeE5vdGljZTsKKyAgICAgICAgICAgIGlmIChtc2ctPmZpbmRJbnQzMigicnRjcC1ldmVudCIsICZJTVNSeE5vdGljZSkpIHsKKyAgICAgICAgICAgICAgICBpbnQzMl90IHBheWxvYWRUeXBlID0gMCwgZmVlZGJhY2tUeXBlID0gMDsKKyAgICAgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQzMigicGF5bG9hZC10eXBlIiwgJnBheWxvYWRUeXBlKSk7CisgICAgICAgICAgICAgICAgbXNnLT5maW5kSW50MzIoImZlZWRiYWNrLXR5cGUiLCAmZmVlZGJhY2tUeXBlKTsKKworICAgICAgICAgICAgICAgIHNwPEFNZXNzYWdlPiBub3RpZnkgPSBkdXBOb3RpZnkoKTsKKyAgICAgICAgICAgICAgICBub3RpZnktPnNldEludDMyKCJ3aGF0Iiwga1doYXRJTVNSeE5vdGljZSk7CisgICAgICAgICAgICAgICAgbm90aWZ5LT5zZXRNZXNzYWdlKCJtZXNzYWdlIiwgbXNnKTsKKyAgICAgICAgICAgICAgICBub3RpZnktPnBvc3QoKTsKKworICAgICAgICAgICAgICAgIEFMT0dWKCJJTVNSeE5vdGljZSBcdFx0IHBheWxvYWQgOiAlZCBmZWVkYmFjayA6ICVkIiwKKyAgICAgICAgICAgICAgICAgICAgICBwYXlsb2FkVHlwZSwgZmVlZGJhY2tUeXBlKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc2l6ZV90IHRyYWNrSW5kZXg7CisgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRTaXplKCJ0cmFja0luZGV4IiwgJnRyYWNrSW5kZXgpKTsKKworICAgICAgICAgICAgc3A8QUJ1ZmZlcj4gYWNjZXNzVW5pdDsKKyAgICAgICAgICAgIGlmIChtc2ctPmZpbmRCdWZmZXIoImFjY2Vzcy11bml0IiwgJmFjY2Vzc1VuaXQpID09IGZhbHNlKSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGludDMyX3QgZGFtYWdlZDsKKyAgICAgICAgICAgIGlmIChhY2Nlc3NVbml0LT5tZXRhKCktPmZpbmRJbnQzMigiZGFtYWdlZCIsICZkYW1hZ2VkKQorICAgICAgICAgICAgICAgICAgICAmJiBkYW1hZ2VkKSB7CisgICAgICAgICAgICAgICAgQUxPR0QoImRyb3BwaW5nIGRhbWFnZWQgYWNjZXNzIHVuaXQuIik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIEltcGxpY2l0bHkgYXNzZXJ0IG9uIHZhbGlkIHRyYWNrSW5kZXggaGVyZSwgd2hpY2ggd2UgZW5zdXJlIGJ5CisgICAgICAgICAgICAvLyBuZXZlciByZW1vdmluZyB0cmFja3MuCisgICAgICAgICAgICBUcmFja0luZm8gKmluZm8gPSAmbVRyYWNrcy5lZGl0SXRlbUF0KHRyYWNrSW5kZXgpOworCisgICAgICAgICAgICBzcDxBbm90aGVyUGFja2V0U291cmNlPiBzb3VyY2UgPSBpbmZvLT5tU291cmNlOworICAgICAgICAgICAgaWYgKHNvdXJjZSAhPSBOVUxMKSB7CisgICAgICAgICAgICAgICAgdWludDMyX3QgcnRwVGltZTsKKyAgICAgICAgICAgICAgICBDSEVDSyhhY2Nlc3NVbml0LT5tZXRhKCktPmZpbmRJbnQzMigicnRwLXRpbWUiLCAoaW50MzJfdCAqKSZydHBUaW1lKSk7CisKKyAgICAgICAgICAgICAgICAvKiBBbm90aGVyUGFja2V0U291cmNlIG1ha2UgYW4gYXNzZXJ0aW9uIGlmIHRoZXJlIGlzIG5vIG50cCBwcm92aWRlZAorICAgICAgICAgICAgICAgICAgIFJUUFNvdXJjZSBzaG91bGQgcHJvdmlkZSBudHBVcyBhbGwgdGhlIHRpbWVzLgorICAgICAgICAgICAgICAgIGlmICghaW5mby0+bU5QVE1hcHBpbmdWYWxpZCkgeworICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIGEgbGl2ZSBzdHJlYW0sIHdlIGRpZG4ndCByZWNlaXZlIGFueSBub3JtYWwKKyAgICAgICAgICAgICAgICAgICAgLy8gcGxheXRpbWUgbWFwcGluZy4gV2Ugd29uJ3QgbWFwIHRvIG5wdCB0aW1lLgorICAgICAgICAgICAgICAgICAgICBzb3VyY2UtPnF1ZXVlQWNjZXNzVW5pdChhY2Nlc3NVbml0KTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaW50NjRfdCBucHRVcyA9CisgICAgICAgICAgICAgICAgICAgICgoZG91YmxlKXJ0cFRpbWUgLSAoZG91YmxlKWluZm8tPm1SVFBUaW1lKQorICAgICAgICAgICAgICAgICAgICAgICAgLyBpbmZvLT5tVGltZVNjYWxlCisgICAgICAgICAgICAgICAgICAgICAgICAqIDEwMDAwMDBsbAorICAgICAgICAgICAgICAgICAgICAgICAgKyBpbmZvLT5tTm9ybWFsUGxheXRpbWVVczsKKworICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgYWNjZXNzVW5pdC0+bWV0YSgpLT5zZXRJbnQ2NCgidGltZVVzIiwgQUxvb3Blcjo6R2V0Tm93VXMoKSk7CisKKyAgICAgICAgICAgICAgICBzb3VyY2UtPnF1ZXVlQWNjZXNzVW5pdChhY2Nlc3NVbml0KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBrV2hhdERpc2Nvbm5lY3Q6CisgICAgICAgIHsKKyAgICAgICAgICAgIHNwPEFSZXBseVRva2VuPiByZXBseUlEOworICAgICAgICAgICAgQ0hFQ0sobXNnLT5zZW5kZXJBd2FpdHNSZXNwb25zZSgmcmVwbHlJRCkpOworCisgICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG1UcmFja3Muc2l6ZSgpOyArK2kpIHsKKyAgICAgICAgICAgICAgICBUcmFja0luZm8gKmluZm8gPSAmbVRyYWNrcy5lZGl0SXRlbUF0KGkpOworCisgICAgICAgICAgICAgICAgaWYgKGluZm8tPm1Jc0F1ZGlvKSB7CisgICAgICAgICAgICAgICAgICAgIG1BdWRpb1RyYWNrLT5zaWduYWxFT1MoRVJST1JfRU5EX09GX1NUUkVBTSk7CisgICAgICAgICAgICAgICAgICAgIG1BdWRpb1RyYWNrID0gTlVMTDsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoIm1BdWRpb1RyYWNrIGRpc2Nvbm5lY3RlZCIpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1WaWRlb1RyYWNrLT5zaWduYWxFT1MoRVJST1JfRU5EX09GX1NUUkVBTSk7CisgICAgICAgICAgICAgICAgICAgIG1WaWRlb1RyYWNrID0gTlVMTDsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoIm1WaWRlb1RyYWNrIGRpc2Nvbm5lY3RlZCIpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIG1SVFBDb25uLT5yZW1vdmVTdHJlYW0oaW5mby0+bVJUUFNvY2tldCwgaW5mby0+bVJUQ1BTb2NrZXQpOworICAgICAgICAgICAgICAgIGNsb3NlKGluZm8tPm1SVFBTb2NrZXQpOworICAgICAgICAgICAgICAgIGNsb3NlKGluZm8tPm1SVENQU29ja2V0KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVRyYWNrcy5jbGVhcigpOworICAgICAgICAgICAgbUZpcnN0QWNjZXNzVW5pdCA9IHRydWU7CisgICAgICAgICAgICBtQWxsVHJhY2tzSGF2ZVRpbWUgPSBmYWxzZTsKKyAgICAgICAgICAgIG1OVFBBbmNob3JVcyA9IC0xOworICAgICAgICAgICAgbU1lZGlhQW5jaG9yVXMgPSAtMTsKKyAgICAgICAgICAgIG1MYXN0TWVkaWFUaW1lVXMgPSAtMTsKKyAgICAgICAgICAgIG1OdW1BY2Nlc3NVbml0c1JlY2VpdmVkID0gMDsKKyAgICAgICAgICAgIG1SZWNlaXZlZEZpcnN0UlRDUFBhY2tldCA9IGZhbHNlOworICAgICAgICAgICAgbVJlY2VpdmVkRmlyc3RSVFBQYWNrZXQgPSBmYWxzZTsKKyAgICAgICAgICAgIG1QYXVzaW5nID0gZmFsc2U7CisgICAgICAgICAgICBtUGF1c2VHZW5lcmF0aW9uID0gMDsKKworICAgICAgICAgICAgKG5ldyBBTWVzc2FnZSktPnBvc3RSZXBseShyZXBseUlEKTsKKworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBrV2hhdFBvbGxCdWZmZXJpbmc6CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIFRSRVNQQVNTKCk7CisgICAgfQorfQorCit2b2lkIE51UGxheWVyOjpSVFBTb3VyY2U6OnNldFRhcmdldEJpdHJhdGUoaW50MzJfdCBiaXRyYXRlKSB7CisgICAgbVJUUENvbm4tPnNldFRhcmdldEJpdHJhdGUoYml0cmF0ZSk7Cit9CisKK3ZvaWQgTnVQbGF5ZXI6OlJUUFNvdXJjZTo6b25UaW1lVXBkYXRlKGludDMyX3QgdHJhY2tJbmRleCwgdWludDMyX3QgcnRwVGltZSwgdWludDY0X3QgbnRwVGltZSkgeworICAgIEFMT0dWKCJvblRpbWVVcGRhdGUgdHJhY2sgJWQsIHJ0cFRpbWUgPSAweCUwOHgsIG50cFRpbWUgPSAlIzAxNmxseCIsCisgICAgICAgICB0cmFja0luZGV4LCBydHBUaW1lLCAobG9uZyBsb25nKW50cFRpbWUpOworCisgICAgLy8gY29udmVydCBudHBUaW1lIGluIFEzMiBzZWNvbmRzIHRvIG1pY3Jvc2Vjb25kcy4gTm90ZTogdGhpcyB3aWxsIG5vdCBsb3NlIHByZWNpc2lvbgorICAgIC8vIGJlY2F1c2UgbnRwVGltZVVzIGlzIGF0IG1vc3QgNTIgYml0cyAoZG91YmxlIGhvbGRzIDUzIGJpdHMpCisgICAgaW50NjRfdCBudHBUaW1lVXMgPSAoaW50NjRfdCkobnRwVGltZSAqIDFFNiAvICgxbGwgPDwgMzIpKTsKKworICAgIFRyYWNrSW5mbyAqdHJhY2sgPSAmbVRyYWNrcy5lZGl0SXRlbUF0KHRyYWNrSW5kZXgpOworCisgICAgdHJhY2stPm1SVFBBbmNob3IgPSBydHBUaW1lOworICAgIHRyYWNrLT5tTlRQQW5jaG9yVXMgPSBudHBUaW1lVXM7CisKKyAgICBpZiAobU5UUEFuY2hvclVzIDwgMCkgeworICAgICAgICBtTlRQQW5jaG9yVXMgPSBudHBUaW1lVXM7CisgICAgICAgIG1NZWRpYUFuY2hvclVzID0gbUxhc3RNZWRpYVRpbWVVczsKKyAgICB9CisKKyAgICBpZiAoIW1BbGxUcmFja3NIYXZlVGltZSkgeworICAgICAgICBib29sIGFsbFRyYWNrc0hhdmVUaW1lID0gKG1UcmFja3Muc2l6ZSgpID4gMCk7CisgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgbVRyYWNrcy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgVHJhY2tJbmZvICp0cmFjayA9ICZtVHJhY2tzLmVkaXRJdGVtQXQoaSk7CisgICAgICAgICAgICBpZiAodHJhY2stPm1OVFBBbmNob3JVcyA8IDApIHsKKyAgICAgICAgICAgICAgICBhbGxUcmFja3NIYXZlVGltZSA9IGZhbHNlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChhbGxUcmFja3NIYXZlVGltZSkgeworICAgICAgICAgICAgbUFsbFRyYWNrc0hhdmVUaW1lID0gdHJ1ZTsKKyAgICAgICAgICAgIEFMT0dJKCJUaW1lIG5vdyBlc3RhYmxpc2hlZCBmb3IgYWxsIHRyYWNrcy4iKTsKKyAgICAgICAgfQorICAgIH0KKyAgICBpZiAobUFsbFRyYWNrc0hhdmVUaW1lICYmIGRhdGFSZWNlaXZlZE9uQWxsQ2hhbm5lbHMoKSkgeworICAgICAgICAvLyBUaW1lIGlzIG5vdyBlc3RhYmxpc2hlZCwgbGV0cyBzdGFydCB0aW1lc3RhbXBpbmcgaW1tZWRpYXRlbHkKKyAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBtVHJhY2tzLnNpemUoKTsgKytpKSB7CisgICAgICAgICAgICBUcmFja0luZm8gKnRyYWNrSW5mbyA9ICZtVHJhY2tzLmVkaXRJdGVtQXQoaSk7CisgICAgICAgICAgICB3aGlsZSAoIXRyYWNrSW5mby0+bVBhY2tldHMuZW1wdHkoKSkgeworICAgICAgICAgICAgICAgIHNwPEFCdWZmZXI+IGFjY2Vzc1VuaXQgPSAqdHJhY2tJbmZvLT5tUGFja2V0cy5iZWdpbigpOworICAgICAgICAgICAgICAgIHRyYWNrSW5mby0+bVBhY2tldHMuZXJhc2UodHJhY2tJbmZvLT5tUGFja2V0cy5iZWdpbigpKTsKKworICAgICAgICAgICAgICAgIGlmIChhZGRNZWRpYVRpbWVzdGFtcChpLCB0cmFja0luZm8sIGFjY2Vzc1VuaXQpKSB7CisgICAgICAgICAgICAgICAgICAgIHBvc3RRdWV1ZUFjY2Vzc1VuaXQoaSwgYWNjZXNzVW5pdCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQorCitib29sIE51UGxheWVyOjpSVFBTb3VyY2U6OmFkZE1lZGlhVGltZXN0YW1wKAorICAgICAgICBpbnQzMl90IHRyYWNrSW5kZXgsIGNvbnN0IFRyYWNrSW5mbyAqdHJhY2ssCisgICAgICAgIGNvbnN0IHNwPEFCdWZmZXI+ICZhY2Nlc3NVbml0KSB7CisKKyAgICB1aW50MzJfdCBydHBUaW1lOworICAgIENIRUNLKGFjY2Vzc1VuaXQtPm1ldGEoKS0+ZmluZEludDMyKAorICAgICAgICAgICAgICAgICJydHAtdGltZSIsIChpbnQzMl90ICopJnJ0cFRpbWUpKTsKKworICAgIGludDY0X3QgcmVsUnRwVGltZVVzID0KKyAgICAgICAgKCgoaW50NjRfdClydHBUaW1lIC0gKGludDY0X3QpdHJhY2stPm1SVFBBbmNob3IpICogMTAwMDAwMGxsKQorICAgICAgICAvIHRyYWNrLT5tVGltZVNjYWxlOworCisgICAgaW50NjRfdCBudHBUaW1lVXMgPSB0cmFjay0+bU5UUEFuY2hvclVzICsgcmVsUnRwVGltZVVzOworCisgICAgaW50NjRfdCBtZWRpYVRpbWVVcyA9IG1NZWRpYUFuY2hvclVzICsgbnRwVGltZVVzIC0gbU5UUEFuY2hvclVzOworCisgICAgaWYgKG1lZGlhVGltZVVzID4gbUxhc3RNZWRpYVRpbWVVcykgeworICAgICAgICBtTGFzdE1lZGlhVGltZVVzID0gbWVkaWFUaW1lVXM7CisgICAgfQorCisgICAgaWYgKG1lZGlhVGltZVVzIDwgMCkgeworICAgICAgICBBTE9HVigiZHJvcHBpbmcgZWFybHkgYWNjZXNzVW5pdC4iKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIEFMT0dWKCJ0cmFjayAlZCBydHBUaW1lPSV1IG1lZGlhVGltZVVzID0gJWxsZCB1cyAoJS4yZiBzZWNzKSIsCisgICAgICAgICAgICB0cmFja0luZGV4LCBydHBUaW1lLCAobG9uZyBsb25nKW1lZGlhVGltZVVzLCBtZWRpYVRpbWVVcyAvIDFFNik7CisKKyAgICBhY2Nlc3NVbml0LT5tZXRhKCktPnNldEludDY0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zcyBhIHZhbHVlIiwgY3BhcmFtcyk7CisgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgICAgICB9CisgICAgICAgIFN0cmluZzgga2V5KGtleV9zdGFydCwgZXF1YWxfcG9zIC0ga2V5X3N0YXJ0KTsKKyAgICAgICAgVHJpbVN0cmluZygma2V5KTsKKyAgICAgICAgaWYgKGtleS5sZW5ndGgoKSA9PSAwKSB7CisgICAgICAgICAgICBBTE9HRSgiUGFyYW1ldGVycyAlcyBjb250YWlucyBhbiBlbXB0eSBrZXkiLCBjcGFyYW1zKTsKKyAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgICAgIH0KKyAgICAgICAgY29uc3QgY2hhciAqdmFsdWVfc3RhcnQgPSBlcXVhbF9wb3MgKyAxOworICAgICAgICBjb25zdCBjaGFyICpzZW1pY29sb25fcG9zID0gc3RyY2hyKHZhbHVlX3N0YXJ0LCAnOycpOworICAgICAgICBTdHJpbmc4IHZhbHVlOworICAgICAgICBpZiAoc2VtaWNvbG9uX3BvcyA9PSBOVUxMKSB7CisgICAgICAgICAgICB2YWx1ZS5zZXRUbyh2YWx1ZV9zdGFydCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB2YWx1ZS5zZXRUbyh2YWx1ZV9zdGFydCwgc2VtaWNvbG9uX3BvcyAtIHZhbHVlX3N0YXJ0KTsKKyAgICAgICAgfQorICAgICAgICBpZiAoc2V0UGFyYW1ldGVyKGtleSwgdmFsdWUpICE9IE9LKSB7CisgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgICAgICB9CisgICAgICAgIGlmIChzZW1pY29sb25fcG9zID09IE5VTEwpIHsKKyAgICAgICAgICAgIGJyZWFrOyAgLy8gUmVhY2hlcyB0aGUgZW5kCisgICAgICAgIH0KKyAgICAgICAga2V5X3N0YXJ0ID0gc2VtaWNvbG9uX3BvcyArIDE7CisgICAgfQorICAgIHJldHVybiBPSzsKK30KKwordm9pZCBOdVB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W50MzJfdCBtUGF5bG9hZFR5cGU7CisgICAgICAgIFN0cmluZzggbU1pbWVUeXBlOworICAgICAgICBTdHJpbmc4IG1Db2RlY05hbWU7CisgICAgICAgIGludDMyX3QgbUNvZGVjUHJvZmlsZTsKKyAgICAgICAgaW50MzJfdCBtQ29kZWNMZXZlbDsKKyAgICAgICAgaW50MzJfdCBtV2lkdGg7CisgICAgICAgIGludDMyX3QgbUhlaWdodDsKKyAgICAgICAgU3RyaW5nOCBtTG9jYWxJcDsKKyAgICAgICAgU3RyaW5nOCBtUmVtb3RlSXA7CisgICAgICAgIGludDMyX3QgbUxvY2FsUG9ydDsKKyAgICAgICAgaW50MzJfdCBtUmVtb3RlUG9ydDsKKyAgICAgICAgaW50NjRfdCBtU29ja2V0TmV0d29yazsKKyAgICAgICAgaW50MzJfdCBtVGltZVNjYWxlOworICAgICAgICBpbnQzMl90IG1BUzsKKworICAgICAgICAvKiBSVFAgaml0dGVyIGJ1ZmZlciB0aW1lIGluIG1pbGxpc2Vjb25kcyAqLworICAgICAgICB1aW50MzJfdCBtSmJUaW1lTXM7CisgICAgICAgIC8qIFVuaXF1ZSBJRCBpbmRpY2F0ZXMgaXRzZWxmICovCisgICAgICAgIHVpbnQzMl90IG1TZWxmSUQ7CisgICAgICAgIC8qIGV4dG1hcDo8dmFsdWU+IGZvciBDVk8gd2lsbCBiZSBzZXQgdG8gaGVyZSAqLworICAgICAgICBpbnQzMl90IG1DVk9FeHRNYXA7CisKKyAgICAgICAgLyogYSBjb3B5IG9mIFRyYWNrSW5mbyBpbiBSVFNQU291cmNlICovCisgICAgICAgIHNwPEFub3RoZXJQYWNrZXRTb3VyY2U+IG1Tb3VyY2U7CisgICAgICAgIHVpbnQzMl90IG1SVFBUaW1lOworICAgICAgICBpbnQ2NF90IG1Ob3JtYWxQbGF5dGltZVVzOworICAgICAgICBib29sIG1OUFRNYXBwaW5nVmFsaWQ7CisKKyAgICAgICAgLyogYSBjb3B5IG9mIFRyYWNrSW5mbyBp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AorICAgICAgICAibGliYW5kcm9pZF9uZXQiLAorICAgICAgICAibGliYXVkaW9jbGllbnQiLAorICAgICAgICAibGliYmluZGVyIiwKKyAgICAgICAgImxpYmNhbWVyYV9jbGllbnQiLAorICAgICAgICAibGliY29kZWMyX2NsaWVudCIsCisgICAgICAgICJsaWJjcnlwdG8iLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICAgICAgImxpYmRhdGFzb3VyY2UiLAorICAgICAgICAibGliZGwiLAorICAgICAgICAibGliZHJtZnJhbWV3b3JrIiwKKyAgICAgICAgImxpYmd1aSIsCisgICAgICAgICJsaWJoaWRsYmFzZSIsCisgICAgICAgICJsaWJsb2ciLAorICAgICAgICAibGlibWVkaWEiLAorICAgICAgICAibGlibWVkaWFfY29kZWNsaXN0IiwKKyAgICAgICAgImxpYm1lZGlhX29teCIsCisgICAgICAgICJsaWJtZWRpYWRybSIsCisgICAgICAgICJsaWJtZWRpYW5kayIsCisgICAgICAgICJsaWJtZWRpYW1ldHJpY3MiLAorICAgICAgICAibGlibWVkaWF1dGlscyIsCisgICAgICAgICJsaWJtZW11bnJlYWNoYWJsZSIsCisgICAgICAgICJsaWJuZXRkX2NsaWVudCIsCisgICAgICAgICJsaWJwb3dlcm1hbmFnZXIiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHQiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZm91bmRhdGlvbiIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCisgICAgICAgICJsaWJhdWRpb2NsaWVudF9haWRsX2NvbnZlcnNpb24iLAorICAgIF0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1XZXJyb3IiLAorICAgICAgICAiLVdhbGwiLAorICAgIF0sCisKKyAgICBzYW5pdGl6ZTogeworICAgICAgICBjZmk6IHRydWUsCisgICAgICAgIG1pc2NfdW5kZWZpbmVkOiBbCisgICAgICAgICAgICAidW5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ubyhtT3V0cHV0QXVkaW9GcCk7CisgICAgICAgIEFTU0VSVF9HRShmZCwgMCkgPDwgIkZhaWxlZCB0byBnZXQgdGhlIGZpbGUgZGVzY3JpcHRvciBvZiB0aGUgb3V0cHV0IGZpbGUgZm9yICIKKyAgICAgICAgICAgICAgICAgICAgICAgICA8PCBPVVRQVVRfRklMRV9OQU1FX0FVRElPOworCisgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IG1TdGZSZWNvcmRlci0+c2V0T3V0cHV0RmlsZShmZCk7CisgICAgICAgIEFTU0VSVF9FUShzdGF0dXMsIE9LKSA8PCAiRmFpbGVkIHRvIHNldCB0aGUgb3V0cHV0IGZpbGUgIiA8PCBPVVRQVVRfRklMRV9OQU1FX0FVRElPCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiIGZvciBzdGFnZWZyaWdodCByZWNvcmRlciI7CisgICAgfQorCisgICAgdm9pZCBUZWFyRG93bigpIG92ZXJyaWRlIHsKKyAgICAgICAgaWYgKG1PdXRwdXRBdWRpb0ZwKSB7CisgICAgICAgICAgICBmY2xvc2UobU91dHB1dEF1ZGlvRnApOworICAgICAgICAgICAgbU91dHB1dEF1ZGlvRnAgPSBudWxscHRyOworICAgICAgICB9CisgICAgICAgIGlmICgha0RlYnVnKSB7CisgICAgICAgICAgICBpbnQzMl90IHN0YXR1cyA9IHJlbW92ZShPVVRQVVRfRklMRV9OQU1FX0FVRElPKTsKKyAgICAgICAgICAgIEFTU0VSVF9FUShzdGF0dXMsIDApIDw8ICJVbmFibGUgdG8gZGVsZXRlIHRoZSBvdXRwdXQgZmlsZSAiIDw8IE9VVFBVVF9GSUxFX05BTUVfQVVESU87CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHNldEF1ZGlvUmVjb3JkZXJGb3JtYXQob3V0cHV0X2Zvcm1hdCBvdXRwdXRGb3JtYXQsIGF1ZGlvX2VuY29kZXIgZW5jb2RlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc291cmNlX3QgYXVkaW9Tb3VyY2UgPSBBVURJT19TT1VSQ0VfREVGQVVMVCk7CisgICAgdm9pZCByZWNvcmRNZWRpYShib29sIGlzUGF1c2VkID0gZmFsc2UsIGludDMyX3QgbnVtU3RhcnQgPSAwLCBpbnQzMl90IG51bVBhdXNlID0gMCk7CisgICAgdm9pZCBkdW1wSW5mbygpOworICAgIHZvaWQgc2V0dXBFeHRyYWN0b3IoQU1lZGlhRXh0cmFjdG9yICpleHRyYWN0b3IsIGludDMyX3QgJnRyYWNrQ291bnQpOworICAgIHZvaWQgdmFsaWRhdGVPdXRwdXQoKTsKKworICAgIE1lZGlhUmVjb3JkZXJCYXNlICptU3RmUmVjb3JkZXI7CisgICAgRklMRSAqbU91dHB1dEF1ZGlvRnA7CisgICAgZG91YmxlIG1FeHBlY3RlZER1cmF0aW9uSW5NczsKKyAgICBkb3VibGUgbUV4cGVjdGVkUGF1c2VJbk1zOworfTsKKwordm9pZCBTdGFnZWZyaWdodFJlY29yZGVyVGVzdDo6c2V0QXVkaW9SZWNvcmRlckZvcm1hdChvdXRwdXRfZm9ybWF0IG91dHB1dEZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZW5jb2RlciBlbmNvZGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zb3VyY2VfdCBhdWRpb1NvdXJjZSkgeworICAgIHN0YXR1c190IHN0YXR1cyA9IG1TdGZSZWNvcmRlci0+c2V0QXVkaW9Tb3VyY2UoYXVkaW9Tb3VyY2UpOworICAgIEFTU0VSVF9FUShzdGF0dXMsIE9LKSA8PCAiRmFpbGVkIHRvIHNldCB0aGUgYXVkaW8gc291cmNlOiAiIDw8IGF1ZGlvU291cmNlOworCisgICAgc3RhdHVzID0gbVN0ZlJlY29yZGVyLT5zZXRPdXRwdXRGb3JtYXQob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ogeworICAgICAgICAgICAgZW5hYmxlZDogdHJ1ZSwKKyAgICAgICAgICAgIGFwZXhfYXZhaWxhYmxlOiBbCisgICAgICAgICAgICAgICAgImNvbS5hbmRyb2lkLm1lZGlhIiwKKyAgICAgICAgICAgICAgICAidGVzdF9jb20uYW5kcm9pZC5tZWRpYSIsCisgICAgICAgICAgICBdLAorICAgICAgICAgICAgbWluX3Nka192ZXJzaW9uOiAiMjkiLAorICAgICAgICB9LAorICAgIH0sCiB9CiAKLWNjX2xpYnJhcnlfc2hhcmVkIHsKK2NjX2xpYnJhcnkgewogICAgIG5hbWU6ICJsaWJtZWRpYXRyYW5zY29kaW5nIiwKIAorICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKKyAgICBhcGV4X2F2YWlsYWJsZTogWworICAgICAgICAiY29tLmFuZHJvaWQubWVkaWEiLAorICAgICAgICAidGVzdF9jb20uYW5kcm9pZC5tZWRpYSIsCisgICAgXSwKKwogICAgIHNyY3M6IFsKLSAgICAgICAgIlRyYW5zY29kaW5nQ2xpZW50TWFuYWdlci5jcHAiCisgICAgICAgICJUcmFuc2NvZGVyV3JhcHBlci5jcHAiLAorICAgICAgICAiVHJhbnNjb2RpbmdDbGllbnRNYW5hZ2VyLmNwcCIsCisgICAgICAgICJUcmFuc2NvZGluZ0xvZ2dlci5jcHAiLAorICAgICAgICAiVHJhbnNjb2RpbmdSZXNvdXJjZVBvbGljeS5jcHAiLAorICAgICAgICAiVHJhbnNjb2RpbmdTZXNzaW9uQ29udHJvbGxlci5jcHAiLAorICAgICAgICAiVHJhbnNjb2RpbmdUaGVybWFsUG9saWN5LmNwcCIsCisgICAgICAgICJUcmFuc2NvZGluZ1VpZFBvbGljeS5jcHAiLAogICAgIF0sCiAKICAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGliYW5kcm9pZCMzMSIsCiAgICAgICAgICJsaWJiaW5kZXJfbmRrIiwKICAgICAgICAgImxpYmN1dGlscyIsCiAgICAgICAgICJsaWJsb2ciLAogICAgICAgICAibGlidXRpbHMiLAorICAgICAgICAibGlibWVkaWF0cmFuc2NvZGVyIiwKKyAgICAgICAgImxpYm1lZGlhbmRrIiwKKyAgICAgICAgImxpYnN0YXRzc29ja2V0IzMwIiwKKyAgICBdLAorICAgIGV4cG9ydF9zaGFyZWRfbGliX2hlYWRlcnM6IFsKKyAgICAgICAgImxpYm1lZGlhbmRrIiwKICAgICBdLAogCiAgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWyJpbmNsdWRlIl0sCiAKICAgICBzdGF0aWNfbGliczogWwogICAgICAgICAibWVkaWF0cmFuc2NvZGluZ19haWRsX2ludGVyZmFjZS1uZGtfcGxhdGZvcm0iLAorICAgICAgICAicmVzb3VyY2VvYnNlcnZlcl9haWRsX2ludGVyZmFjZS1WMS1uZGtfcGxhdGZvcm0iLAorICAgICAgICAibGlic3RhdHNsb2dfbWVkaWEiLAogICAgIF0sCiAKICAgICBjZmxhZ3M6IFsKLSAgICAgICAgIi1XZXJyb3IiLAotICAgICAgICAiLVduby1lcnJvcj1kZXByZWNhdGVkLWRlY2xhcmF0aW9ucyIsCiAgICAgICAgICItV2FsbCIsCisgICAgICAgICItV2Vycm9yIiwKKyAgICAgICAgIi1XZm9ybWF0IiwKKyAgICAgICAgIi1Xbm8tZXJyb3I9ZGVwcmVjYXRlZC1kZWNsYXJhdGlvbnMiLAorICAgICAgICAiLVd0aHJlYWQtc2FmZXR5IiwKKyAgICAgICAgIi1XdW51c2VkIiwKKyAgICAgICAgIi1XdW5yZWFjaGFibGUtY29kZSIsCiAgICAgXSwKIAogICAgIHNhbml0aXplOiB7CkBAIC02NiwzICsxMjksNDMgQEAKICAgICAgICAgY2ZpOiB0cnVlLAogICAgIH0sCiB9CisKK2NjX2xpYnJhcnlfc3RhdGljIHsKKyAgICBuYW1lOiAibGlic3RhdHNsb2dfbWVkaWEiLAorICAgIGdlbmVyYXRlZF9zb3VyY2VzOiBbInN0YXRzbG9nX21lZGlhLmNwcCJdLAorICAg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ICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAibmFtZSI6ICJNZWRpYVNhbXBsZVdyaXRlclRlc3RzIgorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAibmFtZSI6ICJNZWRpYVRyYWNrVHJhbnNjb2RlclRlc3RzIgorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAibmFtZSI6ICJNZWRpYVRyYW5zY29kZXJUZXN0cyIKKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgICAgIm5hbWUiOiAiUGFzc3Rocm91Z2hUcmFja1RyYW5zY29kZXJUZXN0cyIKKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgICAgIm5hbWUiOiAiVHJhbnNjb2RpbmdDbGllbnRNYW5hZ2VyX3Rlc3RzIgorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAibmFtZSI6ICJUcmFuc2NvZGluZ1Nlc3Npb25Db250cm9sbGVyX3Rlc3RzIgorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAibmFtZSI6ICJWaWRlb1RyYWNrVHJhbnNjb2RlclRlc3RzIgorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgICAibmFtZSI6ICJDdHNNZWRpYVRyYW5zY29kaW5nVGVzdENhc2VzIgorICAgICAgICB9CisgICAgXQorfQorCmRpZmYgLS1naXQgYS9tZWRpYS9saWJtZWRpYXRyYW5zY29kaW5nL1RyYW5zY29kZXJXcmFwcGVyLmNwcCBiL21lZGlhL2xpYm1lZGlhdHJhbnNjb2RpbmcvVHJhbnNjb2RlcldyYXBwZXIuY3BwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjYwYjc4MGYKLS0tIC9kZXYvbnVsbAorKysgYi9tZWRpYS9saWJtZWRpYXRyYW5zY29kaW5nL1RyYW5zY29kZXJXcmFwcGVyLmNwcApAQCAtMCwwICsxLDYyNyBAQAorLyoKKyAqIENvcHlyaW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gICBjYXNlIEV2ZW50OjpFcnJvcjoKKyAgICAgICAgdHlwZVN0ciA9ICJFcnJvciI7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgRXZlbnQ6OlByb2dyZXNzOgorICAgICAgICB0eXBlU3RyID0gIlByb2dyZXNzIjsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBFdmVudDo6SGVhcnRCZWF0OgorICAgICAgICB0eXBlU3RyID0gIkhlYXJ0QmVhdCI7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgRXZlbnQ6OkFiYW5kb246CisgICAgICAgIHR5cGVTdHIgPSAiQWJhbmRvbiI7CisgICAgICAgIGJyZWFrOworICAgIGRlZmF1bHQ6CisgICAgICAgIHJldHVybiAiKHVua25vd24pIjsKKyAgICB9CisgICAgc3RkOjpzdHJpbmcgcmVzdWx0OworICAgIHJlc3VsdCA9ICJzZXNzaW9uIHsiICsgc3RkOjp0b19zdHJpbmcoZXZlbnQuY2xpZW50SWQpICsgIiwiICsgc3RkOjp0b19zdHJpbmcoZXZlbnQuc2Vzc2lvbklkKSArCisgICAgICAgICAgICAgIn06ICIgKyB0eXBlU3RyOworICAgIGlmIChldmVudC50eXBlID09IEV2ZW50OjpFcnJvciB8fCBldmVudC50eXBlID09IEV2ZW50OjpQcm9ncmVzcykgeworICAgICAgICByZXN1bHQgKz0gIiAiICsgc3RkOjp0b19zdHJpbmcoZXZlbnQuYXJnKTsKKyAgICB9CisgICAgcmV0dXJuIHJlc3VsdDsKK30KKworY2xhc3MgVHJhbnNjb2RlcldyYXBwZXI6OkNhbGxiYWNrSW1wbCA6IHB1YmxpYyBNZWRpYVRyYW5zY29kZXI6OkNhbGxiYWNrSW50ZXJmYWNlIHsKK3B1YmxpYzoKKyAgICBDYWxsYmFja0ltcGwoY29uc3Qgc3RkOjpzaGFyZWRfcHRyPFRyYW5zY29kZXJXcmFwcGVyPiYgb3duZXIsIENsaWVudElkVHlwZSBjbGllbnRJZCwKKyAgICAgICAgICAgICAgICAgU2Vzc2lvbklkVHlwZSBzZXNzaW9uSWQpCisgICAgICAgICAgOiBtT3duZXIob3duZXIpLCBtQ2xpZW50SWQoY2xpZW50SWQpLCBtU2Vzc2lvbklkKHNlc3Npb25JZCkge30KKworICAgIHZpcnR1YWwgdm9pZCBvbkZpbmlzaGVkKGNvbnN0IE1lZGlhVHJhbnNjb2RlciogdHJhbnNjb2RlciBfX3VudXNlZCkgb3ZlcnJpZGUgeworICAgICAgICBhdXRvIG93bmVyID0gbU93bmVyLmxvY2soKTsKKyAgICAgICAgaWYgKG93bmVyICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgIG93bmVyLT5vbkZpbmlzaChtQ2xpZW50SWQsIG1TZXNzaW9uSWQpOworICAgICAgICB9CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkIG9uRXJyb3IoY29uc3QgTWVkaWFUcmFuc2NvZGVyKiB0cmFuc2NvZGVyIF9fdW51c2VkLAorICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhX3N0YXR1c190IGVycm9yKSBvdmVycmlkZSB7CisgICAgICAgIGF1dG8gb3duZXIgPSBtT3duZXIubG9jaygpOworICAgICAgICBpZiAob3duZXIgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgb3duZXItPm9uRXJyb3IobUNsaWVudElkLCBtU2Vzc2lvbklkLCBlcnJvcik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgb25Qcm9ncmVzc1VwZGF0ZShjb25zdCBNZWRpYVRyYW5zY29kZXIqIHRyYW5zY29kZXIgX191bnVzZWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBwcm9ncmVzcykgb3ZlcnJpZGUgeworICAgICAgICBhdXRvIG93bmVyID0gbU93bmVyLmxvY2soKTsKKyAgICAgICAgaWYgKG93bmVyICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgIG93bmVyLT5vblByb2dyZXNzKG1DbGllbnRJZCwgbVNlc3Np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ICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8VHJhbnNjb2RpbmdMb2dnZXI+JiBsb2dnZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50NjRfdCBoZWFydEJlYXRJbnRlcnZhbFVzKQorICAgICAgOiBtQ2FsbGJhY2soY2IpLAorICAgICAgICBtTG9nZ2VyKGxvZ2dlciksCisgICAgICAgIG1IZWFydEJlYXRJbnRlcnZhbFVzKGhlYXJ0QmVhdEludGVydmFsVXMpLAorICAgICAgICBtQ3VycmVudENsaWVudElkKDApLAorICAgICAgICBtQ3VycmVudFNlc3Npb25JZCgtMSksCisgICAgICAgIG1Mb29wZXJSZWFkeShmYWxzZSkgeworICAgIEFMT0dWKCJUcmFuc2NvZGVyV3JhcHBlciBDVE9SOiAlcCIsIHRoaXMpOworfQorCitUcmFuc2NvZGVyV3JhcHBlcjo6flRyYW5zY29kZXJXcmFwcGVyKCkgeworICAgIEFMT0dWKCJUcmFuc2NvZGVyV3JhcHBlciBEVE9SOiAlcCIsIHRoaXMpOworfQorCitzdGF0aWMgYm9vbCBpc1Jlc291cmNlRXJyb3IobWVkaWFfc3RhdHVzX3QgZXJyKSB7CisgICAgcmV0dXJuIGVyciA9PSBBTUVESUFDT0RFQ19FUlJPUl9SRUNMQUlNRUQgfHwgZXJyID09IEFNRURJQUNPREVDX0VSUk9SX0lOU1VGRklDSUVOVF9SRVNPVVJDRTsKK30KKwordm9pZCBUcmFuc2NvZGVyV3JhcHBlcjo6cmVwb3J0RXJyb3IoQ2xpZW50SWRUeXBlIGNsaWVudElkLCBTZXNzaW9uSWRUeXBlIHNlc3Npb25JZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhX3N0YXR1c190IGVycikgeworICAgIGF1dG8gY2FsbGJhY2sgPSBtQ2FsbGJhY2subG9jaygpOworICAgIGlmIChjYWxsYmFjayAhPSBudWxscHRyKSB7CisgICAgICAg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ICAgICAgICAgICBjb25zdCBUcmFuc2NvZGluZ1JlcXVlc3RQYXJjZWwmIHJlcXVlc3RQYXJjZWwsIHVpZF90IGNhbGxpbmdVaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8SVRyYW5zY29kaW5nQ2xpZW50Q2FsbGJhY2s+JiBjbGllbnRDYikgeworICAgIFRyYW5zY29kaW5nUmVxdWVzdCByZXF1ZXN0e3JlcXVlc3RQYXJjZWx9OworICAgIHF1ZXVlRXZlbnQoRXZlbnQ6OlN0YXJ0LCBjbGllbnRJZCwgc2Vzc2lvbklkLCBbPV0geworICAgICAgICBtZWRpYV9zdGF0dXNfdCBlcnIgPSBoYW5kbGVTdGFydChjbGllbnRJZCwgc2Vzc2lvbklkLCByZXF1ZXN0LCBjYWxsaW5nVWlkLCBjbGllbnRDYik7CisgICAgICAgIGlmIChlcnIgIT0gQU1FRElBX09LKSB7CisgICAgICAgICAgICBjbGVhbnVwKCk7CisgICAgICAgICAgICByZXBvcnRFcnJvcihjbGllbnRJZCwgc2Vzc2lvbklkLCBlcnIpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgYXV0byBjYWxsYmFjayA9IG1DYWxsYmFjay5sb2NrKCk7CisgICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgIGNhbGxiYWNrLT5vblN0YXJ0ZWQoY2xpZW50SWQsIHNlc3Npb25JZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9KTsKK30KKwordm9pZCBUcmFuc2NvZGVyV3JhcHBlcjo6cGF1c2UoQ2xpZW50SWRUeXBlIGNsaWVudElkLCBTZXNzaW9uSWRUeXBlIHNlc3Npb25JZCkgeworICAgIHF1ZXVlRXZlbnQoRXZlbnQ6OlBhdXNlLCBjbGllbnRJZCwgc2Vzc2lvbklkLCBbPV0geworICAgICAgICBtZWRpYV9zdGF0dXNfdCBlcnIgPSBoYW5kbGVQYXVzZShjbGllbnRJZCwgc2Vzc2lvbklkKTsKKworICAgICAgICBjbGVhbnVwKCk7CisKKyAgICAgICAgaWYgKGVyciAhPSBBTUVESUFfT0spIHsKKyAgICAgICAgICAgIHJlcG9ydEVycm9yKGNsaWVudElkLCBzZXNzaW9uSWQsIGVycik7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBhdXRvIGNhbGxiYWNrID0gbUNhbGxiYWNrLmxvY2soKTsKKyAgICAgICAgICAgIGlmIChjYWxsYmFjayAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgY2FsbGJhY2stPm9uUGF1c2VkKGNsaWVudElkLCBzZXNzaW9uSWQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfSk7Cit9CisKK3ZvaWQgVHJhbnNjb2RlcldyYXBwZXI6OnJlc3VtZShDbGllbnRJZFR5cGUgY2xpZW50SWQsIFNlc3Npb25JZFR5cGUgc2Vzc2lvbklkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRyYW5zY29kaW5nUmVxdWVzdFBhcmNlbCYgcmVxdWVzdFBhcmNlbCwgdWlkX3QgY2FsbGluZ1VpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8SVRyYW5zY29kaW5nQ2xpZW50Q2FsbGJhY2s+JiBjbGllbnRDYikgeworICAgIFRyYW5zY29kaW5nUmVxdWVzdCByZXF1ZXN0e3JlcXVlc3RQYXJjZWx9OworICAgIHF1ZXVlRXZlbnQoRXZlbnQ6OlJlc3VtZSwgY2xpZW50SWQsIHNlc3Npb25JZCwgWz1dIHsKKyAgICAgICAgbWVkaWFfc3RhdHVzX3QgZXJyID0gaGFuZGxlUmVzdW1lKGNsaWVudElkLCBzZXNzaW9uSWQsIHJlcXVlc3QsIGNhbGxpbmdVaWQsIGNsaWVudENiKTsKKyAgICAgICAgaWYgKGVyciAhPSBBTUVESUFfT0spIHsKKyAgICAgICAgICAgIGNsZWFudXAoKTsKKyAgICAgICAgICAgIHJlcG9ydEVycm9yKGNsaWVudElkLCBzZXNzaW9uSWQsIGVycik7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBhdXRvIGNhbGxiYWNrID0gbUNhbGxiYWNrLmxvY2soKTsKKyAgICAgICAgICAgIGlmIChjYWxsYmFjayAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgY2FsbGJhY2stPm9uUmVzdW1lZChjbGllbnRJZCwgc2Vzc2lvbklkKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0pOworfQorCit2b2lkIFRyYW5zY29kZXJXcmFwcGVyOjpzdG9wKENsaWVudElkVHlwZSBjbGllbnRJZCwgU2Vzc2lvbklkVHlwZSBzZXNzaW9uSWQsIGJvb2wgYWJhbmRvbikgeworICAgIHF1ZXVlRXZlbnQoRXZlbnQ6OlN0b3AsIGNsaWVudElkLCBzZXNzaW9uSWQsIFs9XSB7CisgICAgICAgIGlmIChtVHJhbnNjb2RlciAhPSBudWxscHRyICYmIGNsaWVudElkID09IG1DdXJyZW50Q2xpZW50SWQgJiYKKyAgICAgICAgICAgIHNlc3Npb25JZCA9PSBtQ3VycmVudFNlc3Npb25JZCkgeworICAgICAgICAgICAgLy8gQ2FuY2VsbGluZyB0aGUgY3VycmVudGx5IHJ1bm5pbmcgc2Vzc2lvbi4KKyAgICAgICAgICAgIG1lZGlhX3N0YXR1c190IGVyciA9IG1UcmFuc2NvZGVyLT5jYW5jZWwoKTsKKyAgICAgICAgICAgIGlmIChlcnIgIT0gQU1FRElBX09LKSB7CisgICAgICAgICAgICAgICAgQUxPR1coImZhaWxlZCB0byBzdG9wIHRyYW5zY29kZXI6ICVkIiwgZXJyKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgQUxPR0koInRyYW5zY29kZXIgc3RvcHBlZCIpOworICAgICAgICAgICAgfQorICAgICAgICA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XRvIGNhbGxiYWNrID0gbUNhbGxiYWNrLmxvY2soKTsKKyAgICAgICAgaWYgKGNhbGxiYWNrICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgIGNhbGxiYWNrLT5vbkZpbmlzaChjbGllbnRJZCwgc2Vzc2lvbklkKTsKKyAgICAgICAgfQorICAgIH0pOworfQorCit2b2lkIFRyYW5zY29kZXJXcmFwcGVyOjpvbkVycm9yKENsaWVudElkVHlwZSBjbGllbnRJZCwgU2Vzc2lvbklkVHlwZSBzZXNzaW9uSWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhX3N0YXR1c190IGVycm9yKSB7CisgICAgcXVldWVFdmVudCgKKyAgICAgICAgICAgIEV2ZW50OjpFcnJvciwgY2xpZW50SWQsIHNlc3Npb25JZCwKKyAgICAgICAgICAgIFs9XSB7CisgICAgICAgICAgICAgICAgaWYgKG1UcmFuc2NvZGVyICE9IG51bGxwdHIgJiYgY2xpZW50SWQgPT0gbUN1cnJlbnRDbGllbnRJZCAmJgorICAgICAgICAgICAgICAgICAgICBzZXNzaW9uSWQgPT0gbUN1cnJlbnRTZXNzaW9uSWQpIHsKKyAgICAgICAgICAgICAgICAgICAgbG9nU2Vzc2lvbkVuZGVkKFRyYW5zY29kaW5nTG9nZ2VyOjpTZXNzaW9uRW5kZWRSZWFzb246OkVSUk9SLCBlcnJvcik7CisgICAgICAgICAgICAgICAgICAgIGNsZWFudXAoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmVwb3J0RXJyb3IoY2xpZW50SWQsIHNlc3Npb25JZCwgZXJyb3IpOworICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIGVycm9yKTsKK30KKwordm9pZCBUcmFuc2NvZGVyV3JhcHBlcjo6b25Qcm9ncmVzcyhDbGllbnRJZFR5cGUgY2xpZW50SWQsIFNlc3Npb25JZFR5cGUgc2Vzc2lvbklkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHByb2dyZXNzKSB7CisgICAgcXVldWVFdmVudCgKKyAgICAgICAgICAgIEV2ZW50OjpQcm9ncmVzcywgY2xpZW50SWQsIHNlc3Npb25JZCwKKyAgICAgICAgICAgIFs9XSB7CisgICAgICAgICAgICAgICAgYXV0byBjYWxsYmFjayA9IG1DYWxsYmFjay5sb2NrKCk7CisgICAgICAgICAgICAgICAgaWYgKGNhbGxiYWNrICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2stPm9uUHJvZ3Jlc3NVcGRhdGUoY2xpZW50SWQsIHNlc3Npb25JZCwgcHJvZ3Jlc3MpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICBwcm9ncmVzcyk7Cit9CisKK3ZvaWQgVHJhbnNjb2RlcldyYXBwZXI6Om9uSGVhcnRCZWF0KENsaWVudElkVHlwZSBjbGllbnRJZCwgU2Vzc2lvbklkVHlwZSBzZXNzaW9uSWQpIHsKKyAgICBxdWV1ZUV2ZW50KEV2ZW50OjpIZWFydEJlYXQsIGNsaWVudElkLCBzZXNzaW9uSWQsIFs9XSB7CisgICAgICAgIGF1dG8gY2FsbGJhY2sgPSBtQ2FsbGJhY2subG9jaygpOworICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgY2FsbGJhY2stPm9uSGVhcnRCZWF0KGNsaWVudElkLCBzZXNzaW9uSWQpOworICAgICAgICB9CisgICAgfSk7Cit9CisKK21lZGlhX3N0YXR1c190IFRyYW5zY29kZXJXcmFwcGVyOjpzZXR1cFRyYW5zY29kZXIoCisgICAgICAgIENsaWVudElkVHlwZSBjbGllbnRJZCwgU2Vzc2lvbklkVHlwZSBzZXNzaW9uSWQsIGNvbnN0IFRyYW5zY29kaW5nUmVxdWVzdFBhcmNlbCYgcmVxdWVzdCwKKyAgICAgICAgdWlkX3QgY2FsbGluZ1VpZCwgY29uc3Qgc3RkOjpz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AgICBjb25zdCBjaGFyKiBtaW1lID0gbnVsbHB0cjsKKyAgICAgICAgQU1lZGlhRm9ybWF0X2dldFN0cmluZyh0cmFja0Zvcm1hdHNbaV0uZ2V0KCksIEFNRURJQUZPUk1BVF9LRVlfTUlNRSwgJm1pbWUpOworCisgICAgICAgIGlmICghc3RybmNtcChtaW1lLCAidmlkZW8vIiwgNikpIHsKKyAgICAgICAgICAgIGZvcm1hdCA9IGdldFZpZGVvRm9ybWF0KG1pbWUsIHJlcXVlc3QucmVxdWVzdGVkVmlkZW9UcmFja0Zvcm1hdCk7CisKKyAgICAgICAgICAgIG1TcmNGb3JtYXQgPSB0cmFja0Zvcm1hdHNbaV07CisgICAgICAgICAgICBtRHN0Rm9ybWF0ID0gZm9ybWF0OworICAgICAgICB9CisKKyAgICAgICAgZXJyID0gbVRyYW5zY29kZXItPmNvbmZpZ3VyZVRyYWNrRm9ybWF0KGksIGZvcm1hdC5nZXQoKSk7CisgICAgICAgIGlmIChlcnIgIT0gQU1FRElBX09LKSB7CisgICAgICAgICAgICBBTE9HRSgiZmFpbGVkIHRvIGNvbmZpZ3VyZSB0cmFjayBmb3JtYXQgZm9yIHRyYWNrICVkOiAlZCIsIGksIGVycik7CisgICAgICAgICAgICAqZmFpbHVyZVJlYXNvbiA9IFRyYW5zY29kaW5nTG9nZ2VyOjpTZXNzaW9uRW5kZWRSZWFzb246OkNPTkZJR19UUkFDS19GQUlMRUQ7CisgICAgICAgICAgICByZXR1cm4gZXJyOworICAgICAgICB9CisKKyAgICAgICAgY2FsbGJhY2stPm9uSGVhcnRCZWF0KGNsaWVudElkLCBzZXNzaW9uSWQpOworICAgIH0KKworICAgIGVyciA9IG1UcmFuc2NvZGVyLT5jb25maWd1cmVEZXN0aW5hdGlvbihkc3RGZEludCk7CisgICAgaWYgKGVyciAhPSBBTUVESUFfT0spIHsKKyAgICAgICAgQUxPR0UoImZhaWxlZCB0byBjb25maWd1cmUgZGVzdDogJWQiLCBlcnIpOworICAgICAgICA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AgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIG1UcmFuc2NvZGVTdGFydFRpbWUgPSBzdGQ6OmNocm9ubzo6c3RlYWR5X2Nsb2NrOjpub3coKTsKKworICAgIGVyciA9IG1UcmFuc2NvZGVyLT5zdGFydCgpOworICAgIGlmIChlcnIgIT0gQU1FRElBX09LKSB7CisgICAgICAgIEFMT0dFKCIlczogZmFpbGVkIHRvIHN0YXJ0IHRyYW5zY29kZXI6ICVkIiwgX19GVU5DVElPTl9fLCBlcnIpOworICAgICAgICBsb2dTZXNzaW9uRW5kZWQoVHJhbnNjb2RpbmdMb2dnZXI6OlNlc3Npb25FbmRlZFJlYXNvbjo6U1RBUlRfRkFJTEVELCBlcnIpOworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIEFMT0dJKCIlczogdHJhbnNjb2RlciBzdGFydGVkIiwgX19GVU5DVElPTl9fKTsKKyAgICByZXR1cm4gQU1FRElBX09LOworfQorCittZWRpYV9zdGF0dXNfdCBUcmFuc2NvZGVyV3JhcHBlcjo6aGFuZGxlUGF1c2UoQ2xpZW50SWRUeXBlIGNsaWVudElkLCBTZXNzaW9uSWRUeXBlIHNlc3Npb25JZCkgeworICAgIGlmIChtVHJhbnNjb2RlciA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dFKCIlczogdHJhbnNjb2RlciBpcyBub3QgcnVubmluZyIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHJldHVybiBBTUVESUFfRVJST1JfSU5WQUxJRF9PUEVSQVRJT047CisgICAgfQorCisgICAgaWYgKGNsaWVudElkICE9IG1DdXJyZW50Q2xpZW50SWQgfHwgc2Vzc2lvbklkICE9IG1DdXJyZW50U2Vzc2lvbklkKSB7CisgICAgICAgIEFMT0dXKCIlczogc3RvcHBpbmcgc2Vzc2lvbiB7JWxsZCwgJWR9IHRoYXQncyBub3QgY3VycmVudCBzZXNzaW9uIHslbGxkLCAlZH0iLCBfX0ZVTkNUSU9OX18sCisgICA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yPFRyYW5zY29kaW5nQ2xpZW50TWFuYWdlcj4mIG93bmVyKTsKKworICAgIFN0YXR1cyBzdWJtaXRSZXF1ZXN0KGNvbnN0IFRyYW5zY29kaW5nUmVxdWVzdFBhcmNlbCYgLyppbl9yZXF1ZXN0Ki8sCisgICAgICAgICAgICAgICAgICAgICAgICAgVHJhbnNjb2RpbmdTZXNzaW9uUGFyY2VsKiAvKm91dF9zZXNzaW9uKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCogLypfYWlkbF9yZXR1cm4qLykgb3ZlcnJpZGU7CisKKyAgICBTdGF0dXMgY2FuY2VsU2Vzc2lvbihpbnQzMl90IC8qaW5fc2Vzc2lvbklkKi8sIGJvb2wqIC8qX2FpZGxfcmV0dXJuKi8pIG92ZXJyaWRlOworCisgICAgU3RhdHVzIGdldFNlc3Npb25XaXRoSWQoaW50MzJfdCAvKmluX3Nlc3Npb25JZCovLCBUcmFuc2NvZGluZ1Nlc3Npb25QYXJjZWwqIC8qb3V0X3Nlc3Npb24qLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sKiAvKl9haWRsX3JldHVybiovKSBvdmVycmlkZTsKKworICAgIFN0YXR1cyBhZGRDbGllbnRVaWQoaW50MzJfdCAvKmluX3Nlc3Npb25JZCovLCBpbnQzMl90IC8qaW5fY2xpZW50VWlkKi8sCisgICAgICAgICAgICAgICAgICAgICAgICBib29sKiAvKl9haWRsX3JldHVybiovKSBvdmVycmlkZTsKKworICAgIFN0YXR1cyBnZXRDbGllbnRVaWRzKGludDMyX3QgLyppbl9zZXNzaW9uSWQqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6Om9wdGlvbmFsPHN0ZDo6dmVjdG9yPGludDMyX3Q+PiogLypfYWlkbF9yZXR1cm4qLykgb3ZlcnJpZGU7CisKKyAgICBTdGF0dXMgdW5yZWdpc3RlcigpIG92ZXJyaWRlOworfTsKKworVHJhbnNjb2RpbmdDbGllbnRNYW5hZ2VyOj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Z1VpZCAmJiAhb3duZXItPmlzVHJ1c3RlZENhbGxlcihjYWxsaW5nUGlkLCBjYWxsaW5nVWlkKSkgeworICAgICAgICBBTE9HRSgic3VibWl0UmVxdWVzdCByZWplY3RlZCAoY2xpZW50UGlkICVkLCBjbGllbnRVaWQgJWQpICIKKyAgICAgICAgICAgICAgIihkb24ndCB0cnVzdCBjYWxsaW5nVWlkICVkKSIsCisgICAgICAgICAgICAgIGluX2NsaWVudFBpZCwgaW5fY2xpZW50VWlkLCBjYWxsaW5nVWlkKTsKKyAgICAgICAgcmV0dXJuIFNUQVRVU19FUlJPUl9GTVQoSU1lZGlhVHJhbnNjb2RpbmdTZXJ2aWNlOjpFUlJPUl9QRVJNSVNTSU9OX0RFTklFRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInN1Ym1pdFJlcXVlc3QgcmVqZWN0ZWQgKGNsaWVudFBpZCAlZCwgY2xpZW50VWlkICVkKSAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIoZG9uJ3QgdHJ1c3QgY2FsbGluZ1VpZCAlZCkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbl9jbGllbnRQaWQsIGluX2NsaWVudFVpZCwgY2FsbGluZ1VpZCk7CisgICAgfQorCisgICAgLy8gQ2hlY2sgaWYgd2UgY2FuIHRydXN0IGNsaWVudFBpZC4gT25seSBwcml2aWxlZ2UgY2FsbGVyIGNvdWxkIGZvcndhcmQgdGhlCisgICAgLy8gcGlkIG9uIGFwcCBjbGllbnQncyBiZWhhbGYuCisgICAgaWYgKGluX2NsaWVudFBpZCA9PSBJTWVkaWFUcmFuc2NvZGluZ1NlcnZpY2U6OlVTRV9DQUxMSU5HX1BJRCkgeworICAgICAgICBpbl9jbGllbnRQaWQgPSBjYWxsaW5nUGlkOworICAgIH0gZWxzZSBpZiAoaW5fY2xpZW50UGlkIDwgMCkgeworICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOworICAgIH0gZWxzZSBpZiAoaW5fY2xpZW50UGlkICE9IGNhbGxpbmdQaWQgJiYgIW93bmVyLT5pc1RydXN0ZWRDYWxsZXIoY2FsbGluZ1BpZCwgY2FsbGluZ1VpZCkpIHsKKyAgICAgICAgQUxPR0UoInN1Ym1pdFJlcXVlc3QgcmVqZWN0ZWQgKGNsaWVudFBpZCAlZCwgY2xpZW50VWlkICVkKSAiCisgICAgICAgICAgICAgICIoZG9uJ3QgdHJ1c3QgY2FsbGluZ1VpZCAlZCkiLAorICAgICAgICAgICAgICBpbl9jbGllbnRQaWQsIGluX2NsaWVudFVpZCwgY2FsbGluZ1VpZCk7CisgICAgICAgIHJldHVybiBTVEFUVVNfRVJST1JfRk1UKElNZWRpYVRyYW5zY29kaW5nU2VydmljZTo6RVJST1JfUEVSTUlTU0lPTl9ERU5JRUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJzdWJtaXRSZXF1ZXN0IHJlamVjdGVkIChjbGllbnRQaWQgJWQsIGNsaWVudFVpZCAlZCkgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKGRvbid0IHRydXN0IGNhbGxpbmdVaWQgJWQpIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5fY2xpZW50UGlkLCBpbl9jbGllbnRVaWQsIGNhbGxpbmdVaWQpOworICAgIH0KKworICAgIGludDMyX3Qgc2Vzc2lvbklkID0gbU5leHRTZXNzaW9uSWQuZmV0Y2hfYWRkKDEpOworCisgICAgKl9haWRsX3JldHVybiA9IG93bmVyLT5tU2Vzc2lvbkNvbnRyb2xsZXItPnN1Ym1pdChtQ2xpZW50SWQsIHNlc3Npb25JZCwgY2FsbGluZ1VpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluX2NsaWVudFVpZCwgaW5fcmVxdWVzdCwgbUNsaWVudENhbGxiYWNrKTsKKworICAgIGlmICgqX2FpZGxfcmV0dXJuKSB7CisgICA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ByZXR1cm4gU3RhdHVzOjpvaygpOworfQorCitTdGF0dXMgVHJhbnNjb2RpbmdDbGllbnRNYW5hZ2VyOjpDbGllbnRJbXBsOjpnZXRTZXNzaW9uV2l0aElkKGludDMyX3QgaW5fc2Vzc2lvbklkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUcmFuc2NvZGluZ1Nlc3Npb25QYXJjZWwqIG91dF9zZXNzaW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sKiBfYWlkbF9yZXR1cm4pIHsKKyAgICAqX2FpZGxfcmV0dXJuID0gZmFsc2U7CisKKyAgICBzdGQ6OnNoYXJlZF9wdHI8VHJhbnNjb2RpbmdDbGllbnRNYW5hZ2VyPiBvd25lcjsKKyAgICBpZiAobUFiYW5kb25lZCB8fCAob3duZXIgPSBtT3duZXIubG9jaygpKSA9PSBudWxscHRyKSB7CisgICAgICAgIHJldHVybiBTdGF0dXM6OmZyb21TZXJ2aWNlU3BlY2lmaWNFcnJvcihJTWVkaWFUcmFuc2NvZGluZ1NlcnZpY2U6OkVSUk9SX0RJU0NPTk5FQ1RFRCk7CisgICAgfQorCisgICAgaWYgKGluX3Nlc3Npb25JZCA8IDApIHsKKyAgICAgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKKyAgICB9CisKKyAgICAqX2FpZGxfcmV0dXJuID0KKyAgICAgICAgICAgIG93bmVyLT5tU2Vzc2lvbkNvbnRyb2xsZXItPmdldFNlc3Npb24obUNsaWVudElkLCBpbl9zZXNzaW9uSWQsICZvdXRfc2Vzc2lvbi0+cmVxdWVzdCk7CisKKyAgICBpZiAoKl9haWRsX3JldHVybikgeworICAgICAgICBvdXRfc2Vzc2lvbi0+c2Vzc2lvbklkID0gaW5fc2Vzc2lvbklkOworICAgICAgICBvdXRfc2Vzc2lvbi0+YXdhaXROdW1iZXJPZlNlc3Npb25zID0gMDsKKyAgICB9CisgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKK30KKworU3RhdHVzIFRyYW5zY29kaW5nQ2xpZW50TWFuYWdlcjo6Q2xpZW50SW1wbDo6YWRkQ2xpZW50VWlkKGludDMyX3QgaW5fc2Vzc2lvbklkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgaW5fY2xpZW50VWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wqIF9haWRsX3JldHVybikgeworICAgICpfYWlkbF9yZXR1cm4gPSBmYWxzZTsKKworICAgIHN0ZDo6c2hhcmVkX3B0cjxUcmFuc2NvZGluZ0NsaWVudE1hbmFnZXI+IG93bmVyOworICAgIGlmIChtQWJhbmRvbmVkIHx8IChvd25lciA9IG1Pd25lci5sb2NrKCkpID09IG51bGxwdHIpIHsKKyAgICAgICAgcmV0dXJuIFN0YXR1czo6ZnJvbVNlcnZpY2VTcGVjaWZpY0Vycm9yKElNZWRpYVRyYW5zY29kaW5nU2VydmljZTo6RVJST1JfRElTQ09OTkVDVEVEKTsKKyAgICB9CisKKyAgICBpZiAoaW5fc2Vzc2lvbklkIDwgMCkgeworICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOworICAgIH0KKworICAgIGludDMyX3QgY2FsbGluZ1BpZCA9IEFJQmluZGVyX2dldENhbGxpbmdQaWQoKTsKKyAgICBpbnQzMl90IGNhbGxpbmdVaWQgPSBBSUJpbmRlcl9nZXRDYWxsaW5nVWlkKCk7CisKKyAgICAvLyBDaGVjayBpZiB3ZSBjYW4gdHJ1c3QgY2xpZW50VWlkLiBPbmx5IHByaXZpbGVnZSBjYWxsZXIgY291bGQgYWRkIHVpZCB0byBleGlzdGluZyBzZXNzaW9ucy4KKyAgICBpZiAoaW5fY2xpZW50VWlkID09IElNZWRpYVRyYW5zY29kaW5nU2VydmljZTo6VVNFX0NBTExJTkdfVUlEKSB7CisgICAgICAgIGluX2NsaWVudFVpZCA9IGNhbGxpbmdVaWQ7CisgICAgfSBlbHNlIGlmIChpbl9jbGllbnRVaWQgPCAwKSB7CisgICAgICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CisgICAgfSBlbHNlIGlmIChpbl9jbGllbnRVaWQgIT0gY2FsbGluZ1VpZCAmJiAhb3duZXItPmlzVHJ1c3RlZENhbGxlcihjYWxsaW5nUGlkLCBjYWxsaW5nVWlkKSkgeworICAgICAgICBBTE9HRSgiYWRkQ2xpZW50VWlkIHJlamVjdGVkIChjbGllbnRVaWQgJWQpICIKKyAgICAgICAgICAgICAgIihkb24ndCB0cnVzdCBjYWxsaW5nVWlkICVkKSIsCisgICAgICAgICAgICAgIGluX2NsaWVudFVpZCwgY2FsbGluZ1VpZCk7CisgICAgICAgIHJldHVybiBTVEFUVVNfRVJST1JfRk1UKElNZWRpYVRyYW5zY29kaW5nU2VydmljZTo6RVJST1JfUEVSTUlTU0lPTl9ERU5JRUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhZGRDbGllbnRVaWQgcmVqZWN0ZWQgKGNsaWVudFVpZCAlZCkgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKGRvbid0IHRydXN0IGNhbGxpbmdVaWQgJWQpIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5fY2xpZW50VWlkLCBjYWxsaW5nVWlkKTsKKyAgICB9CisKKyAgICAqX2FpZGxfcmV0dXJuID0gb3duZXItPm1TZXNzaW9uQ29udHJvbGxlci0+YWRkQ2xpZW50VWlkKG1DbGllbnRJZCwgaW5fc2Vzc2lvbklkLCBpbl9jbGllbnRVaWQpOworICAgIHJldHVybiBTdGF0dXM6Om9rKCk7Cit9CisKK1N0YXR1cyBUcmFuc2NvZGluZ0NsaWVudE1hbmFnZXI6OkNsaWVudEltcGw6OmdldENsaWVudFVpZHMoCisgICAgICAgIGludDMy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AgICAgICAgICAgICAgICAgICAgICAgIGVudW0gU2Vzc2lvbkVuZGVkUmVhc29uIHJlYXNvbiwgdWlkX3QgY2FsbGluZ1VpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RhdHVzLCBzdGQ6OmNocm9ubzo6bWljcm9zZWNvbmRzIGR1cmF0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFNZWRpYUZvcm1hdCogc3JjRm9ybWF0LCBBTWVkaWFGb3JtYXQqIGRzdEZvcm1hdCkgeworICAgIGlmIChzcmNGb3JtYXQgPT0gbnVsbHB0cikgeworICAgICAgICBBTE9HRSgiU291cmNlIGZvcm1hdCBpcyBudWxsLiBEcm9wcGluZyBldmVudC4iKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGlmICghc2hvdWxkTG9nQXRvbShub3csIHN0YXR1cykpIHsKKyAgICAgICAgQUxPR0QoIk1heGltdW0gbG9nZ2VkIGV2ZW50IGNvdW50IHJlYWNoZWQuIERyb3BwaW5nIGV2ZW50LiIpOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgLy8gRXh0cmFjdCB0aGUgcGllY2VzIG9mIGluZm9ybWF0aW9uIHRvIGxvZy4KKyAgICBjb25zdCBpbnQzMl90IHNyY1dpZHRoID0gZ2V0SW50MzIoc3JjRm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX1dJRFRIKTsKKyAgICBjb25zdCBpbnQzMl90IHNyY0hlaWdodCA9IGdldEludDMyKHNyY0Zvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9IRUlHSFQpOworICAgIGNvbnN0IGNoYXIqIHNyY01pbWUgPSBnZXRTdHJpbmcoc3JjRm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX01JTUUpOworICAgIGNvbnN0IGludDMyX3Qgc3JjUHJvZmlsZSA9IGdldEludDMyKHNyY0Zvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9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3BlZEFTdGF0dXMgb25TdGF0dXNDaGFuZ2VkKAorICAgICAgICAgICAgTWVkaWFPYnNlcnZhYmxlRXZlbnQgZXZlbnQsIGludDMyX3QgdWlkLCBpbnQzMl90IHBpZCwKKyAgICAgICAgICAgIGNvbnN0IHN0ZDo6dmVjdG9yPE1lZGlhT2JzZXJ2YWJsZVBhcmNlbD4mIG9ic2VydmFibGVzKSBvdmVycmlkZSB7CisgICAgICAgIEFMT0dEKCIlczogJXMsIHVpZCAlZCwgcGlkICVkLCAlcyIsIF9fRlVOQ1RJT05fXywKKyAgICAgICAgICAgICAgOjphaWRsOjphbmRyb2lkOjptZWRpYTo6dG9TdHJpbmcoZXZlbnQpLmNfc3RyKCksIHVpZCwgcGlkLAorICAgICAgICAgICAgICB0b1N0cmluZyhvYnNlcnZhYmxlc1swXSkuY19zdHIoKSk7CisKKyAgICAgICAgLy8gT25seSByZXBvcnQga0lkbGUgZXZlbnQuCisgICAgICAgIGlmICgoKHVpbnQ2NF90KWV2ZW50ICYgKHVpbnQ2NF90KU1lZGlhT2JzZXJ2YWJsZUV2ZW50OjprSWRsZSkgIT0gMCkgeworICAgICAgICAgICAgZm9yIChhdXRvJiBvYnNlcnZhYmxlIDogb2JzZXJ2YWJsZXMpIHsKKyAgICAgICAgICAgICAgICBpZiAob2JzZXJ2YWJsZS50eXBlID09IE1lZGlhT2JzZXJ2YWJsZVR5cGU6OmtWaWRlb1NlY3VyZUNvZGVjIHx8CisgICAgICAgICAgICAgICAgICAgIG9ic2VydmFibGUudHlwZSA9PSBNZWRpYU9ic2VydmFibGVUeXBlOjprVmlkZW9Ob25TZWN1cmVDb2RlYykgeworICAgICAgICAgICAgICAgICAgICBtT3duZXItPm9uUmVzb3VyY2VBdmFpbGFibGUocGlkKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiA6Om5kazo6U2NvcGVkQVN0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7Cit9OworCitUcmFuc2NvZGluZ1Nlc3Npb25Db250cm9sbGVyOjpXYXRjaGRvZzo6V2F0Y2hkb2coVHJhbnNjb2RpbmdTZXNzaW9uQ29udHJvbGxlciogb3duZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50NjRfdCB0aW1lb3V0VXMpCisgICAgICA6IG1Pd25lcihvd25lciksCisgICAgICAgIG1UaW1lb3V0VXModGltZW91dFVzKSwKKyAgICAgICAgbUFjdGl2ZShmYWxzZSksCisgICAgICAgIG1BYm9ydChmYWxzZSksCisgICAgICAgIG1UaHJlYWQoJldhdGNoZG9nOjp0aHJlYWRMb29wLCB0aGlzKSB7CisgICAgQUxPR1YoIldhdGNoZG9nIENUT1I6ICVwIiwgdGhpcyk7Cit9CisKK1RyYW5zY29kaW5nU2Vzc2lvbkNvbnRyb2xsZXI6OldhdGNoZG9nOjp+V2F0Y2hkb2coKSB7CisgICAgQUxPR1YoIldhdGNoZG9nIERUT1I6ICVwIiwgdGhpcyk7CisKKyAgICB7CisgICAgICAgIC8vIEV4aXQgdGhlIGxvb3BlciB0aHJlYWQuCisgICAgICAgIHN0ZDo6c2NvcGVkX2xvY2sgbG9ja3ttTG9ja307CisKKyAgICAgICAgbUFib3J0ID0gdHJ1ZTsKKyAgICAgICAgbUNvbmRpdGlvbi5ub3RpZnlfb25lKCk7CisgICAgfQorCisgICAgbVRocmVhZC5qb2luKCk7CisgICAgQUxPR1YoIldhdGNoZG9nIERUT1I6ICVwLCBkb25lLiIsIHRoaXMpOworfQorCit2b2lkIFRyYW5zY29kaW5nU2Vzc2lvbkNvbnRyb2xsZXI6OldhdGNoZG9nOjpzdGFydChjb25zdCBTZXNzaW9uS2V5VHlwZSYga2V5KSB7CisgICAgc3RkOjpzY29wZWRfbG9jayBsb2Nre21Mb2NrfTsKKworICAgIGlmICghbUFjdGl2ZSkgeworICAgICAgICBBTE9HSSgiV2F0Y2hkb2cgc3RhcnQ6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5hbWVzLmNvdW50KHVpZCkgPiAwID8gbVVpZFBhY2thZ2VOYW1lc1t1aWRdLmNfc3RyKCkgOiAiKHVua25vd24pIik7CisgICAgICAgIHJlc3VsdC5hcHBlbmQoYnVmZmVyKTsKKyAgICAgICAgc25wcmludGYoYnVmZmVyLCBTSVpFLCAiICAgICAgTnVtIG9mIHNlc3Npb25zOiAlenVcbiIsIG1TZXNzaW9uUXVldWVzW3VpZF0uc2l6ZSgpKTsKKyAgICAgICAgcmVzdWx0LmFwcGVuZChidWZmZXIpOworICAgICAgICBmb3IgKGF1dG8mIHNlc3Npb25LZXkgOiBtU2Vzc2lvblF1ZXVlc1t1aWRdKSB7CisgICAgICAgICAgICBhdXRvIHNlc3Npb25JdCA9IG1TZXNzaW9uTWFwLmZpbmQoc2Vzc2lvbktleSk7CisgICAgICAgICAgICBpZiAoc2Vzc2lvbkl0ID09IG1TZXNzaW9uTWFwLmVuZCgpKSB7CisgICAgICAgICAgICAgICAgc25wcmludGYoYnVmZmVyLCBTSVpFLCAiRmFpbGVkIHRvIGxvb2sgdXAgU2Vzc2lvbiAlcyAgXG4iLAorICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25Ub1N0cmluZyhzZXNzaW9uS2V5KS5jX3N0cigpKTsKKyAgICAgICAgICAgICAgICByZXN1bHQuYXBwZW5kKGJ1ZmZlcik7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBkdW1wU2Vzc2lvbl9sKHNlc3Npb25JdC0+c2Vjb25kLCByZXN1bHQpOworICAgICAgICB9CisgICAgfQorCisgICAgc25wcmludGYoYnVmZmVyLCBTSVpFLCAiXG49PT09PT09PT09IER1bXBpbmcgcGFzdCBzZXNzaW9ucyA9PT09PT09PT1cbiIpOworICAgIHJlc3VsdC5hcHBlbmQoYnVmZmVyKTsKKyAgICBmb3IgKGF1dG8mIHNlc3Npb24gOiBtU2Vzc2lvbkhpc3RvcnkpIHsKKyAgICAgICAgZHVtcFNlc3Npb25fbChzZXNzaW9uLCByZXN1bHQsIHRydWUgLypjbG9zZWRTZXNzaW9uKi8pOworICAgIH0KKworICAgIHdyaXRlKGZkLCByZXN1bHQuc3RyaW5nKCksIHJlc3VsdC5zaXplKCkpOworfQorCisvKgorICogUmV0dXJucyBudWxscHRyIGlmIHRoZXJlIGlzIG5vIHNlc3Npb24sIG9yIHdlJ3JlIHBhdXNlZCBnbG9iYWxseSAoZHVlIHRvIHJlc291cmNlIGxvc3QsCisgKiB0aGVybWFsIHRocm90dGxpbmcsIGV0Yy4pLiBPdGhlcndpc2UsIHJldHVybiB0aGUgc2Vzc2lvbiB0aGF0IHNob3VsZCBiZSBydW4gbmV4dC4KKyAqLworVHJhbnNjb2RpbmdTZXNzaW9uQ29udHJvbGxlcjo6U2Vzc2lvbiogVHJhbnNjb2RpbmdTZXNzaW9uQ29udHJvbGxlcjo6Z2V0VG9wU2Vzc2lvbl9sKCkgeworICAgIGlmIChtU2Vzc2lvbk1hcC5lbXB0eSgpKSB7CisgICAgICAgIHJldHVybiBudWxscHRyOworICAgIH0KKworICAgIC8vIFJldHVybiBudWxscHRyIGlmIHdlJ3JlIHBhdXNlZCBnbG9iYWxseSBkdWUgdG8gcmVzb3VyY2UgbG9zdCBvciB0aGVybWFsIHRocm90dGxpbmcuCisgICAgaWYgKCgobVJlc291cmNlUG9saWN5ICE9IG51bGxwdHIgJiYgbVJlc291cmNlTG9zdCkgfHwKKyAgICAgICAgIChtVGhlcm1hbFBvbGljeSAhPSBudWxscHRyICYmIG1UaGVybWFsVGhyb3R0bGluZykpKSB7CisgICAgICAgIHJldHVybiBudWxscHRyOworICAgIH0KKworICAgIHVpZF90IHRvcFVpZCA9ICptVWlkU29ydGVkTGlzdC5iZWdpbigpOworICAgIC8vIElmIHRoZSBjdXJyZW50IHNlc3Npb24gaXMgcnVubmluZywgYW5kIGl0J3MgaW4gdGhlIHRvcFVpZCdzIHF1ZXVlLCBsZXQgaXQgY29udGludWUKKyAg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6OmNocm9ubzo6ZHVyYXRpb25fY2FzdDxzdGQ6OmNocm9ubzo6bWljcm9zZWNvbmRzPihub3dUaW1lIC0gc3RhdGVFbnRlclRpbWUpOworICAgICAgICBzd2l0Y2ggKHN0YXRlKSB7CisgICAgICAgIGNhc2UgUEFVU0VEOgorICAgICAgICAgICAgcGF1c2VkVGltZSA9IHBhdXNlZFRpbWUgKyBlbGFwc2VkVGltZTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIFJVTk5JTkc6CisgICAgICAgICAgICBydW5uaW5nVGltZSA9IHJ1bm5pbmdUaW1lICsgZWxhcHNlZFRpbWU7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBOT1RfU1RBUlRFRDoKKyAgICAgICAgICAgIHdhaXRpbmdUaW1lID0gd2FpdGluZ1RpbWUgKyBlbGFwc2VkVGltZTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisgICAgaWYgKG5ld1N0YXRlID09IFBBVVNFRCkgeworICAgICAgICBwYXVzZUNvdW50Kys7CisgICAgfQorICAgIHN0YXRlRW50ZXJUaW1lID0gbm93VGltZTsKKyAgICBzdGF0ZSA9IG5ld1N0YXRlOworfQorCit2b2lkIFRyYW5zY29kaW5nU2Vzc2lvbkNvbnRyb2xsZXI6OnVwZGF0ZUN1cnJlbnRTZXNzaW9uX2woKSB7CisgICAgU2Vzc2lvbiogY3VyU2Vzc2lvbiA9IG1DdXJyZW50U2Vzc2lvbjsKKyAgICBTZXNzaW9uKiB0b3BTZXNzaW9uID0gbnVsbHB0cjsKKworICAgIC8vIERlbGF5ZWQgaW5pdCBvZiB0cmFuc2NvZGVyIGFuZCB3YXRjaGRvZy4KKyAgICBpZiAobVRyYW5zY29kZXIgPT0gbnVsbHB0cikgeworICAgICAgICBtVHJhbnNjb2RlciA9IG1UcmFuc2NvZGVyRmFjdG9yeShzaG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gICAgICAgICBrZWVwRm9yQ2xpZW50ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgLy8gRE8gTk9UIGJyZWFrIGhlcmUsIGJlY2F1c2UgYm9vay1rZWVwaW5nIHN0aWxsIG5lZWRzIHRvIGhhcHBlbgorICAgICAgICAgICAgICAgICAgICAvLyBmb3IgdGhlIG90aGVyIHVpZHMuCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCFrZWVwRm9yQ2xpZW50KSB7CisgICAgICAgICAgICAgICAgLy8gVW5mb3J0dW5hdGVseSBhbGwgdWlkcyByZXF1ZXN0aW5nIHRoaXMgc2Vzc2lvbiBhcmUgb3V0IG9mIHF1b3RhLgorICAgICAgICAgICAgICAgIC8vIERyb3AgdGhpcyBzZXNzaW9uIGFuZCB0cnkgdGhlIG5leHQgb25lLgorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgYXV0byBjbGllbnRDYWxsYmFjayA9IG1TZXNzaW9uTWFwW3RvcFNlc3Npb24tPmtleV0uY2FsbGJhY2subG9jaygpOworICAgICAgICAgICAgICAgICAgICBpZiAoY2xpZW50Q2FsbGJhY2sgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50Q2FsbGJhY2stPm9uVHJhbnNjb2RpbmdGYWlsZWQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvcFNlc3Npb24tPmtleS5zZWNvbmQsIFRyYW5zY29kaW5nRXJyb3JDb2RlOjprRHJvcHBlZEJ5U2VydmljZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmVtb3ZlU2Vzc2lvbl9sKHRvcFNlc3Npb24tPmtleSwgU2Vzc2lvbjo6RFJPUFBFRF9CWV9QQUNFUik7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtVH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51bGxwdHIpIHsKKyAgICAgICAgICAgIGlmICgoKmtlZXBVaWQpKHVpZCkpIHsKKyAgICAgICAgICAgICAgICByZW1haW5pbmdVaWRzLmluc2VydCh1aWQpOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gSWYgd2UgaGF2ZSB1aWRzIHRvIGtlZXAsIHRoZSBzZXNzaW9uIGlzIG5vdCBnb2luZyB0byBhbnkgZmluYWwKKyAgICAgICAgICAgIC8vIHN0YXRlIHdlIGNhbid0IHVzZSBvblNlc3Npb25Db21wbGV0ZWQgYXMgdGhlIHJ1bm5pbmcgdGltZSB3aWxsCisgICAgICAgICAgICAvLyBub3QgYmUgdmFsaWQuIE9ubHkgbm90aWZ5IHBhY2VyIHRvIHN0b3AgdHJhY2tpbmcgdGhpcyBzZXNzaW9uLgorICAgICAgICAgICAgbVBhY2VyLT5vblNlc3Npb25DYW5jZWxsZWQodWlkKTsKKyAgICAgICAgfQorICAgICAgICBTZXNzaW9uUXVldWVUeXBlJiBzZXNzaW9uUXVldWUgPSBtU2Vzc2lvblF1ZXVlc1t1aWRdOworICAgICAgICBhdXRvIGl0ID0gc3RkOjpmaW5kKHNlc3Npb25RdWV1ZS5iZWdpbigpLCBzZXNzaW9uUXVldWUuZW5kKCksIHNlc3Npb25LZXkpOworICAgICAgICBpZiAoaXQgPT0gc2Vzc2lvblF1ZXVlLmVuZCgpKSB7CisgICAgICAgICAgICBBTE9HVygiY291bGRuJ3QgZmluZCBzZXNzaW9uICVzIGluIHF1ZXVlIGZvciB1aWQgJWQiLAorICAgICAgICAgICAgICAgICAgc2Vzc2lvblRvU3RyaW5nKHNlc3Npb25LZXkpLmNfc3RyKCksIHVpZCk7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBzZXNzaW9uUXVldWUuZXJhc2UoaXQpOworCisgICAgICAgIC8vIElmIHRoaXMgaXMgdGhlIGxhc3Qgc2Vzc2lvb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ChhdXRvIGl0ID0gbVVpZFNvcnRlZExpc3QuYmVnaW4oKTsgaXQgIT0gbVVpZFNvcnRlZExpc3QuZW5kKCk7KSB7CisgICAgICAgIHVpZF90IHVpZCA9ICppdDsKKworICAgICAgICBpZiAodWlkICE9IE9GRkxJTkVfVUlEICYmIHVpZHMuY291bnQodWlkKSA+IDApIHsKKyAgICAgICAgICAgIGl0ID0gbVVpZFNvcnRlZExpc3QuZXJhc2UoaXQpOworCisgICAgICAgICAgICAvLyBJZiB0aGlzIGlzIHRoZSB0b3Agd2UncmUgcHJlc2VydmluZywgZG9uJ3QgcHVzaCBpdCBoZXJlLCBwdXNoCisgICAgICAgICAgICAvLyBpdCBhZnRlciB0aGUgZm9yLWxvb3AuCisgICAgICAgICAgICBpZiAodWlkID09IGN1clRvcFVpZCAmJiBwcmVzZXJ2ZVRvcFVpZCkgeworICAgICAgICAgICAgICAgIHB1c2hDdXJUb3BUb0Zyb250ID0gdHJ1ZTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbVVpZFNvcnRlZExpc3QucHVzaF9mcm9udCh1aWQpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBJZiB3ZSBmb3VuZCBhbGwgdWlkcyBpbiB0aGUgc2V0LCBicmVhayBvdXQuCisgICAgICAgICAgICBpZiAoKytudW1VaWRzTW92ZWQgPT0gdWlkcy5zaXplKCkpIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICsraXQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpZiAocHVzaEN1clRvcFRvRnJvbnQpIHsKKyAgICAgICAgbVVpZFNvcnRlZExpc3QucHVzaF9mcm9udChjdXJUb3BVaWQpOworICAgIH0KK30KKworYm9vbCBUcmFuc2NvZGluZ1Nlc3Npb25Db250cm9sbGVyOjpzdWJtaXQoCisgICAgICAgIENsaWVudElkVHlwZSBjbGll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gICAgICBpZiAoY2xpZW50Q2FsbGJhY2sgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgIGNsaWVudENhbGxiYWNrLT5vblRyYW5zY29kaW5nRmluaXNoZWQoCisgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uSWQsIFRyYW5zY29kaW5nUmVzdWx0UGFyY2VsKHtzZXNzaW9uSWQsIC0xIC8qYWN0dWFsQml0cmF0ZUJwcyovLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpudWxsb3B0IC8qc2Vzc2lvblN0YXRzKi99KSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBSZW1vdmUgdGhlIHNlc3Npb24uCisgICAgICAgIHJlbW92ZVNlc3Npb25fbChzZXNzaW9uS2V5LCBTZXNzaW9uOjpGSU5JU0hFRCk7CisKKyAgICAgICAgLy8gU3RhcnQgbmV4dCBzZXNzaW9uLgorICAgICAgICB1cGRhdGVDdXJyZW50U2Vzc2lvbl9sKCk7CisKKyAgICAgICAgdmFsaWRhdGVTdGF0ZV9sKCk7CisgICAgfSk7Cit9CisKK3ZvaWQgVHJhbnNjb2RpbmdTZXNzaW9uQ29udHJvbGxlcjo6b25FcnJvcihDbGllbnRJZFR5cGUgY2xpZW50SWQsIFNlc3Npb25JZFR5cGUgc2Vzc2lvbklkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRyYW5zY29kaW5nRXJyb3JDb2RlIGVycikgeworICAgIG5vdGlmeUNsaWVudChjbGllbnRJZCwgc2Vzc2lvbklkLCAiZXJyb3IiLCBbPV0oY29uc3QgU2Vzc2lvbktleVR5cGUmIHNlc3Npb25LZXkpIHsKKyAgICAgICAgaWYgKGVyciA9PSBUcmFuc2NvZGluZ0Vycm9yQ29kZTo6a1dhdGNoZG9nVGltZW91dCkgeworICAgICAgICAgICAgLy8gQWJhbmRvbiB0aGUgdH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Vjb25kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRyYW5zY29kaW5nRXJyb3JDb2RlOjprVWlkR29uZUNhbmNlbGxlZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBSZW1vdmUgdGhlIHNlc3Npb24uCisgICAgICAgIHJlbW92ZVNlc3Npb25fbCgqaXQsIFNlc3Npb246OkNBTkNFTEVEKTsKKyAgICB9CisKKyAgICBhdXRvIGtlZXBVaWQgPSBzdGQ6Om1ha2Vfc2hhcmVkPHN0ZDo6ZnVuY3Rpb248Ym9vbCh1aWRfdCk+PigKKyAgICAgICAgICAgIFtnb25lVWlkXSh1aWRfdCB1aWQpIHsgcmV0dXJuIHVpZCAhPSBnb25lVWlkOyB9KTsKKyAgICBmb3IgKGF1dG8gaXQgPSBzZXNzaW9uc0Zvck90aGVyVWlkcy5iZWdpbigpOyBpdCAhPSBzZXNzaW9uc0Zvck90aGVyVWlkcy5lbmQoKTsgKytpdCkgeworICAgICAgICByZW1vdmVTZXNzaW9uX2woKml0LCBTZXNzaW9uOjpDQU5DRUxFRCwga2VlcFVpZCk7CisgICAgfQorCisgICAgLy8gU3RhcnQgbmV4dCBzZXNzaW9uLgorICAgIHVwZGF0ZUN1cnJlbnRTZXNzaW9uX2woKTsKKworICAgIHZhbGlkYXRlU3RhdGVfbCgpOworfQorCit2b2lkIFRyYW5zY29kaW5nU2Vzc2lvbkNvbnRyb2xsZXI6Om9uUmVzb3VyY2VBdmFpbGFibGUoKSB7CisgICAgc3RkOjpzY29wZWRfbG9jayBsb2Nre21Mb2NrfTsKKworICAgIGlmICghbVJlc291cmNlTG9zdCkgeworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgQUxPR0koIiVzIiwgX19GVU5DVElPTl9fKTsKKworICAgIG1SZXNvdXJjZUxvc3QgPSBmYWxzZTsKKyAgICB1cGRhdGVDdXJyZW50U2Vzc2lvbl9sKCk7CisKKyAg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VpZEl0ZXJhdG9yICE9IE9GRkxJTkVfVUlELAorICAgICAgICAgICAgICAgICAgICAgICAgIm1PZmZsaW5lVWlkSXRlcmF0b3Igbm90IHBvaW50aW5nIHRvIG9mZmxpbmUgdWlkIik7CisgICAgTE9HX0FMV0FZU19GQVRBTF9JRihtVWlkU29ydGVkTGlzdC5zaXplKCkgIT0gbVNlc3Npb25RdWV1ZXMuc2l6ZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgIm1VaWRTb3J0ZWRMaXN0IGFuZCBtU2Vzc2lvblF1ZXVlcyBzaXplIG1pc21hdGNoLCAlenUgdnMgJXp1IiwKKyAgICAgICAgICAgICAgICAgICAgICAgIG1VaWRTb3J0ZWRMaXN0LnNpemUoKSwgbVNlc3Npb25RdWV1ZXMuc2l6ZSgpKTsKKworICAgIGludDMyX3QgdG90YWxTZXNzaW9ucyA9IDA7CisgICAgZm9yIChhdXRvIHVpZCA6IG1VaWRTb3J0ZWRMaXN0KSB7CisgICAgICAgIExPR19BTFdBWVNfRkFUQUxfSUYobVNlc3Npb25RdWV1ZXMuY291bnQodWlkKSAhPSAxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJtU2Vzc2lvblF1ZXVlcyBjb3VudCBmb3IgdWlkICVkIGlzIG5vdCAxIiwgdWlkKTsKKyAgICAgICAgZm9yIChhdXRvJiBzZXNzaW9uS2V5IDogbVNlc3Npb25RdWV1ZXNbdWlkXSkgeworICAgICAgICAgICAgTE9HX0FMV0FZU19GQVRBTF9JRihtU2Vzc2lvbk1hcC5jb3VudChzZXNzaW9uS2V5KSAhPSAxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAibVNlc3Npb25zIGNvdW50IGZvciBzZXNzaW9uICVzIGlzIG5vdCAxIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvblRvU3RyaW5nKHNlc3Npb25LZXkpLmNfc3RyKCkpOworICAgICAgICB9CisKKyAgICAgICAgdG90YWxTZXN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IH0KKworICAgIGlmIChfX2J1aWx0aW5fYXZhaWxhYmxlKGFuZHJvaWQgX19UUkFOU0NPRElOR19NSU5fQVBJX18sICopKSB7CisgICAgICAgIEFUaGVybWFsTWFuYWdlciogdGhlcm1hbE1hbmFnZXIgPSBBVGhlcm1hbF9hY3F1aXJlTWFuYWdlcigpOworICAgICAgICBpZiAodGhlcm1hbE1hbmFnZXIgPT0gbnVsbHB0cikgeworICAgICAgICAgICAgQUxPR0UoIkZhaWxlZCB0byBhY3F1aXJlIHRoZXJtYWwgbWFuYWdlciIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgaW50IHJldCA9IEFUaGVybWFsX3JlZ2lzdGVyVGhlcm1hbFN0YXR1c0xpc3RlbmVyKHRoZXJtYWxNYW5hZ2VyLCBvblN0YXR1c0NoYW5nZSwgdGhpcyk7CisgICAgICAgIGlmIChyZXQgIT0gMCkgeworICAgICAgICAgICAgQUxPR0UoIkZhaWxlZCB0byByZWdpc3RlciB0aGVybWFsIHN0YXR1cyBsaXN0ZW5lciIpOworICAgICAgICAgICAgQVRoZXJtYWxfcmVsZWFzZU1hbmFnZXIodGhlcm1hbE1hbmFnZXIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgbUlzVGhyb3R0bGluZyA9IG5lZWRUaHJvdHRsaW5nKEFUaGVybWFsX2dldEN1cnJlbnRUaGVybWFsU3RhdHVzKHRoZXJtYWxNYW5hZ2VyKSk7CisgICAgICAgIG1UaGVybWFsTWFuYWdlciA9IHRoZXJtYWxNYW5hZ2VyOworICAgIH0KKworICAgIG1SZWdpc3RlcmVkID0gdHJ1ZTsKK30KKwordm9pZCBUcmFuc2NvZGluZ1RoZXJtYWxQb2xpY3k6OnVucmVnaXN0ZXJTZWxmKCkgeworICAgIEFMT0dJKCJUcmFuc2NvZGluZ1RoZXJtYWxQb2xpY3k6IHVucmVnaXN0ZXJTZWxmIik7CisKKyAgICBzdGQ6OnNjb3BlZF9sb2NrIGxvY2t7bVJlZ2lzdGVyZWRMb2NrfTsKKworICAgIGlmICghbVJlZ2lzdGVyZWQpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGlmIChfX2J1aWx0aW5fYXZhaWxhYmxlKGFuZHJvaWQgX19UUkFOU0NPRElOR19NSU5fQVBJX18sICopKSB7CisgICAgICAgIGlmIChtVGhlcm1hbE1hbmFnZXIgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgLy8gVW5yZWdpc3RlciBsaXN0ZW5lcgorICAgICAgICAgICAgaW50IHJldCA9CisgICAgICAgICAgICAgICAgICAgIEFUaGVybWFsX3VucmVnaXN0ZXJUaGVybWFsU3RhdHVzTGlzdGVuZXIobVRoZXJtYWxNYW5hZ2VyLCBvblN0YXR1c0NoYW5nZSwgdGhpcyk7CisgICAgICAgICAgICBpZiAocmV0ICE9IDApIHsKKyAgICAgICAgICAgICAgICBBTE9HVygiRmFpbGVkIHRvIHVucmVnaXN0ZXIgdGhlcm1hbCBzdGF0dXMgbGlzdGVuZXIiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFUaGVybWFsX3JlbGVhc2VNYW5hZ2VyKG1UaGVybWFsTWFuYWdlcik7CisgICAgICAgICAgICBtVGhlcm1hbE1hbmFnZXIgPSBudWxscHRyOworICAgICAgICB9CisgICAgfQorCisgICAgbVJlZ2lzdGVyZWQgPSBmYWxzZTsKK30KKwordm9pZCBUcmFuc2NvZGluZ1RoZXJtYWxQb2xpY3k6OnNldENhbGxiYWNrKAorICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8VGhlcm1hbFBvbGljeUNhbGxiYWNrSW50ZXJmYWNlPiYgY2IpIHsKKyAgICBzdGQ6OnNjb3BlZF9sb2NrIGxvY2t7bUNhbGxiYWNrTG9ja307CisgICAgbVRoZXJtYWxQb2xpY3lDYWxsYmFjayA9IGNiOworfQorCitib29sIFRyYW5zY29kaW5nVGhlcm1hbFBvbGlje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kTG9jayk7CisgICAgICAgIGF1dG8gaXQgPSBtVWlkU3RhdGVNYXAuZmluZCh1aWQpOworICAgICAgICBpZiAoaXQgIT0gbVVpZFN0YXRlTWFwLmVuZCgpICYmIGl0LT5zZWNvbmQgIT0gcHJvY1N0YXRlKSB7CisgICAgICAgICAgICBpc1VpZEdvbmUgPSAocHJvY1N0YXRlID09IEFBQ1RJVklUWU1BTkFHRVJfSU1QT1JUQU5DRV9HT05FKTsKKworICAgICAgICAgICAgdG9wVWlkcyA9IG1TdGF0ZVVpZE1hcFttVG9wVWlkU3RhdGVdOworCisgICAgICAgICAgICAvLyBNb3ZlIHVpZCB0byB0aGUgbmV3IHByb2NTdGF0ZS4KKyAgICAgICAgICAgIG1TdGF0ZVVpZE1hcFtpdC0+c2Vjb25kXS5lcmFzZSh1aWQpOworICAgICAgICAgICAgbVN0YXRlVWlkTWFwW3Byb2NTdGF0ZV0uaW5zZXJ0KHVpZCk7CisgICAgICAgICAgICBpdC0+c2Vjb25kID0gcHJvY1N0YXRlOworCisgICAgICAgICAgICB1cGRhdGVUb3BVaWRfbCgpOworICAgICAgICAgICAgaWYgKHRvcFVpZHMgIT0gbVN0YXRlVWlkTWFwW21Ub3BVaWRTdGF0ZV0pIHsKKyAgICAgICAgICAgICAgICAvLyBNYWtlIGEgY29weSBvZiB0aGUgdWlkIHNldCBmb3IgY2FsbGJhY2suCisgICAgICAgICAgICAgICAgdG9wVWlkcyA9IG1TdGF0ZVVpZE1hcFttVG9wVWlkU3RhdGVdOworICAgICAgICAgICAgICAgIHRvcFVpZFNldENoYW5nZWQgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgQUxPR1YoInRvcFVpZFNldENoYW5nZWQ6ICVkLCBpc1VpZEdvbmUgJWQiLCB0b3BVaWRTZXRDaGFuZ2VkLCBpc1VpZEdvbmUpOworCisgICAgaWYgKHRvcFVpZFNldENoYW5nZWQpIHsKKyAgICAgICAgYXV0byBjYWxsYmFjay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lLgogICAgICAqCi0gICAgICogQHBhcmFtIGNsaWVudCBpbnRlcmZhY2UgZm9yIHRoZSBNZWRpYVRyYW5zY29kaW5nU2VydmljZSB0byBjYWxsIHRoZSBjbGllbnQuCisgICAgICogQHBhcmFtIGNhbGxiYWNrIGNsaWVudCBpbnRlcmZhY2UgZm9yIHRoZSBNZWRpYVRyYW5zY29kaW5nU2VydmljZSB0byBjYWxsCisgICAgICogICAgICAgIHRoZSBjbGllbnQuCisgICAgICogQHBhcmFtIGNsaWVudE5hbWUgbmFtZSBvZiB0aGUgY2xpZW50LgogICAgICAqIEBwYXJhbSBvcFBhY2thZ2VOYW1lIG9wIHBhY2thZ2UgbmFtZSBvZiB0aGUgY2xpZW50LgotICAgICAqIEBwYXJhbSBjbGllbnRVaWQgdXNlciBpZCBvZiB0aGUgY2xpZW50LgotICAgICAqIEBwYXJhbSBjbGllbnRQaWQgcHJvY2VzcyBpZCBvZiB0aGUgY2xpZW50LgotICAgICAqIEByZXR1cm4gYSB1bmlxdWUgcG9zaXRpdmUgSWQgYXNzaWduZWQgdG8gdGhlIGNsaWVudCBieSB0aGUgc2VydmljZSwgLTEgIG1lYW5zIGZhaWxlZCB0bwotICAgICAqIHJlZ2lzdGVyLgorICAgICAqIEByZXR1cm4gYW4gSVRyYW5zY29kaW5nQ2xpZW50IGludGVyZmFjZSBvYmplY3QsIHdpdGggbnVsbHB0ciBpbmRpY2F0aW5nCisgICAgICogICAgICAgICBmYWlsdXJlIHRvIHJlZ2lzdGVyLgogICAgICAqLwotICAgIGludCByZWdpc3RlckNsaWVudChpbiBJVHJhbnNjb2RpbmdTZXJ2aWNlQ2xpZW50IGNsaWVudCwKLSAgICAgICAgICAgICAgICAgICAgICAgaW4gU3RyaW5nIG9wUGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgIGluIGludCBjbGllbnRVaWQsCi0gICAgICAgICAgICAgICAgICAgICAgIGluIGludCBjbGllbnRQaWQpOwotCi0gICAgLyoqCi0gIC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AgICAgIGludDMyX3QgbUNsaWVudElkOwotICAgICAgICAvKiBQcm9jZXNzIGlkIG9mIHRoZSBjbGllbnQgKi8KLSAgICAgICAgaW50MzJfdCBtQ2xpZW50UGlkOwotICAgICAgICAvKiBVc2VyIGlkIG9mIHRoZSBjbGllbnQuICovCi0gICAgICAgIGludDMyX3QgbUNsaWVudFVpZDsKLSAgICAgICAgLyogUGFja2FnZSBuYW1lIG9mIHRoZSBjbGllbnQuICovCi0gICAgICAgIHN0ZDo6c3RyaW5nIG1DbGllbnRPcFBhY2thZ2VOYW1lOwotCi0gICAgICAgIENsaWVudEluZm8oY29uc3Qgc3RkOjpzaGFyZWRfcHRyPElUcmFuc2NvZGluZ1NlcnZpY2VDbGllbnQ+JiBjbGllbnQsIGludDY0X3QgY2xpZW50SWQsCi0gICAgICAgICAgICAgICAgICAgaW50MzJfdCBwaWQsIGludDMyX3QgdWlkLCBjb25zdCBzdGQ6OnN0cmluZyYgb3BQYWNrYWdlTmFtZSkKLSAgICAgICAgICAgIDogbUNsaWVudChjbGllbnQpLAotICAgICAgICAgICAgICBtQ2xpZW50SWQoY2xpZW50SWQpLAotICAgICAgICAgICAgICBtQ2xpZW50UGlkKHBpZCksCi0gICAgICAgICAgICAgIG1DbGllbnRVaWQodWlkKSwKLSAgICAgICAgICAgICAgbUNsaWVudE9wUGFja2FnZU5hbWUob3BQYWNrYWdlTmFtZSkge30KLSAgICB9OwotCi0gICAgLyoqCiAgICAgICogQWRkcyBhIG5ldyBjbGllbnQgdG8gdGhlIG1hbmFnZXIuCiAgICAgICoKLSAgICAgKiBUaGUgY2xpZW50IG11c3QgaGF2ZSB2YWxpZCBjbGllbnRJZCwgcGlkLCB1aWQgYW5kIG9wUGFja2FnZU5hbWUsIG90aGVyd2lzZSwgdGhpcyB3aWxsIHJldHVybgotICAgICAqIGEgbm9uLXplcm8gZXJyb3Jjb2RlLiBJZiB0aGUgY2xpZW50IGhhcyBhbHJlYWR5IGJlZW4gYWRkZWQsIGl0I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F9jcmVhdGUoKTsKKyAgICAgICAgICAgIHBhcmNlbC53cml0ZVRvUGFyY2VsKHApOworICAgICAgICAgICAgQVBhcmNlbF9zZXREYXRhUG9zaXRpb24ocCwgMCk7CisgICAgICAgICAgICByZWFkRnJvbVBhcmNlbChwKTsKKyAgICAgICAgICAgIEFQYXJjZWxfZGVsZXRlKHApOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgc291cmNlRmlsZVBhdGggPSBwYXJjZWwuc291cmNlRmlsZVBhdGg7CisgICAgICAgICAgICBzb3VyY2VGZCA9IG5kazo6U2NvcGVkRmlsZURlc2NyaXB0b3IoZHVwKHBhcmNlbC5zb3VyY2VGZC5nZXQoKSkpOworICAgICAgICAgICAgZGVzdGluYXRpb25GaWxlUGF0aCA9IHBhcmNlbC5kZXN0aW5hdGlvbkZpbGVQYXRoOworICAgICAgICAgICAgZGVzdGluYXRpb25GZCA9IG5kazo6U2NvcGVkRmlsZURlc2NyaXB0b3IoZHVwKHBhcmNlbC5kZXN0aW5hdGlvbkZkLmdldCgpKSk7CisgICAgICAgICAgICBjbGllbnRVaWQgPSBwYXJjZWwuY2xpZW50VWlkOworICAgICAgICAgICAgY2xpZW50UGlkID0gcGFyY2VsLmNsaWVudFBpZDsKKyAgICAgICAgICAgIGNsaWVudFBhY2thZ2VOYW1lID0gcGFyY2VsLmNsaWVudFBhY2thZ2VOYW1lOworICAgICAgICAgICAgdHJhbnNjb2RpbmdUeXBlID0gcGFyY2VsLnRyYW5zY29kaW5nVHlwZTsKKyAgICAgICAgICAgIHJlcXVlc3RlZFZpZGVvVHJhY2tGb3JtYXQgPSBwYXJjZWwucmVxdWVzdGVkVmlkZW9UcmFja0Zvcm1hdDsKKyAgICAgICAgICAgIHByaW9yaXR5ID0gcGFyY2VsLnByaW9yaXR5OworICAgICAgICAgICAgcmVxdWVzdFByb2dyZXNzVXBkYXRlID0gcGFyY2VsLnJlcXVlc3RQcm9ncmVzc1VwZGF0ZTsKKyAgICAgICAgICAg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1Y3QgVGVzdENsaWVudENhbGxiYWNrIDogcHVibGljIEJuVHJhbnNjb2RpbmdDbGllbnRDYWxsYmFjayB7CisgICAgVGVzdENsaWVudENhbGxiYWNrKCkgeyBBTE9HSSgiVGVzdENsaWVudENhbGxiYWNrIENyZWF0ZWQiKTsgfQorCisgICAgdmlydHVhbCB+VGVzdENsaWVudENhbGxiYWNrKCkgeyBBTE9HSSgiVGVzdENsaWVudENhbGxiYWNrIGRlc3Ryb3llZCIpOyB9OworCisgICAgU3RhdHVzIG9wZW5GaWxlRGVzY3JpcHRvcihjb25zdCBzdGQ6OnN0cmluZyYgLyppbl9maWxlVXJpKi8sIGNvbnN0IHN0ZDo6c3RyaW5nJiAvKmluX21vZGUqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDo6bmRrOjpTY29wZWRGaWxlRGVzY3JpcHRvciogLypfYWlkbF9yZXR1cm4qLykgb3ZlcnJpZGUgewogICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOwogICAgIH0KIAotICAgIFN0YXR1cyBvblRyYW5zY29kaW5nRmluaXNoZWQoCi0gICAgICAgICAgICBpbnQzMl90IC8qIGluX2pvYklkICovLAotICAgICAgICAgICAgY29uc3QgOjphaWRsOjphbmRyb2lkOjptZWRpYTo6VHJhbnNjb2RpbmdSZXN1bHRQYXJjZWwmIC8qIGluX3Jlc3VsdCAqLykgb3ZlcnJpZGUgeworICAgIFN0YXR1cyBvblRyYW5zY29kaW5nU3RhcnRlZChpbnQzMl90IC8qaW5fc2Vzc2lvbklkKi8pIG92ZXJyaWRlIHsgcmV0dXJuIFN0YXR1czo6b2soKTsgfQorCisgICAgU3RhdHVzIG9uVHJhbnNjb2RpbmdQYXVzZWQoaW50MzJfdCAvKmluX3Nlc3Npb25JZCovKSBvdmVycmlkZSB7IHJldHVybiBTdGF0dXM6Om9rKCk7IH0KKworICAgIFN0YXR1cyBvblRyYW5zY29kaW5nUmVzdW1lZChpbnQzMl90IC8qaW5fc2Vzc2l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AgICAgICAgICAgICAgICAgICAgIGludDMyX3QgLyogaW5fbmV3QXdhaXROdW1iZXIgKi8pIG92ZXJyaWRlIHsKKyAgICBTdGF0dXMgb25Bd2FpdE51bWJlck9mU2Vzc2lvbnNDaGFuZ2VkKGludDMyX3QgLyogaW5fc2Vzc2lvbklkICovLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCAvKiBpbl9vbGRBd2FpdE51bWJlciAqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgLyogaW5fbmV3QXdhaXROdW1iZXIgKi8pIG92ZXJyaWRlIHsKICAgICAgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKICAgICB9CiAKLSAgICBTdGF0dXMgb25Qcm9ncmVzc1VwZGF0ZShpbnQzMl90IC8qIGluX2pvYklkICovLCBpbnQzMl90IC8qIGluX3Byb2dyZXNzICovKSBvdmVycmlkZSB7CisgICAgU3RhdHVzIG9uUHJvZ3Jlc3NVcGRhdGUoaW50MzJfdCAvKiBpbl9zZXNzaW9uSWQgKi8sIGludDMyX3QgLyogaW5fcHJvZ3Jlc3MgKi8pIG92ZXJyaWRlIHsKICAgICAgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKICAgICB9CiAKLSAgICB2aXJ0dWFsIH5UZXN0Q2xpZW50KCkgeyBBTE9HSSgiVGVzdENsaWVudCBkZXN0cm95ZWQiKTsgfTsKKyAgICBzdHJ1Y3QgRXZlbnQgeworICAgICAgICBlbnVtIHsKKyAgICAgICAgICAgIE5vRXZlbnQsCisgICAgICAgICAgICBGaW5pc2hlZCwKKyAgICAgICAgICAgIEZhaWxlZCwKKyAgICAgICAgfSB0eXBlOworICAgICAgICBTZXNzaW9uSWRUeXBlIHNlc3Npb25JZDsKKyAgICB9OwogCi0gICBwcml2YXRlOgotICAgIHN0ZDo6c2hhcmVkX3B0cjxJTWVkaWFUcmFuc2NvZGluZ1NlcnZpY2U+IG1TZXJ2aWNlOwotICAgIFRlc3RDbGllbnQoY29uc3QgVGVzdENsaWVudCYpID0gZGVsZXRlOwotICAgIFRlc3RDbGllbnQmIG9wZXJhdG9yPShjb25zdCBUZXN0Q2xpZW50JikgPSBkZWxldGU7CisgICAgc3RhdGljIGNvbnN0ZXhwciBFdmVudCBOb0V2ZW50ID0ge0V2ZW50OjpOb0V2ZW50LCAwfTsKKyNkZWZpbmUgREVDTEFSRV9FVkVOVChhY3Rpb24pIFwKKyAgICBzdGF0aWMgRXZlbnQgYWN0aW9uKFNlc3Npb25JZFR5cGUgc2Vzc2lvbklkKSB7IHJldHVybiB7RXZlbnQ6OmFjdGlvbiwgc2Vzc2lvbklkfTsgfQorCisgICAgREVDTEFSRV9FVkVOVChGaW5pc2hlZCk7CisgICAgREVDTEFSRV9FVkVOVChGYWlsZWQpOworCisgICAgY29uc3QgRXZlbnQmIHBvcEV2ZW50KCkgeworICAgICAgICBpZiAobUV2ZW50UXVldWUuZW1wdHkoKSkgeworICAgICAgICAgICAgbVBvcHBlZEV2ZW50ID0gTm9FdmVudDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1Qb3BwZWRFdmVudCA9ICptRXZlbnRRdWV1ZS5iZWdpbigpOworICAgICAgICAgICAgbUV2ZW50UXVldWUucG9wX2Zyb250KCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1Qb3BwZWRFdmVudDsKKyAgICB9CisKK3ByaXZhdGU6CisgICAgRXZlbnQgbVBvcHBlZEV2ZW50OworICAgIHN0ZDo6bGlzdDxFdmVudD4gbUV2ZW50UXVldWU7CisKKyAgICBUZXN0Q2xpZW50Q2FsbGJhY2soY29uc3QgVGVzdENsaWVudENhbGxiYWNrJikgPSBkZWxldGU7CisgICAgVGVzdENsaWVudENhbGxiYWNrJiBvcGVyYXRvcj0oY29uc3QgVGVzdENsaWVudENhbGxiYWNrJikgPSBkZWxldGU7Cit9OworCitib29sIG9wZXJhdG9yPT0oY29uc3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cm9tCisgICAgICAgIC8vIHRoZSBjb250cm9sbGVyIGJhY2sgdG8gY2xpZW50LgorICAgICAgICBpZiAocmVxdWVzdC5zb3VyY2VGaWxlUGF0aCA9PSAiYmFkX3NvdXJjZV9maWxlIikgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHJlcXVlc3QucHJpb3JpdHkgPT0gVHJhbnNjb2RpbmdTZXNzaW9uUHJpb3JpdHk6OmtVbnNwZWNpZmllZCkgeworICAgICAgICAgICAgY2xpZW50VWlkID0gT0ZGTElORV9VSUQ7CisgICAgICAgIH0KKworICAgICAgICBtU2Vzc2lvbnNbc2Vzc2lvbktleV0ucmVxdWVzdCA9IHJlcXVlc3Q7CisgICAgICAgIG1TZXNzaW9uc1tzZXNzaW9uS2V5XS5jYWxsYmFjayA9IGNsaWVudENhbGxiYWNrOworICAgICAgICBtU2Vzc2lvbnNbc2Vzc2lvbktleV0uYWxsQ2xpZW50VWlkcy5pbnNlcnQoY2xpZW50VWlkKTsKKworICAgICAgICBtTGFzdFNlc3Npb24gPSBzZXNzaW9uS2V5OworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBib29sIGFkZENsaWVudFVpZChDbGllbnRJZFR5cGUgY2xpZW50SWQsIFNlc3Npb25JZFR5cGUgc2Vzc2lvbklkLCB1aWRfdCBjbGllbnRVaWQpIG92ZXJyaWRlIHsKKyAgICAgICAgU2Vzc2lvbktleVR5cGUgc2Vzc2lvbktleSA9IHN0ZDo6bWFrZV9wYWlyKGNsaWVudElkLCBzZXNzaW9uSWQpOworCisgICAgICAgIGlmIChtU2Vzc2lvbnMuY291bnQoc2Vzc2lvbktleSkgPT0gMCkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIGlmIChtU2Vzc2lvbnNbc2Vzc2lvbktleV0uYWxsQ2xpZW50VWlkcy5jb3VudChjbGllbnRVaWQpID4gMCkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIG1TZXNzaW9uc1tzZXNzaW9uS2V5XS5hbGxDbGllbnRVaWRzLmluc2VydChjbGllbnRVaWQpOworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBib29sIGdldENsaWVudFVpZHMoQ2xpZW50SWRUeXBlIGNsaWVudElkLCBTZXNzaW9uSWRUeXBlIHNlc3Npb25JZCwKKyAgICAgICAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8aW50MzJfdD4qIG91dF9jbGllbnRVaWRzKSBvdmVycmlkZSB7CisgICAgICAgIFNlc3Npb25LZXlUeXBlIHNlc3Npb25LZXkgPSBzdGQ6Om1ha2VfcGFpcihjbGllbnRJZCwgc2Vzc2lvbklkKTsKKworICAgICAgICBpZiAobVNlc3Npb25zLmNvdW50KHNlc3Npb25LZXkpID09IDApIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBvdXRfY2xpZW50VWlkcy0+Y2xlYXIoKTsKKyAgICAgICAgZm9yICh1aWRfdCB1aWQgOiBtU2Vzc2lvbnNbc2Vzc2lvbktleV0uYWxsQ2xpZW50VWlkcykgeworICAgICAgICAgICAgaWYgKHVpZCAhPSBPRkZMSU5FX1VJRCkgeworICAgICAgICAgICAgICAgIG91dF9jbGllbnRVaWRzLT5wdXNoX2JhY2sodWlkKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBib29sIGNhbmNlbChDbGllbnRJZFR5cGUgY2xpZW50SWQsIFNlc3Npb25JZFR5cGUgc2Vzc2lvbklkKSBvdmVycmlkZSB7CisgICAgICAgIFNlc3Npb25LZXlUeXBlIHNlc3Npb25LZXkgPSBzdGQ6Om1ha2VfcGFpcihjbGllbnRJZCwgc2Vzc2lvbklkKTsKKworICAgICAgICBpZiAobVNlc3Npb25zLmNvdW50KHNlc3Npb25LZXkpID09IDApIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBtU2Vzc2lvbnMuZXJhc2Uoc2Vzc2lvbktleSk7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIGJvb2wgZ2V0U2Vzc2lvbihDbGllbnRJZFR5cGUgY2xpZW50SWQsIFNlc3Npb25JZFR5cGUgc2Vzc2lvbklkLAorICAgICAgICAgICAgICAgICAgICBUcmFuc2NvZGluZ1JlcXVlc3RQYXJjZWwqIHJlcXVlc3QpIG92ZXJyaWRlIHsKKyAgICAgICAgU2Vzc2lvbktleVR5cGUgc2Vzc2lvbktleSA9IHN0ZDo6bWFrZV9wYWlyKGNsaWVudElkLCBzZXNzaW9uSWQpOworICAgICAgICBpZiAobVNlc3Npb25zLmNvdW50KHNlc3Npb25LZXkpID09IDApIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgICooVHJhbnNjb2RpbmdSZXF1ZXN0KilyZXF1ZXN0ID0gbVNlc3Npb25zW3Nlc3Npb25LZXldLnJlcXVlc3Q7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHZvaWQgZmluaXNoTGFzdFNlc3Npb24oKSB7CisgICAgICAgIGF1dG8gaXQgPSBtU2Vzc2lvbnMuZmluZChtTGFzdFNlc3Npb24pOworICAgICAgICBpZiAoaXQgPT0gbVNlc3Npb25zLmVuZCgpKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgeworICAgICAgICAgICAgYXV0byBjbGllbnRDYWxsYmFjayA9IGl0LT5zZWNvbmQuY2FsbGJhY2subG9jaygpOworICAgICAgICAgICAgaWYgKGNsaWVudENhbGxiYWNrICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgICAgICBjbGllbnRDYWxsYmFjay0+b25UcmFuc2NvZGluZ0ZpbmlzaGVkKAorICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3RTZXNzaW9uLnNlY29uZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIFRyYW5zY29kaW5nUmVzdWx0UGFyY2VsKHttTGFzdFNlc3Npb24uc2Vjb25kLCAwLCBzdGQ6Om51bGxvcHR9KSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbVNlc3Npb25zLmVyYXNlKGl0KTsKKyAgICB9CisKKyAgICB2b2lkIGFib3J0TGFzdFNlc3Npb24oKSB7CisgICAgICAgIGF1dG8gaXQgPSBtU2Vzc2lvbnMuZmluZChtTGFzdFNlc3Npb24pOworICAgICAgICBpZiAoaXQgPT0gbVNlc3Npb25zLmVuZCgpKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgeworICAgICAgICAgICAgYXV0byBjbGllbnRDYWxsYmFjayA9IGl0LT5zZWNvbmQuY2FsbGJhY2subG9jaygpOworICAgICAgICAgICAgaWYgKGNsaWVudENhbGxiYWNrICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgICAgICBjbGllbnRDYWxsYmFjay0+b25UcmFuc2NvZGluZ0ZhaWxlZChtTGFzdFNlc3Npb24uc2Vjb25kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRyYW5zY29kaW5nRXJyb3JDb2RlOjprVW5rbm93bik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbVNlc3Npb25zLmVyYXNlKGl0KTsKKyAgICB9CisKKyAgICBzdHJ1Y3QgU2Vzc2lvbiB7CisgICAgICAgIFRyYW5zY29kaW5nUmVxdWVzdCByZXF1ZXN0OworICAgICAgICBzdGQ6OndlYWtfcHRyPElUcmFuc2NvZGluZ0NsaWVudENhbGxiYWNrPiBjYWxsYmFjazsKKyAgICAgICAgc3RkOjp1bm9yZGVyZWRfc2V0PHVpZF90PiBhbGxDbGllbnRVaWRzOworICAgIH07CisKKyAgICB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dTZXJ2aWNlPiBtU2VydmljZSA9IG51bGxwdHI7CisgICAgdm9pZCBhZGRNdWx0aXBsZUNsaWVudHMoKSB7CisgICAgICAgIEVYUEVDVF9FUSgKKyAgICAgICAgICAgICAgICBtQ2xpZW50TWFuYWdlci0+YWRkQ2xpZW50KG1DbGllbnRDYWxsYmFjazEsIGtDbGllbnROYW1lLCBrQ2xpZW50UGFja2FnZSwgJm1DbGllbnQxKSwKKyAgICAgICAgICAgICAgICBPSyk7CisgICAgICAgIEVYUEVDVF9ORShtQ2xpZW50MSwgbnVsbHB0cik7CisKKyAgICAgICAgRVhQRUNUX0VRKAorICAgICAgICAgICAgICAgIG1DbGllbnRNYW5hZ2VyLT5hZGRDbGllbnQobUNsaWVudENhbGxiYWNrMiwga0NsaWVudE5hbWUsIGtDbGllbnRQYWNrYWdlLCAmbUNsaWVudDIpLAorICAgICAgICAgICAgICAgIE9LKTsKKyAgICAgICAgRVhQRUNUX05FKG1DbGllbnQyLCBudWxscHRyKTsKKworICAgICAgICBFWFBFQ1RfRVEoCisgICAgICAgICAgICAgICAgbUNsaWVudE1hbmFnZXItPmFkZENsaWVudChtQ2xpZW50Q2FsbGJhY2szLCBrQ2xpZW50TmFtZSwga0NsaWVudFBhY2thZ2UsICZtQ2xpZW50MyksCisgICAgICAgICAgICAgICAgT0spOworICAgICAgICBFWFBFQ1RfTkUobUNsaWVudDMsIG51bGxwdHIpOworCisgICAgICAgIEVYUEVDVF9FUShtQ2xpZW50TWFuYWdlci0+Z2V0TnVtT2ZDbGllbnRzKCksIDMpOworICAgIH0KKworICAgIHZvaWQgdW5yZWdpc3Rlck11bHRpcGxlQ2xpZW50cygpIHsKKyAgICAgICAgRVhQRUNUX1RSVUUobUNsaWVudDEtPnVucmVnaXN0ZXIoKS5pc09rKCkpOworICAgICAgICBFWFBFQ1RfVFJVRShtQ2xpZW50Mi0+dW5yZWdpc3RlcigpLmlzT2soKSk7CisgICAgICAgIEVYUEVDVF9UUlVFKG1DbGllbnQz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29kZSksCisgICAgICAgICAgICByZWFzb24ocmVhc29uKSwKKyAgICAgICAgICAgIGNhbGxpbmdVaWQoY2FsbGluZ1VpZCksCisgICAgICAgICAgICBzdGF0dXMoc3RhdHVzKSwKKyAgICAgICAgICAgIHRyYW5zY29kZXJGcHModHJhbnNjb2RlckZwcyksCisgICAgICAgICAgICBzcmNXaWR0aChzcmNXaWR0aCksCisgICAgICAgICAgICBzcmNIZWlnaHQoc3JjSGVpZ2h0KSwKKyAgICAgICAgICAgIHNyY01pbWUoc3JjTWltZSksCisgICAgICAgICAgICBzcmNQcm9maWxlKHNyY1Byb2ZpbGUpLAorICAgICAgICAgICAgc3JjTGV2ZWwoc3JjTGV2ZWwpLAorICAgICAgICAgICAgc3JjRnBzKHNyY0ZwcyksCisgICAgICAgICAgICBzcmNEdXJhdGlvbk1zKHNyY0R1cmF0aW9uTXMpLAorICAgICAgICAgICAgc3JjSXNIZHIoc3JjSXNIZHIpLAorICAgICAgICAgICAgZHN0V2lkdGgoZHN0V2lkdGgpLAorICAgICAgICAgICAgZHN0SGVpZ2h0KGRzdEhlaWdodCksCisgICAgICAgICAgICBkc3RNaW1lKGRzdE1pbWUpLAorICAgICAgICAgICAgZHN0SXNIZHIoZHN0SXNIZHIpIHt9CisKKyAgICBpbnQzMl90IGF0b21Db2RlOworICAgIGludDMyX3QgcmVhc29uOworICAgIGludDMyX3QgY2FsbGluZ1VpZDsKKyAgICBpbnQzMl90IHN0YXR1czsKKyAgICBpbnQzMl90IHRyYW5zY29kZXJGcHM7CisgICAgaW50MzJfdCBzcmNXaWR0aDsKKyAgICBpbnQzMl90IHNyY0hlaWdodDsKKyAgICBzdGQ6OnN0cmluZyBzcmNNaW1lOworICAgIGludDMyX3Qgc3JjUHJvZmlsZTsKKyAgICBpbnQzMl90IHNyY0xldmVsOworICAgIGludDMyX3Qgc3JjRnBzOworICAgIGludDMyX3Qgc3JjRHVyYXRpb25NczsKKyAgICBib29sIHNyY0lzSGRyOworICAgIGludDMyX3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ydWN0IEV2ZW50IHsKKyAgICAgICAgZW51bSB7IE5vRXZlbnQsIFN0YXJ0LCBQYXVzZSwgUmVzdW1lLCBTdG9wLCBGaW5pc2hlZCwgRmFpbGVkLCBBYmFuZG9uIH0gdHlwZTsKKyAgICAgICAgQ2xpZW50SWRUeXBlIGNsaWVudElkOworICAgICAgICBTZXNzaW9uSWRUeXBlIHNlc3Npb25JZDsKKyAgICB9OworCisgICAgc3RhdGljIGNvbnN0ZXhwciBFdmVudCBOb0V2ZW50ID0ge0V2ZW50OjpOb0V2ZW50LCAwLCAwfTsKKworI2RlZmluZSBERUNMQVJFX0VWRU5UKGFjdGlvbikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgc3RhdGljIEV2ZW50IGFjdGlvbihDbGllbnRJZFR5cGUgY2xpZW50SWQsIFNlc3Npb25JZFR5cGUgc2Vzc2lvbklkKSB7IFwKKyAgICAgICAgcmV0dXJuIHtFdmVudDo6YWN0aW9uLCBjbGllbnRJZCwgc2Vzc2lvbklkfTsgICAgICAgICAgICAgICAgICAgICAgXAorICAgIH0KKworICAgIERFQ0xBUkVfRVZFTlQoU3RhcnQpOworICAgIERFQ0xBUkVfRVZFTlQoUGF1c2UpOworICAgIERFQ0xBUkVfRVZFTlQoUmVzdW1lKTsKKyAgICBERUNMQVJFX0VWRU5UKFN0b3ApOworICAgIERFQ0xBUkVfRVZFTlQoRmluaXNoZWQpOworICAgIERFQ0xBUkVfRVZFTlQoRmFpbGVkKTsKKyAgICBERUNMQVJFX0VWRU5UKEFiYW5kb24pOworCisgICAgLy8gUHVzaCAxIGV2ZW50IHRvIGJhY2suCisgICAgdm9pZCBhcHBlbmQoY29uc3QgRXZlbnQmIGV2ZW50LAorICAgICAgICAgICAgICAgIGNvbnN0IFRyYW5zY29kaW5nRXJyb3JDb2RlIGVyciA9IFRyYW5zY29kaW5nRXJyb3JDb2RlOjprTm9FcnJvcikgeworICAgICAgICBzdGQ6OnVuaXF1ZV9sb2NrIGxvY2sobUxvY2spOworCisgICAgICAgIG1FdmVudFF1ZXVlLnB1c2hfYmFjayhldmVudCk7CisgICAgICAgIC8vIEVycm9yIGlzIHN0aWNreSwgbm9uLWVycm9yIGV2ZW50IHdpbGwgbm90IGVyYXNlIGl0LCBvbmx5IGdldExhc3RFcnJvcigpCisgICAgICAgIC8vIGNsZWFycyBsYXN0IGVycm9yLgorICAgICAgICBpZiAoZXJyICE9IFRyYW5zY29kaW5nRXJyb3JDb2RlOjprTm9FcnJvcikgeworICAgICAgICAgICAgbUxhc3RFcnJvclF1ZXVlLnB1c2hfYmFjayhlcnIpOworICAgICAgICB9CisgICAgICAgIG1Db25kaXRpb24ubm90aWZ5X29uZSgpOworICAgIH0KKworICAgIC8vIFBvcCAxIGV2ZW50IGZyb20gZnJvbnQsIHdhaXQgZm9yIHVwIHRvIHRpbWVvdXRVcyBpZiBlbXB0eS4KKyAgICBjb25zdCBFdmVudCYgcG9wRXZlbnQoaW50NjRfdCB0aW1lb3V0VXMgPSAwKSB7CisgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtTG9jayk7CisKKyAgICAgICAgaWYgKG1FdmVudFF1ZXVlLmVtcHR5KCkgJiYgdGltZW91dFVzID4gMCkgeworICAgICAgICAgICAgbUNvbmRpdGlvbi53YWl0X2Zvcihsb2NrLCBzdGQ6OmNocm9ubzo6bWljcm9zZWNvbmRzKHRpbWVvdXRVcykpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKG1FdmVudFF1ZXVlLmVtcHR5KCkpIHsKKyAgICAgICAgICAgIG1Qb3BwZWRFdmVudCA9IE5vRXZlbnQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtUG9wcGVkRXZlbnQgPSAqbUV2ZW50UXVldWUuYmVnaW4oKTsKKyAgICAgICAgICAgIG1FdmVudFF1ZXVlLnBvcF9mcm9udCgpOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIG1Qb3BwZWRFd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2RpbmdSZXN1bWVkKGludDMyX3QgLyppbl9zZXNzaW9uSWQqLykgb3ZlcnJpZGUgeyByZXR1cm4gU3RhdHVzOjpvaygpOyB9CisKKyAgICBTdGF0dXMgb25UcmFuc2NvZGluZ0ZpbmlzaGVkKGludDMyX3QgaW5fc2Vzc2lvbklkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVHJhbnNjb2RpbmdSZXN1bHRQYXJjZWwmIGluX3Jlc3VsdCkgb3ZlcnJpZGUgeworICAgICAgICBFWFBFQ1RfRVEoaW5fc2Vzc2lvbklkLCBpbl9yZXN1bHQuc2Vzc2lvbklkKTsKKyAgICAgICAgQUxPR0QoIlRlc3RDbGllbnRDYWxsYmFjazogcmVjZWl2ZWQgb25UcmFuc2NvZGluZ0ZpbmlzaGVkIik7CisgICAgICAgIG1Pd25lci0+b25GaW5pc2hlZChtQ2xpZW50SWQsIGluX3Nlc3Npb25JZCk7CisgICAgICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CisgICAgfQorCisgICAgU3RhdHVzIG9uVHJhbnNjb2RpbmdGYWlsZWQoaW50MzJfdCBpbl9zZXNzaW9uSWQsIFRyYW5zY29kaW5nRXJyb3JDb2RlIGluX2Vycm9yQ29kZSkgb3ZlcnJpZGUgeworICAgICAgICBtT3duZXItPm9uRmFpbGVkKG1DbGllbnRJZCwgaW5fc2Vzc2lvbklkLCBpbl9lcnJvckNvZGUpOworICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOworICAgIH0KKworICAgIFN0YXR1cyBvbkF3YWl0TnVtYmVyT2ZTZXNzaW9uc0NoYW5nZWQoaW50MzJfdCAvKiBpbl9zZXNzaW9uSWQgKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IC8qIGluX29sZEF3YWl0TnVtYmVyICovLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCAvKiBpbl9uZXdBd2FpdE51bWJlciAqLykgb3ZlcnJpZGUgeworICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOworICAgIH0KKworICAgIFN0YXR1cyBvblByb2dyZXNzVXBkYXRlKGludDMyX3QgLyogaW5fc2Vzc2lvbklkICovLCBpbnQzMl90IC8qIGluX3Byb2dyZXNzICovKSBvdmVycmlkZSB7CisgICAgICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CisgICAgfQorCisgICAgdmlydHVhbCB+VGVzdENsaWVudENhbGxiYWNrKCkgeyBBTE9HSSgiVGVzdENsaWVudCBkZXN0cm95ZWQiKTsgfTsKKworcHJpdmF0ZToKKyAgICBUZXN0VHJhbnNjb2RlciogbU93bmVyOworICAgIENsaWVudElkVHlwZSBtQ2xpZW50SWQ7CisgICAgdWlkX3QgbUNsaWVudFVpZDsKKyAgICBUZXN0Q2xpZW50Q2FsbGJhY2soY29uc3QgVGVzdENsaWVudENhbGxiYWNrJikgPSBkZWxldGU7CisgICAgVGVzdENsaWVudENhbGxiYWNrJiBvcGVyYXRvcj0oY29uc3QgVGVzdENsaWVudENhbGxiYWNrJikgPSBkZWxldGU7Cit9OworCitjbGFzcyBUcmFuc2NvZGluZ1Nlc3Npb25Db250cm9sbGVyVGVzdCA6IHB1YmxpYyA6OnRlc3Rpbmc6OlRlc3QgeworcHVibGljOgorICAgIFRyYW5zY29kaW5nU2Vzc2lvbkNvbnRyb2xsZXJUZXN0KCkgeyBBTE9HSSgiVHJhbnNjb2RpbmdTZXNzaW9uQ29udHJvbGxlclRlc3QgY3JlYXRlZCIpOyB9CisgICAgflRyYW5zY29kaW5nU2Vzc2lvbkNvbnRyb2xsZXJUZXN0KCkgeyBBTE9HRCgiVHJhbnNjb2RpbmdTZXNzaW9uQ29udHJvbGxlclRlc3QgZGVzdHJveWVkIik7IH0KKworICAgIHZvaWQgU2V0VXAoKSBvdmVycmlkZSB7CisgICAgICAgIEFMT0dJKCJUcmFuc2NvZGluZ1Nlc3Npb25Db250cm9sbGV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gICAgICAgICAgICAgICAgICBFWFBFQ1RfRVEobVRyYW5zY29kZXIudXNlX2NvdW50KCksIDEpOworICAgICAgICAgICAgICAgICAgICBtVHJhbnNjb2Rlci0+b25DcmVhdGVkKCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBtVHJhbnNjb2RlcjsKKyAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgIG1VaWRQb2xpY3ksIG1SZXNvdXJjZVBvbGljeSwgbVRoZXJtYWxQb2xpY3ksICZjb25maWcpKTsKKyAgICAgICAgbVVpZFBvbGljeS0+c2V0Q2FsbGJhY2sobUNvbnRyb2xsZXIpOworCisgICAgICAgIC8vIFNldCBwcmlvcml0eSBvbmx5LCBpZ25vcmUgb3RoZXIgZmllbGRzIGZvciBub3cuCisgICAgICAgIG1PZmZsaW5lUmVxdWVzdC5wcmlvcml0eSA9IFRyYW5zY29kaW5nU2Vzc2lvblByaW9yaXR5OjprVW5zcGVjaWZpZWQ7CisgICAgICAgIG1SZWFsdGltZVJlcXVlc3QucHJpb3JpdHkgPSBUcmFuc2NvZGluZ1Nlc3Npb25Qcmlvcml0eTo6a0hpZ2g7CisgICAgICAgIG1DbGllbnRDYWxsYmFjazAgPSA6Om5kazo6U2hhcmVkUmVmQmFzZTo6bWFrZTxUZXN0Q2xpZW50Q2FsbGJhY2s+KG1UcmFuc2NvZGVyLmdldCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDTElFTlQoMCksIFVJRCgwKSk7CisgICAgICAgIG1DbGllbnRDYWxsYmFjazEgPSA6Om5kazo6U2hhcmVkUmVmQmFzZTo6bWFrZTxUZXN0Q2xpZW50Q2FsbGJhY2s+KG1UcmFuc2NvZGVyLmdldCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDTElFTlQoMSksIFVJRCgxKSk7CisgICAgICAgIG1DbGllbnRDYWxsYmFjazIgPSA6Om5kazo6U2hhcmVkUmVmQmFzZTo6bWFrZTxUZXN0Q2xpZW50Q2FsbGJhY2s+KG1UcmFuc2NvZGVyLmdldCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDTElFTlQoMiksIFVJRCgyKSk7CisgICAgICAgIG1DbGllbnRDYWxsYmFjazMgPSA6Om5kazo6U2hhcmVkUmVmQmFzZTo6bWFrZTxUZXN0Q2xpZW50Q2FsbGJhY2s+KG1UcmFuc2NvZGVyLmdldCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDTElFTlQoMyksIFVJRCgzKSk7CisgICAgfQorCisgICAgdm9pZCBUZWFyRG93bigpIG92ZXJyaWRlIHsgQUxPR0koIlRyYW5zY29kaW5nU2Vzc2lvbkNvbnRyb2xsZXJUZXN0IHRlYXIgZG93biIpOyB9CisKKyAgICB2b2lkIGV4cGVjdFRpbWVvdXQoaW50NjRfdCBjbGllbnRJZCwgaW50MzJfdCBzZXNzaW9uSWQsIGludDMyX3QgZ2VuZXJhdGlvbikgeworICAgICAgICBFWFBFQ1RfRVEobVRyYW5zY29kZXItPnBvcEV2ZW50KDI5MDAwMDApLCBUZXN0VHJhbnNjb2Rlcjo6Tm9FdmVudCk7CisgICAgICAgIEVYUEVDVF9FUShtVHJhbnNjb2Rlci0+cG9wRXZlbnQoMjAwMDAwKSwgVGVzdFRyYW5zY29kZXI6OkFiYW5kb24oY2xpZW50SWQsIHNlc3Npb25JZCkpOworICAgICAgICBFWFBFQ1RfRVEobVRyYW5zY29kZXItPnBvcEV2ZW50KDEwMDAwMCksIFRlc3RUcmFuc2NvZGVyOjpGYWlsZWQoY2xpZW50SWQsIHNlc3Npb25JZCkpOworICAgICAgICBFWFBFQ1RfRVEob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gaW50IHNlc3Npb25EdXJhdGlvbk1zLCBpbnQgZXhwZWN0ZWRTdWNjZXNzLAorICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c2hhcmVkX3B0cjxUZXN0Q2xpZW50Q2FsbGJhY2s+JiBjbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8aW50PiYgYWRkaXRpb25hbENsaWVudFVpZHMsIGJvb2wgcGF1c2VMYXN0U3VjY2Vzc1Nlc3Npb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCB1c2VSZWFsQ2FsbGluZ1VpZCkgeworICAgICAgICB1aWRfdCBjYWxsaW5nVWlkID0gdXNlUmVhbENhbGxpbmdVaWQgPyA6OmdldHVpZCgpIDogY2xpZW50LT5jbGllbnRVaWQoKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1TdWJtaXRzOyBpKyspIHsKKyAgICAgICAgICAgIG1Db250cm9sbGVyLT5zdWJtaXQoY2xpZW50LT5jbGllbnRJZCgpLCBTRVNTSU9OKGkpLCBjYWxsaW5nVWlkLCBjbGllbnQtPmNsaWVudFVpZCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUmVhbHRpbWVSZXF1ZXN0LCBjbGllbnQpOworICAgICAgICAgICAgZm9yIChpbnQgYWRkaXRpb25hbFVpZCA6IGFkZGl0aW9uYWxDbGllbnRVaWRzKSB7CisgICAgICAgICAgICAgICAgbUNvbnRyb2xsZXItPmFkZENsaWVudFVpZChjbGllbnQtPmNsaWVudElkKCksIFNFU1NJT04oaSksIGFkZGl0aW9uYWxVaWQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZXhwZWN0ZWRTdWNjZXNzOyBpKyspIHsKKyAgICAgICAgICAgIEVYUEVDVF9FUShtVHJhbnNjb2Rlci0+cG9wRXZlbnQoKSwKKyAgICAgICAgICAgICAgICAgICAgICBUZXN0VHJhbnNjb2Rlcjo6U3RhcnQoY2xpZW50LT5jbGllbnRJZCgpLCBTRVNTSU9OKGkpKSk7CisgICAgICAgICAgICBpZiAoKGkgPT0gZXhwZWN0ZWRTdWNjZXNzIC0gMSkgJiYgcGF1c2VMYXN0U3VjY2Vzc1Nlc3Npb24pIHsKKyAgICAgICAgICAgICAgICAvLyBJbnNlcnQgYSBwYXVzZSBvZiAzIHNlYyB0byB0aGUgbGFzdCBzdWNjZXNzIHJ1bm5pbmcgc2Vzc2lvbgorICAgICAgICAgICAgICAgIG1Db250cm9sbGVyLT5vblRocm90dGxpbmdTdGFydGVkKCk7CisgICAgICAgICAgICAgICAgRVhQRUNUX0VRKG1UcmFuc2NvZGVyLT5wb3BFdmVudCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBUZXN0VHJhbnNjb2Rlcjo6UGF1c2UoY2xpZW50LT5jbGllbnRJZCgpLCBTRVNTSU9OKGkpKSk7CisgICAgICAgICAgICAgICAgc2xlZXAoMyk7CisgICAgICAgICAgICAgICAgbUNvbnRyb2xsZXItPm9uVGhyb3R0bGluZ1N0b3BwZWQoKTsKKyAgICAgICAgICAgICAgICBFWFBFQ1RfRVEobVRyYW5zY29kZXItPnBvcEV2ZW50KCksCisgICAgICAgICAgICAgICAgICAgICAgICAgIFRlc3RUcmFuc2NvZGVyOjpSZXN1bWUoY2xpZW50LT5jbGllbnRJZCgpLCBTRVNTSU9OKGkpKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB1c2xlZXAoc2Vzc2lvbkR1cmF0aW9uTXMgKiAxMDAwKTsKKyAgICAgICAgICAgIC8vIFRlc3QgaGFsZiBvZiBGaW5pc2ggYW5kIGhhbGYgb2YgRXJyb3IsIGJvdGggc2hvdWxkIGJlIGNvdW50ZWQgYXMgYnVyc3QgcnVucy4KKyAgICAgICAgICAgIGlmIChpICYgMSkgeworICAgICAgICAgICAgICAgIG1Db250cm9sbGVyLT5vbkZpbmlzaChjbGllbnQtPmNsaWVudElkKCksIFNFU1NJT04oaSkpOworICAgICAgICAgICAgICAgIEVYUEVDVF9FUShtVHJhbnNjb2Rlci0+cG9wRXZlbnQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgVGVzdFRyYW5zY29kZXI6OkZpbmlzaGVkKGNsaWVudC0+Y2xpZW50SWQoKSwgU0VTU0lPTihpKSkpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBtQ29udHJvbGxlci0+b25FcnJvcihjbGllbnQtPmNsaWVudElkKCksIFNFU1NJT04oaSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVHJhbnNjb2RpbmdFcnJvckNvZGU6OmtVbmtub3duKTsKKyAgICAgICAgICAgICAgICBFWFBFQ1RfRVEobVRyYW5zY29kZXItPnBvcEV2ZW50KDEwMDAwMCksCisgICAgICAgICAgICAgICAgICAgICAgICAgIFRlc3RUcmFuc2NvZGVyOjpGYWlsZWQoY2xpZW50LT5jbGllbnRJZCgpLCBTRVNTSU9OKGkpKSk7CisgICAgICAgICAgICAgICAgRVhQRUNUX0VRKG1UcmFuc2NvZGVyLT5nZXRMYXN0RXJyb3IoKSwgVHJhbnNjb2RpbmdFcnJvckNvZGU6OmtVbmtub3duKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBmb3IgKGludCBpID0gZXhwZWN0ZWRTdWNjZXNzOyBpIDwgbnVtU3VibWl0czsgaSsrKSB7CisgICAgICAgICAgICBFWFBFQ1RfRVEobVRyYW5zY29kZXItPnBvcEV2ZW50KCksCisgICAgICAgICAgICAgICAgICAgICAgVGVzdFRyYW5zY29kZXI6OkZhaWxlZChjbGllbnQtPmNsaWVudElkKCksIFNFU1NJT04oaSkpKTsKKyAgICAgICAgICAgIEVYUEVDVF9FUShtVHJhbnNjb2Rlci0+Z2V0TGFzdEVycm9yKCksIFRyYW5zY29kaW5nRXJyb3JDb2RlOjprRHJvcHBlZE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lbnNlIGtpbmRzOgorICAgIC8vICAgU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMAorICAgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWyJmcmFtZXdvcmtzX2F2X2xpY2Vuc2UiXSwKK30KKworY2NfZGVmYXVsdHMgeworICAgIG5hbWU6ICJtZWRpYXRyYW5zY29kZXJfZGVmYXVsdHMiLAorCisgICAgc3JjczogWworICAgICAgICAiTWVkaWFTYW1wbGVRdWV1ZS5jcHAiLAorICAgICAgICAiTWVkaWFTYW1wbGVSZWFkZXJOREsuY3BwIiwKKyAgICAgICAgIk1lZGlhU2FtcGxlV3JpdGVyLmNwcCIsCisgICAgICAgICJNZWRpYVRyYWNrVHJhbnNjb2Rlci5jcHAiLAorICAgICAgICAiTWVkaWFUcmFuc2NvZGVyLmNwcCIsCisgICAgICAgICJOZGtDb21tb24uY3BwIiwKKyAgICAgICAgIlBhc3N0aHJvdWdoVHJhY2tUcmFuc2NvZGVyLmNwcCIsCisgICAgICAgICJWaWRlb1RyYWNrVHJhbnNjb2Rlci5jcHAiLAorICAgIF0sCisKKyAgICBtaW5fc2RrX3ZlcnNpb246ICIyOSIsCisgICAgYXBleF9hdmFpbGFibGU6IFsKKyAgICAgICAgImNvbS5hbmRyb2lkLm1lZGlhIiwKKyAgICAgICAgInRlc3RfY29tLmFuZHJvaWQubWVkaWEiLAorICAgIF0sCisKKyAgICAvL2hlYWRlcl9saWJzOiBbICJsaWJhcmVjdF9oZWFkZXJzIiwgImxpYmFyZWN0X2hlYWRlcnNfZm9yX25kayIgXSwKKyAgICBzdGF0aWNfbGliczogWyAibGliYXJlY3QiIF0sCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmJhc2UiLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICAgICAgImxpYm1lZGlhbmRrIiwKKyAgICAgICAgImxpYm5hdGl2ZXdpbmRvdyIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgICAgICJsaWJiaW5kZXJfbmRrIiwKKyAgICBdLAorCisgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWworICAgICAgICAiaW5jbHVkZSIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLVdhbGwiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgICAgICItV2Zvcm1hdCIsCisgICAgICAgICItV25vLWVycm9yPWRlcHJlY2F0ZWQtZGVjbGFyYXRpb25zIiwKKyAgICAgICAgIi1XdGhyZWFkLXNhZmV0eSIsCisgICAgICAgICItV3VudXNlZCIsCisgICAgICAgICItV3VucmVhY2hhYmxlLWNvZGUiLAorICAgIF0sCisKKyAgICBzYW5pdGl6ZTogeworICAgICAgICBtaXNjX3VuZGVmaW5lZDogWworICAgICAgICAgICAgInVuc2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICAgICAgInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgXSwKKyAgICAgICAgY2ZpOiB0cnVlLAorICAgIH0sCit9CisKK2NjX2xpYnJhcnkgeworICAgIG5hbWU6ICJsaWJtZWRpYXRyYW5zY29kZXIiLAorICAgIGRlZmF1bHRzOiBbIm1lZGlhdHJhbnNjb2Rlcl9kZWZhdWx0cyJdLAorfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGlibWVkaWF0cmFuc2NvZGluZy90cmFuc2NvZGVyL01lZGlhU2FtcGxlUXVldWUuY3BwIGIvbWVkaWEvbGlibWVkaWF0cmFuc2NvZGluZy90cmFuc2NvZGVyL01lZGlhU2FtcGxlUXVldWUuY3BwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmIwODVjOTgKLS0tIC9kZXYvbnVsbAorKysgYi9tZWRpYS9saWJtZWRpYXRyYW5zY29kaW5nL3RyYW5zY29kZXIvTWVkaWFTYW1wbGVRdWV1ZS5jcHAKQEAgLTAsMCArMSw2MyBAQAorLyoKKyAqIENvc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V0U2FtcGxlVHJhY2tJbmRleChtRXh0cmFjdG9yKTsKKworICAgIFNhbXBsZUN1cnNvciYgY3Vyc29yID0gbVRyYWNrQ3Vyc29yc1ttRXh0cmFjdG9yVHJhY2tJbmRleF07CisgICAgaWYgKG1FeHRyYWN0b3JTYW1wbGVJbmRleCA+IGN1cnNvci5wcmV2aW91cy5pbmRleCkgeworICAgICAgICBpZiAoIWN1cnNvci5jdXJyZW50LmlzU2V0KSB7CisgICAgICAgICAgICBjdXJzb3IuY3VycmVudC5zZXQobUV4dHJhY3RvclNhbXBsZUluZGV4LCBBTWVkaWFFeHRyYWN0b3JfZ2V0U2FtcGxlVGltZShtRXh0cmFjdG9yKSk7CisgICAgICAgIH0gZWxzZSBpZiAoIWN1cnNvci5uZXh0LmlzU2V0ICYmIG1FeHRyYWN0b3JTYW1wbGVJbmRleCA+IGN1cnNvci5jdXJyZW50LmluZGV4KSB7CisgICAgICAgICAgICBjdXJzb3IubmV4dC5zZXQobUV4dHJhY3RvclNhbXBsZUluZGV4LCBBTWVkaWFFeHRyYWN0b3JfZ2V0U2FtcGxlVGltZShtRXh0cmFjdG9yKSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gdHJ1ZTsKK30KKworbWVkaWFfc3RhdHVzX3QgTWVkaWFTYW1wbGVSZWFkZXJOREs6OnNlZWtFeHRyYWN0b3JCYWNrd2FyZHNfbChpbnQ2NF90IHRhcmdldFRpbWVVcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHRhcmdldFRyYWNrSW5kZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ2NF90IHRhcmdldFNhbXBsZUluZGV4KSB7CisgICAgaWYgKHRhcmdldFNhbXBsZUluZGV4ID4gbUV4dHJhY3RvclNhbXBsZUluZGV4KSB7CisgICAgICAgIExPRyhFUlJ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pIHsKKyAgICAgICAgaWYgKCFhZHZhbmNlRXh0cmFjdG9yX2woKSkgeworICAgICAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9FTkRfT0ZfU1RSRUFNOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIEFNRURJQV9PSzsKK30KKworbWVkaWFfc3RhdHVzX3QgTWVkaWFTYW1wbGVSZWFkZXJOREs6Om1vdmVUb1RyYWNrX2woaW50IHRyYWNrSW5kZXgpIHsKKyAgICByZXR1cm4gbW92ZVRvU2FtcGxlX2wobVRyYWNrQ3Vyc29yc1t0cmFja0luZGV4XS5jdXJyZW50LCB0cmFja0luZGV4KTsKK30KKworbWVkaWFfc3RhdHVzX3QgTWVkaWFTYW1wbGVSZWFkZXJOREs6OndhaXRGb3JUcmFja19sKGludCB0cmFja0luZGV4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2s8c3RkOjptdXRleD4mIGxvY2tIZWxkKSB7CisgICAgd2hpbGUgKHRyYWNrSW5kZXggIT0gbUV4dHJhY3RvclRyYWNrSW5kZXggJiYgIW1Fb3NSZWFjaGVkICYmIG1FbmZvcmNlU2VxdWVudGlhbEFjY2VzcykgeworICAgICAgICBtVHJhY2tTaWduYWxzW3RyYWNrSW5kZXhdLndhaXQobG9ja0hlbGQpOworICAgIH0KKworICAgIGlmIChtRW9zUmVhY2hlZCkgeworICAgICAgICByZXR1cm4gQU1FRElBX0VSUk9SX0VORF9PRl9TVFJFQU07CisgICAgfQorCisgICAgaWYgKCFtRW5mb3JjZVNlcXVlbnRpYWxBY2Nlc3MpIHsKKyAgICAgICAgcmV0dXJuIG1vdmVUb1RyYWNrX2wodHJhY2tJbmRleCk7CisgICAgfQorCisgICAgcmV0dXJuIEFNRURJQV9PSzsKK30KKworbWVkaWFfc3RhdHVzX3QgTWVkaWFTYW1wbGVSZWFkZXJOREs6OnByaW1lRXh0cmFjdG9yRm9yVHJhY2tfbCgKKyAgICAgICAgaW50IHRyYWNrSW5kZXgsIHN0ZDo6dW5pcXVlX2xvY2s8c3RkOjptdXRleD4mIGxvY2tIZWxkKSB7CisgICAgaWYgKG1FeHRyYWN0b3JUcmFja0luZGV4IDwgMCkgeworICAgICAgICBtRXh0cmFjdG9yVHJhY2tJbmRleCA9IEFNZWRpYUV4dHJhY3Rvcl9nZXRTYW1wbGVUcmFja0luZGV4KG1FeHRyYWN0b3IpOworICAgICAgICBpZiAobUV4dHJhY3RvclRyYWNrSW5kZXggPCAwKSB7CisgICAgICAgICAgICByZXR1cm4gQU1FRElBX0VSUk9SX0VORF9PRl9TVFJFQU07CisgICAgICAgIH0KKyAgICAgICAgbVRyYWNrQ3Vyc29yc1ttRXh0cmFjdG9yVHJhY2tJbmRleF0uY3VycmVudC5zZXQobUV4dHJhY3RvclNhbXBsZUluZGV4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTWVkaWFFeHRyYWN0b3JfZ2V0U2FtcGxlVGltZShtRXh0cmFjdG9yKSk7CisgICAgfQorCisgICAgaWYgKG1FbmZvcmNlU2VxdWVudGlhbEFjY2VzcykgeworICAgICAgICByZXR1cm4gd2FpdEZvclRyYWNrX2wodHJhY2tJbmRleCwgbG9ja0hlbGQpOworICAgIH0gZWxzZSB7CisgICAgICAgIHJldHVybiBtb3ZlVG9UcmFja19sKHRyYWNrSW5kZXgpOworICAgIH0KK30KKworbWVkaWFfc3RhdHVzX3QgTWVkaWFTYW1wbGVSZWFkZXJOREs6OnNlbGVjdFRyYWNrKGludCB0cmFja0luZGV4KSB7CisgICAgc3RkOjpzY29wZWRfbG9jayBsb2NrKG1FeHRyYWN0b3JNdXRleCk7CisKKyAgICBpZiAodHJhY2tJbmRleCA8IDAgfHwgdHJhY2tJbmRleCA+PSBtVHJhY2tDb3VudCkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJJbnZhbGlkIHRyYWNrS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gICAgICAgIC8vIElmIHN3aXRjaGluZyBmcm9tIG5vdCBlbmZvcmNpbmcgdG8gZW5mb3JjaW5nIHNlcXVlbnRpYWwgYWNjZXNzIHRoZSBleHRyYWN0b3IgbmVlZHMgdG8gYmUKKyAgICAgICAgLy8gcG9zaXRpb25lZCBmb3IgdGhlIHRyYWNrIGZhcnRoZXN0IGJlaGluZCBzbyB0aGF0IGl0IHdvbid0IGdldCBzdHVjayB3YWl0aW5nLgorICAgICAgICBzdHJ1Y3QgeworICAgICAgICAgICAgU2FtcGxlUG9zaXRpb24qIHBvcyA9IG51bGxwdHI7CisgICAgICAgICAgICBpbnQgdHJhY2tJbmRleCA9IC0xOworICAgICAgICB9IGVhcmxpZXN0U2FtcGxlOworCisgICAgICAgIGZvciAoaW50IHRyYWNrSW5kZXggPSAwOyB0cmFja0luZGV4IDwgbVRyYWNrQ291bnQ7ICsrdHJhY2tJbmRleCkgeworICAgICAgICAgICAgU2FtcGxlUG9zaXRpb24mIGxhc3RLbm93blRyYWNrUG9zaXRpb24gPSBtVHJhY2tDdXJzb3JzW3RyYWNrSW5kZXhdLmN1cnJlbnQuaXNTZXQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IG1UcmFja0N1cnNvcnNbdHJhY2tJbmRleF0uY3VycmVudAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogbVRyYWNrQ3Vyc29yc1t0cmFja0luZGV4XS5wcmV2aW91czsKKworICAgICAgICAgICAgaWYgKGxhc3RLbm93blRyYWNrUG9zaXRpb24uaXNTZXQpIHsKKyAgICAgICAgICAgICAgICBpZiAoZWFybGllc3RTYW1wbGUucG9zID09IG51bGxwdHIgfHwKKyAgICAgICAgICAgICAgICAgICAgZWFybGllc3RTYW1wbGUucG9zLT5pbmRleCA+IGxhc3RLbm93blRyYWNrUG9zaXRpb24uaW5kZXgpIHsKKyAgICAgICAgICAgICAgICAgICAgZWFybGllc3RTYW1wbGUucG9zID0gJmxhc3RLbm93blRyYWNrUG9zaXRpb247CisgICAgICAgICAgICAgICAgICAgIGVhcmxpZXN0U2FtcGxlLnRyYWNrSW5kZXggPSB0cmFja0luZGV4OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChlYXJsaWVzdFNhbXBsZS5wb3MgPT0gbnVsbHB0cikgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiTm8ga25vd24gc2FtcGxlIHBvc2l0aW9uIGZvdW5kIjsKKyAgICAgICAgICAgIHJldHVybiBBTUVESUFfRVJST1JfVU5LTk9XTjsKKyAgICAgICAgfQorCisgICAgICAgIG1lZGlhX3N0YXR1c190IHN0YXR1cyA9IG1vdmVUb1NhbXBsZV9sKCplYXJsaWVzdFNhbXBsZS5wb3MsIGVhcmxpZXN0U2FtcGxlLnRyYWNrSW5kZXgpOworICAgICAgICBpZiAoc3RhdHVzICE9IEFNRURJQV9PSykgcmV0dXJuIHN0YXR1czsKKworICAgICAgICB3aGlsZSAoIShtVHJhY2tDdXJzb3JzW21FeHRyYWN0b3JUcmFja0luZGV4XS5jdXJyZW50LmlzU2V0ICYmCisgICAgICAgICAgICAgICAgIG1UcmFja0N1cnNvcnNbbUV4dHJhY3RvclRyYWNrSW5kZXhdLmN1cnJlbnQuaW5kZXggPT0gbUV4dHJhY3RvclNhbXBsZUluZGV4KSkgeworICAgICAgICAgICAgaWYgKCFhZHZhbmNlRXh0cmFjdG9yX2woKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBBTUVESUFfRVJST1JfRU5EX09GX1NUUkVBTTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIG1FbmZvcmNlU2VxdWVudGlhbEFjY2VzcyA9IGVuZm9yY2U7CisgICAgcmV0dXJuIEFNRURJQV9PSzsKK30KKworbWVkaWFfc3RhdHVzX3QgTWV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aXplOworICAgICAgICBkdXJhdGlvblVzID0gc2FtcGxlZER1cmF0aW9uVXM7CisgICAgfQorCisgICAgaWYgKHRvdGFsU2FtcGxlU2l6ZSA9PSAwIHx8IGR1cmF0aW9uVXMgPD0gMCkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJVbmFibGUgdG8gZXN0aW1hdGUgdHJhY2sgYml0cmF0ZSI7CisgICAgICAgIHJldHVybiBBTUVESUFfRVJST1JfTUFMRk9STUVEOworICAgIH0KKworICAgICpiaXRyYXRlID0gcm91bmRmKChmbG9hdCl0b3RhbFNhbXBsZVNpemUgKiA4ICogMTAwMDAwMCAvIGR1cmF0aW9uVXMpOworICAgIHJldHVybiBBTUVESUFfT0s7Cit9CisKK21lZGlhX3N0YXR1c190IE1lZGlhU2FtcGxlUmVhZGVyTkRLOjpnZXRTYW1wbGVJbmZvRm9yVHJhY2soaW50IHRyYWNrSW5kZXgsIE1lZGlhU2FtcGxlSW5mbyogaW5mbykgeworICAgIHN0ZDo6dW5pcXVlX2xvY2s8c3RkOjptdXRleD4gbG9jayhtRXh0cmFjdG9yTXV0ZXgpOworCisgICAgaWYgKG1UcmFja1NpZ25hbHMuZmluZCh0cmFja0luZGV4KSA9PSBtVHJhY2tTaWduYWxzLmVuZCgpKSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgIlRyYWNrIG5vdCBzZWxlY3RlZC4iOworICAgICAgICByZXR1cm4gQU1FRElBX0VSUk9SX0lOVkFMSURfUEFSQU1FVEVSOworICAgIH0gZWxzZSBpZiAoaW5mbyA9PSBudWxscHRyKSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgIk1lZGlhU2FtcGxlSW5mbyBwb2ludGVyIGlzIE5VTEwuIjsKKyAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9JTlZBTElEX1BBUkFNRVRFUjsKKyAgICB9CisKKyAgICBtZWRpYV9zdGF0dXNfdCBzdGF0dXMgPSBwcmltZUV4dHJhY3RvckZvclRyYWNrX2wodHJhY2tJbmRleCwgbG9jayk7CisgICAgaWYgKHN0YXR1cyA9PSBBTUVESUFfT0spIHsKKyAgICAgICAgaW5mby0+cHJlc2VudGF0aW9uVGltZVVzID0gQU1lZGlhRXh0cmFjdG9yX2dldFNhbXBsZVRpbWUobUV4dHJhY3Rvcik7CisgICAgICAgIGluZm8tPmZsYWdzID0gQU1lZGlhRXh0cmFjdG9yX2dldFNhbXBsZUZsYWdzKG1FeHRyYWN0b3IpOworICAgICAgICBpbmZvLT5zaXplID0gQU1lZGlhRXh0cmFjdG9yX2dldFNhbXBsZVNpemUobUV4dHJhY3Rvcik7CisgICAgfSBlbHNlIGlmIChzdGF0dXMgPT0gQU1FRElBX0VSUk9SX0VORF9PRl9TVFJFQU0pIHsKKyAgICAgICAgaW5mby0+cHJlc2VudGF0aW9uVGltZVVzID0gMDsKKyAgICAgICAgaW5mby0+ZmxhZ3MgPSBTQU1QTEVfRkxBR19FTkRfT0ZfU1RSRUFNOworICAgICAgICBpbmZvLT5zaXplID0gMDsKKyAgICAgICAgTE9HKERFQlVHKSA8PCAiICBnZXRTYW1wbGVJbmZvRm9yVHJhY2sgIyIgPDwgdHJhY2tJbmRleCA8PCAiOiBFbmQgT2YgU3RyZWFtIjsKKyAgICB9IGVsc2UgeworICAgICAgICBMT0coRVJST1IpIDw8ICIgIGdldFNhbXBsZUluZm9Gb3JUcmFjayAjIiA8PCB0cmFja0luZGV4IDw8ICI6IEVycm9yICIgPDwgc3RhdHVzOworICAgIH0KKworICAgIHJldHVybiBzdGF0dXM7Cit9CisKK21lZGlhX3N0YXR1c190IE1lZGlhU2FtcGxlUmVhZGVyTkRLOjpyZWFkU2FtcGxlRGF0YUZvclRyYWNrKGludCB0cmFja0luZGV4LCB1aW50OF90KiBidWZmZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgYnVmZmVyU2l6ZSkgeworICAgIHN0ZDo6dW5pcXVlX2xvY2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ZVdyaXRlcjo6c3RhcnQoKSB7CisgICAgc3RkOjpzY29wZWRfbG9jayBsb2NrKG1NdXRleCk7CisKKyAgICBpZiAobVRyYWNrcy5zaXplKCkgPT0gMCkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJObyB0cmFja3MgdG8gd3JpdGUuIjsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0gZWxzZSBpZiAobVN0YXRlICE9IElOSVRJQUxJWkVEKSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgIlNhbXBsZSB3cml0ZXIgaXMgbm90IGluaXRpYWxpemVkIjsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIG1TdGF0ZSA9IFNUQVJURUQ7CisgICAgc3RkOjp0aHJlYWQoW3RoaXNdIHsKKyAgICAgICAgYW5kcm9pZFNldFRocmVhZFByaW9yaXR5KDAgLyogdGlkICgwID0gY3VycmVudCkgKi8sIEFORFJPSURfUFJJT1JJVFlfQkFDS0dST1VORCk7CisgICAgICAgIHByY3RsKFBSX1NFVF9OQU1FLCAodW5zaWduZWQgbG9uZykiU2FtcGxlV3JpdGVyVHJkIiwgMCwgMCwgMCk7CisKKyAgICAgICAgYm9vbCB3YXNTdG9wcGVkID0gZmFsc2U7CisgICAgICAgIG1lZGlhX3N0YXR1c190IHN0YXR1cyA9IHdyaXRlU2FtcGxlcygmd2FzU3RvcHBlZCk7CisgICAgICAgIGlmIChhdXRvIGNhbGxiYWNrcyA9IG1DYWxsYmFja3MubG9jaygpKSB7CisgICAgICAgICAgICBpZiAod2FzU3RvcHBlZCAmJiBzdGF0dXMgPT0gQU1FRElBX09LKSB7CisgICAgICAgICAgICAgICAgY2FsbGJhY2tzLT5vblN0b3BwZWQodGhpcyk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGNhbGxiYWNrcy0+b25GaW5pc2hlZCh0aGlzLCBzdGF0dXMpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfSkuZG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wZGF0ZUludGVydmFsKG1IZWFydEJlYXRJbnRlcnZhbFVzKTsKKyAgICBzdGQ6OmNocm9ubzo6c3RlYWR5X2Nsb2NrOjp0aW1lX3BvaW50IG5leHRVcGRhdGVUaW1lID0KKyAgICAgICAgICAgIHN0ZDo6Y2hyb25vOjpzdGVhZHlfY2xvY2s6Om5vdygpICsgdXBkYXRlSW50ZXJ2YWw7CisKKyAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICBpZiAodHJhY2tFb3NDb3VudCA+PSBtVHJhY2tzLnNpemUoKSkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBzaXplX3QgdHJhY2tJbmRleDsKKyAgICAgICAgc3RkOjpzaGFyZWRfcHRyPE1lZGlhU2FtcGxlPiBzYW1wbGU7CisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtTXV0ZXgpOworICAgICAgICAgICAgd2hpbGUgKG1TYW1wbGVRdWV1ZS5lbXB0eSgpICYmIG1TdGF0ZSA9PSBTVEFSVEVEKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFydEJlYXRJbnRlcnZhbFVzIDw9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgbVNhbXBsZVNpZ25hbC53YWl0KGxvY2spOworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAobVNhbXBsZVNpZ25hbC53YWl0X3VudGlsKGxvY2ssIG5leHRVcGRhdGVUaW1lKSA9PSBzdGQ6OmN2X3N0YXR1czo6dGltZW91dCkgeworICAgICAgICAgICAgICAgICAgICAvLyBTZW5kIGhlYXJ0LWJlYXQgaWYgdGhlcmUgaXMgYW55IHByb2dyZXNzIHNpbmNlIGxhc3QgdXBkYXRlIHRpbWUuCisgICAgICAgICAgICAgICAgICAgIGlmIChwcm9ncmVzc1NpbmNlTGFzdFJlcG9ydCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGF1dG8gY2FsbGJhY2tzID0gbUNhbGxiYWNrcy5sb2NrKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFja3MtPm9uSGVhcnRCZWF0KHRoaXMpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgcHJvZ3Jlc3NTaW5jZUxhc3RSZXBvcnQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBuZXh0VXBkYXRlVGltZSArPSB1cGRhdGVJbnRlcnZhbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gU1RPUFBFRCkgeworICAgICAgICAgICAgICAgICp3YXNTdG9wcGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICByZXR1cm4gQU1FRElBX09LOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhdXRvJiB0b3BFbnRyeSA9IG1TYW1wbGVRdWV1ZS50b3AoKTsKKyAgICAgICAgICAgIHRyYWNrSW5kZXggPSB0b3BFbnRyeS5maXJzdDsKKyAgICAgICAgICAgIHNhbXBsZSA9IHRvcEVudHJ5LnNlY29uZDsKKyAgICAgICAgICAgIG1TYW1wbGVRdWV1ZS5wb3AoKTsKKyAgICAgICAgfQorCisgICAgICAgIFRyYWNrUmVjb3JkJiB0cmFjayA9IG1UcmFja3NbdHJhY2tJbmRleF07CisKKyAgICAgICAgaWYgKHNhbXBsZS0+aW5mby5mbGFncyAmIFNBTVBMRV9GTEFHX0VORF9PRl9TVFJFQU0pIHsKKyAgICAgICAgICAgIGlmICh0cmFjay5tUmVhY2hlZEVvcykgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBUcmFjayByZWFjaGVkIGVuZCBvZiBzdHJlYW0uCisgICAgICAgICAgICB0cmFjay5tUmVhY2hlZEVvcyA9IHRydWU7CisgICAgICAgICAgICB0cmFja0Vvc0NvdW50Kys7CisKKyAgICAgICAgICAgIC8vIFByZXNlcnZlIHNvdXJjZSB0cmFjayBkdXJhdGlvbiBieSBzZXR0aW5nIHRoZSBhcHByb3ByaWF0ZSB0aW1lc3RhbXAgb24gdGhlCisgICAgICAgICAgICAvLyBlbXB0eSBFbmQtT2YtU3RyZWFtIHNhbXBsZS4KKyAgICAgICAgICAgIGlmICh0cmFjay5tRHVyYXRpb25VcyA+IDAgJiYgdHJhY2subUZpcnN0U2FtcGxlVGltZVNldCkgeworICAgICAgICAgICAgICAgIHNhbXBsZS0+aW5mby5wcmVzZW50YXRpb25UaW1lVXMgPSB0cmFjay5tRHVyYXRpb25VcyArIHRyYWNrLm1GaXJzdFNhbXBsZVRpbWVVczsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHRyYWNrLm1QcmV2U2FtcGxlVGltZVVzID0gc2FtcGxlLT5pbmZvLnByZXNlbnRhdGlvblRpbWVVczsKKyAgICAgICAgaWYgKCF0cmFjay5tRmlyc3RTYW1wbGVUaW1lU2V0KSB7CisgICAgICAgICAgICAvLyBSZWNvcmQgdGhlIGZpcnN0IHNhbXBsZSdzIHRpbWVzdGFtcCBpbiBvcmRlciB0byB0cmFuc2xhdGUgZHVyYXRpb24gdG8gRU9TCisgICAgICAgICAgICAvLyB0aW1lIGZvciB0cmFja3MgdGhhdCBkb2VzIG5vdCBzdGFydCBhdCAwLgorICAgICAgICAgICAgdHJhY2subUZpcnN0U2FtcGxlVGltZVVzID0gc2FtcGxlLT5pbmZvLnByZXNlbnRhdGlvblRpbWVVczsKKyAgICAgICAgICAgIHRyYWNrLm1GaXJzdFNhbXBsZVRpbWVTZXQgPSB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgYnVmZmVySW5mby5vZmZzZXQgPSBzYW1wbGUtPmRhdGFPZmZzZXQ7CisgICAgICAgIGJ1ZmZlckluZm8uc2l6ZSA9IHNhbXBsZS0+aW5mby5zaXplOworICAgICAgICBidWZmZXJJbmZvLmZsYWdzID0gc2FtcGxlLT5pbmZvLmZsYWdzOworICAgICAgICBidWZmZXJJbmZvLnByZXNlbnRhdGlvblRpbWVVcyA9IHNhbXBsZS0+aW5mby5wcmVzZW50YXRpb25UaW1lVXM7CisKKyAgICAgICAgbWVkaWFfc3RhdHVzX3Qgc3RhdHVzID0gbU11eGVyLT53cml0ZVNhbXBsZURhdGEodHJhY2tJbmRleCwgc2FtcGxlLT5idWZmZXIsICZidWZmZXJJbmZvKTsKKyAgICAgICAgaWYgKHN0YXR1cyAhPSBBTUVESUFfT0spIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIndyaXRlU2FtcGxlRGF0YSByZXR1cm5lZCAiIDw8IHN0YXR1czsKKyAgICAgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgICAgIH0KKyAgICAgICAgc2FtcGxlLnJlc2V0KCk7CisKKyAgICAgICAgLy8gVE9ETyhsbmlsc3Nvbik6IEFkZCBvcHRpb24gdG8gdG9nZ2xlIHByb2dyZXNzIHJlcG9ydGluZyBvbi9vZmYuCisgICAgICAgIGlmICh0cmFja0luZGV4ID09IHByaW1hcnlUcmFja0luZGV4KSB7CisgICAgICAgICAgICBjb25zdCBpbnQ2NF90IGVsYXBzZWQgPSB0cmFjay5tUHJldlNhbXBsZVRpbWVVcyAtIHRyYWNrLm1GaXJzdFNhbXBsZVRpbWVVczsKKyAgICAgICAgICAgIGludDMyX3QgcHJvZ3Jlc3MgPSAoZWxhcHNlZCAqIDEwMCkgLyB0cmFjay5tRHVyYXRpb25VczsKKyAgICAgICAgICAgIHByb2dyZXNzID0gc3RkOjpjbGFtcChwcm9ncmVzcywgMCwgMTAwKTsKKworICAgICAgICAgICAgaWYgKHByb2dyZXNzID4gbGFzdFByb2dyZXNzVXBkYXRlKSB7CisgICAgICAgICAgICAgICAgaWYgKGF1dG8gY2FsbGJhY2tzID0gbUNh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XN0aW5hdGlvbkZvcm1hdCkgeworICAgIHN0ZDo6c2NvcGVkX2xvY2sgbG9ja3ttU3RhdGVNdXRleH07CisKKyAgICBpZiAobVN0YXRlICE9IFVOSU5JVElBTElaRUQpIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ29uZmlndXJlIGNhbiBvbmx5IGJlIGNhbGxlZCBvbmNlIjsKKyAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9VTlNVUFBPUlRFRDsKKyAgICB9CisKKyAgICBpZiAobWVkaWFTYW1wbGVSZWFkZXIgPT0gbnVsbHB0cikgeworICAgICAgICBMT0coRVJST1IpIDw8ICJNZWRpYVNhbXBsZVJlYWRlciBpcyBudWxsIjsKKyAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9JTlZBTElEX1BBUkFNRVRFUjsKKyAgICB9CisgICAgaWYgKHRyYWNrSW5kZXggPCAwIHx8IHRyYWNrSW5kZXggPj0gbWVkaWFTYW1wbGVSZWFkZXItPmdldFRyYWNrQ291bnQoKSkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJUcmFja0luZGV4IGlzIGludmFsaWQgIiA8PCB0cmFja0luZGV4OworICAgICAgICByZXR1cm4gQU1FRElBX0VSUk9SX0lOVkFMSURfUEFSQU1FVEVSOworICAgIH0KKworICAgIG1NZWRpYVNhbXBsZVJlYWRlciA9IG1lZGlhU2FtcGxlUmVhZGVyOworICAgIG1UcmFja0luZGV4ID0gdHJhY2tJbmRleDsKKworICAgIG1Tb3VyY2VGb3JtYXQgPSBzdGQ6OnNoYXJlZF9wdHI8QU1lZGlhRm9ybWF0PihtTWVkaWFTYW1wbGVSZWFkZXItPmdldFRyYWNrRm9ybWF0KG1UcmFja0luZGV4KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkFNZWRpYUZvcm1hdF9kZWxldGUpOworICAgIGlmIChtU291cmNlRm9ybWF0ID09IG51bGxwdHIpIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiVW5hYmxlIHRvIGdldCBmb3JtYXQgZm9yIHRyYWNrICMiIDw8IG1UcmFja0luZGV4OworICAgICAgICByZXR1cm4gQU1FRElBX0VSUk9SX01BTEZPUk1FRDsKKyAgICB9CisKKyAgICBtZWRpYV9zdGF0dXNfdCBzdGF0dXMgPSBjb25maWd1cmVEZXN0aW5hdGlvbkZvcm1hdChkZXN0aW5hdGlvbkZvcm1hdCk7CisgICAgaWYgKHN0YXR1cyAhPSBBTUVESUFfT0spIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiY29uZmlndXJlIGZhaWxlZCB3aXRoIGVycm9yICIgPDwgc3RhdHVzOworICAgICAgICByZXR1cm4gc3RhdHVzOworICAgIH0KKworICAgIG1TdGF0ZSA9IENPTkZJR1VSRUQ7CisgICAgcmV0dXJuIEFNRURJQV9PSzsKK30KKworYm9vbCBNZWRpYVRyYWNrVHJhbnNjb2Rlcjo6c3RhcnQoKSB7CisgICAgc3RkOjpzY29wZWRfbG9jayBsb2Nre21TdGF0ZU11dGV4fTsKKworICAgIGlmIChtU3RhdGUgIT0gQ09ORklHVVJFRCkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJUcmFja1RyYW5zY29kZXIgbXVzdCBiZSBjb25maWd1cmVkIGJlZm9yZSBzdGFydGVkIjsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBtU3RhdGUgPSBTVEFSVEVEOworCisgICAgc3RkOjp0aHJlYWQoW3RoaXNdIHsKKyAgICAgICAgYW5kcm9pZFNldFRocmVhZFByaW9yaXR5KDAgLyogdGlkICgwID0gY3VycmVudCkgKi8sIEFORFJPSURfUFJJT1JJVFlfQkFDS0dST1VORCk7CisgICAgICAgIGJvb2wgc3RvcHBlZCA9IGZhbHNlOworICAgICAgICBtZWRpYV9zdGF0dXNfdCBzdGF0dXMgPSBydW5UcmFuc2NvZGVMb29wKCZzdG9wcGVkKTsKKworICAgICAgICAvLyBPdXRwdXQgYW4gRU9TIHNhbXBsZSBpZiB0aGUgdHJhbnNjb2RlciB3YXMgc3RvcHBlZC4KKyAgICAgICAgaWYgKHN0b3BwZWQpIHsKKyAgICAgICAgICAgIGF1dG8gc2FtcGxlID0gc3RkOjptYWtlX3NoYXJlZDxNZWRpYVNhbXBsZT4oKTsKKyAgICAgICAgICAgIHNhbXBsZS0+aW5mby5mbGFncyA9IFNBTVBMRV9GTEFHX0VORF9PRl9TVFJFQU07CisgICAgICAgICAgICBvbk91dHB1dFNhbXBsZUF2YWlsYWJsZShzYW1wbGUpOworICAgICAgICB9CisKKyAgICAgICAgLy8gTm90aWZ5IHRoZSBjbGllbnQuCisgICAgICAgIGlmIChhdXRvIGNhbGxiYWNrcyA9IG1UcmFuc2NvZGVyQ2FsbGJhY2subG9jaygpKSB7CisgICAgICAgICAgICBpZiAoc3RvcHBlZCkgeworICAgICAgICAgICAgICAgIGNhbGxiYWNrcy0+b25UcmFja1N0b3BwZWQodGhpcyk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXR1cyA9PSBBTUVESUFfT0spIHsKKyAgICAgICAgICAgICAgICBjYWxsYmFja3MtPm9uVHJhY2tGaW5pc2hlZCh0aGlzKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgY2FsbGJhY2tzLT5vblRyYWNrRXJyb3IodGhpcywgc3RhdHVzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0pLmRldGFjaCgpOworCisgICAgcmV0dXJuIHRydWU7Cit9CisKK3ZvaWQgTWVkaWFUcmFja1RyYW5zY29kZXI6OnN0b3AoYm9vbCBzdG9wT25TeW5jU2FtcGxlKSB7CisgICAgc3RkOjpzY29wZWRfbG9jayBsb2Nre21TdGF0ZU11dGV4fTsKKworICAgIGlmIChtU3RhdGUgPT0gU1RBUlRFRCB8fCAobVN0b3BSZXF1ZXN0ID09IFNUT1BfT05fU1lOQyAmJiAhc3RvcE9uU3luY1Nh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ZWRpYUZvcm1hdD4gY3JlYXRlVmlkZW9UcmFja0Zvcm1hdChBTWVkaWFGb3JtYXQqIHNyY0Zvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFNZWRpYUZvcm1hdCogb3B0aW9ucykgeworICAgIGlmIChzcmNGb3JtYXQgPT0gbnVsbHB0ciB8fCBvcHRpb25zID09IG51bGxwdHIpIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ2Fubm90IG1lcmdlIG51bGwgZm9ybWF0cyI7CisgICAgICAgIHJldHVybiBudWxscHRyOworICAgIH0KKworICAgIC8vIC0tLS0tLS0gRGVmaW5lIHBhcmFtZXRlcnMgdG8gY29weSBmcm9tIHRoZSBzb3VyY2UgdHJhY2sgZm9ybWF0IC0tLS0tLS0KKyAgICBzdGQ6OnZlY3RvcjxBTWVkaWFGb3JtYXRVdGlsczo6RW50cnlDb3BpZXI+IHNyY1BhcmFtc1RvQ29weXsKKyAgICAgICAgICAgIEVOVFJZX0NPUElFUihBTUVESUFGT1JNQVRfS0VZX01JTUUsIFN0cmluZyksCisgICAgICAgICAgICBFTlRSWV9DT1BJRVIoQU1FRElBRk9STUFUX0tFWV9EVVJBVElPTiwgSW50NjQpLAorICAgICAgICAgICAgRU5UUllfQ09QSUVSKEFNRURJQUZPUk1BVF9LRVlfV0lEVEgsIEludDMyKSwKKyAgICAgICAgICAgIEVOVFJZX0NPUElFUihBTUVESUFGT1JNQVRfS0VZX0hFSUdIVCwgSW50MzIpLAorICAgICAgICAgICAgRU5UUllfQ09QSUVSKEFNRURJQUZPUk1BVF9LRVlfRlJBTUVfUkFURSwgSW50MzIpLAorICAgICAgICAgICAgRU5UUllfQ09QSUVSKEFNRURJQUZPUk1BVF9LRVlfQ09MT1JfUkFOR0UsIEludDMyKSwKKyAgICAgICAgICAgIEVOVFJZX0NPUElFUihBTUVESUFGT1JNQVRfS0VZX0NPTE9SX1NUQU5E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VwcG9ydGVkT3B0aW9uc3sKKyAgICAgICAgICAgIEVOVFJZX0NPUElFUihBTUVESUFGT1JNQVRfS0VZX01JTUUsIFN0cmluZyksCisgICAgICAgICAgICBFTlRSWV9DT1BJRVIoQU1FRElBRk9STUFUX0tFWV9EVVJBVElPTiwgSW50NjQpLAorICAgICAgICAgICAgRU5UUllfQ09QSUVSKEFNRURJQUZPUk1BVF9LRVlfV0lEVEgsIEludDMyKSwKKyAgICAgICAgICAgIEVOVFJZX0NPUElFUihBTUVESUFGT1JNQVRfS0VZX0hFSUdIVCwgSW50MzIpLAorICAgICAgICAgICAgRU5UUllfQ09QSUVSKEFNRURJQUZPUk1BVF9LRVlfQklUX1JBVEUsIEludDMyKSwKKyAgICAgICAgICAgIEVOVFJZX0NPUElFUihBTUVESUFGT1JNQVRfS0VZX1BST0ZJTEUsIEludDMyKSwKKyAgICAgICAgICAgIEVOVFJZX0NPUElFUihBTUVESUFGT1JNQVRfS0VZX0xFVkVMLCBJbnQzMiksCisgICAgICAgICAgICBFTlRSWV9DT1BJRVIoQU1FRElBRk9STUFUX0tFWV9DT0xPUl9SQU5HRSwgSW50MzIpLAorICAgICAgICAgICAgRU5UUllfQ09QSUVSKEFNRURJQUZPUk1BVF9LRVlfQ09MT1JfU1RBTkRBUkQsIEludDMyKSwKKyAgICAgICAgICAgIEVOVFJZX0NPUElFUihBTUVESUFGT1JNQVRfS0VZX0NPTE9SX1RSQU5TRkVSLCBJbnQzMiksCisgICAgICAgICAgICBFTlRSWV9DT1BJRVIoQU1FRElBRk9STUFUX0tFWV9GUkFNRV9SQVRFLCBJbnQzMiksCisgICAgICAgICAgICBFTlRSWV9DT1BJRVIoQU1FRElBRk9STUFUX0tFWV9JX0ZSQU1FX0lOVEVSVkFMLCBJbnQzMiksCisgICAgICAgICAgICBFTlRSWV9DT1BJRVIoQU1FRElBRk9STUFUX0tFWV9QUklPUklUWSwgSW50MzIpLAorICAgICAgICAgICAgRU5UUllfQ09QSUVSMihBTUVESU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2RlcnNEb25lICY9IChpdC5zZWNvbmQgPT0gRE9ORSk7CisgICAgICAgIH0KKyAgICB9CisgICAgaWYgKCF0cmFuc2NvZGVyc0RvbmUgfHwgc2FtcGxlV3JpdGVyU3RhdGUgPT0gUlVOTklORykgeworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgLy8gQWxsIGRvbmUuIFNlbmQgY2FsbGJhY2sgYXN5bmNocm9ub3VzbHkgYW5kIHdha2UgdXAgdGhyZWFkcyB3YWl0aW5nIGluIGNhbmNlbC9wYXVzZS4KKyAgICBtVGhyZWFkc0RvbmUgPSB0cnVlOworICAgIGlmICghbUNhbGxiYWNrU2VudCkgeworICAgICAgICBzdGQ6OnRocmVhZCBhc3luY05vdGlmaWNhdGlvblRocmVhZHtbdGhpcywgc2VsZiA9IHNoYXJlZF9mcm9tX3RoaXMoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IG1UcmFuc2NvZGVyU3RhdHVzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcHBlZCA9IG1UcmFuc2NvZGVyU3RvcHBlZF0geworICAgICAgICAgICAgcHJjdGwoUFJfU0VUX05BTUUsICh1bnNpZ25lZCBsb25nKSJUcmFuc2NvZENhbGxiayIsIDAsIDAsIDApOworCisgICAgICAgICAgICAvLyBJZiB0aGUgdHJhbnNjb2RlciB3YXMgc3RvcHBlZCB0aGF0IG1lYW5zIGEgY2FsbGVyIGlzIHdhaXRpbmcgaW4gc3RvcCBvciBwYXVzZQorICAgICAgICAgICAgLy8gaW4gd2hpY2ggY2FzZSB3ZSBkb24ndCBzZW5kIGEgY2FsbGJhY2suCisgICAgICAgICAgICBpZiAoc3RhdHVzICE9IEFNRURJQV9PSykgeworICAgICAgICAgICAgICAgIG1DYWxsYmFja3MtPm9uRXJyb3IodGhpcywgc3RhdHVzKTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoIXN0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HRoZSB0cmFja3Mgd2lsbCBub3QgZ2V0IHRoZWlyIG91dHB1dCBzYW1wbGUgcXVldWVzIGRyYWluZWQKKyAgICAgICAgLy8gYW5kIHRoZSB0cmFuc2NvZGVyIGNvdWxkIGhhbmcgZHVlIHRvIG9uZSB0cmFjayBydW5uaW5nIG91dCBvZiBidWZmZXJzIGFuZCBibG9ja2luZyB0aGUKKyAgICAgICAgLy8gb3RoZXIgdHJhY2tzIGZyb20gcmVhZGluZyBzb3VyY2Ugc2FtcGxlcyBiZWZvcmUgdGhleSBjb3VsZCBvdXRwdXQgdGhlaXIgZm9ybWF0cy4KKworICAgICAgICBzdGQ6OnNjb3BlZF9sb2NrIGxvY2t7bVRocmVhZFN0YXRlTXV0ZXh9OworICAgICAgICAvLyBEb24ndCBzdGFydCB0aGUgc2FtcGxlIHdyaXRlciBpZiBhIHN0b3AgYWxyZWFkeSBoYXMgYmVlbiByZXF1ZXN0ZWQuCisgICAgICAgIGlmICghbVNhbXBsZVdyaXRlclN0b3BwZWQpIHsKKyAgICAgICAgICAgIGlmICghbUNhbmNlbGxlZCkgeworICAgICAgICAgICAgICAgIG1TYW1wbGVSZWFkZXItPnNldEVuZm9yY2VTZXF1ZW50aWFsQWNjZXNzKHRydWUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgTE9HKERFQlVHKSA8PCAiU3RhcnRpbmcgc2FtcGxlIHdyaXRlci4iOworICAgICAgICAgICAgZXJyb3JTdGFydGluZyA9ICFtU2FtcGxlV3JpdGVyLT5zdGFydCgpOworICAgICAgICAgICAgaWYgKCFlcnJvclN0YXJ0aW5nKSB7CisgICAgICAgICAgICAgICAgbVRocmVhZFN0YXRlc1tzYW1wbGVXcml0ZXJQdHJdID0gUlVOTklORzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIGlmIChlcnJvclN0YXJ0aW5nKSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgIlVuYWJsZSB0byBzdGFydCBzYW1wbGUg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HJhbnNjb2Rlcj4oc2hhcmVkX2Zyb21fdGhpcygpKTsKKyAgICB9IGVsc2UgeworICAgICAgICBBTWVkaWFGb3JtYXQqIHNyY1RyYWNrRm9ybWF0ID0gbVNvdXJjZVRyYWNrRm9ybWF0c1t0cmFja0luZGV4XS5nZXQoKTsKKworICAgICAgICBjb25zdCBjaGFyKiBzcmNNaW1lID0gbnVsbHB0cjsKKyAgICAgICAgaWYgKCFBTWVkaWFGb3JtYXRfZ2V0U3RyaW5nKHNyY1RyYWNrRm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX01JTUUsICZzcmNNaW1lKSkgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiU291cmNlIHRyYWNrICMiIDw8IHRyYWNrSW5kZXggPDwgIiBoYXMgbm8gbWltZSB0eXBlIjsKKyAgICAgICAgICAgIHJldHVybiBBTUVESUFfRVJST1JfTUFMRk9STUVEOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHN0cm5jbXAoc3JjTWltZSwgInZpZGVvLyIsIDYpICE9IDApIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIk9ubHkgdmlkZW8gdHJhY2tzIGFyZSBzdXBwb3J0ZWQgZm9yIHRyYW5zY29kaW5nLiBVbmFibGUgdG8gY29uZmlndXJlICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgInRyYWNrICMiCisgICAgICAgICAgICAgICAgICAgICAgIDw8IHRyYWNrSW5kZXggPDwgIiB3aXRoIG1pbWUgIiA8PCBzcmNNaW1lOworICAgICAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9VTlNVUFBPUlRFRDsKKyAgICAgICAgfQorCisgICAgICAgIGNvbnN0IGNoYXIqIGRzdE1pbWUgPSBudWxscHRyOworICAgICAgICBpZiAoQU1lZGlhRm9ybWF0X2dldFN0cmluZyhkZXN0aW5hdGlvbk9wdGlvbnMsIEFNRURJQUZPUk1BVF9LRVlfTUlNRSwgJmRzdE1pbWUpKSB7CisgICAgICAgICAgICBpZiAoc3RybmNtcChkc3RNaW1lLCAidmlkZW8vIiwgNikgIT0gMCkgeworICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIlVuYWJsZSB0byBjb252ZXJ0IG1lZGlhIHR5cGVzIGZvciB0cmFjayAjIiA8PCB0cmFja0luZGV4IDw8ICIsIGZyb20gIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgc3JjTWltZSA8PCAiIHRvICIgPDwgZHN0TWltZTsKKyAgICAgICAgICAgICAgICByZXR1cm4gQU1FRElBX0VSUk9SX1VOU1VQUE9SVEVEOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdHJhbnNjb2RlciA9IFZpZGVvVHJhY2tUcmFuc2NvZGVyOjpjcmVhdGUoc2hhcmVkX2Zyb21fdGhpcygpLCBtUGlkLCBtVWlkKTsKKworICAgICAgICB0cmFja0Zvcm1hdCA9IGNyZWF0ZVZpZGVvVHJhY2tGb3JtYXQoc3JjVHJhY2tGb3JtYXQsIGRlc3RpbmF0aW9uT3B0aW9ucyk7CisgICAgICAgIGlmICh0cmFja0Zvcm1hdCA9PSBudWxscHRyKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJVbmFibGUgdG8gY3JlYXRlIHZpZGVvIHRyYWNrIGZvcm1hdCI7CisgICAgICAgICAgICByZXR1cm4gQU1FRElBX0VSUk9SX1VOS05PV047CisgICAgICAgIH0KKyAgICB9CisKKyAgICBtZWRpYV9zdGF0dXNfdCBzdGF0dXMgPSBtU2FtcGxlUmVhZGVyLT5zZWxlY3RUcmFjayh0cmFja0luZGV4KTsKKyAgICBpZiAoc3RhdHVzICE9IEFNRURJQV9PSykgeworICAgICAgICBMT0coRVJST1IpIDw8ICJVbmFibGUgdG8gc2VsZWN0IHRyYWNrICIgPDwgdHJhY2tJbmRleDsKKyAgICAgICAgcmV0dXJuIHN0YXR1czsKKyAgICB9CisKKyAgICBzdGF0dXMgPSB0cmFuc2NvZGVyLT5jb25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0dXJuIEFNRURJQV9FUlJPUl9JTlZBTElEX09QRVJBVElPTjsKKyAgICB9CisKKyAgICAvLyBTdGFydCB0cmFuc2NvZGVycworICAgIGJvb2wgc3RhcnRlZCA9IHRydWU7CisgICAgeworICAgICAgICBzdGQ6OnNjb3BlZF9sb2NrIGxvY2t7bVRocmVhZFN0YXRlTXV0ZXh9OworICAgICAgICBmb3IgKGF1dG8mIHRyYW5zY29kZXIgOiBtVHJhY2tUcmFuc2NvZGVycykgeworICAgICAgICAgICAgaWYgKCEoc3RhcnRlZCA9IHRyYW5zY29kZXItPnN0YXJ0KCkpKSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtVGhyZWFkU3RhdGVzW3N0YXRpY19jYXN0PGNvbnN0IHZvaWQqPih0cmFuc2NvZGVyLmdldCgpKV0gPSBSVU5OSU5HOworICAgICAgICB9CisgICAgfQorICAgIGlmICghc3RhcnRlZCkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJVbmFibGUgdG8gc3RhcnQgdHJhY2sgdHJhbnNjb2Rlci4iOworICAgICAgICBjYW5jZWwoKTsKKyAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9VTktOT1dOOworICAgIH0KKyAgICByZXR1cm4gQU1FRElBX09LOworfQorCittZWRpYV9zdGF0dXNfdCBNZWRpYVRyYW5zY29kZXI6OnJlcXVlc3RTdG9wKGJvb2wgc3RvcE9uU3luYykgeworICAgIHN0ZDo6c2NvcGVkX2xvY2sgbG9ja3ttVGhyZWFkU3RhdGVNdXRleH07CisgICAgaWYgKG1DYW5jZWxsZWQpIHsKKyAgICAgICAgTE9HKERFQlVHKSA8PCAiTWVkaWFUcmFuc2NvZGVyIGFscmVhZHkgY2FuY2VsbGVkIjsKKyAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9VTlNVUFBPUlRFRDsKKyAgICB9CisKKyAgICBpZiAoIXN0b3BPblN5bmMpIHsKKyAgICAgICAgbV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ibGUuICovCitjb25zdCBjaGFyKiBUQkRfQU1FRElBQ09ERUNfUEFSQU1FVEVSX0tFWV9DT0xPUl9UUkFOU0ZFUl9SRVFVRVNUID0gImNvbG9yLXRyYW5zZmVyLXJlcXVlc3QiOworY29uc3QgY2hhciogVEJEX0FNRURJQUNPREVDX1BBUkFNRVRFUl9LRVlfQkFDS0dST1VORF9NT0RFID0gImFuZHJvaWQuX2JhY2tncm91bmQtbW9kZSI7CisKK25hbWVzcGFjZSBBTWVkaWFGb3JtYXRVdGlscyB7CisKKyNkZWZpbmUgREVGSU5FX0ZPUk1BVF9WQUxVRV9DT1BZX0ZVTkMoX3R5cGUsIF90eXBlTmFtZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBib29sIENvcHlGb3JtYXRFbnRyeSMjX3R5cGVOYW1lKGNvbnN0IGNoYXIqIGtleSwgQU1lZGlhRm9ybWF0KiBmcm9tLCBBTWVkaWFGb3JtYXQqIHRvKSB7IFwKKyAgICAgICAgX3R5cGUgdmFsdWU7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgaWYgKEFNZWRpYUZvcm1hdF9nZXQjI190eXBlTmFtZShmcm9tLCBrZXksICZ2YWx1ZSkpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXQjI190eXBlTmFtZSh0bywga2V5LCB2YWx1ZSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIHJldHVybiB0cnVlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgcmV0dXJuIGZhbHNlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9CisKK0RFRklORV9GT1JNQVRfVkFMVUVfQ09QWV9GVU5DKGNvbnN0IGNoYXIqLCBTdHJpbmcpOworREVGSU5FX0ZPUk1BVF9WQUxVRV9DT1BZX0ZVTkMoaW50NjRfdCwgSW50NjQpOworREVGSU5FX0ZPUk1BVF9WQUxVRV9DT1BZX0ZVTkMoaW50MzJfdCwgSW50MzIpOworREVGSU5FX0ZPUk1BVF9WQUxVRV9DT1BZX0ZVTkMoZmxvYXQsIEZsb2F0KTsKKwordm9pZCBDb3B5Rm9ybWF0RW50cmllcyhBTWVkaWFGb3JtYXQqIGZyb20sIEFNZWRpYUZvcm1hdCogdG8sCisgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6dmVjdG9yPEVudHJ5Q29waWVyPiYgZW50cmllcykgeworICAgIGlmIChmcm9tID09IG51bGxwdHIgfHwgdG8gPT0gbnVsbHB0cikgeworICAgICAgICBMT0coRVJST1IpIDw8ICJDYW5ub3QgY29weSBudWxsIGZvcm1hdHMiOworICAgICAgICByZXR1cm47CisgICAgfSBlbHNlIGlmIChlbnRyaWVzLmVtcHR5KCkpIHsKKyAgICAgICAgTE9HKFdBUk5JTkcpIDw8ICJObyBlbnRyaWVzIHRvIGNvcHkiOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgZm9yIChhdXRvJiBlbnRyeSA6IGVudHJpZXMpIHsKKyAgICAgICAgaWYgKCFlbnRyeS5jb3B5KGVudHJ5LmtleSwgZnJvbSwgdG8pICYmIGVudHJ5LmNvcHkyICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgIGVudHJ5LmNvcHkyKGVudHJ5LmtleSwgZnJvbSwgdG8pOworICAgICAgICB9CisgICAgfQorfQorCisjZGVmaW5lIERFRklORV9TRVRfREVGQVVMVF9GT1JNQVRfVkFMVUVfRlVOQyhfdHlwZSwgX3R5cGVOYW1lKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgYm9vbCBTZXREZWZhdWx0Rm9ybWF0VmFsdWUjI190eXBlTmFtZShjb25zdCBjaGFyKiBrZXksIEFNZWRpYUZvcm1hdCogZm9ybWF0LCBfdHlwZSB2YWx1ZSkgeyBcCisgICAgICAgIF90eXBlIHRtcDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIGlmICghQU1lZGlhRm9ybWF0X2dldCMjX3R5cGVOYW1lKGZvcm1hdCwga2V5LCAmdG1wKSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0IyNfdHlwZU5hbWUoZm9ybWF0LCBrZXksIHZhbHVlKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgIHJldHVybiBmYWxzZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgfQorCitERUZJTkVfU0VUX0RFRkFVTFRfRk9STUFUX1ZBTFVFX0ZVTkMoZmxvYXQsIEZsb2F0KTsKK0RFRklORV9TRVRfREVGQVVMVF9GT1JNQVRfVkFMVUVfRlVOQyhpbnQzMl90LCBJbnQzMik7CisKKy8vIERldGVyb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gICAgICAgIHJldHVybiBBTUVESUFfRVJST1JfVU5LTk9XTjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc2FtcGxlID0gTWVkaWFTYW1wbGU6OmNyZWF0ZVdpdGhSZWxlYXNlQ2FsbGJhY2soCisgICAgICAgICAgICAgICAgICAgIGJ1ZmZlciwgMCAvKiBvZmZzZXQgKi8sIDAgLyogYnVmZmVySWQgKi8sIGJ1ZmZlclJlbGVhc2VDYWxsYmFjayk7CisKKyAgICAgICAgICAgIHN0YXR1cyA9IG1NZWRpYVNhbXBsZVJlYWRlci0+cmVhZFNhbXBsZURhdGFGb3JUcmFjayhtVHJhY2tJbmRleCwgYnVmZmVyLCBpbmZvLnNpemUpOworICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBBTUVESUFfT0spIHsKKyAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJVbmFibGUgdG8gcmVhZCBuZXh0IHNhbXBsZSBkYXRhLiBBYm9ydGluZyB0cmFuc2NvZGUuIjsKKyAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOworICAgICAgICAgICAgfQorCisgICAgICAgIH0gZWxzZSBpZiAoc3RhdHVzID09IEFNRURJQV9FUlJPUl9FTkRfT0ZfU1RSRUFNKSB7CisgICAgICAgICAgICBzYW1wbGUgPSBzdGQ6Om1ha2Vfc2hhcmVkPE1lZGlhU2FtcGxlPigpOworICAgICAgICAgICAgZW9zUmVhY2hlZCA9IHRydWU7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJVbmFibGUgdG8gZ2V0IG5leHQgc2FtcGxlIGluZm8uIEFib3J0aW5nIHRyYW5zY29kZS4iOworICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKKyAgICAgICAgfQorCisgICAgICAgIHNhbXBsZS0+aW5mbyA9IGluZm87CisgICAgICAgIG9uT3V0cHV0U2FtcGxlQXZhaWxhYmxlKHNhbXBsZSk7CisKKyAgICAgICAgaWYg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gICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgc3RhdGljIHZvaWQgb25Bc3luY091dHB1dEF2YWlsYWJsZShBTWVkaWFDb2RlYyogY29kZWMsIHZvaWQqIHVzZXJkYXRhLCBpbnQzMl90IGluZGV4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQU1lZGlhQ29kZWNCdWZmZXJJbmZvKiBidWZmZXJJbmZvUHRyKSB7CisgICAgICAgIFZpZGVvVHJhY2tUcmFuc2NvZGVyOjpDb2RlY1dyYXBwZXIqIHdyYXBwZXIgPQorICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PFZpZGVvVHJhY2tUcmFuc2NvZGVyOjpDb2RlY1dyYXBwZXIqPih1c2VyZGF0YSk7CisgICAgICAgIEFNZWRpYUNvZGVjQnVmZmVySW5mbyBidWZmZXJJbmZvID0gKmJ1ZmZlckluZm9QdHI7CisgICAgICAgIGlmIChhdXRvIHRyYW5zY29kZXIgPSB3cmFwcGVyLT5nZXRUcmFuc2NvZGVyKCkpIHsKKyAgICAgICAgICAgIHRyYW5zY29kZXItPm1Db2RlY01lc3NhZ2VRdWV1ZS5wdXNoKFt0cmFuc2NvZGVyLCBpbmRleCwgY29kZWMsIGJ1ZmZlckluZm9dIHsKKyAgICAgICAgICAgICAgICBpZiAoY29kZWMgPT0gdHJhbnNjb2Rlci0+bURlY29kZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNjb2Rlci0+dHJhbnNmZXJCdWZmZXIoaW5kZXgsIGJ1ZmZlckluZm8pOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY29kZWMgPT0gdHJhbnNjb2Rlci0+bUVuY29kZXItPmdldENvZGVjKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNjb2Rlci0+ZGVxdWV1ZU91dHB1dFNhbXBsZShpbmRleCwgYnVmZmVySW5mbyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgIC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wcG9ydGVkID0gQU1lZGlhRm9ybWF0X2dldEludDMyKGlucHV0Rm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRCRF9BTUVESUFDT0RFQ19QQVJBTUVURVJfS0VZX0NPTE9SX1RSQU5TRkVSX1JFUVVFU1QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnRyYW5zZmVyRnVuYykgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZmVyRnVuYyA9PSBDT0xPUl9UUkFOU0ZFUl9TRFJfVklERU87CisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZGVsZXRlKGlucHV0Rm9ybWF0KTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICghc3VwcG9ydGVkKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJIRFIgdG8gU0RSIGNvbnZlcnNpb24gdW5zdXBwb3J0ZWQgYnkgdGhlIGNvZGVjIjsKKyAgICAgICAgICAgIHJldHVybiBBTUVESUFfRVJST1JfVU5TVVBQT1JURUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBDb25maWd1cmUgY29kZWNzIHRvIHJ1biBpbiBhc3luYyBtb2RlLgorICAgIEFNZWRpYUNvZGVjT25Bc3luY05vdGlmeUNhbGxiYWNrIGFzeW5jQ29kZWNDYWxsYmFja3MgPSB7CisgICAgICAgICAgICAub25Bc3luY0lucHV0QXZhaWxhYmxlID0gQXN5bmNDb2RlY0NhbGxiYWNrRGlzcGF0Y2g6Om9uQXN5bmNJbnB1dEF2YWlsYWJsZSwKKyAgICAgICAgICAgIC5vbkFzeW5jT3V0cHV0QXZhaWxhYmxlID0gQXN5bmNDb2RlY0NhbGxiYWNrRGlzcGF0Y2g6Om9uQXN5bmNPdXRwdXRBdmFpbGFibGUsCisgICAgICAgICAgICAub25Bc3luY0Zvcm1hdENoYW5nZWQgPSBBc3luY0NvZGVjQ2FsbGJh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KEVSUk9SKSA8PCAiRGVjb2RlciByZXR1cm5lZCBhIE5VTEwgaW5wdXQgYnVmZmVyLiI7CisgICAgICAgICAgICBtU3RhdHVzID0gQU1FRElBX0VSUk9SX1VOS05PV047CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0gZWxzZSBpZiAoYnVmZmVyU2l6ZSA8IG1TYW1wbGVJbmZvLnNpemUpIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkRlY29kZXIgcmV0dXJuZWQgYW4gaW5wdXQgYnVmZmVyIHRoYXQgaXMgc21hbGxlciB0aGFuIHRoZSBzYW1wbGUuIjsKKyAgICAgICAgICAgIG1TdGF0dXMgPSBBTUVESUFfRVJST1JfVU5LTk9XTjsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIHN0YXR1cyA9IG1NZWRpYVNhbXBsZVJlYWRlci0+cmVhZFNhbXBsZURhdGFGb3JUcmFjayhtVHJhY2tJbmRleCwgc291cmNlQnVmZmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVNhbXBsZUluZm8uc2l6ZSk7CisgICAgICAgIGlmIChzdGF0dXMgIT0gQU1FRElBX09LKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJVbmFibGUgdG8gcmVhZCBuZXh0IHNhbXBsZSBkYXRhLiBBYm9ydGluZyB0cmFuc2NvZGUuIjsKKyAgICAgICAgICAgIG1TdGF0dXMgPSBzdGF0dXM7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBpZiAobVNhbXBsZUluZm8uc2l6ZSkgeworICAgICAgICAgICAgKyttSW5wdXRGcmFtZUNvdW50OworICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgTE9HKERFQlVHKSA8PCAiRU9TIGZyb20gc291cmNlLiI7CisgICAgICAgIG1Fb3NGcm9tU291cmNlID0gdHJ1ZTsKKyA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gICAgIGlmIChzdGF0dXMgIT0gQU1FRElBX09LKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJTaWduYWxFT1Mgb24gZW5jb2RlciByZXR1cm5lZCBlcnJvcjogIiA8PCBzdGF0dXM7CisgICAgICAgICAgICBtU3RhdHVzID0gc3RhdHVzOworICAgICAgICB9CisgICAgfQorfQorCit2b2lkIFZpZGVvVHJhY2tUcmFuc2NvZGVyOjpkZXF1ZXVlT3V0cHV0U2FtcGxlKGludDMyX3QgYnVmZmVySW5kZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFNZWRpYUNvZGVjQnVmZmVySW5mbyBidWZmZXJJbmZvKSB7CisgICAgaWYgKGJ1ZmZlckluZGV4ID49IDApIHsKKyAgICAgICAgc2l6ZV90IHNhbXBsZVNpemUgPSAwOworICAgICAgICB1aW50OF90KiBidWZmZXIgPQorICAgICAgICAgICAgICAgIEFNZWRpYUNvZGVjX2dldE91dHB1dEJ1ZmZlcihtRW5jb2Rlci0+Z2V0Q29kZWMoKSwgYnVmZmVySW5kZXgsICZzYW1wbGVTaXplKTsKKworICAgICAgICBNZWRpYVNhbXBsZTo6T25TYW1wbGVSZWxlYXNlZENhbGxiYWNrIGJ1ZmZlclJlbGVhc2VDYWxsYmFjayA9CisgICAgICAgICAgICAgICAgW2VuY29kZXIgPSBtRW5jb2Rlcl0oTWVkaWFTYW1wbGUqIHNhbXBsZSkgeworICAgICAgICAgICAgICAgICAgICBBTWVkaWFDb2RlY19yZWxlYXNlT3V0cHV0QnVmZmVyKGVuY29kZXItPmdldENvZGVjKCksIHNhbXBsZS0+YnVmZmVySWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UgLyogcmVuZGVyICovKTsKKyAgICAgICAgICAgICAgICB9OworCisgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxNZWRpYVNhbXBsZT4gc2FtcGxlID0gTW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gPDwgIiB2cyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgPDwgbU91dHB1dEZyYW1lQ291bnQ7CisgICAgICAgICAgICBpZiAobUlucHV0RnJhbWVDb3VudCA+IDAgJiYgbU91dHB1dEZyYW1lQ291bnQgPT0gMCkgeworICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkVuY29kZXIgZGlkIG5vdCBwcm9kdWNlIGFueSBvdXRwdXQgZnJhbWVzLiI7CisgICAgICAgICAgICAgICAgbVN0YXR1cyA9IEFNRURJQV9FUlJPUl9VTktOT1dOOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQorCit2b2lkIFZpZGVvVHJhY2tUcmFuc2NvZGVyOjp1cGRhdGVUcmFja0Zvcm1hdChBTWVkaWFGb3JtYXQqIG91dHB1dEZvcm1hdCwgYm9vbCBmcm9tRGVjb2RlcikgeworICAgIGlmIChmcm9tRGVjb2RlcikgeworICAgICAgICBzdGF0aWMgY29uc3Qgc3RkOjp2ZWN0b3I8QU1lZGlhRm9ybWF0VXRpbHM6OkVudHJ5Q29waWVyPiBrVmFsdWVzVG9Db3B5eworICAgICAgICAgICAgICAgIEVOVFJZX0NPUElFUihBTUVESUFGT1JNQVRfS0VZX0NPTE9SX1JBTkdFLCBJbnQzMiksCisgICAgICAgICAgICAgICAgRU5UUllfQ09QSUVSKEFNRURJQUZPUk1BVF9LRVlfQ09MT1JfU1RBTkRBUkQsIEludDMyKSwKKyAgICAgICAgICAgICAgICBFTlRSWV9DT1BJRVIoQU1FRElBRk9STUFUX0tFWV9DT0xPUl9UUkFOU0ZFUiwgSW50MzIpLAorICAgICAgICB9OworICAgICAgICBBTWVkaWFGb3JtYXQqIHBhcmFtcyA9IEFNZWRpYUZvcm1hdF9uZXcoKTsKKyAgICAgICAgaWYgKHBhcmFtcyAhPSBudWxscHRyKSB7CisgICAgICAgICAgICBBTWVkaWFGb3JtYXRVdGlsczo6Q29weUZvcm1hdEVudHJpZXMob3V0cHV0Rm9ybWF0LCBwYXJhbXMsIGtWYWx1ZXNUb0NvcHkpOworICAgICAgICAgICAgaWYgKEFNZWRpYUNvZGVjX3NldFBhcmFtZXRlcnMobUVuY29kZXItPmdldENvZGVjKCksIHBhcmFtcykgIT0gQU1FRElBX09LKSB7CisgICAgICAgICAgICAgICAgTE9HKFdBUk5JTkcpIDw8ICJVbmFibGUgdG8gdXBkYXRlIGVuY29kZXIgd2l0aCBjb2xvciBpbmZvcm1hdGlvbiI7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZGVsZXRlKHBhcmFtcyk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGlmIChtQWN0dWFsT3V0cHV0Rm9ybWF0ICE9IG51bGxwdHIpIHsKKyAgICAgICAgTE9HKFdBUk5JTkcpIDw8ICJJZ25vcmluZyBkdXBsaWNhdGUgZm9ybWF0IGNoYW5nZS4iOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgQU1lZGlhRm9ybWF0KiBmb3JtYXRDb3B5ID0gQU1lZGlhRm9ybWF0X25ldygpOworICAgIGlmICghZm9ybWF0Q29weSB8fCBBTWVkaWFGb3JtYXRfY29weShmb3JtYXRDb3B5LCBvdXRwdXRGb3JtYXQpICE9IEFNRURJQV9PSykgeworICAgICAgICBMT0coRVJST1IpIDw8ICJVbmFibGUgdG8gY29weSBvdXRwdXRGb3JtYXQiOworICAgICAgICBBTWVkaWFGb3JtYXRfZGVsZXRlKGZvcm1hdENvcHkpOworICAgICAgICBtU3RhdHVzID0gQU1FRElBX0VSUk9SX0lOVkFMSURfUEFSQU1FVEVSOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgLy8gR2VuZXJhdGUgdGhlIGFjdHVhbCB0cmFjayBmb3JtYXQgZm9yIG11eGVyIGJhc2VkIG9uIHRoZSBlbmNvZGVyIG91dHB1dCBmb3JtYXQsCisgICAgLy8gc2luY2UgbWFueSB2aXRhbCBpbmZvcm1hd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isgICAgICAgICAgICBBTWVkaWFGb3JtYXQqIHRyYWNrRm9ybWF0ID0gc2FtcGxlUmVhZGVyLT5nZXRUcmFja0Zvcm1hdCh0cmFja0luZGV4KTsKKyAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9nZXRTdHJpbmcodHJhY2tGb3JtYXQsIEFNRURJQUZPUk1BVF9LRVlfTUlNRSwgJm1pbWUpOworCisgICAgICAgICAgICBpZiAoc3RybmNtcChtaW1lLCAidmlkZW8vIiwgNikgPT0gMCkgeworICAgICAgICAgICAgICAgIGludDMyX3QgZnJhbWVDb3VudDsKKyAgICAgICAgICAgICAgICBpZiAoQU1lZGlhRm9ybWF0X2dldEludDMyKHRyYWNrRm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX0ZSQU1FX0NPVU5ULCAmZnJhbWVDb3VudCkpIHsKKyAgICAgICAgICAgICAgICAgICAgc3RhdGUuY291bnRlcnNbIlZpZGVvRnJhbWVSYXRlIl0gPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlbmNobWFyazo6Q291bnRlcihmcmFtZUNvdW50LCBiZW5jaG1hcms6OkNvdW50ZXI6OmtJc1JhdGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSBpZiAoIXJlYWRBdWRpbyAmJiBzdHJuY21wKG1pbWUsICJhdWRpby8iLCA2KSA9PSAwKSB7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRyYWNrSW5kaWNlcy5wdXNoX2JhY2sodHJhY2tJbmRleCk7CisgICAgICAgICAgICBzYW1wbGVSZWFkZXItPnNlbGVjdFRyYWNrKHRyYWNrSW5kZXgpOworICAgICAgICB9CisKKyAgICAgICAgLy8gU3RhcnQgdGhyZWFkcy4KKyAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjp0aHJlYWQ+IHRyYWNrVGhyZWFkczsKKyAgICAgICAgZm9yIChhdXRvIHRyYWNrSW5kZXggOiB0cmFja0luZGljZXMpIHsKKyAgICAgICAgICAgIHRyYWNrVGhyZWFkcy5lbXBsYWNlX2JhY2soW3RyYWNrSW5kZXgsIHNhbXBsZVJlYWRlciwgJnN0YXRlXSB7CisgICAgICAgICAgICAgICAgTE9HKElORk8pIDw8ICJUcmFjayAiIDw8IHRyYWNrSW5kZXggPDwgIiBzdGFydGVkIjsKKyAgICAgICAgICAgICAgICBNZWRpYVNhbXBsZUluZm8gaW5mbzsKKworICAgICAgICAgICAgICAgIHNpemVfdCBidWZmZXJTaXplID0gMDsKKyAgICAgICAgICAgICAgICBzdGQ6OnVuaXF1ZV9wdHI8dWludDhfdFtdPiBidWZmZXI7CisKKyAgICAgICAgICAgICAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICAgICAgICAgICAgICBtZWRpYV9zdGF0dXNfdCBzdGF0dXMgPSBzYW1wbGVSZWFkZXItPmdldFNhbXBsZUluZm9Gb3JUcmFjayh0cmFja0luZGV4LCAmaW5mbyk7CisgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gQU1FRElBX0VSUk9SX0VORF9PRl9TVFJFQU0pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKGluZm8uc2l6ZSA+IGJ1ZmZlclNpemUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlclNpemUgPSBpbmZvLnNpemU7CisgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXIucmVzZXQobmV3IHVpbnQ4X3RbYnVmZmVyU2l6ZV0pOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gc2FtcGxlUmVhZGVyLT5yZWFkU2FtcGxlRGF0YUZvclRyYWNrKHRyYWNrSW5kZXgsIGJ1ZmZlci5nZXQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlclNpemUpOworICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzICE9IEFNRURJQV9PSykgeworICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUuU2tpcFdpdGhFcnJvcigiRXJyb3IgcmVhZGluZyBzYW1wbGUgZGF0YSIpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBMT0coSU5GTykgPDwgIlRyYWNrICIgPDwgdHJhY2tJbmRleCA8PCAiIGZpbmlzaGVkIjsKKyAgICAgICAgICAgIH0pOworICAgICAgICB9CisKKyAgICAgICAgLy8gSm9pbiB0aHJlYWRzLgorICAgICAgICBmb3IgKGF1dG8mIHRocmVhZCA6IHRyYWNrVGhyZWFkcykgeworICAgICAgICAgICAgdGhyZWFkLmpvaW4oKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsb3NlKHNyY0ZkKTsKK30KKworLy8gQmVuY2htYXJrIHJlZ2lzdHJhdGlvbiB3cmFwcGVyIGZvciB0cmFuc2NvZGluZy4KKyNkZWZpbmUgVFJBTlNDT0RFUl9CRU5DSE1BUksoZnVuYykgXAorICAgIEJFTkNITUFSSyhmdW5jKS0+VXNlUmVhbFRpbWUoKS0+TWVhc3VyZVByb2Nlc3NDUFVUaW1lKCktPlVuaXQoYmVuY2htYXJrOjprTWlsbGlzZWNvbmQpCisKK3N0YXRpYyB2b2lkIEJNX01lZGlhU2FtcGxlUmVhZGVyX0F1ZGlvVmlkZW9fUGFyYWxsZWwoYmVuY2htYXJrOjpTdGF0ZSYgc3RhdGUpIHsKKyAgICBSZWFkTWVkaWFTYW1wbGVzKHN0YXRlLCAidmlkZW9fMTkyMHgxMDgwXzM2NDhmcmFtZV9oMjY0XzIyTWJwc18zMGZwc19hYWMubXA0IiwKKyAgICAgICAgICAgICAgICAgICAgIHRydWUgL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CgpOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCBvblRyYWNrRXJyb3IoY29uc3QgTWVkaWFUcmFja1RyYW5zY29kZXIqIHRyYW5zY29kZXIgX191bnVzZWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYV9zdGF0dXNfdCBzdGF0dXMpIG92ZXJyaWRlIHsKKyAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1NdXRleCk7CisgICAgICAgIG1GaW5pc2hlZCA9IHRydWU7CisgICAgICAgIG1TdGF0dXMgPSBzdGF0dXM7CisgICAgICAgIG1Db25kaXRpb24ubm90aWZ5X2FsbCgpOworICAgIH0KKworICAgIHZvaWQgd2FpdEZvclRyYW5zY29kaW5nRmluaXNoZWQoKSB7CisgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtTXV0ZXgpOworICAgICAgICB3aGlsZSAoIW1GaW5pc2hlZCkgeworICAgICAgICAgICAgbUNvbmRpdGlvbi53YWl0KGxvY2spOworICAgICAgICB9CisgICAgfQorCisgICAgbWVkaWFfc3RhdHVzX3QgbVN0YXR1cyA9IEFNRURJQV9PSzsKKworcHJpdmF0ZToKKyAgICBzdGQ6Om11dGV4IG1NdXRleDsKKyAgICBzdGQ6OmNvbmRpdGlvbl92YXJpYWJsZSBtQ29uZGl0aW9uOworICAgIGJvb2wgbUZpbmlzaGVkID0gZmFsc2U7Cit9OworCisvKioKKyAqIE1vY2tTYW1wbGVSZWFkZXIgaG9sZHMgYSByaW5nYnVmZmVyIG9mIHRoZSBmaXJzdCBzYW1wbGVzIGluIHRoZSBwcm92aWRlZCBzb3VyY2UgdHJhY2suIFNhbXBsZXMKKyAqIGFyZSByZXR1cm5lZCB0byB0aGUgY2FsbGVyIGZyb20gdGhlIHJpbmdidWZmZXIgaW4gYSByb3VuZC1yb2JpbiBmYXNoaW9uIHdpdGggaW5jcmVhc2luZworICogdGltZXN0YW1wcy4gVGhlIG51bWJlciBvZiBzYW1wbGV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9ybWF0KGludCB0cmFja0luZGV4KSBvdmVycmlkZSB7CisgICAgICAgIHJldHVybiBBTWVkaWFFeHRyYWN0b3JfZ2V0VHJhY2tGb3JtYXQobUV4dHJhY3RvciwgdHJhY2tJbmRleCk7CisgICAgfQorCisgICAgbWVkaWFfc3RhdHVzX3Qgc2VsZWN0VHJhY2soaW50IHRyYWNrSW5kZXgpIG92ZXJyaWRlIHsKKyAgICAgICAgaWYgKG1TZWxlY3RlZFRyYWNrID49IDApIHJldHVybiBBTUVESUFfRVJST1JfVU5TVVBQT1JURUQ7CisgICAgICAgIG1TZWxlY3RlZFRyYWNrID0gdHJhY2tJbmRleDsKKworICAgICAgICBtZWRpYV9zdGF0dXNfdCBzdGF0dXMgPSBBTWVkaWFFeHRyYWN0b3Jfc2VsZWN0VHJhY2sobUV4dHJhY3RvciwgdHJhY2tJbmRleCk7CisgICAgICAgIGlmIChzdGF0dXMgIT0gQU1FRElBX09LKSByZXR1cm4gc3RhdHVzOworCisgICAgICAgIC8vIEdldCB0aGUgc2FtcGxlIGNvdW50LgorICAgICAgICBBTWVkaWFGb3JtYXQqIGZvcm1hdCA9IGdldFRyYWNrRm9ybWF0KHRyYWNrSW5kZXgpOworICAgICAgICBjb25zdCBib29sIGhhdmVTYW1wbGVDb3VudCA9CisgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldEludDMyKGZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9GUkFNRV9DT1VOVCwgJm1TYW1wbGVDb3VudCk7CisgICAgICAgIEFNZWRpYUZvcm1hdF9kZWxldGUoZm9ybWF0KTsKKworICAgICAgICBpZiAoIWhhdmVTYW1wbGVDb3VudCkgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiTm8gc2FtcGxlIGNvdW50IGluIHRyYWNrIGZvcm1hdC4iOworICAgICAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9VTlNVUFBPUlRFRDsKKyAgICAgICAgfQorCisgICAgICAgIC8vIEJ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YW1wbGVEYXRhKG1FeHRyYWN0b3IsIGJ1ZmZlci5nZXQoKSwgaW5mby5zaXplKTsKKyAgICAgICAgICAgIGlmIChieXRlc1JlYWQgIT0gaW5mby5zaXplKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9VTktOT1dOOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtU2FtcGxlcy5lbXBsYWNlX2JhY2soc3RkOjptb3ZlKGJ1ZmZlciksIGluZm8pOworCisgICAgICAgICAgICBBTWVkaWFFeHRyYWN0b3JfYWR2YW5jZShtRXh0cmFjdG9yKTsKKyAgICAgICAgfQorCisgICAgICAgIG1GaXJzdFB0c1VzID0gbVNhbXBsZXNbMF0uc2Vjb25kLnByZXNlbnRhdGlvblRpbWVVczsKKyAgICAgICAgbVB0c0RpZmYgPSBtU2FtcGxlc1sxXS5zZWNvbmQucHJlc2VudGF0aW9uVGltZVVzIC0gbVNhbXBsZXNbMF0uc2Vjb25kLnByZXNlbnRhdGlvblRpbWVVczsKKworICAgICAgICByZXR1cm4gQU1FRElBX09LOworICAgIH0KKworICAgIG1lZGlhX3N0YXR1c190IHVuc2VsZWN0VHJhY2soaW50IHRyYWNrSW5kZXggX191bnVzZWQpIG92ZXJyaWRlIHsKKyAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9VTlNVUFBPUlRFRDsKKyAgICB9CisKKyAgICBtZWRpYV9zdGF0dXNfdCBzZXRFbmZvcmNlU2VxdWVudGlhbEFjY2Vzcyhib29sIGVuZm9yY2UgX191bnVzZWQpIG92ZXJyaWRlIHsgcmV0dXJuIEFNRURJQV9PSzsgfQorCisgICAgbWVkaWFfc3RhdHVzX3QgZ2V0RXN0aW1hdGVkQml0cmF0ZUZvclRyYWNrKGludCB0cmFja0luZGV4IF9fdW51c2VkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90KiBiaXRyYXRlIF9fdW51c2VkKSBvdmVycmlkZSB7CisgICAgICAgIHJldHVybiBBTUVESUFfRVJST1JfVU5TVVBQT1JURUQ7CisgICAgfQorCisgICAgbWVkaWFfc3RhdHVzX3QgZ2V0U2FtcGxlSW5mb0ZvclRyYWNrKGludCB0cmFja0luZGV4LCBNZWRpYVNhbXBsZUluZm8qIGluZm8pIG92ZXJyaWRlIHsKKyAgICAgICAgaWYgKHRyYWNrSW5kZXggIT0gbVNlbGVjdGVkVHJhY2spIHJldHVybiBBTUVESUFfRVJST1JfSU5WQUxJRF9QQVJBTUVURVI7CisKKyAgICAgICAgaWYgKG1DdXJyZW50U2FtcGxlSW5kZXggPj0gbVNhbXBsZUNvdW50KSB7CisgICAgICAgICAgICBpbmZvLT5wcmVzZW50YXRpb25UaW1lVXMgPSAwOworICAgICAgICAgICAgaW5mby0+c2l6ZSA9IDA7CisgICAgICAgICAgICBpbmZvLT5mbGFncyA9IFNBTVBMRV9GTEFHX0VORF9PRl9TVFJFQU07CisgICAgICAgICAgICByZXR1cm4gQU1FRElBX0VSUk9SX0VORF9PRl9TVFJFQU07CisgICAgICAgIH0KKworICAgICAgICAqaW5mbyA9IG1TYW1wbGVzW21DdXJyZW50U2FtcGxlSW5kZXggJSBtU2FtcGxlcy5zaXplKCldLnNlY29uZDsKKyAgICAgICAgaW5mby0+cHJlc2VudGF0aW9uVGltZVVzID0gbUZpcnN0UHRzVXMgKyBtQ3VycmVudFNhbXBsZUluZGV4ICogbVB0c0RpZmY7CisgICAgICAgIHJldHVybiBBTUVESUFfT0s7CisgICAgfQorCisgICAgbWVkaWFfc3RhdHVzX3QgcmVhZFNhbXBsZURhdGFGb3JUcmFjayhpbnQgdHJhY2tJbmRleCwgdWludDhfdCogYnVmZmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IGJ1ZmZlclNpemUpIG92ZXJyaWRlIHsKKyAgICAgICAgaWYgKHRyYWNrSW5kZXggIT0gbVNlbGVjdGVkVHJhY2spIHJldH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KKworICAgIGZvciAoaW50IHRyYWNrSW5kZXggPSAwOyB0cmFja0luZGV4IDwgc2FtcGxlUmVhZGVyLT5nZXRUcmFja0NvdW50KCk7ICsrdHJhY2tJbmRleCkgeworICAgICAgICBBTWVkaWFGb3JtYXQqIHRyYWNrRm9ybWF0ID0gc2FtcGxlUmVhZGVyLT5nZXRUcmFja0Zvcm1hdCh0cmFja0luZGV4KTsKKworICAgICAgICBjb25zdCBjaGFyKiBtaW1lID0gbnVsbHB0cjsKKyAgICAgICAgQU1lZGlhRm9ybWF0X2dldFN0cmluZyh0cmFja0Zvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9NSU1FLCAmbWltZSk7CisKKyAgICAgICAgaWYgKChtZWRpYVR5cGUgPT0ga1ZpZGVvICYmIHN0cm5jbXAobWltZSwgInZpZGVvLyIsIDYpID09IDApIHx8CisgICAgICAgICAgICAobWVkaWFUeXBlID09IGtBdWRpbyAmJiBzdHJuY21wKG1pbWUsICJhdWRpby8iLCA2KSA9PSAwKSkgeworICAgICAgICAgICAgc3JjVHJhY2tJbmRleCA9IHRyYWNrSW5kZXg7CisgICAgICAgICAgICBzcmNUcmFja0Zvcm1hdCA9IHN0ZDo6c2hhcmVkX3B0cjxBTWVkaWFGb3JtYXQ+KHRyYWNrRm9ybWF0LCAmQU1lZGlhRm9ybWF0X2RlbGV0ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBBTWVkaWFGb3JtYXRfZGVsZXRlKHRyYWNrRm9ybWF0KTsKKyAgICB9CisKKyAgICBpZiAoc3JjVHJhY2tJbmRleCA9PSAtMSkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJObyBtYXRjaGluZyBzb3VyY2UgdHJhY2sgZm91bmQiOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgbWVkaWFfc3RhdHVzX3Qgc3RhdHVzID0gc2FtcGxlUmVhZGVyLT5zZWxlY3RUcmFjayhzcmNUcmFja0luZGV4KT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UuU2tpcFdpdGhFcnJvcigiVW5hYmxlIHRvIGNvbmZpZ3VyZSB0aGUgdHJhbnNjb2RlciIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgdWludDMyX3Qgc2FtcGxlQ291bnQgPSAwOworICAgICAgICBDb25maWd1cmVFbXB0eVNhbXBsZUNvbnN1bWVyKHRyYW5zY29kZXIsIHNhbXBsZUNvdW50KTsKKworICAgICAgICBpZiAoIXRyYW5zY29kZXItPnN0YXJ0KCkpIHsKKyAgICAgICAgICAgIHN0YXRlLlNraXBXaXRoRXJyb3IoIlVuYWJsZSB0byBzdGFydCB0aGUgdHJhbnNjb2RlciIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgY2FsbGJhY2tzLT53YWl0Rm9yVHJhbnNjb2RpbmdGaW5pc2hlZCgpOworICAgICAgICB0cmFuc2NvZGVyLT5zdG9wKCk7CisKKyAgICAgICAgaWYgKGNhbGxiYWNrcy0+bVN0YXR1cyAhPSBBTUVESUFfT0spIHsKKyAgICAgICAgICAgIHN0YXRlLlNraXBXaXRoRXJyb3IoIlRyYW5zY29kZXIgZmFpbGVkIHdpdGggZXJyb3IiKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIExPRyhERUJVRykgPDwgIk51bWJlciBvZiBzYW1wbGVzIHJlY2VpdmVkOiAiIDw8IHNhbXBsZUNvdW50OworICAgICAgICBzdGF0ZS5jb3VudGVyc1siRnJhbWVSYXRlIl0gPSBiZW5jaG1hcms6OkNvdW50ZXIoc2FtcGxlQ291bnQsIGJlbmNobWFyazo6Q291bnRlcjo6a0lzUmF0ZSk7CisgICAgfQorfQorCitzdGF0aWMgdm9pZCBCZW5jaG1hcmtUcmFuc2NvZGVyV2l0aE9wZXJhdGluZ1JhdGUoYmVuY2htYXJrOjpTdGF0ZSYgc3RhdGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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cmFja0Zvcm1hdHNbaV0uZ2V0KCk7CisgICAgICAgICAgICBBTWVkaWFGb3JtYXQqIGRzdEZvcm1hdCA9IG51bGxwdHI7CisKKyAgICAgICAgICAgIGNvbnN0IGNoYXIqIG1pbWUgPSBudWxscHRyOworICAgICAgICAgICAgaWYgKCFBTWVkaWFGb3JtYXRfZ2V0U3RyaW5nKHNyY0Zvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9NSU1FLCAmbWltZSkpIHsKKyAgICAgICAgICAgICAgICBzdGF0ZS5Ta2lwV2l0aEVycm9yKCJTb3VyY2UgdHJhY2sgZm9ybWF0IGRvZXMgbm90IGhhdmUgTUlNRSB0eXBlIik7CisgICAgICAgICAgICAgICAgZ290byBleGl0OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoc3RybmNtcChtaW1lLCAidmlkZW8vIiwgNikgPT0gMCkgeworICAgICAgICAgICAgICAgIGludDMyX3QgZnJhbWVDb3VudDsKKyAgICAgICAgICAgICAgICBpZiAoQU1lZGlhRm9ybWF0X2dldEludDMyKHNyY0Zvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9GUkFNRV9DT1VOVCwgJmZyYW1lQ291bnQpKSB7CisgICAgICAgICAgICAgICAgICAgIHN0YXRlLmNvdW50ZXJzW1BBUkFNX1ZJREVPX0ZSQU1FX1JBVEVdID0gYmVuY2htYXJrOjpDb3VudGVyKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lQ291bnQsIGJlbmNobWFyazo6Q291bnRlcjo6a0lzSXRlcmF0aW9uSW52YXJpYW50UmF0ZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmICghQU1lZGlhRm9ybWF0X2dldEludDMyKHNyY0Zvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9XSURUSCwgJndpZHRoKSkgeworICAgICAgICAgICAgICAgICAgICBzdGF0ZS5Ta2lwV2l0aEVycm9yKCJWaWRlbyBzb3VyY2UgdHJhY2sgZm9ybWF0IGRvZXMgbm90IGhhdmUgd2lkdGgiKTsKKyAgICAgICAgICAgICAgICAgICAgZ290byBleGl0OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoIUFNZWRpYUZvcm1hdF9nZXRJbnQzMihzcmNGb3JtYXQsIEFNRURJQUZPUk1BVF9LRVlfSEVJR0hULCAmaGVpZ2h0KSkgeworICAgICAgICAgICAgICAgICAgICBzdGF0ZS5Ta2lwV2l0aEVycm9yKCJWaWRlbyBzb3VyY2UgdHJhY2sgZm9ybWF0IGRvZXMgbm90IGhhdmUgaGVpZ2h0Iik7CisgICAgICAgICAgICAgICAgICAgIGdvdG8gZXhpdDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldEludDY0KHNyY0Zvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9EVVJBVElPTiwgJnRyYWNrRHVyYXRpb25Vcyk7CisgICAgICAgICAgICAgICAgc291cmNlTWltZSA9IG1pbWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICh0cmFja1NlbGVjdGlvbkNhbGxiYWNrKG1pbWUsICZkc3RGb3JtYXQpKSB7CisgICAgICAgICAgICAgICAgc3RhdHVzID0gdHJhbnNjb2Rlci0+Y29uZmlndXJlVHJhY2tGb3JtYXQoaSwgZHN0Rm9ybWF0KTsKKyAgICAgICAgICAgICAgICBpZiAoc3RybmNtcChtaW1lLCAidmlkZW8vIiwgNikgPT0gMCAmJiBkc3RGb3JtYXQgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyKiBtaW1lID0gbnVsbHB0cjsKKyAgICAgICAgICAgICAgICAgICAgaWYgKEFNZWRpYUZvcm1hdF9nZXRTdHJpbmcoZHN0Rm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX01JTUUsICZtaW1lKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0TWltZSA9IG1pbWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldEludDMyKGRzdEZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9CSVRfUkFURSwgJnRhcmdldEJpdHJhdGUpOworICAgICAgICAgICAgICAgICAgICB0cmFuc2NvZGVWaWRlbyA9IHRydWU7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdHJuY21wKG1pbWUsICJhdWRpby8iLCA2KSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGluY2x1ZGVBdWRpbyA9IHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoZHN0Rm9ybWF0ICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZGVsZXRlKGRzdEZvcm1hdCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoc3RhdHVzICE9IEFNRURJQV9PSykgeworICAgICAgICAgICAgICAgIHN0YXRlLlNraXBXaXRoRXJyb3IoIlVuYWJsZSB0byBjb25maWd1cmUgdHJhY2siKTsKKyAgICAgICAgICAgICAgICBnb3RvIGV4aXQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBzdGF0dXMgPSB0cmFuc2NvZGVyLT5zdGFydCgpOworICAgICAgICBpZiAoc3RhdHVzICE9IEFNRURJQV9PSykgeworICAgICAgICAgICAgc3RhdGUuU2tpcFdpdGhFcnJvcigiVW5hYmxlIHRvIHN0YXJ0IHRyYW5zY29kZXIiKTsKKyAgICAgICAgICAgIGdvdG8gZXhpdDsKKyAgICAgICAgfQorCisgICAgICAgIGlmICghY2FsbGJhY2tzLT53YWl0Rm9yVHJhbnNjb2RpbmdGaW5pc2hlZCgpKSB7CisgICAgICAgICAgICB0cmFuc2NvZGVyLT5jYW5jZWwoKTsKKyAgICAgICAgICAgIHN0YXRlLlNraXBXaXRoRXJyb3IoIlRyYW5zY29kZXIgdGltZWQgb3V0Iik7CisgICAgICAgICAgICBnb3RvIGV4aXQ7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGNhbGxiYWNrcy0+bVN0YXR1cyAhPSBBTUVESUFfT0spIHsKKyAgICAgICAgICAgIHN0YXRlLlNraXBXaXRoRXJyb3IoIlRyYW5zY29kZXIgZXJyb3Igd2hlbiBydW5uaW5nIik7CisgICAgICAgICAgICBnb3RvIGV4aXQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBTZXQgdHJhbnNjb2RpbmcgY29uZmlndXJhdGlvbiBwYXJhbXMgaW4gYmVuY2htYXJrIGxhYmVsCisgICAgc3RhdGUuU2V0TGFiZWwoc3JjRmlsZU5hbWUgKyAiLCIgKworICAgICAgICAgICAgICAgICAgIHN0ZDo6dG9fc3RyaW5nKHdpZHRoKSArICJ4IiArIHN0ZDo6dG9fc3RyaW5nKGhlaWdodCkgKyAiLCIgKworICAgICAgICAgICAgICAgICAgIHNvdXJjZU1pbWUgKyAiLCIgKworICAgICAgICAgICAgICAgICAgIHN0ZDo6dG9fc3RyaW5nKHRyYWNrRHVyYXRpb25Vcy8xMDAwKSArICIsIiArCisgICAgICAgICAgICAgICAgICAgKGluY2x1ZGVBdWRpbyA/ICJZZXMiIDogIk5vIikgKyAiLCIgKworICAgICAgICAgICAgICAgICAgICh0cmFuc2NvZGVWaWRlbyA/ICJZZXMiIDogIk5vIikgKyAiLCIgKworICAgICAgICAgICAgICAgICAgIHRhcmdldE1pbWUgKyAiLCIgKworICAgICAgICAgICAgICAgICAgIHN0ZDo6dG9fc3RyaW5nKHRhcmdldEJpdHJhdGUpCisgICAgICAgICAgICAgICAgICAgKTsKKworZXhpdDoKKyAgICBpZiAoc3JjRmQgPiAwKSBjbG9zZShzcmNGZCk7CisgICAgaWYgKGRzdEZkID4gMCkgY2xvc2UoZHN0RmQpOworfQorCisvKioKKyAqIENhbGxiYWNrIHRvIGVkaXQgdHJhY2sgZm9ybW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0Zvcm1hdCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlb0Zvcm1hdEVkaXRvciAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvRm9ybWF0RWRpdG9yKCpkc3RGb3JtYXRPdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RybmNtcChtaW1lLCAiYXVkaW8vIiwgNikgPT0gMCAmJiAhaW5jbHVkZUF1ZGlvKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgIH0pOworfQorCitzdGF0aWMgdm9pZCBTZXRNYXhPcGVyYXRpbmdSYXRlKEFNZWRpYUZvcm1hdCogZm9ybWF0KSB7CisgICAgQU1lZGlhRm9ybWF0X3NldEludDMyKGZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9PUEVSQVRJTkdfUkFURSwgSU5UMzJfTUFYKTsKKyAgICBBTWVkaWFGb3JtYXRfc2V0SW50MzIoZm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX1BSSU9SSVRZLCAxKTsKK30KKworLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSBBVkMgdG8gQVZDIEJlbmNobWFya3MgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCitzdGF0aWMgdm9pZCBCTV9UcmFuc2NvZGVBdmMyQXZjQXVkaW9WaWRlbzJBdWRpb1ZpZGVvKGJlbmNobWFyazo6U3RhdGUmIHN0YXRlKSB7CisgICAgVHJhbnNjb2RlTWVkaWFGaWxlKHN0YXRlLCAidmlkZW9fM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b2lkIEJNXzE5MjB4MTA4MF9IZXZjMTdNYnBzMkhldmM4TWJwcyhiZW5jaG1hcms6OlN0YXRlJiBzdGF0ZSkgeworICAgIFRyYW5zY29kZU1lZGlhRmlsZShzdGF0ZSwgInR4X2JtXzE5MjBfMTA4MF8zMGZwc19oZXZjXzE3TWJwcy5tcDQiLAorICAgICAgICAgICAgICAgICAgICAgICAidHhfYm1fMTkyMF8xMDgwXzMwZnBzX2hldmNfMTdNYnBzX3RyYW5zY29kZWRfaGV2Y184TWJwcy5tcDQiLAorICAgICAgICAgICAgICAgICAgICAgICBmYWxzZSAvKiBpbmNsdWRlQXVkaW8gKi8sIHRydWUgLyogdHJhbnNjb2RlVmlkZW8gKi8sCisgICAgICAgICAgICAgICAgICAgICAgIFttaW1lID0gInZpZGVvL2hldmMiLCBiaXRyYXRlID0gODAwMDAwMF0oQU1lZGlhRm9ybWF0KiBkc3RGb3JtYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIFNldE1pbWVCaXRyYXRlKGRzdEZvcm1hdCwgbWltZSwgYml0cmF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgIH0pOworfQorCitzdGF0aWMgdm9pZCBCTV8xOTIweDEwODBfSGV2YzE3TWJwczJBdmMxMk1icHMoYmVuY2htYXJrOjpTdGF0ZSYgc3RhdGUpIHsKKyAgICBUcmFuc2NvZGVNZWRpYUZpbGUoc3RhdGUsICJ0eF9ibV8xOTIwXzEwODBfMzBmcHNfaGV2Y18xN01icHMubXA0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgInR4X2JtXzE5MjBfMTA4MF8zMGZwc19oZXZjXzE3TWJwc190cmFuc2NvZGVkX2gyNjRfMTJNYnBzLm1wNCIsCisgICAgICAgICAgICAgICAgICAgICAgIGZhbHNlIC8qIGluY2x1ZGVBdWRpbyAqLywgdHJ1ZSAvKiB0cmFuc2NvZGVWaWRlbyAqLywKKyAgICAgICAgICAgICAgICAgICAgICAgW21pbWUgPSAidmlkZW8vYXZjIiwgYml0cmF0ZSA9IDEyMDAwMDAwXShBTWVkaWFGb3JtYXQqIGRzdEZvcm1hdCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgU2V0TWltZUJpdHJhdGUoZHN0Rm9ybWF0LCBtaW1lLCBiaXRyYXRlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgfSk7Cit9CisKK3N0YXRpYyB2b2lkIEJNXzE5MjB4MTA4MF82MGZwc19IZXZjMjhNYnBzMkF2YzE1TWJwcyhiZW5jaG1hcms6OlN0YXRlJiBzdGF0ZSkgeworICAgIFRyYW5zY29kZU1lZGlhRmlsZShzdGF0ZSwgInR4X2JtXzE5MjBfMTA4MF82MGZwc19oZXZjXzI4TWJwcy5tcDQiLAorICAgICAgICAgICAgICAgICAgICAgICAidHhfYm1fMTkyMF8xMDgwXzYwZnBzX2hldmNfMjhNYnBzX3RyYW5zY29kZWRfaDI2NF8xNU1icHMubXA0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UgLyogaW5jbHVkZUF1ZGlvICovLCB0cnVlIC8qIHRyYW5zY29kZVZpZGVvICovLAorICAgICAgICAgICAgICAgICAgICAgICBbbWltZSA9ICJ2aWRlby9hdmMiLCBiaXRyYXRlID0gMTUwMDAwMDBdKEFNZWRpYUZvcm1hdCogZHN0Rm9ybWF0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICBTZXRNaW1lQml0cmF0ZShkc3RGb3JtYXQsIG1pbWUsIGJpdHJhdGUpOworICAgICAgICAgICAgICAgICAgICAgICB9KTsKK30KKworc3RhdGljIHZvaWQgQk1fMTI4MHg3MjBfQXZjMTBNYnBzMkF2YzRNYnBzKGJlbmNobWFyazo6U3RhdGUmIHN0YXRlKSB7CisgICAgVHJhbnNjb2RlTWVkaWFGaWxlKHN0YXRlLCAidHhfYm1fMTI4MF83MjBfMzBmcHNfaDI2NF8xME1icHMubXA0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgInR4X2JtXzEyODBfNzIwX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mFuc2NvZGVkX2gyNjRfNE1icHMubXA0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UgLyogaW5jbHVkZUF1ZGlvICovLCB0cnVlIC8qIHRyYW5zY29kZVZpZGVvICovLAorICAgICAgICAgICAgICAgICAgICAgICBbbWltZSA9ICJ2aWRlby9hdmMiLCBiaXRyYXRlID0gNDAwMDAwMF0oQU1lZGlhRm9ybWF0KiBkc3RGb3JtYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIFNldE1pbWVCaXRyYXRlKGRzdEZvcm1hdCwgbWltZSwgYml0cmF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgIH0pOworfQorCitzdGF0aWMgdm9pZCBCTV8xMjgweDcyMF9BdmMxME1icHNBYWMyQXZjNE1icHNBYWMoYmVuY2htYXJrOjpTdGF0ZSYgc3RhdGUpIHsKKyAgICBUcmFuc2NvZGVNZWRpYUZpbGUoc3RhdGUsICJ0eF9ibV8xMjgwXzcyMF8zMGZwc19oMjY0XzEwTWJwc19hYWMubXA0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgInR4X2JtXzEyODBfNzIwXzMwZnBzX2gyNjRfMTBNYnBzX2FhY190cmFuc2NvZGVkX2gyNjRfNE1icHNfYWFjLm1wNCIsCisgICAgICAgICAgICAgICAgICAgICAgIHRydWUgLyogaW5jbHVkZUF1ZGlvICovLCB0cnVlIC8qIHRyYW5zY29kZVZpZGVvICovLAorICAgICAgICAgICAgICAgICAgICAgICBbbWltZSA9ICJ2aWRlby9hdmMiLCBiaXRyYXRlID0gNDAwMDAwMF0oQU1lZGlhRm9ybWF0KiBkc3RGb3JtYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIFNldE1pbWVCaXRyYXRlKGRzdEZvcm1hdCwgbWltZSwgYml0cmF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgIH0pOworfQorCitzdGF0aWMgdm9pZCBCTV8xMjgweDcyMF9BdmMxME1icHNBYWMyQXZjUG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LAorICAgICAgICAgICAgICAgICAgICAgICBmYWxzZSAvKiBpbmNsdWRlQXVkaW8gKi8sIHRydWUgLyogdHJhbnNjb2RlVmlkZW8gKi8sCisgICAgICAgICAgICAgICAgICAgICAgIFttaW1lID0gInZpZGVvL2F2YyIsIGJpdHJhdGUgPSA0MDAwMDAwXShBTWVkaWFGb3JtYXQqIGRzdEZvcm1hdCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgU2V0TWltZUJpdHJhdGUoZHN0Rm9ybWF0LCBtaW1lLCBiaXRyYXRlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgfSk7Cit9CisKK3N0YXRpYyB2b2lkIEJNXzEwODB4MTkyMF9BdmMxNU1icHMyQXZjOE1icHMoYmVuY2htYXJrOjpTdGF0ZSYgc3RhdGUpIHsKKyAgICBUcmFuc2NvZGVNZWRpYUZpbGUoc3RhdGUsICJ0eF9ibV8xMDgwXzE5MjBfMzBmcHNfaDI2NF8xNU1icHMubXA0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgInR4X2JtXzEwODBfMTkyMF8zMGZwc19oMjY0XzE1TWJwc190cmFuc2NvZGVkX2gyNjRfOE1icHMubXA0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UgLyogaW5jbHVkZUF1ZGlvICovLCB0cnVlIC8qIHRyYW5zY29kZVZpZGVvICovLAorICAgICAgICAgICAgICAgICAgICAgICBbbWltZSA9ICJ2aWRlby9hdmMiLCBiaXRyYXRlID0gODAwMDAwMF0oQU1lZGlhRm9ybWF0KiBkc3RGb3JtYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIFNldE1pbWVCaXRyYXRlKGRzdEZvcm1hdCwgbWltZSwgYml0cmF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgIH0pOworfQorCitzdGF0aWMgdm9pZCBCTV83MjB4MTI4MF9BdmMxME1icHMyQXZjNE1icHMoYmVuY2htYXJrOjpTdGF0ZSYgc3RhdGUpIHsKKyAgICBUc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WNrSW5kZXgsIE1lZGlhU2FtcGxlSW5mbyogaW5mbykgb3ZlcnJpZGU7CisgICAgbWVkaWFfc3RhdHVzX3QgcmVhZFNhbXBsZURhdGFGb3JUcmFjayhpbnQgdHJhY2tJbmRleCwgdWludDhfdCogYnVmZmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IGJ1ZmZlclNpemUpIG92ZXJyaWRlOworICAgIHZvaWQgYWR2YW5jZVRyYWNrKGludCB0cmFja0luZGV4KSBvdmVycmlkZTsKKworICAgIHZpcnR1YWwgfk1lZGlhU2FtcGxlUmVhZGVyTkRLKCkgb3ZlcnJpZGU7CisKK3ByaXZhdGU6CisgICAgLyoqCisgICAgICogU2FtcGxlUG9zaXRpb24gZGVzY3JpYmVzIHRoZSBwb3NpdGlvbiBvZiBhIHNpbmdsZSBzYW1wbGUgaW4gdGhlIG1lZGlhIGZpbGUgdXNpbmcgaXRzCisgICAgICogdGltZXN0YW1wIGFuZCBpbmRleCBpbiB0aGUgZmlsZS4KKyAgICAgKi8KKyAgICBzdHJ1Y3QgU2FtcGxlUG9zaXRpb24geworICAgICAgICB1aW50NjRfdCBpbmRleCA9IDA7CisgICAgICAgIGludDY0X3QgdGltZVN0YW1wVXMgPSAwOworICAgICAgICBib29sIGlzU2V0ID0gZmFsc2U7CisKKyAgICAgICAgdm9pZCBzZXQodWludDY0X3Qgc2FtcGxlSW5kZXgsIGludDY0X3Qgc2FtcGxlVGltZVVzKSB7CisgICAgICAgICAgICBpbmRleCA9IHNhbXBsZUluZGV4OworICAgICAgICAgICAgdGltZVN0YW1wVXMgPSBzYW1wbGVUaW1lVXM7CisgICAgICAgICAgICBpc1NldCA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICB2b2lkIHJlc2V0KCkgeyBpc1NldCA9IGZhbHNlOyB9CisgICAgfTsKKworICAgIC8qKgorICAgICAqIFNhbXBsZUN1cnNvciBrZWVwcyB0cmFjayBvZiB0aGUgc2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X2FwcGxpY2FibGVfbGljZW5zZXM6IFsiZnJhbWV3b3Jrc19hdl9saWNlbnNlIl0sCit9CisKK2NjX2RlZmF1bHRzIHsKKyAgICBuYW1lOiAidGVzdGRlZmF1bHRzIiwKKworICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJiYXNlX2hlYWRlcnMiLAorICAgICAgICAibGlibWVkaWFfaGVhZGVycyIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJtZWRpYXRyYW5zY29kZXIiLAorICAgIF0sCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmJhc2UiLAorICAgICAgICAibGliYmluZGVyX25kayIsCisgICAgICAgICJsaWJjcnlwdG8iLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICAgICAgImxpYm1lZGlhbmRrIiwKKyAgICAgICAgImxpYm5hdGl2ZXdpbmRvdyIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLVdlcnJvciIsCisgICAgICAgICItV2FsbCIsCisgICAgXSwKKworICAgIHNhbml0aXplOiB7CisgICAgICAgIG1pc2NfdW5kZWZpbmVkOiBbCisgICAgICAgICAgICAidW5zaWduZWQtaW50ZWdlci1vdmVyZmxvdyIsCisgICAgICAgICAgICAic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICBdLAorICAgICAgICBjZmk6IHRydWUsCisgICAgfSwKKworICAgIGRhdGE6IFsiOnRlc3RfYXNzZXRzIl0sCisgICAgdGVzdF9jb25maWdfdGVtcGxhdGU6ICJBbmRyb2lkVGVzdFRlbXBsYXRlLnhtbCIsCisgICAgdGVzdF9zdWl0ZXM6IFsiZGV2aWNlLXRlc3RzIiwgIlRyYW5zY29kZXJUZXN0cyJdLAorfQorCisvLyBNZWRpYVNhbXBsZVJlYWRlck5ESyB1bml0IHRlc3QKK2NjX3Rlc3QgeworICAgIG5hbWU6ICJNZWRp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WF0Pj4gdHJhY2tGb3JtYXRzID0gdHJhbnNjb2Rlci0+Z2V0VHJhY2tGb3JtYXRzKCk7CisgICAgICAgIEVYUEVDVF9HVCh0cmFja0Zvcm1hdHMuc2l6ZSgpLCAwKTsKKworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHRyYWNrRm9ybWF0cy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPEFNZWRpYUZvcm1hdD4gZm9ybWF0OworICAgICAgICAgICAgY29uc3QgY2hhciogbWltZSA9IG51bGxwdHI7CisKKyAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9nZXRTdHJpbmcodHJhY2tGb3JtYXRzW2ldLmdldCgpLCBBTUVESUFGT1JNQVRfS0VZX01JTUUsICZtaW1lKTsKKyAgICAgICAgICAgIGlmIChzdHJuY21wKG1pbWUsICJ2aWRlby8iLCA2KSA9PSAwKSB7CisgICAgICAgICAgICAgICAgZm9ybWF0ID0gc3RkOjpzaGFyZWRfcHRyPEFNZWRpYUZvcm1hdD4oQU1lZGlhRm9ybWF0X25ldygpLCAmQU1lZGlhRm9ybWF0X2RlbGV0ZSk7CisgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldFN0cmluZyhmb3JtYXQuZ2V0KCksIEFNRURJQUZPUk1BVF9LRVlfTUlNRSwgZHN0TWltZSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1lZGlhX3N0YXR1c190IHN0YXR1cyA9IHRyYW5zY29kZXItPmNvbmZpZ3VyZVRyYWNrRm9ybWF0KGksIGZvcm1hdC5nZXQoKSk7CisgICAgICAgICAgICBpZiAoc3RhdHVzICE9IEFNRURJQV9PSykgeworICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBjb25zdCBpbnQgZHN0RmQgPSBvcGVuKGRzdFBhdGguY19zdHIoKSwgT19XUk9OTFkgfCBPX0NSRUFUL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UkVRVUVTVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENPTE9SX1RSQU5TRkVSX1NEUl9WSURFTyk7CisKKyAgICAgICAgRVhQRUNUX0VRKEFNZWRpYUNvZGVjX2NvbmZpZ3VyZShkZWNvZGVyLCBmb3JtYXQuZ2V0KCksIG51bGxwdHIgLypzdXJmYWNlKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbHB0ciAvKmNyeXB0byovLCAwIC8qZmxhZ3MqLyksCisgICAgICAgICAgICAgICAgICBBTUVESUFfT0spOworCisgICAgICAgIEFNZWRpYUZvcm1hdCogaW5wdXRGb3JtYXQgPSBBTWVkaWFDb2RlY19nZXRJbnB1dEZvcm1hdChkZWNvZGVyKTsKKyAgICAgICAgRVhQRUNUX05FKGlucHV0Rm9ybWF0LCBudWxscHRyKTsKKworICAgICAgICBpbnQzMl90IHRyYW5zZmVyRnVuYzsKKyAgICAgICAgYm9vbCBjb252ZXJzaW9uU3VwcG9ydGVkID0KKyAgICAgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZ2V0SW50MzIoaW5wdXRGb3JtYXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRCRF9BTUVESUFDT0RFQ19QQVJBTUVURVJfS0VZX0NPTE9SX1RSQU5TRkVSX1JFUVVFU1QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ0cmFuc2ZlckZ1bmMpICYmCisgICAgICAgICAgICAgICAgdHJhbnNmZXJGdW5jID09IENPTE9SX1RSQU5TRkVSX1NEUl9WSURFTzsKKworICAgICAgICBBTWVkaWFGb3JtYXRfZGVsZXRlKGlucHV0Rm9ybWF0KTsKKyAgICAgICAgQU1lZGlhQ29kZWNfZGVsZXRlKGRlY29kZXIpOworCisgICAgICAgIHJldHVybiBjb252ZXJzaW9uU3VwcG9ydGVkOworICAgIH0KKworICAgIHN0ZDo6c2hhcmVkX3B0cjxUZXN0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sZTo6Y3JlYXRlV2l0aFJlbGVhc2VDYWxsYmFjayhudWxscHRyLCAwLCBpLCBjYWxsYmFjaykpOworICAgICAgICBFWFBFQ1RfRkFMU0UoYWJvcnRlZCk7CisgICAgfQorCisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBrTnVtU2FtcGxlczsgKytpKSB7CisgICAgICAgIEVYUEVDVF9GQUxTRShidWZmZXJSZWxlYXNlZFtpXSk7CisgICAgfQorCisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBrTnVtU2FtcGxlczsgKytpKSB7CisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxNZWRpYVNhbXBsZT4gc2FtcGxlOworICAgICAgICAgICAgYm9vbCBhYm9ydGVkID0gc2FtcGxlUXVldWUuZGVxdWV1ZSgmc2FtcGxlKTsKKyAgICAgICAgICAgIEVYUEVDVF9ORShzYW1wbGUsIG51bGxwdHIpOworICAgICAgICAgICAgRVhQRUNUX0VRKHNhbXBsZS0+YnVmZmVySWQsIGkpOworICAgICAgICAgICAgRVhQRUNUX0ZBTFNFKGJ1ZmZlclJlbGVhc2VkW2ldKTsKKyAgICAgICAgICAgIEVYUEVDVF9GQUxTRShhYm9ydGVkKTsKKyAgICAgICAgfQorCisgICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwga051bVNhbXBsZXM7ICsraikgeworICAgICAgICAgICAgRVhQRUNUX0VRKGJ1ZmZlclJlbGVhc2VkW2pdLCBqIDw9IGkpOworICAgICAgICB9CisgICAgfQorfQorCitURVNUX0YoTWVkaWFTYW1wbGVRdWV1ZVRlc3RzLCBUZXN0QWJvcnRCdWZmZXJSZWxlYXNlKSB7CisgICAgTE9HKERFQlVHKSA8PCAiVGVzdEFib3J0QnVmZmVyUmVsZWFzZSBTdGFydHMiOworCisgICAgc3RhdGljIGNvbnN0ZXhwciBpbnQga051bVNhbXBsZXMgPSA0OworICAgIHN0ZDo6dmVjdG9yPGJvb2w+IGJ1ZmZlcl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7CisgICAgICAgICAgICAgICAgbWVkaWFfc3RhdHVzX3Qgc3RhdHVzID0gbVNhbXBsZVJlYWRlci0+Z2V0U2FtcGxlSW5mb0ZvclRyYWNrKHRyYWNrSW5kZXgsICZpbmZvKTsKKyAgICAgICAgICAgICAgICBpZiAoc3RhdHVzICE9IEFNRURJQV9PSykgeworICAgICAgICAgICAgICAgICAgICBFWFBFQ1RfRVEoc3RhdHVzLCBBTUVESUFfRVJST1JfRU5EX09GX1NUUkVBTSk7CisgICAgICAgICAgICAgICAgICAgIEVYUEVDVF9UUlVFKChpbmZvLmZsYWdzICYgU0FNUExFX0ZMQUdfRU5EX09GX1NUUkVBTSkgIT0gMCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBBU1NFUlRfVFJVRSgoaW5mby5mbGFncyAmIFNBTVBMRV9GTEFHX0VORF9PRl9TVFJFQU0pID09IDApOworCisgICAgICAgICAgICAgICAgYXV0byBidWZmZXIgPSBzdGQ6Om1ha2VfdW5pcXVlPHVpbnQ4X3RbXT4oaW5mby5zaXplKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBtU2FtcGxlUmVhZGVyLT5yZWFkU2FtcGxlRGF0YUZvclRyYWNrKHRyYWNrSW5kZXgsIGJ1ZmZlci5nZXQoKSwgaW5mby5zaXplKTsKKyAgICAgICAgICAgICAgICBFWFBFQ1RfRVEoc3RhdHVzLCBBTUVESUFfT0spOworCisgICAgICAgICAgICAgICAgbVNhbXBsZU11dGV4LmxvY2soKTsKKyAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90KiBidWZmZXJQdHIgPSBidWZmZXIuZ2V0KCk7CisgICAgICAgICAgICAgICAgbVNhbXBsZXNbdHJhY2tJbmRleF0uZW1wbGFjZV9iYWNrKGluZm8uZmxhZ3MsIGluZm8ucHJlc2VudGF0aW9uVGltZVVzLCBpbmZvLnNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlclB0cik7CisgICAgICAgICAgICAgICAgbVNhbXBsZU11dGV4LnVubG9jaygpOworICAgICAgICAgICAgICAgICsrc2FtcGxlc1JlYWQ7CisgICAgICAgICAgICB9CisgICAgICAgIH19OworICAgIH0KKworICAgIHZvaWQgcmVhZFNhbXBsZXNBc3luYyhpbnQgc2FtcGxlQ291bnQpIHsKKyAgICAgICAgZm9yIChpbnQgdHJhY2tJbmRleCA9IDA7IHRyYWNrSW5kZXggPCBtVHJhY2tDb3VudDsgdHJhY2tJbmRleCsrKSB7CisgICAgICAgICAgICByZWFkU2FtcGxlc0FzeW5jKHRyYWNrSW5kZXgsIHNhbXBsZUNvdW50KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2FpdEZvclRyYWNrKGludCB0cmFja0luZGV4KSB7CisgICAgICAgIEFTU0VSVF9UUlVFKG1UcmFja1RocmVhZHNbdHJhY2tJbmRleF0uam9pbmFibGUoKSk7CisgICAgICAgIG1UcmFja1RocmVhZHNbdHJhY2tJbmRleF0uam9pbigpOworICAgIH0KKworICAgIHZvaWQgd2FpdEZvclRyYWNrcygpIHsKKyAgICAgICAgZm9yIChpbnQgdHJhY2tJbmRleCA9IDA7IHRyYWNrSW5kZXggPCBtVHJhY2tDb3VudDsgdHJhY2tJbmRleCsrKSB7CisgICAgICAgICAgICB3YWl0Rm9yVHJhY2sodHJhY2tJbmRleCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHNldEVuZm9yY2VTZXF1ZW50aWFsQWNjZXNzKGJvb2wgZW5mb3JjZSkgeworICAgICAgICBtZWRpYV9zdGF0dXNfdCBzdGF0dXMgPSBtU2FtcGxlUmVhZGVyLT5zZXRFbmZvcmNlU2VxdWVudGlhbEFjY2VzcyhlbmZvcmNlKTsKKyAgICAgICAgRVhQRUNUX0VRKHN0YXR1cywgQU1FRElBX09LKTsKKyAgICB9CisKKyAgICBzdGQ6OnZlY3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AiCisgICAgICAgICAgICAgICAgICAgICAgIDw8IHJlYWRlclNhbXBsZXNbdHJhY2tJbmRleF0uc2l6ZSgpIDw8ICIgc2FtcGxlcy4iOworICAgICAgICAgICAgRVhQRUNUX0VRKHJlYWRlclNhbXBsZXNbdHJhY2tJbmRleF0uc2l6ZSgpLCBtRXh0cmFjdG9yU2FtcGxlc1t0cmFja0luZGV4XS5zaXplKCkpOworICAgICAgICAgICAgZm9yIChzaXplX3Qgc2FtcGxlSW5kZXggPSAwOyBzYW1wbGVJbmRleCA8IHJlYWRlclNhbXBsZXNbdHJhY2tJbmRleF0uc2l6ZSgpOworICAgICAgICAgICAgICAgICBzYW1wbGVJbmRleCsrKSB7CisgICAgICAgICAgICAgICAgRVhQRUNUX0VRKHJlYWRlclNhbXBsZXNbdHJhY2tJbmRleF1bc2FtcGxlSW5kZXhdLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtRXh0cmFjdG9yU2FtcGxlc1t0cmFja0luZGV4XVtzYW1wbGVJbmRleF0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCBUZWFyRG93bigpIG92ZXJyaWRlIHsKKyAgICAgICAgTE9HKERFQlVHKSA8PCAiTWVkaWFTYW1wbGVSZWFkZXJOREtUZXN0cyB0ZWFyIGRvd24iOworICAgICAgICBBTWVkaWFFeHRyYWN0b3JfZGVsZXRlKG1FeHRyYWN0b3IpOworICAgICAgICBjbG9zZShtU291cmNlRmQpOworICAgIH0KKworICAgIH5NZWRpYVNhbXBsZVJlYWRlck5ES1Rlc3RzKCkgeyBMT0coREVCVUcpIDw8ICJNZWRpYVNhbXBsZVJlYWRlck5ES1Rlc3RzIGRlc3Ryb3llZCI7IH0KKworICAgIEFNZWRpYUV4dHJhY3RvciogbUV4dHJhY3RvciA9IG51bGxwdHI7CisgICAgc2l6ZV90IG1UcmFja0NvdW50OworICAgIGludCBtU291cmNlRmQ7CisgICAgc2l6ZV90IG1GaWxlU2l6ZTsKKyAgIC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c3Rlci5yZWFkU2FtcGxlc0FzeW5jKHRyYWNrSW5kZXgsIG1FeHRyYWN0b3JTYW1wbGVzW3RyYWNrSW5kZXhdLnNpemUoKSAtIDEpOworICAgICAgICB9CisgICAgICAgIHRlc3Rlci53YWl0Rm9yVHJhY2tzKCk7CisgICAgICAgIGZvciAoaW50IHRyYWNrSW5kZXggPSAwOyB0cmFja0luZGV4IDwgbVRyYWNrQ291bnQ7ICsrdHJhY2tJbmRleCkgeworICAgICAgICAgICAgdGVzdGVyLnJlYWRTYW1wbGVzQXN5bmModHJhY2tJbmRleCwgU0FNUExFX0NPVU5UX0FMTCk7CisgICAgICAgICAgICB0ZXN0ZXIud2FpdEZvclRyYWNrKHRyYWNrSW5kZXgpOworICAgICAgICB9CisgICAgICAgIGNvbXBhcmVTYW1wbGVzKHRlc3Rlci5nZXRTYW1wbGVzKCkpOworICAgIH0KKworICAgIHsgIC8vIFJldmVyc2UgdHJhY2sgb3JkZXIKKyAgICAgICAgU2FtcGxlQWNjZXNzVGVzdGVyIHRlc3RlcnttU291cmNlRmQsIG1GaWxlU2l6ZX07CisgICAgICAgIGZvciAoaW50IHRyYWNrSW5kZXggPSBtVHJhY2tDb3VudCAtIDE7IHRyYWNrSW5kZXggPj0gMDsgLS10cmFja0luZGV4KSB7CisgICAgICAgICAgICB0ZXN0ZXIucmVhZFNhbXBsZXNBc3luYyh0cmFja0luZGV4LCBtRXh0cmFjdG9yU2FtcGxlc1t0cmFja0luZGV4XS5zaXplKCkgLSAxKTsKKyAgICAgICAgfQorICAgICAgICB0ZXN0ZXIud2FpdEZvclRyYWNrcygpOworICAgICAgICBmb3IgKGludCB0cmFja0luZGV4ID0gbVRyYWNrQ291bnQgLSAxOyB0cmFja0luZGV4ID49IDA7IC0tdHJhY2tJbmRleCkgeworICAgICAgICAgICAgdGVzdGVyLnJlYWRTYW1wbGVzQXN5bmModHJhY2tJbmRleCwgU0FNUExFX0NPVU5UX0FMTCk7CisgICAgICAgICAgICB0ZXN0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hY2tDb3VudDsgKyt0cmFja0luZGV4KSB7CisgICAgICAgICAgICAgICAgaWYgKHRyYWNrSW5kZXggPT0gdHJhY2tJbmRUb0VPUykgY29udGludWU7CisKKyAgICAgICAgICAgICAgICB0ZXN0ZXIucmVhZFNhbXBsZXNBc3luYyh0cmFja0luZGV4LCBTQU1QTEVfQ09VTlRfQUxMKTsKKyAgICAgICAgICAgICAgICB0ZXN0ZXIud2FpdEZvclRyYWNrKHRyYWNrSW5kZXgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBjb21wYXJlU2FtcGxlcyh0ZXN0ZXIuZ2V0U2FtcGxlcygpKTsKKyAgICAgICAgfQorICAgIH0KK30KKworLyoqCisgKiBSZWFkcyBkaWZmZXJlbnQgY29tYmluYXRpb25zIG9mIHNhbXBsZSBjb3VudHMgZnJvbSBhbGwgdHJhY2tzIGluIHBhcmFsbGVsIG1vZGUgYmVmb3JlIHN3aXRjaGluZworICogdG8gc2VxdWVudGlhbCBtb2RlIGFuZCByZWFkaW5nIHRoZSByZXN0IG9mIHRoZSBzYW1wbGVzLgorICovCitURVNUX0YoTWVkaWFTYW1wbGVSZWFkZXJOREtUZXN0cywgVGVzdE1peGVkU2FtcGxlQWNjZXNzKSB7CisgICAgTE9HKERFQlVHKSA8PCAiVGVzdE1peGVkU2FtcGxlQWNjZXNzIFN0YXJ0cyI7CisgICAgaW5pdEV4dHJhY3RvclNhbXBsZXMoKTsKKworICAgIGZvciAoaW50IHRyYWNrSW5kVG9UZXN0ID0gMDsgdHJhY2tJbmRUb1Rlc3QgPCBtVHJhY2tDb3VudDsgKyt0cmFja0luZFRvVGVzdCkgeworICAgICAgICBmb3IgKGludCBzYW1wbGVDb3VudCA9IDA7IHNhbXBsZUNvdW50IDw9IChtRXh0cmFjdG9yU2FtcGxlc1t0cmFja0luZFRvVGVzdF0uc2l6ZSgpICsgMSk7CisgICAgICAgICAgICAgKytzYW1wbGVDb3VudCkgeworICAgICAgICAgICAgU2FtcGxlQWNjZ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U3RvcCgpKTsKKyAgICAgICAgcmV0dXJuIEFNRURJQV9PSzsKKyAgICB9CisgICAgLy8gfk11eGVySW50ZXJmYWNlCisKKyAgICBzdHJ1Y3QgRXZlbnQgeworICAgICAgICBlbnVtIHsgTm9FdmVudCwgQWRkVHJhY2ssIFN0YXJ0LCBXcml0ZVNhbXBsZSwgU3RvcCB9IHR5cGUgPSBOb0V2ZW50OworICAgICAgICBjb25zdCBBTWVkaWFGb3JtYXQqIGZvcm1hdCA9IG51bGxwdHI7CisgICAgICAgIHNpemVfdCB0cmFja0luZGV4ID0gMDsKKyAgICAgICAgY29uc3QgdWludDhfdCogZGF0YSA9IG51bGxwdHI7CisgICAgICAgIEFNZWRpYUNvZGVjQnVmZmVySW5mbyBpbmZve307CisgICAgfTsKKworICAgIHN0YXRpYyBjb25zdGV4cHIgRXZlbnQgTm9FdmVudCA9IHtFdmVudDo6Tm9FdmVudCwgbnVsbHB0ciwgMCwgbnVsbHB0ciwge319OworCisgICAgc3RhdGljIEV2ZW50IEFkZFRyYWNrKGNvbnN0IEFNZWRpYUZvcm1hdCogZm9ybWF0KSB7CisgICAgICAgIHJldHVybiB7LnR5cGUgPSBFdmVudDo6QWRkVHJhY2ssIC5mb3JtYXQgPSBmb3JtYXR9OworICAgIH0KKworICAgIHN0YXRpYyBFdmVudCBTdGFydCgpIHsgcmV0dXJuIHsudHlwZSA9IEV2ZW50OjpTdGFydH07IH0KKyAgICBzdGF0aWMgRXZlbnQgU3RvcCgpIHsgcmV0dXJuIHsudHlwZSA9IEV2ZW50OjpTdG9wfTsgfQorCisgICAgc3RhdGljIEV2ZW50IFdyaXRlU2FtcGxlKHNpemVfdCB0cmFja0luZGV4LCBjb25zdCB1aW50OF90KiBkYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBTWVkaWFDb2RlY0J1ZmZlckluZm8qIGluZm8pIHsKKyAgICAgICAgcmV0dXJuIHsudHlwZSA9IEV2ZW50OjpXcml0ZVNhbXBsZSwgLnRyYWNrSW5kZXggPSB0cmFja0luZGV4LCAuZGF0YSA9IGRhdGEsIC5pbmZvID0gKmluZm99OworICAgIH0KKworICAgIHN0YXRpYyBFdmVudCBXcml0ZVNhbXBsZVdpdGhQdHMoc2l6ZV90IHRyYWNrSW5kZXgsIGludDY0X3QgcHRzKSB7CisgICAgICAgIHJldHVybiB7LnR5cGUgPSBFdmVudDo6V3JpdGVTYW1wbGUsIC50cmFja0luZGV4ID0gdHJhY2tJbmRleCwgLmluZm8gPSB7MCwgMCwgcHRzLCAwfX07CisgICAgfQorCisgICAgdm9pZCBwdXNoRXZlbnQoY29uc3QgRXZlbnQmIGUpIHsKKyAgICAgICAgc3RkOjp1bmlxdWVfbG9jazxzdGQ6Om11dGV4PiBsb2NrKG1NdXRleCk7CisgICAgICAgIG1FdmVudFF1ZXVlLnB1c2hfYmFjayhlKTsKKyAgICAgICAgbUNvbmRpdGlvbi5ub3RpZnlfb25lKCk7CisgICAgfQorCisgICAgY29uc3QgRXZlbnQmIHBvcEV2ZW50KGJvb2wgd2FpdCA9IGZhbHNlKSB7CisgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2s8c3RkOjptdXRleD4gbG9jayhtTXV0ZXgpOworICAgICAgICB3aGlsZSAod2FpdCAmJiBtRXZlbnRRdWV1ZS5lbXB0eSgpKSB7CisgICAgICAgICAgICBtQ29uZGl0aW9uLndhaXRfZm9yKGxvY2ssIHN0ZDo6Y2hyb25vOjptaWxsaXNlY29uZHMoMjAwKSk7CisgICAgICAgIH0KKworICAgICAgICBpZiAobUV2ZW50UXVldWUuZW1wdHkoKSkgeworICAgICAgICAgICAgbVBvcHBlZEV2ZW50ID0gTm9FdmVudDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1Qb3BwZWRFdmVudCA9ICptRXZlbnRRdWV1ZS5iZWdpbigpOworICAgICAgICAgICAgbUV2ZW50UXVldWUucG9wX2Zyb250KCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1Qb3BwZWRFdmVudDsKKyAgICB9CisKK3ByaXZhdGU6CisgICAgRXZlbnQgbVBvcHBlZEV2ZW50OworICAgIHN0ZDo6bGlzdDxFdmVudD4gbUV2ZW50UXVldWU7CisgICAgc3NpemVfdCBtVHJhY2tDb3VudCA9IDA7CisgICAgc3RkOjptdXRleCBtTXV0ZXg7CisgICAgc3RkOjpjb25kaXRpb25fdmFyaWFibGUgbUNvbmRpdGlvbjsKK307CisKK2Jvb2wgb3BlcmF0b3I9PShjb25zdCBBTWVkaWFDb2RlY0J1ZmZlckluZm8mIGxocywgY29uc3QgQU1lZGlhQ29kZWNCdWZmZXJJbmZvJiByaHMpIHsKKyAgICByZXR1cm4gbGhzLm9mZnNldCA9PSByaHMub2Zmc2V0ICYmIGxocy5zaXplID09IHJocy5zaXplICYmCisgICAgICAgICAgIGxocy5wcmVzZW50YXRpb25UaW1lVXMgPT0gcmhzLnByZXNlbnRhdGlvblRpbWVVcyAmJiBsaHMuZmxhZ3MgPT0gcmhzLmZsYWdzOworfQorCitib29sIG9wZXJhdG9yPT0oY29uc3QgVGVzdE11eGVyOjpFdmVudCYgbGhzLCBjb25zdCBUZXN0TXV4ZXI6OkV2ZW50JiByaHMpIHsKKyAgICAvLyBEb24ndCB0ZXN0IGZvcm1hdCBwb2ludGVyIGVxdWFsaXR5IHNpbmNlIHRoZSB3cml0ZXIgY2FuIG1ha2UgYSBjb3B5LgorICAgIHJldHVybiBsaHMudHlwZSA9PSByaHMudHlwZSAvKiYmIGxocy5mb3JtYXQgPT0gcmhzLmZvcm1hdCovICYmCisgICAgICAgICAgIGxocy50cmFja0luZGV4ID09IHJocy50cmFja0luZGV4ICYmIGxocy5kYXRhID09IHJocy5kYXRhICYmIGxocy5pbmZvID09IHJocy5pbmZvOworfQorCisvKiogUmVwcmVzZW50cyBhIG1lZGlhIHNvdXJjZSBmaWxlLiAqLworY2xhc3MgVGVzdE1lZGlhU291cmNlIHsKK3B1YmxpYzoKKyAgICB2b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rRm9ybWF0KG1FeHRyYWN0b3IsIHRyYWNrSW5kZXgpOworICAgICAgICAgICAgQVNTRVJUX05FKHRyYWNrRm9ybWF0LCBudWxscHRyKTsKKworICAgICAgICAgICAgY29uc3QgY2hhciogbWltZSA9IG51bGxwdHI7CisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZ2V0U3RyaW5nKHRyYWNrRm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX01JTUUsICZtaW1lKTsKKyAgICAgICAgICAgIGlmIChzdHJuY21wKG1pbWUsICJ2aWRlby8iLCA2KSA9PSAwKSB7CisgICAgICAgICAgICAgICAgbVZpZGVvVHJhY2tJbmRleCA9IHRyYWNrSW5kZXg7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHN0cm5jbXAobWltZSwgImF1ZGlvLyIsIDYpID09IDApIHsKKyAgICAgICAgICAgICAgICBtQXVkaW9UcmFja0luZGV4ID0gdHJhY2tJbmRleDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVRyYWNrRm9ybWF0cy5wdXNoX2JhY2soCisgICAgICAgICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxBTWVkaWFGb3JtYXQ+KHRyYWNrRm9ybWF0LCAmQU1lZGlhRm9ybWF0X2RlbGV0ZSkpOworCisgICAgICAgICAgICBBTWVkaWFFeHRyYWN0b3Jfc2VsZWN0VHJhY2sobUV4dHJhY3RvciwgdHJhY2tJbmRleCk7CisgICAgICAgIH0KKyAgICAgICAgRVhQRUNUX0dFKG1WaWRlb1RyYWNrSW5kZXgsIDApOworICAgICAgICBFWFBFQ1RfR0UobUF1ZGlvVHJhY2tJbmRleCwgMCk7CisgICAgfQorCisgICAgdm9pZCByZXNldCgpIGNvbnN0IHsKKyAgICAgICAgbWVkaWFfc3RhdHVzX3Qgc3RhdHVzID0gQU1lZGlhRXh0cmFjdG9yX3NlZWtUbyhtRXh0cmFjdG9yLCAwIC8qIHNlZWtQb3NVcyAqLywKKyAgICAgICAgICAg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NoYXIqIHNvdXJjZVBhdGgpIHsKKyAgICAgICAgY29uc3QgaW50IHNvdXJjZUZkID0gb3Blbihzb3VyY2VQYXRoLCBPX1JET05MWSk7CisgICAgICAgIEFTU0VSVF9HVChzb3VyY2VGZCwgMCk7CisKKyAgICAgICAgY29uc3Qgc2l6ZV90IGZpbGVTaXplID0gbHNlZWsoc291cmNlRmQsIDAsIFNFRUtfRU5EKTsKKyAgICAgICAgbHNlZWsoc291cmNlRmQsIDAsIFNFRUtfU0VUKTsKKworICAgICAgICBtTWVkaWFTYW1wbGVSZWFkZXIgPSBNZWRpYVNhbXBsZVJlYWRlck5ESzo6Y3JlYXRlRnJvbUZkKHNvdXJjZUZkLCAwIC8qIG9mZnNldCAqLywgZmlsZVNpemUpOworICAgICAgICBBU1NFUlRfTkUobU1lZGlhU2FtcGxlUmVhZGVyLCBudWxscHRyKTsKKyAgICAgICAgY2xvc2Uoc291cmNlRmQpOworCisgICAgICAgIGZvciAoc2l6ZV90IHRyYWNrSW5kZXggPSAwOyB0cmFja0luZGV4IDwgbU1lZGlhU2FtcGxlUmVhZGVyLT5nZXRUcmFja0NvdW50KCk7CisgICAgICAgICAgICAgKyt0cmFja0luZGV4KSB7CisgICAgICAgICAgICBBTWVkaWFGb3JtYXQqIHRyYWNrRm9ybWF0ID0gbU1lZGlhU2FtcGxlUmVhZGVyLT5nZXRUcmFja0Zvcm1hdCh0cmFja0luZGV4KTsKKyAgICAgICAgICAgIEFTU0VSVF9ORSh0cmFja0Zvcm1hdCwgbnVsbHB0cik7CisKKyAgICAgICAgICAgIGNvbnN0IGNoYXIqIG1pbWUgPSBudWxscHRyOworICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldFN0cmluZyh0cmFja0Zvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9NSU1FLCAmbWltZSk7CisgICAgICAgICAgICBBU1NFUlRfTkUobWltZSwgbnVsbHB0cik7CisKKyAgICAgICAgICAgIGlmIChHZXRQYXJhbSgpID09IFZJREVPICYmIHN0cm5jbXAobWltZSwgInZpZGVvLyIsIDYpID09IDApIHsKKyAgICAgICAgICAgICAgICBtVHJhY2tJbmRleCA9IHRyYWNrSW5kZXg7CisKKyAgICAgICAgICAgICAgICBtU291cmNlRm9ybWF0ID0gc3RkOjpzaGFyZWRfcHRyPEFNZWRpYUZvcm1hdD4odHJhY2tGb3JtYXQsICZBTWVkaWFGb3JtYXRfZGVsZXRlKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfTkUobVNvdXJjZUZvcm1hdCwgbnVsbHB0cik7CisKKyAgICAgICAgICAgICAgICBtRGVzdGluYXRpb25Gb3JtYXQgPQorICAgICAgICAgICAgICAgICAgICAgICAgVHJhY2tUcmFuc2NvZGVyVGVzdFV0aWxzOjpnZXREZWZhdWx0VmlkZW9EZXN0aW5hdGlvbkZvcm1hdCh0cmFja0Zvcm1hdCk7CisgICAgICAgICAgICAgICAgQVNTRVJUX05FKG1EZXN0aW5hdGlvbkZvcm1hdCwgbnVsbHB0cik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9IGVsc2UgaWYgKEdldFBhcmFtKCkgPT0gUEFTU1RIUk9VR0ggJiYgc3RybmNtcChtaW1lLCAiYXVkaW8vIiwgNikgPT0gMCkgeworICAgICAgICAgICAgICAgIC8vIFRPRE8obG5pbHNzb24pOiBUZXN0IG1ldGFkYXRhIHRyYWNrIHBhc3N0aHJvdWdoIGFmdGVyIGhrdWFuZ0AgcHJvdmlkZXMgc2FtcGxlLgorICAgICAgICAgICAgICAgIG1UcmFja0luZGV4ID0gdHJhY2tJbmRleDsKKworICAgICAgICAgICAgICAgIG1Tb3VyY2VGb3JtYXQgPSBzdGQ6OnNoYXJlZF9wdHI8QU1lZGlhRm9ybWF0Pih0cmFja0Zvcm1hdCwgJkFNZWRpYUZvcm1hdF9kZWxldGUpOworICAgICAgICAgICAgICAgIEFTU0VSVF9ORShtU291cmNlRm9ybWF0LCBudWxscHRyKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2RlbGV0ZSh0cmFja0Zvcm1hdCk7CisgICAgICAgIH0KKworICAgICAgICBBU1NFUlRfTkUobVNvdXJjZUZvcm1hdCwgbnVsbHB0cik7CisgICAgICAgIEVYUEVDVF9FUShtTWVkaWFTYW1wbGVSZWFkZXItPnNlbGVjdFRyYWNrKG1UcmFja0luZGV4KSwgQU1FRElBX09LKTsKKyAgICB9CisKKyAgICAvLyBEcmFpbnMgdGhlIHRyYW5zY29kZXIncyBvdXRwdXQgcXVldWUgaW4gYSBsb29wLgorICAgIHZvaWQgZHJhaW5PdXRwdXRTYW1wbGVzKGludCBudW1TYW1wbGVzVG9TYXZlID0gMCkgeworICAgICAgICBtVHJhbnNjb2Rlci0+c2V0U2FtcGxlQ29uc3VtZXIoCisgICAgICAgICAgICAgICAgW3RoaXMsIG51bVNhbXBsZXNUb1NhdmVdKGNvbnN0IHN0ZDo6c2hhcmVkX3B0cjxNZWRpYVNhbXBsZT4mIHNhbXBsZSkgeworICAgICAgICAgICAgICAgICAgICBBU1NFUlRfTkUoc2FtcGxlLCBudWxscHRyKTsKKworICAgICAgICAgICAgICAgICAgICBtR290RW5kT2ZTdHJlYW0gPSAoc2FtcGxlLT5pbmZvLmZsYWdzICYgU0FNUExFX0ZMQUdfRU5EX09GX1NUUkVBTSkgIT0gMDsKKworICAgICAgICAgICAgICAgICAgICBpZiAobVNhdmVkU2FtcGxlcy5zaXplKCkgPCBudW1TYW1wbGVzVG9TYXZlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtU2F2ZWRTYW1wbGVzLnB1c2hfYmFjayhzYW1wbGUpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1TYXZlZFNhbXBsZXMuc2l6ZSgpID09IG51bVNhbXBsZXNUb1NhdmUgfHwgbUdvdEVuZE9mU3RyZWFtKSB7CisgICAgICAgICA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gyLCBib29sIGFic29sdXRlID0gZmFsc2UpIHsKKyAgICAgICAgc3RydWN0IHN0YXQgczEsIHMyOworICAgICAgICBFWFBFQ1RfRVEoc3RhdChwYXRoMSwgJnMxKSwgMCk7CisgICAgICAgIEVYUEVDVF9FUShzdGF0KHBhdGgyLCAmczIpLCAwKTsKKworICAgICAgICBpbnQ2NF90IGRpZmYgPSBzMi5zdF9zaXplIC0gczEuc3Rfc2l6ZTsKKyAgICAgICAgaWYgKGFic29sdXRlICYmIGRpZmYgPCAwKSBkaWZmID0gLWRpZmY7CisKKyAgICAgICAgcmV0dXJuIChmbG9hdClkaWZmICogMTAwLjBmIC8gczEuc3Rfc2l6ZTsKKyAgICB9CisKKyAgICB0eXBlZGVmIGVudW0geworICAgICAgICBrUnVuVG9Db21wbGV0aW9uLAorICAgICAgICBrQ2hlY2tIZWFydEJlYXQsCisgICAgICAgIGtDYW5jZWxBZnRlclByb2dyZXNzLAorICAgICAgICBrQ2FuY2VsQWZ0ZXJTdGFydCwKKyAgICAgICAga1BhdXNlQWZ0ZXJQcm9ncmVzcywKKyAgICAgICAga1BhdXNlQWZ0ZXJTdGFydCwKKyAgICB9IFRyYW5zY29kZUV4ZWN1dGlvbkNvbnRyb2w7CisKKyAgICB1c2luZyBGb3JtYXRDb25maWd1cmF0aW9uQ2FsbGJhY2sgPSBzdGQ6OmZ1bmN0aW9uPEFNZWRpYUZvcm1hdCooQU1lZGlhRm9ybWF0Kik+OworICAgIG1lZGlhX3N0YXR1c190IHRyYW5zY29kZUhlbHBlcihjb25zdCBjaGFyKiBzcmNQYXRoLCBjb25zdCBjaGFyKiBkZXN0UGF0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRm9ybWF0Q29uZmlndXJhdGlvbkNhbGxiYWNrIGZvcm1hdENhbGxiYWNrLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUcmFuc2NvZGVFeGVjdXRpb25Db250cm9sIGV4ZWN1dGlvbkNvb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R0hfSU5URU5ERUQ7CisgICAgICAgICAgICBjYXNlIGtDYW5jZWxBZnRlclN0YXJ0OgorICAgICAgICAgICAgICAgIHRyYW5zY29kZXItPmNhbmNlbCgpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBrUGF1c2VBZnRlclByb2dyZXNzOgorICAgICAgICAgICAgICAgIG1DYWxsYmFja3MtPndhaXRGb3JQcm9ncmVzc01hZGUoKTsKKyAgICAgICAgICAgICAgICBGQUxMVEhST1VHSF9JTlRFTkRFRDsKKyAgICAgICAgICAgIGNhc2Uga1BhdXNlQWZ0ZXJTdGFydDoKKyAgICAgICAgICAgICAgICB0cmFuc2NvZGVyLT5wYXVzZSgmcGF1c2VkU3RhdGUpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBrQ2hlY2tIZWFydEJlYXQ6IHsKKyAgICAgICAgICAgICAgICBtQ2FsbGJhY2tzLT53YWl0Rm9yUHJvZ3Jlc3NNYWRlKCk7CisgICAgICAgICAgICAgICAgYXV0byBzdGFydFRpbWUgPSBzdGQ6OmNocm9ubzo6c3lzdGVtX2Nsb2NrOjpub3coKTsKKyAgICAgICAgICAgICAgICBtQ2FsbGJhY2tzLT53YWl0Rm9yVHJhbnNjb2RpbmdGaW5pc2hlZCgpOworICAgICAgICAgICAgICAgIGF1dG8gZmluaXNoVGltZSA9IHN0ZDo6Y2hyb25vOjpzeXN0ZW1fY2xvY2s6Om5vdygpOworICAgICAgICAgICAgICAgIGludDMyX3QgZXhwZWN0ZWRDb3VudCA9CisgICAgICAgICAgICAgICAgICAgICAgICAoZmluaXNoVGltZSAtIHN0YXJ0VGltZSkgLyBzdGQ6OmNocm9ubzo6bWljcm9zZWNvbmRzKGhlYXJ0QmVhdEludGVydmFsVXMpOworICAgICAgICAgICAgICAgIC8vIEhlcmUgd2UgcmVsYXggdGhlIGV4cGVjdGVkIGNvdW50IGJ5IDEsIGluIGNhc2UgdGhlIGxhc3QgaGVhcnQtYmVhdCBqdXN0CisgICAgICAgICAgICAgICAgLy8gbWlzc2VkIHRoZSB3aW5kb3csIG90aGVyIHRoYW4gdGhhdCB0aGUgY291bnQgc2hvdWxkIGJlIGV4YWN0LgorICAgICAgICAgICAgICAgIEVYUEVDVF9HRShtQ2FsbGJhY2tzLT5tSGVhcnRCZWF0Q291bnQsIGV4cGVjdGVkQ291bnQgLSAxKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2Uga1J1blRvQ29tcGxldGlvbjoKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgbUNhbGxiYWNrcy0+d2FpdEZvclRyYW5zY29kaW5nRmluaXNoZWQoKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBjbG9zZShzcmNGZCk7CisgICAgICAgIGNsb3NlKGRzdEZkKTsKKworICAgICAgICByZXR1cm4gbUNhbGxiYWNrcy0+bVN0YXR1czsKKyAgICB9CisKKyAgICB2b2lkIHRlc3RUcmFuc2NvZGVWaWRlbyhjb25zdCBjaGFyKiBzcmNQYXRoLCBjb25zdCBjaGFyKiBkZXN0UGF0aCwgY29uc3QgY2hhciogZHN0TWltZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IGJpdHJhdGUgPSAwKSB7CisgICAgICAgIEVYUEVDVF9FUSh0cmFuc2NvZGVIZWxwZXIoc3JjUGF0aCwgZGVzdFBhdGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW2RzdE1pbWUsIGJpdHJhdGVdKEFNZWRpYUZvcm1hdCogc291cmNlRm9ybWF0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFNZWRpYUZvcm1hdCogZm9ybWF0ID0gbnVsbHB0cjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciogbWltZSA9IG51bGxwdHI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9nZXRTdHJpbmcoc291cmNlRm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX01JTUUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm1pbWUpOworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdHJuY21wKG1pbWUsICJ2aWRlby8iLCA2KSA9PSAwICYmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYml0cmF0ZSA+IDAgfHwgZHN0TWltZSAhPSBudWxscHRyKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9ybWF0ID0gQU1lZGlhRm9ybWF0X25ldygpOworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYml0cmF0ZSA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0SW50MzIoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXQsIEFNRURJQUZPUk1BVF9LRVlfQklUX1JBVEUsIGJpdHJhdGUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZHN0TWltZSAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldFN0cmluZyhmb3JtYXQsIEFNRURJQUZPUk1BVF9LRVlfTUlNRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRzdE1pbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmb3JtYXQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksCisgICAgICAgICAgICAgICAgICBBTUVESUFfT0spOworCisgICAgICAgIGlmIChkc3RNaW1lICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPEZvcm1hdFZlcmlmaWVyRW50cnk+IGV4dHJhVmVyaWZpZXJzID0geworICAgICAgICAgICAgICAgICAgICB7QU1FRElBRk9STUFUX0tFWV9NSU1FLAorICAgICAgICAgICAgICAgICAgICAgW2RzdE1pbWVdKGNvbnN0IGNoYXIqIGtleSwgQU1lZGlhRm9ybWF0KiBzcmMgX191bnVzZWQsIEFNZWRpYUZvcm1hdCogZHN0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciogbWltZSA9IG51bGxwdHI7CisgICAgICAgICAgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldFN0cmluZyhkc3QsIGtleSwgJm1pbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhc3RyY21wKG1pbWUsIGRzdE1pbWUpOworICAgICAgICAgICAgICAgICAgICAgfX0sCisgICAgICAgICAgICB9OworICAgICAgICAgICAgdmVyaWZ5T3V0cHV0Rm9ybWF0KGRlc3RQYXRoLCAmZXh0cmFWZXJpZmllcnMpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgdmVyaWZ5T3V0cHV0Rm9ybWF0KGRlc3RQYXRoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgdmVyaWZ5T3V0cHV0Rm9ybWF0KGNvbnN0IGNoYXIqIGRlc3RQYXRoLAorICAgICAgICAgICAgICAg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YXRfZ2V0U3RyaW5nKHRyYWNrRm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX01JTUUsICZtaW1lKTsKKworICAgICAgICAgICAgICAgIGlmIChzdHJuY21wKG1pbWUsICJ2aWRlby8iLCA2KSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIExPRyhJTkZPKSA8PCAiVHJhY2sgIyAiIDw8IHRyYWNrSW5kZXggPDwgIjogIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgQU1lZGlhRm9ybWF0X3RvU3RyaW5nKHRyYWNrRm9ybWF0KTsKKyAgICAgICAgICAgICAgICAgICAgdmlkZW9Gb3JtYXQgPSBzdGQ6OnNoYXJlZF9wdHI8QU1lZGlhRm9ybWF0Pih0cmFja0Zvcm1hdCwgJkFNZWRpYUZvcm1hdF9kZWxldGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBFWFBFQ1RfTkUodmlkZW9Gb3JtYXQsIG51bGxwdHIpOworICAgICAgICBpZiAodmlkZW9Gb3JtYXQgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgTE9HKElORk8pIDw8ICJzb3VyY2UgdmlkZW8gZm9ybWF0OiAiIDw8IEFNZWRpYUZvcm1hdF90b1N0cmluZyhtU291cmNlVmlkZW9Gb3JtYXQuZ2V0KCkpOworICAgICAgICAgICAgTE9HKElORk8pIDw8ICJ0cmFuc2NvZGVkIHZpZGVvIGZvcm1hdDogIiA8PCBBTWVkaWFGb3JtYXRfdG9TdHJpbmcodmlkZW9Gb3JtYXQuZ2V0KCkpOworCisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IChzaXplb2Yoa0ZpZWxkc1RvUHJlc2VydmUpIC8gc2l6ZW9mKGtGaWVsZHNUb1ByZXNlcnZlWzBdKSk7ICsraSkgeworICAgICAgICAgICAgICAgIEVYUEVDVF9UUlVFKGtGaWVsZHNUb1ByZXNlcnZlW2ldLmVxdWFsKGtGaWVsZHNUb1ByZXNlcnZlW2ldLmtleSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU291cmNlVmlkZW9Gb3JtYXQuZ2V0KCksIHZpZGVvRm9ybWF0LmdldCgpKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICJGYWlsZWQgYXQga2V5ICIgPDwga0ZpZWxkc1RvUHJlc2VydmVbaV0ua2V5OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoZXh0cmFWZXJpZmllcnMgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZXh0cmFWZXJpZmllcnMtPnNpemUoKTsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IEZvcm1hdFZlcmlmaWVyRW50cnkmIGVudHJ5ID0gKCpleHRyYVZlcmlmaWVycylbaV07CisgICAgICAgICAgICAgICAgICAgIEVYUEVDVF9UUlVFKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudHJ5LmVxdWFsKGVudHJ5LmtleSwgbVNvdXJjZVZpZGVvRm9ybWF0LmdldCgpLCB2aWRlb0Zvcm1hdC5nZXQoKSkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGNsb3NlKGRzdEZkKTsKKyAgICB9CisKKyAgICBzdGQ6OnNoYXJlZF9wdHI8VGVzdFRyYW5zY29kZXJDYWxsYmFja3M+IG1DYWxsYmFja3M7CisgICAgc3RkOjpzaGFyZWRfcHRyPEFNZWRpYUZvcm1hdD4gbVNvdXJjZVZpZGVvRm9ybWF0OworfTsKKworVEVTVF9GKE1lZGlhVHJhbnNjb2RlclRlc3RzLCBUZXN0UGFzc3Rocm91Z2gpIHsKKyAgICBjb25zdCBjaGFyKiBzcmNQYXRoID0gIi9kYXRhL2xvY2FsL3RtcC9Uc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ybWF0X2dldFN0cmluZyh0cmFja0Zvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9NSU1FLCAmbWltZSk7CisgICAgICAgICAgICBBU1NFUlRfTkUobWltZSwgbnVsbHB0cik7CisKKyAgICAgICAgICAgIGlmIChzdHJuY21wKG1pbWUsICJhdWRpby8iLCA2KSA9PSAwKSB7CisgICAgICAgICAgICAgICAgbVRyYWNrSW5kZXggPSB0cmFja0luZGV4OworICAgICAgICAgICAgICAgIEFNZWRpYUV4dHJhY3Rvcl9zZWxlY3RUcmFjayhtRXh0cmFjdG9yLCB0cmFja0luZGV4KTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2RlbGV0ZSh0cmFja0Zvcm1hdCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIFRlYXJEb3duKCkgb3ZlcnJpZGUgeworICAgICAgICBMT0coREVCVUcpIDw8ICJQYXNzdGhyb3VnaFRyYWNrVHJhbnNjb2RlclRlc3RzIHRlYXIgZG93biI7CisgICAgICAgIGlmIChtRXh0cmFjdG9yICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgIEFNZWRpYUV4dHJhY3Rvcl9kZWxldGUobUV4dHJhY3Rvcik7CisgICAgICAgICAgICBtRXh0cmFjdG9yID0gbnVsbHB0cjsKKyAgICAgICAgfQorICAgICAgICBpZiAobVNvdXJjZUZkID4gMCkgeworICAgICAgICAgICAgY2xvc2UobVNvdXJjZUZkKTsKKyAgICAgICAgICAgIG1Tb3VyY2VGZCA9IC0xOworICAgICAgICB9CisgICAgfQorCisgICAgflBhc3N0aHJvdWdoVHJhY2tUcmFuc2NvZGVyVGVzdHMoKSB7CisgICAgICAgIExPRyhERUJVRykgPDwgIlBhc3N0aHJvdWdoVHJhY2tUcmFuc2NvZGVyVGVzdHMgZGVzdHJveWVkIjsKKyAgICB9CisKKyAgICBpbnQgbVNvdXJjZUZkID0gLTE7CisgIC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sIG51bGxwdHIgLyogZGVzdGluYXRpb25Gb3JtYXQgKi8pLAorICAgICAgICAgICAgICBBTUVESUFfT0spOworICAgIEFTU0VSVF9UUlVFKHRyYW5zY29kZXIuc3RhcnQoKSk7CisKKyAgICAvLyBQdWxsIHRyYW5zY29kZXIncyBvdXRwdXQgc2FtcGxlcyBhbmQgY29tcGFyZSBhZ2FpbnN0IGlucHV0IGNoZWNrc3Vtcy4KKyAgICBib29sIGVvcyA9IGZhbHNlOworICAgIHVpbnQ2NF90IHNhbXBsZUNvdW50ID0gMDsKKyAgICB0cmFuc2NvZGVyLnNldFNhbXBsZUNvbnN1bWVyKAorICAgICAgICAgICAgWyZzYW1wbGVDb3VudCwgJnNhbXBsZUNoZWNrc3VtcywgJmVvc10oY29uc3Qgc3RkOjpzaGFyZWRfcHRyPE1lZGlhU2FtcGxlPiYgc2FtcGxlKSB7CisgICAgICAgICAgICAgICAgQVNTRVJUX05FKHNhbXBsZSwgbnVsbHB0cik7CisgICAgICAgICAgICAgICAgRVhQRUNUX0ZBTFNFKGVvcyk7CisKKyAgICAgICAgICAgICAgICBpZiAoc2FtcGxlLT5pbmZvLmZsYWdzICYgU0FNUExFX0ZMQUdfRU5EX09GX1NUUkVBTSkgeworICAgICAgICAgICAgICAgICAgICBlb3MgPSB0cnVlOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIFNhbXBsZUlEIHNhbXBsZUlke3NhbXBsZS0+YnVmZmVyLCBzdGF0aWNfY2FzdDxzc2l6ZV90PihzYW1wbGUtPmluZm8uc2l6ZSl9OworICAgICAgICAgICAgICAgICAgICBFWFBFQ1RfVFJVRShzYW1wbGVJZCA9PSBzYW1wbGVDaGVja3N1bXNbc2FtcGxlQ291bnRdKTsKKyAgICAgICAgICAgICAgICAgICAgKytzYW1wbGVDb3VudDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKworICAgIGNhbGxiYWNrLT53YWl0VW50aWxGaW5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gICAgKyt0cmFja0luZGV4KSB7CisgICAgICAgICAgICBBTWVkaWFGb3JtYXQqIHRyYWNrRm9ybWF0ID0gbU1lZGlhU2FtcGxlUmVhZGVyLT5nZXRUcmFja0Zvcm1hdCh0cmFja0luZGV4KTsKKyAgICAgICAgICAgIEFTU0VSVF9ORSh0cmFja0Zvcm1hdCwgbnVsbHB0cik7CisKKyAgICAgICAgICAgIGNvbnN0IGNoYXIqIG1pbWUgPSBudWxscHRyOworICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldFN0cmluZyh0cmFja0Zvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9NSU1FLCAmbWltZSk7CisgICAgICAgICAgICBBU1NFUlRfTkUobWltZSwgbnVsbHB0cik7CisKKyAgICAgICAgICAgIGlmIChzdHJuY21wKG1pbWUsICJ2aWRlby8iLCA2KSA9PSAwKSB7CisgICAgICAgICAgICAgICAgbVRyYWNrSW5kZXggPSB0cmFja0luZGV4OworCisgICAgICAgICAgICAgICAgbVNvdXJjZUZvcm1hdCA9IHN0ZDo6c2hhcmVkX3B0cjxBTWVkaWFGb3JtYXQ+KHRyYWNrRm9ybWF0LCAmQU1lZGlhRm9ybWF0X2RlbGV0ZSk7CisgICAgICAgICAgICAgICAgQVNTRVJUX05FKG1Tb3VyY2VGb3JtYXQsIG51bGxwdHIpOworCisgICAgICAgICAgICAgICAgbURlc3RpbmF0aW9uRm9ybWF0ID0KKyAgICAgICAgICAgICAgICAgICAgICAgIFRyYWNrVHJhbnNjb2RlclRlc3RVdGlsczo6Z2V0RGVmYXVsdFZpZGVvRGVzdGluYXRpb25Gb3JtYXQodHJhY2tGb3JtYXQpOworICAgICAgICAgICAgICAgIEFTU0VSVF9ORShtRGVzdGluYXRpb25Gb3JtYXQsIG51bGxwdHIpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZGVsZXRlKHRyYWNrRm9ybWF0KTsKKyAgICA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ICAgICAgICBtQ29uZGl0aW9uLm5vdGlmeV9hbGwoKTsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgb25Qcm9ncmVzc1VwZGF0ZShjb25zdCBNZWRpYVRyYW5zY29kZXIqIHRyYW5zY29kZXIgVU5VU0VEX1BBUkFNLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgcHJvZ3Jlc3MpIG92ZXJyaWRlIHsKKyAgICAgICAgdW5pcXVlX2xvY2s8bXV0ZXg+IGxvY2sobU11dGV4KTsKKyAgICAgICAgaWYgKHByb2dyZXNzID4gMCAmJiAhbVByb2dyZXNzTWFkZSkgeworICAgICAgICAgICAgbVByb2dyZXNzTWFkZSA9IHRydWU7CisgICAgICAgICAgICBtQ29uZGl0aW9uLm5vdGlmeV9hbGwoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCBvbkhlYXJ0QmVhdChjb25zdCBNZWRpYVRyYW5zY29kZXIqIHRyYW5zY29kZXIgVU5VU0VEX1BBUkFNKSBvdmVycmlkZSB7fQorCisgICAgdmlydHVhbCB2b2lkIG9uQ29kZWNSZXNvdXJjZUxvc3QoY29uc3QgTWVkaWFUcmFuc2NvZGVyKiB0cmFuc2NvZGVyIFVOVVNFRF9QQVJBTSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPG5kazo6U2NvcGVkQVBhcmNlbD4mIHBhdXNlZFN0YXRlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVTlVTRURfUEFSQU0pIG92ZXJyaWRlIHt9CisKKyAgICB2b2lkIHdhaXRGb3JUcmFuc2NvZGluZ0ZpbmlzaGVkKCkgeworICAgICAgICB1bmlxdWVfbG9jazxtdXRleD4gbG9jayhtTXV0ZXgpOworICAgICAgICB3aGlsZSAoIW1GaW5pc2hlZCkgeworICAgICAgICAgICAgbUNvbmRpdGlvbi53YWl0KGxvY2spOworICAgICAgICB9CisgICAgfQorCitwcml2YXRlOgorICAgIG11dGV4IG1NdXRleDsKKyAgICBjb25kaXRpb25fdmFyaWFibGUgbUNvbmRpdGlvbjsKKyAgICBib29sIG1GaW5pc2hlZCA9IGZhbHNlOworICAgIGJvb2wgbVByb2dyZXNzTWFkZSA9IGZhbHNlOworfTsKKworY2xhc3MgTWVkaWFUcmFuc2NvZGVyRnV6emVyIHsKK3B1YmxpYzoKKyAgICB2b2lkIGluaXQoKTsKKyAgICB2b2lkIGludm9rZVRyYW5zY29kZXIoY29uc3QgdWludDhfdCogZGF0YSwgc2l6ZV90IHNpemUpOworICAgIHZvaWQgZGVJbml0KCk7CisKK3ByaXZhdGU6CisgICAgQU1lZGlhRm9ybWF0KiBnZXRGb3JtYXQoQU1lZGlhRm9ybWF0KiBzb3VyY2VGb3JtYXQpIHsKKyAgICAgICAgQU1lZGlhRm9ybWF0KiBmb3JtYXQgPSBudWxscHRyOworICAgICAgICBjb25zdCBjaGFyKiBtaW1lID0gbnVsbHB0cjsKKyAgICAgICAgQU1lZGlhRm9ybWF0X2dldFN0cmluZyhzb3VyY2VGb3JtYXQsIEFNRURJQUZPUk1BVF9LRVlfTUlNRSwgJm1pbWUpOworICAgICAgICBpZiAobWltZSAhPSBudWxscHRyKSB7CisgICAgICAgICAgICBpZiAoc3RybmNtcChtaW1lLCAidmlkZW8vIiwgNikgPT0gMCAmJiAobURlc3RNaW1lICE9IG51bGxwdHIpKSB7CisgICAgICAgICAgICAgICAgZm9ybWF0ID0gQU1lZGlhRm9ybWF0X25ldygpOworICAgICAgICAgICAgICAgIEFNZWRpYUZvcm1hdF9zZXRTdHJpbmcoZm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX01JTUUsIG1EZXN0TWltZSk7CisgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEludDMyKGZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9QUk9GSUxFLCBtUHJvZmlsZSk7CisgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEludDMyKGZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9MRVZFTCwgbUxldmVsKTsKKyAgICAgICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0SW50MzIoZm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX0JJVF9SQVRFLCBtQml0cmF0ZSk7CisgICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X3NldEludDMyKGZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9PUEVSQVRJTkdfUkFURSwgSU5UMzJfTUFYKTsKKyAgICAgICAgICAgICAgICBBTWVkaWFGb3JtYXRfc2V0SW50MzIoZm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX1BSSU9SSVRZLCAxKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZm9ybWF0OworICAgIH0KKworICAgIHNoYXJlZF9wdHI8VGVzdENhbGxiYWNrcz4gbUNhbGxiYWNrczsKKyAgICBpbnQgbVNyY0ZkID0gMDsKKyAgICBpbnQgbURlc3RGZCA9IDA7CisgICAgY29uc3QgY2hhciogbURlc3RNaW1lOworICAgIEMyQ29uZmlnOjpwcm9maWxlX3QgbVByb2ZpbGU7CisgICAgQzJDb25maWc6OmxldmVsX3QgbUxldmVsOworICAgIHVpbnQ2NF90IG1CaXRyYXRlID0gMDsKK307CisKK3ZvaWQgTWVkaWFUcmFuc2NvZGVyRnV6emVyOjppbml0KCkgeworICAgIG1DYWxsYmFja3MgPSBtYWtlX3NoYXJlZDxUZXN0Q2FsbGJhY2tzPigpOworICAgIEFCaW5kZXJQcm9jZXNzX3N0YXJ0VGhyZWFkUG9vbCgpOworfQorCit2b2lkIE1lZGlhVHJhbnNjb2RlckZ1enplcjo6ZGVJbml0KCkgeworICAgIG1DYWxsYmFja3MucmVzZXQoKTsKKyAgICBpZiAobVNyY0ZkKSB7CisgICAgICAgIGNsb3NlKG1TcmNGZCk7CisgICA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c3RyKCksIE9fV1JPTkxZIHwgT19DUkVBVCwgU19JUlVTUiB8IFNfSVdVU1IpOworICAgIGlmIChkc3RGZCA8PSAwKSB7CisgICAgICAgIEVSUl9NU0coIlVuYWJsZSB0byBvcGVuIGRlc3RpbmF0aW9uIGZpbGUgJXMiLCBjb25maWcuZHN0RmlsZS5jX3N0cigpKTsKKyAgICAgICAgcmV0dXJuIEFNRURJQV9FUlJPUl9JTlZBTElEX1BBUkFNRVRFUjsKKyAgICB9CisKKyAgICBzdGF0dXMgPSB0cmFuc2NvZGVyLT5jb25maWd1cmVEZXN0aW5hdGlvbihkc3RGZCk7CisgICAgY2xvc2UoZHN0RmQpOworICAgIGlmIChzdGF0dXMgIT0gQU1FRElBX09LKSB7CisgICAgICAgIEVSUl9NU0coImNvbmZpZ3VyZURlc3RpbmF0aW9uIHJldHVybmVkIGVycm9yICVkIiwgc3RhdHVzKTsKKyAgICAgICAgcmV0dXJuIHN0YXR1czsKKyAgICB9CisKKyAgICBzdGF0dXMgPSB0cmFuc2NvZGVyLT5zdGFydCgpOworICAgIGlmIChzdGF0dXMgIT0gQU1FRElBX09LKSB7CisgICAgICAgIEVSUl9NU0coInN0YXJ0IHJldHVybmVkIGVycm9yICVkIiwgc3RhdHVzKTsKKyAgICAgICAgcmV0dXJuIHN0YXR1czsKKyAgICB9CisKKyAgICByZXR1cm4gY2FsbGJhY2tzLT53YWl0Rm9yVHJhbnNjb2RpbmdGaW5pc2hlZCgpOworfQorCisvLyBPcHRpb25zLgorc3RhdGljIGNvbnN0IHN0cnVjdCBvcHRpb24ga0xvbmdPcHRzW10gPSB7eyJoZWxwIiwgbm9fYXJndW1lbnQsIG51bGxwdHIsICdoJ30sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7ImNvZGVjIiwgcmVxdWlyZWRfYXJndW1lbnQsIG51bGxwdHIsICdjJ30sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7ImJpdHJhdGUiLCByZXF1aXJlZF9hcmd1bWVudCwgbnVsbHB0ciwgJ2InfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHswLCAwLCAwLCAwfX07CitzdGF0aWMgY29uc3QgY2hhciBrU2hvcnRPcHRzW10gPSAiaGM6YjoiOworCitzdGF0aWMgdm9pZCBwcmludFVzYWdlQW5kRXhpdCgpIHsKKyAgICBjb25zdCBjaGFyKiB1c2FnZSA9CisgICAgICAgICAgICAiICAtaCAvIC0taGVscCAgICA6IFByaW50IHRoaXMgdXNhZ2UgbWVzc2FnZSBhbmQgZXhpdC5cbiIKKyAgICAgICAgICAgICIgIC1jIC8gLS1jb2RlYyAgIDogU3BlY2lmeSBvdXRwdXQgdmlkZW8gY29kZWMgdHlwZSB1c2luZyBNZWRpYUZvcm1hdCBjb2RlYyBtaW1lICIKKyAgICAgICAgICAgICJ0eXBlLlxuIgorICAgICAgICAgICAgIiAgICAgICAgICAgICAgICAgICAgIERlZmF1bHRzIHRvIFwidmlkZW8vYXZjXCIuXG4iCisgICAgICAgICAgICAiICAtYiAvIC0tYml0cmF0ZSA6IFNwZWNpZnkgb3V0cHV0IHZpZGVvIGJpdHJhdGUgaW4gYml0cyBwZXIgc2Vjb25kLlxuIgorICAgICAgICAgICAgIiAgICAgICAgICAgICAgICAgICAgIERlZmF1bHRzIHRvIGVzdGltYXRpbmcgYW5kIHByZXNlcnZpbmcgdGhlIG9yaWdpbmFsIGJpdHJhdGUuXG4iCisgICAgICAgICAgICAiIjsKKworICAgIHByaW50ZigiVXNhZ2U6ICVzIFstaF0gWy1jIENPREVDXSA8c3JjZmlsZT4gPGRzdGZpbGU+XG4lcyIsIGdldHByb2duYW1lKCksIHVzYWdlKTsKKyAgICBleGl0KC0xKTsKK30KKworaW50IG1haW4oaW50IGFyZ2MsIGNoYXIqKiBhcmd2KSB7CisgICAgaW50IGM7CisgICAgVHJhbnNjb2RlQ29uZmlnIGNvbmZpZzsKKworICAgIHdoaWxlICgoYyA9IGdldG9wdF9sb25nKGFyZ2MsIGFyZ3YsIGtTaG9ydE9wdHMsIGtMb25nT3B0cywgbnVsbHB0cikpID49IDApIHsKKyAgICAgICAgc3dpdGNoIChjKSB7CisgICAgICAgIGNhc2UgJ2MnOgorICAgICAgICAgICAgY29uZmlnLmRzdENvZGVjLmFzc2lnbihvcHRhcmcpOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSAnYic6CisgICAgICAgICAgICBjb25maWcuYml0cmF0ZSA9IGF0b2kob3B0YXJnKTsKKyAgICAgICAgICAgIGlmIChjb25maWcuYml0cmF0ZSA8PSAwKSB7CisgICAgICAgICAgICAgICAgRVJSX01TRygiQml0cmF0ZSBtdXN0IGFuIGludGVnZXIgbGFyZ2VyIHRoYW4gemVyby4iKTsKKyAgICAgICAgICAgICAgICBwcmludFVzYWdlQW5kRXhpdCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSAnPyc6CisgICAgICAgICAgICBGQUxMVEhST1VHSF9JTlRFTkRFRDsKKyAgICAgICAgY2FzZSAnaCc6CisgICAgICAgICAgICBGQUxMVEhST1VHSF9JTlRFTkRFRDsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHByaW50VXNhZ2VBbmRFeGl0KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmIChvcHRpbmQgPiAoYXJnYyAtIDIpKSB7CisgICAgICAgIEVSUl9NU0coIlNvdXJjZSBhbmQgZGVzdGluYXRpb24gZmlsZSBub3Qgc3BlY2lmaWVkIik7CisgICAgICAgIHByaW50VXNhZ2VBbmRFeGl0KCk7CisgICAgfQorICAgIGNvbmZpZy5zcmNGaWxlLmFzc2lnbihhcmd2W29wdGluZCsrXSk7CisgICAgY29uZmlnLmRzdEZpbGUuYXNzaWduKGFyZ3Zbb3B0aW5kXSk7CisKKyAgICByZXR1cm4gdHJhbnN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9saWJzOiBbCisgICAgICAgICJsaWJiaW5kZXIiLAorICAgICAgICAibGlic2htZW11dGlsIiwKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICAgICAgInNoYXJlZC1maWxlLXJlZ2lvbi1haWRsLWNwcCIsCisgICAgXSwKKyAgICBleHBvcnRfc2hhcmVkX2xpYl9oZWFkZXJzOiBbCisgICAgICAgICJsaWJiaW5kZXIiLAorICAgICAgICAibGlidXRpbHMiLAorICAgICAgICAic2hhcmVkLWZpbGUtcmVnaW9uLWFpZGwtY3BwIiwKKyAgICBdLAorICAgIHRhcmdldDogeworICAgICAgICBkYXJ3aW46IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgIH0sCit9CisKK2NjX2xpYnJhcnkgeworICAgIG5hbWU6ICJsaWJzaG1lbXV0aWwiLAorICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsiaW5jbHVkZSJdLAorICAgIHNyY3M6IFsiU2htZW1VdGlsLmNwcCJdLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIHZlbmRvcl9hdmFpbGFibGU6IHRydWUsCisgICAgZG91YmxlX2xvYWRhYmxlOiB0cnVlLAorICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJzaGFyZWQtZmlsZS1yZWdpb24tYWlkbC1jcHAiLAorICAgIF0sCisgICAgZXhwb3J0X3NoYXJlZF9saWJfaGVhZGVyczogWworICAgICAgICAic2hhcmVkLWZpbGUtcmVnaW9uLWFpZGwtY3BwIiwKKyAgICBdLAorICAgIHRhcmdldDogeworICAgICAgICBkYXJ3aW46IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgIH0sCit9CisKK2NjX3Rlc3QgeworICAgIG5hbWU6ICJzaG1lbVRlc3QiLAorICAgIHNyY3M6IFsiU2htZW1UZXN0LmNwcCJdLAorICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgIC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2V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG1lbS5zaXplKTsKKyAgICByZXR1cm4gdHJ1ZTsKK30KKworYm9vbCBjb252ZXJ0SU1lbW9yeVRvU2hhcmVkRmlsZVJlZ2lvbihjb25zdCBzcDxJTWVtb3J5PiYgbWVtLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaGFyZWRGaWxlUmVnaW9uKiByZXN1bHQpIHsKKyAgICBhc3NlcnQobWVtICE9IG51bGxwdHIpOworICAgIGFzc2VydChyZXN1bHQgIT0gbnVsbHB0cik7CisKKyAgICAqcmVzdWx0ID0gU2hhcmVkRmlsZVJlZ2lvbigpOworCisgICAgc3NpemVfdCBvZmZzZXQ7CisgICAgc2l6ZV90IHNpemU7CisKKyAgICBzcDxJTWVtb3J5SGVhcD4gaGVhcCA9IG1lbS0+Z2V0TWVtb3J5KCZvZmZzZXQsICZzaXplKTsKKyAgICBpZiAoc2l6ZSA+IDApIHsKKyAgICAgICAgaWYgKGhlYXAgPT0gbnVsbHB0cikgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIC8vIE1ha2Ugc3VyZSB0aGUgb2Zmc2V0IGFuZCBzaXplIGRvIG5vdCBvdmVyZmxvdyBmcm9tIGludDY0IGJvdW5kYXJpZXMuCisgICAgICAgIGlmIChzaXplID4gc3RkOjpudW1lcmljX2xpbWl0czxpbnQ2NF90Pjo6bWF4KCkgfHwKKyAgICAgICAgICAgICAgICBvZmZzZXQgPiBzdGQ6Om51bWVyaWNfbGltaXRzPGludDY0X3Q+OjptYXgoKSB8fAorICAgICAgICAgICAgICAgIGhlYXAtPmdldE9mZnNldCgpID4gc3RkOjpudW1lcmljX2xpbWl0czxpbnQ2NF90Pjo6bWF4KCkgfHwKKyAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDx1aW50NjRfdD4oaGVhcC0+Z2V0T2Zmc2V0KCkpICsKKyAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDx1aW50NjRfdD4ob2Zmc2V0KQorICAgICAgICAgICAgICAgICAgICAgICAgPiBzdGQ6Om51bWVyaWNfbGltaXRzPGludDY0X3Q+OjptYXgoKSkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgY29uc3QgaW50IGZkID0gZmNudGwoaGVhcC0+Z2V0SGVhcElEKCksIEZfRFVQRkRfQ0xPRVhFQywgMCk7CisgICAgICAgIGlmIChmZCA8IDApIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICByZXN1bHQtPmZkLnJlc2V0KGJhc2U6OnVuaXF1ZV9mZChmZCkpOworICAgICAgICByZXN1bHQtPnNpemUgPSBzaXplOworICAgICAgICByZXN1bHQtPm9mZnNldCA9IGhlYXAtPmdldE9mZnNldCgpICsgb2Zmc2V0OworICAgICAgICByZXN1bHQtPndyaXRlYWJsZSA9IChoZWFwLT5nZXRGbGFncygpICYgSU1lbW9yeUhlYXA6OlJFQURfT05MWSkgPT0gMDsKKyAgICB9CisgICAgcmV0dXJuIHRydWU7Cit9CisKK2Jvb2wgY29udmVydE51bGxhYmxlU2hhcmVkRmlsZVJlZ2lvblRvSU1lbW9yeShjb25zdCBzdGQ6Om9wdGlvbmFsPFNoYXJlZEZpbGVSZWdpb24+JiBzaG1lbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcDxJTWVtb3J5PiogcmVzdWx0KSB7CisgICAgYXNzZXJ0KHJlc3VsdCAhPSBudWxscHRyKTsKKworICAgIGlmICghc2htZW0uaGFzX3ZhbHVlKCkpIHsKKyAgICAgICAgcmVzdWx0LT5jbGVhcigpOworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICByZXR1cm4gY29udmVydFNoYXJlZEZpbGVSZWdpb25Ub0lNZW1vcnkoc2htZW0udmFsdWUoKSwgcmVzdWx0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9ydGVkIGluIHR1bm5lbCBtb2RlIiwgVFVOTkVMX1BFRUtfS0VZKTsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisKKyAgICBPTVhfQ09ORklHX0JPT0xFQU5UWVBFIGNvbmZpZzsKKyAgICBJbml0T01YUGFyYW1zKCZjb25maWcpOworICAgIGNvbmZpZy5iRW5hYmxlZCA9IChPTVhfQk9PTCkodHVubmVsUGVlayAhPSAwKTsKKyAgICBzdGF0dXNfdCBlcnIgPSBtT01YTm9kZS0+c2V0Q29uZmlnKAorICAgICAgICAgICAgKE9NWF9JTkRFWFRZUEUpT01YX0luZGV4Q29uZmlnQW5kcm9pZFR1bm5lbFBlZWssCisgICAgICAgICAgICAmY29uZmlnLCBzaXplb2YoY29uZmlnKSk7CisgICAgaWYgKGVyciAhPSBPSykgeworICAgICAgICBBTE9HRSgiZGVjb2RlciBjYW5ub3Qgc2V0ICVzIHRvICVkIChlcnIgJWQpIiwKKyAgICAgICAgICAgICAgVFVOTkVMX1BFRUtfS0VZLCB0dW5uZWxQZWVrLCBlcnIpOworICAgIH0KKworICAgIHJldHVybiBlcnI7Cit9CisKIHN0YXR1c190IEFDb2RlYzo6c2V0QXVkaW9QcmVzZW50YXRpb24oaW50MzJfdCBwcmVzZW50YXRpb25JZCwgaW50MzJfdCBwcm9ncmFtSWQpIHsKICAgICBPTVhfQVVESU9fQ09ORklHX0FORFJPSURfQVVESU9QUkVTRU5UQVRJT04gY29uZmlnOwogICAgIEluaXRPTVhQYXJhbXMoJmNvbmZpZyk7CkBAIC0yNjAyLDE1ICsyNjYwLDE1IEBACiAgICAgdW5zaWduZWQgaW50IG51bUxheWVycyA9IDA7CiAgICAgdW5zaWduZWQgaW50IG51bUJMYXllcnMgPSAwOwogICAgIGludCB0YWdzOwotICAgIGNoYXIgZHVtbXk7CisgICAgY2hhciB0bXA7CiAgICAgT01YX1ZJREVPX0FORFJPSURfVEVNUE9SQUxMQVlFUklOR1BBVFRFUk5UW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mZpZ0NvbW1vblJvdGF0ZShlcnIgJWQpIiwgZXJyKTsKKyAgICAgICAgfQorICAgICAgICBjb25maWcublJvdGF0aW9uID0gcm90YXRpb247CisgICAgICAgIGVyciA9IG1PTVhOb2RlLT5zZXRDb25maWcoCisgICAgICAgICAgICAgICAgKE9NWF9JTkRFWFRZUEUpT01YX0luZGV4Q29uZmlnQ29tbW9uUm90YXRlLCAmY29uZmlnLCBzaXplb2YoY29uZmlnKSk7CisKKyAgICAgICAgQUxPR0QoIkFwcGx5aW5nIGVuY29kZXItcm90YXRpb249WyVkXSB0byB2aWRlbyBlbmNvZGVyLiIsIGNvbmZpZy5uUm90YXRpb24pOworICAgICAgICBpZiAoZXJyICE9IE9LKSB7CisgICAgICAgICAgICBBTE9HVygiRmFpbGVkIHRvIHNldENvbmZpZyBvZiBPTVhfSW5kZXhDb25maWdDb21tb25Sb3RhdGUoZXJyICVkKSIsIGVycik7CisgICAgICAgIH0KKyAgICB9CisKICAgICByZXR1cm4gZXJyOwogfQogCkBAIC00NzU3LDE1ICs0ODU4LDE1IEBACiAgICAgICAgIHVuc2lnbmVkIGludCBudW1MYXllcnMgPSAwOwogICAgICAgICB1bnNpZ25lZCBpbnQgbnVtQkxheWVycyA9IDA7CiAgICAgICAgIGludCB0YWdzOwotICAgICAgICBjaGFyIGR1bW15OwotICAgICAgICBpZiAoc3NjYW5mKHRzU2NoZW1hLmNfc3RyKCksICJ3ZWJydGMudnA4LiV1LWxheWVyJWMiLCAmbnVtTGF5ZXJzLCAmZHVtbXkpID09IDEKKyAgICAgICAgY2hhciB0bXA7CisgICAgICAgIGlmIChzc2NhbmYodHNTY2hlbWEuY19zdHIoKSwgIndlYnJ0Yy52cDguJXUtbGF5ZXIlYyIsICZudW1MYXllcnMsICZ0bXApID09IDEKICAgICAgICAgICAgICAgICAmJiBudW1MYXllcnMgPiAwKSB7CiAgICAgICAgICAgICBwYXR0ZXJuID0gT01YX1ZJREVPX1ZQWFRlbXBvcmFsTGF5ZXJQYXR0ZXJuV2ViUlRDOwogICAgICAgICAgICAgdHNUeXBlID0gT01YX1ZJREVPX0FuZHJvaWRUZW1wb3JhbExheWVyaW5nUGF0dGVybldlYlJUQzsKICAgICAgICAgICAgIHRzTGF5ZXJzID0gbnVtTGF5ZXJzOwogICAgICAgICB9IGVsc2UgaWYgKCh0YWdzID0gc3NjYW5mKHRzU2NoZW1hLmNfc3RyKCksICJhbmRyb2lkLmdlbmVyaWMuJXUlYyV1JWMiLAotICAgICAgICAgICAgICAgICAgICAgICAgJm51bUxheWVycywgJmR1bW15LCAmbnVtQkxheWVycywgJmR1bW15KSkKLSAgICAgICAgICAgICAgICAmJiAodGFncyA9PSAxIHx8ICh0YWdzID09IDMgJiYgZHVtbXkgPT0gJysnKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICZudW1MYXllcnMsICZ0bXAsICZudW1CTGF5ZXJzLCAmdG1wKSkKKyAgICAgICAgICAgICAgICAmJiAodGFncyA9PSAxIHx8ICh0YWdzID09IDMgJiYgdG1wID09ICcrJykpCiAgICAgICAgICAgICAgICAgJiYgbnVtTGF5ZXJzID4gMCAmJiBudW1MYXllcnMgPCBVSU5UMzJfTUFYIC0gbnVtQkxheWVycykgewogICAgICAgICAgICAgcGF0dGVybiA9IE9NWF9WSURFT19WUFhUZW1wb3JhbExheWVyUGF0dGVybldlYlJUQzsKICAgICAgICAgICAgIC8vIFZQWCBkb2VzIG5vdCBoYXZlIGEgY29uY2VwdCBvZiBCLWZyYW1lcywgc28ganVzdCBjb3VudCBhbGwgbGF5ZXJzCkBAIC01NjE2LDE1ICs1NzE3LDE4IEBACiAgICAgaW50MzJfdCByYW5nZSwgc3RhbmRhcmQsIHRyYW5zZmVyOwogICAgIGNvbnZlcnRDb2RlY0NvbG9yQXNwZWN0c1RvUGxhdGZvcm1Bc3BlY3RzKGFzcGVjdHMsICZyYW5nZSwgJnN0YW5kYXJkLCAmdHJhbnNmZXIpOwogCisgICAgaW50MzJfdCBkc1JhbmdlLCBk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ICAgICAgICAgICAgICAgcmVzcG9uc2UtPnNldEludDMyKCJlcnIiLCBlcnIpOworICAgICAgICAgICAgICAgIHJlc3BvbnNlLT5wb3N0UmVwbHkocmVwbHlJRCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGVyciAhPSBPSykgeworICAgICAgICAgICAgICAgIG1Db2RlYy0+c2lnbmFsRXJyb3IoT01YX0Vycm9yVW5kZWZpbmVkLCBlcnIpOworICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KIApAQCAtNTg1MSw2ICs1OTU4LDIxIEBACiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogCisgICAgICAgIGNhc2Uga1doYXRTdWJtaXRFeHRyYU91dHB1dE1ldGFkYXRhQnVmZmVyOiB7CisgICAgICAgICAgICBtUGVuZGluZ0V4dHJhT3V0cHV0TWV0YWRhdGFCdWZmZXJSZXF1ZXN0ID0gZmFsc2U7CisgICAgICAgICAgICBpZiAoZ2V0UG9ydE1vZGUoa1BvcnRJbmRleE91dHB1dCkgPT0gUkVTVUJNSVRfQlVGRkVSUyAmJiBtQ29kZWMtPm1Jc0xvd0xhdGVuY3kpIHsKKyAgICAgICAgICAgICAgICAvLyBEZWNvZGVycyBvZnRlbiBuZWVkIG1vcmUgdGhhbiBvbmUgb3V0cHV0IGJ1ZmZlciB0byBiZQorICAgICAgICAgICAgICAgIC8vIHN1Ym1pdHRlZCBiZWZvcmUgcHJvY2Vzc2luZyBhIHNpbmdsZSBpbnB1dCBidWZmZXIuCisgICAgICAgICAgICAgICAgLy8gRm9yIGxvdyBsYXRlbmN5IGNvZGVjcywgd2UgZG9uJ3Qgd2FudCB0byB3YWl0IGZvciBtb3JlIGlucHV0CisgICAgICAgICAgICAgICAgLy8gdG8gYmUgcXVldWVkIHRvIGdldCB0aG9zZSBvdXRwdXQgYnVmZmVycyBzdWJtaXR0ZWQuCisgICAgICAgICAgICAgICAgaWYgKG1Db2RlYy0+c3VibWl0T3V0cHV0TWV0YWRhdGFCdWZmZXIoKSA9PSBPSworICAgICAgICAgICAgICAgICAgICAgICAgJiYgbUNvZGVjLT5tTWV0YWRhdGFCdWZmZXJzVG9TdWJtaXQgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIG1heWJlUG9zdEV4dHJhT3V0cHV0TWV0YWRhdGFCdWZmZXJSZXF1ZXN0KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKwogICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KQEAgLTYwMDIsNiArNjEyNCwxMiBAQAogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCisgICAgaWYgKG1Db2RlYy0+bUlzU3RyZWFtQ29ycnVwdEZyZWUgJiYgZGF0YTEgPT0gKE9NWF9VMzIpT01YX0Vycm9yU3RyZWFtQ29ycnVwdCkgeworICAgICAgICBBTE9HVigiWyVzXSBoYW5kbGUgT01YX0Vycm9yU3RyZWFtQ29ycnVwdCBhcyBhIG5vcm1hbCBvcGVyYXRpb24iLAorICAgICAgICAgICAgICAgIG1Db2RlYy0+bUNvbXBvbmVudE5hbWUuY19zdHIoKSk7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKwogICAgIEFMT0dFKCJbJXNdIEVSUk9SKDB4JTA4eCkiLCBtQ29kZWMtPm1Db21wb25lbnROYW1lLmNfc3RyKCksIGRhdGExKTsKIAogICAgIC8vIHZlcmlmeSBPTVggY29tcG9uZW50IHNlbmRzIGJhY2sgYW4gZXJyb3Igd2UgZXhwZWN0LgpAQCAtNjEwOSw2ICs2MjM3LDEzIEBACiAgICAgICAgIHJldHVybjsKICAgICB9CiAKKyAgICBpbnQzMl90IGN2bzsKKyAgICBpZiAobUNvZGVjLT5tTmF0aXZlV2luZG93ICE9IE5VTEwgJiYgYnVmZmVyICE9IE5VTEwgJiYKKyAgICAgICAgICAgIGJ1ZmZlci0+bWV0YSgpLT5maW5kSW50MzIoImN2byIsICZjdm8pKSB7CisgICAgICAgIEFMT0dWKCJjdm8oJWQpIGZvdW5kIGluIGJ1ZmZlciAjJXUiLCBjdm8sIGJ1ZmZlcklEKTsKKyAgICAgICAgc2V0TmF0aXZlV2luZG93Um90YXRpb24obUNvZGVjLT5tTmF0aXZlV2luZG93LmdldCgpLCBjdm8pOworICAgIH0KKwogICAgIGluZm8tPm1TdGF0dXMgPSBCdWZmZXJJbmZvOjpPV05FRF9CWV9VUzsKICAgICBpbmZvLT5tRGF0YSA9IGJ1ZmZlcjsKIApAQCAtNjIwNyw3ICs2MzQyLDEyIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG91dHB1dE1vZGUgPT0gRlJFRV9CVUZGRVJTID8gIkZSRUUiIDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0TW9kZSA9PSBLRUVQX0JVRkZFUlMgPyAiS0VFUCIgOiAiUkVTVUJNSVQiKSk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChvdXRwdXRNb2RlID09IFJFU1VCTUlUX0JVRkZFUlMpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1Db2RlYy0+c3VibWl0T3V0cHV0TWV0YWRhdGFCdWZmZXIoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1c190IGVyciA9IG1Db2RlYy0+c3VibWl0T3V0cHV0TWV0YWRhdGFCdWZmZXIoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtQ29kZWMtPm1Jc0xvd0xhdGVuY3kKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgZXJyID09IE9LCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIG1Db2RlYy0+bU1ldGFkYXRhQnVmZmVyc1RvU3VibWl0ID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heWJlUG9zdEV4dHJhT3V0cHV0TWV0YWRhdGF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90IGR1bW15OwotICAgIGlmIChwYXJhbXMtPmZpbmRJbnQzMigicmVxdWVzdC1zeW5jIiwgJmR1bW15KSkgeworICAgIGludDMyX3QgdG1wOworICAgIGlmIChwYXJhbXMtPmZpbmRJbnQzMigicmVxdWVzdC1zeW5jIiwgJnRtcCkpIHsKICAgICAgICAgc3RhdHVzX3QgZXJyID0gcmVxdWVzdElEUkZyYW1lKCk7CiAKICAgICAgICAgaWYgKGVyciAhPSBPSykgewpAQCAtNzc4Myw2ICs3OTI3LDE1IEBACiAgICAgICAgICAgICAgICAgJnByZXNlbnRhdGlvbiwgc2l6ZW9mKHByZXNlbnRhdGlvbikpOwogICAgICAgICB9CiAgICAgfQorCisgICAgaW50MzJfdCB0dW5uZWxQZWVrID0gMDsKKyAgICBpZiAocGFyYW1zLT5maW5kSW50MzIoVFVOTkVMX1BFRUtfS0VZLCAmdHVubmVsUGVlaykpIHsKKyAgICAgICAgc3RhdHVzX3QgZXJyID0gc2V0VHVubmVsUGVlayh0dW5uZWxQZWVrKTsKKyAgICAgICAgaWYgKGVyciAhPSBPSykgeworICAgICAgICAgICAgcmV0dXJuIGVycjsKKyAgICAgICAgfQorICAgIH0KKwogICAgIHJldHVybiBzZXRWZW5kb3JQYXJhbWV0ZXJzKHBhcmFtcyk7CiB9CiAKQEAgLTgyNDgsNiArODQwMSwxMiBAQAogICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0KIAorICAgICAgICBjYXNlIE9NWF9FdmVudE9uRmlyc3RUdW5uZWxGcmFtZVJlYWR5OgorICAgICAgICB7CisgICAgICAgICAgICBtQ29kZWMtPm9uRmlyc3RUdW5uZWxGcmFtZVJlYWR5KCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCiAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICByZXR1cm4gQmFzZVN0YXRlOjpvbk9NWEV2ZW50KGV2ZW50LCBkYXRhMSwgZGF0YTIpOwogICAgIH0KQEAgLTgyODYsMTcgKzg0NDUsMzggQEAKICAgICAgICAgICAgIEZBTExUSFJPVUdIX0lOVEVOREVEOwogICAgICAgICB9CiAgICAgICAgIGNhc2Uga1doYXRSZXN1bWU6Ci0gICAgICAgIGNhc2Uga1doYXRTZXRQYXJhbWV0ZXJzOgogICAgICAgICB7Ci0gICAgICAgICAgICBpZiAobXNnLT53aGF0KCkgPT0ga1doYXRSZXN1bWUpIHsKLSAgICAgICAgICAgICAgICBBTE9HVigiWyVzXSBEZWZlcnJpbmcgcmVzdW1lIiwgbUNvZGVjLT5tQ29tcG9uZW50TmFtZS5jX3N0cigpKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFMT0dWKCJbJXNdIERlZmVycmluZyByZXN1bWUiLCBtQ29kZWMtPm1Db21wb25lbnROYW1lLmNfc3RyKCkpOwogCiAgICAgICAgICAgICBtQ29kZWMtPmRlZmVyTWVzc2FnZShtc2cpOwogICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogCisgICAgICAgIGNhc2Uga1doYXRTZXRQYXJhbWV0ZXJzOgorICAgICAgICB7CisgICAgICAgICAgICBzcDxBTWVzc2FnZT4gcGFyYW1zOworICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kTWVzc2FnZSgicGFyYW1zIiwgJnBhcmFtcykpOworCisgICAgICAgICAgICBzcDxBQnVmZmVyPiBoZHIxMFBsdXNJbmZvOworICAgICAgICAgICAgaWYgKHBhcmFtcy0+ZmluZEJ1ZmZlcigiaGRyMTAtcGx1cy1pbmZvIiwgJmhkcjEwUGx1c0luZm8pKSB7CisgICAgICAgICAgICAgICAgaWYgKGhkcjEwUGx1c0luZm8gIT0gbnVsbHB0ciAmJiBoZHIxMFBsdXNJbmZvLT5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICh2b2lkKW1Db2RlYy0+c2V0SGRyMTBQbHVzSW5mbyhoZHIxMFBsdXNJbmZvKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcGFyYW1zLT5yZW1vdmVFbnRyeUF0KHBhcmFtcy0+ZmluZEVudHJ5QnlOYW1lKCJoZHIxMC1wbHVzLWluZm8iKSk7CisKKyAgICAgICAgICAgICAgICBpZiAocGFyYW1zLT5jb3VudEVudHJpZXMoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIG1zZy0+cmVtb3ZlRW50cnlBdChtc2ctPmZpbmRFbnRyeUJ5TmFtZSgicGFyYW1zIikpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG1zZy0+Y291bnRFbnRyaWVzKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgbUNvZGVjLT5kZWZlck1lc3NhZ2UobXNnKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGhhbmRsZWQgPSB0cnVlOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKwogICAgICAgICBjYXNlIGtXaGF0Rm9yY2VTdGF0ZVRyYW5zaXRpb246CiAgICAgICAgIHsKICAgICAgICAgICAgIGludDMyX3QgZ2VuZXJhdGlvbiA9IDA7CkBAIC04MzA3LDYgKzg0ODcsMjMgQEAKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CiAKKyAgICAgICAgY2FzZSBrV2hhdFNldFN1cmZhY2U6CisgICAgICAgIHsKKyAgICAgICAgICAgIEFMT0dWKCJbJXNdIERlZmVycmluZyBzZXRTdXJmYWNlIiwgbUNvZGVjLT5tQ29tcG9uZW50TmFtZS5jX3N0cigpKTsKKworICAgICAgICAgICAgc3A8QVJlcGx5VG9rZW4+IHJlcGx5SUQ7CisgICAgICAgICAgICBDSEVDSyhtc2ctPnNlbmRlckF3YWl0c1Jlc3BvbnNlKCZyZXBseUlEKSk7CisKKyAgICAgICAgICAgIG1Db2RlYy0+ZGVmZXJNZXNzYWdlKG1zZyk7CisKKyAgICAgICAgICAgIHNwPEFNZXNzYWdlPiByZXNwb25zZSA9IG5ldyBBTWVzc2FnZTsKKyAgICAgICAgICAgIHJlc3BvbnNlLT5zZXRJbnQzMigiZXJyIiwgT0spOworICAgICAgICAgICAgcmVzcG9uc2UtPnBvc3RSZXBseShyZXBseUlEKTsKKworICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCiAgICAgICAgIGNhc2Uga1doYXRDaGVja0lmU3R1Y2s6CiAgICAgICAgIHsKICAgICAgICAgICAgIGludDMyX3QgZ2VuZXJhdGlvbiA9IDA7CkBAIC04NDA3LDYgKzg2MDQsMTUgQEAKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQogCisgICAgICAgIGNhc2UgT01YX0V2ZW50Q29uZmlnVXBkYXRlOgorICAgICAgICB7CisgICAgICAgICAgICBDSEVDS19FUShkYXRhMSwgKE9NWF9VMzIpa1BvcnRJbmRleE91dHB1dCk7CisKKyAgICAgICAgICAgIG1Db2RlYy0+b25Db25maWdVcGRhdGUoKE9NWF9JTkRFWFRZUEUpZGF0YTIpOworCisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCiAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICByZXR1cm4gQmFzZVN0YXRlOjpvbk9NWEV2ZW50KGV2ZW50LCBkYXRhMSwgZGF0YTIpOwogICAgIH0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L0FuZHJvaWQuYnAgYi9tZWRpYS9saWJzdGFnZWZyaWdodC9BbmRyb2lkLmJwCmluZGV4IDNiY2NiN2IuLmEwNTJhNzAgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L0FuZHJvaWQuYnAKKysrIGIvbWVkaWEvbGlic3RhZ2VmcmlnaHQvQW5kcm9pZC5icApAQCAtMSwzICsxLDIwIEBACitwYWNrYWdlIHs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X3N1cHBvcnRlZDogdHJ1ZSwKKyAgICB0YXJnZXQ6IHsKKyAgICAgICAgZGFyd2luOiB7CisgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSwKKyAgICAgICAgfSwKKyAgICB9LAogfQogCiBjY19saWJyYXJ5X3N0YXRpYyB7CkBAIC01OCw5ICs4NywxOCBAQAogICAgIH0sCiAKICAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGliYXVkaW9jbGllbnRfaGVhZGVycyIsCiAgICAgICAgICJsaWJzdGFnZWZyaWdodF9mb3VuZGF0aW9uX2hlYWRlcnMiLAorICAgICAgICAibWVkaWFfbmRrX2hlYWRlcnMiLAogICAgIF0sCi0gICAgc2hhcmVkX2xpYnM6IFsibGlibWVkaWFuZGsiXSwKKworICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIHRhcmdldDogeworICAgICAgICBkYXJ3aW46IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgIH0sCisKICAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUiXSwKIH0KIApAQCAtMTMyLDggKzE3MCwxMCBAQAogCiAgICAgaGVhZGVyX2xpYnM6IFsKICAgICAgICAgImxpYmF1ZGlvY2xpZW50X2hlYWRlcnMiLAotICAgICAgICAibGlibWVkaWFfaGVhZGVycyIsCisgICAgICAgICJsaWJiYXNlX2hlYWRlcnMiLAorICAgICAgICAibGlibWVkaWFfZGF0YXNvdXJjZV9oZWFkZXJzIiwKICAgICAgICAgIm1lZGlhX25ka19oZWFkZXJzIiwKKyAgICAgICAgIm1lZGlhX3BsdWdpbl9oZWFkZXJzIiwKICAgICBdLAogCiAgICAgY2ZsYWdzOiBbCkBAIC0xNTAsNiArMTkwLDE4IEBACiAgICAgICAgICAgICAic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAogICAgICAgICBdLAogICAgIH0sCisKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKyAgICB0YXJnZXQ6IHsKKyAgICAgICAgZGFyd2luOiB7CisgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSwKKyAgICAgICAgfSwKKyAgICAgICAgbGludXg6IHsKKyAgICAgICAgICAgIGNmbGFnczogWworICAgICAgICAgICAgICAgICItRERJU0FCTEVfQVVESU9fU1lTVEVNX09GRkxPQUQiLAorICAgICAgICAgICAgXSwKKyAgICAgICAgfQorICAgIH0sCiB9CiAKIGNjX2xpYnJhcnlfc2hhcmVkIHsKQEAgLTE3Niw3ICsyMjgsNyBAQAogICAgIF0sCiAKICAgICBzdGF0aWNfbGliczogWwotICAgICAgICAibGlicmVuZGVyZW5naW5lIiwKKyAgICAgICAgImxpYnJlbmRlcmZyaWdodCIsCiAgICAgXSwKIAogICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsKQEAgLTIyMiw2ICsyNzQsNyBAQAogICAgICAgICAiTVBFRzJUU1dyaXRlci5jcHAiLAogICAgICAgICAiTVBFRzRXcml0ZXIuY3BwIiwKICAgICAgICAgIk1lZGlhQWRhcHRlci5jcHAiLAorICAgICAgICAiTWVkaWFBcHBlbmRlci5jcHAiLAogICAgICAgICAiTWVkaWFDbG9jay5jcHAiLAogICAgICAgICAiTWVkaWFDb2RlYy5jcHAiLAogICAgICAgICAiTWVkaWFDb2RlY0xpc3QuY3BwIiwKQEAgLTI4NSw2ICszMzgsOCBAQAogICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5jYXMubmF0aXZlQDEuMCIsCiAgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmRybUAxLjAiLAogICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5tZWRpYS5vbXhAMS4wIiwKKyAgICAgICAgImZyYW1ld29yay1wZXJtaXNzaW9uLWFpZGwtY3BwIiwKKyAgICAgICAgImxpYmF1ZGlvY2xpZW50X2FpZGxfY29udmVyc2lvbiIsCiAgICAgXSwKIAogICAgIHN0YXRpY19saWJzOiBbCkBAIC0y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KTsKIAotICAgICAgICAvLyBtYWtlIHN1cmUgdGhhdCB0aGUgQXVkaW9SZWNvcmQgdG90YWwgYnVmZmVyIHNpemUgaXMgbGFyZ2UgZW5vdWdoCi0gICAgICAgIHNpemVfdCBidWZDb3VudCA9IDI7Ci0gICAgICAgIHdoaWxlICgoYnVmQ291bnQgKiBmcmFtZUNvdW50KSA8IG1pbkZyYW1lQ291bnQpIHsKLSAgICAgICAgICAgIGJ1ZkNvdW50Kys7Ci0gICAgICAgIH0KKyAgc2l6ZV90IG1pbkZyYW1lQ291bnQ7CisgIHN0YXR1c190IHN0YXR1cyA9IEF1ZGlvUmVjb3JkOjpnZXRNaW5GcmFtZUNvdW50KCZtaW5GcmFtZUNvdW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGVSYXRlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19GT1JNQVRfUENNXzE2X0JJVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fY2hhbm5lbF9pbl9tYXNrX2Zyb21fY291bnQoY2hhbm5lbENvdW50KSk7CisgIGlmIChzdGF0dXMgPT0gT0spIHsKKyAgICAvLyBtYWtlIHN1cmUgdGhhdCB0aGUgQXVkaW9SZWNvcmQgY2FsbGJhY2sgbmV2ZXIgcmV0dXJucyBtb3JlIHRoYW4gdGhlIG1heGltdW0KKyAgICAvLyBidWZmZXIgc2l6ZQorICAgIHVpbnQzMl90IGZyYW1lQ291bnQgPSBrTWF4QnVmZmVyU2l6ZSAvIHNpemVvZihpbnQxNl90KSAvIGNoYW5uZWxDb3VudDsKIAotICAgICAgICBtUmVjb3JkID0gbmV3IEF1ZGlvUmVjb3JkKAotICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgc2FtcGxlUmF0ZSwgQVVESU9fRk9STUFUX1BDTV8xNl9CSVQsCi0gICAgICAgICAgICAgICAgICAgIGF1ZGlvX2NoYW5uZWxfaW5fbWFza19mcm9tX2NvdW50KGNoYW5uZWxDb3VudCksCi0gICAgICAgICAgICAgICAgICAgIG9wUGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgIChzaXplX3QpIChidWZDb3VudCAqIGZyYW1lQ291bnQpLAotICAgICAgICAgICAgICAgICAgICBBdWRpb1JlY29yZENhbGxiYWNrRnVuY3Rpb24sCi0gICAgICAgICAgICAgICAgICAgIHRoaXMsCi0gICAgICAgICAgICAgICAgICAgIGZyYW1lQ291bnQgLypub3RpZmljYXRpb25GcmFtZXMqLywKLSAgICAgICAgICAgICAgICAgICAgQVVESU9fU0VTU0lPTl9BTExPQ0FURSwKLSAgICAgICAgICAgICAgICAgICAgQXVkaW9SZWNvcmQ6OlRSQU5TRkVSX0RFRkFVTFQsCi0gICAgICAgICAgICAgICAgICAgIEFVRElPX0lOUFVUX0ZMQUdfTk9ORSwKLSAgICAgICAgICAgICAgICAgICAgdWlkLAotICAgICAgICAgICAgICAgICAgICBwaWQsCi0gICAgICAgICAgICAgICAgICAgIGF0dHIsCi0gICAgICAgICAgICAgICAgICAgIHNlbGVjdGVkRGV2aWNlSWQsCi0gICAgICAgICAgICAgICAgICAgIHNlbGVjdGVkTWljRGlyZWN0aW9uLAotICAgICAgICAgICAgICAgICAgICBzZWxlY3RlZE1pY0ZpZWxkRGltZW5zaW9uKTsKLSAgICAgICAgLy8gU2V0IGNhbGxlciBuYW1lIHNvIGl0IGNhbiBiZSBsb2dnZWQgaW4gZGVzdHJ1Y3Rvci4KLSAgICAgICAgLy8gTWVkaWFNZXRyaWNzQ29uc3RhbnRzLmg6IEFNRURJQU1FVFJJQ1NfUFJPUF9DQUxMRVJOQU1FX1ZBTFVFX01FRElBCi0gICAgICAgIG1SZWNvcmQtPnNldENhbGxlck5hbWUoIm1lZGlhIik7Ci0gICAgICAgIG1Jbml0Q2hlY2sgPSBtUmVjb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UZsYWdzICY9IH5GTEFHU19IT1RfQ0FNRVJBOwogICAgIH0gZWxzZSB7CkBAIC01MzEsMTUgKzQzNiwxMyBAQAogICAgICAgICB1aWRfdCBjbGllbnRVaWQsCiAgICAgICAgIHBpZF90IGNsaWVudFBpZCwKICAgICAgICAgU2l6ZSB2aWRlb1NpemUsCi0gICAgICAgIGludDMyX3QgZnJhbWVSYXRlLAotICAgICAgICBib29sIHN0b3JlTWV0YURhdGFJblZpZGVvQnVmZmVycykgeworICAgICAgICBpbnQzMl90IGZyYW1lUmF0ZSkgewogCiAgICAgQUxPR1YoImluaXQiKTsKICAgICBzdGF0dXNfdCBlcnIgPSBPSzsKICAgICBpbnQ2NF90IHRva2VuID0gSVBDVGhyZWFkU3RhdGU6OnNlbGYoKS0+Y2xlYXJDYWxsaW5nSWRlbnRpdHkoKTsKICAgICBlcnIgPSBpbml0V2l0aENhbWVyYUFjY2VzcyhjYW1lcmEsIHByb3h5LCBjYW1lcmFJZCwgY2xpZW50TmFtZSwgY2xpZW50VWlkLCBjbGllbnRQaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW9TaXplLCBmcmFtZVJhdGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmVNZXRhRGF0YUluVmlkZW9CdWZmZXJzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlb1NpemUsIGZyYW1lUmF0ZSk7CiAgICAgSVBDVGhyZWFkU3RhdGU6OnNlbGYoKS0+cmVzdG9yZUNhbGxpbmdJZGVudGl0eSh0b2tlbik7CiAgICAgcmV0dXJuIGVycjsKIH0KQEAgLTYyNiw4ICs1MjksNyBAQAogICAgICAgICB1aWRfdCBjbGllbnRVaWQsCiAgICAgICAgIHBpZF90IGNsaWVudFBpZCwKICAgICAgICAgU2l6ZSB2aWRlb1NpemUsCi0gICAgICAgIGludDMyX3QgZnJhbWVSYXRlLAotICAgICAgICBib29sIHN0b3JlTWV0YURhdGF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ELCBpZ25vcmluZyByZWxlYXNlIChnb3QgJXgsIGV4cGVjdGVkICV4KSIsCi0JCSAgICAgX19GVU5DVElPTl9fLCBoZWFwLT5nZXRIZWFwSUQoKSwgbU1lbW9yeUhlYXBCYXNlLT5nZXRIZWFwSUQoKSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdWludDMyX3QgYmF0Y2hTaXplID0gMDsKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBNdXRleDo6QXV0b2xvY2sgYXV0b0xvY2sobUJhdGNoTG9jayk7Ci0gICAgICAgICAgICAgICAgaWYgKG1JbmZsaWdodEJhdGNoU2l6ZXMuc2l6ZSgpID4gMCkgewotICAgICAgICAgICAgICAgICAgICBiYXRjaFNpemUgPSBtSW5mbGlnaHRCYXRjaFNpemVzWzBdOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChiYXRjaFNpemUgPT0gMCkgeyAvLyByZXR1cm4gYnVmZmVycyBvbmUgYnkgb25lCi0gICAgICAgICAgICAgICAgLy8gRnJhbWUgY29udGFpbnMgYSBWaWRlb05hdGl2ZUhhbmRsZU1ldGFkYXRhLiBTZW5kIHRoZSBoYW5kbGUgYmFjayB0byBjYW1lcmEuCi0gICAgICAgICAgICAgICAgcmVsZWFzZVJlY29yZGluZ0ZyYW1lSGFuZGxlKGhhbmRsZSk7Ci0gICAgICAgICAgICAgICAgbU1lbW9yeUJhc2VzLnB1c2hfYmFjayhmcmFtZSk7Ci0gICAgICAgICAgICAgICAgbU1lbW9yeUJhc2VBdmFpbGFibGVDb25kLnNpZ25hbCgpOwotICAgICAgICAgICAgfSBlbHNlIHsgLy8gR3JvdXAgYnVmZmVycyBpbiBiYXRjaCB0aGVuIHJldHVybgotICAgICAgICAgICAgICAgIE11dGV4OjpBdXRvbG9jayBhdXRvTG9jayhtQmF0Y2hMb2NrKTsKLSAgICAgICAgICAgICAg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2h0LCAmc2FySGVpZ2h0KQogICAgICAgICAgICAgJiYgc2FySGVpZ2h0ICE9IDApIHsKKyAgICAgICAgaW50MzJfdCBtdWx0VmFsOworICAgICAgICBpZiAod2lkdGggPCAwIHx8IHNhcldpZHRoIDwgMCB8fAorICAgICAgICAgICAgX19idWlsdGluX211bF9vdmVyZmxvdyh3aWR0aCwgc2FyV2lkdGgsICZtdWx0VmFsKSkgeworICAgICAgICAgICAgQUxPR0UoImRpc3BsYXlXaWR0aCBvdmVyZmxvdyAlZHglZCIsIHdpZHRoLCBzYXJXaWR0aCk7CisgICAgICAgICAgICByZXR1cm4gTlVMTDsKKyAgICAgICAgfQogICAgICAgICBkaXNwbGF5V2lkdGggPSAod2lkdGggKiBzYXJXaWR0aCkgLyBzYXJIZWlnaHQ7CiAgICAgICAgIGRpc3BsYXlIZWlnaHQgPSBoZWlnaHQ7CiAgICAgfSBlbHNlIGlmICh0cmFja01ldGEtPmZpbmRJbnQzMihrS2V5RGlzcGxheVdpZHRoLCAmZGlzcGxheVdpZHRoKQpAQCAtODYsNiArOTMsMTYgQEAKICAgICAgICAgcm90YXRpb25BbmdsZSA9IDA7CiAgICAgfQogCisgICAgaWYgKCFtZXRhT25seSkgeworICAgICAgICBpbnQzMl90IG11bHRWYWw7CisgICAgICAgIGlmICh3aWR0aCA8IDAgfHwgaGVpZ2h0IDwgMCB8fCBkc3RCcHAgPCAwIHx8CisgICAgICAgICAgICBfX2J1aWx0aW5fbXVsX292ZXJmbG93KGRzdEJwcCwgd2lkdGgsICZtdWx0VmFsKSB8fAorICAgICAgICAgICAgX19idWlsdGluX211bF9vdmVyZmxvdyhtdWx0VmFsLCBoZWlnaHQsICZtdWx0VmFsKSkgeworICAgICAgICAgICAgQUxPR0UoIkZyYW1lIHNpemUgb3ZlcmZsb3cgJWR4JWQgYnBwICVkIiwgd2lkdGgsIGhlaWdodCwgZHN0QnBwKTsKKyAgICAgICAgICAgIHJldHVybiBOVUxMOworICAgICAgICB9CisgICAg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AgICAgYm9vbCBzdWJMYXllckxldmVsUHJlc2VudEZsYWdbOF07CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbWF4U3ViTGF5ZXJzTWludXMxOyArK2kpIHsKKyAgICAgICAgICAgIHN1YkxheWVyUHJvZmlsZVByZXNlbnRGbGFnW2ldID0gcmVhZGVyLmdldEJpdHNXaXRoRmFsbGJhY2soMSwgMCk7CisgICAgICAgICAgICBzdWJMYXllckxldmVsUHJlc2VudEZsYWdbaV0gPSByZWFkZXIuZ2V0Qml0c1dpdGhGYWxsYmFjaygxLCAwKTsKKyAgICAgICAgfQorICAgICAgICAvLyBTa2lwIHJlc2VydmVkCisgICAgICAgIHJlYWRlci5za2lwQml0cygyICogKDggLSBtYXhTdWJMYXllcnNNaW51czEpKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtYXhTdWJMYXllcnNNaW51czE7ICsraSkgeworICAgICAgICAgICAgaWYgKHN1YkxheWVyUHJvZmlsZVByZXNlbnRGbGFnW2ldKSB7CisgICAgICAgICAgICAgICAgLy8gU2tpcCBwcm9maWxlCisgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBCaXRzKDg4KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChzdWJMYXllckxldmVsUHJlc2VudEZsYWdbaV0pIHsKKyAgICAgICAgICAgICAgICAvLyBTa2lwIHN1Yl9sYXllcl9sZXZlbF9pZGNbaV0KKyAgICAgICAgICAgICAgICByZWFkZXIuc2tpcEJpdHMoOCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgLy8gU2tpcCBzcHNfc2VxX3BhcmFtZXRlcl9zZXRfaWQKKyAgICBza2lwVUUoJnJlYWRlcik7CisgICAgdWludDhfdCBjaHJvbWFGb3JtYXRJZGMgPSBwYXJzZVVFV2l0aEZhbGxiYWNrKCZyZWFkZXIsIDApOworICAgIGlmIChjaHJvbWFGb3JtYXRJZGMgPT0gMykgeworICAgICAgICAvLyBTa2lwIHNlcGFyYXRlX2NvbG91cl9wbGFuZV9mbGFnCisgICAgICAgIHJlYWRlci5za2lwQml0cygxKTsKKyAgICB9CisgICAgc2tpcFVFKCZyZWFkZXIpOworICAgIHNraXBVRSgmcmVhZGVyKTsKKworICAgIC8vIHBpY193aWR0aF9pbl9sdW1hX3NhbXBsZXMKKyAgICAqd2lkdGggPSBwYXJzZVVFV2l0aEZhbGxiYWNrKCZyZWFkZXIsIDApOworICAgIC8vIHBpY19oZWlnaHRfaW5fbHVtYV9zYW1wbGVzCisgICAgKmhlaWdodCA9IHBhcnNlVUVXaXRoRmFsbGJhY2soJnJlYWRlciwgMCk7Cit9CisKIHN0YXR1c190IEhldmNQYXJhbWV0ZXJTZXRzOjpwYXJzZVBwcygKLSAgICAgICAgY29uc3QgdWludDhfdCogZGF0YSBfX3VudXNlZCwgc2l6ZV90IHNpemUgX191bnVzZWQpIHsKKyAgICAgICAgY29uc3QgdWludDhfdCogZGF0YSBVTlVTRURfUEFSQU0sIHNpemVfdCBzaXplIFVOVVNFRF9QQVJBTSkgewogICAgIHJldHVybiBPSzsKIH0KIApAQCAtNDg5LDQgKzU0MiwyNiBAQAogICAgIHJldHVybiBPSzsKIH0KIAorYm9vbCBIZXZjUGFyYW1ldGVyU2V0czo6SXNIZXZjSURSKGNvbnN0IHVpbnQ4X3QgKmRhdGEsIHNpemVfdCBzaXplKSB7CisgICAgYm9vbCBmb3VuZElEUiA9IGZhbHNlOworICAgIGNvbnN0IHVpbnQ4X3QgKm5hbFN0YXJ0OworICAgIHNpemVfdCBuYWxTaXplOworICAgIHdoaWxlICghZm91bmRJRFIgJiYgZ2V0TmV4dE5BTFVuaXQoJmRhdGEsICZzaXplLCAmbmFsU3RhcnQsICZuYWxTaXplLCB0cnVlKSA9PSBPSykgeworICAgICAgICBpZiAobmFsU2l6ZSA9PSAwKSB7CisgICAgICAgICAgICBBTE9HRSgiRW5jb3VudGVyZWQgemVyby1sZW5ndGggSEVWQyBOQUw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cm9tIGNvbnRyb2wgbG9vcGVyIHRocmVhZCBzaG91bGRuJ3Qgd2FpdCBmb3IgYW55IHJlc2V0IGluCisgICAgICAgICAqIHByb2Nlc3MgYWxyZWFkeS4KKyAgICAgICAgICovCisgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKKyAgICB9CisKKyAgICBpZiAobVJlc2V0U3RhdHVzICE9IE9LKSB7CisgICAgICAgIC8qIERvbid0IGhhdmUgdG8gcHJvY2VlZCBpZiByZXNldCBoYXMgZmluaXNoZWQgd2l0aCBhbiBlcnJvciBiZWZvcmUuCisgICAgICAgICAqIElmIHRoZXJlIHdhcyBubyBlcnJvciBiZWZvcmUsIHByb2NlZWRpbmcgcmVzZXQgd291bGQgYmUgaGFybWxlc3MsIGFzIHRoZQorICAgICAgICAgKiB0aGUgY2FsbCB3b3VsZCByZXR1cm4gZnJvbSB0aGUgbUluaXRDaGVjayBjb25kaXRpb24gYmVsb3cuCisgICAgICAgICAqLworICAgICAgICByZXR1cm4gbVJlc2V0U3RhdHVzOworICAgIH0KKwogICAgIGlmIChtSW5pdENoZWNrICE9IE9LKSB7Ci0gICAgICAgIHJldHVybiBPSzsKKyAgICAgICAgbVJlc2V0U3RhdHVzID0gT0s7CisgICAgICAgIHJldHVybiBtUmVzZXRTdGF0dXM7CiAgICAgfSBlbHNlIHsKICAgICAgICAgaWYgKCFtV3JpdGVyVGhyZWFkU3RhcnRlZCB8fAogICAgICAgICAgICAgIW1TdGFydGVkKSB7CkBAIC0xMTk4LDcgKzEyNjQsOCBAQAogICAgICAgICAgICAgaWYgKHdyaXRlckVyciAhPSBPSykgewogICAgICAgICAgICAgICAgIHJldEVyciA9IHdyaXRlckVycjsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiByZXRFcnI7CisgICAgICAgICAgICBtUmVzZXRTdGF0dXMgPSByZXRFcnI7CisgICAgICAgICAgICByZXR1cm4gbVJlc2V0U3RhdHVzOwogICAgICAgICB9CiAgICAgf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AgIH0gZWxzZSB7CisgICAgICAgICAgICBlcnIgPSBtTG9vcGVyLT5zdGFydCgpOworICAgICAgICB9CiAgICAgICAgIG1SZWZsZWN0b3IgPSBuZXcgQUhhbmRsZXJSZWZsZWN0b3I8TVBFRzRXcml0ZXI+KHRoaXMpOwogICAgICAgICBtTG9vcGVyLT5yZWdpc3RlckhhbmRsZXIobVJlZmxlY3Rvcik7CiAgICAgfQpAQCAtMjQ1NCwzMSArMjU1NSwyNyBAQAogICAgICAgICAgICAgaW50IGZkID0gbU5leHRGZDsKICAgICAgICAgICAgIG1OZXh0RmQgPSAtMTsKICAgICAgICAgICAgIG1Mb2NrLnVubG9jaygpOwotICAgICAgICAgICAgZmluaXNoQ3VycmVudFNlc3Npb24oKTsKLSAgICAgICAgICAgIGluaXRJbnRlcm5hbChmZCwgZmFsc2UgLyppc0ZpcnN0U2Vzc2lvbiovKTsKLSAgICAgICAgICAgIHN0YXJ0KG1TdGFydE1ldGEuZ2V0KCkpOwotICAgICAgICAgICAgbVN3aXRjaFBlbmRpbmcgPSBmYWxzZTsKLSAgICAgICAgICAgIG5vdGlmeShNRURJQV9SRUNPUkRFUl9FVkVOVF9JTkZPLCBNRURJQV9SRUNPUkRFUl9JTkZPX05FWFRfT1VUUFVUX0ZJTEVfU1RBUlRFRCwgMCk7CisgICAgICAgICAgICBpZiAoZmluaXNoQ3VycmVudFNlc3Npb24oKSA9PSBPSykgeworICAgICAgICAgICAgICAgIGluaXRJbnRlcm5hbChmZCwgZmFsc2UgLyppc0ZpcnN0U2Vzc2lvbiovKTsKKyAgICAgICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBzdGFydChtU3RhcnRNZXRhLmdldCgpKTsKKyAgICAgICAgICAgICAgICBtU3dpdGNoUGVuZGluZyA9IGZhbHNlOworICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gT0spICB7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeShNRURJQV9SRUNPUkRFUl9FVkVOVF9JTkZPLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgTUVESUFfUkVDT1JERVJfSU5GT19ORVhUX09VVFBVVF9GSUxFX1NUQVJURUQsIDApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9Ci0gICAgICAgIC8vIDo6d3JpdGUoKSBvciBsc2VlazY0KCkgd2Fzbid0IGEgc3VjY2VzcywgZmlsZSBjb3VsZCBiZSBtYWxmb3JtZWQKKyAgICAgICAgLyogOjp3cml0ZSgpIG9yIGxzZWVrNjQoKSB3YXNuJ3QgYSBzdWNjZXNzLCBmaWxlIGNvdWxkIGJlIG1hbGZvcm1lZC4KKyAgICAgICAgICogT3IgZmFsbG9jYXRlKCkgZmFpbGVkLiByZXNldCgpIGFuZCBub3RpZnkgY2xpZW50IG9uIGJvdGggdGhlIGNhc2VzLgorICAgICAgICAgKi8KKyAgICAgICAgY2FzZSBrV2hhdEZhbGxvY2F0ZUVycm9yOiAvLyBmYWxsdGhyb3VnaAogICAgICAgICBjYXNlIGtXaGF0SU9FcnJvcjogewotICAgICAgICAgICAgQUxPR0UoImtXaGF0SU9FcnJvciIpOwogICAgICAgICAgICAgaW50MzJfdCBlcnI7CiAgICAgICAgICAgICBDSEVDSyhtc2ctPmZpbmRJbnQzMigiZXJyIiwgJmVycikpOwotICAgICAgICAgICAgLy8gU3RvcCB0cmFja3MnIHRocmVhZHMgYW5kIG1haW4gd3JpdGVyIHRocmVhZC4KLSAgICAgICAgICAgIHN0b3AoKTsKLSAgICAgICAgICAgIG5vdGlmeShNRURJQV9SRUNPUkRFUl9FVkVOVF9FUlJPUiwgTUVESUFfUkVDT1JERVJfRVJST1JfVU5LTk9XTiwgZXJyKTsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0gICAgICAgIC8vIGZhbGxvY2F0ZSgpIGZhaWxlZCwgaGVuY2Ugc3RvcCgpIGFuZCBub3RpZnkgYXBwLgotICAgICA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SAoIW1Eb25lICYmIChlcnIgPSBtU291cmNlLT5yZWFkKCZidWZmZXIpKSA9PSBPSykgeworICAgICAgICBBTE9HVigicmVhZDpidWZmZXItPnJhbmdlX2xlbmd0aDolbGxkIiwgKGxvbmcgbG9uZylidWZmZXItPnJhbmdlX2xlbmd0aCgpKTsKICAgICAgICAgaW50MzJfdCBpc0VPUyA9IGZhbHNlOwogICAgICAgICBpZiAoYnVmZmVyLT5yYW5nZV9sZW5ndGgoKSA9PSAwKSB7CiAgICAgICAgICAgICBpZiAoYnVmZmVyLT5tZXRhX2RhdGEoKS5maW5kSW50MzIoa0tleUlzRW5kT2ZTdHJlYW0sICZpc0VPUykgJiYgaXNFT1MpIHsKQEAgLTM0MDUsNiArMzUxNSwxNCBAQAogICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgfQogICAgICAgICB9CisgICAgICAgIGlmICghYnVmZmVyLT5tZXRhX2RhdGEoKS5maW5kSW50NjQoa0tleVNhbXBsZUZpbGVPZmZzZXQsICZzYW1wbGVGaWxlT2Zmc2V0KSkgeworICAgICAgICAgICAgc2FtcGxlRmlsZU9mZnNldCA9IC0xOworICAgICAgICB9CisgICAgICAgIGludDY0X3QgbGFzdFNhbXBsZSA9IC0xOworICAgICAgICBpZiAoIWJ1ZmZlci0+bWV0YV9kYXRhKCkuZmluZEludDY0KGtLZXlMYXN0U2FtcGxlSW5kZXhJbkNodW5rLCAmbGFzdFNhbXBsZSkpIHsKKyAgICAgICAgICAgIGxhc3RTYW1wbGUgPSAtMTsKKyAgICAgICAgfQorICAgICAgICBBTE9HVigic2FtcGxlRmlsZU9mZnNldDolbGxkIiwgKGxvbmcgbG9uZylzYW1wbGVGaWxlT2Zmc2V0KTsKIAogICAgICAgICAvKgogICAgICAgICAgKiBSZXNlcnZlIHNwYWNlIGluIHRoZSBmaWxlIGZvciB0aGUgY3VycmVudCBzYW1wbGUgKyB0byBiZSB3cml0dGVuIE1PT1YgYm94LiBJZiByZXNlcn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AgICBpZiAobU93bmVyLT51c2VOYWxMZW5ndGhGb3VyKCkpIHsKKyAgICAgICAgICAgICAgICBBTE9HVigibmFsbGVuZ3RoNCIpOwogICAgICAgICAgICAgICAgIHNhbXBsZVNpemUgKz0gNDsKICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgQUxPR1YoIm5hbGxlbmd0aDIiKTsKICAgICAgICAgICAgICAgICBzYW1wbGVTaXplICs9IDI7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KQEAgLTM3MzUsNyArMzg2MCw4IEBACiAgICAgICAgICAgICAgICAgY2h1bmtUaW1lc3RhbXBVcyA9IHRpbWVzdGFtcFVzOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBpbnQ2NF90IGNodW5rRHVyYXRpb25VcyA9IHRpbWVzdGFtcFVzIC0gY2h1bmtUaW1lc3RhbXBVczsKLSAgICAgICAgICAgICAgICBpZiAoY2h1bmtEdXJhdGlvblVzID4gaW50ZXJsZWF2ZUR1cmF0aW9uVXMpIHsKKyAgICAgICAgICAgICAgICBpZiAoY2h1bmtEdXJhdGlvblVzID4gaW50ZXJsZWF2ZUR1cmF0aW9uVXMgfHwgbGFzdFNhbXBsZSA+IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoImxhc3RTYW1wbGU6JWxsZCIsIChsb25nIGxvbmcpbGFzdFNhbXBsZSk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChjaHVua0R1cmF0aW9uVXMgPiBtTWF4Q2h1bmtEdXJhdGlvblVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtTWF4Q2h1bmtEdXJhdGlvblVzID0gY2h1bmtEdXJhdGlvblVzOwogICAgICAgICAgICAgICAgICAgICB9CkBAIC0zOTcxLDYgKzQwOTcsMTAgQEAKICAgICByZXR1cm4gbUlzUmVhbFRpbWVSZWNvcmRpbmc7CiB9CiAKK2Jvb2wgTVBFRzRXcml0ZXI6OmlzQmFja2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dHMubVByaW1hcmllcykKKyAgICAgICAgICAgIHwgbWV0YS0+ZmluZEludDMyKGtLZXlUcmFuc2ZlckZ1bmN0aW9uLCAoaW50MzJfdCopJmFzcGVjdHMubVRyYW5zZmVyKQorICAgICAgICAgICAgfCBtZXRhLT5maW5kSW50MzIoa0tleUNvbG9yTWF0cml4LCAoaW50MzJfdCopJmFzcGVjdHMubU1hdHJpeENvZWZmcykKKyAgICAgICAgICAgIHwgbWV0YS0+ZmluZEludDMyKGtLZXlDb2xvclJhbmdlLCAoaW50MzJfdCopJmFzcGVjdHMubVJhbmdlKSkgewogICAgICAgICBpbnQzMl90IHByaW1hcmllcywgdHJhbnNmZXIsIGNvZWZmczsKICAgICAgICAgYm9vbCBmdWxsUmFuZ2U7CisgICAgICAgIEFMT0dWKCJwcmltYXJpZXM9JXMgdHJhbnNmZXI9JXMgbWF0cml4PSVzIHJhbmdlPSVzIiwKKyAgICAgICAgICAgICAgICBhc1N0cmluZyhhc3BlY3RzLm1QcmltYXJpZXMpLAorICAgICAgICAgICAgICAgIGFzU3RyaW5nKGFzcGVjdHMubVRyYW5zZmVyKSwKKyAgICAgICAgICAgICAgICBhc1N0cmluZyhhc3BlY3RzLm1NYXRyaXhDb2VmZnMpLAorICAgICAgICAgICAgICAgIGFzU3RyaW5nKGFzcGVjdHMubVJhbmdlKSk7CiAgICAgICAgIENvbG9yVXRpbHM6OmNvbnZlcnRDb2RlY0NvbG9yQXNwZWN0c1RvSXNvQXNwZWN0cygKICAgICAgICAgICAgICAgICBhc3BlY3RzLCAmcHJpbWFyaWVzLCAmdHJhbnNmZXIsICZjb2VmZnMsICZmdWxsUmFuZ2UpOwogICAgICAgICBtT3duZXItPmJlZ2luQm94KCJjb2xyIik7CkBAIC00MjMzLDYgKzQzNzAsOCBAQAogICAgICAgICBtT3duZXItPndyaXRlSW50MTYoY29lZmZzKTsKICAgICAgICAgbU93bmVyLT53cml0ZUludDgoaW50OF90KGZ1bGxSYW5nZSA/IDB4ODAgOiA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UuY19zdHIoKSwgInZpZGVvLyIsIDYpKSB7CisgICAgICAgICAgICAgICAgQUxPR1YoIlZpZGVvVHJhY2siKTsKKyAgICAgICAgICAgICAgICBpZiAodmlkZW9UcmFja0luZGV4ICE9IC0xKSB7CisgICAgICAgICAgICAgICAgICAgIEFMT0dFKCJOb3QgbW9yZSB0aGFuIG9uZSB2aWRlbyB0cmFjayBpcyBzdXBwb3J0ZWQiKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX1VOU1VQUE9SVEVEOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB2aWRlb1RyYWNrSW5kZXggPSBleFRyYWNrSW5kZXg7CisgICAgICAgICAgICB9IGVsc2UgaWYgKCFzdHJuY2FzZWNtcChtaW1lLmNfc3RyKCksICJhdWRpby8iLCA2KSkgeworICAgICAgICAgICAgICAgIEFMT0dWKCJBdWRpb1RyYWNrIik7CisgICAgICAgICAgICAgICAgaWYgKGF1ZGlvVHJhY2tJbmRleCAhPSAtMSkgeworICAgICAgICAgICAgICAgICAgICBBTE9HRSgiTm90IG1vcmUgdGhhbiBvbmUgYXVkaW8gdHJhY2sgaXMgc3VwcG9ydGVkIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGF1ZGlvVHJhY2tJbmRleCA9IGV4VHJhY2tJbmRleDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgQUxPR1YoIk5laXRoZXIgVmlkZW8gbm9yIEF1ZGlvIHRyYWNrIik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbUZtdEluZGV4TWFwLmVtcGxhY2UoZXhUcmFja0luZGV4LCBmbXQpOworICAgICAgICBtU2FtcGxlQ291bnRWZWN0LmVtcGxhY2VfYmFjaygwKTsKKyAgICAgICAgbU1heFRpbWVzdGFtcFZlY3QuZW1wbGFjZV9iYWNrKDApOworICAgICAgICBtTGFzdFN5bmNTYW1wbGVUaW1lVmVj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c3RTeW5jU2FtcGxlVGltZVZlY3Q6JWxsZCIsIChsb25nIGxvbmcpc3luY1NhbXBsZVRpbWUpOworICAgIH0KKyAgICBBTE9HVigibU1vZGU6JXUiLCBtTW9kZSk7CisgICAgaWYgKG1Nb2RlID09IEFQUEVORF9NT0RFX0lHTk9SRV9MQVNUX1ZJREVPX0dPUCAmJiB2aWRlb1RyYWNrSW5kZXggIT0gLTEgKSB7CisgICAgICAgIEFMT0dWKCJWaWRlbyB0cmFjayBpcyBwcmVzZW50Iik7CisgICAgICAgIGJvb2wgbGFzdFZpZGVvSWZyYW1lID0gZmFsc2U7CisgICAgICAgIHNpemVfdCBsYXN0VmlkZW9JZnJhbWVPZmZzZXQgPSAwOworICAgICAgICBpbnQ2NF90IGxhc3RWaWRlb1NhbXBsZVRpbWUgPSAtMTsKKyAgICAgICAgZm9yIChhdXRvIHJJdHIgPSBtU0RJLnJiZWdpbigpOyBySXRyICE9IG1TREkucmVuZCgpOyArK3JJdHIpIHsKKyAgICAgICAgICAgIGlmIChySXRyLT5leFRyYWNrSW5kZXggIT0gdmlkZW9UcmFja0luZGV4KSB7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobGFzdFZpZGVvU2FtcGxlVGltZSA9PSAtMSkgeworICAgICAgICAgICAgICAgIGxhc3RWaWRlb1NhbXBsZVRpbWUgPSBySXRyLT50aW1lOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaW50NjRfdCBvZmZzZXQgPSAwOworICAgICAgICAgICAgaWYgKCFySXRyLT5tZXRhLT5maW5kSW50NjQoa0tleVNhbXBsZUZpbGVPZmZzZXQsICZvZmZzZXQpIHx8IG9mZnNldCA9PSAwKSB7CisgICAgICAgICAgICAgICAgQUxPR0UoIk1pc3Npbmcgb2Zmc2V0Iik7CisgICAgICAgICAgICAgICAgcmV0dXJuIEVSUk9SX01BTEZPUk1FRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFMT0dWKCJvZmZzZXQ6JWxsZCIsIChsb25nIGxvbmcpb2Zmc2V0KTsKKyAgICAgICAgICAgIGludDMyX3QgdmFsID0gMDsKKyAgICAgICAgICAgIGlmIChySXRyLT5tZXRhLT5maW5kSW50MzIoa0tleUlzU3luY0ZyYW1lLCAmdmFsKSAmJiB2YWwgIT0gMCkgeworICAgICAgICAgICAgICAgIEFMT0dWKCJzYW1wbGVUaW1lOiVsbGQiLCAobG9uZyBsb25nKXJJdHItPnRpbWUpOworICAgICAgICAgICAgICAgIEFMT0dWKCJsYXN0VmlkZW9TYW1wbGVUaW1lOiVsbGQiLCAobG9uZyBsb25nKWxhc3RWaWRlb1NhbXBsZVRpbWUpOworICAgICAgICAgICAgICAgIGlmIChsYXN0VmlkZW9JZnJhbWUgPT0gZmFsc2UgJiYgKGxhc3RWaWRlb1NhbXBsZVRpbWUgLSBySXRyLT50aW1lKSA+CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMDAwMDAvKiBUcmFjayBpbnRlcmxlYXZpbmcgZHVyYXRpb24gaW4gTVBFRzRXcml0ZXIqLykgeworICAgICAgICAgICAgICAgICAgICBBTE9HVigibGFzdFZpZGVvSWZyYW1lIGdvdCBjaG9zZW4iKTsKKyAgICAgICAgICAgICAgICAgICAgbGFzdFZpZGVvSWZyYW1lID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgbUxhc3RTeW5jU2FtcGxlVGltZVZlY3RbdmlkZW9UcmFja0luZGV4XSA9IHJJdHItPnRpbWU7CisgICAgICAgICAgICAgICAgICAgIGxhc3RWaWRlb0lmcmFtZU9mZnNldCA9IG9mZnNldDsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoImxhc3RWaWRlb0lmcmFtZU9mZnNldDolbGxkIiwgKGxvbmcgbG9uZylvZmZzZXQpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKGxhc3RWaWRlb0lmcmFtZSA9PSBmYWxzZSkgeworICAgICAgICAgICAgQUxPR1YoIk5lZWQgdG8gcmV3cml0ZSBhbGwgc2FtcGxlcyIpOworICAgICAgICAgICAgbUxhc3RTeW5jU2FtcGxlVGltZVZlY3RbdmlkZW9UcmFja0luZGV4XSA9IDA7CisgICAgICAgICAgICBsYXN0VmlkZW9JZnJhbWVPZmZzZXQgPSAwOworICAgICAgICB9CisgICAgICAgIHVuc2lnbmVkIGludCBmcmFtZXNJZ25vcmVkQ291bnQgPSAwOworICAgICAgICBmb3IgKGF1dG8gaXRyID0gbVNESS5iZWdpbigpOyBpdHIgIT0gbVNESS5lbmQoKTspIHsKKyAgICAgICAgICAgIGludDY0X3Qgb2Zmc2V0ID0gMDsKKyAgICAgICAgICAgIEFMT0dWKCJ0cmFja0luZGV4OiV6dSwgJSIgUFJJZDY0ICIiLCBpdHItPmV4VHJhY2tJbmRleCwgaXRyLT50aW1lKTsKKyAgICAgICAgICAgIGlmIChpdHItPm1ldGEtPmZpbmRJbnQ2NChrS2V5U2FtcGxlRmlsZU9mZnNldCwgJm9mZnNldCkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZmZzZXQgPj0gbGFzdFZpZGVvSWZyYW1lT2Zmc2V0KSB7CisgICAgICAgICAgICAgICAgQUxPR1YoIm9mZnNldDolbGxkIiwgKGxvbmcgbG9uZylvZmZzZXQpOworICAgICAgICAgICAgICAgIGlmICghYXVkaW9TeW5jU2FtcGxlVGltZVNldCAmJiBhdWRpb1RyYWNrSW5kZXggIT0gLTEgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9UcmFja0luZGV4ID09IGl0ci0+ZXhUcmFja0luZGV4KSB7CisgICAgICAgICAgICAgICAgICAgIG1MYXN0U3luY1NhbXBsZVRpbWVWZWN0W2F1ZGlvVHJhY2tJbmRleF0gPSBpdHItPnRpbWU7CisgICAgICAgICAgICAgICAgICAgIGF1ZGlvU3luY1NhbXBsZVRpbWVTZXQgPSB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpdHIgPSBtU0RJLmVyYXNlKGl0cik7CisgICAgICAgICAgICAgICAgKytmcmFtZXNJZ25vcmVkQ291bnQ7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICsraXRyOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIEFMT0dWKCJmcmFtZXNJZ25vcmVkQ291bnQ6JXUiLCBmcmFtZXNJZ25vcmVkQ291bnQpOworICAgIH0KKworICAgIGlmIChtTW9kZSA9PSBBUFBFTkRfTU9ERV9JR05PUkVfTEFTVF9WSURFT19HT1AgJiYgdmlkZW9UcmFja0luZGV4ID09IC0xICYmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9UcmFja0luZGV4ICE9IC0xKSB7CisgICAgICAgIEFMT0dWKCJPbmx5IEF1ZGlvVHJhY2sgaXMgcHJlc2VudCIpOworICAgICAgICBmb3IgKGF1dG8gckl0ciA9IG1TREkucmJlZ2luKCk7IHJJdHIgIT0gbVNESS5yZW5kKCk7ICArK3JJdHIpIHsKKyAgICAgICAgICAgIGludDMyX3QgdmFsID0gMDsKKyAgICAgICAgICAgIGlmIChySXRyLT5tZXRhLT5maW5kSW50MzIoa0tleUlzU3luY0ZyYW1lLCAmdmFsKSAmJiB2YWwgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICBtTGFzdFN5bmNTYW1wbGVUaW1lVmVjdFthdWRpb1RyYWNrSW5kZXhdID0gckl0ci0+dGltZTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgdW5zaWduZWQgaW50IGZyYW1lc0lnbm9yZWRDb3VudCA9IDA7CisgICAgICAgIGZvciAoYXV0byBpdHIgPSBtU0RJLmJlZ2luKCk7IGl0ciAhPSBtU0RJLmVuZCgpOykgeworICAgICAgICAgICAgaWYgKGl0ci0+dGltZSA+PSBtTGFzdFN5bmNTYW1wbGVUaW1lVmVjdFthdWRpb1RyYWNrSW5kZXhdKSB7CisgICAgICAgICAgICAgICAgaXRyID0gbVNESS5lcmFzZShpdHIpOworICAgICAgICAgICAgICAgICsrZnJhbWVzSWdub3JlZENvdW50OworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICArK2l0cjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBBTE9HVigiZnJhbWVzSWdub3JlZENvdW50IDoldSIsIGZyYW1lc0lnbm9yZWRDb3VudCk7CisgICAgfQorCisgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBtTGFzdFN5bmNTYW1wbGVUaW1lVmVjdC5zaXplKCk7ICsraSkgeworICAgICAgICBBTE9HVigibUxhc3RTeW5jU2FtcGxlVGltZVZlY3RbJXp1XTolbGxkIiwgaSwgKGxvbmcgbG9uZyltTGFzdFN5bmNTYW1wbGVUaW1lVmVjdFtpXSk7CisgICAgICAgIG1GbXRJbmRleE1hcFtpXS0+c2V0SW50NjQoCisgICAgICAgICAgICAgICAgInNhbXBsZS10aW1lLWJlZm9yZS1hcHBlbmQiIC8qQU1FRElBRk9STUFUX0tFWV9TQU1QTEVfVElNRV9CRUZPUkVfQVBQRU5EKi8sCisgICAgICAgICAgICAgICAgbUxhc3RTeW5jU2FtcGxlVGltZVZlY3RbaV0pOworICAgIH0KKyAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG1NYXhUaW1lc3RhbXBWZWN0LnNpemUoKTsgKytpKSB7CisgICAgICAgIEFMT0dWKCJtTWF4VGltZXN0YW1wWyV6dV06JWxsZCIsIGksIChsb25nIGxvbmcpbU1heFRpbWVzdGFtcFZlY3RbaV0pOworICAgIH0KKyAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG1TYW1wbGVDb3VudFZlY3Quc2l6ZSgpOyArK2kpIHsKKyAg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tZXRhKCk7CisgICAgICAgICAgICBidWZNZXRhLT5zZXRJbnQ2NCgKKyAgICAgICAgICAgICAgICAgICAgImxhc3Qtc2FtcGxlLWluZGV4LWluLWNodW5rIiAvKkFNRURJQUZPUk1BVF9LRVlfTEFTVF9TQU1QTEVfSU5ERVhfSU5fQ0hVTksqLywKKyAgICAgICAgICAgICAgICAgICAgdmFsNjQpOworICAgICAgICB9CisgICAgICAgIHN0YXR1cyA9IG1NdXhlci0+d3JpdGVTYW1wbGVEYXRhKGRhdGEsIG1UcmFja0luZGV4TWFwW21TRElbaV0uZXhUcmFja0luZGV4XSwgbVNESVtpXS50aW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGVGbGFncyk7CisgICAgICAgIGlmIChzdGF0dXMgIT0gT0spIHsKKyAgICAgICAgICAgIEFMT0dFKCJtdXhlciB3cml0ZVNhbXBsZURhdGEgZmFpbGVkOiVkIiwgc3RhdHVzKTsKKyAgICAgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgICAgIH0KKyAgICB9CisgICAgbVN0YXRlID0gU1RBUlRFRDsKKyAgICByZXR1cm4gT0s7Cit9CisKK3N0YXR1c190IE1lZGlhQXBwZW5kZXI6OnN0b3AoKSB7CisgICAgc3RkOjpzY29wZWRfbG9jayBsb2NrKG1NdXRleCk7CisgICAgQUxPR1YoIk1lZGlhQXBwZW5kZXI6OnN0b3AiKTsKKyAgICBpZiAobVN0YXRlID09IFNUQVJURUQpIHsKKyAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gbU11eGVyLT5zdG9wKCk7CisgICAgICAgIGlmIChzdGF0dXMgIT0gT0spIHsKKyAgICAgICAgICAgIG1TdGF0ZSA9IEVSUk9SOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbVN0YXRlID0gU1RPUFBFRDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gc3RhdHVzOworICAgIH0gZWxzZSB7CisgICAgICAgIEFMT0dF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VtJikgb3ZlcnJpZGUge30KKyAgICAgICAgICAgIENvbnN1bWVyTGlzdGVuZXIoY29uc3Qgc3A8SUdyYXBoaWNCdWZmZXJDb25zdW1lcj4gJmNvbnN1bWVyKSB7CisgICAgICAgICAgICAgICAgbUNvbnN1bWVyID0gY29uc3VtZXI7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIG9uRnJhbWVBdmFpbGFibGUoY29uc3QgQnVmZmVySXRlbSYpIG92ZXJyaWRlIHsKKyAgICAgICAgICAgICAgICBCdWZmZXJJdGVtIGJ1ZmZlcjsKKyAgICAgICAgICAgICAgICAvLyBjb25zdW1lIGJ1ZmZlcgorICAgICAgICAgICAgICAgIHNwPElHcmFwaGljQnVmZmVyQ29uc3VtZXI+IGNvbnN1bWVyID0gbUNvbnN1bWVyLnByb21vdGUoKTsKKyAgICAgICAgICAgICAgICBpZiAoY29uc3VtZXIgIT0gbnVsbHB0ciAmJiBjb25zdW1lci0+YWNxdWlyZUJ1ZmZlcigmYnVmZmVyLCAwKSA9PSBOT19FUlJPUikgeworICAgICAgICAgICAgICAgICAgICBjb25zdW1lci0+cmVsZWFzZUJ1ZmZlcihidWZmZXIubVNsb3QsIGJ1ZmZlci5tRnJhbWVOdW1iZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVHTF9OT19ESVNQTEFZLCBFR0xfTk9fU1lOQ19LSFIsIGJ1ZmZlci5tRmVuY2UpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgd3A8SUdyYXBoaWNCdWZmZXJDb25zdW1lcj4gbUNvbnN1bWVyOwogICAgICAgICAgICAgdm9pZCBvbkJ1ZmZlcnNSZWxlYXNlZCgpIG92ZXJyaWRlIHt9CiAgICAgICAgICAgICB2b2lkIG9uU2lkZWJhbmRTdHJlYW1DaGFuZ2VkKCkgb3ZlcnJpZGUge30KICAgICAgICAgfTsKLSAgICAgICAgc3A8Q29uc3Vt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ICBpbnQzMl90IHR1bm5lbFBlZWsgPSAwOworICAgIGlmICghbXNnLT5maW5kSW50MzIoInR1bm5lbC1wZWVrIiwgJnR1bm5lbFBlZWspKXsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIFR1bm5lbFBlZWtTdGF0ZSBwcmV2aW91c1N0YXRlID0gbVR1bm5lbFBlZWtTdGF0ZTsKKyAgICBpZih0dW5uZWxQZWVrID09IDApeworICAgICAgICBzd2l0Y2ggKG1UdW5uZWxQZWVrU3RhdGUpIHsKKyAgICAgICAgICAgIGNhc2UgVHVubmVsUGVla1N0YXRlOjprRW5hYmxlZE5vQnVmZmVyOgorICAgICAgICAgICAgICAgIG1UdW5uZWxQZWVrU3RhdGUgPSBUdW5uZWxQZWVrU3RhdGU6OmtEaXNhYmxlZE5vQnVmZmVyOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBUdW5uZWxQZWVrU3RhdGU6OmtFbmFibGVkUXVldWVkOgorICAgICAgICAgICAgICAgIG1UdW5uZWxQZWVrU3RhdGUgPSBUdW5uZWxQZWVrU3RhdGU6OmtEaXNhYmxlZFF1ZXVlZDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgQUxPR1YoIklnbm9yaW5nIHR1bm5lbC1wZWVrPSVkIGZvciAlcyIsIHR1bm5lbFBlZWssIGFzU3RyaW5nKG1UdW5uZWxQZWVrU3RhdGUpKTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICB9IGVsc2UgeworICAgICAgICBzd2l0Y2ggKG1UdW5uZWxQZWVrU3RhdGUpIHsKKyAgICAgICAgICAgIGNhc2UgVHVubmVsUGVla1N0YXRlOjprRGlzYWJsZWROb0J1ZmZlcjoKKyAgICAgICAgICAgICAgICBtVHVubmVsUGVla1N0YXRlID0gVHVubmVsUGVla1N0YXRlOjprRW5hYmxlZE5vQnVmZmVyOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBUdW5uZWxQZWVrU3RhdGU6OmtEaXNhYmxlZFF1ZXVlZDoKKyAgICAgICAgICAgICAgICBtVHVubmVsUGVla1N0YXRlID0gVHVubmVsUGVla1N0YXRlOjprRW5hYmxlZFF1ZXVlZDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgVHVubmVsUGVla1N0YXRlOjprQnVmZmVyRGVjb2RlZDoKKyAgICAgICAgICAgICAgICBtc2ctPnNldEludDMyKCJhbmRyb2lkLl90cmlnZ2VyLXR1bm5lbC1wZWVrIiwgMSk7CisgICAgICAgICAgICAgICAgbVR1bm5lbFBlZWtTdGF0ZSA9IFR1bm5lbFBlZWtTdGF0ZTo6a0J1ZmZlclJlbmRlcmVkOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBBTE9HVigiSWdub3JpbmcgdHVubmVsLXBlZWs9JWQgZm9yICVzIiwgdHVubmVsUGVlaywgYXNTdHJpbmcobVR1bm5lbFBlZWtTdGF0ZSkpOworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgIH0KKworICAgIEFMT0dWKCJUdW5uZWxQZWVrU3RhdGU6ICVzIC0+ICVzIiwgYXNTdHJpbmcocHJldmlvdXNTdGF0ZSksIGFzU3RyaW5nKG1UdW5uZWxQZWVrU3RhdGUpKTsKK30KKwordm9pZCBNZWRpYUNvZGVjOjp1cGRhdGVQbGF5YmFja0R1cmF0aW9uKGNvbnN0IHNwPEFNZXNzYWdlPiAmbXNnKSB7CisgICAgaW50IHdoYXQgPSAwOworICAgIG1zZy0+ZmluZEludDMyKCJ3aGF0IiwgJndoYXQpOworICAgIGlmIChtc2ctPndoYXQoKSAhPSBrV2hhdENvZGVjTm90aWZ5ICYmIHdoYXQgIT0ga1doYXRPdXRwdXRGcmFtZXNSZW5kZXJlZCkgewor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Ml90IGZsYWdzID0gMDsKKyAgICAgICAgKHZvaWQpIGJ1ZmZlci0+bWV0YSgpLT5maW5kSW50MzIoImZsYWdzIiwgJmZsYWdzKTsKKworICAgICAgICAvLyBzb21lIG9mIHRoZXNlIGZyYW1lcywgd2UgZG9uJ3Qgd2FudCB0byBjb3VudAorICAgICAgICAvLyBzdGFuZGFsb25lIEVPUy4uLi4gaGFzIGFuIGludmFsaWQgdGltZXN0YW1wCisgICAgICAgIGlmICgoZmxhZ3MgJiAoQlVGRkVSX0ZMQUdfQ09ERUNDT05GSUd8QlVGRkVSX0ZMQUdfRU9TKSkgPT0gMCkgeworICAgICAgICAgICAgbUJ5dGVzRW5jb2RlZCArPSBidWZmZXItPnNpemUoKTsKKyAgICAgICAgICAgIG1GcmFtZXNFbmNvZGVkKys7CisKKyAgICAgICAgICAgIE11dGV4OjpBdXRvbG9jayBhbChtT3V0cHV0U3RhdHNMb2NrKTsKKyAgICAgICAgICAgIGludDY0X3QgdGltZVVzID0gMDsKKyAgICAgICAgICAgIGlmIChidWZmZXItPm1ldGEoKS0+ZmluZEludDY0KCJ0aW1lVXMiLCAmdGltZVVzKSkgeworICAgICAgICAgICAgICAgIGlmICh0aW1lVXMgPiBtTGF0ZXN0RW5jb2RlZFB0c1VzKSB7CisgICAgICAgICAgICAgICAgICAgIG1MYXRlc3RFbmNvZGVkUHRzVXMgPSB0aW1lVXM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8vIGNhbid0IGNoYWluIGFzIGFuIGVsc2UtaWYgb3IgdGhpcyBuZXZlciB0cmlnZ2VycworICAgICAgICAgICAgICAgIGlmICh0aW1lVXMgPCBtRWFybGllc3RFbmNvZGVkUHRzVXMpIHsKKyAgICAgICAgICAgICAgICAgICAgbUVhcmxpZXN0RW5jb2RlZFB0c1VzID0gdGltZVVzOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKwogICAgIC8vIG11dGV4IGF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AgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7CiAgICAgICAgIH0KKworICAgIH0gZWxzZSB7CisgICAgICAgIGlmIChtTWV0cmljc0hhbmRsZSAhPSAwKSB7CisgICAgICAgICAgICBpbnQzMl90IGNoYW5uZWxDb3VudDsKKyAgICAgICAgICAgIGlmIChmb3JtYXQtPmZpbmRJbnQzMihLRVlfQ0hBTk5FTF9DT1VOVCwgJmNoYW5uZWxDb3VudCkpIHsKKyAgICAgICAgICAgICAgICBtZWRpYW1ldHJpY3Nfc2V0SW50MzIobU1ldHJpY3NIYW5kbGUsIGtDb2RlY0NoYW5uZWxDb3VudCwgY2hhbm5lbENvdW50KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGludDMyX3Qgc2FtcGxlUmF0ZTsKKyAgICAgICAgICAgIGlmIChmb3JtYXQtPmZpbmRJbnQzMihLRVlfU0FNUExFX1JBVEUsICZzYW1wbGVSYXRlKSkgeworICAgICAgICAgICAgICAgIG1lZGlhbWV0cmljc19zZXRJbnQzMihtTWV0cmljc0hhbmRsZSwga0NvZGVjU2FtcGxlUmF0ZSwgc2FtcGxlUmF0ZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpZiAoZmxhZ3MgJiBDT05GSUdVUkVfRkxBR19FTkNPREUpIHsKKyAgICAgICAgaW50OF90IGVuYWJsZVNoYXBpbmcgPSBwcm9wZXJ0eV9nZXRfYm9vbChlbmFibGVNZWRpYUZvcm1hdFNoYXBpbmdQcm9wZXJ0eSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmFibGVNZWRpYUZvcm1hdFNoYXBpbmdEZWZhdWx0KTsKKyAgICAgICAgaWYgKCFlbmFibGVTaGFwaW5nKSB7CisgICAgICAgICAgICBBTE9HSSgiZm9ybWF0IHNoYXBpbmcgZGlzYWJsZWQsIHByb3BlcnR5ICclcyciLCBlbmFibGVNZWRpYUZvcm1hdFNoYXBpbmdQcm9wZXJ0eSk7CisgICAgICAgICAgICBpZiAobU1ldHJpY3NIYW5kbGUgIT0gMCkgeworICAgICAgICAgICAgICAgIG1lZGlhbWV0cmljc19zZXRJbnQzMihtTWV0cmljc0hhbmRsZSwga0NvZGVjU2hhcGluZ0VuaGFuY2VkLCAtMSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAodm9pZCkgc2hhcGVNZWRpYUZvcm1hdChmb3JtYXQsIGZsYWdzKTsKKyAgICAgICAgICAgIC8vIFhYWDogZG8gd2Ugd2FudCB0byBkbyB0aGlzIHJlZ2FyZGxlc3Mgb2Ygc2hhcGluZyBlbmFibGVtZW50PworICAgICAgICAgICAgbWFwRm9ybWF0KG1Db21wb25lbnROYW1lLCBmb3JtYXQsIG51bGxwdHIsIGZhbHNlKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vIHB1c2ggbWluL21heCBRUCB0byBNZWRpYU1ldHJpY3MgYWZ0ZXIgc2hhcGluZworICAgIGlmIChtSXNWaWRlbyAmJiBtTWV0cmljc0hhbmRsZSAhPSAwKSB7CisgICAgICAgIGludDMyX3QgcXBJTWluID0gLTE7CisgICAgICAgIGlmIChmb3JtYXQtPmZpbmRJbnQzMigidmlkZW8tcXAtaS1taW4iLCAmcXBJTWluKSkgeworICAgICAgICAgICAgbWVkaWFtZXRyaWNzX3NldEludDMyKG1NZXRyaWNzSGFuZGxlLCBrQ29kZWNSZXF1ZXN0ZWRWaWRlb1FQSU1pbiwgcXBJTWluKTsKKyAgICAgICAgfQorICAgICAgICBpbnQzMl90IHFwSU1heCA9IC0xOworICAgICAgICBpZiAoZm9ybWF0LT5maW5kSW50MzIoInZpZGVvLXFwLWktbWF4IiwgJnFwSU1heCkpIHsKKyAgICAgICAgICAgIG1lZGlhbWV0cmljc19zZXRJbnQzMihtTWV0cmljc0hhbmRsZSwga0NvZGVjUmVxdWVzdGVkVmlkZW9RUElNYXgsIHFwSU1heCk7C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mVzb3VyY2VFcnJvcihlcnIpICYmICFtUmVzb3VyY2VNYW5hZ2VyUHJveHktPnJlY2xhaW1SZXNvdXJjZShyZXNvdXJjZXMpKSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CiAgICAgICAgICAgICAvLyBNZWRpYUNvZGVjIG5vdyBzZXQgc3RhdGUgdG8gVU5JTklUSUFMSVpFRCB1cG9uIGFueSBmYXRhbCBlcnJvci4KICAgICAgICAgICAgIC8vIFRvIG1haW50YWluIGJhY2t3YXJkLWNvbXBhdGliaWxpdHksIGRvIGEgcmVzZXQoKSB0byBwdXQgY29kZWMKICAgICAgICAgICAgIC8vIGJhY2sgaW50byBJTklUSUFMSVpFRCBzdGF0ZS4KQEAgLTEzNjgsNyArMTY3NSwxOCBAQAogICAgICAgICAgICAgLy8gdGhlIGNvbmZpZ3VyZSBmYWlsdXJlIGlzIGR1ZSB0byB3cm9uZyBzdGF0ZS4KIAogICAgICAgICAgICAgQUxPR0UoImNvbmZpZ3VyZSBmYWlsZWQgd2l0aCBlcnIgMHglMDh4LCByZXNldHRpbmcuLi4iLCBlcnIpOwotICAgICAgICAgICAgcmVzZXQoKTsKKyAgICAgICAgICAgIHN0YXR1c190IGVycjIgPSByZXNldCgpOworICAgICAgICAgICAgaWYgKGVycjIgIT0gT0spIHsKKyAgICAgICAgICAgICAgICBBTE9HRSgicmV0cnlpbmcgY29uZmlndXJlOiBmYWlsZWQgdG8gcmVzZXQgY29kZWMgKCUwOHgpIiwgZXJyMik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgIGVycjIgPSBzZXRDYWxsYmFjayhjYWxsYmFjayk7CisgICAgICAgICAgICAgICAgaWYgKGVycjIgIT0gT0spIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR0UoInJldHJ5aW5nIGNvbmZpZ3VyZTogZm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CisgICAgICAgIGlmIChtZWRpYU5zICE9IE5VTEwpIHsKKyAgICAgICAgICAgIHN0YXRpYyBjb25zdCBhbmRyb2lkX2RsZXh0aW5mbyBkbGV4dGluZm8gPSB7CisgICAgICAgICAgICAgICAgLmZsYWdzID0gQU5EUk9JRF9ETEVYVF9VU0VfTkFNRVNQQUNFLAorICAgICAgICAgICAgICAgIC5saWJyYXJ5X25hbWVzcGFjZSA9IG1lZGlhTnMsCisgICAgICAgICAgICB9OworCisgICAgICAgICAgICBBU3RyaW5nIGxpYnJhcnlNYWlubGluZSA9ICIvYXBleC9jb20uYW5kcm9pZC5tZWRpYS8iOworI2lmIF9fTFA2NF9fCisgICAgICAgICAgICBsaWJyYXJ5TWFpbmxpbmUuYXBwZW5kKCJsaWI2NC8iKTsKKyNlbHNlCisgICAgICAgICAgICBsaWJyYXJ5TWFpbmxpbmUuYXBwZW5kKCJsaWIvIik7CisjZW5kaWYKKyAgICAgICAgICAgIGxpYnJhcnlNYWlubGluZS5hcHBlbmQobGlicmFyeU5hbWUpOworCisgICAgICAgICAgICBsaWJIYW5kbGUgPSBhbmRyb2lkX2Rsb3Blbl9leHQobGlicmFyeU1haW5saW5lLmNfc3RyKCksIFJUTERfTk9XfFJUTERfTk9ERUxFVEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmRsZXh0aW5mbyk7CisKKyAgICAgICAgICAgIGlmIChsaWJIYW5kbGUgIT0gTlVMTCkgeworICAgICAgICAgICAgICAgIHNTaGFwZXJPcHMgPSAoYW5kcm9pZDo6bWVkaWFmb3JtYXRzaGFwZXI6OkZvcm1hdFNoYXBlck9wc190KikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGxzeW0obGliSGFuZGxlLCAic2hhcGVyX29wcyIpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBBTE9HVygiY29ubmVjdEZvcm1hdFNoYXBlcjogdW5hYmxlIHRvIGxvYWQgbWFpbmxpbmUgZm9ybWF0c2hhcGVyICVzIiwKKyAgICAgICAgICAgICAgICAgICAgICBsaWJyYXJ5TWFpbmxpbmUuY19zdHIoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBBTE9HVigiY29ubmVjdEZvcm1hdFNoYXBlcjogY291bGRuJ3QgZmluZCBtZWRpYSBuYW1lc3BhY2UuIik7CisgICAgICAgIH0KKworICAgICAgICAvLyBmYWxsIGJhY2sgdG8gdGhlIHN5c3RlbSBwYXJ0aXRpb24sIGlmIHByZXNlbnQuCisgICAgICAgIC8vCisgICAgICAgIGlmIChzU2hhcGVyT3BzID09IE5VTEwpIHsKKworICAgICAgICAgICAgbGliSGFuZGxlID0gZGxvcGVuKGxpYnJhcnlOYW1lLmNfc3RyKCksIFJUTERfTk9XfFJUTERfTk9ERUxFVEUpOworCisgICAgICAgICAgICBpZiAobGliSGFuZGxlICE9IE5VTEwpIHsKKyAgICAgICAgICAgICAgICBzU2hhcGVyT3BzID0gKGFuZHJvaWQ6Om1lZGlhZm9ybWF0c2hhcGVyOjpGb3JtYXRTaGFwZXJPcHNfdCopCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRsc3ltKGxpYkhhbmRsZSwgInNoYXBlcl9vcHMiKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgQUxPR1coImNvbm5lY3RGb3JtYXRTaGFwZXI6IHVuYWJsZSB0byBsb2FkIGZvcm1hdHNoYXBlciAlcyIsIGxpYnJhcnlOYW1lLmNfc3RyKCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKHNTaGFwZXJPcHMgIT0gbnVsbHB0cgorICAgICAgICAgICAgJiYgc1NoYXBlck9wcy0+dmVyc2lvbiAhPSBhbmRyb2lkOjptZWRpYWZvcm1hdHNoYXBlcjo6U0hBUEVSX1ZFUlNJT05fVjEpIHsKKyAgICAgICAgICAgIE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ICAgICBzcDxJQmluZGVyPiBiaW5kZXIgPSBzZXJ2aWNlTWdyLT53YWl0Rm9yU2VydmljZShTdHJpbmcxNigicGFja2FnZV9uYXRpdmUiKSk7CisgICAgICAgICAgICBwYWNrYWdlTWdyID0gaW50ZXJmYWNlX2Nhc3Q8Y29udGVudDo6cG06OklQYWNrYWdlTWFuYWdlck5hdGl2ZT4oYmluZGVyKTsKKyAgICAgICAgfQorICAgICAgICAvLyBpZiB3ZSBkaWRuJ3QgZ2V0IHNlcnZpY2VNZ3IsIHdlJ2xsIGxlYXZlIHBhY2thZ2VNZ3IgYXMgZGVmYXVsdCBudWxsCisgICAgICAgIGlmIChwYWNrYWdlTWdyICE9IG51bGxwdHIpIHsKKworICAgICAgICAgICAgLy8gTVVTVCBoYXZlIHRoZXNlCisgICAgICAgICAgICBzdGF0aWMgY29uc3QgU3RyaW5nMTYgZmVhdHVyZXNOZWVkZWRbXSA9IHsKKyAgICAgICAgICAgICAgICBTdHJpbmcxNigiYW5kcm9pZC5oYXJkd2FyZS50b3VjaHNjcmVlbiIpCisgICAgICAgICAgICB9OworICAgICAgICAgICAgLy8gdGhlc2UgbXVzdCBiZSBwcmVzZW50IHRvIGJlIGEgaGFuZGhlbGQKKyAgICAgICAgICAgIGZvciAoOjphbmRyb2lkOjpTdHJpbmcxNiByZXF1aXJlZCA6IGZlYXR1cmVzTmVlZGVkKSB7CisgICAgICAgICAgICAgICAgYm9vbCBoYXNGZWF0dXJlID0gZmFsc2U7CisgICAgICAgICAgICAgICAgYmluZGVyOjpTdGF0dXMgc3RhdHVzID0gcGFja2FnZU1nci0+aGFzU3lzdGVtRmVhdHVyZShyZXF1aXJlZCwgMCwgJmhhc0ZlYXR1cmUpOworICAgICAgICAgICAgICAgIGlmICghc3RhdHVzLmlzT2soKSkgeworICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXM6IGhhc1N5c3RlbUZlYXR1cmUgZmFpbGVkOiAlcyIsCisgICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgc3RhdHVzLmV4Y2VwdGlvbk1lc3NhZ2UoKS5jX3N0cigpKTsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIEFMT0dWKCJmZWF0dXJlICVzIHNheXMgJWQiLCBTdHJpbmc4KHJlcXVpcmVkKS5jX3N0cigpLCBoYXNGZWF0dXJlKTsKKyAgICAgICAgICAgICAgICBpZiAoIWhhc0ZlYXR1cmUpIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoIi4uLiB3aGljaCBtZWFucyB3ZSBhcmUgbm90IGhhbmRoZWxkIik7CisgICAgICAgICAgICAgICAgICAgIHNJc0hhbmRoZWxkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gTVVTVCBOT1QgaGF2ZSB0aGVzZQorICAgICAgICAgICAgc3RhdGljIGNvbnN0IFN0cmluZzE2IGZlYXR1cmVzRGlzYWxsb3dlZFtdID0geworICAgICAgICAgICAgICAgIFN0cmluZzE2KCJhbmRyb2lkLmhhcmR3YXJlLnR5cGUuYXV0b21vdGl2ZSIpLAorICAgICAgICAgICAgICAgIFN0cmluZzE2KCJhbmRyb2lkLmhhcmR3YXJlLnR5cGUudGVsZXZpc2lvbiIpLAorICAgICAgICAgICAgICAgIFN0cmluZzE2KCJhbmRyb2lkLmhhcmR3YXJlLnR5cGUud2F0Y2giKQorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIC8vIGFueSBvZiB0aGVzZSBwcmVzZW50IC0tIHdlIGFyZW4ndCBhIGhhbmRoZWxkCisgICAgICAgICAgICBmb3IgKDo6YW5kcm9pZDo6U3RyaW5nMTYgZm9yYmlkZGVuIDogZmVhdHVyZXNEaXNhbGxvd2VkKSB7CisgICAgICAgICAgICAgICAgYm9vbCBoYXNGZWF0dXJlID0gZmFsc2U7CisgICAgICAgICAgICAgICAgYmluZGVyOjpTdGF0dXMgc3RhdHVzID0gcGFja2FnZU1nci0+aGFzU3lzdGVtRmVhdHVyZShmb3JiaWRkZW4sIDAsICZoYXNGZWF0dXJlKTsKKyAgICAgICAgICAgICAgICBpZiAoIXN0YXR1cy5pc09rKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR0UoIiVzOiBoYXNTeXN0ZW1GZWF0dXJlIGZhaWxlZDogJXMiLAorICAgICAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sIHN0YXR1cy5leGNlcHRpb25NZXNzYWdlKCkuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBBTE9HVigiZmVhdHVyZSAlcyBzYXlzICVkIiwgU3RyaW5nOChmb3JiaWRkZW4pLmNfc3RyKCksIGhhc0ZlYXR1cmUpOworICAgICAgICAgICAgICAgIGlmIChoYXNGZWF0dXJlKSB7CisgICAgICAgICAgICAgICAgICAgIEFMT0dWKCIuLi4gd2hpY2ggbWVhbnMgd2UgYXJlIG5vdCBoYW5kaGVsZCIpOworICAgICAgICAgICAgICAgICAgICBzSXNIYW5kaGVsZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgIH0pOworCisgICAgcmV0dXJuIHRydWU7Cit9CisKKworI2lmIDAKKy8vIGEgY29uc3RydWN0IHRvIGZvcmNlIHRoZSBhYm92ZSBkbG9wZW4oKSB0byBydW4gdmVyeSBlYXJseS4KKy8vIGdvYWw6IHNvIHRoZSBkbG9wZW4oKSBkb2Vzbid0IGhhcHBlbiBvbiBjcml0aWNhbCBwYXRoIG9mIGxhdGVuY3kgc2Vuc2l0aXZlIGFwcHMKKy8vIGZhaWx1cmUgb2YgdGhpcyBtZWFucyB0aGF0IGNvbGQgc3RhcnQgb2YgdG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luZyBtYXBUYXJnZXQ7CisgICAgICAgIGludCBjb3VudCA9IGRldGFpbHMtPmNvdW50RW50cmllcygpOworICAgICAgICBmb3IoaW50IGl4ID0gMDsgaXggPCBjb3VudDsgaXgrKykgeworICAgICAgICAgICAgQU1lc3NhZ2U6OlR5cGUgZW50cnlUeXBlOworICAgICAgICAgICAgY29uc3QgY2hhciAqbWFwU3JjID0gZGV0YWlscy0+Z2V0RW50cnlOYW1lQXQoaXgsICZlbnRyeVR5cGUpOworICAgICAgICAgICAgLy8gWFhYOiByZS11c2UgaXggZnJvbSBnZXRFbnRyeUF0KCkgdG8gYXZvaWQgYWRkaXRpb25hbCBmaW5kWFhYKCkgaW52b2NhdGlvbgorICAgICAgICAgICAgLy8KKyAgICAgICAgICAgIHN0YXRpYyBjb25zdCBjaGFyICpmZWF0dXJlUHJlZml4ID0gImZlYXR1cmUtIjsKKyAgICAgICAgICAgIHN0YXRpYyBjb25zdCBpbnQgZmVhdHVyZVByZWZpeExlbiA9IHN0cmxlbihmZWF0dXJlUHJlZml4KTsKKyAgICAgICAgICAgIHN0YXRpYyBjb25zdCBjaGFyICp0dW5pbmdQcmVmaXggPSAidHVuaW5nLSI7CisgICAgICAgICAgICBzdGF0aWMgY29uc3QgaW50IHR1bmluZ1ByZWZpeExlbiA9IHN0cmxlbih0dW5pbmdQcmVmaXgpOworICAgICAgICAgICAgc3RhdGljIGNvbnN0IGNoYXIgKm1hcHBpbmdQcmVmaXggPSAibWFwcGluZy0iOworICAgICAgICAgICAgc3RhdGljIGNvbnN0IGludCBtYXBwaW5nUHJlZml4TGVuID0gc3RybGVuKG1hcHBpbmdQcmVmaXgpOworCisgICAgICAgICAgICBpZiAobWFwU3JjID09IE5VTEwpIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoIXN0cm5jbXAobWFwU3JjLCBmZWF0dXJlUHJlZml4LCBmZWF0dXJlUHJlZml4TGVuKSkgeworICAgICAgICAgICAgICAgIGludDMyX3QgaW50VmFsdWU7CisgICAgICAgICAgICAgICAgaWYgKGRldGFpbHMtPmZpbmRJbnQzMihtYXBTcmMsICZpbnRWYWx1ZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoIi0tIGZlYXR1cmUgJyVzJyAtPiAlZCIsIG1hcFNyYywgaW50VmFsdWUpOworICAgICAgICAgICAgICAgICAgICAodm9pZCkoc1NoYXBlck9wcy0+c2V0RmVhdHVyZSkoc2hhcGVySGFuZGxlLCAmbWFwU3JjW2ZlYXR1cmVQcmVmaXhMZW5dLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50VmFsdWUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoIXN0cm5jbXAobWFwU3JjLCB0dW5pbmdQcmVmaXgsIHR1bmluZ1ByZWZpeExlbikpIHsKKyAgICAgICAgICAgICAgICBBU3RyaW5nIHZhbHVlOworICAgICAgICAgICAgICAgIGlmIChkZXRhaWxzLT5maW5kU3RyaW5nKG1hcFNyYywgJnZhbHVlKSkgeworICAgICAgICAgICAgICAgICAgICBBTE9HVigiLS0gdHVuaW5nICclcycgLT4gJyVzJyIsIG1hcFNyYywgdmFsdWUuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgICAgICh2b2lkKShzU2hhcGVyT3BzLT5zZXRUdW5pbmcpKHNoYXBlckhhbmRsZSwgJm1hcFNyY1t0dW5pbmdQcmVmaXhMZW5dLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfSBlbHNlIGlmICghc3RybmNtcChtYXBTcmMsIG1hcHBpbmdQcmVmaXgsIG1hcHBpbmdQcmVmaXhMZW4pKSB7CisgICAgICAgICAgICAgICAgQVN0cmluZyB0YXJnZXQ7CisgICAgICAgICAgICAgICAgaWYgKGRldGFpbHMtPmZpbmRTdHJpbmcobWFwU3JjLCAmdGFyZ2V0KSkgeworICAgICAgICAgICAgICAgICAgICBBTE9HVigiLS0gbWFwcGluZyAlczogbWFwICVzIHRvICVzIiwgbWFwU3JjLCAmbWFwU3JjW21hcHBpbmdQcmVmaXhMZW5dLAorICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgICAgIC8vIGtleSBpcyByZWFsbHkgImtpbmQta2V5IgorICAgICAgICAgICAgICAgICAgICAvLyBzZXBhcmF0ZSB0aGF0LCBzbyBzZXRNYXAoKSBzZWVzIHRoZSB0cmlwbGUgIGtpbmQsIGtleSwgdmFsdWUKKyAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqa2luZCA9ICZtYXBTcmNbbWFwcGluZ1ByZWZpeExlbl07CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIgKnNlcCA9IHN0cmNocihraW5kLCAnLScpOworICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICprZXkgPSBzZXArMTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHNlcCAhPSBOVUxMKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgeGtpbmQgPSBzdGQ6OnN0cmluZyhraW5kLCBzZXAta2luZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCkoc1NoYXBlck9wcy0+c2V0TWFwKShzaGFwZXJIYW5kbGUsIHhraW5kLmNfc3RyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXksIHRhcmdldC5jX3N0cigpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8vI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AgICAgICAgICAgbWVkaWFtZXRyaWNzX3NldEludDMyKG1NZXRyaWNzSGFuZGxlLCBrQ29kZWNTaGFwaW5nRW5oYW5jZWQsIGNoYW5nZUNvdW50KTsKKyAgICAgICAgfQorICAgICAgICBpZiAoY2hhbmdlQ291bnQgPiAwKSB7CisgICAgICAgICAgICBpZiAobU1ldHJpY3NIYW5kbGUgIT0gMCkgeworICAgICAgICAgICAgICAgIC8vIHNhdmUgc29tZSBvbGQgcHJvcGVydGllcyBiZWZvcmUgd2UgZm9sZCBpbiB0aGUgbmV3IG9uZXMKKyAgICAgICAgICAgICAgICBpbnQzMl90IGJpdHJhdGU7CisgICAgICAgICAgICAgICAgaWYgKGZvcm1hdC0+ZmluZEludDMyKEtFWV9CSVRfUkFURSwgJmJpdHJhdGUpKSB7CisgICAgICAgICAgICAgICAgICAgIG1lZGlhbWV0cmljc19zZXRJbnQzMihtTWV0cmljc0hhbmRsZSwga0NvZGVjT3JpZ2luYWxCaXRyYXRlLCBiaXRyYXRlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50MzJfdCBxcElNaW4gPSAtMTsKKyAgICAgICAgICAgICAgICBpZiAoZm9ybWF0LT5maW5kSW50MzIoIm9yaWdpbmFsLXZpZGVvLXFwLWktbWluIiwgJnFwSU1pbikpIHsKKyAgICAgICAgICAgICAgICAgICAgbWVkaWFtZXRyaWNzX3NldEludDMyKG1NZXRyaWNzSGFuZGxlLCBrQ29kZWNPcmlnaW5hbFZpZGVvUVBJTWluLCBxcElNaW4pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpbnQzMl90IHFwSU1heCA9IC0xOworICAgICAgICAgICAgICAgIGlmIChmb3JtYXQtPmZpbmRJbnQzMigib3JpZ2luYWwtdmlkZW8tcXAtaS1tYXgiLCAmcXBJTWF4KSkgeworICAgICAgICAgICAgICAgICAgICBtZWRpYW1ldHJpY3Nfc2V0SW50MzIobU1ldHJpY3NIYW5kbGUsIGtDb2RlY09yaWdpbmFsVmlkZW9RUElNYXgsIHFwSU1heCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludDMyX3QgcXBQTWluID0gLTE7CisgICAgICAgICAgICAgICAgaWYgKGZvcm1hdC0+ZmluZEludDMyKCJvcmlnaW5hbC12aWRlby1xcC1wLW1pbiIsICZxcFBNaW4pKSB7CisgICAgICAgICAgICAgICAgICAgIG1lZGlhbWV0cmljc19zZXRJbnQzMihtTWV0cmljc0hhbmRsZSwga0NvZGVjT3JpZ2luYWxWaWRlb1FQUE1pbiwgcXBQTWluKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50MzJfdCBxcFBNYXggPSAtMTsKKyAgICAgICAgICAgICAgICBpZiAoZm9ybWF0LT5maW5kSW50MzIoIm9yaWdpbmFsLXZpZGVvLXFwLXAtbWF4IiwgJnFwUE1heCkpIHsKKyAgICAgICAgICAgICAgICAgICAgbWVkaWFtZXRyaWNzX3NldEludDMyKG1NZXRyaWNzSGFuZGxlLCBrQ29kZWNPcmlnaW5hbFZpZGVvUVBQTWF4LCBxcFBNYXgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgaW50MzJfdCBxcEJNaW4gPSAtMTsKKyAgICAgICAgICAgICAgICBpZiAoZm9ybWF0LT5maW5kSW50MzIoIm9yaWdpbmFsLXZpZGVvLXFwLWItbWluIiwgJnFwQk1pbikpIHsKKyAgICAgICAgICAgICAgICAgICAgbWVkaWFtZXRyaWNzX3NldEludDMyKG1NZXRyaWNzSGFuZGxlLCBrQ29kZWNPcmlnaW5hbFZpZGVvUVBCTWluLCBxcEJNaW4pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpbnQzMl90IHFwQk1heCA9IC0xOworICAgICAgICAgICAgICAgIGlmIChmb3JtYXQtPmZpbmRJbnQzMigib3JpZ2luYWwtdmlkZW8tcXAtYi1tYXgiLCAmcXBCTWF4KSkgeworICAgICAgIC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BpbmdzIHJldHVybmVkIik7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICBBTE9HVigiUHJlLW1hcHBpbmc6ICVzIiwgIGZvcm1hdC0+ZGVidWdTdHJpbmcoMikuY19zdHIoKSk7CisgICAgLy8gZG8gdGhlIG1hcHBpbmcKKyAgICAvLworICAgIGludCBlbnRyaWVzID0gZm9ybWF0LT5jb3VudEVudHJpZXMoKTsKKyAgICBmb3IgKGludCBpID0gMDsgOyBpICs9IDIpIHsKKyAgICAgICAgaWYgKG1hcHBpbmdzW2ldID09IG51bGxwdHIpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgc2l6ZV90IGl4ID0gZm9ybWF0LT5maW5kRW50cnlCeU5hbWUobWFwcGluZ3NbaV0pOworICAgICAgICBpZiAoaXggPCBlbnRyaWVzKSB7CisgICAgICAgICAgICBBTE9HVigibWFwICclcycgdG8gJyVzJyIsIG1hcHBpbmdzW2ldLCBtYXBwaW5nc1tpKzFdKTsKKyAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGZvcm1hdC0+c2V0RW50cnlOYW1lQXQoaXgsIG1hcHBpbmdzW2krMV0pOworICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBPSykgeworICAgICAgICAgICAgICAgIEFMT0dXKCJVbmFibGUgdG8gbWFwIGZyb20gJyVzJyB0byAnJXMnOiBzdGF0dXMgJWQiLAorICAgICAgICAgICAgICAgICAgICAgIG1hcHBpbmdzW2ldLCBtYXBwaW5nc1tpKzFdLCBzdGF0dXMpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorICAgIEFMT0dWKCJQb3N0LW1hcHBpbmc6ICVzIiwgIGZvcm1hdC0+ZGVidWdTdHJpbmcoMikuY19zdHIoKSk7CisKKworICAgIC8vIHJlY2xhaW0gdGhlIG1hcHBpbmcgbWVtb3J5CisgICAgZm9yIChpbnQgaSA9IDA7IDsgaSArPSAyKSB7CisgICAgICAgIGlmICh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ICAgcmVzcG9uc2UtPnNldEludDMyKCJmbGFncyIsIGZsYWdzKTsKKworICAgICAgICBzdGF0c0J1ZmZlclJlY2VpdmVkKHRpbWVVcywgYnVmZmVyKTsKKwogICAgICAgICByZXNwb25zZS0+cG9zdFJlcGx5KHJlcGx5SUQpOwogICAgIH0KIApAQCAtMjE2NSw4ICsyOTc1LDggQEAKICAgICAgICAgICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50MzIoImVyciIsICZlcnIpKTsKICAgICAgICAgICAgICAgICAgICAgQ0hFQ0sobXNnLT5maW5kSW50MzIoImFjdGlvbkNvZGUiLCAmYWN0aW9uQ29kZSkpOwogCi0gICAgICAgICAgICAgICAgICAgIEFMT0dFKCJDb2RlYyByZXBvcnRlZCBlcnIgJSN4LCBhY3Rpb25Db2RlICVkLCB3aGlsZSBpbiBzdGF0ZSAlZCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyLCBhY3Rpb25Db2RlLCBtU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBBTE9HRSgiQ29kZWMgcmVwb3J0ZWQgZXJyICUjeCwgYWN0aW9uQ29kZSAlZCwgd2hpbGUgaW4gc3RhdGUgJWQvJXMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciwgYWN0aW9uQ29kZSwgbVN0YXRlLCBzdGF0ZVN0cmluZyhtU3RhdGUpLmNfc3RyKCkpOwogICAgICAgICAgICAgICAgICAgICBpZiAoZXJyID09IERFQURfT0JKRUNUKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtRmxhZ3MgfD0ga0ZsYWdTYXdNZWRpYVNlcnZlckRpZTsKICAgICAgICAgICAgICAgICAgICAgICAgIG1GbGFncyAmPSB+a0ZsYWdJc0NvbXBvbmVudEFsbG9jYXRlZDsKQEAgLTIyMjIsNiArMzAzMiwxMSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBTVE9QUElORzoKICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUZsYWdzICYga0ZsYWdTYXdNZWRpYVNlcnZlckRpZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHBvc3RQZW5kaW5nUmVwbGllcyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gUkVMRUFTSU5HICYmICFtUmVwbHlJRCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR0QoIlJlbGVhc2luZyBhc3luY2hyb25vdXNseSwgc28gbm90aGluZyB0byByZXBseSBoZXJlLiIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zdFBlbmRpbmdSZXBsaWVzID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gTWVkaWFTZXJ2ZXIgZGllZCwgdGhlcmUgZGVmaW5pdGVseSB3b24ndAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBiZSBhIHNodXRkb3duIGNvbXBsZXRlIG5vdGlmaWNhdGlvbiBhZnRlcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBhbGwuCkBAIC0yMjMzLDcgKzMwNDgsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBSRUxFQVNJTkcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db21wb25lbnROYW1lLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zdFBlbmRpbmdSZXBsaWVzQW5kRGVmZXJyZWRNZXNzYWdlcyhvcmlnaW4gKyAiOmRlYWQiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBvc3RQZW5kaW5nUmVwbGllcykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zdFBlbmRpbmdSZXBsaWVzQW5kRGVmZXJyZWRNZXNzYWdlcyhvcmlnaW4gKyAiOmRlYWQiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kRXJyb3JSZXNwb25zZSA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIW1SZXBseUlEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRFcnJvclJlc3BvbnNlID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwpAQCAtMjMzNCw4ICszMTUzLDggQEAKICAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBSRUxFQVNJTkcgfHwgbVN0YXRlID09IFVOSU5JVElBTElaRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEluIGNhc2UgYSBrV2hhdEVycm9yIG9yIGtXaGF0UmVsZWFzZSBtZXNzYWdlIGNhbWUgaW4gYW5kIHJlcGxpZWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAvLyB3ZSBsb2cgYSB3YXJuaW5nIGFuZCBpZ25vcmUuCi0gICAgICAgICAgICAgICAgICAgICAgICBBTE9HVygiYWxsb2NhdGUgaW50ZXJydXB0ZWQgYnkgZXJyb3Igb3IgcmVsZWFzZSwgY3VycmVudCBzdGF0ZSAlZCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU3RhdGUpOworICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coImFsbG9jYXRlIGludGVycnVwdGVkIGJ5IGVycm9yIG9yIHJlbGVhc2UsIGN1cnJlbnQgc3RhdGUgJWQvJXMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXRlLCBzdGF0ZVN0cmluZyhtU3RhdGUpLmNfc3RyKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgQ0hFQ0tfRVEobVN0YXRlLCBJTklUSUFMSVpJTkcpOwpAQCAtMjM4MSw4ICszMjAwLDggQEAKICAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBSRUxFQVNJTkcgfHwgbVN0YXRlID09IFVOSU5JVElBTElaRUQgfHwgbVN0YXRlID09IElOSVRJQUxJWkVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJbiBjYXNlIGEga1doYXRFcnJvciBvciBrV2hhdFJlbGVhc2UgbWVzc2FnZSBjYW1lIGluIGFuZCByZXBsaWVkLAogICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2UgbG9nIGEgd2FybmluZyBhbmQgaWdub3JlLgotICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coImNvbmZpZ3VyZSBpbnRlcnJ1cHRlZCBieSBlcnJvciBvciByZWxlYXNlLCBjdXJyZW50IHN0YXRlICVkIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVygiY29uZmlndXJlIGludGVycnVwdGVkIGJ5IGVycm9yIG9yIHJlbGVhc2UsIGN1cnJlbnQgc3RhdGUgJWQvJXMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXRlLCBzdGF0ZVN0cmluZyhtU3RhdGUpLmNfc3RyKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgQ0hFQ0tfRVEobVN0YXRlLCBDT05GSUdVUklORyk7CkBAIC0yMzk3LDcgKzMyMTYsNyBAQAogICAgICAgICAgICAgICAgICAgICBpZiAobVN1cmZhY2UgIT0gbnVsbHB0ciAmJiAhbUFsbG93RnJhbWVEcm9wcGluZ0J5U3VyZmFjZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2lnbmFsIGZyYW1lIGRyb3BwaW5nIG1vZGUgaW4gdGhlIGlucHV0IGZvcm1hdCBhcyB0aGlzIG1heSBhbHNvIGJlCiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtZWFuaW5nZnVsIGFuZCBjb25mdXNpbmcgZm9yIGFuIGVuY29kZXIgaW4gYSB0cmFuc2NvZGVyIHNjZW5hcmlvCi0gICAgICAgICAgICAgICAgICAgICAgICBtSW5wdXRGb3JtYXQtPnNldEludDMyKCJhbGxvdy1mcmFtZS1kcm9wIiwgbUFsbG93RnJhbWVEcm9wcGluZ0J5U3VyZmFjZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBtSW5wdXRGb3JtYXQtPnNldEludDMyKEtFWV9BTExPV19GUkFNRV9EUk9QLCBtQWxsb3dGcmFtZURyb3BwaW5nQnlTdXJmYWNlKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBzcDxBTWVzc2FnZT4gaW50ZXJlc3RpbmdGb3JtYXQgPQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIChtRmxhZ3MgJiBrRmxhZ0lzRW5jb2RlcikgPyBtT3V0cHV0Rm9ybWF0IDogbUlucHV0Rm9ybWF0OwpAQCAtMjUyOSw3ICszMzQ4LDggQEAKICAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBSRUxFQVNJTkcgfHwgbVN0YXRlID09IFVOSU5JVElBTElaRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEluIGNhc2UgYSBrV2hhdFJlbGVhc2UgbWVzc2FnZSBjYW1lIGluIGFuZCByZXBsaWVkLAogICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2UgbG9nIGEgd2FybmluZyBhbmQgaWdub3JlLgotICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coInN0YXJ0IGludGVycnVwdGVkIGJ5IHJlbGVhc2UsIGN1cnJlbnQgc3RhdGUgJWQiLCBtU3RhdGUpOworICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coInN0YXJ0IGludGVycnVwdGVkIGJ5IHJlbGVhc2UsIGN1cnJlbnQgc3RhdGUgJWQvJXMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXRlLCBzdGF0ZVN0cmluZyhtU3RhdGUpLmNfc3RyKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgIH0KIApAQCAtMjU1Miw5ICszMzcyLDE4IEBACiAKICAgICAgICAgICAgICAgICBjYXNlIGtXaGF0T3V0cHV0RnJhbWVzUmVuZGVyZWQ6CiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAvLyBpZ25vcmUgdGhlc2UgaW4gYWxsIHN0YXRlcyBleGNlcHQgcnVubmluZywgYW5kIGNoZWNrIHRoYXQgd2UgaGF2ZSBhCi0gICAgICAgICAgICAgICAgICAgIC8vIG5vdGlmaWNhdGlvbiBzZXQKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBTVEFSVEVEICYmIG1PbkZyYW1lUmVuZGVyZWROb3RpZmljYXRpb24gIT0gTlVMTCkgeworICAgICAgICAgICAgICAgICAgICAvLyBpZ25vcmUgdGhlc2UgaW4gYWxsIHN0YXRlcyBleGNlcHQgcnVubmluZworICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXRlICE9IFNUQVJURUQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIFR1bm5lbFBlZWtTdGF0ZSBwcmV2aW91c1N0YXRlID0gbVR1bm5lbFBlZWtTdGF0ZTsKKyAgICAgICAgICAgICAgICAgICAgbVR1bm5lbFBlZWtTdGF0ZSA9IFR1bm5lbFBlZWtTdGF0ZTo6a0J1ZmZlclJlbmRlcmVkOworICAgICAgICAgICAgICAgICAgICBBTE9HVigiVHVubmVsUGVla1N0YXRlOiAlcyAtPiAlcyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGFzU3RyaW5nKHByZXZpb3VzU3RhdGUpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBhc1N0cmluZyhUdW5uZWxQZWVrU3RhdGU6OmtCdWZmZXJSZW5kZXJlZCkpOworICAgICAgICAgICAgICAgICAgICB1cGRhdGVQbGF5YmFja0R1cmF0aW9uKG1zZyk7CisgICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIHRoYXQgd2UgaGF2ZSBhIG5vdGlmaWNhdGlvbiBzZXQKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1PbkZyYW1lUmVuZGVyZWROb3RpZmljYXRpb24gIT0gTlVMTCkgewogICAgICAgICAgICAgICAgICAgICAgICAgc3A8QU1lc3NhZ2U+IG5vdGlmeSA9IG1PbkZyYW1lUmVuZGVyZWROb3RpZmljYXRpb24tPmR1cCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZ5LT5zZXRNZXNzYWdlKCJkYXRhIiwgbXNnKTsKICAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmeS0+cG9zdCgpOwpAQCAtMjU2Miw2ICszMzkxLDQ4IEBACiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIH0KIAorICAgICAgICAgICAgICAgIGNhc2Uga1doYXRGaXJzdFR1bm5lbEZyYW1lUmVhZHk6CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXRlICE9IFNUQVJURUQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIFR1bm5lbFBlZWtTdGF0ZSBwcmV2aW91c1N0YXRlID0gbVR1bm5lbFBlZWtTdGF0ZTsKKyAgICAgICAgICAgICAgICAgICAgc3dpdGNoKG1UdW5uZWxQZWVrU3RhdGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVHVubmVsUGVla1N0YXRlOjprRGlzYWJsZWROb0J1ZmZlcjoKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVHVubmVsUGVla1N0YXRlOjprRGlzYWJsZWRRdWV1ZWQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVR1bm5lbFBlZWtTdGF0ZSA9IFR1bm5lbFBlZWtTdGF0ZTo6a0J1ZmZlckRlY29kZWQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIkZpcnN0IHR1bm5lbCBmcmFtZSByZWFkeSIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dWKCJUdW5uZWxQZWVrU3RhdGU6ICVzIC0+ICVzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhc1N0cmluZyhwcmV2aW91c1N0YXRlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhc1N0cmluZyhtVHVubmVsUGVla1N0YXRlKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFR1bm5lbFBlZWtTdGF0ZTo6a0VuYWJsZWROb0J1ZmZlcjoKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVHVubmVsUGVla1N0YXRlOjprRW5hYmxlZFF1ZXVlZDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwPEFNZXNzYWdlPiBwYXJhbWV0ZXJzID0gbmV3IEFNZXNzYWdlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlcnMtPnNldEludDMyKCJhbmRyb2lkLl90cmlnZ2VyLXR1bm5lbC1wZWVrIiwgMSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db2RlYy0+c2lnbmFsU2V0UGFyYW1ldGVycyhwYXJhbWV0ZXJzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVR1bm5lbFBlZWtTdGF0ZSA9IFR1bm5lbFBlZWtTdGF0ZTo6a0J1ZmZlclJlbmRlcmVkOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dWKCJGaXJzdCB0dW5uZWwgZnJhbWUgcmVhZHkiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiVHVubmVsUGVla1N0YXRlOiAlcyAtPiAlcyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXNTdHJpbmcocHJldmlvdXNTdGF0ZSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXNTdHJpbmcobVR1bm5lbFBlZWtTdGF0ZSkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiSWdub3JpbmcgZmlyc3QgdHVubmVsIGZyYW1lIHJlYWR5LCBUdW5uZWxQZWVrU3RhdGU6ICVzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhc1N0cmluZyhtVHVubmVsUGVla1N0YXRlKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpZiAobU9uRmlyc3RUdW5uZWxGcmFtZVJlYWR5Tm90aWZpY2F0aW9uICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNwPEFNZXNzYWdlPiBub3RpZnkgPSBtT25GaXJzdFR1bm5lbEZyYW1lUmVhZHlOb3RpZmljYXRpb24tPmR1cCgpOworICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZ5LT5zZXRNZXNzYWdlKCJkYXRhIiwgbXNnKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmeS0+cG9zdCgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgICAgIGNhc2Uga1doYXRGaWxsVGhpc0J1ZmZlcjoKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIC8qIHNpemVfdCBpbmRleCA9ICovdXBkYXRlQnVmZmVycyhrUG9ydEluZGV4SW5wdXQsIG1zZyk7CkBAIC0yNjcxLDcgKzM1NDIsOCBAQAogICAgICAgICAgICAgICAgIGNhc2Uga1doYXRTdG9wQ29tcGxldGVkOgogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0ZSAhPSBTVE9QUElORykgewotICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coIlJlY2VpdmVkIGtXaGF0U3RvcENvbXBsZXRlZCBpbiBzdGF0ZSAlZCIsIG1TdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVygiUmVjZWl2ZWQga1doYXRTdG9wQ29tcGxldGVkIGluIHN0YXRlICVkLyVzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGF0ZSwgc3RhdGVTdHJpbmcobVN0YXRlKS5jX3N0cigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIHNldFN0YXRlKElOSVRJQUxJWkVEKTsKQEAgLTI2ODgsNyArMzU2MCw4IEBACiAgICAgICAgICAgICAgICAgY2FzZSBrV2hhdFJlbGVhc2VDb21wbGV0ZWQ6CiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXRlICE9IFJFTEVBU0lORykgewotICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coIlJlY2VpdmVkIGtXaGF0UmVsZWFzZUNvbXBsZXRlZCBpbiBzdGF0ZSAlZCIsIG1TdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVygiUmVjZWl2ZWQga1doYXRSZWxlYXNlQ29tcGxldGVkIGluIHN0YXRlICVkLyVzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGF0ZSwgc3RhdGVTdHJpbmcobVN0YXRlKS5jX3N0cigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIHNldFN0YXRlKFVOSU5JVElBTElaRUQpOwpAQCAtMjcxOCw4ICszNTkxLDggQEAKICAgICAgICAgICAgICAgICBjYXNlIGtXaGF0Rmx1c2hDb21wbGV0ZWQ6CiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXRlICE9IEZMVVNISU5HKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBBTE9HVygicmVjZWl2ZWQgRmx1c2hDb21wbGV0ZWQgbWVzc2FnZSBpbiBzdGF0ZSAlZCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVygicmVjZWl2ZWQgRmx1c2hDb21wbGV0ZWQgbWVzc2FnZSBpbiBzdGF0ZSAlZC8lcyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGF0ZSwgc3RhdGVTdHJpbmcobVN0YXRlKS5jX3N0cigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICB9CiAKQEAgLTI3NzgsNiArMzY1MSw5IEBACiAgICAgICAgICAgICBpZiAobXNnLT5maW5kTWVzc2FnZSgib24tZnJhbWUtcmVuZGVyZWQiLCAmbm90aWZ5KSkgewogICAgICAgICAgICAgICAgIG1PbkZyYW1lUmVuZGVyZWROb3RpZmljYXRpb24gPSBub3RpZnk7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobXNnLT5maW5kTWVzc2FnZSgiZmlyc3QtdHVubmVsLWZyYW1lLXJlYWR5IiwgJm5vdGlmeSkpIHsKKyAgICAgICAgICAgICAgICBtT25GaXJzdFR1bm5lbEZyYW1lUmVhZHlOb3RpZmljYXRpb24gPSBub3RpZnk7CisgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogCkBAIC0yODM5LDcgKzM3MTUsNyBAQAogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBpZiAob2JqICE9IE5VTEwpIHsKLSAgICAgICAgICAgICAgICBpZiAoIWZvcm1hdC0+ZmluZEludDMyKCJhbGxvdy1mcmFtZS1kcm9wIiwgJm1BbGxvd0ZyYW1lRHJvcHBpbmdCeVN1cmZhY2UpKSB7CisgICAgICAgICAgICAgICAgaWYgKCFmb3JtYXQtPmZpbmRJbnQzMihLRVlfQUxMT1dfRlJBTUVfRFJPUCwgJm1BbGxvd0ZyYW1lRHJvcHBpbmdCeVN1cmZhY2UpKSB7CiAgICAgICAgICAgICAgICAgICAgIC8vIGFsbG93IGZyYW1lIGRyb3BwaW5nIGJ5IHN1cmZhY2UgYnkgZGVmYXVsdAogICAgICAgICAgICAgICAgICAgICBtQWxsb3dGcmFtZURyb3BwaW5nQnlTdXJmYWNlID0gdHJ1ZTsKICAgICAgICAgICAgICAgICB9CkBAIC0yODk5LDYgKzM3NzUsMTkgQEAKIAogICAgICAgICAgICAgZXh0cmFjdENTRChmb3JtYXQpOwogCisgICAgICAgICAgICBpbnQzMl90IHR1bm5lbGVkOworICAgICAgICAgICAgaWYgKGZvcm1hdC0+ZmluZEludDMyKCJmZWF0dXJlLXR1bm5lbGVkLXBsYXliYWNrIiwgJnR1bm5lbGVkKSAmJiB0dW5uZWxlZCAhPSAwKSB7CisgICAgICAgICAgICAgICAgQUxPR0koIkNvbmZpZ3VyaW5nIFRVTk5FTEVEIHZpZGVvIHBsYXliYWNrLiIpOworICAgICAgICAgICAgICAgIG1UdW5uZWxlZCA9IHRydWU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1UdW5uZWxlZCA9IGZhbHNlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQzMl90IGJhY2tncm91bmQgPSAwOworICAgICAgICAgICAgaWYgKGZvcm1hdC0+ZmluZEludDMyKCJhbmRyb2lkLl9iYWNrZ3JvdW5kLW1vZGUiLCAmYmFja2dyb3VuZCkgJiYgYmFja2dyb3VuZCkgeworICAgICAgICAgICAgICAgIGFuZHJvaWRTZXRUaHJlYWRQcmlvcml0eShnZXR0aWQoKSwgQU5EUk9JRF9QUklPUklUWV9CQUNLR1JPVU5EKTsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgbUNvZGVjLT5pbml0aWF0ZUNvbmZpZ3VyZUNvbXBvbmVudChmb3JtYXQpOwogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KQEAgLTMwMTEsNiArMzkwMCwxMSBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgc3A8QVJlcGx5VG9rZW4+IHJlcGx5SUQ7CiAgICAgICAgICAgICBDSEVDSyhtc2ctPnNlbmRlckF3YWl0c1Jlc3BvbnNlKCZyZXBseUlEKSk7CisgICAgICAgICAgICBUdW5uZWxQZWVrU3RhdGUgcHJldmlvdXNTdGF0ZSA9IG1UdW5uZWxQZWVrU3RhdGU7CisgICAgICAgICAgICBtVHVubmVsUGVla1N0YXRlID0gVHVubmVsUGVla1N0YXRlOjprRW5hYmxlZE5vQnVmZmVyOworICAgICAgICAgICAgQUxPR1YoIlR1bm5lbFBlZWtTdGF0ZTogJXMgLT4gJXMiLAorICAgICAgICAgICAgICAgICAgYXNTdHJpbmcocHJldmlvdXNTdGF0ZSksCisgICAgICAgICAgICAgICAgICBhc1N0cmluZyhUdW5uZWxQZWVrU3RhdGU6OmtFbmFibGVkTm9CdWZmZXIpKTsKIAogICAgICAgICAgICAgbVJlcGx5SUQgPSByZXBseUlEOwogICAgICAgICAgICAgc2V0U3RhdGUoU1RBUlRJTkcpOwpAQCAtMzA2Niw3ICszOTYwLDEzIEBACiAgICAgICAgICAgICBpbnQzMl90IHJlY2xhaW1lZCA9IDA7CiAgICAgICAgICAgICBtc2ctPmZpbmRJbnQzMigicmVjbGFpbWVkIiwgJnJlY2xhaW1lZCk7CiAgICAgICAgICAgICBpZiAocmVjbGFpbWVkKSB7Ci0gICAgICAgICAgICAgICAgbVJlbGVhc2VkQnlSZXNvdXJjZU1hbmFnZXIgPSB0cnVlOworICAgICAgICAgICAgICAgIGlmICghbVJlbGVhc2VkQnlSZXNvdXJjZU1hbmFnZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gbm90aWZ5IHRoZSBhc3luYyBjbGllbnQKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1GbGFncyAmIGtGbGFnSXNBc3luYykgeworICAgICAgICAgICAgICAgICAgICAgICAgb25FcnJvcihERUFEX09CSkVDVCwgQUNUSU9OX0NPREVfRkFUQUwpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIG1SZWxlYXNlZEJ5UmVzb3VyY2VNYW5hZ2VyID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgICAgICBpbnQzMl90IGZvcmNlID0gMDsKICAgICAgICAgICAgICAgICBtc2ctPmZpbmRJbnQzMigiZm9yY2UiLCAmZm9yY2UpOwpAQCAtMzA3OCwxMCArMzk3OCw2IEBACiAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlLT5zZXRJbnQzMigiZXJyIiwgV09VTERfQkxPQ0spOwogICAgICAgICAgICAgICAgICAgICByZXNwb25zZS0+cG9zdFJlcGx5KHJlcGx5SUQpOwogCi0gICAgICAgICAgICAgICAgICAgIC8vIG5vdGlmeSB0aGUgYXN5bmMgY2xpZW50Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtRmxhZ3MgJiBrRmxhZ0lzQXN5bmMpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG9uRXJyb3IoREVBRF9PQkpFQ1QsIEFDVElPTl9DT0RFX0ZBVEFMKTsKLSAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CkBAIC0zMTEyLDE2ICs0MDA4LDIxIEBACiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIC8vIElmIHdlJ3JlIGZsdXNoaW5nLCBzdG9wcGluZywgY29uZmlndXJpbmcgb3Igc3RhcnRpbmcgIGJ1dAorICAgICAgICAgICAgLy8gSWYgd2UncmUgZmx1c2hpbmcsIGNvbmZpZ3VyaW5nIG9yIHN0YXJ0aW5nICBidXQKICAgICAgICAgICAgIC8vIHJlY2VpdmVkIGEgcmVsZWFzZSByZXF1ZXN0LCBwb3N0IHRoZSByZXBseSBmb3IgdGhlIHBlbmRpbmcgY2FsbAogICAgICAgICAgICAgLy8gZmlyc3QsIGFuZCBjb25zaWRlciBpdCBkb25lLiBUaGUgcmVwbHkgdG9rZW4gd2lsbCBiZSByZXBsYWNlZAogICAgICAgICAgICAgLy8gYWZ0ZXIgdGhpcywgYW5kIHdlJ2xsIG5vIGxvbmdlciBiZSBhYmxlIHRvIHJlcGx5LgotICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBGTFVTSElORyB8fCBtU3RhdGUgPT0gU1RPUFBJTkcKLSAgICAgICAgICAgICAgICAgICAgfHwgbVN0YXRlID09IENPTkZJR1VSSU5HIHx8IG1TdGF0ZSA9PSBTVEFSVElORykgeworICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBGTFVTSElORyB8fCBtU3RhdGUgPT0gQ09ORklHVVJJTkcgfHwgbVN0YXRlID09IFNUQVJUSU5HKSB7CiAgICAgICAgICAgICAgICAgLy8gbVJlcGx5IGlzIGFsd2F5cyBzZXQgaWYgaW4gdGhlc2Ugc3RhdGVzLgogICAgICAgICAgICAgICAgIHBvc3RQZW5kaW5nUmVwbGllc0FuZERlZmVycmVkTWVzc2FnZXMoCiAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZygia1doYXRSZWxlYXNlOiIpICsgc3RhdGVTdHJpbmcobVN0YXRlKSk7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBJZiB3ZSdyZSBzdG9wcGluZyBidXQgcmVjZWl2ZWQgYSByZWxlYXNlIHJlcXVlc3QsIHBvc3QgdGhlIHJlcGx5CisgICAgICAgICAgICAvLyBmb3IgdGhlIHBlbmRpbmcgY2FsbCBpZiBuZWNlc3NhcnkuIE5vdGUgdGhhdCB0aGUgcmVwbHkgbWF5IGhhdmUgYmVlbgorICAgICAgICAgICAgLy8gYWxyZWFkeSBwb3N0ZWQgZHVlIHRvIGFuIGVycm9yLgorICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBTVE9QUElORyAmJiBtUmVwbHlJRCkgeworICAgICAgICAgICAgICAgIHBvc3RQZW5kaW5nUmVwbGllc0FuZERlZmVycmVkTWVzc2FnZXMoImtXaGF0UmVsZWFzZTpTVE9QUElORyIpOworICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBpZiAobUZsYWdzICYga0ZsYWdTYXdNZWRpYVNlcnZlckRpZSkgewogICAgICAgICAgICAgICAgIC8vIEl0J3MgZGVhZCwgSmltLiBEb24ndCBleHBlY3QgaW5pdGlhdGVTaHV0ZG93biB0byB5aWVsZApAQCAtMzQzOCw2ICs0MzM5LDExIEBACiAKICAgICAgICAgICAgIG1Db2RlYy0+c2lnbmFsRmx1c2goKTsKICAgICAgICAgICAgIHJldHVybkJ1ZmZlcnNUb0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FnSXNTZWN1cmUpKSB7CisgICAgICAgIGlmICgoZmxhZ3MgJiBCVUZGRVJfRkxBR19DT0RFQ0NPTkZJRykgJiYgIShtRmxhZ3MgJiBrRmxhZ0lzU2VjdXJlKQorICAgICAgICAgICAgICAgICYmICFtT3duZXJOYW1lLnN0YXJ0c1dpdGgoImNvZGVjMjo6IikpIHsKICAgICAgICAgICAgIHN0YXR1c190IGVyciA9CiAgICAgICAgICAgICAgICAgYW1lbmRPdXRwdXRGb3JtYXRXaXRoQ29kZWNTcGVjaWZpY0RhdGEoYnVmZmVyKTsKIApAQCAtMzk3OCwxMSArNDg4Niw0NCBAQAogICAgICAgICBidWZmZXItPm1ldGEoKS0+c2V0SW50MzIoImNzZCIsIHRydWUpOwogICAgIH0KIAorICAgIGlmIChtVHVubmVsZWQpIHsKKyAgICAgICAgVHVubmVsUGVla1N0YXRlIHByZXZpb3VzU3RhdGUgPSBtVHVubmVsUGVla1N0YXRlOworICAgICAgICBzd2l0Y2gobVR1bm5lbFBlZWtTdGF0ZSl7CisgICAgICAgICAgICBjYXNlIFR1bm5lbFBlZWtTdGF0ZTo6a0VuYWJsZWROb0J1ZmZlcjoKKyAgICAgICAgICAgICAgICBidWZmZXItPm1ldGEoKS0+c2V0SW50MzIoInR1bm5lbC1maXJzdC1mcmFtZSIsIDEpOworICAgICAgICAgICAgICAgIG1UdW5uZWxQZWVrU3RhdGUgPSBUdW5uZWxQZWVrU3RhdGU6OmtFbmFibGVkUXVldWVkOworICAgICAgICAgICAgICAgIEFMT0dWKCJUdW5uZWxQZWVrU3RhdGU6ICVzIC0+ICVzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgIGFzU3RyaW5nKHByZXZpb3VzU3RhdGUpLAorICAgICAgICAgICAgICAgICAgICAgICAgYXNTdHJpbmcobVR1bm5lbFBlZWtTdGF0ZSkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBUdW5uZWxQZWVrU3RhdGU6OmtEaXNhYmxlZE5vQnVmZmVyOgorICAgICAgICAgICAgICAgIGJ1ZmZlci0+bWV0YSgpLT5zZXRJbnQzMigidHVubmVsLWZpcnN0LWZyYW1lIiwgMSk7CisgICAgICAgICAgICAgICAgbVR1bm5lbFBlZWtTdGF0ZSA9IFR1bm5lbFBlZWtTdGF0ZTo6a0Rpc2FibGVkUXVldWVkOworICAgICAgICAgICAgICAgIEFMT0dWKCJUdW5uZWxQZWVrU3RhdGU6ICVzIC0+ICVzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgIGFzU3RyaW5nKHByZXZpb3VzU3RhdGUpLAorICAgICAgICAgICAgICAgICAgICAgICAgYXNTdHJpbmcobVR1bm5lbFBlZWtTdGF0ZSkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKwogICAgIHN0YXR1c190IGVyciA9IE9LOwogICAgIGlmIChoYXNDcnlwdG9PckRlc2NyYW1ibGVyKCkgJiYgIWMyQnVmZmVyICYmICFtZW1vcnkpIHsKICAgICAgICAgQVN0cmluZyAqZXJyb3JEZXRhaWxNc2c7CiAgICAgICAgIENIRUNLKG1zZy0+ZmluZFBvaW50ZXIoImVycm9yRGV0YWlsTXNnIiwgKHZvaWQgKiopJmVycm9yRGV0YWlsTXNnKSk7Ci0KKyAgICAgICAgLy8gTm90aWZ5IG1DcnlwdG8gb2YgdmlkZW8gcmVzb2x1dGlvbiBjaGFuZ2VzCisgICAgICAgIGlmIChtVHVubmVsZWQgJiYgbUNyeXB0byAhPSBOVUxMKSB7CisgICAgICAgICAgICBpbnQzMl90IHdpZHRoLCBoZWlnaHQ7CisgICAgICAgICAgICBpZiAobUlucHV0Rm9ybWF0LT5maW5kSW50MzIoIndpZHRoIiwgJndpZHRoKSAmJgorICAgICAgICAgICAgICAgIG1JbnB1dEZvcm1hdC0+ZmluZEludDMyKCJoZWlnaHQiLCAmaGVpZ2h0KSAmJiB3aWR0aCA+IDAgJiYgaGVpZ2h0ID4gMCkgeworICAgICAgICAgICAgICAgIGlmICh3aWR0aCAhPSBtVHVubmVsZWRJbnB1dFdpZHRoIHx8IGhlaWdodCAhPSBtVHVubmVsZWRJbnB1dEhlaWdodCkgeworICAgICAgICAgICAgICAgICAgICBtVHVubmVsZWRJbnB1dFdpZHRoID0gd2lkdGg7CisgICAgICAgICAgICAgICAgICAgIG1UdW5uZWxlZElucHV0SGVpZ2h0ID0gaGVpZ2h0OworICAgICAgICAgICAgICAgICAgICBtQ3J5cHRvLT5ub3RpZnlSZXNvbHV0aW9uKHdpZHRoLCBoZWlnaHQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogICAgICAgICBlcnIgPSBtQnVmZmVyQ2hhbm5lbC0+cXVldWVTZWN1cmVJbnB1dEJ1ZmZlcigKICAgICAgICAgICAgICAgICBidWZmZXIsCiAgICAgICAgICAgICAgICAgKG1GbGFncyAmIGtGbGFnSXNTZWN1cmUpLApAQCAtNDAxMSw3ICs0OTUyLDcgQEAKICAgICAgICAgaW5mby0+bU93bmVkQnlDbGllbnQgPSBmYWxzZTsKICAgICAgICAgaW5mby0+bURhdGEuY2xlYXIoKTsKIAotICAgICAgICBzdGF0c0J1ZmZlclNlbnQodGltZVVzKTsKKyAgICAgICAgc3RhdHNCdWZmZXJTZW50KHRpbWVVcywgYnVmZmVyKTsKICAgICB9CiAKICAgICByZXR1cm4gZXJyOwpAQCAtNDEwMiw3ICs1MDQzLDE1IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIG1CdWZmZXJDaGFubmVsLT5yZW5kZXJPdXRwdXRCdWZmZXIoYnVmZmVyLCByZW5kZXJUaW1lTnMpOworICAgICAgICBzdGF0dXNfdCBlcnIgPSBtQnVmZmVyQ2hhbm5lbC0+cmVuZGVyT3V0cHV0QnVmZmVyKGJ1ZmZlciwgcmVuZGV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GlzdD4gbGlzdCA9IGdldEluc3RhbmNlKCk7CkBAIC0zNjUsMTQgKzM3NywyMiBAQAogCiAgICAgICAgIGNvbnN0IHNwPE1lZGlhQ29kZWNJbmZvPiBpbmZvID0gbGlzdC0+Z2V0Q29kZWNJbmZvKG1hdGNoSW5kZXgpOwogICAgICAgICBDSEVDSyhpbmZvICE9IG51bGxwdHIpOworCiAgICAgICAgIEFTdHJpbmcgY29tcG9uZW50TmFtZSA9IGluZm8tPmdldENvZGVjTmFtZSgpOwogCisgICAgICAgIGlmICghY29kZWNIYW5kbGVzRm9ybWF0KG1pbWUsIGluZm8sIGZvcm1hdCkpIHsKKyAgICAgICAgICAgIEFMT0dWKCJza2lwcGluZyBjb2RlYyAnJXMnIHdoaWNoIGRvZXNuJ3Qgc2F0aXNmeSBmb3JtYXQgJXMiLAorICAgICAgICAgICAgICAgICAgY29tcG9uZW50TmFtZS5jX3N0cigpLCBmb3JtYXQtPmRlYnVnU3RyaW5nKDIpLmNfc3RyKCkpOworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKwogICAgICAgICBpZiAoKGZsYWdzICYga0hhcmR3YXJlQ29kZWNzT25seSkgJiYgaXNTb2Z0d2FyZUNvZGVjKGNvbXBvbmVudE5hbWUpKSB7CiAgICAgICAgICAgICBBTE9HVigic2tpcHBpbmcgU1cgY29kZWMgJyVzJyIsIGNvbXBvbmVudE5hbWUuY19zdHIoKSk7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBtYXRjaGVzLT5wdXNoKGNvbXBvbmVudE5hbWUpOwotICAgICAgICAgICAgQUxPR1YoIm1hdGNoaW5nICclcyciLCBjb21wb25lbnROYW1lLmNfc3RyKCkpOworICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgIH0KKworICAgICAgICBtYXRjaGVzLT5wdXNoKGNvbXBvbmVudE5hbWUpOworICAgICAgICBBTE9HVigibWF0Y2hpbmcgJyVzJyIsIGNvbXBvbmVudE5hbWUuY19zdHI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gICAgICAgICAgICAgICAgQUxPR1coIlVuYWJsZSB0byBwYXJzZSBzaXplLXJhbmdlIGZyb20gY29kZWMgaW5mbyIpOworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICghc3BsaXRTdHJpbmcobWluU2l6ZSwgIngiLCAmbWluV2lkdGgsICZtaW5IZWlnaHQpKSB7CisgICAgICAgICAgICAgICAgaWYgKCFzcGxpdFN0cmluZyhtaW5TaXplLCAiKiIsICZtaW5XaWR0aCwgJm1pbkhlaWdodCkpIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1coIlVuYWJsZSB0byBwYXJzZSBzaXplLXJhbmdlL21pbi1zaXplIGZyb20gY29kZWMgaW5mbyIpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCFzcGxpdFN0cmluZyhtYXhTaXplLCAieCIsICZtYXhXaWR0aCwgJm1heEhlaWdodCkpIHsKKyAgICAgICAgICAgICAgICBpZiAoIXNwbGl0U3RyaW5nKG1heFNpemUsICIqIiwgJm1heFdpZHRoLCAmbWF4SGVpZ2h0KSkgeworICAgICAgICAgICAgICAgICAgICBBTE9HVygiVW5hYmxlIHRvIGZ1bGx5IHBhcnNlIHNpemUtcmFuZ2UvbWF4LXNpemUgZnJvbSBjb2RlYyBpbmZvIik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIHN0cnRvbCgpIHJldHVybnMgMCBpZiB1bmFibGUgdG8gcGFyc2UgYSBudW1iZXIsIHdoaWNoIHdvcmtzIGZvciBvdXIgbGF0ZXIgdGVzdHMKKyAgICAgICAgICAgIGludCBtaW5XID0gc3RydG9sKG1pbldpZHRoLmNfc3RyKCksIE5VTEwsIDEwKTsKKyAgICAgICAgICAgIGludCBtaW5IID0gc3RydG9sKG1pbkhlaWdodC5jX3N0cigpLCBOVUxMLCAxMCk7CisgICAgICAgICAgICBpbnQgbWF4VyA9IHN0cnRvbChtYXhXaWR0aC5jX3N0cigpLCBOVUxMLCAxMCk7CisgICAgICAgICAgICBpbnQgbWF4SCA9IHN0cnRvbChtYXhIZWlnaHQuY19zdHIoKSwgTlVMTCwgMTApOworCisgICAgICAgICAgICBpZiAobWluVyA9PSAwIHx8IG1pbkggPT0gMCB8fCBtYXhXID09IDAgfHwgbWF4SCA9PSAwKSB7CisgICAgICAgICAgICAgICAgQUxPR1coIlVuYWJsZSB0byBwYXJzZSB2YWx1ZXMgZnJvbSBzaXplLXJhbmdlIGZyb20gY29kZWMgaW5mbyIpOworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gZmluYWxseSwgY29tcGFyaXNvbiB0aW1lCisgICAgICAgICAgICBpZiAod2lkdGggPCBtaW5XIHx8IHdpZHRoID4gbWF4VyB8fCBoZWlnaHQgPCBtaW5IIHx8IGhlaWdodCA+IG1heEgpIHsKKyAgICAgICAgICAgICAgICBBTE9HVigiZm9ybWF0ICVkeCVkIG91dHNpZGUgb2YgYWxsb3dlZCAlZHglZC0lZHglZCIsCisgICAgICAgICAgICAgICAgICAgICAgd2lkdGgsIGhlaWdodCwgbWluVywgbWluSCwgbWF4VywgbWF4SCk7CisgICAgICAgICAgICAgICAgLy8gYXQgdGhpcyBwb2ludCwgaXQncyBhIHJlamVjdGlvbiwgVU5MRVNTCisgICAgICAgICAgICAgICAgLy8gdGhlIGNvZGVjIGFsbG93cyBzd2FwcGluZyB3aWR0aCBhbmQgaGVpZ2h0CisgICAgICAgICAgICAgICAgaW50MzJfdCBzd2FwcGFibGU7CisgICAgICAgICAgICAgICAgaWYgKCFkZXRhaWxzLT5maW5kSW50MzIoImZlYXR1cmUtY2FuLXN3YXAtd2lkdGgtaGVpZ2h0IiwgJnN3YXBwYWJsZSkKKyAgICAgICAgICAgICAgICAgICAgfHwgc3dhcHBhYmxlID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvLyBOQjogZGVsaWJlcmF0ZSBjb21wYXJpc29uIG9mIGhlaWdodCB2cyB3aWR0aCBsaW1pdHMgKGFuZCB3aWR0aCB2cyBoZWlnaHQpCisgICAgICAgICAgICAgICAgaWYgKGhlaWdodCA8IG1pblcgfHwgaGVpZ2h0ID4gbWF4VyB8fCB3aWR0aCA8IG1pbkggfHwgd2lkdGggPiBtYXhIKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIEAgJ2FsaWdubWVudCcgW2UuZy4gIjJ4MiIgd2hpY2ggdGVsbHMgdXMgdGhhdCBib3RoIGRpbWVuc2lvbnMgbXVzdCBiZSBldmVuXQorICAgICAgICAgICAgLy8gbm8gYWxpZ25tZW50ID09IHdlJ3JlIG9rIHdpdGggYW55dGhpbmcKKyAgICAgICAgICAgIEFTdHJpbmcgYWxpZ25tZW50LCBhbGlnbldpZHRoLCBhbGlnbkhlaWdodDsKKyAgICAgICAgICAgIGlmIChkZXRhaWxzLT5maW5kU3RyaW5nKCJhbGlnbm1lbnQiLCAmYWxpZ25tZW50KSkgeworICAgICAgICAgICAgICAgIGlmIChzcGxpdFN0cmluZyhhbGlnbm1lbnQsICJ4IiwgJmFsaWduV2lkdGgsICZhbGlnbkhlaWdodCkgfHwKKyAgICAgICAgICAgICAgICAgICAgc3BsaXRTdHJpbmcoYWxpZ25tZW50LCAiKiIsICZhbGlnbldpZHRoLCAmYWxpZ25IZWlnaHQpKSB7CisgICAgICAgICAgICAgICAgICAgIGludCB3QWxpZ24gPSBzdHJ0b2woYWxpZ25XaWR0aC5jX3N0cigpLCBOVUxMLCAxMCk7CisgICAgICAgICAgICAgICAgICAgIGludCBoQWxpZ24gPSBzdHJ0b2woYWxpZ25IZWlnaHQuY19zdHIoKSwgTlVMTCwgMTApOworICAgICAgICAgICAgICAgICAgICAvLyBzdHJ0b2woKSByZXR1cm5zIDAgaWYgZmFpbGluZyB0byBwYXJzZSwgdHJlYXQgYXMgIm5vIHJlc3RyaWN0aW9uIgorICAgICAgICAgICAgICAgICAgICBpZiAod0FsaWduID4gMCAmJiBoQWxpZ24gPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh3aWR0aCAlIHdBbGlnbikgIT0gMCB8fCAoaGVpZ2h0ICUgaEFsaWduKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoImZvcm1hdCBkaW1lbnNpb25zICVkeCVkIG5vdCBhbGlnbmVkIHRvICVkeCVkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoLCBoZWlnaHQsIHdBbGlnbiwgaEFsaWduKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLy8gaGF2ZW4ndCBmb3VuZCBhIHJlYXNvbiB0byBkaXNjYXJkIHRoaXMgb25lCisgICAgcmV0dXJuIHRydWU7Cit9CisKIH0gIC8vIG5hbWVzcGFjZSBhbmRyb2lkCmRpZmYgLS1naXQgYS9tZWRpYS9saWJzdGFnZWZyaWdodC9NZWRpYUNvZGVjU291cmNlLmNwcCBiL21lZGlhL2xpYnN0YWdlZnJpZ2h0L01lZGlhQ29kZWNTb3VyY2UuY3BwCmluZGV4IGM2YWUxNTkuLjAxMDdjMzIgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L01lZGlhQ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MyBAQAogICAgICAgICAgICAgbWVtY3B5KGluYnVmLT5kYXRhKCksIG1idWYtPmRhdGEoKSwgc2l6ZSk7CiAKICAgICAgICAgICAgIGlmIChtSXNWaWRlbykgeworICAgICAgICAgICAgICAgIGludDMyX3QgZHMgPSAwOworICAgICAgICAgICAgICAgIGlmIChtYnVmLT5tZXRhX2RhdGEoKS5maW5kSW50MzIoa0tleUNvbG9yU3BhY2UsICZkcykKKyAgICAgICAgICAgICAgICAgICAgICAgICYmIGRzICE9IEhBTF9EQVRBU1BBQ0VfVU5LTk9XTikgeworICAgICAgICAgICAgICAgICAgICBhbmRyb2lkX2RhdGFzcGFjZSBkYXRhc3BhY2UgPSBzdGF0aWNfY2FzdDxhbmRyb2lkX2RhdGFzcGFjZT4oZHMpOworICAgICAgICAgICAgICAgICAgICBDb2xvclV0aWxzOjpjb252ZXJ0RGF0YVNwYWNlVG9WMChkYXRhc3BhY2UpOworICAgICAgICAgICAgICAgICAgICBBTE9HRCgiVXBkYXRpbmcgZGF0YXNwYWNlIHRvICV4IiwgZGF0YXNwYWNlKTsKKyAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBzdGFuZGFyZCwgdHJhbnNmZXIsIHJhbmdlOworICAgICAgICAgICAgICAgICAgICBDb2xvclV0aWxzOjpnZXRDb2xvckNvbmZpZ0Zyb21EYXRhU3BhY2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YXNwYWNlLCAmcmFuZ2UsICZzdGFuZGFyZCwgJnRyYW5zZmVyKTsKKyAgICAgICAgICAgICAgICAgICAgc3A8QU1lc3NhZ2U+IG1zZyA9IG5ldyBBTWVzc2FnZTsKKyAgICAgICAgICAgICAgICAgICAgbXNnLT5zZXRJbnQzMihLRVlfQ09MT1JfU1RBTkRBUkQsIHN0YW5kYXJkKTsKKyAgICAgICAgICAgICAgICAgICAgbXNnLT5zZXRJbnQzMihLRVlfQ09MT1JfVFJBTlNGRVIsIHRyYW5zZmVyKTsKKyAgICAgICAgICA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dHJhY3Rvcl9uYW1lKSA9PSAwKSB7CkBAIC0yNDQsMTMgKzI0NCwxOCBAQAogICAgICAgICAgICAgdm9pZCAqbGliSGFuZGxlID0gYW5kcm9pZF9kbG9wZW5fZXh0KAogICAgICAgICAgICAgICAgICAgICBsaWJQYXRoLnN0cmluZygpLAogICAgICAgICAgICAgICAgICAgICBSVExEX05PVyB8IFJUTERfTE9DQUwsIGRsZXh0aW5mbyk7Ci0gICAgICAgICAgICBDSEVDSyhsaWJIYW5kbGUgIT0gbnVsbHB0cikKLSAgICAgICAgICAgICAgICAgICAgPDwgImNvdWxkbid0IGRsb3BlbigiIDw8IGxpYlBhdGguc3RyaW5nKCkgPDwgIikgIiA8PCBzdHJlcnJvcihlcnJubyk7CisgICAgICAgICAgICBpZiAobGliSGFuZGxlID09IG51bGxwdHIpIHsKKyAgICAgICAgICAgICAgICBBTE9HSSgiZGxvcGVuKCVzKSByZXBvcnRlZCBlcnJvciAlcyIsIGxpYlBhdGguc3RyaW5nKCksIHN0cmVycm9yKGVycm5vKSk7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIEdldEV4dHJhY3RvckRlZiBnZXREZWYgPQogICAgICAgICAgICAgICAgIChHZXRFeHRyYWN0b3JEZWYpIGRsc3ltKGxpYkhhbmRsZSwgIkdFVEVYVFJBQ1RPUkRFRiIpOwotICAgICAgICAgICAgQ0hFQ0soZ2V0RGVmICE9IG51bGxwdHIpCi0gICAgICAgICAgICAgICAgICAgIDw8IGxpYlBhdGguc3RyaW5nKCkgPDwgIiBkb2VzIG5vdCBjb250YWluIHNuaWZmZXIiOworICAgICAgICAgICAgaWYgKGdldERlZiA9PSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgQUxPR0koIm5vIHNuaWZmZXIgZm91bmQgaW4gJXMiLCBsaWJQYXRoLnN0cmluZygpKTsKKyAgICAgICAgICAgICAgICBkbGNsb3NlKGxpYkhhbmRsZSk7CisgICAgICAg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tncm91bmRNb2RlKSAmJiBpc0JhY2tncm91bmRNb2RlICE9IDApIHsKKyAgICAgICAgbWV0YS0+c2V0SW50MzIoaXNCYWNrZ3JvdW5kTW9kZSwgMSk7CisgICAgfQorCiAgICAgaW50MzJfdCBhdmdCaXRyYXRlID0gMDsKICAgICBpbnQzMl90IG1heEJpdHJhdGU7CiAgICAgaWYgKG1zZy0+ZmluZEludDMyKCJiaXRyYXRlIiwgJmF2Z0JpdHJhdGUpICYmIGF2Z0JpdHJhdGUgPiAwKSB7CkBAIC0xNzIxLDcgKzE3NjMsNyBAQAogICAgICAgICAgICAgbWV0YS0+c2V0SW50MzIoa0tleVdpZHRoLCB3aWR0aCk7CiAgICAgICAgICAgICBtZXRhLT5zZXRJbnQzMihrS2V5SGVpZ2h0LCBoZWlnaHQpOwogICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgQUxPR0UoImRpZCBub3QgZmluZCB3aWR0aCBhbmQvb3IgaGVpZ2h0Iik7CisgICAgICAgICAgICBBTE9HVigiZGlkIG5vdCBmaW5kIHdpZHRoIGFuZC9vciBoZWlnaHQiKTsKICAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7CiAgICAgICAgIH0KIApAQCAtMTgxMCw3ICsxODUyLDcgQEAKICAgICAgICAgaW50MzJfdCBudW1DaGFubmVscywgc2FtcGxlUmF0ZTsKICAgICAgICAgaWYgKCFtc2ctPmZpbmRJbnQzMigiY2hhbm5lbC1jb3VudCIsICZudW1DaGFubmVscykgfHwKICAgICAgICAgICAgICAgICAhbXNnLT5maW5kSW50MzIoInNhbXBsZS1yYXRlIiwgJnNhbXBsZVJhdGUpKSB7Ci0gICAgICAgICAgICBBTE9HRSgiZGlkIG5vdCBmaW5kIGNoYW5uZWwtY291bnQgYW5kL29yIHNhbXBsZS1yYXRlIik7CisgICAgICAgICAgICBBTE9HVigiZGlkIG5vdCBmaW5kIGNoYW5uZWwtY291bnQgYW5kL29yIHNhbXBsZS1yYXRlIik7CiAgICAgICAg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BzcmNzOiBbCi0gICAgICAgICJzcmMvYWRkLmNwcCIsCi0gICAgICAgICJzcmMvYXpfbHNwLmNwcCIsCi0gICAgICAgICJzcmMvYml0bm9fdGFiLmNwcCIsCi0gICAgICAgICJzcmMvYml0cmVvcmRlcl90YWIuY3BwIiwKLSAgICAgICAgInNyYy9iaXRzMnBybS5jcHAiLAotICAgICAgICAic3JjL2MyXzlwZl90YWIuY3BwIiwKLSAgICAgICAgInNyYy9jb3B5LmNwcCIsCi0gICAgICAgICJzcmMvZGl2XzMyLmNwcCIsCi0gICAgICAgICJzcmMvZGl2X3MuY3BwIiwKLSAgICAgICAgInNyYy9leHRyYWN0X2guY3BwIiwKLSAgICAgICAgInNyYy9leHRyYWN0X2wuY3BwIiwKLSAgICAgICAgInNyYy9nYWluc190YmwuY3BwIiwKLSAgICAgICAgInNyYy9nY19wcmVkLmNwcCIsCi0gICAgICAgICJzcmMvZ21lZF9uLmNwcCIsCi0gICAgICAgICJzcmMvZ3JpZF90YmwuY3BwIiwKLSAgICAgICAgInNyYy9ncmF5X3RibC5jcHAiLAotICAgICAgICAic3JjL2ludF9scGMuY3BwIiwKLSAgICAgICAgInNyYy9pbnZfc3FydC5jcHAiLAotICAgICAgICAic3JjL2ludl9zcXJ0X3RibC5jcHAiLAotICAgICAgICAic3JjL2xfYWJzLmNwcCIsCi0gICAgICAgICJzcmMvbF9kZXBvc2l0X2guY3BwIiwKLSAgICAgICAgInNyYy9sX2RlcG9zaXRfbC5jcHAiLAotICAgICAgICAic3JjL2xfc2hyX3IuY3BwIiwKLSAgICAgICAgInNyYy9sb2cyLmNwcCIsCi0gICAgICAgICJzcmMvbG9nMl9ub3JtLmNwcCIsCi0gICAgICAgICJzcmMvbG9nMl90YmwuY3BwIiwKLSAgICAgICAgInNyYy9sc2Z3dC5jcHAiLAotICAgICAgICAic3JjL2xzcC5jcHAiLAotICAgICAgICAic3JjL2xzcF9hei5jcHAiLAotICAgICAgICAic3JjL2xzcF9sc2YuY3BwIiwKLSAgICAgICAgInNyYy9sc3BfbHNmX3RibC5jcHAiLAotICAgICAgICAic3JjL2xzcF90YWIuY3BwIiwKLSAgICAgICAgInNyYy9tdWx0X3IuY3BwIiwKLSAgICAgICAgInNyYy9ub3JtX2wuY3BwIiwKLSAgICAgICAgInNyYy9ub3JtX3MuY3BwIiwKLSAgICAgICAgInNyYy9waF9kaXNwX3RhYi5jcHAiLAotICAgICAgICAic3JjL3BvdzIuY3BwIiwKLSAgICAgICAgInNyYy9wb3cyX3RibC5jcHAiLAotICAgICAgICAic3JjL3ByZWRfbHQuY3BwIiwKLSAgICAgICAgInNyYy9xX3Bsc2YuY3BwIiwKLSAgICAgICAgInNyYy9xX3Bsc2ZfMy5jcHAiLAotICAgICAgICAic3JjL3FfcGxzZl8zX3RibC5jcHAiLAotICAgICAgICAic3JjL3FfcGxzZl81LmNwcCIsCi0gICAgICAgICJzcmMvcV9wbHNmXzVfdGJsLmNwcCIsCi0gICAgICAgICJzcmMvcXVhX2dhaW5fdGJsLmNwcCIsCi0gICAgICAgICJzcmMvcmVvcmRlci5jcHAiLAotICAgICAgICAic3JjL3Jlc2lkdS5jcHAiLAotICAgICAgICAic3JjL3JvdW5kLmNwcCIsCi0gICAgICAgICJzcmMvc2V0X3plcm8uY3BwIiwKLSAgICAgICAgInNyYy9zaHIuY3BwIiwKLSAgICAgICAgInNyYy9zaHJfci5jcHAiLAotICAgICAgICAic3JjL3NxcnRfbC5jcHAiLAotICAgICAgICAic3JjL3NxcnRfbF90YmwuY3BwIiwKLSAgICAgICAgInNyYy9zdWIuY3BwIiwKLSAgICAgICAgInNyYy9zeW5fZmlsdC5jcHAiLAotICAgICAgICAic3JjL3ZhZDEuY3BwIiwKLSAgICAgICAgInNyYy93ZWlnaHRfYS5jcHAiLAotICAgICAgICAic3JjL3dpbmRvd190YWIuY3BwIiwKLSAgICBdLAotCi0gICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWyJpbmNsdWRlIl0sCi0KLSAgICBjZmxhZ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SIsCi0KLSAgICBzcmNzOiBbCi0gICAgICAgICJzcmMvYV9yZWZsLmNwcCIsCi0gICAgICAgICJzcmMvYWdjLmNwcCIsCi0gICAgICAgICJzcmMvYW1yZGVjb2RlLmNwcCIsCi0gICAgICAgICJzcmMvYl9jbl9jb2QuY3BwIiwKLSAgICAgICAgInNyYy9iZ25zY2QuY3BwIiwKLSAgICAgICAgInNyYy9jX2dfYXZlci5jcHAiLAotICAgICAgICAic3JjL2QxMDM1cGYuY3BwIiwKLSAgICAgICAgInNyYy9kMl8xMXBmLmNwcCIsCi0gICAgICAgICJzcmMvZDJfOXBmLmNwcCIsCi0gICAgICAgICJzcmMvZDNfMTRwZi5jcHAiLAotICAgICAgICAic3JjL2Q0XzE3cGYuY3BwIiwKLSAgICAgICAgInNyYy9kOF8zMXBmLmNwcCIsCi0gICAgICAgICJzcmMvZF9nYWluX2MuY3BwIiwKLSAgICAgICAgInNyYy9kX2dhaW5fcC5jcHAiLAotICAgICAgICAic3JjL2RfcGxzZi5jcHAiLAotICAgICAgICAic3JjL2RfcGxzZl8zLmNwcCIsCi0gICAgICAgICJzcmMvZF9wbHNmXzUuY3BwIiwKLSAgICAgICAgInNyYy9kZWNfYW1yLmNwcCIsCi0gICAgICAgICJzcmMvZGVjX2dhaW4uY3BwIiwKLSAgICAgICAgInNyYy9kZWNfaW5wdXRfZm9ybWF0X3RhYi5jcHAiLAotICAgICAgICAic3JjL2RlY19sYWczLmNwcCIsCi0gICAgICAgICJzcmMvZGVjX2xhZzYuY3BwIiwKLSAgICAgICAgInNyYy9kdHhfZGVjLmNwcCIsCi0gICAgICAgICJzcmMvZWNfZ2FpbnMuY3BwIiwKLSAgICAgICAgInNyYy9leF9jdHJsLmNwcCIsCi0gICAgICAgICJzcmMvaWYyX3RvX2V0cy5jcHAiLAotICAgICAgICAic3JjL2ludF9sc2YuY3BwIiwKLSAgICAgICAgInNyYy9sc3BfYXZnLmNwcCIsCi0gICAgICAgICJzcmMvcGhfZGlzcC5jc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kgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L2NvZGVjcy9hbXJuYi9lbmMvQW5kcm9pZC5icAorKysgYi9tZWRpYS9saWJzdGFnZWZyaWdodC9jb2RlY3MvYW1ybmIvZW5jL0FuZHJvaWQuYnAKQEAgLTEsOTggKzEsMjEgQEAKLWNjX2xpYnJhcnlfc3RhdGljIHsKLSAgICBuYW1lOiAibGlic3RhZ2VmcmlnaHRfYW1ybmJlbmMiLAotICAgIHZlbmRvcl9hdmFpbGFibGU6IHRydWUsCi0gICAgbWluX3Nka192ZXJzaW9uOiAiMjkiLAotCi0gICAgc3JjczogWwotICAgICAgICAic3JjL2FtcmVuY29kZS5jcHAiLAotICAgICAgICAic3JjL2F1dG9jb3JyLmNwcCIsCi0gICAgICAgICJzcmMvYzEwMzVwZi5jcHAiLAotICAgICAgICAic3JjL2MyXzExcGYuY3BwIiwKLSAgICAgICAgInNyYy9jMl85cGYuY3BwIiwKLSAgICAgICAgInNyYy9jM18xNHBmLmNwcCIsCi0gICAgICAgICJzcmMvYzRfMTdwZi5jcHAiLAotICAgICAgICAic3JjL2M4XzMxcGYuY3BwIiwKLSAgICAgICAgInNyYy9jYWxjX2Nvci5jcHAiLAotICAgICAgICAic3JjL2NhbGNfZW4uY3BwIiwKLSAgICAgICAgInNyYy9jYnNlYXJjaC5jcHAiLAotICAgICAgICAic3JjL2NsX2x0cC5jcHAiLAotICAgICAgICAic3JjL2NvZF9hbXIuY3BwIiwKLSAgICAgICAgInNyYy9jb252b2x2ZS5jcHAiLAotICAgICAgICAic3JjL2Nvcl9oLmNwcCIsCi0gICAgICAgICJzcmMvY29yX2hfeC5jcHAiLAotICAgICAgICAic3JjL2Nvcl9oX3gyLmNwcCIsCi0gICAgICAgICJzcmMvY29ycndnaHRfdGFiLmNwcCIsCi0gICAgICAgICJzcmMvZHR4X2VuYy5jcHAiLAotICAgICAgICAic3JjL2VuY19sYWczLmNwcCIsCi0gICAgICAgICJzcmM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XAgdGhlIHJlc3VsdCBvbiAzMiBiaXRzIGFuZCBmaW5kIGFic29sdXRlIG1heGltdW0gKi8KLSAgICB0b3QgPSBMT0cyX09GXzMyOwotICAgIGZvciAoayA9IDA7IGsgPCBuYl90cmFjazsgaysrKQotICAgIHsKLSAgICAgICAgbWF4ID0gMDsKLSAgICAgICAgZm9yIChpID0gazsgaSA8IExfQ09ERTsgaSArPSBzdGVwKQotICAgICAgICB7Ci0gICAgICAgICAgICBzID0gMDsKLQotICAgICAgICAgICAgZm9yIChqID0gaTsgaiA8IExfQ09ERTsgaisrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHMgPSBhbXJuYl9meHBfbWFjXzE2X2J5XzE2YmIoKFdvcmQzMil4W2pdLCAoV29yZDMyKWhbai1pXSwgcyk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHMgPSBzIDw8IDE7Ci0gICAgICAgICAgICB5MzJbaV0gPSBzOwotICAgICAgICAgICAgcyA9IExfYWJzKHMpOwotCi0gICAgICAgICAgICBpZiAocyA+IG1heCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBtYXggPSBzOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHRvdCA9ICh0b3QgKyAobWF4ID4+IDEpKTsKLSAgICB9Ci0KLSAgICBqID0gc3ViKG5vcm1fbCh0b3QpLCBzZiwgcE92ZXJmbG93KTsKLQotICAgIGZvciAoaSA9IDA7IGkgPCBMX0NPREU7IGkrKykKLSAgICB7Ci0gICAgICAgIGRuW2ldID0gcHZfcm91bmQoTF9zaGwoeTMyW2ldLCBqLCBwT3ZlcmZsb3cpLCBwT3ZlcmZsb3cpOwotICAgIH0KLQotICAgIHJldHVybjsKLX0KZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L2NvZGVjcy9hbXJuYi9lbmMvc3JjL3FnYWluNDc1LmNwcCBiL21lZGlhL2xpYnN0YWdlZnJpZ2h0L2Nv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FibGUgZGVjbGFyYXRpb24gLSBkZWZpbmVkIGhlcmUgYW5kIHVzZWQgb3V0c2lkZSB0aGlzIG1vZHVsZQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi0KLS8qIFRoZSB0YWJsZSBjb250YWlucyB0aGUgZm9sbG93aW5nIGRhdGE6Ci0gKgotICogICAgZ19waXRjaCgwKSAgICAgICAgKFExNCkgLy8gZm9yIHN1Yi0KLSAqICAgIGdfZmFjKDApICAgICAgICAgIChRMTIpIC8vIGZyYW1lIDAgYW5kIDIKLSAqICAgIGdfcGl0Y2goMSkgICAgICAgIChRMTQpIC8vIGZvciBzdWItCi0gKiAgICBnX2ZhYygyKSAgICAgICAgICAoUTEyKSAvLyBmcmFtZSAxIGFuZCAzCi0gKgotICovCi1zdGF0aWMgY29uc3QgV29yZDE2IHRhYmxlX2dhaW5fTVI0NzVbTVI0NzVfVlFfU0laRSo0XSA9Ci17Ci0gICAgLypnX3BpdCgwKSwgZ19mYWMoMCksICAgICAgZ19waXQoMSksIGdfZmFjKDEpICovCi0gICAgODEyLCAgICAgICAgICAxMjgsICAgICAgICAgICA1NDIsICAgICAgMTQwLAotICAgIDI4NzMsICAgICAgICAgMTEzNSwgICAgICAgICAgMjI2NiwgICAgIDM0MDIsCi0gICAgMjA2NywgICAgICAgICAgNTYzLCAgICAgICAgIDEyNjc3LCAgICAgIDY0NywKLSAgICA0MTMyLCAgICAgICAgIDE3OTgsICAgICAgICAgIDU2MDEsICAgICA1Mjg1LAotICAgIDc2ODksICAgICAgICAgIDM3NCwgICAgICAgICAgMzczNSwgICAgICA0NDEsCi0gICAgMTA5MTIsICAgICAgICAgMjYzOCwgICAgICAgICAxMTgwNywgICAgIDI0OTQsCi0gICAgMjA0OTAsICAgICAgICAgIDc5NywgICAgICAgICAgNTIxOCwgICAgICA2NzUsCi0gICAgNjcyNCwgICAgICAgICA4MzU0LCAgICAgICAgICA1MjgyLCAgICAgMTY5NiwKLSAgICAxNDg4LCAgICAgICAgICA0MjgsICAgICAgICAgIDU4ODIsICAgICAgNDUyLAotICAgIDUzMzIsICAgICAgICAgNDA3MiwgICAgICAgICAgMzU4MywgICAgIDEyNjgsCi0gICAgMjQ2OSwgICAgICAgICAgOTAxLCAgICAgICAgIDE1ODk0LCAgICAgMTAwNSwKLSAgICAxNDk4MiwgICAgICAgICAzMjcxLCAgICAgICAgIDEwMzMxLCAgICAgNDg1OCwKLSAgICAzNjM1LCAgICAgICAgIDIwMjEsICAgICAgICAgIDI1OTYsICAgICAgODM1LAotICAgIDEyMzYwLCAgICAgICAgIDQ4OTIsICAgICAgICAgMTIyMDYsICAgICAxNzA0LAotICAgIDEzNDMyLCAgICAgICAgIDE2MDQsICAgICAgICAgIDkxMTgsICAgICAyMzQxLAotICAgIDM5NjgsICAgICAgICAgMTUzOCwgICAgICAgICAgNTQ3OSwgICAgIDk5MzYsCi0gICAgMzc5NSwgICAgICAgICAgNDE3LCAgICAgICAgICAxMzU5LCAgICAgIDQxNCwKLSAgICAzNjQwLCAgICAgICAgIDE1NjksICAgICAgICAgIDc5OTUsICAgICAzNTQxLAotICAgIDExNDA1LCAgICAgICAgICA2NDUsICAgICAgICAgIDg1NTIsICAgICAgNjM1LAotICAgIDQwNTYsICAgICAgICAgMTM3NywgICAgICAgICAxNjYwOCwgICAgIDYxMjQsCi0gICAgMTE0MjAsICAgICAgICAgIDcwMCwgICAgICAgICAgMjAwNywgICAgICA2MDcsCi0gICAgMTI0MTUsICAgICAgICAgMTU3OCwgICAgICAgICAxMTExOSwgICAgIDQ2NTQsCi0gICAgMTM2ODAsICAgICAgICAgMTcwOCwgICAgICAgICAxMTk5MCwgICAgIDEyMjksCi0gICAgNzk5NiwgICAgICAgICA3Mjk3LCAgICAgICAgIDEzMjMxLCAgICAgNTcxNSwKLSAgICAyNDI4LCAgICAgICAgIDExNTksICAgICAgICAgIDIwNzMsICAgICAxOTQxLAotICAgIDYyMTgsICAgICAgICAgNjEyMSwgICAgICAgICAgMzU0NiwgICAgIDE4MDQsCi0gICAgODkyNSwgICAgICAgICAxODAyLCAgICAgICAgICA4Njc5LCAgICAgMTU4MCwKLSAgICAxMzkzNSwgICAgICAgICAzNTc2LCAgICAgICAgIDEzMzEzLCAgICAgNjIzNywKLSAgICA2MTQyLCAgICAgICAgIDExMzAsICAgICAgICAgIDU5OTQsICAgICAxNzM0LAotICAgIDE0MTQxLCAgICAgICAgIDQ2NjIsICAgICAgICAgMTEyNzEsICAgICAzMzIxLAotICAgIDEyMjI2LCAgICAgICAgIDE1NTEsICAgICAgICAgMTM5MzEsICAgICAzMDE1LAotICAgIDUwODEsICAgICAgICAxMDQ2NCwgICAgICAgICAgOTQ0NCwgICAgIDY3MDYsCi0gICAgMTY4OSwgICAgICAgICAgNjgzLCAgICAgICAgICAxNDM2LCAgICAgMTMwNiwKLSAgICA3MjEyLCAgICAgICAgIDM5MzMsICAgICAgICAgIDQwODIsICAgICAyNzEzLAotICAgIDc3OTMsICAgICAgICAgIDcwNCwgICAgICAgICAxNTA3MCwgICAgICA4MDIsCi0gICAgNjI5OSwgICAgICAgICA1MjEyLCAgICAgICAgICA0MzM3LCAgICAgNTM1NywKLSAgICA2Njc2LCAgICAgICAgICA1NDEsICAgICAgICAgIDYwNjIsICAgICAgNjI2LAotICAgIDEzNjUxLCAgICAgICAgIDM3MDAsICAgICAgICAgMTE0OTgsICAgICAyNDA4LAotICAgIDE2MTU2LCAgICAgICAgICA3MTYsICAgICAgICAgMTIxNzcsICAgICAgNzUxLAotICAgIDgwNjUsICAgICAgICAxMTQ4OSwgICAgICAgICAgNjMxNCwgICAgIDIyNTYsCi0gICAgNDQ2NiwgICAgICAgICAgNDk2LCAgICAgICAgICA3MjkzLCAgICAgIDUyMywKLSAgICAxMDIxMywgICAgICAgICAzODMzLCAgICAgICAgICA4Mzk0LCAgICAgMzAzNywKLSAgICA4NDAzLCAgICAgICAgICA5NjYsICAgICAgICAgMTQyMjgsICAgICAxODgwLAotICAgIDg3MDMsICAgICAgICAgNTQwOSwgICAgICAgICAxNjM5NSwgICAgIDQ4NjMsCi0gICAgNzQyMCwgICAgICAgICAxOTc5LCAgICAgICAgICA2MDg5LCAgICAgMTIzMCwKLSAgICA5MzcxLCAgICAgICAgIDQzOTgsICAgICAgICAgMTQ1NTgsICAgICAzMzYzLAotICAgIDEzNTU5LCAgICAgICAgIDI4NzMsICAgICAgICAgMTMxNjMsICAgICAxNDY1LAotICAgIDU1MzQsICAgICAgICAgMTY3OCwgICAgICAgICAxMzEzOCwgICAgMTQ3NzEsCi0gICAgNzMzOCwgICAgICAgICAgNjAwLCAgICAgICAgICAxMzE4LCAgICAgIDU0OCwKLSAgICA0MjUyLCAgICAgICAgIDM1MzksICAgICAgICAgMTAwNDQsICAgICAyMzY0LAotICAgIDEwNTg3LCAgICAgICAgICA2MjIsICAgICAgICAgMTMwODgsICAgICAgNjY5LAotICAgIDE0MTI2LCAgICAgICAgIDM1MjYsICAgICAgICAgIDUwMzksICAgICA5Nzg0LAotICAgIDE1MzM4LCAgICAgICAgICA2MTksICAgICAgICAgIDMxMTUsICAgICAgNTkwLAotICAgIDE2NDQyLCAgICAgICAgIDMwMTMsICAgICAgICAgMTU1NDIsICAgICA0MTY4LAotICAgIDE1NTM3LCAgICAgICAgIDE2MTEsICAgICAgICAgMTU0MDUsICAgICAxMjI4LAotICAgIDE2MDIzLCAgICAgICAgIDkyOTksICAgICAgICAgIDc1MzQsICAgICA0OTc2LAotICAgIDE5OTAsICAgICAgICAgMTIxMywgICAgICAgICAxMTQ0NywgICAgIDExNTcsCi0gICAgMTI1MTIsICAgICAgICAgNTUxOSwgICAgICAgICAgOTQ3NSwgICAgIDI2NDQsCi0gICAgNzcxNiwgICAgICAgICAyMDM0LCAgICAgICAgIDEzMjgwLCAgICAgMjIzOSwKLSAgICAxNjAxMSwgICAgICAgICA1MDkzLCAgICAgICAgICA4MDY2LCAgICAgNjc2MSwKLSAgICAxMDA4MywgICAgICAgICAxNDEzLCAgICAgICAgICA1MDAyLCAgICAgMjM0NywKLSAgICAxMjUyMywgICAgICAgICA1OTc1LCAgICAgICAgIDE1MTI2LCAgICAgMjg5OSwKLSAgICAxODI2NCwgICAgICAgICAyMjg5LCAgICAgICAgIDE1ODI3LCAgICAgMjUyNywKLSAgICAxNjI2NSwgICAgICAgIDEwMjU0LCAgICAgICAgIDE0NjUxLCAgICAxMTMxOSwKLSAgICAxNzk3LCAgICAgICAgICAzMzcsICAgICAgICAgIDMxMTUsICAgICAgMzk3LAotICAgIDM1MTAsICAgICAgICAgMjkyOCwgICAgICAgICAgNDU5MiwgICAgIDI2NzAsCi0gICAgNzUxOSwgICAgICAgICAgNjI4LCAgICAgICAgIDExNDE1LCAgICAgIDY1NiwKLSAgICA1OTQ2LCAgICAgICAgIDI0MzUsICAgICAgICAgIDY1NDQsICAgICA3MzY3LAotICAgIDgyMzgsICAgICAgICAgIDgyOSwgICAgICAgICAgNDAwMCwgICAgICA4NjMsCi0gICAgMTAwMzIsICAgICAgICAgMjQ5MiwgICAgICAgICAxNjA1NywgICAgIDM1NTEsCi0gICAgMTgyMDQsICAgICAgICAgMTA1NCwgICAgICAgICAgNjEwMywgICAgIDE0NTQsCi0gICAgNTg4NCwgICAgICAgICA3OTAwLCAgICAgICAgIDE4NzUyLCAgICAgMzQ2OCwKLSAgICAxODY0LCAgICAgICAgICA1NDQsICAgICAgICAgIDkxOTgsICAgICAgNjgzLAotICAgIDExNjIzLCAgICAgICAgIDQxNjAsICAgICAgICAgIDQ1OTQsICAgICAxNjQ0LAotICAgIDMxNTgsICAgICAgICAgMTE1NywgICAgICAgICAxNTk1MywgICAgIDI1NjAsCi0gICAgMTIzNDksICAgICAgICAgMzczMywgICAgICAgICAxNzQyMCwgICAgIDUyNjAsCi0gICAgNjEwNiwgICAgICAgICAyMDA0LCAgICAgICAgICAyOTE3LCAgICAgMTc0MiwKLSAgICAxNjQ2NywgICAgICAgICA1MjU3LCAgICAgICAgIDE2Nzg3LCAgICAgMTY4MCwKLSAgICAxNzIwNSwgICAgICAgICAxNzU5LCAgICAgICAgICA0NzczLCAgICAgMzIzMSwKLSAgICA3Mzg2LCAgICAgICAgIDYwMzUsICAgICAgICAgMTQzNDIsICAgIDEwMDEyLAotICAgIDQwMzUsICAgICAgICAgIDQ0MiwgICAgICAgICAgNDE5NCwgICAgICA0NTgsCi0gICAgOTIxNCwgICAgICAgICAyMjQyLCAgICAgICAgICA3NDI3LCAgICAgNDIxNywKLSAgICAxMjg2MCwgICAgICAgICAgODAxLCAgICAgICAgIDExMTg2LCAgICAgIDgyNSwKLSAgICAxMjY0OCwgICAgICAgICAyMDg0LCAgICAgICAgIDEyOTU2LCAgICAgNjU1NCwKLSAgICA5NTA1LCAgICAgICAgICA5OTYsICAgICAgICAgIDY2MjksICAgICAgOTg1LAotICAgIDEwNTM3LCAgICAgICAgIDI1MDIsICAgICAgICAgMTUyODksICAgICA1MDA2LAotICAgIDEyNjAyLCAgICAgICAgIDIwNTUsICAgICAgICAgMTU0ODQsICAgICAxNjUzLAotICAgIDE2MTk0LCAgICAgICAgIDY5MjEsICAgICAgICAgMTQyMzEsICAgICA1NzkwLAotICAgIDI2MjYsICAgICAgICAgIDgyOCwgICAgICAgICAgNTYxNSwgICAgIDE2ODYsCi0gICAgMTM2NjMsICAgICAgICAgNTc3OCwgICAgICAgICAgMzY2OCwgICAgIDE1NTQsCi0gICAgMTEzMTMsICAgICAgICAgMjYzMywgICAgICAgICAgOTc3MCwgICAgIDE0NTksCi0gICAgMTQwMDMsICAgICAgICAgNDczMywgICAgICAgICAxNTg5NywgICAgIDYyOTEsCi0gICAgNjI3OCwgICAgICAgICAxODcwLCAgICAgICAgICA3OTEwLCAgICAgMjI4NSwKLSAgICAxNjk3OCwgICAgICAgICA0NTcxLCAgICAgICAgIDE2NTc2LCAgICAgMzg0OSwKLSAgICAxNTI0OCwgICAgICAgICAyMzExLCAgICAgICAgIDE2MDIzLCAgICAgMzI0NCwKLSAgICAxNDQ1OSwgICAgICAgIDE3ODA4LCAgICAgICAgIDExODQ3LCAgICAgMjc2MywKLSAgICAxOTgxLCAgICAgICAgIDE0MDcsICAgICAgICAgIDE0MDAsICAgICAgODc2LAotICAgIDQzMzUsICAgICAgICAgMzU0NywgICAgICAgICAgNDM5MSwgICAgIDQyMTAsCi0gICAgNTQwNSwgICAgICAgICAgNjgwLCAgICAgICAgIDE3NDYxLCAgICAgIDc4MSwKLSAgICA2NTAxLCAgICAgICAgIDUxMTgsICAgICAgICAgIDgwOTEsICAgICA3Njc3LAotICAgIDczNTUsICAgICAgICAgIDc5NCwgICAgICAgICAgODMzMywgICAgIDExODIsCi0gICAgMTUwNDEsICAgICAgICAgMzE2MCwgICAgICAgICAxNDkyOCwgICAgIDMwMzksCi0gICAgMjA0MjEsICAgICAgICAgIDg4MCwgICAgICAgICAxNDU0NSwgICAgICA4NTIsCi0gICAgMTIzMzcsICAgICAgICAxNDcwOCwgICAgICAgICAgNjkwNCwgICAgIDE5MjAsCi0gICAgNDIyNSwgICAgICAgICAgOTMzLCAgICAgICAgICA4MjE4LCAgICAgMTA4NywKLSAgICAxMDY1OSwgICAgICAgICA0MDg0LCAgICAgICAgIDEwMDgyLCAgICAgNDUzMywKLSAgICAyNzM1LCAgICAgICAgICA4NDAsICAgICAgICAgMjA2NTcsICAgICAxMDgxLAotICAgIDE2NzExLCAgICAgICAgIDU5NjYsICAgICAgICAgMTU4NzMsICAgICA0NTc4LAotICAgIDEwODcxLCAgICAgICAgIDI1NzQsICAgICAgICAgIDM3NzMsICAgICAxMTY2LAotICAgIDE0NTE5LCAgICAgICAgIDQwNDQsICAgICAgICAgMjA2OTksICAgICAyNjI3LAotICAgIDE1MjE5LCAgICAgICAgIDI3MzQsICAgICAgICAgMTUyNzQsICAgICAyMTg2LAotICAgIDYyNTcsICAgICAgICAgMzIyNiwgICAgICAgICAxMzEyNSwgICAgMTk0ODAsCi0gICAgNzE5NiwgICAgICAgICAgOTMwLCAgICAgICAgICAyNDYyLCAgICAgMTYxOCwKLSAgICA0NTE1LCAgICAgICAgIDMwOTIsICAgICAgICAgMTM4NTIsICAgICA0Mjc3LAotICAgIDEwNDYwLCAgICAgICAgICA4MzMsICAgICAgICAgMTczMzksICAgICAgODEwLAotICAgIDE2ODkxLCAgICAgICAgIDIyODksICAgICAgICAgMTU1NDYsICAgICA4MjE3LAotICAgIDEzNjAzLCAgICAgICAgIDE2ODQsICAgICAgICAgIDMxOTcsICAgICAxODM0LAotICAgIDE1OTQ4LCAgICAgICAgIDI4MjAsICAgICAgICAgMTU4MTIsICAgICA1MzI3LAotICAgIDE3MDA2LCAgICAgICAgIDI0MzgsICAgICAgICAgMTY3ODgsICAgICAxMzI2LAotICAgIDE1NjcxLCAgICAgICAgIDgxNTYsICAgICAgICAgMTE3MjYsICAgICA4NTU2LAotICAgIDM3NjIsICAgICAgICAgMjA1MywgICAgICAgICAgOTU2MywgICAgIDEzMTcsCi0gICAgMTM1NjEsICAgICAgICAgNjc5MCwgICAgICAgICAxMjIyNywgICAgIDE5MzYsCi0gICAgODE4MCwgICAgICAgICAzNTUwLCAgICAgICAgIDEzMjg3LCAgICAgMTc3OCwKLSAgICAxNjI5OSwgICAgICAgICA2NTk5LCAgICAgICAgIDE2MjkxLCAgICAgNzc1OCwKLSAgICA4NTIxLCAgICAgICAgIDI1NTEsICAgICAgICAgIDcyMjUsICAgICAyNjQ1LAotICAgIDE4MjY5LCAgICAgICAgIDc0ODksICAgICAgICAgMTY4ODUsICAgICAyMjQ4LAotICAgIDE3ODgyLCAgICAgICAgIDI4ODQsICAgICAgICAgMTcyNjUsICAgICAzMzI4LAotICAgIDk0MTcsICAgICAgICAyMDE2MiwgICAgICAgICAxMTA0MiwgICAgIDgzMjAsCi0gICAgMTI4NiwgICAgICAgICAgNjIwLCAgICAgICAgICAxNDMxLCAgICAgIDU4MywKLSAgICA1OTkzLCAgICAgICAgIDIyODksICAgICAgICAgIDM5NzgsICAgICAzNjI2LAotICAgIDUxNDQsICAgICAgICAgIDc1MiwgICAgICAgICAxMzQwOSwgICAgICA4MzAsCi0gICAgNTU1MywgICAgICAgICAyODYwLCAgICAgICAgIDExNzY0LCAgICAgNTkwOCwKLSAgICAxMDczNywgICAgICAgICAgNTYwLCAgICAgICAgICA1NDQ2LCAgICAgIDU2NCwKLSAgICAxMzMyMSwgICAgICAgICAzMDA4LCAgICAgICAgIDExOTQ2LCAgICAgMzY4MywKLSAgICAxOTg4NywgICAgICAgICAgNzk4LCAgICAgICAgICA5ODI1LCAgICAgIDcyOCwKLSAgICAxMzY2MywgICAgICAgICA4NzQ4LCAgICAgICAgICA3MzkxLCAgICAgMzA1MywKLSAgICAyNTE1LCAgICAgICAgICA3NzgsICAgICAgICAgIDYwNTAsICAgICAgODMzLAotICAgIDY0NjksICAgICAgICAgNTA3NCwgICAgICAgICAgODMwNSwgICAgIDI0NjMsCi0gICAgNjE0MSwgICAgICAgICAxODY1LCAgICAgICAgIDE1MzA4LCAgICAgMTI2MiwKLSAgICAxNDQwOCwgICAgICAgICA0NTQ3LCAgICAgICAgIDEzNjYzLCAgICAgNDUxNSwKLSAgICAzMTM3LCAgICAgICAgIDI5ODMsICAgICAgICAgIDI0NzksICAgICAxMjU5LAotICAgIDE1MDg4LCAgICAgICAgIDQ2NDcsICAgICAgICAgMTUzODIsICAgICAyNjA3LAotICAgIDE0NDkyLCAgICAgICAgIDIzOTIsICAgICAgICAgMTI0NjIsICAgICAyNTM3LAotICAgIDc1MzksICAgICAgICAgMjk0OSwgICAgICAgICAxMjkwOSwgICAgMTIwNjAsCi0gICAgNTQ2OCwgICAgICAgICAgNjg0LCAgICAgICAgICAzMTQxLCAgICAgIDcyMiwKLSAgICA1MDgxLCAgICAgICAgIDEyNzQsICAgICAgICAgMTI3MzIsICAgICA0MjAwLAotICAgIDE1MzAyLCAgICAgICAgICA2ODEsICAgICAgICAgIDc4MTksICAgICAgNTkyLAotICAgIDY1MzQsICAgICAgICAgMjAyMSwgICAgICAgICAxNjQ3OCwgICAgIDg3MzcsCi0gICAgMTMzNjQsICAgICAgICAgIDg4MiwgICAgICAgICAgNTM5NywgICAgICA4OTksCi0gICAgMTQ2NTYsICAgICAgICAgMjE3OCwgICAgICAgICAxNDc0MSwgICAgIDQyMjcsCi0gICAgMTQyNzAsICAgICAgICAgMTI5OCwgICAgICAgICAxMzkyOSwgICAgIDIwMjksCi0gICAgMTU0NzcsICAgICAgICAgNzQ4MiwgICAgICAgICAxNTgxNSwgICAgIDQ1NzIsCi0gICAgMjUyMSwgICAgICAgICAyMDEzLCAgICAgICAgICA1MDYyLCAgICAgMTgwNCwKLSAgICA1MTU5LCAgICAgICAgIDY1ODIsICAgICAgICAgIDcxMzAsICAgICAzNTk3LAotICAgIDEwOTIwLCAgICAgICAgIDE2MTEsICAgICAgICAgMTE3MjksICAgICAxNzA4LAotICAgIDE2OTAzLCAgICAgICAgIDM0NTUsICAgICAgICAgMTYyNjgsICAgICA2NjQwLAotICAgIDkzMDYsICAgICAgICAgMTAwNywgICAgICAgICAgOTM2OSwgICAgIDIxMDYsCi0gICAgMTkxODIsICAgICAgICAgNTAzNywgICAgICAgICAxMjQ0MSwgICAgIDQyNjksCi0gICAgMTU5MTksICAgICAgICAgMTMzMiwgICAgICAgICAxNTM1NywgICAgIDM1MTIsCi0gICAgMTE4OTgsICAgICAgICAxNDE0MSwgICAgICAgICAxNjEwMSwgICAgIDY4NTQsCi0gICAgMjAxMCwgICAgICAgICAgNzM3LCAgICAgICAgICAzNzc5LCAgICAgIDg2MSwKLSAgICAxMTQ1NCwgICAgICAgICAyODgwLCAgICAgICAgICAzNTY0LCAgICAgMzU0MCwKLSAgICA5MDU3LCAgICAgICAgIDEyNDEsICAgICAgICAgMTIzOTEsICAgICAgODk2LAotICAgIDg1NDYsICAgICAgICAgNDYyOSwgICAgICAgICAxMTU2MSwgICAgIDU3NzYsCi0gICAgODEyOSwgICAgICAgICAgNTg5LCAgICAgICAgICA4MjE4LCAgICAgIDU4OCwKLSAgICAxODcyOCwgICAgICAgICAzNzU1LCAgICAgICAgIDEyOTczLCAgICAgMzE0OSwKLSAgICAxNTcyOSwgICAgICAgICAgNzU4LCAgICAgICAgIDE2NjM0LCAgICAgIDc1NCwKLSAgICAxNTIyMiwgICAgICAgIDExMTM4LCAgICAgICAgIDE1ODcxLCAgICAgMjIwOCwKLSAgICA0NjczLCAgICAgICAgICA2MTAsICAgICAgICAgMTAyMTgsICAgICAgNjc4LAotICAgIDE1MjU3LCAgICAgICAgIDQxNDYsICAgICAgICAgIDU3MjksICAgICAzMzI3LAotICAgIDgzNzcsICAgICAgICAgMTY3MCwgICAgICAgICAxOTg2MiwgICAgIDIzMjEsCi0gICAgMTU0NTAsICAgICAgICAgNTUxMSwgICAgICAgICAxNDA1NCwgICAgIDU0ODEsCi0gICAgNTcyOCwgICAgICAgICAyODg4LCAgICAgICAgICA3NTgwLCAgICAgMTM0NiwKLSAgICAxNDM4NCwgICAgICAgICA1MzI1LCAgICAgICAgIDE2MjM2LCAgICAgMzk1MCwKLSAgICAxNTExOCwgICAgICAgICAzNzQ0LCAgICAgICAgIDE1MzA2LCAgICAgMTQzNSwKLSAgICAxNDU5NywgICAgICAgICA0MDcwLCAgICAgICAgIDEyMzAxLCAgICAxNTY5NiwKLSAgICA3NjE3LCAgICAgICAgIDE2OTksICAgICAgICAgIDIxNzAsICAgICAgODg0LAotICAgIDQ0NTksICAgICAgICAgNDU2NywgICAgICAgICAxODA5NCwgICAgIDMzMDYsCi0gICAgMTI3NDIsICAgICAgICAgIDgxNSwgICAgICAgICAxNDkyNiwgICAgICA5MDcsCi0gICAgMTUwMTYsICAgICAgICAgNDI4MSwgICAgICAgICAxNTUxOCwgICAgIDgzNjgsCi0gICAgMTc5OTQsICAgICAgICAgMTA4NywgICAgICAgICAgMjM1OCwgICAgICA4NjUsCi0gICAgMTYyODEsICAgICAgICAgMzc4NywgICAgICAgICAxNTY3OSwgICAgIDQ1OTYsCi0gICAgMTYzNTYsICAgICAgICAgMTUzNCwgICAgICAgICAxNjU4NCwgICAgIDIyMTAsCi0gICAgMTY4MzMsICAgICAgICAgOTY5NywgICAgICAgICAxNTkyOSwgICAgIDQ1MTMsCi0gICAgMzI3NywgICAgICAgICAxMDg1LCAgICAgICAgICA5NjQzLCAgICAgMjE4NywKLSAgICAxMTk3MywgICAgICAgICA2MDY4LCAgICAgICAgICA5MTk5LCAgICAgNDQ2MiwKLSAgICA4OTU1LCAgICAgICAgIDE2MjksICAgICAgICAgMTAyODksICAgICAzMDYyLAotICAgIDE2NDgxLCAgICAgICAgIDUxNTUsICAgICAgICAgMTU0NjYsICAgICA3MDY2LAotICAgIDEzNjc4LCAgICAgICAgIDI1NDMsICAgICAgICAgIDUyNzMsICAgICAyMjc3LAotICAgIDE2NzQ2LCAgICAgICAgIDYyMTMsICAgICAgICAgMTY2NTUsICAgICAzNDA4LAotICAgIDIwMzA0LCAgICAgICAgIDMzNjMsICAgICAgICAgMTg2ODgsICAgICAxOTg1LAotICAgIDE0MTcyLCAgICAgICAgMTI4NjcsICAgICAgICAgMTUxNTQsICAgIDE1NzAzLAotICAgIDQ0NzMsICAgICAgICAgMTAyMCwgICAgICAgICAgMTY4MSwgICAgICA4ODYsCi0gICAgNDMxMSwgICAgICAgICA0MzAxLCAgICAgICAgICA4OTUyLCAgICAgMzY1NywKLSAgICA1ODkzLCAgICAgICAgIDExNDcsICAgICAgICAgMTE2NDcsICAgICAxNDUyLAotICAgIDE1ODg2LCAgICAgICAgIDIyMjcsICAgICAgICAgIDQ1ODIsICAgICA2NjQ0LAotICAgIDY5MjksICAgICAgICAgMTIwNSwgICAgICAgICAgNjIyMCwgICAgICA3OTksCi0gICAgMTI0MTUsICAgICAgICAgMzQwOSwgICAgICAgICAxNTk2OCwgICAgIDM4NzcsCi0gICAgMTk4NTksICAgICAgICAgMjEwOSwgICAgICAgICAgOTY4OSwgICAgIDIxNDEsCi0gICAgMTQ3NDIsICAgICAgICAgODgzMCwgICAgICAgICAxNDQ4MCwgICAgIDI1OTksCi0gICAgMTgxNywgICAgICAgICAxMjM4LCAgICAgICAgICA3NzcxLCAgICAgIDgxMywKLSAgICAxOTA3OSwgICAgICAgICA0NDEwLCAgICAgICAgICA1NTU0LCAgICAgMjA2NCwKLSAgICAzNjg3LCAgICAgICAgIDI4NDQsICAgICAgICAgMTc0MzUsICAgICAyMjU2LAotICAgIDE2Njk3LCAgICAgICAgIDQ0ODYsICAgICAgICAgMTYxOTksICAgICA1Mzg4LAotICAgIDgwMjgsICAgICAgICAgMjc2MywgICAgICAgICAgMzQwNSwgICAgIDIxMTksCi0gICAgMTc0MjYsICAgICAgICAgNTQ3NywgICAgICAgICAxMzY5OCwgICAgIDI3ODYsCi0gICAgMTk4NzksICAgICAgICAgMjcyMCwgICAgICAgICAgOTA5OCwgICAgIDM4ODAsCi0gICAgMTgxNzIsICAgICAgICAgNDgzMywgICAgICAgICAxNzMzNiwgICAgMTIyMDcsCi0gICAgNTExNiwgICAgICAgICAgOTk2LCAgICAgICAgICA0OTM1LCAgICAgIDk4OCwKLSAgICA5ODg4LCAgICAgICAgIDMwODEsICAgICAgICAgIDYwMTQsICAgICA1MzcxLAotICAgIDE1ODgxLCAgICAgICAgIDE2NjcsICAgICAgICAgIDg0MDUsICAgICAxMTgzLAotICAgIDE1MDg3LCAgICAgICAgIDIzNjYsICAgICAgICAgMTk3NzcsICAgICA3MDAyLAotICAgIDExOTYzLCAgICAgICAgIDE1NjIsICAgICAgICAgIDcyNzksICAgICAxMTI4LAotICAgIDE2ODU5LCAgICAgICAgIDE1MzIsICAgICAgICAgMTU3NjIsICAgICA1MzgxLAotICAgIDE0NzA4LCAgICAgICAgIDIwNjUsICAgICAgICAgMjAxMDUsICAgICAyMTU1LAotICAgIDE3MTU4LCAgICAgICAgIDgyNDUsICAgICAgICAgMTc5MTEsICAgICA2MzE4LAotICAgIDU0NjcsICAgICAgICAgMTUwNCwgICAgICAgICAgNDEwMCwgICAgIDI1NzQsCi0gICAgMTc0MjEsICAgICAgICAgNjgxMCwgICAgICAgICAgNTY3MywgICAgIDI4ODgsCi0gICAgMTY2MzYsICAgICAgICAgMzM4MiwgICAgICAgICAgODk3NSwgICAgIDE4MzEsCi0gICAgMjAxNTksICAgICAgICAgNDczNywgICAgICAgICAxOTU1MCwgICAgIDcyOTQsCi0gICAgNjY1OCwgICAgICAgICAyNzgxLCAgICAgICAgIDExNDcyLCAgICAgMzMyMSwKLSAgICAxOTM5NywgICAgICAgICA1MDU0LCAgICAgICAgIDE4ODc4LCAgICAgNDcyMiwKLSAgICAxNjQzOSwgICAgICAgICAyMzczLCAgICAgICAgIDIwNDMwLCAgICAgNDM4NiwKLSAgICAxMTM1MywgICAgICAgIDI2NTI2LCAgICAgICAgIDExNTkzLCAgICAgMzA2OCwKLSAgICAyODY2LCAgICAgICAgIDE1NjYsICAgICAgICAgIDUxMDgsICAgICAxMDcwLAotICAgIDk2MTQsICAgICAgICAgNDkxNSwgICAgICAgICAgNDkzOSwgICAgIDM1MzYsCi0gICAgNzU0MSwgICAgICAgICAgODc4LCAgICAgICAgIDIwNzE3LCAgICAgIDg1MSwKLSAgICA2OTM4LCAgICAgICAgIDQzOTUsICAgICAgICAgMTY3OTksICAgICA3NzMzLAotICAgIDEwMTM3LCAgICAgICAgIDEwMTksICAgICAgICAgIDk4NDUsICAgICAgOTY0LAotICAgIDE1NDk0LCAgICAgICAgIDM5NTUsICAgICAgICAgMTU0NTksICAgICAzNDMwLAotICAgIDE4ODYzLCAgICAgICAgICA5ODIsICAgICAgICAgMjAxMjAsICAgICAgOTYzLAotICAgIDE2ODc2LCAgICAgICAgMTI4ODcsICAgICAgICAgMTQzMzQsICAgICA0MjAwLAotICAgIDY1OTksICAgICAgICAgMTIyMCwgICAgICAgICAgOTIyMiwgICAgICA4MTQsCi0gICAgMTY5NDIsICAgICAgICAgNTEzNCwgICAgICAgICAgNTY2MSwgICAgIDQ4OTgsCi0gICAgNTQ4OCwgICAgICAgICAxNzk4LCAgICAgICAgIDIwMjU4LCAgICAgMzk2MiwKLSAgICAxNzAwNSwgICAgICAgICA2MTc4LCAgICAgICAgIDE3OTI5LCAgICAgNTkyOSwKLSAgICA5MzY1LCAgICAgICAgIDM0MjAsICAgICAgICAgIDc0NzQsICAgICAxOTcxLAotICAgIDE5NTM3LCAgICAgICAgIDUxNzcsICAgICAgICAgMTkwMDMsICAgICAzMDA2LAotICAgIDE2NDU0LCAgICAgICAgIDM3ODgsICAgICAgICAgMTYwNzAsICAgICAyMzY3LAotICAgIDg2NjQsICAgICAgICAgMjc0MywgICAgICAgICAgOTQ0NSwgICAgMjYzNTgsCi0gICAgMTA4NTYsICAgICAgICAgMTI4NywgICAgICAgICAgMzU1NSwgICAgIDEwMDksCi0gICAgNTYwNiwgICAgICAgICAzNjIyLCAgICAgICAgIDE5NDUzLCAgICAgNTUxMiwKLSAgICAxMjQ1MywgICAgICAgICAgNzk3LCAgICAgICAgIDIwNjM0LCAgICAgIDkxMSwKLSAgICAxNTQyNywgICAgICAgICAzMDY2LCAgICAgICAgIDE3MDM3LCAgICAxMDI3NSwKLSAgICAxODg4MywgICAgICAgICAyNjMzLCAgICAgICAgICAzOTEzLCAgICAgMTI2OCwKLSAgICAxOTUxOSwgICAgICAgICAzMzcxLCAgICAgICAgIDE4MDUyLCAgICAgNTIzMCwKLSAgICAxOTI5MSwgICAgICAgICAxNjc4LCAgICAgICAgIDE5NTA4LCAgICAgMzE3MiwKLSAgICAxODA3MiwgICAgICAgIDEwNzU0LCAgICAgICAgIDE2NjI1LCAgICAgNjg0NSwKLSAgICAzMTM0LCAgICAgICAgIDIyOTgsICAgICAgICAgMTA4NjksICAgICAyNDM3LAotICAgIDE1NTgwLCAgICAgICAgIDY5MTMsICAgICAgICAgMTI1OTcsICAgICAzMzgxLAotICAgIDExMTE2LCAgICAgICAgIDMyOTcsICAgICAgICAgMTY3NjIsICAgICAyNDI0LAotICAgIDE4ODUzLCAgICAgICAgIDY3MTUsICAgICAgICAgMTcxN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AgICovCi0gICAgY29uc3QgV29yZDE2ICpwLCAgICAgICAvKiBpICA6IHBvaW50ZXIgdG8gc2VsZWN0ZWQgcXVhbnRpemVyIHRhYmxlIGVudHJ5ICovCi0gICAgV29yZDE2IGdjb2RlMCwgICAgICAgICAvKiBpICA6IHByZWRpY3RlZCBDQiBnYWluLCAgICAgUSgxNCAtIGV4cF9nY29kZTApICovCi0gICAgV29yZDE2IGV4cF9nY29kZTAsICAgICAvKiBpICA6IGV4cG9uZW50IG9mIHByZWRpY3RlZCBDQiBnYWluLCAgICAgICAgUTAgICovCi0gICAgV29yZDE2ICpnYWluX3BpdCwgICAgICAvKiBvICA6IFBpdGNoIGdhaW4sICAgICAgICAgICAgICAgICAgICAgICAgICAgUTE0ICovCi0gICAgV29yZDE2ICpnYWluX2NvZCwgICAgICAvKiBvICA6IENvZGUgZ2FpbiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgUTEgICovCi0gICAgRmxhZyAgICpwT3ZlcmZsb3cgICAgICAvKiBvICA6IG92ZXJmbG93IGluZGljYXRvciAgICAgICAgICAgICAgICAgICAgICAgICovCi0pCi17Ci0gICAgV29yZDE2IGdfY29kZTsKLSAgICBXb3JkMTYgZXhwOwotICAgIFdvcmQxNiBmcmFjOwotICAgIFdvcmQxNiB0bXA7Ci0gICAgV29yZDMyIExfdG1wOwotCi0gICAgV29yZDE2IHF1YV9lbmVyX01SMTIyOyAvKiBvICA6IHF1YW50aXplZCBlbmVyZ3kgZXJyb3IsIE1SMTIyIHZlcnNpb24gUTEwICovCi0gICAgV29yZDE2IHF1YV9lbmVyOyAgICAgICAvKiBvICA6IHF1YW50aXplZCBlbmVyZ3kgZXJyb3IsICAgICAgICAgICAgICAgUTEwICovCi0KLQotICAgIC8qIFJlYWQgdGhlIHF1YW50aXplZCBnYWlucyAqLwotICAgICpnYWluX3BpdCA9ICpwKys7Ci0gICAgZ19jb2RlID0gKnArKzsKLQotICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKgotICAgICAqICBjYWxjdWxhdGUgZmluYWwgZml4ZWQgY29kZWJvb2sgZ2FpbjogICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICB+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICAgZ2MgPSBnYzAgKiBnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLQotICAgIExfdG1wID0gKChXb3JkMzIpIGdfY29kZSAqIGdjb2RlMCkgPDwgMTsKLSAgICB0bXAgICA9IDEwIC0gZXhwX2djb2RlMDsKLSAgICBMX3RtcCA9IExfc2hyKExfdG1wLCB0bXAsIHBPdmVyZmxvdyk7Ci0gICAgKmdhaW5fY29kID0gKFdvcmQxNikoTF90bXAgPj4gMTYpOwotCi0gICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCi0gICAgICogIGNhbGN1bGF0ZSBwcmVkaWN0b3IgdXBkYXRlIHZhbHVlcyBhbmQgdXBkYXRlIGdhaW4gcHJlZGljdG9yOiAgICAqCi0gICAgICogIH5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fiAgICAqCi0gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICogICBxdWFfZW5lciAgICAgICA9IGxvZzIoZykgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICogICBxdWFfZW5lcl9NUjEyMiA9IDIwKmxvZzEwKGcpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotCi0gICAgLyogTG9nMih4IFExMikgPSBsb2cyKHgpICsgMTIgKi8KLSAgICBMb2cyKChXb3JkMzIpIGdfY29kZSwgJmV4cCwgJmZyYWMsIHBPdmVyZmxvdyk7Ci0gICAgZXhwIC09IDEyOwotCi0gICAgdG1wID0gc2hyX3IoZnJhYywgNSwgcE92ZXJmbG93KTsKLSAgICBxdWFfZW5lcl9NUjEyMiA9IGV4cCA8PCAxMDsKLSAgICBxdWFfZW5lcl9NUjEyMiA9IHRtcCArIHF1YV9lbmVyX01SMTIyOwotCi0gICAgLyogMjQ2NjAgUTEyIH49IDYuMDIwNiA9IDIwKmxvZzEwKDIpICovCi0gICAgTF90bXAgPSBNcHlfMzJfMTYoZXhwLCBmcmFjLCAyNDY2MCwgcE92ZXJmbG93KTsKLSAgICBMX3RtcCA9IExfdG1wIDw8IDEzOwotCi0gICAgLyogUTEyICogUTAgPSBRMTMgLT4gUTEwICovCi0gICAgcXVhX2VuZXIgPSAoV29yZDE2KSgoTF90bXAgKyAoV29yZDMyKSAweDAwMDA4MDAwTCkgPj4gMTYpOwotCi0gICAgZ2NfcHJlZF91cGRhdGUocHJlZF9zdCwgcXVhX2VuZXJfTVIxMjIsIHF1YV9lbmVyKTsKLQotICAgIHJldHVybjsKLX0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiov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cmQxNgotTVI0NzVfZ2Fpbl9xdWFudCggICAgICAgICAgICAgIC8vIG8gIDogaW5kZXggb2YgcXVhbnRpemF0aW9uLgotICAgIGdjX3ByZWRTdGF0ZSAqcHJlZF9zdCwgICAgIC8vIGkvbzogZ2FpbiBwcmVkaWN0b3Igc3RhdGUgc3RydWN0Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkYXRhIGZyb20gc3ViZnJhbWUgMCAob3IgMikKLSAgICBXb3JkMTYgc2YwX2V4cF9nY29kZTAsICAgICAvLyBpICA6IHByZWRpY3RlZCBDQiBnYWluIChleHBvbmVudCksICAgICAgUTAKLSAgICBXb3JkMTYgc2YwX2ZyYWNfZ2NvZGUwLCAgICAvLyBpICA6IHByZWRpY3RlZCBDQiBnYWluIChmcmFjdGlvbiksICAgICAgUTE1Ci0gICAgV29yZDE2IHNmMF9leHBfY29lZmZbXSwgICAgLy8gaSAgOiBlbmVyZ3kgY29lZmYuICg1KSwgZXhwb25lbnQgcGFydCwgIFEwCi0gICAgV29yZDE2IHNmMF9mcmFjX2NvZWZmW10sICAgLy8gaSAgOiBlbmVyZ3kgY29lZmYuICg1KSwgZnJhY3Rpb24gcGFydCwgIFExNQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgKGZyYWNfY29lZmYgYW5kIGV4cF9jb2VmZiBjb21wdXRlZCBpbgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgIGNhbGNfZmlsdF9lbmVyZ2llcygpKQotICAgIFdvcmQxNiBzZjBfZXhwX3RhcmdldF9lbiwgIC8vIGkgIDogZXhwb25lbnQgb2YgdGFyZ2V0IGVuZXJneSwgICAgICAgICBRMAotICAgIFdvcmQxNiBzZjBfZnJhY190YXJnZXRfZW4sIC8vIGkgIDogZnJhY3Rpb24gb2YgdGFyZ2V0IGVuZXJneSwgICAgICAgICBRMTUKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRhdGEgZnJvbSBzdWJmcmFtZSAxIChvciAzKQotICAgIFdvcmQxNiBzZjFfY29kZV9ub3NoYXJwW10sIC8vIGkgIDogaW5ub3ZhdGl2ZSBjb2RlYm9vayB2ZWN0b3IgKExfU1VCRlIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAod2hpdGhvdXQgcGl0Y2ggc2hhcnBlbmluZykKLSAgICBXb3JkMTYgc2YxX2V4cF9nY29kZTAsICAgICAvLyBpICA6IHByZWRpY3RlZCBDQiBnYWluIChleHBvbmVudCksICAgICAgUTAKLSAgICBXb3JkMTYgc2YxX2ZyYWNfZ2NvZGUwLCAgICAvLyBpICA6IHByZWRpY3RlZCBDQiBnYWluIChmcmFjdGlvbiksICAgICAgUTE1Ci0gICAgV29yZDE2IHNmMV9leHBfY29lZmZbXSwgICAgLy8gaSAgOiBlbmVyZ3kgY29lZmYuICg1KSwgZXhwb25lbnQgcGFydCwgIFEwCi0gICAgV29yZDE2IHNmMV9mcmFjX2NvZWZmW10sICAgLy8gaSAgOiBlbmVyZ3kgY29lZmYuICg1KSwgZnJhY3Rpb24gcGFydCwgIFExNQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgKGZyYWNfY29lZmYgYW5kIGV4cF9jb2VmZiBjb21wdXRlZCBpbgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgIGNhbGNfZmlsdF9lbmVyZ2llcygpKQotICAgIFdvcmQxNiBzZjFfZXhwX3RhcmdldF9lbiwgIC8vIGkgIDogZXhwb25lbnQgb2YgdGFyZ2V0IGVuZXJneSwgICAgICAgICBRMAotICAgIFdvcmQxNiBzZjFfZnJhY190YXJnZXRfZW4sIC8vIGkgIDogZnJhY3Rpb24gb2YgdGFyZ2V0IGVuZXJneSwgICAgICAgICBRMTUKLQotICAgIFdvcmQxNiBncF9saW1pdCwgICAgICAgICAgIC8vIGkgIDogcGl0Y2ggZ2FpbiBsaW1pdAotCi0gICAgV29yZDE2ICpzZjBfZ2Fpbl9waXQsICAgICAgLy8gbyAgOiBQaXRjaCBnYWluLCAgICAgICAgICAgICAgICAgICAgICAgIFExNAotICAgIFdvcmQxNiAqc2YwX2dhaW5fY29kLCAgICAgIC8vIG8gIDogQ29kZSBnYWluLCAgICAgICAgICAgICAgICAgICAgICAgICBRMQotCi0gICAgV29yZDE2ICpzZjFfZ2Fpbl9waXQsICAgICAgLy8gbyAgOiBQaXRjaCBnYWluLCAgICAgICAgICAgICAgICAgICAgICAgIFExNAotICAgIFdvcmQxNiAqc2YxX2dhaW5fY29kICAgICAgIC8vIG8gIDogQ29kZSBnYWluLCAgICAgICAgICAgICAgICAgICAgICAgICBRMQotKQotewotICAgIGNvbnN0IFdvcmQxNiAqcDsKLSAgICBXb3JkMTYgaSwgaW5kZXggPSAwOwotICAgIFdvcmQxNiB0bXA7Ci0gICAgV29yZDE2IGV4cDsKLSAgICBXb3JkMTYgc2YwX2djb2RlMCwgc2YxX2djb2RlMDsKLSAgICBXb3JkMTYgZ19waXRjaCwgZzJfcGl0Y2gsIGdfY29kZSwgZzJfY29kZSwgZ19waXRfY29kOwotICAgIFdvcmQxNiBjb2VmZlsxMF0sIGNvZWZmX2xvWzEwXSwgZXhwX21heFsxMF07ICAvLyAwLi40OiBzZjA7IDUuLjk6IHNmMQotICAgIFdvcmQzMiBMX3RtcCwgZGlzdF9taW47Ci0KLSAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCi0gICAgICogIHByZWRpY3RlZCBjb2RlYm9vayBnYWluICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICB+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAgICAgKiAgZ2MwICAgICA9IDJeZXhwX2djb2RlMCArIDJeZnJhY19nY29kZTAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICBnY29kZTAgKFExNCkgPSAyXjE0KjJeZnJhY19nY29kZTAgPSBnYzAgKiAyXigxNC1leHBfZ2NvZGUwKSAgICAgICoKLSAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCi0KLSAgICBzZjBfZ2NvZGUwID0gZXh0cmFjdF9sKFBvdzIoMTQsIHNmMF9mcmFjX2djb2RlMCkpOwotICAgIHNmMV9nY29kZTAgPSBleHRyYWN0X2woUG93MigxNCwgc2YxX2ZyYWNfZ2NvZGUwKSk7Ci0KLSAgICAgKiBGb3IgZWFjaCBzdWJmcmFtZSwgdGhlIGVycm9yIGVuZXJneSAoc3VtKSB0byBiZSBtaW5pbWl6ZWQgY29uc2lzdHMKLSAgICAgKiBvZiBmaXZlIHRlcm1zLCB0WzAuLjRdLgotICAgICAqCi0gICAgICogICAgICAgICAgICAgICAgICAgICAgdFswXSA9ICAgIGdwXjIgICogPHkxIHkxPgotICAgICAqICAgICAgICAgICAgICAgICAgICAgIHRbMV0gPSAtMipncCAgICAqIDx4biB5MT4KLSAgICAgKiAgICAgICAgICAgICAgICAgICAgICB0WzJdID0gICAgZ2NeMiAgKiA8eTIgeTI+Ci0gICAgICogICAgICAgICAgICAgICAgICAgICAgdFszXSA9IC0yKmdjICAgICogPHhuIHkyPgotICAgICAqICAgICAgICAgICAgICAgICAgICAgIHRbNF0gPSAgMipncCpnYyAqIDx5MSB5Mj4KLSAgICAgKgotCi0gICAgLy8gc2YgMAotICAgIC8vIGRldGVybWluZSB0aGUgc2NhbGluZyBleHBvbmVudCBmb3IgZ19jb2RlOiBlYyA9IGVjMCAtIDExCi0gIC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gIHsKLSAgICAgICAgZXhwX21heFtpXSA9IGFkZCAoZXhwX21heFtpXSwgZXhwKTsKLSAgICB9Ci0KLSAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCi0gICAgICogIEZpbmQgbWF4aW11bSBleHBvbmVudDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICB+fn5+fn5+fn5+fn5+fn5+fn5+fn5+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICogIEZvciB0aGUgc3VtIG9wZXJhdGlvbiwgYWxsIHRlcm1zIG11c3QgaGF2ZSB0aGUgc2FtZSBzY2FsaW5nOyAgICAgKgotICAgICAqICB0aGF0IHNjYWxpbmcgc2hvdWxkIGJlIGxvdyBlbm91Z2ggdG8gcHJldmVudCBvdmVyZmxvdy4gVGhlcmUtICAgICoKLSAgICAgKiAgZm9yZSwgdGhlIG1heGltdW0gc2NhbGUgaXMgZGV0ZXJtaW5lZCBhbmQgYWxsIGNvZWZmaWNpZW50cyBhcmUgICAqCi0gICAgICogIHJlLXNjYWxlZDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAgICAgKiAgICBleHAgPSBtYXgoZXhwX21heFtpXSkgKyAxOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICogICAgZSA9IGV4cF9tYXhbaV0tZXhwOyAgICAgICAgIGUgPD0gMCEgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICAgIGNbaV0gPSBjW2ldKjJeZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCi0KLSAgICBleHAgPSBleHBfbWF4WzBdOwotICAgIGZvciAoaSA9IDE7IGkgPCAxMDsgaSsrKQotICAgIHsKLSAgICAgICAgaWYgKHN1YihleHBfbWF4W2ldLCBleHApID4gMCkKLSAgICAgICAgewotICAgICAgICAgICAgZXhwID0gZXhwX21heFtpXTsKLSAgICAgICAgfQotICAgIH0KLSAgICBleHAgPSBhZGQoZXhwLCAxKTsgICAgICAvLyBUbyBhdm9pZCBvdmVyZmxvdwotCi0gICAgcCA9ICZzZjBfZnJhY19jb2VmZlswXTsKLSAgICBmb3IgKGkgPSAwOyBpIDwgNTsgaSsrKSB7Ci0gICAgICAgIHRtcCA9IHN1YihleHAsIGV4cF9tYXhbaV0pOwotICAgICAgICBMX3RtcCA9IExfZGVwb3NpdF9oKCpwKyspOwotICAgICAgICBMX3RtcCA9IExfc2hyKExfdG1wLCB0bXApOwotICAgICAgICBMX0V4dHJhY3QoTF90bXAsICZjb2VmZltpXSwgJmNvZWZmX2xvW2ldKTsKLSAgICB9Ci0gICAgcCA9ICZzZjFfZnJhY19jb2VmZlswXTsKLSAgICBmb3IgKDsgaSA8IDEwOyBpKyspIHsKLSAgICAgICAgdG1wID0gc3ViKGV4cCwgZXhwX21heFtpXSk7Ci0gICAgICAgIExfdG1wID0gTF9kZXBvc2l0X2goKnArKyk7Ci0gICAgICAgIExfdG1wID0gTF9zaHIoTF90bXAsIHRtcCk7Ci0gICAgICAgIExfRXh0cmFjdChMX3RtcCwgJmNvZWZmW2ldLCAmY29lZmZfbG9baV0pOwotICAgIH0KLQotICAgIC8vLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSoKLSAgICAgKiAgQ29kZWJvb2sgc2VhcmNoOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICogIH5+fn5+fn5+fn5+fn5+fn4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAgICAgKiAgRm9yIGVhY2ggcGFpciAoZ19waXRjaCwgZ19mYWMpIGluIHRoZSB0YWJsZSBjYWxjdWxhdGUgdGhlICAgICAgICAqCi0gICAgICogIHRlcm1zIHRbMC4uNF0gYW5kIHN1bSB0aGVtIHVwOyB0aGUgcmVzdWx0IGlzIHRoZSBtZWFuIHNxdWFyZWQgICAgKgotICAgICAqICBlcnJvciBmb3IgdGhlIHF1YW50aXplZCBnYWlucyBmcm9tIHRoZSB0YWJsZS4gVGhlIGluZGV4IGZvciB0aGUgICoKLSAgICAgKiAgbWluaW11bSBNU0UgaXMgc3RvcmVkIGFuZCBmaW5hbGx5IHVzZWQgdG8gcmV0cmlldmUgdGhlIHF1YW50aXplZCAqCi0gICAgICogIGdhaW5zICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQotCi0gICAgLy8gc3RhcnQgd2l0aCAiaW5maW5pdGUiIE1TRQotICAgIGRpc3RfbWluID0gTUFYXzMyOwotCi0gICAgcCA9ICZ0YWJsZV9nYWluX01SNDc1WzBdOwotCi0gICAgZm9yIChpID0gMDsgaSA8IE1SNDc1X1ZRX1NJWkU7IGkrKykKLS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ID0gbXVsdChnX2NvZGUsIHNmMV9nY29kZTApOwotICAgICAgICAgICAgZzJfcGl0Y2ggPSBtdWx0KGdfcGl0Y2gsIGdfcGl0Y2gpOwotICAgICAgICAgICAgZzJfY29kZSA9IG11bHQoZ19jb2RlLCBnX2NvZGUpOwotICAgICAgICAgICAgZ19waXRfY29kID0gbXVsdChnX2NvZGUsIGdfcGl0Y2gpOwotCi0gICAgICAgICAgICBMX3RtcCA9IE1hY18zMl8xNihMX3RtcCwgY29lZmZbNV0sIGNvZWZmX2xvWzVdLCBnMl9waXRjaCk7Ci0gICAgICAgICAgICBMX3RtcCA9IE1hY18zMl8xNihMX3RtcCwgY29lZmZbNl0sIGNvZWZmX2xvWzZdLCBnX3BpdGNoKTsKLSAgICAgICAgICAgIExfdG1wID0gTWFjXzMyXzE2KExfdG1wLCBjb2VmZls3XSwgY29lZmZfbG9bN10sIGcyX2NvZGUpOwotICAgICAgICAgICAgTF90bXAgPSBNYWNfMzJfMTYoTF90bXAsIGNvZWZmWzhdLCBjb2VmZl9sb1s4XSwgZ19jb2RlKTsKLSAgICAgICAgICAgIExfdG1wID0gTWFjXzMyXzE2KExfdG1wLCBjb2VmZls5XSwgY29lZmZfbG9bOV0sIGdfcGl0X2NvZCk7Ci0KLSAgICAgICAgICAgIC8vIHN0b3JlIHRhYmxlIGluZGV4IGlmIE1TRSBmb3IgdGhpcyBpbmRleCBpcyBsb3dlcgotICAgICAgICAgICAgICAgdGhhbiB0aGUgbWluaW11bSBNU0Ugc2VlbiBzbyBmYXIKLSAgICAgICAgICAgIGlmIChMX3N1YihMX3RtcCwgZGlzdF9taW4pIDwgKFdvcmQzMikgMCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBkaXN0X21pbiA9IExfdG1wOwotICAgICAgICAgICAgICAgIGluZGV4ID0gaTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgICAqLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tL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AgICAgIFExNSAqLwotICAgIFdvcmQxNiBzZjFfZXhwX2NvZWZmW10sICAgIC8qIGkgIDogZW5lcmd5IGNvZWZmLiAoNSksIGV4cG9uZW50IHBhcnQsICBRMCAgKi8KLSAgICBXb3JkMTYgc2YxX2ZyYWNfY29lZmZbXSwgICAvKiBpICA6IGVuZXJneSBjb2VmZi4gKDUpLCBmcmFjdGlvbiBwYXJ0LCAgUTE1ICovCi0gICAgLyogICAgICAoZnJhY19jb2VmZiBhbmQgZXhwX2NvZWZmIGNvbXB1dGVkIGluICAqLwotICAgIC8qICAgICAgIGNhbGNfZmlsdF9lbmVyZ2llcygpKSAgICAgICAgICAgICAgICAgKi8KLSAgICBXb3JkMTYgc2YxX2V4cF90YXJnZXRfZW4sICAvKiBpICA6IGV4cG9uZW50IG9mIHRhcmdldCBlbmVyZ3ksICAgICAgICAgUTAgICovCi0gICAgV29yZDE2IHNmMV9mcmFjX3RhcmdldF9lbiwgLyogaSAgOiBmcmFjdGlvbiBvZiB0YXJnZXQgZW5lcmd5LCAgICAgICAgIFExNSAqLwotCi0gICAgV29yZDE2IGdwX2xpbWl0LCAgICAgICAgICAgLyogaSAgOiBwaXRjaCBnYWluIGxpbWl0ICAgICAgICAgICAgICAgICAgICAgICAqLwotCi0gICAgV29yZDE2ICpzZjBfZ2Fpbl9waXQsICAgICAgLyogbyAgOiBQaXRjaCBnYWluLCAgICAgICAgICAgICAgICAgICAgICAgIFExNCAqLwotICAgIFdvcmQxNiAqc2YwX2dhaW5fY29kLCAgICAgIC8qIG8gIDogQ29kZSBnYWluLCAgICAgICAgICAgICAgICAgICAgICAgICBRMSAgKi8KLQotICAgIFdvcmQxNiAqc2YxX2dhaW5fcGl0LCAgICAgIC8qIG8gIDogUGl0Y2ggZ2FpbiwgICAgICAgICAgICAgICAgICAgICAgICBRMTQgKi8KLSAgICBXb3JkMTYgKnNmMV9nYWluX2NvZCwgICAgICAvKiBvICA6IENvZGUgZ2FpbiwgICAgICAgICAgICAgICAgICAgICAgICAgUTEgICovCi0gICAgRmxhZyAgICpwT3ZlcmZsb3cgICAgICAgICAgLyogbyAgOiBvdmVyZmxvdyBpbmRpY2F0b3IgICAgICAgICAgICAgICAgICAgICAqLwotKQotewotICAgIGNvbnN0IFdvcmQxNiAqcDsKLSAgICBXb3JkMTYgaTsKLSAgICBXb3JkMTYgaW5kZXggPSAwOwotICAgIFdvcmQxNiB0bXA7Ci0gICAgV29yZDE2IGV4cDsKLSAgICBXb3JkMTYgc2YwX2djb2RlMDsKLSAgICBXb3JkMTYgc2YxX2djb2RlMDsKLSAgICBXb3JkMTYgZ19waXRjaDsKLSAgICBXb3JkMTYgZzJfcGl0Y2g7Ci0gICAgV29yZDE2IGdfY29kZTsKLSAgICBXb3JkMTYgZzJfY29kZTsKLSAgICBXb3JkMTYgZ19waXRfY29kOwotICAgIFdvcmQxNiBjb2VmZlsxMF07Ci0gICAgV29yZDE2IGNvZWZmX2xvWzEwXTsKLSAgICBXb3JkMTYgZXhwX21heFsxMF07ICAvKiAwLi40OiBzZjA7IDUuLjk6IHNmMSAqLwotICAgIFdvcmQzMiBMX3RtcDsKLSAgICBXb3JkMzIgZGlzdF9taW47Ci0KLSAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qCi0gICAgICogIHByZWRpY3RlZCBjb2RlYm9vayBnYWluICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICB+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAgICAgKiAgZ2MwICAgICA9IDJeZXhwX2djb2RlMCArIDJeZnJhY19nY29kZTAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICBnY29kZTAgKFExNCkgPSAyXjE0KjJeZnJhY19nY29kZTAgPSBnYzAgKiAyXigxNC1leHBfZ2NvZGUwKSAgICAgICoKLSAgICAgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotCi0gICAgc2YwX2djb2RlMCA9IChXb3JkMTYpKFBvdzIoMTQsIHNmMF9mcmFjX2djb2RlMCwgcE92ZXJmbG93KSk7Ci0gICAgc2YxX2djb2RlMCA9IChXb3JkMTYpKFBvdzIoMTQsIHNmMV9mcmFjX2djb2RlMCwgcE92ZXJmbG93KSk7Ci0KLSAgICAvKgotICAgICAqIEZvciBlYWNoIHN1YmZyYW1lLCB0aGUgZXJyb3IgZW5lcmd5IChzdW0pIHRvIGJlIG1pbmltaXplZCBjb25zaXN0cwotICAgICAqIG9mIGZpdmUgdGVybXMsIHRbMC4uNF0uCi0gICAgICoKLSAgICAgKiAgICAgICAgICAgICAgICAgICAgICB0WzBdID0gICAgZ3BeMiAgKiA8eTEgeTE+Ci0gICAgICogICAgICAgICAgICAgICAgICAgICAgdFsxXSA9IC0yKmdwICAgICogPHhuIHkxPgotICAgICAqICAgICAgICAgICAgICAgICAgICAgIHRbMl0gPSAgICBnY14yICAqIDx5MiB5Mj4KLSAgICAgKiAgICAgICAgICAgICAgICAgICAgICB0WzNdID0gLTIqZ2MgICAgKiA8eG4geTI+Ci0gICAgICogICAgICAgICAgICAgICAgICAgICAgdFs0XSA9ICAyKmdwKmdjICogPHkxIHkyPgotICAgICAqCi0gICAgICovCi0KLSAgICAvKiBzZiAwICovCi0gICAgLyogZGV0ZXJtaW5lIHRoZSBzY2FsaW5nIGV4cG9uZW50IGZvciBnX2NvZGU6IGVjID0gZWMwIC0gMTEgKi8KLSAgICBleHAgPSBzZjBfZXhwX2djb2RlMCAtIDExOwotCi0gICAgLyogY2FsY3VsYXRl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tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKgotICAgICAqICBGaW5kIG1heGltdW0gZXhwb25lbnQ6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAgICAgKiAgfn5+fn5+fn5+fn5+fn5+fn5+fn5+fiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICBGb3IgdGhlIHN1bSBvcGVyYXRpb24sIGFsbCB0ZXJtcyBtdXN0IGhhdmUgdGhlIHNhbWUgc2NhbGluZzsgICAgICoKLSAgICAgKiAgdGhhdCBzY2FsaW5nIHNob3VsZCBiZSBsb3cgZW5vdWdoIHRvIHByZXZlbnQgb3ZlcmZsb3cuIFRoZXJlLSAgICAqCi0gICAgICogIGZvcmUsIHRoZSBtYXhpbXVtIHNjYWxlIGlzIGRldGVybWluZWQgYW5kIGFsbCBjb2VmZmljaWVudHMgYXJlICAgKgotICAgICAqICByZS1zY2FsZWQ6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICogICAgZXhwID0gbWF4KGV4cF9tYXhbaV0pICsgMTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICAgIGUgPSBleHBfbWF4W2ldLWV4cDsgICAgICAgICBlIDw9IDAhICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAgICAgKiAgICBjW2ldID0gY1tpXSoyXmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLQotICAgIGV4cCA9IGV4cF9tYXhbMF07Ci0gICAgZm9yIChpID0gOTsgaSA+IDA7IGktLSkKLSAgICB7Ci0gICAgICAgIGlmIChleHBfbWF4W2ldID4gZXhwKQotICAgICAgICB7Ci0gICAgICAgICAgICBleHAgPSBleHBfbWF4W2ldOwotICAgICAgICB9Ci0gICAgfQotICAgIGV4cCsrOyAgICAgIC8qIFRvIGF2b2lkIG92ZXJmbG93ICovCi0KLSAgICBwID0gJnNmMF9mcmFjX2NvZWZmWzBdOwotICAgIGZvciAoaSA9IDA7IGkgPCA1OyBpKyspCi0gICAgewotICAgICAgICB0bXAgPSAoZXhwIC0gZXhwX21heFtpXSk7Ci0gICAgICAgIExfdG1wID0gKChXb3JkMzIpKCpwKyspIDw8IDE2KTsKLSAgICAgICAgTF90bXAgPSBMX3NocihMX3RtcCwgdG1wLCBwT3ZlcmZsb3cpOwotICAgICAgICBjb2VmZltpXSA9IChXb3JkMTYpKExfdG1wID4+IDE2KTsKLSAgICAgICAgY29lZmZfbG9baV0gPSAoV29yZDE2KSgoTF90bXAgPj4gMSkgLSAoKExfdG1wID4+IDE2KSA8PCAxNSkpOwotICAgIH0KLSAgICBwID0gJnNmMV9mcmFjX2NvZWZmWzBdOwotICAgIGZvciAoOyBpIDwgMTA7IGkrKykKLSAgICB7Ci0gICAgICAgIHRtcCA9IGV4cCAtIGV4cF9tYXhbaV07Ci0gICAgICAgIExfdG1wID0gKChXb3JkMzIpKCpwKyspIDw8IDE2KTsKLSAgICAgICAgTF90bXAgPSBMX3NocihMX3RtcCwgdG1wLCBwT3ZlcmZsb3cpOwotICAgICAgICBjb2VmZltpXSA9IChXb3JkMTYpKExfdG1wID4+IDE2KTsKLSAgICAgICAgY29lZmZfbG9baV0gPSAoV29yZDE2KSgoTF90bXAgPj4gMSkgLSAoKExfdG1wID4+IDE2KSA8PCAxNSkpOwotICAgIH0KLQotCi0gICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKgotICAgICAqICBDb2RlYm9vayBzZWFyY2g6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSAgICAgKiAgfn5+fn5+fn5+fn5+fn5+fiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotICAgICAqICBGb3IgZWFjaCBwYWlyIChnX3BpdGNoLCBnX2ZhYykgaW4gdGhlIHRhYmxlIGNhbGN1bGF0ZSB0aGUgICAgICAgICoKLSAgICAgKiAgdGVybXMgdFswLi40XSBhbmQgc3VtIHRoZW0gdXA7IHRoZSByZXN1bHQgaXMgdGhlIG1lYW4gc3F1YXJlZCAgICAqCi0gICAgICogIGVycm9yIGZvciB0aGUgcXVhbnRpemVkIGdhaW5zIGZyb20gdGhlIHRhYmxlLiBUaGUgaW5kZXggZm9yIHRoZSAgKgotICAgICAqICBtaW5pbXVtIE1TRSBpcyBzdG9yZWQgYW5kIGZpbmFsbHkgdXNlZCB0byByZXRyaWV2ZSB0aGUgcXVhbnRpemVkICoKLSAgICAgKiAgZ2FpbnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0gICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLQotICAgIC8qIHN0YXJ0IHdpdGggImluZmluaXRlIiBNU0UgKi8KLSAgICBkaXN0X21pbiA9IE1BWF8zMjsKLQotICAgIHAgPSAmdGFibGVfZ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otICAgICAgICB0bXAgPSAoZ19waXRjaCAtIGdwX2xpbWl0KTsKLQotICAgICAgICAvKiBzdWJmcmFtZSAxIChhbmQgMykgY2FsY3VsYXRpb25zICovCi0gICAgICAgIGdfcGl0Y2ggPSAqcCsrOwotICAgICAgICBnX2NvZGUgPSAqcCsrOwotCi0gICAgICAgIGlmICgodG1wIDw9IDApICYmIChnX3BpdGNoIDw9IGdwX2xpbWl0KSkKLSAgICAgICAgewotICAgICAgICAgICAgZ19jb2RlID0gKFdvcmQxNikoKChXb3JkMzIpIGdfY29kZSAqIHNmMV9nY29kZTApID4+IDE1KTsKLSAgICAgICAgICAgIGcyX3BpdGNoICA9IChXb3JkMTYpKCgoV29yZDMyKSBnX3BpdGNoICogZ19waXRjaCkgPj4gMTUpOwotICAgICAgICAgICAgZzJfY29kZSAgID0gKFdvcmQxNikoKChXb3JkMzIpIGdfY29kZSAqIGdfY29kZSkgPj4gMTUpOwotICAgICAgICAgICAgZ19waXRfY29kID0gKFdvcmQxNikoKChXb3JkMzIpIGdfY29kZSAqIGdfcGl0Y2gpID4+IDE1KTsKLQotICAgICAgICAgICAgTF90bXAgKz0gKE1weV8zMl8xNihjb2VmZls1XSwgY29lZmZfbG9bNV0sIGcyX3BpdGNoLCBwT3ZlcmZsb3cpICsKLSAgICAgICAgICAgICAgICAgICAgICBNcHlfMzJfMTYoY29lZmZbNl0sIGNvZWZmX2xvWzZdLCBnX3BpdGNoLCBwT3ZlcmZsb3cpICsKLSAgICAgICAgICAgICAgICAgICAgICBNcHlfMzJfMTYoY29lZmZbN10sIGNvZWZmX2xvWzddLCBnMl9jb2RlLCBwT3ZlcmZsb3cpICsKLSAgICAgICAgICAgICAgICAgICAgICBNcHlfMzJfMTYoY29lZmZbOF0sIGNvZWZmX2xvWzhdLCBnX2NvZGUsIHBPdmVyZmxvdykgKwotICAgICAgICAgICAgICAgICAgICAgIE1weV8zMl8xNihjb2VmZls5XSwgY29lZmZfbG9bOV0sIGdfcGl0X2NvZCwg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Fpbl9NUjQ3NVt0bXBdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2YwX2djb2RlMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNmMF9leHBfZ2NvZGUwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2YwX2dhaW5fcGl0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2YwX2dhaW5fY29kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcE92ZXJmbG93KTsKLQotICAgIC8qIGNhbGN1bGF0ZSBuZXcgcHJlZGljdGVkIGdhaW4gZm9yIHN1YmZyYW1lIDEgKHRoaXMgdGltZSB1c2luZwotICAgICAgIHRoZSByZWFsLCBxdWFudGl6ZWQgZ2FpbnMpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIGdjX3ByZWQocHJlZF9zdCwgTVI0NzUsIHNmMV9jb2RlX25vc2hhcnAsCi0gICAgICAgICAgICAmc2YxX2V4cF9nY29kZTAsICZzZjFfZnJhY19nY29kZTAsCi0gICAgICAgICAgICAmc2YwX2V4cF9nY29kZTAsICZzZjBfZ2NvZGUwLCAvKiBkdW1teSBhcmdzICovCi0gICAgICAgICAgICBwT3ZlcmZsb3cpOwotCi0gICAgc2YxX2djb2RlMCA9IChXb3JkMTYpKFBvdzIoMTQsIHNmMV9mcmFjX2djb2RlMCwgcE92ZXJmbG93KSk7Ci0KLSAgICB0bXAgKz0gMjsKLSAgICBNUjQ3NV9xdWFudF9zdG9yZV9yZXN1bHRzKAotICAgICAgICBwcmVkX3N0LAotICAgICAgICAmdGFibGVfZ2Fpbl9NUjQ3NVt0bXBdLAotICAgICAgICBzZjFfZ2NvZGUwLAotICAgICAgICBzZjFfZXhwX2djb2RlMCwKLSAgICAgICAgc2YxX2dhaW5fcGl0LAotICAgICAgICBzZjFfZ2Fpbl9jb2QsCi0gICAgICAgIHBPdmVyZmxvdyk7Ci0KLSAgICByZXR1cm4oaW5kZX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qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAqIE9yaWdpbmFsbHkgZGV2ZWxvcGVkIGFuZCBjb250cmlidXRlZCBieSBJdHRpYW0gU3lzdGVtcyBQdnQuIEx0ZCwgQmFuZ2Fsb3JlCi0gKi8KLQotY2NfZnV6eiB7Ci0gICAgbmFtZTogImFtcm5iX2RlY19mdXp6ZXIiLAotICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAotICAgIHNyY3M6IFsKLSAgICAgICAgImFtcm5iX2RlY19mdXp6ZXIuY3BwIiwKLSAgICBdLAotICAgIHN0YXRpY19saWJzOiBbCi0gICAgICAgICJsaWJzdGFnZWZyaWdodF9hbXJuYmRlYyIsCi0gICAgICAgICJsaWJzdGFnZWZyaWdodF9hbXJuYl9jb21tb24iLAotICAgICAgICAibGlibG9nIiwKLSAgICBdLAotICAgIHRhcmdldDogewotICAgICAgICBkYXJ3aW46IHsKLSAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAotICAgICAgICB9LAotICAgIH0sCi19CmRpZmYgLS1naXQgYS9tZWRpYS9saWJzdGFnZWZyaWdodC9jb2RlY3MvYW1ybmIvZnV6emVyL2Ftcm5iX2RlY19mdXp6ZXIuY3BwIGIvbWVkaWEvbGlic3RhZ2VmcmlnaHQvY29kZWNzL2Ftcm5iL2Z1enplci9hbXJuYl9kZWNfZnV6emVyLmNwcApkZWxldGVkIGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggZDRlN2U1Yy4uMDAwMDAwMAotLS0gYS9tZWRpYS9saWJzdGFnZWZyaWdodC9jb2RlY3MvYW1ybmIvZnV6emVyL2Ftcm5iX2RlY19mdXp6ZXIuY3BwCisrKyAvZGV2L251bGwKQEAgLTEsOTQgKzAsMCBAQAotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgotICoKLSAqIENvcHlyaWdodCAoQyk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LS0gYS9tZWRpYS9saWJzdGFnZWZyaWdodC9jb2RlY3MvYW1yd2IvQW5kcm9pZC5icAorKysgL2Rldi9udWxsCkBAIC0xLDEwNCArMCwwIEBACi1jY19saWJyYXJ5X3N0YXRpYyB7Ci0gICAgbmFtZTogImxpYnN0YWdlZnJpZ2h0X2FtcndiZGVjIiwKLSAgICB2ZW5kb3JfYXZhaWxhYmxlOiB0cnVlLAotICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAotICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKLQotICAgIHNyY3M6IFsKLSAgICAgICAgInNyYy9hZ2MyX2Ftcl93Yi5jcHAiLAotICAgICAgICAic3JjL2JhbmRfcGFzc182a183ay5jcHAiLAotICAgICAgICAic3JjL2RlY19hY2VscF8ycF9pbl82NC5jcHAiLAotICAgICAgICAic3JjL2RlY19hY2VscF80cF9pbl82NC5jcHAiLAotICAgICAgICAic3JjL2RlY19hbGdfY29kZWJvb2suY3BwIiwKLSAgICAgICAgInNyYy9kZWNfZ2FpbjJfYW1yX3diLmNwcCIsCi0gICAgICAgICJzcmMvZGVlbXBoYXNpc18zMi5jcHAiLAotICAgICAgICAic3JjL2R0eF9kZWNvZGVyX2Ftcl93Yi5jcHAiLAotICAgICAgICAic3JjL2dldF9hbXJfd2JfYml0cy5jcHAiLAotICAgICAgICAic3JjL2hpZ2hwYXNzXzQwMGh6X2F0XzEyazguY3BwIiwKLSAgICAgICAgInNyYy9oaWdocGFzc181MGh6X2F0XzEyazguY3BwIiwKLSAgICAgICAgInNyYy9ob21pbmdfYW1yX3diX2RlYy5jcHAiLAotICAgICAgICAic3JjL2ludGVycG9sYXRlX2lzcC5jcHAiLAotICAgICAgICAic3JjL2lzZl9leHRyYXBvbGF0aW9uLmNwcCIsCi0gICAgICAgICJzcmMvaXNwX2F6LmNwcCIsCi0gICAgICAgICJzcmMvaXNwX2lzZi5jcHAiLAotICAgICAgICAic3JjL2xhZ2NvbmNlYWwuY3BwIiwKLSAgICAgICAgInNyYy9sb3dfcGFzc19maWx0XzdrLmNwcCIsCi0gICAgICAgICJzcmMvbWVkaWFuNS5jcHAiLAotICAgICAgICAic3JjL21pbWVfaW8uY3BwIiwKLSAgICAgICAgInNyYy9ub2lzZV9nZW5fYW1yd2IuY3BwIiwKLSAgICAgICAgInNyYy9ub3JtYWxpemVfYW1yX3diLmNwcCIsCi0gICAgICAgICJzcmMvb3ZlcnNhbXBfMTJrOF90b18xNmsuY3BwIiwKLSAgICAgICAgInNyYy9waGFzZV9kaXNwZXJzaW9uLmNwcCIsCi0gICAgICAgICJzcmMvcGl0X3NocnAuY3BwIiwKLSAgICAgICAgInNyYy9wcmVkX2x0NC5jcHAiLAotICAgICAgICAic3JjL3ByZWVtcGhfYW1yd2JfZGVjLmNwcCIsCi0gICAgICAgICJzcmMvcHZhbXJ3Yl9tYXRoX29wLmNwcCIsCi0gICAgICAgICJzcmMvcHZhbXJ3YmRlY29kZXIuY3BwIiwKLSAgICAgICAgInNyYy9xX2dhaW4yX3RhYi5jcHAiLAotICAgICAgICAic3JjL3Fpc2ZfbnMuY3BwIiwKLSAgICAgICAgInNyYy9xaXNmX25zX3RhYi5jcHAiLAotICAgICAgICAic3JjL3FwaXNmXzJzLmNwcCIsCi0gICAgICAgICJzcmMvcXBpc2ZfMnNfdGFiLmNwcCIsCi0gICAgICAgICJzcmMvc2NhbGVfc2lnbmFsLmNwcCIsCi0gICAgICAgICJzcmMvc3ludGhlc2lzX2Ftcl93Yi5jcHAiLAotICAgICAgICAic3JjL3ZvaWNlX2ZhY3Rvci5jcHAiLAotICAgICAgICAic3JjL3diX3N5bl9maWx0LmNwcCIsCi0gICAgICAgICJzcmMvd2VpZ2h0X2FtcndiX2xwYy5jcHAiLAotICAgIF0sCi0KLSAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbCi0gICAgICAgICJzcmMiLAotICAgICAgICAiaW5jbHVkZSIsCi0gICAgXSwKLQotICAgIGNmbGFnczogWwotICAgICAgICA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AgICAgOiBvcmRlciBvZiBMUCBmaWx0ZXIKLSAgICAgaW50MTYgeFtdLCAgICAgICAgICAgICAgIChpKSAgICAgOiBpbnB1dCBzaWduYWwKLSAgICAgaW50MTYgeVtdLCAgICAgICAgICAgICAgIChvKSAgICAgOiBvdXRwdXQgc2lnbmFsCi0gICAgIGludDE2IGxnLCAgICAgICAgICAgICAgICAoaSkgICAgIDogc2l6ZSBvZiBmaWx0ZXJpbmcKLSAgICAgaW50MTYgbWVtW10sICAgICAgICAgICAgIChpL28pICAgOiBtZW1vcnkgYXNzb2NpYXRlZCB3aXRoIHRoaXMgZmlsdGVyaW5nLgotICAgICBpbnQxNiB1cGRhdGUsICAgICAgICAgICAgKGkpICAgICA6IDA9bm8gdXBkYXRlLCAxPXVwZGF0ZSBvZiBtZW1vcnkuCi0gICAgIGludDE2IHlfYnVmW10KLQotU3luX2ZpbHRfMzIKLQotICAgICBpbnQxNiBhW10sICAgICAgICAgICAgICAoaSkgUTEyIDogYVttKzFdIHByZWRpY3Rpb24gY29lZmZpY2llbnRzCi0gICAgIGludDE2IG0sICAgICAgICAgICAgICAgIChpKSAgICAgOiBvcmRlciBvZiBMUCBmaWx0ZXIKLSAgICAgaW50MTYgZXhjW10sICAgICAgICAgICAgKGkpIFFuZXc6IGV4Y2l0YXRpb24gKGV4Y1tpXSA+PiBRbmV3KQotICAgICBpbnQxNiBRbmV3LCAgICAgICAgICAgICAoaSkgICAgIDogZXhjIHNjYWxpbmcgPSAwKG1pbikgdG8gOChtYXgpCi0gICAgIGludDE2IHNpZ19oaVtdLCAgICAgICAgIChvKSAvMTYgOiBzeW50aGVzaXMgaGlnaAotICAgICBpbnQxNiBzaWdfbG9bXSwgICAgICAgICAobykgLzE2IDogc3ludGhlc2lzIGxvdwotICAgICBpbnQxNiBsZyAgICAgICAgICAgICAgICAoaSkgICAgIDogc2l6ZSBvZiBmaWx0ZXJpbmcKLQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS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G8pICAgICA6IG91dHB1dCBzaWduYWwgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBpbnQxNiBsZywgICAgICAgIC8qIChpKSAgICAgOiBzaXplIG9mIGZpbHRlcmluZyAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgaW50MTYgbWVtW10sICAgICAvKiAoaS9vKSAgIDogbWVtb3J5IGFzc29jaWF0ZWQgd2l0aCB0aGlzIGZpbHRlcmluZy4gICAqLwotICAgIGludDE2IHVwZGF0ZSwgICAgLyogKGkpICAgICA6IDA9bm8gdXBkYXRlLCAxPXVwZGF0ZSBvZiBtZW1vcnkuICAgICAgICAgKi8KLSAgICBpbnQxNiB5X2J1ZltdCi0pCi17Ci0KLSAgICBpbnQxNiBpLCBqOwotICAgIGludDMyIExfdG1wMTsKLSAgICBpbnQzMiBMX3RtcDI7Ci0gICAgaW50MzIgTF90bXAzOwotICAgIGludDMyIExfdG1wNDsKLSAgICBpbnQxNiAqeXk7Ci0KLSAgICAvKiBjb3B5IGluaXRpYWwgZmlsdGVyIHN0YXRlcyBpbnRvIHN5bnRoZXNpcyBidWZmZXIgKi8KLSAgICBwdl9tZW1jcHkoeV9idWYsIG1lbSwgbSpzaXplb2YoKnl5KSk7Ci0KLSAgICB5eSA9ICZ5X2J1ZlttXTsKLQotICAgIC8qIERvIHRoZSBmaWx0ZXJpbmcuICovCi0KLSAgICBmb3IgKGkgPSAwOyBpIDwgbGcgPj4gMjsgaSsrKQotICAgIHsKLSAgICAgICAgTF90bXAxID0gLSgoaW50MzIpeFsoaTw8MildIDw8IDExKTsKLSAgICAgICAgTF90bXAyID0gLSgoaW50MzIpeFsoaTw8MikrMV0gPDwgMTEpOwotICAgICAgICBMX3RtcDMgPSAtKChpbnQzMil4WyhpPDwyKSsyXSA8PCAxMSk7Ci0gICAgICAgIExfdG1wNCA9IC0oKGludDMyKXhbKGk8PDIpKzNdIDw8IDExKTsKLQotICAgICAgICAvKiBhW10gdXNlcyBRMTIgYW5kI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ICAgICAgICAgICAgIC8qIChpKSBRMTIgOiBhW20rMV0gcHJlZGljdGlvbiBjb2VmZmljaWVudHMgKi8KLSAgICBpbnQxNiBtLCAgICAgICAgICAgICAgICAvKiAoaSkgICAgIDogb3JkZXIgb2YgTFAgZmlsdGVyICAgICAgICAgICAgICovCi0gICAgaW50MTYgZXhjW10sICAgICAgICAgICAgLyogKGkpIFFuZXc6IGV4Y2l0YXRpb24gKGV4Y1tpXSA+PiBRbmV3KSAgICAqLwotICAgIGludDE2IFFuZXcsICAgICAgICAgICAgIC8qIChpKSAgICAgOiBleGMgc2NhbGluZyA9IDAobWluKSB0byA4KG1heCkgKi8KLSAgICBpbnQxNiBzaWdfaGlbXSwgICAgICAgICAvKiAobykgLzE2IDogc3ludGhlc2lzIGhpZ2ggICAgICAgICAgICAgICAgICovCi0gICAgaW50MTYgc2lnX2xvW10sICAgICAgICAgLyogKG8pIC8xNiA6IHN5bnRoZXNpcyBsb3cgICAgICAgICAgICAgICAgICAqLwotICAgIGludDE2IGxnICAgICAgICAgICAgICAgIC8qIChpKSAgICAgOiBzaXplIG9mIGZpbHRlcmluZyAgICAgICAgICAgICAgKi8KLSkKLXsKLSAgICBpbnQxNiBpLCBrLCBhMDsKLSAgICBpbnQzMiBMX3RtcDE7Ci0gICAgaW50MzIgTF90bXAyOwotICAgIGludDMyIExfdG1wMzsKLSAgICBpbnQzMiBMX3RtcDQ7Ci0KLSAgICBhMCA9IDkgLSBRbmV3OyAgICAgICAgLyogaW5wdXQgLyAxNiBhbmQgPj5RbmV3ICovCi0KLSAgICAvKiBEbyB0aGUgZmlsdGVyaW5nLiAqLwotCi0gICAgZm9yIChpID0gMDsgaSA8IGxnID4+IDE7IGkrKykKLSAgICB7Ci0KLSAgICAgICAgTF90bXAzID0gMDsKLSAgICAgICAgTF90bXA0ID0gMDsKLQotICAgICAgICBMX3RtcDEgPSBmeHBfbXVsXzE2YnkxNihzaWdfbG9bKGk8PDEpIC0gMV0sIGFbMV0pOwotICAgIC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Aic3JjL2R0eC5jIiwKLSAgICAgICAgInNyYy9nX3BpdGNoLmMiLAotICAgICAgICAic3JjL2dwY2xpcC5jIiwKLSAgICAgICAgInNyYy9ob21pbmcuYyIsCi0gICAgICAgICJzcmMvaHA0MDAuYyIsCi0gICAgICAgICJzcmMvaHA1MC5jIiwKLSAgICAgICAgInNyYy9ocDZrLmMiLAotICAgICAgICAic3JjL2hwX3dzcC5jIiwKLSAgICAgICAgInNyYy9pbnRfbHBjLmMiLAotICAgICAgICAic3JjL2lzcF9hei5jIiwKLSAgICAgICAgInNyYy9pc3BfaXNmLmMiLAotICAgICAgICAic3JjL2xhZ193aW5kLmMiLAotICAgICAgICAic3JjL2xldmluc29uLmMiLAotICAgICAgICAic3JjL2xvZzIuYyIsCi0gICAgICAgICJzcmMvbHBfZGVjMi5jIiwKLSAgICAgICAgInNyYy9tYXRoX29wLmMiLAotICAgICAgICAic3JjL29wZXJfMzJiLmMiLAotICAgICAgICAic3JjL3BfbWVkX29sLmMiLAotICAgICAgICAic3JjL3BpdF9zaHJwLmMiLAotICAgICAgICAic3JjL3BpdGNoX2Y0LmMiLAotICAgICAgICAic3JjL3ByZWRfbHQ0LmMiLAotICAgICAgICAic3JjL3ByZWVtcGguYyIsCi0gICAgICAgICJzcmMvcV9nYWluMi5jIiwKLSAgICAgICAgInNyYy9xX3B1bHNlLmMiLAotICAgICAgICAic3JjL3Fpc2ZfbnMuYyIsCi0gICAgICAgICJzcmMvcXBpc2ZfMnMuYyIsCi0gICAgICAgICJzcmMvcmFuZG9tLmMiLAotICAgICAgICAic3JjL3Jlc2lkdS5jIiwKLSAgICAgICAgInNyYy9zY2FsZS5jIiwKLSAgICAgICAgInNyYy9zdHJlYW0uYyIsCi0gICAgICAgICJzcmMvc3luX2ZpbHQuYyIsCi0gICAgICAgICJzcmMvdXBkdF90YXIuYyIsCi0gICAgICAgICJzcmMvdXRpbC5jIiwKLSAgICAgICAgInNyYy92b0FNUldCRW5jLmMiLAotICAgICAgICAic3JjL3ZvaWNlZmFjLmMiLAotICAgICAgICAic3JjL3diX3ZhZC5jIiwKLSAgICAgICAgInNyYy93ZWlnaHRfYS5jIiwKLSAgICAgICAgInNyYy9tZW1fYWxpZ24uYyIsCi0gICAgXSwKLQotICAgIGFyY2g6IHsKLSAgICAgICAgYXJtOiB7Ci0gICAgICAgICAgICBzcmNzOiBbCi0gICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL2NvbnZvbHZlX29wdC5zIiwKLSAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvY29yX2hfdmVjX29wdC5zIiwKLSAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvRGVlbXBoXzMyX29wdC5zIiwKLSAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvRG90X3Bfb3B0LnMiLAotICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9GaWx0XzZrXzdrX29wdC5zIiwKLSAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvTm9ybV9Db3JyX29wdC5zIiwKLSAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvcHJlZF9sdDRfMV9vcHQucyIsCi0gICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL3Jlc2lkdV9hc21fb3B0LnMiLAotICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9zY2FsZV9zaWdfb3B0LnMiLAotICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9TeW5fZmlsdF8zMl9vcHQucyIsCi0gICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL3N5bl9maWx0X29wdC5zIiwKLSAgICAgICAgICAgIF0sCi0KLSAgICAgICAgICAgIGNmbGFnczogWwotICAgICAgICAgICAgICAgICItREFSTSIsCi0gICAgICAgICAgICAgICAgIi1EQVNNX09QVCIsCi0gICAgICAgICAgICBdLAotICAgICAgICAgICAgbG9jYWxfaW5jbHVkZV9kaXJzOiBbInNyYy9hc20vQVJNVjVFIl0sCi0KLSAgICAgICAgICAgIGluc3RydWN0aW9uX3NldDogImFybSIsCi0KLSAgICAgICAgICAgIG5lb246IHsKLSAgICAgICAgICAgICAgICBleGNsdWRlX3NyY3M6IFsKLSAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL2NvbnZvbHZlX29wdC5zIiwKLSAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL2Nvcl9oX3ZlY19vcHQucyIsCi0gICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9EZWVtcGhfMzJfb3B0LnMiLAotICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvRG90X3Bfb3B0LnMiLAotICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvRmlsdF82a183a19vcHQucyIsCi0gICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9Ob3JtX0NvcnJfb3B0LnMiLAotICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUvcHJlZF9sdDRfMV9vcHQucyIsCi0gICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9yZXNpZHVfYXNtX29wdC5zIiwKLSAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjVFL3NjYWxlX3NpZ19vcHQucyIsCi0gICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9TeW5fZmlsdF8zMl9vcHQucyIsCi0gICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY1RS9zeW5fZmlsdF9vcHQucyIsCi0gICAgICAgICAgICAgICAgXSwKLQotICAgICAgICAgICAgICAgIHNyY3M6IFsKLSAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjcvY29udm9sdmVfbmVvbi5zIiwKLSAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjcvY29yX2hfdmVjX25lb24ucyIsCi0gICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY3L0RlZW1waF8zMl9uZW9uLnMiLAotICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNy9Eb3RfcF9uZW9uLnMiLAotICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNy9GaWx0XzZrXzdrX25lb24ucyIsCi0gICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY3L05vcm1fQ29ycl9uZW9uLnMiLAotICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNy9wcmVkX2x0NF8xX25lb24ucyIsCi0gICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY3L3Jlc2lkdV9hc21fbmVvbi5zIiwKLSAgICAgICAgICAgICAgICAgICAgInNyYy9hc20vQVJNVjcvc2NhbGVfc2lnX25lb24ucyIsCi0gICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY3L1N5bl9maWx0XzMyX25lb24ucyIsCi0gICAgICAgICAgICAgICAgICAgICJzcmMvYXNtL0FSTVY3L3N5bl9maWx0X25lb24ucyIsCi0gICAgICAgICAgICAgICAgXSwKLQotICAgICAgICAgICAgICAgIC8vIGRvbid0IGFjdHVhbGx5IGdlbmVyYXRlIG5lb24gaW5zdHJ1Y3Rpb25zLCBzZWUgYnVnIDI2OTMyOTgwCi0gICAgICAgICAgICAgICAgY2ZsYWdzOiBbCi0gICAgICAgICAgICAgICAgICAgICItREFSTVY3IiwKLSAgICAgICAgICAgICAgICAgICAgIi1tZnB1PXZmcHYzIiwKLSAgICAgICAgICAgICAgICBdLAotICAgICAgICAgICAgICAgIGxvY2FsX2luY2x1ZGVfZGlyczogWwotICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNUUiLAotICAgICAgICAgICAgICAgICAgICAic3JjL2FzbS9BUk1WNyIsCi0gICAgICAgICAgICAgICAgXSwKLSAgICAgICAgICAgIH0sCi0KLSAgICAgICAgfSwKLSAgICB9LAotCi0gICAgaW5jbH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otKiAgICAgIEZpbGU6IHByZWVtcGguYyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCi0qICAgICAgRGVzY3JpcHRpb246IFByZWVtcGhhc2lzOiBmaWx0ZXJpbmcgdGhyb3VnaCAxIC0gZyB6Xi0xICAgICAgICAgKgotKiAgICAgICAgICAgICAgUHJlZW1waDIgLS0+IHNpZ25hbCBpcyBtdWx0aXBsaWVkIGJ5IDIgICAgICAgICAgICAgKgotKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotI2luY2x1ZGUgInR5cGVkZWYuaCIKLSNpbmNsdWRlICJiYXNpY19vcC5oIgotCi12b2lkIFByZWVtcGgoCi0gICAgICAgIFdvcmQxNiB4W10sICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkvbykgICA6IGlucHV0IHNpZ25hbCBvdmVyd3JpdHRlbiBieSB0aGUgb3V0cHV0ICovCi0gICAgICAgIFdvcmQxNiBtdSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIFExNSA6IHByZWVtcGhhc2lzIGNvZWZmaWNpZW50ICAgICAgICAgICAgICAgICovCi0gICAgICAgIFdvcmQxNiBsZywgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpICAgICA6IGxlbmdodCBvZiBmaWx0ZXJpbmcgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgIFdvcmQxNiAqIG1lbSAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkvbykgICA6IG1lbW9yeSAoeFstMV0pICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICkKLXsKLSAgICBXb3JkMTYgdGVtcDsKLSAgICBXb3JkMzIgaSwgTF90bXA7Ci0KLSAgICB0ZW1wID0geFtsZyAtIDFdOwotCi0gICAgZm9yIChpID0gbGcgLSAxOyBpID4gMDsgaS0tKQotICAgIHsKLSAgICAgICAgTF90bXAgPSBMX2RlcG9zaXRfaCh4W2ldKTsKLSAgICAgICAgTF90bXAgLT0gKHhbaSAtIDFdICogbXUpPDwxOwotICAgICAgICB4W2ldID0gKExfdG1wICsgMHg4MDAwKT4+MTY7Ci0gICAgfQotCi0gICAgTF90bXAgPSBMX2RlcG9zaXRfaCh4WzBdKTsKLSAgICBMX3RtcCAtPSAoKCptZW0pICogbXUpPDwxOwotICAgIHhbMF0gPSAoTF90bXAgKyAweDgwMDApPj4xNjsKLQotICAgICptZW0gPSB0ZW1wOwotCi0gICAgcmV0dXJuOwotfQotCi0KLXZvaWQgUHJlZW1waDIoCi0gICAgICAgIFdvcmQxNiB4W10sICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkvbykgICA6IGlucHV0IHNpZ25hbCBvdmVyd3JpdHRlbiBieSB0aGUgb3V0cHV0ICovCi0gICAgICAgIFdvcmQxNiBtdSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIFExNSA6IHByZWVtcGhhc2lzIGNvZWZmaWNpZW50ICAgICAgICAgICAgICAgICovCi0gICAgICAgIFdvcmQxNiBsZywgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpICAgICA6IGxlbmdodCBvZiBmaWx0ZXJpbmcgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgIFdvcmQxNiAqIG1lbSAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkvbykgICA6IG1lbW9yeSAoeFstMV0pICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICApCi17Ci0gICAgV29yZDE2IHRlbXA7Ci0gICAgV29yZDMyIGksIExfdG1wOwotCi0gICAgdGVtcCA9IHhbbGcgLSAxXTs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IgdGhlIExpY2Vuc2UuCi0gKi8KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi0qICAgICAgRmlsZTogcV9wdWxzZS5jICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgotKiAgICAgIERlc2NyaXB0aW9uOiBDb2RpbmcgYW5kIGRlY29kaW5nIG9mIGFsZ2VicmFpYyBjb2RlYm9vayAgICAgICAgICAqCi0qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKLSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotI2luY2x1ZGUgPHN0ZGlvLmg+Ci0jaW5jbHVkZSAidHlwZWRlZi5oIgotI2luY2x1ZGUgImJhc2ljX29wLmgiCi0jaW5jbHVkZSAicV9wdWxzZS5oIgotCi0jZGVmaW5lIE5CX1BPUyAxNiAgICAgICAgICAgICAgICAgICAgICAgICAgLyogcG9zIGluIHRyYWNrLCBtYXNrIGZvciBzaWduIGJpdCAqLwotCi1Xb3JkMzIgcXVhbnRfMXBfTjEoICAgICAgICAgICAgICAgICAgICAgICAgLyogKG8pIHJldHVybiBOKzEgYml0cyAgICAgICAgICAgICAqLwotICAgICAgICBXb3JkMTYgcG9zLCAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBwb3NpdGlvbiBvZiB0aGUgcHVsc2UgICAgICAgKi8KLSAgICAgICAgV29yZDE2IE4pICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgbnVtYmVyIG9mIGJpdHMgZm9yIHBvc2l0aW9uICovCi17Ci0gICAgV29yZDE2IG1hc2s7Ci0gICAgV29yZDMyIGluZGV4OwotCi0gICAgbWFzayA9ICgxIDw8IE4pIC0gMTsgICAgICAgICAgICAgIC8qIG1hc2sgPSAoKDE8PE4pLTEpOyAqLwotICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSoKLSAgICAgKiBRdWFudGl6YXRpb24gb2YgMSBwdWxzZSB3aXRoIE4rMSBiaXRzOiAgICAgICAgICAgICAgICAqCi0gICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLSAgICBpbmRleCA9IExfZGVwb3NpdF9sKChXb3JkMTYpIChwb3MgJiBtYXNrKSk7Ci0gICAgaWYgKChwb3MgJiBOQl9QT1MpICE9IDApCi0gICAgewotICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCBMX2RlcG9zaXRfbCgxIDw8IE4pKTsgICAvKiBpbmRleCArPSAxIDw8IE47ICovCi0gICAgfQotICAgIHJldHVybiAoaW5kZXgpOwotfQotCi0KLVdvcmQzMiBxdWFudF8ycF8yTjEoICAgICAgICAgICAgICAgICAgICAgICAvKiAobykgcmV0dXJuICgyKk4pKzEgYml0cyAgICAgICAgICovCi0gICAgICAgIFdvcmQxNiBwb3MxLCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIHBvc2l0aW9uIG9mIHRoZSBwdWxzZSAxICAgICAqLwotICAgICAgICBXb3JkMTYgcG9zMiwgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBwb3NpdGlvbiBvZiB0aGUgcHVsc2UgMiAgICAgKi8KLSAgICAgICAgV29yZDE2IE4pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgbnVtYmVyIG9mIGJpdHMgZm9yIHBvc2l0aW9uICovCi17Ci0gICAgV29yZDE2IG1hc2ssIHRtcDsKLSAgICBXb3JkMzIgaW5kZXg7Ci0gICAgbWFzayA9ICgxIDw8IE4pIC0gMTsgICAgICAgICAgICAgIC8qIG1hc2sgPSAoKDE8PE4pLTEpOyAqLwotICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSoKLSAgICAgKiBRdWFudGl6YXRpb24gb2YgMiBwdWxzZXMgd2l0aCAyKk4rMSBiaXRzOiAgICAgICAgICAgICAqCi0gICAgICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLSAgICBpZiAoKChwb3MyIF4gcG9zMSkgJiBOQl9QT1MpID09IDApCi0gICAgewotICAgICAgICAvKiBzaWduIG9mIDFzdCBwdWxzZSA9PSBzaWduIG9mIDJ0aCBwdWxzZSAqLwotICAgICAgICBpZihwb3MxIDw9IHBvczIpICAgICAgICAgIC8qICgocG9zMSAtIHBvczIpIDw9IDApICovCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qIGluZGV4ID0gKChwb3MxICYgbWFzaykgPDwgTikgKyAocG9zMiAmIG1hc2spOyAqLwotICAgICAgICAgICAgaW5kZXggPSBMX2RlcG9zaXRfbChhZGQxKCgoKFdvcmQxNikgKHBvczEgJiBtYXNrKSkgPDwgTiksICgoV29yZDE2KSAocG9zMiAmIG1hc2spKSkpOwotICAgICAgICB9IGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgLyogKChwb3MyICYgbWFzaykgPDwgTikgKyAocG9zMSAmIG1hc2spOyAqLwotICAgICAgICAgICAgaW5kZXggPSBMX2RlcG9zaXRfbChhZGQxKCgoKFdvcmQxNikgKHBvczIgJiBtYXNrKSkgPDwgTiksICgoV29yZDE2KSAocG9zMSAmIG1hc2spKSkpOwotICAgICAgICB9Ci0gICAgICAgIGlmICgocG9zMSAmIE5CX1BPUykgIT0gMCkKLSAgICAgICAgewotICAgICAgICAgICAgdG1wID0gKE4gPDwgMSk7Ci0gICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCAoMUwgPDwgdG1wKSk7ICAgICAgIC8qIGluZGV4ICs9IDEgPDwgKDIqTik7ICovCi0gICAgICAgIH0KLSAgICB9IGVsc2UKLSAgICB7Ci0gICAgICAgIC8qIHNpZ24gb2YgMXN0IHB1bHNlICE9IHNpZ24gb2YgMnRoIHB1bHNlICovCi0gICAgICAgIGlmICh2b19zdWIoKFdvcmQxNikgKHBvczEgJiBtYXNrKSwgKFdvcmQxNikgKHBvczIgJiBtYXNrKSkgPD0gMCkKLSAgICAgICAgewotICAgICAgICAgICAgLyogaW5kZXggPSAoKHBvczIgJiBtYXNrKSA8PCBOKSArIChwb3MxICYgbWFzayk7ICovCi0gICAgICAgICAgICBpbmRleCA9IExfZGVwb3NpdF9sKGFkZDEoKCgoV29yZDE2KSAocG9zMiAmIG1hc2spKSA8PCBOKSwgKChXb3JkMTYpIChwb3MxICYgbWFzaykpKSk7Ci0gICAgICAgICAgICBpZiAoKHBvczIgJiBOQl9QT1MpICE9IDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgdG1wID0gKE4gPDwgMSk7ICAgICAgICAgICAvKiBpbmRleCArPSAxIDw8ICgyKk4pOyAqLwotICAgICAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsICgxTCA8PCB0bXApKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qIGluZGV4ID0gKChwb3MxICYgbWFzaykgPDwgTikgKyAocG9zMiAmIG1hc2spOyAgICAgKi8KLSAgICAgICAgICAgIGluZGV4ID0gTF9kZXBvc2l0X2woYWRkMSgoKChXb3JkMTYpIChwb3MxICYgbWFzaykpIDw8IE4pLCAoKFdvcmQxNikgKHBvczIgJiBtYXNrKSkpKTsKLSAgICAgICAgICAgIGlmICgocG9zMSAmIE5CX1BPUykgIT0gMCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB0bXAgPSAoTiA8PCAxKTsKLSAgICAgICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCAoMSA8PCB0bXApKTsgICAgLyogaW5kZXggKz0gMSA8PCAoMipOKTsgKi8KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLSAgICByZXR1cm4gKGluZGV4KTsKLX0KLQotCi1Xb3JkMzIgcXVhbnRfM3BfM04xKCAgICAgICAgICAgICAgICAgICAgICAgLyogKG8pIHJldHVybiAoMypOKSsxIGJpdHMgICAgICAgICAqLwotICAgICAgICBXb3JkMTYgcG9zMSwgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBwb3NpdGlvbiBvZiB0aGUgcHVsc2UgMSAgICAgKi8KLSAgICAgICAgV29yZDE2IHBvczIsICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgcG9zaXRpb24gb2YgdGhlIHB1bHNlIDIgICAgICovCi0gICAgICAgIFdvcmQxNiBwb3MzLCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIHBvc2l0aW9uIG9mIHRoZSBwdWxzZSAzICAgICAqLwotICAgICAgICBXb3JkMTYgTikgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBudW1iZXIgb2YgYml0cyBmb3IgcG9zaXRpb24gKi8KLXsKLSAgICBXb3JkMTYgbmJfcG9zOwotICAgIFdvcmQzMiBpbmRleDsKLQotICAgIG5iX3BvcyA9KDEgPDwoTiAtIDEpKTsgICAgICAgICAgICAvKiBuYl9wb3MgPSAoMTw8KE4tMSkpOyAqLwotICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSoKLSAgICAgKiBRdWFudGl6YXRpb24gb2YgMyBwdWxzZXMgd2l0aCAzKk4rMSBiaXRzOiAgICAgICAgICAgICAqCi0gICAgIC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bnRfMXBfTjEocG9zMiwgTikgPDwKLSAgICAgICAgICogKDIqTik7ICovCi0gICAgfSBlbHNlCi0gICAgewotICAgICAgICBpbmRleCA9IHF1YW50XzJwXzJOMShwb3MyLCBwb3MzLCAoTiAtIDEpKTsgICAgLyogaW5kZXggPSBxdWFudF8ycF8yTjEocG9zMiwgcG9zMywgKE4tMSkpOyAqLwotICAgICAgICAvKiBpbmRleCArPSAocG9zMiAmIG5iX3BvcykgPDwgTjsgICAgICAgICAgICAqLwotICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCAoTF9kZXBvc2l0X2woKFdvcmQxNikgKHBvczIgJiBuYl9wb3MpKSA8PCBOKSk7Ci0gICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzFwX04xKHBvczEsIE4pIDw8ICgyKk4pOyAgICovCi0gICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIChxdWFudF8xcF9OMShwb3MxLCBOKSA8PCAoTiA8PCAxKSkpOwotICAgIH0KLSAgICByZXR1cm4gKGluZGV4KTsKLX0KLQotCi1Xb3JkMzIgcXVhbnRfNHBfNE4xKCAgICAgICAgICAgICAgICAgICAgICAgLyogKG8pIHJldHVybiAoNCpOKSsxIGJpdHMgICAgICAgICAqLwotICAgICAgICBXb3JkMTYgcG9zMSwgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBwb3NpdGlvbiBvZiB0aGUgcHVsc2UgMSAgICAgKi8KLSAgICAgICAgV29yZDE2IHBvczIsICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgcG9zaXRpb24gb2YgdGhlIHB1bHNlIDIgICAgICovCi0gICAgICAgIFdvcmQxNiBwb3MzLCAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIHBvc2l0aW9uIG9mIHRoZSBwdWxzZSAzICAgICAqLwotICAgICAgICBXb3JkMTYgcG9zNCwgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBwb3NpdGlvbiBvZiB0a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HNlIGlmICgoKHBvczEgXiBwb3MzKSAmIG5iX3BvcykgPT0gMCkKLSAgICB7Ci0gICAgICAgIGluZGV4ID0gcXVhbnRfMnBfMk4xKHBvczEsIHBvczMsIChOIC0gMSkpOwotICAgICAgICAvKiBpbmRleCArPSAocG9zMSAmIG5iX3BvcykgPDwgTjsgKi8KLSAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgKExfZGVwb3NpdF9sKChXb3JkMTYpIChwb3MxICYgbmJfcG9zKSkgPDwgTikpOwotICAgICAgICAvKiBpbmRleCArPSBxdWFudF8ycF8yTjEocG9zMiwgcG9zNCwgTikgPDwgKDIqTik7ICovCi0gICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIChxdWFudF8ycF8yTjEocG9zMiwgcG9zNCwgTikgPDwgKE4gPDwgMSkpKTsKLSAgICB9IGVsc2UKLSAgICB7Ci0gICAgICAgIGluZGV4ID0gcXVhbnRfMnBfMk4xKHBvczIsIHBvczMsIChOIC0gMSkpOwotICAgICAgICAvKiBpbmRleCArPSAocG9zMiAmIG5iX3BvcykgPDwgTjsgKi8KLSAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgKExfZGVwb3NpdF9sKChXb3JkMTYpIChwb3MyICYgbmJfcG9zKSkgPDwgTikpOwotICAgICAgICAvKiBpbmRleCArPSBxdWFudF8ycF8yTjEocG9zMSwgcG9zNCwgTikgPDwgKDIqTik7ICovCi0gICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIChxdWFudF8ycF8yTjEocG9zMSwgcG9zNCwgTikgPDwgKE4gPDwgMSkpKTsKLSAgICB9Ci0gICAgcmV0dXJuIChpbmRleCk7Ci19Ci0KLQotV29yZDMyIHF1YW50XzRwXzROKCAgICAgICAgICAgICAgICAgICAgICAgIC8qIChvKSByZXR1cm4gNCpOIGJpdHMgICAgICAgICAgICAgKi8KLSAgICAgICAgV29yZDE2IHBvc1tdLCAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgcG9zaXRpb24gb2YgdGhlIHB1bHNlIDEuLjQgICovCi0gICAgICAgIFdvcmQxNiBOKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIG51bWJlciBvZiBiaXRzIGZvciBwb3NpdGlvbiAqLwotewotICAgIFdvcmQxNiBuYl9wb3MsIG1hc2sgX191bnVzZWQsIG5fMSwgdG1wOwotICAgIFdvcmQxNiBwb3NBWzRdLCBwb3NCWzRdOwotICAgIFdvcmQzMiBpLCBqLCBrLCBpbmRleDsKLQotICAgIG5fMSA9IChXb3JkMTYpIChOIC0gMSk7Ci0gICAgbmJfcG9zID0gKDEgPDwgbl8xKTsgICAgICAgICAgICAgICAgICAvKiBuYl9wb3MgPSAoMTw8bl8xKTsgKi8KLSAgICBtYXNrID0gdm9fc3ViKCgxIDw8IE4pLCAxKTsgICAgICAgICAgICAgIC8qIG1hc2sgPSAoKDE8PE4pLTEpOyAqLwotCi0gICAgaSA9IDA7Ci0gICAgaiA9IDA7Ci0gICAgZm9yIChrID0gMDsgayA8IDQ7IGsrKykKLSAgICB7Ci0gICAgICAgIGlmICgocG9zW2tdICYgbmJfcG9zKSA9PSAwKQotICAgICAgICB7Ci0gICAgICAgICAgICBwb3NBW2krK10gPSBwb3Nba107Ci0gICAgICAgIH0gZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICBwb3NCW2orK10gPSBwb3Nba107Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBzd2l0Y2ggKGkpCi0gICAgewotICAgICAgICBjYXNlIDA6Ci0gICAgICAgICAgICB0bXAgPSB2b19zdWIoKE4gPDwgMiksIDMpOyAgICAgICAgICAgLyogaW5kZXggPSAxIDw8ICgoNCpOKS0zKTsgKi8KLSAgICAgICAgICAgIGluZGV4ID0gKDFMIDw8IHRtcCk7Ci0gICAgICAgICAgICAvKiBpbmRleCArPSBxdWFudF80cF80TjEocG9zQlswXSwgcG9zQlsxXSwgcG9zQlsyXSwgcG9zQlszXSwgbl8xKTsgKi8KLSAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIHF1YW50XzRwXzROMShwb3NCWzBdLCBwb3NCWzFdLCBwb3NCWzJdLCBwb3NCWzNdLCBuXzEpKTsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIDE6Ci0gICAgICAgICAgICAvKiBpbmRleCA9IHF1YW50XzFwX04xKHBvc0FbMF0sIG5fMSkgPDwgKCgzKm5fMSkrMSk7ICovCi0gICAgICAgICAgICB0bXAgPSBhZGQxKChXb3JkMTYpKCh2b19MX211bHQoMywgbl8xKSA+PiAxKSksIDEpOwotICAgICAgICAgICAgaW5kZXggPSBMX3NobChxdWFudF8xcF9OMShwb3NBWzBdLCBuXzEpLCB0bXApOwotICAgICAgICAgICAgLyogaW5kZXggKz0gcXVhbnRfM3BfM04xKHBvc0JbMF0sIHBvc0JbMV0sIHBvc0JbMl0sIG5fMSk7ICovCi0gICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCBxdWFudF8zcF8zTjEocG9zQlswXSwgcG9zQlsxXSwgcG9zQlsyXSwgbl8xKSk7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSAyOgotICAgICAgICAgICAgdG1wID0gKChuXzEgPDwgMSkgKyAxKTsgICAgICAgICAvKiBpbmRleCA9IHF1YW50XzJwXzJOMShwb3NBWzBdLCBwb3NBWzFdLCBuXzEpIDw8ICgoMipuXzEpKzEpOyAqLwotICAgICAgICAgICAgaW5kZXggPSBMX3NobChxdWFudF8ycF8yTjEocG9zQVswXSwgcG9zQVsxXSwgbl8xKSwgdG1wKTsKLSAgICAgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzJwXzJOMShwb3NCWzBdLCBwb3NCWzFdLCBuXzEpOyAqLwotICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgcXVhbnRfMnBfMk4xKHBvc0JbMF0sIHBvc0JbMV0sIG5fMSkpOwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgMzoKLSAgICAgICAgICAgIC8qIGluZGV4ID0gcXVhbnRfM3BfM04xKHBvc0FbMF0sIHBvc0FbMV0sIHBvc0FbMl0sIG5fMSkgPDwgTjsgKi8KLSAgICAgICAgICAgIGluZGV4ID0gTF9zaGwocXVhbnRfM3BfM04xKHBvc0FbMF0sIHBvc0FbMV0sIHBvc0FbMl0sIG5fMSksIE4pOwotICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgcXVhbnRfMXBfTjEocG9zQlswXSwgbl8xKSk7ICAgICAgICAvKiBpbmRleCArPSBxdWFudF8xcF9OMShwb3NCWzBdLCBuXzEpOyAqLwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgNDoKLSAgICAgICAgICAgIGluZGV4ID0gcXVhbnRfNHBfNE4xKHBvc0FbMF0sIHBvc0FbMV0sIHBvc0FbMl0sIHBvc0FbM10sIG5fMSk7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgIGluZGV4ID0gMDsKLSAgICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiRXJyb3IgaW4gZnVuY3Rpb24gcXVhbnRfNHBfNE5cbiIpOwotICAgIH0KLSAgICB0bXAgPSAoKE4gPDwgMikgLSAyKTsgICAgICAgICAgICAgICAvKiBpbmRleCArPSAoaSAmIDMpIDw8ICgoNCpOKS0yKTsgKi8KLSAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCBMX3NobCgoTF9kZXBvc2l0X2woaSkgJiAoM0wpKSwgdG1wKSk7Ci0KLSAgICByZXR1cm4gKGluZGV4KTsKLX0KLQotCi0KLVdvcmQzMiBxdWFudF81cF81TiggICAgICAgICAgICAgICAgICAgICAgICAvKiAobykgcmV0dXJuIDUqTiBiaXRzICAgICAgICAgICAgICovCi0gICAgICAgIFdvcmQxNiBwb3NbXSwgICAgICAgICAgICAgICAgICAgICAgICAgLyogKGkpIHBvc2l0aW9uIG9mIHRoZSBwdWxzZSAxLi41ICAqLwotICAgICAgICBXb3JkMTYgTikgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBudW1iZXIgb2YgYml0cyBmb3IgcG9zaXRpb24gKi8KLXsKLSAgICBXb3JkMTYgbmJfcG9zLCBuXzEsIHRtcDsKLSAgICBXb3JkMTYgcG9zQVs1XSwgcG9zQls1XTsKLSAgICBXb3JkMzIgaSwgaiwgaywgaW5kZXgsIHRtcDI7Ci0KLSAgICBuXzEgPSAoV29yZDE2KSAoTiAtIDEpOwotICAgIG5iX3BvcyA9ICgxIDw8IG5fMSk7ICAgICAgICAgICAgICAgICAgLyogbmJfcG9zID0gKDE8PG5fMSk7ICovCi0KLSAgICBpID0gMDsKLSAgICBqID0gMDsKLSAgICBmb3IgKGsgPSAwOyBrIDwgNTsgaysrKQotICAgIHsKLSAgICAgICAgaWYgKChwb3Nba10gJiBuYl9wb3MpID09IDApCi0gICAgICAgIHsKLSAgICAgICAgICAgIHBvc0FbaSsrXSA9IHBvc1trXTsKLSAgICAgICAgfSBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIHBvc0JbaisrXSA9IHBvc1trXTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHN3aXRjaCAoaSkKLSAgICB7Ci0gICAgICAgIGNhc2UgMDoKLSAgICAgICAgICAgIHRtcCA9IHZvX3N1YigoV29yZDE2KSgodm9fTF9tdWx0KDUsIE4pID4+IDEpKSwgMSk7ICAgICAgICAvKiAoKDUqTiktMSkpICovCi0gICAgICAgICAgICBpbmRleCA9IExfc2hsKDFMLCB0bXApOyAgIC8qIGluZGV4ID0gMSA8PCAoKDUqTiktMSk7ICovCi0gICAgICAgICAgICB0bXAgPSBhZGQxKChOIDw8IDEpLCAxKTsgIC8qIGluZGV4ICs9IHF1YW50XzNwXzNOMShwb3NCWzBdLCBwb3NCWzFdLCBwb3NCWzJdLCBuXzEpID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ci0gICAgICAgICAgICBpbmRleCA9IDA7Ci0gICAgICAgICAgICBmcHJpbnRmKHN0ZGVyciwgIkVycm9yIGluIGZ1bmN0aW9uIHF1YW50XzVwXzVOXG4iKTsKLSAgICB9Ci0KLSAgICByZXR1cm4gKGluZGV4KTsKLX0KLQotCi1Xb3JkMzIgcXVhbnRfNnBfNk5fMiggICAgICAgICAgICAgICAgICAgICAgLyogKG8pIHJldHVybiAoNipOKS0yIGJpdHMgICAgICAgICAqLwotICAgICAgICBXb3JkMTYgcG9zW10sICAgICAgICAgICAgICAgICAgICAgICAgIC8qIChpKSBwb3NpdGlvbiBvZiB0aGUgcHVsc2UgMS4uNiAgKi8KLSAgICAgICAgV29yZDE2IE4pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAoaSkgbnVtYmVyIG9mIGJpdHMgZm9yIHBvc2l0aW9uICovCi17Ci0gICAgV29yZDE2IG5iX3Bvcywgbl8xOwotICAgIFdvcmQxNiBwb3NBWzZdLCBwb3NCWzZdOwotICAgIFdvcmQzMiBpLCBqLCBrLCBpbmRleDsKLQotICAgIC8qICEhICBOIGFuZCBuXzEgYXJlIGNvbnN0YW50cyAtPiBpdCBkb2Vzbid0IG5lZWQgdG8gYmUgb3BlcmF0ZWQgYnkgQmFzaWMgT3BlcmF0b3JzICovCi0gICAgbl8xID0gKFdvcmQxNikgKE4gLSAxKTsKLSAgICBuYl9wb3MgPSAoMSA8PCBuXzEpOyAgICAgICAgICAgICAgICAgIC8qIG5iX3BvcyA9ICgxPDxuXzEpOyAqLwotCi0gICAgaSA9IDA7Ci0gICAgaiA9IDA7Ci0gICAgZm9yIChrID0gMDsgayA8IDY7IGsrKykKLSAgICB7Ci0gICAgICAgIGlmICgocG9zW2tdICYgbmJfcG9zKSA9PSAwKQotICAgICAgICB7Ci0gICAgICAgICAgICBwb3NBW2krK10gPSBwb3Nba107Ci0gICAgICAgIH0gZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICBwb3NCW2orK10gPSBwb3Nba107Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBzd2l0Y2ggKGkpCi0gICAgewotICAgICAgICBjYXNlIDA6Ci0gICAgICAgICAgICBpbmRleCA9ICgxIDw8IChXb3JkMTYpICg2ICogTiAtIDUpKTsgICAgICAgIC8qIGluZGV4ID0gMSA8PCAoKDYqTiktNSk7ICovCi0gICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCAocXVhbnRfNXBfNU4ocG9zQiwgbl8xKSA8PCBOKSk7IC8qIGluZGV4ICs9IHF1YW50XzVwXzVOKHBvc0IsIG5fMSkgPDwgTjsgKi8KLSAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIHF1YW50XzFwX04xKHBvc0JbNV0sIG5fMSkpOyAgICAgICAgLyogaW5kZXggKz0gcXVhbnRfMXBfTjEocG9zQls1XSwgbl8xKTsgKi8KLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIDE6Ci0gICAgICAgICAgICBpbmRleCA9ICgxTCA8PCAoV29yZDE2KSAoNiAqIE4gLSA1KSk7ICAgICAgICAvKiBpbmRleCA9IDEgPDwgKCg2Kk4pLTUpOyAqLwotICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgKHF1YW50XzVwXzVOKHBvc0IsIG5fMSkgPDwgTikpOyAvKiBpbmRleCArPSBxdWFudF81cF81Tihwb3NCLCBuXzEpIDw8IE47ICovCi0gICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCBxdWFudF8xcF9OMShwb3NBWzBdLCBuXzEpKTsgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzFwX04xKHBvc0FbMF0sIG5fMSk7ICovCi0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSAyOgotICAgICAgICAgICAgaW5kZXggPSAoMUwgPDwgKFdvcmQxNikgKDYgKiBOIC0gNSkpOyAgICAgICAgLyogaW5kZXggPSAxIDw8ICgoNipOKS01KTsgKi8KLSAgICAgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzRwXzROKHBvc0IsIG5fMSkgPDwgKCgyKm5fMSkrMSk7ICovCi0gICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCAocXVhbnRfNHBfNE4ocG9zQiwgbl8xKSA8PCAoV29yZDE2KSAoMiAqIG5fMSArIDEpKSk7Ci0gICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCBxdWFudF8ycF8yTjEocG9zQVswXSwgcG9zQVsxXSwgbl8xKSk7ICAgICAgLyogaW5kZXggKz0gcXVhbnRfMnBfMk4xKHBvc0FbMF0sIHBvc0FbMV0sIG5fMSk7ICovCi0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSAzOgotICAgICAgICAgICAgaW5kZXggPSAocXVhbnRfM3BfM04xKHBvc0FbMF0sIHBvc0FbMV0sIHBvc0FbMl0sIG5fMSkgPDwgKFdvcmQxNikgKDMgKiBuXzEgKyAxKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogaW5kZXggPSBxdWFudF8zcF8zTjEocG9zQVswXSwgcG9zQVsxXSwgcG9zQVsyXSwgbl8xKSA8PCAoKDMqbl8xKSsxKTsgKi8KLSAgICAgICAgICAgIGluZGV4ID12b19MX2FkZChpbmRleCwgcXVhbnRfM3BfM04xKHBvc0JbMF0sIHBvc0JbMV0sIHBvc0JbMl0sIG5fMSkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogaW5kZXggKz0gcXVhbnRfM3BfM04xKHBvc0JbMF0sIHBvc0JbMV0sIHBvc0JbMl0sIG5fMSk7ICovCi0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSA0OgotICAgICAgICAgICAgaSA9IDI7Ci0gICAgICAgICAgICBpbmRleCA9IChxdWFudF80cF80Tihwb3NBLCBuXzEpIDw8IChXb3JkMTYpICgyICogbl8xICsgMSkpOyAgLyogaW5kZXggPSBxdWFudF80cF80Tihwb3NBLCBuXzEpIDw8ICgoMipuXzEpKzEpOyAqLwotICAgICAgICAgICAgaW5kZXggPSB2b19MX2FkZChpbmRleCwgcXVhbnRfMnBfMk4xKHBvc0JbMF0sIHBvc0JbMV0sIG5fMSkpOyAgICAgIC8qIGluZGV4ICs9IHF1YW50XzJwXzJOMShwb3NCWzBdLCBwb3NCWzFdLCBuXzEpOyAqLwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgNToKLSAgICAgICAgICAgIGkgPSAxOwotICAgICAgICAgICAgaW5kZXggPSAocXVhbnRfNXBfNU4ocG9zQSwgbl8xKSA8PCBOKTsgICAgICAgLyogaW5kZXggPSBxdWFudF81cF81Tihwb3NBLCBuXzEpIDw8IE47ICovCi0gICAgICAgICAgICBpbmRleCA9IHZvX0xfYWRkKGluZGV4LCBxdWFudF8xcF9OMShwb3NCWzBdLCBuXzEpKTsgICAgICAgIC8qIGluZGV4ICs9IHF1YW50XzFwX04xKHBvc0JbMF0sIG5fMSk7ICovCi0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSA2OgotICAgICAgICAgICAgaSA9IDA7Ci0gICAgICAgICAgICBpbmRleCA9IChxdWFudF81cF81Tihwb3NBLCBuXzEpIDw8IE4pOyAgICAgICAvKiBpbmRleCA9IHF1YW50XzVwXzVOKHBvc0EsIG5fMSkgPDwgTjsgKi8KLSAgICAgICAgICAgIGluZGV4ID0gdm9fTF9hZGQoaW5kZXgsIHF1YW50XzFwX04xKHBvc0FbNV0sIG5fMSkpOyAgICAgICAgLyogaW5kZXggKz0gcXVhbnRfMXBfTjEocG9zQVs1XSwgbl8xKTsgKi8KLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgaW5kZXggPSAwOwotICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJFcnJvciBpbiBmdW5jdGlvbiBx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AgLyogeSBjb29yZCBvZiAxc3QgZWxlbWVudCBpbiB0aGUgcm93ICAvCi0gICAgICAgICAgICAgICAgICAgICAvY29udGFpbmluZyBwZWxjIHBpeGVsIC8gICAgICovCi0gICAgUmVjX1lfcHRyID0gJlJlY19ZW2FkZHJfdiArIHhfc3RhcnRdOyAgLyogaW5pdGlhbGl6aW5nIHBvaW50ZXIgdG8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gIHBlbGMwIHBvc2l0aW9uICAqLwotICAgIHN1bV9WX3B0ciA9ICZzdW1fdlswXTsgIC8qIGluaXRpYWxpemluZyBwb2ludGVyIHRvIDB0aCBlbGVtZW50IG9mIGFycmF5Ci0gICAgICAgICAgICAgICAgLyAgIHRoYXQgd2lsbCBjb250YWluIHdlaWdodGVkIHN1bXMgb2YgcGl4ZWwKLSAgICAgICAgICAgICAgICAvICAgbHVtaW5hbmNlIHZhbHVlcyAqLwotICAgIHNpZ25fVl9wdHIgPSAmc2lnbl92WzBdOyAgLyogIGluaXRpYWxpemluZyBwb2ludGVyIHRvIDB0aCBlbGVtZW50IG9mCi0gICAgICAgICAgICAgICAgICAvICAgYXJyYXkgdGhhdCB3aWxsIGNvbnRhaW4gc3VtcyB0aGF0IGluZGljYXRlCi0gICAgICAgICAgICAgICAgICAvICAgIGhvdyBtYW55IG9mIHRoZSA5IHBpeGVscyBhcmUgYWJvdmUgb3IgYmVsb3cKLSAgICAgICAgICAgICAgICAgIC8gICAgdGhlIHRocmVzaG9sZCB2YWx1ZSAodGhyKSAgICAqLwotICAgIHBlbHAgPSAmb2xkcm93WzBdOyAgLyogaW5pdGlhbGl6aW5nIHBvaW50ZXIgdG8gdGhlIDB0aCBlbGVtZW50IG9mIGFycmF5Ci0gICAgICAgICAgICAgICAgLyAgICB0aGF0IHdpbGwgY29udGFpbiBjdXJyZW50IHZhbHVlcyBvZiBwZWxjIHRoYXQKLSAgICAgICAgICAgICAgICAvICAgYXJlIHNhdmVkIGFuZCB1c2VkIGFzI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LSAgICBlbHNlCi0gICAgewotICAgICAgICBpID0gODsKLSAgICAgICAgd2hpbGUgKGktLSkKLSAgICAgICAgewotICAgICAgICAgICAgYm1hcHIgPSAoaW50KWJpdG1hcGNvbFtpXTsKLSAgICAgICAgICAgIGlmIChibWFwcikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZiAoKGJtYXByJjB4ZikgPT0gMCkgICAgICAgICAvKiAgMDcvMTgvMDEgKi8KLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICgqKGlkY3Rjb2xWQ0EyW2JtYXByPj40XSkpKGNvZWZmX2luICsgaSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGlkY3Rjb2woY29lZmZfaW4gKyBpKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKChiaXRtYXBjb2xbNF0gfCBiaXRtYXBjb2xbNV0gfCBiaXRtYXBjb2xbNl0gfCBiaXRtYXBjb2xbN10pID09IDApCi0gICAgICAgIHsKLSAgICAgICAgICAgIGJpdG1hcHJvdyA+Pj0gNDsKLSAgICAgICAgICAgICgqKGlkY3Ryb3dWQ0EyX2ludHJhWyhpbnQpYml0bWFwcm93XSkpKGNvZWZmX2luLCBjX2NvbXAsIHdpZHRoKTsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlkY3Ryb3dfaW50cmEoY29lZmZfaW4sIGNfY29tcCwgd2lkdGgpOwotICAgICAgICB9Ci0gICAgfQotI2Vsc2UKLSAgICB2b2lkIGlkY3RfaW50cmEoaW50ICpibG9jaywgdWludDggKmNvbXAsIGludCB3aWR0aCk7Ci0gICAgaWRjdF9pbnRyYShjb2VmZl9pbiwgY19jb21wLCB3aWR0aCk7Ci0jZW5kaWYKLSNlbHNl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qKShwcmVkICs9IDQpKTsKLSAgICAqKCh1aW50MzIqKShkc3QgKz0gd2lkdGgpKSA9ICooKHVpbnQzMiopKHByZWQgKz0gMTIpKTsKLSAgICAqKCh1aW50MzIqKShkc3QgKz0gNCkpID0gKigodWludDMyKikocHJlZCArPSA0KSk7Ci0gICAgKigodWludDMyKikoZHN0ICs9IHdpZHRoKSkgPSAqKCh1aW50MzIqKShwcmVkICs9IDEyKSk7Ci0gICAgKigodWludDMyKikoZHN0ICs9IDQpKSA9ICooKHVpbnQzMiopKHByZWQgKz0gNCkpOwotICAgICooKHVpbnQzMiopKGRzdCArPSB3aWR0aCkpID0gKigodWludDMyKikocHJlZCArPSAxMikpOwotICAgICooKHVpbnQzMiopKGRzdCArPSA0KSkgPSAqKCh1aW50MzIqKShwcmVkICs9IDQpKTsKLSAgICAqKCh1aW50MzIqKShkc3QgKz0gd2lkdGgpKSA9ICooKHVpbnQzMiopKHByZWQgKz0gMTIpKTsKLSAgICAqKCh1aW50MzIqKShkc3QgKz0gNCkpID0gKigodWludDMyKikocHJlZCArPSA0KSk7Ci0gICAgKigodWludDMyKikoZHN0ICs9IHdpZHRoKSkgPSAqKCh1aW50MzIqKShwcmVkICs9IDEyKSk7Ci0gICAgKigodWludDMyKikoZHN0ICs9IDQpKSA9ICooKHVpbnQzMiopKHByZWQgKz0gNCkpOwotCi0gICAgcmV0dXJuIDsKLX0KLQotLyogIDA4LzA0LzA1IGNvbXB1dGUgSURDVCBhbmQgYWRkIHByZWRpY3Rpb24gYXQgdGhlIGVuZCAgKi8KLXZvaWQgQmxvY2tJRENUKAotICAgIHVpbnQ4ICpkc3QsICAvKiBkZXN0aW5hdGlvbiAqLwotICAgIHVpbnQ4ICpwcmVkLCAvKiBwcmVkaWN0aW9uIGJsb2NrLCBwaXRjaCAxNiAqLwotICAgIGludDE2ICAgKmNvZWZmX2luLCAgLyogRENUIGRhdGEsIHNpemUgNjQgKi8KLSAgICBpbnQgd2lkdGgsIC8qIHdpZHRoIG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gICBpZiAoYm1hcHIpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgaWYgKChibWFwciYweGYpID09IDApICAgICAgICAgLyogIDA3LzE4LzAxICovCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAoKihpZGN0Y29sVkNBMltibWFwcj4+NF0pKShjb2VmZl9pbiArIGkpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBpZGN0Y29sKGNvZWZmX2luICsgaSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGlmICgoYml0bWFwY29sWzRdIHwgYml0bWFwY29sWzVdIHwgYml0bWFwY29sWzZdIHwgYml0bWFwY29sWzddKSA9PSAwKQotICAgICAgICB7Ci0gICAgICAgICAgICAoKihpZGN0cm93VkNBMltiaXRtYXByb3c+PjRdKSkoY29lZmZfaW4sIHByZWQsIGRzdCwgd2lkdGgpOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgaWRjdHJvdyhjb2VmZl9pbiwgcHJlZCwgZHN0LCB3aWR0aCk7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIDsKLSAgICB9Ci0jZWxzZSAvLyBGQVNUX0lEQ1QKLSAgICB2b2lkIGlkY3QoaW50ICpibG9jaywgdWludDggKnByZWQsIHVpbnQ4ICpkc3QsIGludCB3aWR0aCk7Ci0gICAgaWRjdChjb2VmZl9pbiwgcHJlZCwgZHN0LCB3aWR0aCk7Ci0gICAgcmV0dXJuOwotI2VuZGlmIC8vIEZBU1RfSURDVAotI2Vsc2UgLy8gSU5URUdFUl9JRENUCi0gICAgdm9pZCBpZGN0cmVmKGludCAqYmxvY2ssIHVpbnQ4ICpwcmVkLCB1aW50OCAqZHN0LCBpbnQgd2lkdGgpOwotICAgIGlkY3RyZWYoY29lZmZ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ci0gICAgICAgIGJsa1sxMl0gPSAwOwotICAgICAgICB4MiA9IGJsa1sxNF07Ci0gICAgICAgIGJsa1sxNF0gPSAwOwotICAgICAgICB4MyA9IGJsa1sxMF07Ci0gICAgICAgIGJsa1sxMF0gPSAwOwotICAgICAgICB4NCA9IGJsa1s5XTsKLSAgICAgICAgYmxrWzldID0gMDsKLSAgICAgICAgeDUgPSBibGtbMTVdOwotICAgICAgICBibGtbMTVdID0gMDsKLSAgICAgICAgeDYgPSBibGtbMTNdOwotICAgICAgICBibGtbMTNdID0gMDsKLSAgICAgICAgeDcgPSBibGtbMTFdOwotICAgICAgICBibGtbMTFdID0gMDsKLSAgICAgICAgeDAgPSAoKCooYmxrICs9IDgpKSA8PCA4KSArIDgxOTI7Ci0gICAgICAgIGJsa1swXSA9IDA7ICAgLyogZm9yIHByb3BlciByb3VuZGluZyBpbiB0aGUgZm91cnRoIHN0YWdlICovCi0KLSAgICAgICAgLyogZmlyc3Qgc3RhZ2UgKi8KLSAgICAgICAgeDggPSBXNyAqICh4NCArIHg1KSArIDQ7Ci0gICAgICAgIHg0ID0gKHg4ICsgKFcxIC0gVzcpICogeDQpID4+IDM7Ci0gICAgICAgIHg1ID0gKHg4IC0gKFcxICsgVzcpICogeDUpID4+IDM7Ci0gICAgICAgIHg4ID0gVzMgKiAoeDYgKyB4NykgKyA0OwotICAgICAgICB4NiA9ICh4OCAtIChXMyAtIFc1KSAqIHg2KSA+PiAzOwotICAgICAgICB4NyA9ICh4OCAtIChXMyArIFc1KSAqIHg3KSA+PiAzOwotCi0gICAgICAgIC8qIHNlY29uZCBzdGFnZSAqLwotICAgICAgICB4OCA9IHgwICsgeDE7Ci0gICAgICAgIHgwIC09IHgxOwotICAgICAgICB4MSA9IFc2ICogKHgzICsgeDIpICsgNDsKLSAgICAgICAgeDIgPSAoeDEgLSAoVzIgKyBXNikgKiB4MikgPj4gMzsKLSAgICAgICAgeDMgPSAoeDEgKyAoVzIgLSBXNikgKiB4MykgPj4gMzsKLSAgICAgICAgeDEgPSB4NCArIHg2OwotICAgICAgICB4NCAtPSB4NjsKLSAgICAgICAgeDYgPSB4NSArIHg3OwotICAgICAgICB4NSAtPSB4NzsKLQotICAgICAgICAvKiB0aGlyZCBzdGFnZSAqLwotICAgICAgICB4NyA9IHg4ICsgeDM7Ci0gICAgICAgIHg4IC09IHgzOwotICAgICAgICB4MyA9IHgwICsgeDI7Ci0gICAgICAgIHgwIC09IHgyOwotICAgICAgICB4MiA9ICgxODEgKiAoeDQgKyB4NSkgKyAxMjgpID4+IDg7Ci0gICAgICAgIHg0ID0gKDE4MSAqICh4NCAtIHg1KSArIDEyOCkgPj4gODsKLQotICAgICAgICAvKiBmb3VydGggc3RhZ2UgKi8KLSAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocHJlZCArPSAxMikpOyAvKiByZWFkIDQgYnl0ZXMgZnJvbSBwcmVkICovCi0KLSAgICAgICAgcmVzID0gKHg3ICsgeDEpID4+IDE0OwotICAgICAgICBBRERfQU5EX0NMSVAxKHJlcyk7Ci0gICAgICAgIHJlczIgPSAoeDMgKyB4MikgPj4gMTQ7Ci0gICAgICAgIEFERF9BTkRfQ0xJUDIocmVzMik7Ci0gICAgICAgIGRzdF93b3JkID0gKHJlczIgPDwgOCkgfCByZXM7Ci0gICAgICAgIHJlcyA9ICh4MCArIHg0KSA+PiAxNDsKLSAgICAgICAgQUREX0FORF9DTElQMyhyZXMpOwotICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDE2KTsKLSAgICAgICAgcmVzID0gKHg4ICsgeDYpID4+IDE0OwotICAgICAgICBBRERfQU5EX0NMSVA0KHJlcyk7Ci0gICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMjQpOwotICAgICAgICAqKCh1aW50MzIqKShkc3QgKz0gd2lkdGgpKSA9IGRzdF93b3JkOyAvKiBzYXZlIDQgYnl0ZXMgdG8gZHN0ICovCi0KLSAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocH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KLSAgICAgICAgeDIgPSBibGtbNl07Ci0gICAgICAgIGJsa1s2XSA9IDA7Ci0gICAgICAgIHgzID0gYmxrWzJdOwotICAgICAgICBibGtbMl0gPSAwOwotICAgICAgICB4NCA9IGJsa1sxXTsKLSAgICAgICAgYmxrWzFdID0gMDsKLSAgICAgICAgeDUgPSBibGtbN107Ci0gICAgICAgIGJsa1s3XSA9IDA7Ci0gICAgICAgIHg2ID0gYmxrWzVdOwotICAgICAgICBibGtbNV0gPSAwOwotICAgICAgICB4NyA9IGJsa1szXTsKLSAgICAgICAgYmxrWzNdID0gMDsKLSNpZm5kZWYgRkFTVF9JRENUCi0gICAgICAgIC8qIHNob3J0Y3V0ICovICAvKiBjb3ZlcmVkIGJ5IGlkY3Ryb3cxICAwMS85LzIwMDEgKi8KLSAgICAgICAgaWYgKCEoeDEgfCB4MiB8IHgzIHwgeDQgfCB4NSB8IHg2IHwgeDcpKQotICAgICAgICB7Ci0gICAgICAgICAgICBibGtbMF0gPSBibGtbMV0gPSBibGtbMl0gPSBibGtbM10gPSBibGtbNF0gPSBibGtbNV0gPSBibGtbNl0gPSBibGtbN10gPSAoYmxrWzBdICsgMzIpID4+IDY7Ci0gICAgICAgICAgICByZXR1cm47Ci0gICAgICAgIH0KLSNlbmRpZgotICAgICAgICB4MCA9ICgoaW50MzIpYmxrWzBdIDw8IDgpICsgODE5MjsKLSAgICAgICAgYmxrWzBdID0gMDsgIC8qIGZvciBwcm9wZXIgcm91bmRpbmcgaW4gdGhlIGZvdXJ0aCBzdGFnZSAqLwotCi0gICAgICAgIC8qIGZpcnN0IHN0YWdlICovCi0gICAgICAgIHg4ID0gVzcgKiAoeDQgKyB4NSkgKyA0OwotICAgICAgICB4NCA9ICh4OCArIChXMSAtIFc3KSAqIHg0KSA+PiAzOwotICAgICAgICB4NSA9ICh4OCAtIChXMSArIFc3KSAqIHg1KSA+PiAzOwotICAgICAgICB4OCA9IFczICogKHg2ICsgeDcpICsgNDsKLSAgICAgICAgeDYgPSAoeDggLSAoVzMgLSBXNSkgKiB4NikgPj4gMzsKLSAgICAgICAgeDcgPSAoeDggLSAoVzMgKyBXNSkgKiB4NykgPj4gMzsKLQotICAgICAgICAvKiBzZWNvbmQgc3RhZ2UgKi8KLSAgICAgICAgeDggPSB4MCArIHgxOwotICAgICAgICB4MCAtPSB4MTsKLSAgICAgICAgeDEgPSBXNiAqICh4MyArIHgyKSArIDQ7Ci0gICAgICAgIHgyID0gKHgxIC0gKFcyICsgVzYpICogeDIpID4+IDM7Ci0gICAgICAgIHgzID0gKHgxICsgKFcyIC0gVzYpICogeDMpID4+IDM7Ci0gICAgICAgIHgxID0geDQgKyB4NjsKLSAgICAgICAgeDQgLT0geDY7Ci0gICAgICAgIHg2ID0geDUgKyB4NzsKLSAgICAgICAgeDUgLT0geDc7Ci0KLSAgICAgICAgLyogdGhpcmQgc3RhZ2UgKi8KLSAgICAgICAgeDcgPSB4OCArIHgzOwotICAgICAgICB4OCAtPSB4MzsKLSAgICAgICAgeDMgPSB4MCArIHgyOwotICAgICAgICB4MCAtPSB4MjsKLSAgICAgICAgeDIgPSAoMTgxICogKHg0ICsgeDUpICsgMTI4KSA+PiA4OwotICAgICAgICB4NCA9ICgxODEgKiAoeDQgLSB4NSkgKyAxMjgpID4+IDg7Ci0KLSAgICAgICAgLyogZm91cnRoIHN0YWdlICovCi0gICAgICAgIHdvcmQgPSAoKHg3ICsgeDEpID4+IDE0KTsKLSAgICAgICAgQ0xJUF9SRVNVTFQod29yZCkKLQotICAgICAgICB0ZW1wID0gKCh4MyArIHgyKSA+PiAxNCk7Ci0gICAgICAgIENMSVBfUkVTVUxUKHRlbXApCi0gICAgICAgIHdvcmQgPSB3b3JkIHwgKHRlbXAgPDwgOCk7Ci0KLSAgICAgICAgdGVtcCA9ICgoeDAgKyB4NCkgPj4gMTQpOwotICAgICAgICBDTElQX1JFU1VMVCh0ZW1wKQotICAgICAgICB3b3JkID0gd29yZCB8ICh0ZW1wIDw8IDE2KTsKLQotICAg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SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IGJsa1swXSA8PCAzOwotICAgICAgICByZXR1cm47Ci0gICAgfQotI2VuZGlmCi0KLSAgICB4MCA9ICgoaW50MzIpYmxrWzBdIDw8IDExKSArIDEyODsKLQotICAgIC8qIGZpcnN0IHN0YWdlICovCi0gICAgeDggPSBXNyAqICh4NCArIHg1KTsKLSAgICB4NCA9IHg4ICsgKFcxIC0gVzcpICogeDQ7Ci0gICAgeDUgPSB4OCAtIChXMSArIFc3KSAqIHg1OwotICAgIHg4ID0gVzMgKiAoeDYgKyB4Nyk7Ci0gICAgeDYgPSB4OCAtIChXMyAtIFc1KSAqIHg2OwotICAgIHg3ID0geDggLSAoVzMgKyBXNSkgKiB4NzsKLQotICAgIC8qIHNlY29uZCBzdGFnZSAqLwotICAgIHg4ID0geDAgKyB4MTsKLSAgICB4MCAtPSB4MTsKLSAgICB4MSA9IFc2ICogKHgzICsgeDIpOwotICAgIHgyID0geDEgLSAoVzIgKyBXNikgKiB4MjsKLSAgICB4MyA9IHgxICsgKFcyIC0gVzYpICogeDM7Ci0gICAgeDEgPSB4NCArIHg2OwotICAgIHg0IC09IHg2OwotICAgIHg2ID0geDUgKyB4NzsKLSAgICB4NSAtPSB4NzsKLQotICAgIC8qIHRoaXJkIHN0YWdlICovCi0gICAgeDcgPSB4OCArIHgzOwotICAgIHg4IC09IHgzOwotICAgIHgzID0geDAgKyB4MjsKLSAgICB4MCAtPSB4MjsKLSAgICB4MiA9ICgxODEgKiAoeDQgKyB4NSkgKyAxMjgpID4+IDg7Ci0gICAgeDQgPSAoMTgxICogKHg0IC0geDUpICsgMTI4KSA+PiA4OwotCi0gICAgLyogZm91cnRoIHN0YWdlICovCi0gICAgYmxrWzBdICAgID0gKHg3ICsgeDEpID4+IDg7Ci0gICAgYmxrWzhdID0gKHgzICsgeDIpID4+IDg7Ci0gICAgYmxrWzE2XSA9ICh4MCArIHg0KSA+PiA4OwotICAgIGJ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S0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQotOyBFWFRFUk5BTCBHTE9CQUwgU1RPUkUvQlVGRkVSL1BPSU5URVIgUkVGRVJFTkNFUwotOyBEZWNsYXJlIHZhcmlhYmxlcyB1c2VkIGluIHRoaXMgbW9kdWxlIGJ1dCBkZWZpbmVkIGVsc2V3aGVyZQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi0jaWZkZWYgUFZfUE9TVFBST0NfT04KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKLSAgICBGdW5jdGlvbiBwcm90b3R5cGUgOiB2b2lkIENvbWJpbmVkSG9yelZlcnRGaWx0ZXIoICAgdWludDggKnJlYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHdpZHRoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaGVpZ2h0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgKlFQX3N0b3JlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgY2hyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50OCAqcHBfbW9kKQotICAgIFBhcmFtZXRlcnMgIDoKLSAgICAgICAgcmVjICAgICA6ICAgcG9pbnRlciB0byB0aGUgZGVjb2RlZCBmcmFtZSBidWZmZXIuCi0gICAgICAgIHdpZHRoICAg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SovCi0gICAgcHBfdyA9ICh3aWR0aCA+PiAzKTsKLSAgICBwcF9oID0gKGhlaWdodCA+PiAzKTsKLQotICAgIGZvciAobWJyID0gMDsgbWJyIDwgcHBfaDsgbWJyICs9IDIpICAgICAgICAgLyogcm93IG9mIGJsb2NrcyAqLwotICAgIHsKLSAgICAgICAgYnJ3aWR0aCA9IG1iciAqIHBwX3c7ICAgICAgICAgICAgICAgLyogbnVtYmVyIG9mIGJsb2NrcyBhYm92ZSBjdXJyZW50IGJsb2NrIHJvdyAqLwotICAgICAgICBmb3IgKG1iYyA9IDA7IG1iYyA8IHBwX3c7IG1iYyArPSAyKSAgICAgLyogY29sIG9mIGJsb2NrcyAqLwotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAoIWNocikKLSAgICAgICAgICAgICAgICBRUCA9IFFQX3N0b3JlWyhicndpZHRoPj4yKSArIChtYmM+PjEpXTsgLyogUVAgaXMgcGVyIE1CIGJhc2VkIHZhbHVlICovCi0KLSAgICAgICAgICAgIC8qKioqKioqKiogZm9yIGVhY2ggYmxvY2sgKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqIEhvcml6LiBGaWx0ZXJpbmcgKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICBmb3IgKGJyID0gbWJyICsgMTsgYnIgPCBtYnIgKyAzOyBicisrKSAgLyogMngyIGJsb2NrcyAqLwotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGJyd2lkdGggKz0gcHBfdzsgICAgICAgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBibG9ja3MgYWJvdmUgJiBsZWZ0IGN1cnJlbnQgYmxvY2sgcm93ICovCi0gICAgICAgICAgICAgICAgLyogdGhlIHByb2ZpbGUgb24gQVJNOTIwVCBzaG93cyBzZXBhcmF0ZSB0aGVzZSB0d28gYm91bmRhcnkgY2hlY2sgaXMgZmFzdGVyIHRoYW4gY29tYmluZSB0aGVtICovCi0gICAgICAgICAgICAgICAgaWYgKGJyIDwgcHBfaCkgICAgICAgICAgICAgICAgICAvKiBib3VuZGFyeSA6IGRvbid0IGRvIGl0IG9uIHRoZSBsb3dlc3Qgcm93IGJsb2NrICovCi0gICAgICAgICAgICAgICAgICAgIGZvciAoYmMgPSBtYmM7IGJjIDwgbWJjICsgMjsgYmMrKykKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgLyoqKioqKiBjaGVjayBib3VuZGFyeSBmb3IgZGVibG9ja2luZyAqKioqKioqKioqKiovCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYmMgPCBwcF93KSAgICAgICAgICAgICAgLyogYm91bmRhcnkgOiBkb24ndCBkbyBpdCBvbiB0aGUgbW9zdCByaWdodCBjb2wgYmxvY2sgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHIgPSByZWMgKyAoYnJ3aWR0aCA8PCA2KSArIChiYyA8PCAzKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCA9IGJyd2lkdGggKyBiYzsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hyKSAgICBRUCA9IFFQX3N0b3JlW2pWYWwwXTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0cl9lID0gcHRyICsgODsgICAgICAgIC8qIHBvaW50ZXIgdG8gd2hlcmUgdGhlIGxvb3AgZW5kcyAqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCgocHBfbW9kW2pWYWwwXSYweDAyKSkgJiYgKChwcF9tb2RbalZhbDAtcHBfd10mMHgwMikpKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSG9yaXogSGFyZCBmaWx0ZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgPSAqKHB0ciAtIHdpZHRoKTsgICAgIC8qIEMgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxID0gKnB0cjsgICAgICAgICAgICAgICAvKiBEICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMiA9IGpWYWwxIC0galZhbDA7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoKGpWYWwyID4gMCkgJiYgKGpWYWwyIDwgKFFQIDw8IDEpKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgKChqVmFsMiA8IDApICYmIChqVmFsMiA+IC0oUVAgPDwgMSkpKSkgLyogKEQtQykgY29tcGFyZWQgd2l0aCAyUVAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBkaWZmZXJlbnRpYXRlIGJldHdlZW4gcmVhbCBhbmQgZmFrZSBlZGdlICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgPSAoKGpWYWwwICsgalZhbDEpID4+IDEpOyAgICAgLyogKEQrQykvMiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyIC0gd2lkdGgpID0gKHVpbnQ4KShqVmFsMCk7ICAgIC8qICBDICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKnB0ciA9ICh1aW50OCkoalZhbDApOyAgICAgICAgICAvKiAgRCAqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgPSAqKHB0ciAtICh3aWR0aCA8PCAxKSk7ICAgICAgLyogQiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxID0gKihwdHIgKyB3aWR0aCk7ICAgICAgICAgLyogRSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwyID0galZhbDEgLSBqVmFsMDsgICAgICAvKiBFLUIgKi8KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChqVmFsMiA+IDApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCArPSAoKGpWYWwyICsgMykgPj4gMik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxIC09ICgoalZhbDIgKyAzKSA+PiAyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSAod2lkdGggPDwgMSkpID0gKHVpbnQ4KWpWYWwwOyAgICAgICAvKiAgc3RvcmUgQiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciArIHdpZHRoKSA9ICh1aW50OClqVmFsMTsgICAgICAgICAgLyogc3RvcmUgRSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChqVmFsMikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwIC09ICgoMyAtIGpWYWwyKSA+PiAyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgKz0gKCgzIC0galZhbDIpID4+IDIpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciAtICh3aWR0aCA8PCAxKSkgPSAodWludDgpalZhbDA7ICAgICAgIC8qICBzdG9yZSBCICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyICsgd2lkdGgpID0gKHVpbnQ4KWpWYWwxOyAgICAgICAgICAvKiBzdG9yZSBFICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgPSAqKHB0ciAtICh3aWR0aCA8PCAxKSAtIHdpZHRoKTsgIC8qIEEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMSA9ICoocHRyICsgKHdpZHRoIDw8IDEpKTsgICAgICAvKiBGICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDIgPSBqVmFsMSAtIGpWYWwwOyAgICAgICAgICAgICAgLyogKEYtQSkgKi8KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChqVmFsMiA+IDApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCArPSAoKGpWYWwyICsgNykgPj4gMyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxIC09ICgoalZhbDIgKyA3KSA+PiAzKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSAod2lkdGggPDwgMSkgLSB3aWR0aCkgPSAodWludDgpKGpWYWwwKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgKyAod2lkdGggPDwgMSkpID0gKHVpbnQ4KShqVmFsMSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGpWYWwyKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgLT0gKCg3IC0galZhbDIpID4+IDMpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMSArPSAoKDcgLSBqVmFsMikgPj4gMyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyIC0gKHdpZHRoIDw8IDEpIC0gd2lkdGgpID0gKHVpbnQ4KShqVmFsMCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyICsgKHdpZHRoIDw8IDEpKSA9ICh1aW50OCkoalZhbDEpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0vKiBhM18wID4gMlFQICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKCsrcHRyIDwgcHRyX2UpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlICAgLyogSG9yaXogc29mdCBmaWx0ZXIqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgPSAqKHB0ciAtIHdpZHRoKTsgLyogQiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgPSAqcHRyOyAgICAgICAgICAgLyogQyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDIgPSBqVmFsMSAtIGpWYWwwOyAgLyogQy1CICovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoKGpWYWwyID4gMCkgJiYgKGpWYWwyIDwgKFFQKSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8ICgoalZhbDIgPCAwKSAmJiAoalZhbDIgPiAtKFFQKSkpKSAvKiAoQy1CKSBjb21wYXJlZCB3aXRoIFFQICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCA9ICgoalZhbDAgKyBqVmFsMSkgPj4gMSk7ICAgICAvKiAoQitDKS8yIGNhbm5vdCBvdmVyZmxvdzsgY2VpbCgpICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSB3aWR0aCkgPSAodWludDgpKGpWYWwwKTsgICAgLyogQiA9IChCK0MpLzIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqcHRyID0gKHVpbnQ4KWpWYWwwOyAgICAgICAgICAgIC8qIEMgPSAoQitDKS8yICovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCA9ICoocHRyIC0gKHdpZHRoIDw8IDEpKTsgICAgICAvKiBBICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgPSAqKHB0ciArIHdpZHRoKTsgICAgICAgICAvKiBEICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDIgPSBqVmFsMSAtIGpWYWwwOyAgICAgICAgICAvKiBELUEgKi8KLQotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGpWYWwyID4gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxIC09ICgoalZhbDIgKyA3KSA+PiAzKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgKz0gKChqVmFsMiArIDcpID4+IDMpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciAtICh3aWR0aCA8PCAxKSkgPSAodWludDgpalZhbDA7ICAgICAgIC8qIEEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgKyB3aWR0aCkgPSAodWludDgpalZhbDE7ICAgICAgICAgIC8qIEQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoalZhbDIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMSArPSAoKDcgLSBqVmFsMikgPj4gMyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwIC09ICgoNyAtIGpWYWwyKSA+PiAzKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSAod2lkdGggPDwgMSkpID0gKHVpbnQ4KWpWYWwwOyAgICAgICAvKiBBICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyICsgd2lkdGgpID0gKHVpbnQ4KWpWYWwxOyAgICAgICAgICAvKiBEICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlICgrK3B0ciA8IHB0cl9lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IC8qIFNvZnQgZmlsdGVyKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIH0vKiBib3VuZGFyeSBjaGVja2luZyovCi0gICAgICAgICAgICAgICAgICAgIH0vKmJjKi8KLSAgICAgICAgICAgIH0vKmJyKi8KLSAgICAgICAgICAgIGJyd2lkdGggLT0gKHBwX3cgPDwgMSk7Ci0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqIFZlcnQuIEZpbHRlcmluZyAqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIGZvciAoYnIgPSBtYnI7IGJyIDwgbWJyICsgMjsgYnIrKykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZiAoYnIgPCBwcF9oKQotICAgICAgICAgICAgICAgICAgICBmb3IgKGJjID0gbWJjICsgMTsgYmMgPCBtYmMgKyAzOyBiYysrKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKioqKioqIGNoZWNrIGJvdW5kYXJ5IGZvciBkZWJsb2NraW5nICoqKioqKioqKioqKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiYyA8IHBwX3cpCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRyID0gcmVjICsgKGJyd2lkdGggPDwgNikgKyAoYmMgPDwgMyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgPSBicndpZHRoICsgYmM7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNocikgICAgUVAgPSBRUF9zdG9yZVtqVmFsMF07Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJfZSA9IHB0ciArICh3aWR0aCA8PCAzKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoKHBwX21vZFtqVmFsMC0xXSYweDAxKSkgJiYgKChwcF9tb2RbalZhbDBdJjB4MDEpKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFZlcnQgSGFyZCBmaWx0ZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgPSAqcHRyOyAgICAgICAvKiBEICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCA9ICoocHRyIC0gMSk7IC8qIEMgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwyID0galZhbDEgLSBqVmFsMDsgIC8qIEQtQyAqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKChqVmFsMiA+IDApICYmIChqVmFsMiA8IChRUCA8PCAxKSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8ICgoalZhbDIgPCAwKSAmJiAoalZhbDIgPiAtKFFQIDw8IDEpKSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgPSAoalZhbDAgKyBqVmFsMSkgPj4gMTsgICAvKiAoQytEKS8yICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKnB0ciAgICAgICAgPSAgIGpWYWwxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyIC0gMSkgID0gICBqVmFsMTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxID0gKihwdHIgKyAxKTsgICAgIC8qIEUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCA9ICoocHRyIC0gMik7ICAgICAvKiBCICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDIgPSBqVmFsMSAtIGpWYWwwOyAgICAgIC8qIEUtQiAqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGpWYWwyID4gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxIC09ICgoalZhbDIgKyAzKSA+PiAyKTsgICAgICAgIC8qIEUgPSBFIC0oRS1CKS80ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwICs9ICgoalZhbDIgKyAzKSA+PiAyKTsgICAgICAgIC8qIEIgPSBCICsoRS1CKS80ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyICsgMSkgPSBqVmFsMTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSAyKSA9IGpWYWwwOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChqVmFsMikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxICs9ICgoMyAtIGpWYWwyKSA+PiAyKTsgICAgICAgIC8qIEUgPSBFIC0oRS1CKS80ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwIC09ICgoMyAtIGpWYWwyKSA+PiAyKTsgICAgICAgIC8qIEIgPSBCICsoRS1CKS80ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyICsgMSkgPSBqVmFsMTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSAyKSA9IGpWYWwwOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxID0gKihwdHIgKyAyKTsgICAgIC8qIEYgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCA9ICoocHRyIC0gMyk7ICAgICAvKiBBICovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMiA9IGpWYWwxIC0galZhbDA7ICAgICAgICAgIC8qIChGLUEpICovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoalZhbDIgPiAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgLT0gKChqVmFsMiArIDcpID4+IDMpOyAgICAvKiBGIC09IChGLUEpLzggKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgKz0gKChqVmFsMiArIDcpID4+IDMpOyAgICAvKiBBICs9IChGLUEpLzggKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgKyAyKSA9IGpWYWwxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciAtIDMpID0galZhbDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGpWYWwyKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgLT0gKChqVmFsMiAtIDcpID4+IDMpOyAgICAvKiBGIC09IChGLUEpLzggKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgKz0gKChqVmFsMiAtIDcpID4+IDMpOyAgICAvKiBBICs9IChGLUEpLzggKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgKyAyKSA9IGpWYWwxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciAtIDMpID0galZhbDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSAgIC8qIGVuZCBvZiB2ZXIgaGFyZCBmaWxldGVyaW5nICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKChwdHIgKz0gd2lkdGgpIDwgcHRyX2UpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlICAgLyogVmVydCBzb2Z0IGZpbHRlciovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMSA9ICpwdHI7ICAgICAgICAgICAgICAgLyogQyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgPSAqKHB0ciAtIDEpOyAgICAgICAgIC8qIEIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwyID0galZhbDEgLSBqVmFsMDsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCgoalZhbDIgPiAwKSAmJiAoalZhbDIgPCAoUVApKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgKChqVmFsMiA8IDApICYmIChqVmFsMiA+IC0oUVApKSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMSA9IChqVmFsMCArIGpWYWwxICsgMSkgPj4gMTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqcHRyID0galZhbDE7ICAgICAgICAgICAvKiBDICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSAxKSA9IGpWYWwxOyAgICAgLyogQiAqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgPSAqKHB0ciArIDEpOyAgICAgLyogRCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwID0gKihwdHIgLSAyKTsgICAgIC8qIEEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMiA9IChqVmFsMSAtIGpWYWwwKTsgICAgICAgIC8qIEQtIEEgKi8KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChqVmFsMiA+IDApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMSAtPSAoKChqVmFsMikgKyA3KSA+PiAzKTsgICAgICAvKiBEIC09IChELUEpLzggKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgKz0gKCgoalZhbDIpICsgNykgPj4gMyk7ICAgICAgLyogQSArPSAoRC1BKS84ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyICsgMSkgPSBqVmFsMTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSAyKSA9IGpWYWwwOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGpWYWwyKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgKz0gKCg3IC0gKGpWYWwyKSkgPj4gMyk7ICAgICAgLyogRCAtPSAoRC1BKS84ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwIC09ICgoNyAtIChqVmFsMikpID4+IDMpOyAgICAgIC8qIEEgKz0gKEQtQSkvOCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciArIDEpID0galZhbDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyIC0gMikgPSBqVmFsMDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKChwdHIgKz0gd2lkdGgpIDwgcHRyX2UpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gLyogU29mdCBmaWx0ZXIqLwotICAgICAgICAgICAgICAgICAgICAgICAgfSAvKiBib3VuZGFye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ioqLwotICAgICAgICAgICAgZm9yIChiciA9IG1iciArIDE7IGJyIDwgbWJyICsgMzsgYnIrKykgIC8qIDJ4MiBibG9ja3MgKi8KLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBicndpZHRoICs9IHBwX3c7ICAgICAgICAgICAgICAgICAgICAvKiBudW1iZXIgb2YgYmxvY2tzIGFib3ZlICYgbGVmdCBjdXJyZW50IGJsb2NrIHJvdyAqLwotICAgICAgICAgICAgICAgIC8qIHRoZSBwcm9maWxlIG9uIEFSTTkyMFQgc2hvd3Mgc2VwYXJhdGUgdGhlc2UgdHdvIGJvdW5kYXJ5IGNoZWNrIGlzIGZhc3RlciB0aGFuIGNvbWJpbmUgdGhlbSAqLwotICAgICAgICAgICAgICAgIGlmIChiciA8IHBwX2gpICAgICAgICAgICAgICAgICAgLyogYm91bmRhcnkgOiBkb24ndCBkbyBpdCBvbiB0aGUgbG93ZXN0IHJvdyBibG9jayAqLwotICAgICAgICAgICAgICAgICAgICBmb3IgKGJjID0gbWJjOyBiYyA8IG1iYyArIDI7IGJjKyspCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8qKioqKiogY2hlY2sgYm91bmRhcnkgZm9yIGRlYmxvY2tpbmcgKioqKioqKioqKioqLwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJjIDwgcHBfdykgICAgICAgICAgICAgIC8qIGJvdW5kYXJ5IDogZG9uJ3QgZG8gaXQgb24gdGhlIG1vc3QgcmlnaHQgY29sIGJsb2NrICovCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRyID0gcmVjICsgKGJyd2lkdGggPDwgNikgKyAoYmMgPDwgMyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgPSBicndpZHRoICsgYmM7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNocikgICAgUVAgPSBRUF9zdG9yZVtqVmFsMF07Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJfZSA9IHB0ciArIDg7ICAgICAgICAvKiBwb2ludGVyIHRvIHdoZXJlIHRoZSBsb29wIGVuZHMgKi8KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoKHBwX21vZFtqVmFsMF0mMHgwMikpICYmICgocHBfbW9kW2pWYWwwLXBwX3ddJjB4MDIpKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEhvcml6IEhhcmQgZmlsdGVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwID0gKihwdHIgLSB3aWR0aCk7ICAgICAvKiBDICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMSA9ICpwdHI7ICAgICAgICAgICAgICAgLyogRCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDIgPSBqVmFsMSAtIGpWYWwwOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKChqVmFsMiA+IDApICYmIChqVmFsMiA8IChRUCA8PCAxKSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8ICgoalZhbDIgPCAwKSAmJiAoalZhbDIgPiAtKFFQIDw8IDEpKSkpIC8qIChELUMpIGNvbXBhcmVkIHdpdGggMlFQICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogZGlmZmVyZW50aWF0ZSBiZXR3ZWVuIHJlYWwgYW5kIGZha2UgZWRnZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwID0gKChqVmFsMCArIGpWYWwxKSA+PiAxKTsgICAgIC8qIChEK0MpLzIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciAtIHdpZHRoKSA9ICh1aW50OCkoalZhbDApOyAgICAvKiAgQyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpwdHIgPSAodWludDgpKGpWYWwwKTsgICAgICAgICAgLyogIEQgKi8KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwID0gKihwdHIgLSAod2lkdGggPDwgMSkpOyAgICAgIC8qIEIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMSA9ICoocHRyICsgd2lkdGgpOyAgICAgICAgIC8qIEUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMiA9IGpWYWwxIC0galZhbDA7ICAgICAgLyogRS1CICovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoalZhbDIgPiAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgKz0gKChqVmFsMiArIDMpID4+IDIpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMSAtPSAoKGpWYWwyICsgMykgPj4gMik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyIC0gKHdpZHRoIDw8IDEpKSA9ICh1aW50OClqVmFsMDsgICAgICAgLyogIHN0b3JlIEIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgKyB3aWR0aCkgPSAodWludDgpalZhbDE7ICAgICAgICAgIC8qIHN0b3JlIEUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoalZhbDIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCAtPSAoKDMgLSBqVmFsMikgPj4gMik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxICs9ICgoMyAtIGpWYWwyKSA+PiAyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSAod2lkdGggPDwgMSkpID0gKHVpbnQ4KWpWYWwwOyAgICAgICAvKiAgc3RvcmUgQiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciArIHdpZHRoKSA9ICh1aW50OClqVmFsMTsgICAgICAgICAgLyogc3RvcmUgRSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwID0gKihwdHIgLSAod2lkdGggPDwgMSkgLSB3aWR0aCk7ICAvKiBBICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgPSAqKHB0ciArICh3aWR0aCA8PCAxKSk7ICAgICAgLyogRiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwyID0galZhbDEgLSBqVmFsMDsgICAgICAgICAgICAgIC8qIChGLUEpICovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoalZhbDIgPiAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgKz0gKChqVmFsMiArIDcpID4+IDMpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMSAtPSAoKGpWYWwyICsgNykgPj4gMyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyIC0gKHdpZHRoIDw8IDEpIC0gd2lkdGgpID0gKHVpbnQ4KShqVmFsMCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyICsgKHdpZHRoIDw8IDEpKSA9ICh1aW50OCkoalZhbDEpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChqVmFsMikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwIC09ICgoNyAtIGpWYWwyKSA+PiAzKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgKz0gKCg3IC0galZhbDIpID4+IDMpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciAtICh3aWR0aCA8PCAxKSAtIHdpZHRoKSA9ICh1aW50OCkoalZhbDApOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciArICh3aWR0aCA8PCAxKSkgPSAodWludDgpKGpWYWwxKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LyogYTNfMCA+IDJRUCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlICgrK3B0ciA8IHB0cl9lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIH0vKiBib3VuZGFyeSBjaGVja2luZyovCi0gICAgICAgICAgICAgICAgICAgIH0vKmJjKi8KLSAgICAgICAgICAgIH0vKmJyKi8KLSAgICAgICAgICAgIGJyd2lkdGggLT0gKHBwX3cgPDwgMSk7Ci0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqIFZlcnQuIEZpbHRlcmluZyAqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIGZvciAoYnIgPSBtYnI7IGJyIDwgbWJyICsgMjsgYnIrKykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZiAoYnIgPCBwcF9oKQotICAgICAgICAgICAgICAgICAgICBmb3IgKGJjID0gbWJjICsgMTsgYmMgPCBtYmMgKyAzOyBiYysrKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKioqKioqIGNoZWNrIGJvdW5kYXJ5IGZvciBkZWJsb2NraW5nICoqKioqKioqKioqKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiYyA8IHBwX3cpCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRyID0gcmVjICsgKGJyd2lkdGggPDwgNikgKyAoYmMgPDwgMyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgPSBicndpZHRoICsgYmM7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNocikgICAgUVAgPSBRUF9zdG9yZVtqVmFsMF07Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJfZSA9IHB0ciArICh3aWR0aCA8PCAzKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoKHBwX21vZFtqVmFsMC0xXSYweDAxKSkgJiYgKChwcF9tb2RbalZhbDBdJjB4MDEpKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFZlcnQgSGFyZCBmaWx0ZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgPSAqcHRyOyAgICAgICAvKiBEICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCA9ICoocHRyIC0gMSk7IC8qIEMgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwyID0galZhbDEgLSBqVmFsMDsgIC8qIEQtQyAqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKChqVmFsMiA+IDApICYmIChqVmFsMiA8IChRUCA8PCAxKSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8ICgoalZhbDIgPCAwKSAmJiAoalZhbDIgPiAtKFFQIDw8IDEpKSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgPSAoalZhbDAgKyBqVmFsMSkgPj4gMTsgICAvKiAoQytEKS8yICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKnB0ciAgICAgICAgPSAgIGpWYWwxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyIC0gMSkgID0gICBqVmFsMTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxID0gKihwdHIgKyAxKTsgICAgIC8qIEUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCA9ICoocHRyIC0gMik7ICAgICAvKiBCICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDIgPSBqVmFsMSAtIGpWYWwwOyAgICAgIC8qIEUtQiAqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGpWYWwyID4gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxIC09ICgoalZhbDIgKyAzKSA+PiAyKTsgICAgICAgIC8qIEUgPSBFIC0oRS1CKS80ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwICs9ICgoalZhbDIgKyAzKSA+PiAyKTsgICAgICAgIC8qIEIgPSBCICsoRS1CKS80ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyICsgMSkgPSBqVmFsMTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSAyKSA9IGpWYWwwOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChqVmFsMikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxICs9ICgoMyAtIGpWYWwyKSA+PiAyKTsgICAgICAgIC8qIEUgPSBFIC0oRS1CKS80ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwwIC09ICgoMyAtIGpWYWwyKSA+PiAyKTsgICAgICAgIC8qIEIgPSBCICsoRS1CKS80ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyICsgMSkgPSBqVmFsMTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSAyKSA9IGpWYWwwOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpWYWwxID0gKihwdHIgKyAyKTsgICAgIC8qIEYgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMCA9ICoocHRyIC0gMyk7ICAgICAvKiBBICovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqVmFsMiA9IGpWYWwxIC0galZhbDA7ICAgICAgICAgIC8qIChGLUEpICovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoalZhbDIgPiAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgLT0gKChqVmFsMiArIDcpID4+IDMpOyAgICAvKiBGIC09IChGLUEpLzggKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgKz0gKChqVmFsMiArIDcpID4+IDMpOyAgICAvKiBBICs9IChGLUEpLzggKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgKyAyKSA9IGpWYWwxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciAtIDMpID0galZhbDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGpWYWwyKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDEgLT0gKChqVmFsMiAtIDcpID4+IDMpOyAgICAvKiBGIC09IChGLUEpLzggKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgalZhbDAgKz0gKChqVmFsMiAtIDcpID4+IDMpOyAgICAvKiBBICs9IChGLUEpLzggKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgKyAyKSA9IGpWYWwxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0ciAtIDMpID0galZhbDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSAgIC8qIGVuZCBvZiB2ZXIgaGFyZCBmaWxldGVyaW5nICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKChwdHIgKz0gd2lkdGgpIDwgcHRyX2UpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgfSAvKiBib3VuZGFyeSovCi0gICAgICAgICAgICAgICAgICAgIH0gLypiYyovCi0gICAgICAgICAgICAgICAgYnJ3aWR0aCArPSBwcF93OwotICAgICAgICAgICAgfS8qYnIqLwotICAgICAgICAgICAgYnJ3aWR0aCAtPSAocHBfdyA8PCAxKTsKLSAgICAgICAgfS8qbWJjKi8KLSAgICAgICAgYnJ3aWR0aCArPSAocHBfdyA8PCAxKTsKLSAgICB9LyptYnIqLwotICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQotICAgIDsgUmV0dXJuIG5vdGhpbmcgb3IgZGF0YSBvciBkYXRhIHBvaW50Z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kdGggPDwgMTsgICAgICAgIC8qIE9mZnNldCB0byB0d28gcm93cyBpbiBwaXhlbHMgKi8KLSAgICB3MyA9IHcxICsgdzI7ICAgICAgICAgICAvKiBPZmZzZXQgdG8gdGhyZWUgcm93cyBpbiBwaXhlbHMgKi8KLSAgICB3NCA9IHcyIDw8IDE7ICAgICAgICAgICAvKiBPZmZzZXQgdG8gZm91ciByb3dzIGluIHBpeGVscyAqLwotICAgIGluY3IgPSB3aWR0aCAtIEJMS1NJWkU7IC8qIE9mZnNldCB0byBuZXh0IHJvdyBhZnRlciBwcm9jZXNzaW5nIGJsb2NrICovCi0KLSAgICAvKiBXb3JrIHRocm91Z2ggdGhlIGFyZWEgaG9ydGl6b250YWxseSBieSB0d28gcm93cyBwZXIgc3RlcCAqLwotICAgIGZvciAobWJyID0gMDsgbWJyIDwgcHBfaDsgbWJyICs9IDIpCi0gICAgewotICAgICAgICAvKiBicndpZHRoIGNvbnRhaW5zIHRoZSBibG9jayBudW1iZXIgb2YgdGhlIGxlZnRtb3N0IGJsb2NrCi0gICAgICAgICAqIG9mIHRoZSBjdXJyZW50IHJvdyAqLwotICAgICAgICBicndpZHRoID0gbWJyICogcHBfdzsKLQotICAgICAgICAvKiBXb3JrIHRocm91Z2ggdGhlIGFyZWEgdmVydGljYWxseSBieSB0d28gY29sdW1ucyBwZXIgc3RlcCAqLwotICAgICAgICBmb3IgKG1iYyA9IDA7IG1iYyA8IHBwX3c7IG1iYyArPSAyKQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBpZiB0aGUgZGF0YSBpcyBsdW1pbmFuY2UgaW5mbywgZ2V0IHRoZSBjb3JyZWN0Ci0gICAgICAgICAgICAgICAgICAgICogcXVhbnRpemF0aW9uIHBhcmFtZW50ZXIuIE9uZSBwYXJhbWV0ZXIgcGVyIG1hY3JvYmxvY2sgKi8KLSAgICAgICAgICAgIGlmICghY2hyKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8qIGJyd2lkdGgvNCBpcyB0aGUgbWFjcm9ibG9jayBudW1iZXIgYW5kIG1iYy8yIGlzIHRoZSBtYWNyb2Jsb2NrIGNvbCBudW1iZXIqLwotICAgICAgICAgICAgICAgIFFQID0gUVBfc3RvcmVbKGJyd2lkdGg+PjIpICsgKG1iYz4+MSldOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqIEhvcml6LiBGaWx0ZXJpbmcgKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvKiBQcm9jZXNzIGZvdXIgYmxvY2tzIGZvciB0aGUgZmlsdGVyaW5nICAgICAgICAqLwotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgLyogTG9vcCBvdmVyIHR3byByb3dzIG9mIGJsb2NrcyAqLwotICAgICAgICAgICAgZm9yIChiciA9IG1iciArIDE7IGJyIDwgbWJyICsgMzsgYnIrKykgICAgLyogYnIgaXMgdGhlIHJvdyBjb3VudGVyIGluIGJsb2NrcyAqLwotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8qIFNldCBicndpZHRoIHRvIHRoZSBmaXJzdCAobGVmdG1vc3QpIGJsb2NrIG51bWJlciBvZiB0aGUgbmV4dCByb3cgKi8KLSAgICAgICAgICAgICAgICAvKiBicndpZHRoIGlzIHVzZWQgYXMgYW4gaW5kZXggd2hlbiBjb3VudGluZyBibG9ja3MgKi8KLSAgICAgICAgICAgICAgICBicndpZHRoICs9IHBwX3c7Ci0KLSAgICAgICAgICAgICAgICAvKiBMb29wIG92ZXIgdHdvIGNvbHVtbnMgb2YgYmxvY2tzIGluIHRoZSByb3cgKi8KLSAgICAgICAgICAgICAgICBmb3IgKGJjID0gbWJjOyBiYyA8IG1iYyArIDI7IGJjKyspICAgIC8qIGJjIGlzIHRoZSBjb2x1bW4gY291bnRlciBpbiBibG9ja3MgKi8KLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIC8qKioqKiogY2hlY2sgYm91bmRhcnkgZm9yIGRlYmxvY2tpbmcgKioqKioqKioqKioqLwotICAgICAgICAgICAgICAgICAgICAvKiBFeGVjdXRlIGlmIHRoZSByb3cgYW5kIGNvbHVtbiBjb3VudGVycyBhcmUgd2l0aGluIHRoZSBhcmVhICovCi0gICAgICAgICAgICAgICAgICAgIGlmIChiciA8IHBwX2ggJiYgYmMgPCBwcF93KQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKiBTZXQgdGhlIHB0ciB0byB0aGUgZmlyc3QgcGl4ZWwgb2YgdGhlIGZpcnN0IGJsb2NrIG9mIHRoZSBzZWNvbmQgcm93Ci0gICAgICAgICAgICAgICAgICAgICAgICAqIGJyd2lkdGggKiA2NCBpcyB0aGUgcGl4ZWwgcm93IG9mZnNldAotICAgICAgICAgICAgICAgICAgICAgICAgKiBiYyAqIDggaXMgdGhlIHBpeGVsIGNvbHVtbiBvZmZzZXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIHB0ciA9IHJlYyArIChicndpZHRoIDw8IDYpICsgKGJjIDw8IDMpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAvKiBTZXQgdGhlIGluZGV4IHRvIHRoZSBjdXJyZW50IGJsb2NrIG9mIHRoZSBzZWNvbmQgcm93IGNvdW50aW5nIGluIGJsb2NrcyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBicndpZHRoICsgYmM7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIGlmIHRoZSBkYXRhIGlzIGNocm9taW5hbmNlIGluZm8sIGdldCB0aGUgY29ycmVjdAotICAgICAgICAgICAgICAgICAgICAgICAgICogcXVhbnRpemF0aW9uIHBhcmFtZW50ZXIuIE9uZSBwYXJhbWV0ZXIgcGVyIGJsb2NrLiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNocikKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBRUCA9IFFQX3N0b3JlW2luZGV4XTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgLyogRXhlY3V0ZSBoYXJkIGhvcml6b250YWwgZmlsdGVyIGlmIHNlbWFwaG9yZSBmb3IgaG9yaXpvbnRhbCBkZWJsb2NraW5nCi0gICAgICAgICAgICAgICAgICAgICAgICAgICogaXMgc2V0IGZvciB0aGUgY3VycmVudCBibG9jayBhbmQgYmxvY2sgaW1tZWRpYXRlbHkgYWJvdmUgaXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoKHBwX21vZFtpbmRleF0mMHgwMikgIT0gMCkgJiYgKChwcF9tb2RbaW5kZXgtcHBfd10mMHgwMikgIT0gMCkpCi0gICAgICAgICAgICAgICAgICAgICAgICB7ICAgLyogSGFyZCBmaWx0ZXIgKi8KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNldCBIb3J6SGZsYWcgKGJpdCA0KSBpbiB0aGUgcHBfbW9kIGxvY2F0aW9uICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHBfbW9kW2luZGV4LXBwX3ddIHw9IDB4MTA7IC8qICA0LzI2LzAwIHJldXNlIHBwX21vZCBmb3IgSG9yekhmbGFnKi8KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEZpbHRlciBhY3Jvc3MgdGhlIDggcGl4ZWxzIG9mIHRoZSBibG9jayAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW5kZXggPSBCTEtTSVpFOyBpbmRleCA+IDA7IGluZGV4LS0pCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBEaWZmZXJlbmNlIGJldHdlZW4gdGhlIGN1cnJlbnQgcGl4ZWwgYW5kIHRoZSBwaXhlbCBhYm92ZSBpdCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhM18wID0gKnB0ciAtICoocHRyIC0gdzEpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGlmIHRoZSBtYWduaXR1ZGUgb2YgdGhlIGRpZmZlcmVuY2UgaXMgZ3JlYXRlciB0aGFuIHRoZSBLVGhIIHRocmVzaG9sZAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBhbmQgd2l0aGluIHRoZSBxdWFudGl6YXRpb24gcGFyYW1ldGVyLCBhcHBseSBoYXJkIGZpbHRlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGEzXzAgPiBLVGhIIHx8IGEzXzAgPCAtS1RoSCkgJiYgYTNfMDxRUCAmJiBhM18wPiAtUVApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0cl9jID0gcHRyIC0gdzM7ICAgLyogUG9pbnRzIHRvIHBpeGVsIHRocmVlIHJvd3MgYWJvdmUgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0cl9uID0gcHRyICsgdzE7ICAgLyogUG9pbnRzIHRvIHBpeGVsIG9uZSByb3cgYmVsb3cgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZbMF0gPSAoaW50KSgqKHB0cl9jIC0gdzMpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZbMV0gPSAoaW50KSgqKHB0cl9jIC0gdzIpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZbMl0gPSAoaW50KSgqKHB0cl9jIC0gdzEpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZbM10gPSAoaW50KSgqcHRyX2MpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdls0XSA9IChpbnQpKCoocHRyX2MgKyB3MSkpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdW0gPSB2WzBdCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHZbMV0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgdlsyXQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAqcHRyX2MKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgdls0XQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAoKihwdHJfYyArIHcyKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgKCoocHRyX2MgKyB3MykpOyAgLyogQ3VycmVudCBwaXhlbCAqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWx0YSA9IChzdW0gKyAqcHRyX2MgKyA0KSA+PiAzOyAgIC8qIEF2ZXJhZ2UgcGl4ZWwgdmFsdWVzIHdpdGggcm91bmRpbmcgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyX2MpID0gKHVpbnQ4KSBkZWx0YTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTW92ZSBwb2ludGVyIGRvd24gb25lIHJvdyBvZiBwaXhlbHMgKHBvaW50cyB0byBwaXhlbCB0d28gcm93cwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICogYWJvdmUgY3VycmVudCBwaXhlbCkgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0cl9jICs9IHcxOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNvdW50ZXIgPSAwOyBjb3VudGVyIDwgNTsgY291bnRlcisrKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFN1YnRyYWN0IG9mZiBoaWdoZXN0IHBpeGVsIGFuZCBhZGQgaW4gcGl4ZWwgYmVsb3cgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdW0gPSBzdW0gLSB2W2NvdW50ZXJdICsgKnB0cl9uOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEF2ZXJhZ2UgdGhlIHBpeGVsIHZhbHVlcyB3aXRoIHJvdW5kaW5nICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsdGEgPSAoc3VtICsgKnB0cl9jICsgNCkgPj4gMzsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqcHRyX2MgPSAodWludDgpKGRlbHRhKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEluY3JlbWVudCBwb2ludGVycyB0byBuZXh0IHBpeGVsIHJvdyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0cl9jICs9IHcxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0cl9uICs9IHcxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEluY3JlbWVudCBwb2ludGVyIHRvIG5leHQgcGl4ZWwgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKytwdHI7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSAvKiBpbmRleCovCi0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICB7IC8qIHNvZnQgZmlsdGVyKi8KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIENsZWFyIEhvcnpIZmxhZyAoYml0IDQpIGluIHRoZSBwcF9tb2QgbG9jYXRpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcF9tb2RbaW5kZXgtcHBfd10gJj0gMHhlZjsgLyogcmVzZXQgMTExMCwxMTExICovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGluZGV4ID0gQkxLU0laRTsgaW5kZXggPiAwOyBpbmRleC0tKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGlmZmVyZW5jZSBiZXR3ZWVuIHRoZSBjdXJyZW50IHBpeGVsIGFuZCB0aGUgcGl4ZWwgYWJvdmUgaXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTNfMCA9ICoocHRyKSAtICoocHRyIC0gdzEpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGlmIHRoZSBtYWduaXR1ZGUgb2YgdGhlIGRpZmZlcmVuY2UgaXMgZ3JlYXRlciB0aGFuIHRoZSBLVGggdGhyZXNob2xkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBhcHBseSBzb2Z0IGZpbHRlciAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGEzXzAgPiBLVGggfHwgYTNfMCA8IC1LVGgpKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFN1bSBvZiB3ZWlnaHRlZCBkaWZmZXJlbmNlcyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTNfMCArPSAoKCoocHRyIC0gdzIpIC0gKihwdHIgKyB3MSkpIDw8IDEpICsgKGEzXzAgPDwgMik7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIENoZWNrIGlmIHN1bSBpcyBsZXNzIHRoYW4gdGhlIHF1YW50aXphdGlvbiBwYXJhbWV0ZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChQVl9BQlMoYTNfMCkgPCAoUVAgPDwgMykpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTNfMSA9ICoocHRyIC0gdzIpIC0gKihwdHIgLSB3Myk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTNfMSArPSAoKCoocHRyIC0gdzQpIC0gKihwdHIgLSB3MSkpIDw8IDEpICsgKGEzXzEgPDwgMik7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhM18yICA9ICoocHRyICsgdzIpIC0gKihwdHIgKyB3MSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTNfMiArPSAoKCoocHRyKSAtICoocHRyICsgdzMpKSA8PCAxKSArIChhM18yIDw8IDIpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQTNfMCA9IFBWX0FCUyhhM18wKSAtIFBWX01JTihQVl9BQlMoYTNfMSksIFBWX0FCUyhhM18yKSk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQTNfMCA+IDApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBM18wICs9IEEzXzAgPDwgMjsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQTNfMCA9IChBM18wICsgMzIpID4+IDY7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhM18wID4gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQTNfMCA9IC1BM18wOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsdGEgPSAoKihwdHIgLSB3MSkgLSAqKHB0cikpID4+IDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkZWx0YSA+PSAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVsdGEgPj0gQTNfMCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWx0YSA9IFBWX01BWChBM18wLCAwKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBM18wID4gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWx0YSA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsdGEgPSBQVl9NQVgoQTNfMCwgZGVsdGEpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihwdHIgLSB3MSkgPSAodWludDgpKCoocHRyIC0gdzEpIC0gZGVsdGEpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHB0cikgPSAodWludDgpKCoocHRyKSArIGRlbHRhKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IC8qdGhyZXNob2xkKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBJbmNyZW1lbnQgcG9pbnRlciB0byBuZXh0IHBpeGVsICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsrcHRyOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gLyppbmRleCovCi0gICAgICAgICAgICAgICAgICAgICAgICB9IC8qIFNvZnQgZmlsdGVyKi8KLSAgICAgICAgICAgICAgICAgICAgfS8qIGJvdW5kYXJ5IGNoZWNraW5nKi8KLSAgICAgICAgICAgICAgICB9LypiYyovCi0gICAgICAgICAgICB9LypiciovCi0gICAgICAgICAgICBicndpZHRoIC09IChwcF93IDw8IDEpOwotCi0KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKiogVmVydC4gRmlsdGVyaW5nICoqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8qIFByb2Nlc3MgZm91ciBibG9ja3MgZm9yIHRoZSBmaWx0ZXJpbmcgICAgICAgICovCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAvKiBMb29wIG92ZXIgdHdvIHJvd3Mgb2YgYmxvY2tzICovCi0gICAgICAgICAgICBmb3IgKGJyID0gbWJyOyBiciA8IG1iciArIDI7IGJyKyspICAgICAgLyogYnIgaXMgdGhlIHJvdyBjb3VudGVyIGluIGJsb2NrcyAqLwotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGZvciAoYmMgPSBtYmMgKyAxOyBiYyA8IG1iYyArIDM7IGJjKyspICAvKiBiYyBpcyB0aGUgY29sdW1uIGNvdW50ZXIgaW4gYmxvY2tzICovCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAvKioqKioqIGNoZWNrIGJvdW5kYXJ5IGZvciBkZWJsb2NraW5nICoqKioqKioqKioqKi8KLSAgICAgICAgICAgICAgICAgICAgLyogRXhlY3V0ZSBpZiB0aGUgcm93IGFuZCBjb2x1bW4gY291bnRlcnMgYXJlIHdpdGhpbiB0aGUgYXJlYSAqLwotICAgICAgICAgICAgICAgICAgICBpZiAoYnIgPCBwcF9oICYmIGJjIDwgcHBfdykKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgLyogU2V0IHRoZSBwdHIgdG8gdGhlIGZpcnN0IHBpeGVsIG9mIHRoZSBmaXJzdCBibG9jayBvZiB0aGUgc2Vjb25kIHJvdwotICAgICAgICAgICAgICAgICAgICAgICAgKiBicndpZHRoICogNjQgaXMgdGhlIHBpeGVsIHJvdyBvZmZzZXQKLSAgICAgICAgICAgICAgICAgICAgICAgICogYmMgKiA4IGlzIHRoZSBwaXhlbCBjb2x1bW4gb2Zmc2V0ICovCi0gICAgICAgICAgICAgICAgICAgICAgICBwdHIgPSByZWMgKyAoYnJ3aWR0aCA8PCA2KSArIChiYyA8PCAzKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgLyogU2V0IHRoZSBpbmRleCB0byB0aGUgY3VycmVudCBibG9jayBvZiB0aGUgc2Vjb25kIHJvdyBjb3VudGluZyBpbiBibG9ja3MgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gYnJ3aWR0aCArIGJjOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAvKiBpZiB0aGUgZGF0YSBpcyBjaHJvbWluYW5jZSBpbmZvLCBnZXQgdGhlIGNvcnJlY3QKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIHF1YW50aXphdGlvbiBwYXJhbWVudGVyLiBPbmUgcGFyYW1ldGVyIHBlciBibG9jay4gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaHIpCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgUVAgPSBRUF9zdG9yZVtpbmRleF07Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIEV4ZWN1dGUgaGFyZCB2ZXJ0aWNhbCBmaWx0ZXIgaWYgc2VtYXBob3JlIGZvciB2ZXJ0aWNhbCBkZWJsb2NraW5nCi0gICAgICAgICAgICAgICAgICAgICAgICAgICogaXMgc2V0IGZvciB0aGUgY3VycmVudCBibG9jayBhbmQgYmxvY2sgaW1tZWRpYXRlbHkgbGVmdCBvZiBpdCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCgocHBfbW9kW2luZGV4LTFdJjB4MDEpICE9IDApICYmICgocHBfbW9kW2luZGV4XSYweDAxKSAhPSAwKSkKLSAgICAgICAgICAgICAgICAgICAgICAgIHsgICAvKiBIYXJkIGZpbHRlciAqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU2V0IFZlcnRIZmxhZyAoYml0IDUpIGluIHRoZSBwcF9tb2QgbG9jYXRpb24gb2YgcHJldmlvdXMgYmxvY2sqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBwX21vZFtpbmRleC0xXSB8PSAweDIwOyAvKiAgNC8yNi8wMCByZXVzZSBwcF9tb2QgZm9yIFZlcnRIZmxhZyovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBGaWx0ZXIgYWNyb3NzIHRoZSA4IHBpeGVscyBvZiB0aGUgYmxvY2sgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGluZGV4ID0gQkxLU0laRTsgaW5kZXggPiAwOyBpbmRleC0tKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGlmZmVyZW5jZSBiZXR3ZWVuIHRoZSBjdXJyZW50IHBpeGVsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICogYW5kIHRoZSBwaXhlbCB0byBsZWZ0IG9mIGl0ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEzXzAgPSAqcHRyIC0gKihwdHIgLSAxKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBpZiB0aGUgbWFnbml0dWRlIG9mIHRoZSBkaWZmZXJlbmNlIGlzIGdyZWF0ZXIgdGhhbiB0aGUgS1RoSCB0aHJlc2hvbGQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICogYW5kIHdpdGhpbiB0aGUgcXVhbnRpemF0aW9uIHBhcmFtZXRlciwgYXBwbHkgaGFyZCBmaWx0ZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChhM18wID4gS1RoSCB8fCBhM18wIDwgLUtUaEgpICYmIGEzXzA8UVAgJiYgYTNfMD4gLVFQKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJfYyA9IHB0ciAtIDM7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJfbiA9IHB0ciArIDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2WzBdID0gKGludCkoKihwdHJfYyAtIDMpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZbMV0gPSAoaW50KSgqKHB0cl9jIC0gMikpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdlsyXSA9IChpbnQpKCoocHRyX2MgLSAxKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2WzNdID0gKGludCkoKnB0cl9jKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZbNF0gPSAoaW50KSgqKHB0cl9jICsgMSkpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdW0gPSB2WzBdCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHZbMV0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgdlsyXQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAqcHRyX2MKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgdls0XQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAoKihwdHJfYyArIDIpKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAoKihwdHJfYyArIDMpKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsdGEgPSAoc3VtICsgKnB0cl9jICsgNCkgPj4gMzsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyX2MpID0gKHVpbnQ4KSBkZWx0YTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTW92ZSBwb2ludGVyIGRvd24gb25lIHBpeGVsIHRvIHRoZSByaWdodCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRyX2MgKz0gMTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoY291bnRlciA9IDA7IGNvdW50ZXIgPCA1OyBjb3VudGVyKyspCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU3VidHJhY3Qgb2ZmIGhpZ2hlc3QgcGl4ZWwgYW5kIGFkZCBpbiBwaXhlbCBiZWxvdyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1bSA9IHN1bSAtIHZbY291bnRlcl0gKyAqcHRyX247Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogQXZlcmFnZSB0aGUgcGl4ZWwgdmFsdWVzIHdpdGggcm91bmRpbmcgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWx0YSA9IChzdW0gKyAqcHRyX2MgKyA0KSA+PiAzOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpwdHJfYyA9ICh1aW50OCkoZGVsdGEpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSW5jcmVtZW50IHBvaW50ZXJzIHRvIG5leHQgcGl4ZWwgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdHJfYyArPSAxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0cl9uICs9IDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSW5jcmVtZW50IHBvaW50ZXJzIHRvIG5leHQgcGl4ZWwgcm93ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0ciArPSB3MTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IC8qIGluZGV4Ki8KLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgICAgIHsgLyogc29mdCBmaWx0ZXIqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogQ2xlYXIgVmVydEhmbGFnIChiaXQgNSkgaW4gdGhlIHBwX21vZCBsb2NhdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBwX21vZFtpbmRleC0xXSAmPSAweGRmOyAvKiByZXNldCAxMTAxLDExMTEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGluZGV4ID0gQkxLU0laRTsgaW5kZXggPiAwOyBpbmRleC0tKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRGlmZmVyZW5jZSBiZXR3ZWVuIHRoZSBjdXJyZW50IHBpeGVsIGFuZCB0aGUgcGl4ZWwgYWJvdmUgaXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTNfMCA9ICoocHRyKSAtICoocHRyIC0gMSk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogaWYgdGhlIG1hZ25pdHVkZSBvZiB0aGUgZGlmZmVyZW5jZSBpcyBncmVhdGVyIHRoYW4gdGhlIEtUaCB0aHJlc2hvbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIGFwcGx5IHNvZnQgZmlsdGVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoYTNfMCA+IEtUaCB8fCBhM18wIDwgLUtUaCkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU3VtIG9mIHdlaWdodGVkIGRpZmZlcmVuY2VzICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhM18wICs9ICgoKihwdHIgLSAyKSAtICoocHRyICsgMSkpIDw8IDEpICsgKGEzXzAgPDwgMik7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIENoZWNrIGlmIHN1bSBpcyBsZXNzIHRoYW4gdGhlIHF1YW50aXphdGlvbiBwYXJhbWV0ZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChQVl9BQlMoYTNfMCkgPCAoUVAgPDwgMykpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTNfMSA9ICoocHRyIC0gMikgLSAqKHB0ciAtIDMpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEzXzEgKz0gKCgqKHB0ciAtIDQpIC0gKihwdHIgLSAxKSkgPDwgMSkgKyAoYTNfMSA8PCAyKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEzXzIgID0gKihwdHIgKyAyKSAtICoocHRyICsgMSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTNfMiArPSAoKCoocHRyKSAtICoocHRyICsgMykpIDw8IDEpICsgKGEzXzIgPDwgMik7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBM18wID0gUFZfQUJTKGEzXzApIC0gUFZfTUlOKFBWX0FCUyhhM18xKSwgUFZfQUJTKGEzXzIpKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBM18wID4gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEzXzAgKz0gQTNfMCA8PCAyOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBM18wID0gKEEzXzAgKyAzMikgPj4gNjsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEzXzAgPiAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBM18wID0gLUEzXzA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWx0YSA9ICgqKHB0ciAtIDEpIC0gKihwdHIpKSA+PiAxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVsdGEgPj0gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRlbHRhID49IEEzXzApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsdGEgPSBQVl9NQVgoQTNfMCwgMCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQTNfMCA+IDApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsdGEgPSAwOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbHRhID0gUFZfTUFYKEEzXzAsIGRlbHRhKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyIC0gMSkgPSAodWludDgpKCoocHRyIC0gMSkgLSBkZWx0YSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHRyKSA9ICh1aW50OCkoKihwdHIpICsgZGVsdGEpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gLyp0aHJlc2hvbGQqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0ciArPSB3MTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IC8qaW5kZXgqLwotICAgICAgICAgICAgICAgICAgICAgICAgfSAvKiBTb2Z0IGZpbHRlciovCi0gICAgICAgICAgICAgICAgICAgIH0gLyogYm91bmRhcnkqLwotICAgICAgICAgICAgICAgIH0gLypiYyovCi0gICAgICAgICAgICAgICAgLyogSW5jcmVtZW50IHBvaW50ZXIgdG8gbmV4dCByb3cgb2YgcGl4ZWxzICovCi0gICAgICAgICAgICAgICAgYnJ3aWR0aCArPSBwcF93OwotICAgICAgICAgICAgfS8qYnIqLwotICAgICAgICAgICAgYnJ3aWR0aCAtPSAocHBfdyA8PCAxKTsKLQotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKiBEZXJpbmdpbmcgKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgLyogUHJvY2VzcyBmb3VyIGJsb2NrcyBmb3IgdGhlIGZpbHRlcmluZyAgICAgICAgKi8KLSAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8qIExvb3Agb3ZlciB0d28gcm93cyBvZiBibG9ja3MgKi8KLSAgICAgICAgICAgIGZvciAoYnIgPSBtYnI7IGJyIDwgbWJyICsgMjsgYnIrKykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAvKiBMb29wIG92ZXIgdHdvIGNvbHVtbnMgb2YgYmxvY2tzIGluIHRoZSByb3cgKi8KLSAgICAgICAgICAgICAgICBmb3IgKGJjID0gbWJjOyBiYyA8IG1iYyArIDI7IGJjKyspCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAvKiBFeGVjdXRlIGlmIHRoZSByb3cgYW5kIGNvbHVtbiBjb3VudGVycyBhcmUgd2l0aGluIHRoZSBhcmVhICovCi0gICAgICAgICAgICAgICAgICAgIGlmIChiciA8IHBwX2ggJiYgYmMgPCBwcF93KQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKiBTZXQgdGhlIGluZGV4IHRvIHRoZSBjdXJyZW50IGJsb2NrICovCi0gICAgICAgICAgICAgICAgICAgICAgICBpbmRleCA9IGJyd2lkdGggKyBiYzsKLQotICAgICAgICAgICAgICAgICAgICAgICAgLyogRXhlY3V0ZSBkZXJpbmdpbmcgaWYgc2VtYXBob3JlIGZvciBkZXJpbmdpbmcgKGJpdC0zIG9mIHBwX21vZCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIGlzIHNldCBmb3IgdGhlIGN1cnJlbnQgYmxvY2sgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICgocHBfbW9kW2luZGV4XSYweDA0KSAhPSAwKQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIERvbid0IHByb2Nlc3MgZGVyaW5naW5nIGlmIG9uIGFuIGVkZ2UgYmxvY2sgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYnIgPiAwICYmIGJjID4gMCAmJiBiciA8IHBwX2ggLSAxICYmIGJjIDwgcHBfdyAtIDEpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBjbnRoZmxhZyA9IHdlaWdodGVkIGF2ZXJhZ2Ugb2YgSG9yekhmbGFnIG9mIGN1cnJlbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIG9uZSBhYm92ZSwgcHJldmlvdXMgYmxvY2tzKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY250aGZsYWcgPSAoKHBwX21vZFtpbmRleF0gJiAweDEwKSArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChwcF9tb2RbaW5kZXgtcHBfd10gJiAweDEwKSArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgocHBfbW9kW2luZGV4LTFdID4+IDEpICYgMHgxMCkgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKHBwX21vZFtpbmRleF0gPj4gMSkgJiAweDEwKSkgPj4gNDsgLyogNC8yNi8wMCovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogRG8gdGhlIGRlcmluZ2luZyBpZiBkZWNpc2lvbiBmbGFncyBpbmRpY2F0ZSBpdCdzIG5lY2Vzc2FyeSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY250aGZsYWcgPCAzKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBpZiB0aGUgZGF0YSBpcyBjaHJvbWluYW5jZSBpbmZvLCBnZXQgdGhlIGNvcnJlY3QKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIHF1YW50aXphdGlvbiBwYXJhbWVudGVyLiBPbmUgcGFyYW1ldGVyIHBlciBibG9jay4gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaHIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUVAgPSBRUF9zdG9yZVtpbmRleF07Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNldCBhbW91bnQgdG8gY2hhbmdlIGx1bWluYW5jZSBpZiBpdCBuZWVkcyB0byBiZSBjaGFuZ2VkCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBiYXNlZCBvbiBxdWFudGl6YXRpb24gcGFyYW1ldGVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhfZGlmZiA9IChRUCA+PiAyKSArIDQ7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNldCBwb2ludGVyIHRvIGZpcnN0IHBpeGVsIG9mIGN1cnJlbnQgYmxvY2sgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0ciA9IHJlYyArIChicndpZHRoIDw8IDYpICsgKGJjIDw8IDMpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBGaW5kIG1pbmltdW0gYW5kIG1heGltdW0gdmFsdWUgb2YgcGl4ZWwgYmxvY2sgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZpbmRNYXhNaW4ocHRyLCAmbWluX2JsaywgJm1heF9ibGssIGluY3IpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiB0aHJlc2hvbGQgZGV0ZXJtaW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyZXMgPSAobWF4X2JsayArIG1pbl9ibGsgKyAxKSA+PiAxOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBJZiBwaXhlbCByYW5nZSBpcyBncmVhdGVyIG9yIGVxdWFsIHRoYW4gREVSSU5HX1RIUiwgc21vb3RoIHRoZSByZWdpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgobWF4X2JsayAtIG1pbl9ibGspID49IERFUklOR19USFIpIC8qc21vb3RoIDh4OCByZWdpb24qLwotI2lmbmRlZiBOb01NWAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIHNtb290aCBhbGwgcGl4ZWxzIGluIHRoZSBibG9jayovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGVyaW5nQWRhcHRpdmVTbW9vdGhNTVgocHRyLCB3aWR0aCwgdGhyZXMsIG1heF9kaWZmKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSNlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU2V0dXAgdGhlIHN0YXJ0aW5nIHBvaW50IG9mIHRoZSByZWdpb24gdG8gc21vb3RoICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdjAgPSAoYnIgPDwgMykgLSAxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgwID0gKGJjIDw8IDMpIC0gMTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qc21vb3RoIDh4OCByZWdpb24qLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFkYXB0aXZlU21vb3RoX05vTU1YKHJlYywgdjAsIGgwLCB2MCArIDEsIGgwICsgMSwgdGhyZXMsIHdpZHRoLCBtYXhfZGlmZik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0jZW5kaWYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS8qY250aGZsYWcqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gLypkZXJpbmcgYnI9PTEgb3IgYmM9PTEgKGJvdW5kYXJ5IGJsb2NrKSovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAgICAvKiBQcm9jZXNzIHRoZSBib3VuZGFyeSBibG9ja3MgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIERlY2lkZSB0byBwZXJmb3JtIGRlYmxvY2tpbmcgYmFzZWQgb24gdGhlIHNlbWFwaG9yZSBmbGFncwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIG9mIHRoZSBuZWlnaGJvcmluZyBibG9ja3MgaW4gZWFjaCBjYXNlLiBBIGNlcnRhaW4gbnVtYmVyIG9mCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIGhhcmQgZmlsdGVyaW5nIGZsYWdzIGhhdmUgdG8gYmUgc2V0IGluIG9yZGVyIHRvIHNpZ25hbCBuZWVkCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIGZvciBzbW9vdGhpbmcgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJyID4gMCAmJiBiciA8IHBwX2ggLSAxKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYmMgPiAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNudGhmbGFnID0gKChwcF9tb2RbaW5kZXgtcHBfd10gJiAweDEwKSArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBwX21vZFtpbmRleF0gJiAweDEwKSArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChwcF9tb2RbaW5kZXgtMV0gPj4gMSkgJiAweDEwKSkgPj4gNDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbnRoZmxhZyA9ICgocHBfbW9kW2luZGV4XSAmIDB4MTApICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocHBfbW9kW2luZGV4LXBwX3ddICYgMHgxMCkgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgocHBfbW9kW2luZGV4XSA+PiAxKSAmIDB4MTApKSA+PiA0OwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGJjID4gMCAmJiBiYyA8IHBwX3cgLSAxKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYnIgPiAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNudGhmbGFnID0gKChwcF9tb2RbaW5kZXgtcHBfd10gJiAweDEwKSArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChwcF9tb2RbaW5kZXgtMV0gPj4gMSkgJiAweDEwKSArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChwcF9tb2RbaW5kZXhdID4+IDEpICYgMHgxMCkpID4+IDQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY250aGZsYWcgPSAoKHBwX21vZFtpbmRleF0gJiAweDEwKSArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChwcF9tb2RbaW5kZXgtMV0gPj4gMSkgJiAweDEwKSArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChwcF9tb2RbaW5kZXhdID4+IDEpICYgMHgxMCkpID4+IDQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAvKiBhdCB0aGUgY29ybmVyIGRvIGRlZmF1bHQqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbnRoZmxhZyA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBEbyB0aGUgZGVyaW5naW5nIGlmIGRlY2lzaW9uIGZsYWdzIGluZGljYXRlIGl0J3MgbmVjZXNzYXJ5ICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjbnRoZmxhZyA8IDIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogaWYgdGhlIGRhdGEgaXMgY2hyb21pbmFuY2UgaW5mbywgZ2V0IHRoZSBjb3JyZWN0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIHF1YW50aXphdGlvbiBwYXJhbWVudGVyLiBPbmUgcGFyYW1ldGVyIHBlciBibG9jay4gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaHIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUVAgPSBRUF9zdG9yZVtpbmRleF07Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNldCBhbW91bnQgdG8gY2hhbmdlIGx1bWluYW5jZSBpZiBpdCBuZWVkcyB0byBiZSBjaGFuZ2VkCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBiYXNlZCBvbiBxdWFudGl6YXRpb24gcGFyYW1ldGVyICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhfZGlmZiA9IChRUCA+PiAyKSArIDQ7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFNldCBwb2ludGVyIHRvIGZpcnN0IHBpeGVsIG9mIGN1cnJlbnQgYmxvY2sgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0ciA9IHJlYyArIChicndpZHRoIDw8IDYpICsgKGJjIDw8IDMpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBGaW5kIG1pbmltdW0gYW5kIG1heGltdW0gdmFsdWUgb2YgcGl4ZWwgYmxvY2sgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZpbmRNYXhNaW4ocHRyLCAmbWluX2JsaywgJm1heF9ibGssIGluY3IpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiB0aHJlc2hvbGQgZGV0ZXJtaW5hdGlvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyZXMgPSAobWF4X2JsayArIG1pbl9ibGsgKyAxKSA+PiAxOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTZXR1cCB0aGUgc3RhcnRpbmcgcG9pbnQgb2YgdGhlIHJlZ2lvbiB0byBzbW9vdGgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIFRoaXMgaXMgZ29pbmcgdG8gYmUgYSA0eDQgcmVnaW9uICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2MCA9IChiciA8PCAzKSArIDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoMCA9IChiYyA8PCAzKSArIDE7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIElmIHBpeGVsIHJhbmdlIGlzIGdyZWF0ZXIgb3IgZXF1YWwgdGhhbiBERVJJTkdfVEhSLCBzbW9vdGggdGhlIHJlZ2lvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChtYXhfYmxrIC0gbWluX2JsaykgPj0gREVSSU5HX1RIUikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBTbW9vdGggNHg0IHJlZ2lvbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFkYXB0aXZlU21vb3RoX05vTU1YKHJlYywgdjAsIGgwLCB2MCAtIDMsIGgwIC0gMywgdGhyZXMsIHdpZHRoLCBtYXhfZGlmZik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0vKmNudGhmbGFnKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IC8qIGJyPT0wLCBiYz09MCovCi0gICAgICAgICAgICAgICAgICAgICAgICB9ICAvKiBkZXJpbmcqLwotICAgICAgICAgICAgICAgICAgICB9IC8qYm91bmRhcnkgY29uZGl0aW9uKi8KLSAgICAgICAgICAgICAgICB9LypiYyovCi0gICAgICAgICAgICAgICAgYnJ3aWR0aCArPSBwcF93OwotICAgICAgICAgICAgfS8qYnIqLwotICAgICAgICAgICAgYnJ3aWR0aCAtPSAocHBfdyA8PCAxKTsKLSAgICAgICAgfS8qbWJjKi8KLSAgICAgICAgYnJ3aWR0aCArPSAocHBfdyA8PCAxKTsKLSAgICB9LyptYnIqLwotCi0gICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tL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AgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IERlY29kZSBhIGZyYW1lIG9mIE1QRUc0IGJpdHN0cmVhbSBpbiBjb21iaW5lZCBtb2RlLiAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgIDAzLzMwLzIwMDAgOiBDbGVhbmVkIHVwIGFuZCBvcHRpbWl6ZWQgdGhlIGNvZGUuICAgICAgICAgICAgICovCi0vKiAgICAgIDAzLzMxLzIwMDAgOiBBZGRlZCBwcm9wZXIgaGFuZGxpbmcgb2YgTUIgc3R1ZmZpbmcuICAgICAgICAgICovCi0vKiAgICAgIDA0LzEzLzIwMDAgOiBSZXdyb3RlIHRoaXMgY29tYmluZWQgbW9kZSBwYXRoIGNvbXBsZXRlbHkgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvIHRoYXQgaXQgaGFuZGxlcyAiQ29tYmluZWQgTW9kZSBXaXRoIEVycm9yICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgUmVzaWxpZW5jZS4iICBOb3cgdGhlIGNvZGUgcmVzZW1ibGVzIHRoZSAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICBwc2V1ZG8gY29kZXMgaW4gTVBFRy00IHN0YW5kYXJkIGJldHRlci4gICAgICAgICovCi0vKiAgICAgIDEwLzEzLzIwMDAgOiBBZGQgZmFzdCBWTEMrZGVxdWFudCAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgIDA0LzEzLzIwMDEgOiBmaXggTUJfc3R1ZmZpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgMDgvMDcvMjAwMSA6IHJlbW92ZSBNQnplcm8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotUFZfU1RBVFVTIERlY29kZUZyYW1lQ29tYmluZWRNb2RlKFZpZGVvRGVjRGF0YSAqdmlkZW8pCi17Ci0gICAgUFZfU1RBVFVTIHN0YXR1czsKLSAgICBpbnQgbWJudW07Ci0gICAgVm9wICpjdXJyVm9wID0gdmlkZW8tPmN1cnJWb3A7Ci0gICAgQml0c3RyZWFtRGVjVmlkZW8gKnN0cmVhbSA9IHZpZGVvLT5iaXRzdHJlYW07Ci0gICAgaW50IHNob3J0VmlkZW9IZWFkZXIgPSB2aWRlby0+c2hvcnRWaWRlb0hlYWRlcjsKLSAgICBpbnQxNiBRUCwgKlFQTUIgPSB2aWRlby0+UVBNQjsKLSAgICB1aW50OCAqTW9kZSA9IHZpZGVvLT5oZWFkZXJJbmZvLk1vZGU7Ci0gICAgaW50IG5Ub3RhbE1CID0gdmlkZW8tPm5Ub3RhbE1COwotICAgIGludCBuTUJQZXJSb3cgPSB2aWRlby0+bk1CUGVyUm93OwotICAgIGludCBzbGljZV9jb3VudGVyOwotICAgIHVpbnQzMiB0bXB2YXIsIGxvbmdfemVyb19iaXRzOwotICAgIHVpbnQgY29kZTsKLSAgICBpbnQgdmFsaWRfc3R1ZmZpbmc7Ci0gICAgaW50IHJlc3luY19tYXJrZXJfbGVuZ3RoOwotICAgIGludCBzdHVmZmluZ19sZW5ndGg7Ci0KLSAgICAvKiBhZGQgdGhpcyBmb3IgZXJy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UX1NVUFBPUlQKLSAgICBpZiAodmlkZW8tPnNob3J0VmlkZW9IZWFkZXIpCi0gICAgewotICAgICAgICBpZiAodmlkZW8tPmFkdmFuY2VkX0lOVFJBKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAodmlkZW8tPm1vZGlmaWVkX3F1YW50KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHZpZGVvLT52bGNEZWNDb2VmZkludHJhID0gJlZsY0RlY1RDT0VGU2hvcnRIZWFkZXJfQW5uZXhJVDsKLSAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRlciA9ICZWbGNEZWNUQ09FRlNob3J0SGVhZGVyX0FubmV4VDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRyYSA9ICZWbGNEZWNUQ09FRlNob3J0SGVhZGVyX0FubmV4STsKLSAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRlciA9ICZWbGNEZWNUQ09FRlNob3J0SGVhZGVyOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKHZpZGVvLT5tb2RpZmllZF9xdWFudCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB2aWRlby0+dmxjRGVjQ29lZmZJbnRlciA9IHZpZGVvLT52bGNEZWNDb2VmZkludHJhID0gJlZsY0RlY1RDT0VGU2hvcnRIZWFkZXJfQW5uZXhUOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHZpZGVvLT52bGNEZWNDb2VmZkludGVyID0gdmlkZW8tPnZsY0RlY0NvZWZmSW50cmEgPSAmVmxjRGVjVENPRUZTaG9ydEhlYWRlcjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotIC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Ci0gICAgICAgICAgICAgICAgbW92ZVBvaW50ZXJUbyhzdHJlYW0sIChzdGFydFBhY2tldCAmIC04KSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8qIFN0b3JlIHRoZSBRUCB2YWx1ZSBmb3IgbGF0ZXIgdXNlIGluIEFDIHByZWRpY3Rpb24gKi8KLSAgICAgICAgICAgIFFQTUJbbWJudW1dID0gUVA7Ci0KLSAgICAgICAgICAgIGlmIChNb2RlW21ibnVtXSAhPSBNT0RFX1NLSVBQRUQpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLyogZGVjb2RlIHRoZSBEQ1QgY29lZmljaWVudHMgZm9yIHRoZSBNQiAqLwotICAgICAgICAgICAgICAgIHN0YXR1cyA9IEdldE1CRGF0YSh2aWRlbyk7Ci0gICAgICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBQVl9TVUNDRVNTKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7Ci0gICAgICAgICAgICAgICAgICAgIHZpZGVvLT5tYm51bSA9IG1iX3N0YXJ0OwotICAgICAgICAgICAgICAgICAgICBtb3ZlUG9pbnRlclRvKHN0cmVhbSwgKHN0YXJ0UGFja2V0ICYgLTgpKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSAvKiBNT0RFX1NLSVBQRUQgKi8KLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBTa2lwcGVkTUJNb3Rpb25Db21wKHZpZGVvKTsgLyogIDA4LzA0LzA1ICovCi0gICAgICAgICAgICB9Ci0gICAgICAgICAgICAvLyBNb3Rpb24gY29tcGVuc2F0aW9uIGFuZCBwdXQgdmlkZW8tPm1ibG9jay0+cHJlZF9ibG9jawotICAgICAgICAgICAgbWJudW0rKzsKLQotICAgICAgICAgICAgLyogcmVtb3ZlIGFueSBzdHVmZmluZyBiaXRzICovCi0gICAgICAgICAgICBCaXRzdHJlYW1TaG93Qml0czE2KHN0cmVhbSwgc3R1ZmZpbmdfbGVuZ3RoLCAmY29kZSk7Ci0gICAgICAgICAgICB3aGlsZSAoY29kZSA9PSAxKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIFBWX0JpdHN0cmVhbUZsdXNoQml0cyhzdHJlYW0sIHN0dWZmaW5nX2xlbmd0aCk7Ci0gICAgICAgICAgICAgICAgQml0c3RyZWFtU2hvd0JpdHMxNihzdHJlYW0sIHN0dWZmaW5nX2xlbmd0aCwgJmNvZGUpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvKiBoYXZlIHdlIHJlYWNoZWQgdGhlIGVuZCBvZiB0aGUgdmlkZW8gcGFja2V0IG9yIHZvcD8gKi8KLSAgICAgICAgICAgIGlmIChzaG9ydFZpZGVvSGVhZGVyKQotICAgICAgICAgICAgewotI2lmZGVmIFBWX0FOTkVYX0lKS1RfU1VQUE9SVAotICAgICAgICAgICAgICAgIGlmICghdmlkZW8tPnNsaWNlX3N0cnVjdHVyZSkKLSAgICAgICAgICAgICAgICB7Ci0jZW5kaWYKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1ibnVtID49IChpbnQpKHZpZGVvLT5tYm51bV9yb3cgKyAxKSp2aWRlby0+bk1CaW5HT0IpICAgLyogIDEwLzExLzAxICovCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYm51bSA+PSBuVG90YWxNQikgcmV0dXJuIFBWX1NVQ0NFU1M7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1TaG93Qml0czMyKHN0cmVhbSwgR09CX1JFU1lOQ19NQVJLRVJfTEVOR1RILCAmdG1wdmFyKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSBHT0JfUkVTWU5DX01BUktFUikKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9CaXRzdHJlYW1TaG93Qml0c0J5dGVBbGlnbihzdHJlYW0sIEdPQl9SRVNZTkNfTUFSS0VSX0xFTkdUSCwgJnRtcHZhcik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSBHT0JfUkVTWU5DX01BUktFUikgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsKLQotICAgICAgICAgICAgICAgICAgICBpZiAobWJudW0gPj0gblRvdGFsTUIpICAvKiBpbiBjYXNlIG5vIHZhbGlkIHN0dWZmaW5nICAwNi8yMy8wMSAqLwotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB2YWxpZF9zdHVmZmluZyA9IHZhbGlkU3R1ZmZpbmdfaDI2MyhzdHJlYW0pOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZhbGlkX3N0dWZmaW5nID09IDApCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29uY2VhbFBhY2tldCh2aWRlbywgbWJfc3RhcnQsIG5Ub3RhbE1CLCBzbGljZV9jb3VudGVyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9TVUNDRVNTOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIC8qIEFOTkVYX0sgKi8KLSAgICAgICAgICAgICAgICAgICAgUFZfQml0c3RyZWFtU2hvd0JpdHNCeXRlQWxpZ25Ob0ZvcmNlU3R1ZmZpbmcoc3RyZWFtLCAxNywgJnRtcHZhcik7Ci0gICAgICAgICAgICAgICAgICAgIGlmICh0bXB2YXIgPT0gUkVTWU5DX01BUktFUikKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRfc3R1ZmZpbmcgPSB2YWxpZFN0dWZmaW5nX2gyNjMoc3RyZWFtKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2YWxpZF9zdHVmZmluZykKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsgLyogIDA2LzIxLzAxICovCi0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIH0KLSNlbmRpZgotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmIChtYm51bSA+PSBuVG90YWxNQikgIC8qIGluIGNhc2Ugbm8gdmFsaWQgc3R1ZmZpbmcgIDA2LzIzLzAxICovCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAvKiAgMTEvMDEvMjAwMiBpZiB3ZSBhcmUgYXQgdGhlIGVuZCBvZiB0aGUgZnJhbWUgYW5kIHRoZXJlIGlzIHNvbWUgZ2FyYmFnZSBkYXRhCi0gICAgICAgICAgICAgICAgICAgIGF0IHRoZSBlbmQgb2YgdGhlIGZyYW1lIChpLmUuIG5vIG5leHQgc3RhcnRjb2RlKSBicmVhayBpZiB0aGUgc3R1ZmZpbmcgaXMgdmFsaWQgKi8KLSAgICAgICAgICAgICAgICAgICAgdmFsaWRfc3R1ZmZpbmcgPSB2YWxpZFN0dWZmaW5nKHN0cmVhbSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmICh2YWxpZF9zdHVmZmluZyA9PSAwKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKiBlbmQgMTEvMDEvMjAwMiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBDb25jZWFsUGFja2V0KHZpZGVvLCBtYl9zdGFydCwgblRvdGFsTUIsIHNsaWNlX2NvdW50ZXIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIFBWX0JpdHN0cmVhbUJ5dGVBbGlnbihzdHJlYW0pOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gUFZfU1VDQ0VTUzsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9CaXRzdHJlYW1TaG93Qml0c0J5dGVBbGlnbihzdHJlYW0sIDIzLCAmdG1wdmFyKTsgLyogdGhpcyBjYWxsIGlzIHZhbGlkIGZvciBmX2NvZGUgPCA4ICovCi0gICAgICAgICAgICAgICAgbG9uZ196ZXJvX2JpdHMgPSAhdG1wdmFyOwotCi0gICAgICAgICAgICAgICAgaWYgKCh0bXB2YXIgPj4gKDIzIC0gcmVzeW5jX21hcmtlcl9sZW5ndGgpKSA9PSBSRVNZTkNfTUFSS0VSIHx8IGxvbmdfemVyb19iaXRzKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgdmFsaWRfc3R1ZmZpbmcgPSB2YWxpZFN0dWZmaW5nKHN0cmVhbSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmICh2YWxpZF9zdHVmZmluZykKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOyAvKiAgMDYvMjEvMDEgKi8KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICB3aGlsZSAoVFJVRSk7Ci0KLSAgICAgICAgaWYgKHNob3J0VmlkZW9IZWFkZXIpCi0gICAgICAgIHsgLyogV2UgbmVlZCB0byBjaGVjayBuZXdnb2IgdG8gcmVmcmVzaCBxdWFudGl6ZXIgKi8KLSNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKLSAgICAgICAgICAgIGlmICghdmlkZW8tPnNsaWNlX3N0cnVjdHVyZSkKLSAgICAgICAgICAgIHsKLSNlbmRpZgotICAgICAgICAgICAgICAgIHdoaWxlICgoc3RhdHVzID0gUFZfR29iSGVhZGVyKHZpZGVvKSkgPT0gUFZfRkFJTCkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgoc3RhdHVzID0gcXVpY2tTZWFyY2hHT0JIZWFkZXIoc3RyZWFtKSkgIT0gUFZfU1VDQ0VTUykKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBtYm51bSA9IGN1cnJWb3AtPmdvYk51bWJlciAqIHZpZGVvLT5uTUJpbkdPQjsKLSNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB3aGlsZSAoKHN0YXR1cyA9IFBWX0gyNjNTbGljZUhlYWRlcih2aWRlbywgJm1ibnVtKSkgPT0gUFZfRkFJTCkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgoc3RhdHVzID0gcXVpY2tTZWFyY2hIMjYzU2xpY2VIZWFkZXIoc3RyZWFtKSkgIT0gUFZfU1VDQ0VTUykKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSNlbmRpZgotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgd2hpbGUgKChzdGF0dXMgPSBQVl9SZWFkVmlkZW9QYWNrZXRIZWFkZXIodmlkZW8sICZtYm51bSkpID09IFBWX0ZBSUwpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgaWYgKChzdGF0dXMgPSBxdWlja1NlYXJjaFZpZGVvUGFja2V0SGVhZGVyKHN0cmVhbSwgcmVzeW5jX21hcmtlcl9sZW5ndGgpKSAhPSBQVl9TVUNDRVNTKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHN0YXR1cyA9PSBQVl9FTkRfT0ZfVk9QKQotICAgICAgICB7Ci0gICAgICAgICAgICBtYm51bSA9IG5Ub3RhbE1COwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKG1ibnVtID4gdmlkZW8tPm1ibnVtICsgMSkKLSAgICAgICAgewotICAgICAgICAgICAgQ29uY2VhbFBhY2tldCh2aWRlbywgdmlkZW8tPm1ibnVtLCBtYm51bSwgc2xpY2VfY291bnRlcik7Ci0gICAgICAgIH0KLSAgICAgICAgUVAgPSB2aWRlby0+Y3VyclZvcC0+cXVhbnRpemVyOwotICAgICAgICBzbGljZV9jb3VudGVyKys7Ci0gICAgICAgIGlmIChtYm51bSA+PSBuVG90YWxNQikgYnJlYWs7Ci0KLSAgICB9Ci0gICAgd2hpbGUgKFRSVUUpOwotICAgIHJldHVybiBQVl9TVUNDRVNTOwotfQotCi0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IEdldE1CSGVhZGVyKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IERlY29kZSBNQiBoZWFkZXIsIG5vdF9jb2RlZCwgbWNicGMsIGFjX3ByZWRfZmxhZywgY2JweSwgZHF1YW50LiAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgMy8yOS8wMCA6IENoYW5nZWQgdGhlIHJldHVybmVkIHZhbHVlIGFuZCBvcHRpbWl6ZWQgdGhlIGNvZGUuICAgICovCi0vKiAgICAgIDQvMDEvMDEgOiBuZXcgQUNEQyBwcmVkaWN0aW9uIHN0cnVjdHVyZSAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotUFZfU1RBVFVTIEdldE1CaGVhZGVyKFZpZGVvRGVjRGF0YSAqdmlkZW8sIGludDE2ICpRUCkKLXsKLSAgICBCaXRzdHJlYW1EZWNWaW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pOwotICAgICAgICBaRVJPX09VVF82NEJZVEVTKERDQUNfcm93KTsKLSAgICAgICAgWkVST19PVVRfNjRCWVRFUyhEQ0FDX2NvbCk7IC8qICAwOC8xMi8wNSAqLwotCi0gICAgICAgIGZvciAoY29tcCA9IDA7IGNvbXAgPCA2OyBjb21wKyspCi0gICAgICAgIHsKLSAgICAgICAgICAgICgqREMpW2NvbXBdID0gbWlkX2dyYXk7Ci0gICAgICAgIH0KLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgLyogY29kZWQgbWFjcm9ibG9jayAqLwotICAgICAgICBpZiAoVm9wVHlwZSA9PSBJX1ZPUCkKLSAgICAgICAgewotICAgICAgICAgICAgTUNCUEMgPSBQVl9WbGNEZWNNQ0JQQ19jb21faW50cmEoc3RyZWFtKTsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKLSAgICAgICAgICAgIGlmICghdmlkZW8tPmRlYmxvY2tpbmcpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgTUNCUEMgPSBQVl9WbGNEZWNNQ0JQQ19jb21faW50ZXIoc3RyZWFtKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBNQ0JQQyA9IFBWX1ZsY0RlY01DQlBDX2NvbV9pbnRlcl9IMjYzKHN0cmVhbSk7Ci0gICAgICAgICAgICB9Ci0jZWxzZQotICAgICAgICAgICAgTUNCUEMgPSBQVl9WbGNEZWNNQ0JQQ19jb21faW50ZXIoc3RyZWFtKTsKLSNlbmRpZgotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKFZMQ19FUlJPUl9ERVRFQ1RFRChNQ0JQQykpCi0gICAgICAgIHsKLSAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOwotICAgICAgICB9Ci0KLSAgICAgICAgTW9kZVttYm51bV0gPSAodWludDgpKE1CdHlwZSA9IE1CdHlwZV9tb2RlW01DQlBDICYgN10pOwotICAgICAgICBDQlBDID0gKE1DQlBDID4+IDQpICYgMzsKLQotI2lmZGVmIFBWX0FOTkVYX0lKS1RfU1VQUE9SVAotICAgICAgICBpZiAoTUJ0eXBlICYgSU5UUkFfTUFTSykKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKCF2aWRlby0+c2hvcnRWaWRlb0hlYWRlcikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB2aWRlby0+YWNQcmVkRmxhZ1ttYm51bV0gPSAodWludDgpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmICh2aWRlby0+YWR2YW5jZWRfSU5UUkEpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBpZiAoIUJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+YWNQcmVkRmxhZ1ttYm51bV0gPSAwOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmFjUHJlZEZsYWdbbWJudW1dID0gMTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+bWJsb2NrLT5kaXJlY3Rpb24gPSAwOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5tYmxvY2stPmRpcmVjdGlvbiA9IDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmFjUHJlZEZsYWdbbWJudW1dID0gMDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSNlbHNlCi0gICAgICAgIGlmICgoTUJ0eXBlICYgSU5UUkFfTUFTSykgJiYgIXZpZGVvLT5zaG9ydFZpZGVvSGVhZGVyKQotICAgICAgICB7Ci0gICAgICAgICAgICB2aWRlby0+YWNQcmVkRmxhZ1ttYm51bV0gPSAodWludDgpIEJpdHN0cmVhbVJlYWQxQml0c19JTkxJTkUoc3RyZWFtKTsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIHZpZGVvLT5hY1ByZWRGbGFnW21ibnVtXSA9IDA7Ci0gICAgICAgIH0KLSNlbmRpZgotICAgICAgICBDQlBZID0gUFZfVmxjRGVjQ0JQWShzdHJlYW0sIE1CdHlwZSAmIElOVFJBX01BU0spOyAvKiBJTlRSQSB8fCBJTlRSQV9RICovCi0gICAgICAgIGlmIChDQlBZIDwgMCkKLSAgICAgICAgewotICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgIH0KLQotICAgICAgICAvLyBHVyAwNC8yMy85OQotICAgICAgICB2aWRlby0+aGVhZGVySW5mby5DQlBbbWJudW1dID0gKHVpbnQ4KShDQlBZIDw8IDIgfCAoQ0JQQyAmIDMpKTsKLSNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKLSAgICAgICAgaWYgKE1CdHlwZSAmIFFfTUFTSykKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKCF2aWRlby0+bW9kaWZpZWRfcXVhbnQpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgRFFVQU5UID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDIpOwotICAgICAgICAgICAgICAgICpRUCArPSBEUV90YWJbRFFVQU5UXTsKLQotICAgICAgICAgICAgICAgIGlmICgqUVAgPCAxKSAqUVAgPSAxOwotICAgICAgICAgICAgICAgIGVsc2UgaWYgKCpRUCA+IDMxKSAqUVAgPSAzMTsKLSAgICAgICAgICAgICAgICB2aWRlby0+UVBfQ0hSID0gKlFQOyAgLyogQU5ORVhfVCAqLwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgKlFQICs9IERRX3RhYl9Bbm5leF9UXzExWypRUF07Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAqUVAgKz0gRFFfdGFiX0FubmV4X1RfMTBbKlFQXTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAoKlFQIDwgMSkgKlFQID0gMTsKLSAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoKlFQID4gMzEpICpRUCA9IDMxOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAqUVAgPSAoaW50MTYpQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB2aWRlby0+UVBfQ0hSID0gIE1RX2Nocm9tYV9RUF90YWJsZVsqUVBdOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0jZWxzZQotICAgICAgICBpZiAoTUJ0eXBlICYgUV9NQVNLKQotICAgICAgICB7Ci0gICAgICAgICAgICBEUVVBTlQgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMik7Ci0gICAgICAgICAgICAqUVAgKz0gRFFfdGFiW0RRVUFOVF07Ci0KLSAgICAgICAgICAgIGlmICgqUVAgPCAxKSAqUVAgPSAxOwotICAgICAgICAgICAgZWxzZSBpZiAoKlFQID4gMzEpICpRUCA9IDMxOwotICAgICAgICB9Ci0jZW5kaWYKLSAgICB9Ci0gICAgcmV0dXJuIFBWX1NVQ0NFU1M7Ci19Ci0KLQotCi0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEJlZ2luKioqKioqCi0qICAgICAgIDMvMTAvMDAgIDogaW5pdGlhbCBtb2RpZmljYXRpb24gdG8gdGhlCi0qICAgICAgICAgICAgICAgIG5ldyBQVi1EZWNvZGVyIExpYiBmb3JtYXQuCi0qICAgICAgIDQvMi8yMDAwIDogQ2xlYW51cCBhbmQgZXJyb3ItaGFuZGxpbmcgbW9kaWZpY2F0aW9uLiAgVGhpcwotKiAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoYXMgYmVlbiBkaXZpZGVkIGludG8gc2V2ZXJhbCBzdWItZnVuY3Rpb25zIGZvcgotKiAgICAgICAgICAgICAgICAgICBiZXR0ZXIgY29kaW5nIHN0eWxlIGFuZCBtYWludGFpbmFuY2UgcmVhc29uLiAgSSBhbHNvCi0qICAgICAgICAgICAgICAgICAgIGdyZWF0bHkgc2hydW5rIHRoZSBjb2RlIHNpemUgaGVyZS4KLSogICAgICAgOS8xOC8yMDAwIDogVmxjRGVjb2RlK0RlcXVhbnQgb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by0+c2hvcnRWaWRlb0hlYWRlcikKLSAgICAgICAgICAgIHsKLSNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKLSAgICAgICAgICAgICAgICBpZiAoIXZpZGVvLT5hZHZhbmNlZF9JTlRSQSkKLSAgICAgICAgICAgICAgICB7Ci0jZW5kaWYKLSAgICAgICAgICAgICAgICAgICAgRENfY29lZmYgPSAoaW50MTYpIEJpdHN0cmVhbVJlYWRCaXRzMTZfSU5MSU5FKHN0cmVhbSwgOCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKChEQ19jb2VmZiAmIDB4N2YpID09IDApIC8qIDEyOCAmIDAgICovCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIGN1cnJlbnRseSB3ZSB3aWxsIG9ubHkgc2lnbmFsIEZBSUwgZm9yIDEyOC4gV2Ugd2lsbCBpZ25vcmUgdGhlIDAgY2FzZSAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChEQ19jb2VmZiA9PSAxMjgpCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKERDX2NvZWZmID09IDI1NSkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgRENfY29lZmYgPSAxMjg7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZGF0YUJsb2NrWzBdID0gKGludDE2KSBEQ19jb2VmZjsKLSNpZmRlZiBQVl9BTk5FWF9JSktUX1NVUFBPUlQKLSAgICAgICAgICAgICAgICB9Ci0jZW5kaWYKLSAgICAgICAgICAgICAgICBuY29lZmZzW2NvbXBdID0gVmxjRGVxdWFudEgyNjNJbnRyYUJsb2NrX1NIKHZpZGVvLCBjb21wLCBtYmxvY2stPmJpdG1hcGNvbFtjb21wXSwgJm1ibG9jay0+Yml0bWFwcm93W2NvbXBdKTsKLQotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmIChzd2l0Y2hlZCA9PSAwKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRGVjb2RlUHJlZGljdGVkSW50cmFEQyhjb21wLCBzdHJlYW0sICZEQ19jb2VmZik7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIFBWX0ZBSUw7Ci0KLSAgICAgICAgICAgICAgICAgICAgZGF0YUJsb2NrWzBdID0gKGludDE2KSBEQ19jb2VmZjsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbmNvZWZmc1tjb21wXSA9IFZsY0RlcXVhbnRIMjYzSW50cmFCbG9jayh2aWRlbywgY29tcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoZWQsIG1ibG9jay0+Yml0bWFwY29sW2NvbXBdLCAmbWJsb2NrLT5iaXRtYXByb3dbY29tcF0pOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoVkxDX0VSUk9SX0RFVEVDVEVEKG5jb2VmZnNbY29tcF0pKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmIChzd2l0Y2hlZCkKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgbmNvZWZmc1tjb21wXSA9IDE7Ci0gICAgICAgICAgICAgICAgICAgIG9zY2xfbWVtc2V0KChkYXRhQmxvY2sgKyAxKSwgMCwgc2l6ZW9mKGludDE2KSo2Myk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgbm9fY29lZmZbY29tcF0gPSBuY29lZmZzW2NvbXBdOwotCi0jaWZkZWYgUFZfUE9TVFBST0NfT04KLSAgICAgICAgICAgIGlmICh2aWRlby0+cG9zdEZpbHRlclR5cGUgIT0gUFZfTk9fUE9TVF9QUk9DKQotICAgICAgICAgICAgICAgICpwcF9tb2RbY29tcF0gPSAodWludDgpIFBvc3RQcm9jU2VtYXBob3JlKGRhdGFCbG9jayk7Ci0jZW5kaWYKLSAgICAgICAgfQotICAgICAgICBNQmxvY2tJRENUKHZpZGVvKTsKLSAgICB9Ci0gICAgZWxzZSAgICAgIC8qIElOVEVSIG1vZGVzICovCi0gICAgeyAgIC8qICBtb3ZlZCBpdCBoZXJlIEF1ZyAxNSwgMjAwNSAqLwotICAgICAgICAvKiBkZWNvZGUgdGhlIG1vdGlvbiB2ZWN0b3IgKGlmIHRoZXJlIGFyZSBhbnkpICovCi0gICAgICAgIHN0YXR1cyA9IFBWX0dldE1CdmVjdG9ycyh2aWRlbywgbW9kZSk7Ci0gICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykKLSAgICAgICAgewotICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgfQotCi0KLSAgICAgICAgTUJNb3Rpb25Db21wKHZpZGVvLCBDQlApOwotICAgICAgICBjX2NvbXAgID0gdmlkZW8tPmN1cnJWb3AtPnlDaGFuICsgb2Zmc2V0OwotCi0jaWZkZWYgUFZfQU5ORVhfSUpLVF9TVVBQT1JUCi0gICAgICAgIGZvciAoY29tcCA9IDA7IGNvbXAgPCA0OyBjb21wKyspCi0gICAgICAgIHsKLSAgICAgICAgICAgICgqREMpW2NvbXBdID0gbWlkX2dyYXk7Ci0gICAgICAgICAgICBpZiAoQ0JQICYgKDEgPDwgKDUgLSBjb21wKSkpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgbmNvZWZmc1tjb21wXSA9IFZsY0RlcXVhbnRIMjYzSW50ZXJCbG9jayh2aWRlbywgY29tcCwgbWJsb2NrLT5iaXRtYXBjb2xbY29tcF0sICZtYmxvY2stPmJpdG1hcHJvd1tjb21wXSk7Ci0gICAgICAgICAgICAgICAgaWYgKFZMQ19FUlJPUl9ERVRFQ1RFRChuY29lZmZzW2NvbXBdKSkgcmV0dXJuIFBWX0ZBSUw7Ci0KLSAgICAgICAgICAgICAgICBCbG9ja0lEQ1QoY19jb21wICsgKGNvbXAmMikqKHdpZHRoIDw8IDIpICsgOCooY29tcCYxKSwgbWJsb2NrLT5wcmVkX2Jsb2NrICsgKGNvbXAmMikqNjQgKyA4Kihjb21wJjEpLCBtYmxvY2stPmJsb2NrW2NvbXBdLCB3aWR0aCwgbmNvZWZmc1tjb21wXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWJsb2NrLT5iaXRtYXBjb2xbY29tcF0sIG1ibG9jay0+Yml0bWFwcm93W2NvbXBdKTsKLQotI2lmZGVmIFBWX1BPU1RQUk9DX09OCi0gICAgICAgICAgICAgICAgLyogZm9yIGludGVyIGp1c3QgdGVzdCBmb3IgcmluZ2luZyAqLwotICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cG9zdEZpbHRlclR5cGUgIT0gUFZfTk9fUE9TVF9QUk9DKQotICAgICAgICAgICAgICAgICAgICAqcHBfbW9kW2NvbXBdID0gKHVpbnQ4KSgobmNvZWZmc1tjb21wXSA+IDMpID8gNCA6IDApOwotI2VuZGlmCi0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLyogbm8gSURD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ZXN0IGZvciByaW5naW5nICovCi0gICAgICAgICAgICBpZiAodmlkZW8tPnBvc3RGaWx0ZXJUeXBlICE9IFBWX05PX1BPU1RfUFJPQykKLSAgICAgICAgICAgICAgICAqcHBfbW9kWzRdID0gKHVpbnQ4KSgobmNvZWZmc1s0XSA+IDMpID8gNCA6IDApOwotI2VuZGlmCi0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBubyBJRENUIGZvciBhbGwgemVyb3MgYmxvY2tzICAwMy8yOC8yMDAyICovCi0gICAgICAgICAgICAvKiAgICAgICAgICAgICAgQmxvY2tJRENUKCk7ICAgICAgICAgICAgICAgICovCi0jaWZkZWYgUFZfUE9TVFBST0NfT04KLSAgICAgICAgICAgIGlmICh2aWRlby0+cG9zdEZpbHRlclR5cGUgIT0gUFZfTk9fUE9TVF9QUk9DKQotICAgICAgICAgICAgICAgICpwcF9tb2RbNF0gPSAwOwotI2VuZGlmCi0gICAgICAgIH0KLSAgICAgICAgKCpEQylbNV0gPSBtaWRfZ3JheTsKLSAgICAgICAgaWYgKENCUCAmIDEpCi0gICAgICAgIHsKLSAgICAgICAgICAgIG5jb2VmZnNbNV0gPSBWbGNEZXF1YW50SDI2M0ludGVyQmxvY2sodmlkZW8sIDUsIG1ibG9jay0+Yml0bWFwY29sWzVdLCAmbWJsb2NrLT5iaXRtYXByb3dbNV0pOwotICAgICAgICAgICAgaWYgKFZMQ19FUlJPUl9ERVRFQ1RFRChuY29lZmZzWzVdKSkgcmV0dXJuIFBWX0ZBSUw7Ci0KLSAgICAgICAgICAgIEJsb2NrSURDVCh2aWRlby0+Y3VyclZvcC0+dkNoYW4gKyAob2Zmc2V0ID4+IDIpICsgKHhfcG9zIDw8IDIpLCBtYmxvY2stPnByZWRfYmxvY2sgKyAyNjQsIG1ibG9jay0+YmxvY2tbNV0sIHdpZHRoID4+IDEsIG5jb2VmZnNbNV0sCi0gICAgICAgICAgICAgICAgICAgICAgbWJsb2NrLT5iaXRtYXBjb2xbNV0sIG1ibG9jay0+Yml0bWFwcm93WzVdKTsKLQotI2lmZGVmIFBWX1BPU1RQUk9DX09OCi0gICAgICAgICAgICAvKiBmb3IgaW50ZXIganVzdCB0ZXN0IGZvciByaW5naW5nICovCi0gICAgICAgICAgICBpZiAodmlkZW8tPnBvc3RGaWx0ZXJUeXBlICE9IFBWX05PX1BPU1RfUFJPQykKLSAgICAgICAgICAgICAgICAqcHBfbW9kWzVdID0gKHVpbnQ4KSgobmNvZWZmc1s1XSA+IDMpID8gNCA6IDApOwotI2VuZGlmCi0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBubyBJRENUIGZvciBhbGwgemVyb3MgYmxvY2tzICAwMy8yOC8yMDAyICovCi0gICAgICAgICAgICAvKiAgICAgICAgICAgICAgQmxvY2tJRENUKCk7ICAgICAgICAgICAgICAgICovCi0jaWZkZWYgUFZfUE9TVFBST0NfT04KLSAgICAgICAgICAgIGlmICh2aWRlby0+cG9zdEZpbHRlclR5cGUgIT0gUFZfTk9fUE9TVF9QUk9DKQotICAgICAgICAgICAgICAgICpwcF9tb2RbNV0gPSAwOwotI2VuZGlmCi0gICAgICAgIH0KLSAgICAgICAgdmlkZW8tPlFQTUJbbWJudW1dID0gUVA7ICAvKiByZXN0b3JlIHRoZSBRUCB2YWx1ZXMgIEFOTkVYX1QqLwotI2Vsc2UKLSAgICAgICAgZm9yIChjb21wID0gMDsgY29tcCA8IDQ7IGNvbXArKykKLSAgICAgICAgewotICAgICAgICAgICAgKCpEQylbY29tcF0gPSBtaWRfZ3JheTsKLSAgICAgICAgICAgIGlmIChDQlAgJiAoMSA8PCAoNSAtIGNvbXApKSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBuY29lZmZzW2NvbXBdID0gVmxjRGVxdWFudEgyNjNJbnRlckJsb2NrKHZpZGVvLCBjb21wLCBtYmxvY2stPmJpdG1hcGNvbFtjb21wXSwgJm1ibG9jay0+Yml0bWFwcm93W2NvbXBdKTsKLSAgICAgICAgICAgICAgICBpZiAoVkxDX0VSUk9SX0RFVEVDVEVEKG5jb2VmZnNbY29tcF0pKSByZXR1cm4gUFZfRkFJTDsKLQotICAgICAgICAgICAgICAgIEJsb2NrSURDVChjX2NvbXAgKyAoY29tcCYyKSood2lkdGggPDwgMikgKyA4Kihjb21wJjEpLCBtYmxvY2stPnByZWRfYmxvY2sgKyAoY29tcCYyKSo2NCArIDgqKGNvbXAmMSksIG1ibG9jay0+YmxvY2tbY29tcF0sIHdpZHRoLCBuY29lZmZzW2NvbXBdLAotICAgICAgICAgICAgICAgICAgICAgICAgICBtYmxvY2stPmJpdG1hcGNvbFtjb21wXSwgbWJsb2NrLT5iaXRtYXByb3dbY29tcF0pOwotCi0jaWZkZWYgUFZfUE9TVFBST0NfT04KLSAgICAgICAgICAgICAgICAvKiBmb3IgaW50ZXIganVzdCB0ZXN0IGZvciByaW5naW5nICovCi0gICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5wb3N0RmlsdGVyVHlwZSAhPSBQVl9OT19QT1NUX1BST0MpCi0gICAgICAgICAgICAgICAgICAgICpwcF9tb2RbY29tcF0gPSAodWludDgpKChuY29lZmZzW2NvbXBdID4gMykgPyA0IDogMCk7Ci0jZW5kaWYKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAvKiBubyBJRENUIGZvciBhbGwgemVyb3MgYmxvY2tzICAwMy8yOC8yMDAyICovCi0gICAgICAgICAgICAgICAgLyogICAgICAgICAgICAgIEJsb2NrSURDVCgpOyAgICAgICAgICAgICAgICAqLwotI2lmZGVmIFBWX1BPU1RQUk9DX09OCi0gICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5wb3N0RmlsdGVyVHlwZSAhPSBQVl9OT19QT1NUX1BST0MpCi0gICAgICAgICAgICAgICAgICAgICpwcF9tb2RbY29tcF0gPSAwOwotI2VuZGlmCi0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICAoKkRDKVs0XSA9IG1pZF9ncmF5OwotICAgICAgICBpZiAoQ0JQICYgMikKLSAgICAgICAgewotICAgICAgICAgICAgbmNvZWZmc1s0XSA9IFZsY0RlcXVhbnRIMjYzSW50ZXJCbG9jayh2aWRlbywgNCwgbWJsb2NrLT5iaXRtYXBjb2xbNF0sICZtYmxvY2stPmJpdG1hcHJvd1s0XSk7Ci0gICAgICAgICAgICBpZiAoVkxDX0VSUk9SX0RFVEVDVEVEKG5jb2VmZnNbNF0pKSByZXR1cm4gUFZfRkFJTDsKLQotICAgICAgICAgICAgQmxvY2tJRENUKHZpZGVvLT5jdXJyVm9wLT51Q2hhbiArIChvZmZzZXQgPj4gMikgKyAoeF9wb3MgPDwgMiksIG1ibG9jay0+cHJlZF9ibG9jayArIDI1NiwgbWJsb2NrLT5ibG9ja1s0XSwgd2lkdGggPj4gMSwgbmNvZWZmc1s0XSwKLSAgICAgICAgICAgICAgICAgICAgICBtYmxvY2stPmJpdG1hcGNvbFs0XSwgbWJsb2NrLT5iaXRtYXByb3dbNF0pOwotCi0jaWZkZWYgUFZfUE9TVFBST0NfT04KLSAgICAgICAgICAgIC8qIGZvciBpbnRlciBqdXN0IHRlc3QgZm9yIHJpbmdpbmcgKi8KLSAgICAgICAgICAgIGlmICh2aWRlby0+cG9zdEZpbHRlclR5cGUgIT0gUFZfTk9fUE9TVF9QUk9DKQotICAgICAgICAgICAgICAgICpwcF9tb2RbNF0gPSAodWludDgpKChuY29lZmZzWzRdID4gMykgPyA0IDogMCk7Ci0jZW5kaWYKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qIG5vIElEQ1QgZm9yIGFsbCB6ZXJvcyBibG9ja3MgIDAzLzI4LzIwMDIgKi8KLSAgICAgICAgICAgIC8qICAgICAgICAgICAgICBCbG9ja0lEQ1QoKTsgICAgICAgICAgICAgICA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W5jbHVkZSAiaWRjdC5oIgotCi0jZGVmaW5lIE9TQ0xfRElTQUJMRV9XQVJOSU5HX0NPTkRJVElPTkFMX0lTX0NPTlNUQU5UCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IERlY29kZUZyYW1lRGF0YVBhcnRNb2RlKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogRGVjb2RlIGEgZnJhbWUgb2YgTVBFRzQgYml0c3RyZWFtIGluIGRhdGFwYXJ0aXRpb25pbmcgbW9kZS4gICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgMDQvMjUvMjAwMCA6IFJld3JpdGUgdGhlIGRhdGEgcGFydGl0aW9uaW5nIHBhdGggY29tcGxldGVseSAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgYWNjb3JkaW5nIHRvIHRoZSBwc2V1ZG8gY29kZXMgaW4gTVBFRy00ICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFuZGFyZC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAwOS8xOC8yMDAwIGFkZCBmYXN0IFZsY0RlY29kZStEZXF1YW50ICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgMDQvMTcvMjAwMSBjbGVhbnVwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotUFZfU1RBVFVTIERlY29kZUZyYW1lRGF0YVBhcnRNb2RlKFZpZGVvRGVjRGF0YSAqdmlkZW8pCi17Ci0gICAgUFZfU1RBVFVTIHN0YXR1czsKLSAgICBWb3AgKmN1cnJWb3AgPSB2aWRlby0+Y3VyclZvcDsKLSAgICBCaXRzdHJlYW1EZWNWaWRlbyAqc3RyZWFtID0gdmlkZW8tPmJpdHN0cmVhbTsKLQotICAgIGludCBuTUJQZXJSb3cgPSB2aWRlby0+bk1CUGVyUm93OwotCi0gICAgaW50IHZvcFR5cGUgPSBjdXJyVm9wLT5wcmVkaWN0aW9uVHlwZTsKLSAgICBpbnQgbWJudW07Ci0gICAgaW50IG5Ub3RhbE1CID0gdmlkZW8tPm5Ub3RhbE1COwotICAgIGludCBzbGljZV9jb3VudGVyOwotICAgIGludCByZXN5bmNfbWFya2VyX2xlbmd0aDsKLQotICAgIC8qIGNvcHkgYW5kIHBhZCB0byBwcmV2X1ZvcCBmb3IgSU5URVIgY29kaW5nICovCi0gICAgc3dpdGNoICh2b3BUeXBlKQotICAgIHsKLSAgICAgICAgY2FzZSBJX1ZPUCA6Ci0vLyAgICAgIG9zY2xfbWVtc2V0KE1vZGUsIE1PREVfSU5UUkEsIHNpemVvZih1aW50OCkqblRvdGFsTUIpOwotICAgICAgICAgICAgcmVzeW5jX21hcmtlcl9sZW5ndGggPSAxNzsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIFBfVk9QIDoKLSAgICAgICAgICAgIG9zY2xfbWVtc2V0KHZpZGVvLT5tb3RYLCAwLCBzaXplb2YoTU9UK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B2aWRlby0+bWJudW1fcm93ICogbk1CUGVyUm93OwotCi0gICAgICAgIHN3aXRjaCAodm9wVHlwZSkKLSAgICAgICAgewotICAgICAgICAgICAgY2FzZSBJX1ZPUCA6Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gRGVjb2RlRGF0YVBhcnRfSV9WaWRlb1BhY2tldCh2aWRlbywgc2xpY2VfY291bnRlcik7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgUF9WT1AgOgotICAgICAgICAgICAgICAgIHN0YXR1cyA9IERlY29kZURhdGFQYXJ0X1BfVmlkZW9QYWNrZXQodmlkZW8sIHNsaWNlX2NvdW50ZXIpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICBkZWZhdWx0IDoKLSAgICAgICAgICAgICAgICBtcDRkZWNfbG9nKCJEZWNvZGVGcmFtZURhdGFQYXJ0TW9kZSgpOiBWb3AgdHlwZSBub3Qgc3VwcG9ydGVkLlxuIik7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgIH0KLQotICAgICAgICB3aGlsZSAoKHN0YXR1cyA9IFBWX1JlYWRWaWRlb1BhY2tldEhlYWRlcih2aWRlbywgJm1ibnVtKSkgPT0gUFZfRkFJTCkKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKChzdGF0dXMgPSBxdWlja1NlYXJjaFZpZGVvUGFja2V0SGVhZGVyKHN0cmVhbSwgcmVzeW5jX21hcmtlcl9sZW5ndGgpKSAhPSBQVl9TVUNDRVNTKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHN0YXR1cyA9PSBQVl9FTkRfT0ZfVk9QKQotICAgICAgICB7Ci0gICAgICAgICAgICBtYm51bSA9IG5Ub3RhbE1COwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKG1ibnVtID4gdmlkZW8tPm1ibnVtICsgMSkKLSAgICAgICAgewotICAgICAgICAgICAgQ29uY2VhbFBhY2tldCh2aWRlbywgdmlkZW8tPm1ibnVtLCBtYm51bSwgc2xpY2VfY291bnRlcik7Ci0gICAgICAgIH0KLSAgICAgICAgc2xpY2VfY291bnRlcisrOwotICAgICAgICBpZiAobWJudW0gPj0gblRvdGFsTUIpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0KLQotICAgIH0KLSAgICB3aGlsZSAoVFJVRSk7Ci0KLSAgICByZXR1cm4gUFZfU1VDQ0VTUzsKLX0KLQotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IERlY29kZURhdGFQYXJ0X0lfVmlkZW9QYWNrZXQoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMDQvMjUvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiBEZWNvZGUgRGF0YSBQYXJ0aXRpb25lZCBNb2RlIFZpZGVvIFBhY2tldCBpbiBJLVZPUCAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogUFZfU1VDQ0VTUyBpZiBzdWNjZXNzZWQsIFBWX0ZBSUwgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAwOS8xOC8yMDAwIGFkZCBmYXN0IFZsY0RlY29kZStEZXF1YW50ICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgMDQvMDEvMjAwMSBmaXhlZCBNQl9zdHVmZmluZywgcmVtb3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doaWxlIChjb2RlID09IDEpCi0gICAgewotICAgICAgICBQVl9CaXRzdHJlYW1GbHVzaEJpdHMoc3RyZWFtLCA5KTsKLSAgICAgICAgQml0c3RyZWFtU2hvd0JpdHMxNihzdHJlYW0sIDksICZjb2RlKTsKLSAgICB9Ci0KLSAgICBkbwotICAgIHsKLSAgICAgICAgLyogZGVjb2RlIENPRCwgTUNCUEMsIEFDcHJlZF9mbGFnLCBDUEJZIGFuZCBEUVVBTlQgKi8KLSAgICAgICAgTUNCUEMgPSBQVl9WbGNEZWNNQ0JQQ19jb21faW50cmEoc3RyZWFtKTsKLQotICAgICAgICBpZiAoIVZMQ19FUlJPUl9ERVRFQ1RFRChNQ0JQQykpCi0gICAgICAgIHsKLSAgICAgICAgICAgIE1vZGVbbWJudW1dID0gKHVpbnQ4KShNQnR5cGUgPSBNQnR5cGVfbW9kZVtNQ0JQQyAmIDddKTsKLSAgICAgICAgICAgIHZpZGVvLT5oZWFkZXJJbmZvLkNCUFttYm51bV0gPSAodWludDgpKChNQ0JQQyA+PiA0KSAmIDMpOwotICAgICAgICAgICAgc3RhdHVzID0gR2V0TUJoZWFkZXJEYXRhUGFydF9EUVVBTlRfREModmlkZW8sICZRUCk7Ci0gICAgICAgICAgICB2aWRlby0+dXNlUHJldlFQID0gMTsgICAgICAgIC8qIHNldCBpdCBhZnRlciB0aGUgZmlyc3QgY29kZWQgTUIgICAgICAwNC8yNy8wMSAqLwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgLyogUmVwb3J0IHRoZSBlcnJvciB0byB0aGUgYXBwbGljYXRpb24uICAgMDYvMjAvMjAwMCAqLwotICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7Ci0gICAgICAgICAgICB2aWRlby0+bWJudW0gPSBtYl9zdGFydDsKLSAgICAgICAgICAgIG1vdmVQb2ludGVyVG8oc3RyZWFtLCBzdGFydEZpcnN0UGFydCk7Ci0gICAgICAgICAgICByZXR1cm4gUFZfRkFJTDsKLSAgICAgICAgfQotCi0gICAgICAgIHZpZGVvLT5zbGljZU5vW21ibnVtXSA9ICh1aW50OCkgc2xpY2VfY291bnRlcjsKLSAgICAgICAgUVBNQlttYm51bV0gPSBRUDsKLSAgICAgICAgdmlkZW8tPm1ibnVtID0gKyttYm51bTsKLQotICAgICAgICBCaXRzdHJlYW1TaG93Qml0czE2KHN0cmVhbSwgOSwgJmNvZGUpOwotICAgICAgICB3aGlsZSAoY29kZSA9PSAxKQotICAgICAgICB7Ci0gICAgICAgICAgICBQVl9CaXRzdHJlYW1GbHVzaEJpdHMoc3RyZWFtLCA5KTsKLSAgICAgICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMTYoc3RyZWFtLCA5LCAmY29kZSk7Ci0gICAgICAgIH0KLSAgICAgICAgLyogaGF2ZSB3ZSByZWFjaGVkIHRoZSBlbmQgb2YgdGhlIHZpZGVvIHBhY2tldCBvciB2b3A/ICovCi0gICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVNob3dCaXRzMzIoc3RyZWFtLCBEQ19NQVJLRVJfTEVOR1RILCAmdG1wdmFyKTsKLQotICAgIH0KLSAgICB3aGlsZSAodG1wdmFyICE9IERDX01BUktFUiAmJiB2aWRlby0+bWJudW0gPCBuVG90YWxNQik7Ci0KLSAgICBpZiAodG1wdmFyID09IERDX01BUktFUikKLSAgICB7Ci0gICAgICAgIFBWX0JpdHN0cmVhbUZsdXNoQml0cyhzdHJlYW0sIERDX01BUktFUl9MRU5HVEgpOwotICAgIH0KLSAgICBlbHNlCi0gICAgewotICAgICAgICBzdGF0dXMgPSBxdWlja1NlYXJjaERDTShzdHJlYW0pOwotICAgICAgICBpZiAoc3RhdHVzID09IFBWX1NVQ0NFU1MpCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qIG9ubHkgd2F5IHlvdSBjYW4gZW5kIHVwIGJlaW5nIGhlcmUgaXMgaW4gdGhlIGxhc3QgcG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aWNlX2NvdW50ZXIpOwotICAgICAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgfQotICAgICAgICB2aWRlby0+dXNlUHJldlFQID0gMTsgICAgICAgICAgIC8qICAwNC8yNy8wMSBzaG91bGQgYmUgc2V0IGFmdGVyIGRlY29kaW5nIGZpcnN0IE1CICovCi0gICAgfQotCi0gICAgdmFsaWRfc3R1ZmZpbmcgPSB2YWxpZFN0dWZmaW5nKHN0cmVhbSk7Ci0gICAgaWYgKCF2YWxpZF9zdHVmZmluZykKLSAgICB7Ci0gICAgICAgIFZpZGVvRGVjb2RlckVycm9yRGV0ZWN0ZWQodmlkZW8pOwotICAgICAgICBtb3ZlUG9pbnRlclRvKHN0cmVhbSwgc3RhcnRTZWNvbmRQYXJ0KTsKLSAgICAgICAgQ29uY2VhbFRleHR1cmVfSSh2aWRlbywgc3RhcnRGaXJzdFBhcnQsIG1iX3N0YXJ0LCBtYl9lbmQsIHNsaWNlX2NvdW50ZXIpOwotICAgICAgICByZXR1cm4gUFZfRkFJTDsKLSAgICB9Ci0gICAgcmV0dXJuIFBWX1NVQ0NFU1M7Ci19Ci0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBEZWNvZGVEYXRhUGFydF9QX1ZpZGVvUGFja2V0KCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA0LzI1LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogRGVjb2RlIERhdGEgUGFydGl0aW9uZWQgTW9kZSBWaWRlbyBQYWNrZXQgaW4gUC1WT1AgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IFBWX1NVQ0NFU1MgaWYgc3VjY2Vzc2VkLCBQVl9GQUlMIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAwOS8xOC8yMDAwLCAgZmFzdCBWbGNEZWNvZGUrRGVxdWFudCAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgMDQvMTMvMjAwMSwgIGZpeGVkIE1CX3N0dWZmaW5nLCBuZXcgQUNEQyBwcmVkIHN0cnVjdHVyZSwgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFudXAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAwOC8wNy8yMDAxLCAgcmVtb3ZlIE1CemVybyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLVBWX1NUQVRVUyBEZWNvZGVEYXRhUGFydF9QX1ZpZGVvUGFja2V0KFZpZGVvRGVjRGF0YSAqdmlkZW8sIGludCBzbGljZV9jb3VudGVyKQotewotICAgIFBWX1NUQVRVUyBzdGF0dXM7Ci0gICAgdWludDggKk1vZGUgPSB2aWRlby0+aGVhZGVySW5mby5Nb2RlOwotICAgIEJpdHN0cmVhbURlY1ZpZGVvICpzdHJlYW0gPSB2aWRlby0+Yml0c3RyZWFtOwotICAgIGludCBuVG90YWxNQiA9IHZpZGVvLT5uVG90YWxNQjsKLSAgICBpbnQgbWJudW0sIG1iX3N0YXJ0LCBtYl9lbmQ7Ci0gICAgaW50MTYgUVAsICpRUE1CID0gdmlkZW8tPlFQTUI7Ci0gICAgaW50IE1CdHlwZSwgQ0JQWTsKLSAgICBCb29sIHZhbGlkX3N0dWZmaW5nOwotICAgIGludCBpbnRyYV9NQjsKL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ludHJhX01CKTsKLSAgICAgICAgaWYgKENCUFkgPCAwKQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBSZXBvcnQgdGhlIGVycm9yIHRvIHRoZSBhcHBsaWNhdGlvbi4gICAwNi8yMC8yMDAwICovCi0gICAgICAgICAgICBWaWRlb0RlY29kZXJFcnJvckRldGVjdGVkKHZpZGVvKTsKLSAgICAgICAgICAgIC8qIENvbmNlYWwgc2Vjb25kIHBhcnRpdGlvbiwgIDUvMTUvMjAwMCAqLwotICAgICAgICAgICAgbW92ZVBvaW50ZXJUbyhzdHJlYW0sIHN0YXJ0U2Vjb25kUGFydCk7Ci0gICAgICAgICAgICBDb25jZWFsVGV4dHVyZV9QKHZpZGVvLCBtYl9zdGFydCwgbWJfZW5kLCBzbGljZV9jb3VudGVyKTsKLSAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOwotICAgICAgICB9Ci0KLSAgICAgICAgdmlkZW8tPmhlYWRlckluZm8uQ0JQW21ibnVtXSB8PSAodWludDgpKENCUFkgPDwgMik7Ci0gICAgICAgIGlmIChpbnRyYV9NQiB8fCBNQnR5cGUgPT0gTU9ERV9JTlRFUl9RKSAgICAgICAgICAgICAgICAgICAgIC8qICAwNC8yNi8wMSAqLwotICAgICAgICB7Ci0gICAgICAgICAgICBzdGF0dXMgPSBHZXRNQmhlYWRlckRhdGFQYXJ0X0RRVUFOVF9EQyh2aWRlbywgJlFQKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIHN0YXR1czsKLSAgICAgICAgfQotICAgICAgICB2aWRlby0+dXNlUHJldlFQID0gMTsgICAgICAgIC8qICAwNC8yNy8wMSAqLwotICAgICAgICBRUE1CW21ibnVtXSA9IFFQOwotICAgIH0KLQotICAgIHZpZGVvLT51c2VQcmV2UVAgPSAwOyAgLyogIDA0LzI3LzAxICovCi0KLSAgICBmb3IgKG1ibnVtID0gbWJfc3RhcnQ7IG1ibnVtIDwgbWJfZW5kOyBtYm51bSsrKQotICAgIHsKLSAgICAgICAgdmlkZW8tPm1ibnVtID0gbWJudW07Ci0gICAgICAgIHZpZGVvLT5tYm51bV9yb3cgPSBQVl9HRVRfUk9XKG1ibnVtLCBuTUJQZXJSb3cpOyAgLyogIFRoaXMgaXMgbmVlZGVkIGlmIG5ibnVtIGlzIHJlYWQgZnJvbSB0aGUgcGFja2V0IGhlYWRlciAqLwotICAgICAgICB2aWRlby0+bWJudW1fY29sID0gbWJudW0gLSB2aWRlby0+bWJudW1fcm93ICogbk1CUGVyUm93OwotCi0KLSAgICAgICAgaWYgKE1vZGVbbWJudW1dICE9IE1PREVfU0tJUFBFRCkKLSAgICAgICAgewotICAgICAgICAgICAgLyogZGVjb2RlIHRoZSBEQ1QgY29lZmljaWVudHMgZm9yIHRoZSBNQiAqLwotICAgICAgICAgICAgc3RhdHVzID0gR2V0TUJEYXRhX0RhdGFQYXJ0KHZpZGVvKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAvKiBSZXBvcnQgdGhlIGVycm9yIHRvIHRoZSBhcHBsaWNhdGlvbi4gICAwNi8yMC8yMDAwICovCi0gICAgICAgICAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7Ci0KLSAgICAgICAgICAgICAgICAvKiBDb25jZWFsIHNlY29uZCBwYXJ0aXRpb24sICA1LzE1LzIwMDAgKi8KLSAgICAgICAgICAgICAgICBtb3ZlUG9pbnRlclRvKHN0cmVhbSwgc3RhcnRTZWNvbmRQYXJ0KTsKLSAgICAgICAgICAgICAgICBDb25jZWFsVGV4dHVyZV9QKHZpZGVvLCBtYl9zdGFydCwgbWJfZW5kLCBzbGljZV9jb3VudGVyKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdmlkZW8tPnVzZVByZXZRUCA9IDE7ICAvKiAgMDQvMjcvMDEgKi8KLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsgICAvLyBTS0lQUEVECi0KLSAgICAgICAgICAgIC8qIE1vdGlvbiBjb21wZW5zYXRpb24gYW5kIHB1dCBpdCB0byB2aWRlby0+bWJsb2NrLT5wcmVkX2Jsb2NrICovCi0gICAgICAgICAgICBTa2lwcGVkTUJNb3Rpb25Db21wKHZpZGVvKTsKLQotICAgICAgICAgICAgLy9vc2NsX21lbXNldCh2aWRlby0+cHJlZERDQUNfcm93ICsgdmlkZW8tPm1ibnVtX2NvbCwgMCwgc2l6ZW9mKHR5cGVEQ0FDU3RvcmUpKTsgLyogIFNLSVBQRURfQUNEQyAqLwotICAgICAgICAgICAgLy9vc2NsX21lbXNldCh2aWRlby0+cHJlZERDQUNfY29sLCAwLCBzaXplb2YodHlwZURDQUNTdG9yZSkpOwotICAgICAgICAgICAgLyogIDA4LzA4LzIwMDUgKi8KLSAgICAgICAgICAgIHBieXRlID0gKHVpbnQ4KikodmlkZW8tPnByZWREQ0FDX3JvdyArIHZpZGVvLT5tYm51bV9jb2wpOwotICAgICAgICAgICAgWkVST19PVVRfNjRCWVRFUyhwYnl0ZSk7Ci0gICAgICAgICAgICBwYnl0ZSA9ICh1aW50OCopKHZpZGVvLT5wcmVkRENBQ19jb2wpOwotICAgICAgICAgICAgWkVST19PVVRfNjRCWVRFUyhwYnl0ZSk7Ci0KLSAgICAgICAgfQotICAgIH0KLQotICAgIHZhbGlkX3N0dWZmaW5nID0gdmFsaWRTdHVmZmluZyhzdHJlYW0pOyAgIC8qICAqLwotICAgIGlmICghdmFsaWRfc3R1ZmZpbmcpCi0gICAgewotICAgICAgICBWaWRlb0RlY29kZXJFcnJvckRldGVjdGVkKHZpZGVvKTsKLSAgICAgICAgbW92ZVBvaW50ZXJUbyhzdHJlYW0sIHN0YXJ0U2Vjb25kUGFydCk7IC8qICAqLwotICAgICAgICBDb25jZWFsVGV4dHVyZV9QKHZpZGVvLCBtYl9zdGFydCwgbWJfZW5kLCBzbGljZV9jb3VudGVyKTsKLQotICAgICAgICByZXR1cm4gUFZfRkFJTDsKLSAgICB9Ci0gICAgcmV0dXJuIFBWX1NVQ0NFU1M7Ci19Ci0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBHZXRNQmhlYWRlckRhdGFQYXJ0X0RRVUFOVF9EQygpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA0LzI2LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogRGVjb2RlIERRVUFOVCBhbmQgREMgaW4gRGF0YSBQYXJ0aXRpb25lZCBNb2RlIGZvciBib3RoICAgICAgICovCi0vKiAgICAgICAgICAgICBJLVZPUCBhbmQgUC1WT1AuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogUFZfU1VDQ0VTUyBpZiBzdWNjZXNzZWQsIFBWX0ZBSUwgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAwMi8xMy8yMDAxIG5ldyBBQ0RDIHByZWRpY3Rpb24gc3RydWN0dXJlLCAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYW51cCAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi1QVl9TVEFU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IFFQX3RtcCA9ICpRUDsgICAgICAgICAgICAgICAgICAgICAgLyogcnVubmluZyBRUCAgMDQvMjYvMDEqLwotICAgICAgICBzd2l0Y2hlZCA9IDA7Ci0gICAgICAgIGlmIChpbnRyYV9kY192bGNfdGhyKSAgICAgICAgICAgICAgICAgLyogIDA0LzI3LzAxICovCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmICh2aWRlby0+dXNlUHJldlFQKQotICAgICAgICAgICAgICAgIFFQX3RtcCA9IHZpZGVvLT5RUE1CW21ibnVtLTFdOwotICAgICAgICAgICAgc3dpdGNoZWQgPSAoaW50cmFfZGNfdmxjX3RociA9PSA3IHx8IFFQX3RtcCA+PSBpbnRyYV9kY192bGNfdGhyICogMiArIDExKTsKLSAgICAgICAgfQotICAgICAgICBpZiAoIXN3aXRjaGVkKQotICAgICAgICB7Ci0gICAgICAgICAgICBmb3IgKGNvbXAgPSAwOyBjb21wIDwgNjsgY29tcCsrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0RlY29kZVByZWRpY3RlZEludHJhREMoY29tcCwgc3RyZWFtLCAoKkRDICsgY29tcCkpOyAgIC8qICAwMy8wMS8wMSAqLwotICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICBmb3IgKGNvbXAgPSAwOyBjb21wIDwgNjsgY29tcCsrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICgqREMpW2NvbXBdID0gMDsgICAvKiAgMDQvMjYvMDEgbmVlZGVkIGZvciBzd2l0Y2hlZCBjYXNlKi8KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLSAgICByZXR1cm4gc3RhdHVzOwotfQotCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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gICAgfQotICAgIH0KLSAgICBlbHNlCi0gICAgewotICAgICAgICAvKiBjb2RlZCBtYWNyb2Jsb2NrICovCi0gICAgICAgIE1DQlBDID0gUFZfVmxjRGVjTUNCUENfY29tX2ludGVyKHN0cmVhbSk7Ci0KLSAgICAgICAgaWYgKFZMQ19FUlJPUl9ERVRFQ1RFRChNQ0JQQykpCi0gICAgICAgIHsKLSAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOwotICAgICAgICB9Ci0KLSAgICAgICAgTW9kZVttYm51bV0gPSAodWludDgpTUJ0eXBlX21vZGVbTUNCUEMgJiA3XTsKLSAgICAgICAgdmlkZW8tPmhlYWRlckluZm8uQ0JQW21ibnVtXSA9ICh1aW50OCkoKE1DQlBDID4+IDQpICYgMyk7Ci0gICAgfQotCi0gICAgcmV0dXJuIFBWX1NVQ0NFU1M7Ci19Ci0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEJlZ2luKioqKioqCi0qICAgICAgIDA0LzE3LzAxICBuZXcgQUNEQyBwcmVkIHN0cnVjdHVyZSwgcmVvcmdhbml6ZWQgY29kZSwgY2xlYW51cAotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipDb21tZW50RW5kKioqKioqKiovCi1QVl9TVEFUVVMgR2V0TUJEYXRhX0RhdGFQYXJ0KFZpZGVvRGVjRGF0YSAqdmlkZW8pCi17Ci0gICAgaW50IG1ibnVtID0gdmlkZW8tPm1ibnVtOwotICAgIGludDE2ICpkYXRhQmxvY2s7Ci0gICAgTWFjcm9CbG9jayAqbWJsb2NrID0gdmlkZW8tPm1ibG9jazsKLSAgICBpbnQgUVAgPSB2aWRlby0+UVBNQlttYm51bV07Ci0gICAgaW50MzIgb2Zmc2V0OwotICAgIFBJWEVMICpjX2NvbXA7Ci0gICAgaW50IHdpZHRoID0gdmlkZW8tPndpZHRoOwotICAgI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yIChjb21wID0gMDsgY29tcCA8IDY7IGNvbXArKykKLSAgICAgICAgewotICAgICAgICAgICAgZGF0YUJsb2NrID0gbWJsb2NrLT5ibG9ja1tjb21wXTsgICAgLyosIDEwLzIwLzIwMDAgKi8KLQotICAgICAgICAgICAgZGF0YUJsb2NrWzBdID0gKCpEQylbY29tcF07Ci0KLSAgICAgICAgICAgIG5jb2VmZnNbY29tcF0gPSBWbGNEZXF1YW50SDI2M0ludHJhQmxvY2sodmlkZW8sIGNvbXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoZWQsIG1ibG9jay0+Yml0bWFwY29sW2NvbXBdLCAmbWJsb2NrLT5iaXRtYXByb3dbY29tcF0pOwotCi0gICAgICAgICAgICBpZiAoVkxDX0VSUk9SX0RFVEVDVEVEKG5jb2VmZnNbY29tcF0pKSAgICAgICAgIC8qICAqLwotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmIChzd2l0Y2hlZCkKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgbmNvZWZmc1tjb21wXSA9IDE7Ci0gICAgICAgICAgICAgICAgICAgIG9zY2xfbWVtc2V0KChkYXRhQmxvY2sgKyAxKSwgMCwgc2l6ZW9mKGludDE2KSo2Myk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgbm9fY29lZmZbY29tcF0gPSBuY29lZmZzW2NvbXBdOwotICAgICAgICAgICAgLyogIG1vZGlmaWVkIHRvIG5ldyBzZW1hcGhvcmUgZm9yIHBvc3QtcHJvYyAqLwotICAgICAgICAgICAgLy8gRnV0dXJlIHdvcms6OiBjYW4gYmUgY29tYmluZWQgaW4gdGhlIGRlcXVhbnQgZnVuY3Rpb24KLSAgICAgICAgICAgIC8vIEB0b2RvIERlYmxvY2tpbmcgU2VtYXBob3JlIGZvciBJTlRSQSBibG9jawotI2lmZGVmIFBWX1BPU1RQUk9DX09OCi0gICAgICAgICAgICBpZiAodmlkZW8tPnBvc3RGaWx0ZXJUeXBlICE9IFBWX05PX1BPU1RfUFJPQykKLSAgICAgICAgICAgICAgICAqcHBfbW9kW2NvbXBdID0gKHVpbnQ4KSBQb3N0UHJvY1NlbWFwaG9yZShkYXRhQmxvY2spOwotI2VuZGlmCi0gICAgICAgIH0KLSAgICAgICAgTUJsb2NrSURDVCh2aWRlbyk7Ci0gICAgfQotICAgIGVsc2UgLyogTU9ERSBJTlRFUiovCi0gICAgewotCi0KLQotCi0gICAgICAgIE1CTW90aW9uQ29tcCh2aWRlbywgQ0JQKTsKLSAgICAgICAgb2Zmc2V0ID0gKGludDMyKSh5X3BvcyA8PCA0KSAqIHdpZHRoICsgKHhfcG9zIDw8IDQpOwotICAgICAgICBjX2NvbXAgID0gdmlkZW8tPmN1cnJWb3AtPnlDaGFuICsgb2Zmc2V0OwotCi0KLSAgICAgICAgZm9yIChjb21wID0gMDsgY29tcCA8IDQ7IGNvbXArKykKLSAgICAgICAgewotICAgICAgICAgICAgKCpEQylbY29tcF0gPSBtaWRfZ3JheTsKLQotICAgICAgICAgICAgaWYgKENCUCAmICgxIDw8ICg1IC0gY29tcCkpKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIG5jb2VmZnNbY29tcF0gPSBWbGNEZXF1YW50SDI2M0ludGVyQmxvY2sodmlkZW8sIGNvbXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ibG9jay0+Yml0bWFwY29sW2NvbXBdLCAmbWJsb2NrLT5iaXRtYXByb3dbY29tcF0pOwotICAgICAgICAgICAgICAgIGlmIChWTENfRVJST1JfREVURUNURUQobmNvZWZmc1tjb21wXSkpCi0gICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOwotCi0KLSAgICAgICAgICAgICAgICBCbG9ja0lEQ1QoY19jb21wICsgKGNvbXAmMikqKHdpZHRoIDw8IDIpICsgOCooY29tcCYxKSwgbWJsb2NrLT5wcmVkX2Jsb2NrICsgKGNvbXAmMikqNjQgKyA4Kihjb21wJjEpLCBtYmxvY2stPmJsb2NrW2NvbXBdLCB3aWR0aCwgbmNvZWZmc1tjb21wXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWJsb2NrLT5iaXRtYXBjb2xbY29tcF0sIG1ibG9jay0+Yml0bWFwcm93W2NvbXBdKTsKLQotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIG5jb2VmZnNbY29tcF0gPSAwOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvKiAgQHRvZG8gRGVibG9ja2luZyBTZW1hcGhvcmUgZm9yIElOVFJBIGJsb2NrLCBmb3IgaW50ZXIganVzdCB0ZXN0IGZvciByaW5naW5nICAqLwotI2lmZGVmIFBWX1BPU1RQUk9DX09OCi0gICAgICAgICAgICBpZiAodmlkZW8tPnBvc3RGaWx0ZXJUeXBlICE9IFBWX05PX1BPU1RfUFJPQykKLSAgICAgICAgICAgICAgICAqcHBfbW9kW2NvbXBdID0gKHVpbnQ4KSgobmNvZWZmc1tjb21wXSA+IDMpID8gNCA6IDApOwotI2VuZGlmCi0gICAgICAgIH0KLQotICAgICAgICAoKkRDKVs0XSA9IG1pZF9ncmF5OwotICAgICAgICBpZiAoQ0JQICYgMikKLSAgICAgICAgewotICAgICAgICAgICAgbmNvZWZmc1s0XSA9IFZsY0RlcXVhbnRIMjYzSW50ZXJCbG9jayh2aWRlbywgNCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWJsb2NrLT5iaXRtYXBjb2xbNF0sICZtYmxvY2stPmJpdG1hcHJvd1s0XSk7Ci0gICAgICAgICAgICBpZiAoVkxDX0VSUk9SX0RFVEVDVEVEKG5jb2VmZnNbNF0pKQotICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOwotCi0gICAgICAgICAgICBCbG9ja0lEQ1QodmlkZW8tPmN1cnJWb3AtPnVDaGFuICsgKG9mZnNldCA+PiAyKSArICh4X3BvcyA8PCAyKSwgbWJsb2NrLT5wcmVkX2Jsb2NrICsgMjU2LCBtYmxvY2stPmJsb2NrWzRdLCB3aWR0aCA+PiAxLCBuY29lZmZzWzRdLAotICAgICAgICAgICAgICAgICAgICAgIG1ibG9jay0+Yml0bWFwY29sWzRdLCBtYmxvY2stPmJpdG1hcHJvd1s0XSk7Ci0KLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIG5jb2VmZnNbNF0gPSAwOwotICAgICAgICB9Ci0jaWZkZWYgUFZfUE9TVFBST0NfT04KLSAgICAgICAgaWYgKHZpZGVvLT5wb3N0RmlsdGVyVHlwZSAhPSBQVl9OT19QT1NUX1BST0MpCi0gICAgICAgICAgICAqcHBfbW9kWzRdID0gKHVpbnQ4KSgobmNvZWZmc1s0XSA+IDMpID8gNCA6IDApOwotI2VuZGlmCi0gICAgICAgICgqREMpWzVdID0gbWlkX2dyYXk7Ci0gICAgICAgIGlmIChDQlAgJiAxKQotICAgICAgICB7Ci0gICAgICAgICAgICBuY29lZmZzWzVdID0gVmxjRGVxdWFudEgyNjNJbnRlckJsb2NrKHZpZGVvLCA1LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYmxvY2stPmJpdG1hcGNvbFs1XSwgJm1ibG9jay0+Yml0bWFwcm93WzVdKTsKLSAgICAgICAgICAgIGlmIChWTENfRVJST1JfREVURUNURUQobmNvZWZmc1s1XSkpCi0gICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7Ci0KLSAgICAgICAgICAgIEJsb2NrSURDVCh2aWRlby0+Y3VyclZvcC0+dkNoYW4gKyAob2Zmc2V0ID4+IDIpICsgKHhfcG9zIDw8IDIpLCBtYmxvY2stPnByZWRfYmxvY2sgKyAy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AgLyogY2hyb21pbmFuY2UgKi8KLSAgICAvKiBEbyB0aGUgZmlyc3QgbGluZSAoNyBwaXhlbHMgYXQgYSB0aW1lID0+IERvbid0IHVzZSBNTVgpKi8KLSAgICBmb3IgKGhfYmxrID0gMDsgaF9ibGsgPCB3aWR0aDsgaF9ibGsgKz0gQkxLU0laRSkKLSAgICB7Ci0gICAgICAgIG1heF9kaWZmID0gKFFQX3N0b3JlW2hfYmxrPj4zXSA+PiAyKSArIDQ7Ci0gICAgICAgIHB0ciA9ICZSZWNfQ1toX2Jsa107Ci0gICAgICAgIG1heF9ibGsgPSBtaW5fYmxrID0gKnB0cjsKLSAgICAgICAgRmluZE1heE1pbihwdHIsICZtaW5fYmxrLCAmbWF4X2Jsaywgd2lkdGgpOwotICAgICAgICBoMCA9ICgoaF9ibGsgLSAxKSA+PSAxKSA/IChoX2JsayAtIDEpIDogMTsKLQotICAgICAgICBpZiAobWF4X2JsayAtIG1pbl9ibGsgPj0gNCkKLSAgICAgICAgewotICAgICAgICAgICAgdGhyZXMgPSAobWF4X2JsayArIG1pbl9ibGsgKyAxKSA+PiAxOwotCi0KLSAgICAgICAgICAgIGZvciAodl9wZWwgPSAxOyB2X3BlbCA8IEJMS1NJWkUgLSAxOyB2X3BlbCsrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGFkZHJfdiA9IChpbnQzMil2X3BlbCAqIHdpZHRoOwotICAgICAgICAgICAgICAgIHB0ciA9ICZSZWNfQ1thZGRyX3YgKyBoMCAtIDFdOwotICAgICAgICAgICAgICAgIHB0cjIgPSAmc3VtX3ZbMF07Ci0gICAgICAgICAgICAgICAgcHRyMyA9ICZzaWduX3ZbMF07Ci0KLSAgICAgICAgICAgICAgICBwZWx1ID0gKihwdHIgLSB3aWR0aCk7Ci0gICAgICAgICAgICAgICAgcGVsYyA9ICpwdHI7Ci0gICAgICAgICAgICAgICAgcGVsbCA9ICoocHRyICsgd2lkdGgpOwotICAgICAgICAgICAgICAgIHB0cisrOwotICAgICAgICAgICAgICAgICpwdHIyKysgPSBwZWx1ICsgKHBlbGMgPDwgMSkgKyBwZWxsOwotICAgICAgICAgICAgICAgICpwdHIzKysgPSBJTkRFWChwZWx1LCB0aHJlcykgKyBJTkRFWChwZWxjLCB0aHJlcykgKyBJTkRFWChwZWxsLCB0aHJlcyk7Ci0KLSAgICAgICAgICAgICAgICBwZWx1ID0gKihwdHIgLSB3aWR0aCk7Ci0gICAgICAgICAgICAgICAgcGVsYyA9ICpwdHI7Ci0gICAgICAgICAgICAgICAgcGVsbCA9ICoocHRyICsgd2lkdGgpOwotICAgICAgICAgICAgICAgIHB0cisrOwotICAgICAgICAgICAgICAgICpwdHIyKysgPSBwZWx1ICsgKHBlbGMgPDwgMSkgKyBwZWxsOwotICAgICAgICAgICAgICAgICpwdHIzKysgPSBJTkRFWChwZWx1LCB0aHJlcykgKyBJTkRFWChwZWxjLCB0aHJlcykgKyBJTkRFWChwZWxsLCB0aHJlcyk7Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGhfcGVsID0gaDA7IGhfcGVsIDwgaF9ibGsgKyBCTEtTSVpFIC0gMTsgaF9wZWwrKykKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHBlbHUgPSAqKHB0ciAtIHdpZHRoKTsKLSAgICAgICAgICAgICAgICAgICAgcGVsYyA9ICpwdHI7Ci0gICAgICAgICAgICAgICAgICAgIHBlbGwgPSAqKHB0ciArIHdpZHRoKTsKLQotICAgICAgICAgICAgICAgICAgICAqcHRyMiA9IHBlbHUgKyAocGVsYyA8PCAxKSArIHBlbGw7Ci0gICAgICAgICAgICAgICAgICAgICpwdHIzID0gSU5ERVgocGVsdSwgdGhyZXMpICsgSU5ERVgocGVsYywgdGhyZXMpICsgSU5ERVgocGVsbCwgdGhyZXMpOwotCi0gICAgICAgICAgICAgICAgICAgIHN1bTEgPSAqKHB0cjMgLSAyKSArICoocHRyMyAtIDEpICsgKnB0cjM7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChzdW0xID09IDAgfHwgc3VtMSA9PSA5KQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdW0gPSAoKihwdHIyIC0gMikgKyAoKihwdHIyIC0gMSkgPDwgMSkgKyAqcHRyMiArIDgpID4+IDQ7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIHB0ci0tOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFBWX0FCUygqcHRyIC0gc3VtKSA+IG1heF9kaWZmKQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdW0gPiAqcHRyKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdW0gPSAqcHRyICsgbWF4X2RpZmY7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdW0gPSAqcHRyIC0gbWF4X2RpZmY7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAqcHRyKysgPSAodWludDgpIHN1bTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBwdHIrKzsKLSAgICAgICAgICAgICAgICAgICAgcHRyMisrOwotICAgICAgICAgICAgICAgICAgICBwdHIzKys7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgZm9yICh2X2JsayA9IEJMS1NJWkU7IHZfYmxrIDwgaGVpZ2h0OyB2X2JsayArPSBCTEtTSVpFKQotICAgIHsKLSAgICAgICAgdjAgPSB2X2JsayAtIDE7Ci0gICAgICAgIC8qIERvIHRoZSBmaXJzdCBibG9jayAocGl4ZWxzPTcgPT4gTm8gTU1YKSAqLwotICAgICAgICBtYXhfZGlmZiA9IChRUF9zdG9yZVsoKCgoaW50MzIpdl9ibGsqd2lkdGgpPj4zKSk+PjNdID4+IDIpICsgNDsKLSAgICAgICAgcHRyID0gJlJlY19DWyhpbnQzMil2X2JsayAqIHdpZHRoXTsKLSAgICAgICAgbWF4X2JsayA9IG1pbl9ibGsgPSAqcHRyOwotICAgICAgICBGaW5kTWF4TWluKHB0ciwgJm1pbl9ibGssICZtYXhfYmxrLCBpbmNyKTsKLQotICAgICAgICBpZiAobWF4X2JsayAtIG1pbl9ibGsgPj0gNCkKLSAgICAgICAgewotICAgICAgICAgICAgdGhyZXMgPSAobWF4X2JsayArIG1pbl9ibGsgKyAxKSA+PiAxOwotCi0gICAgICAgICAgICBmb3IgKHZfcGVsID0gdjA7IHZfcGVsIDwgdl9ibGsgKyBCTEtTSVpFIC0gMTsgdl9wZWwrKykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBhZGRyX3YgPSB2X3BlbCAqIHdpZHRoOwotICAgICAgICAgICAgICAgIHB0ciA9ICZSZWNfQ1thZGRyX3ZdOwotICAgICAgICAgICAgICAgIHB0cjIgPSAmc3VtX3ZbMF07Ci0gICAgICAgICAgICAgICAgcHRyMyA9ICZzaWduX3ZbMF07Ci0KLSAgICAgICAgICAgICAgICBwZWx1ID0gKihwdHIgLSB3aWR0aCk7Ci0gICAgICAgICAgICAgICAgcGVsYyA9ICpwdHI7Ci0gICAgICAgICAgICAgICAgcGVsbCA9ICoocHRyICsgd2lkdGgpOwotICAgICAgICAgICAgICAgIHB0cisrOwotICAgICAgICAgICAgICAgICpwdHIyKysgPSBwZWx1ICsgKHBlbGMgPDwgMSkgKyBwZWxsOwotICAgICAgICAgICAgICAgICpwdHIzKysgPSBJTkRFWChwZWx1LCB0aHJlcykgKyBJTkRFWChwZWxjLCB0aHJlcykgKyBJTkRFWChwZWxsLCB0aHJlcyk7Ci0KLSAgICAgICAgICAgICAgICBwZWx1ID0gKihwdHIgLSB3aWR0aCk7Ci0gICAgICAgICAgICAgICAgcGVsYyA9ICpwdHI7Ci0gICAgICAgICAgICAgICAgcGVsbCA9ICoocHRyICsgd2lkdGgpOwotICAgICAgICAgICAgICAgIHB0cisrOwotICAgICAgICAgICAgICAgICpwdHIyKysgPSBwZWx1ICsgKHBlbGMgPDwgMSkgKyBwZWxsOwotICAgICAgICAgICAgICAgICpwdHIzKysgPSBJTkRFWChwZWx1LCB0aHJlcykgKyBJTkRFWChwZWxjLCB0aHJlcykgKyBJTkRFWChwZWxsLCB0aHJlcyk7Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGhfcGVsID0gMTsgaF9wZWwgPCBCTEtTSVpFIC0gMTsgaF9wZWwrKykKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHBlbHUgPSAqKHB0ciAtIHdpZHRoKTsKLSAgICAgICAgICAgICAgICAgICAgcGVsYyA9ICpwdHI7Ci0gICAgICAgICAgICAgICAgICAgIHBlbGwgPSAqKHB0ciArIHdpZHRoKTsKLQotICAgICAgICAgICAgICAgICAgICAqcHRyMiA9IHBlbHUgKyAocGVsYyA8PCAxKSArIHBlbGw7Ci0gICAgICAgICAgICAgICAgICAgICpwdHIzID0gSU5ERVgocGVsdSwgdGhyZXMpICsgSU5ERVgocGVsYywgdGhyZXMpICsgSU5ERVgocGVsbCwgdGhyZXMpOwotCi0gICAgICAgICAgICAgICAgICAgIHN1bTEgPSAqKHB0cjMgLSAyKSArICoocHRyMyAtIDEpICsgKnB0cjM7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChzdW0xID09IDAgfHwgc3VtMSA9PSA5KQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdW0gPSAoKihwdHIyIC0gMikgKyAoKihwdHIyIC0gMSkgPDwgMSkgKyAqcHRyMiArIDgpID4+IDQ7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIHB0ci0tOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFBWX0FCUygqcHRyIC0gc3VtKSA+IG1heF9kaWZmKQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdW0gPiAqcHRyKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdW0gPSAqcHRyICsgbWF4X2RpZmY7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdW0gPSAqcHRyIC0gbWF4X2RpZmY7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAqcHRyKysgPSAodWludDgpIHN1bTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBwdHIrKzsKLSAgICAgICAgICAgICAgICAgICAgcHRyMisrOwotICAgICAgICAgICAgICAgICAgICBwdHIzKys7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLQotICAgICAgICAvKiBEbyB0aGUgcmVzdCBpbiBNTVggKi8KLSAgICAgICAgZm9yIChoX2JsayA9IEJMS1NJWkU7IGhfYmxrIDwgd2lkdGg7IGhfYmxrICs9IEJMS1NJWkUpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmICgocHBfbW9kWyh2X2Jsay84KSood2lkdGgvOCkraF9ibGsvOF0mMHg0KSAhPSAwKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIG1heF9kaWZmID0gKFFQX3N0b3JlWygoKChpbnQzMil2X2Jsayp3aWR0aCk+PjMpK2hfYmxrKT4+M10gPj4gMikgKyA0OwotICAgICAgICAgICAgICAgIHB0ciA9ICZSZWNfQ1soaW50MzIpdl9ibGsgKiB3aWR0aCArIGhfYmxrXTsKLSAgICAgICAgICAgICAgICBtYXhfYmxrID0gbWluX2JsayA9ICpwdHI7Ci0gICAgICAgICAgICAgICAgRmluZE1heE1pbihwdHIsICZtaW5fYmxrLCAmbWF4X2JsaywgaW5jcik7Ci0gICAgICAgICAgICAgICAgaDAgPSBoX2JsayAtIDE7Ci0KL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HJhbmdlW2Jsa3NdID49IG1heF9yYW5nZV9ibGspCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBtYXhfcmFuZ2VfYmxrID0gcmFuZ2VbYmxrc107Ci0gICAgICAgICAgICAgICAgICAgIG1heF90aHJlc19ibGsgPSB0aHJlc1tibGtzXTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYmxrcysrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgYmxrcyA9IDA7Ci0gICAgICAgIGZvciAodl9ibGsgPSAwOyB2X2JsayA8IE1CU0laRTsgdl9ibGsgKz0gQkxLU0laRSkKLSAgICAgICAgewotICAgICAgICAgICAgdjAgPSAoKHZfYmxrIC0gMSkgPj0gMSkgPyAodl9ibGsgLSAxKSA6IDE7Ci0gICAgICAgICAgICBmb3IgKGhfYmxrID0gTUJfSDsgaF9ibGsgPCBNQl9IICsgTUJTSVpFOyBoX2JsayArPSBCTEtTSVpFKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGgwID0gKChoX2JsayAtIDEpID49IDEpID8gKGhfYmxrIC0gMSkgOiAxOwotCi0gICAgICAgICAgICAgICAgLyogdGhyZXNob2xkIHJlYXJyYW5nZW1lbnQgZm9yIGZsYXQgcmVnaW9uIGFkamFjZW50IHRvIG5vbi1mbGF0IHJlZ2lvbiAqLwotICAgICAgICAgICAgICAgIGlmIChyYW5nZVtibGtzXTwzMiAmJiBtYXhfcmFuZ2VfYmxrID49IDY0KQotICAgICAgICAgICAgICAgICAgICB0aHJlc1tibGtzXSA9IG1heF90aHJlc19ibGs7Ci0KLSAgICAgICAgICAgICAgICAvKiB0aHJlc2hvbGQgcmVhcnJhbmdlbWVudCBmb3IgZGVibG9ja2luZwotICAgICAgICAgICAgICAgIChibG9ja2luZXNzIGFubm95aW5nIGF0IERDIGRvbWluYW50IHJlZ2lvbikgKi8KLSAgICAgICAgICAgICAgICBpZiAobWF4X3JhbmdlX2JsayA+PSAxNikKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIC8qIGFkYXB0aXZlIHNtb290aGluZyAqLwotICAgICAgICAgICAgICAgICAgICB0aHIgPSB0aHJlc1tibGtzXTsKLQotICAgICAgICAgICAgICAgICAgICBBZGFwdGl2ZVNtb290aF9Ob01NWChSZWNfWSwgdjAsIGgwLCB2X2JsaywgaF9ibGssCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRociwgd2lkdGgsIG1heF9kaWZmKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYmxrcysrOwotICAgICAgICAgICAgfSAvKiBibG9jayBsZXZlbCAoTHVtaW5hbmNlKSAqLwotICAgICAgICB9Ci0gICAgfSAvKiBtYWNyb2Jsb2NrIGxldmVsICovCi0KLQotICAgIC8qIERvIHRoZSByZXN0IG9mIHRoZSBtYWNyby1ibG9jay1saW5lcyAqLwotICAgIGZvciAoTUJfViA9IE1CU0laRTsgTUJfViA8IGhlaWdodDsgTUJfViArPSBNQlNJWkUpCi0gICAgewotICAgICAgICAvKiBGaXJzdCBtYWNyby1ibG9jayAqLwotICAgICAgICBtYXhfZGlmZiA9IChRUF9zdG9yZVsoKCgoaW50MzIpTUJfVip3aWR0aCk+PjQpKT4+NF0gPj4gMikgKyA0OwotICAgICAgICAvKiB0aHJlc2hvbGQgZGV0ZXJtaW5hdGlvbiAqLwotICAgICAgICBtYXhfcmFuZ2VfYmxrID0gbWF4X3RocmVzX2JsayA9IDA7Ci0gICAgICAgIGJsa3MgPSAwOwotICAgICAgICBmb3IgKEJMS19WID0gMDsgQkxLX1YgPCBNQlNJWkU7IEJMS19WICs9IEJMS1NJWkUpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGZvciAoQkxLX0ggPSAwOyBCTEtfSCA8IE1CU0laRTsgQkxLX0ggKz0gQkxLU0laRSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBwdHIgPSAmUmVjX1lbKGludDMyKShNQl9WICsgQkxLX1YpICogd2lkdGggKyBCTEtfSF07Ci0gICAgICAgICAgICAgICAgRmluZE1heE1pbihwdHIsICZtaW5fYmxrLCAmbWF4X2JsaywgaW5jcik7Ci0gICAgICAgICAgICAgICAgdGhyZXNbYmxrc10gPSAobWF4X2JsayArIG1pbl9ibGsgKyAxKSA+PiAxOwotICAgICAgICAgICAgICAgIHJhbmdlW2Jsa3NdID0gbWF4X2JsayAtIG1pbl9ibGs7Ci0KLSAgICAgICAgICAgICAgICBpZiAocmFuZ2VbYmxrc10gPj0gbWF4X3JhbmdlX2JsaykKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIG1heF9yYW5nZV9ibGsgPSByYW5nZVtibGtzXTsKLSAgICAgICAgICAgICAgICAgICAgbWF4X3RocmVzX2JsayA9IHRocmVzW2Jsa3NdOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBibGtzKys7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBibGtzID0gMDsKLSAgICAgICAgZm9yICh2X2JsayA9IE1CX1Y7IHZfYmxrIDwgTUJfViArIE1CU0laRTsgdl9ibGsgKz0gQkxLU0laRSkKLSAgICAgICAgewotICAgICAgICAgICAgdjAgPSB2X2JsayAtIDE7Ci0gICAgICAgICAgICBmb3IgKGhfYmxrID0gMDsgaF9ibGsgPCBNQlNJWkU7IGhfYmxrICs9IEJMS1NJWkUpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgaDAgPSAoKGhfYmxrIC0gMSkgPj0gMSkgPyAoaF9ibGsgLSAxKSA6IDE7Ci0KLSAgICAgICAgICAgICAgICAvKiB0aHJlc2hvbGQgcmVhcnJhbmdlbWVudCBmb3IgZmxhdCByZWdpb24gYWRqYWNlbnQgdG8gbm9uLWZsYXQgcmVnaW9uICovCi0gICAgICAgICAgICAgICAgaWYgKHJhbmdlW2Jsa3NdPDMyICYmIG1heF9yYW5nZV9ibGsgPj0gNjQpCi0gICAgICAgICAgICAgICAgICAgIHRocmVzW2Jsa3NdID0gbWF4X3RocmVzX2JsazsKLQotICAgICAgICAgICAgICAgIC8qIHRocmVzaG9sZCByZWFycmFuZ2VtZW50IGZvciBkZWJsb2NraW5nCi0gICAgICAgICAgICAgICAgKGJsb2NraW5lc3MgYW5ub3lpbmcgYXQgREMgZG9taW5hbnQgcmVnaW9uKSAqLwotICAgICAgICAgICAgICAgIGlmIChtYXhfcmFuZ2VfYmxrID49IDE2KQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgLyogYWRhcHRpdmUgc21vb3RoaW5nICovCi0gICAgICAgICAgICAgICAgICAgIHRociA9IHRocmVzW2Jsa3NdOwotCi0gICAgICAgICAgICAgICAgICAgIEFkYXB0aXZlU21vb3RoX05vTU1YKFJlY19ZLCB2MCwgaDAsIHZfYmxrLCBoX2JsaywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyLCB3aWR0aCwgbWF4X2RpZmYpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBibGtzKys7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gLyogYmxvY2sgbGV2ZWwgKEx1bWluYW5jZSkgKi8KLQotICAgICAgICAvKiBSZXN0IG9mIHRoZSBtYWNyby1ibG9ja3MgKi8KLSAgICAgICAgZm9yIChNQl9IID0gTUJTSVpFOyBNQl9IIDwgd2lkdGg7IE1CX0ggKz0gTUJTSVpFKQotICAgICAgICB7Ci0gICAgICAgICAgICBtYXhfZGlmZiA9IChRUF9zdG9yZVsoKCgoaW50MzIpTUJfVip3aWR0aCk+PjQpK01CX0gpPj40XSA+PiAyKSArIDQ7Ci0KLSAgICAgICAgICAgIC8qIHRocmVzaG9sZCBkZXRlcm1pbmF0aW9uICovCi0gICAgICAgICAgICBtYXhfcmFuZ2VfYmxrID0gbWF4X3RocmVzX2JsayA9IDA7Ci0gICAgICAgICAgICBibGtzID0gMDsKLQotICAgICAgICAgICAgbWJfaW5keCA9IChNQl9WIC8gOCkgKiAod2lkdGggLyA4KSArIE1CX0ggLyA4OwotICAgICAgICAgICAgZm9yIChCTEtfViA9IDA7IEJMS19WIDwgTUJTSVpFOyBCTEtfViArPSBCTEtTSVpFKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGZvciAoQkxLX0ggPSAwOyBCTEtfSCA8IE1CU0laRTsgQkxLX0ggKz0gQkxLU0laRSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGJsa19pbmR4ID0gbWJfaW5keCArIChCTEtfViAvIDgpICogd2lkdGggLyA4ICsgQkxLX0ggLyA4OwotICAgICAgICAgICAgICAgICAgICAvKiBVcGRhdGUgYmFzZWQgb24gcHBfbW9kIG9ubHkgKi8KLSAgICAgICAgICAgICAgICAgICAgaWYgKChwcF9tb2RbYmxrX2luZHhdJjB4NCkgIT0gMCkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgcHRyID0gJlJlY19ZWyhpbnQzMikoTUJfViArIEJMS19WKSAqIHdpZHRoICsgTUJfSCArIEJMS19IXTsKLSAgICAgICAgICAgICAgICAgICAgICAgIEZpbmRNYXhNaW4ocHRyLCAmbWluX2JsaywgJm1heF9ibGssIGluY3IpOwotICAgICAgICAgICAgICAgICAgICAgICAgdGhyZXNbYmxrc10gPSAobWF4X2JsayArIG1pbl9ibGsgKyAxKSA+PiAxOwotICAgICAgICAgICAgICAgICAgICAgICAgcmFuZ2VbYmxrc10gPSBtYXhfYmxrIC0gbWluX2JsazsKLQotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJhbmdlW2Jsa3NdID49IG1heF9yYW5nZV9ibGspCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4X3JhbmdlX2JsayA9IHJhbmdlW2Jsa3NdOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heF90aHJlc19ibGsgPSB0aHJlc1tibGtzXTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBibGtzKys7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBibGtzID0gMDsKLSAgICAgICAgICAgIGZvciAodl9ibGsgPSBNQl9WOyB2X2JsayA8IE1CX1YgKyBNQlNJWkU7IHZfYmxrICs9IEJMS1NJWkUpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgdjAgPSB2X2JsayAtIDE7Ci0gICAgICAgICAgICAgICAgbWJfaW5keCA9ICh2X2JsayAvIDgpICogKHdpZHRoIC8gOCk7Ci0gICAgICAgICAgICAgICAgZm9yIChoX2JsayA9IE1CX0g7IGhfYmxrIDwgTUJfSCArIE1CU0laRTsgaF9ibGsgKz0gQkxLU0laRSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGgwID0gaF9ibGsgLSAxOwotICAgICAgICAgICAgICAgICAgICBibGtfaW5keCA9IG1iX2luZHggKyBoX2JsayAvIDg7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgocHBfbW9kW2Jsa19pbmR4XSYweDQpICE9IDApCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIHRocmVzaG9sZCByZWFycmFuZ2VtZW50IGZvciBmbGF0IHJlZ2lvbiBhZGphY2VudCB0byBub24tZmxhdCByZWdpb24gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyYW5nZVtibGtzXTwzMiAmJiBtYXhfcmFuZ2VfYmxrID49IDY0KQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocmVzW2Jsa3NdID0gbWF4X3RocmVzX2JsazsKLQotICAgICAgICAgICAgICAgICAgICAgICAgLyogdGhyZXNob2xkIHJlYXJyYW5nZW1lbnQgZm9yIGRlYmxvY2tpbmcKLSAgICAgICAgICAgICAgICAgICAgICAgIChibG9ja2luZXNzIGFubm95aW5nIGF0IERDIGRvbWluYW50IHJlZ2lvbikgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXhfcmFuZ2VfYmxrID49IDE2KQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGFkYXB0aXZlIHNtb290aGluZyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRociA9IHRocmVzW2Jsa3NdOwotI2lmZGVmIE5vTU1YCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQWRhcHRpdmVTbW9vdGhfTm9NTVgoUmVjX1ksIHYwLCBoMCwgdl9ibGssIGhfYmxrLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRociwgd2lkdGgsIG1heF9kaWZmKTsKLSNlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgRGVyaW5nQWRhcHRpdmVTbW9vdGhNTVgoJlJlY19ZW3YwKndpZHRoK2gwXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aCwgdGhyLCBtYXhfZGlmZik7Ci0jZW5kaWYKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBibGtzKys7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSAvKiBibG9jayBsZXZlbCAoTHVtaW5hbmNlKSAqLwotICAgICAgICB9IC8qIG1hY3JvYmxvY2sgbGV2ZWwgKi8KLSAgICB9IC8qIG1hY3JvYmxvY2sgbGV2ZWwgKi8KLQotICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS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NpbmcgbnpfY29lZnMpCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLS8vcHJldGVzdGVkIHZlcnNpb24KLXZvaWQgaWRjdHJvdzAoaW50MTYgKiwgdWludDggKiwgdWludDggKiwgaW50KQotewotICAgIHJldHVybiA7Ci19Ci12b2lkIGlkY3Rjb2wwKGludDE2ICopCi17Ci0gICAgcmV0dXJuIDsKLX0KLQotdm9pZCBpZGN0cm93MShpbnQxNiAqYmxrLCB1aW50OCAqcHJlZCwgdWludDggKmRzdCwgaW50IHdpZHRoKQotewotICAgIC8qIHNob3J0Y3V0ICovCi0gICAgaW50IHRtcDsKLSAgICBpbnQgaSA9IDg7Ci0gICAgdWludDMyIHByZWRfd29yZCwgZHN0X3dvcmQ7Ci0gICAgaW50IHJlcywgcmVzMjsKLQotICAgIC8qIHByZXNldCB0aGUgb2Zmc2V0LCBzdWNoIHRoYXQgd2UgY2FuIHRha2UgYWR2YW50YWdlIHByZS1vZmZzZXQgYWRkcmVzc2luZyBtb2RlICAgKi8KLSAgICB3aWR0aCAtPSA0OwotICAgIGRzdCAtPSB3aWR0aDsKLSAgICBwcmVkIC09IDEyOwotICAgIGJsayAtPSA4OwotCi0gICAgd2hpbGUgKGktLSkKLSAgICB7Ci0gICAgICAgIHRtcCA9ICgqKGJsayArPSA4KSArIDMyKSA+PiA2OwotICAgICAgICAqYmxrID0gMDsKLQotICAgICAgICBwcmVkX3dvcmQgPSAqKCh1aW50MzIqKShwcmVkICs9IDEyKSk7IC8qIHJlYWQgNCBieXRlcyBmcm9tIHByZWQgKi8KLSAgICAgICAgcmVzID0gdG1wICsgKHByZWRfd29yZCAmIDB4RkYpOwotICAgICAgICBDTElQX1JFU1VMVChyZXMpOwotICAgICAgICByZXMyID0gdG1wICsgKChwcmVkX3dvcmQgPj4gOCkgJiAweEZGKTsKLSAgICAgICAgQ0xJUF9SRVNVTFQocmVzMik7Ci0gICAgICAgIGRzdF93b3JkID0gKHJlczIgPDwgOCkgfCByZXM7Ci0gICAgICAgIHJlcyA9IHRtcCArICgocHJlZF93b3JkID4+IDE2KSAmIDB4RkYpOwotICAgICAgICBDTElQX1JFU1VMVChyZXMpOwotICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDE2KTsKLSAgICAgICAgcmVzID0gdG1wICsgKChwcmVkX3dvcmQgPj4gMjQpICYgMHhGRik7Ci0gICAgICAgIENMSVBfUkVTVUxUKHJlcyk7Ci0gICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMjQpOwotICAgICAgICAqKCh1aW50MzIqKShkc3QgKz0gd2lkdGgpKSA9IGRzdF93b3JkOyAvKiBzYXZlIDQgYnl0ZXMgdG8gZHN0ICovCi0KLSAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocHJlZCArPSA0KSk7IC8qIHJlYWQgNCBieXRlcyBmcm9tIHByZWQgKi8KLSAgICAgICAgcmVzID0gdG1wICsgKHByZWRfd29yZCAmIDB4RkYpOwotICAgICAgICBDTElQX1JFU1VMVChyZXMpOwotICAgICAgICByZXMyID0gdG1wICsgKChwcmVkX3dvcmQgPj4gOCkgJiAweEZGKTsKLSAgICAgICAgQ0xJUF9SRVNVTFQocmVzMik7Ci0gICAgICAgIGRzdF93b3JkID0gKHJlczIgPDwgOCkgfCByZXM7Ci0gICAgICAgIHJlcyA9IHRtcCArICgocHJlZF93b3JkID4+IDE2KSAmIDB4RkYpOwotICAgICAgICBDTElQX1JFU1VMVChyZXMpOwotICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDE2KTsKLSAgICAgICAgcmVzID0gdG1wICsgKChwcmVkX3dvcmQgPj4gMjQpICYgMHhGRik7Ci0gICAgICAgIENMSVBfUkVTVUxUKHJlcyk7Ci0gICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMjQpOwotICAgICAgICAqKCh1aW50MzIqKShkc3QgKz0gNCkpID0gZHN0X3dvcmQ7IC8qIHNhdmUgNCBieXRlcyB0byBkc3QgKi8KLSAgICB9Ci0gICAgcmV0dXJuOwotfQotCi12b2lkIGlkY3Rjb2wxKGludDE2ICpibGspCi17IC8qIHNob3J0Y3V0ICovCi0gICAgYmxrWzBdID0gYmxrWzhdID0gYmxrWzE2XSA9IGJsa1syNF0gPSBibGtbMzJdID0gYmxrWzQwXSA9IGJsa1s0OF0gPSBibGtbNTZdID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibGtbMF0gPDwgMzsKLSAgICByZXR1cm47Ci19Ci0KLXZvaWQgaWRjdHJvdzIoaW50MTYgKmJsaywgdWludDggKnByZWQsIHVpbnQ4ICpkc3QsIGludCB3aWR0aCkKLXsKLSAgICBpbnQzMiB4MCwgeDEsIHgyLCB4NCwgeDU7Ci0gICAgaW50IGkgPSA4OwotICAgIHVpbnQzMiBwcmVkX3dvcmQsIGRzdF93b3JkOwotICAgIGludCByZXMsIHJlczI7Ci0KLSAgICAvKiBwcmVzZXQgdGhlIG9mZnNldCwgc3VjaCB0aGF0IHdlIGNhbiB0YWtlIGFkdmFudGFnZSBwcmUtb2Zmc2V0IGFkZHJlc3NpbmcgbW9kZSAgICovCi0gICAgd2lkdGggLT0gNDsKLSAgICBkc3QgLT0gd2lkdGg7Ci0gICAgcHJlZCAtPSAxMjsKLSAgICBibGsgLT0gODsKLQotICAgIHdoaWxlIChpLS0pCi0gICAgewotICAgICAgICAvKiBzaG9ydGN1dCAqLwotICAgICAgICB4NCA9IGJsa1s5XTsKLSAgICAgICAgYmxrWzldID0gMDsKLSAgICAgICAgeDAgPSAoKCooYmxrICs9IDgpKSA8PCA4KSArIDgxOTI7Ci0gICAgICAgICpibGsgPSAwOyAgLyogZm9yIHByb3BlciByb3VuZGluZyBpbiB0aGUgZm91cnRoIHN0YWdlICovCi0KLSAgICAgICAgLyogZmlyc3Qgc3RhZ2UgKi8KLSAgICAgICAgeDUgPSAoVzcgKiB4NCArIDQpID4+IDM7Ci0gICAgICAgIHg0ID0gKFcxICogeDQgKyA0KSA+PiAzOwotCi0gICAgICAgIC8qIHRoaXJkIHN0YWdlICovCi0gICAgICAgIHgyID0gKDE4MSAqICh4NCArIHg1KSArIDEyOCkgPj4gODsKLSAgICAgICAgeDEgPSAoMTgxICogKHg0IC0geDUpICsgMTI4KSA+PiA4OwotCi0gICAgICAgIC8qIGZvdXJ0aCBzdGFnZSAqLwotICAgICAgICBwcmVkX3dvcmQgPSAqKCh1aW50MzIqKShwcmVkICs9IDEyKSk7IC8qIHJlYWQgNCBieXRlcyBmcm9tIHByZWQgKi8KLSAgICAgICAgcmVzID0gKHgwICsgeDQpID4+IDE0OwotICAgICAgICBBRERfQU5EX0NMSVAxKHJlcyk7Ci0gICAgICAgIHJlczIgPSAoeDAgKyB4MikgPj4gMTQ7Ci0gICAgICAgIEFERF9BTkRfQ0xJUDIocmVzMik7Ci0gICAgICAgIGRzdF93b3JkID0gKHJlczIgPDwgOCkgfCByZXM7Ci0gICAgICAgIHJlcyA9ICh4MCArIHgxKSA+PiAxNDsKLSAgICAgICAgQUREX0FORF9DTElQMyhyZXMpOwotICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDE2KTsKLSAgICAgICAgcmVzID0gKHgwICsgeDUpID4+IDE0OwotICAgICAgICBBRERfQU5EX0NMSVA0KHJlcyk7Ci0gICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMjQpOwotICAgICAgICAqKCh1aW50MzIqKShkc3QgKz0gd2lkdGgpKSA9IGRzdF93b3JkOyAvKiBzYXZlIDQgYnl0ZXMgdG8gZHN0ICovCi0KLSAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocHJlZCArPSA0KSk7IC8qIHJlYWQgNCBieXRlcyBmcm9tIHByZWQgKi8KLSAgICAgICAgcmVzID0gKHgwIC0geDUpID4+IDE0OwotICAgICAgIC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gICB4MiA9IChXMiAqIHgyICsgNCkgPj4gMzsKLSAgICAgICAgeDggPSB4MCAtIHgyOwotICAgICAgICB4MCArPSB4MjsKLSAgICAgICAgeDIgPSB4ODsKLSAgICAgICAgeDggPSB4NCAtIHg2OwotICAgICAgICB4NCArPSB4NjsKLSAgICAgICAgeDYgPSB4ODsKLQotICAgICAgICB4NyA9IChXNyAqIHgxICsgNCkgPj4gMzsKLSAgICAgICAgeDEgPSAoVzEgKiB4MSArIDQpID4+IDM7Ci0gICAgICAgIHgzID0geDc7Ci0gICAgICAgIHg1ID0gKDE4MSAqICh4MSAtIHg3KSArIDEyOCkgPj4gODsKLSAgICAgICAgeDcgPSAoMTgxICogKHgxICsgeDcpICsgMTI4KSA+PiA4OwotCi0gICAgICAgIHByZWRfd29yZCA9ICooKHVpbnQzMiopKHByZWQgKz0gMTIpKTsgLyogcmVhZCA0IGJ5dGVzIGZyb20gcHJlZCAqLwotICAgICAgICByZXMgPSAoeDAgKyB4MSkgPj4gMTQ7Ci0gICAgICAgIEFERF9BTkRfQ0xJUDEocmVzKTsKLSAgICAgICAgcmVzMiA9ICh4NCArIHg3KSA+PiAxNDsKLSAgICAgICAgQUREX0FORF9DTElQMihyZXMyKTsKLSAgICAgICAgZHN0X3dvcmQgPSAocmVzMiA8PCA4KSB8IHJlczsKLSAgICAgICAgcmVzID0gKHg2ICsgeDUpID4+IDE0OwotICAgICAgICBBRERfQU5EX0NMSVAzKHJlcyk7Ci0gICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMTYpOwotICAgICAgICByZXMgPSAoeDIgKyB4MykgPj4gMTQ7Ci0gICAgICAgIEFERF9BTkRfQ0xJUDQocmVzKTsKLSAgICAgICAgZHN0X3dvcmQgfD0gKHJlcyA8PCAyNCk7Ci0gICAgICAgICooKHVpbnQzMiopKGRzdCArPSB3aWR0aCkpID0gZHN0X3dvcmQ7IC8qIHNhdmUgNCBieXRlcyB0byBkc3QgKi8KLQotICAgICAgICBwcmVkX3dvc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tbOV0gPSAwOwotICAgICAgICB4MyA9IGJsa1sxMV07Ci0gICAgICAgIGJsa1sxMV0gPSAwOwotICAgICAgICB4MCA9ICgoKihibGsgKz0gOCkpIDw8IDgpICsgODE5MjsKLSAgICAgICAgKmJsayA9IDA7ICAgIC8qIGZvciBwcm9wZXIgcm91bmRpbmcgaW4gdGhlIGZvdXJ0aCBzdGFnZSAqLwotCi0gICAgICAgIHg0ID0geDA7Ci0gICAgICAgIHg2ID0gKFc2ICogeDIgKyA0KSA+PiAzOwotICAgICAgICB4MiA9IChXMiAqIHgyICsgNCkgPj4gMzsKLSAgICAgICAgeDggPSB4MCAtIHgyOwotICAgICAgICB4MCArPSB4MjsKLSAgICAgICAgeDIgPSB4ODsKLSAgICAgICAgeDggPSB4NCAtIHg2OwotICAgICAgICB4NCArPSB4NjsKLSAgICAgICAgeDYgPSB4ODsKLQotICAgICAgICB4NyA9IChXNyAqIHgxICsgNCkgPj4gMzsKLSAgICAgICAgeDEgPSAoVzEgKiB4MSArIDQpID4+IDM7Ci0gICAgICAgIHg1ID0gKFczICogeDMgKyA0KSA+PiAzOwotICAgICAgICB4MyA9ICgtIFc1ICogeDMgKyA0KSA+PiAzOwotICAgICAgICB4OCA9IHgxIC0geDU7Ci0gICAgICAgIHgxICs9IHg1OwotICAgICAgICB4NSA9IHg4OwotICAgICAgICB4OCA9IHg3IC0geDM7Ci0gICAgICAgIHgzICs9IHg3OwotICAgICAgICB4NyA9ICgxODEgKiAoeDUgKyB4OCkgKyAxMjgpID4+IDg7Ci0gICAgICAgIHg1ID0gKDE4MSAqICh4NSAtIHg4KSArIDEyOCkgPj4gODsKLQotICAgICAgICBwcmVkX3dvcmQgPSAqKCh1aW50MzIqKShwcmVkICs9IDEyKSk7IC8qIHJlYWQgNCBieXRlcyBmcm9tIHByZWQgKi8KLSAgICAgICAgcmVzID0gKHgwICsgeDEpID4+IDE0OwotICAgICAgICBBRERfQU5EX0NMSVAxKHJlcyk7Ci0gICAgICAgIHJlczIgPSAoeDQgKyB4NykgPj4gMTQ7Ci0gICAgICAgIEFERF9BTkRfQ0xJUDIocmVzMik7Ci0gICAgICAgIGRzdF93b3JkID0gKHJlczIgPDwgOCkgfCByZXM7Ci0gICAgICAgIHJlcyA9ICh4NiArIHg1KSA+PiAxNDsKLSAgICAgICAgQUREX0FORF9DTElQMyhyZXMpOwotICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDE2KTsKLSAgICAgICAgcmVzID0gKHgyICsgeDMpID4+IDE0OwotICAgICAgICBBRERfQU5EX0NMSVA0KHJlcyk7Ci0gICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMjQpOwotICAgICAgICAqKCh1aW50MzIqKShkc3QgKz0gd2lkdGgpKSA9IGRzdF93b3JkOyAvKiBzYXZlIDQgYnl0ZXMgdG8gZHN0ICovCi0KLSAgICAgICAgcHJlZF93b3JkID0gKigodWludDMyKikocHJlZCArPSA0KSk7IC8qIHJlYWQgNCBieXRlcyBmcm9tIHByZWQgKi8KLSAgICAgICAgcmVzID0gKHgyIC0geDMpID4+IDE0OwotICAgICAgICBBRERfQU5EX0NMSVAxKHJlcyk7Ci0gICAgICAgIHJlczIgPSAoeDYgLSB4NSkgPj4gMTQ7Ci0gICAgICAgIEFERF9BTkRfQ0xJUDIocmVzMik7Ci0gICAgICAgIGRzdF93b3JkID0gKHJlczIgPDwgOCkgfCByZXM7Ci0gICAgICAgIHJlcyA9ICh4NCAtIHg3KSA+PiAxNDsKLSAgICAgICAgQUREX0FORF9DTElQMyhyZXMpOwotICAgICAgICBkc3Rfd29yZCB8PSAocmVzIDw8IDE2KTsKLSAgICAgICAgcmVzID0gKHgwIC0geDEpID4+IDE0OwotICAgICAgICBBRERfQU5EX0NMSVA0KHJlcyk7Ci0gICAgICAgIGRzdF93b3JkIHw9IChyZXMgPDwgMjQpOwotICAgICAgICAqKCh1aW50MzIqKShkc3QgKz0gNCkpID0gZHN0X3dvcmQ7IC8qIHNhdmUgNCBieXRlcyB0byBk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gPSBibGtbMV07Ci0gICAgICAgIGJsa1sxXSA9IDA7Ci0gICAgICAgIHgwID0gKChpbnQzMilibGtbMF0gPDwgOCkgKyA4MTkyOwotICAgICAgICBibGtbMF0gPSAwOyAgIC8qIGZvciBwcm9wZXIgcm91bmRpbmcgaW4gdGhlIGZvdXJ0aCBzdGFnZSAqLwotCi0gICAgICAgIC8qIGZpcnN0IHN0YWdlICovCi0gICAgICAgIHg1ID0gKFc3ICogeDQgKyA0KSA+PiAzOwotICAgICAgICB4NCA9IChXMSAqIHg0ICsgNCkgPj4gMzsKLQotICAgICAgICAvKiB0aGlyZCBzdGFnZSAqLwotICAgICAgICB4MiA9ICgxODEgKiAoeDQgKyB4NSkgKyAxMjgpID4+IDg7Ci0gICAgICAgIHgxID0gKDE4MSAqICh4NCAtIHg1KSArIDEyOCkgPj4gODsKLQotICAgICAgICAvKiBmb3VydGggc3RhZ2UgKi8KLSAgICAgICAgd29yZCA9ICgoeDAgKyB4NCkgPj4gMTQpOwotICAgICAgICBDTElQX1JFU1VMVCh3b3JkKQotCi0gICAgICAgIHRlbXAgPSAoKHgwICsgeDIpID4+IDE0KTsKLSAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKLSAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCA4KTsKLSAgICAgICAgdGVtcCA9ICgoeDAgKyB4MSkgPj4gMTQpOwotICAgICAgICBDTElQX1JFU1VMVCh0ZW1wKQotICAgICAgICB3b3JkID0gd29yZCB8ICh0ZW1wIDw8IDE2KTsKLSAgICAgICAgdGVtcCA9ICgoeDAgKyB4NSkgPj4gMTQpOwotICAgICAgICBDTElQX1JFU1VMVCh0ZW1wKQotICAgICAgICB3b3JkID0gd29yZCB8ICh0ZW1wIDw8IDI0KTsKLSAgICAgICAgKigoaW50MzIqKShjb21wICs9IG9mZnNldCkpID0gd29yZDsKLQotICAgICAgICB3b3JkID0gKCh4MCAtIHg1KSA+PiAxNCk7Ci0gICAgICAgIENMSVBfUkVTVUxUKHdvcmQpCi0gICAgICAgIHRlbXAgPSAoKHgwIC0geDEpID4+IDE0KTsKLSAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKLSAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCA4KTsKLSAgICAgICAgdGVtcCA9ICgoeDAgLSB4MikgPj4gMTQpOwotICAgICAgICBDTElQX1JFU1VMVCh0ZW1wKQotICAgICAgICB3b3JkID0gd29yZCB8ICh0ZW1wIDw8IDE2KTsKLSAgICAgICAgdGVtcCA9ICgoeDAgLSB4NCkgPj4gMTQpOwotICAgICAgICBDTElQX1JFU1VMVCh0ZW1wKQotICAgICAgICB3b3JkID0gd29yZCB8ICh0ZW1wIDw8IDI0KTsKLSAgICAgICAgKigoaW50MzIqKShjb21wICsgNCkpID0gd29yZDsKLQotICAgICAgICBibGsgKz0gQl9TSVpFOwotICAgIH0KLSAgICByZXR1cm4gOwotfQotCi12b2lkIGlkY3Ryb3czX2ludHJhKGludDE2ICpibGssIFBJWEVMICpjb21wLCBpbnQgd2lkdGgpCi17Ci0gICAgaW50MzIgeDAsIHgxLCB4MiwgeDMsIHg0LCB4NSwgeDYsIHg3LCB4OCwgdGVtcDsKLSAgICBpbnQgaSA9IDg7Ci0gICAgaW50IG9mZnNldCA9IHdpZHRoOwotICAgIGludDMyIHdvcmQ7Ci0KLSAgICBjb21wIC09IG9mZnNldDsKLQotICAgIHdoaWxlIChpLS0pCi0gICAgewotICAgICAgICB4MiA9IGJsa1syXTsKLSAgICAgICAgYmxrWzJdID0gMDsKLSAgICAgICAgeDEgPSBibGtbMV07Ci0gICAgICAgIGJsa1sxXSA9IDA7Ci0gICAgICAgIHgwID0gKChpbnQzMilibGtbMF0gPDwgOCkgKyA4MTkyOwotICAgICAgICBibGtbMF0gPSAwOy8qIGZvciBwcm9wZXIgcm91bmRpbmcgaW4gdGhlIGZvdXJ0aCBzdGFnZSAqLwotICAgICAgICAvKiBib3RoIHVwcGVyIGFuZCBsb3dlciovCi0gICAgICAgIC8qIGJvdGggeDJvcng2IGFuZCB4MG9yeDQgKi8KLQotICAgICAgICB4NCA9IHgwOwotICAgICAgICB4NiA9IChXNiAqIHgyICsgNCkgPj4gMzsKLSAgICAgICAgeDIgPSAoVzIgKiB4MiArIDQpID4+IDM7Ci0gICAgICAgIHg4ID0geDAgLSB4MjsKLSAgICAgICAgeDAgKz0geDI7Ci0gICAgICAgIHgyID0geDg7Ci0gICAgICAgIHg4ID0geDQgLSB4NjsKLSAgICAgICAgeDQgKz0geDY7Ci0gICAgICAgIHg2ID0geDg7Ci0KLSAgICAgICAgeDcgPSAoVzcgKiB4MSArIDQpID4+IDM7Ci0gICAgICAgIHgxID0gKFcxICogeDEgKyA0KSA+PiAzOwotICAgICAgICB4MyA9IHg3OwotICAgICAgICB4NSA9ICgxODEgKiAoeDEgLSB4NykgKyAxMjgpID4+IDg7Ci0gICAgICAgIHg3ID0gKDE4MSAqICh4MSArIHg3KSArIDEyOCkgPj4gODsKLQotICAgICAgICB3b3JkID0gKCh4MCArIHgxKSA+PiAxNCk7Ci0gICAgICAgIENMSVBfUkVTVUxUKHdvcmQpCi0gICAgICAgIHRlbXAgPSAoKHg0ICsgeDcpID4+IDE0KTsKLSAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKLSAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCA4KTsKLQotCi0gICAgICAgIHRlbXAgPSAoKHg2ICsgeDUpID4+IDE0KTsKLSAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKLSAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAxNik7Ci0KLSAgICAgICAgdGVtcCA9ICgoeDIgKyB4MykgPj4gMTQpOwotICAgICAgICBDTElQX1JFU1VMVCh0ZW1wKQotICAgICAgICB3b3JkID0gd29yZCB8ICh0ZW1wIDw8IDI0KTsKLSAgICAgICAgKigoaW50MzIqKShjb21wICs9IG9mZnNldCkpID0gd29yZDsKLQotICAgICAgICB3b3JkID0gKCh4MiAtIHgzKSA+PiAxNCk7Ci0gICAgICAgIENMSVBfUkVTVUxUKHdvcmQpCi0KLSAgICAgICAgdGVtcCA9ICgoeDYgLSB4NSkgPj4gMTQpOwotICAgICAgICBDTElQX1JFU1VMVCh0ZW1wKQotICAgICAgICB3b3JkID0gd29yZCB8ICh0ZW1wIDw8IDgpOwotCi0gICAgICAgIHRlbXAgPSAoKHg0IC0geDcpID4+IDE0KTsKLSAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKLSAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCAxNik7Ci0KLSAgICAgICAgdGVtcCA9ICgoeDAgLSB4MSkgPj4gMTQpOwotICAgICAgICBDTElQX1JFU1VMVCh0ZW1wKQotICAgICAgICB3b3JkID0gd29yZCB8ICh0ZW1wIDw8IDI0KTsKLSAgICAgICAgKigoaW50MzIqKShjb21wICsgNCkpID0gd29yZDsKLQotICAgICAgICBibGsgKz0gQl9TSVpFOwotICAgIH0KLSAgICByZXR1cm4gOwotfQotCi12b2lkIGlkY3Ryb3c0X2ludHJhKGludDE2ICpibGssIFBJWEVMICpjb21wLCBpbnQgd2lkdGgpCi17Ci0gICAgaW50MzIgeDAsIHgxLCB4MiwgeDMsIHg0LCB4NSwgeDYsIHg3LCB4OCwgdGVtcDsKLSAgICBpbnQgaSA9IDg7Ci0gICAgaW50IG9mZnNldCA9IHdpZHRoOwotICAgIGludDMyIHdvcmQ7Ci0KLSAgICBjb21wIC09IG9mZnNldDsKLQotICAgIHdoaWxlIChpLS0pCi0gICAgewotICAgICAgICB4MiA9IGJsa1syXTsKLSAgICAgICAgYmxrWzJdID0gMDsKLSAgICAgICAgeDEgPSBibGtbMV07Ci0gICAgICAgIGJsa1sxXSA9IDA7Ci0gICAgICAgIHgzID0gYmxrWzNdOwotICAgICAgICBibGtbM10gPSAwOwotICAgICAgICB4MCA9ICgoaW50MzIpYmxrWzBdIDw8IDgpICsgODE5MjsKLSAgICAgICAgYmxrWzBdID0gMDsvKiBmb3IgcHJvcGVyIHJvdW5kaW5nIGluIHRoZSBmb3VydGggc3RhZ2UgKi8KLQotICAgICAgICB4NCA9IHgwOwotICAgICAgICB4NiA9IChXNiAqIHgyICsgNCkgPj4gMzsKLSAgICAgICAgeDIgPSAoVzIgKiB4MiArIDQpID4+IDM7Ci0gICAgICAgIHg4ID0geDAgLSB4MjsKLSAgICAgICAgeDAgKz0geDI7Ci0gICAgICAgIHgyID0geDg7Ci0gICAgICAgIHg4ID0geDQgLSB4NjsKLSAgICAgICAgeDQgKz0geDY7Ci0gICAgICAgIHg2ID0geDg7Ci0KLSAgICAgICAgeDcgPSAoVzcgKiB4MSArIDQpID4+IDM7Ci0gICAgICAgIHgxID0gKFcxICogeDEgKyA0KSA+PiAzOwotICAgICAgICB4NSA9IChXMyAqIHgzICsgNCkgPj4gMzsKLSAgICAgICAgeDMgPSAoLSBXNSAqIHgzICsgNCkgPj4gMzsKLSAgICAgICAgeDggPSB4MSAtIHg1OwotICAgICAgICB4MSArPSB4NTsKLSAgICAgICAgeDUgPSB4ODsKLSAgICAgICAgeDggPSB4NyAtIHgzOwotICAgICAgICB4MyArPSB4NzsKLSAgICAgICAgeDcgPSAoMTgxICogKHg1ICsgeDgpICsgMTI4KSA+PiA4OwotICAgICAgICB4NSA9ICgxODEgKiAoeDUgLSB4OCkgKyAxMjgpID4+IDg7Ci0KLSAgICAgICAgd29yZCA9ICgoeDAgKyB4MSkgPj4gMTQpOwotICAgICAgICBDTElQX1JFU1VMVCh3b3JkKQotCi0gICAgICAgIHRlbXAgPSAoKHg0ICsgeDcpID4+IDE0KTsKLSAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKLSAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PCA4KTsKLQotCi0gICAgICAgIHRlbXAgPSAoKHg2ICsgeDUpID4+IDE0KTsKLSAgICAgICAgQ0xJUF9SRVNVTFQodGVtcCkKLSAgICAgICAgd29yZCA9IHdvcmQgfCAodGVtcCA8PC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aW9uIGluIGN1cnJlbnQgTUI7IG9yaWdpbiBvZiBNQiAqLwotICAgIHlwb3MgPSB2aWRlby0+bWJudW1fcm93IDw8IDQgOwotICAgIC8qIHN0YXJ0aW5nIHggcG9zaXRpb24gaW4gY3VycmVudCBNQjsgb3JpZ2luIG9mIE1CICovCi0gICAgeHBvcyA9IHZpZGVvLT5tYm51bV9jb2wgPDwgNCA7Ci0KLSAgICAvKiBvZmZzZXQgdG8gKHgseSkgcG9zaXRpb24gaW4gY3VycmVudCBsdW1pbmFuY2UgTUIgKi8KLSAgICAvKiBpbiBwaXhlbCByZXNvbHV0aW9uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAvKiB5cG9zKndpZHRoIC0+IHJvdywgK3ggLT4gY29sdW1uICovCi0gICAgb2Zmc2V0ID0gKGludDMyKXlwb3MgKiB3aWR0aCArIHhwb3M7Ci0KLSAgICAvKiBnZXQgbW9kZSBmb3IgY3VycmVudCBNQiAqLwotICAgIG1vZGUgPSB2aWRlby0+aGVhZGVySW5mby5Nb2RlW21ibnVtXTsKLQotICAgIC8qIGJsb2NrIGluZGV4ICovCi0gICAgLyogaW12ID0gKHhwb3MvOCkgKyAoKHlwb3MvOCkgKiBtdndpZHRoKSAqLwotICAgIGltdiA9IChvZmZzZXQgPj4gNikgLSAoeHBvcyA+PiA2KSArICh4cG9zID4+IDMpOwotICAgIGlmIChtb2RlICYgSU5URVJfMVZNQVNLKQotICAgIHsKLSAgICAgICAgZHggPSBweFswXSA9IHB4WzFdID0gcHhbMl0gPSBweFszXSA9IHZpZGVvLT5tb3RYW2ltdl07Ci0gICAgICAgIGR5ID0gcHlbMF0gPSBweVsxXSA9IHB5WzJdID0gcHlbM10gPSB2aWRlby0+bW90WVtpbXZdOwotICAgICAgICBpZiAoKGR4ICYgMykgPT0gMCkKLSAgICAgICAgewotICAgICAgICAgICAgZHggPSBkeCA+PiAxOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgLyogeCBjb21wb25lbnQgb2YgTVYgaXMgb3InZWQgZm9yIHJvdW5kaW5nICg/KSAqLwotICAgICAgICAgICAgZHggPSAoZHggPj4gMSkgfCAxOwotICAgICAgICB9Ci0KLSAgICAgICAgLyogeSBjb21wb25lbnQgb2YgbW90aW9uIHZlY3RvcjsgZGl2aWRlIGJ5IDIgZm9yIHRvICovCi0gICAgICAgIC8qIGNvbnZlcnQgdG8gZnVsbC1wZWwgcmVzb2x1dGlvbi4gICAgICAgICAgICAgICAgICAqLwotICAgICAgICBpZiAoKGR5ICYgMykgPT0gMCkKLSAgICAgICAgewotICAgICAgICAgICAgZHkgPSBkeSA+PiAxOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgLyogeSBjb21wb25lbnQgb2YgTVYgaXMgb3InZWQgZm9yIHJvdW5kaW5nICg/KSAqLwotICAgICAgICAgICAgZHkgPSAoZHkgPj4gMSkgfCAxOwotICAgICAgICB9Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIHB4WzBdID0gdmlkZW8tPm1vdFhbaW12XTsKLSAgICAgICAgcHhbMV0gPSB2aWRlby0+bW90WFtpbXYrMV07Ci0gICAgICAgIHB4WzJdID0gdmlkZW8tPm1vdFhbaW12K212d2lkdGhdOwotICAgICAgICBweFszXSA9IHZpZGVvLT5tb3RYW2ltdittdndpZHRoKzFdOwotICAgICAgICB4c3VtID0gcHhbMF0gKyBweFsxXSArIHB4WzJdICsgcHhbM107Ci0gICAgICAgIGR4ID0gUFZfU0lHTih4c3VtKSAqIChyb3VuZHRhYjE2WyhQVl9BQlMoeHN1bSkpICYgMHhGXSArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKChQVl9BQlMoeHN1bSkpID4+IDQpIDw8IDEpKTsKLSAgICAgICAgcHlbMF0gPSB2aWRlby0+bW90WVtpbXZdOwotICAgICAgICBweVsxXSA9IHZpZGVvLT5tb3RZW2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HksIGNfcHJldiwKLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPm1ibG9jay0+cHJlZF9ibG9jaywgd2lkdGgsIGhlaWdodCwKLSAgICAgICAgICAgICAgICAgICAgcm91bmQxLCBtdndpZHRoLCAmeHN1bSwgJnlzdW0pOyovCi0gICAgY19jb21wID0gdmlkZW8tPmN1cnJWb3AtPnlDaGFuICsgb2Zmc2V0OwotCi0KLSAgICB4cHJlZCA9IChpbnQpKCh4cG9zIDw8IDEpICsgcHhbMF0pOwotICAgIHlwcmVkID0gKGludCkoKHlwb3MgPDwgMSkgKyBweVswXSk7Ci0KLSAgICBpZiAoKENCUCA+PiA1KSYxKQotICAgIHsKLSAgICAgICAgcHJlZCA9IHByZWRfYmxvY2s7Ci0gICAgICAgIHByZWRfd2lkdGggPSAxNjsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgcHJlZCA9IGNfY29tcDsKLSAgICAgICAgcHJlZF93aWR0aCA9IHdpZHRoOwotICAgIH0KLQotICAgIC8qIGNoZWNrIHdoZXRoZXIgdGhlIE1WIHBvaW50cyBvdXRzaWRlIHRoZSBmcmFtZSAqLwotICAgIGlmICh4cHJlZCA+PSAwICYmIHhwcmVkIDw9ICgod2lkdGggPDwgMSkgLSAoMipCX1NJWkUpKSAmJgotICAgICAgICAgICAgeXByZWQgPj0gMCAmJiB5cHJlZCA8PSAoKGhlaWdodCA8PCAxKSAtICgyKkJfU0laRSkpKQotICAgIHsgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgIC8qICh4LHkpIGlzIGluc2lkZSB0aGUgZnJhbWUgKi8KLSAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICA7Ci0gICAgICAgIEdldFByZWRBZHZCVGFibGVbeXByZWQmMV1beHByZWQmMV0oY19wcmV2ICsgKHhwcmVkID4+IDEpICsgKCh5cHJlZCA+PiAxKSp3aWR0aCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlZCwgd2lkdGgsIChwcmVkX3dpZHRoIDw8IDEpIHwgcm91bmQxKTsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAvKiAoeCx5KSBpcyBvdXRzaWRlIHRoZSBmcmFtZSAqLwotICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICBHZXRQcmVkT3V0c2lkZSh4cHJlZCwgeXByZWQsIGNfcHJldiwKLSAgICAgICAgICAgICAgICAgICAgICAgcHJlZCwgd2lkdGgsIGhlaWdodCwgcm91bmQxLCBwcmVkX3dpZHRoKTsKLSAgICB9Ci0KLQotICAgIC8qIENvbXB1dGUgcHJlZGljdGlvbiB2YWx1ZXMgb3ZlciBjdXJyZW50IGx1bWluYW5jZSBNQiAqLwotICAgIC8qIChibG9ja3MgMSk7IGFkZCBtb3Rpb24gdmVjdG9yIHByaW9yIHRvIGlucHV0OyAgICAgICAqLwotICAgIC8qIGFkZCA4IHRvIHhfcG9zIHRvIGFkdmFuY2UgdG8gbmV4dCBibG9jayAgICAgICAgICovCi0gICAgeHByZWQgPSAoaW50KSgoKHhwb3MgKyBCX1NJWkUpIDw8IDEpICsgcHhbMV0pOwotICAgIHlwcmVkID0gKGludCkoKHlwb3MgPDwgMSkgKyBweVsxXSk7Ci0KLSAgICBpZiAoKENCUCA+PiA0KSYxKQotICAgIHsKLSAgICAgICAgcHJlZCA9IHByZWRfYmxvY2sgKyA4OwotICAgICAgICBwcmVkX3dpZHRoID0gMTY7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIHByZWQgPSBjX2NvbXAgKyA4OwotICAgICAgICBwcmVkX3dpZHRoID0gd2lkdGg7Ci0gICAgfQotCi0gICAgLyogY2hlY2sgd2hldGhlciB0aGUgTVYgcG9pbnRzIG91dHNpZGUgdGhlIGZyYW1lICovCi0gICAgaWYgKHhwcmVkID49IDAgJiYgeHByZWQgPD0gKCh3aWR0aCA8PCAxKSAtICgyKkJfU0laRSkpICYmCi0gICAgICAgICAgICB5cHJlZCA+PSAwICYmIHlwcmVkIDw9ICgoaGVpZ2h0IDw8IDEpIC0gKDIqQl9TSVpFKSkpCi0gICAgeyAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgLyogKHgseSkgaXMgaW5zaWRlIHRoZSBmcmFtZSAqLwotICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgIEdldFByZWRBZHZCVGFibGVbeXByZWQmMV1beHByZWQmMV0oY19wcmV2ICsgKHhwcmVkID4+IDEpICsgKCh5cHJlZCA+PiAxKSp3aWR0aCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlZCwgd2lkdGgsIChwcmVkX3dpZHRoIDw8IDEpIHwgcm91bmQxKTsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAvKiAoeCx5KSBpcyBvdXRzaWRlIHRoZSBmcmFtZSAqLwotICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICBHZXRQcmVkT3V0c2lkZSh4cHJlZCwgeXByZWQsIGNfcHJldiwKLSAgICAgICAgICAgICAgICAgICAgICAgcHJlZCwgd2lkdGgsIGhlaWdodCwgcm91bmQxLCBwcmVkX3dpZHRoKTsKLSAgICB9Ci0KLQotCi0gICAgLyogQ29tcHV0ZSBwcmVkaWN0aW9uIHZhbHVlcyBvdmVyIGN1cnJlbnQgbHVtaW5hbmNlIE1CICovCi0gICAgLyogKGJsb2NrcyAyKTsgYWRkIG1vdGlvbiB2ZWN0b3IgcHJpb3IgdG8gaW5wdXQgICAgICAgICovCi0gICAgLyogYWRkIDggdG8geV9wb3MgdG8gYWR2YW5jZSB0byBibG9jayBvbiBuZXh0IHJvdyAgICAgICovCi0gICAgeHByZWQgPSAoaW50KSgoeHBvcyA8PCAxKSArIHB4WzJdKTsKLSAgICB5cHJlZCA9IChpbnQpKCgoeXBvcyArIEJfU0laRSkgPDwgMSkgKyBweVsyXSk7Ci0KLSAgICBpZiAoKENCUCA+PiAzKSYxKQotICAgIHsKLSAgICAgICAgcHJlZCA9IHByZWRfYmxvY2sgKyAxMjg7Ci0gICAgICAgIHByZWRfd2lkdGggPSAxNjsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgcHJlZCA9IGNfY29tcCArICh3aWR0aCA8PCAzKTsKLSAgICAgICAgcHJlZF93aWR0aCA9IHdpZHRoOwotICAgIH0KLQotICAgIC8qIGNoZWNrIHdoZXRoZXIgdGhlIE1WIHBvaW50cyBvdXRzaWRlIHRoZSBmcmFtZSAqLwotICAgIGlmICh4cHJlZCA+PSAwICYmIHhwcmVkIDw9ICgod2lkdGggPDwgMSkgLSAoMipCX1NJWkUpKSAmJgotICAgICAgICAgICAgeXByZWQgPj0gMCAmJiB5cHJlZCA8PSAoKGhlaWdodCA8PCAxKSAtICgyKkJfU0laRSkpKQotICAgIHsgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgIC8qICh4LHkpIGlzIGluc2lkZSB0aGUgZnJhbWUgKi8KLSAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICBHZXRQcmVkQWR2QlRhYmxlW3lwcmVkJjFdW3hwcmVkJjFdKGNfcHJldiArICh4cHJlZCA+PiAxKSArICgoeXByZWQgPj4gMSkqd2lkdGgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCAocHJlZF93aWR0aCA8PCAxKSB8IHJvdW5kMSk7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7ICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgLyogKHgseSkgaXMgb3V0c2lkZSB0aGUgZnJhbWUgKi8KLSAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgR2V0UHJlZE91dHNpZGUoeHByZWQsIHlwcmVkLCBjX3ByZXYsCi0gICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCBoZWlnaHQsIHJvdW5kMSwgcHJlZF93aWR0aCk7Ci0gICAgfQotCi0KLQotICAgIC8qIENvbXB1dGUgcHJlZGljdGlvbiB2YWx1ZXMgb3ZlciBjdXJyZW50IGx1bWluYW5jZSBNQiAqLwotICAgIC8qIChibG9ja3MgMyk7IGFkZCBtb3Rpb24gdmVjdG9yIHByaW9yIHRvIGlucHV0OyAgICAgICAqLwotICAgIC8qIGFkZCA4IHRvIHhfcG9zIGFuZCB5X3BvcyB0byBhZHZhbmNlIHRvIG5leHQgYmxvY2sgICAqLwotICAgIC8qIG9uIG5leHQgcm93ICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgeHByZWQgPSAoaW50KSgoKHhwb3MgKyBCX1NJWkUpIDw8IDEpICsgcHhbM10pOwotICAgIHlwcmVkID0gKGludCkoKCh5cG9zICsgQl9TSVpFKSA8PCAxKSArIHB5WzNdKTsKLQotICAgIGlmICgoQ0JQID4+IDIpJjEpCi0gICAgewotICAgICAgICBwcmVkID0gcHJlZF9ibG9jayArIDEzNjsKLSAgICAgICAgcHJlZF93aWR0aCA9IDE2OwotICAgIH0KLSAgICBlbHNlCi0gICAgewotICAgICAgICBwcmVkID0gY19jb21wICsgKHdpZHRoIDw8IDMpICsgODsKLSAgICAgICAgcHJlZF93aWR0aCA9IHdpZHRoOwotICAgIH0KLQotICAgIC8qIGNoZWNrIHdoZXRoZXIgdGhlIE1WIHBvaW50cyBvdXRzaWRlIHRoZSBmcmFtZSAqLwotICAgIGlmICh4cHJlZCA+PSAwICYmIHhwcmVkIDw9ICgod2lkdGggPDwgMSkgLSAoMipCX1NJWkUpKSAmJgotICAgICAgICAgICAgeXByZWQgPj0gMCAmJiB5cHJlZCA8PSAoKGhlaWdodCA8PCAxKSAtICgyKkJfU0laRSkpKQotICAgIHsgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgIC8qICh4LHkpIGlzIGluc2lkZSB0aGUgZnJhbWUgKi8KLSAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICBHZXRQcmVkQWR2QlRhYmxlW3lwcmVkJjFdW3hwcmVkJjFdKGNfcHJldiArICh4cHJlZCA+PiAxKSArICgoeXByZWQgPj4gMSkqd2lkdGgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCAocHJlZF93aWR0aCA8PCAxKSB8IHJvdW5kMSk7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7ICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgLyogKHgseSkgaXMgb3V0c2lkZSB0aGUgZnJhbWUgKi8KLSAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgR2V0UHJlZE91dHNpZGUoeHByZWQsIHlwcmVkLCBjX3ByZXYsCi0gICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCBoZWlnaHQsIHJvdW5kMSwgcHJlZF93aWR0aCk7Ci0gICAgfQotICAgIC8qIENhbGwgZnVuY3Rpb24gdG8gc2V0IGRlLWJsb2NraW5nIGFuZCBkZS1yaW5naW5nICovCi0gICAgLyogICBzZW1hcGhvcmVzIGZvciBsdW1pbmFuY2UgICAgICAgICAgICAgICAgICAgICAgKi8KLQotI2lmZGVmIFBWX1BPU1RQUk9DX09OCi0gICAgaWYgKHZpZGVvLT5wb3N0RmlsdGVyVHlwZSAhPSBQVl9OT19QT1NUX1BST0MpCi0gICAgewotICAgICAgICBpZiAobW9kZSZJTlRFUl8xVk1BU0spCi0gICAgICAgIHsKLSAgICAgICAgICAgIHBwX2RlY195ID0gdmlkZW8tPnBzdHByY1R5cEN1ciArIGltdjsKLSAgICAgICAgICAgIGxsWzBdID0gMTsKLSAgICAgICAgICAgIGxsWzFdID0gbXZ3aWR0aCAtIDE7Ci0gICAgICAgICAgICBsbFsyXSA9IDE7Ci0gICAgICAgICAgICBsbFszXSA9IC1tdndpZHRoIC0gMTsKLSAgICAgICAgICAgIG1za19kZWJsb2NrID0gcHBfc2VtYXBob3JlX2x1bWEoeHByZWQsIHlwcmVkLCBwcF9kZWNfeSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnBzdHByY1R5cFBydiwgbGwsICZ0bXAsIHB4WzBdLCBweVswXSwgbXZ3aWR0aCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGgsIGhlaWdodCk7Ci0KLSAgICAgICAgICAgIHBwX2RlY191ID0gdmlkZW8tPnBzdHByY1R5cEN1ciArIChzaXplID4+IDYpICsKLSAgICAgICAgICAgICAgICAgICAgICAgKChpbXYgKyAoeHBvcyA+PiAzKSkgPj4gMik7Ci0KLSAgICAgICAgICAgIHBwX3NlbWFwaG9yZV9jaHJvbWFfaW50ZXIoeHByZWQsIHlwcmVkLCBwcF9kZWNfdSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnBzdHByY1R5cFBydiwgZHgsIGR5LCBtdndpZHRoLCBoZWlnaHQsIHNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRtcCwgbXNrX2RlYmxvY2spOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgLyogUG9zdC1wcm9jZXNzaW5nIG1vZGUgKE1CTV9JTlRFUjgpICovCi0gICAgICAgICAgICAvKiBkZWJsb2NraW5nIGFuZCBkZXJpbmdpbmcpICovCi0gICAgICAgICAgICBwcF9kZWNf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SAgICAvKiB4IHBvc2l0aW9uIGluIHByZWRpY3Rpb24gZGF0YSBvZmZzZXQgYnkgbW90aW9uIHZlY3RvciAqLwotICAgIC8qIHhwcmVkIGNhbGN1bGF0aW9uIGZvciBDaHJvbWluYW5jZSBpcyBpbiBmdWxsLXBlbCAgICAgICovCi0gICAgLyogcmVzb2x1dGlvbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICB4cHJlZCA9IHhwb3MgKyBkeDsKLQotICAgIC8qIHkgcG9zaXRpb24gaW4gcHJlZGljdGlvbiBkYXRhIG9mZnNldCBieSBtb3Rpb24gdmVjdG9yICovCi0gICAgLyogeXByZWQgY2FsY3VsYXRpb24gZm9yIENocm9taW5hbmNlIGlzIGluIGZ1bGwtcGVsICAgICAgKi8KLSAgICAvKiByZXNvbHV0aW9uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIHlwcmVkID0geXBvcyArIGR5OwotCi0gICAgY3VfY29tcCA9IHZpZGVvLT5jdXJyVm9wLT51Q2hhbiArIChvZmZzZXQgPj4gMikgKyAoeHBvcyA+PiAyKTsKLSAgICBjdl9jb21wID0gdmlkZW8tPmN1cnJWb3AtPnZDaGFuICsgKG9mZnNldCA+PiAyKSArICh4cG9zID4+IDIpOwotCi0gICAgLyogQ2FsbCBmdW5jdGlvbiB0aGF0IHBlcmZvcm1zIGNocm9taW5hbmNlIHByZWRpY3Rpb24gKi8KLSAgICAvKiAgICAgIGNocm9taW5hbmNlX3ByZWQoeHByZWQsIHlwcmVkLCBjdV9wcmV2LCBjdl9wcmV2LAotICAgICAgICAgICAgcHJlZF9ibG9jaywgd2lkdGhfdXYsIGhlaWdodF91diwKLSAgICAgICAgICAgIHJvdW5kMSk7Ki8KLSAgICBpZiAoeHByZWQgPj0gMCAmJiB4cHJlZCA8PSAoKHdpZHRoIDw8IDEpIC0gKDIqQl9TSVpFKSkgJiYgeXByZWQgPj0gMCAmJgotICAgICAgICAgICAgeXByZWQgPD0gKChoZWlnaHQgPDwgMSkgLSAoMipCX1NJWkUpKSkKLSAgICB7Ci0gICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgLyogKHgseSkgaXMgaW5zaWRlIHRoZSBmcmFtZSAqLwotICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgIGlmICgoQ0JQID4+IDEpJjEpCi0gICAgICAgIHsKLSAgICAgICAgICAgIHByZWQgPSBwcmVkX2Jsb2NrICsgMjU2OwotICAgICAgICAgICAgcHJlZF93aWR0aCA9IDE2OwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgcHJlZCA9IGN1X2NvbXA7Ci0gICAgICAgICAgICBwcmVkX3dpZHRoID0gd2lkdGg7Ci0gICAgICAgIH0KLQotICAgICAgICAvKiBDb21wdXRlIHByZWRpY3Rpb24gZm9yIENocm9taW5hbmNlIGIgKGJsb2NrWzRdKSAqLwotICAgICAgICBHZXRQcmVkQWR2QlRhYmxlW3lwcmVkJjFdW3hwcmVkJjFdKGN1X3ByZXYgKyAoeHByZWQgPj4gMSkgKyAoKHlwcmVkID4+IDEpKndpZHRoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVkLCB3aWR0aCwgKHByZWRfd2lkdGggPDwgMSkgfCByb3VuZDEpOwotCi0gICAgICAgIGlmIChDQlAmMSkKLSAgICAgICAgewotICAgICAgICAgICAgcHJlZCA9IHByZWRfYmxvY2sgKyAyNjQ7Ci0gICAgICAgICAgICBwcmVkX3dpZHRoID0gMTY7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICBwcmVkID0gY3ZfY29tcDsKLSAgICAgICAgICAgIHByZWRfd2lkdGggPSB3aWR0aDsKLSAgICAgICAgfQotICAgICAgICAvKiBDb21wdXRlIHByZWRpY3Rpb24gZm9yIENocm9taW5hbmNlIHIgKGJsb2NrWzVdKSAqLwotICAgICAgICBHZXRQcmVkQWR2QlRhYmxlW3lwcmVkJjFdW3hwcmVkJjFdKGN2X3ByZXYgKyAoeHByZWQgPj4gMSkgKyAoKHlwcmVkID4+IDEpKndpZHRoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVkLCB3aWR0aCwgKHByZWRfd2lkdGggPDwgMSkgfCByb3VuZDEpOwotCi0gICAgICAgIHJldHVybiA7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgIC8qICh4LHkpIGlzIG91dHNpZGUgdGhlIGZyYW1lICovCi0gICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgIGlmICgoQ0JQID4+IDEpJjEpCi0gICAgICAgIHsKLSAgICAgICAgICAgIHByZWQgPSBwcmVkX2Jsb2NrICsgMjU2OwotICAgICAgICAgICAgcHJlZF93aWR0aCA9IDE2OwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgcHJlZCA9IGN1X2NvbXA7Ci0gICAgICAgICAgICBwcmVkX3dpZHRoID0gd2lkdGg7Ci0gICAgICAgIH0KLQotICAgICAgICAvKiBDb21wdXRlIHByZWRpY3Rpb24gZm9yIENocm9taW5hbmNlIGIgKGJsb2NrWzRdKSAqLwotICAgICAgICBHZXRQcmVkT3V0c2lkZSh4cHJlZCwgeXByZWQsICAgIGN1X3ByZXYsCi0gICAgICAgICAgICAgICAgICAgICAgIHByZWQsIHdpZHRoLCBoZWlnaHQsIHJvdW5kMSwgcHJlZF93aWR0aCk7Ci0KLSAgICAgICAgaWYgKENCUCYxKQotICAgICAgICB7Ci0gICAgICAgICAgICBwcmVkID0gcHJlZF9ibG9jayArIDI2NDsKLSAgICAgICAgICAgIHByZW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x1bWluYW5jZV9wcmVkX21vZGVfaW50ZXIoCi0gICAgICAgIGludCB4cHJlZCwgICAgICAgICAgLyogaSAqLwotICAgICAgICBpbnQgeXByZWQsICAgICAgICAgIC8qIGkgKi8KLSAgICAgICAgdWludDggKmNfcHJldiwgICAgICAvKiBpICovCi0gICAgICAgIHVpbnQ4ICpwcmVkX2Jsb2NrLCAgLyogaSAqLwotICAgICAgICBpbnQgd2lkdGgsICAgICAgICAgIC8qIGkgKi8KLSAgICAgICAgaW50IGhlaWdodCwgICAgICAgICAvKiBpICovCi0gICAgICAgIGludCByb3VuZDEKLSAgICApOwotCi0gICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi0gICAgLyogZGVmaW5lZCBpbiBsdW1pbmFuY2VfcHJlZF9tb2RlX2ludGVyNHYuYyAqLwotICAgIHZvaWQgbHVtaW5hbmNlX3ByZWRfbW9kZV9pbnRlcjR2KAotICAgICAgICBpbnQgeHBvcywgICAgICAgICAgIC8qIGkgKi8KLSAgICAgICAgaW50IHlwb3MsICAgICAgICAgICAvKiBpICovCi0gICAgICAgIE1PVCAqcHgsICAgICAgICAgICAgLyogaSAqLwotICAgICAgICBNT1QgKnB5LCAgICAgICAgICAgIC8qIGkgKi8KLSAgICAgICAgdWludDggKmNfcHJldiwgICAgICAvKiBpICovCi0gICAgICAgIHVpbnQ4ICpwcmVkX2Jsb2NrLCAgLyogaSAqLwotICAgICAgICBpbnQgd2lkdGgsICAgICAgICAgIC8qIGkgKi8KLSAgICAgICAgaW50IGhlaWdodCwgICAgICAgICAvKiBpICovCi0gICAgICAgIGludCByb3VuZDEsICAgICAgICAgLyogaSAqLwotICAgICAgICBpbnQgbXZ3aWR0aCwgICAgICAgICAgICAvKiBpICovCi0gICAgICAgIGludCAqeHN1bV9wdHIsICAgICAgICAgIC8qIGkvbyAqLwotICAgICAgIC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IGkgKi8KLSAgICAgICAgdWludDggICAqcHBfZGVjX3ksICAvKiBpL28gKi8KLSAgICAgICAgdWludDggICAqcHN0cHJjVHlwUHJ2LCAgLyogaSAqLwotICAgICAgICBpbnQgKmxsLCAgICAgICAgLyogaSAqLwotICAgICAgICBpbnQgKm12X2xvYywgICAgLyogaS9vICovCi0gICAgICAgIGludCBkeCwgICAgIC8qIGkgKi8KLSAgICAgICAgaW50IGR5LCAgICAgLyogaSAqLwotICAgICAgICBpbnQgbXZ3aWR0aCwgICAgLyogaSAqLwotICAgICAgICBpbnQgd2lkdGgsICAgICAgLyogaSAqLwotICAgICAgICBpbnQgaGVpZ2h0ICAgICAgLyogaSAqLwotICAgICk7Ci0jZW5kaWYKLSAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLSAgICAvKiBkZWZpbmVkIGluIGdldF9wcmVkX2Fkdl9tYl9hZGQuYyAqLwotICAgIGludCBHZXRQcmVkQWR2YW5jZWRNQigKLSAgICAgICAgaW50IHhwb3MsCi0gICAgICAgIGludCB5cG9zLAotICAgICAgICB1aW50OCAqY19wcmV2LAotICAgICAgICB1aW50OCAqcHJlZF9ibG9jaywKLSAgICAgICAgaW50IHdpZHRoLAotICAgICAgICBpbnQgcm5kMQotICAgICk7Ci0KLSAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLSAgICAvKiBkZWZpbmVkIGluIGdldF9wcmVkX2Fkdl9iX2FkZC5jICovCi0gICAgaW50IEdldFByZWRBZHZhbmNlZEJ5MHgwKAotICAgICAgICB1aW50OCAqY19wcmV2LCAgICAgIC8qIGkgKi8KLSAgICAgICAgdWludDggKnByZWRfYmxvY2ssICAgICAgLyogaSAqLwotICAgICAgICBpbnQgd2lkdGgsICAgICAgLyogaSAqLwotICAgICAgICBpbnQgcHJlZF93aWR0aF9ybmQgLyogaSAqLwotICAgICk7Ci0KLSAgICBpbnQgR2V0UHJlZEFkdmFuY2VkQnkweDEoCi0gICAgICAgIHVpbnQ4ICpjX3ByZXYsICAgICAgLyogaSAqLwotICAgICAgICB1aW50OCAqcHJlZF9ibG9jaywgICAgICAvKiBpICovCi0gICAgICAgIGludCB3aWR0aCwgICAgICAvKiBpICovCi0gICAgICAgIGludCBwcmVkX3dpZHRoX3JuZCAvKiBpICovCi0gICAgKTsKLQotICAgIGludCBHZXRQcmVkQWR2YW5jZWRCeTF4MCgKLSAgICAgICAgdWludDggKmNfcHJldiwgICAgICAvKiBpICovCi0gICAgICAgIHVpbnQ4ICpwcmVkX2Jsb2NrLCAgICAgIC8qIGkgKi8KLSAgICAgICAgaW50IHdpZHRoLCAgICAgIC8qIGkgKi8KLSAgICAgICAgaW50IHByZWRfd2lkdGhfcm5kIC8qIGkgKi8KLSAgICApOwotCi0gICAgaW50IEdldFByZWRBZHZhbmNlZEJ5MXgxKAotICAgICAgICB1aW50OCAqY19wcmV2LCAgICAgIC8qIGkgKi8KLSAgICAgICAgdWludDggKnByZWRfYmxvY2ssICAgICAgLyogaSAqLwotICAgICAgICBpbnQgd2lkdGgsICAgICAgLyogaSAqLwotICAgICAgICBpbnQgcHJlZF93aWR0aF9ybmQgLyogaSAqLwotICAgICk7Ci0KLSAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi8KLSAgICAvKiBkZWZpbmVkIGluIGdldF9wcmVkX291dHNpZGUuYyAqLwotICAgIGludCBHZXRQcmVkT3V0c2lkZSgKLSAgICAgICAgaW50IHhwb3MsCi0gICAgICAgIGludCB5cG9zLAotICAgICAgICB1aW50OCAqY19wcmV2LAotICAgICAgICB1aW50OC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1hcGhvcmUoaW50MTYgKnFfYmxvY2spOwotICAgIHZvaWQgUG9zdEZpbHRlcihWaWRlb0RlY0RhdGEgKnZpZGVvLCBpbnQgZmlsZXJfdHlwZSwgdWludDggKm91dHB1dCk7Ci0gICAgdm9pZCBGaW5kTWF4TWluKHVpbnQ4ICpwdHIsIGludCAqbWluLCBpbnQgKm1heCwgaW50IGluY3IpOwotICAgIHZvaWQgRGVyaW5nQWRhcHRpdmVTbW9vdGhNTVgodWludDggKmltZywgaW50IGluY3IsIGludCB0aHJlcywgaW50IG14ZGYpOwotICAgIHZvaWQgQWRhcHRpdmVTbW9vdGhfTm9NTVgodWludDggKlJlY19ZLCBpbnQgdjAsIGludCBoMCwgaW50IHZfYmxrLCBpbnQgaF9ibGssCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgdGhyLCBpbnQgd2lkdGgsIGludCBtYXhfZGlmZik7Ci0gICAgdm9pZCBEZXJpbmdpbmdfTHVtYSh1aW50OCAqUmVjX1ksIGludCB3aWR0aCwgaW50IGhlaWdodCwgaW50MTYgKlFQX3N0b3JlLAotICAgICAgICAgICAgICAgICAgICAgICAgaW50IENvbWJpbmVkLCB1aW50OCAqcHBfbW9kKTsKLSAgICB2b2lkIERlcmluZ2luZ19DaHJvbWEodWludDggKlJlY19DLCBpbnQgd2lkdGgsIGludCBoZWlnaHQsIGludDE2ICpRUF9zdG9yZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IENvbWJpbmVkLCB1aW50OCAqcHBfbW9kKTsKLSAgICB2b2lkIENvbWJpbmVkSG9yelZlcnRGaWx0ZXIodWludDggKnJlYywgaW50IHdpZHRoLCBpbnQgaGVpZ2h0LCBpbnQxNiAqUVBfc3RvcmUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBjaHIsIHVpbnQ4ICpwcF9tb2QpOwotICAgIHZvaWQgQ29tYmluZWRIb3J6VmVydEZpbHRlcl9Ob1NvZnREZWJsb2NraW5nKH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gaW4gdmxjX2RlcXVhbnQuYyAsICAwOS8xOC8yMDAwKi8KLSNpZmRlZiBQVl9TVVBQT1JUX01BSU5fUFJPRklMRQotICAgIGludCBWbGNEZXF1YW50TXBlZ0ludHJhQmxvY2sodm9pZCAqdmlkZW8sIGludCBjb21wLCBpbnQgc3dpdGNoZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50OCAqYml0bWFwY29sLCB1aW50OCAqYml0bWFwcm93KTsKLSAgICBpbnQgVmxjRGVxdWFudE1wZWdJbnRlckJsb2NrKHZvaWQgKnZpZGVvLCBpbnQgY29tcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ4ICpiaXRtYXBjb2wsIHVpbnQ4ICpiaXRtYXByb3cpOwotI2VuZGlmCi0gICAgaW50IFZsY0RlcXVhbnRIMjYzSW50cmFCbG9jayhWaWRlb0RlY0RhdGEgKnZpZGVvLCBpbnQgY29tcCwgaW50IHN3aXRjaGVkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDggKmJpdG1hcGNvbCwgdWludDggKmJpdG1hcHJvdyk7Ci0gICAgaW50IFZsY0RlcXVhbnRIMjYzSW50cmFCbG9ja19TSChWaWRlb0RlY0RhdGEgKnZpZGVvLCBpbnQgY29tcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ4ICpiaXRtYXBjb2wsIHVpbnQ4ICpiaXRtYXByb3cpOwotICAgIGludCBWbGNEZXF1YW50SDI2M0ludGVyQmxvY2soVmlkZW9EZWNEYXRhICp2aWRlbywgaW50IGNvbXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50OCAqYml0bWFwY29sLCB1aW50OCAqYml0bWFwcm93KTsKLQotI2lmZGVmIF9fY3BsdXNwbHVzCi19Ci0jZW5kaWYgLyogX19jcGx1c3BsdXMgKi8KLQotLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tL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IChmaWx0ZXJfdHlwZSAmIFBWX0RFUklORykpCi0gICAgewotICAgICAgICBDb21iaW5lZEhvcnpWZXJ0UmluZ0ZpbHRlcihvdXRwdXQsIHdpZHRoLCBoZWlnaHQsIFFQX3N0b3JlLCAwLCBwcF9tb2QpOwotICAgIH0KLSAgICBlbHNlCi0gICAgewotICAgICAgICBpZiAoZmlsdGVyX3R5cGUgJiBQVl9ERUJMT0NLKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAoc29mdERlYmxvY2tpbmcpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgQ29tYmluZWRIb3J6VmVydEZpbHRlcihvdXRwdXQsIHdpZHRoLCBoZWlnaHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBRUF9zdG9yZSwgMCwgcHBfbW9kKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBDb21iaW5lZEhvcnpWZXJ0RmlsdGVyX05vU29mdERlYmxvY2tpbmcob3V0cHV0LCB3aWR0aCwgaGVpZ2h0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBRUF9zdG9yZSwgMCwgcHBfbW9kKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBpZiAoZmlsdGVyX3R5cGUgJiBQVl9ERVJJTkcpCi0gICAgICAgIHsKLSAgICAgICAgICAgIERlcmluZ2luZ19MdW1hKG91dHB1dCwgd2lkdGgsIGhlaWdodCwgUVBfc3RvcmUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBjb21iaW5lZF93aXRoX2RlYmxvY2tfZmlsdGVyLCBwcF9tb2QpOwotCi0gICAgICAgIH0KLSAgICB9Ci0KLSAgICAvKiBDaHJvbWEgKi8KLQotICAgIHBwX21vZCArPSAoblRvdGFsTUIgPDwgMik7Ci0gICAgb3V0cHV0ICs9IHNpemU7Ci0KLSAgICBpZiAoKGZpbHRlcl90eXBlICYgUFZfREVCTE9DSykgJiYgKGZpbHRlcl90eXBlICYgUFZfREVSSU5HKSkKLSAgICB7Ci0gICAgICAgIENvbWJpbmVkSG9yelZlcnRSaW5nRmlsdGVyKG91dHB1dCwgKGludCkod2lkdGggPj4gMSksIChpbnQpKGhlaWdodCA+PiAxKSwgUVBfc3RvcmUsIChpbnQpIDEsIHBwX21vZCk7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIGlmIChmaWx0ZXJfdHlwZSAmIFBWX0RFQkxPQ0spCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmIChzb2Z0RGVibG9ja2luZykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBDb21iaW5lZEhvcnpWZXJ0RmlsdGVyKG91dHB1dCwgKGludCkod2lkdGggPj4gMSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50KShoZWlnaHQgPj4gMSksIFFQX3N0b3JlLCAoaW50KSAxLCBwcF9tb2QpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIENvbWJpbmVkSG9yelZlcnRGaWx0ZXJfTm9Tb2Z0RGVibG9ja2luZyhvdXRwdXQsIChpbnQpKHdpZHRoID4+IDEpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50KShoZWlnaHQgPj4gMSksIFFQX3N0b3JlLCAoaW50KSAxLCBwcF9tb2QpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGlmIChmaWx0ZXJfdHlwZSAmIFBWX0RFUklORykKLSAgICAgICAgewotICAgICAgICAgICAgRGVyaW5naW5nX0Nocm9tYShvdXRwdXQsIChpbnQpKHdpZHRoID4+IDEpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50KShoZWlnaHQgPj4gMSksIFFQX3N0b3JlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21iaW5lZF93aXRoX2RlYmxvY2tfZmlsdGVyLCBwcF9tb2QpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHBfbW9kICs9IG5Ub3RhbE1COwotICAgIG91dHB1dCArPSAoc2l6ZSA+PiAyKTsKLQotICAgIGlmICgoZmlsdGVyX3R5cGUgJiBQVl9ERUJMT0NLKSAmJiAoZmlsdGVyX3R5cGUgJiBQVl9ERVJJTkcpKQotICAgIHsKLSAgICAgICAgQ29tYmluZWRIb3J6VmVydFJpbmdGaWx0ZXIob3V0cHV0LCAoaW50KSh3aWR0aCA+PiAxKSwgKGludCkoaGVpZ2h0ID4+IDEpLCBRUF9zdG9yZSwgKGludCkgMSwgcHBfbW9kKTsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgaWYgKGZpbHRlcl90eXBlICYgUFZfREVCTE9DSykKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKHNvZnREZWJsb2NraW5nKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIENvbWJpbmVkSG9yelZlcnRGaWx0ZXIob3V0cHV0LCAoaW50KSh3aWR0aCA+PiAxKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpKGhlaWdodCA+PiAxKSwgUVBfc3RvcmUsIChpbnQpIDEsIHBwX21vZCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgQ29tYmluZWRIb3J6VmVydEZpbHRlcl9Ob1NvZnREZWJsb2NraW5nKG91dHB1dCwgKGludCkod2lkdGggPj4gMSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpKGhlaWdodCA+PiAxKSwgUVBfc3RvcmUsIChpbnQpIDEsIHBwX21vZCk7Ci0gICAgICAgICAgIC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qKioqKiogVkVSVElDQUwgRklMVEVSSU5HICoqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgLyogdmVydGljYWwgZmlsdGVyaW5nIG9mIG1pZCBzZWN0aW9ucyBubyBuZWVkIHRvIGNoZWNrIG5laWdoYm9yaW5nIFFQJ3MgZXRjICovCi0gICAgaWYgKCFjaHIpCi0gICAgewotICAgICAgICByZWNfeSA9IHJlYyArICh3aWR0aCA8PCAzKTsKLSAgICAgICAgZm9yIChpID0gMDsgaSA8IChoZWlnaHQgPj4gNCk7IGkrKykKLSAgICAgICAgewotICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8ICh3aWR0aCA+PiA0KTsgaisrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmIChtb2RlW21ibnVtXSAhPSBNT0RFX1NLSVBQRUQpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBrID0gMTY7Ci0gICAgICAgICAgICAgICAgICAgIHN0cmVuZ3RoID0gU1RSRU5HVEhfdGFiW1FQX3N0b3JlW21ibnVtXV07Ci0gICAgICAgICAgICAgICAgICAgIHdoaWxlIChrLS0pCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIEEgPSAgKihyZWNfeSAtIHdpZHRoMik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBEID0gKihyZWNfeSArIHdpZHRoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIEFfRCA9IEEgLSBEOwotICAgICAgICAgICAgICAgICAgICAgICAgQyA9ICpyZWNfeTsKLSAgICAgICAgICAgICAgICAgICAgICAgIEIgPSAqKHJlY195IC0gd2lkdGgpOwotICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICgoKEMgLSBCKSA8PCAyKSArIEFfRCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkIDwgMCkKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IC0oLWQgPj4gMyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQxIDwgLShzdHJlbmd0aCA8PCAxKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZDEgPCAtc3RyZW5ndGgpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IC1kMSAtIChzdHJlbmd0aCA8PCAxKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZDFfMiA9IC1kMSA+PiAxOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gZCA+PiAzOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkMSA+IChzdHJlbmd0aCA8PCAxKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZDEgPiBzdHJlbmd0aCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gKHN0cmVuZ3RoIDw8IDEpIC0gZDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxXzIgPSBkMSA+PiAxOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoQV9EIDwgMCkKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMiA9IC0oLUFfRCA+PiAyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDIgPCAtZDFfMikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQyID0gLWQxXzI7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQyID0gQV9EID4+IDI7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQyID4gZDFfMikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQyID0gZDFfMjsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICoocmVjX3kgLSB3aWR0aDIpID0gQSAtIGQyOwotICAgICAgICAgICAgICAgICAgICAgICAgdG1wdmFyID0gQiArIGQxOwotICAgICAgICAgICAgICAgICAgICAgICAgQ0xJUF9SRVNVTFQodG1wdmFyKQotICAgICAgICAgICAgICAgICAgICAgICAgKihyZWNfeSAtIHdpZHRoKSA9IHRtcHZhcjsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRtcHZhciA9IEMgLSBkMTsKLSAgICAgICAgICAgICAgICAgICAgICAgIENMSVBfUkVTVUxUKHRtcHZhcikKLSAgICAgICAgICAgICAgICAgICAgICAgICpyZWNfeSA9IHRtcHZhcjsKLSAgICAgICAgICAgICAgICAgICAgICAgICoocmVjX3kgKyB3aWR0aCkgPSBEICsgZDI7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZWNfeSsrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJlY195ICs9IGJfc2l6ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbWJudW0rKzsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJlY195ICs9ICgxNSAqIHdpZHRoKTsKLQotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyogVkVSVElDQUwgYm91bmRhcnkgYmxvY2tzICovCi0KLQotICAgIHJlY195ID0gcmVjICsgd2lkdGggKiBiX3NpemU7Ci0KLSAgICBtYm51bSA9IG5NQlBlclJvdzsKLSAgICBmb3IgKGkgPSAwOyBpIDwgbk1CUGVyQ29sIC0gMTsgaSsrKQotICAgIHsKLSAgICAgICAgZm9yIChqID0gMDsgaiA8IG5NQlBlclJvdzsgaisrKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAobW9kZVttYm51bV0gIT0gTU9ERV9TS0lQUEVEIHx8IG1vZGVbbWJudW0gLSBuTUJQZXJSb3ddICE9IE1PREVfU0tJUFBFRCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBrID0gYl9zaXplOwotICAgICAgICAgICAgICAgIGlmIChtb2RlW21ibnVtXSAhPSBNT0RFX1NLSVBQRUQpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBzdHJlbmd0aCA9IFNUUkVOR1RIX3RhYlsoYW5uZXhfVCA/ICBNUV9jaHJvbWFfUVBfdGFibGVbUVBfc3RvcmVbbWJudW1dXSA6IFFQX3N0b3JlW21ibnVtXSldOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBzdHJlbmd0aCA9IFNUUkVOR1RIX3RhYlsoYW5uZXhfVCA/ICBNUV9jaHJvbWFfUVBfdGFibGVbUVBfc3RvcmVbbWJudW0gLSBuTUJQZXJSb3ddXSA6IFFQX3N0b3JlW21ibnVtIC0gbk1CUGVyUm93XSldOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIHdoaWxlIChrLS0pCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBBID0gICoocmVjX3kgLSB3aWR0aDIpOwotICAgICAgICAgICAgICAgICAgICBEID0gICoocmVjX3kgKyB3aWR0aCk7Ci0gICAgICAgICAgICAgICAgICAgIEFfRCA9IEEgLSBEOwotICAgICAgICAgICAgICAgICAgICBDID0gKnJlY195OwotICAgICAgICAgICAgICAgICAgICBCID0gKihyZWNfeSAtIHdpZHRoKTsKLSAgICAgICAgICAgICAgICAgICAgZCA9ICgoKEMgLSBCKSA8PCAyKSArIEFfRCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGQgPCAwKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBkMSA9IC0oLWQgPj4gMyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDEgPCAtKHN0cmVuZ3RoIDw8IDEpKQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGQxIDwgLXN0cmVuZ3RoKQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gLWQxIC0gKHN0cmVuZ3RoIDw8IDEpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgZDFfMiA9IC1kMSA+PiAxOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSBkID4+IDM7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDEgPiAoc3RyZW5ndGggPDwgMSkpCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAwOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZDEgPiBzdHJlbmd0aCkKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IChzdHJlbmd0aCA8PCAxKSAtIGQxOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgZDFfMiA9IGQxID4+IDE7Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBpZiAoQV9EIDwgMCkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSAtKC1BX0QgPj4gMik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDIgPCAtZDFfMikKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMiA9IC1kMV8yOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSBBX0QgPj4gMjsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkMiA+IGQxXzIpCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSBkMV8yOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgKihyZWNfeSAtIHdpZHRoMikgPSBBIC0gZDI7Ci0gICAgICAgICAgICAgICAgICAgIHRtcHZhciA9IEIgKyBkMTsKLSAgICAgICAgICAgICAgICAgICAgQ0xJUF9SRVNVTFQodG1wdmFyKQotICAgICAgICAgICAgICAgICAgICAqKHJlY195IC0gd2lkdGgpID0gdG1wdmFyOwotICAgICAgICAgICAgICAgICAgICB0bXB2YXIgPSBDIC0gZDE7Ci0gICAgICAgICAgICAgICAgICAgIENMSVBfUkVTVUxUKHRtcHZhcikKLSAgICAgICAgICAgICAgICAgICAgKnJlY195ID0gdG1wdmFyOwotICAgICAgICAgICAgICAgICAgICAqKHJlY195ICsgd2lkdGgpID0gRCArIGQyOwotICAgICAgICAgICAgICAgICAgICByZWNfeSsrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICByZWNfeSArPSBiX3NpemU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtYm51bSsrOwotICAgICAgICB9Ci0gICAgICAgIHJlY195ICs9ICgoYl9zaXplIC0gMSkgKiB3aWR0aCk7Ci0KLSAgICB9Ci0KLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKipIT1JJWk9OVEFMIEZJTFRFUklORyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICBtYm51bSA9IDA7Ci0gICAgLyogSE9SSVpPTlRBTCBJTk5FUiAqLwotICAgIGlmICghY2hyKQotICAgIHsKLSAgICAgICAgcmVjX3kgPSByZWMgKyA4OwotICAgICAgICBvZmZzZXQgPSB3aWR0aCAqIGJfc2l6ZSAtIGJfc2l6ZTsKLQotICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbk1CUGVyQ29sOyBpKyspCi0gICAgICAgIHsKLSAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCBuTUJQZXJSb3c7IGorKykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZiAobW9kZVttYm51bV0gIT0gTU9ERV9TS0lQUEVEKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgayA9IDE2OwotICAgICAgICAgICAgICAgICAgICBzdHJlbmd0aCA9IFNUUkVOR1RIX3RhYltRUF9zdG9yZVttYm51bV1dOwotICAgICAgICAgICAgICAgICAgICB3aGlsZSAoay0tKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBBID0gICoocmVjX3kgLSAyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIEQgPSAgKihyZWNfeSArIDEpOwotICAgICAgICAgICAgICAgICAgICAgICAgQV9EID0gQSAtIEQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICBDID0gKnJlY195OwotICAgICAgICAgICAgICAgICAgICAgICAgQiA9ICoocmVjX3kgLSAxKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGQgPSAoKChDIC0gQikgPDwgMikgKyBBX0QpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCA8IDApCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAtKC1kID4+IDMpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkMSA8IC0oc3RyZW5ndGggPDwgMSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGQxIDwgLXN0cmVuZ3RoKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAtZDEgLSAoc3RyZW5ndGggPDwgMSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxXzIgPSAtZDEgPj4gMTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IGQgPj4gMzsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDEgPiAoc3RyZW5ndGggPDwgMSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGQxID4gc3RyZW5ndGgpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IChzdHJlbmd0aCA8PCAxKSAtIGQxOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMV8yID0gZDEgPj4gMTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFfRCA8IDApCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSAtKC1BX0QgPj4gMik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQyIDwgLWQxXzIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMiA9IC1kMV8yOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMiA9IEFfRCA+PiAyOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkMiA+IGQxXzIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMiA9IGQxXzI7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICAqKHJlY195IC0gMikgPSBBIC0gZDI7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0bXB2YXIgPSBCICsgZDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICBDTElQX1JFU1VMVCh0bXB2YXIpCi0gICAgICAgICAgICAgICAgICAgICAgICAqKHJlY195IC0gMSkgPSB0bXB2YXI7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0bXB2YXIgPSBDIC0gZDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICBDTElQX1JFU1VMVCh0bXB2YXIpCi0gICAgICAgICAgICAgICAgICAgICAgICAqcmVjX3kgPSB0bXB2YXI7Ci0gICAgICAgICAgICAgICAgICAgICAgICAqKHJlY195ICsgMSkgPSBEICsgZDI7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZWNfeSArPSB3aWR0aDsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICByZWNfeSAtPSBvZmZzZXQ7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHJlY195ICs9IGJfc2l6ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbWJudW0rKzsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJlY195ICs9ICgxNSAqIHdpZHRoKTsKLQotICAgICAgICB9Ci0gICAgfQotCi0KLQotICAgIC8qIEhPUklaT05UQUwgRURHRSAqLwotICAgIHJlY195ID0gcmVjICsgYl9zaXplOwotICAgIG9mZnNldCA9IHdpZHRoICogYl9zaXplIC0gYl9zaXplOwotICAgIG1ibnVtID0gMTsKLSAgICBmb3IgKGkgPSAwOyBpIDwgbk1CUGVyQ29sOyBpKyspCi0gICAgewotICAgICAgICBmb3IgKGogPSAwOyBqIDwgbk1CUGVyUm93IC0gMTsgaisrKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAobW9kZVttYm51bV0gIT0gTU9ERV9TS0lQUEVEIHx8IG1vZGVbbWJudW0tMV0gIT0gTU9ERV9TS0lQUEVEKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGsgPSBiX3NpemU7Ci0gICAgICAgICAgICAgICAgaWYgKG1vZGVbbWJudW1dICE9IE1PREVfU0tJUFBFRCkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHN0cmVuZ3RoID0gU1RSRU5HVEhfdGFiWyhhbm5leF9UID8gIE1RX2Nocm9tYV9RUF90YWJsZVtRUF9zdG9yZVttYm51bV1dIDogUVBfc3RvcmVbbWJudW1dKV07Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHN0cmVuZ3RoID0gU1RSRU5HVEhfdGFiWyhhbm5leF9UID8gIE1RX2Nocm9tYV9RUF90YWJsZVtRUF9zdG9yZVttYm51bSAtIDFdXSA6IFFQX3N0b3JlW21ibnVtIC0gMV0pXTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICB3aGlsZSAoay0tKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgQSA9ICAqKHJlY195IC0gMik7Ci0gICAgICAgICAgICAgICAgICAgIEQgPSAgKihyZWNfeSArIDEpOwotICAgICAgICAgICAgICAgICAgICBBX0QgPSBBIC0gRDsKLSAgICAgICAgICAgICAgICAgICAgQyA9ICpyZWNfeTsKLSAgICAgICAgICAgICAgICAgICAgQiA9ICoocmVjX3kgLSAxKTsKLSAgICAgICAgICAgICAgICAgICAgZCA9ICgoKEMgLSBCKSA8PCAyKSArIEFfRCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGQgPCAwKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBkMSA9IC0oLWQgPj4gMyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDEgPCAtKHN0cmVuZ3RoIDw8IDEpKQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGQxIDwgLXN0cmVuZ3RoKQotICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQxID0gLWQxIC0gKHN0cmVuZ3RoIDw8IDEpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgZDFfMiA9IC1kMSA+PiAxOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSBkID4+IDM7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDEgPiAoc3RyZW5ndGggPDwgMSkpCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZDEgPSAwOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZDEgPiBzdHJlbmd0aCkKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMSA9IChzdHJlbmd0aCA8PCAxKSAtIGQxOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgZDFfMiA9IGQxID4+IDE7Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBpZiAoQV9EIDwgMCkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSAtKC1BX0QgPj4gMik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZDIgPCAtZDFfMikKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkMiA9IC1kMV8yOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSBBX0QgPj4gMjsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkMiA+IGQxXzIpCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZDIgPSBkMV8yOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgKihyZWNfeSAtIDIpID0gQSAtIGQyOwotICAgICAgICAgICAgICAgICAgICB0bXB2YXIgPSBCICsgZDE7Ci0gICAgICAgICAgICAgICAgICAgIENMSVBfUkVTVUxUKHRtcHZhcikKLSAgICAgICAgICAgICAgICAgICAgKihyZWNfeSAtIDEpID0gdG1wdmFyOwotICAgICAgICAgICAgICAgICAgICB0bXB2YXIgPSBDIC0gZDE7Ci0gICAgICAgICAgICAgICAgICAgIENMSVBfUkVTVUxUKHRtcHZhcikKLSAgICAgICAgICAgICAgICAgICAgKnJlY195ID0gdG1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taW5lIGlmIGFsbCBvciBzb21lIGFyZSBub24temVyby4gICAgICAgICAgICAgICAgICAgKi8KLSAgICBpZiAocV9ibG9ja1sxXSAhPSAwKQotICAgIHsKLSAgICAgICAgLyogQXQgdGhpcyBwb2ludCwgcV9ibG9ja1swXSBhbmQgcV9ibG9ja1sxXSBhcmUgbm9uLXplcm8sIHdoaWxlICovCi0gICAgICAgIC8qIHFfYmxvY2tbbl0sIG4gPSAyLC4uLiwgQl9TSVpFLTEsIGFyZSB6ZXJvLiBUaGVyZWZvcmUsIHdlICAgICAqLwotICAgICAgICAvKiBuZWVkIHRvIGRpc2FibGUgdmVydGljYWwgZGVibG9ja2luZyAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgcG9zdG1vZGUgJj0gMHhFOwotICAgIH0KLQotICAgIGZvciAoaSA9IDI7IGkgPCBCX1NJWkU7IGkrKykKLSAgICB7Ci0gICAgICAgIGlmIChxX2Jsb2NrW2ldKQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBDaGVjayBpZiBxX2Jsb2NrW25dLCBuID0gMiwuLi4sIEJfU0laRS0xLCBhcmUgbm9uLXplcm8uKi8KLSAgICAgICAgICAgIC8qIElmIGFueSBvZiB0aGVtIHR1cm4gb3V0IHRvIGJlIG5vbi16ZXJvLCB3ZSBuZWVkIHRvICAgICAqLwotICAgICAgICAgICAgLyogZGlzYWJsZSB2ZXJ0aWNhbCBkZWJsb2NraW5nLiAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICBwb3N0bW9kZSAmPSAweEU7Ci0KLSAgICAgICAgICAgIC8qIERlcmluZ2luZyBpcyBlbmFibGVkIGlmIGFueSBub256ZXJvIGVsZW1lbnRzIGV4aXN0IGluICovCi0gICAgICAgICAgICAvKiBwb3NpdGlvbnMgb3RoZXIgdGhhbiBxX2Jsb2NrWzBdLCBxX2Jsb2NrWzFdIG9yICAgICAgICAqLwotICAgICAgICAgICAgLyogcV9ibG9ja1tCX1NJWkVdLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIHBvc3Rtb2RlIHw9IDB4NDsKLQotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICAvKiBIb3Jpem9udGFsIGRlYmxvY2tpbmcgYml0IGlzIGVuYWJsZWQgd2hlbiBvbmx5IHRoZSBlbnRpcmUgZmFyICovCi0gICAgLyogbGVmdCBjb2x1bW4sIGkuZS4sIHFfYmxvY2tbbipCX1NJWkVdLCBuID0gMCwgLi4uLCBCX1NJWkUtMSwgICAqLwotICAgIC8qIGFyZSBub24temVyby4gU2luY2UgaW5pdGlhbCBhc3N1bXB0aW9uIGlzIHRoYXQgYWxsIGVsZW1lbnRzLCAgKi8KLSAgICAvKiBleGNlcHQgcV9ibG9ja1swXSwgaXMgemVybywgd2UgbmVlZCB0byBjaGVjayB0aGUgcmVtYWluaW5nICAgICovCi0gICAgLyogZWxlbWVudHMgaW4gdGhlIGZhciBsZWZ0IGNvbHVtbiB0byBkZXRlcm1pbmUgaWYgYWxsIG9yIHNvbWUgICAqLwotICAgIC8qIGFyZSBub24temVyby4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICBpZiAocV9ibG9ja1tCX1NJWkVdKQotICAgIHsKLSAgICAgICAgLyogQXQgdGhpcyBwb2ludCwgb25seSBxX2Jsb2NrWzBdIGFuZCBxX2Jsb2NrW0JfU0laRV0gYXJlIG5vbi16ZXJvLCAqLwotICAgICAgICAvKiB3aGlsZSBxX2Jsb2NrW24qQl9TSVpFXSwgbiA9IDIsIDMsLi4uLCBCX1NJWkUtMSwgYXJlIHplcm8uICAgICAgICovCi0gICAgICAgIC8qIFRoZXJlZm9yZSwgd2UgbmVlZCB0byBkaXNhYmxlIGhvcml6b250YWwgZGVibG9ja2luZy4gICAgICAgICAgICAgKi8KLSAgICAgICAgcG9zdG1vZGUgJj0gMHhEOwotICAgIH0KLQotICAgIGZvciAoaSA9IDE2OyBpIDwgTkNPRUZGX0JMT0NLOyBpICs9IEJfU0laRSkKLSAgICB7Ci0gICAgICAgIGlmIChxX2Jsb2NrW2ldKQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBDaGVjayBpZiBxX2Jsb2NrW25dLCBuID0gMipCX1NJWkUsLi4uLChCX1NJWkUtMSkqQl9TSVpFLCAgKi8KLSAgICAgICAgICAgIC8qIGFyZSBub24temVyby4gSWYgYW55IG9mIHRoZW0gdHVybiBvdXQgdG8gYmUgbm9uLXplcm8sICAgICAqLwotICAgICAgICAgICAgLyogd2UgbmVlZCB0byBkaXNhYmxlIGhvcml6b250YWwgZGVibG9ja2luZy4gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICBwb3N0bW9kZSAmPSAweEQ7Ci0KLSAgICAgICAgICAgIC8qIERlcmluZ2luZyBpcyBlbmFibGVkIGlmIGFueSBub256ZXJvIGVsZW1lbnRzIGV4aXN0IGluICovCi0gICAgICAgICAgICAvKiBwb3NpdGlvbnMgb3RoZXIgdGhhbiBxX2Jsb2NrWzBdLCBxX2Jsb2NrWzFdIG9yICAgICAgICAqLwotICAgICAgICAgICAgLyogcV9ibG9ja1tCX1NJWkVdLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIHBvc3Rtb2RlIHw9IDB4NDsKLQotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICAvKiBBdCB0aGlzIHBvaW50LCBvbmx5IHRoZSBmaXJzdCByb3cgYW5kIGZhciBsZWZ0IGNvbHVtbiBlbGVtZW50cyAqLwotICAgIC8qIGhhdmUgYmVlbiB0ZXN0ZWQuIElmIGRlcmluZ2luZyBiaXQgaXMgc3RpbGwgbm90IHNldCBhdCB0aGlzICAgICovCi0gICAgLyogcG9pbnQsIGNoZWNrIHRoZSByZXN0IG9mIHFfYmxvY2sgdG8gZGV0ZXJtaW5lIGlmIHRoZSBlbGVtZW50cyAgKi8KLSAgICAvKiBhcmUgbm9uLXplcm8uIElmIGFsbCBlbGVtZW50cywgYmVzaWRlcyBxX2Jsb2NrWzBdLCBxX2Jsb2NrWzFdLCAqLwotICAgIC8qIG9yIHFfYmxvY2tbQl9TSVpFXSBhcmUgbm9uLXplcm8sIGRlcmluZ2luZyBiaXQgbXVzdCBiZSBzZXQgICAgICovCi0gICAgaWYgKChwb3N0bW9kZSAmIDB4NCkgPT0gMCkKLSAgICB7Ci0gICAgICAgIGZvciAoaSA9IDE7IGkgPCBCX1NJWkU7IGkrKykKLSAgICAgICAgewotICAgICAgICAgICAgZm9yIChqID0gMTsgaiA8IEJfU0laRTsgaisrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmIChxX2Jsb2NrWyhpPDwzKStqXSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIC8qIEF0IHRoaXMgcG9pbnQsIHFfYmxvY2tbMF0gYW5kIGFub3RoZXIgcV9ibG9jayAqLwotICAgICAgICAgICAgICAgICAgICAvKiBlbGVtZW50IGFyZSBub24temVybywgdGhlcmVmb3JlLCB3ZSBuZWVkIHRvICAgKi8KLSAgICAgICAgICAgICAgICAgICAgLyogZGlzYWJsZSB2ZXJ0aWNhbCBhbmQgaG9yaXpvbnRhbCBkZWJsb2NraW5nICAgICovCi0gICAgICAgICAgICAgICAgICAgIHBvc3Rtb2RlICY9IDB4QzsKLQotICAgICAgICAgICAgICAgICAgICAvKiBEZXJpbmdpbmcgaXMgZW5hYmxlZCBpZiBhbnkgbm9uemVybyBlbGVtZW50cyBleGlzdCBpbiAqLwotICAgICAgICAgICAgICAgICAgICAvKiBwb3NpdGlvbnMgb3RoZXIgdGhhbiBxX2Jsb2NrWzBdLCBxX2Jsb2NrWzFdIG9yICAgICAgICAqLwotICAgICAgICAgICAgICAgICAgICAvKiBxX2Jsb2NrW0JfU0laRV0uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgICAgICBwb3N0bW9kZSB8PSAweDQ7Ci0KLSAgICAgICAgICAgICAgICAgICAgLyogU2V0IG91dGVyIEZPUiBsb29wIGNvdW50IHRvIEJfU0laRSB0byBnZXQgb3V0IG9mICovCi0gICAgICAgICAgICAgICAgICAgIC8qIG91dGVyIEZPUiBsb29wICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgICAgICBpID0gQl9TSVpFOwotCi0gICAgICAgICAgICAgICAgICAgIC8qIEdldCBvdXQgb2YgaW5uZXIgRk9SIGxvb3AgKi8KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCi0gICAgOyBSZXR1cm4gbm90aGluZyBvciBkYXRhIG9yIGRhdGEgcG9pbnRlcgotICAgIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotICAgIHJldHVybiAocG9zdG1vZGUpOwotfQotCi0jZW5kaWYKZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L2NvZGVjcy9tNHZfaDI2My9kZWMvc3JjL3BwX3NlbWFwaG9yZV9jaHJvbWFfaW50ZXIuY3BwIGIvbWVkaWEvbGlic3RhZ2VmcmlnaHQvY29kZWNzL200dl9oMjYzL2RlYy9zcmMvcHBfc2VtYXBob3JlX2Nocm9tYV9pbnRlci5jcHAKZGVsZXRlZCBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDdjMjAyMjIuLjA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gbW12eSA9IHlwcmVkID4+IDQ7ICAvKiBibG9jayB5IGNvb3IgKi8KLSAgICAgICAgbm12eSA9IG1tdnk7Ci0KLSAgICAgICAgLyogQ2hlY2sgaWYgTVYgaXMgb3V0c2lkZSB0aGUgZnJhbWUgKi8KLSAgICAgICAgaWYgKG12X2xvYyA9PSAxKQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBQZXJmb3JtIGJvdW5kYXJ5IGNoZWNrICovCi0gICAgICAgICAgICBpZiAobm12eCA8IDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgbm12eCA9IDA7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlIGlmIChubXZ4ID4gbXZ3aWR0aCAtIDEpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgbm12eCA9IG12d2lkdGggLSAxOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAobm12eSA8IDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgbm12eSA9IDA7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlIGlmIChubXZ5ID4gKGhlaWdodCA+PiA0KSAtIDEpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgbm12eSA9IChoZWlnaHQgPj4gNCkgLSAxOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgLyogQ2FsY3VsYXRlIHBvaW50ZXIgdG8gZmlyc3QgY2hyb21pbmFuY2UgYiBzZW1hcGhvcmVzIGluICAgICAgICovCi0gICAgICAgIC8qIHBzdHByY1R5cFBydiwgaS5lLiwgZmlyc3QgY2hyb21pbmFuY2UgYiBzZW1hcGhvcmUgaXMgaW4gICAgICAqLwotICAgICAgICAvKiAocHN0cHJjVHlwUHJ2ICsgKHNpemU+PjYpKS4gICAgICAgICAgICAgICAgICAqLwotICAgICAgICAvKiBTaW5jZSB0b3RhbCBudW1iZXIgb2YgY2hyb21pbmFuY2UgYmxvY2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C8qICBtdl9sb2MgPSAobnVtYmVyIG9mIHBpeGVscyBpbiBMdW1pbmFuY2UgVk9QLyg0KjY0KSkgICAqLwotICAgICAgICAvKiAgICAgICAgID0gc2l6ZS8yNTYgPSBzaXplPj44ICAgICAgICAgICAgICAgKi8KLSAgICAgICAgbXZfbG9jID0gKHNpemUgPj4gOCk7Ci0KLSAgICAgICAgLyogIDExLzMvMDAsIGNoYW5nZSB0aGUgcHJvcGFnYXRpb24gZm9yIGRlYmxvY2tpbmcgKi8KLSAgICAgICAgaWYgKG1za19kZWJsb2NrID09IDApCi0gICAgICAgIHsKLQotICAgICAgICAgICAgLyogRGVibG9ja2luZyBzZW1hcGhvcmUgcHJvcGFnYXRpb24gZm9yIENocm9taW5hbmNlICovCi0gICAgICAgICAgICAvKiBiIHNlbWFwaG9yZXMgICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgKihwcF9kZWNfdSkgPSAwOwotCi0gICAgICAgICAgICAvKiBBZHZhbmNlIG9mZnNldCB0byBwb2ludCB0byBDaHJvbWluYW5jZSByIHNlbWFwaG9yZXMgKi8KLSAgICAgICAgICAgIHBwX2RlY191ICs9IG12X2xvYzsKLQotICAgICAgICAgICAgLyogRGVibG9ja2luZyBzZW1hcGhvcmUgcHJvcGFnYXRpb24gZm9yIENocm9taW5hbmNlICovCi0gICAgICAgICAgICAvKiByIHNlbWFwaG9yZXMgICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgKihwcF9kZWNfdSkgPSAwOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgLyogRGVyaW5naW5nIHNlbWFwaG9yZSBwcm9wYWdhdGlvbiBmb3IgQ2hyb21pbmFuY2UgQiBibG9jayAqLwotICAgICAgICAgICAgaWYgKCgqKHBwX2RlY191KSY0KSA9PSAwKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICoocHBfZGVjX3UpIHw9ICgoKihwcF9wcmV2MSkgfCAqKHBwX3ByZXYyKSB8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHBwX3ByZXYzKSB8ICoocHBfcHJldjQpKSAmIDB4NCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8qIEFkdmFuY2Ugb2Zmc2V0IHRvIHBvaW50IHRvIENocm9taW5hbmNlIHIgc2VtYXBob3JlcyAqLwotICAgICAgICAgICAgcHBfZGVjX3UgKz0gbXZfbG9jOwotICAgICAgICAgICAgcHBfcHJldjEgKz0gbXZfbG9jOwotICAgICAgICAgICAgcHBfcHJldjIgKz0gbXZfbG9jOwotICAgICAgICAgICAgcHBfcHJldjMgKz0gbXZfbG9jOwotICAgICAgICAgICAgcHBfcHJldjQgKz0gbXZfbG9jOwotCi0gICAgICAgICAgICAvKiBEZXJpbmdpbmcgc2VtYXBob3JlIHByb3BhZ2F0aW9uIGZvciBDaHJvbWluYW5jZSBSICovCi0gICAgICAgICAgICBpZiAoKCoocHBfZGVjX3UpJjQpID09IDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgKihwcF9kZWNfdSkgfD0gKCgqKHBwX3ByZXYxKSB8ICoocHBfcHJldjIpIHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHBfcHJldjMpIHwgKihwcF9wcmV2NCkpICYgMHg0KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQotICAgICAgICA7IFJldHVybiBub3RoaW5nIG9yIGRhdGEgb3IgZGF0YSBwb2ludGVyCi0gICAgICAgIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLwotICAgICAgICByZ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ICAgICAgICBpbnQgeXByZWQsICAgICAgLyogaSAqLwotICAgICAgICB1aW50OCAgICpwcF9kZWNfeSwgIC8qIGkvbyAqLwotICAgICAgICB1aW50OCAgICpwc3RwcmNUeXBQcnYsICAvKiBpICovCi0gICAgICAgIGludCAqbGwsICAgICAgICAvKiBpICovCi0gICAgICAgIGludCAqbXZfbG9jLCAgICAvKiBpL28gKi8KLSAgICAgICAgaW50IGR4LCAgICAgLyogaSAqLwotICAgICAgICBpbnQgZHksICAgICAvKiBpICovCi0gICAgICAgIGludCBtdndpZHRoLCAgICAvKiBpICovCi0gICAgICAgIGludCB3aWR0aCwgICAgICAvKiBpICovCi0gICAgICAgIGludCBoZWlnaHQgICAgICAvKiBpICovCi0gICAgKQotICAgIHsKLSAgICAgICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCi0gICAgICAgIDsgRGVmaW5lIGFsbCBsb2NhbCB2YXJpYWJsZXMKLSAgICAgICAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi0gICAgICAgIGludCBraywgbW12eSwgbW12eCwgbm12eCwgbm12eTsKLSAgICAgICAgdWludDggICAqcHBfcHJldjEsICpwcF9wcmV2MiwgKnBwX3ByZXYzLCAqcHBfcHJldjQ7Ci0gICAgICAgIHVpbnQ4ICAgbXNrX2RlYmxvY2sgPSAwOyAgICAgICAgLyogIDExLzMvMDAgKi8KLQotICAgICAgICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KLSAgICAgICAgOyBGdW5jdGlvbiBib2R5IGhlcmUKLSAgICAgICAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCi0gICAgICAgIC8qIEludGVyZnJhbWUgUHJvY2Vzc2luZyAtIDEgTVYgcGVyIE1CICovCi0KLSAgICAgICAgLyogY2hlY2sgd2hldGhlciB0aGUgTVYgcG9pbnRzIG91dHNpZGUgdGhlIGZyYW1lICovCi0gICAgICAgIGlmICh4cHJlZCA+PSAwICYmIHhwcmVkIDw9ICgod2lkdGggPDwgMSkgLSAoMipNQl9TSVpFKSkgJiYgeXByZWQgPj0gMCAmJgotICAgICAgICAgICAgICAgIHlwcmVkIDw9ICgoaGVpZ2h0IDw8IDEpIC0gKDIqTUJfU0laRSkpKQotICAgICAgICB7ICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAgICAgLyogKHgseSkgaXMgaW5zaWRlIHRoZSBmcmFtZSAqLwotICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0gICAgICAgICAgICAvKiAgMTAvMjQvMjAwMCBwb3N0X3Byb2Nlc3Npbmcgc2VtYXBob3JlICovCi0gICAgICAgICAgICAvKiBnZW5lcmF0aW9uICovCi0KLSAgICAgICAgICAgIC8qICAxMC8yMy8yMDAwIG5vIGJvdW5kYXJ5IGNoZWNraW5nKi8KLSAgICAgICAgICAgICptdl9sb2MgPSAwOwotCi0gICAgICAgICAgICAvKiBDYWxjdWxhdGUgYmxvY2sgeCBjb29yZGluYXRlLiBEaXZpZGUgYnkgMTYgaXMgZm9yICAqLwotICAgICAgICAgICAgLyogY29udmVydGluZyBoYWxmLXBpeGVsIHJlc29sdXRpb24gdG8gYmxvY2sgICAgICAgICAgKi8KLSAgICAgICAgICAgIG1tdnggPSB4cHJlZCA+PiA0OwotCi0gICAgICAgICAgICAvKiBDYWxjdWxhdGUgYmxvY2sgeSBjb29yZGluYXRlLiBEaXZpZGUgYnkgMTYgaXMgZm9yICovCi0gICAgICAgICAgICAvKiBjb252ZXJ0aW5nIGhhbGYtcGl4ZWwgcmVzb2x1dGlvbiB0byBibG9jayAgICAgICAgICovCi0gICAgICAgICAgICBtbXZ5ID0geXByZWQgPj4gNDsKLQotICAgICAgICAgICAgLyogRmluZCBwb3N0IHByb2Nlc3Npbmcgc2VtYXBob3JlIGxvY2F0aW9uIGZvciBibG9jayAqLwotICAgICAgICAgICAgLyogdXNlZCBmb3IgcHJlZGljdGlvbiwgaS5lLiwgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIC8qIHBwX3ByZXYxID0gJnBzdHByY1R5cFBydlttbXZ5Km12d2lkdGhdW21tdnhdICAgICAgKi8KLSAgICAgICAgICAgIHBwX3ByZXYxID0gcHN0cHJjVHlwUHJ2ICsgbW12eCArIG1tdnkgKiBtdndpZHRoOwotCi0gICAgICAgICAgICAvKiBDaGVjayBpZiBNViBpcyBhIG11bHRpcGxlIG9mIDE2ICovCi0gICAgICAgICAgICBpZiAoKGR4JjB4RikgIT0gMCkKLSAgICAgICAgICAgIHsgICAvKiBkeCBpcyBub3QgYSBtdWx0aXBsZSBvZiAxNiAqLwotCi0gICAgICAgICAgICAgICAgLyogcHBfcHJldjIgaXMgdGhlIGJsb2NrIHRvIHRoZSByaWdodCBvZiAqLwotICAgICAgICAgICAgICAgIC8qIHBwX3ByZXYxIGJsb2NrICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBwcF9wcmV2MiA9IHBwX3ByZXYxICsgMTsKLQotICAgICAgICAgICAgICAgIGlmICgoZHkmMHhGKSAhPSAwKQotICAgICAgICAgICAgICAgIHsgICAvKiBkeSBpcyBub3QgYSBtdWx0aXBsZSBvZiAxNiAqLwotCi0gICAgICAgICAgICAgICAgICAgIC8qIHBwX3ByZXYzIGlzIHRoZSBibG9jayBiZWxvdyAqLwotICAgICAgICAgICAgICAgICAgICAvKiBwcF9wcmV2MSBibG9jayAgICAgICAgICAqLwotICAgICAgICAgICAgICAgICAgICBwcF9wcmV2MyA9IHBwX3ByZXYxICsgbXZ3aWR0aDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsgICAvKiBkeSBpcyBhIG11bHRpcGxlIG9mIDE2ICovCi0KLSAgICAgICAgICAgICAgICAgICAgcHBfcHJldjMgPSBwcF9wcmV2MTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAvKiBwcF9wcmV2NCBpcyB0aGUgYmxvY2sgdG8gdGhlIHJpZ2h0IG9mICovCi0gICAgICAgICAgICAgICAgLyogcHBfcHJldjMgYmxvY2suICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIHBwX3ByZXY0ID0gcHBfcHJldjMgKyAxOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgeyAgIC8qIGR4IGlzIGEgbXVsdGlwbGUgb2YgMTYgKi8KLQotICAgICAgICAgICAgICAgIHBwX3ByZXYyID0gcHBfcHJldjE7Ci0KLSAgICAgICAgICAgICAgICBpZiAoKGR5JjB4RikgIT0gMCkKLSAgICAgICAgICAgICAgICB7ICAgLyogZHkgaXMgbm90IGEgbXVsdGlwbGUgb2YgMTYgKi8KLQotICAgICAgICAgICAgICAgICAgICAvKiBwcF9wcmV2MyBpcyB0aGUgYmxvY2sgYmVsb3cgKi8KLSAgICAgICAgICAgICAgICAgICAgLyogcHBfcHJldjEgYmxvY2suICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgcHBfcHJldjMgPSBwcF9wcmV2MSArIG12d2lkdGg7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICB7ICAgLyogZHkgaXMgYSBtdWx0aXBsZSBvZiAxNiAqLwotCi0gICAgICAgICAgICAgICAgICAgIHBwX3ByZXYzID0gcHBfcHJldjE7Ci0gICAgICAgICAgICAgICAgICAgIG1za19kZWJsb2NrID0gMHgzOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIHBwX3ByZXY0ID0gcHBfcHJldjM7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8qIFBlcmZvcm0gcG9zdCBwcm9jZXNzaW5nIHNlbWFwaG9yZSBwcm9wYWdhdGlvbiBmb3IgZWFjaCAqLwotICAgICAgICAgICAgLyogb2YgdGhlIDQgYmxvY2tzIGluIGEgTUIuICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIGZvciAoa2sgPSAwOyBrayA8IDQ7IGtrKyspCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLyogRGVyaW5naW5nIHNlbWFwaG9yZSBwcm9wYWdhdGlvbiAqLwotICAgICAgICAgICAgICAgIGlmICgoKihwcF9kZWNfeSkgJiA0KSA9PSAwKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgKihwcF9kZWNfeSkgfD0gKCgqKHBwX3ByZXYxKSB8ICoocHBfcHJldjIpIHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKHBwX3ByZXYzKSB8ICoocHBfcHJldjQpKSAmIDB4NCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8qIERlYmxvY2tpbmcgc2VtYXBob3JlIHByb3BhZ2F0aW9uICovCi0gICAgICAgICAgICAgICAgLyogIDExLzMvMDAsIGNoYW5nZSB0aGUgcHJvcGFnYXRpb24gZm9yIGRlYmxvY2tpbmcgKi8KLSAgICAgICAgICAgICAgICBpZiAobXNrX2RlYmxvY2sgPT0gMCkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICoocHBfZGVjX3kpID0gMDsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBwcF9kZWNfeSArPSBsbFtra107Ci0gICAgICAgICAgICAgICAgcHBfcHJldjEgKz0gbGxba2tdOwotICAgICAgICAgICAgICAgIHBwX3ByZXYyICs9IGxsW2trXTsKLSAgICAgICAgICAgICAgICBwcF9wcmV2MyArPSBsbFtra107Ci0gICAgICAgICAgICAgICAgcHBfcHJldjQgKz0gbGxba2tdOwotICAgICAgICAgICAgfQotCi0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7ICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgIC8qICh4LHkpIGlzIG91dHNpZGUgdGhlIGZyYW1lICovCi0gICAgICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0gICAgICAgICAgICAvKiAgMTAvMjQvMjAwMCBwb3N0X3Byb2Nlc3Npbmcgc2VtYXBob3JlICovCi0gICAgICAgICAgICAvKiBnZW5lcmF0aW9uICovCi0KLSAgICAgICAgICAgIC8qICAxMC8yMy8yMDAwIGJvdW5kYXJ5IGNoZWNraW5nKi8KLSAgICAgICAgICAgICptdl9sb2MgPSAxOwotCi0gICAgICAgICAgICAvKiBQZXJmb3JtIHBvc3QgcHJvY2Vzc2luZyBzZW1hcGhvcmUgcHJvcGFnYXRpb24gZm9yIGVhY2ggKi8KLSAgICAgICAgICAgIC8qIG9mIHRoZSA0IGJsb2NrcyBpbiBhIE1CLiAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICBmb3IgKGtrID0gMDsga2sgPCA0OyBraysrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8qIENhbGN1bGF0ZSBibG9jayB4IGNvb3JkaW5hdGUgYW5kIHJvdW5kICg/KS4gICovCi0gICAgICAgICAgICAgICAgLyogRGl2aWRlIGJ5IDE2IGlzIGZvciBjb252ZXJ0aW5nIGhhbGYtcGl4ZWwgICAgKi8KLSAgICAgICAgICAgICAgICAvKiByZXNvbHV0aW9uIHRvIGJsb2NrLiAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIG1tdnggPSAoeHByZWQgKyAoKGtrICYgMSkgPDwgMykpID4+IDQ7Ci0gICAgICAgICAgICAgICAgbm12eCA9IG1tdng7Ci0KLSAgICAgICAgICAgICAgICAvKiBDYWxjdWxhdGUgYmxvY2sgeSBjb29yZGluYXRlIGFuZCByb3VuZCAoPykuICAqLwotICAgICAgICAgICAgICAgIC8qIERpdmlkZSBieSAxNiBpcyBmb3IgY29udmVydGluZyBoYWxmLXBpeGVsICAgICovCi0gICAgICAgICAgICAgICAgLyogcmVzb2x1dGlvbiB0byBibG9jay4gICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBtbXZ5ID0gKHlwcmVkICsgKChrayAmIDIpIDw8IDIpKSA+PiA0OwotICAgICAgICAgICAgICAgIG5tdnkgPSBtbXZ5OwotCi0gICAgICAgICAgICAgICAgLyogUGVyZm9ybSBib3VuZGFyeSBjaGVja2luZyAqLwotICAgICAgICAgICAgICAgIGlmIChubXZ4IDwgMCkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIG5tdnggPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlIGlmIChubXZ4ID4gbXZ3aWR0aCAtIDEpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBubXZ4ID0gbXZ3aWR0aCAtIDE7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKG5tdnkgPCAwKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgbm12eSA9IDA7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UgaWYgKG5tdnkgPiAoaGVpZ2h0ID4+IDMpIC0gMSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIG5tdnkgPSAoaGVpZ2h0ID4+IDMpIC0gMTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAvKiBGaW5kIHBvc3QgcHJvY2Vzc2luZyBzZW1hcGhvcmUgbG9jYXRpb24gZm9yIGJsb2NrICovCi0gICAgICAgICAgICAgICAgLyogdXNlZCBmb3IgcHJlZGljdGlvbiwgaS5lLiwgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAvKiBwcF9wcmV2MSA9ICZwc3RwcmNUeXBQcnZbbm12eSptdndpZHRoXVtubXZ4XSAgICAgICovCi0gICAgICAgICAgICAgICAgcHBfcHJldjEgPSBwc3RwcmNUeXBQcnYgKyBubXZ4ICsgbm12eSAqIG12d2lkdGg7Ci0KLSAgICAgICAgICAgICAgICAvKiBDaGVjayBpZiB4IGNvbXBvbmVudCBvZiBNViBpcyBhIG11bHRpcGxlIG9mIDE2ICAgICovCi0gICAgICAgICAgICAgICAgLyogYW5kIGNoZWNrIGlmIGJsb2NrIHggY29vcmRpbmF0ZSBpcyBvdXQgb2YgYm91bmRzICAqLwotICAgICAgICAgICAgICAgIGlmICgoKGR4JjB4RikgIT0gMCkgJiYgKG1tdnggKyAxIDwgbXZ3aWR0aCAtIDEpKQotICAgICAgICAgICAgICAgIHsgICAvKiBkeCBpcyBub3QgYSBtdWx0aXBsZSBvZiAxNiBhbmQgdGhlIGJsb2NrICovCi0gICAgICAgICAgICAgICAgICAgIC8qIHggY29vcmRpbmF0ZSBpcyB3aXRoaW4gdGhlIGJvdW5kcyAgICAgICAgKi8KLQotICAgICAgICAgICAgICAgICAgICAvKiBwcF9wcmV2MiBpcyB0aGUgYmxvY2sgdG8gdGhlIHJpZ2h0IG9mICovCi0gICAgICAgICAgICAgICAgICAgIC8qIHBwX3ByZXYxIGJsb2NrICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgcHBfcHJldjIgPSBwcF9wcmV2MSArIDE7Ci0KLSAgICAgICAgICAgICAgICAgICAgLyogQ2hlY2sgaWYgeSBjb21wb25lbnQgb2YgTVYgaXMgYSBtdWx0aXBsZSAqLwotICAgICAgICAgICAgICAgICAgICAvKiBvZiAxNiBhbmQgY2hlY2sgaWYgYmxvY2sgeSBjb29yZGluYXRlIGlzICovCi0gICAgICAgICAgICAgICAgICAgIC8qIG91dCBvZiBib3VuZHMgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgaWYgKCgoZHkmMHhGKSAhPSAwKSAmJiAobW12eSArIDEgPCAoaGVpZ2h0ID4+IDMpIC0gMSkpCi0gICAgICAgICAgICAgICAgICAgIHsgICAvKiBkeSBpcyBub3QgYSBtdWx0aXBsZSBvZiAxNiBhbmQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIHRoZSBibG9jayB5IGNvb3JkaW5hdGUgaXMgICAgICAqLwotICAgICAgICAgICAgICAgICAgICAgICAgLyogd2l0aGluIHRoZSBib3VuZHMgICAgICAgICAgICAgICovCi0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIHBwX3ByZXYzIGlzIHRoZSBibG9jayBiZWxvdyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgLyogcHBfcHJldjEgYmxvY2sgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIHBwX3ByZXYzID0gcHBfcHJldjEgKyBtdndpZHRoOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAvKiBhbGwgcHJlZGljdGlvbiBhcmUgZnJvbSBkaWZmZXJlbnQgYmxvY2tzICovCi0gICAgICAgICAgICAgICAgICAgICAgICBtc2tfZGVibG9jayA9IDB4MzsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgIHsgICAvKiBkeSBpcyBhIG11bHRpcGxlIG9mIDE2IG9yIHRoZSBibG9jayAqLwotICAgICAgICAgICAgICAgICAgICAgICAgLyogeSBjb29yZGluYXRlIGlzIG91dCBvZiBib3VuZHMgICAgICAgKi8KLQotICAgICAgICAgICAgICAgICAgICAgICAgcHBfcHJldjMgPSBwcF9wcmV2MTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIC8qIHBwX3ByZXY0IGlzIHRoZSBibG9jayB0byB0aGUgcmlnaHQgb2YgKi8KLSAgICAgICAgICAgICAgICAgICAgLyogcHBfcHJldjMgYmxvY2suICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgICAgICBwcF9wcmV2NCA9IHBwX3ByZXYzICsgMTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsgICAvKiBkeCBpcyBhIG11bHRpcGxlIG9mIDE2IG9yIHRoZSBibG9jayB4ICovCi0gICAgICAgICAgICAgICAgICAgIC8qIGNvb3JkaW5hdGUgaXMgb3V0IG9mIGJvdW5kcyAgICAgICAgICAgKi8KLQotICAgICAgICAgICAgICAgICAgICBwcF9wcmV2MiA9IHBwX3ByZXYxOwotCi0gICAgICAgICAgICAgICAgICAgIC8qIENoZWNrIGlmIHkgY29tcG9uZW50IG9mIE1WIGlzIGEgbXVsdGlwbGUgKi8KLSAgICAgICAgICAgICAgICAgICAgLyogb2YgMTYgYW5kIGNoZWNrIGlmIGJsb2NrIHkgY29vcmRpbmF0ZSBpcyAqLwotICAgICAgICAgICAgICAgICAgICAvKiBvdXQgb2YgYm91bmRzICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgIGlmICgoKGR5JjB4RikgIT0gMCkgJiYgKG1tdnkgKyAxIDwgKGhlaWdodCA+PiAzKSAtIDEpKQotICAgICAgICAgICAgICAgICAgICB7ICAgLyogZHkgaXMgbm90IGEgbXVsdGlwbGUgb2YgMTYgYW5kICovCi0gICAgICAgICAgICAgICAgICAgICAgICAvKiB0aGUgYmxvY2sgeSBjb29yZGluYXRlIGlzICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIHdpdGhpbiB0aGUgYm91bmRzICAgICAgICAgICAgICAqLwotCi0gICAgICAgICAgICAgICAgICAgICAgICAvKiBwcF9wcmV2MyBpcyB0aGUgYmxvY2sgYmVsb3cgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qIHBwX3ByZXYxIGJsb2NrLiAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgICAgICBwcF9wcmV2MyA9IHBwX3ByZXYxICsgbXZ3aWR0aDsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgIHsgICAvKiBkeSBpcyBhIG11bHRpcGxlIG9mIDE2IG9yIHRoZSBibG9jayAqLwotICAgICAgICAgICAgICAgICAgICAgICAgLyogeSBjb29yZGluYXRlIGlzIG91dCBvZiBib3VuZHMgICAgICAgKi8KLQotICAgICAgICAgICAgICAgICAgICAgICAgcHBfcHJldjMgPSBwcF9wcmV2MTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIHBwX3ByZXY0ID0gcHBfcHJldjM7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgLyogRGVyaW5naW5nIHNlbWFwaG9yZSBwcm9wYWdhdGlvbiAqLwotICAgICAgICAgICAgICAgIGlmICgoKihwcF9kZWNfeSkmNCkgPT0gMCkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICoocHBfZGVjX3kpIHw9ICgoKihwcF9wcmV2MSkgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHBfcHJldjIpIHwgKihwcF9wcmV2MykgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoocHBfcHJldjQpKSAmIDB4NCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8qIERlYmxvY2tpbmcgc2VtYXBob3JlIHByb3BhZ2F0aW9uICovCi0gICAgICAgICAgICAgICAgLyogIDExLzMvMDAsIGNoYW5nZSB0aGUgcHJvcGFnYT0gKi8KLSAgICAgICAgICAgICAgICAvKiB0aW9uIGZvciBkZWJsb2NraW5nICovCi0gICAgICAgIC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RENbUUNJRl9NQlNdOwotZXh0ZXJuIHR5cGVEQ0FDU3RvcmUgICAgICAgIElNRU1fcHJlZERDQUNfY29sW1FDSUZfTUJfUk9XUysxXTsKLQotZXh0ZXJuIFZpZGVvRGVjRGF0YSAgICAgICAgIElNRU1fVmlkZW9EZWNEYXRhWzFdOwotZXh0ZXJuIFZvcCAgICAgICAgICAgICAgICAgIElNRU1fY3VyclZvcFsxXTsKLWV4dGVybiBWb3AgICAgICAgICAgICAgICAgICBJTUVNX3ByZXZWb3BbMV07Ci1leHRlcm4gUElYRUwgICAgICAgICAgICAgICAgSU1FTV9jdXJyVm9wX3lDaGFuW1FDSUZfTUJTKjEyOCozXTsKLWV4dGVybiBQSVhFTCAgICAgICAgICAgICAgICBJTUVNX3ByZXZWb3BfeUNoYW5bUUNJRl9NQlMqMTI4KjNdOwotZXh0ZXJuIHVpbnQ4ICAgICAgICAgICAgICAgIElNRU1fcHN0cHJjVHlwQ3VyWzYqUUNJRl9NQlNdOwotZXh0ZXJuIHVpbnQ4ICAgICAgICAgICAgICAgIElNRU1fcHN0cHJjVHlwUHJ2WzYqUUNJRl9NQlNdOwotCi0KLWV4dGVybiBWb3AgICAgICAgICAgICAgICAgICBJTUVNX3ZvcEhFQURFUlsyXTsKLWV4dGVybiBWb2wgICAgICAgICAgICAgICAgICBJTUVNX1ZPTFsyXTsKLWV4dGVybiBWb3AgICAgICAgICAgICAgICAgICBJTUVNX3ZvcEhlYWRlclsyXVsxXTsKLWV4dGVybiBWb2wgICAgICAgICAgICAgICAgICBJTUVNX3ZvbFsyXVsxXTsKLQotI2VuZGlmCi0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZJbml0VmlkZW9EZWNvZGVyKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwNC8xMS8yMDAwLCAwOC8yOS8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IEluaXRpYWxpemF0aW9uIG9mIHRoZSBNUEVHLTQgdmlkZW8gZGVjb2RlciBsaWJyYXJ5LiAgICAgICAgICAqLwotLyogICAgICAgICAgICAgVGhlIHJldHVybiB0eXBlIGlzIEJvb2wgaW5zdGVhZCBvZiBQVl9TVEFUVVMgYmVjYXVzZSAgICAgICAgICovCi0vKiAgICAgICAgICAgICB3ZSBkb24ndCB3YW50IHRvIGV4cG9zZSBQVl9TVEFUVVMgdG8gKG91dHNpZGUpIHByb2dyYW1tZXJzICAgKi8KLS8qICAgICAgICAgICAgIHRoYXQgdXNlIG91ciBkZWNvZGVyIGxpYnJhcnkgU0RLLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi1PU0NMX0VYUE9SVF9SRUYgQm9vbCBQVkluaXRWaWRlb0RlY29kZXIoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgdWludDggKnZvbGJ1ZltdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyICp2b2xidWZfc2l6ZSwgaW50IG5MYXllcnMsIGludCB3aWR0aCwgaW50IGhlaWdodCwgTVA0RGVjb2Rp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R4ID0gMDsgaWR4IDwgbkxheWVyczsgaWR4KyspCi0gICAgICAgICAgICB7Ci0KLSNpZmRlZiBERUNfSU5URVJOQUxfTUVNT1JZX09QVAotICAgICAgICAgICAgICAgIHZpZGVvLT52b3BIZWFkZXJbaWR4XSA9IElNRU1fdm9wSGVhZGVyW2lkeF07Ci0jZWxzZQotICAgICAgICAgICAgICAgIHZpZGVvLT52b3BIZWFkZXJbaWR4XSA9IChWb3AgKikgb3NjbF9tYWxsb2Moc2l6ZW9mKFZvcCkpOwotI2VuZGlmCi0gICAgICAgICAgICAgICAgaWYgKHZpZGVvLT52b3BIZWFkZXJbaWR4XSA9PSBOVUxMKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBvc2NsX21lbXNldCh2aWRlby0+dm9wSGVhZGVyW2lkeF0sIDAsIHNpemVvZihWb3ApKTsKLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZvcEhlYWRlcltpZHhdLT50aW1lU3RhbXAgPSAwOwotICAgICAgICAgICAgICAgICAgICB2aWRlby0+bWVtb3J5VXNhZ2UgKz0gKHNpemVvZihWb3ApKTsKLSAgICAgICAgICAgICAgICB9Ci0jaWZkZWYgREVDX0lOVEVSTkFMX01FTU9SWV9PUFQKLSAgICAgICAgICAgICAgICB2aWRlby0+dm9sW2lkeF0gPSBJTUVNX3ZvbFtpZHhdOwotICAgICAgICAgICAgICAgIHZpZGVvLT5tZW1vcnlVc2FnZSArPSBzaXplb2YoVm9sKTsKLSAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnZvbFtpZHhdID09IE5VTEwpIHN0YXR1cyA9IFBWX0ZBTFNFOwotICAgICAgICAgICAgICAgIGVsc2Ugb3NjbF9tZW1zZXQodmlkZW8tPnZvbFtpZHhdLCAwLCBzaXplb2YoVm9sKSk7Ci0gICAgICAgICAgICAgICAgc3RyZWFtID0gSU1FTV9CaXRzdHJlYW1EZWNWaWRlbzsKLSNlbHNlCi0gICAgICAgICAgICAgICAgdmlkZW8tPnZvbFtpZHhdID0gKFZvbCAqKSBvc2NsX21hbGxvYyhzaXplb2YoVm9sKSk7Ci0gICAgICAgICAgICAgICAgaWYgKHZpZGVvLT52b2xbaWR4XSA9PSBOVUxMKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICB2aWRlby0+bWVtb3J5VXNhZ2UgKz0gc2l6ZW9mKFZvbCk7Ci0gICAgICAgICAgICAgICAgICAgIG9zY2xfbWVtc2V0KHZpZGVvLT52b2xbaWR4XSwgMCwgc2l6ZW9mKFZvbCkpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIHN0cmVhbSA9IChCaXRzdHJlYW1EZWNWaWRlbyAqKSBvc2NsX21hbGxvYyhzaXplb2YoQml0c3RyZWFtRGVjVmlkZW8pKTsKLSNlbmRpZgotICAgICAgICAgICAgICAgIHZpZGVvLT5tZW1vcnlVc2FnZSArPSBzaXplb2YoQml0c3RyZWFtRGVjVmlkZW8pOwotICAgICAgICAgICAgICAgIGlmIChzdHJlYW0gPT0gTlVMTCkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBTFNFOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgaW50MzIgYnVmZmVyX3NpemU7Ci0gICAgICAgICAgICAgICAgICAgIG9zY2xfbWVtc2V0KHN0cmVhbSwgMCwgc2l6ZW9mKEJpdHN0cmVhbURlY1ZpZGVvKSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgoYnVmZmVyX3NpemUgPSBCaXRzdHJlYW1PcGVuKHN0cmVhbSwgaWR4KSkgPCAwKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtcDRkZWNfbG9nKCJJbml0VmlkZW9EZWNvZGVyKCk6IENhbid0IGFsbG9jYXRlIGJpdHN0cmVhbSBidWZmZXIuXG4iKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBTFNFOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPm1lbW9yeVVzYWdlICs9IGJ1ZmZlcl9zaXplOwotICAgICAgICAgICAgICAgICAgICB2aWRlby0+dm9sW2lkeF0tPmJpdHN0cmVhbSA9IHN0cmVhbTsKLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZvbFtpZHhdLT52b2xJRCA9IGlkeDsKLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZvbFtpZHhdLT50aW1lSW5jX29mZnNldCA9IDA7ICAvKiAgMTEvMTIvMDEgKi8KLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZsY0RlY0NvZWZmSW50cmEgPSAmVmxjRGVjVENPRUZTaG9ydEhlYWRlcjsKLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZsY0RlY0NvZWZmSW50ZXIgPSAmVmxjRGVjVENPRUZTaG9ydEhlYWRlcjsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1vZGUgPT0gTVBFRzRfTU9ERSkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgLyogU2V0IHVwIFZPTCBoZWFkZXIgYml0c3RyZWFtIGZvciBmcmFtZS1iYXNlZCBkZWNvZGluZy4gIDA4LzMwLzIwMDAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlc2V0KHN0cmVhbSwgZGVjQ3RybC0+dm9sYnVmW2lkeF0sIGRlY0N0cmwtPnZvbGJ1Zl9zaXplW2lkeF0pOwotCi0gICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKERlY29kZVZPTEhlYWRlcih2aWRlbywgaWR4KSkKLSAgICAgICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFBWX1NVQ0NFU1MgOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzID09IFBWX1RSVUUpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9UUlVFOyAgIC8qICB3ZSB3YW50IHRvIG1ha2Ugc3VyZSB0aGF0IGlmIGZpcnN0IGxheWVyIGlzIGJhZCwgc2Vjb25kIGxheWVyIGlzIGdvb2QgcmV0dXJuIFBWX0ZBSUwgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotI2lmZGVmIFBWX1RPTEVSQVRFX1ZPTF9FUlJPUlMKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFBWX0JBRF9WT0xIRUFERVI6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX1RSVUU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotI2VuZGlmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdCA6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBTFNFOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnNob3J0VmlkZW9IZWFkZXIgPSBQVl9UUlVFOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5zaG9ydFZpZGVvSGVhZGVyID09IFBWX1RSVUUpCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1vZGUgPSBIMjYzX01PREU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKiBTZXQgbWF4IHdpZHRoIGFuZCBoZWlnaHQuICBJbiBILjI2MyBtb2RlLCB3ZSB1c2UgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qICB2b2xidWZfc2l6ZVswXSB0byBwYXNzIGluIHdpZHRoIGFuZCB2b2xidWZfc2l6ZVsxXSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgLyogIHRvIHBhc3MgaW4gaGVpZ2h0LiAgICAgICAgICAgICAgICAgICAgMDQvMjMvMjAwMSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnByZXZWb3AtPnRlbXBvcmFsUmVmID0gMDsgLyogIDExLzEyLzAxICovCi0gICAgICAgICAgICAgICAgICAgICAgICAvKiBDb21wdXRlIHNvbWUgY29udmVuaWVuY2UgdmFyaWFibGVzOiAgIDA0LzIzLzIwMDEgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT52b2xbaWR4XS0+cXVhbnRUeXBlID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT52b2xbaWR4XS0+cXVhbnRQcmVjaXNpb24gPSA1OwotICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZvbFtpZHhdLT5lcnJvclJlc0Rpc2FibGUgPSAxOwotICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnZvbFtpZHhdLT5kYXRhUGFydGl0aW9uaW5nID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT52b2xbaWR4XS0+dXNlUmV2ZXJzZVZMQyA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+aW50cmFfYWNkY1ByZWREaXNhYmxlID0gMTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT52b2xbaWR4XS0+c2NhbGFiaWxpdHkgPSAwOwotCi0gICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gd2lkdGg7Ci0gICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGlzcGxheUhlaWdodCA9IGhlaWdodDsKLSAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT53aWR0aCA9ICh3aWR0aCArIDE1KSAmIC0xNjsKLSAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5oZWlnaHQgPSAoaGVpZ2h0ICsgMTUpICYgLTE2OwotICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnNpemUgPSAoaW50MzIpdmlkZW8tPndpZHRoICogdmlkZW8tPmhlaWdodDsKLQotI2lmZGVmIFBWX0FOTkVYX0lKS1RfU1VQUE9SVAotICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPm1vZGlmaWVkX3F1YW50ID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5hZHZhbmNlZF9JTlRSQSA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGVibG9ja2luZyA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+c2xpY2Vfc3R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b3AtPnRpbWVTdGFtcCA9IDA7Ci0gICAgfQotICAgIHZpZGVvLT5jb25jZWFsRnJhbWUgPSB2aWRlby0+cHJldlZvcC0+eUNoYW47ICAgICAgICAgICAgICAgLyogIDA3LzA3LzIwMDEgKi8KLSAgICBkZWNDdHJsLT5vdXRwdXRGcmFtZSA9IHZpZGVvLT5wcmV2Vm9wLT55Q2hhbjsgICAgICAgICAgICAgIC8qICAwNi8xOS8yMDAyICovCi0jZW5kaWYKLQotICAgIC8qIGFsd2F5cyBzdGFydCBmcm9tIGJhc2UgbGF5ZXIgKi8KLSAgICB2aWRlby0+Y3VyckxheWVyID0gMDsKLSAgICByZXR1cm4gc3RhdHVzOwotfQotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWUmVzZXRWaWRlb0RlY29kZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMDEvMTQvMjAwMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiBSZXNldCB2aWRlbyB0aW1lc3RhbXBzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotQm9vbCBQVlJlc2V0VmlkZW9EZWNvZGVyKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwpCi17Ci0gICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKikgZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKLSAgICBpbnQgaWR4OwotCi0gICAgZm9yIChpZHggPSAwOyBpZHggPCBkZWNDdHJsLT5uTGF5ZXJzOyBpZHgrKykKLSAgICB7Ci0gICAgICAgIHZpZGVvLT52b3BIZWFkZXJbaWR4XS0+dGltZVN0YW1wID0gMDsKLSAgICB9Ci0gICAgdmlkZW8tPnByZXZWb3AtPnRpbWVTdGFtcCA9IDA7Ci0gICAgaWYgKGRlY0N0cmwtPm5MYXllcnMgPiAxKQotICAgICAgICB2aWRlby0+cHJldkVuaGNWb3AtPnRpbWVTdGFtcCA9IDA7Ci0KLSAgICBvc2NsX21lbXNldCh2aWRlby0+bWJsb2NrLT5ibG9jaywgMCwgc2l6ZW9mKGludDE2KSo2Kk5DT0VGRl9CTE9DSyk7IC8vICBBdWcgMjMsMjAwNQotCi0gICAgcmV0dXJuIFBWX1RSVUU7Ci19Ci0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkNsZWFuVXBWaWRlb0RlY29kZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA0LzExLzIwMDAsIDA4LzI5LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogQ2xlYW51cCBvZiB0aGUgTVBFRy00IHZpZGVvIGRlY29kZXIgbGlicmFyeS4gICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLU9TQ0xfRVhQT1JUX1JFRiBCb29sIFBWQ2xlYW5VcFZpZGVvRGVjb2RlcihWaWRlb0RlY0NvbnRyb2xzICpkZWNDdHJsKQotewotICAgIGludCBpZHg7Ci0gICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKikgZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKLSNpZmRlZiBERUNfSU5URVJOQUxfTUVNT1JZX09QVAotICAgIGlmICh2aWRlbykKLSAgICB7Ci0jaWZkZWYgUFZfUE9TVFBST0NfT04KLSAgICAgICAgdmlkZW8tPnBzdHByY1R5cEN1ciA9IE5VTEw7Ci0gICAgICAgIHZpZGVvLT5wc3RwcmNUeXBQcnYgPSBOVUxMOwotI2VuZGlmCi0KLSAgICAgICAgdmlkZW8tPmFjUHJlZEZsYWcgICAgICAgPSBOVUxMOwotICAgICAgICB2aWRlby0+c2xpY2VObyAgICAgICAgICA9IE5VTEw7Ci0gICAgICAgIHZpZGVvLT5tb3RYICAgICAgICAgICAgID0gTlVMTDsKLSAgICAgICAgdmlkZW8tPm1vdFkgICAgICAgICAgICAgPSBOVUxMOwotICAgICAgICB2aWRlby0+bWJsb2NrICAgICAgICAgICA9IE5VTEw7Ci0gICAgICAgIHZpZGVvLT5RUE1CICAgICAgICAgICAgID0gTlVMTDsKLSAgICAgICAgdmlkZW8tPnByZWREQyAgICAgICAgICAgPSBOVUxMOwotICAgICAgICB2aWRlby0+cHJlZERDQUNfcm93ICAgICA9IE5VTEw7Ci0gICAgICAgIHZpZGVvLT5wcmVkRENBQ19jb2wgICAgID0gTlVMTDsKLSAgICAgICAgdmlkZW8tPmhlYWRlckluZm8uTW9kZSAgPSBOVUxMOwotICAgICAgICB2aWRlby0+aGVhZGVySW5mby5DQlAgICA9IE5VTEw7Ci0gICAgICAgIGlmICh2aWRlby0+bnVtYmVyT2ZMYXllcnMgPiAxKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAodmlkZW8tPnByZXZFbmhjVm9wKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHZpZGVvLT5wcmV2RW5oY1ZvcC0+dUNoYW4gPSBOVUxMOwotICAgICAgICAgICAgICAgIHZpZGVvLT5wcmV2RW5oY1ZvcC0+dkNoYW4gPSBOVUxMOwotICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cHJldkVuaGNWb3AtPnlDaGFuKSBvc2NsX2ZyZWUodmlkZW8tPnByZXZFbmhjVm9wLT55Q2hhbik7Ci0gICAgICAgICAgICAgICAgb3NjbF9mcmVlKHZpZGVvLT5wcmV2RW5oY1ZvcCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKHZpZGVvLT5jdXJyVm9wKQotICAgICAgICB7Ci0gICAgICAgICAgICB2aWRlby0+Y3VyclZvcC0+dUNoYW4gPSBOVUxMOwotICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnZDaGFuID0gTlVMTDsKLSAgICAgICAgICAgIGlmICh2aWRlby0+Y3VyclZvcC0+eUNoYW4pCi0gICAgICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnlDaGFuID0gTlVMTDsKLSAgICAgICAgICAgIHZpZGVvLT5jdXJyVm9wID0gTlVMTDsKLSAgICAgICAgfQotICAgICAgICBpZiAodmlkZW8tPnByZXZWb3ApCi0gICAgICAgIHsKLSAgICAgICAgICAgIHZpZGVvLT5wcmV2Vm9wLT51Q2hhbiA9IE5VTEw7Ci0gICAgICAgICAgICB2aWRlby0+cHJldlZvcC0+dkNoYW4gPSBOVUxMOwotICAgICAgICAgICAgaWYgKHZpZGVvLT5wcmV2Vm9wLT55Q2hhbikKLSAgICAgICAgICAgICAgICB2aWRlby0+cHJldlZvcC0+eUNoYW4gPSBOVUxMOwotICAgICAgICAgICAgdmlkZW8tPnByZXZWb3AgPSBOVUxMOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHZpZGVvLT52b2wpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgdmlkZW8tPm51bWJlck9mTGF5ZXJzOyBpZHgrKykKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnZvbFtpZHhdKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtQ2xvc2UodmlkZW8tPnZvbFtpZHhdLT5iaXRzdHJlYW0pOwotICAgICAgICAgICAgICAgICAgICB2aWRlby0+dm9sW2lkeF0tPmJpdHN0cmVhbSA9IE5VTEw7Ci0gICAgICAgICAgICAgICAgICAgIHZpZGVvLT52b2xbaWR4XSA9IE5VTEw7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHZpZGVvLT52b3BIZWFkZXJbaWR4XSA9IE5VTEw7Ci0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHZpZGVvLT52b2wgPSBOVUxMOwotICAgICAgICAgICAgdmlkZW8tPnZvcEhlYWRlciA9IE5VTEw7Ci0gICAgICAgIH0KLQotICAgICAgICB2aWRlbyA9IE5VTEw7Ci0gICAgICAgIGRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGEgPSBOVUxMOwotICAgIH0KLQotI2Vsc2UKLQotICAgIGlmICh2aWRlbykKLSAgICB7Ci0jaWZ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2NsX2ZyZWUodmlkZW8tPnByZXZWb3AtPnlDaGFuKTsKLSNlbmRpZgotICAgICAgICAgICAgb3NjbF9mcmVlKHZpZGVvLT5wcmV2Vm9wKTsKLSAgICAgICAgfQotCi0gICAgICAgIGlmICh2aWRlby0+dm9sKQotICAgICAgICB7Ci0gICAgICAgICAgICBmb3IgKGlkeCA9IDA7IGlkeCA8IHZpZGVvLT5udW1iZXJPZkxheWVyczsgaWR4KyspCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgaWYgKHZpZGVvLT52b2xbaWR4XSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby0+dm9sW2lkeF0tPmJpdHN0cmVhbSkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtQ2xvc2UodmlkZW8tPnZvbFtpZHhdLT5iaXRzdHJlYW0pOwotICAgICAgICAgICAgICAgICAgICAgICAgb3NjbF9mcmVlKHZpZGVvLT52b2xbaWR4XS0+Yml0c3RyZWFtKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBvc2NsX2ZyZWUodmlkZW8tPnZvbFtpZHhdKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG9zY2xfZnJlZSh2aWRlby0+dm9sKTsKLSAgICAgICAgfQotCi0gICAgICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgdmlkZW8tPm51bWJlck9mTGF5ZXJzOyBpZHgrKykKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKHZpZGVvLT52b3BIZWFkZXJbaWR4XSkgb3NjbF9mcmVlKHZpZGVvLT52b3BIZWFkZXJbaWR4XSk7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAodmlkZW8tPnZvcEhlYWRlcikgb3NjbF9mcmVlKHZpZGVvLT52b3BIZWFkZXIpOwotCi0gICAgICAgIG9zY2xfZnJlZSh2aWRlbyk7Ci0gICAgICAgIGRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGEgPSBOVUxMOwotICAgIH0KLSNlbmRpZgotICAgIHJldHVybiBQVl9UUlVFOwotfQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkdldFZpZGVvRGltZW5zaW9ucygpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA0MDUwNSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IHRoZSBkaXNwbGF5X3dpZHRoIGFuZCBkaXNwbGF5X2hlaWdodCBvZiAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgdGhlIGZyYW1lIGluIHRoZSBjdXJyZW50IGxheWVyLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTm90ZSAgICAgOiBUaGlzIGlzIG5vdCBhIG1hY3JvIG9yIGlubGluZSBmdW5jdGlvbiBiZWNhdXNlIHdlIGRvICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICBub3Qgd2FudCB0byBleHBvc2Ugb3VyIGludGVybmFsIGRhdGEgc3RydWN0dXJlLiAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLU9TQ0xfRVhQT1JUX1JFRiB2b2lkIFBWR2V0VmlkZW9EaW1lbnNpb25zKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwsIGludDMyICpkaXNwbGF5X3dpZHRoLCBpbnQzMiAqZGlzcGxheV9oZWlnaHQpCi17Ci0gICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKilkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhOwotICAgICpkaXNwbGF5X3dpZHRoID0gdmlkZW8tPmRpc3BsYXlXaWR0aDsKLSAgICAqZGlzcGxheV9oZWlnaHQgPSB2aWRlby0+ZGlzcGxheUhlaWdodDsKLX0KLQotT1NDTF9FWFBPUlRfUkVGIHZvaWQgUFZHZXRCdWZmZXJEaW1lbnNpb25zKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwsIGludDMyICp3aWR0aCwgaW50MzIgKmhlaWdodCkgewotICAgIFZpZGVvRGVjRGF0YSAqdmlkZW8gPSAoVmlkZW9EZWNEYXRhICopZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKLSAgICAqd2lkdGggPSB2aWRlby0+d2lkdGg7Ci0gICAgKmhlaWdodCA9IHZpZGVvLT5oZWlnaHQ7Ci19Ci0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZHZXRWaWRlb1RpbWVTdGFtcCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwNC8yNy8yMDAwLCAwOC8yOS8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBjdXJyZW50IHRpbWUgc3RhbXAgaW4gbWlsbGlzZWNvbmQuICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBOb3RlICAgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLXVpbnQzMiBQVkdldFZpZGVvVGltZVN0YW1wKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwpCi17Ci0gICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKilkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhOwotICAgIHJldHVybiB2aWRlby0+Y3VyclRpbWVzdGFtcDsKLX0KLQotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWU2V0UG9zdFByb2NUeXBlKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMDcvMDcvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogU2V0IHBvc3QtcHJvY2Vzc2luZyBmaWx0ZXIgdHlwZS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6IC4gMDgvMjkvMjAwMCBjaGFuZ2VzIHRoZSBuYW1lIGZvciBjb25zaXN0ZW5jeS4gICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi1PU0NMX0VYUE9SVF9SRUYgdm9pZCBQVlNldFBvc3RQcm9jVHlwZShWaWRlb0RlY0NvbnRyb2xzICpkZWNDdHJsLCBpbnQgbW9kZSkKLXsKLSAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKWRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGE7Ci0gICAgdmlkZW8tPnBvc3RGaWx0ZXJUeXBlID0gbW9kZTsKLX0KLQotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWR2V0RGVjQml0cmF0ZSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMDgvMjMvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogVGhpcyBmdW5jdGlvbiByZXR1cm5zIHRoZSBhdmVyYWdlIGJpdHMgcGVyIHNlY29uZC4gICAgICAgICAgICovCi0vKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi1pbnQgUFZHZXREZWNCaXRyYXRlKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwpCi17Ci0gICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKilkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhOwotICAgIGludCAgICAgaWR4OwotICAgIGludDMyICAgc3VtID0gMDsKLQotICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgQklUUkFURV9BVkVSQUdFX1dJTkRPVzsgaWR4KyspCi0gICAgewotICAgICAgICBzdW0gKz0gdmlkZW8tPm5CaXRzUGVyVm9wW2lkeF07Ci0gICAgfQotICAgIHN1bSA9IChzdW0gKiB2aWRlby0+ZnJhbWVSYXRlKSAvICgxMCAqIEJJVFJBVEVfQVZFUkFHRV9XSU5ET1cpOwotICAgIHJldHVybiAoaW50KSBzdW07Ci19Ci0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkdldERlY0ZyYW1lcmF0ZSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA4LzIzLzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IFRoaXMgZnVuY3Rpb24gcmV0dXJucyB0aGUgYXZlcmFnZSBmcmFtZSBwZXIgMTAgc2Vjb25kLiAgICAgICAqLwotLyogIE5vdGUgICAgIDogVGhlIGZwcyBjYW4gYmUgY2FsY3VsYXRlZCBieSBQVkdldERlY0ZyYW1lcmF0ZSgpLzEwICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotaW50IFBWR2V0RGVjRnJhbWVyYXRlKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwpCi17Ci0gICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKilkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhOwotCi0gICAgcmV0dXJuIHZpZGVvLT5mcmFtZVJhdGU7Ci19Ci0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZHZXRPdXRwdXRGcmFtZSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwNS8wNy8yMDAxICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBUaGlzIGZ1bmN0aW9uIHJldHVybnMgdGhlIHBvaW50ZXIgdG8gdGhlIG91dHB1dCBmcmFtZSAgICAgICAgKi8KLS8qICBOb3RlICAgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLXVpbnQ4ICpQVkdldERlY091dHB1dEZyYW1lKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwpCi17Ci0gICAgcmV0dXJuIGRlY0N0cmwtPm91dHB1dEZyYW1lOwotfQotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWR2V0TGF5ZXJJRCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMDcvMDkvMjAwMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogVGhpcyBmdW5jdGlvbiByZXR1cm5zIGRlY29kZWQgZnJhbWUgbGF5ZXIgaWQgKEJBU0UvRU5IQU5DRSkgICovCi0vKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi1pbnQgUFZHZXRMYXllcklEKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwpCi17Ci0gICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKilkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhOwotICAgIHJldHVybiB2aWRlby0+Y3VyckxheWVyOwotfQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkdldERlY01lbW9yeVVzYWdlKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA4LzIzLzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IFRoaXMgZnVuY3Rpb24gcmV0dXJucyB0aGUgYW1vdW50IG9mIG1lbW9yeSB1c2VkLiAgICAgICAgICAgICAqLwotLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotaW50MzIgUFZHZXREZWNNZW1vcnlVc2FnZShWaWRlb0RlY0NvbnRyb2xzICpkZWNDdHJsKQotewotICAgIFZpZGVvRGVjRGF0YSAqdmlkZW8gPSAoVmlkZW9EZWNEYXRhICopZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKLSAgICByZXR1cm4gdmlkZW8tPm1lbW9yeVVzYWdlOwotfQotCi0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZHZXREZWNCaXRzdHJlYW1Nb2RlKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwOC8yMy8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBUaGlzIGZ1bmN0aW9uIHJldHVybnMgdGhlIGRlY29kaW5nIG1vZGUgb2YgdGhlIGJhc2VsYXllciAgICAgKi8KLS8qICAgICAgICAgICAgICBiaXRzdHJlYW0uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotT1NDTF9FWFBPUlRfUkVGIE1QNERlY29kaW5nTW9kZSBQVkdldERlY0JpdHN0cmVhbU1vZGUoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCkKLXsKLSAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKWRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGE7Ci0gICAgaWYgKHZpZGVvLT5zaG9ydFZpZGVvSGVhZGVyKQotICAgIHsKLSAgICAgICAgcmV0dXJuIEgyNjNfTU9ERTsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgcmV0dXJuIE1QRUc0X01PREU7Ci0gICAgfQotfQotCi0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZFeHRyYWN0Vm9sSGVhZGVyKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwOC8yOS8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBFeHRyYWN0IHZvbCBoZWFkZXIgb2YgdGhlIGJpdHN0cmVhbSBmcm9tIGJ1ZmZlcltdLiAgICAgICAgICAgKi8KLS8qICBOb3RlICAgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLUJvb2wgUFZFeHRyYWN0Vm9sSGVhZGVyKHVpbnQ4ICp2aWRlb19idWZmZXIsIHVpbnQ4ICp2b2xfaGVhZGVyLCBpbnQzMiAqdm9sX2hlYWRlcl9zaXplKQotewotICAgIGludCBpZHggPSAtMTsKLSAgICB1aW50OCBzdGFydF9jb2RlX3ByZWZpeFtdID0geyAweDAwLCAweDAwLCAweDAxIH07Ci0gICAgdWludDggaDI2M19wcmVmaXhbXSA9IHsgMHgwMCwgMHgwMCwgMHg4MCB9OwotCi0gICAgaWYgKG9zY2xfbWVtY21wKGgyNjNfcHJlZml4LCB2aWRlb19idWZmZXIsIDMpID09IDApIC8qIHdlIGhhdmUgc2hvcnQgaGVhZGVyIHN0cmVhbSAqLwotICAgIHsKLSAgICAgICAgb3NjbF9tZW1jcHkodm9sX2hlYWRlciwgdmlkZW9fYnVmZmVyLCAzMik7Ci0gICAgICAgICp2b2xfaGVhZGVyX3NpemUgPSAzMjsKLSAgICAgICAgcmV0dXJuIFRSVUU7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIGlmIChvc2NsX21lbWNtcChzdGFydF9jb2RlX3ByZWZpeCwgdmlkZW9fYnVmZmVyLCAzKSB8fAotICAgICAgICAgICAgICAgICh2aWRlb19idWZmZXJbM10gIT0gMHhiMCAmJiB2aWRlb19idWZmZXJbM10gPj0gMHgyMCkpIHJldHVybiBGQUxTRTsKLQotICAgICAgICBkbwotICAgICAgICB7Ci0gICAgICAgICAgICBpZHgrKzsKLSAgICAgICAgICAgIHdoaWxlIChvc2NsX21lbWNtcChzdGFydF9jb2RlX3ByZWZpeCwgdmlkZW9fYnVmZmVyICsgaWR4LCAzKSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZHgrKzsKLSAgICAgICAgICAgICAgICBpZiAoaWR4ICsgMyA+PSAqdm9sX2hlYWRlcl9zaXplKSBnb3RvIHF1aXQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgd2hpbGUgKHZpZGVvX2J1ZmZlcltpZHgrM10gIT0gMHhiMyAmJiB2aWRlb19idWZmZXJbaWR4KzNdICE9IDB4YjYpOwotCi0gICAgICAgIG9zY2xfbWVtY3B5KHZvbF9oZWFkZXIsIHZpZGVvX2J1ZmZlciwgaWR4KTsKLSAgICAgICAgKnZvbF9oZWFkZXJfc2l6ZSA9IGlkeDsKLSAgICAgICAgcmV0dXJuIFRSVUU7Ci0gICAgfQotCi1xdWl0OgotICAgIG9zY2xfbWVtY3B5KHZvbF9oZWFkZXIsIHZpZGVvX2J1ZmZlciwgKnZvbF9oZWFkZXJfc2l6ZSk7Ci0gICAgcmV0dXJuIEZBTFNFOwotfQotCi0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZMb2NhdGVGcmFtZUhlYWRlcigpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwNC84LzIwMDUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBSZXR1cm4gdGhlIG9mZnNldCB0byB0aGUgZmlyc3QgU0MgaW4gdGhlIGJ1ZmZlciAgICAgICAgICAgICAgKi8KLS8qICBOb3RlICAgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLWludDMyIFBWTG9jYXRlRnJhbWVIZWFkZXIodWludDggKnB0ciwgaW50MzIgc2l6ZSkKLXsKLSAgICBpbnQgY291bnQgPSAwOwotICAgIGludDMyIGkgPSBzaXplOwotCi0gICAgaWYgKHNpemUgPCAxKQotICAgIHsKLSAgICAgICAgcmV0dXJuIDA7Ci0gICAgfQotICAgIHdoaWxlIChpLS0pCi0gICAgewotICAgICAgICBpZiAoKGNvdW50ID4gMSkgJiYgKCpwdHIgPT0gMHgwMSkpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGkgKz0gMjsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKCpwdHIrKykKLSAgICAgICAgICAgIGNvdW50ID0gMDsKLSAgICAgICAgZWxzZQotICAgICAgICAgICAgY291bnQrKzsKLSAgICB9Ci0gICAgcmV0dXJuIChzaXplIC0gKGkgKyAxKSk7Ci19Ci0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkxvY2F0ZUgyNjNGcmFtZUhlYWRlcigpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA0LzgvMjAwNSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IFJldHVybiB0aGUgb2Zmc2V0IHRvIHRoZSBmaXJzdCBTQyBpbiB0aGUgYnVmZmVyICAgICAgICAgICAgICAqLwotLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotaW50MzIgUFZMb2NhdGVIMjYzRnJhbWVIZWFkZXIodWludDggKnB0ciwgaW50MzIgc2l6ZSkKLXsKLSAgICBpbnQgY291bnQgPSAwOwotICAgIGludDMyIGkgPSBzaXplOwotCi0gICAgaWYgKHNpemUgPCAxKQotICAgIHsKLSAgICAgICAgcmV0dXJuIDA7Ci0gICAgfQotCi0gICAgd2hpbGUgKGktLSkKLSAgICB7Ci0gICAgICAgIGlmICgoY291bnQgPiAxKSAmJiAoKCpwdHIgJiAweEZDKSA9PSAweDgwKSkKLSAgICAgICAgewotICAgICAgICAgICAgaSArPSAyOwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoKnB0cisrKQotICAgICAgICAgICAgY291bnQgPSAwOwotICAgICAgICBlbHNlCi0gICAgICAgICAgICBjb3VudCsrOwotICAgIH0KLSAgICByZXR1cm4gKHNpemUgLSAoaSArIDEpKTsKLX0KLQotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWRGVjb2RlVmlkZW9GcmFtZSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMDgvMjkvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiBEZWNvZGUgb25lIHZpZGVvIGZyYW1lIGFuZCByZXR1cm4gYSBZVVYtMTIgaW1hZ2UuICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6IDA0LzE3LzIwMDEgcmVtb3ZlZCBQVl9FT1MsIFBWX0VORF9PRl9CVUZGRVIgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgOiAwOC8yMi8yMDAyIGJyZWFrIHVwIGludG8gMiBmdW5jdGlvbnMgUFZEZWNvZGVWb3BIZWFkZXIgYW5kICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgUFZEZWNvZGVWb3BCb2R5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotT1NDTF9FWFBPUlRfUkVGIEJvb2wgUFZEZWNvZGVWaWRlb0ZyYW1lKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwsIHVpbnQ4ICpidWZmZXJbXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzIgdGltZXN0YW1wW10sIGludDMyIGJ1ZmZlcl9zaXplW10sIHVpbnQgdXNlX2V4dF90aW1lc3RhbXBbXSwgdWludDggKmN1cnJZVVYpCi17Ci0gICAgUFZfU1RBVFVTIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgVm9wSGVhZGVySW5mbyBoZWFkZXJfaW5mbzsKLQotICAgIHN0YXR1cyA9IChQVl9TVEFUVVMpUFZEZWNvZGVWb3BIZWFkZXIoZGVjQ3RybCwgYnVmZmVyLCB0aW1lc3RhbXAsIGJ1ZmZlcl9zaXplLCAmaGVhZGVyX2luZm8sIHVzZV9leHRfdGltZXN0YW1wLCBjdXJyWVVWKTsKLSAgICBpZiAoc3RhdHVzICE9IFBWX1RSVUUpCi0gICAgICAgIHJldHVybiBQVl9GQUxTRTsKLQotICAgIGlmIChQVkRlY29kZVZvcEJvZHkoZGVjQ3RybCwgYnVmZmVyX3NpemUpICE9IFBWX1RSVUUpCi0gICAgewotICAgICAgICByZXR1cm4gUFZfRkFMU0U7Ci0gICAgfQotCi0gICAgcmV0dXJuIFBWX1RSVUU7Ci19Ci0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZEZWNvZGVWb3BIZWFkZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwOC8yMi8yMDAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IERldGVybWluZSB0YXJnZXQgbGF5ZXIgYW5kIGRlY29kZSB2b3AgaGVhZGVyLCBtb2RpZmllZCBmcm9tICAqLwotLyogICAgICAgICAgICAgIG9yaWdpbmFsIFBWRGVjb2RlVmlkZW9GcmFtZS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotQm9vbCBQVkRlY29kZVZvcEhlYWRlcihWaWRlb0RlY0NvbnRyb2xzICpkZWNDdHJsLCB1aW50OCAqYnVmZmVyW10sCi0gICAgICAgICAgICAgICA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nVlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvKiBkaWQgdGhlIGFwcGxpY2F0aW9uIHByb3ZpZGUgYSB0aW1lc3RhbXAgZm9yIHRoaXMgdm9wPyAqLwotICAgICAgICAgICAgaWYgKHRpbWVzdGFtcFtpZHhdIDwgMCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZiAodm9wSGVhZGVyW2lkeF0tPnRpbWVTdGFtcCA8IDApCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAvKiBkZWNvZGUgdGhlIHRpbWVzdGFtcCBpbiB0aGUgYml0c3RyZWFtICovCi0gICAgICAgICAgICAgICAgICAgIHZpZGVvLT5jdXJyTGF5ZXIgPSBpZHg7Ci0gICAgICAgICAgICAgICAgICAgIHN0cmVhbSA9IHZpZGVvLT52b2xbaWR4XS0+Yml0c3RyZWFtOwotICAgICAgICAgICAgICAgICAgICBCaXRzdHJlYW1SZXNldChzdHJlYW0sIGJ1ZmZlcltpZHhdLCBidWZmZXJfc2l6ZVtpZHhdKTsKLQotICAgICAgICAgICAgICAgICAgICB3aGlsZSAoKHN0YXR1cyA9IERlY29kZVZPUEhlYWRlcih2aWRlbywgdm9wSGVhZGVyW2lkeF0sIEZBTFNFKSkgIT0gUFZfU1VDQ0VTUykKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgLyogVHJ5IHRvIGZpbmQgYSBWT1AgaGVhZGVyIGluIHRoZSBidWZmZXIuICAgMDgvMzAvMjAwMC4gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChQVlNlYXJjaE5leHRNNFZGcmFtZShzdHJlYW0pICE9IFBWX1NVQ0NFU1MpCi0gICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogaWYgd2UgZG9uJ3QgaGF2ZSBkYXRhIGZvciBlbmhhbmNlbWVudCBsYXllciwgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAgICBkb24ndCBqdXN0IHN0b3AuICAgMDkvMDcvMjAwMC4gICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXJfc2l6ZVtpZHhdID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzID09IFBWX1NVQ0NFU1MpCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHZvcEhlYWRlcltpZHhdLT50aW1lU3RhbXAgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVzdGFtcFtpZHhdID0gQ2FsY1ZvcERpc3BsYXlUaW1lKHZpZGVvLT52b2xbaWR4XSwgdm9wSGVhZGVyW2lkeF0sIHZpZGVvLT5zaG9ydFZpZGVvSGVhZGVyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpZHggPT0gMCkgdm9wSGVhZGVyW2lkeF0tPnJlZlNlbGVjdENvZGUgPSAxOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIC8qIFdlJ3ZlIGRlY29kZWQgdGhpcyB2b3AgaGVhZGVyIGluIHRoZSBwcmV2aW91cyBydW4gYWxyZWFkeS4gKi8KLSAgICAgICAgICAgICAgICAgICAgdGltZXN0YW1wW2lkeF0gPSB2b3BIZWFkZXJbaWR4XS0+dGltZVN0YW1wOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgLyogVXNlIHRpbWVzdGFtcHMgdG8gc2VsZWN0IHRoZSBuZXh0IFZPUCB0byBiZSBkZWNvZGVkICovCi0gICAgICAgICAgICBpZ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lcl9zaXplWzBdID0gMDsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5pbml0aWFsaXplZCA9PSBQVl9GQUxTRSkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGlzcGxheUhlaWdodCA9IHZpZGVvLT5oZWlnaHQgPSAwOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUxTRTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmICh1c2VfZXh0X3RpbWVzdGFtcFswXSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAvKiBNVEIgZm9yIEgyNjMgaXMgYWJzb2x1dGUgVFIgKi8KLSAgICAgICAgICAgICAgICAvKiBmb2xsb3dpbmcgbGluZSBpcyBlcXVpdmFsZW50IHRvICByb3VuZCgodGltZXN0YW1wWzBdKjMwKS8xMDAxKTsgICAxMS8xMy8yMDAxICovCi0gICAgICAgICAgICAgICAgdmlkZW8tPnZvbFswXS0+bW9kdWxvVGltZUJhc2UgPSAzMCAqICgodGltZXN0YW1wWzBdICsgMTcpIC8gMTAwMSkgKyAoMzAgKiAoKHRpbWVzdGFtcFswXSArIDE3KSAlIDEwMDEpIC8gMTAwMSk7Ci0gICAgICAgICAgICAgICAgdm9wSGVhZGVyWzBdLT50aW1lU3RhbXAgPSB0aW1lc3RhbXBbMF07Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgdm9wSGVhZGVyWzBdLT50aW1lU3RhbXAgPSBDYWxjVm9wRGlzcGxheVRpbWUoY3VyclZvbCwgdm9wSGVhZGVyWzBdLCB2aWRlby0+c2hvcnRWaWRlb0hlYWRlcik7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICB3aGlsZSAoRGVjb2RlVk9QSGVhZGVyKHZpZGVvLCB2b3BIZWFkZXJbMF0sIEZBTFNFKSAhPSBQVl9TVUNDRVNTKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8qIFRyeSB0byBmaW5kIGEgVk9QIGhlYWRlciBpbiB0aGUgYnVmZmVyLiAgIDA4LzMwLzIwMDAuICovCi0gICAgICAgICAgICAgICAgaWYgKFBWU2VhcmNoTmV4dE00VkZyYW1lKHN0cmVhbSkgIT0gUFZfU1VDQ0VTUykKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIC8qIFRoZXJlIGlzIG5vIHZvcCBoZWFkZXIgaW4gdGhlIGJ1ZmZlciwgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgLyogICBjbGVhbiBiaXRzdHJlYW0gYnVmZmVyLiAgICAgMi81LzIwMDEgICAqLwotICAgICAgICAgICAgICAgICAgICBidWZmZXJfc2l6ZVswXSA9IDA7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUxTRTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmICh1c2VfZXh0X3RpbWVzdGFtcFswXSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB2aWRlby0+dm9sWzBdLT50aW1lSW5jX29mZnNldCA9IHZvcEhlYWRlclswXS0+dGltZUluYzsKLSAgICAgICAgICAgICAgICB2aWRlby0+dm9sWzBdLT5tb2R1bG9UaW1lQmFzZSA9IHRpbWVzdGFtcFswXTsgIC8qICAxMS8xMi8yMDAxICovCi0gICAgICAgICAgICAgICAgdm9wSGVhZGVyWzBdLT50aW1lU3RhbXAgPSB0aW1lc3RhbXBbMF07Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7Ci0gICA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21lbWNweShjdXJyVm9wLCB2b3BIZWFkZXJbdGFyZ2V0X2xheWVyXSwgc2l6ZW9mKFZvcCkpOwotCi0jaWZkZWYgUFZfU1VQUE9SVF9URU1QT1JBTF9TQ0FMQUJJTElUWQotICAgIHZvcEhlYWRlclt0YXJnZXRfbGF5ZXJdLT50aW1lU3RhbXAgPSAtMTsKLSNlbmRpZgotICAgIC8qIHB1dCBoZWFkZXIgaW5mbyBpbnRvIHRoZSBzdHJ1Y3R1cmUgKi8KLSAgICBoZWFkZXJfaW5mby0+Y3VyckxheWVyID0gdGFyZ2V0X2xheWVyOwotICAgIGhlYWRlcl9pbmZvLT50aW1lc3RhbXAgPSB2aWRlby0+Y3VyclRpbWVzdGFtcDsKLSAgICBoZWFkZXJfaW5mby0+ZnJhbWVUeXBlID0gKE1QNEZyYW1lVHlwZSljdXJyVm9wLT5wcmVkaWN0aW9uVHlwZTsKLSAgICBoZWFkZXJfaW5mby0+cmVmU2VsQ29kZSA9IHZvcEhlYWRlclt0YXJnZXRfbGF5ZXJdLT5yZWZTZWxlY3RDb2RlOwotICAgIGhlYWRlcl9pbmZvLT5xdWFudGl6ZXIgPSBjdXJyVm9wLT5xdWFudGl6ZXI7Ci0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotICAgIHJldHVybiBQVl9UUlVFOwotfQotCi0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZEZWNvZGVWb3BCb2R5KCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwOC8yMi8yMDAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IERlY29kZSB2b3AgYm9keSBhZnRlciB0aGUgaGVhZGVyIGlzIGRlY29kZWQsIG1vZGlmaWVkIGZyb20gICAqLwotLyogICAgICAgICAgICAgIG9yaWdpbmFsIFBWRGVjb2RlVmlkZW9GcmFtZS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotQm9vbCBQVkRlY29kZVZvcEJvZHkoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgaW50MzIgYnVmZmVyX3NpemVbXSkKLXsKLSAgICBQVl9TVEFUVVMgc3RhdHVzID0gUFZfRkFJTDsKLSAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKSBkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhOwotICAgIGludCB0YXJnZXRfbGF5ZXIgPSB2aWRlby0+Y3VyckxheWVyOwotICAgIFZvbCAqY3VyclZvbCA9IHZpZGVvLT52b2xbdGFyZ2V0X2xheWVyXTsKLSAgICBWb3AgKmN1cnJWb3AgPSB2aWRlby0+Y3VyclZvcDsKLSAgICBWb3AgKnByZXZWb3AgPSB2aWRlby0+cHJldlZvcDsKLSAgICBWb3AgKnRlbXBWb3BQdHI7Ci0gICAgaW50IGJ5dGVzX2Nvbn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ICB2aWRlby0+dm9wX2NvZGluZ190eXBlID0gY3VyclZvcC0+cHJlZGljdGlvblR5cGU7IC8qICAwNy8wOS8wMSAqLwotICAgICAgICAvKiB0aGUgZm9sbG93aW5nIGlzIG5lY2Vzc2FyeSB0byBhdm9pZCBkaXNwbGF5aW5nIGFuIG5vdENvZGVkIEktVk9QIGF0IHRoZSBiZWdpbm5pbmcgb2YgYSBzZXNzaW9uCi0gICAgICAgIG9yIGFmdGVyIHJhbmRvbSBwb3NpdGlvbmluZyAgMDcvMDMvMDIqLwotICAgICAgICBpZiAoY3VyclZvcC0+cHJlZGljdGlvblR5cGUgPT0gSV9WT1ApCi0gICAgICAgIHsKLSAgICAgICAgICAgIHZpZGVvLT52b3BfY29kaW5nX3R5cGUgPSBQX1ZPUDsKLSAgICAgICAgfQotCi0KLSAgICAgICAgcmV0dXJuIFBWX1RSVUU7Ci0gICAgfQotICAgIC8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLSAgICAvKiAgRGVjb2RlIHZvcCBib2R5IChpZiB0aGVyZSBpcyBubyBlcnJvciBpbiB0aGUgaGVhZGVyISkgICovCi0gICAgLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotCi0gICAgLyogZmlyc3QsIHdlIG5lZWQgdG8gc2VsZWN0IGEgcmVmZXJlbmNlIGZyYW1lICovCi0gICAgaWYgKGRlY0N0cmwtPm5MYXllcnMgPiAxKQotICAgIHsKLSAgICAgICAgaWYgKGN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID09IElfVk9QKQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBkbyBub3RoaW5nIGhlcmUgKi8KLSAgICAgICAgfQotICAgICAgICBlbHNlIGlmIChjdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9PSBQX1ZPUCkKLSAgICAgICAgewotICAgICAgICAgICAgc3dpdGNoIChjdXJyVm9wLT5yZWZTZWxlY3RDb2RlKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGNhc2UgMCA6IC8qIG1vc3QgcmVjZW50bHkgZGVjb2RlZCBlbmhhbmNlbWVudCB2b3AgKi8KLSAgICAgICAgICAgICAgICAgICAgLyogU2V0dXAgdmlkZW8tPnByZXZWb3AgYmVmb3JlIHdlIGNhbGwgUFZfRGVjb2RlVm9wKCkuICAgMDQvMjQvMjAwMSAqLwotICAgICAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnByZXZFbmhjVm9wLT50aW1lU3RhbXAgPj0gdmlkZW8tPnByZXZWb3AtPnRpbWVTdGFtcCkKLSAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvLT5wcmV2Vm9wID0gdmlkZW8tPnByZXZFbmhjVm9wOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgMSA6IC8qIG1vc3QgcmVjZW50bHkgZGlzcGxheWVkIGJhc2UtbGF5ZXIgdm9wICovCi0gICAgICAgICAgICAgICAgICAgIGlmICh0YXJnZXRfbGF5ZXIpCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cHJldkVuaGNWb3AtPnRpbWVTdGFtcCA+IHZpZGVvLT5wcmV2Vm9wLT50aW1lU3RhbXApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnByZXZWb3AgPSB2aWRlby0+cHJldkVuaGNWb3A7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIDIgOiAvKiBuZXh0IGJhc2UtbGF5ZXIgdm9wIGluIGRpc3BsYXkgb3JkZXIgKi8KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIDMgOiAvKiB0ZW1wb3JhbGx5IGNvaW5ja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ZPUCBwb2ludGVycy4gIE5vIGVuaGMuIGZyYW1lIG9zY2xfbWVtY3B5KCkgYW55bW9yZSEgICAwNC8yNC8yMDAxICovCi0gICAgICAgICAgICBpZiAodGFyZ2V0X2xheWVyKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHRlbXBWb3BQdHIgPSB2aWRlby0+cHJldkVuaGNWb3A7Ci0gICAgICAgICAgICAgICAgdmlkZW8tPnByZXZFbmhjVm9wID0gdmlkZW8tPmN1cnJWb3A7Ci0gICAgICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AgPSB0ZW1wVm9wUHRyOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHRlbXBWb3BQdHIgPSB2aWRlby0+cHJldlZvcDsKLSAgICAgICAgICAgICAgICB2aWRlby0+cHJldlZvcCA9IHZpZGVvLT5jdXJyVm9wOwotICAgICAgICAgICAgICAgIHZpZGVvLT5jdXJyVm9wID0gdGVtcFZvcFB0cjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgIGRlZmF1bHQgOgotICAgICAgICAgICAgLyogVGhpcyB3aWxsIG5ldmVyIGhhcHBlbiAqLwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgfQotCi0gICAgcmV0dXJuIFBWX1RSVUU7Ci19Ci0KLSNpZmRlZiBQVl9NRU1PUllfUE9PTAotT1NDTF9FWFBPUlRfUkVGIHZvaWQgUFZTZXRSZWZlcmVuY2VZVVYoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgdWludDggKllVVikKLXsKLSAgICBWaWRlb0RlY0RhdGEgKnZpZGVvID0gKFZpZGVvRGVjRGF0YSAqKWRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGE7Ci0gICAgdmlkZW8tPnByZXZWb3AtPnlDaGFuID0gKFBJWEVMICopWVVWOwotICAgIHZpZGVvLT5wcmV2Vm9wLT51Q2hhbiA9IChQSVhFTCAqKVlVViArIHZpZGVvLT5zaXplOwotICAgIHZpZGVvLT5wcmV2Vm9wLT52Q2hhbiA9IChQSVhFTCAqKXZpZGVvLT5wcmV2Vm9wLT51Q2hhbiArIChkZWNDdHJsLT5zaXplID4+IDIpOwotICAgIG9zY2xfbWVtc2V0KHZpZGVvLT5wcmV2Vm9wLT55Q2hhbiwgMTYsIHNpemVvZih1aW50OCkqZGVjQ3RybC0+c2l6ZSk7ICAgICAvKiAgMTAvMzEvMDEgKi8KLSAgICBvc2NsX21lbXNldCh2aWRlby0+cHJldlZvcC0+dUNoYW4sIDEyOCwgc2l6ZW9mKHVpbnQ4KSpkZWNDdHJsLT5zaXplIC8gMik7Ci0gICAgdmlkZW8tPmNvbmNlYWxGcmFtZSA9IHZpZGVvLT5wcmV2Vm9wLT55Q2hhbjsgICAgICAgICAgICAgICAvKiAgMDcvMDcvMjAwMSAqLwotICAgIGRlY0N0cmwtPm91dHB1dEZyYW1lID0gdmlkZW8tPnByZXZWb3AtPnlDaGFuOyAgICAgICAgICAgICAgLyogIDA2LzE5LzIwMDIgKi8KLX0KLSNlbmRpZgotCi0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwNi8yMC8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBUaGlzIGZ1bmN0aW9uIHdpbGwgYmUgY2FsbGVkIGV2ZXJ5dGltZSBhbiBlcnJvciBpbnQgdGhlICAgICAgKi8KLS8qICAgICAgICAgICAgICBiaXRzdHJlYW0gaXMgZGV0ZWN0ZWQuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotdWludCBWaWRlb0RlY29kZXJFcnJvckRldGVjdGVkKFZpZGVvRGVjRGF0YSAqKQotewotICAgIC8qIFRoaXMgaXMgb25seSB1c2VkIGZvciB0cmFwcGluZyBiaXRzdHJlYW0gZXJyb3IgZm9yIGRlYnVnaW5nICovCi0gICAgcmV0dXJuIDA7Ci19Ci0KLSNpZmRlZiBFTkFCTEVfTE9HCi0jaW5jbHVkZSA8c3RkaW8uaD4KLSNpbmNsdWRlIDxzdGRhcmcuaD4KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogbTR2ZGVjX2RwcmludGYoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwOC8xNS8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IFRoaXMgaXMgYSBmdW5jdGlvbiB0aGF0IGxvZ3MgbWVzc2FnZXMgaW4gdGhlIG1wZWc0IHZpZGVvICAgICAqLwotLyogICAgICAgICAgICAgZGVjb2Rlci4gIFdlIGNhbiBjYWxsIHRoZSBzdGFuZGFyZCBQYWNrZXRWaWRlbyBQVk1lc3NhZ2UgICAgICovCi0vKiAgICAgICAgICAgICBmcm9tIGluc2lkZSB0aGlzIGZ1bmN0aW9uIGlmIG5lY2Vzc2FyeS4gICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTm90ZSAgICAgOiBUbyB0dXJuIG9uIHRoZSBsb2dnaW5nLCBMT0dfTVA0REVDX01FU1NBR0UgbXVzdCBiZSBkZWZpbmVkICAgKi8KLS8qICAgICAgICAgICAgICB3aGVuIGNvbXBpbGluZyB0aGlzIGZpbGUgKG9ubHkgdGhpcyBmaWxlKS4gICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLXZvaWQgbTR2ZGVjX2RwcmludGYoY2hhciAqZm9ybWF0LCAuLi4pCi17Ci0gICAgRklMRSAqbG9nX2ZwOwotICAgIHZhX2xpc3QgYXJnczsKLSAgICB2YV9zdGFydChhcmdzLCBmb3JtYXQpOwotCi0gICAgLyogb3BlbiB0aGUgbG9nIGZpbGUgKi8KLSAgICBsb2dfZnAgPSBmb3BlbigiXFxtcDRkZWNfbG9nLnR4dCIsICJhKyIpOwotICAgIGlmIChsb2dfZnAgPT0gTlVMTCkgcmV0dXJuOwotICAgIC8qIG91dHB1dCB0aGUgbWVzc2FnZSAqLwotICAgIHZmcHJpbnRmKGxvZ19mcCwgZm9ybWF0LCBhcmdzKTsKLSAgICBmY2xvc2UobG9nX2ZwKTsKLQotICAgIHZhX2VuZChhcmdzKTsKLX0KLSNlbmRpZgotCi0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogSXNJbnRyYUZyYW1lKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwNS8yOS8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBUaGUgbW9zdCByZWNlbnRseSBkZWNvZGVkIGZyYW1lIGlzIGFuIEludHJhIGZyYW1lLiAgICAgICAgICAgKi8KLS8qICBOb3RlICAgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLUJvb2wgSXNJbnRyYUZyYW1lKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwpCi17Ci0gICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKilkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhOwotICAgIHJldHVybiAodmlkZW8tPnZvcF9jb2RpbmdfdHlwZSA9PSBJX1ZPUCk7Ci19Ci0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZEZWNQb3N0UHJvY2VzcygpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwMS8wOS8yMDAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IFBvc3RQcm9jZXNzIG9uZSB2aWRlbyBmcmFtZSBhbmQgcmV0dXJuIGEgWVVWLTEyIGltYWdlLiAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBOb3RlICAgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLXZvaWQgUFZEZWNQb3N0UHJvY2VzcyhWaWRlb0RlY0NvbnRyb2xzICpkZWNDdHJsLCB1aW50OCAqb3V0cHV0WVVWKQotewotICAgIHVpbnQ4ICpvdXRwdXRCdWZmZXI7Ci0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gICAgb3V0cHV0QnVmZmVyID0gZGVjQ3RybC0+b3V0cHV0RnJhbWU7Ci0gICAgb3V0cHV0WVVWOwotI2VuZGlmCi0gICAgZGVjQ3RybC0+b3V0cHV0RnJhbWUgPSBvdXRwdXRCdWZmZXI7Ci0gICAgcmV0dXJuOwotfQotCi0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZEZWNTZXRSZWZlcmVuY2UoVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgdWludDggKnJlZllVViwgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyIHRpbWVzdGFtcCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA3LzIyLzIwMDMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogR2V0IFlVViByZWZlcmVuY2UgZnJhbWUgZnJvbSBleHRlcm5hbCBzb3VyY2UuICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiBZVVYgNC0yLTAgZnJhbWUgY29udGFpbmluZyBuZXcgcmVmZXJlbmNlIGZyYW1lIGluIHRoZSBzYW1lICAgKi8KLS8qICAgOiBkaW1lbnNpb24gYXMgb3JpZ2luYWwsIGkuZS4sIGRvZXNuJ3QgaGF2ZSB0byBiZSBtdWx0aXBsZSBvZiAxNiAhISEuICAqLwotLyogIFJldHVybiAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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oZHN0UHRyMiwgb3JnUHRyMiwgKHNpemUgPj4gMikpOwotCi0gICAgdmlkZW8tPmNvbmNlYWxGcmFtZSA9IHZpZGVvLT5wcmV2Vm9wLT55Q2hhbjsKLSAgICB2aWRlby0+dm9wX2NvZGluZ190eXBlID0gSV9WT1A7Ci0gICAgZGVjQ3RybC0+b3V0cHV0RnJhbWUgPSB2aWRlby0+cHJldlZvcC0+eUNoYW47Ci0KLSAgICByZXR1cm4gUFZfVFJVRTsKLX0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkRlY1NldEVuaFJlZmVyZW5jZShWaWRlb0RlY0NvbnRyb2xzICpkZWNDdHJsLCB1aW50OCAqcmVmWVVWLCAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyIHRpbWVzdGFtcCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA3LzIzLzIwMDMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogR2V0IFlVViBlbmhhbmNlIHJlZmVyZW5jZSBmcmFtZSBmcm9tIGV4dGVybmFsIHNvdXJjZS4gICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiBZVVYgNC0yLTAgZnJhbWUgY29udGFpbmluZyBuZXcgcmVmZXJlbmNlIGZyYW1lIGluIHRoZSBzYW1lICAgKi8KLS8qICAgOiBkaW1lbnNpb24gYXMgb3JpZ2luYWwsIGkuZS4sIGRvZXNuJ3QgaGF2ZSB0byBiZSBtdWx0aXBsZSBvZiAxNiAhISEuICAqLwotLyogIFJldHVybiAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTm90ZSAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi1Cb29sIFBWRGVjU2V0RW5oUmVmZXJlbmNlKFZpZGVvRGVjQ29udHJvbHMgKmRlY0N0cmwsIHVpbnQ4ICpyZWZZVVYsIHVpbnQzMiB0aW1lc3RhbXApCi17Ci0gICAgVmlkZW9EZWNEYXRhICp2aWRlbyA9IChWaWRlb0RlY0RhdGEgKikgZGVjQ3RybC0+dmlkZW9EZWNvZGVyRGF0YTsKLSAgICBWb3AgKnByZXZFbmhjVm9wID0gdmlkZW8tPnByZXZFbmhjVm9wOwotICAgIHVpbnQ4ICpkc3RQdHIsICpvcmdQdHIsICpkc3RQdHIyLCAqb3JnUHRyMjsKLSAgICBpbnQzMiBzaXplID0gKGludDMyKSB2aWRlby0+d2lkdGggKiB2aWRlby0+aGVpZ2h0OwotCi0gICAgaWYgKHZpZGVvLT5udW1iZXJPZkxheWVycyA8PSAxKQotICAgICAgICByZXR1cm4gUFZfRkFMU0U7Ci0KLQotICAgIC8qIHNldCBuZXcgcGFyYW1ldGVycyAqLwotICAgIHByZXZFbmhjVm9wLT50aW1lU3RhbXAgPSB0aW1lc3RhbXA7Ci0gICAgcHJldkVuaGNWb3AtPnByZWRpY3Rpb25UeXBlID0gSV9WT1A7Ci0KLSAgICBkc3RQdHIgPSBwcmV2RW5oY1ZvcC0+eUNoYW47Ci0gICAgb3JnUHRyID0gcmVmWVVWOwotICAgIG9zY2xfbWVtY3B5KGRzdFB0ciwgb3JnUHRyLCBzaXplKTsKLSAgICBkc3RQdHIgPSBwcmV2RW5oY1ZvcC0+dUNoYW47Ci0gICAgZHN0UHRyMiA9IHByZXZFbmhjVm9wLT52Q2hhbjsKLSAgICBvcmdQdHIgPSByZWZZVVYgKyBzaXplOwotICAgIG9yZ1B0cjIgPSBvcmdQdHIgKyAoc2l6ZSA+PiAyKTsKLSAgICBvc2NsX21lbWNweShkc3RQdHIsIG9yZ1B0ciwgKHNpemUgPj4gMikpOwotICAgIG9zY2xfbWVtY3B5KGRzdFB0cjIsIG9yZ1B0cjIsIChzaXplID4+IDIpKTsKLSAgICB2aWRlby0+Y29uY2VhbEZyYW1lID0gdmlkZW8tPnByZXZFbmhjVm9wLT55Q2hhbjsKLSAgICB2aWRlby0+dm9wX2NvZGluZ190eXBlID0gSV9WT1A7Ci0gICAgZGVjQ3RybC0+b3V0cHV0RnJhbWUgPSB2aWRlby0+cHJldkVuaGNWb3AtPnlDaGFuOwotCi0gICAgcmV0dXJuIFBWX1RSVUU7Ci19Ci0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkdldFZvbEluZm8oKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA4LzA2LzIwMDMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogR2V0IHRoZSB2b2wgaW5mbyhvbmx5IGJhc2UtbGF5ZXIpLiAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE5vdGUgICAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAwNi8yNC8yMDA0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotQm9vbCBQVkdldFZvbEluZm8oVmlkZW9EZWNDb250cm9scyAqZGVjQ3RybCwgVm9sSW5mbyAqcFZvbEluZm8pCi17Ci0gICAgVm9sICpjdXJyVm9sOwotCi0gICAgaWYgKHBWb2xJbmZvID09IE5VTEwgfHwgZGVjQ3RybCA9PSBOVUxMIHx8IGRlY0N0cmwtPnZpZGVvRGVjb2RlckRhdGEgPT0gTlVMTCB8fAotICAgICAgICAgICAgKChWaWRlb0RlY0RhdGEgKilkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhKS0+dm9sWzBdID09IE5VTEwpIHJldHVybiBQVl9GQUxTRTsKLQotICAgIGN1cnJWb2wgPSAoKFZpZGVvRGVjRGF0YSAqKShkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhKSktPnZvbFswXTsKLQotICAgIC8vIGdldCB0aGUgVk9MIGluZm8KLSAgICBwVm9sSW5mby0+c2hvcnRWaWRlb0hlYWRlciA9IChpbnQzMikoKFZpZGVvRGVjRGF0YSAqKShkZWNDdHJsLT52aWRlb0RlY29kZXJEYXRhKSktPnNob3J0VmlkZW9IZWFkZXI7Ci0gICAgcFZvbEluZm8tPmRhdGFQYXJ0aXRpb25pbmcgPSAoaW50MzIpY3VyclZvbC0+ZGF0YVBhcnRpdGlvbmluZzsKLSAgICBwVm9sSW5mby0+ZXJyb3JSZXNEaXNhYmxlICA9IChpbnQzMiljdXJyVm9sLT5lcnJvclJlc0Rpc2FibGU7Ci0gICAgcFZvbEluZm8tPnVzZVJldmVyc2VWTEMgICAgPSAoaW50MzIpY3VyclZvbC0+d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ICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogQ2FsY3VsYXRlIHRoZSBtaW5pbXVtIG51bWJlciBvZiBiaXRzIHJlcXVpcmVkIHRvICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgcmVwcmVzZW50IHguICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBOb3RlICAgICA6IFRoaXMgaXMgYW4gZXF1aXZhbGVudCBpbXBsZW1lbnRhdGlvbiBvZiAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgKGxvbmcpY2VpbChsb2coKGRvdWJsZSl4KS9sb2coMi4wKSkgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotaW50IENhbGNOdW1CaXRzKHVpbnQgeCkKLXsKLSAgICBpbnQgaSA9IDE7Ci0gICAgd2hpbGUgKHggPj49IDEpIGkrKzsKLSAgICByZXR1cm4gaTsKLX0KLQotCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRCZWdpbioqKioqKgotKgotKiAtLSBEZWNvZGVWb2xIZWFkZXIgLS0gRGVjb2RlIHRoZSBoZWFkZXIgb2YgYSBWT0wKLSoKLSogICAwNC8xMC8yMDAwIDogaW5pdGlhbCBtb2RpZmljYXRpb24gdG8gdGhlIG5ldyBQVi1EZWNvZGVyIExpYiBmb3JtYXQuCi0qICAgMTAvMTIvMjAwMSA6IHJlam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Amc3RhcnRDb2RlKTsKLQotICAgIGlmIChzdGFydENvZGUgPT0gVklTVUFMX09CSkVDVF9TRVFVRU5DRV9TVEFSVF9DT0RFKQotICAgIHsgICAvKiAgQml0c3RyZWFtIEV4aGNoYW5nZSBGaXggOS85OSAqLwotICAgICAgICAvKiBCaXRzdHJlYW0gRXhjaGFuZ2UgcmVxdWlyZXMgd2UgYWxsb3cgc3RhcnQgd2l0aCBWaWRlbyBPYmplY3QgU2VxdWVuY2UgKi8KLSAgICAgICAgLyogdmlzdWFsX29iamVjdF9zZXF1ZW5jZV9zdGFydF9jb2RlICAgICAgICAgICAgKi8KLSAgICAgICAgKHZvaWQpIEJpdHN0cmVhbVJlYWRCaXRzMzJIQyhzdHJlYW0pOwotICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgIDgpOyAvKiBwcm9maWxlICovCi0jaWZuZGVmIFBWX1RPTEVSQVRFX1ZPTF9FUlJPUlMKLSAgICAgICAgaWYgKGxheWVyKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qICAgICovCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qIHN1cHBvcnQgU1NQTDAtMiAgKi8KLSAgICAgICAgICAgIGlmICh0bXB2YXIgIT0gMHgxMCAmJiB0bXB2YXIgIT0gMHgxMSAmJiB0bXB2YXIgIT0gMHgxMiAmJgotICAgICAgICAgICAgICAgICAgICB0bXB2YXIgIT0gMHhBMSAmJiB0bXB2YXIgIT0gMHhBMiAgJiYgdG1wdmFyICE9IDB4QTMvKiBDb3JlIFNQQEwxLUwzICovKQotICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgLyogc3VwcG9ydCBTUEwwLTMgJiBTU1BMMC0yICAgKi8KLSAgICAgICAgICAgIGlmICh0bXB2YXIgIT0gMHgwMSAmJiB0bXB2YXIgIT0gMHgwMiAmJiB0bXB2YXIgIT0gMHgwMyAmJiB0bXB2YXIgIT0gMHgwOCAmJgotICAgICAgICAgICAgICAgICAgICAvKiBXaGlsZSBub3QgdGVjaG5pY2FsbHkgc3VwcG9ydGVkLCB0cnkgdG8gZGVjb2RlIFNQTDQmU1BMNSBmaWxlcyBhcyB3ZWxsLiAqLwotICAgICAgICAgICAgICAgICAgICAvKiBXZSdsbCBmYWlsIGxhdGVyIGlmIHRoZSBzaXplIGlzIHRvbyBsYXJnZS4gIFRoaXMgaXMgdG8gYWxsb3cgcGxheWJhY2sgb2YgKi8KLSAgICAgICAgICAgICAgICAgICAgLyogc29tZSA8PUNJRiBmaWxlcyBnZW5lcmF0ZWQgYnkgb3RoZXIgZW5jb2RlcnMuICovCi0gICAgICAgICAgICAgICAgICAgIHRtcHZhciAhPSAweDA0ICYmIHRtcHZhciAhPSAweDA1ICYmCi0gICAgICAgICAgICAgICAgICAgIHRtcHZhciAhPSAweDEwICYmIHRtcHZhciAhPSAweDExICYmIHRtcHZhciAhPSAweDEyICYmCi0gICAgICAgICAgICAgICAgICAgIHRtcHZhciAhPSAweDIxICYmIHRtcHZhciAhPSAweDIyICYmICAvKiBDb3JlIFByb2ZpbGUgTGV2ZWxzICovCi0gICAgICAgICAgICAgICAgICAgIHRtcHZhciAhPSAweEExICYmIHRtcHZhciAhPSAweEEyICYmIHRtcHZhciAhPSAweEEzICYmCi0gICAgICAgICAgICAgICAgICAgIHRtcHZhciAhPSAweEYwICYmIHRtcHZhciAhPSAweEYxICYmIC8qIEFkdmFuY2VkIFNpbXBsZSBQcm9maWxlIExldmVscyovCi0gICAgICAgICAgICAgICAgICAgIHRtcHZhciAhPSAweEYyICYmIHRtcHZhciAhPSAweEYzICYmCi0gICAgICAgICAgICAgICAgICAgIHRtcHZhciAhPSAweEY0ICYmIHRtcHZhciAhPSAweEY1KQotICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOwotICAgICAgICB9Ci0jZWxzZQotICAgICAgICBwcm9maWxlID0gdG1wdmFyOwotI2VuZGlmCi0KLSAgICAgICAgLy8gc2F2ZSB0aGUgcHJvZmlsZSBhbmQgbGV2ZWwgZm9yIHRoZSBxdWVyeQotICAgICAgICBjdXJyVm9sLT5wcm9maWxlX2xldmVsX2lkID0gKHVpbnQpdG1wdmFyOyAvLyAgNi8xMC8wNAotCi0KLQotICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1TaG93Qml0czMySEMoc3RyZWFtLCAmdG1wdmFyKTsKLSAgICAgICAgaWYgKHRtcHZhciA9PSBVU0VSX0RBVEFfU1RBUlRfQ09ERSkKLSAgICAgICAgewotICAgICAgICAgICAgLyogU29tZXRoaW5nIGhhcyB0byBiZSBkb25lIHdpdGggdXNlciBkYXRhICAxMS8xMS85OSAqLwotICAgICAgICAgICAgc3RhdHVzID0gRGVjb2RlVXNlckRhdGEoc3RyZWFtKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgIH0KLSAgICAgICAgLyogdmlzdWFsX29iamVjdF9zdGFydF9jb2RlICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgQml0c3RyZWFtU2hvd0JpdHMzMkhDKHN0cmVhbSwgJnRtcHZhcik7Ci0gICAgICAgIGlmICh0bXB2YXIgIT0gVklTVUFMX09CSkVDVF9TVEFSVF9DT0RFKQotICAgICAgICB7Ci0gICAgICAgICAgICBkbwotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8qIFNlYXJjaCBmb3IgVk9MX0hFQURFUiAqLwotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWU2VhcmNoTmV4dE00VkZyYW1lKHN0cmVhbSk7IC8qIHNlYXJjaCAweDAwIDB4MDAgMHgwMSAqLwotICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIFBWX0ZBSUw7IC8qIGJyZWFrcyB0aGUgbG9vcCAqLwotICAgICAgICAgICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMzIoc3RyZWFtLCBWT0xfU1RBUlRfQ09ERV9MRU5HVEgsICZ0bXB2YXIpOwotICAgICAgICAgICAgICAgIFBWX0JpdHN0cmVhbUZsdXNoQml0cyhzdHJlYW0sIDgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgd2hpbGUgKHRtcHZhciAhPSBWT0xfU1RBUlRfQ09ERSk7Ci0gICAgICAgICAgICBnb3RvIGRlY29kZV92b2w7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICBCaXRzdHJlYW1SZWFkQml0czMySEMoc3RyZWFtKTsKLSAgICAgICAgfQotCi0gICAgICAgIC8qICBpc192aXN1YWxfb2JqZWN0X2lkZW50aWZpZXIgICAgICAgICAgICAqLwotICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLSAgICAgICAgaWYgKHRtcHZhcikKLSAgICAgICAgewotICAgICAgICAgICAgLyogdmlzdWFsX29iamVjdF92ZXJpZCAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDQpOwotICAgICAgICAgICAgLyogdmlzdWFsX29iamVjdF9wcmlvcml0eSAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpOwotICAgICAgICB9Ci0gICAgICAgIC8qIHZpc3VhbF9vYmplY3RfdHlwZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMzIoc3RyZWFtLCA0LCAmdG1wdmFyKTsKLSAgICAgICAgaWYgKHRtcHZhciA9PSAxKQotICAgICAgICB7IC8qIHZpZGVvX3NpZ25hbF90eXBlICovCi0gICAgICAgICAgICBQVl9CaXRzdHJlYW1GbHVzaEJpdHMoc3RyZWFtLCA0KTsKLSAgICAgICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAxKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8qIHZpZGVvX2Zvcm1hdCAqLwotICAgICAgICAgICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAzKTsKLSAgICAgICAgICAgICAgICAvKiB2aWRlb19yYW5nZSAgKi8KLSAgICAgICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLSAgICAgICAgICAgICAgICAvKiBjb2xvcl9kZXNjcmlwdGlvbiAqLwotICAgICAgICAgICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotICAgICAgICAgICAgICAgIGlmICh0bXB2YXIgPT0gMSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIC8qIGNvbG9yX3ByaW1hcmllcyAqLwotICAgICAgICAgICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOCk7Ci0gICAgICAgICAgICAgICAgICAgIC8qIHRyYW5zZmVyX2NoYXJhY3RlcmlzdGljcyAqLwotICAgICAgICAgICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOCk7Ci0gICAgICAgICAgICAgICAgICAgIC8qIG1hdHJpeF9jb2VmZmljaWVudHMgKi8KLSAgICAgICAgICAgICAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIGRvCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLyogU2VhcmNoIGZvciBWT0xfSEVBREVSICovCi0gICAgICAgICAgICAgICAgc3RhdHVzID0gUFZTZWFyY2hOZXh0TTRWRnJhbWUoc3RyZWFtKTsgLyogc2VhcmNoIDB4MDAgMHgwMCAweDAxICovCi0gICAgICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBQVl9TVUNDRVNTKSByZXR1cm4gUFZfRkFJTDsgLyogYnJlYWtzIHRoZSBsb29wICovCi0gICAgICAgICAgICAgICAgQml0c3RyZWFtU2hvd0JpdHMzMihzdHJlYW0sIFZPTF9TVEFSVF9DT0RFX0xFTkdUSCwgJnRtcHZhcik7Ci0gICAgICAgICAgICAgICAgUFZfQml0c3RyZWFtRmx1c2hCaXRzKHN0cmVhbSwgOCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB3aGlsZSAodG1wdmFyICE9IFZPTF9TVEFSVF9DT0RFKTsKLSAgICAgICAgICAgIGdvdG8gZGVjb2RlX3ZvbDsKLSAgICAgICAgfQotCi0gICAgICAgIC8qIG5leHRfc3RhcnRfY29kZSgpICovCi0gICAgICAgIHN0YXR1cyA9IFBWX0JpdHN0cmVhbUJ5dGVBbGlnbihzdHJlYW0pOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAgMTAvMTIvMDEgKi8KLSAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtU2hvd0JpdHMzMkhDKHN0cmVhbSwgJnRtcHZhcik7Ci0KLSAgICAgICAgaWYgKHRtcHZhciA9PSBVU0VSX0RBVEFfU1RBUlRfQ09ERSkKLSAgICAgICAgewotICAgICAgICAgICAgLyogU29tZXRoaW5nIGhhcyB0byBiZSBkb25lIHRvIGRlYWwgd2l0aCB1c2VyIGRhdGEgKHBhcnNlIGl0KSAgMTEvMTEvOTkgKi8KLSAgICAgICAgICAgIHN0YXR1cyA9IERlY29kZVVzZXJEYXRhKHN0cmVhbSk7Ci0gICAgICAgICAgICBpZiAoc3RhdHVzICE9IFBWX1NVQ0NFU1MpIHJldHVybiBQVl9GQUlMOwotICAgICAgICB9Ci0gICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVNob3dCaXRzMzIoc3RyZWFtLCAyNywgJnRtcHZhcik7ICAgLyogIDEwLzEyLzAxICovCi0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIC8qICAgICAgdG1wdmFyID0gMDsgICAqLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qICAxMC8xMi8wMSAqLwotICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1TaG93Qml0czMyKHN0cmVhbSwgMjcsICZ0bXB2YXIpOyAgICAgLyogdW5jb21tZW50IHRoaXMgbGluZSBpZiB5b3Ugd2FudAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG8gc3RhcnQgZGVjb2Rpbmcgd2l0aCBhCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlb19vYmplY3Rfc3RhcnRfY29kZSAqLwotICAgIH0KLQotICAgIGlmICh0bXB2YXIgPT0gVk9fU1RBUlRfQ09ERSkKLSAgICB7Ci0gICAgICAgIC8qKioqKgotICAgICAgICAqCi0gICAgICAgICogICBSZWFkIHRoZSBWT0wgaGVhZGVyIGVudHJpZXMgZnJvbSB0aGUgYml0c3RyZWFtCi0gICAgICAgICoKLSAgICAgICAgKioqKiovCi0gICAgICAgIC8qIHZpZGVvX29iamVjdF9zdGFydF9jb2RlICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgIHRtcHZhciA9IEJpdHN0cmVhbVJlYWRCaXRzMzIoc3RyZWFtLCAyNyk7Ci0gICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA1KTsKLQotCi0gICAgICAgIC8qIHZpZGVvX29iamVjdF9sYXllcl9zdGFydF9jb2RlICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMzIoc3RyZWFtLCBWT0xfU1RBUlRfQ09ERV9MRU5HVEgsICZ0bXB2YXIpOwotICAgICAgICBpZiAodG1wdmFyICE9IFZPTF9TVEFSVF9DT0RFKQotICAgICAgICB7Ci0gICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1DaGVja0VuZEJ1ZmZlcihzdHJlYW0pOwotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBQVl9FTkRfT0ZfVk9QKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHZpZGVvLT5zaG9ydFZpZGVvSGVhZGVyID0gVFJVRTsKLSAgICAgICAgICAgICAgICByZXR1cm4gUFZfU1VDQ0VTUzsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBkbwotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgLyogU2VhcmNoIGZvciBWT0xfSEVBREVSICovCi0gICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWU2VhcmNoTmV4dE00VkZyYW1lKHN0cmVhbSk7Lyogc2VhcmNoIDB4MDAgMHgwMCAweDAxICovCi0gICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIFBWX0ZBSUw7IC8qIGJyZWFrcyB0aGUgbG9vcCAqLwotICAgICAgICAgICAgICAgICAgICBCaXRzdHJlYW1TaG93Qml0czMyKHN0cmVhbSwgVk9MX1NUQVJUX0NPREVfTEVOR1RILCAmdG1wdmFyKTsKLSAgICAgICAgICAgICAgICAgICAgUFZfQml0c3RyZWFtRmx1c2hCaXRzKHN0cmVhbSwgOCk7IC8qIGFkdmFuY2UgdGhlIGJ5dGUgcHRyICovCi0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHdoaWxlICh0bXB2YXIgIT0gVk9MX1NUQVJUX0NPREUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgUFZfQml0c3RyZWFtRmx1c2hCaXRzKHN0cmVhbSwgOCk7Ci0gICAgICAgIH0KLQotZGVjb2RlX3ZvbDoKLSAgICAgICAgUFZfQml0c3RyZWFtRmx1c2hCaXRzKHN0cmVhbSwgVk9MX1NUQVJUX0NPREVfTEVOR1RIIC0gOCk7Ci0gICAgICAgIHZpZGVvLT5zaG9ydFZpZGVvSGVhZGVyID0gMDsKLQotICAgICAgICAvKiB2b2xfaWQgKDQgYml0cykgKi8KLSAgICAgICAgY3VyclZvbC0+dm9sSUQgPSAoaW50KSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNCk7Ci0KLSAgICAgICAgLyogUmFuZG9tQWNjZXNzaWJsZSBmbGFnICovCi0gICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotCi0gICAgICAgIC8qIG9iamVjdCB0eXBlICovCi0gICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsgICAgICAgICAgICAgICAgLyogICovCi0KLSNpZmRlZiBQVl9UT0xFUkFURV9WT0xfRVJST1JTCi0gICAgICAgIGlmICh0bXB2YXIgPT0gMCkKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKGxheWVyKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qICAgICovCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLyogc3VwcG9ydCBTU1BMMC0yICAqLwotICAgICAgICAgICAgICAgIGlmIChwcm9maWxlICE9IDB4MTAgJiYgcHJvZmlsZSAhPSAweDExICYmIHByb2ZpbGUgIT0gMHgxMikKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgdG1wdmFyID0gMHgwMjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAvKiBzdXBwb3J0IFNQTDAtMyAmIFNTUEwwLTIgICAqLwotICAgICAgICAgICAgICAgIGlmIChwcm9maWxlICE9IDB4MDEgJiYgcHJvZmlsZSAhPSAweDAyICYmIHByb2ZpbGUgIT0gMHgwMyAmJiBwcm9maWxlICE9IDB4MDggJiYKLSAgICAgICAgICAgICAgICAgICAgICAgIHByb2ZpbGUgIT0gMHgxMCAmJiBwcm9maWxlICE9IDB4MTEgJiYgcHJvZmlsZSAhPSAweDEyKQotICAgICAgICAgICAgICAgICAgICByZXR1cm4gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICB0bXB2YXIgPSAweDAxOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcHJvZmlsZSB8PSAweDAxMDA7Ci0gICAgICAgIH0KLSNlbmRpZgotCi0gICAgICAgIGlmIChsYXllcikKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKHRtcHZhciAhPSAweDAyKSByZXR1cm4gUFZfRkFJTDsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmICh0bXB2YXIgIT0gMHgwMSkgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgIH0KLQotICAgICAgICAvKiB2ZXJzaW9uIGlkIHNwZWNpZmllZD8gKi8KLSAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0gICAgICAgIGlmICh0bXB2YXIgPT0gMSkKLSAgICAgICAgewotICAgICAgICAgICAgLyogdmVyc2lvbiBJRCAqLwotICAgICAgICAgICAgdmVyc2lvbl9pZCA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA0KTsKLSAgICAgICAgICAgIC8qIHByaW9yaXR5ICovCi0gICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMyk7Ci0KLSAgICAgICAgfQotCi0gICAgICAgIC8qIGFzcGVjdCByYXRpbyBpbmZvICovCi0gICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA0KTsKLSAgICAgICAgaWYgKHRtcHZhciA9PSAwKSByZXR1cm4gUFZfRkFJTDsKLSAgICAgICAgaWYgKHRtcHZhciA9PSAweGYgLyogZXh0ZW5kZWRfcGFyICovKQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiB3aWR0aCAqLwotICAgICAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgLyogaGVpZ2h0ICovCi0gICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOCk7Ci0gICAgICAgIH0KLQotCi0gICAgICAgIC8qIGNvbnRyb2wgcGFyYW1ldGVycyBwcmVzZW50PyAqLwotICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLQotICAgICAgICAvKiAgR2V0IHRoZSBwYXJhbWV0ZXJzIChza2lwcGVkKSAqLwotICAgICAgICAvKiAgMDMvMTAvOTkgKi8KLSAgICAgICAgaWYgKHRtcHZhcikKLSAgICAgICAgewotICAgICAgICAgICAgLyogY2hyb21hX2Zvcm1hdCAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIHRtcHZhciA9IEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAyKTsKLSAgICAgICAgICAgIGlmICh0bXB2YXIgIT0gMSkgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgICAgICAvKiBsb3dfZGVsYXkgICovCi0gICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLQotICAgICAgICAgICAgLyogdmJ2X3BhcmFtZXRlcnMgcHJlc2VudD8gKi8KLSAgICAgICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotICAgICAgICAgICAgaWYgKHRtcHZhcikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAvKiBmaXJzdF9oYWxmX2JpdF9yYXRlICAgICovCi0gICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDE1KTsKLSAgICAgICAgICAgICAgICBpZiAoIUJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pKSByZXR1cm4gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICAvKiBsYXR0ZXJfaGFsZl9iaXRfcmF0ZSAgICovCi0gICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDE1KTsKLSAgICAgICAgICAgICAgICBpZiAoIUJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pKSByZXR1cm4gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICAvKiBmaXJzdF9oYWxmX3Zidl9idWZmZXJfc2l6ZSAgICovCi0gICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDE1KTsKLSAgICAgICAgICAgICAgICBpZiAoIUJpdHN0cmVhbVJlYWQx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UhlaWdodCAmIDB4MSk7IC8qIGRpc3BsYXllZCBpbWFnZSBzaG91bGQgYmUgZXZlbiBzaXplICovCi0gICAgICAgIGlmICghQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpIHJldHVybiBQVl9GQUlMOwotCi0gICAgICAgIC8qICAwMy8xMC85OSAqLwotICAgICAgICAvKiBpbnRlcmxhY2VkICovCi0gICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotICAgICAgICBpZiAodG1wdmFyICE9IDApCi0gICAgICAgIHsKLSAgICAgICAgICAgIG1wNGRlY19sb2coIkRlY29kZVZPTEhlYWRlcigpOiBJbnRlcmxhY2VkIHZpZGVvIGlzIG5vdCBzdXBwb3J0ZWQuXG4iKTsKLSAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOwotICAgICAgICB9Ci0KLSAgICAgICAgLyogb2JtY19kaXNhYmxlICovCi0gICAgICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotICAgICAgICBpZiAodG1wdmFyID09IDApIHJldHVybiBQVl9GQUlMOwotCi0gICAgICAgIGlmICh2ZXJzaW9uX2lkID09IDEpCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qICBzcHJpdGVfZW5hYmxlICgxIGJpdHMpICovCi0gICAgICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLSAgICAgICAgICAgIGlmICh0bXB2YXIpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgbXA0ZGVjX2xvZygiRGVjb2RlVk9MSGVhZGVyKCk6IFNwcml0ZSBpcyBub3Qgc3VwcG9ydGVkLlxuIik7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7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bnRQcmVjaXNpb24gPSA1OwotICAgICAgICAgICAgY3VyclZvbC0+Yml0c1BlclBpeGVsID0gODsKLSAgICAgICAgfQotCi0gICAgICAgIC8qIHF1YW50X3R5cGUgKDEgYml0KSAqLwotICAgICAgICBjdXJyVm9sLT5xdWFudFR5cGUgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLSAgICAgICAgaWYgKGN1cnJWb2wtPnF1YW50VHlwZSkKLSAgICAgICAgewotI2lmZGVmIFBWX1NVUFBPUlRfTUFJTl9QUk9GSUxFCi0gICAgICAgICAgICAvKiBsb2FkIHF1YW50aXphdGlvbiBtYXRyaWNlcy4gICA1LzIyLzIwMDAgKi8KLSAgICAgICAgICAgIC8qIGxvYWRfaW50cmFfcXVhbnRfbWF0ICgxIGJpdCkgKi8KLSAgICAgICAgICAgIHFtYXQgPSBjdXJyVm9sLT5pcW1hdDsKLSAgICAgICAgICAgIGN1cnJWb2wtPmxvYWRJbnRyYVF1YW50TWF0ID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0gICAgICAgICAgICBpZiAoY3VyclZvbC0+bG9hZEludHJhUXVhbnRNYXQpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLyogaW50cmFfcXVhbnRfbWF0ICg4KjY0IGJpdHMpICovCi0gICAgICAgICAgICAgICAgaSA9IDA7Ci0gICAgICAgICAgICAgICAgZG8KLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHFtYXRbKih6aWd6YWdfaW52K2kpXSA9IChpbnQpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgd2hpbGUgKChxbWF0WyooemlnemFnX2luditpKV0gIT0gMCkgJiYgKCsraSA8IDY0KSk7Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGogPSBpOyBqIDwgNjQ7IGorKykKLSAgICAgICAgICAgICAgICAgICAgcW1hdFsqKHppZ3phZ19pbnYraildID0gcW1hdFsqKHppZ3phZ19pbnYraS0xKV07Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgb3NjbF9tZW1jcHkocW1hdCwgbXBlZ19pcW1hdF9kZWYsIDY0KnNpemVvZihpbnQpKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgcW1hdFswXSA9IDA7ICAgICAgICAgICAgIC8qIG5lY2Vzc2FyeSBmb3Igc3dpdGNoZWQgJiYgTVBFRyBxdWFudCAgMDcvMDkvMDEgKi8KLQotICAgICAgICAgICAgLyogbG9hZF9ub25pbnRyYV9xdWFudF9tYXQgKDEgYml0KSAqLwotICAgICAgICAgICAgcW1hdCA9IGN1cnJWb2wtPm5pcW1hdDsKLSAgICAgICAgICAgIGN1cnJWb2wtPmxvYWROb25JbnRyYVF1YW50TWF0ID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0gICAgICAgICAgICBpZiAoY3VyclZvbC0+bG9hZE5vbkludHJhUXVhbnRNYXQpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLyogbm9uaW50cmFfcXVhbnRfbWF0ICg4KjY0IGJpdHMpICovCi0gICAgICAgICAgICAgICAgaSA9IDA7Ci0gICAgICAgICAgICAgICAgZG8KLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHFtYXRbKih6aWd6YWdfaW52K2kpXSA9IChpbnQpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgd2hpbGUgKChxbWF0WyooemlnemFnX2luditpKV0gIT0gMCkgJiYgKCsraSA8IDY0KSk7Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGogPSBpOyBqIDwgNjQ7IGorKykKLSAgICAgICAgICAgICAgICAgICAgcW1hdFsqKHppZ3phZ19pbnYraildID0gcW1hdFsqKHppZ3phZ19pbnYraS0xKV07Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgb3NjbF9tZW1jcHkocW1hdCwgbXBlZ19ucW1hdF9kZWYsIDY0KnNpemVvZihpbnQpKTsKLSAgICAgICAgICAgIH0KLSNlbHNlCi0gICAgICAgICAgICByZXR1cm4gUFZfRkFJTDsKLSNlbmRpZgotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHZlcnNpb25faWQgIT0gMSkKLSAgICAgICAgewotICAgICAgICAgICAgLyogcXVhcnRlcl9zYW1wbGUgZW5hYmxlZCAqLwotICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0gICAgICAgICAgICBpZiAodG1wdmFyKSByZXR1cm4gUFZfRkFJTDsKLSAgICAgICAgfQotCi0gICAgICAgIC8qIGNvbXBsZXhpdHlfZXN0aW1hdGlvbl9kaXNhYmxlICovCi0gICAgICAgIGN1cnJWb2wtPmNvbXBsZXhpdHlfZXN0RGlzYWJsZSA9IEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotICAgICAgICBpZiAoY3VyclZvbC0+Y29tcGxleGl0eV9lc3REaXNhYmxlID09IDApCi0gICAgICAgIHsKLSAgICAgICAgICAgIGN1cnJWb2wtPmNvbXBsZXhpdHlfZXN0TWV0aG9kID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDIpOwotCi0gICAgICAgICAgICBpZiAoY3VyclZvbC0+Y29tcGxleGl0eV9lc3RNZXRob2QgPCAyKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8qIHNoYXBlX2NvbXBsZXhpdHlfZXN0aW1hdGlvbl9kaXNhYmxlICovCi0gICAgICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0gICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAwKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgbXA0ZGVjX2xvZygiRGVjb2RlVk9MSGVhZGVyKCk6IFNoYXBlIENvbXBsZXhpdHkgZXN0aW1hdGlvbiBpcyBub3Qgc3VwcG9ydGVkLlxuIik7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBQVl9GQUlMOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAvKiB0ZXh0dXJlX2NvbXBsZXhpdHlfZXN0aW1hdGlvbl9zZXRfMV9kaXNhYmxlICovCi0gICAgICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0gICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAwKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgY3VyclZvbC0+Y29tcGxleGl0eS50ZXh0XzEgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8qIG1hcmtlciBiaXQgKi8KLSAgICAgICAgICAgICAgICBpZiAoIUJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pKSByZXR1cm4gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICAvKiB0ZXh0dXJlX2NvbXBsZXhpdHlfZXN0aW1hdGlvbl9zZXRfMl9kaXNhYmxlICovCi0gICAgICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0gICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAwKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgY3VyclZvbC0+Y29tcGxleGl0eS50ZXh0XzIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8qIG1vdGlvbl9jb21wZW5zYXRpb25fY29tcGxleGl0eV9kaXNhYmxlICovCi0gICAgICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0gICAgICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAwKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgY3VyclZvbC0+Y29tcGxleGl0eS5tYyA9IEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA2KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgLyogbWFya2VyIGJpdCAqLwotICAgICAgICAgICAgICAgIGlmICghQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpIHJldHVybiBQVl9GQUlMOwotCi0gICAgICAgICAgICAgICAgaWYgKGN1cnJWb2wtPmNvbXBsZXhpdHlfZXN0TWV0aG9kID09IDEpCi0gICAgICAgICAgICAgICAgeyAgIC8qIHZlcnNpb24yX2NvbXBsZXhpdHlfZXN0aW1hdGlvbl9kaXNhYmxlICovCi0gICAgICAgICAgICAgICAgICAgIHRtcHZhciA9IEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotICAgICAgICAgICAgICAgICAgICBpZiAodG1wdmFyID09IDApCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1wNGRlY19sb2coIkRlY29kZVZPTEhlYWRlcigpOiBzYWRjdCwgcXVhcnRlciBwZWwgbm90IHN1cHBvcnRlZC5cbiIpOwotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICAvKiAgMDMvMTAvOTkgKi8KLSAgICAgICAgLyogcmVzeW5jX21hcmtlcl9kaXNhYmxlICovCi0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ICAgfQotCi0gICAgICAgIGlmICh2ZXJzaW9uX2lkICE9IDEpCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qIG5ld3ByZWRfZW5hYmxlICovCi0gICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLSAgICAgICAgICAgIGlmICh0bXB2YXIpIHJldHVybiBQVl9GQUlMOwotCi0gICAgICAgICAgICAvKiByZWR1Y2VkX3Jlc29sdXRpb25fdm9wICovCi0gICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLSAgICAgICAgICAgIGlmICh0bXB2YXIpIHJldHVybiBQVl9GQUlMOwotCi0gICAgICAgIH0KLQotICAgICAgICAvKiBJbnRyYSBBQy9EQyBwcmVkaWN0aW9uIGlzIGFsd2F5cyB0cnVlICovCi0gICAgICAgIHZpZGVvLT5pbnRyYV9hY2RjUHJlZERpc2FibGUgPSAwOwotICAgICAgICAvKiBzY2FsYWJpbGl0eSAqLwotICAgICAgICBjdXJyVm9sLT5zY2FsYWJpbGl0eSA9IChpbnQpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotCi0gICAgICAgIGlmIChjdXJyVm9sLT5zY2FsYWJpbGl0eSkKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKGxheWVyID09IDApICByZXR1cm4gUFZfRkFJTDsgICAgICAgICAgICAgICAgICAgICAvKiAgKi8KLSAgICAgICAgICAgIC8qIGhpZXJhcmNoeV90eXBlOiAxIDogdGVtcG9yYWwsIDAgOiBzcGF0aWFsICovCi0gICAgICAgICAgICAvKiAgMDMvMTAvOTkgKi8KLSAgICAgICAgICAgIGN1cnJWb2wtPnNjYWxUeXBlID0gKGludCkgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7ICAgICAgICAgICAgICAvKiAgKi8KLSAgICAgICAgICAgIGlmICghY3VyclZvbC0+c2NhbFR5cGUpIHJldHVybiBQVl9GQUlMOwotCi0gICAgICAgICAgICAvKiByZWZfbGF5ZXJfaWQgKDQgYml0cykgKi8KLSAgICAgICAgICAgIGN1cnJWb2wtPnJlZlZvbElEID0gKGludCkgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDQpOwotICAgICAgICAgICAgaWYgKGxheWVyKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qICAqLwotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmIChjdXJyVm9sLT5yZWZWb2xJRCAhPSB2aWRlby0+dm9sWzBdLT52b2xJRCkgcmV0dXJuIFBWX0ZBSUw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICAvKiByZWZfbGF5ZXJfc2FtcGxpbmdfZGlyZWMgKDEgYml0cykgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAvKiAgIDEgOiByZWYuIGxheWVyIGhhcyBoaWdoZXIgcmVzb2x1dGlvbiAgICAgICAgICovCi0gICAgICAgICAgICAvKiAgIDAgOiByZWYuIGxheWVyIGhhcyBlcXVhbCBvciBsb3dlciByZXNvbHV0aW9uICovCi0gICAgICAgICAgICBjdXJyVm9sLT5yZWZTYW1wRGlyID0gKGludCkgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0gICAgICAgICAgICBpZiAoY3VyclZvbC0+cmVmU2FtcERpcikgcmV0dXJuIFBWX0ZBSUw7Ci0KLSAgICAgICAgICAgIC8qIGhvcl9zYW1wbGluZ19mYWN0b3JfbiAoNSBiaXRzKSAqLwotICAgICAgICAgICAgY3VyclZvbC0+aG9yU2FtcF9uID0gKGludCkgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDUpOwotCi0gICAgICAgICAgICAvKiBob3Jfc2FtcGxpbmdfZmFjdG9yX20gKDUgYml0cykgKi8KLSAgICAgICAgICAgIGN1cnJWb2wtPmhvclNhbXBfbSA9IChpbnQpIEJpdHN0cmVhbVJlYWR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lCi0gICAgewotICAgICAgICAvKiBTSE9SVF9IRUFERVIgKi8KLSAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtU2hvd0JpdHMzMihzdHJlYW0sIFNIT1JUX1ZJREVPX1NUQVJUX01BUktFUl9MRU5HVEgsICZ0bXB2YXIpOwotCi0gICAgICAgIGlmICh0bXB2YXIgPT0gU0hPUlRfVklERU9fU1RBUlRfTUFSS0VSKQotICAgICAgICB7Ci0gICAgICAgICAgICB2aWRlby0+c2hvcnRWaWRlb0hlYWRlciA9IFRSVUU7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICBkbwotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8qIFNlYXJjaCBmb3IgVk9MX0hFQURFUiAqLwotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWU2VhcmNoTmV4dE00VkZyYW1lKHN0cmVhbSk7IC8qIHNlYXJjaCAweDAwIDB4MDAgMHgwMSAqLwotICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gUFZfU1VDQ0VTUykgcmV0dXJuIFBWX0ZBSUw7IC8qIGJyZWFrcyB0aGUgbG9vcCAqLwotICAgICAgICAgICAgICAgIEJpdHN0cmVhbVNob3dCaXRzMzIoc3RyZWFtLCBWT0xfU1RBUlRfQ09ERV9MRU5HVEgsICZ0bXB2YXIpOwotICAgICAgICAgICAgICAgIFBWX0JpdHN0cmVhbUZsdXNoQml0cyhzdHJlYW0sIDgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgd2hpbGUgKHRtcHZhciAhPSBWT0xfU1RBUlRfQ09ERSk7Ci0gICAgICAgICAgICBnb3RvIGRlY29kZV92b2w7Ci0gICAgICAgIH0KLSAgICB9Ci0jaWZkZWYgUFZfVE9MRVJBVEVfVk9MX0VSUk9SUwotICAgIGlmIChwcm9maWxlID4gMHhGRiB8fCBwcm9maWxlID09IDApCi0gICAgewotICAgICAgICByZXR1cm4gUFZfQkFEX1ZPTEhFQURFUjsKLSAgICB9Ci0jZW5kaWYKLQotICAgIHJldHVybiBzdGF0dXM7Ci19Ci0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEJlZ2luKioqKioqCi0qCi0qIC0tIERlY29kZUdPViAtLSBEZWNvZGVzIHRoZSBHcm91cCBvZiBWT1BzIGZyb20gYml0c3RyZWFtCi0qCi0qICAgMDQvMjAvMjAwMCAgaW5pdGlhbCBtb2RpZmljYXRpb24gdG8gdGhlIG5ldyBQVi1EZWNvZGVyIExpYiBmb3JtYXQuCi0qCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRFbmQqKioqKioqKi8KLVBWX1NUQVRVUyBEZWNvZGVHT1ZIZWFkZXIoQml0c3RyZWFtRGVjVmlkZW8gKnN0cmVhbSwgdWludDMyICp0aW1lX2Jhc2UpCi17Ci0gICAgdWludDMyIHRtcHZhciwgdGltZV9zOwotICAgIGludCBjbG9zZWRfZ292LCBicm9rZW5fbGluazsKLQotICAgIC8qIGdyb3VwX3N0YXJ0X2NvZGUgKDMyIGJpdHMpICovCi0vLyAgIHRtcHZhciA9IEJpdHN0cmVhbVJlYWRCaXRzMzIoc3RyZWFtLCAzMik7Ci0KLSAgICAvKiBob3VycyAqLwotICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA1KTsKLSAgICB0aW1lX3MgPSB0bXB2YXIgKiAzNjAwOwotCi0gICAgLyogbWludXRlcyAqLwotICAgIHRtcHZhciA9ICh1aW50MzIpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA2KTsKLSAgICB0aW1lX3MgKz0gdG1wdmFyICogNjA7Ci0KLSAgICAvKiBtYXJrZXIgYml0ICovCi0gICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUm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LSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgY3VyclZvcC0+cm91bmRpbmdUeXBlID0gMDsKLSAgICB9Ci0KLSAgICBpZiAoY3VyclZvbC0+Y29tcGxleGl0eV9lc3REaXNhYmxlID09IDApCi0gICAgewotICAgICAgICBpZiAoY3VyclZvbC0+Y29tcGxleGl0eV9lc3RNZXRob2QgPCAyKSAgIC8qICAgT0NUIDIwMDIgKi8KLSAgICAgICAgewotICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5LnRleHRfMSA+PiAzKSAmIDB4MSkgICAgLyogaW50cmEgICAgICAgICovCi0gICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgaWYgKGN1cnJWb2wtPmNvbXBsZXhpdHkudGV4dF8xICYgMHgxKSAgICAgICAgICAgLyogbm90X2NvZGVkICAgICovCi0gICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5LnRleHRfMiA+PiAzKSAmIDB4MSkgICAgLyogZGN0X2NvZWZzICAgICovCi0gICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5LnRleHRfMiA+PiAyKSAmIDB4MSkgICAgLyogZGN0X2xpbmVzICAgICovCi0gICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5LnRleHRfMiA+PiAxKSAmIDB4MSkgICAgLyogdmxjX3N5bWJvbHMgICovCi0gICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgaWYgKGN1cnJWb2wtPmNvbXBsZXhpdHkudGV4dF8yICYgMHgxKSAgICAgICAgICAgLyogdmxjX2JpdHMgICAgICovCi0gICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDQpOwotCi0gICAgICAgICAgICBpZiAoY3VyclZvcC0+cHJlZGljdGlvblR5cGUgIT0gSV9WT1ApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5LnRleHRfMSA+PiAyKSAmIDB4MSkgICAgLyogaW50ZXIgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgICAgIGlmICgoY3VyclZvbC0+Y29tcGxleGl0eS50ZXh0XzEgPj4gMSkgJiAweDEpICAgIC8qIGludGVyXzR2ICovCi0gICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKLSAgICAgICAgICAgICAgICBpZiAoKGN1cnJWb2wtPmNvbXBsZXhpdHkubWMgPj4gNSkgJiAweDEpICAgICAgICAvKiBhcG0gICAgICAqLwotICAgICAgICAgICAgICAgICAgICBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOCk7Ci0gICAgICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5Lm1jID4+IDQpICYgMHgxKSAgICAgICAgLyogbnBtICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgICAgIC8qIGludGVycG9sYXRlX21jX3EgKi8KLSAgICAgICAgICAgICAgICBpZiAoKGN1cnJWb2wtPmNvbXBsZXhpdHkubWMgPj4gMikgJiAweDEpICAgICAgICAvKiBmb3J3X2JhY2tfbWNfcSAqLwotICAgICAgICAgICAgICAgICAgICBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOCk7Ci0gICAgICAgICAgICAgICAgaWYgKChjdXJyVm9sLT5jb21wbGV4aXR5Lm1jID4+IDEpICYgMHgxKSAgICAgICAgLyogaGFsZnBlbDIgKi8KLSAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgICAgIGlmIChjdXJyVm9sLT5jb21wbGV4aXR5Lm1jICYgMHgxKSAgICAgICAgICAgICAgIC8qIGhhbGZwZWw0ICovCi0gICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChjdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9PSBCX1ZPUCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZiAoKGN1cnJWb2wtPmNvbXBsZXhpdHkubWMgPj4gMykgJiAweDEpICAgICAgICAvKiBpbnRlcnBvbGF0ZV9tY19xICovCi0gICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA4KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qIHJlYWQgaW50cmFfZGNfdmxjX3RociAqLwotICAgIGN1cnJWb3AtPmludHJhRENWbGNUaHIgPSAoaW50KSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMyk7Ci0KLSAgICAvKiByZWFkIHZvcF9xdWFudCAoY3VyclZvbC0+cXVhbnRQcmVjaXNpb24gYml0cykgKi8KLSAgICBjdXJyVm9wLT5xdWFudGl6ZXIgPSAoaW50MTYpIEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCBjdXJyVm9sLT5xdWFudFByZWNpc2lvbik7Ci0gICAgaWYgKGN1cnJWb3AtPnF1YW50aXplciA9PSAwKQotICAgIHsKLSAgICAgICAgY3VyclZvcC0+cXVhbnRpemVyID0gdmlkZW8tPnByZXZWb3AtPnF1YW50aXplcjsKLSAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgfQotCi0KLSAgICAvKiByZWFkIHZvcF9mY29kZV9mb3J3YXJkICovCi0gICAgaWYgKGN1cnJWb3AtPnByZWRpY3Rpb25UeXBlICE9IElfVk9QKQotICAgIHsKLSAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpOwotICAgICAgICBpZiAodG1wdmFyIDwgMSkKLSAgICAgICAgewotICAgICAgICAgICAgY3VyclZvcC0+ZmNvZGVGb3J3YXJkID0gMTsKLSAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgfQotICAgICAgICBjdXJyVm9wLT5mY29kZUZvcndhcmQgPSB0bXB2YXI7Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIGN1cnJWb3AtPmZjb2RlRm9yd2FyZCA9IDA7Ci0gICAgfQotCi0gICAgLyogcmVhZCB2b3BfZmNvZGVfYmFja3dhcmQgKi8KLSAgICBpZiAoY3VyclZvcC0+cHJlZGljdGlvblR5cGUgPT0gQl9WT1ApCi0gICAgewotICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMyk7Ci0gICAgICAgIGlmICh0bXB2YXIgPCAxKQotICAgICAgICB7Ci0gICAgICAgICAgICBjdXJyVm9wLT5mY29kZUJhY2t3YXJkID0gMTsKLSAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgfQotICAgICAgICBjdXJyVm9wLT5mY29kZUJhY2t3YXJkID0gdG1wdmFyOwotICAgIH0KLSAgICBlbHNlCi0gICAgewotICAgICAgICBjdXJyVm9wLT5mY29kZUJhY2t3YXJkID0gMDsKLSAgICB9Ci0KLSAgICBpZiAoY3VyclZvbC0+c2NhbGFiaWxpdHkpCi0gICAgewotICAgICAgICBjdXJyVm9wLT5yZWZTZWxlY3RDb2RlID0gKGludCkgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDIpOwotICAgIH0KLQotcmV0dXJuX3BvaW50OgotICAgIHJldHVybiBzdGF0dXM7Ci19Ci0KLQotLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqQ29tbWVudEJlZ2luKioqKioqCi0qCi0qIC0tIFZpZGVvUGxhbmVXaXRoU2hvcnRIZWFkZXIgLS0gRGVjb2RlcyB0aGUgc2hvcnRfdmlkZW9faGVhZGVyIGluZm9ybWF0aW9uIGZyb20gdGhlIGJpdHN0cmVhbQotKiBNb2RpZmllZCA6Ci0gICAgICAgICAgICAgMDQvMjMvMjAwMS4gIFJlbW92ZSB0aGUgY29kZXMgcmVsYXRlZCB0byB0aGUKLSAgICAgICAgICAgICAgICAgImZpcnN0IHBhc3MiIGRlY29kaW5nLiAgV2UgdXNlIGEgZGlmZmVyZW50IGZ1bmN0aW9uCi0gICAgICAgICAgICAgICAgIHRvIHNldCB1cCB0aGUgZGVjb2RlciBub3cuCi0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRFbmQqKioqKioqKi8KLVBWX1NUQVRVUyBEZWNvZGVTaG9ydEhlYWRlcihWaWRlb0RlY0RhdGEgKnZpZGVvLCBWb3AgKmN1cnJWb3ApCi17Ci0gICAgUFZfU1RBVFVTIHN0YXR1cyA9IFBWX1NVQ0NFU1M7Ci0gICAgVm9sICpjdXJyVm9sID0gdmlkZW8tPnZvbFswXTsKLSAgICBCaXRzdHJlYW1EZWNWaWRlbyAqc3RyZWFtID0gY3VyclZvbC0+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IkRlY29kZVNob3J0SGVhZGVyKCk6IEZyZWV6ZSBSZWxlYXNlIG5vdCBzdXBwb3J0ZWQuXG4iKTsKLSAgICAgICAgVmlkZW9EZWNvZGVyRXJyb3JEZXRlY3RlZCh2aWRlbyk7Ci0gICAgfQotICAgIC8qIHNvdXJjZSBmb3JtYXQgKi8KLSAgICBzd2l0Y2ggKEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAzKSkKLSAgICB7Ci0gICAgICAgIGNhc2UgMToKLSAgICAgICAgICAgIGlmICh2aWRlby0+c2l6ZSA8IDEyOCo5NikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9ICAxMjg7Ci0gICAgICAgICAgICB2aWRlby0+ZGlzcGxheUhlaWdodCA9IHZpZGVvLT5oZWlnaHQgID0gOTY7Ci0gICAgICAgICAgICBicmVhazsKLQotICAgICAgICBjYXNlIDI6Ci0gICAgICAgICAgICBpZiAodmlkZW8tPnNpemUgPCAxNzYqMTQ0KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gdmlkZW8tPndpZHRoICA9IDE3NjsKLSAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gdmlkZW8tPmhlaWdodCAgPSAxNDQ7Ci0gICAgICAgICAgICBicmVhazsKLQotICAgICAgICBjYXNlIDM6Ci0gICAgICAgICAgICBpZiAodmlkZW8tPnNpemUgPCAzNTIqMjg4KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gdmlkZW8tPndpZHRoID0gMzUyOwotICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlIZWlnaHQgPSB2aWRlby0+aGVpZ2h0ID0gMjg4OwotICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgY2FzZSA0OgotICAgICAgICAgICAgaWYgKHZpZGVvLT5zaXplIDwgNzA0KjU3NikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9IDcwNDsKLSAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gdmlkZW8tPmhlaWdodCA9IDU3NjsKLSAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgIGNhc2UgNToKLSAgICAgICAgICAgIGlmICh2aWRlby0+c2l6ZSA8IDE0MDgqMTE1MikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9IDE0MDg7Ci0gICAgICAgICAgICB2aWRlby0+ZGlzcGxheUhlaWdodCA9IHZpZGVvLT5oZWlnaHQgPSAxMTUyOwotICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgY2FzZSA3OgotICAgICAgICAgICAgZXh0ZW5kZWRfUFRZUEUgPSBUUlVFOwotICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgIC8qIE1zZygiSC4yNjMgc291cmNlIGZvcm1hdCBub3QgbGVnYWxcbiIpOyAqLwotICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgIH0KLQotCi0gICAgY3VyclZvcC0+cm91bmRpbmdUeXBlID0gMDsKLQotICAgIGlmIChleHRlbmRlZF9QVFlQRSA9PSBGQUxTRSkKLSAgICB7Ci0gICAgICAgIGN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID0gKGludCkgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0KLSAgICAgICAgLyogZm91cl9yZXNlcnZlZF96ZXJvX2JpdHMgKi8KLSAgICAgICAgaWYgKEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA0KSkKLSAgICAgICAgewotICAgICAgICAgICAgbXA0ZGVjX2xvZygiRGVjb2RlU2hvcnRIZWFkZXIoKTogUmVzZXJ2ZWQgYml0cyB3cm9uZy5cbiIpOwotICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgICAgICB9Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0gICAgICAgIFVGRVAgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgMyk7Ci0gICAgICAgIGlmIChVRkVQID09IDEpCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8qIHNvdXJjZSBmb3JtYXQgKi8KLSAgICAgICAgICAgIHN3aXRjaCAoQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGNhc2UgMToKLSAgICAgICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5zaXplIDwgMTI4Kjk2KQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9ICAxMjg7Ci0gICAgICAgICAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gdmlkZW8tPmhlaWdodCAgPSA5NjsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIDI6Ci0gICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby0+c2l6ZSA8IDE3NioxNDQpCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gdmlkZW8tPndpZHRoICA9IDE3NjsKLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlIZWlnaHQgPSB2aWRlby0+aGVpZ2h0ICA9IDE0NDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIDM6Ci0gICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby0+c2l6ZSA8IDM1MioyODgpCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGlzcGxheVdpZHRoID0gdmlkZW8tPndpZHRoID0gMzUyOwotICAgICAgICAgICAgICAgICAgICB2aWRlby0+ZGlzcGxheUhlaWdodCA9IHZpZGVvLT5oZWlnaHQgPSAyODg7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSA0OgotICAgICAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnNpemUgPCA3MDQqNTc2KQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9IDcwNDsKLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlIZWlnaHQgPSB2aWRlby0+aGVpZ2h0ID0gNTc2OwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgNToKLSAgICAgICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5zaXplIDwgMTQwOCoxMTUyKQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHZpZGVvLT53aWR0aCA9IDE0MDg7Ci0gICAgICAgICAgICAgICAgICAgIHZpZGVvLT5kaXNwbGF5SGVpZ2h0ID0gdmlkZW8tPmhlaWdodCA9IDExNTI7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSA2OgotICAgICAgICAgICAgICAgICAgICBjdXN0b21fUEZNVCA9IFRSVUU7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICAgICAgLyogTXNnKCJILjI2MyBzb3VyY2UgZm9ybWF0IG5vdCBsZWdhbFxuIik7ICovCi0gICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBjdXN0b21fUENGID0gQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0gICAgICAgICAgICAvKiB1bnJlc3RyaWN0ZWQgTVYgKi8KLSAgICAgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgLyogU0FDICovCi0gICAgICAgICAgICBpZiAoQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgLyogQVAgKi8KLSAgICAgICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICB2aWRlby0+YWR2YW5jZWRfSU5UUkEgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLQotICAgICAgICAgICAgdmlkZW8tPmRlYmxvY2tpbmcgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLQotICAgICAgICAgICAgdmlkZW8tPnNsaWNlX3N0cnVjdHVyZSA9IEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotCi0gICAgICAgICAgICAvKiBSUFMsIElTRCwgQUlWICovCi0gICAgICAgICAgICBpZiAoQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB2aWRlby0+bW9kaWZpZWRfcXVhbnQgPSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsKLQotICAgICAgICAgICAgLyogTWFya2VyIEJpdCBhbmQgcmVzZXJ2ZWQqLwotICAgICAgICAgICAgaWYgKEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCA0KSAhPSA4KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSNpZm5kZWYgUFZfQU5ORVhfSUpLVF9TVVBQT1JUCi0gICAgICAgIGlmICh2aWRlby0+YWR2YW5jZWRfSU5UUkEgfCB2aWRlby0+ZGVibG9ja2luZyB8IHZpZGVvLT5tb2RpZmllZF9xdWFudCB8IHZpZGVvLT5tb2RpZmllZF9xdWFudCkKLSAgICAgICAgewotICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgICAgICB9Ci0jZW5kaWYKLQotICAgICAgICBpZiAoVUZFUCA9PSAwIHx8IFVGRVAgPT0gMSkKLSAgICAgICAgewotICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDMpOwotICAgICAgICAgICAgaWYgKHRtcHZhciA+IDEpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID0gdG1wdmFyOwotICAgICAgICAgICAgLyogUlBSICovCi0gICAgICAgICAgICBpZiAoQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgLyogUlJVICovCi0gICAgICAgICAgICBpZiAoQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGN1cnJWb3AtPnJvdW5kaW5nVHlwZSA9IChpbnQpIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotICAgICAgICAgICAgaWYgKEJpdHN0cmVhbVJlYWRCaXRzMTYoc3RyZWFtLCAzKSAhPSAxKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgIH0KLSAgICAgICAgLyogQ1BNICovCi0gICAgICAgIGlmIChCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKSkKLSAgICAgICAgewotICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgICAgICB9Ci0gICAgICAgIC8qIENQRk1UICovCi0gICAgICAgIGlmIChjdXN0b21fUEZNVCA9PSAxICYmIFVGRVAgPT0gMSkKLSAgICAgICAgewotICAgICAgICAgICAgLyogYXNwZWN0IHJhdGlvICovCi0gICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNCk7Ci0gICAgICAgICAgICBpZiAodG1wdmFyID09IDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIC8qIEV4dGVuZGVkIFBBUiAqLwotICAgICAgICAgICAgaWYgKHRtcHZhciA9PSAweEYpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLyogUmVhZCBwYXJfd2lkdGggYW5kIHBhcl9oZWlnaHQgYnV0IGRvIG5vdGhpbmcgKi8KLSAgICAgICAgICAgICAgICAvKiBwYXJfd2lkdGggKi8KLSAgICAgICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOCk7Ci0KLSAgICAgICAgICAgICAgICAvKiBwYXJfaGVpZ2h0ICovCi0gICAgICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdG1wdmFyID0gQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDkpOwotCi0gICAgICAgICAgICBpbnQgdG1wRGlzcGxheVdpZHRoID0gKHRtcHZhciArIDEpIDw8IDI7Ci0gICAgICAgICAgICAvKiBtYXJrZXIgYml0ICovCi0gICAgICAgICAgICBpZiAoIUJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgOSk7Ci0gICAgICAgICAgICBpZiAodG1wdmFyID09IDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGludCB0bXBEaXNwbGF5SGVpZ2h0ID0gdG1wdmFyIDw8IDI7Ci0gICAgICAgICAgICBpbnQgdG1wSGVpZ2h0ID0gKHRtcERpc3BsYXlIZWlnaHQgKyAxNSkgJiAtMTY7Ci0gICAgICAgICAgICBpbnQgdG1wV2lkdGggPSAodG1wRGlzcGxheVdpZHRoICsgMTUpICYgLTE2OwotCi0gICAgICAgICAgICBpZiAodG1wV2lkdGggPiB2aWRlby0+d2lkdGgpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLy8gd2hpbGUgYWxsb3dlZCBieSB0aGUgc3BlYywgdGhpcyBkZWNvZGVyIGRvZXMgbm90IGFjdHVhbGx5Ci0gICAgICAgICAgICAgICAgLy8gc3VwcG9ydCBhbiBpbmNyZWFzZSBpbiBzaXplLgotICAgICAgICAgICAgICAgIEFMT0dFKCJ3aWR0aCBpbmNyZWFzZSBub3Qgc3VwcG9ydGVkIik7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICh0bXBIZWlnaHQgKiB0bXBXaWR0aCA+IHZpZGVvLT5zaXplKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMganVzdCBwb3NzaWJseSAiYi8zNzA3OTI5NiIuCi0gICAgICAgICAgICAgICAgQUxPR0UoImIvMzcwNzkyOTYiKTsKLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgICAgIGdvdG8gcmV0dXJuX3BvaW50OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlXaWR0aCA9IHRtcERpc3BsYXlXaWR0aDsKLSAgICAgICAgICAgIHZpZGVvLT53aWR0aCA9IHRtcFdpZHRoOwotICAgICAgICAgICAgdmlkZW8tPmRpc3BsYXlIZWlnaHQgPSB0bXBEaXNwbGF5SGVpZ2h0OwotICAgICAgICAgICAgdmlkZW8tPmhlaWdodCA9IHRtcEhlaWdodDsKLQotICAgICAgICAgICAgdmlkZW8tPm5Ub3RhbE1CID0gdmlkZW8tPndpZHRoIC8gTUJfU0laRSAqIHZpZGVvLT5oZWlnaHQgLyBNQl9TSVpFOwotCi0gICAgICAgICAgICBpZiAodmlkZW8tPm5Ub3RhbE1CIDw9IDQ4KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHZpZGVvLT5uQml0c0Zvck1CSUQgPSA2OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSBpZiAodmlkZW8tPm5Ub3RhbE1CIDw9IDk5KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHZpZGVvLT5uQml0c0Zvck1CSUQgPSA3OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSBpZiAodmlkZW8tPm5Ub3RhbE1CIDw9IDM5NikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB2aWRlby0+bkJpdHNGb3JNQklEID0gOTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgaWYgKHZpZGVvLT5uVG90YWxNQiA8PSAxNTg0KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHZpZGVvLT5uQml0c0Zvck1CSUQgPSAxMTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgaWYgKHZpZGVvLT5uVG90YWxNQiA8PSA2MzM2KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHZpZGVvLT5uQml0c0Zvck1CSUQgPSAxMyA7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlIGlmICh2aWRlby0+blRvdGFsTUIgPD0gOTIxNikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB2aWRlby0+bkJpdHNGb3JNQklEID0gMTQgOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWX0ZBSUw7Ci0gICAgICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKFVGRVAgPT0gMSAmJiBjdXN0b21fUENGID09IDEpCi0gICAgICAgIHsKLSAgICAgICAgICAgIEJpdHN0cmVhbVJlYWQxQml0cyhzdHJlYW0pOwotCi0gICAgICAgICAgICB0bXB2YXIgPSBCaXRzdHJlYW1SZWFkQml0czE2KHN0cmVhbSwgNyk7Ci0gICAgICAgICAgICBpZiAodG1wdmFyID09IDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFJTDsKLSAgICAgICAgICAgICAgICBnb3RvIHJldHVybl9wb2ludDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGlmIChjdXN0b21fUENGID09I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kZWRfUFRZUEUgPT0gRkFMU0UpCi0gICAgewotICAgICAgICBpZiAoQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpCi0gICAgICAgIHsKLSAgICAgICAgICAgIG1wNGRlY19sb2coIkRlY29kZVNob3J0SGVhZGVyKCk6IFplcm8gYml0IHdyb25nLlxuIik7Ci0gICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgIH0KLSAgICB9Ci0gICAgLyogcGVpICovCi0gICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSk7Ci0KLSAgICB3aGlsZSAodG1wdmFyKQotICAgIHsKLSAgICAgICAgdG1wdmFyID0gKHVpbnQzMikgQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIDgpOyAvKiAiUFNQQVJFIiAqLwotICAgICAgICB0bXB2YXIgPSAodWludDMyKSBCaXRzdHJlYW1SZWFkMUJpdHMoc3RyZWFtKTsgLyogIlBFSSIgKi8KLSAgICB9Ci0KLSAgICBpZiAodmlkZW8tPnNsaWNlX3N0cnVjdHVyZSkgIC8qIEFOTkVYX0sgKi8KLSAgICB7Ci0gICAgICAgIGlmICghQml0c3RyZWFtUmVhZDFCaXRzKHN0cmVhbSkpICAvKiBTRVBCMSAqLwotICAgICAgICB7Ci0gICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOwotICAgICAgICAgICAgZ290byByZXR1cm5fcG9pbnQ7Ci0gICAgICAgIH0KLQotICAgICAgICAvLyAgaWYgKGN1cnJWb2wtPm5CaXRzRm9yTUJJRCAvLwotICAgICAgICBpZiAoQml0c3RyZWFtUmVhZEJpdHMxNihzdHJlYW0sIHZpZGVvLT5uQml0c0Zvck1CSUQpKQotICAgICAgICB7Ci0gICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUlMOyAgICAgICAgICAgICAvKiBubyBBU08sIFJTIHN1cH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IG1vZGUgY29tZXMgaGVyZSAqLwotICAgICAgICAgICAgc3RhdHVzID0gRGVjb2RlRnJhbWVEYXRhUGFydE1vZGUodmlkZW8pOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgLyogQ29tYmluZWQgbW9kZSB3aXRoIG9yIHdpdGhvdXQgZXJyb3IgcmVzaWxpZW5jZSAqLwotICAgICAgICAgICAgLyogICAgYW5kIHNob3J0IHZpZGVvIGhlYWRlciBjb21lcyBoZXJlLiAgICAgICAgICAqLwotICAgICAgICAgICAgc3RhdHVzID0gRGVjb2RlRnJhbWVDb21iaW5lZE1vZGUodmlkZW8pOwotICAgICAgICB9Ci0gICAgfQotICAgIGVsc2UKLSAgICB7Ci0jaWZkZWYgRE9fTk9UX0ZPTExPV19TVEFOREFSRAotICAgICAgICAvKiBhY2NvcmRpbmcgdG8gdGhlIHN0YW5kYXJkLCBvbmx5IGNvbWJpbmVkIG1vZGUgaXMgYWxsb3dlZCAqLwotICAgICAgICAvKiAgICBpbiB0aGUgZW5oYW5jZW1lbnQgbGF5ZXIuICAgICAgICAgIDA2LzAxLzIwMDAuICAgICAgICAqLwotICAgICAgICBpZiAoY3VyclZvbC0+ZGF0YVBhcnRpdGlvbmluZykKLSAgICAgICAgewotICAgICAgICAgICAgLyogRGF0YSBwYXJ0aXRpb25pbmcgbW9kZSBjb21lcyBoZXJlICovCi0gICAgICAgICAgICBzdGF0dXMgPSBEZWNvZGVGcmFtZURhdGFQYXJ0TW9kZSh2aWRlbyk7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICAvKiBDb21iaW5lZCBtb2RlIHdpdGggb3Igd2l0aG91dCBlcnJvciByZXNpbGllbmNlICovCi0gICAgICAgICAgICAvKiAgICBhbmQgc2hvcnQgdmlkZW8gaGVhZGVyIGNvbWVzIGhlcmUuICAgICAgICAgICovCi0gICAgICAgICAgICBzdGF0dXMgPSBEZWNvZ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19FTkRfTUFSS0VSKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIFBWX0JpdHN0cmVhbUJ5dGVBbGlnbihjdXJyVm9sLT5iaXRzdHJlYW0pOwotICAgICAgICAgICAgICAgIFBWX0JpdHN0cmVhbUZsdXNoQml0cyhjdXJyVm9sLT5iaXRzdHJlYW0sIDIyKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLSAgICByZXR1cm4gc3RhdHVzOwotfQotCi0KLS8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKkNvbW1lbnRCZWdpbioqKioqKgotKgotKiAtLSBDYWxjVm9wRGlzcGxheVRpbWUgLS0gY2FsY3VsYXRlIGFic29sdXRlIHRpbWUgd2hlbiBWT1AgaXMgdG8gYmUgZGlzcGxheWVkCi0qCi0qICAgMDQvMTIvMjAwMCBJbml0aWFsIHBvcnQgdG8gdGhlIG5ldyBQViBkZWNvZGVyIGxpYnJhcnkgZm9ybWF0LgotKgotKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipDb21tZW50RW5kKioqKioqKiovCi11aW50MzIgQ2FsY1ZvcERpc3BsYXlUaW1lKFZvbCAqY3VyclZvbCwgVm9wICpjdXJyVm9wLCBpbnQgc2hvcnRWaWRlb0hlYWRlcikKLXsKLSAgICB1aW50MzIgZGlzcGxheV90aW1lOwotCi0KLSAgICAvKioqKioKLSAgICAqICAgQ2FsY3VsYXRlIHRoZSB0aW1lIHdoZW4gdGhlIFZPUCBpcyB0byBiZSBkaXNwbGF5ZWQgbmV4dAotICAgICoqKioqLwotCi0gICAgaWYgKCFzaG9ydFZpZGVvSGVhZGVyKQotICAgIHsKLSAgICAgICAgZGlzcGxheV90aW1lID0gKHVpbnQzMikoY3VyclZvbC0+bW9kdWxvVGltZUJhc2UgKyAoKChpbnQzMiljdXJyVm9wLT50aW1lSW5jIC0gKGludDMyKWN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KLSAgICAgICAgb3N0cm0ud3JpdGUocmVpbnRlcnByZXRfY2FzdDxjaGFyICo+KHNyYyksIG1XaWR0aCAvIDIpOwotICAgICAgICBzcmMgKz0gc3JjVVZTdHJpZGU7Ci0gICAgfQotICAgIC8qIFYgYnVmZmVyICovCi0gICAgc3JjID0gc3JjU3RhcnQgKyB2U3RyaWRlICogc3JjWVN0cmlkZSAqIDUgLyA0OwotICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgbUhlaWdodCAvIDI7ICsraSkgewotICAgICAgICBvc3RybS53cml0ZShyZWludGVycHJldF9jYXN0PGNoYXIgKj4oc3JjKSwgbVdpZHRoIC8gMik7Ci0gICAgICAgIHNyYyArPSBzcmNVVlN0cmlkZTsKLSAgICB9Ci19Ci0KLXZvaWQgTXBlZzRIMjYzRGVjb2RlclRlc3Q6OmZyZWVPdXRwdXRCdWZmZXIoKSB7Ci0gICAgZm9yIChpbnQzMl90IGkgPSAwOyBpIDwga051bU91dHB1dEJ1ZmZlcnM7ICsraSkgewotICAgICAgICBpZiAobU91dHB1dEJ1ZmZlcltpXSkgewotICAgICAgICAgICAgZnJlZShtT3V0cHV0QnVmZmVyW2ldKTsKLSAgICAgICAgICAgIG1PdXRwdXRCdWZmZXJbaV0gPSBudWxscHRyOwotICAgICAgICB9Ci0gICAgfQotfQotCi12b2lkIE1wZWc0SDI2M0RlY29kZXJUZXN0Ojpwcm9jZXNzTXBlZzRIMjYzRGVjb2Rlcih2ZWN0b3I8RnJhbWVJbmZvPiBJbmZvLCBpbnQzMl90IG9mZnNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgcmFuZ2UsIGlmc3RyZWFtICZtRWxlU3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2ZzdHJlYW0gJm9zdHJtLCBNUDREZWNvZGluZ01vZGUgaW5wdXRNb2RlKSB7Ci0g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WR0aCwgYnVmV2lkdGgpIDw8ICJEaXNwbGF5IHdpZHRoIGlzIGdyZWF0ZXIgdGhhbiBidWZmZXIgd2lkdGgiOwotICAgICAgICAgICAgQVNTRVJUX0xFKGRpc3BIZWlnaHQsIGJ1ZkhlaWdodCkgPDwgIkRpc3BsYXkgaGVpZ2h0IGlzIGdyZWF0ZXIgdGhhbiBidWZmZXIgaGVpZ2h0IjsKLQotICAgICAgICAgICAgaWYgKGRpc3BXaWR0aCAhPSBtV2lkdGggfHwgZGlzcEhlaWdodCAhPSBtSGVpZ2h0KSB7Ci0gICAgICAgICAgICAgICAgbVdpZHRoID0gZGlzcFdpZHRoOwotICAgICAgICAgICAgICAgIG1IZWlnaHQgPSBkaXNwSGVpZ2h0OwotICAgICAgICAgICAgICAgIGZyZWVPdXRwdXRCdWZmZXIoKTsKLSAgICAgICAgICAgICAgICBpZiAoaW5wdXRNb2RlID09IEgyNjNfTU9ERSkgewotICAgICAgICAgICAgICAgICAgICBQVkNsZWFuVXBWaWRlb0RlY29kZXIobURlY0hhbmRsZSk7Ci0KLSAgICAgICAgICAgICAgICAgICAgdWludDhfdCAqdm9sRGF0YVsxXXt9OwotICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHZvbFNpemUgPSAwOwotCi0gICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBWSW5pdFZpZGVvRGVjb2RlcihtRGVjSGFuZGxlLCB2b2xEYXRhLCAmdm9sU2l6ZSwgMSwgbWF4V2lkdGgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhIZWlnaHQsIEgyNjNfTU9ERSk7Ci0gICAgICAgICAgICAgICAgICAgIEFTU0VSVF9UUlVFKHN0YXR1cykgPDwgIlBWSW5pdFZpZGVvRGVjb2RlciBmYWlsZWQgZm9yIEgyNjMiOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtRnJhbWVzQ29uZmlndXJlZCA9IGZhbHNlOwot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sCi0KLSAgICBzcmNzOiBbCi0gICAgICAgICJzcmMvYml0c3RyZWFtX2lvLmNwcCIsCi0gICAgICAgICJzcmMvY29tYmluZWRfZW5jb2RlLmNwcCIsICJzcmMvZGF0YXBhcnRfZW5jb2RlLmNwcCIsCi0gICAgICAgICJzcmMvZGN0LmNwcCIsCi0gICAgICAgICJzcmMvZmluZGhhbGZwZWwuY3BwIiwKLSAgICAgICAgInNyYy9mYXN0Y29kZW1iLmNwcCIsCi0gICAgICAgICJzcmMvZmFzdGlkY3QuY3BwIiwKLSAgICAgICAgInNyYy9mYXN0cXVhbnQuY3BwIiwKLSAgICAgICAgInNyYy9tZV91dGlscy5jcHAiLAotICAgICAgICAic3JjL21wNGVuY19hcGkuY3BwIiwKLSAgICAgICAgInNyYy9yYXRlX2NvbnRyb2wuY3BwIiwKLSAgICAgICAgInNyYy9tb3Rpb25fZXN0LmNwcCIsCi0gICAgICAgICJzcmMvbW90aW9uX2NvbXAuY3BwIiwKLSAgICAgICAgInNyYy9zYWQuY3BwIiwKLSAgICAgICAgInNyYy9zYWRfaGFsZnBlbC5jcHAiLAotICAgICAgICAic3JjL3ZsY19lbmNvZGUuY3BwIiwKLSAgICAgICAgInNyYy92b3AuY3BwIiwKLSAgICBdLAotCi0gICAgY2ZsYWdzOiBbCi0gICAgICAgICItREJYX1JDIiwKLSAgICAgICAgIi1XZXJyb3IiLAotICAgIF0sCi0KLSAgICB2ZXJzaW9uX3NjcmlwdDogImV4cG9ydHMubGRzIiwKLQotICAgIGxvY2FsX2luY2x1ZGVfZGlyczogWyJzcmMiXSwKLSAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUiXSwKLQotICAgIHNhbml0aXplOiB7Ci0gICAgICAgIG1pc2NfdW5kZWZpbmVkOiBbCi0gICAgICAgICAgICAic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAotICAgICAgICBdLAotICAgICAgICBjZmk6IHRydWUsCi0gICAgfSwKLX0KLQogLy8jIyM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AgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLQotT1NDTF9FWFBPUlRfUkVGIEJvb2wgUFZHZXREZWZhdWx0RW5jT3B0aW9uKFZpZGVvRW5jT3B0aW9ucyAqZW5jT3B0aW9uLCBJbnQgZW5jVXNlQ2FzZSkKLXsKLSAgICBWaWRlb0VuY09wdGlvbnMgZGVmYXVsdFVzZUNhc2UgPSB7SDI2M19NT0RFLCBwcm9maWxlX2xldmVsX21heF9wYWNrZXRfc2l6ZVtTSU1QTEVfUFJPRklMRV9MRVZFTDBdID4+IDMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNJTVBMRV9QUk9GSUxFX0xFVkVMMCwgUFZfT0ZGLCAwLCAxLCAxMDAwLCAzMywgezE0NCwgMTQ0fSwgezE3NiwgMTc2fSwgezE1LCAzMH0sIHs2NDAwMCwgMTI4MDAwfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgezEwLCAxMH0sIHsxMiwgMTJ9LCB7MCwgMH0sIENCUl8xLCAwLjAsIFBWX09GRiwgLTEsIDAsIFBWX09GRiwgMTYsIFBWX09GRiwgMCwgUFZfT04KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwotCi0gICAgT1NDTF9VTlVTRURfQVJHKGVuY1VzZUNhc2UpOyAvLyB1bnVzZWQgZm9yIG5vdy4gTGF0ZXIgd2UgY2FuIGFkZCBtb3JlIGRlZmF1bHRzIHNldHRpbmcgYW5kIHVzZSB0aGlzCi0gICAgLy8gYXJndW1lbnQgdG8gc2VsZWN0IHRoZSByaWdodCBvbmUuCi0gICAgLyogaW4gdGhlIGZ1dHVyZSB3ZSBjYW4gY3JlYXRlIG1vcmUgbWVhbmluZ2Z1bCB1c2UtY2FzZXMgKi8KLSAgICBpZiAoZW5jT3B0aW9uID09IE5VTEwpCi0gICAgewotICAgICAgICByZXR1cm4gUFZfRkFMU0U7Ci0gICAgfQotCi0gICAgTTRWRU5DX01FTUNQWShlbmNPcHRpb24sICZkZWZhdWx0VXNlQ2FzZSwgc2l6ZW9mKFZpZGVvRW5jT3B0aW9ucykpOwotCi0gICAgcmV0dXJuIFBWX1RSVUU7Ci19Ci0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZJbml0VmlkZW9FbmNvZGVyKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwOC8yMi8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IEluaXRpYWxpemF0aW9uIG9mIE1QNCBFbmNvZGVyIGFuZCBWTyBiaXRzdHJlYW0gICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICA1LzIxLzAxLCBhbGxvY2F0ZSBvbmx5IHlDaGFuIGFuZCBhc3NpZ24gdUNoYW4gJiB2Q2hhbiAgICovCi0vKiAgICAgICAgICAgICAgMTIvMTIvMDUsIGFkZCBlbmNvZGluZyBvcHRpb24gYXMgaW5wdXQgYXJndW1lbnQgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi1PU0NMX0VYUE9SVF9SRUYgQm9vbCAgICBQVkluaXRWaWRlb0VuY29kZXIoVmlkZW9FbmNDb250cm9scyAqZW5jb2RlckNvbnRyb2wsIFZpZGVvRW5jT3B0aW9ucyAqZW5jT3B0aW9uKQotewotCi0gICAgQm9vbCAgICAgICAgc3RhdHVzID0gUFZfVFJVRTsKLSAgICBJbnQgICAgICAgICBuTGF5ZXJzLCBpZHgsIGksIGo7Ci0gICAgSW50ICAgICAgICAgbWF4ID0gMCwgbWF4X3dpZHRoID0gMCwgbWF4X2hlaWdodCA9IDAsIHBpdGNoLCBvZmZzZXQ7Ci0gICAgSW50ICAgICAgICAgc2l6ZSA9IDAsIG5Ub3RhbE1CID0gMDsKLSAgICBWaWRlb0VuY0RhdGEgKnZpZGVvOwotICAgIFZvbCAgICAgICAgICpwVm9sOwotICAgIFZpZGVvRW5jUGFyYW1zICAqcEVuY1BhcmFtczsKLSAgICBJbnQgICAgICAgICB0ZW1wX3csIHRlbXBfaCwgbWJzUGVyU2VjOwotCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAvKiAgICAgIHRoaXMgcGFydCB1c2UgdG8gYmUgUFZTZXRFbmNvZGUoKSAqLwotICAgIEludCBwcm9maWxlX3RhYmxlX2luZGV4LCAqcHJvZmlsZV9sZXZlb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ZV90YWJsZV9pbmRleCA9IChJbnQpcHJvZmlsZV9sZXZlbDsKLSAgICAgICAgaWYgKGVuY1BhcmFtcy0+bkxheWVycyAhPSAxKQotICAgICAgICB7Ci0gICAgICAgICAgICBnb3RvIENMRUFOX1VQOwotICAgICAgICB9Ci0KLSAgICAgICAgZW5jUGFyYW1zLT5MYXllck1heE1ic1BlclNlY1swXSA9IHByb2ZpbGVfbGV2ZWxfbWF4X21ic1BlclNlY1twcm9maWxlX3RhYmxlX2luZGV4XTsKLQotICAgIH0KLSAgICBlbHNlICAgLyogc2NhbGFibGUgcHJvZmlsZSAqLwotICAgIHsKLSAgICAgICAgcHJvZmlsZV9sZXZlbF90YWJsZSA9IChJbnQgKilzY2FsYWJsZV9wcm9maWxlX2xldmVsX21heF9wYWNrZXRfc2l6ZTsKLSAgICAgICAgcHJvZmlsZV90YWJsZV9pbmRleCA9IChJbnQpcHJvZmlsZV9sZXZlbCAtIChJbnQpKFNJTVBMRV9TQ0FMQUJMRV9QUk9GSUxFX0xFVkVMMCk7Ci0gICAgICAgIGlmIChlbmNQYXJhbXMtPm5MYXllcnMgPCAyKQotICAgICAgICB7Ci0gICAgICAgICAgICBnb3RvIENMRUFOX1VQOwotICAgICAgICB9Ci0gICAgICAgIGZvciAoaSA9IDA7IGkgPCBlbmNQYXJhbXMtPm5MYXllcnM7IGkrKykKLSAgICAgICAgewotICAgICAgICAgICAgZW5jUGFyYW1zLT5MYXllck1heE1ic1BlclNlY1tpXSA9IHNjYWxhYmxlX3Byb2ZpbGVfbGV2ZWxfbWF4X21ic1BlclNlY1twcm9maWxlX3RhYmxlX2luZGV4XTsKLSAgICAgICAgfQotCi0gICAgfQotCi0gICAgLyogY2Fubm90IGhhdmUgemVybyBzaXplIHBhY2tldCB3aXRoIHRoZXNlIG1vZGVzICovCi0gICAgaWYgKFBhY2tldFNpemUgPT0gMCkKLSAgICB7Ci0gICAgICAgIGlmIChlbmNPcHRpb24tPmVuY01vZGUgPT0gREFUQV9QQVJ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YWNrZXRTaXplOwotICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgY2FzZSBDT01CSU5FX01PREVfV0lUSF9FUlJfUkVTOgotCi0gICAgICAgICAgICBlbmNQYXJhbXMtPkRhdGFQYXJ0aXRpb25pbmcgPSAwOyAgICAgICAgLyogQ29tYmluZWQgTW9kZSAqLwotICAgICAgICAgICAgZW5jUGFyYW1zLT5SZXN5bmNNYXJrZXJEaXNhYmxlID0gMDsgLyogUmVzeW5jIE1hcmtlciAqLwotICAgICAgICAgICAgZW5jUGFyYW1zLT5SZXZlcnNpYmxlVkxDID0gMDsgICAgICAgICAgIC8qIE5vIFJWTEMgKi8KLSAgICAgICAgICAgIGVuY1BhcmFtcy0+UmVzeW5jUGFja2V0c2l6ZSA9IFBhY2tldFNpemU7Ci0gICAgICAgICAgICBicmVhazsKLQotICAgICAgICBjYXNlIENPTUJJTkVfTU9ERV9OT19FUlJfUkVTOgotCi0gICAgICAgICAgICBlbmNQYXJhbXMtPkRhdGFQYXJ0aXRpb25pbmcgPSAwOyAgICAgICAgLyogQ29tYmluZWQgTW9kZSAqLwotICAgICAgICAgICAgZW5jUGFyYW1zLT5SZXN5bmNNYXJrZXJEaXNhYmxlID0gMTsgLyogRGlzYWJsZSBSZXN5bmMgTWFya2VyICovCi0gICAgICAgICAgICBlbmNQYXJhbXMtPlJldmVyc2libGVWTEMgPSAwOyAgICAgICAgICAgLyogTm8gUlZMQyAqLwotICAgICAgICAgICAgYnJlYWs7Ci0jZW5kaWYKLSAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgIGdvdG8gQ0xFQU5fVVA7Ci0gICAgfQotICAgIC8qIFNldCB0aGUgY29uc3RyYWludHMgKG1heGltdW0gdmFsdWVzKSBhY2NvcmRpbmcgdG8gdGhlIGlucHV0IHByb2ZpbGUgYW5kIGxldmVsICovCi0gICAgLyogTm90ZSB0aGF0IHByb2ZpbGVfdGFibGVfaW5kZXggaXMgYWxyZWFkeSBmaWd1cmVkIG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KLSAgICB7Ci0gICAgICAgIHN3aXRjaCAoZW5jT3B0aW9uLT5lbmNXaWR0aFswXSkKLSAgICAgICAgewotICAgICAgICAgICAgY2FzZSAxMjg6Ci0gICAgICAgICAgICAgICAgaWYgKGVuY09wdGlvbi0+ZW5jSGVpZ2h0WzBdICE9IDk2KSAvKiBzb3VyY2VfZm9ybWF0ID0gMSAqLwotICAgICAgICAgICAgICAgICAgICBnb3RvIENMRUFOX1VQOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSAxNzY6Ci0gICAgICAgICAgICAgICAgaWYgKGVuY09wdGlvbi0+ZW5jSGVpZ2h0WzBdICE9IDE0NCkgLyogc291cmNlX2Zvcm1hdCA9IDIgKi8KLSAgICAgICAgICAgICAgICAgICAgZ290byBDTEVBTl9VUDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgMzUyOgotICAgICAgICAgICAgICAgIGlmIChlbmNPcHRpb24tPmVuY0hlaWdodFswXSAhPSAyODgpIC8qIHNvdXJjZV9mb3JtYXQgPSAyICovCi0gICAgICAgICAgICAgICAgICAgIGdvdG8gQ0xFQU5fVVA7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgNzA0OgotICAgICAgICAgICAgICAgIGlmIChlbmNPcHRpb24tPmVuY0hlaWdodFswXSAhPSA1NzYpIC8qIHNvdXJjZV9mb3JtYXQgPSAyICovCi0gICAgICAgICAgICAgICAgICAgIGdvdG8gQ0xFQU5fVVA7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICBjYXNlIDE0MDg6Ci0gICAgICAgICAgICAgICAgaWYgKGVuY09wdGlvbi0+ZW5jSGVpZ2h0WzBdICE9IDExNTIpIC8qIHNvdXJjZV9mb3JtYXQgPSAyICovCi0gICAgICAgICAgICAgICAgICAgIGdvdG8gQ0xFQU5fVVA7Ci0gICAgICAgICAgICAgICAgYnJlYW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QgZnJhbWVyYXRlKE1Cc1BlclNlYykgYXJlIHZhbGQgKi8KLSAgICAgICAgbWJzUGVyU2VjID0gKEludCkoblRvdGFsTUIgKiB2aWRlby0+ZW5jUGFyYW1zLT5MYXllckZyYW1lUmF0ZVtpZHhdKTsKLSAgICAgICAgaWYgKG1ic1BlclNlYyA+IHZpZGVvLT5lbmNQYXJhbXMtPkxheWVyTWF4TWJzUGVyU2VjW2lkeF0pIHN0YXR1cyA9IFBWX0ZBTFNFOwotICAgIH0KLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIC8qIFNldCBQcm9maWxlIGFuZCBWaWRlbyBCdWZmZXIgU2l6ZSBmb3IgZWFjaCBsYXllciAqLwotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIGlmICh2aWRlby0+ZW5jUGFyYW1zLT5SQ19UeXBlID09IENCUl9MT1dERUxBWSkgdmlkZW8tPmVuY1BhcmFtcy0+VkJWX2RlbGF5ID0gMC41OyAvKiBGb3IgQ0JSX0xPV0RFTEFZLCB3ZSBzZXQgMC41c2VjIGJ1ZmZlciAqLwotICAgIHN0YXR1cyA9IFNldFByb2ZpbGVfQnVmZmVyU2l6ZSh2aWRlbywgdmlkZW8tPmVuY1BhcmFtcy0+VkJWX2RlbGF5LCAxKTsKLSAgICBpZiAoc3RhdHVzICE9IFBWX1RSVUUpCi0gICAgICAgIGdvdG8gQ0xFQU5fVVA7Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAvKiBtZW1vcnkgYWxsb2NhdGlvbiBhbmQgaW5pdGlhbGl6YXRpb24gKi8KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotICAgIGlmICh2aWRlbyA9PSBOVUxMKSBnb3RvIENMRUFOX1VQOwotCi0gICAgLyogY3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JlKSkgewotICAgICAgICAgICAgZ290byBDTEVBTl9VUDsKLSAgICAgICAgfQotICAgICAgICB2aWRlby0+cHJlZERDQUNfY29sID0gKHR5cGVEQ0FDU3RvcmUgKikgTTRWRU5DX01BTExPQygoKG1heF93aWR0aCA+PiA0KSArIDEpICogc2l6ZW9mKHR5cGVEQ0FDU3RvcmUpKTsKLSAgICAgICAgaWYgKHZpZGVvLT5wcmVkRENBQ19jb2wgPT0gTlVMTCkgZ290byBDTEVBTl9VUDsKLQotICAgICAgICAvKiBlbGVtZW50IHplcm8gd2lsbCBiZSB1c2VkIGZvciBzdG9yaW5nIHZlcnRpY2FsIChjb2wpIEFDIGNvZWZmaWNpZW50cyAqLwotICAgICAgICAvKiAgdGhlIHJlc3Qgd2lsbCBiZSB1c2VkIGZvciBzdG9yaW5nIGhvcml6b250YWwgKHJvdykgQUMgY29lZmZpY2llbnRzICAqLwotICAgICAgICB2aWRlby0+cHJlZERDQUNfcm93ID0gdmlkZW8tPnByZWREQ0FDX2NvbCArIDE7ICAgICAgICAvKiAgQUNEQyAqLwotCi0gICAgICAgIGlmICgoc2l6ZV90KW5Ub3RhbE1CID4gU0laRV9NQVggLyBzaXplb2YoSW50KSkgewotICAgICAgICAgICAgZ290byBDTEVBTl9VUDsKLSAgICAgICAgfQotICAgICAgICB2aWRlby0+YWNQcmVkRmxhZyA9IChJbnQgKikgTTRWRU5DX01BTExPQyhuVG90YWxNQiAqIHNpemVvZihJbnQpKTsgLyogTWVtb3J5IGZvciBhY1ByZWRGbGFnICovCi0gICAgICAgIGlmICh2aWRlby0+YWNQcmVkRmxhZyA9PSBOVUxMKSBnb3RvIENMRUFOX1VQOwotICAgIH0KLQotICAgIHZpZGVvLT5vdXRwdXRNQiA9IChNYWNyb0Jsb2NrICopIE00VkVOQ19NQUxMT0Moc2l6ZW9mKE1hY3JvQmxvY2spKTsgLyogQWxsb2NhdGluZyBtYWNyb2Jsb2NrIHNwYWNlICovCi0gICAgaWYgKHZpZGVvLT5v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mIChwVm9sLT5uVG90YWxNQiA+PSAyNTcpCi0gICAgICAgICAgICBwVm9sLT5uQml0c0Zvck1CSUQgPSA5OwotICAgICAgICBpZiAocFZvbC0+blRvdGFsTUIgPj0gNTEzKQotICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTA7Ci0gICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSAxMDI1KQotICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTE7Ci0gICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSAyMDQ5KQotICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTI7Ci0gICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSA0MDk3KQotICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTM7Ci0gICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSA4MTkzKQotICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTQ7Ci0gICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSAxNjM4NSkKLSAgICAgICAgICAgIHBWb2wtPm5CaXRzRm9yTUJJRCA9IDE1OwotICAgICAgICBpZiAocFZvbC0+blRvdGFsTUIgPj0gMzI3NjkpCi0gICAgICAgICAgICBwVm9sLT5uQml0c0Zvck1CSUQgPSAxNjsKLSAgICAgICAgaWYgKHBWb2wtPm5Ub3RhbE1CID49IDY1NTM3KQotICAgICAgICAgICAgcFZvbC0+bkJpdHNGb3JNQklEID0gMTc7Ci0gICAgICAgIGlmIChwVm9sLT5uVG90YWxNQiA+PSAxMzEwNzMpCi0gICAgICAgICAgICBwVm9sLT5uQml0c0Zvck1CSUQgPSAxODsKLQotICAgICAgICBpZiAocFZvbC0+c2hvcnRWaWRlb0hlYWRlcikKLSAgICAgICAgewotICAgICAgICAgICAgc3dpdGNoIChwVm9sLT53aWR0aCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBjYXNlIDEyODoKLSAgICAgICAgICAgICAgICAgICAgaWYgKHBWb2wtPmhlaWdodCA9PSA5NikgIC8qIHNvdXJjZV9mb3JtYXQgPSAxICovCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHBWb2wtPm5HT0JpblZvcCA9IDY7Ci0gICAgICAgICAgICAgICAgICAgICAgICBwVm9sLT5uTUJpbkdPQiA9IDg7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSAxNzY6Ci0gICAgICAgICAgICAgICAgICAgIGlmIChwVm9sLT5oZWlnaHQgPT0gMTQ0KSAgLyogc291cmNlX2Zvcm1hdCA9IDIgKi8KLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgcFZvbC0+bkdPQmluVm9wID0gOTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHBWb2wtPm5NQmluR09CID0gMTE7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGNhc2UgMzUyOgotICAgICAgICAgICAgICAgICAgICBpZiAocFZvbC0+aGVpZ2h0ID09IDI4OCkgIC8qIHNvdXJjZV9mb3JtYXQgPSAyICovCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHBWb2wtPm5HT0JpblZvcCA9IDE4OwotICAgICAgICAgICAgICAgICAgICAgICAgcFZvbC0+bk1CaW5HT0IgPSAyMjsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUxTRTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIDcwNDoKLSAgICAgICAgICAgICAgICAgICAgaWYgKHBWb2wtPmhlaWdodCA9PSA1NzYpICAvKiBzb3VyY2VfZm9ybWF0ID0gMiAqLwotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBwVm9sLT5uR09CaW5Wb3AgPSAxODsKLSAgICAgICAgICAgICAgICAgICAgICAgIHBWb2wtPm5NQmluR09CID0gODg7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzID0gUFZfRkFMU0U7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGNhc2UgMTQwODoKLSAgICAgICAgICAgICAgICAgICAgaWYgKHBWb2wtPmhlaWdodCA9PSAxMTUyKSAgLyogc291cmNlX2Zvcm1hdCA9IDIgKi8KLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgcFZvbC0+bkdPQmluVm9wID0gMTg7Ci0gICAgICAgICAgICAgICAgICAgICAgICBwVm9sLT5uTUJpbkdPQiA9IDM1MjsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUxTRTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBQVl9GQUxTRTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIC8qIGFsbG9jYXRlIGFuZCBpbml0aWFsaXplIHJhdGUgY29udHJvbCBwYXJhbWV0ZXJzICovCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotICAgIC8qIEJFR0lOIElOSVRJQUxJWkFUSU9OIE9GIEFOTkVYIEwgUkFURSBDT05UUk9MICovCi0gICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPlJDX1R5cGUgIT0gQ09OU1RBTlRfUSkKLSAgICB7Ci0gICAgICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgbkxheWVyczsgaWR4KyspIC8qIDEyLzI1LzAwICovCi0gICAgICAgIHsKLSAgICAgICAgICAgIHZpZGVvLT5yY1tpZHhdID0KLSAgICAgICAgICAgICAgICAocmF0ZUNvbnRyb2wgKilNNFZFTkNfTUFMTE9DKHNpemVvZihyYXRlQ29udHJvbCkpOwotCi0gICAgICAgICAgICBpZiAodmlkZW8tPnJjW2lkeF0gPT0gTlVMTCkgZ290byBDTEVBTl9VUDsKLQotICAgICAgICAgICAgTTRWRU5DX01FTVNFVCh2aWRlby0+cmNbaWR4XSwgMCwgc2l6ZW9mKHJhdGVDb250cm9sKSk7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKFBWX1NVQ0NFU1MgIT0gUkNfSW5pdGlhbGl6ZSh2aWRlbykpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGdvdG8gQ0xFQU5fVVA7Ci0gICAgICAgIH0KLSAgICAgICAgLyogaW5pdGlhbGl6YXRpb24gZm9yIDItcGFzcyByYXRlIGNvbnRyb2wgKi8KLSAgICB9Ci0gICAgLyogRU5EIElOSVRJQUxJWkFUSU9OIE9GIEFOTkVYIEwgUkFURSBDT05UUk9MICovCi0KLSAgICAvKioqKioqKioqKiBhc3NpZ24gcGxhdGZvcm0gZGVwZW5kZW50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W5jdGlvblBvaW50ZXItPkNob29zZU1vZGUgPSAmQ2hvb3NlTW9kZV9DOwotICAgIHZpZGVvLT5mdW5jdGlvblBvaW50ZXItPkdldEhhbGZQZWxNQlJlZ2lvbiA9ICZHZXRIYWxmUGVsTUJSZWdpb25fQzsKLS8vICB2aWRlby0+ZnVuY3Rpb25Qb2ludGVyLT5TQURfTUJfUEFERElORyA9ICZTQURfTUJfUEFERElORzsgLyogNC8yMS8wMSAqLwotCi0KLSAgICBlbmNvZGVyQ29udHJvbC0+dmlkZW9FbmNvZGVySW5pdCA9IDE7ICAvKiBpbml0IGRvbmUhICovCi0KLSAgICByZXR1cm4gUFZfVFJVRTsKLQotQ0xFQU5fVVA6Ci0gICAgUFZDbGVhblVwVmlkZW9FbmNvZGVyKGVuY29kZXJDb250cm9sKTsKLQotICAgIHJldHVybiBQVl9GQUxTRTsKLX0KLQotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWQ2xlYW5VcFZpZGVvRW5jb2RlcigpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMDgvMjIvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiBEZWFsbG9jYXRlcyBhbGxvY2F0ZWQgbWVtb3J5IGZyb20gSW5pdFZpZGVvRW5jb2RlcigpICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiA1LzIxLzAxLCBmcmVlIG9ubHkgeUNoYW4gaW4gVm9wICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLQotT1NDTF9FWFBPUlRfUkVGIEJvb2wgICAgUFZDbGVhblVwVmlkZW9FbmNvZGVyKFZpZGVvRW5jQ29udHJvbHMgKmVuY29kZXJDb250cm9sKQotewotICAgIEludCBpZHgsIGk7Ci0gICAgVmlkZW9FbmNEYXRhICp2aWRlbyA9IChWaWRlb0VuY0RhdGEgKillbmNvZGVyQ29udHJvbC0+dmlkZW9FbmNvZGVyRGF0YTsKLSAgICBpbnQgblRvdGFsTUI7Ci0gICAgaW50IG1heF93aWR0aCwgb2Zmc2V0OwotCi0jaWZkZWYgUFJJTlRfUkNfSU5GTwotICAgIGlmIChmYWNjdCAhPSBOVUxMKQotICAgIHsKLSAgICAgICAgZnByaW50ZihmYWNjdCwgIkBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBcbiIpOwotICAgICAgICBmcHJpbnRmKGZhY2N0LCAiVE9UQUwgTlVNIEJJVFMgR0VORVJBVEVEICVkXG4iLCB0aVRvdGFsTnVtQml0c0dlbmVyYXRlZCk7Ci0gICAgICAgIGZwcmludGYoZmFjY3QsICJAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAXG4iKTsKLSAgICAgICAgZnByaW50ZihmYWNjdCwgIlRPVEFMIE5VTUJFUiBPRiBGUkFNRVMgQ09ERUQgJWRcbiIsCi0gICAgICAgICAgICAgICAgdmlkZW8tPmVuY1BhcmFtcy0+cmNbMF0tPnRv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LSAgICAgICAgICAgIGZvciAoaWR4ID0gMDsgaWR4IDwgblRvdGFsTUI7IGlkeCsrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmICh2aWRlby0+bW90W2lkeF0pCi0gICAgICAgICAgICAgICAgICAgIE00VkVOQ19GUkVFKHZpZGVvLT5tb3RbaWR4XSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+bW90KTsKLSAgICAgICAgfQotCi0gICAgICAgIGlmICh2aWRlby0+aW50cmFBcnJheSkgTTRWRU5DX0ZSRUUodmlkZW8tPmludHJhQXJyYXkpOwotCi0gICAgICAgIGlmICh2aWRlby0+c2xpY2VObylNNFZFTkNfRlJFRSh2aWRlby0+c2xpY2VObyk7Ci0gICAgICAgIGlmICh2aWRlby0+YWNQcmVkRmxhZylNNFZFTkNfRlJFRSh2aWRlby0+YWNQcmVkRmxhZyk7Ci0vLyAgICAgIGlmKHZpZGVvLT5wcmVkRENBQylNNFZFTkNfRlJFRSh2aWRlby0+cHJlZERDQUMpOwotICAgICAgICBpZiAodmlkZW8tPnByZWREQykgTTRWRU5DX0ZSRUUodmlkZW8tPnByZWREQyk7Ci0gICAgICAgIHZpZGVvLT5wcmVkRENBQ19yb3cgPSBOVUxMOwotICAgICAgICBpZiAodmlkZW8tPnByZWREQ0FDX2NvbCkgTTRWRU5DX0ZSRUUodmlkZW8tPnByZWREQ0FDX2NvbCk7Ci0gICAgICAgIGlmICh2aWRlby0+b3V0cHV0TUIpTTRWRU5DX0ZSRUUodmlkZW8tPm91dHB1dE1CKTsKLQotICAgICAgICBpZiAodmlkZW8tPmJpdHN0cmVhbTEpQml0c3RyZWFtQ2xvc2VFbmModmlkZW8tPmJpdHN0cmVhbTEpOwotICAgICAgICBpZiAodmlkZW8tPmJpdHN0cmVhbTIpQml0c3RyZWFtQ2xvc2VFbmModmlkZW8tPmJpdHN0cmVhbTIpOwotICAgICAgICBpZiAodmlkZW8tPmJpdHN0cmVhbTMpQml0c3RyZWFtQ2xvc2VFbmModmlkZW8tPmJpdHN0cmVhbTMpOwotCi0gICAgICAgIGlmICh2aWRlby0+b3ZlcnJ1bkJ1ZmZlcikgTTRWRU5DX0ZSRUUodmlkZW8tPm92ZXJydW5CdWZmZXIpOwotCi0gICAgICAgIG1heF93aWR0aCA9IHZpZGVvLT5lbmNQYXJhbXMtPkxheWVyV2lkdGhbMF07Ci0gICAgICAgIG1heF93aWR0aCA9ICgoKG1heF93aWR0aCArIDE1KSA+PiA0KSA8PCA0KTsgLyogMDkvMTkvMDUgKi8KLSAgICAgICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPkgyNjNfRW5hYmxlZCkKLSAgICAgICAgewotICAgICAgICAgICAgb2Zmc2V0ID0gMDsKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIG9mZnNldCA9ICgobWF4X3dpZHRoICsgMzIpIDw8IDQpICsgMTY7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAodmlkZW8tPmN1cnJWb3ApCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmICh2aWRlby0+Y3VyclZvcC0+YWxsQ2hhbikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+Y3VyclZvcC0+YWxsQ2hhbik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+Y3VyclZvcCk7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAodmlkZW8tPm5leHRCYXNlVm9wKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAodmlkZW8tPm5leHRCYXNlVm9wLT5hbGxDaGFuKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIE00VkVOQ19GUkVFKHZpZGVvLT5uZXh0QmFzZVZvcC0+YWxsQ2hhbik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+bmV4dEJhc2VWb3ApOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHZpZGVvLT5wcmV2QmFzZVZvcCkKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKHZpZGVvLT5wcmV2QmFzZVZvcC0+YWxsQ2hhbikKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+cHJldkJhc2VWb3AtPmFsbENoYW4pOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8tPnByZXZCYXNlVm9wKTsKLSAgICAgICAgfQotICAgICAgICBpZiAodmlkZW8tPnByZXZFbmhhbmNlVm9wKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAodmlkZW8tPnByZXZFbmhhbmNlVm9wLT5hbGxDaGFuKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIE00VkVOQ19GUkVFKHZpZGVvLT5wcmV2RW5oYW5jZVZvcC0+YWxsQ2hhbik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+cHJldkVuaGFuY2VWb3ApOwotICAgICAgICB9Ci0KLSAgICAgICAgLyogMDQvMDkvMDEsIGZvciBWb3BzIGluIHRoZSB1c2UgbXVsdGlwYXNzIHByb2Nlc3NpbmcgKi8KLSAgICAgICAgZm9yIChpZHggPSAwOyBpZHggPCB2aWRlby0+ZW5jUGFyYW1zLT5uTGF5ZXJzOyBpZHgrKykKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKHZpZGVvLT5wTVBbaWR4XSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnBNUFtpZHhdLT5wUkRTYW1wbGVzKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IDMwOyBpKyspCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cE1QW2lkeF0tPnBSRFNhbXBsZXNbaV0pCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8tPnBNUFtpZHhdLT5wUkRTYW1wbGVzW2ldKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+cE1QW2lkeF0tPnBSRFNhbXBsZXMpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIE00VkVOQ19NRU1TRVQodmlkZW8tPnBNUFtpZHhdLCAwLCBzaXplb2YoTXVsdGlQYXNzKSk7Ci0gICAgICAgICAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8tPnBNUFtpZHhdKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICAvKiAvLyAgRW5kIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLyAqLwotCi0gICAgICAgIGlmICh2aWRlby0+dm9sKQotICAgICAgICB7Ci0gICAgICAgICAgICBmb3IgKGlkeCA9IDA7IGlkeCA8IHZpZGVvLT5lbmNQYXJhbXMtPm5MYXllcnM7IGlkeCsrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmICh2aWRlby0+dm9sW2lkeF0pCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnZvbFtpZHhdLT5zdHJlYW0pCi0gICAgICAgICAgICAgICAgICAgICAgICBNNFZFTkNfRlJFRSh2aWRlby0+dm9sW2lkeF0tPnN0cmVhbSk7Ci0gICAgICAgICAgICAgICAgICAgIE00VkVOQ19GUkVFKHZpZGVvLT52b2xbaWR4XSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8tPnZvbCk7Ci0gICAgICAgIH0KLQotICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAvKiBzdG9wIHJhdGUgY29udHJvbCBwYXJhbWV0ZXJzICovCi0gICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSAgICAgICAgLyogQU5ORVggTCBSQVRFIENPTlRST0wgKi8KLSAgICAgICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPlJDX1R5cGUgIT0gQ09OU1RBTlRfUSkKLSAgICAgICAgewotICAgICAgICAgICAgUkNfQ2xlYW51cCh2aWRlby0+cmMsIHZpZGVvLT5lbmNQYXJhbXMtPm5MYXllcnMpOwotCi0gICAgICAgICAgICBmb3IgKGlkeCA9IDA7IGlkeCA8IHZpZGVvLT5lbmNQYXJhbXMtPm5MYXllcnM7IGlkeCsrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cmNbaWR4XSkKLSAgICAgICAgICAgICAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8tPnJjW2lkeF0pOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHZpZGVvLT5mdW5jdGlvblBvaW50ZXIpIE00VkVOQ19GUkVFKHZpZGVvLT5mdW5jdGlvblBvaW50ZXIpOwotCi0gICAgICAgIC8qIElmIGFwcGxpY2F0aW9uIGhhcyBjYWxsZWQgUFZDbGVhblVwVmlkZW9FbmNvZGVyIHRoZW4gd2UgZGVhbGxvY2F0ZSAqLwotICAgICAgICAvKiBJZiBQVkluaXRWaWRlb0VuY29kZXIgY2xhc3MgaXQsIHRoZW4gd2UgRE8gTk9UIGRlYWxsb2NhdGUgKi8KLSAgICAgICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMpCi0gICAgICAgIHsKLSAgICAgICAgICAgIE00VkVOQ19GUkVFKHZpZGVvLT5lbmNQYXJhbXMpOwotICAgICAgICB9Ci0KLSAgICAgICAgTTRWRU5DX0ZSRUUodmlkZW8pOwotICAgICAgICBlbmNvZGVyQ29udHJvbC0+dmlkZW9FbmNvZGVyRGF0YSA9IE5VTEw7IC8qIHZpZGVvICovCi0gICAgfQotCi0gICAgZW5jb2RlckNvbnRyb2wtPnZpZGVvRW5jb2RlckluaXQgPSAwOwotCi0gICAgcmV0dXJuIFBWX1RSVUU7Ci19Ci0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZHZXRWb2xIZWFkZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiA3LzE3LzIwMDEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLQotT1NDTF9FWFBPUlRfUkVGIEJvb2wgUFZHZXRWb2xIZW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AgICB9Ci0gICAgZWxzZQotICAgICAgICByZXR1cm4gUFZfRkFMU0U7Ci0KLSAgICAvKiBSZXNldCBiaXRzdHJlYW0xIGJ1ZmZlciBwYXJhbWV0ZXJzICovCi0gICAgQml0c3RyZWFtRW5jUmVzZXQoZW5jRGF0YS0+Yml0c3RyZWFtMSk7Ci0KLSAgICByZXR1cm4gUFZfVFJVRTsKLX0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkdldE92ZXJydW5CdWZmZXIoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IEdldCB0aGUgb3ZlcnJ1biBidWZmZXIgYCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQb2ludGVyIHRvIG92ZXJydW4gYnVmZmVyLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0KLU9TQ0xfRVhQT1JUX1JFRiBVQ2hhciogUFZHZXRPdmVycnVuQnVmZmVyKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwpCi17Ci0gICAgVmlkZW9FbmNEYXRhICp2aWRlbyA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOwotICAgIEludCBjdXJyTGF5ZXIgPSB2aWRlby0+Y3VyckxheWVyOwotICAgIFZvbCAqY3VyclZvbCA9IHZpZGVvLT52b2xbY3VyckxheWVyXTsKLQotICAgIGlmIChjdXJyVm9sLT5zdHJlYW0tPmJpdHN0cmVhbUJ1ZmZlciAhPSB2aWRlby0+b3ZlcnJ1bkJ1ZmZlcikgLy8gbm90IHVzZWQKLSAgICB7Ci0gICAgICAgIHJldHVybiBOVUxMOwotICAgIH0KLQotICAgIHJldHVybiB2aWRlby0+b3ZlcnJ1bkJ1ZmZlcjsKLX0KLQotCi0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBFbmNvZGVWaWRlb0ZyYW1lKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA4LzIyLzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogRW5jb2RlIHZpZGVvIGZyYW1lIGFuZCByZXR1cm4gYml0c3RyZWFtICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgMDIuMTQuMjAwMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICBGaW5pc2hpbmcgbmV3IHRpbWVzdGFtcCAzMi1iaXQgaW5wdXQgIC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fCAoY3VyckxheWVyID4gZW5jUGFyYW1zLT5uTGF5ZXJzIC0gMSkpCi0gICAgICAgIHJldHVybiBQVl9GQUxTRTsKLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgLyogSWYgcG9zdC1za2lwcGluZyBzdGlsbCBlZmZlY3RpdmUgLS0tIHJldHVybiAqLwotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0KLSAgICBpZiAoIWVuY29kZVZvcCkgLyogc2tpcCBlbmggbGF5ZXIsIG5vIGJhc2UgbGF5ZXIgY29kZWQgLS0tIHJldHVybiAqLwotICAgIHsKLSNpZmRlZiBfUFJJTlRfU1RBVAotICAgICAgICBwcmludGYoIk5vIGZyYW1lIGNvZGVkLiBDb250aW51ZSB0byBuZXh0IGZyYW1lLiIpOwotI2VuZGlmCi0gICAgICAgIC8qIGV4cGVjdGVkIG5leHQgY29kZSB0aW1lLCBjb252ZXJ0IGJhY2sgdG8gbWlsbGlzZWMgKi8KLSAgICAgICAgKm5leHRNb2RUaW1lID0gdmlkZW8tPm5leHRNb2RUaW1lOwotCi0jaWZkZWYgQUxMT1dfVk9QX05PVF9DT0RFRAotICAgICAgICBpZiAodmlkZW8tPnZvbFswXS0+c2hvcnRWaWRlb0hlYWRlcikgLyogU2hvcnQgVmlkZW8gSGVhZGVyID0gMSAqLwotICAgICAgICB7Ci0gICAgICAgICAgICAqc2l6ZSA9IDA7Ci0gICAgICAgICAgICAqbkxheWVyID0gLTE7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICAqbkxheWVyID0gMDsKLSAgICAgICAgICAgIEVuY29kZVZvcE5vdENvZGVkKHZpZGVvLCBic3RyZWFtLCBzaXplLCBtb2RUaW1lKTsKLSAgICAgICAgICAgICpzaXplID0gdmlkZW8tPnZvbFswXS0+c3RyZWFtLT5ieXRlQ291bnQ7Ci0gICAgICAgIH0KLSNlbHNlCi0gICAgICAgICpzaXplID0gMDsKLSAgICAgICAgKm5MYXllciA9IC0xOwotI2VuZGlmCi0gICAgICAgIHJldHVybiBzdGF0dXM7Ci0gICAgfQotCi0KLS8vRU5DT0RFX1ZPUF9BR0FJTjogIC8qIDEyLzMwLzAwICovCi0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgLyogSW5pdGlhbGl6ZSBWb2wgc3RyZWFtIHN0cnVjdHVyZSB3aXRoIGFwcGxpY2F0aW9uIGJpdHN0cmVhbSAqLwotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotICAgIGN1cnJWb2wgPSB2aWRlby0+dm9sW2N1cnJMYXllcl07Ci0gICAgY3VyclZvbC0+c3RyZWFtLT5iaXRzdHJlYW1CdWZmZXIgPSBic3RyZWFtOwotICAgIGN1cnJWb2wtPnN0cmVhbS0+YnVmZmVyU2l6ZSA9ICpzaXplOwotICAgIEJpdHN0cmVhbUVuY1Jlc2V0KGN1cnJWb2wtPnN0cmVhbSk7Ci0gICAgQml0c3RyZWFtU2V0T3ZlcnJ1bkJ1ZmZlcihjdXJyVm9sLT5zdHJlYW0sIHZpZGVvLT5vdmVycnVuQnVmZmVyLCB2aWRlby0+b0JTaXplLCB2aWRlbyk7Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgLyogRW5jb2RlIFZPUyBhbmQgVk9MIEhlYWRlcnMgb24gZmlyc3QgY2FsbCBmb3IgZWFjaCBsYXllciAqLwotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotICAgIGlmICh2aWRlby0+dm9sSW5pdGlhbGl6ZVtjdXJyTGF5ZXJdKQotICAgIHsKLSAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnRpbWVJbmMgPSAwOwotICAgICAgICB2aWRlby0+cHJldkJhc2VWb3AtPnRpbWVJbmMgPSAwOwotICAgICAgICBpZiAoIXZpZGVvLT5lbmNQYXJhbXMtPkdldFZvbEhlYWRlcltjdXJyTGF5ZXJdKQotICAgICAgICAgICAgcHZfc3RhdHVzID0gRW5jb2RlVk9TX1N0YXJ0KGVuY0N0cmwpOwotICAgIH0KLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgLyogQ29weSBJbnB1dCBWaWRlbyBGcmFtZSB0byBJbnRlcm5hbCBWaWRlbyBCdWZmZXIgKi8KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIC8qIERldGVybWluZSBXaWR0aCBhbmQgSGVpZ2h0IG9mIFZvcCBMYXllciAqLwotCi0gICAgd2lkdGggPSBlbmNQYXJhbXMtPkxheWVyV2lkdGhbY3VyckxheWVyXTsgICAvKiBHZXQgaW5wdXQgd2lkdGggKi8KLSAgICBoZWlnaHQgPSBlbmNQYXJhbXMtPkxheWVySGVpZ2h0W2N1cnJMYXllcl07IC8qIEdldCBpbnB1dCBoZWlnaHQgKi8KLSAgICAvKiBSb3VuZCBVcCB0byBuZWFyZXN0IG11bHRpcGxlIG9mIDE2IDogTVBFRy00IFN0YW5kYXJkICovCi0KLSAgICB3aWR0aF8xNiA9ICgod2lkdGggKyAxNSkgLyAxNikgKiAxNjsgICAgICAgICAgICAvKiBSb3VuZCB1cCB0byBuZWFyZXN0IG11bHRpcGxlIG9mIDE2ICovCi0gICAgaGVpZ2h0XzE2ID0gKChoZWlnaHQgKyAxNSkgLyAxNikgKiAxNjsgICAgICAgICAgLyogUm91bmQgdXAgdG8gbmVhcmVzdCBtdWx0aXBsZSBvZiAxNiAqLwotCi0gICAgdmlkZW8tPmlucHV0ID0gdmlkX2luOyAgLyogcG9pbnQgdG8gdGhlIGZyYW1lIGlucHV0ICovCi0KLSAgICAvKi8vICBFbmQgLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vICovCi0KLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAvKiBEZXRlcm1pbmUgVk9QIFR5cGUgICAgICAgICAgICAgICAgICovCi0gICAgLyogNi8yLzIwMDEsIHNlcGFyYXRlIGZ1bmN0aW9uICAgICAgKi8KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgRGV0ZXJtaW5lVm9wVHlwZSh2aWRlbywgY3VyckxheWVyKTsKLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIC8qICAgIEluaXRpYWxpemUgVk9QICAgICAgICAqLwotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIHZpZGVvLT5jdXJyVm9wLT52b2xJRCA9IGN1cnJWb2wtPnZvbElEOwotICAgIHZpZGVvLT5jdXJyVm9wLT53aWR0aCA9IHdpZHRoXzE2OwotICAgIHZpZGVvLT5jdXJyVm9wLT5oZWlnaHQgPSBoZWlnaHRfMTY7Ci0gICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPkgyNjNfRW5hYmxlZCkgLyogIDExLzI4LzA1ICovCi0gICAgewotICAgICAgICB2aWRlby0+Y3VyclZvcC0+cGl0Y2ggPSB3aWR0aF8xNjsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnBpdGNoID0gd2lkdGhfMTYgKyAzMjsKLSAgICB9Ci0gICAgdmlkZW8tPmN1cnJWb3AtPnRpbWVJbmMgPSBjdXJyVm9sLT50aW1lSW5jcmVtZW50OwotICAgIHZpZGVvLT5jdXJyVm9wLT52b3BDb2RlZCA9IDE7Ci0gICAgdmlkZW8tPmN1cnJWb3AtP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ZW5jUGFyYW1zLT5JbnRyYVBlcmlvZDsKLQotICAgIC8qIFNldCBIaW50VHJhY2sgSW5mb3JtYXRpb24gKi8KLSAgICBpZiAoY3VyckxheWVyICE9IC0xKQotICAgIHsKLSAgICAgICAgaWYgKGN1cnJWb2wtPnByZXZNb2R1bG9UaW1lQmFzZSkKLSAgICAgICAgICAgIHZpZGVvLT5oaW50VHJhY2tJbmZvLk1UQiA9IDE7Ci0gICAgICAgIGVsc2UKLSAgICAgICAgICAgIHZpZGVvLT5oaW50VHJhY2tJbmZvLk1UQiA9IDA7Ci0gICAgICAgIHZpZGVvLT5oaW50VHJhY2tJbmZvLkxheWVySUQgPSAoVUNoYXIpY3VyclZvbC0+dm9sSUQ7Ci0gICAgICAgIHZpZGVvLT5oaW50VHJhY2tJbmZvLkNvZGVUeXBlID0gKFVDaGFyKXZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZTsKLSAgICAgICAgdmlkZW8tPmhpbnRUcmFja0luZm8uUmVmU2VsQ29kZSA9IChVQ2hhcil2aWRlby0+Y3VyclZvcC0+cmVmU2VsZWN0Q29kZTsKLSAgICB9Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIC8qIERldGVybWluZSBuTGF5ZXIgYW5kIHRpbWVJbmMgZm9yIG5leHQgZW5jb2RlICovCi0gICAgLyogMTIvMjcvMDAgYWx3YXlzIGdvIGJ5IHRoZSBoaWdoZXN0IGxheWVyKi8KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgLyogQ29weSBSZWNvbnN0cnVjdGVkIEJ1ZmZlciB0byBPdXRwdXQgVmlkZW8gRnJhbWUgQnVmZmVyICovCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKio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UgT3VwdXQgYnN0cmVhbSBieXRlIGNvdW50ICovCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0gICAgKnNpemUgPSBjdXJyVm9sLT5zdHJlYW0tPmJ5dGVDb3VudDsKLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIC8qIFN3YXAgVm9wIFBvaW50ZXJzIGZvciBCYXNlIExheWVyICAgICAqLwotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIGlmIChjdXJyTGF5ZXIgPT0gMCkKLSAgICB7Ci0gICAgICAgIHRlbXAgPSB2aWRlby0+cHJldkJhc2VWb3A7Ci0gICAgICAgIHZpZGVvLT5wcmV2QmFzZVZvcCA9IHZpZGVvLT5jdXJyVm9wOwotICAgICAgICB2aWRlby0+cHJldkJhc2VWb3AtPnBhZGRlZCA9IDA7IC8qIG5vdCBwYWRkZWQgKi8KLSAgICAgICAgdmlkZW8tPmN1cnJWb3AgID0gdGVtcDsKLSAgICAgICAgdmlkZW8tPmZvcndhcmRSZWZWb3AgPSB2aWRlby0+cHJldkJhc2VWb3A7IC8qIEZvciBQLVZvcCBiYXNlIG9ubHkgKi8KLSAgICAgICAgdmlkZW8tPmZvcndhcmRSZWZWb3AtPnJlZlNlbGVjdENvZGUgPSAxOwotICAgIH0KLSAgICBlbHNlCi0gICAgewotICAgICAgICB0ZW1wID0gdmlkZW8tPnByZXZFbmhhbmNlVm9wOwotICAgICAgICB2aWRlby0+cHJldkVuaGFuY2VWb3AgPSB2aWRlby0+Y3VyclZvcDsKLSAgICAgICAgdmlkZW8tPnByZXZFbmhhbmNlVm9wLT5wYWRkZWQgPSAwOyAvKiBub3QgcGFkZGVkICovCi0gICAgICAgIHZpZGVvLT5jdXJyVm9wID0gdGVtcDsKLSAgICAgICAgdmlkZW8tPmZvcndhcmRSZWZWb3AgPSB2aWRlby0+cHJldkVuaGFuY2VWb3A7Ci0gICAgICAgIHZpZGVvLT5mb3J3YXJkUmVmVm9wLT5yZWZTZWxlY3RDb2RlID0gMDsKLSAgICB9Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAvKiBNb2RpZnkgdGhlIGludGlhbGl6ZSBmbGFnIGF0IHRoZSBlbmQuKi8KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICBpZiAodmlkZW8tPnZvbEluaXRpYWxpemVbY3VyckxheWVyXSkKLSAgICAgICAgdmlkZW8tPnZvbEluaXRpYWxpemVbY3VyckxheWVyXSA9IDA7Ci0KLSAgICByZXR1cm4gc3RhdHVzOwotfQotCi0jaWZuZGVmIE5PX1NMSUNFX0VOQ09ERQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkVuY29kZUZyYW1lU2V0KCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA0LzE4LzIwMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogRW50ZXIgYSB2aWRlbyBmcmFtZSBhbmQgcGVyZm9ybSBmcm9udC1lbmQgdGltZSBjaGVjayBwbHVzIE1FICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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ZG9tX3ZhbFszMF0gPSB7MCwgMSwgMSwgMSwgMCwgMCwgMSwgMCwgMSwgMCwgMCwgMCwgMSwgMSwgMCwgMCwgMCwgMCwgMSwgMSwgMSwgMSwgMSwgMSwgMCwgMSwgMCwgMSwgMCwgMH07Ci0gICAgc3RhdGljIEludCByYW5kX2lkeCA9IDA7Ci0jZW5kaWYKLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAvKiBEZXRlcm1pbmUgTmV4dCBWb3AgdG8gZW5jb2RlLCBpZiBhbnksIGFuZCBuTGF5ZXIgICAgKi8KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotICAgIHZpZGVvLT5tb2RUaW1lID0gbW9kVGltZTsKLQotICAgIC8vaSA9IG5MYXllcnMtMTsKLQotICAgIGlmICh2aWRlby0+dm9sSW5pdGlhbGl6ZVswXSkgLyogZmlyc3Qgdm9sIHRvIGNvZGUgKi8KLSAgICB7Ci0gICAgICAgIHZpZGVvLT5uZXh0TW9kVGltZSA9IHZpZGVvLT5tb2RUaW1lUmVmID0gKChtb2RUaW1lKSAtICgobW9kVGltZSkgJSAxMDAwKSk7Ci0gICAgfQotCi0KLSAgICBlbmNvZGVWb3AgPSBEZXRlcm1pbmVDb2RpbmdMYXllcih2aWRlbywgbkxheWVyLCBtb2RUaW1lKTsKLQotICAgIGN1cnJMYXllciA9ICpuTGF5ZXI7Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIC8qIElmIHBvc3Qtc2tpcHBpbmcgc3RpbGwgZWZmZWN0aXZlIC0tLSByZXR1cm4gKi8KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0gICAgaWYgKCFlbmNvZGVWb3ApIC8qIHNraXAgZW5oIGxheWVyLCBubyBiYXNlIGxheWVyIGNvZGVkIC0tLSByZXR1cm4gKi8KLSAgICB7Ci0jaWZkZWYgX1BSSU5UX1NUQVQKLSAgICAgICAgcHJpbnRmKCJObyBmcmFtZSBjb2RlZC4gQ29udGludWUgdG8gbmV4dCBmcmFtZS4iKTsKLSNlbmRpZgotICAgICAgICAqbkxheWVyID0gLTE7Ci0KLSAgICAgICAgLyogZXhwZWN0ZWQgbmV4dCBjb2RlIHRpbWUsIGNvbnZlcnQgYmFjayB0byBtaWxsaXNlYyAqLwotICAgICAgICAqbmV4dE1vZFRpbWUgPSB2aWRlby0+bmV4dE1vZFRpbWU7OwotICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgIH0KLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAvKiBJbml0aWFsaXplIFZvbCBzdHJlYW0gc3RydWN0dXJlIHdpdGggYXBwbGljYXRpb24gYml0c3RyZWFtICovCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0gICAgY3VyclZvbCA9IHZpZGVvLT52b2xbY3VyckxheWVyXTsKLSAgICBjdXJyVm9sLT5zdHJlYW0tPmJ1ZmZlclNpemUgPSAwOwotICAgIEJpdHN0cmVhbUVuY1Jlc2V0KGN1cnJWb2wtPnN0cmVhbSk7Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgLyogRW5jb2RlIFZPUyBhbmQgVk9MIEhlYWRlcnMgb24gZmlyc3QgY2FsbCBmb3IgZWFjaCBsYXllciAqLwotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotICAgIGlmICh2aWRlby0+dm9sSW5pdGlhbGl6ZVtjdXJyTGF5ZXJdKQotICAgIHsKLSAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnRpbWVJbmMgPSAwOwotICAgICAgICB2aWRlby0+cHJldkJhc2VWb3AtPnRpbWVJbmMgPSAwOwotICAgIH0KLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgLyogQ29weSBJbnB1dCBWaWRlbyBGcmFtZSB0byBJbnRlcm5hbCBWaWRlbyBCdWZmZXIgKi8KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIC8qIERldGVybWluZSBXaWR0aCBhbmQgSGVpZ2h0IG9mIFZvcCBMYXllciAqLwotCi0gICAgd2lkdGggPSBlbmNQYXJhbXMtPkxheWVyV2lkdGhbY3VyckxheWVyXTsgICAvKiBHZXQgaW5wdXQgd2lkdGggKi8KLSAgICBoZWlnaHQgPSBlbmNQYXJhbXMtPkxheWVySGVpZ2h0W2N1cnJMYXllcl07IC8qIEdldCBpbnB1dCBoZWlnaHQgKi8KLSAgICAvKiBSb3VuZCBVcCB0byBuZWFyZXN0IG11bHRpcGxlIG9mIDE2IDogTVBFRy00IFN0YW5kYXJkICovCi0KLSAgICB3aWR0aF8xNiA9ICgod2lkdGggKyAxNSkgLyAxNikgKiAxNjsgICAgICAgICAgICAvKiBSb3VuZCB1cCB0byBuZWFyZXN0IG11bHRpcGxlIG9mIDE2ICovCi0gICAgaGVpZ2h0XzE2ID0gKChoZWlnaHQgKyAxNSkgLyAxNikgKiAxNjsgICAgICAgICAgLyogUm91bmQgdXAgdG8gbmVhcmVzdCBtdWx0aXBsZSBvZiAxNiAqLwotCi0gICAgdmlkZW8tPmlucHV0ID0gdmlkX2luOyAgLyogcG9pbnQgdG8gdGhlIGZyYW1lIGlucHV0ICovCi0KLSAgICAvKi8vICBFbmQgLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vICovCi0KLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAvKiBEZXRlcm1pbmUgVk9QIFR5cGUgICAgICAgICAgICAgICAgICovCi0gICAgLyogNi8yLzIwMDEsIHNlcGFyYXRlIGZ1bmN0aW9uICAgICAgKi8KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgRGV0ZXJtaW5lVm9wVHlwZSh2aWRlbywgY3VyckxheWVyKTsKLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIC8qICAgIEluaXRpYWxpemUgVk9QICAgICAgICAqLwotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIHZpZGVvLT5jdXJyVm9wLT52b2xJRCA9IGN1cnJWb2wtPnZvbElEOwotICAgIHZpZGVvLT5jdXJyVm9wLT53aWR0aCA9IHdpZHRoXzE2OwotICAgIHZpZGVvLT5jdXJyVm9wLT5oZWlnaHQgPSBoZWlnaHRfMTY7Ci0gICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPkgyNjNfRW5hYmxlZCkgLyogIDExLzI4LzA1ICovCi0gICAgewotICAgICAgICB2aWRlby0+Y3VyclZvcC0+cGl0Y2ggPSB3aWR0aF8xNjsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnBpdGNoID0gd2lkdGhfMTYgKyAzMjsKLSAgICB9Ci0gICAgdmlkZW8tPmN1cnJWb3AtPnRpbWVJbmMgPSBjdXJyVm9sLT50aW1lSW5jcmVtZW50OwotICAgIHZpZGVvLT5jdXJyVm9wLT52b3BDb2RlZCA9IDE7Ci0gICAgdmlkZW8tPmN1cnJWb3AtPnJvdW5kaW5nVHlwZSA9IDA7Ci0gICAgdmlkZW8tPmN1cnJWb3AtPmludHJhRENWbGNUaHIgPSBlbmNQYXJhbXMtPkludHJhRENWbGNUaHI7Ci0KLSAgICBpZiAoY3VyckxheWVyID09IDAKLSNpZmRl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kiLCB2aWRlby0+Zm9yd2FyZFJlZlZvcC0+cmVmU2VsZWN0Q29kZSk7Ci0jZW5kaWYKLQotICAgIC8qIFNldCBIaW50VHJhY2sgSW5mb3JtYXRpb24gKi8KLSAgICBpZiAoY3VyclZvbC0+cHJldk1vZHVsb1RpbWVCYXNlKQotICAgICAgICB2aWRlby0+aGludFRyYWNrSW5mby5NVEIgPSAxOwotICAgIGVsc2UKLSAgICAgICAgdmlkZW8tPmhpbnRUcmFja0luZm8uTVRCID0gMDsKLQotICAgIHZpZGVvLT5oaW50VHJhY2tJbmZvLkxheWVySUQgPSAoVUNoYXIpY3VyclZvbC0+dm9sSUQ7Ci0gICAgdmlkZW8tPmhpbnRUcmFja0luZm8uQ29kZVR5cGUgPSAoVUNoYXIpdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlOwotICAgIHZpZGVvLT5oaW50VHJhY2tJbmZvLlJlZlNlbENvZGUgPSAoVUNoYXIpdmlkZW8tPmN1cnJWb3AtPnJlZlNlbGVjdENvZGU7Ci0KLSAgICByZXR1cm4gc3RhdHVzOwotfQotI2VuZGlmIC8qIE5PX1NMSUNFX0VOQ09ERSAqLwotCi0jaWZuZGVmIE5PX1NMSUNFX0VOQ09ERQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkVuY29kZVBhY2tldCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA0LzE4LzIwMDIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogRW5jb2RlIG9uZSBwYWNrZXQgYW5kIHJldHVybiBiaXRzdHJlYW0gICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotT1NDTF9FWFBPUlRfUkVGIEJvb2wgUFZFbmNvZGVTbGljZShWaWRlb0VuY0NvbnRyb2xzICplbmNDdHJsLCBVQ2hhciAqYnN0cmVhbSwgSW50ICpzaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJbnQgKmVuZG9mRnJhbWUsIFZpZGVvRW5jRnJhbWVJTyAqdmlkX291dCwgVUxvbmcgKm5leHRNb2RUaW1lKQotewotICAgIFBWX1NUQVRVUyBwdl9zdGF0dXM7Ci0gICAgVmlkZW9FbmNEYXRhICp2aWRlbyA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOwotICAgIFZpZGVvRW5jUGFyYW1zICplbmNQYXJhbXMgPSB2aWRlby0+ZW5jUGFyYW1zOwotICAgIFZvbCAqY3VyclZvbDsKLSAgICBQVl9TVEFUVVMgICBFbmNvZGVWT1NfU3RhcnQoVmlkZW9FbmNDb250cm9scyAqZW5jQ3RybCk7Ci0gICAgVm9wICp0ZW1wOwotICAgIHZvaWQgIFBhZGRpbmdFZGdlKFZvcCAqcGFkVm9wKTsKLSAgICBJbnQgY3VyckxheWVyID0gdmlkZW8tPmN1cnJMYXllcjsKLSAgICBJbnQgcHJlX3NraXA7Ci0gICAgSW50IHByZV9zaXplOwotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAvKiBJbml0aWFsaXplIFZvbCBzdHJlYW0gc3RydWN0dXJlIHdpdGggYXBwbGljYXRpb24gYml0c3RyZWFtICovCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0gICAgY3VyclZvbCA9IHZpZGVvLT52b2xbY3VyckxheWVyXTsKLSAgICBjdXJyVm9sLT5zdHJlYW0tPmJpdHN0cmVhbUJ1ZmZlciA9IGJzdHJlYW07Ci0gICAgcHJlX3NpemUgPSBjdXJyVm9sLT5zdHJlYW0tPmJ5dGVDb3VudDsKLSAgICBjdXJyVm9sLT5zdHJlYW0tPmJ1ZmZlclNpemUgPSBwcmVfc2l6ZSArICgqc2l6ZSk7Ci0KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgLyogRW5jb2RlIFZPUyBhbmQgVk9MIEhlYWRlcnMgb24gZmlyc3QgY2FsbCBmb3IgZWFjaCBsYXllciAqLwotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLQotICAgIGlmICh2aWRlby0+dm9sSW5pdGlhbGl6ZVtjdXJyTGF5ZXJdKQotICAgIHsKLSAgICAgICAgaWYgKCF2aWRlby0+ZW5jUGFyYW1zLT5HZXRWb2xIZWFkZXJbY3VyckxheWVyXSkKLSAgICAgICAgICAgIHB2X3N0YXR1cyA9IEVuY29kZVZPU19TdGFydChlbmNDdHJsKTsKLSAgICB9Ci0KLSAgICAvKioqKioqKioqKioqKioqKi8KLSAgICAvKiBFbmNvZGUgU2xpY2UgKi8KLSAgICAvKioqKioqKioqKioqKioqKi8KLSAgICBwdl9zdGF0dXMgPSBFbmNvZGVTbGljZSh2aWRlbyk7Ci0KLSAgICAqZW5kb2ZGcmFtZSA9IDA7Ci0KLSAgICBpZiAodmlkZW8tPm1ibnVtID49IGN1cnJWb2wtPm5Ub3RhbE1CICYmICF2aWRlby0+ZW5kX29mX2J1ZikKLSAgICB7Ci0gICAgICAgICplbmRvZkZyYW1lID0gMTsKLQotICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAvKiBVcGRhdGUgU2tpcCBOZXh0IEZyYW1lICAgICAgICAgICAqLwotICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICBwcmVfc2tpcCA9IFVwZGF0ZVNraXBOZXh0RnJhbWUodmlkZW8sIG5leHRNb2RUaW1lLCBzaXplLCBwdl9zdGF0dXMpOyAvKiBtb2RpZmllZCBzdWNoIHRoYXQgbm8gcHJlLXNraXBwZWQgKi8KLQotICAgICAgICBpZiAocHJlX3NraXAgPT0gLTEpIC8qIGVycm9yICovCi0gICAgICAgIHsKLSAgICAgICAgICAgICplbmRvZkZyYW1lID0gLTE7Ci0gICAgICAgICAgICAvKiBtYWtlIHN1cmUgdGhhdCBwb2ludGVycyBhcmUgcmVzdG9yZWQgdG8gdGhlIHByZXZpb3VzIHN0YXRlICovCi0gICAgICAgICAgICBpZiAoY3VyckxheWVyID09IDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgdmlkZW8tPmZvcndhcmRSZWZWb3AgPSB2aWRlby0+dGVtcEZvcndSZWZWb3A7IC8qIEZvciBQLVZvcCBiYXNlIG9ubHkgKi8KLSAgICAgICAgICAgICAgICB2aWRlby0+Zm9yd2FyZFJlZlZvcC0+cmVmU2VsZWN0Q29kZSA9IHZpZGVvLT50ZW1wUmVmU2VsQ29kZTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgcmV0dXJuIHB2X3N0YXR1czsKLSAgICAgICAgfQotCi0gICAgICAgIC8qIElmIEktVk9QIHdhcyBlbmNvZGVkLCByZXNldCBJbnRyYVBlcmlvZCAqLwotICAgICAgICBpZiAoKGN1cnJMYXllciA9PSAwKSAmJiAoZW5jUGFyYW1zLT5JbnRyYVBlcmlvZCA+IDApICYmICh2aWRlby0+Y3VyclZvcC0+cHJlZGljdGlvblR5cGUgPT0gSV9WT1ApKQotICAgICAgICAgICAgdmlkZW8tPm5leHRFbmNJVm9wID0gZW5jUGFyYW1zLT5JbnRyYVBlcmlvZDsKLQotICAgICAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgLyogQ29weSBSZWNvbnN0cnVjdGVkIEJ1ZmZlciB0byBPdXRwdXQgVmlkZW8gRnJhbWUgQnVmZmVyICovCi0gICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICB2aWRfb3V0LT55Q2hhbiA9IHZpZGVvLT5jdXJyVm9wLT55Q2hhbjsKLSAgICAgICAgdmlkX291dC0+dUNoYW4gPSB2aWRlby0+Y3VyclZvcC0+dUNoYW47Ci0gICAgICAgIHZpZF9vdXQtPnZDaGFuID0gdmlkZW8tPmN1cnJWb3AtPnZDaGFuOwotICAgICAgICBpZiAodmlkZW8tPmVuY1BhcmFtcy0+SDI2M19FbmFibGVkKQotICAgICAgICB7Ci0gICAgICAgICAgICB2aWRfb3V0LT5oZWlnaHQgPSB2aWRlby0+Y3VyclZvcC0+aGVpZ2h0OyAvKiBwYWRkZWQgaGVpZ2h0ICovCi0gICAgICAgICAgICB2aWRfb3V0LT5waXRjaCA9IHZpZGVvLT5jdXJyVm9wLT53aWR0aDsgLyogcGFkZGVkIHdpZHRoICovCi0gICAgICAgIH0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICB2aWRfb3V0LT5oZWlnaH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Jhc2Ugb25seSAqLwotICAgICAgICAgICAgdmlkZW8tPmZvcndhcmRSZWZWb3AtPnJlZlNlbGVjdENvZGUgPSAxOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgdGVtcCA9IHZpZGVvLT5wcmV2RW5oYW5jZVZvcDsKLSAgICAgICAgICAgIHZpZGVvLT5wcmV2RW5oYW5jZVZvcCA9IHZpZGVvLT5jdXJyVm9wOwotICAgICAgICAgICAgdmlkZW8tPnByZXZFbmhhbmNlVm9wLT5wYWRkZWQgPSAwOyAvKiBub3QgcGFkZGVkICovCi0gICAgICAgICAgICB2aWRlby0+Y3VyclZvcCA9IHRlbXA7Ci0gICAgICAgICAgICB2aWRlby0+Zm9yd2FyZFJlZlZvcCA9IHZpZGVvLT5wcmV2RW5oYW5jZVZvcDsKLSAgICAgICAgICAgIHZpZGVvLT5mb3J3YXJkUmVmVm9wLT5yZWZTZWxlY3RDb2RlID0gMDsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAvKiBVcGRhdGUgT3VwdXQgYnN0cmVhbSBieXRlIGNvdW50ICovCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotCi0gICAgKnNpemUgPSBjdXJyVm9sLT5zdHJlYW0tPmJ5dGVDb3VudCAtIHByZV9zaXplOwotCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgLyogTW9kaWZ5IHRoZSBpbnRpYWxpemUgZmxhZyBhdCB0aGUgZW5kLiovCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgaWYgKHZpZGVvLT52b2xJbml0aWFsaXplW2N1cnJMYXllcl0pCi0gICAgICAgIHZpZGVvLT52b2xJbml0aWFsaXplW2N1cnJMYXllcl0gPSAwOwotCi0gICAgcmV0dXJuIHB2X3N0YXR1czsKLX0KLSNlbmRpZiAvKiBOT19TTElDRV9FTkNPREUgKi8KLQotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWR2V0SDI2M1Byb2ZpbGVMZXZlbElEKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMDIvMDUvMjAwMyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiBHZXQgSC4yNjMgUHJvZmlsZSBJRCBhbmQgbGV2ZWwgSUQgZm9yIHByb2ZpbGUgMCAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6IFByb2ZpbGUgSUQ9MCwgbGV2ZWxJRCBpcyB3aGF0IHdlIHdhbnQgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBOb3RlICAgICA6IGgyNjNMZXZlbFs4XSwgckJSX2JvdW5kWzhdLCBtYXhfaDI2M19mcmFtZXJhdGVbMl0gICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgbWF4X2gyNjNfd2lkdGhbMl0sIG1heF9oMjYzX2hlaWdodFsyXSBhcmUgZ2xvYmFsICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09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VuZFsyXSAmJgotICAgICAgICAgICAgICAgICgod2lkdGggPD0gbWF4X2gyNjNfd2lkdGhbMF0gJiYgaGVpZ2h0IDw9IG1heF9oMjYzX2hlaWdodFswXSAmJiBmcmFtZXJhdGUgPD0gbWF4X2gyNjNfZnJhbWVyYXRlWzFdKSB8fAotICAgICAgICAgICAgICAgICAod2lkdGggPD0gbWF4X2gyNjNfd2lkdGhbMV0gJiYgaGVpZ2h0IDw9IG1heF9oMjYzX2hlaWdodFsxXSAmJiBmcmFtZXJhdGUgPD0gbWF4X2gyNjNfZnJhbWVyYXRlWzBdKSkpCi0gICAgICAgIHsKLSAgICAgICAgICAgICpsZXZlbElEID0gaDI2M0xldmVsWzJdOwotICAgICAgICAgICAgcmV0dXJuIFBWX1RSVUU7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZSAgIC8qIHdpZHRoLCBoZWlnaHQgYW5kIGZyYW1lcmF0ZSBhcmUgb2ssIG5vdyBjaG9vc2UgbGV2ZWwgMzAgb3IgNDAgKi8KLSAgICAgICAgewotICAgICAgICAgICAgKmxldmVsSUQgPSAoYml0cmF0ZV9yIDw9IHJCUl9ib3VuZFszXSA/IGgyNjNMZXZlbFszXSA6IGgyNjNMZXZlbFs0XSk7Ci0gICAgICAgICAgICByZXR1cm4gUFZfVFJVRTsKLSAgICAgICAgfQotICAgIH0KLX0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBQVkdldE1QRUc0UHJvZmlsZUxldmVsSUQoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDI2LzA2LzIwMDggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogR2V0IE1QRUc0IExldmVsIGFmdGVyIGluaXRpYWxpemVkICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiBwcm9maWxlX2xldmVsIGFjY29yZGluZyB0byBpbnRlcmZhY2UgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotT1NDTF9FWFBPUlRfUkVGIEJvb2wgUFZHZXRNUEVHNFByb2ZpbGVMZXZlbElEKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwsIEludCAqcHJvZmlsZV9sZXZlbCwgSW50IG5MYXllcikKLXsKLSAgICBWaWRlb0VuY0RhdGEqIHZpZGVvOwotICAgIEludCBpOwotCi0gICAgdmlkZW8gPSAoVmlkZW9FbmNEYXRhICopZW5jQ3RybC0+dmlkZW9FbmNvZGVyRGF0YTsKLQotICAgIGlmIChuTGF5ZXIgPT0gMCkKLSAgICB7Ci0gICAgICAgIGZvciAoaSA9IDA7IGkgPCA4OyBpKyspCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmICh2aWRlby0+ZW5jUGFyYW1zLT5Qcm9maWxlTGV2ZWxbMF0gPT0gcHJvZmlsZV9sZXZlbF9jb2RlW2ldKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgICpwcm9maWxlX2xldmVsID0gaTsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKLSAgICAgICAgZm9yIChpID0gMDsgaSA8IDg7IGkrKykKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKHZpZGVvLT5lbmNQYXJhbXMtPlByb2ZpbGVMZXZlbFswXSA9PSBzY2FsYWJsZV9wcm9maWxlX2xldmVsX2NvZGVbaV0pCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgKnByb2ZpbGVfbGV2ZWwgPSBpICsgU0lNUExFX1NDQUxBQkxFX1BST0ZJTEVfTEVWRUwwOwotICAgIH0KLQotICAgIHJldHVybiB0cnVlOwotfQotCi0jaWZuZGVmIExJTUlURURfQVBJCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWVXBkYXRlRW5jRnJhbWVSYXRlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMDQvMDgvMjAwMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiBVcGRhdGUgdGFyZ2V0IGZyYW1lIHJhdGVzIG9mIHRoZSBlbmNvZGVkIGJhc2UgYW5kIGVuaGFuY2UgICAgKi8KLS8qICAgICAgICAgICAgIGxheWVyKGlmIGFueSkgd2hpbGUgZW5jb2Rpbmcgb3BlcmF0aW9uIGlzIG9uZ29pbmcgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLQotT1NDTF9FWFBPUlRfUkVGIEJvb2wgUFZVcGRhdGVFbmNGcmFtZVJhdGUoVmlkZW9FbmNDb250cm9scyAqZW5jQ3RybCwgZmxvYXQgKmZyYW1lUmF0ZSkKLXsKLSAgICBWaWRlb0VuY0RhdGEgICAgKmVuY0RhdGE7Ci0gICAgSW50IGk7Ly8gblRvdGFsTUIsIG1iUGVyU2VjOwotCi0gICAgZW5jRGF0YSA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOwotCi0gICAgaWYgKGVuY0RhdGEgPT0gTlVMTCkKLSAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOwotICAgIGlmIChlbmNEYXRhLT5lbmNQYXJhbXMgPT0gTlVMTCkKLSAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOwotCi0gICAgLyogVXBkYXRlIHRoZSBmcmFtZXJhdGVzIGZvciBhbGwgdGhlIGxheWVycyAqLwotICAgIGZvciAoaSA9IDA7IGkgPCBlbmNEYXRhLT5lbmNQYXJhbXMtPm5MYXllcnM7IGkrKykKLSAgICB7Ci0KLSAgICAgICAgLyogTmV3IGNoZWNrOiBlbmNvZGluZyBmcmFtZXJhdGUgc2hvdWxkIGJlIGNvbnNpc3RlbnQgd2l0aCB0aGUgZ2l2ZW4gcHJvZmlsZSBhbmQgbGV2ZWwgKi8KLSAgICAgICAgLy9uVG90YWxNQiA9ICgoKGVuY0RhdGEtPmVuY1BhcmFtcy0+TGF5ZXJXaWR0aFtpXSsxNSkvMTYpKjE2KSooKChlbmNEYXRhLT5lbmNQYXJhbXMtPkxheWVySGVpZ2h0W2ldKzE1KS8xNikqMTYpLygxNioxNik7Ci0gICAgICAgIC8vbWJQZXJTZWMgPSAoSW50KShuVG90YWxNQiAqIGZyYW1lUmF0ZVtpXSk7Ci0gICAgICAgIC8vaWYobWJQZXJTZWMgPiBlbmNEYXRhLT5lbmNQYXJhbXMtPkxheWVyTWF4TWJzUGVyU2VjW2ldKSByZXR1cm4gUFZfRkFMU0U7Ci0gICAgICAgIGlmIChmcmFtZVJhdGVbaV0gPiBlbmNEYXRhLT5lbmNQYXJhbXMtPkxheWVyTWF4RnJhbWVSYXRlW2ldKSByZXR1cm4gUFZfRkFMU0U7IC8qIHNldCBieSB1c2VycyBvciBwcm9maWxlICovCi0KLSAgICAgICAgZW5jRGF0YS0+ZW5jUGFyYW1zLT5MYXllckZyYW1lUmF0ZVtpXSA9IGZyYW1lUmF0ZVtpXTsKLSAgICB9Ci0KLSAgICByZXR1cm4gUkNfVXBkYXRlQlhSQ1BhcmFtcygodm9pZCopIGVuY0RhdGEpOwotCi19Ci0jZW5kaWYKLSNpZm5kZWYgTElNSVRFRF9BUEkKLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZVcGRhdGVCaXRSYXRlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwNC8wOC8yMDAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IFVwZGF0ZSB0YXJnZXQgYml0IHJhdGVzIG9mIHRoZSBlbmNvZGVkIGJhc2UgYW5kIGVuaGFuY2UgICAgICAqLwotLyogICAgICAgICAgICAgbGF5ZXIoaWYgYW55KSB3aGlsZSBlbmNvZGluZyBvcGVyYXRpb24gaXMgb25nb2luZyAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IFBWX1RSVUUgaWYgc3VjY2Vzc2VkLCBQVl9GQUxTRSBpZiBmYWlsZWQuICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotCi1PU0NMX0VYUE9SVF9SRUYgQm9vbCBQVlVwZGF0ZUJpdFJhdGUoVmlkZW9FbmNDb250cm9scyAqZW5jQ3RybCwgSW50ICpiaXRSYXRlKQotewotICAgIFZpZGVvRW5jRGF0YSAgICAqZW5jRGF0YTsKLSAgICBJbnQgaTsKLQotICAgIGVuY0RhdGEgPSAoVmlkZW9FbmNEYXRhICopZW5jQ3RybC0+dmlkZW9FbmNvZGVyRGF0YTsKLQotICAgIGlmIChlbmNEYXRhID09IE5VTEwpCi0gICAgICAgIHJldHVybiBQVl9GQUxTRTsKLSAgICBpZiAoZW5jRGF0YS0+ZW5jUGFyYW1zID09IE5VTEwpCi0gICAgICAgIHJldHVybiBQVl9GQUxTRTsKLQotICAgIC8qIFVwZGF0ZSB0aGUgYml0cmF0ZXMgZm9yIGFsbCB0aGUgbGF5ZXJzICovCi0gICAgZm9yIChpID0gMDsgaSA8IGVuY0RhdGEtPmVuY1BhcmFtcy0+bkxheWVyczsgaSsrKQotICAgIHsKLSAgICAgICAgaWYgKGJpdFJhdGVbaV0gPiBlbmNEYXRhLT5lbmNQYXJhbXMtPkxheWVyTWF4Qml0UmF0ZVtpXSkgLyogc2V0IGJ5IHVzZXJzIG9yIHByb2ZpbGUgKi8KLSAgICAgICAgewotICAgICAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOwotICAgICAgICB9Ci0gICAgICAgIGVuY0RhdGEtPmVuY1BhcmFtcy0+TGF5ZXJCaXRSYXRlW2ldID0gYml0UmF0ZVtpXTsKLSAgICB9Ci0KLSAgICByZXR1cm4gUkNfVXBkYXRlQlhSQ1BhcmFtcygodm9pZCopIGVuY0RhdGEpOwotCi19Ci0jZW5kaWYKLSNpZm5kZWYgTElNSVRFRF9BUEkKLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWVXBkYXRlVkJWRGVsYXkoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiA0LzIzLzIwMDQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiBVcGRhdGUgVkJWIGJ1ZmZlciBzaXplKGluIGRlbGF5KSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0KLUJvb2wgUFZVcGRhdGVWQlZEZWxheShWaWRlb0VuY0NvbnRyb2xzICplbmNDdHJsLCBmbG9hdCBkZWxheSkKLXsKLQotICAgIFZpZGVvRW5jRGF0YSAgICAqZW5jRGF0YTsKLSAgICBJbnQgdG90YWxfYml0cmF0ZSwgbWF4X2J1ZmZlcl9zaXplOwotICAgIGludCBpbmRleDsKLQotICAgIGVuY0RhdGEgPSAoVmlkZW9FbmNEYXRhICopZW5jQ3RybC0+dmlkZW9FbmNvZGVyRGF0YTsKLQotICAgIGlmIChlbmNEYXRhID09IE5VTEwpCi0gICAgICAgIHJldHVybiBQVl9GQUxTRTsKLSAgICBpZiAoZW5jRGF0YS0+ZW5jUGFyYW1zID09IE5VTEwpCi0gICAgICAgIHJldHVybiBQVl9GQUxTRTsKLQotICAgIC8qIENoZWNrIHdoZXRoZXIgdGhlIGlucHV0IGRlbGF5IGlzIHZhbGlkIGJhc2VkIG9uIHRoZSBnaXZlbiBwcm9maWxlICovCi0gICAgdG90YWxfYml0cmF0ZSAgID0gKGVuY0RhdGEtPmVuY1BhcmFtcy0+bkxheWVycyA9PSAxID8gZW5jRGF0YS0+ZW5jUGFyYW1zLT5MYXllckJpdFJhdGVbMF0gOgotICAgICAgICAgICAgICAgICAgICAgICBlbmNEYXRhLT5lbmNQYXJhbXMtPkxheWVyQml0UmF0ZVsxXSk7Ci0gICAgaW5kZXggPSBlbmNEYXRhLT5lbmNQYXJhbXMtPnByb2ZpbGVfdGFibGVfaW5kZXg7Ci0gICAgbWF4X2J1ZmZlcl9zaXplID0gKGVuY0RhdGEtPmVuY1BhcmFtcy0+bkxheWVycyA9PSAxID8gcHJvZmlsZV9sZXZlbF9tYXhfVkJWX3NpemVbaW5kZXhdIDoKLSAgICAgICAgICAgICAgICAgICAgICAgc2NhbGFibGVfcHJvZmlsZV9sZXZlbF9tYXhfVkJWX3NpemVbaW5kZXhdKTsKLQotICAgIGlmICh0b3RhbF9iaXRyYXRlKmRlbGF5ID4gKGZsb2F0KW1heF9idWZmZXJfc2l6ZSkKLSAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOwotCi0gICAgZW5jRGF0YS0+ZW5jUGFyYW1zLT5WQlZfZGVsYXkgPSBkZWxheTsKLSAgICByZXR1cm4gUFZfVFJVRTsKLQotfQotI2VuZGlmCi0jaWZuZGVmIExJTUlURURfQVBJCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWVXBkYXRlSUZyYW1lSW50ZXJ2YWwoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA0LzEwLzIwMDIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogdXBkYXRlcyB0aGUgSU5UUkEgZnJhbWUgcmVmcmVzaCBpbnRlcnZhbCB3aGlsZSBlbmNvZGluZyAgICAgICovCi0vKiAgICAgICAgICAgICBpcyBvbmdvaW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0KLU9TQ0xfRVhQT1JUX1JFRiBCb29sIFBWVXBkYXRlSUZyYW1lSW50ZXJ2YWwoVmlkZW9FbmNDb250cm9scyAqZW5jQ3RybCwgSW50IGFJRnJhbWVQZXJpb2QpCi17Ci0gICAgVmlkZW9FbmNEYXRhICAgICplbmNEYXRhOwotCi0gICAgZW5jRGF0YSA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOwotCi0gICAgaWYgKGVuY0RhdGEgPT0gTlVMTCkKLSAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOwotICAgIGlmIChlbmNEYXRhLT5lbmNQYXJhbXMgPT0gTlVMTCkKLSAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOwotCi0gICAgZW5jRGF0YS0+ZW5jUGFyYW1zLT5JbnRyYVBlcmlvZCA9IGFJRnJhbWVQZXJpb2Q7Ci0gICAgcmV0dXJuIFBWX1RSVUU7Ci19Ci0jZW5kaWYKLSNpZm5kZWYgTElNSVRFRF9BUEkKLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZTZXROdW1JbnRyYU1CUmVmcmVzaCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwOC8wNS8yMDAzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLU9TQ0xfRVhQT1JUX1JFRiBCb29sICAgIFBWVXBkYXRlTnVtSW50cmFNQlJlZnJlc2goVmlkZW9FbmNDb250cm9scyAqZW5jQ3RybCwgSW50IG51bU1CKQotewotICAgIFZpZGVvRW5jRGF0YSAgICAqZW5jRGF0YTsKLQotICAgIGVuY0RhdGEgPSAoVmlkZW9FbmNEYXRhICopZW5jQ3RybC0+dmlkZW9FbmNvZGVyRGF0YTsKLQotICAgIGlmIChlbmNEYXRhID09IE5VTEwpCi0gICAgICAgIHJldHVybiBQVl9GQUxTRTsKLQotICAgIGVuY0RhdGEtPmVuY1BhcmFtcy0+UmVmcmVzaCA9IG51bU1COwotCi0gICAgcmV0dXJuIFBWX1RSVUU7Ci19Ci0jZW5kaWYKLSNpZm5kZWYgTElNSVRFRF9BUEkKLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZJRnJhbWVSZXF1ZXN0KCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwNC8xMC8yMDAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IGVuY29kZXMgdGhlIG5leHQgYmFzZSBmcmFtZSBhcyBhbiBJLVZvcCAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLQotT1NDTF9FWFBPUlRfUkVGIEJvb2wgUFZJRnJhbWVSZXF1ZXN0KFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwpCi17Ci0gICAgVmlkZW9FbmNEYXRhICAgICplbmNEYXRhOwotCi0gICAgZW5jRGF0YSA9IChWaWRlb0VuY0RhdGEgKillbmNDdHJsLT52aWRlb0VuY29kZXJEYXRhOwotCi0gICAgaWYgKGVuY0RhdGEgPT0gTlVMTCkKLSAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOwotICAgIGlmIChlbmNEYXRhLT5lbmNQYXJhbXMgPT0gTlVMTCkKLSAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOwotCi0gICAgZW5jRGF0YS0+bmV4dEVuY0lWb3AgPSAxOwotICAgIHJldHVybiBQVl9UUlVFOwotfQotI2VuZGlmCi0jaWZuZGVmIExJTUlURURfQVBJCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWR2V0RW5jTWVtb3J5VXNhZ2UoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMTAvMTcvMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0KLU9TQ0xfRVhQT1JUX1JFRiBJbnQgUFZHZXRFbmNNZW1vcnlVc2FnZShWaWRlb0VuY0NvbnRyb2xzICplbmNDdHJsKQotewotICAgIFZpZGVvRW5jRGF0YSAgICAqZW5jRGF0YTsKLQotICAgIGVuY0RhdGEgPSAoVmlkZW9FbmNEYXRhICopZW5jQ3RybC0+dmlkZW9FbmNvZGVyRGF0YTsKLQotICAgIGlmIChlbmNEYXRhID09IE5VTEwpCi0gICAgICAgIHJldHVybiBQVl9GQUxTRTsKLSAgICBpZiAoZW5jRGF0YS0+ZW5jUGFyYW1zID09IE5VTEwpCi0gICAgICAgIHJldHVybiBQVl9GQUxTRTsKLSAgICByZXR1cm4gZW5jRGF0YS0+ZW5jUGFyYW1zLT5NZW1vcnlVc2FnZTsKLX0KLSNlbmRpZgotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWR2V0SGludFRyYWNrKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMS8xNy8yMDAxLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0KLU9TQ0xfRVhQT1JUX1JFRiBCb29sIFBWR2V0SGludFRyYWNrKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwsIE1QNEhpbnRUcmFjayAqaW5mbykKLXsKLSAgICBWaWRlb0VuY0RhdGEgICAgKmVuY0RhdGE7Ci0KLSAgICBlbmNEYXRhID0gKFZpZGVvRW5jRGF0YSAqKWVuY0N0cmwtPnZpZGVvRW5jb2RlckRhdGE7Ci0KLSAgICBpZiAoZW5jRGF0YSA9PSBOVUxMKQotICAgICAgICByZXR1cm4gUFZfRkFMU0U7Ci0gICAgaWYgKGVuY0RhdGEtPmVuY1BhcmFtcyA9PSBOVUxMKQotICAgICAgICByZXR1cm4gUFZfRkFMU0U7Ci0gICAgaW5mby0+TVRCID0gZW5jRGF0YS0+aGludFRyYWNrSW5mby5NVEI7Ci0gICAgaW5mby0+TGF5ZXJJRCA9IGVuY0RhdGEtPmhpbnRUcmFja0luZm8uTGF5ZXJJRDsKLSAgICBpbmZvLT5Db2RlVHlwZSA9IGVuY0RhdGEtPmhpbnRUcmFja0luZm8uQ29kZVR5cGU7Ci0gICAgaW5mby0+UmVmU2VsQ29kZSA9IGVuY0RhdGEtPmhpbnRUcmFja0luZm8uUmVmU2VsQ29kZTsKLQotICAgIHJldHVybiBQVl9UUlVFOwotfQotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFBWR2V0TWF4VmlkZW9GcmFtZVNpemUoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogNy8xNy8yMDAxLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiBGdW5jdGlvbiBtZXJlbHkgcmV0dXJucyB0aGUgbWF4aW11bSBidWZmZXIgc2l6ZSAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogUFZfVFJVRSBpZiBzdWNjZXNzZWQsIFBWX0ZBTFNFIGlmIGZhaWxlZC4gICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0KLU9TQ0xfRVhQT1JUX1JFRiBCb29sIFBWR2V0TWF4VmlkZW9GcmFtZVNpemUoVmlkZW9FbmNDb250cm9scyAqZW5jQ3RybCwgSW50ICptYXhWaWRlb0ZyYW1lU2l6ZSkKLXsKLSAgICBWaWRlb0VuY0RhdGEgICAgKmVuY0RhdGE7Ci0KLSAgICBlbmNEYXRhID0gKFZpZGVvRW5jRGF0YSAqKWVuY0N0cmwtPnZpZGVvRW5jb2RlckRhdGE7Ci0KLSAgICBpZiAoZW5jRGF0YSA9PSBOVUxMKQotICAgICAgICByZXR1cm4gUFZfRkFMU0U7Ci0gICAgaWYgKGVuY0RhdGEtPmVuY1BhcmFtcyA9PSBOVUxMKQotICAgICAgICByZXR1cm4gUFZfRkFMU0U7Ci0KLQotCi0gICAgKm1heFZpZGVvRnJhbWVTaXplID0gZW5jRGF0YS0+ZW5jUGFyYW1zLT5CdWZmZXJTaXplWzBdOwotCi0gICAgaWYgKGVuY0RhdGEtPmVuY1BhcmFtcy0+bkxheWVycyA9PSAyKQotICAgICAgICBpZiAoKm1heFZpZGVvRnJhbWVTaXplIDwgZW5jRGF0YS0+ZW5jUGFyYW1zLT5CdWZmZXJTaXplWzFdKQotICAgICAgICAgICAgKm1heFZpZGVvRnJhbWVTaXplID0gZW5jRGF0YS0+ZW5jUGFyYW1zLT5CdWZmZXJTaXplWzFdOwotICAgICptYXhWaWRlb0ZyYW1lU2l6ZSA+Pj0gMzsgICAvKiBDb252ZXJ0IHRvIEJ5dGVzICovCi0KLSAgICBpZiAoKm1heFZpZGVvRnJhbWVTaXplIDw9IDQwMDApCi0gICAgICAgICptYXhWaWRlb0ZyYW1lU2l6ZSA9IDQwMDA7Ci0KLSAgICByZXR1cm4gUFZfVFJVRTsKLX0KLSNpZm5kZWYgTElNSVRFRF9BUEkKLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogUFZHZXRWQlZTaXplKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiA0LzE1LzIwMDIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IEZ1bmN0aW9uIG1lcmVseSByZXR1cm5zIHRoZSBtYXhpbXVtIGJ1ZmZlciBzaXplICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLQotT1NDTF9FWFBPUlRfUkVGIEJvb2wgUFZHZXRWQlZTaXplKFZpZGVvRW5jQ29udHJvbHMgKmVuY0N0cmwsIEludCAqVkJWU2l6ZSkKLXsKLSAgICBWaWRlb0VuY0RhdGEgICAgKmVuY0RhdGE7Ci0KLSAgICBlbmNEYXRhID0gKFZpZGVvRW5jRGF0YSAqKWVuY0N0cmwtPnZpZGVvRW5jb2RlckRhdGE7Ci0KLSAgICBpZiAoZW5jRGF0YSA9PSBOVUxMKQotICAgICAgICByZXR1cm4gUFZfRkFMU0U7Ci0gICAgaWYgKGVuY0RhdGEtPmVuY1BhcmFtcyA9PSBOVUxMKQotICAgICAgICByZXR1cm4gUFZfRkFMU0U7Ci0KLSAgICAqVkJWU2l6ZSA9IGVuY0RhdGEtPmVuY1BhcmFtcy0+QnVmZmVyU2l6ZVswXTsKLSAgICBpZiAoZW5jRGF0YS0+ZW5jUGFyYW1zLT5uTGF5ZXJzID09IDIpCi0gICAgICAgICpWQlZTaXplICs9IGVuY0RhdGEtPmVuY1BhcmFtcy0+QnVmZmVyU2l6ZVsxXTsKLQotICAgIHJldHVybiBQVl9UUlVFOwotCi19Ci0jZW5kaWYKLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogRW5jb2RlVk9TX1N0YXJ0KCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwOC8yMi8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IEVuY29kZXMgdGhlIFZPUyxWTywgYW5kIFZPTCBvciBTaG9ydCBIZWFkZXJzICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLVBWX1NUQVRVUyBFbmNvZGVWT1NfU3RhcnQoVmlkZW9FbmNDb250cm9scyAqZW5jb2RlckNvbnRyb2wpCi17Ci0KLSAgICBWaWRlb0VuY0RhdGEgKnZpZGVvID0gKFZpZGVvRW5jRGF0YSAqKWVuY29kZXJDb250cm9sLT52aWRlb0VuY29kZXJEYXRhOwotICAgIFZvbCAgICAgICAgICpjdXJyVm9sID0gdmlkZW8tPnZvbFt2aWRlby0+Y3VyckxheWVyXTsKLSAgICBQVl9TVEFUVVMgc3RhdHVzID0gUFZfU1VDQ0VTUzsKLSAgICAvL2ludCBwcm9maWxlX2xldmVsPTB4MDE7Ci0gICAgQml0c3RyZWFtRW5jVmlkZW8gKnN0cmVhbSA9IHZpZGVvLT5iaXRzdHJlYW0xOwotICAgIGludCBpLCBqOwotCi0gICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgIC8qIENoZWNrIGZvciBzaG9ydF92aWRlb19oZWFkZXIgKi8KLSAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi0gICAgaWYgKGN1cnJWb2wtPnNob3J0VmlkZW9IZWFkZXIgPT0gMSkKLSAgICAgICAgcmV0dXJuIHN0YXR1czsKLSAgICBlbHNlCi0gICAgewotICAgICAgICAvKiBTaG9ydCBWaWRlbyBIZWFkZXIgb3IgTTRWICovCi0KLSAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqLwotICAgICAgICAvKiBWaXN1YWxPYmplY3RTZXF1ZW5jZSAoKSovCi0gICAgICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtUHV0R1QxNkJpdHMoc3RyZWFtLCAzMiwgU0VTU0lPTl9TVEFSVF9DT0RFKTsKLSAgICAgICAgLyogIERldGVybWluZSBwcm9maWxlX2xldmVsICovCi0gICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dEJpdHMoc3RyZWFtLCA4LCB2aWRlby0+ZW5jUGFyYW1zLT5Qcm9maWxlTGV2ZWxbdmlkZW8tPmN1cnJMYXllcl0pOwotCi0gICAgICAgIC8qKioqKioqKioqKioqKioqKiovCi0gICAgICAgIC8qIFZpc3VhbE9iamVjdCgpICovCi0gICAgICAgIC8qKioqKioqKioqKioqKioqKiovCi0KLSAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtUHV0R1QxNkJpdHMoc3RyZWFtLCAzMiwgVklTVUFMX09CSkVDVF9TVEFSVF9DT0RFKTsKLSAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtUHV0MUJpdHMoc3RyZWFtLCAweDAwKTsgLyogdmlzdWFsIG9iamVjdCBpZGVudGlmaWVyICovCi0gICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dEJpdHMoc3RyZWFtLCA0LCAweDAxKTsgLyogdmlzdWFsIG9iamVjdCBUeXBlID09ICJ2aWRlbyBJRCIgKi8KLSAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtUHV0MUJpdHMoc3R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yogc3ByaXRlX2VuYWJsZSA9IDAgKi8KLSAgICAgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dDFCaXRzKHN0cmVhbSwgMHgwMCk7Lyogbm90XzhfYml0ID0gMCAqLwotICAgICAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtUHV0MUJpdHMoc3RyZWFtLCBjdXJyVm9sLT5xdWFudFR5cGUpOy8qICAgcXVhbnRfdHlwZSAqLwotCi0gICAgICAgICAgICBpZiAoY3VyclZvbC0+cXVhbnRUeXBlKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dDFCaXRzKHN0cmVhbSwgY3VyclZvbC0+bG9hZEludHJhUXVhbnRNYXQpOyAvKiBJbnRyYSBxdWFudCBtYXRyaXggKi8KLSAgICAgICAgICAgICAgICBpZiAoY3VyclZvbC0+bG9hZEludHJhUXVhbnRNYXQpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBmb3IgKGogPSA2MzsgaiA+PSAxOyBqLS0pCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VyclZvbC0+aXFtYXRbKih6aWd6YWdfaStqKV0gIT0gY3VyclZvbC0+aXFtYXRbKih6aWd6YWdfaStqLTEpXSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgaWYgKChqID09IDEpICYmIChjdXJyVm9sLT5pcW1hdFsqKHppZ3phZ19pK2opXSA9PSBjdXJyVm9sLT5pcW1hdFsqKHppZ3phZ19pK2otMSldKSkKLSAgICAgICAgICAgICAgICAgICAgICAgIGogPSAwOwotICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaiArIDE7IGkrKykKLSAgICAgICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVB1dEJpdHMoc3RyZWFtLCA4LCBjdXJyVm9sLT5pcW1hdFsqKHppZ3phZ19pK2kpXSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChqIDwgNjMpCi0gICAgICAgICAgICAgICAgICAgICAgICBCaXRzdHJlYW1QdXRCaXRzKHN0cmVhbSwgOCwgMCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCA2NDsgaisrKQotICAgICAgICAgICAgICAgICAgICAgICAgY3VyclZvbC0+aXFtYXRbal0gPSBtcGVnX2lxbWF0X2RlZltqXTsKLQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1QdXQxQml0cyhzdHJlYW0sIGN1cnJWb2wtPmxvYWROb25JbnRyYVF1YW50TWF0KTsgLyogTm9uLUludHJhIHF1YW50IG1hdHJpeCAqLwotICAgICAgICAgICAgICAgIGlmIChjdXJyVm9sLT5sb2FkTm9uSW50cmFRdWFudE1hdCkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDYzOyBqID49IDE7IGotLSkKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJyVm9sLT5uaXFtYXRbKih6aWd6YWdfaStqKV0gIT0gY3VyclZvbC0+bmlxbWF0WyooemlnemFnX2krai0xKV0pCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgoaiA9PSAxKSAmJiAoY3VyclZvbC0+bmlxbWF0WyooemlnemFnX2kraildID09IGN1cnJWb2wtPm5pcW1hdFsqKHppZ3phZ19pK2otMSldKSkKLSAgICAgICAgICAgICAgICAgICAgICAgIGogPSAwOwotICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaiArIDE7IGkrKykKLSAgICAgICAgICAgICAgICAgICAgICAgIEJpdHN0cmVhbVB1dEJpdHMoc3RyZWFtLCA4LCBjdXJyVm9sLT5uaXFtYXRbKih6aWd6YWdfaStpKV0pOwotICAgICAgICAgICAgICAgICAgICBpZiAoaiA8IDYzKQotICAgICAgICAgICAgICAgICAgICAgICAgQml0c3RyZWFtUHV0Qml0cyhzdHJlYW0sIDgsIDApOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBmb3IgKGogPSAwOyBqIDwgNjQ7IGorKykKLSAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJWb2wtPm5pcW1hdFtqXSA9IG1wZWdfbnFtYXRfZGVmW2pdOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtUHV0MUJpdHMoc3RyZWFtLCAweDAxKTsgICAvKiBjb21wbGV4aXR5X2VzdGltYXRpb25fZGlzYWJsZSA9IDEgKi8KLSAgICAgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dDFCaXRzKHN0cmVhbSwgY3VyclZvbC0+UmVzeW5jTWFya2VyRGlzYWJsZSk7LyogUmVzeW5jX21hcmtlcl9kaXNhYmxlICovCi0gICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1QdXQxQml0cyhzdHJlYW0sIGN1cnJWb2wtPmRhdGFQYXJ0aXRpb25pbmcpOy8qIERhdGEgcGFydGl0aW9uZWQgKi8KLQotICAgICAgICAgICAgaWYgKGN1cnJWb2wtPmRhdGFQYXJ0aXRpb25pbmcpCi0gICAgICAgICAgICAgICAgc3RhdHVzID0gQml0c3RyZWFtUHV0MUJpdHMoc3RyZWFtLCBjdXJyVm9sLT51c2VSZXZlcnNlVkxDKTsgLyogUmV2ZXJzaWJsZV92bGMgKi8KLQotCi0gICAgICAgICAgICBpZiAoY3VyclZvbC0+c2NhbGFiaWxpdHkpIC8qIFNjYWxhYmlsaXR5Ki8KLSAgICAgICAgICAgIHsKLQotICAgICAgIC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qLwotICAgICAgICAgICAgICAgIHN0YXR1cyA9IEJpdHN0cmVhbVB1dDFCaXRzKHN0cmVhbSwgY3VyclZvbC0+ZW5oYW5jZW1lbnRUeXBlKTsvKiBlbmhhbmNlbWVudF90eXBlKi8KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgLyogTm8gU2NhbGFiaWxpdHkgKi8KLSAgICAgICAgICAgICAgICBzdGF0dXMgPSBCaXRzdHJlYW1QdXQxQml0cyhzdHJlYW0sIGN1cnJWb2wtPnNjYWxhYmlsaXR5KTsvKiBTY2FsYWJpbGl0eSA9IDAgKi8KLQotICAgICAgICAgICAgLyp0ZW1wID0gKi8KLSAgICAgICAgICAgIEJpdHN0cmVhbU1wZWc0Qnl0ZUFsaWduU3R1ZmZpbmcoc3RyZWFtKTsgLyogQnl0ZSBhbGlnbiBIZWFkZXJzIGZvciBWT1AgKi8KLSAgICAgICAgfQotICAgIH0KLQotICAgIHJldHVybiBzdGF0dXM7Ci19Ci0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogVk9TX0VuZCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwOC8yMi8yMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IFZpc3VhbCBPYmplY3QgU2VxdWVuY2UgRW5kICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIEluL291dCAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUmV0dXJuICAgOiBQVl9UUlVFIGlmIHN1Y2Nlc3NlZCwgUFZfRkFMU0UgaWYgZmFpbGVkLiAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBNb2RpZmllZCA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLQotUFZfU1RBVFVTIFZPU19FbmQoVmlkZW9FbmNDb250cm9scyAqZW5jb2RlckNvbnRyb2wpCi17Ci0gICAgUFZfU1RBVFVTIHN0YXR1cyA9IFBWX1NVQ0NFU1M7Ci0gICAgVmlkZW9FbmNEYXRhICp2aWRlbyA9IChWaWRlb0VuY0RhdGEgKillbmNvZGVyQ29udHJvbC0+dmlkZW9FbmNvZGVyRGF0YTsKLSAgICBWb2wgICAgICAgICAqY3VyclZvbCA9IHZpZGVvLT52b2xbdmlkZW8tPmN1cnJMYXllcl07Ci0gICAgQml0c3RyZWFtRW5jVmlkZW8gKnN0cmVhbSA9IGN1cnJWb2wtPnN0cmVhbTsKLQotCi0gICAgc3RhdHVzID0gQml0c3RyZWFtUHV0Qml0cyhzdHJlYW0sIFNFU1NJT05fRU5EX0NPREUsIDMyKTsKLQotICAgIHJldHVybiBzdGF0dXM7Ci19Ci0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogRGV0ZXJtaW5lQ29kaW5nTGF5ZXIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwNi8wMi8yMDAxICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IEZpbmQgbGF5ZXIgdG8gY29kZSBiYXNlZCBvbiBjdXJyZW50IG1vZCB0aW1lLCBhc3N1bWluZyB0aGF0Ci0gICAgICAgICAgICAgICBpdCdzIHRpbWUgdG8gZW5jb2RlIGVuaGFuY2VkIGxheWVyLiAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogTnVtYmVyIG9mIGxheWVyIHRvIGNvZGUuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0KLUludCBEZXRlcm1pbmVDb2RpbmdMYXllcihWaWRlb0VuY0RhdGEgKnZpZGVvLCBJbnQgKm5MYXllciwgVUxvbmcgbW9kVGltZSkKLXsKLSAgICBWb2wgKip2b2wgPSB2aWRlby0+dm9sOwotICAgIFZpZGVvRW5jUGFyYW1zICplbmNQYXJhbXMgPSB2aWRlby0+ZW5jUGFyYW1zOwotICAgIEludCBudW1MYXllcnMgPSBlbmNQYXJhbXMtPm5MYXllcnM7Ci0gICAgVUludCBtb2RUaW1lUmVmID0gdmlkZW8tPm1vZFRpbWVSZWY7Ci0gICAgZmxvYXQgKkxheWVyRnJhbWVSYXRlID0gZW5jUGFyYW1zLT5MYXllckZyYW1lUmF0ZTsKLSAgICBVSW50IGZyYW1lTnVtWzRdLCBmcmFtZVRpY2s7Ci0gICAgVUxvbmcgZnJhbWVNb2RU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dGUgcmMtPk5yLCByYy0+QiwgKHJjLT5ScikqLwotICAgICAgICAgICAgICAgIGlmIChlbmNQYXJhbXMtPlJDX1R5cGUgIT0gQ09OU1RBTlRfUSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIFJDX1VwZGF0ZUJ1ZmZlcih2aWRlbywgaSwgZXh0cmFfc2tpcCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgLyogdXBkYXRlIGZyYW1lIG5vLiAqLwotICAgICAgICAgICAgdmlkZW8tPnByZXZGcmFtZU51bVtpXSA9IGZyYW1lTnVtW2ldOwotICAgICAgICB9Ci0gICAgfQotCi0jaWZkZWYgX1BSSU5UX1NUQVQKLSAgICBpZiAoZW5jb2RlVm9wKQotICAgICAgICBwcmludGYoIiBUSTogJWQgIiwgdm9sWypuTGF5ZXJdLT50aW1lSW5jcmVtZW50KTsKLSNlbmRpZgotCi0gICAgcmV0dXJuIGVuY29kZVZvcDsKLX0KLQotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0vKiAgRnVuY3Rpb24gOiBEZXRlcm1pbmVWb3BUeXBlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBEYXRlICAgICA6IDA2LzAyLzIwMDEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFB1cnBvc2UgIDogVGhlIG5hbWUgc2F5cyBpdCBhbGwuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IHZvaWQgLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotCi12b2lkIERldGVybWluZVZvcFR5cGUoVmlkZW9FbmNEYXRhICp2aWRlbywgSW50IGN1cnJMYXllcikKLXsKLSAgICBWaWRlb0VuY1BhcmFtcyAqZW5jUGFyYW1zID0gdmlkZW8tPmVuY1BhcmFtczsKLS8vICBWb2wgKmN1cnJWb2wgPSB2aWRlby0+dm9sW2N1cnJMYXllcl07Ci0KLSAgICBpZiAoZW5jUGFyYW1zLT5JbnRyYVBlcmlvZCA9PSAwKSAvKiBJLVZPUHMgb25seSAqLwotICAgIHsKLSAgICAgICAgaWYgKHZpZGVvLT5jdXJyTGF5ZXIgPiAwKQotICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID0gUF9WT1A7Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID0gSV9WT1A7Ci0gICAgICAgICAgICBpZiAodmlkZW8tPm51bVZvcHNJbkdPUCA+PSAxMzIpCi0gICAgICAgICAgICAgICAgdmlkZW8tPm51bVZvcHNJbkdPUCA9IDA7Ci0gICAgICAgIH0KLSAgICB9Ci0gICAgZWxzZSBpZiAoZW5jUGFyYW1zLT5JbnRyYVBlcmlvZCA9PSAtMSkgIC8qIElQUFBQUC4uLiAqLwotICAgIHsKLQotICAgICAgICAvKiBtYWludGFpbiBmcmFtZSB0eXBlIGlmIHByZXZpb3VzIGZyYW1lIGlzIHByZS1za2lwcGVkLCAwNi8wMi8yMDAxICovCi0gICAgICAgIGlmIChlbmNQYXJhbXMtPlJDX1R5cGUgPT0gQ09OU1RBTlRfUSB8fCB2aWRlby0+cmNbY3VyckxheWVyXS0+c2tpcF9uZXh0X2ZyYW1lICE9IC0xKQotICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID0gUF9WT1A7Ci0KLSAgICAgICAgaWYgKHZpZGVvLT5jdXJyTGF5ZXIgPT0gMCkKLSAgICAgICAgewotICAgICAgICAgICAgaWYgKC8qdmlkZW8tPm51bVZvcHNJbkdPUD49MTMyIHx8ICovdmlkZW8tPnZvbEluaXRpYWxpemVbY3VyckxheWVyXSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB2aWRlby0+Y3VyclZvcC0+cHJlZGljdGlvblR5cGUgPSBJX1ZPUDsKLSAgICAgICAgICAgICAgICB2aWRlby0+bnVtVm9wc0luR09QID0gMDsgLyogZm9yY2UgSU5UUkEgdXBkYXRlIGV2ZXJ5IDEzMiBiYXNlIGZyYW1lcyovCi0gICAgICAgICAgICAgICAgdmlkZW8tPm5leHRFbmNJVm9wID0gMTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgaWYgKHZpZGVvLT5uZXh0RW5jSVZvcCA9PSAwIHx8IHZpZGVvLT5jdXJyVm9wLT5wcmVkaWN0aW9uVHlwZSA9PSBJX1ZPUCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB2aWRlby0+bnVtVm9wc0luR09QID0gMDsKLSAgICAgICAgICAgICAgICB2aWRlby0+bmV4dEVuY0lWb3AgPSAxOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotICAgIGVsc2UgICAvKiBJbnRyYVBlcmlvZD4wIDogSVBQUFBQSVBQUFBQSS4uLiAqLwotICAgIHsKLQotICAgICAgICAvKiBtYWludGFpbiBmcmFtZSB0eXBlIGlmIHByZXZpb3VzIGZyYW1lIGlzIHByZS1za2lwcGVkLCAwNi8wMi8yMDAxICovCi0gICAgICAgIGlmIChlbmNQYXJhbXMtPlJDX1R5cGUgPT0gQ09OU1RBTlRfUSB8fCB2aWRlby0+cmNbY3VyckxheWVyXS0+c2tpcF9uZXh0X2ZyYW1lICE9IC0xKQotICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID0gUF9WT1A7Ci0KLSAgICAgICAgaWYgKGN1cnJMYXllciA9PSAwKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAodmlkZW8tPm5leHRFbmNJVm9wIDw9IDAgfHwgdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID09IElfVk9QKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHZpZGVvLT5uZXh0RW5jSVZvcCA9IGVuY1BhcmFtcy0+SW50cmFQZXJpb2Q7Ci0gICAgICAgICAgICAgICAgdmlkZW8tPmN1cnJWb3AtPnByZWRpY3Rpb25UeXBlID0gSV9WT1A7Ci0gICAgICAgICAgICAgICAgdmlkZW8tPm51bVZvcHNJbkdPUCA9IDA7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICByZXR1cm4gOwotfQotCi0vKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gKi8KLS8qICBGdW5jdGlvbiA6IFVwZGF0ZVNraXBOZXh0RnJhbWUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIERhdGUgICAgIDogMDYvMDIvMjAwMSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgUHVycG9zZSAgOiBGcm9tIHJhdGUgY29udHJvbCBmcmFtZSBza2lwcGluZyBkZWNpc2lvbiwgdXBkYXRlIHRpbWluZwotICAgICAgICAgICAgICAgIHJlbGF0ZWQgcGFyYW1ldGVycy4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgSW4vb3V0ICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBSZXR1cm4gICA6IEN1cnJlbnQgY29kZWQgbGF5ZXIuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIE1vZGlmaWVkIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotCi1JbnQgVXBkYXRlU2tpcE5leHRGcmFtZShWaWRlb0VuY0RhdGEgKnZpZGVvLCBVTG9uZyAqbW9kVGltZSwgSW50ICpzaXplLCBQVl9TVEFUVVMgc3RhdHVzKQotewotICAgIEludCBjdXJyTGF5ZXIgPSB2aWRlby0+Y3VyckxheWVyOwotICAgIEludCBuTGF5ZXIgPSBjdXJyTGF5ZXI7Ci0gICAgVmlkZW9FbmNQYXJhbXMgKmVuY1BhcmFtcyA9IHZpZGVvLT5lbmNQYXJhbXM7Ci0gICAgSW50IG51bUxheWVycyA9IGVuY1BhcmFtcy0+bkxheWVyczsKLSAgICBWb2wgKmN1cnJWb2wgPSB2aWRlby0+dm9sW2N1cnJMYXllcl07Ci0gICAgVm9sICoqdm9sID0gdmlkZW8tPnZvbDsKLSAgICBJbnQgbnVtX3NraXAsIGV4dHJhX3NraXA7Ci0gICAgSW50IGk7Ci0gICAgVUludCBuZXdSZWZUaWNrLCBkZWx0YU1vZFRpbWU7Ci0gICAgVUludCB0ZW1wOwotCi0gICAgaWYgKGVuY1BhcmFtcy0+UkNfVHlwZSAhPSBDT05TVEFOVF9RKQotICAgIHsKLSAgICAgICAgaWYgKHZpZGVvLT52b2xJbml0aWFsaXplWzBdICYmIGN1cnJMYXllciA9PSAwKSAgLyogYWx3YXlzIGVuY29kZSB0aGUgZmlyc3QgZnJhbWUgKi8KLSAgICAgICAgewotICAgICAgICAgICAgUkNfUmVzZXRTa2lwTmV4dEZyYW1lKHZpZGVvLCBjdXJyTGF5ZXIpOwotICAgICAgICAgICAgLy9yZXR1cm4gY3VyckxheWVyOyAgMDkvMTUvMDUKLSAgICAgICAgfQotICAgICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmIChSQ19HZXRTa2lwTmV4dEZyYW1lKHZpZGVvLCBjdXJyTGF5ZXIpIDwgMCB8fCBzdGF0dXMgPT0gUFZfRU5EX09GX0JVRikgICAvKiBTa2lwIEN1cnJlbnQgRnJhbWUgKi8KLSAgICAgICAgICAgIHsKLQotI2lmZGVmIF9QUklOVF9TVEFUCi0gICAgICAgICAgICAgICAgcHJpbnRmKCJTa2lwIGN1cnJlbnQgZnJhbWUiKTsKLSNlbmRpZgotICAgICAgICAgICAgICAgIGN1cnJWb2wtPm1vZHVsb1RpbWVCYXNlID0gY3VyclZvbC0+cHJldk1vZHVsb1RpbWVCYXNlOwotCi0gICAgICAgICAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKi8KLSAgICAgICAgICAgICAgICAvKiBwcmVwYXJlIHRvIHJldHVybiAqLwotICAgICAgICAgICAgICAgIC8qKioqKioqKioqKioqKioqKioqKiovCi0gICAgICAgICAgICAgICAgKnNpemUgPSAwOyAgLyogU2V0IEJpdHN0cmVhbSBidWZmZXIgdG8gemVybyAqLwotCi0gICAgICAgICAgICAgICAgLyogRGV0ZXJtaW5lIG5MYXllciBhbmQgbW9kVGltZSBmb3IgbmV4dCBlbmNvZGUgKi8KLQotICAgICAgICAgICAgICAgICptb2RUaW1lID0gdmlkZW8tPm5leHRNb2RUaW1lOwotICAgICAgICAgICAgICAgIG5MYXllciA9IC0xOwotCi0gICAgICAgICAgICAgICAgcmV0dXJuIG5MYXllcjsgLyogcmV0dXJuIGltbWVkaWF0ZWx5IHdpdGhvdXQgdXBkYXRpbmcgUmVmVGljayAmIG1vZFRpbWVSZWYgKi8KLSAgICAgICAgICAgICAgICAvKiBJZiBJLVZPUCB3YXMgYXR0ZW1wdGVkLCB0aGVuIGVuc3VyZSBuZXh0IGJhc2UgaXMgSS1WT1AgKi8KLSAgICAgICAgICAgICAgICAvKmlmKChlbmNQYXJhbXMtPkludHJhUGVyaW9kPjApICYmICh2aWRlby0+Y3VyclZvcC0+cHJlZGljdGlvblR5cGUgPT0gSV9WT1ApKQotICAgICAgICAgICAgICAgIHZpZGVvLT5uZXh0RW5jSVZvcCA9IDA7IGNvbW1lbnRlZCBvdXQgYnkgMDYvMDUvMDEgKi8KLQotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSBpZiAoKG51bV9za2lwID0gUkNfR2V0U2tpcE5leHRGcmFtZSh2aWRlbywgY3VyckxheWVyKSkgPiAwKQotICAgICAgICAgICAgewotCi0jaWZkZWYgX1BSSU5UX1NUQVQKLSAgICAgICAgICAgICAgICBwcmludGYoIlNraXAgbmV4dCAlZCBmcmFtZXMiLCBudW1fc2tpcCk7Ci0jZW5kaWYKLSAgICAgICAgICAgICAgICAvKiB0byBrZWVwIHRoZSBOciBvZiBlbmggbGF5ZXIgdGhlIHNhbWUgKi8KLSAgICAgICAgICAgICAgICAvKiBhZGp1c3QgcmVsTGF5ZXJDb2RlVGltZSBvbmx5LCBkbyBub3QgYWRqdXN0IGxheWVyQ29kZVRpbWVbbnVtTGF5ZXJzLTFdICovCi0gICAgICAgICAgICAgICAgZXh0cmFfc2tpcCA9IDA7Ci0gICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGN1cnJMYXllcjsgaSsrKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHZpZGVvLT5yZWxMYXllckNvZGVUaW1lW2ldIDw9IDEwMDApCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhX3NraXAgPSAxOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGkgPSBjdXJyTGF5ZXI7IGkgPCBudW1MYXllcnM7IGkrKykKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIHZpZGVvLT5yZWxMYXllckNvZGVUaW1lW2ldICs9IChudW1fc2tpcCArIGV4dHJhX3NraXApICoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChJbnQpKCgxMDAwLjAgKiBlbmNQYXJhbXMtPkxheWVyRnJhbWVSYXRlW251bUxheWVycy0xXSkgLyBlbmNQYXJhbXMtPkxheWVyRnJhbWVSYXRlW2ldKSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9LyogZmlyc3QgZnJhbWUgKi8KLSAgICB9Ci0gICAgLyoqKioqICBjdXJyZW50IGZyYW1lIGlzIGVuY29kZWQsIG5vdyB1cGRhdGUgcmVmVGljayAqKioqKiovCi0KLSAgICB2aWRlby0+cmVmVGlja1tjdXJyTGF5ZXJdICs9IHZvbFtjdXJyTGF5ZXJdLT5wcmV2TW9kdWxvVGltZUJhc2UgKiB2b2xbY3VyckxheWVyXS0+dGltZUluY3JlbWVudFJlc29sdXRpb247Ci0KLSAgICAvKiBSZXNldCBsYXllckNvZGVUaW1lIGV2ZXJ5IEktVk9QIHRvIHByZXZlbnQgb3ZlcmZsb3cgKi8KLSAgICBpZiAoY3VyckxheWVyID09IDApCi0gICAgewotICAgICAgICAvKiAgMTIvMTIvMDIsIGZpeCBmb3Igd2VpcmQgdGFyZ2VyIGZyYW1lIHJhdGUgb2YgOS45OSBmcHMgb3IgMy4zMyBmcHMgKi8KLSAgICAgICAgaWYgKCgoZW5jUGFyYW1zLT5JbnRyYVBlcmlvZCAhPSAwKSAvKiYmICh2aWRlby0+Y3VyclZvcC0+cHJlZGljdGlvblR5cGU9PUlfVk9QKSovKSB8fAotICAgICAgICAgICAgICAgICgoZW5jUGFyYW1zLT5JbnRyYVBlcmlvZCA9PSAwKSAmJiAodmlkZW8tPm51bVZvcHNJbkdPUCA9PSAwKSkpCi0gICAgICAgIHsKLSAgICAgICAgICAgIG5ld1JlZlRpY2sgPSB2aWRlby0+cmVmVGlja1swXTsKLQotICAgICAgICAgICAgZm9yIChpID0gMTsgaSA8IG51bUxheWVyczsgaSsrKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmICh2aWRlby0+cmVmVGlja1tpXSA8IG5ld1JlZlRpY2spCi0gICAgICAgICAgICAgICAgICAgIG5ld1JlZlRpY2sgPSB2aWRlby0+cmVmVGlja1tpXTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgLyogY2hlY2sgdG8gbWFrZSBzdXJlIHRoYXQgdGhlIHVwZGF0ZSBpcyBpbnRlZ2VyIG11bHRpcGxlIG9mIGZyYW1lIG51bWJlciAqLwotICAgICAgICAgICAgLyogaG93IG1hbnkgbXNlYyBlbGFwc2VkIGZyb20gbGFzdCBtb2RUaW1lUmVmICovCi0gICAgICAgICAgICBkZWx0YU1vZFRpbWUgPSAobmV3UmVmVGljayAvIHZvbFswXS0+dGltZUluY3JlbWVudFJlc29sdXRpb24pICogMTAwMDsKLQotICAgICAgICAgICAgZm9yIChpID0gbnVtTGF5ZXJzIC0gMTsgaSA+PSAwOyBpLS0pCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgdGVtcCA9IChVSW50KShkZWx0YU1vZFRpbWUgKiBlbmNQYXJhbXMtPkxheWVyRnJhbWVSYXRlW2ldKTsgLyogMTIvMTIvMDIgKi8KLSAgICAgICAgICAgICAgICBpZiAodGVtcCAlIDEwMDApCi0gICAgICAgICAgICAgICAgICAgIG5ld1JlZlRpY2sgPSAwOwotCi0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobmV3UmVmVGljayA+IDApCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgdmlkZW8tPm1vZFRpbWVSZWYgKz0gZGVsdGFNb2RUaW1lOwotICAgICAgICAgICAgICAgIGZvciAoaSA9IG51bUxheWVycyAtIDE7IGkgPj0gMDsgaS0tKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgdmlkZW8tPnByZXZGcmFtZU51bVtpXSAtPSAoVUludCkoZGVsdGFNb2RUaW1lICogZW5jUGFyYW1zLT5MYXllckZyYW1lUmF0ZVtpXSkgLyAxMDAwOwotICAgICAgICAgICAgICAgICAgICB2aWRlby0+cmVmVGlja1tpXSAtPSBuZXdSZWZUaWNrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgICptb2RUaW1lID0gIHZpZGVvLT5uZXh0TW9kVGltZTsKLQotICAgIHJldHVybiBuTGF5ZXI7Ci19Ci0KLQotI2lmbmRlZiBPUklHSU5BTF9WRVJTSU9OCi0KLS8qID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSAqLwotLyogIEZ1bmN0aW9uIDogU2V0UHJvZmlsZV9CdWZmZXJTaXplICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgRGF0ZSAgICAgOiAwNC8wOC8yMDAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBQdXJwb3NlICA6IFNldCBwcm9maWxlIGFuZCB2aWRlbyBidWZmZXIgc2l6ZSwgY29waWVkIGZyb20gSmltJ3MgY29kZSAgICAqLwotLyogICAgICAgICAgICAgaW4gUFZJbml0VmlkZW9FbmNvZGVyKC4pLCBzaW5jZSB3ZSBoYXZlIGRpZmZlcmVudCBwbGFjZXMgICAgICovCi0vKiAgICAgICAgICAgICB0byByZXNldCBwcm9maWxlIGFuZCB2aWRlbyBidWZmZXIgc2l6ZSAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICBJbi9vdXQgICA6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogIFJldHVybiAgIDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCi0vKiAgTW9kaWZpZWQgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KLS8qICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLwotLyogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICovCi0KLUJvb2wgU2V0UHJvZmlsZV9CdWZmZXJTaXplKFZpZGVvRW5jRGF0YSAqdmlkZW8sIGZsb2F0IGRlbGF5LCBJbnQgYkluaXRpYWxpemVkKQotewotICAgIEludCBpLCBqLCBzdGFydCwgZW5kOwotLy8gIEludCBCYXNlTUJzUGVyU2VjID0gMCwgRW5oTUJzUGVyU2VjID0gMDsKLSAgICBJbnQgblRvdGFsTUIgPSAwOwotICAgIEludCBpZHgsIHRlbXBfdywgdGVtcF9oLCBtYXggPSAwLCBtYXhfd2lkdGgsIG1heF9oZWlnaHQ7Ci0KLSAgICBJbnQgbkxheWVycyA9IHZpZGVvLT5lbmNQYXJhbXMtPm5MYXllcnM7IC8qIE51bWJlciBvZiBMYXllcnMgdG8gYmUgZW5jb2RlZCAqLwotCi0gICAgSW50I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JzUGVyU2VjWzJdICAgICAgJiYKLSAgICAgICAgICAgICAgICB0b3RhbF9WQlZfc2l6ZSAgICAgIDw9IHNjYWxhYmxlX3Byb2ZpbGVfbGV2ZWxfbWF4X1ZCVl9zaXplWzJdKQotCi0gICAgICAgIHsKLSAgICAgICAgICAgIHN0YXJ0ID0gMDsKLSAgICAgICAgICAgIGVuZCA9IGluZGV4OwotICAgICAgICB9Ci0KLSAgICAgICAgZWxzZQotICAgICAgICB7Ci0gICAgICAgICAgICBzdGFydCA9IDQ7Ci0gICAgICAgICAgICBlbmQgPSBpbmRleDsKLSAgICAgICAgfQotCi0KLSAgICAgICAgLyogU2VhcmNoIHRoZSBzY2FsYWJsZSBwcm9maWxlICovCi0gICAgICAgIGZvciAoaSA9IHN0YXJ0OyBpIDw9IGVuZDsgaSsrKQotICAgICAgICB7Ci0gICAgICAgICAgICBpZiAodG90YWxfYml0cmF0ZSAgICAgICA8PSBzY2FsYWJsZV9wcm9maWxlX2xldmVsX21heF9iaXRyYXRlW2ldICAgICAmJgotICAgICAgICAgICAgICAgICAgICB0b3RhbF9wYWNrZXRfc2l6ZSAgIDw9IHNjYWxhYmxlX3Byb2ZpbGVfbGV2ZWxfbWF4X3BhY2tldF9zaXplW2ldICYmCi0gICAgICAgICAgICAgICAgICAgIHRvdGFsX01Cc1BlclNlYyAgICAgPD0gc2NhbGFibGVfcHJvZmlsZV9sZXZlbF9tYXhfbWJzUGVyU2VjW2ldICAgJiYKLSAgICAgICAgICAgICAgICAgICAgdG90YWxfVkJWX3NpemUgICAgICA8PSBzY2FsYWJsZV9wcm9maWxlX2xldmVsX21heF9WQlZfc2l6ZVtpXSkKLQotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0gICAgICAgIGlmIChpID4gZW5kKSByZXR1cm4gUFZfRkFMU0U7Ci0KLSAgICAgICAgLyogU2VhcmNoIHRoZSBiYXNlIHByb2ZpbGUgKi8KLSAgICAgICAgaWYgKGkgPT0gMCkKLSAgICAgICAgewotICAgICAgICAgICAgaiA9IDA7Ci0gICAgICAgICAgICBiRm91bmQgPSAxOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UgICAgICAgIGJGb3VuZCA9IDA7Ci0KLSAgICAgICAgZm9yIChqID0gc3RhcnQ7ICFiRm91bmQgJiYgaiA8PSBpOyBqKyspCi0gICAgICAgIHsKLSAgICAgICAgICAgIGlmIChiYXNlX2JpdHJhdGUgICAgICAgIDw9IHByb2ZpbGVfbGV2ZWxfbWF4X2JpdHJhdGVbal0gICAgICAmJgotICAgICAgICAgICAgICAgICAgICBiYXNlX3BhY2tldF9zaXplICAgIDw9IHByb2ZpbGVfbGV2ZWxfbWF4X3BhY2tldF9zaXplW2pdICAmJgotICAgICAgICAgICAgICAgICAgICBiYXNlX01Cc1BlclNlYyAgICAgIDw9IHByb2ZpbGVfbGV2ZWxfbWF4X21ic1BlclNlY1tqXSAgICAmJgotICAgICAgICAgICAgICAgICAgICBiYXNlX1ZCVl9zaXplICAgICAgIDw9IHByb2ZpbGVfbGV2ZWxfbWF4X1ZCVl9zaXplW2pdKQotCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgYkZvdW5kID0gMTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGlmICghYkZvdW5kKSAvLyAmJiBzdGFydCA9PSA0KQotICAgICAgICAgICAgcmV0dXJuIFBWX0ZBTFNFOyAvKiBtaXMtbWF0Y2ggaW4gdGhlIHByb2ZpbGVzIGJldHdlZW4gYmFzZSBsYXllciBhbmQgZW5oYW5jZW1lbnQgbGF5ZXIgKi8KLQotICAgICAgICAvKiBqIGZvciBiYXNlIGxheWVyLCBpIGZvciBlbmhhbmNlbWVudCBsYXllciAqLwotICAgICAgICB2aWRlby0+ZW5jUGFyYW1zLT5Qcm9maWxlTGV2ZWxbMF0gPSBwcm9maWxlX2xldmVsX2NvZGVbal07Ci0gICAgICAgIHZpZGVvLT5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B2bXAzX3BvbHlwaGFzZV9maWx0ZXJfd2luZG93LmNwcCIsCi0gICAgICAgICJzcmMvcHZtcDNfbWRjdF8xOC5jcHAiLAotICAgICAgICAic3JjL3B2bXAzX2RjdF85LmNwcCIsCi0gICAgICAgICJzcmMvcHZtcDNfZGN0XzE2LmNwcCIsCi0gICAgXSwKLQotICAgIGFyY2g6IHsKLSAgICAgICAgYXJtOiB7Ci0gICAgICAgICAgICBleGNsdWRlX3NyY3M6IFsKLSAgICAgICAgICAgICAgICAic3JjL3B2bXAzX3BvbHlwaGFzZV9maWx0ZXJfd2luZG93LmNwcCIsCi0gICAgICAgICAgICAgICAgInNyYy9wdm1wM19tZGN0XzE4LmNwcCIsCi0gICAgICAgICAgICAgICAgInNyYy9wdm1wM19kY3RfOS5jcHAiLAotICAgICAgICAgICAgICAgICJzcmMvcHZtcDNfZGN0XzE2LmNwcCIsCi0gICAgICAgICAgICBdLAotICAgICAgICAgICAgc3JjczogWwotICAgICAgICAgICAgICAgICJzcmMvYXNtL3B2bXAzX3BvbHlwaGFzZV9maWx0ZXJfd2luZG93X2djYy5zIiwKLSAgICAgICAgICAgICAgICAic3JjL2FzbS9wdm1wM19tZGN0XzE4X2djYy5zIiwKLSAgICAgICAgICAgICAgICAic3JjL2FzbS9wdm1wM19kY3RfOV9nY2MucyIsCi0gICAgICAgICAgICAgICAgInNyYy9hc20vcHZtcDNfZGN0XzE2X2djYy5zIiwKLSAgICAgICAgICAgIF0sCi0KLSAgICAgICAgICAgIGluc3RydWN0aW9uX3NldDogImFybSIsCi0gICAgICAgIH0sCi0gICAgfSwKLQotICAgIHNhbml0aXplOiB7Ci0gICAgICAgIG1pc2NfdW5kZWZpbmVkOiBbCi0gICAgICAgICAgICAic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAotICAgICAgICBdLAotICAgICAgICBjZmk6IHRydWUsCi0gICAgfSwKLQotICAgIGluY2x1ZGVfZGlyczogWyJmcmFtZXdvcmtzL2F2L21lZGlhL2xpY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CiAgICAgICBtU2Vla1ByZVJvbGwoMCksCiAgICAgICBtQW5jaG9yVGltZVVzKDApLApAQCAtMTY5LDExICsxNzEsMTEgQEAKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgb3B1c1BhcmFtcy0+bkF1ZGlvQmFuZFdpZHRoID0gMDsKLSAgICAgICAgICAgIG9wdXNQYXJhbXMtPm5TYW1wbGVSYXRlID0ga1JhdGU7CisgICAgICAgICAgICBvcHVzUGFyYW1zLT5uU2FtcGxlUmF0ZSA9IG1TYW1wbGluZ1JhdGU7CiAgICAgICAgICAgICBvcHVzUGFyYW1zLT5uQml0UmF0ZSA9IDA7CiAKICAgICAgICAgICAgIGlmICghaXNDb25maWd1cmVkKCkpIHsKLSAgICAgICAgICAgICAgICBvcHVzUGFyYW1zLT5uQ2hhbm5lbHMgPSAxOworICAgICAgICAgICAgICAgIG9wdXNQYXJhbXMtPm5DaGFubmVscyA9IG1OdW1DaGFubmVsczsKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgb3B1c1BhcmFtcy0+bkNoYW5uZWxzID0gbUhlYWRlci0+Y2hhbm5lbHM7CiAgICAgICAgICAgICB9CkBAIC0yNzQsNyArMjc2LDggQEAKICAgICAgICAgICAgIGlmIChvcHVzUGFyYW1zLT5uUG9ydEluZGV4ICE9IDApIHsKICAgICAgICAgICAgICAgICByZXR1cm4gT01YX0Vycm9yVW5kZWZpbmVkOwogICAgICAgICAgICAgfQotCisgICAgICAgICAgICBtTnVtQ2hhbm5lbHMgPSBvcHVzUGFyYW1zLT5uQ2hhbm5lbHM7CisgICAgICAgICAgICBtU2FtcGxpbmdSYXRlID0gb3B1c1BhcmFtcy0+blNhbXBsZVJhdGU7CiAgICAgICAgICAgICByZXR1cm4gT01YX0Vycm9yTm9uZTsKICAgICAgICAgfQogCkBAIC00OTYsNiArNDk5LDggQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihyZWludGVycHJldF9jYXN0PGlud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CAtMjY1LDE1ICsyNjksMTYgQEAKIAogYm9vbCBBTWVzc2FnZTo6Y29udGFpbnMoY29uc3QgY2hhciAqbmFtZSkgY29uc3QgewogICAgIHNpemVfdCBpID0gZmluZEl0ZW1JbmRleChuYW1lLCBzdHJsZW4obmFtZSkpOwotICAgIHJldHVybiBpIDwgbU51bUl0ZW1zOworICAgIHJldHVybiBpIDwgbUl0ZW1zLnNpemUoKTsKIH0KIAogI2RlZmluZSBCQVNJQ19UWVBFKE5BTUUsRklFTEROQU1FLFRZUEVOQU1FKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogdm9pZCBBTWVzc2FnZTo6c2V0IyNOQU1FKGNvbnN0IGNoYXIgKm5hbWUsIFRZUEVOQU1FIHZhbHVlKSB7ICAgICAgICAgICAgXAogICAgIEl0ZW0gKml0ZW0gPSBhbGxvY2F0ZUl0ZW0obmFtZSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIGl0ZW0tPm1UeXBlID0ga1R5cGUjI05BTUU7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIGl0ZW0tPnUuRklFTEROQU1FID0gdmFsdWU7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlmIChpdGVtKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBpdGVtLT5tVHlwZSA9IGtUeXBlIyNOQU1FOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBpdGVtLT51LkZJRUxETkFNRSA9IHZhbHVlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogLyogTk9MSU5UIGFkZGVkIHRvIGF2b2lkIGluY29ycmVjdCB3YXJuaW5nL2ZpeCBmcm9tIGNsYW5nLnRpZHkgKi8gICAgICAgXApAQCAtMjk4LDggKzMwMywxMCBAQAogdm9pZCBBTWVzc2FnZTo6c2V0U3RyaW5nKAogICAgICAgICBjb25zdCBjaGFyICpuYW1lLCBjb25zdCBjaGFyICpzLCBzc2l6ZV90IGxlbikgewogICAgIEl0ZW0gKml0ZW0gPSBhbGxvY2F0ZUl0ZW0obmFtZSk7Ci0gICAgaXRlbS0+bVR5cGUgPSBrVHlwZVN0cmluZzsKLSAgICBpdGVtLT51LnN0cmluZ1ZhbHVlID0gbmV3IEFTdHJpbmcocywgbGVuIDwgMCA/IHN0cmxlbihzKSA6IGxlbik7CisgICAgaWYgKGl0ZW0pIHsKKyAgICAgICAgaXRlbS0+bVR5cGUgPSBrVHlwZVN0cmluZzsKKyAgICAgICAgaXRlbS0+dS5zdHJpbmdWYWx1ZSA9IG5ldyBBU3RyaW5nKHMsIGxlbiA8IDAgPyBzdHJsZW4ocykgOiBsZW4pOworICAgIH0KIH0KIAogdm9pZCBBTWVzc2FnZTo6c2V0U3RyaW5nKApAQCAtMzEwLDEwICszMTcsMTIgQEAKIHZvaWQgQU1lc3NhZ2U6OnNldE9iamVjdEludGVybmFsKAogICAgICAgICBjb25zdCBjaGFyICpuYW1lLCBjb25zdCBzcDxSZWZCYXNlPiAmb2JqLCBUeXBlIHR5cGUpIHsKICAgICBJdGVtICppdGVtID0gYWxsb2NhdGVJdGVtKG5hbWUpOwotICAgIGl0ZW0tPm1UeXBlID0gdHlwZTs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AgICAgbUl0ZW1zW21OdW1JdGVtc10ubVR5cGUgPSBrVHlwZUludDMyOworICAgIHNpemVfdCBsYXN0SW5kZXggPSBtSXRlbXMuc2l6ZSgpIC0gMTsKKyAgICBpZiAoaW5kZXggPCBsYXN0SW5kZXgpIHsKKyAgICAgICAgbUl0ZW1zW2luZGV4XSA9IG1JdGVtc1tsYXN0SW5kZXhdOworICAgICAgICBtSXRlbXNbbGFzdEluZGV4XS5tTmFtZSA9IG51bGxwdHI7CisgICAgICAgIG1JdGVtc1tsYXN0SW5kZXhdLm1UeXBlID0ga1R5cGVJbnQzMjsKICAgICB9CisgICAgbUl0ZW1zLnBvcF9iYWNrKCk7CiAgICAgcmV0dXJuIE9LOwogfQogCitzdGF0dXNfdCBBTWVzc2FnZTo6cmVtb3ZlRW50cnlCeU5hbWUoY29uc3QgY2hhciAqbmFtZSkgeworICAgIGlmIChuYW1lID09IG51bGxwdHIpIHsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisgICAgc2l6ZV90IGluZGV4ID0gZmluZEVudHJ5QnlOYW1lKG5hbWUpOworICAgIGlmIChpbmRleCA+PSBtSXRlbXMuc2l6ZSgpKSB7CisgICAgICAgIHJldHVybiBCQURfSU5ERVg7CisgICAgfQorICAgIHJldHVybiByZW1vdmVFbnRyeUF0KGluZGV4KTsKK30KKwogdm9pZCBBTWVzc2FnZTo6c2V0SXRlbShjb25zdCBjaGFyICpuYW1lLCBjb25zdCBJdGVtRGF0YSAmaXRlbSkgewogICAgIGlmIChpdGVtLnVzZWQoKSkgewogICAgICAgICBJdGVtICppdCA9IGFsbG9jYXRlSXRlbShuYW1lKTsKICAgICAgICAgaWYgKGl0ICE9IG51bGxwdHIpIHsKLSAgICAgICAgICAgIHNldEVudHJ5QXQoaXQgLSBtSXRlbXMsIGl0ZW0pOworICAgICAgICAgICAgc2V0RW50cnlBdChpdCAtICZtSXRlbXNbMF0sIGl0ZW0pOwogICAgICAgICB9CiAgICAgfQogf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VyZSBpbnN0ZWFkIG9mIGFib3ZlIHdoZW4gaXQgYmVjb21lcyBzdXBwb3J0ZWQKICAgICAgICAgICAgIGV4Y2x1ZGVfc2hhcmVkX2xpYnM6IFsKICAgICAgICAgICAgICAgICAibGliYmluZGVyIiwKICAgICAgICAgICAgIF0sCkBAIC04Niw2ICsxMTAsMTQgQEAKICAgICAgICAgICAgICAgICAiLUROT19JTUVNT1JZIiwKICAgICAgICAgICAgIF0sCiAgICAgICAgIH0sCisgICAgICAgIGFwZXg6IHsKKyAgICAgICAgICAgIGV4Y2x1ZGVfc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgICAgICAgICAibGliYmluZGVyIiwKKyAgICAgICAgICAgIF0sCisgICAgICAgIH0sCisgICAgICAgIGRhcndpbjogeworICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsCisgICAgICAgIH0sCiAgICAgfSwKIAogICAgIGNsYW5nOiB0cnVlLApAQCAtMTE3LDMgKzE0OSw2NiBAQAogICAgICAgICAiLUROT19JTUVNT1JZIiwKICAgICBdLAogfQorCisvLyB0aGlzIGdldHMgbGlua2VkIGludG8gZXh0cmFjdG9ycyBpbiBtZWRpYSBtYWlubGluZSBtb2R1bGUKKy8vIHNvIG11c3QgYmUgbmRrIGFwaSAyOSBzbyB0aGF0IGl0IHJ1bnMgb24gPj1RCitjY19saWJyYXJ5X3N0YXRpYyB7CisgICAgbmFtZTogImxpYnN0YWdlZnJpZ2h0X2ZvdW5kYXRpb25fY29sb3J1dGlsc19uZGsiLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIHZlbmRvcl9hdmFpbGFibGU6IHRydWUsCisKKyAgICB0YXJnZXQ6IHsKKyAgICAgICAgZGFyd2luOiB7CisgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSwKKyAgICAgICAgfSwKKyAgICB9LAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmxvZyIsCisgICAgICAgICJsaWJ1dGlscyIsICAgICAgICAgICAgIC8vIGZvciBzcDw+CisgICAgICAgIC8vIGFjdHVhbGx5IGludm9rZXMgdGhpcywgYnV0IGNhbGxlZCBmcm9tIGZvbGtzIHdobyBhbHJlYWR5IGxvYWQgaXQKKyAgICAgICAgLy8gImxpYm1lZGlhbmRrIiwKKyAgICBdLAorCisgICAgaGVhZGVyX2xpYnM6IFsKKyAgICAgICAgLy8gdGhpcyBpcyBvbmx5IG5lZWRlZCBmb3IgdGhlIHZlbmRvciB2YXJpYW50IHRoYXQgcmVtb3ZlcyBsaWJiaW5kZXIsIGJ1dCB2ZW5kb3IKKyAgICAgICAgLy8gdGFyZ2V0IGJlbG93IGRvZXMgbm90IGFsbG93IGFkZGluZyBoZWFkZXJfbGlicy4KKyAgICAgICAgImxpYmJpbmRlcl9oZWFkZXJzIiwKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2ZvdW5kYXRpb25faGVhZGVycyIsCisgICAgICAgICJtZWRpYV9uZGtfaGVhZGVycyIsCisgICAgICAgICJtZWRpYV9wbHVnaW5faGVhZGVycyIsCisgICAgXSwKKworICAgIGxvY2FsX2luY2x1ZGVfZGlyczogWworICAgICAgICAiaW5jbHVkZS9tZWRpYS9zdGFnZWZyaWdodC9mb3VuZGF0aW9uIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV2Vycm9yIiwKKyAgICAgICAgIi1XYWxsIiwKKyAgICBdLAorCisgICAgc3JjczogWworICAgICAgICAiQ29sb3JVdGlsc19uZGsuY3BwIiwKKyAgICAgICAgIkNvbG9yVXRpbHNfZmlsbC5jcHAiLAorICAgIF0sCisKKyAgICBjbGFuZzogdHJ1ZSwKKworICAgIHNhbml0aXplOiB7CisgICAgICAgIG1pc2NfdW5kZWZpbmVkOiBbCisgICAgICAgICAgICAidW5zaWduZWQtaW50ZWdlci1vdmVyZmxvdyIsCisgICAgICAgICAgICAic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICBdLAorICA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PSBMT19VSU5UMTYoaW5mby5zVHlwZTEubVIueCk7CisgICAgZGF0YVsyXSA9IEhJX1VJTlQxNihpbmZvLnNUeXBlMS5tUi54KTsKKyAgICBkYXRhWzNdID0gTE9fVUlOVDE2KGluZm8uc1R5cGUxLm1SLnkpOworICAgIGRhdGFbNF0gPSBISV9VSU5UMTYoaW5mby5zVHlwZTEubVIueSk7CisKKyAgICAvLyBkaXNwbGF5IHByaW1hcnkgMQorICAgIGRhdGFbNV0gPSBMT19VSU5UMTYoaW5mby5zVHlwZTEubUcueCk7CisgICAgZGF0YVs2XSA9IEhJX1VJTlQxNihpbmZvLnNUeXBlMS5tRy54KTsKKyAgICBkYXRhWzddID0gTE9fVUlOVDE2KGluZm8uc1R5cGUxLm1HLnkpOworICAgIGRhdGFbOF0gPSBISV9VSU5UMTYoaW5mby5zVHlwZTEubUcueSk7CisKKyAgICAvLyBkaXNwbGF5IHByaW1hcnkgMgorICAgIGRhdGFbOV0gPSBMT19VSU5UMTYoaW5mby5zVHlwZTEubUIueCk7CisgICAgZGF0YVsxMF0gPSBISV9VSU5UMTYoaW5mby5zVHlwZTEubUIueCk7CisgICAgZGF0YVsxMV0gPSBMT19VSU5UMTYoaW5mby5zVHlwZTEubUIueSk7CisgICAgZGF0YVsxMl0gPSBISV9VSU5UMTYoaW5mby5zVHlwZTEubUIueSk7CisKKyAgICAvLyB3aGl0ZSBwb2ludAorICAgIGRhdGFbMTNdID0gTE9fVUlOVDE2KGluZm8uc1R5cGUxLm1XLngpOworICAgIGRhdGFbMTRdID0gSElfVUlOVDE2KGluZm8uc1R5cGUxLm1XLngpOworICAgIGRhdGFbMTVdID0gTE9fVUlOVDE2KGluZm8uc1R5cGUxLm1XLnkpOworICAgIGRhdGFbMTZdID0gSElfVUlOVDE2KGluZm8uc1R5cGUxLm1XLnkpOworCisgICAgLy8gTWF4RGlzcGxheUx1bWluYW5jZQorICAgIGRhdGFbMTddID0gTE9fVUlOVDE2KGluZm8uc1R5cGUxLm1NY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sICZpbmRleCk7CisgICAgICAgIGlmIChjID09IC0xKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIHN3aXRjaCAoYykgeworICAgICAgICAgICAgY2FzZSAnUCc6IHsKKyAgICAgICAgICAgICAgICBzZXRSZXMob3B0YXJnKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpZiAob3B0aW5kIDwgYXJnYykgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwKKyAgICAgICAgICAgICAgICAidW5yZWNvZ25pemVkIG9wdGlvbjogJXNcblxuIgorICAgICAgICAgICAgICAgICJ1c2FnZTogJXMgPGd0ZXN0IG9wdGlvbnM+IDx0ZXN0IG9wdGlvbnM+XG5cbiIKKyAgICAgICAgICAgICAgICAidGVzdCBvcHRpb25zIGFyZTpcblxuIgorICAgICAgICAgICAgICAgICItUCwgLS1wYXRoOiBSZXNvdXJjZSBmaWxlcyBkaXJlY3RvcnkgbG9jYXRpb25cbiIsCisgICAgICAgICAgICAgICAgYXJndltvcHRpbmQgPzogMV0sIGFyZ3ZbMF0pOworICAgICAgICByZXR1cm4gMjsKKyAgICB9CisgICAgcmV0dXJuIDA7Cit9CisKKyNlbmRpZiAgLy8gX19BVkNfVVRJTFNfVEVTVF9FTlZJUk9OTUVOVF9IX18KZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L2ZvdW5kYXRpb24vdGVzdHMvQVZDVXRpbHMvQVZDVXRpbHNVbml0VGVzdC5jcHAgYi9tZWRpYS9saWJzdGFnZWZyaWdodC9mb3VuZGF0aW9uL3Rlc3RzL0FWQ1V0aWxzL0FWQ1V0aWxzVW5pdFRlc3QuY3BwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjc3YTg1OT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GVuZ3RoKTsKKyAgICAgICAgICAgIGJvb2wgaXNSZWZlcmVuY2VGcmFtZSA9IElzQVZDUmVmZXJlbmNlRnJhbWUoYWNjZXNzVW5pdCk7CisgICAgICAgICAgICBBU1NFUlRfVFJVRShpc1JlZmVyZW5jZUZyYW1lKTsKKworICAgICAgICAgICAgYWNjZXNzVW5pdC5jbGVhcigpOworICAgICAgICAgICAgbGF5ZXJJRCA9IEZpbmRBVkNMYXllcklkKCh1aW50OF90ICopZGF0YSwgY2h1bmtMZW5ndGgpOworICAgICAgICAgICAgQVNTRVJUX0VRKGxheWVySUQsIGZyYW1lTGF5ZXJJRCkgPDwgIldyb25nIGxheWVyIElEIGZvdW5kIjsKKyAgICAgICAgfQorICAgICAgICBkZWxldGVbXSBkYXRhOworICAgIH0KK30KKworSU5TVEFOVElBVEVfVEVTVF9TVUlURV9QKEFWQ1V0aWxzVGVzdEFsbCwgTXBlZ0F1ZGlvVW5pdFRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgOjp0ZXN0aW5nOjpWYWx1ZXMobWFrZV90dXBsZSgweEZGRkI5MjA0LCA0MTgsIDQ0MTAwLCAyLCAxMjgsIDExNTIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoMHhGRkZCNzYwNCwgMjg5LCA0ODAwMCwgMiwgOTYsIDExNTIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoMHhGRkZFNTYwNCwgMTY0LCA0ODAwMCwgMiwgMTYwLCAzODQpKSk7CisKKy8vIEluZm8gRmlsZSBjb250YWlucyB0aGUgdHlwZSBhbmQgbGVuZ3RoIGZvciBlYWNoIGNodW5rL2ZyYW1lCitJTlNUQU5USUFURV9URVNUX1NVSVRFX1AoCisgICAgICAgIEFWQ1V0aWxzVGVzdEFsbCwgQVZDRGltZW5zaW9uVGVzdCwKKyAgICAgICAgOjp0ZXN0aW5nOjpWYWx1ZXMobWFrZV90dXBsZSgiY3Jvd2RfOHg4cDUwZjMyXzIwMGticHNfYnAuaDI2NCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNyb3dkXzh4OHA1MGYzMl8yMDBrYnBzX2JwLmluZm8iLCA4LCA4LCAxMSksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoImNyb3dkXzY0MHgzNjBwMjRmMzAwXzEwMDBrYnBzX2JwLmgyNjQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJjcm93ZF82NDB4MzYwcDI0ZjMwMF8xMDAwa2Jwc19icC5pbmZvIiwgNjQwLCAzNjAsIDExKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgiY3Jvd2RfMTI4MHg3MjBwMzBmMzAwXzUwMDBrYnBzX2JwLmgyNjQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJjcm93ZF8xMjgweDcyMHAzMGYzMDBfNTAwMGticHNfYnAuaW5mbyIsIDEyODAsIDcyMCwgMTIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJjcm93ZF8xOTIweDEwODBwNTBmMzAwXzEyMDAwa2Jwc19icC5oMjY0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY3Jvd2RfMTkyMHgxMDgwcDUwZjMwMF8xMjAwMGticHNfYnAuaW5mbyIsIDE5MjAsIDEwODAsIDE0KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgiY3Jvd2RfMzg0MHgyMTYwcDYwZjMwMF82ODAwMGticHNfYnAuaDI2NCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNyb3dkXzM4NDB4MjE2MHA2MGYzMDBfNjgwMDBrYnBzX2JwLmluZm8iLCAzODQwLCAyMTYwLCAxNCkpKTsKKworLy8gSW5mbyB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IiwgNzIwLCA0ODApLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoInZvbERhdGFfMTI4MF83MjAiLCAxMjgwLCA3MjApLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoInZvbERhdGFfMTkyMF8xMDgwIiwgMTkyMCwgMTA4MCkpKTsKKworLy8gSW5mbyBGaWxlIGNvbnRhaW5zIHRoZSB0eXBlLCBsZW5ndGggYW5kIGxheWVyIElEIGZvciBlYWNoIGNodW5rL2ZyYW1lCitJTlNUQU5USUFURV9URVNUX1NVSVRFX1AoQVZDVXRpbHNUZXN0QWxsLCBBVkNGcmFtZVRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgOjp0ZXN0aW5nOjpWYWx1ZXMobWFrZV90dXBsZSgiY3Jvd2RfOHg4cDUwZjMyXzIwMGticHNfYnAuaDI2NCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY3Jvd2RfOHg4cDUwZjMyXzIwMGticHNfYnAuaW5mbyIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoImNyb3dkXzY0MHgzNjBwMjRmMzAwXzEwMDBrYnBzX2JwLmgyNjQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNyb3dkXzY0MHgzNjBwMjRmMzAwXzEwMDBrYnBzX2JwLmluZm8iKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJjcm93ZF8xMjgweDcyMHAzMGYzMDBfNTAwMGticHNfYnAuaDI2NCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY3Jvd2RfMTI4MHg3MjBwMzBmMzAwXzUwMDBrYnBzX2JwLmluZm8iKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJjcm93ZF8xOTIweDEwODBwNTBmMzAwXzEyMDAwa2Jwc19icC5oMjY0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJjcm93ZF8xOTIweDEwODBwNTBmMzAwXzEyMDAwa2Jwc19icC5pbmZvIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgiY3Jvd2RfMzg0MHgyMTYwcDYwZjMwMF82ODAwMGticHNfYnAuaDI2NCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY3Jvd2RfMzg0MHgyMTYwcDYwZjMwMF82ODAwMGticHNfYnAuaW5mbyIpKSk7CisKK2ludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikgeworICAgIGdFbnYgPSBuZXcgQVZDVXRpbHNUZXN0RW52aXJvbm1lbnQoKTsKKyAgICA6OnRlc3Rpbmc6OkFkZEdsb2JhbFRlc3RFbnZpcm9ubWVudChnRW52KTsKKyAgICA6OnRlc3Rpbmc6OkluaXRHb29nbGVUZXN0KCZhcmdjLCBhcmd2KTsKKyAgICBpbnQgc3RhdHVzID0gZ0Vudi0+aW5pdEZyb21PcHRpb25zKGFyZ2MsIGFyZ3YpOworICAgIGlmIChzdGF0dXMgPT0gMCkgeworICAgICAgICBzdGF0dXMgPSBSVU5fQUxMX1RFU1RTKCk7CisgICAgICAgIEFMT0dWKCJUZXN0IHJlc3VsdCA9ICVkXG4iLCBzdGF0dXMpOworICAgIH0KKyAgICByZXR1cm4gc3RhdHVzOworfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGlic3RhZ2VmcmlnaHQvZm91bmRhdGlvbi90ZXN0cy9BVkNVdGlscy9BbmRyb2lkLmJwIGIvbWVkaWEvbG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AgIHswLCAyLCAxfSwKKyAgICAgICAgezAsIDEsIDIsIDN9LAorICAgICAgICB7MCwgNCwgMSwgMiwgM30sCisgICAgICAgIHswLCA0LCAxLCAyLCAzLCA1fSwKKyAgICAgICAgezAsIDQsIDEsIDIsIDMsIDUsIDZ9LAorICAgICAgICB7MCwgNiwgMSwgMiwgMywgNCwgNSwgN30sCit9OworCitzdGF0aWMgT3B1c0hlYWRlclRlc3RFbnZpcm9ubWVudCAqZ0VudiA9IG51bGxwdHI7CisKK2NsYXNzIE9wdXNIZWFkZXJUZXN0IHsKKyAgcHVibGljOgorICAgIE9wdXNIZWFkZXJUZXN0KCkgOiBtSW5wdXRCdWZmZXIobnVsbHB0cikge30KKworICAgIH5PcHVzSGVhZGVyVGVzdCgpIHsKKyAgICAgICAgaWYgKG1FbGVTdHJlYW0uaXNfb3BlbigpKSBtRWxlU3RyZWFtLmNsb3NlKCk7CisgICAgICAgIGlmIChtSW5wdXRCdWZmZXIpIHsKKyAgICAgICAgICAgIGZyZWUobUlucHV0QnVmZmVyKTsKKyAgICAgICAgICAgIG1JbnB1dEJ1ZmZlciA9IG51bGxwdHI7CisgICAgICAgIH0KKyAgICB9CisgICAgaWZzdHJlYW0gbUVsZVN0cmVhbTsKKyAgICB1aW50OF90ICptSW5wdXRCdWZmZXI7Cit9OworCitjbGFzcyBPcHVzSGVhZGVyUGFyc2VUZXN0IDogcHVibGljIE9wdXNIZWFkZXJUZXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyA6OnRlc3Rpbmc6OlRlc3RXaXRoUGFyYW08CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dXBsZTxzdHJpbmcgLyogSW5wdXRGaWxlTmFtZSAqLywgaW50MzJfdCAvKiBDaGFubmVsQ291bnQgKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIC8qIGlzSGVhZGVyVmFsaWQgKi8sIGJvb2wgLyogaXNDb2RlY0RlbGF5VmFsaWQgKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIC8qIGlzU2Vla1ByZVJvbGxWYWxpZCAqLywgYm9vbCAvKiBpc0lucHV0VmFsaWQgKi8+PiB7Cit9OworCitjbGFzcyBPcHVzSGVhZGVyV3JpdGVUZXN0CisgICAgOiBwdWJsaWMgT3B1c0hlYWRlclRlc3QsCisgICAgICBwdWJsaWMgOjp0ZXN0aW5nOjpUZXN0V2l0aFBhcmFtPHR1cGxlPGludDMyX3QgLyogQ2hhbm5lbENvdW50ICovLCBpbnQzMl90IC8qIHNraXBTYW1wbGVzICovLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgLyogcmVmZXJlbmNlRmlsZSAqLz4+IHt9OworCitURVNUX1AoT3B1c0hlYWRlcldyaXRlVGVzdCwgV3JpdGVUZXN0KSB7CisgICAgdHVwbGU8aW50MzJfdCwgaW50MzJfdCwgc3RyaW5nPiBwYXJhbXMgPSBHZXRQYXJhbSgpOworICAgIE9wdXNIZWFkZXIgd3JpdHRlbkhlYWRlcjsKKyAgICBtZW1zZXQoJndyaXR0ZW5IZWFkZXIsIDAsIHNpemVvZih3cml0dGVuSGVhZGVyKSk7CisgICAgaW50MzJfdCBjaGFubmVscyA9IGdldDwwPihwYXJhbXMpOworICAgIHdyaXR0ZW5IZWFkZXIuY2hhbm5lbHMgPSBjaGFubmVsczsKKyAgICB3cml0dGVuSGVhZGVyLm51bV9zdHJlYW1zID0gY2hhbm5lbHM7CisgICAgd3JpdHRlbkhlYWRlci5jaGFubmVsX21hcHBpbmcgPSAoKGNoYW5uZWxzID4gOCkgPyAyNTUgOiAoY2hhbm5lbHMgPiAyKSk7CisgICAgaW50MzJfdCBza2lwU2FtcGxlcyA9IGdldDwxPihwYXJhbXMpOworICAgIHN0cmluZyByZWZlcmVuY2VGaWxlTmFtZSA9IGdFbnYtPmdldFJlcygpICsgZ2V0PD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JpdHRlbi4gSGVhZGVyIHNpemUgc2hvdWxkIGJlIGVxdWFsIHRvIDg2ICsgIgorICAgICAgICAgICAgICAgICAgICJ3cml0dGVuSGVhZGVyLmNoYW5uZWxzIjsKKworICAgICAgICB1aW50OF90IG1hcHBlZENoYW5uZWxOdW1iZXI7CisgICAgICAgIGZvciAoaW50MzJfdCBjaGFubmVsTnVtYmVyID0gMDsgY2hhbm5lbE51bWJlciA8IGNoYW5uZWxzOyBjaGFubmVsTnVtYmVyKyspIHsKKyAgICAgICAgICAgIG1hcHBlZENoYW5uZWxOdW1iZXIgPSAqKHJlaW50ZXJwcmV0X2Nhc3Q8dWludDhfdCAqPihvcHVzSGVhZEJ1ZikgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga09wdXNIZWFkZXJTdHJlYW1NYXBPZmZzZXQgKyBjaGFubmVsTnVtYmVyKTsKKyAgICAgICAgICAgIEFTU0VSVF9MVChtYXBwZWRDaGFubmVsTnVtYmVyLCBjaGFubmVscykgPDwgIkludmFsaWQgaGVhZGVyIGdlbmVyYXRlZC4gQ2hhbm5lbCBtYXBwaW5nICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNhbm5vdCBiZSBncmVhdGVyIHRoYW4gY2hhbm5lbCBjb3VudC4iOworCisgICAgICAgICAgICBBU1NFUlRfRVEobWFwcGVkQ2hhbm5lbE51bWJlciwga09wdXNDaGFubmVsTWFwW2NoYW5uZWxzIC0gMV1bY2hhbm5lbE51bWJlcl0pCisgICAgICAgICAgICAgICAgICAgIDw8ICJJbnZhbGlkIGhlYWRlciBnZW5lcmF0ZWQuIENoYW5uZWwgbWFwcGluZyBpcyBub3QgYXMgcGVyIHNwZWNpZmljYXRpb24uIjsKKyAgICAgICAgfQorICAgIH0gZWxzZSB7CisgICAgICAgIEFTU0VSVF9MRShwYXJzZWRIZWFkZXIuY2hhbm5lbHMsIDIpOworICAgIH0KK30KKworVEVTV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YW5ub3QgYmUgZ3JlYXRlciB0aGFuIG51bWJlciAiCisgICAgICAgICAgICAgICAib2Ygc3RyZWFtcy4iOworCisgICAgQVNTRVJUX0VRKGhlYWRlci5udW1fY291cGxlZCArIGhlYWRlci5udW1fc3RyZWFtcywgaGVhZGVyLmNoYW5uZWxzKTsKKworICAgIGlmIChoZWFkZXIuY2hhbm5lbF9tYXBwaW5nKSB7CisgICAgICAgIHVpbnQ4X3QgbWFwcGVkQ2hhbm5lbE51bWJlcjsKKyAgICAgICAgZm9yIChpbnQzMl90IGNoYW5uZWxOdW1iZXIgPSAwOyBjaGFubmVsTnVtYmVyIDwgY2hhbm5lbHM7IGNoYW5uZWxOdW1iZXIrKykgeworICAgICAgICAgICAgbWFwcGVkQ2hhbm5lbE51bWJlciA9ICoocmVpbnRlcnByZXRfY2FzdDx1aW50OF90ICo+KG9wdXNIZWFkQnVmKSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrT3B1c0hlYWRlclN0cmVhbU1hcE9mZnNldCArIGNoYW5uZWxOdW1iZXIpOworICAgICAgICAgICAgQVNTRVJUX0xUKG1hcHBlZENoYW5uZWxOdW1iZXIsIGNoYW5uZWxzKQorICAgICAgICAgICAgICAgICAgICA8PCAiSW52YWxpZCBoZWFkZXIuIENoYW5uZWwgbWFwcGluZyBjYW5ub3QgYmUgZ3JlYXRlciB0aGFuIGNoYW5uZWwgY291bnQuIjsKKworICAgICAgICAgICAgQVNTRVJUX0VRKG1hcHBlZENoYW5uZWxOdW1iZXIsIGtPcHVzQ2hhbm5lbE1hcFtjaGFubmVscyAtIDFdW2NoYW5uZWxOdW1iZXJdKQorICAgICAgICAgICAgICAgICAgICA8PCAiSW52YWxpZCBoZWFkZXIgZ2VuZXJhdGVkLiBDaGFubmVsIG1hcHBpbmcgIgorICAgICAgICAgICAgICAgICAgICAgICAiaXMgbm90IGFzIHBlciBzcGVjaWZpY2F0aW9uLiI7CisgICAgICAgIH0KKyAgICB9Cit9CisKK0lOU1RBTlRJQVRFX1RFU1RfU1VJVEVfUCgKKyAgICAgICAgT3B1c0hlYWRlclRlc3RBbGwsIE9wdXNIZWFkZXJXcml0ZVRlc3QsCisgICAgICAgIDo6dGVzdGluZzo6VmFsdWVzKG1ha2VfdHVwbGUoMSwgMzEyLCAib3V0cHV0X2NoYW5uZWxzXzFza2lwU2FtcGxlc18zMTIub3B1cyIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKDIsIDMxMiwgIm91dHB1dF9jaGFubmVsc18yc2tpcFNhbXBsZXNfMzEyLm9wdXMiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV90dXBsZSg1LCAzMTIsICJvdXRwdXRfY2hhbm5lbHNfNXNraXBTYW1wbGVzXzMxMi5vcHVzIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoNiwgMzEyLCAib3V0cHV0X2NoYW5uZWxzXzZza2lwU2FtcGxlc18zMTIub3B1cyIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKDEsIDAsICJvdXRwdXRfY2hhbm5lbHNfMXNraXBTYW1wbGVzXzAub3B1cyIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKDIsIDAsICJvdXRwdXRfY2hhbm5lbHNfMnNraXBTYW1wbGVzXzAub3B1cyIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKDUsIDAsICJvdXRwdXRfY2hhbm5lbHNfNXNraXBTYW1wbGVzXzAub3B1cyIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKDYsIDAsICJvdXRwdXRfY2hhbm5lbHNfNnNraXBTYW1wbGVzXzAub3B1cyIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKDEsIDYyNCwgIm91dHB1dF9jaGFubmVsc18xc2tpcFNhbXBsZXNfNjI0Lm9wdXMiKSwKKy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gIC8vIFBhcnNlcyB0aGUgY29tbWFuZCBsaW5lIGFyZ3VtZW50cworICAgIGludCBpbml0RnJvbU9wdGlvbnMoaW50IGFyZ2MsIGNoYXIgKiphcmd2KTsKKworICAgIHZvaWQgc2V0UmVzKGNvbnN0IGNoYXIgKl9yZXMpIHsgcmVzID0gX3JlczsgfQorCisgICAgY29uc3Qgc3RyaW5nIGdldFJlcygpIGNvbnN0IHsgcmV0dXJuIHJlczsgfQorCisgIHByaXZhdGU6CisgICAgc3RyaW5nIHJlczsKK307CisKK2ludCBPcHVzSGVhZGVyVGVzdEVudmlyb25tZW50Ojppbml0RnJvbU9wdGlvbnMoaW50IGFyZ2MsIGNoYXIgKiphcmd2KSB7CisgICAgc3RhdGljIHN0cnVjdCBvcHRpb24gb3B0aW9uc1tdID0ge3sicGF0aCIsIHJlcXVpcmVkX2FyZ3VtZW50LCAwLCAnUCd9LCB7MCwgMCwgMCwgMH19OworCisgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgaW50IGluZGV4ID0gMDsKKyAgICAgICAgaW50IGMgPSBnZXRvcHRfbG9uZyhhcmdjLCBhcmd2LCAiUDoiLCBvcHRpb25zLCAmaW5kZXgpOworICAgICAgICBpZiAoYyA9PSAtMSkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBzd2l0Y2ggKGMpIHsKKyAgICAgICAgICAgIGNhc2UgJ1AnOiB7CisgICAgICAgICAgICAgICAgc2V0UmVzKG9wdGFyZyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCisgICAgaWYgKG9wdGluZCA8IGFyZ2MpIHsKKyAgICAgICAgZnByaW50ZihzdGRlcnIsCisgICAgICAgICAgICAgICAgInVucmVjb2duaXplZCBvcHRpb246ICVzXG5cbiIKKyAgICAgICAgICAgICAgICAidXNhZ2U6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ZzOworfTsKKworY2xhc3MgSXNvVG9QbGF0Zm9ybUFzcGVjdHNUZXN0IDogcHVibGljIDo6dGVzdGluZzo6VGVzdFdpdGhQYXJhbTxzdGQ6OnR1cGxlPAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBQcmltYXJpZXMgKi8gQ0E6OlByaW1hcmllcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogVHJhbnNmZXIgKi8gQ0E6OlRyYW5zZmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBNYXRyaXhDb2VmZnMgKi8gQ0E6Ok1hdHJpeENvZWZmcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogU3RhbmRhcmQgKi8gaW50MzJfdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogVHJhbnNmZXIgKi8gaW50MzJfdD4+IHsKKyAgcHVibGljOgorICAgIElzb1RvUGxhdGZvcm1Bc3BlY3RzVGVzdCgpIHsKKyAgICAgICAgbVByaW1hcmllcyA9IHN0ZDo6Z2V0PDA+KEdldFBhcmFtKCkpOworICAgICAgICBtVHJhbnNmZXIgPSBzdGQ6OmdldDwxPihHZXRQYXJhbSgpKTsKKyAgICAgICAgbU1hdHJpeENvZWZmcyA9IHN0ZDo6Z2V0PDI+KEdldFBhcmFtKCkpOworICAgICAgICBtUGxhdGZvcm1TdGFuZGFyZCA9IHN0ZDo6Z2V0PDM+KEdldFBhcmFtKCkpOworICAgICAgICBtUGxhdGZvcm1UcmFuc2ZlciA9IHN0ZDo6Z2V0PDQ+KEdldFBhcmFtKCkpOworICAgIH07CisKKyAgICBDQTo6UHJpbWFyaWVzIG1QcmltYXJpZXM7CisgICAgQ0E6OlRyYW5zZmVyIG1UcmFuc2ZlcjsKKyAgICBDQTo6TWF0cml4Q29lZmZzIG1NYXRyaXhDb2VmZnM7CisgICAga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ZmZzOworICAgIENBOjpSYW5nZSBtUmFuZ2U7CisgICAgQ0E6OlN0YW5kYXJkIG1TdGFuZGFyZDsKK307CisKK2NsYXNzIERlZmF1bHRDb2xvckFzcGVjdHNUZXN0IDogcHVibGljIDo6dGVzdGluZzo6VGVzdFdpdGhQYXJhbTxzdGQ6OnR1cGxlPAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFdpZHRoICovIGludDMyX3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogSGVpZ2h0ICovIGludDMyX3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogUHJpbWFyaWVzICovIENBOjpQcmltYXJpZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogTWF0cml4Q29lZmZzICovIENBOjpNYXRyaXhDb2VmZnM+PiB7CisgIHB1YmxpYzoKKyAgICBEZWZhdWx0Q29sb3JBc3BlY3RzVGVzdCgpIHsKKyAgICAgICAgbVdpZHRoID0gc3RkOjpnZXQ8MD4oR2V0UGFyYW0oKSk7CisgICAgICAgIG1IZWlnaHQgPSBzdGQ6OmdldDwxPihHZXRQYXJhbSgpKTsKKyAgICAgICAgbVByaW1hcmllcyA9IHN0ZDo6Z2V0PDI+KEdldFBhcmFtKCkpOworICAgICAgICBtTWF0cml4Q29lZmZzID0gc3RkOjpnZXQ8Mz4oR2V0UGFyYW0oKSk7CisgICAgfTsKKworICAgIGludDMyX3QgbVdpZHRoOworICAgIGludDMyX3QgbUhlaWdodDsKKyAgICBDQTo6UHJpbWFyaWVzIG1QcmltYXJpZXM7CisgICAgQ0E6Ok1hdHJpeENvZWZmcyBtTWF0cml4Q29lZmZzOworfTsKKworY2xhc3MgRGF0YVNwYWNlVGVzdCA6IHB1YmxpYyA6OnRlc3Rpbmc6OlRlc3RXaXRoUGFyYW08c3RkOjp0dXBsZTwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIENvbG9yUmFuZ2UgKi8gQ0E6OlJhbmdlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogUHJpbWFyaWVzICovIENBOjpQcmltYXJpZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBDb2xvclRyYW5zZmVyICovIENBOjpUcmFuc2ZlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE1hdHJpeENvZWZmcyAqLyBDQTo6TWF0cml4Q29lZmZzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogdjBfYW5kcm9pZF9kYXRhc3BhY2UgKi8gYW5kcm9pZF9kYXRhc3BhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBhbmRyb2lkX2RhdGFzcGFjZSAqLyBhbmRyb2lkX2RhdGFzcGFjZT4+IHsKKyAgcHVibGljOgorICAgIERhdGFTcGFjZVRlc3QoKSB7CisgICAgICAgIG1SYW5nZSA9IHN0ZDo6Z2V0PDA+KEdldFBhcmFtKCkpOworICAgICAgICBtUHJpbWFyaWVzID0gc3RkOjpnZXQ8MT4oR2V0UGFyYW0oKSk7CisgICAgICAgIG1UcmFuc2ZlciA9IHN0ZDo6Z2V0PDI+KEdldFBhcmFtKCkpOworICAgICAgICBtTWF0cml4Q29lZmZzID0gc3RkOjpnZXQ8Mz4oR2V0UGFyYW0oKSk7CisgICAgICAgIG1EYXRhU3BhY2VWMCA9IHN0ZDo6Z2V0PDQ+KEdldFBhcmFtKCkpOworICAgICAgICBtRGF0YVNwYWNlID0gc3RkOjpnZXQ8NT4oR2V0UGFyYW0oKSk7CisgICAgfTsKKworICAgIENBOjpSYW5nZSBtUmFuZ2U7CisgICAgQ0E6OlByaW1hcmllcyBtUHJpbWFyaWVzOworICAgIENBOjpUcmFuc2ZlciBtVHJhbnNmZXI7CisgICAgQ0E6Ok1hdHJpeENvZWZmcyBtTWF0cml4Q29lZmZzOworICAgIGFuZHJvaWRfZGF0YXNwY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XMgPSBtUHJpbWFyaWVzOworICAgIGFzcGVjdHMubVRyYW5zZmVyID0gbVRyYW5zZmVyOworICAgIGFzcGVjdHMubU1hdHJpeENvZWZmcyA9IG1NYXRyaXhDb2VmZnM7CisKKyAgICBpbnQzMl90IHByaW1hcmllcyA9IC0xOworICAgIGludDMyX3QgY29sb3JUcmFuc2ZlciA9IC0xOworICAgIGludDMyX3QgbWF0cml4Q29lZmZzID0gLTE7CisgICAgYm9vbCBmdWxsUmFuZ2UgPSBmYWxzZTsKKyAgICBDb2xvclV0aWxzOjpjb252ZXJ0Q29kZWNDb2xvckFzcGVjdHNUb0lzb0FzcGVjdHMoYXNwZWN0cywgJnByaW1hcmllcywgJmNvbG9yVHJhbnNmZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZtYXRyaXhDb2VmZnMsICZmdWxsUmFuZ2UpOworCisgICAgQ0EgcmV0dXJuZWRBc3BlY3RzOworICAgIENvbG9yVXRpbHM6OmNvbnZlcnRJc29Db2xvckFzcGVjdHNUb0NvZGVjQXNwZWN0cyhwcmltYXJpZXMsIGNvbG9yVHJhbnNmZXIsIG1hdHJpeENvZWZmcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVsbFJhbmdlLCByZXR1cm5lZEFzcGVjdHMpOworICAgIEVYUEVDVF9FUShyZXR1cm5lZEFzcGVjdHMubVJhbmdlLCBhc3BlY3RzLm1SYW5nZSkKKyAgICAgICAgICAgIDw8ICJyYW5nZSBtaXNtYXRjaCBmb3IgY29udmVyc2lvbiBiZXR3ZWVuIElzb0FzcGVjdHMiOworICAgIEVYUEVDVF9FUShyZXR1cm5lZEFzcGVjdHMubVByaW1hcmllcywgYXNwZWN0cy5tUHJpbWFyaWVzKQorICAgICAgICAgICAgPDwgInByaW1hcmllcyBtaXNtYXRjaCBmb3IgY29udmVyc2lvbiBiZXR3ZWVuIElzb0FzcGVjdH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FzcGVjdHMoCisgICAgICAgICAgICBhc3BlY3RzLCAmY29sb3JSYW5nZSwgJmNvbG9yU3RhbmRhcmQsICZjb2xvclRyYW5zZmVyKTsKKyAgICBFWFBFQ1RfTkUoc3RhdHVzLCBPSykgPDwgImludmFsaWQgY29sb3JBc3BlY3RzIHZhbHVlIGFjY2VwdGVkIjsKKworICAgIGludDMyX3QgY29sb3JQcmltYXJpZXMgPSAtMTsKKyAgICBjb2xvclRyYW5zZmVyID0gLTE7CisgICAgaW50MzJfdCBjb2xvck1hdHJpeENvZWZmcyA9IC0xOworICAgIGJvb2wgZnVsbFJhbmdlID0gZmFsc2U7CisgICAgYXNwZWN0cy5tUHJpbWFyaWVzID0gQ0E6OlByaW1hcmllc090aGVyOworICAgIGFzcGVjdHMubVRyYW5zZmVyID0gQ0E6OlRyYW5zZmVyT3RoZXI7CisgICAgYXNwZWN0cy5tTWF0cml4Q29lZmZzID0gQ0E6Ok1hdHJpeE90aGVyOworICAgIENvbG9yVXRpbHM6OmNvbnZlcnRDb2RlY0NvbG9yQXNwZWN0c1RvSXNvQXNwZWN0cyhhc3BlY3RzLCAmY29sb3JQcmltYXJpZXMsICZjb2xvclRyYW5zZmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmY29sb3JNYXRyaXhDb2VmZnMsICZmdWxsUmFuZ2UpOworICAgIENBIHJldHVybmVkQXNwZWN0czsKKyAgICBDb2xvclV0aWxzOjpjb252ZXJ0SXNvQ29sb3JBc3BlY3RzVG9Db2RlY0FzcGVjdHMoY29sb3JQcmltYXJpZXMsIGNvbG9yVHJhbnNmZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbG9yTWF0cml4Q29lZmZzLCBmdWxsUmFuZ2UsIHJldHVybmVkQXNwZWN0cyk7CisgICAgRVhQRUNUX0VRKHJldHVybmVkQXNwZWN0cy5tUHJpbWFyaWVzLCBDQT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VbnNwZWNpZmllZCksCisgICAgICAgICAgICAgICAgc3RkOjptYWtlX3BhaXIoQ0E6OlByaW1hcmllczo6UHJpbWFyaWVzQlQ3MDlfNSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhCVDcwOV81KSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfcGFpcihDQTo6UHJpbWFyaWVzOjpQcmltYXJpZXNCVDYwMV82XzYyNSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhCVDYwMV82KSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfcGFpcihDQTo6UHJpbWFyaWVzOjpQcmltYXJpZXNCVDYwMV82XzYyNSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhCVDcwOV81KSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfcGFpcihDQTo6UHJpbWFyaWVzOjpQcmltYXJpZXNCVDYwMV82XzUyNSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhCVDYwMV82KSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfcGFpcihDQTo6UHJpbWFyaWVzOjpQcmltYXJpZXNCVDYwMV82XzUyNSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhTTVBURTI0ME0pLAorICAgICAgICAgICAgICAgIHN0ZDo6bWFrZV9wYWlyKENBOjpQcmltYXJpZXM6OlByaW1hcmllc0JUMjAyMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhCVDIwMjApLAorICAgICAgICAgICAgICAgIHN0ZDo6bWFrZV9wYWlyKENBOjpQcmltYXJpZXM6OlByaW1hcmllc0JUMjAyMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhCVDIwMjBDb25zdGFudCksCisgICAgICAgICAgICAgICAgc3RkOjptYWtlX3BhaXIoQ0E6OlByaW1hcmllczo6UHJpbWFyaWVzQlQ0NzBfNk0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0E6Ok1hdHJpeENvZWZmczo6TWF0cml4QlQ0NzBfNk0pLAorICAgICAgICAgICAgICAgIHN0ZDo6bWFrZV9wYWlyKENBOjpQcmltYXJpZXM6OlByaW1hcmllc0dlbmVyaWNGaWxtLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENBOjpNYXRyaXhDb2VmZnM6Ok1hdHJpeEJUMjAyMCkpKTsKKworSU5TVEFOVElBVEVfVEVTVF9TVUlURV9QKAorICAgICAgICBDb2xvclV0aWxzVW5pdFRlc3QsIENvbG9yQXNwZWN0c1Rlc3QsCisgICAgICAgIDo6dGVzdGluZzo6VmFsdWVzKAorICAgICAgICAgICAgICAgIC8vIFByaW1hcmllcywgQ29sb3JUcmFuc2ZlciwgTWF0cml4Q29lZmZzLCBDb2xvclJhbmdlLCBDb2xvclN0YW5kYXJkCisgICAgICAgICAgICAgICAgc3RkOjptYWtlX3R1cGxlKENBOjpQcmltYXJpZXM6OlByaW1hcmllc1Vuc3BlY2lmaWVkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6VHJhbnNmZXI6OlRyYW5zZmVyVW5zcGVjaWZpZWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENBOjpNYXRyaXhDb2VmZnM6Ok1hdHJpeFVuc3BlY2lmaWVkLCBDQTo6UmFuZ2U6OlJhbmdlRnVsbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0E6OlN0YW5kYXJkOjpTdGFuZGFyZFVuc3BlY2lmaWVkKSwKKyAgICAgICAgICAgIC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HYW1tYTIyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhCVDYwMV82LCBDQTo6UmFuZ2U6OlJhbmdlRnVsbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0E6OlN0YW5kYXJkOjpTdGFuZGFyZFVuc3BlY2lmaWVkKSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfdHVwbGUoQ0E6OlByaW1hcmllczo6UHJpbWFyaWVzQlQ2MDFfNl81MjUsIENBOjpUcmFuc2Zlcjo6VHJhbnNmZXJHYW1tYTI4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhTTVBURTI0ME0sIENBOjpSYW5nZTo6UmFuZ2VGdWxsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6U3RhbmRhcmQ6OlN0YW5kYXJkQlQ0NzBNKSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfdHVwbGUoQ0E6OlByaW1hcmllczo6UHJpbWFyaWVzQlQyMDIwLCBDQTo6VHJhbnNmZXI6OlRyYW5zZmVyU1QyMDg0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhCVDIwMjAsIENBOjpSYW5nZTo6UmFuZ2VGdWxsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6U3RhbmRhcmQ6OlN0YW5kYXJkQlQ2MDFfNTI1KSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfdHVwbGUoQ0E6OlByaW1hcmllczo6UHJpbWFyaWVzQlQyMDIwLCBDQTo6VHJhbnNmZXI6OlRyYW5zZmVySExHLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQTo6TWF0cml4Q29lZmZzOjpNYXRyaXhCVDIwMjBDb25zdGFudCwgQ0E6OlJhbmdlOj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DQTo6VHJhbnNmZXJVbnNwZWNpZmllZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0E6Ok1hdHJpeFVuc3BlY2lmaWVkLCBDb2xvclV0aWxzOjprQ29sb3JTdGFuZGFyZFVuc3BlY2lmaWVkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb2xvclV0aWxzOjprQ29sb3JUcmFuc2ZlclVuc3BlY2lmaWVkKSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfdHVwbGUoQ0E6OlByaW1hcmllc0JUNzA5XzUsIENBOjpUcmFuc2ZlckxpbmVhciwgQ0E6Ok1hdHJpeEJUNzA5XzUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbG9yVXRpbHM6OmtDb2xvclN0YW5kYXJkQlQ3MDksIENvbG9yVXRpbHM6OmtDb2xvclRyYW5zZmVyTGluZWFyKSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfdHVwbGUoQ0E6OlByaW1hcmllc0JUNjAxXzZfNjI1LCBDQTo6VHJhbnNmZXJTUkdCLCBDQTo6TWF0cml4QlQ2MDFfNiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29sb3JVdGlsczo6a0NvbG9yU3RhbmRhcmRCVDYwMV82MjUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbG9yVXRpbHM6OmtDb2xvclRyYW5zZmVyU1JHQiksCisgICAgICAgICAgICAgICAgc3RkOjptYWtlX3R1cGxlKENBOjpQcmltYXJpZXNCVDYwMV82XzYyNSwgQ0E6OlRyYW5zZmVyU01QVEUxNzBNLCBDQTo6TWF0cml4QlQ3MDlfNSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29sb3JVdGlsczo6a0NvbG9yU3RhbmRhcmRCVDYwMV82MjVfVW5hZGp1c3RlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29sb3JVdGlsczo6a0NvbG9yVHJhbnNmZXJTTVBURV8xNzBNKSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfdHVwbGUoQ0E6OlByaW1hcmllc0JUNjAxXzZfNTI1LCBDQTo6VHJhbnNmZXJHYW1tYTIyLCBDQTo6TWF0cml4QlQ2MDFfNiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29sb3JVdGlsczo6a0NvbG9yU3RhbmRhcmRCVDYwMV81MjUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbG9yVXRpbHM6OmtDb2xvclRyYW5zZmVyR2FtbWEyMiksCisgICAgICAgICAgICAgICAgc3RkOjptYWtlX3R1cGxlKENBOjpQcmltYXJpZXNCVDYwMV82XzUyNSwgQ0E6OlRyYW5zZmVyR2FtbWEyOCwgQ0E6Ok1hdHJpeFNNUFRFMjQwTSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29sb3JVdGlsczo6a0NvbG9yU3RhbmRhcmRCVDYwMV81MjVfVW5hZGp1c3RlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29sb3JVdGlsczo6a0NvbG9yVHJhbnNmZXJHYW1tYTI4KSwKKyAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfdHVwbGUoQ0E6OlByaW1hcmllc0JUMjAyMCwgQ0E6OlRyYW5zZmVyU1QyMDg0LCBDQTo6TWF0cml4QlQyMDIwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb2xvclV0aWxzOjprQ29sb3JTdGFuZGFyZEJUMjAyMCwgQ29sb3JVdGlsczo6a0NvbG9yVHJhbnNmZXJTVDIwODQpLAorICAgICAgICAgICAgICAgIHN0ZDo6bWFrZV90dXBsZShDQTo6UHJpbWFyaWVzQlQyMDIwLCBDQTo6VHJhbnNmZXJITEcsIENBOjpNYXRyaXhCVDIwMjBDb25zdGFudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29sb3JVdGlscz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MgcG9zc2libGUgYW1iaXF1aXR5LgorICAgIC8vCiAgICAgaWYgKGhlYWRlci52ZXJzaW9uX21ham9yID09IDQpIHsKICAgICAgICAgdm9pZCAqY29weSA9IG1hbGxvYyhzaXplKTsKICAgICAgICAgaWYgKGNvcHkgPT0gTlVMTCkgewpAQCAtMzQxLDEyICszNTIsMTIgQEAKIAogICAgICAgICBtZW1jcHkoY29weSwgbURhdGEsIHNpemUpOwogCi0gICAgICAgIGJvb2wgc3VjY2VzcyA9IHJlbW92ZVVuc3luY2hyb25pemF0aW9uVjJfNChmYWxzZSAvKiBpVHVuZXNIYWNrICovKTsKKyAgICAgICAgYm9vbCBzdWNjZXNzID0gcmVtb3ZlVW5zeW5jaHJvbml6YXRpb25WMl80KGZhbHNlIC8qIGlUdW5lc0hhY2sgKi8sIGhhc0dsb2JhbFVuc3luYyk7CiAgICAgICAgIGlmICghc3VjY2VzcykgewogICAgICAgICAgICAgbWVtY3B5KG1EYXRhLCBjb3B5LCBzaXplKTsKICAgICAgICAgICAgIG1TaXplID0gc2l6ZTsKIAotICAgICAgICAgICAgc3VjY2VzcyA9IHJlbW92ZVVuc3luY2hyb25pemF0aW9uVjJfNCh0cnVlIC8qIGlUdW5lc0hhY2sgKi8pOworICAgICAgICAgICAgc3VjY2VzcyA9IHJlbW92ZVVuc3luY2hyb25pemF0aW9uVjJfNCh0cnVlIC8qIGlUdW5lc0hhY2sgKi8sIGhhc0dsb2JhbFVuc3luYyk7CiAKICAgICAgICAgICAgIGlmIChzdWNjZXNzKSB7CiAgICAgICAgICAgICAgICAgQUxPR1YoIkhhZCB0byBhcHBseSB0aGUgaVR1bmVzIGhhY2sgdG8gcGFyc2UgdGhpcyBJRDMgdGFnIik7CkBAIC0zNjUsNyArMzc2LDYgQEAKICAgICB9CiAKIAotCiAgICAgaWYgKGhlYWRlci52ZXJzaW9uX21ham9yID09IDIpIHsKICAgICAgICAgbVZlcnNpb24gPSBJRDNfVjJfMjsKICAgICB9IGVsc2UgaWY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bGVTb3VyY2UocGF0aC5jX3N0cigpKTsKICAgICBBU1NFUlRfRVEoZmlsZS0+aW5pdENoZWNrKCksIChzdGF0dXNfdClPSykgPDwgIkZpbGUgaW5pdGlhbGl6YXRpb24gZmFpbGVkISBcbiI7CiAKQEAgLTgxLDE3ICs4NSwzNCBAQAogICAgIEFTU0VSVF9UUlVFKHRhZy5pc1ZhbGlkKCkpIDw8ICJObyB2YWxpZCBJRDMgdGFnIGZvdW5kIGZvciAiIDw8IHBhdGguY19zdHIoKSA8PCAiXG4iOwogICAgIGludCBjb3VudFRleHRGcmFtZXMgPSAwOwogICAgIElEMzo6SXRlcmF0b3IgaXQodGFnLCBudWxscHRyKTsKLSAgICB3aGlsZSAoIWl0LmRvbmUoKSkgewotICAgICAgICBTdHJpbmc4IGlkOwotICAgICAgICBpdC5nZXRJRCgmaWQpOwotICAgICAgICBBU1NFUlRfR1QoaWQubGVuZ3RoKCksIDApOwotICAgICAgICBpZiAoaWRbMF0gPT0gJ1QnKSB7Ci0gICAgICAgICAgICBTdHJpbmc4IHRleHQ7Ci0gICAgICAgICAgICBjb3VudFRleHRGcmFtZXMrKzsKLSAgICAgICAgICAgIGl0LmdldFN0cmluZygmdGV4dCk7Ci0gICAgICAgICAgICBBTE9HVigiRm91bmQgdGV4dCBmcmFtZSAlcyA6ICVzIFxuIiwgaWQuc3RyaW5nKCksIHRleHQuc3RyaW5nKCkpOworICAgIGlmICh0YWcudmVyc2lvbigpICE9IElEMzo6SUQzX1YxICYmIHRhZy52ZXJzaW9uKCkgIT0gSUQzOjpJRDNfVjFfMSkgeworICAgICAgICB3aGlsZSAoIWl0LmRvbmUoKSkgeworICAgICAgICAgICAgU3RyaW5nOCBpZDsKKyAgICAgICAgICAgIGl0LmdldElEKCZpZCk7CisgICAgICAgICAgICBBU1NFUlRfR1QoaWQubGVuZ3RoKCksIDApIDw8ICJGb3VuZCBhbiBJRDMgdGFnIG9mIDAgc2l6ZSI7CisgICAgICAgICAgICBpZiAoaWRbMF0gPT0gJ1QnKSB7CisgICAgICAgICAgICAgICAgU3RyaW5nOCB0ZXh0OworICAgICAgICAgICAgICAgIGNvdW50VGV4dEZyYW1lcysrOworICAgICAgICAgICAgICAgIGl0LmdldFN0cmluZygmdGV4dCk7CisgICAgICAgICAgICAgICAgQUxPR1YoIkZvdW5kIHRleHQgZnJhbWUgJXMgOiAlcyBcbiIsIGlkLnN0cmluZygpLCB0ZXh0LnN0cmluZygpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGl0Lm5leHQoKTsKICAgICAgICAgfQotICAgICAgICBpdC5uZXh0KCk7CisgICAgfSBlbHNlIHsKKyAgICAgICAgd2hpbGUgKCFpdC5kb25lKCkpIHsKKyAgICAgICAgICAgIFN0cmluZzggaWQ7CisgICAgICAgICAgICBTdHJpbmc4IHRleHQ7CisgICAgICAgICAgICBpdC5nZXRJRCgmaWQpOworICAgICAgICAgICAgQVNTRVJUX0dUKGlkLmxlbmd0aCgpLCAwKSA8PCAiRm91bmQgYW4gSUQzIHRhZyBvZiAwIHNpemUiOworICAgICAgICAgICAgaXQuZ2V0U3RyaW5nKCZ0ZXh0KTsKKyAgICAgICAgICAgIC8vIGlmIHRoZSB0YWcgaGFzIGEgdmFsdWUKKyAgICAgICAgICAgIGlmIChzdHJjbXAodGV4dC5zdHJpbmcoKSwgIiIpKSB7CisgICAgICAgICAgICAgICAgY291bnRUZXh0RnJhbWVzKys7CisgICAgICAgICAgICAgICAgQUxPR1YoIklEOiAlc1xuIiwgaWQuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgQUxPR1YoIlRleHQgc3RyaW5nOiAlc1xuIiwgdGV4dC5zdHJpbmcoKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpdC5uZXh0KCk7CisgICAgICAgIH0KICAgICB9CiAgICAgQVNTRVJUX0VRKGNvdW50VGV4dEZyYW1lcywgbnVtVGV4dEZyYW1lcykKICAgICAgICAgICAgIDw8ICJFeHBlY3RlZCAiIDw8IG51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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfNW1pbnNfMV9pbWFnZS5tcDMiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfNW1pbnNfMl9pbWFnZS5tcDMiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfNW1pbnNfbGFyZ2VTaXplLm1wMyIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImJiYl80NDEwMGh6XzJjaF8xMjhrYnBzX21wM18zMHNlY19tb3JlVGV4dEZyYW1lcy5tcDMiKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgOjp0ZXN0aW5nOjpWYWx1ZXMoImJiYl8xc2VjX3YyMy5tcDMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJiYmJfMXNlY18xX2ltYWdlLm1wMyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImJiYl8xc2VjXzJfaW1hZ2UubXAzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYmJiXzJzZWNfdjI0Lm1wMyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImJiYl8yc2VjXzFfaW1hZ2UubXAzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYmJiXzJzZWNfMl9pbWFnZS5tcDMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJiYmJfMnNlY19sYXJnZVNpemUubXAzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYmJiXzFzZWNfdjIzXzN0YWdzLm1wMyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImJiYl8xc2VjX3YxXzV0YWdzLm1wMyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImJiYl8yc2VjX3YyNF91bnN5bmNocm9uaXplZE9uZUZyYW1lLm1wMyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImlkdjI0X3Vuc3luY2hyb25pemVkLm1wMyIpKTsKIAogSU5TVEFOVElBVEVfVEVTVF9TVUlURV9QKAogICAgICAgICBpZDNUZXN0QWxsLCBJRDN2ZXJzaW9uVGVzdCwKLSAgICAgICAgOjp0ZXN0aW5nOjpWYWx1ZXMobWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfMzBzZWMubXAzIiwgNCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzQ0MTAwaHpfMmNoXzEyOGticHNfbXAzXzMwc2VjXzFfaW1hZ2UubXAzIiwgNCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzQ0MTAwaHpfMmNoXzEyOGticHNfbXAzXzMwc2VjXzJfaW1hZ2UubXAzIiwgNCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzQ0MTAwaHpfMmNoXzEyOGticHNfbXAzXzVtaW5zLm1wMyIsIDQpLAotICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl80NDEwMGh6XzJjaF8xMjhrYnBzX21wM181bWluc18xX2ltYWdlLm1wMyIsIDQpLAotICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl80NDEwMGh6XzJjaF8xMjhrYnBzX21wM181bWluc18yX2ltYWdlLm1wMyIsIDQpLAotICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl80NDEwMGh6XzJjaF8xMjhrYnBzX21wM181bWluc19sYXJnZVNpemUubXAzIiwgNCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzQ0MTAwaHpfMmNoXzEyOGticHNfbXAzXzMwc2VjX21vcmVUZXh0RnJhbWVzLm1wMyIsIDQpKSk7CisgICAgICAgIDo6dGVzdGluZzo6VmFsdWVzKG1ha2VfcGFpcigiYmJiXzFzZWNfdjIzLm1wMyIsIElEMzo6SUQzX1YyXzMpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8xc2VjXzFfaW1hZ2UubXAzIiwgSUQzOjpJRDNfVjJfMyksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzFzZWNfMl9pbWFnZS5tcDMiLCBJRDM6OklEM19WMl8zKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMnNlY192MjQubXAzIiwgSUQzOjpJRDNfVjJfNCksCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzJzZWNfMV9pbWFnZS5tcDMiLCBJRDM6OklEM19WMl80KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMnNlY18yX2ltYWdlLm1wMyIsIElEMzo6SUQzX1YyXzQpLAorI2lmIFRFU1RfTEFSR0UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMnNlY19sYXJnZVNpemUubXAzIiwgSUQzOjpJRDNfVjJfNCksIC8vIEZBSUwKKyNlbmRpZgorICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8xc2VjX3YyM18zdGFncy5tcDMiLCBJRDM6OklEM19WMl8zKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMXNlY192MV81dGFncy5tcDMiLCBJRDM6OklEM19WMV8xKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMXNlY192MV8zdGFncy5tcDMiLCBJRDM6OklEM19WMV8xKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMnNlY192MjRfdW5zeW5jaHJvbml6ZWRPbmVGcmFtZS5tcDMiLCBJRDM6OklEM19WMl80KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJpZHYyNF91bnN5bmNocm9uaXplZC5tcDMiLCBJRDM6OklEM19WMl80KSkpOwogCiBJTlNUQU5USUFURV9URVNUX1NVSVRFX1AoCiAgICAgICAgIGlkM1Rlc3RBbGwsIElEM3RleHRUYWdUZXN0LAotICAgICAgICA6OnRlc3Rpbmc6OlZhbHVlcyhtYWtlX3BhaXIoImJiYl80NDEwMGh6XzJjaF8xMjhrYnBzX21wM18zMHNlYy5tcDMiLCAxKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfMzBzZWNfMV9pbWFnZS5tcDMiLCAxKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfMzBzZWNfMl9pbWFnZS5tcDMiLCAxKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfNW1pbnMubXAzIiwgMSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzQ0MTAwaHpfMmNoXzEyOGticHNfbXAzXzVtaW5zXzFfaW1hZ2UubXAzIiwgMSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzQ0MTAwaHpfMmNoXzEyOGticHNfbXAzXzVtaW5zXzJfaW1hZ2UubXAzIiwgMSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzQ0MTAwaHpfMmNoXzEyOGticHNfbXAzXzVtaW5zX2xhcmdlU2l6ZS5tcDMiLCAxKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfMzBzZWNfbW9yZVRleHRGcmFtZXMubXAzIiwgNSkpKTsKKyAgICAgICAgOjp0ZXN0aW5nOjpWYWx1ZXMoCisgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMXNlY192MjMubXAzIiwgMSksCisgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMXNlY18xX2ltYWdlLm1wMyIsIDEpLAorICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzFzZWNfMl9pbWFnZS5tcDMiLCAxKSwKKyAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8yc2VjX3YyNC5tcDMiLCAxKSwKKyAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8yc2VjXzFfaW1hZ2UubXAzIiwgMSksCisgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMnNlY18yX2ltYWdlLm1wMyIsIDEpLAorI2lmIFRFU1RfTEFSR0UKKyAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8yc2VjX2xhcmdlU2l6ZS5tcDMiLCAxKSwgLy8gRkFJTAorI2VuZGlmCisgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMXNlY192MjNfM3RhZ3MubXAzIiwgMyksCisgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMXNlY192MV81dGFncy5tcDMiLCA1KSwKKyAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8xc2VjX3YxXzN0YWdzLm1wMyIsIDMpLAorICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzJzZWNfdjI0X3Vuc3luY2hyb25pemVkT25lRnJhbWUubXAzIiwgMykKKyAgICAgICAgICAgICAgICApKTsKIAotSU5TVEFOVElBVEVfVEVTVF9TVUlURV9QKAotICAgICAgICBpZDNUZXN0QWxsLCBJRDNhbGJ1bUFydFRlc3QsCi0gICAgICAgIDo6dGVzdGluZzo6VmFsdWVzKG1ha2VfcGFpcigiYmJiXzQ0MTAwaHpfMmNoXzEyOGticHNfbXAzXzMwc2VjLm1wMyIsIGZhbHNlKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfMzBzZWNfMV9pbWFnZS5tcDMiLCB0cnVlKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfMzBzZWNfMl9pbWFnZS5tcDMiLCB0cnVlKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfNW1pbnMubXAzIiwgZmFsc2UpLAotICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl80NDEwMGh6XzJjaF8xMjhrYnBzX21wM181bWluc18xX2ltYWdlLm1wMyIsIHRydWUpLAotICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl80NDEwMGh6XzJjaF8xMjhrYnBzX21wM181bWluc18yX2ltYWdlLm1wMyIsIHRydWUpLAotICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl80NDEwMGh6XzJjaF8xMjhrYnBzX21wM181bWluc19sYXJnZVNpemUubXAzIiwgdHJ1ZSkpKTsKK0lOU1RBTlRJQVRFX1RFU1RfU1VJVEVfUChpZDNUZXN0QWxsLCBJRDNhbGJ1bUFydFRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgOjp0ZXN0aW5nOjpWYWx1ZXMobWFrZV9wYWlyKCJiYmJfMXNlY192MjMubXAzIiwgZmFsc2UpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzFzZWNfMV9pbWFnZS5tcDMiLCB0cnVlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8xc2VjXzJfaW1hZ2UubXAzIiwgdHJ1ZSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMnNlY192MjQubXAzIiwgZmFsc2UpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzJzZWNfMV9pbWFnZS5tcDMiLCB0cnVlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8yc2VjXzJfaW1hZ2UubXAzIiwgdHJ1ZSksCisjaWYgVEVTVF9MQVJHRQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzJzZWNfbGFyZ2VTaXplLm1wMyIsIHRydWUpLCAvLyBGQUlMCisjZW5kaWYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8xc2VjX3YxXzV0YWdzLm1wMyIsIGZhbHNlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImlkdjI0X3Vuc3luY2hyb25pemVkLm1wMyIsIHRydWUpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKSk7CiAKLUlOU1RBTlRJQVRFX1RFU1RfU1VJVEVfUCgKLSAgICAgICAgaWQzVGVzdEFsbCwgSUQzbXVsdGlBbGJ1bUFydFRlc3QsCi0gICAgICAgIDo6dGVzdGluZzo6VmFsdWVzKG1ha2VfcGFpcigiYmJiXzQ0MTAwaHpfMmNoXzEyOGticHNfbXAzXzMwc2VjLm1wMyIsIDApLAotICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl80NDEwMGh6XzJjaF8xMjhrYnBzX21wM181bWlucy5tcDMiLCAwKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfMzBzZWNfMV9pbWFnZS5tcDMiLCAxKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfNW1pbnNfMV9pbWFnZS5tcDMiLCAxKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfMzBzZWNfMl9pbWFnZS5tcDMiLCAyKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfNW1pbnNfMl9pbWFnZS5tcDMiLCAyKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfNDQxMDBoel8yY2hfMTI4a2Jwc19tcDNfNW1pbnNfbGFyZ2VTaXplLm1wMyIsIDMpKSk7CitJTlNUQU5USUFURV9URVNUX1NVSVRFX1AoaWQzVGVzdEFsbCwgSUQzbXVsdGlBbGJ1bUFydFRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgOjp0ZXN0aW5nOjpWYWx1ZXMobWFrZV9wYWlyKCJiYmJfMXNlY192MjMubXAzIiwgMCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMnNlY192MjQubXAzIiwgMCksCisjaWYgVEVTVF9MQVJHRQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzJzZWNfbGFyZ2VTaXplLm1wMyIsIDMpLCAvLyBGQUlMCisjZW5kaWYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8xc2VjXzFfaW1hZ2UubXAzIiwgMSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJiYmJfMnNlY18xX2ltYWdlLm1wMyIsIDEpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigiYmJiXzFzZWNfMl9pbWFnZS5tcDMiLCAyKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImJiYl8yc2VjXzJfaW1hZ2UubXAzIiwgMikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApKTsKIAogaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiphcmd2KSB7CiAgICAgZ0VudiA9IG5ldyBJRDNUZXN0RW52aXJvbm1lbnQoKTsKZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L2luY2x1ZGUvRnJhbWVEZWNvZGVyLmggYi9tZWRpYS9saWJzdGFnZWZyaWdodC9pbmNsdWRlL0ZyYW1lRGVjb2Rlci5oCmluZGV4IDE5YWUwZTMuLmQ1OWU0ZjUgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L2luY2x1ZGUvRnJhbWVEZWNvZGVyLmgKKysrIGIvbWVkaWEvbGlic3RhZ2VmcmlnaHQvaW5jbHVkZS9GcmFtZURlY29kZXIuaApAQCAtMTM1LDcgKzEzNSw4IEBACiBwcml2YXRlOgogICAgIHNwPEZyYW1lQ2FwdHVyZUxheWVyPiBt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qCiAgICAgICogQHBhcmFtIGNhbWVyYSB0aGUgdmlkZW8gaW5wdXQgZnJhbWUgZGF0YSBzb3VyY2UuIElmIGl0IGlzIE5VTEwsCkBAIC04OSw4ICs3Nyw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWRfdCBjbGllbnRQaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaXplIHZpZGVvU2l6ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgZnJhbWVSYXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8SUdyYXBoaWNCdWZmZXJQcm9kdWNlcj4mIHN1cmZhY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHN0b3JlTWV0YURhdGFJblZpZGVvQnVmZmVycyA9IHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8SUdyYXBoaWNCdWZmZXJQcm9kdWNlcj4mIHN1cmZhY2UpOwogCiAgICAgdmlydHVhbCB+Q2FtZXJhU291cmNlKCk7CiAKQEAgLTEzMiwyNiArMTE5LDYgQEAKIHByb3RlY3RlZDoKIAogICAgIC8qKgotICAgICAqIFRoZSBjbGFzcyBmb3IgbGlzdGVuaW5nIHRvIEJuQ2FtZXJhUmVjb3JkaW5nUHJveHlMaXN0ZW5lci4gVGhpcyBpcyB1c2VkIHRvIHJlY2VpdmUgdmlkZW8KLSAgICAgKiBidWZmZXJzIGluIFZJREVPX0JVRkZFUl9NT0RFX0RBVEFfQ0FMTEJBQ0tfWVVWIGFuZCBWSURFT19CVUZGRVJfTU9ERV9EQVRBX0NBTExCQUNLX01FVEFEQVRBCi0gICAgICogbW9kZS4gV2hlbiBhIGZyYW1lIGlzIGF2YWlsYWJsZSwgQ2FtZXJhU291cmNlO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51bGxwdHIiKTsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CiAgICAgICAgIHJldHVybiBtU291cmNlLT5yZWFkQXQob2Zmc2V0LCBtTWVtb3J5LT51bnNlY3VyZVBvaW50ZXIoKSwgc2l6ZSk7CiAgICAgfQogICAgIHZpcnR1YWwgc3RhdHVzX3QgZ2V0U2l6ZShvZmY2NF90ICpzaXplKSB7CisgICAgICAgIE11dGV4OjpBdXRvbG9jayBsb2NrKG1Mb2NrKTsKKyAgICAgICAgaWYgKG1Tb3VyY2UuZ2V0KCkgPT0gbnVsbHB0cikgeworICAgICAgICAgICAgQUxPR0UoImdldFNpemUoKSBmYWlsZWQsIG1Tb3VyY2UgaXMgbnVsbHB0ciIpOworICAgICAgICAgICAgcmV0dXJuIElOVkFMSURfT1BFUkFUSU9OOworICAgICAgICB9CiAgICAgICAgIHJldHVybiBtU291cmNlLT5nZXRTaXplKHNpemUpOwogICAgIH0KICAgICB2aXJ0dWFsIHZvaWQgY2xvc2UoKSB7CiAgICAgICAgIC8vIFByb3RlY3Qgc3Ryb25nIHBvaW50ZXIgYXNzaWdubWVudHMuIFRoaXMgYWxzbyBjYW4gYmUgY2FsbGVkIGZyb20gdGhlIGJpbmRlcgogICAgICAgICAvLyBjbGVhbi11cCBwcm9jZWR1cmUgd2hpY2ggaXMgcnVubmluZyBvbiBhIHNlcGFyYXRlIHRocmVhZC4KLSAgICAgICAgTXV0ZXg6OkF1dG9sb2NrIGxvY2sobUNsb3NlTG9jayk7CisgICAgICAgIE11dGV4OjpBdXRvbG9jayBsb2NrKG1Mb2NrKTsKICAgICAgICAgbVNvdXJjZSA9IG51bGxwdHI7CiAgICAgICAgIG1NZW1vcnkgPSBudWxscHRyOwogICAgIH0KICAgICB2aXJ0dWFsIHVpbnQzMl90IGdldEZsYWdzKCkgeworICAgICAgICBNdXRleDo6QXV0b2xvY2sgbG9jayhtTG9jayk7CisgICAgICAgIGlmIChtU291cmNlLmdldCgpID09IG51bGxwdHI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EuMCIsCkBAIC0zNiw5ICs1MywxMCBAQAogICAgIF0sCiAKICAgICBoZWFkZXJfbGliczogWwotICAgICAgICAibGlibWVkaWFfaGVhZGVycyIsCisgICAgICAgICJsaWJtZWRpYV9kYXRhc291cmNlX2hlYWRlcnMiLAogICAgICAgICAibGliYXVkaW9jbGllbnRfaGVhZGVycyIsCiAgICAgICAgICJtZWRpYV9uZGtfaGVhZGVycyIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9mb3VuZGF0aW9uX2hlYWRlcnMiLAogICAgIF0sCiAKICAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbIi4iXSwKQEAgLTQ4LDQgKzY2LDM5IEBACiAgICAgXSwKIAogICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKKworICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorCisgICAgdGFyZ2V0OiB7CisgICAgICAgIGRhcndpbjogeworICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsCisgICAgICAgIH0sCisgICAgfSwKK30KKworCitjY19saWJyYXJ5X3N0YXRpYyB7CisgICAgbmFtZTogImxpYnN0YWdlZnJpZ2h0X21wZWcyc3VwcG9ydCIsCisgICAgZGVmYXVsdHM6IFsKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X21wZWcyc3VwcG9ydF9kZWZhdWx0cyIsCisgICAgXSwKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1ERU5BQkxFX0NSWVBUTyIsCisgICAgXSwKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGliY3J5cHRvIiwKKyAgICBdLAorICAgIHNyY3M6IFsKKyAgICAgICAgIkhsc1NhbXBsZURlY3J5cHRvci5jcHAiLAorICAgIF0sCit9CisKK2NjX2xpYnJhcnlfc3RhdGljIHsKKyAgICBuYW1lOiAibGlic3RhZ2VmcmlnaHRfbXBlZzJzdXBwb3J0X25vY3J5cHRvIiwKKyAgICBkZWZhdWx0czogWworICAgICAgICAibGlic3RhZ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gICAgLy8gQSBsYXJnZS1zY2FsZS1jaGFuZ2UgYWRkZWQgJ2RlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlcycgdG8gaW1wb3J0CisgICAgLy8gYWxsIG9mIHRoZSAnbGljZW5zZV9raW5kcycgZnJvbSAiZnJhbWV3b3Jrc19hdl9tZWRpYV9saWJzdGFnZWZyaWdodF9tcGVnMnRzX2xpY2Vuc2UiCisgICAgLy8gdG8gZ2V0IHRoZSBiZWxvdyBsaWNlbnNlIGtpbmRzOgorICAgIC8vICAgU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMAorICAgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWworICAgICAgICAiZnJhbWV3b3Jrc19hdl9tZWRpYV9saWJzdGFnZWZyaWdodF9tcGVnMnRzX2xpY2Vuc2UiLAorICAgIF0sCit9CisKK2NjX3Rlc3R7CisgICAgbmFtZTogIk1wZWcydHNVbml0VGVzdCIsCisgICAgZ3Rlc3Q6IHRydWUsCisgICAgdGVzdF9zdWl0ZXM6IFsiZGV2aWNlLXRlc3RzIl0sCisKKyAgICBzcmNzOiBbCisgICAgICAgICJNcGVnMnRzVW5pdFRlc3QuY3BwIgorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5jYXNAMS4wIiwKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuY2FzLm5hdGl2ZUAxLjAiLAorICAgICAgICAiYW5kcm9pZC5oaWRsLnRva2VuQDEuMC11dGlscyIsCisgICAgICAgICJhbmRyb2lkLmhpZGwuYWxsb2NhdG9yQDEuMCIsCisgICAgICAgICJsaWJjcnlwdG8iLAorICAgICAgICAibGliaGlkbGJhc2UiLAorICAgICAgICAibGliaGlkbG1lbW9yeSIsCisgICAgICAgICJsaWJsb2ciLAorICAgICAgICAibGlibWVkaWEiLAorICAgICAgICAibGliYmluZGVyIiwKKyAgICAgICAgImxpYmJpbmRlcl9uZGsiLAorICAgICAgICAibGlidXRpbHMiLAorICAgIF0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGliZGF0YXNvdXJjZSIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodCIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9mb3VuZGF0aW9uIiwKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X21ldGFkYXRhdXRpbHMiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfbXBlZzJzdXBwb3J0IiwKKyAgICBdLAorCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL2V4dHJhY3RvcnMvIiwKKyAgICAgICAgImZyYW1ld29ya3MvYXYvbWVkaWEvbGlic3RhZ2VmcmlnaHQvIiwKKyAgICBdLAorCisgICAgaGVhZGVyX2xpYnM6IFsKKyAgICAgICAgImxpYm1lZGlhX2hlYWRlcnMiLAorICAgICAgICAibGliYXVkaW9jbGllbnRfaGVhZGVycyIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLVdhbGwiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgXSwKKworICAgIHNhbml0aXplOiB7CisgICAgICAgIGNmaTogdHJ1ZSwKKyAgICAgICAgbWlzY191bmRlZmluZWQ6IFsKKyAgICAgICAgICAgICJ1bnNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgICAgICJzaWduZWQtaW50ZWdlci1vdmVyZmxvdyIsCisgICAgICAgIF0sCisgICAgfSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L21wZWcydHMvdGVzdC9BbmRyb2lkVGVzdC54bWwgYi9tZWRpYS9saWJzdGFnZWZyaWdodC9tcGVnMnRzL3Rlc3QvQW5kcm9pZFRlc3QueG1sCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmFjMTI5NGQKLS0tIC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bURhdGFTb3VyY2UgPSAwOworICAgIHVpbnQ4X3QgcGFja2V0W2tUU1BhY2tldFNpemVdOworICAgIHNzaXplX3QgbnVtQnl0ZXNSZWFkID0gLTE7CisKKyAgICBBVFNQYXJzZXI6OlN5bmNFdmVudCBldmVudChtT2Zmc2V0KTsKKyAgICBzdGF0aWMgY29uc3QgQVRTUGFyc2VyOjpTb3VyY2VUeXBlIG1lZGlhVHlwZVtdID0ge0FUU1BhcnNlcjo6VklERU8sIEFUU1BhcnNlcjo6QVVESU8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVFNQYXJzZXI6Ok1FVEEsIEFUU1BhcnNlcjo6TlVNX1NPVVJDRV9UWVBFU307CisgICAgY29uc3QgdWludDMyX3Qgbk1lZGlhVHlwZXMgPSBzaXplb2YobWVkaWFUeXBlKSAvIHNpemVvZihtZWRpYVR5cGVbMF0pOworCisgICAgd2hpbGUgKChudW1CeXRlc1JlYWQgPSBtU291cmNlLT5yZWFkQXQobU9mZnNldCwgcGFja2V0LCBrVFNQYWNrZXRTaXplKSkgPT0ga1RTUGFja2V0U2l6ZSkgeworICAgICAgICBBU1NFUlRfVFJVRShwYWNrZXRbMF0gPT0ga1RTU3luY0J5dGUpIDw8ICJTeW5jIGJ5dGUgZXJyb3IhIjsKKworICAgICAgICAvLyBwaWQgaXMgMTMgYml0cworICAgICAgICB1aW50MTZfdCBwaWQgPSAocGFja2V0WzFdICsgKHBhY2tldFsyXSA8PCA4KSkgJiBrUElETWFzazsKKyAgICAgICAgQVNTRVJUX1RSVUUocGlkIDw9IGtQSURNYXhWYWx1ZSkgPDwgIkludmFsaWQgUElEOiAiIDw8IHBpZDsKKworICAgICAgICBzdGF0dXNfdCBlcnIgPSBtUGFyc2VyLT5mZWVkVFNQYWNrZXQocGFja2V0LCBrVFNQYWNrZXRTaXplLCAmZXZlbnQpOworICAgICAgICBBU1NFUlRfRVEoZXJyLCAoc3RhdHVzX3QpT0spIDw8ICJVbmFibGUgdG8gZmVlZCBUUyBwYWNrZXQhIjsKKworICAgICAgICBtT2Zmc2V0ICs9IG51bUJ5dGVzUmVhZDsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuTWVkaWFUeXBlczsgaSsrKSB7CisgICAgICAgICAgICBpZiAobVBhcnNlci0+aGFzU291cmNlKG1lZGlhVHlwZVtpXSkpIHsKKyAgICAgICAgICAgICAgICBzd2l0Y2ggKG1lZGlhVHlwZVtpXSkgeworICAgICAgICAgICAgICAgICAgICBjYXNlIEFUU1BhcnNlcjo6VklERU86CisgICAgICAgICAgICAgICAgICAgICAgICB2aWRlb0ZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIEFUU1BhcnNlcjo6QVVESU86CisgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb0ZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIEFUU1BhcnNlcjo6TUVUQToKKyAgICAgICAgICAgICAgICAgICAgICAgIG1ldGFEYXRhRm91bmQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgQVRTUGFyc2VyOjpOVU1fU09VUkNFX1RZUEVTOgorICAgICAgICAgICAgICAgICAgICAgICAgbnVtRGF0YVNvdXJjZSA9IDM7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAodmlkZW9Gb3VuZCAmJiBhdWRpb0ZvdW5kICYmIG1ldGFEYXRhRm91bmQgJiYgKG51bURhdGFTb3VyY2UgPT0gMykpIGJyZWFrOworICAgIH0KKworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbk1lZGlhVHlwZXM7IGkrKykgeworICAgICAgICBBVFNQYXJzZXI6OlNvdXJjZVR5cGUgY3VycmVudE1lZGlhVHlwZSA9IG1lZGlhVHlwZVtpXTsKKyAgICAgICAgaWYgKG1QYXJzZXItPmhhc1NvdXJjZShjdXJyZW50TWVkaWFUeXBlKSkgeworICAgICAgICAgICAgaWYgKGV2ZW50Lmhhc1JldHVybmVkRGF0YSgpKSB7CisgICAgICAgICAgICAgICAgc3luY1BvaW50UHJlc2VudCA9IHRydWU7CisgICAgICAgICAgICAgICAgc3A8QW5vdGhlclBhY2tldFNvdXJjZT4gc3luY1BhY2tldFNvdXJjZSA9IGV2ZW50LmdldE1lZGlhU291cmNlKCk7CisgICAgICAgICAgICAgICAgQVNTRVJUX05FKHN5bmNQYWNrZXRTb3VyY2UsIG51bGxwdHIpCisgICAgICAgICAgICAgICAgICAgICAgICA8PCAiQ2Fubm90IGdldCBzeW5jIHNvdXJjZSBmb3IgbWVkaWEgdHlwZTogIiA8PCBjdXJyZW50TWVkaWFUeXBlOworCisgICAgICAgICAgICAgICAgc3RhdHVzX3QgZXJyID0gc3luY1BhY2tldFNvdXJjZS0+c3RhcnQoKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfRVEoZXJyLCAoc3RhdHVzX3QpT0spIDw8ICJFcnJvciByZXR1cm5lZCB3aGlsZSBzdGFydGluZyEiOworCisgICAgICAgICAgICAgICAgc3A8TWV0YURhdGE+IGZvcm1hdCA9IHN5bmNQYWNrZXRTb3VyY2UtPmdldEZvcm1hdCgpOworICAgICAgICAgICAgICAgIEFTU0VSVF9ORShmb3JtYXQsIG51bGxwdHIpIDw8ICJVbmFibGUgdG8gZ2V0IHRoZSBmb3JtYXQgb2YgdGhlIHNvdXJjZSBwYWNrZXQhIjsKKworICAgICAgICAgICAgICAgIE1lZGlhQnVmZmVyQmFzZSAqYnVmOworICAgICAgICAgICAgICAgIHN5bmNQYWNrZXRTb3VyY2UtPnJlYWQoJmJ1ZiwgbnVsbHB0cik7CisgICAgICAgICAgICAgICAgQVNTRVJUX05FKGJ1ZiwgbnVsbHB0cikgPDwgIkZhaWxlZCB0byByZWFkIHN5bmMgcGFja2V0IHNvdXJjZSBkYXRhIjsKKworICAgICAgICAgICAgICAgIE1ldGFEYXRhQmFzZSAmaW5NZXRhID0gYnVmLT5tZXRhX2RhdGEoKTsKKyAgICAgICAgICAgICAgICBib29sIHN0YXR1cyA9IGluTWV0YS5maW5kSW50MzIoa0tleUlzU3luY0ZyYW1lLCAmdmFsMzIpOworICAgICAgICAgICAgICAgIEFTU0VSVF9FUShzdGF0dXMsIHRydWUpIDw8ICJTeW5jIGZyYW1lIGtleSBpcyBub3Qgc2V0IjsKKworICAgICAgICAgICAgICAgIHN0YXR1cyA9IGluTWV0YS5maW5kSW50MzIoa0tleUNyeXB0b01vZGUsICZ2YWwzMik7CisgICAgICAgICAgICAgICAgQVNTRVJUX0VRKHN0YXR1cywgZmFsc2UpIDw8ICJJbnZhbGlkIHBhY2tldCwgZm91bmQgc2NyYW1ibGVkIHBhY2tldHMhIjsKKworICAgICAgICAgICAgICAgIGVyciA9IHN5bmNQYWNrZXRTb3VyY2UtPnN0b3AoKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfRVEoZXJyLCAoc3RhdHVzX3QpT0spIDw8ICJFcnJvciByZXR1cm5lZCB3aGlsZSBzdG9wcGluZyEiOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3A8QW5vdGhlclBhY2tldFNvdXJjZT4gcGFja2V0U291cmNlID0gbVBhcnNlci0+Z2V0U291cmNlKGN1cnJlbnRNZWRpYVR5cGUpOworICAgICAgICAgICAgQVNTRVJUX05FKHBhY2tldFNvdXJjZSwgbnVsbHB0cikKKyAgICAgICAgICAgICAgICAgICAgPDwgIkNhbm5vdCBnZXQgc291cmNlIGZvciBtZWRpYSB0eXBlOiAiIDw8IGN1cnJlbnRNZWRpYVR5cGU7CisKKyAgICAgICAgICAgIHN0YXR1c190IGVyciA9IHBhY2tldFNvdXJjZS0+c3RhcnQoKTsKKyAgICAgICAgICAgIEFTU0VSVF9FUShlcnIsIChzdGF0dXNfdClPSykgPDwgIkVycm9yIHJldHVybmVkIHdoaWxlIHN0YXJ0aW5nISI7CisgICAgICAgICAgICBzcDxNZXRhRGF0YT4gZm9ybWF0ID0gcGFja2V0U291cmNlLT5nZXRGb3JtYXQoKTsKKyAgICAgICAgICAgIEFTU0VSVF9ORShmb3JtYXQsIG51bGxwdHIpIDw8ICJVbmFibGUgdG8gZ2V0IHRoZSBmb3JtYXQgb2YgdGhlIHBhY2tldCEiOworCisgICAgICAgICAgICBlcnIgPSBwYWNrZXRTb3VyY2UtPnN0b3AoKTsKKyAgICAgICAgICAgIEFTU0VSVF9FUShlcnIsIChzdGF0dXNfdClPSykgPDwgIkVycm9yIHJldHVybmVkIHdoaWxlIHN0b3BwaW5nISI7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBBU1NFUlRfRVEodmlkZW9Gb3VuZCwgYm9vbChtTWVkaWFUeXBlICYga1ZpZGVvUHJlc2VudCkpIDw8ICJObyBWaWRlbyBwYWNrZXRzIGZvdW5kISI7CisgICAgQVNTRVJUX0VRKGF1ZGlvRm91bmQsIGJvb2wobU1lZGlhVHlwZSAmIGtBdWRpb1ByZXNlbnQp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SA8Z2V0b3B0Lmg+CisKK3VzaW5nIG5hbWVzcGFjZSBzdGQ7CisKK2NsYXNzIE1wZWcydHNVbml0VGVzdEVudmlyb25tZW50IDogcHVibGljOjp0ZXN0aW5nOjpFbnZpcm9ubWVudCB7CisgIHB1YmxpYzoKKyAgICBNcGVnMnRzVW5pdFRlc3RFbnZpcm9ubWVudCgpIDogcmVzKCIvZGF0YS9sb2NhbC90bXAvIikge30KKworICAgIC8vIFBhcnNlcyB0aGUgY29tbWFuZCBsaW5lIGFyZ3VtZW50cworICAgIGludCBpbml0RnJvbU9wdGlvbnMoaW50IGFyZ2MsIGNoYXIgKiphcmd2KTsKKworICAgIHZvaWQgc2V0UmVzKGNvbnN0IGNoYXIgKl9yZXMpIHsgcmVzID0gX3JlczsgfQorCisgICAgY29uc3Qgc3RyaW5nIGdldFJlcygpIGNvbnN0IHsgcmV0dXJuIHJlczsgfQorCisgIHByaXZhdGU6CisgICAgc3RyaW5nIHJlczsKK307CisKK2ludCBNcGVnMnRzVW5pdFRlc3RFbnZpcm9ubWVudDo6aW5pdEZyb21PcHRpb25zKGludCBhcmdjLCBjaGFyICoqYXJndikgeworICAgIHN0YXRpYyBzdHJ1Y3Qgb3B0aW9uIG9wdGlvbnNbXSA9IHt7InBhdGgiLCByZXF1aXJlZF9hcmd1bWVudCwgMCwgJ1AnfSwgezAsIDAsIDAsIDB9fTsKKworICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgIGludCBpbmRleCA9IDA7CisgICAgICAgIGludCBjID0gZ2V0b3B0X2xvbmcoYXJnYywgYXJndiwgIlA6Iiwgb3B0aW9ucywgJmluZGV4KTsKKyAgICAgICAgaWYgKGMgPT0gLTEpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgc3dpdGNoIChjKSB7CisgICAgICAgICAgICBjYXNlICdQJzogeworICAgICAgICAgICAgICAgIHNldFJlcyhvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAg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ICAgICAgIGZvciAoc3RkOjpzdHJpbmc6OmNvbnN0X2l0ZXJhdG9yIGl0MiA9IG5hbWUuY2JlZ2luKCk7CisgICAgICAgICAgICAgICAgICAgIGl0MSAhPSBsYXN0ICYmIGl0MiAhPSBuYW1lLmNlbmQoKSAmJiB0b2xvd2VyKCppdDEpID09IHRvbG93ZXIoKml0Mik7CisgICAgICAgICAgICAgICAgICAgICsraXQxLCArK2l0MikgeworICAgICAgICAgICAgfQorICAgICAgICAgICAgbGFzdCA9IGl0MTsKKyAgICAgICAgfQorICAgICAgICBtUHJlZml4ID0gc3RkOjpzdHJpbmcoZmlyc3QsIGxhc3QpOworICAgICAgICBMT0coSU5GTykgPDwgIm9teCBjb21tb24gcHJlZml4OiAnIiA8PCBtUHJlZml4LmNfc3RyKCkgPDwgIiciOworICAgIH0gZWxzZSB7CisgICAgICAgIExPRyhJTkZPKSA8PCAib214IGNvbW1vbiBwcmVmaXg6IG5vIG5vZGVzIjsKKyAgICB9CisKICAgICBNZWRpYUNvZGVjc1htbFBhcnNlciBwYXJzZXI7CiAgICAgcGFyc2VyLnBhcnNlWG1sRmlsZXNJblNlYXJjaERpcnMoeG1sTmFtZXMsIHNlYXJjaERpcnMpOwogICAgIGlmIChwcm9maWxpbmdSZXN1bHRzWG1sUGF0aCAhPSBudWxscHRyKSB7CkBAIC0xMTIsOCArMTMwLDYgQEAKICAgICAgICAgbVJvbGVMaXN0W2ldID0gc3RkOjptb3ZlKHJvbGUpOwogICAgICAgICArK2k7CiAgICAgfQotCi0gICAgbVByZWZpeCA9IHBhcnNlci5nZXRDb21tb25QcmVmaXgoKTsKIH0KIAogT214U3RvcmU6On5PbXhTdG9yZSgpIHsKZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L29teC8xLjAvV0dyYXBoaWNCdWZmZXJTb3VyY2UuY3BwIGIvbWVkaWEvbGlic3RhZ2VmcmlnaHQvb214LzEuMC9XR3JhcGhpY0J1ZmZlclNvdXJjZS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F0ZU9NWFBsdWdpbikKKyAgICAgICAgY3JlYXRlT01YUGx1Z2luID0gKENyZWF0ZU9NWFBsdWdpbkZ1bmMpZGxzeW0oCisgICAgICAgICAgICAgICAgbGliSGFuZGxlLCAiX1pON2FuZHJvaWQxNWNyZWF0ZU9NWFBsdWdpbkV2Iik7CisKKyAgICBPTVhQbHVnaW5CYXNlICpwbHVnaW4gPSBudWxscHRyOworICAgIGlmIChjcmVhdGVPTVhQbHVnaW4pIHsKKyAgICAgICAgcGx1Z2luID0gKCpjcmVhdGVPTVhQbHVnaW4pKCk7CisgICAgfQorCisgICAgaWYgKHBsdWdpbikgeworICAgICAgICBtUGx1Z2lucy5wdXNoX2JhY2soeyBwbHVnaW4sIGxpYkhhbmRsZSB9KTsKKyAgICAgICAgYWRkUGx1Z2luKHBsdWdpbik7CisgICAgfSBlbHNlIHsKKyAgICAgICAgYW5kcm9pZF91bmxvYWRfc3BoYWxfbGlicmFyeShsaWJIYW5kbGUpOworICAgIH0KK30KKwordm9pZCBPTVhTdG9yZTo6YWRkUGx1Z2luKE9NWFBsdWdpbkJhc2UgKnBsdWdpbikgeworICAgIE11dGV4OjpBdXRvbG9jayBhdXRvTG9jayhtTG9jayk7CisKKyAgICBPTVhfVTMyIGluZGV4ID0gMDsKKworICAgIGNoYXIgbmFtZVsxMjhdOworICAgIE9NWF9FUlJPUlRZUEUgZXJyOworICAgIHdoaWxlICgoZXJyID0gcGx1Z2luLT5lbnVtZXJhdGVDb21wb25lbnRzKAorICAgICAgICAgICAgICAgICAgICBuYW1lLCBzaXplb2YobmFtZSksIGluZGV4KyspKSA9PSBPTVhfRXJyb3JOb25lKSB7CisgICAgICAgIFN0cmluZzggbmFtZTgobmFtZSk7CisKKyAgICAgICAgaWYgKG1QbHVnaW5CeUNvbXBvbmVudE5hbWUuaW5kZXhPZktleShuYW1lOCkgPj0gMCkgeworICAgICAgICAgICAgQUxPR0UoIkEgY29tcG9uZW50IG9mIG5hbWUgJyVzJyBhbHJlYWR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ICAgICAgICAgICAgZGVsZXRlIHBsdWdpbi5tT214OworCisgICAgICAgIGFuZHJvaWRfdW5sb2FkX3NwaGFsX2xpYnJhcnkocGx1Z2luLm1MaWJIYW5kbGUpOworICAgIH0KKworICAgIG1QbHVnaW5zLmNsZWFyKCk7Cit9CisKK09NWF9FUlJPUlRZUEUgT01YU3RvcmU6Om1ha2VDb21wb25lbnRJbnN0YW5jZSgKKyAgICAgICAgY29uc3QgY2hhciAqbmFtZSwKKyAgICAgICAgY29uc3QgT01YX0NBTExCQUNLVFlQRSAqY2FsbGJhY2tzLAorICAgICAgICBPTVhfUFRSIGFwcERhdGEsCisgICAgICAgIE9NWF9DT01QT05FTlRUWVBFICoqY29tcG9uZW50KSB7CisgICAgQUxPR0koIm1ha2VDb21wb25lbnRJbnN0YW5jZSglcykgaW4gJXMgcHJvY2VzcyIsIG5hbWUsIG1Qcm9jZXNzTmFtZSk7CisgICAgTXV0ZXg6OkF1dG9sb2NrIGF1dG9Mb2NrKG1Mb2NrKTsKKworICAgICpjb21wb25lbnQgPSBOVUxMOworCisgICAgc3NpemVfdCBpbmRleCA9IG1QbHVnaW5CeUNvbXBvbmVudE5hbWUuaW5kZXhPZktleShTdHJpbmc4KG5hbWUpKTsKKworICAgIGlmIChpbmRleCA8IDApIHsKKyAgICAgICAgcmV0dXJuIE9NWF9FcnJvckludmFsaWRDb21wb25lbnROYW1lOworICAgIH0KKworICAgIE9NWFBsdWdpbkJhc2UgKnBsdWdpbiA9IG1QbHVnaW5CeUNvbXBvbmVudE5hbWUudmFsdWVBdChpbmRleCk7CisgICAgT01YX0VSUk9SVFlQRSBlcnIgPQorICAgICAgICBwbHVnaW4tPm1ha2VDb21wb25lbnRJbnN0YW5jZShuYW1lLCBjYWxsYmFja3MsIGFwcERhdGEsIGNvbXBvbmVudCk7CisKKyAgICBpZiAoZXJyICE9IE9NWF9FcnJvck5vbmUpIHsKKyAgICAgICAgcmV0dXJuIGVycjsKKyAgICB9CisKKyAgICBtUGx1Z2luQnlJbnN0YW5jZS5hZGQoKmNvbXBvbmVudCwgcGx1Z2luKTsKKworICAgIHJldHVybiBlcnI7Cit9CisKK09NWF9FUlJPUlRZUEUgT01YU3RvcmU6OmRlc3Ryb3lDb21wb25lbnRJbnN0YW5jZSgKKyAgICAgICAgT01YX0NPTVBPTkVOVFRZUEUgKmNvbXBvbmVudCkgeworICAgIE11dGV4OjpBdXRvbG9jayBhdXRvTG9jayhtTG9jayk7CisKKyAgICBzc2l6ZV90IGluZGV4ID0gbVBsdWdpbkJ5SW5zdGFuY2UuaW5kZXhPZktleShjb21wb25lbnQpOworCisgICAgaWYgKGluZGV4IDwgMCkgeworICAgICAgICByZXR1cm4gT01YX0Vycm9yQmFkUGFyYW1ldGVyOworICAgIH0KKworICAgIE9NWFBsdWdpbkJhc2UgKnBsdWdpbiA9IG1QbHVnaW5CeUluc3RhbmNlLnZhbHVlQXQoaW5kZXgpOworICAgIG1QbHVnaW5CeUluc3RhbmNlLnJlbW92ZUl0ZW1zQXQoaW5kZXgpOworCisgICAgcmV0dXJuIHBsdWdpbi0+ZGVzdHJveUNvbXBvbmVudEluc3RhbmNlKGNvbXBvbmVudCk7Cit9CisKK09NWF9FUlJPUlRZUEUgT01YU3RvcmU6OmVudW1lcmF0ZUNvbXBvbmVudHMoCisgICAgICAgIE9NWF9TVFJJTkcgbmFtZSwKKyAgICAgICAgc2l6ZV90IHNpemUsCisgICAgICAgIE9NWF9VMzIgaW5kZXgpIHsKKyAgICBNdXRleDo6QXV0b2xvY2sgYXV0b0xvY2sobUxvY2spOworCisgICAgc2l6ZV90IG51bUNvbXBvbmVudHMgPSBtUGx1Z2luQnlDb21wb25lbnROYW1lLnNpemUoKTsKKworICAgIGlmIChpbmRleCA+PSBudW1Db21wb25lbnRzKSB7CisgICAgICAgIHJldHVybiBPTVhfRXJyb3JOb01vcmU7CisgICAgfQorCisgICAgY29uc3QgU3RyaW5nOCAmbmFtZTggPSBtUGx1Z2luQnlDb21wb25lbnROYW1lL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TdjFfQ00iLAorICAgICAgICAibGliR0xFU3YyIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgICAgICJsaWJuYXRpdmV3aW5kb3ciLAorICAgICAgICAibGlicHJvY2Vzc2dyb3VwIiwKKyAgICAgICAgImxpYnN5bmMiLAorICAgICAgICAibGlidWkiLAorICAgICAgICAibGlidXRpbHMiLAorICAgIF0sCisgICAgbG9jYWxfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUiXSwKKyAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUiXSwKK30KKworZmlsZWdyb3VwIHsKKyAgICBuYW1lOiAibGlicmVuZGVyZnJpZ2h0X3NvdXJjZXMiLAorICAgIHNyY3M6IFsKKyAgICAgICAgIkRlc2NyaXB0aW9uLmNwcCIsCisgICAgICAgICJNZXNoLmNwcCIsCisgICAgICAgICJSZW5kZXJFbmdpbmUuY3BwIiwKKyAgICAgICAgIlRleHR1cmUuY3BwIiwKKyAgICBdLAorfQorCitmaWxlZ3JvdXAgeworICAgIG5hbWU6ICJsaWJyZW5kZXJmcmlnaHRfZ2xfc291cmNlcyIsCisgICAgc3JjczogWworICAgICAgICAiZ2wvR0xFU1JlbmRlckVuZ2luZS5jcHAiLAorICAgICAgICAiZ2wvR0xFeHRlbnNpb25zLmNwcCIsCisgICAgICAgICJnbC9HTEZyYW1lYnVmZmVyLmNwcCIsCisgICAgICAgICJnbC9HTEltYWdlLmNwcCIsCisgICAgICAgICJnbC9HTFNoYWRvd1RleHR1cmUuY3BwIiwKKyAgICAgICAgImdsL0dMU2hhZG93VmVydGV4R2VuZXJhdG9yLmNwcCIsCisgICAgICAgICJnbC9HTFNraWFTaGFkb3dQb3J0LmNwcCIsCisgICAgICAgICJnbC9HTFZlcnRleEJ1ZmZlci5jcHAiLAorICAgICAgICAiZ2wvSW1hZ2VNYW5hZ2VyLmNwcCIsCisgICAgICAgICJnbC9Qcm9ncmFtLmNwcCIsCisgICAgICAgICJnbC9Qcm9ncmF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9yPEVHTENvbmZpZz4gY29uZmlncyhudW1Db25maWdzLCBFR0xfTk9fQ09ORklHX0tIUik7CisgICAgZWdsQ2hvb3NlQ29uZmlnKGRweSwgYXR0cnMsIGNvbmZpZ3MuZGF0YSgpLCBjb25maWdzLnNpemUoKSwgJm4pOworICAgIGNvbmZpZ3MucmVzaXplKG4pOworCisgICAgaWYgKCFjb25maWdzLmVtcHR5KCkpIHsKKyAgICAgICAgaWYgKGF0dHJpYnV0ZSAhPSBFR0xfTk9ORSkgeworICAgICAgICAgICAgZm9yIChFR0xDb25maWcgY29uZmlnIDogY29uZmlncykgeworICAgICAgICAgICAgICAgIEVHTGludCB2YWx1ZSA9IDA7CisgICAgICAgICAgICAgICAgZWdsR2V0Q29uZmlnQXR0cmliKGRweSwgY29uZmlnLCBhdHRyaWJ1dGUsICZ2YWx1ZSk7CisgICAgICAgICAgICAgICAgaWYgKHdhbnRlZCA9PSB2YWx1ZSkgeworICAgICAgICAgICAgICAgICAgICAqb3V0Q29uZmlnID0gY29uZmlnOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8ganVzdCBwaWNrIHRoZSBmaXJzdCBvbmUKKyAgICAgICAgICAgICpvdXRDb25maWcgPSBjb25maWdzWzBdOworICAgICAgICAgICAgcmV0dXJuIE5PX0VSUk9SOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIE5BTUVfTk9UX0ZPVU5EOworfQorCitzdGF0aWMgc3RhdHVzX3Qgc2VsZWN0RUdMQ29uZmlnKEVHTERpc3BsYXkgZGlzcGxheSwgRUdMaW50IGZvcm1hdCwgRUdMaW50IHJlbmRlcmFibGVUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFR0xDb25maWcqIGNvbmZpZykgeworICAgIC8vIHNlbGVjdCBvdXIgRUdMQ29uZmlnLiBJdCBt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ICAgICAgICAgICAgICAgRUdMX0dSRUVOX1NJWkUsCisgICAgICAgICAgICAgICAgaXMxMDEwMTAyID8gMTAgOiA4LAorICAgICAgICAgICAgICAgIEVHTF9CTFVFX1NJWkUsCisgICAgICAgICAgICAgICAgaXMxMDEwMTAyID8gMTAgOiA4LAorICAgICAgICAgICAgICAgIEVHTF9BTFBIQV9TSVpFLAorICAgICAgICAgICAgICAgIGlzMTAxMDEwMiA/IDIgOiA4LAorICAgICAgICAgICAgICAgIEVHTF9OT05FLAorICAgICAgICB9OworICAgICAgICBzdGQ6OmNvcHkodG1wQXR0cmlicywgdG1wQXR0cmlicyArIChzaXplb2YodG1wQXR0cmlicykgLyBzaXplb2YoRUdMaW50KSksCisgICAgICAgICAgICAgICAgICBzdGQ6OmJhY2tfaW5zZXJ0ZXIoYXR0cmlicykpOworICAgICAgICB3YW50ZWRBdHRyaWJ1dGUgPSBFR0xfTk9ORTsKKyAgICAgICAgd2FudGVkQXR0cmlidXRlVmFsdWUgPSBFR0xfTk9ORTsKKyAgICB9IGVsc2UgeworICAgICAgICAvLyBpZiBubyByZW5kZXJhYmxlIHR5cGUgc3BlY2lmaWVkLCBmYWxsYmFjayB0byBhIHNpbXBsaWZpZWQgcXVlcnkKKyAgICAgICAgd2FudGVkQXR0cmlidXRlID0gRUdMX05BVElWRV9WSVNVQUxfSUQ7CisgICAgICAgIHdhbnRlZEF0dHJpYnV0ZVZhbHVlID0gZm9ybWF0OworICAgIH0KKworICAgIGVyciA9IHNlbGVjdENvbmZpZ0ZvckF0dHJpYnV0ZShkaXNwbGF5LCBhdHRyaWJzLmRhdGEoKSwgd2FudGVkQXR0cmlidXRlLCB3YW50ZWRBdHRyaWJ1dGVWYWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnKTsKKyAgICBpZiAoZXJyID09IE5PX0VSUk9SKSB7CisgICAgICAgIEVHTGludCBjYXZlYXQ7CisgICAgICAgIGlmIChlZ2xHZXRDb25ma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4dFByaW9yaXR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQcm90ZWN0aW9uOjpQUk9URUNURUQpOworICAgICAgICBBTE9HRV9JRihwcm90ZWN0ZWRDb250ZXh0ID09IEVHTF9OT19DT05URVhULCAiQ2FuJ3QgY3JlYXRlIHByb3RlY3RlZCBjb250ZXh0Iik7CisgICAgfQorCisgICAgRUdMQ29udGV4dCBjdHh0ID0gY3JlYXRlRWdsQ29udGV4dChkaXNwbGF5LCBjb25maWcsIHByb3RlY3RlZENvbnRleHQsIHVzZUNvbnRleHRQcmlvcml0eSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFByb3RlY3Rpb246OlVOUFJPVEVDVEVEKTsKKworICAgIC8vIGlmIGNhbid0IGNyZWF0ZSBhIEdMIGNvbnRleHQsIHdlIGNhbiBvbmx5IGFib3J0LgorICAgIExPR19BTFdBWVNfRkFUQUxfSUYoY3R4dCA9PSBFR0xfTk9fQ09OVEVYVCwgIkVHTENvbnRleHQgY3JlYXRpb24gZmFpbGVkIik7CisKKyAgICBFR0xTdXJmYWNlIHN0dWIgPSBFR0xfTk9fU1VSRkFDRTsKKyAgICBpZiAoIWV4dGVuc2lvbnMuaGFzU3VyZmFjZWxlc3NDb250ZXh0KCkpIHsKKyAgICAgICAgc3R1YiA9IGNyZWF0ZVN0dWJFZ2xQYnVmZmVyU3VyZmFjZShkaXNwbGF5LCBjb25maWcsIGFyZ3MucGl4ZWxGb3JtYXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUHJvdGVjdGlvbjo6VU5QUk9URUNURUQpOworICAgICAgICBMT0dfQUxXQVlTX0ZBVEFMX0lGKHN0dWIgPT0gRUdMX05PX1NVUkZBQ0UsICJjYW4ndCBjcmVhdGUgc3R1YiBwYnVmZmVyIik7CisgICAgfQorICAgIEVHTEJvb2xlYW4gc3VjY2VzcyA9IGVnbE1ha2VDdXJyZW50K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RUdMX1NZTkNfRkVOQ0VfS0hSLCBudWxscHRyKSk7CisgICAgfQorCisgICAgcmV0dXJuIHdhaXRTeW5jKHN5bmMsIEVHTF9TWU5DX0ZMVVNIX0NPTU1BTkRTX0JJVF9LSFIpOworfQorCitib29sIEdMRVNSZW5kZXJFbmdpbmU6OndhaXRTeW5jKEVHTFN5bmNLSFIgc3luYywgRUdMaW50IGZsYWdzKSB7CisgICAgRUdMaW50IHJlc3VsdCA9IGVnbENsaWVudFdhaXRTeW5jS0hSKG1FR0xEaXNwbGF5LCBzeW5jLCBmbGFncywgMjAwMDAwMDAwMCAvKjIgc2VjKi8pOworICAgIEVHTGludCBlcnJvciA9IGVnbEdldEVycm9yKCk7CisgICAgZWdsRGVzdHJveVN5bmNLSFIobUVHTERpc3BsYXksIHN5bmMpOworICAgIGlmIChyZXN1bHQgIT0gRUdMX0NPTkRJVElPTl9TQVRJU0ZJRURfS0hSKSB7CisgICAgICAgIGlmIChyZXN1bHQgPT0gRUdMX1RJTUVPVVRfRVhQSVJFRF9LSFIpIHsKKyAgICAgICAgICAgIEFMT0dXKCJmZW5jZSB3YWl0IHRpbWVkIG91dCIpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgQUxPR1coImVycm9yIHdhaXRpbmcgb24gRUdMIGZlbmNlOiAlI3giLCBlcnJvcik7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHJldHVybiB0cnVlOworfQorCitib29sIEdMRVNSZW5kZXJFbmdpbmU6OndhaXRGZW5jZShiYXNlOjp1bmlxdWVfZmQgZmVuY2VGZCkgeworICAgIGlmICghR0xFeHRlbnNpb25zOjpnZXRJbnN0YW5jZSgpLmhhc05hdGl2ZUZlbmNlU3luYygpIHx8CisgICAgICAgICFHTEV4dGVuc2lvbnM6OmdldEluc3RhbmNlKCkuaGFzV2FpdFN5bmMoKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLy8gcmVs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B0cnVlOworfQorCit2b2lkIEdMRVNSZW5kZXJFbmdpbmU6OmNsZWFyV2l0aENvbG9yKGZsb2F0IHJlZCwgZmxvYXQgZ3JlZW4sIGZsb2F0IGJsdWUsIGZsb2F0IGFscGhhKSB7CisgICAgQVRSQUNFX0NBTEwoKTsKKyAgICBnbERpc2FibGUoR0xfQkxFTkQpOworICAgIGdsQ2xlYXJDb2xvcihyZWQsIGdyZWVuLCBibHVlLCBhbHBoYSk7CisgICAgZ2xDbGVhcihHTF9DT0xPUl9CVUZGRVJfQklUKTsKK30KKwordm9pZCBHTEVTUmVuZGVyRW5naW5lOjpmaWxsUmVnaW9uV2l0aENvbG9yKGNvbnN0IFJlZ2lvbiYgcmVnaW9uLCBmbG9hdCByZWQsIGZsb2F0IGdyZWVuLCBmbG9hdCBibHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IGFscGhhKSB7CisgICAgc2l6ZV90IGM7CisgICAgUmVjdCBjb25zdCogciA9IHJlZ2lvbi5nZXRBcnJheSgmYyk7CisgICAgTWVzaCBtZXNoID0gTWVzaDo6QnVpbGRlcigpCisgICAgICAgICAgICAgICAgICAgICAgICAuc2V0UHJpbWl0aXZlKE1lc2g6OlRSSUFOR0xFUykKKyAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRWZXJ0aWNlcyhjICogNiAvKiBjb3VudCAqLywgMiAvKiBzaXplICovKQorICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCk7CisgICAgTWVzaDo6VmVydGV4QXJyYXk8dmVjMj4gcG9zaXRpb24obWVzaC5nZXRQb3NpdGlvbkFycmF5PHZlYzI+KCkpOworICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgYzsgaSsrLCByKyspIHsKKyAgICAgICAgcG9zaXRpb25baSAqIDYgKyAwXS54ID0gci0+bGVmdDsKKyAgICAgICAgcG9zaXRpb25baSAqIDYgKyAwXS55ID0gci0+dG9wOworICAgICAgICBw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Y291bnQsIG5hbWVzKTsKK30KKwordm9pZCBHTEVTUmVuZGVyRW5naW5lOjpkZWxldGVUZXh0dXJlcyhzaXplX3QgY291bnQsIHVpbnQzMl90IGNvbnN0KiBuYW1lcykgeworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7ICsraSkgeworICAgICAgICBtVGV4dHVyZVZpZXcuZXJhc2UobmFtZXNbaV0pOworICAgIH0KKyAgICBnbERlbGV0ZVRleHR1cmVzKGNvdW50LCBuYW1lcyk7Cit9CisKK3ZvaWQgR0xFU1JlbmRlckVuZ2luZTo6YmluZEV4dGVybmFsVGV4dHVyZUltYWdlKHVpbnQzMl90IHRleE5hbWUsIGNvbnN0IEltYWdlJiBpbWFnZSkgeworICAgIEFUUkFDRV9DQUxMKCk7CisgICAgY29uc3QgR0xJbWFnZSYgZ2xJbWFnZSA9IHN0YXRpY19jYXN0PGNvbnN0IEdMSW1hZ2UmPihpbWFnZSk7CisgICAgY29uc3QgR0xlbnVtIHRhcmdldCA9IEdMX1RFWFRVUkVfRVhURVJOQUxfT0VTOworCisgICAgZ2xCaW5kVGV4dHVyZSh0YXJnZXQsIHRleE5hbWUpOworICAgIGlmIChnbEltYWdlLmdldEVHTEltYWdlKCkgIT0gRUdMX05PX0lNQUdFX0tIUikgeworICAgICAgICBnbEVHTEltYWdlVGFyZ2V0VGV4dHVyZTJET0VTKHRhcmdldCwgc3RhdGljX2Nhc3Q8R0xlZ2xJbWFnZU9FUz4oZ2xJbWFnZS5nZXRFR0xJbWFnZSgpKSk7CisgICAgfQorfQorCitzdGF0dXNfdCBHTEVTUmVuZGVyRW5naW5lOjpiaW5kRXh0ZXJuYWxUZXh0dXJlQnVmZmVyKHVpbnQzMl90IHRleE5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPEdyYXBoaWNCdWZmZXI+JiBidWZmZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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gdHdlYWtlZC4KKyAgICAgICAgaWYgKG1QbGFjZWhvbGRlckltYWdlICE9IEVHTF9OT19JTUFHRV9LSFIpIHsKKyAgICAgICAgICAgIGZvciAoYXV0byBbdGV4dHVyZU5hbWUsIGJ1ZmZlcklkXSA6IG1UZXh0dXJlVmlldykgeworICAgICAgICAgICAgICAgIGlmIChidWZmZXJJZCAmJiBtUGxhY2Vob2xkZXJJbWFnZSAhPSBFR0xfTk9fSU1BR0VfS0hSKSB7CisgICAgICAgICAgICAgICAgICAgIGdsQmluZFRleHR1cmUoR0xfVEVYVFVSRV9FWFRFUk5BTF9PRVMsIHRleHR1cmVOYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgZ2xFR0xJbWFnZVRhcmdldFRleHR1cmUyRE9FUyhHTF9URVhUVVJFX0VYVEVSTkFMX09FUywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxHTGVnbEltYWdlT0VTPihtUGxhY2Vob2xkZXJJbWFnZSkpOworICAgICAgICAgICAgICAgICAgICBtVGV4dHVyZVZpZXdbdGV4dHVyZU5hbWVdID0gc3RkOjpudWxsb3B0OworICAgICAgICAgICAgICAgICAgICBjaGVja0Vycm9ycygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB7CisgICAgICAgICAgICBzdGQ6OmxvY2tfZ3VhcmQ8c3RkOjptdXRleD4gbG9jayhtUmVuZGVyaW5nTXV0ZXgpOworICAgICAgICAgICAgbUltYWdlQ2FjaGUuY2xlYXIoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vIEJpbmQgdGhlIHRleHR1cmUgdG8gcGxhY2Vob2xkZXIgc28gdGhhdCBiYWNraW5nIGltYWdlIGRhdGEgY2FuIGJlIGZyZWVkLgorICAgIEdMRnJhbWVidWZmZXIqIGdsRnJhbWVidWZmZXIgPSBzdGF0aWNfY2FzdDxHTEZyYW1lY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Gl2ZUJ1ZmZlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzUHJvdGVjdGVkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgdXNlRnJhbWVidWZmZXJDYWNoZSkgeworICAgIHNwPEdyYXBoaWNCdWZmZXI+IGdyYXBoaWNCdWZmZXIgPSBHcmFwaGljQnVmZmVyOjpmcm9tKG5hdGl2ZUJ1ZmZlcik7CisgICAgaWYgKHVzZUZyYW1lYnVmZmVyQ2FjaGUpIHsKKyAgICAgICAgc3RkOjpsb2NrX2d1YXJkPHN0ZDo6bXV0ZXg+IGxvY2sobUZyYW1lYnVmZmVySW1hZ2VDYWNoZU11dGV4KTsKKyAgICAgICAgZm9yIChjb25zdCBhdXRvJiBpbWFnZSA6IG1GcmFtZWJ1ZmZlckltYWdlQ2FjaGUpIHsKKyAgICAgICAgICAgIGlmIChpbWFnZS5maXJzdCA9PSBncmFwaGljQnVmZmVyLT5nZXRJZCgpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGltYWdlLnNlY29uZDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICBFR0xpbnQgYXR0cmlidXRlc1tdID0geworICAgICAgICAgICAgaXNQcm90ZWN0ZWQgPyBFR0xfUFJPVEVDVEVEX0NPTlRFTlRfRVhUIDogRUdMX05PTkUsCisgICAgICAgICAgICBpc1Byb3RlY3RlZCA/IEVHTF9UUlVFIDogRUdMX05PTkUsCisgICAgICAgICAgICBFR0xfTk9ORSwKKyAgICB9OworICAgIEVHTEltYWdlS0hSIGltYWdlID0gZWdsQ3JlYXRlSW1hZ2VLSFIobUVHTERpc3BsYXksIEVHTF9OT19DT05URVhULCBFR0xfTkFUSVZFX0JVRkZFUl9BTkRST0lELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlQnVmZmVyLCBhdHRyaWJ1dGVzKTsKKyAgICBpZiAodXNlRnJhbWVidWZmZXJDYWNoZSkgeworICAgICAgICBpZiAoaW1hZ2UgIT0gRUdMX05PX0lNQUdFX0tIUikgeworICAgICAgICAgICAgc3RkOjpsb2NrX2d1YXJkPHN0ZDo6bXV0ZXg+IGxvY2sobUZyYW1lYnVmZmVySW1hZ2VDYWNoZU11dGV4KTsKKyAgICAgICAgICAgIGlmIChtRnJhbWVidWZmZXJJbWFnZUNhY2hlLnNpemUoKSA+PSBtRnJhbWVidWZmZXJJbWFnZUNhY2hlU2l6ZSkgeworICAgICAgICAgICAgICAgIEVHTEltYWdlS0hSIGV4cGlyZWQgPSBtRnJhbWVidWZmZXJJbWFnZUNhY2hlLmZyb250KCkuc2Vjb25kOworICAgICAgICAgICAgICAgIG1GcmFtZWJ1ZmZlckltYWdlQ2FjaGUucG9wX2Zyb250KCk7CisgICAgICAgICAgICAgICAgZWdsRGVzdHJveUltYWdlS0hSKG1FR0xEaXNwbGF5LCBleHBpcmVkKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1GcmFtZWJ1ZmZlckltYWdlQ2FjaGUucHVzaF9iYWNrKHtncmFwaGljQnVmZmVyLT5nZXRJZCgpLCBpbWFnZX0pOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIGltYWdlOworfQorCitzdGF0dXNfdCBHTEVTUmVuZGVyRW5naW5lOjpkcmF3TGF5ZXJzKGNvbnN0IERpc3BsYXlTZXR0aW5ncyYgZGlzcGxheSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8Y29uc3QgTGF5ZXJTZXR0aW5ncyo+JiBsYXllcnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPEdyYXBoaWNCdWZmZXI+JiBidWZmZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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5cy4gVGhpcyBpcworICAgIC8vIHByb2JhYmx5IG5vdCBxdWl0ZSBlZmZpY2llbnQgb24gYWxsIEdQVXMsIHNpbmNlIHdlIGNvdWxkIGZpbHRlciBvdXQKKyAgICAvLyBvcGFxdWUgbGF5ZXJzLgorICAgIGNsZWFyV2l0aENvbG9yKDAuMCwgMC4wLCAwLjAsIDAuMCk7CisKKyAgICBzZXRPdXRwdXREYXRhU3BhY2UoZGlzcGxheS5vdXRwdXREYXRhc3BhY2UpOworICAgIHNldERpc3BsYXlNYXhMdW1pbmFuY2UoZGlzcGxheS5tYXhMdW1pbmFuY2UpOworCisgICAgY29uc3QgbWF0NCBwcm9qZWN0aW9uTWF0cml4ID0KKyAgICAgICAgICAgIHVpOjpUcmFuc2Zvcm0oZGlzcGxheS5vcmllbnRhdGlvbikuYXNNYXRyaXg0KCkgKiBtU3RhdGUucHJvamVjdGlvbk1hdHJpeDsKKyAgICBpZiAoIWRpc3BsYXkuY2xlYXJSZWdpb24uaXNFbXB0eSgpKSB7CisgICAgICAgIGdsRGlzYWJsZShHTF9CTEVORCk7CisgICAgICAgIGZpbGxSZWdpb25XaXRoQ29sb3IoZGlzcGxheS5jbGVhclJlZ2lvbiwgMC4wLCAwLjAsIDAuMCwgMS4wKTsKKyAgICB9CisKKyAgICBNZXNoIG1lc2ggPSBNZXNoOjpCdWlsZGVyKCkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRQcmltaXRpdmUoTWVzaDo6VFJJQU5HTEVfRkFOKQorICAgICAgICAgICAgICAgICAgICAgICAgLnNldFZlcnRpY2VzKDQgLyogY291bnQgKi8sIDIgLyogc2l6ZSAqLykKKyAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRUZXhDb29yZHMoMiAvKiBzaXplICovKQorICAgICAgICAgICAgICAgICAgICAgICAgLnNldENyb3BDb29yZHMoMiAvKiBzaXplICovKQorICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCk7CisgICAgZm9yIChhdXRvIGNvbnN0IGxheWVyIDogbGF5ZXJzKSB7CisgICAgICAgIGlmIChibHVyTGF5ZXJzLnNpemUoKSA+IDAgJiYgYmx1ckxheWVycy5mcm9udCgpID09IGxheWVyKSB7CisgICAgICAgICAgICBibHVyTGF5ZXJzLnBvcF9mcm9udCgpOworCisgICAgICAgICAgICBhdXRvIHN0YXR1cyA9IG1CbHVyRmlsdGVyLT5wcmVwYXJlKCk7CisgICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7CisgICAgICAgICAgICAgICAgQUxPR0UoIkZhaWxlZCB0byByZW5kZXIgYmx1ciBlZmZlY3QhIEFib3J0aW5nIEdQVSBjb21wb3NpdGlvbiBmb3IgYnVmZmVyICglcCkuIiwKKyAgICAgICAgICAgICAgICAgICAgICBidWZmZXItPmhhbmRsZSk7CisgICAgICAgICAgICAgICAgY2hlY2tFcnJvcnMoIkNhbid0IHJlbmRlciBmaXJzdCBibHVyIHBhc3MiKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoYmx1ckxheWVycy5zaXplKCkgPT0gMCkgeworICAgICAgICAgICAgICAgIC8vIERvbmUgYmx1cnJpbmcsIHRpbWUgdG8gYmluZCB0aGUgbmF0aXZlIEZCTyBhbmQgcmVuZGVyIG91ciBibHVyIG9udG8gaXQuCisgICAgICAgICAgICAgICAgZmJvID0gc3RkOjptYWtlX3VuaXF1ZTxCaW5kTmF0aXZlQnVmZmVyQXNGcmFtZWJ1ZmZlcj4oKnRoaXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyLmdldCgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtPmdldE5hdGl2ZUJ1ZmZlcigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZUZyYW1lYnVmZmVyQ2FjaGUpOworICAgICAgICAgICAgICAgIHN0YXR1cyA9IGZiby0+Z2V0U3RhdHVzKCk7CisgICAgICAgICAgICAgICAgc2V0Vmlld3BvcnRBbmRQcm9qZWN0aW9uKGRpc3BsYXkucGh5c2ljYWxEaXNwbGF5LCBkaXNwbGF5LmNsaXApOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyBUaGVyZSdzIHN0aWxsIHNvbWV0aGluZyBlbHNlIHRvIGJsdXIsIHNvIGxldCdzIGtlZXAgcmVuZGVyaW5nIHRvIG91ciBGQk8KKyAgICAgICAgICAgICAgICAvLyBpbnN0ZWFkIG9mIHRvIHRoZSBkaXNwbGF5LgorICAgICAgICAgICAgICAgIHN0YXR1cyA9IG1CbHVyRmlsdGVyLT5zZXRBc0RyYXdUYXJnZXQoZGlzcGxheSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsdXJMYXllcnMuZnJvbnQoKS0+YmFja2dyb3VuZEJsdXJSYWRpdXMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgeworICAgICAgICAgICAgICAgIEFMT0dFKCJGYWlsZWQgdG8gYmluZCBmcmFtZWJ1ZmZlciEgQWJvcnRpbmcgR1BVIGNvbXBvc2l0aW9uIGZvciBidWZmZXIgKCVwKS4iLAorICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlci0+aGFuZGxlKTsKKyAgICAgICAgICAgICAgICBjaGVja0Vycm9ycygiQ2FuJ3QgYmluZCBuYXRpdmUgZnJhbWVidWZmZXIiKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzdGF0dXMgPSBtQmx1ckZpbHRlci0+cmVuZGVyKGJsdXJMYXllcnNTaXplID4gMSk7CisgICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7CisgICAgICAgICAgICAgICAgQUxPR0UoIkZhaWxlZCB0byByZW5kZXIgYmx1ciBlZmZlY3QhIEFib3J0aW5nIEdQVSBjb21wb3NpdGlvbiBmb3IgYnVmZmVyICglcCkuIiwKKyAgICAgICAgICAgICAgICAgICAgICBidWZmZXItPmhhbmRsZSk7CisgICAgICAgICAgICAgICAgY2hlY2tFcnJvcnMoIkNhbid0IHJlbmRlciBibHVyIGZpbHRlciIpOworICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBtU3RhdGUubWF4TWFzdGVyaW5nTHVtaW5hbmNlID0gbGF5ZXItPnNvdXJjZS5idWZmZXIubWF4TWFzdGVyaW5nTHVtaW5hbmNlOworICAgICAgICBtU3RhdGUubWF4Q29udGVudEx1bWluYW5jZSA9IGxheWVyLT5zb3VyY2UuYnVmZmVyLm1heENvbnRlbnRMdW1pbmFuY2U7CisgICAgICAgIG1TdGF0ZS5wcm9qZWN0aW9uTWF0cml4ID0gcHJvamVjdGlvbk1hdHJpeCAqIGxheWVyLT5nZW9tZXRyeS5wb3NpdGlvblRyYW5zZm9ybTsKKworICAgICAgICBjb25zdCBGbG9hdFJlY3QgYm91bmRzID0gbGF5ZXItPmdlb21ldHJ5LmJvdW5kYXJpZXM7CisgICAgICAgIE1lc2g6OlZlcnRleEFycmF5PHZlYzI+IHBvc2l0aW9uKG1lc2guZ2V0UG9zaXRpb25BcnJheTx2ZWMyPigpKTsKKyAgICAgICAgcG9zaXRpb25bMF0gPSB2ZWMyKGJvdW5kcy5sZWZ0LCBib3VuZHMudG9wKTsKKyAgICAgICAgcG9zaXRpb25bMV0gPSB2ZWMyKGJvdW5kcy5sZWZ0LCBib3VuZHMuYm90dG9tKTsKKyAgICAgICAgcG9zaXRpb25bMl0gPSB2ZWMyKGJvdW5kcy5yaWdodCwgYm91bmRzLmJvdHRvbSk7CisgICAgICAgIHBvc2l0aW9uWzNdID0gdmVjMihib3VuZHMucmlnaHQsIGJvdW5kcy50b3ApOworCisgICAgICAgIHNldHVwTGF5ZXJDcm9wcGluZygqbGF5ZXIsIG1lc2gpOworICAgICAgICBzZXRDb2xvclRyYW5zZm9ybShkaXNwbGF5LmNvbG9yVHJhbnNmb3JtICogbGF5ZXItPmNvbG9yVHJhbnNmb3JtKTsKKworICAgICAgICBib29sIHVzZVByZW11bHRpcGxpZWRBbHBoYSA9IHRydWU7CisgICAgICAgIGJvb2wgZGlzYWJsZVRleHR1cmUgPSB0cnVlOworICAgICAgICBib29sIGlzT3BhcXVlID0gZmFsc2U7CisgICAgICAgIGlmIChsYXllci0+c291cmNlLmJ1ZmZlci5idWZmZXIgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgZGlzYWJsZVRleHR1cmUgPSBmYWxzZTsKKyAgICAgICAgICAgIGlzT3BhcXVlID0gbGF5ZXItPnNvdXJjZS5idWZmZXIuaXNPcGFxdWU7CisKKyAgICAgICAgICAgIHNwPEdyYXBoaWNCdWZmZXI+IGdCdWYgPSBsYXllci0+c291cmNlLmJ1ZmZlci5idWZmZXI7CisgICAgICAgICAgICBiaW5kRXh0ZXJuYWxUZXh0dXJlQnVmZmVyKGxheWVyLT5zb3VyY2UuYnVmZmVyLnRleHR1cmVOYW1lLCBnQnVmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXllci0+c291cmNlLmJ1ZmZlci5mZW5jZSk7CisKKyAgICAgICAgICAgIHVzZVByZW11bHRpcGxpZWRBbHBoYSA9IGxheWVyLT5zb3VyY2UuYnVmZmVyLnVzZVByZW11bHRpcGxpZWRBbHBoYTsKKyAgICAgICAgICAgIFRleHR1cmUgdGV4dHVyZShUZXh0dXJlOjpURVhUVVJFX0VYVEVSTkFMLCBsYXllci0+c291cmNlLmJ1ZmZlci50ZXh0dXJlTmFtZ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5lZWRzIHRvIHR1cm4gb24gYmxlbmRpbmcgYW55d2F5LgorICAgICAgICBlbHNlIGlmIChsYXllci0+Z2VvbWV0cnkucm91bmRlZENvcm5lcnNSYWRpdXMgPiAwLjAgJiYgY29sb3IuYSA+PSAxLjBmICYmIGlzT3BhcXVlKSB7CisgICAgICAgICAgICBoYW5kbGVSb3VuZGVkQ29ybmVycyhkaXNwbGF5LCAqbGF5ZXIsIG1lc2gpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZHJhd01lc2gobWVzaCk7CisgICAgICAgIH0KKworICAgICAgICAvLyBDbGVhbnVwIGlmIHRoZXJlJ3MgYSBidWZmZXIgc291cmNlCisgICAgICAgIGlmIChsYXllci0+c291cmNlLmJ1ZmZlci5idWZmZXIgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgZGlzYWJsZUJsZW5kaW5nKCk7CisgICAgICAgICAgICBzZXRTb3VyY2VZNDEwQlQyMDIwKGZhbHNlKTsKKyAgICAgICAgICAgIGRpc2FibGVUZXh0dXJpbmcoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmIChkcmF3RmVuY2UgIT0gbnVsbHB0cikgeworICAgICAgICAqZHJhd0ZlbmNlID0gZmx1c2goKTsKKyAgICB9CisgICAgLy8gSWYgZmx1c2ggZmFpbGVkIG9yIHdlIGRvbid0IHN1cHBvcnQgbmF0aXZlIGZlbmNlcywgd2UgbmVlZCB0byBmb3JjZSB0aGUKKyAgICAvLyBnbCBjb21tYW5kIHN0cmVhbSB0byBiZSBleGVjdXRlZC4KKyAgICBpZiAoZHJhd0ZlbmNlID09IG51bGxwdHIgfHwgZHJhd0ZlbmNlLT5nZXQoKSA8IDApIHsKKyAgICAgICAgYm9vbCBzdWNjZXNzID0gZmluaXNoKCk7CisgICAgICAgIGlmICghc3VjY2VzcykgeworICAgICAgICAgICAgQUxPR0UoIkZhaWxlZCB0byBmbHVzaCBSZW5kZXJFbmdpbmUgY29tbWFuZHMiKTsKKyAgICAgICA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X0JUNzA5CisgICAgICAgIGlmIChpbnB1dFN0YW5kYXJkICE9IERhdGFzcGFjZTo6U1RBTkRBUkRfRENJX1AzICYmCisgICAgICAgICAgICBpbnB1dFN0YW5kYXJkICE9IERhdGFzcGFjZTo6U1RBTkRBUkRfQlQyMDIwKSB7CisgICAgICAgICAgICBpbnB1dFN0YW5kYXJkID0gRGF0YXNwYWNlOjpTVEFOREFSRF9CVDcwOTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChuZWVkc1hZWkNvbnZlcnNpb24pIHsKKyAgICAgICAgICAgIC8vIFRoZSBzdXBwb3J0ZWQgaW5wdXQgY29sb3Igc3BhY2VzIGFyZSBzdGFuZGFyZCBSR0IsIERpc3BsYXkgUDMgYW5kIEJUMjAyMC4KKyAgICAgICAgICAgIHN3aXRjaCAoaW5wdXRTdGFuZGFyZCkgeworICAgICAgICAgICAgICAgIGNhc2UgRGF0YXNwYWNlOjpTVEFOREFSRF9EQ0lfUDM6CisgICAgICAgICAgICAgICAgICAgIG1hbmFnZWRTdGF0ZS5pbnB1dFRyYW5zZm9ybU1hdHJpeCA9IG1EaXNwbGF5UDNUb1h5ejsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBEYXRhc3BhY2U6OlNUQU5EQVJEX0JUMjAyMDoKKyAgICAgICAgICAgICAgICAgICAgbWFuYWdlZFN0YXRlLmlucHV0VHJhbnNmb3JtTWF0cml4ID0gbUJ0MjAyMFRvWHl6OworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICBtYW5hZ2VkU3RhdGUuaW5wdXRUcmFuc2Zvcm1NYXRyaXggPSBtU3JnYlRvWHl6OworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gVGhlIHN1cHBvcnRlZCBvdXRwdXQgY29sb3Igc3BhY2VzIGFyZSBCVDIwMjAsIERpc3BsYXkgUDMgYW5kIHN0YW5kYXJkIFJHQi4KKyAgICAgICAgICAgIHN3aXRjaCAob3V0cHV0U3RhbmRhcmQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIERhdGFzcGFjZTo6U1RBTkRBUkRfQlQyMDIwOgorICAgICAgICAgICAgICAgICAgICBtYW5hZ2VkU3RhdGUub3V0cHV0VHJhbnNmb3JtTWF0cml4ID0gbVh5elRvQnQyMDIwOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIERhdGFzcGFjZTo6U1RBTkRBUkRfRENJX1AzOgorICAgICAgICAgICAgICAgICAgICBtYW5hZ2VkU3RhdGUub3V0cHV0VHJhbnNmb3JtTWF0cml4ID0gbVh5elRvRGlzcGxheVAzOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICBtYW5hZ2VkU3RhdGUub3V0cHV0VHJhbnNmb3JtTWF0cml4ID0gbVh5elRvU3JnYjsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAoaW5wdXRTdGFuZGFyZCAhPSBvdXRwdXRTdGFuZGFyZCkgeworICAgICAgICAgICAgLy8gQXQgdGhpcyBwb2ludCwgdGhlIGlucHV0IGRhdGEgc3BhY2UgYW5kIG91dHB1dCBkYXRhIHNwYWNlIGNvdWxkIGJlIGJvdGgKKyAgICAgICAgICAgIC8vIEhEUiBkYXRhIHNwYWNlcywgYnV0IHRoZXkgbWF0Y2ggZWFjaCBvdGhlciwgd2UgZG8gbm90aGluZyBpbiB0aGlzIGNhc2UuCisgICAgICAgICAgICAvLyBJbiBhZGRpdGlvbiB0byB0aGUgY2FzZSBhYm92ZSwgdGhlIGlucHV0IGRhdGEgc3BhY2UgY291bGQgYmUKKyAgICAgICAgICAgIC8vIC0gc2NSR0IgbGluZWFyCisgICAgICAgICAgICAvLyAtIHNjUkdCIG5vbi1saW5lYXIKKyAgICAgICAgICAgIC8vIC0gc1JHQgorICAgICAgICAgICAgLy8gLSBEaXNwbGF5IFAzCisgICAgICAgICAgICAvLyAtIEJUMjAyMAorICAgICAgICAgICAgLy8gVGhlIG91dHB1dCBkYXRhIHNwYWNlcyBjb3VsZCBiZQorICAgICAgICAgICAgLy8gLSBzUkdCCisgICAgICAgICAgICAvLyAtIERpc3BsYXkgUDMKKyAgICAgICAgICAgIC8vIC0gQlQyMDIwCisgICAgICAgICAgICBzd2l0Y2ggKG91dHB1dFN0YW5kYXJkKSB7CisgICAgICAgICAgICAgICAgY2FzZSBEYXRhc3BhY2U6OlNUQU5EQVJEX0JUMjAyMDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0U3RhbmRhcmQgPT0gRGF0YXNwYWNlOjpTVEFOREFSRF9CVDcwOSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbWFuYWdlZFN0YXRlLm91dHB1dFRyYW5zZm9ybU1hdHJpeCA9IG1TcmdiVG9CdDIwMjA7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXRTdGFuZGFyZCA9PSBEYXRhc3BhY2U6OlNUQU5EQVJEX0RDSV9QMykgeworICAgICAgICAgICAgICAgICAgICAgICAgbWFuYWdlZFN0YXRlLm91dHB1dFRyYW5zZm9ybU1hdHJpeCA9IG1EaXNwbGF5UDNUb0J0MjAyMDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIERhdGFzcGFjZTo6U1RBTkRBUkRfRENJX1AzOgorICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXRTdGFuZGFyZCA9PSBEYXRhc3BhY2U6OlNUQU5EQVJEX0JUNzA5KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2VkU3RhdGUub3V0cHV0VHJhbnNmb3JtTWF0cml4ID0gbVNyZ2JUb0Rpc3BsYXlQMzsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dFN0YW5kYXJkID09IERhdGFzcGFjZTo6U1RBTkRBUkRfQlQyMDIwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2VkU3RhdGUub3V0cHV0VHJhbnNmb3JtTWF0cml4ID0gbUJ0MjAyMFRvRGlzcGxheVAzOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dFN0YW5kYXJkID09IERhdGFzcGFjZTo6U1RBTkRBUkRfRENJX1AzKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2VkU3RhdGUub3V0cHV0VHJhbnNmb3JtTWF0cml4ID0gbURpc3BsYXlQM1RvU3JnYjsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dFN0YW5kYXJkID09IERhdGFzcGFjZTo6U1RBTkRBUkRfQlQyMDIwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2VkU3RhdGUub3V0cHV0VHJhbnNmb3JtTWF0cml4ID0gbUJ0MjAyMFRvU3JnYjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIHdlIG5lZWQgdG8gY29udmVydCB0aGUgUkdCIHZhbHVlIHRvIGxpbmVhciBzcGFjZSBhbmQgY29udmVydCBpdCBiYWNrIHdoZW46CisgICAgICAgIC8vIC0gdGhlcmUgaXMgYSBjb2xvciBtYXRyaXggdGhhdCBpcyBub3QgYW4gaWRlbnRpdHkgbWF0cml4LCBvcgorICAgICAgICAvLyAtIHRoZXJlIGlzIGFuIG91dHB1dCB0cmFuc2Zvcm0gbWF0cml4IHRoYXQ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zY2FuZihzdHIsICJPcGVuR0wgRVMgJWQuJWQiLCAmbWFqb3IsICZtaW5vcikgIT0gMikgeworICAgICAgICAgICAgQUxPR1coIlVuYWJsZSB0byBwYXJzZSBHTF9WRVJTSU9OIHN0cmluZzogXCIlc1wiIiwgc3RyKTsKKyAgICAgICAgICAgIHJldHVybiBHTEVTX1ZFUlNJT05fMV8wOworICAgICAgICB9CisgICAgfQorCisgICAgaWYgKG1ham9yID09IDEgJiYgbWlub3IgPT0gMCkgcmV0dXJuIEdMRVNfVkVSU0lPTl8xXzA7CisgICAgaWYgKG1ham9yID09IDEgJiYgbWlub3IgPj0gMSkgcmV0dXJuIEdMRVNfVkVSU0lPTl8xXzE7CisgICAgaWYgKG1ham9yID09IDIgJiYgbWlub3IgPj0gMCkgcmV0dXJuIEdMRVNfVkVSU0lPTl8yXzA7CisgICAgaWYgKG1ham9yID09IDMgJiYgbWlub3IgPj0gMCkgcmV0dXJuIEdMRVNfVkVSU0lPTl8zXzA7CisKKyAgICBBTE9HVygiVW5yZWNvZ25pemVkIE9wZW5HTCBFUyB2ZXJzaW9uOiAlZC4lZCIsIG1ham9yLCBtaW5vcik7CisgICAgcmV0dXJuIEdMRVNfVkVSU0lPTl8xXzA7Cit9CisKK0VHTENvbnRleHQgR0xFU1JlbmRlckVuZ2luZTo6Y3JlYXRlRWdsQ29udGV4dChFR0xEaXNwbGF5IGRpc3BsYXksIEVHTENvbmZpZyBjb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRUdMQ29udGV4dCBzaGFyZUNvbnRleHQsIGJvb2wgdXNlQ29udGV4dFByaW9yaXR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFByb3RlY3Rpb24gcHJvdGVjdGlvbikgeworICAgIEVHTGludCByZW5kZXJhYmxlVHlwZSA9IDA7CisgICAgaWYgKGNvbmZpZyA9PSBFR0xfTk9fQ09ORklHKSB7CisgICAgICAgI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gICAgICAgIGlmICghbVJ1bm5pbmcpIHsKKyAgICAgICAgICAgICAgICAvLyBpZiBtUnVubmluZyBpcyBmYWxzZSwgdGhlbiBGbHVzaFRyYWNlciBpcyBiZWluZyBkZXN0cm95ZWQsIHNvCisgICAgICAgICAgICAgICAgLy8gYmFpbCBvdXQgbm93LgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZW50cnkgPSBtUXVldWUuZnJvbnQoKTsKKyAgICAgICAgICAgIG1RdWV1ZS5wb3AoKTsKKyAgICAgICAgfQorICAgICAgICB7CisgICAgICAgICAgICBjaGFyIG5hbWVbNjRdOworICAgICAgICAgICAgc25wcmludGYobmFtZSwgc2l6ZW9mKG5hbWUpLCAid2FpdGluZyBmb3IgZnJhbWUgJWx1IiwKKyAgICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PHVuc2lnbmVkIGxvbmc+KGVudHJ5Lm1GcmFtZU51bSkpOworICAgICAgICAgICAgQVRSQUNFX05BTUUobmFtZSk7CisgICAgICAgICAgICBtRW5naW5lLT53YWl0U3luYyhlbnRyeS5tU3luYywgMCk7CisgICAgICAgIH0KKyAgICB9Cit9CisKK3ZvaWQgR0xFU1JlbmRlckVuZ2luZTo6aGFuZGxlU2hhZG93KGNvbnN0IEZsb2F0UmVjdCYgY2FzdGVyUmVjdCwgZmxvYXQgY2FzdGVyQ29ybmVyUmFkaXVzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU2hhZG93U2V0dGluZ3MmIHNldHRpbmdzKSB7CisgICAgQVRSQUNFX0NBTEwoKTsKKyAgICBjb25zdCBmbG9hdCBjYXN0ZXJaID0gc2V0dGluZ3MubGVuZ3RoIC8gMi4wZjsKKyAgICBjb25zdCBHTFNoYWRvd1ZlcnRleEdlbmVyYXRvciBzaGFkb3dzKGNhc3RlclJlY3QsIGNhc3RlckNvcm5lclJhZGl1cywgY2FzdGVyWiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLmNhc3RlcklzVHJhbnNsdWNlbnQsIHNldHRpbmdzLmFtYmllbnRDb2xvciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzLnNwb3RDb2xvciwgc2V0dGluZ3MubGlnaHRQb3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5ncy5saWdodFJhZGl1cyk7CisKKyAgICAvLyBzZXR1cCBtZXNoIGZvciBib3RoIHNoYWRvd3MKKyAgICBNZXNoIG1lc2ggPSBNZXNoOjpCdWlsZGVyKCkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRQcmltaXRpdmUoTWVzaDo6VFJJQU5HTEVTKQorICAgICAgICAgICAgICAgICAgICAgICAgLnNldFZlcnRpY2VzKHNoYWRvd3MuZ2V0VmVydGV4Q291bnQoKSwgMiAvKiBzaXplICovKQorICAgICAgICAgICAgICAgICAgICAgICAgLnNldFNoYWRvd0F0dHJzKCkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRJbmRpY2VzKHNoYWRvd3MuZ2V0SW5kZXhDb3VudCgpKQorICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCk7CisKKyAgICBNZXNoOjpWZXJ0ZXhBcnJheTx2ZWMyPiBwb3NpdGlvbiA9IG1lc2guZ2V0UG9zaXRpb25BcnJheTx2ZWMyPigpOworICAgIE1lc2g6OlZlcnRleEFycmF5PHZlYzQ+IHNoYWRvd0NvbG9yID0gbWVzaC5nZXRTaGFkb3dDb2xvckFycmF5PHZlYzQ+KCk7CisgICAgTWVzaDo6VmVydGV4QXJyYXk8dmVjMz4gc2hhZG93UGFyYW1zID0gbWVzaC5nZXRTaGFkb3dQYXJhbXNBcnJheTx2ZWMzPigpOworICAgIHNoYWRvd3MuZmlsbFZlcnRpY2VzKHBvc2l0aW9uLCBzaGFkb3dDb2xvciwg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udGV4dChFR0xEaXNwbGF5IGRpc3BsYXksIEVHTENvbmZpZyBjb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFR0xDb250ZXh0IHNoYXJlQ29udGV4dCwgYm9vbCB1c2VDb250ZXh0UHJpb3JpdHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQcm90ZWN0aW9uIHByb3RlY3Rpb24pOworICAgIHN0YXRpYyBFR0xTdXJmYWNlIGNyZWF0ZVN0dWJFZ2xQYnVmZmVyU3VyZmFjZShFR0xEaXNwbGF5IGRpc3BsYXksIEVHTENvbmZpZyBjb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBod2NGb3JtYXQsIFByb3RlY3Rpb24gcHJvdGVjdGlvbik7CisgICAgc3RkOjp1bmlxdWVfcHRyPEZyYW1lYnVmZmVyPiBjcmVhdGVGcmFtZWJ1ZmZlcigpOworICAgIHN0ZDo6dW5pcXVlX3B0cjxJbWFnZT4gY3JlYXRlSW1hZ2UoKTsKKyAgICB2b2lkIGNoZWNrRXJyb3JzKCkgY29uc3Q7CisgICAgdm9pZCBjaGVja0Vycm9ycyhjb25zdCBjaGFyKiB0YWcpIGNvbnN0OworICAgIHZvaWQgc2V0U2Npc3Nvcihjb25zdCBSZWN0JiByZWdpb24pOworICAgIHZvaWQgZGlzYWJsZVNjaXNzb3IoKTsKKyAgICBib29sIHdhaXRTeW5jKEVHTFN5bmNLSFIgc3luYywgRUdMaW50IGZsYWdzKTsKKyAgICBzdGF0dXNfdCBjYWNoZUV4dGVybmFsVGV4dHVyZUJ1ZmZlckludGVybmFsKGNvbnN0IHNwPEdyYXBoaWNCdWZmZXI+JiBidWZmZXIpCisgICAgICAgICAgICBFWENMVURFUyhtUmVuZGVyaW5nTXV0ZXgpOworICAgIHZvaWQgdW5iaW5kRXh0ZXJuYWxUZXh0dXJlQnVmZmVySW50ZXJuYWwodWludDY0X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FzdCBkcmF3CisgICAgLy8gZmVuY2UgdGhhdCBkb2Vzbid0IGV4aXN0LgorICAgIGJvb2wgbVByaW9yUmVzb3VyY2VzQ2xlYW5lZCA9IHRydWU7CisKKyAgICAvLyBCbHVyIGVmZmVjdCBwcm9jZXNzb3IsIG9ubHkgaW5zdGFudGlhdGVkIHdoZW4gYSBsYXllciByZXF1ZXN0cyBpdC4KKyAgICBCbHVyRmlsdGVyKiBtQmx1ckZpbHRlciA9IG51bGxwdHI7CisKKyAgICBjbGFzcyBGbHVzaFRyYWNlciB7CisgICAgcHVibGljOgorICAgICAgICBGbHVzaFRyYWNlcihHTEVTUmVuZGVyRW5naW5lKiBlbmdpbmUpOworICAgICAgICB+Rmx1c2hUcmFjZXIoKTsKKyAgICAgICAgdm9pZCBxdWV1ZVN5bmMoRUdMU3luY0tIUiBzeW5jKSBFWENMVURFUyhtTXV0ZXgpOworCisgICAgICAgIHN0cnVjdCBRdWV1ZUVudHJ5IHsKKyAgICAgICAgICAgIEVHTFN5bmNLSFIgbVN5bmMgPSBudWxscHRyOworICAgICAgICAgICAgdWludDY0X3QgbUZyYW1lTnVtID0gMDsKKyAgICAgICAgfTsKKworICAgIHByaXZhdGU6CisgICAgICAgIHZvaWQgbG9vcCgpOworICAgICAgICBHTEVTUmVuZGVyRW5naW5lKiBjb25zdCBtRW5naW5lOworICAgICAgICBzdGQ6OnRocmVhZCBtVGhyZWFkOworICAgICAgICBzdGQ6OmNvbmRpdGlvbl92YXJpYWJsZV9hbnkgbUNvbmRpdGlvbjsKKyAgICAgICAgc3RkOjptdXRleCBtTXV0ZXg7CisgICAgICAgIHN0ZDo6cXVldWU8UXVldWVFbnRyeT4gbVF1ZXVlIEdVQVJERURfQlkobU11dGV4KTsKKyAgICAgICAgdWludDY0X3QgbUZyYW1lc1F1ZXVlZCBHVUFSREVEX0JZKG1NdXRleCkgPSAwOworICAgICAgICBib29sIG1SdW5uaW5nID0gdHJ1ZTsKKyAgICB9OworICAgIGZyaWVuZ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RXh0ZW5zaW9uU2V0IHsKK3B1YmxpYzoKKyAgICBFeHRlbnNpb25TZXQoY29uc3QgY2hhciogZXh0ZW5zaW9ucykgeworICAgICAgICBjaGFyIGNvbnN0KiBjdXJyID0gZXh0ZW5zaW9uczsKKyAgICAgICAgY2hhciBjb25zdCogaGVhZCA9IGN1cnI7CisgICAgICAgIGRvIHsKKyAgICAgICAgICAgIGhlYWQgPSBzdHJjaHIoY3VyciwgJyAnKTsKKyAgICAgICAgICAgIHNpemVfdCBsZW4gPSBoZWFkID8gaGVhZCAtIGN1cnIgOiBzdHJsZW4oY3Vycik7CisgICAgICAgICAgICBpZiAobGVuID4gMCkgeworICAgICAgICAgICAgICAgIG1FeHRlbnNpb25zLmVtcGxhY2UoY3VyciwgbGVuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGN1cnIgPSBoZWFkICsgMTsKKyAgICAgICAgfSB3aGlsZSAoaGVhZCk7CisgICAgfQorCisgICAgYm9vbCBoYXNFeHRlbnNpb24oY29uc3QgY2hhciogZXh0ZW5zaW9uKSBjb25zdCB7IHJldHVybiBtRXh0ZW5zaW9ucy5jb3VudChleHRlbnNpb24pID4gMDsgfQorCitwcml2YXRlOgorICAgIHN0ZDo6dW5vcmRlcmVkX3NldDxzdGQ6OnN0cmluZz4gbUV4dGVuc2lvbnM7Cit9OworCit9IC8vIGFub255bW91cyBuYW1lc3BhY2UKKwordm9pZCBHTEV4dGVuc2lvbnM6OmluaXRXaXRoR0xTdHJpbmdzKEdMdWJ5dGUgY29uc3QqIHZlbmRvciwgR0x1Ynl0ZSBjb25zdCogcmVuZGVyZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0x1Ynl0ZSBjb25zdCogdmVyc2lvbiwgR0x1Ynl0ZSBjb25zdCogZXh0ZW5zaW9ucykgeworICAgIG1WZW5kb3IgPSAoY2hhciBjb25zdCopdmVuZG9yOworICAgIG1SZW5kZXJlciA9IChjaGFyIGNvbnN0KilyZ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VyWiwgY2FzdGVySXNUcmFuc2x1Y2VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BvdENvbG9yLCBsaWdodFBvc2l0aW9uLCBsaWdodFJhZGl1cyk7CisgICAgICAgIG1TcG90U2hhZG93VmVydGV4Q291bnQgPSBnZXRWZXJ0ZXhDb3VudEZvckdlb21ldHJ5KCptU3BvdFNoYWRvd0dlb21ldHJ5LmdldCgpKTsKKyAgICAgICAgbVNwb3RTaGFkb3dJbmRleENvdW50ID0gZ2V0SW5kZXhDb3VudEZvckdlb21ldHJ5KCptU3BvdFNoYWRvd0dlb21ldHJ5LmdldCgpKTsKKyAgICB9IGVsc2UgeworICAgICAgICBtU3BvdFNoYWRvd1ZlcnRleENvdW50ID0gMDsKKyAgICAgICAgbVNwb3RTaGFkb3dJbmRleENvdW50ID0gMDsKKyAgICB9Cit9CisKK3NpemVfdCBHTFNoYWRvd1ZlcnRleEdlbmVyYXRvcjo6Z2V0VmVydGV4Q291bnQoKSBjb25zdCB7CisgICAgcmV0dXJuIG1BbWJpZW50U2hhZG93VmVydGV4Q291bnQgKyBtU3BvdFNoYWRvd1ZlcnRleENvdW50OworfQorCitzaXplX3QgR0xTaGFkb3dWZXJ0ZXhHZW5lcmF0b3I6OmdldEluZGV4Q291bnQoKSBjb25zdCB7CisgICAgcmV0dXJuIG1BbWJpZW50U2hhZG93SW5kZXhDb3VudCArIG1TcG90U2hhZG93SW5kZXhDb3VudDsKK30KKwordm9pZCBHTFNoYWRvd1ZlcnRleEdlbmVyYXRvcjo6ZmlsbFZlcnRpY2VzKE1lc2g6OlZlcnRleEFycmF5PHZlYzI+JiBwb3NpdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNZXNoOjpWZXJ0ZXhBcnJheTx2ZWM0PiYgY29sb3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWVzaDo6VmVydGV4QXJyYXk8dmVjMz4mIHBhcmFtcykgY29uc3QgeworICAgIGlmIChtRHJhd0FtYmllbnRTaGFkb3cpIHsKKyAgICAgICAgZmlsbFZlcnRpY2VzRm9yR2VvbWV0cnkoKm1BbWJpZW50U2hhZG93R2VvbWV0cnkuZ2V0KCksIG1BbWJpZW50U2hhZG93VmVydGV4Q291bnQsIHBvc2l0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xvciwgcGFyYW1zKTsKKyAgICB9CisgICAgaWYgKG1EcmF3U3BvdFNoYWRvdykgeworICAgICAgICBmaWxsVmVydGljZXNGb3JHZW9tZXRyeSgqbVNwb3RTaGFkb3dHZW9tZXRyeS5nZXQoKSwgbVNwb3RTaGFkb3dWZXJ0ZXhDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWVzaDo6VmVydGV4QXJyYXk8dmVjMj4ocG9zaXRpb24sIG1BbWJpZW50U2hhZG93VmVydGV4Q291bnQpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNZXNoOjpWZXJ0ZXhBcnJheTx2ZWM0Pihjb2xvciwgbUFtYmllbnRTaGFkb3dWZXJ0ZXhDb3VudCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1lc2g6OlZlcnRleEFycmF5PHZlYzM+KHBhcmFtcywgbUFtYmllbnRTaGFkb3dWZXJ0ZXhDb3VudCkpOworICAgIH0KK30KKwordm9pZCBHTFNoYWRvd1ZlcnRleEdlbmVyYXRvcjo6ZmlsbEluZGljZXModWludDE2X3QqIGluZGljZXMpIGNvbnN0IHsKKyAgICBpZiAobURyYXdBbWJpZW50U2hhZG93KSB7CisgICAgICAgIGZpbGxJbmRpY2VzRm9yR2VvbWV0cnkoKm1BbWJpZW50U2hhZG93R2VvbWV0cnkuZ2V0KCksIG1BbWJpZW50U2hhZG93SW5kZXhDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwIC8qIHN0YXJ0aW5nIHZlc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JtYWwgZmlsbCwgd2UgZHJhdyBnZW9tZXRyeSBmb3IgdGhlIGNpcmNsZSBhcyBhbiBvY3RhZ29uLgorc3RhdGljIGNvbnN0IHVpbnQxNl90IGdGaWxsQ2lyY2xlSW5kaWNlc1tdID0geworICAgICAgICAvLyBlbnRlciB0aGUgb2N0YWdvbgorICAgICAgICAvLyBjbGFuZy1mb3JtYXQgb2ZmCisgICAgICAgICAwLCAxLCA4LCAxLCAyLCA4LAorICAgICAgICAgMiwgMywgOCwgMywgNCwgOCwKKyAgICAgICAgIDQsIDUsIDgsIDUsIDYsIDgsCisgICAgICAgICA2LCA3LCA4LCA3LCAwLCA4LAorICAgICAgICAvLyBjbGFuZy1mb3JtYXQgb24KK307CisKKy8vIEZvciBzdHJva2VkIGNpcmNsZXMsIHdlIHVzZSB0d28gbmVzdGVkIG9jdGFnb25zLgorc3RhdGljIGNvbnN0IHVpbnQxNl90IGdTdHJva2VDaXJjbGVJbmRpY2VzW10gPSB7CisgICAgICAgIC8vIGVudGVyIHRoZSBvY3RhZ29uCisgICAgICAgIC8vIGNsYW5nLWZvcm1hdCBvZmYKKyAgICAgICAgIDAsIDEsICA5LCAwLCAgOSwgIDgsCisgICAgICAgICAxLCAyLCAxMCwgMSwgMTAsICA5LAorICAgICAgICAgMiwgMywgMTEsIDIsIDExLCAxMCwKKyAgICAgICAgIDMsIDQsIDEyLCAzLCAxMiwgMTEsCisgICAgICAgICA0LCA1LCAxMywgNCwgMTMsIDEyLAorICAgICAgICAgNSwgNiwgMTQsIDUsIDE0LCAxMywKKyAgICAgICAgIDYsIDcsIDE1LCA2LCAxNSwgMTQsCisgICAgICAgICA3LCAwLCAgOCwgNywgIDgsIDE1LAorICAgICAgICAvLyBjbGFuZy1mb3JtYXQgb24KK307CisKKyNkZWZpbmUgU0tfQVJSQVlfQ09VTlQoYSkgKHNpemVvZihhKSAvIHNpemVvZigoYSlbMF0pKQorc3RhdGljIGNvbnN0IGludCBrSW5kaWNlc1BlckZpbGxDa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RhdGljIGNvbnN0IGludCBrVmVydHNQZXJGaWxsUlJlY3QgPSAyNDsKKworc3RhdGljIGludCBycmVjdF90eXBlX3RvX3ZlcnRfY291bnQoUlJlY3RUeXBlIHR5cGUpIHsKKyAgICBzd2l0Y2ggKHR5cGUpIHsKKyAgICAgICAgY2FzZSBrRmlsbF9SUmVjdFR5cGU6CisgICAgICAgICAgICByZXR1cm4ga1ZlcnRzUGVyRmlsbFJSZWN0OworICAgICAgICBjYXNlIGtTdHJva2VfUlJlY3RUeXBlOgorICAgICAgICAgICAgcmV0dXJuIGtWZXJ0c1BlclN0cm9rZVJSZWN0OworICAgICAgICBjYXNlIGtPdmVyc3Ryb2tlX1JSZWN0VHlwZToKKyAgICAgICAgICAgIHJldHVybiBrVmVydHNQZXJPdmVyc3Ryb2tlUlJlY3Q7CisgICAgfQorICAgIEFMT0dFKCJJbnZhbGlkIHJlY3QgdHlwZTogJWQiLCB0eXBlKTsKKyAgICByZXR1cm4gLTE7Cit9CisKK3N0YXRpYyBpbnQgcnJlY3RfdHlwZV90b19pbmRleF9jb3VudChSUmVjdFR5cGUgdHlwZSkgeworICAgIHN3aXRjaCAodHlwZSkgeworICAgICAgICBjYXNlIGtGaWxsX1JSZWN0VHlwZToKKyAgICAgICAgICAgIHJldHVybiBrSW5kaWNlc1BlckZpbGxSUmVjdDsKKyAgICAgICAgY2FzZSBrU3Ryb2tlX1JSZWN0VHlwZToKKyAgICAgICAgICAgIHJldHVybiBrSW5kaWNlc1BlclN0cm9rZVJSZWN0OworICAgICAgICBjYXNlIGtPdmVyc3Ryb2tlX1JSZWN0VHlwZToKKyAgICAgICAgICAgIHJldHVybiBrSW5kaWNlc1Blck92ZXJzdHJva2VSUmVjdDsKKyAgICB9CisgICAgQUxPR0UoIkludmFsaWQgcmVjdCB0eXBlOiAlZCIsIHR5cGUpOworICAgIHJldHVybiAtMTsKK30KKworc3RhdGljIGNvbnN0IHVpbnQxNl90KiBycmVjdF90eXBlX3RvX2luZGljZXMoU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gICAgdmVydGV4Q291bnQrKzsKKworICAgICAgICBwb3NpdGlvblt2ZXJ0ZXhDb3VudF0gPSBjZW50ZXIgKyB2ZWMyKHMgKiByLCAtYyAqIHIpOworICAgICAgICBzaGFkb3dDb2xvclt2ZXJ0ZXhDb3VudF0gPSBjb2xvcjsKKyAgICAgICAgc2hhZG93UGFyYW1zW3ZlcnRleENvdW50XSA9IHZlYzMocyAqIGlubmVyUmFkaXVzLCAtYyAqIGlubmVyUmFkaXVzLCBkaXN0YW5jZUNvcnJlY3Rpb24pOworICAgICAgICB2ZXJ0ZXhDb3VudCsrOworCisgICAgICAgIHBvc2l0aW9uW3ZlcnRleENvdW50XSA9IGNlbnRlciArIHZlYzIoYyAqIHIsIC1zICogcik7CisgICAgICAgIHNoYWRvd0NvbG9yW3ZlcnRleENvdW50XSA9IGNvbG9yOworICAgICAgICBzaGFkb3dQYXJhbXNbdmVydGV4Q291bnRdID0gdmVjMyhjICogaW5uZXJSYWRpdXMsIC1zICogaW5uZXJSYWRpdXMsIGRpc3RhbmNlQ29ycmVjdGlvbik7CisgICAgICAgIHZlcnRleENvdW50Kys7CisKKyAgICAgICAgcG9zaXRpb25bdmVydGV4Q291bnRdID0gY2VudGVyICsgdmVjMihjICogciwgcyAqIHIpOworICAgICAgICBzaGFkb3dDb2xvclt2ZXJ0ZXhDb3VudF0gPSBjb2xvcjsKKyAgICAgICAgc2hhZG93UGFyYW1zW3ZlcnRleENvdW50XSA9IHZlYzMoYyAqIGlubmVyUmFkaXVzLCBzICogaW5uZXJSYWRpdXMsIGRpc3RhbmNlQ29ycmVjdGlvbik7CisgICAgICAgIHZlcnRleENvdW50Kys7CisKKyAgICAgICAgcG9zaXRpb25bdmVydGV4Q291bnRdID0gY2VudGVyICsgdmVjMihzICogciwgYyAqIHIpOworICAgICAgICBzaGFkb3dDb2xvclt2ZXJ0ZXhDb3VudF0gPSBjb2xvcjsKKyAgICAgICAgc2hhZG93UGFyYW1zW3ZlcnRleENvdW50XSA9IHZ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N0cm9rZWR9KTsKK30KKworc3RkOjp1bmlxdWVfcHRyPEdlb21ldHJ5PiBnZXRBbWJpZW50U2hhZG93R2VvbWV0cnkoY29uc3QgRmxvYXRSZWN0JiBjYXN0ZXJSZWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgY2FzdGVyQ29ybmVyUmFkaXVzLCBmbG9hdCBjYXN0ZXJaLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBjYXN0ZXJJc1RyYW5zbHVjZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdmVjNCYgYW1iaWVudENvbG9yKSB7CisgICAgZmxvYXQgZGV2U3BhY2VJbnNldFdpZHRoID0gQW1iaWVudEJsdXJSYWRpdXMoY2FzdGVyWik7CisgICAgY29uc3QgZmxvYXQgdW1icmFSZWNpcEFscGhhID0gQW1iaWVudFJlY2lwQWxwaGEoY2FzdGVyWik7CisgICAgY29uc3QgZmxvYXQgZGV2U3BhY2VBbWJpZW50Qmx1ciA9IGRldlNwYWNlSW5zZXRXaWR0aCAqIHVtYnJhUmVjaXBBbHBoYTsKKworICAgIC8vIE91dHNldCB0aGUgc2hhZG93IHJyZWN0IHRvIHRoZSBib3JkZXIgb2YgdGhlIHBlbnVtYnJhCisgICAgZmxvYXQgYW1iaWVudFBhdGhPdXRzZXQgPSBkZXZTcGFjZUluc2V0V2lkdGg7CisgICAgRmxvYXRSZWN0IG91dHNldFJlY3QoY2FzdGVyUmVjdCk7CisgICAgb3V0c2V0UmVjdC5sZWZ0IC09IGFtYmllbnRQYXRoT3V0c2V0OworICAgIG91dHNldFJlY3QudG9wIC09IGFtYmllbnRQYXRoT3V0c2V0OworICAgIG91dHNldFJlY3QucmlnaHQgKz0gYW1iaWVudFBhdGhPdXRzZXQ7CisgICAgb3V0c2V0UmVjdC5ib3R0b20gKz0gYW1iaWVudFBhdGhPdXRzZXQ7CisKKyAgICBmbG9hdCBvdXRzZXRSYWQgPSBjYXN0ZXJDb3JuZXJSYWRpdXMgKyBhbWJpZW50UGF0aE91dHNldDsKKyAgICBpZiAoY2FzdGVySXNUcmFuc2x1Y2VudCkgeworICAgICAgICAvLyBzZXQgYSBsYXJnZSBpbnNldCB0byBmb3JjZSBhIGZpbGwKKyAgICAgICAgZGV2U3BhY2VJbnNldFdpZHRoID0gb3V0c2V0UmVjdC5nZXRXaWR0aCgpOworICAgIH0KKworICAgIHJldHVybiBnZXRTaGFkb3dHZW9tZXRyeShhbWJpZW50Q29sb3IsIG91dHNldFJlY3QsIHN0ZDo6YWJzKG91dHNldFJhZCksIGRldlNwYWNlQW1iaWVudEJsdXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6YWJzKGRldlNwYWNlSW5zZXRXaWR0aCkpOworfQorCitzdGQ6OnVuaXF1ZV9wdHI8R2VvbWV0cnk+IGdldFNwb3RTaGFkb3dHZW9tZXRyeShjb25zdCBGbG9hdFJlY3QmIGNhc3RlclJlY3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBjYXN0ZXJDb3JuZXJSYWRpdXMsIGZsb2F0IGNhc3RlclosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGNhc3RlcklzVHJhbnNsdWNlbnQsIGNvbnN0IHZlYzQmIHNwb3RDb2xvciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHZlYzMmIGxpZ2h0UG9zaXRpb24sIGZsb2F0IGxpZ2h0UmFkaXVzKSB7CisgICAgZmxvYXQgZGV2U3BhY2VTcG90Qmx1cjsKKyAgICBmbG9hdCBzcG90U2NhbGU7CisgICAgdmVjMiBzcG90T2Zmc2V0OworICAgIEdldFNwb3RQYXJhbXMoY2FzdGVy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Zlci4KKyAgICAgICAgLy8KKyAgICAgICAgLy8gU2luY2Ugd2UgYXJlIG91dHNldHRpbmcgYnkgMS8yIHRoZSBibHVyIGRpc3RhbmNlLCB3ZSBqdXN0IGFkZCB0aGUgbWF4T2Zmc2V0IHRvCisgICAgICAgIC8vIHRoYXQgdG8gZ2V0IHRoZSBmdWxsIGluc2V0V2lkdGguCisgICAgICAgIGZsb2F0IG1heE9mZnNldDsKKyAgICAgICAgaWYgKGNhc3RlckNvcm5lclJhZGl1cyA8PSAwLmYpIHsKKyAgICAgICAgICAgIC8vIE1hbmhhdHRhbiBkaXN0YW5jZSB3b3JrcyBiZXR0ZXIgZm9yIHJlY3RzCisgICAgICAgICAgICBtYXhPZmZzZXQgPSBzdGQ6Om1heChzdGQ6Om1heChzdGQ6OmFicyhzcG90U2hhZG93UmVjdC5sZWZ0IC0gY2FzdGVyUmVjdC5sZWZ0KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6YWJzKHNwb3RTaGFkb3dSZWN0LnRvcCAtIGNhc3RlclJlY3QudG9wKSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6Om1heChzdGQ6OmFicyhzcG90U2hhZG93UmVjdC5yaWdodCAtIGNhc3RlclJlY3QucmlnaHQpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjphYnMoc3BvdFNoYWRvd1JlY3QuYm90dG9tIC0gY2FzdGVyUmVjdC5ib3R0b20pKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBmbG9hdCBkciA9IHNwb3RTaGFkb3dSYWRpdXMgLSBjYXN0ZXJDb3JuZXJSYWRpdXM7CisgICAgICAgICAgICB2ZWMyIHVwcGVyTGVmdE9mZnNldCA9IHZlYzIoc3BvdFNoYWRvd1JlY3QubGVmdCAtIGNhc3RlclJlY3QubGVmdCArIGRyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwb3RTaGFkb3dSZWN0LnRvcCAtIGNhc3RlclJlY3QudG9wICsgZHIpOworICAgICAgICAgICAgdmVjMiBsb3dlclJpZ2h0T2Zmc2V0ID0gdmVjMihzcG90U2hhZG93UmVjdC5yaWdodCAtIGNhc3RlclJlY3QucmlnaHQgLSBkciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BvdFNoYWRvd1JlY3QuYm90dG9tIC0gY2FzdGVyUmVjdC5ib3R0b20gLSBkcik7CisgICAgICAgICAgICBtYXhPZmZzZXQgPSBzcXJ0KHN0ZDo6bWF4KGRvdCh1cHBlckxlZnRPZmZzZXQsIGxvd2VyUmlnaHRPZmZzZXQpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3QobG93ZXJSaWdodE9mZnNldCwgbG93ZXJSaWdodE9mZnNldCkpKSArCisgICAgICAgICAgICAgICAgICAgIGRyOworICAgICAgICB9CisgICAgICAgIGluc2V0V2lkdGggKz0gc3RkOjptYXgoYmx1ck91dHNldCwgbWF4T2Zmc2V0KTsKKyAgICB9CisKKyAgICAvLyBPdXRzZXQgdGhlIHNoYWRvdyBycmVjdCB0byB0aGUgYm9yZGVyIG9mIHRoZSBwZW51bWJyYQorICAgIHNwb3RTaGFkb3dSYWRpdXMgKz0gYmx1ck91dHNldDsKKyAgICBzcG90U2hhZG93UmVjdC5sZWZ0IC09IGJsdXJPdXRzZXQ7CisgICAgc3BvdFNoYWRvd1JlY3QudG9wIC09IGJsdXJPdXRzZXQ7CisgICAgc3BvdFNoYWRvd1JlY3QucmlnaHQgKz0gYmx1ck91dHNldDsKKyAgICBzcG90U2hhZG93UmVjdC5ib3R0b20gKz0gYmx1ck91dHNldDsKKworICAgIHJldHVybiBnZXRTaGFkb3dHZW9tZXRyeShzcG90Q29sb3IsIHNwb3RTaGFkb3dSZWN0LCBzdGQ6OmFicyhzcG90U2hhZG93UmFkaXVzKSwKKyAgICAgIC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3Ryb2tlZDsKK307CisKK3N0ZDo6dW5pcXVlX3B0cjxHZW9tZXRyeT4gZ2V0U3BvdFNoYWRvd0dlb21ldHJ5KGNvbnN0IEZsb2F0UmVjdCYgY2FzdGVyUmVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IGNhc3RlckNvcm5lclJhZGl1cywgZmxvYXQgY2FzdGVyWiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgY2FzdGVySXNUcmFuc2x1Y2VudCwgY29uc3QgdmVjNCYgc3BvdENvbG9yLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdmVjMyYgbGlnaHRQb3NpdGlvbiwgZmxvYXQgbGlnaHRSYWRpdXMpOworCitzdGQ6OnVuaXF1ZV9wdHI8R2VvbWV0cnk+IGdldEFtYmllbnRTaGFkb3dHZW9tZXRyeShjb25zdCBGbG9hdFJlY3QmIGNhc3RlclJlY3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBjYXN0ZXJDb3JuZXJSYWRpdXMsIGZsb2F0IGNhc3RlclosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGNhc3RlcklzVHJhbnNsdWNlbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB2ZWM0JiBhbWJpZW50Q29sb3IpOworCitpbnQgZ2V0VmVydGV4Q291bnRGb3JHZW9tZXRyeShjb25zdCBHZW9tZXRyeSYgc2hhZG93R2VvbWV0cnkpOworCitpbnQgZ2V0SW5kZXhDb3VudEZvckdlb21ldHJ5KGNvbnN0IEdlb21ldHJ5JiBzaGFkb3dHZW9tZXRyeSk7CisKK3ZvaWQgZmlsbFZlcnRpY2VzRm9yR2V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gICAgaWYgKCFtUnVubmluZykgeworICAgICAgICAgICAgICAgIC8vIGlmIG1SdW5uaW5nIGlzIGZhbHNlLCB0aGVuIEltYWdlTWFuYWdlciBpcyBiZWluZyBkZXN0cm95ZWQsIHNvCisgICAgICAgICAgICAgICAgLy8gYmFpbCBvdXQgbm93LgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBlbnRyeSA9IG1RdWV1ZS5mcm9udCgpOworICAgICAgICAgICAgbVF1ZXVlLnBvcCgpOworICAgICAgICAgICAgQVRSQUNFX0lOVCgiSW1hZ2VNYW5hZ2VyUXVldWVEZXB0aCIsIG1RdWV1ZS5zaXplKCkpOworICAgICAgICB9CisKKyAgICAgICAgc3RhdHVzX3QgcmVzdWx0ID0gTk9fRVJST1I7CisgICAgICAgIHN3aXRjaCAoZW50cnkub3ApIHsKKyAgICAgICAgICAgIGNhc2UgUXVldWVFbnRyeTo6T3BlcmF0aW9uOjpEZWxldGU6CisgICAgICAgICAgICAgICAgbUVuZ2luZS0+dW5iaW5kRXh0ZXJuYWxUZXh0dXJlQnVmZmVySW50ZXJuYWwoZW50cnkuYnVmZmVySWQpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBRdWV1ZUVudHJ5OjpPcGVyYXRpb246Okluc2VydDoKKyAgICAgICAgICAgICAgICByZXN1bHQgPSBtRW5naW5lLT5jYWNoZUV4dGVybmFsVGV4dHVyZUJ1ZmZlckludGVybmFsKGVudHJ5LmJ1ZmZlcik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGVudHJ5LmJhcnJpZXIgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN0ZDo6bG9ja19ndWFyZDxzdGQ6Om11dGV4PiBlbnRyeUxvY2soZW50cnkuYmFycmllci0+bXV0ZXgpOworICAgICAgICAgICAgICAgIGVudHJ5LmJhcnJp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lkIHsKKworY2xhc3MgU3RyaW5nODsKKworbmFtZXNwYWNlIHJlbmRlcmVuZ2luZSB7CituYW1lc3BhY2UgZ2wgeworCisvKgorICogQWJzdHJhY3RzIGEgR0xTTCBwcm9ncmFtIGNvbXByaXNpbmcgYSB2ZXJ0ZXggYW5kIGZyYWdtZW50IHNoYWRlcgorICovCitjbGFzcyBQcm9ncmFtIHsKK3B1YmxpYzoKKyAgICAvLyBrbm93biBsb2NhdGlvbnMgZm9yIHBvc2l0aW9uIGFuZCB0ZXh0dXJlIGNvb3JkaW5hdGVzCisgICAgZW51bSB7CisgICAgICAgIC8qIHBvc2l0aW9uIG9mIGVhY2ggdmVydGV4IGZvciB2ZXJ0ZXggc2hhZGVyICovCisgICAgICAgIHBvc2l0aW9uID0gMCwKKworICAgICAgICAvKiBVViBjb29yZGluYXRlcyBmb3IgdGV4dHVyZSBtYXBwaW5nICovCisgICAgICAgIHRleENvb3JkcyA9IDEsCisKKyAgICAgICAgLyogQ3JvcCBjb29yZGluYXRlcywgaW4gcGl4ZWxzICovCisgICAgICAgIGNyb3BDb29yZHMgPSAyLAorCisgICAgICAgIC8qIFNoYWRvdyBjb2xvciAqLworICAgICAgICBzaGFkb3dDb2xvciA9IDMsCisKKyAgICAgICAgLyogU2hhZG93IHBhcmFtcyAqLworICAgICAgICBzaGFkb3dQYXJhbXMgPSA0LAorICAgIH07CisKKyAgICBQcm9ncmFtKGNvbnN0IFByb2dyYW1DYWNoZTo6S2V5JiBuZWVkcywgY29uc3QgY2hhciogdmVydGV4LCBjb25zdCBjaGFyKiBmcmFnbWVudCk7CisgICAgflByb2dyYW0oKSA9IGRlZmF1bHQ7CisKKyAgICAvKiB3aGV0aGVyIHRoaXMgb2JqZWN0IGlzIHVzYWJsZSAqLworICAgIGJvb2wgaXNWYWxpZCgpIGNvbnN0OworCisgICAgLyogQmluZHMgdGhpcyBwcm9ncmFtIHRvIHRoZSBHTEVTIGNvbnRleHQgKi8KKyAgICB2b2lkIHVzZSgp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IHsKKyAgICAgICAgICAgIC8vIENhY2hlIGlucHV0IHRyYW5zZmVyIGZvciBITEcgJiBTVDIwODQKKyAgICAgICAgICAgIHNoYWRlcktleS5zZXQoS2V5OjpJTlBVVF9URl9NQVNLLCAoaSAmIDEpID8KKyAgICAgICAgICAgICAgICAgICAgS2V5OjpJTlBVVF9URl9ITEcgOiBLZXk6OklOUFVUX1RGX1NUMjA4NCk7CisKKyAgICAgICAgICAgIC8vIENhY2hlIFk0MTAgaW5wdXQgb24gb3Igb2ZmCisgICAgICAgICAgICBzaGFkZXJLZXkuc2V0KEtleTo6WTQxMF9CVDIwMjBfTUFTSywgKGkgJiAyKSA/CisgICAgICAgICAgICAgICAgICAgIEtleTo6WTQxMF9CVDIwMjBfT04gOiBLZXk6Olk0MTBfQlQyMDIwX09GRik7CisgICAgICAgICAgICBpZiAoY2FjaGUuY291bnQoc2hhZGVyS2V5KSA9PSAwKSB7CisgICAgICAgICAgICAgICAgY2FjaGUuZW1wbGFjZShzaGFkZXJLZXksIGdlbmVyYXRlUHJvZ3JhbShzaGFkZXJLZXkpKTsKKyAgICAgICAgICAgICAgICBzaGFkZXJDb3VudCsrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICB1aW50MzJfdCBrZXlNYXNrID0gS2V5OjpCTEVORF9NQVNLIHwgS2V5OjpPUEFDSVRZX01BU0sgfCBLZXk6OkFMUEhBX01BU0sgfCBLZXk6OlRFWFRVUkVfTUFTSworICAgICAgICB8IEtleTo6Uk9VTkRFRF9DT1JORVJTX01BU0s7CisgICAgLy8gUHJpbWUgdGhlIGNhY2hlIGZvciBhbGwgY29tYmluYXRpb25zIG9mIHRoZSBhYm92ZSBtYXNrcywKKyAgICAvLyBsZWF2aW5nIG9mZiB0aGUgZXhwZXJpbWVudGFsIGNvbG9yIG1hdHJpeCBtYXNrIG9wdGlvbnMuCisKKyAgICBuc2Vjc190IHRpbWVCZWZvcmUgPSBzeXN0ZW1UaW1lKCk7CisgICAgZm9yICh1aW50MzJfdCBrZXlWYWwgPSAwOyBrZXlWYWwgPD0ga2V5TWFzazsga2V5VmFsKyspIHsKKyAgICAgICAgS2V5IHNoYWRlcktleTsKKyAgICAgICAgc2hhZGVyS2V5LnNldChrZXlNYXNrLCBrZXlWYWwpOworICAgICAgICB1aW50MzJfdCB0ZXggPSBzaGFkZXJLZXkuZ2V0VGV4dHVyZVRhcmdldCgpOworICAgICAgICBpZiAodGV4ICE9IEtleTo6VEVYVFVSRV9PRkYgJiYgdGV4ICE9IEtleTo6VEVYVFVSRV9FWFQgJiYgdGV4ICE9IEtleTo6VEVYVFVSRV8yRCkgeworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGNhY2hlLmNvdW50KHNoYWRlcktleSkgPT0gMCkgeworICAgICAgICAgICAgY2FjaGUuZW1wbGFjZShzaGFkZXJLZXksIGdlbmVyYXRlUHJvZ3JhbShzaGFkZXJLZXkpKTsKKyAgICAgICAgICAgIHNoYWRlckNvdW50Kys7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBQcmltZSBmb3Igc1JHQi0+UDMgY29udmVyc2lvbgorICAgIGlmICh1c2VDb2xvck1hbmFnZW1lbnQpIHsKKyAgICAgICAgS2V5IHNoYWRlcktleTsKKyAgICAgICAgc2hhZGVyS2V5LnNldChLZXk6OkJMRU5EX01BU0sgfCBLZXk6Ok9VVFBVVF9UUkFOU0ZPUk1fTUFUUklYX01BU0sgfCBLZXk6OklOUFVUX1RGX01BU0sgfAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS2V5OjpPVVRQVVRfVEZfTUFTSywKKyAgICAgICAgICAgICAgICAgICAgICBLZXk6OkJMRU5EX1BSRU1VTFQgfCBLZXk6Ok9VVFBVVF9UUkFOU0ZPUk1fTUFUUklYX09OIHwgS2V5OjpJTlBVVF9URl9TUkdCIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtleTo6T1VUUFVUX1RGX1NSR0IpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDE2OyBpKyspIHsKKyAgICAgICAgICAgIHNoYWRlcktleS5zZXQoS2V5OjpPUEFDSVRZX01BU0ssCisgICAgICAgICAgICAgICAgICAgICAgICAgIChpICYgMSkgPyBLZXk6Ok9QQUNJVFlfT1BBUVVFIDogS2V5OjpPUEFDSVRZX1RSQU5TTFVDRU5UKTsKKyAgICAgICAgICAgIHNoYWRlcktleS5zZXQoS2V5OjpBTFBIQV9NQVNLLCAoaSAmIDIpID8gS2V5OjpBTFBIQV9MVF9PTkUgOiBLZXk6OkFMUEhBX0VRX09ORSk7CisKKyAgICAgICAgICAgIC8vIENhY2hlIHJvdW5kZWQgY29ybmVycworICAgICAgICAgICAgc2hhZGVyS2V5LnNldChLZXk6OlJPVU5ERURfQ09STkVSU19NQVNLLAorICAgICAgICAgICAgICAgICAgICAgICAgICAoaSAmIDQpID8gS2V5OjpST1VOREVEX0NPUk5FUlNfT04gOiBLZXk6OlJPVU5ERURfQ09STkVSU19PRkYpOworCisgICAgICAgICAgICAvLyBDYWNoZSB0ZXh0dXJlIG9mZiBvcHRpb24gZm9yIHdpbmRvdyB0cmFuc2l0aW9uCisgICAgICAgICAgICBzaGFkZXJLZXkuc2V0KEtleTo6VEVYVFVSRV9NQVNLLCAoaSAmIDgpID8gS2V5OjpURVhUVVJFX0VYVCA6IEtleTo6VEVYVFVSRV9PRkYpOworICAgICAgICAgICAgaWYgKGNhY2hlLmNvdW50KHNoYWRlcktleSkgPT0gMCkgeworICAgICAgICAgICAgICAgIGNhY2hlLmVtcGxhY2Uoc2hhZGVyS2V5LCBnZW5lcmF0ZVByb2dyYW0oc2hhZGVyS2V5KSk7CisgICAgICAgICAgICAgICAgc2hhZGVyQ291bnQrKzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIG5zZWNzX3QgdGltZUFmdGVyID0gc3lzdGVtVGltZSgpOworICAgIGZsb2F0IGNvbXBpbGVUaW1lTXMgPSBzdGF0aWNfY2FzdDxmbG9hdD4odGltZUFmdGVyIC0gdGltZUJlZm9yZSkgLyAxLjBFNjsKKyAgICBBTE9HRCgic2hhZGVyIGNhY2hlIGdlbmVyYXRlZCAtICV1IHNoYWRlcnMgaW4gJWYgbXNcbiIsIHNoYWRlckNvdW50LCBjb21waWxlVGltZU1zKTsKK30KKworUHJvZ3JhbUNhY2hlOjpLZXkgUHJvZ3JhbUNhY2hlOjpjb21wdXRlS2V5KGNvbnN0IERlc2NyaXB0aW9uJiBkZXNjcmlwdGlvbikgeworICAgIEtleSBuZWVkczsKKyAgICBuZWVkcy5zZXQoS2V5OjpURVhUVVJFX01BU0ssCisgICAgICAgICAgICAgICFkZXNjcmlwdGlvbi50ZXh0dXJlRW5hYmxlZAorICAgICAgICAgICAgICAgICAgICAgID8gS2V5OjpURVhUVVJFX09GRgorICAgICAgICAgICAgICAgICAgICAgIDogZGVzY3JpcHRpb24udGV4dHVyZS5nZXRUZXh0dXJlVGFyZ2V0KCkgPT0gR0xfVEVYVFVSRV9FWFRFUk5BTF9PRVMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gS2V5OjpURVhUVVJFX0VYVAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBkZXNjcmlwdGlvbi50ZXh0dXJlLmdldFRleHR1cmVUYXJnZXQoKSA9PSBHTF9URVhUVVJFXzJECisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gS2V5OjpURVhUVVJFXzJECisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogS2V5OjpURVhUVVJFX09GRikKKyAgICAgICAgICAgIC5zZXQoS2V5OjpBTFBIQV9NQVNLLCAoZGVzY3JpcHRpb24uY29sb3IuYSA8IDEpID8gS2V5OjpBTFBIQV9MVF9PTkUgOiBLZXk6OkFMUEhBX0VRX09ORSkKKyAgICAgICAgICAgIC5zZXQoS2V5OjpCTEVORF9NQVNLLAorICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbi5pc1ByZW11bHRpcGxpZWRBbHBoYSA/IEtleTo6QkxFTkRfUFJFTVVMVCA6IEtleTo6QkxFTkRfTk9STUFMKQorICAgICAgICAgICAgLnNldChLZXk6Ok9QQUNJVFlfTUFTSywKKyAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb24uaXNPcGFxdWUgPyBLZXk6Ok9QQUNJVFlfT1BBUVVFIDogS2V5OjpPUEFDSVRZX1RSQU5TTFVDRU5UKQorICAgICAgICAgICAgLnNldChLZXk6OktleTo6SU5QVVRfVFJBTlNGT1JNX01BVFJJWF9NQVNLLAorICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbi5oYXNJbnB1dFRyYW5zZm9ybU1hdHJpeCgpID8gS2V5OjpJTlBVVF9UUkFOU0ZPUk1fTUFUUklYX09OCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBLZXk6OklOUFVUX1RSQU5TRk9STV9NQVRSSVhfT0ZGKQorICAgICAgICAgICAgLnNldChLZXk6OktleTo6T1VUUFVUX1RSQU5TRk9STV9NQVRSSVhfTUFTSywKKyAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb24uaGFzT3V0cHV0VHJhbnNmb3JtTWF0cml4KCkgfHwgZGVzY3JpcHRpb24uaGFzQ29sb3JNYXRyaXgoKQorICAgICAgICAgICAgICAgICAgICAgICAgID8gS2V5OjpPVVRQVVRfVFJBTlNGT1JNX01BVFJJWF9PTgorICAgICAgICAgICAgICAgICAgICAgICAgIDogS2V5OjpPVVRQVVRfVFJBTlNGT1JNX01BVFJJWF9PRkYpCisgICAgICAgICAgICAuc2V0KEtleTo6Uk9VTkRFRF9DT1JORVJTX01BU0ssCisgICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uLmNvcm5lclJhZGl1cyA+IDAgPyBLZXk6OlJPVU5ERURfQ09STkVSU19PTiA6IEtleTo6Uk9VTk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BLZXk6OklOUFVUX1RGX1NUMjA4NCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIERlc2NyaXB0aW9uOjpUcmFuc2ZlckZ1bmN0aW9uOjpITEc6CisgICAgICAgICAgICAgICAgbmVlZHMuc2V0KEtleTo6SU5QVVRfVEZfTUFTSywgS2V5OjpJTlBVVF9URl9ITEcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgc3dpdGNoIChkZXNjcmlwdGlvbi5vdXRwdXRUcmFuc2ZlckZ1bmN0aW9uKSB7CisgICAgICAgICAgICBjYXNlIERlc2NyaXB0aW9uOjpUcmFuc2ZlckZ1bmN0aW9uOjpMSU5FQVI6CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIG5lZWRzLnNldChLZXk6Ok9VVFBVVF9URl9NQVNLLCBLZXk6Ok9VVFBVVF9URl9MSU5FQVIpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBEZXNjcmlwdGlvbjo6VHJhbnNmZXJGdW5jdGlvbjo6U1JHQjoKKyAgICAgICAgICAgICAgICBuZWVkcy5zZXQoS2V5OjpPVVRQVVRfVEZfTUFTSywgS2V5OjpPVVRQVVRfVEZfU1JHQik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIERlc2NyaXB0aW9uOjpUcmFuc2ZlckZ1bmN0aW9uOjpTVDIwODQ6CisgICAgICAgICAgICAgICAgbmVlZHMuc2V0KEtleTo6T1VUUFVUX1RGX01BU0ssIEtleTo6T1VUUFVUX1RGX1NUMjA4NCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIERlc2NyaXB0aW9uOjpUcmFuc2ZlckZ1bmN0aW9uOjpITEc6CisgICAgICAgICAgICAgICAgbmVlZHMuc2V0KEtleTo6T1VUUFVUX1RGX01BU0ssIEtleTo6T1VUUFVUX1RGX0hMRyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gbmVlZHM7Cit9CisKKy8vIEdlbmVyYXRlIEVPVEYgdGhhdCBjb252ZXJ0cyBzaWduYWwgdmFsdWVzIHRvIHJlbGF0aXZlIGRpc3BsYXkgbGlnaHQsCisvLyBib3RoIG5vcm1hbGl6ZWQgdG8gWzAsIDFdLgordm9pZCBQcm9ncmFtQ2FjaGU6OmdlbmVyYXRlRU9URihGb3JtYXR0ZXImIGZzLCBjb25zdCBLZXkmIG5lZWRzKSB7CisgICAgc3dpdGNoIChuZWVkcy5nZXRJbnB1dFRGKCkpIHsKKyAgICAgICAgY2FzZSBLZXk6OklOUFVUX1RGX1NSR0I6CisgICAgICAgICAgICBmcyA8PCBSIl9fU0hBREVSX18oCisgICAgICAgICAgICAgICAgZmxvYXQgRU9URl9zUkdCKGZsb2F0IHNyZ2IpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNyZ2IgPD0gMC4wNDA0NSA/IHNyZ2IgLyAxMi45MiA6IHBvdygoc3JnYiArIDAuMDU1KSAvIDEuMDU1LCAyLjQpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHZlYzMgRU9URl9zUkdCKGNvbnN0IHZlYzMgc3JnYikgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmVjMyhFT1RGX3NSR0Ioc3JnYi5yKSwgRU9URl9zUkdCKHNyZ2IuZyksIEVPVEZfc1JHQihzcmdiLmIpKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB2ZWMzIEVPVEYoY29uc3QgdmVjMyBzcmdiKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBzaWduKHNyZ2IucmdiKSAqIEVPVEZfc1JHQihhYnMoc3JnYi5yZ2IpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICApX19TSEFERVJfXyI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBLZXk6OklOUFVUX1RGX1NUMjA4NDoKKyAgICAgICAgICAgIGZzIDw8IFIiX19TSEFERVJfXygKKyAgICAgICAgICAgICAgICB2ZWMzIEVPVEYoY29uc3QgaGlnaHAgdmVjMyBjb2xvcikgeworICAgICAgICAgICAgICAgICAgICBjb25zdCBoaWdocCBmbG9hdCBtMSA9ICgyNjEwLjAgLyA0MDk2LjApIC8gNC4wOworICAgICAgICAgICAgICAgICAgICBjb25zdCBoaWdocCBmbG9hdCBtMiA9ICgyNTIzLjAgLyA0MDk2LjApICogMTI4LjA7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IGhpZ2hwIGZsb2F0IGMxID0gKDM0MjQuMCAvIDQwOTYuMCk7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IGhpZ2hwIGZsb2F0IGMyID0gKDI0MTMuMCAvIDQwOTYuMCkgKiAzMi4wOworICAgICAgICAgICAgICAgICAgICBjb25zdCBoaWdocCBmbG9hdCBjMyA9ICgyMzkyLjAgLyA0MDk2LjApICogMzIuMDsKKworICAgICAgICAgICAgICAgICAgICBoaWdocCB2ZWMzIHRtcCA9IHBvdyhjbGFtcChjb2xvciwgMC4wLCAxLjApLCAxLjAgLyB2ZWMzKG0yKSk7CisgICAgICAgICAgICAgICAgICAgIHRtcCA9IG1heCh0bXAgLSBjMSwgMC4wKSAvIChjMiAtIGMzICogdG1wKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBvdyh0bXAsIDEuMCAvIHZlYzMobTEpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICApX19TSEFERVJfXyI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBLZXk6OklOUFVUX1RGX0hMRzoKKyAgICAgICAgICAgIGZzIDw8IFIiX19TSEFERVJfXygKKyAgICAgICAgICAgICAgICBoaWdocCBmbG9hdCBFT1RGX2NoYW5uZWwoY29uc3QgaGlnaHAgZmxvYXQgY2hhbm5lbCkgeworICAgICAgICAgICAgICAgICAgICBjb25zdCBoaWdocCBmbG9hdCBhID0gMC4xNzg4MzI3NzsKKyAgICAgICAgICAgICAgICAgICAgY29uc3QgaGlnaHAgZmxvYXQgYiA9IDAuMjg0NjY4OTI7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IGhpZ2hwIGZsb2F0IGMgPSAwLjU1OTkxMDczOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2hhbm5lbCA8PSAwLjUgPyBjaGFubmVsICogY2hhbm5lbCAvIDMuMCA6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGV4cCgoY2hhbm5lbCAtIGMpIC8gYSkgKyBiKSAvIDEyLjA7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgdmVjMyBFT1RGKGNvbnN0IGhpZ2hwIHZlYzMgY29sb3IpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZlYzMoRU9URl9jaGFubmVsKGNvbG9yLnIpLCBFT1RGX2NoYW5uZWwoY29sb3IuZyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgRU9URl9jaGFubmVsKGNvbG9yLmIpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICApX19TSEFERVJfXyI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIGZzIDw8IFIiX19TSEFERVJfXygKKyAgICAgICAgICAgICAgICB2ZWMzIEVPVEYoY29uc3QgdmVjMyBsaW5lYXIpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxpbmVhcjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICApX19TSEFERVJfXyI7CisgICAgICAgICAgICBicmVhazsKKyAgICB9Cit9CisKK3ZvaWQgUHJvZ3JhbUNhY2hlOjpnZW5lcmF0ZVRvbmVNYXBwaW5nUHJvY2VzcyhGb3JtYXR0ZXImIGZzLCBjb25zdCBLZXkmIG5lZWRzKSB7CisgICAgLy8gQ29udmVydCByZWxhdGl2ZSBsaWdodCB0byBhYnNvbHV0ZSBsaWdodC4KKyAgICBzd2l0Y2ggKG5lZWRzLmdldElucHV0VEYoKSkgeworICAgICAgICBjYXNlIEtleTo6SU5QVVRfVEZfU1QyMDg0OgorICAgICAgICAgICAgZnMgPDwgUiJfX1NIQURFUl9fKAorICAgICAgICAgICAgICAgIGhpZ2hwIHZlYzMgU2NhbGVMdW1pbmFuY2UoaGlnaHAgdmVjMyBjb2xvcikgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29sb3IgKiAxMDAwMC4wOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIClfX1NIQURFUl9fIjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEtleTo6SU5QVVRfVEZfSExHOgorICAgICAgICAgICAgZnMgPDwgUiJfX1NIQURFUl9fKAorICAgICAgICAgICAgICAgIGhpZ2hwIHZlYzMgU2NhbGVMdW1pbmFuY2UoaGlnaHAgdmVjMyBjb2xvcikgeworICAgICAgICAgICAgICAgICAgICAvLyBUaGUgZm9ybXVsYSBpczoKKyAgICAgICAgICAgICAgICAgICAgLy8gYWxwaGEgKiBwb3coWSwgZ2FtbWEgLSAxLjApICogY29sb3IgKyBiZXRhOworICAgICAgICAgICAgICAgICAgICAvLyB3aGVyZSBhbHBoYSBpcyAxMDAwLjAsIGdhbW1hIGlzIDEuMiwgYmV0YSBpcyAwLjAuCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb2xvciAqIDEwMDAuMCAqIHBvdyhjb2xvci55LCAwLjIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIClfX1NIQURFUl9fIjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgZnMgPDwgUiJfX1NIQURFUl9fKAorICAgICAgICAgICAgICAgIGhpZ2hwIHZlYzMgU2NhbGVMdW1pbmFuY2UoaGlnaHAgdmVjMyBjb2xvcikgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29sb3IgKiBkaXNwbGF5TWF4THVtaW5hbmNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIClfX1NIQURFUl9fIjsKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKworICAgIC8vIFRvbmUgbWFwIGFic29sdXRlIGxpZ2h0IHRvIGRpc3BsYXkgbHVtaW5hbmNlIHJhbmdlLgorICAgIHN3aXRjaCAobmVlZHMuZ2V0SW5wdXRURigpKSB7CisgICAgICAgIGNhc2UgS2V5OjpJTlBVVF9URl9TVDIwODQ6CisgICAgICAgIGNhc2UgS2V5OjpJTlBVVF9URl9ITEc6CisgICAgICAgICAgICBzd2l0Y2ggKG5lZWRzLmdldE91dHB1dFRGKCkpIHsKKyAgICAgICAgICAgICAgICBjYXNlIEtleTo6T1VUUFVUX1RGX0hMRzoKKyAgICAgICAgICAgICAgICAgICAgLy8gUmlnaHQgbm93IHdoZW4gbWl4ZWQgUFEgYW5kIEhMRyBjb250ZW50cyBhcmUgcHJlc2VudGVkLAorICAgICAgICAgICAgICAgICAgICAvLyBITEcgY29udGVudCB3aWxsIGFsd2F5cyBiZSBjb252ZXJ0ZWQgdG8gUFEuIEhvd2V2ZXIsIGZvcgorICAgICAgICAgICAgICAgICAgICAvLyBjb21wbGV0ZW5lc3MsIHdlIHNpbXBseSBjbGFtcCB0aGUgdmFsdWUgdG8gWzAuMCwgMTAwMC4wXS4KKyAgICAgICAgICAgICAgICAgICAgZnMgPDwgUiJfX1NIQURFUl9fKAorICAgICAgICAgICAgICAgICAgICAgICAgaGlnaHAgdmVjMyBUb25lTWFwKGhpZ2hwIHZlYzMgY29sb3IpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2xhbXAoY29sb3IsIDAuMCwgMTAwMC4wKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgKV9fU0hBREVSX18iOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIEtleTo6T1VUUFVUX1RGX1NUMjA4NDoKKyAgICAgICAgICAgICAgICAgICAgZnMgPDwgUiJfX1NIQURFUl9fKAorICAgICAgICAgICAgICAgICAgICAgICAgaGlnaHAgdmVjMyBUb25lTWFwKGhpZ2hwIHZlYzMgY29sb3IpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29sb3I7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIClfX1NIQURFUl9fIjsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgZnMgPDwgUiJfX1NIQURFUl9fKAorICAgICAgICAgICAgICAgICAgICAgICAgaGlnaHAgdmVjMyBUb25lTWFwKGhpZ2hwIHZlYzMgY29sb3IpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBtYXhNYXN0ZXJpbmdMdW1pID0gbWF4TWFzdGVyaW5nTHVtaW5hbmNlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IG1heENvbnRlbnRMdW1pID0gbWF4Q29udGVudEx1bWluYW5jZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBtYXhJbkx1bWkgPSBtaW4obWF4TWFzdGVyaW5nTHVtaSwgbWF4Q29udGVudEx1bWkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IG1heE91dEx1bWkgPSBkaXNwbGF5TWF4THVtaW5hbmNlOworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgbml0cyA9IGNvbG9yLnk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjbGFtcCB0byBtYXggaW5wdXQgbHVtaW5hbmNlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbml0cyA9IGNsYW1wKG5pdHMsIDAuMCwgbWF4SW5MdW1pKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNjYWxlIFswLjAsIG1heEluTHVtaV0gdG8gWzAuMCwgbWF4T3V0THVtaV0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobWF4SW5MdW1pIDw9IG1heE91dEx1bWkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbG9yICogKG1heE91dEx1bWkgLyBtYXhJbkx1bWkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRocmVlIGNvbnRyb2wgcG9pbnRzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZsb2F0IHgwID0gMTAuMDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZmxvYXQgeTAgPSAxNy4wOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4MSA9IG1heE91dEx1bWkgKiAwLjc1OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB5MSA9IHgxOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4MiA9IHgxICsgKG1heEluTHVtaSAtIHgxKSAvIDIuMDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeTIgPSB5MSArIChtYXhPdXRMdW1pIC0geTEpICogMC43NTsKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBob3Jpem9udGFsIGRpc3RhbmNlcyBiZXR3ZWVuIHRoZSBsYXN0IHRocmVlIGNvbnRyb2wgcG9pbnRzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IGgxMiA9IHgyIC0geDE7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IGgyMyA9IG1heEluTHVtaSAtIHgyOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0YW5nZW50cyBhdCB0aGUgbGFzdCB0aHJlZSBjb250cm9sIHBvaW50cworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBtMSA9ICh5MiAtIHkxKSAvIGgxMjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgbTMgPSAobWF4T3V0THVtaSAtIHkyKSAvIGgyMzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgbTIgPSAobTEgKyBtMykgLyAyLjA7CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5pdHMgPCB4MCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2NhbGUgWzAuMCwgeDBdIHRvIFswLjAsIHkwXSBsaW5lYXJseQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgc2xvcGUgPSB5MCAvIHgwOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbG9yICogc2xvcGU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobml0cyA8IHgxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzY2FsZSBbeDAsIHgxXSB0byBbeTAsIHkxXSBsaW5lYXJseQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgc2xvcGUgPSAoeTEgLSB5MCkgLyAoeDEgLSB4MCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuaXRzID0geTAgKyAobml0cyAtIHgwKSAqIHNsb3BlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG5pdHMgPCB4MikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2NhbGUgW3gxLCB4Ml0gdG8gW3kxLCB5Ml0gdXNpbmcgSGVybWl0ZSBpbnRlcnAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHQgPSAobml0cyAtIHgxKSAvIGgxMjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5pdHMgPSAoeTEgKiAoMS4wICsgMi4wICogdCkgKyBoMTIgKiBtMSAqIHQpICogKDEuMCAtIHQpICogKDEuMCAtIHQpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHkyICogKDMuMCAtIDIuMCAqIHQpICsgaDEyICogbTIgKiAodCAtIDEuMCkpICogdCAqIHQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzY2FsZSBbeDIsIG1heEluTHVtaV0gdG8gW3kyLCBtYXhPdXRMdW1pXSB1c2luZyBIZXJtaXRlIGludGVycAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdCA9IChuaXRzIC0geDIpIC8gaDIzOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbml0cyA9ICh5MiAqICgxLjAgKyAyLjAgKiB0KSArIGgyMyAqIG0yICogdCkgKiAoMS4wIC0gdCkgKiAoMS4wIC0gdCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobWF4T3V0THVtaSAqICgzLjAgLSAyLjAgKiB0KSArIGgyMyAqIG0zICogKHQgLSAxLjApKSAqIHQgKiB0OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gY29sb3IueSBpcyBncmVhdGVyIHRoYW4geDAgYW5kIGlzIHRodXMgbm9uLXplcm8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29sb3IgKiAobml0cyAvIGNvbG9yLnkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICApX19TSEFERVJfXyI7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAvLyBpbnZlcnNlIHRvbmUgbWFwOyB0aGUgb3V0cHV0IGx1bWluYW5jZSBjYW4gYmUgdXAgdG8gbWF4T3V0THVtaS4KKyAgICAgICAgICAgIGZzIDw8IFIiX19TSEFERVJfXygKKyAgICAgICAgICAgICAgICBoaWdocCB2ZWMzIFRvbmVNYXAoaGlnaHAgdmVjMyBjb2xvcikgeworICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCBtYXhPdXRMdW1pID0gMzAwMC4wOworCisgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZsb2F0IHgwID0gNS4wOworICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCB5MCA9IDIuNTsKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDEgPSBkaXNwbGF5TWF4THVtaW5hbmNlICogMC43OworICAgICAgICAgICAgICAgICAgICBmbG9hdCB5MSA9IG1heE91dEx1bWkgKiAwLjE1OworICAgICAgICAgICAgICAgICAgICBmbG9hdCB4MiA9IGRpc3BsYXlNYXhMdW1pbmFuY2UgKiAwLjk7CisgICAgICAgICAgICAgICAgICAgIGZsb2F0IHkyID0gbWF4T3V0THVtaSAqIDAuNDU7CisgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgzID0gZGlzcGxheU1heEx1bWluYW5jZTsKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgeTMgPSBtYXhPdXRMdW1pOworCisgICAgICAgICAgICAgICAgICAgIGZsb2F0IGMxID0geTEgLyAzLjA7CisgICAgICAgICAgICAgICAgICAgIGZsb2F0IGMyID0geTIgLyAyLjA7CisgICAgICAgICAgICAgICAgICAgIGZsb2F0IGMzID0geTMgLyAxLjU7CisKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgbml0cyA9IGNvbG9yLnk7CisKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgc2NhbGU7CisgICAgICAgICAgICAgICAgICAgIGlmIChuaXRzIDw9IHgwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBzY2FsZSBbMC4wLCB4MF0gdG8gWzAuMCwgeTBdIGxpbmVhcmx5CisgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCBzbG9wZSA9IHkwIC8geDA7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29sb3IgKiBzbG9wZTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChuaXRzIDw9IHgxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBzY2FsZSBbeDAsIHgxXSB0byBbeTAsIHkxXSB1c2luZyBhIGN1cnZlCisgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB0ID0gKG5pdHMgLSB4MCkgLyAoeDEgLSB4MCk7CisgICAgICAgICAgICAgICAgICAgICAgICBuaXRzID0gKDEuMCAtIHQpICogKDEuMCAtIHQpICogeTAgKyAyLjAgKiAoMS4wIC0gdCkgKiB0ICogYzEgKyB0ICogdCAqIHkxOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG5pdHMgPD0geDIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNjYWxlIFt4MSwgeDJdIHRvIFt5MSwgeTJdIHVzaW5nIGEgY3VydmUKKyAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHQgPSAobml0cyAtIHgxKSAvICh4MiAtIHgxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5pdHMgPSAoMS4wIC0gdCkgKiAoMS4wIC0gdCkgKiB5MSArIDIuMCAqICgxLjAgLSB0KSAqIHQgKiBjMiArIHQgKiB0ICogeTI7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBzY2FsZSBbeDIsIHgzXSB0byBbeTIsIHkzXSB1c2luZyBhIGN1cnZlCisgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB0ID0gKG5pdHMgLSB4MikgLyAoeDMgLSB4Mik7CisgICAgICAgICAgICAgICAgICAgICAgICBuaXRzID0gKDEuMCAtIHQpICogKDEuMCAtIHQpICogeTIgKyAyLjAgKiAoMS4wIC0gdCkgKiB0ICogYzMgKyB0ICogdCAqIHkzOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLy8gY29sb3IueSBpcyBncmVhdGVyIHRoYW4geDAgYW5kIGlzIHRodXMgbm9uLXplcm8KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbG9yICogKG5pdHMgLyBjb2xvci55KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICApX19TSEFERVJfXyI7CisgICAgICAgICAgICBicmVhazsKKyAgICB9CisKKyAgICAvLyBjb252ZXJ0IGFic29sdXRlIGxpZ2h0IHRvIHJlbGF0aXZlIGxpZ2h0LgorICAgIHN3aXRjaCAobmVlZHMuZ2V0T3V0cHV0VEYoKSkgeworICAgICAgICBjYXNlIEtleTo6T1VUUFVUX1RGX1NUMjA4NDoKKyAgICAgICAgICAgIGZzIDw8IFIiX19TSEFERVJfXygKKyAgICAgICAgICAgICAgICBoaWdocCB2ZWMzIE5vcm1hbGl6ZUx1bWluYW5jZShoaWdocCB2ZWMzIGNvbG9yKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb2xvciAvIDEwMDAwLjA7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgKV9fU0hBREVSX18iOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgS2V5OjpPVVRQVVRfVEZfSExHOgorICAgICAgICAgICAgZnMgPDwgUiJfX1NIQURFUl9fKAorICAgICAgICAgICAgICAgIGhpZ2hwIHZlYzMgTm9ybWFsaXplTHVtaW5hbmNlKGhpZ2hwIHZlYzMgY29sb3IpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbG9yIC8gMTAwMC4wICogcG93KGNvbG9yLnkgLyAxMDAwLjAsIC0wLjIgLyAxLjIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIClfX1NIQURFUl9fIjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgZnMgPDwgUiJfX1NIQURFUl9fKAorICAgICAgICAgICAgICAgIGhpZ2hwIHZlYzMgTm9ybWFsaXplTHVtaW5hbmNlKGhpZ2hwIHZlYzMgY29sb3IpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbG9yIC8gZGlzcGxheU1heEx1bWluYW5jZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICApX19TSEFERVJfXyI7CisgICAgICAgICAgICBicmVhazsKKyAgICB9Cit9CisKKy8vIEdlbmVyYXRlIE9PVEYgdGhhdCBtb2RpZmllcyB0aGUgcmVsYXRpdmUgc2NlbmNlIGxpZ2h0IHRvIHJlbGF0aXZlIGRpc3BsYXkgbGlnaHQuCit2b2lkIFByb2dyYW1DYWNoZTo6Z2VuZXJhdGVPT1RGKEZvcm1hdHRlciYgZnMsIGNvbnN0IFByb2dyYW1DYWNoZTo6S2V5JiBuZWVkcykgeworICAgIGlmICghbmVlZHMubmVlZHNUb25lTWFwcGluZygpKSB7CisgICAgICAgIGZzIDw8IFIiX19TSEFERVJfXygKKyAgICAgICAgICAgIGhpZ2hwIHZlYzMgT09URihjb25zdCBoaWdocCB2ZWMzIGNvbG9yKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGNvbG9yOworICAgICAgICAgICAgfQorICAgICAgICApX19TSEFERVJfXyI7CisgICAgfSBlbHNlIHsKKyAgICAgICAgZ2VuZXJhdGVUb25lTWFwcGluZ1Byb2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LmcpLCBPRVRGX3NSR0IobGluZWFyLmIpKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB2ZWMzIE9FVEYoY29uc3QgdmVjMyBsaW5lYXIpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNpZ24obGluZWFyLnJnYikgKiBPRVRGX3NSR0IoYWJzKGxpbmVhci5yZ2IpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICApX19TSEFERVJfXyI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBLZXk6Ok9VVFBVVF9URl9TVDIwODQ6CisgICAgICAgICAgICBmcyA8PCBSIl9fU0hBREVSX18oCisgICAgICAgICAgICAgICAgdmVjMyBPRVRGKGNvbnN0IHZlYzMgbGluZWFyKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IGhpZ2hwIGZsb2F0IG0xID0gKDI2MTAuMCAvIDQwOTYuMCkgLyA0LjA7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IGhpZ2hwIGZsb2F0IG0yID0gKDI1MjMuMCAvIDQwOTYuMCkgKiAxMjguMDsKKyAgICAgICAgICAgICAgICAgICAgY29uc3QgaGlnaHAgZmxvYXQgYzEgPSAoMzQyNC4wIC8gNDA5Ni4wKTsKKyAgICAgICAgICAgICAgICAgICAgY29uc3QgaGlnaHAgZmxvYXQgYzIgPSAoMjQxMy4wIC8gNDA5Ni4wKSAqIDMyLjA7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IGhpZ2hwIGZsb2F0IGMzID0gKDIzOTIuMCAvIDQwOTYuMCkgKiAzMi4wOworCisgICAgICAgICAgICAgICAgICAgIGhpZ2hwIHZlYzMgdG1wID0gcG93KGxpbmVhciwgdmVjMyhtMSkpOworICAgICAgICAgICAgICAgICAgICB0bXAgPSAoYzEgKyBjMiAqIHRtcCkgLyAoMS4wICsgYzMgKiB0bXApOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gcG93KHRtcCwgdmVjMyhtMikpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIClfX1NIQURFUl9fIjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEtleTo6T1VUUFVUX1RGX0hMRzoKKyAgICAgICAgICAgIGZzIDw8IFIiX19TSEFERVJfXygKKyAgICAgICAgICAgICAgICBoaWdocCBmbG9hdCBPRVRGX2NoYW5uZWwoY29uc3QgaGlnaHAgZmxvYXQgY2hhbm5lbCkgeworICAgICAgICAgICAgICAgICAgICBjb25zdCBoaWdocCBmbG9hdCBhID0gMC4xNzg4MzI3NzsKKyAgICAgICAgICAgICAgICAgICAgY29uc3QgaGlnaHAgZmxvYXQgYiA9IDAuMjg0NjY4OTI7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IGhpZ2hwIGZsb2F0IGMgPSAwLjU1OTkxMDczOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2hhbm5lbCA8PSAxLjAgLyAxMi4wID8gc3FydCgzLjAgKiBjaGFubmVsKSA6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSAqIGxvZygxMi4wICogY2hhbm5lbCAtIGIpICsgYzsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB2ZWMzIE9FVEYoY29uc3QgaGlnaHAgdmVjMyBjb2xvcikgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmVjMyhPRVRGX2NoYW5uZWwoY29sb3IuciksIE9FVEZfY2hhbm5lbChjb2xvci5nKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBPRVRGX2NoYW5uZWwoY29sb3IuYikpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIClfX1NIQURFUl9fIjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgZnMgPDwgUiJfX1NIQURFUl9fKAorICAgICAgICAgICAgICAgIHZlYzMgT0VURihjb25zdCB2ZWMzIGxpbmVhcikgeworICAgIC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AgZmxvYXQgZCA9IGxlbmd0aChvdXRTaGFkb3dQYXJhbXMueHkpOworICAgICAgICAgICAgICAgIHZlYzIgdXYgPSB2ZWMyKG91dFNoYWRvd1BhcmFtcy56ICogKDEuMCAtIGQpLCAwLjUpOworICAgICAgICAgICAgICAgIGxvd3AgZmxvYXQgZmFjdG9yID0gdGV4dHVyZTJEKHNhbXBsZXIsIHV2KS5hOworICAgICAgICAgICAgICAgIHJldHVybiBvdXRTaGFkb3dDb2xvciAqIGZhY3RvcjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIClfX1NIQURFUl9fIjsKKyAgICB9CisKKyAgICBpZiAobmVlZHMuZ2V0VGV4dHVyZVRhcmdldCgpID09IEtleTo6VEVYVFVSRV9PRkYgfHwgbmVlZHMuaGFzQWxwaGEoKSkgeworICAgICAgICBmcyA8PCAidW5pZm9ybSB2ZWM0IGNvbG9yOyI7CisgICAgfQorCisgICAgaWYgKG5lZWRzLmlzWTQxMEJUMjAyMCgpKSB7CisgICAgICAgIGZzIDw8IFIiX19TSEFERVJfXygKKyAgICAgICAgICAgIHZlYzMgY29udmVydFk0MTBCVDIwMjAoY29uc3QgdmVjMyBjb2xvcikgeworICAgICAgICAgICAgICAgIGNvbnN0IHZlYzMgb2Zmc2V0ID0gdmVjMygwLjA2MjUsIDAuNSwgMC41KTsKKyAgICAgICAgICAgICAgICBjb25zdCBtYXQzIHRyYW5zZm9ybSA9IG1hdDMoCisgICAgICAgICAgICAgICAgICAgIHZlYzMoMS4xNjc4LCAgMS4xNjc4LCAxLjE2NzgpLAorICAgICAgICAgICAgICAgICAgICB2ZWMzKCAgIDAuMCwgLTAuMTg3OCwgMi4xNDgxKSwKKyAgICAgICAgICAgICAgICAgICAgdmVjMygxLjY4MzYsIC0wLjY1MjMsICAgMC4wKSk7CisgICAgICAgICAgICAgICAgLy8gWSBpcyBpbiBHLCBVIGlzIGluIFIsIGFuZCBWIGlzIGluIEIKKyAgICAgICAgICAgICAgICByZXR1cm4gY2xhbXAodHJhbnNmb3JtICogKGNvbG9yLmdyYiAtIG9mZnNldCksIDAuMCwgMS4wKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIClfX1NIQURFUl9fIjsKKyAgICB9CisKKyAgICBpZiAobmVlZHMuaGFzVHJhbnNmb3JtTWF0cml4KCkgfHwgKG5lZWRzLmdldElucHV0VEYoKSAhPSBuZWVkcy5nZXRPdXRwdXRURigpKSkgeworICAgICAgICBpZiAobmVlZHMubmVlZHNUb25lTWFwcGluZygpKSB7CisgICAgICAgICAgICBmcyA8PCAidW5pZm9ybSBmbG9hdCBkaXNwbGF5TWF4THVtaW5hbmNlOyI7CisgICAgICAgICAgICBmcyA8PCAidW5pZm9ybSBmbG9hdCBtYXhNYXN0ZXJpbmdMdW1pbmFuY2U7IjsKKyAgICAgICAgICAgIGZzIDw8ICJ1bmlmb3JtIGZsb2F0IG1heENvbnRlbnRMdW1pbmFuY2U7IjsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChuZWVkcy5oYXNJbnB1dFRyYW5zZm9ybU1hdHJpeCgpKSB7CisgICAgICAgICAgICBmcyA8PCAidW5pZm9ybSBtYXQ0IGlucHV0VHJhbnNmb3JtTWF0cml4OyI7CisgICAgICAgICAgICBmcyA8PCBSIl9fU0hBREVSX18oCisgICAgICAgICAgICAgICAgaGlnaHAgdmVjMyBJbnB1dFRyYW5zZm9ybShjb25zdCBoaWdocCB2ZWMzIGNvbG9yKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBjbGFtcCh2ZWMzKGlucHV0VHJhbnNmb3JtTWF0cml4ICogdmVjNChjb2xvciwgMS4wKSksIDAuMCwgMS4wKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICApX19TSEFERVJfXyI7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBmcyA8PCBSIl9fU0hBREVSX18oCisgICAgICAgICAgICAgICAgaGlnaHAgdmVjMyBJbnB1dFRyYW5zZm9ybShjb25zdCBoaWdocCB2ZWMzIGNvbG9yKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb2xvcjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICApX19TSEFERVJfXyI7CisgICAgICAgIH0KKworICAgICAgICAvLyB0aGUgdHJhbnNmb3JtYXRpb24gZnJvbSBhIHdpZGVyIGNvbG9yc3BhY2UgdG8gYSBuYXJyb3dlciBvbmUgY2FuCisgICAgICAgIC8vIHJlc3VsdCBpbiA+MS4wIG9yIDwwLjAgcGl4ZWwgdmFsdWVzCisgICAgICAgIGlmIChuZWVkcy5oYXNPdXRwdXRUcmFuc2Zvcm1NYXRyaXgoKSkgeworICAgICAgICAgICAgZnMgPDwgInVuaWZvcm0gbWF0NCBvdXRwdXRUcmFuc2Zvcm1NYXRyaXg7IjsKKyAgICAgICAgICAgIGZzIDw8IFIiX19TSEFERVJfXygKKyAgICAgICAgICAgICAgICBoaWdocCB2ZWMzIE91dHB1dFRyYW5zZm9ybShjb25zdCBoaWdocCB2ZWMzIGNvbG9yKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBjbGFtcCh2ZWMzKG91dHB1dFRyYW5zZm9ybU1hdHJpeCAqIHZlYzQoY29sb3IsIDEuMCkpLCAwLjAsIDEuMCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgKV9fU0hBREVSX18iOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZnMgPDwgUiJfX1NIQURFUl9fKAorICAgICAgICAgICAgICAgIGhpZ2hwIHZlYzMgT3V0cHV0VHJhbnNmb3JtKGNvbnN0IGhpZ2hwIHZlYzMgY29sb3IpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNsYW1wKGNvbG9yLCAwLjAsIDEuMCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgKV9fU0hBREVSX18iOworICAgICAgICB9CisKKyAgICAgICAgZ2VuZXJhdGVFT1RGKGZzLCBuZWVkcyk7CisgICAgICAgIGdlbmVyYXRlT09URihmcywgbmVlZHMpOworICAgICAgICBnZW5lcmF0ZU9FVEYoZnMsIG5lZWRzKTsKKyAgICB9CisKKyAgICBmcyA8PCAidm9pZCBtYWluKHZvaWQpIHsiIDw8IGluZGVudDsKKyAgICBpZiAobmVlZHMuZHJhd1NoYWRvd3MoKSkgeworICAgICAgICBmcyA8PCAiZ2xfRnJhZ0NvbG9yID0gZ2V0U2hhZG93Q29sb3IoKTsiOworICAgIH0gZWxzZSB7CisgICAgICAgIGlmIChuZWVkcy5pc1RleHR1cmluZygpKSB7CisgICAgICAgICAgICBmcyA8PCAiZ2xfRnJhZ0NvbG9yID0gdGV4dHVyZTJEKHNhbXBsZXIsIG91dFRleENvb3Jkcyk7IjsKKyAgICAgICAgICAgIGlmIChuZWVkcy5pc1k0MTBCVDIwMjAoKSkgeworICAgICAgICAgICAgICAgIGZzIDw8ICJnbF9GcmFnQ29sb3IucmdiID0gY29udmVydFk0MTBCVDIwMjAoZ2xfRnJhZ0NvbG9yLnJnYik7IjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGZzIDw8ICJnbF9GcmFnQ29sb3IucmdiID0gY29sb3IucmdiOyI7CisgICAgICAgICAgICBmcyA8PCAiZ2xfRnJhZ0NvbG9yLmEgPSAxLjA7IjsKKyAgICAgICAgfQorICAgICAgICBpZiAobmVlZHMuaXNPcGFxdWUoKSkgeworICAgICAgICAgICAgZnMgPDwgImdsX0ZyYWdDb2xvci5hID0gMS4wOyI7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG5lZWRzLmhhc0FscGhhKCkpIHsKKyAgICAgICAgICAgIC8vIG1vZHVsYXRlIHRoZSBjdXJyZW50IGFscGhhIHZhbHVlIHdpdGggYWxwaGEgc2V0CisgICAgICAgICAgICBpZiAobmVlZHMuaXNQcmVtdWx0aXBsaWVkKCkpIHsKKyAgICAgICAgICAgICAgICAvLyAuLi4gYW5kIHRoZSBjb2xvciB0b28g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bSBhIERlc2NyaXB0aW9uLgorICogSXQgYWxzbyBtYWludGFpbnMgYSBjYWNoZSBvZiB0aGVzZSBQcm9ncmFtcy4KKyAqLworY2xhc3MgUHJvZ3JhbUNhY2hlIDogcHVibGljIFNpbmdsZXRvbjxQcm9ncmFtQ2FjaGU+IHsKK3B1YmxpYzoKKyAgICAvKgorICAgICAqIEtleSBpcyB1c2VkIHRvIHJldHJpZXZlIGEgUHJvZ3JhbSBpbiB0aGUgY2FjaGUuCisgICAgICogQSBLZXkgaXMgZ2VuZXJhdGVkIGZyb20gYSBEZXNjcmlwdGlvbi4KKyAgICAgKi8KKyAgICBjbGFzcyBLZXkgeworICAgICAgICBmcmllbmQgY2xhc3MgUHJvZ3JhbUNhY2hlOworICAgICAgICB0eXBlZGVmIHVpbnQzMl90IGtleV90OworICAgICAgICBrZXlfdCBtS2V5OworCisgICAgcHVibGljOgorICAgICAgICBlbnVtIHsKKyAgICAgICAgICAgIEJMRU5EX1NISUZUID0gMCwKKyAgICAgICAgICAgIEJMRU5EX01BU0sgPSAxIDw8IEJMRU5EX1NISUZULAorICAgICAgICAgICAgQkxFTkRfUFJFTVVMVCA9IDEgPDwgQkxFTkRfU0hJRlQsCisgICAgICAgICAgICBCTEVORF9OT1JNQUwgPSAwIDw8IEJMRU5EX1NISUZULAorCisgICAgICAgICAgICBPUEFDSVRZX1NISUZUID0gMSwKKyAgICAgICAgICAgIE9QQUNJVFlfTUFTSyA9IDEgPDwgT1BBQ0lUWV9TSElGVCwKKyAgICAgICAgICAgIE9QQUNJVFlfT1BBUVVFID0gMSA8PCBPUEFDSVRZX1NISUZULAorICAgICAgICAgICAgT1BBQ0lUWV9UUkFOU0xVQ0VOVCA9IDAgPDwgT1BBQ0lUWV9TSElGVCwKKworICAgICAgICAgICAgQUxQSEFfU0hJRlQgPSAyLAorICAgICAgICAgICAgQUxQSEFfTUFTSyA9IDEgPDwgQUxQSEFfU0hJRlQsCisgICAgICAgICAgICBBTFBIQV9MVF9PTkUgPSAxIDw8IEFMUEhBX1NISUZULAorICAgICAgICAgICAgQUxQSEFfRVFfT05FID0gMCA8PCBBTFBIQV9TSElGVCwKKworICAgICAgICAgICAgVEVYVFVSRV9TSElGVCA9IDMsCisgICAgICAgICAgICBURVhUVVJFX01BU0sgPSAzIDw8IFRFWFRVUkVfU0hJRlQsCisgICAgICAgICAgICBURVhUVVJFX09GRiA9IDAgPDwgVEVYVFVSRV9TSElGVCwKKyAgICAgICAgICAgIFRFWFRVUkVfRVhUID0gMSA8PCBURVhUVVJFX1NISUZULAorICAgICAgICAgICAgVEVYVFVSRV8yRCA9IDIgPDwgVEVYVFVSRV9TSElGVCwKKworICAgICAgICAgICAgUk9VTkRFRF9DT1JORVJTX1NISUZUID0gNSwKKyAgICAgICAgICAgIFJPVU5ERURfQ09STkVSU19NQVNLID0gMSA8PCBST1VOREVEX0NPUk5FUlNfU0hJRlQsCisgICAgICAgICAgICBST1VOREVEX0NPUk5FUlNfT0ZGID0gMCA8PCBST1VOREVEX0NPUk5FUlNfU0hJRlQsCisgICAgICAgICAgICBST1VOREVEX0NPUk5FUlNfT04gPSAxIDw8IFJPVU5ERURfQ09STkVSU19TSElGVCwKKworICAgICAgICAgICAgSU5QVVRfVFJBTlNGT1JNX01BVFJJWF9TSElGVCA9IDYsCisgICAgICAgICAgICBJTlBVVF9UUkFOU0ZPUk1fTUFUUklYX01BU0sgPSAxIDw8IElOUFVUX1RSQU5TRk9STV9NQVRSSVhfU0hJRlQsCisgICAgICAgICAgICBJTlBVVF9UUkFOU0ZPUk1fTUFUUklYX09GRiA9IDAgPDwgSU5QVVRfVFJBTlNGT1JNX01BVFJJWF9TSElGVCwKKyAgICAgICAgICAgIElOUFVUX1RSQU5TRk9STV9NQVRSSVhfT04gPSAxIDw8IElOUFVUX1RSQU5TRk9STV9NQVRSSVhfU0hJRlQsCisKKyAgICAgICAgICAgIE9VVFBVVF9UUkFOU0ZPUk1fTUFUUklYX1NISUZUID0gNywKKyAgICAgICAgICAgIE9VVFBVVF9UUkFOU0ZPUk1fTUFUUklYX01BU0sgPSAxIDw8IE9VVFBVVF9UUkFOU0ZPUk1fTUFUUklYX1NISUZULAorICAgICAgICAgICAgT1VUUFVUX1RSQU5TRk9STV9NQVRSSVhfT0ZGID0gMCA8PCBPVVRQVVRfVFJBTlNGT1JNX01BVFJJWF9TSElGVCwKKyAgICAgICAgICAgIE9VVFBVVF9UUkFOU0ZPUk1fTUFUUklYX09OID0gMSA8PCBPVVRQVVRfVFJBTlNGT1JNX01BVFJJWF9TSElGVCwKKworICAgICAgICAgICAgSU5QVVRfVEZfU0hJRlQgPSA4LAorICAgICAgICAgICAgSU5QVVRfVEZfTUFTSyA9IDMgPDwgSU5QVVRfVEZfU0hJRlQsCisgICAgICAgICAgICBJTlBVVF9URl9MSU5FQVIgPSAwIDw8IElOUFVUX1RGX1NISUZULAorICAgICAgICAgICAgSU5QVVRfVEZfU1JHQiA9IDEgPDwgSU5QVVRfVEZfU0hJRlQsCisgICAgICAgICAgICBJTlBVVF9URl9TVDIwODQgPSAyIDw8IElOUFVUX1RGX1NISUZULAorICAgICAgICAgICAgSU5QVVRfVEZfSExHID0gMyA8PCBJTlBVVF9URl9TSElGVCwKKworICAgICAgICAgICAgT1VUUFVUX1RGX1NISUZUID0gMTAsCisgICAgICAgICAgICBPVVRQVVRfVEZfTUFTSyA9IDMgPDwgT1VUUFVUX1RGX1NISUZULAorICAgICAgICAgICAgT1VUUFVUX1RGX0xJTkVBUiA9IDAgPDwgT1VUUFVUX1RGX1NISUZULAorICAgICAgICAgICAgT1VUUFVUX1RGX1NSR0IgPSAxIDw8IE9VVFBVVF9URl9TSElGVCwKKyAgICAgICAgICAgIE9VVFBVVF9URl9TVDIwODQgPSAyIDw8IE9VVFBVVF9URl9TSElGVCwKKyAgICAgICAgICAgIE9VVFBVVF9URl9ITEcgPSAzIDw8IE9VVFBVVF9URl9TSElGVCwKKworICAgICAgICAgICAgWTQxMF9CVDIwMjBfU0hJRlQgPSAxMiwKKyAgICAgICAgICAgIFk0MTBfQlQyMDIwX01BU0sgPSAxIDw8IFk0MTBfQlQyMDIwX1NISUZULAorICAgICAgICAgICAgWTQxMF9CVDIwMjBfT0ZGID0gMCA8PCBZNDEwX0JUMjAyMF9TSElGVCwKKyAgICAgICAgICAgIFk0MTBfQlQyMDIwX09OID0gMSA8PCBZNDEwX0JUMjAyMF9TSElGVCwKKworICAgICAgICAgICAgU0hBRE9XX1NISUZUID0gMTMsCisgICAgICAgICAgICBTSEFET1dfTUFTSyA9IDEgPDwgU0hBRE9XX1NISUZULAorICAgICAgICAgICAgU0hBRE9XX09GRiA9IDAgPDwgU0hBRE9XX1NISUZULAorICAgICAgICAgICAgU0hBRE9XX09OID0gMSA8PCBTSEFET1dfU0hJRlQsCisgICAgICAgIH07CisKKyAgICAgICAgaW5saW5lIEtleSgpIDogbUtleSgwKSB7fQorICAgICAgICBpbmxpbmUgS2V5KGNvbnN0IEtleSYgcmhzKSA6IG1LZXkocmhzLm1LZXkpIHt9CisKKyAgICAgICAgaW5saW5lIEtleSYgc2V0KGtleV90IG1hc2ssIGtleV90IHZhbHVlKSB7CisgICAgICAgICAgICBtS2V5ID0gKG1LZXkgJiB+bWFzaykgfCB2YWx1ZTsKKyAgICAgICAgICAgIHJldHVybiAqdGhpczsKKyAgICAgICAgfQorCisgICAgICAgIGlubGluZSBib29sIGlzVGV4dHVyaW5nKCkgY29uc3QgeyByZXR1cm4gKG1LZXkgJiBURVhUVVJFX01BU0spICE9IFRFWFRVUkVfT0ZGOyB9CisgICAgICAgIGlubGluZSBib29sIGhhc1RleHR1cmVDb29yZHMoKSBjb25zdCB7IHJldHVybiBpc1RleHR1cmluZygpICYmICFkcmF3U2hhZG93cygpOyB9CisgICAgICAgIGlubGluZSBpbnQgZ2V0VGV4dHVyZVRhcmdldCgpIGNvbnN0IHsgcmV0dXJuIChtS2V5ICYgVEVYVFVSRV9NQVNLKTsgfQorICAgICAgICBpbmxpbmUgYm9vbCBpc1ByZW11bHRpcGxpZWQoKSBjb25zdCB7IHJldHVybiAobUtleSAmIEJMRU5EX01BU0spID09IEJMRU5EX1BSRU1VTFQ7IH0KKyAgICAgICAgaW5saW5lIGJvb2wgaXNPcGFxdWUoKSBjb25zdCB7IHJldHVybiAobUtleSAmIE9QQUNJVFlfTUFTSykgPT0gT1BBQ0lUWV9PUEFRVUU7IH0KKyAgICAgICAgaW5saW5lIGJvb2wgaGFzQWxwaGEoKSBjb25zdCB7IHJldHVybiAobUtleSAmIEFMUEhBX01BU0spID09IEFMUEhBX0xUX09ORTsgfQorICAgICAgICBpbmxpbmUgYm9vbCBoYXNSb3VuZGVkQ29ybmVycygpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiAobUtleSAmIFJPVU5ERURfQ09STkVSU19NQVNLKSA9PSBST1VOREVEX0NPUk5FUlNfT047CisgICAgICAgIH0KKyAgICAgICAgaW5saW5lIGJvb2wgZHJhd1NoYWRvd3MoKSBjb25zdCB7IHJldHVybiAobUtleSAmIFNIQURPV19NQVNLKSA9PSBTSEFET1dfT047IH0KKyAgICAgICAgaW5saW5lIGJvb2wgaGFzSW5wdXRUcmFuc2Zvcm1NYXRyaXgoKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gKG1LZXkgJiBJTlBVVF9UUkFOU0ZPUk1fTUFUUklYX01BU0spID09IElOUFVUX1RSQU5TRk9STV9NQVRSSVhfT047CisgICAgICAgIH0KKyAgICAgICAgaW5saW5lIGJvb2wgaGFzT3V0cHV0VHJhbnNmb3JtTWF0cml4KCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIChtS2V5ICYgT1VUUFVUX1RSQU5TRk9STV9NQVRSSVhfTUFTSykgPT0gT1VUUFVUX1RSQU5TRk9STV9NQVRSSVhfT047CisgICAgICAgIH0KKyAgICAgICAgaW5saW5lIGJvb2wgaGFzVHJhbnNmb3JtTWF0cml4KCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIGhhc0lucHV0VHJhbnNmb3JtTWF0cml4KCkgfHwgaGFzT3V0cHV0VHJhbnNmb3JtTWF0cml4KCk7CisgICAgICAgIH0KKyAgICAgICAgaW5saW5lIGludCBnZXRJbnB1dFRGKCkgY29uc3QgeyByZXR1cm4gKG1LZXkgJiBJTlBVVF9URl9NQVNLKTsgfQorICAgICAgICBpbmxpbmUgaW50IGdldE91dHB1dFRGKCkgY29uc3QgeyByZXR1cm4gKG1LZXkgJiBPVVRQVVRfVEZfTUFTSyk7IH0KKworICAgICAgICAvLyBXaGVuIEhEUiBhbmQgbm9uLUhEUiBjb250ZW50cyBhcmUgbWl4ZWQsIG9yIGRpZmZlcmVudCB0eXBlcyBvZiBIRFIgY29udGVudHMgYXJlCisgICAgICAgIC8vIG1peGVkLCB3ZSB3aWxsIGRvIGEgdG9uZSBtYXBwaW5nIHByb2Nlc3MgdG8gdG9uZSBtYXAgdGhlIGlucHV0IGNvbnRlbnQgdG8gb3V0cHV0CisgICAgICAgIC8vIGNvbnRlbnQuIEN1cnJlbnRseSwgdGhlIGZvbGxvd2luZyBjb252ZXJzaW9ucyBoYW5kbGVkLCB0aGV5IGFyZToKKyAgICAgICAgLy8gKiBTRFIgLT4gSExHCisgICAgICAgIC8vICogU0RSIC0+IFBRCisgICAgICAgIC8vICogSExHIC0+IFBRCisgICAgICAgIGlubGluZSBib29sIG5lZWRzVG9uZU1hcHBpbmcoKSBjb25zdCB7CisgICAgICAgICAgICBpbnQgaW5wdXRURiA9IGdldElucHV0VEYoKTsKKyAgICAgICAgICAgIGludCBvdXRwdXRURiA9IGdldE91dHB1dFRGKCk7CisKKyAgICAgICAgICAgIC8vIFJldHVybiBmYWxzZSB3aGVuIGNvbnZlcnRpbmcgZnJvbSBTRFIgdG8gU0RSLgorICAgICAgICAgICAgaWYgKGlucHV0VEYgPT0gS2V5OjpJTlBVVF9URl9TUkdCICYmIG91dHB1dFRGID09IEtleTo6T1VUUFVUX1RGX0xJTkVBUikgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChpbnB1dFRGID09IEtleTo6SU5QVVRfVEZfTElORUFSICYmIG91dHB1dFRGID09IEtleTo6T1VUUFVUX1RGX1NSR0IpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlucHV0VEYgPj49IEtleTo6SU5QVVRfVEZfU0hJRlQ7CisgICAgICAgICAgICBvdXRwdXRURiA+Pj0gS2V5OjpPVVRQVVRfVEZfU0hJRlQ7CisgICAgICAgICAgICByZXR1cm4gaW5wdXRURiAhPSBvdXRwdXRURjsKKyAgICAgICAgfQorICAgICAgICBpbmxpbmUgYm9vbCBpc1k0MTBCVDIwMjAoKSBjb25zdCB7IHJldHVybiAobUtleSAmIFk0MTBfQlQyMDIwX01BU0spID09IFk0MTBfQlQyMDIwX09OOyB9CisKKyAgICAgICAgLy8gZm9yIHVzZSBieSBzdGQ6OnVub3JkZXJlZF9tYXAKKworICAgICAgICBib29sIG9wZXJhdG9yPT0oY29uc3QgS2V5JiBvdGhlcikgY29uc3QgeyByZXR1cm4gbUtleSA9PSBvdGhlci5tS2V5OyB9CisKKyAgICAgICAgc3RydWN0IEhhc2ggeworICAgICAgICAgICAgc2l6ZV90IG9wZXJhdG9yKCkoY29uc3QgS2V5JiBrZXkpIGNvbnN0IHsgcmV0dXJuIHN0YXRpY19jYXN0PHNpemVfdD4oa2V5Lm1LZXkpOyB9CisgICAgICAgIH07CisgICAgfTsKKworICAgIFByb2dyYW1DYWNoZSgpID0gZGVmYXVsdDsKKyAgICB+UHJvZ3JhbUNhY2hlKCkgPSBkZWZhdWx0OworCisgICAgLy8gR2VuZXJhdGUgc2hhZGVycyB0byBwb3B1bGF0ZSB0aGUgY2FjaGUKKyAgICB2b2lkIHByaW1lQ2FjaGUoY29uc3QgRUdMQ29udGV4dCBjb250ZXh0LCBib29sIHVzZUNvbG9yTWFuYWdlbWVudCwgYm9vbCB0b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d2luZyBibHVyIG1lc2giKTsKKyAgICByZXR1cm4gTk9fRVJST1I7Cit9CisKK3N0cmluZyBCbHVyRmlsdGVyOjpnZXRWZXJ0ZXhTaGFkZXIoKSBjb25zdCB7CisgICAgcmV0dXJuIFIiU0hBREVSKCN2ZXJzaW9uIDMxMCBlcworICAgICAgICBwcmVjaXNpb24gbWVkaXVtcCBmbG9hdDsKKworICAgICAgICBpbiB2ZWMyIGFQb3NpdGlvbjsKKyAgICAgICAgaW4gaGlnaHAgdmVjMiBhVVY7CisgICAgICAgIG91dCBoaWdocCB2ZWMyIHZVVjsKKworICAgICAgICB2b2lkIG1haW4oKSB7CisgICAgICAgICAgICB2VVYgPSBhVVY7CisgICAgICAgICAgICBnbF9Qb3NpdGlvbiA9IHZlYzQoYVBvc2l0aW9uLCAwLjAsIDEuMCk7CisgICAgICAgIH0KKyAgICApU0hBREVSIjsKK30KKworc3RyaW5nIEJsdXJGaWx0ZXI6OmdldEZyYWdtZW50U2hhZGVyKCkgY29uc3QgeworICAgIHJldHVybiBSIlNIQURFUigjdmVyc2lvbiAzMTAgZXMKKyAgICAgICAgcHJlY2lzaW9uIG1lZGl1bXAgZmxvYXQ7CisKKyAgICAgICAgdW5pZm9ybSBzYW1wbGVyMkQgdVRleHR1cmU7CisgICAgICAgIHVuaWZvcm0gdmVjMiB1T2Zmc2V0OworCisgICAgICAgIGluIGhpZ2hwIHZlYzIgdlVWOworICAgICAgICBvdXQgdmVjNCBmcmFnQ29sb3I7CisKKyAgICAgICAgdm9pZCBtYWluKCkgeworICAgICAgICAgICAgZnJhZ0NvbG9yICA9IHRleHR1cmUodVRleHR1cmUsIHZVViwgMC4wKTsKKyAgICAgICAgICAgIGZyYWdDb2xvciArPSB0ZXh0dXJlKHVUZXh0dXJlLCB2VVYgKyB2ZWMyKCB1T2Zmc2V0LngsICB1T2Zmc2V0LnkpLCAwLjApOworICAgICAgICAgICAgZnJhZ0NvbG9yICs9IHRleHR1cmUodVRleHR1cmUsIHZVViArIHZlYzIoIHVPZmZzZXQueCwgLXVPZmZzZXQueSksIDAuMCk7CisgICAgICAgICAgICBmcmFnQ29sb3IgKz0gdGV4dHVyZSh1VGV4dHVyZSwgdlVWICsgdmVjMigtdU9mZnNldC54LCAgdU9mZnNldC55KSwgMC4wKTsKKyAgICAgICAgICAgIGZyYWdDb2xvciArPSB0ZXh0dXJlKHVUZXh0dXJlLCB2VVYgKyB2ZWMyKC11T2Zmc2V0LngsIC11T2Zmc2V0LnkpLCAwLjApOworCisgICAgICAgICAgICBmcmFnQ29sb3IgPSB2ZWM0KGZyYWdDb2xvci5yZ2IgKiAwLjIsIDEuMCk7CisgICAgICAgIH0KKyAgICApU0hBREVSIjsKK30KKworc3RyaW5nIEJsdXJGaWx0ZXI6OmdldE1peEZyYWdTaGFkZXIoKSBjb25zdCB7CisgICAgc3RyaW5nIHNoYWRlciA9IFIiU0hBREVSKCN2ZXJzaW9uIDMxMCBlcworICAgICAgICBwcmVjaXNpb24gbWVkaXVtcCBmbG9hdDsKKworICAgICAgICBpbiBoaWdocCB2ZWMyIHZVVjsKKyAgICAgICAgb3V0IHZlYzQgZnJhZ0NvbG9yOworCisgICAgICAgIHVuaWZvcm0gc2FtcGxlcjJEIHVDb21wb3NpdGlvblRleHR1cmU7CisgICAgICAgIHVuaWZvcm0gc2FtcGxlcjJEIHVUZXh0dXJlOworICAgICAgICB1bmlmb3JtIGZsb2F0IHVNaXg7CisKKyAgICAgICAgdm9pZCBtYWluKCkgeworICAgICAgICAgICAgdmVjNCBibHVycmVkID0gdGV4dHVyZSh1VGV4dHVyZSwgdlVWKTsKKyAgICAgICAgICAgIHZlYzQgY29tcG9zaXRpb24gPSB0ZXh0dXJlKHVDb21wb3NpdGlvblRleHR1cmUsIHZVVik7CisgICAgICAgICAgICBmcmFnQ29sb3IgPSBtaXgoY29tcG9zaXRpb24sIGJsdXJyZWQsIHVNaXgpOworICAgICAgICB9CisgICAgKVNIQURFUiI7CisgICAgcmV0dXJuIHNoYWRlc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HNpemVfdCBtVmVydGV4U2l6ZTsKKyAgICBzaXplX3QgbVRleENvb3Jkc1NpemU7CisgICAgc2l6ZV90IG1Dcm9wQ29vcmRzU2l6ZTsKKyAgICBzaXplX3QgbVNoYWRvd0NvbG9yU2l6ZTsKKyAgICBzaXplX3QgbVNoYWRvd1BhcmFtc1NpemU7CisgICAgc2l6ZV90IG1TdHJpZGU7CisgICAgUHJpbWl0aXZlIG1QcmltaXRpdmU7CisgICAgc3RkOjp2ZWN0b3I8dWludDE2X3Q+IG1JbmRpY2VzOworICAgIHNpemVfdCBtSW5kZXhDb3VudDsKK307CisKK2NsYXNzIE1lc2g6OkJ1aWxkZXIgeworcHVibGljOgorICAgIEJ1aWxkZXImIHNldFByaW1pdGl2ZShQcmltaXRpdmUgcHJpbWl0aXZlKSB7CisgICAgICAgIG1QcmltaXRpdmUgPSBwcmltaXRpdmU7CisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICB9OworICAgIEJ1aWxkZXImIHNldFZlcnRpY2VzKHNpemVfdCB2ZXJ0ZXhDb3VudCwgc2l6ZV90IHZlcnRleFNpemUpIHsKKyAgICAgICAgbVZlcnRleENvdW50ID0gdmVydGV4Q291bnQ7CisgICAgICAgIG1WZXJ0ZXhTaXplID0gdmVydGV4U2l6ZTsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgIH07CisgICAgQnVpbGRlciYgc2V0VGV4Q29vcmRzKHNpemVfdCB0ZXhDb29yZHNTaXplKSB7CisgICAgICAgIG1UZXhDb29yZHNTaXplID0gdGV4Q29vcmRzU2l6ZTsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgIH07CisgICAgQnVpbGRlciYgc2V0Q3JvcENvb3JkcyhzaXplX3QgY3JvcENvb3Jkc1NpemUpIHsKKyAgICAgICAgbUNyb3BDb29yZHNTaXplID0gY3JvcENvb3Jkc1NpemU7CisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICB9OworICAgIEJ1aWxkZXImIHNldFNoYWRvd0F0d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V4dFByaW9yaXR5OworICAgIFJlbmRlckVuZ2luZTo6UmVuZGVyRW5naW5lVHlwZSByZW5kZXJFbmdpbmVUeXBlOworICAgIGJvb2wgcmVhbHRpbWU7CisKKyAgICBzdHJ1Y3QgQnVpbGRlcjsKKworcHJpdmF0ZToKKyAgICAvLyBtdXN0IGJlIGNyZWF0ZWQgYnkgQnVpbGRlciB2aWEgY29uc3RydWN0b3Igd2l0aCBmdWxsIGFyZ3VtZW50IGxpc3QKKyAgICBSZW5kZXJFbmdpbmVDcmVhdGlvbkFyZ3MoaW50IF9waXhlbEZvcm1hdCwgdWludDMyX3QgX2ltYWdlQ2FjaGVTaXplLCBib29sIF91c2VDb2xvck1hbmFnZW1lbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgX2VuYWJsZVByb3RlY3RlZENvbnRleHQsIGJvb2wgX3ByZWNhY2hlVG9uZU1hcHBlclNoYWRlck9ubHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgX3N1cHBvcnRzQmFja2dyb3VuZEJsdXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJlbmRlckVuZ2luZTo6Q29udGV4dFByaW9yaXR5IF9jb250ZXh0UHJpb3JpdHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJlbmRlckVuZ2luZTo6UmVuZGVyRW5naW5lVHlwZSBfcmVuZGVyRW5naW5lVHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBfcmVhbHRpbWUpCisgICAgICAgICAgOiBwaXhlbEZvcm1hdChfcGl4ZWxGb3JtYXQpLAorICAgICAgICAgICAgaW1hZ2VDYWNoZVNpemUoX2ltYWdlQ2FjaGVTaXplKSwKKyAgICAgICAgICAgIHVzZUNvbG9yTWFuYWdlbWVudChfdXNlQ29sb3JNYW5hZ2VtZW50KSwKKyAgICAgICAgICAgIGVuYWJsZVByb3RlY3RlZENvbnRleHQoX2VuYWJsZVByb3RlY3RlZEN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bmFibGVQcm90ZWN0ZWRDb250ZXh0KSB7CisgICAgICAgIHRoaXMtPmVuYWJsZVByb3RlY3RlZENvbnRleHQgPSBlbmFibGVQcm90ZWN0ZWRDb250ZXh0OworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorICAgIEJ1aWxkZXImIHNldFByZWNhY2hlVG9uZU1hcHBlclNoYWRlck9ubHkoYm9vbCBwcmVjYWNoZVRvbmVNYXBwZXJTaGFkZXJPbmx5KSB7CisgICAgICAgIHRoaXMtPnByZWNhY2hlVG9uZU1hcHBlclNoYWRlck9ubHkgPSBwcmVjYWNoZVRvbmVNYXBwZXJTaGFkZXJPbmx5OworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorICAgIEJ1aWxkZXImIHNldFN1cHBvcnRzQmFja2dyb3VuZEJsdXIoYm9vbCBzdXBwb3J0c0JhY2tncm91bmRCbHVyKSB7CisgICAgICAgIHRoaXMtPnN1cHBvcnRzQmFja2dyb3VuZEJsdXIgPSBzdXBwb3J0c0JhY2tncm91bmRCbHVyOworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorICAgIEJ1aWxkZXImIHNldENvbnRleHRQcmlvcml0eShSZW5kZXJFbmdpbmU6OkNvbnRleHRQcmlvcml0eSBjb250ZXh0UHJpb3JpdHkpIHsKKyAgICAgICAgdGhpcy0+Y29udGV4dFByaW9yaXR5ID0gY29udGV4dFByaW9yaXR5OworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorICAgIEJ1aWxkZXImIHNldFJlbmRlckVuZ2luZVR5cGUoUmVuZGVyRW5naW5lOjpSZW5kZXJFbmdpbmVUeXBlIHJlbmRlckVuZ2luZVR5cGUpIHsKKyAgICAgICAgdGhpcy0+cmVuZGVyRW5naW5lVHlwZSA9IHJlbmRlckVuZ2luZVR5cGU7CisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisgICAgQnVpbGRlciYgc2V0UmVhbHRpbWUoYm9vbCByZWFsdGltZSkgeworICAgICAgICB0aGlzLT5yZWFsdGltZSA9IHJlYWx0aW1lOworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorICAgIFJlbmRlckVuZ2luZUNyZWF0aW9uQXJncyBidWlsZCgpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIFJlbmRlckVuZ2luZUNyZWF0aW9uQXJncyhwaXhlbEZvcm1hdCwgaW1hZ2VDYWNoZVNpemUsIHVzZUNvbG9yTWFuYWdlbWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmFibGVQcm90ZWN0ZWRDb250ZXh0LCBwcmVjYWNoZVRvbmVNYXBwZXJTaGFkZXJPbmx5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1cHBvcnRzQmFja2dyb3VuZEJsdXIsIGNvbnRleHRQcmlvcml0eSwgcmVuZGVyRW5naW5lVHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFsdGltZSk7CisgICAgfQorCitwcml2YXRlOgorICAgIC8vIDEgbWVhbnMgUkdCQV84ODg4CisgICAgaW50IHBpeGVsRm9ybWF0ID0gMTsKKyAgICB1aW50MzJfdCBpbWFnZUNhY2hlU2l6ZSA9IDA7CisgICAgYm9vbCB1c2VDb2xvck1hbmFnZW1lbnQgPSB0cnVlOworICAgIGJvb2wgZW5hYmxlUHJvdGVjdGVkQ29udGV4dCA9IGZhbHNlOworICAgIGJvb2wgcHJlY2FjaGVUb25lTWFwcGVyU2hhZGVyT25seSA9IGZhbHNlOworICAgIGJvb2wgc3VwcG9ydHNCYWNrZ3JvdW5kQmx1ciA9IGZhbHNlOworICAgIFJlbmRlckVuZ2luZTo6Q29udGV4dFByaW9yaXR5IGNvbnRleHRQcmlvcml0eSA9IFJlbmRlckVuZ2luZTo6Q29udGV4dFByaW9yaXR5OjpNRURJVU07CisgICAgUmVuZGVyRW5naW5lOjpSZW5kZXJFbmdpbmVUeXBlIHJlbmRlckVuZ2luZVR5cGUgPSBSZW5kZXJFbmdpbmU6OlJlbmRlckVuZ2luZVR5cGU6OkdMRVM7CisgICAgYm9vbCByZWFsdGltZSA9IHRydWU7Cit9OworCitjbGFzcyBCaW5kTmF0aXZlQnVmZmVyQXNGcmFtZWJ1ZmZlciB7CitwdWJsaWM6CisgICAgQmluZE5hdGl2ZUJ1ZmZlckFzRnJhbWVidWZmZXIoUmVuZGVyRW5naW5lJiBlbmdpbmUsIEFOYXRpdmVXaW5kb3dCdWZmZXIqIGJ1ZmZlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBib29sIHVzZUZyYW1lYnVmZmVyQ2FjaGUpCisgICAgICAgICAgOiBtRW5naW5lKGVuZ2luZSksIG1GcmFtZWJ1ZmZlcihtRW5naW5lLmdldEZyYW1lYnVmZmVyRm9yRHJhd2luZygpKSwgbVN0YXR1cyhOT19FUlJPUikgeworICAgICAgICBtU3RhdHVzID0gbUZyYW1lYnVmZmVyLT5zZXROYXRpdmVXaW5kb3dCdWZmZXIoYnVmZmVyLCBtRW5naW5lLmlzUHJvdGVjdGVkKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VGcmFtZWJ1ZmZlckNhY2hlKQorICAgICAgICAgICAgICAgID8gbUVuZ2luZS5iaW5kRnJhbWVCdWZmZXIobUZyYW1lYnVmZmVyKQorICAgICAgICAgICAgICAgIDogTk9fTUVNT1JZOworICAgIH0KKyAgICB+QmluZE5hdGl2ZUJ1ZmZlckFzRnJhbWVidWZmZXIoKSB7CisgICAgICAgIG1GcmFtZWJ1ZmZlci0+c2V0TmF0aXZlV2luZG93QnVmZmVyKG51bGxwdHIsIGZhbHNlLCAvKmFyYml0cmFyeSovIHRydWUpOworICAgICAgICBtRW5naW5lLnVuYmluZEZyYW1lQnVmZmVyKG1GcmFtZWJ1ZmZlcik7CisgICAgfQorICAgIHN0YXR1c190IGdldFN0YXR1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WxzZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRQcmVjYWNoZVRvbmVNYXBwZXJTaGFkZXJPbmx5KGZhbHNlKQorICAgICAgICAgICAgICAgICAgICAgICAgLnNldFN1cHBvcnRzQmFja2dyb3VuZEJsdXIodHJ1ZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRDb250ZXh0UHJpb3JpdHkocmVuZGVyZW5naW5lOjpSZW5kZXJFbmdpbmU6OkNvbnRleHRQcmlvcml0eTo6TUVESVVNKQorICAgICAgICAgICAgICAgICAgICAgICAgLnNldFJlbmRlckVuZ2luZVR5cGUocmVuZGVyZW5naW5lOjpSZW5kZXJFbmdpbmU6OlJlbmRlckVuZ2luZVR5cGU6OkdMRVMpCisgICAgICAgICAgICAgICAgICAgICAgICAuYnVpbGQoKSk7CisgICAgfQorCisgICAgc3RhdGljIHZvaWQgVGVhckRvd25UZXN0U3VpdGUoKSB7CisgICAgICAgIC8vIFRoZSBvcmRlcmluZyBoZXJlIGlzIGltcG9ydGFudCAtIHNDdXJyZW50QnVmZmVyIG11c3QgbGl2ZSBsb25nZXIKKyAgICAgICAgLy8gdGhhbiBSZW5kZXJFbmdpbmUgdG8gYXZvaWQgYSBudWxsIHJlZmVyZW5jZSBvbiB0ZWFyLWRvd24uCisgICAgICAgIHNSRSA9IG51bGxwdHI7CisgICAgICAgIHNDdXJyZW50QnVmZmVyID0gbnVsbHB0cjsKKyAgICB9CisKKyAgICBzdGF0aWMgc3A8R3JhcGhpY0J1ZmZlcj4gYWxsb2NhdGVEZWZhdWx0QnVmZmVyKCkgeworICAgICAgICByZXR1cm4gbmV3IEdyYXBoaWNCdWZmZXIoREVGQVVMVF9ESVNQTEFZX1dJRFRILCBERUZBVUxUX0RJU1BMQVlfSEVJR0hULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSEFMX1BJWEVMX0ZPUk1BVF9SR0JBXzg4ODgsIDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICA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1cmVfb3V0XyIpOworICAgICAgICB9CisgICAgICAgIGZvciAodWludDMyX3QgdGV4TmFtZSA6IG1UZXhOYW1lcykgeworICAgICAgICAgICAgc1JFLT5kZWxldGVUZXh0dXJlcygxLCAmdGV4TmFtZSk7CisgICAgICAgICAgICBFWFBFQ1RfRkFMU0Uoc1JFLT5pc1RleHR1cmVOYW1lS25vd25Gb3JUZXN0aW5nKHRleE5hbWUpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd3JpdGVCdWZmZXJUb0ZpbGUoY29uc3QgY2hhciogYmFzZW5hbWUpIHsKKyAgICAgICAgc3RkOjpzdHJpbmcgZmlsZW5hbWUoYmFzZW5hbWUpOworICAgICAgICBmaWxlbmFtZS5hcHBlbmQoOjp0ZXN0aW5nOjpVbml0VGVzdDo6R2V0SW5zdGFuY2UoKS0+Y3VycmVudF90ZXN0X2luZm8oKS0+bmFtZSgpKTsKKyAgICAgICAgZmlsZW5hbWUuYXBwZW5kKCIucHBtIik7CisgICAgICAgIHN0ZDo6b2ZzdHJlYW0gZmlsZShmaWxlbmFtZS5jX3N0cigpLCBzdGQ6Omlvczo6YmluYXJ5KTsKKyAgICAgICAgaWYgKCFmaWxlLmlzX29wZW4oKSkgeworICAgICAgICAgICAgQUxPR0UoIlVuYWJsZSB0byBvcGVuIGZpbGU6ICVzIiwgZmlsZW5hbWUuY19zdHIoKSk7CisgICAgICAgICAgICBBTE9HRSgiWW91IG1heSBuZWVkIHRvIGRvOiBcImFkYiBzaGVsbCBzZXRlbmZvcmNlIDBcIiB0byBlbmFibGUgIgorICAgICAgICAgICAgICAgICAgInN1cmZhY2VmbGluZ2VyIHRvIHdyaXRlIGRlYnVnIGltYWdlcyIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgdWludDhfdCogcGl4ZWxzOworICAgICAgICBtQnVmZmVyLT5sb2NrKEdSQUxMT0NfVVNBR0VfU1dfUkVBRF9PRlRFTiB8IEdSQUxMT0NfVVNBR0VfU1dfV1JJVEVfT0ZURU4sCisgICAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDx2b2lkKio+KCZwaXhlbHMpKTsKKworICAgICAgICBmaWxlIDw8ICJQNlxuIjsKKyAgICAgICAgZmlsZSA8PCBtQnVmZmVyLT5nZXRXaWR0aCgpIDw8ICJcbiI7CisgICAgICAgIGZpbGUgPDwgbUJ1ZmZlci0+Z2V0SGVpZ2h0KCkgPDwgIlxuIjsKKyAgICAgICAgZmlsZSA8PCAyNTUgPDwgIlxuIjsKKworICAgICAgICBzdGQ6OnZlY3Rvcjx1aW50OF90PiBvdXRCdWZmZXIobUJ1ZmZlci0+Z2V0V2lkdGgoKSAqIG1CdWZmZXItPmdldEhlaWdodCgpICogMyk7CisgICAgICAgIGF1dG8gb3V0UHRyID0gcmVpbnRlcnByZXRfY2FzdDx1aW50OF90Kj4ob3V0QnVmZmVyLmRhdGEoKSk7CisKKyAgICAgICAgZm9yICh1aW50MzJfdCBqID0gMDsgaiA8IG1CdWZmZXItPmdldEhlaWdodCgpOyBqKyspIHsKKyAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QqIHNyYyA9IHBpeGVscyArIChtQnVmZmVyLT5nZXRTdHJpZGUoKSAqIGopICogNDsKKyAgICAgICAgICAgIGZvciAodWludDMyX3QgaSA9IDA7IGkgPCBtQnVmZmVyLT5nZXRXaWR0aCgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICAvLyBPbmx5IGNvcHkgUiwgRyBhbmQgQiBjb21wb25lbnRzCisgICAgICAgICAgICAgICAgb3V0UHRyWzBdID0gc3JjWzBdOworICAgICAgICAgICAgICAgIG91dFB0clsxXSA9IHNyY1sxXTsKKyAgICAgICAgICAgICAgICBvdXRQdHJbMl0gPSBzcmNbMl07CisgICAgICAgICAgICAgICAgb3V0UHRyICs9IDM7CisKKyAgICAgICAgICAgICAgICBzcmMgKz0gNDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBmaWxlLndyaXRlKHJlaW50ZXJwcmV0X2Nhc3Q8Y2hhcio+KG91dEJ1ZmZlci5kYXRhKCkpLCBvdXRCdWZmZXIuc2l6ZSgpKTsKKyAgICAgICAgbUJ1ZmZlci0+dW5sb2NrKCk7CisgICAgfQorCisgICAgdm9pZCBleHBlY3RCdWZmZXJDb2xvcihjb25zdCBSZWdpb24mIHJlZ2lvbiwgdWludDhfdCByLCB1aW50OF90IGcsIHVpbnQ4X3QgYiwgdWludDhfdCBhKSB7CisgICAgICAgIHNpemVfdCBjOworICAgICAgICBSZWN0IGNvbnN0KiByZWN0ID0gcmVnaW9uLmdldEFycmF5KCZjKTsKKyAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBjOyBpKyssIHJlY3QrKykgeworICAgICAgICAgICAgZXhwZWN0QnVmZmVyQ29sb3IoKnJlY3QsIHIsIGcsIGIsIGEpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCBleHBlY3RCdWZmZXJDb2xvcihjb25zdCBSZWN0JiByZWN0LCB1aW50OF90IHIsIHVpbnQ4X3QgZywgdWludDhfdCBiLCB1aW50OF90IGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50OF90IHRvbGVyYW5jZSA9IDApIHsKKyAgICAgICAgYXV0byBjb2xvckNvbXBhcmUgPSBbdG9sZXJhbmNlXShjb25zdCB1aW50OF90KiBjb2xvckEsIGNvbnN0IHVpbnQ4X3QqIGNvbG9yQikgeworICAgICAgICAgICAgYXV0byBjb2xvckJpdENvbXBhcmUgPSBbdG9sZXJhbmNlXSh1aW50OF90IGEsIHVpbnQ4X3QgYikgeworICAgICAgICAgICAgICAgIHVpbnQ4X3QgdG1wID0gYSA+PSBiID8gYSAtIGIgOiBiIC0gYTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdG1wIDw9IHRvbGVyYW5jZTsKKyAgICAgICAgICAgIH07CisgICAgICAgICAgICByZXR1cm4gc3RkOjplcXVhbChjb2xvckEsIGNvbG9yQSArIDQsIGNvbG9yQiwgY29sb3JCaXRDb21wYXJlKTsKKyAgICAgICAgfTsKKworICAgICAgICBleHBlY3RCdWZmZXJDb2xvcihyZWN0LCByLCBnLCBiLCBhLCBjb2xvckNvbXBhcmUpOworICAgIH0KKworICAgIHZvaWQgZXhwZWN0QnVmZmVyQ29sb3IoY29uc3QgUmVjdCYgcmVnaW9uLCB1aW50OF90IHIsIHVpbnQ4X3QgZywgdWludDhfdCBiLCB1aW50OF90IGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OmZ1bmN0aW9uPGJvb2woY29uc3QgdWludDhfdCogYSwgY29uc3QgdWludDhfdCogYik+IGNvbG9yQ29tcGFyZSkgeworICAgICAgICB1aW50OF90KiBwaXhlbHM7CisgICAgICAgIG1CdWZmZXItPmxvY2soR1JBTExPQ19VU0FHRV9TV19SRUFEX09GVEVOIHwgR1JBTExPQ19VU0FHRV9TV19XUklURV9PRlRFTiwKKyAgICAgICAgICAgICAgICAgICAgICByZWludGVycHJldF9jYXN0PHZvaWQqKj4oJnBpeGVscykpOworICAgICAgICBpbnQzMl90IG1heEZhaWxzID0gMTA7CisgICAgICAgIGludDMyX3QgZmFpbHMgPSAwOworICAgICAgICBmb3IgKGludDMyX3QgaiA9IDA7IGogPCByZWdpb24uZ2V0SGVpZ2h0KCk7IGorKykgeworICAgICAgICAgICAgY29uc3QgdWludDhfdCogc3JjID0KKyAgICAgICAgICAgICAgICAgICAgcGl4ZWxzICsgKG1CdWZmZXItPmdldFN0cmlkZSgpICogKHJlZ2lvbi50b3AgKyBqKSArIHJlZ2lvbi5sZWZ0KSAqIDQ7CisgICAgICAgICAgICBmb3IgKGludDMyX3QgaSA9IDA7IGkgPCByZWdpb24uZ2V0V2lkdGgoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCBleHBlY3RlZFs0XSA9IHtyLCBnLCBiLCBhfTsKKyAgICAgICAgICAgICAgICBib29sIGVxdWFsID0gY29sb3JDb21wYXJlKHNyYywgZXhwZWN0ZWQpOworICAgICAgICAgICAgICAgIEVYUEVDVF9UUlVFKGVxdWFsKQorICAgICAgICAgICAgICAgICAgICAgICAgPDwgInBpeGVsIEAgKCIgPDwgcmVnaW9uLmxlZnQgKyBpIDw8ICIsICIgPDwgcmVnaW9uLnRvcCArIGogPDwgIik6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICJleHBlY3RlZCAoIiA8PCBzdGF0aWNfY2FzdDx1aW50MzJfdD4ocikgPDwgIiwgIgorICAgICAgICAgICAgICAgICAgICAgICAgPDwgc3RhdGljX2Nhc3Q8dWludDMyX3Q+KGcpIDw8ICIsICIgPDwgc3RhdGljX2Nhc3Q8dWludDMyX3Q+KGIpIDw8ICIsICIKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8IHN0YXRpY19jYXN0PHVpbnQzMl90PihhKSA8PCAiKSwgIgorICAgICAgICAgICAgICAgICAgICAgICAgPDwgImdvdCAoIiA8PCBzdGF0aWNfY2FzdDx1aW50MzJfdD4oc3JjWzBdKSA8PCAiLCAiCisgICAgICAgICAgICAgICAgICAgICAgICA8PCBzdGF0aWNfY2FzdDx1aW50MzJfdD4oc3JjWzFdKSA8PCAiLCAiIDw8IHN0YXRpY19jYXN0PHVpbnQzMl90PihzcmNbMl0pCisgICAgICAgICAgICAgICAgICAgICAgICA8PCAiLCAiIDw8IHN0YXRpY19jYXN0PHVpbnQzMl90PihzcmNbM10pIDw8ICIpIjsKKyAgICAgICAgICAgICAgICBzcmMgKz0gNDsKKyAgICAgICAgICAgICAgICBpZiAoIWVxdWFsICYmICsrZmFpbHMgPj0gbWF4RmFpbHMpIHsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGZhaWxzID49IG1heEZhaWxzKSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH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gIHN0YXRpYyByZW5kZXJlbmdpbmU6OlNoYWRvd1NldHRpbmdzIGdldFNoYWRvd1NldHRpbmdzKGNvbnN0IHZlYzImIGNhc3RlclBvcywgZmxvYXQgc2hhZG93TGVuZ3RoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgY2FzdGVySXNUcmFuc2x1Y2VudCkgeworICAgICAgICByZW5kZXJlbmdpbmU6OlNoYWRvd1NldHRpbmdzIHNoYWRvdzsKKyAgICAgICAgc2hhZG93LmFtYmllbnRDb2xvciA9IHswLjBmLCAwLjBmLCAwLjBmLCAwLjAzOWZ9OworICAgICAgICBzaGFkb3cuc3BvdENvbG9yID0gezAuMGYsIDAuMGYsIDAuMGYsIDAuMTlmfTsKKyAgICAgICAgc2hhZG93LmxpZ2h0UG9zID0gdmVjMyhjYXN0ZXJQb3MueCwgY2FzdGVyUG9zLnksIDApOworICAgICAgICBzaGFkb3cubGlnaHRSYWRpdXMgPSAwLjBmOworICAgICAgICBzaGFkb3cubGVuZ3RoID0gc2hhZG93TGVuZ3RoOworICAgICAgICBzaGFkb3cuY2FzdGVySXNUcmFuc2x1Y2VudCA9IGNhc3RlcklzVHJhbnNsdWNlbnQ7CisgICAgICAgIHJldHVybiBzaGFkb3c7CisgICAgfQorCisgICAgc3RhdGljIFJlY3QgZnVsbHNjcmVlblJlY3QoKSB7IHJldHVybiBSZWN0KERFRkFVTFRfRElTUExBWV9XSURUSCwgREVGQVVMVF9ESVNQTEFZX0hFSUdIVCk7IH0KKworICAgIHN0YXRpYyBSZWN0IG9mZnNldFJlY3QoKSB7CisgICAgICAgIHJldHVybiBSZWN0KERFRkFVTFRfRElTUExBWV9PRkZTRVQsIERFRkFVTFRfRElTUExBWV9PRkZTRVQsIERFRkFVTFRfRElTUExBWV9XSURUSCwKKyAgICAgICAgICAgICAgICAgICAgREVGQVVMVF9ESVNQTEFZX0hFSUdIVCk7CisgICAgfQorCisgICAg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gICAgICAgICAgICAgICAwLCAyNTUsIDAsIDI1NSk7Cit9CisKK3RlbXBsYXRlIDx0eXBlbmFtZSBTb3VyY2VWYXJpYW50Pgordm9pZCBSZW5kZXJFbmdpbmVUZXN0OjpmaWxsQnVmZmVyQ2hlY2tlcnNSb3RhdGU5MCgpIHsKKyAgICBmaWxsQnVmZmVyQ2hlY2tlcnM8U291cmNlVmFyaWFudD4odWk6OlRyYW5zZm9ybTo6Uk9UXzkwKTsKKyAgICBleHBlY3RCdWZmZXJDb2xvcihSZWN0KDAsIDAsIERFRkFVTFRfRElTUExBWV9XSURUSCAvIDIsIERFRkFVTFRfRElTUExBWV9IRUlHSFQgLyAyKSwgMCwgMjU1LCAwLAorICAgICAgICAgICAgICAgICAgICAgIDI1NSk7CisgICAgZXhwZWN0QnVmZmVyQ29sb3IoUmVjdChERUZBVUxUX0RJU1BMQVlfV0lEVEggLyAyLCAwLCBERUZBVUxUX0RJU1BMQVlfV0lEVEgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBERUZBVUxUX0RJU1BMQVlfSEVJR0hUIC8gMiksCisgICAgICAgICAgICAgICAgICAgICAgMjU1LCAwLCAwLCAyNTUpOworICAgIGV4cGVjdEJ1ZmZlckNvbG9yKFJlY3QoREVGQVVMVF9ESVNQTEFZX1dJRFRIIC8gMiwgREVGQVVMVF9ESVNQTEFZX0hFSUdIVCAvIDIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBERUZBVUxUX0RJU1BMQVlfV0lEVEgsIERFRkFVTFRfRElTUExBWV9IRUlHSFQpLAorICAgICAgICAgICAgICAgICAgICAgIDAsIDAsIDI1NSwgMjU1KTsKKyAgICBleHBlY3RCdWZmZXJDb2xvcihSZWN0KDAsIERFRkFVTFRfRElTUExBWV9IRUlHSFQgLyAyLCBERUZBVUxUX0RJU1BMQVlfV0lEVEggLyAyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgREVGQVVMVF9ESVNQTEFZX0hFSUdIVCksCisgICAgICAgICA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JR0hUIC8gMyArIDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBERUZBVUxUX0RJU1BMQVlfV0lEVEgsIERFRkFVTFRfRElTUExBWV9IRUlHSFQpLAorICAgICAgICAgICAgICAgICAgICAgIDAsIDAsIDAsIDApOworCisgICAgc3RkOjp2ZWN0b3I8Y29uc3QgcmVuZGVyZW5naW5lOjpMYXllclNldHRpbmdzKj4gbGF5ZXJzU2Vjb25kOworICAgIHJlbmRlcmVuZ2luZTo6TGF5ZXJTZXR0aW5ncyBsYXllclR3bzsKKyAgICBsYXllclR3by5nZW9tZXRyeS5ib3VuZGFyaWVzID0KKyAgICAgICAgICAgIEZsb2F0UmVjdChERUZBVUxUX0RJU1BMQVlfV0lEVEggLyAzLjAsIERFRkFVTFRfRElTUExBWV9IRUlHSFQgLyAzLjAsCisgICAgICAgICAgICAgICAgICAgICAgREVGQVVMVF9ESVNQTEFZX1dJRFRILCBERUZBVUxUX0RJU1BMQVlfSEVJR0hUKTsKKyAgICBTb3VyY2VWYXJpYW50OjpmaWxsQ29sb3IobGF5ZXJUd28sIDAuMGYsIDEuMGYsIDAuMGYsIHRoaXMpOworICAgIGxheWVyVHdvLmFscGhhID0gMS4wZjsKKworICAgIGxheWVyc1NlY29uZC5wdXNoX2JhY2soJmxheWVyVHdvKTsKKyAgICBpbnZva2VEcmF3KHNldHRpbmdzLCBsYXllcnNTZWNvbmQsIG1CdWZmZXIpOworCisgICAgZXhwZWN0QnVmZmVyQ29sb3IoUmVjdChERUZBVUxUX0RJU1BMQVlfV0lEVEggLyAzLCBERUZBVUxUX0RJU1BMQVlfSEVJR0hUIC8gMyksIDAsIDAsIDAsIDApOworICAgIGV4cGVjdEJ1ZmZlckNvbG9yKFJlY3QoREVGQVVMVF9ESVNQTEFZX1dJRFRIIC8gMyArIDEsIERFRkFVTFRfRElTUExBWV9IRUlHSFQgLyAzICsgMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIERFRkFVTFRfRElTUExBWV9XSURU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ltYWdlTWFuYWdlcjo6QmFycmllcj4gYmFycmllciA9CisgICAgICAgICAgICBzUkUtPmNhY2hlRXh0ZXJuYWxUZXh0dXJlQnVmZmVyRm9yVGVzdGluZyhidWYpOworICAgIHsKKyAgICAgICAgc3RkOjpsb2NrX2d1YXJkPHN0ZDo6bXV0ZXg+IGxvY2soYmFycmllci0+bXV0ZXgpOworICAgICAgICBBU1NFUlRfVFJVRShiYXJyaWVyLT5jb25kaXRpb24ud2FpdF9mb3IoYmFycmllci0+bXV0ZXgsIHN0ZDo6Y2hyb25vOjpzZWNvbmRzKDUpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyZdKCkgUkVRVUlSRVMoYmFycmllci0+bXV0ZXgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYmFycmllci0+aXNPcGVuOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOworICAgICAgICBFWFBFQ1RfRVEoTk9fRVJST1IsIGJhcnJpZXItPnJlc3VsdCk7CisgICAgfQorICAgIEVYUEVDVF9UUlVFKHNSRS0+aXNJbWFnZUNhY2hlZEZvclRlc3RpbmcoYnVmZmVySWQpKTsKKyAgICBiYXJyaWVyID0gc1JFLT51bmJpbmRFeHRlcm5hbFRleHR1cmVCdWZmZXJGb3JUZXN0aW5nKGJ1ZmZlcklkKTsKKyAgICB7CisgICAgICAgIHN0ZDo6bG9ja19ndWFyZDxzdGQ6Om11dGV4PiBsb2NrKGJhcnJpZXItPm11dGV4KTsKKyAgICAgICAgQVNTRVJUX1RSVUUoYmFycmllci0+Y29uZGl0aW9uLndhaXRfZm9yKGJhcnJpZXItPm11dGV4LCBzdGQ6OmNocm9ubzo6c2Vjb25kcyg1KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsmXSgpIFJFUVVJUkVTKGJ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aXN0PHNwPEFCdWZmZXI+PiAqcXVldWUgPSBzb3VyY2UtPnF1ZXVlKCk7CisgICAgaW50MzJfdCBuYWNrQ291bnQgPSAwOworCisgICAgTGlzdDxzcDxBQnVmZmVyPiA+OjppdGVyYXRvciBpdCA9IHF1ZXVlLT5iZWdpbigpOworCisgICAgaWYgKGl0ID09IHF1ZXVlLT5lbmQoKSkgeworICAgICAgICByZXR1cm4gbmFja0NvdW50IC8qIDAgKi87CisgICAgfQorCisgICAgdWludDE2X3QgcXVldWVIZWFkU2VxTnVtID0gKCppdCktPmludDMyRGF0YSgpOworCisgICAgLy8gbW92ZSB0byB0aGUgcGFja2V0IGFmdGVyIHdoaWNoIFJUQ1A6TkFDSyB3YXMgc2VudC4KKyAgICBmb3IgKDsgaXQgIT0gcXVldWUtPmVuZCgpOyArK2l0KSB7CisgICAgICAgIGludDMyX3Qgc2VxTnVtID0gKCppdCktPmludDMyRGF0YSgpOworICAgICAgICBpZiAoc2VxTnVtID49IHNvdXJjZS0+bUhpZ2hlc3ROYWNrTnVtYmVyKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIGludDMyX3QgbmFja1N0YXJ0QXQgPSAtMTsKKworICAgIHdoaWxlIChpdCAhPSBxdWV1ZS0+ZW5kKCkpIHsKKyAgICAgICAgaW50MzJfdCBzZXFCZWZvcmVMYXN0ID0gKCppdCktPmludDMyRGF0YSgpOworICAgICAgICAvLyBpbmNyZWFzZSBpdGVyYXRvci4KKyAgICAgICAgaWYgKCgrK2l0KSA9PSBxdWV1ZS0+ZW5kKCkpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGludDMyX3Qgc2VxTGFzdCA9ICgqaXQpLT5pbnQzMkRhdGEoKTsKKworICAgICAgICBpZiAoKHNlcUxhc3QgLSBzZXFCZWZvcmVMYXN0KSA8IDApIHsKKyAgICAgICAgICAgIEFMT0dEKCJhZGROYWNrOiBmb3VuZCBlbmQgb2Ygc2VxTnVtIGZyb20oJWQpIHRvKCVkKSIsIHNlcUJlZm9yZUxhc3QsIHNlcUxhc3QpOworICAgICAgICAgICAgc291cmNlLT5tSGlnaGVzdE5hY2tOdW1iZXIgPSAwOworICAgICAgICB9CisKKyAgICAgICAgLy8gbWlzc2VkIHBhY2tldCBmb3VuZAorICAgICAgICBpZiAoc2VxTGFzdCA+IChzZXFCZWZvcmVMYXN0ICsgMSkgJiYKKyAgICAgICAgICAgICAgICAvLyB3ZSBkaWRuJ3Qgc2VuZCBSVENQOk5BQ0sgZm9yIHRoaXMgcGFja2V0IHlldC4KKyAgICAgICAgICAgICAgICAoc2VxTGFzdCAtIDEpID4gc291cmNlLT5tSGlnaGVzdE5hY2tOdW1iZXIpIHsKKyAgICAgICAgICAgIHNvdXJjZS0+bUhpZ2hlc3ROYWNrTnVtYmVyID0gc2VxTGFzdCAtIDE7CisgICAgICAgICAgICBuYWNrU3RhcnRBdCA9IHNlcUJlZm9yZUxhc3QgKyAxOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgIH0KKworICAgIGlmIChuYWNrU3RhcnRBdCAhPSAtMSkgeworICAgICAgICBuYWNrQ291bnQgPSBzb3VyY2UtPm1IaWdoZXN0TmFja051bWJlciAtIG5hY2tTdGFydEF0ICsgMTsKKyAgICAgICAgQUxPR0QoImFkZE5hY2s6IG5hY2tDb3VudD0lZCwgbmFja0Zyb209JWQsIG5hY2tUbz0lZCIsIG5hY2tDb3VudCwKKyAgICAgICAgICAgICAgICBuYWNrU3RhcnRBdCwgc291cmNlLT5tSGlnaGVzdE5hY2tOdW1iZXIpOworCisgICAgICAgIHVpbnQxNl90IG1hc2sgPSAodWludDE2X3QpKDB4ZmZmZikgPj4gKDE2IC0gbmFja0NvdW50ICsgMSk7CisgICAgICAgIHNvdXJjZS0+c2V0U2VxTnVtVG9OQUNLKG5hY2tTdGFydEF0LCBtYXNrLCBxdWV1ZUhlYWRTZXFOdW0pOworICAgIH0KKworICAg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0IGFuIGFsYXJtIGZvciBqaXR0ZXIgYnVmZmVyIHRpbWUgZXhwaXJhdGlvbi4KKyAgICAgICAgLy8gYWRkaW5nIDFtcyBiZWNhdXNlIGppdHRlciBidWZmZXIgdGltZSBpcyBrZWVwIGNoYW5naW5nLgorICAgICAgICBpbnQ2NF90IGV4cFRpbWVVcyA9IChSdHBUb01zKHN0ZDo6YWJzKGRpZmZUaW1lUnRwKSwgY2xvY2tSYXRlKSArIDEpICogMTAwMDsKKyAgICAgICAgc291cmNlLT5zZXRKYkFsYXJtVGltZShub3dUaW1lVXMsIGV4cFRpbWVVcyk7CisgICAgICAgIHJldHVybiBOT1RfRU5PVUdIX0RBVEE7CisgICAgfQorCisgICAgaWYgKGlzRmlyc3RMaW5lQnJva2VuKSB7CisgICAgICAgIGludDY0X3QgdG90YWxEaWZmVGltZU1zID0gUnRwVG9NcyhkaWZmVGltZVJ0cCArIGppdHRlclRpbWVSdHAsIGNsb2NrUmF0ZSk7CisgICAgICAgIFN0cmluZzggaW5mbzsKKyAgICAgICAgaW5mby5hcHBlbmRGb3JtYXQoIlJUUCBkaWZmIGZyb20gZXhwID0lbGxkIFx0IE1TIGRpZmYgZnJvbSBzdGFtcCA9ICVsbGRcdFx0IgorICAgICAgICAgICAgICAgICAgICAiU2VxIyAlZCBcdCBFeHBTZXEjICVkIFx0IgorICAgICAgICAgICAgICAgICAgICAiSml0dGVyTXMgJWQgKyAoJWQgKyAlZCAqICUuM2YpIiwKKyAgICAgICAgICAgICAgICAgICAgKGxvbmcgbG9uZylkaWZmVGltZVJ0cCwgKGxvbmcgbG9uZyl0b3RhbERpZmZUaW1lTXMsCisgICAgICAgICAgICAgICAgICAgIGJ1ZmZlci0+aW50MzJEYXRhKCksIG1OZXh0RXhwZWN0ZWRTZXFObywKKyAgICAgICAgICAgICAgICAgICAgaml0dGVyVGltZU1zLCB0cnlKYlRpbWVNcywgZHluYW1pY0piVGltZU1zLCBKSVRURVJfTVVMVElQTEUpOworICAgICAgICB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0KCk7CiAgICAgfQpAQCAtMjE2LDYgKzQ0OCwxMCBAQAogICAgIHNpemVfdCB0b3RhbENvdW50ID0gMTsKICAgICBib29sIGNvbXBsZXRlID0gZmFsc2U7CiAKKyAgICB1aW50MzJfdCBydHBUaW1lU3RhcnRBdDsKKyAgICBDSEVDSyhidWZmZXItPm1ldGEoKS0+ZmluZEludDMyKCJydHAtdGltZSIsIChpbnQzMl90ICopJnJ0cFRpbWVTdGFydEF0KSk7CisgICAgdWludDMyX3Qgc3RhcnRTZXFObyA9IGJ1ZmZlci0+aW50MzJEYXRhKCk7CisKICAgICBpZiAoZGF0YVsxXSAmIDB4NDApIHsKICAgICAgICAgLy8gSHVoPyBFbmQgYml0IGFsc28gc2V0IG9uIHRoZSBmaXJzdCBidWZmZXIuCiAKQEAgLTIzMywzNCArNDY5LDMzIEBACiAgICAgICAgICAgICBzaXplX3Qgc2l6ZSA9IGJ1ZmZlci0+c2l6ZSgpOwogCiAgICAgICAgICAgICBpZiAoKHVpbnQzMl90KWJ1ZmZlci0+aW50MzJEYXRhKCkgIT0gZXhwZWN0ZWRTZXFObykgewotICAgICAgICAgICAgICAgIEFMT0dWKCJzZXF1ZW5jZSBub3QgY29tcGxldGUsIGV4cGVjdGVkIHNlcU5vICVkLCBnb3QgJWQiLAotICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRTZXFObywgKHVpbnQzMl90KWJ1ZmZlci0+aW50MzJEYXRhKCkpOwotCi0gICAgICAgICAgICAgICAgcmV0dXJuIFdST05HX1NFUVVFTkNFX05VTUJFUjsKKyAgICAgICAgICAgICAgICBBTE9HRCgic2VxdWVuY2Ugbm90IGNvbXBsZXRlLCBleHBlY3RlZCBzZXFObyAldSwgZ290ICV1LCBuYWxUeXBlICV1IiwKKyAgICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkU2VxTm8sICh1aW50MzJfdClidWZmZXItPmludDMyRGF0YSgpLCBuYWxUeXBlKTsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgaWYgKHNpemUgPCAyCi0gICAgICAgICAgICAgICAgICAgIHx8IGRhdGFbMF0gIT0gaW5kaWNhdG9yCi0gICAgICAgICAgICAgICAgICAgIHx8IChkYXRhWzFdICYgMHgxZikgIT0gbmFsVHlwZQotICAgICAgICAgICAgICAgICAgICB8fCAoZGF0YVsxXSAmIDB4ODApKSB7CisgICAgICAgICAgICB1aW50MzJfdCBydHBUaW1lOworICAgICAgICAgICAgQ0hFQ0soYnVmZmVyLT5tZXRhKCktPmZpbmRJbnQzMigicnRwLXRpbWUiLCAoaW50MzJfdCAqKSZydHBUaW1lKSk7CisgICAgICAgICAgICBpZiAoc2l6ZSA8IDIpIHsKICAgICAgICAgICAgICAgICBBTE9HVigiSWdub3JpbmcgbWFsZm9ybWVkIEZVIGJ1ZmZlci4iKTsKLQotICAgICAgICAgICAgICAgIC8vIERlbGV0ZSB0aGUgd2hvbGUgc3RhcnQgb2YgdGhlIEZVLgotCi0gICAgICAgICAgICAgICAgaXQgPSBxdWV1ZS0+YmVnaW4oKTsKLSAgICAgICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8PSB0b3RhbENvdW50OyArK2kpIHsKLSAgICAgICAgICAgICAgICAgICAgaXQgPSBxdWV1ZS0+ZXJhc2UoaXQpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIG1OZXh0RXhwZWN0ZWRTZXFObyA9IGV4cGVjdGVkU2VxTm8gKyAxOwotCi0gICAgICAgICAgICAgICAgcmV0dXJuIE1BTEZPUk1FRF9QQUNLRVQ7CisgICAgICAgICAgICAgICAgaXQgPSBxdWV1ZS0+ZXJhc2UoaXQpOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGRhdGFbMF0gIT0gaW5kaWNhdG9yCisgICAgICAgICAgICAgICAgICAgIHx8IChkYXRhWzFdICYgMHgxZikgIT0gbmFsVHlwZQorICAgICAgICAgICAgICAgICAgICB8fCAoZGF0YVsxXSAmIDB4ODApCisgICAgICAgICAgICAgICAgICAgIHx8IHJ0cFRpbWUgIT0gcnRwVGltZVN0YXJ0QXQpIHsKKyAgICAgICAgICAgICAgICAvLyBBc3NlbWJsZXIgYWxyZWFkeSBoYXZlIGdpdmVuIGVub3VnaCB0aW1lIGJ5IGppdHRlciBidWZmZXIKKyAgICAgICAgICAgICAgICBBTE9HRCgiU2VlbXMgYW5vdGhlciBmcmFtZS4gSW5jb21wbGV0ZSBmcmFtZSBbJWQgfiAlZCkgXHQgJWQgRlVzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0U2VxTm8sIGV4cGVjdGVkU2VxTm8sIChpbnQpcXVldWUtPmRpc3RhbmNlKHF1ZXVlLT5iZWdpbigpLCBpdCkpOworICAgICAgICAgICAgICAgIGV4cGVjdGVkU2VxTm8gPSAodWludDMyX3QpYnVmZmVyLT5pbnQzMkRhdGEoKTsKKyAgICAgICAgICAgICAgICBjb21wbGV0ZSA9IHRydWU7CisgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIHRvdGFsU2l6ZSArPSBzaXplIC0gMjsKICAgICAgICAgICAgICsrdG90YWxDb3VudDsKIAotICAgICAgICAgICAgZXhwZWN0ZWRTZXFObyA9IGV4cGVjdGVkU2VxTm8gKyAxOworICAgICAgICAgICAgZXhwZWN0ZWRTZXFObyA9ICh1aW50MzJfdClidWZmZXItPmludDMyRGF0YSgpICsgMTsKIAogICAgICAgICAgICAgaWYgKGRhdGFbMV0gJiAweDQwKSB7CiAgICAgICAgICAgICAgICAgLy8gVGhpcyBpcyB0aGUgbGFzdCBmcmFnbWVudC4KQEAgLTI5MCw2ICs1MjUsOCBAQAogICAgIHVuaXQtPmRhdGEoKVswXSA9IChucmkgPDwgNSkgfCBuYWxUeXBlOwogCiAgICAgc2l6ZV90IG9mZnNldCA9IDE7CisgICAgaW50MzJfdCBjdm8gPSAtMTsKKyAg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VEE7CisgICAgfQorCisgICAgaWYgKGlzRmlyc3RMaW5lQnJva2VuKSB7CisgICAgICAgIGludDY0X3QgdG90YWxEaWZmVGltZU1zID0gUnRwVG9NcyhkaWZmVGltZVJ0cCArIGppdHRlclRpbWVSdHAsIGNsb2NrUmF0ZSk7CisgICAgICAgIFN0cmluZzggaW5mbzsKKyAgICAgICAgaW5mby5hcHBlbmRGb3JtYXQoIlJUUCBkaWZmIGZyb20gZXhwID0lbGxkIFx0IE1TIGRpZmYgZnJvbSBzdGFtcCA9ICVsbGRcdFx0IgorICAgICAgICAgICAgICAgICAgICAiU2VxIyAlZCBcdCBFeHBTZXEjICVkIFx0IgorICAgICAgICAgICAgICAgICAgICAiSml0dGVyTXMgJWQgKyAoJWQgKyAlZCAqICUuM2YpIiwKKyAgICAgICAgICAgICAgICAgICAgKGxvbmcgbG9uZylkaWZmVGltZVJ0cCwgKGxvbmcgbG9uZyl0b3RhbERpZmZUaW1lTXMsCisgICAgICAgICAgICAgICAgICAgIGJ1ZmZlci0+aW50MzJEYXRhKCksIG1OZXh0RXhwZWN0ZWRTZXFObywKKyAgICAgICAgICAgICAgICAgICAgaml0dGVyVGltZU1zLCB0cnlKYlRpbWVNcywgZHluYW1pY0piVGltZU1zLCBKSVRURVJfTVVMVElQTEUpOworICAgICAgICBpZiAoaXNTZWNvbmRMaW5lQnJva2VuKSB7CisgICAgICAgICAgICBBTE9HRSgiJXMiLCBpbmZvLnN0cmluZygpKTsKKyAgICAgICAgICAgIHByaW50Tm93VGltZU1zKHN0YXJ0VGltZU1zLCBub3dUaW1lTXMsIHBsYXllZFRpbWVNcyk7CisgICAgICAgICAgICBwcmludFJUUFRpbWUocnRwVGltZSwgcGxheWVkVGltZVJ0cCwgZXhwaXJlZFRpbWVSdHAsIGlzRXhwaXJlZCk7CisKKyAgICAgICAgfSAgZWxzZSB7CisgICAgICAgICAgICBBTE9HVygiJXMiLCBpbmZvLnN0cmluZygpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmIChtTmV4dEV4cGVjdGVkU2VxTm9WYWxpZCkgeworICAgICAgICBtTmV4dEV4cGVjdGVkU2VxTm8gPSBwaWNrU3RhcnRTZXEocXVldWUsIGZpcnN0UlRQVGltZSwgcGxheWVkVGltZVJ0cCwgaml0dGVyVGltZVJ0cCk7CisgICAgICAgIGludDMyX3QgY250UmVtb3ZlID0gZGVsZXRlVW5pdFVuZGVyU2VxKHF1ZXVlLCBtTmV4dEV4cGVjdGVkU2VxTm8pOworCisgICAgICAgIGlmIChjbnRSZW1vdmUgPiAwKSB7CisgICAgICAgICAgICBpbnQzMl90IHNpemUgPSBxdWV1ZS0+c2l6ZSgpOworICAgICAgICAgICAgc291cmNlLT5ub3RpY2VBYmFuZG9uQnVmZmVyKGNudFJlbW92ZSk7CisgICAgICAgICAgICBBTE9HVygiZGVsZXRlICVkIG9mICVkIGJ1ZmZlcnMiLCBjbnRSZW1vdmUsIHNpemUpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHF1ZXVlLT5lbXB0eSgpKSB7CisgICAgICAgICAgICByZXR1cm4gTk9UX0VOT1VHSF9EQVRBOworICAgICAgICB9CisgICAgfQorCisgICAgYnVmZmVyID0gKnF1ZXVlLT5iZWdpbigpOworCisgICAgaWYgKCFtTmV4dEV4cGVjdGVkU2VxTm9WYWxpZCkgeworICAgICAgICBtTmV4dEV4cGVjdGVkU2VxTm9WYWxpZCA9IHRydWU7CisgICAgICAgIG1OZXh0RXhwZWN0ZWRTZXFObyA9ICh1aW50MzJfdClidWZmZXItPmludDMyRGF0YSgpOworICAgIH0gZWxzZSBpZiAoKHVpbnQzMl90KWJ1ZmZlci0+aW50MzJEYXRhKCkgIT0gbU5leHRFeHBlY3RlZFNlcU5vKSB7CisgICAgICAgIEFMT0dWKCJOb3QgdGhlIHNlcXVlbmNlIG51bWJlciBJIGV4cGVjdGVkIik7CisKKyAgICAgICAgcmV0dXJuIFdST05HX1NFUVVFTkNFX05VTUJFUjsKKyAgICB9CisKKyAgICBjb25zdCB1aW50OF90ICpkYXRhID0gYnVmZmVyLT5kYXRhKCk7CisgICAgc2l6ZV90IHNpemUgPSBidWZmZXItPnNpemUoKTsKKworICAgIGlmIChzaXplIDwgMSB8fCAoZGF0YVswXSAmIDB4ODApKSB7CisgICAgICAgIC8vIENvcnJ1cHQuCisKKyAgICAgICAgQUxPR1YoIklnbm9yaW5nIGNvcnJ1cHQgYnVmZmVyLiIpOworICAgICAgICBxdWV1ZS0+ZXJhc2UocXVldWUtPmJlZ2luKCkpOworCisgICAgICAgICsrbU5leHRFeHBlY3RlZFNlcU5vOworICAgICAgICByZXR1cm4gTUFMRk9STUVEX1BBQ0tFVDsKKyAgICB9CisKKyAgICB1bnNpZ25lZCBuYWxUeXBlID0gKGRhdGFbMF0gPj4gMSkgJiBIMjY1X05BTFVfTUFTSzsKKyAgICBpZiAobmFsVHlwZSA+IDAgJiYgbmFsVHlwZSA8IEgyNjVfTkFMVV9BUCkgeworICAgICAgICBhZGRTaW5nbGVOQUxVbml0KGJ1ZmZlcik7CisgICAgICAgIHF1ZXVlLT5lcmFzZShxdWV1ZS0+YmVnaW4oKSk7CisgICAgICAgICsrbU5leHRFeHBlY3RlZFNlcU5vOworICAgICAgICByZXR1cm4gT0s7CisgICAgfSBlbHNlIGlmIChuYWxUeXBlID09IEgyNjVfTkFMVV9GVSkgeworICAgICAgICAvLyBGVS1BCisgICAgICAgIHJldHVybiBhZGRGcmFnbWVudGVkTkFMVW5pdChxdWV1ZSk7CisgICAgfSBlbHNlIGlmIChuYWxUeXBlID09IEgyNjVfTkFMVV9BUCkgeworICAgICAgICAvLyBTVEFQLUEKKyAgICAgICAgYm9vbCBzdWNjZXNzID0gYWRkU2luZ2xlVGltZUFnZ3JlZ2F0aW9uUGFja2V0KGJ1ZmZlcik7CisgICAgICAgIHF1ZXVlLT5lcmFzZShxdWV1ZS0+YmVnaW4oKSk7CisgICAgICAgICsrbU5leHRFeHBlY3RlZFNlcU5vOworCisgICAgICAgIHJldHV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6dSIsIHRvdGFsQ291bnQpOworCisgICAgICAgICAgICBjb25zdCBzcDxBQnVmZmVyPiAmYnVmZmVyID0gKml0OworCisgICAgICAgICAgICBjb25zdCB1aW50OF90ICpkYXRhID0gYnVmZmVyLT5kYXRhKCk7CisgICAgICAgICAgICBzaXplX3Qgc2l6ZSA9IGJ1ZmZlci0+c2l6ZSgpOworCisgICAgICAgICAgICBpZiAoKHVpbnQzMl90KWJ1ZmZlci0+aW50MzJEYXRhKCkgIT0gZXhwZWN0ZWRTZXFObykgeworICAgICAgICAgICAgICAgIEFMT0dWKCJzZXF1ZW5jZSBub3QgY29tcGxldGUsIGV4cGVjdGVkIHNlcU5vICV1LCBnb3QgJXUsIG5hbFR5cGUgJXUiLAorICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRTZXFObywgKHVuc2lnbmVkKWJ1ZmZlci0+aW50MzJEYXRhKCksIG5hbFR5cGUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB1aW50MzJfdCBydHBUaW1lOworICAgICAgICAgICAgQ0hFQ0soYnVmZmVyLT5tZXRhKCktPmZpbmRJbnQzMigicnRwLXRpbWUiLCAoaW50MzJfdCAqKSZydHBUaW1lKSk7CisgICAgICAgICAgICBpZiAoc2l6ZSA8IDMpIHsKKyAgICAgICAgICAgICAgICBBTE9HVigiSWdub3JpbmcgbWFsZm9ybWVkIEZVIGJ1ZmZlci4iKTsKKyAgICAgICAgICAgICAgICBpdCA9IHF1ZXVlLT5lcmFzZShpdCk7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoKChkYXRhWzBdID4+IDEpICYgSDI2NV9OQUxVX01BU0spICE9IGluZGljYXRvcgorICAgICAgICAgICAgICAgICAgICB8fCAoZGF0YVsyXSAmIEgyNjVfTkFMVV9NQVNLKSAhPSBuYWxUeXBlCisgICAgICAgICAgICAgICAgICAgIHx8IChkYXRhWzJdICYgMHg4MCkKKyAgICAgICAgICAgICAgICAgICAgfHwgcnRwVGltZSAhPSBydHBUaW1lU3RhcnRBdCkgeworICAgICAgICAgICAgICAgIC8vIEFzc2VtYmxlciBhbHJlYWR5IGhhdmUgZ2l2ZW4gZW5vdWdoIHRpbWUgYnkgaml0dGVyIGJ1ZmZlcgorICAgICAgICAgICAgICAgIEFMT0dEKCJTZWVtcyBhbm90aGVyIGZyYW1lLiBJbmNvbXBsZXRlIGZyYW1lIFslZCB+ICVkKSBcdCAlZCBGVXMiLAorICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRTZXFObywgZXhwZWN0ZWRTZXFObywgKGludClxdWV1ZS0+ZGlzdGFuY2UocXVldWUtPmJlZ2luKCksIGl0KSk7CisgICAgICAgICAgICAgICAgZXhwZWN0ZWRTZXFObyA9ICh1aW50MzJfdClidWZmZXItPmludDMyRGF0YSgpOworICAgICAgICAgICAgICAgIGNvbXBsZXRlID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdG90YWxTaXplICs9IHNpemUgLSAzOworICAgICAgICAgICAgKyt0b3RhbENvdW50OworCisgICAgICAgICAgICBleHBlY3RlZFNlcU5vID0gKHVpbnQzMl90KWJ1ZmZlci0+aW50MzJEYXRhKCkgKyAxOworCisgICAgICAgICAgICBpZiAoZGF0YVsyXSAmIDB4NDApIHsKKyAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIHRoZSBsYXN0IGZyYWdtZW50LgorICAgICAgICAgICAgICAgIGNvbXBsZXRlID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgKytpdDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmICghY29tcGxldGUpIHsKKyAgICAgICAgcmV0dXJuIE5PVF9FTk9VR0hfREFUQTsKKyAgICB9CisKKyAgICBtTmV4dEV4cGVjdGVkU2VxTm8gPSBleHBlY3RlZFNlcU5vOworCisgICAgLy8gV2U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gpOworfQorCitpbnQzMl90IEFIRVZDQXNzZW1ibGVyOjpwaWNrU3RhcnRTZXEoY29uc3QgUXVldWUgKnF1ZXVlLAorICAgICAgICB1aW50MzJfdCBmaXJzdCwgaW50NjRfdCBwbGF5LCBpbnQ2NF90IGppdCkgeworICAgIC8vIHBpY2sgdGhlIGZpcnN0IHNlcXVlbmNlIG51bWJlciBoYXMgdGhlIHN0YXJ0IGJpdC4KKyAgICBzcDxBQnVmZmVyPiBidWZmZXIgPSAqKHF1ZXVlLT5iZWdpbigpKTsKKyAgICBpbnQzMl90IGZpcnN0U2VxTm8gPSBidWZmZXItPmludDMyRGF0YSgpOworCisgICAgLy8gVGhpcyBvbmx5IHdvcmtzIGZvciBGVS1BIHR5cGUgJiBub24tc3RhcnQgc2VxdWVuY2UKKyAgICB1bnNpZ25lZCBuYWxUeXBlID0gYnVmZmVyLT5kYXRhKClbMF0gJiAweDFmOworICAgIGlmIChuYWxUeXBlICE9IDI4IHx8IGJ1ZmZlci0+ZGF0YSgpWzJdICYgMHg4MCkgeworICAgICAgICByZXR1cm4gZmlyc3RTZXFObzsKKyAgICB9CisKKyAgICBmb3IgKGF1dG8gaXQgOiAqcXVldWUpIHsKKyAgICAgICAgY29uc3QgdWludDhfdCAqZGF0YSA9IGl0LT5kYXRhKCk7CisgICAgICAgIGludDY0X3QgcnRwVGltZSA9IGZpbmRSVFBUaW1lKGZpcnN0LCBpdCk7CisgICAgICAgIGlmIChydHBUaW1lICsgaml0ID49IHBsYXkpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGlmICgoZGF0YVsyXSAmIDB4ODApKSB7CisgICAgICAgICAgICBjb25zdCBpbnQzMl90IHNlcU5vID0gaXQtPmludDMyRGF0YSgpOworICAgICAgICAgICAgQUxPR0UoImZpbmRpbmcgW0hFQURdIHBrdC4gXHQgU2VxIyAoJWQgfiApWyVkIiwgZmlyc3RTZXFObywgc2VxTm8pOworICAgICAgICAgICAgZmlyc3RT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zdGFydCAmPSB+MTsKIAotICAgIGZvciAodW5zaWduZWQgcG9ydCA9IHN0YXJ0OyBwb3J0IDwgNjU1MzY7IHBvcnQgKz0gMikgeworICAgIGZvciAodW5zaWduZWQgcG9ydCA9IHN0YXJ0OyBwb3J0IDwgNjU1MzU7IHBvcnQgKz0gMikgewogICAgICAgICBzdHJ1Y3Qgc29ja2FkZHJfaW4gYWRkcjsKICAgICAgICAgbWVtc2V0KGFkZHIuc2luX3plcm8sIDAsIHNpemVvZihhZGRyLnNpbl96ZXJvKSk7CiAgICAgICAgIGFkZHIuc2luX2ZhbWlseSA9IEFGX0lORVQ7CkBAIC0xMzksMTIgKzE1NCwxMzAgQEAKICAgICAgICAgICAgICAgICAgKGNvbnN0IHN0cnVjdCBzb2NrYWRkciAqKSZhZGRyLCBzaXplb2YoYWRkcikpID09IDApIHsKICAgICAgICAgICAgICpydHBQb3J0ID0gcG9ydDsKICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8vIHdlIHNob3VsZCByZWNyZWF0ZSBhIFJUUCBzb2NrZXQgdG8gYXZvaWQgYmluZCBvdGhlciBwb3J0IGluIHNhbWUgUlRQIHNvY2tldAorICAgICAgICAgICAgY2xvc2UoKnJ0cFNvY2tldCk7CisKKyAgICAgICAgICAgICpydHBTb2NrZXQgPSBzb2NrZXQoQUZfSU5FVCwgU09DS19ER1JBTSwgMCk7CisgICAgICAgICAgICBDSEVDS19HRSgqcnRwU29ja2V0LCAwKTsKKyAgICAgICAgICAgIGJ1bXBTb2NrZXRCdWZmZXJTaXplKCpydHBTb2NrZXQpOwogICAgICAgICB9CiAgICAgfQogCiAgICAgVFJFU1BBU1MoKTsKIH0KIAorLy8gc3RhdGljCit2b2lkIEFSVFBDb25uZWN0aW9uOjpNYWtlUlRQU29ja2V0UGFpcigKKyAgICAgICAgaW50ICpydHBTb2NrZXQsIGludCAqcnRjcFNvY2tldCwgY29uc3QgY2hhciAqbG9jY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gKHVuc2lnbmVkIGxvbmcgbG9uZylzb2NrZXROZXR3b3JrKTsKKyAgICAgICAgfQorICAgICAgICByZXN1bHQgPSBhbmRyb2lkX3NldHNvY2tuZXR3b3JrKChuZXRfaGFuZGxlX3Qpc29ja2V0TmV0d29yaywgKnJ0Y3BTb2NrZXQpOworICAgICAgICBpZiAocmVzdWx0ICE9IDApIHsKKyAgICAgICAgICAgIEFMT0dXKCJmYWlsZWQoJWQpIHRvIGJpbmQgcnRjcCBzb2NrZXQoJWQpIHRvIG5ldHdvcmsoJWxsdSkiLAorICAgICAgICAgICAgICAgICAgICByZXN1bHQsICpydGNwU29ja2V0LCAodW5zaWduZWQgbG9uZyBsb25nKXNvY2tldE5ldHdvcmspOworICAgICAgICB9CisgICAgfQorCisgICAgYnVtcFNvY2tldEJ1ZmZlclNpemUoKnJ0Y3BTb2NrZXQpOworCisgICAgc3RydWN0IHNvY2thZGRyICphZGRyOworICAgIHN0cnVjdCBzb2NrYWRkcl9pbiBhZGRyNDsKKyAgICBzdHJ1Y3Qgc29ja2FkZHJfaW42IGFkZHI2OworCisgICAgaWYgKGlzSVB2NikgeworICAgICAgICBhZGRyID0gKHN0cnVjdCBzb2NrYWRkciAqKSZhZGRyNjsKKyAgICAgICAgbWVtc2V0KCZhZGRyNiwgMCwgc2l6ZW9mKGFkZHI2KSk7CisgICAgICAgIGFkZHI2LnNpbjZfZmFtaWx5ID0gQUZfSU5FVDY7CisgICAgICAgIGluZXRfcHRvbihBRl9JTkVUNiwgbG9jYWxJcCwgJmFkZHI2LnNpbjZfYWRkcik7CisgICAgICAgIGFkZHI2LnNpbjZfcG9ydCA9IGh0b25zKCh1aW50MTZfdClsb2NhbFBvcnQpOworICAgIH0gZWxzZSB7CisgICAgICAgIGFkZHIgPSAoc3RydWN0IHNvY2thZGRyICopJmFkZHI0OworICAgICAgICBtZW1zZXQoJmFkZHI0LCAwLCBzaXplb2YoYWRkcjQpKTsKKyAgICAgICAgYWRkcjQuc2luX2ZhbWlseSA9IEFGX0lORVQ7CisgICAgICAgIGFkZHI0LnNpbl9hZGRyLnNfYWRkciA9IGluZXRfYWRkcihsb2NhbElwKTsKKyAgICAgICAgYWRkcjQuc2luX3BvcnQgPSBodG9ucygodWludDE2X3QpbG9jYWxQb3J0KTsKKyAgICB9CisKKyAgICBpbnQgc29ja29wdCA9IDE7CisgICAgc2V0c29ja29wdCgqcnRwU29ja2V0LCBTT0xfU09DS0VULCBTT19SRVVTRUFERFIsIChpbnQgKikmc29ja29wdCwgc2l6ZW9mKHNvY2tvcHQpKTsKKyAgICBzZXRzb2Nrb3B0KCpydGNwU29ja2V0LCBTT0xfU09DS0VULCBTT19SRVVTRUFERFIsIChpbnQgKikmc29ja29wdCwgc2l6ZW9mKHNvY2tvcHQpKTsKKworICAgIGludCBzaXplU29ja1N0ID0gaXNJUHY2ID8gc2l6ZW9mKGFkZHI2KSA6IHNpemVvZihhZGRyNCk7CisKKyAgICBpZiAoYmluZCgqcnRwU29ja2V0LCBhZGRyLCBzaXplU29ja1N0KSA9PSAwKSB7CisgICAgICAgIEFMT0dJKCJydHAgc29ja2V0IHN1Y2Nlc3NmdWxseSBiaW5kZWQuIGFkZHI9JXM6JWQiLCBsb2NhbElwLCBsb2NhbFBvcnQpOworICAgIH0gZWxzZSB7CisgICAgICAgIEFMT0dFKCJmYWlsZWQgdG8gYmluZCBydHAgc29ja2V0IGFkZHI9JXM6JWQgZXJyPSVzIiwgbG9jYWxJcCwgbG9jYWxQb3J0LCBzdHJlcnJvcihlcnJubykpOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgaWYgKGlzSVB2NikKKyAgICAgICAgYWRkcjYuc2luNl9wb3J0ID0gaHRvbnMobG9jYWxQb3J0ICsgMSk7CisgICAgZWxzZQorICAgICAgICBhZGRyNC5zaW5fcG9ydCA9IGh0b25zKGxvY2FsUG9ydCArIDEpOworCisgICAgaWYgKGJpbmQoKnJ0Y3BTb2NrZXQsIGFkZHIsIHNpemVTb2NrU3QpID09ID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W90ZUlwLCByZW1vdGVQb3J0KTsKKyAgICB9IGVsc2UgeworICAgICAgICBBTE9HRSgiZmFpbGVkIHRvIGNvbm5lY3QgcnRwIHNvY2tldCB0byByZW1vdGUgYWRkcj0lczolZCBlcnI9JXMiLCByZW1vdGVJcCwKKyAgICAgICAgICAgICAgICByZW1vdGVQb3J0LCBzdHJlcnJvcihlcnJubykpOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgaWYgKGlzSVB2NikKKyAgICAgICAgYWRkcjYuc2luNl9wb3J0ID0gaHRvbnMocmVtb3RlUG9ydCArIDEpOworICAgIGVsc2UKKyAgICAgICAgYWRkcjQuc2luX3BvcnQgPSBodG9ucyhyZW1vdGVQb3J0ICsgMSk7CisKKyAgICBpZiAoY29ubmVjdCgqcnRjcFNvY2tldCwgYWRkciwgc2l6ZVNvY2tTdCkgPT0gMCkgeworICAgICAgICBBTE9HSSgicnRjcCBzb2NrZXQgc3VjY2Vzc2Z1bGx5IGNvbm5lY3RlZCB0byByZW1vdGU9JXM6JWQiLCByZW1vdGVJcCwgcmVtb3RlUG9ydCArIDEpOworICAgIH0gZWxzZSB7CisgICAgICAgIEFMT0dFKCJmYWlsZWQgdG8gY29ubmVjdCBydGNwIHNvY2tldCBhZGRyPSVzOiVkIGVycj0lcyIsIHJlbW90ZUlwLAorICAgICAgICAgICAgICAgIHJlbW90ZVBvcnQgKyAxLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICByZXR1cm47CisgICAgfQorfQorCiB2b2lkIEFSVFBDb25uZWN0aW9uOjpvbk1lc3NhZ2VSZWNlaXZlZChjb25zdCBzcDxBTWVzc2FnZT4gJm1zZykgewogICAgIHN3aXRjaCAobXNnLT53aGF0KCkpIHsKICAgICAgICAgY2FzZSBrV2hhdEFkZFN0cmVhbToKQEAgLTE1Myw2ICsyODYsMTIgQEAKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CiAKKyAgICAgICAgY2FzZSBrV2hhdFNlZWtTdHJlYW06CisgICAgICAgIHsKKyAgICAgICAgICAgIG9uU2Vla1N0cmVhbShtc2cpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKwogICAgICAgICBjYXNlIGtXaGF0UmVtb3ZlU3RyZWFtOgogICAgICAgICB7CiAgICAgICAgICAgICBvblJlbW92ZVN0cmVhbShtc2cpOwpAQCAtMTY1LDYgKzMwNCwxMiBAQAogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KIAorICAgICAgICBjYXNlIGtXaGF0QWxhcm1TdHJlYW06CisgICAgICAgIHsKKyAgICAgICAgICAgIG9uQWxhcm1TdHJlYW0obXNnKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKICAgICAgICAgY2FzZSBrV2hhdEluamVjdFBhY2tldDoKICAgICAgICAgewogICAgICAgICAgICAgb25JbmplY3RQYWNrZXQobXNnKTsKQEAgLTIwNCwxMiArMzQ5LDM3IEBACiAgICAgaW5mby0+bU51bVJUQ1BQYWNrZXRzUmVjZWl2ZWQgPSAwOwogICAgIGluZm8tPm1OdW1SVFBQYWNrZXRzUmVjZWl2ZWQgPSAwOwogICAgIG1lbXNldCgmaW5mby0+bVJlbW90ZVJUQ1BBZGRyLCAwLCBzaXplb2YoaW5mby0+bVJlbW90ZVJUQ1BBZGRyKSk7CisgICAgbWVtc2V0KCZpbmZvLT5tUmVtb3RlUlRDUEFkZHI2LCAwLCBzaXplb2YoaW5mby0+bVJlbW90ZVJUQ1BBZGRyNikpOworCisgICAgc3A8QVNlc3Npb25EZXNjcmlwdGlvbj4gc2Vzc2lvbkRlc2MgPSBpbmZvLT5tU2Vzc2lvbkRlc2M7CisgICAgaW5mby0+bUNWT0V4dE1hcCA9IDA7CisgICAgZm9yIChzaXplX3QgaSA9IDE7IGkgPCBzZXNzaW9uRGVzYy0+Y291bnRUcmFja3MoKTsgKytpKSB7CisgICAgICAgIGludDMyX3QgY3ZvRXh0TWFwOworICAgICAgICBpZiAoc2Vzc2lvbkRlc2MtPmdldEN2b0V4dE1hcChpLCAmY3ZvRXh0TWFwKSkgeworICAgICAgICAgICAgaW5mby0+bUNWT0V4dE1hcCA9IGN2b0V4dE1hcDsKKyAgICAgICAgICAgIEFMT0dJKCJ1cm46M2dwcDp2aWRlby1vcmllbnRhdGlvbihjdm8pIGZvdW5kIGFzIGV4dG1hcDolZCIsIGluZm8tPm1DVk9FeHRNYXApOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgQUxPR0koInVybjozZ3BwOnZpZGVvLW9yaWVudGF0aW9uKGN2bykgbm90IGZvdW5kIDolZCIsIGluZm8tPm1DVk9FeHRNYXApOworICAgICAgICB9CisgICAgfQogCiAgICAgaWYgKCFpbmplY3RlZCkgewogICAgICAgICBwb3N0UG9sbEV2ZW50KCk7CiAgICAgfQogfQogCit2b2lkIEFSVFBDb25uZWN0aW9uOjpvblNlZWtTdHJlYW0oY29uc3Qgc3A8QU1lc3NhZ2U+ICZtc2cpIHsKKyAgICAodm9pZCltc2c7IC8vIHVudXNlZCBwYXJhbSBhcyBvZiBub3cuCisgICAgTGlzdDxTdHJlYW1JbmZvPjo6aXRlcmF0b3IgaXQgPSBtU3RyZWFtcy5iZWdpbigpOworICAgIHdoaWxlIChpdCAhPSBtU3RyZWFtcy5lbmQoKSkgeworICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IGl0LT5tU291cmNlcy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgc3A8QVJUUFNvdXJjZT4gc291cmNlID0gaXQtPm1Tb3VyY2VzLnZhbHVlQXQoaSk7CisgICAgICAgICAgICBzb3VyY2UtPnRpbWVSZXNldCgpOworICAgICAgICB9CisgICAgICAgICsraXQ7CisgICAgfQorfQorCiB2b2lkIEFSVFBDb25uZWN0aW9uOjpvblJlbW92ZVN0cmVhbShjb25zdCBzcDxBTWVzc2FnZT4gJm1zZykgewogICAgIGludDMyX3QgcnRwU29ja2V0LCBydGNwU29ja2V0OwogICAgIENIRUNLKG1zZy0+ZmluZEludDMyKCJydHAtc29ja2V0IiwgJnJ0cFNvY2tldCkpOwpAQCAtMjc1LDYgKzQ0NSw3IEBACiAgICAgICAgIHJldHVybjsKICAgICB9CiAKKyAgICBpbnQ2NF90IG5vd1VzID0gQUxvb3Blcjo6R2V0Tm93VXMoKTsKICAgICBpbnQgcmVzID0gc2VsZWN0KG1heFNvY2tldCArIDEsICZycywgTlVMTCwgTlVMTCwgJnR2KTsKIAogICAgIGlmIChyZXMgPiAwKSB7CkBAIC0yODQsNiArNDU1LDcgQEAKICAgICAgICAgICAgICAgICArK2l0OwogICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgaXQtPm1MYXN0UG9sbFRpbWVVcyA9IG5vd1VzOwogCiAgICAgICAgICAgICBzdGF0dXNfdCBlcnIgPSBPSzsKICAgICAgICAgICAgIGlmIChGRF9JU1NFVChpdC0+bVJUUFNvY2tldCwgJnJzKSkgewpAQCAtMjk1LDE3ICs0NjcsNTggQEAKIAogICAgICAgICAgICAgaWYgKGVyciA9PSAtRUNPTk5SRVNFVCkgewogICAgICAgICAgICAgICAgIC8vIHNvY2tldCBmYWlsdXJlLCB0aGlzIHN0cmVhbSBpcyBkZWFkLCBKaW0uCisgICAgICAgICAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBpdC0+bVNvdXJjZXMuc2l6ZSgpOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgc3A8QU1lc3NhZ2U+IG5vdGlmeSA9IGl0LT5tTm90aWZ5TXNnLT5kdXAoKTsKKyAgICAgICAgICAgICAgICAgICAgbm90aWZ5LT5zZXRJbnQzMigicnRjcC1ldmVudCIsIDEpOworICAgICAgICAgICAgICAgICAgICBub3RpZnktPnNldEludDMyKCJwYXlsb2FkLXR5cGUiLCA0MDApOworICAgICAgICAgICAgICAgICAgICBub3RpZnktPnNldEludDMyKCJmZWVkYmFjay10eXBlIiwgMSk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeS0+c2V0SW50MzIoInNlbmRlciIsIGl0LT5tU291cmNlcy52YWx1ZUF0KGkpLT5nZXRTZWxmSUQoKSk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeS0+cG9zdCgpOwogCi0gICAgICAgICAgICAgICAgQUxPR1coImZhaWxlZCB0byByZWNlaXZlIFJUUC9SVENQIGRhdGFncmFtLiIpOworICAgICAgICAgICAgICAgICAgICBBTE9HVygiZmFpbGVkIHRvIHJlY2VpdmUgUlRQL1JUQ1AgZGF0YWdyYW0uIik7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGl0ID0gbVN0cmVhbXMuZXJhc2UoaXQpOwogICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgfQogCisgICAgICAgICAgICAvLyBhZGQgTkFDSyBhbmQgRklSIHRoYXQgbmVlZHMgdG8gYmUgc2VudCBpbW1lZGlhdGVseS4KKyAgICAgICAgICAgIHNwPEFCdWZmZXI+IGJ1ZmZlciA9IG5ldyBBQnVmZmVyKGtNYXhVRFBTaXplKTsKKyAgICAgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgaXQtPm1Tb3VyY2VzLnNpemUoKTsgKytpKSB7CisgICAgICAgICAgICAgICAgYnVmZmVyLT5zZXRSYW5nZSgwLCAwKTsKKyAgICAgICAgICAgICAgICBpbnQgY250ID0gaXQtPm1Tb3VyY2VzLnZhbHVlQXQoaSktPmFkZE5BQ0soYnVmZmVyKTsKKyAgICAgICAgICAgICAgICBpZiAoY250ID4gMCkgeworICAgICAgICAgICAgICAgICAgICBBTE9HVigiU2VuZCBOQUNLIGZvciBsb3N0ICVkIFBhY2tldHMiLCBjbnQpOworICAgICAgICAgICAgICAgICAgICBzZW5kKCYqaXQsIGJ1ZmZlcik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgYnVmZmVyLT5zZXRSYW5nZSgwLCAwKTsKKyAgICAgICAgICAgICAgICBpdC0+bVNvdXJjZXMudmFsdWVBdChpKS0+YWRkRklSKGJ1ZmZlcik7CisgICAgICAgICAgICAgICAgaWYgKGJ1ZmZlci0+c2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgICAgICBBTE9HRCgiU2VuZCBGSVIgaW1tZWRpYXRlbHkgZm9yIGxvc3QgUGFja2V0cyIpOworICAgICAgICAgICAgICAgICAgICBzZW5kKCYqaXQsIGJ1ZmZlcik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgYnVmZmVyLT5zZXRSYW5nZSgwLCAwKTsKKyAgICAgICAgICAgICAgICBpdC0+bVNvdXJjZXMudmFsdWVBdChpKS0+YWRkVE1NQlIoYnVmZmVyLCBtVGFyZ2V0Qml0cmF0ZSk7CisgICAgICAgICAgICAgICAgbVRhcmdldEJpdHJhdGUgPSAtMTsKKyAgICAgICAgICAgICAgICBpZiAoYnVmZmVyLT5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIEFMT0dWKCJTZW5kaW5nIFRNTUJSLi4uIik7CisgICAgICAgICAgICAgICAgICAgIHNzaXplX3QgbiA9IHNlbmQoJippdCwgYnVmZmVyKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAobiAhPSAoc3NpemVfdClidWZmZXItPnNpemUoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coImZhaWxlZCB0byBzZW5kIFJUQ1AgVE1NQlIgKCVzKS4iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID49IDAgPyAiY29ubmVjdGlvbiBnb25lIiA6IHN0cmVycm9yKGVycm5vKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgKytpdDsKICAgICAgICAgfQogICAgIH0KIAotICAgIGludDY0X3Qgbm93VXMgPSBBTG9vcGVyOjpHZXROb3dVcygpOworICAgIGNoZWNrUnhCaXRyYXRlKG5vd1VzKTsKKwogICAgIGlmIChtTGFzdFJlY2VpdmVyUmVwb3J0VGltZVVzIDw9IDAKICAgICAgICAgICAgIHx8IG1MYXN0UmVjZWl2ZXJSZXBvcnRUaW1lVXMgKyA1MDAwMDAwTEwgPD0gbm93VXMpIHsKICAgICAgICAgc3A8QUJ1ZmZlcj4gYnVmZmVyID0gbmV3IEFCdWZmZXIoa01heFVEUFNpemUpOwpAQCAtMzQwLDI0ICs1NTMsMTQgQEAKICAgICAgICAgICAgIGlmIChidWZmZXItPnNpemUoKSA+IDApIHsKICAgICAgICAgICAgICAgICBBTE9HVigiU2VuZGluZyBSUi4uLiIpOwogCi0gICAgICAgICAgICAgICAgc3NpemVfdCBuOwotICAgICAgICAgICAgICAgIGRvIHsKLSAgICAgICAgICAgICAgICAgICAgbiA9IHNlbmR0bygKLSAgICAgICAgICAgICAgICAgICAgICAgIHMtPm1SVENQU29ja2V0LCBidWZmZXItPmRhdGEoKSwgYnVmZmVyLT5zaXplKCksIDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAoY29uc3Qgc3RydWN0IHNvY2thZGRyICopJnMtPm1SZW1vdGVSVENQQWRkciwKLSAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihzLT5tUmVtb3RlUlRDUEFkZHIpKTsKLSAgICAgICAgICAgICAgICB9IHdoaWxlIChuIDwgMCAmJiBlcnJubyA9PSBFSU5UUik7CisgICAgICAgICAgICAgICAgc3NpemVfdCBuID0gc2VuZChzLCBidWZmZXIpOwogCi0gICAgICAgICAgICAgICAgaWYgKG4gPD0gMCkgeworICAgICAgICAgICAgICAgIGlmIChuICE9IChzc2l6ZV90KWJ1ZmZlci0+c2l6ZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIEFMT0dXKCJmYWlsZWQgdG8gc2VuZCBSVENQIHJlY2VpdmVyIHJlcG9ydCAoJXMpLiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgbiA9PSAwID8gImNvbm5lY3Rpb24gZ29uZSIgOiBzdHJlcnJvcihlcnJubykpOwotCi0gICAgICAgICAgICAgICAgICAgIGl0ID0gbVN0cmVhbXMuZXJhc2UoaXQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPj0gMCA/ICJjb25uZWN0aW9uIGdvbmUiIDogc3RyZXJyb3IoZXJybm8pKTsKICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgQ0hFQ0tfRVEobiwgKHNzaXplX3QpYnVmZmVyLT5zaXplKCkpOwotCiAgICAgICAgICAgICAgICAgbUxhc3RSZWNlaXZlclJlcG9ydFRpbWVVcyA9IG5vd1VzOwogICAgICAgICAgICAgfQogCkBAIC0zNzAsNiArNTczLDEzIEBACiAgICAgfQogfQogCit2b2lkIEFSVFBDb25uZWN0aW9uOjpvbkFsYXJtU3RyZWFtKGNvbnN0IHNwPEFNZXNzYWdlPiBtc2cpIHsKKyAgICBzcDxBUlRQU291cmNlPiBzb3VyY2UgPSBudWxscHRyOworICAgIGlmIChtc2ctPmZpbmRPYmplY3QoInNvdXJjZSIsIChzcDxhbmRyb2lkOjpSZWZCYXNlPiopJnNvdXJjZSkpIHsKKyAgICAgICAgc291cmNlLT5wcm9jZXNzUlRQUGFja2V0KCk7CisgICAgfQorfQorCiBzdGF0dXNfdCBBUlRQQ29ubmVjdGlvbjo6cmVjZWl2ZShTdHJlYW1JbmZvICpzLCBib29sIHJlY2VpdmVSVFApIHsKICAgICBBTE9HVigicmVjZWl2aW5nICVzIiwgcmVjZWl2ZVJUUCA/ICJSVFAiIDogIlJUQ1AiKTsKIApAQCAtMzc3LDkgKzU4NywyMiBAQAogCiAgICAgc3A8QUJ1ZmZlcj4gYnVmZmVyID0gbmV3IEFCdWZmZXIoNjU1MzYpOwogCisgICAgc3RydWN0IHNvY2thZGRyICpwUmVtb3RlUlRDUEFkZHI7CisgICAgaW50IHNpemVTb2NrU3Q7CisgIC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N0KCk7Ci0gICAgfQorc3NpemVfdCBBUlRQQ29ubmVjdGlvbjo6c2VuZChjb25zdCBTdHJlYW1JbmZvICppbmZvLCBjb25zdCBzcDxBQnVmZmVyPiBidWZmZXIpIHsKKyAgICAgICAgc3RydWN0IHNvY2thZGRyKiBwUmVtb3RlUlRDUEFkZHI7CisgICAgICAgIGludCBzaXplU29ja1N0OwogCisgICAgICAgIC8qIEl0IHNlZW1zIHRoaXMgaXNJUHY2IHZhcmlhYmxlIGlzIHVzZWxlc3MuCisgICAgICAgICAqIFdlIHNob3VsZCByZW1vdmUgaXQgdG8gcHJldmVudCBjb25mdXNpb24gKi8KKyAgICAgICAgaWYgKGluZm8tPmlzSVB2NikgeworICAgICAgICAgICAgcFJlbW90ZVJUQ1BBZGRyID0gKHN0cnVjdCBzb2NrYWRkciAqKSZpbmZvLT5tUmVtb3RlUlRDUEFkZHI2OworICAgICAgICAgICAgc2l6ZVNvY2tTdCA9IHNpemVvZihzdHJ1Y3Qgc29ja2FkZHJfaW42KTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHBSZW1vdGVSVENQQWRkciA9IChzdHJ1Y3Qgc29ja2FkZHIgKikmaW5mby0+bVJlbW90ZVJUQ1BBZGRyOworICAgICAgICAgICAgc2l6ZVNvY2tTdCA9IHNpemVvZihzdHJ1Y3Qgc29ja2FkZHJfaW4pOworICAgICAgICB9CisKKyAgICAgICAgaWYgKG1GbGFncyAmIGtWaUxURUNvbm5lY3Rpb24pIHsKKyAgICAgICAgICAgIEFMT0dWKCJWaUxURSBSVENQIik7CisgICAgICAgICAgICBwUmVtb3RlUlRDUEFkZHIgPSBOVUxMOworICAgICAgICAgICAgc2l6ZVNvY2tTdCA9IDA7CisgICAgICAgIH0KKworICAgICAgICBzc2l6ZV90IG47CisgICAgICAgIGRvIHsKKyAgICAgICAgICAgIG4gPSBzZW5kdG8oCisgICAgICAgICAgICAgICAgICAgIGluZm8tPm1SVENQU29ja2V0LCBidWZmZXItPmRhdGEoKSwgYnVmZmVyLT5zaXplKCksIDAsCisgICAgICAgICAgICAgICAgICAgIHBSZW1vdGVSVENQQWRkciwgc2l6ZVNvY2tTdCk7CisgICAgICAgIH0gd2hpbGUgKG4gPCAwICYmIGVycm5vID09IEVJTlRSKTsKKworICAgICAgICBpZiAobiA8IDApIHsKKyAgICAgICAgICAgIEFMT0dXKCJmYWlsZWQgdG8gc2VuZCBydGNwIHBhY2tldC4gY2F1c2U9JXMiLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIG47Cit9CisKK3N0YXR1c190IEFSVFBDb25uZWN0aW9uOjpwYXJzZVJUUChTdHJlYW1JbmZvICpzLCBjb25zdCBzcDxBQnVmZmVyPiAmYnVmZmVyKSB7CiAgICAgc2l6ZV90IHNpemUgPSBidWZmZXItPnNpemUoKTsKIAogICAgIGlmIChzaXplIDwgMTIpIHsKQEAgLTQzMSw2ICs2OTAsMTEgQEAKICAgICAgICAgcmV0dXJuIC0xOwogICAgIH0KIAorICAgIGlmICgoZGF0YVsxXSAmIDB4N2YpID09IDIwIC8qIGRlY2ltYWwgKi8pIHsKKyAgICAgICAgLy8gVW5hc3NpZ25lZCBwYXlsb2FkIHR5cGUKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKwogICAgIGlmIChkYXRhWzBdICYgMHgyMCkgewogICAgICAgICAvLyBQYWRkaW5nIHByZXNlbnQuCiAKQEAgLTQ1NCw2ICs3MTgsNyBAQAogICAgICAgICByZXR1cm4gLTE7CiAgICAgfQogCisgICAgaW50MzJfdCBjdm9EZWdyZWVzID0gLTE7CiAgICAgaWYgKGRhdGFbMF0gJiAweDEwKSB7CiAgICAgICAgIC8vIEhlYWRlciBlWHRlbnNpb24gcHJlc2VudC4KIApAQCAtNDY3LDEzICs3MzIsMTQgQEAKICAgICAgICAgY29uc3QgdWludDhfdCAqZXh0ZW5zaW9uRGF0YSA9ICZkYXRhW3BheWxvYWRPZmZzZXRdOw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V4dExlbiA8IDQpCisgICAgICAgIHJldHVybiAtMTsKKworICAgIHVpbnQxNl90IGhlYWRlciA9IChleHRIZWFkZXJbMF0gPDwgOCkgfCAoZXh0SGVhZGVyWzFdKTsKKyAgICBib29sIGlzT25lYnl0ZUhlYWRlciA9IGZhbHNlOworCisgICAgaWYgKGhlYWRlciA9PSAweEJFREUpIHsKKyAgICAgICAgaXNPbmVieXRlSGVhZGVyID0gdHJ1ZTsKKyAgICB9IGVsc2UgaWYgKGhlYWRlciA9PSAweDEwMDApIHsKKyAgICAgICAgQUxPR1coInBhcnNlUlRQRXh0OiB0d28tYnl0ZSBoZWFkZXIgaXMgbm90IGltcGxlbWVudGVkIHlldCIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfSBlbHNlIHsKKyAgICAgICAgQUxPR1coInBhcnNlUlRQRXh0OiBjYW4gbm90IHJlY29nbml6ZSBoZWFkZXIiKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIGNvbnN0IHVpbnQ4X3QgKmV4dFBheWxvYWQgPSBleHRIZWFkZXIgKyA0OworICAgIGV4dExlbiAtPSA0OworICAgIHNpemVfdCBvZmZzZXQgPSAwOyAvL3N0YXJ0IGZyb20gZmlyc3QgcGF5bG9hZCBvZiBydHAgZXh0ZW5zaW9uLgorICAgIC8vIG9uZS1ieXRlIGhlYWRlciBwYXJzZXIKKyAgICB3aGlsZSAoaXNPbmVieXRlSGVhZGVyICYmIG9mZnNldCA8IGV4dExlbikgeworICAgICAgICB1aW50OF90IGV4dG1hcElkID0gZXh0UGF5bG9hZFtvZmZzZXRdID4+IDQ7CisgICAgICAgIHVpbnQ4X3QgbGVuZ3RoID0gKGV4dFBheWxvYWRbb2Zmc2V0XSAmIDB4RikgKyAxOworICAgICAgICBvZmZzZXQrKzsKKworICAgICAgICAvLyBwYWRkaW5nIGNhc2UKKyAgICAgICAgaWYgKGV4dG1hcElkID09IDApCisgICAgICAgICAgICBjb250aW51ZTsKKworICAgICAgICB1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mVCeXRlcyAqIDggLyB0aW1lRGlmZjsKKyAgICBzb3VyY2UtPm5vdGlmeVBrdEluZm8oYml0cmF0ZSwgbm93VXMsIHRydWUgLyogaXNSZWd1bGFyICovKTsKKwogICAgIHNvdXJjZS0+YnllUmVjZWl2ZWQoKTsKIAogICAgIHJldHVybiBPSzsKQEAgLTYyMSw2ICs5NjYsMTQ0IEBACiAgICAgcmV0dXJuIDA7CiB9CiAKK3N0YXR1c190IEFSVFBDb25uZWN0aW9uOjpwYXJzZVRTRkIoCisgICAgICAgIFN0cmVhbUluZm8gKnMsIGNvbnN0IHVpbnQ4X3QgKmRhdGEsIHNpemVfdCBzaXplKSB7CisgICAgaWYgKHNpemUgPCAxMikgeworICAgICAgICAvLyBicm9rZW4gcGFja2V0CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICB1aW50OF90IG1zZ1R5cGUgPSBkYXRhWzBdICYgMHgxZjsKKyAgICB1aW50MzJfdCBpZCA9IHUzMmF0KCZkYXRhWzRdKTsKKworICAgIGNvbnN0IHVpbnQ4X3QgKnB0ciA9ICZkYXRhWzEyXTsKKyAgICBzaXplIC09IDEyOworCisgICAgdXNpbmcgbmFtZXNwYWNlIHN0ZDsKKyAgICBzaXplX3QgRkNJU2l6ZTsKKyAgICBzd2l0Y2gobXNnVHlwZSkgeworICAgICAgICBjYXNlIDE6ICAgICAvLyBHZW5lcmljIE5BQ0sKKyAgICAgICAgeworICAgICAgICAgICAgRkNJU2l6ZSA9IDQ7CisgICAgICAgICAgICB3aGlsZSAoc2l6ZSA+PSBGQ0lTaXplKSB7CisgICAgICAgICAgICAgICAgdWludDE2X3QgUElEID0gdTE2YXQoJnB0clswXSk7ICAvLyBsb3N0IHBhY2tldCBSVFAgbnVtYmVyCisgICAgICAgICAgICAgICAgdWludDE2X3QgQkxQID0gdTE2YXQoJnB0clsyXSk7ICAvLyBCaXRtYXNrIG9mIGZvbGxvd2luZyBMb3N0IFBhY2tldHMKKworICAgICAgICAgICAgICAgIHNpemUgLT0gRkNJU2l6ZTsKKyAgICAgICAgICAgICAgICBwdHIgKz0gRkNJU2l6ZTsKKworICAgICAgICAgICAgICAgIEFTdHJpbmcgbGlzdF9vZl9sb3N0czsKKyAgICAgICAgICAgICAgICBsaXN0X29mX2xvc3RzLmFwcGVuZChQSUQpOworICAgICAgICAgICAgICAgIGZvciAoaW50IGk9MCA7IGk8MTYgOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19sb3N0ID0gQkxQICYgKDB4MSA8PCBpKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGlzX2xvc3QpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGxpc3Rfb2ZfbG9zdHMuYXBwZW5kKCIsICIpOworICAgICAgICAgICAgICAgICAgICAgICAgbGlzdF9vZl9sb3N0cy5hcHBlbmQoUElEICsgaSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgQUxPR0koIk9wcG9uZW50IGxvc3RzIHBhY2tldCBvZiBSVFAgJXMiLCBsaXN0X29mX2xvc3RzLmNfc3RyKCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSAzOiAgICAgLy8gVE1NQlIKKyAgICAgICAgY2FzZSA0OiAgICAgLy8gVE1NQk4KKyAgICAgICAgeworICAgICAgICAgICAgRkNJU2l6ZSA9IDg7CisgICAgICAgICAgICB3aGlsZSAoc2l6ZSA+PSBGQ0lTaXplKSB7CisgICAgICAgICAgICAgICAgdWludDMyX3QgTXhUQlIgPSB1MzJhdCgmcHRyWzRdKTsKKyAgICAgICAgICAgICAgICB1aW50MzJfdCBNeFRCUkV4cCA9IE14VEJSID4+IDI2OworICAgICAgICAgICAgICAgIHVpbnQzMl90IE14VEJSTWFudGlzc2EgPSAoTXhUQlIgPj4gOSkgJiAweDAxRkZGRjsKKyAgICAgICAgICAgICAgICB1aW50MzJfdCBvdmVyaGVhZCA9IE14VEJSICYgMHgwMUZGOworCisgICAgICAgICAgICAgICAgc2l6ZSAtPSBGQ0lTaXplOworICAgICAgICAgICAgICAgIHB0ciArPSBGQ0lTaXplOworCisgICAgICAgICAgICAgICAgdWludDMyX3QgYml0UmF0ZSA9ICgxIDw8IE14VEJSRXhwKSAqIE14VEJSTWFudGlzc2E7CisKKyAgICAgICAgICAgICAgICBpZiAobXNnVHlwZSA9PSAzKQorICAgICAgICAgICAgICAgICAgICBBTE9HSSgiT3AgLT4gVUUgUmVxIFR4IGJpdHJhdGUgOiAlZCBYIDJeJWQgPSAlZCIsCisgICAgICAgICAgICAgICAgICAgICAgICBNeFRCUk1hbnRpc3NhLCBNeFRCUkV4cCwgYml0UmF0ZSk7CisgICAgICAgICAgICAgICAgZWxzZSBpZiAobXNnVHlwZSA9PSA0KQorICAgICAgICAgICAgICAgICAgICBBTE9HSSgiT1AgLT4gVUUgTm90aSBSeCBiaXRyYXRlIDogJWQgWCAyXiVkID0gJWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgTXhUQlJNYW50aXNzYSwgTXhUQlJFeHAsIGJpdFJhdGUpOworCisgICAgICAgICAgICAgICAgc3A8QU1lc3NhZ2U+IG5vdGlmeSA9IHMtPm1Ob3RpZnlNc2ctPmR1cCgpOworICAgICAgICAgICAgICAgIG5vdGlmeS0+c2V0SW50MzIoInJ0Y3AtZXZlbnQiLCAxKTsKKyAgICAgICAgICAgICAgICBub3RpZnktPnNldEludDMyKCJwYXlsb2FkLXR5cGUiLCAyMDUpOworICAgICAgICAgICAgICAgIG5vdGlmeS0+c2V0SW50MzIoImZlZWRiYWNrLXR5cGUiLCBtc2dUeXBlKTsKKyAgICAgICAgICAgICAgICBub3RpZnktPnNldEludDMyKCJzZW5kZXIiLCBpZCk7CisgICAgICAgICAgICAgICAgbm90aWZ5LT5zZXRJbnQzMigiYml0LXJhdGUiLCBiaXRSYXRlKTsKKyAgICAgICAgICAgICAgICBub3RpZnktPnBvc3QoKTsKKyAgICAgICAgICAgICAgICBBTE9HSSgib3ZlcmhlYWQgOiAlZCIsIG92ZXJoZWFkKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgIHsKKyAgICAgICAgICAgIEFMT0dJKCJOb3Qgc3VwcG9ydGVkIFRTRkIgdHlwZSAlZCIsIG1zZ1R5cGUpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gMDsKK30KKworc3RhdHVzX3QgQVJUUENvbm5lY3Rpb246OnBhcnNlUFNGQigKKyAgICAgICAgU3RyZWFtSW5mbyAqcywgY29uc3QgdWludDhfdCAqZGF0YSwgc2l6ZV90IHNpemUpIHsKKyAgICBpZiAoc2l6ZSA8IDEyKSB7CisgICAgICAgIC8vIGJyb2tlbiBwYWNrZXQKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIHVpbnQ4X3QgbXNnVHlwZSA9IGRhdGFbMF0gJiAweDFmOworICAgIHVpbnQzMl90IGlkID0gdTMyYXQoJmRhdGFbNF0pOworCisgICAgY29uc3QgdWludDhfdCAqcHRyID0gJmRhdGFbMTJdOworICAgIHNpemUgLT0gMTI7CisKKyAgICB1c2luZyBuYW1lc3BhY2Ugc3RkOworICAgIHN3aXRjaChtc2dUeXBlKSB7CisgICAgICAgIGNhc2UgMTogICAgIC8vIFBpY3R1cmUgTG9zcyBJbmRpY2F0aW9uIChQTEkpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChzaXplID4gMCkgeworICAgICAgICAgICAgICAgIC8vIFBMSSBkb2VzIG5vdCBuZWVkIHBhcmFtZXRlcnMKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH07CisgICAgICAgICAgICBzcDxBTWVzc2FnZT4gbm90aWZ5ID0gcy0+bU5vdGlmeU1zZy0+ZHVwKCk7CisgICAgICAgICAgICBub3RpZnktPnNldEludDMyKCJydGNwLWV2ZW50IiwgMSk7CisgICAgICAgICAgICBub3RpZnktPnNldEludDMyKCJwYXlsb2FkLXR5cGUiLCAyMDYpOworICAgICAgICAgICAgbm90aWZ5LT5zZXRJbnQzMigiZmVlZGJhY2stdHlwZSIsIG1zZ1R5cGUpOworICAgICAgICAgICAgbm90aWZ5LT5zZXRJbnQzMigic2VuZGVyIiwgaWQpOworICAgICAgICAgICAgbm90aWZ5LT5wb3N0KCk7CisgICAgICAgICAgICBBTE9HSSgiUExJIGRldGVjdGVkLiIpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSA0OiAgICAgLy8gRnVsbCBJbnRyYSBSZXF1ZXN0IChGSVIpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChzaXplIDwgNCkgeworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdWludDMyX3QgcmVxdWVzdGVkSWQgPSB1MzJhdCgmcHRyWzBdKTsKKyAgICAgICAgICAgIGlmIChyZXF1ZXN0ZWRJZCA9PSAodWludDMyX3QpbVNlbGZJRCkgeworICAgICAgICAgICAgICAgIHNwPEFNZXNzYWdlPiBub3RpZnkgPSBzLT5tTm90aWZ5TXNnLT5kdXAoKTsKKyAgICAgICAgICAgICAgICBub3RpZnktPnNldEludDMyKCJydGNwLWV2ZW50IiwgMSk7CisgICAgICAgICAgICAgICAgbm90aWZ5LT5zZXRJbnQzMigicGF5bG9hZC10eXBlIiwgMjA2KTsKKyAgICAgICAgICAgICAgICBub3RpZnktPnNldEludDMyKCJmZWVkYmFjay10eXBlIiwgbXNnVHlwZSk7CisgICAgICAgICAgICAgICAgbm90aWZ5LT5zZXRJbnQzMigic2VuZGVyIiwgaWQpOworICAgICAgICAgICAgICAgIG5vdGlmeS0+cG9zdCgpOworICAgICAgICAgICAgICAgIEFMT0dJKCJGSVIgZGV0ZWN0ZWQuIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBkZWZhdWx0OgorICAgICAgICB7CisgICAgICAgICAgICBBTE9HSSgiTm90IHN1cHBvcnRlZCBQU0ZCIHR5cGUgJWQiLCBtc2dUeXBlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIDA7Cit9CiBzcDxBUlRQU291cmNlPiBBUlRQQ29ubmVjdGlvbjo6ZmluZFNvdXJjZShTdHJlYW1JbmZvICppbmZvLCB1aW50MzJfdCBzcmNJZCkgewogICAgIHNwPEFSVFBTb3VyY2U+IHNvdXJjZTsKICAgICBzc2l6ZV90IGluZGV4ID0gaW5mby0+bVNvdXJjZXMuaW5kZXhPZktleShzcmNJZCk7CkBAIC02MzAsNiArMTExMywxNSBAQAogICAgICAgICBzb3VyY2UgPSBuZXcgQVJUUFNvdXJjZSgKICAgICAgICAgICAgICAgICBzcmNJZCwgaW5mby0+bVNlc3Npb25EZXNjLCBpbmZvLT5tSW5kZXgsIGluZm8tPm1Ob3RpZnlNc2cpOwogCisgICAgICAgIGlmIChtRmxhZ3MgJiBrVmlMVEVDb25uZWN0aW9uKSB7CisgICAgICAgICAgICBzZXRTdGF0aWNKaXR0ZXJUaW1lTXMoNTApOworICAgICAgICAgICAgc291cmNlLT5zZXRQZXJpb2RpY0ZJUihmYWxzZSk7CisgICAgICAgIH0KKworICAgICAgICBzb3VyY2UtPnNldFNlbGZJRChtU2VsZklEKTsKKyAgICAgICAgc291cmNlLT5zZXRTdGF0aWNKaXR0ZXJUaW1lTXMobVN0YXRpY0ppdHRlclRpbWVNcyk7CisgICAgICAgIHNwPEFNZXNzYWdlPiB0aW1lciA9IG5ldyBBTWVzc2FnZShrV2hhdEFsYXJtU3RyZWFtLCB0aGlzKTsKKyAgICAgICAgc291cmNlLT5zZXRKYlRpbWVyKHRpbWVyKTsKICAgICAgICAgaW5mby0+bVNvdXJjZXMuYWRkKHNyY0lk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lOb3RpZnlUaW1lVXMgPSBub3dVczsKKworICAgICAgICBMaXN0PFN0cmVhbUluZm8+OjppdGVyYXRvciBpdCA9IG1TdHJlYW1zLmJlZ2luKCk7CisgICAgICAgIHdoaWxlIChpdCAhPSBtU3RyZWFtcy5lbmQoKSkgeworICAgICAgICAgICAgU3RyZWFtSW5mbyAqcyA9ICYqaXQ7CisgICAgICAgICAgICBpZiAocy0+bUlzSW5qZWN0ZWQpIHsKKyAgICAgICAgICAgICAgICArK2l0OworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBzLT5tU291cmNlcy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgICAgIHNwPEFSVFBTb3VyY2U+IHNvdXJjZSA9IHMtPm1Tb3VyY2VzLnZhbHVlQXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKHNvdXJjZS0+aXNOZWVkVG9FYXJseU5vdGlmeSgpKSB7CisgICAgICAgICAgICAgICAgICAgIHNvdXJjZS0+bm90aWZ5UGt0SW5mbyhiaXRyYXRlLCBub3dVcywgZmFsc2UgLyogaXNSZWd1bGFyICovKTsKKyAgICAgICAgICAgICAgICAgICAgbUxhc3RFYXJseU5vdGlmeVRpbWVVcyA9IG5vd1VzICsgKDEwMDAwMDBsbCAqIDM2MDAgKiAyNCk7IC8vIGFmdGVyIDEgZGF5CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgKytpdDsKKyAgICAgICAgfQorICAgIH0KKyAgICBlbHNlIGlmIChtTGFzdEJpdHJhdGVSZXBvcnRUaW1lVXMgKyAxMDAwMDAwbGwgPD0gbm93VXMpIHsKKyAgICAgICAgaW50MzJfdCB0aW1lRGlmZiA9IChub3dVcyAtIG1MYXN0Qml0cmF0ZVJlcG9ydFRpbWVVcykgLyAxMDAwMDAwbGw7CisgICAgICAgIGludDMyX3QgYml0cmF0ZSA9IG1DdW11bGF0aXZlQnl0ZXMgKiA4IC8gdGltZURpZmY7CisgICAgICAgIEFMT0dJKCJBY3R1YWwgUnggYml0cmF0ZSA6ICVkIGJpdHMvc2VjIiwgYml0cmF0ZSk7CisKKyAgICAgICAgc3A8QUJ1ZmZlcj4gYnVmZmVyID0gbmV3IEFCdWZmZXIoa01heFVEUFNpemUpOworICAgICAgICBMaXN0PFN0cmVhbUluZm8+OjppdGVyYXRvciBpdCA9IG1TdHJlYW1zLmJlZ2luKCk7CisgICAgICAgIHdoaWxlIChpdCAhPSBtU3RyZWFtcy5lbmQoKSkgeworICAgICAgICAgICAgU3RyZWFtSW5mbyAqcyA9ICYqaXQ7CisgICAgICAgICAgICBpZiAocy0+bUlzSW5qZWN0ZWQpIHsKKyAgICAgICAgICAgICAgICArK2l0OworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAocy0+bU51bVJUQ1BQYWNrZXRzUmVjZWl2ZWQgPT0gMCkgeworICAgICAgICAgICAgICAgIC8vIFdlIGhhdmUgbmV2ZXIgcmVjZWl2ZWQgYW55IFJUQ1AgcGFja2V0cyBvbiB0aGlzIHN0cmVhbSwKKyAgICAgICAgICAgICAgICAvLyB3ZSBkb24ndCBldmVuIGtub3cgd2hlcmUgdG8gc2VuZCBhIHJlcG9ydC4KKyAgICAgICAgICAgICAgICArK2l0OworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBidWZmZXItPnNldFJhbmdlKDAsIDApOworICAgICAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBzLT5tU291cmNlcy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgICAgIHNwPEFSVFBTb3VyY2U+IHNvdXJjZSA9IHMtPm1Tb3VyY2VzLnZhbHVlQXQoaSk7CisgICAgICAgICAgICAgICAgc291cmNlLT5ub3RpZnlQa3RJbmZvKGJpdHJhdGUsIG5vd1VzLCB0c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dGltZSBhZGp1c3RlZC4KKyAgICAgICAgbUppdHRlckNhbGMtPmluaXQobUZpcnN0UnRwVGltZSwgbVN5c0FuY2hvclRpbWUsIDAsIG1TdGF0aWNKYlRpbWVNcyAqIDEwMDApOworICAgIH0KK30KKworYm9vbCBBUlRQU291cmNlOjpxdWV1ZVBhY2tldChjb25zdCBzcDxBQnVmZmVyPiAmYnVmZmVyKSB7CisgICAgaW50NjRfdCBub3dVcyA9IEFMb29wZXI6OkdldE5vd1VzKCk7CisgICAgdWludDMyX3Qgc2VxTnVtID0gKHVpbnQzMl90KWJ1ZmZlci0+aW50MzJEYXRhKCk7CisgICAgaW50MzJfdCBzc3JjID0gMCwgcnRwVGltZSA9IDA7CisKKyAgICBidWZmZXItPm1ldGEoKS0+ZmluZEludDMyKCJzc3JjIiwgJnNzcmMpOworICAgIENIRUNLKGJ1ZmZlci0+bWV0YSgpLT5maW5kSW50MzIoInJ0cC10aW1lIiwgKGludDMyX3QgKikmcnRwVGltZSkpOworICAgIG1MYXRlc3RSdHBUaW1lID0gcnRwVGltZTsKKworICAgIGlmIChtTnVtQnVmZmVyc1JlY2VpdmVkKysgPT0gMCAmJiBtRmlyc3RTeXNUaW1lID09IDApIHsKKyAgICAgICAgbUZpcnN0U3lzVGltZSA9IG5vd1VzOworICAgICAgICBtU3lzQW5jaG9yVGltZSA9IG5vd1VzOworICAgICAgICBtTGFzdFN5c0FuY2hvclRpbWVVcGRhdGVkVXMgPSBub3dVczsKICAgICAgICAgbUhpZ2hlc3RTZXFOdW1iZXIgPSBzZXFOdW07CiAgICAgICAgIG1CYXNlU2VxTnVtYmVyID0gc2VxTnVtOworICAgICAgICBtRmlyc3RSdHBUaW1lID0gcnRwVGltZTsKKyAgICAgICAgbUZpcnN0U3NyYyA9IHNzcmM7CisgICAgICAgIEFMT0dEKCJmaXJzdC1ydHAgYXJyaXZlZDogZmlyc3QtcnRwLXRpbWU9JXUsIHN5cy10aW1lPSVsbGQsIHNlcS1udW09JXUsIHNz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4+IDE1KTsKKyAgICBkYXRhWzE3XSA9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobWFudGlzc2EgJiAweDA3ZjgwKSA+PiA3OworICAgIGRhdGFbMThdID0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIChtYW50aXNzYSAmIDB4MDAwN2YpIDw8IDE7CisgICAgZGF0YVsxOV0gPSA0MDsgICAgICAgICAgICAgIC8vIDQwIGJ5dGVzIG92ZXJoZWFkOworCisgICAgYnVmZmVyLT5zZXRSYW5nZShidWZmZXItPm9mZnNldCgpLCBidWZmZXItPnNpemUoKSArIChkYXRhWzNdICsgMSkgKiBzaXplb2YoaW50MzJfdCkpOworCisgICAgQUxPR0koIlVFIC0+IE9wIFJlcSBSeCBiaXRyYXRlIDogJWQgIiwgbWFudGlzc2EgPDwgcmlnaHRFbmQpOworfQorCitpbnQgQVJUUFNvdXJjZTo6YWRkTkFDSyhjb25zdCBzcDxBQnVmZmVyPiAmYnVmZmVyKSB7CisgICAgY29uc3RleHByIHNpemVfdCBrTWF4RkNJcyA9IDEwOyAvLyBtYXggbnVtYmVyIG9mIEZDSXMKKyAgICBpZiAoYnVmZmVyLT5zaXplKCkgKyAoMyArIGtNYXhGQ0lzKSAqIHNpemVvZihpbnQzMl90KSA+IGJ1ZmZlci0+Y2FwYWNpdHkoKSkgeworICAgICAgICBBTE9HVygiUlRDUCBidWZmZXIgdG9vIHNtYWxsIHRvIGFjY29tbW9kYXRlIE5BQ0suIik7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICB1aW50OF90ICpkYXRhID0gYnVmZmVyLT5kYXRhKCkgKyBidWZmZXItPnNpemUoKTsKKworICAgIGRhdGFbMF0gPSAweDgwIHwgMTsgLy8gR2VuZXJpYyBOQUNLCisgICAgZGF0YVsxXSA9IDIwNTsgICAgICAvLyBUU0ZCCisgICAgZGF0YVsyXSA9IDA7CisgICAgZGF0YVszXSA9IDA7ICAgICAgICAvLyB3aWxsIGJlIGRlY2lkZW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ICAgaW50IGNudCA9IDA7CisKKyAgICBzdGQ6Om1hcDx1aW50MTZfdCwgaW5mb05BQ0s+OjppdGVyYXRvciBpdDsKKyAgICBmb3IoaXQgPSBtTkFDS01hcC5iZWdpbigpOyBpdCAhPSBtTkFDS01hcC5lbmQoKSAmJiBjbnQgPCBzaXplOyBpdCsrKSB7CisgICAgICAgIGluZm9OQUNLICZpbmZvX2l0ID0gaXQtPnNlY29uZDsKKyAgICAgICAgaWYgKGluZm9faXQubmVlZFRvTkFDSykgeworICAgICAgICAgICAgaW5mb19pdC5uZWVkVG9OQUNLID0gZmFsc2U7CisgICAgICAgICAgICAvLyBzd2l0Y2ggTFNCIHRvIE1TQiBmb3Igc2VuZGluZyBOL1cKKyAgICAgICAgICAgIHVpbnQzMl90IEZDSTsKKyAgICAgICAgICAgIHVpbnQ4X3QgKnRlbXAgPSAodWludDhfdCAqKSZGQ0k7CisgICAgICAgICAgICB0ZW1wWzBdID0gKGluZm9faXQuc2VxTnVtID4+IDgpICYgMHhmZjsKKyAgICAgICAgICAgIHRlbXBbMV0gPSAoaW5mb19pdC5zZXFOdW0pICAgICAgJiAweGZmOworICAgICAgICAgICAgdGVtcFsyXSA9IChpbmZvX2l0Lm1hc2sgPj4gOCkgICAmIDB4ZmY7CisgICAgICAgICAgICB0ZW1wWzNdID0gKGluZm9faXQubWFzaykgICAgICAgICYgMHhmZjsKKworICAgICAgICAgICAgbGlzdC5wdXNoX2JhY2soRkNJKTsKKyAgICAgICAgICAgIGNudCsrOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIGNudDsKK30KKwordm9pZCBBUlRQU291cmNlOjpzZXRTZXFOdW1Ub05BQ0sodWludDE2X3Qgc2VxTnVtLCB1aW50MTZfdCBtYXNrLCB1aW50MTZfdCBub3dKaXR0ZXJIZWFkU2VxTnVtKSB7CisgICAgQXV0b011dGV4IF9sKG1NYXBMb2NrKTsKKyAgICBpbmZvTkFDSyBpbmZvID0ge3NlcU51bSwgbWFzaywgb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nRwIHdyaXRlciIpOwogICAgIG1Mb29wZXItPnJlZ2lzdGVySGFuZGxlcihtUmVmbGVjdG9yKTsKICAgICBtTG9vcGVyLT5zdGFydCgpOwogCi0gICAgbVNvY2tldCA9IHNvY2tldChBRl9JTkVULCBTT0NLX0RHUkFNLCAwKTsKLSAgICBDSEVDS19HRShtU29ja2V0LCAwKTsKKyAgICBtUlRQU29ja2V0ID0gc29ja2V0KEFGX0lORVQsIFNPQ0tfREdSQU0sIDApOworICAgIENIRUNLX0dFKG1SVFBTb2NrZXQsIDApOworICAgIG1SVENQU29ja2V0ID0gc29ja2V0KEFGX0lORVQsIFNPQ0tfREdSQU0sIDApOworICAgIENIRUNLX0dFKG1SVENQU29ja2V0LCAwKTsKIAogICAgIG1lbXNldChtUlRQQWRkci5zaW5femVybywgMCwgc2l6ZW9mKG1SVFBBZGRyLnNpbl96ZXJvKSk7CiAgICAgbVJUUEFkZHIuc2luX2ZhbWlseSA9IEFGX0lORVQ7CkBAIC03Miw2ICsxMDUsNDYgQEAKIAogICAgIG1SVENQQWRkciA9IG1SVFBBZGRyOwogICAgIG1SVENQQWRkci5zaW5fcG9ydCA9IGh0b25zKG50b2hzKG1SVFBBZGRyLnNpbl9wb3J0KSB8IDEpOworICAgIG1TUFNCdWYgPSBOVUxMOworICAgIG1QUFNCdWYgPSBOVUxMOworCisjaWYgTE9HX1RPX0ZJTEVTCisgICAgbVJUUEZkID0gb3BlbigKKyAgICAgICAgICAgICIvZGF0YS9taXNjL3J0cG91dC5iaW4iLAorICAgICAgICAgICAgT19XUk9OTFkgfCBPX0NSRUFUIHwgT19UUlVOQywKKyAgICAgICAgICAgIDA2NDQpOworICAgIENIRUNLX0dFKG1SVFBGZCwgMCk7CisKKyAgICBtUlRDUEZkID0gb3BlbigKKyAgICAgICAgICAgICIvZGF0YS9taXNjL3J0Y3BvdXQuYmluIiwKKyAgICAgICAgICAgIE9fV1JPTkxZIHwgT19DUkVBVCB8IE9fVFJVTkMsCisgICAgICAgIC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dCB1aW50OF90ICpOQUxQdHIgPSAoY29uc3QgdWludDhfdCAqKWJ1ZmZlci0+ZGF0YSgpICsgYnVmZmVyLT5yYW5nZV9vZmZzZXQoKTsKKyAgICAgICAgdWludDhfdCBuYWxUeXBlID0gKCpOQUxQdHIpICYgSDI2NF9OQUxVX01BU0s7CisKKyAgICAgICAgTWVkaWFCdWZmZXJCYXNlICoqdGFyZ2V0UHRyID0gTlVMTDsKKyAgICAgICAgaWYgKG5hbFR5cGUgPT0gSDI2NF9OQUxVX1NQUykgeworICAgICAgICAgICAgdGFyZ2V0UHRyID0gc3BzQnVmZmVyOworICAgICAgICB9IGVsc2UgaWYgKG5hbFR5cGUgPT0gSDI2NF9OQUxVX1BQUykgeworICAgICAgICAgICAgdGFyZ2V0UHRyID0gcHBzQnVmZmVyOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIEFMT0dWKCJTUFMoNykgb3IgUFBTKDgpIGZvdW5kLiBUeXBlICVkIiwgbmFsVHlwZSk7CisKKyAgICAgICAgdWludDMyX3QgYnVmZmVyU2l6ZSA9IGJ1ZmZlci0+cmFuZ2VfbGVuZ3RoKCk7CisgICAgICAgIE1lZGlhQnVmZmVyQmFzZSAqJnRhcmdldCA9ICp0YXJnZXRQdHI7CisgICAgICAgIHVpbnQzMl90IGkgPSAwLCBqID0gMDsKKyAgICAgICAgYm9vbCBpc0JvdW5kRm91bmQgPSBmYWxzZTsKKyAgICAgICAgZm9yIChpID0gMDsgaSA8IGJ1ZmZlclNpemU7IGkrKykgeworICAgICAgICAgICAgd2hpbGUgKGogPiAwICYmIE5BTFB0cltpXSAhPSBzdGFydFByZWZpeENvZGVbal0pIHsKKyAgICAgICAgICAgICAgICBqID0gc3BjS01QaWR4W2ogLSAxXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChOQUxQdHJbaV0gPT0gc3RhcnRQcmVmaXhDb2RlW2pdKSB7CisgICAgICAgICAgICAgICAgaisrOworICAgICAgICAgICAgICAgIGlmIChqID09IFNQQ1NpemUpIHsKKyAgICAgICAgICAgICAgICAgICAgaXNCb3VuZEZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdWludDMyX3QgdGFyZ2V0U2l6ZTsKKyAgICAgICAgaWYgKHRhcmdldCAhPSBOVUxMKSB7CisgICAgICAgICAgICB0YXJnZXQtPnJlbGVhc2UoKTsKKyAgICAgICAgfQorICAgICAgICAvLyBub3RlIHRoYXQgdGFyZ2V0U2l6ZSBpcyBuZXZlciAwIGFzIHRoZSBmaXJzdCBieXRlIGlzIG5ldmVyIHBhcnQKKyAgICAgICAgLy8gb2YgYSBzdGFydCBwcmVmaXgKKyAgICAgICAgaWYgKGlzQm91bmRGb3VuZCkgeworICAgICAgICAgICAgdGFyZ2V0U2l6ZSA9IGkgLSBTUENTaXplICsgMTsKKyAgICAgICAgICAgIHRhcmdldCA9IE1lZGlhQnVmZmVyQmFzZTo6Q3JlYXRlKHRhcmdldFNpemUpOworICAgICAgICAgICAgbWVtY3B5KHRhcmdldC0+ZGF0YSgpLAorICAgICAgICAgICAgICAgICAgIChjb25zdCB1aW50OF90ICopYnVmZmVyLT5kYXRhKCkgKyBidWZmZXItPnJhbmdlX29mZnNldCgpLAorICAgICAgICAgICAgICAgICAgIHRhcmdldFNpemUpOworICAgICAgICAgICAgYnVmZmVyLT5zZXRfcmFuZ2UoYnVmZmVyLT5yYW5nZV9vZmZzZXQoKSArIHRhcmdldFNpemUgKyBTUENTaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyLT5yYW5nZV9sZW5ndGgoKSAtIHRhcmdldFNpemUgLSBTUENTaXplKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHRhcmdldFNpemUgPSBidWZmZXJTaXplOworICAgICAgICA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UykgeworICAgICAgICAgICAgdGFyZ2V0UHRyID0gc3BzQnVmZmVyOworICAgICAgICB9IGVsc2UgaWYgKG5hbFR5cGUgPT0gSDI2NV9OQUxVX1BQUykgeworICAgICAgICAgICAgdGFyZ2V0UHRyID0gcHBzQnVmZmVyOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIEFMT0dWKCJWUFMoMzIpIFNQUygzMykgb3IgUFBTKDM0KSBmb3VuZC4gVHlwZSAlZCIsIG5hbFR5cGUpOworCisgICAgICAgIHVpbnQzMl90IGJ1ZmZlclNpemUgPSBidWZmZXItPnJhbmdlX2xlbmd0aCgpOworICAgICAgICBNZWRpYUJ1ZmZlckJhc2UgKiZ0YXJnZXQgPSAqdGFyZ2V0UHRyOworICAgICAgICB1aW50MzJfdCBpID0gMCwgaiA9IDA7CisgICAgICAgIGJvb2wgaXNCb3VuZEZvdW5kID0gZmFsc2U7CisgICAgICAgIGZvciAoaSA9IDA7IGkgPCBidWZmZXJTaXplOyBpKyspIHsKKyAgICAgICAgICAgIHdoaWxlIChqID4gMCAmJiBOQUxQdHJbaV0gIT0gc3RhcnRQcmVmaXhDb2RlW2pdKSB7CisgICAgICAgICAgICAgICAgaiA9IHNwY0tNUGlkeFtqIC0gMV07CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoTkFMUHRyW2ldID09IHN0YXJ0UHJlZml4Q29kZVtqXSkgeworICAgICAgICAgICAgICAgIGorKzsKKyAgICAgICAgICAgICAgICBpZiAoaiA9PSBTUENTaXplKSB7CisgICAgICAgICAgICAgICAgICAgIGlzQm91bmRGb3VuZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHVpbnQzMl90IHRhcmdldFNpemU7CisgICAgICAgIGlmICh0YXJnZXQgIT0gTlVMTCkgeworICAgICAgICAgICAg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HsKKyAgICAgICAgICAgIGRhdGFbMV0gPSBtUGF5bG9hZFR5cGU7ICAvLyBNYXJrZXIgYml0IHNob3VsZCBub3QgYmUgc2V0IGluIGNhc2Ugb2YgTm9uLVZDTAorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZGF0YVsxXSA9ICgxIDw8IDcpIHwgbVBheWxvYWRUeXBlOyAgLy8gTS1iaXQKKyAgICAgICAgfQogICAgICAgICBkYXRhWzJdID0gKG1TZXFObyA+PiA4KSAmIDB4ZmY7CiAgICAgICAgIGRhdGFbM10gPSBtU2VxTm8gJiAweGZmOwogICAgICAgICBkYXRhWzRdID0gcnRwVGltZSA+PiAyNDsKQEAgLTU5OCwzNCArMTA0Niw3NSBAQAogICAgICAgICBkYXRhWzEwXSA9IChtU291cmNlSUQgPj4gOCkgJiAweGZmOwogICAgICAgICBkYXRhWzExXSA9IG1Tb3VyY2VJRCAmIDB4ZmY7CiAKLSAgICAgICAgbWVtY3B5KCZkYXRhWzEyXSwKKyAgICAgICAgaW50IHJ0cEV4dEluZGV4ID0gMDsKKyAgICAgICAgaWYgKG1SVFBDVk9FeHRNYXAgPiAwKSB7CisgICAgICAgICAgICAvKgorICAgICAgICAgICAgICAgIDAgMSAyIDMgNCA1IDYgNyA4IDkgMCAxIDIgMyA0IDUgNiA3IDggOSAwIDEgMiAzIDQgNSA2IDcgOCA5IDAgMQorICAgICAgICAgICAgICAgKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSsKKyAgICAgICAgICAgICAgIHwgICAgICAgMHhCRSAgICB8ICAgIDB4REUgICAgICAgfCAgICAgICAgICAgbGVuZ3RoPTMgICAgICAgICAgICB8CisgICAgICAgICAgICAgICArLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKworICAgICAgICAgICAgICAgfCAgSUQgICB8IEw9MCAgIHwgICAgIGRhdGEgICAgICB8ICBJRCAgIHwgIEw9MSAgfCAgIGRhdGEuLi4KKyAgICAgICAgICAgICAgICstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rCisgICAgICAgICAgICAgICAgICAgICAuLi5kYXRhICAgfCAgICAwIChwYWQpICAgIHwgICAgMCAocGFkKSAgICB8ICBJRCAgIHwgTD0zICAgfAorICAgICAgICAgICAgICAgKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSsKKyAgICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8CisgICAgICAgICAgICAgICArLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKworCisKKyAgICAgICAgICAgICAgSW4gdGhlIG9uZS1ieXRlIGhlYWRlciBmb3JtIG9mIGV4dGVuc2lvbnMsIHRoZSAxNi1iaXQgdmFsdWUgcmVxdWlyZWQKKyAgICAgICAgICAgICAgYnkgdGhlIFJUUCBzcGVjaWZpY2F0aW9uIGZvciBhIGhlYWRlciBleHRlbnNpb24sIGxhYmVsZWQgaW4gdGhlIFJUUAorICAgICAgICAgICAgICBzcGVjaWZpY2F0aW9uIGFzICJkZWZpbmVkIGJ5IHByb2ZpbGUiLCB0YWtlcyB0aGUgZml4ZWQgYml0IHBhdHRlcm4KKyAgICAgICAgICAgICAgMHhCRURFICh0aGUgZmlyc3QgdmVyc2lvbiBvZiB0aGlzIHNwZWNpZmljYXRpb24gd2FzIHdyaXR0ZW4gb24gdGhlCisgICAgICAgICAgICAgIGZlYXN0IGRheSBvZiB0aGUgVmVuZXJhYmxlIEJlZGUpLgorICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIGRhdGFbMTJdID0gMHhCRTsKKyAgICAgICAgICAgIGRhdGFbMTNdID0gMHhERTsKKyAgICAgICAgICAgIC8vIHB1dCBhIGxlbmd0aCBvZiBSVFAgRXh0ZW5zaW9uLgorICAgICAgICAgICAgZGF0YVsxNF0gPSAweDAwOworICAgICAgICAgICAgZGF0YVsxNV0gPSAweDAxOworICAgICAgICAgICAgLy8gcHV0IGV4dG1hcCBvZiBSVFAgYXNzaWduZWQgZm9yIENWTy4KKyAgICAgICAgICAgIGRhdGFbMTZdID0gKG1SVFBDVk9FeHRNYXAgPDwgNCkgfCAweDA7CisgICAgICAgICAgICAvLyBwdXQgaW1hZ2UgZGVncmVlcyBhcyBwZXIgQ1ZPIHNwZWNpZmljYXRpb24uCisgICAgICAgICAgICBkYXRhWzE3XSA9IG1SVFBDVk9EZWdyZWVzOworICAgICAgICAgICAgZGF0YVsxOF0gPSAweDA7CisgICAgICAgICAgICBkYXRhWzE5XSA9IDB4MDsKKyAgICAgICAgICAgIHJ0cEV4dEluZGV4ID0gODsKKyAgICAgICAgfQorCisgICAgICAgIG1lbWNweSgmZGF0YVsxMiArIHJ0cEV4dEluZGV4XSwKICAgICAgICAgICAgICAgIG1lZGlhRGF0YSwgbWVkaWFCdWYtPnJhbmdlX2xlbmd0aCgpKTsKIAotICAgICAgICBidWZmZXItPnNldFJhbmdlKDAsIG1lZGlhQnVmLT5yYW5nZV9sZW5ndGgoKSArIDEyKTsKKyAgICAgICAgYnVmZmVyLT5zZXRSYW5nZSgwLCBtZWRpYUJ1Zi0+cmFuZ2VfbGVuZ3RoKCkgKyAoMTIgKyBydHBFeHRJbmRleCkpOwogCiAgICAgICAgIHNlbmQoYnVmZmVyLCBmYWxzZSAvKiBpc1JUQ1AgKi8pOwogCiAgICAgICAgICsrbVNlcU5vOwogICAgICAgICArK21OdW1SVFBTZW50OwotICAgICAgICBtTnVtUlRQT2N0ZXRzU2VudCArPSBidWZmZXItPnNpemUoKSAtIDEyOworICAgICAgICBtTnVtUlRQ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jYXBhY2l0eSgpIC0gMTIgLSAyOworICAgICAgICAgICAgICAgIHNpemUgPSBidWZmZXItPmNhcGFjaXR5KCkgLSBUQ1BJUF9IRUFERVJfU0laRSAtIFJUUF9IRUFERVJfU0laRSAtCisgICAgICAgICAgICAgICAgICAgIFJUUF9IRUFERVJfRVhUX1NJWkUgLSBSVFBfRlVfSEVBREVSX1NJWkUgLSBSVFBfUEFZTE9BRF9ST09NX1NJWkU7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIHVpbnQ4X3QgKmRhdGEgPSBidWZmZXItPmRhdGEoKTsKICAgICAgICAgICAgIGRhdGFbMF0gPSAweDgwOwotICAgICAgICAgICAgZGF0YVsxXSA9IChsYXN0UGFja2V0ID8gKDEgPDwgNykgOiAweDAwKSB8IFBUOyAgLy8gTS1iaXQKKyAgICAgICAgICAgIGlmIChsYXN0UGFja2V0ICYmIG1SVFBDVk9FeHRNYXAgPiAwKSB7CisgICAgICAgICAgICAgICAgZGF0YVswXSB8PSAweDEwOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZGF0YVsxXSA9IChsYXN0UGFja2V0ID8gKDEgPDwgNykgOiAweDAwKSB8IG1QYXlsb2FkVHlwZTsgIC8vIE0tYml0CiAgICAgICAgICAgICBkYXRhWzJdID0gKG1TZXFObyA+PiA4KSAmIDB4ZmY7CiAgICAgICAgICAgICBkYXRhWzNdID0gbVNlcU5vICYgMHhmZjsKICAgICAgICAgICAgIGRhdGFbNF0gPSBydHBUaW1lID4+IDI0OwpAQCAtNjM3LDMyICsxMTI2LDI0NyBAQAogICAgICAgICAgICAgZGF0YVsxMF0gPSAobVNvdXJjZUlEID4+IDgpICYgMHhmZjsKICAgICAgICAgICAgIGRhdGFbMTFdID0gbVNvdXJjZUlEICYgMHhmZjsKIAotICAgICAgICAgICAgZGF0YVsxMl0gPSAyOCB8IChuYWxUeXBlICYgMHhlMCk7CisgICAgICAgICAgICBpbnQgcnRwRXh0SW5kZXggPSAwOworICAgICAgICAgICAgaWYgKGxhc3RQYWNrZXQgJiYgbVJUUENWT0V4dE1hcCA+IDApIHsKKyAgICAgICAgICAgICAgICBkYXRhWzEyXSA9IDB4QkU7CisgICAgICAgICAgICAgICAgZGF0YVsxM10gPSAweERFOworICAgICAgICAgICAgICAgIGRhdGFbMTRdID0gMHgwMDsKKyAgICAgICAgICAgICAgICBkYXRhWzE1XSA9IDB4MDE7CisgICAgICAgICAgICAgICAgZGF0YVsxNl0gPSAobVJUUENWT0V4dE1hcCA8PCA0KSB8IDB4MDsKKyAgICAgICAgICAgICAgICBkYXRhWzE3XSA9IG1SVFBDVk9EZWdyZWVzOworICAgICAgICAgICAgICAgIGRhdGFbMThdID0gMHgwOworICAgICAgICAgICAgICAgIGRhdGFbMTldID0gMHgwOworICAgICAgICAgICAgICAgIHJ0cEV4dEluZGV4ID0gODsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLyogIEgyNjUgcGF5bG9hZCBoZWFkZXIgaXMgMTYgYml0CisgICAgICAgICAgICAgICAgIDAgMSAyIDMgNCA1IDYgNyAwIDEgMiAzIDQgNSA2IDcKKyAgICAgICAgICAgICAgICArLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSsKKyAgICAgICAgICAgICAgICB8RnwgICAgVHlwZSAgIHwgIExheWVyIElEIHwgVElEIHwKKyAgICAgICAgICAgICAgICArLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSsKKyAgICAgICAgICAgICovCisgICAgICAgICAgICBBTE9HVigiSDI2NSBwYXlsb2FkIGhlYWRlciAweCV4ICV4IiwgbWVkaWFEYXRhWzBdLCBtZWRpYURhdGFbMV0pOworICAgICAgICAgICAgLy8gZXhjbHVkZXMgVHlwZSBmcm9tIDFzdCBieXRlIG9mIEgyNjUgcGF5bG9hZCBoZWFkZXIuCisgICAgICAgICAgICBkYXRhWzEyICsgcnRwRXh0SW5kZXhdID0gbWVkaWFEYXRhWzBdICYgMHg4MTsKKyAgICAgICAgICAgIC8vIGZpbGxzIFR5cGUgYXMgRlUgKDQ5ID09IDB4MzEpCisgICAgICAgICAgICBkYXRhWzEyICsgcnRwRXh0SW5kZXhdID0gZGF0YVsxMiArIHJ0cEV4dEluZGV4XSB8ICgweDMxIDw8IDEpOworICAgICAgICAgICAgZGF0YVsxMyArIHJ0cEV4dEluZGV4XSA9IG1lZGlhRGF0YVsxXTsKKworICAgICAgICAgICAgQUxPR1YoIkgyNjUgRlUgaGVhZGVyIDB4JXggJXgiLCBkYXRhWzEyICsgcnRwRXh0SW5kZXhdLCBkYXRhWzEzICsgcnRwRXh0SW5kZXhdKTsKIAogICAgICAgICAgICAgQ0hFQ0soIWZpcnN0UGFja2V0IHx8ICFsYXN0UGFja2V0KTsKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgICAgRlUgSU5ESUNBVE9SIEhEUgorICAgICAgICAgICAgICAgICAwIDEgMiAzIDQgNSA2IDcKKyAgICAgICAgICAgICAgICArLSstKy0rLSstKy0rLSstKworICAgICAgICAgICAgICAgIHxTfEV8ICAgVHlwZSAgICB8CisgICAgICAgICAgICAgICAgKy0rLSstKy0rLSstKy0rLSsKKyAgICAgICAgICAgICovCiAKLSAgICAgICAgICAgIGRhdGFbMTNdID0KKyAgICAgICAgICAgIGRhdGFbMTQgKyBydHBFeHRJbmRleF0gPQogICAgICAgICAgICAgICAgIChmaXJzdFBhY2tldCA/IDB4ODAgOiAweDAwKQogICAgICAgICAgICAgICAgIHwgKGxhc3RQYWNrZXQgPyAweDQwIDogMHgwMCkKLSAgICAgICAgICAgICAgICB8IChuYWxUeXBlICYgMHgxZik7CisgICAgICAgICAgICAgICAgfCAobmFsVHlwZSAmIEgyNjVfTkFMVV9NQVNLKTsKKyAgICAgICAgICAgIEFMT0dWKCJIMjY1IEZVIGluZGljYXRvciAweCV4IiwgZGF0YVsxNF0pOwogCi0gICAgICAgICAgICBtZW1jcHkoJmRhdGFbMTRdLCAmbWVkaWFEYXRhW29mZnNldF0sIHNpemUpOworICAgICAgICAgICAgbWVtY3B5KCZkYXRhWzE1ICsgcnRwRXh0SW5kZXhdLCAmbWVkaWFEYXRhW29mZnNldF0sIHNpemUpOwogCi0gICAgICAgICAgICBidWZmZXItPnNldFJhbmdlKDAsIDE0ICsgc2l6ZSk7CisgICAgICAgICAgICBidWZmZXItPnNldFJhbmdlKDAsIDE1ICsgcnRwRXh0SW5kZXggKyBzaXplKTsKIAogICAgICAgICAgICAgc2VuZChidWZmZXIsIGZhbHNlIC8qIGlzUlRDUCAqLyk7CiAKICAgICAgICAgICAgICsrbVNlcU5vOwogICAgICAgICAgICAgKyttTnVtUlRQU2VudDsKLSAgICAgICAgICAgIG1OdW1SVFBPY3RldHNTZW50ICs9IGJ1ZmZlci0+c2l6ZSgpIC0gMTI7CisgICAgICAgICAgICBtTnVtUlRQT2N0ZXRzU2VudCArPSBidWZmZXItPnNpemUoKSAtICgxMiArIHJ0cEV4dEluZGV4KTsKIAogICAgICAgICAgICAgZmlyc3RQYWNrZXQgPSBmYWxzZTsKICAgICAgICAgICAgIG9mZnNldCArPSBzaXplOwogICAgICAgICB9CiAgICAgfQorfQogCi0gICAgbUxhc3RSVFBUaW1lID0gcnRwVGltZTsKLSAgICBtTGFzdE5UUFRpbWUgPSBHZXROb3dOVFAoKTsKK3ZvaWQgQVJUUFdyaXRlcjo6c2VuZEFWQ0RhdGEoTWVkaWFCdWZmZXJCYXNlICptZWRpYUJ1ZikgeworICAgIC8vIDEyIGJ5dGVzIFJUUCBoZWFkZXIgKyAyIGJ5dGVzIGZvciB0aGUgRlUtaW5kaWNhdG9yIGFuZCBGVS1oZWFkZXIuCisgICAgQ0hFQ0tfR0Uoa01heFBhY2tldFNpemUsIDEydSArIDJ1KTsKKworICAgIGludDY0X3QgdGltZVVzOworICAgIENIRUNLKG1lZGlhQnVmLT5tZXRhX2RhdGEoKS5maW5kSW50NjQoa0tleVRpbWUsICZ0aW1lVXMpKTsKKworICAgIHNlbmRTUFNQUFNJZklGcmFtZShtZWRpY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Vk9FeHRNYXAgPiAwKSB7CisgICAgICAgICAgICBkYXRhWzBdIHw9IDB4MTA7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGlzU3BzUHBzKSB7CisgICAgICAgICAgICBkYXRhWzFdID0gbVBheWxvYWRUeXBlOyAgLy8gTWFya2VyIGJpdCBzaG91bGQgbm90IGJlIHNldCBpbiBjYXNlIG9mIHNwcy9wcHMKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGRhdGFbMV0gPSAoMSA8PCA3KSB8IG1QYXlsb2FkVHlwZTsKKyAgICAgICAgfQorICAgICAgICBkYXRhWzJdID0gKG1TZXFObyA+PiA4KSAmIDB4ZmY7CisgICAgICAgIGRhdGFbM10gPSBtU2VxTm8gJiAweGZmOworICAgICAgICBkYXRhWzRdID0gcnRwVGltZSA+PiAyNDsKKyAgICAgICAgZGF0YVs1XSA9IChydHBUaW1lID4+IDE2KSAmIDB4ZmY7CisgICAgICAgIGRhdGFbNl0gPSAocnRwVGltZSA+PiA4KSAmIDB4ZmY7CisgICAgICAgIGRhdGFbN10gPSBydHBUaW1lICYgMHhmZjsKKyAgICAgICAgZGF0YVs4XSA9IG1Tb3VyY2VJRCA+PiAyNDsKKyAgICAgICAgZGF0YVs5XSA9IChtU291cmNlSUQgPj4gMTYpICYgMHhmZjsKKyAgICAgICAgZGF0YVsxMF0gPSAobVNvdXJjZUlEID4+IDgpICYgMHhmZjsKKyAgICAgICAgZGF0YVsxMV0gPSBtU291cmNlSUQgJiAweGZmOworCisgICAgICAgIGludCBydHBFeHRJbmRleCA9IDA7CisgICAgICAgIGlmIChtUlRQQ1ZPRXh0TWFwID4gMCkgeworICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICAgICAwIDEgMiAzIDQgNSA2IDcgOCA5IDAgMSAyIDMgNCA1IDYgNyA4IDkgMCAxIDIgMyA0IDUgNiA3IDggOSAwIDEKKyAgICAgICAgICAgICAgICstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rCisgICAgICAgICAgICAgICB8ICAgICAgIDB4QkUgICAgfCAgICAweERFICAgICAgIHwgICAgICAgICAgIGxlbmd0aD0zICAgICAgICAgICAgfAorICAgICAgICAgICAgICAgKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSsKKyAgICAgICAgICAgICAgIHwgIElEICAgfCBMPTAgICB8ICAgICBkYXRhICAgICAgfCAgSUQgICB8ICBMPTEgIHwgICBkYXRhLi4uCisgICAgICAgICAgICAgICArLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKworICAgICAgICAgICAgICAgICAgICAgLi4uZGF0YSAgIHwgICAgMCAocGFkKSAgICB8ICAgIDAgKHBhZCkgICAgfCAgSUQgICB8IEw9MyAgIHwKKyAgICAgICAgICAgICAgICstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rCisgICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfAorICAgICAgICAgICAgICAgKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSstKy0rLSsKKworCisgICAgICAgICAgICAgIEluIHRoZSBvbmUtYnl0ZSBoZWFkZXIgZm9ybSBvZiBleHRlbnNpb25zLCB0aGUgMTYtYml0IHZhbHVlIHJlcXVpcmVkCisgICAgICAgICAgICAgIGJ5IHRoZSBSVFAgc3BlY2lmaWNhdGlvbiBmb3IgYSBoZWFkZXIgZXh0ZW5zaW9uLCBsYWJlbGVkIGluIHRoZSBSVFAKKyAgICAgICAgICAgICAgc3BlY2lmaWNhdGlvbiBhcyAiZGVmaW5lZCBieSBwcm9maWxlIiwgdGFrZXMgdGhlIGZpeGVkIGJpdCBwYXR0ZXJuCisgICAgICAgICAgICAgIDB4QkVERSAodGhlIGZpcnN0IHZlcnNpb24gb2YgdGhpcyBzcGVjaWZpY2F0aW9uIHdhcyB3cml0dGVuIG9uIHRoZQorICAgICAgICAgICAgICBmZWFzdCBkYXkgb2YgdGhlIFZlbmVyYWJsZSBCZWRlKS4KKyAgICAgICAgICAgICovCisgICAgICAgICAgICBkYXRhWzEyXSA9IDB4QkU7CisgICAgICAgICAgICBkYXRhWzEzXSA9IDB4REU7CisgICAgICAgICAgICAvLyBwdXQgYSBsZW5ndGggb2YgUlRQIEV4dGVuc2lvbi4KKyAgICAgICAgICAgIGRhdGFbMTRdID0gMHgwMDsKKyAgICAgICAgICAgIGRhdGFbMTVdID0gMHgwMTsKKyAgICAgICAgICAgIC8vIHB1dCBleHRtYXAgb2YgUlRQIGFzc2lnbmVkIGZvciBDVk8uCisgICAgICAgICAgICBkYXRhWzE2XSA9IChtUlRQQ1ZPRXh0TWFwIDw8IDQpIHwgMHgwOworICAgICAgICAgICAgLy8gcHV0IGltYWdlIGRlZ3JlZXMgYXMgcGVyIENWTyBzcGVjaWZpY2F0aW9uLgorICAgICAgICAgICAgZGF0YVsxN10gPSBtUlRQQ1ZPRGVncmVlczsKKyAgICAgICAgICAgIGRhdGFbMThdID0gMHgwOworICAgICAgICAgICAgZGF0YVsxOV0gPSAweDA7CisgICAgICAgICAgICBydHBFeHRJbmRleCA9IDg7CisgICAgICAgIH0KKworICAgICAgICBtZW1jcHkoJmRhdGFbMTIgKyBydHBFeHRJbmRleF0sCisgICAgICAgICAgICAgICBtZWRpYURhdGEsIG1lZGlhQnVmLT5yYW5nZV9sZW5ndGgoKSk7CisKKyAgICAgICAgYnVmZmVyLT5zZXRSYW5nZSgwLCBtZWRpYUJ1Zi0+cmFuZ2VfbGVuZ3RoKCkgKyAoMTIgKyBydHBFeHRJbmRleCkpOworCisgICAgICAgIHNlbmQoYnVmZmVyLCBmYWxzZSAvKiBpc1JUQ1AgKi8pOworCisgICAgICAgICsrbVNlcU5vOworICAgICAgICArK21OdW1SVFBTZW50OworICAgICAgICBtTnVtUlRQT2N0ZXRzU2VudCArPSBidWZmZXItPnNpemUoKSAtICgxMiArIHJ0cEV4dEluZGV4KTsKKyAgICB9IGVsc2UgeworICAgICAgICAvLyBGVS1BCisKKyAgICAgICAgdW5zaWduZWQgbmFsVHlwZSA9IG1lZGlhRGF0YVswXSAmIEgyNjRfTkFMVV9NQVNLOworICAgICAgICBBTE9HVigiSDI2NCBuYWxUeXBlIDB4JXgsIGRhdGFbMF09MHgleCIsIG5hbFR5cGUsIG1lZGlhRGF0YVswXSk7CisgICAgICAgIHNpemVfdCBvZmZzZXQgPSAxOworCisgICAgICAgIGJvb2wgZmlyc3RQYWNrZXQgPSB0cnVlOworICAgICAgICB3aGlsZSAob2Zmc2V0IDwgbWVkaWFCdWYtPnJhbmdlX2xlbmd0aCgpKSB7CisgICAgICAgICAgICBzaXplX3Qgc2l6ZSA9IG1lZGlhQnVmLT5yYW5nZV9sZW5ndGgoKSAtIG9mZnNldDsKKyAgICAgICAgICAgIGJvb2wgbGFzdFBhY2tldCA9IHRydWU7CisgICAgICAgICAgICBpZiAoc2l6ZSArIFRDUElQX0hFQURFUl9TSVpFICsgUlRQX0hFQURFUl9TSVpFICsgUlRQX0hFQURFUl9FWFRfU0laRSArCisgICAgICAgICAgICAgICAgICAgIFJUUF9GVV9IRUFERVJfU0laRSArIFJUUF9QQVlMT0FEX1JPT01fU0laRSA+IGJ1ZmZlci0+Y2FwYWNpdHkoKSkgeworICAgICAgICAgICAgICAgIGxhc3RQYWNrZXQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBzaXplID0gYnVmZmVyLT5jYXBhY2l0eSgpIC0gVENQSVBfSEVBREVSX1NJWkUgLSBSVFBfSEVBREVSX1NJWkUgLQorICAgICAgICAgICAgICAgICAgICBSVFBfSEVBREVSX0VYVF9TSVpFIC0gUlRQX0ZVX0hFQURFUl9TSVpFIC0gUlRQX1BBWUxPQURfUk9PTV9TSVpFOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB1aW50OF90ICpkYXRhID0gYnVmZmVyLT5kYXRhKCk7CisgICAgICAgICAgICBkYXRhWzBdID0gMHg4MDsKKyAgICAgICAgICAgIGlmIChsYXN0UGFja2V0ICYmIG1SVFBDVk9FeHRNYXAgPiAwKSB7CisgICAgICAgICAgICAgICAgZGF0YVswXSB8PSAweDEwOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZGF0YVsxXSA9IChsYXN0UGFja2V0ID8gKDEgPDwgNykgOiAweDAwKSB8IG1QYXlsb2FkVHlwZTsgIC8vIE0tYml0CisgICAgICAgICAgICBkYXRhWzJdID0gKG1TZXFObyA+PiA4KSAmIDB4ZmY7CisgICAgICAgICAgICBkYXRhWzNdID0gbVNlcU5vICYgMHhmZjsKKyAgICAgICAgICAgIGRhdGFbNF0gPSBydHBUaW1lID4+IDI0OworICAgICAgICAgICAgZGF0YVs1XSA9IChydHBUaW1lID4+IDE2KSAmIDB4ZmY7CisgICAgICAgICAgICBkYXRhWzZdID0gKHJ0cFRpbWUgPj4gOCkgJiAweGZmOworICAgICAgICAgICAgZGF0YVs3XSA9IHJ0cFRpbWUgJiAweGZmOworICAgICAgICAgICAgZGF0YVs4XSA9IG1Tb3VyY2VJRCA+PiAyNDsKKyAgICAgICAgICAgIGRhdGFbOV0gPSAobVNvdXJjZUlEID4+IDE2KSAmIDB4ZmY7CisgICAgICAgICAgICBkYXRhWzEwXSA9IChtU291cmNlSUQgPj4gOCkgJiAweGZmOworICAgICAgICAgICAgZGF0YVsxMV0gPSBtU291cmNlSUQgJiAweGZmOworCisgICAgICAgICAgICBpbnQgcnRwRXh0SW5kZXggPSAwOworICAgICAgICAgICAgaWYgKGxhc3RQYWNrZXQgJiYgbVJUUENWT0V4dE1hcCA+IDApIHsKKyAgICAgICAgICAgICAgICBkYXRhWzEyXSA9IDB4QkU7CisgICAgICAgICAgICAgICAgZGF0YVsxM10gPSAweERFOworICAgICAgICAgICAgICAgIGRhdGFbMTRdID0gMHgwMDsKKyAgICAgICAgICAgICAgICBkYXRhWzE1XSA9IDB4MDE7CisgICAgICAgICAgICAgICAgZGF0YVsxNl0gPSAobVJUUENWT0V4dE1hcCA8PCA0KSB8IDB4MDsKKyAgICAgICAgICAgICAgICBkYXRhWzE3XSA9IG1SVFBDVk9EZWdyZWVzOworICAgICAgICAgICAgICAgIGRhdGFbMThdID0gMHgwOworICAgICAgICAgICAgICAgIGRhdGFbMTldID0gMHgwOworICAgICAgICAgICAgICAgIHJ0cEV4dEluZGV4ID0gODsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLyogIEgyNjQgcGF5bG9hZCBoZWFkZXIgaXMgOCBiaXQKKyAgICAgICAgICAgICAgICAgMCAxIDIgMyA0IDUgNiA3CisgICAgICAgICAgICAgICAgKy0rLSstKy0rLSstKy0rLSsKKyAgICAgICAgICAgICAgICB8RnxOUkl8ICBUeXBlICAgfAorICAgICAgICAgICAgICAgICstKy0rLSstKy0rLSstKy0rCisgICAgICAgICAgICAqLworICAgICAgICAgICAgQUxPR1YoIkgyNjQgcGF5bG9hZCBoZWFkZXIgMHgleCIsIG1lZGlhRGF0YVswXSk7CisgICAgICAgICAgICAvLyBleGNsdWRlcyBUeXBlIGZyb20gMXN0IGJ5dGUgb2YgSDI2NCBwYXlsb2FkIGhlYWRlci4KKyAgICAgICAgICAgIGRhdGFbMTIgKyBydHBFeHRJbmRleF0gPSBtZWRpYURhdGFbMF0gJiAweGUwOworICAgICAgICAgICAgLy8gZmlsbHMgVHlwZSBhcyBGVSAoMjggPT0gMHgxQykKKyAgICAgICAgICAgIGRhdGFbMTIgKyBydHBFeHRJbmRleF0gPSBkYXRhWzEyICsgcnRwRXh0SW5kZXhdIHwgMHgxQzsKKworICAgICAgICAgICAgQ0hFQ0soIWZpcnN0UGFja2V0IHx8ICFsYXN0UGFja2V0KTsKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgICAgRlUgaGVhZGVyCisgICAgICAgICAgICAgICAgIDAgMSAyIDMgNCA1IDYgNworICAgICAgICAgICAgICAgICstKy0rLSstKy0rLSstKy0rCisgICAgICAgICAgICAgICAgfFN8RXxSfCAgVHlwZSAgIHwKKyAgICAgICAgICAgICAgICArLSstKy0rLSstKy0rLSstKworICAgICAgICAgICAgKi8KKworICAgICAgICAgICAgZGF0YVsxMyArIHJ0cEV4dEluZGV4XSA9CisgICAgICAgICAgICAgICAgKGZpcnN0UGFja2V0ID8gMHg4MCA6IDB4MDApCisgICAgICAgICAgICAgICAgfCAobGFzdFBhY2tldCA/IDB4NDAgOiAweDAwKQorICAgICAgICAgICAgICAgIHwgKG5hbFR5cGUgJiBIMjY0X05BTFVfTUFTSyk7CisgICAgICAgICAgICBBTE9HVigiSDI2NCBGVSBoZWFkZXIgMHgleCIsIGRhdGFbMTNdKTsKKworICAgICAgICAgICAgbWVtY3B5KCZkYXRhWzE0ICsgcnRwRXh0SW5kZXhdLCAmbWVkaWFEYXRhW29mZnNldF0sIHNpemUpOworCisgICAgICAgICAgICBidWZmZXItPnNldFJhbmdlKDAsIDE0ICsgcnRwRXh0SW5kZXggKyBzaXplKTsKKworICAgICAgICAgICAgc2VuZChidWZmZXIsIGZhbHNlIC8qIGlzUlRDUCAqLyk7CisKKyAgICAgICAgICAgICsrbVNlcU5vOworICAgICAgICAgICAgKyttTnVtUlRQU2VudDsKKyAgICAgICAgICAgIG1OdW1SVFBPY3RldHNTZW50ICs9IGJ1ZmZlci0+c2l6ZSgpIC0gKDEyICsgcnRwRXh0SW5kZXgpOworCisgICAgICAgICAgICBmaXJzdFBhY2tldCA9IGZhbHNlOworICAgICAgICAgICAgb2Zmc2V0ICs9IHNpemU7CisgICAgICAgIH0KKyAgICB9CiB9CiAKIHZvaWQgQVJUUFdyaXRlcjo6c2VuZEgyNjNEYXRhKE1lZGlhQnVmZmVyQmFzZSAq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CBpbnQzMl90ICpjdm9FeHRNYXApIGNvbnN0IHsKKyAgICBDSEVDS19HRShpbmRleCwgMHUpOworICAgIENIRUNLX0xUKGluZGV4LCBtVHJhY2tzLnNpemUoKSk7CisKKyAgICBBU3RyaW5nIGtleSwgdmFsdWU7CisgICAgKmN2b0V4dE1hcCA9IDA7CisKKyAgICBjb25zdCBBdHRyaWJzICZ0cmFjayA9IG1UcmFja3MuaXRlbUF0KGluZGV4KTsKKyAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHRyYWNrLnNpemUoKTsgaSsrKSB7CisgICAgICAgIHZhbHVlID0gdHJhY2sudmFsdWVBdChpKTsKKyAgICAgICAgaWYgKHZhbHVlLnNpemUoKSA+IDAgJiYgc3RyY21wKHZhbHVlLmNfc3RyKCksICJ1cm46M2dwcDp2aWRlby1vcmllbnRhdGlvbiIpID09IDApIHsKKyAgICAgICAgICAgIGtleSA9IHRyYWNrLmtleUF0KGkpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpZiAoa2V5LnNpemUoKSA+IDApIHsKKyAgICAgICAgY29uc3QgY2hhciAqY29sb25Qb3MgPSBzdHJyY2hyKGtleS5jX3N0cigpLCAnOicpOworICAgICAgICBjb2xvblBvcysrOworICAgICAgICAqY3ZvRXh0TWFwID0gYXRvaShjb2xvblBvcyk7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHJldHVybiBmYWxzZTsKK30KKwogdm9pZCBBU2Vzc2lvbkRlc2NyaXB0aW9uOjpnZXRGb3JtYXRUeXBlKAogICAgICAgICBzaXplX3QgaW5kZXgsIHVuc2lnbmVkIGxvbmcgKlBULAogICAgICAgICBBU3RyaW5nICpkZXNjLCBBU3RyaW5nICpwYXJhbXMpIGNvbnN0IHsKQEAgLTM0NSw1ICszNzQsNzQgQEAKICAgICByZXR1cm4gKm5wdDIgPiAqbnB0MTsKIH0KIAorLy8gc3RhdGljCit2b2lkIEFTZXNzaW9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ZW5kKCJcclxuIik7CisKKyAgICBzZHAuYXBwZW5kKCJhPXJ0cG1hcDoiKTsKKyAgICBzZHAuYXBwZW5kKHBheWxvYWRUeXBlKTsKKyAgICBzZHAuYXBwZW5kKCIgIik7CisgICAgc2RwLmFwcGVuZChjb2RlYyk7CisgICAgc2RwLmFwcGVuZCgiLyIpOworICAgIHNkcC5hcHBlbmQoaXNBdWRpbyA/ICI4MDAwIiA6ICI5MDAwMCIpOworICAgIHNkcC5hcHBlbmQoIlxyXG4iKTsKKworICAgIGlmIChmbXRwICE9IE5VTEwpIHsKKyAgICAgICAgc2RwLmFwcGVuZCgiYT1mbXRwOiIpOworICAgICAgICBzZHAuYXBwZW5kKHBheWxvYWRUeXBlKTsKKyAgICAgICAgc2RwLmFwcGVuZCgiICIpOworICAgICAgICBzZHAuYXBwZW5kKGZtdHApOworICAgICAgICBzZHAuYXBwZW5kKCJcclxuIik7CisgICAgfQorCisgICAgaWYgKCFpc0F1ZGlvICYmIHdpZHRoID4gMCAmJiBoZWlnaHQgPiAwKSB7CisgICAgICAgIHNkcC5hcHBlbmQoImE9ZnJhbWVzaXplOiIpOworICAgICAgICBzZHAuYXBwZW5kKHBheWxvYWRUeXBlKTsKKyAgICAgICAgc2RwLmFwcGVuZCgiICIpOworICAgICAgICBzZHAuYXBwZW5kKHdpZHRoKTsKKyAgICAgICAgc2RwLmFwcGVuZCgiLSIpOworICAgICAgICBzZHAuYXBwZW5kKGhlaWdodCk7CisgICAgICAgIHNkcC5hcHBlbmQoIlxyXG4iKTsKKyAgICB9CisKKyAgICBpZiAoY3ZvRXh0TWFwID4gMCkgeworICAgICAgICBzZHAuYXBwZW5kKCJhPWV4dG1hcDoiKTsKKyAgICAgICAgc2RwLmFwcGVuZChjdm9FeHRNYXApOworICAgICAgICBzZHAuYXBwZW5kKCIgIik7CisgICAgICAgIHNkcC5hcHBlbmQoInVybjozZ3BwOnZpZGVvLW9yaWVudGF0aW9uIik7CisgICAgICAgIHNkcC5hcHBlbm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sCisgICAgdmlzaWJpbGl0eTogWyI6X19zdWJwYWNrYWdlc19fIl0sCisgICAgbGljZW5zZV9raW5kczogWworICAgICAgICAiU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMCIsCisgICAgXSwKKyAgICBsaWNlbnNlX3RleHQ6IFsKKyAgICAgICAgIk5PVElDRSIsCisgICAgXSwKK30KKwogY2NfZGVmYXVsdHMgewogICAgIG5hbWU6ICJsaWJzdGFnZWZyaWdodF9ydHNwX2RlZmF1bHRzIiwKIAogICAgIHNyY3M6IFsKICAgICAgICAgIkFBTVJBc3NlbWJsZXIuY3BwIiwKICAgICAgICAgIkFBVkNBc3NlbWJsZXIuY3BwIiwKKyAgICAgICAgIkFIRVZDQXNzZW1ibGVyLmNwcCIsCiAgICAgICAgICJBSDI2M0Fzc2VtYmxlci5jcHAiLAogICAgICAgICAiQU1QRUcyVFNBc3NlbWJsZXIuY3BwIiwKICAgICAgICAgIkFNUEVHNEF1ZGlvQXNzZW1ibGVyLmNwcCIsCkBAIC0xNiwxMCArMzYsMTIgQEAKICAgICAgICAgIkFSVFBXcml0ZXIuY3BwIiwKICAgICAgICAgIkFSVFNQQ29ubmVjdGlvbi5jcHAiLAogICAgICAgICAiQVNlc3Npb25EZXNjcmlwdGlvbi5jcHAiLAorICAgICAgICAiSml0dGVyQ2FsY3VsYXRvci5jcHAiLAogICAgICAgICAiU0RQTG9hZGVyLmNwcCIsCiAgICAgXSwKIAogICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJhbmRyb2lkX25ldCIsCiAgICAgICAgICJsaWJjcnlwdG8iLAogICAgICAgICAibGliZGF0YXNvdXJjZSIsCiAgICAgICAgICJsaWJtZWRpYSIsCkBAIC0yOCw2ICs1MCw3IEBACiAgICAgaW5jbHVkZV9kaXJzOiBbCiAgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL2xpYnN0YWdlZnJpZ2h0IiwKICAgICAgICAgImZyYW1ld29ya3MvbmF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Vbml0cyA9IDIwOworc3RhdGljIGludDMyX3Qga01heEFsbG93ZWRTdGFsZUF1ZGlvQWNjZXNzVW5pdHMgPSAyMDsKK3N0YXRpYyBpbnQzMl90IGtNYXhBbGxvd2VkU3RhbGVWaWRlb0FjY2Vzc1VuaXRzID0gNDAwOwogCiBzdGF0aWMgaW50NjRfdCBrVGVhckRvd25UaW1lb3V0VXMgPSAzMDAwMDAwbGw7CiAKQEAgLTEwOCw2ICsxMDksMTAgQEAKICAgICB9CiB9CiAKK3N0YXRpYyBpbnQzMl90IEdldE1heEFsbG93ZWRTdGFsZUNvdW50KGJvb2wgaXNWaWRlbykgeworICAgIHJldHVybiBpc1ZpZGVvID8ga01heEFsbG93ZWRTdGFsZVZpZGVvQWNjZXNzVW5pdHMgOiBrTWF4QWxsb3dlZFN0YWxlQXVkaW9BY2Nlc3NVbml0czsKK30KKwogc3RydWN0IE15SGFuZGxlciA6IHB1YmxpYyBBSGFuZGxlciB7CiAgICAgZW51bSB7CiAgICAgICAgIGtXaGF0Q29ubmVjdGVkICAgICAgICAgICAgICAgICAgPSAnY29ubicsCkBAIC0xMDMyLDYgKzEwMzcsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQogCisgICAgICAgICAgICAgICAgaW50MzJfdCBydGNwRXZlbnQ7CisgICAgICAgICAgICAgICAgaWYgKG1zZy0+ZmluZEludDMyKCJydGNwLWV2ZW50IiwgJnJ0Y3BFdmVudCkpIHsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorCiAgICAgICAgICAgICAgICAgKyttTnVtQWNjZXNzVW5pdHNSZWNlaXZlZDsKICAgICAgICAgICAgICAgICBwb3N0QWNjZXNzVW5pdFRpbWVvdXRDaGVjaygpOwogCkBAIC0xMzI1LDYgKzEzMzUsOCBAQAogCiAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigicnRwLWluZm86ICVzIiwgcmVzcG9uc2UtPm1IZWFkZXJzLnZhbHVlQXQoaSkuY19zdHIoKSk7CiAKKyAgICAgICAgICAgICAgICAgICAgICAgIG1SVFBDb25uLT5zZWVrU3RyZWFtKCk7CisKICAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dJKCJzZWVrIGNvbXBsZXRlZC4iKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KQEAgLTE1MDksNyArMTUyMSw3IEBACiAgICAgICAgICAgICBUcmFja0luZm8gKmluZm8gPSAmbVRyYWNrcy5lZGl0SXRlbUF0KHRyYWNrSW5kZXgpOwogICAgICAgICAgICAgaW5mby0+bUZpcnN0U2VxTnVtSW5TZWdtZW50ID0gc2VxOwogICAgICAgICAgICAgaW5mby0+bU5ld1NlZ21lbnQgPSB0cnVlOwotICAgICAgICAgICAgaW5mby0+bUFsbG93ZWRTdGFsZUFjY2Vzc1VuaXRzID0ga01heEFsbG93ZWRTdGFsZUFjY2Vzc1VuaXRzOworICAgICAgICAgICAgaW5mby0+bUFsbG93ZWRTdGFsZUFjY2Vzc1VuaXRzID0gR2V0TWF4QWxsb3dlZFN0YWxlQ291bnQoaW5mby0+bUlzVmlkZW8pOwogCiAgICAgICAgICAgICBDSEVDSyhHZXRBdHRyaWJ1dGUoKCppdCkuY19zdHIoKSwgInJ0cHRpbWUiLCAmdmFsKSk7CiAKQEAgLTE1NTEsNiArMTU2Myw3IEBACiAgICAgICAgIGludCBtUlRQU29ja2V0OwogICAgICAgICBpbnQgbVJUQ1BTb2NrZXQ7CiAgICAgICAgIGJvb2wgbVVzaW5nSW50ZXJsZWF2ZWRUQ1A7CisgICAgICAgIGJvb2wgbUlzVmlkZW87CiAgICAgICAgIHVpbnQzMl90IG1GaXJzdFNlcU51bUluU2VnbWVudDsKICAgICAgICAgYm9vbCBtTmV3U2VnbWVudDsKICAgICAgICAgaW50MzJfdCBtQWxsb3dlZFN0YWxlQWNjZXNzVW5pdHM7CkBAIC0xNjM1LDkgKzE2NDgs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AgICBpZiAobVNlZWthYmxlKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmICh0cmFjay0+bUFsbG93ZWRTdGFsZUFjY2Vzc1VuaXRzID4gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3Qgc2VxTnVtMTYgPSBzZXFOdW0gJiAweGZmZmY7CiAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBmaXJzdFNlcU51bUluU2VnbWVudDE2ID0gdHJhY2stPm1GaXJzdFNlcU51bUluU2VnbWVudCAmIDB4ZmZmZjsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZXFOdW0xNiA+IGZpcnN0U2VxTnVtSW5TZWdtZW50MTYgKyBrTWF4QWxsb3dlZFN0YWxlQWNjZXNzVW5pdHMKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZXFOdW0xNiA+IGZpcnN0U2VxTnVtSW5TZWdtZW50MTYgKyBtYXhBbGxvd2VkU3RhbGVBY2Nlc3NVbml0cwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCBzZXFOdW0xNiA8IGZpcnN0U2VxTnVtSW5TZWdtZW50MTYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBOb3QgdGhlIGZpcnN0IHJ0cCBwYWNrZXQgb2YgdGhlIHN0cmVhbSBhZnRlciBzZWVraW5nLCBkaXNjYXJkaW5nLgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrLT5tQWxsb3dlZFN0YWxlQWNjZXNzVW5pdHMtLTsKQEAgLTE4NTIsNyArMTg2Nyw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBtTnVtQWNjZXNzVW5pdHNSZWNlaXZlZCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HV19JRih0cmFjay0+bUFsbG93ZWRTdGFsZUFjY2Vzc1VuaXRzID09IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJTdGlsbCBubyBmaXJzdCByd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sKKyAgICB2b2lkIHByaW50QWNjdUJpdHNGb3JMYXN0UGVyaW9kKFRpbWUgcGVyaW9kLCBUaW1lIHVuaXQpOworfTsKKwordGVtcGxhdGUgPGNsYXNzIFRpbWUsIGNsYXNzIEJ5dGVzPgorVHJhZmZpY1JlY29yZGVyPFRpbWUsIEJ5dGVzPjo6VHJhZmZpY1JlY29yZGVyKHNpemVfdCBzaXplLCBUaW1lIHJlY29yZExpbWl0KQorICAgIDogbVJlY29yZExpbWl0KHJlY29yZExpbWl0KSB7CisgICAgaWYgKHNpemUgPiBrTWF4TnVtRW50cmllcykgeworICAgICAgICBMT0coVkVSQk9TRSkgPDwgIkxpbWl0aW5nIFRyYWZmaWNSZWNvcmRlciBzaXplIHRvICIgPDwga01heE51bUVudHJpZXM7CisgICAgICAgIHNpemUgPSBrTWF4TnVtRW50cmllczsKKyAgICB9IGVsc2UgaWYgKHNpemUgPCBrTWluTnVtRW50cmllcykgeworICAgICAgICBMT0coVkVSQk9TRSkgPDwgIkxpbWl0aW5nIFRyYWZmaWNSZWNvcmRlciBzaXplIHRvICIgPDwga01heE51bUVudHJpZXM7CisgICAgICAgIHNpemUgPSBrTWluTnVtRW50cmllczsKKyAgICB9CisKKyAgICBzaXplX3QgZXhwID0gKChzaXplb2Yoc2l6ZV90KSA9PSA4KSA/CisgICAgICAgICAgICAgICAgICA2NCAtIF9fYnVpbHRpbl9jbHpsKHNpemUgLSAxKSA6CisgICAgICAgICAgICAgICAgICAzMiAtIF9fYnVpbHRpbl9jbHooc2l6ZSAtIDEpKTsKKyAgICBtU2l6ZSA9ICgxdWwgPDwgZXhwKTsgICAgICAgICAvLyBzaXplID0gMl5leHAKKyAgICBtU2l6ZU1hc2sgPSBtU2l6ZSAtIDE7CisKKyAgICBMT0coVkVSQk9TRSkgPDwgIlRyYWZmaWNSZWNvcmRlciBJbml0IHNpemUgIiA8PCBtU2l6ZTsKKyAgICBtVGltZUFycmF5ID0gbmV3IFRpbWVbbVNpemVdOworICAgIG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30KKworLy8gQWRkZWQgYXV0b21hdGljYWxseSBieSBhIGxhcmdlLXNjYWxlLWNoYW5nZQorLy8gU2VlOiBodHRwOi8vZ28vYW5kcm9pZC1saWNlbnNlLWZhcQorbGljZW5zZSB7CisgICAgbmFtZTogImZyYW1ld29ya3NfYXZfbWVkaWFfbGlic3RhZ2VmcmlnaHRfdGVzdHNfbGljZW5zZSIsCisgICAgdmlzaWJpbGl0eTogWyI6X19zdWJwYWNrYWdlc19fIl0sCisgICAgbGljZW5zZV9raW5kczogWworICAgICAgICAiU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMCIsCisgICAgXSwKKyAgICBsaWNlbnNlX3RleHQ6IFsKKyAgICAgICAgIk5PVElDRSIsCisgICAgXSwKK30KKwogY2NfdGVzdCB7CiAgICAgbmFtZTogIk1lZGlhQ29kZWNMaXN0T3ZlcnJpZGVzX3Rlc3QiLAogCkBAIC05LDcgKzI4LDYgQEAKICAgICAgICAgImxpYm1lZGlhIiwKICAgICAgICAgImxpYnN0YWdlZnJpZ2h0IiwKICAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2ZvdW5kYXRpb24iLAotICAgICAgICAibGlic3RhZ2VmcmlnaHRfb214IiwKICAgICAgICAgImxpYnV0aWxzIiwKICAgICAgICAgImxpYmxvZyIsCiAgICAgXSwKQEAgLTE3LDExICszNSw4IEBACiAgICAgaW5jbHVkZV9kaXJzOiBbCiAgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL2xpYnN0YWdlZnJpZ2h0IiwKICAgICAgICAgImZyYW1ld29ya3MvYXYvbWVkaWEvbGlic3RhZ2VmcmlnaHQvaW5jbHVkZSIsCi0gICAgICAgICJmcmFtZXdvcmtzL25hdGl2ZS9pbmNsdWRlL21lZGlhL29wZW5tYXgiLAogICAgIF0sCiAKLSAgICBjb21waWxlX211bHRpbGliOiAiMzIiLAotCiAgICAgY2ZsYWdzOiBbCiAgICAgICAgICItV2Vycm9yIiwKICAgICAgIC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1ZGUgPGRhdGFzb3VyY2UvRmlsZVNvdXJjZS5oPgorI2luY2x1ZGUgPG1lZGlhL3N0YWdlZnJpZ2h0L01lZGlhRXh0cmFjdG9yRmFjdG9yeS5oPgorI2luY2x1ZGUgPG1lZGlhL3N0YWdlZnJpZ2h0L01ldGFEYXRhLmg+CisKKyNpbmNsdWRlICJFU0RTVGVzdEVudmlyb25tZW50LmgiCisKK3VzaW5nIG5hbWVzcGFjZSBhbmRyb2lkOworCitzdGF0aWMgRVNEU1Rlc3RFbnZpcm9ubWVudCAqZ0VudiA9IG51bGxwdHI7CisKK3N0cnVjdCBFU0RTUGFyYW1zIHsKKyAgICBjb25zdCBjaGFyICppbnB1dEZpbGU7CisgICAgaW50MzJfdCBvYmplY3RUeXBlSW5kaWNhdGlvbjsKKyAgICBjb25zdCBjaGFyICpjb2RlY1NwZWNpZmljSW5mb0RhdGE7CisgICAgaW50MzJfdCBjb2RlY1NwZWNpZmljSW5mb0RhdGFTaXplOworICAgIGludDMyX3QgYml0cmF0ZU1heDsKKyAgICBpbnQzMl90IGJpdHJhdGVBdmc7Cit9OworCitjbGFzcyBFU0RTVW5pdFRlc3QgOiBwdWJsaWMgOjp0ZXN0aW5nOjpUZXN0V2l0aFBhcmFtPHR1cGxlPAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBJbnB1dEZpbGUgKi8gY29uc3QgY2hhciAqLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBPYmplY3RUeXBlSW5kaWNhdGlvbiAqLyBpbnQzMl90LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBDb2RlY1NwZWNpZmljSW5mb0RhdGEgKi8gY29uc3QgY2hhciAqLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBDb2RlY1NwZWNpZmljSW5mb0RhdGFTaXplICovIGludDMyX3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIEJpdHJhdGVNYXggKi8gaW50MzJfdCwKKyAgICAg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pDcmVhdGUobURhdGFTb3VyY2UpOworICAgICAgICBpZiAoZXh0cmFjdG9yID09IG51bGxwdHIpIHsKKyAgICAgICAgICAgIG1EYXRhU291cmNlLmNsZWFyKCk7CisgICAgICAgICAgICBBU1NFUlRfVFJVRShmYWxzZSkgPDwgIlVuYWJsZSB0byBjcmVhdGUgZXh0cmFjdG9yIGZvciBmaWxlOiAiIDw8IGlucHV0RmlsZTsKKyAgICAgICAgfQorCisgICAgICAgIHNpemVfdCBudW1UcmFja3MgPSBleHRyYWN0b3ItPmNvdW50VHJhY2tzKCk7CisgICAgICAgIEFTU0VSVF9HVChudW1UcmFja3MsIDApIDw8ICJObyB0cmFja3MgaW4gZmlsZTogIiA8PCBpbnB1dEZpbGU7CisgICAgICAgIEFTU0VSVF9UUlVFKGVzZHNEYXRhUHJlc2VudChudW1UcmFja3MsIGV4dHJhY3RvcikpCisgICAgICAgICAgICAgICAgPDwgIlVuYWJsZSB0byBmaW5kIGVzZHMgaW4gYW55IHRyYWNrIGluIGZpbGU6ICIgPDwgaW5wdXRGaWxlOworICAgIH0KKworICAgIGJvb2wgZXNkc0RhdGFQcmVzZW50KHNpemVfdCBudW1UcmFja3MsIHNwPElNZWRpYUV4dHJhY3Rvcj4gZXh0cmFjdG9yKSB7CisgICAgICAgIGJvb2wgZm91bmRFU0RTID0gZmFsc2U7CisgICAgICAgIHVpbnQzMl90IHR5cGU7CisgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgbnVtVHJhY2tzOyArK2kpIHsKKyAgICAgICAgICAgIHNwPE1ldGFEYXRhPiB0cmFja01ldGEgPSBleHRyYWN0b3ItPmdldFRyYWNrTWV0YURhdGEoaSk7CisgICAgICAgICAgICBpZiAodHJhY2tNZXRhICE9IG51bGxwdHIgJiYKKyAgICAgICAgICAgICAgICB0cmFja01ldGEtPmZpbmREYXRhKGtLZXlFU0RTLCAmdHlwZSwgJm1FU0RTRGF0YSwgJm1FU0RTU2l6ZSkpIHsKKyAgICAgICAgICAgICAgICB0cmFja01ldGEtPmNsZWFyKCk7CisgICAgICAgICAgICAgICAgZm91bmRFU0RTID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZm91bmRFU0RTOworICAgIH0KKworICAgIEZJTEUgKm1JbnB1dEZwOworICAgIHNwPERhdGFTb3VyY2U+IG1EYXRhU291cmNlOworfTsKKworVEVTVF9QKEVTRFNVbml0VGVzdCwgSW52YWxpZERhdGFUZXN0KSB7CisgICAgdm9pZCAqaW52YWxpZERhdGEgPSBjYWxsb2MobUVTRFNTaXplLCAxKTsKKyAgICBBU1NFUlRfTkUoaW52YWxpZERhdGEsIG51bGxwdHIpIDw8ICJVbmFibGUgdG8gYWxsb2NhdGUgbWVtb3J5IjsKKyAgICBFU0RTIGVzZHMoaW52YWxpZERhdGEsIG1FU0RTU2l6ZSk7CisgICAgZnJlZShpbnZhbGlkRGF0YSk7CisgICAgQVNTRVJUX05FKGVzZHMuSW5pdENoZWNrKCksIE9LKSA8PCAiaW52YWxpZCBFU0RTIGRhdGEgYWNjZXB0ZWQiOworfQorCitURVNUKEVTRFNTYW5pdHlVbml0VGVzdCwgQ29uc3RydWN0b3JTYW5pdHlUZXN0KSB7CisgICAgdm9pZCAqaW52YWxpZERhdGEgPSBtYWxsb2MoMSk7CisgICAgQVNTRVJUX05FKGludmFsaWREYXRhLCBudWxscHRyKSA8PCAiVW5hYmxlIHRvIGFsbG9jYXRlIG1lbW9yeSI7CisgICAgRVNEUyBlc2RzX3plcm8oaW52YWxpZERhdGEsIDApOworICAgIGZyZWUoaW52YWxpZERhdGEpOworICAgIEFTU0VSVF9ORShlc2RzX3plcm8uSW5pdENoZWNrKCksIE9LKSA8PCAiaW52YWxpZCBFU0RTIGRhdGEgYWNjZXB0ZWQiOworCisgICAgRVNEUyBlc2RzX251bGwoTlVMTCwgMCk7CisgICAgQVNTRVJUX05FKGVzZHNfbnVs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h6Lm1wNCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICA5NywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICJceDAwXHgwMFx4MDFceEIzXHg1MFx4MDJceEQwXHgzNVx4RkZceEZGXHhFMVx4QTBceDAwXHgwMFx4MDFceEI1XHgxNSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICJceDZBXHgwMFx4MDFceDAwXHgwMCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAyMiwgMzQxNTQ1MiwgMzQxNTQ1MiksCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgidmlkZW9fMTc2eDE0NF8zZ3BfaDI2M181NmticHNfMjVmcHNfYWFjX21vbm9fMjRrYnBzXzExMDI1aHouM2dwIiwgNjQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAiXHgxNVx4MDgiLCAyLCAyNDU3NiwgMCkpKTsKKworaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiphcmd2KSB7CisgICAgLy8gTWVkaWFFeHRyYWN0b3IgbmVlZHMgYmluZGVyIHRocmVhZCBwb29sCisgICAgUHJvY2Vzc1N0YXRlOjpzZWxmKCktPnN0YXJ0VGhyZWFkUG9vbCgpOworICAgIGdFbnYgPSBuZXcgRVNEU1Rlc3RFbnZpcm9ubWVudCgpOworICAgIDo6dGVzdGluZzo6QWRkR2xvYmFsVGVzdEVudmlyb25tZW50KGdFbnYpOworICAgIDo6dGVzdGluZzo6SW5pdEdvb2dsZVRlc3QoJmFyZ2MsIGFyZ3YpOworICAgIGludCBzdGF0dXMgPSBnRW52LT5pbml0RnJvbU9wdGlvbnMoYXJnYywgYXJndik7CisgICAgaWYgKHN0YXR1cyA9PSAwKSB7CisgICAgICAgIHN0YXR1cyA9IFJVTl9BTExfVEVTVFMoKTsKKyAgICAgICAgQUxPR1YoIlRlc3QgcmVzdWx0ID0gJWRcbiIsIHN0YXR1cyk7CisgICAgfQorICAgIHJldHVybiBzdGF0dXM7Cit9CmRpZmYgLS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0X2xvbmcoYXJnYywgYXJndiwgIlA6Iiwgb3B0aW9ucywgJmluZGV4KTsKKyAgICAgICAgaWYgKGMgPT0gLTEpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgc3dpdGNoIChjKSB7CisgICAgICAgICAgICBjYXNlICdQJzoKKyAgICAgICAgICAgICAgICBzZXRSZXMob3B0YXJnKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpZiAob3B0aW5kIDwgYXJnYykgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwKKyAgICAgICAgICAgICAgICAidW5yZWNvZ25pemVkIG9wdGlvbjogJXNcblxuIgorICAgICAgICAgICAgICAgICJ1c2FnZTogJXMgPGd0ZXN0IG9wdGlvbnM+IDx0ZXN0IG9wdGlvbnM+XG5cbiIKKyAgICAgICAgICAgICAgICAidGVzdCBvcHRpb25zIGFyZTpcblxuIgorICAgICAgICAgICAgICAgICItUCwgLS1wYXRoOiBSZXNvdXJjZSBmaWxlcyBkaXJlY3RvcnkgbG9jYXRpb25cbiIsCisgICAgICAgICAgICAgICAgYXJndltvcHRpbmQgPzogMV0sIGFyZ3ZbMF0pOworICAgICAgICByZXR1cm4gMjsKKyAgICB9CisgICAgcmV0dXJuIDA7Cit9CisKKyNlbmRpZiAgLy8gX19FU0RTX1RFU1RfRU5WSVJPTk1FTlRfSF9fCmRpZmYgLS1naXQgYS9tZWRpYS9saWJzdGFnZWZyaWdodC90ZXN0cy9FU0RTL1JFQURNRS5tZCBiL21lZGlhL2xpYnN0YWdlZnJpZ2h0L3Rlc3RzL0VTRFMvUkVBRE1FLm1kCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjEwMGZiODYKLS0tIC9kZXYvbnVsbAorKysgYi9tZWRpYS9saWJzdGFnZWZyaWdod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AgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWworICAgICAgICAiZnJhbWV3b3Jrc19hdl9tZWRpYV9saWJzdGFnZWZyaWdodF90ZXN0c19saWNlbnNlIiwKKyAgICBdLAorfQorCitjY190ZXN0IHsKKyAgICBuYW1lOiAiSEVWQ1V0aWxzVW5pdFRlc3QiLAorICAgIHRlc3Rfc3VpdGVzOiBbImRldmljZS10ZXN0cyJdLAorICAgIGd0ZXN0OiB0cnVlLAorCisgICAgc3JjczogWworICAgICAgICAiSEVWQ1V0aWxzVW5pdFRlc3QuY3BwIiwKKyAgICBdLAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodCIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9mb3VuZGF0aW9uIiwKKyAgICBdLAorCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL2xpYnN0YWdlZnJpZ2h0IiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV2Vycm9yIiwKKyAgICAgICAgIi1XYWxsIiwKKyAgICBdLAorCisgICAgc2FuaXRpemU6IHsKKyAgICAgICAgY2ZpOiB0cnVlLAorICAgICAgICBtaXNjX3VuZGVmaW5lZDogWworICAgICAgICAgICAgInVuc2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICAgICAgInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgXSwKKyAgICB9LAorfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGlic3RhZ2VmcmlnaHQvdGVzdHMvSEVWQy9BbmRyb2lkVGVzdC54bWwgYi9tZWRpYS9saWJzdGFnZWZyaWdodC90ZXN0cy9IRVZDL0FuZHJvaWRUZXN0LnhtbApu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nZpcm9ubWVudDo6aW5pdEZyb21PcHRpb25zKGludCBhcmdjLCBjaGFyICoqYXJndikgeworICAgIHN0YXRpYyBzdHJ1Y3Qgb3B0aW9uIG9wdGlvbnNbXSA9IHt7InBhdGgiLCByZXF1aXJlZF9hcmd1bWVudCwgMCwgJ1AnfSwgezAsIDAsIDAsIDB9fTsKKworICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgIGludCBpbmRleCA9IDA7CisgICAgICAgIGludCBjID0gZ2V0b3B0X2xvbmcoYXJnYywgYXJndiwgIlA6Iiwgb3B0aW9ucywgJmluZGV4KTsKKyAgICAgICAgaWYgKGMgPT0gLTEpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgc3dpdGNoIChjKSB7CisgICAgICAgICAgICBjYXNlICdQJzogeworICAgICAgICAgICAgICAgIHNldFJlcyhvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmIChvcHRpbmQgPCBhcmdjKSB7CisgICAgICAgIGZwcmludGYoc3RkZXJyLAorICAgICAgICAgICAgICAgICJ1bnJlY29nbml6ZWQgb3B0aW9uOiAlc1xuXG4iCisgICAgICAgICAgICAgICAgInVzYWdlOiAlcyA8Z3Rlc3Qgb3B0aW9ucz4gPHRlc3Qgb3B0aW9ucz5cblxuIgorICAgICAgICAgICAgICAgICJ0ZXN0IG9wdGlvbnMgYXJlOlxuXG4iCisgICAgICAgICAgICAgICAgIi1QLCAtLXBhdGg6IFJlc291cmNlIGZpbGVzIGRpcmVjdG9yeSBsb2NhdGlvblxuIiwKKyAgICAgICAgICAgICAgICBhcmd2W29wdGluZCA/OiAxXSwgYXJndlswXSk7CisgICAgICAgIHJldHVybiAyOworICAgIH0KKyAgICByZXR1cm4gMDsKK30KKworI2VuZGlmICAvLyBfX0hFV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GhlIGNodW5rIGxlbmd0aCI7CisKKyAgICAgICAgdWludDhfdCAqbmFsVW5pdCA9ICh1aW50OF90ICopKGRhdGEgKyBvZmZzZXQpOworICAgICAgICBzaXplX3QgbmFsVW5pdExlbmd0aCA9IGNodW5rTGVuZ3RoIC0gb2Zmc2V0OworCisgICAgICAgIC8vIEFkZCBOQUwgdW5pdHMgb25seSBpZiB0aGV5J3JlIG9mIHR5cGU6IFZQUy9TUFMvUFBTL1NFSQorICAgICAgICBpZiAoISgodHlwZS5jb21wYXJlKCJWUFMiKSAmJiB0eXBlLmNvbXBhcmUoIlNQUyIpICYmIHR5cGUuY29tcGFyZSgiUFBTIikgJiYKKyAgICAgICAgICAgICAgIHR5cGUuY29tcGFyZSgiU0VJIikpKSkgeworICAgICAgICAgICAgZXJyID0gaGV2Y1BhcmFtcy5hZGROYWxVbml0KG5hbFVuaXQsIG5hbFVuaXRMZW5ndGgpOworICAgICAgICAgICAgQVNTRVJUX0VRKGVyciwgKHN0YXR1c190KU9LKQorICAgICAgICAgICAgICAgICAgICA8PCAiRmFpbGVkIHRvIGFkZCBOQUwgVW5pdCB0eXBlOiAiIDw8IHR5cGUgPDwgIiBTaXplOiAiIDw8IG5hbFVuaXRMZW5ndGg7CisKKyAgICAgICAgICAgIHNpemVfdCBzaXplTmFsVW5pdCA9IGhldmNQYXJhbXMuZ2V0U2l6ZShpbmRleCk7CisgICAgICAgICAgICBBU1NFUlRfRVEoc2l6ZU5hbFVuaXQsIG5hbFVuaXRMZW5ndGgpIDw8ICJJbnZhbGlkIHNpemUgcmV0dXJuZWQgZm9yIE5BTDogIiA8PCB0eXBlOworCisgICAgICAgICAgICB1aW50OF90ICpkZXN0aW5hdGlvbiA9ICh1aW50OF90ICopbWFsbG9jKG5hbFVuaXRMZW5ndGgpOworICAgICAgICAgICAgQVNTRVJUX05FKGRlc3RpbmF0aW9uLCBudWxscHRyKQorICAgICAgICAgICAgICAgICAgICA8PCAiRmFpbGVkIHRvIGFsbG9jYXR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AvLyBTZWU6IGh0dHA6Ly9nby9hbmRyb2lkLWxpY2Vuc2UtZmFxCisgICAgLy8gQSBsYXJnZS1zY2FsZS1jaGFuZ2UgYWRkZWQgJ2RlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlcycgdG8gaW1wb3J0CisgICAgLy8gYWxsIG9mIHRoZSAnbGljZW5zZV9raW5kcycgZnJvbSAiZnJhbWV3b3Jrc19hdl9tZWRpYV9saWJzdGFnZWZyaWdodF90ZXN0c19saWNlbnNlIgorICAgIC8vIHRvIGdldCB0aGUgYmVsb3cgbGljZW5zZSBraW5kczoKKyAgICAvLyAgIFNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUFwYWNoZS0yLjAKKyAgICBkZWZhdWx0X2FwcGxpY2FibGVfbGljZW5zZXM6IFsKKyAgICAgICAgImZyYW1ld29ya3NfYXZfbWVkaWFfbGlic3RhZ2VmcmlnaHRfdGVzdHNfbGljZW5zZSIsCisgICAgXSwKK30KKworY2NfZGVmYXVsdHMgeworICAgIG5hbWU6ICJsaWJzdGFnZWZyaWdodF9mdXp6ZXJfZGVmYXVsdHMiLAorICAgIGNmbGFnczogWworICAgICAgICAiLVduby1tdWx0aWNoYXIiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgICAgICItV25vLWVycm9yPWRlcHJlY2F0ZWQtZGVjbGFyYXRpb25zIiwKKyAgICAgICAgIi1XYWxsIiwKKyAgICBdLAorICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodCIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9jb2RlY2Jhc2UiLAorICAgICAgICAibGliYmFzZSIsCisgICAgICAgICJsaWJjdXRpbHMiLAorICAgICAgICAibGlidXRpbHMiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZm91bmRhdGlvbiIsCisgICAgICAgICJsaWJtZWRpYSIsCisgICAgICAgICJsaWJhdWRpb2NsaWVudCIsCisgICAgICAgICJsaWJtZWRpYV9vbXgiLAorICAgICAgICAibGliZ3VpIiwKKyAgICAgICAgImxpYmJpbmRlciIsCisgICAgICAgICJsaWJsb2ciLAorICAgICAgICAibWVkaWFfcGVybWlzc2lvbi1haWRsLWNwcCIsCisgICAgXSwKKyAgICBpbmNsdWRlX2RpcnM6IFsKKyAgICAgICAgImZyYW1ld29ya3MvYXYvbWVkaWEvbGlic3RhZ2VmcmlnaHQiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJsaWJzdGFnZWZyaWdodF9tZWRpYWNsb2NrX2Z1enplciIsCisgICAgc3JjczogWworICAgICAgICAiTWVkaWFDbG9ja0Z1enplci5jcHAiLAorICAgIF0sCisgICAgZGVmYXVsdHM6IFsibGlic3RhZ2VmcmlnaHRfZnV6emVyX2RlZmF1bHRzIl0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJsaWJzdGFnZWZyaWdodF9tZWRpYXNjYW5uZXJfZnV6emVyIiwKKyAgICBzcmNzOiBbCisgICAgICAgICJTdGFnZWZyaWdodE1lZGlhU2Nhbm5lckZ1enplci5jcHAiLAorICAgIF0sCisgICAgZGVmYXVsdHM6IFsibGlic3RhZ2VmcmlnaHRfZnV6emVyX2RlZmF1bHRzIl0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJsaWJzdGFnZWZyaWdodF9za2lwY3V0YnVmZmVyX2Z1enplciIsCisgICAgc3JjczogWworICAgICAgICAiU2tpcEN1dEJ1ZmZlckZ1enplci5jcHAiLAorICAgIF0sCisgICAgZGVmYXVsdHM6IFsibGlic3RhZ2VmcmlnaHRfZnV6emVyX2RlZmF1bHRzIl0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJsaWJzdGFnZWZyaWdodF9tZWRpYW11eGVyX2Z1enplciIsCisgICAgc3JjczogWworICAgICAgICAiTWVkaWFNdXhlckZ1enplci5jcHAiLAorICAgIF0sCisgICAgZGVmYXVsdHM6IFsibGlic3RhZ2VmcmlnaHRfZnV6emVyX2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IHsKKyAgICAgICAgZGVjb2RlciA9IG5ldyBNZWRpYUltYWdlRGVjb2Rlcihjb21wb25lbnROYW1lLCB0cmFja01ldGEsIHNvdXJjZSk7CisgICAgfQorCisgICAgd2hpbGUgKGZkcC5yZW1haW5pbmdfYnl0ZXMoKSkgeworICAgICAgICBzd2l0Y2ggKGZkcC5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQ4X3Q+KDAsIDMpKSB7CisgICAgICAgICAgICBjYXNlIDA6CisgICAgICAgICAgICAgICAgZGVjb2Rlci0+aW5pdCgvKmZyYW1lVGltZVVzKi8gZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQ2NF90PigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLypvcHRpb24qLyBmZHAuQ29uc3VtZUludGVncmFsPGludD4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qY29sb3JGb3JtYXQqLyBmZHAuQ29uc3VtZUludGVncmFsPGludD4oKSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIDE6CisgICAgICAgICAgICAgICAgZGVjb2Rlci0+ZXh0cmFjdEZyYW1lKCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIDI6IHsKKyAgICAgICAgICAgICAgICBGcmFtZVJlY3QgcmVjdDsKKyAgICAgICAgICAgICAgICByZWN0LmxlZnQgPSBmZHAuQ29uc3VtZUludGVncmFsPGludDMyX3Q+KCk7CisgICAgICAgICAgICAgICAgcmVjdC50b3AgPSBmZHAuQ29uc3VtZUludGVncmFsPGludDMyX3Q+KCk7CisgICAgICAgICAgICAgICAgcmVjdC5yaWdodCA9IGZkcC5Db25zdW1lSW50ZWdyYWw8aW50MzJfdD4oKTsKKyAgICAgICAgICAgICAgICByZWN0LmJvdHRvbSA9IGZkcC5Db25zdW1lSW50ZWdyYWw8aW50MzJfdD4oKTsKKyAgICAgICAgICAgICAgICBkZWNvZGVyLT5leHRyYWN0RnJhbWUoJnJlY3QpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSAzOiB7CisgICAgICAgICAgICAgICAgc3A8TWV0YURhdGE+IHRyYWNrTWV0YSA9IGdlbmVyYXRlTWV0YURhdGEoJmZkcCk7CisgICAgICAgICAgICAgICAgZGVjb2Rlci0+Z2V0TWV0YWRhdGFPbmx5KHRyYWNrTWV0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLypjb2xvckZvcm1hdCovIGZkcC5Db25zdW1lSW50ZWdyYWw8aW50PigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKnRodW1ibmFpbCovIGZkcC5Db25zdW1lQm9vbCgpKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIGdlbmVyYXRlZF9taW1lX3R5cGVzLmNsZWFyKCk7CisKKyAgICByZXR1cm4gMDsKK30KKworfSAgLy8gbmFtZXNwYWNlIGFuZHJvaWQKZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L3Rlc3RzL2Z1enplcnMvRnJhbWVEZWNvZGVySGVscGVycy5oIGIvbWVkaWEvbGlic3RhZ2VmcmlnaHQvdGVzdHMvZnV6emVycy9GcmFtZURlY29kZXJIZWxwZXJzLmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMjI4YzA0YQotLS0gL2Rldi9udWxsCisrKyBiL21lZGlhL2xpYnN0YWdlZnJpZ2h0L3Rlc3RzL2Z1enplcnMvRnJhbWVEZWNvZGVySGVscGVycy5oCkBAIC0wLDAgKzEsOTAgQEAKKworLyoKKyAqIENvcHlyaWdodCAoQykgMjAyMCBUaGUgQW5kcm9pZCBPcGVuIFNvdXJjZSBQcm9qZWN0CisgKgorICogTGljZW5zZWQgdW5kZXI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Tb3VyY2VGYWN0b3J5OjpnZXRJbnN0YW5jZSgpLT5DcmVhdGVGcm9tVVJJKE5VTEwgLyogaHR0cFNlcnZpY2UgKi8sIHVyaS5jX3N0cigpKTsKKworICAgIGlmIChzb3VyY2UgPT0gTlVMTCkgeworICAgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisKKyAgICByZXR1cm4gTWVkaWFFeHRyYWN0b3JGYWN0b3J5OjpDcmVhdGUoc291cmNlKTsKK30KKworc3A8TWVkaWFTb3VyY2U+IGdlbk1lZGlhU291cmNlKEZ1enplZERhdGFQcm92aWRlciAqZGF0YVByb3ZpZGVyLCB1aW50MTZfdCBtYXhNZWRpYUJsb2JTaXplKSB7CisgICAgc3RkOjpzdHJpbmcgbWltZSA9IGdlbk1pbWVUeXBlKGRhdGFQcm92aWRlcik7CisgICAgc3A8SU1lZGlhRXh0cmFjdG9yPiBleHRyYWN0b3IgPSBnZW5NZWRpYUV4dHJhY3RvcihkYXRhUHJvdmlkZXIsIG1pbWUsIG1heE1lZGlhQmxvYlNpemUpOworCisgICAgaWYgKGV4dHJhY3RvciA9PSBOVUxMKSB7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKworICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgZXh0cmFjdG9yLT5jb3VudFRyYWNrcygpOyArK2kpIHsKKyAgICAgICAgc3A8TWV0YURhdGE+IG1ldGEgPSBleHRyYWN0b3ItPmdldFRyYWNrTWV0YURhdGEoaSk7CisKKyAgICAgICAgY29uc3QgY2hhciAqdHJhY2tNaW1lOworICAgICAgICBpZiAoIXN0cmNhc2VjbXAobWltZS5jX3N0cigpLCB0cmFja01pbWUpKSB7CisgICAgICAgICAgICBzcDxJTWVkaWFTb3VyY2U+IHRyYWNrID0gZXh0cmFjdG9yLT5nZXRUcmFjayhpKTsKKyAgICAgICAgICAgIGlmICh0cmFjayA9PSBOVUxMKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgICAgIC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aWxlVHlwZSwgb3V0cHV0X2Zvcm1hdDo6T1VUUFVUX0ZPUk1BVF9XRUJNKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1QRUc0OgorICAgICAgICAgICAgd3JpdGVyID0gbmV3IE1QRUc0V3JpdGVyKGZkKTsKKyAgICAgICAgICAgIGZpbGVNZXRhLT5zZXRJbnQzMihrS2V5RmlsZVR5cGUsIG91dHB1dF9mb3JtYXQ6Ok9VVFBVVF9GT1JNQVRfTVBFR180KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFNUl9OQjoKKyAgICAgICAgICAgIHdyaXRlciA9IG5ldyBBTVJXcml0ZXIoZmQpOworICAgICAgICAgICAgZmlsZU1ldGEtPnNldEludDMyKGtLZXlGaWxlVHlwZSwgb3V0cHV0X2Zvcm1hdDo6T1VUUFVUX0ZPUk1BVF9BTVJfTkIpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQU1SX1dCOgorICAgICAgICAgICAgd3JpdGVyID0gbmV3IEFNUldyaXRlcihmZCk7CisgICAgICAgICAgICBmaWxlTWV0YS0+c2V0SW50MzIoa0tleUZpbGVUeXBlLCBvdXRwdXRfZm9ybWF0OjpPVVRQVVRfRk9STUFUX0FNUl9XQik7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNUEVHMlRTOgorICAgICAgICAgICAgd3JpdGVyID0gbmV3IE1QRUcyVFNXcml0ZXIoZmQpOworICAgICAgICAgICAgZmlsZU1ldGEtPnNldEludDMyKGtLZXlGaWxlVHlwZSwgb3V0cHV0X2Zvcm1hdDo6T1VUUFVUX0ZPUk1BVF9NUEVHMlRTKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgcmV0dXJuIG51bGxwdHI7CisgICAgfQorICAgIGlmICh3cml0ZXIgIT0gbnVsbHB0cikgeworICAgICAgICBmaWxlTWV0YS0+c2V0SW50Mz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dGFnZWZyaWdodC9NZWRpYUNsb2NrLmg+CisKK25hbWVzcGFjZSBhbmRyb2lkIHsKK2V4dGVybiAiQyIgaW50IExMVk1GdXp6ZXJUZXN0T25lSW5wdXQoY29uc3QgdWludDhfdCAqZGF0YSwgc2l6ZV90IHNpemUpIHsKKyAgICBGdXp6ZWREYXRhUHJvdmlkZXIgZmRwID0gRnV6emVkRGF0YVByb3ZpZGVyKGRhdGEsIHNpemUpOworICAgIHNwPE1lZGlhQ2xvY2s+IG1DbG9jayhuZXcgTWVkaWFDbG9jayk7CisKKyAgICBib29sIHJlZ2lzdGVyZWQgPSBmYWxzZTsKKyAgICB3aGlsZSAoZmRwLnJlbWFpbmluZ19ieXRlcygpID4gMCkgeworICAgICAgICBzd2l0Y2ggKGZkcC5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQ4X3Q+KDAsIDUpKSB7CisgICAgICAgICAgICBjYXNlIDA6IHsKKyAgICAgICAgICAgICAgICBpZiAocmVnaXN0ZXJlZCA9PSBmYWxzZSkgeworICAgICAgICAgICAgICAgICAgICBtQ2xvY2stPmluaXQoKTsKKyAgICAgICAgICAgICAgICAgICAgcmVnaXN0ZXJlZCA9IHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgMTogeworICAgICAgICAgICAgICAgIGludDY0X3Qgc3RhcnRpbmdUaW1lTWVkaWFVcyA9IGZkcC5Db25zdW1lSW50ZWdyYWw8aW50NjRfdD4oKTsKKyAgICAgICAgICAgICAgICBtQ2xvY2stPnNldFN0YXJ0aW5nVGltZU1lZGlhKHN0YXJ0aW5nVGltZU1lZGlhVXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSAyOiB7CisgICAgICAgICAgICAgICAgbUNsb2NrLT5jbGVhckFuY2hvcigpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSAzOiB7CisgICAgICAgICAgICAgICAgaW50NjRfdCBhbmNob3JUaW1lUmVhbFVzID0gZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQ2NF90PigpOworICAgICAgICAgICAgICAgIGludDY0X3QgYW5jaG9yVGltZU1lZGlhVXMgPSBmZHAuQ29uc3VtZUludGVncmFsPGludDY0X3Q+KCk7CisgICAgICAgICAgICAgICAgaW50NjRfdCBtYXhUaW1lTWVkaWFVcyA9IGZkcC5Db25zdW1lSW50ZWdyYWw8aW50NjRfdD4oKTsKKyAgICAgICAgICAgICAgICBtQ2xvY2stPnVwZGF0ZUFuY2hvcihhbmNob3JUaW1lTWVkaWFVcywgYW5jaG9yVGltZVJlYWxVcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhUaW1lTWVkaWFVcyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIDQ6IHsKKyAgICAgICAgICAgICAgICBpbnQ2NF90IG1heFRpbWVNZWRpYVVzID0gZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQ2NF90PigpOworICAgICAgICAgICAgICAgIG1DbG9jay0+dXBkYXRlTWF4VGltZU1lZGlhKG1heFRpbWVNZWRpYVVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIDU6IHsKKyAgICAgICAgICAgICAgICB3cDxBTWVzc2FnZT4gbXNnKG5ldyBBTWVzc2FnZSk7CisgICAgICAgICAgICAgICAgbUNsb2NrLT5zZXROb3RpZmljYXRpb25NZXNzYWdlKG1zZy5wcm9tb3RlKCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIDA7Cit9Cit9ICAvLyBuYW1lc3BhY2UgYW5kcm9pZApkaWZmIC0tZ2l0IGEvbWVkaWEvbGlic3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UEVfQVVESU9fQU1SX05CLAorICAgIE1FRElBX01JTUVUWVBFX0FVRElPX0FNUl9XQiwKKyAgICBNRURJQV9NSU1FVFlQRV9BVURJT19NUEVHLAorICAgIE1FRElBX01JTUVUWVBFX0FVRElPX01QRUdfTEFZRVJfSSwKKyAgICBNRURJQV9NSU1FVFlQRV9BVURJT19NUEVHX0xBWUVSX0lJLAorICAgIE1FRElBX01JTUVUWVBFX0FVRElPX01JREksCisgICAgTUVESUFfTUlNRVRZUEVfQVVESU9fQUFDLAorICAgIE1FRElBX01JTUVUWVBFX0FVRElPX1FDRUxQLAorICAgIE1FRElBX01JTUVUWVBFX0FVRElPX1ZPUkJJUywKKyAgICBNRURJQV9NSU1FVFlQRV9BVURJT19PUFVTLAorICAgIE1FRElBX01JTUVUWVBFX0FVRElPX0c3MTFfQUxBVywKKyAgICBNRURJQV9NSU1FVFlQRV9BVURJT19HNzExX01MQVcsCisgICAgTUVESUFfTUlNRVRZUEVfQVVESU9fUkFXLAorICAgIE1FRElBX01JTUVUWVBFX0FVRElPX0ZMQUMsCisgICAgTUVESUFfTUlNRVRZUEVfQVVESU9fQUFDX0FEVFMsCisgICAgTUVESUFfTUlNRVRZUEVfQVVESU9fTVNHU00sCisgICAgTUVESUFfTUlNRVRZUEVfQVVESU9fQUMzLAorICAgIE1FRElBX01JTUVUWVBFX0FVRElPX0VBQzMsCisgICAgTUVESUFfTUlNRVRZUEVfQVVESU9fRUFDM19KT0MsCisgICAgTUVESUFfTUlNRVRZUEVfQVVESU9fQUM0LAorICAgIE1FRElBX01JTUVUWVBFX0FVRElPX1NDUkFNQkxFRCwKKyAgICBNRURJQV9NSU1FVFlQRV9BVURJT19BTEFDLAorICAgIE1FRElBX01JTUVUWVBFX0FVRElPX1dNQSwKKyAgICBNRURJQV9NSU1FVFlQRV9BVURJT19NU19BRFBDTSwKKyAgICBNRURJQV9NSU1FVFlQRV9BVURJT19EVklfSU1BX0FEUENNLAorICAgIE1FRElBX01JTUVUWVBFX0N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gICAgIG1NdXhlci0+YWRkVHJhY2soYV9mb3JtYXQpOworICAgICAgYnJlYWs7CisgICAgfQorICAgIGNhc2UgMTogeworICAgICAgbU11eGVyLT5zdGFydCgpOworICAgICAgYnJlYWs7CisgICAgfQorICAgIGNhc2UgMjogeworICAgICAgaW50IGRlZ3JlZXMgPSBmZHAuQ29uc3VtZUludGVncmFsPGludD4oKTsKKyAgICAgIG1NdXhlci0+c2V0T3JpZW50YXRpb25IaW50KGRlZ3JlZXMpOworICAgICAgYnJlYWs7CisgICAgfQorICAgIGNhc2UgMzogeworICAgICAgaW50IGxhdGl0dWRlID0gZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQ+KCk7CisgICAgICBpbnQgbG9uZ2l0dWRlID0gZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQ+KCk7CisgICAgICBtTXV4ZXItPnNldExvY2F0aW9uKGxhdGl0dWRlLCBsb25naXR1ZGUpOworICAgICAgYnJlYWs7CisgICAgfQorICAgIGNhc2UgNDogeworICAgICAgc2l6ZV90IGJ1Zl9zaXplID0gZmRwLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8c2l6ZV90PigwLCBkYXRhX3NpemUpOworICAgICAgc3A8QUJ1ZmZlcj4gYV9idWZmZXIobmV3IEFCdWZmZXIoYnVmX3NpemUpKTsKKworICAgICAgc2l6ZV90IHRyYWNrSW5kZXggPSBmZHAuQ29uc3VtZUludGVncmFsPHNpemVfdD4oKTsKKyAgICAgIGludDY0X3QgdGltZVVzID0gZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQ2NF90PigpOworICAgICAgdWludDMyX3QgZmxhZ3MgPSBmZHAuQ29uc3VtZUludGVncmFsPHVpbnQzMl90PigpOworICAgICAgbU11eGVyLT53cml0ZVNhbXBsZURhdGEoYV9idWZmZXIsIHRyYWNrSW5kZXgsIHRpbWVVcywgZmxhZ3MpOworICAgIH0KKyAgICB9CisgIH0KKworICBpZiAoZmRwLkNvbnN1bWVCb29sKCk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RhdGljIHN0ZDo6dmVjdG9yPGNvbnN0IGNoYXIgKj4gaW50MzJNYXBwaW5nc3sibG9vcCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0aW1lLXNjYWxlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNyeXB0by1tb2RlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNyeXB0by1kZWZhdWx0LWl2LXNpemUiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY3J5cHRvLWVuY3J5cHRlZC1ieXRlLWJsb2NrIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNyeXB0by1za2lwLWJ5dGUtYmxvY2siLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZnJhbWUtY291bnQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAibWF4LWJpdHJhdGUiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAicGNtLWJpZy1lbmRpYW4iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGVtcG9yYWwtbGF5ZXItY291bnQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGVtcG9yYWwtbGF5ZXItaWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGh1bWJuYWlsLXdpZHRoIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRodW1ibmFpbC1oZWlnaHQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidHJhY2staWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmFsaWQtc2FtcGxlcyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJjb2xvci1mb3JtYXQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY2Etc3lzdGVtLWlkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImlzLXN5bmMtZnJhbWUiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYml0cmF0ZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJtYXgtYml0cmF0ZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ3aWR0aCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJoZWlnaHQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAic2FyLXdpZHRoIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInNhci1oZWlnaHQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZGlzcGxheS13aWR0aCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJkaXNwbGF5LWhlaWdodCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpcy1kZWZhdWx0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRpbGUtd2lkdGgiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGlsZS1oZWlnaHQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZ3JpZC1yb3dzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImdyaWQtY29scyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJyb3RhdGlvbi1kZWdyZWVzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNoYW5uZWwtY291bnQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAic2FtcGxlLXJhdGUiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYml0cy1wZXItc2FtcGxlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNoYW5uZWwtbWFzayIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJlbmNvZGVyLWRlbGF5IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImVuY29kZXItcGFkZGluZyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpcy1hZHRzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImZyYW1lLXJhdGUiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAibWF4LWhlaWdodCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJtYXgtd2lkdGgiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAibWF4LWlucHV0LXNpemUiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaGFwdGljLWNoYW5uZWwtY291bnQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAicGNtLWVuY29kaW5nIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImFhYy1wcm9maWxlIn07CisKK3N0YXRpYyBjb25zdCBzdGQ6OnZlY3RvcjxzdGQ6OmZ1bmN0aW9uPHZvaWQoQU1lc3NhZ2UgKiwgRnV6emVkRGF0YVByb3ZpZGVyICopPj4KKyAgICBhbWVzc2FnZV9zZXR2YWxzID0geworICAgICAgICBbXShBTWVzc2FnZSAqbXNnLCBGdXp6ZWREYXRhUHJvdmlkZXIgKmZkcCkgLT4gdm9pZCB7CisgICAgICAgICAgbXNnLT5zZXRSZWN0KCJjcm9wIiwgZmRwLT5Db25zdW1lSW50ZWdyYWw8aW50MzJfdD4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgZmRwLT5Db25zdW1lSW50ZWdyYWw8aW50MzJfdD4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgZmRwLT5Db25zdW1lSW50ZWdyYWw8aW50MzJfdD4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgZmRwLT5Db25zdW1lSW50ZWdyYWw8aW50MzJfdD4oKSk7CisgICAgICAgIH0sCisgICAgICAgIFtdKEFNZXNzYWdlICptc2csIEZ1enplZERhdGFQcm92aWRlciAqZmRwKSAtPiB2b2lkIHsKKyAgICAgICAgICBtc2ctPnNldEZsb2F0KGZsb2F0TWFwcGluZ3NbZmRwLT5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHNpemVfdD4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgZmxvYXRNYXBwaW5ncy5zaXplKCkgLSAxKV0sCisgICAgICAgICAgICAgICAgICAgICAgICBmZHAtPkNvbnN1bWVGbG9hdGluZ1BvaW50PGZsb2F0PigpKTsKKyAgICAgICAgfSwKKyAgICAgICAgW10oQU1lc3NhZ2UgKm1zZywgRnV6emVkRGF0YVByb3ZpZGVyICpmZHApIC0+IHZvaWQgeworICAgICAgICAgIG1zZy0+c2V0SW50NjQoaW50NjRNYX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isgICAgfSwKKyAgICBbXShGdXp6ZWREYXRhUHJvdmlkZXIgKmRhdGFQcm92aWRlciwgTVBFRzRXcml0ZXIgKm1lZGlhV3JpdGVyKSB7CisgICAgICAgIHN0ZDo6c3RyaW5nIGZvdXJDQyA9IGdldEZvdXJDQyhkYXRhUHJvdmlkZXIpOworICAgICAgICBtZWRpYVdyaXRlci0+d3JpdGVGb3VyY2MoZm91ckNDLmNfc3RyKCkpOworICAgIH0sCisKKyAgICAvLyBNaXNjIHNldHRlcnMKKyAgICBbXShGdXp6ZWREYXRhUHJvdmlkZXIgKmRhdGFQcm92aWRlciwgTVBFRzRXcml0ZXIgKm1lZGlhV3JpdGVyKSB7CisgICAgICAgIHVpbnQzMl90IGxheWVycyA9IGRhdGFQcm92aWRlci0+Q29uc3VtZUludGVncmFsPHVpbnQzMl90PigpOworICAgICAgICBtZWRpYVdyaXRlci0+c2V0VGVtcG9yYWxMYXllckNvdW50KGxheWVycyk7CisgICAgfSwKKyAgICBbXShGdXp6ZWREYXRhUHJvdmlkZXIgKmRhdGFQcm92aWRlciwgTVBFRzRXcml0ZXIgKm1lZGlhV3JpdGVyKSB7CisgICAgICAgIHVpbnQzMl90IGR1cmF0aW9uID0gZGF0YVByb3ZpZGVyLT5Db25zdW1lSW50ZWdyYWw8dWludDMyX3Q+KCk7CisgICAgICAgIG1lZGlhV3JpdGVyLT5zZXRJbnRlcmxlYXZlRHVyYXRpb24oZHVyYXRpb24pOworICAgIH0sCisgICAgW10oRnV6emVkRGF0YVByb3ZpZGVyICpkYXRhUHJvdmlkZXIsIE1QRUc0V3JpdGVyICptZWRpYVdyaXRlcikgeworICAgICAgICBpbnQgbGF0ID0gZGF0YVByb3ZpZGVyLT5Db25zdW1lSW50ZWdyYWw8aW50PigpOworICAgICAgICBpbnQgbG9uID0gZGF0YVByb3ZpZGVyLT5Db25zdW1lSW50ZWdyYWw8aW50PigpOworICAgICAgICBtZWRpYVdyaXRlci0+c2V0R2VvRGF0YShsYXQsIGxv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gd2UgZG9uJ3QgZXhwZWN0IGFueSBidWZmZXIgb3BlcmF0aW9ucwogICAgICAgICAgICAgICAgIC8vIGluIHRoaXMgc2NlbmFyaW8uCkBAIC0zMTQsMTMgKzMxNywxNyBAQAogICAgICAgICAgICAgICAgICAgICBtb2NrQ29kZWMtPmNhbGxiYWNrKCktPm9uU3RhcnRDb21wbGV0ZWQoKTsKICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgIE9OX0NBTEwoKm1vY2tDb2RlYywgaW5pdGlhdGVTaHV0ZG93bih0cnVlKSkKLSAgICAgICAgICAgICAgICAuV2lsbEJ5RGVmYXVsdChbbW9ja0NvZGVjLCAmZXJyb3JPY2N1cnJlZF0oYm9vbCkgeworICAgICAgICAgICAgICAgIC5XaWxsQnlEZWZhdWx0KFttb2NrQ29kZWNdKGJvb2wpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gMikKICAgICAgICAgICAgICAgICAgICAgbW9ja0NvZGVjLT5jYWxsYmFjaygpLT5vbkVycm9yKFVOS05PV05fRVJST1IsIEFDVElPTl9DT0RFX0ZBVEFMKTsKLSAgICAgICAgICAgICAgICAgICAgLy8gTWFyayB0aGF0IDEpIGFuZCAyKSBhcmUgY29tcGxldGUuCi0gICAgICAgICAgICAgICAgICAgIGVycm9yT2NjdXJyZWQuc2V0X3ZhbHVlKCk7CisgICAgICAgICAgICAgICAgICAgIC8vIDMpCisgICAgICAgICAgICAgICAgICAgIG1vY2tDb2RlYy0+Y2FsbGJhY2soKS0+b25FcnJvcihVTktOT1dOX0VSUk9SLCBBQ1RJT05fQ09ERV9GQVRBTCk7CiAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICBPTl9DQUxMKCptb2NrQ29kZWMsIGluaXRpYXRlU2h1dGRvd24oZmFsc2UpKQogICAgICAgICAgICAgICAgIC5XaWxsQnlEZWZhdWx0KFttb2NrQ29kZWNdKGJvb2wpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gUHJldmlvdXM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WMgY29uc3QgQVN0cmluZyBrQ29kZWNPd25lcnsibm9ib2R5In07CisgICAgc3RhdGljIGNvbnN0IEFTdHJpbmcga01lZGlhVHlwZXsidmlkZW8veC10ZXN0In07CisKKyAgICBzcDxNb2NrQ29kZWM+IG1vY2tDb2RlYzsKKyAgICBzdGQ6OmZ1bmN0aW9uPHNwPENvZGVjQmFzZT4oY29uc3QgQVN0cmluZyAmbmFtZSwgY29uc3QgY2hhciAqb3duZXIpPiBnZXRDb2RlY0Jhc2UgPQorICAgICAgICBbJm1vY2tDb2RlY10oY29uc3QgQVN0cmluZyAmLCBjb25zdCBjaGFyICopIHsKKyAgICAgICAgICAgIG1vY2tDb2RlYyA9IG5ldyBNb2NrQ29kZWMoW10oY29uc3Qgc3RkOjpzaGFyZWRfcHRyPE1vY2tCdWZmZXJDaGFubmVsPiAmKSB7CisgICAgICAgICAgICAgICAgLy8gTm8gbW9jayBzZXR1cCwgYXMgd2UgZG9uJ3QgZXhwZWN0IGFueSBidWZmZXIgb3BlcmF0aW9ucworICAgICAgICAgICAgICAgIC8vIGluIHRoaXMgc2NlbmFyaW8uCisgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIE9OX0NBTEwoKm1vY2tDb2RlYywgaW5pdGlhdGVBbGxvY2F0ZUNvbXBvbmVudChfKSkKKyAgICAgICAgICAgICAgICAuV2lsbEJ5RGVmYXVsdChbbW9ja0NvZGVjXShjb25zdCBzcDxBTWVzc2FnZT4gJikgeworICAgICAgICAgICAgICAgICAgICBtb2NrQ29kZWMtPmNhbGxiYWNrKCktPm9uQ29tcG9uZW50QWxsb2NhdGVkKGtDb2RlY05hbWUuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICBPTl9DQUxMKCptb2NrQ29kZWMsIGluaXRpYXRlU2h1dGRvd24oXykpCisgICAgICAgICAgICAgICAgLldpbGxCeURlZmF1bHQoW21vY2tDb2RlY10oYm9vbCkgeworICAgICAgICAgICAgICAgICAgICAvLy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dGVkLCBudW1DaGFubmVsRm91bmQpOworICAgICAgICB9IGVsc2UgaWYgKCFzdHJuY2FzZWNtcCh0YWcuY19zdHIoKSwgIkFORFJPSURfTE9PUCIsIHNpemVvZih0YWcpKSkgeworICAgICAgICAgICAgaW50MzJfdCBsb29wRXhwZWN0ZWQgPSAhdmFsdWUuY29tcGFyZSgidHJ1ZSIpOworICAgICAgICAgICAgaW50MzJfdCBsb29wRm91bmQgPSAtMTsKKworICAgICAgICAgICAgc3RhdHVzID0gQU1lZGlhRm9ybWF0X2dldEludDMyKGZpbGVNZXRhLCAibG9vcCIsICZsb29wRm91bmQpOworICAgICAgICAgICAgQVNTRVJUX1RSVUUoc3RhdHVzKSA8PCAiRmFpbGVkIHRvIGdldCB0aGUgbG9vcCBjb3VudCI7CisgICAgICAgICAgICBBU1NFUlRfRVEobG9vcEV4cGVjdGVkLCBsb29wRm91bmQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY29uc3QgY2hhciAqdGFnVmFsdWUgPSAiIjsKKyAgICAgICAgICAgIHN0YXR1cyA9IEFNZWRpYUZvcm1hdF9nZXRTdHJpbmcoZmlsZU1ldGEsIGtleS5jX3N0cigpLCAmdGFnVmFsdWUpOworICAgICAgICAgICAgQVNTRVJUX1RSVUUoc3RhdHVzKSA8PCAiRmFpbGVkIHRvIGdldCB0aGUgdGFnIHZhbHVlIjsKKyAgICAgICAgICAgIEFTU0VSVF9TVFJFUSh2YWx1ZS5jX3N0cigpLCB0YWdWYWx1ZSk7CisgICAgICAgIH0KKyAgICAgICAgQU1lZGlhRm9ybWF0X2RlbGV0ZShmaWxlTWV0YSk7CisgICAgfQorfQorCitJTlNUQU5USUFURV9URVNUX1NVSVRFX1AoTWV0YURhdGFVdGlsc1Rlc3RBbGwsIEF2Y0NTRFRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgOjp0ZXN0aW5nOjpWYWx1ZXMobWFrZV90dXBsZSgic3BzX3Bwc191c2VyZGF0YS5oMjY0IiwgOCwgOCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgic3BzX3VzZXJkYXRhX3Bwcy5oMjY0IiwgOCwgOCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgic3BzX3Bwc19zcHNfcHBzLmgyNjQiLCA4LCA4KSkpOworCisvLyBUT0RPKGIvMTU4MDY3NjkxKTogQWRkIGludmFsaWQgdGVzdCB2ZWN0b3JzIHdpdGggaW5jb21wbGV0ZSBQUFMgb3Igbm8gUFBTCitJTlNUQU5USUFURV9URVNUX1NVSVRFX1AoTWV0YURhdGFVdGlsc1Rlc3RBbGwsIEF2Y0NTRFZhbGlkYXRlVGVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICA6OnRlc3Rpbmc6OlZhbHVlcygic3BzX3Bwc19vbmx5X3N0YXJ0Y29kZS5oMjY0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAic3BzX2luY29tcGxldGVfcHBzLmgyNjQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRPRE8oYi8xNTgwNjc2OTEpICJzcHNfcHBzX2luY29tcGxldGUuaDI2NCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInJhbmRvbWRhdGEuaDI2NCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVE9ETyhiLzE1ODA2NzY5MSkgInNwcy5oMjY0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAicHBzLmgyNjQiKSk7CisKK0lOU1RBTlRJQVRFX1RFU1RfU1VJVEVfUChNZXRhRGF0YVV0aWxzVGVzdEFsbCwgQWFjQ1NEVGVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICA6OnRlc3Rpbmc6OlZhbHVlcyhtY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bGFzcyBNZXRhRGF0YVV0aWxzVGVzdEVudmlyb25tZW50IDogcHVibGljOjp0ZXN0aW5nOjpFbnZpcm9ubWVudCB7CisgIHB1YmxpYzoKKyAgICBNZXRhRGF0YVV0aWxzVGVzdEVudmlyb25tZW50KCkgOiByZXMoIi9kYXRhL2xvY2FsL3RtcC8iKSB7fQorCisgICAgLy8gUGFyc2VzIHRoZSBjb21tYW5kIGxpbmUgYXJndW1lbnRzCisgICAgaW50IGluaXRGcm9tT3B0aW9ucyhpbnQgYXJnYywgY2hhciAqKmFyZ3YpOworCisgICAgdm9pZCBzZXRSZXMoY29uc3QgY2hhciAqX3JlcykgeyByZXMgPSBfcmVzOyB9CisKKyAgICBjb25zdCBzdHJpbmcgZ2V0UmVzKCkgY29uc3QgeyByZXR1cm4gcmVzOyB9CisKKyAgcHJpdmF0ZToKKyAgICBzdHJpbmcgcmVzOworfTsKKworaW50IE1ldGFEYXRhVXRpbHNUZXN0RW52aXJvbm1lbnQ6OmluaXRGcm9tT3B0aW9ucyhpbnQgYXJnYywgY2hhciAqKmFyZ3YpIHsKKyAgICBzdGF0aWMgc3RydWN0IG9wdGlvbiBvcHRpb25zW10gPSB7eyJwYXRoIiwgcmVxdWlyZWRfYXJndW1lbnQsIDAsICdQJ30sIHswLCAwLCAwLCAwfX07CisKKyAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICBpbnQgaW5kZXggPSAwOworICAgICAgICBpbnQgYyA9IGdldG9wdF9sb25nKGFyZ2MsIGFyZ3YsICJQOiIsIG9wdGlvbnMsICZpbmRleCk7CisgICAgICAgIGlmIChjID09IC0xKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIHN3aXRjaCAoYykgeworICAgICAgICAgICAgY2FzZSAnUCc6IHsKKyAgICAgICAgICAgICAgICBzZXRSZXMob3B0YXJnKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGRlZmF1bHQ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Ml90Pj4geworY2xhc3MgV3JpdGVyVGVzdCB7CiAgIHB1YmxpYzoKLSAgICBXcml0ZXJUZXN0KCkgOiBtV3JpdGVyKG51bGxwdHIpLCBtRmlsZU1ldGEobnVsbHB0ciksIG1DdXJyZW50VHJhY2sobnVsbHB0cikge30KKyAgICBXcml0ZXJUZXN0KCkgOiBtV3JpdGVyKG51bGxwdHIpLCBtRmlsZU1ldGEobnVsbHB0cikge30KIAogICAgIH5Xcml0ZXJUZXN0KCkgewotICAgICAgICBpZiAobVdyaXRlcikgewotICAgICAgICAgICAgbVdyaXRlci5jbGVhcigpOwotICAgICAgICAgICAgbVdyaXRlciA9IG51bGxwdHI7Ci0gICAgICAgIH0KICAgICAgICAgaWYgKG1GaWxlTWV0YSkgewogICAgICAgICAgICAgbUZpbGVNZXRhLmNsZWFyKCk7CiAgICAgICAgICAgICBtRmlsZU1ldGEgPSBudWxscHRyOwogICAgICAgICB9Ci0gICAgICAgIGlmIChtQ3VycmVudFRyYWNrKSB7Ci0gICAgICAgICAgICBtQ3VycmVudFRyYWNrLmNsZWFyKCk7Ci0gICAgICAgICAgICBtQ3VycmVudFRyYWNrID0gbnVsbHB0cjsKKyAgICAgICAgaWYgKG1Xcml0ZXIpIHsKKyAgICAgICAgICAgIG1Xcml0ZXIuY2xlYXIoKTsKKyAgICAgICAgICAgIG1Xcml0ZXIgPSBudWxscHRyOworICAgICAgICB9CisgICAgICAgIGlmIChnRW52LT5jbGVhblVwKCkpIHJlbW92ZShPVVRQVVRfRklMRV9OQU1FKTsKKworICAgICAgICBmb3IgKGludDMyX3QgaWR4ID0gMDsgaWR4IDwga01heFRyYWNrQ291bnQ7IGlkeCsrKSB7CisgICAgICAgICAgICBtQnVmZmVySW5mb1tpZHhdLmNsZWFyKCk7CisgICAgICAgICAgICBpZiAobUN1cnJlbnRUcmFja1tpZHhdKSB7CisgICAgICAgICAgICAgICAgbUN1cnJlbnRUcmFja1tpZHhdLT5zdG9wKCk7CisgICAgICAgICAgICAg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KKyAgICB9CisgICAgaWYgKGZpbGVEdXJhdGlvbkxpbWl0ID4gMCkgeworICAgICAgICBtYXhGaWxlRHVyYXRpb24gPSAoaW50NjRfdCkoZmlsZUR1cmF0aW9uTGltaXQgKiBsYXN0RnJhbWVUaW1lU3RhbXBVcyk7CisgICAgICAgIG1Xcml0ZXItPnNldE1heEZpbGVEdXJhdGlvbihtYXhGaWxlRHVyYXRpb24pOworICAgIH0KKworICAgIHNwPFdyaXRlckxpc3RlbmVyPiBsaXN0ZW5lciA9IG5ldyBXcml0ZXJMaXN0ZW5lcigpOworICAgIEFTU0VSVF9ORShsaXN0ZW5lciwgbnVsbHB0cikgPDwgInVuYWJsZSB0byBhbGxvY2F0ZSBsaXN0ZW5lciI7CisKKyAgICBtV3JpdGVyLT5zZXRMaXN0ZW5lcihsaXN0ZW5lcik7CisgICAgc3RhdHVzID0gbVdyaXRlci0+c3RhcnQobUZpbGVNZXRhLmdldCgpKTsKKyAgICBBU1NFUlRfRVEoKHN0YXR1c190KU9LLCBzdGF0dXMpOworCisgICAgZmxvYXQgaW50ZXJ2YWwgPSBnZXQ8NT4oR2V0UGFyYW0oKSk7CisgICAgQVNTRVJUX0xFKGludGVydmFsLCAxLjBmKSA8PCAiQnVmZmVyIGludGVydmFsIGludmFsaWQuIFNob3VsZCBiZSBsZXNzIHRoYW4gb3IgZXF1YWwgdG8gMS4wIjsKKworICAgIHNpemVfdCByYW5nZSA9IDA7CisgICAgaW50MzJfdCBsb29wQ291bnQgPSAwOworICAgIGludDMyX3Qgb2Zmc2V0W2tNYXhUcmFja0NvdW50XXt9OworICAgIHdoaWxlIChsb29wQ291bnQgPCBjZWlsKDEuMCAvIGludGVydmFsKSkgeworICAgICAgICBmb3IgKGludDMyX3QgaWR4ID0gMDsgaWR4IDwgbnVtVHJhY2tzOyBpZHgrKykgeworICAgICAgICAgICAgcmFuZ2UgPSBtQnVmZmVySW5mb1tpZHhdLnNpemUoKSAqIGludGVydmFsOworICAgICAgICAgICAgc3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ICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJhbXJ3YiIsIEFNUl9XQl8xLCBVTlVTRURfSUQsIDAuNSwgMC41LCAxKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJtcGVnMlRzIiwgQUFDXzEsIFVOVVNFRF9JRCwgMC4yLCAxLCAxKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJtcGVnNCIsIEFBQ18xLCBVTlVTRURfSUQsIDAuNCwgMC4zLCAwLjI1KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJtcGVnNCIsIEFBQ18xLCBVTlVTRURfSUQsIDAuMywgMSwgMC41KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJvZ2ciLCBPUFVTXzEsIFVOVVNFRF9JRCwgMC43LCAwLjMsIDEpKSk7CisKIC8vIFRPRE86IChiLzE0NDQ3NjE2NCkKIC8vIEFkZCBBQUNfQURUUywgRkxBQywgQVYxIGlucHV0Ci1JTlNUQU5USUFURV9URVNUX1NVSVRFX1AoV3JpdGVyVGVzdEFsbCwgV3JpdGVyVGVzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICA6OnRlc3Rpbmc6OlZhbHVlcyhtYWtlX3BhaXIoIm9nZyIsIDApLCBtYWtlX3BhaXIoIndlYm0iLCAwKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoImFhYyIsIDEpLCBtYWtlX3BhaXIoIm1wZWc0IiwgMSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJhbXJuYiIsIDMpLCBtYWtlX3BhaXIoImFtcndiIiwgNCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJ3ZWJtIiwgNSksIG1ha2VfcGFpcigid2VibSIsIDcpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VfcGFpcigid2VibSIsIDgpLCBtYWtlX3BhaXIoIm1wZWc0IiwgOSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyKCJtcGVnNCIsIDEwKSwgbWFrZV9wYWlyKCJtcGVnNCIsIDEyKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIm1wZWc0IiwgMTMpLCBtYWtlX3BhaXIoIm1wZWcyVHMiLCAxKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlX3BhaXIoIm1wZWcyVHMiLCA5KSkpOworSU5TVEFOVElBVEVfVEVTVF9TVUlURV9QKAorICAgICAgICBXcml0ZXJUZXN0QWxsLCBXcml0ZUZ1bmN0aW9uYWxpdHlUZXN0LAorICAgICAgICA6OnRlc3Rpbmc6OlZhbHVlcygKKyAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJhYWMiLCBBQUNfMSwgVU5VU0VEX0lELCAxKSwKKworICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoImFtcm5iIiwgQU1SX05CXzEsIFVOVVNFRF9JRCwgMSksCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgiYW1yd2IiLCBBTVJfV0JfMSwgVU5VU0VEX0lELCAxKSwKKworICAgICAgICAgICAgICAgIC8vIFRPRE8oYi8xNDQ5MDIwMTgpOiBFbmFibGUgdGVzdCBmb3IgbXBlZzJ0cworICAgICAgICAgICAgICAgIC8vIG1ha2VfdHVwbGUoIm1wZWcyVHMiLCBBQUNfMSwgVU5VU0VEX0lELCAxKSwKKyAgICAgICAgICAgICAgICAvLyBtYWtlX3R1cGxlKCJtcGVnMlRzIiwgQVZDXzEsIFVOVVNFRF9JRCwgMSksCisgICAgICAgICAgICAgICAgLy8gVE9ETyhiLzE1NjM1NTg1Nyk6IEFkZCBtdWx0aXRyYWNrIGZvciBtcGVnMnRzCisgICAgICAgICAgICAgICAgLy8gbWFrZV90dXBsZSgibXBlZzJUcyIsIEFBQ18xLCBBVkNfMSwgMC41MCksCisgICAgICAgICAgICAgICAgLy8gbWFrZV90dXBsZSgibXBlZzJUcyIsIEFWQ18xLCBBQUNfMSwgMC4yNSksCisKKyAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJtcGVnNCIsIEFBQ18xLCBVTlVTRURfSUQsIDEpLAorICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoIm1wZWc0IiwgQU1SX05CXzEsIFVOVVNFRF9JRCwgMSksCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgibXBlZzQiLCBBTVJfV0JfMSwgVU5VU0VEX0lELCAxKSwKKyAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJtcGVnNCIsIEFWQ18xLCBVTlVTRURfSUQsIDEpLAorICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoIm1wZWc0IiwgSDI2M18xLCBVTlVTRURfSUQsIDEpLAorICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoIm1wZWc0IiwgSEVJQ18xLCBVTlVTRURfSUQsIDEpLAorICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoIm1wZWc0IiwgSEVWQ18xLCBVTlVTRURfSUQsIDEpLAorICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoIm1wZWc0IiwgTVBFRzRfMSwgVU5VU0VEX0lELCAxKSwKKyAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJtcGVnNCIsIEFBQ18xLCBBVkNfMSwgMC4yNSksCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgibXBlZzQiLCBBVkNfMSwgQUFDXzEsIDAuNzUpLAorICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoIm1wZWc0IiwgQU1SX1dCXzEsIEFBQ18xLCAwLjc1KSwKKyAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJtcGVnNCIsIEhFVkNfMSwgQU1SX1dCXzEsIDAuMjUpLAorICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoIm1wZWc0IiwgSDI2M18xLCBBTVJfTkJfMSwgMC41MCksCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgibXBlZzQiLCBNUEVHNF8xLCBBQUNfMSwgMC43NSksCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgibXBlZzQiLCBBTVJfTkJfMSwgQU1SX1dCXzEsIDAuMjUpLAorICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoIm1wZWc0IiwgSDI2M18xLCBBTVJfTkJfMSwgMC41MCksCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgibXBlZzQiLCBNUEVHNF8xLCBIRVZDXzEsIDAuNzUpLAorCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgib2dnIiwgT1BVU18xLCBVTlVTRURfSUQsIDEpLAorCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgid2VibSIsIE9QVVNfMSwgVU5VU0VEX0lELCAxKSwKKyAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJ3ZWJtIiwgVk9SQklTXzEsIFVOVVNFRF9JRCwgMSksCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgid2VibSIsIFZQOF8xLCBVTlVTRURfSUQsIDEpLAorICAgICAgICAgICAgICAgIG1ha2VfdHVwbGUoIndlYm0iLCBWUDlfMSwgVU5VU0VEX0lELCAxKSwKKyAgICAgICAgICAgICAgICBtYWtlX3R1cGxlKCJ3ZWJtIiwgVlA4XzEsIE9QVVNfMSwgMC41MCksCisgICAgICAgICAgICAgICAgbWFrZV90dXBsZSgid2VibSIsIFZPUkJJU18xLCBWUDhfMSwgMC4yNSkpKTsKKworSU5TVEFOVElBVEVfVEVTVF9TVUlURV9QKA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IsNiArNTcsMTEgQEAKICAgICAgICAgICAgIGNhc2UgJ1AnOgogICAgICAgICAgICAgICAgIHNldFJlcyhvcHRhcmcpOwogICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSAnQyc6CisgICAgICAgICAgICAgICAgaWYgKCFzdHJjbXAob3B0YXJnLCAiZmFsc2UiKSkgeworICAgICAgICAgICAgICAgICAgICBkZWxldGVPdXRwdXQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CkBAIC02Miw3ICs3Miw4IEBACiAgICAgICAgICAgICAgICAgInVucmVjb2duaXplZCBvcHRpb246ICVzXG5cbiIKICAgICAgICAgICAgICAgICAidXNhZ2U6ICVzIDxndGVzdCBvcHRpb25zPiA8dGVzdCBvcHRpb25zPlxuXG4iCiAgICAgICAgICAgICAgICAgInRlc3Qgb3B0aW9ucyBhcmU6XG5cbiIKLSAgICAgICAgICAgICAgICAiLVAsIC0tcGF0aDogUmVzb3VyY2UgZmlsZXMgZGlyZWN0b3J5IGxvY2F0aW9uXG4iLAorICAgICAgICAgICAgICAgICItUCwgLS1wYXRoOiBSZXNvdXJjZSBmaWxlcyBkaXJlY3RvcnkgbG9jYXRpb25cbiIKKyAgICAgICAgICAgICAgICAiLUMsIGRlZmF1bHQ6dHJ1ZS4gRGVsZXRlIG91dHB1dCBmaWxlIGFmdGVyIHRlc3QgY29tcGxldGVzXG4iLAogICAgICAgICAgICAgICAgIGFyZ3Zbb3B0aW5kID86IDFdLCBhcmd2WzBdKTsKICAgICAgICAgcmV0dXJuIDI7CiAgICAgfQpkaWZmIC0tZ2l0IGEvbWVkaWEvbGlic3RhZ2VmcmlnaHQvdGVzdHMvd3JpdGVyL1dyaXRlclV0aWxpdHkuY3BwIGIvbWVkaWEvbGlic3RhZ2VmcmlnaHQvdGVzdHMv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ICAgIC8vIEEgbGFyZ2Utc2NhbGUtY2hhbmdlIGFkZGVkICdkZWZhdWx0X2FwcGxpY2FibGVfbGljZW5zZXMnIHRvIGltcG9ydAorICAgIC8vIGFsbCBvZiB0aGUgJ2xpY2Vuc2Vfa2luZHMnIGZyb20gImZyYW1ld29ya3NfYXZfbWVkaWFfbGlic3RhZ2VmcmlnaHRfdGltZWR0ZXh0X2xpY2Vuc2UiCisgICAgLy8gdG8gZ2V0IHRoZSBiZWxvdyBsaWNlbnNlIGtpbmRzOgorICAgIC8vICAgU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMAorICAgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWworICAgICAgICAiZnJhbWV3b3Jrc19hdl9tZWRpYV9saWJzdGFnZWZyaWdodF90aW1lZHRleHRfbGljZW5zZSIsCisgICAgXSwKK30KKworY2NfdGVzdCB7CisgICAgbmFtZTogIlRpbWVkVGV4dFVuaXRUZXN0IiwKKyAgICB0ZXN0X3N1aXRlczogWyJkZXZpY2UtdGVzdHMiXSwKKyAgICBndGVzdDogdHJ1ZSwKKworICAgIHNyY3M6IFsKKyAgICAgICAgIlRpbWVkVGV4dFVuaXRUZXN0LmNwcCIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJzdGFnZWZyaWdodF90aW1lZHRleHQiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZm91bmRhdGlvbiIsCisgICAgXSwKKworICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiZnJhbWV3b3Jrcy9hdi9tZWRpYS9saWJzdGFnZWZyaWdodCIsCisgICAgXSwKKworICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJsb2ciLAorICAgICAgICAibGlibWVkaWEiLAorICAgICAgICAibGliYmluZGVyIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV25vLW11bHRpY2hhciIsCisgICAgICAgICItV2Vyc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zIHRoZSBjb21tYW5kIGxpbmUgYXJndW1lbnRzCisgICAgaW50IGluaXRGcm9tT3B0aW9ucyhpbnQgYXJnYywgY2hhciAqKmFyZ3YpOworCisgICAgdm9pZCBzZXRSZXMoY29uc3QgY2hhciAqX3JlcykgeyByZXMgPSBfcmVzOyB9CisKKyAgICBjb25zdCBzdHJpbmcgZ2V0UmVzKCkgY29uc3QgeyByZXR1cm4gcmVzOyB9CisKKyAgcHJpdmF0ZToKKyAgICBzdHJpbmcgcmVzOworfTsKKworaW50IFRpbWVkVGV4dFRlc3RFbnZpcm9ubWVudDo6aW5pdEZyb21PcHRpb25zKGludCBhcmdjLCBjaGFyICoqYXJndikgeworICAgIHN0YXRpYyBzdHJ1Y3Qgb3B0aW9uIG9wdGlvbnNbXSA9IHt7InJlcyIsIHJlcXVpcmVkX2FyZ3VtZW50LCAwLCAnUCd9LCB7MCwgMCwgMCwgMH19OworCisgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgaW50IGluZGV4ID0gMDsKKyAgICAgICAgaW50IGMgPSBnZXRvcHRfbG9uZyhhcmdjLCBhcmd2LCAiUDoiLCBvcHRpb25zLCAmaW5kZXgpOworICAgICAgICBpZiAoYyA9PSAtMSkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBzd2l0Y2ggKGMpIHsKKyAgICAgICAgICAgIGNhc2UgJ1AnOgorICAgICAgICAgICAgICAgIHNldFJlcyhvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmIChvcHRpbmQgPCBhcmdjKSB7CisgICAgICAgIGZwcmludGYoc3RkZXJyLAorICAgICAgICAgICAgICAgICJ1bnJlY29nbml6ZWQgb3B0aW9uOiAlc1xuXG4iCisgICAgICAgICAgICAgICAgInVzYWdlOiAlcyA8Z3Rlc3Qgb3B0aW9ucz4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Y3QgRm9udEluZm8geworICAgIGludDMyX3QgZGlzcGxheUZsYWcgPSAtMTsKKyAgICBpbnQzMl90IGhvcml6b250YWxKdXN0aWZpY2F0aW9uID0gLTE7CisgICAgaW50MzJfdCB2ZXJ0aWNhbEp1c3RpZmljYXRpb24gPSAtMTsKKyAgICBpbnQzMl90IHJnYmFCYWNrZ3JvdW5kID0gLTE7CisgICAgaW50MzJfdCBsZWZ0UG9zID0gLTE7CisgICAgaW50MzJfdCB0b3BQb3MgPSAtMTsKKyAgICBpbnQzMl90IGJvdHRvbVBvcyA9IC0xOworICAgIGludDMyX3QgcmlnaHRQb3MgPSAtMTsKKyAgICBpbnQzMl90IHN0YXJ0Y2hhciA9IC0xOworICAgIGludDMyX3QgZW5kQ2hhciA9IC0xOworICAgIGludDMyX3QgZm9udElkID0gLTE7CisgICAgaW50MzJfdCBmYWNlU3R5bGUgPSAtMTsKKyAgICBpbnQzMl90IGZvbnRTaXplID0gLTE7CisgICAgaW50MzJfdCByZ2JhVGV4dCA9IC0xOworICAgIGludDMyX3QgZW50cnlDb3VudCA9IC0xOworfTsKKworc3RydWN0IEZvbnRSZWNvcmQgeworICAgIGludDMyX3QgZm9udElEID0gLTE7CisgICAgaW50MzJfdCBmb250TmFtZUxlbmd0aCA9IC0xOworICAgIGNvbnN0IHVpbnQ4X3QgKmZvbnQgPSBudWxscHRyOworfTsKKwordXNpbmcgbmFtZXNwYWNlIGFuZHJvaWQ7CisKK3N0YXRpYyBUaW1lZFRleHRUZXN0RW52aXJvbm1lbnQgKmdFbnYgPSBudWxscHRyOworCitjbGFzcyBUaW1lZFRleHRVbml0VGVzdCA6IHB1YmxpYyA6OnRlc3Rpbmc6OlRlc3RXaXRoUGFyYW08LypmaWxlbmFtZSovIHN0cmluZz4geworICBwdWJsaWM6CisgICAgVGltZWRUZXh0VW5pdFRlc3QoKXt9OworCisgICAgflRpbWVkVGV4dFVuaXRUZXN0KCkgeworICAgICAgICBpZiAobUVsZVN0cmVhbSkgbUV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GZvbnRJbmZvLmRpc3BsYXlGbGFnKTsKKyAgICBmb250SW5mby5ob3Jpem9udGFsSnVzdGlmaWNhdGlvbiA9IHRtcERhdGFbNF07CisgICAgQUxPR0koIkhvcml6b250YWwgSnVzdGlmaWNhdGlvbjogJWQiLCBmb250SW5mby5ob3Jpem9udGFsSnVzdGlmaWNhdGlvbik7CisgICAgZm9udEluZm8udmVydGljYWxKdXN0aWZpY2F0aW9uID0gdG1wRGF0YVs1XTsKKyAgICBBTE9HSSgiVmVydGljYWwgSnVzdGlmaWNhdGlvbjogJWQiLCBmb250SW5mby52ZXJ0aWNhbEp1c3RpZmljYXRpb24pOworICAgIGZvbnRJbmZvLnJnYmFCYWNrZ3JvdW5kID0KKyAgICAgICAgICAgICoodG1wRGF0YSArIDYpIDw8IDI0IHwgKih0bXBEYXRhICsgNykgPDwgMTYgfCAqKHRtcERhdGEgKyA4KSA8PCA4IHwgKih0bXBEYXRhICsgOSk7CisgICAgQUxPR0koInJnYmEgdmFsdWUgb2YgYmFja2dyb3VuZDogJWQiLCBmb250SW5mby5yZ2JhQmFja2dyb3VuZCk7CisKKyAgICB0bXBEYXRhICs9IDEwOworICAgIHJlbWFpbmluZyAtPSAxMDsKKworICAgIGlmIChyZW1haW5pbmcgPj0gOCkgeworICAgICAgICBmb250SW5mby5sZWZ0UG9zID0gVTE2X0FUKHRtcERhdGEpOworICAgICAgICBBTE9HSSgiTGVmdDogJWQiLCBmb250SW5mby5sZWZ0UG9zKTsKKyAgICAgICAgZm9udEluZm8udG9wUG9zID0gVTE2X0FUKHRtcERhdGEgKyAyKTsKKyAgICAgICAgQUxPR0koIlRvcDogJWQiLCBmb250SW5mby50b3BQb3MpOworICAgICAgICBmb250SW5mby5ib3R0b21Qb3MgPSBVMTZfQVQodG1wRGF0YSArIDQpOworICAgICAgICBBTE9HSSgiQm90dG9tOiAlZCIsIGZvbnRJbmZvLmJvdHRvbVBvcyk7CisgICAgICAgIGZvbnRJbmZvLnJpZ2h0UG9zID0gVTE2X0FUKHRtcERhdGEgKyA2KTsKKyAgICAgICAgQUxPR0koIlJpZ2h0OiAlZCIsIGZvbnRJbmZvLnJpZ2h0UG9zKTsKKworICAgICAgICB0bXBEYXRhICs9IDg7CisgICAgICAgIHJlbWFpbmluZyAtPSA4OworCisgICAgICAgIGlmIChyZW1haW5pbmcgPj0gMTIpIHsKKyAgICAgICAgICAgIGZvbnRJbmZvLnN0YXJ0Y2hhciA9IFUxNl9BVCh0bXBEYXRhKTsKKyAgICAgICAgICAgIEFMT0dJKCJTdGFydCBjaGFyYWN0ZXI6ICVkIiwgZm9udEluZm8uc3RhcnRjaGFyKTsKKyAgICAgICAgICAgIGZvbnRJbmZvLmVuZENoYXIgPSBVMTZfQVQodG1wRGF0YSArIDIpOworICAgICAgICAgICAgQUxPR0koIkVuZCBjaGFyYWN0ZXI6ICVkIiwgZm9udEluZm8uZW5kQ2hhcik7CisgICAgICAgICAgICBmb250SW5mby5mb250SWQgPSBVMTZfQVQodG1wRGF0YSArIDQpOworICAgICAgICAgICAgQUxPR0koIlZhbHVlIG9mIGZvbnQgSWRlbnRpZmllcjogJWQiLCBmb250SW5mby5mb250SWQpOworICAgICAgICAgICAgZm9udEluZm8uZmFjZVN0eWxlID0gKih0bXBEYXRhICsgNik7CisgICAgICAgICAgICBBTE9HSSgiRmFjZSBzdHlsZSBmbGFnIDogJWQiLCBmb250SW5mby5mYWNlU3R5bGUpOworICAgICAgICAgICAgZm9udEluZm8uZm9udFNpemUgPSAqKHRtcERhdGEgKyA3KTsKKyAgICAgICAgICAgIEFMT0dJKCJTaXplIG9mIHRoZSBmb250OiAlZCIsIGZvbnRJbmZvLmZvbnRTaXplKTsKKyAgICAgICAgICAgIGZvbnRJbmZvLnJnYmFUZXh0ID0gKih0bXBEYXRhICsgOCkgPDwgMjQgfCAqKHRtcERhdGEgKyA5KSA8PCAxNiB8ICoodG1wRGF0YSArIDEwKSA8PCA4IHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKih0bXBEYXRhICsgMTEpOworICAgICAgICAgICAgQUxPR0koInJnYmEgdmFsdWUgb2YgdGhlIHRleHQ6ICVkIiwgZm9udEluZm8ucmdiYVRleHQpOworCisgICAgICAgICAgICB0bXBEYXRhICs9IDEyOworICAgICAgICAgICAgcmVtYWluaW5nIC09IDEyOworCisgICAgICAgICAgICBpZiAocmVtYWluaW5nID49IDEwKSB7CisgICAgICAgICAgICAgICAgLy8gU2tpcHBpbmcgdGhlIGJ5dGVzIGNvbnRhaW5pbmcgaW5mb3JtYXRpb24gYWJvdXQgdGhlIHR5cGUgb2Ygc3ViYm94KGZ0YWIpCisgICAgICAgICAgICAgICAgZm9udEluZm8uZW50cnlDb3VudCA9IFUxNl9BVCh0bXBEYXRhICsgOCk7CisgICAgICAgICAgICAgICAgQUxPR0koIlZhbHVlIG9mIGVudHJ5IGNvdW50OiAlZCIsIGZvbnRJbmZvLmVudHJ5Q291bnQpOworCisgICAgICAgICAgICAgICAgdG1wRGF0YSArPSAxMDsKKyAgICAgICAgICAgICAgICByZW1haW5pbmcgLT0gMTA7CisKKyAgICAgICAgICAgICAgICBmb3IgKGludDMyX3QgaSA9IDA7IGkgPCBmb250SW5mby5lbnRyeUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHJlbWFpbmluZyA8IDMpIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHRlbXBGb250SUQgPSBVMTZfQVQodG1wRGF0YSk7CisgICAgICAgICAgICAgICAgICAgIEFMT0dJKCJGb250IElkOiAlZCIsIHRlbXBGb250SUQpOworICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHRlbXBGb250TmFtZUxlbmd0aCA9ICoodG1wRGF0YSArIDIpOworICAgICAgICAgICAgICAgICAgICBBTE9HSSgiTGVuZ3RoIG9mIGZvbnQgbmFtZTogJWQiLCB0ZW1wRm9udE5hbWVMZW5ndGgpOworCisgICAgICAgICAgICAgICAgICAgIHRtcERhdGEgKz0gMzsKKyAgICAgICAgICAgICAgICAgICAgcmVtYWluaW5nIC09IDM7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKHJlbWFpbmluZyA8IHRlbXBGb250TmFtZUxlbmd0aCkgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKnRtcEZvbnQgPSB0bXBEYXRhOworICAgICAgICAgICAgICAgICAgICBjaGFyICp0bXBGb250TmFtZSA9IHN0cm5kdXAoKGNvbnN0IGNoYXIgKil0bXBGb250LCB0ZW1wRm9udE5hbWVMZW5ndGgpOworICAgICAgICAgICAgICAgICAgICBBU1NFUlRfTkUodG1wRm9udE5hbWUsIG51bGxwdHIpIDw8ICJGb250IE5hbWUgaXMgbnVsbCI7CisgICAgICAgICAgICAgICAgICAgIEFMT0dJKCJGb250TmFtZSA9ICVzIiwgdG1wRm9udE5hbWUpOworICAgICAgICAgICAgICAgICAgICBmcmVlKHRtcEZvbnROYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgdG1wRGF0YSArPSB0ZW1wRm9udE5hbWVMZW5ndGg7CisgICAgICAgICAgICAgICAgICAgIHJlbWFpbmluZyAtPSB0ZW1wRm9udE5hbWVMZW5ndGg7CisgICAgICAgICAgICAgICAgICAgIGZvbnRSZWNvcmRFbnRyaWVzLnB1c2hfYmFjayh7dGVtcEZvbnRJRCwgdGVtcEZvbnROYW1lTGVuZ3RoLCB0bXBGb250fSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgUGFyY2VsIHBhcmNlbDsKKyAgICBpbnQzMl90IGZsYWcgPSBUZXh0RGVzY3JpcHRpb25zOjpJTl9CQU5EX1RFWFRfM0dQUCB8IFRleHREZXNjcmlwdGlvbnM6OkdMT0JBTF9ERVNDUklQVElPTlM7CisgICAgc3RhdHVzX3Qgc3RhdHVzID0gVGV4dERlc2NyaXB0aW9uczo6Z2V0UGFyY2VsT2ZEZXNjcmlwdGlvbnMo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wYXJjZWwuZGF0YUF2YWlsKCksIDApIDw8ICJQYXJjZWwgaGFzIHNvbWUgZGF0YSBsZWZ0IHRvIHJlYWQiOworfQorCitJTlNUQU5USUFURV9URVNUX1NVSVRFX1AoVGltZWRUZXh0VW5pdFRlc3RBbGwsIFNSVERlc2NyaXB0aW9uVGVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICA6OnRlc3Rpbmc6OlZhbHVlcygoInNhbXBsZVRlc3QxLnNydCIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgic2FtcGxlVGVzdDIuc3J0IikpKTsKKworSU5TVEFOVElBVEVfVEVTVF9TVUlURV9QKFRpbWVkVGV4dFVuaXRUZXN0QWxsLCBUZXh0M0dQUERlc2NyaXB0aW9uVGVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICA6OnRlc3Rpbmc6OlZhbHVlcygoInR4M2dCb3gxIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCJ0eDNnQm94MiIpKSk7CisKK2ludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikgeworICAgIGdFbnYgPSBuZXcgVGltZWRUZXh0VGVzdEVudmlyb25tZW50KCk7CisgICAgOjp0ZXN0aW5nOjpBZGRHbG9iYWxUZXN0RW52aXJvbm1lbnQoZ0Vudik7CisgICAgOjp0ZXN0aW5nOjpJbml0R29vZ2xlVGVzdCgmYXJnYywgYXJndik7CisgICAgaW50IHN0YXR1cyA9IGdFbnYtPmluaXRGcm9tT3B0aW9ucyhhcmdjLCBhcmd2KTsKKyAgICBpZiAoc3RhdHVzID09IDApIHsKKyAgICAgICAgc3RhdHVzID0gUlVOX0FMTF9URVNUUygpOworICAgICAgICBBTE9HVigiVGVzdCByZXN1bHQgPSAlZFxuIiwgc3RhdHVzKTsKKyAgICB9CisgICAgcmV0dXJuIHN0YXR1czsKK30KZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2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CisgICAgICAgICJsaWJzdGFnZWZyaWdodCIsCisgICAgXSwKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGliYmluZGVyIiwKKyAgICAgICAgImxpYmN1dGlscyIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgXSwKK30KKworY2NfZGVmYXVsdHMgeworICAgIG5hbWU6ICJ3cml0ZXItZnV6emVyLWRlZmF1bHRzIiwKKyAgICBkZWZhdWx0czogWyJ3cml0ZXItZnV6emVyYmFzZS1kZWZhdWx0cyJdLAorICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJ3cml0ZXJmdXp6ZXJiYXNlIiwKKyAgICBdLAorICAgIGZ1enpfY29uZmlnOiB7CisgICAgICAgIGNjOiBbCisgICAgICAgICAgICAiYW5kcm9pZC1tZWRpYS1mdXp6aW5nLXJlcG9ydHNAZ29vZ2xlLmNvbSIsCisgICAgICAgIF0sCisgICAgICAgIGNvbXBvbmVudGlkOiAxNTUyNzYsCisgICAgfSwKK30KKworY2NfbGlicmFyeV9zdGF0aWMgeworICAgIG5hbWU6ICJsaWJ3cml0ZXJmdXp6ZXJiYXNlIiwKKyAgICBkZWZhdWx0czogWyJ3cml0ZXItZnV6emVyYmFzZS1kZWZhdWx0cyJdLAorICAgIHNyY3M6IFsKKyAgICAgICAgIldyaXRlckZ1enplckJhc2UuY3BwIiwKKyAgICBdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiYW1ybmJfd3JpdGVyX2Z1enplciIsCisgICAgZGVmYXVsdHM6IFsid3JpdGVyLWZ1enplci1kZWZhdWx0cyJdLAorICAgIHNyY3M6IFsKKyAgICAgICAgImFtcl93cml0ZXJfZnV6emVyLmNwcCIsCisgICAgXSwKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1EQU1STkIiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJhbXJ3Yl93cml0ZXJfZnV6emVyIiwKKyAgICBkZWZhdWx0czogWyJ3cml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dGVyRnV6emVyQmFzZTo6QnVmZmVyU291cmNlOjpnZXRGcmFtZUluZm8oKSB7CisgICAgc2l6ZV90IHJlYWRJbmRleFN0YXJ0ID0gbVJlYWRJbmRleDsKKyAgICBpZiAobVNpemUgLSBtUmVhZEluZGV4ID4ga01hcmtlclNpemUgKyBrTWFya2VyU3VmZml4U2l6ZSkgeworICAgICAgICBib29sIGlzRnJhbWVBdmFpbGFibGUgPSB0cnVlOworICAgICAgICBzaXplX3QgYnl0ZXNSZW1haW5pbmcgPSBtU2l6ZTsKKyAgICAgICAgbVJlYWRJbmRleCA9IG1TaXplIC0ga01hcmtlclNpemU7CisgICAgICAgIHdoaWxlIChpc0ZyYW1lQXZhaWxhYmxlKSB7CisgICAgICAgICAgICBpc0ZyYW1lQXZhaWxhYmxlID0gc2VhcmNoRm9yTWFya2VyKHJlYWRJbmRleFN0YXJ0KTsKKyAgICAgICAgICAgIGlmIChpc0ZyYW1lQXZhaWxhYmxlKSB7CisgICAgICAgICAgICAgICAgc2l6ZV90IGxvY2F0aW9uID0gbVJlYWRJbmRleCArIGtNYXJrZXJTaXplOworICAgICAgICAgICAgICAgIGlmIChsb2NhdGlvbiArIGtNYXJrZXJTdWZmaXhTaXplID49IGJ5dGVzUmVtYWluaW5nKSB7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBib29sIGlzQ1NEID0gaXNDU0RNYXJrZXIobG9jYXRpb24pOworICAgICAgICAgICAgICAgIGxvY2F0aW9uICs9IGtNYXJrZXJTdWZmaXhTaXplOworICAgICAgICAgICAgICAgIHVpbnQ4X3QgKmZyYW1lUHRyID0gY29uc3RfY2FzdDx1aW50OF90ICo+KCZtRGF0YVtsb2NhdGlvbl0pOworICAgICAgICAgICAgICAgIHNpemVfdCBmcmFtZVNpemUgPSBieXRlc1JlbWFpbmluZyAtIGxvY2F0aW9uLCBidWZmZXJTaXplID0gMDsKKyAgICAgICAgICAgICAgICB1aW50OF90IHRyYWNrSW5kZXggPSBmcmFtZVB0clswXSAlIGtNYXhUcmFja0NvdW50OworICAgICAgICAgICAgICAgICsrZnJhbWVQdHI7CisgICAgICAgICAgICAgICAgdWludDhfdCBmbGFncyA9IDA7CisgICAgICAgICAgICAgICAgaW50NjRfdCBwdHMgPSAwOworICAgICAgICAgICAgICAgIGlmIChpc0NTRCAmJiBmcmFtZVNpemUgPiAxKSB7CisgICAgICAgICAgICAgICAgICAgIGZsYWdzIHw9IGtDb2RlY0NvbmZpZ0ZsYWc7CisgICAgICAgICAgICAgICAgICAgIHB0cyA9IDA7CisgICAgICAgICAgICAgICAgICAgICsrbU51bUNzZHNbdHJhY2tJbmRleF07CisgICAgICAgICAgICAgICAgICAgIGJ1ZmZlclNpemUgPSBmcmFtZVNpemUgLSAxOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZnJhbWVTaXplID4gc2l6ZW9mKHVpbnQ4X3QpICsgc2l6ZW9mKGludDY0X3QpICsgMSkgeworICAgICAgICAgICAgICAgICAgICBmbGFncyA9IGZsYWdUeXBlc1tmcmFtZVB0clswXSAlIHNpemUoZmxhZ1R5cGVzKV07CisgICAgICAgICAgICAgICAgICAgICsrZnJhbWVQdHI7CisgICAgICAgICAgICAgICAgICAgIGNvcHkoZnJhbWVQdHIsIGZyYW1lUHRyICsgc2l6ZW9mKGludDY0X3QpLCByZWludGVycHJldF9jYXN0PHVpbnQ4X3QgKj4oJnB0cykpOworICAgICAgICAgICAgICAgICAgICBmcmFtZVB0ciArPSBzaXplb2YoaW50NjRfdCk7CisgICAgICAgICAgICAgICAgICAgIGJ1ZmZlclNpemUgPSBmcmFtZVNpemUgLSAoc2l6ZW9mKHVpbnQ4X3QpICsgc2l6ZW9mKGludDY0X3QpKSAtIDE7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1GcmFtZUxpc3RbdHJhY2tJbmRleF0uaW5zZXJ0KG1GcmFtZUxpc3RbdHJhY2tJbmRleF0uYmVnaW4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGcmFtZURhdGF7YnVmZmVyU2l6ZSwgZmxhZ3MsIHB0cywgZnJhbWVQdHJ9KTsKKyAgICAgICAgICAgICAgICBieXRlc1JlbWFpbmluZyAtPSAoZnJhbWVTaXplICsga01hcmtlclNpemUgKyBrTWFya2VyU3VmZml4U2l6ZSk7CisgICAgICAgICAgICAgICAgLS1tUmVhZEluZGV4OworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorICAgIGlmIChtRnJhbWVMaXN0WzBdLmVtcHR5KCkgJiYgbUZyYW1lTGlzdFsxXS5lbXB0eSgpKSB7CisgICAgICAgIC8qKgorICAgICAgICAgKiBTY2VuYXJpbyB3aGVyZSBpbnB1dCBkYXRhIGRvZXMgbm90IGNvbnRhaW4gdGhlIGN1c3RvbSBmcmFtZSBtYXJrZXJzLgorICAgICAgICAgKiBIZW5jZSBmZWVkIHRoZSBlbnRpcmUgZGF0YSBhcyBzaW5nbGUgZnJhbWUuCisgICAgICAgICAqLworICAgICAgICBtRnJhbWVMaXN0WzBdLmVtcGxhY2VfYmFjayhGcmFtZURhdGF7bVNpemUgLSByZWFkSW5kZXhTdGFydCwgMCwgMCwgbURhdGEgKyByZWFkSW5kZXhTdGFydH0pOworICAgIH0KK30KK2Jvb2wgV3JpdGVyRnV6emVyQmFzZTo6QnVmZmVyU291cmNlOjpnZXRUcmFja0luZm8oaW50MzJfdCB0cmFja0luZGV4KSB7CisgICAgaWYgKG1TaXplIDw9IG1SZWFkSW5kZXggKyBzaXplb2YodWludDhfdCkpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBzaXplX3QgbWltZVR5cGVJZHggPSBtRGF0YVttUmVhZEluZGV4XSAlIGtTdXBwb3J0ZWRNaW1lVHlwZXM7CisgICAgY2hhciAqbWltZSA9IChjaGFyICopc3VwcG9ydGVkTWltZVR5cGVzW21pbWVUeXBlSWR4XS5jX3N0cigpOworICAgIG1QYXJhbXNbdHJhY2tJbmRleF0ubWltZSA9IG1pbWU7CisgICAgbVJlYWRJbmRleCArPSBzaXplb2YodWludDhfdCk7CisKKyAgICBpZiAobVNpemUgPiBtUmVhZEluZGV4ICsgMiAqIHNpemVvZihpbnQzMl90KSkgeworICAgICAgICBpZiAoIXN0cm5jbXAobWltZSwgImF1ZGlvLyIsIDYpKSB7CisgICAgICAgICAgICBjb3B5KG1EYXRhICsgbVJlYWRJbmRleCwgbURhdGEgKyBtUmVhZEluZGV4ICsgc2l6ZW9mKGludDMyX3QpLAorICAgICAgICAgICAgICAgICByZWludGVycHJldF9jYXN0PGNoYXIgKj4oJm1QYXJhbXNbdHJhY2tJbmRleF0uY2hhbm5lbENvdW50KSk7CisgICAgICAgICAgICBjb3B5KG1EYXRhICsgbVJlYWRJbmRleCArIHNpemVvZihpbnQzMl90KSwgbURhdGEgKyBtUmVhZEluZGV4ICsgMiAqIHNpemVvZihpbnQzMl90KSwKKyAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDxjaGFyICo+KCZtUGFyYW1zW3RyYWNrSW5kZXhdLnNhbXBsZVJhdGUpKTsKKyAgICAgICAgfSBlbHNlIGlmICghc3RybmNtcChtaW1lLCAidmlkZW8vIiwgNikpIHsKKyAgICAgICAgICAgIGNvcHkobURhdGEgKyBtUmVhZEluZGV4LCBtRGF0YSArIG1SZWFkSW5kZXggKyBzaXplb2YoaW50MzJfdCksCisgICAgICAgICAgICAgICAgIHJlaW50ZXJwcmV0X2Nhc3Q8Y2hhciAqPigmbVBhcmFtc1t0cmFja0luZGV4XS5oZWlnaHQpKTsKKyAgICAgICAgICAgIGNvcHkobURhdGEgKyBtUmVhZEluZGV4ICsgc2l6ZW9mKGludDMyX3QpLCBtRGF0YSArIG1SZWFkSW5kZXggKyAyICogc2l6ZW9mKGludDMyX3QpLAorICAgICAgICAgICAgICAgICByZWludGVycHJldF9jYXN0PGNoYXIgKj4oJm1QYXJhbXNbdHJhY2tJbmRleF0ud2lkdGgpKTsKKyAgICAgICAgfQorICAgICAgICBtUmVhZEluZGV4ICs9IDIgKiBzaXplb2YoaW50MzJfdCk7CisgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKHN0cm5jbXAobWltZSwgInRleHQvIiwgNSkgJiYgc3RybmNtcChtaW1lLCAiYXBwbGljYXRpb24vIiwgMTIpKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIHRydWU7Cit9CisKK3ZvaWQgd3JpdGVIZWFkZXJCdWZmZXJzKHZlY3RvcjxGcmFtZURhdGE+ICZidWZmZXJJbmZvLCBzcDxBTWVzc2FnZT4gJmZvcm1hdCwgaW50MzJfdCBudW1Dc2RzKSB7CisgICAgY2hhciBjc2ROYW1lW2tNYXhDU0RTdHJsZW5dOworICAgIGZvciAoaW50IGNzZElkID0gMDsgY3NkSWQgPCBudW1Dc2RzOyArK2NzZElkKSB7CisgICAgICAgIGludDMyX3QgZmxhZ3MgPSBidWZmZXJJbmZvW2NzZElkXS5mbGFnczsKKyAgICAgICAgaWYgKGZsYWdzID09IGtDb2RlY0NvbmZpZ0ZsYWcpIHsKKyAgICAgICAgICAgIHNwPEFCdWZmZXI+IGNzZEJ1ZmZlciA9CisgICAgICAgICAgICAgICAgQUJ1ZmZlcjo6Q3JlYXRlQXNDb3B5KCh2b2lkICopYnVmZmVySW5mb1tjc2RJZF0uYnVmLCBidWZmZXJJbmZvW2NzZElkXS5zaXplKTsKKyAgICAgICAgICAgIGlmIChjc2RCdWZmZXIuZ2V0KCkgPT0gbnVsbHB0ciB8fCBjc2RCdWZmZXItPmJhc2UoKSA9PSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc25wcmludGYoY3N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ICAgICAgICByZW1haW5pbmdOdW1GcmFtZXNbaWR4XSA9IG1CdWZmZXJTb3VyY2UtPmdldEZyYW1lTGlzdChpZHgpLnNpemUoKSAtIGN1cnJlbnRGcmFtZUluZGV4W2lkeF07CisgICAgfQorICAgIGRvIHsKKyAgICAgICAgbnVtVHJhY2tGcmFtZXNEb25lID0gbnVtVHJhY2tzOworICAgICAgICBmb3IgKGludDMyX3QgaWR4ID0gMDsgaWR4IDwgbnVtVHJhY2tzOyArK2lkeCkgeworICAgICAgICAgICAgaWYgKHJlbWFpbmluZ051bUZyYW1lc1tpZHhdID4gMCkgeworICAgICAgICAgICAgICAgIGludDMyX3QgbnVtRnJhbWVzSW50ZXJsZWF2ZSA9CisgICAgICAgICAgICAgICAgICAgIG1pbihyZW1haW5pbmdOdW1GcmFtZXNbaWR4XSwgc3RhdGljX2Nhc3Q8aW50MzJfdD4obnVtQnVmZmVyc0ludGVybGVhdmUpKTsKKyAgICAgICAgICAgICAgICBzZW5kQnVmZmVyc1RvV3JpdGVyKG1DdXJyZW50VHJhY2tbaWR4XSwgaWR4LCBjdXJyZW50RnJhbWVJbmRleFtpZHhdLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudEZyYW1lSW5kZXhbaWR4XSArIG51bUZyYW1lc0ludGVybGVhdmUpOworICAgICAgICAgICAgICAgIGN1cnJlbnRGcmFtZUluZGV4W2lkeF0gKz0gbnVtRnJhbWVzSW50ZXJsZWF2ZTsKKyAgICAgICAgICAgICAgICByZW1haW5pbmdOdW1GcmFtZXNbaWR4XSAtPSBudW1GcmFtZXNJbnRlcmxlYXZlOworICAgICAgICAgICAgICAgIC0tbnVtVHJhY2tGcmFtZXNEb25lOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfSB3aGlsZSAobnVtVHJhY2tGcmFtZXNEb25lIDwgbnVtVHJhY2tzKTsKK30KKwordm9pZCBXcml0ZXJGdXp6ZXJCYXNlOjppbml0RmlsZVdyaXRlckFuZFByb2Nlc3NEYXRhKGNvbnN0IHVpbnQ4X3QgKmRhdGEsIHNpemVfdCBzaXplKSB7CisgICAgaWYgKCFjcmVhdGVPdXRwdXRGaWxlKCkpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICBpZiAoIWNyZWF0ZVdyaXRlcigpKSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICBpZiAoc2l6ZSA8IDEpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICB1aW50OF90IG51bUJ1ZmZlcnNJbnRlcmxlYXZlID0gKGRhdGFbMF0gPT0gMCA/IDEgOiBkYXRhWzBdKTsKKyAgICArK2RhdGE7CisgICAgLS1zaXplOworCisgICAgbUJ1ZmZlclNvdXJjZSA9IG5ldyBCdWZmZXJTb3VyY2UoZGF0YSwgc2l6ZSk7CisgICAgaWYgKCFtQnVmZmVyU291cmNlKSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgbU51bVRyYWNrcyA9IG1CdWZmZXJTb3VyY2UtPmdldE51bVRyYWNrcygpOworICAgIGlmIChtTnVtVHJhY2tzID4gMCkgeworICAgICAgICBmb3IgKGludDMyX3QgaWR4ID0gMDsgaWR4IDwgbU51bVRyYWNrczsgKytpZHgpIHsKKyAgICAgICAgICAgIGlmICghbUJ1ZmZlclNvdXJjZS0+Z2V0VHJhY2tJbmZvKGlkeCkpIHsKKyAgICAgICAgICAgICAgICBpZiAoaWR4ID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgZGVsZXRlIG1CdWZmZXJTb3VyY2U7CisgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbU51bVRyYWNrcyA9IGlkeDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBtQnVmZmVyU291cmNlLT5nZXRGcmFtZUluZm8oKTsKKyAgICAgICAgZm9yIChpbnQzMl90IGlkeCA9IDA7IGlkeCA8IG1OdW1UcmFja3M7ICsraWR4KSB7CisgICAgICAgICAgICBhZGRXcml0ZXJTb3VyY2UoaWR4KTsKKyAgICAgICAgfQorICAgICAgICBzdGFydCgpOworICAgICAgICBzZW5kQnVmZmVyc0ludGVybGVhdmUobU51bVRyYWNrcywgbnVtQnVmZmVyc0ludGVybGVhdmUpOworICAgICAgICBmb3IgKGludDMyX3QgaWR4ID0gMDsgaWR4IDwgbU51bVRyYWNrczsgKytpZHgpIHsKKyAgICAgICAgICAgIGlmIChtQ3VycmVudFRyYWNrW2lkeF0pIHsKKyAgICAgICAgICAgICAgICBtQ3VycmVudFRyYWNrW2lkeF0tPnN0b3AoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICBkZWxldGUgbUJ1ZmZlclNvdXJjZTsKKyAgICBtV3JpdGVyLT5zdG9wKCk7Cit9CmRpZmYgLS1naXQgYS9tZWRpYS9saWJzdGFnZWZyaWdodC93cml0ZXJfZnV6emVycy9hbXJfd3JpdGVyX2Z1enplci5jcHAgYi9tZWRpYS9saWJzdGFnZWZyaWdodC93cml0ZXJfZnV6emVycy9hbXJfd3JpdGVyX2Z1enplci5jcHAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uYmJiNmY5ZgotLS0gL2Rldi9udWxsCisrKyBiL21lZGlhL2xpYnN0YWdlZnJpZ2h0L3dyaXRlcl9mdXp6ZXJzL2Ftcl93cml0ZXJfZnV6emVyLmNwcApAQCAtMCwwICsxLDUwIEBACisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgKgorICogQ29weXJpZ2h0IChDKSAyMDIwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY3QKKyAqCisgKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi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MyX3Qgc2FtcGxlUmF0ZTsKKyAgICBpbnQzMl90IGNoYW5uZWxDb3VudDsKK307CisKK3N0cnVjdCBGcmFtZURhdGEgeworICAgIHNpemVfdCBzaXplOworICAgIHVpbnQ4X3QgZmxhZ3M7CisgICAgaW50NjRfdCB0aW1lVXM7CisgICAgY29uc3QgdWludDhfdCogYnVmOworfTsKKworc3RhdGljIHN0cmluZyBzdXBwb3J0ZWRNaW1lVHlwZXNbXSA9IHsiYXVkaW8vM2dwcCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhdWRpby9hbXItd2IiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYXVkaW8vdm9yYmlzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImF1ZGlvL29wdXMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYXVkaW8vbXA0YS1sYXRtIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImF1ZGlvL21wZWciLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYXVkaW8vbXBlZy1MMSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhdWRpby9tcGVnLUwyIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImF1ZGlvL21pZGkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYXVkaW8vcWNlbHAiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYXVkaW8vZzcxMS1hbGF3IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImF1ZGlvL2c3MTEtbWxhdyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhdWRpby9mbGFjIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImF1ZGlvL2FhYy1hZHRzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImF1ZGlvL2dzbSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhdWRpby9hYzMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYXVkaW8vZWFjMyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhdWRpby9lYWMzLWpvYyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhdWRpby9hYzQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYXVkaW8vc2NyYW1ibGVkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImF1ZGlvL2FsYWMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYXVkaW8veC1tcy13bWEiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYXVkaW8veC1hZHBjbS1tcyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhdWRpby94LWFkcGNtLWR2aS1pbWEiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmlkZW8vYXZjIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInZpZGVvL2hldmMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmlkZW8vbXA0di1lcyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2aWRlby8zZ3BwIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInZpZGVvL3gtdm5kLm9uMi52cDgiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmlkZW8veC12bmQub24yLnZwOSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2aWRlby9hdjAxIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInZpZGVvL21wZWcyIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInZpZGVvL2RvbGJ5LXZpc2lvbiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2aWRlby9zY3JhbWJsZWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmlkZW8vZGl2eCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2aWRlby9kaXZ4MyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2aWRlby94dmlkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInZpZGVvL3gtbW90aW9uLWpwZWciLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGV4dC8zZ3BwLXR0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3gtc3VicmlwIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRleHQvdnR0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRleHQvY2VhLTYwOCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0ZXh0L2NlYS03MDgiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24veC1pZDN2NCJ9OworCitlbnVtIFNhbXBsZUZsYWcgeworICAgIERFRkFVTFRfRkxBRyA9IDAsCisgICAgU1lOQ19GTEFHID0gMSwKKyAgICBFTkNSWVBURURfRkxBRyA9IDIsCit9OworCitzdGF0aWMgdWludDhfdCBmbGFnVHlwZXNbXSA9IHtTYW1wbGVGbGFnOjpERUZBVUxUX0ZMQUcsIFNhbXBsZUZsYWc6OlNZTkNfRkxBRywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNhbXBsZUZsYWc6OkVOQ1JZUFRFRF9GTEFHfTsKKworY2xhc3MgV3JpdGVyRnV6emVyQmFzZSB7CisgICBwdWJsaWM6CisgICAgV3JpdGVyRnV6emVyQmFzZSgpID0gZGVmYXVsdDsKKyAgICB2aXJ0dWFsIH5Xcml0ZXJGdXp6ZXJCYXNlKCkgeworICAgICAgICBpZiAobUZpbGVNZXRhKSB7CisgICAgICAgICAgICBtRmlsZU1ldGEuY2xlYXIoKTsKKyAgICAgICAgICAgIG1GaWxlTWV0YSA9IG51bGxwdHI7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1Xcml0ZXIpIHsKKyAgICAgICAgICAgIG1Xcml0ZXIuY2xlYXIoKTsKKyAgICAgICAgICAgIG1Xcml0ZXIgPSBudWxscHRyOworICAgICAgICB9CisgICAgICAgIGZvciAoaW50MzJfdCBpZHggPSAwOyBpZHggPCBrTWF4VHJhY2tDb3VudDsgKytpZHgpIHsKKyAgICAgICAgICAgIGlmIChtQ3VycmVudFRyYWNrW2lkeF0pIHsKKyAgICAgICAgICAgICAgICBtQ3VycmVudFRyYWNrW2lkeF0tPnN0b3AoKTsKKyAgICAgICAgICAgICAgICBtQ3VycmVudFRyYWNrW2lkeF0uY2xlYXIoKTsKKyAgICAgICAgICAgICAgICBtQ3VycmVudFRyYWNrW2lkeF0gPSBudWxscHRyOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGNsb3NlKG1GZCk7CisgICAgfTsKKworICAgIC8qKiBGdW5jdGlvbiB0byBjcmVhdGUgdGhlIG1lZGlhIHdyaXRlciBjb21wb25lbnQuCisgICAgICogVG8gYmUgaW1wbGVtZW50ZWQgYnkgdGhlIGRlcml2ZWQgY2xhc3MuCisgICAgICovCisgICAgdmlydHVhbCBib29sIGNyZWF0ZVdyaXRlcigpID0gMDsKKworICAgIC8qKiBQYXJlbnQgY2xhc3MgZnVuY3Rpb25zIHRvIGJlIHJldXNlZCBieSBkZXJpdmVkIGNsYXNzLgorICAgICAqIFRoZXNlIGFyZSBjb21tb24gZm9yIGFsbCBtZWRpYSB3cml0ZXIgY29tcG9uZW50cy4KKyAgICAgKi8KKyAgICBib29sIGNyZWF0ZU91dHB1dEZpbGUoKTsKKworICAgIHZvaWQgYWRkV3JpdGVyU291cmNlKGludDMyX3QgdHJhY2tJbmRleCk7CisKKyAgICB2b2lkIHN0YXJ0KCk7CisKKyAgICB2b2lkIHNlbmRCdWZmZXJzVG9Xcml0ZXIoc3A8TWVkaWFBZGFwdGVyPiYgY3VycmVudFRyYWNrLCBpbnQzMl90IHRyYWNrSW5kZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3Qgc3RhcnRGcmFtZUluZGV4LCBpbnQzMl90IGVuZEZyYW1lSW5kZXgpOworCisgICAgdm9pZCBzZW5kQnVmZmVyc0ludGVybGVhdmUoaW50MzJfdCBudW1UcmFja3MsIHVpbnQ4X3QgbnVtQnVmZmVyc0ludGVybGVhdmUpOworCisgICAgdm9pZCBpbml0RmlsZVdyaXRlckFuZFByb2Nlc3NEYXRhKGNvbnN0IHVpbnQ4X3QqIGRhdGEsIHNpemVfdCBzaXplKTsKKworICAgcHJvdGVjdGVkOgorICAgIGNsYXNzIEJ1ZmZlclNvdXJjZSB7CisgICAgICAgcHVibGljOgorICAgICAgICBCdWZmZXJTb3VyY2UoY29uc3QgdWludDhfdCogZGF0YSwgc2l6ZV90IHNpemUpIDogbURhdGEoZGF0YSksIG1TaXplKHNpemUpLCBtUmVhZEluZGV4KDApIHt9CisgICAgICAgIH5CdWZmZXJTb3VyY2UoKSB7CisgICAgICAgICAgICBtRGF0YSA9IG51bGxwdHI7CisgICAgICAgICAgICBtU2l6ZSA9IDA7CisgICAgICAgICAgICBtUmVhZEluZGV4ID0gMDsKKyAgICAgICAgICAgIGZvciAoaW50MzJfdCBpZHggPSAwOyBpZHggPCBrTWF4VHJhY2tDb3VudDsgKytpZHgpIHsKKyAgICAgICAgICAgICAgICBtRnJhbWVMaXN0W2lkeF0uY2xlYXIoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB1aW50MzJfdCBnZXROdW1UcmFja3MoKTsKKyAgICAgICAgYm9vbCBnZXRUcmFja0luZm8oaW50MzJfdCB0cmFja0luZGV4KTsKKyAgICAgICAgdm9pZCBnZXRGcmFtZUluZm8oKTsKKyAgICAgICAgQ29uZmlnRm9ybWF0IGdldENvbmZpZ0Zvcm1hdChpbnQzMl90IHRyYWNrSW5kZXgpOworICAgICAgICBpbnQzMl90IGdldE51bUNzZHMoaW50MzJfdCB0cmFja0luZGV4KTsKKyAgICAgICAgdmVjdG9yPEZyYW1lRGF0YT4mIGdldEZyYW1lTGlzdChpbnQzMl90IHRyYWNrSW5kZXgpOworCisgICAgICAgcHJpdmF0ZToKKyAgICAgICAgYm9vbCBpc01hcmtlcigpIHsgcmV0dXJuIChtZW1jbXAoJm1EYXRhW21SZWFkSW5kZXhdLCBrTWFya2VyLCBrTWFya2VyU2l6ZSkgPT0gMCk7IH0KKworICAgICAgICBib29sIGlzQ1NETWFya2VyKHNpemVfdCBwb3NpdGlvbikgeworICAgICAgICAgICAgcmV0dXJuIChtZW1jbXAoJm1EYXRhW3Bvc2l0aW9uXSwga0NzZE1hcmtlclN1ZmZpeCwga01hcmtlclN1ZmZpeFNpemUpID09IDApOworICAgICAgICB9CisKKyAgICAgICAgYm9vbCBzZWFyY2hGb3JNYXJrZXIoc2l6ZV90IHN0YXJ0SW5kZXgpOworCisgICAgICAgIGNvbnN0IHVpbnQ4X3QqIG1EYXRhID0gbnVsbHB0cjsKKyAgICAgICAgc2l6ZV90IG1TaXplID0gMDsKKyAgICAgICAgc2l6ZV90IG1SZWFkSW5kZXggPSAwOworICAgICAgICBDb25maWdGb3JtYXQgbVBhcmFtc1trTWF4VHJhY2tDb3VudF0gPSB7fTsKKyAgICAgICAgaW50MzJfdCBtTnVtQ3Nkc1trTWF4VHJhY2tDb3VudF0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AgQEAKICAgICAgICAgfTsKICAgICBzdGF0aWMgc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IG5hbWVzID0gewogICAgICAgICAgICAgcHJlZml4ZXNbMF0gKyB2YXJpYW50c1swXSArICIueG1sIiwKLSAgICAgICAgICAgIHByZWZpeGVzWzFdICsgdmFyaWFudHNbMV0gKyAiLnhtbCIKKyAgICAgICAgICAgIHByZWZpeGVzWzFdICsgdmFyaWFudHNbMV0gKyAiLnhtbCIsCisKKyAgICAgICAgICAgIC8vIHNoYXBpbmcgaW5mb3JtYXRpb24gaXMgbm90IGN1cnJlbnRseSB2YXJpYW50IHNwZWNpZmljLgorICAgICAgICAgICAgIm1lZGlhX2NvZGVjc19zaGFwaW5nLnhtbCIKICAgICAgICAgfTsKICAgICByZXR1cm4gbmFtZXM7CiB9CkBAIC0zNDYsNiArMzQ5LDggQEAKICAgICAgICAgc3RhdHVzX3QgYWRkQWxpYXMoY29uc3QgY2hhciAqKmF0dHJzKTsKICAgICAgICAgc3RhdHVzX3QgYWRkRmVhdHVyZShjb25zdCBjaGFyICoqYXR0cnMpOwogICAgICAgICBzdGF0dXNfdCBhZGRMaW1pdChjb25zdCBjaGFyICoqYXR0cnMpOworICAgICAgICBzdGF0dXNfdCBhZGRNYXBwaW5nKGNvbnN0IGNoYXIgKiphdHRycyk7CisgICAgICAgIHN0YXR1c190IGFkZFR1bmluZyhjb25zdCBjaGFyICoqYXR0cnMpOwogICAgICAgICBzdGF0dXNfdCBhZGRRdWlyayhjb25zdCBjaGFyICoqYXR0cnMsIGNvbnN0IGNoYXIgKnByZWZpeCA9IG51bGxwdHIpOwogICAgICAgICBzdGF0dXNfdCBhZGRTZXR0aW5nKGNvbnN0IGNoYXIgKiphdHRycywgY29uc3QgY2hhciAqcHJlZml4ID0gbnVsbHB0cik7CiAgICAgICAgIHN0YXR1c190IGVudGVyTWVkaWFDb2RlYyhjb25zdCBjaGFyICoqYXR0cnMsIGJvb2wgZW5jb2Rlcik7CkBA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kID0gcGF0aC5yZmluZCgiLyIpOworICAgIHN0ZDo6c3RyaW5nOjpzaXplX3R5cGUgZW5kID0gcGF0aC5yZmluZCgnLycpOwogICAgIGlmIChlbmQgIT0gc3RkOjpzdHJpbmc6Om5wb3MpIHsKICAgICAgICAgbUhyZWZCYXNlID0gcGF0aC5zdWJzdHIoMCwgZW5kICsgMSk7CiAgICAgfQpAQCAtNzQxLDEzICs3NDYsMTkgQEAKICAgICAgICAgewogICAgICAgICAgICAgLy8gaWdub3JlIGxpbWl0cyBhbmQgZmVhdHVyZXMgc3BlY2lmaWVkIG91dHNpZGUgb2YgdHlwZQogICAgICAgICAgICAgaWYgKCFtU3RhdGUtPmluVHlwZSgpCi0gICAgICAgICAgICAgICAgICAgICYmIChzdHJFcShuYW1lLCAiTGltaXQiKSB8fCBzdHJFcShuYW1lLCAiRmVhdHVyZSIpIHx8IHN0ckVxKG5hbWUsICJWYXJpYW50IikpKSB7CisgICAgICAgICAgICAgICAgICAgICYmIChzdHJFcShuYW1lLCAiTGltaXQiKSB8fCBzdHJFcShuYW1lLCAiRmVhdHVyZSIpCisgICAgICAgICAgICAgICAgICAgICAgICB8fCBzdHJFcShuYW1lLCAiVmFyaWFudCIpIHx8IHN0ckVxKG5hbWUsICJNYXBwaW5nIikKKyAgICAgICAgICAgICAgICAgICAgICAgIHx8IHN0ckVxKG5hbWUsICJUdW5pbmciKSkpIHsKICAgICAgICAgICAgICAgICBQTE9HRCgiaWdub3JpbmcgJXMgc3BlY2lmaWVkIG91dHNpZGUgb2YgYSBUeXBlIiwgbmFtZSk7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfSBlbHNlIGlmIChzdHJFcShuYW1lLCAiTGltaXQiKSkgewogICAgICAgICAgICAgICAgIGVyciA9IGFkZExpbWl0KGF0dHJzKTsKICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RyRXEobmFtZSwgIkZlYXR1cmUiKSkgewogICAgICAgICAgICAgICAgIGVyciA9I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ICAgbXNnID0gbXNnICsgbmFtZTsKKyAgICAgICAgICAgICAgICByZXR1cm4geyBOQU1FX05PVF9GT1VORCwgbXNnIH07CiAgICAgICAgICAgICB9CiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAvLyBUaGlzIHNob3VsZCBoYXBwZW4gb25seSB3aGVuIHRoZSBjb2RlYyBoYXMgYXQgbW9zdCBvbmUgdHlwZS4KICAgICAgICAgICAgIHR5cGVJdCA9IGNvZGVjSXQtPnNlY29uZC50eXBlTWFwLmJlZ2luKCk7CiAgICAgICAgICAgICBpZiAodHlwZUl0ID09IGNvZGVjSXQtPnNlY29uZC50eXBlTWFwLmVuZCgpCiAgICAgICAgICAgICAgICAgICAgIHx8IGNvZGVjSXQtPnNlY29uZC50eXBlTWFwLnNpemUoKSAhPSAxKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHsgQkFEX1ZBTFVFLCAiTWVkaWFDb2RlYzogY2Fubm90IHVwZGF0ZSBjb2RlYyB3aXRob3V0IHR5cGUgc3BlY2lmaWVkIiB9OworICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG1zZyA9ICJNZWRpYUNvZGVjOiBjYW5ub3QgdXBkYXRlIGNvZGVjIHdpdGhvdXQgdHlwZSBzcGVjaWZpZWQ6ICI7CisgICAgICAgICAgICAgICAgbXNnID0gbXNnICsgbmFtZTsKKyAgICAgICAgICAgICAgICByZXR1cm4geyBCQURfVkFMVUUsIG1zZyB9OwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQpAQCAtMTM4Niw2ICsxNDA1LDkyIEBACiAgICAgcmV0dXJuIE9LOwogfQogCitzdGF0dXNfdCBNZWRpYUNvZGVjc1htbFBhcnNlcjo6SW1wbDo6UGFyc2VyOjphZGRNYXBwaW5nKGNvbnN0IGNoYXIgKiphdHRycykgeworICAgIENIRUNLKG1TdGF0ZS0+aW5UeXBlKCkpOworICAgIHNpemVfdCBpID0gMDsKKyAgICBjb25zdCBjaGFyICphX25hbWUgPSBudWxscHRyOworICAgIGNvbnN0IGNoYXIgKmFfdmFsdWUgPSBudWxscHRyOworICAgIGNvbnN0IGNoYXIgKmFfa2luZCA9IG51bGxwdHI7CisKKyAgICB3aGlsZSAoYXR0cnNbaV0gIT0gbnVsbHB0cikgeworICAgICAgICBDSEVDSygoaSAmIDEpID09IDApOworICAgICAgICBpZiAoYXR0cnNbaSArIDFdID09IG51bGxwdHIpIHsKKyAgICAgICAgICAgIFBMT0dEKCJNYXBwaW5nOiBhdHRyaWJ1dGUgJyVzJyBpcyBudWxsIiwgYXR0cnNbaV0pOworICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChzdHJFcShhdHRyc1tpXSwgIm5hbWUiKSkgeworICAgICAgICAgICAgYV9uYW1lID0gYXR0cnNbKytpXTsKKyAgICAgICAgfSBlbHNlIGlmIChzdHJFcShhdHRyc1tpXSwgImtpbmQiKSkgeworICAgICAgICAgICAgYV9raW5kID0gYXR0cnNbKytpXTsKKyAgICAgICAgfSBlbHNlIGlmIChzdHJFcShhdHRyc1tpXSwgInZhbHVlIikpIHsKKyAgICAgICAgICAgIGFfdmFsdWUgPSBhdHRyc1srK2ldOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgUExPR0QoIk1hcHBpbmc6IGlnbm9yaW5nIHVucmVjb2duaXplZCBhdHRyaWJ1dGUgJyVzJyIsIGF0dHJzW2ldKTsKKyAgICAgICAgICAgICsraTsKKyAgICAgICAgfQorICAgICAgICArK2k7CisgICAgfQorCisgICAgLy8gRXZlcnkgbWFwcGluZyBtdXN0IGhhdmUgYWxsIDMgZmllbGRzCisgICAgaWYgKGFfbmFtZSA9PSBudWxscHRyKSB7CisgICAgICAgIFBMT0dEKCJNYXBwaW5nIHdpdGggbm8gJ25hbWUnIGF0dHJpYnV0ZSIpOworICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgIH0KKworICAgIGlmIChhX2tpbmQgPT0gbnVsbHB0cikgeworICAgICAgICBQTE9HRCgiTWFwcGluZyB3aXRoIG5vICdraW5kJyBhdHRyaWJ1dGUiKTsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisKKyAgICBpZiAoYV92YWx1ZSA9PSBudWxscHRyKSB7CisgICAgICAgIFBMT0dEKCJNYXBwaW5nIHdpdGggbm8gJ3ZhbHVlJyBhdHRyaWJ1dGUiKTsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisKKyAgICBtU3RhdGUtPmFkZERldGFpbChzdGQ6OnN0cmluZygibWFwcGluZy0iKSArIGFfa2luZCArICItIiArIGFfbmFtZSwgYV92YWx1ZSk7CisgICAgcmV0dXJuIE9LOworfQorCitzdGF0dXNfdCBNZWRpYUNvZGVjc1htbFBhcnNlcjo6SW1wbDo6UGFyc2VyOjphZGRUdW5pbmcoY29uc3QgY2hhciAqKmF0dHJzKSB7CisgICAgQ0hFQ0sobVN0YXRlLT5pblR5cGUoKSk7CisgICAgc2l6ZV90IGkgPSAwOworICAgIGNvbnN0IGNoYXIgKmFfbmFtZSA9IG51bGxwdHI7CisgICAgY29uc3QgY2hhciAqYV92YWx1ZSA9IG51bGxwdHI7CisKKyAgICB3aGlsZSAoYXR0cnNbaV0gIT0gbnVsbHB0cikgeworICAgICAgICBDSEVDSygoaSAmIDEpID09IDApOworICAgICAgICBpZiAoYXR0cnNbaSArIDFdID09IG51bGxwdHIpIHsKKyAgICAgICAgICAgIFBMT0dEKCJNYXBwaW5nOiBhdHRyaWJ1dGUgJyVzJyBpcyBudWxsIiwgYXR0cnNbaV0pOworICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChzdHJFcShhdHRyc1tpXSwgIm5hbWUiKSkgeworICAgICAgICAgICAgYV9uYW1lID0gYXR0cnNbKytpXTsKKyAgICAgICAgfSBlbHNlIGlmIChzdHJFcShhdHRyc1tpXSwgInZhbHVlIikpIHsKKyAgICAgICAgICAgIGFfdmFsdWUgPSBhdHRyc1srK2ldOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgUExPR0QoIlR1bmluZzogaWdub3JpbmcgdW5yZWNvZ25pemVkIGF0dHJpYnV0ZSAnJXMnIiwgYXR0cnNbaV0pOworICAgICAgICAgICAgKytpOworICAgICAgICB9CisgICAgICAgICsraTsKKyAgICB9CisKKyAgICAvLyBFdmVyeSB0dW5pbmcgbXVzdCBoYXZlIGJvdGggZmllbGRzCisgICAgaWYgKGFfbmFtZSA9PSBudWxscHRyKSB7CisgICAgICAgIFBMT0dEKCJUdW5pbmcgd2l0aCBubyAnbmFtZScgYXR0cmlidXRlIik7CisgICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgfQorCisgICAgaWYgKGFfdmFsdWUgPT0gbnVsbHB0cikgeworICAgICAgICBQTE9HRCgiVHVuaW5nIHdpdGggbm8gJ3ZhbHVlJyBhdHRyaWJ1dGUiKTsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisKKyAgICBtU3RhdGUtPmFkZERldGFpbChzdGQ6OnN0cmluZygidHVuaW5nLSIpICsgYV9uYW1lLCBhX3ZhbHVlKTsKKyAgICByZXR1cm4gT0s7Cit9CisKIHN0YXR1c190IE1lZGlhQ29kZWNzWG1sUGFyc2VyOjpJbXBsOjpQYXJzZXI6OmFkZEFsaWFzKGNvbnN0IGNoYXIgKiphdHRycykgewogICAgIENIRUNLKG1TdGF0ZS0+aW5Db2RlYygpKTsKICAgICBzaXplX3QgaSA9IDA7CkBAIC0xNTI1LDcgKzE2MzAsNyBAQAogICAgICAgICAgICAgICAgIG5vZGVJbmZvLmF0dHJpYnV0ZUxpc3QucHVzaF9iYWNrKEF0dHJpYnV0ZXsicmFuayIsIHJhbmt9KTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIG5vZGVMaXN0LT5pbnNlcnQoc3RkOjptYWtlX3BhaXIoCi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NlbnNlX2tpbmRzJyBmcm9tICJmcmFtZXdvcmtzX2F2X21lZGlhX2xpYnN0YWdlZnJpZ2h0X2xpY2Vuc2UiCisgICAgLy8gdG8gZ2V0IHRoZSBiZWxvdyBsaWNlbnNlIGtpbmRzOgorICAgIC8vICAgU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMAorICAgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWyJmcmFtZXdvcmtzX2F2X21lZGlhX2xpYnN0YWdlZnJpZ2h0X2xpY2Vuc2UiXSwKK30KKworY2NfdGVzdCB7CisgICAgbmFtZTogIlhNTFBhcnNlclRlc3QiLAorICAgIHRlc3Rfc3VpdGVzOiBbImRldmljZS10ZXN0cyJdLAorICAgIGd0ZXN0OiB0cnVlLAorCisgICAgc3JjczogWworICAgICAgICAiWE1MUGFyc2VyVGVzdC5jcHAiLAorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGlibG9nIiwKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X3htbHBhcnNlciIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLVdlcnJvciIsCisgICAgICAgICItV2FsbCIsCisgICAgXSwKKworICAgIGRhdGE6IFsiOnhtbHBhcnNlcnRlc3RfdGVzdF9maWxlcyIsXSwKKworICAgIHNhbml0aXplOiB7CisgICAgICAgIG1pc2NfdW5kZWZpbmVkOiBbCisgICAgICAgICAgICAidW5zaWduZWQtaW50ZWdlci1vdmVyZmxvdyIsCisgICAgICAgICAgICAic2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICBdLAorICAgICAgICBjZmk6IHRydWUsCisgICAgfSwKK30KKworZmlsZWdyb3VwIHsKKyAgICBuYW1lOiAieG1scGFyc2VydGVzdF90ZXN0X2ZpbGVzIiwKKyAgICBzcmNzOiBbCisgICAgICAgICJ0ZXN0ZGF0YS9tZWRpYV9jb2RlY3NfdW5pdF90ZXN0Lnhtb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ICAgICAgIHBhaXI8c3RyaW5nLCBzdHJpbmc+KCJmZWF0dXJlLWZlYXR1cmUyIiwgIjAiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWlyPHN0cmluZywgc3RyaW5nPigiZmVhdHVyZS1mZWF0dXJlMyIsICIwIiksCisgICAgICAgICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICAgICAgICAgICAgIHt9LCAiIik7CisKKyAgICBzZXRDb2RlY1Byb3BlcnRpZXMoInRlc3Q0LmRlY29kZXIiLCBmYWxzZSwgNCwge30sIHt9LCB7fSwgImF1ZGlvL2ZsYWMiLAorICAgICAgICAgICAgICAgICAgICAgICB7cGFpcjxzdHJpbmcsIHN0cmluZz4oImZlYXR1cmUtZmVhdHVyZTEiLCAiZmVhdHVyZTFWYWwiKX0sIHt9LCAiIik7CisKKyAgICBzZXRDb2RlY1Byb3BlcnRpZXMoInRlc3Q1LmRlY29kZXIiLCBmYWxzZSwgNSwgeyJhdHRyaWJ1dGU6OmF0dHJpYnV0ZVF1aXJrMSJ9LCB7fSwge30sCisgICAgICAgICAgICAgICAgICAgICAgICJhdWRpby9nNzExLW1sYXciLCB7fSwge30sICIiKTsKKworICAgIHNldENvZGVjUHJvcGVydGllcygidGVzdDYuZGVjb2RlciIsIGZhbHNlLCA2LCB7fSwge30sIHsidmFyaWFudDEiLCAidmFyaWFudDIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgImF1ZGlvL21wNGEtbGF0bSIsCisgICAgICAgICAgICAgICAgICAgICAgIHtwYWlyPHN0cmluZywgc3RyaW5nPigidmFyaWFudDE6Ojp2YXJpYW50MUxpbWl0MS1yYW5nZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmFyaWFudDFMaW1pdDFNaW4tdmFyaWFudDFMaW1pdDFNYXgiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHBhaXI8c3RyaW5nLCBzdHJpbmc+KCJ2YXJpYW50MTo6OnZhcmlhbnQxTGltaXQyLXJhbmdlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2YXJpYW50MUxpbWl0Mkxvdy12YXJpYW50MUxpbWl0MkhpZ2giKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHBhaXI8c3RyaW5nLCBzdHJpbmc+KCJ2YXJpYW50Mjo6OnZhcmlhbnQyTGltaXQxIiwgInZhcmlhbnQyTGltaXQxVmFsdWUiKX0sCisgICAgICAgICAgICAgICAgICAgICAgIHt9LCAiIik7CisKKyAgICBzZXRDb2RlY1Byb3BlcnRpZXMoCisgICAgICAgICAgICAidGVzdDcuZGVjb2RlciIsIGZhbHNlLCA3LCB7fSwge30sIHt9LCAiYXVkaW8vdm9yYmlzIiwKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcGFpcjxzdHJpbmcsIHN0cmluZz4oIi1taW4tbGltaXQxIiwgImxpbWl0MU1pbiIpLAorICAgICAgICAgICAgICAgICAgICAvKnBhaXI8c3RyaW5nLCBzdHJpbmc+KCJsaW1pdDEtaW4iLCAibGltaXQxSW4iKSwqLworICAgICAgICAgICAgICAgICAgICBwYWlyPHN0cmluZywgc3RyaW5nPigibGltaXQyLXJhbmdlIiwgImxpbWl0Mk1pbi1saW1pdDJNYXgiKSwKKyAgICAgICAgICAgICAgICAgICAgcGFpcjxzdHJpbmcsIHN0cmluZz4oImxpbWl0Mi1zY2FsZSIsICJsaW1pdDJTY2FsZSIpLAorICAgICAgICAgICAgICAgICAgICBwYWlyPHN0cmluZywgc3RyaW5nPigibGltaXQzLWRlZmF1bHQiLCAibGltaXQzVmFsMyIpLAorICAgICAgICAgICAgICAgICAgICBwYWlyPHN0cmluZywgc3RyaW5nPigibGltaXQzLXJhbmdlcyIsICJsaW1pdDNWYWwxLGxpbWl0M1ZhbDIsbGltaXQzVmFsMyIpLAorICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIHt9LCAiIik7CisKKyAgICBzZXRDb2RlY1Byb3BlcnRpZXMoInRlc3Q4LmVuY29kZXIiLCB0cnVlLCA4LCB7fSwge30sIHt9LCAiYXVkaW8vb3B1cyIsCisgICAgICAgICAgICAgICAgICAgICAgIHtwYWlyPHN0cmluZywgc3RyaW5nPigibWF4LWxpbWl0MSIsICJsaW1pdDFNYXgiKX0sIHt9LCAiIik7CisKKyAgICBzZXRDb2RlY1Byb3BlcnRpZXMoInRlc3Q5LmVuY29kZXIiLCB0cnVlLCA5LCB7fSwge30sIHt9LCAidmlkZW8vYXZjIiwKKyAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgIHBhaXI8c3RyaW5nLCBzdHJpbmc+KCJtYXBwaW5nLXN1cmUtYmVmb3JlIiwgImFmdGVyIiksCisgICAgICAgICAgIH0sCisgICAgICAgICAgIHt9LCAiIik7CisKKyAgICBzZXRDb2RlY1Byb3BlcnRpZXMoInRlc3QxMC5lbmNvZGVyIiwgdHJ1ZSwgMTAsIHt9LCB7fSwge30sICJ2aWRlby9oZXZjIiwKKyAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgIHBhaXI8c3RyaW5nLCBzdHJpbmc+KCJtYXBwaW5nLWZpcmUtZnJvbSIsICJ0byIpLAorICAgICAgICAgICB9LAorICAgICAgICAgICB7fSwgIiIpOworICAgIHNldENvZGVjUHJvcGVydGllcygidGVzdDExLmVuY29kZXIiLCB0cnVlLCAxMSwge30sIHt9LCB7fSwgInZpZGVvL2F2MDEiLAorICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgcGFpcjxzdHJpbmcsIHN0cmluZz4oInR1bmluZy1odW5ncnkiLCAieWVzIiksCisgICAgICAgICAgICAgICAgICAgcGFpcjxzdHJpbmcsIHN0cmluZz4oInR1bmluZy1waSIsICIzLjE0MTUiKSwKKyAgICAgICAgICAgfSwKKyAgICAgICAgICAge30sICIiKTsKKworICAgIHNldFJvbGVQcm9wZXJ0aWVzKCJhdWRpb19kZWNvZGVyLm1wMyIsIGZ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UuZGVjb2RlciIsCisgICAgICAgICAgICAgICAgICAgICAge3BhaXI8c3RyaW5nLCBzdHJpbmc+KCJhdHRyaWJ1dGU6OmF0dHJpYnV0ZVF1aXJrMSIsICJwcmVzZW50Iil9KTsKKworICAgIHNldFJvbGVQcm9wZXJ0aWVzKCJhdWRpb19kZWNvZGVyLmFhYyIsIGZhbHNlLCA2LCAiYXVkaW8vbXA0YS1sYXRtIiwgInRlc3Q2LmRlY29kZXIiLAorICAgICAgICAgICAgICAgICAgICAgIHtwYWlyPHN0cmluZywgc3RyaW5nPigidmFyaWFudDE6Ojp2YXJpYW50MUxpbWl0MS1yYW5nZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2YXJpYW50MUxpbWl0MU1pbi12YXJpYW50MUxpbWl0MU1heCIpLAorICAgICAgICAgICAgICAgICAgICAgICBwYWlyPHN0cmluZywgc3RyaW5nPigidmFyaWFudDE6Ojp2YXJpYW50MUxpbWl0Mi1yYW5nZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2YXJpYW50MUxpbWl0Mkxvdy12YXJpYW50MUxpbWl0MkhpZ2giKSwKKyAgICAgICAgICAgICAgICAgICAgICAgcGFpcjxzdHJpbmcsIHN0cmluZz4oInZhcmlhbnQyOjo6dmFyaWFudDJMaW1pdDEiLCAidmFyaWFudDJMaW1pdDFWYWx1ZSIpfSk7CisKKyAgICBzZXRSb2xlUHJvcGVydGllcygiYXVkaW9fZGVjb2Rlci52b3JiaXMiLCBmYWxzZSwgNywgImF1ZGlvL3ZvcmJpcyIsICJ0ZXN0Ny5kZWNvZGVyIiwKKyAgICAgICAgICAgICAgICAgICAgICB7cGFpcjxzdHJpbmcsIHN0cmluZz4oIi1taW4tbGltaXQxIiwgImxpbWl0MU1pbiIpLAorICAgICAgICAgICAgICAgICAgICAgICAvKnBhaXI8c3RyaW5nLCBzdHJpbmc+KCJsaW1pdDEtaW4iLCAibGltaXQxSW4iKSwqLworICAgICAgICAgICAgICAgICAgICAgICBwYWlyPHN0cmluZywgc3RyaW5nPigibGltaXQyLXJhbmdlIiwgImxpbWl0Mk1pbi1saW1pdDJNYXgiKSwKKyAgICAgICAgICAgICAgICAgICAgICAgcGFpcjxzdHJpbmcsIHN0cmluZz4oImxpbWl0Mi1zY2FsZSIsICJsaW1pdDJTY2FsZSIpLAorICAgICAgICAgICAgICAgICAgICAgICBwYWlyPHN0cmluZywgc3RyaW5nPigibGltaXQzLWRlZmF1bHQiLCAibGltaXQzVmFsMyIpLAorICAgICAgICAgICAgICAgICAgICAgICBwYWlyPHN0cmluZywgc3RyaW5nPigibGltaXQzLXJhbmdlcyIsICJsaW1pdDNWYWwxLGxpbWl0M1ZhbDIsbGltaXQzVmFsMyIpfSk7CisKKyAgICBzZXRSb2xlUHJvcGVydGllcygiYXVkaW9fZW5jb2Rlci5vcHVzIiwgdHJ1ZSwgOCwgImF1ZGlvL29wdXMiLCAidGVzdDguZW5jb2RlciIsCisgICAgICAgICAgICAgICAgICAgICAge3BhaXI8c3RyaW5nLCBzdHJpbmc+KCJtYXgtbGltaXQxIiwgImxpbWl0MU1heCIpfSk7CisKKyAgICBzZXRSb2xlUHJvcGVydGllcygidmlkZW9fZW5jb2Rlci5hdmMiLCB0cnVlLCA5LCAidmlkZW8vYXZjIiwgInRlc3Q5LmVuY29kZXIiLAorICAgICAgICAgICAgICAgICAgICAgICB7cGFpcjxzdHJpbmcsIHN0cmluZz4oIm1hcHBpbmctc3VyZS1iZWZvcmUiLCAiYWZ0ZXIiKX0pOworCisgICAgc2V0Um9sZVByb3BlcnRpZXMoInZpZGVvX2VuY29kZXIuaGV2YyIsIHRydWUsIDEwLCAidmlkZW8vaGV2YyIsICJ0ZXN0MTAuZW5jb2RlciIsCisgICAgICAgICAgICAgICAgICAgICAgIHsgcGFpcjxzdHJpbmcsIHN0cmluZz4oIm1hcHBpbmctZmlyZS1mcm9tIiwgInRvIil9KTsKKworICAgIHNldFJvbGVQcm9wZXJ0aWVzKCJ2aWRlb19lbmNvZGVyLmF2MDEiLCB0cnVlLCAxMSwgInZpZGVvL2F2MDEiLCAidGVzdDExLmVuY29kZXIiLAorICAgICAgICAgICAgICAgICAgICAgICB7cGFpcjxzdHJpbmcsIHN0cmluZz4oInR1bmluZy1odW5ncnkiLCAieWVzIiksCisgICAgICAgICAgICAgICAgICAgICAgICBwYWlyPHN0cmluZywgc3RyaW5nPigidHVuaW5nLXBpIiwgIjMuMTQxNSIpCisgICAgICAgICAgICAgICAgICAgICAgIH0pOworCisgICAgc2V0U2VydmljZUF0dHJpYnV0ZSgKKyAgICAgICAgICAgIHtwYWlyPHN0cmluZywgc3RyaW5nPigiZG9tYWluLXRlbGVwaG9ueSIsICIwIiksIHBhaXI8c3RyaW5nLCBzdHJpbmc+KCJkb21haW4tdHYiLCAiMCIpLAorICAgICAgICAgICAgIHBhaXI8c3RyaW5nLCBzdHJpbmc+KCJzZXR0aW5nMiIsICIwIiksIHBhaXI8c3RyaW5nLCBzdHJpbmc+KCJ2YXJpYW50LXZhcmlhbnQxIiwgIjAiKX0pOworfQorCitib29sIFhNTFBhcnNlVGVzdDo6Y29tcGFyZU1hcChjb25zdCBtYXA8c3RyaW5nLCBzdHJpbmc+ICZsaHMsIGNvbnN0IG1hcDxzdHJpbmcsIHN0cmluZz4gJnJocykgeworICAgIHJldHVybiBsaHMuc2l6ZSgpID09IHJocy5zaXplKCkgJiYgZXF1YWwobGhzLmJlZ2luKCksIGxocy5lbmQoKSwgcmhzLmJlZ2luKCkpOworfQorCit2b2lkIFhNTFBhcnNlVGVzdDo6c2V0Q29kZWNQcm9wZXJ0aWVzKHN0cmluZyBjb2RlY05hbWUsIGJvb2wgaXNFbmNvZGVyLCBpbnQzMl90IG9yZGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ8c3RyaW5nPiBxdWlya1NldCwgc2V0PHN0cmluZz4gZG9tYWluU2V0LAorICAgICAgICAg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GluZzo6RW52aXJvbm1lbnQgeworICBwdWJsaWM6CisgICAgWE1MUGFyc2VyVGVzdEVudmlyb25tZW50KCkgOiByZXMoIi9kYXRhL2xvY2FsL3RtcC8iKSB7fQorCisgICAgLy8gUGFyc2VzIHRoZSBjb21tYW5kIGxpbmUgYXJndW1lbnRzCisgICAgaW50IGluaXRGcm9tT3B0aW9ucyhpbnQgYXJnYywgY2hhciAqKmFyZ3YpOworCisgICAgdm9pZCBzZXRSZXMoY29uc3QgY2hhciAqX3JlcykgeyByZXMgPSBfcmVzOyB9CisKKyAgICBjb25zdCBzdHJpbmcgZ2V0UmVzKCkgY29uc3QgeyByZXR1cm4gcmVzOyB9CisKKyAgcHJpdmF0ZToKKyAgICBzdHJpbmcgcmVzOworfTsKKworaW50IFhNTFBhcnNlclRlc3RFbnZpcm9ubWVudDo6aW5pdEZyb21PcHRpb25zKGludCBhcmdjLCBjaGFyICoqYXJndikgeworICAgIHN0YXRpYyBzdHJ1Y3Qgb3B0aW9uIG9wdGlvbnNbXSA9IHt7InBhdGgiLCByZXF1aXJlZF9hcmd1bWVudCwgMCwgJ1AnfSwgezAsIDAsIDAsIDB9fTsKKworICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgIGludCBpbmRleCA9IDA7CisgICAgICAgIGludCBjID0gZ2V0b3B0X2xvbmcoYXJnYywgYXJndiwgIlA6Iiwgb3B0aW9ucywgJmluZGV4KTsKKyAgICAgICAgaWYgKGMgPT0gLTEpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgc3dpdGNoIChjKSB7CisgICAgICAgICAgICBjYXNlICdQJzogeworICAgICAgICAgICAgICAgIHNldFJlcyhvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmIChvcHRpbmQgPCBhcmdjKSB7C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cnZpY2VzL21lZGlhcmVzb3VyY2VtYW5hZ2VyIiwKICAgICBdLAogCi0gICAgLy8gYmFjayB0byAzMi1iaXQsIGIvMTI2NTAyNjEzCi0gICAgY29tcGlsZV9tdWx0aWxpYjogIjMyIiwKKyAgICAvLyBCeSBkZWZhdWx0IG1lZGlhc2VydmVyIHJ1bnMgaW4gMzItYml0IHRvIHNhdmUgbWVtb3J5LCBleGNlcHQKKyAgICAvLyBvbiA2NC1iaXQtb25seSBsdW5jaCB0YXJnZXRzLgorICAgIC8vICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKKyAgICAvLyBUTyBFTkFCTEUgNjQtQklUIE1FRElBU0VSVkVSIE9OIE1JWEVEIDMyLzY0LUJJVCBERVZJQ0VTLCBDT01NRU5UCisgICAgLy8gT1VUIFRIRSBGT0xMT1dJTkcgTElORToKKyAgICAvLyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgICAgY29tcGlsZV9tdWx0aWxpYjogInByZWZlcjMyIiwKIAogICAgIGluaXRfcmM6IFsibWVkaWFzZXJ2ZXIucmMiXSwKIApkaWZmIC0tZ2l0IGEvbWVkaWEvbWVkaWFzZXJ2ZXIvbWFpbl9tZWRpYXNlcnZlci5jcHAgYi9tZWRpYS9tZWRpYXNlcnZlci9tYWluX21lZGlhc2VydmVyLmNwcAppbmRleCAzMTY3MzJiLi41OGUyZDJhIDEwMDY0NAotLS0gYS9tZWRpYS9tZWRpYXNlcnZlci9tYWluX21lZGlhc2VydmVyLmNwcAorKysgYi9tZWRpYS9tZWRpYXNlcnZlci9tYWluX21lZGlhc2VydmVyLmNwcApAQCAtMTgsNyArMTgsNiBAQAogI2RlZmluZSBMT0dfVEFHICJtZWRpYXNlcnZlciIKIC8vI2RlZmluZSBMT0dfTkRFQlVHIDAKIAotI2luY2x1ZGUgPGFpY3UvQUljdS5oPg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AogICAgICAgICAibGlibG9nIiwKICAgICAgICAgImxpYnVzYmhvc3QiLAogICAgIF0sCisgICAgaGVhZGVyX2xpYnM6IFsibGliY3V0aWxzX2hlYWRlcnMiXSwKIH0KLQpkaWZmIC0tZ2l0IGEvbWVkaWEvbXRwL0lNdHBEYXRhYmFzZS5oIGIvbWVkaWEvbXRwL0lNdHBEYXRhYmFzZS5oCmluZGV4IDgxZmE2MGMuLjNiOWJiYjAgMTAwNjQ0Ci0tLSBhL21lZGlhL210cC9JTXRwRGF0YWJhc2UuaAorKysgYi9tZWRpYS9tdHAvSU10cERhdGFiYXNlLmgKQEAgLTM5LDcgKzM5LDcgQEAKICAgICAvLyBDYWxsZWQgdG8gcmVwb3J0IHN1Y2Nlc3Mgb3IgZmFpbHVyZSBvZiB0aGUgU2VuZE9iamVjdCBmaWxlIHRyYW5zZmVyLgogICAgIHZpcnR1YWwgdm9pZCAgICAgICAgICAgICAgICAgICAgZW5kU2VuZE9iamVjdChNdHBPYmplY3RIYW5kbGUgaGFuZGxlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHN1Y2NlZWRlZCkgPSAwOwotICAgIAorCiAgICAgLy8gQ2FsbGVkIHRvIHJlc2NhbiBhIGZpbGUsIHN1Y2ggYXMgYWZ0ZXIgYW4gZWRpdC4KICAgICB2aXJ0dWFsIHZvaWQgICAgICAgICAgICAgICAgICAgIHJlc2NhbkZpbGUoY29uc3QgY2hhciogcGF0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSwKQEAgLTkxLDYgKzkxLDggQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50NjRfdCYgb3V0RmlsZUxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0Rm9ybWF0JiBvdXRGb3JtYX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k7CisgICAgbURhdGEucHV0U3RyaW5nKHByb3BlcnR5LT5nZXRDdXJyZW50VmFsdWUoKS5zdHIpOworCisgICBpZiAoc2VuZFJlcXVlc3QoTVRQX09QRVJBVElPTl9TRVRfREVWSUNFX1BST1BfVkFMVUUpICYmIHNlbmREYXRhKCkpIHsKKyAgICAgICAgTXRwUmVzcG9uc2VDb2RlIHJldCA9IHJlYWRSZXNwb25zZSgpOworICAgICAgICBpZiAocmV0ICE9IE1UUF9SRVNQT05TRV9PSykgeworICAgICAgICAgICAgQUxPR1coIiVzOiBSZXNwb25zZT0weCUwNFhcbiIsIF9fZnVuY19fLCByZXQpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCiBNdHBQcm9wZXJ0eSogTXRwRGV2aWNlOjpnZXRPYmplY3RQcm9wRGVzYyhNdHBPYmplY3RQcm9wZXJ0eSBjb2RlLCBNdHBPYmplY3RGb3JtYXQgZm9ybWF0KSB7CiAgICAgc3RkOjpsb2NrX2d1YXJkPHN0ZDo6bXV0ZXg+IGxnKG1NdXRleCk7CiAKZGlmZiAtLWdpdCBhL21lZGlhL210cC9NdHBEZXZpY2UuaCBiL21lZGlhL210cC9NdHBEZXZpY2UuaAppbmRleCAwMWJjM2RiLi5iMWIzMGU0IDEwMDY0NAotLS0gYS9tZWRpYS9tdHAvTXRwRGV2aWNlLmgKKysrIGIvbWVkaWEvbXRwL010cERldmljZS5oCkBAIC0xMTIsNiArMTEyLDcgQEAKICAgICBNdHBPYmplY3RQcm9wZXJ0eUxpc3QqICBnZXRPYmplY3RQcm9wc1N1cHBvcnRlZChNdHBPYmplY3RGb3JtYXQgZm9ybWF0KTsKIAogICAgIE10cFByb3BlcnR5KiAgICAgICAgICAgIGdldERldmljZVByb3BEZXNjKE10cERldmljZVByb3BlcnR5IGNvZGUpOworICAgIGJvb2wgICAgICAgICAgICAgICAgICAgIHNldERldmljZVByb3BWYWx1ZVN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BlbHNlIHsKICAgICAgICAgICAgIG51bV9ldmVudHMrKzsKICAgICAgICAgfQorICAgICAgICBpZiAoaXNfYmF0Y2hfY2FuY2VsICYmIG51bV9ldmVudHMgPT0gMSkgeworICAgICAgICAgICAgbnVtX2V2ZW50cyA9IGVuZCAtIHN0YXJ0OworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KICAgICB9CiAgICAgaWYgKG51bV9ldmVudHMgIT0gZW5kIC0gc3RhcnQpIHsKICAgICAgICAgcmV0ID0gLTE7CkBAIC00OTUsNyArNTAwLDggQEAKICAgICAgICAgICAgICAgICBudW1fZXZlbnRzICs9IHRoaXNfZXZlbnRzOwogCiAgICAgICAgICAgICAgICAgaWYgKGV2ZW50X3JldCA9PSAtMSkgewotICAgICAgICAgICAgICAgICAgICBjYW5jZWxFdmVudHMobUlvYnVmW2ldLmlvY2IuZGF0YSgpLCBpb2V2cywgbnVtX2V2ZW50cywgbUlvYnVmW2ldLmFjdHVhbCk7CisgICAgICAgICAgICAgICAgICAgIGNhbmNlbEV2ZW50cyhtSW9idWZbaV0uaW9jYi5kYXRhKCksIGlvZXZzLCBudW1fZXZlbnRzLCBtSW9idWZbaV0uYWN0dWFsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1CYXRjaENhbmNlbCk7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgcmV0ICs9IGV2ZW50X3JldDsKQEAgLTUxMiw3ICs1MTgsOCBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmIChzaG9ydF9wYWNrZXQpIHsKLSAgICAgICAgICAgICAgICBpZiAoY2FuY2VsRXZlbnRzKG1Jb2J1ZltpXS5pb2NiLmRhdGEoKSwgaW9ldnMsIHNob3J0X2ksIG1Jb2J1ZltpXS5hY3R1YWwpKSB7CisgICAgICAgICAgICAgICAgaWYgKGNhbmNlbEV2ZW50c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yZW1lbnRzIGNvdW50ZXIgYnkgdGhlIG51bWJlciBvZiBldmVudHMgcmV0dXJuZWQuCmRpZmYgLS1naXQgYS9tZWRpYS9tdHAvTXRwUGFja2V0LmNwcCBiL21lZGlhL210cC9NdHBQYWNrZXQuY3BwCmluZGV4IDNiMjk4YTkuLmYwNjlhODMgMTAwNjQ0Ci0tLSBhL21lZGlhL210cC9NdHBQYWNrZXQuY3BwCisrKyBiL21lZGlhL210cC9NdHBQYWNrZXQuY3BwCkBAIC0xNTcsNyArMTU3LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LT5lbmRwb2ludCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LT5idWZmZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdC0+YnVmZmVyX2xlbmd0aCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDAwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MDAwKTsKICAgICByZXF1ZXN0LT5hY3R1YWxfbGVuZ3RoID0gcmVzdWx0OwogICAgIHJldHVybiByZXN1bHQ7CiB9CmRpZmYgLS1naXQgYS9tZWRpYS9tdHAvTXRwUHJvcGVydHkuY3BwIGIvbWVkaWEvbXRwL010cFByb3BlcnR5LmNwcAppbmRleCA1YzAyYTBkLi45OGEyYWQzIDEwMDY0NAotLS0gYS9tZWRpYS9tdHAvTXRwUHJvcGVydHkuY3BwCisrKyBiL21lZGlhL210cC9NdHBQcm9wZXJ0eS5jcHAKQEAgLTI0MCw2ICsyNDAsMTYgQEAKICAgICAgICAgbUN1cnJlbnRWYWx1ZS5zdHIgPSBOVUxMOwogfQogCit2b2lkIE10cFByb3BlcnR5OjpzZXRDdXJyZW50VmFsdWUoY29uc3QgY2hhciogc3RyaW5nKSB7CisgICAgZnJlZShtQ3VycmVudFZhbHVlLnN0cik7CisgICAgaWYgKHN0cmluZykgeworICAgICAgICBNdHBTdHJpbmdCd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ZSB0aGF0IE1UUCBkb2Vzbid0IHRyYW5zY29kZSBieSBkZWZhdWx0IGFuZCB3ZQorICAgIC8vIG1pZ2h0IG5lZWQgdG8gbWFrZSBhIGJpbmRlciBjYWxsIHRvIGF2b2lkIHRyYW5zY29kaW5nIG9yIGNvbWUgdXAgd2l0aCBhIGJldHRlciBzdHJhdGVneS4KKyAgICBpZiAodHJhbnNjb2RlKSB7CisgICAgICAgIG1mci5mZCA9IG1EYXRhYmFzZS0+b3BlbkZpbGVQYXRoKGZpbGVQYXRoLCB0cnVlKTsKKyAgICAgICAgZnN0YXQobWZyLmZkLCAmc3N0YXQpOworICAgICAgICBmaW5hbHNpemUgPSBzc3RhdC5zdF9zaXplOworICAgICAgICBmaWxlTGVuZ3RoID0gZmluYWxzaXplOworICAgICAgICBpZiAobWZyLmZkIDwgMCkgeworICAgICAgICAgICAgQUxPR1coIk10cCBvcGVuIHZpYSBJTXRwRGF0YWJhc2UgZmFpbGVkIGZvciAlcy4gRmFsbGluZyBiYWNrIHRvIHRoZSBvcmlnaW5hbCIsCisgICAgICAgICAgICAgICAgICBmaWxlUGF0aCk7CisgICAgICAgICAgICBmaWxlUGF0aEFjY2VzcyA9IHRydWU7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBmaWxlUGF0aEFjY2VzcyA9IGZhbHNlOworICAgICAgICB9CiAgICAgfQorCisgICAgaWYgKGZpbGVQYXRoQWNjZXNzKSB7CisgICAgICAgIG1mci5mZCA9IG9wZW4oZmlsZVBhdGgsIE9fUkRPTkxZKTsKKyAgICAgICAgaWYgKG1mci5mZCA8IDApIHsKKyAgICAgICAgICAgIHJldHVybiBNVFBfUkVTUE9OU0VfR0VORVJBTF9FUlJPUjsKKyAgICAgICAgfQorICAgICAgICBmc3RhdChtZnIuZmQsICZzc3RhdCk7CisgICAgICAgIGZpbmFsc2l6ZSA9IHNzdGF0LnN0X3NpemU7CisgICAgfQorCiAgICAgbWZyLm9mZnNldCA9IDA7CiAgICAgbWZ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XRwX2Z1enplciIsCisgICAgc3JjczogWworICAgICAgICAibXRwX2Z1enplci5jcHAiLAorICAgICAgICAiTXRwTW9ja0RhdGFiYXNlLmNwcCIsCisgICAgXSwKKyAgICBzaGFyZWRfbGliczogWworCSJsaWJtdHAiLAorCSJsaWJiYXNlIiwKKwkibGlibG9nIiwKKwkibGlidXRpbHMiLAorICAgIF0sCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV2FsbCIsCisgICAgICAgICItV2V4dHJhIiwKKyAgICAgICAgIi1XZXJyb3IiLAorICAgICAgICAiLURNVFBfREVWSUNFIiwKKyAgICAgICAgIi1Xbm8tdW51c2VkLXBhcmFtZXRlciIsCisgICAgXSwKKyAgICBkaWN0aW9uYXJ5OiAibXRwX2Z1enplci5kaWN0IiwKKyAgICBjb3JwdXM6IFsiY29ycHVzLyoiXSwKKworICAgIGZ1enpfY29uZmlnOiB7CisKKyAgICAgICAgY2M6IFsiamFtZXN3ZWlAZ29vZ2xlLmNvbSJdLAorICAgICAgICBjb21wb25lbnRpZDogMTM0NCwKKyAgICAgICAgYWNrbm93bGVkZ2VtZW50OiBbCisgICAgICAgICAgICAiR3JhbnQgSGVybmFuZGV6IG9mIEdvb2dsZSIsCisgICAgICAgIF0sCisgICAgfSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL210cC90ZXN0cy9NdHBGdXp6ZXIvTXRwTW9ja0RhdGFiYXNlLmNwcCBiL21lZGlhL210cC90ZXN0cy9NdHBGdXp6ZXIvTXRwTW9ja0RhdGFiYXNlLmNwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi44YWFmZTMzCi0tLSAvZGV2L251bGwKKysrIGIvbWVkaWEvbXRwL3Rlc3RzL010cEZ1enplci9NdHBNb2NrRGF0YWJhc2UuY3BwCkBAIC0wLDAgKzEsMzIwIEBACisvKgorICogQ29weXJpZ2h0IChDKSAyMDIwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY3QKKyA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sKK30KKworTXRwUmVzcG9uc2VDb2RlIE10cE1vY2tEYXRhYmFzZTo6c2V0RGV2aWNlUHJvcGVydHlWYWx1ZShNdHBEZXZpY2VQcm9wZXJ0eSBwcm9wZXJ0eSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwRGF0YVBhY2tldCYgcGFja2V0KSB7CisgICAgQUxPR0QoIk1vY2tEYXRhYmFzZSAlczogcHJvcGVydHk9JXNcbiIsIF9fZnVuY19fLCBNdHBEZWJ1Zzo6Z2V0RGV2aWNlUHJvcENvZGVOYW1lKHByb3BlcnR5KSk7CisgICAgcmV0dXJuIE1UUF9SRVNQT05TRV9PSzsKK30KKworTXRwUmVzcG9uc2VDb2RlIE10cE1vY2tEYXRhYmFzZTo6cmVzZXREZXZpY2VQcm9wZXJ0eShNdHBEZXZpY2VQcm9wZXJ0eSBwcm9wZXJ0eSkgeworICAgIEFMT0dEKCJNb2NrRGF0YWJhc2UgJXM6IHByb3BlcnR5PSVzXG4iLCBfX2Z1bmNfXywgTXRwRGVidWc6OmdldERldmljZVByb3BDb2RlTmFtZShwcm9wZXJ0eSkpOworICAgIHJldHVybiBNVFBfUkVTUE9OU0VfT0s7Cit9CisKK010cFJlc3BvbnNlQ29kZSBNdHBNb2NrRGF0YWJhc2U6OmdldE9iamVjdFByb3BlcnR5TGlzdChNdHBPYmplY3RIYW5kbGUgaGFuZGxlLCB1aW50MzJfdCBmb3JtYXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgcHJvcGVydHksIGludCBncm91cENvZGUsIGludCBkZXB0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpIHsKKyAgICBBTE9HRCgiTW9ja0RhdGFiYXNlICVzOiBvaGFuZGxlPSV1IGZvcm1hdD0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0RhdGFiYXNlOjpnZXRPYmplY3RGaWxlUGF0aChNdHBPYmplY3RIYW5kbGUgaGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwU3RyaW5nQnVmZmVyJiBvdXRGaWxlUGF0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDY0X3QmIG91dEZpbGVMZW5ndGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQmIG91dEZvcm1hdCkgeworICAgIEFMT0dEKCJNb2NrRGF0YWJhc2UgJXM6IG9oYW5kbGU9JXVcbiIsIF9fZnVuY19fLCBoYW5kbGUpOworCisgICAgaWYgKG1PYmplY3RzLnNpemUoKSA9PSAwKSB7CisgICAgICAgIHJldHVybiBNVFBfUkVTUE9OU0VfSU5WQUxJRF9PQkpFQ1RfSEFORExFOworICAgIH0KKworICAgIC8vIHRoaXMgaXMgdXNlZCB0byBsZXQgdGhlIGZ1enplciBtYWtlIHByb2dyZXNzLCBvdGhlcndpc2UKKyAgICAvLyBpdCBoYXMgdG8gYnJ1dGUtZm9yY2UgYSAzMi1iaXQgaGFuZGxlCisgICAgTXRwT2JqZWN0SGFuZGxlIHJlZHVjZWRIYW5kbGUgPSBoYW5kbGUgJSBtT2JqZWN0cy5zaXplKCk7CisgICAgTXRwT2JqZWN0SW5mbyogb2JqID0gbU9iamVjdHNbcmVkdWNlZEhhbmRsZV07CisgICAgTXRwU3RvcmFnZSogc3RvcmFnZSA9IG1TdG9yYWdlW29iai0+bVN0b3JhZ2VJRF07CisKKyAgICAvLyB3YWxrIHVwIHRoZSB0cmVlIHRvIGJ1aWxkIGEgZnVsbCBwYXRoIG9mIHRoZSBvYmplY3QKKyAgICBNdHBPYmplY3RIYW5kbGUgY3VycmVudEhhbmRsZSA9IHJlZHVjZWRIYW5kbGU7CisgICAgc3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9ybWF0KTsKKyAgICBNdHBEZXZpY2VQcm9wZXJ0eUxpc3QqIGdldFN1cHBvcnRlZERldmljZVByb3BlcnRpZXMoKTsKKworICAgIE10cFJlc3BvbnNlQ29kZSBnZXRPYmplY3RQcm9wZXJ0eVZhbHVlKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsIE10cE9iamVjdFByb3BlcnR5IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cERhdGFQYWNrZXQmIHBhY2tldCk7CisKKyAgICBNdHBSZXNwb25zZUNvZGUgc2V0T2JqZWN0UHJvcGVydHlWYWx1ZShNdHBPYmplY3RIYW5kbGUgaGFuZGxlLCBNdHBPYmplY3RQcm9wZXJ0eSBwcm9wZXJ0eSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpOworCisgICAgTXRwUmVzcG9uc2VDb2RlIGdldERldmljZVByb3BlcnR5VmFsdWUoTXRwRGV2aWNlUHJvcGVydHkgcHJvcGVydHksIE10cERhdGFQYWNrZXQmIHBhY2tldCk7CisKKyAgICBNdHBSZXNwb25zZUNvZGUgc2V0RGV2aWNlUHJvcGVydHlWYWx1ZShNdHBEZXZpY2VQcm9wZXJ0eSBwcm9wZXJ0eSwgTXRwRGF0YVBhY2tldCYgcGFja2V0KTsKKworICAgIE10cFJlc3BvbnNlQ29kZSByZXNldERldmljZVByb3BlcnR5KE10cERldmljZVByb3BlcnR5IHByb3BlcnR5KTsKKworICAgIE10cFJlc3BvbnNlQ29kZSBnZXRPYmplY3RQcm9wZXJ0eUxpc3QoTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSwgdWludDMyX3QgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgcHJvcGVydHksIGludCBncm91cENvZGUsIGludCBkZXB0aCwKKyAgICAgICAgICAgICAgICAgICA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WZpbmUgX01UUF9NT0NLX0hBTkRMRV9ICisKKyNpbmNsdWRlIDx2ZWN0b3I+CisKK3R5cGVkZWYgc3RkOjp2ZWN0b3I8dWludDhfdD4gcGFja2V0X3Q7CisKK25hbWVzcGFjZSBhbmRyb2lkIHsKK2NsYXNzIE10cE1vY2tIYW5kbGUgOiBwdWJsaWMgSU10cEhhbmRsZSB7Citwcml2YXRlOgorICAgIHNpemVfdCBtUGFja2V0TnVtYmVyOworICAgIHNpemVfdCBtUGFja2V0T2Zmc2V0OworICAgIHN0ZDo6dmVjdG9yPHBhY2tldF90PiBtUGFja2V0czsKKworcHVibGljOgorICAgIE10cE1vY2tIYW5kbGUoKSA6IG1QYWNrZXROdW1iZXIoMCksIG1QYWNrZXRPZmZzZXQoMCkge30KKworICAgIHZvaWQgYWRkX3BhY2tldChwYWNrZXRfdCBwa3QpIHsgbVBhY2tldHMucHVzaF9iYWNrKHBrdCk7IH0KKworICAgIC8vIFJldHVybiBudW1iZXIgb2YgYnl0ZXMgcmVhZC93cml0dGVuLCBvciAtMSBhbmQgZXJybm8gaXMgc2V0CisgICAgaW50IHJlYWQodm9pZCAqZGF0YSwgc2l6ZV90IGxlbikgeworICAgICAgICBpZiAobVBhY2tldE51bWJlciA+PSBtUGFja2V0cy5zaXplKCkpIHsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaW50IHJlYWRBbXQgPSAwOworICAgICAgICAgICAgcGFja2V0X3QgcGt0ID0gbVBhY2tldHNbbVBhY2tldE51bWJlcl07CisKKyAgICAgICAgICAgIEFMT0dEKCIlczogc3ogJXp1LCBwa3QgJXp1KyV6dS8lenVcbiIsIF9fZnVuY19fLCBsZW4sIG1QYWNrZXROdW1iZXIsIG1QYWNrZXRPZmZzZXQsCisgICAgICAgICAgICAgICAgICBwa3Quc2l6ZSgpKTsKKworICAgICAgICAgICAgLy8gcGFja2V0IGlzIGJpZ2dlciB0aGFuIHdoYXQgdGhlIGNhbGxlciBjYW4gaGFuZGxlLAorICAgICAgICAgICAgaWYgKHBrdC5zaXplKCkgPiBsZW4pIHsKKyAgICAgICAgICAgICAgICBtZW1jcHkoZGF0YSwgcGt0LmRhdGEoKSArIG1QYWNrZXRPZmZzZXQsIGxlbik7CisKKyAgICAgICAgICAgICAgICBtUGFja2V0T2Zmc2V0ICs9IGxlbjsKKyAgICAgICAgICAgICAgICByZWFkQW10ID0gbGVuOworICAgICAgICAgICAgICAgIC8vIHBhY2tldCBpcyBlcXVhbCBvciBzbWFsbGVyIHRoYW4gdGhlIGNhbGxlciBidWZmZXIKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbWVtY3B5KGRhdGEsIHBrdC5kYXRhKCkgKyBtUGFja2V0T2Zmc2V0LCBwa3Quc2l6ZSgpKTsKKworICAgICAgICAgICAgICAgIG1QYWNrZXROdW1iZXIrKzsKKyAgICAgICAgICAgICAgICBtUGFja2V0T2Zmc2V0ID0gMDsKKyAgICAgICAgICAgICAgICByZWFkQW10ID0gcGt0LnNpemUoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIHJlYWRBbXQ7CisgICAgICAgIH0KKyAgICB9CisgICAgaW50IHdyaXRlKGNvbnN0IHZvaWQgKmRhdGEsIHNpemVfdCBsZW4pIHsKKyAgICAgICAgQUxPR0QoIk1vY2tIYW5kbGUgJXM6IGxlbj0lenVcbiIsIF9fZnVuY19fLCBsZW4pOworICAgICAgICAvLyBmYWtlIHRoZSB3cml0ZQorICAgICAgICByZXR1cm4gbGVuOworICAgIH0KKworICAgIC8vIFJldHVybiAwIGlmIHNlbmQvcmVjZWl2ZSBpcyBzdWNjZXNzZnVsLCBvciAtMSBhbmQgZXJybm8gaXMgc2V0CisgICAgaW50IHJlY2VpdmVGaWxlKG10cF9maWxlX3JhbmdlIG1mciwgYm9vbCB6ZXJvX3BhY2tldCkgeworICAgICAgICBBTE9HRCgiTW9ja0hhbmRsZSAlc1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MKTsKKyAgICAgICAgbURhdGFiYXNlID0gc3RkOjptYWtlX3VuaXF1ZTxNdHBNb2NrRGF0YWJhc2U+KCk7CisgICAgICAgIG1EYXRhYmFzZS0+YWRkU3RvcmFnZShtU3RvcmFnZS5nZXQoKSk7CisKKyAgICAgICAgbU10cCA9IHN0ZDo6bWFrZV91bmlxdWU8TXRwU2VydmVyPihtRGF0YWJhc2UuZ2V0KCksIGNvbnRyb2xGZCwgcHRwLCBtYW51LCBtb2RlbCwgdmVyc2lvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXJpYWwpOworICAgICAgICBtTXRwLT5hZGRTdG9yYWdlKG1TdG9yYWdlLmdldCgpKTsKKworICAgICAgICAvLyBjbGVhciB0aGUgb2xkIGhhbmRsZSBmaXJzdCwgc28gd2UgZG9uJ3QgbGVhayBtZW1vcnkKKyAgICAgICAgZGVsZXRlIG1NdHAtPm1IYW5kbGU7CisgICAgICAgIG1NdHAtPm1IYW5kbGUgPSBtSGFuZGxlLmdldCgpOworICAgIH0KKworICAgIHZvaWQgcnVuKCkgeyBtTXRwLT5ydW4oKTsgfQorCisgICAgaW50IGNyZWF0ZURhdGFiYXNlRnJvbVNvdXJjZURpcihjb25zdCBjaGFyKiBmcm9tUGF0aCwgY29uc3QgY2hhciogdG9QYXRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIHBhcmVudEhhbmRsZSkgeworICAgICAgICBpbnQgcmV0ID0gMDsKKyAgICAgICAgc3RkOjpzdHJpbmcgZnJvbVBhdGhTdHIoZnJvbVBhdGgpOworICAgICAgICBzdGQ6OnN0cmluZyB0b1BhdGhTdHIodG9QYXRoKTsKKworICAgICAgICBESVIqIGRpciA9IG9wZW5kaXIoZnJvbVBhdGgpOworICAgICAgICBpZiAoIWRpcikgeworICAgICAgICAgICAgQUxPR0UoIm9wZW5kaXIgJXMgZmFpbGVkIiwgZnJvbVBhdGgpOworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgICAgIGlmIChmcm9tUGF0aFN0cltmcm9tUGF0aFN0ci5zaXplKCkgLSAxXSAhPSAnLycpIGZyb21QYXRoU3RyICs9ICcvJzsKKyAgICAgICAgaWYgKHRvUGF0aFN0clt0b1BhdGhTdHIuc2l6ZSgpIC0gMV0gIT0gJy8nKSB0b1BhdGhTdHIgKz0gJy8nOworCisgICAgICAgIHN0cnVjdCBkaXJlbnQqIGVudHJ5OworICAgICAgICB3aGlsZSAoKGVudHJ5ID0gcmVhZGRpcihkaXIpKSkgeworICAgICAgICAgICAgY29uc3QgY2hhciogbmFtZSA9IGVudHJ5LT5kX25hbWU7CisKKyAgICAgICAgICAgIC8vIGlnbm9yZSAiLiIgYW5kICIuLiIKKyAgICAgICAgICAgIGlmIChuYW1lWzBdID09ICcuJyAmJiAobmFtZVsxXSA9PSAwIHx8IChuYW1lWzFdID09ICcuJyAmJiBuYW1lWzJdID09IDApKSkgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzdGQ6OnN0cmluZyBvbGRGaWxlID0gZnJvbVBhdGhTdHIgKyBuYW1lOworICAgICAgICAgICAgc3RkOjpzdHJpbmcgbmV3RmlsZSA9IHRvUGF0aFN0ciArIG5hbWU7CisKKyAgICAgICAgICAgIGlmIChlbnRyeS0+ZF90eXBlID09IERUX0RJUikgeworICAgICAgICAgICAgICAgIHJldCArPSBtYWtlRm9sZGVyKG5ld0ZpbGUuY19zdHIoKSk7CisKKyAgICAgICAgICAgICAgICBNdHBPYmplY3RJbmZvKiBvYmplY3RJbmZvID0gbmV3IE10cE9iamVjdEluZm8obURhdGFiYXNlLT5hbGxvY2F0ZU9iamVjdEhhbmRsZSgpKTsKKyAgICAgICAgICAgICAgICBvYmplY3RJbmZvLT5tU3RvcmFnZUlEID0gbVN0b3JhZ2UtPmdldFN0b3JhZ2VJRCgpOworICAgICAgICAgICAgICAgIG9iamVjdEluZm8tPm1QYXJlbnQgPSBwYXJlbnRIYW5kbGU7CisgICAgICAgICAgICAgICAgb2JqZWN0SW5mby0+bUZvcm1hdCA9IE1UUF9GT1JNQVRfQVNTT0NJQVRJT047IC8vIGZvbGRlcgorICAgICAgICAgICAgICAgIG9iamVjdEluZm8tPm1OYW1lID0gc3RyZHVwKG5hbWUpOworICAgICAgICAgICAgICAgIG9iamVjdEluZm8tPm1LZXl3b3JkcyA9IHN0cmR1cCgiIik7CisKKyAgICAgICAgICAgICAgICBtRGF0YWJhc2UtPmFkZE9iamVjdChvYmplY3RJbmZvKTsKKworICAgICAgICAgICAgICAgIHJldCArPSBjcmVhdGVEYXRhYmFzZUZyb21Tb3VyY2VEaXIob2xkRmlsZS5jX3N0cigpLCBuZXdGaWxlLmNfc3RyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3RJbmZvLT5tSGFuZGxlKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcmV0ICs9IGNvcHlGaWxlKG9sZEZpbGUuY19zdHIoKSwgbmV3RmlsZS5jX3N0cigpKTsKKworICAgICAgICAgICAgICAgIE10cE9iamVjdEluZm8qIG9iamVjdEluZm8gPSBuZXcgTXRwT2JqZWN0SW5mbyhtRGF0YWJhc2UtPmFsbG9jYXRlT2JqZWN0SGFuZGxlKCkpOworICAgICAgICAgICAgICAgIG9iamVjdEluZm8tPm1TdG9yYWdlSUQgPSBtU3RvcmFnZS0+Z2V0U3RvcmFnZUlEKCk7CisgICAgICAgICAgICAgICAgb2JqZWN0SW5mby0+bVBhcmVudCA9IHBhcmVudEhhbmRsZTsKKyAgICAgICAgICAgICAgICBvYmplY3RJbmZvLT5tRm9ybWF0ID0gTVRQX0ZPUk1BVF9URVhUOworICAgICAgICAgICAgICAgIG9iamVjdEluZm8tPm1OYW1lID0gc3RyZHVwKG5hbWUpOworICAgICAgICAgICAgICA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ywxMSArNzQsMjAgQEAKICAgICAgICAgImNvbS5hbmRyb2lkLm1lZGlhLnN3Y29kZWMiLAogICAgIF0sCiAgICAgbWluX3Nka192ZXJzaW9uOiAiMjkiLAotICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsiaW5jbHVkZSJdCisgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWyJpbmNsdWRlIl0sCisgICAgaG9zdF9zdXBwb3J0ZWQ6IHRydWUsCisgICAgdGFyZ2V0OiB7CisgICAgICAgIGRhcndpbjogeworICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsCisgICAgICAgIH0sCisgICAgfSwKIH0KIAogY2NfbGlicmFyeV9zaGFyZWQgewogICAgIG5hbWU6ICJsaWJtZWRpYW5kayIsCisgICAgbGxuZGs6IHsKKyAgICAgICAgc3ltYm9sX2ZpbGU6ICJsaWJtZWRpYW5kay5tYXAudHh0IiwKKyAgICB9LAogCiAgICAgc3JjczogWwogICAgICAgICAiTmRrSmF2YVZNSGVscGVyLmNwcCIsCkBAIC03Niw5ICsxMTYsMTEgQEAKIAogICAgIHN0YXRpY19saWJzOiBbCiAgICAgICAgICJsaWJncmFsbG9jdXNhZ2UiLAorICAgICAgICAibGlibmF0aXZlaGVscGVyX2xhenkiLAogICAgIF0sCiAKICAgICBoZWFkZXJfbGliczogWworICAgICAgICAiam5pX2hlYWRlcnMiLAogICAgICAgICAibGlibWVkaWFkcm1faGVhZGVycyIsCiAgICAgICAgICJsaWJtZWRpYW1ldHJpY3NfaGVhZGVycyIsCiAgICAgXSwKQEAgLTEwMywxMCArMTQ1LDE0IEBACiAgICAgICAgICJsaWJndWkiLAogICAgICAgICAibGlidWkiLAogICAgICAgICAibGlibWVkaWFuZGtfdXRpbHMiLAotICAgICAgICAibGlibmF0aXZlaGVscGVyIiwKICAgICBdLAogCi0gICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWyJpbmNsdWRlIl0sCisgICAgZXhwb3J0X2hlYWRlcl9saWJfaGVhZGVyczogWyJqbmlfaGVhZGVycyJdLAorCisgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWworICAgICAgICAiaW5jbHVkZSIsCisgICAgICAgICJpbmNsdWRlX3BsYXRmb3JtIiwKKyAgICBdLAogCiAgICAgZXhwb3J0X3NoYXJlZF9saWJfaGVhZGVyczogWwogICAgICAgICAibGliZ3VpIiwKQEAgLTEyNCwxNCArMTcwLDYgQEAKICAgICB9LAogfQogCi1sbG5ka19saWJyYXJ5IHsKLSAgICBuYW1lOiAibGlibWVkaWFuZGsiLAotICAgIHN5bWJvbF9maWxlOiAibGlibWVkaWFuZGsubWFwLnR4dCIsCi0gICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWwotICAgICAgICAiaW5jbHVkZSIsCi0gICAgXSwKLX0KLQogY2NfbGlicmFyeSB7CiAgICAgbmFtZTogImxpYm1lZGlhbmRrX3V0aWxzIiwKIApAQCAtMTcyLDYgKzIxMCw3IEBACiAKIGNjX3Rlc3QgewogICAgIG5hbWU6ICJBSW1hZ2VSZWFkZXJXaW5kb3dIYW5kbGVUZXN0IiwKKyAgICB0ZXN0X3N1aXRlczogWyJkZXZpY2UtdGVzdHMiXSwKICAgICBzcmNzOiBbInRlc3RzL0FJbWFnZVJlYWRlcldpbmRvd0hhbmRsZVRlc3QuY3BwIl0sCiAgICAgc2hhcmVkX2xpYnM6IFsKICAgICAgICAgImxpYmJpbmRlciIsCkBAIC0xOTUsMyArMjM0LDQ1IEBACiAgICAgICAgICJmcmFtZXdvcmtzL2F2L21lZGlhL25kay8iLAogICAgIF0sCiB9CisKK2NjX2xpYnJhcnlfc3RhdGljIHsKKyAgICBuYW1lOiAibGlibWVkaWFuZGtfZm9ybWF0IiwKKworICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorCisgICAgc3JjczogWworICAgICAgICAiTmRrTWVkaWFGb3JtYXQuY3BwIiwKKyAgICBdLAorCisgICAgaGVhZGVyX2xpYnM6IFsKKyAgICAgICAgImxpYnN0YWdlZnJpZ2h0X2ZvdW5kYXRpb25faGVhZGVycyIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURFWFBPUlQ9X19hdHRyaWJ1dGVfXygodmlzaWJpbGl0eShcImRlZmF1bHRcIikpKSIsCisgICAgICAgICItV2Vycm9yIiwKKyAgICAgICAgIi1XYWxsIiwKKyAgICBdLAorCisgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWyJpbmNsdWRlIl0sCisKKyAgICBzYW5pdGl6ZTogeworICAgICAgICBtaXNjX3VuZGVmaW5lZDogWworICAgICAgICAgICAgInVuc2lnbmVkLWludGVnZXItb3ZlcmZsb3ciLAorICAgICAgICAgICAgInNpZ25lZC1pbnRlZ2VyLW92ZXJmbG93IiwKKyAgICAgICAgXSwKKyAgICAgICAgY2ZpOiB0cnVlLAorICAgIH0sCisKKyAgICB0YXJnZXQ6IHsKKyAgICAgICAgZGFyd2luOiB7CisgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSwKKyAgICAgICAgfSwKKyAgICB9LAorCisgICAgYXBleF9hdmFpbGFibGU6IFsKKyAgICAgICAgIi8vYXBleF9hdmFpbGFibGU6cGxhdGZvcm0iLAorICAgICAgICAiY29tLmFuZHJvaWQubWVkaWEiLAorICAgICAgICAiY29tLmFuZHJvaWQubWVkaWEuc3djb2RlYyIsCisgICAgXSwKK30KZGlmZiAtLWdpdCBhL21lZGlhL25kay9OZGtJbWFnZS5jcHAgYi9tZWRpYS9uZGsvTmRrSW1hZ2UuY3BwCmluZGV4IDExNDViN2IuLjVmZGQ0NWEgMTAwNjQ0Ci0tLSBhL21lZGlhL25kay9OZGtJbWFnZS5jcHAKKysrIGIvbWVkaWEvbmRrL05ka0ltYWdlLmNwcApAQCAtNTgsNyArNTgsNyBAQAogICAgIGlmIChtSXNDbG9zZWQpIHsKICAgICAgICAgcmV0dXJuOwogICAgIH0KLSAgICBpZiAoIW1SZWFkZXItPm1Jc0Nsb3NlZCkgeworICAgIGlmIChtUmVh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UoIkRlY29kZXIgcmVwb3J0ZWQgZXJyb3IoMHgleCksIGFjdGlvbkNvZGUoJWQpLCBkZXRhaWwoJXMpIiwKKyAgICAgICAgICAgICAgICAgICAgIEFMT0dFKCJDb2RlYyByZXBvcnRlZCBlcnJvcigweCV4KSwgYWN0aW9uQ29kZSglZCksIGRldGFpbCglcykiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyLCBhY3Rpb25Db2RlLCBkZXRhaWwuY19zdHIoKSk7CiAKICAgICAgICAgICAgICAgICAgICAgIE11dGV4OjpBdXRvbG9jayBfbChtQ29kZWMtPm1Bc3luY0NhbGxiYWNrTG9jayk7CkBAIC0zMDgsNyArMzEyLDExIEBACiAKIGV4dGVybiAiQyIgewogCi1zdGF0aWMgQU1lZGlhQ29kZWMgKiBjcmVhdGVBTWVkaWFDb2RlYyhjb25zdCBjaGFyICpuYW1lLCBib29sIG5hbWVfaXNfdHlwZSwgYm9vbCBlbmNvZGVyKSB7CitzdGF0aWMgQU1lZGlhQ29kZWMgKiBjcmVhdGVBTWVkaWFDb2RlYyhjb25zdCBjaGFyICpuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBuYW1lX2lzX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGVuY29kZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWRfdCBwaWQgPSBhbmRyb2lkOjpNZWRpYUNvZGVjOjprTm9QaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQgPSBhbmRyb2lkOjpNZWRpYUNvZGVjOjprTm9VaWQpIHsKICAgICBBTWVkaWFDb2RlYyAqbURhdGEgPSBuZXcgQU1lZGlhQ29kZWMoKTsKICAgICBtRGF0YS0+bUxvb3BlciA9IG5ldyBBTG9vcGVyOwogICAgIG1EYXRhLT5tTG9vcGVyLT5zZXROYW1lKCJOREsgTWVkaWFDb2RlY19sb29wZXIiKTsKQEAgLTMyMiw5ICszMzAsMjAgQEAKICAgICAgICAgcmV0dXJuIE5VTEw7CiAgICAgfQogICAgIGlmIChuYW1lX2lzX3R5cGUpIHsKLSAgICAgICAgbURhdGEtPm1Db2RlYyA9IGFuZHJvaWQ6Ok1lZGlhQ29kZWM6OkNyZWF0ZUJ5VHlwZShtRGF0YS0+bUxvb3BlciwgbmFtZSwgZW5jb2Rlcik7CisgICAgICAgIG1EYXRhLT5tQ29kZWMgPSBhbmRyb2lkOjpNZWRpYUNvZGVjOjpDcmVhdGVCeVR5cGUoCisgICAgICAgICAgICAgICAgbURhdGEtPm1Mb29wZXIsCisgICAgICAgICAgICAgICAgbmFtZSwKKyAgICAgICAgICAgICAgICBlbmNvZGVyLAorICAgICAgICAgICAgICAgIG51bGxwdHIgLyogZXJyICovLAorICAgICAgICAgICAgICAgIHBpZCwKKyAgICAgICAgICAgICAgICB1aWQpOwogICAgIH0gZWxzZSB7Ci0gICAgICAgIG1EYXRhLT5tQ29kZWMgPSBhbmRyb2lkOjpNZWRpYUNvZGVjOjpDcmVhdGVCeUNvbXBvbmVudE5hbWUobURhdGEtPm1Mb29wZXIsIG5hbWUpOworICAgICAgICBtRGF0YS0+bUNvZGVjID0gYW5kcm9pZDo6TWVkaWFDb2RlYzo6Q3JlYXRlQnlDb21wb25lbnROYW1lKAorICAgICAgICAgICAgICAgIG1EYXRhLT5tTG9vcGVyLAorICAgICAgICAgICAgICAgIG5hbWUsCisgICAgICAgICAgICAgICAgbnVsbHB0ciAvKiBlcnIgKi8sCisgICAgICAgICAgICAgICAgcGlkLAorICAgICAgICAgICAgICAgIHVpZCk7CiAgICAgfQogICAgIGlmIChtRGF0YS0+bUNvZGVjID09IE5VTEwpIHsgIC8vIGZhaWxlZCB0byBjcmVhdGUgY29kZWMKICAgICAgICAgQU1lZGlhQ29kZWNfZGVsZXRlKG1EYXRhKTsKQEAgLTM0NCwxNyArMzYzLDM4IEBACi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AgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQpIHsKKyAgICByZXR1cm4gY3JlYXRlQU1lZGlhQ29kZWMobmFtZSwgZmFsc2UgLyogbmFtZV9pc190eXBlICovLCBmYWxzZSAvKiBlbmNvZGVyICovLCBwaWQsIHVpZCk7Cit9CisKK0VYUE9SVAorQU1lZGlhQ29kZWMqIEFNZWRpYUNvZGVjX2NyZWF0ZURlY29kZXJCeVR5cGVGb3JDbGllbnQoY29uc3QgY2hhciAqbWltZV90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgdWlkKSB7CisgICAgcmV0dXJuIGNyZWF0ZUFNZWRpYUNvZGVjKG1pbWVfdHlwZSwgdHJ1ZSAvKiBuYW1lX2lzX3R5cGUgKi8sIGZhbHNlIC8qIGVuY29kZXIgKi8sIHBpZCwgdWlkKTsKK30KKworRVhQT1JUCitBTWVkaWFDb2RlYyogQU1lZGlhQ29kZWNfY3JlYXRlRW5jb2RlckJ5VHlwZUZvckNsaWVudChjb25zdCBjaGFyICpuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgdWlkKSB7CisgICAgcmV0dXJuIGNyZWF0ZUFNZWRpYUNvZGVjKG5hbWUsIHRydWUgLyogbmFtZV9pc190eXBlICovLCB0cnVlIC8qIGVuY29kZXIgKi8sIHBpZCwgdWlkKTsKIH0KIAogRVhQT1JUCkBAIC05MTQsNSArOTU0LDEzIEBACiAgICAgcmV0dXJuIEFNRURJQV9PSzsKIH0KIAorRVhQT1JUIGNvbnN0IGNoYXIqIEFNRURJQUNPREVDX0tFWV9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8tIiArIFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpICsgIi5tcDQiOworICAgICAgICBMb2cuaShUQUcsICJPdXRwdXQgdmlkZW8gaXMgc2F2ZWQgYXQ6ICIgKyB2aWRlb1BhdGgpOworICAgICAgICByZXR1cm4gdmlkZW9QYXRoOworICAgIH0KKworICAgIEBUZXN0CisgICAgcHVibGljIHZvaWQgdGVzdE1lZGlhU3VyZmFjZUVuY29kZXIoKSB0aHJvd3MgSU9FeGNlcHRpb24sIEludGVycnVwdGVkRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nIG91dHB1dEZpbGVQYXRoID0gZ2V0T3V0cHV0UGF0aCgpOworICAgICAgICBNZWRpYUNvZGVjU3VyZmFjZUVuY29kZXIgc3VyZmFjZUVuY29kZXIgPQorICAgICAgICAgICAgICAgIG5ldyBNZWRpYUNvZGVjU3VyZmFjZUVuY29kZXIobUNvbnRleHQsIG1JbnB1dFJlc0lkLCBtTWltZSwgbUlzU29mdHdhcmVFbmNvZGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0RmlsZVBhdGgsIG1NYXhCRnJhbWVzKTsKKyAgICAgICAgaW50IGVuY29kaW5nU3RhdHVzID0gc3VyZmFjZUVuY29kZXIuc3RhcnRFbmNvZGluZ1N1cmZhY2UoKTsKKyAgICAgICAgYXNzZXJ0VGhhdChlbmNvZGluZ1N0YXR1cywgaXMoZXF1YWxUbygwKSkpOworICAgICAgICBpbnRbXSBmcmFtZU51bUFycmF5ID0gc3VyZmFjZUVuY29kZXIuZ2V0RnJhbWVUeXBlcygpOworICAgICAgICBMb2cuaShUQUcsICJSZXN1bHRzOiBJLUZyYW1lczogIiArIGZyYW1lTnVtQXJyYXlbMF0gKyAiOyBQLUZyYW1lczogIiArIGZyYW1lTnVtQXJyYXlbMV0gKworICAgICAgICAgICAgICAgICJcbiAiICsgIjsgQi1GcmFtZXM6IiArIGZyYW1lTnVtQXJyYXlbMl0pOworICAgICAgICBhc3Nlc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k7CisgICAgICAgIHJhZGlvR3JvdXBfbWltZS5zZXRPbkNoZWNrZWRDaGFuZ2VMaXN0ZW5lcihuZXcgUmFkaW9Hcm91cC5PbkNoZWNrZWRDaGFuZ2VMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIHZvaWQgb25DaGVja2VkQ2hhbmdlZChSYWRpb0dyb3VwIGdyb3VwLCBpbnQgY2hlY2tlZElkKSB7CisgICAgICAgICAgICAgICAgaWYgKGNoZWNrZWRJZCA9PSBSLmlkLmF2YykgeworICAgICAgICAgICAgICAgICAgICBtTWltZSA9IE1lZGlhRm9ybWF0Lk1JTUVUWVBFX1ZJREVPX0FWQzsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtTWltZSA9IE1lZGlhRm9ybWF0Lk1JTUVUWVBFX1ZJREVPX0hFVkM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICBmaW5hbCBSYWRpb0dyb3VwIHJhZGlvR3JvdXBfY29kZWMgPSBmaW5kVmlld0J5SWQoUi5pZC5yYWRpb19ncm91cF9jb2RlYyk7CisgICAgICAgIHJhZGlvR3JvdXBfY29kZWMuc2V0T25DaGVja2VkQ2hhbmdlTGlzdGVuZXIobmV3IFJhZGlvR3JvdXAuT25DaGVja2VkQ2hhbmdlTGlzdGVuZXIoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2hlY2tlZENoYW5nZWQoUmFkaW9Hcm91cCBncm91cCwgaW50IGNoZWNrZWRJZCkgeworICAgICAgICAgICAgICAgIG1Jc0NvZGVjU29mdHdhcmUgPSBjaGVja2VkSWQgPT0gUi5pZC5zdzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSk7CisKKyAgICAgICAgZmluYWwgQ2hlY2tCb3ggY2hlY2tCb3hfbXIgPSBmaW5kVmlld0J5SWQoUi5pZC5jaGVja0JveF9tZWRpYV9yZWNvcmRlcik7CisgICAgICAgIGZpbmFsIENoZWNrQm94IGNoZWNrQm94X21jID0gZmluZFZpZXdCeUlkKFIuaWQuY2hlY2tCb3hfbWVkaWFfY29kZWMpOworICAgICAgICBtVGV4dHVyZVZpZXcgPSBmaW5kVmlld0J5SWQoUi5pZC50ZXh0dXJlKTsKKyAgICAgICAgbVRleHRWaWV3ID0gZmluZFZpZXdCeUlkKFIuaWQudGV4dFZpZXdSZXN1bHRzKTsKKworICAgICAgICBjaGVja0JveF9tci5zZXRPbkNsaWNrTGlzdGVuZXIobmV3IFZpZXcuT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgICAgIGJvb2xlYW4gY2hlY2tlZCA9ICgoQ2hlY2tCb3gpIHYpLmlzQ2hlY2tlZCgpOworICAgICAgICAgICAgICAgIGlmIChjaGVja2VkKSB7CisgICAgICAgICAgICAgICAgICAgIGNoZWNrQm94X21jLnNldENoZWNrZWQoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICBtSXNNZWRpYVJlY29yZGVyID0gVFJVRTsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCByYWRpb0dyb3VwX2NvZGVjLmdldENoaWxkQ291bnQoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByYWRpb0dyb3VwX2NvZGVjLmdldENoaWxkQXQoaSkuc2V0RW5hYmxlZChmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgICAgICBjaGVja0JveF9tYy5zZXRPbkNsaWNrTGlzdGVuZXIobmV3IFZpZXcuT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgICAgIGJvb2xlYW4gY2hlY2tlZCA9ICgoQ2hlY2tCb3gpIHYpLmlzQ2hlY2tlZCgpOworICAgICAgICAgICAgICAgIGlmIChjaGVja2VkKSB7CisgICAgICAgICAgICAgICAgICAgIGNoZWNrQm94X21yLnNldENoZWNrZWQoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICBtSXNNZWRpYVJlY29yZGVyID0gRkFMU0U7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcmFkaW9Hcm91cF9jb2RlYy5nZXRDaGlsZENvdW50KCk7IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgcmFkaW9Hcm91cF9jb2RlYy5nZXRDaGlsZEF0KGkpLnNldEVuYWJsZWQodHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgICAgICBtU3RhcnRCdXR0b24gPSBmaW5kVmlld0J5SWQoUi5pZC5zdGFydF9idXR0b24pOworICAgICAgICBtU3RhcnRCdXR0b24uc2V0T25DbGlja0xpc3RlbmVyKHRoaXMpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgIGlmICh2LmdldElkKCkgPT0gUi5pZC5zdGFydF9idXR0b24pIHsKKyAgICAgICAgICAgIG1UZXh0Vmlldy5zZXRUZXh0KG51bGwpOworICAgICAgICAgICAgaWYgKG1Jc01lZGlhUmVjb3JkZXIpIHsKKyAgICAgICAgICAgICAgICBpZiAobUlzUmVjb3JkaW5nKSB7CisgICAgICAgICAgICAgICAgICAgIHN0b3BSZWNvcmRpbmdWaWRlbygpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1TdGFyd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ICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvblBvc3RFeGVjdXRlKEludGVnZXIgZW5jb2RpbmdTdGF0dXMpIHsKKyAgICAgICAgICAgIE1haW5BY3Rpdml0eSBtYWluQWN0aXZpdHkgPSBhY3Rpdml0eVJlZmVyZW5jZS5nZXQoKTsKKyAgICAgICAgICAgIG1haW5BY3Rpdml0eS5tU3RhcnRCdXR0b24uc2V0RW5hYmxlZCh0cnVlKTsKKyAgICAgICAgICAgIGlmIChlbmNvZGluZ1N0YXR1cyA9PSAwKSB7CisgICAgICAgICAgICAgICAgVG9hc3QubWFrZVRleHQobWFpbkFjdGl2aXR5LmdldEFwcGxpY2F0aW9uQ29udGV4dCgpLCAiRW5jb2RpbmcgQ29tcGxldGVkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgIFRvYXN0LkxFTkdUSF9TSE9SVCkuc2hvdygpOworICAgICAgICAgICAgICAgIG1haW5BY3Rpdml0eS5tVGV4dFZpZXcuYXBwZW5kKCJcbiBFbmNvZGVkIHN0cmVhbSBjb250YWluczogIik7CisgICAgICAgICAgICAgICAgbWFpbkFjdGl2aXR5Lm1UZXh0Vmlldy5hcHBlbmQoIlxuIE51bWJlciBvZiBJLUZyYW1lczogIiArCisgICAgICAgICAgICAgICAgICAgICAgICBtYWluQWN0aXZpdHkubUZyYW1lVHlwZU9jY3VycmVuY2VzW0ZSQU1FX1RZUEVfSV0pOworICAgICAgICAgICAgICAgIG1haW5BY3Rpdml0eS5tVGV4dFZpZXcuYXBwZW5kKCJcbiBOdW1iZXIgb2YgUC1GcmFtZXM6ICIgKworICAgICAgICAgICAgICAgICAgICAgICAgbWFpbkFjdGl2aXR5Lm1GcmFtZVR5cGVPY2N1cnJlbmNlc1tGUkFNRV9UWVBFX1BdKTsKKyAgICAgICAgICAgICAgICBtYWluQWN0aXZpdHkubVRleHRWaWV3LmFwcGVuZCgiXG4gTnVtYmVyIG9mIEItRnJhbWVzOiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1haW5BY3Rpdml0eS5tRnJhbWVUeXBlT2NjdXJyZW5jZXNbRlJBTUVfVFlQRV9CXSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIFRvYXN0Lm1ha2VUZXh0KG1haW5BY3Rpdml0eS5nZXRBcHBsaWNhdGlvbkNvbnRleHQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICJFcnJvciBvY2N1cnJlZCB3aGlsZSAiICsgImVuY29kaW5nIiwgVG9hc3QuTEVOR1RIX1NIT1JUKS5zaG93KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtYWluQWN0aXZpdHkubU91dHB1dFZpZGVvUGF0aCA9IG51bGw7CisgICAgICAgICAgICBzdXBlci5vblBvc3RFeGVjdXRlKGVuY29kaW5nU3RhdHVzKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgZmluYWwgVGV4dHVyZVZpZXcuU3VyZmFjZVRleHR1cmVMaXN0ZW5lciBtU3VyZmFjZVRleHR1cmVMaXN0ZW5lciA9CisgICAgICAgICAgICBuZXcgVGV4dHVyZVZpZXcuU3VyZmFjZVRleHR1cmVMaXN0ZW5lcigpIHsKKworICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uU3VyZmFjZVRleHR1cmVBdmFpbGFibGUoU3VyZmFjZVRleHR1cmUgc3VyZmFjZSwgaW50IHdpZHRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGhlaWdodCkgeworICAgICAgICAgICAgICAgICAgICBvcGVuQ2FtZXJhKHdpZHRoLCBoZWlnaHQpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uU3VyZmFjZVRleHR1cmVTaXplQ2hhbmdlZChTdXJmYWNlVGV4dHVyZSBzdXJmYWNlLCBpbnQgd2lkdGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBoZWlnaHQpIHsKKyAgICAgICAgICAgICAgICAgICAgY29uZmlndXJlVHJhbnNmb3JtKHdpZHRoLCBoZWlnaHQpOworICAgICAgICAgICAgICAgICAgICBMb2cudihUQUcsICJLZWVwaW5nIGNhbWVyYSBwcmV2aWV3IHNpemUgZml4ZWQiKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBvblN1cmZhY2VUZXh0dXJlRGVzdHJveWVkKFN1cmZhY2VUZXh0dXJlIHN1cmZhY2UpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25TdXJmYWNlVGV4dHVyZVVwZGF0ZWQoU3VyZmFjZVRleHR1cmUgc3VyZmFjZSkgeworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisKKworICAgIHByaXZhdGUgZmluYWwgQ2FtZXJhRGV2aWNlLlN0YXRlQ2FsbGJhY2sgbVN0YXRlQ2FsbGJhY2sgPSBuZXcgQ2FtZXJhRGV2aWNlLlN0YXRlQ2FsbGJhY2soKSB7CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIG9uT3BlbmVkKENhbWVyYURldmljZSBjYW1lcmFEZXZpY2UpIHsKKyAgICAgICAgICAgIG1DYW1lcmFEZXZpY2UgPSBjYW1lcmFEZXZpY2U7CisgICAgICAgICAgICBzdGFydFByZXZpZXcoKTsKKyAgICAgICAgICAgIG1DYW1lcmFPcGVuQ2xvc2VMb2NrLnJlbGVhc2UoKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBvbkRpc2Nvbm5lY3RlZChDYW1lcmFEZXZpY2UgY2FtZXJhRGV2aWNlKSB7CisgICAgICAgICAgICBtQ2FtZXJhT3BlbkNsb3NlTG9jay5yZWxlYXNlKCk7CisgICAgICAgICAgICBjYW1lcmFEZXZpY2UuY2xvc2UoKTsKKyAgICAgICAgICAgIG1DYW1lcmFEZXZpY2UgPSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIG9uRXJyb3IoQ2FtZXJhRGV2aWNlIGNhbWVyYURldmljZSwgaW50IGVycm9yKSB7CisgICAgICAgICAgICBtQ2FtZXJhT3BlbkNsb3NlTG9jay5yZWxlYXNlKCk7CisgICAgICAgICAgICBjYW1lcmFEZXZpY2UuY2xvc2UoKTsKKyAgICAgICAgICAgIG1DYW1lcmFEZXZpY2UgPSBudWxsOworICAgICAgICAgICAgQWN0aXZpdHkgYWN0aXZpdHkgPSBNYWluQWN0aXZpdHkudGhpczsKKyAgICAgICAgICAgIGFjdGl2aXR5LmZpbmlzaCgpOworICAgICAgICB9CisgICAgfTsKKworICAgIHByaXZhdGUgYm9vbGVhbiBzaG91bGRTaG93UmVxdWVzdFBlcm1pc3Npb25SYXRpb25hbGUoU3RyaW5nW10gcmVjb3JkUGVybWlzc2lvbnMpIHsKKyAgICAgICAgZm9yIChTdHJpbmcgcGVybWlzc2lvbiA6IHJlY29yZFBlcm1pc3Npb25zKSB7CisgICAgICAgICAgICBpZiAoQWN0aXZpdHlDb21wYXQuc2hvdWxkU2hvd1JlcXVlc3RQZXJtaXNzaW9uUmF0aW9uYWxlKHRoaXMsIHBlcm1pc3Npb24pKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZXF1ZXN0UmVjb3JkUGVybWlzc2lvbnMoKSB7CisgICAgICAgIGlmICghc2hvdWxkU2hvd1JlcXVlc3RQZXJtaXNzaW9uUmF0aW9uYWxlKFJFQ09SRF9QRVJNSVNTSU9OUykpIHsKKyAgICAgICAgICAgIEFjdGl2aXR5Q29tcGF0LnJlcXVlc3RQZXJtaXNzaW9ucyh0aGlzLCBSRUNPUkRfUEVSTUlTU0lPTlMsIFJFUVVFU1RfUkVDT1JEX1BFUk1JU1NJT05TKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uUmVxdWVzdFBlcm1pc3Npb25zUmVzdWx0KGludCByZXF1ZXN0Q29kZSwgU3RyaW5nW10gcGVybWlzc2lvbnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50W10gZ3JhbnRSZXN1bHRzKSB7CisgICAgICAgIGlmIChyZXF1ZXN0Q29kZSA9PSBSRVFVRVNUX1JFQ09SRF9QRVJNSVNTSU9OUykgeworICAgICAgICAgICAgaWYgKGdyYW50UmVzdWx0cy5sZW5ndGggPT0gUkVDT1JEX1BFUk1JU1NJT05TLmxlbmd0aCkgeworICAgICAgICAgICAgICAgIGZvciAoaW50IHJlc3VsdCA6IGdyYW50UmVzdWx0cykgeworICAgICAgICAgICAgICAgICAgICBpZiAocmVzdWx0ICE9IFBhY2thZ2VNYW5hZ2VyLlBFUk1JU1NJT05fR1JBTlRFRCkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiUGVybWlzc2lvbiBpcyBub3QgZ3JhbnRlZCIpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBzdXBlci5vblJlcXVlc3RQZXJtaX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ZXZpZXdTaXplLmdldFdpZHRoKCkpOworICAgICAgICAgICAgY29uZmlndXJlVHJhbnNmb3JtKHdpZHRoLCBoZWlnaHQpOworICAgICAgICAgICAgbU1lZGlhUmVjb3JkZXIgPSBuZXcgTWVkaWFSZWNvcmRlcigpOworICAgICAgICAgICAgbWFuYWdlci5vcGVuQ2FtZXJhKGNhbWVyYUlkLCBtU3RhdGVDYWxsYmFjaywgbnVsbCk7CisgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIHwgQ2FtZXJhQWNjZXNzRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIGUucHJpbnRTdGFja1RyYWNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgY2xvc2VDYW1lcmEoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtQ2FtZXJhT3BlbkNsb3NlTG9jay5hY3F1aXJlKCk7CisgICAgICAgICAgICBjbG9zZVByZXZpZXdTZXNzaW9uKCk7CisgICAgICAgICAgICBpZiAobnVsbCAhPSBtQ2FtZXJhRGV2aWNlKSB7CisgICAgICAgICAgICAgICAgbUNhbWVyYURldmljZS5jbG9zZSgpOworICAgICAgICAgICAgICAgIG1DYW1lcmFEZXZpY2UgPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG51bGwgIT0gbU1lZGlhUmVjb3JkZXIpIHsKKyAgICAgICAgICAgICAgICBtTWVkaWFSZWNvcmRlci5yZWxlYXNlKCk7CisgICAgICAgICAgICAgICAgbU1lZGlhUmVjb3JkZXIgPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiSW50ZXJydXB0ZWQgd2hpbGUgdHJ5aW5nIHRvIGxvY2sgY2FtZXJhIGNsb3NpbmcuIik7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBtQ2FtZXJhT3BlbkNsb3NlTG9jay5yZWxlYXNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBTaXplIGNob29zZVZpZGVvU2l6ZShTaXplW10gY2hvaWNlcykgeworICAgICAgICBmb3IgKFNpemUgc2l6ZSA6IGNob2ljZXMpIHsKKyAgICAgICAgICAgIGlmIChzaXplLmdldFdpZHRoKCkgPT0gc2l6ZS5nZXRIZWlnaHQoKSAqIDE2IC8gOSAmJiBzaXplLmdldFdpZHRoKCkgPD0gMTkyMCkgeworICAgICAgICAgICAgICAgIHJldHVybiBzaXplOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIExvZy5lKFRBRywgIkNvdWxkbid0IGZpbmQgYW55IHN1aXRhYmxlIHZpZGVvIHNpemUiKTsKKyAgICAgICAgcmV0dXJuIGNob2ljZXNbY2hvaWNlcy5sZW5ndGggLSAxXTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBTaXplIGNob29zZU9wdGltYWxTaXplKFNpemVbXSBjaG9pY2VzLCBpbnQgd2lkdGgsIGludCBoZWlnaHQsIFNpemUgYXNwZWN0UmF0aW8pIHsKKyAgICAgICAgTGlzdDxTaXplPiBiaWdFbm91Z2ggPSBuZXcgQXJyYXlMaXN0PD4oKTsKKyAgICAgICAgaW50IHcgPSBhc3BlY3RSYXRpby5nZXRXaWR0aCgpOworICAgICAgICBpbnQgaCA9IGFzcGVjdFJhdGlvLmdldEhlaWdodCgpOworICAgICAgICBmb3IgKFNpemUgb3B0aW9uIDogY2hvaWNlcykgeworICAgICAgICAgICAgaWYgKG9wdGlvbi5nZXRIZWlnaHQoKSA9PSBvcHRpb24uZ2V0V2lkdGgoKSAqIGggLyB3ICYmIG9wdGlvbi5nZXRXaWR0aCgpID49IHdpZHRoICYmCisgICAgICAgICAgICAgICAgICAgIG9wdGlvbi5nZXRIZWlnaHQoKSA+PSBoZWlnaHQpIHsKKyAgICAgICAgICAgICAgICBiaWdFbm91Z2guYWRkKG9wdGlvbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBQaWNrIHRoZSBzbWFsbGVzdCBvZiB0aG9zZSwgYXNzdW1pbmcgd2UgZm91bmQgYW55CisgICAgICAgIGlmIChiaWdFbm91Z2guc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgcmV0dXJuIENvbGxlY3Rpb25zLm1pbihiaWdFbm91Z2gsIG5ldyBDb21wYXJlU2l6ZXNCeUFyZWEoKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJDb3VsZG4ndCBmaW5kIGFueSBzdWl0YWJsZSBwcmV2aWV3IHNpemUiKTsKKyAgICAgICAgICAgIHJldHVybiBjaG9pY2VzWzBdOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBib29sZWFuIGhhc1Blcm1pc3Npb25HcmFudGVkKFN0cmluZ1tdIHJlY29yZFBlcm1pc3Npb25zKSB7CisgICAgICAgIGZvciAoU3RyaW5nIHBlcm1pc3Npb24gOiByZWNvcmRQZXJtaXNzaW9ucykgeworICAgICAgICAgICAgaWYgKEFjdGl2aXR5Q29tcGF0LmNoZWNrU2VsZlBlcm1pc3Npb24oTWFpbkFjdGl2aXR5LnRoaXMsIHBlcm1pc3Npb24pICE9CisgICAgICAgICAgICAgICAgICAgIFBhY2thZ2VNYW5hZ2VyLlBFUk1JU1NJT05fR1JBTlRFRCkgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBvblJlc3VtZSgpIHsKKyAgICAgICAgc3VwZXIub25SZXN1bWUoKTsKKyAgICAgICAgc3RhcnRCYWNrZ3JvdW5kVGhyZWFkKCk7C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BBcnJheUxpc3Q8PigpOworCisgICAgICAgICAgICAvLyBTZXQgdXAgU3VyZmFjZSBmb3IgdGhlIGNhbWVyYSBwcmV2aWV3CisgICAgICAgICAgICBTdXJmYWNlIHByZXZpZXdTdXJmYWNlID0gbmV3IFN1cmZhY2UodGV4dHVyZSk7CisgICAgICAgICAgICBzdXJmYWNlcy5hZGQocHJldmlld1N1cmZhY2UpOworICAgICAgICAgICAgbVByZXZpZXdCdWlsZGVyLmFkZFRhcmdldChwcmV2aWV3U3VyZmFjZSk7CisKKyAgICAgICAgICAgIC8vIFNldCB1cCBTdXJmYWNlIGZvciB0aGUgTWVkaWFSZWNvcmRlcgorICAgICAgICAgICAgU3VyZmFjZSByZWNvcmRlclN1cmZhY2UgPSBtTWVkaWFSZWNvcmRlci5nZXRTdXJmYWNlKCk7CisgICAgICAgICAgICBzdXJmYWNlcy5hZGQocmVjb3JkZXJTdXJmYWNlKTsKKyAgICAgICAgICAgIG1QcmV2aWV3QnVpbGRlci5hZGRUYXJnZXQocmVjb3JkZXJTdXJmYWNlKTsKKworICAgICAgICAgICAgLy9TdGFydCBhIGNhcHR1cmUgc2Vzc2lvbgorICAgICAgICAgICAgbUNhbWVyYURldmljZS5jcmVhdGVDYXB0dXJlU2Vzc2lvbihzdXJmYWNlcywgbmV3IENhbWVyYUNhcHR1cmVTZXNzaW9uLlN0YXRlQ2FsbGJhY2soKSB7CisKKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNvbmZpZ3VyZWQoQ2FtZXJhQ2FwdHVyZVNlc3Npb24gc2Vzc2lvbikgeworICAgICAgICAgICAgICAgICAgICBtUHJldmlld1Nlc3Npb24gPSBzZXNzaW9uOworICAgICAgICAgICAgICAgICAgICB1cGRhdGVQcmV2aWV3KCk7CisgICAgICAgICAgICAgICAgICAgIE1haW5BY3Rpdml0eS50aGlzLnJ1bk9uVWlUaHJlYWQobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUlzUmVjb3JkaW5nID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTWVkaWFSZWNvcmRlci5zdGFydCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGFydEJ1dHRvbi5zZXRUZXh0KFIuc3RyaW5nLnN0b3ApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGFydEJ1dHRvbi5zZXRFbmFibGVkKHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNvbmZpZ3VyZUZhaWxlZChDYW1lcmFDYXB0dXJlU2Vzc2lvbiBzZXNzaW9uKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkZhaWxlZCB0byBjb25maWd1cmUuIENhbm5vdCBzdGFydCBSZWNvcmRpbmciKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9LCBtQmFja2dyb3VuZEhhbmRsZXIpOworICAgICAgICB9IGNhdGNoIChDYW1lcmFBY2Nlc3NFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgZS5wcmludFN0YWNrVHJhY2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzZXRVcE1lZGlhUmVjb3JkZXIoKSB7CisgICAgICAgIGZpbmFsIEFjdGl2aXR5IGFjdGl2aXR5ID0gTWFpbkFjdGl2aXR5LnRoaXM7CisgICAgICAgIGlmIChhY3Rpdml0eSA9PSBudWxsKSB7CisgICAgICAgICAgICBUb2FzdC5tYWtlVGV4dChNYWluQWN0aXZpdHkudGhpcywgIkVycm9yIG9jY3VycmVkIHdoaWxlIHNldHRpbmcgdXAgdGhlIE1lZGlhUmVjb3JkZXIiLAorICAgICAgICAgICAgICAgICAgICBUb2FzdC5MRU5HVEhfU0hPUlQpLnNob3coKTsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIkVycm9yIG9jY3VycmVkIHdoaWxlIHNldHRpbmcgdXAgdGhlIE1lZGlhUmVjb3JkZXIiKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgbU1lZGlhUmVjb3JkZXIuc2V0QXVkaW9Tb3VyY2UoTWVkaWFSZWNvcmRlci5BdWRpb1NvdXJjZS5NSUMpOworICAgICAgICAgICAgbU1lZGlhUmVjb3JkZXIuc2V0VmlkZW9Tb3VyY2UoTWVkaWFSZWNvcmRlci5WaWRlb1NvdXJjZS5TVVJGQUNFKTsKKyAgICAgICAgICAgIG1NZWRpYVJlY29yZGVyLnNldE91dHB1dEZvcm1hdChNZWRpYVJlY29yZGVyLk91dHB1dEZvcm1hdC5NUEVHXzQpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgZS5wcmludFN0YWNrVHJhY2UoKTsKKyAgICAgICAgfQorICAgICAgICBpZiAobU91dHB1dFZpZGVvUGF0aCA9PSBudWxsKSB7CisgICAgICAgICAgICBtT3V0cHV0VmlkZW9QYXRoID0gZ2V0VmlkZW9QYXRoKE1haW5BY3Rpdml0eS50aGlzKTsKKyAgICAgICAgfQorICAgICAgICBtTWVkaWFSZWNvcmRlci5zZXRPdXRwdXRGaWxlKG1PdXRwdXRWaWRlb1BhdGgpOworICAgICAgICBtTWVkaWFSZWNvcmRlci5zZXRWaWRlb0VuY29kaW5nQml0UmF0ZShWSURFT19CSVRSQVRFKTsKKyAgICAgICAgbU1lZGlhUmVjb3JkZXIuc2V0VmlkZW9GcmFtZVJhdGUoVklERU9fRlJBTUVSQVRFKTsKKyAgICAgICAgbU1lZGlhUmVjb3JkZXIuc2V0VmlkZW9TaXplKG1WaWRlb1NpemUuZ2V0V2lkdGgoKSwgbVZpZGVvU2l6ZS5nZXRIZWlnaHQoKSk7CisgICAgICAgIG1NZWRpYVJlY29yZGVyLnNldE9yaWVudGF0aW9uSGludCgyNzApOworICAgICAgICBpZiAobU1pbWUuZXF1YWxzKE1lZGlhRm9ybWF0Lk1JTUVUWVBFX1ZJREVPX0hFVkMpKSB7CisgICAgICAgICAgICBtTWVkaWFSZWNvcmRlci5zZXRWaWRlb0VuY29kZXIoTWVkaWFSZWNvcmRlci5WaWRlb0VuY29kZXIuSEVWQyk7CisgICAgICAgICAgICBpZiAoQnVpbGQuVkVSU0lPTi5TREtfSU5UID49IEJ1aWxkLlZFUlNJT05fQ09ERVMuTykgeworICAgICAgICAgICAgICAgIG1NZWRpYVJlY29yZGVyLnNldFZpZGVvRW5jb2RpbmdQcm9maWxlTGV2ZWwoCisgICAgICAgICAgICAgICAgICAgICAgICBNZWRpYUNvZGVjSW5mby5Db2RlY1Byb2ZpbGVMZXZlbC5IRVZDUHJvZmlsZU1haW4sCisgICAgICAgICAgICAgICAgICAgICAgICBNZWRpYUNvZGVjSW5mby5Db2RlY1Byb2ZpbGVMZXZlbC5IRVZDTWFpblRpZXJMZXZlbDQpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbU1lZGlhUmVjb3JkZXIuc2V0VmlkZW9FbmNvZGVyKE1lZGlhUmVjb3JkZXIuVmlkZW9FbmNvZGVyLkgyNjQpOworICAgICAgICAgICAgaWYgKEJ1aWxkLlZFUlNJT04uU0RLX0lOVCA+PSBCdWlsZC5WRVJTSU9OX0NPREVTLk8pIHsKKyAgICAgICAgICAgICAgICBtTWVkaWFSZWNvcmRlci5zZXRWaWRlb0VuY29kaW5nUHJvZmlsZUxldmVsKAorICAgICAgICAgICAgICAgICAgICAgICAgTWVkaWFDb2RlY0luZm8uQ29kZWNQcm9maWxlTGV2ZWwuQVZDUHJvZmlsZU1haW4sCisgICAgICAgICAgICAgICAgICAgICAgICBNZWRpYUNvZGVjSW5mby5Db2RlY1Byb2ZpbGVMZXZlbC5BVkNMZXZlbDQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIG1NZWRpYVJlY29yZGVyLnNldEF1ZGlvRW5jb2RlcihNZWRpYVJlY29yZGVyLkF1ZGlvRW5jb2Rlci5BQUMpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgbU1lZGlhUmVjb3JkZXIucHJlcGFyZSgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBlLnByaW50U3RhY2tUcmFjZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBTdHJpbmcgZ2V0VmlkZW9QYXRoKEFjdGl2aXR5IGFjdGl2aXR5KSB7CisgICAgICAgIEZpbGUgZGlyID0gYWN0aXZpdHkuZ2V0QXBwbGljYXRpb25Db250ZXh0KCkuZ2V0RXh0ZXJuYWxGaWxlc0RpcihudWxsKTsKKyAgICAgICAgaWYgKGRpciA9PSBudWxsKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJDYW5ub3QgZ2V0IGV4dGVybmFsIGRpcmVjdG9yeSBwYXRoIHRvIHNhdmUgb3V0cHV0IHZpZGVvIik7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBTdHJpbmcgdmlkZW9QYXRoID0gZGlyLmdldEFic29sdXRlUGF0aCgpICsgIi9WaWRlby0iICsgU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgKyAiLm1wNCI7CisgICAgICAgIExvZy5kKFRBRywgIk91dHB1dCB2aWRlbyBpcyBzYXZlZCBhdDogIiArIHZpZGVvUGF0aCk7CisgICAgICAgIHJldHVybiB2aWRlb1BhdGg7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGNsb3NlUHJldmlld1Nlc3Npb24oKSB7CisgICAgICAgIGlmIChtUHJldmlld1Nlc3Npb24gIT0gbnVsbCkgeworICAgICAgICAgICAgbVByZXZpZXdTZXNzaW9uLmNsb3NlKCk7CisgICAgICAgICAgICBtUHJldmlld1Nlc3Npb24gPSBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHN0b3BSZWNvcmRpbmdWaWRlbygpIHsKKyAgICAgICAgbUlzUmVjb3JkaW5nID0gZmFsc2U7CisgICAgICAgIG1TdGFydEJ1dHRvbi5zZXRUZXh0KFIuc3RyaW5nLnN0YXJ0KTsKKyAgICAgICAgbU1lZGlhUmVjb3JkZXIuc3RvcCgpOworICAgICAgICBtTWVkaWFSZWNvcmRlci5yZXNldCgpOworICAgICAgICBUb2FzdC5tYWtlVGV4dChNYWluQWN0aXZpdHkudGhpcywgIlJlY29yZGluZyBGaW5pc2hlZCIsIFRvYXN0LkxFTkdUSF9TSE9SVCkuc2hvdygpOworICAgICAgICBtT3V0cHV0VmlkZW9QYXRoID0gbnVsbDsKKyAgICAgICAgc3RhcnRQcmV2aWV3KCk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHN0YXJ0UHJldmlldygpIHsKKyAgICAgICAgaWYgKG51bGwgPT0gbUNhbWVyYURldmljZSB8fCAhbVRleHR1cmVWaWV3LmlzQXZhaWxhYmxlKCkgfHwgbnVsbCA9PSBtUHJldmlld1NpemUpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgY2xvc2VQcmV2aWV3U2Vzc2lvbigpOworICAgICAgICAgICAgU3VyZmFjZVRleHR1cmUgdGV4dHVyZSA9IG1UZXh0dXJlVmlldy5nZXRTdXJmYWNlVGV4dHVyZSgpOworICAgICAgICAgICAgYXNzZXJ0IHRleHR1cmUgIT0gbnVsbDsKKyAgICAgICAgICAgIHRleHR1cmUuc2V0RGVmYXVsdEJ1ZmZlclNpemUobVByZXZpZXdTaXplLmdldFdpZHRoKCksIG1QcmV2aWV3U2l6ZS5nZXRIZWlnaHQoKSk7CisgICAgICAgICAgICBtUHJldmlld0J1aWxkZXIgPSBtQ2FtZXJhRGV2aWNlLmNyZWF0ZUNhcHR1cmVSZXF1ZXN0KENhbWVyYURldmljZS5URU1QTEFURV9QUkVWSUVXKTsKKworICAgICAgICAgICAgU3VyZmFjZSBwcmV2aWV3U3VyZmFjZSA9IG5ldyBTdXJmYWNlKHRleHR1cmUpOworICAgICAgICAgICAgbVByZXZpZXdCdWlsZGVyLmFkZFRhcmdldChwcmV2aWV3U3VyZmFjZSk7CisKKyAgICAgICAgICAgIG1DYW1lcmFEZXZpY2UuY3JlYXRlQ2FwdHVyZVNlc3Npb24oQ29sbGVjdGlvbnMuc2luZ2xldG9uTGlzdChwcmV2aWV3U3VyZmFjZSksCisgICAgICAgICAgICAgICAgICAgIG5ldyBDYW1lcmFDYXB0dXJlU2Vzc2lvbi5TdGF0ZUNhbGxiYWNrKCkgeworCisgICAgICAgICAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ29uZmlndXJlZChDYW1lcmFDYXB0dXJlU2Vzc2lvbiBzZXNzaW9uKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByZXZpZXdTZXNzaW9uID0gc2Vzc2lvbjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVQcmV2aWV3KCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25Db25maWd1cmVGYWlsZWQoQ2FtZXJhQ2FwdHVyZVNlc3Npb24gc2Vzc2lvbikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRvYXN0Lm1ha2VUZXh0KE1haW5BY3Rpdml0eS50aGlzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNvbmZpZ3VyZSBGYWlsZWQ7IENhbm5vdCBzdGFydCAiICsgInByZXZpZXciLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVG9hc3QuTEVOR1RIX1NIT1JUKS5zaG93KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiQ29uZmlndXJlIGZhaWxlZDsgQ2Fubm90IHN0YXJ0IHByZXZpZXciKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSwgbUJhY2tncm91bmRIYW5kbGVyKTsKKyAgICAgICAgfSBjYXRjaCAoQ2FtZXJhQWNjZXNzRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIGUucHJpbnRTdGFja1RyYWNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgdXBkYXRlUHJldmlldygpIHsKKyAgICAgICAgaWYgKG1DYW1lcmFEZXZpY2UgPT0gbnVsbCkgeworICAgICAgICAgICAgVG9hc3QubWFrZVRleHQoTWFpbkFjdGl2aXR5LnRoaXMsICJDYW1lcmEgbm90IGZvdW5kOyBDYW5ub3QgdXBkYXRlICIgKyAicHJldmlldyIsCisgICAgICAgICAgICAgICAgICAgIFRvYXN0LkxFTkdUSF9TSE9SVCkuc2hvdygpOworICAgICAgICAgICAgTG9nLmUoVEFHLCAiQ2FtZXJhIG5vdCBmb3VuZDsgQ2Fubm90IHVwZGF0ZSBwcmV2aWV3Iik7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG1QcmV2aWV3QnVpbGRlci5zZXQoQ2FwdHVyZVJlcXVlc3QuQ09OVFJPTF9NT0RFLCBDYW1lcmFNZXRhZGF0YS5DT05UUk9MX01PREVfQVVUTyk7CisgICAgICAgICAgICBIY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m5ld0NvbmRpdGlvbigpOworICAgIHByaXZhdGUgZmluYWwgTGlua2VkTGlzdDxQYWlyPEludGVnZXIsIE1lZGlhQ29kZWMuQnVmZmVySW5mbz4+IG1DYklucHV0UXVldWU7CisgICAgcHJpdmF0ZSBmaW5hbCBMaW5rZWRMaXN0PFBhaXI8SW50ZWdlciwgTWVkaWFDb2RlYy5CdWZmZXJJbmZvPj4gbUNiT3V0cHV0UXVldWU7CisgICAgcHJpdmF0ZSB2b2xhdGlsZSBib29sZWFuIG1TaWduYWxsZWRFcnJvcjsKKworICAgIENvZGVjQXN5bmNIYW5kbGVyKCkgeworICAgICAgICBtQ2JJbnB1dFF1ZXVlID0gbmV3IExpbmtlZExpc3Q8PigpOworICAgICAgICBtQ2JPdXRwdXRRdWV1ZSA9IG5ldyBMaW5rZWRMaXN0PD4oKTsKKyAgICAgICAgbVNpZ25hbGxlZEVycm9yID0gZmFsc2U7CisgICAgfQorCisgICAgdm9pZCBjbGVhclF1ZXVlcygpIHsKKyAgICAgICAgbUxvY2subG9jaygpOworICAgICAgICBtQ2JJbnB1dFF1ZXVlLmNsZWFyKCk7CisgICAgICAgIG1DYk91dHB1dFF1ZXVlLmNsZWFyKCk7CisgICAgICAgIG1Mb2NrLnVubG9jaygpOworICAgIH0KKworICAgIHZvaWQgcmVzZXRDb250ZXh0KCkgeworICAgICAgICBjbGVhclF1ZXVlcygpOworICAgICAgICBtU2lnbmFsbGVkRXJyb3IgPSBmYWxzZTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBvbklucHV0QnVmZmVyQXZhaWxhYmxlKE1lZGlhQ29kZWMgY29kZWMsIGludCBidWZmZXJJbmRleCkgeworICAgICAgICBtTG9jay5sb2NrKCk7CisgICAgICAgIG1DYklucHV0UXVldWUuYWRkKG5ldyBQYWlyPD4oYnVmZmVySW5kZXgsIChNZWRpYUNvZGVjLkJ1ZmZlckluZm8pIG51bGwpKTsKKyAgICAgICAgbUNv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soTWVkaWFDb2RlYyBjb2RlYywgYm9vbGVhbiBpc0NvZGVjSW5Bc3luY01vZGUpIHsKKyAgICAgICAgaWYgKGlzQ29kZWNJbkFzeW5jTW9kZSkgeworICAgICAgICAgICAgY29kZWMuc2V0Q2FsbGJhY2sodGhpcyk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBQYWlyPEludGVnZXIsIE1lZGlhQ29kZWMuQnVmZmVySW5mbz4gZ2V0T3V0cHV0KCkgdGhyb3dzIEludGVycnVwdGVkRXhjZXB0aW9uIHsKKyAgICAgICAgUGFpcjxJbnRlZ2VyLCBNZWRpYUNvZGVjLkJ1ZmZlckluZm8+IGVsZW1lbnQgPSBudWxsOworICAgICAgICBtTG9jay5sb2NrKCk7CisgICAgICAgIHdoaWxlICghbVNpZ25hbGxlZEVycm9yKSB7CisgICAgICAgICAgICBpZiAobUNiT3V0cHV0UXVldWUuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgbUNvbmRpdGlvbi5hd2FpdCgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBlbGVtZW50ID0gbUNiT3V0cHV0UXVldWUucmVtb3ZlKDApOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIG1Mb2NrLnVubG9jaygpOworICAgICAgICByZXR1cm4gZWxlbWVudDsKKyAgICB9CisKKyAgICBQYWlyPEludGVnZXIsIE1lZGlhQ29kZWMuQnVmZmVySW5mbz4gZ2V0V29yaygpIHRocm93cyBJbnRlcnJ1cHRlZEV4Y2VwdGlvbiB7CisgICAgICAgIFBhaXI8SW50ZWdlciwgTWVkaWFDb2RlYy5CdWZmZXJJbmZvPiBlbGVtZW50ID0gbnVsbDsKKyAgICAgICAgbUxvY2subG9jaygpOworICAgICAgICB3aGlsZSAoIW1TaWduYWxsZWRFcnJvcikgeworICAgICAgICAgICAgaWYgKG1DYklucHV0UXVldWUuaXNFbXB0eSgpICYmIG1DYk91dHB1dFF1ZXVlLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIG1Db25kaXRpb24uYXdhaXQoKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaWYgKCFtQ2JPdXRwdXRRdWV1ZS5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgZWxlbWVudCA9IG1DYk91dHB1dFF1ZXVlLnJlbW92ZSgwKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmICghbUNiSW5wdXRRdWV1ZS5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgZWxlbWVudCA9IG1DYklucHV0UXVldWUucmVtb3ZlKDApOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbUxvY2sudW5sb2NrKCk7CisgICAgICAgIHJldHVybiBlbGVtZW50OworICAgIH0KKworICAgIGJvb2xlYW4gaGFzU2VlbkVycm9yKCkgeworICAgICAgICByZXR1cm4gbVNpZ25hbGxlZEVycm9yOworICAgIH0KK30KKworYWJzdHJhY3QgcHVibGljIGNsYXNzIE1lZGlhQ29kZWNCYXNlIHsKKyAgICBzdGF0aWMgQXJyYXlMaXN0PFN0cmluZz4gc2VsZWN0Q29kZWNzKFN0cmluZyBtaW1lLCBBcnJheUxpc3Q8TWVkaWFGb3JtYXQ+IGZvcm1hdHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmdbXSBmZWF0dXJlcywgYm9vbGVhbiBpc0VuY29kZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGlzU29mdHdhcmUpIHsKKworICAgICAgICBNZWRpYUNvZGVjTGlzdCBjb2RlY0xpc3QgPSBuZXcgTWVkaWFDb2RlY0xpc3QoTWVkaWFDb2RlY0xpc3QuUkVHVUxBUl9DT0RFQ1MpOworICAgICAgICBNZWRpYUNvZGVjSW5mb1tdIGNvZGVjSW5mb3MgPSBjb2RlY0xpc3QuZ2V0Q29kZWNJbmZvcygpOworICAgICAgICBBcnJheUxpc3Q8U3RyaW5nPiBsaXN0T2ZDb2RlY3MgPSBuZXcgQXJyYXlMaXN0PD4oKTsKKyAgICAgICAgZm9yIChNZWRpYUNvZGVjSW5mbyBjb2RlY0luZm8gOiBjb2RlY0luZm9zKSB7CisgICAgICAgICAgICBpZiAoaXNFbmNvZGVyKSB7CisgICAgICAgICAgICAgICAgaWYgKCFjb2RlY0luZm8uaXNFbmNvZGVyKCkpIGNvbnRpbnVlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAoY29kZWNJbmZvLmlzRW5jb2RlcigpKSBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChCdWlsZC5WRVJTSU9OLlNES19JTlQgPj0gQnVpbGQuVkVSU0lPTl9DT0RFUy5RICYmIGNvZGVjSW5mby5pc0FsaWFzKCkpIGNvbnRpbnVlOworICAgICAgICAgICAgU3RyaW5nW10gdHlwZXMgPSBjb2RlY0luZm8uZ2V0U3VwcG9ydGVkVHlwZXMoKTsKKyAgICAgICAgICAgIGZvciAoU3RyaW5nIHR5cGUgOiB0eXBlcykgeworICAgICAgICAgICAgICAgIGlmICh0eXBlLmVxdWFsc0lnbm9yZUNhc2UobWltZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBpc09rID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgTWVkaWFDb2RlY0luZm8uQ29kZWNDYXBhYmlsaXRpZXMgY29kZWNDYXBhYmlsaXRpZXMgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGVjSW5mby5nZXRDYXBhYmlsaXRpZXNGb3JUeXBlKHR5cGUpOworICAgICAgICAgICAgICAgICAgICBpZiAoZm9ybWF0cyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKE1lZGlhRm9ybWF0IGZvcm1hdCA6IGZvcm1hdHMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWNvZGVjQ2FwYWJpbGl0aWVzLmlzRm9ybWF0U3VwcG9ydGVkKGZvcm1hdCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNPayA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGZlYXR1cmVzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoU3RyaW5nIGZlYXR1cmUgOiBmZWF0dXJlcykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghY29kZWNDYXBhYmlsaXRpZXMuaXNGZWF0dXJlU3VwcG9ydGVkKGZlYXR1cmUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzT2sgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChpc1NvZnR3YXJlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29kZWNJbmZvLmdldE5hbWUoKS5jb250YWlucygic29mdHdhcmUiKSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlY0luZm8uZ2V0TmFtZSgpLmNvbnRhaW5zKCJhbmRyb2lkIikgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZWNJbmZvLmdldE5hbWUoKS5jb250YWlucygiZ29vZ2xlIikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNPaykgbGlzdE9mQ29kZWNzLmFkZChjb2RlY0luZm8uZ2V0TmFtZSgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb2RlY0luZm8uZ2V0TmFtZSgpLmNvbnRhaW5zKCJzb2Z0d2FyZSIpIHx8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGVjSW5mby5nZXROYW1lKCkuY29udGFpbnMoImFuZHJvaWQiKSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlY0luZm8uZ2V0TmFtZSgpLmNvbnRhaW5zKCJnb29nbGUiKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNPaykgbGlzdE9mQ29kZWNzLmFkZChjb2RlY0luZm8uZ2V0TmFtZSgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbGlzdE9mQ29kZWNzOworICAgIH0KK30KZGlmZiAtLWdpdCBhL21lZGlhL3Rlc3RzL1NhbXBsZVZpZGVvRW5jb2Rlci9hcHAvc3JjL21haW4vamF2YS9jb20vYW5kcm9pZC9tZWRpYS9zYW1wbGV2aWRlb2VuY29kZXIvTWVkaWFDb2RlY1N1cmZhY2VFbmNvZGVyLmphdmEgYi9tZWRpYS90ZXN0cy9TYW1wbGVWaWRlb0VuY29kZXIvYXBwL3NyYy9tYWluL2phdmEvY29tL2FuZHJvaW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IFN0cmluZyBtaW1lLCBib29sZWFuIGlzU29mdHdhcmUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgb3V0cHV0UGF0aCkgeworICAgICAgICAvLyBEZWZhdWx0IHZhbHVlIG9mIE1lZGlhRm9ybWF0LktFWV9NQVhfQl9GUkFNRVMgaXMgc2V0IHRvIDEsIGlmIG5vdCBwYXNzZWQgYXMgYSBwYXJhbWV0ZXIuCisgICAgICAgIHRoaXMoY29udGV4dCwgcmVzSWQsIG1pbWUsIGlzU29mdHdhcmUsIG91dHB1dFBhdGgsIDEpOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgc3RhcnRFbmNvZGluZ1N1cmZhY2UoKSB0aHJvd3MgSU9FeGNlcHRpb24sIEludGVycnVwdGVkRXhjZXB0aW9uIHsKKyAgICAgICAgTWVkaWFGb3JtYXQgZGVjb2RlckZvcm1hdCA9IHNldFVwU291cmNlKCk7CisgICAgICAgIGlmIChkZWNvZGVyRm9ybWF0ID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorCisgICAgICAgIFN0cmluZyBkZWNvZGVyTWltZSA9IGRlY29kZXJGb3JtYXQuZ2V0U3RyaW5nKE1lZGlhRm9ybWF0LktFWV9NSU1FKTsKKyAgICAgICAgQXJyYXlMaXN0PFN0cmluZz4gbGlzdE9mRGVvY2RlcnMgPQorICAgICAgICAgICAgICAgIE1lZGlhQ29kZWNCYXNlLnNlbGVjdENvZGVjcyhkZWNvZGVyTWltZSwgbnVsbCwgbnVsbCwgZmFsc2UsIG1Jc0NvZGVjU29mdHdhcmUpOworICAgICAgICBpZiAobGlzdE9mRGVvY2RlcnMuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJObyBzdWl0YWJsZSBkZWNvZGVyIGZvdW5kIGZvciBtaW1lOiAiICsgZGVjb2Rlck1pbWUpOworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB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ICB9CisgICAgICAgICAgICBjb25maWd1cmVDb2RlYyhkZWNvZGVyRm9ybWF0LCBlbmNvZGVyRm9ybWF0KTsKKyAgICAgICAgICAgIG1FbmNvZGVyLnN0YXJ0KCk7CisgICAgICAgICAgICBtRGVjb2Rlci5zdGFydCgpOworICAgICAgICAgICAgZG9Xb3JrKEludGVnZXIuTUFYX1ZBTFVFKTsKKyAgICAgICAgICAgIHF1ZXVlRU9TKCk7CisgICAgICAgICAgICB3YWl0Rm9yQWxsRW5jb2Rlck91dHB1dHMoKTsKKyAgICAgICAgICAgIGlmIChtdXhPdXRwdXQpIHsKKyAgICAgICAgICAgICAgICBpZiAobVRyYWNrSUQgIT0gLTEpIHsKKyAgICAgICAgICAgICAgICAgICAgbU11eGVyLnN0b3AoKTsKKyAgICAgICAgICAgICAgICAgICAgbVRyYWNrSUQgPSAtMTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG1NdXhlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1NdXhlci5yZWxlYXNlKCk7CisgICAgICAgICAgICAgICAgICAgIG1NdXhlciA9IG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgbURlY29kZXIucmVzZXQoKTsKKyAgICAgICAgICAgIG1FbmNvZGVyLnJlc2V0KCk7CisgICAgICAgICAgICBtU3VyZmFjZS5yZWxlYXNlKCk7CisgICAgICAgICAgICBtU3VyZmFjZSA9IG51bGw7CisgICAgICAgICAgICBMb2cuaShUQUcsICJOdW1iZXIgb2YgSS1mcmFtZXMgPSAiICsgbUZyYW1lVHlwZU9jY3VycmVuY2VzW0ZSQU1FX1RZUEVfSV0pOworICAgICAgICAgICAgTG9nLmkoVEFHLCAiTnVtYmVyIG9mIFAtZnJhbWVzID0gIiArIG1GcmFtZVR5cGVPY2N1cnJlbmNlc1tGUkFNRV9UWVBFX1BdKTsKKyAgICAgICAgICAgIExvZy5pKFRBRywgIk51bWJlci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obUVuY29kZXIsIHRydWUpOworICAgICAgICBtRW5jb2Rlci5jb25maWd1cmUoZW5jRm9ybWF0LCBudWxsLCBudWxsLCBNZWRpYUNvZGVjLkNPTkZJR1VSRV9GTEFHX0VOQ09ERSk7CisgICAgICAgIG1TdXJmYWNlID0gbUVuY29kZXIuY3JlYXRlSW5wdXRTdXJmYWNlKCk7CisgICAgICAgIGlmICghbVN1cmZhY2UuaXNWYWxpZCgpKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJTdXJmYWNlIGlzIG5vdCB2YWxpZCIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIG1Bc3luY0hhbmRsZURlY29kZXIuc2V0Q2FsbEJhY2sobURlY29kZXIsIHRydWUpOworICAgICAgICBtRGVjb2Rlci5jb25maWd1cmUoZGVjRm9ybWF0LCBtU3VyZmFjZSwgbnVsbCwgMCk7CisgICAgICAgIExvZy5kKFRBRywgIkNvZGVjIGNvbmZpZ3VyZWQiKTsKKyAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICBMb2cuZChUQUcsICJFbmNvZGVyIE91dHB1dCBmb3JtYXQ6ICIgKyBtRW5jb2Rlci5nZXRPdXRwdXRGb3JtYXQoKSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgZGVxdWV1ZURlY29kZXJPdXRwdXQoaW50IGJ1ZmZlckluZGV4LCBNZWRpYUNvZGVjLkJ1ZmZlckluZm8gaW5mbykgeworICAgICAgICBpZiAoKGluZm8uZmxhZ3MgJiBNZWRpYUNvZGVjLkJVRkZFUl9GTEFHX0VORF9PRl9TVFJFQU0pICE9IDApIHsKKyAgICAgICAgICAgIG1TYXdEZWNPdXRwdXRFT1MgPSB0cnVlOworICAgICAgICB9CisgICAgICAgIGlmIChERUJVRykgeworICAgICAgICAgICAgTG9nLmQoVEFHLAorICAgICAgICAgICAgICAgICAgICAib3V0cHV0OiBpZDogIiArIGJ1ZmZlckluZGV4ICsgIiBmbGFnczogIiArIGluZm8uZmxhZ3MgKyAiIHNpemU6ICIgKyBpbmZvLnNpemUgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICIgdGltZXN0YW1wOiAiICsgaW5mby5wcmVzZW50YXRpb25UaW1lVXMpOworICAgICAgICB9CisgICAgICAgIGlmIChpbmZvLnNpemUgPiAwICYmIChpbmZvLmZsYWdzICYgTWVkaWFDb2RlYy5CVUZGRVJfRkxBR19DT0RFQ19DT05GSUcpID09IDApIHsKKyAgICAgICAgICAgIG1EZWNPdXRwdXRDb3VudCsrOworICAgICAgICB9CisgICAgICAgIG1EZWNvZGVyLnJlbGVhc2VPdXRwdXRCdWZmZXIoYnVmZmVySW5kZXgsIG1TdXJmYWNlICE9IG51bGwpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBlbnF1ZXVlRGVjb2RlcklucHV0KGludCBidWZmZXJJbmRleCkgeworICAgICAgICBCeXRlQnVmZmVyIGlucHV0QnVmZmVyID0gbURlY29kZXIuZ2V0SW5wdXRCdWZmZXIoYnVmZmVySW5kZXgpOworICAgICAgICBpbnQgc2l6ZSA9IG1FeHRyYWN0b3IucmVhZFNhbXBsZURhdGEoaW5wdXRCdWZmZXIsIDApOworICAgICAgICBpZiAoc2l6ZSA8IDApIHsKKyAgICAgICAgICAgIGVucXVldWVEZWNvZGVyRU9TKGJ1ZmZlckluZGV4KTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGxvbmcgcHRzID0gbUV4dHJhY3Rvci5nZXRTYW1wbGVUaW1lKCk7CisgICAgICAgICAgICBpbnQgZXh0cmFjdG9yRmxhZ3MgPSBtRXh0cmFjdG9yLmdldFNhbXBsZUZsYWdzKCk7CisgICAgICAgICAgICBpbnQgY29kZWNGbGFncyA9IDA7CisgICAgICAgICAgICBpZiAoKGV4dHJhY3RvckZsYWdzICYgTWVkaWFFeHRyYWN0b3IuU0FNUExFX0ZMQUdfU1lOQykgIT0gMCkgeworICAgICAgICAgICAgICAgIGNvZGVjRmxhZ3MgfD0gTWVkaWFDb2RlYy5CVUZGRVJfRkxBR19LRVlfRlJBTUU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoKGV4dHJhY3RvckZsYWdzICYgTWVkaWFFeHRyYWN0b3IuU0FNUExFX0ZMQUdfUEFSVElBTF9GUkFNRSkgIT0gMCkgeworICAgICAgICAgICAgICAgIGNvZGVjRmxhZ3MgfD0gTWVkaWFDb2RlYy5CVUZGRVJfRkxBR19QQVJUSUFMX0ZSQU1FOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCFtRXh0cmFjdG9yLmFkdmFuY2UoKSkgeworICAgICAgICAgICAgICAgIGNvZGVjRmxhZ3MgfD0gTWVkaWFDb2RlYy5CVUZGRVJfRkxBR19FTkRfT0ZfU1RSRUFNOworICAgICAgICAgICAgICAgIG1TYXdEZWNJbnB1dEVPUyA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoREVCVUcpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJpbnB1dDogaWQ6ICIgKyBidWZmZXJJbmRleCArICIgc2l6ZTogIiArIHNpemUgKyAiIHB0czogIiArIHB0cyArCisgICAgICAgICAgICAgICAgICAgICAgICAiIGZsYWdzOiAiICsgY29kZWNGbGFncyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtRGVjb2Rlci5xdWV1ZUlucHV0QnVmZmVyKGJ1ZmZlckluZGV4LCAwLCBzaXplLCBwdHMsIGNvZGVjRmxhZ3MpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGRvV29yayhpbnQgZnJhbWVMaW1pdCkgdGhyb3dzIEludGVycnVwdGVkRXhjZXB0aW9uIHsKKyAgICAgICAgaW50IGZyYW1lQ291bnQgPSAwOworICAgICAgICB3aGlsZSAoIWhhc1NlZW5FcnJvcigpICYmICFtU2F3RGVjSW5wdXRFT1MgJiYgZnJhbWVDb3VudCA8IGZyYW1lTGltaXQpIHsKKyAgICAgICAgICAgIFBhaXI8SW50ZWdlciwgTWVkaWFDb2RlYy5CdWZmZXJJbmZvPiBlbGVtZW50ID0gbUFzeW5jSGFuZGxlRGVjb2Rlci5nZXRXb3JrKCk7CisgICAgICAgICAgICBpZiAoZWxlbWVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaW50IGJ1ZmZlcklEID0gZWxlbWVudC5maXJzdDsKKyAgICAgICAgICAgICAgICBNZWRpYUNvZGVjLkJ1ZmZlckluZm8gaW5mbyA9IGVsZW1lbnQuc2Vjb25kOworICAgICAgICAgICAgICAgIGlmIChpbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gPGlkLCBpbmZvPiBjb3JyZXNwb25kcyB0byBvdXRwdXQgY2FsbGJhY2suCisgICAgICAgICAgICAgICAgICAgIGRlcXVldWVEZWNvZGVyT3V0cHV0KGJ1ZmZlcklELCBpbmZvKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvLyA8aWQsIG51bGw+IGNvcnJlc3BvbmRzIHRvIGlucHV0IGNhbGxiYWNrLgorICAgICAgICAgICAgICAgICAgICBlbnF1ZXVlRGVjb2RlcklucHV0KGJ1ZmZlcklEKTsKKyAgICAgICAgICAgICAgICAgICAgZnJhbWVDb3VudCsrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIGNoZWNrIGRlY29kZXIgRU9TCisgICAgICAgICAgICBpZiAobVNhd0RlY091dHB1dEVPUykgbUVuY29kZXIuc2lnbmFsRW5kT2ZJbnB1dFN0cmVhbSgpOworICAgICAgICAgICAgLy8gZW5jb2RlciBvdXRwdXQKKyAgICAgICAgICAgIGlmIChtRGVjT3V0cHV0Q291bnQgLSBtRW5jT3V0cHV0Q291bnQgPiBtTWF4QkZyYW1lcykgeworICAgICAgICAgICAgICAgIHRyeUVuY29kZXJPdXRwdXQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBxdWV1ZUVPUygpIHRocm93cyBJbnRlcnJ1cHRlZEV4Y2VwdGlvbiB7CisgICAgICAgIHdoaWxlICghbUFzeW5jSGFuZGxlRGVjb2Rlci5oYXNTZWVuRXJyb3IoKSAmJiAhbVNhd0RlY0lucHV0RU9TKSB7CisgICAgICAgICAgICBQYWlyPEludGVnZXIsIE1lZGlhQ29kZWMuQnVmZmVySW5mbz4gZWxlbWVudCA9IG1Bc3luY0hhbmRsZURlY29kZXIuZ2V0V29yaygpOworICAgICAgICAgICAgaWYgKGVsZW1lbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGludCBidWZmZXJJRCA9IGVsZW1lbnQuZmlyc3Q7CisgICAgICAgICAgICAgICAgTWVkaWFDb2RlYy5CdWZmZXJJbmZvIGluZm8gPSBlbGVtZW50LnNlY29uZDsKKyAgICAgICAgICAgICAgICBpZiAoaW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGRlcXVldWVEZWNvZGVyT3V0cHV0KGJ1ZmZlcklELCBpbmZvKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBlbnF1ZXVlRGVjb2RlckVPUyhlbGVtZW50LmZpcnN0KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICB3aGlsZSAoIWhhc1NlZW5FcnJvcigpICYmICFtU2F3RGVjT3V0cHV0RU9TKSB7CisgICAgICAgICAgICBQYWlyPEludGVnZXIsIE1lZGlhQ29kZWMuQnVmZmVySW5mbz4gZGVjT3AgPSBtQXN5bmNIYW5kbGVEZWNvZGVyLmdldE91dHB1dCgpOworICAgICAgICAgICAgaWYgKGRlY09wICE9IG51bGwpIGRlcXVldWVEZWNvZGVyT3V0cHV0KGRlY09wLmZpcnN0LCBkZWNPcC5zZWNvbmQpOworICAgICAgICA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2Rlci5xdWV1ZUlucHV0QnVmZmVyKGJ1ZmZlckluZGV4LCAwLCAwLCAwLCBNZWRpYUNvZGVjLkJVRkZFUl9GTEFHX0VORF9PRl9TVFJFQU0pOworICAgICAgICAgICAgbVNhd0RlY0lucHV0RU9TID0gdHJ1ZTsKKyAgICAgICAgICAgIExvZy5kKFRBRywgIlF1ZXVlZCBFbmQgb2YgU3RyZWFtIik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgZGVxdWV1ZUVuY29kZXJPdXRwdXQoaW50IGJ1ZmZlckluZGV4LCBNZWRpYUNvZGVjLkJ1ZmZlckluZm8gaW5mbykgeworICAgICAgICBpZiAoREVCVUcpIHsKKyAgICAgICAgICAgIExvZy5kKFRBRywgImVuY29kZXIgb3V0cHV0OiBpZDogIiArIGJ1ZmZlckluZGV4ICsgIiBmbGFnczogIiArIGluZm8uZmxhZ3MgKyAiIHNpemU6ICIgKworICAgICAgICAgICAgICAgICAgICBpbmZvLnNpemUgKyAiIHRpbWVzdGFtcDogIiArIGluZm8ucHJlc2VudGF0aW9uVGltZVVzKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoKGluZm8uZmxhZ3MgJiBNZWRpYUNvZGVjLkJVRkZFUl9GTEFHX0VORF9PRl9TVFJFQU0pICE9IDApIHsKKyAgICAgICAgICAgIG1TYXdFbmNPdXRwdXRFT1MgPSB0cnVlOworICAgICAgICB9CisgICAgICAgIGlmIChpbmZvLnNpemUgPiAwKSB7CisgICAgICAgICAgICBCeXRlQnVmZmVyIGJ1ZiA9IG1FbmNvZGVyLmdldE91dHB1dEJ1ZmZlcihidWZmZXJJbmRleCk7CisgICAgICAgICAgICAvLyBQYXJzZSB0aGUgYnVmZmVyIHRvIGdldCB0aGUgZnJhbWUgdHlwZQorICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJbIEZyYW1lIDogIiArIChtRnJhbWVOdW0rKykgKyAiIF0iKTsKKyAgICAgICAgICAgIGludCBmcmFtZVR5cGVSZXN1bHQgPSAtMTsKKyAgICAgICAgICAgIGlmIChtTWltZSA9PSBNZWRpYUZvcm1hdC5NSU1FVFlQRV9WSURFT19BVkMpIHsKKyAgICAgICAgICAgICAgICBmcmFtZVR5cGVSZXN1bHQgPSBOYWxVbml0VXRpbC5nZXRTdGFuZGFyZGl6ZWRGcmFtZVR5cGVzRnJvbUFWQyhidWYpOworICAgICAgICAgICAgfSBlbHNlIGlmIChtTWltZSA9PSBNZWRpYUZvcm1hdC5NSU1FVFlQRV9WSURFT19IRVZDKXsKKyAgICAgICAgICAgICAgICBmcmFtZVR5cGVSZXN1bHQgPSBOYWxVbml0VXRpbC5nZXRTdGFuZGFyZGl6ZWRGcmFtZVR5cGVzRnJvbUhFVkMoYnVmKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiTWltZSB0eXBlICIgKyBtTWltZSArICIgaXMgbm90IHN1cHBvcnRlZC4iKTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZnJhbWVUeXBlUmVzdWx0ICE9IC0xKSB7CisgICAgICAgICAgICAgICAgbUZyYW1lVHlwZU9jY3VycmVuY2VzW2ZyYW1lVHlwZVJlc3VsdF0rKzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG1NdXhlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKG1UcmFja0lEID09IC0xKSB7CisgICAgICAgICAgICAgICAgICAgIG1UcmFja0lEID0gbU11eGVyLmFkZFRyYWNrKG1FbmNvZGVyLmdldE91dHB1dEZvcm1hdCgpKTsKKyAgICAgICAgICAgICAgICAgICAgbU11eGVyLnN0YXJ0KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1NdXhlci53cml0ZVNhbXBsZURhdGEobVRyYWNrSUQsIGJ1ZiwgaW5mbyk7CisgICAgICAgICAgIC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ZzZXQgPSA0OworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBzdGFydE9mZnNldDsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgZ2V0QVZDTmFsVW5pdFR5cGUoYnl0ZVtdIGRhdGFBcnJheSwgaW50IG5hbFVuaXRPZmZzZXQpIHsKKyAgICAgICAgcmV0dXJuIGRhdGFBcnJheVtuYWxVbml0T2Zmc2V0XSAmIDB4MUY7CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IHBhcnNlQVZDTkFMVW5pdERhdGEoYnl0ZVtdIGRhdGFBcnJheSwgaW50IG9mZnNldCwgaW50IGxpbWl0KSB7CisgICAgICAgIFBhcnNhYmxlQml0QXJyYXkgYml0QXJyYXkgPSBuZXcgUGFyc2FibGVCaXRBcnJheShkYXRhQXJyYXkpOworICAgICAgICBiaXRBcnJheS5yZXNldChkYXRhQXJyYXksIG9mZnNldCwgbGltaXQpOworCisgICAgICAgIGJpdEFycmF5LnNraXBCaXQoKTsgLy8gZm9yYmlkZGVuX3plcm9fYml0CisgICAgICAgIGJpdEFycmF5LnJlYWRCaXRzKDIpOyAvLyBuYWxfcmVmX2lkYworICAgICAgICBiaXRBcnJheS5za2lwQml0cyg1KTsgLy8gbmFsX3VuaXRfdHlwZQorCisgICAgICAgIGJpdEFycmF5LnJlYWRVRVYoKTsgLy8gZmlyc3RfbWJfaW5fc2xpY2UKKyAgICAgICAgaWYgKCFiaXRBcnJheS5jYW5SZWFkVUVWKCkpIHsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorICAgICAgICBpbnQgc2xpY2VUeXBlID0gYml0QXJyYXkucmVhZFVFVigpOworICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgInNsaWNlX3R5cGUgPSAiICsgc2xpY2VUeXBlKTsKKyAgICAgICAgaWYgKHNsaWNlVHlwZSA9PSAwKSB7CisgICAgICAgICAgICByZXR1cm4gRlJBTUVfVFlQRV9QOworICAgICAgICB9IGVsc2UgaWYgKHNsaWNlVHlwZSA9PSAxKSB7CisgICAgICAgICAgICByZXR1cm4gRlJBTUVfVFlQRV9COworICAgICAgICB9IGVsc2UgaWYgKHNsaWNlVHlwZSA9PSAyKSB7CisgICAgICAgICAgICByZXR1cm4gRlJBTUVfVFlQRV9JOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IGdldEhFVkNOYWxVbml0VHlwZShieXRlW10gZGF0YUFycmF5LCBpbnQgbmFsVW5pdE9mZnNldCkgeworICAgICAgICByZXR1cm4gKGRhdGFBcnJheVtuYWxVbml0T2Zmc2V0XSAmIDB4N0UpID4+IDE7CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IHBhcnNlSEVWQ05BTFVuaXREYXRhKGJ5dGVbXSBkYXRhQXJyYXksIGludCBvZmZzZXQsIGludCBsaW1pdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IG5hbFVuaXRUeXBlKSB7CisgICAgICAgIC8vIG5hbF91bml0X3R5cGUgdmFsdWVzIGZyb20gSC4yNjUvSEVWQyBUYWJsZSA3LTEuCisgICAgICAgIGZpbmFsIGludCBCTEFfV19MUCA9IDE2OworICAgICAgICBmaW5hbCBpbnQgUlNWX0lSQVBfVkNMMjMgPSAyMzsKKworICAgICAgICBQYXJzYWJsZUJpdEFycmF5IGJpdEFycmF5ID0gbmV3IFBhcnNhYmxlQml0QXJyYXkoZGF0YUFycmF5KTsKKyAgICAgICAgYml0QXJyYXkucmVzZXQoZGF0YUFycmF5LCBvZmZzZXQsIGxpbWl0KTsKKworICAgICAgICBiaXRBcnJheS5za2lwQml0KCk7IC8vIGZvcmJpZGRlbiB6ZXJvIGJpdAorICAgICAgICBiaXRBcnJheS5yZWFkQml0cyg2KTsgLy8gbmFsX3Vu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ICAgICByZXR1cm4gRlJBTUVfVFlQRV9QOworICAgICAgICB9IGVsc2UgaWYgKHNsaWNlVHlwZSA9PSAyKSB7CisgICAgICAgICAgICByZXR1cm4gRlJBTUVfVFlQRV9JOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBpbnQgZ2V0U3RhbmRhcmRpemVkRnJhbWVUeXBlc0Zyb21BVkMoQnl0ZUJ1ZmZlciBidWYpIHsKKyAgICAgICAgaW50IGxpbWl0ID0gYnVmLmxpbWl0KCk7CisgICAgICAgIGJ5dGVbXSBkYXRhQXJyYXkgPSBuZXcgYnl0ZVtidWYucmVtYWluaW5nKCldOworICAgICAgICBidWYuZ2V0KGRhdGFBcnJheSk7CisgICAgICAgIGludCBmcmFtZVR5cGUgPSAtMTsKKyAgICAgICAgZm9yIChpbnQgcG9zID0gMDsgcG9zICsgMyA8IGxpbWl0OyApIHsKKyAgICAgICAgICAgIGludCBzdGFydE9mZnNldCA9IE5hbFVuaXRVdGlsLmZpbmROYWxVbml0KGRhdGFBcnJheSwgcG9zLCBsaW1pdCk7CisgICAgICAgICAgICBpZiAoc3RhcnRPZmZzZXQgIT0gMCkgeworICAgICAgICAgICAgICAgIGludCBuYWxVbml0VHlwZSA9IGdldEFWQ05hbFVuaXRUeXBlKGRhdGFBcnJheSwgKHBvcyArIHN0YXJ0T2Zmc2V0KSk7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIk5hbFVuaXRPZmZzZXQgPSAiICsgKHBvcyArIHN0YXJ0T2Zmc2V0KSk7CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIk5hbFVuaXRUeXBlID0gIiArIG5hbFVuaXRUeXBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgLy8gU0xJQ0VfTkFMID0gMTsgSURSX1NMSUNFX05BTCA9IDUKKyAgICAgICAgICAgICAgICBpZiAobmFsVW5pdFR5cGUgPT0gMSB8fCBuYWxVbml0VHlwZSA9PSA1KSB7CisgICAgICAgICAgICAgICAgICAgIGZyYW1lVHlwZSA9IHBhcnNlQVZDTkFMVW5pdERhdGEoZGF0YUFycmF5LCAocG9zICsgc3RhcnRPZmZzZXQpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChsaW1pdCAtIHBvcyAtIHN0YXJ0T2Zmc2V0KSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBwb3MgKz0gMzsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcG9zKys7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZyYW1lVHlwZTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIGludCBnZXRTdGFuZGFyZGl6ZWRGcmFtZVR5cGVzRnJvbUhFVkMoQnl0ZUJ1ZmZlciBidWYpIHsKKyAgICAgICAgaW50IGxpbWl0ID0gYnVmLmxpbWl0KCk7CisgICAgICAgIGJ5dGVbXSBkYXRhQXJyYXkgPSBuZXcgYnl0ZVtidWYucmVtYWluaW5nKCldOworICAgICAgICBidWYuZ2V0KGRhdGFBcnJheSk7CisgICAgICAgIGludCBmcmFtZVR5cGUgPSAtMTsKKyAgICAgICAgZm9yIChpbnQgcG9zID0gMDsgcG9zICsgMyA8IGxpbWl0OyApIHsKKyAgICAgICAgICAgIGludCBzdGFydE9mZnNldCA9IE5hbFVuaXRVdGlsLmZpbmROYWxVbml0KGRhdGFBcnJheSwgcG9zLCBsaW1pdCk7CisgICAgICAgICAgICBpZiAoc3RhcnRPZmZzZXQgIT0gMCkgeworICAgICAgICAgICAgICAgIGludCBuYWxVbml0VHlwZSA9IE5hbFVuaXRVdGlsLmdldEhFVkNOYWxVbml0VHlwZShkYXRhQXJyYXksIChwb3MgKyBzdGFydE9mZnNldCkpOworICAgICAgICAgICAgICAgIGlmIChERUJVRykgeworICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJOYWxVbml0T2Zmc2V0ID0gIiArIChwb3MgKyBzdGFydE9mZnNldCkpOworICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJOYWxVbml0VHlwZSA9ICIgKyBuYWxVbml0VHlwZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8vIFBhcnNlIE5BTFVuaXRzIGNvbnRhaW5pbmcgc2xpY2VfaGVhZGVycyB3aGljaCBsaWVzIGluIHRoZSByYW5nZSBvZiAwIHRvIDIxCisgICAgICAgICAgICAgICAgaWYgKG5hbFVuaXRUeXBlID49IDAgJiYgbmFsVW5pdFR5cGUgPD0gMjEpIHsKKyAgICAgICAgICAgICAgICAgICAgZnJhbWVUeXBlID0gcGFyc2VIRVZDTkFMVW5pdERhdGEoZGF0YUFycmF5LCAocG9zICsgc3RhcnRPZmZzZXQpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChsaW1pdCAtIHBvcyAtIHN0YXJ0T2Zmc2V0KSwgbmFsVW5pdFR5cGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcG9zICs9IDM7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHBvcysrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBmcmFtZVR5cGU7CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvbWVkaWEvdGVzdHMvU2FtcGxlVmlkZW9FbmNvZGVyL2FwcC9zcmMvbWFpbi9qYXZhL2NvbS9hbmRyb2lkL21lZGlhL3NhbXBsZXZpZGVvZW5jb2Rlci9QYXJzYWJsZUJpdEFycmF5LmphdmEgYi9tZWRpYS90ZXN0cy9TYW1wbGVWaWRlb0VuY29kZXIvYXBwL3NyYy9tYWluL2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YW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCisgKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KKyAqLworCitwYWNrYWdlIGNvbS5hbmRyb2lkLm1lZGlhLnNhbXBsZXZpZGVvZW5jb2RlcjsKKworcHVibGljIGNsYXNzIFBhcnNhYmxlQml0QXJyYXkgeworICAgIHB1YmxpYyBieXRlW10gZGF0YTsKKyAgICBwcml2YXRlIGludCBieXRlT2Zmc2V0OworICAgIHByaXZhdGUgaW50IGJpdE9mZnNldDsKKyAgICBwcml2YXRlIGludCBieXRlTGltaXQ7CisKKyAgICBwdWJsaWMgUGFyc2FibGVCaXRBcnJheShieXRlW10gZGF0YUFycmF5KSB7CisgICAgICAgIHRoaXMoZGF0YUFycmF5LCBkYXRhQXJyYXkubGVuZ3RoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgUGFyc2FibGVCaXRBcnJheShieXRlW10gZGF0YUFycmF5LCBpbnQgbGltaXQpIHsKKyAgICAgICAgdGhpcy5kYXRhID0gZGF0YUFycmF5OworICAgICAgICBieXRlTGltaXQgPSBsaW1pdDsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCByZXNldChieXRlW10gZGF0YSwgaW50IG9mZnNldCwgaW50IGxpbWl0KSB7CisgICAgICAgIHRoaXMuZGF0YSA9IGRhdGE7CisgICAgICAgIGJ5dGVPZmZzZXQgPSBvZmZzZXQ7CisgICAgICAgIGJpdE9mZnNldCA9IDA7CisgICAgICAgIGJ5dGVMaW1pdCA9IGxpbWl0OworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNraXBCaXQoKSB7CisgICAgICAgIGlmICgrK2JpdE9mZnNldCA9PSA4KSB7CisgICAgICAgICAgICBiaXRPZmZzZXQgPSAwOworICAgICAgICAgICAgYnl0ZU9mZnNldCsrOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2tpcEJpdHMoaW50IG51bUJpdHMpIHsKKyAgICAgICAgaW50IG51bUJ5dGVzID0gbnVtQml0cyAvIDg7CisgICAgICAgIGJ5dGVPZmZzZXQgKz0gbnVtQnl0ZXM7CisgICAgICAgIGJpdE9mZnNldCArPSBudW1CaXRzIC0gKG51bUJ5dGVzICogOCk7CisgICAgICAgIGlmIChiaXRPZmZzZXQgPiA3KSB7CisgICAgICAgICAgICBieXRlT2Zmc2V0Kys7CisgICAgICAgICAgICBiaXRPZmZzZXQgLT0gODsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIHJlYWRCaXQoKSB7CisgICAgICAgIGJvb2xlYW4gcmV0dXJuVmFsdWUgPSAoZGF0YVtieXRlT2Zmc2V0XSAmICgweDgwID4+IGJpdE9mZnNldCkpICE9IDA7CisgICAgICAgIHNraXBCaXQoKTsKKyAgICAgICAgcmV0dXJuIHJldHVyblZhbHVlOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgcmVhZEJpdHMoaW50IG51bUJpdHMpIHsKKyAgICAgICAgaWYgKG51bUJpdHMgPT0gMCkgeworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKyAgICAgICAgaW50IHJldHVyblZhbHVlID0gMDsKKyAgICAgICAgYml0T2Zmc2V0ICs9IG51bUJpdHM7CisgICAgICAgIHdoaWxlIChiaXRPZmZzZXQgPiA4KSB7CisgICAgICAgICAgICBiaXRPZmZzZXQgLT0gODsKKyAgICAgICAgICAgIHJldHVyblZhbHVlIHw9IChkYXRhW2J5dGVPZmZzZXQrK10gJiAweEZGKSA8PCBiaXRPZmZzZXQ7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuVmFsdWUgfD0gKGRhdGFbYnl0ZU9mZnNldF0gJiAweEZGKSA+PiAoOCAtIGJpdE9mZnNldCk7CisgICAgICAgIHJldHVyblZhbHVlICY9IDB4RkZGRkZGRkYgPj4+ICgzMiAtIG51bUJpdHMpOworICAgICAgICBpZiAoYml0T2Zmc2V0ID09IDgpIHsKKyAgICAgICAgICAgIGJpdE9mZnNldCA9IDA7CisgICAgICAgICAgICBieXRlT2Zmc2V0Kys7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJldHVyblZhbHVlOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGNhblJlYWRVRVYoKSB7CisgICAgICAgIGludCBpbml0aWFsQnl0ZU9mZnNldCA9IGJ5dGVPZmZzZXQ7CisgICAgICAgIGludCBpbml0aWFsQml0T2Zmc2V0ID0gYml0T2Zmc2V0OworICAgICAgICBpbnQgbGVhZGluZ1plcm9zID0gMDsKKyAgICAgICAgd2hpbGUgKGJ5dGVPZmZzZXQgPCBieXRlTGltaXQgJiYgIXJlYWRCaXQoKSkgeworICAgICAgICAgICAgbGVhZGluZ1plcm9zKys7CisgICAgICAgIH0KKyAgICAgICAgYm9vbGVhbiBoaXRMaW1pdCA9IGJ5dGVPZmZzZXQgPT0gYnl0ZUxpbWl0OworICAgICAgICBieXRlT2Zmc2V0ID0gaW5pdGlhbEJ5dGVPZmZzZXQ7CisgICAgICAgIGJpdE9mZnNldCA9IGluaXRpYWxCaXRPZmZzZXQ7CisgICAgICAgIHJldHVybiAhaGl0TGltaXQgJiYgY2FuUmVhZEJpdHMobGVhZGluZ1plcm9zICogMiArIDEpOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgcmVhZFVFVigpIHsKKyAgICAgICAgaW50IGxlYWRpbmdaZXJvcyA9IDA7CisgICAgICAgIHdoaWxlICghcmVhZEJpdCgpKSB7CisgICAgICAgICAgICBsZWFkaW5nWmVyb3MrKzsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gKDEgPDwgbGVhZGluZ1plcm9zKSAtIDEgKyAobGVhZGluZ1plcm9zID4gMCA/IHJlYWRCaXRzKGxlYWRpbmdaZXJvcykgOiAwKTsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBjYW5SZWFkQml0cyhpbnQgbnVtQml0cykgeworICAgICAgICBpbnQgb2xkQnl0ZU9mZn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kOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dlaWdodD0iMSIKKyAgICAgICAgICAgIGFuZHJvaWQ6Y2hlY2tlZD0idHJ1ZSIKKyAgICAgICAgICAgIGFuZHJvaWQ6dGV4dD0iQHN0cmluZy9hdmMiIC8+CisKKyAgICAgICAgPFJhZGlvQnV0dG9uCisgICAgICAgICAgICBhbmRyb2lkOmlkPSJAK2lkL2hldmMiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOnRleHQ9IkBzdHJpbmcvaGV2YyIgLz4KKyAgICA8L1JhZGlvR3JvdXA+CisKKyAgICA8UmFkaW9Hcm91cAorICAgICAgICBhbmRyb2lkOmlkPSJAK2lkL3JhZGlvX2dyb3VwX2NvZGVjIgorICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luVG9wPSIxMGRwIgorICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5FbmQ9IjQwZHAiCisgICAgICAgIGFuZHJvaWQ6b3JpZW50YXRpb249InZlcnRpY2FsIgorICAgICAgICBhcHA6bGF5b3V0X2NvbnN0cmFpbnRFbmRfdG9FbmRPZj0icGFyZW50IgorICAgICAgICBhcHA6bGF5b3V0X2NvbnN0cmFpbnRUb3BfdG9Cb3R0b21PZj0iQCtpZC9jaGVja0JveF9tZWRpYV9jb2RlYyI+CisKKyAgICAgICAgPFJhZGlvQnV0dG9uCisgICAgICAgICAgICBhbmRyb2lkOmlkPSJAK2lkL2h3IgorICAgICAgICAgICAgYW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SwKKyAgICAgICAgICAgICAgICB7REVDT0RFX0FVRElPX1VOUEFDS0VELCBNZWRpYUZvcm1hdC5NSU1FVFlQRV9BVURJT19BTVJfV0IsCisgICAgICAgICAgICAgICAgICAgICAgICBFTkNPREVfREVGQVVMVF9BVURJT19CSVRfUkFURSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAxNjAwMCwgMX0sCisgICAgICAgICAgICAgICAge0RFQ09ERV9BVURJT19VTlBBQ0tFRCwgTWVkaWFGb3JtYXQuTUlNRVRZUEVfQVVESU9fRkxBQywKKyAgICAgICAgICAgICAgICAgICAgICAgIEVOQ09ERV9ERUZBVUxUX0FVRElPX0JJVF9SQVRFLCAtMSwgLTEsIC0xLCAtMSwgLTEsIDQ0MTAwLCAyfSwKKyAgICAgICAgICAgICAgICB7REVDT0RFX0FVRElPX1VOUEFDS0VELCBNZWRpYUZvcm1hdC5NSU1FVFlQRV9BVURJT19PUFVTLAorICAgICAgICAgICAgICAgICAgICAgICAgRU5DT0RFX0RFRkFVTFRfQVVESU9fQklUX1JBVEUsIC0xLCAtMSwgLTEsIC0xLCAtMSwgNDgwMDAsIDJ9LAorCiAgICAgICAgICAgICAgICAgLy8gVmlkZW8gVGVzdAotICAgICAgICAgICAgICAgIHsiY3Jvd2RfMTkyMHgxMDgwXzI1ZnBzXzQwMDBrYnBzX3ZwOC53ZWJtIn0sCi0gICAgICAgICAgICAgICAgeyJjcm93ZF8xOTIweDEwODBfMjVmcHNfNjcwMGticHNfaDI2NC50cyJ9LAotICAgICAgICAgICAgICAgIHsiY3Jvd2RfMTkyMHgxMDgwXzI1ZnBzXzQwMDBrYnBzX2gyNjUubWt2In0sCi0gICAgICAgICAgICAgICAgeyJjcm93ZF8xOTIweDEwODBfMjVmcHNfNDAwMGticHNfdnA5LndlYm0ifSwKLSAgICAgICAgICAgICAgICB7ImNyb3dkXzE3NngxNDRfMjVmcHNfNjAwMGticHNfbXBlZzQubXA0In0sCi0gICAgICAgICAgICAgICAgeyJjcm93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EsIC0xLCAtMX0sCisgICAgICAgICAgICAgICAge0RFQ09ERV9RQ0lGX1VOUEFDS0VELCBNZWRpYUZvcm1hdC5NSU1FVFlQRV9WSURFT19NUEVHNCwgRU5DT0RFX01JTl9WSURFT19CSVRfUkFURSwKKyAgICAgICAgICAgICAgICAgICAgICAgIDE3NiwgMTQ0LCAxLCAtMSwgLTEsIC0xLCAtMX0sCisgICAgICAgICAgICAgICAge0RFQ09ERV9RQ0lGX1VOUEFDS0VELCBNZWRpYUZvcm1hdC5NSU1FVFlQRV9WSURFT19IMjYzLCBFTkNPREVfTUlOX1ZJREVPX0JJVF9SQVRFLAorICAgICAgICAgICAgICAgICAgICAgICAgMTc2LCAxNDQsIDEsIC0xLCAtMSwgLTEsIC0xfX0pOwogICAgIH0KIAotICAgIHB1YmxpYyBFbmNvZGVyVGVzdChTdHJpbmcgaW5wdXRGaWxlTmFtZSkgewotICAgICAgICB0aGlzLm1JbnB1dEZpbGUgPSBpbnB1dEZpbGVOYW1lOworICAgIHB1YmxpYyBFbmNvZGVyVGVzdChTdHJpbmcgZmlsZW5hbWUsIFN0cmluZyBtaW1lLCBpbnQgYml0cmF0ZSwgaW50IHdpZHRoLCBpbnQgaGVpZ2h0LAorICAgICAgICAgICAgICAgICAgICAgICBpbnQgZnJhbWVJbnRlcnZhbCwgaW50IHByb2ZpbGUsIGludCBsZXZlbCwgaW50IHNhbXBsZXJhdGUsCisgICAgICAgICAgICAgICAgICAgICAgIGludCBjaGFubmVsQ291bnQpIHsKKyAgICAgICAgdGhpcy5tSW5wdXRGaWxlID0gZmlsZW5hbWU7CisgICAgICAgIHRoaXMubU1pbWUgPSBtaW1lOworICAgICAgICB0aGlzLm1CaXRSYXRlID0gYml0cmF0ZTsKKyAgICAgICAgdGhpcy5tSUZyYW1lSW50ZXJ2YWwgPSBmcmFtZUludGVydmFsOworICAgICAgICB0aGlzLm1XaWR0aCA9IHdpZHRoOworICAgICAgICB0aGlzLm1IZWlnaHQgPSBoZWlnaHQ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lY29kZXIgPSBuZXcgRGVjb2RlcigpOwogICAgICAgICAgICAgZGVjb2Rlci5zZXR1cERlY29kZXIoZGVjb2RlT3V0cHV0U3RyZWFtKTsKICAgICAgICAgICAgIHN0YXR1cyA9IGRlY29kZXIuZGVjb2RlKGlucHV0QnVmZmVyLCBmcmFtZUluZm8sIGZhbHNlLCBmb3JtYXQsICIiKTsKLSAgICAgICAgICAgIGFzc2VydEVxdWFscygiRGVjb2RlciByZXR1cm5lZCBlcnJvciAiICsgc3RhdHVzICsgIiBmb3IgZmlsZTogIiArIG1JbnB1dEZpbGUsIDAsCi0gICAgICAgICAgICAgICAgICAgIHN0YXR1cyk7CiAgICAgICAgICAgICBNZWRpYUZvcm1hdCBkZWNvZGVyRm9ybWF0ID0gZGVjb2Rlci5nZXRGb3JtYXQoKTsKKyAgICAgICAgICAgIGlmIChkZWNvZGVyRm9ybWF0LmNvbnRhaW5zS2V5KE1lZGlhRm9ybWF0LktFWV9DT0xPUl9GT1JNQVQpKSB7CisgICAgICAgICAgICAgICAgbUNvbG9yRm9ybWF0ID0gZGVjb2RlckZvcm1hdC5nZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9DT0xPUl9GT1JNQVQpOworICAgICAgICAgICAgfQogICAgICAgICAgICAgZGVjb2Rlci5kZUluaXRDb2RlYygpOwogICAgICAgICAgICAgZXh0cmFjdG9yLnVuc2VsZWN0RXh0cmFjdG9yVHJhY2soY3VycmVudFRyYWNrKTsKICAgICAgICAgICAgIGlucHV0QnVmZmVyLmNsZWFyKCk7CiAgICAgICAgICAgICBmcmFtZUluZm8uY2xlYXIoKTsKLSAgICAgICAgICAgIGlmIChkZWNvZGVPdXRwdXRTdHJlYW0gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGRlY29kZU91dHB1dFN0cmVhbS5jbG9zZSgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgU3RyaW5nIG1pbWUgPSBmb3JtYXQuZ2V0U3RyaW5nKE1lZGlhRm9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AgICAgICAgICAgICAgICAgICAgICAgICBvdXRFbmNvZGVGaWxlLmRlbGV0ZSgpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGFzc2VydFRydWUoIlVuYWJsZSB0byBjcmVhdGUgZmlsZSB0byB3cml0ZSBlbmNvZGVyIG91dHB1dDogIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dEVuY29kZUZpbGUudG9TdHJpbmcoKSwgb3V0RW5jb2RlRmlsZS5jcmVhdGVOZXdGaWxlKCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RlT3V0cHV0U3RyZWFtID0gbmV3IEZpbGVPdXRwdXRTdHJlYW0ob3V0RW5jb2RlRmlsZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgRmlsZSByYXdGaWxlID0gbmV3IEZpbGUobUNvbnRleHQuZ2V0RmlsZXNEaXIoKSArICIvZGVjb2Rlcl8iICsgdGlkICsgIi5vdXQiKTsKLSAgICAgICAgICAgICAgICAgICAgYXNzZXJ0VHJ1ZSgiQ2Fubm90IG9wZW4gZmlsZSB0byB3cml0ZSBkZWNvZGVkIG91dHB1dCIsIHJhd0ZpbGUuZXhpc3RzKCkpOwotICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5pKFRBRywgIlBhdGggb2YgZGVjb2RlZCBpbnB1dCBmaWxlOiAiICsgcmF3RmlsZS50b1N0cmluZygpKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBGaWxlSW5wdXRTdHJlYW0gZWxlU3RyZWFtID0gbmV3IEZpbGVJbnB1dFN0cmVhbShyYXdGaWxlKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1pbWUuc3RhcnRzV2l0aCgidmlkZW8vIikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoID0gZm9ybWF0LmdldEludGVnZXIoTWVkaWFGb3JtYXQuS0VZX1dJRFRIKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodCA9IGZvcm1hdC5nZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9IRUlHSFQpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZvcm1hdC5jb250YWluc0tleShNZWRpYUZvcm1hdC5LRVlfRlJBTUVfUkFURSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcmFtZVJhdGUgPSBmb3JtYXQuZ2V0SW50ZWdlcihNZWRpYUZvcm1hdC5LRVlfRlJBTUVfUkFURSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGZyYW1lUmF0ZSA8PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWVSYXRlID0gRU5DT0RFX0RFRkFVTFRfRlJBTUVfUkFURTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmb3JtYXQuY29udGFpbnNLZXkoTWVkaWFGb3JtYXQuS0VZX0JJVF9SQVRFKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdFJhdGUgPSBmb3JtYXQuZ2V0SW50ZWdlcihNZWRpYUZvcm1hdC5LRVlfQklUX1JBVEUpOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChiaXRSYXRlIDw9IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobWltZS5jb250YWlucygidmlkZW8vM2dwcCIpIHx8IG1pbWUuY29udGFpbnMoInZpZGVvL21wNHYtZXMiKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRSYXRlID0gRU5DT0RFX01JTl9CSVRfUkFURTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRSYXRlID0gRU5DT0RFX0RFRkFVTFRfQklUX1JBVEU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZvcm1hdC5jb250YWluc0tleShNZWRpYUZvcm1hdC5LRVlfUFJPRklMRSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9maWxlID0gZm9ybWF0LmdldEludGVnZXIoTWVkaWFGb3JtYXQuS0VZX1BST0ZJTEUpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZvcm1hdC5jb250YWluc0tleShNZWRpYUZvcm1hdC5LRVlfUFJPRklMRSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXZlbCA9IGZvcm1hdC5nZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9MRVZFTCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVjb2RlckZvcm1hdC5jb250YWluc0tleShNZWRpYUZvcm1hdC5LRVlfQ09MT1JfRk9STUFUKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbG9yRm9ybWF0ID0gZGVjb2RlckZvcm1hdC5nZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9DT0xPUl9GT1JNQVQpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxlUmF0ZSA9IGZvcm1hdC5nZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9TQU1QTEVfUkFURSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBudW1DaGFubmVscyA9IGZvcm1hdC5nZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9DSEFOTkVMX0NPVU5UKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkZWNvZGVyRm9ybWF0LmNvbnRhaW5zS2V5KE1lZGlhRm9ybWF0LktFWV9CSVRfUkFURSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRSYXRlID0gZGVjb2RlckZvcm1hdC5nZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9CSVRfUkFURSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdFJhdGUgPSBFTkNPREVfREVGQVVMVF9BVURJT19CSVRfUkFURTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAvKlNldHVwIEVuY29kZSBGb3JtYXQqLwotICAgICAgICAgICAgICAgICAgICBNZWRpYUZvcm1hdCBlbmNvZGVGb3JtYXQ7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtaW1lLnN0YXJ0c1dpdGgoInZpZGVvLyIpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmcmFtZVNpemUgPSB3aWR0aCAqIGhlaWdodCAqIDMgLyAyOwotICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RlRm9ybWF0ID0gTWVkaWFGb3JtYXQuY3JlYXRlVmlkZW9Gb3JtYXQobWltZSwgd2lkdGgsIGhlaWdodCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBlbmNvZGVGb3JtYXQuc2V0SW50ZWdlcihNZWRpYUZvcm1hdC5LRVlfRlJBTUVfUkFURSwgZnJhbWVSYXRlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGVuY29kZUZvcm1hdC5zZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9CSVRfUkFURSwgYml0UmF0ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBlbmNvZGVGb3JtYXQuc2V0SW50ZWdlcihNZWRpYUZvc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WNOYW1lLCBlbmNvZGVGb3JtYXQsIG1pbWUsIGZyYW1lUmF0ZSwgc2FtcGxlUmF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcmFtZVNpemUsIGFzeW5jTW9kZSk7Ci0gICAgICAgICAgICAgICAgICAgIGVuY29kZXIuZGVJbml0RW5jb2RlcigpOwotICAgICAgICAgICAgICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZWNOYW1lICsgIiBlbmNvZGVyIHJldHVybmVkIGVycm9yICIgKyBzdGF0dXMgKyAiIGZvciAiICsgImZpbGU6IiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiICIgKyBtSW5wdXRGaWxlLCAwLCBzdGF0dXMpOwotICAgICAgICAgICAgICAgICAgICBlbmNvZGVyLmR1bXBTdGF0aXN0aWNzKG1JbnB1dEZpbGUsIGNvZGVjTmFtZSwgKGFzeW5jTW9kZSA/ICJhc3luYyIgOiAic3luYyIpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhY3Rvci5nZXRDbGlwRHVyYXRpb24oKSwgbVN0YXRzRmlsZSk7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5pKFRBRywgIkVuY29kaW5nIGNvbXBsZXRlIGZvciBmaWxlOiAiICsgbUlucHV0RmlsZSArICIgd2l0aCBjb2RlYzogIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZWNOYW1lICsgIiBmb3IgYVN5bmNNb2RlID0gIiArIGFzeW5jTW9kZSk7Ci0gICAgICAgICAgICAgICAgICAgIGVuY29kZXIucmVzZXRFbmNvZGVyKCk7Ci0gICAgICAgICAgICAgICAgICAgIGVsZVN0cmVhbS5jbG9zZSgpOwotICAgICAgICAgICAgICAgICAgICBpZiAoZW5jb2RlT3V0cHV0U3RyZWFtICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGVuY29kZU91dHB1dFN0cmVhbS5jbG9zZSgpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICAvL0NsZWFudXAgdGVtcG9yYXJ5IGlucHV0IGZpbGUKLSAgICAgICAgICAgIGlmIChkZWNvZGVkRmlsZS5leGlzdHMoKSkgewotICAgICAgICAgICAgICAgIGFzc2VydFRydWUoIiBVbmFibGUgdG8gZGVsZXRlIGRlY29kZWQgZmlsZSIgKyBkZWNvZGVkRmlsZS50b1N0cmluZygpLAotICAgICAgICAgICAgICAgICAgICAgICAgZGVjb2RlZEZpbGUuZGVsZXRlKCkpOwotICAgICAgICAgICAgICAgIExvZy5pKFRBRywgIlN1Y2Nlc3NmdWxseSBkZWxldGVkIGRlY29kZWQgZmlsZSIpOwotICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIGV4dHJhY3Rvci5kZWluaXRFeHRyYWN0b3IoKTsKICAgICAgICAgZmlsZUlucHV0LmNsb3NlKCk7CisgICAgICAgIGRlY29kZU91dHB1dFN0cmVhbS5jbG9zZSgpOworICAgICAgICByZXR1cm4gc3RhdHVzOwogICAgIH0KIAogICAgIEBUZXN0KHRpbWVvdXQgPSBQRVJfVEVTVF9USU1FT1VUX01TKQotICAgIHB1YmxpYyB2b2lkIHRlc3ROYXRpdmVFbmNvZGVyKCkgdGhyb3dzIEV4Y2VwdGlvbiB7Ci0gICAgICAgIEZpbGUgaW5wdXRGaWxlID0gbmV3IEZpbGUobUlucHV0RmlsZVBhdGggKyBtSW5wdXRGaWxlKTsKLSAgICAgICAgYXNzZXJ0VHJ1ZSgiQ2Fubm90IGZpbmQgIiArIG1JbnB1dEZpbGUgKyAiIGluIGRpcmVjdG9yeSAiICsgbUlucHV0RmlsZVBhdGgsCi0gICAgICAgICAgICAgICAgaW5wdXRGaWxlLmV4aXN0cygpKTsKLSAgICAgICAgaW50IHRpZCA9IGFuZHJvaWQub3MuUHJvY2Vzcy5teVRpZC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ICAgICAgICAgICAgIGlmIChvdXRFbmNvZGVGaWxlLmV4aXN0cygpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBhc3NlcnRUcnVlKCIgVW5hYmxlIHRvIGRlbGV0ZSBleGlzdGluZyBmaWxlIiArIG91dEVuY29kZUZpbGUudG9TdHJpbmcoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0RW5jb2RlRmlsZS5kZWxldGUoKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYXNzZXJ0VHJ1ZSgiVW5hYmxlIHRvIGNyZWF0ZSBmaWxlIHRvIHdyaXRlIGVuY29kZXIgb3V0cHV0OiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRFbmNvZGVGaWxlLnRvU3RyaW5nKCksIG91dEVuY29kZUZpbGUuY3JlYXRlTmV3RmlsZSgpKTsKKyAgICAgICAgICAgICAgICAgICAgZW5jb2RlT3V0cHV0U3RyZWFtID0gbmV3IEZpbGVPdXRwdXRTdHJlYW0ob3V0RW5jb2RlRmlsZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIEZpbGUgcmF3RmlsZSA9IG5ldyBGaWxlKG1GaWxlRGlyUGF0aCArIG1JbnB1dEZpbGUpOworICAgICAgICAgICAgICAgIGFzc2VydFRydWUoIkNhbm5vdCBvcGVuIGRlY29kZWQgaW5wdXQgZmlsZSIsIHJhd0ZpbGUuZXhpc3RzKCkpOworICAgICAgICAgICAgICAgIGlmIChERUJVRykgeworICAgICAgICAgICAgICAgICAgICBMb2cuaShUQUcsICJQYXRoIG9mIGRlY29kZWQgaW5wdXQgZmlsZTogIiArIHJhd0ZpbGUudG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIEZpbGVJbnB1dFN0cmVhbSBlbGVTdHJlYW0gPSBuZXcgRmlsZUlucHV0U3RyZWFtKHJhd0ZpbGUpOworICAgICAgICAgICAgICAgIC8vIFNldHVwIEVuY29kZSBGb3JtYXQKKyAgICAgICAgICAgICAgICBNZWRpYUZvcm1hdCBlbmNvZGVGb3JtYXQ7CisgICAgICAgICAgICAgICAgaWYgKG1NaW1lLnN0YXJ0c1dpdGgoInZpZGVvLyIpKSB7CisgICAgICAgICAgICAgICAgICAgIGZyYW1lU2l6ZSA9IG1XaWR0aCAqIG1IZWlnaHQgKiAzIC8gMjsKKyAgICAgICAgICAgICAgICAgICAgZW5jb2RlRm9ybWF0ID0gTWVkaWFGb3JtYXQuY3JlYXRlVmlkZW9Gb3JtYXQobU1pbWUsIG1XaWR0aCwgbUhlaWdodCk7CisgICAgICAgICAgICAgICAgICAgIGVuY29kZUZvcm1hdC5zZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9GUkFNRV9SQVRFLCBFTkNPREVfREVGQVVMVF9GUkFNRV9SQVRFKTsKKyAgICAgICAgICAgICAgICAgICAgZW5jb2RlRm9ybWF0LnNldEludGVnZXIoTWVkaWFGb3JtYXQuS0VZX0lfRlJBTUVfSU5URVJWQUwsIG1JRnJhbWVJbnRlcnZhbCk7CisgICAgICAgICAgICAgICAgICAgIGVuY29kZUZvcm1hdC5zZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9CSVRfUkFURSwgbUJpdFJhdGUpOworICAgICAgICAgICAgICAgICAgICBlbmNvZGVGb3JtYXQuc2V0SW50ZWdlcihNZWRpYUZvcm1hdC5LRVlfQ09MT1JfRk9STUFULCBtQ29sb3JGb3JtYXQpOworICAgICAgICAgICAgICAgICAgICBpZiAobVByb2ZpbGUgIT0gLTEgJiYgbUxldmVsICE9IC0xKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBlbmNvZGVGb3JtYXQuc2V0SW50ZWdlcihNZWRpYUZvcm1hdC5LRVlfUFJPRklMRSwgbVByb2ZpbGUpOworICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RlRm9ybWF0LnNldEludGVnZXIoTWVkaWFGb3JtYXQuS0VZX0xFVkVMLCBtTGV2ZWwpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgZnJhbWVTaXplID0gNDA5NjsKKyAgICAgICAgICAgICAgICAgICAgZW5jb2RlRm9ybWF0ID0gTWVkaWFGb3JtYXQuY3JlYXRlQXVkaW9Gb3JtYXQobU1pbWUsIG1TYW1wbGVSYXRlLCBtTnVtQ2hhbm5lbCk7CisgICAgICAgICAgICAgICAgICAgIGVuY29kZUZvcm1hdC5zZXRJbnRlZ2VyKE1lZGlhRm9ybWF0LktFWV9CSVRfUkFURSwgbUJpdFJhdGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBFbmNvZGVyIGVuY29kZXIgPSBuZXcgRW5jb2RlcigpOworICAgICAgICAgICAgICAgIGVuY29kZXIuc2V0dXBFbmNvZGVyKGVuY29kZU91dHB1dFN0cmVhbSwgZWxlU3RyZWFtKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSBlbmNvZGVyLmVuY29kZShjb2RlY05hbWUsIGVuY29kZUZvcm1hdCwgbU1pbWUsIEVOQ09ERV9ERUZBVUxUX0ZSQU1FX1JBVEUsCisgICAgICAgICAgICAgICAgICAgICAgICBtU2FtcGxlUmF0ZSwgZnJhbWVTaXplLCBhc3luY01vZGUpOworICAgICAgICAgICAgICAgIGVuY29kZXIuZGVJbml0RW5jb2RlcigpOwogICAgICAgICAgICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvZGVjTmFtZSArICIgZW5jb2RlciByZXR1cm5lZCBlcnJvciAiICsgc3RhdHVzICsgIiBmb3IgIiArICJmaWxlOiIgKyAiICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW5wdXRGaWxlLCAwLCBzdGF0dXMpOworICAgICAgICAgICAgICAgICAgICAgICAgY29kZWNOYW1lICsgIiBlbmNvZGVyIHJldHVybmVkIGVycm9yICIgKyBzdGF0dXMgKyAiIGZvciAiICsgIm1pbWU6IiArICIgIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1NaW1lLCAwLCBzdGF0dXMpOworICAgICAgICAgICAgICAgIFN0cmluZyBpbnB1dFJlZmVyZW5jZTsKKyAgICAgICAgICAgICAgICBsb25nIGR1cmF0aW9uVXM7CisgICAgICAgICAgICAgICAgaWYgKG1NaW1lLnN0YXJ0c1dpdGgoInZpZGVvLyIpKSB7CisgICAgICAgICAgICAgICAgICAgIGlucHV0UmVmZXJlbmNlID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW5wdXRGaWxlICsgIl8iICsgbVdpZHRoICsgIngiICsgbUhlaWdodCArICJfIiArIG1CaXRSYXRlICsgImJwcyI7CisgICAgICAgICAgICAgICAgICAgIGR1cmF0aW9uVXMgPSAoKChlbGVTdHJlYW0uZ2V0Q2hhbm5lbCgpLnNpemUoKSArIGZyYW1lU2l6ZSAtIDEpIC8gZnJhbWVTaXplKSAvCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgRU5DT0RFX0RFRkFVTFRfRlJBTUVfUkFURSkgKiAxMDAwMDAwOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGlucHV0UmVmZXJlbmNlID0gbUlucHV0RmlsZSArICJfIiArIG1TYW1wbGVSYXRlICsgImh6XyIgKyBtTnVtQ2hhbm5lbCArICJjaF8iICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQml0UmF0ZSArICJicHMiOworICAgICAgICAgICAgICAgICAgICBkdXJhdGlvblVzID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZWxlU3RyZWFtLmdldENoYW5uZWwoKS5zaXplKCkgLyAobVNhbXBsZVJhdGUgKiBtTnVtQ2hhbm5lbCkpICogMTAwMDAwMDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZW5jb2Rlci5kdW1wU3RhdGlzdGljcyhpbnB1dFJlZmVyZW5jZSwgY29kZWNOYW1lLCAoYXN5bmNNb2RlID8gImFzeW5jIiA6ICJzeW5jIiksCisgICAgICAgICAgICAgICAgICAgICAgICBkdXJhdGlvblVzLCBtU3RhdHNGaWxlKTsKKyAgICAgICAgICAgICAgICBMb2cuaShUQUcsICJFbmNvZGluZyBjb21wbGV0ZSBmb3IgbWltZTogIiArIG1NaW1lICsgIiB3aXRoIGNvZGVjOiAiICsgY29kZWNOYW1lICsKKyAgICAgICAgICAgICAgICAgICAgICAgICIgZm9yIGFTeW5jTW9kZSA9ICIgKyBhc3luY01vZGUpOworICAgICAgICAgICAgICAgIGVuY29kZXIucmVzZXRFbmNvZGVyKCk7CisgICAgICAgICAgICAgICAgZWxlU3RyZWFtLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgaWYgKGVuY29kZU91dHB1dFN0cmVhbSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGVuY29kZU91dHB1dFN0cmVhbS5jbG9zZSgpOworICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgICAgICBGaWxlIGRlY29kZWRGaWxlID0gbmV3IEZpbGUobURlY29kZWRGaWxlKTsKLSAgICAgICAgLy8gQ2xlYW51cCB0ZW1wb3JhcnkgaW5wdXQgZmlsZQotICAgICAgICBpZiAoZGVjb2RlZEZpbGUuZXhpc3RzKCkpIHsKLSAgICAgICAgICAgIGFzc2VydFRydWUoIlVuYWJsZSB0byBkZWxldGUgLSAiICsgbURlY29kZWRGaWxlLCBkZWNvZGVkRmlsZS5kZWxldGUoKSk7Ci0gICAgICAgICAgICBMb2cuaShUQUcsICJTdWNjZXNzZnVsbHkgZGVsZXRlZCAtICIgKyBtRGVjb2RlZEZpbGUpOworICAgIH0KKworICAgIEBUZXN0KHRpbWVvdXQgPSBQRVJfVEVTVF9USU1FT1VUX01TKQorICAgIHB1YmxpYyB2b2lkIHRlc3ROYXRpdmVFbmN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B9Ci0gICAgICAgIGRlY29kZXItPnNldHVwRGVjb2RlcigpOwotICAgICAgICBzdGF0dXMgPSBkZWNvZGVyLT5kZWNvZGUoaW5wdXRCdWZmZXIsIGZyYW1lSW5mbywgZGVjTmFtZSwgZmFsc2UgLyphc3luY01vZGUgKi8sIG91dEZwKTsKKyAgICAgICAgRW5jb2RlciAqZW5jb2RlciA9IG5ldyBFbmNvZGVyKCk7CisgICAgICAgIGVuY29kZXItPnNldHVwRW5jb2RlcigpOworICAgICAgICBhdXRvIHN0YXR1cyA9IGVuY29kZXItPmVuY29kZShzQ29kZWNOYW1lLCBlbGVTdHJlYW0sIGVsZVNpemUsIG1vZGUsIGVuY1BhcmFtcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3RfY2FzdDxjaGFyICo+KG1pbWUpKTsKICAgICAgICAgaWYgKHN0YXR1cyAhPSBBTUVESUFfT0spIHsKLSAgICAgICAgICAgIEFMT0dFKCJEZWNvZGUgcmV0dXJuZWQgZXJyb3IiKTsKLSAgICAgICAgICAgIGZyZWUoaW5wdXRCdWZmZXIpOworICAgICAgICAgICAgQUxPR0UoIkVuY29kZXIgcmV0dXJuZWQgZXJyb3IiKTsKICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgfQotCi0gICAgICAgIEFNZWRpYUZvcm1hdCAqZGVjb2RlckZvcm1hdCA9IGRlY29kZXItPmdldEZvcm1hdCgpOwotICAgICAgICBBTWVkaWFGb3JtYXQgKmZvcm1hdCA9IGV4dHJhY3Rvci0+Z2V0Rm9ybWF0KCk7Ci0gICAgICAgIGlmIChpbnB1dEJ1ZmZlcikgewotICAgICAgICAgICAgZnJlZShpbnB1dEJ1ZmZlcik7Ci0gICAgICAgICAgICBpbnB1dEJ1ZmZlciA9IG51bGxwdHI7CisgICAgICAgIEFMT0dWKCJFbmNvZGluZyBjb21wbGV0ZSB3aXRoIGNvZGVjICVzIGZvciBhc3luY01vZGUgPSAlZCIsIHNDb2RlY05hbWUuY19zdHIoKSwgbW9kZSk7CisgICAgICAgIGVuY29kZXItPmRlSW5pdENvZGVjKCk7CisgICAgICAgIGNvbnN0IGNoYXIgKnN0YXRzRmlsZSA9IGVudi0+R2V0U3RyaW5nVVRGQ2hhcnMoalN0YXRzRmlsZSwgbnVsbHB0cik7CisgICAgICAgIHN0cmluZyBpbnB1dFJlZmVyZW5jZTsKKyAgICAgICAgaW50NjRfdCBjbGlwRHVyYXRpb25VczsKKyAgICAgICAgaWYgKCFzdHJuY21wKG1pbWUsICJ2aWRlby8iLCA2KSkgeworICAgICAgICAgICAgaW5wdXRSZWZlcmVuY2UgPSBzdHJpbmcoZmlsZU5hbWUpICsgIl8iICsgdG9fc3RyaW5nKGpXaWR0aCkgKyAieCIgKyB0b19zdHJpbmcoakhlaWdodCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiXyIgKyB0b19zdHJpbmcoakJpdFJhdGUpICsgImJwcyI7CisgICAgICAgICAgICBpbnQzMl90IGZyYW1lU2l6ZSA9IGpXaWR0aCAqIGpIZWlnaHQgKiAzIC8gMjsKKyAgICAgICAgICAgIGNsaXBEdXJhdGlvblVzID0KKyAgICAgICAgICAgICAgICAgICAgKCgoZWxlU2l6ZSArIGZyYW1lU2l6ZSAtIDEpIC8gZnJhbWVTaXplKSAvIEVOQ09ERV9ERUZBVUxUX0ZSQU1FX1JBVEUpICogMTAwMDAwMDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGlucHV0UmVmZXJlbmNlID0gc3RyaW5nKGZpbGVOYW1lKSArICJfIiArIHRvX3N0cmluZyhqU2FtcGxlUmF0ZSkgKyAiaHpfIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvX3N0cmluZyhqTnVtQ2hhbm5lbHMpICsgImNoXyIgKyB0b19zdHJpbmcoakJpdFJhdGUpICsgImJwcyI7CisgICAgICAgICAgICBjbGlwRHVyYXRpb25VcyA9IChlbGVTaXplIC8gKGpTYW1w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X1JBVEU7Ci0gICAgICAgICAgICAgICAgICAgIGlmICghc3RyY21wKG1pbWUsICJ2aWRlby8zZ3BwIikgfHwgIXN0cmNtcChtaW1lLCAidmlkZW8vbXA0di1lcyIpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBlbmNQYXJhbXMuYml0cmF0ZSA9IEVOQ09ERV9NSU5fQklUX1JBVEUgLyogNjAwIEticHMgKi87Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBlbmNQYXJhbXMuYml0cmF0ZSA9IEVOQ09ERV9ERUZBVUxUX0JJVF9SQVRFIC8qIDggTWJwcyAqLzsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZ2V0SW50MzIoZm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX1BST0ZJTEUsICZlbmNQYXJhbXMucHJvZmlsZSk7Ci0gICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldEludDMyKGZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9MRVZFTCwgJmVuY1BhcmFtcy5sZXZlbCk7Ci0gICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldEludDMyKGRlY29kZXJGb3JtYXQsIEFNRURJQUZPUk1BVF9LRVlfQ09MT1JfRk9STUFULAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZW5jUGFyYW1zLmNvbG9yRm9ybWF0KTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldEludDMyKGZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9TQU1QTEVfUkFURSwgJmVuY1BhcmFtcy5zYW1wbGVSYXRlKTsKLSAgICAgICAgICAgICAgICBBTWVkaWFGb3JtYXRfZ2V0SW50MzIoZm9ybWF0LCBBTUVESUFGT1JNQVRfS0VZX0NIQU5ORUxfQ09VTlQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlbmNQYXJhbXMubnVtQ2hhbm5lbHMpOwotICAgICAgICAgICAgICAgIGVuY1BhcmFtcy5iaXRyYXRlID0gRU5DT0RFX0RFRkFVTFRfQVVESU9fQklUX1JBVEU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBFbmNvZGVyICplbmNvZGVyID0gbmV3IEVuY29kZXIoKTsKLSAgICAgICAgICAgIGVuY29kZXItPnNldHVwRW5jb2RlcigpOwotICAgICAgICAgICAgc3RhdHVzID0gZW5jb2Rlci0+ZW5jb2RlKHNDb2RlY05hbWUsIGVsZVN0cmVhbSwgZWxlU2l6ZSwgYXN5bmNNb2RlW2ldLCBlbmNQYXJhbXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGNoYXIgKiltaW1lKTsKLSAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gQU1FRElBX09LKSB7Ci0gICAgICAgICAgICAgICAgQUxPR0UoIkVuY29kZXIgcmV0dXJuZWQgZXJyb3IiKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gLTE7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBBTE9HVigiRW5jb2RpbmcgY29tcGxldGUgd2l0aCBjb2RlYyAlcyBmb3IgYXN5bmNNb2RlID0gJWQiLCBzQ29kZWNOYW1lLmNfc3RyKCksCi0gICAgICAgICAgICAgICAgICBhc3luY01vZGVbaV0pOwotICAgICAgICAgICAgZW5jb2Rlci0+ZGVJbml0Q29kZWMoKTsKLSAgICAgICAgICAgIGNvbnN0IGNoYXIgKnN0YXRzRmlsZSA9IGVudi0+R2V0U3RyaW5nVVRGQ2hhcnMoalN0YXRzRmlsZSwgbnVsbHB0cik7Ci0gICAgICAgICAgICBlbmNvZGVyLT5kdW1wU3RhdGlzdGljcyhzSW5wdXRSZWZlcmVuY2UsIGV4dHJhY3Rvci0+Z2V0Q2x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WFtOjphdGUpOwpAQCAtMTA4LDExICsxMTMsMTMgQEAKICAgICAgICAgICAgIGlmIChlbmNQYXJhbXMuYml0cmF0ZSA8PSAwIHx8IGVuY1BhcmFtcy5mcmFtZVJhdGUgPD0gMCkgewogICAgICAgICAgICAgICAgIGVuY1BhcmFtcy5mcmFtZVJhdGUgPSAyNTsKICAgICAgICAgICAgICAgICBpZiAoIXN0cmNtcChtaW1lLCAidmlkZW8vM2dwcCIpIHx8ICFzdHJjbXAobWltZSwgInZpZGVvL21wNHYtZXMiKSkgewotICAgICAgICAgICAgICAgICAgICBlbmNQYXJhbXMuYml0cmF0ZSA9IDYwMDAwMCAvKiA2MDAgS2JwcyAqLzsKKyAgICAgICAgICAgICAgICAgICAgZW5jUGFyYW1zLmJpdHJhdGUgPSBrRW5jb2RlTWluVmlkZW9CaXRSYXRlOwogICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGVuY1BhcmFtcy5iaXRyYXRlID0gODAwMDAwMCAvKiA4IE1icHMgKi87CisgICAgICAgICAgICAgICAgICAgIGVuY1BhcmFtcy5iaXRyYXRlID0ga0VuY29kZURlZmF1bHRWaWRlb0JpdFJhdGU7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQorICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldEludDMyKGRlY29kZXJGb3JtYXQsIEFNRURJQUZPUk1BVF9LRVlfQ09MT1JfRk9STUFULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlbmNQYXJhbXMuY29sb3JGb3JtYXQpOwogICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldEludDMyKGZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9QUk9GSUxFLCAmZW5jUGFyYW1zLnByb2ZpbGUpOwogICAgICAgICAgICAgQU1lZGlhRm9ybWF0X2dldEludDMyKGZvcm1hdCwgQU1FRElBRk9STUFUX0tFWV9MRVZFTCwgJmVuY1BhcmFtc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8gQSBsYXJnZS1zY2FsZS1jaGFuZ2UgYWRkZWQgJ2RlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlcycgdG8gaW1wb3J0CisgICAgLy8gYWxsIG9mIHRoZSAnbGljZW5zZV9raW5kcycgZnJvbSAiZnJhbWV3b3Jrc19hdl9saWNlbnNlIgorICAgIC8vIHRvIGdldCB0aGUgYmVsb3cgbGljZW5zZSBraW5kczoKKyAgICAvLyAgIFNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUFwYWNoZS0yLjAKKyAgICBkZWZhdWx0X2FwcGxpY2FibGVfbGljZW5zZXM6IFsiZnJhbWV3b3Jrc19hdl9saWNlbnNlIl0sCit9CisKIGNjX2xpYnJhcnkgewogICAgIG5hbWU6ICJsaWJtZWRpYXV0aWxzIiwKIApAQCAtMjgsMTcgKzM3LDI0IEBACiAgICAgXSwKICAgICBzdGF0aWNfbGliczogWwogICAgICAgICAibGliY19tYWxsb2NfZGVidWdfYmFja3RyYWNlIiwKKyAgICAgICAgImxpYmJhdHRlcnlzdGF0c19haWRsIiwKKyAgICAgICAgImxpYnByb2Nlc3NpbmZvc2VydmljZV9haWRsIiwKICAgICBdLAogICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJhdWRpb2NsaWVudF9haWRsX2NvbnZlcnNpb24iLAogICAgICAgICAibGliYXVkaW91dGlscyIsIC8vIGZvciBjbG9jay5oCiAgICAgICAgICJsaWJiaW5kZXIiLAogICAgICAgICAibGliY3V0aWxzIiwKICAgICAgICAgImxpYmxvZyIsCiAgICAgICAgICJsaWJ1dGlscyIsCiAgICAgICAgICJsaWJoaWRsYmFzZSIsCisgICAgICAgICJsaWJwZXJtaXNzaW9uIiwKICAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuZ3JhcGhpY3MuYnVmZmVycXVldWVAMS4wIiwKICAgICAgICAgImFuZHJvaWQuaGlkbC50b2tlbkAxLjAtdXRpbHMiLAogICAgIF0sCisgICAgZXhwb3J0X3N0YX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ICAgImxpYmxvZyIsCisgICAgICAgICJsaWJtZWRpYXV0aWxzIiwKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICAgICAgImxpYmJpbmRlciIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCisgICAgXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLVdhbGwiLAorICAgICAgICAiLVdleHRyYSIsCisgICAgICAgICItV2Vycm9yIiwKKyAgICAgICAgIi1Xbm8tYysrMmEtZXh0ZW5zaW9ucyIsCisgICAgXSwKKworICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJiaW9uaWNfbGliY19wbGF0Zm9ybV9oZWFkZXJzIiwKKyAgICAgICAgImxpYm1lZGlhX2hlYWRlcnMiLAorICAgIF0sCisKKyAgICBpbmNsdWRlX2RpcnM6IFsKKyAgICAgICAgLy8gRm9yIERFQlVHR0VSX1NJR05BTAorICAgICAgICAic3lzdGVtL2NvcmUvZGVidWdnZXJkL2luY2x1ZGUiLAorICAgIF0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJsaWJtZWRpYXV0aWxzX2Z1enplcl9iYXR0ZXJ5X25vdGlmaWVyIiwKKyAgICBkZWZhdWx0czogWyJsaWJtZWRpYXV0aWxzX2Z1enplcl9kZWZhdWx0cyJdLAorICAgIHNyY3M6IFsiQmF0dGVyeU5vdGlmaWVyRnV6ei5jcHAiXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogImxpYm1lZGlhdXRpbHNfZnV6emVyX3NjaGVkdWxpbmdfcG9saWN5X3NlcnZpY2UiLAorICAgIGRlZmF1bHRzOiBbImxpYm1lZGlhdXRpbHNfZnV6emVyX2RlZmF1bHRzIl0sCisgICAgc3JjczogWyJTY2hlZHVsaW5nUG9saWN5U2VydmljZUZ1enouY3BwIl0sCit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJsaWJtZWRpYXV0aWxzX2Z1enplcl9zZXJ2aWNlX3V0aWxpdGllc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jpmb3J3YXJkPFU+KHUpKTsKKyAgICB9CisKKyAgICAvLyByZXR1cm5zIGEgY29weS12YWx1ZSBub3QgYSByZWZlcmVuY2UuCisgICAgVCBsb2FkKCkgY29uc3QgeworICAgICAgICBzdGQ6OmxvY2tfZ3VhcmQgbG9jayhtTG9jayk7CisgICAgICAgIHJldHVybiBtVDsKKyAgICB9CisKKyAgICAvLyBhbnkgY29udmVyc2lvbiBkb25lIHVuZGVyIGxvY2suCisgICAgdGVtcGxhdGUgPHR5cGVuYW1lIFU+CisgICAgdm9pZCBzdG9yZShVJiYgdSkgeworICAgICAgICBpZiBjb25zdGV4cHIgKChGTEFHUyAmIEZMQUdfRFRPUl9PVVRfT0ZfTE9DSykgIT0gMCkgeworICAgICAgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtTG9jayk7CisgICAgICAgICAgICAgVCB0ZW1wID0gc3RkOjptb3ZlKG1UKTsKKyAgICAgICAgICAgICBtVCA9IHN0ZDo6Zm9yd2FyZDxVPih1KTsKKyAgICAgICAgICAgICBsb2NrLnVubG9jaygpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgc3RkOjpsb2NrX2d1YXJkIGxvY2sobUxvY2spOworICAgICAgICAgICAgbVQgPSBzdGQ6OmZvcndhcmQ8VT4odSk7CisgICAgICAgIH0KKyAgICB9Cit9OworCisvKioKKyAqIGF0b21pY193cDw+IGFuZCBhdG9taWNfc3A8PiBhcmUgdXNlZCBmb3IgY29uY3VycmVudCBhY2Nlc3MgdG8gQW5kcm9pZAorICogc3A8PiBhbmQgd3A8PiBzbWFydCBwb2ludGVycywgaW5jbHVkaW5nIHRoZWlyIG1vZGlmaWVycy4gIFdlCisgKiByZXR1cm4gYSBjb3B5IG9mIHRoZSBzbWFydCBwb2ludGVyIHdpdGggbG9hZCgpLgorICoKKyAqIEhpc3RvcmljYWw6IFRoZSBpbXBvcnRhbmNlIG9mIGFuIGF0b21pYzxzdGQ6OnNoYXJlZF9wdHI8VD4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5IGEgbGFyZ2Utc2NhbGUtY2hhbmdlCisvLyBTZWU6IGh0dHA6Ly9nby9hbmRyb2lkLWxpY2Vuc2UtZmFxCitsaWNlbnNlIHsKKyAgICBuYW1lOiAiZnJhbWV3b3Jrc19hdl9zZXJ2aWNlc19hdWRpb2ZsaW5nZXJfbGljZW5zZSIsCisgICAgdmlzaWJpbGl0eTogWyI6X19zdWJwYWNrYWdlc19fIl0sCisgICAgbGljZW5zZV9raW5kczogWworICAgICAgICAiU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMCIsCisgICAgXSwKKyAgICBsaWNlbnNlX3RleHQ6IFsKKyAgICAgICAgIk5PVElDRSIsCisgICAgXSwKK30KKwogY2NfbGlicmFyeV9zaGFyZWQgewogICAgIG5hbWU6ICJsaWJhdWRpb2ZsaW5nZXIiLAogCkBAIC0zNSw2ICs1NCwxMSBAQAogICAgIF0sCiAKICAgICBzaGFyZWRfbGliczogWworICAgICAgICAiYXVkaW9mbGluZ2VyLWFpZGwtY3BwIiwKKyAgICAgICAgImF1ZGlvY2xpZW50LXR5cGVzLWFpZGwtY3BwIiwKKyAgICAgICAgImF2LXR5cGVzLWFpZGwtY3BwIiwKKyAgICAgICAgImVmZmVjdC1haWRsLWNwcCIsCisgICAgICAgICJsaWJhdWRpb2NsaWVudF9haWRsX2NvbnZlcnNpb24iLAogICAgICAgICAibGliYXVkaW9mb3VuZGF0aW9uIiwKICAgICAgICAgImxpYmF1ZGlvaGFsIiwKICAgICAgICAgImxpYmF1ZGlvcHJvY2Vzc2luZyIsCkBAIC01MCwyMyArNzQsMzEgQEAKICAgICAgICAgImxpYm1lZGlhdXRpbHMiLAogICAgICAgICAibGlibmJhaW8iLAogICAgICAgICAibGlibmJsb2ciLAorICAgICAgICAibGlicGVybWlzc2lvbiIsCiAgICAgICAgICJsaWJwb3dlcm1hbmFnZXIiLAogICAgICAgICAibGlibWVkaWF1dGlscyIsCiAgICAgICAgICJsaWJtZW11bnJlYWNoYWJsZSIsCiAgICAgICAgICJsaWJtZWRpYV9oZWxwZXIiLAorICAgICAgICAibGlic2htZW1jb21wYXQiLAogICAgICAgICAibGlidmlicmF0b3IiLAogICAgIF0sCiAKICAgICBzdGF0aWNfbGliczogWwogICAgICAgICAibGliY3B1c3RhdHMiLAogICAgICAgICAibGlic25kZmlsZSIsCisgICAgICAgICJsaWJwZXJtaXNzaW9uIiwKICAgICBdLAogCiAgICAgaGVhZGVyX2xpYnM6IFsKKyAgICAgICAgImxpYmF1ZGlvY2xpZW50X2hlYWRlcnMiLAogICAgICAgICAibGliYXVkaW9oYWxfaGVhZGVycyIsCiAgICAgICAgICJsaWJtZWRpYV9oZWFkZXJzIiwKICAgICBdLAogCisgICAgZXhwb3J0X3NoYXJlZF9saWJfaGVhZGVyczogWworICAgICAgICAibGlicGVybWlzc2lvbiIsCisgICAgXSwKKwogICAgIGNmbGFnczogWwogICAgICAgICAiLURTVEFURV9RVUVVRV9JTlNUQU5USUFUSU9OUz1cIlN0YXRlUXVldWVJbnN0YW50aWF0aW9ucy5jcHBcIiIsCiAgICAgICAgICItZnZpc2liaWxpdHk9aGlkZGVuIiwKZGlmZiAtLWdpdCBhL3NlcnZpY2VzL2F1ZGlvZmxpbmdlci9BdWRpb0ZsaW5nZXIuY3BwIGIvc2VydmljZXMvYXVkaW9mbGluZ2VyL0F1ZGlvRmxpbmdlci5jcHAKaW5kZXggNzY0ZmRjMy4uNjVhMTYzZiAxMDA2NDQKLS0tIGEvc2VydmljZXMvYXVkaW9mbGluZ2VyL0F1ZGlvRmxpbmdlci5jcHAKKysrIGIvc2VydmljZXMvYXVkaW9mbGluZ2VyL0F1ZGlvRmxpbmdlci5jcHAKQEAgLTMxLDYgKzMxLDcgQEAKICNpbmNsdWRlIDxzeXMvcmVzb3VyY2UuaD4KICNpbmNsdWRlIDx0aHJlYWQ+CiAKKyNpbmNsdWRlIDxhbmRyb2lkL21lZGlhL0lBdWRpb1BvbGljeVNlcnZpY2UuaD4KICNpbm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ICAgICAgICAgYWN0dWFsU2Vzc2lvbklkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmc3RyZWFtVHlwZSwgY2xpZW50LmNsaWVudFBpZCwgY2xpZW50LmNsaWVudFVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnN0cmVhbVR5cGUsIGNsaWVudC5hdHRyaWJ1dGlvblNvdXJjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZ1bGxDb25maWcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChhdWRpb19vdXRwdXRfZmxhZ3NfdCkoQVVESU9fT1VUUFVUX0ZMQUdfTU1BUF9OT0lSUSB8CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fT1VUUFVUX0ZMQUdfRElSRUNUKSwKQEAgLTM1Myw5ICs0NDMsNyBAQAogICAgICAgICByZXQgPSBBdWRpb1N5c3RlbTo6Z2V0SW5wdXRGb3JBdHRyKCZsb2NhbEF0dHIsICZpbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUNPUkRfUklJRF9JTlZBTElELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdHVhbFNlc3Npb25JZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnQuY2xpZW50UGlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudC5jbGllbnRVaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50LnBhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudC5hdHRyaWJ1dGlvblNvdXJjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fSU5QVVRfRkxBR19NTUFQX05PSVJRLCBkZXZpY2VJZCwgJnBvcnRJZCk7CiAgICAgfQpAQCAtMzkxLDE0ICs0NzksMTkgQEAKIC8qIHN0YXRpYyAqLwogaW50IEF1ZGlvRmxpbmdlcjo6b25FeHRlcm5hbFZpYnJhdGlvblN0YXJ0KGNvbnN0IHNwPG9zOjpFeHRlcm5hbFZpYnJhdGlvbj4mIGV4dGVybmFsVmlicmF0aW9uKSB7CiAgICAgc3A8b3M6OklFeHRlcm5hbFZpYnJhdG9yU2VydmljZT4gZXZzID0gZ2V0RXh0ZXJuYWxWaWJyYXRvclNlcnZpY2UoKTsKLSAgICBpZiAoZXZzICE9IDApIHsKKyAgICBpZiAoZXZzICE9IG51bGxwdHIpIHsKICAgICAgICAgaW50MzJfdCByZXQ7CiAgICAgICAgIGJpbmRlcjo6U3RhdHVzIHN0YXR1cyA9IGV2cy0+b25FeHRlcm5hbFZpYnJhdGlvblN0YXJ0KCpleHRlcm5hbFZpYnJhdGlvbiwgJnJldCk7CiAgICAgICAgIGlmIChzdGF0dXMuaXNPaygpKSB7CisgICAgICAgICAgICBBTE9HRCgiJXMsIHN0YXJ0IGV4dGVybmFsIHZpYnJhdGlvbiB3aXRoIGludGVuc2l0eSBhcyAlZCIsIF9fZnVuY19fLCByZXQpOwogICAgICAgICAgICAgcmV0dXJuIHJldDsKICAgICAgICAgfQogICAgIH0KLSAgICByZXR1cm4gQXVkaW9NaXhlcjo6SEFQVElDX1NDQUxFX01VVEU7CisgICAgQUxPR0QoIiVzLCBzdGFydCBleHRlcm5hbCB2aWJyYXRpb24gd2l0aCBpbnRlbnNpdHkgYXMgTVVURSBkdWUgdG8gJXMiLAorICAgICAgICAgICAgX19mdW5jX18sCisgICAgICAgICA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ICAgICAgICAgICAgICAgICAiJXMgdWlkICVkIHBpZCAlZCB0cmllZCB0byBwYXNzIGl0c2VsZiBvZmYgYXMgcGlkICVkIiwKICAgICAgICAgICAgICAgICAgX19mdW5jX18sIGNhbGxpbmdVaWQsIGNhbGxpbmdQaWQsIGNsaWVudFBpZCk7CiAgICAgICAgIGNsaWVudFBpZCA9IGNhbGxpbmdQaWQ7CisgICAgICAgIGFkakF0dHJpYnV0aW9uU291cmNlLnBpZCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMobGVnYWN5MmFpZGxfcGlkX3RfaW50MzJfdChjYWxsaW5nUGlkKSk7CiAgICAgfQogCiAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb25JZCA9IGlucHV0LnNlc3Npb25JZDsKQEAgLTc4Niw3ICs4ODgsNyBAQAogICAgIG91dHB1dC5vdXRwdXRJZCA9IEFVRElPX0lPX0hBTkRMRV9OT05FOwogICAgIG91dHB1dC5zZWxlY3RlZERldmljZUlkID0gaW5wdXQuc2VsZWN0ZWREZXZpY2VJZDsKICAgICBsU3RhdHVzID0gQXVkaW9TeXN0ZW06OmdldE91dHB1dEZvckF0dHIoJmxvY2FsQXR0ciwgJm91dHB1dC5vdXRwdXRJZCwgc2Vzc2lvbklkLCAmc3RyZWFtVHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50UGlkLCBjbGllbnRVaWQsICZpbnB1dC5jb25maWcsIGlucHV0LmZsYWdzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGpBdHRyaWJ1dGlvblNvdXJjZSwgJmlucHV0LmNvbmZpZywgaW5wdXQuZmxhZ3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZvdXRwdXQuc2VsZWN0ZWREZXZpY2VJZCwgJnBvcnRJZCwgJnNlY29uZGFyeU91dHB1dHMpOwogCiAgICAgaWYgKGxTdGF0dXMgIT0gTk9fRVJST1IgfHwgb3V0cHV0Lm91dHB1dElkID09IEFVRElPX0lPX0hBTkRMRV9OT05FKSB7CkBAIC04NDUsMTUgKzk0NywxNSBAQAogICAgICAgICBvdXRwdXQuZnJhbWVDb3VudCA9IGlucHV0LmZyYW1lQ291bnQ7CiAgICAgICAgIG91dHB1dC5ub3RpZmljYXRpb25GcmFtZUNvdW50ID0gaW5wdXQubm90aWZpY2F0aW9uRnJhbWVDb3VudDsKICAgICAgICAgb3V0cHV0LmZsYWdzID0gaW5wdXQuZmxhZ3M7CisgICAgICAgIG91dHB1dC5zdHJlYW1UeXBlID0gc3RyZWFtVHlwZTsKIAogICAgICAgICB0cmFjayA9IHRocmVhZC0+Y3JlYXRlVHJhY2tfbChjbGllbnQsIHN0cmVhbVR5cGUsIGxvY2FsQXR0ciwgJm91dHB1dC5zYW1wbGVSYXRlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnB1dC5jb25maWcuZm9ybWF0LCBpbnB1dC5jb25maWcuY2hhbm5lbF9tYXNrLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmb3V0cHV0LmZyYW1lQ291bnQsICZvdXRwdXQubm90aWZpY2F0aW9uRnJhbWVDb3VudCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQubm90aWZpY2F0aW9uc1BlckJ1ZmZlciwgaW5wdXQuc3BlZWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0LnNoYXJlZEJ1ZmZlciwgc2Vzc2lvbklkLCAmb3V0cHV0LmZsYWdzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsaW5nUGlkLCBpbnB1dC5jbGllbnRJbmZvLmNsaWVudFRpZCwgY2xpZW50VWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbFN0YXR1cywgcG9ydElkLCBpbnB1dC5h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ZGFyeVRocmVhZCA9IGNoZWNrUGxheWJhY2tUaHJlYWRfbChzZWNvbmRhcnlPdXRwdXQpOwotICAgICAgICAgICAgICAgIGlmIChzZWNvbmRhcnlUaHJlYWQgPT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICBBTE9HRSgibm8gcGxheWJhY2sgdGhyZWFkIGZvdW5kIGZvciBzZWNvbmRhcnkgb3V0cHV0ICVkIiwgb3V0cHV0Lm91dHB1dElkKTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgc2l6ZV90IHNvdXJjZUZyYW1lQ291bnQgPSB0aHJlYWQtPmZyYW1lQ291bnQoKSAqIG91dHB1dC5zYW1wbGVSYXRlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvIHRocmVhZC0+c2FtcGxlUmF0ZSgpOwotICAgICAgICAgICAgICAgIHNpemVfdCBzaW5rRnJhbWVDb3VudCA9IHNlY29uZGFyeVRocmVhZC0+ZnJhbWVDb3VudCgpICogb3V0cHV0LnNhbXBsZVJhdGUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gc2Vjb25kYXJ5VGhyZWFkLT5zYW1wbGVSYXRlKCk7Ci0gICAgICAgICAgICAgICAgLy8gSWYgdGhlIHNlY29uZGFyeSBvdXRwdXQgaGFzIGp1c3QgYmVlbiBvcGVuZWQsIHRoZSBmaXJzdCBzZWNvbmRhcnlUaHJlYWQgd3JpdGUKLSAgICAgICAgICAgICAgICAvLyB3aWxsIG5vdCBibG9jayBhcyBpdCB3aWxsIGZpbGwgdGhlIGVtcHR5IHN0YXJ0dXAgYnVmZmVyIG9mIHRoZSBIQUwsCi0gICAgICAgICAgICAgICAgLy8gc28gYSBzZWNvbmQgc2luayBidWZmZXIgbmVlZHMgdG8gYmUgcmVhZHkgZm9yIHRoZSBpbW1lZGlhdGUgbmV4dCBibG9ja2luZy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ICAgICAgICAgICAgIC8vIFRoZSBmcmFtZUNvdW50IHNob3VsZCBhbHNvIG5vdCBiZSBzbWFsbGVyIHRoYW4gdGhlIHNlY29uZGFyeSB0aHJlYWQgbWluIGZyYW1lCi0gICAgICAgICAgICAgICAgLy8gY291bnQKLSAgICAgICAgICAgICAgICBzaXplX3QgbWluRnJhbWVDb3VudCA9IEF1ZGlvU3lzdGVtOjpjYWxjdWxhdGVNaW5GcmFtZUNvdW50KAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsmXSB7IE11dGV4OjpBdXRvbG9jayBfbChzZWNvbmRhcnlUaHJlYWQtPm1Mb2NrKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2Vjb25kYXJ5VGhyZWFkLT5sYXRlbmN5X2woKTsgfSgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY29uZGFyeVRocmVhZC0+bU5vcm1hbEZyYW1lQ291bnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kYXJ5VGhyZWFkLT5tU2FtcGxlUmF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXQuc2FtcGxlUmF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnB1dC5zcGVlZCk7Ci0gICAgICAgICAgICAgICAgZnJhbWVDb3VudCA9IHN0ZDo6bWF4KGZyYW1lQ291bnQsIG1pbkZyYW1lQ291bnQpOwotCi0gICAgICAgICAgICAgICAgdXNpbmcgbmFtZXNwYWNlIHN0ZDo6Y2hyb25vX2xpdGVyYWxzOwotICAgICAgICAgICAgICAgIGF1dG8gaW5DaGFubmVsTWFzayA9IGF1ZGlvX2NoYW5uZWxfbWFza19vdXRfdG9faW4oaW5wdXQuY29uZmlnLmNoYW5uZWxfbWFzayk7Ci0gICAgICAgICAgICAgICAgc3AgcGF0Y2hSZWNvcmQgPSBuZXcgUmVjb3JkVGhyZWFkOjpQYXRjaFJlY29yZChudWxscHRyIC8qIHRocmVhZCAqLywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dC5zYW1wbGVSYXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5DaGFubmVsTWFzaywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0LmNvbmZpZy5mb3JtYXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcmFtZUNvdW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCAvKiBidWZmZXIgKi8sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoc2l6ZV90KTAgLyogYnVmZmVyU2l6ZSAqLywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX0lOUFVUX0ZMQUdfRElSRUNULAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMG5zIC8qIHRpbWVvdXQgKi8pOwotICAgICAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IHBhdGNoUmVjb3JkLT5pbml0Q2hlY2soKTsKLSAgICAgICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgICAgIEFMT0dFKCJTZWNvbmRhcnkgb3V0cHV0IHBhdGNoUmVjb3JkIGluaXQgZmFpbGVkOiAlZCIsIHN0YXR1cyk7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIC8vIFRPRE86IFdlIGNvdWxkIGNoZWNrIGNvbXBhdGliaWxpdHkgb2YgdGhlIHNlY29uZGFyeVRocmVhZCB3aXRoIHRoZSBQYXRjaFRyYWNrCi0gICAgICAgICAgICAgICAgLy8gZm9yIGZhc3QgdXNhZ2U6IHRocmVhZCBoYXMgZmFzdCBtaXhlciwgc2FtcGxlIHJhdGUgbWF0Y2hlcywgZXRjLjsKLSAgICAgICAgICAgICAgICAvLyBmb3Igbm93LCB3ZSBleGNsdWRlIGZhc3QgdHJhY2tzIGJ5IHJlbW92aW5nIHRoZSBGYXN0IGZsYWcuCi0gICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fb3V0cHV0X2ZsYWdzX3Qgb3V0cHV0RmxhZ3MgPQotICAgICAgICAgICAgICAgICAgICAgICAgKGF1ZGlvX291dHB1dF9mbGFnc190KShvdXRwdXQuZmxhZ3MgJiB+QVVESU9fT1VUUFVUX0ZMQUdfRkFTVCk7Ci0gICAgICAgICAgICAgICAgc3AgcGF0Y2hUcmFjayA9IG5ldyBQbGF5YmFja1RocmVhZDo6UGF0Y2hUcmFjayhzZWNvbmRhcnlUaHJlYWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW1UeXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0LnNhbXBsZVJhdGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnB1dC5jb25maWcuY2hhbm5lbF9tYXNrLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQuY29uZmlnLmZvcm1hdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lQ291bnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRjaFJlY29yZC0+YnVmZmVyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRjaFJlY29yZC0+YnVmZmVyU2l6ZSgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0RmxhZ3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwbnMgLyogdGltZW91dCAqLywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lQ291bnRUb0JlUmVhZHkpOwotICAgICAgICAgICAgICAgIHN0YXR1cyA9IHBhdGNoVHJhY2stPmluaXRDaGVjaygpOwotICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICAgICAgQUxPR0UoIlNlY29uZGFyeSBvdXRwdXQgcGF0Y2hUcmFjayBpbml0IGZhaWxlZDogJWQiLCBzdGF0dXMpOwotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgdGVlUGF0Y2hlcy5wdXNoX2JhY2soe3BhdGNoUmVjb3JkLCBwYXRjaFRyYWNrfSk7Ci0gICAgICAgICAgICAgICAgc2Vjb25kYXJ5VGhyZWFkLT5hZGRQYXRjaFRyYWNrKHBhdGNoVHJhY2spOwotICAgICAgICAgICAgICAgIC8vIEluIGNhc2UgdGhlIGRvd25zdHJlYW0gcGF0Y2hUcmFjayBvbiB0aGUgc2Vjb25kYXJ5VGhyZWFkIHRlbXBvcmFyaWx5IG91dG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ICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxJQXVkaW9GbGluZ2VyQ2xpZW50PiYgY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxtZWRpYTo6SUF1ZGlvRmxpbmdlckNsaWVudD4mIGNsaWVudCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQpCiAgICAgOiBtQXVkaW9GbGluZ2VyKGF1ZGlvRmxpbmdlciksIG1QaWQocGlkKSwgbVVpZCh1aWQpLCBtQXVkaW9GbGluZ2VyQ2xpZW50KGNsaWVudCkKQEAgLTE5NzYsMTAgKzIwMTUsMTIgQEAKIAogLy8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogCi1zcDxtZWRpYTo6SUF1ZGlvUmVjb3JkPiBBdWRpb0ZsaW5nZXI6OmNyZWF0ZVJlY29yZChjb25zdCBDcmVhdGVSZWNvcmRJbnB1dCYgaW5wdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDcmVhdGVSZWNvcmRPdXRwdXQmIG91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1c190ICpzdGF0dXMpCitzdGF0dXNfdCBBdWRpb0ZsaW5nZXI6OmNyZWF0ZVJlY29yZChjb25zdCBtZWRpYTo6Q3JlYXRlUmVjb3JkUmVxdWVzdCYgX2lucHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWE6OkNyZWF0ZVJlY29yZFJlc3Bvbn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gZmxhZyB0aGVuIHRyeSBhZ2FpbiB3aXRob3V0IEZBU1QgZmxhZyBpZiB0aGF0IGZhaWxzLgpAQCAtMjA1NSw5ICsyMTAwLDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQucmlpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbklkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gRklYTUUgY29tcGFyZSB0byBBdWRpb1RyYWNrCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50VWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnB1dC5vcFBhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGpBdHRyaWJ1dGlvblNvdXJjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmlucHV0LmNvbmZpZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0LmZsYWdzLCAmb3V0cHV0LnNlbGVjdGVkRGV2aWNlSWQsICZwb3J0SWQpOwogICAgIGlmIChsU3RhdHVzICE9IE5PX0VSUk9SKSB7CkBAIC0yMDg0LDEwICsyMTI3LDkgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQuY29uZmlnLmZvcm1hdCwgaW5wdXQuY29uZmlnLmNoYW5uZWxfbWFzaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm91dHB1dC5mcmFtZUNvdW50LCBzZXNzaW9uSWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZvdXRwdXQubm90aWZpY2F0aW9uRnJhbWVDb3VudCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGluZ1BpZCwgY2xpZW50VWlkLCAmb3V0cHV0LmZsYWdzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsaW5nUGlkLCBhZGpBdHRyaWJ1dGlvblNvdXJjZSwgJm91dHB1dC5mbGFncywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQuY2xpZW50SW5mby5jbGllbnRUaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZsU3RhdHVzLCBwb3J0SWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0Lm9wUGFja2FnZU5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbFN0YXR1cywgcG9ydElkLCBpbnB1dC5tYXhTaGFyZWRBdWRpb0hpc3RvcnlNcyk7CiAgICAgICAgIExPR19BTFdBWVNfRkFUQUxfSUYoKGxTdGF0dXMgPT0gTk9fRVJST1IpICYmIChyZWNvcmRUcmFjayA9PSAwKSk7CiAKICAgICAgICAgLy8gbFN0YXR1cyA9PSBCQURfVFlQRSBtZWFucyBGQVNUIGZsYWcgd2FzIHJlamVjdGVkOiByZXF1ZXN0IGEgbmV3IGlucHV0IGZyb20KQEAgLTIxMTcsOCArMjE1OSw4IEBACiAgICAgb3V0cHV0LmJ1ZmZlcnMgPSByZWNvcmRUcmFjay0+Z2V0QnVmZmVycygpOwogICAgIG91dHB1dC5wb3J0SWQgPSBwb3J0SWQ7CiAKLSAgICAvLyByZXR1cm4gaGFuZGxlIHRvIGNsaWVudAotICAgIHJlY29yZEhhbmRsZSA9IG5ldyBSZWNvcmRIYW5kbGUocmVjb3JkVHJhY2sp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gICAgICAgICBtUGF0Y2hQYW5lbC5ub3RpZnlTdHJlYW1PcGVuZWQob3V0SHdEZXYsICpvdXRwdXQsICZwYXRjaCk7CisgICAgICAgICAgICBpZiAodGhyZWFkLT5pc01zZERldmljZSgpKSB7CisgICAgICAgICAgICAgICAgdGhyZWFkLT5zZXREb3duU3RyZWFtUGF0Y2goJnBhdGNoKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIHJldHVybiB0aHJlYWQ7CiAgICAgICAgIH0KICAgICB9CkBAIC0yNTQyLDIwICsyNTkyLDI4IEBACiAgICAgcmV0dXJuIDA7CiB9CiAKLXN0YXR1c190IEF1ZGlvRmxpbmdlcjo6b3Blbk91dHB1dChhdWRpb19tb2R1bGVfaGFuZGxlX3QgbW9kdWxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICpvdXRwdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fY29uZmlnX3QgKmNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxEZXZpY2VEZXNjcmlwdG9yQmFzZT4mIGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCAqbGF0ZW5jeU1zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190IGZsYWdzKQorc3RhdHVzX3QgQXVkaW9GbGluZ2VyOjpvcGVuT3V0cHV0KGNvbnN0IG1lZGlhOjpPcGVuT3V0cHV0UmVxdWVzdCYgcmVxdWVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWE6Ok9wZW5PdXRwdXRSZXNwb25zZSogcmVzcG9uc2UpCiB7CisgICAgYXVkaW9fbW9kdWxlX2hhbmRsZV90IG1vZHVsZSA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMoCisgICAg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WcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19kZXZpY2VzX3QgKmRldmljZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTdHJpbmc4JiBhZGRyZXNzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc291cmNlX3Qgc291cmNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW5wdXRfZmxhZ3NfdCBmbGFncykKK3N0YXR1c190IEF1ZGlvRmxpbmdlcjo6b3BlbklucHV0KGNvbnN0IG1lZGlhOjpPcGVuSW5wdXRSZXF1ZXN0JiByZXF1ZXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWE6Ok9wZW5JbnB1dFJlc3BvbnNlKiByZXNwb25zZSkKIHsKICAgICBNdXRleDo6QXV0b2xvY2sgX2wobUxvY2spOwogCi0gICAgaWYgKCpkZXZpY2VzID09IEFVRElPX0RFVklDRV9OT05FKSB7CisgICAgaWYgKHJlcXVlc3QuZGV2aWNlLnR5cGUgPT0gQVVESU9fREVWSUNFX05PTkUpIHsKICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKICAgICB9CiAKKyAgICBhdWRpb19pb19oYW5kbGVfdCBpbnB1dCA9IFZBTFVFX09SX1JFVFVSTl9TVEFUVVMoCisgICAgICAgICAgICBhaWRsMmxlZ2FjeV9pbnQzMl90X2F1ZGlvX2lvX2hhbmRsZV90KHJlcXVlc3QuaW5wdXQpKTsKKyAgICBhdWRpb19jb25maWdfdCBjb25maWcgPSBWQUxVRV9PUl9SRVRVUk5fU1RBVFVTKAorICAgICAgICAgICAgYWlkbDJsZWdhY3lfQXVkaW9Db25maWdfYXVkaW9fY29uZmlnX3QocmVxdWVzdC5jb25maWcpKTsKKyAgICBBdWRpb0RldmljZVR5cGVBZGRyIGRldmljZSA9IFZB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KGxlZ2FjeTJhaWRsX2F1ZGlvX2NvbmZpZ190X0F1ZGlvQ29uZmlnKGNvbmZpZykpOworICAgIHJlc3BvbnNlLT5kZXZpY2UgPSByZXF1ZXN0LmRldmljZTsKIAogICAgIGlmICh0aHJlYWQgIT0gMCkgewogICAgICAgICAvLyBub3RpZnkgY2xpZW50IHByb2Nlc3NlcyBvZiB0aGUgbmV3IGlucHV0IGNyZWF0aW9uCkBAIC0yNzcyLDcgKzI4NDksNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgKmlucHV0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fY29uZmlnX3QgKmNvbmZpZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2VzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nOCYgYWRkcmVzcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIqIGFkZHJlc3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zb3VyY2VfdCBzb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pbnB1dF9mbGFnc190IGZsYWdzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190IG91dHB1dERldmljZSwKQEAgLTI4MDIsNyArMjg3OSw3IEBACiAgICAgc3A8RGV2aWNlSGFsSW50ZXJmYWNl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RlcnMuCkBAIC0yODIwLDEzICsyODk3LDEzIEBACiAgICAgICAgIGF1ZGlvX2lzX2xpbmVhcl9wY20oY29uZmlnLT5mb3JtYXQpICYmCiAgICAgICAgIGF1ZGlvX2lzX2xpbmVhcl9wY20oaGFsY29uZmlnLmZvcm1hdCkgJiYKICAgICAgICAgKGhhbGNvbmZpZy5zYW1wbGVfcmF0ZSA8PSBBVURJT19SRVNBTVBMRVJfRE9XTl9SQVRJT19NQVggKiBjb25maWctPnNhbXBsZV9yYXRlKSAmJgotICAgICAgICAoYXVkaW9fY2hhbm5lbF9jb3VudF9mcm9tX2luX21hc2soaGFsY29uZmlnLmNoYW5uZWxfbWFzaykgPD0gRkNDXzgpICYmCi0gICAgICAgIChhdWRpb19jaGFubmVsX2NvdW50X2Zyb21faW5fbWFzayhjb25maWctPmNoYW5uZWxfbWFzaykgPD0gRkNDXzgpKSB7CisgICAgICAgIChhdWRpb19jaGFubmVsX2NvdW50X2Zyb21faW5fbWFzayhoYWxjb25maWcuY2hhbm5lbF9tYXNrKSA8PSBGQ0NfTElNSVQpICYmCisgICAgICAgIChhdWRpb19jaGFubmVsX2NvdW50X2Zyb21faW5fbWFzayhjb25maWctPmNoYW5uZWxfbWFzaykgPD0gRkNDX0xJTUlUKSkgewogICAgICAgICAvLyBGSVhNRSBkZXNjcmliZSB0aGUgY2hhbmdlIHByb3Bvc2VkIGJ5IEhBTCAoc2F2ZSBvbGQgdmFsdWVzIHNvIHdlIGNhbiBsb2cgdGhlbSBoZXJlKQogICAgICAgICBBTE9HVigib3BlbklucHV0X2woKSByZW9wZW5pbmcgd2l0aCBwcm9wb3NlZCBzYW1wbGluZyByYXRlIGFuZCBjaGFubmVsIG1hc2siKTsKICAgICAgICAgaW5TdHJlYW0uY2xlYXIoKTsKICAgICAgICAgc3RhdHVzID0gaW5Id0hhbC0+b3BlbklucHV0U3RyZWFtKAotICAgICAgICAgICAgICAgICppbnB1dCwgZGV2aWNlcywgJmhhbGNvbmZpZywgZmx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kLT5tU2FtcGxlUmF0ZSwKKyAgICAgICAgICAgICAgICAgICAgdHJhY2stPnNhbXBsZVJhdGUoKSwKKyAgICAgICAgICAgICAgICAgICAgdHJhY2stPmdldFNwZWVkKCkpOworICAgICAgICBmcmFtZUNvdW50ID0gc3RkOjptYXgoZnJhbWVDb3VudCwgbWluRnJhbWVDb3VudCk7CisKKyAgICAgICAgdXNpbmcgbmFtZXNwYWNlIHN0ZDo6Y2hyb25vX2xpdGVyYWxzOworICAgICAgICBhdXRvIGluQ2hhbm5lbE1hc2sgPSBhdWRpb19jaGFubmVsX21hc2tfb3V0X3RvX2luKHRyYWNrLT5jaGFubmVsTWFzaygpKTsKKyAgICAgICAgc3AgcGF0Y2hSZWNvcmQgPSBuZXcgUmVjb3JkVGhyZWFkOjpQYXRjaFJlY29yZChudWxscHRyIC8qIHRocmVhZCAqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFjay0+c2FtcGxlUmF0ZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluQ2hhbm5lbE1hc2ssCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2stPmZvcm1hdCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lQ291bnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbHB0ciAvKiBidWZmZXIgKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHNpemVfdCkwIC8qIGJ1ZmZlclNpemUgKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fSU5QVVRfRkxBR19ESVJFQ1QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMG5zIC8qIHRpbWVvdXQgKi8pOworICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBwYXRjaFJlY29yZC0+aW5pdENoZWNrKCk7CisgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKKyAgICAgICAgICAgIEFMT0dFKCJTZWNvbmRhcnkgb3V0cHV0IHBhdGNoUmVjb3JkIGluaXQgZmFpbGVkOiAlZCIsIHN0YXR1cyk7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIFRPRE86IFdlIGNvdWxkIGNoZWNrIGNvbXBhdGliaWxpdHkgb2YgdGhlIHNlY29uZGFyeVRocmVhZCB3aXRoIHRoZSBQYXRjaFRyYWNrCisgICAgICAgIC8vIGZvciBmYXN0IHVzYWdlOiB0aHJlYWQgaGFzIGZhc3QgbWl4ZXIsIHNhbXBsZSByYXRlIG1hdGNoZXMsIGV0Yy47CisgICAgICAgIC8vIGZvciBub3csIHdlIGV4Y2x1ZGUgZmFzdCB0cmFja3MgYnkgcmVtb3ZpbmcgdGhlIEZhc3QgZmxhZy4KKyAgICAgICAgY29uc3QgYXVkaW9fb3V0cHV0X2ZsYWdzX3Qgb3V0cHV0RmxhZ3MgPQorICAgICAgICAgICAgICAgIChhdWRpb19vdXRwdXRfZmxhZ3NfdCkodHJhY2stPmdldE91dHB1dEZsYWdzKCkgJiB+QVVESU9fT1VUUFVUX0ZMQUdfRkFTVCk7CisgICAgICAgIHNwIHBhdGNoVHJhY2sgPSBuZXcgUGxheWJhY2tUaHJlYWQ6OlBhdGNoVHJhY2soc2Vjb25kYXJ5VGhyZWFkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrLT5zdHJlYW1UeXBlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2stPnNhbXBsZVJhdGUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFjay0+Y2hhbm5lbE1hc2soKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFjay0+Zm9ybWF0KCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWVDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRjaFJlY29yZC0+YnVmZmVyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0Y2hSZWNvcmQtPmJ1ZmZlclNpemUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRGbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwbnMgLyogdGltZW91dCAqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcmFtZUNvdW50VG9CZVJlYWR5KTsKKyAgICAgICAgc3RhdHVzID0gcGF0Y2hUcmFjay0+aW5pdENoZWNrKCk7CisgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKKyAgICAgICAgICAgIEFMT0dFKCJTZWNvbmRhcnkgb3V0cHV0IHBhdGNoVHJhY2sgaW5pdCBmYWlsZWQ6ICVkIiwgc3RhdHVzKTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIHRlZVBhdGNoZXMucHVzaF9iYWNrKHtwYXRjaFJlY29yZCwgcGF0Y2hUcmFja30pOworICAgICAgICBzZWNvbmRhcnlUaHJlYWQtPmFkZFBhdGNoV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oImNyZWF0ZUVmZmVjdCBnb3Qgb3V0cHV0ICVkIiwgaW8pOwogICAgICAgICB9CiAKICAgICAgICAgTXV0ZXg6OkF1dG9sb2NrIF9sKG1Mb2NrKTsKIAogICAgICAgICBpZiAoc2Vzc2lvbklkID09IEFVRElPX1NFU1NJT05fREVWSUNFKSB7Ci0gICAgICAgICAgICBzcDxDbGllbnQ+IGNsaWVudCA9IHJlZ2lzdGVyUGlkKHBpZCk7CisgICAgICAgICAgICBzcDxDbGllbnQ+IGNsaWVudCA9IHJlZ2lzdGVyUGlkKGN1cnJlbnRQaWQpOwogICAgICAgICAgICAgQUxPR1YoIiVzIGRldmljZSB0eXBlICUjeCBhZGRyZXNzICVzIiwgX19mdW5jX18sIGRldmljZS5tVHlwZSwgZGV2aWNlLmdldEFkZHJlc3MoKSk7CiAgICAgICAgICAgICBoYW5kbGUgPSBtRGV2aWNlRWZmZWN0TWFuYWdlci5jcmVhdGVFZmZlY3RfbCgKLSAgICAgICAgICAgICAgICAgICAgJmRlc2MsIGRldmljZSwgY2xpZW50LCBlZmZlY3RDbGllbnQsIG1QYXRjaFBhbmVsLnBhdGNoZXNfbCgpLAotICAgICAgICAgICAgICAgICAgICBlbmFibGVkLCAmbFN0YXR1cywgcHJvYmUpOworICAgICAgICAgICAgICAgICAgICAmZGVzY091dCwgZGV2aWNlLCBjbGllbnQsIGVmZmVjdENsaWVudCwgbVBhdGNoUGFuZWwucGF0Y2hlc19sKCksCisgICAgICAgICAgICAgICAgICAgICZlbmFibGVkT3V0LCAmbFN0YXR1cywgcHJvYmUpOwogICAgICAgICAgICAgaWYgKGxTdGF0dXMgIT0gTk9fRVJST1IgJiYgbFN0YXR1cyAhPSBBTFJFQURZX0VYSVNUUykgewogICAgICAgICAgICAgICAgIC8vIHJlbW92ZSBsb2NhbCBzdHJvbmcgcmVmZXJlbmNlIHRvIENsaWVudCB3aXRoIG1DbGllbnRMb2NrIGhlbGQKICAgICAgICAgICAgICAgICBNdXRleDo6QXV0b2xvY2sgX2NsKG1DbGllbnRMb2NrKTsKICAgICAgICAgICAgICAgICBjbGllbnQuY2xlYXIoKTsKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgLy8gaGFuZGxlIG11c3QgYmUgdmFsaWQgaGVyZSwgYnV0IGNoZWNrIGFnYWluIHRvIGJlIHNhZmUuCi0gICAgICAgICAgICAgICAgaWYgKGhhbmRsZS5nZXQoKSAhPSBudWxscHRyICYmIGlkICE9IG51bGxwdHIpICppZCA9IGhhbmRsZS0+aWQoKTsKKyAgICAgICAgICAgICAgICBpZiAoaGFuZGxlLmdldCgpICE9IG51bGxwdHIpIGlkT3V0ID0gaGFuZGxlLT5pZCgpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgZ290byBSZWdpc3RlcjsKICAgICAgICAgfQpAQCAtMzU5Myw4ICszNzgxLDggQEAKICAgICAgICAgICAgIC8vIERldGVjdCBpZiB0aGUgZWZmZWN0IGlzIGNyZWF0ZWQgYWZ0ZXIgYW4gQXVkaW9SZWNvcmQgaXMgZGVzdHJveWVkLgogICAgICAgICAgICAgaWYgKGdldE9ycGhhbkVmZmVjdENoYWluX2woc2Vzc2lvbklkKS5nZXQoKSAhPSBudWxscHRyKSB7CiAgICAgICAgICAgICAgICAgQUxPR0UoIiVzOiBlZmZlY3QgJXMgd2l0aCBubyBzcGVjaWZpZWQgaW8gaGFuZGxlIGlzIGRlbmllZCBiZWNhdXNlIHRoZSBBdWRpb1JlY29yZCIKLSAgICAgICAgICAgICAgICAgICAgICAgICIgZm9yIHNlc3Npb24gJWQgbm8gbG9uZ2VyIGV4aXN0cyIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sIGRlc2MubmFtZSwgc2Vzc2lvbklkKTsKKyAgICAgICAgICAgICAgICAgICAgICAiIGZvciBzZXNzaW9uICVkIG5vIGxvbmdlciBleGlzdHMiLAorICAgICAgICAgICAgICAgICAgICAgIF9fZnVuY19fLCBkZXNjT3V0Lm5hbWUsIHNlc3Npb25JZCk7CiAgICAgICAgICAgICAgICAgbFN0YXR1cyA9IFBFUk1JU1NJT05fREVOSUVEOwogICAgICAgICAgICAgICAgIGdvdG8gRXhpdDsKICAgICAgICAgICAgIH0KQEAgLTM2MDgsMTcgKzM3OTYsMjcgQEAKICAgICAgICAgICAgIGlmIChpbyA9PSBBVURJT19JT19IQU5ETEVfTk9ORSAmJiBtUGxheWJhY2tUaHJlYWRzLnNpemUoKSA+IDApIHsKICAgICAgICAgICAgICAgICBpbyA9IG1QbGF5YmFja1RocmVhZHMua2V5QXQoMCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBBTE9HVigiY3JlYXRlRWZmZWN0KCkgZ290IGlvICVkIGZvciBlZmZlY3QgJXMiLCBpbywgZGVzYy5uYW1lKTsKKyAgICAgICAgICAgIEFMT0dWKCJjcmVhdGVFZmZlY3QoKSBnb3QgaW8gJWQgZm9yIGVmZmVjdCAlcyIsIGlvLCBkZXNjT3V0Lm5hbWUpOwogICAgICAgICB9IGVsc2UgaWYgKGNoZWNrUGxheWJhY2tUaHJlYWRfbChpbykgIT0gbnVsbHB0cikgewogICAgICAgICAgICAgLy8gYWxsb3cgb25seSBvbmUgZWZmZWN0IGNoYWluIHBlciBzZXNzaW9uSWQgb24gbVBsYXliYWNrVGhyZWFkcy4KICAgICAgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgbVBsYXliYWNrVGhyZWFkcy5zaXplKCk7IGkrKykgewogICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2lvX2hhbmRsZV90IGNoZWNrSW8gPSBtUGxheWJhY2tUaHJlYWRzLmtleUF0KGkpOwotICAgICAgICAgICAgICAgIGlmIChpbyA9PSBjaGVja0lvKSBjb250aW51ZTsKKyAgICAgICAgICAgICAgICBpZiAoaW8gPT0gY2hlY2tJbykgeworICAgICAgICAgICAgICAgICAgICBpZiAoaGFwdGljUGxheWJhY2tSZXF1aXJlZAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIG1QbGF5YmFja1RocmVhZHMudmFsdWVBdChpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLT5oYXB0aWNDaGFubmVsTWFzaygpID09IEFVRElPX0NIQU5ORUxfTk9ORSkgeworICAgICAgICAgICAgICAgICAgICAgICAgQUxPR0UoIiVzOiBoYXB0aWMgcGxheWJhY2sgdGhyZWFkIGlzIHJlcXVpcmVkIHdoaWxlIHRoZSByZXF1aXJlZCBwbGF5YmFjayAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGhyZWFkKGlvPSVkKSBkb2Vzbid0IHN1cHBvcnQiLCBfX2Z1bmNfXywgKGludClpbyk7CisgICAgICAgICAgICAgICAgICAgICAgICBsU3RhdHVzID0gQkFEX1ZBTFVFOworICAgICAgICAgICAgICAgICAgICAgICAgZ290byBFeGl0OworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBjb25zdCB1aW50MzJfdCBzZXNzaW9uVHlwZSA9CiAgICAgICAgICAgICAgICAgICAgICAgICBtUGxheWJhY2tUaHJlYWRzLnZhbHVlQXQoaSktPmhhc0F1ZGlvU2Vzc2lvbihzZXNzaW9uSWQpOwogICAgICAgICAgICAgICAgIGlmICgoc2Vzc2lvblR5cGUgJiBUaHJlYWRCYXNlOjpFRkZFQ1RfU0VTU0lPTikgIT0gMCkgewogICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXM6IGVmZmVjdCAlcyBpbyAlZCBkZW5pZWQgYmVjYXVzZSBzZXNzaW9uICVkIGVmZmVjdCBleGlzdHMgb24gaW8gJWQiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fZnVuY19fLCBkZXNjLm5hbWUsIChpbnQpaW8sIChpbnQpc2Vzc2lvbklkLCAoaW50KWNoZWNrSW8pOworICAgICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgZGVzY091dC5uYW1lLCAoaW50KSBpbywgKGludCkgc2Vzc2lvbklkLCAoaW50KSBjaGVja0lvKTsKICAgICAgICAgICAgICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIxMjMyMzc5NzQiKTsKICAgICAgICAgICAgICAgICAgICAgbFN0YXR1cyA9IEJBRF9WQUxVRTsKICAgICAgICAgICAgICAgICAgICAgZ290byBFeGl0OwpAQCAtMzY0NiwxOSArMzg0NCwzOCBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAKLSAgICAgICAgc3A8Q2xpZW50PiBjbGllbnQgPSByZWdpc3RlclBpZChwaWQpOworICAgICAgICBzcDxDbGllbnQ+IGNsaWVudCA9IHJlZ2lzdGVyUGlkKGN1cnJlbnRQaWQpOwogCiAgICAgICAgIC8vIGNyZWF0ZSBlZmZlY3Qgb24gc2VsZWN0ZWQgb3V0cHV0IHRocmVhZAogICAgICAgICBib29sIHBpbm5lZCA9ICFhdWRpb19pc19nbG9iYWxfc2Vzc2lvbihzZXNzaW9uSWQpICYmIGlzU2Vzc2lvbkFjcXVpcmVkX2woc2Vzc2lvbklkKTsKKyAgICAgICAgVGhyZWFkQmFzZSAqb3JpVGhyZWFkID0gbnVsbHB0cjsKKyAgICAgICAgaWYgKGhhcHRpY1BsYXliYWNrUmVxdWlyZWQgJiYgdGhyZWFkLT5oYXB0aWNDaGFubmVsTWFzaygpID09IEFVRElPX0NIQU5ORUxfTk9ORSkgeworICAgICAgICAgICAgVGhyZWFkQmFzZSAqaGFwdGljVGhyZWFkID0gaGFwdGljUGxheWJhY2tUaHJlYWRfbCgpOworICAgICAgICAgICAgaWYgKGhhcHRpY1RocmVhZCA9PSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgQUxPR0UoIiVzIGhhcHRpYyB0aHJlYWQgbm90IGZvdW5kIHdoaWxlIGl0IGlzIHJlcXVpcmVkIiwgX19mdW5jX18pOworICAgICAgICAgICAgICAgIGxTdGF0dXMgPSBJTlZBTElEX09QRVJBVElPTjsKKyAgICAgICAgICAgICAgICBnb3RvIEV4aXQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoaGFwdGljVGhyZWFkICE9IHRocmVhZCkgeworICAgICAgICAgICAgICAgIC8vIEZvcmNlIHRvIHVzZSBoYXB0aWMgdGhyZWFkIGZvciBoYXB0aWMtZ2VuZXJhdGluZyBlZmZlY3QuCisgICAgICAgICAgICAgICAgb3JpVGhyZWFkID0gdGhyZWFkOworICAgICAgICAgICAgICAgIHRocmVhZCA9IGhhcHRpY1RocmVhZDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogICAgICAgICBoYW5kbGUgPSB0aHJlYWQtPmNyZWF0ZUVmZmVjdF9sKGNsaWVudCwgZWZmZWN0Q2xpZW50LCBwcmlvcml0eSwgc2Vzc2lvbklkLAotICAgICAgICAgICAgICAgICZkZXNjLCBlbmFibGVkLCAmbFN0YXR1cywgcGlubmVkLCBwcm9iZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmRlc2NPdXQsICZlbmFibGVkT3V0LCAmbFN0YXR1cywgcGlubmVkLCBwcm9iZSk7CiAgICAgICAgIGlmIChsU3RhdHVzICE9IE5PX0VSUk9SICYmIGxTdGF0dXMgIT0gQUxSRUFEWV9FWElTVFMpIHsKICAgICAgICAgICAgIC8vIHJlbW92ZSBsb2NhbCBzdHJvbmcgcmVmZXJlbmNlIHRvIENsaWVudCB3aXRoIG1DbGllbnRMb2NrIGhlbGQKICAgICAgICAgICAgIE11dGV4OjpBdXRvbG9jayBfY2wobUNsaWVudExvY2spOwogICAgICAgICAgICAgY2xpZW50LmNsZWFyKCk7CiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAvLyBoYW5kbGUgbXVzdCBiZSB2YWxpZCBoZXJlLCBidXQgY2hlY2sgYWdhaW4gdG8gYmUgc2FmZS4KLSAgICAgICAgICAgIGlmICho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uQ29kZTo6U0VUX0FVRElPX1BPUlRfQ09ORklHOgorICAgICAgICBjYXNlIFRyYW5zYWN0aW9uQ29kZTo6U0VUX1JFQ09SRF9TSUxFTkNFRDoKKyAgICAgICAgICAgIEFMT0dXKCIlczogdHJhbnNhY3Rpb24gJWQgcmVjZWl2ZWQgZnJvbSBQSUQgJWQiLAorICAgICAgICAgICAgICAgICAgX19mdW5jX18sIGNvZGUsIElQQ1RocmVhZFN0YXRlOjpzZWxmKCktPmdldENhbGxpbmdQaWQoKSk7CisgICAgICAgICAgICAvLyByZXR1cm4gc3RhdHVzIG9ubHkgZm9yIG5vbiB2b2lkIG1ldGhvZHMKKyAgICAgICAgICAgIHN3aXRjaCAoY29kZSkgeworICAgICAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25Db2RlOjpTRVRfUkVDT1JEX1NJTEVOQ0VEOgorICAgICAgICAgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25Db2RlOjpTRVRfRUZGRUNUX1NVU1BFTkRFRDoKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElOVkFMSURfT1BFUkFUSU9OOworICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gRmFpbCBzaWxlbnRseSBpbiB0aGVzZSBjYXNlcy4KKyAgICAgICAgICAgIHJldHVybiBPSzsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKworICAgIC8vIG1ha2Ugc3VyZSB0aGUgZm9sbG93aW5nIHRyYW5zYWN0aW9ucyBjb21lIGZyb20gc3lzdGVtIGNvbXBvbmVudHMKKyAgICBzd2l0Y2ggKGNvZGUpIHsKKyAgICAgICAgY2FzZSBUcmFuc2FjdGlvbkNvZGU6OlNFVF9NQVNURVJfVk9MVU1FOgorICAgICAgICBjYXNlIFRyYW5zYWN0aW9uQ29kZTo6U0VUX01BU1RFUl9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X1JFQURZOgorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSU5WQUxJRF9PUEVSQVRJT047CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8vIEZhaWwgc2lsZW50bHkgaW4gdGhlc2UgY2FzZXMuCisgICAgICAgICAgICAgICAgcmV0dXJuIE9LOworICAgICAgICAgICAgfQorICAgICAgICB9IGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgYnJlYWs7CisgICAgfQorCisgICAgLy8gTGlzdCBvZiByZWxldmFudCBldmVudHMgdGhhdCB0cmlnZ2VyIGxvZyBtZXJnaW5nLgorICAgIC8vIExvZyBtZXJnaW5nIHNob3VsZCBhY3RpdmF0ZSBkdXJpbmcgYXVkaW8gYWN0aXZpdHkgb2YgYW55IGtpbmQuIFRoaXMgYXJlIGNvbnNpZGVyZWQgdGhlCisgICAgLy8gbW9zdCByZWxldmFudCBldmVudHMuCisgICAgLy8gVE9ETyBzaG91bGQgc2VsZWN0IG1vcmUgd2lzZWx5IHRoZSBpdGVtcyBmcm9tIHRoZSBsaXN0CisgICAgc3dpdGNoIChjb2RlKSB7CisgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25Db2RlOjpDUkVBVEVfVFJBQ0s6CisgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25Db2RlOjpDUkVBVEVfUkVDT1JEOgorICAgICAgICBjYXNlIFRyYW5zYWN0aW9uQ29kZTo6U0VUX01BU1RFUl9WT0xVTUU6CisgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25Db2RlOjpTRVRfTUFTVEVSX01VVEU6CisgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25Db2RlOjpTRVRfTUlDX01VVEU6CisgICAgICAgIGNhc2UgVHJhbnNhY3Rpb25Db2RlOjpTRVRfUEFSQU1FVEVSUzoKKyAgICAgICAg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wgICAgIHN0YXR1c190ICAgIGR1bXAoaW50IGZkLCBjb25zdCBWZWN0b3I8U3RyaW5nMTY+JiBhcmdzKTsKKyAgICBzdGF0aWMgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSBjaGVja0F0dHJpYnV0aW9uU291cmNlUGFja2FnZSgKKyAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgYXR0cmlidXRpb25Tb3VyY2UpOworCisgICAgc3RhdHVzX3QgZHVtcChpbnQgZmQsIGNvbnN0IFZlY3RvcjxTdHJpbmcxNj4mIGFyZ3MpIG92ZXJyaWRlOwogCiAgICAgLy8gSUF1ZGlvRmxpbmdlciBpbnRlcmZhY2UsIGluIGJpbmRlciBvcGNvZGUgb3JkZXIKLSAgICB2aXJ0dWFsIHNwPElBdWRpb1RyYWNrPiBjcmVhdGVUcmFjayhjb25zdCBDcmVhdGVUcmFja0lucHV0JiBpbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDcmVhdGVUcmFja091dHB1dCYgb3V0cHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1c190ICpzdGF0dXMpOworICAgIHN0YXR1c190IGNyZWF0ZVRyYWNrKGNvbnN0IG1lZGlhOjpDcmVhdGVUcmFja1JlcXVlc3QmIGlucHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhOjpDcmVhdGVUcmFja1Jlc3BvbnNlJiBvdXRwdXQpIG92ZXJyaWRlOwogCi0gICAgdmlydHVhbCBzcDxtZWRpYTo6SUF1ZGlvUmVjb3JkPiBjcmVhdGVSZWNvcmQoY29uc3QgQ3JlYXRlUmVjb3JkSW5wdXQmIGlucHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENyZWF0ZVJlY29yZE91dHB1dCYgb3V0cHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2NoYW5uZWxfbWFza190IGNoYW5uZWxNYXNrKSBjb25zdDsKIAotICAgIHZpcnR1YWwgc3RhdHVzX3Qgb3Blbk91dHB1dChhdWRpb19tb2R1bGVfaGFuZGxlX3QgbW9kdWxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCAqb3V0cHV0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19jb25maWdfdCAqY29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxEZXZpY2VEZXNjcmlwdG9yQmFzZT4mIGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgKmxhdGVuY3lNcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fb3V0cHV0X2ZsYWdzX3QgZmxhZ3MpOworICAgIHZpcnR1YWwgc3RhdHVzX3Qgb3Blbk91dHB1dChjb25zdCBtZWRpYTo6T3Blbk91dHB1dFJlcXVlc3QmIHJlcXVlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhOjpPcGVuT3V0cHV0UmVzcG9uc2UqIHJlc3BvbnNlKTsKIAogICAgIHZpcnR1YWwgYXVkaW9faW9faGFuZGxlX3Qgb3BlbkR1cGxpY2F0ZU91dHB1dChhdWRpb19pb19oYW5kbGVfdCBvdXRwdXQxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBvdXRwdXQyKTsKQEAgLTE5NiwxMyArMTk2LDggQEAKIAogICAgIHZpcnR1YWwgc3RhdHVzX3QgcmVzdG9yZU91dHB1dChhdWRpb19pb19oYW5kbGVfdCBvdXRwdXQpOwogCi0gICAgdmlydHVhbCBzdGF0dXNfdCBvcGVuSW5wdXQoYXVkaW9fbW9kdWxlX2hhbmRsZV90IG1vZHVsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCAqaW5wdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fY29uZmlnX3QgKmNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19kZXZpY2VzX3QgKmRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTdHJpbmc4JiBhZGRyZXNzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3NvdXJjZV90IHNvdXJjZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pbnB1dF9mbGFnc190IGZsYWdzKTsKKyAgICB2aXJ0dWFsIHN0YXR1c190IG9wZW5JbnB1dChjb25zdCBtZWRpYTo6T3BlbklucHV0UmVxdWVzdCYgcmVxdWVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYTo6T3BlbklucHV0UmVzcG9uc2UqIHJlc3BvbnNlKTsKIAogICAgIHZpcnR1YWwgc3RhdHVzX3QgY2xvc2VJbnB1dChhdWRpb19pb19oYW5kbGVfdCBpbnB1dCk7CiAKQEAgLTIzMSwxOSArMjI2LDggQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgcHJlZmVycmVkVHlwZUZsYWcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVmZmVjdF9kZXNjcmlwdG9yX3QgKmRlc2NyaXB0b3IpIGNvbnN0OwogCi0gICAgdmlydHVhbCBzcDxJRWZmZWN0PiBjcmVhdGVFZmZlY3QoCi0gICAgICAgICAgICAgICAgICAgICAgICBlZmZlY3RfZGVzY3JpcHRvcl90ICpwRGVzYywKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPElFZmZlY3RDbGllbnQ+JiBlZmZlY3RDbGllbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHByaW9yaXR5LAotICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgaW8sCi0gICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkLAotICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkciYgZGV2aWNlLAotICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nMTYmIG9wUGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICBwaWRfdCBwaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICBib29sIHByb2JlLAotICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzX3QgKnN0YXR1cyAvKm5vbi1OVUxMKi8sCi0gICAgICAgICAgICAgICAgICAgICAgICBpbnQgKmlkLAotICAgICAgICAgICAgICAgICAgICAgICAgaW50ICplbmFibGVkKTsKKyAgICB2aXJ0dWFsIHN0YXR1c190IGNyZWF0ZUVmZmVjdChjb25zdCBtZWRpYTo6Q3JlYXRlRWZmZWN0UmVxdWVzdCYgcmVxdWVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYTo6Q3JlYXRlRWZmZWN0UmVzcG9uc2UqIHJlc3BvbnNlKTsKIAogICAgIHZpcnR1YWwgc3RhdHVzX3QgbW92ZUVmZmVjdHMoYXVkaW9fc2Vzc2lvbl90IHNlc3Npb25JZCwgYXVkaW9faW9faGFuZGxlX3Qgc3JjT3V0cHV0LAogICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgZHN0T3V0cHV0KTsKQEAgLTI2NCw3ICsyNDgsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0IGF1ZGlvX3Bvc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bGllbnQgOiBwdWJsaWMgSUJpbmRlcjo6RGVhdGhSZWNpcGllbnQgewogICAgIHB1YmxpYzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOb3RpZmljYXRpb25DbGllbnQoY29uc3Qgc3A8QXVkaW9GbGluZ2VyPiYgYXVkaW9GbGluZ2VyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8SUF1ZGlvRmxpbmdlckNsaWVudD4mIGNsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPG1lZGlhOjpJQXVkaW9GbGluZ2VyQ2xpZW50PiYgY2xpZW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgdWlkKTsKICAgICAgICAgdmlydHVhbCAgICAgICAgICAgICB+Tm90aWZpY2F0aW9uQ2xpZW50KCk7CiAKLSAgICAgICAgICAgICAgICBzcDxJQXVkaW9GbGluZ2VyQ2xpZW50PiBhdWRpb0ZsaW5nZXJDbGllbnQoKSBjb25zdCB7IHJldHVybiBtQXVkaW9GbGluZ2VyQ2xpZW50OyB9CisgICAgICAgICAgICAgICAgc3A8bWVkaWE6OklBdWRpb0ZsaW5nZXJDbGllbnQ+IGF1ZGlvRmxpbmdlckNsaWVudCgpIGNvbnN0IHsgcmV0dXJuIG1BdWRpb0ZsaW5nZXJDbGllbnQ7IH0KICAgICAgICAgICAgICAgICBwaWRfdCBnZXRQaWQoKSBjb25zdCB7IHJldHVybiBtUGlkOyB9CiAgICAgICAgICAgICAgICAgdWlkX3QgZ2V0VWlkKCkgY29uc3QgeyByZXR1cm4gbVVpZDsgfQogCkBAIC01MDYsNyArNTE1LDcgQEAKICAgICAgICAgY29uc3Qgc3A8QXVkaW9GbGluZ2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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCogX2FpZGxfcmV0dXJuKSBvdmVycmlkZTsKKyAgICAgICAgYmluZGVyOjpTdGF0dXMgZ2V0VGltZXN0YW1wKG1lZGlhOjpBdWRpb1RpbWVzdGFtcEludGVybmFsKiB0aW1lc3RhbXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90KiBfYWlkbF9yZXR1cm4pIG92ZXJyaWRlOworICAgICAgICBiaW5kZXI6OlN0YXR1cyBzaWduYWwoKSBvdmVycmlkZTsKKyAgICAgICAgYmluZGVyOjpTdGF0dXMgYXBwbHlWb2x1bWVTaGFwZXIoY29uc3QgbWVkaWE6OlZvbHVtZVNoYXBlckNvbmZpZ3VyYXRpb24mIGNvbmZpZ3VyYXRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IG1lZGlhOjpWb2x1bWVTaGFwZXJPcGVyYXRpb24mIG9wZXJhdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCogX2FpZGxfcmV0dXJuKSBvdmVycmlkZTsKKyAgICAgICAgYmluZGVyOjpTdGF0dXMgZ2V0Vm9sdW1lU2hhcGVyU3RhdGUoCisgICAgICAgICAgICAgICAgaW50MzJfdCBpZCwKKyAgICAgICAgICAgICAgICBzdGQ6Om9wdGlvbmFsPG1lZGlhOjpWb2x1bWVTaGFwZXJTdGF0ZT4qIF9haWRsX3JldHVybikgb3ZlcnJpZGU7CisgICAgICAgIGJpbmRlcjo6U3RhdHVzIGdldER1YWxNb25vTW9kZShtZWRpYTo6QXVkaW9EdWFsTW9ub01vZGUqIF9haWRsX3JldHVybikgb3ZlcnJpZGU7CisgICAgICAgIGJpbmRlcjo6U3RhdHVzIHNldER1YWxNb25vTW9kZShtZWRpYTo6QXVkaW9EdWFsTW9ub01vZGUgbW9kZSkgb3ZlcnJpZGU7Cis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ICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAqYXR0ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90ICpoYW5kbGUpOwpAQCAtNzA0LDcgKzcyOCw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgKmlucHV0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2NvbmZpZ190ICpjb25maWcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190IGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTdHJpbmc4JiBhZGRyZXNzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIqIGFkZHJlc3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc291cmNlX3Qgc291cmNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lucHV0X2ZsYWdzX3QgZmxhZ3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190IG91dHB1dERldmljZSwKQEAgLTc1Niw2ICs3ODAsMTMgQEAKIAogICAgICAgICAgICAgICBzcDxUaHJlYWRCYXNlPiBnZXRFZmZlY3RUaHJlYWRfbChhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkLCBpbnQgZWZmZWN0SWQpOwogCisgICAgICAgICAgICAgIFRocmVhZEJhc2UgKmhhcHRpY1BsYXliYWNrVGhyZWFkX2woKSBjb25zdDsKKworICAgICAgICAgICAgICB2b2lkIHVwZGF0ZVNlY29uZGFyeU91dHB1dHNGb3JUcmFja19sKAorICAgICAgICAgICAgICAgICAgICAgIFBsYXliYWNrVGhyZWFkOjpUcmFjayogdHJhY2ssCisgICAgICAgICAgICAgICAgICAgICAgUGxheWJhY2tUaHJlYWQqIHRocmVhZCwKKyAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnZlY3RvcjxhdWRpb19pb19oYW5kbGVfdD4mIHNlY29uZGFyeU91dHB1dHMpIGNvbnN0OworCiAKICAgICAgICAgICAgICAgICB2b2lkICAgICAgICByZW1vdmVDbGllbnRfbChwaWRfdCBwaWQpOwogICAgICAgICAgICAgICAgIHZvaWQgICAgICAgIHJlbW92ZU5vdGlmaWNhdGlvbkNsaWVudChwaWRfdCBwaWQpOwpAQCAtNzgyLDcgKzgxMyw3IEBACiAKICAgICAgICAgICAgICAgICBzdGQ6OnZlY3Rvcjwgc3A8RWZmZWN0TW9kdWxlPiA+IHB1cmdlU3RhbGVFZmZlY3RzX2woKTsKIAotICAgICAgICAgICAgICAgIHZvaWQgYnJvYWNhc3RQYXJhbWV0ZXJzVG9SZWNvcmRUaHJlYWRzX2woY29uc3QgU3RyaW5nOCYga2V5VmFsdWVQYWlycyk7CisgICAgICAgICAgICAgICAgdm9pZCBicm9hZGNhc3RQYXJhbWV0ZXJzVG9SZWNvcmRUaHJlYWRzX2woY29uc3QgU3RyaW5nOCYga2V5VmFsdWVQYWlycyk7CiAgICAgICAgICAgICAgICAgdm9pZCB1cGRhdGVPdXREZXZpY2VzRm9yUmVjb3JkVGhyZWFkc19sKGNvbnN0IERldmljZURlc2NyaXB0b3JCYXNlVmVjdG9yJiBkZXZpY2VzKTsKICAgICAgICAgICAgICAgICB2b2lkIGZvcndhcmRQYXJhbWV0ZXJzVG9Eb3duc3RyZWFtUGF0Y2hlc19sKAogICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgdXBTdHJlYW0sIGNvbnN0IFN0cmluZzgmIGtleVZhbHVlUGFpcnMsCkBAIC05NjIsNyAr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ygpLT5yZXNldFZvbHVtZSgpOwogICAgICAgICBtU2V0Vm9sdW1lUmVlbnRyYW50VGlkID0gSU5WQUxJRF9QSUQ7CiAgICAgfQogCkBAIC0xMTQ4LDcgKzExODIsMTIgQEAKIHsKICAgICBpZiAoKG1EZXNjcmlwdG9yLmZsYWdzICYgRUZGRUNUX0ZMQUdfVFlQRV9NQVNLKSA9PSBFRkZFQ1RfRkxBR19UWVBFX1BSRV9QUk9DIHx8CiAgICAgICAgICAgICAgKG1EZXNjcmlwdG9yLmZsYWdzICYgRUZGRUNUX0ZMQUdfVFlQRV9NQVNLKSA9PSBFRkZFQ1RfRkxBR19UWVBFX1BPU1RfUFJPQykgewotICAgICAgICBtQ2FsbGJhY2stPnJlbW92ZUVmZmVjdEZyb21IYWwobUVmZmVjdEludGVyZmFjZSk7CisgICAgICAgIGlmICghbUFkZGVkVG9IYWwpIHsKKyAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKKyAgICAgICAgfQorCisgICAgICAgIGdldENhbGxiYWNrKCktPnJlbW92ZUVmZmVjdEZyb21IYWwobUVmZmVjdEludGVyZmFjZSk7CisgICAgICAgIG1BZGRlZFRvSGFsID0gZmFsc2U7CiAgICAgfQogICAgIHJldHVybiBOT19FUlJPUjsKIH0KQEAgLTExNjAsMTEgKzExOTksMTAgQEAKICAgICByZXR1cm4gcmVtYWluZGVyID09IDAgPyAwIDogZGl2aXNvciAtIHJlbWFpbmRlcjsKIH0KIAotc3RhdHVzX3QgQXVkaW9GbGluZ2VyOjpFZmZlY3RNb2R1bGU6OmNvbW1hbmQodWludDMyX3QgY21kQ29kZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGNtZFNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICpwQ21kRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90ICpyZXBseVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICpwUmVwbHlEYXRhKQorc3RhdHVzX3QgQXVkaW9GbGluZ2VyOjpFZmZlY3RNb2R1bGU6OmNvbW1hbmQoaW50MzJfdCBjbWRDb2RlLAorICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8dWludDhfdD4mIGNtZERhdGEsCisgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IG1heFJlcGx5U2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHVpbnQ4X3Q+KiByZXBseSkKIHsKICAgICBNdXRleDo6QXV0b2xvY2sgX2wobUxvY2spOwogICAgIEFMT0dWVigiY29tbWFuZCgpLCBjbWRDb2RlOiAlZCwgbUVmZmVjdEludGVyZmFjZTogJXAiLCBjbWRDb2RlLCBtRWZmZWN0SW50ZXJmYWNlLmdldCgpKTsKQEAgLTExNzUsNjMgKzEyMTMsNjggQEAKICAgICBpZiAobVN0YXR1cyAhPSBOT19FUlJPUikgewogICAgICAgICByZXR1cm4gbVN0YXR1czsKICAgICB9CisgICAgaWYgKG1heFJlcGx5U2l6ZSA8IDAgfHwgbWF4UmVwbHlTaXplID4gRUZGRUNUX1BBUkFNX1NJWkVfTUFYKSB7CisgICAgICAgIHJldHVybiAtRUlOVkFMOworICAgIH0KKyAgICBzaXplX3QgY21kU2l6ZSA9IGNtZERhdGEuc2l6ZSgpOworICAgIGNvbnN0IGVmZmVjdF9wYXJhbV90KiBwYXJhbSA9IGNtZFNpemUgPj0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gcmVpbnRlcnByZXRfY2FzdDxjb25zdCBlZmZlY3RfcGFyYW1fdCo+KGNtZERhdGEuZGF0YSgpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogbnVsbHB0cjsKICAgICBpZiAoY21kQ29kZSA9PSBFRkZFQ1RfQ01EX0dFVF9QQVJBTSAmJgotICAgICAgICAgICAgKHNpemVvZihlZmZlY3RfcGFyYW1fdCkgPiBjbWRTaXplIHx8Ci0gICAgICAgICAgICAgICAgICAgICgoZWZmZWN0X3BhcmFtX3QgKilwQ21kRGF0YSktPnBzaXplID4gY21kU2l6ZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSkpIHsKKyAgICAgICAgICAgIChwYXJhbSA9PSBudWxscHRyIHx8IHBhcmFtLT5wc2l6ZSA+IGNtZFNpemUgLSBzaXplb2YoZWZmZWN0X3BhcmFtX3QpKSkgewogICAgICAgICBhbmRyb2lkX2Vycm9yV3JpdGVMb2coMHg1MzRlNDU1NCwgIjMyNDM4NTk0Iik7CiAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiMzMwMDM4MjIiKTsKICAgICAgICAgcmV0dXJuIC1FSU5WQUw7CiAgICAgfQogICAgIGlmIChjbWRDb2RlID09IEVGRkVDVF9DTURfR0VUX1BBUkFNICYmCi0gICAgICAgICAgICAoKnJlcGx5U2l6ZSA8IHNpemVvZihlZmZlY3RfcGFyYW1fdCkgfHwKLSAgICAgICAgICAgICAgICAgICAgKChlZmZlY3RfcGFyYW1fdCAqKXBDbWREYXRhKS0+cHNpemUgPiAqcmVwbHlTaXplIC0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSkpIHsKKyAgICAgICAgICAgIChtYXhSZXBseVNpemUgPCBzaXplb2YoZWZmZWN0X3BhcmFtX3QpIHx8CisgICAgICAgICAgICAgICAgICAgcGFyYW0tPnBzaXplID4gbWF4UmVwbHlTaXplIC0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSkpIHsKICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIyOTI1MTU1MyIpOwogICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICB9CiAgICAgaWYgKGNtZENvZGUgPT0gRUZGRUNUX0NNRF9HRVRfUEFSQU0gJiYKLSAgICAgICAgKHNpemVvZihlZmZlY3RfcGFyYW1fdCkgPiAqcmVwbHlTaXplCi0gICAgICAgICAgfHwgKChlZmZlY3RfcGFyYW1fdCAqKXBDbWREYXRhKS0+cHNpemUgPiAqcmVwbHlTaXplCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHNpemVvZihlZmZlY3RfcGFyYW1fdCkKLSAgICAgICAgICB8fCAoKGVmZmVjdF9wYXJhbV90ICopcENtZERhdGEpLT52c2l6ZSA+ICpyZXBseVNpemUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSAoKGVmZmVjdF9wYXJhbV90ICopcENtZERhdGEpLT5wc2l6ZQotICAgICAgICAgIHx8IHJvdW5kVXBEZWx0YSgoKGVmZmVjdF9wYXJhbV90ICopcENtZERhdGEpLT5wc2l6ZSwgKHVpbnQzMl90KXNpemVvZihpbnQpKSA+Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqcmVwbHlTaXplCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHNpemVvZihlZmZlY3RfcGFyYW1fdCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gKChlZmZlY3RfcGFyYW1fdCAqKXBDbWREYXRhKS0+cHNpemUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gKChlZmZlY3RfcGFyYW1fdCAqKXBDbWREYXRhKS0+dnNpemUpKSB7CisgICAgICAgICAgICAoc2l6ZW9mKGVmZmVjdF9wYXJhbV90KSA+IG1heFJlcGx5U2l6ZQorICAgICAgICAgICAgICAgICAgICB8fCBwYXJhbS0+cHNpemUgPiBtYXhSZXBseVNpemUgLSBzaXplb2YoZWZmZWN0X3BhcmFtX3QpCisgICAgICAgICAgICAgICAgICAgIHx8IHBhcmFtLT52c2l6ZSA+IG1heFJlcGx5U2l6ZSAtIHNpemVvZihlZmZlY3RfcGFyYW1fdCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHBhcmFtLT5wc2l6ZQorICAgICAgICAgICAgICAgICAgICB8fCByb3VuZFVwRGVsdGEocGFyYW0tPnBzaXplLCAodWludDMyX3QpIHNpemVvZihpbnQpKSA+CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4UmVwbHlTaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHNpemVvZihlZmZlY3RfcGFyYW1fdCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gcGFyYW0tPnBzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHBhcmFtLT52c2l6ZSkpIHsKICAgICAgICAgQUxPR1YoIlx0TFZNX0VSUk9SIDogRUZGRUNUX0NNRF9HRVRfUEFSQU06IHJlcGx5IHNpemUgaW5jb25zaXN0ZW50Iik7CiAgICAgICAgICAgICAgICAgICAgICBhbmRyb2lkX2Vycm9yV3JpdGVMb2coMHg1MzRlNDU1NCwgIjMyNzA1NDM4Iik7CiAgICAgICAgIHJldHVybiAtRUlOVkFMOwogICAgIH0KICAgICBpZiAoKGNtZENvZGUgPT0gRUZGRUNUX0NNRF9TRVRfUEFSQU0KLSAgICAgICAgICAgIHx8IGNtZENvZGUgPT0gRUZGRUNUX0NNRF9TRVRfUEFSQU1fREVGRVJSRUQpICYmICAvLyBERUZFUlJFRCBub3QgZ2VuZXJhbGx5IHVzZWQKLSAgICAgICAgKHNpemVvZihlZmZlY3RfcGFyYW1fdCkgPiBjbWRTaXplCi0gICAgICAgICAgICB8fCAoKGVmZmVjdF9wYXJhbV90ICopcENtZERhdGEpLT5wc2l6ZSA+IGNtZFNpemUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBzaXplb2YoZWZmZWN0X3BhcmFtX3QpCi0gICAgICAgICAgICB8fCAoKGVmZmVjdF9wYXJhbV90ICopcENtZERhdGEpLT52c2l6ZSA+IGNtZFNpemUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBzaXplb2YoZWZmZWN0X3BhcmFtX3QpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gKChlZmZlY3RfcGFyYW1fdCAqKXBDbWREYXRhKS0+cHNpemUKLSAgICAgICAgICAgIHx8IHJvdW5kVXBEZWx0YSgoKGVmZmVjdF9wYXJhbV90ICopcENtZERhdGEpLT5wc2l6ZSwgKHVpbnQzMl90KXNpemVvZihpbnQpKSA+Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtZFNpemUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBzaXplb2YoZWZmZWN0X3BhcmFtX3QpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gKChlZmZlY3RfcGFyYW1fdCAqKXBDbWREYXRhKS0+cHNpemUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSAoKGVmZmVjdF9wYXJhbV90ICopcENtZERhdGEpLT52c2l6ZSkpIHsKKyAgICAgICAgICAgIHx8IGNtZENvZGUgPT0gRUZGRUNUX0NNRF9TRVRfUEFSQU1fREVGRVJSRUQpCisgICAgICAgICAgICAmJiAgLy8gREVGRVJSRUQgbm90IGdlbmVyYWxseSB1c2VkCisgICAgICAgICAgICAgICAgICAgIChwYXJhbSA9PSBudWxscHRyCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgcGFyYW0tPnBzaXplID4gY21kU2l6ZSAtIHNpemVvZihlZmZlY3RfcGFyYW1fdCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCBwYXJhbS0+dnNpemUgPiBjbWRTaXplIC0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBwYXJhbS0+cHNpemUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCByb3VuZFVwRGVsdGEocGFyYW0tPnBzaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodWludDMyX3QpIHNpemVvZihpbnQpKSA+CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbWRTaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gc2l6ZW9mKGVmZmVjdF9wYXJhbV90KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHBhcmFtLT5wc2l6ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHBhcmFtLT52c2l6ZSkpIHsKICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIzMDIwNDMwMSIpOwogICAgICAgICByZXR1cm4gLUVJTlZBTDsKICAgICB9CisgICAgdWludDMyX3QgcmVwbHlTaXplID0gbWF4UmVwbHlTaXplOworICAgIHJlcGx5LT5yZXNpemUocmVwbHlTaXplKTsKICAgICBzdGF0dXNfdCBzdGF0dXMgPSBtRWZmZWN0SW50ZXJmYWNlLT5jb21tYW5kKGNtZENvZGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbWRTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcENtZERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXBseVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwUmVwbHlEYXRhKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0X2Nhc3Q8dWludDhfdCo+KGNtZERhdGEuZGF0YSgpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZyZXBseVNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXBseS0+ZGF0YSgpKTsKKyAgICByZXBseS0+cmVzaXplKHN0YXR1cyA9PSBOT19FUlJPUiA/IHJlcGx5U2l6ZSA6IDApOwogICAgIGlmIChjbWRDb2RlICE9IEVGRkVDVF9DTURfR0VUX1BBUkFNICYmIHN0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICB1aW50MzJfdCBzaXplID0gKHJlcGx5U2l6ZSA9PSBOVUxMKSA/IDAgOiAqcmVwbHlTaXplOwogICAgICAgICBmb3IgKHNpemVfdCBpID0gMTsgaSA8IG1IYW5kbGVzLnNpemUoKTsgaSsrKSB7CiAgICAgICAgICAgICBFZmZlY3RIYW5kbGUgKmggPSBtSGFuZGxlc1tpXTsKICAgICAgICAgICAgIGlmIChoICE9IE5VTEwgJiYgIWgtPmRpc2Nvbm5lY3RlZCgpKSB7Ci0gICAgICAgICAgICAgICAgaC0+Y29tbWFuZEV4ZWN1dGVkKGNtZENvZGUsIGNtZFNpemUsIHBDbWREYXRhLCBzaXplLCBwUmVwbHlEYXRhKTsKKyAgICAgICAgICAgICAgICBoLT5jb21tYW5kR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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxJRWZmZWN0Q2xpZW50PiYgZWZmZWN0Q2xpZW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgcHJpb3JpdHkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPEF1ZGlvRmxpbmdlcjo6Q2xpZW50PiYgY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxtZWRpYTo6SUVmZmVjdENsaWVudD4mIGVmZmVjdENsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBwcmlvcml0eSkKICAgICA6IEJuRWZmZWN0KCksCiAgICAgbUVmZmVjdChlZmZlY3QpLCBtRWZmZWN0Q2xpZW50KGVmZmVjdENsaWVudCksIG1DbGllbnQoY2xpZW50KSwgbUNibGsoTlVMTCksCiAgICAgbVByaW9yaXR5KHByaW9yaXR5KSwgbUhhc0NvbnRyb2woZmFsc2UpLCBtRW5hYmxlZChmYWxzZSksIG1EaXNjb25uZWN0ZWQoZmFsc2UpCkBAIC0xNjM2LDIwICsxNzQyLDI0IEBACiAgICAgcmV0dXJuIG1DbGllbnQgPT0gMCB8fCBtQ2Jsa01lbW9yeSAhPSAwID8gT0sgOiBOT19NRU1PUlk7CiB9CiAKLXN0YXR1c190IEF1ZGlvRmxpbmdlcjo6RWZmZWN0SGFuZGxlOjplbmFibGUoKQorI2RlZmluZSBSRVRVUk4oY29kZSkgXAorICAqX2FpZGxfcmV0dXJuID0gKGNvZGUpOyBcCisgIHJldHVybiBTdGF0dXM6Om9rKCk7CisKK1N0YXR1cyBBdWRpb0ZsaW5nZXI6OkVmZmVjdEhhbmRsZTo6ZW5hYmxlKGludDMyX3QqIF9haWRsX3JldHVybikKIHsKICAgICBBdXRvTXV0ZXggX2wobUxvY2spOwog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0lGKCFjb252ZXJ0SU1lbW9yeVRvU2hhcmVkRmlsZVJlZ2lvbihtQ2Jsa01lbW9yeSwgX2FpZGxfcmV0dXJuKSk7CisgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKK30KKworU3RhdHVzIEF1ZGlvRmxpbmdlcjo6RWZmZWN0SGFuZGxlOjpjb21tYW5kKGludDMyX3QgY21kQ29kZSwKKyAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8dWludDhfdD4mIGNtZERhdGEsCisgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgbWF4UmVzcG9uc2VTaXplLAorICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3Rvcjx1aW50OF90PiogcmVzcG9uc2UsCisgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QqIF9haWRsX3JldHVybikKIHsKICAgICBBTE9HVlYoImNvbW1hbmQoKSwgY21kQ29kZTogJWQsIG1IYXNDb250cm9sOiAlZCwgbUVmZmVjdDogJXAiLAogICAgICAgICAgICAgY21kQ29kZSwgbUhhc0NvbnRyb2wsIG1FZmZlY3QudW5zYWZlX2dldCgpKTsKQEAgLTE3NjUsNDkgKzE4ODEsNDYgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiNjIwMTk5OTIiKTsKLSAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgICAgICAgICBSRVRVUk4oQkFEX1ZBTFVFKTsKICAgICB9CiAKICAgICBpZiAoY21kQ29kZSA9PSBFRkZFQ1RfQ01EX0VOQUJMRSkgewotICAgICAgICBpZiAoKnJlcGx5U2l6ZSA8IHNpemVvZihpbnQpKSB7CisgICAgICAgIGlmIChtYXhSZXNwb25zZVNpemUgPCBzaXplb2YoaW50KSkgewogICAgICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIzMjA5NTcxMyIpOwotICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICAgICAgICAgIFJFVFVSTihCQURfVkFMVUUpOwogICAgICAgICB9Ci0gICAgICAgICooaW50ICopcFJlcGx5RGF0YSA9IE5PX0VSUk9SOwotICAgICAgICAqcmVwbHlTaXplID0gc2l6ZW9mKGludCk7Ci0gICAgICAgIHJldHVybiBlbmFibGUoKTsKKyAgICAgICAgd3JpdGVUb0J1ZmZlcihOT19FUlJPUiwgcmVzcG9uc2UpOworICAgICAgICByZXR1cm4gZW5hYmxlKF9haWRsX3JldHVybik7CiAgICAgfSBlbHNlIGlmIChjbWRDb2RlID09IEVGRkVDVF9DTURfRElTQUJMRSkgewotICAgICAgICBpZiAoKnJlcGx5U2l6ZSA8IHNpemVvZihpbnQpKSB7CisgICAgICAgIGlmIChtYXhSZXNwb25zZVNpemUgPCBzaXplb2YoaW50KSkgewogICAgICAgICAgICAgYW5kcm9pZF9lcnJvcldyaXRlTG9nKDB4NTM0ZTQ1NTQsICIzMjA5NTcxMyIpOwotICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICAgICAgICAgIFJFVFVSTihCQURfVkFMVUUpOwogICAgICAgICB9Ci0gICAgICAgICooaW50ICopcFJlcGx5RGF0YSA9IE5PX0VSUk9SOwotICAgICAgICAqcmVwbHlTaXplID0gc2l6ZW9mKGludCk7Ci0gICAgICAgIHJldHVybiBkaXNhYmxlKCk7CisgICAgICAgIHdyaXRlVG9CdWZmZXIoTk9fRVJST1IsIHJlc3BvbnNlKTsKKyAgICAgICAgcmV0dXJuIGRpc2FibGUoX2FpZGxfcmV0dXJuKTsKICAgICB9CiAKICAgICBBdXRvTXV0ZXggX2wobUxvY2spOwogICAgIHNwPEVmZmVjdEJhc2U+IGVmZmVjdCA9IG1FZmZlY3QucHJvbW90ZSgpOwogICAgIGlmIChlZmZlY3QgPT0gMCB8fCBtRGlzY29ubmVjdGVkKSB7Ci0gICAgICAgIHJldHVybiBERUFEX09CSkVDVDsKKyAgICAgICAgUkVUVVJOKERFQURfT0JKRUNUKTsKICAgICB9CiAgICAgLy8gb25seSBnZXQgcGFyYW1ldGVyIGNvbW1hbmQgaXMgcGVybWl0dGVkIGZvciBhcHBsaWNhdGlvbnMgbm90IGNvbnRyb2xsaW5nIHRoZSBlZmZlY3QKICAgICBpZiAoIW1IYXNDb250cm9sICYmIGNtZENvZGUgIT0gRUZGRUNUX0NNRF9HRVRfUEFSQU0pIHsKLSAgICAgICAgcmV0dXJuIElOVkFMSURfT1BFUkFUSU9OOworICAgICAgICBSRVRVUk4oSU5WQUxJRF9PUEVSQVRJT04pOwogICAgIH0KIAogICAgIC8vIGhhbmRsZSBjb21tYW5kcyB0aGF0IGFyZSBub3QgZm9yd2FyZGVkIHRyYW5zcGFyZW50bHkgdG8gZWZmZWN0IGVuZ2luZQogICAgIGlmIChjbWRDb2RlID09IEVGRkVDVF9DTURfU0VUX1BBUkFNX0NPTU1JVCkgewogICAgICAgICBpZiAobUNsaWVudCA9PSAwKSB7Ci0gICAgICAgICAgICByZXR1cm4gSU5WQUxJRF9PUEVSQVRJT047CisgICAgICAgICAgICBSRVRVUk4oSU5WQUxJRF9PUEVSQVRJT04pOwogICAgICAgICB9CiAKLSAgICAgICAgaWYgKCpyZXBseVNpemUgPCBzaXplb2YoaW50KSkgeworICAgICAgICBpZiAobWF4UmVzcG9uc2VTaXplIDwgc2l6ZW9mKGludCkpIHsKICAgICAgICAgICAgIGFuZHJvaWRfZXJyb3JXcml0ZUxvZygweDUzNGU0NTU0LCAiMzIwOTU3MTMiKTsKLSAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgICAgICAgICBSRVRVUk4oQkFEX1ZBTFVFKTsKICAgICAgICAgfQotICAgICAgICAqKGludCAqKXBSZXBseURhdGEgPSBOT19FUlJPUjsKLSAgICAgICAgKnJlcGx5U2l6ZSA9IHNpemVvZihpbnQpOworICAgICAgICB3cml0ZVRvQnVmZmVyKE5PX0VSUk9SLCByZXNwb25zZSk7CiAKICAgICAgICAgLy8gTm8gbmVlZCB0byB0cnlsb2NrKCkgaGVyZSBhcyB0aGlzIGZ1bmN0aW9uIGlzIGV4ZWN1dGVkIGluIHRoZSBiaW5kZXIgdGhyZWFkIHNlcnZpbmcgYQogICAgICAgICAvLyBwYXJ0aWN1bGFyIGNsaWVudCBwcm9jZXNzOiAgbm8gcmlzayB0byBibG9jayB0aGUgd2hvbGUgbWVkaWEgc2VydmVyIHByb2Nlc3Mgb3IgbWl4ZXIKQEAgLTE4MjAsMTAgKzE5MzMsMTAgQEAKICAgICAgICAgICAgIHNlcnZlckluZGV4ID4gRUZGRUNUX1BBUkFNX0JVRkZFUl9TSVpFKSB7CiAgICAgICAgICAgICBtQ2Jsay0+c2VydmVySW5kZXggPSAwOwogICAgICAgICAgICAgbUNibGstPmNsaWVudEluZGV4ID0gMDsKLSAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgICAgICAgICBSRVRVUk4oQkFEX1ZBTFVFKTsKICAgICAgICAgfQogICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBOT19FUlJPUjsKLSAgICAgICAgZWZmZWN0X3BhcmFtX3QgKnBhcmFtID0gTlVMTDsKKyAgICAgICAgc3RkOjp2ZWN0b3I8dWludDhfdD4gcGFyYW07CiAgICAgICAgIGZvciAodWludDMyX3QgaW5kZXggPSBzZXJ2ZXJJbmRleDsgaW5kZXggPCBjbGllbnRJbmRleDspIHsKICAgICAgICAgICAgIGludCAqcCA9IChpbnQgKikobUJ1ZmZlciArIGluZGV4KTsKICAgICAgICAgICAgIGNvbnN0IGludCBzaXplID0gKnArKzsKQEAgLTE4MzUsMjMgKzE5NDgsMTYgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgLy8gY29weSB0byBsb2NhbCBtZW1vcnkgaW4gY2FzZSBvZiBjbGllbnQgY29ycnVwdGlvbiBiLzMyMjIwNzY5Ci0gICAgICAgICAgICBhdXRvICpuZXdQYXJhbSA9IChlZmZlY3RfcGFyYW1fdCAqKXJlYWxsb2MocGFyYW0sIHNpemUpOwotICAgICAgICAgICAgaWYgKG5ld1BhcmFtID09IE5VTEwpIHsKLSAgICAgICAgICAgICAgICBBTE9HVygiY29tbWFuZCgpOiBvdXQgb2YgbWVtb3J5Iik7Ci0gICAgICAgICAgICAgICAgc3RhdHVzID0gTk9fTUVNT1JZOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcGFyYW0gPSBuZXdQYXJhbTsKLSAgICAgICAgICAgIG1lbWNweShwYXJhbSwgcCwgc2l6ZSk7CisgICAgICAgICAgICBzdGQ6OmNvcHkocmVpbnRlcnByZXRfY2FzdDxjb25zdCB1aW50OF90Kj4ocCksCisgICAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDxjb25zdCB1aW50OF90Kj4ocCkgKyBzaXplLAorICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6YmFja19pbnNlcnRlcihwYXJhbSkpOwogCi0gICAgICAgICAgICBpbnQgcmVwbHkgPSAwOwotICAgICAgICAgICAgdWludDMyX3QgcnNpemUgPSBzaXplb2YocmVwbHkpOworICAgICAgICAgICAgc3RkOjp2ZWN0b3I8dWludDhfdD4gcmVwbHlCdWZmZXI7CiAgICAgICAgICAgICBzdGF0dXNfdCByZXQgPSBlZmZlY3QtPmNvbW1hbmQoRUZGRUNUX0NNRF9TRVRfUEFSQU0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcnNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZyZXBseSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihpbnQpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcmVwbHlCdWZmZXIpOworICAgICAgICAgICAgaW50IHJlcGx5ID0gKnJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgaW50Kj4ocmVwbHlCdWZmZXIuZGF0YSgpKTsKIAogICAgICAgICAgICAgLy8gdmVyaWZ5IHNoYXJlZCBtZW1vcnk6IHNlcnZlciBpbmRleCBzaG91bGRuJ3QgY2hhbmdlOyBjbGllbnQgaW5kZXggY2FuJ3QgZ28gYmFjay4KICAgICAgICAgICAgIGlmIChzZXJ2ZXJJbmRleCAhPSBtQ2Jsay0+c2VydmVySW5kZXgKQEAgLTE4NjQsMjEgKzE5NzAsMjQgQEAKICAgICAgICAgICAgIC8vIHN0b3AgYXQgZmlyc3QgZXJyb3IgZW5jb3VudGVyZWQKICAgICAgICAgICAgIGlmIChyZXQgIT0gTk9fRVJST1IpIHsKICAgICAgICAgICAgICAgICBzdGF0dXMgPSByZXQ7Ci0gICAgICAgICAgICAgICAgKihpbnQgKilwUmVwbHlEYXRhID0gcmVwbHk7CisgICAgICAgICAgICAgICAgd3JpdGVUb0J1ZmZlcihyZXBseSwgcmVzcG9uc2UpOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfSBlbHNlIGlmIChyZXBseSAhPSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgICooaW50ICopcFJlcGx5RGF0YSA9IHJlcGx5OworICAgICAgICAgICAgICAgIHdyaXRlVG9CdWZmZXIocmVwbHksIHJlc3BvbnNlKTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGluZGV4ICs9IHNpemU7CiAgICAgICAgIH0KLSAgICAgICAgZnJlZShwYXJhbSk7CiAgICAgICAgIG1DYmxrLT5zZXJ2ZXJJbmRleCA9IDA7CiAgICAgICAgIG1DYmxrLT5jbGllbnRJbmRleCA9IDA7Ci0gICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgICAgIFJFVFVSTihzdGF0dXMpOwogICAgIH0KIAotICAgIHJldHVybiBlZmZlY3QtPmNvbW1hbmQoY21kQ29kZSwgY21kU2l6ZSwgcENtZERhdGEsIHJlcGx5U2l6ZSwgcFJlcGx5RGF0YSk7CisgICAgc3RhdHVzX3Qgc3RhdHVzID0gZWZmZWN0LT5jb21tYW5kKGNtZENvZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtZERhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heFJlc3BvbnNlU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2UpOworICAgIFJFVFVSTihzdGF0dXMpOwogfQogCiB2b2lkIEF1ZGlvRmxpbmdlcjo6RWZmZWN0SGFuZGxlOjpzZXRDb250cm9sKGJvb2wgaGFzQ29udHJvbCwgYm9vbCBzaWduYWwsIGJvb2wgZW5hYmxlZCkKQEAgLTE4OTQsMTMgKzIwMDMsMTEgQEAKIH0KIAogdm9pZCBBdWRpb0ZsaW5nZXI6OkVmZmVjdEhhbmRsZTo6Y29tbWFuZEV4ZWN1dGVkKHVpbnQzMl90IGNtZENvZGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgY21kU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICpwQ21kRGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCByZXBseVNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAqcFJlcGx5RGF0YSkKKyAgICAgICAgICAgICAgICAgICAg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gICAgICAgICAgICB1aW50MzJfdCAqcmVwbHlTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICpwUmVwbHlEYXRhKTsKLSAgICB2aXJ0dWFsIHZvaWQgZGlzY29ubmVjdCgpOwotcHJpdmF0ZToKLSAgICAgICAgICAgIHZvaWQgZGlzY29ubmVjdChib29sIHVucGluSWZMYXN0KTsKLXB1YmxpYzoKLSAgICB2aXJ0dWFsIHNwPElNZW1vcnk+IGdldENibGsoKSBjb25zdCB7IHJldHVybiBtQ2Jsa01lbW9yeTsgfQotICAgIHZpcnR1YWwgc3RhdHVzX3Qgb25UcmFuc2FjdCh1aW50MzJfdCBjb2RlLCBjb25zdCBQYXJjZWwmIGRhdGEsCi0gICAgICAgICAgICBQYXJjZWwqIHJlcGx5LCB1aW50MzJfdCBmbGFncyk7CisgICAgYW5kcm9pZDo6YmluZGVyOjpTdGF0dXMgZW5hYmxlKGludDMyX3QqIF9haWRsX3JldHVybikgb3ZlcnJpZGU7CisgICAgYW5kcm9pZDo6YmluZGVyOjpTdGF0dXMgZGlzYWJsZShpbnQzMl90KiBfYWlkbF9yZXR1cm4pIG92ZXJyaWRlOworICAgIGFuZHJvaWQ6OmJpbmRlcjo6U3RhdHVzIGNvbW1hbmQoaW50MzJfdCBjbWRDb2RlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8dWludDhfdD4mIGNtZERhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IG1heFJlc3BvbnNlU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHVpbnQ4X3Q+KiByZXNwb25zZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QqIF9haWRsX3JldHVybikgb3ZlcnJpZGU7CisgICAgYW5kcm9pZDo6YmluZGVyOjpTdGF0dXMgZGlzY29ubmVjdCgpIG92ZXJyaWRlOworICAgIGFuZHJvaWQ6OmJpbmRlcjo6U3RhdHVzIGdldENibGsobWVkaWE6OlNoYXJlZEZpbGVSZWdpb24qIF9haWRsX3JldHVybikgb3ZlcnJpZGU7CiAKK3ByaXZhdGU6CisgICAgdm9pZCBkaXNjb25uZWN0KGJvb2wgdW5waW5JZkxhc3QpOwogCiAgICAgLy8gR2l2ZSBvciB0YWtlIGNvbnRyb2wgb2YgZWZmZWN0IG1vZHVsZQogICAgIC8vIC0gaGFzQ29udHJvbDogdHJ1ZSBpZiBjb250cm9sIGlzIGdpdmVuLCBmYWxzZSBpZiByZW1vdmVkCkBAIC0zNDksMTAgKzM1MSw4IEBACiAgICAgLy8gLSBlbmFibGVkOiBzdGF0ZSBvZiB0aGUgZWZmZWN0IHdoZW4gY29udHJvbCBpcyBwYXNzZWQKICAgICB2b2lkIHNldENvbnRyb2woYm9vbCBoYXNDb250cm9sLCBib29sIHNpZ25hbCwgYm9vbCBlbmFibGVkKTsKICAgICB2b2lkIGNvbW1hbmRFeGVjdXRlZCh1aW50MzJfdCBjbWRDb2RlLAotICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGNtZFNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAqcENtZERhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgcmVwbHlTaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgKnBSZXBseURhdGEpOworICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6dmVjdG9yPHVpbnQ4X3Q+JiBjbWREYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6dmVjdG9yPHVpbnQ4X3Q+JiByZXBseURhdGEpOwogICAgIHZvaWQgc2V0RW5hYmxlZChib29sIGVuYWJsZWQpOwogICAgIGJvb2wgZW5hYmxlZCgpIGNvbnN0IHsgcmV0dXJuIG1FbmFibG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TsgICAgICAgICAgICAgICAgICAgICAgLy8gY2xpZW50IGFwcGxpY2F0aW9uIHByaW9yaXR5IHRvIGNvbnRyb2wgdGhlIGVmZmVjdAotICAgIGJvb2wgbUhhc0NvbnRyb2w7ICAgICAgICAgICAgICAgICAgIC8vIHRydWUgaWYgdGhpcyBoYW5kbGUgaXMgY29udHJvbGxpbmcgdGhlIGVmZmVjdAotICAgIGJvb2wgbUVuYWJsZWQ7ICAgICAgICAgICAgICAgICAgICAgIC8vIGNhY2hlZCBlbmFibGUgc3RhdGU6IG5lZWRlZCB3aGVuIHRoZSBlZmZlY3QgaXMKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZXN0b3JlZCBhZnRlciBiZWluZyBzdXNwZW5kZWQKLSAgICBib29sIG1EaXNjb25uZWN0ZWQ7ICAgICAgICAgICAgICAgICAvLyBTZXQgdG8gdHJ1ZSBieSBkaXNjb25uZWN0KCkKKyAgICBNdXRleCBtTG9jazsgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHByb3RlY3RzIElFZmZlY3QgbWV0aG9kIGNhbGxzCisgICAgY29uc3Qgd3A8RWZmZWN0QmFzZT4gbUVmZmVjdDsgICAgICAgICAgICAvLyBwb2ludGVyIHRvIGNvbnRyb2xsZWQgRWZmZWN0TW9kdWxlCisgICAgY29uc3Qgc3A8bWVkaWE6OklFZmZlY3RDbGllbnQ+IG1FZmZlY3RDbGllbnQ7ICAvLyBjYWxsYmFjayBpbnRlcmZhY2UgZm9yIGNsaWVudCBub3RpZmljYXRpb25zCisgICAgLypjb25zdCovIHNwPENsaWVudD4gbUNsaWVudDsgICAgICAgICAgICAvLyBjbGllbnQgZm9yIHNoYXJlZCBtZW1vcnkgYWxsb2NhdGlvbiwgc2VlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAgIGRpc2Nvbm5lY3QoKQorICAgIHNwPElNZW1vcnk+IG1DYmxrTWVtb3J5OyAgICAgICAgICAgICAgICAgLy8gc2hhcmVkIG1lbW9yeSBmb3IgY29udHJvbCBibG9jaworICAgIGVmZmVjdF9wYXJhbV9jYmxrX3QqIG1DYmxrOyAgICAgICAgICAgICAgLy8gY29udHJvbCBibG9jayBmb3IgZGVmZXJyZWQgcGFyYW1ldGVyIHNldHRpbmcgdmlhCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzaGFyZWQgbWVtb3J5CisgICAgdWludDhfdCogbUJ1ZmZlcjsgICAgICAgICAgICAgICAgICAgICAgICAvLyBwb2ludGVyIHRvIHBhcmFtZXRlciBhcmVhIGluIHNoYXJlZCBtZW1vcnkKKyAgICBpbnQgbVByaW9yaXR5OyAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNsaWVudCBhcHBsaWNhdGlvbiBwcmlvcml0eSB0byBjb250cm9sIHRoZSBlZmZlY3QKKyAgICBib29sIG1IYXNDb250cm9sOyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRydWUgaWYgdGhpcyBoYW5kbGUgaXMgY29udHJvbGxpbmcgdGhlIGVmZmVjdAorICAgIGJvb2wgbUVuYWJsZWQ7ICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gY2FjaGVkIGVuYWJsZSBzdGF0ZTogbmVlZGVkIHdoZW4gdGhlIGVmZmVjdCBpcworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVzdG9yZWQgYWZ0ZXIgYmVpbmcgc3VzcGVuZGVkCisgICAgYm9vbCBtRGlzY29ubmVjdGVkOyAgICAgICAgICAgICAgICAgICAgICAvLyBTZXQgdG8gdHJ1ZSBieSBkaXNjb25uZWN0KCkKIH07CiAKIC8vIHRoZSBFZmZlY3RDaGFpbiBjbGFzcyByZXByZXNlbnRzIGEgZ3JvdXAgb2YgZWZmZWN0cyBhc3NvY2lhdGVkIHRvIG9uZSBhdWRpbyBzZXNzaW9uLgpAQCAtNDY3LDgg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ICAgICAgICAgICAgICBjb25zdCB3cDxUaHJlYWRCYXNlPiYgdGhyZWFkKQotICAgICAgICAgICAgOiBtQ2hhaW4ob3duZXIpIHsKLSAgICAgICAgICAgIHNldFRocmVhZCh0aHJlYWQpOworICAgICAgICAgICAgOiBtQ2hhaW4ob3duZXIpCisgICAgICAgICAgICAsIG1UaHJlYWQodGhyZWFkKQorICAgICAgICAgICAgLCBtQXVkaW9GbGluZ2VyKCpnQXVkaW9GbGluZ2VyKSB7CiAgICAgICAgIH0KIAogICAgICAgICBzdGF0dXNfdCBjcmVhdGVFZmZlY3RIYWwoY29uc3QgZWZmZWN0X3V1aWRfdCAqcEVmZmVjdFV1aWQsCkBAIC01MzQsNiArNTQ2LDcgQEAKICAgICAgICAgdWludDMyX3Qgc2FtcGxlUmF0ZSgpIGNvbnN0IG92ZXJyaWRlOwogICAgICAgICBhdWRpb19jaGFubmVsX21hc2tfdCBjaGFubmVsTWFzaygpIGNvbnN0IG92ZXJyaWRlOwogICAgICAgICB1aW50MzJfdCBjaGFubmVsQ291bnQoKSBjb25zdCBvdmVycmlkZTsKKyAgICAgICAgYXVkaW9fY2hhbm5lbF9tYXNrX3QgaGFwdGljQ2hhbm5lbE1hc2soKSBjb25zdCBvdmVycmlkZTsKICAgICAgICAgc2l6ZV90IGZyYW1lQ291bnQoKSBjb25zdCBvdmVycmlkZTsKICAgICAgICAgdWludDMyX3QgbGF0ZW5jeSgpIGNvbnN0IG92ZXJyaWRlOwogCkBAIC01NDYsMjUgKzU1OSwyMyBAQAogICAgICAgICB2b2lkIGNoZWNrU3VzcGVuZE9uRWZmZWN0RW5hYmxlZChjb25zdCBzcDxFZmZlY3RCYXNlPiYgZWZmZWN0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBlbmFibGVkLCBib29sIHRocmVhZExvY2tlZCkgb3ZlcnJpZGU7CiAgICAgICAgIHZvaWQgcmVzZXRWb2x1bWUoKSBvdmVycmlkZTsKLSAgICAgICAgdWludDM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IDEwMDY0NAotLS0gYS9zZXJ2aWNlcy9hdWRpb2ZsaW5nZXIvTW1hcFRyYWNrcy5oCisrKyBiL3NlcnZpY2VzL2F1ZGlvZmxpbmdlci9NbWFwVHJhY2tzLmgKQEAgLTI5LDggKzI5LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19jaGFubmVsX21hc2tfdCBjaGFubmVsTWFzaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNPdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgdWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IHBpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhbmRyb2lkOjpjb250ZW50OjpBdHRyaWJ1dGlvblNvdXJjZVN0YXRlJiBhdHRyaWJ1dGlvblNvdXJjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWRfdCBjcmVhdG9yUGlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkID0gQVVESU9fUE9SVF9IQU5ETEVfTk9ORSk7CiAgICAgdmlydHVhbCAgICAgICAgICAgICB+TW1hcFRyYWNrKCk7CmRpZmYgLS1naXQgYS9zZXJ2aWNlcy9hdWRpb2ZsaW5nZXIvT1dORVJTIGIvc2VydmljZXMvYXVkaW9mbGluZ2VyL09XTkVSUwppbmRleCBkMDJkOWUwLi4wMzRkMTYxIDEwMDY0NAotLS0gYS9zZXJ2aWNlcy9hdWRpb2ZsaW5nZXIvT1dORVJTCisrKyBiL3NlcnZpY2VzL2F1ZGlvZmxpbmdlci9PV05FUlMKQEAgLTEsNCArMSw0IEBACitna2FzdGVuQGdvb2dsZS5jb20KIGh1bmdhQGdvb2dsZS5jb20KIGptdHJpdmlAZ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wdXQgaW52b2x2ZWQgaW4gYW4gZW5kcG9pbnQuCisgICAgICAgICAgICBpZiAoIWVuZHBvaW50UGF0Y2gpIHsKKyAgICAgICAgICAgICAgICBmb3IgKGF1dG8mIGl0ZXIgOiBtUGF0Y2hlcykgeworICAgICAgICAgICAgICAgICAgICBpZiAoaXRlci5zZWNvbmQubUF1ZGlvUGF0Y2guc291cmNlc1swXS5leHQubWl4LmhhbmRsZSA9PSB0aHJlYWQtPmlkKCkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAhaXRlci5zZWNvbmQubUlzRW5kcG9pbnRQYXRjaCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXJhc2VQYXRjaChpdGVyLmZpcnN0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9IGJyZWFrOwpAQCAtNDEzLDEwICs0NDEsMTAgQEAKICAgICAgICAgKmhhbmRsZSA9IChhdWRpb19wYXRjaF9oYW5kbGVfdCkgbUF1ZGlvRmxpbmdlci5uZXh0VW5pcXVlSWQoQVVESU9fVU5JUVVFX0lEX1VTRV9QQVRDSCk7CiAgICAgICAgIG5ld1BhdGNoLm1IYWxIYW5kbGUgPSBoYWxIYW5kbGU7CiAgICAgICAgIG1BdWRpb0ZsaW5nZXIubURldmljZUVmZmVjdE1hbmFnZXIuY3JlYXRlQXVkaW9QYXRjaCgqaGFuZGxlLCBuZXdQYXRjaCk7Ci0gICAgICAgIG1QYXRjaGVzLmluc2VydChzdGQ6Om1ha2VfcGFpcigqaGFuZGxlLCBzdGQ6Om1vdmUobmV3UGF0Y2gpKSk7CiAgICAgICAgIGlmIChpbnNlcnRlZE1vZHVsZSAhPSBBVURJT19NT0RVTEVfSEFORExFX05PTkUpIHsKLSAgICAgICAgICAgIGFkZFNvZnR3YXJlUGF0Y2hUb0luc2VydGVkTW9kdWxlcyhpbnNl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sdDsKICAgICAgICAgflBhdGNoKCk7CiAgICAgICAgIFBhdGNoKGNvbnN0IFBhdGNoJiBvdGhlcikgbm9leGNlcHQgewpAQCAtMTY5LDYgKzE3Miw3IEBACiAgICAgICAgICAgICBtUGxheWJhY2sgPSBvdGhlci5tUGxheWJhY2s7CiAgICAgICAgICAgICBtUmVjb3JkID0gb3RoZXIubVJlY29yZDsKICAgICAgICAgICAgIG1UaHJlYWQgPSBvdGhlci5tVGhyZWFkOworICAgICAgICAgICAgbUlzRW5kcG9pbnRQYXRjaCA9IG90aGVyLm1Jc0VuZHBvaW50UGF0Y2g7CiAgICAgICAgIH0KICAgICAgICAgUGF0Y2goUGF0Y2gmJiBvdGhlcikgbm9leGNlcHQgeyBzd2FwKG90aGVyKTsgfQogICAgICAgICBQYXRjaCYgb3BlcmF0b3I9KFBhdGNoJiYgb3RoZXIpIG5vZXhjZXB0IHsKQEAgLTE4Myw2ICsxODcsNyBAQAogICAgICAgICAgICAgc3dhcChtUGxheWJhY2ssIG90aGVyLm1QbGF5YmFjayk7CiAgICAgICAgICAgICBzd2FwKG1SZWNvcmQsIG90aGVyLm1SZWNvcmQpOwogICAgICAgICAgICAgc3dhcChtVGhyZWFkLCBvdGhlci5tVGhyZWFkKTsKKyAgICAgICAgICAgIHN3YXAobUlzRW5kcG9pbnRQYXRjaCwgb3RoZXIubUlzRW5kcG9pbnRQYXRjaCk7CiAgICAgICAgIH0KIAogICAgICAgICBmcmllbmQgdm9pZCBzd2FwKFBhdGNoICZhLCBQYXRjaCAmYikgbm9leGNlcHQgewpAQCAtMjE3LDYgKzIyMiw3IEBACiAgICAgICAgIEVuZHBvaW50PFJlY29yZFRocmVhZCwgUmVjb3JkVGhyZWFkOjpQYXRjaFJlY29yZD4gbVJlY29yZDsKIAogICAgICAgICB3cDxUaHJlYWRCYXNlPiBtVGhyZWFkOworICAgICAgICBib29sIG1Jc0VuZHBvaW50UGF0Y2g7CiAgICAgfTsKIAogICAgIC8vIENhbGwgd2l0a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IYXNPcFBsYXlBdWRpbzsKLSAgICBjb25zdCB1aWRfdCBtVWlkOworICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUgbUF0dHJpYnV0aW9uU291cmNlOwogICAgIGNvbnN0IGludDMyX3QgbVVzYWdlOyAvLyBvbiBwdXJwb3NlIG5vdCBhdWRpb191c2FnZV90IGJlY2F1c2UgYWx3YXlzIGNoZWNrZWQgaW4gYXBwT3BzIGFzIGludDMyX3QKICAgICBjb25zdCBpbnQgbUlkOyAvLyBmb3IgbG9nZ2luZyBwdXJwb3NlcyBvbmx5Ci0gICAgY29uc3QgU3RyaW5nMTYgbU9wUGFja2FnZU5hbWU7CiB9OwogCiAvLyBwbGF5YmFjayB0cmFjawpAQCAtNzIsMTQgKzczLDE0IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPElNZW1vcnk+JiBzaGFyZWRCdWZmZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uSWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IGNyZWF0b3JQaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgYXR0cmlidXRpb25Tb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190IGZsYWdzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja190eXBlIHR5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkID0gQVVESU9fUE9SVF9IQU5ETEVfTk9ORSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyoqIGRlZmF1bHQgYmVoYXZpb3VyIGlzIHRvIHN0YXJ0IHdoZW4gdGhlcmUgYXJlIGFzIG1hbnkgZnJhbWVzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiByZWFkeSBhcyBwb3NzaWJsZSAoYWthLiBCdWZmZXIgaXMgZnVsbCkuICovCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCBmcmFtZUNvdW50VG9CZVJlYWR5ID0gU0laRV9NQVgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nIG9wUGFja2FnZU5hbWUgPSAiIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHNwZWVkID0gMS4wZik7CiAgICAgdmlydHVhbCAgICAgICAgICAgICB+VHJhY2soKTsKICAgICB2aXJ0dWFsIHN0YXR1c190ICAgIGluaXRDaGVjaygpIGNvbnN0OwogCkBAIC0xMTcsNiArMTE4LDEyIEBACiAgICAgICAgICAgICBpbnQgICAgICAgICBhdXhFZmZlY3RJZCgpIGNvbnN0IHsgcmV0dXJuIG1BdXhFZmZlY3RJZDsgfQogICAgIHZpcnR1YWwgc3RhdHVzX3QgICAgZ2V0VGltZXN0YW1wKEF1ZGlvVGltZXN0YW1wJiB0aW1lc3RhbXApOwogICAgICAgICAgICAgdm9pZCAgICAgICAgc2lnbmFsKCk7CisgICAgICAgICAgICBzdGF0dXNfdCAgICBnZXREdWFsTW9ub01vZGUoYXVkaW9fZHVhbF9tb25vX21vZGVfdCogbW9kZSk7CisgICAgICAgICAgICBzdGF0dXNfdCAgICBzZXREdWFsTW9ub01vZGUoYXVkaW9fZHVhbF9tb25vX21vZGVfdCBtb2RlKTsKKyAgICAgICAgICAgIHN0YXR1c190ICAgIGdldEF1ZGlvRGVzY3JpcHRpb25NaXhMZXZlbChmbG9hdCogbGV2ZWxkQik7CisgICAgICAgICAgICBzdGF0dXNfdCAgICBzZXRBdWRpb0Rlc2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CBzaG91bGQgYmUgc2V0IGFmdGVyIHF1ZXJ5aW5nIHZpYnJhdG9yIHNlcnZpY2UuICovCi0gICAgICAgICAgICB2b2lkICAgIHNldEhhcHRpY0ludGVuc2l0eShBdWRpb01peGVyOjpoYXB0aWNfaW50ZW5zaXR5X3QgaGFwdGljSW50ZW5zaXR5KSB7Ci0gICAgICAgICAgICAgICAgaWYgKEF1ZGlvTWl4ZXI6OmlzVmFsaWRIYXB0aWNJbnRlbnNpdHkoaGFwdGljSW50ZW5zaXR5KSkgeworICAgICAgICAgICAgdm9pZCAgICBzZXRIYXB0aWNJbnRlbnNpdHkob3M6OkhhcHRpY1NjYWxlIGhhcHRpY0ludGVuc2l0eSkgeworICAgICAgICAgICAgICAgIGlmIChvczo6aXNWYWxpZEhhcHRpY1NjYWxlKGhhcHRpY0ludGVuc2l0eSkpIHsKICAgICAgICAgICAgICAgICAgICAgbUhhcHRpY0ludGVuc2l0eSA9IGhhcHRpY0ludGVuc2l0eTsKLSAgICAgICAgICAgICAgICAgICAgc2V0SGFwdGljUGxheWJhY2tFbmFibGVkKG1IYXB0aWNJbnRlbnNpdHkgIT0gQXVkaW9NaXhlcjo6SEFQVElDX1NDQUxFX01VVEUpOworICAgICAgICAgICAgICAgICAgICBzZXRIYXB0aWNQbGF5YmFja0VuYWJsZWQobUhhcHRpY0ludGVuc2l0eSAhPSBvczo6SGFwdGljU2NhbGU6Ok1VVEUpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHNwPG9zOjpFeHRlcm5hbFZpYnJhdGlvbj4gZ2V0RXh0ZXJuYWxWaWJyYXRpb24oKSBjb25zdCB7IHJldHVybiBtRXh0ZXJuYWxWaWJyYXRpb247IH0KQEAgLTE4Myw2ICsxODIsOSBAQAogICAgICAgICAgICAgICAgICAgIG1BdWRpb1RyYWNrU2VydmVyUHJveHktPmdldFVuZGVycnVuRnJhbWVzKCkpOwogICAgICAgIH0KICAgICB9CisKKyAgICBhd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F5YmFja19yYXRlX3QgIG1QbGF5YmFja1JhdGVQYXJhbWV0ZXJzID0gQVVESU9fUExBWUJBQ0tfUkFURV9JTklUSUFMSVpFUjsKIAogcHJpdmF0ZToKICAgICB2b2lkICAgICAgICAgICAgICAgIGludGVyY2VwdEJ1ZmZlcihjb25zdCBBdWRpb0J1ZmZlclByb3ZpZGVyOjpCdWZmZXImIGJ1ZmZlcik7CkBAIC0yODgsNiArMzA0LDE0IEBACiAgICAgICAgIGZvciAoYXV0byYgdHAgOiBtVGVlUGF0Y2hlcykgeyBmKHRwLnBhdGNoVHJhY2spOyB9CiAgICAgfTsKIAorICAgIHNpemVfdCAgICAgICAgICAgICAgbVByZXNlbnRhdGlvbkNvbXBsZXRlRnJhbWVzID0gMDsgLy8gKFVzZWQgZm9yIE1peGVkIHRyYWNrcykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoZSBudW1iZXIgb2YgZnJhbWVzIHdyaXR0ZW4gdG8gdGhlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBhdWRpbyBIQUwgd2hlbiB0aGlzIHRyYWNrIGlzIGNvbnNpZGVyZWQgZnVsbHkgcmVuZGVyZWQuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBaZXJvIG1lYW5zIG5vdCBtb25pdG9yaW5nLgorICAgIGludDY0X3QgICAgICAgICAgICAgbVByZXNlbnRhdGlvbkNvbXBsZXRlVGltZU5zID0gMDsgLy8gKFVzZWQgZm9yIERpcmVjdCB0cmFja3MpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUaGUgdGltZSB3aGVuIHRoaXMgdHJhY2sgaXMgY29uc2lkZXJlZCBmdWxseSByZW5kZXJlZC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFplcm8gbWVhbnMgbm90IG1vbml0b3JpbmcuCisKICAgICAvLyBUaGUgZm9sbG93aW5nIGZp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ICAgIH07Ci0KLSAgICBzcDxSZWNvcmRBdWRpb09wQ2FsbGJhY2s+IG1PcENhbGxiYWNrOwotICAgIC8vIGNhbGxlZCBieSBSZWNvcmRBdWRpb09wQ2FsbGJhY2sgd2hlbiBPUF9SRUNPUkRfQVVESU8gaXMgdXBkYXRlZCBpbiBBcHBPcCBjYWxsYmFjawotICAgIC8vIGFuZCBpbiBvbkZpcnN0UmVmKCkKLSAgICB2b2lkIGNoZWNrUmVjb3JkQXVkaW8oKTsKLQotICAgIHN0ZDo6YXRvbWljX2Jvb2wgbUhhc09wUmVjb3JkQXVkaW87Ci0gICAgY29uc3QgdWlkX3QgbVVpZDsKLSAgICBjb25zdCBTdHJpbmcxNiBtUGFja2FnZTsKLX07Ci0KIC8vIHJlY29yZCB0cmFjawogY2xhc3MgUmVjb3JkVHJhY2sgOiBwdWJsaWMgVHJhY2tCYXNlIHsKIHB1YmxpYzoKQEAgLTY3LDExICszNSwxMSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgYnVmZmVyU2l6ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb25JZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgY3JlYXRvclBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgdWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlJiBhdHRyaWJ1dGlvblNvdXJjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW5wdXRfZmxhZ3NfdCBmbGFncywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tfdHlwZSB0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTdHJpbmcxNiYgb3BQYWNrYWdlTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCBwb3J0SWQgPSBBVURJT19QT1JUX0hBTkRMRV9OT05FKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCBwb3J0SWQgPSBBVURJT19QT1JUX0hBTkRMRV9OT05FLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHN0YXJ0RnJhbWVzID0gLTEpOwogICAgIHZpcnR1YWwgICAgICAgICAgICAgflJlY29yZFRyYWNrKCk7CiAgICAgdmlydHVhbCBzdGF0dXNfdCAgICBpbml0Q2hlY2soKSBjb25zdDsKIApAQCAtMTAzLDEyICs3MSwxNSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IHJldHVybiAobUZsYWdzICYgQVVESU9fSU5QVVRfRkxBR19ESVJFQ1QpICE9IDA7IH0KIAogICAgICAgICAgICAgdm9pZCAgICAgICAgc2V0U2lsZW5jZWQoYm9vbCBzaWxlbmNlZCkgeyBpZiAoIWlzUGF0Y2hUcmFjaygpKSBtU2lsZW5jZWQgPSBzaWxlbmNlZDsgfQotICAgICAgICAgICAgYm9vbCAgICAgICAgaXNTaWxlbmNlZCgpIGNvbnN0OworICAgICAgICAgICAgYm9vbCAgICAgICAgaXNTaWxlbmNlZCgpIGNvbnN0IHsgcmV0dXJuIG1TaWxlbmNlZDsgfQogCiAgICAgICAgICAgICBzdGF0dXNfdCAgICBnZXRBY3RpdmVNaWNyb3Bob25lcyhzdGQ6OnZlY3RvcjxtZWRpYTo6TWljcm9waG9uZUluZm8+KiBhY3RpdmVNaWNyb3Bob25lcyk7CiAKICAgICAgICAgICAgIHN0YXR1c190ICAgIHNldFByZWZlcnJlZE1pY3JvcGhvbmVEaXJlY3Rpb24oYXVkaW9fbWljcm9waG9uZV9kaXJlY3Rpb25fdCBkaXJlY3Rpb24pOwogICAgICAgICAgICAgc3RhdHVzX3QgICAgc2V0UHJlZmVycmVkTWljcm9waG9uZUZpZWxkRGltZW5zaW9uKGZsb2F0IHpvb20pOworICAgICAgICAgICAgc3RhdHVzX3QgICAgc2hhcmVBdWRpb0hpc3RvcnkoY29uc3Qgc3RkOjpzdHJpbmcmIHNoYXJlZEF1ZGlvUGFja2FnZU5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQ2NF90IHNoYXJlZEF1ZGlvU3RhcnRNcyk7CisgICAgICAgICAgICBpbnQzMl90ICAgICBzdGFydEZyYW1lcygpIHsgcmV0dXJuIG1TdGFydEZyYW1lczsgfQogCiAgICAgc3RhdGljICBib29sICAgICAgICBjaGVja1NlcnZlckxhdGVuY3lTdXBwb3J0ZWQoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1hdF90IGZvcm1hdCwgYXVkaW9faW5wdXRfZmxhZ3NfdCBmbGFncykgewpAQCAtMTQ3LDEwICsxMTgsOCBAQAogCiAgICAgICAgICAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TaWxlbmNlZDsKIAotICAgICAgICAgICAgLy8gdXNlZCB0byBlbmZvcmNlIE9QX1JFQ09SRF9BVURJTwotICAgICAgICAgICAgdWlkX3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVWlkOwotICAgICAgICAgICAgU3RyaW5nMTYgICAgICAgICAgICAgICAgICAgICAgICAgICBtT3BQYWNrYWdlTmFtZTsKLSAgICAgICAgICAgIHNwPE9wUmVjb3JkQXVkaW9Nb25pdG9yPiAgICAgICAgICAgbU9wUmVjb3JkQXVkaW9Nb25pdG9yOworICAgICAgICAgICAgc3RkOjpzdHJpbmcgICAgICAgICAgICAgICAgICAgICAgICBtU2hhcmVkQXVkaW9QYWNrYWdlTmFtZSA9IHt9OworICAgICAgICAgICAgaW50MzJfdCAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU3RhcnRGcmFtZXMgPSAt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EFVRElPX09VVFBVVF9GTEFHX0RJUkVDVCk7CisgICAgICAgIH0KKwogICAgICAgICB0cmFjayA9IG5ldyBUcmFjayh0aGlzLCBjbGllbnQsIHN0cmVhbVR5cGUsIGF0dHIsIHNhbXBsZVJhdGUsIGZvcm1hdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbE1hc2ssIGZyYW1lQ291bnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGxwdHIgLyogYnVmZmVyICovLCAoc2l6ZV90KTAgLyogYnVmZmVyU2l6ZSAqLywgc2hhcmVkQnVmZmVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uSWQsIGNyZWF0b3JQaWQsIHVpZCwgKmZsYWdzLCBUcmFja0Jhc2U6OlRZUEVfREVGQVVMVCwgcG9ydElkLAotICAgICAgICAgICAgICAgICAgICAgICAgICBTSVpFX01BWCAvKmZyYW1lQ291bnRUb0JlUmVhZHkqLywgb3BQYWNrYWdlTmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25JZCwgY3JlYXRvclBpZCwgYXR0cmlidXRpb25Tb3VyY2UsIHRyYWNrRmxhZ3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgIFRyYWNrQmFzZTo6VFlQRV9ERUZBVUxULCBwb3J0SWQsIFNJWkVfTUFYIC8qZnJhbWVDb3VudFRvQmVSZWFkeSovLCBzcGVlZCk7CiAKICAgICAgICAgbFN0YXR1cyA9IHRyYWNrICE9IDAgPyB0cmFjay0+aW5pdENoZWNrKCkgOiAoc3RhdHVzX3QpIE5PX01FTU9SWTsKICAgICAgICAgaWYgKGxTdGF0dXMgIT0gTk9fRVJST1IpIHsKQEAgLTI1MjksMTUgKzI2MDQsMTcgQEAKICAgICAgICAgICAgICAgICAgICAgdHJhY2stPnNoYXJlZEJ1ZmZlcigpICE9IDAgPyBUcmFjazo6RlNfRklMTEVEIDogVHJhY2s6OkZTX0ZJTExJTkc7CiAgICAgICAgIH0KIAotICAgICAgICBpZiAoKHRyYWNrLT5jaGFubmVsTWFzaygpICYgQVVESU9fQ0hBTk5FTF9IQVBUSUNfQUxMKSAhPSBBVURJT19DSEFOTkVMX05PTkUKLSAgICAgICAgICAgICAgICAmJiBtSGFwdGljQ2hhbm5lbE1hc2sgIT0gQVVESU9fQ0hBTk5FTF9OT05FKSB7CisgICAgICAgIHNwPEVmZmVjdENoYWluPiBjaGFpbiA9IGdldEVmZmVjdENoYWluX2wodHJhY2stPnNlc3Npb25JZCgpKTsKKyAgICAgICAgaWYgKG1IYXB0aWNDaGFubmVsTWFzayAhPSBBVURJT19DSEFOTkVMX05PTkUKKyAgICAgICAgICAgICAgICAmJiAoKHRyYWNrLT5jaGFubmVsTWFzaygpICYgQVVESU9fQ0hBTk5FTF9IQVBUSUNfQUxMKSAhPSBBVURJT19DSEFOTkVMX05PTkUKKyAgICAgICAgICAgICAgICAgICAgICAgIHx8IChjaGFpbiAhPSBudWxscHRyICYmIGNoYWluLT5jb250YWluc0hhcHRpY0dlbmVyYXRpbmdFZmZlY3RfbCgpKSkpIHsKICAgICAgICAgICAgIC8vIFVubG9jayBkdWUgdG8gVmlicmF0b3JTZXJ2aWNlIHdpbGwgbG9jayBmb3IgdGhpcyBjYWxsIGFuZCB3aWxsCiAgICAgICAgICAgICAvLyBjYWxsIFRyYWNrcy5tdXRlL3VubXV0ZSB3aGljaCBhbHNvIHJlcXVpcmUgdGhyZWFkJ3MgbG9jay4KICAgICAgICAgICAgIG1Mb2NrLnVubG9jaygpOwogICAgICAgICAgICAgY29uc3QgaW50IGludGVuc2l0eSA9IEF1ZGlvRmxpbmdlcjo6b25FeHRlcm5hbFZpYnJhdGlvblN0YXJ0KAogICAgICAgICAgICAgICAgICAgICB0cmFjay0+Z2V0RXh0ZXJuYWxWaWJyYXRpb24oKSk7CiAgICAgICAgICAgICBtTG9jay5sb2NrKCk7Ci0gICAgICAgICAgICB0cmFjay0+c2V0SGFwdGljSW50ZW5zaXR5KHN0YXRpY19jYXN0PEF1ZGlvTWl4ZXI6OmhhcHRpY19pbnRlbnNpdHlfdD4oaW50ZW5zaXR5KSk7CisgICAgICAgICAgICB0cmFjay0+c2V0SGFwdGljSW50ZW5zaXR5KHN0YXRpY19jYXN0PG9zOjpIYXB0aWNTY2FsZT4oaW50ZW5zaXR5KSk7CiAgICAgICAgICAgICAvLyBIYXB0aWMgcGxheWJhY2sgc2hvdWxkIGJlIGVuYWJsZWQgYnkgdmlicmF0b3Igc2VydmljZS4KICAgICAgICAgICAgIGlmICh0cmFjay0+Z2V0SGFwdGljUGxheWJhY2tFbmFibGVkKCkpIHsKICAgICAgICAgICAgICAgICAvLyBEaXNhYmxlIGhhcHRpYyBwbGF5YmFjayBvZiBhbGwgYWN0aXZlIHRyYWNrIHRvIGVuc3VyZSBvbmx5CkBAIC0yNTQ2LDEyICsyNjIzLDE2IEBACiAgICAgICAgICAgICAgICAgICAgIHQtPnNldEhhcHRpY1BsYXliYWNrRW5hYmxlZChmYWxzZSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBTZXQgaGFwdGljIGludGVuc2l0eSBmb3IgZWZmZWN0CisgICAgICAgICAgICBpZiAoY2hhaW4gIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgIGNoYWluLT5zZXRIYXB0aWNJbnRlbnNpdHlfbCh0cmFjay0+aWQoKSwgaW50ZW5zaXR5KTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfQogCiAgICAgICAgIHRyYWNrLT5tUmVzZXREb25lID0gZmFsc2U7Ci0gICAgICAgIHRyYWNrLT5tUHJlc2VudGF0aW9uQ29tcGxldGVGcmFtZXMgPSAwOworICAgICAgICB0cmFjay0+cmVzZXRQcmVzZW50YXRpb25Db21wbGV0ZSgpOwogICAgICAgICBtQWN0aXZlVHJhY2tzLmFkZCh0cmFjayk7Ci0gICAgICAgIHNwPEVmZmVjdENoYWluPiBjaGFpbiA9IGdldEVmZmVj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w4IEBACiAgICAgICAgICAgICAgICAgbG9nU3RyaW5nID0gTlVMTDsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgLy8gQ29sbGVjdCB0aW1lc3RhbXAgc3RhdGlzdGljcyBmb3IgdGhlIFBsYXliYWNrIFRocmVhZCB0eXBlcyB0aGF0IHN1cHBvcnQgaXQuCi0gICAgICAgICAgICBpZiAobVR5cGUgPT0gTUlYRVIKLSAgICAgICAgICAgICAgICAgICAgfHwgbVR5cGUgPT0gRFVQTElDQVRJTkcKLSAgICAgICAgICAgICAgICAgICAgfHwgbVR5cGUgPT0gRElSRUNUCi0gICAgICAgICAgICAgICAgICAgIHx8IG1UeXBlID09IE9GRkxPQUQpIHsgLy8gbm8gaW5kZW50YXRpb24KLSAgICAgICAgICAgIC8vIEdhdGhlciB0aGUgZnJhbWVzUmVsZWFzZWQgY291bnRlcnMgZm9yIGFsbCBhY3RpdmUgdHJhY2tzLAotICAgICAgICAgICAgLy8gYW5kIGFzc29jaWF0ZSB3aXRoIHRoZSBzaW5rIGZyYW1lcyB3cml0dGVuIG91dC4gIFdlIG5lZWQKLSAgICAgICAgICAgIC8vIHRoaXMgdG8gY29udmVydCB0aGUgc2luayB0aW1lc3RhbXAgdG8gdGhlIHRyYWNrIHRpbWVzdGFtcC4KLSAgICAgICAgICAgIGJvb2wga2VybmVsTG9jYXRpb25VcGRhdGUgPSBmYWxzZTsKLSAgICAgICAgICAgIEV4dGVuZGVkVGltZXN0YW1wIHRpbWVzdGFtcDsgLy8gdXNlIHByaXZhdGUgY29weSB0byBmZXRjaAotICAgICAgICAgICAgaWYgKG1TdGFuZGJ5KSB7Ci0gICAgICAgICAgICAgICAgbVRpbWVzdGFtcFZlcmlmaWVyLmRpc2NvbnRpbnVpdHkoKTsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAodGhyZWFkbG9vcF9nZXRIYWxUaW1lc3RhbXBfbCgmdGltZXN0YW1wKSA9PSBPSykgewotICAgICAgICAgICAgICAgIG1UaW1lc3RhbXBWZXJpZmllci5hZGQodGltZXN0YW1wLm1Qb3NpdGlvbltFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fS0VSTkVMXSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVzdGFtcC5tVGltZU5zW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdLAotICAgICAgICAgICAgICAgICAgICAgICAgbVNhbXBsZVJhdGUpOworICAgICAgICAgICAgY29sbGVjdFRpbWVzdGFtcHNfbCgpOwogCi0gICAgICAgICAgICAgICAgaWYgKGlzVGltZXN0YW1wQ29ycmVjdGlvbkVuYWJsZWQoKSkgewotICAgICAgICAgICAgICAgICAgICBBTE9HVigiVFNfQkVGT1JFOiAlZCAlbGxkICVsbGQiLCBpZCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChsb25nIGxvbmcpdGltZXN0YW1wLm1UaW1lTnNbRXh0ZW5kZWRUaW1lc3RhbXA6OkxPQ0FUSU9OX0tFUk5FTF0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKGxvbmcgbG9uZyl0aW1lc3RhbXAubVBvc2l0aW9uW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdKTsKLSAgICAgICAgICAgICAgICAgICAgYXV0byBjb3JyZWN0ZWRUaW1lc3RhbXAgPSBtVGltZXN0YW1wVmVyaWZpZXIuZ2V0TGFzdENvcnJlY3RlZFRpbWVzdGFtcCgpOwotICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXAubVBvc2l0aW9uW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPSBjb3JyZWN0ZWRUaW1lc3RhbXAubUZyYW1lczsKLSAgICAgICAgICAgICAgICAgICAgdGltZXN0YW1wLm1UaW1lTnNbRXh0ZW5kZWRUaW1lc3RhbXA6OkxPQ0FUSU9OX0tFUk5FTF0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IGNvcnJlY3RlZFRpbWVzdGFtcC5tVGltZU5zOwotICAgICAgICAgICAgICAgICAgICBBTE9HVigiVFNfQUZURVI6ICVkICVsbGQgJWxsZCIsIGlkKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKGxvbmcgbG9uZyl0aW1lc3RhbXAubVRpbWVOc1tFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fS0VSTkVMXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAobG9uZyBsb25nKXRpbWVzdGFtcC5tUG9zaXRpb25bRXh0ZW5kZWRUaW1lc3RhbXA6OkxPQ0FUSU9OX0tFUk5FTF0pOwotCi0gICAgICAgICAgICAgICAgICAgIC8vIE5vdGU6IERvd25zdHJlYW0gbGF0ZW5jeSBvbmx5IGFkZGVkIGlmIHRpbWVzdGFtcCBjb3JyZWN0aW9uIGVuYWJsZWQuCi0gICAgICAgICAgICAgICAgICAgIGlmIChtRG93bnN0cmVhbUxhdGVuY3lTdGF0TXMuZ2V0TigpID4gMCkgeyAvLyB3ZSBoYXZlIGxhdGVuY3kgaW5mby4KLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDY0X3QgbmV3UG9zaXRpb24gPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXAubVBvc2l0aW9uW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gaW50NjRfdChtRG93bnN0cmVhbUxhdGVuY3lTdGF0TXMuZ2V0TWVhbigpICogbVNhbXBsZVJhdGUgKiAxZS0zKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHByZXZlbnQgcmV0cm9ncmFkZQotICAgICAgICAgICAgICAgICAgICAgICAgdGltZXN0YW1wLm1Qb3NpdGlvbltFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fS0VSTkVMXSA9IG1heCgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3UG9zaXRpb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChtVGltZXN0YW1wLm1Qb3NpdGlvbltFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fS0VSTkVMXQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gbVN1c3BlbmRlZEZyYW1lcykpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgLy8gV2UgYWx3YXlzIGZldGNoIHRoZSB0aW1lc3RhbXAgaGVyZSBiZWNhdXNlIG9mdGVuIHRoZSBkb3duc3RyZWFtCi0gICAgICAgICAgICAgICAgLy8gc2luayB3aWxsIGJsb2NrIHdoaWxlIHdyaXRpbmcuCi0KLSAgICAgICAgICAgICAgICAvLyBXZSBrZWVwIHRyYWNrIG9mIHRoZSBsYXN0IHZhbGlkIGtlcm5lbCBwb3NpdGlvbiBpbiBjYXNlIHdlIGFyZSBpbiB1bmRlcnJ1bgotICAgICAgICAgICAgICAgIC8vIGFuZCB0aGUgbm9ybWFsIG1peGVyIHBlcmlvZCBpcyB0aGUgc2FtZSBhcyB0aGUgZmFzdCBtaXhlciBwZXJpb2QsIG9yIHRoZXJlCi0gICAgICAgICAgICAgICAgLy8gaXMgc29tZSBlcnJvciBmcm9tIHRoZSBIQUwuCi0gICAgICAgICAgICAgICAgaWYgKG1UaW1lc3RhbXAubVRpbWVOc1tFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fS0VSTkVMXSA+PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1UaW1lc3RhbXAubVBvc2l0aW9uW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxfTEFTVEtFUk5FTE9LXSA9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRpbWVzdGFtcC5tUG9zaXRpb25bRXh0ZW5kZWRUaW1lc3RhbXA6OkxPQ0FUSU9OX0tFUk5FTF07Ci0gICAgICAgICAgICAgICAgICAgIG1UaW1lc3RhbXAubVRpbWVOc1tFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fS0VSTkVMX0xBU1RLRVJORUxPS10gPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UaW1lc3RhbXAubVRpbWVOc1tFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fS0VSTkVMXTsKLQotICAgICAgICAgICAgICAgICAgICBtVGltZXN0YW1wLm1Qb3NpdGlvbltFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fU0VSVkVSX0xBU1RLRVJORUxPS10gPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UaW1lc3RhbXAubVBvc2l0aW9uW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9TRVJWRVJdOwotICAgICAgICAgICAgICAgICAgICBtVGltZXN0YW1wLm1UaW1lTnNbRXh0ZW5kZWRUaW1lc3RhbXA6OkxPQ0FUSU9OX1NFUlZFUl9MQVNUS0VSTkVMT0tdID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVGltZXN0YW1wLm1UaW1lTnNbRXh0ZW5kZWRUaW1lc3RhbXA6OkxPQ0FUSU9OX1NFUlZFUl07Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKHRpbWVzdGFtcC5tVGltZU5zW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdID49IDApIHsKLSAgICAgICAgICAgICAgICAgICAga2VybmVsTG9jYXRpb25VcGRhdGUgPSB0cnVlOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIEFMT0dWVigiZ2V0VGltZXN0YW1wIGVycm9yIC0gbm8gdmFsaWQga2VybmVsIHBvc2l0aW9uIik7Ci0gICAgICAgICA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1UaW1lc3RhbXAubVRpbWVOc1tFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fU0VSVkVSXSA9IG1MYXN0SW9CZWdpbk5zID09IC0xCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBzeXN0ZW1UaW1lKCkgOiBtTGFzdElvQmVnaW5OczsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IHNwPFRyYWNrPiAmdCA6IG1BY3RpdmVUcmFja3MpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCF0LT5pc0Zhc3RUcmFjaygpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0LT51cGRhdGVUcmFja0ZyYW1lSW5mbygKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC0+bUF1ZGlvVHJhY2tTZXJ2ZXJQcm94eS0+ZnJhbWVzUmVsZWFzZWQoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZyYW1lc1dyaXR0ZW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TYW1wbGVSYXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVGltZXN0YW1wKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKGF1ZGlvX2hhc19wcm9wb3J0aW9uYWxfZnJhbWVzKG1Gb3JtYXQpKSB7Ci0gICAgICAgICAgICAgICAgY29uc3QgZG91YmxlIGxhdGVuY3lNcyA9IG1UaW1lc3RhbXAuZ2V0T3V0cHV0U2VydmVyTGF0ZW5jeU1zKG1TYW1wbGVSYXRlKTsKLSAgICAgICAgICAgICAgICBpZiAobGF0ZW5jeU1zICE9IDAuKSB7IC8vIG5vdGUgMC4gbWVhbnMgdGltZXN0YW1wIGlzIGVtcHR5LgotICAgICAgICAgICAgICAgICAgICBtTGF0ZW5jeU1zLmFkZChsYXRlbmN5TXMpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgfSAvLyBpZiAobVR5cGUgLi4uICkgeyAvLyBubyBpbmRlbnRhdGlvbgotI2lmIDAKLSAgICAgICAgICAgIC8vIGxvZ0Zvcm1hdCBleGFtcGxlCi0gICAgICAgICAgICBpZiAoeiAlIDEwMCA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgdGltZXNwZWMgdHM7Ci0gICAgICAgICAgICAgICAgY2xvY2tfZ2V0dGltZShDTE9DS19NT05PVE9OSUMsICZ0cyk7Ci0gICAgICAgICAgICAgICAgTE9HVCgiVGhpcyBpcyBhbiBpbnRlZ2VyICVkLCB0aGlzIGlzIGEgZmxvYXQgJWYsIHRoaXMgaXMgbXkgIgotICAgICAgICAgICAgICAgICAgICAicGlkICVwICUlICVzICV0IiwgNDIsIDMuMTQsICJhbmQgdGhpcyBpcyBhIHRpbWVzdGFtcCIsIHRzKTsKLSAgICAgICAgICAgICAgICBMT0dUKCJBIGRlY2VwdGl2ZSBudWxsLXRlcm1pbmF0ZWQgc3RyaW5nICVcMCIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgKyt6OwotI2VuZGlmCiAgICAgICAgICAgICBzYXZlT3V0cHV0VHJhY2tzKCk7CiAgICAgICAgICAgICBpZiAobVNpZ25hbFBlbmRpbmcpIHsKICAgICAgICAgICAgICAgICAvLyBBIHNpZ25hbCB3YXMgcmFpc2VkIHdoaWxlIHdlIHdlcmUgdW5sb2NrZWQKQEAgLTM3MzgsOSArMzY5MywxNSBAQAogCiAgICAgICAgICAgICAvLyBEZXRlcm1pbmUgd2hpY2ggc2Vzc2lvbiB0byBwaWNrIHVwIGhhcHRpYyBkYXRhLgogICAgICAgICAgICAgLy8gVGhpcyBtdXN0IGJlIGRvbmUgdW5kZXIgdGhlIHNhbWUgbG9jayBhcyBwcmVwYXJlVHJhY2tzX2woKS4KKyAgICAgICAgICAgIC8vIFRoZSBoYXB0aWMgZGF0YSBmcm9tIHRoZSBlZmZlY3QgaXMgYXQgYSBoaWdoZXIgcHJpb3JpdHkgdGhhbiB0aGUgb25lIGZyb20gdHJhY2suCiAgICAgICAgICAgICAvLyBUT0RPOiBXcml0ZSBoYXB0aWMgZGF0YSBkaXJlY3RseSB0byBzaW5rIGJ1ZmZlciB3aGVuIG1peGluZy4KICAgICAgICAgICAgIGlmIChtSGFwdGljQ2hhbm5lbENvdW50ID4gMCAmJiBlZmZlY3RDaGFpbnMuc2l6ZSgpID4gMCkgewogICAgICAgICAgICAgICAgIGZvciAoY29uc3QgYXV0byYgdHJhY2sgOiBtQWN0aXZlVHJhY2tzKSB7CisgICAgICAgICAgICAgICAgICAgIHNwPEVmZmVjdENoYWluPiBlZmZlY3RDaGFpbiA9IGdldEVmZmVjdENoYWluX2wodHJhY2stPnNlc3Npb25JZCgpKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGVmZmVjdENoYWluICE9IG51bGxwdHIgJiYgZWZmZWN0Q2hhaW4tPmNvbnRhaW5zSGFwdGljR2VuZXJhdGluZ0VmZmVjdF9sKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGFjdGl2ZUhhcHRpY1Nlc3Npb25JZCA9IHRyYWNrLT5zZXNzaW9uSWQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGlmICh0cmFjay0+Z2V0SGFwdGljUGxheWJhY2tFbmFibGVkKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGl2ZUhhcHRpY1Nlc3Npb25JZCA9IHRyYWNrLT5zZXNzaW9uSWQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwpAQCAtNDA4Niw2ICs0MDQ3LDE0OCBAQAogICAgIHJldHVybiBmYWxzZTsKIH0KIAordm9pZCBBdWRpb0ZsaW5nZXI6OlBsYXliYWNrVGhyZWFkO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GFtcDo6TE9DQVRJT05fS0VSTkVMXQorICAgICAgICAgICAgICAgICAgICA9IGNvcnJlY3RlZFRpbWVzdGFtcC5tRnJhbWVzOworICAgICAgICAgICAgdGltZXN0YW1wLm1UaW1lTnNbRXh0ZW5kZWRUaW1lc3RhbXA6OkxPQ0FUSU9OX0tFUk5FTF0KKyAgICAgICAgICAgICAgICAgICAgPSBjb3JyZWN0ZWRUaW1lc3RhbXAubVRpbWVOczsKKyAgICAgICAgICAgIEFMT0dWVigiVFNfQUZURVI6ICVkICVsbGQgJWxsZCIsIGlkKCksCisgICAgICAgICAgICAgICAgICAgIChsb25nIGxvbmcpdGltZXN0YW1wLm1UaW1lTnNbRXh0ZW5kZWRUaW1lc3RhbXA6OkxPQ0FUSU9OX0tFUk5FTF0sCisgICAgICAgICAgICAgICAgICAgIChsb25nIGxvbmcpdGltZXN0YW1wLm1Qb3NpdGlvbltFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fS0VSTkVMXSk7CisKKyAgICAgICAgICAgIC8vIE5vdGU6IERvd25zdHJlYW0gbGF0ZW5jeSBvbmx5IGFkZGVkIGlmIHRpbWVzdGFtcCBjb3JyZWN0aW9uIGVuYWJsZWQuCisgICAgICAgICAgICBpZiAobURvd25zdHJlYW1MYXRlbmN5U3RhdE1zLmdldE4oKSA+IDApIHsgLy8gd2UgaGF2ZSBsYXRlbmN5IGluZm8uCisgICAgICAgICAgICAgICAgY29uc3QgaW50NjRfdCBuZXdQb3NpdGlvbiA9CisgICAgICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXAubVBvc2l0aW9uW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdCisgICAgICAgICAgICAgICAgICAgICAgICAtIGludDY0X3QobURvd25zdHJlYW1MYXRlbmN5U3RhdE1zLmdldE1lYW4oKSAqIG1TYW1wbGVSYXRlICogMWUtMyk7CisgICAgICAgICAgICAgICAgLy8gcHJldmVudCByZXRyb2dyYWRlCisgICAgICAgICAgICAgICAgdGltZXN0YW1wLm1Qb3NpdGlvbltFeHRlbmRlZFRpbWVzdGFtcDo6TE9DQVRJT05fS0VSTkVMXSA9IG1heCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ld1Bvc2l0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgKG1UaW1lc3RhbXAubVBvc2l0aW9uW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gbVN1c3BlbmRlZEZyYW1lcykpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gV2UgYWx3YXlzIGZldGNoIHRoZSB0aW1lc3RhbXAgaGVyZSBiZWNhdXNlIG9mdGVuIHRoZSBkb3duc3RyZWFtCisgICAgICAgIC8vIHNpbmsgd2lsbCBibG9jayB3aGlsZSB3cml0aW5nLgorCisgICAgICAgIC8vIFdlIGtlZXAgdHJhY2sgb2YgdGhlIGxhc3QgdmFsaWQga2VybmVsIHBvc2l0aW9uIGluIGNhc2Ugd2UgYXJlIGluIHVuZGVycnVuCisgICAgICAgIC8vIGFuZCB0aGUgbm9ybWFsIG1peGVyIHBlcmlvZCBpcyB0aGUgc2FtZSBhcyB0aGUgZmFzdCBtaXhlciBwZXJpb2QsIG9yIHRoZXJlCisgICAgICAgIC8vIGlzIHNvbWUgZXJyb3IgZnJvbSB0aGUgSEFMLgorICAgICAgICBpZiAobVRpbWVzdGFtcC5tVGltZU5zW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdID49IDApIHsKKyAgICAgICAgICAgIG1UaW1lc3RhbXAubVBvc2l0aW9uW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxfTEFTVEtFUk5FTE9LXSA9CisgICAgICAgICAgICAgICAgICAgIG1UaW1lc3RhbXAubVBvc2l0aW9uW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9L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odHJhY2stPmdldEV4dGVybmFsVmlicmF0aW9uKCkpOwogICAgICAgICAgICAgbUxvY2subG9jaygpOworCisgICAgICAgICAgICAvLyBXaGVuIHRoZSB0cmFjayBpcyBzdG9wLCBzZXQgdGhlIGhhcHRpYyBpbnRlbnNpdHkgYXMgTVVURQorICAgICAgICAgICAgLy8gZm9yIHRoZSBIYXB0aWNHZW5lcmF0b3IgZWZmZWN0LgorICAgICAgICAgICAgaWYgKGNoYWluICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgICAgICBjaGFpbi0+c2V0SGFwdGljSW50ZW5zaXR5X2wodHJhY2stPmlkKCksIHN0YXRpY19jYXN0PGludD4ob3M6OkhhcHRpY1NjYWxlOjpNVVRFKSk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiB9CkBAIC00MTMyLDIwICs0MjQyLDE1IEBACiAgICAgICAgIHJldHVybiBzdGF0dXM7CiAgICAgfQogICAgIGlmICgobVR5cGUgPT0gT0ZGTE9BRCB8fCBtVHlwZSA9PSBESVJFQ1QpICYmIG1PdXRwdXQgIT0gTlVMTCkgewotICAgICAgICB1aW50NjRfdCBwb3NpdGlvbjY0OwotICAgICAgICBpZiAobU91dHB1dC0+Z2V0UHJlc2VudGF0aW9uUG9zaXRpb24oJnBvc2l0aW9uNjQsICZ0aW1lc3RhbXAubVRpbWUpID09IE9LKSB7Ci0gICAgICAgICAgICB0aW1lc3RhbXAubVBvc2l0aW9uID0gKHVpbnQzMl90KXBvc2l0aW9uNjQ7Ci0gICAgICAgICAgICBpZiAobURvd25zdHJlYW1MYXRlbmN5U3RhdE1zLmdldE4oKSA+IDApIHsKLSAgICAgICAgICAgICAgICBjb25zdCB1aW50MzJfdCBwb3NpdGlvbk9mZnNldCA9Ci0gICAgICAgICAgICAgICAgICAgICh1aW50MzJfdCkobURvd25zdHJlYW1MYXRlbmN5U3RhdE1zLmdldE1lYW4oKSAqIG1TYW1wbGVSYXRlICogMWUtMyk7Ci0gICAgICAgICAgICAgICAgaWYgKHBvc2l0aW9uT2Zmc2V0ID4gdGltZXN0YW1wLm1Qb3NpdGlvbikgewotICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXAubVBvc2l0aW9uID0gMDsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXAubVBvc2l0aW9uIC09IHBvc2l0aW9uT2Zmc2V0OwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKKyAgICAgICAgY29sbGVjdFRpbWVzdGFtcHNfbCgpOworICAgICAgICBpZiAobVRpbWVzdGFtcC5tVGltZU5zW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdIDw9IDApIHsKKyAgICAgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKICAgICAgICAgfQorICAgICAgICB0aW1lc3RhbXAubVBvc2l0aW9uID0gbVRpbWVzdGFtcC5tUG9zaXRpb25bRXh0ZW5kZWRUaW1lc3RhbXA6OkxPQ0FUSU9OX0tFUk5FTF07CisgICAgICAgIGNvbnN0IGludDY0X3QgdGltZU5zID0gbVRpbWVzdGFtcC5tVGltZU5zW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdOworICAgICAgICB0aW1lc3RhbXAubVRpbWUudHZfc2VjID0gdGltZU5zIC8gTkFOT1NfUEVSX1NFQ09ORDsKKyAgICAgICAgdGltZXN0YW1wLm1UaW1lLnR2X25zZWMgPSB0aW1lTnMgLSAodGltZXN0YW1wLm1UaW1lLnR2X3NlYyAqIE5BTk9TX1BFUl9TRUNPTkQpOworICAgICAgICByZXR1cm4gTk9fRVJST1I7CiAgICAgfQogICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKIH0KQEAgLTQyMDUsNyArNDMxMCw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkVudW1lcmF0ZWQgZ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ubmVsIGNvdW50CiAgICAgICAgIHN0YXRlLT5tU2lua0NoYW5uZWxNYXNrID0gbUhhcHRpY0NoYW5uZWxNYXNrID09IEFVRElPX0NIQU5ORUxfTk9ORQotICAgICAgICAgICAgICAgID8gQVVESU9fQ0hBTk5FTF9OT05FIDogbUNoYW5uZWxNYXNrIHwgbUhhcHRpY0NoYW5uZWxNYXNrOworICAgICAgICAgICAgICAgID8gQVVESU9fQ0hBTk5FTF9OT05FCisgICAgICAgICAgICAgICAgOiBzdGF0aWNfY2FzdDxhdWRpb19jaGFubmVsX21hc2tfdD4obUNoYW5uZWxNYXNrIHwgbUhhcHRpY0NoYW5uZWxNYXNrKTsKICAgICAgICAgc3RhdGUtPm1Db21tYW5kID0gRmFzdE1peGVyU3RhdGU6OkNPTERfSURMRTsKICAgICAgICAgLy8gYWxyZWFkeSBkb25lIGluIGNvbnN0cnVjdG9yIGluaXRpYWxpemF0aW9uIGxpc3QKICAgICAgICAgLy9tRmFzdE1peGVyRnV0ZXggPSAwOwpAQCAtNTU0NCw4ICs1NjUxLDYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXNfdCYgc3RhdHVzKQogewogICAgIGJvb2wgcmVjb25maWcgPSBmYWxzZTsKLSAgICBib29sIGEyZHBEZXZpY2VDaGFuZ2VkID0gZmFsc2U7Ci0KICAgICBzdGF0dXMgPSBOT19FUlJPUjsKIAogICAgIEF1dG9QYXJrPEZhc3RNaXhlcj4gcGFyayhtRmFzdE1peGVyKTsKQEAgLTU2MTcsNyArNTcyMiw3IEBACiAgICAgICAgIH0KICAgICB9CiAKLSAgICByZXR1cm4gcmVjb25maWcgfHwgYTJkcERldmljZUNoYW5nZWQ7CisgICAgcmV0dXJuIHJlY29uZmlnOwogfQogCiAKQEAgLTU4MTgsOCArNTkyMywxNSBAQAogICAgICAgICBzcDxUcmFjaz4gbCA9IG1BY3RpdmVUcmFja3MuZ2V0TGF0ZXN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l90IHJldHJ5VGhyZXNob2xkID0gdGFyZ2V0UmV0cnlDb3VudCA+IDIgPyB0YXJnZXRSZXRyeUNvdW50IC0gMSA6IDE7CiAgICAgICAgIHVpbnQzMl90IG1pbkZyYW1lczsKICAgICAgICAgaWYgKCh0cmFjay0+c2hhcmVkQnVmZmVyKCkgPT0gMCkgJiYgIXRyYWNrLT5pc1N0b3BwaW5nXzEoKSAmJiAhdHJhY2stPmlzUGF1c2luZygpCi0gICAgICAgICAgICAmJiAodHJhY2stPm1SZXRyeUNvdW50ID4gMSkgJiYgYXVkaW9faGFzX3Byb3BvcnRpb25hbF9mcmFtZXMobUZvcm1hdCkpIHsKKyAgICAgICAgICAgICYmICh0cmFjay0+bVJldHJ5Q291bnQgPiByZXRyeVRocmVzaG9sZCkgJiYgYXVkaW9faGFzX3Byb3BvcnRpb25hbF9mcmFtZXMobUZvcm1hdCkpIHsKICAgICAgICAgICAgIG1pbkZyYW1lcyA9IG1Ob3JtYWxGcmFtZUNvdW50OwogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgbWluRnJhbWVzID0gMTsKQEAgLTU4OTMsNyArNjAxMyw3IEBACiAgICAgICAgICAgICAgICAgbVByZXZpb3VzVHJhY2sgPSB0cmFjazsKIAogICAgICAgICAgICAgICAgIC8vIHJlc2V0IHJldHJ5IGNvdW50Ci0gICAgICAgICAgICAgICAgdHJhY2stPm1SZXRyeUNvdW50ID0ga01heFRyYWNrUmV0cmllc0RpcmVjdDsKKyAgICAgICAgICAgICAgICB0cmFjay0+bVJldHJ5Q291bnQgPSB0YXJnZXRSZXRyeUNvdW50OwogICAgICAgICAgICAgICAgIG1BY3RpdmVUcmFjayA9IHQ7CiAgICAgICAgICAgICAgICAgbWl4ZXJTdGF0dXMgPSBNSVhFUl9UUkFDS1NfUkVBRFk7CiAgICAgICAgICAgICAgICAgaWYgKG1Id1BhdXNlZCkgewpAQCAtNTkxOCwxNiArNjAzOCw4IEBACiAgICAgICAgICAgICAgICAgICAgIHRyYWNrLT5pc1N0b3BwaW5nXzIoKSB8fCB0cmFjay0+aXNQYXVzZWQoKSkgewogICAgICAgICAgICAgICAgIC8vIFdlIGhhdmUgY29uc3VtZWQgYWxsIHRoZSBidWZmZXJzIG9mIHRoaXMgdHJhY2suCiAgICAgICAgICAgICAgICAgLy8gUmVtb3ZlIGl0IGZyb20gdGhlIGxpc3Qgb2YgYWN0aXZlIHRyYWNrcy4KLSAgICAgICAgICAgICAgICBzaXplX3QgYXVkaW9IQUxGcmFtZXM7Ci0gICAgICAgICAgICAgICAgaWYgKGF1ZGlvX2hhc19wcm9wb3J0aW9uYWxfZnJhbWVzKG1Gb3JtYXQpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGF1ZGlvSEFMRnJhbWVzID0gKGxhdGVuY3lfbCgpICogbVNhbXBsZVJhdGUpIC8gMTAwMDsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBhdWRpb0hBTEZyYW1lcyA9IDA7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaW50NjRfdCBmcmFtZXNXcml0dGVuID0gbUJ5dGVzV3JpdHRlbiAvIG1GcmFtZVNpemU7CiAgICAgICAgICAgICAgICAgaWYgKG1TdGFuZGJ5IHx8ICFsYXN0IHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICB0cmFjay0+cHJlc2VudGF0aW9uQ29tcGxldGUoZnJhbWVzV3JpdHRlbiwgYXVkaW9IQUxGcmFtZXMpIHx8CisgICAgICAgICAgICAgICAgICAgICAgICB0cmFjay0+cHJlc2VudGF0aW9uQ29tcGxldGUobGF0ZW5jeV9sKCkpIHx8CiAgICAgICAgICAgICAgICAgICAgICAgICB0cmFjay0+aXNQYXVzZWQoKSB8fCBtSHdQYXVzZWQpIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKHRyYWNrLT5pc1N0b3BwaW5nXzIoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2stPm1TdG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ewogICAgICAgICAgICAgICAgICAgICBkb0h3UGF1c2UgPSB0cnVlOwpAQCAtNjQ5NywyMyArNjYxMywxNyBAQAogICAgICAgICAgICAgICAgIC8vIERyYWluIGhhcyBjb21wbGV0ZWQgb3Igd2UgYXJlIGluIHN0YW5kYnksIHNpZ25hbCBwcmVzZW50YXRpb24gY29tcGxldGUKICAgICAgICAgICAgICAgICBpZiAoIShtRHJhaW5TZXF1ZW5jZSAmIDEpIHx8ICFsYXN0IHx8IG1TdGFuZGJ5KSB7CiAgICAgICAgICAgICAgICAgICAgIHRyYWNrLT5tU3RhdGUgPSBUcmFja0Jhc2U6OlNUT1BQRUQ7Ci0gICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGxhdGVuY3kgPSAwOwotICAgICAgICAgICAgICAgICAgICBzdGF0dXNfdCByZXN1bHQgPSBtT3V0cHV0LT5zdHJlYW0tPmdldExhdGVuY3koJmxhdGVuY3kpOwotICAgICAgICAgICAgICAgICAgICBBTE9HRV9JRihyZXN1bHQgIT0gT0ssCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIkVycm9yIHdoZW4gcmV0cmlldmluZyBvdXRwdXQgc3RyZWFtIGxhdGVuY3k6ICVkIiwgcmVzdWx0KTsKLSAgICAgICAgICAgICAgICAgICAgc2l6ZV90IGF1ZGlvSEFMRnJhbWVzID0gKGxhdGVuY3kgKiBtU2FtcGxlUmF0ZSkgLyAxMDAwOwotICAgICAgICAgICAgICAgICAgICBpbnQ2NF90IGZyYW1lc1dyaXR0ZW4gPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1CeXRlc1dyaXR0ZW4gLyBtT3V0cHV0LT5nZXRGcmFtZVNpemUoKTsKLSAgICAgICAgICAgICAgICAgICAgdHJhY2stPnByZXNlbnRhdGlvbkNvbXBsZXRlKGZyYW1lc1dyaXR0ZW4sIGF1ZGlvSEFMRnJhbWVzKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhY2stPnByZXNlbnRhdGlvbkNvbXBsZXRlKGxhdGVuY3lfbCgpKTsKICAgICAgICAgICAgICAgICAgICAgdHJhY2stPnJlc2V0KCk7CiAgICAgICAgICAgICAgICAgICAgIHRyYWNrc1RvUmVtb3ZlLT5hZGQodHJhY2spOwotICAgICAgICAgICAgICAgICAgICAvLyBESVJFQ1QgYW5kIE9GRkxPQURFRCBzdG9wIHJlc2V0cyBmcmFtZSBjb3VudHMuCisgICAgICAgICAgICAgICAgICAgIC8vIE9GRkxPQURFRCBzdG9wIHJlc2V0cyBmcmFtZSBjb3VudHMuCiAgICAgICAgICAgICAgICAgICAgIGlmICghbVVzZUFzeW5jV3JpdGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIHdlIGRvbid0IGdldCBleHBsaWNpdCBkcmFpbiBub3RpZmljYXRpb24gd2UgbXVzdAogICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVnaXN0ZXIgZGlzY29udGludWl0eSByZWdhcmRsZXNzIG9mIHdoZXRoZXIgdGhpcyBpcwogICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhlIHByZXZpb3VzICghbGFzdCkgb3IgdGhlIHVwY29taW5nIChsYXN0KSB0cmFjawogICAgICAgICAgICAgICAgICAgICAgICAgLy8gdG8gYXZvaWQgc2tpcHBpbmcgdGhlIGRpc2NvbnRpbnVpdHkuCi0gICAgICAgICAgICAgICAgICAgICAgICBtVGltZXN0YW1wVmVyaWZpZXIuZGlzY29udGludWl0eSgpOworICAgICAgICAgICAgICAgICAgICAgICAgbVRpbWVzdGFtcFZlcmlmaWVyLmRpc2NvbnRpbnVpdHkoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UaW1lc3RhbXBWZXJpZmllci5ESVNDT05USU5VSVRZX01PREVfWkVSTyk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9IGVsc2UgewpAQCAtNjc2MSwxMyArNjg3MSwyMCBAQAogICAgIC8vIGZyb20gZGlmZmVyZW50IE91dHB1dFRyYWNrcyBhbmQgdGhlaXIgYXNzb2NpYXRlZCBNaXhlclRocmVhZHMgKGUuZy4gb25lIG1heQogICAgIC8vIG5lYXJseSBlbXB0eSBhbmQgdGhlIG90aGVyIG1heSBiZSBkcm9wcGluZyBkYXRhKS4KIAorICAgIC8vIFRPRE8gYi8xODIzOTI3Njk6IHVzZSBhdHRyaWJ1dGlvbiBzb3VyY2UgdXRpbCwgbW92ZSB0byBzZXJ2ZXIgZWRnZQorICAgIEF0dHJpYnV0aW9uU291cmNlU3RhdGUgYXR0cmlidXRpb25Tb3VyY2UgPSBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlKCk7CisgICAgYXR0cmlidXRpb25Tb3VyY2UudWlkID0gVkFMVUVfT1JfRkFUQUwobGVnYWN5MmFpZGxfdWlkX3RfaW50MzJfdCgKKyAgICAgICAgSVBDVGhyZWFkU3RhdGU6OnNlbGYoKS0+Z2V0Q2FsbGluZ1VpZCgpKSk7CisgICAgYXR0cmlidXRpb25Tb3VyY2UucGlkID0gVkFMVUVfT1JfRkFUQUwobGVnYWN5MmFpZGxfcGlkX3RfaW50MzJfdCgKKyAgICAgIElQQ1RocmVhZFN0YXRlOjpzZWxmKCktPmdldENhbGxpbmdQaWQoKSkpOworICAgIGF0dHJpYnV0aW9uU291cmNlLnRva2VuID0gc3A8QkJpbmRlcj46Om1ha2UoKTsKICAgICBzcDxPdXRwdXRUcmFjaz4gb3V0cHV0VHJhY2sgPSBuZXcgT3V0cHV0VHJhY2sodGhyZWFkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU2FtcGxlUmF0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZvcm1hdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNoYW5uZWxNYXNrLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcmFtZUNvdW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJUENUaHJlYWRTdGF0ZTo6c2VsZigpLT5nZXRDYWxsaW5nVWlkKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGlvblNvdXJjZSk7CiAgICAgc3RhdHVzX3Qgc3RhdHVzID0gb3V0cHV0VHJhY2sgIT0gMCA/IG91dHB1dFRyYWNrLT5pbml0Q2hlY2soKSA6IChzdGF0dXNfdCkgTk9fTUVNT1JZOwogICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKICAgICAgICAgQUxPR0UoImFkZE91dHB1dFRyYWNrKCkgaW5pdENoZWNrIGZhaWxlZCAlZCIsIHN0YXR1cyk7CkBAIC02ODg3LDcgKzcwMDQsNyBAQAogICAgIHNucHJpbnRmKG1UaHJlYWROYW1lLCBrVGhyZWFkTmFtZUxlbmd0aCwgIkF1ZGlvSW5fJVgiLCBpZCk7CiAgICAgbU5CTG9nV3JpdGVyID0gYXVkaW9GbGluZ2VyLT5uZXdXcml0ZXJfbChrTG9nU2l6ZSwgbVRocmVhZE5hbWUpOwogCi0gICAgaWYgKG1JbnB1dCAhPSBudWxscHRyICYmIG1JbnB1dC0+YXVkaW9Id0RldiAhPSBudWxscHRyKSB7CisgICAgaWYgKG1JbnB1dC0+YXVkaW9Id0RldiAhPSBudWxscHRyKSB7CiAgICAgICAgIG1Jc01zZERldmljZSA9IHN0cmNtcCgKICAgICAgICAgICAgICAgICBtSW5wdXQtPmF1ZGlvSHdEZXYtPm1vZHVsZU5hbWUoKSwgQVVESU9fSEFSRFdBUkVfTU9EVUxFX0lEX01TRCkgPT0gMDsKICAgICB9CkBAIC03MTgyLDE5ICs3Mjk5LDI5IEBACiAgICAgICAgICAgICAgICAgICAgIC8vICAgIHRoZSBvbmx5IGFjdGl2ZSB0cmFjawogICAgICAgICAgICAgICAgICAgICAvLyAyKSBpbnZhbGlkYXRlIHRoaXMgdHJhY2s6IHRoaXMgd2lsbCBjYXVzZSB0aGUgY2xpZW50IHRvIHJlY29ubmVjdCBhbmQgcG9zc2libHkKICAgICAgICAgICAgICAgICAgICAgLy8gICAgYmUgaW52YWxpZGF0ZWQgYWdhaW4gdW50aWwgdW5zaWxlbmNlZAorICAgICAgICAgICAgICAgICAgICBib29sIGludmFsaWRhdGUgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgaWYgKGFjdGl2ZVRyYWNrLT5pc1NpbGVuY2VkKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzaXplID4gMSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGl2ZVRyYWNrLT5pbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR19BU1NFUlQoZmFzdFRyYWNrVG9SZW1vdmUgPT0gMCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFzdFRyYWNrVG9SZW1vdmUgPSBhY3RpdmVUcmFjazsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVUcmFja19sKGFjdGl2ZVRyYWNrKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aXZlVHJhY2tzLnJlbW92ZShhY3RpdmVUcmFjayk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZS0tOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaWxlbmNlRmFzdENhcHR1cmUgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIEludmFsaWRhdGUgZmFzdCB0cmFja3MgaWYgYWNjZXNzIHRvIGF1ZGlvIGhpc3RvcnkgaXMgcmVxdWlyZWQgYXMgdGhpcyBpcyBub3QKKyAgICAgICAgICAgICAgICAgICAgLy8gcG9zc2libGUgd2l0aCBmYXN0IHRyYWNrcy4gT25jZSB0aGUgZmFzdCB0cmFjayBoYXMgYmVlbiBpbnZhbGlkYXRlZCwgbm8gbmV3CisgICAgICAgICAgICAgICAgICAgIC8vIGZhc3QgdHJhY2sgd2lsbCBiZSBjcmVhdGVkIHVudGlsIG1NYXhTaGFyZWRBdWRpb0hpc3RvcnlNcyBpcyBjbGVhcmVkLgorICAgICAgICAgICAgICAgICAgICBpZiAobU1heFNoYXJlZEF1ZGlvSGlzdG9yeU1zICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChpbnZhbGlkYXRlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBhY3RpdmVUcmFjay0+aW52YWxpZGF0ZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgQUxPR19BU1NFUlQoZmFzdFRyYWNrVG9SZW1vdmUgPT0gMCk7CisgICAgICAgICAgICAgICAgICAgICAgICBmYXN0VHJhY2tUb1JlbW92ZSA9IGFjdGl2ZVRyYWNrOworICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlVHJhY2tfbChhY3RpdmVUcmFjayk7CisgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aXZlVHJhY2tzLnJlbW92ZShhY3RpdmVUcmFjayk7CisgICAgICAgICAgICAgICAgICAgICAgICBzaXplLS07CisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBmYXN0VHJhY2sgPSBhY3RpdmVUcmFjazsKICA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pc2NvbnRpbnVpdHkoYXVkaW9faXNfbGluZWFyX3BjbShtRm9ybWF0KSA/CisgICAgICAgICAgICAgICAgICAgIG1UaW1lc3RhbXBWZXJpZmllci5ESVNDT05USU5VSVRZX01PREVfQ09OVElOVU9VUyA6CisgICAgICAgICAgICAgICAgICAgIG1UaW1lc3RhbXBWZXJpZmllci5ESVNDT05USU5VSVRZX01PREVfWkVSTyk7CiAgICAgICAgICAgICB9IGVsc2UgaWYgKG1Tb3VyY2UtPmdldENhcHR1cmVQb3NpdGlvbigmcG9zaXRpb24sICZ0aW1lKSA9PSBOT19FUlJPUgogICAgICAgICAgICAgICAgICAgICAmJiB0aW1lID4gbVRpbWVzdGFtcC5tVGltZU5zW0V4dGVuZGVkVGltZXN0YW1wOjpMT0NBVElPTl9LRVJORUxdKSB7CiAKQEAgLTczNzksMTIgKzc1MDgsMTIgQEAKIAogICAgICAgICAgICAgICAgIC8vIENvcnJlY3QgdGltZXN0YW1wcwogICAgICAgICAgICAgICAgIGlmIChpc1RpbWVzdGFtcENvcnJlY3Rpb25FbmFibGVkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgQUxPR1YoIlRTX0JFRk9SRTogJWQgJWxsZCAlbGxkIiwKKyAgICAgICAgICAgICAgICAgICAgQUxPR1ZWKCJUU19CRUZPUkU6ICVkICVsbGQgJWxsZCIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQoKSwgKGxvbmcgbG9uZyl0aW1lLCAobG9uZyBsb25nKXBvc2l0aW9uKTsKICAgICAgICAgICAgICAgICAgICAgYXV0byBjb3JyZWN0ZWRUaW1lc3RhbXAgPSBtVGltZXN0YW1wVmVyaWZpZXIuZ2V0TGFzdENvcnJlY3RlZFRpbWVzdGFtcCgpOwogICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbiA9IGNvcnJlY3RlZFRpbWVzdGFtcC5tRnJhbWVzOwogICAgICAgICAgICAgICAgICAgICB0aW1lID0gY29ycmVjdGVkVGltZXN0YW1wLm1UaW1lTnM7Ci0gICAgICAgICAgICAgICAgICAgIEFMT0dWKCJUU19BRlRFUjogJWQgJWxsZCAlbGxkIiwKKyAgICAgICAgICAgICAgICAgICAgQUxPR1ZWKCJUU19BRlRFUjogJWQgJWxsZCAlbGxkIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZCgpLCAobG9uZyBsb25nKXRpbWUsIChsb25nIGxvbmcpcG9zaXRpb24pOwogICAgICAgICAgICAgICAgIH0KIApAQCAtNzQzNCw3ICs3NTYzLDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIChmcmFtZXNSZWFkIC0gcGFydDEpICogbUZyYW1lU2l6ZSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgICAgcmVhciA9IG1Sc21wSW5SZWFyICs9IGZyYW1lc1JlYWQ7CisgICAgICAgIG1Sc21wSW5SZWFyID0gYXVkaW9fdXRpbHM6OnNhZmVfYWRkX292ZXJmbG93KG1Sc21wSW5SZWFyLCAoaW50MzJfdClmcmFtZXNSZWFkKTsKIAogICAgICAgICBzaXplID0gYWN0aXZlVHJhY2tzLnNpemUoKTsKIApAQCAtNzY3OSwxMiArNzgwOCwxMiBAQAogICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkLAogICAgICAgICBzaXplX3QgKnBOb3RpZmljYXRpb25GcmFtZUNvdW50LAogICAgICAgICBwaWRfdCBjcmVhdG9yUGlkLAotICAgICAgICB1aWRfdCB1aWQsCisgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUmIGF0dHJpYnV0aW9uU291cmNlLAogICAgICAgICBhdWRpb19pbnB1dF9mbGFnc190ICpmbGFncywKICAgICAgICAgcGlkX3QgdGlkLAogICAgICAgICBzdGF0dXNfdCAqc3RhdHVzLAogICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCwKLSAgICAgICAgY29uc3QgU3RyaW5nMTYmIG9wUGFja2FnZU5hbWUpCisg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AgICAgICAgICAgICAgICAgICAgIGZvcm1hdCwgY2hhbm5lbE1hc2ssIGZyYW1lQ291bnQsCi0gICAgICAgICAgICAgICAgICAgICAgbnVsbHB0ciAvKiBidWZmZXIgKi8sIChzaXplX3QpMCAvKiBidWZmZXJTaXplICovLCBzZXNzaW9uSWQsIGNyZWF0b3JQaWQsIHVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAqZmxhZ3MsIFRyYWNrQmFzZTo6VFlQRV9ERUZBVUxULCBvcFBhY2thZ2VOYW1lLCBwb3J0SWQpOworICAgICAgICAgICAgICAgICAgICAgIG51bGxwdHIgLyogYnVmZmVyICovLCAoc2l6ZV90KTAgLyogYnVmZmVyU2l6ZSAqLywgc2Vzc2lvbklkLCBjcmVhdG9yUGlkLAorICAgICAgICAgICAgICAgICAgICAgIGNoZWNrZWRBdHRyaWJ1dGlvblNvdXJjZSwgKmZsYWdzLCBUcmFja0Jhc2U6OlRZUEVfREVGQVVMVCwgcG9ydElkLAorICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0RnJhbWVzKTsKIAogICAgICAgICBsU3RhdHVzID0gdHJhY2stPmluaXRDaGVjaygpOwogICAgICAgICBpZiAobFN0YXR1cyAhPSBOT19FUlJPUikgewpAQCAtNzgzNCw2ICs3OTg2LDEwIEBACiAgICAgICAgICAgICAvLyBzbyBhc2sgYWN0aXZpdHkgbWFuYWdlciB0byBkbyB0aGlzIG9uIG91ciBiZWhhbGYKICAgICAgICAgICAgIHNlbmRQcmlvQ29uZmlnRXZlbnRfbChjYWxsaW5nUGlkLCB0aWQsIGtQcmlvcml0eUF1ZGlvQXBwLCB0cnVlIC8qZm9yQXBwKi8pOwogICAgICAgICB9CisKKyAgICAgICAgaWYgKG1heFNoYXJlZEF1ZGlvSGlzdG9yeU1zICE9IDApIHsKKyAgICAgICAgICAgIHNlbmRSZXNpemVCdWZmZXJDb25maWdFdmVudF9sKG1heFNoYXJlZEF1ZGlvSGlzdG9yeU1zKTsKKyAgICAgICAg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c2ssICZmb3JtYXQpID09IE9LICYmCi0gICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pc19saW5lYXJfcGNtKGZvcm1hdCkgJiYgYXVkaW9faXNfbGluZWFyX3BjbShyZXFGb3JtYXQpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICBzUmF0ZSA8PSAoQVVESU9fUkVTQU1QTEVSX0RPV05fUkFUSU9fTUFYICogc2FtcGxpbmdSYXRlKSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fY2hhbm5lbF9jb3VudF9mcm9tX2luX21hc2soY2hhbm5lbE1hc2spIDw9IEZDQ184KSB7CisgICAgICAgICAgICAgICAgYXVkaW9fY29uZmlnX2Jhc2VfdCBjb25maWcgPSBBVURJT19DT05GSUdfQkFTRV9JTklUSUFMSVpFUjsKKyAgICAgICAgICAgICAgICBpZiAobUlucHV0LT5zdHJlYW0tPmdldEF1ZGlvUHJvcGVydGllcygmY29uZmlnKSA9PSBPSyAmJgorICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faXNfbGluZWFyX3BjbShjb25maWcuZm9ybWF0KSAmJiBhdWRpb19pc19saW5lYXJfcGNtKHJlcUZvcm1hdCkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5zYW1wbGVfcmF0ZSA8PSAoQVVESU9fUkVTQU1QTEVSX0RPV05fUkFUSU9fTUFYICogc2FtcGxpbmdSYXRlKSAmJgorICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fY2hhbm5lbF9jb3VudF9mcm9tX2luX21hc2soY29uZmlnLmNoYW5uZWxfbWFzaykgPD0gRkNDX0xJTUlUKSB7CiAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IE5PX0VSUk9SOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KQEAgLTg0MjYsMTAgKzg2NjcsMTAgQEAKICAgICBtRm9ybWF0ID0gbUhBTEZvcm1hdDsKICAgICBtQ2hhbm5lbENvdW50ID0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gIHNpemVfdCBwYXJ0MSA9IHByZXZpb3VzUnNtcEluRnJhbWVzUDIgLSBwcmV2aW91c0Zyb250OworICAgICAgICBpZiAocGFydDEgPiAoc2l6ZV90KSB1bnJlYWQpIHsKKyAgICAgICAgICAgIHBhcnQxID0gdW5yZWFkOworICAgICAgICB9CisgICAgICAgIGlmIChwYXJ0MSAhPSAwKSB7CisgICAgICAgICAgICBtZW1jcHkocnNtcEluQnVmZmVyLCAoY29uc3QgdWludDhfdCopbVJzbXBJbkJ1ZmZlciArIHByZXZpb3VzRnJvbnQgKiBtRnJhbWVTaXplLAorICAgICAgICAgICAgICAgICAgIHBhcnQxICogbUZyYW1lU2l6ZSk7CisgICAgICAgICAgICBtUnNtcEluUmVhciA9IHBhcnQxOworICAgICAgICAgICAgcGFydDEgPSB1bnJlYWQgLSBwYXJ0MTsKKyAgICAgICAgICAgIGlmIChwYXJ0MSAhPSAwKSB7CisgICAgICAgICAgICAgICAgbWVtY3B5KCh1aW50OF90Kilyc21wSW5CdWZmZXIgKyBtUnNtcEluUmVhciAqIG1GcmFtZVNpemUsCisgICAgICAgICAgICAgICAgICAgICAgIChjb25zdCB1aW50OF90KiltUnNtcEluQnVmZmVyLCBwYXJ0MSAqIG1GcmFtZVNpemUpOworICAgICAgICAgICAgICAgIG1Sc21wSW5SZWFyICs9IHBhcnQxOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIC8vIFVwZGF0ZSBmcm9udCBmb3IgYWxsIGNsaWVudHMgYWNjb3JkaW5nIHRvIG5ldyByZWFyCisgICAgICAgIHVwZGF0ZUZyb250c19sKGF1ZGlvX3V0aWxzOjpzYWZlX3N1Yl9vdmVyZmxvdyhwcmV2aW91c1JlYXIsIG1Sc21wSW5SZWFyKSk7CisgICAgfSBlbHNlIHsKKyAgICAgICAgbVJzbXBJblJlYXIgPSAwOworICAgIH0KKyAgICBmcmVlKG1Sc21wSW5CdWZmZXIpOworICAgIG1Sc21wSW5CdWZmZXIgPSByc21wSW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gICAgIH0KKyAgICAgICAgcmV0dXJuIHJldDsKICAgICB9CiAKICAgICBhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCA9IEFVRElPX1BPUlRfSEFORExFX05PTkU7CkBAIC04ODQ4LDggKzkyMDMsNyBAQAogICAgICAgICByZXQgPSBBdWRpb1N5c3RlbTo6Z2V0T3V0cHV0Rm9yQXR0cigmbUF0dHIsICZpbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVNlc3Npb25JZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50LmNsaWVudFBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50LmNsaWVudFVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50LmF0dHJpYnV0aW9uU291cmNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmY29uZmlnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFncywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmRldmljZUlkLApAQCAtODg2Niw5ICs5MjIwLDcgQEAKICAgICAgICAgcmV0ID0gQXVkaW9TeXN0ZW06OmdldElucHV0Rm9yQXR0cigmbUF0dHIsICZpbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUNPUkRfUklJRF9JTlZBTElELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TZXNzaW9uSWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50LmNsaWVudFBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnQuY2xpZW50VWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudC5wYWNrYWdlTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnQuYXR0cmlidXRpb25Tb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmNvbmZpZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19JTlBVVF9GTEFHX01NQVBfTk9JUlEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmRldmljZUlkLApAQCAtODkwOCwxNiArOTI2MCwxNiBAQAogCiAgICAgLy8gR2l2ZW4gdGhhdCBNbWFwVGhyZWFkOjptQXR0ciBpcyBtdXRhYmxlLCBzaG91bGQgYSBNbWFwVHJhY2sgaGF2ZSBhdHRyaWJ1dGVzID8KICAgICBzcDxNbWFwVHJhY2s+IHRyYWNrID0gbmV3IE1tYXBUcmFjayh0aGlzLCBhdHRyID09IG51bGxwdHIgPyBtQXR0ciA6ICphdHRyLCBtU2FtcGxlUmF0ZSwgbUZvcm1hdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ2hhbm5lbE1hc2ssIG1TZXNzaW9uSWQsIGlzT3V0cHV0KCksIGNsaWVudC5jbGllbnRVaWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50LmNsaWVudFBpZCwgSVBDVGhyZWFkU3RhdGU6OnNlbGYoKS0+Z2V0Q2FsbGluZ1BpZCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcnRJZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNoYW5uZWxNYXNrLCBtU2Vzc2lvbklkLCBpc091dHB1dCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudC5hdHRyaWJ1dGlvblNvdXJjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJUENUaHJlYWRTdGF0ZTo6c2VsZigpLT5nZXRDYWxsaW5nUGlkKCksIHBvcnRJZCk7CiAKICAgICBpZiAoaXNPdXRwdXQoKSkgewogICAgICAgICAvLyBmb3JjZSB2b2x1bWUgdXBkYXRlIHdoZW4gYSBuZXcgdHJhY2sgaXMgYWRkZWQKICAgICAgICAgbUhhbFZvbEZsb2F0ID0gLTEuMGY7CiAgICAgfSBlbHNlIGlmICghdHJhY2stPmlzU2lsZW5jZWRfbCgpKSB7CiAgICAgICAgIGZvciAoY29uc3Qgc3A8TW1hcFRyYWNrPiAmdCA6IG1BY3RpdmVUcmFja3MpIHsKLSAgICAgICAgICAgIGlmICh0LT5pc1NpbGVuY2VkX2woKSAmJiB0LT51aWQoKSAhPSBjbGllbnQuY2xpZW50VWlkKQorICAgICAgICAgICAgaWYgKHQtPmlzU2lsZW5jZWRfbCgpICYmIHQtPnVpZCgpICE9IGNsaWVudC5hdHRyaWJ1dGlvblNvdXJjZS51aWQpCiAgICAgICAgICAgICAgICAgdC0+aW52YWxpZGF0ZSgpOwogICAgICAgICB9CiAgICAgfQpAQCAtODk1MCw2ICs5MzAyLDcgQEAKIAogICAgIGlmIChoYW5kbGUgPT0gbVBvcnRJZCkgewogICAgICAgICBtSGFsU3RyZWFtLT5zdG9wKCk7CisgICAgICAgIHJlbGVhc2VXYWtlTG9jaygpOwogICAgICAgICByZXR1cm4gTk9fRVJST1I7CiAgICAgfQogCkBAIC05MTkyLDcgKzk1NDUsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRW51bWVyYXRlZCBkZXZpY2UgdHlwZSglI3gpIG11c3Qgbm90IGJlIHVzZWQgIgogICAgICAgICAgICAg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hbmRsZT4gY3JlYXRlRWZmZWN0X2woCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxBdWRpb0ZsaW5nZXI6OkNsaWVudD4mIGNsaWVudCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPElFZmZlY3RDbGllbnQ+JiBlZmZlY3RDbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxtZWRpYTo6SUVmZmVjdENsaWVudD4mIGVmZmVjdENsaWVudCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgcHJpb3JpdHksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0X2Rlc2NyaXB0b3JfdCAqZGVzYywKQEAgLTQzNCw4ICs0NjIsMTAgQEAKIAogICAgICAgICAgICAgICAgIC8vIHRoZSB2YWx1ZSByZXR1cm5lZCBieSBkZWZhdWx0IGltcGxlbWVudGF0aW9uIGlzIG5vdCBpbXBvcnRhbnQgYXMgdGhlCiAgICAgICAgICAgICAgICAgLy8gc3RyYXRlZ3kgaXMgb25seSBtZWFuaW5nZnVsIGZvciBQbGF5YmFja1RocmVhZCB3aGljaCBpbXBsZW1lbnRzIHRoaXMgbWV0aG9kCi0gICAgICAgICAgICAgICAgdmlydHVhbCB1aW50MzJfdCBnZXRTdHJhdGVneUZvclNlc3Npb25fbChhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkIF9fdW51c2VkKQotICAgICAgICAgICAgICAgICAgICAgICAgeyByZXR1cm4gMDsgfQorICAgICAgICAgICAgICAgIHZpcnR1YWwgcHJvZHVjdF9zdHJhdGVneV90IGdldFN0cmF0ZWd5Rm9yU2Vzc2lvbl9sKAorICAgICAgICAgICAgICAgICAgICAg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aW9uX2woc2Vzc2lvbklkKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4KKyAgICAgICAgICAgICAgICB2b2lkIGludmFsaWRhdGVUcmFja3NGb3JBdWRpb1Nlc3Npb25fbChhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFQmIHRyYWNrcykgY29uc3QgeworICAgICAgICAgICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHRyYWNrcy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3A8VHJhY2tCYXNlPiYgdHJhY2sgPSB0cmFja3NbaV07CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2Vzc2lvbklkID09IHRyYWNrLT5zZXNzaW9uSWQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrLT5pbnZhbGlkYXRlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICB2aXJ0dWFsICAgICBib29sIGlzU3RyZWFtSW5pdGlhbGl6ZWQoKSA9IDA7CisKIHByb3RlY3RlZDoKIAogICAgICAgICAgICAgICAgIC8vIGVudHJ5IGRlc2NyaWJpbmcgYW4gZWZmZWN0IGJlaW5nIHN1c3BlbmRlZCBpbiBtU3VzcGVuZGVkU2Vzc2lvbnMga2V5ZWQgdmVjdG9yCkBAIC01NzUsNyArNjI2LDcgQEAKIAogICAgICAgICAgICAgICAgIHN0YXRpYyBjb25zdCBpbnQgICAgICAgIGtUaHJlYWROYW1lTGVuZ3RoID0gMTY7IC8vIHByY3RsKFBSX1NFVF9OQU1FKSBsaW1pdAogICAgICAgICAgICAgICAgIGNoYXIgICAgICAgICAgICAgICAgICAgIG1UaHJlYWROYW1lW2tUaHJlYWROYW1lTGVuZ3RoXTsgLy8gZ3VhcmFudGVlZCBOVUwtdGVybWluYXRlZAotICAgICAgICAgICAgICAgIHNwPElQb3dlck1hbmFnZXI+ICAgICAgIG1Qb3dlck1hbmFnZXI7CisgICAgICAgICAgICAgICAgc3A8b3M6OklQb3dlck1hbmFnZXI+ICAgbVBvd2VyTWFuYWdlcjsKICAgICAgICAgICAgICAgICBzcDxJQmluZGVyPiAgICAgICAgICAgICBtV2FrZUxvY2tUb2tlbjsKICAgICAgICAgICAgICAgICBjb25zdCBzcDxQTURlYXRoUmVjaXBpZW50PiBtRGVhdGhSZWNpcGllbnQ7CiAgICAgICAgICAgICAgICAgLy8gbGlzdCBvZiBzdXNwZW5kZWQgZWZmZWN0cyBwZXIgc2Vzc2lvbiBhbmQgcGVyIHR5cGUuIFRoZSBmaXJzdCAob3V0ZXIpIHZlY3RvciBpcwpAQCAtNTkwLDYgKzY0MSwxMSBAQAogICAgICAgICAgICAgICAgIEV4dGVuZGVkVGltZXN0YW1wICAgICAgIG1UaW1lc3RhbXA7CiAgICAgICAgICAgICAgICAgVGltZXN0YW1wVmVyaWZpZXI8IC8vIEZvciB0aW1lc3RhbXAgc3RhdGlzdGljcy4KICAgICAgICAgICAgICAgICAgICAgICAgIGludDY0X3QgLyogZnJhbWUgY291bnQgKi8sIGludDY0X3QgLyogdGltZSBucyAqLz4gbVRpbWVzdGFtcFZlcmlmaWVyOworICAgICAgICAgICAgICAgIC8vIERJUkVDVCBhbmQgT0ZGTE9BRCB0aHJlYWRzIHNob3VsZCByZXNldCBmcmFtZSBjb3VudCB0byB6ZXJvIG9uIHN0b3AvZmx1c2gKKyAgICAgICAgICAgICAgICAvLyBUT0RPOiBhZGQgY29uZmlybWF0aW9uIGNoZWNrczoKKyAgICAgICAgICAgICAgICAvLyAxKSBESVJFQ1QgdGhyZWFkcyBhbmQgbGluZWFyIFBDTSBmb3JtYXQgcmVhbGx5IHJlc2V0cyB0byAwPworICAgICAgICAgICAgICAgIC8vIDIpIElzIGZyYW1lIGNvdW50IHJlYWxseSB2YWxpZCBpZiBub3QgbGluZWFyIHBjbT8KKyAgICAgICAgICAgICAgICAvLyAzKSBBcmUgYWxsIDY0IGJpdHMgb2YgcG9zaXRpb24gcmV0dXJuZWQsIG5vdCBqdXN0IGxvd2VzdCAzMiBiaXRzPwogICAgICAgICAgICAgICAgIC8vIFRpbWVzdGFtcCBjb3JyZWN0ZWQgZGV2aWNlIHNob3VsZCBiZSBhIHNpbmdsZSBkZXZpY2UuCiAgICAgICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190ICAgICAgICAgbVRpbWVzdGFtcENvcnJlY3RlZERldmljZSA9IEFVRElPX0RFVklDRV9OT05FOwogCkBAIC02ODcsNyArNzQzLDkgQEAKICAgICAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgICAgIHVwZGF0ZVBvd2VyU3RhdGUoc3A8VGhyZWFkQmFzZT4gdGhyZWFkLCBib29sIGZvcmNlID0gZmFsc2UpOwogCiAgICAgICAgICAgICAgICAgICAgIC8qKiBAcmV0dXJuIHRydWUgaWYgb25lIG9yIG1vdmUgYWN0aXZlIHRyYWNrcyB3YXMgYWRkZWQgb3IgcmVtb3ZlZCBzaW5jZSB0aGUKLSAgICAgICAgICAgICAgICAgICAgICogICAgICAgICAgbGFzdCB0aW1lIHRoaXMgZnVuY3Rpb24gd2FzIGNhbGxlZCBvciB0aGUgdmVjdG9yIHdhcyBjcmVhdGVkLiAqLworICAgICAgICAgICAgICAgICAgICAgKiAgICAgICAgICBsYXN0IHRpbWUgdGhpcyBmdW5jdGlvbiB3YXMgY2FsbGVkIG9yIHRoZSB2ZWN0b3Igd2FzIGNyZWF0ZWQuCisgICAgICAgICAgICAgICAgICAgICAqICAgICAgICAgIHRydWUgaWYgdm9sdW1lIG9mIG9uZSBvZiBhY3RpdmUgdHJhY2tzIHdhcyBjaGFuZ2VkLgorICAgICAgICAgICAgICAgICAgICAgKi8KICAgICAgICAgICAgICAgICAgICAgYm9vbCAgICAgICAgICAgIHJlYWRBbmRDbGVhckhhc0NoYW5nZWQoKTsKIAogICAgICAgICAgICAgICAgIHByaXZhdGU6CkBAIC04NjAsMTIgKzkxOCwxMSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19vdXRwdXRfZmxhZ3NfdCAqZmxhZ3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IGNyZWF0b3JQaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUmIGF0dHJpYnV0aW9uU291cmNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWRfdCB0aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzX3QgKnN0YXR1cyAvKm5vbi1OVUxMKi8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxtZWRpYTo6SUF1ZGlvVHJhY2tDYWxsYmFjaz4mIGNhbGxiYWNrLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgb3BQYWNrYWdlTmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPG1lZGlhOjpJQXVkaW9UcmFja0NhbGxiYWNrPiYgY2FsbGJhY2spOwogCiAgICAgICAgICAgICAgICAgQXVkaW9TdHJlYW1PdXQqIGdldE91dHB1dCgpIGNvbnN0OwogICAgICAgICAgICAgICAgIEF1ZGlvU3RyZWFtT3V0KiBjbGVhck91dHB1dCgpOwpAQCAtOTA0LDcgKzk2MSw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBoYXNBdWRpb1Nlc3Npb25fbChhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkKSBjb25zdCBvdmVycmlkZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRocmVhZEJhc2U6Omhhc0F1ZGlvU2Vzc2lvbl9sKHNlc3Npb25JZCwgbVRyYWNrcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgdmlydHVhbCB1aW50MzJfdCBnZXRTdHJhdGVneUZvclNlc3Npb25fbChhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkKTsKKyAgICAgICAgICAgICAgICB2aXJ0dWFsIHByb2R1Y3Rfc3RyYXRlZ3lfdCBnZXRTdHJhdGVneUZvclNlc3Npb25fbChhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkKTsKIAogCiAgICAgICAgICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBzZXRTeW5jRXZlbnQoY29uc3Qgc3A8U3luY0V2ZW50PiYgZXZlbnQpOwpAQCAtOTQwLDYgKzk5NywyNCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIG91dERldmljZVR5cGVzKCkuY291bnQobVRpbWVzdGFtcENvcnJlY3RlZERldmljZSkgIT0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAKKyAgICB2aXJ0dWFsICAgICBib29sICAgICAgICBpc1N0cmVhbUluaXRpYWxpemVkKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShtT3V0cHV0ID09IG51bGxwdHIgfHwgbU91dHB1dC0+c3RyZWFtID09IG51bGxwdHIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGF1ZGlvX2NoYW5uZWxfbWFza190IGhhcHRpY0NoYW5uZWxNYXNrKCkgY29uc3Qgb3ZlcnJpZGUgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbUhhcHRpY0NoYW5uZWxNYXNrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBib29sIHN1cHBvcnRzSGFwdGljUGxheWJhY2soKSBjb25zdCB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiAobUhhcHRpY0NoYW5uZWxNYXNrICYgQVVESU9fQ0hBTk5FTF9IQVBUSUNfQUxMKSAhPSBBVURJT19DSEFOTkVMX05PTkU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgdm9pZCBzZXREb3duU3RyZWFtUGF0Y2goY29uc3Qgc3RydWN0IGF1ZGlvX3BhdGNoICpwYXRjaCkgeworICAgICAgICAgICAgICAgICAgICBNdXRleDo6QXV0b2xvY2sgX2wobUxvY2spOworICAgICAgICAgICAgICAgICAgICBtRG93blN0cmVhbVBhdGNoID0gKnBhdGNoOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIFBsYXliYWNrVGhyZWFkOjpUcmFjayogZ2V0VHJhY2tCeUlkX2woYXVkaW9fcG9ydF9oYW5kbGVfdCB0cmFja0lkKTsKKwogcHJvdGVjdGVkOgogICAgIC8vIHVwZGF0ZWQgYnkgcmVhZE91dHB1dFBhcmFtZXRlcnNfbCgpCiAgICAgc2l6ZV90ICAgICAgICAgICAgICAgICAgICAgICAgICBtTm9ybWFsRnJhbWVDb3VudDsgIC8vIG5vcm1hbCBtaXhlciBhbmQgZWZmZWN0cwpAQCAtMTAxOCw2ICsxMDkzLDggQEAKIAogICAgIGludDY0X3QgICAgICAgICAgICAgICAgICAgICAgICAgbUJ5dGVzV3JpdHRlbjsKICAgICBpbnQ2NF90ICAgICAgICAgICAgICAgICAgICAgICAgIG1GcmFtZXNXcml0dGVuOyAvLyBub3QgcmVzZXQgb24gc3RhbmRieQorICAgIGludDY0X3QgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3RGcmFtZXNXcml0dGVuID0gLTE7IC8vIHRyYWNrIGNoYW5nZXMgaW4gdGltZXN0YW1wCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2VydmVyIGZyYW1lcyB3cml0dGVuLgogICAgIGludDY0X3QgICAgICAgICAgICAgICAgICAgICAgICAgbVN1c3BlbmRlZEZyYW1lczsgLy8gbm90IHJlc2V0IG9uIHN0YW5kYnkKIAogICAgIC8vIG1IYXB0aWNDaGFubmVsTWFzayBhbmQgbUhhcHRpY0NoYW5uZWxDb3VudCB3aWxsIG9ubHkgYmUgdmFsaWQgd2hlbiB0aGUgdGhyZWFkIHN1cHBvcnQKQEAgLTEwMzAsNiArMTEwNywxNCBAQAogICAgIC8vIGNvcHkgcmF0aGVyIHRoYW4gdGhlIG9uZSBpbiBBdWRpb0ZsaW5nZXIuICBUaGlzIG9wdGltaXphdGlvbiBzYXZlcyBhIGxvY2suCiAgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTWFzdGVyTXV0ZTsKICAgICAgICAgICAgICAgICB2b2lkICAgICAgICBzZXRNYXN0ZXJNdXRlX2woYm9vbCBtdXRlZCkgeyBtTWFzdGVyTXV0ZSA9IG11dGVkOyB9CisKKyAgICAgICAgICAgICAgICBhdXRvIGRpc2NvbnRpbnVpdHlGb3JTdGFuZGJ5T3JGbHVzaCgpIGNvbnN0IHsgLy8gY2FsbCBvbiB0aHJlYWRMb29wIG9yIHdpdGggbG9jay4KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuICgobVR5cGUgPT0gRElSRUNUICYmICFhdWRpb19pc19saW5lYXJfcGNtKG1Gb3JtYXQpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgbVR5cGUgPT0gT0ZGTE9BRCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IG1UaW1lc3RhbXBWZXJpZmllci5ESVNDT05USU5VSVRZX01PREVfWkVSTworICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogbVRpbWVzdGFtcFZlcmlmaWVyLkRJU0NPTlRJTlVJVFlfTU9ERV9DT05USU5VT1VTOworICAgICAgICAgICAgICAgIH0KKwogcHJvdGVjdGVkOgogICAgIEFjdGl2ZVRyYWNrczxUcmFjaz4gICAgIG1BY3RpdmVUcmFja3M7CiAKQEAgLTEwNjIsNiArMTE0NywxMSBAQAogCiAgICAgICAgICAgICAgICAgdWludDMyX3QgICAgdHJhY2tDb3VudEZvclVpZF9sKHVpZF90IHVpZCkgY29uc3Q7CiAKKyAgICAgICAgICAgICAgICB2b2lkICAgICAgICBpbnZhbGlkYXRlVHJhY2tzRm9yQXVkaW9TZXNzaW9uX2woCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbklkKSBjb25zdCBvdmVycmlkZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmVhZEJhc2U6OmludmFsaWRhdGVUcmFja3NGb3JBdWRpb1Nlc3Npb25fbChzZXNzaW9uSWQsIG1UcmFja3MpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKwogcHJpdmF0ZToKIAogICAgIGZyaWVuZCBjbGFzcyBBdWRpb0ZsaW5nZXI7ICAgICAgLy8gZm9yIG51bWVyb3VzCkBAIC0xMDc2LDYgKzExNjYsOCBAQAogICAgIHZvaWQgICAgICAgIHVwZGF0ZU1ldGFkYXRhX2woKSBmaW5hbDsKICAgICB2aXJ0dWFsIHZvaWQgc2VuZE1ldGFkYXRhVG9CYWNrZW5kX2woY29uc3QgU3RyZWFtT3V0SGFsSW50ZXJmYWNlOjpTb3VyY2VNZXRhZGF0YSYgbWV0YWRhdGEpOwogCisgICAgdm9pZCAgICAgICAgY29sbGVjdFRp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KSBjb25zdCB7IHJldHVybiBtUnNtcEluRnJvbnQ7IH0KKyAgICAgICAgICAgICAgICB2b2lkICAgICAgICBzZXRGcm9udChpbnQzMl90IGZyb250KSB7IG1Sc21wSW5Gcm9udCA9IGZyb250OyB9CiAgICAgcHJpdmF0ZToKICAgICAgICAgUmVjb3JkVHJhY2sgKiBjb25zdCBtUmVjb3JkVHJhY2s7CiAgICAgICAgIHNpemVfdCAgICAgICAgICAgICAgbVJzbXBJblVucmVsOyAgIC8vIHVucmVsZWFzZWQgZnJhbWVzIHJlbWFpbmluZyBmcm9tCkBAIC0xNTk5LDEyICsxNjk4LDEyIEBACiAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uSWQsCiAgICAgICAgICAgICAgICAgICAgIHNpemVfdCAqcE5vdGlmaWNhdGlvbkZyYW1lQ291bnQsCiAgICAgICAgICAgICAgICAgICAgIHBpZF90IGNyZWF0b3JQaWQsCi0gICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKKyAgICAgICAgICAgICAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgYXR0cmlidXRpb25Tb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lucHV0X2ZsYWdzX3QgKmZsYWdzLAogICAgICAgICAgICAgICAgICAgICBwaWRfdCB0aWQsCiAgICAgICAgICAgICAgICAgICAgIHN0YXR1c190ICpzdGF0dXMgLypub24tTlVMTCovLAogICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCwKLSAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nMTYmIG9wUGFja2FnZU5hbWUpOworICAgICAgICAgICAgICAgICAgICBpbnQzMl90IG1heFNoYXJlZEF1ZGlvSGlzdG9yeU1zKTsKIAogICAgICAgICAgICAgc3RhdHVzX3QgICAgc3RhcnQoUmVjb3JkVHJhY2sqIHJlY29yZFRyYWNrLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXVkaW9TeXN0ZW06OnN5bmNfZXZlbnRfdCBldmVudCwKQEAgLTE2MjgsNiArMTcyNyw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcGF0Y2hfaGFuZGxlX3QgKmhhbmRsZSk7CiAgICAgdmlydHVhbCBzdGF0dXNfdCAgICByZWxlYXNlQXVkaW9QYXRjaF9sKGNvbnN0IGF1ZGlvX3BhdGNoX2hhbmRsZV90IGhhbmRsZSk7CiAgICAgICAgICAgICB2b2lkICAgICAgICB1cGRhdGVPdXREZXZpY2VzKGNvbnN0IERldmljZURlc2NyaXB0b3JCYXNlVmVjdG9yJiBvdXREZXZpY2VzKSBvdmVycmlkZTsKKyAgICAgICAgICAgIHZvaWQgICAgICAgIHJlc2l6ZUlucHV0QnVmZmVyX2woaW50MzJfdCBtYXhTaGFyZWRBdWRpb0hpc3RvcnlNcykgb3ZlcnJpZGU7CiAKICAgICAgICAgICAgIHZvaWQgICAgICAgIGFkZFBhdGNoVHJhY2soY29uc3Qgc3A8UGF0Y2hSZWNvcmQ+JiByZWNvcmQpOwogICAgICAgICAgICAgdm9pZCAgICAgICAgZGVsZXRlUGF0Y2hUcmFjayhjb25zdCBzcDxQYXRjaFJlY29yZD4mIHJlY29yZCk7CkBAIC0xNjgzLDYgKzE3ODMsMTggQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIGluRGV2aWNlVHlwZSgpID09IG1UaW1lc3RhbXBDb3JyZWN0ZWREZXZpY2U7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAKKyAgICAgICAgICAgIHN0YXR1c190ICAgIHNoYXJlQXVkaW9IaXN0b3J5KGNvbnN0IHN0ZDo6c3RyaW5nJiBzaGFyZWRBdWRpb1BhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNoYXJlZFNlc3Npb25JZCA9IEFVRElPX1NFU1NJT05fTk9ORSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDY0X3Qgc2hhcmVkQXVkaW9TdGFydE1zID0gLTEpOworICAgICAgICAgICAgc3RhdHVzX3QgICAgc2hhcmVBdWRpb0hpc3RvcnlfbChjb25zdCBzdGQ6OnN0cmluZyYgc2hhcmVkQXVkaW9QYWNrYWdlTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzaGFyZWRTZXNzaW9uSWQgPSBBVURJT19TRVNTSU9OX05PTkUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQ2NF90IHNoYXJlZEF1ZGlvU3RhcnRNcyA9IC0xKTsKKyAgICAgICAgICAgIHZvaWQgICAgICAgIHJlc2V0QXVkaW9IaXN0b3J5X2woKTsKKworICAgIHZpcnR1YWwgYm9vbCAgICAgICAgaXNTdHJlYW1Jbml0aWFsaXplZCgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShtSW5wdXQgPT0gbnVsbHB0ciB8fCBtSW5wdXQtPnN0cmVhbSA9PSBudWxscHRyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKwogcHJvdGVjdGVkOgogICAgICAgICAgICAgdm9pZCAgICAgICAgZHVtcEludGVybmFsc19sKGludCBmZCwgY29uc3QgVmVjdG9yPFN0cmluZzE2PiYgYXJncykgb3ZlcnJpZGU7CiAgICAgICAgICAgICB2b2lkICAgICAgICBkdW1wVHJhY2tzX2woaW50IGZkLCBjb25zdCBWZWN0b3I8U3RyaW5nMTY+JiBhcmdzKSBvdmVycmlkZTsKQEAgLTE2OTYsNiArMTgwOCw5IEBACiAKICAgICAgICAgICAgIHZvaWQgICAgY2hlY2tCdE5yZWNfbCgpOwogCisgICAgICAgICAgICBpbnQzMl90IGdldE9sZGVzdEZyb250X2woKTsKKyAgICAgICAgICAgIHZvaWQgICAgdXBkYXRlRnJvbnRzX2woaW50MzJfdCBvZmZzZXQpOworCiAgICAgICAgICAgICBBdWRpb1N0cmVhbUluICAgICAgICAgICAgICAgICAgICAgICAqbUlucHV0OwogICAgICAgICAgICAgU291cmNlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKm1Tb3VyY2U7CiAgICAgICAgICAgICBTb3J0ZWRWZWN0b3IgPCBzcDxSZWNvcmRUcmFjaz4gPiAgICBtVHJhY2tzOwpAQCAtMTc2MSw2ICsxODc2LDExIEBACiAgICAgICAgICAgICBpbnQ2NF90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRnJhbWVzUmVhZCA9IDA7ICAgIC8vIGNvbnRpbnVvdXMgcnVubmluZyBjb3VudGVyLgogCiAgICAgICAgICAgICBEZXZpY2VEZXNjcmlwdG9yQmFzZVZlY3RvciAgICAgICAgICBtT3V0RGV2aWNlczsKKworICAgICAgICAgICAgaW50MzJfdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU1heFNoYXJlZEF1ZGlvSGlzdG9yeU1zID0gMDsKKyAgICAgICAgICAgIHN0ZDo6c3RyaW5nICAgICAgICAgICAgICAgICAgICAgICAgIG1TaGFyZWRBdWRpb1BhY2thZ2VOYW1lID0ge307CisgICAgICAgICAgICBpbnQzMl90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU2hhcmVkQXVkaW9TdGFydEZyYW1lcyA9IC0xOworICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90ICAgICAgICAgICAgICAgICAgICAgbVNoYXJlZEF1ZGlvU2Vzc2lvbklkID0gQVVESU9fU0VTU0lPTl9OT05FOwogfTsKIAogY2xhc3MgTW1hcFRocmVhZCA6IHB1YmxpYyBUaHJlYWRCYXNlCkBAIC0xNzkyLDYgKzE5MTIsNyBAQAogICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKmhhbmRsZSk7CiAgICAgc3RhdHVzX3Qgc3RvcChhdWRpb19wb3J0X2hhbmRsZV90IGhhbmRsZSk7CiAgICAgc3RhdHVzX3Qgc3RhbmRieSgpOworICAgIHZpcnR1YWwgc3RhdHVzX3QgZ2V0RXh0ZXJuYWxQb3NpdGlvbih1aW50NjRfdCAqcG9zaXRpb24sIGludDY0X3QgKnRpbWVOYW9zKSA9IDA7CiAKICAgICAvLyBSZWZCYXNlCiAgICAgdmlydHVhbCAgICAgdm9pZCAgICAgICAgb25GaXJzdFJlZigpOwpAQCAtMTg0Myw2ICsxOTY0LDggQEAKICAgICB2aXJ0dWFsICAgICB2b2lkICAgICAgICBzZXRSZWNvcmRTaWxlbmNlZChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCBfX3VudXNlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHNpbGVuY2VkIF9fdW51c2VkKSB7fQogCisgICAgdmlydHVhbCAgICAgYm9vbCAgICAgICAgaXNTdHJlYW1Jbml0aWFsaXplZCgpIHsgcmV0dXJuIGZhbHNlOyB9CisKICBwcm90ZWN0ZWQ6CiAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgZHVtcEludGVybmFsc19sKGludCBmZCwgY29uc3QgVmVjdG9yPFN0cmluZzE2PiYgYXJncykgb3ZlcnJpZGU7CiAgICAgICAgICAgICAgICAgdm9pZCAgICAgICAgZHVtcFRyYWNrc19sKGludCBmZCwgY29uc3QgVmVjdG9yPFN0cmluZzE2PiYgYXJncykgb3ZlcnJpZGU7CkBAIC0xOTAzLDYgKzIwMjYsMTIgQEAKIAogICAgIHZpcnR1YWwgICAgIHZvaWQgICAgICAgIHRvQXVkaW9Qb3J0Q29uZmlnKHN0cnVjdCBhdWRpb19wb3J0X2NvbmZpZyAqY29uZmlnKTsKIAorICAgICAgICAgICAgICAgIHN0YXR1c190ICAgIGdldEV4dGVybmFsUG9zaXRpb24odWludDY0X3QgKnBvc2l0aW9uLCBpbnQ2NF90ICp0aW1lTmFub3MpIG92ZXJyaWRlOworCisgICAgdmlydHVhbCAgICAgYm9vbCAgICAgICAgaXNTdHJlYW1Jbml0aWFsaXplZCgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEobU91dHB1dCA9PSBudWxscHRyIHx8IG1PdXRwdXQtPnN0cmVhbSA9PSBudWxscHRyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisKIHByb3RlY3RlZDoKICAgICAgICAgICAgICAgICB2b2lkICAgICAgICBkdW1wSW50ZXJuYWxzX2woaW50IGZkLCBjb25zdCBWZWN0b3I8U3RyaW5nMTY+JiBhcmdzKSBvdmVycmlkZTsKIApAQCAtMTkzMyw2ICsyMDYyLDEyIEBACiAKICAgICB2aXJ0dWFsICAgICB2b2lkICAgICAgICAgICB0b0F1ZGlvUG9ydENvbmZpZyhzdHJ1Y3QgYXVkaW9fcG9ydF9jb25maWcgKmNvbmZpZyk7CiAKKyAgICAgICAgICAgICAgICBzdGF0dXNfdCAgICAgICBnZXRFeHRlcm5hbFBvc2l0aW9uKHVpbnQ2NF90ICpwb3NpdGlvbiwgaW50NjRfdCAqdGltZU5hbm9zKSBvdmVycmlkZTsKKworICAgIHZpcnR1YWwgICAgIGJvb2wgICAgICAgICAgIGlzU3RyZWFtSW5pdGlhbGl6ZWQoKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKG1JbnB1dCA9PSBudWxscHRyIHx8IG1JbnB1dC0+c3RyZWFtID09IG51bGxwdHIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKwogcHJvdGVjdGVkOgogCiAgICAgICAgICAgICAgICAgQXVkaW9TdHJlYW1JbiogIG1JbnB1dDsKZGlmZiAtLWdpdCBhL3NlcnZpY2VzL2F1ZGlvZmxpbmdlci9UcmFja0Jhc2UuaCBiL3NlcnZpY2VzL2F1ZGlvZmxpbmd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sKK30KKworU3RhdHVzIEF1ZGlvRmxpbmdlcjo6VHJhY2tIYW5kbGU6OnNldFBhcmFtZXRlcnMoY29uc3Qgc3RkOjpzdHJpbmcmIGtleVZhbHVlUGFpcnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90KiBfYWlkbF9yZXR1cm4pIHsKKyAgICAqX2FpZGxfcmV0dXJuID0gbVRyYWNrLT5zZXRQYXJhbWV0ZXJzKFN0cmluZzgoa2V5VmFsdWVQYWlycy5jX3N0cigpKSk7CisgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKK30KKworU3RhdHVzIEF1ZGlvRmxpbmdlcjo6VHJhY2tIYW5kbGU6OnNlbGVjdFByZXNlbnRhdGlvbihpbnQzMl90IHByZXNlbnRhdGlvbklkLCBpbnQzMl90IHByb2dyYW1JZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCogX2FpZGxfcmV0dXJuKSB7CisgICAgKl9haWRsX3JldHVybiA9IG1UcmFjay0+c2VsZWN0UHJlc2VudGF0aW9uKHByZXNlbnRhdGlvbklkLCBwcm9ncmFtSWQpOworICAgIHJldHVybiBTdGF0dXM6Om9rKCk7Cit9CisKK1N0YXR1cyBBdWRpb0ZsaW5nZXI6OlRyYWNrSGFuZGxlOjpnZXRUaW1lc3RhbXAobWVkaWE6OkF1ZGlvVGltZXN0YW1wSW50ZXJuYWwqIHRpbWVzdGFtcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCogX2FpZGxfcmV0dXJuKSB7CisgICAgQXVkaW9UaW1lc3RhbXAgbGVnYWN5OworICAgICpfYWlkbF9yZXR1cm4gPSBtVHJhY2stPmdldFRpbWVzdGFtcChsZWdhY3kpOworICAgIGlmICgqX2FpZGxfcmV0dXJuICE9IE9LKSB7CisgICAgICAgIHJldHVybiBTdGF0dXM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LDggQEAKICAgICAgICAgICAgICAgICAgIC8vICAgICAgIGlzc3VlIChlLmcuIGJ5IGNvcHlpbmcpLgogICAgICAgICAgICAgICAgICAgKHNoYXJlZEJ1ZmZlciAhPSAwKSA/IHNoYXJlZEJ1ZmZlci0+dW5zZWN1cmVQb2ludGVyKCkgOiBidWZmZXIsCiAgICAgICAgICAgICAgICAgICAoc2hhcmVkQnVmZmVyICE9IDApID8gc2hhcmVkQnVmZmVyLT5zaXplKCkgOiBidWZmZXJTaXplLAotICAgICAgICAgICAgICAgICAgc2Vzc2lvbklkLCBjcmVhdG9yUGlkLCB1aWQsIHRydWUgLyppc091dCovLAorICAgICAgICAgICAgICAgICAgc2Vzc2lvbklkLCBjcmVhdG9yUGlkLAorICAgICAgICAgICAgICAgICAgVkFMVUVfT1JfRkFUQUwoYWlkbDJsZWdhY3lfaW50MzJfdF91aWRfdChhdHRyaWJ1dGlvblNvdXJjZS51aWQpKSwgdHJ1ZSAvKmlzT3V0Ki8sCiAgICAgICAgICAgICAgICAgICAodHlwZSA9PSBUWVBFX1BBVENIKSA/ICggYnVmZmVyID09IE5VTEwgPyBBTExPQ19MT0NBTCA6IEFMTE9DX05PTkUpIDogQUxMT0NfQ0JMSywKICAgICAgICAgICAgICAgICAgIHR5cGUsCiAgICAgICAgICAgICAgICAgICBwb3J0SWQsCkBAIC01NDUsMTMgKzY1MCwxMSBAQAogICAgIG1NYWluQnVmZmVyKHRocmVhZC0+c2lua0J1ZmZlcigpKSwKICAgICBtQXV4QnVmZmVyKE5VTEwpLAogICAgIG1BdXhFZmZlY3RJZCgwKSwgbUhhc1ZvbHVtZUNvbnRyb2xsZXIoZmFsc2UpLAotICAgIG1QcmVzZW50YXRpb25Db21wbGV0ZUZyYW1lcygwKSwKICAgICBtRnJhbWVNYXAoMTYgLyogc2luay1mcmFtZS10by10cmFjay1mcmFtZSBtYXAgbWVtb3J5ICovKSwKICAgICBtVm9sdW1lSGFuZGxlcihuZXcgbWVkaWE6OlZvbHVt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ogICAgICAgICBBTE9HVigiJXMoJWQpOiBjb25zaWRlciB0cmFjayByZWFkeSB3aXRoICV6dS8lenUsIHRhcmdldCB3YXMgJXp1KSIsCkBAIC05NTEsNiArMTA2NSwxMyBAQAogICAgICAgICAvLyBpbml0aWFsIHN0YXRlLXN0b3BwaW5nLiBuZXh0IHN0YXRlLXBhdXNpbmcuCiAgICAgICAgIC8vIFdoYXQgaWYgcmVzdW1lIGlzIGNhbGxlZCA/CiAKKyAgICAgICAgaWYgKHN0YXRlID09IEZMVVNIRUQpIHsKKyAgICAgICAgICAgIC8vIGF2b2lkIHVuZGVycnVuIGdsaXRjaGVzIHdoZW4gc3RhcnRpbmcgYWZ0ZXIgZmx1c2gKKyAgICAgICAgICAgIHJlc2V0KCk7CisgICAgICAgIH0KKworICAgICAgICAvLyBjbGVhciBtUGF1c2VId1BlbmRpbmcgYmVjYXVzZSBvZiBwYXVzZSAoYW5kIHBvc3NpYmx5IGZsdXNoKSBkdXJpbmcgdW5kZXJydW4uCisgICAgICAgIG1QYXVzZUh3UGVuZGluZyA9IGZhbHNlOwogICAgICAgICBpZiAoc3RhdGUgPT0gUEFVU0VEIHx8IHN0YXRlID09IFBBVVNJTkcpIHsKICAgICAgICAgICAgIGlmIChtUmVzdW1lVG9TdG9wcGluZykgewogICAgICAgICAgICAgICAgIC8vIGhhcHBlbmVkIHdlIG5lZWQgdG8gcmVzdW1lIHRvIFNUT1BQSU5HXzEKQEAgLTEwODIsNiArMTIwMyw5IEBACiAgICAgICAgICAgICBtU3RhdGUgPSBQQVVTSU5HOwogICAgICAgICAgICAgQUxPR1YoIiVzKCVkKTogQUNUSVZFL1JFU1VNSU5HID0+IFBBVVNJTkcgb24gdGhyZWFkICVkIiwKICAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sIG1JZCwgKGludCltVGhyZWFkSW9IYW5kbGUpOworICAgICAgICAgICAgaWYgKGlzT2ZmbG9hZGVkT3JEaXJlY3QoKSkgeworICAgICAgICAgICAgICAgIG1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B7CisgICAgICAgIHNwPFRocmVhZEJhc2U+IHRocmVhZCA9IG1UaHJlYWQucHJvbW90ZSgpOworICAgICAgICBpZiAodGhyZWFkICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgIGF1dG8gdCA9IHN0YXRpY19jYXN0PFBsYXliYWNrVGhyZWFkICo+KHRocmVhZC5nZXQoKSk7CisgICAgICAgICAgICBNdXRleDo6QXV0b2xvY2sgbG9jayh0LT5tTG9jayk7CisgICAgICAgICAgICBzdGF0dXMgPSB0LT5tT3V0cHV0LT5zdHJlYW0tPnNldFBsYXliYWNrUmF0ZVBhcmFtZXRlcnMocGxheWJhY2tSYXRlKTsKKyAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKKyAgICAgICAgICAgICAgICBtUGxheWJhY2tSYXRlUGFyYW1ldGVycyA9IHBsYXliYWNrUmF0ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gc3RhdHVzOworfQorCiAvL1RvIGJlIGNhbGxlZCB3aXRoIHRocmVhZCBsb2NrIGhlbGQKIGJvb2wgQXVkaW9GbGluZ2VyOjpQbGF5YmFja1RocmVhZDo6VHJhY2s6OmlzUmVzdW1lUGVuZGluZygpIHsKIApAQCAtMTYwNCwxMiArMTg4NCwxMiBAQAogICAgICAgICAgICAgYXVkaW9fZm9ybWF0X3QgZm9ybWF0LAogICAgICAgICAgICAgYXVkaW9fY2hhbm5lbF9tYXNrX3QgY2hhbm5lbE1hc2ssCiAgICAgICAgICAgICBzaXplX3QgZnJhbWVDb3VudCwKLSAgICAgICAgICAgIHVpZF90IHVpZCkKKyAgICAgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUmIGF0dHJpYnV0aW9uU291cmNlKQogICAgIDogICBUcmFjayhwbGF5YmFja1RocmVhZCwgTlVMTCwgQVVESU9fU1RSRUFNX1BBVENILAogICAgICAgICAgICAgICBhdWRpb19hdHRyaWJ1d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mFja0Jhc2UodGhyZWFkLCBjbGllbnQsIGF0dHIsIHNhbXBsZVJhdGUsIGZvcm1hdCwKICAgICAgICAgICAgICAgICAgIGNoYW5uZWxNYXNrLCBmcmFtZUNvdW50LCBidWZmZXIsIGJ1ZmZlclNpemUsIHNlc3Npb25JZCwKLSAgICAgICAgICAgICAgICAgIGNyZWF0b3JQaWQsIHVpZCwgZmFsc2UgLyppc091dCovLAorICAgICAgICAgICAgICAgICAgY3JlYXRvclBpZCwKKyAgICAgICAgICAgICAgICAgIFZBTFVFX09SX0ZBVEFMKGFpZGwybGVnYWN5X2ludDMyX3RfdWlkX3QoYXR0cmlidXRpb25Tb3VyY2UudWlkKSksCisgICAgICAgICAgICAgICAgICBmYWxzZSAvKmlzT3V0Ki8sCiAgICAgICAgICAgICAgICAgICAodHlwZSA9PSBUWVBFX0RFRkFVTFQpID8KICAgICAgICAgICAgICAgICAgICAgICAgICAgKChmbGFncyAmIEFVRElPX0lOUFVUX0ZMQUdfRkFTVCkgPyBBTExPQ19QSVBFIDogQUxMT0NfQ0JMSykgOgogICAgICAgICAgICAgICAgICAgICAgICAgICAoKGJ1ZmZlciA9PSBOVUxMKSA/IEFMTE9DX0xPQ0FMIDogQUxMT0NfTk9ORSksCkBAIC0yMTM5LDcgKzIzNDcsNyBAQAogICAgICAgICBtUmVjb3JkQnVmZmVyQ29udmVydGVyKE5VTEwpLAogICAgICAgICBtRmxhZ3MoZmxhZ3MpLAogICAgICAgICBtU2lsZW5jZWQoZmFsc2UpLAotICAgICAgICBtT3BSZWNvcmRBdWRpb01vbml0b3IoT3BSZWNvcmRBdWRpb01vbml0b3I6OmNyZWF0ZUlmTmVlZGVkKHVpZCwgYXR0ciwgb3BQYWNrYWdlTmFtZSkpCisgICAgICAgIG1TdGFydEZyYW1lcyhzdGFydEZyYW1lcykKIHsKICAgICBpZiAobUNibGsgPT0gTlVMTCkgewogICAgICAgICByZXR1cm47CkBAIC0yMTgwLDcgKzIzODgsNyBAQAogI2VuZG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2tfdCBjaGFubmVsTWFzaywKICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb25JZCwKICAgICAgICAgYm9vbCBpc091dCwKLSAgICAgICAgdWlkX3QgdWlkLAotICAgICAgICBwaWRfdCBwaWQsCisgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUmIGF0dHJpYnV0aW9uU291cmNlLAogICAgICAgICBwaWRfdCBjcmVhdG9yUGlkLAogICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCkKICAgICA6ICAgVHJhY2tCYXNlKHRocmVhZCwgTlVMTCwgYXR0ciwgc2FtcGxlUmF0ZSwgZm9ybWF0LAogICAgICAgICAgICAgICAgICAgY2hhbm5lbE1hc2ssIChzaXplX3QpMCAvKiBmcmFtZUNvdW50ICovLAogICAgICAgICAgICAgICAgICAgbnVsbHB0ciAvKiBidWZmZXIgKi8sIChzaXplX3QpMCAvKiBidWZmZXJTaXplICovLAotICAgICAgICAgICAgICAgICAgc2Vzc2lvbklkLCBjcmVhdG9yUGlkLCB1aWQsIGlzT3V0LAorICAgICAgICAgICAgICAgICAgc2Vzc2lvbklkLCBjcmVhdG9yUGlkLAorICAgICAgICAgICAgICAgICAgVkFMVUVfT1JfRkFUQUwoYWlkbDJsZWdhY3lfaW50MzJfdF91aWRfdChhdHRyaWJ1dGlvblNvdXJjZS51aWQpKSwKKyAgICAgICAgICAgICAgICAgIGlzT3V0LAogICAgICAgICAgICAgICAgICAgQUxMT0NfTk9ORSwKICAgICAgICAgICAgICAgICAgIFRZUEVfREVGQVVMVCwgcG9ydElkLAogICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcoQU1FRElBTUVUUklDU19LRVlfUFJFRklYX0FVRElPX01NQVApICsgc3RkOjp0b19zdHJpbmcocG9ydElkKSksCi0gICAgICAgIG1QaWQocGlkKSwgbVNpbGVuY2VkKGZhbHNlKSwgbVNpbGVuY2VkTm90aWZpZWQoZmFsc2UpCisgICAg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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3N0cmVhbV90eXBlX3QgKnN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgYXR0cmlidXRpb25Tb3VjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdWRpb19jb25maWdfdCAqY29uZmlnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190ICpmbGFncywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90ICpzZWxlY3RlZERldmljZUlkLApAQCAtMTMzLDE1ICsxMzcsMTUgQEAKICAgICB2aXJ0dWFsIHN0YXR1c190IHN0YXJ0T3V0cHV0KGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkKSA9IDA7CiAgICAgLy8gaW5kaWNhdGVzIHRvIHRoZSBhdWRpbyBwb2xpY3kgbWFuYWdlciB0aGF0IHRoZSBvdXRwdXQgc3RvcHMgYmVpbmcgdXNlZCBieSBjb3JyZXNwb25kaW5nIHN0cmVhbS4KICAgICB2aXJ0dWFsIHN0YXR1c190IHN0b3BPdXRwdXQoYXVkaW9fcG9ydF9oYW5kbGVfdCBwb3J0SWQpID0gMDsKLSAgICAvLyByZWxlYXNlcyB0aGUgb3V0cHV0LgotICAgIHZpcnR1YWwgdm9pZCByZWxlYXNlT3V0cHV0KGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkKSA9IDA7CisgICAgLy8gcmVsZWFzZXMgdGhlIG91dHB1dCwgcmV0dXJuIHRydWUgaWYgdGhlIG91dHB1dCBkZXNjcmlwdG9yIGlzIHJlb3BlbmVkLgorICAgIHZpcnR1YWwgYm9vbCByZWxlYXNlT3V0cHV0KGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkKSA9IDA7CiAKICAgICAvLyByZXF1ZXN0IGFuIGlucHV0IGFwcHJvcHJpYXRlIGZvciByZWNvcmQgZnJvbSB0aGUgc3VwcGxpZWQgZGV2aWNlIHdpdGggc3VwcGxpZWQgcGFyYW1ldGVycy4KICAgICB2aXJ0dWFsIHN0YXR1c190IGdldElucHV0Rm9yQXR0cihjb25zdCBhdWRpb19hdHRyaWJ1dGVzX3QgKmF0dHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgKmlucHV0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3VuaXF1ZV9pZF90IHJpaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgdWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUmIGF0dHJpYnV0aW9uU291Y2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqY29uZmlnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lucHV0X2ZsYWdzX3QgZmxhZ3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqc2VsZWN0ZWREZXZpY2VJZCwKQEAgLTE5MSw3ICsxOTUsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCAmaW5kZXgpID0gMDsKIAogICAgIC8vIHJldHVybiB0aGUgc3RyYXRlZ3kgY29ycmVzcG9uZGluZyB0byBhIGdpdmVuIHN0cmVhbSB0eXBlCi0gICAgdmlydHVhbCB1aW50MzJfdCBnZXRTdHJhdGVneUZvclN0cmVhbShhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSkgPSAwOworICAgIHZpcnR1YWwgcHJvZHVjdF9zdHJhdGVneV90IGdldFN0cmF0ZWd5Rm9yU3RyZWFtKGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtKSA9IDA7CiAKICAgICAvLyByZXR1cm4gdGhlIGVuYWJsZWQgb3V0cHV0IGRldmljZXMgZm9yIHRoZSBnaXZlbiBzdHJlYW0gdHlwZQogICAgIHZpcnR1YWwgYXVkaW9fZGV2aWNlc190IGdldERldmljZXNGb3JTdHJlYW0oYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0pID0gMDsKQEAgLTIwNCw3ICsyMDgsNyBAQAogICAgIHZpcnR1YWwgYXVkaW9faW9faGFuZGxlX3QgZ2V0T3V0cHV0Rm9yRWZmZWN0KGNvbnN0IGVmZmVjdF9kZXNjcmlwdG9yX3QgKmRlc2MpID0gMDsKICAgICB2aXJ0dWFsIHN0YXR1c190IHJlZ2lzdGVyRWZmZWN0KGNvbnN0IGVmZmVjdF9kZXNjcmlwdG9yX3QgKmRlc2MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBpbywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHN0cmF0ZWd5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZHVjdF9zdHJhdGVneV90IHN0cmF0ZWd5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNlc3Npb24sC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yVmVjdG9yJiBkZXZpY2VzKQogICAgICAgICAgICAgPSAwOwogICAgIHZpcnR1YWwgc3RhdHVzX3QgcmVtb3ZlVWlkRGV2aWNlQWZmaW5pdGllcyh1aWRfdCB1aWQpID0gMDsKIAogICAgIHZpcnR1YWwgc3RhdHVzX3Qgc2V0VXNlcklkRGV2aWNlQWZmaW5pdGllcyhpbnQgdXNlcklkLAotICAgICAgICAgICAgY29uc3QgVmVjdG9yPEF1ZGlvRGV2aWNlVHlwZUFkZHI+JiBkZXZpY2VzKSA9IDA7CisgICAgICAgICAgICBjb25zdCBBdWRpb0RldmljZVR5cGVBZGRyVmVjdG9yJiBkZXZpY2VzKSA9IDA7CiAgICAgdmlydHVhbCBzdGF0dXNfdCByZW1vdmVVc2VySWREZXZpY2VBZmZpbml0aWVzKGludCB1c2VySWQpID0gMDsKIAogICAgIHZpcnR1YWwgc3RhdHVzX3Qgc3RhcnRBdWRpb1NvdXJjZShjb25zdCBzdHJ1Y3QgYXVkaW9fcG9ydF9jb25maWcgKnNvdXJjZSwKQEAgLTI3Miw4ICsyNzYsMTEgQEAKIAogICAgIHZpcnR1YWwgc3RhdHVzX3QgZ2V0U3Vycm91bmRGb3JtYXRzKHVuc2lnbmVkIGludCAqbnVtU3Vycm91bmRGb3JtYXRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1hdF90ICpzdXJyb3VuZEZvcm1hdHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCAqc3Vycm91bmRGb3JtYXRzRW5hYmxlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHJlcG9ydGVkKSA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCAqc3Vycm91bmRGb3JtYXRzRW5hYmxlZCkgPSAwOworCisgICAgdmlydHVhbCBzdGF0dXNfdCBnZXRSZXBvcnRl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R3JvdXBzKEF1ZGlvVm9sdW1lR3JvdXBWZWN0b3IgJmdyb3VwcykgPSAwOwogCi0gICAgdmlydHVhbCBzdGF0dXNfdCBnZXRWb2x1bWVHcm91cEZyb21BdWRpb0F0dHJpYnV0ZXMoY29uc3QgQXVkaW9BdHRyaWJ1dGVzICZhYSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2x1bWVfZ3JvdXBfdCAmdm9sdW1lR3JvdXApID0gMDsKKyAgICB2aXJ0dWFsIHN0YXR1c190IGdldFZvbHVtZUdyb3VwRnJvbUF1ZGlvQXR0cmlidXRlcygKKyAgICAgICAgICAgIGNvbnN0IEF1ZGlvQXR0cmlidXRlcyAmYWEsIHZvbHVtZV9ncm91cF90ICZ2b2x1bWVHcm91cCwgYm9vbCBmYWxsYmFja09uRGVmYXVsdCkgPSAwOwogCiAgICAgdmlydHVhbCBib29sICAgICBpc0NhbGxTY3JlZW5Nb2RlU3VwcG9ydGVkKCkgPSAwOwogCi0gICAgdmlydHVhbCBzdGF0dXNfdCBzZXRQcmVmZXJyZWREZXZpY2VGb3JTdHJhdGVneShwcm9kdWN0X3N0cmF0ZWd5X3Qgc3RyYXRlZ3ksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdWRpb0RldmljZVR5cGVBZGRyICZkZXZpY2UpID0gMDsKKyAgICB2aXJ0dWFsIHN0YXR1c190IHNldERldmljZXNSb2xlRm9yU3RyYXRlZ3kocHJvZHVjdF9zdHJhdGVneV90IHN0cmF0ZWd5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2Vfcm9sZV90IHJvbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF1ZGlvRGV2aWNlVHlwZUFkZHJWZWN0b3IgJmRldmljZXMpID0gMDsKIAotICAgIHZpcnR1YWwgc3RhdHVzX3QgcmVtb3ZlUHJlZmVycmVkRGV2aWNlRm9yU3RyYXRlZ3kocHJvZHVjdF9zdHJhdGVneV90IHN0cmF0ZWd5KSA9IDA7CisgICAgdmlydHVhbCBzdGF0dXNfdCByZW1vdmVEZXZpY2VzUm9sZUZvclN0cmF0ZWd5KHByb2R1Y3Rfc3RyYXRlZ3lfdCBzdHJhdGVneSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlX3JvbGVfdCByb2xlKSA9IDA7CiAKLSAgICB2aXJ0dWFsIHN0YXR1c190IGdldFByZWZlcnJlZERldmljZUZvclN0cmF0ZWd5KHByb2R1Y3Rfc3RyYXRlZ3lfdCBzdHJhdGVneSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEF1ZGlvRGV2aWNlVHlwZUFkZHIgJmRldmljZSkgPSAwOworCisgICAgdmlydHVhbCBzdGF0dXNfdCBnZXREZXZpY2VzRm9yUm9sZUFuZFN0cmF0ZWd5KHByb2R1Y3Rfc3RyYXRlZ3lfdCBzdHJhdGVneSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlX3JvbGVfdCByb2xlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBdWRpb0RldmljZVR5cGVBZGRyVmVjdG9yICZkZXZpY2VzKSA9IDA7CisKKyAgICB2aXJ0dWFsIHN0YXR1c190IHNldERldmljZXNSb2xlRm9yQ2FwdHVyZVByZXNldChhdWRpb19zb3VyY2VfdCBhdWRpb1NvdXJjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2Vfcm9sZV90IHJvbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciAmZGV2aWNlcykgPSAwOworCisgICAgdmlydHVhbCBzdGF0dXNfdCBhZGREZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXQoYXVkaW9fc291cmNlX3QgYXVkaW9Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlX3JvbGVfdCByb2xlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF1ZGlvRGV2aWNlVHlwZUFkZHJWZWN0b3IgJmRldmljZXMpID0gMDsKKworICAgIHZpcnR1YWwgc3RhdHVzX3QgcmVtb3ZlRGV2aWNlc1JvbGVGb3JDYXB0dXJlUHJlc2V0KAorICAgICAgICAgICAgYXVkaW9fc291cmNlX3QgYXVkaW9Tb3VyY2UsIGRldmljZV9yb2xlX3Qgcm9sZSwKKyAgICAgICAgICAgIGNvbnN0IEF1ZGlvRGV2aWNlVHlwZUFkZHJWZWN0b3ImIGRldmljZXMpID0gMDsKKworICAgIHZpcnR1YWwgc3RhdHVzX3QgY2xlYXJEZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXQoYXVkaW9fc291cmNlX3QgYXVkaW9Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2Vfcm9sZV90IHJvbGUpID0gMDsKKworICAgIHZpcnR1YWwgc3RhdHVzX3QgZ2V0RGV2aWNlc0ZvclJvbGVBbmRDYXB0dXJlUHJlc2V0KGF1ZGlvX3NvdXJjZV90IGF1ZGlvU291cmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZV9yb2xlX3Qgcm9sZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBB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XMsCisvLyBlLmcuICdtT3V0cHV0RGV2aWNlcycuIFRoaXMgYWxzbyBtZWFucyB0aGF0IGl0J3MgaW1wb3NzaWJsZQorLy8gdG8gaW1wbGVtZW50ICJkZWVwIGNvcHlpbmciIG9mIHRoaXMgY2xhc3Mgd2l0aG91dCByZS1kZXNpZ25pbmcgaXQuCiBjbGFzcyBBdWRpb1BvbGljeUNvbmZpZwogewogcHVibGljOgpAQCAtNDAsMTQgKzQ5LDI0IEBACiAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlVmVjdG9yICZvdXRwdXREZXZpY2VzLAogICAgICAgICAgICAgICAgICAgICAgIERldmljZVZlY3RvciAmaW5wdXREZXZpY2VzLAogICAgICAgICAgICAgICAgICAgICAgIHNwPERldmljZURlc2NyaXB0b3I+ICZkZWZhdWx0T3V0cHV0RGV2aWNlKQotICAgICAgICA6IG1FbmdpbmVMaWJyYXJ5TmFtZVN1ZmZpeChrRGVmYXVsdEVuZ2luZUxpYnJhcnlOYW1lU3VmZml4KSwKLSAgICAgICAgICBtSHdNb2R1bGVzKGh3TW9kdWxlcyksCisgICAgICAgIDogbUh3TW9kdWxlcyhod01vZHVsZXMpLAogICAgICAgICAgIG1PdXRwdXREZXZpY2VzKG91dHB1dERldmljZXMpLAogICAgICAgICAgIG1JbnB1dERldmljZXMoaW5wdXREZXZpY2VzKSwKLSAgICAgICAgICBtRGVmYXVsdE91dHB1dERldmljZShkZWZhdWx0T3V0cHV0RGV2aWNlKSwKLSAgICAgICAgICBtSXNTcGVha2VyRHJjRW5hYmxlZChmYWxzZSksCi0gICAgICAgICAgbUlzQ2FsbFNjcmVlbk1vZGVTdXBwb3J0ZWQoZmFsc2UpCi0gICAge30KKyAgICAgICAgICBtRGVmYXVsdE91dHB1dERldmljZShkZWZhdWx0T3V0cHV0RGV2aWNlKSB7CisgICAgICAgIGNsZWFyKCk7CisgICAgfQorCisgICAgdm9pZCBjbGVhcigpIHsKKyAgICAgICAgbVNvdXJjZSA9IHt9O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oYXVkaW9fc291cmNlX3QgaW5wdXRTb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgRGV2aWNlVmVjdG9yICZhdmFpbGFibGVEZXZpY2VUeXBlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3A8QXVkaW9Qb2xpY3lNaXg+ICpwb2xpY3lNaXgpIGNvbnN0OwogCiAgICAgLyoqCkBAIC0xMDEsNyArMTAyLDcgQEAKICAgICAgKiAgICBBbiBleGFtcGxlIG9mIGZhaWx1cmUgaXMgd2hlbiB0aGVyZSBhcmUgYWxyZWFkeSBydWxlcyBpbiBwbGFjZSB0byByZXN0cmljdAogICAgICAqICAgIGEgbWl4IHRvIHRoZSBnaXZlbiB1aWQgKGkuZS4gd2hlbiBhIE1BVENIX1VJRCBydWxlIHdhcyBzZXQgZm9yIGl0KS4KICAgICAgKi8KLSAgICBzdGF0dXNfdCBzZXRVaWREZXZpY2VBZmZpbml0aWVzKHVpZF90IHVpZCwgY29uc3QgVmVjdG9yPEF1ZGlvRGV2aWNlVHlwZUFkZHI+JiBkZXZpY2VzKTsKKyAgICBzdGF0dXNfdCBzZXRVaWREZXZpY2VBZmZpbml0aWVzKHVpZF90IHVpZCwgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciYgZGV2aWNlcyk7CiAgICAgc3RhdHVzX3QgcmVtb3ZlVWlkRGV2aWNlQWZmaW5pdGllcyh1aWRfdCB1aWQpOwogICAgIHN0YXR1c190IGdldERldmljZXNGb3JVaWQodWlkX3QgdWlkLCBWZWN0b3I8QXVkaW9EZXZpY2VUeXBlQWRkcj4mIGRldmljZXMpIGNvbnN0OwogCkBAIC0xMTUsNyArMTE2LDcgQEAKICAgICAgKiAg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AgICAgICAgICAgIHJldHVybiBNaXhNYXRjaFN0YXR1czo6Tk9fTUFUQ0g7Ci0gICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAoIShhdHRyaWJ1dGVzLnVzYWdlID09IEFVRElPX1VTQUdFX1VOS05PV04gfHwKICAgICAgICAgICAgICAgICAgIGF0dHJpYnV0ZXMudXNhZ2UgPT0gQVVESU9fVVNBR0VfTUVESUEgfHwKICAgICAgICAgICAgICAgICAgIGF0dHJpYnV0ZXMudXNhZ2UgPT0gQVVESU9fVVNBR0VfR0FNRSB8fAogICAgICAgICAgICAgICAgICAgYXR0cmlidXRlcy51c2FnZSA9PSBBVURJT19VU0FHRV9WT0lDRV9DT01NVU5JQ0FUSU9OKSkgewogICAgICAgICAgICAgICAgIHJldHVybiBNaXhNYXRjaFN0YXR1czo6Tk9fTUFUQ0g7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBhdXRvIGhhc0ZsYWcgPSBbXShhdXRvIGZsYWdzLCBhdXRvIGZsYWcpIHsgcmV0dXJuIChmbGFncyAmIGZsYWcpID09IGZsYWc7IH07CisgICAgICAgICAgICBpZiAoaGFzRmxhZyhhdHRyaWJ1dGVzLmZsYWdzLCBBVURJT19GTEFHX05PX1NZU1RFTV9DQVBUVVJFKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBNaXhNYXRjaFN0YXR1czo6Tk9fTUFUQ0g7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChhdHRyaWJ1dGVzLnVzYWdlID09IEFVRElPX1VTQUdFX1ZPSUNFX0NPTU1VTklDQVRJT04pIHsKKyAgICAgICAgICAgICAgICBpZiAoIW1peC0+bVZvaWNlQ29tbXVuaWNhdGlvbkNhcHR1cmVBbGxvd2VkKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBNaXhNYXRjaFN0YXR1czo6Tk9fTUFUQ0g7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIGlmICghbWl4LT5tQWxsb3dQcml2aWxlZ2VkTWVkaWFQbGF5YmFja0NhcHR1cmUgJiYKKyAgICAgICAgICAgICAgICBoYXNGbGFnKGF0dHJpYnV0ZXMuZmxhZ3MsIEFVRElPX0ZMQUdfTk9fTUVESUFfUFJPSkVDVElPTikpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gTWl4TWF0Y2hTdGF0dXM6Ok5PX01BVENIOworICAgICAgICAgICAgfQogICAgICAgICB9CiAKICAgICAgICAgaW50IHVzZXJJZCA9IChpbnQpIG11bHRpdXNlcl9nZXRfdXNlcl9pZCh1aWQpOwpAQCAtMzkwLDYgKzM5MSw3IEBACiBzcDxEZXZpY2VEZXNjcmlwdG9yPiBBdWRpb1BvbGljeU1peENvbGxlY3Rpb246OmdldERldmljZUFuZE1peEZvcklucHV0U291cmNlKAogICAgICAgICBhdWRpb19zb3VyY2VfdCBpbnB1dFNvdXJjZSwKICAgICAgICAgY29uc3QgRGV2aWNlVmVjdG9yICZhdmFpbERldmljZXMsCisgICAgICAgIHVpZF90IHVpZCwKICAgICAgICAgc3A8QXVkaW9Qb2xpY3lNaXg+ICpwb2xpY3lNaXgpIGNvbnN0CiB7CiAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBzaXplKCk7IGkrKykgewpAQCAtNDAxLDcgKzQwMywxMSBAQAogICAgICAgICAgICAgaWYgKChSVUxFX01BVENIX0FUVFJJQlVURV9DQVBUVVJFX1BSRVNFVCA9PSBtaXgtPm1Dcml0ZXJpYVtqXS5tUnVsZSAmJgogICAgICAgICAgICAgICAgICAgICBtaXgtPm1Dcml0ZXJpYVtqXS5tVmFsdWUubVNvdXJjZSA9PSBpbnB1dFNvdXJjZSkgfHwKICAgICAgICAgICAgICAgIChSVUxFX0VYQ0xVREVfQVRUUklCVVRFX0NBUFRVUkVfUFJFU0VUID09IG1peC0+bUNyaXRlcmlhW2pdLm1SdWxlICYmCi0gICAgICAgICAgICAgICAgICAgIG1peC0+bUNyaXRlcmlhW2pdLm1WYW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HluYW1pY0RldmljZShkZXZEZXNjKTsKICAgICAvLyBSZWNpcHJvY2FsbHkgYXR0YWNoIHRoZSBkZXZpY2UgdG8gdGhlIG1vZHVsZQogICAgIGRldkRlc2MtPmF0dGFjaCh0aGlzKTsKQEAgLTI3MSw4ICsyODEsOSBAQAogICAgIHJldHVybiBudWxscHRyOwogfQogCi1zcCA8SHdNb2R1bGU+IEh3TW9kdWxlQ29sbGVjdGlvbjo6Z2V0TW9kdWxlRm9yRGV2aWNlVHlwZShhdWRpb19kZXZpY2VzX3QgdHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1hdF90IGVuY29kZWRGb3JtYXQpIGNvbnN0CitzcDxId01vZHVsZT4gSHdNb2R1bGVDb2xsZWN0aW9uOjpnZXRNb2R1bGVGb3JEZXZpY2VUeXBlKGF1ZGlvX2RldmljZXNfdCB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19mb3JtYXRfdCBlbmNvZGVkRm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyAqdGFnTmFtZSkgY29uc3QKIHsKICAgICBmb3IgKGNvbnN0IGF1dG8mIG1vZHVsZSA6ICp0aGlzKSB7CiAgICAgICAgIGNvbnN0IGF1dG8mIHByb2ZpbGVzID0gYXVkaW9faXNfb3V0cHV0X2RldmljZSh0eXBlKSA/CkBAIC0yODQsOSArMjk1LDE1IEBACiAgICAgICAgICAgICAgICAgICAgIHNwIDxEZXZpY2VEZXNjcmlwdG9yPiBkZXZpY2VEZXNjID0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWNsYXJlZERldmljZXMuZ2V0RGV2aWNlKHR5cGUsIFN0cmluZzgoKSwgZW5jb2RlZEZvcm1hdCk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChkZXZpY2VEZXNjKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGFnTmFtZSAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKnRhZ05hbWUgPSBkZXZpY2VEZXNjLT5nZXRUYWdOYW1lKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbW9kdWxlOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRhZ05hbWUgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgICAgICAgICAgKnRhZ05hbWUgPSBwcm9maWxlLT5nZXRUYWcoe3R5cGV9KTsKKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICByZXR1cm4gbW9kdWxlOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KQEAgLTMyNSwxNSArMzQyLDMyIEBACiAgICAgfQogCiAgICAgZm9yIChjb25zdCBhdXRvJiBod01vZHVsZSA6ICp0aGlzKSB7CisgICAgICAgIGlmICghYWxsb3dUb0NyZWF0ZSkgeworICAgICAgICAgICAgYXV0byBkeW5hbWljRGV2aWNlcyA9IGh3TW9kdWxlLT5nZXREeW5hbWljRGV2aWNlcygpOworICAgICAgICAgICAgYXV0byBkeW5hbWljRGV2aWNlID0gZHluYW1pY0RldmljZXMuZ2V0RGV2aWNlKGRldmljZVR5cGUsIGRldkFkZHJlc3MsIGVuY29kZWRGb3JtYXQpOworICAgICAgICAgICAgaWYgKGR5bmFtaWNEZXZpY2UpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZHluYW1pY0RldmljZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogICAgICAgICBEZXZpY2VWZWN0b3IgbW9kdWxlRGV2aWNlcyA9IGh3TW9kdWxlLT5nZXRBbGxEZXZpY2VzKCk7CiAgICAgICAgIGF1dG8gbW9kdWxlRGV2aWNlID0gbW9kdWxlRGV2aWNlcy5nZXREZXZpY2UoZGV2aWNlVHlwZSwgZGV2QWRkcmVzcywgZW5jb2RlZEZvcm1hdCk7CisKKyAgICAgICAgLy8gUHJldmVudCBvdmVyd3JpdHRpbmcgbW9kdWxlRGV2aWNlIGFkZHJlc3MgaWYgY29ubmVjdGVkIGRldmljZSBkb2VzIG5vdCBoYXZlIHRoZSBzYW1lCisgICAgICAgIC8vIGFkZHJlc3MgKHNpbmNlIGdldERldmljZSB3aXRoIGVtcHR5IGFkZHJlc3MgaWdub3JlcyBtYXRjaCBvbiBhZGRyZXNzKSwgdXNlIGR5bmFtaWMgZGV2aWNlCisgICAgICAgIGlmIChtb2R1bGVEZXZpY2UgJiYgYWxsb3dUb0NyZWF0ZSAmJgorICAgICAgICAgICAgICAgICghbW9kdWxlRGV2aWNlLT5hZGRyZXNzKCkuZW1wdHkoKSAmJgorICAgICAgICAgICAgICAgICAobW9kdWxlRGV2aWNlLT5hZGRyZXNzKCkuY29tcGFyZShkZXZBZGRyZXNzLmNfc3RyKCkpICE9IDApKSkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KICAgICAgICAgaWYgKG1vZHVsZURldmljZSkgewogICAgICAgICAgICAgaWYgKGVuY29kZWRGb3JtYXQgIT0gQVVESU9fRk9STUFUX0RFRkFVTFQpIHsKICAgICAgICAgICAgICAgICBtb2R1bGVEZXZpY2UtPnNldEVuY29kZWRGb3JtYXQoZW5jb2RlZEZvcm1hdCk7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAoYWxsb3dUb0NyZWF0ZSkgewogICAgICAgICAgICAgICAgIG1vZHVsZURldmljZS0+YXR0YWNoKGh3TW9kdWxlKTsKKyAgICAgICAgICAgICAgICAvLyBOYW1lIG1heSBiZSBvdmVyd3JpdHRlbiwgcmVzdG9yZWQgb24gZGV0YWNoLgogICAgICAgICAgICAgICAgIG1vZHV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FsaXplKGNoaWxkLCBzZXJpYWxpemluZ0NvbnRleHQpOwotICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LmlzT2soKSkgewotICAgICAgICAgICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBUcmFpdDo6YWRkRWxlbWVudFRvQ29sbGVjdGlvbihlbGVtZW50LCBjb2xsZWN0aW9uKTsKKyAgICAgICAgICAgICAgICBhdXRvIG1heWJlRWxlbWVudCA9IGRlc2VyaWFsaXplPFRyYWl0PihjaGlsZCwgc2VyaWFsaXppbmdDb250ZXh0KTsKKyAgICAgICAgICAgICAgICBpZiAobWF5YmVFbGVtZW50LmluZGV4KCkgPT0gMSkgeworICAgICAgICAgICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBUcmFpdDo6YWRkRWxlbWVudFRvQ29sbGVjdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OmdldDwxPihtYXliZUVsZW1lbnQpLCBjb2xsZWN0aW9uKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewogICAgICAgICAgICAgICAgICAgICAgICAgQUxPR0UoIiVzOiBjb3VsZCBub3QgYWRkIGVsZW1lbnQgdG8gJXMgY29sbGVjdGlvbiIsIF9fZnVuY19fLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRyYWl0Ojpjb2xsZWN0aW9uVGFnKTsKICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzdGF0dXM7CiAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1JZ25vcmVWZW5kb3JFeHRlbnNpb25zICYmIHN0ZDo6Z2V0PHN0YXR1c190PihtYXliZUVsZW1lbnQpID09IE5PX0lOSVQpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gU2tpcCBhIHZlbmRvciBleHRlbnNpb24gZWxlbWVudC4KICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAg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KICAgICBSb3V0ZVRyYWl0czo6Q29sbGVjdGlvbiByb3V0ZXM7CiAgICAgc3RhdHVzID0gZGVzZXJpYWxpemVDb2xsZWN0aW9uPFJvdXRlVHJhaXRzPihjdXIsICZyb3V0ZXMsIG1vZHVsZS5nZXQoKSk7CiAgICAgaWYgKHN0YXR1cyAhPSBOT19FUlJPUikgewotICAgICAgICByZXR1cm4gU3RhdHVzOjpmcm9tU3RhdHVzVChzdGF0dXMpOworICAgICAgICByZXR1cm4gc3RhdHVzOwogICAgIH0KICAgICBtb2R1bGUtPnNldFJvdXRlcyhyb3V0ZXMpOwogCkBAIC02NTMsNiArNzEzLDEyIEBACiAgICAgICAgICAgICAgICAgICAgICAgICBzcDxEZXZpY2VEZXNjcmlwdG9yPiBkZXZpY2UgPSBtb2R1bGUtPmdldERlY2xhcmVkRGV2aWNlcygpLgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXREZXZpY2VGcm9tVGFnTmFtZShzdGQ6OnN0cmluZyhyZWludGVycHJldF9jYXN0PGNvbnN0IGNoYXIqPigKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR0YWNoZWREZXZpY2UuZ2V0KCkpKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGV2aWNlID09IG51bGxwdHIgJiYgbUlnbm9yZVZlbmRvckV4dGVuc2lvbnMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVygiU2tpcHBlZCBhdHRhY2hlZCBkZXZpY2UgXCIlc1wiIGJlY2F1c2UgaXQgbGlrZWx5IHVzZXMgYSB2ZW5kb3IiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZXh0ZW5zaW9uIHR5cGUiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDxjb25zdCBjaGFyKj4oYXR0YWNoZWREZXZpY2UuZ2V0KCkpKTs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GxpbmdSYXRlcz0iNDQxMDAiCisgICAgICAgICAgICAgICAgICAgICBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyIvPgorICAgICAgICA8L2RldmljZVBvcnQ+CisgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IkJUIEEyRFAgSW4iIHR5cGU9IkFVRElPX0RFVklDRV9JTl9CTFVFVE9PVEhfQTJEUCIgcm9sZT0ic291cmNlIj4KKyAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjQ0MTAwIDQ4MDAwIgorICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX0lOX01PTk8gQVVESU9fQ0hBTk5FTF9JTl9TVEVSRU8iLz4KKyAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgIDwvZGV2aWNlUG9ydHM+CisgICAgPHJvdXRlcz4KKyAgICAgICAgPHJvdXRlIHR5cGU9Im1peCIgc2luaz0iQlQgQTJEUCBPdXQiCisgICAgICAgICAgICAgICBzb3VyY2VzPSJhMmRwIG91dHB1dCIvPgorICAgICAgICA8cm91dGUgdHlwZT0ibWl4IiBzaW5rPSJCVCBBMkRQIEhlYWRwaG9uZXMiCisgICAgICAgICAgICAgICBzb3VyY2VzPSJhMmRwIG91dHB1dCIvPgorICAgICAgICA8cm91dGUgdHlwZT0ibWl4IiBzaW5rPSJCVCBBMkRQIFNwZWFrZXIiCisgICAgICAgICAgICAgICBzb3VyY2VzPSJhMmRwIG91dHB1dCIvPgorICAgICAgICA8cm91dGUgdHlwZT0ibWl4IiBzaW5rPSJhMmRwIGlucHV0IgorICAgICAgICAgICAgICAgc291cmNlcz0iQlQgQTJEUCBJbiIvPgorICAgIDwvcm91dGVzPgorPC9tb2R1bGU+CmRpZmYgLS1naXQgYS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eSBBdWRpbyBIQUwgLS0+CisgICAgICAgIDxtb2R1bGUgbmFtZT0icHJpbWFyeSIgaGFsVmVyc2lvbj0iMy4wIj4KKyAgICAgICAgICAgIDxhdHRhY2hlZERldmljZXM+CisgICAgICAgICAgICAgICAgPGl0ZW0+U3BlYWtlcjwvaXRlbT4KKyAgICAgICAgICAgICAgICA8aXRlbT5CdWlsdC1JbiBNaWM8L2l0ZW0+CisgICAgICAgICAgICAgICAgPGl0ZW0+QnVpbHQtSW4gQmFjayBNaWM8L2l0ZW0+CisgICAgICAgICAgICA8L2F0dGFjaGVkRGV2aWNlcz4KKyAgICAgICAgICAgIDxkZWZhdWx0T3V0cHV0RGV2aWNlPlNwZWFrZXI8L2RlZmF1bHRPdXRwdXREZXZpY2U+CisgICAgICAgICAgICA8bWl4UG9ydHM+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0icHJpbWFyeSBvdXRwdXQiIHJvbGU9InNvdXJjZSIgZmxhZ3M9IkFVRElPX09VVFBVVF9GTEFHX1BSSU1BUlkiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjQ4MDAwIiBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyIvPgorICAgICAgICAgICAgICAgIDwvbWl4UG9ydD4KKyAgICAgICAgICAgICAgICA8bWl4UG9ydCBuYW1lPSJkZWVwX2J1ZmZlciIgcm9sZT0ic291cmNlIgorICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3M9IkFVRElPX09VVFBVVF9GTEFHX0RFRVBfQlVGRkVSIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0iY29tcHJlc3NlZF9vZmZsb2FkIiByb2xlPSJzb3VyY2UiCisgICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3M9IkFVRElPX09VVFBVVF9GTEFHX0RJUkVDVCBBVURJT19PVVRQVVRfRkxBR19DT01QUkVTU19PRkZMT0FEIEFVRElPX09VVFBVVF9GTEFHX05PTl9CTE9DS0lORyI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfTVAzIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI4MDAwIDExMDI1IDEyMDAwIDE2MDAwIDIyMDUwIDI0MDAwIDMyMDAwIDQ0MTAwIDQ4MDAwIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyBBVURJT19DSEFOTkVMX09VVF9NT05PIi8+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfQUFDIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI4MDAwIDExMDI1IDEyMDAwIDE2MDAwIDIyMDUwIDI0MDAwIDMyMDAwIDQ0MTAwIDQ4MDAwIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyBBVURJT19DSEFOTkVMX09VVF9NT05PIi8+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfQUFDX0xDIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI4MDAwIDExMDI1IDEyMDAwIDE2MDAwIDIyMDUwIDI0MDAwIDMyMDAwIDQ0MTAwIDQ4MDAwIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyBBVURJT19DSEFOTkVMX09VVF9NT05PIi8+CisgICAgICAgICAgICAgICAgPC9taXhQb3J0PgorICAgICAgICAgICAgICAgIDxtaXhQb3J0IG5hbWU9InZvaWNlX3R4IiByb2xlPSJzb3VyY2UiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjgwMDAgMTYwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9PVVRfTU9OTyIvPgorICAgICAgICAgICAgICAgIDwvbWl4UG9ydD4KKyAgICAgICAgICAgICAgICA8bWl4UG9ydCBuYW1lPSJwcmltYXJ5IGlucHV0IiByb2xlPSJzaW5rIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI4MDAwIDExMDI1IDEyMDAwIDE2MDAwIDIyMDUwIDI0MDAwIDMyMDAwIDQ0MTAwIDQ4MDAwIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfSU5fTU9OTyBBVURJT19DSEFOTkVMX0lOX1NURVJFTyBBVURJT19DSEFOTkVMX0lOX0ZST05UX0JBQ0siLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0idm9pY2VfcngiIHJvbGU9InNpbmsiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjgwMDAgMTYwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9JTl9NT05PIi8+CisgICAgICAgICAgICAgICAgPC9taXhQb3J0PgorICAgICAgICAgICAgPC9taXhQb3J0cz4KKyAgICAgICAgICAgIDxkZXZpY2VQb3J0cz4KKyAgICAgICAgICAgICAgICA8IS0tIE91dHB1dCBkZXZpY2VzIGRlY2xhcmF0aW9uLCBpLmUuIFNpbmsgREVWSUNFIFBPUlQgLS0+CisgICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iRWFycGllY2UiIHR5cGU9IkFVRElPX0RFVklDRV9PVVRfRUFSUElFQ0UiIHJvbGU9InNpbmsiPgorICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9NT05PIi8+CisgICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IlNwZWFrZXIiIHJvbGU9InNpbmsiIHR5cGU9IkFVRElPX0RFVklDRV9PVVRfU1BFQUtFUiIgYWRkcmVzcz0iIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICAgICAgPGdhaW5zPgorICAgICAgICAgICAgICAgICAgICAgICAgPGdhaW4gbmFtZT0iZ2Fpbl8xIiBtb2RlPSJBVURJT19HQUlOX01PREVfSk9JTlQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW5WYWx1ZU1CPSItODQwMCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heFZhbHVlTUI9IjQwMDAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWVNQj0iMCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZXBWYWx1ZU1CPSIxMDAiLz4KKyAgICAgICAgICAgICAgICAgICAgPC9nYWlucz4KKyAgICAgICAgICAgICAgICA8L2RldmljZVBvcnQ+CisgICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iV2lyZWQgSGVhZHNldCIgdHlwZT0iQVVESU9fREVWSUNFX09VVF9XSVJFRF9IRUFEU0VUIiByb2xlPSJzaW5rIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L2RldmljZVBvcnQ+CisgICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iV2lyZWQgSGVhZHBob25lcyIgdHlwZT0iQVVESU9fREVWSUNFX09VVF9XSVJFRF9IRUFEUEhPTkUiIHJvbGU9InNpbmsiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjQ4MDAwIiBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyIvPgorICAgICAgICAgICAgICAgIDwvZGV2aWNlUG9ydD4KKyAgICAgICAgICAgICAgICA8ZGV2aWNlUG9ydCB0YWdOYW1lPSJCVCBTQ08iIHR5cGU9IkFVRElPX0RFVklDRV9PVVRfQkxVRVRPT1RIX1NDTyIgcm9sZT0ic2luayI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iODAwMCAxNjAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9NT05PIi8+CisgICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IkJUIFNDTyBIZWFkc2V0IiB0eXBlPSJBVURJT19ERVZJQ0VfT1VUX0JMVUVUT09USF9TQ09fSEVBRFNFVCIgcm9sZT0ic2luayI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iODAwMCAxNjAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9NT05PIi8+CisgICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IkJUIFNDTyBDYXIgS2l0IiB0eXBlPSJBVURJT19ERVZJQ0VfT1VUX0JMVUVUT09USF9TQ09fQ0FSS0lUIiByb2xlPSJzaW5rIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI4MDAwIDE2MDAwIiBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX01PTk8iLz4KKyAgICAgICAgICAgICAgICA8L2RldmljZVBvcnQ+CisgICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iVGVsZXBob255IFR4IiB0eXBlPSJBVURJT19ERVZJQ0VfT1VUX1RFTEVQSE9OWV9UWCIgcm9sZT0ic2luayI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iODAwMCAxNjAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9NT05PIi8+CisgICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorCisgICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iQnVpbHQtSW4gTWljIiB0eXBlPSJBVURJT19ERVZJQ0VfSU5fQlVJTFRJTl9NSUMiIHJvbGU9InNvdXJjZSI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iODAwMCAxMTAyNSAxMjAwMCAxNjAwMCAyMjA1MCAyNDAwMCAzMjAwMCA0NDEwMCA0ODAwMCIKKyAgICAgICAgICAgICAgICAgICAgICA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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfSU5fTU9OTyBBVURJT19DSEFOTkVMX0lOX1NURVJFTyBBVURJT19DSEFOTkVMX0lOX0ZST05UX0JBQ0siLz4KKyAgICAgICAgICAgICAgICA8L2RldmljZVBvcnQ+CisgICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iQlQgU0NPIEhlYWRzZXQgTWljIiB0eXBlPSJBVURJT19ERVZJQ0VfSU5fQkxVRVRPT1RIX1NDT19IRUFEU0VUIiByb2xlPSJzb3VyY2UiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjgwMDAgMTYwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9JTl9NT05PIi8+CisgICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IlRlbGVwaG9ueSBSeCIgdHlwZT0iQVVESU9fREVWSUNFX0lOX1RFTEVQSE9OWV9SWCIgcm9sZT0ic291cmNlIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI4MDAwIDE2MDAwIiBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfSU5fTU9OTyIvPgorICAgICAgICAgICAgICAgIDwvZGV2aWNlUG9ydD4KKyAgICAgICAgICAgIDwvZGV2aWNlUG9ydHM+CisgICAgICAgICAgICA8IS0tIHJvdXRlIGRlY2xhcmF0aW9uLCBpLmUuIGxpc3QgYWxsIGF2YWlsYWJsZSBzb3VyY2VzIGZvciBhIGdpdmVuIHNpbmsgLS0+CisgICAgICAgICAgICA8cm91dGVzPgorICAgICAgICAgICAgICAgIDxyb3V0ZSB0eXBlPSJtaXgiIHNpbms9IkVhcnBpZWNlIgorICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2VzPSJwcmltYXJ5IG91dHB1dCxkZWVwX2J1ZmZlcixCVCBTQ08gSGVhZHNldCBNaWMiLz4KKyAgICAgICAgICAgICAgICA8cm91dGUgdHlwZT0ibWl4IiBzaW5rPSJTcGVha2VyIgorICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2VzPSJwcmltYXJ5IG91dHB1dCxkZWVwX2J1ZmZlcixjb21wcmVzc2VkX29mZmxvYWQsQlQgU0NPIEhlYWRzZXQgTWljLFRlbGVwaG9ueSBSeCIvPgorICAgICAgICAgICAgICAgIDxyb3V0ZSB0eXBlPSJtaXgiIHNpbms9IldpcmVkIEhlYWRzZXQiCisgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZXM9InByaW1hcnkgb3V0cHV0LGRlZXBfYnVmZmVyLGNvbXByZXNzZWRfb2ZmbG9hZCxCVCBTQ08gSGVhZHNldCBNaWMsVGVsZXBob255IFJ4Ii8+CisgICAgICAgICAgICAgICAgPHJvdXRlIHR5cGU9Im1peCIgc2luaz0iV2lyZWQgSGVhZHBob25lcyIKKyAgICAgICAgICAgICAgICAgICAgICAgc291cmNlcz0icHJpbWFyeSBvdXRwdXQsZGVlcF9idWZmZXIsY29tcHJlc3NlZF9vZmZsb2FkLEJUIFNDTyBIZWFkc2V0IE1pYyxUZWxlcGhvbnkgUngiLz4KKyAgICAgICAgICAgICAgICA8cm91dGUgdHlwZT0ibWl4IiBzaW5rPSJwcmltYXJ5IGlucHV0IgorICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2VzPSJCdWlsdC1JbiBNaWMsQnVpbHQtSW4gQmFjayBNaWMsV2lyZWQgSGVhZHNldCBNaWMsQlQgU0NPIEh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2FwdHVyZVByZXNldCgKKyAgICAgICAgICAgICAgICBhdWRpb1NvdXJjZSwKKyAgICAgICAgICAgICAgICByb2xlID09IERFVklDRV9ST0xFX1BSRUZFUlJFRCA/IERFVklDRV9ST0xFX0RJU0FCTEVEIDogREVWSUNFX1JPTEVfUFJFRkVSUkVELAorICAgICAgICAgICAgICAgIGRldmljZXMsCisgICAgICAgICAgICAgICAgZmFsc2UgLypmb3JjZU1hdGNoZWQqLyk7CisgICAgfSBicmVhazsKKyAgICBjYXNlIERFVklDRV9ST0xFX05PTkU6CisgICAgICAgIC8vIEludGVudGlvbmFsbHkgZmFsbC10aHJvdWdoIGFzIGl0IGlzIG5vIG5lZWQgdG8gc2V0IGRldmljZSByb2xlIGFzIG5vbmUKKyAgICBkZWZhdWx0OgorICAgICAgICBBTE9HRSgiJXMgaW52YWxpZCByb2xlICVkIiwgX19mdW5jX18sIHJvbGUpOworICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgIH0KKyAgICByZXR1cm4gTk9fRVJST1I7Cit9CisKK3N0YXR1c190IEVuZ2luZUJhc2U6OnJlbW92ZURldmljZXNSb2xlRm9yQ2FwdHVyZVByZXNldCgKKyAgICAgICAgYXVkaW9fc291cmNlX3QgYXVkaW9Tb3VyY2UsIGRldmljZV9yb2xlX3Qgcm9sZSwgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciYgZGV2aWNlcykgeworICAgIHJldHVybiBkb1JlbW92ZURldmljZXNSb2xlRm9yQ2FwdHVyZVByZXNldChhdWRpb1NvdXJjZSwgcm9sZSwgZGV2aWNlcyk7Cit9CisKK3N0YXR1c190IEVuZ2luZUJhc2U6OmRvUmVtb3ZlRGV2aWNlc1JvbGVGb3JDYXB0dXJlUHJlc2V0KGF1ZGlvX3NvdXJjZV90IGF1ZGlvU291cmNlLAorICAgICAgICBkZXZpY2Vfcm9sZV90IHJvbGUsIGNvbnN0IEF1ZGlvRGV2aWNlVHlwZUFkZHJWZWN0b3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R19TQ08sCkBAIC0zOSwxMCArMzksMTEgQEAKICAgICAgewogICAgICAgICAgeyJyaW5nIiwgQVVESU9fU1RSRUFNX1JJTkcsICJBVURJT19TVFJFQU1fUklORyIsCiAgICAgICAgICAge3tBVURJT19DT05URU5UX1RZUEVfVU5LTk9XTiwgQVVESU9fVVNBR0VfTk9USUZJQ0FUSU9OX1RFTEVQSE9OWV9SSU5HVE9ORSwKLSAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiIn19CisgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn19CiAgICAgICAgICB9LAogICAgICAgICAgeyJhbGFybSIsIEFVRElPX1NUUkVBTV9BTEFSTSwgIkFVRElPX1NUUkVBTV9BTEFSTSIsCi0gICAgICAgICAge3tBVURJT19DT05URU5UX1RZUEVfVU5LTk9XTiwgQVVESU9fVVNBR0VfQUxBUk0sIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiIn19LAorICAgICAgICAgIHt7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX0FMQVJNLCBBVURJT19TT1VSQ0VfREVGQVVMVCwKKyAgICAgICAgICAgIEFVRElPX0ZMQUdfTk9ORSwgIiJ9fSwKICAgICAgICAgIH0KICAgICAgfSwKICAgICB9LApAQCAtNTgsNyArNTksNyBAQAogICAgICB7CiAgICAgICAgICB7IiIsIEFVRElPX1NUUkVBTV9BQ0NFU1NJQklMSVRZLCAiQVVESU9fU1RSRUFNX0FDQ0VTU0lCSUxJVFkiLAogICAgICAgICAgIHt7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX0FTU0lTVEFOQ0VfQUNDRVNTSUJJTElUWSwKLSAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiIn19CisgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn19CiAgICAgICAgICB9CiAgICAgIH0sCiAgICAgfSwKQEAgLTY2LDE1ICs2NywxNiBAQAogICAgICB7CiAgICAgICAgICB7IiIsIEFVRElPX1NUUkVBTV9OT1RJRklDQVRJT04sICJBVURJT19TVFJFQU1fTk9USUZJQ0FUSU9OIiwKICAgICAgICAgICB7Ci0gICAgICAgICAgICAgIHtBVURJT19DT05URU5UX1RZUEVfVU5LTk9XTiwgQVVESU9fVVNBR0VfTk9USUZJQ0FUSU9OLCBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgIiJ9LAorICAgICAgICAgICAgICB7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX05PVElGSUNBVElPTiwgQVVESU9fU09VUkNFX0RFRkFVTFQsCisgICAgICAgICAgICAgICBBVURJT19GTEFHX05PTkUsICIifSwKICAgICAgICAgICAgICAge0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9OT1RJRklDQVRJT05fQ09NTVVOSUNBVElPTl9SRVFVRVNULAotICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICIifSwKICAgICAgICAgICAgICAge0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9OT1RJRklDQVRJT05fQ09NTVVOSUNBVElPTl9JTlNUQU5ULAotICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICIifSwKICAgICAgICAgICAgICAge0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9OT1RJRklDQVRJT05fQ09NTVVOSUNBVElPTl9ERUxBWUVELAotICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICIifSwKICAgICAgICAgICAgICAge0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9OT1RJRklDQVRJT05fRVZFTlQsCi0gICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgIiJ9CisgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0KICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgIH0sCkBAIC04MywyMSArODUsMjUgQEAKICAgICAgewogICAgICAgICAgeyJhc3Npc3RhbnQiLCBBVURJT19TVFJFQU1fQVNTSVNUQU5ULCAiQVVESU9fU1RSRUFNX0FTU0lTVEFOVCIsCiAgICAgICAgICAge3tBVURJT19DT05URU5UX1RZUEVfU1BFRUNILCBBVURJT19VU0FHRV9BU1NJU1RBTlQsCi0gICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgIiJ9fQorICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgIiJ9fQogICAgICAgICAgfSwKICAgICAgICAgIHsibXVzaWMiLCBBVURJT19TVFJFQU1fTVVTSUMsICJBVURJT19TVFJFQU1fTVVTSUMiLAogICAgICAgICAgIHsKLSAgICAgICAgICAgICAge0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9NRURJQSwgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKLSAgICAgICAgICAgICAge0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9HQU1FLCBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgIiJ9LAotICAgICAgICAgICAgICB7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX0FTU0lTVEFOVCwgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAge0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9NRURJQSwgQVVESU9fU09VUkNFX0RFRkFVTFQsCisgICAgICAgICAgICAgICBBVURJT19GTEFHX05PTkUsICIifSwKKyAgICAgICAgICAgICAge0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9HQU1FLCBBVURJT19TT1VSQ0VfREVGQVVMVCwKKyAgICAgICAgICAgICAgIEFVRElPX0ZMQUdfTk9ORSwgIiJ9LAorICAgICAgICAgICAgICB7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX0FTU0lTVEFOVCwgQVVESU9fU09VUkNFX0RFRkFVTFQsCisgICAgICAgICAgICAgICBBVURJT19GTEFHX05PTkUsICIifSwKICAgICAgICAgICAgICAge0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9BU1NJU1RBTkNFX05BVklHQVRJT05fR1VJREFOQ0UsCi0gICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgIiJ9LAotICAgICAgICAgICAgICB7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX1VOS05PV04sIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiIn0KKyAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICIifSwKKyAgICAgICAgICAgICAge0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9VTktOT1dOLCBBVURJT19TT1VSQ0VfREVGQVVMVCwKKyAgICAgICAgICAgICAgIEFVRElPX0ZMQUdfTk9ORSwgIiJ9CiAgICAgICAgICAgfSwKICAgICAgICAgIH0sCiAgICAgICAgICB7InN5c3RlbSIsIEFVRElPX1NUUkVBTV9TWVNURU0sICJBVURJT19TVFJFQU1fU1lTVEVNIiwKICAgICAgICAgICB7e0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9BU1NJU1RBTkNFX1NPTklGSUNBVElPTiwKLSAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiIn19CisgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn19CiAgICAgICAgICB9CiAgICAgIH0sCiAgICAgfSwKQEAgLTEwNiw3ICsxMTIsNyBAQAogICAgICAgICAgeyIiLCBBVURJT19TVFJFQU1fRFRNRiwgIkFVRElPX1NUUkVBTV9EVE1GIiwKICAgICAgICAgICB7CiAgICAgICAgICAgICAgIHtBVURJT19DT05URU5UX1RZUEVfVU5LTk9XTiwgQVVESU9fVVNBR0VfVk9JQ0VfQ09NTVVOSUNBVElPTl9TSUdOQUxMSU5HLAotICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifQorICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgIiJ9CiAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICB9LApAQCAtMTE0LDcgKzEyMCw4IEBACiAgICAgeyJTVFJBVEVHWV9DQUxMX0FTU0lTVEFOVCIsCiAgICAgIHsKICAgICAgICAgIHsiIiwgQVVESU9fU1RSRUFNX0NBTExfQVNTSVNUQU5ULCAiQVVESU9fU1RSRUFNX0NBTExfQVNTSVNUQU5UIiwKLSAgICAgICAgICB7e0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9DQUxMX0FTU0lTVEFOVCwgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifX0KKyAgICAgICAgICB7e0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9DQUxMX0FTU0lTVEFOVCwgQVVESU9fU09VUkNFX0RFRkFVTFQsCisgICAgICAgICAgICBBVURJT19GTEFHX05PTkUsICIifX0KICAgICAgICAgIH0KICAgICAgfSwKICAgICB9LApAQCAtMTM2LDE0ICsxNDMsMTYgQEAKICAgICB7InJlcm91dGluZyIsCiAgICAgIHsKICAgICAgICAgIHsiIiwgQVVESU9fU1RSRUFNX1JFUk9VVElORywgIkFVRElPX1NUUkVBTV9SRVJPVVRJTkciLAotICAgICAgICAgIHt7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX1ZJUlRVQUxfU09VUkNFLCBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgIiJ9fQorICAgICAgICAgIHt7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX1ZJUlRVQUxfU09VUkNFLCBBVURJT19TT1VSQ0VfREVGQVVMVCwKKyAgICAgICAgICAgIEFVRElPX0ZMQUdfTk9ORSwgIiJ9fQogICAgICAgICAgfQogICAgICB9LAogICAgIH0sCiAgICAgeyJwYXRjaCIsCiAgICAgIHsKICAgICAgICAgIHsiIiwgQVVESU9fU1RSRUFNX1BBVENILCAiQVVESU9fU1RSRUFNX1BBVENIIiwKLSAgICAgICAgICB7e0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9VTktOT1dOLCBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgIiJ9fQorICAgICAgICAgIHt7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX1VOS05PV04sIEFVRElPX1NPVVJDRV9ERUZBVUxULAorICAgICAgICAgICAgQVVESU9fRkxBR19OT05FLCAiIn19CiAgICAgICAgICB9CiAgICAgIH0sCiAgICAgfQpkaWZmIC0tZ2l0IGEvc2Vydmlj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mUuY3BwIGIvc2VydmljZXMvYXVkaW9wb2xpY3kvZW5naW5lY29uZmlndXJhYmxlL3NyYy9FbmdpbmUuY3BwCmluZGV4IDZkNDJmY2YuLmIwYzM3NmEgMTAwNjQ0Ci0tLSBhL3NlcnZpY2VzL2F1ZGlvcG9saWN5L2VuZ2luZWNvbmZpZ3VyYWJsZS9zcmMvRW5naW5lLmNwcAorKysgYi9zZXJ2aWNlcy9hdWRpb3BvbGljeS9lbmdpbmVjb25maWd1cmFibGUvc3JjL0VuZ2luZS5jcHAKQEAgLTMxMCw2ICszMTAsNyBAQAogfQogCiBzcDxEZXZpY2VEZXNjcmlwdG9yPiBFbmdpbmU6OmdldElucHV0RGV2aWNlRm9yQXR0cmlidXRlcyhjb25zdCBhdWRpb19hdHRyaWJ1dGVzX3QgJmF0dHIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcDxBdWRpb1BvbGljeU1peD4gKm1peCkgY29uc3QKIHsKICAgICBjb25zdCBhdXRvICZwb2xpY3lNaXhlcyA9IGdldEFwbU9ic2VydmVyKCktPmdldEF1ZGlvUG9saWN5TWl4Q29sbGVjdGlvbigpOwpAQCAtMzI4LDcgKzMyOSwxMCBAQAogICAgICAgICByZXR1cm4gZGV2aWNlOwogICAgIH0KIAotICAgIGRldmljZSA9IHBvbGljeU1peGVzLmdldERldmljZUFuZE1peEZvcklucHV0U291cmNlKGF0dHIuc291cmNlLCBhdmFpbGFibGVJbnB1dERldmljZXMsIG1peCk7CisgICAgZGV2aWNlID0gcG9saWN5TWl4ZXMuZ2V0RGV2aWNlQW5kTWl4Rm9ySW5wdXRTb3VyY2UoYXR0ci5zb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXZhaWxhYmxlSW5wdXREZXZpY2VzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaXgpOwogICAgIGlmIChkZXZpY2UgIT0gbnVsbHB0cikgewogICAgICAgICByZXR1cm4gZGV2aWNlOwogICAgIH0KZGlmZiAtLWdpdCBhL3NlcnZpY2VzL2F1ZGlvcG9saWN5L2VuZ2luZWNvbmZpZ3VyYWJsZS9zcmMvRW5naW5lLmggYi9zZXJ2aWNlcy9hdWRpb3BvbGljeS9lbmdpbmVjb25maWd1cmFibGUvc3JjL0VuZ2luZS5oCmluZGV4IDNiMzcxZDguLmQ4ZTI3NDIgMTAwNjQ0Ci0tLSBhL3NlcnZpY2VzL2F1ZGlvcG9saWN5L2VuZ2luZWNvbmZpZ3VyYWJsZS9zcmMvRW5naW5lLmgKKysrIGIvc2VydmljZXMvYXVkaW9wb2xpY3kvZW5naW5lY29uZmlndXJhYmxlL3NyYy9FbmdpbmUuaApAQCAtNjEsOCArNjEsMTAgQEAKICAgICBEZXZpY2VWZWN0b3IgZ2V0T3V0cHV0RGV2aWNlc0ZvclN0cmVhbShhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGZyb21DYWNoZSA9IGZhbHNlKSBjb25zdCBvdmVycmlkZTsKIAotICAgIHNwPERldmljZURlc2NyaXB0b3I+IGdldElucHV0RGV2aWNlRm9yQXR0cmlidXRlcygKLSAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAmYXR0ciwgc3A8QXVkaW9Qb2xpY3lNaXg+ICptaXggPSBudWxscHRyKSBjb25zdCBvdmVycmlkZTsKKyAgICBzcDxEZXZpY2VEZXNjcmlwdG9yPiBnZXRJbnB1dERldmljZUZvckF0dHJpYnV0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dHVyZUZpbGUoY29tcG9uZW50VHlwZURpY3QsIHN0cnVjdHVyZVR5cGVzRmlsZSwgb3V0cHV0RmlsZSk6CiAKQEAgLTc0LDEwICs4MCwxMiBAQAogICAgICAgICAgICAgICAgIGlmIGJpdHBhcmFtZXRlcnNfbm9kZSBpcyBub3QgTm9uZToKICAgICAgICAgICAgICAgICAgICAgb3JkZXJlZF92YWx1ZXMgPSBPcmRlcmVkRGljdChzb3J0ZWQodmFsdWVzX2RpY3QuaXRlbXMoKSwga2V5PWxhbWJkYSB4OiB4WzFdKSkKICAgICAgICAgICAgICAgICAgICAgZm9yIGtleSwgdmFsdWUgaW4gb3JkZXJlZF92YWx1ZXMuaXRlbXMoKToKLSAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlX25vZGUgPSBFVC5TdWJFbGVtZW50KGJpdHBhcmFtZXRlcnNfbm9kZSwgIkJpdFBhcmFtZXRlciIpCi0gICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZV9ub2RlLnNldCgnTmFtZScsIGtleSkKLSAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlX25vZGUuc2V0KCdTaXplJywgIjEiKQotICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVfbm9kZS5zZXQoJ1BvcycsIHN0cihmaW5kQml0UG9zKHZhbHVlKSkpCisgICAgICAgICAgICAgICAgICAgICAgICBwb3MgPSBmaW5kQml0UG9zKHZhbHVlKQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgcG9zID49IDA6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVfbm9kZSA9IEVULlN1YkVsZW1lbnQoYml0cGFyYW1ldGVyc19ub2RlLCAiQml0UGFyYW1ldGVyIikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZV9ub2RlLnNldCgnTmFtZScsIGtleSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZV9ub2RlLnNldCgnU2l6ZScsICIxIikKKyAgICAgICAgICAgIC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ArMTY0LDE0IEBACiAKICAgICAgICAgICAgIGxvZ2dpbmcuZGVidWcoInR5cGU6e30sIGxpdGVyYWw6e30sIHZhbHVlczp7fS4iLmZvcm1hdChjb21wb25lbnRfdHlwZV9uYW1lLCBjb21wb25lbnRfdHlwZV9saXRlcmFsLCBjb21wb25lbnRfdHlwZV9udW1lcmljYWxfdmFsdWUpKQogCi0gICAgIyBUcmFuc2Zvcm0gaW5wdXQgc291cmNlIGluIGluY2x1c2l2ZSBjcml0ZXJpb24KLSAgICBzaGlmdCA9IGxlbihhbGxfY29tcG9uZW50X3R5cGVzWydPdXRwdXREZXZpY2VzTWFzayddKQotICAgIGlmIHNoaWZ0ID4gMzI6Ci0gICAgICAgIGxvZ2dpbmcuY3JpdGljYWwoIk91dHB1dERldmljZXNNYXNrIGluY29tcGF0aWJsZSB3aXRoIGNyaXRlcmlvbiByZXByZXNlbnRhdGlvbiBvbiAzMiBiaXRzIikKLSAgICAgICAgbG9nZ2luZy5pbmZvKCJFWElUIE9OIEZBSUxVUkUiKQotICAgICAgICBleGl0KDEpCisgICAgaWYgInN0dWIiIG5vdCBpbiBhbGxfY29tcG9uZW50X3R5cGVzWyJPdXRwdXREZXZpY2VzTWFzayJdOgorICAgICAgICBhbGxfY29tcG9uZW50X3R5cGVzWyJPdXRwdXREZXZpY2VzTWFzayJdWyJzdHViIl0gPSAweDQwMDAwMDAwCisgICAgICAgIGxvZ2dpbmcuaW5mbygiYWRkZWQgc3R1YiBvdXRwdXQgZGV2aWNlIG1hc2siKQorICAgIGlmICJzdHViIiBub3QgaW4gYWxsX2NvbXBvbmVudF90eXBlc1siSW5wdXREZXZpY2VzTWFzayJdOgorICAgICAgICBhbGxfY29tcG9uZW50X3R5cGVzWyJJbnB1dERldmljZXNNYXNrIl1bInN0dWIiXSA9IDB4NDAwMDAwMDAKKyAgICAgICAgbG9nZ2luZy5pbmZvKCJhZGRlZCBzdHViIGlucHV0IGRldmljZSBtYXNrIikKIAorICAgICMgVHJhbnNmb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IEFVRElPX0RFVklDRV9JTjogbmVlZCB0byByZW1vdmUgc2lnbiBiaXQgLyByZW5hbWUgZGVmYXVsdCB0byBzdHViCiAgICAgICAgICAgICBpZiBjcml0ZXJpb25fbmFtZSA9PSAiSW5wdXREZXZpY2VzTWFza1R5cGUiOgotICAgICAgICAgICAgICAgIG51bWVyaWNhbF92YWx1ZSA9IHN0cihpbnQobnVtZXJpY2FsX3ZhbHVlLCAwKSAmIH4yMTQ3NDgzNjQ4KQorICAgICAgICAgICAgICAgIGlmIGNyaXRlcmlvbl9saXRlcmFsID09ICJEZWZhdWx0IjoKKyAgICAgICAgICAgICAgICAgICAgY3JpdGVyaW9uX251bWVyaWNhbF92YWx1ZSA9IHN0cihpbnQoIjB4NDAwMDAwMDAiLCAwKSkKKyAgICAgICAgICAgICAgICBlbHNlOgorICAgICAgICAgICAgICAgICAgICB0cnk6CisgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmdfaW50ID0gaW50KGNyaXRlcmlvbl9udW1lcmljYWxfdmFsdWUsIDApCisgICAgICAgICAgICAgICAgICAgIGV4Y2VwdCBWYWx1ZUVycm9yOgorICAgICAgICAgICAgICAgICAgICAgICAgIyBIYW5kbGUgdGhlIGV4Y2VwdGlvbgorICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2luZy5pbmZvKCJ2YWx1ZSB7fTp7fSBmb3IgY3JpdGVyaW9uIHt9IGlzIG5vdCBhIG51bWJlciwgaWdub3JpbmciCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmZvcm1hdChjcml0ZXJpb25fbnVtZXJpY2FsX3ZhbHVlLCBjcml0ZXJpb25fbGl0ZXJhbCwgY3JpdGVyaW9uX25hbWUpKQorICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWUKKyAgICAgICAgICAgICAgICAgICAgY3JpdGVyaW9uX251bWVyaWNhbF92YWx1ZSA9IHN0cihpbnQoY3JpdGVyaW9uX251bWVyaWNhbF92YWx1ZSwgMCkgJiB+MjE0NzQ4MzY0OCkKKworICAgICAgICAgICAgaWYgY3JpdGVyaW9uX25hbWUgPT0gIk91dHB1dERldmljZXNNYXNrVHlwZSI6CisgICAgICAgICAgICAgICAgaWYgY3JpdGVyaW9uX2xpdGVyYWwgPT0gIkRlZmF1bHQiOgorICAgICAgICAgICAgICAgICAgICBjcml0ZXJpb25fbnVtZXJpY2FsX3ZhbHVlID0gc3RyKGludCgiMHg0MDAwMDAwMCIsIDApKQorICAgICAgICAgICAgICAgIGlmIGNyaXRlcmlvbl9saXRlcmFsIGluIGlnbm9yZWRfb3V0cHV0X2RldmljZV92YWx1ZXM6CisgICAgICAgICAgICAgICAgICAgIGxvZ2dpbmcuaW5mbygiT3V0cHV0RGV2aWNlc01hc2tUeXBlIHNraXBwaW5nIHt9Ii5mb3JtYXQoY3JpdGVyaW9uX2xpdGVyYWwpKQorICAgICAgICAgICAgICAgICAgICBjb250aW51ZQorICAgICAgICAgICAgdHJ5OgorICAgICAgICAgICAgICAgIHN0cmluZ19pbnQgPSBpbnQoY3JpdGVyaW9uX251bWVyaWNhbF92YWx1ZSwgMCkKKyAgICAgICAgICAgIGV4Y2VwdCBWYWx1ZUVycm9yOgorICAgICAgICAgICAgICAgICMgSGFuZGxlIHRoZSBleGNlcHRpb24KKyAgICAgICAgICAgICAgICBsb2dnaW5nLmluZm8oIlRoZSB2YWx1ZSB7fTp7fSBpcyBmb3IgY3JpdGVyaW9uIHt9IGlzIG5vdCBhIG51bWJlciwgaWdub3JpbmciCisgICAgICAgICAgICAgICAgICAgIC5mb3JtYXQoY3JpdGVyaW9uX251bWVyaWNhbF92YWx1ZSwgY3JpdGVyaW9uX2xpdGVyYWwsIGNyaXRlcmlvbl9uYW1lKSkKKyAgICAgICAgICAgICAgICBjb250aW51ZQogCiAgICAgICAgICAgICAjIFJlbW92ZSBkdXBsaWNhdGVkIG51bWVyaWNhbCB2YWx1ZXMKLSAgICAgICAgICAgIGlmIGludChudW1lcmljYWxfdmFsdWUsIDApIGluIGFsbF9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Ryb2lkYXVkaW9jb21tb25iYXNlaGVhZGVyRmlsZSk6CisgICAgICAgIG1hdGNoID0gY3JpdGVyaWFfcGF0dGVybi5tYXRjaChsaW5lKQorICAgICAgICBpZiBtYXRjaDoKKyAgICAgICAgICAgIGxvZ2dpbmcuZGVidWcoIlRoZSBmb2xsb3dpbmcgbGluZSBpcyBWQUxJRDoge306e31cbnt9Ii5mb3JtYXQoCisgICAgICAgICAgICAgICAgYW5kcm9pZGF1ZGlvY29tbW9uYmFzZWhlYWRlckZpbGUubmFtZSwgbGluZV9udW1iZXIsIGxpbmUpKQorCisgICAgICAgICAgICBjcml0ZXJpb25fbmFtZSA9IGNyaXRlcmlvbl9tYXBwaW5nX3RhYmxlW21hdGNoLmdyb3VwZGljdCgpWyd0eXBlJ11dCisgICAgICAgICAgICBjcml0ZXJpb25fbGl0ZXJhbCA9IFwKKyAgICAgICAgICAgICAgICAnJy5qb2luKCh3LmNhcGl0YWxpemUoKSBmb3IgdyBpbiBtYXRjaC5ncm91cGRpY3QoKVsnbGl0ZXJhbCddLnNwbGl0KCdfJykpKQorICAgICAgICAgICAgY3JpdGVyaW9uX251bWVyaWNhbF92YWx1ZSA9IG1hdGNoLmdyb3VwZGljdCgpWyd2YWx1ZXMnXQorCisgICAgICAgICAgICB0cnk6CisgICAgICAgICAgICAgICAgc3RyaW5nX2ludCA9IGludChjcml0ZXJpb25fbnVtZXJpY2FsX3ZhbHVlLCAwKQorICAgICAgICAgICAgZXhjZXB0IFZhbHVlRXJyb3I6CisgICAgICAgICAgICAgICAgIyBIYW5kbGUgdGhlIGV4Y2VwdGlvbgorICAgICAgICAgICAgICAgIGxvZ2dpbmcuaW5mbygiVGhlIHZhbHVlIHt9Ont9IGlzIGZvciBjcml0ZXJpb24ge30gaXMgbm90IGEgbnVtYmVyLCBpZ25vcmluZyIKKyAgICAgICAgICAgICAgICAgICAgLmZvcm1hdChjcml0ZXJpb25fbnVtZXJpY2FsX3ZhbHVlLCBjcml0ZXJpb25fbG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cpOwogfQogCi1EZXZpY2VWZWN0b3IgRW5naW5lOjpnZXREZXZpY2VzRm9yU3RyYXRlZ3lJbnQobGVnYWN5X3N0cmF0ZWd5IHN0cmF0ZWd5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERldmljZVZlY3RvciBhdmFpbGFibGVPdXRwdXREZXZpY2VzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERldmljZVZlY3RvciBhdmFpbGFibGVJbnB1dERldmljZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3dBdWRpb091dHB1dENvbGxlY3Rpb24gJm91dHB1dHMpIGNvbnN0Cit2b2lkIEVuZ2luZTo6ZmlsdGVyT3V0cHV0RGV2aWNlc0ZvclN0cmF0ZWd5KGxlZ2FjeV9zdHJhdGVneSBzdHJhdGVneSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlVmVjdG9yJiBhdmFpbGFibGVPdXRwdXREZXZpY2VzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTd0F1ZGlvT3V0cHV0Q29sbGVjdGlvbiAmb3V0cHV0cykgY29uc3QKIHsKLSAgICBEZXZpY2VWZWN0b3IgZGV2aWNlczsKKyAgICBEZXZpY2VWZWN0b3IgYXZhaWxhYmxlSW5wdXREZXZpY2VzID0gZ2V0QXBtT2JzZXJ2ZXIoKS0+Z2V0QXZhaWxhYmxlSW5wdXREZXZpY2VzKCk7CiAKICAgICBzd2l0Y2ggKHN0cmF0ZWd5KSB7Ci0KLSAgICBjYXNlIFNUUkFURUdZX1RSQU5TTUlUVEVEX1RIUk9VR0hfU1BFQUtFUjoKLSAgICAgICAgZGV2aWNlcyA9IGF2YWlsYWJsZU91dHB1dERldmljZXMuZ2V0RGV2aWNlc0Zyb21UeXBlKEFVRElPX0RFVklDRV9PVVRfU1BFQUtFUik7Ci0gICAgICAgIGJyZWFrOwotCi0gICAgY2FzZSBTVFJBVEVHWV9TT05JRklDQVRJT05fUkVTUEVDVEZVTDoKLSAgICAgICAgaWYgKGlzSW5DYWxsKCkgfHwgb3V0cHV0cy5pc0FjdGl2ZUxvY2FsbHkodG9Wb2x1bWVTb3VyY2UoQVVESU9fU1RSRUFNX1ZPSUNFX0NBTEwpKSkgewotICAgICAgICAgICAgZGV2aWNlcyA9IGdldERldmljZXNGb3JTdHJhdGVneUludCgKLSAgICAgICAgICAgICAgICAgICAgU1RSQVRFR1lfU09OSUZJQ0FUSU9OLCBhdmFpbGFibGVPdXRwdXREZXZpY2VzLCBhdmFpbGFibGVJbnB1dERldmljZXMsIG91dHB1dHMpOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgYm9vbCBtZWRpYV9hY3RpdmVfbG9jYWxseSA9Ci0gICAgICAgICAgICAgICAgICAgIG91dHB1dHMuaXNBY3RpdmVMb2NhbGx5KHRvVm9sdW1lU291cmNlKEFVRElPX1NUUkVBTV9NVVNJQyksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNPTklGSUNBVElPTl9SRVNQRUNURlVMX0FGVEVSX01VU0lDX0RFTEFZKQotICAgICAgICAgICAgICAgICAgICB8fCBvdXRwdXRzLmlzQWN0aXZlTG9jYWxseSgKLSAgICAgICAgICAgICAgICAgICAgICAgIHRvVm9sdW1lU291cmNlKEFVRElPX1NUUkVBTV9BQ0NFU1NJQklMSVRZKSwKLSAgICAgICAgICAgICAgICAgICAgICAgIFNPTklGSUNBVElPTl9SRVNQRUNURlVMX0FGVEVSX01VU0lDX0RFTEFZKTsKKyAgICBjYXNlIFNUUkFURUdZX1NPTklGSUNBVElPTl9SRVNQRUNURlVMOiB7CisgICAgICAgIGlmICghKGlzSW5DYWxsKCkgfHwgb3V0cHV0cy5pc0FjdGl2ZUxvY2FsbHkodG9Wb2x1bWVTb3VyY2UoQVVESU9fU1RSRUFNX1ZPSUNFX0NBTEwpKSkpIHsKICAgICAgICAgICAgIC8vIHJvdXRpbmcgaXMgc2FtZSBhcyBtZWRpYSB3aXRob3V0IHRoZSAicmVtb3RlIiBkZXZpY2UKICAgICAgICAgICAgIGF2YWlsYWJsZU91dHB1dERldmljZXMucmVtb3ZlKGF2YWlsYWJsZU91dHB1dERldmljZXMuZ2V0RGV2aWNlc0Zyb21UeXBlKAogICAgICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfT1VUX1JFTU9URV9TVUJNSVgpKTsKLSAgICAgICAgICAgIGRldmljZXMgPSBnZXREZXZpY2VzRm9yU3RyYXRlZ3lJbnQoU1RSQVRFR1lfTUVESUEsCi0gICAgICAgICAgICAgICAgICAgIGF2YWlsYWJsZU91dHB1dERldmljZXMsCi0gICAgICAgICAgICAgICAgICAgIGF2YWlsYWJsZUlucHV0RGV2aWNlcywgb3V0cHV0cyk7Ci0gICAgICAgICAgICAvLyBpZiBubyBtZWRpYSBpcyBwbGF5aW5nIG9uIHRoZSBkZXZpY2UsIGNoZWNrIGZvciBtYW5kYXRvcnkgdXNlIG9mICJzYWZlIiBzcGVha2VyCi0gICAgICAgICAgICAvLyB3aGVuIG1lZGlhIHdvdWxkIGhhdmUgcGxheWVkIG9uIHNwZWFrZXIsIGFuZCB0aGUgc2FmZSBzcGVha2VyIHBhdGggaXMgYXZhaWxhYmxlCi0gICAgICAgICAgICBpZiAoIW1lZGlhX2FjdGl2ZV9sb2NhbGx5KSB7Ci0gICAgICAgICAgICAgICAgZGV2aWNlcy5yZXBsYWNlRGV2aWNlc0J5VHlwZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9PVVRfU1BFQUtFUiwKLSAgICAgICAgICAgICAgICAgICAgICAgIGF2YWlsYWJsZU91dHB1dERldmljZXMuZ2V0RGV2aWNlc0Zyb21UeXBlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfT1VUX1NQRUFLRVJfU0FGRSkpOwotICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIGJyZWFrOwotCisgICAgICAgIH0gYnJlYWs7CiAgICAgY2FzZSBTVFJBVEVHWV9EVE1GOgotICAgICAgICBpZiAoIWlzSW5DYWxsKCkpIHsKLSAgICAgICAgICAgIC8vIHdoZW4gb2ZmIGNhbGwsIERUTUYgc3RyYXRlZ3kgZm9sbG93cyB0aGUgc2FtZSBydWxlcyBhcyBNRURJQSBzdHJhdGVneQotICAgICAgICAgICAgZGV2aWNlcyA9IGdldERldmljZXNGb3JTdHJhdGVneUludCgKLSAgICAgICAgICAgICAgICAgICAgU1RSQVRFR1lfTUVESUEsIGF2YWlsYWJsZU91dHB1dERldmljZXMsIGF2YWlsYWJsZUlucHV0RGV2aWNlcywgb3V0cHV0cyk7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotICAgICAgICAvLyB3aGVuIGluIGNhbGwsIERUTUYgYW5kIFBIT05FIHN0cmF0ZWdpZXMgZm9sbG93IHRoZSBzYW1lIHJ1bGVzCi0gICAgICAgIEZBTExUSFJPVUdIX0lOVEVOREVEOwotCi0gICAgY2FzZSBTVFJBVEVHWV9QSE9ORToKKyAgICBjYXNlIFNUUkFURUdZX1BIT05FOiB7CiAgICAgICAgIC8vIEZvcmNlIHVzZSBvZiBvbmx5IGRldmljZXMgb24gcHJpbWFyeSBvdXRwdXQgaWY6CiAgICAgICAgIC8vIC0gaW4gY2FsbCBBTkQKICAgICAgICAgLy8gICAtIGNhbm5vdCByb3V0ZSBmcm9tIHZvaWNlIGNhbGwgUlggT1IKQEAgLTIxNiw4NyArMTgwLDEwMiBAQAogICAgICAgICAgICAgICAgICAgICBhdmFpbGFibGVPdXRwdXREZXZpY2VzLmdldERldmljZXNGcm9tVHlwZShBVURJT19ERVZJQ0VfT1VUX0hFQVJJTkdfQUlEKSk7CiAKICAgICAgICAgICAgIGlmICgoYXZhaWxhYmxlSW5wdXREZXZpY2VzLmdldERldmljZShBVURJT19ERVZJQ0VfSU5fVEVMRVBIT05ZX1JYLAotICAgICAgICAgICAgICAgICAgICBTdHJpbmc4KCIiKSwgQVVESU9fRk9STUFUX0RFRkFVTFQpID09IG51bGxwdHIpIHx8Ci0gICAgICAgICAgICAgICAgICAgICgoYXZhaWxQcmltYXJ5SW5wdXREZXZpY2VzLmdldERldmljZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eERldmljZSwgU3RyaW5nOCgiIiksIEFVRElPX0ZPUk1BVF9ERUZBVUxUKSAhPSBudWxscHRyKSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChwcmltYXJ5T3V0cHV0LT5nZXRQb2xpY3lBdWRpb1BvcnQoKS0+Z2V0TW9kdWxlVmVyc2lvbk1ham9yKCkgPCAzKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmc4KCIiKSwgQVVESU9fRk9STUFUX0RFRkFVTFQpID09IG51bGxwdHIpIHx8CisgICAgICAgICAgICAgICAgKChhdmFpbFByaW1hcnlJbnB1dERldmljZXMuZ2V0RGV2aWNlKAorICAgICAgICAgICAgICAgICAgICAgICAgdHhEZXZpY2UsIFN0cmluZzgoIiIpLCBBVURJT19GT1JNQVRfREVGQVVMVCkgIT0gbnVsbHB0cikgJiYKKyAgICAgICAgICAgICAgICAgKHByaW1hcnlPdXRwdXQtPmdldFBvbGljeUF1ZGlvUG9ydCgpLT5nZXRNb2R1bGVWZXJzaW9uTWFqb3IoKSA8IDMpKSkgewogICAgICAgICAgICAgICAgIGF2YWlsYWJsZU91dHB1dERldmljZXMgPSBhdmFpbFByaW1hcnlPdXRwdXREZXZpY2VzOwogICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIC8vIGZvciBwaG9uZSBzdHJhdGVneSwgd2UgZmlyc3QgY29uc2lkZXIgdGhlIGZvcmNlZCB1c2UgYW5kIHRoZW4gdGh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dXRwdXREZXZpY2VzLmdldERldmljZXNGcm9tVHlwZShBVURJT19ERVZJQ0VfT1VUX0hFQVJJTkdfQUlEKTsKLSAgICAgICAgICAgIGlmICghZGV2aWNlcy5pc0VtcHR5KCkpIGJyZWFrOwotICAgICAgICAgICAgLy8gd2hlbiBub3QgaW4gYSBwaG9uZSBjYWxsLCBwaG9uZSBzdHJhdGVneSBzaG91bGQgcm91dGUgU1RSRUFNX1ZPSUNFX0NBTEwgdG8gQTJEUAotICAgICAgICAgICAgaWYgKCFpc0luQ2FsbCgpICYmCi0gICAgICAgICAgICAgICAgICAgIChnZXRGb3JjZVVzZShBVURJT19QT0xJQ1lfRk9SQ0VfRk9SX01FRElBKSAhPSBBVURJT19QT0xJQ1lfRk9SQ0VfTk9fQlRfQTJEUCkgJiYKLSAgICAgICAgICAgICAgICAgICAgIG91dHB1dHMuaXNBMmRwU3VwcG9ydGVkKCkpIHsKLSAgICAgICAgICAgICAgICBkZXZpY2VzID0gYXZhaWxhYmxlT3V0cHV0RGV2aWNlcy5nZXRGaXJzdERldmljZXNGcm9tVHlwZXMoewotICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX09VVF9CTFVFVE9PVEhfQTJEUCwKLSAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9PVVRfQkxVRVRPT1RIX0EyRFBfSEVBRFBIT05FU30pOwotICAgICAgICAgICAgICAgIGlmICghZGV2aWNlcy5pc0VtcHR5KCkpIGJyZWFrOworICAgICAgICB9CisgICAgICAgIC8vIERvIG5vdCB1c2UgQTJEUCBkZXZpY2VzIHdoZW4gaW4gY2FsbCBidXQgdXNlIHRoZW0gd2hlbiBub3QgaW4gY2FsbAorICAgICAgICAvLyAoZS5nIGZvciB2b2ljZSBtYWlsIHBsYXliYWNrKQorICAgICAgICBpZiAoaXNJbkNhbGwoKSkgeworICAgICAgICAgICAgYXZhaWxhYmxlT3V0cHV0RGV2aWNlcy5yZW1vdmUoYXZhaWxhYmx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VJDLCBBVURJT19ERVZJQ0VfT1VUX0hETUlfRUFSQ30pKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGRldmljZXMgPSBhdmFpbGFibGVPdXRwdXREZXZpY2VzLmdldEZpcnN0RGV2aWNlc0Zyb21UeXBlcyh7Ci0gICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9PVVRfV0lSRURfSEVBRFBIT05FLCBBVURJT19ERVZJQ0VfT1VUX1dJUkVEX0hFQURTRVQsCi0gICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9PVVRfTElORSwgQVVESU9fREVWSUNFX09VVF9VU0JfSEVBRFNFVCwKLSAgICAgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX09VVF9VU0JfREVWSUNFfSk7Ci0gICAgICAgICAgICBpZiAoIWRldmljZXMuaXNFbXB0eSgpKSBicmVhazsKLSAgICAgICAgICAgIGlmICghaXNJbkNhbGwoKSkgewotICAgICAgICAgICAgICAgIGRldmljZXMgPSBhdmFpbGFibGVPdXRwdXREZXZpY2VzLmdldEZpcnN0RGV2aWNlc0Zyb21UeXBlcyh7Ci0gICAgICAgICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfT1VUX1VTQl9BQ0NFU1NPUlksIEFVRElPX0RFVklDRV9PVVRfREdUTF9ET0NLX0hFQURTRVQsCi0gICAgICAgICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfT1VUX0FVWF9ESUdJVEFMLCBBVURJT19ERVZJQ0VfT1VUX0FOTEdfRE9DS19IRUFEU0VUfSk7Ci0gICAgICAgICAgICAgICAgaWYgKCFkZXZpY2VzLmlzRW1wdHkoKSkgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBkZXZpY2VzID0gYXZhaWxhYmxlT3V0cHV0RGV2aWNlcy5nZXREZXZpY2VzRnJvbVR5cGUoQVVESU9fREVWSUNFX09VVF9FQVJQSUVDRSk7CisgICAgICAgIH0KKyAgICAgICAgfSBic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EwgdG8KLSAgICAgICAgICAgIC8vIEEyRFAgc3BlYWtlciB3aGVuIGZvcmNpbmcgdG8gc3BlYWtlciBvdXRwdXQKLSAgICAgICAgICAgIGlmICghaXNJbkNhbGwoKSAmJgotICAgICAgICAgICAgICAgICAgICAoZ2V0Rm9yY2VVc2UoQVVESU9fUE9MSUNZX0ZPUkNFX0ZPUl9NRURJQSkgIT0gQVVESU9fUE9MSUNZX0ZPUkNFX05PX0JUX0EyRFApICYmCi0gICAgICAgICAgICAgICAgICAgICBvdXRwdXRzLmlzQTJkcFN1cHBvcnRlZCgpKSB7Ci0gICAgICAgICAgICAgICAgZGV2aWNlcyA9IGF2YWlsYWJsZU91dHB1dERldmljZXMuZ2V0RGV2aWNlc0Zyb21UeXBlKAotICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX09VVF9CTFVFVE9PVEhfQTJEUF9TUEVBS0VSKTsKLSAgICAgICAgICAgICAgICBpZiAoIWRldmljZXMuaXNFbXB0eSgpKSBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghaXNJbkNhbGwoKSkgewotICAgICAgICAgICAgICAgIGRldmljZXMgPSBhdmFpbGFibGVPdXRwdXREZXZpY2VzLmdldEZpcnN0RGV2aWNlc0Zyb21UeXBlcyh7Ci0gICAgICAgICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfT1VUX1VTQl9BQ0NFU1NPUlksIEFVRElPX0RFVklDRV9PVVRfVVNCX0RFVklDRSwKLSAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9PVVRfREdUTF9ET0NLX0hFQURTRVQsIEFVRElPX0RFVklDRV9PVVRfQVVYX0RJR0lUQUwsCi0gICAgICAgICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfT1VUX0FOTEdfRE9DS19IRUFEU0VUfSk7Ci0gICAgICAgICAgICAgICAgaWYgKCFkZXZpY2VzLmlzRW1wdHkoKSkgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBkZXZpY2VzID0gYXZhaWxhYmxlT3V0cHV0RGV2aWNlcy5nZXREZXZpY2VzRnJvbVR5cGUoQVVESU9fREVWSUNFX09VVF9TUEVBS0VSKTsKLSAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgcmV0dXJuIHN0cmF0ZWd5OwogICAgICAgICB9Ci0gICAgYnJlYWs7CisgICAgfSBlbHNlIHsKKyAgICAgICAgc3dpdGNoIChsZWdhY3lTdHJhdGVneSkgeworICAgICAgICBjYXNlIFNUUkFURUdZX1NPTklGSUNBVElPTl9SRVNQRUNURlVMOgorICAgICAgICBjYXNlIFNUUkFURUdZX1NPTklGSUNBVElPTjoKKyAgICAgICAgICAgIGlmIChvdXRwdXRzLmlzQWN0aXZlTG9jYWxseSh0b1ZvbHVtZVNvdXJjZShBVURJT19TVFJFQU1fVk9JQ0VfQ0FMTCkpKSB7CisgICAgICAgICAgICAgICAgbGVnYWN5U3RyYXRlZ3kgPSBTVFJBVEVHWV9QSE9ORTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGNhc2UgU1RSQVRFR1lfQUNDRVNTSUJJTElUWToKKyAgICAgICAgICAgIGlmIChvdXRwdXRzLmlzQWN0aXZlKHRvVm9sdW1lU291cmNlKEFVRElPX1NUUkVBTV9SSU5HKSkgfHwKKyAgICAgICAgICAgICAgICAgICAgb3V0cHV0cy5pc0FjdGl2ZSh0b1ZvbHVtZVNvdXJjZShBVURJT19TVFJFQU1fQUxBUk0pKSkgeworICAgICAgICAgICAgICAgIGxlZ2FjeVN0cmF0ZWd5ID0gU1RSQVRFR1lfU09OSUZJQ0FUSU9OOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHJldHVybiBzdHJhdGVneTsKKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gZ2V0UHJvZHVjdFN0cmF0ZWd5RnJvbUxlZ2FjeShsZWdhY3lTdHJhdGVneSk7Cit9CisKK0RldmljZVZlY3RvciBFbmdpbmU6OmdldERldmljZXNGb3JTdHJhdGVneUludChsZWdhY3lfc3RyYXRlZ3kgc3RyYXRlZ3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlVmVjdG9yIGF2YWlsYWJsZU91dHB1dERldmljZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3dBdWRpb091dHB1dENvbGxlY3Rpb24gJm91dHB1dHMpIGNvbnN0Cit7CisgICAgRGV2aWNlVmVjdG9yIGRldmljZXM7CisKKyAgICBzd2l0Y2ggKHN0cmF0ZWd5KSB7CisKKyAgICBjYXNlIFNUUkFURUdZX1RSQU5TTUlUVEVEX1RIUk9VR0hfU1BFQUtFUjoKKyAgICAgICAgZGV2aWNlcyA9IGF2YWlsYWJsZU91dHB1dERldmljZXMuZ2V0RGV2aWNlc0Zyb21UeXBlKEFVRElPX0RFVklDRV9PVVRfU1BFQUtFUik7CisgICAgICAgIGJyZWFrOworCisgICAgY2FzZSBTVFJBVEVHWV9QSE9ORTogeworICAgICAgICBkZXZpY2VzID0gYXZhaWxhYmxlT3V0cHV0RGV2aWNlcy5nZXREZXZpY2VzRnJvbVR5cGUoQVVESU9fREVWSUNFX09VVF9IRUFSSU5HX0FJRCk7CisgICAgICAgIGlmICghZGV2aWNlcy5pc0VtcHR5KCkpIGJyZWFrOworICAgICAgICBkZXZpY2VzID0gYXZhaWxhYmxlT3V0cHV0RGV2aWNlcy5nZXRGaXJzdERldmljZXNGcm9tVHlwZXMoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRMYXN0UmVtb3ZhYmxlTWVkaWFEZXZpY2VzKCkpOworICAgICAgICBpZiAoIWRldmljZXMuaXNFbXB0eSgpKSBicmVhaz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m90IGJlIG1peGVkIGFuZCBkcm9wcGVkLgotICAgICAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBvdXRwdXRzLnNpemUoKTsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgc3A8QXVkaW9PdXRwdXREZXNjcmlwdG9yPiBkZXNjID0gb3V0cHV0cy52YWx1ZUF0KGkpOwotICAgICAgICAgICAgICAgIGlmIChkZXNjLT5pc0FjdGl2ZSgpICYmICFhdWRpb19pc19saW5lYXJfcGNtKGRlc2MtPmdldEZvcm1hdCgpKSkgewotICAgICAgICAgICAgICAgICAgICBhdmFpbGFibGVPdXRwdXREZXZpY2VzLnJlbW92ZShkZXNjLT5kZXZpY2VzKCkuZ2V0RGV2aWNlc0Zyb21UeXBlcyh7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX09VVF9IRE1JLCBBVURJT19ERVZJQ0VfT1VUX1NQRElGLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9PVVRfSERNSV9BUkN9KSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG91dHB1dHMuaXNBY3RpdmUodG9Wb2x1bWVTb3VyY2UoQVVESU9fU1RSRUFNX1JJTkcpKSB8fAotICAgICAgICAgICAgICAgICAgICBvdXRwdXRzLmlzQWN0aXZlKHRvVm9sdW1lU291cmNlKEFVRElPX1NUUkVBTV9BTEFSTSkpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGdldERldmljZXNGb3JTdHJhdGVneUludCgKLSAgICAgICAgICAgICAgICAgICAgU1RSQVRFR1lfU09OSUZJQ0FUSU9OLCBhdmFpbGFibGVPdXRwdXREZXZpY2VzLCBhdmFpbGFibGVJbnB1dERldmljZXMsIG91dHB1dHMpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKGlzSW5DYWxsKCkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gZ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X05PX0JUX0EyRFApKSB7CiAgICAgICAgICAgICAgICAgLy8gR2V0IHRoZSBsYXN0IGNvbm5lY3RlZCBkZXZpY2Ugb2Ygd2lyZWQgYW5kIGJsdWV0b290aCBhMmRwCiAgICAgICAgICAgICAgICAgZGV2aWNlczIgPSBhdmFpbGFibGVPdXRwdXREZXZpY2VzLmdldEZpcnN0RGV2aWNlc0Zyb21UeXBlcygKICAgICAgICAgICAgICAgICAgICAgICAgIGdldExhc3RSZW1vdmFibGVNZWRpYURldmljZXMoKSk7CkBAIC00MjMsNyArMzcwLDkgQEAKICAgICAgICAgaWYgKHN0cmF0ZWd5ID09IFNUUkFURUdZX01FRElBKSB7CiAgICAgICAgICAgICAvLyBBUkMsIFNQRElGIGFuZCBBVVhfTElORSBjYW4gY28tZXhpc3Qgd2l0aCBvdGhlcnMuCiAgICAgICAgICAgICBkZXZpY2VzMyA9IGF2YWlsYWJsZU91dHB1dERldmljZXMuZ2V0RGV2aWNlc0Zyb21UeXBlcyh7Ci0gICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9PVVRfSERNSV9BUkMsIEFVRElPX0RFVklDRV9PVVRfU1BESUYsIEFVRElPX0RFVklDRV9PVVRfQVVYX0xJTkV9KTsKKyAgICAgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX09VVF9IRE1JX0FSQywgQVVESU9fREVWSUNFX09VVF9IRE1JX0VBUkMsCisgICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9PVVRfU1BESUYsIEFVRElPX0RFVklDRV9PVVRfQVVYX0xJTkUsCisgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICB9CiAKICAgICAgICAgZGV2aWNlczIuYWRkKGRldmljZXMzKTsKQEAgLTQzOCw5ICszODcsMjEgQEAKICAgICAgICAgICAgIGRldmljZXMucmVtb3ZlKGRldmljZXMuZ2V0RGV2aWNlc0Zyb21UeXBlKEFVRElPX0RFVklDRV9PVVRfU1BFQUtFUikpOwogICAgICAgICB9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URTRVQsIEFVRElPX0RFVklDRV9JTl9VU0JfSEVBRFNFVCwKLSAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfSU5fVVNCX0RFVklDRSwgQVVESU9fREVWSUNFX0lOX0JVSUxUSU5fTUlDfSk7CisgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX0lOX0JMRV9IRUFEU0VULCBBVURJT19ERVZJQ0VfSU5fV0lSRURfSEVBRFNFVCwKKyAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfSU5fVVNCX0hFQURTRVQsIEFVRElPX0RFVklDRV9JTl9VU0JfREVWSUNFLAorICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9JTl9CTFVFVE9PVEhfQkxFLCBBVURJT19ERVZJQ0VfSU5fQlVJTFRJTl9NSUN9KTsKICAgICAgICAgYnJlYWs7CiAKICAgICBjYXNlIEFVRElPX1NPVVJDRV9WT0lDRV9DT01NVU5JQ0FUSU9OOgpAQCAtNTI4LDQ2ICs0OTcsNjQgQEAKICAgICAgICAgICAgIGF2YWlsYWJsZURldmljZXMgPSBhdmFpbGFibGVQcmltYXJ5RGV2aWNlczsKICAgICAgICAgfQogCi0gICAgICAgIHN3aXRjaCAoZ2V0Rm9yY2VVc2UoQVVESU9fUE9MSUNZX0ZPUkNFX0ZPUl9DT01NVU5JQ0FUSU9OKSkgewotICAgICAgICBjYXNlIEFVRElPX1BPTElDWV9GT1JDRV9CVF9TQ086CisgICAgICAgIGlmIChhdWRpb19pc19ibHVldG9vdGhfb3V0X3Njb19kZXZpY2UoY29tbURldmljZVR5cGUpKSB7CiAgICAgICAgICAgICAvLyBpZiBTQ08gZGV2aWNlIGlzIHJlcXVlc3RlZCBidXQgbm8gU0NPIGRldmljZSBpcyBhdmFpbGFibGUsIGZhbGwgYmFjayB0byBkZWZhdWx0IGNhc2UKICAgICAgICAgICAgIGRldmljZSA9IGF2YWlsYWJsZURldmljZXMuZ2V0RGV2aWNlKAogICAgICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfSU5fQkxVRVRPT1RIX1NDT19IRUFEU0VULCBTdHJpbmc4KCIiKSwgQVVESU9fRk9STUFUX0RFRkFVTFQpOwogICAgICAgICAgICAgaWYgKGRldmljZSAhPSBudWxscHRyKSB7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBGQUxMVEhST1VHSF9JTlRFTkRFRDsKLQorICAgICAgICB9CisgICAgICAgIHN3aXRjaCAoY29tbURldmljZVR5cGUpIHsKKyAgICAgICAgY2FzZSBBVURJT19ERVZJQ0VfT1VUX0JMRV9IRUFEU0VUOgorICAgICAgICAgICAgZGV2aWNlID0gYXZhaWxhYmxlRGV2aWNlcy5nZXREZXZpY2UoCisgICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9JTl9CTEVfSEVBRFNFVCwgU3RyaW5nOCgiIiksIEFVRElPX0ZPUk1BVF9ERUZBVUxUKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFVRElPX0RFVklDRV9PVVRfU1BFQUtFUjoKKyAgICAgICAgICAgIGRldmljZSA9IGF2YWlsYWJsZURldmljZXMuZ2V0Rmlyc3RFeGlzdGluZ0RldmljZSh7CisgICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9JTl9CQUNLX01JQywgQVVESU9fREVWSUNFX0lOX0JVSUxUSU5fTUlDLAorICAgICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfSU5fVVNCX0RFVklDRSwgQVVESU9fREVWSUNFX0lOX1VTQl9IRUFEU0VUfSk7CisgICAgICAgICAgICBicmVhazsKICAgICAgICAgZGVmYXVsdDogICAgLy8gRk9SQ0VfTk9ORQogICAgICAgICAgICAgZGV2aWNlID0gYXZhaWxhYmxlRGV2aWNlcy5nZXRGaXJzdEV4aXN0aW5nRGV2aWNlKHsKICAgICAgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX0lOX1dJUkVEX0hFQURTRVQsIEFVRElPX0RFVklDRV9JTl9VU0JfSEVBRFNFVCwKLSAgICAgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX0lOX1VTQl9ERVZJQ0UsIEFVRElPX0RFVklDRV9JTl9CVUlMVElOX01JQ30pOworICAgICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfSU5fVVNCX0RFVklDRSwgQVVESU9fREVWSUNFX0lOX0JMVUVUT09USF9CTEUsCisgICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9JTl9CVUlMVElOX01JQ30pOwogICAgICAgICAgICAgYnJlYWs7CiAKLSAgICAgICAgY2FzZSBBVURJT19QT0xJQ1lfRk9SQ0VfU1BFQUtFUjoKLSAgICAgICAgICAgIGRldmljZSA9IGF2YWlsYWJsZURldmljZXMuZ2V0Rmlyc3RFeGlzdGluZ0RldmljZSh7Ci0gICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9JTl9CQUNLX01JQywgQVVESU9fREVWSUNFX0lOX0JVSUxUSU5fTUlDfSk7Ci0gICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogICAgICAgICBicmVhazsKIAogICAgIGNhc2UgQVVESU9fU09VUkNFX1ZPSUNFX1JFQ09HTklUSU9OOgogICAgIGNhc2UgQVVESU9fU09VUkNFX1VOUFJPQ0VTU0VEOgotICAgIGNhc2UgQVVESU9fU09VUkNFX0hPVFdPUkQ6Ci0gICAgICAgIGlmIChpbnB1dFNvdXJjZSA9PSBBVURJT19TT1VSQ0VfSE9UV09SRCkgewotICAgICAgICAgICAgLy8gV2Ugc2hvdWxkIG5vdCB1c2UgcHJpbWFyeSBvdXRwdXQgY3JpdGVyaWEgZm9yIEhvdHdvcmQgYnV0IHJhdGhlciBsaW1pdAotICAgICAgICAgICAgLy8gdG8gZGV2aWNlcyBhdHRhY2hlZCB0byB0aGUgc2FtZSBIVyBtb2R1bGUgYXMgdGhlIGJ1aWxkIGluIG1pYwotICAgICAgICAgICAgTE9HX0FMV0FZU19GQVRBTF9JRihhdmFpbGFibGVQcmltYXJ5RGV2aWNlcy5pc0VtcHR5KCksICJQcmltYXJ5IGRldmljZXMgbm90IGZvdW5kIik7Ci0gICAgICAgICAgICBhdmFpbGFibGVEZXZpY2VzID0gYXZhaWxhYmxlUHJpbWFyeURldmljZXM7CisgICAgICAgIGlmIChhdWRpb19pc19ibHVldG9vdGhfb3V0X3Njb19kZXZpY2UoY29tbURldmljZVR5cGUpKSB7CisgICAgICAgICAgICBkZXZpY2UgPSBhdmFpbGFibGVEZXZpY2VzLmdldERldmljZSgKKyAgICAgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX0lOX0JMVUVUT09USF9TQ09fSEVBRFNFVCwgU3RyaW5nOCgiIiksIEFVRElPX0ZPUk1BVF9ERUZBVUxUKTsKKyAgICAgICAgICAgIGlmIChkZXZpY2UgIT0gbnVsbHB0cikgYnJlYWs7CiAgICAgICAgIH0KLSAgICAgICAgaWYgKGdldEZvcmNlVXNlKEFVRElPX1BPTElDWV9GT1JDRV9GT1JfUkVDT1JEKSA9PSBBVURJT19QT0xJQ1lfRk9SQ0VfQlRfU0NPKSB7CisgICAgICAgIC8vIHdlIG5lZWQgdG8gbWFrZSBCTFVFVE9PVEhfQkxFIGhhcyBoaWdoZXIgcHJpb3JpdHkgdGhhbiBCVUlMVElOX01JQywKKyAgICAgICAgLy8gYmVjYXVzZSBzb21ldGltZXMgdXNlciB3YW50IHRvIGRvIHZvaWNlIHNlYXJjaCBieSBidCByZW1vdGUKKyAgICAgICAgLy8gZXZlbiBpZiBCVUlMRElOX01JQyBpcyBhdmFpbGFibGUuCisgICAgICAgIGRldmljZSA9IGF2YWlsYWJsZURldmljZXMuZ2V0Rmlyc3RFeGlzdGluZ0RldmljZSh7CisgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX0lOX0JMRV9IRUFEU0VULCBBVURJT19ERVZJQ0VfSU5fV0lSRURfSEVBRFNFVCwKKyAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfSU5fVVNCX0hFQURTRVQsIEFVRElPX0RFVklDRV9JTl9VU0JfREVWSUNFLAorICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9JTl9CTFVFVE9PVEhfQkxFLCBBVURJT19ERVZJQ0VfSU5fQlVJTFRJTl9NSUN9KTsKKworICAgICAgICBicmVhazsKKyAgICBjYXNlIEFVRElPX1NPVVJDRV9IT1RXT1JEOgorICAgICAgICAvLyBXZSBzaG91bGQgbm90IHVzZSBwcmltYXJ5IG91dHB1dCBjcml0ZXJpYSBmb3IgSG90d29yZCBidXQgcmF0aGVyIGxpbWl0CisgICAgICAgIC8vIHRvIGRldmljZXMgYXR0YWNoZWQgdG8gdGhlIHNhbWUgSFcgbW9kdWxlIGFzIHRoZSBidWlsZCBpbiBtaWMKKyAgICAgICAgTE9HX0FMV0FZU19GQVRBTF9JRihhdmFpbGFibGVQcmltYXJ5RGV2aWNlcy5pc0VtcHR5KCksICJQcmltYXJ5IGRldmljZXMgbm90IGZvdW5kIik7CisgICAgICAgIGF2YWlsYWJsZURldmljZXMgPSBhdmFpbGFibGVQcmltYXJ5RGV2aWNlczsKKyAgICAgICAgaWYgKGF1ZGlvX2lzX2JsdWV0b290aF9vdXRfc2NvX2RldmljZShjb21tRGV2aWNlVHlwZSkpIHsKICAgICAgICAgICAgIGRldmljZSA9IGF2YWlsYWJsZURldmljZXMuZ2V0RGV2aWNlKAogICAgICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfSU5fQkxVRVRPT1RIX1NDT19IRUFEU0VULCBTdHJpbmc4KCIiKSwgQVVESU9fRk9STUFUX0RFRkFVTFQpOwogICAgICAgICAgICAgaWYgKGRldmljZSAhPSBudWxscHRyKSBicmVhazsKICAgICAgICAgfQogICAgICAgICBkZXZpY2UgPSBhdmFpbGFibGVEZXZpY2VzLmdldEZpcnN0RXhpc3RpbmdEZXZpY2UoewotICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9JTl9XSVJFRF9IRUFEU0VULCBBVURJT19ERVZJQ0VfSU5fVVNCX0hFQURTRVQsCi0gICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX0lOX1VTQl9ERVZJQ0UsIEFVRElPX0RFVklDRV9JTl9CVUlMVElOX01JQ30pOworICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9JTl9CTEVfSEVBRFNFVCwgQVVESU9fREVWSUNFX0lOX1dJUkVEX0hFQURTRVQsCisgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX0lOX1VTQl9IRUFEU0VULCBBVURJT19ERVZJQ0VfSU5fVVNCX0RFVklDRSwKKyAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfSU5fQlVJTFRJTl9NSUN9KTsKICAgICAgICAgYnJlYWs7CiAgICAgY2FzZSBBVURJT19TT1VSQ0VfQ0FNQ09SREVSOgogICAgICAgICAvLyBGb3IgYSBkZXZpY2Ugd2l0aG91dCBidWlsdC1pbiBtaWMsIGFkZGluZyB1c2IgZGV2aWNlCkBAIC01ODQsNyArNTcxLDggQEAKICAgICBjYXNlIEFVRElPX1NPVVJDRV9WT0lDRV9QRVJGT1JNQU5DRToKICAgICAgICAgZGV2aWNlID0gYXZhaWxhYmxlRGV2aWNlcy5nZXRGaXJzdEV4aXN0aW5nRGV2aWNlKHsKICAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfSU5fV0lSRURfSEVBRFNFVCwgQVVESU9fREVWSUNFX0lOX1VTQl9IRUFEU0VULAotICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9JTl9VU0JfREVWSUNFLCBBVURJT19ERVZJQ0VfSU5fQlVJTFRJTl9NSUN9KTsKKyAgICAgICAgICAgICAgICBBVURJT19ERVZJQ0VfSU5fVVNCX0RFVklDRSwgQVVESU9fREVWSUNFX0lOX0JMVUVUT09USF9CTEUsCisgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX0lOX0JVSUxUSU5fTUlDfSk7CiAgICAgICAgIGJyZWFrOwogICAgIGNhc2UgQVVESU9fU09VUkN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AgRGV2aWNlVmVjdG9yIHByZWZlcnJlZEF2YWlsYWJsZURldlZlYyA9CisgICAgICAgICAgICBnZXRQcmVmZXJyZWRBdmFpbGFibGVEZXZpY2VzRm9yUHJvZHVjdFN0cmF0ZWd5KGF2YWlsYWJsZU91dHB1dERldmljZXMsIHN0cmF0ZWd5KTsKKyAgICBpZiAoIXByZWZlcnJlZEF2YWlsYWJsZURldlZlYy5pc0VtcHR5KCkpIHsKKyAgICAgICAgcmV0dXJuIHByZWZlcnJlZEF2YWlsYWJsZURldlZlYzsKKyAgICB9CisKICAgICByZXR1cm4gZ2V0RGV2aWNlc0ZvclN0cmF0ZWd5SW50KGxlZ2FjeVN0cmF0ZWd5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXZhaWxhYmxlT3V0cHV0RGV2aWNlcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF2YWlsYWJsZUlucHV0RGV2aWNlcywgb3V0cHV0cyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRzKTsKIH0KIAogRGV2aWNlVmVjdG9yIEVuZ2luZTo6Z2V0T3V0cHV0RGV2aWNlc0ZvckF0dHJpYnV0ZXMoY29uc3QgYXVkaW9fYXR0cmlidXRlc190ICZhdHRyaWJ1dGVzLApAQCAtNjg5LDYgKzcxNSw3IEBACiB9CiAKIHNwPERldmljZURlc2NyaXB0b3I+IEVuZ2luZTo6Z2V0SW5wdXREZXZpY2VGb3JBdHRyaWJ1dGVzKGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAmYXR0ciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwPEF1ZGlvUG9saWN5TWl4PiAqbWl4KSBjb25zdAogewogICAgIGNvbnN0IGF1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3V0cHV0RGV2aWNlc0ZvclN0cmVhbShhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGZyb21DYWNoZSA9IGZhbHNlKSBjb25zdCBvdmVycmlkZTsKIAotICAgIHNwPERldmljZURlc2NyaXB0b3I+IGdldElucHV0RGV2aWNlRm9yQXR0cmlidXRlcygKLSAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAmYXR0ciwgc3A8QXVkaW9Qb2xpY3lNaXg+ICptaXggPSBudWxscHRyKSBjb25zdCBvdmVycmlkZTsKKyAgICBzcDxEZXZpY2VEZXNjcmlwdG9yPiBnZXRJbnB1dERldmljZUZvckF0dHJpYnV0ZXMoY29uc3QgYXVkaW9fYXR0cmlidXRlc190ICZhdHRyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQgPSAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcDxBdWRpb1BvbGljeU1peD4gKm1peCA9IG51bGxwdHIpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IG92ZXJyaWRlOwogCiAgICAgdm9pZCB1cGRhdGVEZXZpY2VTZWxlY3Rpb25DYWNoZSgpIG92ZXJyaWRlOwogCkBAIC03NCwxNSArNzYsMjcgQEAKIAogICAgIHN0YXR1c190IHNldERlZmF1bHREZXZpY2UoYXVkaW9fZGV2aWNlc190IGRldmljZSk7CiAKKyAgICB2b2lkIGZpbHRlck91dHB1dERldmljZXNGb3JTdHJhdGVneShsZWdhY3lfc3RyYXRlZ3kgc3RyYXRlZ3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERldmljZVZlY3RvciYgYXZhaWxhYmxlT3V0cHV0RGV2aWNlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3dBdWRpb091dHB1dENvbGxlY3Rpb24gJm91dHB1dHMpIGNvbnN0OworCisgICAgcHJvZHVjdF9zdHJhdGVneV90IHJlbWFwU3RyYXRlZ3lGcm9tQ29udGV4dChwcm9kdWN0X3N0cmF0ZWd5X3Qgc3RyYXRlZ3ksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFN3QXVkaW9PdXRwdXRDb2xsZWN0aW9uICZvdXRwdXRzKSBjb25zdDsKKwogICAgIERldmljZVZlY3RvciBnZXREZXZpY2VzRm9yU3RyYXRlZ3lJbnQobGVnYWN5X3N0cmF0ZWd5IHN0cmF0ZWd5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlVmVjdG9yIGF2YWlsYWJsZU91dHB1dERldmljZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZXZpY2VWZWN0b3IgYXZhaWxhYmxlSW5wdXREZXZpY2VzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3dBdWRpb091dHB1dENvbGxlY3Rpb24gJm91dHB1dHMpIGNvbnN0OwogCiAgICAgRGV2aWNlVmVjdG9yIGdldERldmljZXNGb3JQcm9kdWN0U3RyYXRlZ3kocHJvZHVjdF9zdHJhdGVneV90IHN0cmF0ZWd5KSBjb25zdDsKIAogICAgIHNwPERldmljZURlc2NyaXB0b3I+IGdldERldmljZUZvcklucHV0U291cmNlKGF1ZGlvX3NvdXJjZV90IGlucHV0U291cmNlKSBjb25zdDsKIAorICAgIHByb2R1Y3Rfc3RyYXRlZ3lfdCBnZXRQcm9kdWN0U3RyYXRlZ3lGcm9tTGVnYWN5KGxlZ2FjeV9zdHJhdGVneSBsZWdhY3lTdHJhdGVneSkgY29uc3Q7CisgICAgYXVkaW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2Vuc2Uga2luZHM6CisgICAgLy8gICBTUERYLWxpY2Vuc2UtaWRlbnRpZmllci1BcGFjaGUtMi4wCisgICAgZGVmYXVsdF9hcHBsaWNhYmxlX2xpY2Vuc2VzOiBbImZyYW1ld29ya3NfYXZfbGljZW5zZSJdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiYXVkaW9wb2xpY3lfZnV6emVyIiwKKyAgICBzcmNzOiBbCisgICAgICAgICJhdWRpb3BvbGljeV9mdXp6ZXIuY3BwIiwKKyAgICBdLAorICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiZnJhbWV3b3Jrcy9hdi9zZXJ2aWNlcy9hdWRpb3BvbGljeSIsCisgICAgXSwKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5hdWRpby5jb21tb24tdXRpbCIsCisgICAgICAgICJjYXB0dXJlX3N0YXRlX2xpc3RlbmVyLWFpZGwtY3BwIiwKKyAgICAgICAgImxpYmF1ZGlvY2xpZW50IiwKKyAgICAgICAgImxpYmF1ZGlvZm91bmRhdGlvbiIsCisgICAgICAgICJsaWJiYXNlIiwKKyAgICAgICAgImxpYmN1dGlscyIsCisgICAgICAgICJsaWJoaWRsYmFzZSIsCisgICAgICAgICJsaWJkbCIsCisgICAgICAgICJsaWJsb2ciLAorICAgICAgICAibGlibWVkaWFfaGVscGVyIiwKKyAgICAgICAgImxpYm1lZGlhbWV0cmljcyIsCisgICAgICAgICJsaWJ1dGlscyIsCisgICAgICAgICJsaWJ4bWwyIiwKKyAgICAgICAgImxpYmJpbmRlciIsCisgICAgICAgICJsaWJhdWRpb3BvbGljeSIsCisgICAgICAgICJsaWJhdWRpb3BvbGljeW1hbmFnZXJkZWZhdWx0IiwKKyAgICAgICAgImZyYW1ld29yay1wZXJtaXNzaW9uLWFpZGwtY3BwIiwKKyAgICBdLAorICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmF1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HIoKSwgJmF1ZGlvQ29udGVudFR5cGVIYWwpKSB7CisgICAgICAgICAgICByZXN1bHQucHVzaF9iYWNrKGF1ZGlvQ29udGVudFR5cGVIYWwpOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiByZXN1bHQ7Cit9KCk7CisKK3N0ZDo6dmVjdG9yPGludD4ga01peFR5cGVzID0ge01JWF9UWVBFX1BMQVlFUlMsIE1JWF9UWVBFX1JFQ09SREVSU307CisKK3N0ZDo6dmVjdG9yPGludD4ga01peFJvdXRlRmxhZ3MgPSB7TUlYX1JPVVRFX0ZMQUdfUkVOREVSLCBNSVhfUk9VVEVfRkxBR19MT09QX0JBQ0ssCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1JWF9ST1VURV9GTEFHX0xPT1BfQkFDS19BTkRfUkVOREVSLCBNSVhfUk9VVEVfRkxBR19BTEx9OworCitzdGQ6OnZlY3RvcjxhdWRpb19mbGFnc19tYXNrX3Q+IGtBdWRpb0ZsYWdNYXNrcyA9IHsKKyAgICBBVURJT19GTEFHX05PTkUsICAgICAgICAgICBBVURJT19GTEFHX0FVRElCSUxJVFlfRU5GT1JDRUQsCisgICAgQVVESU9fRkxBR19TRUNVUkUsICAgICAgICAgQVVESU9fRkxBR19TQ08sCisgICAgQVVESU9fRkxBR19CRUFDT04sICAgICAgICAgQVVESU9fRkxBR19IV19BVl9TWU5DLAorICAgIEFVRElPX0ZMQUdfSFdfSE9UV09SRCwgICAgIEFVRElPX0ZMQUdfQllQQVNTX0lOVEVSUlVQVElPTl9QT0xJQ1ksCisgICAgQVVESU9fRkxBR19CWVBBU1NfTVVURSwgICAgQVVESU9fRkxBR19MT1dfTEFURU5DWSwKKyAgICBBVURJT19GTEFHX0RFRVBfQlVGRkVSLCAgICBBVURJT19GTEFHX05PX01FRElBX1BST0pFQ1RJT04sCisgICAgQVVESU9fRkxBR19NVVRFX0hBUFRJQywgICAgQVVESU9fRkxBR19OT19TWVNURU1fQ0FQVFVSRSwK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hZ2VyQ29uZmlnKCk7CisgICAgYm9vbCBnZXRPdXRwdXRGb3JBdHRyKGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnNlbGVjdGVkRGV2aWNlSWQsIGF1ZGlvX2Zvcm1hdF90IGZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fY2hhbm5lbF9tYXNrX3QgY2hhbm5lbE1hc2ssIGludCBzYW1wbGVSYXRlLAorICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19vdXRwdXRfZmxhZ3NfdCBmbGFncyA9IEFVRElPX09VVFBVVF9GTEFHX05PTkUsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICpvdXRwdXQgPSBudWxscHRyLAorICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90ICpwb3J0SWQgPSBudWxscHRyLCBhdWRpb19hdHRyaWJ1dGVzX3QgYXR0ciA9IHt9KTsKKyAgICBib29sIGdldElucHV0Rm9yQXR0cihjb25zdCBhdWRpb19hdHRyaWJ1dGVzX3QgJmF0dHIsIGF1ZGlvX3VuaXF1ZV9pZF90IHJpaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqc2VsZWN0ZWREZXZpY2VJZCwgYXVkaW9fZm9ybWF0X3QgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2NoYW5uZWxfbWFza190IGNoYW5uZWxNYXNrLCBpbnQgc2FtcGxlUmF0ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pbnB1dF9mbGFnc190IGZsYWdzID0gQVVESU9fSU5QVVRfRkxBR19OT05FLAorICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnBvcnRJZCA9IG51bGxwdHIpOworICAgIGJvb2wgZmluZERldmljZVBvcnQoYXVkaW9fcG9ydF9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U0lPTl9OT05FLCBhdHRyaWJ1dGlvblNvdXJjZSwKKyAgICAgICAgICAgICZjb25maWcsIGZsYWdzLCBzZWxlY3RlZERldmljZUlkLCAmaW5wdXRUeXBlLCBwb3J0SWQpICE9IE9LKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgaWYgKCpwb3J0SWQgPT0gQVVESU9fUE9SVF9IQU5ETEVfTk9ORSB8fCBpbnB1dCA9PSBBVURJT19JT19IQU5ETEVfTk9ORSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCitib29sIEF1ZGlvUG9saWN5TWFuYWdlckZ1enplcjo6ZmluZERldmljZVBvcnQoYXVkaW9fcG9ydF9yb2xlX3Qgcm9sZSwgYXVkaW9fZGV2aWNlc190IGRldmljZVR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcgJmFkZHJlc3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF92NyAqZm91bmRQb3J0KSB7CisgICAgdWludDMyX3QgbnVtUG9ydHMgPSAwOworICAgIHVpbnQzMl90IGdlbmVyYXRpb24xOworICAgIHN0YXR1c190IHJldDsKKworICAgIHJldCA9IG1NYW5hZ2VyLT5saXN0QXVkaW9Qb3J0cyhyb2xlLCBBVURJT19QT1JUX1RZUEVfREVWSUNFLCAmbnVtUG9ydHMsIG51bGxwdHIsICZnZW5lcmF0aW9uMSk7CisgICAgaWYgKHJldCAhPSBOT19FUlJPUikgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgdWludDMyX3QgZ2VuZXJhdGlvbjI7CisgICAgc3RydWN0IGF1ZGlvX3BvcnRfdjcgcG9ydHNbbnVtUG9ydHNdOworICAgIHJldCA9IG1NYW5hZ2VyLT5saXN0QXVkaW9Qb3J0cyhyb2xlLCBBVURJT19QT1JUX1RZUEVfREVWSUNFLCAmbnVtUG9ydHMsIHBvcnRzLCAmZ2VuZXJhdGlvbjIpOworICAgIGlmIChyZXQgIT0gTk9fRVJST1IpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGZvciAoY29uc3QgYXV0byAmcG9ydCA6IHBvcnRzKSB7CisgICAgICAgIGlmIChwb3J0LnJvbGUgPT0gcm9sZSAmJiBwb3J0LmV4dC5kZXZpY2UudHlwZSA9PSBkZXZpY2VUeXBlICYmCisgICAgICAgICAgICAoc3RybmNtcChwb3J0LmV4dC5kZXZpY2UuYWRkcmVzcywgYWRkcmVzcy5jX3N0cigpLCBBVURJT19ERVZJQ0VfTUFYX0FERFJFU1NfTEVOKSA9PQorICAgICAgICAgICAgIDApKSB7CisgICAgICAgICAgICBpZiAoZm91bmRQb3J0KSAqZm91bmRQb3J0ID0gcG9ydDsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiBmYWxzZTsKK30KKworYXVkaW9fcG9ydF9oYW5kbGVfdCBBdWRpb1BvbGljeU1hbmFnZXJGdXp6ZXI6OmdldERldmljZUlkRnJvbVBhdGNoKAorICAgIGNvbnN0IHN0cnVjdCBhdWRpb19wYXRjaCAqcGF0Y2gpIHsKKyAgICBpZiAocGF0Y2gtPm51bV9zb3VyY2VzICE9IDAgJiYgcGF0Y2gtPm51bV9zaW5rcyAhPSAwKSB7CisgICAgICAgIGlmIChwYXRjaC0+c291cmNlc1swXS50eXBlID09IEFVRElPX1BPUlRfVFlQRV9NSVgpIHsKKyAgICAgICAgICAgIHJldHVybiBwYXRjaC0+c2lua3NbMF0uaWQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gcGF0Y2gtPnNvdXJjZXNbMF0uaWQ7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIEFVRElPX1BPUlRfSEFORExFX05PTkU7Cit9C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ckZ1enplcldpdGhDb25maWd1cmF0aW9uRmlsZTo6U2V0VXBNYW5hZ2VyQ29uZmlnKCkgeworICAgIGRlc2VyaWFsaXplQXVkaW9Qb2xpY3lGaWxlKGdldENvbmZpZ0ZpbGUoKS5jX3N0cigpLCAmbU1hbmFnZXItPmdldENvbmZpZygpKTsKK30KKwordm9pZCBBdWRpb1BvbGljeU1hbmFnZXJGdXp6ZXJXaXRoQ29uZmlndXJhdGlvbkZpbGU6OnRyYXZlcnNlQW5kRnV6elhNTCh4bWxEb2NQdHIgcERvYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeG1sTm9kZVB0ciBjdXJyKSB7CisgICAgaWYgKGN1cnIgPT0gbnVsbHB0cikgeworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgeG1sQXR0ciAqYXR0cmlidXRlID0gY3Vyci0+cHJvcGVydGllczsKKyAgICB3aGlsZSAoYXR0cmlidXRlKSB7CisgICAgICAgIGlmICgheG1sU3RyY21wKGF0dHJpYnV0ZS0+bmFtZSwgcmVpbnRlcnByZXRfY2FzdDxjb25zdCB4bWxDaGFyICo+KCJmb3JtYXQiKSkpIHsKKyAgICAgICAgICAgIGNvbnN0IGNoYXIgKm5ld0Zvcm1hdCA9CisgICAgICAgICAgICAgICAgYXVkaW9fZm9ybWF0X3RvX3N0cmluZyhnZXRWYWx1ZUZyb21WZWN0b3I8YXVkaW9fZm9ybWF0X3Q+KG1GZHAsIGtBdWRpb0Zvcm1hdHMpKTsKKyAgICAgICAgICAgIHhtbFNldFByb3AoY3VyciwgYXR0cmlidXRlLT5uYW1lLCByZWludGVycHJldF9jYXN0PGNvbnN0IHhtbENoYXIgKj4obmV3Rm9ybWF0KSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCF4bWxTdHJjbXAoYXR0cmlidXRlLT5uYW1lLCByZWludGVycHJldF9jYXN0PGNvbnN0IHhtbENoYXIgKj4oImZsYWdzIikpKSB7CisgICAgICAgICAgICBzdGQ6OnN0cmluZyBuZXdGbGFnID0gIiI7CisgICAgICAgICAgICB1aW50MTZfdCBudW1GbGFncyA9IHN0ZDo6bWF4KCh1aW50MTZfdCkxLCBtRmRwLT5Db25zdW1lSW50ZWdyYWw8dWludDE2X3Q+KCkpOworICAgICAgICAgICAgZm9yICh1aW50MTZfdCBpID0gMDsgaSA8IG51bUZsYWdzOyArK2kpIHsKKyAgICAgICAgICAgICAgICBuZXdGbGFnICs9IHN0ZDo6c3RyaW5nKGF1ZGlvX291dHB1dF9mbGFnX3RvX3N0cmluZygKKyAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWVGcm9tVmVjdG9yPGF1ZGlvX291dHB1dF9mbGFnc190PihtRmRwLCBrQXVkaW9PdXRwdXRGbGFncykpKTsKKyAgICAgICAgICAgICAgICBpZiAoaSAhPSAobnVtRmxhZ3MgLSAxKSkgeworICAgICAgICAgICAgICAgICAgICBuZXdGbGFnICs9IHN0ZDo6c3RyaW5nKCJ8Iik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgeG1sU2V0UHJvcChjdXJyLCBhdHRyaWJ1dGUtPm5hbWUsIHJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgeG1sQ2hhciAqPihuZXdGbGFnLmNfc3RyKCkpKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoIXhtbFN0cmNtcChhdHRyaWJ1dGUtPm5hbWUsIHJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgeG1sQ2hhciAqPigic2FtcGxpbmdSYXRlcyIpKSkgeworICAgICAgICAgICAgc3RkOjpzdHJpbmcgbmV3UmF0ZSA9ICIiOworICAgICAgICAgICAgdWludDE2X3QgbnVtUmF0ZXMgPSBzdGQ6Om1heCgodWludDE2X3QpMSwgbUZkcC0+Q29uc3VtZUludGVncmFsPHVpbnQxNl90PigpKTsKKyAgICAgICAgICAgIGZvciAodWludDE2X3QgaSA9IDA7IGkgPCBudW1SYXRlczsgKytpKSB7CisgICAgICAgICAgICAgICAgbmV3UmF0ZSArPSBzdGQ6OnRvX3N0cmluZyhnZXRWYWx1ZUZyb21WZWN0b3I8dWludDMyX3Q+KG1GZHAsIGtTYW1wbGluZ1JhdGVzKSk7CisgICAgICAgICAgICAgICAgaWYgKGkgIT0gKG51bVJhdGVzIC0gMSkpIHsKKyAgICAgICAgICAgICAgICAgICAgbmV3UmF0ZSArPSBzdGQ6OnN0cmluZygiLCIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHhtbFNldFByb3AoY3VyciwgYXR0cmlidXRlLT5uYW1lLCByZWludGVycHJldF9jYXN0PGNvbnN0IHhtbENoYXIgKj4obmV3UmF0ZS5jX3N0cigpKSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCF4bWxTdHJjbXAoYXR0cmlidXRlLT5uYW1lLCByZWludGVycHJldF9jYXN0PGNvbnN0IHhtbENoYXIgKj4oImNoYW5uZWxNYXNrcyIpKSkgeworICAgICAgICAgICAgaW50IGlzT3V0TWFzayA9IC0xOworICAgICAgICAgICAgY2hhciAqdmFsdWUgPQorICAgICAgICAgICAgICAgIHJlaW50ZXJwcmV0X2Nhc3Q8Y2hhciAqPih4bWxOb2RlTGlzdEdldFN0cmluZyhwRG9jLCBhdHRyaWJ1dGUtPmNoaWxkcmVuLCAxKSk7CisgICAgICAgICAgICBpZiAoc3RkOjpzdHJpbmcodmFsdWUpLmZpbmQoc3RkOjpzdHJpbmcoIl9PVVRfIikpICE9IHN0ZDo6c3RyaW5nOjpucG9zKSB7CisgICAgICAgICAgICAgICAgLy8gT1VUIG1hc2sKKyAgICAgICAgICAgICAgICBpc091dE1hc2sgPSAxOworICAgICAgICAgICAgfSBlbHNlIGlmIChzdGQ6OnN0cmluZyh2YWx1ZSkuZmluZChzdGQ6OnN0cmluZygiX0lOXyIpKSAhPSBzdGQ6OnN0cmluZzo6bnBvcykgeworICAgICAgICAgICAgICAgIC8vIElOIG1hc2sKKyAgICAgICAgICAgICAgICBpc091dE1hc2sgPSAwOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGlzT3V0TWFzayAhPSAtMSkgeworICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5ld01hc2sgPSAiIjsKKyAgICAgICAgICAgICAgICB1aW50MTZfdCBudW1NYXNrcyA9IHN0ZDo6bWF4KCh1aW50MTZfdCkxLCBtRmRwLT5Db25zdW1lSW50ZWdyYWw8dWludDE2X3Q+KCkpOworICAgICAgICAgICAgICAgIGZvciAodWludDE2X3QgaSA9IDA7IGkgPCBudW1NYXNrczsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChpc091dE1hc2spIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ld01hc2sgKz0gc3RkOjpzdHJpbmcoYXVkaW9fY2hhbm5lbF9vdXRfbWFza190b19zdHJpbmcoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWVGcm9tVmVjdG9yPGF1ZGlvX2NoYW5uZWxfbWFza190PihtRmRwLCBrQXVkaW9DaGFubmVsT3V0TWFza3MpKSk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBuZXdNYXNrICs9IHN0ZDo6c3RyaW5nKGF1ZGlvX2NoYW5uZWxfaW5fbWFza190b19zdHJpbmcoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWVGcm9tVmVjdG9yPGF1ZGlvX2NoYW5uZWxfbWFza190PihtRmRwLCBrQXVkaW9DaGFubmVsSW5NYXNrcykpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoaSAhPSAobnVtTWFza3MgLSAxKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbmV3TWFzayArPSBzdGQ6OnN0cmluZygiLCIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHhtbFNldFByb3AoY3VyciwgYXR0cmlidXRlLT5uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDxjb25zdCB4bWxDaGFyICo+KG5ld01hc2suY19zdHIoKSkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgeG1sRnJlZSh2YWx1ZSk7CisgICAgICAgIH0KKyAgICAgICAgYXR0cmlidXRlID0gYXR0cmlidXRlLT5uZXh0OworICAgIH0KKworICAgIGN1cnIgPSBjdXJyLT54bWxDaGlsZHJlbk5vZGU7CisgICAgd2hpbGUgKGN1cnIgIT0gbnVsbHB0cikgeworICAgICAgICB0cmF2ZXJzZUFuZEZ1enpYTUwocERvYywgY3Vycik7CisgICAgICAgIGN1cnIgPSBjdXJyLT5uZXh0OworICAgIH0KK30KKworc3RkOjpzdHJpbmcgQXVkaW9Qb2xpY3lNYW5hZ2VyRnV6emVyV2l0aENvbmZpZ3VyYXRpb25GaWxlOjpmdXp6WE1MKHN0ZDo6c3RyaW5nIHhtbFBhdGgpIHsKKyAgICBzdGQ6OnN0cmluZyBvdXRQYXRoID0gc0Z1enplZENvbmZpZzsKKworICAgIC8vIExvYWQgaW4gdGhlIHhtbCBmaWxlIGZyb20gZGlzaworICAgIHhtbERvY1B0ciBwRG9jID0geG1sUGFyc2VGaWxlKHhtbFBhdGguY19zdHIoKSk7CisgICAgeG1sTm9kZVB0ciByb290ID0geG1sRG9jR2V0Um9vdEVsZW1lbnQocERvYyk7CisKKyAgICB0cmF2ZXJzZUFuZEZ1enpYTUwocERvYywgcm9vdCk7CisKKyAgICAvLyBTYXZlIHRoZSBkb2N1bWVudCBiYWNrIG91dCB0byBkaXNrLgorICAgIHhtbFNhdmVGaWxlRW5jKG91dFBhdGguY19zdHIoKSwgcERvYywgIlVURi04Iik7CisgICAgeG1sRnJlZURvYyhwRG9jKTsKKworICAgIHJldHVybiBvdXRQYXRoOworfQorC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mF0ZXMpOworICAgIHN0YXR1c190IHJldCA9IGFkZFBvbGljeU1peChnZXRWYWx1ZUZyb21WZWN0b3I8aW50PihtRmRwLCBrTWl4VHlwZXMpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRWYWx1ZUZyb21WZWN0b3I8aW50PihtRmRwLCBrTWl4Um91dGVGbGFncyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFZhbHVlRnJvbVZlY3RvcjxhdWRpb19kZXZpY2VzX3Q+KG1GZHAsIGtBdWRpb0RldmljZXMpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTWl4QWRkcmVzcywgbUF1ZGlvQ29uZmlnLCBtVXNhZ2VSdWxlcyk7CisgICAgaWYgKHJldCAhPSBOT19FUlJPUikgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgc3RydWN0IGF1ZGlvX3BvcnRfdjcgZXh0cmFjdGlvblBvcnQ7CisgICAgZmluZERldmljZVBvcnQoQVVESU9fUE9SVF9ST0xFX1NPVVJDRSwgZ2V0VmFsdWVGcm9tVmVjdG9yPGF1ZGlvX2RldmljZXNfdD4obUZkcCwga0F1ZGlvRGV2aWNlcyksCisgICAgICAgICAgICAgICAgICAgbU1peEFkZHJlc3MsICZleHRyYWN0aW9uUG9ydCk7CisKKyAgICBhdWRpb19wb3J0X2hhbmRsZV90IHNlbGVjdGVkRGV2aWNlSWQgPSBBVURJT19QT1JUX0hBTkRMRV9OT05FOworICAgIGF1ZGlvX3NvdXJjZV90IHNvdXJjZSA9IGdldFZhbHVlRnJvbVZlY3RvcjxhdWRpb19zb3VyY2VfdD4obUZkcCwga0F1ZGlvU291cmNlcyk7CisgICAgYXVkaW9fYXR0cmlidXRlc190IGF0dHIgPSB7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX1VOS05PV04sIHNvdXJjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19GTEFHX05PTkUsICIifTsKKyAgICBzdGQ6OnN0cmluZyB0YWdzID0gImFkZHI9IiArIG1NaXhBZGRyZXNzOworICAgIHN0cm5jcHkoYXR0ci50YWdzLCB0YWdzLmNfc3RyKCksIEFVRElPX0FUVFJJQlVURVNfVEFHU19NQVhfU0laRSAtIDEpOworICAgIGdldElucHV0Rm9yQXR0cihhdHRyLCBtVHJhY2tlci0+Z2V0UmlpZCgpLCAmc2VsZWN0ZWREZXZpY2VJZCwgbUF1ZGlvQ29uZmlnLmZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgbUF1ZGlvQ29uZmlnLmNoYW5uZWxfbWFzaywgbUF1ZGlvQ29uZmlnLnNhbXBsZV9yYXRlLCBBVURJT19JTlBVVF9GTEFHX05PTkUsCisgICAgICAgICAgICAgICAgICAgICZtUG9ydElkKTsKKworICAgIHJldCA9IG1NYW5hZ2VyLT5zdGFydElucHV0KG1Qb3J0SWQpOworICAgIGlmIChyZXQgIT0gTk9fRVJST1IpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBpZiAoIWZpbmREZXZpY2VQb3J0KEFVRElPX1BPUlRfUk9MRV9TSU5LLAorICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWVGcm9tVmVjdG9yPGF1ZGlvX2RldmljZXNfdD4obUZkcCwga0F1ZGlvRGV2aWNlcyksIG1NaXhBZGRyZXNzLAorICAgICAgICAgICAgICAgICAgICAgICAgJm1JbmplY3Rpb25Qb3J0KSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcmV0dXJuIHRydWU7Cit9CisKK3ZvaWQgQXVkaW9Qb2xpY3lNYW5hZ2VyRnV6emVyRFBQbGF5YmFja1JlUm91dGluZzo6cGxheUJhY2tSZVJvdXRpbmcoKSB7CisgICAgY29uc3QgdWludDMyX3QgbnVtVGVzdENhc2VzID0gbUZkcC0+Q29uc3VtZUludGVncmFsSW5SYW5nZTx1aW50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ZGV2aWNlUG9ydDsKKyAgICAgICAgY29uc3QgYXVkaW9fcG9ydF9yb2xlX3Qgcm9sZSA9CisgICAgICAgICAgICBhdWRpb19pc19vdXRwdXRfZGV2aWNlKHR5cGUpID8gQVVESU9fUE9SVF9ST0xFX1NJTksgOiBBVURJT19QT1JUX1JPTEVfU09VUkNFOworICAgICAgICBmaW5kRGV2aWNlUG9ydChyb2xlLCB0eXBlLCBhZGRyZXNzLCAmZGV2aWNlUG9ydCk7CisKKyAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCByb3V0ZWRQb3J0SWQgPSBkZXZpY2VQb3J0LmlkOworICAgICAgICAvLyBUcnkgc3RhcnQgaW5wdXQgb3Igb3V0cHV0IGFjY29yZGluZyB0byB0aGUgZGV2aWNlIHR5cGUKKyAgICAgICAgaWYgKGF1ZGlvX2lzX291dHB1dF9kZXZpY2VzKHR5cGUpKSB7CisgICAgICAgICAgICBnZXRPdXRwdXRGb3JBdHRyKCZyb3V0ZWRQb3J0SWQsIGdldFZhbHVlRnJvbVZlY3RvcjxhdWRpb19mb3JtYXRfdD4obUZkcCwga0F1ZGlvRm9ybWF0cyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFZhbHVlRnJvbVZlY3RvcjxhdWRpb19jaGFubmVsX21hc2tfdD4obUZkcCwga0F1ZGlvQ2hhbm5lbE91dE1hc2tzKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWVGcm9tVmVjdG9yPHVpbnQzMl90PihtRmRwLCBrU2FtcGxpbmdSYXRlcyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX09VVFBVVF9GTEFHX05PTkUpOworICAgICAgICB9IGVsc2UgaWYgKGF1ZGlvX2lzX2lucHV0X2RldmljZSh0eXBlKSkgeworICAgICAgICAgICAgUmVjb3JkaW5nQWN0aXZpdHlUcmFja2VyIHRyYWNrZXI7CisgICAgICAgICAgICBnZXRJbnB1dEZvckF0dHIoe30sIHRyYWNrZXIuZ2V0UmlpZCgpLCAmcm91dGVkUG9ydElkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFZhbHVlRnJvbVZlY3RvcjxhdWRpb19mb3JtYXRfdD4obUZkcCwga0F1ZGlvRm9ybWF0cyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWVGcm9tVmVjdG9yPGF1ZGlvX2NoYW5uZWxfbWFza190PihtRmRwLCBrQXVkaW9DaGFubmVsSW5NYXNrcyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWVGcm9tVmVjdG9yPHVpbnQzMl90PihtRmRwLCBrU2FtcGxpbmdSYXRlcyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fSU5QVVRfRkxBR19OT05FKTsKKyAgICAgICAgfQorICAgIH0KK30KKwordm9pZCBBdWRpb1BvbGljeU1hbmFnZXJGdXp6ZXJEZXZpY2VDb25uZWN0aW9uOjpwcm9jZXNzKCkgeworICAgIGlmIChpbml0aWFsaXplKCkpIHsKKyAgICAgICAgc2V0RGV2aWNlQ29ubmVjdGlvblN0YXRlKCk7CisgICAgICAgIGV4cGxpY2l0bHlSb3V0aW5nQWZ0ZXJDb25uZWN0aW9uKCk7CisgICAgICAgIGZ1enpQYXRjaENyZWF0aW9uKCk7CisgICAgfQorfQorCitjbGFzcyBBdWRpb1BvbGljeU1hbmFnZXJUVkZ1enplciA6IHB1YmxpYyBBdWRpb1BvbGljeU1hbmFnZXJGdXp6ZXJXaXRoQ29uZmlndXJhdGlvbkZpbGUgeworICAgcHVibGljOgorICAgIGV4cGxpY2l0IEF1ZGlvUG9saWN5TWFuYWdlclRWRnV6emVyKEZ1enplZERhdGFQcm92aWRlciAqZmRwKQorICAgICAgICA6IEF1ZGlvUG9saWN5TWFuYWdlckZ1enplcldpdGhDb25maWd1cmF0aW9uRmlsZShmZHApe307CisgICAgdm9pZCBwcm9jZXNzKCkgb3ZlcnJpZGU7CisKK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ICAgICAgIDwvYXR0YWNoZWREZXZpY2VzPgorICAgICAgICAgICAgPGRlZmF1bHRPdXRwdXREZXZpY2U+U3BlYWtlcjwvZGVmYXVsdE91dHB1dERldmljZT4KKyAgICAgICAgICAgIDxtaXhQb3J0cz4KKyAgICAgICAgICAgICAgICA8bWl4UG9ydCBuYW1lPSJwcmltYXJ5IG91dHB1dCIgcm9sZT0ic291cmNlIiBmbGFncz0iQVVESU9fT1VUUFVUX0ZMQUdfUFJJTUFSWSI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iNDgwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9PVVRfU1RFUkVPIi8+CisgICAgICAgICAgICAgICAgPC9taXhQb3J0PgorICAgICAgICAgICAgICAgIDxtaXhQb3J0IG5hbWU9InByaW1hcnkgaW5wdXQiIHJvbGU9InNpbmsiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjQ4MDAwIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfSU5fU1RFUkVPIi8+CisgICAgICAgICAgICAgICAgPC9taXhQb3J0PgorICAgICAgICAgICAgICAgIDxtaXhQb3J0IG5hbWU9Im1peHBvcnRfYnRfaGZwX291dHB1dCIgcm9sZT0ic291cmNlIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0ibWl4cG9ydF9idF9oZnBfaW5wdXQiIHJvbGU9InNpbmsiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjgwMDAsMTEwMjUsMTYwMDAsNDQxMDAsNDgwMDAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9JTl9TVEVSRU8sQVVESU9fQ0hBTk5FTF9JTl9NT05PIi8+CisgICAgICAgICAgICAgICAgPC9taXhQb3J0PgorICAgICAgICAgICAgPC9taXhQb3J0cz4KKyAgICAgICAgICAgIDxkZXZpY2VQb3J0cz4KKyAgICAgICAgICAgICAgICA8ZGV2aWNlUG9ydCB0YWdOYW1lPSJTcGVha2VyIiB0eXBlPSJBVURJT19ERVZJQ0VfT1VUX1NQRUFLRVIiIHJvbGU9InNpbmsiPgorICAgICAgICAgICAgICAgIDwvZGV2aWNlUG9ydD4KKyAgICAgICAgICAgICAgICA8ZGV2aWNlUG9ydCB0YWdOYW1lPSJCdWlsdC1JbiBNaWMiIHR5cGU9IkFVRElPX0RFVklDRV9JTl9CVUlMVElOX01JQyIgcm9sZT0ic291cmNlIj4KKyAgICAgICAgICAgICAgICA8L2RldmljZVBvcnQ+CisgICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iSGRtaSIgdHlwZT0iQVVESU9fREVWSUNFX09VVF9IRE1JIiByb2xlPSJzaW5rIj4KKyAgICAgICAgICAgICAgICA8L2RldmljZVBvcnQ+CisgICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iSGRtaS1JbiBNaWMiIHR5cGU9IkFVRElPX0RFVklDRV9JTl9IRE1JIiByb2xlPSJzb3VyY2UiPgorICAgICAgICAgICAgICAgIDwvZGV2aWNlUG9ydD4KKyAgICAgICAgICAgICAgICA8ZGV2aWNlUG9ydCB0YWdOYW1lPSJCVCBTQ08iIHR5cGU9IkFVRElPX0RFVklDRV9PVVRfQkxVRVRPT1RIX1NDTyIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByb2xlPSJzaW5rIiBhZGRyZXNzPSJoZnBfY2xpZW50X291dCI+CisgICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IkJUIFNDTyBIZWFkc2V0IE1pYyIgdHlwZT0iQVVESU9fREVWSUNFX0lOX0JMVUVUT09USF9TQ09fSEVBRFNFVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByb2xlPSJzb3VyY2UiIGFkZHJlc3M9ImhmcF9jbGllbnRfaW4iPgorICAgICAgICAgICAgICAgIDwvZGV2aWNlUG9ydD4KKyAgICAgICAgICAgIDwvZGV2aWNlUG9ydHM+CisgICAgICAgICAgICA8cm91dGVzPgorICAgICAgICAgICAgICAgIDxyb3V0ZSB0eXBlPSJtaXgiIHNpbms9IlNwZWFrZXIiCisgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZXM9InByaW1hcnkgb3V0cHV0Ii8+CisgICAgICAgICAgICAgICAgPHJvdXRlIHR5cGU9Im1peCIgc2luaz0icHJpbWFyeSBpbnB1dCIKKyAgICAgICAgICAgICAgICAgICAgICAgc291cmNlcz0iQnVpbHQtSW4gTWljLEhkbWktSW4gTWljIi8+CisgICAgICAgICAgICAgICAgPHJvdXRlIHR5cGU9Im1peCIgc2luaz0iSGRtaSIKKyAgICAgICAgICAgICAgICAgICAgICAgc291cmNlcz0icHJpbWFyeSBvdXRwdXQiLz4KKyAgICAgICAgICAgICAgICA8cm91dGUgdHlwZT0ibWl4IiBzaW5rPSJCVCBTQ08iCisgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZXM9Im1peHBvcnRfYnRfaGZwX291dHB1dCIvPgorICAgICAgICAgICAgICAgIDxyb3V0ZSB0eXBlPSJtaXgiIHNpbms9Im1peHBvcnRfYnRfaGZwX2lucHV0IgorICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2VzPSJCVCBTQ08gSGVhZHNldCBNaWMiLz4KKyAgICAgICAgICAgIDwvcm91dGVzPgorICAgICAgICA8L21vZHVsZT4KKworICAgICAgICA8IS0tIFJlbW90ZSBTdWJtaXggbW9kdWxlIC0tPgorICAgICAgICA8bW9kdWxlIG5hbWU9InJfc3VibWl4IiBoYWxWZXJzaW9uPSIyLjAiPgorICAgICAgICAgICAgPGF0dGFjaGVkRGV2aWNlcz4KKyAgICAgICAgICAgICAgICA8aXRlbT5SZW1vdGUgU3VibWl4IEluPC9pdGVtPgorICAgICAgICAgICAgPC9hdHRhY2hlZERldmljZXM+CisgICAgICAgICAgICA8bWl4UG9ydHM+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0icl9zdWJtaXggb3V0cHV0IiByb2xlPSJzb3VyY2UiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjQ4MDAwIiBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyIvPgorICAgICAgICAgICAgICAgIDwvbWl4UG9ydD4KKyAgICAgICAgICAgICAgICA8bWl4UG9ydCBuYW1lPSJyX3N1Ym1peCBpbnB1dCIgcm9sZT0ic2luayI+CisgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjQ4MDAwIiBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfSU5fU1RFUkVPIi8+CisgICAgICAgICAgICAgICAgPC9taXhQb3J0PgorICAgICAgICAgICA8L21peFBvcnRzPgorICAgICAgICAgICA8ZGV2aWNlUG9ydHM+CisgICAgICAgICAgICAgICA8ZGV2aWNlUG9ydCB0YWdOYW1lPSJSZW1vdGUgU3VibWl4IE91dCIgdHlwZT0iQVVESU9fREVWSUNFX09VVF9SRU1PVEVfU1VCTUlYIiAgcm9sZT0ic2luayI+CisgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjQ4MDAwIiBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyIvPgorICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iUmVtb3RlIFN1Ym1peCBJbiIgdHlwZT0iQVVESU9fREVWSUNFX0lOX1JFTU9URV9TVUJNSVgiICByb2xlPSJzb3VyY2UiPgorICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX0lOX1NURVJFTyIvPgorICAgICAgICAgICAgICAgIDwvZGV2aWNlUG9ydD4KKyAgICAgICAgICAgIDwvZGV2aWNlUG9ydHM+CisgICAgICAgICAgICA8cm91dGVzPgorICAgICAgICAgICAgICAgIDxyb3V0ZS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AgICAgIDwvYXR0YWNoZWREZXZpY2VzPgorICAgICAgICAgICAgPG1peFBvcnRzPgorICAgICAgICAgICAgICAgIDxtaXhQb3J0IG5hbWU9Im1zMTIgaW5wdXQiIHJvbGU9InNvdXJjZSI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iNDgwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9PVVRfU1RFUkVPIi8+CisgICAgICAgICAgICAgICAgPC9taXhQb3J0PgorICAgICAgICAgICAgICAgIDxtaXhQb3J0IG5hbWU9Im1zMTIgY29tcHJlc3NlZCBpbnB1dCIgcm9sZT0ic291cmNlIgorICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3M9IkFVRElPX09VVFBVVF9GTEFHX0RJUkVDVHxBVURJT19PVVRQVVRfRkxBR19DT01QUkVTU19PRkZMT0FEfEFVRElPX09VVFBVVF9GTEFHX05PTl9CTE9DS0lORyI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfQUMzIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSIzMjAwMCw0NDEwMCw0ODAwMCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9NT05PfEFVRElPX0NIQU5ORUxfT1VUX1NURVJFT3xBVURJT19DSEFOTkVMX09VVF81UE9JTlQxIi8+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfRV9BQzMiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjMyMDAwLDQ0MTAwLDQ4MDAwIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX01PTk98QVVESU9fQ0hBTk5FTF9PVVRfU1RFUkVPfEFVRElPX0NIQU5ORUxfT1VUXzVQT0lOVDF8QVVESU9fQ0hBTk5FTF9PVVRfN1BPSU5UMSIvPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX0VfQUMzX0pPQyIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iMzIwMDAsNDQxMDAsNDgwMDAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9PVVRfTU9OT3xBVURJT19DSEFOTkVMX09VVF9TVEVSRU98QVVESU9fQ0hBTk5FTF9PVVRfNVBPSU5UMXxBVURJT19DSEFOTkVMX09VVF83UE9JTlQxIi8+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfQUM0IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSIzMjAwMCw0NDEwMCw0ODAwMCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9NT05PfEFVRElPX0NIQU5ORUxfT1VUX1NURVJFT3xBVURJT19DSEFOTkVMX09VVF81UE9JTlQxfEFVRElPX0NIQU5ORUxfT1VUXzdQT0lOVDEiLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICAgICAgPCEtLSBUaGUgSFcgQVYgU3luYyBmbGFnIGlzIG5vdCByZXF1aXJlZCwgYnV0IGlzIHJlY29tbWVuZGVkIC0tPgorICAgICAgICAgICAgICAgIDxtaXhQb3J0IG5hbWU9Im1zMTIgb3V0cHV0IiByb2xlPSJzaW5rIiBmbGFncz0iQVVESU9fSU5QVVRfRkxBR19IV19BVl9TWU5DfEFVRElPX0lOUFVUX0ZMQUdfRElSRUNUIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX0lOX1NURVJFTyIvPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX0FDMyIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iNDgwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9JTl81UE9JTlQxIi8+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfRV9BQzMiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjQ4MDAwIiBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfSU5fNVBPSU5UMSIvPgorICAgICAgICAgICAgICAgIDwvbWl4UG9ydD4KKyAgICAgICAgICAgPC9taXhQb3J0cz4KKyAgICAgICAgICAgPGRldmljZVBvcnRzPgorICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iTVMxMiBJbnB1dCIgdHlwZT0iQVVESU9fREVWSUNFX09VVF9CVVMiICByb2xlPSJzaW5rIj4KKyAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iNDgwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9PVVRfU1RFUkVPIi8+CisgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9BQzMiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iMzIwMDAsNDQxMDAsNDgwMDAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9NT05PfEFVRElPX0NIQU5ORUxfT1VUX1NURVJFT3xBVURJT19DSEFOTkVMX09VVF81UE9JTlQxIi8+CisgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9FX0FDMyIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSIzMjAwMCw0NDEwMCw0ODAwMCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX01PTk98QVVESU9fQ0hBTk5FTF9PVVRfU1RFUkVPfEFVRElPX0NIQU5ORUxfT1VUXzVQT0lOVDF8QVVESU9fQ0hBTk5FTF9PVVRfN1BPSU5UMSIvPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX0VfQUMzX0pPQyIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iMzIwMDAsNDQxMDAsNDgwMDAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9PVVRfTU9OT3xBVURJT19DSEFOTkVMX09VVF9TVEVSRU98QVVESU9fQ0hBTk5FTF9PVVRfNVBPSU5UMXxBVURJT19DSEFOTkVMX09VVF83UE9JTlQxIi8+CisgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9BQzQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iMzIwMDAsNDQxMDAsNDgwMDAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9NT05PfEFVRElPX0NIQU5ORUxfT1VUX1NURVJFT3xBVURJT19DSEFOTkVMX09VVF81UE9JTlQxfEFVRElPX0NIQU5ORUxfT1VUXzdQT0lOVDEiLz4KKyAgICAgICAgICAgICAgIDwvZGV2aWNlUG9ydD4KKyAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9Ik1TMTIgT3V0cHV0IiB0eXBlPSJBVURJT19ERVZJQ0VfSU5fQlVTIiAgcm9sZT0ic291cmNlIj4KKyAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iNDgwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9JTl9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L2RldmljZVBvcnQ+CisgICAgICAgICAgICA8L2RldmljZVBvcnRzPgorICAgICAgICAgICAgPHJvdXRlcz4KKyAgICAgICAgICAgICAgICA8cm91dGUgdHlwZT0ibWl4IiBzaW5rPSJNUzEyIElucHV0IiBzb3VyY2VzPSJtczEyIGlucHV0LG1zMTIgY29tcHJlc3NlZCBpbnB1dCIvPgorICAgICAgICAgICAgICAgIDxyb3V0ZSB0eXBlPSJtaXgiIHNpbms9Im1zMTIgb3V0cHV0IiBzb3VyY2VzPSJNUzEyIE91dHB1dCIvPgorICAgICAgICAgICAgPC9yb3V0ZXM+CisgICAgICAgI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WdzPSJBVURJT19PVVRQVVRfRkxBR19QUklNQVJZIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0icHJpbWFyeSBpbnB1dCIgcm9sZT0ic2luayI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iNDgwMDAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9JTl9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICA8L21peFBvcnRzPgorICAgICAgICAgICAgPGRldmljZVBvcnRzPgorICAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IlNwZWFrZXIiIHR5cGU9IkFVRElPX0RFVklDRV9PVVRfU1BFQUtFUiIgcm9sZT0ic2luayI+CisgICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IkJ1aWx0LUluIE1pYyIgdHlwZT0iQVVESU9fREVWSUNFX0lOX0JVSUxUSU5fTUlDIiByb2xlPSJzb3VyY2UiPgorICAgICAgICAgICAgICAgIDwvZGV2aWNlUG9ydD4KKyAgICAgICAgICAgIDwvZGV2aWNlUG9ydHM+CisgICAgICAgICAgICA8cm91dGVzPgor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hdWx0T3V0cHV0RGV2aWNlPgorICAgICAgICAgICAgPG1peFBvcnRzPgorICAgICAgICAgICAgICAgIDwhLS0gUHJvZmlsZXMgb24gdGhlIEhETUkgcG9ydCBhcmUgZXhwbGljaXQgZm9yIHNpbXBsaWNpdHkuIEluIHJlYWxpdHkgdGhleSBhcmUgZHluYW1pYyAtLT4KKyAgICAgICAgICAgICAgICA8IS0tIE5vdGU6IHBvcnRzIGFyZSBpbnRlbnRpb25hbGx5IGFycmFuZ2VkIGZyb20gbW9yZSBzcGVjaWZpYyB0byBsZXNzCisgICAgICAgICAgICAgICAgICAgICBzcGVjaWZpYyBpbiBvcmRlciB0byB0ZXN0IGIvMTQwNDQ3MTI1IGZvciBIVyBBViBTeW5jLCBhbmQgc2ltaWxhciAiZXhwbGljaXQgbWF0Y2hlcyIgLS0+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0idHVubmVsIiByb2xlPSJzb3VyY2UiCisgICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3M9IkFVRElPX09VVFBVVF9GTEFHX0RJUkVDVHxBVURJT19PVVRQVVRfRkxBR19IV19BVl9TWU5DIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0ibG93IGxhdGVuY3kiIHJvbGU9InNvdXJjZSIKKyAgICAgICAgICAgICAgICAgICAgICAgICBmbGFncz0iQVVESU9fT1VUUFVUX0ZMQUdfRElSRUNUfEFVRElPX09VVFBVVF9GTEFHX01NQVBfTk9JUlEiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjQ4MDAwIiBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyIvPgorICAgICAgICAgICAgICAgIDwvbWl4UG9ydD4KKyAgICAgICAgICAgICAgICA8bWl4UG9ydCBuYW1lPSJkaXJlY3QiIHJvbGU9InNvdXJjZSIgZmxhZ3M9IkFVRElPX09VVFBVVF9GTEFHX0RJUkVDVCI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iNDgwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9PVVRfU1RFUkVPIi8+CisgICAgICAgICAgICAgICAgPC9taXhQb3J0PgorICAgICAgICAgICAgICAgIDxtaXhQb3J0IG5hbWU9InByaW1hcnkgb3V0cHV0IiByb2xlPSJzb3VyY2UiIGZsYWdzPSJBVURJT19PVVRQVVRfRkxBR19QUklNQVJZIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgIDwvbWl4UG9ydHM+CisgICAgICAgICAgIDxkZXZpY2VQb3J0cz4KKyAgICAgICAgICAgICAgICA8ZGV2aWNlUG9ydCB0YWdOYW1lPSJTcGVha2VyIiB0eXBlPSJBVUR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8gcmVtb3ZlIGRldmljZSBmcm9tIG1SZXBvcnRlZEZvcm1hdHNNYXAgY2FjaGUKKyAgICAgICAgICAgIG1SZXBvcnRlZEZvcm1hdHNNYXAuZXJhc2UoZGV2aWNlKTsKKwogICAgICAgICAgICAgfSBicmVhazsKIAogICAgICAgICBkZWZhdWx0OgpAQCAtMjQ2LDYgKzI0OSw3IEBACiAgICAgICAgICAgICAgICAgICAgIGlmICgoc3RhdGUgPT0gQVVESU9fUE9MSUNZX0RFVklDRV9TVEFURV9VTkFWQUlMQUJMRSkgfHwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKChkZXNjLT5tRmxhZ3MgJiBBVURJT19PVVRQVVRfRkxBR19ESVJFQ1QpICE9IDApICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChkZXNjLT5tRGlyZWN0T3BlbkNvdW50ID09IDApKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJBdWRpb1NvdXJjZXNGb3JPdXRwdXQob3V0cHV0KTsKICAgICAgICAgICAgICAgICAgICAgICAgIGNsb3NlT3V0cHV0KG91dHB1dCk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CkBAIC0yNjAsMTUgKzI2NCwxNSBAQAogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgY2hlY2tDbG9zZU91dHB1dHMoKTsKICAgICAgICAgfQotCi0gICAgICAgIGlmIChtRW5naW5lLT5nZXRQaG9uZVN0YXRlKCkgPT0gQVVESU9fTU9ERV9JTl9DQUxMICYmIGhhc1ByaW1hcnlPdXRwdXQoKSkgewotICAgICAgICAgICAgRGV2aWNlVmVjdG9yIG5ld0RldmljZXMgPSBnZXROZXdPdXRwdXREZXZpY2VzKG1QcmltYXJ5T3V0cHV0LCBmYWxzZSAvKmZyb21DYWNoZSovKTsKLSAgICAgICAgICAgIHVwZGF0ZUNhbGxSb3V0aW5nKG5ld0RldmljZXMpOwotICAgICAgICB9CisgICAgICAg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ICAgICAgICAgICAgLy8gY2FuIGJlIHJlb3BlbmVkIHRvIHF1ZXJ5IGR5bmFtaWMgcHJvZmlsZXMgd2hlbiBhbGwgY2xpZW50cyBhcmUgaW5hY3RpdmUuCisgICAgICAgICAgICAgICAgaWYgKGFyZUFsbEFjdGl2ZVRyYWNrc1Jlcm91dGVkKGRlc2MpKSB7CisgICAgICAgICAgICAgICAgICAgIG91dHB1dHNUb1Jlb3Blbi5wdXNoX2JhY2sobU91dHB1dHMua2V5QXQoaSkpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGRlc2MtPm1QZW5kaW5nUmVvcGVuVG9RdWVyeVByb2ZpbGVzID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoIWRlc2MtPnN1cHBvcnRzRGV2aWNlc0ZvclBsYXliYWNrKGFjdGl2ZU1lZGlhRGV2aWNlcykpIHsKKyAgICAgICAgICAgICAgICAvLyBDbGVhciB0aGUgZmxhZyB0aGF0IHByZXZpb3VzbHkgc2V0IGZvciByZS1xdWVyeWluZyBwcm9maWxlcy4KKyAgICAgICAgICAgICAgICBkZXNjLT5tUGVuZGluZ1Jlb3BlblRvUXVlcnlQcm9maWxlcyA9IGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGZvciAoY29uc3QgYXV0byYgb3V0cHV0IDogb3V0cHV0c1RvUmVvcGVuKSB7CisgICAgICAgICAgICBzcDxTd0F1ZGlvT3V0cHV0RGVzY3JpcHRvcj4gZGVzYyA9IG1PdXRwdXRzLnZhbHVlRm9yKG91dHB1dCk7CisgICAgICAgICAgICBjbG9zZU91dHB1dChvdXRwdXQpOworICAgICAgICAgICAgb3Blbk91dHB1dFdpdGhQcm9maWxlQW5kRGV2aWNlKGRlc2MtPm1Qcm9maWxlLCBhY3RpdmVNZWRpYURldmljZXMpOwogICAgICAgICB9CiAKICAgICAgICAgaWYgKHN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WdzX21hc2tfdD4ocmVzdWx0QXR0ci0+ZmxhZ3MgfCBpdC0+c2Vjb25kKTsKICAgICB9CiAgICAgKnN0cmVhbSA9IG1FbmdpbmUtPmdldFN0cmVhbVR5cGVGb3JBdHRyaWJ1dGVzKCpyZXN1bHRBdHRyKTsKIApAQCAtMTAyMCwxMSArMTA5NSw5IEBACiAgICAgKm91dHB1dCA9IEFVRElPX0lPX0hBTkRMRV9OT05FOwogICAgIGlmICghbXNkRGV2aWNlcy5pc0VtcHR5KCkpIHsKICAgICAgICAgKm91dHB1dCA9IGdldE91dHB1dEZvckRldmljZXMobXNkRGV2aWNlcywgc2Vzc2lvbiwgKnN0cmVhbSwgY29uZmlnLCBmbGFncyk7Ci0gICAgICAgIHNwPERldmljZURlc2NyaXB0b3I+IGRldmljZSA9IG91dHB1dERldmljZXMuaXNFbXB0eSgpID8gbnVsbHB0ciA6IG91dHB1dERldmljZXMuaXRlbUF0KDApOwotICAgICAgICBpZiAoKm91dHB1dCAhPSBBVURJT19JT19IQU5ETEVfTk9ORSAmJiBzZXRNc2RQYXRjaChkZXZpY2UpID09IE5PX0VSUk9SKSB7CisgICAgICAgIGlmICgqb3V0cHV0ICE9IEFVRElPX0lPX0hBTkRMRV9OT05FICYmIHNldE1zZE91dHB1dFBhdGNoZXMoJm91dHB1dERldmljZXMpID09IE5PX0VSUk9SKSB7CiAgICAgICAgICAgICBBTE9HVigiJXMoKSBVc2luZyBNU0QgZGV2aWNlcyAlcyBpbnN0ZWFkIG9mIGRldmljZXMgJXMiLAogICAgICAgICAgICAgICAgICAgX19mdW5jX18sIG1zZERldmljZXMudG9TdHJpbmcoKS5jX3N0cigpLCBvdXRwdXREZXZpY2VzLnRvU3RyaW5nKCkuY19zdHIoKSk7Ci0gICAgICAgICAgICBvdXRwdXREZXZpY2VzID0gbXNkRGV2aWNlczsKICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICpvdXRwdXQgPSBBVURJT19JT19IQU5ETEVfTk9ORTsKICAgICAgICAgfQpAQCAtMTAzOCw2ICsxMTExLDEyIEBACiAgICAgfQogCiAgICAgKnNlbGVjdGVkRGV2aWNlSWQgPSBnZXRGaXJzdERldmljZUlkKG91dHB1dERldmljZXMpOworICAgIGZvciAoYXV0byAmb3V0cHV0RGV2aWNlIDogb3V0cHV0RGV2aWNlcykgeworICAgICAgICBpZiAob3V0cHV0RGV2aWNlLT5nZXRJZCgpID09IGdldENvbmZpZygpLmdldERlZmF1bHRPdXRwdXREZXZpY2UoKS0+Z2V0SWQoKSkgeworICAgICAgICAgICAgKnNlbGVjdGVkRGV2aWNlSWQgPSBvdXRwdXREZXZpY2UtPmdldElkKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KIAogICAgIGlmIChvdXRwdXREZXZpY2VzLm9ubHlDb250YWluc0RldmljZXNXaXRoVHlwZShBVURJT19ERVZJQ0VfT1VUX1RFTEVQSE9OWV9UWCkpIHsKICAgICAgICAgKm91dHB1dFR5cGUgPSBBUElfT1VUUFVUX1RFTEVQSE9OWV9UWDsKQEAgLTEwNTQsNyArMTEzMyw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgKm91dHB1dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zdHJlYW1fdHlwZV90ICpzdHJlYW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgdWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUmIGF0dHJpYnV0aW9uU291cmNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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cywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgT3V0cHV0UHJvZmlsZUNvbGxlY3Rpb24gJm91dHB1dFByb2ZpbGVzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxEZXZpY2VEZXNjcmlwdG9yPiAmc291cmNlRGV2aWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxEZXZpY2VEZXNjcmlwdG9yPiAmc2lua0RldmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXVkaW9Qcm9maWxlVmVjdG9yJiBzb3VyY2VQcm9maWxlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXVkaW9Qcm9maWxlVmVjdG9yJiBzaW5rUHJvZmlsZXMpIGNvbnN0IHsKICAgICBpZiAoaW5wdXRQcm9maWxlcy5pc0VtcHR5KCkpIHsKLSAgICAgICAgQUxPR0UoIiVzKCkgbm8gaW5wdXQgcHJvZmlsZXMgZm9yIE1TRCBtb2R1bGUiLCBfX2Z1bmNfXyk7CisgICAgICAgIEFMT0dFKCIlcygpIG5vIGlucHV0IHByb2ZpbGVzIGZvciBzb3VyY2UgbW9kdWxlIiwgX19mdW5jX18pOwogICAgICAgICByZXR1cm4gTk9fSU5JVDsKICAgICB9Ci0gICAgY29uc3QgT3V0cHV0UHJvZmlsZUNvbGxlY3Rpb24gJm91dHB1dFByb2ZpbGVzID0gZGV2aWNlTW9kdWxlLT5nZXRPdXRwdXRQcm9maWxlcygpOwogICAgIGlmIChvdXRwdXRQcm9maWxlcy5pc0VtcHR5KCkpIHsKLSAgICAgICAgQUxPR0UoIiVzKCkgbm8gb3V0cHV0IHByb2ZpbGVzIGZvciBkZXZpY2UgJXMiLCBfX2Z1bmNfXywgb3V0cHV0RGV2aWNlLT50b1N0cmluZygpLmNf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NvbmZpZywgJnNpbmtDb25maWcpOwotICAgIGlmIChyZXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgLy8gRm91bmQgYSBtYXRjaGluZyBwcm9maWxlIGZvciBlbmNvZGVkIGF1ZGlvLiBSZS1jcmVhdGUgUGF0Y2hCdWlsZGVyIHdpdGggdGhpcyBjb25maWcuCi0gICAgICAgIHJldHVybiAoUGF0Y2hCdWlsZGVyKCkpLmFkZFNvdXJjZShzb3VyY2VDb25maWcpLmFkZFNpbmsoc2lua0NvbmZpZyk7CisgICAgZm9yIChhdXRvIGh3QXZTeW5jIDogeyB0cnVlLCBmYWxzZSB9KSB7CisgICAgICAgIGlmIChnZXRNc2RQcm9maWxlcyhod0F2U3luYywgaW5wdXRQcm9maWxlcywgb3V0cHV0UHJvZmlsZXMsIHNvdXJjZURldmljZSwgc2lua0RldmljZSwKKyAgICAgICAgICAgICAgICBzb3VyY2VQcm9maWxlcywgc2lua1Byb2ZpbGVzKSAhPSBOT19FUlJPUikgeworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGdldEJlc3RNc2RDb25maWcoaHdBdlN5bmMsIHNvdXJjZVByb2ZpbGVzLCBzaW5rUHJvZmlsZXMsICZzb3VyY2VDb25maWcsCisgICAgICAgICAgICAgICAgJnNpbmtDb25maWcpID09IE5PX0VSUk9SKSB7CisgICAgICAgICAgICAvLyBGb3VuZCBhIG1hdGNoaW5nIGNvbmZpZy4gUmUtY3JlYXRlIFBhdGNoQnVpbGRlciB3aXRoIHRoaXMgY29uZmlnLgorICAgICAgICAgICAgcmV0dXJuIChQYXRjaEJ1aWxkZXIoKSkuYWRkU291cmNlKHNvdXJjZUNvbmZpZykuYWRkU2luayhzaW5rQ29uZmlnKTsKKyAgICAgICAgfQogICAgIH0KLSAgICBBTE9HVigiJXMoKSBubyBtYXRjaGluZyBwcm9maWxlIGZvdW5kLiBGYWxsIHRocm91Z2ggdG8gZGVmYXVsdCBQQ00gcGF0Y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0gJnBhdGNoLT5tUGF0Y2guc2lua3Nbal07CisgICAgICAgICAgICBpZiAoc2luay0+dHlwZSA9PSBBVURJT19QT1JUX1RZUEVfREVWSUNFICYmIGRldmljZXMuZ2V0RGV2aWNlKHNpbmstPmV4dC5kZXZpY2UudHlwZSwKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nOChzaW5rLT5leHQuZGV2aWNlLmFkZHJlc3MpLCBBVURJT19GT1JNQVRfREVGQVVMVCkgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgIHJlbGVhc2VBdWRpb1BhdGNoKHBhdGNoLT5nZXRIYW5kbGUoKSwgbVVpZENhY2hlZCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CisKIGF1ZGlvX2lvX2hhbmRsZV90IEF1ZGlvUG9saWN5TWFuYWdlcjo6c2VsZWN0T3V0cHV0KGNvbnN0IFNvcnRlZFZlY3RvcjxhdWRpb19pb19oYW5kbGVfdD4mIG91dHB1dHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fb3V0cHV0X2ZsYWdzX3QgZmxhZ3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZm9ybWF0X3QgZm9ybWF0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2NoYW5uZWxfbWFza190IGNoYW5uZWxNYXNrLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHNhbXBsaW5nUmF0ZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190IGZsYWdzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAg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hBUFRJQ0dFTkVSQVRPUik7CisgICAgICAgIGlmIChvdXRwdXRzLmluZGV4T2YoaGFwdGljR2VuZXJhdGluZ091dHB1dCkgPj0gMCkgeworICAgICAgICAgICAgcmV0dXJuIGhhcHRpY0dlbmVyYXRpbmdPdXRwdXQ7CisgICAgICAgIH0KKyAgICB9CisKICAgICAvLyBGbGFncyBkaXNxdWFsaWZ5aW5nIGFuIG91dHB1dDogdGhlIG1hdGNoIG11c3QgaGFwcGVuIGJlZm9yZSBjYWxsaW5nIHNlbGVjdE91dHB1dCgpCiAgICAgc3RhdGljIGNvbnN0IGF1ZGlvX291dHB1dF9mbGFnc190IGtFeGNsdWRlZEZsYWdzID0gKGF1ZGlvX291dHB1dF9mbGFnc190KQogICAgICAgICAoQVVESU9fT1VUUFVUX0ZMQUdfSFdfQVZfU1lOQyB8IEFVRElPX09VVFBVVF9GTEFHX01NQVBfTk9JUlEgfCBBVURJT19PVVRQVVRfRkxBR19ESVJFQ1QpOwpAQCAtMTc2NSw3ICsxOTEwLDggQEAKICAgICAgICAgY2hlY2tBbmRTZXRWb2x1bWUoY3VydmVzLCBjbGllbnQtPnZvbHVtZVNvdXJjZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJ2ZXMuZ2V0Vm9sdW1lSW5kZXgob3V0cHV0RGVzYy0+ZGV2aWNlcygpLnR5cGVzKCkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXREZXNjLAotICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXREZXNjLT5kZXZpY2VzKCkudHlwZXMoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dERlc2MtPmRldmljZXMoKS50eXBlcygpLCAwIC8qZGVsYXkqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0RGVzYy0+dXNlSHdHYWluKCkgLypmb3JjZSovKTsKIAogICAgICAgICAvLyB1cGRhdGUgdGhlIG91dHB1dHMgaWYgc3RhcnRpbmcg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GlzIHBlbmRpbmcgcmVvcGVuZWQgdG8gcXVlcnkgZHluYW1pYyBwcm9maWxlcyBhbmQKKyAgICAgICAgLy8gdGhlcmUgaXMgbm8gYWN0aXZlIGNsaWVudHMKKyAgICAgICAgY2xvc2VPdXRwdXQob3V0cHV0RGVzYy0+bUlvSGFuZGxlKTsKKyAgICAgICAgc3A8U3dBdWRpb091dHB1dERlc2NyaXB0b3I+IG5ld091dHB1dERlc2MgPSBvcGVuT3V0cHV0V2l0aFByb2ZpbGVBbmREZXZpY2UoCisgICAgICAgICAgICAgICAgb3V0cHV0RGVzYy0+bVByb2ZpbGUsIG1FbmdpbmUtPmdldEFjdGl2ZU1lZGlhRGV2aWNlcyhtQXZhaWxhYmxlT3V0cHV0RGV2aWNlcykpOworICAgICAgICBpZiAobmV3T3V0cHV0RGVzYyA9PSBudWxscHRyKSB7CisgICAgICAgICAgICBBTE9HRSgiJXMgZmFpbGVkIHRvIG9wZW4gb3V0cHV0IiwgX19mdW5jX18pOworICAgICAgICB9CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKyAgICByZXR1cm4gZmFsc2U7CiB9CiAKIHN0YXR1c190IEF1ZGlvUG9saWN5TWFuYWdlcjo6Z2V0SW5wdXRGb3JBdHRyKGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAqYXR0ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICppbnB1dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3VuaXF1ZV9pZF90IHJpaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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NzaW9uKTsKKyAgICAgICAgQUxPR1YoIiVzIHJldXNpbmcgTU1BUCBpbnB1dCAlZCBmb3Igc2Vzc2lvbiAlZCIsIF9fRlVOQ1RJT05fXywgKmlucHV0LCBzZXNzaW9uKTsKICAgICAgICAgZ290byBleGl0OwogICAgIH0KIApAQCAtMjA2NiwxNCArMjIyOSwxOCBAQAogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgLy8gUHJldmVudCBmcm9tIHN0b3JpbmcgaW52YWxpZCByZXF1ZXN0ZWQgZGV2aWNlIGlkIGluIGNsaWVudHMKICAgICAgICAgICAgIHJlcXVlc3RlZERldmljZUlkID0gQVVESU9fUE9SVF9IQU5ETEVfTk9ORTsKLSAgICAgICAgICAgIGRldmljZSA9IG1FbmdpbmUtPmdldElucHV0RGV2aWNlRm9yQXR0cmlidXRlcyhhdHRyaWJ1dGVzLCAmcG9saWN5TWl4KTsKKyAgICAgICAgICAgIGRldmljZSA9IG1FbmdpbmUtPmdldElucHV0RGV2aWNlRm9yQXR0cmlidXRlcyhhdHRyaWJ1dGVzLCB1aWQsICZwb2xpY3lNaXgpOworICAgICAgICAgICAgQUxPR1ZfSUYoZGV2aWNlICE9IG51bGxwdHIsICIlcyBmb3VuZCBkZXZpY2UgdHlwZSBpcyAweCVYIiwKKyAgICAgICAgICAgICAgICBfX0ZVTkNUSU9OX18sIGRldmljZS0+dHlwZSgpKTsKICAgICAgICAgfQogICAgICAgICBpZiAoZGV2aWNlID09IG51bGxwdHIpIHsKICAgICAgICAgICAgIEFMT0dXKCJnZXRJbnB1dEZvckF0dHIoKSBjb3VsZCBub3QgZmluZCBkZXZpY2UgZm9yIHNvdXJjZSAlZCIsIGF0dHJpYnV0ZXMuc291cmNlKTsKICAgICAgICAgICAgIHN0YXR1cyA9IEJBRF9WQUxVRTsKICAgICAgICAgICAgIGdvdG8gZXJyb3I7CiAgICAgICAgIH0KLSAgICAgICAgaWYgKHBvbGljeU1peCkgeworICAgICAgICBpZiAoZGV2aW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9yIChjb25zdCBhdXRvICZjbGllbnQgOiBjbGllbnRzKSB7CisgICAgICAgICAgICBpZiAoc2Vzc2lvbiA9PSBjbGllbnQtPnNlc3Npb24oKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBkZXNjLT5tSW9IYW5kbGU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKICAgICBpZiAoIXByb2ZpbGUtPmNhbk9wZW5OZXdJbygpKSB7CiAgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgbUlucHV0cy5zaXplKCk7ICkgewogICAgICAgICAgICAgc3A8QXVkaW9JbnB1dERlc2NyaXB0b3I+IGRlc2MgPSBtSW5wdXRzLnZhbHVlQXQoaSk7CkBAIC0yMzQ5LDEyICsyNTMxLDE0IEBACiAgICAgICAgIEFMT0dXKCIlcyBpbnB1dCAlZCBjbGllbnQgJWQgYWxyZWFkeSBzdG9wcGVkIiwgX19GVU5DVElPTl9fLCBpbnB1dCwgY2xpZW50LT5wb3J0SWQoKSk7CiAgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKICAgICB9Ci0KKyAgICBhdXRvIG9sZF9zb3VyY2UgPSBpbnB1dERlc2MtPnNvdXJjZSgpOwogICAgIGlucHV0RGVzYy0+c2V0Q2xpZW50QWN0aXZlKGNsaWVudCwgZmFsc2UpOwogCiAgICAgaW5wdXREZXNjLT5zdG9wKCk7CiAgICAgaWYgKGlucHV0RGVzYy0+aXNBY3RpdmUoKSkgewotICAgICAgICBzZXRJbnB1dERldmljZShpbnB1dCwgZ2V0TmV3SW5wdXREZXZpY2UoaW5wdXREZXNjKSwgZmFsc2UgLyogZm9yY2UgKi8pOworICAgICAgICBhdXRvIGN1cnJlbnRfc291cmNlID0gaW5wdXREZXNjLT5zb3VyY2UoKTsKKyAgICAgICAgc2V0SW5wdXREZXZpY2UoaW5wdXQsIGdldE5ld0lucHV0RGV2aWNlKGlucHV0RGVzYyksCisgICAgICAgICAgICAgICAgb2xkX3NvdXJjZSAhPSBjdXJyZW50X3NvdXJjZSAvKiBmb3JjZSAqLyk7CiAgICAgfSBlbHNlIHsKICAgICAgICAgc3A8QXVkaW9Qb2xpY3lNaXg+IHBvbGljeU1peCA9IGlucHV0RGVzYy0+bVBvbGljeU1peC5wcm9tb3RlKCk7CiAgICAgICAgIC8vIGlmIGlucHV0IG1hcHMgdG8gYSBkeW5hbWljIHBvbGljeSB3aXRoIGFuIGFjdGl2aXR5IGxpc3RlbmVyLCBub3RpZnkgb2Ygc3RhdGUgY2hhbmdlCkBAIC0yNDUwLDcgKzI2MzQsNyBAQAogICAgICAgICAgICAgYm9vbCBjbG9zZSA9IGZhbHNlOwogICAgICAgICAgICAgZm9yIChjb25zdCBhdXRvJiBjbGllbnQgOiBpbnB1dC0+Y2xpZW50c0xpc3QoKSkgewogICAgICAgICAgICAgICAgIHNwPERldmljZURlc2NyaXB0b3I+IGRldmljZSA9Ci0gICAgICAgICAgICAgICAgICAgIG1FbmdpbmUtPmdldElucHV0RGV2aWNlRm9yQXR0cmlidXRlcyhjbGllbnQtPmF0dHJpYnV0ZXMoKSk7CisgICAgICAgICAgICAgICAgICAgIG1FbmdpbmUtPmdldElucHV0RGV2aWNlRm9yQXR0cmlidXRlcyhjbGllbnQtPmF0dHJpYnV0ZXMoKSwgY2xpZW50LT51aWQoKSk7CiAgICAgICAgICAgICAgICAgaWYgKCFpbnB1dC0+c3VwcG9ydGVkRGV2aWNlcygpLmNvbnRhaW5zKGRldmljZSkpIHsKICAgICAgICAgICAgICAgICAgICAgY2xvc2UgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTI3NzgsNyArMjk2Miw3IEBACiAKIHN0YXR1c190IEF1ZGlvUG9saWN5TWFuYWdlcjo6cmVnaXN0ZXJFZmZlY3QoY29uc3QgZWZmZWN0X2Rlc2NyaXB0b3JfdCAqZGVzYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3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W5hYmxlZCgpKSB7Ci0gICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgcmV0dXJuIEFVRElPX09GRkxPQURfTk9UX1NVUFBPUlRFRDsKICAgICB9CiAKICAgICAvLyBTZWUgaWYgdGhlcmUgaXMgYSBwcm9maWxlIHRvIHN1cHBvcnQgdGhpcy4KQEAgLTMzNjYsOCArMzY2MCwxNiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZmZsb2FkSW5mby5jaGFubmVsX21hc2ssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX09VVFBVVF9GTEFHX0NPTVBSRVNTX09GRkxPQUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRydWUgLyogZGlyZWN0T25seSAqLyk7Ci0gICAgQUxPR1YoImlzT2ZmbG9hZFN1cHBvcnRlZCgpIHByb2ZpbGUgJXNmb3VuZCIsIHByb2ZpbGUgIT0gMCA/ICIiIDogIk5PVCAiKTsKLSAgICByZXR1cm4gKHByb2ZpbGUgIT0gMCk7CisgICAgQUxPR1YoIiVzOiBwcm9maWxlICVzZm91bmQlcyIsIF9fZnVuY19fLCBwcm9maWxlICE9IG51bGxwdHIgPyAiIiA6ICJOT1QgIiwKKyAgICAgICAgICAgIChwcm9maWxlICE9IG51bGxwdHIgJiYgKHByb2ZpbGUtPmdldEZsYWdzKCkgJiBBVURJT19PVVRQVVRfRkxBR19HQVBMRVNTX09GRkxPQUQpICE9IDApCisgICAgICAgICAgICA/ICIsIHN1cHBvcnRzIGdhcGxlc3MiIDogIiIpOworICAgIGlmIChwcm9maWxlID09IG51bGxwdHIpIHsKKyAgICAgICAgcmV0dXJuIEFVRElPX09GRkxPQURfTk9UX1NVUFBPUlRFRDsKKyAgICB9CisgICAgaWYgKChwcm9maWxlLT5nZXRGbGFncygpICYgQVVESU9fT1VUUFVUX0ZMQUdfR0FQTEVTU19PRkZMT0FEKSAhPSAwKSB7CisgICAgICAgIHJldHVybiBBVURJT19PRkZMT0FEX0dBUExFU1NfU1VQUE9SVEVEOworICAgIH0KKyAgICByZXR1cm4gQVVESU9fT0ZGTE9BRF9TVVBQT1JURUQ7CiB9CiAKIGJvb2wgQXVkaW9Qb2xpY3lNYW5hZ2VyOjppc0RpcmVjdE91dHB1dFN1cHBvcnRlZChjb25zdCBhdWRpb19jb25maWdfYmFzZV90JiBjb25maWcsCkBAIC0zMzkxLDE1ICszNjkzLDE1IEBACiBzdGF0dXNfdCBBdWRpb1BvbGljeU1hbmFnZXI6Omxpc3RBdWRpb1BvcnRzKGF1ZGlvX3BvcnRfcm9sZV90IHJvbGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfdHlwZV90IHR5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuc2lnbmVkIGludCAqbnVtX3BvcnRzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QgYXVkaW9fcG9ydCAqcG9ydHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cnVjdCBhdWRpb19wb3J0X3Y3ICpwb3J0cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQgaW50ICpnZW5lcmF0aW9uKQogewotICAgIGlmIChudW1fcG9ydHMgPT0gTlVMTCB8fCAoKm51bV9wb3J0cyAhPSAwICYmIHBvcnRzID09IE5VTEwpIHx8Ci0gICAgICAgICAgICBnZW5lcmF0aW9uID09IE5VTEwpIHsKKyAgICBpZiAobnVtX3BvcnRzID09IG51bGxwdHIgfHwgKCpudW1fcG9ydHMgIT0gMCAmJiBwb3J0cyA9PSBudWxscHRyKSB8fAorICAgICAgICAgICAgZ2VuZXJhdGlvbiA9PSBudWxscHRyKSB7CiAgIC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WNoIHRoZSBzaW5rIHNvIHRoYXQgaXMgY2FuIGJlIGRlY2xhcmVkIGFzIGF2YWlsYWJsZS4KKyAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBvdXRwdXQgPSBBVURJT19JT19IQU5ETEVfTk9ORTsKKyAgICAgICAgICAgICAgICBzcDxTd0F1ZGlvT3V0cHV0RGVzY3JpcHRvcj4gb3V0cHV0RGVzYyA9IG51bGxwdHI7CisgICAgICAgICAgICAgICAgaWYgKHNvdXJjZURlc2MgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgICAgICAvLyB0YWtlIGNhcmUgb2YgZHluYW1pYyByb3V0aW5nIGZvciBTd091dHB1dCBzZWxlY3Rpb24sCisgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2F0dHJpYnV0ZXNfdCBhdHRyaWJ1dGVzID0gc291cmNlRGVzYy0+YXR0cmlidXRlcygpOworICAgICAgICAgICAgICAgICAgICBhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSA9IHNvdXJjZURlc2MtPnN0cmVhbSgpOworICAgICAgICAgICAgICAgICAgICBhdWRpb19hdHRyaWJ1dGVzX3QgcmVzdWx0QXR0cjsKKyAgICAgICAgICAgICAgICAgICAgYXVkaW9fY29uZmlnX3QgY29uZmlnID0gQVVESU9fQ09ORklHX0lOSVRJQUxJWkVSOworICAgICAgICAgICAgICAgICAgICBjb25maWcuc2FtcGxlX3JhdGUgPSBzb3VyY2VEZXNjLT5jb25maWcoKS5zYW1wbGVfcmF0ZTsKKyAgICAgICAgICAgICAgICAgICAgY29uZmlnLmNoYW5uZWxfbWFzayA9IHNvdXJjZURlc2MtPmNvbmZpZygpLmNoYW5uZWxfbWFzazsKKyAgICAgICAgICAgICAgICAgICAgY29uZmlnLmZvcm1hdCA9IHNvdXJjZURlc2MtPmNvbmZpZygpLmZvcm1hdDsKKyAgICAgICAgICAgICAgICAgICAgYXVkaW9fb3V0cHV0X2ZsYWdzX3QgZmxhZ3MgPSBBVURJT19PVVRQVVRfRkxBR19OT05FOworICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90IHNlbGVjdGVkRGV2aWNlSWQgPSBBVURJT19QT1JUX0hBTkRMRV9OT05FOworICAgICAgICAgICAgICAgICAgICBib29sIGlzUmVxdWVzdGVkRGV2aWNlRm9yRXhjbHVzaXZlVXNlID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIG91dHB1dF90eXBlX3Qgb3V0cHV0VHlwZTsKKyAgICAgICAgICAgICAgICAgICAgZ2V0T3V0cHV0Rm9yQXR0ckludCgmcmVzdWx0QXR0ciwgJm91dHB1dCwgQVVESU9fU0VTU0lPTl9OT05FLCAmYXR0cmlidXRlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmc3RyZWFtLCBzb3VyY2VEZXNjLT51aWQoKSwgJmNvbmZpZywgJmZsYWdzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzZWxlY3RlZERldmljZUlkLCAmaXNSZXF1ZXN0ZWREZXZpY2VGb3JFeGNsdXNpdmVVc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbHB0ciwgJm91dHB1dFR5cGUpOworICAgICAgICAgICAgICAgICAgICBpZiAob3V0cHV0ID09IEFVRElPX0lPX0hBTkRMRV9OT05FKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiJXMgbm8gb3V0cHV0IGZvciBkZXZpY2UgJXMiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19GVU5DVElPTl9fLCBzaW5rRGV2aWNlLT50b1N0cmluZygpLmNfc3RyKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElOVkFMSURfT1BFUkFUSU9OOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIG91dHB1dERlc2MgPSBtT3V0cHV0cy52YWx1ZUZvcihvdXRwdXQpOworICAgICAgICAgICAgICAgICAgICBpZiAob3V0cHV0RGVzYy0+aXNEdXBsaWNhdGVkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dFKCIlcyBvdXRwdXQgaXMgZHVwbGljYXRlZCIsIF9fZnVuY19fKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzb3VyY2VEZXNjLT5zZXRTd091dHB1dChvdXRwdXREZXNjKTsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgLy8gY3JlYXRlIGEgc29mdHdhcmUgYnJpZGdlIGluIFBhdGNoUGFuZWwgaWY6CiAgICAgICAgICAgICAgICAgLy8gLSBzb3VyY2UgYW5kIHNpbmsgZGV2aWNlcyBhcmUgb24gZGlmZmVyZW50IEhXIG1vZHVsZXMgT1IKICAgICAgICAgICAgICAgICAvLyAtIGF1ZGlvIEhBTCB2ZXJzaW9uIGlzIDwgMy4wCkBAIC0zNzAxLDQ5ICs0MDQ3LDI1IEBACiAgICAgICAgICAgICAgICAgICAgIGlmIChwYXRjaC0+bnVtX3NpbmtzID4gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElOVkFMSURfT1BFUkFUSU9OOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90IG91dHB1dCA9IEFVRElPX0lPX0hBTkRMRV9OT05FOwotICAgICAgICAgICAgICAgICAgICBpZiAoc291cmNlRGVzYyAhPSBudWxscHRyKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyB0YWtlIGNhcmUgb2YgZHluYW1pYyByb3V0aW5nIGZvciBTd091dHB1dCBzZWxlY3Rpb24sCi0gICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19hdHRyaWJ1dGVzX3QgYXR0cmlidXRlcyA9IHNvdXJjZURlc2MtPmF0dHJpYnV0ZXMoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtID0gc291cmNlRGVzYy0+c3RyZWFtKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19hdHRyaWJ1dGVzX3QgcmVzdWx0QXR0cjsKLSAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2NvbmZpZ190IGNvbmZpZyA9IEFVRElPX0NPTkZJR19JTklUSUFMSVpFUjsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5zYW1wbGVfcmF0ZSA9IHNvdXJjZURlc2MtPmNvbmZpZygpLnNhbXBsZV9yYXRlOwotICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnLmNoYW5uZWxfbWFzayA9IHNvdXJjZURlc2MtPmNvbmZpZygpLmNoYW5uZWxfbWFzazsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5mb3JtYXQgPSBzb3VyY2VEZXNjLT5jb25maWcoKS5mb3JtYXQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19vdXRwdXRfZmxhZ3NfdCBmbGFncyA9IEFVRElPX09VVFBVVF9GTEFHX05PTkU7Ci0gICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90IHNlbGVjdGVkRGV2aWNlSWQgPSBBVURJT19QT1JUX0hBTkRMRV9OT05FOwotICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc1JlcXVlc3RlZERldmljZUZvckV4Y2x1c2l2ZVVzZSA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0X3R5cGVfdCBvdXRwdXRUeXBlOwotICAgICAgICAgICAgICAgICAgICAgICAgZ2V0T3V0cHV0Rm9yQXR0ckludCgmcmVzdWx0QXR0ciwgJm91dHB1dCwgQVVESU9fU0VTU0lPTl9OT05FLCAmYXR0cmlidXRlcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnN0cmVhbSwgc291cmNlRGVzYy0+dWlkKCksICZjb25maWcsICZmbGFncywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNlbGVjdGVkRGV2aWNlSWQsICZpc1JlcXVlc3RlZERldmljZUZvckV4Y2x1c2l2ZVVzZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbHB0ciwgJm91dHB1dFR5cGUpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG91dHB1dCA9PSBBVURJT19JT19IQU5ETEVfTk9ORSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dWKCIlcyBubyBvdXRwdXQgZm9yIGRldmljZSAlcyIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19GVU5DVElPTl9fLCBzaW5rRGV2aWNlLT50b1N0cmluZygpLmNfc3RyKCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHNvdXJjZURlc2MgPT0gbnVsbHB0cikgewogICAgICAgICAgICAgICAgICAgICAgICAgU29ydGVkVmVjdG9yPGF1ZGlvX2lvX2hhbmRsZV90PiBvdXRwdXRzID0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0T3V0cHV0c0ZvckRldmljZXMoRGV2aWNlVmVjdG9yKHNpbmtEZXZpY2UpLCBtT3V0cHV0cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpZiB0aGUgc2luayBkZXZpY2UgaXMgcmVhY2hhYmxlIHZpYSBhbiBvcGVuZWQgb3V0cHV0IHN0cmVhbSwgcmVxdWVzdCB0bwogICAgICAgICAgICAgICAgICAgICAgICAgLy8gZ28gdmlhIHRoaXMgb3V0cHV0IHN0cmVhbSBieSBhZGRpbmcgYSBzZWNvbmQgc291cmNlIHRvIHRoZSBwYXRjaAogICAgICAgICAgICAgICAgICAgICAgICAgLy8gZGVzY3JpcHRpb24KICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dCA9IHNlbGVjdE91dHB1dChvdXRwdXRzKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAob3V0cHV0ICE9IEFVRElPX0lPX0hBTkRMRV9OT05FKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzcDxTd0F1ZGlvT3V0cHV0RGVzY3JpcHRvcj4gb3V0cHV0RGVzYyA9IG1PdXRwdXRzLnZhbHVlRm9yKG91dHB1dCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAob3V0cHV0RGVzYy0+aXNEdXBsaWNhdGVkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiJXMgb3V0cHV0IGZvciBkZXZpY2UgJXMgaXMgZHVwbGljYXRlZCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19GVU5DVElPTl9fLCBzaW5rRGV2aWNlLT50b1N0cmluZygpLmNfc3RyKCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvdXRwdXQgIT0gQVVESU9fSU9fSEFORExFX05PTkUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXREZXNjID0gbU91dHB1dHMudmFsdWVGb3Iob3V0cHV0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3V0cHV0RGVzYy0+aXNEdXBsaWNhdGVkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIiVzIG91dHB1dCBmb3IgZGV2aWNlICVzIGlzIGR1cGxpY2F0ZWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX0ZVTkNUSU9OX18sIHNpbmtEZXZpY2UtPnRvU3RyaW5nKCkuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKG91dHB1dERlc2MgIT0gbnVsbHB0cikgewogICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9jb25maWcgc3JjTWl4UG9ydENvbmZpZyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0RGVzYy0+dG9BdWRpb1BvcnRDb25maWcoJnNyY01peFBvcnRDb25maWcsICZwYXRjaC0+c291cmNlc1swXSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc291cmNlRGVzYyAhPSBudWxscHRyKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlRGVzYy0+c2V0U3dPdXRwdXQob3V0cHV0RGVzYyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBmb3Igdm9sdW1lIGNvbnRyb2wsIHdlIG1heSBuZWVkIGEgdmFsaWQgc3RyZWFtCiAgICAgICAgICAgICAgICAgICAgICAgICBzcmNNaXhQb3J0Q29uZmlnLmV4dC5taXgudXNlY2FzZS5zdHJlYW0gPSBzb3VyY2VEZXNjICE9IG51bGxwdHIgPwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlRGVzYy0+c3RyZWFtKCkgOiBBVURJT19TVFJFQU1fUEFUQ0g7CkBAIC0zNzUzLDYgKzQwNzUsNyBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgLy8gVE9ETzogY2hlY2sgZnJvbSByb3V0aW5nIGNhcGFiaWxpdGllcyBpbiBjb25maWcgZmlsZSBhbmQgb3RoZXIgY29uZmxpY3RpbmcgcGF0Y2hlcwogCitpbnN0YWxsUGF0Y2g6CiAgICAgICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBpbnN0YWxsUGF0Y2goCiAgICAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgaW5kZXgsIGhhbmRsZSwgcGF0Y2hCdWlsZGVyLnBhdGNoKCksIGRlbGF5TXMsIHVpZCwgJnBhdGNoRGVzYyk7CiAgICAgICAgICAgICBpZiAoc3RhdHVzICE9IE5PX0VSUk9SKSB7CkBAIC0zODM0LDggKzQxNTcsOSBAQAogICAgICAgICAgICAgICAgIHNwPFN3QXVkaW9PdXRwdXREZXNjcmlwdG9yPiBvdXRwdXREZXNjID0KICAgICAgICAgICAgICAgICAgICAgICAgIG1PdXRwdXRzLmdldE91dHB1dEZyb21JZChwYXRjaC0+c291cmNlc1sxXS5pZCk7CiAgICAgICAgICAgICAgICAgaWYgKG91dHB1dERlc2MgPT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXMgb3V0cHV0IG5vdCBmb3VuZCBmb3IgaWQgJWQiLCBfX2Z1bmNfXywgcGF0Y2gtPnNvdXJjZXNbMF0uaWQpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgICAgICAgICAgICAgICAgICBBTE9HVygiJXMgb3V0cHV0IG5vdCBmb3VuZCBmb3IgaWQgJWQiLCBfX2Z1bmNfXywgcGF0Y2gtPnNvdXJjZXNbMF0uaWQpOworICAgICAgICAgICAgICAgICAgICAvLyByZWxlYXNlT3V0cHV0IGhhcyBhbHJlYWR5IGNhbGxlZCBjbG9zZU91cHV0IGluIGNhc2Ugb2YgZGlyZWN0IG91dHB1dAorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7CiA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lIHBhdGNoLCBlcnJvciAlZCIsIF9fZnVuY19fLCBzdGF0dXMpOwogICAgICAgICByZXR1cm4gSU5WQUxJRF9PUEVSQVRJT047CiAgICAgfQotICAgIHNvdXJjZURlc2MtPnNldFBhdGNoSGFuZGxlKGhhbmRsZSk7CisgICAgc291cmNlRGVzYy0+Y29ubmVjdChoYW5kbGUsIHNpbmtEZXZpY2UpOwogICAgIC8vIFNXIEJyaWRnZT8gKEB0b2RvOiBIVyBicmlkZ2UsIGtlZXAgdHJhY2sgb2YgSHdPdXRwdXQgZm9yIGRldmljZSBzZWxlY3Rpb24gInJlY29uc2lkZXJhdGlvbiIpCiAgICAgc3A8U3dBdWRpb091dHB1dERlc2NyaXB0b3I+IHN3T3V0cHV0ID0gc291cmNlRGVzYy0+c3dPdXRwdXQoKS5wcm9tb3RlKCk7CiAgICAgaWYgKHN3T3V0cHV0ICE9IDApIHsKQEAgLTQyMjEsNTQgKzQ1NDksMjggQEAKIAogc3RhdHVzX3QgQXVkaW9Qb2xpY3lNYW5hZ2VyOjpnZXRTdXJyb3VuZEZvcm1hdHModW5zaWduZWQgaW50ICpudW1TdXJyb3VuZEZvcm1hdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19mb3JtYXRfdCAqc3Vycm91bmRGb3JtYXRzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCAqc3Vycm91bmRGb3JtYXRzRW5hYmxlZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcmVwb3J0ZWQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sICpzdXJyb3VuZEZvcm1hdHNFbmFibGVkKQogewotICAgIGlmIChudW1TdXJyb3VuZEZvcm1hdHMgPT0gTlVMTCB8fCAoKm51bVN1cnJvdW5kRm9ybWF0cyAhPSAwICYm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N0KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0gZWxzZSB7Ci0gICAgICAgIGZvciAoY29uc3QgYXV0byYgcGFpciA6IG1Db25maWcuZ2V0U3Vycm91bmRGb3JtYXRzKCkpIHsKLSAgICAgICAgICAgIGZvcm1hdHMuaW5zZXJ0KHBhaXIuZmlyc3QpOwotICAgICAgICB9Ci0gICAgfQotICAgICpudW1TdXJyb3VuZEZvcm1hdHMgPSBmb3JtYXRzLnNpemUoKTsKKworICAgICpudW1TdXJyb3VuZEZvcm1hdHMgPSBtQ29uZmlnLmdldFN1cnJvdW5kRm9ybWF0cygpLnNpemUoKTsKICAgICBhdWRpb19wb2xpY3lfZm9yY2VkX2NmZ190IGZvcmNlVXNlID0gbUVuZ2luZS0+Z2V0Rm9yY2VVc2UoCiAgICAgICAgICAgICBBVURJT19QT0xJQ1lfRk9SQ0VfRk9SX0VOQ09ERURfU1VSUk9VTkQpOwotICAgIGZvciAoY29uc3QgYXV0byYgZm9ybWF0OiBmb3JtYXRzKSB7CisgICAgZm9yIChjb25zdCBhdXRvJiBmb3JtYXQ6IG1Db25maWcuZ2V0U3Vycm91bmRGb3JtYXRzKCkpIHsKICAgICAgICAgaWYgKGZvcm1hdHNXcml0dGVuIDwgZm9ybWF0c01heCkgewotICAgICAgICAgICAgc3Vycm91bmRGb3JtYXRzW2Zvcm1hdHNXcml0dGVuXSA9IGZvcm1hdDsKKyAgICAgICAgICAgIHN1cnJvdW5kRm9ybWF0c1tmb3JtYXRzV3JpdHRlbl0gPSBmb3JtYXQuZmlyc3Q7CiAgICAgICAgICAgICBib29sIGZvcm1hdEVuYWJsZWQgPSB0cnVlOwogICAgICAgICAgICAgc3dpdGNoIChmb3JjZVVzZSkgewogICAgICAgICAgICAgICAgIGNhc2UgQVVESU9fUE9MSUNZX0ZPUkNFX0VOQ09ERURfU1VSUk9VTkRfTUFOVUFMOgotICAgICAgICAgICAgICAgICAgICBmb3JtYXRFbmFibGVkID0gbU1hbnVhbFN1cnJvdW5kRm9ybWF0cy5jb3VudChmb3JtYXQpICE9IDA7CisgICAgICAgICAgICAgICAgICAgIGZvcm1hdEVuYWJsZWQgPSBtTWFudWFsU3Vycm91bmRGb3JtYXRzLmNvdW50KGZvcm1hdC5maXJzdCkgIT0gMDsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgY2FzZSBBVURJT19QT0xJQ1lfRk9SQ0VfRU5DT0RFRF9TVVJST1VORF9ORVZFUjoKICAgICAgICAgICAgICAgICAgICAgZm9ybWF0RW5hYmxlZCA9IGZhbHNlOwpAQCAtNDI4Miw2ICs0NTg0LDYwIEBACiAgICAgcmV0dXJuIE5PX0VSUk9SOwogfQogCitzdGF0dXNfdCBBdWRpb1BvbGljeU1hbmFnZXI6OmdldFJlcG9ydGVkU3Vycm91bmRGb3JtYXRzKHVuc2lnbmVkIGludCAqbnVtU3Vycm91bmRGb3JtYXRzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19mb3JtYXRfdCAqc3Vycm91bmRGb3JtYXRzKSB7CisgICAgaWYgKG51bVN1cnJvdW5kRm9ybWF0cyA9PSBudWxscHRyIHx8ICgqbnVtU3Vycm91bmRGb3JtYXRzICE9IDAgJiYgc3Vycm91bmRGb3JtYXRzID09IG51bGxwdHIpKSB7CisgICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgfQorICAgIEFMT0dWKCIlcygpIG51bVN1cnJvdW5kRm9ybWF0cyAlZCBzdXJyb3VuZEZvcm1hdHMgJXAiLAorICAgICAgICAgICAgX19mdW5jX18sICpudW1TdXJyb3VuZEZvcm1hdHMsIHN1cnJvdW5kRm9ybWF0cyk7CisKKyAgICBzaX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jQsNyArNTAwOCw3IEBACiAgICAgICAgICAgICAgICAgICAgIHNldEVuZ2luZURldmljZUNvbm5lY3Rpb25TdGF0ZShkZXZpY2UsIEFVRElPX1BPTElDWV9ERVZJQ0VfU1RBVEVfQVZBSUxBQkxFKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobVByaW1hcnlPdXRwdXQgPT0gMCAmJgorICAgICAgICAgICAgaWYgKG1QcmltYXJ5T3V0cHV0ID09IG51bGxwdHIgJiYKICAgICAgICAgICAgICAgICAgICAgb3V0UHJvZmlsZS0+Z2V0RmxhZ3MoKSAmIEFVRElPX09VVFBVVF9GTEFHX1BSSU1BUlkpIHsKICAgICAgICAgICAgICAgICBtUHJpbWFyeU91dHB1dCA9IG91dHB1dERlc2M7CiAgICAgICAgICAgICB9CkBAIC00Njk2LDcgKzUwNDAsOCBAQAogICAgICAgICAgICAgY29uc3QgRGV2aWNlVmVjdG9yICZzdXBwb3J0ZWREZXZpY2VzID0gaW5Qcm9maWxlLT5nZXRTdXBwb3J0ZWREZXZpY2VzKCk7CiAgICAgICAgICAgICBEZXZpY2VWZWN0b3IgYXZhaWxQcm9maWxlRGV2aWNlcyA9IHN1cHBvcnRlZERldmljZXMuZmlsdGVyKG1JbnB1dERldmljZXNBbGwpOwogICAgICAgICAgICAgaWYgKGF2YWlsUHJvZmlsZURldmljZXMuaXNFbXB0eSgpKSB7Ci0gICAgICAgICAgICAgICAgQUxPR0UoIiVzOiBJbnB1dCBkZXZpY2UgbGlzdCBpcyBlbXB0eSEiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICAgICAgICAgIEFMT0dWKCIlczogSW5wdXQgZGV2aWNlIGxpc3QgaXMgZW1wdHkhIGZvciBwcm9maWxlICVzIiwKKyAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sIGluUHJvZmlsZS0+Z2V0VGFnTmFtZSgpLmNfc3RyKCkpOwogICAgICAgICAgICAgICAgIGNvbnRpbn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0YXR1cyA9PSBOT19FUlJPUikgewotICAgICAgICAgICAgICAgIC8vIEhlcmUgaXMgd2hlcmUgdGhlIG91dF9zZXRfcGFyYW1ldGVycygpIGZvciBjYXJkICYgZGV2aWNlIGdldHMgY2FsbGVkCi0gICAgICAgICAgICAgICAgaWYgKCFhZGRyZXNzLmlzRW1wdHkoKSkgewotICAgICAgICAgICAgICAgICAgICBjaGFyICpwYXJhbSA9IGF1ZGlvX2RldmljZV9hZGRyZXNzX3RvX3BhcmFtZXRlcihkZXZpY2VUeXBlLCBhZGRyZXNzKTsKLSAgICAgICAgICAgICAgICAgICAgbXBDbGllbnRJbnRlcmZhY2UtPnNldFBhcmFtZXRlcnMob3V0cHV0LCBTdHJpbmc4KHBhcmFtKSk7Ci0gICAgICAgICAgICAgICAgICAgIGZyZWUocGFyYW0pOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB1cGRhdGVBdWRpb1Byb2ZpbGVzKGRldmljZSwgb3V0cHV0LCBwcm9maWxlLT5nZXRBdWRpb1Byb2ZpbGVzKCkpOwotICAgICAgICAgICAgICAgIGlmICghcHJvZmlsZS0+aGFzVmFsaWRBdWRpb1Byb2ZpbGUoKSkgewotICAgICAgICAgICAgICAgICAgICBBTE9HVygiY2hlY2tPdXRwdXRzRm9yRGV2aWNlKCkgbWlzc2luZyBwYXJhbSIpOwotICAgICAgICAgICAgICAgICAgICBkZXNjLT5jbG9zZSgpOwotICAgICAgICAgICAgICAgICAgICBvdXRwdXQgPSBBVURJT19JT19IQU5ETEVfTk9ORTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHByb2ZpbGUtPmhhc0R5bmFtaWNBdWRpb1Byb2ZpbGUoKSkgewotICAgICAgICAgICAgICAgICAgICBkZXNjLT5jbG9zZSgpOwotICAgICAgICAgICAgICAgICAgICBvdXRwdXQgPSBBVURJT19JT19IQU5ETEVfTk9ORTsKLSAgICAgICAgICAgICAgICAgICAgYXVkaW9fY29uZmlnX3QgY29uZmlnID0gQVVESU9fQ09ORklHX0lOSVRJQUxJWkVSOwotICAgICAgICAgICAgICAgICAgICBwcm9maWxlLT5waWNrQXVkaW9Qcm9maWxlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5zYW1wbGVfcmF0ZSwgY29uZmlnLmNoYW5uZWxfbWFzaywgY29uZmlnLmZvcm1hdCk7Ci0gICAgICAgICAgICAgICAgICAgIGNvbmZpZy5vZmZsb2FkX2luZm8uc2FtcGxlX3JhdGUgPSBjb25maWcuc2FtcGxlX3JhdGU7Ci0gICAgICAgICAgICAgICAgICAgIGNvbmZpZy5vZmZsb2FkX2luZm8uY2hhbm5lbF9tYXNrID0gY29uZmlnLmNoYW5uZWxfbWFzazsKLSAgICAgICAgICAgICAgICAgICAgY29uZmlnLm9mZmxvYWRfaW5mby5mb3JtYXQgPSBjb25maWcuZm9ybWF0OwotCi0gICAgICAgICAgICAgICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGRlc2MtPm9wZW4oJmNvbmZpZywgRGV2aWNlVmVjdG9yKGRldmljZSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU1RSRUFNX0RFRkFVTFQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fT1VUUFVUX0ZMQUdfTk9ORSwgJm91dHB1dCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dCA9IEFVRElPX0lPX0hBTkRMRV9OT05FOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKG91dHB1dCAhPSBBVURJT19JT19IQU5ETEVfTk9ORSkgewotICAgICAgICAgICAgICAgICAgICBhZGRPdXRwdXQob3V0cHV0LCBkZXNjKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGF1ZGlvX2lzX3JlbW90ZV9zdWJtaXhfZGV2aWNlKGRldmljZVR5cGUpICYmIGFkZHJlc3MgIT0gIjAiKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzcDxBdWRpb1BvbGljeU1peD4gcG9saWN5TWl4OwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Qb2xpY3lNaXhlcy5nZXRBdWRpb1BvbGljeU1peChkZXZpY2VUeXBlLCBhZGRyZXNzLCBwb2xpY3lNaXgpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID09IE5PX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9saWN5TWl4LT5zZXRPdXRwdXQoZGVzYyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYy0+bVBvbGljeU1peCA9IHBvbGljeU1peDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coImNoZWNrT3V0cHV0c0ZvckRldmljZSgpIGNhbm5vdCBmaW5kIHBvbGljeSBmb3IgYWRkcmVzcyAlcyIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkcmVzcy5zdHJpbmcoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgoKGRlc2MtPm1GbGFncyAmIEFVRElPX09VVFBVVF9GTEFHX0RJUkVDVCkgPT0gMCkgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc1ByaW1hcnlPdXRwdXQoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gbm8gZHVwbGljYXRlZCBvdXRwdXQgZm9yIGRpcmVjdCBvdXRwdXRzIGFuZAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gb3V0cHV0cyB1c2VkIGJ5IGR5bmFtaWMgcG9saWN5IG1peGVzCi0gICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBkdXBsaWNhdGVkT3V0cHV0ID0gQVVESU9fSU9fSEFORExFX05PTkU7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vVE9ETzogY29uZmlndXJlIGF1ZGlvIGVmZmVjdCBvdXRwdXQgc3RhZ2UgaGVyZQotCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBvcGVuIGEgZHVwbGljYXRpbmcgb3V0cHV0IHRocmVhZCBmb3IgdGhlIG5ldyBvdXRwdXQgYW5kIHRoZSBwcmltYXJ5IG91dHB1dAotICAgICAgICAgICAgICAgICAgICAgICAgc3A8U3dBdWRpb091dHB1dERlc2NyaXB0b3I+IGR1cE91dHB1dERlc2MgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgU3dBdWRpb091dHB1dERlc2NyaXB0b3IoTlVMTCwgbXBDbGllbnRJbnRlcmZhY2UpOwotICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gZHVwT3V0cHV0RGVzYy0+b3BlbkR1cGxpY2F0aW5nKG1QcmltYXJ5T3V0cHV0LCBkZXNjLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZkdXBsaWNhdGVkT3V0cHV0KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBhZGQgZHVwbGljYXRlZCBvdXRwdXQgZGVzY3JpcHRvcgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZE91dHB1dChkdXBsaWNhdGVkT3V0cHV0LCBkdXBPdXRwdXREZXNjKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coImNoZWNrT3V0cHV0c0ZvckRldmljZSgpIGNvdWxkIG5vdCBvcGVuIGR1cCBvdXRwdXQgZm9yICVkIGFuZCAlZCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUHJpbWFyeU91dHB1dC0+bUlvSGFuZGxlLCBvdXRwdXQpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2MtPmNsb3NlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlT3V0cHV0KG91dHB1dCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dEF1ZGlvUG9ydEdlbmVyYXRpb24oKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXQgPSBBVURJT19JT19IQU5ETEVfTk9ORTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgb3V0cHV0ID0gQVVESU9fSU9fSEFORExFX05PTkU7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBkZXNjID0gb3Blbk91dHB1dFdpdGhQcm9maWxlQW5kRGV2aWNlKHByb2ZpbGUsIERldmljZVZlY3RvcihkZXZpY2UpKTsKKyAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90IG91dHB1dCA9IGRlc2MgPT0gbnVsbHB0ciA/IEFVRElPX0lPX0hBTkRMRV9OT05FIDogZGVzYy0+bUlvSGFuZGxlOwogICAgICAgICAgICAgaWYgKG91dHB1dCA9PSBBVURJT19JT19IQU5ETEVfTk9ORSkgewogICAgICAgICAgICAgICAgIEFMT0dXKCJjaGVja091dHB1dHNGb3JEZXZpY2UoKSBjb3VsZCBub3Qgb3BlbiBvdXRwdXQgZm9yIGRldmljZSAleCIsIGRldmljZVR5cGUpOwogICAgICAgICAgICAgICAgIHByb2ZpbGVzLnJlbW92ZUF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ICAgICAgICAgb3V0cHV0cy5hZGQobU91dHB1dHMua2V5QXQoaSkpOwogICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIW1BdmFpbGFibGVPdXRwdXREZXZpY2VzLmNvbnRhaW5zQXRMZWFzdE9uZShkZXNjLT5zdXBwb3J0ZWREZXZpY2VzKCkpKSB7CiAgICAgICAgICAgICAgICAgICAgIEFMT0dWKCJjaGVja091dHB1dHNGb3JEZXZpY2UoKTogZGlzY29ubmVjdGluZyBhZGRpbmcgb3V0cHV0ICVkIiwKQEAgLTQ5NDgsMTEgKzUyMzIsMzAgQEAKICAgICAgICAgZm9yIChjb25zdCBhdXRvJiBod01vZHVsZSA6IG1Id01vZHVsZXMpIHsKICAgICAgICAgICAgIGZvciAoc2l6ZV90IGogPSAwOyBqIDwgaHdNb2R1bGUtPmdldE91dHB1dFByb2ZpbGVzKCkuc2l6ZSgpOyBqKyspIHsKICAgICAgICAgICAgICAgICBzcDxJT1Byb2ZpbGU+IHByb2ZpbGUgPSBod01vZHVsZS0+Z2V0T3V0cHV0UHJvZmlsZXMoKVtqXTsKLSAgICAgICAgICAgICAgICBpZiAocHJvZmlsZS0+c3VwcG9ydHNEZXZpY2UoZGV2aWNlKSkgewotICAgICAgICAgICAgICAgICAgICBBTE9HVigiY2hlY2tPdXRwdXRzRm9yRGV2aWNlKCk6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY2xlYXJpbmcgZGlyZWN0IG91dHB1dCBwcm9maWxlICV6dSBvbiBtb2R1bGUgJXMiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGosIGh3TW9kdWxlLT5nZXROYW1lKCkpOwotICAgICAgICAgICAgICAgICAgICBwcm9maWxlLT5jbGVhckF1ZGlvUHJvZmlsZXMoKTsKKyAgICAgICAgICAgICAgICBpZiAoIXByb2ZpbGUtPnN1cHBvcnRzRGV2aWNlKGRldmljZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIEFMT0dWKCJjaGVja091dHB1dHNGb3JEZXZpY2UoKTogIgorICAgICAgICAgICAgICAgICAgICAgICAgImNsZWFyaW5nIGRpcmVjdCBvdXRwdXQgcHJvZmlsZSAlenUgb24gbW9kdWxlICVzIiwKKyAgICAgICAgICAgICAgICAgICAgICAgIGosIGh3TW9kdWxlLT5nZXROYW1lKCkpOworICAgICAgICAgICAgICAgIHByb2ZpbGUtPmNsZWFyQXVkaW9Qcm9maWxlcygpOworICAgICAgICAgICAgICAgIGlmICghcHJvZmlsZS0+aGFzRHluYW1pY0F1ZGlvUHJvZmlsZSgpKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvLyBXaGVuIGEgZGV2aWNlIGlzIGRpc2Nvbm5lY3RlZCwgaWYgdGhlcmUgaXMgYW4gSU9Qcm9maWxlIHRoYXQgY29udGFpbnMgZHluYW1pYworICAgICAgICAgICAgICAgIC8vIHByb2ZpbGVzIGFuZCBzdXBwb3J0cyB0aGUgZGlzY29ubmVjdGVkIGRldmljZSwgY2FsbCBnZXRBdWRpb1BvcnQgdG8gcmVwb3B1bGF0ZQorICAgICAgICAgICAgICAgIC8vIHRoZSBjYXBhYmlsaXRpZXMgb2YgdGhlIGRldmljZXMgdGhhdCBpcyBzdXBwb3J0ZWQgYnkgdGhlIElPUHJvZmlsZS4KKyAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGF1dG8mIHN1cHBvcnRlZERldmljZSA6IHByb2ZpbGUtPmdldFN1cHBvcnRlZERldmljZXMoKSkgeworICAgICAgICAgICAgICAgICAgICBpZiAoc3VwcG9ydGVkRGV2aWNlID09IGRldmljZSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICFtQXZhaWxhYmxlT3V0cHV0RGV2aWNlcy5jb250YWlucyhzdXBwb3J0ZWREZXZpY2UpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QgYXVkaW9fcG9ydF92NyBwb3J0OworICAgICAgICAgICAgICAgICAgICBzdXBwb3J0ZWREZXZpY2UtPnRvQXVkaW9Qb3J0KCZwb3J0KTsKKyAgICAgICAgICAgICAgICAgICAgc3RhdHVzX3Qgc3RhdHVzID0gbXBDbGllbnRJbnRlcmZhY2UtPmdldEF1ZGlvUG9ydCgmcG9ydCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gTk9fRVJST1IpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN1cHBvcnRlZERldmljZS0+aW1wb3J0QXVkaW9Qb3J0KHBvcnQpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9CkBAIC01MTU0LDggKzU0NTcsMTMgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICBpZiAoIWRpcmVjdE91dHB1dE9wZW4pIHsKLSAgICAgICAgICAgIEFMT0dWKCJubyBkaXJlY3Qgb3V0cHV0cyBvcGVuLCByZXNldCBNU0QgcGF0Y2giKTsKLSAgICAgICAgICAgIHNldE1zZFBhdGNoKCk7CisgICAgICAgICAgICBBTE9HVigibm8gZGlyZWN0IG91dHB1dHMgb3BlbiwgcmVzZXQgTVNEIHBhdGNoZXMiKTsKKyAgICAgICAgICAgIC8vIFRPRE86IFRoZSBNU0QgcGF0Y2hlcyB0byBiZSBlc3RhYmxpc2hlZCBoZXJlIG1heSBkaWZmZXIgdG8gY3VycmVudCBNU0QgcGF0Y2hlcyBkdWUgdG8KKyAgICAgICAgICAgIC8vIGhvdyBvdXRwdXQgZGV2aWNlcyBmb3IgcGF0Y2hpbmcgYXJlIHJlc29sdmVkLiBBdm9pZCBieSBjYWNoaW5nIGFuZCByZXVzaW5nIHRoZQorICAgICAgICAgICAgLy8gYXJndW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mdldFByb2R1Y3RTdHJhdGVneUZvckF0dHJpYnV0ZXMoYXR0cik7CkBAIC01MjYyLDcgKzU2MDEsNyBAQAogICAgICAgICAgICAgaWYgKHN0YXR1cyAhPSBPSykgewogICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKGNsaWVudC0+Z2V0UHJpbWFyeU1peCgpICE9IHByaW1hcnlNaXgpIHsKKyAgICAgICAgICAgIGlmIChjbGllbnQtPmdldFByaW1hcnlNaXgoKSAhPSBwcmltYXJ5TWl4IHx8IGNsaWVudC0+aGFzTG9zdFByaW1hcnlNaXgoKSkgewogICAgICAgICAgICAgICAgIGludmFsaWRhdGUgPSB0cnVlOwogICAgICAgICAgICAgICAgIGlmIChkZXNjLT5pc1N0cmF0ZWd5QWN0aXZlKHBzSWQpKSB7CiAgICAgICAgICAgICAgICAgICAgIG1heExhdGVuY3kgPSBkZXNjLT5sYXRlbmN5KCk7CkBAIC01MjkzLDcgKzU2MzIsOCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50LT5mbGFncygpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50LT5jb25maWcoKS5mb3JtYXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnQtPmNvbmZpZygpLmNoYW5uZWxfbWFzaywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudC0+Y29uZmlnKCkuc2FtcGxlX3JhdGUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50LT5jb25maWcoKS5zYW1wbGVfcmF0ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudC0+c2Vzc2lvbigpKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKG5ld091dHB1dCAhPSBzcmNPdXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CkBAIC01MzI4LDcgKzU2NjgsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdEZXZpY2VzLnR5cGVzKCkpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgc3A8U291cmNlQ2xpZW50RGVzY3JpcHRvcj4gc291cmNlID0gZ2V0U291cmNlRm9yQXR0cmlidXRlc09uT3V0cHV0KHNyY091dCwgYXR0cik7Ci0gICAgICAgICAgICBpZiAoc291cmNlICE9IDApeworICAgICAgICAgICAgaWYgKHNvdXJjZSAhPSBudWxscHRyICYmICFpc0NhbGxSeEF1ZGlvU291cmNlKHNvdXJjZSkpIHsKICAgICAgICAgICAgICAgICBjb25uZWN0QXVkaW9Tb3VyY2Uoc291cmNlKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQpAQCAtNTM1MSwxMSArNTY5MSwxMyBAQAogICAgIGZvciAoY29uc3QgYXV0byAmc3RyYXRlZ3kgOiBtRW5naW5lLT5nZXRPcmRlcmVkUHJvZHVjdFN0cmF0ZWdpZXMoKSkgewogICAgICAgICBhdXRvIGF0dHJpYnV0ZXMgPSBtRW5naW5lLT5nZXRBbGxBdHRyaWJ1dGVzRm9yUHJvZHVjdFN0cmF0ZWd5KHN0cmF0ZWd5KS5mcm9udCgpOwogICAgICAgICBjaGVja091dHB1dEZvckF0dHJpYnV0ZXMoYXR0cmlidXRlcyk7CisgICAgICAgIGNoZWNrQXVkaW9Tb3VyY2VGb3JBdHRyaWJ1dGVzKGF0dHJp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Q0VfT1VUX0hFQVJJTkdfQUlELAorICAgICAgICAgICAgIEFVRElPX0RFVklDRV9PVVRfQkxFX0hFQURTRVR9KS5lbXB0eSgpICYmCiAgICAgICAgICAgICAoKHZvbHVtZVNvdXJjZSA9PSBhbGFybVZvbHVtZVNyYyB8fAogICAgICAgICAgICAgICB2b2x1bWVTb3VyY2UgPT0gcmluZ1ZvbHVtZVNyYykgfHwKICAgICAgICAgICAgICAodm9sdW1lU291cmNlID09IHRvVm9sdW1lU291cmNlKEFVRElPX1NUUkVBTV9OT1RJRklDQVRJT04pKSB8fApAQCAtNjA2NCw4ICs2NDU1LDkgQEAKICAgICAgICAgICAgICAgICB2b2x1bWVEYiA9IG1pblZvbERiOwogICAgICAgICAgICAgICAgIEFMT0dWKCJjb21wdXRlVm9sdW1lIGxpbWl0aW5nIHZvbHVtZSB0byAlZiBtdXNpY1ZvbCAlZiIsIG1pblZvbERiLCBtdXNpY1ZvbERiKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghSW50ZXJzZWN0aW9uKGRldmljZVR5cGVzLCB7QVVESU9fREVWSUNFX09VVF9CTFVFVE9PVEhfQTJEUCwKLSAgICAgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX09VVF9CTFVFVE9PVEhfQTJEUF9IRUFEUEhPTkVTfSkuZW1wdHkoKSkgeworICAgICAgICAgICAgaWYgKFZvbHVtZTo6Z2V0RGV2aWNlRm9yVm9sdW1lKGRldmljZVR5cGVzKSAhPSBBVURJT19ERVZJQ0VfT1VUX1NQRUFLRVIKKyAgICAgICAgICAgICAgICAgICAgJiYgICFJbnRlcnNlY3Rpb24oZGV2aWNlVHlwZXMsIHtBVURJT19ERVZJQ0VfT1VUX0JMVUVUT09USF9BMkRQLAorICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fREVWSUNFX09VVF9CTFVFVE9PVEhfQTJEUF9IRUFEUEhPTkVTfSkuZW1wdHkoKSkgewogICAgICAgICAgICAgICAgIC8vIG9uI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y2hEZXNjLT5tUGF0Y2guc2lua3Nbal07CiAgICAgICAgICAgICBpZiAoc2luay0+dHlwZSA9PSBBVURJT19QT1JUX1RZUEVfREVWSUNFICYmCi0gICAgICAgICAgICAgICAgICAgIHNpbmstPmV4dC5kZXZpY2UudHlwZSA9PSBkZXZpY2VEZXNjLT50eXBlKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgc2luay0+ZXh0LmRldmljZS50eXBlID09IGRldmljZURlc2MtPnR5cGUoKSAmJgorICAgICAgICAgICAgICAgICAgICAoc3RybmxlbihhZGRyZXNzLCBBVURJT19ERVZJQ0VfTUFYX0FERFJFU1NfTEVOKSA9PSAwCisgICAgICAgICAgICAgICAgICAgICB8fCBzdHJuY21wKHNpbmstPmV4dC5kZXZpY2UuYWRkcmVzcywgYWRkcmVzcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX0RFVklDRV9NQVhfQUREUkVTU19MRU4pID09IDApKSB7CiAgICAgICAgICAgICAgICAgcmVsZWFzZSA9IHRydWU7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KQEAgLTY0MDYsNyArNjgwNCw3IEBACiAgICAgICAgIGZvciAoYXV0byBpdCA9IGNoYW5uZWxNYXNrcy5iZWdpbigpOyBpdCAhPSBjaGFubmVsTWFza3MuZW5kKCk7KSB7CiAgICAgICAgICAgICBhdWRpb19jaGFubmVsX21hc2tfdCBjaGFubmVsTWFzayA9ICppdDsKICAgICAgICAgICAgIGlmIChjaGFubmVsTWFzayAmIH5BVURJT19DSEFOTkVMX09VVF9TVEVSRU8pIHsKLSAgICAgICAgICAgICAgICBBTE9HSSgiJXM6IGZvcmNlIE5FVkVSLCBzbyByZW1vdmUgY2hhbm5lbE1hc2sgMHglMDh4IiwgX19GVU5DVElPTl9fLCBjaGFubmVsTWFzayk7CisgICAgICAgICAgICAgICAgQUxPR1YoIiVzOiBmb3JjZSBORVZFUiwgc28gcmVtb3ZlIGNoYW5uZWxNYXNrIDB4JTA4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HB1dCBmb3IgZGlyZWN0IG91dHB1dHMgYW5kCisgICAgICAgIC8vIG91dHB1dHMgdXNlZCBieSBkeW5hbWljIHBvbGljeSBtaXhlcworICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBkdXBsaWNhdGVkT3V0cHV0ID0gQVVESU9fSU9fSEFORExFX05PTkU7CisKKyAgICAgICAgLy9UT0RPOiBjb25maWd1cmUgYXVkaW8gZWZmZWN0IG91dHB1dCBzdGFnZSBoZXJlCisKKyAgICAgICAgLy8gb3BlbiBhIGR1cGxpY2F0aW5nIG91dHB1dCB0aHJlYWQgZm9yIHRoZSBuZXcgb3V0cHV0IGFuZCB0aGUgcHJpbWFyeSBvdXRwdXQKKyAgICAgICAgc3A8U3dBdWRpb091dHB1dERlc2NyaXB0b3I+IGR1cE91dHB1dERlc2MgPQorICAgICAgICAgICAgICAgIG5ldyBTd0F1ZGlvT3V0cHV0RGVzY3JpcHRvcihudWxscHRyLCBtcENsaWVudEludGVyZmFjZSk7CisgICAgICAgIHN0YXR1cyA9IGR1cE91dHB1dERlc2MtPm9wZW5EdXBsaWNhdGluZyhtUHJpbWFyeU91dHB1dCwgZGVzYywgJmR1cGxpY2F0ZWRPdXRwdXQpOworICAgICAgICBpZiAoc3RhdHVzID09IE5PX0VSUk9SKSB7CisgICAgICAgICAgICAvLyBhZGQgZHVwbGljYXRlZCBvdXRwdXQgZGVzY3JpcHRvcgorICAgICAgICAgICAgYWRkT3V0cHV0KGR1cGxpY2F0ZWRPdXRwdXQsIGR1cE91dHB1dERlc2MpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgQUxPR1coImNoZWNrT3V0cHV0c0ZvckRldmljZSgpIGNvdWxkIG5vdCBvcGVuIGR1cCBvdXRwdXQgZm9yICVkIGFuZCAlZCIsCisgICAgICAgICAgICAgICAgICBtUHJpbWFyeU91dHB1dC0+bUlvSGFuZGxlLCBvdXRwdXQpOworICAgICAgICAgICAgZGVzYy0+Y2xvc2UoKTsKKyAgICAgIC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WF0aW9uIGFwcGxpZWQgdG8gU1RSQVRFR1lfU09OSUZJQ0FUSU9OIHN0cmVhbXMgd2hlbiBhIGhlYWRzZXQgaXMgY29ubmVjdGVkOiA2ZEIKQEAgLTExNiw3ICsxMTgsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICpvdXRwdXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc3RyZWFtX3R5cGVfdCAqc3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlJiBhdHRyaWJ1dGlvblNvdXJjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdWRpb19jb25maWdfdCAqY29uZmlnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190ICpmbGFncywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90ICpzZWxlY3RlZERldmljZUlkLApAQCAtMTI1LDEyICsxMjcsMTIgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRfdHlwZV90ICpvdXRwdXRUeXBlKSBvdmVycmlkZTsKICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBzdGFydE91dHB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCk7CiAgICAgICAgIHZpcnR1YWwgc3RhdHVzX3Qgc3RvcE91dHB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCk7Ci0gICAgICAgIHZpcnR1YWwgdm9pZCByZWxlYXNlT3V0cHV0KGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkKTsKKyAgICAgICAgdmlydHVhbCBib29sIHJlbGVhc2VPdXRwdXQoYXVkaW9fcG9ydF9oYW5kbGVfdCBwb3J0SWQpOwogICAgICAgICB2aXJ0dWFsIHN0YXR1c190IGdldElucHV0Rm9yQXR0cihjb25zdCBhdWRpb19hdHRyaWJ1dGVzX3QgKmF0dHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICppbnB1dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fdW5pcXVlX2lkX3QgcmlpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgYXR0cmlidXRpb25Tb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2NvbmZpZ19iYXNlX3QgKmNvbmZpZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW5wdXRfZmxhZ3NfdCBmbGFncywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqc2VsZWN0ZWREZXZpY2VJZCwKQEAgLTE4MCw3ICsxODIsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBEZXZpY2VUeXBlU2V0JiBkZXZpY2VUeXBlcykgY29uc3Q7CiAKICAgICAgICAgLy8gcmV0dXJuIHRoZSBzdHJhdGVneSBjb3JyZXNwb25kaW5nIHRvIGEgZ2l2ZW4gc3RyZWFtIHR5cGUKLSAgICAgICAgdmlydHVhbCB1aW50MzJfdCBnZXRTdHJhdGVneUZvclN0cmVhbShhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSkKKyAgICAgICAgdmlydHVhbCBwcm9kdWN0X3N0cmF0ZWd5X3QgZ2V0U3RyYXRlZ3lGb3JTdHJlYW0oYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0pCiAgICAgICAgIHsKICAgICAgICAgICAgIHJldHVybiBzdHJlYW1Ub1N0cmF0ZWd5KHN0cmVhbSk7CiAgICAgICAgIH0KQEAgLTIwMCw3ICsyMDIsNyBAQAogICAgICAgICB2aXJ0dWFsIGF1ZGlvX2lvX2hhbmRsZV90IGdldE91dHB1dEZvckVmZmVjdChjb25zdCBlZmZlY3RfZGVzY3JpcHRvcl90ICpkZXNjID0gTlVMTCk7CiAgICAgICAgIHZpcnR1YWwgc3RhdHVzX3QgcmVnaXN0ZXJFZmZlY3QoY29uc3QgZWZmZWN0X2Rlc2NyaXB0b3JfdCAqZGVzYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19pb19oYW5kbGVfdCBpbywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBzdHJhdGVneSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kdWN0X3N0cmF0ZWd5X3Qgc3RyYXRlZ3ksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNlc3Npb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGlkKTsKICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCB1bnJlZ2lzdGVyRWZmZWN0KGludCBpZCk7CkBAIC0yMjUsNyArMjI3LDcgQEAKICAgICAgICAgc3RhdHVzX3QgZHVtcChpbnQgZmQpIG92ZXJyaWRlOwogCiAgICAgICAgIHN0YXR1c190IHNldEFsbG93ZWRDYXB0dXJlUG9saWN5KHVpZF90IHVpZCwgYXVkaW9fZmxhZ3NfbWFza190IGNhcHR1cmVQb2xpY3kpIG92ZXJyaWRlOwotICAgICAgICB2aXJ0dWFsIGJvb2wgaXNPZmZsb2FkU3VwcG9ydGVkKGNvbnN0IGF1ZGlvX29mZmxvYWRfaW5mb190JiBvZmZsb2FkSW5mbyk7CisgICAgICAgIHZpcnR1YWwgYXVkaW9fb2ZmbG9hZF9tb2RlX3QgZ2V0T2ZmbG9hZFN1cHBvcnQoY29uc3QgYXVkaW9fb2ZmbG9hZF9pbmZvX3QmIG9mZmxvYWRJbmZvKTsKIAogICAgICAgICB2aXJ0dWFsIGJvb2wgaXNEaXJlY3RPdXRwdXRTdXBwb3J0ZWQoY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCYgY29uZmlnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fYXR0cmlidXRlc190JiBhdHRyaWJ1dGVzKTsKQEAgLTIzMyw5ICsyMzUsOSBAQAogICAgICAgICB2aXJ0dWFsIHN0YXR1c190IGxpc3RBdWRpb1BvcnRzKGF1ZGlvX3BvcnRfcm9sZV90IHJvbGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF90eXBlX3QgdHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBpbnQgKm51bV9wb3J0cywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QgYXVkaW9fcG9ydCAqcG9ydHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0IGF1ZGlvX3BvcnRfdjcgKnBvcnRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH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ZmaW5pdGllcyhpbnQgdXNlcklkLAotICAgICAgICAgICAgICAgIGNvbnN0IFZlY3RvcjxBdWRpb0RldmljZVR5cGVBZGRyPiYgZGV2aWNlcyk7CisgICAgICAgICAgICAgICAgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciYgZGV2aWNlcyk7CiAgICAgICAgIHZpcnR1YWwgc3RhdHVzX3QgcmVtb3ZlVXNlcklkRGV2aWNlQWZmaW5pdGllcyhpbnQgdXNlcklkKTsKIAotICAgICAgICB2aXJ0dWFsIHN0YXR1c190IHNldFByZWZlcnJlZERldmljZUZvclN0cmF0ZWd5KHByb2R1Y3Rfc3RyYXRlZ3lfdCBzdHJhdGVneSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF1ZGlvRGV2aWNlVHlwZUFkZHIgJmRldmljZSk7Ci0gICAgICAgIHZpcnR1YWwgc3RhdHVzX3QgcmVtb3ZlUHJlZmVycmVkRGV2aWNlRm9yU3RyYXRlZ3kocHJvZHVjdF9zdHJhdGVneV90IHN0cmF0ZWd5KTsKLSAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBnZXRQcmVmZXJyZWREZXZpY2VGb3JTdHJhdGVneShwcm9kdWN0X3N0cmF0ZWd5X3Qgc3RyYXRlZ3ksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBdWRpb0RldmljZVR5cGVBZGRyICZkZXZpY2UpOworICAgICAgICB2aXJ0dWFsIHN0YXR1c190IHNldERldmljZXNSb2xlRm9yU3RyYXRlZ3kocHJvZHVjdF9zdHJhdGVneV90IHN0cmF0ZWd5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlX3JvbGVfdCByb2xlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciAmZGV2aWNlcyk7CisKKyAgICAgICAgdmlydHVhbCBzdGF0dXNfdCByZW1vdmVEZXZpY2VzUm9sZUZvclN0cmF0ZWd5KHByb2R1Y3Rfc3RyYXRlZ3lfdCBzdHJhdGVneSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZV9yb2xlX3Qgcm9sZSk7CisKKworICAgICAgICB2aXJ0dWFsIHN0YXR1c190IGdldERldmljZXNGb3JSb2xlQW5kU3RyYXRlZ3kocHJvZHVjdF9zdHJhdGVneV90IHN0cmF0ZWd5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlX3JvbGVfdCByb2xlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciAmZGV2aWNlcyk7CisKKyAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBzZXREZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXQoYXVkaW9fc291cmNlX3QgYXVkaW9Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZV9yb2xlX3Qgcm9sZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciAmZGV2aWNlcyk7CisKKyAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBhZGREZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXQoYXVkaW9fc291cmNlX3QgYXVkaW9Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZV9yb2xlX3Qgcm9sZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciAmZGV2aWNlcyk7CisKKyAgICAgICAgdmlydHVhbCBzdGF0dXNfdCByZW1vdmVEZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXQoCisgICAgICAgICAgICAgICAgYXVkaW9fc291cmNlX3QgYXVkaW9Tb3VyY2UsIGRldmljZV9yb2xlX3Qgcm9sZSwKKyAgICAgICAgICAgICAgICBjb25zdCBBdWRpb0RldmljZVR5cGVBZGRyVmVjdG9yJiBkZXZpY2VzKTsKKworICAgICAgICB2aXJ0dWFsIHN0YXR1c190IGNsZWFyRGV2aWNlc1JvbGVGb3JDYXB0dXJlUHJlc2V0KGF1ZGlvX3NvdXJjZV90IGF1ZGlvU291cmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZV9yb2xlX3Qgcm9sZSk7CisKKyAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBnZXREZXZpY2VzRm9yUm9sZUFuZENhcHR1cmVQcmVzZXQoYXVkaW9fc291cmNlX3QgYXVkaW9Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZV9yb2xlX3Qgcm9sZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXVkaW9EZXZpY2VUeXBlQWRkclZlY3RvciAmZGV2aWNlcyk7CiAKICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBzdGFydEF1ZGlvU291cmNlKGNvbnN0IHN0cnVjdCBhdWRpb19wb3J0X2NvbmZpZyAqc291cmNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fYXR0cmlidXRlc190ICphdHRyaWJ1dGVzLApAQCAtMjg4LDggKzMxNSw5IEBACiAKICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBnZXRTdXJyb3VuZEZvcm1hdHModW5zaWduZWQgaW50ICpudW1TdXJyb3VuZEZvcm1hdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1hdF90ICpzdXJyb3VuZEZvcm1hdHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgKnN1cnJvdW5kRm9ybWF0c0VuYWJsZWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcmVwb3J0ZWQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sICpzdXJyb3VuZEZvcm1hdHNFbmFibGVkKTsKKyAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBnZXRSZXBvcnRlZFN1cnJvdW5kRm9ybWF0cyh1bnNpZ25lZCBpbnQgKm51bVN1cnJvdW5kRm9ybWF0cywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19mb3JtYXRfdCAqc3Vycm91bmRGb3JtYXRzKTsKICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBzZXRTdXJyb3VuZEZvcm1hdEVuYWJsZWQoYXVkaW9fZm9ybWF0X3QgYXVkaW9Gb3JtYXQsIGJvb2wgZW5hYmxlZCk7CiAKICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBnZXRId09mZmxvYWRFbmNvZGluZ0Zvcm1hdHNTdXBwb3J0ZWRGb3JBMkRQKApAQCAtMzA0LDExICszMzIsMTQgQEAKICAgICAgICAgICAgIHJldHVybiBtRW5naW5lLT5saXN0QXVkaW9Qcm9kdWN0U3RyYXRlZ2llcyhzdHJhdGVnaWVzKTsKICAgICAgICAgfQogCi0gICAgICAgIHZpcnR1YWwgc3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Um91dGluZyhjb25zdCBhdWRpb19hdHRyaWJ1dGVzX3QgJmxBdHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdWRpb19hdHRyaWJ1dGVzX3QgJnJBdHRyKSBjb25zdDsKIApAQCAtNjA4LDcgKzY2NSw4IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19vdXRwdXRfZmxhZ3NfdCBmbGFncyA9IEFVRElPX09VVFBVVF9GTEFHX05PTkUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19mb3JtYXRfdCBmb3JtYXQgPSBBVURJT19GT1JNQVRfSU5WQUxJRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2NoYW5uZWxfbWFza190IGNoYW5uZWxNYXNrID0gQVVESU9fQ0hBTk5FTF9OT05FLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3Qgc2FtcGxpbmdSYXRlID0gMCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBzYW1wbGluZ1JhdGUgPSAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc2Vzc2lvbl90IHNlc3Npb25JZCA9IEFVRElPX1NFU1NJT05fTk9ORSk7CiAgICAgICAgIC8vIHNhbXBsaW5nUmF0ZSwgZm9ybWF0LCBjaGFubmVsTWFzayBhcmUgaW4vb3V0IGFuZCBzbyBtYXkgYmUgbW9kaWZpZWQKICAgICAgICAgc3A8SU9Qcm9maWxlPiBnZXRJbnB1dFByb2ZpbGUoY29uc3Qgc3A8RGV2aWNlRGVzY3JpcHRvcj4gJiBkZXZpY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90JiBzYW1wbGluZ1JhdGUsCkBAIC02ODAsOSArNzM4LDIyIEBACiAgICAgICAgICAgICAgICAgICAgIFN0cmluZzgoZGV2aWNlcy5pdGVtQXQoMCktPmFkZHJlc3MoKS5jX3N0cigpKSA6IFN0cmluZzgoIiIpOwogICAgICAgICB9CiAKLSAgICAgICAgdWludDMyX3QgdXBkYXRlQ2FsbFJvdXRpbmcoY29uc3QgRGV2aWNlVmVjdG9yICZyeERldmljZXMsIHVpbnQzMl90IGRlbGF5TXMgPSAwKTsKKyAgICAgICAgc3RhdHVzX3QgdXBkYXRlQ2FsbFJvdXRpbmcoCisgICAgICAgICAgICAgICAgYm9vbCBmcm9tQ2FjaGUsIHVpbnQzMl90IGRlbGF5TXMgPSAwLCB1aW50MzJfdCAqd2FpdE1zID0gbnVsbHB0cik7CisgICAgICAgIHN0YXR1c190IHVwZGF0ZUNhbGxSb3V0aW5nSW50ZXJuYWwoCisgICAgICAgICAgICAgICAgY29uc3QgRGV2aWNlVmVjdG9yICZyeERldmljZXMsIHVpbnQzMl90IGRlbGF5TXMsIHVpbnQzMl90ICp3YWl0TXMpOwogICAgICAgICBzcDxBdWRpb1BhdGNoPiBjcmVhdGVUZWxlcGhvbnlQYXRjaChib29sIGlzUngsIGNvbnN0IHNwPERldmljZURlc2NyaXB0b3I+ICZkZXZpY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGRlbGF5TXMpOworICAgICAgICAvKioKKyAgICAgICAgICogQGJyaWVmIHNlbGVjdEJlc3RSeFNpbmtEZXZpY2VzRm9yQ2FsbDogaWYgdGhlIHByaW1hcnkgbW9kdWxlIGhvc3QgYm90aCBUZWxlcGhvbnkgUngvVHgKKyAgICAgICAgICogZGV2aWNlcywgYW5kIGl0IGRlY2xhcmVzIGFsc28gc3VwcG9ydGluZyBhIEhXIGJyaWRnZSBiZXR3ZWVuIHRoZSBUZWxlcGhvbnkgUnggYW5kIHRoZQorICAgICAgICAgKiBnaXZlbiBzaW5rIGRldmljZSBmb3IgVm9pY2UgQ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EZXZpY2VEZXNjcmlwdG9yPiYgZGV2RGVzYywgYXVkaW9faW9faGFuZGxlX3QgaW9IYW5kbGUsCiAgICAgICAgICAgICAgICAgQXVkaW9Qcm9maWxlVmVjdG9yICZwcm9maWxlcyk7CkBAIC05MzgsMTAgKzEwMjgsMTcgQEAKICAgICAgICAgICAgICAgICBzcDxBdWRpb1BhdGNoPiAqcGF0Y2hEZXNjUHRyKTsKIAogICAgICAgICBib29sIGFyZUFsbERldmljZXNTdXBwb3J0ZWQoCi0gICAgICAgICAgICAgICAgY29uc3QgVmVjdG9yPEF1ZGlvRGV2aWNlVHlwZUFkZHI+JiBkZXZpY2VzLAorICAgICAgICAgICAgICAgIGNvbnN0IEF1ZGlvRGV2aWNlVHlwZUFkZHJWZWN0b3ImIGRldmljZXMsCiAgICAgICAgICAgICAgICAgc3RkOjpmdW5jdGlvbjxib29sKGF1ZGlvX2RldmljZXNfdCk+IHByZWRpY2F0ZSwKICAgICAgICAgICAgICAgICBjb25zdCBjaGFyKiBjb250ZXh0KTsKIAorICAgICAgICBib29sIGlzU2NvUmVxdWVzdGVkRm9yQ29tbSgpIGNvbnN0OworCisgICAgICAgIGJvb2wgYXJlQWxsQWN0aXZlVHJhY2tzUmVyb3V0ZWQoY29uc3Qgc3A8U3dBdWRpb091dHB1dERlc2NyaXB0b3I+JiBvdXRwdXQpOworCisgICAgICAgIHNwPFN3QXVkaW9PdXRwdXREZXNjcmlwdG9yPiBvcGVuT3V0cHV0V2l0aFByb2ZpbGVBbmREZXZpY2UoY29uc3Qgc3A8SU9Qcm9maWxlPiYgcHJvZmlsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBEZXZpY2VWZWN0b3ImIGRldmljZXMpOworCiB9OwogCiB9OwpkaWZmIC0tZ2l0IGEvc2VydmljZXMvYXVkaW9wb2xpY3kvc2VydmljZS9BbmRyb2lkLmJwIGIvc2VydmljZXMv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Rpb2ZsaW5nZXIiCisgICAgXSwKKworICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJhY3Rpdml0eW1hbmFnZXJfYWlkbCIsCisgICAgICAgICJsaWJhdWRpb2NsaWVudCIsCisgICAgICAgICJsaWJhdWRpb2NsaWVudF9haWRsX2NvbnZlcnNpb24iLAorICAgICAgICAibGliYXVkaW9mb3VuZGF0aW9uIiwKKyAgICAgICAgImxpYmF1ZGlvcG9saWN5IiwKKyAgICAgICAgImxpYmF1ZGlvcG9saWN5bWFuYWdlcmRlZmF1bHQiLAorICAgICAgICAibGliYXVkaW91dGlscyIsCisgICAgICAgICJsaWJiaW5kZXIiLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICAgICAgImxpYmVmZmVjdHNjb25maWciLAorICAgICAgICAibGliaGFyZHdhcmVfbGVnYWN5IiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgICAgICJsaWJtZWRpYV9oZWxwZXIiLAorICAgICAgICAibGlibWVkaWFtZXRyaWNzIiwKKyAgICAgICAgImxpYm1lZGlhdXRpbHMiLAorICAgICAgICAibGlicGVybWlzc2lvbiIsCisgICAgICAgICJsaWJzZW5zb3Jwcml2YWN5IiwKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICAgICAgImF1ZGlvY2xpZW50LXR5cGVzLWFpZGwtY3BwIiwKKyAgICAgICAgImF1ZGlvZmxpbmdlci1haWRsLWNwcCIsCisgICAgICAgICJhdWRpb3BvbGljeS1haWRsLWNwcCIsCisgICAgICAgICJhdWRpb3BvbGljeS10eXBlcy1haWRsLWNwcCIsCisgICAgICAgICJjYXB0dXJlX3N0YXRlX2xpc3RlbmVyLWFpZGwtY3BwIiwKKyAgICAgICAgImZyYW1ld29yay1wZXJtaXNzaW9uLWFpZGwtY3BwIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYmF1ZGlvcG9saWN5Y29tcG9uZW50cyIsCisgICAgICAgICJmcmFtZXdvc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ewotICAgICAgICAgICAgICAgIEFMT0dFKCJwZXJtaXNzaW9uIGRlbmllZDogbW9kaWZ5IGF1ZGlvIHJvdXRpbmcgbm90IGFsbG93ZWQgZm9yIHVpZCAlZCIsIHVpZCk7CisgICAgICAgICAgICBpZiAoIW1vZGlmeUF1ZGlvUm91dGluZ0FsbG93ZWQoYXR0cmlidXRpb25Tb3VyY2UpKSB7CisgICAgICAgICAgICAgICAgQUxPR0UoKCJwZXJtaXNzaW9uIGRlbmllZDogbW9kaWZ5IGF1ZGlvIHJvdXRpbmcgbm90IGFsbG93ZWQgIgorICAgICAgICAgICAgICAgICAgICAgICAiZm9yIGF0dHJpYnV0aW9uU291cmNlICVzIiksIGF0dHJpYnV0aW9uU291cmNlLnRvU3RyaW5nKCkuY19zdHIoKSk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIFBFUk1JU1NJT05fREVOSUVEOwogICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewpAQCAtNzQsNzEgKzk1LDk0IEBACiAgICAgbUF1ZGlvUG9saWN5TWFuYWdlci0+b25OZXdBdWRpb01vZHVsZXNBdmFpbGFibGUoKTsKIH0KIAotc3RhdHVzX3QgQXVkaW9Qb2xpY3lTZXJ2aWNlOjpzZXREZXZpY2VDb25uZWN0aW9uU3RhdGUoYXVkaW9fZGV2aWNlc190IGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9saWN5X2Rldl9zdGF0ZV90IHN0YXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqZGV2aWNlX25hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2Zvcm1h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OT19JTklUKTsKICAgICB9CiAgICAgaWYgKCFzZXR0aW5nc0FsbG93ZWQoKSkgewotICAgICAgICByZXR1cm4gUEVSTUlTU0lPTl9ERU5JRUQ7CisgICAgICAgIHJldHVybiBiaW5kZXJTdGF0dXNGcm9tU3RhdHVzVChQRVJNSVNTSU9OX0RFTklFRCk7CiAgICAgfQogICAgIGlmIChzdGF0ZSAhPSBBVURJT19QT0xJQ1lfREVWSUNFX1NUQVRFX0FWQUlMQUJMRSAmJgogICAgICAgICAgICAgc3RhdGUgIT0gQVVESU9fUE9MSUNZX0RFVklDRV9TVEFURV9VTkFWQUlMQUJMRSkgewotICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgICAgICByZXR1cm4gYmluZGVyU3RhdHVzRnJvbVN0YXR1c1QoQkFEX1ZBTFVFKTsKICAgICB9CiAKICAgICBBTE9HVigic2V0RGV2aWNlQ29ubmVjdGlvblN0YXRlKCkiKTsKICAgICBNdXRleDo6QXV0b2xvY2sgX2wobUxvY2spOwogICAgIEF1dG9DYWxsZXJDbGVhciBhY2M7Ci0gICAgcmV0dXJuIG1BdWRpb1BvbGljeU1hbmFnZXItPnNldERldmljZUNvbm5lY3Rpb25TdGF0ZShkZXZpY2UsIHN0YXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlX2FkZHJlc3MsIGRldmljZV9uYW1lLCBlbmNvZGVkRm9ybWF0KTsKKyAgICByZXR1cm4gYmluZGVyU3RhdHVzRnJvbVN0YXR1c1QoCisgICAgICAgICAgICBtQXVkaW9Qb2xpY3lNYW5hZ2VyLT5zZXREZXZpY2VDb25uZWN0aW9uU3RhdGUoZGV2aWNlLCBzdGF0ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2VBaWRsLmFkZHJlc3MuY19zdHIoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2VOYW1lQWlkbC5jX3N0cigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuY29kZWRGb3JtYXQpKTsKIH0KIAotYXVkaW9fcG9saWN5X2Rldl9zdGF0ZV90IEF1ZGlvUG9saWN5U2VydmljZTo6Z2V0RGV2aWNlQ29ubmVjdGlvblN0YXRlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19kZXZpY2VzX3QgZGV2aWNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcykKLXsKK1N0YXR1cyBBdWRpb1BvbGljeVNlcnZpY2U6OmdldERldmljZUNvbm5lY3Rpb25TdGF0ZShjb25zdCBtZWRpYTo6QXVkaW9EZXZpY2UmIGRldmljZUFpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWE6OkF1ZGlvUG9saWN5RGV2aWNlU3RhdGUqIF9haWRsX3JldHVybikgeworICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UgPSBWQUxVRV9PUl9SRVRVUk5fQklOREVSX1NUQVRVUygKKyAgICAgICAgICAgIGFpZGwybGVnYWN5X2ludDMyX3RfYXVkaW9fZGV2aWNlc190KGRldmljZUFpZGwudHlwZSkpOwogICAgIGlmIChtQXVkaW9Qb2xpY3lNYW5hZ2VyID09IE5VTEwpIHsKLSAgICAgICAgcmV0dXJuIEFVRElPX1BPTElDWV9ERVZJQ0VfU1RBVEVfVU5BVkFJTEFCTEU7CisgICAgICAgICpfYWlkbF9yZXR1cm4gPSBWQUxVRV9PUl9SRVRVUk5fQklOREVSX1NUQVRVUygKKyAgICAgICAgICAgICAgICBsZWdhY3kyYWlkbF9hdWRpb19wb2xpY3lfZGV2X3N0YXRlX3RfQXVkaW9Qb2xpY3lEZXZpY2VTdGF0ZSgKKyAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1BPTElDWV9ERVZJQ0VfU1RBVEVfVU5BVkFJTEFCTEUpKTsKKyAgICAgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKICAgICB9CiAgICAgQXV0b0NhbGxlckNsZWFyIGFjYzsKLSAgICByZXR1cm4gbUF1ZGlvUG9saWN5TWFuYWdlci0+Z2V0RGV2aWNlQ29ubmVjdGlvblN0YXRlKGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZV9hZGRyZXNzKTsKKyAgICAqX2FpZGxfcmV0dXJuID0gVkFMVUVfT1JfUkVUVVJOX0JJTkRFUl9TVEFUVVMoCisgICAgICAgICAgICBsZWdhY3kyYWlkbF9hdWRpb19wb2xpY3lfZGV2X3N0YXRlX3RfQXVkaW9Qb2xpY3lEZXZpY2VTdGF0ZSgKKyAgICAgICAgICAgICAgICAgICAgbUF1ZGlvUG9saWN5TWFuYWdlci0+Z2V0RGV2aWNlQ29ubmVjdGlvblN0YXRlKGRldmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZUFpZGwuYWRkcmVzcy5jX3N0cigpKSkpOworICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CiB9CiAKLXN0YXR1c190IEF1ZGlvUG9saWN5U2VydmljZTo6aGFuZGxlRGV2aWNlQ29uZmlnQ2hhbmdlKGF1ZGlvX2RldmljZXNfdCBkZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIgKmRldmljZV9hZGRyZXNzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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Qb2xpY3lNYW5hZ2VyID09IE5VTEwpIHsKLSAgICAgICAgcmV0dXJuIEFVRElPX0lPX0hBTkRMRV9OT05FOworICAgICAgICByZXR1cm4gYmluZGVyU3RhdHVzRnJvbVN0YXR1c1QoTk9fSU5JVCk7CiAgICAgfQogICAgIEFMT0dWKCJnZXRPdXRwdXQoKSIpOwogICAgIE11dGV4OjpBdXRvbG9jayBfbChtTG9jayk7CiAgICAgQXV0b0NhbGxlckNsZWFyIGFjYzsKLSAgICByZXR1cm4gbUF1ZGlvUG9saWN5TWFuYWdlci0+Z2V0T3V0cHV0KHN0cmVhbSk7CisgICAgKl9haWRsX3JldHVybiA9IFZBTFVFX09SX1JFVFVSTl9CSU5ERVJfU1RBVFVTKAorICAgICAgICAgICAgbGVnYWN5MmFpZGxfYXVkaW9faW9faGFuZGxlX3RfaW50MzJfdChtQXVkaW9Qb2xpY3lNYW5hZ2VyLT5nZXRPdXRwdXQoc3RyZWFtKSkpOworICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CiB9CiAKLXN0YXR1c190IEF1ZGlvUG9saWN5U2VydmljZTo6Z2V0T3V0cHV0Rm9yQXR0cihhdWRpb19hdHRyaWJ1dGVzX3QgKmF0dHIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgKm91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zdHJlYW1fdHlwZV90ICpzdHJlYW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdWRpb19jb25maWdfdCAqY29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190IGZsYWdzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnNlbGVjdGVkRGV2aWNlSWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqcG9ydElkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGF1ZGlvX2lvX2hhbmRsZV90PiAqc2Vjb25kYXJ5T3V0cHV0cykKK1N0YXR1cyBBdWRpb1BvbGljeVNlcnZpY2U6OmdldE91dHB1dEZvckF0dHIoY29uc3QgbWVkaWE6OkF1ZGlvQXR0cmlidXRlc0ludGVybmFsJiBhdHRyQWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBzZXNzaW9uQWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgYXR0cmlidXRpb25Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IG1lZGlhOjpBdWRpb0NvbmZpZyYgY29uZmlnQWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBmbGFnc0FpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3Qgc2VsZWN0ZWREZXZpY2VJZEFpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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KICAgICB9CiAgICAgQXV0b0NhbGxlckNsZWFyIGFjYzsKICAgICBBdWRpb1BvbGljeUludGVyZmFjZTo6b3V0cHV0X3R5cGVfdCBvdXRwdXRUeXBlOwotICAgIHJlc3VsdCA9IG1BdWRpb1BvbGljeU1hbmFnZXItPmdldE91dHB1dEZvckF0dHIoYXR0ciwgb3V0cHV0LCBzZXNzaW9uLCBzdHJlYW0sIHVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZsYWdzLCBzZWxlY3RlZERldmljZUlkLCBwb3J0SWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kYXJ5T3V0cHV0cywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmb3V0cHV0VHlwZSk7CisgICAgc3RhdHVzX3QgcmVzdWx0ID0gbUF1ZGlvUG9saWN5TWFuYWdlci0+Z2V0T3V0cHV0Rm9yQXR0cigmYXR0ciwgJm91dHB1dCwgc2Vzc2lvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzdHJlYW0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGpBdHRyaWJ1dGlvblNvdXJjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZjb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmxhZ3MsICZzZWxlY3RlZERldmljZUlkLCAmcG9ydElkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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YgKCFtb2RpZnlBdWRpb1JvdXRpbmdBbGxvd2VkKHBpZCwgdWlkKSkgeworICAgICAgICAgICAgaWYgKCFtb2RpZnlBdWRpb1JvdXRpbmdBbGxvd2VkKGFkakF0dHJpYnV0aW9uU291cmNlKSkgewogICAgICAgICAgICAgICAgIEFMT0dFKCIlcygpIHBlcm1pc3Npb24gZGVuaWVkOiBtb2RpZnkgYXVkaW8gcm91dGluZyBub3QgYWxsb3dlZCBmb3IgdWlkICVkIiwKLSAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sIHVpZCk7CisgICAgICAgICAgICAgICAgICAgIF9fZnVuY19fLCBhZGpBdHRyaWJ1dGlvblNvdXJjZS51aWQpOwogICAgICAgICAgICAgICAgIHJlc3VsdCA9IFBFUk1JU1NJT05fREVOSUVEOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7CkBAIC0yODYsMTEgKzM3MSwyNCBAQAogICAgIH0KIAogICAgIGlmIChyZXN1bHQgPT0gTk9fRVJST1IpIHsKLSAgICAgICAgc3AgPEF1ZGlvUGxheWJhY2tDbGllbnQ+IGNsaWVudCA9Ci0gICAgICAgICAgICBuZXcgQXVkaW9QbGF5YmFja0NsaWVudCgqYXR0ciwgKm91dHB1dCwgdWlkLCBwaWQsIHNlc3Npb24sICpwb3J0SWQsICpzZWxlY3RlZERldmljZUlkLCAqc3RyZWFtKTsKLSAgICAgICAgbUF1ZGlvUGxheWJhY2tDbGllbnRzLmFkZCgqcG9ydElkLCBjbGllbnQpOworICAgICAgICBzcDxBdWRpb1BsYXliYWNrQ2xpZW50PiBjbGllbnQgPQorICAgICAgICAgICAgICAgIG5ldyBBdWRpb1BsYXliYWNrQ2xpZW50KGF0dHIsIG91dHB1dCwgYWRqQXR0cmlidXRpb25Tb3VyY2UsIHNlc3Npb24sCisgICAgICAgICAgICAgICAgICAgIHBvcnRJZCwgc2VsZWN0ZWREZXZpY2VJZCwgc3RyZWFtKTsKKyAgICAgICAgbUF1ZGlvUGx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AgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFN0cmluZzE2JiBvcFBhY2thZ2VOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqY29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW5wdXRfZmxhZ3NfdCBmbGFncywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnNlbGVjdGVkRGV2aWNlSWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wb3J0X2hhbmRsZV90ICpwb3J0SWQpCi17CitTdGF0dXMgQXVkaW9Qb2xpY3lTZXJ2aWNlOjpnZXRJbnB1dEZvckF0dHIoY29uc3QgbWVkaWE6OkF1ZGlvQXR0cmlidXRlc0ludGVybmFsJiBhdHRyQWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IGlucHV0QWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHJpaWRBaWRsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3Qgc2Vzc2lvbkFpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSYgYXR0cmlidXRpb25Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgbWVkaWE6OkF1ZGlvQ29uZmlnQmFzZSYgY29uZmlnQWlkbCwKKyAgICAg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wYXJhbWV0ZXIgaXMgaWdub3JlZCBieSBnZXRfaW5wdXQoKQotICAgICAgICAgICAgc3RhdHVzID0gbUF1ZGlvUG9saWN5TWFuYWdlci0+Z2V0SW5wdXRGb3JBdHRyKGF0dHIsIGlucHV0LCByaWlkLCBzZXNzaW9uLCB1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFncywgc2VsZWN0ZWREZXZpY2VJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZpbnB1dFR5cGUsIHBvcnRJZCk7CisgICAgICAgICAgICBzdGF0dXMgPSBtQXVkaW9Qb2xpY3lNYW5hZ2VyLT5nZXRJbnB1dEZvckF0dHIoJmF0dHIsICZpbnB1dCwgcmlpZCwgc2Vzc2lvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGpBdHRyaWJ1dGlvblNvdXJjZSwgJmNvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFncywgJnNlbGVjdGVkRGV2aWNlSWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmlucHV0VHlwZSwgJnBvcnRJZCk7CisKICAgICAgICAgfQogICAgICAgICBhdWRpb1BvbGljeUVmZmVjdHMgPSBtQXVkaW9Qb2xpY3lFZmZlY3RzOwogCkBAIC01MDksNyArNjUyLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIEF1ZGlvUG9saWN5SW50ZXJmYWNlOjpBUElfSU5QVVRfTUlYX0VYVF9QT0xJQ1lfUkVST1VURToKLSAgICAgICAgICAgICAgICBpZiAoIW1vZGlmeUF1ZGlvUm91dGluZ0FsbG93ZWQocGlkLCB1aWQpKSB7CisgICAgICAgICAgICAgICAgaWYgKCFtb2RpZnlBdWRpb1JvdXRpbmdBbGxvd2VkKGFkakF0dHJpYnV0aW9uU291cmNlKSkgewogICAgICAgICAgICAgICAgICAgICBBTE9HRSgiZ2V0SW5wdXRGb3JBdHRyKCkgcGVybWlzc2lvbiBkZW5pZWQ6IG1vZGlmeSBhdWRpbyByb3V0aW5nIG5vdCBhbGxvd2VkIik7CiAgICAgICAgICAgICAgICAgICAgIHN0YXR1cyA9IFBFUk1JU1NJT05fREVOSUVEOwogICAgICAgICAgICAgICAgIH0KQEAgLTUyNCwyOSArNjY3LDM3IEBACiAgICAgICAgIGlmIChzdGF0dXMgIT0gTk9fRVJST1IpIHsKICAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gUEVSTUlTU0lPTl9ERU5JRUQpIHsKICAgICAgICAgICAgICAgICBBdXRvQ2FsbGVyQ2xlYXIgYWNjOwotICAgICAgICAgICAgICAgIG1BdWRpb1BvbGljeU1hbmFnZXItPnJlbGVhc2VJbnB1dCgqcG9ydElkKTsKKyAgICAgICAgICAgICAgICBtQXVkaW9Qb2xpY3lNYW5hZ2VyLT5yZWxlYXNlSW5wdXQocG9ydElkKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBzdGF0dXM7CisgICAgICAgICAgICByZXR1cm4gYmluZGVyU3RhdHVzRnJvbVN0YXR1c1Qoc3RhdHVzKTsKICAgICAgICAgfQogCi0gICAgICAgIHNwPEF1ZGlvUmVjb3JkQ2xpZW50PiBjbGllbnQgPSBuZXcgQXVkaW9SZWNvcmRDbGllbnQoKmF0dHIsICppbnB1dCwgdWlkLCBwaWQsIHNlc3Npb24sICpwb3J0SWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKnNlbGVjdGVkRGV2aWNlSWQsIG9wUGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuQ2FwdHVyZU91dHB1dCwgY2FuQ2FwdHVyZUhvdHdvcmQpOwotICAgICAgICBtQXVkaW9SZWNvcmRDbGllbnRzLmFkZCgqcG9ydElkLCBjbGllbnQpOworICAgICAgICBzcDxBdWRpb1JlY29yZENsaWVudD4gY2xpZW50ID0gbmV3IEF1ZGlvUmVjb3JkQ2xpZW50KGF0dHIsIGlucHV0LCBzZXNzaW9uLCBwb3J0SWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0ZWREZXZpY2VJZCwgYWRqQXR0cmlidXRpb25Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuQ2FwdHVyZU91dHB1dCwgY2FuQ2FwdHVyZUhvdHdvcmQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU91dHB1dENvbW1hbmRUaHJlYWQpOworICAgICAgICBtQXVkaW9SZWNvcmRDbGllbnRzLmFkZChwb3J0SWQsIGNsaWVudCk7CiAgICAgfQogCiAgICAgaWYgKGF1ZGlvUG9saWN5RWZmZWN0cyAhPSAwKSB7CiAgICAgICAgIC8vIGNyZWF0ZSBhdWRpbyBwcmUgcHJvY2Vzc29ycyBhY2NvcmRpbmcgdG8gaW5wdXQgc291cmNlCi0gICAgICAgIHN0YXR1c190IHN0YXR1cyA9IGF1ZGlvUG9saWN5RWZmZWN0cy0+YWRkSW5wdXRFZmZlY3RzKCppbnB1dCwgaW5wdXRTb3VyY2UsIHNlc3Npb24pOworICAgICAgICBzdGF0dXNfdCBzdGF0dXMgPSBhdWRpb1BvbGljeUVmZmVjdH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zIiwKKyAgICAgICAgICAgICAgICBfX2Z1bmNfXywgY2xpZW50LT5hdHRyaWJ1dGlvblNvdXJjZS50b1N0cmluZygpLmNfc3RyKCkpOworICAgICAgICByZXR1cm4gYmluZGVyU3RhdHVzRnJvbVN0YXR1c1QoUEVSTUlTU0lPTl9ERU5JRUQpOwogICAgIH0KIAogICAgIE11dGV4OjpBdXRvbG9jayBfbChtTG9jayk7CkBAIC02MjAsMTEgKzc3NywxMyBAQAogICAgICAgICAgICAgaXRlbS0+c2V0Q1N0cmluZyhrQXVkaW9Qb2xpY3lScXN0U3JjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b1N0cmluZyhjbGllbnQtPmF0dHJpYnV0ZXMuc291cmNlKS5jX3N0cigpKTsKICAgICAgICAgICAgIGl0ZW0tPnNldEludDMyKGtBdWRpb1BvbGljeVJxc3RTZXNzaW9uLCBjbGllbnQtPnNlc3Npb24pOwotICAgICAgICAgICAgaWYgKGNsaWVudC0+b3BQYWNrYWdlTmFtZS5zaXplKCkgIT0gMCkgeworICAgICAgICAgICAgaWYgKGNsaWVudC0+YXR0cmlidXRpb25Tb3VyY2UucGFja2FnZU5hbWUuaGFzX3ZhbHVlKCkgJiYKKyAgICAgICAgICAgICAgICBjbGllbnQtPmF0dHJpYnV0aW9uU291cmNlLnBhY2thZ2VOYW1lLnZhbHVlKCkuc2l6ZSgpICE9IDApIHsKICAgICAgICAgICAgICAgICBpdGVtLT5zZXRDU3RyaW5nKGtBdWRpb1BvbGljeVJxc3RQa2csCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyhTdHJpbmc4KGNsaWVudC0+b3BQYWNrYWdlTmFtZSkuc3RyaW5nKCkpLmNfc3RyKCkpOworICAgICAgICAgICAgICAgICAgICBjbGllbnQtPmF0dHJpYnV0aW9uU291cmNlLnBhY2thZ2VOYW1lLnZhbHVlKCkuY19zdHIoKSk7CiAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGl0ZW0tPnNldENTdHJpbmcoa0F1ZGlvUG9saWN5UnFzdFBrZywgc3RkOjp0b19zdHJpbmcoY2xpZW50LT51aWQpLmNfc3RyKCkpOworICAgICAgICAgICAgICAgIGl0ZW0tPnNldENTdHJpbmcoa0F1ZGlvUG9saWN5UnFzdFBrZywKKyAgICAgICAgICAgICAgICAgICAgc3RkOjp0b19zdHJpbmcoY2xpZW50LT5hdHRyaWJ1dGlvblNvdXJjZS51aWQpLmNfc3RyKCkpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgaXRlbS0+c2V0Q1N0cmluZygKICAgICAgICAgICAgICAgICAgICAga0F1ZGlvUG9saWN5UnFzdERldmljZSwgZ2V0RGV2aWNlVHlwZVN0ckZvclBvcnRJZChjbGllbnQtPmRldmljZUlkKS5jX3N0cigpKTsKQEAgLTY0MCwxMiArNzk5LDEzIEBACiAgICAgICAgICAgICAgICAgICAgIGl0ZW0tPnNldENTdHJpbmcoa0F1ZGlvUG9saWN5QWN0aXZlU3JjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvU3RyaW5nKG90aGVyLT5hdHRyaWJ1dGVzLnNvdXJjZSkuY19zdHIoKSk7CiAgICAgICAgICAgICAgICAgICAgIGl0ZW0tPnNldEludDMyKGtBdWRpb1BvbGljeUFjdGl2ZVNlc3Npb24sIG90aGVyLT5zZXNzaW9uKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG90aGVyLT5vcFBhY2thZ2VOYW1lLnNpemUoKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChvdGhlci0+YXR0cmlidXRpb25Tb3VyY2UucGFja2FnZU5hbWUuaGFzX3ZhbHVlKCkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgIG90aGVyLT5hdHRyaWJ1dGlvblNvdXJjZS5wYWNrYWdlTmFtZS52YWx1ZSgpLnNpemUoKSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBpdGVtLT5zZXRDU3RyaW5nKGtBdWRpb1BvbGljeUFjdGl2ZVBrZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcoU3RyaW5nOChvdGhlci0+b3BQYWNrYWdlTmFtZSkuc3RyaW5nKCkpLmNfc3RyKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG90aGVyLT5hdHRyaWJ1dGlvblNvdXJjZS5wYWNrYWdlTmFtZS52YWx1ZSgpLmNfc3RyKCkpOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgaXRlbS0+c2V0Q1N0cmluZyhrQXVkaW9Qb2xpY3lScXN0UGtnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnRvX3N0cmluZyhvdGhlci0+dWlkKS5jX3N0cigpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW0tPnNldENTdHJpbmcoa0F1ZGlvUG9saWN5UnFzdFBrZywgc3RkOjp0b19zdHJpbmcoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3RoZXItPmF0dHJpYnV0aW9uU291cmNlLnVpZCkuY19zdHIoKSk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgaXRlbS0+c2V0Q1N0cmluZyhrQXVkaW9Qb2xpY3lBY3RpdmVEZXZpY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RGV2aWNlVHlwZVN0ckZvclBvcnRJZChvdGhlci0+ZGV2aWNlSWQpLmNfc3RyKCkpOwpAQCAtNjYxLDI0ICs4MjEsMjYgQEAKICAgICAgICAgY2xpZW50LT5hY3RpdmUgPSBmYWxzZTsKICAgICAgICAgY2xpZW50LT5zdGFydFRpbWVOcyA9IDA7CiAgICAgICAgIHVwZGF0ZVVpZFN0YXRlc19sKCk7Ci0gICAgICAgIGZpbmlzaFJlY29yZGluZyhjbGllb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CisgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKIH0KIAotc3RhdHVzX3QgQXVkaW9Qb2xpY3lTZXJ2aWNlOjppbml0U3RyZWFtVm9sdW1lKGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXhNaW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleE1heCkKLXsKK1N0YXR1cyBBdWRpb1BvbGljeVNlcnZpY2U6OmluaXRTdHJlYW1Wb2x1bWUobWVkaWE6OkF1ZGlvU3RyZWFtVHlwZSBzdHJlYW1BaWRsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IGluZGV4TWluQWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBpbmRleE1heEFpZGwpIHsKKyAgICBhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSA9IFZBTFVFX09SX1JFVFVSTl9CSU5ERVJfU1RBVFVTKAorICAgICAgICAgICAgYWlkbDJsZWdhY3lfQXVkaW9TdHJlYW1UeXBlX2F1ZGlvX3N0cmVhbV90eXBlX3Qoc3RyZWFtQWlkbCkpOworICAgIGludCBpbmRleE1pbiA9IFZBTFVFX09SX1JFVFVSTl9CSU5ERVJfU1RBVFVTKGNvbnZlcnRJbnRlZ3JhbDxpbnQ+KGluZGV4TWluQWlkbCkpOworICAgIGludCBpbmRleE1heCA9IFZBTFVFX09SX1JFVFVSTl9CSU5ERVJfU1RBVFVTKGNvbnZlcnRJbnRlZ3JhbDxpbnQ+KGluZGV4TWF4QWlkbCkpOworCiAgICAgaWYgKG1BdWRpb1BvbGljeU1hbmFnZXIgPT0gTlVMTCkgewotICAgICAgICByZXR1cm4gTk9fSU5JVDsKKyAgICAgICAgcmV0dXJuIGJpbmRlclN0YX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TG9jayk7CiAgICAgQXV0b0NhbGxlckNsZWFyIGFjYzsKLSAgICByZXR1cm4gbUF1ZGlvUG9saWN5TWFuYWdlci0+c2V0U3RyZWFtVm9sdW1lSW5kZXgoc3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZSk7CisgICAgcmV0dXJuIGJpbmRlclN0YXR1c0Zyb21TdGF0dXNUKG1BdWRpb1BvbGljeU1hbmFnZXItPnNldFN0cmVhbVZvbHVtZUluZGV4KHN0cmVhbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZSkpOwogfQogCi1zdGF0dXNfdCBBdWRpb1BvbGljeVNlcnZpY2U6OmdldFN0cmVhbVZvbHVtZUluZGV4KGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgKmluZGV4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19kZXZpY2VzX3QgZGV2aWNlKQoteworU3RhdHVzIEF1ZGlvUG9saWN5U2VydmljZTo6Z2V0U3RyZWFtVm9sdW1lSW5kZXgobWVkaWE6OkF1ZGlvU3RyZWFtVHlwZSBzdHJlYW1BaWRsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBkZXZpY2VBaWRsLCBpbnQzMl90KiBfYWlkbF9yZXR1cm4pIHsKKyAgICBhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSA9IFZBTFVFX09SX1JFVFVSTl9CSU5ERVJfU1RBVFVTKAorICAgICAgICAgICAgYWlkbDJsZWdhY3lfQXVkaW9TdHJlYW1UeXBlX2F1ZGlvX3N0cmVhbV90eXBlX3Qoc3RyZWFtQWlkbCkpOworICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UgPSBWQUxVRV9PUl9SRVRVUk5fQklOREVSX1NUQVRVUygKKyAgICAgICAgICAgIGFpZGwybGVnYWN5X2ludDMyX3RfYXVkaW9fZGV2aWNlc190KGRldmljZUFpZGwpKTsKKyAgICBpbnQgaW5kZXg7CisKICAgICBpZiAobUF1ZGlvUG9saWN5TWFuYWdlciA9PSBOVUxMKSB7Ci0gICAgICAgIHJldHVybiBOT19JTklUOworICAgICAgICByZXR1cm4gYmluZGVyU3RhdHVzRnJvbVN0YXR1c1QoTk9fSU5JVCk7CiAgICAgfQogICAgIGlmICh1aW50MzJfdChzdHJlYW0pID49IEFVRElPX1NUUkVBTV9QVUJMSUNfQ05UKSB7Ci0gICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgICAgIHJldHVybiBiaW5kZXJTdGF0dXNGcm9tU3RhdHVzVChCQURfVkFMVUUpOwogICAgIH0KICAgICBNdXRleDo6QXV0b2xvY2sgX2wobUxvY2spOwogICAgIEF1dG9DYWxsZXJDbGVhciBhY2M7Ci0gICAgcmV0dXJuIG1BdWRpb1BvbGljeU1hbmFnZXItPmdldFN0cmVhbVZvbHVtZUluZGV4KHN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2UpOworICAgIFJFVFVSTl9JRl9CSU5ERVJfRVJST1IoYmluZGVyU3RhdHVzRnJvbVN0YXR1c1QoCisgICAgICAgICAgICBtQXVkaW9Qb2xpY3lNYW5hZ2VyL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vcFBhY2thZ2VOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVmZmVjdF91dWlkX3QgKnV1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBwcmlvcml0eSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19zb3VyY2VfdCBzb3VyY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fdW5pcXVlX2lkX3QqIGlkKQoteworU3RhdHVzIEF1ZGlvUG9saWN5U2VydmljZTo6YWRkU291cmNlRGVmYXVsdEVmZmVjdChjb25zdCBtZWRpYTo6QXVkaW9VdWlkJiB0eXBlQWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcmIG9wUGFja2FnZU5hbWVBaWRsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBtZWRpYTo6QXVkaW9VdWlkJiB1dWlkQWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBwcmlvcml0eSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWE6OkF1ZGlvU291cmNlVHlwZSBzb3VyY2VBaWRsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90KiBfYWlkbF9yZXR1cm4pIHsKKyAgICBlZmZlY3RfdXVpZF90IHR5cGUgPSBWQUxVRV9PUl9SRVRVUk5fQklOREVSX1NUQVRVUygKKyAgICAgICAgICAgIGFpZGwybGVnYWN5X0F1ZGlvVXVpZF9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TdGF0dXNUKFBFUk1JU1NJT05fREVOSUVEKTsKICAgICB9Ci0gICAgcmV0dXJuIGF1ZGlvUG9saWN5RWZmZWN0cy0+YWRkU291cmNlRGVmYXVsdEVmZmVjdCgKLSAgICAgICAgICAgIHR5cGUsIG9wUGFja2FnZU5hbWUsIHV1aWQsIHByaW9yaXR5LCBzb3VyY2UsIGlkKTsKKyAgICBSRVRVUk5fSUZfQklOREVSX0VSUk9SKGJpbmRlclN0YXR1c0Zyb21TdGF0dXNUKGF1ZGlvUG9saWN5RWZmZWN0cy0+YWRkU291cmNlRGVmYXVsdEVmZmVjdCgKKyAgICAgICAgICAgICZ0eXBlLCBvcFBhY2thZ2VOYW1lLCAmdXVpZCwgcHJpb3JpdHksIHNvdXJjZSwgJmlkKSkpOworICAgICpfYWlkbF9yZXR1cm4gPSBWQUxVRV9PUl9SRVRVUk5fQklOREVSX1NUQVRVUyhsZWdhY3kyYWlkbF9hdWRpb191bmlxdWVfaWRfdF9pbnQzMl90KGlkKSk7CisgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKIH0KIAotc3RhdHVzX3QgQXVkaW9Qb2xpY3lTZXJ2aWNlOjphZGRTdHJlYW1EZWZhdWx0RWZmZWN0KGNvbnN0IGVmZmVjdF91dWlkX3QgKnR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nMTYmIG9wUGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZWZmZWN0X3V1aWRfdCAqdXVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IHByaW9yaXR5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3VzYWdlX3QgdXNhZ2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fdW5pcXVlX2lkX3QqIGlkKQotewotICAgIHNwPEF1ZGlvUG9saWN5RWZmZWN0cz5hdWRpb1BvbGljeUVmZmVjdHM7Ci0gICAgc3RhdHVzX3Qgc3RhdHVzID0gZ2V0QXVkaW9Qb2xpY3lFZmZlY3RzKGF1ZGlvUG9saWN5RWZmZWN0cyk7Ci0gICAgaWYgKHN0YXR1cyAhPSBPSykgewotICAgICAgICByZXR1cm4gc3RhdHVzOwotICAgIH0KK1N0YXR1cyBBdWRpb1BvbGljeVNlcnZpY2U6OmFkZFN0cmVhbURlZmF1bHRFZmZlY3QoY29uc3QgbWVkaWE6OkF1ZGlvVXVpZCYgdHlwZUFpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBvcFBhY2thZ2VOYW1lQWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgbWVkaWE6OkF1ZGlvVXVpZCYgdXVpZEFpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgcHJpb3JpdHksIG1lZGlhOjpBdWRpb1VzYWdlIHVzYWdlQWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCogX2FpZGxfcmV0dXJuKSB7CisgICAgZWZmZWN0X3V1aWRfdCB0eXBlID0gVkFMVUVfT1JfUkVUVVJOX0JJTkRFUl9TVEFUVVMoCisgICAgICAgICAgICBhaWRsMmxlZ2FjeV9BdWRpb1V1aWRfYXVkaW9fdXVpZF90KHR5cGVBaWRsKSk7CisgICAgU3RyaW5nMTYgb3BQYWNrYWdlTmFtZSA9IFZBTFVFX09SX1JFVFVSTl9CSU5ERVJfU1RBVFVTKAorICAgICAgICAgICA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XVkaW9QYXRjaChoYW5kbGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElQQ1RocmVhZFN0YXRlOjpzZWxmKCktPmdldENhbGxpbmdVaWQoKSk7CisgICAgcmV0dXJuIGJpbmRlclN0YXR1c0Zyb21TdGF0dXNUKAorICAgICAgICAgICAgbUF1ZGlvUG9saWN5TWFuYWdlci0+cmVsZWFzZUF1ZGlvUGF0Y2goaGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSVBDVGhyZWFkU3RhdGU6OnNlbGYoKS0+Z2V0Q2FsbGluZ1VpZCgpKSk7CiB9CiAKLXN0YXR1c190IEF1ZGlvUG9saWN5U2VydmljZTo6bGlzdEF1ZGlvUGF0Y2hlcyh1bnNpZ25lZCBpbnQgKm51bV9wYXRjaGVzLAotICAgICAgICBzdHJ1Y3QgYXVkaW9fcGF0Y2ggKnBhdGNoZXMsCi0gICAgICAgIHVuc2lnbmVkIGludCAqZ2VuZXJhdGlvbikKLXsKK1N0YXR1cyBBdWRpb1BvbGljeVNlcnZpY2U6Omxpc3RBdWRpb1BhdGNoZXMobWVkaWE6OkludCogY291bnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPG1lZGlhOjpBdWRpb1BhdGNoPiogcGF0Y2hlc0FpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QqIF9haWRsX3JldHVybikgeworICAgIHVuc2lnbmVkIGludCBudW1fcGF0Y2hlcyA9IFZBTFVFX09SX1JFVFVSTl9CSU5ERVJfU1RBVFVTKAorICAgICAgICAgICAgY29udmVydEludGVncmFsPHVuc2lnbmVkIGludD4oY291bnQtPnZhbHVlKSk7CisgICAgaWYgKG51bV9wYXRjaGVzID4gTUFYX0lURU1TX1BFUl9MSVNUKSB7CisgICAgICAgIG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X3JldHVybikpOwogfQogCiAKLWZsb2F0IEF1ZGlvUG9saWN5U2VydmljZTo6Z2V0U3RyZWFtVm9sdW1lREIoCi0gICAgICAgICAgICBhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSwgaW50IGluZGV4LCBhdWRpb19kZXZpY2VzX3QgZGV2aWNlKQoteworU3RhdHVzIEF1ZGlvUG9saWN5U2VydmljZTo6Z2V0U3RyZWFtVm9sdW1lREIobWVkaWE6OkF1ZGlvU3RyZWFtVHlwZSBzdHJlYW1BaWRsLCBpbnQzMl90IGluZGV4QWlkbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgZGV2aWNlQWlkbCwgZmxvYXQqIF9haWRsX3JldHVybikgeworICAgIGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtID0gVkFMVUVfT1JfUkVUVVJOX0JJTkRFUl9TVEFUVVMoCisgICAgICAgICAgICBhaWRsMmxlZ2FjeV9BdWRpb1N0cmVhbVR5cGVfYXVkaW9fc3RyZWFtX3R5cGVfdChzdHJlYW1BaWRsKSk7CisgICAgaW50IGluZGV4ID0gVkFMVUVfT1JfUkVUVVJOX0JJTkRFUl9TVEFUVVMoY29udmVydEludGVncmFsPGludD4oaW5kZXhBaWRsKSk7CisgICAgYXVkaW9fZGV2aWNlc190IGRldmljZSA9IFZBTFVFX09SX1JFVFVSTl9CSU5ERVJfU1RBVFVTKAorICAgICAgICAgICAgYWlkbDJsZWdhY3lfaW50MzJfdF9hdWRpb19kZXZpY2VzX3QoZGV2aWNlQWlkbCkpOworCiAgICAgaWYgKG1BdWRpb1BvbGljeU1hbmFnZXIgPT0gTlVMTCkgewotICAgICAgICByZXR1cm4gTkFOOworICAgICAgICByZXR1cm4gYmluZGVyU3RhdHVzRnJvbVN0YXR1c1QoTk9fSU5JVCk7CiAgICAgfQogICAgIE11dGV4OjpBdXRvbG9jayBfbChtTG9jayk7CiAgICAgQXV0b0NhbGxlckN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sZV90ICpoYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGVsYXlNcykKQEAgLTI5MywxMCArMzcyLDExIEBACiAgICAgcmV0dXJuIG1BdWRpb0NvbW1hbmRUaHJlYWQtPnNldEF1ZGlvUG9ydENvbmZpZ0NvbW1hbmQoY29uZmlnLCBkZWxheU1zKTsKIH0KIAotQXVkaW9Qb2xpY3lTZXJ2aWNlOjpOb3RpZmljYXRpb25DbGllbnQ6Ok5vdGlmaWNhdGlvbkNsaWVudChjb25zdCBzcDxBdWRpb1BvbGljeVNlcnZpY2U+JiBzZXJ2aWNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxJQXVkaW9Qb2xpY3lTZXJ2aWNlQ2xpZW50PiYgY2xpZW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IHBpZCkKK0F1ZGlvUG9saWN5U2VydmljZTo6Tm90aWZpY2F0aW9uQ2xpZW50OjpOb3RpZmljYXRpb25DbGllbnQoCisgICAgICAgIGNvbnN0IHNwPEF1ZGlvUG9saWN5U2VydmljZT4mIHNlcnZpY2UsCisgICAgICAgIGNvbnN0IHNwPG1lZGlhOjpJQXVkaW9Qb2xpY3lTZXJ2aWNlQ2xpZW50PiYgY2xpZW50LAorICAgICAgICB1aWRfdCB1aWQsCisgICAgICAgIHBpZF90IHBpZCkKICAgICA6IG1TZXJ2aWNlKHNlcnZpY2UpLCBtVWlkKHVpZCksIG1QaWQocGlkKSwgbUF1ZGlvUG9saWN5U2VydmljZUNsaWVudChjbGllbnQpLAogICAgICAgbUF1ZGlvUG9ydENhbGxiYWNrc0VuYWJsZWQoZmFsc2UpLCBtQXVkaW9Wb2x1b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cjxtZWRpYTo6RWZmZWN0RGVzY3JpcHRvcj4gZWZmZWN0c0FpZGwgPSBWQUxVRV9PUl9SRVRVUk5fU1RBVFVTKAorICAgICAgICAgICAgICAgICAgICBjb252ZXJ0Q29udGFpbmVyPHN0ZDo6dmVjdG9yPG1lZGlhOjpFZmZlY3REZXNjcmlwdG9yPj4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0cywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdhY3kyYWlkbF9lZmZlY3RfZGVzY3JpcHRvcl90X0VmZmVjdERlc2NyaXB0b3IpKTsKKyAgICAgICAgICAgIGludDMyX3QgcGF0Y2hIYW5kbGVBaWRsID0gVkFMVUVfT1JfUkVUVVJOX1NUQVRVUygKKyAgICAgICAgICAgICAgICAgICAgbGVnYWN5MmFpZGxfYXVkaW9fcGF0Y2hfaGFuZGxlX3RfaW50MzJfdChwYXRjaEhhbmRsZSkpOworICAgICAgICAgICAgbWVkaWE6OkF1ZGlvU291cmNlVHlwZSBzb3VyY2VBaWRsID0gVkFMVUVfT1JfUkVUVVJOX1NUQVRVUygKKyAgICAgICAgICAgICAgICAgICAgbGVnYWN5MmFpZGxfYXVkaW9fc291cmNlX3RfQXVkaW9Tb3VyY2VUeXBlKHNvdXJjZSkpOworICAgICAgICAgICAgcmV0dXJuIGFpZGxfdXRpbHM6OnN0YXR1c1RGcm9tQmluZGVyU3RhdHVzKAorICAgICAgICAgICAgICAgICAgICBtQXVkaW9Qb2xpY3lTZXJ2aWNlQ2xpZW50LT5vblJlY29yZGluZ0NvbmZpZ3VyYXRpb25VcGRhdGUoZXZlbnRBaWRsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50SW5mb0FpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnRDb25maWdBaWRsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50RWZmZWN0c0FpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2VDb25maWdBaWRsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0c0FpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRjaEhhbmRsZUFpZGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2VBaWRsKSk7CisgICAgICAgIH0oKTsKKyAgICAgICAgQUxPR1dfSUYoc3RhdHVzICE9IE9LLCAib25SZWNvcmRpbmdDb25maWd1cmF0aW9uVXBkYXRlKCkgZmFpbGVkOiAlZCIsIHN0YXR1cyk7CiAgICAgfQogfQogCkBAIC0zNzIsNiArNDgyLDEzIEBACiAgICAgbUF1ZGlvVm9sdW1lR3JvdXBDYWxsYmFja3NFbmFibGVkID0gZW5hYmxlZDsKIH0KIAordm9pZCBBdWRpb1BvbGljeVNlcnZpY2U6Ok5vdGlmaWNhdGlvbkNsaWVudDo6b25Sb3V0aW5nVXBkYXRlZCgpCit7CisgICAgaWYgKG1BdWRpb1BvbGljeVNlcnZpY2VDbGllbnQgIT0gMCAmJiBpc1NlcnZpY2VVaWQobVVpZCkpIHsKKyAgICAgICAgbUF1ZGlvUG9saWN5U2VydmljZUNsaWVudC0+b25Sb3V0aW5nVXBkYXRlZCgpOworICAgIH0KK30KKwogdm9pZCBBdWRpb1Bv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TExeU9uVG9wIHx8IHJ0dENhbGxBY3RpdmUpICYmIGlzQXNzaXN0YW50KSkpIHsKICAgICAgICAgICAgICAgICBpZiAoaXNQcml2YWN5U2Vuc2l0aXZlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChjdXJyZW50LT5zdGFydFRpbWVOcyA+IGxhdGVzdFNlbnNpdGl2ZVN0YXJ0TnMpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGxhdGVzdFNlbnNpdGl2ZUFjdGl2ZSA9IGN1cnJlbnQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsYXRlc3RTZW5zaXRpdmVTdGFydE5zID0gY3VycmVudC0+c3RhcnRUaW1lTnM7CisgICAgICAgICAgICAgICAgICAgIC8vIGlmIGF1ZGlvIG1vZGUgaXMgSU5fQ09NTVVOSUNBVElPTiwgbWFrZSBzdXJlIHRoZSBhdWRpbyBtb2RlIG93bmVyCisgICAgICAgICAgICAgICAgICAgIC8vIGlzIG1hcmtlZCBsYXRlc3Qgc2Vuc2l0aXZlIGFjdGl2ZSBldmVuIGlmIGFub3RoZXIgYXBwIHF1YWxpZmllcy4KKyAgICAgICAgICAgICAgICAgICAgaWYgKGN1cnJlbnQtPnN0YXJ0VGltZU5zID4gbGF0ZXN0U2Vuc2l0aXZlU3RhcnROcworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IChpc0luQ29tbXVuaWNhdGlvbiAmJiBjdXJyZW50VWlkID09IG1QaG9uZVN0YXRlT3duZXJVaWQpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzSW5Db21tdW5pY2F0aW9uIHx8IGxhdGVzdFNlbnNpdGl2ZUFjdGl2ZU9yQ29tbSA9PSBudWxscHRyCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IFZBTFVFX09SX0ZBVEFMKGFpZGwybGVnYWN5X2ludDMyX3RfdWlkX3QoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXRlc3RTZW5zaXRpdmVBY3RpdmVPckNvbW0tPmF0dHJpYnV0aW9uU291cmNlLnVpZCkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIT0gbVBob25lU3RhdGVPd25lclVpZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhdGVzdFNlbnNpdGl2ZUFjdGl2ZU9yQ29tbSA9IGN1cnJlbnQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGF0ZXN0U2Vuc2l0aXZlU3RhcnROcyA9IGN1cnJlbnQtPnN0YXJ0VGltZU5zOworICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGlzU2Vuc2l0aXZlQWN0aXZlID0gdHJ1ZTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewpAQCAtNTMxLDYgKzY2MCw5IEBACiAgICAgICAgIGlmIChjdXJyZW50LT5hdHRyaWJ1dGVzLnNvdXJjZSAhPSBBVURJT19TT1VSQ0VfSE9UV09SRCkgewogICAgICAgICAgICAgb25seUhvdHdvcmRBY3RpdmUgPSBmYWxzZTsKICAgICAgICAgfQorICAgICAgICBpZiAoY3VycmVudFVpZCA9PSBtUGhvbmVTdGF0ZU93bmVyVWlkKSB7CisgICAgICAgICAgICBpc1Bob25lU3RhdGVPd25lckFjdGl2ZSA9IHRydWU7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvLyBpZiBubyBhY3RpdmUgY2xpZW50IHdpdGggVUkgb24gVG9wLCBjb25zaWRlciBsYXRlc3QgYWN0aXZlIGFzIHRvcApAQCAtNTM5LDggKzY3MSwxNyBAQAogICAgICAgICB0b3BTdGFydE5zID0gbGF0ZXN0U3RhcnROczsKICAgICB9CiAgICAgaWYgKHRvcFNlbnNpdGl2ZUFjdGl2ZSA9PSBudWxscHRyKSB7Ci0gICAgICAgIHRvcFNlbnNpdGl2ZUFjdGl2ZSA9IGxhdGVzdFNlbnNpdGl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VJZkluQ2FsbE9yQ29tbXVuaWNhdGlvbihjdXJyZW50KSkgewogICAgICAgICAgICAgICAgIGFsbG93Q2FwdHVyZSA9IHRydWU7CiAgICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSBpZiAobVVpZFBvbGljeS0+aXNDdXJyZW50SW1lVWlkKGN1cnJlbnQtPnVpZCkpIHsKKyAgICAgICAgfSBlbHNlIGlmIChtVWlkUG9saWN5LT5pc0N1cnJlbnRJbWVVaWQoY3VycmVudFVpZCkpIHsKICAgICAgICAgICAgIC8vIEZvciBjdXJyZW50IElucHV0TWV0aG9kU2VydmljZSBhbGxvdyBjYXB0dXJlIGlmOgogICAgICAgICAgICAgLy8gICAgIEEgUlRUIGNhbGwgaXMgYWN0aXZlIEFORCB0aGUgc291cmNlIGlzIFZPSUNFX1JFQ09HTklUSU9OCiAgICAgICAgICAgICBpZiAocnR0Q2FsbEFjdGl2ZSAmJiBzb3VyY2UgPT0gQVVESU9fU09VUkNFX1ZPSUNFX1JFQ09HTklUSU9OKSB7CiAgICAgICAgICAgICAgICAgYWxsb3dDYXB0dXJlID0gdHJ1ZTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgICAgICBzZXRBcHBTdGF0ZV9sKGN1cnJlbnQtPnBvcnRJZCwKLSAgICAgICAgICAgICAgICAgICAgICBhbGxvd0NhcHR1cmUgPyBhcG1TdGF0RnJvbUFtU3RhdGUobVVpZFBvbGljeS0+Z2V0VWlkU3RhdGUoY3VycmVudC0+dWlkKSkgOgorICAgICAgICBzZXRBcHBTdGF0ZV9sKGN1cnJlbnQsCisgICAgICAgICAgICAgICAgICAgICAgYWxsb3dDYXB0dXJlID8gYXBtU3RhdEZyb21BbVN0YXRlKG1VaWRQb2xpY3ktPmdldFVpZFN0YXRlKGN1cnJlbnRVaWQpKSA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFQUF9TVEFURV9JRExFKTsKICAgICB9CiB9CkBAIC02NTIsNyArNzk5LDcgQ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EICVkIiwKKyAgICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgY29kZSwgSVBDVGhyZWFkU3RhdGU6OnNlbGYoKS0+Z2V0Q2FsbGluZ1BpZCgpLAorICAgICAgICAgICAgICAgICAgICAgIElQQ1RocmVhZFN0YXRlOjpzZWxmKCktPmdldENhbGxpbmdVaWQoKSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIElOVkFMSURfT1BFUkFUSU9OOworICAgICAgICAgICAgfQorICAgICAgICB9IGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgYnJlYWs7CisgICAgfQorCisgICAgc3RkOjpzdHJpbmcgdGFnKCJJQXVkaW9Qb2xpY3lTZXJ2aWNlIGNvbW1hbmQgIiArIHN0ZDo6dG9fc3RyaW5nKGNvZGUpKTsKKyAgICBUaW1lQ2hlY2sgY2hlY2sodGFnLmNfc3RyKCkpOworCiAgICAgc3dpdGNoIChjb2RlKSB7CiAgICAgICAgIGNhc2UgU0hFTExfQ09NTUFORF9UUkFOU0FDVElPTjogewogICAgICAgICAgICAgaW50IGluID0gZGF0YS5yZWFkRmlsZURlc2NyaXB0b3IoKTsKQEAgLTc4OSw2ICsxMDUxLDkgQEAKICAgICAgICAgcmV0dXJuIGhhbmRsZVJlc2V0VWlkU3RhdGUoYXJncywgZXJyKTsKICAgICB9IGVsc2UgaWYgKGFyZ3Muc2l6ZSgpID49IDIgJiYgYXJnc1swXSA9PSBTdHJpbmcxNigiZ2V0LXVpZC1zdGF0ZSIpKSB7CiAgICAgICAgIHJldHVybiBoYW5kbGVHZXRVaWRTdGF0ZShhcmdzLCBvdXQsIGVycik7CisgICAgfSBlbHNlIGlmIChhcmdzLnNpemUoKSA+PSAxICYmIGFyZ3NbMF0gPT0gU3RyaW5nMTYoInB1cmdlX3Blcm1pc3Npb24tY2FjaGUiKSkgeworICAgICAgICBwdXJnZVBlcm1pc3Npb25DYWNoZSgpOworICAgICAgICByZXR1cm4gTk9fRVJST1I7CiAgICA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lvQ29tbWFuZFRocmVhZCBpbXBsZW1lbnRhdGlvbiAtLS0tLS0tLS0tCiAKIEF1ZGlvUG9saWN5U2VydmljZTo6QXVkaW9Db21tYW5kVGhyZWFkOjpBdWRpb0NvbW1hbmRUaHJlYWQoU3RyaW5nOCBuYW1lLApAQCAtMTM2Niw2ICsxNzQyLDI3IEBACiAgICAgICAgICAgICAgICAgICAgIHN2Yy0+ZG9Pbk5ld0F1ZGlvTW9kdWxlc0F2YWlsYWJsZSgpOwogICAgICAgICAgICAgICAgICAgICBtTG9jay5sb2NrKCk7CiAgICAgICAgICAgICAgICAgICAgIH0gYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBST1VUSU5HX1VQREFURUQ6IHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR1YoIkF1ZGlvQ29tbWFuZFRocmVhZCgpIHByb2Nlc3Npbmcgcm91dGluZyB1cGRhdGUiKTsKKyAgICAgICAgICAgICAgICAgICAgc3ZjID0gbVNlcnZpY2UucHJvbW90ZSgpOworICAgICAgICAgICAgICAgICAgICBpZiAoc3ZjID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIG1Mb2NrLnVubG9jaygpOworICAgICAgICAgICAgICAgICAgICBzdmMtPmRvT25Sb3V0aW5nVXBkYXRlZCgpOworICAgICAgICAgICAgICAgICAgICBtTG9jay5sb2NrKCk7CisgICAgICAgICAgICAgICAgICAgIH0gYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIFVQREFURV9VSURfU1RBVEVTOiB7CisgICAgICAgICAgICAgICAgICAgIEFMT0dWKCJBdWRpb0NvbW1hbmRUaHJlYWQoKSBwcm9jZXNzaW5nIHVwZGF0ZVVJRCBzdGF0ZXMiKTsKKyAgICAgICAgICAgICAgICAgICAgc3ZjID0gbVNlcnZpY2UucHJvbW90ZSgpOworICAgICAgICAgICAgICAgICAgICBpZiAoc3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mljZTxBdWRpb1BvbGljeVNlcnZpY2U+OwpAQCAtNjEsMTA4ICs2NiwxODIgQEAKICAgICAvLwogICAgIC8vIEJuQXVkaW9Qb2xpY3lTZXJ2aWNlIChzZWUgQXVkaW9Qb2xpY3lJbnRlcmZhY2UgZm9yIG1ldGhvZCBkZXNjcmlwdGlvbnMpCiAgICAgLy8KLQotICAgIHZvaWQgb25OZXdBdWRpb01vZHVsZXNBdmFpbGFibGUoKSBvdmVycmlkZTsKLSAgICB2aXJ0dWFsIHN0YXR1c190IHNldERldmljZUNvbm5lY3Rpb25TdGF0ZShhdWRpb19kZXZpY2VzX3QgZGV2aWNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvbGljeV9kZXZfc3RhdGVfdCBzdGF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19mb3JtYXRfdCBlbmNvZGVkRm9ybWF0KTsKLSAgICB2aXJ0dWFsIGF1ZGlvX3BvbGljeV9kZXZfc3RhdGVfdCBnZXREZXZpY2VDb25uZWN0aW9uU3RhdGUoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190IGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcyk7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCBoYW5kbGVEZXZpY2VDb25maWdDaGFuZ2UoYXVkaW9fZGV2aWNlc190IGRldmljZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfYWRkcmVzcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpkZXZpY2VfbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19mb3JtYXRfdCBlbmNvZGVkRm9ybWF0KTsKLSAgICB2aXJ0dWFsIHN0YXR1c190IHNldFBob25lU3RhdGUoYXVkaW9fbW9kZV90IHN0YXRlLCB1aWRfdCB1aWQpOwotICAgIHZpcnR1YWwgc3RhdHVzX3Qgc2V0Rm9yY2VVc2UoYXVkaW9fcG9saWN5X2ZvcmNlX3VzZV90IHVzYWdlLCBhdWRpb19wb2xpY3lfZm9yY2VkX2NmZ190IGNvbmZpZyk7Ci0gICAgdmlydHVhbCBhdWRpb19wb2xpY3lfZm9yY2VkX2NmZ190IGdldEZvcmNlVXNlKGF1ZGlvX3BvbGljeV9mb3JjZV91c2VfdCB1c2FnZSk7Ci0gICAgdmlydHVhbCBhdWRpb19pb19oYW5kbGVfdCBnZXRPdXRwdXQoYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0pOwotICAgIHN0YXR1c190IGdldE91dHB1dEZvckF0dHIoYXVkaW9fYXR0cmlidXRlc190ICphdHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9faW9faGFuZGxlX3QgKm91dHB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc3RyZWFtX3R5cGVfdCAqc3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgcGlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgdWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX3QgKmNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX291dHB1dF9mbGFnc190IGZsYWdzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqc2VsZWN0ZWREZXZpY2VJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgKnBvcnRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGF1ZGlvX2lvX2hhbmRsZV90PiAqc2Vjb25kYXJ5T3V0cHV0cykgb3ZlcnJpZGU7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCBzdGFydE91dHB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCk7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCBzdG9wT3V0cHV0KGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkKTsKLSAgICB2aXJ0dWFsIHZvaWQgcmVsZWFzZU91dHB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCk7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCBnZXRJbnB1dEZvckF0dHIoY29uc3QgYXVkaW9fYXR0cmlidXRlc190ICphdHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lvX2hhbmRsZV90ICppbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb191bmlxdWVfaWRfdCByaWlkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpZF90IHBpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWRfdCB1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nMTYmIG9wUGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqY29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2lucHV0X2ZsYWdzX3QgZmxhZ3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqc2VsZWN0ZWREZXZpY2VJZCA9IE5VTEwsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqcG9ydElkID0gTlVMTCk7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCBzdGFydElucHV0KGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkKTsKLSAgICB2aXJ0dWFsIHN0YXR1c190IHN0b3BJbnB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCk7Ci0gICAgdmlydHVhbCB2b2lkIHJlbGVhc2VJbnB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCk7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCBpbml0U3RyZWFtVm9sdW1lKGF1ZGlvX3N0cmVhbV90eXBlX3Qgc3RyZWFtLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXhNaW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleE1heCk7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCBzZXRTdHJlYW1Wb2x1bWVJbmRleChhdWRpb19zdHJlYW1fdHlwZV90IHN0cmVhbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UpOwotICAgIHZpcnR1YWwgc3RhdHVzX3QgZ2V0U3RyZWFtVm9sdW1lSW5kZXgoYXVkaW9fc3RyZWFtX3R5cGVfdCBzdHJlYW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgKmluZGV4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZGV2aWNlc190IGRldmljZSk7Ci0KLSAgICB2aXJ0dWFsIHN0YXR1c190IHNldFZvbHVtZUluZGV4Rm9yQXR0cmlidXRlcyhjb25zdCBhdWRpb19hdHRyaWJ1dGVzX3QgJmF0dHIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGluZGV4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UpOwotICAgIHZpcnR1YWwgc3RhdHVzX3QgZ2V0Vm9sdW1lSW5kZXhGb3JBdHRyaWJ1dGVzKGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAmYXR0ciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgJmluZGV4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX2RldmljZXNfdCBkZXZpY2UpOwotICAgIHZpcnR1YWwgc3RhdHVzX3QgZ2V0TWluVm9sdW1lSW5kZXhGb3JBdHRyaWJ1dGVzKGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAmYXR0ciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgJmluZGV4KTsKLSAgICB2aXJ0dWFsIHN0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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVmZmVjdF91dWlkX3QgKnV1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgcHJpb3JpdHksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3NvdXJjZV90IHNvdXJjZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fdW5pcXVlX2lkX3QqIGlkKTsKLSAgICB2aXJ0dWFsIHN0YXR1c190IGFkZFN0cmVhbURlZmF1bHRFZmZlY3QoY29uc3QgZWZmZWN0X3V1aWRfdCAqdHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nMTYmIG9wUGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVmZmVjdF91dWlkX3QgKnV1aWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgcHJpb3JpdHksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3VzYWdlX3QgdXNhZ2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3VuaXF1ZV9pZF90KiBpZCk7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCByZW1vdmVTb3VyY2VEZWZhdWx0RWZmZWN0KGF1ZGlvX3VuaXF1ZV9pZF90IGlkKTsKLSAgICB2aXJ0dWFsIHN0YXR1c190IHJlbW92ZVN0cmVhbURlZmF1bHRFZmZlY3QoYXVkaW9fdW5pcXVlX2lkX3QgaWQpOworICAgIGJpbmRlcjo6U3RhdHVzIG9uTmV3QXVkaW9Nb2R1bGVzQXZhaWxhYmxlKCkgb3Zlc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gICAgICBtZWRpYTo6QXVkaW9Qb2xpY3lGb3JjZWRDb25maWcgY29uZmlnKSBvdmVycmlkZTsKKyAgICBiaW5kZXI6OlN0YXR1cyBnZXRGb3JjZVVzZShtZWRpYTo6QXVkaW9Qb2xpY3lGb3JjZVVzZSB1c2FnZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYTo6QXVkaW9Qb2xpY3lGb3JjZWRDb25maWcqIF9haWRsX3JldHVybikgb3ZlcnJpZGU7CisgICAgYmluZGVyOjpTdGF0dXMgZ2V0T3V0cHV0KG1lZGlhOjpBdWRpb1N0cmVhbVR5cGUgc3RyZWFtLCBpbnQzMl90KiBfYWlkbF9yZXR1cm4pIG92ZXJyaWRlOworICAgIGJpbmRlcjo6U3RhdHVzIGdldE91dHB1dEZvckF0dHIoY29uc3QgbWVkaWE6OkF1ZGlvQXR0cmlidXRlc0ludGVybmFsJiBhdHRyLCBpbnQzMl90IHNlc3Npb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlICZhdHRyaWJ1dGlvblNvdXJjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IG1lZGlhOjpBdWRpb0NvbmZpZyYgY29uZmlnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBmbGFncywgaW50MzJfdCBzZWxlY3RlZERldmljZUlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWE6OkdldE91dHB1dEZvckF0dHJSZXNwb25zZSogX2FpZGxfcmV0dXJuKSBvdmVycmlkZTsKKyAgICBiaW5kZXI6OlN0YXR1cyBzdGFydE91dHB1dChpbnQzMl90IHBvcnRJZCkgb3ZlcnJpZGU7CisgICAgYmluZGVyOjpTdGF0dXMgc3RvcE91dHB1dChpbnQzMl90IHBvcnRJZCkgb3ZlcnJpZGU7CisgICAgYmluZGVyOjpTdGF0dXMgcmVsZWFzZU91dHB1dChpbnQzMl90IHBvcnRJZCkgb3ZlcnJpZGU7CisgICAgYmluZGVyOjpTdGF0dXMgZ2V0SW5wdXRGb3JBdHRyKGNvbnN0IG1lZGlhOjpBdWRpb0F0dHJpYnV0ZXNJbnRlcm5hbCYgYXR0ciwgaW50MzJfdCBpbnB1dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCByaWlkLCBpbnQzMl90IHNlc3Npb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUgJmF0dHJpYnV0aW9uU291cmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBtZWRpYTo6QXVkaW9Db25maWdCYXNlJiBjb25maWcsIGludDMyX3QgZmxhZ3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3Qgc2VsZWN0ZWREZXZpY2VJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWE6OkdldElucHV0Rm9yQXR0clJlc3BvbnNlKiBfYWlkbF9yZXR1cm4pIG92ZXJyaWRlOworICAgIGJpbmRlcjo6U3RhdHVzIHN0YXJ0SW5wdXQoaW50MzJfdCBwb3J0SWQpIG92ZXJyaWRlOworICAgIGJpbmRlcjo6U3RhdHVzIHN0b3BJbnB1dChpbnQzMl90IHBvcnRJZCkgb3ZlcnJpZGU7CisgICAgYmluZGVyOjpTdGF0dXMgcmVsZWFzZUlucHV0KGludDMyX3QgcG9ydElkKSBvdmVycmlkZTsKKyAgICBiaW5kZXI6OlN0YXR1cyBpbml0U3RyZWFtVm9sdW1lKG1lZGlhOjpBdWRpb1N0cmVhbVR5cGUgc3RyZWFtLCBpbnQzMl90IGluZGV4TWluLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBpbmRleE1heCkgb3ZlcnJpZGU7CisgICAgYmluZGVyOjpTdGF0dXMgc2V0U3RyZWFtVm9sdW1lSW5kZXgobWVkaWE6OkF1ZGlvU3RyZWFtVHlwZSBzdHJlYW0sIGludDMyX3QgZGV2aWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgaW5kZXgpIG92ZXJyaWRlOworICAgIGJpbmRlcjo6U3RhdHVzIGdldFN0cmVhbVZvbHVtZUluZGV4KG1lZGlhOjpBdWRpb1N0cmVhbVR5cGUgc3RyZWFtLCBpbnQzMl90IGRldmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90KiBfYWlkbF9yZXR1cm4pIG92ZXJyaWRlOworICAgIGJpbmRlcjo6U3RhdHVzIHNldFZvbHVtZUluZGV4Rm9yQXR0cmlidXRlcyhjb25zdCBtZWRpYTo6QXVkaW9BdHRyaWJ1dGVzSW50ZXJuYWwmIGF0dHIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgZGV2aWNlLCBpbnQzMl90IGluZGV4KSBvdmVycmlkZTsKKyAgICBiaW5kZXI6OlN0YXR1cyBnZXRWb2x1bWVJbmRleEZvckF0dHJpYnV0ZXMoY29uc3QgbWVkaWE6OkF1ZGlvQXR0cmlidXRlc0ludGVybmFsJiBhdHRyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IGRldmljZSwgaW50MzJfdCogX2FpZGxfcmV0dXJuKSBvdmVycmlkZTsKKyAgICBiaW5kZXI6OlN0YXR1cyBnZXRNYXhWb2x1bWVJbmRleEZvckF0dHJpYnV0ZXMoY29uc3QgbWVkaWE6OkF1ZGlvQXR0cmlidXRlc0ludGVybmFsJiBhdHRyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90KiBfYWlkbF9yZXR1cm4pIG92ZXJyaWRlOworICAgIGJpbmRlcjo6U3RhdHVzIGdldE1pblZvbHVtZUluZGV4Rm9yQXR0cmlidXRlcyhjb25zdCBtZWRpYTo6QXVkaW9BdHRyaWJ1dGVzSW50ZXJuYWwmIGF0dHIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QqIF9haWRsX3JldHVybikgb3ZlcnJpZGU7CisgICAgYmluZGVyOjpTdGF0dXMgZ2V0U3RyYXRlZ3lGb3JTdHJlYW0obWVkaWE6OkF1ZGlvU3RyZWFtVHlwZSBzdHJlYW0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCogX2FpZGxfcmV0dXJuKSBvdmVycmlkZTsKKyAgICBiaW5kZXI6OlN0YXR1cyBnZXREZXZpY2VzRm9yU3RyZWFtKG1lZGlhOjpBdWRpb1N0cmVhbVR5cGUgc3RyZWFtLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCogX2FpZGxfcmV0dXJuKSBvdmVycmlkZTsKKyAgICBiaW5kZXI6OlN0YXR1cyBnZXREZXZpY2VzRm9yQXR0cmlidXRlcyhjb25zdCBtZWRpYTo6QXVkaW9BdHRyaWJ1dGVzRXgmIGF0dHIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8bWVkaWE6OkF1ZGlvRGV2aWNlPiogX2FpZGxfcmV0dXJuKSBvdmVycmlkZTsKKyAgICBiaW5kZXI6OlN0YXR1cyBnZXRPdXRwdXRGb3JFZmZlY3QoY29uc3QgbWVkaWE6OkVmZmVjdERlc2NyaXB0b3ImIGRlc2MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QqIF9haWRsX3JldHVybikgb3ZlcnJpZGU7CisgICAgYmluZGVyOjpTdGF0dXMgcmVnaXN0ZXJFZm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5nKAorICAgICAgICAgICAgaW50MzJfdCBhdWRpb1Nlc3Npb24sIG1lZGlhOjpJbnQqIGNvdW50LAorICAgICAgICAgICAgc3RkOjp2ZWN0b3I8bWVkaWE6OkVmZmVjdERlc2NyaXB0b3I+KiBfYWlkbF9yZXR1cm4pIG92ZXJyaWRlOworICAgIGJpbmRlcjo6U3RhdHVzIGFkZFNvdXJjZURlZmF1bHRFZmZlY3QoY29uc3QgbWVkaWE6OkF1ZGlvVXVpZCYgdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBvcFBhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgbWVkaWE6OkF1ZGlvVXVpZCYgdXVpZCwgaW50MzJfdCBwcmlvcml0eSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhOjpBdWRpb1NvdXJjZVR5cGUgc291cmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCogX2FpZGxfcmV0dXJuKSBvdmVycmlkZTsKKyAgICBiaW5kZXI6OlN0YXR1cyBhZGRTdHJlYW1EZWZhdWx0RWZmZWN0KGNvbnN0IG1lZGlhOjpBdWRpb1V1aWQmIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgb3BQYWNrYWdlTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IG1lZGlhOjpBdWRpb1V1aWQmIHV1aWQsIGludDMyX3QgcHJpb3JpdHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYTo6QXVkaW9Vc2FnZSB1c2FnZSwgaW50MzJfdCogX2FpZGxfcmV0dXJuKSBvdmVycmlkZT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ggKnBhdGNoZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuc2lnbmVkIGludCAqZ2VuZXJhdGlvbik7Ci0gICAgdmlydHVhbCBzdGF0dXNfdCBzZXRBdWRpb1BvcnRDb25maWcoY29uc3Qgc3RydWN0IGF1ZGlvX3BvcnRfY29uZmlnICpjb25maWcpOworICAgIHZvaWQgZG9Pbk5ld0F1ZGlvTW9kdWxlc0F2YWlsYWJsZSgpOworICAgIHN0YXR1c190IGRvU3RvcE91dHB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCk7CisgICAgdm9pZCBkb1JlbGVhc2VPdXRwdXQoYXVkaW9fcG9ydF9oYW5kbGVfdCBwb3J0SWQpOwogCi0gICAgdmlydHVhbCB2b2lkIHJlZ2lzdGVyQ2xpZW50KGNvbnN0IHNwPElBdWRpb1BvbGljeVNlcnZpY2VDbGllbnQ+JiBjbGllbnQpOworICAgIHN0YXR1c190IGNsaWVudENyZWF0ZUF1ZGlvUGF0Y2goY29uc3Qgc3RydWN0IGF1ZGlvX3BhdGNoICpwYXRjaCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BhdGNoX2hhbmRsZV90ICpoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGVsYXlNcyk7CisgICAgc3RhdHVzX3QgY2xpZW50UmVsZWFzZUF1ZGlvUGF0Y2goYXVkaW9fcGF0Y2hfaGFuZGxlX3QgaGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBkZWxheU1zKTsKKyAgICB2aXJ0dWFsIHN0YXR1c190IGNsaWVudFNldEF1ZGlvUG9ydENvbmZpZyhjb25zdCBzdHJ1Y3QgYXVkaW9fcG9ydF9jb25maWcgKmNvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGVsYXlNcyk7CiAKLSAgICB2aX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uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqZGV2aWNlQ29uZmlnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGVmZmVjdF9kZXNjcmlwdG9yX3Q+IGVmZmVjdHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcGF0Y2hfaGFuZGxlX3QgcGF0Y2hIYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc291cmNlX3Qgc291cmNlKTsKKyAgICB2b2lkIGRvT25SZWNvcmRpbmdDb25maWd1cmF0aW9uVXBkYXRlKGludCBldmVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlY29yZF9jbGllbnRfaW5mb190ICpjbGllbnRJbmZvLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqY2xpZW50Q29uZmlnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8ZWZmZWN0X2Rlc2NyaXB0b3JfdD4gY2xpZW50RWZmZWN0cywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2NvbmZpZ19iYXNlX3QgKmRldmljZUNvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGVmZmVjdF9kZXNjcmlwdG9yX3Q+IGVmZmVjdHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wYXRjaF9oYW5kbGVfdCBwYXRjaEhhbmRsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3NvdXJjZV90IHNvdXJj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ZW5lcj4mIGxpc3RlbmVyLAotICAgICAgICBib29sKiByZXN1bHQpIG92ZXJyaWRlOwotCi0gICAgdmlydHVhbCBzdGF0dXNfdCBzZXRSdHRFbmFibGVkKGJvb2wgZW5hYmxlZCk7Ci0KLSAgICAgICAgICAgIGJvb2wgaXNDYWxsU2NyZWVuTW9kZVN1cHBvcnRlZCgpIG92ZXJyaWRlOwotCi0gICAgICAgICAgICB2b2lkIGRvT25OZXdBdWRpb01vZHVsZXNBdmFpbGFibGUoKTsKLSAgICAgICAgICAgIHN0YXR1c190IGRvU3RvcE91dHB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCk7Ci0gICAgICAgICAgICB2b2lkIGRvUmVsZWFzZU91dHB1dChhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCk7Ci0KLSAgICAgICAgICAgIHN0YXR1c190IGNsaWVudENyZWF0ZUF1ZGlvUGF0Y2goY29uc3Qgc3RydWN0IGF1ZGlvX3BhdGNoICpwYXRjaCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcGF0Y2hfaGFuZGxlX3QgKmhhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlbGF5TXMpOwotICAgICAgICAgICAgc3RhdHVzX3QgY2xpZW50UmVsZWFzZUF1ZGlvUGF0Y2goYXVkaW9fcGF0Y2hfaGFuZGxlX3QgaGFuZGxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlbGF5TXMpOwotICAgICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBjbGllbnRTZXRBdWRpb1BvcnRDb25maWcoY29uc3Qgc3RydWN0IGF1ZGlvX3BvcnRfY29uZmlnICpjb25maWcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGVsYXlNcyk7Ci0KLSAgICAgICAgICAgIHZvaWQgcmVtb3ZlTm90aWZpY2F0aW9uQ2xpZW50KHVpZF90IHVpZCwgcGlkX3QgcGlkKTsKLSAgICAgICAgICAgIHZvaWQgb25BdWRpb1BvcnRMaXN0VXBkYXRlKCk7Ci0gICAgICAgICAgICB2b2lkIGRvT25BdWRpb1BvcnRMaXN0VXBkYXRlKCk7Ci0gICAgICAgICAgICB2b2lkIG9uQXVkaW9QYXRjaExpc3RVcGRhdGUoKTsKLSAgICAgICAgICAgIHZvaWQgZG9PbkF1ZGlvUGF0Y2hMaXN0VXBkYXRlKCk7Ci0KLSAgICAgICAgICAgIHZvaWQgb25EeW5hbWljUG9saWN5TWl4U3RhdGVVcGRhdGUoY29uc3QgU3RyaW5nOCYgcmVnSWQsIGludDMyX3Qgc3RhdGUpOwotICAgICAgICAgICAgdm9pZCBkb09uRHluYW1pY1BvbGljeU1peFN0YXRlVXBkYXRlKGNvbnN0IFN0cmluZzgmIHJlZ0lkLCBpbnQzMl90IHN0YXRlKTsKLSAgICAgICAgICAgIHZvaWQgb25SZWNvcmRpbmdDb25maWd1cmF0aW9uVXBkYXRlKGludCBldmVudCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlY29yZF9jbGllbnRfaW5mb190ICpjbGllbnRJbmZvLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqY2xpZW50Q29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8ZWZmZWN0X2Rlc2NyaXB0b3JfdD4gY2xpZW50RWZmZWN0cywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2NvbmZpZ19iYXNlX3QgKmRldmljZUNvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGVmZmVjdF9kZXNjcmlwdG9yX3Q+IGVmZmVjdHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wYXRjaF9oYW5kbGVfdCBwYXRjaEhhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3NvdXJjZV90IHNvdXJjZSk7Ci0gICAgICAgICAgICB2b2lkIGRvT25SZWNvcmRpbmdDb25maWd1cmF0aW9uVXBkYXRlKGludCBldmVudCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgcmVjb3JkX2NsaWVudF9pbmZvX3QgKmNsaWVudEluZm8sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2NvbmZpZ19iYXNlX3QgKmNsaWVudENvbmZpZywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8ZWZmZWN0X2Rlc2NyaXB0b3JfdD4gY2xpZW50RWZmZWN0cywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fY29uZmlnX2Jhc2VfdCAqZGV2aWNlQ29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxlZmZlY3RfZGVzY3JpcHRvcl90PiBlZmZlY3RzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpb19wYXRjaF9oYW5kbGVfdCBwYXRjaEhhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc291cmNl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NlbnNvclByaXZhY3lFbmFibGVkKCk7CkBAIC00NzUsNiArNDgyLDggQEAKICAgICAgICAgICAgIFJFQ09SRElOR19DT05GSUdVUkFUSU9OX1VQREFURSwKICAgICAgICAgICAgIFNFVF9FRkZFQ1RfU1VTUEVOREVELAogICAgICAgICAgICAgQVVESU9fTU9EVUxFU19VUERBVEUsCisgICAgICAgICAgICBST1VUSU5HX1VQREFURUQsCisgICAgICAgICAgICBVUERBVEVfVUlEX1NUQVRFUwogICAgICAgICB9OwogCiAgICAgICAgIEF1ZGlvQ29tbWFuZFRocmVhZCAoU3RyaW5nOCBuYW1lLCBjb25zdCB3cDxBdWRpb1BvbGljeVNlcnZpY2U+JiBzZXJ2aWNlKTsKQEAgLTUyMSw2ICs1MzAsOCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uSWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBzdXNwZW5kZWQpOwogICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICBhdWRpb01vZHVsZXNVcGRhdGVDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgIHJvdXRpbmdDaGFuZ2VkQ29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgICB1cGRhdGVVaWRTdGF0ZXNDb21tYW5kKCk7CiAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICAgIGluc2VydENvbW1hbmRfbChBdWRpb0NvbW1hbmQgKmNvbW1hbmQsIGludCBkZWxheU1zID0gMCk7CiAgICAgcHJpdmF0ZToKICAgICAgICAgY2xhc3MgQXVkaW9Db21tYW5kRGF0YTsKQEAgLTczOSwxMCArNzUwLDE3IEBACiAKICAgICAgICAgdmlydHVhbCB2b2lkIG9uQXVkaW9Wb2x1bWVHcm91cENo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BzcDxtZWRpYTo6SUF1ZGlvUG9saWN5U2VydmljZUNsaWVudD4mIGNsaWVudCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZF90IHVpZCwgcGlkX3QgcGlkKTsKICAgICAgICAgdmlydHVhbCAgICAgICAgICAgICB+Tm90aWZpY2F0aW9uQ2xpZW50KCk7CiAKQEAgLTc2OSw2ICs3ODcsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGVmZmVjdF9kZXNjcmlwdG9yX3Q+IGVmZmVjdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcGF0Y2hfaGFuZGxlX3QgcGF0Y2hIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fc291cmNlX3Qgc291cmNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICAgICAgb25Sb3V0aW5nVXBkYXRlZCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgICAgICBzZXRBdWRpb1BvcnRDYWxsYmFja3NFbmFibGVkKGJvb2wgZW5hYmxlZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCBzZXRBdWRpb1ZvbHVtZUdyb3VwQ2FsbGJhY2tzRW5hYmxlZChib29sIGVuYWJsZWQpOwogCkBAIC03ODMsNjYgKzgwMiwxMjQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOb3RpZmljYXRpb25DbGllbnQoY29uc3QgTm90aWZpY2F0aW9uQ2xpZW50Jik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTm90aWZpY2F0aW9uQ2xpZW50JiBvcGVyYXRvciA9IChjb25zdCBOb3RpZmljYXRpb25DbGllbnQmKTsKIAotICAgICAgICBjb25zdCB3cDxBdWRpb1BvbGljeVNlcnZpY2U+ICAgICAgICBtU2VydmljZTsKLSAgICAgICAgY29uc3QgdWlkX3QgICAgICAgICAgICAgICAgICAgICAgICAgbVVpZDsKLSAgICAgICAgY29uc3QgcGlkX3QgICAgICAgICAgICAgICAgICAgICAgICAgbVBpZDsKLSAgICAgICAgY29uc3Qgc3A8SUF1ZGlvUG9saWN5U2VydmljZUNsaWVudD4gbUF1ZGlvUG9saWN5U2VydmljZUNsaWVudDsKLSAgICAgICAgICAgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgbUF1ZGlvUG9ydENhbGxiYWNrc0VuYWJsZWQ7Ci0gICAgICAgICAgICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgICAgIG1BdWRpb1ZvbHVtZUdyb3VwQ2FsbGJhY2tzRW5hYmxlZDsKKyAgICAgICAgY29uc3Qgd3A8QXVkaW9Qb2xpY3lTZXJ2aWNlPiAgICAgICAgICAgICAgIG1TZXJ2aWNlOworICAgICAgICBjb25zdCB1aWRfdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVVpZDsKKyAgICAgICAgY29uc3QgcGlkX3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QaWQ7CisgICAgICAgIGNvbnN0IHNwPG1lZGlhOjpJQXVkaW9Qb2xpY3lTZXJ2aWNlQ2xpZW50PiBtQXVkaW9Qb2xpY3lTZXJ2aWNlQ2xpZW50OworICAgICAgICAgICAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUF1ZGlvUG9ydENhbGxiYWNrc0VuYWJsZWQ7CisgICAgICAgICAgICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQXVkaW9Wb2x1bWVHcm91cENhbGxiYWNrc0VuYWJsZWQ7CiAgICAgfTsKIAogICAgIGNsYXNzIEF1ZGlvQ2xpZW50IDogcHVibGljIHZpcnR1YWwgUmVmQmFzZSB7CiAgICAgcHVibGljOgogICAgICAgICAgICAgICAgIEF1ZGlvQ2xpZW50KGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCBhdHRyaWJ1dGVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2lvX2hhbmRsZV90IGlvLCB1aWRfdCB1aWQsIHBpZF90IHBpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdWRpb19pb19oYW5kbGVfdCBpbywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdHRyaWJ1dGlvblNvdXJjZVN0YXRlJiBhdHRyaWJ1dGlvblNvdXJjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdWRpb19zZXNzaW9uX3Qgc2Vzc2lvbiwgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgcG9ydElkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX3BvcnRfaGFuZGxlX3QgZGV2aWNlSWQpIDoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRlcyhhdHRyaWJ1dGVzKSwgaW8oaW8pLCB1aWQodWlkKSwgcGlkKHBpZCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb24oc2Vzc2lvbiksIHBvcnRJZChwb3J0SWQpLCBkZXZpY2VJZChkZXZpY2VJZCksIGFjdGl2ZShmYWxzZSkge30KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRlcyhhdHRyaWJ1dGVzKSwgaW8oaW8pLCBhdHRyaWJ1dGlvblNvdXJjZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRpb25Tb3VyY2UpLCBzZXNzaW9uKHNlc3Npb24pLCBwb3J0SWQocG9ydElkKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlSWQoZGV2aWNlSWQpLCBhY3Rp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DogcHVibGljIEF1ZGlvQ2xpZW50IHsKICAgICBwdWJsaWM6CiAgICAgICAgICAgICAgICAgQXVkaW9SZWNvcmRDbGllbnQoY29uc3QgYXVkaW9fYXR0cmlidXRlc190IGF0dHJpYnV0ZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2lvX2hhbmRsZV90IGlvLCB1aWRfdCB1aWQsIHBpZF90IHBpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9faW9faGFuZGxlX3QgaW8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX3Nlc3Npb25fdCBzZXNzaW9uLCBhdWRpb19wb3J0X2hhbmRsZV90IHBvcnRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fcG9ydF9oYW5kbGVfdCBkZXZpY2VJZCwgY29uc3QgU3RyaW5nMTYmIG9wUGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgY2FuQ2FwdHVyZU91dHB1dCwgYm9vbCBjYW5DYXB0dXJlSG90d29yZCkgOgotICAgICAgICAgICAgICAgICAgICBBdWRpb0NsaWVudChhdHRyaWJ1dGVzLCBpbywgdWlkLCBwaWQsIHNlc3Npb24sIHBvcnRJZCwgZGV2aWNlSWQpLAotICAgICAgICAgICAgICAgICAgICBvcFBhY2thZ2VOYW1lKG9wUGFja2FnZU5hbWUpLCBzdGFydFRpbWVOcygwKSwKLSAgICAgICAgICAgICAgICAgICAgY2FuQ2FwdHVyZU91dHB1dChjYW5DYXB0dXJlT3V0cHV0KSwgY2FuQ2FwdHVyZUhvdHdvcmQoY2FuQ2FwdHVyZUhvdHdvcmQpIHt9CisgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX3BvcnRfaGFuZGxlX3QgZGV2aWNlSWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEF0dHJpYnV0aW9uU291cmNlU3RhdGUmIGF0dHJpYnV0aW9uU291cmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGNhbkNhcHR1cmVPdXRwdXQsIGJvb2wgY2FuQ2FwdHVyZUhvdHdvcmQsCisgICAgICAgICAgICAgICAgICAgICAgICAgIHdwPEF1ZGlvQ29tbWFuZFRocmVhZD4gY29tbWFuZFRocmVhZCkgOgorICAgICAgICAgICAgICAgICAgICBBdWRpb0NsaWVudChhdHRyaWJ1dGVzLCBpbywgYXR0cmlidXRpb25Tb3VyY2UsCisgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uLCBwb3J0SWQsIGRldmljZUlkKSwgYXR0cmlidXRpb25Tb3VyY2UoYXR0cmlidXRpb25Tb3VyY2UpLAorICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lTnMoMCksIGNhbkNhcHR1cmVPdXRwdXQoY2FuQ2FwdHVyZU91dHB1dCksCisgICAgICAgICAgICAgICAgICAgICAgICBjYW5DYXB0dXJlSG90d29yZChjYW5DYXB0dXJlSG90d29yZCksIHNpbGVuY2VkKGZhbHNlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIG1PcFJlY29yZEF1ZGlvTW9uaXRvcigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT3BSZWNvcmRBdWRpb01vbml0b3I6OmNyZWF0ZUlmTmVlZGVkKGF0dHJpYnV0aW9uU291cmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzLCBjb21tYW5kVGhyZWFkKSkge30KICAgICAgICAgICAgICAgICB+QXVkaW9SZWNvcmRDbGllbnQoKSBvdmVycmlkZSA9IGRlZmF1bHQ7CiAKLSAgICAgICAgY29uc3QgU3RyaW5nMTYgb3BQYWNrYWdlTmFtZTsgICAgICAgIC8vIGNsaWVudCBwYWNrYWdlIG5hbWUKKyAgICAgICAgYm9vbCBoYXNPcCgpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBtT3BSZWNvcmRBdWRpb01vbml0b3IgPyBtT3BSZWNvcmRBdWRpb01vbml0b3ItPmhhc09wKCkgOiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgY29uc3QgQXR0cmlidXRpb25Tb3VyY2VTdGF0ZSBhdHRyaWJ1dGlvblNvdXJjZTsgLy8gYXR0cmlidXRpb24gc291cmNlIG9mIGNsaWVudAogICAgICAgICBuc2Vjc190IHN0YXJ0VGltZU5zOwogICAgICAgICBjb25zdCBib29sIGNhbkNhcHR1cmVPdXRwdXQ7CiAgICAgICAgIGNvbnN0IGJvb2wgY2FuQ2FwdHVyZUhvdHdvcmQ7CisgICAgICAgIGJvb2wgc2lsZW5jZWQ7CisKKyAgICBwcml2YXRlOgorICAgICAgICBzcDxPcFJlY29yZEF1ZGlvTW9uaXRvcj4gICAgICAgICAgIG1PcFJlY29yZEF1ZGlvTW9uaXRvcjsKICAgICB9OwogCisKICAgICAvLyAtLS0gQXVkaW9QbGF5YmFja0NsaWVudCAtLS0KICAgICAvLyBJbmZvcm1hdGlvbiBhYm91dCBlYWNoIHJlZ2lzdGVyZWQgQXVkaW9UcmFjayBjbGllbnQKICAgICAvLyAoYmV0d2VlbiBjYWxscyB0byBnZXRPdXRwdXRGb3JBdHRyKCkgYW5kIHJlbGVhc2VPdXRwdXQoKSkKICAgICBjbGFzcyBBdWRpb1BsYXliYWNrQ2xpZW50IDogcHVibGljIEF1ZGlvQ2xpZW50IHsKICAgICBwdWJsaWM6CiAgICAgICAgICAgICAgICAgQXVkaW9QbGF5YmFja0NsaWVudChjb25zdCBhdWRpb19hdHRyaWJ1dGVzX3QgYXR0cmlidXRlcywKLSAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdWRpb19pb19oYW5kbGVfdCBpbywgdWlkX3QgdWlkLCBwaWRfdCBwaWQsCisgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9faW9faGFuZGxlX3QgaW8sIEF0dHJpYnV0aW9uU291cmN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lSWQsIEFVRElPX0ZPUk1BVF9QQ01fMTZfQklULApAQCAtNzU3LDkgKzExMDQsOSBAQAogICAgICAgICBBdWRpb1BvbGljeU1hbmFnZXJUZXN0RFBQbGF5YmFja1JlUm91dGluZywKICAgICAgICAgdGVzdGluZzo6VmFsdWVzKAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9NVVNJQywgQVVESU9fVVNBR0VfTUVESUEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLCBBVURJT19VU0FHRV9BTEFSTSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgIiJ9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgIiJ9CiAgICAgICAgICAgICAgICAgKQogICAgICAgICApOwogCkBAIC03NjgsNDcgKzExMTUsNDcgQEAKICAgICAgICAgQXVkaW9Qb2xpY3lNYW5hZ2VyVGVzdERQUGxheWJhY2tSZVJvdXRpbmcsCiAgICAgICAgIHRlc3Rpbmc6OlZhbHVlcygKICAgICAgICAgICAgICAgICAoYXVkaW9fYXR0cmlidXRlc190KXtBVURJT19DT05URU5UX1RZUEVfTVVTSUMsIEFVRElPX1VTQUdFX01FRElBLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCisgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifSwKICAgICAgICAgICAgICAgICAoYXVkaW9fYXR0cmlidXRlc190KXtBVURJT19DT05URU5UX1RZUEVfTVVTSUMsIEFVRElPX1VTQUdFX1ZPSUNFX0NPTU1VTklDQVRJT04sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifSwKKyAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9NVVNJQywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19VU0FHRV9WT0lDRV9DT01NVU5JQ0FUSU9OX1NJR05BTExJTkcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifSwKKyAgICAgICAgICAgICAgICAgICAgQVVESU9fVVNBR0VfVk9JQ0VfQ09NTVVOSUNBVElPTl9TSUdOQUxMSU5HLAorICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLCBBVURJT19VU0FHRV9BTEFSTSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAorICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLCBBVURJT19VU0FHRV9OT1RJRklDQVRJT04sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifSwKKyAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9NVVNJQywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19VU0FHRV9OT1RJRklDQVRJT05fVEVMRVBIT05ZX1JJTkdUT05FLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCisgICAgICAgICAgICAgICAgICAgIEFVRElPX1VTQUdFX05PVElGSUNBVElPTl9URUxFUEhPTllfUklOR1RPTkUsCisgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifSwKICAgICAgICAgICAgICAgICAoYXVkaW9fYXR0cmlidXRlc190KXtBVURJT19DT05URU5UX1RZUEVfTVVTSUMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fVVNBR0VfTk9USUZJQ0FUSU9OX0NPTU1VTklDQVRJT05fUkVRVUVTVCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAorICAgICAgICAgICAgICAgICAgICBBVURJT19VU0FHRV9OT1RJRklDQVRJT05fQ09NTVVOSUNBVElPTl9SRVFVRVNULAorICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1VTQUdFX05PVElGSUNBVElPTl9DT01NVU5JQ0FUSU9OX0lOU1RBTlQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifSwKKyAgICAgICAgICAgICAgICAgICAgQVVESU9fVVNBR0VfTk9USUZJQ0FUSU9OX0NPTU1VTklDQVRJT05fSU5TVEFOVCwKKyAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9NVVNJQywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19VU0FHRV9OT1RJRklDQVRJT05fQ09NTVVOSUNBVElPTl9ERUxBWUVELAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCisgICAgICAgICAgICAgICAgICAgIEFVRElPX1VTQUdFX05PVElGSUNBVElPTl9DT01NVU5JQ0FUSU9OX0RFTEFZRUQsCisgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifSwKICAgICAgICAgICAgICAgICAoYXVkaW9fYXR0cmlidXRlc190KXtBVURJT19DT05URU5UX1RZUEVfTVVTSUMsIEFVRElPX1VTQUdFX05PVElGSUNBVElPTl9FVkVOVCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAorICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1VTQUdFX0FTU0lTVEFOQ0VfQUNDRVNTSUJJTElUWSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAorICAgICAgICAgICAgICAgICAgICBBVURJT19VU0FHRV9BU1NJU1RBTkNFX0FDQ0VTU0lCSUxJVFksCisgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifSwKICAgICAgICAgICAgICAgICAoYXVkaW9fYXR0cmlidXRlc190KXtBVURJT19DT05URU5UX1RZUEVfTVVTSUMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fVVNBR0VfQVNTSVNUQU5DRV9OQVZJR0FUSU9OX0dVSURBTkNFLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCisgICAgICAgICAgICAgICAgICAgIEFVRElPX1VTQUdFX0FTU0lTVEFOQ0VfTkFWSUdBVElPTl9HVUlEQU5DRSwKKyAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9NVVNJQywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19VU0FHRV9BU1NJU1RBTkNFX1NPTklGSUNBVElPTiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAorICAgICAgICAgICAgICAgICAgICBBVURJT19VU0FHRV9BU1NJU1RBTkNFX1NPTklGSUNBVElPTiwKKyAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9NVVNJQywgQVVESU9fVVNBR0VfR0FNRSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAorICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLCBBVURJT19VU0FHRV9WSVJUVUFMX1NPVVJDRSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAorICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLCBBVURJT19VU0FHRV9BU1NJU1RBTlQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifSwKKyAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9TUEVFQ0gsIEFVRElPX1VTQUdFX0FTU0lTVEFOVCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9CisgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifQogICAgICAgICAgICAgICAgICkKICAgICAgICAgKTsKIApAQCAtODE3LDQxICsxMTY0LDQxIEBACiAgICAgICAgIEF1ZGlvUG9saWN5TWFuYWdlclRlc3REUFBsYXliYWNrUmVSb3V0aW5nLAogICAgICAgICB0ZXN0aW5nOjpWYWx1ZXMoCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLCBBVURJT19VU0FHRV9WT0lDRV9DT01NVU5JQ0FUSU9OLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiIn0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgIiJ9LAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9NVVNJQywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19VU0FHRV9WT0lDRV9DT01NVU5JQ0FUSU9OX1NJR05BTExJTkcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLCBBVURJT19VU0FHRV9OT1RJRklDQVRJT04sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1VTQUdFX05PVElGSUNBVElPTl9URUxFUEhPTllfUklOR1RPTkUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1VTQUdFX05PVElGSUNBVElPTl9DT01NVU5JQ0FUSU9OX1JFUVVFU1QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1VTQUdFX05PVElGSUNBVElPTl9DT01NVU5JQ0FUSU9OX0lOU1RBTlQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1VTQUdFX05PVElGSUNBVElPTl9DT01NVU5JQ0FUSU9OX0RFTEFZRUQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLCBBVURJT19VU0FHRV9OT1RJRklDQVRJT05fRVZFTlQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1VTQUdFX0FTU0lTVEFOQ0VfQUNDRVNTSUJJTElUWSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgIiJ9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICIifSwKICAgICAgICAgICAgICAgICAoYXVkaW9fYXR0cmlidXRlc190KXtBVURJT19DT05URU5UX1RZUEVfTVVTSUMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fVVNBR0VfQVNTSVNUQU5DRV9OQVZJR0FUSU9OX0dVSURBTkNFLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiIn0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIEFVRElPX0ZMQUdfTk9ORSwgIiJ9LAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9NVVNJQywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19VU0FHRV9BU1NJU1RBTkNFX1NPTklGSUNBVElPTiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgMCwgIiJ9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCBBVURJT19GTEFHX05PTkUsICIifSwKICAgICAgICAgICAgICAgICAoYXVkaW9fYXR0cmlidXRlc190KXtBVURJT19DT05URU5UX1RZUEVfTVVTSUMsIEFVRElPX1VTQUdFX0dBTUUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX01VU0lDLCBBVURJT19VU0FHRV9BU1NJU1RBTlQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0RFRkFVTFQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX1NQRUVDSCwgQVVESU9fVVNBR0VfQVNTSVNUQU5ULAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9ERUZBVUxULCAwLCAiIn0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfREVGQVVMVCwgQVVESU9fRkxBR19OT05FLCAiIn0KICAgICAgICAgICAgICAgICApCiAgICAgICAgICk7CiAKQEAgLTg2OSw3ICsxMjE2LDcgQEAKICAgICAgICAge0FVRElPX1VTQUdFX1VOS05PV04sIEFVRElPX1NPVVJDRV9WT0lDRV9DT01NVU5JQ0FUSU9OLCBSVUxFX01BVENIX0FUVFJJQlVURV9DQVBUVVJFX1BSRVNFVH0KICAgICB9OwogCi0gICAgc3RydWN0IGF1ZGlvX3BvcnQgbUV4dHJhY3Rpb25Qb3J0OworICAgIHN0cnVjdCBhdWRpb19wb3J0X3Y3IG1FeHRyYWN0aW9uUG9ydDsKICAgICBhdWRpb19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weShhdHRyLnRhZ3MsIHRhZ3MuY19zdHIoKSwgQVVESU9fQVRUUklCVVRFU19UQUdTX01BWF9TSVpFIC0gMSk7CiAgICAgZ2V0T3V0cHV0Rm9yQXR0cigmc2VsZWN0ZWREZXZpY2VJZCwgQVVESU9fRk9STUFUX1BDTV8xNl9CSVQsIEFVRElPX0NIQU5ORUxfT1VUX1NURVJFTywKQEAgLTk0MSwxNyArMTI4OSwxOSBAQAogICAgICAgICBBdWRpb1BvbGljeU1hbmFnZXJUZXN0RFBNaXhSZWNvcmRJbmplY3Rpb24sCiAgICAgICAgIHRlc3Rpbmc6OlZhbHVlcygKICAgICAgICAgICAgICAgICAoYXVkaW9fYXR0cmlidXRlc190KXtBVURJT19DT05URU5UX1RZUEVfVU5LTk9XTiwgQVVESU9fVVNBR0VfVU5LTk9XTiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfQ0FNQ09SREVSLCAwLCAiIn0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0NBTUNPUkRFUiwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX1VOS05PV04sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0NBTUNPUkRFUiwgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9DQU1DT1JERVIsIEFVRElPX0ZMQUdfTk9ORSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX1VOS05PV04sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX01JQywgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9NSUMsIEFVRElPX0ZMQUdfTk9ORSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX1VOS05PV04sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX01JQywgMCwgIiJ9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9NSUMsIEFVRElPX0ZMQUdfTk9ORSwgIiJ9LAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9VTktOT1dOLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9WT0lDRV9DT01NVU5JQ0FUSU9OLCAwLCAiIn0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX1ZPSUNFX0NPTU1VTklDQVRJT04sIEFVRElPX0ZMQUdfTk9ORSwgIiJ9LAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9VTktOT1dOLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9WT0lDRV9DT01NVU5JQ0FUSU9OLCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9WT0lDRV9DT01NVU5JQ0FUSU9OLCBBVURJT19GTEFHX05PTkUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9CiAgICAgICAgICAgICAgICAgKQogICAgICAgICApOwpAQCAtOTYyLDE0ICsxMzEyLDE1IEBACiAgICAgICAgIEF1ZGlvUG9saWN5TWFuYWdlclRlc3REUE1peFJlY29yZEluamVjdGlvbiwKICAgICAgICAgdGVzdGluZzo6VmFsdWVzKAogICAgICAgICAgICAgICAgIChhdWRpb19hdHRyaWJ1dGVzX3Qpe0FVRElPX0NPTlRFTlRfVFlQRV9VTktOT1dOLCBBVURJT19VU0FHRV9VTktOT1dOLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9WT0lDRV9SRUNPR05JVElPTiwgMCwgIiJ9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9WT0lDRV9SRUNPR05JVElPTiwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX1VOS05PV04sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0hPVFdPUkQsIDAsICIifSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfSE9UV09SRCwgQVVESU9fRkxBR19OT05FLCAiIn0sCiAgICAgICAgICAgICAgICAgKGF1ZGlvX2F0dHJpYnV0ZXNfdCl7QVVESU9fQ09OVEVOVF9UWVBFX1VOS05PV04sIEFVRElPX1VTQUdFX1VOS05PV04sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX1ZPSUNFX1JFQ09HTklUSU9OLCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElPX1NPVVJDRV9WT0lDRV9SRUNPR05JVElPTiwgQVVESU9fRkxBR19OT05FLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJhZGRyPXJlbW90ZV9zdWJtaXhfbWVkaWEifSwKICAgICAgICAgICAgICAgICAoYXVkaW9fYXR0cmlidXRlc190KXtBVURJT19DT05URU5UX1RZUEVfVU5LTk9XTiwgQVVESU9fVVNBR0VfVU5LTk9XTiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBVURJT19TT1VSQ0VfSE9UV09SRCwgMCwgImFkZHI9cmVtb3RlX3N1Ym1peF9tZWRpYSJ9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESU9fU09VUkNFX0hPVFdPUkQsIEFVRElPX0ZMQUdfTk9ORSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYWRkcj1yZW1vdGVfc3VibWl4X21lZGlhIn0KICAgICAgICAgICAgICAgICApCiAgICAgICAgICk7CiAKQEAgLTk4OCw2ICsxMzM5LDM0IEBACiAgICAgZHVtcFRvTG9nKCk7CiB9CiAKK1RFU1RfRihBdWRpb1BvbGljeU1hbmFnZXJUZXN0RGV2aWNlQ29ubmVjdGlvbiwgUm91dGluZ1VwZGF0ZSkgeworICAgIG1DbGllbnQtPnJlc2V0Um91dGluZ1VwZGF0ZWRDb3VudGVyKCk7CisgICAgLy8gQ29ubmVjdGluZyBhIHZhbGlkIG91dHB1dCBkZXZpY2Ugd2l0aCB2YWxpZCBwYXJhbWV0ZXJzIHNob3VsZCB0cmlnZ2VyIGEgcm91d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QgY2xlYXIgZGV2aWNlcworICAgIEFTU0VSVF9FUShOT19FUlJPUiwKKyAgICAgICAgICAgICAgbU1hbmFnZXItPmNsZWFyRGV2aWNlc1JvbGVGb3JDYXB0dXJlUHJlc2V0KGF1ZGlvU291cmNlLCByb2xlKSk7CisgICAgZGV2aWNlcy5jbGVhcigpOworICAgIEFTU0VSVF9FUShOQU1FX05PVF9GT1VORCwKKyAgICAgICAgICAgICAgbU1hbmFnZXItPmdldERldmljZXNGb3JSb2xlQW5kQ2FwdHVyZVByZXNldChhdWRpb1NvdXJjZSwgcm9sZSwgZGV2aWNlcykpOworfQorCitJTlNUQU5USUFURV9URVNUX0NBU0VfUCgKKyAgICAgICAgRGV2aWNlc1JvbGVGb3JDYXB0dXJlUHJlc2V0T3BlcmF0aW9uLAorICAgICAgICBBdWRpb1BvbGljeU1hbmFnZXJEZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXRUZXN0LAorICAgICAgICB0ZXN0aW5nOjpWYWx1ZXMoCisgICAgICAgICAgICAgICAgRGV2aWNlc1JvbGVGb3JDYXB0dXJlUHJlc2V0UGFyYW0oe0FVRElPX1NPVVJDRV9NSUMsIERFVklDRV9ST0xFX1BSRUZFUlJFRH0pLAorICAgICAgICAgICAgICAgIERldmljZXNSb2xlRm9yQ2FwdHVyZVByZXNldFBhcmFtKHtBVURJT19TT1VSQ0VfVk9JQ0VfVVBMSU5LLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBERVZJQ0VfUk9MRV9QUkVGRVJSRUR9KSwKKyAgICAgICAgICAgICAgICBEZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXRQYXJhbSh7QVVESU9fU09VUkNFX1ZPSUNFX0RPV05MSU5LLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBERVZJQ0VfUk9MRV9QUkVGRVJSRUR9KSwKKyAgICAgICAgICAgICAgICBEZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXRQYXJhbSh7QVVESU9fU09VUkNFX1ZPSUNFX0NBTEwsIERFVklDRV9ST0xFX1BSRUZFUlJFRH0pLAorICAgICAgICAgICAgICAgIERldmljZXNSb2xlRm9yQ2FwdHVyZVByZXNldFBhcmFtKHtBVURJT19TT1VSQ0VfQ0FNQ09SREVSLCBERVZJQ0VfUk9MRV9QUkVGRVJSRUR9KSwKKyAgICAgICAgICAgICAgICBEZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXRQYXJhbSh7QVVESU9fU09VUkNFX1ZPSUNFX1JFQ09HTklUSU9OLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBERVZJQ0VfUk9MRV9QUkVGRVJSRUR9KSwKKyAgICAgICAgICAgICAgICBEZXZpY2VzUm9sZUZvckNhcHR1cmVQcmVzZXRQYXJhbSh7QVVESU9fU09VUkNFX1ZPSUNFX0NPTU1VTklDQVRJT04sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERFVklDRV9ST0xFX1BSRUZFUlJFRH0pLAorICAgICAgICAgICAgICAgIERldmljZXNSb2xlRm9yQ2FwdHVyZVByZXNldFBhcmFtKHtBVURJT19TT1VSQ0VfUkVNT1RFX1NVQk1JWCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREVWSUNFX1JPTEVfUFJFRkVSUkVEfSksCisgICAgICAgICAgICAgICAgRGV2aWNlc1JvbGVGb3JDYXB0dXJlUHJlc2V0UGFyYW0oe0FVRElPX1NPVVJDRV9VTlBST0NFU1NFRCwgREVWSUNFX1JPTEVfUFJFRkVSUkVEfSksCisgICAgICAgICAgICAgICAgRGV2aWNlc1JvbGVGb3JDYXB0dXJlUHJlc2V0UGFyYW0oe0FVRElPX1NPVVJDRV9WT0lDRV9QRVJGT1JNQU5DRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICA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XZpY2UgcG9ydCBpbiB0aGUgInJfc3VibWl4IiBtb2R1bGUgc2VjdGlvbi4gLS0+Cis8YXVkaW9Qb2xpY3lDb25maWd1cmF0aW9uIHZlcnNpb249IjEuMCIgeG1sbnM6eGk9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWEluY2x1ZGUiPgorICAgIDxnbG9iYWxDb25maWd1cmF0aW9uIHNwZWFrZXJfZHJjX2VuYWJsZWQ9InRydWUiLz4KKworICAgIDxtb2R1bGVzPgorICAgICAgICA8IS0tIFByaW1hcnkgbW9kdWxlIC0tPgorICAgICAgICA8bW9kdWxlIG5hbWU9InByaW1hcnkiIGhhbFZlcnNpb249IjIuMCI+CisgICAgICAgICAgICA8YXR0YWNoZWREZXZpY2VzPgorICAgICAgICAgICAgICAgIDxpdGVtPlNwZWFrZXI8L2l0ZW0+CisgICAgICAgICAgICAgICAgPGl0ZW0+QnVpbHQtSW4gTWljPC9pdGVtPgorICAgICAgICAgICAgPC9hdHRhY2hlZERldmljZXM+CisgICAgICAgICAgICA8ZGVmYXVsdE91dHB1dERldmljZT5TcGVha2VyPC9kZWZhdWx0T3V0cHV0RGV2aWNlPgorICAgICAgICAgICAgPG1peFBvcnRzPgorICAgICAgICAgICAgICAgIDxtaXhQb3J0IG5hbWU9InByaW1hcnkgb3V0cHV0IiByb2xlPSJzb3VyY2UiIGZsYWdzPSJBVURJT19PVVRQVVRfRkxBR19QUklNQVJZIj4KKyAgICAgICAgICAgICAgICAgICAgPHByb2ZpbGUgbmFtZT0iIiBmb3JtYXQ9IkFVRElPX0ZPUk1BVF9QQ01fMTZfQklUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1wbGluZ1JhdGVzPSI0ODAwMCIgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX09VVF9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0icHJpbWFyeSBpbnB1dCIgcm9sZT0ic2luayI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iNDgwMDAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9JTl9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0ibWl4cG9ydF9idF9oZnBfb3V0cHV0IiByb2xlPSJzb3VyY2UiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbXBsaW5nUmF0ZXM9IjQ4MDAwIiBjaGFubmVsTWFza3M9IkFVRElPX0NIQU5ORUxfT1VUX1NURVJFTyIvPgorICAgICAgICAgICAgICAgIDwvbWl4UG9ydD4KKyAgICAgICAgICAgICAgICA8bWl4UG9ydCBuYW1lPSJtaXhwb3J0X2J0X2hmcF9pbnB1dCIgcm9sZT0ic2luayI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iODAwMCwxMTAyNSwxNjAwMCw0NDEwMCw0ODAwMCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbE1hc2tzPSJBVURJT19DSEFOTkVMX0lOX1NURVJFTyxBVURJT19DSEFOTkVMX0lOX01PTk8iLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICA8L21peFBvcnRzPgorICAgICAgICAgICAgPGRldmljZVBvcnRzPgorICAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IlNwZWFrZXIiIHR5cGU9IkFVRElPX0RFVklDRV9PVVRfU1BFQUtFUiIgcm9sZT0ic2luayI+CisgICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IkJ1aWx0LUluIE1pYyIgdHlwZT0iQVVESU9fREVWSUNFX0lOX0JVSUxUSU5fTUlDIiByb2xlPSJzb3VyY2UiPgorICAgICAgICAgICAgICAgIDwvZGV2aWNlUG9ydD4KKyAgICAgICAgICAgICAgICA8ZGV2aWNlUG9ydCB0YWdOYW1lPSJIZG1pIiB0eXBlPSJBVURJT19ERVZJQ0VfT1VUX0hETUkiIHJvbGU9InNpbmsiPgorICAgICAgICAgICAgICAgIDwvZGV2aWNlUG9ydD4KKyAgICAgICAgICAgICAgICA8ZGV2aWNlUG9ydCB0YWdOYW1lPSJIZG1pLUluIE1pYyIgdHlwZT0iQVVESU9fREVWSUNFX0lOX0hETUkiIHJvbGU9InNvdXJjZSI+CisgICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgICAgICAgICAgICAgIDxkZXZpY2VQb3J0IHRhZ05hbWU9IkJUIFNDTyIgdHlwZT0iQVVESU9fREVWSUNFX09VVF9CTFVFVE9PVEhfU0NPIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJvbGU9InNpbmsiIGFkZHJlc3M9ImhmcF9jbGllbnRfb3V0Ij4KKyAgICAgICAgICAgICAgICA8L2RldmljZVBvcnQ+CisgICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iQlQgU0NPIEhlYWRzZXQgTWljIiB0eXBlPSJBVURJT19ERVZJQ0VfSU5fQkxVRVRPT1RIX1NDT19IRUFEU0VUIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJvbGU9InNvdXJjZSIgYWRkcmVzcz0iaGZwX2NsaWVudF9pbiI+CisgICAgICAgICAgICAgICAgPC9kZXZpY2VQb3J0PgorICAgICAgICAgICAgPC9kZXZpY2VQb3J0cz4KKyAgICAgICAgICAgIDxyb3V0ZXM+CisgICAgICAgICAgICAgICAgPHJvdXRlIHR5cGU9Im1peCIgc2luaz0iU3BlYWtlciIKKyAgICAgICAgICAgICAgICAgICAgICAgc291cmNlcz0icHJpbWFyeSBvdXRwdXQiLz4KKyAgICAgICAgICAgICAgICA8cm91dGUgdHlwZT0ibWl4IiBzaW5rPSJwcmltYXJ5IGlucHV0IgorICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2VzPSJCdWlsdC1JbiBNaWMsSGRtaS1JbiBNaWMiLz4KKyAgICAgICAgICAgICAgICA8cm91dGUgdHlwZT0ibWl4IiBzaW5rPSJIZG1pIgorICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2VzPSJwcmltYXJ5IG91dHB1dCIvPgorICAgICAgICAgICAgICAgIDxyb3V0ZSB0eXBlPSJtaXgiIHNpbms9IkJUIFNDTyIKKyAgICAgICAgICAgICAgICAgICAgICAgc291cmNlcz0ibWl4cG9ydF9idF9oZnBfb3V0cHV0Ii8+CisgICAgICAgICAgICAgICAgPHJvdXRlIHR5cGU9Im1peCIgc2luaz0ibWl4cG9ydF9idF9oZnBfaW5wdXQiCisgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZXM9IkJUIFNDTyBIZWFkc2V0IE1pYyIvPgorICAgICAgICAgICAgPC9yb3V0ZXM+CisgICAgICAgIDwvbW9kdWxlPgorCisgICAgICAgIDwhLS0gUmVtb3RlIFN1Ym1peCBtb2R1bGUgLS0+CisgICAgICAgIDxtb2R1bGUgbmFtZT0icl9zdWJtaXgiIGhhbFZlcnNpb249IjIuMCI+CisgICAgICAgICAgICA8YXR0YWNoZWREZXZpY2VzPgorICAgICAgICAgICAgICAgIDxpdGVtPlJlbW90ZSBTdWJtaXggSW48L2l0ZW0+CisgICAgICAgICAgICA8L2F0dGFjaGVkRGV2aWNlcz4KKyAgICAgICAgICAgIDxtaXhQb3J0cz4KKyAgICAgICAgICAgICAgICA8bWl4UG9ydCBuYW1lPSJyX3N1Ym1peCBvdXRwdXQiIHJvbGU9InNvdXJjZSI+CisgICAgICAgICAgICAgICAgICAgIDxwcm9maWxlIG5hbWU9IiIgZm9ybWF0PSJBVURJT19GT1JNQVRfUENNXzE2X0JJVCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iNDgwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9PVVRfU1RFUkVPIi8+CisgICAgICAgICAgICAgICAgPC9taXhQb3J0PgorICAgICAgICAgICAgICAgIDxtaXhQb3J0IG5hbWU9InJfc3VibWl4IGlucHV0IiByb2xlPSJzaW5rIj4KKyAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxpbmdSYXRlcz0iNDgwMDAiIGNoYW5uZWxNYXNrcz0iQVVESU9fQ0hBTk5FTF9JTl9TVEVSRU8iLz4KKyAgICAgICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgIDwvbWl4UG9ydHM+CisgICAgICAgICAgIDxkZXZpY2VQb3J0cz4KKyAgICAgICAgICAgICAgIDwhLS0gVGhpcyBwb3J0IGlzIG1pc3NpbmcgInRhZ05hbWUiIGF0dHJpYnV0ZS4gLS0+CisgICAgICAgICAgICAgICA8ZGV2aWNlUG9ydCB0eXBlPSJBVURJT19ERVZJQ0VfT1VUX1JFTU9URV9TVUJNSVgiICByb2xlPSJzaW5rIj4KKyAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIGZvcm1hdD0iQVVESU9fRk9STUFUX1BDTV8xNl9CSVQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtcG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ICAgICAgICAgICA8L21peFBvcnQ+CisgICAgICAgICAgICAgICAgPG1peFBvcnQgbmFtZT0ibXVsdGljaGFubmVsIG91dHB1dCIgcm9sZT0ic291cmNlIgorICAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzPSJBVURJT19PVVRQVVRfRkxBR19ESVJFQ1QiPgorICAgICAgICAgICAgICAgICAgICA8cHJvZmlsZSBuYW1lPSIiIC8+CisgICAgICAgICAgICAgICAgPC9taXhQb3J0PgorICAgICAgICAgICAgPC9taXhQb3J0cz4KKyAgICAgICAgICAgIDxkZXZpY2VQb3J0cz4KKyAgICAgICAgICAgICAgICA8ZGV2aWNlUG9ydCB0YWdOYW1lPSJTdHViIiB0eXBlPSJBVURJT19ERVZJQ0VfT1VUX1NUVUIiIHJvbGU9InNpbmsiIC8+CisgICAgICAgICAgICAgICAgPGRldmljZVBvcnQgdGFnTmFtZT0iSERNSSIgdHlwZT0iQVVESU9fREVWSUNFX09VVF9IRE1JIiByb2xlPSJzaW5rIiAvPgorICAgICAgICAgICAgPC9kZXZpY2VQb3J0cz4KKyAgICAgICAgICAgIDxyb3V0ZXM+CisgICAgICAgICAgICAgICAgPHJvdXRlIHR5cGU9Im1peCIgc2luaz0iU3R1YiIgc291cmNlcz0icHJpbWFyeSBwY20iLz4KKyAgICAgICAgICAgICAgICA8cm91dGUgdHlwZT0ibWl4IiBzaW5rPSJIRE1JIiBzb3VyY2VzPSJwcmltYXJ5IHBjbSxtdWx0aWNoYW5uZWwgb3V0cHV0Ii8+CisgICAgICAgICAgICA8L3JvdXRlcz4KKyAgICAgICAgPC9tb2R1bGU+CisgICAgPC9tb2R1bGVzPgorPC9hdWRpb1BvbGljeUNvbmZpZ3VyYXRpb24+CmRpZmYgLS1naXQgYS9zZXJ2aWNlcy9jYW1lcmEvbGliY2FtZXJhc2VydmljZS9BbmRyb2lkLmJwIGIvc2VydmljZXMvY2FtZXJhL2xpYmNhbWVyYXNlcnZpY2UvQW5kcm9pZC5icAppbmRleCA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QgcmVzID0gbUNhbWVyYVByb3ZpZGVyTWFuYWdlci0+ZmlsdGVyU21hbGxKcGVnU2l6ZXMoY2FtZXJhSWQpOworICAgICAgICAgICAgaWYgKHJlcyA9PSBPSykgeworICAgICAgICAgICAgICAgIG1QZXJmQ2xhc3NQcmltYXJ5Q2FtZXJhSWRzLmluc2VydChjYW1lcmFJZCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIEFMT0dFKCIlczogRmFpbGVkIHRvIGZpbHRlciBzbWFsbCBKUEVHIHNpemVzIGZvciBwZXJmb3JtYW5jZSBjbGFzcyBwcmltYXJ5ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICJjYW1lcmEgJXM6ICVzKCVkKSIsIF9fRlVOQ1RJT05fXywgY2FtZXJhSWQuY19zdHIoKSwgc3RyZXJyb3IoLXJlcyksIHJlcyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChmYWNpbmcgPT0gaGFyZHdhcmU6OkNBTUVSQV9GQUNJTkdfQkFDSykgeworICAgICAgICAgICAgICAgIGZpcnN0UmVhckNhbWVyYVNlZW4gPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGZhY2luZyA9PSBoYXJkd2FyZTo6Q0FNRVJBX0ZBQ0lOR19GUk9OVCkgeworICAgICAgICAgICAgICAgIGZpcnN0RnJvbnRDYW1lcmFTZWVuID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChmaXJzdFJlYXJDYW1lcmFTZWVuICYmIGZpcnN0RnJvbnRDYW1lcmFTZWVuKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KK30KKwogdm9pZCBDYW1lcmFTZXJ2aWNlOjphZGRTdGF0ZXMoY29uc3QgU3RyaW5nOCBpZCkgewogICAgIHN0ZDo6c3RyaW5nIGNhbWVyYUlkKGlkLmNfc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dldENhbWVyYUNoYXJhY3RlcmlzdGljcygKLSAgICAgICAgICAgIFN0cmluZzgoY2FtZXJhSWQpLnN0cmluZygpLCBjYW1lcmFJbmZvKTsKKyAgICAgICAgICAgIGNhbWVyYUlkU3RyLCBvdmVycmlkZUZvclBlcmZDbGFzcywgY2FtZXJhSW5mbyk7CiAgICAgaWYgKHJlcyAhPSBPSykgewotICAgICAgICByZXR1cm4gU1RBVFVTX0VSUk9SX0ZNVChFUlJPUl9JTlZBTElEX09QRVJBVElPTiwgIlVuYWJsZSB0byByZXRyaWV2ZSBjYW1lcmEgIgotICAgICAgICAgICAgICAgICJjaGFyYWN0ZXJpc3RpY3MgZm9yIGRldmljZSAlczogJXMgKCVkKSIsIFN0cmluZzgoY2FtZXJhSWQpLnN0cmluZygpLAotICAgICAgICAgICAgICAgIHN0cmVycm9yKC1yZXMpLCByZXMpOworICAgICAgICBpZiAocmVzID09IE5BTUVfTk9UX0ZPVU5EKSB7CisgICAgICAgICAgICByZXR1cm4gU1RBVFVTX0VSUk9SX0ZNVChFUlJPUl9JTExFR0FMX0FSR1VNRU5ULCAiVW5hYmxlIHRvIHJldHJpZXZlIGNhbWVyYSAiCisgICAgICAgICAgICAgICAgICAgICJjaGFyYWN0ZXJpc3RpY3MgZm9yIHVua25vd24gZGV2aWNlICVzOiAlcyAoJWQpIiwgU3RyaW5nOChjYW1lcmFJZCkuc3RyaW5nKCksCisgICAgICAgICAgICAgICAgICAgIHN0cmVycm9yKC1yZXMpLCByZXMpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbG9nU2VydmljZUVycm9yKFN0cmluZzg6OmZvcm1hdCgiVW5hYmxlIHRvIHJldHJpZXZlIGNhbWVyYSBjaGFyYWN0ZXJpc3RpY3MgZm9yICIKKyAgICAgICAgICAgICJkZXZpY2UgJXMuIiwgU3RyaW5nOChjYW1lcmFJZCkuc3RyaW5nKCkpLEVSUk9SX0lOVkFMSURfT1BFUkFUSU9OKTsKKyAgICAgICAgICAgI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UNhbWVyYUlkLAotICAgICAgICAgICAgICAgICAgICAgICAgZmFjaW5nLCBjbGllbnRQaWQsIGNsaWVudFVpZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZpY2VQaWQpOworICAgICAgICAgICAgICAgICAgICAgICAgZmFjaW5nLCBzZW5zb3JPcmllbnRhdGlvbiwgY2xpZW50UGlkLCBjbGllbnRVaWQsCisgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2aWNlUGlkLCBvdmVycmlkZUZvclBlcmZDbGFzcyk7CiAgICAgICAgICAgICB9IGVsc2UgeyAvLyBDYW1lcmEyIEFQSSByb3V0ZQogICAgICAgICAgICAgICAgIHNwPGhhcmR3YXJlOjpjYW1lcmEyOjpJQ2FtZXJhRGV2aWNlQ2FsbGJhY2tzPiB0bXAgPQogICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8aGFyZHdhcmU6OmNhbWVyYTI6OklDYW1lcmFEZXZpY2VDYWxsYmFja3MqPihjYW1lcmFDYi5nZXQoKSk7CiAgICAgICAgICAgICAgICAgKmNsaWVudCA9IG5ldyBDYW1lcmFEZXZpY2VDbGllbnQoY2FtZXJhU2VydmljZSwgdG1wLCBwYWNrYWdlTmFtZSwgZmVhdHVyZUlkLAotICAgICAgICAgICAgICAgICAgICAgICAgY2FtZXJhSWQsIGZhY2luZywgY2xpZW50UGlkLCBjbGllbnRVaWQsIHNlcnZpY2VQaWQpOworICAgICAgICAgICAgICAgICAgICAgICAgY2FtZXJhSWQsIGZhY2luZywgc2Vuc29yT3JpZW50YXRpb24sIGNsaWVudFBpZCwgY2xpZW50VWlkLCBzZXJ2aWNlUGlkLAorICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGVGb3JQZXJmQ2xhc3MpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgIC8vIFNob3VsZCBub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Dwgb3duZXJQaWRzLnNpemUoKSAtIDE7IGkrKykgewogICAgICAgICAgICAgcGlkVG9Qcmlvcml0eU1hcC5lbXBsYWNlKG93bmVyUGlkc1tpXSwKICAgICAgICAgICAgICAgICAgICAgcmVzb3VyY2VfcG9saWN5OjpDbGllbnRQcmlvcml0eShwcmlvcml0eVNjb3Jlc1tpXSwgc3RhdGVzW2ldLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGlzVmVuZG9yQ2xpZW50IHdvbid0IGdldCBjb3BpZWQgb3ZlciovIGZhbHNlKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogaXNWZW5kb3JDbGllbnQgd29uJ3QgZ2V0IGNvcGllZCBvdmVyKi8gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogb29tU2NvcmVPZmZzZXQgd29uJ3QgZ2V0IGNvcGllZCBvdmVyKi8gMCkpOwogICAgICAgICB9CiAgICAgICAgIG1BY3RpdmVDbGllbnRNYW5hZ2VyLnVwZGF0ZVByaW9yaXRpZXMocGlkVG9Qcmlvcml0eU1hcCk7CiAKQEAgLTEzNDAsMTMgKzEzODIsMTYgQEAKICAgICAgICAgICAgIHJldHVybiBCQURfVkFMVUU7CiAgICAgICAgIH0KIAotICAgICAgICAvLyBNYWtlIGRlc2NyaXB0b3IgZm9yIGluY29taW5nIGNsaWVudAorICAgICAgICBpbnQzMl90IGFjdHVhbFNjb3JlID0gcHJpb3JpdHlTY29yZXNbcHJpb3JpdHlTY29yZXMuc2l6ZSgpIC0gMV07CisgICAgICAgIGludDMyX3QgYWN0dWFsU3RhdGUgPSBzdGF0ZXNbc3RhdGVzLnNpemUoKSAtIDFdOworCisgICAgICAgIC8vIE1ha2UgZGVzY3JpcHRvciBmb3IgaW5jb21pbmcgY2xpZW50LiBXZSBzdG9yZSB0aGUgb29tU2NvcmVPZmZzZXQKKyAgICAgICAgLy8gc2luY2Ugd2UgbWlnaHQgbmVlZCBpdCBsYXRlciBvbiBuZXcgaGFuZGxlRXZpY3Rpb25zTG9ja2VkIGFuZAorICAgICAgICAvLyBQcm9jZXNzSW5mb1NlcnZpY2Ugd291bGQgbm90IHRha2UgdGhhdCBpbnRvIGFjY291bnQuCiAgICAgICAgIGNsaWVudERlc2NyaXB0b3IgPSBDYW1lcmFDbGllbnRNYW5hZ2VyOjptYWtlQ2xpZW50RGVzY3JpcHRvcihjYW1lcmFJZCwKICAgICAgICAgICAgICAgICBzcDxCYXNpY0NsaWVudD57bnVsbHB0cn0sIHN0YXRpY19jYXN0PGludDMyX3Q+KHN0YXRlLT5nZXRDb3N0KCkpLAotICAgICAgICAgICAgICAgIHN0YXRlLT5nZXRDb25mbGljdGluZygpLAotICAgICAgICAgICAgICAgIHByaW9yaXR5U2NvcmVzW3ByaW9yaXR5U2NvcmVzLnNpemUoKSAtIDFdLAotICAgICAgICAgICAgICAgIGNsaWVudFBpZCwKLSAgICAgICAgICAgICAgICBzdGF0ZXNbc3RhdGVzLnNpemUoKSAtIDFdKTsKKyAgICAgICAgICAgICAgICBzdGF0ZS0+Z2V0Q29uZmxpY3RpbmcoKSwgYWN0dWFsU2NvcmUsIGNsaWVudFBpZCwgYWN0dWFsU3RhdGUsCisgICAgICAgICAgICAgICAgb29tU2NvcmVPZmZzZXQpOwogCiAgICAgICAgIHJlc291cmNlX3BvbGljeTo6Q2xpZW50UHJpb3JpdHkgY2xpZW50UHJpb3JpdHkgPSBjbGllbnREZXNjcmlwdG9yLT5nZXRQcmlvcml0eSgpOwogCkBAIC0xNDc5LDYgKzE1MjQsNyBAQAogICAgICAgICBjb25zdCBTdHJpbmcxNiYgY2xpZW50UGFja2FnZU5hbWUsCiAgICAgICAgIGludCBjbGllbnRVaWQsCiAgICAgICAgIGludCBjbGllbnRQaWQsCisgICAgICAgIGludCB0YXJnZXRTZGtWZXJzaW9uLAogICAgICAgICAvKm91dCovCiAgICAgICAgIHNwPElDYW1lcmE+KiBkZXZpY2UpIHsKIApAQCAtMTQ4OCwzN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MyICsxNjIwLDY5IEBACiAgICAgU3RyaW5nOCBpZCA9IFN0cmluZzgoY2FtZXJhSWQpOwogICAgIHNwPENhbWVyYURldmljZUNsaWVudD4gY2xpZW50ID0gbnVsbHB0cjsKICAgICBTdHJpbmcxNiBjbGllbnRQYWNrYWdlTmFtZUFkaiA9IGNsaWVudFBhY2thZ2VOYW1lOworICAgIGludCBjYWxsaW5nUGlkID0gQ2FtZXJhVGhyZWFkU3RhdGU6OmdldENhbGxpbmdQaWQoKTsKIAogICAgIGlmIChnZXRDdXJyZW50U2VydmluZ0NhbGwoKSA9PSBCaW5kZXJDYWxsVHlwZTo6SFdCSU5ERVIpIHsKICAgICAgICAgc3RkOjpzdHJpbmcgdmVuZG9yQ2xpZW50ID0KICAgICAgICAgICAgICAgICBTdHJpbmdQcmludGYoInZlbmRvci5jbGllbnQucGlkPCVkPiIsIENhbWVyYVRocmVhZFN0YXRlOjpnZXRDYWxsaW5nUGlkKCkpOwogICAgICAgICBjbGllbnRQYWNrYWdlTmFtZUFkaiA9IFN0cmluZzE2KHZlbmRvckNsaWVudC5jX3N0cigpKTsKICAgICB9CisKKyAgICBpZiAob29tU2NvcmVPZmZzZXQgPCAwKSB7CisgICAgICAgIFN0cmluZzggbXNnID0KKyAgICAgICAgICAgICAgICBTdHJpbmc4Ojpmb3JtYXQoIkNhbm5vdCBpbmNyZWFzZSB0aGUgcHJpb3JpdHkgb2YgYSBjbGllbnQgJXMgcGlkICVkIGZvciAiCisgICAgICAgICAgICAgICAgICAgICAgICAiY2FtZXJhIGlkICVzIiwgU3RyaW5nOChjbGllbnRQYWNrYWdlTmFtZUFkaikuc3RyaW5nKCksIGNhbGxpbmdQaWQsCisgICAgICAgICAgICAgICAgICAgICAgICBpZC5zdHJpbmcoKSk7CisgICAgICAgIEFMT0dFKCIlczogJXMiLCBfX0ZVTkNUSU9OX18sIG1zZy5zdHJpbmcoKSk7CisgICAgICAgIHJldHVybiBTVEFUVVNfRVJST1IoRVJST1JfSUxMRU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gICAgICAgIC8vIHJldGFpbiB0aGUgY29uZGl0aW9uIGJsb2NraW5nIG90aGVyIGNsaWVudHMgZnJvbSBjb25uZWN0aW5nCisgICAgICAgICAgICAvLyBpbiBtU2VydmljZUxvY2tXcmFwcGVyIGlmIGhlbGQuCisgICAgICAgICAgICBtU2VydmljZUxvY2sudW5sb2NrKCk7CisgICAgICAgICAgICAvLyBDbGVhciBjYWxsZXIgaWRlbnRpdHkgdGVtcG9yYXJpbHkgc28gY2xpZW50IGRpc2Nvbm5lY3QgUElECisgICAgICAgICAgICAvLyBjaGVja3Mgd29yayBjb3JyZWN0bHkKKyAgICAgICAgICAgIGludDY0X3QgdG9rZW4gPSBDYW1lcmFUaHJlYWRTdGF0ZTo6Y2xlYXJDYWxsaW5nSWRlbnRpdHkoKTsKKyAgICAgICAgICAgIC8vIE5vdGUgQXBwT3AgdG8gdHJpZ2dlciB0aGUgIlVuYmxvY2siIGRpYWxvZworICAgICAgICAgICAgY2xpZW50LT5ub3RlQXBwT3AoKTsKKyAgICAgICAgICAgIGNsaWVudC0+ZGlzY29ubmVjdCgpOworICAgICAgICAgICAgQ2FtZXJhVGhyZWFkU3RhdGU6OnJlc3RvcmVDYWxsaW5nSWRlbnRpdHkodG9rZW4pOworICAgICAgICAgICAgLy8gUmVhY3F1aXJlIG1TZXJ2aWNlTG9jaworICAgICAgICAgICAgbVNlcnZpY2VMb2NrLmxvY2soKTsKKworICAgICAgICAgICAgcmV0dXJuIFNUQVRVU19FUlJPUl9GTVQoRVJST1JfRElTQUJMRUQsCisgICAgICAgICAgICAgICAgICAgICJDYW1lcmEgXCIlc1wiIGRpc2FibGVkIGR1ZSB0byBjYW1lcmEgbXV0ZSIsIGNhbWVyYUlkLnN0cmluZygpKTsKICAgICAgICAgfQogCiAgICAgICAgIGlmIChzaGltVXBkYXRlT25seSkgewpAQCAtMTc4MSwxMyArMTg3NCwyMCBAQAogICAgICAgICAgICAgbVNlcnZpY2VMb2NrLmxvY2soKTsKICAgICAgIC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SBzZXJ2aWNlIGFib3V0IG9yaWVudGF0aW9uIgorICAgICAgICAgICAgICAgICAgICAiIGNoYW5nZXMgZnJvbSBwaWQ9JWQsIHVpZD0lZCIsIGNhbGxpbmdQaWQsIHVpZCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBNdXRleDo6QXV0b2xvY2sgbG9jayhtU2VydmljZUxvY2spOworCisgICAgLy8gRG9uJ3QgZG8gYW55dGhpbmcgaWYgcm90YXRlLWFuZC1jcm9wIG92ZXJyaWRlIHZpYSBjbWQgaXMgYWN0aXZlCisgICAgaWYgKG1PdmVycmlkZVJvdGF0ZUFuZENyb3BNb2RlICE9IEFORFJPSURfU0NBTEVSX1JPVEFURV9BTkRfQ1JPUF9BVVRPKSByZXR1cm4gU3RhdHVzOjpvaygpOworCisgICAgY29uc3QgYXV0byBjbGllbnRzID0gbUFjdGl2ZUNsaWVudE1hbmFnZXIuZ2V0QWxsKCk7CisgICAgZm9yIChhdXRvJiBjdXJyZW50IDogY2xpZW50cykgeworICAgICAgICBpZiAoY3VycmVudCAhPSBudWxscHRyKSB7CisgICAgICAgICAgICBjb25zdCBhdXRvIGJhc2ljQ2xpZW50ID0gY3VycmVudC0+Z2V0VmFsdWUoKTsKKyAgICAgICAgICAgIGlmIChiYXNpY0NsaWVudC5nZXQoKSAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgaWYgKENhbWVyYVNlcnZpY2VQcm94eVdyYXBwZXI6OmlzUm90YXRlQW5kQ3JvcE92ZXJyaWRlTmVlZGVkKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJhc2ljQ2xpZW50LT5nZXRQYWNrYWdlTmFtZSgpLCBiYXNpY0NsaWVudC0+Z2V0Q2FtZXJhT3JpZW50YXRpb24oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYXNpY0NsaWVudC0+Z2V0Q2FtZXJhRmFjaW5nKCkpKSB7CisgICAgICAgICAgICAgICAgICAgIGJhc2ljQ2xpZW50LT5z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AgICAgICAgICAgICAgICAgY2xpZW50RGVzY3JpcHRvci0+Z2V0UHJpb3JpdHkoKS5nZXRTY29yZSgpLAotICAgICAgICAgICAgICAgICAgICBjbGllbnREZXNjcmlwdG9yLT5nZXRQcmlvcml0eSgpLmdldFN0YXRlKCkpOwotICAgICAgICAgICAgZHByaW50ZihmZCwgIiAgICBDbGllbnQgUElEOiAlZFxuIiwgY2xpZW50RGVzY3JpcHRvci0+Z2V0T3duZXJJZCgpKTsKLQotICAgICAgICAgICAgYXV0byBjbGllbnQgPSBjbGllbnREZXNjcmlwdG9yLT5nZXRWYWx1ZSgpOwotICAgICAgICAgICAgZHByaW50ZihmZCwgIiAgICBDbGllbnQgcGFja2FnZTogJXNcbiIsCi0gICAgICAgICAgICAgICAgICAgIFN0cmluZzgoY2xpZW50LT5nZXRQYWNrYWdlTmFtZSgpKS5zdHJpbmcoKSk7Ci0KLSAgICAgICAgICAgIGNsaWVudC0+ZHVtcENsaWVudChmZCwgYXJncyk7CisgICAgICAgICAgICAvLyBsb2cgdGhlIGN1cnJlbnQgb3BlbiBzZXNzaW9uIGluZm8KKyAgICAgICAgICAgIGR1bXBPcGVuU2Vzc2lvbkNsaWVudExvZ3MoZmQsIGFyZ3MsIGNhbWVyYUlkKTsKICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGRwcmludGYoZmQsICIgIERldmljZSAlcyBpcyBjbG9zZWQsIG5vIGNsaWVudCBpbnN0YW5jZVxuIiwKLSAgICAgICAgICAgICAgICAgICAgY2FtZXJhSWQuc3RyaW5nKCkpOworICAgICAgICAgICAgZHVtcENsb3NlZFNlc3Npb25DbGllbnRMb2dzKGZkLCBjYW1lcmFJZCk7CiAgICAgICAgIH0KIAogICAgIH0KQEAgLTM2ODIsOSArNDA2Niw1NSBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQorCisgICAgYm9vbCBzZXJ2aWNlTG9ja2VkID0gdHJ5TG9jayhtU2VydmljZUxvY2spOworCisgICAgLy8gRHVtcCBpbmZvIGZyb20gcHJldmlvdXMgb3BlbiBzZXNzaW9ucy4KKyAgICAvLyBSZXBvc2l0aW9uIHRoZSBvZmZzZXQgdG8gYmVnaW5uaW5nIG9mIHRoZSBmaWxlIGJlZm9yZSByZWFkaW5nCisKKyAgICBpZiAoKG1NZW1GZCA+PSAwKSAmJiAobHNlZWsobU1lbUZkLCAwLCBTRUVLX1NFVCkgIT0gLTEpKSB7CisgICAgICAgIGRwcmludGYoZmQsICJcbioqKioqKioqKipEdW1wc3lzIGZyb20gcHJldmlvdXMgb3BlbiBzZXNzaW9uKioqKioqKioqKlxuIik7CisgICAgICAgIHNzaXplX3Qgc2l6ZV9yZWFkOworICAgICAgICBjaGFyIGJ1Zls0MDk2XTsKKyAgICAgICAgd2hpbGUgKChzaXplX3JlYWQgPSByZWFkKG1NZW1GZCwgYnVmLCAoc2l6ZW9mKGJ1ZikgLSAxKSkpID4gMCkgeworICAgICAgICAgICAgLy8gUmVhZCBkYXRhIGZyb20gZmlsZSB0byBhIHNtYWxsIGJ1ZmZlciBhbmQgd3JpdGUgaXQgdG8gZmQuCisgICAgICAgICAgICB3cml0ZShmZCwgYnVmLCBzaXplX3JlYWQpOworICAgICAgICAgICAgaWYgKHNpemVfcmVhZCA9PSAtMSkgeworICAgICAgICAgICAgICAgIEFMT0dFKCIlczogRXJyb3IgZHVyaW5nIHJlYWRpbmcgdGhlIGZpbGU6ICVzIiwgX19GVU5DVElPTl9fLCBzRmlsZU5hbWUpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGRwcmludGYoZmQsICJcbioqKioqKioqKipFbmQgb2YgRHVtcHN5cyBmcm9tIHByZXZpb3VzIG9wZW4gc2Vzc2lvbioqKioqKioqKipcbiIpOworICAgIH0gZWxzZSB7CisgICAgICAgIEFMT0dFKCIlczogRXJyb3IgZHVyaW5nIHJlYWRpbmcgdGhlIGZpbGU6ICVzIiwgX19GVU5DV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FJZHNdCiAgICAgICAgICAgICAoY29uc3QgU3RyaW5nOCYgY2FtZXJhSWQsIFN0YXR1c0ludGVybmFsIHN0YXR1cykgewogCkBAIC0zODEwLDggKzQyMjgsOCBAQAogICAgICAgICAgICAgICAgIGJvb2wgaXNWZW5kb3JMaXN0ZW5lciA9IGxpc3RlbmVyLT5pc1ZlbmRvckxpc3RlbmVyKCk7CiAgICAgICAgICAgICAgICAgaWYgKHNob3VsZFNraXBTdGF0dXNVcGRhdGVzKGRldmljZUtpbmQsIGlzVmVuZG9yTGlzdGVuZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lci0+Z2V0TGlzdGVuZXJQaWQoKSwgbGlzdGVuZXItPmdldExpc3RlbmVyVWlkKCkpIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAoaXNWZW5kb3JMaXN0ZW5lciAmJiAhc3VwcG9ydHNIQUwzKSkgewotICAgICAgICAgICAgICAgICAgICBBTE9HVigiU2tpcHBpbmcgZGlzY292ZXJ5IGNhbGxiYWNrIGZvciBzeXN0ZW0tb25seSBjYW1lcmEvSEFMMSBkZXZpY2UgJXMiLAorICAgICAgICAgICAgICAgICAgICAgICAgaXNWZW5kb3JMaXN0ZW5lcikgeworICAgICAgICAgICAgICAgICAgICBBTE9HVigiU2tpcHBpbmcgZGlzY292ZXJ5IGNhbGxiYWNrIGZvciBzeXN0ZW0tb25seSBjYW1lcmEgZGV2aWNlICVzIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW1lcmFJZC5jX3N0cigpKTsKICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgfQpAQCAtMzg4NywxNCArNDMwNSw2IEBACiAgICAgb25TdGF0dXNVcGRhdGVkTG9ja2VkKGNhbWVyYUlkLCBzdGF0dXMpOwogfQogCi12b2lkIENhbWVyYVNlcnZpY2U6OnVwZGF0ZVByb3h5RGV2aWNlU3RhdGUoaW50IG5ld1N0YXRlLAotICAgICAg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Y2sgbG9jayhtU2VydmljZUxvY2spOworCisgICAgbUltYWdlRHVtcE1hc2sgPSBtYXNrVmFsdWU7CisKKyAgICByZXR1cm4gT0s7Cit9CisKK3N0YXR1c190IENhbWVyYVNlcnZpY2U6OmhhbmRsZUdldEltYWdlRHVtcE1hc2soaW50IG91dCkgeworICAgIE11dGV4OjpBdXRvbG9jayBsb2NrKG1TZXJ2aWNlTG9jayk7CisKKyAgICByZXR1cm4gZHByaW50ZihvdXQsICJJbWFnZSBkdW1wIG1hc2s6ICVkXG4iLCBtSW1hZ2VEdW1wTWFzayk7Cit9CisKK3N0YXR1c190IENhbWVyYVNlcnZpY2U6OmhhbmRsZVNldENhbWVyYU11dGUoY29uc3QgVmVjdG9yPFN0cmluZzE2PiYgYXJncykgeworICAgIGludCBtdXRlVmFsdWUgPSBzdHJ0b2woU3RyaW5nOChhcmdzWzFdKSwgbnVsbHB0ciwgMTApOworICAgIGlmIChlcnJubyAhPSAwKSByZXR1cm4gQkFEX1ZBTFVFOworCisgICAgaWYgKG11dGVWYWx1ZSA8IDAgfHwgbXV0ZVZhbHVlID4gMSkgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICBNdXRleDo6QXV0b2xvY2sgbG9jayhtU2VydmljZUxvY2spOworCisgICAgbU92ZXJyaWRlQ2FtZXJhTXV0ZU1vZGUgPSAobXV0ZVZhbHVlID09IDEpOworCisgICAgY29uc3QgYXV0byBjbGllbnRzID0gbUFjdGl2ZUNsaWVudE1hbmFnZXIuZ2V0QWxsKCk7CisgICAgZm9yIChhdXRvJiBjdXJyZW50IDogY2xpZW50cykgeworICAgICAgICBpZiAoY3VycmVudCAhPSBudWxscHRyKSB7CisgICAgICAgICAgICBjb25zdCBhdXRvIGJhc2ljQ2xpZW50ID0gY3VycmVudC0+Z2V0VmFsdWUoKTsKKyAgICAgICAgICAgIGlmIChiYXNpY0NsaWVudC5nZXQoKSAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgaWYgKGJhc2ljQ2x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cmFJZFN0ciwKICAgICAgICAgICAgICAgICBpbnQgY2FtZXJhRmFjaW5nLAorICAgICAgICAgICAgICAgIGludCBzZW5zb3JPcmllbnRhdGlvbiwKICAgICAgICAgICAgICAgICBpbnQgY2xpZW50UGlkLAogICAgICAgICAgICAgICAgIHVpZF90IGNsaWVudFVpZCwKICAgICAgICAgICAgICAgICBpbnQgc2VydmljZVBpZCk7CkBAIC0zMTgsOCArMzQ0LDkgQEAKICAgICAgICAgc3RhdGljIHNwPENhbWVyYVNlcnZpY2U+ICAgICAgICBzQ2FtZXJhU2VydmljZTsKICAgICAgICAgY29uc3QgU3RyaW5nOCAgICAgICAgICAgICAgICAgICBtQ2FtZXJhSWRTdHI7CiAgICAgICAgIGNvbnN0IGludCAgICAgICAgICAgICAgICAgICAgICAgbUNhbWVyYUZhY2luZzsKKyAgICAgICAgY29uc3QgaW50ICAgICAgICAgICAgICAgICAgICAgICBtT3JpZW50YXRpb247CiAgICAgICAgIFN0cmluZzE2ICAgICAgICAgICAgICAgICAgICAgICAgbUNsaWVudFBhY2thZ2VOYW1lOwotICAgICAgICBzdGQ6OnVuaXF1ZV9wdHI8U3RyaW5nMTY+ICAgICAgIG1DbGllbnRGZWF0dXJlSWQ7CisgICAgICAgIHN0ZDo6b3B0aW9uYWw8U3RyaW5nMTY+ICAgICAgICAgbUNsaWVudEZlYXR1cmVJZDsKICAgICAgICAgcGlkX3QgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ2xpZW50UGlkOwogICAgICAgICBjb25zdCB1aWRfdCAgICAgICAgICAgICAgICAgICAgIG1DbGllbnRVaWQ7CiAgICAgICAgIGNvbnN0IHBpZF90ICAgICAgICAgICAgICAgICAgICAgbVNlcnZpY2VQaWQ7CkBAIC0zMzIsOSArMzU5LDIxIEBACiAgICAgICAgIC8vIC0gVGhlIGFwcC1zaWRlIEJpbmRlciBpbnRlcmZhY2UgdG8gcmVjZWl2ZSBjYWxsYmFja3MgZnJvbSB1cwogICAgICAgICBzcDxJ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U3RyZWFtaW5nOwogCiAgICAgICAgIC8vIElBcHBPcHNDYWxsYmFjayBpbnRlcmZhY2UsIGluZGlyZWN0ZWQgdGhyb3VnaCBvcExpc3RlbmVyCiAgICAgICAgIHZpcnR1YWwgdm9pZCBvcENoYW5nZWQoaW50MzJfdCBvcCwgY29uc3QgU3RyaW5nMTYmIHBhY2thZ2VOYW1lKTsKQEAgLTM5MSwxMCArNDMzLDExIEBACiAgICAgICAgIENsaWVudChjb25zdCBzcDxDYW1lcmFTZXJ2aWNlPiYgY2FtZXJhU2VydmljZSwKICAgICAgICAgICAgICAgICBjb25zdCBzcDxoYXJkd2FyZTo6SUNhbWVyYUNsaWVudD4mIGNhbWVyYUNsaWVudCwKICAgICAgICAgICAgICAgICBjb25zdCBTdHJpbmcxNiYgY2xpZW50UGFja2FnZU5hbWUsCi0gICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp1bmlxdWVfcHRyPFN0cmluZzE2PiYgY2xpZW50RmVhdHVyZUlkLAorICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6b3B0aW9uYWw8U3RyaW5nMTY+JiBjbGllbnRGZWF0dXJlSWQsCiAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nOCYgY2FtZXJhSWRTdHIsCiAgICAgICAgICAgICAgICAgaW50IGFwaTFDYW1lcmFJZCwKICAgICAgICAgICAgICAgICBpbnQgY2FtZXJhRmFjaW5nLAorICAgICAgICAgICAgICAgIGludCBzZW5zb3JPcmllbnRhdGlvbiwKICAgICAgICAgICAgICAgICBpbnQgY2xpZW50UGlkLAogICAgICAgICAgICAgICAgIHVpZF90IGNsaWVudFVpZCwKICAgICAgICAgICAgICAgICBpbnQgc2VydmljZVBpZCk7CkBAIC00MTUsNiArNDU4LDggQEAKICAgICAgICAgLy8gQ2hlY2sgd2hhdCBBUEkgbGV2ZWwgaXMgdXNlZCBmb3IgdGhpcyBjbGllbnQuIFRoaXMgaXMgdXNlZCB0byBkZXRlcm1pbmUgd2hpY2gK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T4mIGRhdGFQdHIpOwotCi0gICAgdm9pZCAgICAgICAgICAgICAgICAgICAgY29weUZyYW1lQW5kUG9zdENvcGllZEZyYW1lKAotICAgICAgICBpbnQzMl90IG1zZ1R5cGUsCi0gICAgICAgIGNvbnN0IHNwPGhhcmR3YXJlOjpJQ2FtZXJhQ2xpZW50PiYgY2xpZW50LAotICAgICAgICBjb25zdCBzcDxJTWVtb3J5SGVhcD4mIGhlYXAsCi0gICAgICAgIHNpemVfdCBvZmZzZXQsIHNpemVfdCBzaXplLAotICAgICAgICBjYW1lcmFfZnJhbWVfbWV0YWRhdGFfdCAqbWV0YWRhdGEpOwotCi0gICAgaW50ICAgICAgICAgICAgICAgICAgICAgZ2V0T3JpZW50YXRpb24oaW50IG9yaWVudGF0aW9uLCBib29sIG1pcnJvcik7Ci0KLSAgICBzdGF0dXNfdCAgICAgICAgICAgICAgICBzZXRQcmV2aWV3V2luZG93KAotICAgICAgICBjb25zdCBzcDxJQmluZGVyPiYgYmluZGVyLAotICAgICAgICBjb25zdCBzcDxBTmF0aXZlV2luZG93PiYgd2luZG93KTsKLQotCi0gICAgLy8gdGhlc2UgYXJlIGluaXRpYWxpemVkIGluIHRoZSBjb25zdHJ1Y3Rvci4KLSAgICBzcDxDYW1lcmFIYXJkd2FyZUludGVyZmFjZT4gICAgIG1IYXJkd2FyZTsgICAgICAgLy8gY2xlYXJlZCBhZnRlciBkaXNjb25uZWN0KCkKLSAgICBpbnQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QcmV2aWV3Q2FsbGJhY2tGbGFnOwotICAgIGludCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU9yaWVudGF0aW9uOyAgICAgLy8gQ3VycmVudCBkaXNwbGF5IG9yaWVudGF0aW9uCi0gICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUGxheVNodXR0ZXJTb3VuZDsKLSAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MZWdhY3lNb2RlOyAv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pc1NlbnNvclBpeGVsTW9kZUNvbnNpc3RlbnQoc3RyZWFtSWRzVXNlZEluUmVxdWVzdCwgaXQuc2V0dGluZ3MpKSB7CisgICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXM6IENhbWVyYSAlczogUmVxdWVzdCBzZXR0aW5ncyBDT05UUk9MX1NFTlNPUl9QSVhFTF9NT0RFIG5vdCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNvbnNpc3RlbnQgd2l0aCBjb25maWd1cmVkIHN0cmVhbXMuIFJlamVjdGluZyByZXF1ZXN0LiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19GVU5DVElPTl9fLCBpdC5pZC5jX3N0cigpKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNUQVRVU19FUlJPUihDYW1lcmFTZXJ2aWNlOjpFUlJPUl9JTExFR0FMX0FSR1VNRU5ULAorICAgICAgICAgICAgICAgICAgICAgICAgIlJlcXVlc3Qgc2V0dGluZ3MgQ09OVFJPTF9TRU5TT1JfUElYRUxfTU9ERSBhcmUgbm90IGNvbnNpc3RlbnQgd2l0aCAiCisgICAgICAgICAgICAgICAgICAgICAgICAic3RyZWFtcyBjb25maWd1cmVkIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCiAgICAgICAgICAgICBTdHJpbmc4IHBoeXNpY2FsSWQoaXQuaWQuY19zdHIoKSk7CiAgICAgICAgICAgICBpZiAocGh5c2ljYWxJZCAhPSBtRGV2aWNlLT5nZXRJZCgpKSB7CiAgICAgICAgICAgICAgICAgYXV0byBmb3VuZCA9IHN0ZDo6ZmluZChyZXF1ZXN0ZWRQaHlzaWNhbElkcy5iZWdpbigpLCByZXF1ZXN0ZWRQaHlzaWNhbElkcy5lbmQoKSwKQEAgLTQ3MCw3ICs1MTgsNyBAQAogfQogCiBiaW5kZXI6OlN0YXR1cyBDYW1lcmFEZXZpY2VDbGllbnQ6OmVuZENvbmZpZ3VyZShpbnQgb3Blcm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ciA6IGJ1ZmZlclByb2R1Y2VycykgewotICAgICAgICAgICAgc3A8U3VyZmFjZT4gc3VyZmFjZTsKLSAgICAgICAgICAgIGNvbnN0IENhbWVyYU1ldGFkYXRhICZwaHlzaWNhbERldmljZUluZm8gPSBnZXRNZXRhZGF0YShwaHlzaWNhbENhbWVyYUlkKTsKLSAgICAgICAgICAgIHJlcyA9IGNyZWF0ZVN1cmZhY2VGcm9tR2JwKHN0cmVhbUluZm8sIGlzU3RyZWFtSW5mb1ZhbGlkLCBzdXJmYWNlLCBidWZmZXJQcm9kdWNlciwKLSAgICAgICAgICAgICAgICAgICAgbG9naWNhbENhbWVyYUlkLAotICAgICAgICAgICAgICAgICAgICBwaHlzaWNhbENhbWVyYUlkLnNpemUoKSA+IDAgPyBwaHlzaWNhbERldmljZUluZm8gOiBkZXZpY2VJbmZvICk7Ci0KLSAgICAgICAgICAgIGlmICghcmVzLmlzT2soKSkKLSAgICAgICAgICAgICAgICByZXR1cm4gcmVzOwotCi0gICAgICAgICAgICBpZiAoIWlzU3RyZWFtSW5mb1ZhbGlkKSB7Ci0gICAgICAgICAgICAgICAgYm9vbCBpc0RlcHRoQ29tcG9zaXRlU3RyZWFtID0KLSAgICAgICAgICAgICAgICAgICAgICAgIGNhbWVyYTM6OkRlcHRoQ29tcG9zaXRlU3RyZWFtOjppc0RlcHRoQ29tcG9zaXRlU3RyZWFtKHN1cmZhY2UpOwotICAgICAgICAgICAgICAgIGJvb2wgaXNIZWljQ29tcG9zaXRlU3RyZWFtID0KLSAgICAgICAgICAgICAgICAgICAgICAgIGNhbWVyYTM6OkhlaWNDb21wb3NpdGVTdHJlYW06OmlzSGVpY0NvbXBvc2l0ZVN0cmVhbShzdXJmYWNlKTsKLSAgICAgICAgICAgICAgICBpZiAoaXNEZXB0aENvbXBvc2l0ZVN0cmVhbSB8fCBpc0hlaWNDb21wb3NpdGVTdHJlYW0pIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gV2UgbmVlZCB0byB0YWtlIGluIHRvIGFjY291bnQgdGhhdCBjb21wb3NpdGUgc3RyZWFtcyBjYW4gaGF2ZQotICAgICAgICAgICAgICAgICAgICAvLyBhZGRpdGlvbmFsIGludGVybmFsIGNhbWVyYSBzdHJlYW1zLgotICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxPdXRwdXRTdHJlYW1JbmZvPiBjb21wb3NpdGVTdHJlYW1zOwotICAgICAgICAgICAgICAgICAgICBpZiAoaXNEZXB0aENvbXBvc2l0ZVN0cmVhbSkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmV0ID0gY2FtZXJhMzo6RGVwdGhDb21wb3NpdGVTdHJlYW06OmdldENvbXBvc2l0ZVN0cmVhbUluZm8oc3RyZWFtSW5mbywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlSW5mbywgJmNvbXBvc2l0ZVN0cmVhbXMpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgcmV0ID0gY2FtZXJhMzo6SGVpY0NvbXBvc2l0ZVN0cmVhbTo6Z2V0Q29tcG9zaXRlU3RyZWFtSW5mbyhzdHJlYW1JbmZvLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZUluZm8sICZjb21wb3NpdGVTdHJlYW1zKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAocmV0ICE9IE9LKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmc4IG1zZyA9IFN0cmluZzg6OmZvcm1hdCgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNhbWVyYSAlczogRmFpbGVkIGFkZGluZyBjb21wb3NpdGUgc3RyZWFtczogJXMgKCVkKSIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2ljYWxDYW1lcmFJZC5zdHJpbmcoKSwgc3RyZXJyb3IoLXJldCksIHJldCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXM6ICVzIiwgX19GVU5DVElPTl9fLCBtc2cuc3RyaW5nKCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNUQVRVU19FUlJPUihDYW1lcmFTZXJ2aWNlOjpFUlJPUl9JTExFR0FMX0FSR1VNRU5ULCBtc2cuc3RyaW5nKCkpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGNvbXBvc2l0ZVN0cmVhbXMuc2l6ZSgpID09IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIE5vIGludGVybmFsIHN0cmVhbXMgbWVhbnMgY29tcG9zaXRlIHN0cmVhbSBub3QKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHN1cHBvcnRlZC4KLSAgICAgICAgICAgICAgICAgICAgICAgICp1bnN1cHBvcnRlZCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYmluZGVyOjpTdGF0dXM6Om9rKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY29tcG9zaXRlU3RyZWFtcy5zaXplKCkgPiAxKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW1Db3VudCArPSBjb21wb3NpdGVTdHJlYW1zLnNpemUoKSAtIDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW1Db25maWd1cmF0aW9uLnN0cmVhbXMucmVzaXplKHN0cmVhbUNvdW50KTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgYXV0byYgY29tcG9zaXRlU3RyZWFtIDogY29tcG9zaXRlU3RyZWFtcykgewotICAgICAgICAgICAgICAgICAgICAgICAgbWFwU3RyZWFtSW5mbyhjb21wb3NpdGVTdHJlYW0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PGNhbWVyYTNfc3RyZWFtX3JvdGF0aW9uX3Q+IChpdC5nZXRSb3RhdGlvbigpKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGh5c2ljYWxDYW1lcmFJZCwgJnN0cmVhbUNvbmZpZ3VyYXRpb24uc3RyZWFtc1tzdHJlYW1JZHgrK10pOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbWFwU3RyZWFtSW5mbyhzdHJlYW1JbmZvLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PGNhbWVyYTNfc3RyZWFtX3JvdGF0aW9uX3Q+IChpdC5nZXRSb3RhdGlvbigpKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaHlzaWNhbENhbWVyYUlkLCAmc3RyZWFtQ29uZmlndXJhdGlvbi5zdHJlYW1zW3N0cmVhbUlkeCsrXSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlzU3RyZWFtSW5mb1ZhbGlkID0gdHJ1ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLSAgICByZXR1cm4gYmluZGVyOjpTdGF0dXM6Om9rKCk7Ci19Ci0KIGJpbmRlcjo6U3RhdHVzIENhbWVyYURldmljZUNsaWVudDo6aXNTZXNzaW9uQ29uZmlndXJhdGlvblN1cHBvcnRlZCgKICAgICAgICAgY29uc3QgU2Vzc2lvbkNvbmZpZ3VyYXRpb24mIHNlc3Npb25Db25maWd1cmF0aW9uLCBib29sICpzdGF0dXMgLypvdXQqLykgewotICAgIEFUUkFDRV9DQUxMKCk7CiAKKyAgICBBVFJBQ0VfQ0FMTCgpOwogICAgIGJpbmRlcjo6U3RhdHVzIHJlczsKICAgICBzdGF0dXNfdCByZXQgPSBPSzsKICAgICBpZiAoIShyZXMgPSBjaGVja1BpZFN0YXR1cyhfX0ZVTkNUSU9OX18pKS5pc09rKCkpIHJldHVybiBy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9IDA7IGkgPCBzdHJlYW1Db25maWdzLmNvdW50OyBpICs9IDQpIHsKLSAgICAgICAgaW50MzJfdCBmbXQgPSBzdHJlYW1Db25maWdzLmRhdGEuaTMyW2ldOwotICAgICAgICBpbnQzMl90IHcgPSBzdHJlYW1Db25maWdzLmRhdGEuaTMyW2kgKyAxXTsKLSAgICAgICAgaW50MzJfdCBoID0gc3RyZWFtQ29uZmlncy5kYXRhLmkzMltpICsgMl07Ci0KLSAgICAgICAgLy8gSWdub3JlIGlucHV0L291dHB1dCB0eXBlIGZvciBub3cKLSAgICAgICAgaWYgKGZtdCA9PSBmb3JtYXQpIHsKLSAgICAgICAgICAgIGlmICh3ID09IHdpZHRoICYmIGggPT0gaGVpZ2h0KSB7Ci0gICAgICAgICAgICAgICAgYmVzdFdpZHRoID0gd2lkdGg7Ci0gICAgICAgICAgICAgICAgYmVzdEhlaWdodCA9IGhlaWdodDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAodyA8PSBST1VORElOR19XSURUSF9DQVAgJiYgKGJlc3RXaWR0aCA9PSAtMSB8fAotICAgICAgICAgICAgICAgICAgICBDYW1lcmFEZXZpY2VDbGllbnQ6OmV1Y2xpZERpc3RTcXVhcmUodywgaCwgd2lkdGgsIGhlaWdodCkgPAotICAgICAgICAgICAgICAgICAgICBDYW1lcmFEZXZpY2VDbGllbnQ6OmV1Y2xpZERpc3RTcXVhcmUoYmVzdFdpZHRoLCBiZXN0SGVpZ2h0LCB3aWR0aCwgaGVpZ2h0KSkpIHsKLSAgICAgICAgICAgICAgICBiZXN0V2lkdGggPSB3OwotICAgICAgICAgICAgICAgIGJlc3RIZWlnaHQgPSBoOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgaWYgKGJlc3RXaWR0aCA9PSAtMSkgewotICAgICAgICAvLyBSZXR1cm4gZmFsc2UgaWYgbm8gY29uZmlndXJhdGlvbnMgZm9yIHRoaXMgZm9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VVRURVJfTEFHOgorICAgICAgICAgICAgKnRlbXBJZCA9IGNhbWVyYV9yZXF1ZXN0X3RlbXBsYXRlX3Q6OkNBTUVSQV9URU1QTEFURV9aRVJPX1NIVVRURVJfTEFHOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgSUNhbWVyYURldmljZVVzZXI6OlRFTVBMQVRFX01BTlVBTDoKKyAgICAgICAgICAgICp0ZW1wSWQgPSBjYW1lcmFfcmVxdWVzdF90ZW1wbGF0ZV90OjpDQU1FUkFfVEVNUExBVEVfTUFOVUFMOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICByZXQgPSBTVEFUVVNfRVJST1JfRk1UKENhbWVyYVNlcnZpY2U6OkVSUk9SX0lMTEVHQUxfQVJHVU1FTlQsCisgICAgICAgICAgICAgICAgICAgICJDYW1lcmEgJXM6IFRlbXBsYXRlIElEICVkIGlzIGludmFsaWQgb3Igbm90IHN1cHBvcnRlZCIsCisgICAgICAgICAgICAgICAgICAgIG1DYW1lcmFJZFN0ci5zdHJpbmcoKSwgdGVtcGxhdGVJZCk7CisgICAgICAgICAgICByZXR1cm4gcmV0OworICAgIH0KKworICAgIHJldHVybiByZXQ7Cit9CisKK2NvbnN0IENhbWVyYU1ldGFkYXRhICZDYW1lcmFEZXZpY2VDbGllbnQ6OmdldFN0YXRpY0luZm8oY29uc3QgU3RyaW5nOCAmY2FtZXJhSWQpIHsKKyAgICBpZiAobURldmljZS0+Z2V0SWQoKSA9PSBjYW1lcmFJZCkgeworICAgICAgICByZXR1cm4gbURldmljZS0+aW5mbygpOworICAgIH0KKyAgICByZXR1cm4gbURldmljZS0+aW5mb1BoeXNpY2FsKGNhbWVyYUlkKTsKK30KKworYm9vbCBDYW1lcmFEZXZpY2VDbGllbnQ6OmlzVWx0cmFIaWdoUmVzb2x1dGlvblNlbnNvcihjb25zdCBTdHJpbmc4ICZjYW1lcmFJZCkgeworICAgIGNvbnN0IENh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RlKSB7CisgICAgICAgIEFMT0dFKCIlczogc2Vuc29yIHBpeGVsIG1vZGVzIGRvbid0IGNvbnRhaW4gZWl0aGVyIG1heGltdW0gcmVzb2x1dGlvbiBvciBkZWZhdWx0IG1vZGVzIiwKKyAgICAgICAgICAgICAgICBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgIH0KKworICAgIGlmIChoYXNEZWZhdWx0U2Vuc29yUGl4ZWxNb2RlKSB7CisgICAgICAgIGF1dG8gcmV0ID0gZ2V0TWF0Y2hpbmdEZXB0aFNpemUod2lkdGgsIGhlaWdodCwgZGVwdGhTaXplcywgJmNob3NlbkRlcHRoV2lkdGgsCisgICAgICAgICAgICAgICAgJmNob3NlbkRlcHRoSGVpZ2h0KTsKKyAgICAgICAgaWYgKHJldCAhPSBPSykgeworICAgICAgICAgICAgQUxPR0UoIiVzOiBObyBtYXRjaGluZyBkZXB0aCBzdHJlYW0gc2l6ZSBmb3VuZCIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgICAgICByZXR1cm4gcmV0OworICAgICAgICB9CisgICAgfQorCisgICAgaWYgKGhhc01heGltdW1SZXNvbHV0aW9uU2Vuc29yUGl4ZWxNb2RlKSB7CisgICAgICAgIHNpemVfdCBkZXB0aFdpZHRoID0gMCwgZGVwdGhIZWlnaHQgPSAwOworICAgICAgICBhdXRvIHJldCA9IGdldE1hdGNoaW5nRGVwdGhTaXplKHdpZHRoLCBoZWlnaHQsCisgICAgICAgICAgICAgICAgZGVwdGhTaXplc01heGltdW1SZXNvbHV0aW9uLCAmZGVwdGhXaWR0aCwgJmRlcHRoSGVpZ2h0KTsKKyAgICAgICAgaWYgKHJldCAhPSBPSykgeworICAgICAgICAgICAgQUxPR0UoIiVzOiBObyBtYXRjaGluZyBtYXggcmVzb2x1dGlvbiBkZXB0aCBzdHJlYW0gc2l6ZSBmb3VuZCIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgICAgICByZXR1cm4gc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XNVbHRyYUhpZ2hSZXNvbHV0aW9uU2Vuc29yKGNoKSkgeworICAgICAgICBnZXRTdXBwb3J0ZWREZXB0aFNpemVzKGNoLCAvKm1heFJlc29sdXRpb24qL3RydWUsICZkZXB0aFNpemVzTWF4aW11bVJlc29sdXRpb24pOworICAgICAgICBpZiAoZGVwdGhTaXplc01heGltdW1SZXNvbHV0aW9uLmVtcHR5KCkpIHsKKyAgICAgICAgICAgIEFMT0dFKCIlczogTm8gZGVwdGggc3RyZWFtIGNvbmZpZ3VyYXRpb25zIGZvciBtYXhpbXVtIHJlc29sdXRpb24gcHJlc2VudCIsCisgICAgICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXyk7CisgICAgICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOworICAgICAgICB9CisgICAgfQorCisgICAgc2l6ZV90IGNob3NlbkRlcHRoV2lkdGggPSAwLCBjaG9zZW5EZXB0aEhlaWdodCA9IDA7CisgICAgYXV0byByZXQgPSBjaGVja0FuZEdldE1hdGNoaW5nRGVwdGhTaXplKHN0cmVhbUluZm8ud2lkdGgsIHN0cmVhbUluZm8uaGVpZ2h0LCBkZXB0aFNpemVzLAorICAgICAgICAgICAgZGVwdGhTaXplc01heGltdW1SZXNvbHV0aW9uLCBzdHJlYW1JbmZvLnNlbnNvclBpeGVsTW9kZXNVc2VkLCAmY2hvc2VuRGVwdGhXaWR0aCwKKyAgICAgICAgICAgICZjaG9zZW5EZXB0aEhlaWdodCk7CisKICAgICBpZiAocmV0ICE9IE9LKSB7Ci0gICAgICAgIEFMT0dFKCIlczogTm8gbWF0Y2hpbmcgZGVwdGggc3RyZWFtIHNpemUgZm91bmQiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICBBTE9HRSgiJXM6IENvdWxkbid0IGdldCBtYXRjaGluZyBkZXB0aCBzaXplcyIsIF9fRlVOQ1RJT05fXyk7CiAgICAgICAgIHJldHVybiByZXQ7CiAgICAgfQogCiAgICAgY29tcG9zaXRlT3V0cHV0LT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Jpbmc4JiBjYW1lcmFJZCwKICAgICAgICAgICAgICAgICAgICAgICBpbnQgYXBpMUNhbWVyYUlkLAogICAgICAgICAgICAgICAgICAgICAgIGludCBjYW1lcmFGYWNpbmcsCisgICAgICAgICAgICAgICAgICAgICAgaW50IHNlbnNvck9yaWVudGF0aW9uLAogICAgICAgICAgICAgICAgICAgICAgIGludCBjbGllbnRQaWQsCiAgICAgICAgICAgICAgICAgICAgICAgdWlkX3QgY2xpZW50VWlkLAotICAgICAgICAgICAgICAgICAgICAgIGludCBzZXJ2aWNlUGlkKTsKKyAgICAgICAgICAgICAgICAgICAgICBpbnQgc2VydmljZVBpZCwKKyAgICAgICAgICAgICAgICAgICAgICBib29sIG92ZXJyaWRlRm9yUGVyZkNsYXNzKTsKICAgICB2aXJ0dWFsIH5DYW1lcmEyQ2xpZW50QmFzZSgpOwogCiAgICAgdmlydHVhbCBzdGF0dXNfdCAgICAgIGluaXRpYWxpemUoc3A8Q2FtZXJhUHJvdmlkZXJNYW5hZ2VyPiBtYW5hZ2VyLCBjb25zdCBTdHJpbmc4JiBtb25pdG9yVGFncyk7CkBAIC02Niw3ICs2OCwxMCBAQAogCiAgICAgdmlydHVhbCB2b2lkICAgICAgICAgIG5vdGlmeUVycm9yKGludDMyX3QgZXJyb3JDb2RlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBDYXB0dXJlUmVzdWx0RXh0cmFzJiByZXN1bHRFeHRyYXMpOwotICAgIHZpcnR1YWwgdm9pZCAgICAgICAgICBub3RpZnlJZGxlKCk7CisgICAgdmlydHVhbCBzdGF0dXNfdCAgICAgIG5vdGlmeUFjdGl2ZSgpOyAgLy8gUmV0dXJucyBlcnJvcnMgb24gYXBwIG9wcyBwZXJtaXNzaW9uIGZhaWx1cmVzCisgICAgdmlydHVhbCB2b2lkICAgICAgICAgIG5vdGlmeUlkbGUoaW50NjRfdCByZXF1ZXN0Q291bnQsIGludDY0X3QgcmVzdWx0RXJyb3J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mlkZXJJbnN0YW5jZUlkKTsKKyAgICBib29sIHByb3ZpZGVyUHJlc2VudCA9IGZhbHNlOworICAgIGZvciAoY29uc3QgYXV0byYgcHJvdmlkZXJJbmZvIDogbVByb3ZpZGVycykgeworICAgICAgICBpZiAocHJvdmlkZXJJbmZvLT5tUHJvdmlkZXJOYW1lID09IG5ld1Byb3ZpZGVyKSB7CisgICAgICAgICAgICBBTE9HVygiJXM6IENhbWVyYSBwcm92aWRlciBIQUwgd2l0aCBuYW1lICclcycgYWxyZWFkeSByZWdpc3RlcmVkIiwKKyAgICAgICAgICAgICAgICAgICAgX19GVU5DVElPTl9fLCBuZXdQcm92aWRlci5jX3N0cigpKTsKKyAgICAgICAgICAgIGlmIChwcmVleGlzdGluZykgeworICAgICAgICAgICAgICAgIHJldHVybiBBTFJFQURZX0VYSVNUUzsKKyAgICAgICAgICAgIH0gZWxzZXsKKyAgICAgICAgICAgICAgICBBTE9HVygiJXM6IFRoZSBuZXcgcHJvdmlkZXIgaW5zdGFuY2Ugd2lsbCBnZXQgaW5pdGlhbGl6ZWQgaW1tZWRpYXRlbHkgYWZ0ZXIgdGhlIgorICAgICAgICAgICAgICAgICAgICAgICAgIiBjdXJyZW50bHkgcHJlc2VudCBpbnN0YW5jZSBpcyByZW1vdmVkISIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgICAgICAgICAgcHJvdmlkZXJQcmVzZW50ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHNwPFByb3ZpZGVySW5mbz4gcHJvdmlkZXJJbmZvID0gbmV3IFByb3ZpZGVySW5mbyhuZXdQcm92aWRlciwgcHJvdmlkZXJJbnN0YW5jZSwgdGhpcyk7CisgICAgaWYgKCFwcm92aWRlclByZXNlbnQpIHsKKyAgICAgICAgc3RhdHVzX3QgcmVzID0gdHJ5VG9Jbml0aWFsaXplUHJvdmlkZXJMb2NrZWQobmV3UHJvdmlkZXIsIHByb3ZpZGVySW5mbyk7CisgICAgICAgIGlmIChyZXMgIT0gT0spIHsKKyAgICAgICAgICAgIHJldHVybiByZXM7CisgICAgICAgIH0KICAgICB9CiAKICAgICBtUHJvdmlkZXJzLnB1c2hfYmFjayhwcm92aWRlckluZm8pOworICAgIG1Qcm92aWRlckluc3RhbmNlSWQrKzsKIAogICAgIHJldHVybiBPSzsKIH0KQEAgLTEyNjQsMTIgKzEyOTEsMTQgQEAKICAgICBzdGQ6OnVuaXF1ZV9sb2NrPHN0ZDo6bXV0ZXg+IGxvY2sobUludGVyZmFjZU11dGV4KTsKICAgICBzdGQ6OnZlY3RvcjxTdHJpbmc4PiByZW1vdmVkRGV2aWNlSWRzOwogICAgIHN0YXR1c190IHJlcyA9IE5BTUVfTk9UX0ZPVU5EOworICAgIHN0ZDo6c3RyaW5nIHJlbW92ZWRQcm92aWRlck5hbWU7CiAgICAgZm9yIChhdXRvIGl0ID0gbVByb3ZpZGVycy5iZWdpbigpOyBpdCAhPSBtUHJvdmlkZXJzLmVuZCgpOyBpdCsrKSB7Ci0gICAgICAgIGlmICgoKml0KS0+bVByb3ZpZGVyTmFtZSA9PSBwcm92aWRlcikgeworICAgICAgICBpZiAoKCppdCktPm1Qcm92aWRlckluc3RhbmNlID09IHByb3ZpZGVyKSB7CiAgICAgICAgICAgICByZW1vdmVkRGV2aWNlSWRzLnJlc2VydmUoKCppdCktPm1EZXZpY2VzLnNpemUoKSk7CiAgICAgICAgICAgICBmb3IgKGF1dG8mIGRldmljZUluZm8gOiAoKml0KS0+bURldmljZXMpIHsKICAgICAgICAgICAgICAgICByZW1vdmVkRGV2aWNlSWRzLnB1c2hfYmFjayhTdHJpbmc4KGRldmljZUluZm8tPm1JZC5jX3N0cigpKSk7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICByZW1vdmVkUHJvdmlkZXJOYW1lID0gKCppdCktPm1Qcm92aWRlck5hbWU7CiAgICAgICAgICAgICBtUHJvdmlkZXJzLmVyY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Byb3ZpZGVyPiBpbnRlcmZhY2UyXzcgPSBjYXN0Ml83OworICAgICAgICAgICAgaWYgKGludGVyZmFjZTJfNyAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgbU1pbm9yVmVyc2lvbiA9IDc7CisgICAgICAgICAgICB9CisgICAgICAgIH0KICAgICB9CiAKICAgICAvLyBjYW1lcmFEZXZpY2VTdGF0dXNDaGFuZ2UgY2FsbGJhY2tzIG1heSBiZSBjYWxsZWQgKGFuZCBjYXVzaW5nIG5ldyBkZXZpY2VzIGFkZGVkKQpAQCAtMTU2Nyw5ICsxNjE2LDkgQEAKICAgICBzdGQ6OnVuaXF1ZV9wdHI8RGV2aWNlSW5mbz4gZGV2aWNlSW5mbzsKICAgICBzd2l0Y2ggKG1ham9yKSB7CiAgICAgICAgIGNhc2UgMToKLSAgICAgICAgICAgIGRldmljZUluZm8gPSBpbml0aWFsaXplRGV2aWNlSW5mbzxEZXZpY2VJbmZvMT4obmFtZSwgbVByb3ZpZGVyVGFnaWQsCi0gICAgICAgICAgICAgICAgICAgIGlkLCBtaW5vcik7Ci0gICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIEFMT0dFKCIlczogRGV2aWNlICVzOiBVbnN1cHBvcnRlZCBISURMIGRldmljZSBIQUwgbWFqb3IgdmVyc2lvbiAlZDoiLCBfX0ZVTkNUSU9OX18sCisgICAgICAgICAgICAgICAgICAgIG5hbWUuY19zdHIoKSwgbWFqb3IpOworICAgICAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgZGV2aWNlSW5mbyA9IGluaXRpYWxpemVEZXZpY2VJbmZvPERldmljZUluZm8zPihuYW1lLCBtUHJvdmlkZXJUYWdpZCwKICAgICAgICAgICAgICAgICAgICAgaWQsIG1pbm9yKTsKQEAgLTE2MTgsNyArMTY2Nyw3IEBACiAKIHN0YXR1c190IENhbWVyYVByb3ZpZGVyTWFuYWdlcjo6UHJvdmlkZ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ICBzcDxwcm92aWRlcjo6VjJfNjo6SUNhbWVyYVByb3ZpZGVyPiBpbnRlcmZhY2VfMl82ID0gY2FzdFJlc3VsdDsKLSAgICAgICAgICAgIGlmIChpbnRlcmZhY2VfMl82ICE9IG51bGxwdHIpIHsKLSAgICAgICAgICAgICAgICBTdGF0dXMgY2FsbFN0YXR1czsKLSAgICAgICAgICAgICAgICBhdXRvIGNiID0KLSAgICAgICAgICAgICAgICAgICAgICAgIFsmaXNTdXBwb3J0ZWQsICZjYWxsU3RhdHVzXShTdGF0dXMgcywgYm9vbCBzdXBwb3J0ZWQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxTdGF0dXMgPSBzOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKmlzU3VwcG9ydGVkID0gc3VwcG9ydGVkOyB9OworICAgICAgICBhdXRvIGNhc3RSZXN1bHQyXzYgPSBwcm92aWRlcjo6VjJfNjo6SUNhbWVyYVByb3ZpZGVyOjpjYXN0RnJvbShpbnRlcmZhY2UpOworICAgICAgICBhdXRvIGNhc3RSZXN1bHQyXzcgPSBwcm92aWRlcjo6VjJfNzo6SUNhbWVyYVByb3ZpZGVyOjpjYXN0RnJvbShpbnRlcmZhY2UpOworICAgICAgICBTdGF0dXMgY2FsbFN0YXR1czsKKyAgICAgICAgYXV0byBjYiA9CisgICAgICAgICAgICAgICAgWyZpc1N1cHBvcnRlZCwgJmNhbGxTdGF0dXNdKFN0YXR1cyBzLCBib29sIHN1cHBvcnRlZCkgeworICAgICAgICAgICAgICAgICAgICAgIGNhbGxTdGF0dXMgPSBzOworICAgICAgICAgICAgICAgICAgICAgICppc1N1cHBvcnRlZCA9IHN1cHBvcnRlZDsgfTsKIAotICAgICAgICAgICAgICAgIGF1dG8gcmV0ID0gIGludGVyZmFjZV8yXzYtPmlzQ29uY3VycmVudFN0cmVhbUNvbWJpbmF0aW9uU3VwcG9ydGVkKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbENhbWVyYUlkc0FuZFN0cmVhbUNvbWJpbmF0aW9ucywgY2IpOwotICAgICAgICAgICAgICAgIGlmIChyZXQuaXNPaygpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoY2FsbFN0YXR1cykgewotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBTdGF0dXM6Ok9LOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEV4cGVjdGVkIGNhc2UsIGRvIG5vdGhpbmcuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzID0gT0s7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFN0YXR1czo6TUVUSE9EX05PVF9TVVBQT1JURUQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzID0gSU5WQUxJRF9PUEVSQVRJT047Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dFKCIlczogU2Vzc2lvbiBjb25maWd1cmF0aW9uIHF1ZXJ5IGZhaWxlZDogJWQiLCBfX0ZVTkNUSU9OX18sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxTdGF0dXMpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcyA9IFVOS05PV05fRVJST1I7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXM6IFVuZXhwZWN0ZWQgYmluZGVyIGVycm9yOiAlcyIsIF9fRlVOQ1RJT05fXywgcmV0LmRlc2NyaXB0aW9uKCkuY19zdHIoKSk7Ci0gICAgICAgICAgICAgICAgICAgIHJlcyA9IFVOS05PV05fRVJST1I7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHJldHVybiByZXM7CisgICAgICAgIDo6YW5kcm9pZDo6aGFyZHdhcmU6OlJldHVybjx2b2lkPiByZXQ7CisgICAgICAgIHNwPHByb3ZpZGVyOjpWMl83OjpJQ2FtZXJhUHJvdmlkZXI+IGludGVyZmFjZV8yXzc7CisgICAgICAgIHNwPHByb3ZpZGVyOjpWMl82OjpJQ2FtZXJhUHJvdmlkZXI+IGludGVyZmFjZV8yXzY7CisgICAgICAgIGlmIChtTWlub3JWZXJzaW9uID49IDcgJiYgY2FzdFJlc3VsdDJfNy5pc09rKCkpIHsKKyAgICAgICAgICAgIGludGVyZmFjZV8yXzcgPSBjYXN0UmVzdWx0Ml83OworICAgICAgICAgICAgaWYgKGludGVyZmFjZV8yXzcgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgIHJldCA9IGludGVyZmFjZV8yXzctPmlzQ29uY3VycmVudFN0cmVhbUNvbWJpbmF0aW9uU3VwcG9ydGVkXzJfNygKKyAgICAgICAgICAgICAgICAgICAgICAgIGhhbENhbWVyYUlkc0FuZFN0cmVhbUNvbWJpbmF0aW9ucywgY2IpOwogICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgaWYgKG1NaW5vclZlcnNpb24gPT0gNiAmJiBjYXN0UmVzdWx0Ml82LmlzT2soKSkgeworICAgICAgICAgICAgaW50ZXJmYWNlXzJfNiA9IGNhc3RSZXN1bHQyXzY7CisgICAgICAgICAgICBpZiAoaW50ZXJmYWNlXzJfNiAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgaGFyZHdhcmU6OmhpZGxfdmVjPHByb3ZpZGVyOjpWMl82OjpDYW1lcmFJZEFuZFN0cmVhbUNvbWJpbmF0aW9uPgorICAgICAgICAgICAgICAgICAgICAgICAgaGFsQ2FtZXJhSWRzQW5kU3RyZWFtQ29tYmluYXRpb25zXzJfNjsKKyAgICAgICAgICAgICAgICBzaXplX3QgbnVtU3RyZWFtcyA9IGhhbENhbWVyYUlkc0FuZFN0cmVhbUNvbWJpbmF0aW9ucy5zaXplKCk7CisgICAgICAgICAgICAgICAgaGFsQ2FtZXJhSWRzQW5kU3RyZWFtQ29tYmluYXRpb25zXzJfNi5yZXNpemUobnVtU3RyZWFtcyk7CisgICAgICAgICAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBudW1TdHJlYW1zOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgdXNpbmcgbmFtZXNwYWNlIGNhbWVyYTM7CisgICAgICAgICAgICAgICAgICAgIGF1dG8gY29uc3QmIGNvbWJpbmF0aW9uID0gaGFsQ2FtZXJhSWRzQW5kU3RyZWFtQ29tYmluYXRpb25zW2ldOworICAgICAgICAgICAgICAgICAgICBoYWxDYW1lcmFJZHNBbmRTdHJlYW1Db21iaW5hdGlvbnNfMl82W2ldLmNhbWVyYUlkID0gY29tYmluYXRpb24uY2FtZXJhSWQ7CisgICAgICAgICAgICAgICAgICAgIGJvb2wgc3VjY2VzcyA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2Vzc2lvbkNvbmZpZ3VyYXRpb25VdGlsczo6Y29udmVydEhBTFN0cmVhbUNvbWJpbmF0aW9uRnJvbVYzN1RvVjM0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFsQ2FtZXJhSWRzQW5kU3RyZWFtQ29tYmluYXRpb25zXzJfNltpXS5zdHJlYW1Db25maWd1cmF0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tYmluYXRpb24uc3RyZWFtQ29uZmlndXJhdGlvbik7CisgICAgICAgICAgICAgICAgICAgIGlmICghc3VjY2VzcykgeworICAgICAgICAgICAgICAgICAgICAgICAgKmlzU3VwcG9ydGVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT0s7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0ID0gaW50ZXJmYWNlXzJfNi0+aXNDb25jdXJyZW50U3RyZWFtQ29tYmluYXRpb25TdXBwb3J0ZWQoCisgICAgICAgICAgICAgICAgICAgICAgICBoYWxDYW1lcmFJZHNBbmRTdHJlYW1Db21iaW5hdGlvbnNfMl82LCBjYik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpZiAoaW50ZXJmYWNlXzJfNyAhPSBudWxscHRyIHx8IGludGVyZmFjZV8yXzYgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgaWYgKHJldC5pc09rKCkpIHsKKyAgICAgICAgICAgICAgICBzd2l0Y2ggKGNhbGxTdGF0dXMpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBTdGF0dXM6Ok9LOgorICAgICAgICAgICAgICAgICAgICAgICAgLy8gRXhwZWN0ZWQgY2FzZSwgZG8gbm90aGluZy4KKyAgICAgICAgICAgICAgICAgICAgICAgIHJlcyA9IE9LOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgU3RhdHVzOjpNRVRIT0RfTk9UX1NVUFBPUlRFRDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlcyA9IElOVkFMSURfT1BFUkFUSU9OOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXM6IFNlc3Npb24gY29uZmlndXJhdGlvbiBxdWVyeSBmYWlsZWQ6ICVkIiwgX19GVU5DVElPTl9fLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxTdGF0dXMpOworICAgICAgICAgICAgICAgICAgICAgICAgcmVzID0gVU5LTk9XTl9FUlJPUjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIEFMT0dFKCIlczogVW5leHBlY3RlZCBiaW5kZXIgZXJyb3I6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RlcmZhY2VfM181LT5pc1N0cmVhbUNvbWJpbmF0aW9uU3VwcG9ydGVkKGNvbmZpZ3VyYXRpb24sCisgICAgOjphbmRyb2lkOjpoYXJkd2FyZTo6UmV0dXJuPHZvaWQ+IHJldDsKKyAgICBhdXRvIGhhbENiID0KICAgICAgICAgICAgIFsmY2FsbFN0YXR1cywgJnN0YXR1c10gKFN0YXR1cyBzLCBib29sIGNvbWJTdGF0dXMpIHsKICAgICAgICAgICAgICAgICBjYWxsU3RhdHVzID0gczsKICAgICAgICAgICAgICAgICAqc3RhdHVzID0gY29tYlN0YXR1czsKLSAgICAgICAgICAgIH0pOworICAgICAgICAgICAgfTsKKyAgICBpZiAoaW50ZXJmYWNlXzNfNyAhPSBudWxscHRyKSB7CisgICAgICAgIHJldCA9IGludGVyZmFjZV8zXzctPmlzU3RyZWFtQ29tYmluYXRpb25TdXBwb3J0ZWRfM183KGNvbmZpZ3VyYXRpb24sIGhhbENiKTsKKyAgICB9IGVsc2UgaWYgKGludGVyZmFjZV8zXzUgIT0gbnVsbHB0cikgeworICAgICAgICBoYXJkd2FyZTo6Y2FtZXJhOjpkZXZpY2U6OlYzXzQ6OlN0cmVhbUNvbmZpZ3VyYXRpb24gY29uZmlndXJhdGlvbl8zXzQ7CisgICAgICAgIGJvb2wgc3VjY2VzcyA9IFNlc3Npb25Db25maWd1cmF0aW9uVXRpbHM6OmNvbnZlcnRIQUxTdHJlYW1Db21iaW5hdGlvbkZyb21WMzdUb1YzNCgKKyAgICAgICAgICAgICAgICBjb25maWd1cmF0aW9uXzNfNCwgY29uZmlndXJhdGlvbik7CisgICAgICAgIGlmICghc3VjY2VzcykgeworICAgICAgICAgICAgKnN0YXR1cyA9IGZhbHNlOworICAgICAgICAgICAgcmV0dXJuIE9LOworICAgICAgICB9CisgICAgICAgIHJldCA9IGludGVyZmFjZV8zXzUtPmlzU3RyZWFtQ29tYmluYXRpb25TdXBwb3J0ZWQoY29uZmlndXJhdGlvbl8zXzQsIGhhbENiK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WQUlMQUJMRV9TVFJFQU1fQ09ORklHVVJBVElPTlMpOworICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgc3RyZWFtQ29uZmlncy5jb3VudDsgaSArPSA0KSB7CisgICAgICAgIGlmICgoc3RyZWFtQ29uZmlncy5kYXRhLmkzMltpXSA9PSBIQUxfUElYRUxfRk9STUFUX0JMT0IpICYmIChzdHJlYW1Db25maWdzLmRhdGEuaTMyW2krM10gPT0KKyAgICAgICAgICAgICAgICBBTkRST0lEX1NDQUxFUl9BVkFJTEFCTEVfU1RSRUFNX0NPTkZJR1VSQVRJT05TX09VVFBVVCkpIHsKKyAgICAgICAgICAgIGlmIChzdHJlYW1Db25maWdzLmRhdGEuaTMyW2krMV0gPCB0aHJlc2hvbGRXICB8fAorICAgICAgICAgICAgICAgICAgICBzdHJlYW1Db25maWdzLmRhdGEuaTMyW2krMl0gPCB0aHJlc2hvbGRIKSB7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGxhcmdlSnBlZ0NvdW50ICsrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIG5ld1N0cmVhbUNvbmZpZ3MuaW5zZXJ0KG5ld1N0cmVhbUNvbmZpZ3MuZW5kKCksIHN0cmVhbUNvbmZpZ3MuZGF0YS5pMzIgKyBpLAorICAgICAgICAgICAgICAgIHN0cmVhbUNvbmZpZ3MuZGF0YS5pMzIgKyBpICsgNCk7CisgICAgfQorICAgIGlmIChuZXdTdHJlYW1Db25maWdzLnNpemUoKSA9PSAwIHx8IGxhcmdlSnBlZ0NvdW50ID09IDApIHsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisKKyAgICAvLyBSZW1vdmUgc21hbGwgSlBFRyBzaXplcyBmcm9tIGF2YWlsYWJsZSBtaW4gZnJhbWUgZHVyYXRpb25zCisgICAgbGFyZ2VKcGVnQ291bnQgPSAwOworICAgIHN0ZDo6d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Ojpwcm92aWRlcjo6VjJfNzo6Q2FtZXJhSWRBbmRTdHJlYW1Db21iaW5hdGlvbj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmhhbENhbWVyYUlkc0FuZFN0cmVhbUNvbWJpbmF0aW9ucywKICAgICAgICAgICAgICAgICBib29sICppc1N1cHBvcnRlZCk7CiAKQEAgLTQ2Myw3ICs0NzQsOSBAQAogICAgICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBnZXRDYW1lcmFJbmZvKGhhcmR3YXJlOjpDYW1lcmFJbmZvICppbmZvKSBjb25zdCA9IDA7CiAgICAgICAgICAgICB2aXJ0dWFsIGJvb2wgaXNBUEkxQ29tcGF0aWJsZSgpIGNvbnN0ID0gMDsKICAgICAgICAgICAgIHZpcnR1YWwgc3RhdHVzX3QgZHVtcFN0YXRlKGludCBmZCkgPSAwOwotICAgICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBnZXRDYW1lcmFDaGFyYWN0ZXJpc3RpY3MoQ2FtZXJhTWV0YWRhdGEgKmNoYXJhY3RlcmlzdGljcykgY29uc3QgeworICAgICAgICAgICAgdmlydHVhbCBzdGF0dXNfdCBnZXRDYW1lcmFDaGFyYWN0ZXJpc3RpY3MoYm9vbCBvdmVycmlkZUZvclBlcmZDbGFzcywKKyAgICAgICAgICAgICAgICAgICAgQ2FtZXJhTWV0YWRhdGEgKmNoYXJhY3RlcmlzdGljcykgY29uc3QgeworICAgICAgICAgICAgICAgICh2b2lkKSBvdmVycmlkZUZvclBlcmZDbGFzczsKICAgICAgICAgICAgICAgICAodm9pZCkgY2hhcmFjdGVyaXN0aWNzOwogICAgICAgICAgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKICAgICAgICAgICAgIH0KQEAgLTQ3NSwxMCArNDg4LDExIEBACiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIHZpcnR1YWwgc3RhdHVzX3QgaXNTZXNzaW9uQ29uZmlndXJhdGlvblN1cHBvcn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mg+Ci0jaW5jbHVkZSA8dXRpbHMvUmVmQmFzZS5oPgotI2luY2x1ZGUgPHVpL0dyYXBoaWNCdWZmZXIuaD4KLSNpbmNsdWRlIDxjYW1lcmEvQ2FtZXJhLmg+Ci0jaW5jbHVkZSA8Y2FtZXJhL0NhbWVyYVBhcmFtZXRlcnMuaD4KLSNpbmNsdWRlIDxzeXN0ZW0vd2luZG93Lmg+Ci0jaW5jbHVkZSA8aGFyZHdhcmUvY2FtZXJhLmg+Ci0KLSNpbmNsdWRlIDxjb21tb24vQ2FtZXJhUHJvdmlkZXJNYW5hZ2VyLmg+Ci0KLW5hbWVzcGFjZSBhbmRyb2lkIHsKLQotdHlwZWRlZiB2b2lkICgqbm90aWZ5X2NhbGxiYWNrKShpbnQzMl90IG1zZ1R5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBleHQxLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgZXh0MiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkKiB1c2VyKTsKLQotdHlwZWRlZiB2b2lkICgqZGF0YV9jYWxsYmFjaykoaW50MzJfdCBtc2dUeXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNwPElNZW1vcnk+ICZkYXRhUHRyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbWVyYV9mcmFtZV9tZXRhZGF0YV90ICptZXRhZGF0YSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkKiB1c2VyKTsKLQotdHlwZWRlZiB2b2lkICgqZGF0YV9jYWxsYmFja190aW1lc3RhbXApKG5zZWNzX3QgdGltZXN0YW1wLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QgbXNnVHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzcDxJTWVtb3J5PiAmZGF0YVB0ciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lk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YXBCYXNlKGZkLCBidWZfc2l6ZSAqIG51bV9idWZmZXJzKTsKLSAgICAgICAgICAgIGNvbW1vbkluaXRpYWxpemF0aW9uKCk7Ci0gICAgICAgIH0KLQotICAgICAgICBleHBsaWNpdCBDYW1lcmFIZWFwTWVtb3J5KHNpemVfdCBidWZfc2l6ZSwgdWludF90IG51bV9idWZmZXJzID0gMSkgOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1CdWZTaXplKGJ1Zl9zaXplKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTnVtQnVmcyhudW1fYnVmZmVycykKLSAgICAgICAgewotICAgICAgICAgICAgbUhlYXAgPSBuZXcgTWVtb3J5SGVhcEJhc2UoYnVmX3NpemUgKiBudW1fYnVmZmVycyk7Ci0gICAgICAgICAgICBjb21tb25Jbml0aWFsaXphdGlvbigpOwotICAgICAgICB9Ci0KLSAgICAgICAgdm9pZCBjb21tb25Jbml0aWFsaXphdGlvbigpCi0gICAgICAgIHsKLSAgICAgICAgICAgIGhhbmRsZS5kYXRhID0gbUhlYXAtPmJhc2UoKTsKLSAgICAgICAgICAgIGhhbmRsZS5zaXplID0gbUJ1ZlNpemUgKiBtTnVtQnVmczsKLSAgICAgICAgICAgIGhhbmRsZS5oYW5kbGUgPSB0aGlzOwotCi0gICAgICAgICAgICBtQnVmZmVycyA9IG5ldyBzcDxNZW1vcnlCYXNlPlttTnVtQnVmc107Ci0gICAgICAgICAgICBmb3IgKHVpbnRfdCBpID0gMDsgaSA8IG1OdW1CdWZzOyBpKyspCi0gICAgICAgICAgICAgICAgbUJ1ZmZlcnNbaV0gPSBuZXcgTWVtb3J5QmFzZShtSGVhcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgKiBtQnVmU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1CdWZTaXplKTsKLQotICAgICAgICAgICAgaGFuZG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gICAgc3RydWN0IEJ1ZmZlckhhc2hlciB7Ci0gICAgICAgIHNpemVfdCBvcGVyYXRvcigpKGNvbnN0IGJ1ZmZlcl9oYW5kbGVfdCYgYnVmKSBjb25zdCB7Ci0gICAgICAgICAgICBpZiAoYnVmID09IG51bGxwdHIpCi0gICAgICAgICAgICAgICAgcmV0dXJuIDA7Ci0KLSAgICAgICAgICAgIHNpemVfdCByZXN1bHQgPSAxOwotICAgICAgICAgICAgcmVzdWx0ID0gMzEgKiByZXN1bHQgKyBidWYtPm51bUZkczsKLSAgICAgICAgICAgIHJlc3VsdCA9IDMxICogcmVzdWx0ICsgYnVmLT5udW1JbnRzOwotICAgICAgICAgICAgaW50IGxlbmd0aCA9IGJ1Zi0+bnVtRmRzICsgYnVmLT5udW1JbnRzOwotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykgewotICAgICAgICAgICAgICAgIHJlc3VsdCA9IDMxICogcmVzdWx0ICsgYnVmLT5kYXRhW2ldOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKLSAgICAgICAgfQotICAgIH07Ci0KLSAgICBzdHJ1Y3QgQnVmZmVyQ29tcGFyYXRvciB7Ci0gICAgICAgIGJvb2wgb3BlcmF0b3IoKShjb25zdCBidWZmZXJfaGFuZGxlX3QmIGJ1ZjEsIGNvbnN0IGJ1ZmZlcl9oYW5kbGVfdCYgYnVmMikgY29uc3QgewotICAgICAgICAgICAgaWYgKGJ1ZjEtPm51bUZkcyA9PSBidWYyLT5udW1GZHMgJiYgYnVmMS0+bnVtSW50cyA9PSBidWYyLT5udW1JbnRzKSB7Ci0gICAgICAgICAgICAgICAgaW50IGxlbmd0aCA9IGJ1ZjEtPm51bUZkcyArIGJ1ZjEtPm51bUludHM7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBpZiAoYn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HwgKGNvdW50ICUgUEVSX0NPTkZJR1VSQVRJT05fU0laRSkpIHsKICAgICAgICAgQUxPR0UoIiVzOiBDYW1lcmEgJXM6IGJhZCBvcGFxdWUgUkFXIHNpemUgc3RhdGljIG1ldGFkYXRhIGxlbmd0aCglenUpISIsCkBAIC03NTEsMTYgKzc3NiwyMSBAQAogICAgIH0KIAogICAgIGxpbmVzID0gU3RyaW5nOCgiICAgIEluLWZsaWdodCByZXF1ZXN0czpcbiIpOwotICAgIGlmIChtSW5GbGlnaHRNYXAuc2l6ZSgpID09IDApIHsKLSAgICAgICAgbGluZXMuYXBwZW5kKCIgICAgICBOb25lXG4iKTsKLSAgICB9IGVsc2UgewotICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IG1JbkZsaWdodE1hcC5zaXplKCk7IGkrKykgewotICAgICAgICAgICAgSW5GbGlnaHRSZXF1ZXN0IHIgPSBtSW5GbGlnaHRNYXAudmFsdWVBdChpKTsKLSAgICAgICAgICAgIGxpbmVzLmFwcGVuZEZvcm1hdCgiICAgICAgRnJhbWUgJWQgfCAgVGltZXN0YW1wOiAlIiBQUklkNjQgIiwgbWV0YWRhdGEiCi0gICAgICAgICAgICAgICAgICAgICIgYXJyaXZlZDogJXMsIGJ1ZmZlcnMgbGVmdDogJWRcbiIsIG1JbkZsaWdodE1hcC5rZXlBdChpKSwKLSAgICAgICAgICAgICAgICAgICAgci5zaHV0dGVyVGltZXN0YW1wLCByLmhhdmVSZXN1bHRNZXRhZGF0YSA/ICJ0cnVlIiA6ICJmYWxzZSIsCi0gICAgICAgICAgICAgICAgICAgIHIubnVtQnVmZmVyc0xlZnQpOworICAgIGlmIChtSW5GbGlnaHRMb2NrLnRyeV9sb2NrKCkpIHsKKyAgICAgICAgaWYgKG1JbkZsaWdodE1hcC5zaXplKCkgPT0gMCkgeworICAgICAgICAgICAgbGluZXMuYXBwZW5kKCIgICAgICBOb25lXG4iKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgbUluRmxpZ2h0TWFwLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgSW5GbGlnaHRSZXF1ZXN0IHIgPSBtSW5GbGlnaHRNYXAudmFsdWVBdChpKTsKKyAgICAgICAgICAgICAgICBsaW5lcy5hcHBlbmRGb3JtYXQoIiAgICAgIEZyYW1lICVkIHwgIFRpbWVzdGFtcDogJSIgUFJJZDY0ICIsIG1ldGFkYXRhIgorICAgICAgICAgICAgICAgICAgICAgICAgIiBhcnJpdmVkOiAlcywgYnVmZmVycyBsZWZ0OiAlZFxuIiwgbUluRmxpZ2h0TWFwLmtleUF0KGkpLAorICAgICAgICAgICAgICAgICAgICAgICAgci5zaHV0dGVyVGltZXN0YW1wLCByLmhhdmVSZXN1bHRNZXRhZGF0YSA/ICJ0cnVlIiA6ICJmYWxzZSIsCisgICAgICAgICAgICAgICAgICAgICAgICByLm51bUJ1ZmZlcnNMZWZ0KTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfQorICAgICAgICBtSW5GbGlnaHRMb2NrLnVubG9jaygpOworICAgIH0gZWxzZSB7CisgICAgICAgIGxpbmVzLmFwcGVuZCgiICAgICAgRmFpbGVkIHRvIGFjcXVpcmUgSW4tZmxpZ2h0IGxvY2shXG4iKTsKICAgICB9CiAgICAgd3JpdGUoZmQsIGxpbmVzLnN0cmluZygpLCBsaW5lcy5zaXplKCkpOwogCkBAIC03NzgsNyArODA4LDcgQEAKICAgICB9CiAKICAgICBpZiAoZHVtcFRlbXBsYXRlcykgewotICAgICAgICBjb25zdCBjaGFyICp0ZW1wbGF0ZU5hbWVzW0NBTUVSQTNfVEVNUExBVEVfQ09VTlRdID0geworICAgICAgICBjb25zdCBjaGFyICp0ZW1wbGF0ZU5hbWVzW0NBTUVSQV9URU1QTEFURV9DT1VOVF0gPSB7CiAgICAgICAgICAgICAiVEVNUExBVEVfUFJFVklFVyIsCiAgICAgICAgICAgICAiVEVNUExBV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T5nZXRVc2FnZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzdHJlYW1TdGF0cy5lbXBsYWNlX2JhY2soc3RyZWFtLT5nZXRXaWR0aCgpLCBzdHJlYW0tPmdldEhlaWdodCgpLAorICAgICAgICAgICAgICAgICAgICBzdHJlYW0tPmdldEZvcm1hdCgpLCBzdHJlYW0tPmdldERhdGFTcGFjZSgpLCB1c2FnZSwKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtLT5nZXRNYXhIYWxCdWZmZXJzKCksCisgICAgICAgICAgICAgICAgICAgIHN0cmVhbS0+Z2V0TWF4VG90YWxCdWZmZXJzKCkgLSBzdHJlYW0tPmdldE1heEhhbEJ1ZmZlcnMoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KICAgICB9CiAKICAgICBzcDxOb3RpZmljYXRpb25MaXN0ZW5lcj4gbGlzdGVuZXI7CkBAIC0yMTEwLDggKzIyMDUsNDAgQEAKICAgICAgICAgc3RkOjpsb2NrX2d1YXJkPHN0ZDo6bXV0ZXg+IGwobU91dHB1dExvY2spOwogICAgICAgICBsaXN0ZW5lciA9IG1MaXN0ZW5lci5wcm9tb3RlKCk7CiAgICAgfQotICAgIGlmIChpZGxlICYmIGxpc3RlbmVyICE9IE5VTEwpIHsKLSAgICAgICAgbGlzdGVuZXItPm5vdGlmeUlkbGUoKTsKKyAgICBzdGF0dXNfdCByZXMgPSBPSzsKKyAgICBpZiAobGlzdGVuZXIgIT0gbnVsbHB0cikgeworICAgICAgICBpZiAoaWRsZSkgeworICAgICAgICAgICAgLy8gR2V0IHNlc3Npb24gc3RhdHMgZnJvbSB0aGUgYnVpbGRlciwgYW5kIG5vdGlmeSB0aGUgbGlzdGVuZXIuCisgICAgICAgICAgICBpbnQ2NF90IHJlcXVlc3RDb3VudCwgcmVzdWx0RXJyb3JDb3VudDsKKyAgICAgICAgICAgIGJvb2wgZGV2aWNlRXJyb3I7CisgICAgICAgICAgICBzdGQ6Om1hc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CaW5zLmFzc2lnbigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0cy0+c2Vjb25kLm1DYXB0dXJlTGF0ZW5jeUJpbnMuYmVnaW4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0cy0+c2Vjb25kLm1DYXB0dXJlTGF0ZW5jeUJpbnMuZW5kKCkpOworICAgICAgICAgICAgICAgICAgICBzdHJlYW1TdGF0c1tpXS5tSGlzdG9ncmFtQ291bnRzLmFzc2lnbigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRzLT5zZWNvbmQubUNhcHR1cmVMYXRlbmN5SGlzdG9ncmFtLmJlZ2luKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0cy0+c2Vjb25kLm1DYXB0dXJlTGF0ZW5jeUhpc3RvZ3JhbS5lbmQoKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgbGlzdGVuZXItPm5vdGlmeUlkbGUocmVxdWVzdENvdW50LCByZXN1bHRFcnJvckNvdW50LCBkZXZpY2VFcnJvciwgc3RyZWFtU3RhdHMpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmVzID0gbGlzdGVuZXItPm5vdGlmeUFjdGl2ZSgpOworICAgICAgICB9CisgICAgfQorICAgIGlmIChyZXMgIT0gT0spIHsKKyAgICAgICAgU0VUX0VSUigiQ2FtZXJhIGFjY2VzcyBwZXJtaXNzaW9uIGxvc3QgbWlkLW9wZXJhdGlvbjogJXMgKCVkKSIsCisgICAgICAgICAgICAgICAgc3RyZXJyb3IoLXJlcyksIHJlcyk7CiAgICAgfQogfQogCkBAIC0yMjIxLDYgKzIzNDgsMTIgQEAKICAgICAgICAgQUxPR0UoIiVzOiBTdHJlYW0gJWQgaXMgbm90IGZvdW5kLiIsIF9fRlVOQ1RJT05fXywgc3RyZWFtSWQpOwogICAgICAgICByZXR1cm4gQkFEX1ZBTFVFOwogICAgIH0KKworICAgIGl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3QzXzIudXNhZ2UgPSBtYXBUb0NvbnN1bWVyVXNhZ2UoY2FtM3N0cmVhbS0+Z2V0VXNhZ2UoKSk7CisgICAgICAgIGRzdDNfMi5yb3RhdGlvbiA9CisgICAgICAgICAgICAgICAgbWFwVG9TdHJlYW1Sb3RhdGlvbigoY2FtZXJhX3N0cmVhbV9yb3RhdGlvbl90KXNyYy0+cm90YXRpb24pOworICAgICAgICAvLyBGb3IgSGlkbFNlc3Npb24gdmVyc2lvbiAzLjUgb3IgbmV3ZXIsIHRoZSBmb3JtYXQgYW5kIGRhdGFTcGFjZSBzZW50CisgICAgICAgIC8vIHRvIEhBTCBhcmUgb3JpZ2luYWwsIG5vdCB0aGUgb3ZlcnJpZGRlbiBvbmVzLgorICAgICAgICBpZiAobUhpZGxTZXNzaW9uXzNfNSAhPSBudWxscHRyKSB7CisgICAgICAgICAgICBkc3QzXzIuZm9ybWF0ID0gbWFwVG9QaXhlbEZvcm1hdChjYW0zc3RyZWFtLT5pc0Zvcm1hdE92ZXJyaWRkZW4oKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IGNhbTNzdHJlYW0tPmdldE9yaWdpbmFsRm9ybWF0KCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBzcmMtPmZvcm1hdCk7CisgICAgICAgICAgICBkc3QzXzIuZGF0YVNwYWNlID0KKyAgICAgICAgICAgICAgICAgICAgbWFwVG9IaWRsRGF0YXNwYWNlKGNhbTNzdHJlYW0tPmlzRGF0YVNwYWNlT3ZlcnJpZGRlbigpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IGNhbTNzdHJlYW0tPmdldE9yaWdpbmFsRGF0YVNwYWNlKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogc3JjLT5kYXRhX3NwYWNlKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGRzdDNfMi5mb3Jt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183ICE9IG51bGxwdHIpIHsKKyAgICAgICAgcmVxdWVzdGVkQ29uZmlndXJhdGlvbjNfNy5zdHJlYW1Db25maWdDb3VudGVyID0gbU5leHRTdHJlYW1Db25maWdDb3VudGVyKys7CisgICAgICAgIHJlcXVlc3RlZENvbmZpZ3VyYXRpb24zXzcubXVsdGlSZXNvbHV0aW9uSW5wdXRJbWFnZSA9CisgICAgICAgICAgICAgICAgY29uZmlnLT5pbnB1dF9pc19tdWx0aV9yZXNvbHV0aW9uOworCisgICAgICAgIGNvbnN0IGNhbWVyYV9tZXRhZGF0YV90KiByYXdNZXRhZGF0YSA9IGNhbWVyYUNoYXJhY3RlcmlzdGljcy5nZXRBbmRMb2NrKCk7CisgICAgICAgIDo6YW5kcm9pZDo6aGFyZHdhcmU6OmNhbWVyYTo6ZGV2aWNlOjpWM18yOjpDYW1lcmFNZXRhZGF0YSBoaWRsQ2hhcnMgPSB7fTsKKyAgICAgICAgaGlkbENoYXJzLnNldFRvRXh0ZXJuYWwoCisgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDx1aW50OF90Kj4oY29uc3RfY2FzdDxjYW1lcmFfbWV0YWRhdGFfdCo+KHJhd01ldGFkYXRhKSksCisgICAgICAgICAgICAgICAgZ2V0X2NhbWVyYV9tZXRhZGF0YV9zaXplKHJhd01ldGFkYXRhKSk7CisgICAgICAgIGNhbWVyYUNoYXJhY3RlcmlzdGljcy51bmxvY2socmF3TWV0YWRhdGEpOworCisgICAgICAgIHNwPGhhcmR3YXJlOjpjYW1lcmE6OmRldmljZTo6VjNfNzo6SUNhbWVyYUluamVjdGlvblNlc3Npb24+CisgICAgICAgICAgICAgICAgaGlkbEluamVjdGlvblNlc3Npb25fM183OworICAgICAgICBhdXRvIGNhc3RJbmplY3Rpb25SZXN1bHRfM183ID0KKyAgICAgICAgICAgICAgICBkZXZpY2U6OlYzXzc6OklDYW1lcmFJbmplY3Rpb25TZXNzaW9uOjpjYXN0RnJvbShtSGlkbFNlc3Npb25fM183KTsKKyAgICAgICAgaWYgKGNhc3RJbmplY3Rpb25SZXN1bHRfM183LmlzT2soKSkgeworICAgICAgICAgICAgaGlkbEluamVjdGlvblNlc3Npb25fM183ID0gY2FzdEluamVjdGlvblJlc3VsdF8zXzc7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBBTE9HRSgiJXM6IFRyYW5zYWN0aW9uIGVycm9yOiAlcyIsIF9fRlVOQ1RJT05fXywKKyAgICAgICAgICAgICAgICAgICAgY2FzdEluamVjdGlvblJlc3VsdF8zXzcuZGVzY3JpcHRpb24oKS5jX3N0cigpKTsKKyAgICAgICAgICAgIHJldHVybiBERUFEX09CSkVDVDsKKyAgICAgICAgfQorCisgICAgICAgIGF1dG8gZXJyID0gaGlkbEluamVjdGlvblNlc3Npb25fM183LT5jb25maWd1cmVJbmplY3Rpb25TdHJlYW1zKAorICAgICAgICAgICAgICAgIHJlcXVlc3RlZENvbmZpZ3VyYXRpb24zXzcsIGhpZGxDaGFycyk7CisgICAgICAgIGlmICghZXJyLmlzT2soKSkgeworICAgICAgICAgICAgQUxPR0UoIiVzOiBUcmFuc2FjdGlvbiBlcnJvcjogJXMiLCBfX0ZVTkNUSU9OX18sCisgICAgICAgICAgICAgICAgICAgIGVyci5kZXNjcmlwdGlvbigpLmNfc3RyKCkpOworICAgICAgICAgICAgcmV0dXJuIERFQURfT0JKRUNUOworICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgQUxPR0UoIiVzOiBtSGlkbFNlc3Npb25fM183IGRvZXMgbm90IGV4aXN0LCB0aGUgbG93ZXN0IHZlcnNpb24gb2YgaW5qZWN0aW9uICIKKyAgICAgICAgICAgICAgICAic2Vzc2lvbiBpcyAzLjciLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gREVBRF9PQkpFQ1Q7CisgICAgfQorCisgICAgcmV0dXJuIHJlczsKK30KKworc3RhdHVzX3QgQ2FtZXJhM0RldmljZTo6SGFsSW50ZXJm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SBudWxscHRyKSA/CisgICAgICAgICAgICAgICAgICAgIGNhcHR1cmVSZXF1ZXN0c18zXzdbaV0udjNfNC5waHlzaWNhbENhbWVyYVNldHRpbmdzIDoKKyAgICAgICAgICAgICAgICAgICAgY2FwdHVyZVJlcXVlc3RzXzNfNFtpXS5waHlzaWNhbENhbWVyYVNldHRpbmdzOworICAgICAgICAgICAgcGh5c2ljYWxDYW1lcmFTZXR0aW5ncy5yZXNpemUocmVxdWVzdC0+bnVtX3BoeXNjYW1fc2V0dGluZ3MpOwogICAgICAgICAgICAgZm9yIChzaXplX3QgaiA9IDA7IGogPCByZXF1ZXN0LT5udW1fcGh5c2NhbV9zZXR0aW5nczsgaisrKSB7CiAgICAgICAgICAgICAgICAgaWYgKHJlcXVlc3QtPnBoeXNjYW1fc2V0dGluZ3MgIT0gbnVsbHB0cikgewogICAgICAgICAgICAgICAgICAgICBzaXplX3Qgc2V0dGluZ3NTaXplID0gZ2V0X2NhbWVyYV9tZXRhZGF0YV9zaXplKHJlcXVlc3QtPnBoeXNjYW1fc2V0dGluZ3Nbal0pOwogICAgICAgICAgICAgICAgICAgICBpZiAobVJlcXVlc3RNZXRhZGF0YVF1ZXVlICE9IG51bGxwdHIgJiYgbVJlcXVlc3RNZXRhZGF0YVF1ZXVlLT53cml0ZSgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDxjb25zdCB1aW50OF90Kj4ocmVxdWVzdC0+cGh5c2NhbV9zZXR0aW5nc1tqXSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzU2l6ZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhcHR1cmVSZXF1ZXN0c18zXzRbaV0ucGh5c2ljYWxDYW1lcmFTZXR0aW5nc1tqXS5zZXR0aW5ncy5yZXNpemUoMCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYXB0dXJlUmVxdWVzdHNfM180W2ldLnBoeXNpY2FsQ2FtZXJhU2V0dGluZ3Nbal0uZm1xU2V0dGluZ3NTaXplID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nc1NpemU7CisgICAgICAgICAgICAgICAgICAgICAgICBwaHlzaWNhbENhbWVyYVNldHRpbmdzW2pdLnNldHRpbmdzLnJlc2l6ZSgwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBoeXNpY2FsQ2FtZXJhU2V0dGluZ3Nbal0uZm1xU2V0dGluZ3NTaXplID0gc2V0dGluZ3NTaXplOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1SZXF1ZXN0TWV0YWRhdGFRdWV1ZSAhPSBudWxscHRyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1coIiVzOiBjb3VsZG4ndCB1dGlsaXplIGZtcSwgZmFsbGJhY2sgdG8gaHdiaW5kZXIiLCBfX0ZVTkNUSU9OX18pOwogICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgY2FwdHVyZVJlcXVlc3RzXzNfNFtpXS5waHlzaWNhbENhbWVyYVNldHRpbmdzW2pdLnNldHRpbmdzLnNldFRvRXh0ZXJuYWwoCisgICAgICAgICAgICAgICAgICAgICAgICBwaHlzaWNhbENhbWVyYVNldHRpbmdzW2pdLnNldHRpbmdzLnNldFRvRXh0ZXJuYWwoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlaW50ZXJwcmV0X2Nhc3Q8dWludDhfdCo+KGNvbnN0X2Nhc3Q8Y2FtZXJhX21ldGFkYXRhX3QqPigKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LT5waHlzY2FtX3NldHRpbmdzW2pdKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldF9jYW1lcmFfbWV0YWRhdGFfc2l6ZShyZXF1ZXN0LT5waHlzY2FtX3NldHRpbmdzW2pdKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYXB0dXJlUmVxdWVzdHNfM180W2ldLnBoeXNpY2FsQ2FtZXJhU2V0dGluZ3Nbal0uZm1xU2V0dGluZ3NTaXplID0gMHU7CisgICAgICAgICAgICAgICAgICAgICAgICBwaHlzaWNhbENhbWVyYVNldHRpbmdzW2pdLmZtcVNldHRpbmdzU2l6ZSA9IDB1OwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgY2FwdHVyZVJlcXVlc3RzXzNfNFtpXS5waHlzaWNhbENhbWVyYVNldHRpbmdzW2pdLmZtcVNldHRpbmdzU2l6ZSA9IDB1OwotICAgICAgICAgICAgICAgICAgICBjYXB0dXJlUmVxdWVzdHNfM180W2ldLnBoeXNpY2FsQ2FtZXJhU2V0dGluZ3Nbal0uc2V0dGluZ3MucmVzaXplKDApOworICAgICAgICAgICAgICAgICAgICBwaHlzaWNhbENhbWVyYVNldHRpbmdzW2pdLmZtcVNldHRpbmdzU2l6ZSA9IDB1OworICAgICAgICAgICAgICAgICAgICBwaHlzaWNhbENhbWVyYVNldHRpbmdzW2pdLnNldHRpbmdzLnJlc2l6ZSgwKTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgY2FwdHVyZVJlcXVlc3RzXzNfNFtpXS5waHlzaWNhbENhbWVyYVNldHRpbmdzW2pdLnBoeXNpY2FsQ2FtZXJhSWQgPQotICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LT5waHlzY2FtX2lkW2pdOworICAgICAgICAgICAgICAgIHBoeXNpY2FsQ2FtZXJhU2V0dGluZ3Nbal0ucGh5c2ljYWxDYW1lcmFJZCA9IHJlcXVlc3QtPnBoeXNjYW1faWRbal07CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CkBAIC0zNTU1LDcgKzM5MzgsMTAgQEAKICAgICAgICAgICAgICA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gICAgICAgICBzdGF0dXNfdCByZXMgPSAoKml0KS0+bUlucHV0U3RyZWFtLT5nZXRJbnB1dEJ1ZmZlcigmaW5wdXRCdWZmZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAvKnJlc3BlY3RIYWxMaW1pdCovIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICZpbnB1dEJ1ZmZlclNpemUsIC8qcmVzcGVjdEhhbExpbWl0Ki8gZmFsc2UpOwogICAgICAgICAgICAgICAgIGlmIChyZXMgIT0gT0spIHsKICAgICAgICAgICAgICAgICAgICAgQUxPR1coIiVzOiAlZDogY291bGRuJ3QgZ2V0IGlucHV0IGJ1ZmZlciB3aGlsZSBjbGVhcmluZyB0aGUgcmVxdWVzdCAiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImxpc3Q6ICVzICglZCkiLCBfX0ZVTkNUSU9OX18sIF9fTElORV9fLCBzdHJlcnJvcigtcmVzKSwgcmVzKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBpbnB1dEJ1ZmZlci5zdGF0dXMgPSBDQU1FUkEzX0JVRkZFUl9TVEFUVVNfRVJST1I7CisgICAgICAgICAgICAgICAgICAgIGlucHV0QnVmZmVyLnN0YXR1cyA9IENBTUVSQV9CVUZGRVJfU1RBVFVTX0VSUk9SOwogICAgICAgICAgICAgICAgICAgICByZXMgPSAoKml0KS0+bUlucHV0U3RyZWFtLT5yZXR1cm5JbnB1dEJ1ZmZlcihpbnB1dEJ1ZmZlcik7CiAgICAgICAgICAgICAgICAgICAgIGlmIChyZXMgIT0gT0spIHsKICAgICAgICAgICAgICAgICAgICAgICAgIEFMT0dFKCIlczogJWQ6IGNvdWxkbid0IHJldHVybiBpbnB1dCBidWZmZXIgd2hpbGUgY2xlYXJpbmcgdGhlIHJlcXVlc3QgIgpAQCAtNDA3MCw3ICs0NDY1LDcgQEAKICAgICBBVFJBQ0VfQ0FMTCgpOwogICAgIHN0YXR1c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AgICAgICAgIC8qKgogICAgICAgICAgICAgICogSEFMIHdvcmthcm91bmQ6Ci0gICAgICAgICAgICAgKiBJbnNlcnQgYSBkdW1teSB0cmlnZ2VyIElEIGlmIGEgdHJpZ2dlciBpcyBzZXQgYnV0IG5vIHRyaWdnZXIgSUQgaXMKKyAgICAgICAgICAgICAqIEluc2VydCBhIGZha2UgdHJpZ2dlciBJRCBpZiBhIHRyaWdnZXIgaXMgc2V0IGJ1dCBubyB0cmlnZ2VyIElEIGlzCiAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIHJlcyA9IGFkZER1bW15VHJpZ2dlcklkcyhjYXB0dXJlUmVxdWVzdCk7CisgICAgICAgICAgICByZXMgPSBhZGRGYWtlVHJpZ2dlcklkcyhjYXB0dXJlUmVxdWVzdCk7CiAgICAgICAgICAgICBpZiAocmVzICE9IE9LKSB7Ci0gICAgICAgICAgICAgICAgU0VUX0VSUigiUmVxdWVzdFRocmVhZDogVW5hYmxlIHRvIGluc2VydCBkdW1teSB0cmlnZ2VyIElEcyAiCisgICAgICAgICAgICAgICAgU0VUX0VSUigiUmVxdWVzdFRocmVhZDogVW5hYmxlIHRvIGluc2VydCBmYWtlIHRyaWdnZXIgSURzICIKICAgICAgICAgICAgICAgICAgICAgICAgICIoY2FwdHVyZSByZXF1ZXN0ICVkLCBIQUwgZGV2aWNlOiAlcyAoJWQpIiwKICAgICAgICAgICAgICAgICAgICAgICAgIGhhbFJlcXVlc3QtPmZyYW1lX251bWJlciwgc3RyZXJyb3IoLXJlcyksIHJlcyk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIElOVkFMSURfT1BFUkFUSU9OOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLy8gQ29ycmVjdCBtZXRhZGF0YSByZWdpb25zIGZvciBkaXN0b3J0aW9uIGNvcnJlY3Rpb24gaWYgZW5hYmxlZAogICAgICAgICAgICAgICAgIHNwPENhbWVyYTNEZXZpY2U+IHBhcmVudCA9IG1QYXJlbnQucHJvbW90ZSgpOwogICAgICAgICAgICAgICAgIGlmIChwYXJlbnQgIT0gbnVsbHB0cikgewogICAgICAgICAgICAgICAgICAgICBMaXN0PFBoeXNpY2FsQ2FtZXJhU2V0dGluZ3M+OjppdGVyYXRvciBpdDsKICAgICAgICAgICAgICAgICAgICAgZm9yIChpdCA9IGNhcHR1cmVSZXF1ZXN0LT5tU2V0dGluZ3NMaXN0LmJlZ2luKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXQgIT0gY2FwdHVyZVJlcXVlc3QtPm1TZXR0aW5nc0xpc3QuZW5kKCk7IGl0KyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYXJlbnQtPm1VSFJDcm9wQW5kTWV0ZXJpbmdSZWdpb25NYXBwZXJzLmZpbmQoaXQtPmNhbWVyYUlkKSA9PQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJlbnQtPm1VSFJDcm9wQW5kTWV0ZXJpbmdSZWdpb25NYXBwZXJzLmVuZCgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghY2FwdHVyZVJlcXVlc3QtPm1VSFJDcm9wQW5kTWV0ZXJpbmdSZWdpb25zVXBkYXRlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcyA9IHBhcmVudC0+bVVIUkNyb3BBbmRNZXRlcmluZ1JlZ2lvbk1hcHBlcnNbaXQtPmNhbWVyYUlkXS4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUNhcHR1cmVSZXF1ZXN0KCYoaXQtPm1ldGFkYXRhKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlcyAhPSBPSykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTRVRfRVJSKCJSZXF1ZXN0VGhyZWFkOiBVbmFibGUgdG8gY29ycmVjdCBjYXB0dXJlIHJlcXVlc3RzICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZm9yIHNjYWxlciBjcm9wIHJlZ2lvbiBhbmQgbWV0ZXJpbmcgcmVnaW9ucyBmb3IgcmVxdWVzdCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiVkOiAlcyAoJWQpIiwgaGFsUmVxdWVzdC0+ZnJhbWVfbnVtYmVyLCBzdHJlcnJvcigtcmVzKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXMpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSU5WQUxJRF9PUEVSQVRJT047CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhcHR1cmVSZXF1ZXN0LT5tVUhSQ3JvcEFuZE1ldGVyaW5nUmVnaW9uc1VwZGF0ZWQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLy8gQ29ycmVjdCBtZXRhZGF0YSByZWdpb25zIGZvciBkaXN0b3J0aW9uIGNvcnJlY3Rpb24gaWYgZW5hYmxlZAorICAgICAgICAgICAgICAgICAgICBmb3IgKGl0ID0gY2FwdHVyZVJlcXVlc3QtPm1TZXR0aW5nc0xpc3QuYmVnaW4oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdCAhPSBjYXB0dXJlUmVxdWVzdC0+bVNldHRpbmdzTGlzdC5lbmQoKTsgaXQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhcmVudC0+bURpc3RvcnRpb25NYXBwZXJzLmZpbmQoaXQtPmNhbWVyYUlkKSA9PQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJlbnQtPm1E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cnkoc2V0dGluZ3MsIEFORFJPSURfQ09OVFJPTF9FTkFCTEVfWlNMLCAmZSk7CiAgICAgICAgICAgICBpZiAoKGUuY291bnQgPiAwKSAmJiAoZS5kYXRhLnU4WzBdID09IEFORFJPSURfQ09OVFJPTF9FTkFCTEVfWlNMX1RSVUUpKSB7CiAgICAgICAgICAgICAgICAgaXNac2xDYXB0dXJlID0gdHJ1ZTsKICAgICAgICAgICAgIH0KQEAgLTQ2OTIsMTYgKzUxMjMsMjEgQEAKICAgICAgICAgICAgICAgICB0b3RhbE51bUJ1ZmZlcnMsIGNhcHR1cmVSZXF1ZXN0LT5tUmVzdWx0RXh0cmFzLAogICAgICAgICAgICAgICAgIC8qaGFzSW5wdXQqL2hhbFJlcXVlc3QtPmlucHV0X2J1ZmZlciAhPSBOVUxMLAogICAgICAgICAgICAgICAgIGhhc0NhbGxiYWNrLAotICAgICAgICAgICAgICAgIGNhbGN1bGF0ZU1heEV4cGVjdGVkRHVyYXRpb24oaGFsUmVxdWVzdC0+c2V0dGluZ3MpLAorICAgICAgICAgICAgICAgIGNhbGN1bGF0ZU1heEV4cGVjdGVkRHVyYXRpb24oc2V0dGluZ3MpLAogICAgICAgICAgICAgICAgIHJlcXVlc3RlZFBoeXNpY2FsQ2FtZXJhcywgaXNTdGlsbENhcHR1cmUsIGlzWnNsQ2FwdHVyZSwKICAgICAgICAgICAgICAgICBjYXB0dXJlUmVxdWVzdC0+bVJvdGF0ZUFuZENyb3BBdXRvLCBtUHJldkNhbWVyYUlkc1dpdGhab29tLAogICAgICAgICAgICAgICAgIChtVXNlSGFsQnVmTWFuYWdlcikgPyB1bmlxdWVTdXJmYWNlSWRNYXAgOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdXJmYWNlTWFwe30pOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdXJmYWNlTWFwe30sIGNhcHR1cmVSZXF1ZXN0LT5tUmVxdWVzdFRpbWVOcyk7CiAg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aSsrKSB7CisgICAgICAgICAgICBpZiAodGVzdFBhdHRlcm5Db2xvci5kYXRhLmkzMltpXSAhPSB0ZXN0UGF0dGVybkRhdGFbaV0pIHsKKyAgICAgICAgICAgICAgICB0ZXN0UGF0dGVybkNvbG9yLmRhdGEuaTMyW2ldID0gdGVzdFBhdHRlcm5EYXRhW2ldOworICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgbWV0YWRhdGEudXBkYXRlKEFORFJPSURfU0VOU09SX1RFU1RfUEFUVEVSTl9EQVRBLAorICAgICAgICAgICAgICAgIHRlc3RQYXR0ZXJuRGF0YSwgNCk7CisgICAgICAgIGNoYW5nZWQgPSB0cnVlOworICAgIH0KKworICAgIHJldHVybiBjaGFuZ2VkOworfQorCitzdGF0dXNfdCBDYW1lcmEzRGV2aWNlOjpSZXF1ZXN0VGhyZWFkOjpzZXRIYWxJbnRlcmZhY2UoCisgICAgICAgIHNwPEhhbEludGVyZmFjZT4gbmV3SGFsSW50ZXJmYWNlKSB7CisgICAgaWYgKG5ld0hhbEludGVyZmFjZS5nZXQoKSA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dFKCIlczogVGhlIG5ld0hhbEludGVyZmFjZSBkb2VzIG5vdCBleGlzdCEiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm4gREVBRF9PQkpFQ1Q7CisgICAgfQorCisgICAgbUludGVyZmFjZSA9IG5ld0hhbEludGVyZmFjZTsKKworICAgIHJldHVybiBPSzsKK30KKwogLyoqCiAgKiBQcmVwYXJlclRocmVhZCBpbm5lciBjbGFzcyBtZXRob2RzCiAgKi8KQEAgLTU2MzYsNyArNjE2Myw3IEBACiAKICAgICBzdGQ6OmxvY2tfZ3VhcmQ8c3RkOjptdXRleD4gbG9jayhtTG9jayk7CiAgICAgbVN0YXR1c1RyYWNrZXIgPSBzdGF0dXNUcmFja2VyOwotIC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EVTVF9QQVRURVJOX01PREVfU09MSURfQ09MT1IgOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTkRST0lEX1NFTlNPUl9URVNUX1BBVFRFUk5fTU9ERV9CTEFDSzsKKyAgICByZXR1cm4gbVJlcXVlc3RUaHJlYWQtPnNldENhbWVyYU11dGUobXV0ZU1vZGUpOworfQorCitzdGF0dXNfdCBDYW1lcmEzRGV2aWNlOjppbmplY3RDYW1lcmEoY29uc3QgU3RyaW5nOCYgaW5qZWN0ZWRDYW1JZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcDxDYW1lcmFQcm92aWRlck1hbmFnZXI+IG1hbmFnZXIpIHsKKyAgICBBTE9HSSgiJXMgSW5qZWN0aW9uIGNhbWVyYTogaW5qZWN0ZWRDYW1JZCA9ICVzIiwgX19GVU5DVElPTl9fLCBpbmplY3RlZENhbUlkLnN0cmluZygpKTsKKyAgICBBVFJBQ0VfQ0FMTCgpOworICAgIE11dGV4OjpBdXRvbG9jayBpbChtSW50ZXJmYWNlTG9jayk7CisKKyAgICBzdGF0dXNfdCByZXMgPSBOT19FUlJPUjsKKyAgICBpZiAobUluamVjdGlvbk1ldGhvZHMtPmlzSW5qZWN0aW5nKCkpIHsKKyAgICAgICAgaWYgKGluamVjdGVkQ2FtSWQgPT0gbUluamVjdGlvbk1ldGhvZHMtPmdldEluamVjdGVkQ2FtSWQoKSkgeworICAgICAgICAgICAgcmV0dXJuIE9LOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmVzID0gbUluamVjdGlvbk1ldGhvZHMtPnN0b3BJbmplY3Rpb24oKTsKKyAgICAgICAgICAgIGlmIChyZXMgIT0gT0spIHsKKyAgICAgICAgICAgICAgICBBTE9HRSgiJXM6IEZhaWxlZCB0byBzdG9wIHRoZSBpbmplY3Rpb24gY2FtZXJhISByZXQgIT0gTk9fRVJST1I6ICVkIiwKKyAgICAgICAgICAgICAgICAgICAgICAg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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1PdXRwdXRTdHJlYW1zOwogICAgICAgICBTdXJmYWNlTWFwICAgICAgICAgICAgICAgICAgICAgICAgICBtT3V0cHV0U3VyZmFjZXM7CkBAIC01MTcsOSArNTcwLDE2IEBACiAgICAgICAgIC8vIG92ZXJyaWRpbmcgb2YgUk9UQVRFX0FORF9DUk9QIHZhbHVlIGFuZCBhZGp1c3RtZW50IG9mIGNvb3JkaW5hdGVzCiAgICAgICAgIC8vIGluIHNldmVyYWwgb3RoZXIgY29udHJvbHMgaW4gYm90aCB0aGUgcmVxdWVzdCBhbmQgdGhlIHJlc3VsdAogICAgICAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUm90YXRlQW5kQ3JvcEF1dG87CisgICAgICAgIC8vIE9yaWdpbmFsIHZhbHVlIG9mIFRFU1RfUEFUVEVSTl9NT0RFIGFuZCBEQVRBIHNvIHRoYXQgdGhleSBjYW4gYmUKKyAgICAgICAgLy8gcmVzdG9yZWQgd2hlbiBzZW5zb3IgbXV0aW5nIGlzIHR1cm5lZCBvZmYKKyAgICAgICAgaW50MzJfdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU9yaWdpbmFsVGVzdFBhdHRlcm5Nb2RlOworICAgICAgICBpbnQzMl90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtT3JpZ2luYWxUZXN0UGF0dGVybkRhdGFbNF07CisKICAgICAgICAgLy8gV2hldGhlciB0aGlzIGNhcHR1cmUgcmVxdWVzdCBoYXMgaXRzIHpvb20gcmF0aW8gc2V0IHRvIDEuMHggYmVmb3JlCiAgICAgICAgIC8vIHRoZSBmcmFtZXdvcmsgb3ZlcnJpZGVzIGl0IGZvciBjYW1lcmEgSEFMIGNvbnN1bXB0aW9uLgogICAgICAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtWm9vbVJhdGlvSXMxeDsKKyAgICAgICAgLy8gVGhlIHN5c3RlbVRpbW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KyAgICAgICAgQUxPR0UoIkluamVjdGlvbiBjYW1lcmEgdHJhbnNhY3Rpb24gZXJyb3Igd2hlbiBnZXR0aW5nIHJlc3VsdCBtZXRhZGF0YSBxdWV1ZSAiCisgICAgICAgICAgICAgICAgImZyb20gY2FtZXJhIHNlc3Npb246ICVzIiwgcmVzdWx0UXVldWVSZXQuZGVzY3JpcHRpb24oKS5jX3N0cigpKTsKKyAgICAgICAgcmV0dXJuIERFQURfT0JKRUNUOworICAgIH0KKyAgICBJRl9BTE9HVigpIHsKKyAgICAgICAgc2Vzc2lvbi0+aW50ZXJmYWNlQ2hhaW4oCisgICAgICAgICAgICAgICAgW10oOjphbmRyb2lkOjpoYXJkd2FyZTo6aGlkbF92ZWM8OjphbmRyb2lkOjpoYXJkd2FyZTo6aGlkbF9zdHJpbmc+CisgICAgICAgICAgICAgICAgICAgICAgICBpbnRlcmZhY2VDaGFpbikgeworICAgICAgICAgICAgICAgICAgICAgICAgQUxPR1YoIkluamVjdGlvbiBjYW1lcmEgc2Vzc2lvbiBpbnRlcmZhY2UgY2hhaW46Iik7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGF1dG8mIGlmYWNlIDogaW50ZXJmYWNlQ2hhaW4pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HVigiICAlcyIsIGlmYWNlLmNfc3RyKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0pOworICAgIH0KKworICAgIEFMT0dWKCIlczogSW5qZWN0aW9uIGNhbWVyYSBpbnRlcmZhY2UgPSBuZXcgSGFsSW50ZXJmYWNlKCkiLCBfX0ZVTkNUSU9OX18pOworICAgIG1JbmplY3RlZENhbUhhbEludGVyZmFjZSA9CisgICAgICAgICAgICBuZXcgSGFsSW50ZXJmYWNlKHNlc3Npb24sIHF1ZXVlLCBwYXJlbnQtPm1Vc2VIYWxCdWZNYW5hZ2VyLAorICAgICAgICAgICAgICAgICAgICAgICB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worICAgICAgICByZXR1cm4gSU5WQUxJRF9PUEVSQVRJT047CisgICAgfQorCisgICAgbnNlY3NfdCBtYXhFeHBlY3RlZER1cmF0aW9uID0gcGFyZW50LT5nZXRFeHBlY3RlZEluRmxpZ2h0RHVyYXRpb24oKTsKKyAgICBib29sIHdhc0FjdGl2ZSA9IGZhbHNlOworICAgIGlmIChwYXJlbnQtPm1TdGF0dXMgPT0gU1RBVFVTX0FDVElWRSkgeworICAgICAgICBBTE9HVigiJXM6IExldCB0aGUgZGV2aWNlIGJlIElETEUgYW5kIHRoZSByZXF1ZXN0IHRocmVhZCBpcyBwYXVzZWQiLAorICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHBhcmVudC0+bVBhdXNlU3RhdGVOb3RpZnkgPSB0cnVlOworICAgICAgICByZXMgPSBwYXJlbnQtPmludGVybmFsUGF1c2VBbmRXYWl0TG9ja2VkKG1heEV4cGVjdGVkRHVyYXRpb24pOworICAgICAgICBpZiAocmVzICE9IE9LKSB7CisgICAgICAgICAgICBBTE9HRSgiJXM6IENhbid0IHBhdXNlIGNhcHR1cmVzIHRvIGluamVjdCBjYW1lcmEhIiwgX19GVU5DVElPTl9fKTsKKyAgICAgICAgICAgIHJldHVybiByZXM7CisgICAgICAgIH0KKyAgICAgICAgd2FzQWN0aXZlID0gdHJ1ZTsKKyAgICB9CisKKyAgICBBTE9HVigiJXM6IEluamVjdGlvbiBjYW1lcmE6IHJlcGxhY2VIYWxJbnRlcmZhY2UiLCBfX0ZVTkNUSU9OX18pOworICAgIHJlcyA9IHJlcGxhY2VIYWxJbnRlcmZhY2UobUluamVjdGVkQ2FtSGFsSW50ZXJmYWNlLCB0cnVlKTsKKyAgICBpZiAocmVzICE9IE9LKSB7CisgICAgICAgIEFMT0dFKCIlczogRmFpbGVkIHRvIHJlcGxhY2UgdGhlIG5ldyBIYWxJbnRlcmZhY2UhIiwgX19GVU5DVElPTl9fKTsKKyAgICAgICAgaW5qZWN0aW9u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lbnQtPmludGVybmFsUGF1c2VBbmRXYWl0TG9ja2VkKG1heEV4cGVjdGVkRHVyYXRpb24pOworICAgICAgICBpZiAocmVzICE9IE9LKSB7CisgICAgICAgICAgICBBTE9HRSgiJXM6IENhbid0IHBhdXNlIGNhcHR1cmVzIHRvIHN0b3AgaW5qZWN0aW9uISIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgICAgICByZXR1cm4gcmVzOworICAgICAgICB9CisgICAgICAgIHdhc0FjdGl2ZSA9IHRydWU7CisgICAgfQorCisgICAgcmVzID0gcmVwbGFjZUhhbEludGVyZmFjZShtQmFja3VwSGFsSW50ZXJmYWNlLCBmYWxzZSk7CisgICAgaWYgKHJlcyAhPSBPSykgeworICAgICAgICBBTE9HRSgiJXM6IEZhaWxlZCB0byByZXN0b3JlIHRoZSBiYWNrdXAgSGFsSW50ZXJmYWNlISIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIGluamVjdGlvbkRpc2Nvbm5lY3RJbXBsKCk7CisgICAgICAgIHJldHVybiByZXM7CisgICAgfQorICAgIGluamVjdGlvbkRpc2Nvbm5lY3RJbXBsKCk7CisKKyAgICBpZiAod2FzQWN0aXZlKSB7CisgICAgICAgIEFMT0dWKCIlczogUmVzdGFydGluZyBhY3Rpdml0eSB0byBzdG9wIGluamVjdGlvbiIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIC8vIFJldXNlIGN1cnJlbnQgb3BlcmF0aW5nIG1vZGUgYW5kIHNlc3Npb24gcGFyYW1ldGVycyBmb3IgbmV3IHN0cmVhbQorICAgICAgICAvLyBjb25maWcuCisgICAgICAgIHBhcmVudC0+aW50ZXJuYWxVcGRhdGVTdGF0dXNMb2NrZWQoU1RBVFVTX0FDVElWRSk7CisgICAgfQorCisgICAgcmV0dXJuIE9LOworfQorCitib29sIENhbWVyYTNEZXZpY2U6OkNhbWVyYTNEZXZpY2VJbmplY3Rpb25NZXRob2RzOjppc0luamVjdGluZygpIHsKKyAgICBpZiAobUluamVjdGVkQ2FtSGFsSW50ZXJmYWNlID09IG51bGxwdHIpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0gZWxzZSB7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KK30KKworY29uc3QgU3RyaW5nOCYgQ2FtZXJhM0RldmljZTo6Q2FtZXJhM0RldmljZUluamVjdGlvbk1ldGhvZHM6OmdldEluamVjdGVkQ2FtSWQoKQorICAgICAgICBjb25zdCB7CisgICAgcmV0dXJuIG1JbmplY3RlZENhbUlkOworfQorCit2b2lkIENhbWVyYTNEZXZpY2U6OkNhbWVyYTNEZXZpY2VJbmplY3Rpb25NZXRob2RzOjpnZXRJbmplY3Rpb25Db25maWcoCisgICAgICAgIC8qb3V0Ki8gY2FtZXJhMzo6Y2FtZXJhX3N0cmVhbV9jb25maWd1cmF0aW9uKiBpbmplY3Rpb25Db25maWcsCisgICAgICAgIC8qb3V0Ki8gc3RkOjp2ZWN0b3I8dWludDMyX3Q+KiBpbmplY3Rpb25CdWZmZXJTaXplcykgeworICAgIGlmIChpbmplY3Rpb25Db25maWcgPT0gbnVsbHB0ciB8fCBpbmplY3Rpb25CdWZmZXJTaXplcyA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dFKCIlczogSW5qZWN0aW9uIGNvbmZpZ3VyYXRpb24gYXJndW1lbnRzIG11c3Qgbm90IGJlIG51bGwhIiwgX19GVU5DVElPTl9fKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgICppbmplY3Rpb25Db25maWcgPSBtSW5qZWN0aW9uQ29uZmlnOworICAgICppbmplY3Rpb25CdWZmZXJTaXplcyA9IG1JbmplY3Rpb25CdWZmZXJTaXplczsKK30KKworCitzdGF0dXNfdCBDYW1lcmEzRGV2aWNlOjpDYW1lcmEzRGV2aWNlSW5qZWN0aW9uTWV0aG9kczo6aW5qZWN0aW9uQ29uZmlndXJlU3RyZWFtcygKKyAgICAgICAgY2FtZXJhMzo6Y2FtZXJhX3N0cmVhb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8gcmV0dXJuLgorICAgICAgICB9CisgICAgfQorCisgICAgaWYgKGludGVyZmFjZSAhPSBudWxscHRyKSB7CisgICAgICAgIGludGVyZmFjZS0+Y2xvc2UoKTsKKyAgICB9CisKKyAgICB7CisgICAgICAgIE11dGV4OjpBdXRvbG9jayBsb2NrKG1JbmplY3Rpb25Mb2NrKTsKKyAgICAgICAgaWYgKG1JbmplY3RlZENhbUhhbEludGVyZmFjZSAhPSBudWxscHRyKSB7CisgICAgICAgICAgICBtSW5qZWN0ZWRDYW1IYWxJbnRlcmZhY2UtPmNsZWFyKCk7CisgICAgICAgICAgICBtSW5qZWN0ZWRDYW1IYWxJbnRlcmZhY2UgPSBudWxscHRyOworICAgICAgICB9CisgICAgfQorfQorCitzdGF0dXNfdCBDYW1lcmEzRGV2aWNlOjpDYW1lcmEzRGV2aWNlSW5qZWN0aW9uTWV0aG9kczo6cmVwbGFjZUhhbEludGVyZmFjZSgKKyAgICAgICAgc3A8SGFsSW50ZXJmYWNlPiBuZXdIYWxJbnRlcmZhY2UsIGJvb2wga2VlcEJhY2t1cCkgeworICAgIE11dGV4OjpBdXRvbG9jayBsb2NrKG1JbmplY3Rpb25Mb2NrKTsKKyAgICBpZiAobmV3SGFsSW50ZXJmYWNlLmdldCgpID09IG51bGxwdHIpIHsKKyAgICAgICAgQUxPR0UoIiVzOiBUaGUgbmV3SGFsSW50ZXJmYWNlIGRvZXMgbm90IGV4aXN0LCB0byBzdG9wIHJlcGxhY2luZy4iLAorICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHJldHVybiBERUFEX09CSkVDVDsKKyAgICB9CisKKyAgICBzcDxDYW1lcmEzRGV2aWNlPiBwYXJlbnQgPSBtUGFyZW50LnByb21vdGUoKTsKKyAgICBpZiAocGFyZW50ID09IG51bGxwdHIpIHsKKyAgICAgICAgQUxPR0UoIiVzOiBwYXJlbnQgZG9lcyBub3QgZXhpc3QhIiwgX19GVU5DVElPTl9fKTsKKyAgICA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yYTNJT1N0cmVhbUJhc2U6OmhhbmRvdXRCdWZmZXJMb2NrZWQoY2FtZXJhM19zdHJlYW1fYnVmZmVyICZidWZmZXIsCit2b2lkIENhbWVyYTNJT1N0cmVhbUJhc2U6OmhhbmRvdXRCdWZmZXJMb2NrZWQoY2FtZXJhX3N0cmVhbV9idWZmZXIgJmJ1ZmZlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXJfaGFuZGxlX3QgKmhhbmRsZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgYWNxdWlyZUZlbmNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCByZWxlYXNlRmVuY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FtZXJhM19idWZmZXJfc3RhdHVzX3Qgc3RhdHVzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbWVyYV9idWZmZXJfc3RhdHVzX3Qgc3RhdHVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgb3V0cHV0KSB7CiAgICAgLyoqCiAgICAgICogTm90ZSB0aGF0IGFsbCBmZW5jZXMgYXJlIG5vdyBvd25lZCBieSBIQUwuCkBAIC0yMjAsNyArMjIyLDcgQEAKIH0KIAogc3RhdHVzX3QgQ2FtZXJhM0lPU3RyZWFtQmFzZTo6cmV0dXJuQW55QnVmZmVyTG9ja2VkKAotICAgICAgICBjb25zdCBjYW1lcmEzX3N0cmVhbV9idWZmZXIgJmJ1ZmZlciwKKyAgICAgICAgY29uc3QgY2FtZXJhX3N0cmVhbV9idWZmZXIgJmJ1ZmZlciwKICAgICAgICAgbnNlY3NfdCB0aW1lc3RhbXAsCiAgICAgICAgIGJvb2wgb3V0cHV0LAogICAgICAgICBjb25zdCBzdGQ6O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X3Q+KG1pblVuZGVxdWV1ZWRCdWZmZXJzKTsKIAotICAgICAgICBpZiAoY2FtZXJhM19zdHJlYW06Om1heF9idWZmZXJzID09IDApIHsKKyAgICAgICAgaWYgKGNhbWVyYV9zdHJlYW06Om1heF9idWZmZXJzID09IDApIHsKICAgICAgICAgICAgIEFMT0dFKCIlczogJWQ6IEhBTCBzZXRzIG1heF9idWZmZXIgdG8gMC4gTXVzdCBiZSBhdCBsZWFzdCAxLiIsCiAgICAgICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXywgX19MSU5FX18pOwogICAgICAgICAgICAgcmV0dXJuIElOVkFMSURfT1BFUkFUSU9OOwogICAgICAgICB9CiAKICAgICAgICAgLyoKLSAgICAgICAgICogV2UgcHJvbWlzZSBuZXZlciB0byAnYWNxdWlyZScgbW9yZSB0aGFuIGNhbWVyYTNfc3RyZWFtOjptYXhfYnVmZmVycworICAgICAgICAgKiBXZSBwcm9taXNlIG5ldmVyIHRvICdhY3F1aXJlJyBtb3JlIHRoYW4gY2FtZXJhX3N0cmVhbTo6bWF4X2J1ZmZlcnMKICAgICAgICAgICogYXQgYW55IG9uZSB0aW1lLgogICAgICAgICAgKgogICAgICAgICAgKiBCb29zdCB0aGUgbnVtYmVyIHVwIHRvIG1lZXQgdGhlIG1pbmltdW0gcmVxdWlyZWQgYnVmZmVyIGNvdW50LgpAQCAtMjU5LDggKzI2Niw4IEBACiAgICAgICAgICAqIChOb3RlIHRoYXQgdGhpcyBzZXRzIGNvbnN1bWVyLXNpZGUgYnVmZmVyIGNvdW50IG9ubHksCiAgICAgICAgICAqIGFuZCBub3QgdGhlIHN1bSBvZiBwcm9kdWNlcitjb25zdW1lciBzaWRlIGFzIGluIG90aGVyIGNhbWVyYSBzdHJlYW1zKS4KICAgICAgICAgICovCi0gICAgICAgIG1Ub3RhbEJ1ZmZlckNvdW50ID0gY2FtZXJhM19zdHJlYW06Om1heF9idWZmZXJzID4gbWluQnVmcyA/Ci0gICAgICAgICAgICBj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ICAgICAgICAgICAgICAgICAgICAgICBhbmRyb2lkX2RhdGFzcGFjZSBkYXRhU3BhY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbWVyYTNfc3RyZWFtX3JvdGF0aW9uX3Qgcm90YXRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbWVyYV9zdHJlYW1fcm90YXRpb25fdCByb3RhdGlvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgU3RyaW5nOCYgcGh5c2ljYWxDYW1lcmFJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnVub3JkZXJlZF9zZXQ8aW50MzJfdD4gJnNlbnNvclBpeGVsTW9kZXNVc2VkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50NjRfdCBjb25zdW1lclVzYWdlLCBuc2Vjc190IHRpbWVzdGFtcE9mZnNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNldElkKSA6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBzZXRJZCwgYm9vbCBpc011bHRpUmVzb2x1dGlvbikgOgogICAgICAgICBDYW1lcmEzSU9TdHJlYW1CYXNlKGlkLCB0eXBlLCB3aWR0aCwgaGVpZ2h0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qbWF4U2l6ZSovMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXQsIGRhdGFTcGFjZSwgcm90YXRpb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGh5c2ljYWxDYW1lcmFJZCwgc2V0SWQpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBoeXNpY2FsQ2FtZXJhSWQsIHNlbnNvclBpeGVsTW9kZXNVc2VkLCBzZXRJZCwgaXNN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cmVhbTo6d2lkdGgsIGNhbWVyYTNfc3RyZWFtOjpoZWlnaHQsCisgICAgICAgICAgICAgICAgX19GVU5DVElPTl9fLCBjYW1lcmFfc3RyZWFtOjp3aWR0aCwgY2FtZXJhX3N0cmVhbTo6aGVpZ2h0LAogICAgICAgICAgICAgICAgIG1NYXhTaXplLCBtSWQpOwogICAgICAgICByZXR1cm4gcmVzOwogICAgIH0KICAgICByZXMgPSBuYXRpdmVfd2luZG93X3NldF9idWZmZXJzX2Zvcm1hdChtQ29uc3VtZXIuZ2V0KCksCi0gICAgICAgICAgICBjYW1lcmEzX3N0cmVhbTo6Zm9ybWF0KTsKKyAgICAgICAgICAgIGNhbWVyYV9zdHJlYW06OmZvcm1hdCk7CiAgICAgaWYgKHJlcyAhPSBPSykgewogICAgICAgICBBTE9HRSgiJXM6IFVuYWJsZSB0byBjb25maWd1cmUgc3RyZWFtIGJ1ZmZlciBmb3JtYXQgJSN4IGZvciBzdHJlYW0gJWQiLAotICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXywgY2FtZXJhM19zdHJlYW06OmZvcm1hdCwgbUlkKTsKKyAgICAgICAgICAgICAgICBfX0ZVTkNUSU9OX18sIGNhbWVyYV9zdHJlYW06OmZvcm1hdCwgbUlkKTsKICAgICAgICAgcmV0dXJuIHJlczsKICAgICB9CiAKICAgICByZXMgPSBuYXRpdmVfd2luZG93X3NldF9idWZmZXJzX2RhdGFfc3BhY2UobUNvbnN1bWVyLmdldCgpLAotICAgICAgICAgICAgY2FtZXJhM19zdHJlYW06OmRhdGFfc3BhY2UpOworICAgICAgICAgICAgY2FtZXJhX3N0cmVhbTo6ZGF0YV9zcGFjZSk7CiAgICAgaWYgKHJlcyAhPSBPSykgewogICAgICAgICBBTE9HRSgiJXM6IFVuYWJsZSB0byBjb25maWd1cmUgc3RyZWFtIGRhdGFzcGFjZSAlI3ggZm9yIHN0cmVhbSAlZCIsCi0gICAgICAgICAgICAgICAgX19GVU5DVElPTl9fLCBjYW1l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FsQnVmZmVyQ291bnQgOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW1lcmFfc3RyZWFtOjptYXhfYnVmZmVycykgLSBtSGFuZG91dFRvdGFsQnVmZmVyQ291bnQ7CiAgICAgICAgIG1Mb2NrLnVubG9jaygpOwogCiAgICAgICAgIG5zZWNzX3QgZGVxdWV1ZVN0YXJ0ID0gc3lzdGVtVGltZShTWVNURU1fVElNRV9NT05PVE9OSUMpOwotICAgICAgICByZXMgPSBjdXJyZW50Q29uc3VtZXItPmRlcXVldWVCdWZmZXIoY3VycmVudENvbnN1bWVyLmdldCgpLCBhbmIsIGZlbmNlRmQpOworCisgICAgICAgIHNpemVfdCBiYXRjaFNpemUgPSBtQmF0Y2hTaXplLmxvYWQoKTsKKyAgICAgICAgaWYgKGJhdGNoU2l6ZSA9PSAxKSB7CisgICAgICAgICAgICBzcDxBTmF0aXZlV2luZG93PiBhbncgPSBjb25zdW1lcjsKKyAgICAgICAgICAgIHJlcyA9IGFudy0+ZGVxdWV1ZUJ1ZmZlcihhbncuZ2V0KCksIGFuYiwgZmVuY2VGZCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBzdGQ6OnVuaXF1ZV9sb2NrPHN0ZDo6bXV0ZXg+IGJhdGNoTG9jayhtQmF0Y2hMb2NrKTsKKyAgICAgICAgICAgIHJlcyA9IE9LOworICAgICAgICAgICAgaWYgKG1CYXRjaGVkQnVmZmVycy5zaXplKCkgPT0gMCkgeworICAgICAgICAgICAgICAgIGlmIChyZW1haW5pbmdCdWZmZXJzID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgQUxPR0UoIiVzOiBjYW5ub3QgZ2V0IGJ1ZmZlciB3aGlsZSBhbGwgYnVmZmVycyBhcmUgaGFuZGVkIG91dCIsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBJTlZBTElEX09QRVJBVElPTjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGJhdGNoU2l6ZSA+IHJlbWFpbmluZ0J1ZmZlcnMpIHsKKyAgICAgICAgICAgICAgICAgICAgYmF0Y2hTaXplID0gcmVtYWluaW5nQnVmZmVyczsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYmF0Y2hMb2NrLnVubG9jaygpOworICAgICAgICAgICAgICAgIC8vIFJlZmlsbCBiYXRjaGVkIGJ1ZmZlcnMKKyAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxTdXJmYWNlOjpCYXRjaEJ1ZmZlcj4gYmF0Y2hlZEJ1ZmZlcnM7CisgICAgICAgICAgICAgICAgYmF0Y2hlZEJ1ZmZlcnMucmVzaXplKGJhdGNoU2l6ZSk7CisgICAgICAgICAgICAgICAgcmVzID0gY29uc3VtZXItPmRlcXVldWVCdWZmZXJzKCZiYXRjaGVkQnVmZmVycyk7CisgICAgICAgICAgICAgICAgYmF0Y2hMb2NrLmxvY2soKTsKKyAgICAgICAgICAgICAgICBpZiAocmVzICE9IE9LKSB7CisgICAgICAgICAgICAgICAgICAgIEFMT0dFKCIlczogYmF0Y2ggZGVxdWV1ZUJ1ZmZlcnMgY2FsbCBmYWlsZWQhICVzICglZCkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXywgc3RyZXJyb3IoLXJlcyksIHJlcyk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbUJhdGNoZWRCdWZmZXJzID0gc3RkOjptb3ZlKGJhdGNoZWRCdWZmZXJzKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChyZXMgPT0gT0spIHsKKyAgICAgICAgICAgICAgICAvLyBEaXNwYXRjaCBiYXRjaCBidWZmZXJzCisgICAgICAgICAgICAgICAgKmFuYiA9IG1CYXRjaGVkQnVmZmVycy5iYWNrKCkuYnVmZmVyOworICAgICAgICAgICAgICAg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HVkZSA8dXRpbHMvUmVmQmFzZS5oPgogI2luY2x1ZGUgPGd1aS9JUHJvZHVjZXJMaXN0ZW5lci5oPgogI2luY2x1ZGUgPGd1aS9TdXJmYWNlLmg+CkBAIC00Nyw2ICs0OCw3IEBACiAgICAgdWludDY0X3QgY29tYmluZWRVc2FnZTsKICAgICBzaXplX3QgdG90YWxCdWZmZXJDb3VudDsKICAgICBib29sIGlzQ29uZmlndXJlZDsKKyAgICBib29sIGlzTXVsdGlSZXM7CiAgICAgZXhwbGljaXQgU3RyZWFtSW5mbyhpbnQgaWQgPSBDQU1FUkEzX1NUUkVBTV9JRF9JTlZBTElELAogICAgICAgICAgICAgaW50IHNldElkID0gQ0FNRVJBM19TVFJFQU1fU0VUX0lEX0lOVkFMSUQsCiAgICAgICAgICAgICB1aW50MzJfdCB3ID0gMCwKQEAgLTU1LDcgKzU3LDggQEAKICAgICAgICAgICAgIGFuZHJvaWRfZGF0YXNwYWNlIGRzID0gSEFMX0RBVEFTUEFDRV9VTktOT1dOLAogICAgICAgICAgICAgdWludDY0X3QgdXNhZ2UgPSAwLAogICAgICAgICAgICAgc2l6ZV90IGJ1ZmZlckNvdW50ID0gMCwKLSAgICAgICAgICAgIGJvb2wgY29uZmlndXJlZCA9IGZhbHNlKSA6CisgICAgICAgICAgICBib29sIGNvbmZpZ3VyZWQgPSBmYWxzZSwKKyAgICAgICAgICAgIGJvb2wgbXVsdGlSZXMgPSBmYWxzZSkgOgogICAgICAgICAgICAgICAgIHN0cmVhbUlkKGlkKSwKICAgICAgICAgICAgICAgICBzdHJlYW1TZXRJZChzZXRJZCksCiAgICAgICAgICAgICAgICAgd2lkdGgodyksCkBAIC02NCw3ICs2Nyw4IEBACiAgICAgICAgICAgICAgICAgZGF0YVNwYWNlKGRzKSwKICAgICAgICAgICAgICAgICBjb21iaW5lZFVzYWdlKHVzYWdlKSwKICAgICAgICAgICAgICAgICB0b3RhbEJ1ZmZlckNvdW50KGJ1ZmZlckNvdW50KSwKLSAg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AgICAgICBpZiAoY2FtZXJhSWRJdGVyICE9IHJlcXVlc3QucGh5c2ljYWxDYW1lcmFJZHMuZW5kKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgcmVxdWVzdC5waHlzaWNhbENhbWVyYUlkcy5lcmFzZShjYW1lcmFJZEl0ZXIpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIFNFVF9FUlIoIlRvdGFsIHJlc3VsdCBmb3IgZnJhbWUgJWQgaGFzIGFscmVhZHkgcmV0dXJuZWQgZm9yIGNhbWVyYSAlcyIsCisgICAgICAgICAgICAgICAgYm9vbCB2YWxpZFBoeXNpY2FsQ2FtZXJhTWV0YWRhdGEgPQorICAgICAgICAgICAgICAgICAgICAgICAgZXJhc2VQaHlzaWNhbENhbWVyYUlkU2V0KHJlcXVlc3QucGh5c2ljYWxDYW1lcmFJZHMsIHBoeXNpY2FsSWQpOworICAgICAgICAgICAgICAgIGlmICghdmFsaWRQaHlzaWNhbENhbWVyYU1ldGFkYXRhKSB7CisgICAgICAgICAgICAgICAgICAgIFNFVF9FUlIoIlVuZXhwZWN0ZWQgdG90YWwgcmVzdWx0IGZvciBmcmFtZSAlZCBjYW1lcmEgJXMiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lTnVtYmVyLCBwaHlzaWNhbElkLmNfc3RyKCkpOwogICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgfQpAQCAtNjAyLDcgKzY0NSw3IEBACiAgICAgICAgIGlmIChzaHV0dGVyVGltZXN0YW1wICE9IDApIHsKICAgICAgICAgICAgIHJldHVybkFuZFJlbW92ZVBlbmRpbmdPdXRwdXRCdWZmZXJzKAogICAgICAgICAgICAgICAgIHN0YXRlcy51c2VIYWxCdWZNYW5hZ2VyLCBzdGF0ZXMubGlzdGVuZXIsCi0gICAgICAgICAgICAgICAgcmVxdWVzdCk7CisgICAgICAgICAgICAgICAgcmVxdWVzdCwg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gICAgICAgICAgICAgICAgICAgIChtc2cuZXJyb3JfY29kZSA8IENBTUVSQV9NU0dfTlVNX0VSUk9SUykpID8KICAgICAgICAgICAgIGhhbEVycm9yTWFwW21zZy5lcnJvcl9jb2RlXSA6CiAgICAgICAgICAgICBoYXJkd2FyZTo6Y2FtZXJhMjo6SUNhbWVyYURldmljZUNhbGxiYWNrczo6RVJST1JfQ0FNRVJBX0lOVkFMSURfRVJST1I7CiAKQEAgLTEwMzIsMTQgKzEwOTUsMTQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvckNvZGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwaHlzaWNhbENhbWVyYUlkLnNpemUoKSA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmc4IGNhbWVyYUlkKHBoeXNpY2FsQ2FtZXJhSWQpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1dG8gaXRlciA9IHIucGh5c2ljYWxDYW1lcmFJZHMuZmluZChjYW1lcmFJZCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZXIgPT0gci5waHlzaWNhbENhbWVyYUlkcy5lbmQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgdmFsaWRQaHlzaWNhbENhbWVyYUlkID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyYXNlUGh5c2ljYWxDYW1lcmFJZFNldChyLnBoeXNpY2FsQ2FtZXJhSWRzLCBjYW1lcmFJZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF2YWxpZFBoeXNpY2FsQ2FtZXJhSWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxPR0UoIiVzOiBSZXBvcnRlZCByZXN1bHQgZmFpbHVyZSBmb3IgcGh5c2ljYWwgY2FtZXJhIGRldmljZTogJXMgIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIgd2hpY2ggaXMgbm90IHBhcnQgb2YgdGhlIHJlc3BlY3RpdmUgcmVxdWVzdCEiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXywgY2FtZXJhSWQuc3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgci5waHlzaWNhbENhbWVyYUlkcy5lcmFzZShpdGVyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRFeHRyYXMuZXJyb3JQaHlzaWNhbENhbWVyYUlkID0gcGh5c2ljYWxDYW1lcmFJZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaHlzaWNhbERldmljZVJlc3VsdEVycm9yID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KQEAgLTEwODUsMTMgKzExNDgsMTMgQEAKICAgICB9CiB9CiAKLXZvaWQgbm90aWZ5KENhcHR1cmVPdXRwdXRTdGF0ZXMmIHN0YXRlcywgY29uc3QgY2FtZXJhM19ub3RpZnlfbXNnICptc2cpIHsKK3ZvaWQgbm90aWZ5KENhcHR1cmVPdXRwdXRTdGF0ZXMmIHN0YXRlcywgY29uc3QgY2FtZXJhX25vdGlmeV9tc2cgKm1zZykgewogICAgIHN3aXRjaCAobXNnLT50eXBlKSB7Ci0gICAgICAgIGNhc2UgQ0FNRVJBM19NU0dfRVJST1I6IHsKKyAgICAgICAgY2FzZSBDQU1FUkFfTVNHX0VSUk9SOiB7CiAgICAgICAgICAgICBub3RpZnlFcnJvcihzdGF0ZXMsIG1zZy0+bWVzc2FnZS5lcnJvcik7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQotICAgICAgICBjYXNlIENBTUVSQTNfTVNHX1NIVVRURVI6IHsKKyAgICAgICAgY2FzZSBDQU1FUkFfTVNHX1NIVVRURVI6IHsKICAgICAgICAgICAgIG5vdGlmeVNodXR0ZXIoc3RhdGVzLCBtc2ctPm1lc3NhZ2Uuc2h1dHRlcik7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQpAQCAtMTEwNywxMCArMTE3MCwxMCBAQAogICAgIHVzaW5nIGFuZHJvaWQ6OmhhcmR3YXJlOjpjYW1lcmE6OmRldmljZTo6VjNfMjo6RXJyb3JDb2RlOwogCiAgICAgQVRSQUNFX0NBTEwoKTsKLSAgICBjYW1lcmEzX25vdGlmeV9tc2cgbTsKKyAgICBjYW1lcmFfbm90aWZ5X21zZyBtOwogICAgIHN3aXRjaCAobXNnLnR5cGUpIHsKICAgICAgICAgY2FzZSBNc2dUeXBlOjpFUlJPUjoKLSAgICAgICAgICAgIG0udHlwZSA9IENBTUVSQTNfTVNHX0VSUk9SOworICAgICAgICAgICAgbS50eXBlID0gQ0FNRVJBX01TR19FUlJPUjsKICAgICAgICAgICAgIG0ubWVzc2FnZS5lcnJvci5mcmFtZV9udW1iZXIgPSBtc2cubXNnLmVycm9yLmZyYW1lTnVtYmVyOwogICAgICAgICAgICAgaWYgKG1zZy5tc2cuZXJyb3IuZXJyb3JTdHJlYW1JZCA+PSAwKSB7CiAgICAgICAgICAgICAgICAgc3A8Q2FtZXJhM1N0cmVhbUludGVyZmFjZT4gc3RyZWFtID0KQEAgLTExMjYsMjEgKzExODksMjEgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHN3aXRjaCAobXNnLm1zZy5lcnJvci5lcnJvckNvZGUpIHsKICAgICAgICAgICAgICAgICBjYXNlIEVycm9yQ29kZTo6RVJST1JfREVWSUNFOgotICAgICAgICAgICAgICAgICAgICBtLm1lc3NhZ2UuZXJyb3IuZXJyb3JfY29kZSA9IENBTUVSQTNfTVNHX0VSUk9SX0RFVklDRTsKKyAgICAgICAgICAgICAgICAgICAgbS5tZXNzYWdlLmVycm9yLmVycm9yX2NvZGUgPSBDQU1FUkFfTVNHX0VSUk9SX0RFVklDRTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgY2FzZSBFcnJvckNvZGU6OkVSUk9SX1JFUVVFU1Q6Ci0gICAgICAgICAgICAgICAgICAgIG0ubWVzc2FnZS5lcnJvci5lcnJvcl9jb2RlID0gQ0FNRVJBM19NU0dfRVJST1JfUkVRVUVTVDsKKyAgICAgICAgICAgICAgICAgICAgbS5tZXNzYWdlLmVycm9yLmVycm9yX2NvZGUgPSBDQU1FUkFfTVNHX0VSUk9SX1JFUVVFU1Q7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIGNhc2UgRXJyb3JDb2RlOjpFUlJPUl9SRVNVTFQ6Ci0gICAgICAgICAgICAgICAgICAgIG0ubWVzc2FnZS5lcnJvci5lcnJvcl9jb2RlID0gQ0FNRVJBM19NU0dfRVJST1JfUkVTVUxUOworICAgICAgICAgICAgICAgICAgICBtLm1lc3NhZ2UuZXJyb3IuZXJyb3JfY29kZSA9IENBTUVSQV9NU0dfRVJST1JfUkVTVUxUOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlIEVycm9yQ29kZTo6RVJST1JfQlVGRkVSOgotICAgICAgICAgICAgICAgICAgICBtLm1lc3NhZ2UuZXJyb3IuZXJyb3JfY29kZSA9IENBTUVSQTNfTVNHX0VSUk9SX0JVRkZFUjsKKyAgICAgICAgICAgICAgICAgICAgbS5tZXNzYWdlLmVycm9yLmVycm9yX2NvZGUgPSBDQU1FUkFfTVNHX0VSUk9SX0JVRkZFUjsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgY2FzZSBNc2dUeXBlOjpTSFVUVEVSOgotICAgICAgICAgICAgbS50eXBlID0gQ0FNRVJBM19NU0dfU0hVVFRFUjsKKyAgICAgICAgICAgIG0udHlwZSA9IENBTUVSQV9NU0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VxdWVzdCB0aHJlYWQKICAgICAgICAgICAgIC8vIFdlIG5lZWQgdG8gdXBkYXRlIHRoZSB3YWl0IGR1cmF0aW9uIGV2ZXJ5dGltZSB3ZSBjYWxsIGdldGJ1ZmZlcgogICAgICAgICAgICAgbnNlY3NfdCB3YWl0RHVyYXRpb24gPSAgc3RhdGVzLnJlcUJ1ZmZlckludGYuZ2V0V2FpdER1cmF0aW9uKCk7CkBAIC0xMjU1LDYgKzEzMTgsNyBAQAogICAgICAgICAgICAgICAgICAgICBBTE9HVigiJXM6IENhbid0IGdldCBvdXRwdXQgYnVmZmVyIGZvciBzdHJlYW0gJWQ6ICVzICglZCkiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXywgc3RyZWFtSWQsIHN0cmVycm9yKC1yZXMpLCByZXMpOwogICAgICAgICAgICAgICAgICAgICBidWZSZXQudmFsLmVycm9yKFN0cmVhbUJ1ZmZlclJlcXVlc3RFcnJvcjo6U1RSRUFNX0RJU0NPTk5FQ1RFRCk7CisgICAgICAgICAgICAgICAgICAgIHN0YXRlcy5zZXNzaW9uU3RhdHNCdWlsZGVyLnN0b3BDb3VudGVyKHN0cmVhbUlkKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXM6IENhbid0IGdldCBvdXRwdXQgYnVmZmVyIGZvciBzdHJlYW0gJWQ6ICVzICglZCkiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXywgc3RyZWFtSWQsIHN0cmVycm9yKC1yZXMpLCByZXMpOwpAQCAtMTMxNSwxMiArMTM3OSwxMyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGZvciAoc2l6ZV90IGIgPSAwOyBiIDwgbnVtQWxsb2NhdGVkQnVmZmVyczsgYisrKSB7Ci0gICAgICAgICAgICAgICAgY2FtZXJhM19zdHJlYW1fYnVmZmVyX3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ZXJhX3N0cmVhbSogaGFsU3RyZWFtID0gc3RyZWFtLT5hc0hhbFN0cmVhbSgpOwogICAgICAgICAgICAgICAgIHN0cmVhbUJ1ZmZlci5zdHJlYW0gPSBoYWxTdHJlYW07CiAgICAgICAgICAgICAgICAgc3dpdGNoIChoYWxTdHJlYW0tPnN0cmVhbV90eXBlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgQ0FNRVJBM19TVFJFQU1fT1VUUFVUOgorICAgICAgICAgICAgICAgICAgICBjYXNlIENBTUVSQV9TVFJFQU1fT1VUUFVUOgogICAgICAgICAgICAgICAgICAgICAgICAgcmVzID0gc3RyZWFtLT5yZXR1cm5CdWZmZXIoc3RyZWFtQnVmZmVyLCAvKnRpbWVzdGFtcCovIDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qdGltZXN0YW1wSW5jcmVhc2luZyovdHJ1ZSwgc3RkOjp2ZWN0b3I8c2l6ZV90PiAoKSwgZnJhbWVOdW1iZXIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKnRpbWVzdGFtcEluY3JlYXNpbmcqL3RydWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHNpemVfdD4gKCksIGZyYW1lTnVtYmVyKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXMgIT0gT0spIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTE9HRSgiJXM6IENhbid0IHJldHVybiBvdXRwdXQgYnVmZmVyIGZvciBmcmFtZSAlZCB0byIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIHN0cmVhbSAlZDogJXMgKCVkKSIsICBfX0ZVTkNUSU9OX18sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJhbWVOdW1iZXIsIHN0cmVhbUlkLCBzdHJlcnJvcigtcmVzKSwgcmVzKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICA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NhbmRpbmcgYnVmZmVyIGNvdW50IGdvZXMgZnJvbSAlenUgdG8gJXp1LCAiCisgICAgICAgICAgICAgICAgICAgICJnZXRCdWZmZXIocykgY2FsbCBtdXN0IG5vdCBydW4gaW4gcGFyYWxsZWwhIiwgX19GVU5DVElPTl9fLAorICAgICAgICAgICAgICAgICAgICBudW1PdXRzdGFuZGluZ0J1ZmZlcnMsIHVwZGF0ZWROdW1PdXRzdGFuZGluZ0J1ZmZlcnMpOworICAgICAgICAgICAgcmV0dXJuIElOVkFMSURfT1BFUkFUSU9OOworICAgICAgICB9CisgICAgICAgIG51bU91dHN0YW5kaW5nQnVmZmVycyA9IHVwZGF0ZWROdW1PdXRzdGFuZGluZ0J1ZmZlcnM7CisgICAgfQorCisgICAgcmVzID0gZ2V0QnVmZmVyc0xvY2tlZChidWZmZXJzKTsKKyAgICBpZiAocmVzID09IE9LKSB7CisgICAgICAgIGZvciAoYXV0byYgb3V0c3RhbmRpbmdCdWZmZXIgOiAqYnVmZmVycykgeworICAgICAgICAgICAgY2FtZXJhX3N0cmVhbV9idWZmZXIqIGJ1ZmZlciA9IG91dHN0YW5kaW5nQnVmZmVyLm91dEJ1ZmZlcjsKKyAgICAgICAgICAgIGZpcmVCdWZmZXJMaXN0ZW5lcnNMb2NrZWQoKmJ1ZmZlciwgLyphY3F1aXJlZCovdHJ1ZSwgLypvdXRwdXQqL3RydWUpOworICAgICAgICAgICAgaWYgKGJ1ZmZlci0+YnVmZmVyKSB7CisgICAgICAgICAgICAgICAgTXV0ZXg6OkF1dG9sb2NrIGwobU91dHN0YW5kaW5nQnVmZmVyc0xvY2spOworICAgICAgICAgICAgICAgIG1PdXRzdGFuZGluZ0J1ZmZlcnMucHVzaF9iYWNrKCpidWZmZXItPmJ1ZmZlcik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gcmVzOworfQorCiB9OyAvLyBuYW1lc3BhY2UgY2FtZXJhMwogCiB9OyAvLyBuYW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wcGVySW5mbywgY2xhbXApOwogCi0gICAgaWYgKCFtVmFsaWRHcmlkcykgewotICAgICAgICBzdGF0dXNfdCByZXMgPSBidWlsZEdyaWRzKCk7CisgICAgaWYgKCFtYXBwZXJJbmZvLT5tVmFsaWRHcmlkcykgeworICAgICAgICBzdGF0dXNfdCByZXMgPSBidWlsZEdyaWRzKG1hcHBlckluZm8pOwogICAgICAgICBpZiAocmVzICE9IE9LKSByZXR1cm4gcmVzOwogICAgIH0KIAogICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY29vcmRDb3VudCAqIDI7IGkgKz0gMikgewotICAgICAgICBjb25zdCBHcmlkUXVhZCAqcXVhZCA9IGZpbmRFbmNsb3NpbmdRdWFkKGNvb3JkUGFpcnMgKyBpLCBtRGlzdG9ydGVkR3JpZCk7CisgICAgICAgIGNvbnN0IEdyaWRRdWFkICpxdWFkID0gZmluZEVuY2xvc2luZ1F1YWQoY29vcmRQYWlycyArIGksIG1hcHBlckluZm8tPm1EaXN0b3J0ZWRHcmlkKTsKICAgICAgICAgaWYgKHF1YWQgPT0gbnVsbHB0cikgewogICAgICAgICAgICAgQUxPR0UoIlJhdyB0byBjb3JyZWN0ZWQgbWFwcGluZyBmYWlsdXJlOiBObyBxdWFkIGZvdW5kIGZvciAoJWQsICVkKSIsCiAgICAgICAgICAgICAgICAgICAgICooY29vcmRQYWlycyArIGkpLCAqKGNvb3JkUGFpcnMgKyBpICsgMSkpOwpAQCAtMjQ0LDggKzMxNCw4IEBACiAKICAgICAgICAgLy8gQ2xhbXAgdG8gd2l0aGluIGFjdGl2ZSBhcnJheQogICAgICAgICBpZiAoY2xhbXApIHsKLSAgICAgICAgICAgIGNvcnJYID0gc3RkOjptaW4obUFjdGl2ZVdpZHRoIC0gMSwgc3RkOjptYXgoMC5mLCBjb3JyWCkpOwotICAgICAgICAgICAgY29yclkgPSBzdGQ6Om1pbihtQWN0aXZlSGVpZ2h0IC0gMSwgc3RkOjptYXgoMC5mLCBjb3JyWSkpO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Bjb25zdCBzdGQ6OmFycmF5PGZsb2F0LCA1PiAma0sgPSBtYXBwZXJJbmZvLT5tSzsKICAgICAgICAgZmxvYXQgclNxID0geHdpICogeHdpICsgeXdpICogeXdpOwotICAgICAgICBmbG9hdCBGciA9IDEuZiArIChtS1swXSAqIHJTcSkgKyAobUtbMV0gKiByU3EgKiByU3EpICsgKG1LWzJdICogclNxICogclNxICogclNxKTsKLSAgICAgICAgZmxvYXQgeGMgPSB4d2kgKiBGciArIChtS1szXSAqIDIgKiB4d2kgKiB5d2kpICsgbUtbNF0gKiAoclNxICsgMiAqIHh3aSAqIHh3aSk7Ci0gICAgICAgIGZsb2F0IHljID0geXdpICogRnIgKyAobUtbNF0gKiAyICogeHdpICogeXdpKSArIG1LWzNdICogKHJTcSArIDIgKiB5d2kgKiB5d2kpOworICAgICAgICBmbG9hdCBGciA9IDEuZiArIChrS1swXSAqIHJTcSkgKyAoa0tbMV0gKiByU3EgKiByU3EpICsgKGtLWzJdICogclNxICogclNxICogclNxKTsKKyAgICAgICAgZmxvYXQgeGMgPSB4d2kgKiBGciArIChrS1szXSAqIDIgKiB4d2kgKiB5d2kpICsga0tbNF0gKiAoclNxICsgMiAqIHh3aSAqIHh3aSk7CisgICAgICAgIGZsb2F0IHljID0geXdpICogRnIgKyAoa0tbNF0gKiAyICogeHdpICogeXdpKSArIGtLWzNdICogKHJTcSArIDIgKiB5d2kgKiB5d2kpOwogICAgICAgICAvLyBNb3ZlIGJhY2sgdG8gaW1hZ2Ugc3BhY2UKLSAgICAgICAgZmxvYXQgeHIgPSBtRnggKiB4YyArIG1TICogeWMgKyBtQ3g7Ci0gICAgICAgIGZsb2F0IHlyID0gbUZ5ICogeWMgKyBtQ3k7CisgICAgICAgIGZsb2F0IHhyID0gbWFwcGVySW5mby0+bUZ4ICogeGMgKyBtYXBwZXJJbmZvLT5tUyAqIHljICsgbWFwcGVySW5mby0+bUN4OworICAgICAgICBmbG9hdCB5ciA9IG1hcHBlckluZm8tPm1GeSA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hc3MgRGlzdG9ydGlvbk1hcHBlciA6IHB1YmxpYyBDb29yZGluYXRlTWFwcGVyIHsKICAgcHVibGljOgogICAgIERpc3RvcnRpb25NYXBwZXIoKTsKIAogICAgIERpc3RvcnRpb25NYXBwZXIoY29uc3QgRGlzdG9ydGlvbk1hcHBlciYgb3RoZXIpIDoKLSAgICAgICAgICAgIG1WYWxpZE1hcHBpbmcob3RoZXIubVZhbGlkTWFwcGluZyksIG1WYWxpZEdyaWRzKG90aGVyLm1WYWxpZEdyaWRzKSwKLSAgICAgICAgICAgIG1GeChvdGhlci5tRngpLCBtRnkob3RoZXIubUZ5KSwgbUN4KG90aGVyLm1DeCksIG1DeShvdGhlci5tQ3kpLCBtUyhvdGhlci5tUyksCi0gICAgICAgICAgICBtSW52Rngob3RoZXIubUludkZ4KSwgbUludkZ5KG90aGVyLm1JbnZGeSksIG1LKG90aGVyLm1LKSwKLSAgICAgICAgICAgIG1BcnJheVdpZHRoKG90aGVyLm1BcnJheVdpZHRoKSwgbUFycmF5SGVpZ2h0KG90aGVyLm1BcnJheUhlaWdodCksCi0gICAgICAgICAgICBtQWN0aXZlV2lkdGgob3RoZXIubUFjdGl2ZVdpZHRoKSwgbUFjdGl2ZUhlaWdodChvdGhlci5tQWN0aXZlSGVpZ2h0KSwKLSAgICAgICAgICAgIG1BcnJheURpZmZYKG90aGVyLm1BcnJheURpZmZYKSwgbUFycmF5RGlmZlkob3RoZXIubUFycmF5RGlmZlkpLAotICAgICAgICAgICAgbUNvcnJlY3RlZEdyaWQob3RoZXIubUNvcnJlY3RlZEdyaWQpLCBtRGlzdG9ydGVkR3JpZChvdGhlci5tRGlzdG9ydGVkR3JpZCkge30KKyAgICAgICAgICAgIG1EaXN0b3J0aW9uTWFwcGVySW5mbyhvdGhlci5tRGlzdG9ydGlvbk1hcHBlckluZm8pLAorICAgICAgICAgICAgbURpc3RvcnRpb25NYXBwZXJJbmZvTWF4aW11bVJlc29sdXRpb24ob3RoZXIubURpc3RvcnRpb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JpbmcoaWQpOworICAgICAgICB9CisgICAgICAgIG1Db21wb25lbnROYW1lcy5hZGQoaWQsIGNvbXBvbmVudE5hbWUpOworICAgICAgICBBTE9HRV9JRihlcnIgPCAwLCAiJXM6IENhbid0IGFkZCBuZXcgY29tcG9uZW50ICVkICglcyk6ICVzICglemQpIiwKKyAgICAgICAgICAgICAgICBfX0ZVTkNUSU9OX18sIGlkLCBjb21wb25lbnROYW1lLmNfc3RyKCksIHN0cmVycm9yKC1lcnIpLCBlcnIpOwogICAgIH0KIAogICAgIGlmIChlcnIgPj0gMCkgewpAQCAtNjgsNiArNzIsNyBAQAogICAgICAgICBNdXRleDo6QXV0b2xvY2sgbChtTG9jayk7CiAgICAgICAgIEFMT0dWKCIlczogUmVtb3ZpbmcgY29tcG9uZW50ICVkIiwgX19GVU5DVElPTl9fLCBpZCk7CiAgICAgICAgIGlkeCA9IG1TdGF0ZXMucmVtb3ZlSXRlbShpZCk7CisgICAgICAgIG1Db21wb25lbnROYW1lcy5yZW1vdmVJdGVtKGlkKTsKICAgICB9CiAKICAgICBpZiAoaWR4ID49IDApIHsKQEAgLTgwLDYgKzg1LDIwIEBACiB9CiAKIAordm9pZCBTdGF0dXNUcmFja2VyOjpkdW1wQWN0aXZlQ29tcG9uZW50cygpIHsKKyAgICBNdXRleDo6QXV0b2xvY2sgbChtTG9jayk7CisgICAgaWYgKG1EZXZpY2VTdGF0ZSA9PSBJRExFKSB7CisgICAgICAgIEFMT0dJKCIlczogYWxsIGNvbXBvbmVudHMgYXJlIElETEUiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICByZXR1cm47CisgICAgfQorICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgbVN0YXRlcy5zaXplKCk7IGkrKykgeworICAgICAgICBpZiAobVN0YXRlcy52YWx1ZUF0KGkpID09IEFDVElWRSkgeworICAgICAgICAgICAgQUxPR0koIiVzOiBjb21wb25lbnQgJWQgKCVzKSBpcyBhY3RpdmUiLCBfX0ZVTkNUS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ByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFTZXNzaW9uQ29uZmlndXJhdGlvblV0aWxzOjpnZXRBcnJheVdpZHRoQW5kSGVpZ2h0KCZkZXZpY2VJbmZvLAorICAgICAgICAgICAgICAgIEFORFJPSURfU0VOU09SX0lORk9fUFJFX0NPUlJFQ1RJT05fQUNUSVZFX0FSUkFZX1NJWkVfTUFYSU1VTV9SRVNPTFVUSU9OLAorICAgICAgICAgICAgICAgICZtQXJyYXlXaWR0aE1heGltdW1SZXNvbHV0aW9uLCAmbUFycmF5SGVpZ2h0TWF4aW11bVJlc29sdXRpb24pKSB7CisgICAgICAgICAgICBBTE9HRSgiJXM6IENvdWxkbid0IGdldCBtYXhpbXVtIHJlc29sdXRpb24gcHJlIGNvcnJlY3Rpb24gYWN0aXZlIGFycmF5IHNpemUiLAorICAgICAgICAgICAgICAgICAgICBfX0ZVTkNUSU9OX18pOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKCFTZXNzaW9uQ29uZmlndXJhdGlvblV0aWxzOjpnZXRBcnJheVdpZHRoQW5kSGVpZ2h0KCZkZXZpY2VJbmZvLAorICAgICAgICAgICAgICAgIEFORFJPSURfU0VOU09SX0lORk9fQUNUSVZFX0FSUkFZX1NJWkUsICZtQXJyYXlXaWR0aCwKKyAgICAgICAgICAgICAgICAmbUFycmF5SGVpZ2h0KSkgeworICAgICAgICAgICAgQUxPR0UoIiVzOiBDb3VsZG4ndCBnZXQgYWN0aXZlIGFycmF5IHNpemUiLCBfX0ZVTkNUSU9OX18pOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGlmICghU2Vzc2lvbkNvbmZpZ3VyYXRpb25VdGlsczo6Z2V0QXJyYXlXaWR0aEFuZEhlaWdodCgmZGV2aWNlSW5mbywKKyAgICAgICAgICAgICAgICBBTkRST0lEX1NFTlNPUl9JTkZPX0FDVElWRV9BUlJBWV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nZXQgbWF4aW11bSByZXNvbHV0aW9uIHByZSBjb3JyZWN0aW9uIGFjdGl2ZSBhcnJheSBzaXplIiwKKyAgICAgICAgICAgICAgICAgICAgX19GVU5DVElPTl9fKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICAgaWYgKCFTZXNzaW9uQ29uZmlndXJhdGlvblV0aWxzOjpnZXRBcnJheVdpZHRoQW5kSGVpZ2h0KGRldmljZUluZm8sCisgICAgICAgICAgICAgICAgQU5EUk9JRF9TRU5TT1JfSU5GT19BQ1RJVkVfQVJSQVlfU0laRV9NQVhJTVVNX1JFU09MVVRJT04sCisgICAgICAgICAgICAgICAgJmFjdGl2ZU1heGltdW1SZXNvbHV0aW9uVywgJmFjdGl2ZU1heGltdW1SZXNvbHV0aW9uSCkpIHsKKyAgICAgICAgICAgIEFMT0dFKCIlczogQ291bGRuJ3QgZ2V0IG1heGltdW0gcmVzb2x1dGlvbiBwcmUgY29ycmVjdGlvbiBhY3RpdmUgYXJyYXkgc2l6ZSIsCisgICAgICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXyk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICB9CiAKICAgICBpZiAodXNlUHJlY29ycmVjdEFycmF5KSB7CiAgICAgICAgIG1BcnJheVdpZHRoID0gYXJyYXlXOwogICAgICAgICBtQXJyYXlIZWlnaHQgPSBhcnJheUg7CisgICAgICAgIG1BcnJheVdpZHRoTWF4aW11bVJlc29sdXRpb24gPSBhcnJheU1heGltdW1SZXNvbHV0aW9uVzsKKyAgICAgICAgbUFycmF5SGVpZ2h0TWF4aW11bVJlc29sdXRpb24gPSBhcnJheU1heGltdW1SZXNvbHV0aW9uSDsKICAgICB9IGVsc2UgewogICAgICAgICBtQXJyYXlXaWR0aCA9IGFjdGl2ZVc7CiAgICAgICAgIG1BcnJheUhlaWdodCA9IGFjdGl2ZUg7CisgICAgICAgIG1BcnJheVdpZHRoTWF4aW11bVJlc29s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cExvY2tlZChDYW1lcmFNZXRhZGF0YSogbWV0YWRhdGEsIGJvb2wgaXNSZXN1bHQsCisgICAgICAgIGludCBhcnJheVdpZHRoLCBpbnQgYXJyYXlIZWlnaHQpIHsKKyAgICBmbG9hdCB6b29tUmF0aW8gPSAxLjA7CisgICAgc3RhdHVzX3QgcmVzID0gZGVyaXZlWm9vbVJhdGlvKG1ldGFkYXRhLCAmem9vbVJhdGlvLCBhcnJheVdpZHRoLCBhcnJheUhlaWdodCk7CisKKyAgICBpZiAocmVzICE9IE9LKSB7CisgICAgICAgIEFMT0dFKCIlczogRmFpbGVkIHRvIGRlcml2ZSB6b29tIHJhdGlvOiAlcyglZCkiLAorICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXywgc3RyZXJyb3IoLXJlcyksIHJlcyk7CisgICAgICAgIHJldHVybiByZXM7CisgICAgfQogCiAgICAgLy8gVXBkYXRlIHpvb21SYXRpbyBtZXRhZGF0YSB0YWcKICAgICByZXMgPSBtZXRhZGF0YS0+dXBkYXRlKEFORFJPSURfQ09OVFJPTF9aT09NX1JBVElPLCAmem9vbVJhdGlvLCAxKTsKQEAgLTI1NywxMiArMzU1LDE0IEBACiAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAvLyBUb3AgbGVmdCAoaW5jbHVzaXZlKQotICAgICAgICAgICAgc2NhbGVDb29yZGluYXRlcyhlbnRyeS5kYXRhLmkzMiArIGosIDEsIHpvb21SYXRpbywgdHJ1ZSAvKmNsYW1wKi8pOworICAgICAgICAgICAgc2NhbGVDb29yZGluYXRlcyhlbnRyeS5kYXRhLmkzMiArIGosIDEsIHpvb21SYXRpbywgdHJ1ZSAvKmNsYW1wKi8sIGFycmF5V2lkdGgsCisgICAgICAgICAgICAgICAgICAgIGFycmF5SGVpZ2h0KTsKICAgICAgICAgICAgIC8vIEJvdHRvbSByaWdodCAoZXhjbHVzaXZlKTogVXNlIGFkamFjZW50IGluY2x1c2l2ZSBwaXhlbCB0bwogICAgICAgICAgICAgLy8gY2FsY3VsYXRlLgogICAgICAgICAgICAgZW50cnkuZGF0YS5pMzJbaisyXSAtPSAxOwogICAgICAgICAgICAgZW50cnkuZGF0YS5pMzJbaiszXSAtPSAxOwotICAgICAgICAgICAgc2NhbGVDb29yZGluYXRlcyhlbnRyeS5kYXRhLmkzMiArIGogKyAyLCAxLCB6b29tUmF0aW8sIHRydWUgLypjbGFtcCovKTsKKyAgICAgICAgICAgIHNjYWxlQ29vcmRpbmF0ZXMoZW50cnkuZGF0YS5pMzIgKyBqICsgMiwgMSwgem9vbVJhdGlvLCB0cnVlIC8qY2xhbXAqLywgYXJyYXlXaWR0aCwKKyAgICAgICAgICAgICAgICAgICAgYXJyYXlIZWlnaHQpOwogICAgICAgICAgICAgZW50cnkuZGF0YS5pMzJbaisyXSArPSAxOwogICAgICAgICAgICAgZW50cnkuZGF0YS5pMzJbaiszXSArPSAxOwogICAgICAgICB9CkBAIC0yNzAsMjAgKzM3MCwyMiBAQAogCiAgICAgZm9yIChhdXRvIHJlY3QgOiBrUmVjdHNUb0NvcnJlY3QpIHsKICAgICAgICAgZW50cnkgPSBtZXRhZGF0YS0+ZmluZChyZWN0KTsKLSAgICAgICAgc2NhbGVSZWN0cyhlbnRyeS5kYXRhLmkzMiwgZW50cnkuY291bnQgLyA0LCB6b29tUmF0aW8pOworICAgICAgICBzY2FsZVJlY3RzKGVudHJ5LmRhdGEuaTMyLCBlbnRyeS5jb3VudCAvIDQsIHpvb21SYXRpbywgYXJyYXlXaWR0aCwgYXJyYXlIZWlnaHQpOwogICAgIH0KIAogICAgIGlmIChpc1Jlc3VsdCkgewogICAgICAgICBmb3IgKGF1dG8gcHRzIDoga1Jlc3VsdFBvaW50c1RvQ29ycmVjdE5vQ2xhbXApIHsKICAgICAgICAgICAgIGVudHJ5ID0gbWV0YWRhdGEtPmZpbmQocHRzKTsKLSAgICAgICAgICAgIHNjYWxlQ29vcmRpbmF0ZXMoZW50cnku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wMSwyOSArNDAyLDMyIEBACiAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAvLyBUb3AtbGVmdCAoaW5jbHVzaXZlKQotICAgICAgICAgICAgc2NhbGVDb29yZGluYXRlcyhlbnRyeS5kYXRhLmkzMiArIGosIDEsIDEuMCAvIHpvb21SYXRpbywgdHJ1ZSAvKmNsYW1wKi8pOworICAgICAgICAgICAgc2NhbGVDb29yZGluYXRlcyhlbnRyeS5kYXRhLmkzMiArIGosIDEsIDEuMCAvIHpvb21SYXRpbywgdHJ1ZSAvKmNsYW1wKi8sIGFycmF5V2lkdGgsCisgICAgICAgICAgICAgICAgICAgIGFycmF5SGVpZ2h0KTsKICAgICAgICAgICAgIC8vIEJvdHRvbS1yaWdodCAoZXhjbHVzaXZlKTogVXNlIGFkamFjZW50IGluY2x1c2l2ZSBwaXhlbCB0bwogICAgICAgICAgICAgLy8gY2FsY3VsYXRlLgogICAgICAgICAgICAgZW50cnkuZGF0YS5pMzJbaisyXSAtPSAxOwogICAgICAgICAgICAgZW50cnkuZGF0YS5pMzJbaiszXSAtPSAxOwotICAgICAgICAgICAgc2NhbGVDb29yZGluYXRlcyhlbnRyeS5kYXRhLmkzMiArIGogKyAyLCAxLCAxLjAgLyB6b29tUmF0aW8sIHRydWUgLypjbGFtcCovKTsKKyAgICAgICAgICAgIHNjYWxlQ29vcmRpbmF0ZXMoZW50cnkuZGF0YS5pMzIgKyBqICsgMiwgMSwgMS4wIC8gem9vbVJhdGlvLCB0cnVlIC8qY2xhbXAqLywgYXJyYXlXaWR0aCwKKyAgICAgICAgICAgICAgICAgICAgYXJyYXlIZWlnaHQpOwogICAgICAgICAgICAgZW50cnkuZGF0YS5pMzJbaisyXSArPSAxOwogICAgICAgICAgICAgZW50cnkuZGF0YS5pMzJbaiszXSArPSAxOwogICAgICAgICB9CiAgICAgfQogICAgIGZvciAoYXV0byByZWN0IDoga1JlY3RzVG9Db3JyZWN0KSB7CiAg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ZFkgPSB5Q2VudGVyZWQgKiBzY2FsZVJhdGlvOwotICAgICAgICBzY2FsZWRYICs9IChtQXJyYXlXaWR0aCAtIDIpIC8gMjsKLSAgICAgICAgc2NhbGVkWSArPSAobUFycmF5SGVpZ2h0IC0gMikgLyAyOworICAgICAgICBzY2FsZWRYICs9IChhcnJheVdpZHRoIC0gMikgLyAyOworICAgICAgICBzY2FsZWRZICs9IChhcnJheUhlaWdodCAtIDIpIC8gMjsKICAgICAgICAgY29vcmRQYWlyc1tpXSA9IHN0YXRpY19jYXN0PGludDMyX3Q+KHN0ZDo6cm91bmQoc2NhbGVkWCkpOwogICAgICAgICBjb29yZFBhaXJzW2krMV0gPSBzdGF0aWNfY2FzdDxpbnQzMl90PihzdGQ6OnJvdW5kKHNjYWxlZFkpKTsKICAgICAgICAgLy8gQ2xhbXAgdG8gd2l0aGluIGFjdGl2ZUFycmF5L3ByZUNvcnJlY3Rpb25BY3RpdmVBcnJheQogICAgICAgICBpZiAoY2xhbXApIHsKLSAgICAgICAgICAgIGludDMyX3QgcmlnaHQgPSBtQXJyYXlXaWR0aCAtIDE7Ci0gICAgICAgICAgICBpbnQzMl90IGJvdHRvbSA9IG1BcnJheUhlaWdodCAtIDE7CisgICAgICAgICAgICBpbnQzMl90IHJpZ2h0ID0gYXJyYXlXaWR0aCAtIDE7CisgICAgICAgICAgICBpbnQzMl90IGJvdHRvbSA9IGFycmF5SGVpZ2h0IC0gMTsKICAgICAgICAgICAgIGNvb3JkUGFpcnNbaV0gPQogICAgICAgICAgICAgICAgICAgICBzdGQ6Om1pbihyaWdodCwgc3RkOjptYXgoMCwgY29vcmRQYWlyc1tpXSkpOwogICAgICAgICAgICAgY29vcmRQYWlyc1tpKzFdID0KQEAgLTM2Nyw3ICs0NzEsNyBAQAogfQogCiB2b2lkIFpvb21SYXRpb01hcHBlcjo6c2NhbGVSZWN0cyhpbnQzMl90KiByZWN0cywgaW50IHJlY3RDb3VudCwKLSAgICAgICAgZmxvYXQgc2Nhb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WVudCBpZiBpdCBkZWNpZGVzIHRvCiAgICAgICAgIC8vIHVzZSBmbXEuCiAgICAgICAgIGlmIChlLnNldHRpbmdzLmdldERpc2NyaW1pbmF0b3IoKSA9PQotICAgICAgICAgICAgRm1xU2l6ZU9yTWV0YWRhdGE6OmhpZGxfZGlzY3JpbWluYXRvcjo6Zm1xTWV0YWRhdGFTaXplKSB7CisgICAgICAgICAgICBWMl8wOjpGbXFTaXplT3JNZXRhZGF0YTo6aGlkbF9kaXNjcmltaW5hdG9yOjpmbXFNZXRhZGF0YVNpemUpIHsKICAgICAgICAgICAgIC8qKgogICAgICAgICAgICAgICogR2V0IHNldHRpbmdzIGZyb20gdGhlIGZtcS4KICAgICAgICAgICAgICAqLwpAQCAtMTk2LDYgKzE5NiwxMiBAQAogCiBSZXR1cm48SFN0YXR1cz4gSGlkbENhbWVyYURldmljZVVzZXI6OmVuZENvbmZpZ3VyZShTdHJlYW1Db25maWd1cmF0aW9uTW9kZSBvcGVyYXRpbmdNb2RlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgaGlkbF92ZWM8dWludDhfdD4mIHNlc3Npb25QYXJhbXMpIHsKKyAgICByZXR1cm4gZW5kQ29uZmlndXJlXzJfMShvcGVyYXRpbmdNb2RlLCBzZXNzaW9uUGFyYW1zLCBzeXN0ZW1UaW1lKCkpOworfQorCitSZXR1cm48SFN0YXR1cz4gSGlkbENhbWVyYURldmljZVVzZXI6OmVuZENvbmZpZ3VyZV8yXzEoU3RyZWFtQ29uZmlndXJhdGlvbk1vZGUgb3BlcmF0aW5nTW9kZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGhpZGxfdmVjPHVpbnQ4X3Q+JiBzZXNzaW9uUGFyYW1zLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnNlY3NfdCBzdGFydFRpbWVOcykgewogICAgIGFuZHJvaWQ6OkNhbWVyYU1ldGFkYXRhIGNhbWVyYU1ldGFkYXRhOwogICAgIGlmICghY29udmVydEZyb21IaWRsKHNlc3Npb25QYXJhbXMsICZjYW1lcmFNZXRhZGF0YSkpIHsKICAgICAgICAgcmV0dXJuIEhTdGF0dXM6OklMTEVHQUxfQVJHVU1FTlQ7CkBAIC0yMDMsNyArMjA5LDggQEAKIAogICAgIHN0ZDo6dmVjdG9yPGludD4gb2ZmbGluZVN0cmVhbUlkczsKICAgICBiaW5kZXI6OlN0YXR1cyByZXQgPSBtRGV2aWNlUmVtb3RlLT5lbmRDb25maWd1cmUoY29udmVydEZyb21IaWRsKG9wZXJhdGluZ01vZGUpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW1lcmFNZXRhZGF0YSwgJm9mZmxpbmVTdHJlYW1JZHMpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW1lcmFNZXRhZGF0YSwgbnMybXMoc3RhcnRUaW1lTnMpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmb2ZmbGluZVN0cmVhbUlkcyk7CiAgICAgcmV0dXJuIEIySFN0YXR1cyhyZXQpOwogfQogCmRpZmYgLS1naXQgYS9zZXJ2aWNlcy9jYW1lcmEvbGliY2FtZXJhc2VydmljZS9oaWRsL0hpZGxDYW1lcmFEZXZpY2VVc2VyLmggYi9zZXJ2aWNlcy9jYW1lcmEvbGliY2FtZXJhc2VydmljZS9oaWRsL0hpZGxDYW1lcmFEZXZpY2VVc2VyLmgKaW5kZXggYzNhODBmZS4uMGUyYWIzZCAxMDA2NDQKLS0tIGEvc2VydmljZXMvY2FtZXJhL2xpYmNhbWVyYXNlcnZpY2UvaGlkbC9IaWRsQ2FtZXJhRGV2aWNlVXNlci5oCisrKyBiL3NlcnZpY2VzL2NhbWVyYS9sa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gZnJvbSAiZnJhbWV3b3Jrc19hdl9zZXJ2aWNlc19jYW1lcmFfbGliY2FtZXJhc2VydmljZV9saWNlbnNlIgorICAgIC8vIHRvIGdldCB0aGUgYmVsb3cgbGljZW5zZSBraW5kczoKKyAgICAvLyAgIFNQRFgtbGljZW5zZS1pZGVudGlmaWVyLUFwYWNoZS0yLjAKKyAgICBkZWZhdWx0X2FwcGxpY2FibGVfbGljZW5zZXM6IFsKKyAgICAgICAgImZyYW1ld29ya3NfYXZfc2VydmljZXNfY2FtZXJhX2xpYmNhbWVyYXNlcnZpY2VfbGljZW5zZSIsCisgICAgXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogImNhbWVyYV9zZXJ2aWNlX2Z1enplciIsCisgICAgc3JjczogWworICAgICAgICAiY2FtZXJhX3NlcnZpY2VfZnV6emVyLmNwcCIsCisgICAgXSwKKyAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGlibWVkaWFfaGVhZGVycyIsCisgICAgXSwKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGliYmluZGVyIiwKKyAgICAgICAgImxpYmJhc2UiLAorICAgICAgICAibGlidXRpbHMiLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICAgICAgImxpYmNhbWVyYXNlcnZpY2UiLAorICAgICAgICAibGliY2FtZXJhX2NsaWVudCIsCisgICAgICAgICJsaWJsb2ciLAorICAgICAgICAibGlidWkiLAorICAgICAgICAibGliZ3VpIiwKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuY2FtZXJhLmNvbW1vbkAxLjAiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5jYW1lcmEucHJvdmlkZXJAMi40IiwKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuY2FtZXJhLnByb3ZpZGVyQDIuNSIsCisgICAgICAgICJhbmRyb2lkLmhhcmR3YXJlLmNhbWVyYS5wcm92aWRlckAyLjYiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5j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dFX0hXX1JFTkRFUiovLCAgICAweDAwMDEwMDAwIC8qR1JBTExPQ19VU0FHRV9IV19WSURFT19FTkNPREVSKi99OworY29uc3QgaW50IGtDYW1lcmFNc2dbXSA9IHsweDAwMSAvKkNBTUVSQV9NU0dfRVJST1IqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgMHgwMDIgLypDQU1FUkFfTVNHX1NIVVRURVIqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgMHgwMDQgLypDQU1FUkFfTVNHX0ZPQ1VTKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MDA4IC8qQ0FNRVJBX01TR19aT09NKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MDEwIC8qQ0FNRVJBX01TR19QUkVWSUVXX0ZSQU1FKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MDIwIC8qQ0FNRVJBX01TR19WSURFT19GUkFNRSAqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgMHgwNDAgLypDQU1FUkFfTVNHX1BPU1RWSUVXX0ZSQU1FKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MDgwIC8qQ0FNRVJBX01TR19SQVdfSU1BR0UgKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MTAwIC8qQ0FNRVJBX01TR19DT01QUkVTU0VEX0lNQUdFKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MjAwIC8qQ0FNRVJBX01TR19SQVdfSU1BR0VfTk9USUZZKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgIDB4NDAwIC8qQ0FNRVJBX01TR19QUkVWSUVXX01FVEFEQVRBKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgIDB4ODAwIC8qQ0FNRVJBX01TR19GT0NVU19NT1ZFKi99OworY29uc3QgaW50MzJfdCBrRXZlbnRJZFtdID0ge0lDYW1lcmFTZXJ2aWNlOjpFVkVOVF9VU0VSX1NXSVRDSEVELCBJQ2FtZXJ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worICAgIGlmIChDQU1FUkFfTVNHX0ZPQ1VTID09IG1zZ1R5cGUpIHsKKyAgICAgICAgTXV0ZXg6OkF1dG9sb2NrIGwobUF1dG9Gb2N1c0xvY2spOworICAgICAgICBtQXV0b0ZvY3VzTWVzc2FnZSA9IHRydWU7CisgICAgICAgIG1BdXRvRm9jdXNDb25kaXRpb24uYnJvYWRjYXN0KCk7CisgICAgfQorfTsKKwordm9pZCBDYW1lcmFGdXp6ZXI6OmRhdGFDYWxsYmFjayhpbnQzMl90IG1zZ1R5cGUsIGNvbnN0IHNwPElNZW1vcnk+ICYgLypkYXRhKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbWVyYV9mcmFtZV9tZXRhZGF0YV90ICopIHsKKyAgICBzd2l0Y2ggKG1zZ1R5cGUpIHsKKyAgICAgICAgY2FzZSBDQU1FUkFfTVNHX1BSRVZJRVdfRlJBTUU6IHsKKyAgICAgICAgICAgIE11dGV4OjpBdXRvbG9jayBsKG1QcmV2aWV3TG9jayk7CisgICAgICAgICAgICArK21QcmV2aWV3QnVmZmVyQ291bnQ7CisgICAgICAgICAgICBtUHJldmlld0NvbmRpdGlvbi5icm9hZGNhc3QoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgQ0FNRVJBX01TR19DT01QUkVTU0VEX0lNQUdFOiB7CisgICAgICAgICAgICBNdXRleDo6QXV0b2xvY2sgbChtU25hcHNob3RMb2NrKTsKKyAgICAgICAgICAgIG1TbmFwc2hvdE5vdGlmaWNhdGlvbiA9IHRydWU7CisgICAgICAgICAgICBtU25hcHNob3RDb25kaXRpb24uYnJvYWRjYXN0KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgYnJlYWs7CisgICAgfQorfTsKKworc3RhdHVzX3QgQ2FtZXJhRnV6emVyOjp3YWl0Rm9yUHJldmlld1N0YXJ0KCkgeworICAgIHN0YXR1c190IHJjID0gTk9fRVJST1I7CisgICAgTXV0ZXg6OkF1dG9sb2NrIGwobVByZXZpZXdMb2NrKTsKKyAgICBtUHJldmlld0J1ZmZlckNvdW50ID0gMDsKKworICAgIHdoaWxlIChtUHJldmlld0J1ZmZlckNvdW50IDwga1ByZXZpZXdUaHJlc2hvbGQpIHsKKyAgICAgICAgcmMgPSBtUHJldmlld0NvbmRpdGlvbi53YWl0UmVsYXRpdmUobVByZXZpZXdMb2NrLCBrUHJldmlld1RpbWVvdXQpOworICAgICAgICBpZiAoTk9fRVJST1IgIT0gcmMpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIHJjOworfQorCitzdGF0dXNfdCBDYW1lcmFGdXp6ZXI6OndhaXRGb3JFdmVudChNdXRleCAmbXV0ZXgsIENvbmRpdGlvbiAmY29uZGl0aW9uLCBib29sICZmbGFnKSB7CisgICAgc3RhdHVzX3QgcmMgPSBOT19FUlJPUjsKKyAgICBNdXRleDo6QXV0b2xvY2sgbChtdXRleCk7CisgICAgZmxhZyA9IGZhbHNlOworCisgICAgd2hpbGUgKCFmbGFnKSB7CisgICAgICAgIHJjID0gY29uZGl0aW9uLndhaXRSZWxhdGl2ZShtdXRleCwga0V2ZW50VGltZW91dCk7CisgICAgICAgIGlmIChOT19FUlJPUiAhPSByYykgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gcmM7Cit9CisKK3ZvaWQgQ2FtZXJhRnV6emVyOjpkZUluaXQoKSB7CisgICAgaWYgKG1Db21wb3NlckNsaWVudCkgeworICAgICAgICBtQ29tcG9zZXJDbGllbnQtPmRpc3Bvc2UoKTsKKyAgICB9Cit9CisKK3ZvaWQgQ2FtZXJhRnV6emVyOjpnZXROdW1DYW1lcmFzKCkgeworICAgIGJvb2wgc2hvdWxkUGFzc0ludmFsaWRDYW1UeXBlID0gbUZ1enplZERhdGFQcm92aWRlci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ICAgICAvKnRhcmdldFNka1ZlcnNpb24qL19fQU5EUk9JRF9BUElfRlVUVVJFX18sICZjYW1lcmFEZXZpY2UpOworICAgICAgICBpZiAoIXJjLmlzT2soKSkgeworICAgICAgICAgICAgLy8gY2FtZXJhIG5vdCBjb25uZWN0ZWQKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBpZiAoY2FtZXJhRGV2aWNlKSB7CisgICAgICAgICAgICBzcDxTdXJmYWNlPiBwcmV2aWV3U3VyZmFjZTsKKyAgICAgICAgICAgIHNwPFN1cmZhY2VDb250cm9sPiBzdXJmYWNlQ29udHJvbDsKKyAgICAgICAgICAgIENhbWVyYVBhcmFtZXRlcnMgcGFyYW1zKGNhbWVyYURldmljZS0+Z2V0UGFyYW1ldGVycygpKTsKKyAgICAgICAgICAgIFN0cmluZzggZm9jdXNNb2RlcyhwYXJhbXMuZ2V0KENhbWVyYVBhcmFtZXRlcnM6OktFWV9TVVBQT1JURURfRk9DVVNfTU9ERVMpKTsKKyAgICAgICAgICAgIGJvb2wgaXNBRlN1cHBvcnRlZCA9IGZhbHNlOworICAgICAgICAgICAgY29uc3QgY2hhciAqZm9jdXNNb2RlID0gbnVsbHB0cjsKKworICAgICAgICAgICAgaWYgKGZvY3VzTW9kZXMuY29udGFpbnMoQ2FtZXJhUGFyYW1ldGVyczo6Rk9DVVNfTU9ERV9BVVRPKSkgeworICAgICAgICAgICAgICAgIGlzQUZTdXBwb3J0ZWQgPSB0cnVlOworICAgICAgICAgICAgfSBlbHNlIGlmIChmb2N1c01vZGVzLmNvbnRhaW5zKENhbWVyYVBhcmFtZXRlcnM6OkZPQ1VTX01PREVfQ09OVElOVU9VU19QSUNUVVJFKSkgeworICAgICAgICAgICAgICAgIGlzQUZTdXBwb3J0ZWQgPSB0cnVlOworICAgICAgICAgICAgICAgIGZvY3VzTW9kZSA9IENhbWVyYVBhcmFtZXRlcnM6OkZPQ1VTX01PREVfQ09OVElOVU9VU19QSUNUVVJFOworICAgICAgICAgICAgfSBlbHNlIGlmIChmb2N1c01vZGVzLmNvbnRhaW5zKENhbWVyYVBhcmFtZXRlcnM6OkZPQ1VTX01PREVfQ09OVElOVU9VU19WSURFTykpIHsKKyAgICAgICAgICAgICAgICBpc0FGU3VwcG9ydGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBmb2N1c01vZGUgPSBDYW1lcmFQYXJhbWV0ZXJzOjpGT0NVU19NT0RFX0NPTlRJTlVPVVNfVklERU87CisgICAgICAgICAgICB9IGVsc2UgaWYgKGZvY3VzTW9kZXMuY29udGFpbnMoQ2FtZXJhUGFyYW1ldGVyczo6Rk9DVVNfTU9ERV9NQUNSTykpIHsKKyAgICAgICAgICAgICAgICBpc0FGU3VwcG9ydGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBmb2N1c01vZGUgPSBDYW1lcmFQYXJhbWV0ZXJzOjpGT0NVU19NT0RFX01BQ1JPOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG51bGxwdHIgIT0gZm9jdXNNb2RlKSB7CisgICAgICAgICAgICAgICAgcGFyYW1zLnNldChDYW1lcmFQYXJhbWV0ZXJzOjpLRVlfRk9DVVNfTU9ERSwgZm9jdXNNb2RlKTsKKyAgICAgICAgICAgICAgICBjYW1lcmFEZXZpY2UtPnNldFBhcmFtZXRlcnMocGFyYW1zLmZsYXR0ZW4oKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpbnQgcHJldmlld1dpZHRoLCBwcmV2aWV3SGVpZ2h0OworICAgICAgICAgICAgcGFyYW1zLmdldFByZXZpZXdTaXplKCZwcmV2aWV3V2lkdGgsICZwcmV2aWV3SGVpZ2h0KTsKKworICAgICAgICAgICAgbUNvbXBvc2VyQ2xpZW50ID0gbmV3IFN1cmZhY2VDb21wb3NlckNsaWVudDsKKyAgICAgICAgICAgIG1Db21wb3NlckNsaWVudC0+aW5pdENoZWNrKCk7CisKKyAgICAgICAgICAgIGJvb2wgc2hvdWxkUGFzc0ludmFsaWRMYXllck1ldGFEYXRhID0gbUZ1enplZERhdGFQcm92aWRlci0+Q29uc3VtZUJvb2woKTsKKyAgICAgICAgICAgIGludCBsYXllck1ldGFEYXRhOworICAgICAgICAgICAgaWYgKHNob3VsZFBhc3NJbnZhbGlkTGF5ZXJNZXRhRGF0YSkgeworICAgICAgICAgICAgICAgIGxheWVyTWV0YURhdGEgPSBtRnV6emVkRGF0YVByb3ZpZGVyLT5Db25zdW1lSW50ZWdyYWw8aW50PigpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBsYXllck1ldGFEYXRhID0ga0xheWVyTWV0YWRhdGFbbUZ1enplZERhdGFQcm92aWRlci0+Q29uc3VtZUludGVncmFsSW5SYW5nZTxzaXplX3Q+KAorICAgICAgICAgICAgICAgICAgICAwLCBrTnVtTGF5ZXJNZXRhRGF0YSAtIDEpXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHN1cmZhY2VDb250cm9sID0gbUNvbXBvc2VyQ2xpZW50LT5jcmVhdGVTdXJmYWNlKAorICAgICAgICAgICAgICAgIFN0cmluZzgoIlRlc3QgU3VyZmFjZSIpLCBwcmV2aWV3V2lkdGgsIHByZXZpZXdIZWlnaHQsCisgICAgICAgICAgICAgICAgQ2FtZXJhUGFyYW1ldGVyczo6cHJldmlld0Zvcm1hdFRvRW51bShwYXJhbXMuZ2V0UHJldmlld0Zvcm1hdCgpKSwgbGF5ZXJNZXRhRGF0YSk7CisKKyAgICAgICAgICAgIGlmIChzdXJmYWNlQ29udHJvbC5nZXQoKSAhPSBudWxscHRyKSB7CisgICAgICAgICAgICAgICAgU3VyZmFjZUNvbXBvc2VyQ2xpZW50OjpUcmFuc2FjdGlvbnt9CisgICAgICAgICAgICAgICAgICAgIC5zZXRMYXllcihzdXJmYWNlQ29udHJvbCwgMHg3ZmZmZmZmZikKKyAgICAgICAgICAgICAgICAgICAgLnNob3coc3VyZmFjZUNvbnRyb2wpCisgICAgICAgICAgICAgICAgICAgIC5hcHBseSgpOworCisgICAgICAgICAgICAgICAgcHJldmlld1N1cmZhY2UgPSBzdXJmYWNlQ29udHJvbC0+Z2V0U3VyZmFjZSgpOworICAgICAgICAgICAgICAgIGNhbWVyYURldmljZS0+c2V0UHJldmlld1RhcmdldChwcmV2aWV3U3VyZmFjZS0+Z2V0SUdyYXBoaWNCdWZmZXJQcm9kdWNlcigpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhbWVyYURldmljZS0+c2V0UHJldmlld0NhbGxiYWNrRmxhZyhDQU1FUkFfRlJBTUVfQ0FMTEJBQ0tfRkxBR19DQU1DT1JERVIpOworCisgICAgICAgICAgICBWZWN0b3I8U2l6ZT4gcGljdHVyZVNpemVzOworICAgICAgICAgICAgcGFyYW1zLmdldFN1cHBvcnRlZFBpY3R1cmVTaXplcyhwaWN0dXJlU2l6ZXMpOworCisgICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHBpY3R1cmVTaXplcy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgICAgIHBhcmFtcy5zZXRQaWN0dXJlU2l6ZShwaWN0dXJlU2l6ZXNbaV0ud2lkdGgsIHBpY3R1cmVTaXplc1tpXS5oZWlnaHQpOworICAgICAgICAgICAgICAgIGNhbWVyYURldmljZS0+c2V0UGFyYW1ldGVycyhwYXJhbXMuZmxhdHRlbigpKTsKKyAgICAgICAgICAgICAgICBjYW1lcmFEZXZpY2UtPnN0YXJ0UHJldmlldygpOworICAgICAgICAgICAgICAgIHdhaXRGb3JQcmV2aWV3U3RhcnQoKTsKKyAgICAgICAgICAgICAgICBjYW1lcmFEZXZpY2UtPmF1dG9Gb2N1cygpOworICAgICAgICAgICAgICAgIHdhaXRGb3JFdmVudChtQXV0b0ZvY3VzTG9jaywgbUF1dG9Gb2N1c0NvbmRpdGlvbiwgbUF1dG9Gb2N1c01lc3NhZ2UpOworICAgICAgICAgICAgICAgIGJvb2wgc2hvdWxkUGFzc0ludmFsaWRDYW1lcmFNc2cgPSBtRnV6emVkRGF0YVByb3ZpZGVyLT5Db25zdW1lQm9vbCgpOworICAgICAgICAgICAgICAgIGludCBtc2dUeXBlOworICAgICAgICAgICAgICAgIGlmIChzaG91bGRQYXNzSW52YWxpZENhbWVyYU1zZykgeworICAgICAgICAgICAgICAgICAgICBtc2dUeXBlID0gbUZ1enplZERhdGFQcm92aWRlci0+Q29uc3VtZUludGVncmFsPGludD4oKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtc2dUeXBlID0ga0NhbWVyYU1zZ1ttRnV6emVkRGF0YVByb3ZpZGVyLT5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHNpemVfdD4oCisgICAgICAgICAgICAgICAgICAgICAgICAwLCBrTnVtQ2FtZXJhTXNnIC0gMSldOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYW1lcmFEZXZpY2UtPnRha2VQaWN0dXJlKG1zZ1R5cGUpOworCisgICAgICAgICAgICAgICAgd2FpdEZvckV2ZW50KG1TbmFwc2hvdExvY2ssIG1TbmFwc2hvdENvbmRpdGlvbiwgbVNuYXBzaG90Tm90aWZpY2F0aW9uKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgVmVjdG9yPFNpemU+IHZpZGVvU2l6ZXM7CisgICAgICAgICAgICBwYXJhbXMuZ2V0U3VwcG9ydGVkVmlkZW9TaXplcyh2aWRlb1NpemVzKTsKKworICAgICAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCB2aWRlb1NpemVzLnNpemUoKTsgKytpKSB7CisgICAgICAgICAgICAgICAgcGFyYW1zLnNldFZpZGVvU2l6ZSh2aWRlb1NpemVzW2ldLndpZHRoLCB2aWRlb1NpemVzW2ldLmhlaWdodCk7CisKKyAgICAgICAgICAgICAgICBjYW1lcmFEZXZpY2UtPnNldFBhcmFtZXRlcnMocGFyYW1zLmZsYXR0ZW4oKSk7CisgICAgICAgICAgICAgICAgY2FtZXJhRGV2aWNlLT5zdGFydFByZXZpZXcoKTsKKyAgICAgICAgICAgICAgICB3YWl0Rm9yUHJldmlld1N0YXJ0KCk7CisgICAgICAgICAgICAgICAgY2FtZXJhRGV2aWNlLT5zZXRWaWRlb0J1ZmZlck1vZGUoCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6OmhhcmR3YXJlOjpCbkNhbWVyYTo6VklERU9fQlVGRkVSX01PREVfQlVGRkVSX1FVRVVFKTsKKyAgICAgICAgICAgICAgICBjYW1lcmFEZXZpY2UtPnNldFZpZGVvVGFyZ2V0KHByZXZpZXdTdXJmYWNlLT5nZXRJR3JhcGhpY0J1ZmZlclByb2R1Y2VyKCkpOworICAgICAgICAgICAgICAgIGNhbWVyYURldmljZS0+c3RhcnRSZWNvcmRpbmcoKTsKKyAgICAgICAgICAgICAgICBjYW1lcmFEZXZpY2UtPnN0b3BSZWNvcmRpbmcoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhbWVyYURldmljZS0+c3RvcFByZXZpZXcoKTsKKyAgICAgICAgICAgIGNhbWVyYURldmljZS0+ZGlzY29ubmVjdCgpOworICAgICAgICB9CisgICAgfQorfQorCit2b2lkIENhbWVyYUZ1enplcjo6cHJvY2VzcygpIHsKKyAgICBnZXROdW1DYW1lcmFzKCk7CisgICAgaW52b2tlQ2FtZXJhU291bmQoKTsKKyAgICBpZiAobU51bUNhbWVyYXMgPiAwKSB7CisgICAgICAgIGludm9rZUNhbWVyYUFQSXMoKTsKKyAgICB9CisgICAgaW52b2tlRHVtcCgpOworICAgIGludm9rZVNoZWxsQ29tbWFuZCgpOworICAgIGludm9rZU5vdGlmeUNhbGxzKCk7Cit9CisKK2NsYXNzIFRlc3RDYW1lcmFTZXJ2aWNlTGlzdGVuZXIgOiBwdWJsaWMgaGFyZHdhcmU6OkJuQ2FtZXJhU2VydmljZUxpc3RlbmVyIHsKK3B1YmxpYzoKKyAgICB2aXJ0dWFsIH5UZ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VU5DVElPTl9fLCBpZC5jX3N0cigpKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgIH0KKworICAgIEFMT0dWKCIlczogaWQgJXMiLCBfX0ZVTkNUSU9OX18sIGlkLmNfc3RyKCkpOworICAgIHNlc3Npb25TdGF0cy0+b25BY3RpdmUoKTsKK30KKwordm9pZCBDYW1lcmFTZXJ2aWNlUHJveHlXcmFwcGVyOjpsb2dJZGxlKGNvbnN0IFN0cmluZzgmIGlkLAorICAgICAgICBpbnQ2NF90IHJlcXVlc3RDb3VudCwgaW50NjRfdCByZXN1bHRFcnJvckNvdW50LCBib29sIGRldmljZUVycm9yLAorICAgICAgICBjb25zdCBzdGQ6OnZlY3RvcjxoYXJkd2FyZTo6Q2FtZXJhU3RyZWFtU3RhdHM+JiBzdHJlYW1TdGF0cykgeworICAgIHN0ZDo6c2hhcmVkX3B0cjxDYW1lcmFTZXNzaW9uU3RhdHNXcmFwcGVyPiBzZXNzaW9uU3RhdHM7CisgICAgeworICAgICAgICBNdXRleDo6QXV0b2xvY2sgbChtTG9jayk7CisgICAgICAgIHNlc3Npb25TdGF0cyA9IG1TZXNzaW9uU3RhdHNNYXBbaWRdOworICAgIH0KKworICAgIGlmIChzZXNzaW9uU3RhdHMgPT0gbnVsbHB0cikgeworICAgICAgICBBTE9HRSgiJXM6IFNlc3Npb25TdGF0c01hcCBzaG91bGQgY29udGFpbiBjYW1lcmEgJXMgd2hlbiBsb2dJZGxlIGlzIGNhbGxlZCIsCisgICAgICAgICAgICAgICAgX19GVU5DVElPTl9fLCBpZC5jX3N0cigpKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIEFMT0dWKCIlczogaWQgJXMsIHJlcXVlc3RDb3VudCAlIiBQUklkNjQgIiwgcmVzdWx0RXJyb3JDb3VudCAlIiBQUklkNjQgIiwgZGV2aWNlRXJyb3IgJWQiLAorICAgICAgICAgICAgX19GVU5DVElPTl9fLCBpZC5jX3N0cigpLCByZXF1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dGl2ZUFwaUxldmVsLCBpc05kaywgbGF0ZW5jeU1zKTsKKyAgICBzZXNzaW9uU3RhdHMtPm9uT3BlbigpOworfQorCit2b2lkIENhbWVyYVNlcnZpY2VQcm94eVdyYXBwZXI6OmxvZ0Nsb3NlKGNvbnN0IFN0cmluZzgmIGlkLCBpbnQzMl90IGxhdGVuY3lNcykgeworICAgIHN0ZDo6c2hhcmVkX3B0cjxDYW1lcmFTZXNzaW9uU3RhdHNXcmFwcGVyPiBzZXNzaW9uU3RhdHM7CisgICAgeworICAgICAgICBNdXRleDo6QXV0b2xvY2sgbChtTG9jayk7CisgICAgICAgIGlmIChtU2Vzc2lvblN0YXRzTWFwLmNvdW50KGlkKSA9PSAwKSB7CisgICAgICAgICAgICBBTE9HRSgiJXM6IFNlc3Npb25TdGF0c01hcCBzaG91bGQgY29udGFpbiBjYW1lcmEgJXMgYmVmb3JlIGl0J3MgY2xvc2VkIiwKKyAgICAgICAgICAgICAgICAgICAgX19GVU5DVElPTl9fLCBpZC5jX3N0cigpKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIHNlc3Npb25TdGF0cyA9IG1TZXNzaW9uU3RhdHNNYXBbaWRdOworICAgICAgICBpZiAoc2Vzc2lvblN0YXRzID09IG51bGxwdHIpIHsKKyAgICAgICAgICAgIEFMT0dFKCIlczogU2Vzc2lvblN0YXRzTWFwIHNob3VsZCBjb250YWluIGNhbWVyYSAlcyIsCisgICAgICAgICAgICAgICAgICAgIF9fRlVOQ1RJT05fXywgaWQuY19zdHIoKSk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgbVNlc3Npb25TdGF0c01hcC5lcmFzZShpZCk7CisgICAgICAgIEFMT0dWKCIlczogRXJhc2luZyBpZCAlcyIsIF9fRlVOQ1RJT05fXywgaWQuY19zdHIoKSk7CisgICAgfQorCisgICAgQUxPR1YoIiVzOiBpZCAlcywgbGF0ZW5jeU1zICVkIiwgX19GVU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SEVJQ19BVkFJTEFCTEVfSEVJQ19NSU5fRlJBTUVfRFVSQVRJT05TX01BWElNVU1fUkVTT0xVVElPTjsKKyAgICAgICAgY2FzZSBBTkRST0lEX0hFSUNfQVZBSUxBQkxFX0hFSUNfU1RBTExfRFVSQVRJT05TOgorICAgICAgICAgICAgcmV0dXJuIEFORFJPSURfSEVJQ19BVkFJTEFCTEVfSEVJQ19TVEFMTF9EVVJBVElPTlNfTUFYSU1VTV9SRVNPTFVUSU9OOworICAgICAgICBjYXNlIEFORFJPSURfU0VOU09SX09QQVFVRV9SQVdfU0laRToKKyAgICAgICAgICAgIHJldHVybiBBTkRST0lEX1NFTlNPUl9PUEFRVUVfUkFXX1NJWkVfTUFYSU1VTV9SRVNPTFVUSU9OOworICAgICAgICBjYXNlIEFORFJPSURfTEVOU19JTlRSSU5TSUNfQ0FMSUJSQVRJT046CisgICAgICAgICAgICByZXR1cm4gQU5EUk9JRF9MRU5TX0lOVFJJTlNJQ19DQUxJQlJBVElPTl9NQVhJTVVNX1JFU09MVVRJT047CisgICAgICAgIGNhc2UgQU5EUk9JRF9MRU5TX0RJU1RPUlRJT046CisgICAgICAgICAgICByZXR1cm4gQU5EUk9JRF9MRU5TX0RJU1RPUlRJT05fTUFYSU1VTV9SRVNPTFVUSU9OOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgQUxPR0UoIiVzOiBUYWcgJWQgZG9lc24ndCBoYXZlIGEgbWF4aW11bSByZXNvbHV0aW9uIGNvdW50ZXJwYXJ0IiwgX19GVU5DVElPTl9fLAorICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VGFnKTsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgcmV0dXJuIC0xOworfQorCitib29sIFNlc3Npb25Db25maWd1cmF0aW9uVXRpbHM6OmdldEFycmF5V2lkdGhBbmRIZWlnaHQoY29uc3QgQ2FtZXJhTWV0YWRhdGEgKmRldmljZUluZm8sCisgICAgICAgIGludDMyX3QgYX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oID0gc3RyZWFtQ29uZmlncy5kYXRhLmkzMltpICsgMl07CisKKyAgICAgICAgLy8gSWdub3JlIGlucHV0L291dHB1dCB0eXBlIGZvciBub3cKKyAgICAgICAgaWYgKGZtdCA9PSBmb3JtYXQpIHsKKyAgICAgICAgICAgIGlmICh3ID09IHdpZHRoICYmIGggPT0gaGVpZ2h0KSB7CisgICAgICAgICAgICAgICAgYmVzdFdpZHRoID0gd2lkdGg7CisgICAgICAgICAgICAgICAgYmVzdEhlaWdodCA9IGhlaWdodDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAodyA8PSBST1VORElOR19XSURUSF9DQVAgJiYgKGJlc3RXaWR0aCA9PSAtMSB8fAorICAgICAgICAgICAgICAgICAgICBTZXNzaW9uQ29uZmlndXJhdGlvblV0aWxzOjpldWNsaWREaXN0U3F1YXJlKHcsIGgsIHdpZHRoLCBoZWlnaHQpIDwKKyAgICAgICAgICAgICAgICAgICAgU2Vzc2lvbkNvbmZpZ3VyYXRpb25VdGlsczo6ZXVjbGlkRGlzdFNxdWFyZShiZXN0V2lkdGgsIGJlc3RIZWlnaHQsIHdpZHRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodCkpKSB7CisgICAgICAgICAgICAgICAgYmVzdFdpZHRoID0gdzsKKyAgICAgICAgICAgICAgICBiZXN0SGVpZ2h0ID0gaDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIGlmIChiZXN0V2lkdGggPT0gLTEpIHsKKyAgICAgICAgLy8gUmV0dXJuIGZhbHNlIGlmIG5vIGNvbmZpZ3VyYXRpb25zIGZvciB0aGlzIGZvcm1hdCB3ZXJlIGxpc3RlZAorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLy8gU2V0IHRoZSBvdXRwdXRzIHRvIHRoZSBjbG9zZXQgd2lkdGgvaGVpZ2h0CisgICAgaWYgKG91dFdpZHRoICE9IE5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E1ldGFkYXRhKHBoeXNpY2FsQ2FtZXJhSWQsCisgICAgICAgICAgICAgICAgb3ZlcnJpZGVGb3JQZXJmQ2xhc3MpOworICAgICAgICBjb25zdCBDYW1lcmFNZXRhZGF0YSAmbWV0YWRhdGFDaG9zZW4gPQorICAgICAgICAgICAgICAgIHBoeXNpY2FsQ2FtZXJhSWQuc2l6ZSgpID4gMCA/IHBoeXNpY2FsRGV2aWNlSW5mbyA6IGRldmljZUluZm87CisKKyAgICAgICAgc2l6ZV90IG51bUJ1ZmZlclByb2R1Y2VycyA9IGJ1ZmZlclByb2R1Y2Vycy5zaXplKCk7CisgICAgICAgIGJvb2wgaXNTdHJlYW1JbmZvVmFsaWQgPSBmYWxzZTsKKyAgICAgICAgaW50MzJfdCBncm91cElkID0gaXQuaXNNdWx0aVJlc29sdXRpb24oKSA/IGl0LmdldFN1cmZhY2VTZXRJRCgpIDogLTE7CisgICAgICAgIE91dHB1dFN0cmVhbUluZm8gc3RyZWFtSW5mbzsKKworICAgICAgICByZXMgPSBjaGVja1N1cmZhY2VUeXBlKG51bUJ1ZmZlclByb2R1Y2VycywgZGVmZXJyZWRDb25zdW1lciwgaXQuZ2V0U3VyZmFjZVR5cGUoKSk7CisgICAgICAgIGlmICghcmVzLmlzT2soKSkgeworICAgICAgICAgICAgcmV0dXJuIHJlczsKKyAgICAgICAgfQorICAgICAgICByZXMgPSBjaGVja1BoeXNpY2FsQ2FtZXJhSWQocGh5c2ljYWxDYW1lcmFJZHMsIHBoeXNpY2FsQ2FtZXJhSWQsCisgICAgICAgICAgICAgICAgbG9naWNhbENhbWVyYUlkKTsKKyAgICAgICAgaWYgKCFyZXMuaXNPaygpKSB7CisgICAgICAgICAgICByZXR1cm4gcmVzOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGRlZmVycmVkQ29uc3VtZXIpIHsKKyAgICAgICAgICAgIHN0cmVhbUluZm8ud2lkdGggPSBpdC5nZXRXaWR0aCgpOworICAgICAgICAgICAgc3RyZWFtS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ZXMgbm90IHZhbGlkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19GVU5DVElPTl9fKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTVEFUVVNfRVJST1IoQ2FtZXJhU2VydmljZTo6RVJST1JfSUxMRUdBTF9BUkdVTUVOVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkRlZmVycmVkIHN1cmZhY2Ugc2Vuc29yIHBpeGVsIG1vZGVzIG5vdCB2YWxpZCIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbWFwU3RyZWFtSW5mbyhzdHJlYW1JbmZvLCBjYW1lcmEzOjpDQU1FUkFfU1RSRUFNX1JPVEFUSU9OXzAsIHBoeXNpY2FsQ2FtZXJhSWQsIGdyb3VwSWQsCisgICAgICAgICAgICAgICAgICAgICZzdHJlYW1Db25maWd1cmF0aW9uLnN0cmVhbXNbc3RyZWFtSWR4KytdKTsKKyAgICAgICAgICAgIGlzU3RyZWFtSW5mb1ZhbGlkID0gdHJ1ZTsKKworICAgICAgICAgICAgaWYgKG51bUJ1ZmZlclByb2R1Y2VycyA9PSAwKSB7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBmb3IgKGF1dG8mIGJ1ZmZlclByb2R1Y2VyIDogYnVmZmVyUHJvZHVjZXJzKSB7CisgICAgICAgICAgICBzcDxTdXJmYWNlPiBzdXJmYWNlOworICAgICAgICAgICAgcmVzID0gY3JlYXRlU3VyZmFjZUZyb21HYnAoc3RyZWFtSW5mbywgaXNTdHJlYW1JbmZvVmFsaWQsIHN1cmZhY2UsIGJ1ZmZlclByb2R1Y2VyLAorICAgICAgICAgICAgICAgICAgICBsb2dpY2FsQ2FtZXJhSWQsIG1ldGFkYXRhQ2hvc2VuLCBzZW5zb3JQaXhlbE1vZGVzVXNlZCk7CisKKyAgICAgICAgICAgIGlmICghcmVzLmlzT2soKSkKKyAgICAgICAgICAgICAgICByZXR1cm4gcmVzOworCisgICAgICAgICAgICBpZiAoIWlzU3RyZWFtSW5mb1ZhbGlkKSB7CisgICAgICAgICAgICAgICAgYm9vbCBpc0RlcHRoQ29tcG9zaXRlU3RyZWFtID0KKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbWVyYTM6OkRlcHRoQ29tcG9zaXRlU3RyZWFtOjppc0RlcHRoQ29tcG9zaXRlU3RyZWFtKHN1cmZhY2UpOworICAgICAgICAgICAgICAgIGJvb2wgaXNIZWljQ29tcG9zaXRlU3RyZWFtID0KKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbWVyYTM6OkhlaWNDb21wb3NpdGVTdHJlYW06OmlzSGVpY0NvbXBvc2l0ZVN0cmVhbShzdXJmYWNlKTsKKyAgICAgICAgICAgICAgICBpZiAoaXNEZXB0aENvbXBvc2l0ZVN0cmVhbSB8fCBpc0hlaWNDb21wb3NpdGVTdHJlYW0pIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gV2UgbmVlZCB0byB0YWtlIGluIHRvIGFjY291bnQgdGhhdCBjb21wb3NpdGUgc3RyZWFtcyBjYW4gaGF2ZQorICAgICAgICAgICAgICAgICAgICAvLyBhZGRpdGlvbmFsIGludGVybmFsIGNhbWVyYSBzdHJlYW1zLgorICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxPdXRwdXRTdHJlYW1JbmZvPiBjb21wb3NpdGVTdHJlYW1zOworICAgICAgICAgICAgICAgICAgICBpZiAoaXNEZXB0aENvbXBvc2l0ZVN0cmVhbSkgeworICAgICAgICAgICAgICAgICAgICAgIC8vIFRPRE86IFRha2UgY2FyZSBvZiBjb21wb3NpdGUgc3RyZWFtcy4KKyAgICAgICAgICAgICAgICAgICAgICAgIHJldCA9IGNhbWVyYTM6OkRlcHRoQ29tcG9zaXRlU3RyZWFtOjpnZXRDb21wb3NpdGVTdHJlYW1JbmZvKHN0cmVhbUluZm8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmljZUluZm8sICZjb21wb3NpdGVTdHJlYW1zKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldCA9IGNhbWVyYTM6OkhlaWNDb21wb3NpdGVTdHJlYW06OmdldENvbXBvc2l0ZVN0cmVhbUluZm8oc3RyZWFtSW5mbywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2VJbmZvLCAmY29tcG9zaXRlU3RyZWFtcyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKHJldCAhPSBPSykgeworICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nOCBtc2cgPSBTdHJpbmc4Ojpmb3JtYXQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJDYW1lcmEgJXM6IEZhaWxlZCBhZGRpbmcgY29tcG9zaXRlIHN0cmVhbXM6ICVzICglZCkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dpY2FsQ2FtZXJhSWQuc3RyaW5nKCksIHN0cmVycm9yKC1yZXQpLCByZXQpOworICAgICAgICAgICAgICAgICAgICAgICAgQUxPR0UoIiVzOiAlcyIsIF9fRlVOQ1RJT05fXywgbXNnLnN0cmluZygpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTVEFUVVNfRVJST1IoQ2FtZXJhU2VydmljZTo6RVJST1JfSUxMRUdBTF9BUkdVTUVOVCwgbXNnLnN0cmluZygpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGlmIChjb21wb3NpdGVTdHJlYW1zLnNpemUoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBObyBpbnRlcm5hbCBzdHJlYW1zIG1lYW5zIGNvbXBvc2l0ZSBzdHJlYW0gbm90CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBzdXBwb3J0ZWQuCisgICAgICAgICAgICAgICAgICAgICAgICAqZWFybHlFeGl0ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiaW5kZXI6OlN0YXR1czo6b2soKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjb21wb3NpdGVTdHJlYW1zLnNpemUoKSA+IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmVhbUNvdW50ICs9IGNvbXBvc2l0ZVN0cmVhbXMuc2l6ZSgpIC0gMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmVhbUNvbmZpZ3VyYXRpb24uc3RyZWFtcy5yZXNpemUoc3RyZWFtQ291bnQpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBhdXRvJiBjb21wb3NpdGVTdHJlYW0gOiBjb21wb3NpdGVTdHJlYW1zKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYXBTdHJlYW1JbmZvKGNvbXBvc2l0ZVN0cmVhbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8Y2FtZXJhX3N0cmVhbV9yb3RhdGlvbl90PiAoaXQuZ2V0Um90YXRpb24oKSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBoeXNpY2FsQ2FtZXJhSWQsIGdyb3VwSWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzdHJlYW1Db25maWd1cmF0aW9uLnN0cmVhbXNbc3RyZWFtSWR4KytdKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1hcFN0cmVhbUluZm8oc3RyZWFtSW5mbywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxjYW1lcmFfc3RyZWFtX3JvdGF0aW9uX3Q+IChpdC5nZXRSb3RhdGlvbigpKSwKKyAgICA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YXRzKCkgOiBtUmVxdWVzdGVkRnJhbWVDb3VudCgwKSwKKyAgICAgICAgICAgICAgICAgICAgIG1Ecm9wcGVkRnJhbWVDb3VudCgwKSwKKyAgICAgICAgICAgICAgICAgICAgIG1Db3VudGVyU3RvcHBlZChmYWxzZSksCisgICAgICAgICAgICAgICAgICAgICBtU3RhcnRMYXRlbmN5TXMoMCksCisgICAgICAgICAgICAgICAgICAgICBtQ2FwdHVyZUxhdGVuY3lIaXN0b2dyYW17fQorICAgICAgICAgICAgICAgICAge30KKworICAgIHZvaWQgdXBkYXRlTGF0ZW5jeUhpc3RvZ3JhbShpbnQzMl90IGxhdGVuY3lNcyk7Cit9OworCisvLyBIZWxwZXIgY2xhc3MgdG8gYnVpbGQgc2Vzc2lvbiBzdGF0cworY2xhc3MgU2Vzc2lvblN0YXRzQnVpbGRlciB7CitwdWJsaWM6CisKKyAgICBzdGF0dXNfdCBhZGRTdHJlYW0oaW50IHN0cmVhbUlkKTsKKyAgICBzdGF0dXNfdCByZW1vdmVTdHJlYW0oaW50IHN0cmVhbUlkKTsKKworICAgIC8vIFJldHVybiB0aGUgc2Vzc2lvbiBzdGF0aXN0aWNzIGFuZCByZXNldCB0aGUgaW50ZXJuYWwgc3RhdGVzLgorICAgIHZvaWQgYnVpbGRBbmRSZXNldCgvKm91dCovaW50NjRfdCogcmVxdWVzdENvdW50LAorICAgICAgICAgICAgLypvdXQqL2ludDY0X3QqIGVycm9yUmVzdWx0Q291bnQsCisgICAgICAgICAgICAvKm91dCovYm9vbCogZGV2aWNlRXJyb3IsCisgICAgICAgICAgICAvKm91dCovc3RkOjptYXA8aW50LCBTdHJlYW1TdGF0cz4gKnN0YXRzTWFwKTsKKworICAgIC8vIFN0cmVhbSBzcGVjaWZpYyBjb3VudGVyCisgICAgdm9pZCBzdGFydENvdW50ZXIoaW50IHN0cmVhbUlkKTsKKyAgICB2b2lkIHN0b3BDb3VudGVyKGludCBzdHJlYW1JZCk7CisgICAgdm9pZCBpbmNDb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QCAtMzUsMjAgKzU0LDYgQEAKICAgICAgICAgImxpYmxvZyIsCiAgICAgICAgICJsaWJhdnNlcnZpY2VzX21pbmlqYWlsIiwKICAgICBdLAotICAgIGhlYWRlcl9saWJzOiBbCi0gICAgICAgICJiaW9uaWNfbGliY19wbGF0Zm9ybV9oZWFkZXJzIiwKLSAgICBdLAotICAgIHRhcmdldDogewotICAgICAgICBhbmRyb2lkOiB7Ci0gICAgICAgICAgICBwcm9kdWN0X3ZhcmlhYmxlczogewotICAgICAgICAgICAgICAgIG1hbGxvY19ub3Rfc3ZlbHRlOiB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIFNjdWRvIGluY3JlYXNlcyBtZW1vcnkgZm9vdHByaW50LCBzbyBvbmx5IGVuYWJsZSBvbgotICAgICAgICAgICAgICAgICAgICAvLyBub24tc3ZlbHRlIGRldmljZXMuCi0gICAgICAgICAgICAgICAgICAgIHNoYXJlZF9saWJzOiBbImxpYmNfc2N1ZG8iXSwKLSAgICAgICAgICAgICAgICB9LAotICAgICAgICAgICAgfSwKLSAgICAgICAgfSwKLSAgICB9LAogICAgIGluaXRfcmM6IFsibWVkaWFleHRyYWN0b3IucmMiXSwKIAogICAgIGNmbGFnczogWwpAQCAtODEsNCArODYsMyBAQAogICAgICAgICAiY29kZV9jb3ZlcmFnZS5wb2xpY3kiLAogICAgIF0sCiB9Ci0KZGlmZiAtLWdpdCBhL3NlcnZpY2VzL21lZGlhZXh0cmFjdG9yL01lZGlhRXh0cmFjdG9yU2VydmljZS5jcHAgYi9zZXJ2aWNlcy9tZWRpYWV4dHJhY3Rvci9NZWRpYUV4dHJhY3RvclNlcnZpY2UuY3BwCmluZGV4IDk5OTJkMWMuLjcxYTViZmYgMTAwNjQ0Ci0tLSBhL3NlcnZpY2VzL21lZGlhZXh0cmFjdG9yL01lZGlhRXh0cmFjdG9yU2VydmljZS5jcHAKKysrIGIvc2VydmljZXMvbWVkaWFleHRyYWN0b3IvTWVkaWFFeHRyYWN0b3JTZX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JtZWRpYXV0aWxzIiwKICAgICAgICAgImxpYnV0aWxzIiwKKyAgICAgICAgIm1lZGlhbWV0cmljc3NlcnZpY2UtYWlkbC1jcHAiLAogICAgIF0sCiAgICAgaGVhZGVyX2xpYnM6IFsKICAgICAgICAgImxpYmF1ZGlvdXRpbHNfaGVhZGVycyIsCkBAIC0xMTEsNyArMTI1LDcgQEAKICAgICBdLAogfQogCi1jY19saWJyYXJ5X3NoYXJlZCB7CitjY19saWJyYXJ5IHsKICAgICBuYW1lOiAibGlibWVkaWFtZXRyaWNzc2VydmljZSIsCiAgICAgZGVmYXVsdHM6IFsKICAgICAgICAgIm1lZGlhbWV0cmljc19mbGFnc19kZWZhdWx0cyIsCkBAIC0xNDIsNiArMTU2LDcgQEAKICAgICB9LAogCiAgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgIm1lZGlhbWV0cmljc3NlcnZpY2UtYWlkbC1jcHAiLAogICAgICAgICAibGliYmFzZSIsIC8vIGFuZHJvaWQgbG9nZ2luZwogICAgICAgICAibGliYmluZGVyIiwKICAgICAgICAgImxpYmN1dGlscyIsCkBAIC0xNTEsMTAgKzE2NiwxOCBAQAogICAgICAgICAibGlibWVkaWF1dGlscyIsCiAgICAgICAgICJsaWJtZW11bnJlYWNoYWJsZSIsCiAgICAgICAgICJsaWJwcm90b2J1Zi1jcHAtbGl0ZSIsCisgICAgICAgICJsaWJzdGFnZWZyaWdodF9mb3VuZGF0aW9uIiwKICAgICAgICAgImxpYnN0YXRzbG9nIiwKKyAgICAgICAgImxpYnN0YXRzcHVsbCIsCisgICAgICAgICJsaWJzdGF0c3NvY2tldCIsCiAgICAgICAgICJsaWJ1dGlscyIsCiAgICAgXSwKIAorICAgIGV4cG9ydF9zaGFyZWRfbGliX2hlYWRlcnM6IFsKKyAgICAgICAgImxpYnN0YXRzcHVsbCIsCisgICAgICAgICJsaWJzdGF0c3NvY2tldCIsCisgICAgXSwKKwogICAgIHN0YXRpY19saWJzOiBbCiAgICAgICAg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RzLApAQCAtNTIyLDkgKzU5OCwxMSBAQAogICAgICAgICAgICAgICAgICAgICAsIHNlbGVjdGVkRGV2aWNlSWQKICAgICAgICAgICAgICAgICAgICAgLCBFTlVNX0VYVFJBQ1QoY2FsbGVyTmFtZUZvclN0YXRzKQogICAgICAgICAgICAgICAgICAgICAsIEVOVU1fRVhUUkFDVChzb3VyY2VGb3JTdGF0cykKKyAgICAgICAgICAgICAgICAgICAgLCBsb2dTZXNzaW9uSWRGb3JTdGF0cy5jX3N0cigpCiAgICAgICAgICAgICAgICAgICAgICk7CiAgICAgICAgICAgICBBTE9HVigiJXM6IHN0YXRzZCAlcyIsIF9fZnVuY19fLCBzdHIuY19zdHIoKSk7Ci0gICAgICAgICAgICBtQXVkaW9BbmFseXRpY3MubVN0YXRzZExvZy5sb2coIiVzIiwgc3RyLmNfc3RyKCkpOworICAgICAgICAgICAgbUF1ZGlvQW5hbHl0aWNzLm1TdGF0c2RMb2ctPmxvZygKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDo6dXRpbDo6TUVESUFNRVRSSUNTX0FVRElPUkVDT1JEREVWSUNFVVNBR0VfUkVQT1JURUQsIHN0cik7CiAgICAgICAgIH0KICAgICB9IGJyZWFrOwogICAgIGNhc2UgVEhSRUFEOiB7CkBAIC01NzIsNyArNjUwLDggQEAKICAgICAgICAgICAgICAgICAsIEVOVU1fRVhUUkFDVCh0eXBlRm9yU3RhdHMpCiAgICAgICAgICAgICApOwogICAgICAgICAgICAgQUxPR1YoIiVzOiBzdGF0c2QgJXMiLCBfX2Z1bmNfXywgc3RyLmNfc3RyKCkpOwotICAgICAgICAgICAgbUF1ZGlvQW5hbHl0aWNzLm1TdGF0c2RMb2cubG9nKCIlcyIsIHN0ci5jX3N0cigpKTsKKyAgICAgICAgICAgIG1BdWRpb0FuYWx5dGljcy5tU3RhdHNkTG9nLT5sb2coCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6OnV0aWw6Ok1FRElBTUVUUklDU19BV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gICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgIEFMT0dWKCIlczogc3RhdHNkICVzIiwgX19mdW5jX18sIHN0ci5jX3N0cigpKTsKLSAgICAgICAgICAgIG1BdWRpb0FuYWx5dGljcy5tU3RhdHNkTG9nLmxvZygiJXMiLCBzdHIuY19zdHIoKSk7CisgICAgICAgICAgICBtQXVkaW9BbmFseXRpY3MubVN0YXRzZExvZy0+bG9nKAorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOjp1dGlsOjpNRURJQU1FVFJJQ1NfQVVESU9UUkFDS0RFVklDRVVTQUdFX1JFUE9SVEVELCBzdHIpOwogICAgICAgICB9CiAgICAgICAgIH0gYnJlYWs7CiAgICAgfQpAQCAtNzM3LDcgKzgyNSw3IEBACiAgICAgICAgIG1BMmRwQ29ubmVjdGlvblNlcnZpY2VOcyA9IDA7CiAgICAgICAgICsrbUEyZHBDb25uZWN0aW9uU3VjY2Vzc2VzOwogCi0gICAgICAgIGNvbnN0IGF1dG8gY29ubmVjdGlvblRpbWVNcyA9IGZsb2F0KHRpbWVEaWZmTnMgKiAxZS02KTsKKyAgICAgICAgY29uc3QgYXV0byBjb25uZWN0aW9uVGltZU1zID0gZmxvYXQoKGRvdWJsZSl0aW1lRGlmZk5zICogMWUtNik7CiAKICAgICAgICAgY29uc3QgYXV0byBvdXRwdXREZXZpY2VCaXRzID0gdHlwZXM6Omxvb2t1cDx0eXBlczo6T1VUUFVUX0RFVklDRSwgbG9uZ19lbnVtX3R5cGVfdD4oCiAgICAgICAgICAgICAgICAgIkFVRElPX0RFVklDRV9PVVRfQkxVRVRPT1RIX0EyRFAiKTsKQEAgLTc2MCw3ICs4NDgsOCBAQAogICAgICAgICAgICAgICAgICAgICAsIC8qIGNvbm5lY3Rpb25fY291bnQgKi8gMQogICAgICAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgQUxPR1YoIiVzOiBzdGF0c2QgJXMiLCBfX2Z1bmNfXywgc3RyLmNfc3RyKCkpOwotICAgICAgICAgICAgbUF1ZGlvQW5hbHl0aWNzLm1TdGF0c2RMb2cubG9nKCIlcyIsIHN0ci5jX3N0cigpKTsKKyAgICAgICAgICAgIG1BdWRpb0FuYWx5dGljcy5tU3RhdHNkTG9nLT5sb2coCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6OnV0aWw6Ok1FRElBTUVUUklDU19BVURJT0RFVklDRUNPTk5FQ1RJT05fUkVQT1JURUQsIHN0cik7CiAgICAgICAgIH0KICAgICB9CiB9CkBAIC04MTMsNyArOTAyLDggQEAKICAgICAgICAgICAgICAgICAgICAgLCAvKiBjb25uZWN0aW9uX2NvdW50ICovIDEKICAgICAgICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgIEFMT0dWKCIlczogc3RhdHNkICVzIiwgX19mdW5jX18sIHN0ci5jX3N0cigpKTsKLSAgICAgICAgICAgIG1BdWRpb0FuYWx5dGljcy5tU3RhdHNkTG9nLmxvZygiJXMiLCBzdHIuY19zdHIoKSk7CisgICAgICAgICAgICBtQXVkaW9BbmFseXRpY3MubVN0YXRzZExvZy0+bG9nKAorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOjp1dGlsOjpNRURJQU1FVFJJQ1NfQVVESU9ERVZJQ0VDT05ORUNUSU9OX1JFUE9SVEVELCBzdHIpOwogICAgICAgICB9CiAgICAgICAgIHJldHVybjsKICAgICB9CkBAIC04MzksNyArOTI5LDE4NSBAQAogICAgICAgICAgICAgICAgICwgLyogY29ubmVjdGlvbl9jb3VudCAqLyAxCiAgICAgICAgICAgICAgICAgKTsKICAgICAgICAgQUxPR1YoIiVzOiBzdGF0c2QgJXMiLCBfX2Z1bmNfXywgc3RyLmNfc3RyKCkpOwotICAgICAgICBtQXVkaW9BbmFseXRpY3MubVN0YXRzZExvZy5sb2coIiVzIiwgc3RyLmNfc3RyKCkpOworICAgICAgICBtQXVkaW9BbmFseXRpY3MubVN0YXRzZExvZy0+bG9nKAorICAgICAgICAgICAgICAgIGFuZHJvaWQ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gICAgICAgICAgICAgICAgIGNoYW5uZWxDb3VudCA9IGF1ZGlvX2NoYW5uZWxfY291bnRfZnJvbV9vdXRfbWFzayhjaGFubmVsTWFzayk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgMjogLy8gSW5wdXQsIGtlZXAgc3luYyB3aXRoIEF1ZGlvVHlwZXMjZ2V0QUF1ZGlvRGlyZWN0aW9uKCkKKyAgICAgICAgICAgICAgICAgICAgY2hhbm5lbENvdW50ID0gYXVkaW9fY2hhbm5lbF9jb3VudF9mcm9tX2luX21hc2soY2hhbm5lbE1hc2spOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICBBTE9HVygiSW52YWxpZCBkaXJlY3Rpb24gJWQiLCBkaXJlY3Rpb24pOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgaW50NjRfdCB0b3RhbEZyYW1lc1RyYW5zZmVycmVkID0gLTE7CisgICAgbUF1ZGlvQW5hbHl0aWNzLm1BbmFseXRpY3NTdGF0ZS0+dGltZU1hY2hpbmUoKS5nZXQoCisgICAgICAgICAgICBrZXksIEFNRURJQU1FVFJJQ1NfUFJPUF9GUkFNRVNUUkFOU0ZFUlJFRCwgJnRvdGFsRnJhbWVzVHJhbnNmZXJyZWQpOworCisgICAgc3RkOjpzdHJpbmcgcGVyZk1vZGVSZXF1ZXN0ZWRTdHI7CisgICAgbUF1ZGlvQW5hbHl0aWNzLm1BbmFseXRpY3NTdGF0ZS0+dGltZU1hY2hpbmUoKS5nZXQoCisgICAgICAgICAgICBrZXksIEFNRURJQU1FVFJJQ1NfUFJPUF9QRVJGT1JNQU5DRU1PREUsICZwZXJmTW9kZVJlcXVlc3RlZFN0cik7CisgICAgY29uc3QgYXV0byBwZXJmTW9kZVJlcXVlc3RlZCA9CisgICAgICAgICAgICB0eXBlczo6bG9va3VwPHR5cGVzOj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gICAgPDwgIiBzYW1wbGVfcmF0ZTogIiA8PCBzYW1wbGVSYXRlCisgICAgICAgICAgICA8PCAiIGNvbnRlbnRfdHlwZTogIiA8PCBjb250ZW50VHlwZSA8PCAiKCIgPDwgY29udGVudFR5cGVTdHIgPDwgIikiCisgICAgICAgICAgICA8PCAiIHNoYXJpbmdfcmVxdWVzdGVkOiIgPDwgc2hhcmluZ01vZGVSZXF1ZXN0ZWQKKyAgICAgICAgICAgICAgICAgICAgPDwgIigiIDw8IHNoYXJpbmdNb2RlUmVxdWVzdGVkU3RyIDw8ICIpIjsKKworICAgIGlmIChtQXVkaW9BbmFseXRpY3MubURlbGl2ZXJTdGF0aXN0aWNzKSB7CisgICAgICAgIGFuZHJvaWQ6OnV0aWw6OkJ5dGVzRmllbGQgYmZfc2VyaWFsaXplZCgKKyAgICAgICAgICAgIHNlcmlhbGl6ZWREZXZpY2VUeXBlcy5jX3N0cigpLCBzZXJpYWxpemVkRGV2aWNlVHlwZXMuc2l6ZSgpKTsKKyAgICAgICAgY29uc3QgYXV0byByZXN1bHQgPSBzZW5kVG9TdGF0c2QoCisgICAgICAgICAgICAgICAgQ09ORElUSU9OKGFuZHJvaWQ6OnV0aWw6Ok1FRElBTUVUUklDU19BQVVESU9TVFJFQU1fUkVQT1JURUQpCisgICAgICAgICAgICAgICAgLCBwYXRoCisgICAgICAgICAgICAgICAgLCBkaXJlY3Rpb24KKyAgICAgICAgICAgICAgICAsIGZyYW1lc1BlckJ1cnN0CisgICAgICAgICAgICAgICAgLCBidWZmZXJTaXplSW5GcmFtZXMKKyAgICAgICAgICAgICAgICAsIGJ1ZmZlckNhcGFjaXR5SW5GcmFtZXMKKyAgICAgICAgICAgICAgICAsIGNoYW5uZWxDb3VudAorICAgICAgICAgICAgICAgICwgdG90YWxGcmFtZXNUcmFuc2ZlcnJlZAorICAgICAgICAgICAgICAgICwgcGVyZk1vZGVSZXF1ZXN0ZWQKKyAgICAgICAgICAgICAgICAsIHBlcmZNb2RlQWN0dWFsCisgICAgICAgICAgICAgICAgLCBzaGFyaW5nTW9kZUFjdHVhbAorICAgICAgICAgICAgICAgICwgeHJ1bkNvdW50CisgICAgICAgICAgICAgICAgLCBiZl9zZXJpYWxpemVkCisgICAgICAgICAgICAgICAgLCBmb3JtYXRBcHAKKyAgICAgICAgICAgICAgICAsIGZvcm1hdERldmljZQorICAgICAgICAgICAgICAgICwgbG9nU2Vzc2lvbklkLmNfc3RyKCkKKyAgICAgICAgICAgICAgICAsIHNhbXBsZVJhdGUKKyAgICAgICAgICAgICAgICAsIGNvbnRlbnRUeXBlCisgICAgICAgICAgICAgICAgLCBzaGFyaW5nTW9kZVJlcXVlc3RlZAorICAgICAgICAgICAgICAgICk7CisgICAgICAgIHN0ZDo6c3RyaW5nc3RyZWFtIHNzOworICAgICAgICBzcyA8PCAicmVzdWx0OiIgPDwgcmVzdWx0OworICAgICAgICBjb25zdCBhdXRvIGZpZWxkc1N0ciA9IHByaW50RmllbGRzKEFBdWRpb1N0cmVhbUZpZWxkcywKKyAgICAgICAgICAgICAgICBDT05ESVRJT04oYW5kcm9pZDo6dXRpbDo6TUVESUFNRVRSSUNTX0FBVURJT1NUUkVBTV9SRVBPUlRFRCkKKyAgICAgICAgICAgICAgICAsIHBhdGgKKyAgICAgICAgICAgICAgICAsIGRpcmVjdGlvbgorICAgICAgICAgICAgICAgICwgZnJhbWVzUGVyQnVyc3QKKyAgICAgICAgICAgICAgICAsIGJ1ZmZlclNpemVJbkZyYW1lcworICAgICAgICAgICAgICAgICwgYnVmZmVyQ2FwYWNpdHlJbkZyYW1lcworICAgICAgICAgICAgICAgICwgY2hhbm5lbENvdW50CisgICAgICAgICAgICAgICAgLCB0b3RhbEZyYW1lc1RyYW5zZmVycmVkCisgICAgICAgICAgICAgICAgLCBwZXJmTW9kZVJlcXVlc3RlZAorICAgICAgICAgICAgICAgICwgcGVyZk1vZGVBY3R1YWwKKyAgICAgICAgICAgICAgICAsIHNoYXJpbmdNb2RlQWN0dWFsCis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1dFUl9VU0FHRV9EQVRBX1JFUE9SVEVELAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQzMl90KShkdXJhdGlvbl9ucyAvIE5BTk9TX1BFUl9TRUNPTkQpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZmxvYXQpdm9sdW1lLAorICAgIGNvbnN0IGludDMyX3QgZHVyYXRpb25fc2VjcyA9IChpbnQzMl90KShkdXJhdGlvbl9ucyAvIE5BTk9TX1BFUl9TRUNPTkQpOworICAgIGNvbnN0IGZsb2F0IGF2ZXJhZ2Vfdm9sdW1lID0gKGZsb2F0KXZvbHVtZTsKKyAgICBjb25zdCBpbnQgcmVzdWx0ID0gYW5kcm9pZDo6dXRpbDo6c3RhdHNfd3JpdGUoYW5kcm9pZDo6dXRpbDo6QVVESU9fUE9XRVJfVVNBR0VfREFUQV9SRVBPUlRFRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fZGV2aWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdXJhdGlvbl9zZWNzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmVyYWdlX3ZvbHVtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSk7CisKKyAgICBzdGQ6OnN0cmluZ3N0cmVhbSBsb2c7CisgICAgbG9nIDw8ICJyZXN1bHQ6IiA8PCByZXN1bHQgPDwgIiB7IgorICAgICAgICAgICAgPDwgIiBtZWRpYW1ldHJpY3NfYXVkaW9fcG93ZXJfdXNhZ2VfZGF0YV9yZXBvcnRlZDoiCisgICAgICAgICAgICA8PCBhbmRyb2lkOjp1dGlsOjpBVURJT19QT1dFUl9VU0FHRV9EQVRBX1JFUE9SVEVECisgICAgICAgICAgICA8PCAiIGF1ZGlvX2RldmljZToiIDw8IGF1ZGlvX2RldmljZQorICAgICAgICAgICAgPDwgIiBkdXJhdGlvbl9zZWNzOiIgPDwgZHVyYXRpb25fc2VjcworICAgICAgICAgICAgPDwgIiBhdmVyYWdlX3ZvbHVtZToiIDw8IGF2ZXJhZ2Vfdm9sdW1lCisgICAgICAgICAgICA8PCAiIHR5cGU6IiA8PCB0eXBlCisgICAgICAgICAgICA8PCAiIH0iOworICAgIG1TdGF0c2RMb2ctPmxvZyhhbmRyb2lkOjp1dGlsOjpBVURJT19QT1dFUl9VU0FHRV9EQVRBX1JFUE9SVEVELCBsb2cuc3RyKCkpOwogfQogCiBib29sIEF1ZGlvUG93ZXJVc2FnZTo6c2F2ZUFzSXRlbV9sKApAQCAtMTc0LDggKzE4Niw4IEBACiAgICAgICAgIGlmIChpdGVtX2RldmljZSA9PSBkZXZpY2UgJiYgaXRlbV90eXBlID09IHR5cGUpIHsKICAgICAgICAgICAgIGludDY0X3QgZmluYWxfZHVyYXRpb25fbnMgPSBpdGVtX2R1cmF0aW9uX25zICsgZHVyYXRpb25fbnM7CiAgICAgICAgICAgICBkb3VibGUgZmluYWxfdm9sdW1lID0gKGRldmljZSAmIElOUFVUX0RFVklDRV9CSVQpID8gMS4wOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoaXRlbV92b2x1bWUgKiBpdGVtX2R1cmF0aW9uX25zICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmVyYWdlX3ZvbCAqIGR1cmF0aW9uX25zKSAvIGZpbmFsX2R1cmF0aW9uX25zKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKGl0ZW1fdm9sdW1lICogKGRvdWJsZSlpdGVtX2R1cmF0aW9uX25zICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmVyYWdlX3ZvbCAqIChkb3VibGUpZHVyYXRpb25fbnMpIC8gKGRvdWJsZSlmaW5hbF9kdXJhdGlvbl9ucyk7CiAKICAgICAgICAgICAgIGl0ZW0tPnNldEludDY0KEFVRElPX1BPV0VSX1VTQUdFX1BST1BfRFVSQVRJT05fTlMsIGZpbmFsX2R1cmF0aW9uX25zKTsKICAgICAgICAgICAgIGl0ZW0tPnNldERvdWJsZShBVURJT19QT1dFUl9VU0FHRV9QUk9QX1ZPTFVNRSwgZmluYWxfdm9sdW1lKTsKQEAgLTI4OSw3ICszMDEsNyBAQAogICAgICAgICBjb25zdCBpbnQ2NF90IGR1cmF0aW9uTnMgPSBlbmRDYWxsTnMgLSBtRGV2aWNlVGltZU5zOwogICAgICAgICBpZiAoZHVyYXRpb25OcyA+IDApIHsKICAgICAgICAgICAgIG1EZXZpY2VWb2x1bWUgPSAobURldmljZVZvbHVtZSAqIGRvdWJsZShtVm9sdW1lVGltZU5zIC0gbURldmljZVRpbWVOcykgKwotICAgICAgICAgICAgICAgICAgICBtVm9pY2VWb2x1bWUgKiBkb3VibGUoZW5kQ2FsbE5zIC0gbVZvbHVtZVRpbWVOcykpIC8gZHVyYXRpb25OczsKKyAgICAgICAgICAgICAgICAgICAgbVZvaWNlVm9sdW1lICogZG91YmxlKGVuZENhbGxOcyAtIG1Wb2x1bWVUaW1lTnMpKSAvIChkb3VibGUpZHVyYXRpb25OczsKICAgICAgICAgICAgIHNhdmVBc0l0ZW1zX2wobVByaW1hcnlEZXZpY2UsIGR1cmF0aW9uTnMsIFZPSUNFX0NBTExfVFlQRSwgbURldmljZVZvbHVtZSk7CiAgICAgICAgIH0KICAgICB9IGVsc2UgaWYgKG1vZGUgPT0gIkFVRElPX01PREVfSU5fQ0FMTCIpIHsgLy8gZW50ZXJpbmcgY2FsbCBtb2RlCkBAIC0zMTcsNyArMzI5LDcgQEAKICAgICAgICAgY29uc3QgaW50NjRfdCBkdXJhdGlvbk5zID0gdGltZU5zIC0gbURldmljZVRpbWVOczsKICAgICAgICAgaWYgKGR1cmF0aW9uTnMgPiAwKSB7CiAgICAgICAgICAgICBtRGV2aWNlVm9sdW1lID0gKG1EZXZpY2VWb2x1bWUgKiBkb3VibGUobVZvbHVtZVRpbWVOcyAtIG1EZXZpY2VUaW1lTnMpICsKLSAgICAgICAgICAgICAgICAgICAgbVZvaWNlVm9sdW1lICogZG91YmxlKHRpbWVOcyAtIG1Wb2x1bWVUaW1lTnMpKSAvIGR1cmF0aW9uTnM7CisgICAgICAgICAgICAgICAgICAgIG1Wb2ljZVZvbHVtZSAqIGRvdWJsZSh0aW1lTnMgLSBtVm9sdW1lVGltZU5zKSkgLyAoZG91YmxlKWR1cmF0aW9uTnM7CiAgICAgICAgICAgICBtVm9sdW1lVGltZU5zID0gdGltZU5zOwogICAgICAgICB9CiAgICAgfQpAQCAtMzQ4LDcgKzM2MCw3IEBACiAgICAgICAgIGNvbnN0IGludDY0X3QgZHVyYXRpb25OcyA9IGVuZERldmljZU5zIC0gbURldmljZVRpbWVOczsKICAgICAgICAgaWYgKGR1cmF0aW9uTnMgPiAwKSB7CiAgICAgICAgICAgICBtRGV2aWNlVm9sdW1lID0gKG1EZXZpY2VWb2x1bWUgKiBkb3VibGUobVZvbHVtZVRpbWVOcyAtIG1EZXZpY2VUaW1lTnMpICsKLSAgICAgICAgICAgICAgICAgICAgbVZvaWNlVm9sdW1lICogZG91YmxlKGVuZERldmljZU5zIC0gbVZvbHVtZVRpbWVOcykpIC8gZHVyYXRpb25OczsKKyAgICAgICAgICAgICAgICAgICAgbVZvaWNlVm9sdW1lICogZG91YmxlKGVuZERldmljZU5zIC0gbVZvbHVtZVRpbWVOcykpIC8gKGRvdWJsZSlkdXJhdGlvbk5zOwogICAgICAgICAgICAgc2F2ZUFzSXRlbXNfbChtUHJpbWFyeURldmljZSwgZHVyYXRpb25OcywgVk9JQ0VfQ0FMTF9UWVBFLCBtRGV2aWNlVm9sdW1lKTsKICAgICAgICAgfQogICAgICAgICAvLyByZXNldCBzdGF0aXN0aWNzCkBAIC0zNjAsOCArMzcyLDEwIEBACiAgICAgbVByaW1hcnlEZXZpY2UgPSBkZXZ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XN1bHRbXSA9CisgICAgICAgICAgICAgICAgICAgICJSZWNvZ25pemVkIHBhcmFtZXRlcnM6XG4iCisgICAgICAgICAgICAgICAgICAgICItLWFsbCAgICAgICAgIHNob3cgYWxsIHJlY29yZHNcbiIKKyAgICAgICAgICAgICAgICAgICAgIi0tY2xlYXIgICAgICAgY2xlYXIgb3V0IHNhdmVkIHJlY29yZHNcbiIKKyAgICAgICAgICAgICAgICAgICAgIi0taGVhcCAgICAgICAgc2hvdyBoZWFwIHVzYWdlICh0b3AgMTAwKVxuIgorICAgICAgICAgICAgICAgICAgICAiLS1oZWxwICAgICAgICBkaXNwbGF5IGhlbHBcbiIKKyAgICAgICAgICAgICAgICAgICAgIi0tcHJlZml4IFggICAgcHJvY2VzcyByZWNvcmRzIGZvciBjb21wb25lbnQgWFxuIgorICAgICAgICAgICAgICAgICAgICAiLS1zaW5jZSBYICAgICBYIDwgMDogcmVjb3JkcyBmcm9tIC1YIHNlY29uZHMgaW4gdGhlIHBhc3RcbiIKKyAgICAgICAgICAgICAgICAgICAgIiAgICAgICAgICAgICAgWCA9IDA6IGlnbm9yZVxuIgorICAgICAgICAgICAgICAgICAgICAiICAgICAgICAgICAgICBYID4gMDogcmVjb3JkcyBmcm9tIFggc2Vjb25kcyBzaW5jZSBVbml4IGVwb2NoXG4iCisgICAgICAgICAgICAgICAgICAgICItLXVucmVhY2hhYmxlIHNob3cgdW5yZWFjaGFibGUgbWVtb3J5IChsZWFrcylcbiI7CisgICAgICAgICAgICB3cml0ZShmZCwgcmVzdWx0LCBzdGQ6OnNpemUocmVzdWx0KSk7CiAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7CiAgICAgICAgIH0gZWxzZSBpZiAoYXJnc1tpXSA9PSBwcmVmaXhPcHRpb24pIHsKICAgICAgICAgICAgICsraTsKQEAgLTI4MiwzMCArMjg3LDM2IEBACiAgICAgICAgICAgICB1bnJlYWNoYWJsZSA9IHRydWU7CiAgICAgICAgIH0KICAgICB9Ci0KKyAgICBzdGQ6OnN0cmluZ3N0cmVhbSByZXN1bHQ7CiAgICAgewogICAgICAgICBzdGQ6OmxvY2tfZ3VhcmQgX2wobUxvY2spOwogCiAgICAgICAgIGlmIChjbGVhcikgewotICAgICAgICAgICAgbUl0ZW1zRGlzY2FyZGVkICs9IG1JdGVtcy5zaXplKCk7CisgICAgICAgICAgICBtSXRlbXNEaXNjYXJkZWQgKz0gKGludDY0X3QpbUl0ZW1zLnNpemUoKTsKICAgICAgICAgICAgIG1JdGVtcy5jbGVhcigpOwogICAgICAgICAgICAgbUF1ZGlvQW5hbHl0aWNzLmNsZWFyKCk7CiAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXN1bHQuYXBwZW5kRm9ybWF0KCJEdW1wIG9mIHRoZSAlcyBwcm9jZXNzOlxuIiwga1NlcnZpY2VOYW1lKTsKKyAgICAgICAgICAgIHJlc3VsdCA8PCBTdHJpbmdQcmludGYoIkR1bXAgb2YgdGhlICVzIHByb2Nlc3M6XG4iLCBrU2VydmljZU5hbWUpOwogICAgICAgICAgICAgY29uc3QgY2hhciAqcHJlZml4cHRyID0gcHJlZml4LnNpemUoKSA+IDAgPyBwcmVmaXguY19zdHIoKSA6IG51bGxwdHI7Ci0gICAgICAgICAgICBkdW1wSGVhZGVycyhyZXN1bHQsIHNpbmNlTnMsIHByZWZpeHB0cik7Ci0gICAgICAgICAgICBkdW1wUXVldWUocmVzdWx0LCBzaW5jZU5zLCBwcmVmaXhwdHIpOworICAgICAgICAgICAgcmVzdWx0IDw8IGR1bXBIZWFkZXJzKHNpbmNlTnMsIHByZWZpeHB0cik7CisgICAgICAgICAgICByZXN1bHQgPDwgZHVtcFF1ZXVlKHNpbmNlTnMsIHByZWZpeHB0cik7CiAKICAgICAgICAgICAgIC8vIFRPRE86IG1heWJlIGNvbnNpZGVyIGEgYmV0dGVyIHdheSBvZiBkdW1waW5nIGF1ZGlvIGFuYWx5dGljcyBpbmZvLgogICAgICAgICAgICAgY29uc3QgaW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leD4KKyNpbmNsdWRlIDxzc3RyZWFtPgorCituYW1lc3BhY2UgYW5kcm9pZDo6bWVkaWFtZXRyaWNzIHsKKworY2xhc3MgU3RhdHNkTG9nIHsKK3B1YmxpYzoKKyAgICBleHBsaWNpdCBTdGF0c2RMb2coc2l6ZV90IGxpbmVzKSA6IG1TaW1wbGVMb2cobGluZXMpIHt9CisKKyAgICB2b2lkIGxvZyhpbnQgYXRvbSwgY29uc3Qgc3RkOjpzdHJpbmcmIHN0cmluZykgeworICAgICAgICB7CisgICAgICAgICAgICBzdGQ6OmxvY2tfZ3VhcmQgbG9jayhtTG9jayk7CisgICAgICAgICAgICArK21Db3VudE1hcFthdG9tXTsKKyAgICAgICAgfQorICAgICAgICBtU2ltcGxlTG9nLmxvZygiJXMiLCBzdHJpbmcuY19zdHIoKSk7CisgICAgfQorCisgICBzdGQ6OnN0cmluZyBkdW1wVG9TdHJpbmcoY29uc3QgY2hhciAqcHJlZml4ID0gIiIsIHNpemVfdCBsb2dMaW5lcyA9IDApIGNvbnN0IHsKKyAgICAgICBzdGQ6OnN0cmluZ3N0cmVhbSBzczsKKworICAgICAgIHsgICAvLyBmaXJzdCBwcmludCBvdXQgdGhlIGF0b20gY291bnRzCisgICAgICAgICAgIHN0ZDo6bG9ja19ndWFyZCBsb2NrKG1Mb2NrKTsKKworICAgICAgICAgICBzaXplX3QgY29sID0gMDsKKyAgICAgICAgICAgZm9yIChjb25zdCBhdXRvJiBjb3VudCA6IG1Db3VudE1hcCkgeworICAgICAgICAgICAgICAgaWYgKGNvbCA9PSA4KSB7CisgICAgICAgICAgICAgICAgICAgY29sID0gMDsKKyAgICAgICAgICAgICAgICAgICBzcyA8PCAiXG4iIDw8IHByZWZpeDsKKyAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgc3MgPDwgIiAiOworICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgc3MgPDwgIlsgIiA8PCBjb3VudC5maXJzdCA8PCAiIDog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XRpbHMiLAorICAgICAgICAibGlibWVtdW5yZWFjaGFibGUiLAorICAgICAgICAibGlicHJvdG9idWYtY3BwLWxpdGUiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHQiLAorICAgICAgICAibGlic3RhZ2VmcmlnaHRfZm91bmRhdGlvbiIsCisgICAgICAgICJsaWJzdGF0c2xvZyIsCisgICAgICAgICJsaWJzdGF0c3B1bGwiLAorICAgICAgICAibGlic3RhdHNzb2NrZXQiLAorICAgICAgICAibGlidXRpbHMiLAorICAgICAgICAibWVkaWFtZXRyaWNzc2VydmljZS1haWRsLWNwcCIsCisgICAgXSwKKworICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiZnJhbWV3b3Jrcy9hdi9zZXJ2aWNlcy9tZWRpYW1ldHJpY3MiLAorICAgICAgICAic3lzdGVtL21lZGlhL2F1ZGlvX3V0aWxzL2luY2x1ZGUiLAorICAgIF0sCisKKyAgICBmdXp6X2NvbmZpZzogeworICAgICAgICBjYzogWworICAgICAgICAgICAgImFuZHJvaWQtbWVkaWEtZnV6emluZy1yZXBvcnRzQGdvb2dsZS5jb20iLAorICAgICAgICBdLAorICAgICAgICBjb21wb25lbnRpZDogMTU1Mjc2LAorICAgIH0sCit9CmRpZmYgLS1naXQgYS9zZXJ2aWNlcy9tZWRpYW1ldHJpY3MvZnV6emVyL1JFQURNRS5tZCBiL3NlcnZpY2VzL21lZGlhbWV0cmljcy9mdXp6ZXIvUkVBRE1FLm1kCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmExMzgzMGUKLS0tIC9kZXYvbnVsbAorKysgYi9zZXJ2aWNlcy9tZWRpYW1ldHJpY3MvZnV6emVyL1JFQURNRS5tZApAQCAtMCwwICsxLDU0IEBACisjIEZ1enplciBmb3IgbGlibWVkaWFtZXRyaWNzc2VydmljZQorCisjIyBQbHVnaW4gRGVzaWduIENvbnNpZGVyYXRpb25zCitUaGUgZnV6emVyIHBsdWdpbiBmb3IgbG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bmRvbUxlbmd0aFN0cmluZygpLmNfc3RyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmRwLkNvbnN1bWVSYW5kb21MZW5ndGhTdHJpbmcoKS5jX3N0cigpKTsKKyAgICB9Cit9CisKK3ZvaWQgTWVkaWFNZXRyaWNzU2VydmljZUZ1enplcjo6aW52b2tlSXRlbU1hbmlwdWxhdGlvbihjb25zdCB1aW50OF90ICpkYXRhLCBzaXplX3Qgc2l6ZSkgeworICAgIEZ1enplZERhdGFQcm92aWRlciBmZHAgPSBGdXp6ZWREYXRhUHJvdmlkZXIoZGF0YSwgc2l6ZSk7CisKKyAgICBtZWRpYW1ldHJpY3M6Okl0ZW0gaXRlbShmZHAuQ29uc3VtZVJhbmRvbUxlbmd0aFN0cmluZygpLmNfc3RyKCkpOworICAgIHdoaWxlIChmZHAucmVtYWluaW5nX2J5dGVzKCkpIHsKKyAgICAgICAgY29uc3QgdWludDhfdCBhY3Rpb24gPSBmZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTx1aW50OF90PigwLCAxNik7CisgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nIGtleSA9IGZkcC5Db25zdW1lUmFuZG9tTGVuZ3RoU3RyaW5nKCk7CisgICAgICAgIGlmIChmZHAucmVtYWluaW5nX2J5dGVzKCkgPCAxIHx8IGtleS5sZW5ndGgoKSA8IDEpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIHN3aXRjaCAoYWN0aW9uKSB7CisgICAgICAgICAgICBjYXNlIDA6IHsKKyAgICAgICAgICAgICAgICBpdGVtLnNldEludDMyKGtleS5jX3N0cigpLCBmZHAuQ29uc3VtZUludGVncmFsPGludDMyX3Q+KCkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSAxOiB7CisgICAgICAgICAgICAgICAgaXRlbS5hZGRJbnQzMihrZXkuY19zdHIoKSwgZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQzMl90PigpKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgMjogeworICAgICAgICAgICAgICAgIGludDMyX3QgaTMyID0gMDsKKyAgICAgICAgICAgICAgICBpdGVtLmdldEludDMyKGtleS5jX3N0cigpLCAmaTMyKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgMzogeworICAgICAgICAgICAgICAgIGl0ZW0uc2V0SW50NjQoa2V5LmNfc3RyKCksIGZkcC5Db25zdW1lSW50ZWdyYWw8aW50NjRfdD4oKSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIDQ6IHsKKyAgICAgICAgICAgICAgICBpdGVtLmFkZEludDY0KGtleS5jX3N0cigpLCBmZHAuQ29uc3VtZUludGVncmFsPGludDY0X3Q+KCkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSA1OiB7CisgICAgICAgICAgICAgICAgaW50NjRfdCBpNjQgPSAwOworICAgICAgICAgICAgICAgIGl0ZW0uZ2V0SW50NjQoa2V5LmNfc3RyKCksICZpNjQpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSA2OiB7CisgICAgICAgICAgICAgICAgaXRlbS5zZXREb3VibGUoa2V5LmNfc3RyKCksIGZkcC5Db25zdW1lRmxvYXRpbmdQb2ludDxkb3VibGU+KCkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSA3OiB7CisgICAgICAgICAgICAgICAgaXRlbS5hZGREb3VibGUoa2V5LmNfc3RyKCksIGZkcC5Db25zdW1lRmxvYXRpbmdQb2ludDxkb3VibGU+KCkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSA4OiB7CisgICAgICAgICAgICAgICAgZG91YmxlIGQgPSAwOworICAgICAgICAgICAgICAgIGl0ZW0uZ2V0RG91YmxlKGtleS5jX3N0cigpLCAmZCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIDk6IHsKKyAgICAgICAgICAgICAgICBpdGVtLnNldENTdHJpbmcoa2V5LmNfc3RyKCksIGZkcC5Db25zdW1lUmFuZG9tTGVuZ3RoU3RyaW5nKCkuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIDEwOiB7CisgICAgICAgICAgICAgICAgY2hhciAqcyA9IG51bGxwdHI7CisgICAgICAgICAgICAgICAgaXRlbS5nZXRDU3RyaW5nKGtleS5jX3N0cigpLCAmcyk7CisgICAgICAgICAgICAgICAgaWYgKHMpIGZyZWUocyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIDExOiB7CisgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgczsKKyAgICAgICAgICAgICAgICBpdGVtLmdldFN0cmluZyhrZXkuY19zdHIoKSwgJnMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSAxMjogeworICAgICAgICAgICAgICAgIGl0ZW0uc2V0UmF0ZShrZXkuY19zdHIoKSwgZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQ2NF90PigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZHAuQ29uc3VtZUludGVncmFsPGludDY0X3Q+KCkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSAxMzogeworICAgICAgICAgICAgICAgIGludDY0X3QgYiA9IDAsIGggPSAwOworICAgICAgICAgICAgICAgIGRvdWJsZSBkID0gMDsKKyAgICAgICAgICAgICAgICBpdGVtLmdldFJhdGUoa2V5LmNfc3RyKCksICZiLCAmaCwgJmQpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSAxNDogeworICAgICAgICAgICAgICAgICh2b2lkKWl0ZW0uZmlsdGVyKGtleS5jX3N0cigpKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgMTU6IHsKKyAgICAgICAgICAgICAgICBjb25zdCBjaGFyICphcnJbMV0gPSB7IiJ9OworICAgICAgICAgICAgICAgIGFyclswXSA9IGNvbnN0X2Nhc3Q8Y2hhciAqPihrZXkuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgKHZvaWQpaXRlbS5maWx0ZXJOb3QoMSwgYXJyKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgMTY6IHsKKyAgICAgICAgICAgICAgICAodm9pZClpdGVtLnRvU3RyaW5nKCkuY19zdHIoKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIFBhcmNlbCBwOworICAgIG1lZGlhbWV0cmljczo6SXRlbSBpdGVtMjsKKworICAgICh2b2lkKWl0ZW0ud3JpdGVUb1BhcmNlbCgmcCk7CisgICAgcC5zZXREYXRhUG9zaXRpb24oMCk7ICAvLyByZXdpbmQgZm9yIHJlYWRpbmcKKyAgICAodm9pZClpdGVtMi5yZWFkRnJvbVBhcmNlbChwKTsKKworICAgIGNoYXIgKmJ5dGVEYXRhID0gbnVsbHB0cjsKKyAgICBzaXplX3QgbGVuZ3RoID0gMDsKKyAgICAodm9pZClpdGVtLndyaXRlVG9CeXRlU3RyaW5nKCZieXRlRGF0YSwgJmxlbmd0aCk7CisgICAgKHZvaWQpaXRlbTIuc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aWR0aCA9IC0xOwotICAgIGlmICggaXRlbS0+Z2V0SW50MzIoImFuZHJvaWQubWVkaWEubWVkaWFjb2RlYy5tYXh3aWR0aCIsICZtYXh3aWR0aCkpIHsKLSAgICAgICAgbWV0cmljc19wcm90by5zZXRfbWF4X3dpZHRoKG1heHdpZHRoKTsKKyAgICBBU3RhdHNFdmVudF93cml0ZUludDMyKGV2ZW50LCBsZXZlbCk7CisKKworICAgIGludDMyX3QgbWF4X3dpZHRoID0gLTE7CisgICAgaWYgKCBpdGVtLT5nZXRJbnQzMigiYW5kcm9pZC5tZWRpYS5tZWRpYWNvZGVjLm1heHdpZHRoIiwgJm1heF93aWR0aCkpIHsKKyAgICAgICAgbWV0cmljc19wcm90by5zZXRfbWF4X3dpZHRoKG1heF93aWR0aCk7CiAgICAgfQotICAgIC8vIGFuZHJvaWQubWVkaWEubWVkaWFjb2RlYy5tYXhoZWlnaHQgICAgICAgaW50MzIKLSAgICBpbnQzMl90IG1heGhlaWdodCA9IC0xOwotICAgIGlmICggaXRlbS0+Z2V0SW50MzIoImFuZHJvaWQubWVkaWEubWVkaWFjb2RlYy5tYXhoZWlnaHQiLCAmbWF4aGVpZ2h0KSkgewotICAgICAgICBtZXRyaWNzX3Byb3RvLnNldF9tYXhfaGVpZ2h0KG1heGhlaWdodCk7CisgICAgQVN0YXRzRXZlbnRfd3JpdGVJbnQzMihldmVudCwgbWF4X3dpZHRoKTsKKworICAgIGludDMyX3QgbWF4X2hlaWdodCA9IC0xOworICAgIGlmICggaXRlbS0+Z2V0SW50MzIoImFuZHJvaWQubWVkaWEubWVkaWFjb2RlYy5tYXhoZWlnaHQiLCAmbWF4X2hlaWdodCkpIHsKKyAgICAgICAgbWV0cmljc19wcm90by5zZXRfbWF4X2hlaWdodChtYXhfaGVpZ2h0KTsKICAgICB9Ci0gICAgLy8gYW5kcm9pZC5tZWRpYS5tZWRpYWNvZGVjLmVycmNvZGUgICAgICAgICBpbnQzMgotICAgIGludDMyX3QgZXJyY29k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TsKKworICAgIGludDMyX3QgcXBQTWluID0gLTE7CisgICAgaWYgKGl0ZW0tPmdldEludDMyKCJhbmRyb2lkLm1lZGlhLm1lZGlhY29kZWMudmlkZW8tcXAtcC1taW4iLCAmcXBQTWluKSkgeworICAgICAgICBtZXRyaWNzX3Byb3RvLnNldF92aWRlb19xcF9wX21pbihxcFBNaW4pOworICAgIH0KKyAgICBBU3RhdHNFdmVudF93cml0ZUludDMyKGV2ZW50LCBxcFBNaW4pOworCisgICAgaW50MzJfdCBxcFBNYXggPSAtMTsKKyAgICBpZiAoaXRlbS0+Z2V0SW50MzIoImFuZHJvaWQubWVkaWEubWVkaWFjb2RlYy52aWRlby1xcC1wLW1heCIsICZxcFBNYXgpKSB7CisgICAgICAgIG1ldHJpY3NfcHJvdG8uc2V0X3ZpZGVvX3FwX3BfbWF4KHFwUE1heCk7CisgICAgfQorICAgIEFTdGF0c0V2ZW50X3dyaXRlSW50MzIoZXZlbnQsIHFwUE1heCk7CisKKyAgICBpbnQzMl90IHFwQk1pbiA9IC0xOworICAgIGlmIChpdGVtLT5nZXRJbnQzMigiYW5kcm9pZC5tZWRpYS5tZWRpYWNvZGVjLnZpZGVvLXFwLWItbWluIiwgJnFwQk1pbikpIHsKKyAgICAgICAgbWV0cmljc19wcm90by5zZXRfdmlkZW9fcXBfYl9taW4ocXBCTWluKTsKKyAgICB9CisgICAgQVN0YXRzRXZlbnRfd3JpdGVJbnQzMihldmVudCwgcXBCTWluKTsKKworICAgIGludDMyX3QgcXBCTWF4ID0gLTE7CisgICAgaWYgKGl0ZW0tPmdldEludDMyKCJhbmRyb2lkLm1lZGlhLm1lZGlhY29kZWMudmlkZW8tcXAtYi1tYXgiLCAmcXBCTWF4KSkgeworICAgICAgICBtZXRyaWNzX3Byb3RvLnNldF92aWRlb19xcF9iX21heChxcEJNYXgpOworICAgIH0KKyAgICBBU3RhdHNFdmVudF93cml0ZUludDMyKGV2ZW50LCBxcEJNYXgpOworCisgICAgaW50MzJfdCBvcm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ICAgICAgICBtZXRyaWNzX3Byb3RvLnNldF9vcmlnaW5hbF92aWRlb19xcF9pX21heChxcElNYXhPcmkpOworICAgIH0KKyAgICBBU3RhdHNFdmVudF93cml0ZUludDMyKGV2ZW50LCBxcElNYXhPcmkpOworCisgICAgaW50MzJfdCBxcFBNaW5PcmkgPSAtMTsKKyAgICBpZiAoIGl0ZW0tPmdldEludDMyKCJhbmRyb2lkLm1lZGlhLm1lZGlhY29kZWMub3JpZ2luYWwtdmlkZW8tcXAtcC1taW4iLCAmcXBQTWluT3JpKSkgeworICAgICAgICBtZXRyaWNzX3Byb3RvLnNldF9vcmlnaW5hbF92aWRlb19xcF9wX21pbihxcFBNaW5PcmkpOworICAgIH0KKyAgICBBU3RhdHNFdmVudF93cml0ZUludDMyKGV2ZW50LCBxcFBNaW5PcmkpOworCisgICAgaW50MzJfdCBxcFBNYXhPcmkgPSAtMTsKKyAgICBpZiAoIGl0ZW0tPmdldEludDMyKCJhbmRyb2lkLm1lZGlhLm1lZGlhY29kZWMub3JpZ2luYWwtdmlkZW8tcXAtcC1tYXgiLCAmcXBQTWF4T3JpKSkgeworICAgICAgICBtZXRyaWNzX3Byb3RvLnNldF9vcmlnaW5hbF92aWRlb19xcF9wX21heChxcFBNYXhPcmkpOworICAgIH0KKyAgICBBU3RhdHNFdmVudF93cml0ZUludDMyKGV2ZW50LCBxcFBNYXhPcmkpOworCisgICAgaW50MzJfdCBxcEJNaW5PcmkgPSAtMTsKKyAgICBpZiAoIGl0ZW0tPmdldEludDMyKCJhbmRyb2lkLm1lZGlhLm1lZGlhY29kZWMub3JpZ2luYWwtdmlkZW8tcXAtYi1taW4iLCAmcXBCTWluT3JpKSkgeworICAgICAgICBtZXRyaWNzX3Byb3RvLnNldF9vcmlnaW5hbF92aWRlb19xcF9iX21pbihxcEJNaW5PcmkpOworICAgIH0KKyAgICBBU3RhdHNFdmVudF93cml0ZUludDMyKGV2ZW50LCBxcEJNaW5PcmkpOworCisgICAgaW50MzJfdCBxc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gICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYV9hcGV4X3ZlcnNpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmZfc2VyaWFsaXplZCk7CiAKLSAgICBpZiAoZW5hYmxlZF9zdGF0c2QpIHsKLSAgICAgICAgYW5kcm9pZDo6dXRpbDo6Qnl0ZXNGaWVsZCBiZl9zZXJpYWxpemVkKCBzZXJpYWxpemVkLmNfc3RyKCksIHNlcmlhbGl6ZWQuc2l6ZSgpKTsKLSAgICAgICAgKHZvaWQpYW5kcm9pZDo6dXRpbDo6c3RhdHNfd3JpdGUoYW5kcm9pZDo6dXRpbDo6TUVESUFNRVRSSUNTX0NPREVDX1JFUE9SVEVELAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXAsIHBrZ05hbWUuY19zdHIoKSwgcGtnVmVyc2lvbkNvZGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhQXBleFZlcnNpb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJmX3NlcmlhbGl6ZWQpOworICAgIHN0ZDo6c3RyaW5nc3RyZWFtIGxvZzsKKyAgICBsb2cgPDwgInJlc3VsdDoiIDw8IHJlc3VsdCA8PCAiIHsiCisgICAgICAgICAgICA8PCAiIG1lZGlhbWV0cmljc19jb2RlY19yZXBvcnRlZDoiCisgICAgICAgICAgICA8PCBhbmRyb2lkOjp1dGlsOjpNRURJQU1FVFJJQ1NfQ09ERUNfUkVQT1JURUQKKyAgICAgICAgICAgIDw8ICIgdGltZXN0YW1wX25hbm9zOiIgPDwgdGltZXN0YW1wX25hbm9zCisgICAgICAgICAgICA8PCAiIHBhY2thZ2VfbmFtZToiIDw8IHBhY2thZ2VfbmFtZQorICAgICAgICAgICAgPDwgIiBwYWNrYWdlX3ZlcnNpb25fY29kZToiIDw8IHBhY2thZ2VfdmVyc2lvbl9jb2RlCisgICAgICAgICAgICA8PCAiIG1lZGlhX2FwZXhfdmVyc2lvbjoiIDw8IG1lZGlhX2FwZXhfdmVyc2lvbgogCi0gICAgfSBlbHNlIHsKLSAgICAgICAgQUxPR1YoIk5PVCBzZW5kaW5nOiBwcml2YXRlIGRhdGEgKGxlbj0lenUpIiwgc3RybGVuKHNlcmlhbGl6ZWQuY19zdHIoKSkpOwotICAgIH0KKyAgICAgICAgICAgIDw8ICIgY29kZWM6IiA8PCBjb2RlYworICAgICAgICAgICAgPDwgIiBtaW1lOiIgPDwgbWltZQorICAgICAgICAgICAgPDwgIiBtb2RlOiIgPDwgbW9kZQorICAgICAgICAgICAgPDwgIiBlbmNvZGVyOiIgPDwgZW5jb2RlcgorICAgICAgICAgICAgPDwgIiBzZWN1cmU6IiA8PCBzZWN1cmUKKyAgICAgICAgICAgIDw8ICIgd2lkdGg6IiA8PCB3aWR0aAorICAgICAgICAgICAgPDwgIiBoZWlnaHQ6IiA8PCBoZWlnaHQKKyAgICAgICAgICAgIDw8ICIgcm90YXRpb246IiA8PCByb3RhdGlvbgorICAgICAgICAgICAgPDwgIiBjcnlwdG86IiA8PCBjcnlwdG8KKyAgICAgICAgICAgIDw8ICIgcHJvZmlsZToiIDw8IHByb2ZpbGUKKworICAgICAgICAgICAgPDwgIiBsZXZlbDoiIDw8IGxldmVsCisgICAgICAgICAgICA8PCAiIG1heF93aWR0aDoiIDw8IG1heF93aWR0aAorICAgICAgICAgICAgPDwgIiBtYXhfaGVpZ2h0OiIgPDwgbWF4X2hlaWdodAorICAgICAgICAgICAgPDwgIiBlcnJvcl9jb2RlOiIgPDwgZXJyb3JfY29kZQorICAgICAgICAgICAgPDwgIiBlcnJvcl9zdGF0ZToiIDw8IGVycm9yX3N0YXRlCisgICAgICAgICAgICA8PCAiIGxhdGVuY3lfbWF4OiIgPDwgbGF0ZW5jeV9tYXgKKyAgICAgICAgICAgIDw8ICIgbGF0ZW5jeV9taW46IiA8PCBsYXRlbmN5X21pbgorICAgICAgICAgICAgPDwgIiBsYXRlb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luZyBkZXNjcmlwdGlvbjsKICAgICAodm9pZCkgaXRlbS0+Z2V0U3RyaW5nKCJkZXNjcmlwdGlvbiIsICZkZXNjcmlwdGlvbik7Ci0gICAgc3RkOjpzdHJpbmcgc2VyaWFsaXplZF9tZXRyaWNzOwotICAgICh2b2lkKSBpdGVtLT5nZXRTdHJpbmcoInNlcmlhbGl6ZWRfbWV0cmljcyIsICZzZXJpYWxpemVkX21ldHJpY3MpOwotCi0gICAgaWYgKGVuYWJsZWRfc3RhdHNkKSB7Ci0gICAgICAgIGFuZHJvaWQ6OnV0aWw6OkJ5dGVzRmllbGQgYmZfc2VyaWFsaXplZChzZXJpYWxpemVkX21ldHJpY3MuY19zdHIoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcmlhbGl6ZWRfbWV0cmljcy5zaXplKCkpOwotICAgICAgICBhbmRyb2lkOjp1dGlsOjpzdGF0c193cml0ZShhbmRyb2lkOjp1dGlsOjpNRURJQU1FVFJJQ1NfTUVESUFEUk1fUkVQT1JURUQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVzdGFtcCwgcGtnTmFtZS5jX3N0cigpLCBwa2dWZXJzaW9uQ29kZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFBcGV4VmVyc2lvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yLmNfc3RyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uLmNfc3RyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJmX3NlcmlhbGl6ZWQpOwotICAgIH0gZWxzZSB7Ci0gICAgICAgIEFMT0dWKCJOT1Qgc2VuZGluZzogbWVkaWFkcm0gcHJpdmF0ZSBkYXRhIChsZW49JXp1KSIsIHNlcmlhbGl6ZWRfbWV0cmljcy5zaXplKCkpOw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mcGx1Z2luX2lkKTsKQEAgLTEzMiw4ICsxMjIsOSBAQAogICAgICAgICBpdGVtLT5nZXRJbnQ2NCgoIm1ldGhvZCJzICsgc3RkOjp0b19zdHJpbmcoaSkpLmNfc3RyKCksICZtZXRob2RDb3VudHNbaV0pOwogICAgIH0KIAotICAgIGFuZHJvaWQ6OnV0aWw6OnN0YXRzX3dyaXRlKGFuZHJvaWQ6OnV0aWw6Ok1FRElBTUVUUklDU19EUk1NQU5BR0VSX1JFUE9SVEVELAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVzdGFtcCwgcGtnTmFtZS5jX3N0cigpLCBwa2dWZXJzaW9uQ29kZSwgbWVkaWFBcGV4VmVyc2lvbiwKKyAgICBjb25zdCBpbnQgcmVzdWx0ID0gYW5kcm9pZDo6dXRpbDo6c3RhdHNfd3JpdGUoYW5kcm9pZDo6dXRpbDo6TUVESUFNRVRSSUNTX0RSTU1BTkFHRVJfUkVQT1JURUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZXN0YW1wX25hbm9zLCBwYWNrYWdlX25hbWUuY19zdHIoKSwgcGFja2FnZV92ZXJzaW9uX2NvZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFfYXBleF92ZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsdWdpbl9pZC5jX3N0cigpLCBkZXNjcmlwdGlvbi5jX3N0cigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZF9pZCwgbWltZV90eXBlcy5jX3N0cigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZENvdW50c1swXSwgbWV0aG9kQ291bnRzWzFdLCBtZXRob2RDb3VudHNbMl0sCkBAIC0xNDIsNiArMTMzLDEwMSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZENvdW50c1s5XSwgbWV0aG9kQ291bnRzWzEwXSwgbWV0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YWN0b3IubWltZSAgICAgICAgc3RyaW5nCisKICAgICBzdGQ6OnN0cmluZyBtaW1lOwogICAgIGlmIChpdGVtLT5nZXRTdHJpbmcoImFuZHJvaWQubWVkaWEubWVkaWFleHRyYWN0b3IubWltZSIsICZtaW1lKSkgewotICAgICAgICBtZXRyaWNzX3Byb3RvLnNldF9taW1lKHN0ZDo6bW92ZShtaW1lKSk7Ci0gICAgfQotICAgIC8vIGFuZHJvaWQubWVkaWEubWVkaWFleHRyYWN0b3IubnRyayAgICAgICAgaW50MzIKLSAgICBpbnQzMl90IG50cmsgPSAtMTsKLSAgICBpZiAoaXRlbS0+Z2V0SW50MzIoImFuZHJvaWQubWVkaWEubWVkaWFleHRyYWN0b3IubnRyayIsICZudHJrKSkgewotICAgICAgICBtZXRyaWNzX3Byb3RvLnNldF90cmFja3MobnRyayk7CisgICAgICAgIG1ldHJpY3NfcHJvdG8uc2V0X21pbWUobWltZSk7CiAgICAgfQogCi0gICAgLy8gYW5kcm9pZC5tZWRpYS5tZWRpYWV4dHJhY3Rvci5lbnRyeSAgICAgICBzdHJpbmcKKyAgICBpbnQzMl90IHRyYWNrcyA9IC0xOworICAgIGlmIChpdGVtLT5nZXRJbnQzMigiYW5kcm9pZC5tZWRpYS5tZWRpYWV4dHJhY3Rvci5udHJrIiwgJnRyYWNrcykpIHsKKyAgICAgICAgbWV0cmljc19wcm90by5zZXRfdHJhY2tzKHRyYWNrcyk7CisgICAgfQorCiAgICAgc3RkOjpzdHJpbmcgZW50cnlfcG9pbnRfc3RyaW5nOworICAgIHN0YXRzOjptZWRpYW1ldHJpY3NfbWVzc2FnZTo6RXh0cmFjdG9yRGF0YTo6RW50cnlQb2ludCBlbnRyeV9wb2ludCA9CisgICAgICAgICAgICBzdGF0czo6bWVkaWFtZXRyaWNzX21lc3NhZ2U6OkV4dHJhY3RvckRhdGFfRW50cnlQb2ludF9PVEhFUjsKICAgICBpZiAoaXRlbS0+Z2V0U3RyaW5nKCJhbmRyb2lkLm1l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CksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZWRCeU5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlclBvb2wuY19zdHIoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdEV4Y2VwdGlvbi5jX3N0cigpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZUJ5dGVDb3VudCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHVyYXRpb25NaWxsaXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrTWltZVR5cGVzLmNfc3RyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrQ29kZWNzLmNfc3RyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsdGVyZWRQYXJhbWV0ZXJzLmNfc3RyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvV2lkdGgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvSGVpZ2h0KTsKLSAgICB9IGVsc2UgewotICAgICAgICBBTE9HVigiTk9UIHNlbmRpbmcgTWVkaWFQYXJzZXIgbWVkaWEgbWV0cmljcy4iKTsKLSAgICB9CisgICAgc3RkOjpzdHJpbmcgbG9nU2Vzc2lvbklkOworICAgIGl0ZW0tPmdldFN0cmluZygiYW5kcm9pZC5tZWRpYS5tZWRpYXBhcnNlci5sb2dTZXNzaW9uSWQiLCAmbG9nU2Vzc2lvbklkKTsKKyAgICBsb2dTZXNzaW9uSWQgPSBtZWRpYW1ldHJpY3M6OnN0cmluZ3V0aWxzOjpzYW5pdGl6ZUxvZ1Nlc3Npb25JZChsb2dTZXNzaW9uSWQpOwogCisgICAgaW50IHJlc3VsdCA9IGFuZHJvaWQ6OnV0aWw6OnN0YXRzX3dyaXRlKGFuZHJvaWQ6OnV0aWw6Ok1FRElBTUVUUklDU19NRURJQVBBUlNFUl9SRVBPUlRFRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXBfbmFub3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFja2FnZV9uYW1lLmNfc3RyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFja2FnZV92ZXJzaW9uX2NvZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyTmFtZS5jX3N0cigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZWRCeU5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyUG9vbC5jX3N0cigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RFeGNlcHRpb24uY19zdHIoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZUJ5dGVDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdXJhdGlvbk1pbGxpcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja01pbWVUeXBlcy5jX3N0cigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrQ29kZWNzLmNfc3RyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWx0ZXJlZFBhcmFtZXRlcnMuY19zdHIoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlb1dpZHRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvSGVpZ2h0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZ1Nlc3Npb25JZC5jX3N0cigpKTsKKworICAgIHN0ZDo6c3RyaW5nc3RyZWFtIGxvZzsKKyAgICBsb2cgPDwgInJlc3VsdDoiIDw8IHJlc3VsdCA8PCAiIHsiCisgICAgICAg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dlcl9haWRsIiwKKyAgICBdLAorfQorCithaWRsX2ludGVyZmFjZSB7CisgICAgbmFtZTogInJlc291cmNlb2JzZXJ2ZXJfYWlkbF9pbnRlcmZhY2UiLAorICAgIGxvY2FsX2luY2x1ZGVfZGlyOiAiYWlkbCIsCisgICAgc3JjczogWworICAgICAgICAiOnJlc291cmNlb2JzZXJ2ZXJfYWlkbCIsCisgICAgXSwKKyAgICBiYWNrZW5kOiB7CisgICAgICAgIGphdmE6IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgICAgICBjcHA6IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IGZhbHNlLAorICAgICAgICB9LAorICAgICAgICBuZGs6IHsKKyAgICAgICAgICAgIGFwZXhfYXZhaWxhYmxlOiBbCisgICAgICAgICAgICAgICAgIi8vYXBleF9hdmFpbGFibGU6cGxhdGZvcm0iLAorICAgICAgICAgICAgICAgICJjb20uYW5kcm9pZC5tZWRpYSIsCisgICAgICAgICAgICAgICAgInRlc3RfY29tLmFuZHJvaWQubWVkaWEiLAorICAgICAgICAgICAgXSwKKyAgICAgICAgICAgIG1pbl9zZGtfdmVyc2lvbjogIjI5IiwKKyAgICAgICAgICAgIGVuYWJsZWQ6IHRydWUsCisgICAgICAgIH0sCisgICAgfSwKKyAgICB2ZXJzaW9uczogWyIxIl0sCit9CisKK2NjX2xpYnJhcnkgewogICAgIG5hbWU6ICJsaWJyZXNvdXJjZW1hbmFnZXJzZXJ2aWNlIiwKIAogICAgIHNyY3M6IFsKICAgICAgICAgIlJlc291cmNlTWFuYWdlclNlcnZpY2UuY3BwIiwKKyAgICAgICAgIlJlc291cmNlT2JzZXJ2ZXJTZXJ2aWNlLmNwcCIsCiAgICAgICAgICJTZXJ2aWNlTG9nLmNwcCIsCisKKyAgICAgICAgLy8gVE9ETzogY29udmVydCB0byBBSURMPworICAgICAgICAiSU1lZGlhUmVzb3VyY2VNb25pdG9yLmNwcCIsCiAgICAgX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dm9pZCBEZWF0aE5vdGlmaWVyOjpCaW5kZXJEaWVkQ2FsbGJhY2sodm9pZCogY29va2llKSB7Ci0gICAgYXV0byB0aGl6ID0gc3RhdGljX2Nhc3Q8RGVhdGhOb3RpZmllcio+KGNvb2tpZSk7Ci0gICAgdGhpei0+YmluZGVyRGllZCgpOworICAgIHNwPERlYXRoTm90aWZpZXI+IG5vdGlmaWVyOworICAgIHsKKyAgICAgICAgc3RkOjpzY29wZWRfbG9jayBsb2Nre1Jlc291cmNlTWFuYWdlclNlcnZpY2U6OnNDb29raWVMb2NrfTsKKyAgICAgICAgYXV0byBpdCA9IFJlc291cmNlTWFuYWdlclNlcnZpY2U6OnNDb29raWVUb0RlYXRoTm90aWZpZXJNYXAuZmluZCgKKyAgICAgICAgICAgICAgICByZWludGVycHJldF9jYXN0PHVpbnRwdHJfdD4oY29va2llKSk7CisgICAgICAgIGlmIChpdCA9PSBSZXNvdXJjZU1hbmFnZXJTZXJ2aWNlOjpzQ29va2llVG9EZWF0aE5vdGlmaWVyTWFwLmVuZCgpKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgbm90aWZpZXIgPSBpdC0+c2Vjb25kOworICAgIH0KKyAgICBpZiAobm90aWZpZXIuZ2V0KCkgIT0gbnVsbHB0cikgeworICAgICAgICBub3RpZmllci0+YmluZGVyRGllZCgpOworICAgIH0KIH0KIAogdm9pZCBEZWF0aE5vdGlmaWVyOjpiaW5kZXJEaWVkKCkgewpAQCAtNjAsOCArOTcsMjggQEAKIAogICAgIHNlcnZpY2UtPm92ZXJyaWRlUGlkKG1QaWQsIC0xKTsKICAgICAvLyB0aGl6IGlzIGZyZWVkIGluIHRoZSBjYWxsIGJlbG93LCBzbyBpdCBtdXN0IGJlIGxhc3QgY2FsbCByZWZlcnJpbmcgdGhpegotICAgIHNlcnZpY2UtPnJlbW92ZVJlc291cmNlKG1QaWQsIG1DbGllbnRJZCwgZmFsc2UpOworICAgIHNlcnZpY2UtP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ICAgICByZXNvdXJjZS52YWx1ZSAtPSByZXMudmFsdWU7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIG9uTGFzdFJlbW92ZWQocmVzLCBpbmZvKTsKKyAgICAgICAgICAgICAgICBhY3R1YWxSZW1vdmVkLnZhbHVlID0gcmVzb3VyY2UudmFsdWU7CiAgICAgICAgICAgICAgICAgaW5mby5yZXNvdXJjZXMuZXJhc2UocmVzVHlwZSk7CiAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIEFkZCBpdCB0byB0aGUgbGlzdCBvZiByZW1vdmVkIHJlc291cmNlcyBmb3Igb2JzZXJ2ZXJzLgorICAgICAgICAgICAgYXV0byBpdCA9IHJlc291cmNlUmVtb3ZlZC5maW5kKHJlc1R5cGUpOworICAgICAgICAgICAgaWYgKGl0ID09IHJlc291cmNlUmVtb3ZlZC5lbmQoKSkgeworICAgICAgICAgICAgICAgIHJlc291cmNlUmVtb3ZlZFtyZXNUeXBlXSA9IGFjdHVhbFJlbW92ZWQ7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1lcmdlUmVzb3VyY2VzKGl0LT5zZWNvbmQsIGFjdHVhbFJlbW92ZWQpOworICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQorICAgIGlmIChtT2JzZXJ2ZXJTZXJ2aWNlICE9IG51bGxwdHIgJiYgIXJlc291cmNlUmVtb3ZlZC5lbXB0eSgpKSB7CisgICAgICAgIG1PYnNlcnZlclNlcnZpY2UtPm9uUmVzb3VyY2VSZW1vdmVkKGluZm8udWlkLCBwaWQsIHJlc291cmNlUmVtb3ZlZCk7CisgICAgfQogICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CiB9CiAKIFN0YXR1cyBSZXNvdXJjZU1hbmFnZXJTZXJ2aWNlOjpyZW1vdmVDbGllbnQoaW50MzJfdCBwaWQsIGludDY0X3QgY2xpZW50SWQpIHsKLSAgICByZW1vdmVSZXNvdXJjZShwaW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VudExvY2s7CisvL3N0YXRpYworc3RkOjptYXA8dWludHB0cl90LCBzdGQ6OnNoYXJlZF9wdHI8UmVzb3VyY2VPYnNlcnZlclNlcnZpY2U6OkRlYXRoUmVjaXBpZW50PiA+CitSZXNvdXJjZU9ic2VydmVyU2VydmljZTo6c0RlYXRoUmVjaXBpZW50TWFwOworCitzdHJ1Y3QgUmVzb3VyY2VPYnNlcnZlclNlcnZpY2U6OkRlYXRoUmVjaXBpZW50IHsKKyAgICBEZWF0aFJlY2lwaWVudChSZXNvdXJjZU9ic2VydmVyU2VydmljZSogX3NlcnZpY2UsCisgICAgICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8SVJlc291cmNlT2JzZXJ2ZXI+JiBfb2JzZXJ2ZXIpCisgICAgICAgIDogc2VydmljZShfc2VydmljZSksIG9ic2VydmVyKF9vYnNlcnZlcikge30KKyAgICB+RGVhdGhSZWNpcGllbnQoKSB7fQorCisgICAgdm9pZCBiaW5kZXJEaWVkKCkgeworICAgICAgICBpZiAoc2VydmljZSAhPSBudWxscHRyKSB7CisgICAgICAgICAgICBzZXJ2aWNlLT51bnJlZ2lzdGVyT2JzZXJ2ZXIob2JzZXJ2ZXIpOworICAgICAgICB9CisgICAgfQorCisgICAgUmVzb3VyY2VPYnNlcnZlclNlcnZpY2UqIHNlcnZpY2U7CisgICAgc3RkOjpzaGFyZWRfcHRyPElSZXNvdXJjZU9ic2VydmVyPiBvYnNlcnZlcjsKK307CisKKy8vIHN0YXRpYwordm9pZCBSZXNvdXJjZU9ic2VydmVyU2VydmljZTo6QmluZGVyRGllZENhbGxiYWNrKHZvaWQqIGNvb2tpZSkgeworICAgIHVpbnRwdHJfdCBpZCA9IHJlaW50ZXJwcmV0X2Nhc3Q8dWludHB0cl90Pihjb29raWUpOworCisgICAgQUxPR1coIk9ic2VydmVyICVsbGQgaXMgZGVhZCIsIChsb25nIGxvbmcpaWQpOworCisgICAgc3RkOjpzaGFyZWRfcHRyPERlYXRoUmVja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2ZXIgOiBtT2JzZXJ2ZXJJbmZvTWFwKSB7CisgICAgICAgICAgICByZXN1bHQuYXBwZW5kRm9ybWF0KCIgICAgT2JzZXJ2ZXIgJXA6XG4iLCBvYnNlcnZlci5zZWNvbmQuYmluZGVyLmdldCgpKTsKKyAgICAgICAgICAgIGZvciAoYXV0byAmb2JzZXJ2YWJsZSA6IG9ic2VydmVyLnNlY29uZC5maWx0ZXJzKSB7CisgICAgICAgICAgICAgICAgU3RyaW5nOCBlbmFibGVkRXZlbnRzU3RyOworICAgICAgICAgICAgICAgIGZvciAoYXV0byAmZXZlbnQgOiBzRXZlbnRzKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgoKHVpbnQ2NF90KW9ic2VydmFibGUuZXZlbnRGaWx0ZXIgJiAodWludDY0X3QpZXZlbnQpICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZW5hYmxlZEV2ZW50c1N0ci5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmFibGVkRXZlbnRzU3RyLmFwcGVuZCgifCIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZW5hYmxlZEV2ZW50c1N0ci5hcHBlbmQodG9TdHJpbmcoZXZlbnQpLmNfc3RyKCkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJlc3VsdC5hcHBlbmRGb3JtYXQoIiAgICAgICVzOiAlc1xuIiwKKyAgICAgICAgICAgICAgICAgICAgICAgIHRvU3RyaW5nKG9ic2VydmFibGUudHlwZSkuY19zdHIoKSwgZW5hYmxlZEV2ZW50c1N0ci5jX3N0cigpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHdyaXRlKGZkLCByZXN1bHQuc3RyaW5nKCksIHJlc3VsdC5zaXplKCkpOworICAgIHJldHVybiBPSzsKK30KKworU3RhdHVzIFJ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KyAgICAgICAgICAgICAgICAiY2FuJ3QgdW5yZWdpc3Rlck9ic2VydmVyIGZyb20gcGlkPSVkLCB1aWQ9JWRcbiIsCisgICAgICAgICAgICAgICAgQUlCaW5kZXJfZ2V0Q2FsbGluZ1BpZCgpLAorICAgICAgICAgICAgICAgIEFJQmluZGVyX2dldENhbGxpbmdVaWQoKSk7CisgICAgICAgIHJldHVybiBTdGF0dXM6OmZyb21TZXJ2aWNlU3BlY2lmaWNFcnJvcihQRVJNSVNTSU9OX0RFTklFRCk7CisgICAgfQorCisgICAgaWYgKGluX29ic2VydmVyID09IG51bGxwdHIpIHsKKyAgICAgICAgcmV0dXJuIFN0YXR1czo6ZnJvbVNlcnZpY2VTcGVjaWZpY0Vycm9yKEJBRF9WQUxVRSk7CisgICAgfQorCisgICAgOjpuZGs6OlNwQUlCaW5kZXIgYmluZGVyID0gaW5fb2JzZXJ2ZXItPmFzQmluZGVyKCk7CisKKyAgICB7CisgICAgICAgIHN0ZDo6c2NvcGVkX2xvY2sgbG9ja3ttT2JzZXJ2ZXJMb2NrfTsKKworICAgICAgICBhdXRvIGl0ID0gbU9ic2VydmVySW5mb01hcC5maW5kKCh1aW50cHRyX3QpYmluZGVyLmdldCgpKTsKKyAgICAgICAgaWYgKGl0ID09IG1PYnNlcnZlckluZm9NYXAuZW5kKCkpIHsKKyAgICAgICAgICAgIHJldHVybiBTdGF0dXM6OmZyb21TZXJ2aWNlU3BlY2lmaWNFcnJvcihOQU1FX05PVF9GT1VORCk7CisgICAgICAgIH0KKworICAgICAgICAvLyBSZW1vdmUgb2JzZXJ2ZXIgZnJvbSBvYnNlcnZhYmxlLT5zdWJzY3JpYmVycyBtYXAuCisgICAgICAgIGZvciAoYXV0byAmZmlsdGVyIDogaXQtPnNlY29uZC5maWx0ZXJzKSB7CisgICAgICAgICAgICBmb3IgKGF1dG8gJmV2ZW50IDogc0V2ZW50cykgeworICAgICAgICAgICAgICAgIGlmICghKCh1aW50NjRfdClmaWx0ZXIuZXZlbnRGaWx0ZXIgJiAodWludDY0X3QpZXZlbnQpKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBNZWRpYU9ic2VydmFibGVGaWx0ZXIga2V5e2ZpbHRlci50eXBlLCBldmVudH07CisgICAgICAgICAgICAgICAgbU9ic2VydmFibGVUb1N1YnNjcmliZXJzTWFwW2tleV0uZXJhc2UoKHVpbnRwdHJfdCliaW5kZXIuZ2V0KCkpOworCisgICAgICAgICAgICAgICAgLy9SZW1vdmUgdGhlIGVudHJ5IGlmIHRoZXJlJ3Mgbm8gbW9yZSBzdWJzY3JpYmVycy4KKyAgICAgICAgICAgICAgICBpZiAobU9ic2VydmFibGVUb1N1YnNjcmliZXJzTWFwW2tleV0uZW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICBtT2JzZXJ2YWJsZVRvU3Vic2NyaWJlcnNNYXAuZXJhc2Uoa2V5KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBSZW1vdmUgb2JzZXJ2ZXIgaW5mby4KKyAgICAgICAgbU9ic2VydmVySW5mb01hcC5lcmFzZShpdCk7CisgICAgfQorCisgICAgLy8gVW5saW5rIGFuZCByZW1vdmUgZGVhdGggYmluZGVyLgorICAgIHVpbnRwdHJfdCBjb29raWUgPSAodWludHB0cl90KWJpbmRlci5nZXQoKTsKKyAgICBBSUJpbmRlcl91bmxpbmtUb0RlYXRoKGJpbmRlci5nZXQoKSwgbURlYXRoUmVjaXBpZW50LmdldCgpLAorICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDx2b2lkKj4oY29va2llKSk7CisKKyAgICB7CisgICAgICAgIHN0ZDo6c2NvcGVkX2xvY2sgbG9ja3tzRGVhdGhSZWNpcGllbnRMb2NrfTsKKyAgICAgICAgc0RlYXRoUmVjaXBpZW50TWFwLmVyYXNlKGNvb2tpZSk7CisgICAgfQ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E1lZGlhT2JzZXJ2YWJsZUZpbHRlciBrZXl7b2JzZXJ2YWJsZVR5cGUsIGV2ZW50fTsKKyAgICAgICAgICAgIC8vIFNraXAgaWYgbm8gb25lIHN1YnNjcmliZWQgdG8gdGhpcyBvYnNlcnZhYmxlLgorICAgICAgICAgICAgYXV0byBvYnNlcnZhYmxlSXQgPSBtT2JzZXJ2YWJsZVRvU3Vic2NyaWJlcnNNYXAuZmluZChrZXkpOworICAgICAgICAgICAgaWYgKG9ic2VydmFibGVJdCA9PSBtT2JzZXJ2YWJsZVRvU3Vic2NyaWJlcnNNYXAuZW5kKCkpIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIExvb3AgdGhyb3VnaCBhbGwgc3Vic3JpYmVycy4KKyAgICAgICAgICAgIGZvciAoYXV0byAmc3Vic2NyaWJlciA6IG9ic2VydmFibGVJdC0+c2Vjb25kKSB7CisgICAgICAgICAgICAgICAgYXV0byBjYWxsZWVJdCA9IGNhbGxlZUxpc3QuZmluZChzdWJzY3JpYmVyLmZpcnN0KTsKKyAgICAgICAgICAgICAgICBpZiAoY2FsbGVlSXQgPT0gY2FsbGVlTGlzdC5lbmQoKSkgeworICAgICAgICAgICAgICAgICAgICBjYWxsZWVMaXN0LmVtcGxhY2Uoc3Vic2NyaWJlci5maXJzdCwgQ2FsbGVlSW5mb3sKKyAgICAgICAgICAgICAgICAgICAgICAgIHN1YnNjcmliZXIuc2Vjb25kLCB7e29ic2VydmFibGVUeXBlLCByZXMuc2Vjb25kLnZhbHVlfX19KTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBjYWxsZWVJdC0+c2Vjb25kLm1vbml0b3JzLnB1c2hfYmFjayh7b2JzZXJ2YWJsZVR5cGUsIHJlcy5zZWNvbmQudmFsdWV9KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9C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ICAgICAgICAgdGhlIG92ZXJyaWRlcy4KKyAgICAgKiBAcGFyYW0gcGlkIHBpZCBvZiB0aGUgY2FsbGluZyBwcm9jZXNzLgorICAgICAqIEBwYXJhbSBwcm9jU3RhdGUgdGhlIHByb2Nlc3Mgc3RhdGUgdmFsdWUgdGhhdCBSZXNvdXJjZU1hbmFnZXJTZXJ2aWNlIHNob3VsZAorICAgICAqICAgICAgICAgICAgICAgICAgdXNlIGZvciB0aGlzIHBpZC4KKyAgICAgKiBAcGFyYW0gb29tU2NvcmUgdGhlIG9vbSBzY29yZSB2YWx1ZSB0aGF0IFJlc291cmNlTWFuYWdlclNlcnZpY2Ugc2hvdWxkCisgICAgICogICAgICAgICAgICAgICAgICB1c2UgZm9yIHRoaXMgcGlkLgorICAgICAqLworICAgIHZvaWQgb3ZlcnJpZGVQcm9jZXNzSW5mbygKKyAgICAgICAgICAgIElSZXNvdXJjZU1hbmFnZXJDbGllbnQgY2xpZW50LAorICAgICAgICAgICAgaW50IHBpZCwKKyAgICAgICAgICAgIGludCBwcm9jU3RhdGUsCisgICAgICAgICAgICBpbnQgb29tU2NvcmUpOworCisgICAgLyoqCisgICAgICogTWFyayBhIGNsaWVudCBmb3IgcGVuZGluZyByZW1vdmFsCisgICAgICoKKyAgICAgKiBAcGFyYW0gcGlkIHBpZCBmcm9tIHdoaWNoIHRoZSBjbGllbnQncyByZXNvdXJjZXMgd2lsbCBiZSByZW1vdmVkLgorICAgICAqIEBwYXJhbSBjbGllbnRJZCBjbGllbnRJZCB3aXRoaW4gdGhlIHBpZCB0aGF0IHdpbGwgYmUgcmVtb3ZlZC4KKyAgICAgKi8KKyAgICB2b2lkIG1hcmtDbGllbnRGb3JQZW5kaW5nUmVtb3ZhbChpbnQgcGlkLCBsb25nIGNsaWVudElkKTsKKworICAgIC8qKgorICAgICAqIFJlY2xhaW0gcmVzb3VyY2VzIGZyb20gY2xpZW50cyBwZW5kaW5nIHJlbW92YWwsIGlmIGFueS4KKyAgICAgKgorICA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ICAgICBDUFVTRVRfRU5BQkxFID0gMywKKyAgICAgICAgQ1BVU0VUX0RJU0FCTEUgPSA0LAorICAgIH07CisKKyAgICBzdHJ1Y3QgRXZlbnRFbnRyeSB7CisgICAgICAgIEV2ZW50VHlwZSB0eXBlOworICAgICAgICBpbnQgYXJnOworICAgIH07CisKKyAgICB2aXJ0dWFsIHZvaWQgbm90ZVN0YXJ0VmlkZW8oaW50IHVpZCkgb3ZlcnJpZGUgeworICAgICAgICBtTGFzdEV2ZW50ID0ge0V2ZW50VHlwZTo6VklERU9fT04sIHVpZH07CisgICAgICAgICsrbUV2ZW50Q291bnQ7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkIG5vdGVTdG9wVmlkZW8oaW50IHVpZCkgb3ZlcnJpZGUgeworICAgICAgICBtTGFzdEV2ZW50ID0ge0V2ZW50VHlwZTo6VklERU9fT0ZGLCB1aWR9OworICAgICAgICArK21FdmVudENvdW50OworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCBub3RlUmVzZXRWaWRlbygpIG92ZXJyaWRlIHsKKyAgICAgICAgbUxhc3RFdmVudCA9IHtFdmVudFR5cGU6OlZJREVPX1JFU0VULCAwfTsKKyAgICAgICAgKyttRXZlbnRDb3VudDsKKyAgICB9CisKKyAgICB2aXJ0dWFsIGJvb2wgcmVxdWVzdENwdXNldEJvb3N0KGJvb2wgZW5hYmxlKSBvdmVycmlkZSB7CisgICAgICAgIG1MYXN0RXZlbnQgPSB7ZW5hYmxlID8gRXZlbnRUeXBlOjpDUFVTRVRfRU5BQkxFIDogRXZlbnRUeXBlOjpDUFVTRVRfRElTQUJMRSwgMH07CisgICAgICAgICsrbUV2ZW50Q291bnQ7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHNpemVfdCBldmVudENvdW50KCkgeyByZXR1cm4gbUV2ZW50Q291bnQ7IH0KKyAgICBFdmVudFR5cGUgbGFzdEV2ZW50VHlwZSgpIHsgcmV0dXJuIG1MYXN0RXZlbnQudHlwZTsgfQorICAgIEV2ZW50RW50cnkgbGFzdEV2ZW50KCkgeyByZXR1cm4gbUxhc3RFdmVudDsgfQorCisgICBwcm90ZWN0ZWQ6CisgICAgdmlydHVhbCB+VGVzdFN5c3RlbUNhbGxiYWNrKCkge30KKworICAgcHJpdmF0ZToKKyAgICBFdmVudEVudHJ5IG1MYXN0RXZlbnQ7CisgICAgc2l6ZV90IG1FdmVudENvdW50OworCisgICAgRElTQUxMT1dfRVZJTF9DT05TVFJVQ1RPUlMoVGVzdFN5c3RlbUNhbGxiYWNrKTsKK307CisKK3N0cnVjdCBUZXN0Q2xpZW50IDogcHVibGljIEJuUmVzb3VyY2VNYW5hZ2VyQ2xpZW50IHsKKyAgICBUZXN0Q2xpZW50KGludCBwaWQsIGNvbnN0IHNoYXJlZF9wdHI8UmVzb3VyY2VNYW5hZ2VyU2VydmljZT4mIHNlcnZpY2UpCisgICAgICAgIDogbVJlY2xhaW1lZChmYWxzZSksIG1QaWQocGlkKSwgbVNlcnZpY2Uoc2VydmljZSkge30KKworICAgIFN0YXR1cyByZWNsYWltUmVzb3VyY2UoYm9vbCogYWlkbFJldHVybikgb3ZlcnJpZGUgeworICAgICAgICBtU2VydmljZS0+cmVtb3ZlQ2xpZW50KG1QaWQsIGdldElkKHJlZjxUZXN0Q2xpZW50PigpKSk7CisgICAgICAgIG1SZWNsYWltZWQgPSB0cnVlOworICAgICAgICAqYWlkbFJldHVybiA9IHRydWU7CisgICAgICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CisgICAgfQorCisgICAgU3RhdHVzIGdldE5hbWUoc3RyaW5nKiBhaWRsUmV0dXJuKSBvdmVycmlkZSB7CisgICAgICAgICphaWRsUmV0dXJuID0gInRlc3RfY2xpZW50IjsKKyAgICAgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKKyAgICB9CisKKyAgICB2aXJ0dWFsIH5UZXN0Q2xpZW50KCkge30KKworICAgcHJpdmF0ZToKKyAgICBib29sIG1SZWNsYWltZWQ7CisgICAgaW50IG1QaWQ7CisgICAgc2hhcmVkX3B0cjxSZXNvdXJjZU1hbmFnZXJTZXJ2aWNlPiBtU2VydmljZTsKKyAgICBESVNBTExPV19FVklMX0NPTlNUUlVDVE9SUyhUZXN0Q2xpZW50KTsKK307CisKK2NsYXNzIFJlc291cmNlTWFuYWdlclNlcnZpY2VGdXp6ZXIgeworICAgcHVibGljOgorICAgIFJlc291cmNlTWFuYWdlclNlcnZpY2VGdXp6ZXIoKSA9IGRlZmF1bHQ7CisgICAgflJlc291cmNlTWFuYWdlclNlcnZpY2VGdXp6ZXIoKSB7CisgICAgICAgIG1TZXJ2aWNlID0gbnVsbHB0cjsKKyAgICAgICAgZGVsZXRlIG1GdXp6ZWREYXRhUHJvdmlkZXI7CisgICAgfQorICAgIHZvaWQgcHJvY2Vzcyhjb25zdCB1aW50OF90KiBkYXRhLCBzaXplX3Qgc2l6ZSk7CisKKyAgIHByaXZhdGU6CisgICAgdm9pZCBzZXRDb25maWcoKTsKKyAgICB2b2lkIHNldFJlc291cmNlcygpOworICAgIHZvaWQgc2V0U2VydmljZUxvZygpOworCisgICAgc3RhdGljIHZvaWQqIGFkZFJlc291cmNlKHZvaWQqIGFyZykgeworICAgICAgICByZXNvdXJjZVRocmVhZEFyZ3MqIHRBcmdzID0gKHJlc291cmNlVGhyZWFkQXJncyopYXJnOworICAgICAgICBpZiAodEFyZ3MpIHsKKyAgICAgICAgICAgICh0QXJncy0+c2VydmljZSkKKyAgICAgICAgICAgICAgICAtPmFkZFJlc291cmNlKHRBcmdzLT5waWQsIHRBcmdzLT51aWQsIHRBcmdzLT50ZXN0Q2xpZW50SWQsIHRBcmdzLT50ZXN0Q2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdEFyZ3MtPm1lZGlhUmVzb3VyY2UpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxscHRyOworICAgIH0KKworICAgIHN0YXRpYyB2b2lkKiByZW1vdmVSZXNvdXJjZSh2b2l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ICAgICAgIHRocmVhZEFyZ3Muc2VydmljZSA9IG1TZXJ2aWNlOworICAgICAgICBzaGFyZWRfcHRyPElSZXNvdXJjZU1hbmFnZXJDbGllbnQ+IHRlc3RDbGllbnQgPQorICAgICAgICAgICAgOjpuZGs6OlNoYXJlZFJlZkJhc2U6Om1ha2U8VGVzdENsaWVudD4odGhyZWFkQXJncy5waWQsIG1TZXJ2aWNlKTsKKyAgICAgICAgdGhyZWFkQXJncy50ZXN0Q2xpZW50ID0gdGVzdENsaWVudDsKKyAgICAgICAgdGhyZWFkQXJncy50ZXN0Q2xpZW50SWQgPSBnZXRJZCh0ZXN0Q2xpZW50KTsKKyAgICAgICAgbWVkaWFSZXNvdXJjZS5wdXNoX2JhY2soTWVkaWFSZXNvdXJjZShzdGF0aWNfY2FzdDxNZWRSZXNUeXBlPihtZWRpYVJlc291cmNlVHlwZSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8TWVkUmVzU3ViVHlwZT4obWVkaWFSZXNvdXJjZVN1YlR5cGUpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhUmVzb3VyY2VWYWx1ZSkpOworICAgICAgICB0aHJlYWRBcmdzLm1lZGlhUmVzb3VyY2UgPSBtZWRpYVJlc291cmNlOworICAgICAgICBwdGhyZWFkX2NyZWF0ZSgmcHRbaV0sIG51bGxwdHIsIGFkZFJlc291cmNlLCAmdGhyZWFkQXJncyk7CisgICAgICAgIHB0aHJlYWRfY3JlYXRlKCZwdFtpICsgMV0sIG51bGxwdHIsIHJlbW92ZVJlc291cmNlLCAmdGhyZWFkQXJncyk7CisgICAgICAgIG1lZGlhUmVzb3VyY2UuY2xlYXIoKTsKKyAgICB9CisKKyAgICBmb3IgKGkgPSAwOyBpIDwgbnVtVGhyZWFkczsgKytpKSB7CisgICAgICAgIHB0aHJlYWRfam9pbihwdFtpXSwgbnVsbHB0cik7Cis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NsYWltUmVzb3VyY2UocGlkWmVybywgbWVkaWFSZXNvdXJjZSwgJnJlc3VsdCk7CisgICAgbVNlcnZpY2UtPnJlbW92ZVJlc291cmNlKHBpZFplcm8sIGdldElkKHRlc3RDbGllbnQpLCBtZWRpYVJlc291cmNlKTsKKyAgICBtU2VydmljZS0+cmVtb3ZlQ2xpZW50KHBpZFplcm8sIGdldElkKHRlc3RDbGllbnQpKTsKKyAgICBtZWRpYVJlc291cmNlLmNsZWFyKCk7Cit9CisKK3ZvaWQgUmVzb3VyY2VNYW5hZ2VyU2VydmljZUZ1enplcjo6c2V0U2VydmljZUxvZygpIHsKKyAgICBzaXplX3QgbWF4TnVtID0KKyAgICAgICAgbUZ1enplZERhdGFQcm92aWRlci0+Q29uc3VtZUludGVncmFsSW5SYW5nZTxpbnQzMl90PihrTWluU2VydmljZUxvZywga01heFNlcnZpY2VMb2cpOworICAgIHNwPFNlcnZpY2VMb2c+IHNlcnZpY2VMb2cgPSBuZXcgU2VydmljZUxvZyhtYXhOdW0pOworICAgIGlmIChzZXJ2aWNlTG9nKSB7CisgICAgICAgIHNlcnZpY2VMb2ctPmFkZChTdHJpbmc4KCJsb2ciKSk7CisgICAgICAgIHNlcnZpY2VMb2ctPnRvU3RyaW5nKCk7CisgICAgfQorfQorCitleHRlcm4gIkMiIGludCBMTFZNRnV6emVyVGVzdE9uZUlucHV0KGNvbnN0IHVpbnQ4X3QqIGRhdGEsIHNpemVfdCBzaXplKSB7CisgICAgaWYgKHNpemUgPCAxKSB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKyAgICBSZXNvdXJjZU1hbmFnZXJTZXJ2aWNlRnV6emVyKiBybUZ1enplciA9IG5ldyBSZXNvdXJjZU1hbmFnZXJTZXJ2aWNlRnV6emVyKCk7CisgICAgaWYgKCFybUZ1enplcikgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisgICAgcm1GdXp6ZXItPnByb2Nlc3MoZGF0YSwgc2l6ZSk7CisgICAgZGVsZXR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ogWyJsaWJyZXNvdXJjZW1hbmFnZXJzZXJ2aWNlIl0sCiAgICAgc2hhcmVkX2xpYnM6IFsKICAgICAgICAgImxpYmJpbmRlciIsCiAgICAgICAgICJsaWJiaW5kZXJfbmRrIiwKICAgICAgICAgImxpYmxvZyIsCiAgICAgICAgICJsaWJtZWRpYSIsCi0gICAgICAgICJsaWJyZXNvdXJjZW1hbmFnZXJzZXJ2aWNlIiwKICAgICAgICAgImxpYnV0aWxzIiwKICAgICBdLAogICAgIGluY2x1ZGVfZGlyczogWwpAQCAtMTksMTcgKzI4LDE2IEBACiAgICAgICAgICItV2Vycm9yIiwKICAgICAgICAgIi1XYWxsIiwKICAgICBdLAotICAgIGNvbXBpbGVfbXVsdGlsaWI6ICIzMiIsCiB9CiAKIGNjX3Rlc3QgewogICAgIG5hbWU6ICJTZXJ2aWNlTG9nX3Rlc3QiLAogICAgIHNyY3M6IFsiU2VydmljZUxvZ190ZXN0LmNwcCJdLAogICAgIHRlc3Rfc3VpdGVzOiBbImRldmljZS10ZXN0cyJdLAorICAgIHN0YXRpY19saWJzOiBbImxpYnJlc291cmNlbWFuYWdlcnNlcnZpY2UiXSwKICAgICBzaGFyZWRfbGliczogWwogICAgICAgICAibGlibG9nIiwKICAgICAgICAgImxpYm1lZGlhIiwKLSAgICAgICAgImxpYnJlc291cmNlbWFuYWdlcnNlcnZpY2UiLAogICAgICAgICAibGlidXRpbHMiLAogICAgIF0sCiAgICAgaW5jbHVkZV9kaXJzOiBbCkBAIC00MCw1ICs0OCwyOSBAQAogICAgICAgICAiLVdlcnJvciIsCiAgICAgICAgICItV2FsbCIsCiAgICAgXSwKLSAgICBjb21waWxlX211bHRpbGliOiAiMzIiLAorfQorCitjY190ZXN0IHsKKyAgICBuYW1lOiAiUmVzb3VyY2VPYnNlcnZlclNlcnZpY2VfdGVzdCIsCisgICAgc3JjczogWyJSZXNvdXJjZU9ic2VydmVyU2VydmljZV90ZXN0LmNwcCJdLAorICAgIHRlc3Rfc3VpdG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0dWFsIGJvb2wgaXNWYWxpZFBpZChpbnQgLyogcGlkICovKSB7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHZpcnR1YWwgYm9vbCBvdmVycmlkZVByb2Nlc3NJbmZvKAorICAgICAgICAgICAgaW50IC8qIHBpZCAqLywgaW50IC8qIHByb2NTdGF0ZSAqLywgaW50IC8qIG9vbVNjb3JlICovKSB7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCByZW1vdmVQcm9jZXNzSW5mb092ZXJyaWRlKGludCAvKiBwaWQgKi8pIHsKKyAgICB9CisKK3ByaXZhdGU6CisgICAgRElTQUxMT1dfRVZJTF9DT05TVFJVQ1RPUlMoVGVzdFByb2Nlc3NJbmZvKTsKK307CisKK3N0cnVjdCBUZXN0U3lzdGVtQ2FsbGJhY2sgOgorICAgICAgICBwdWJsaWMgUmVzb3VyY2VNYW5hZ2VyU2VydmljZTo6U3lzdGVtQ2FsbGJhY2tJbnRlcmZhY2UgeworICAgIFRlc3RTeXN0ZW1DYWxsYmFjaygpIDoKKyAgICAgICAgbUxhc3RFdmVudCh7RXZlbnRUeXBlOjpJTlZBTElELCAwfSksIG1FdmVudENvdW50KDApIHt9CisKKyAgICBlbnVtIEV2ZW50VHlwZSB7CisgICAgICAgIElOVkFMSUQgICAgICAgICAgPSAtMSwKKyAgICAgICAgVklERU9fT04gICAgICAgICA9IDAsCisgICAgICAgIFZJREVPX09GRiAgICAgICAgPSAxLAorICAgICAgICBWSURFT19SRVNFVCAgICAgID0gMiwKKyAgICAgICAgQ1BVU0VUX0VOQUJMRSAgICA9IDMsCisgICAgICAgIENQVVNFVF9ESVNBQkxFICAgPSA0LAorICAgIH07CisKKyAgICBzdHJ1Y3QgRXZlbnRFbnRyeSB7CisgICAgICAgIEV2ZW50VHlwZSB0eXBlOworICAgICAgICBpbnQgYXJnOworICAgIH07CisKKyAgICB2aXJ0dWFsIHZvaWQgbm90ZVN0YXJ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SZXNvdXJjZXMoY29uc3Qgc3RkOjp2ZWN0b3I8TWVkaWFSZXNvdXJjZVBhcmNlbD4gJnJlc291cmNlczEsCisgICAgICAgICAgICBjb25zdCBSZXNvdXJjZUxpc3QgJnJlc291cmNlczIpIHsKKyAgICAgICAgLy8gY29udmVydCByZXNvdXJjZTEgdG8gUmVzb3VyY2VMaXN0CisgICAgICAgIFJlc291cmNlTGlzdCByMTsKKyAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCByZXNvdXJjZXMxLnNpemUoKTsgKytpKSB7CisgICAgICAgICAgICBjb25zdCBhdXRvICZyZXMgPSByZXNvdXJjZXMxW2ldOworICAgICAgICAgICAgY29uc3QgYXV0byByZXNUeXBlID0gc3RkOjp0dXBsZShyZXMudHlwZSwgcmVzLnN1YlR5cGUsIHJlcy5pZCk7CisgICAgICAgICAgICByMVtyZXNUeXBlXSA9IHJlczsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcjEgPT0gcmVzb3VyY2VzMjsKKyAgICB9CisKKyAgICBzdGF0aWMgdm9pZCBleHBlY3RFcVJlc291cmNlSW5mbyhjb25zdCBSZXNvdXJjZUluZm8gJmluZm8sCisgICAgICAgICAgICBpbnQgdWlkLAorICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPElSZXNvdXJjZU1hbmFnZXJDbGllbnQ+IGNsaWVudCwKKyAgICAgICAgICAgIGNvbnN0IHN0ZDo6dmVjdG9yPE1lZGlhUmVzb3VyY2VQYXJjZWw+ICZyZXNvdXJjZXMpIHsKKyAgICAgICAgRVhQRUNUX0VRKHVpZCwgaW5mby51aWQpOworICAgICAgICBFWFBFQ1RfRVEoY2xpZW50LCBpbmZvLmNsaWVudCk7CisgICAgICAgIEVYUEVDVF9UUlVFKGlzRXF1YWxSZXNvdXJjZXMocmVzb3VyY2VzLCBpbmZvLnJlc291cmNlcykpOworICAgIH0KK307CisKK30gLy8gbmFtZXNwYWNlIGFuZHJvaWQKZGlmZiAtLWdpdC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9pZDo6bWVkaWE6OnRvU3RyaW5nKG9ic2VydmFibGUudHlwZSkKKyAgICAgICAgKyAiLCAiICsgc3RkOjp0b19zdHJpbmcob2JzZXJ2YWJsZS52YWx1ZSkgKyAifSI7CisgICAgfQorICAgIHN0YXRpYyBzdGQ6OnN0cmluZyB0b1N0cmluZyhjb25zdCBFdmVudCYgZXZlbnQpIHsKKyAgICAgICAgc3RkOjpzdHJpbmcgZXZlbnRTdHI7CisgICAgICAgIHN3aXRjaCAoZXZlbnQudHlwZSkgeworICAgICAgICBjYXNlIEV2ZW50OjpCdXN5OgorICAgICAgICAgICAgZXZlbnRTdHIgPSAiQnVzeSI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBFdmVudDo6SWRsZToKKyAgICAgICAgICAgIGV2ZW50U3RyID0gIklkbGUiOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICByZXR1cm4gIk5vRXZlbnQiOworICAgICAgICB9CisgICAgICAgIHN0ZDo6c3RyaW5nIG9ic2VydmFibGVTdHI7CisgICAgICAgIGZvciAoYXV0byAmb2JzZXJ2YWJsZSA6IGV2ZW50Lm9ic2VydmFibGVzKSB7CisgICAgICAgICAgICBpZiAoIW9ic2VydmFibGVTdHIuZW1wdHkoKSkgeworICAgICAgICAgICAgICAgIG9ic2VydmFibGVTdHIgKz0gIiwgIjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG9ic2VydmFibGVTdHIgKz0gdG9TdHJpbmcob2JzZXJ2YWJsZSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuICJ7IiArIGV2ZW50U3RyICsgIiwgIiArIHN0ZDo6dG9fc3RyaW5nKGV2ZW50LnVpZCkgKyAiLCAiCisgICAgICAgICAgICAgICAgKyBzdGQ6OnRvX3N0cmluZyhldmVudC5waWQpICsgIiwgeyIgKyBvYnNlcnZhYmxlU3RyICsgIn19IjsKKyAgICB9CisKKyAgICBzdGF0aWMgRXZlbnQgQnVzeShpbnQgdWlkLCBpbnQgcGlkLCBjb25zdCBzdGQ6OnZlY3RvcjxNZWRpYU9ic2VydmFibGVQYXJjZWw+JiBvYnNlcnZhYmxlcykgeworICAgICAgICByZXR1cm4geyBFdmVudDo6QnVzeSwgdWlkLCBwaWQsIG9ic2VydmFibGVzIH07CisgICAgfQorICAgIHN0YXRpYyBFdmVudCBJZGxlKGludCB1aWQsIGludCBwaWQsIGNvbnN0IHN0ZDo6dmVjdG9yPE1lZGlhT2JzZXJ2YWJsZVBhcmNlbD4mIG9ic2VydmFibGVzKSB7CisgICAgICAgIHJldHVybiB7IEV2ZW50OjpJZGxlLCB1aWQsIHBpZCwgb2JzZXJ2YWJsZXMgfTsKKyAgICB9CisKKyAgICAvLyBQb3AgMSBldmVudCBmcm9tIGZyb250LCB3YWl0IGZvciB1cCB0byB0aW1lb3V0VXMgaWYgZW1wdHkuCisgICAgY29uc3QgRXZlbnQmIHBvcChpbnQ2NF90IHRpbWVvdXRVcyA9IDApIHsKKyAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1Mb2NrKTsKKworICAgICAgICBpZiAobUV2ZW50UXVldWUuZW1wdHkoKSAmJiB0aW1lb3V0VXMgPiAwKSB7CisgICAgICAgICAgICBtQ29uZGl0aW9uLndhaXRfZm9yKGxvY2ssIHN0ZDo6Y2hyb25vOjptaWNyb3NlY29uZHModGltZW91dFVzKSk7CisgICAgICAgIH0KKworICAgICAgICBpZiAobUV2ZW50UXVldWUuZW1wdHkoKSkgeworICAgICAgICAgICAgbVBvcHBlZEV2ZW50ID0gTm9FdmVudDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1Qb3BwZWRFdmVudCA9ICptRXZlbnRRdWV1ZS5iZWdpbigpOworICAgICAgICAgICAgbUV2ZW50UXVldWUucG9wX2Zyb250KCk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbVBvcHBlZEV2ZW50OworICAgIH0KKworICAgIC8v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worICAgIG5hbWU6ICJmcmFtZXdvcmtzX2F2X3NlcnZpY2VzX21lZGlhdHJhbnNjb2RpbmdfbGljZW5zZSIsCisgICAgdmlzaWJpbGl0eTogWyI6X19zdWJwYWNrYWdlc19fIl0sCisgICAgbGljZW5zZV9raW5kczogWworICAgICAgICAiU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMCIsCisgICAgXSwKKyAgICBsaWNlbnNlX3RleHQ6IFsKKyAgICAgICAgIk5PVElDRSIsCisgICAgXSwKK30KKworY2NfbGlicmFyeSB7CiAgICAgbmFtZTogImxpYm1lZGlhdHJhbnNjb2RpbmdzZXJ2aWNlIiwKIAotICAgIHNyY3M6IFsiTWVkaWFUcmFuc2NvZGluZ1NlcnZpY2UuY3BwIl0sCisgICAgc3JjczogWworICAgICAgICAiTWVkaWFUcmFuc2NvZGluZ1NlcnZpY2UuY3BwIiwKKyAgICAgICAgIlNpbXVsYXRlZFRyYW5zY29kZXIuY3BwIiwKKyAgICBdLAorCisgICAgbWluX3Nka192ZXJzaW9uOiAiMjkiLAorICAgIGFwZXhfYXZhaWxhYmxlOiBbCisgICAgICAgICJjb20uYW5kcm9pZC5tZWRpYSIsCisgICAgICAgICJ0ZXN0X2NvbS5hbmRyb2lkLm1lZGlhIiwKKyAgICBdLAogCiAgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmFuZHJvaWQjMzEiLAogICAgICAgICAibGliYmFzZSIsCiAgICAgICAgICJsaWJiaW5kZXJfbmRrIiwKKyAgICAgICAgImxpYmN1dGlscyIsCiAgICAgICAgICJsaWJsb2ciLAogICAgICAgICAibGlibWVkaWF0cmFuc2NvZGluZyIsCiAgICAgICAgICJsaWJ1dGlscyIsCiAgICAgXSwKIAorICAgIGV4cG9ydF9zaGFyZWRfbGliX2hlYWRlcnM6IFsKKyAgICAgICAgImxpYm1lZGlhdHJhbnNjb2RpbmciLAorICAgIF0sCisKICAgICBzdGF0aWNfbGliczogWwogICAgICAgICAibWVkaWF0cmFuc2NvZGluZ19haWRsX2ludGVyZmFjZS1uZGtfcGxhdGZvcm0iLAogICAgIF0sCkBAIC0zMSw4ICs2NSw3IEBACiAKICAgICBzaGFyZWRfbGliczogWwogICAgICAgICAibGliYmFzZSIsCi0gICAgICAgIC8vIFRPRE8oaGt1YW5nKTogVXNlIGxpYmJpbmRlcl9uZGsKLSAgICAgICAgImxpYmJpbmRlciIsCisgICAgICAgICJsaWJiaW5kZXJfbmRrIiwKICAgICAgICAgImxpYnV0aWxzIiwKICAgICAgICAgImxpYmxvZyIsCiAgICAgICAgICJsaWJiYXNlIiwKQEAgLTQwLDI0ICs3MywxNiBAQAogICAgICAgICAibGlibWVkaWF0cmFuc2NvZGluZ3NlcnZpY2UiLAogICAgIF0sCiAKKyAgICBtaW5fc2RrX3ZlcnNpb246ICIyOSIsCisgICAgYXBleF9hdmFpbGFibGU6IFsKKyAgICAgICAgImNvbS5hbmRyb2lkLm1lZGlhIiwKKyAgICAgICAgInRlc3RfY29tLmFuZHJvaWQubWVkaWEiLAorICAgIF0sCisKICAgICBzdGF0aWNfbGliczogWwogICAgICAgICAibWVkaWF0cmFuc2NvZGluZ19haWRsX2ludGVyZmFjZS1uZGtfcGxhdGZvcm0iLAogICAgIF0sCiAKLSAgICB0YXJnZXQ6IHsKLSAgICAgICAgYW5kcm9pZDogewotICAgICAgICAgICAgcHJvZHVjdF92YXJpYWJsZXM6IHsKLSAgICAgICAgICAgICAgICBtYWxsb2Nfbm90X3N2ZWx0ZTogewotICAgICAgICAgICAgICAgICAgICAvLyBTY3VkbyBpbmNyZWFzZXMgbWVtb3J5IGZvb3RwcmludCwgc28gb25seSBlbmFibGUgb24KLSAgICAgICAgICAgICAgICAgICAgLy8gbm9uLXN2ZWx0ZSBkZXZpY2VzLgotICAgICAgICAgICAgICAgICAgICBzaGFyZWRfbGliczogWyJsaWJjX3NjdWRvIl0sCi0gICAgICAgICAgICAgICAgfSwKLSAgICAgICAgICAgIH0sCi0gICA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yB3aXRoIHNob3J0ZXIgdmFsdWVzIGZvciB0ZXN0aW5nLgorICAgICAgICBUcmFuc2NvZGluZ1Nlc3Npb25Db250cm9sbGVyOjpDb250cm9sbGVyQ29uZmlnIGNvbmZpZyA9IHsKKyAgICAgICAgICAgICAgICAucGFjZXJCdXJzdFRocmVzaG9sZE1zID0gNTAwLAorICAgICAgICAgICAgICAgIC5wYWNlckJ1cnN0Q291bnRRdW90YSA9IDEwLAorICAgICAgICAgICAgICAgIC5wYWNlckJ1cnN0VGltZVF1b3RhU2Vjb25kcyA9IDMsCisgICAgICAgIH07CisgICAgICAgIG1TZXNzaW9uQ29udHJvbGxlci5yZXNldChuZXcgVHJhbnNjb2RpbmdTZXNzaW9uQ29udHJvbGxlcigKKyAgICAgICAgICAgICAgICBbXShjb25zdCBzdGQ6OnNoYXJlZF9wdHI8VHJhbnNjb2RlckNhbGxiYWNrSW50ZXJmYWNlPiYgY2IpCisgICAgICAgICAgICAgICAgICAgICAgICAtPiBzdGQ6OnNoYXJlZF9wdHI8VHJhbnNjb2RlckludGVyZmFjZT4geworICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RkOjptYWtlX3NoYXJlZDxTaW11bGF0ZWRUcmFuc2NvZGVyPihjYik7CisgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICBtVWlkUG9saWN5LCBtUmVzb3VyY2VQb2xpY3ksIG1UaGVybWFsUG9saWN5LCAmY29uZmlnKSk7CisgICAgfSBlbHNlIHsKKyAgICAgICAgaW50MzJfdCBvdmVycmlkZUJ1cnN0Q291bnRRdW90YSA9CisgICAgICAgICAgICAgICAgcHJvcGVydHlfZ2V0X2ludDMyKCJwZXJzaXN0LnRyYW5zY29kaW5nLmJ1cnN0X2NvdW50X3F1b3RhIiwgLTEpOworICAgICAgICBpbnQzMl90IHBhY2VyQnVyc3RUaW1lUXVvdGFTZWNvbmRzID0KKyAgICAgICAgICAgICAgICBwcm9wZXJ0eV9nZXRfaW50MzIoInBlcnNpc3QudHJhbnNjb2RpbmcuYnVyc3RfdGltZV9xdW90YV9zZWNvbmRzIiwgLTEpOworICAgICAgICAvLyBPdmVycmlkZSBkZWZhdWx0IGNvbmZpZyBwYXJhbXMgd2l0aCBwcm9wZXJ0aWVzIGlmIHByZXNlbnQuCisgICAgICAgIFRyYW5zY29kaW5nU2Vzc2lvbkNvbnRyb2xsZXI6OkNvbnRyb2xsZXJDb25maWcgY29uZmlnOworICAgICAgICBpZiAob3ZlcnJpZGVCdXJzdENvdW50UXVvdGEgPiAwKSB7CisgICAgICAgICAgICBjb25maWcucGFjZXJCdXJzdENvdW50UXVvdGEgPSBvdmVycmlkZUJ1cnN0Q291bnRRdW90YTsKKyAgICAgICAgfQorICAgICAgICBpZiAocGFjZXJCdXJzdFRpbWVRdW90YVNlY29uZHMgPiAwKSB7CisgICAgICAgICAgICBjb25maWcucGFjZXJCdXJzdFRpbWVRdW90YVNlY29uZHMgPSBwYWNlckJ1cnN0VGltZVF1b3RhU2Vjb25kczsKKyAgICAgICAgfQorICAgICAgICBtU2Vzc2lvbkNvbnRyb2xsZXIucmVzZXQobmV3IFRyYW5zY29kaW5nU2Vzc2lvbkNvbnRyb2xsZXIoCisgICAgICAgICAgICAgICAgW2xvZ2dlciA9IG1Mb2dnZXJdKGNvbnN0IHN0ZDo6c2hhcmVkX3B0cjxUcmFuc2NvZGVyQ2FsbGJhY2tJbnRlcmZhY2U+JiBjYikKKyAgICAgICAgICAgICAgICAgICAgICAgIC0+IHN0ZDo6c2hhcmVkX3B0cjxUcmFuc2NvZGVySW50ZXJmYWNlPiB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBzdGQ6Om1ha2Vfc2hhcmVkPFRyYW5zY29kZXJXcmFwcGVyPihjYiwgbG9nZ2VyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga1RyYW5zY29kZXJIZWFydEJlYXRJbnRlcnZhbFVzKTsKKyAgICAgICAg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hbGxpbmdVaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZwZXJtaXNzaW9uUmVzdWx0KSAhPSBQRVJNSVNTSU9OX01BTkFHRVJfU1RBVFVTX09LIHx8CisgICAgICAgICAgICBwZXJtaXNzaW9uUmVzdWx0ICE9IFBFUk1JU1NJT05fTUFOQUdFUl9QRVJNSVNTSU9OX0dSQU5URUQpIHsKKyAgICAgICAgICAgIHJlc3VsdC5mb3JtYXQoCisgICAgICAgICAgICAgICAgICAgICJQZXJtaXNzaW9uIERlbmlhbDogIgorICAgICAgICAgICAgICAgICAgICAiY2FuJ3QgZHVtcCBNZWRpYVRyYW5zY29kaW5nU2VydmljZSBmcm9tIHBpZD0lZCwgdWlkPSVkXG4iLAorICAgICAgICAgICAgICAgICAgICBBSUJpbmRlcl9nZXRDYWxsaW5nUGlkKCksIEFJQmluZGVyX2dldENhbGxpbmdVaWQoKSk7CisgICAgICAgICAgICB3cml0ZShmZCwgcmVzdWx0LnN0cmluZygpLCByZXN1bHQuc2l6ZSgpKTsKKyAgICAgICAgICAgIHJldHVybiBQRVJNSVNTSU9OX0RFTklFRDsKKyAgICAgICAgfQorICAgIH0KKwogICAgIGNvbnN0IHNpemVfdCBTSVpFID0gMjU2OwogICAgIGNoYXIgYnVmZmVyW1NJWkVdOwogCkBAIC02NCw3ICsxMjMsOCBAQAogICAgIHdyaXRlKGZkLCByZXN1bHQuc3RyaW5nKCksIHJlc3VsdC5zaXplKCkpOwogCiAgICAgVmVjdG9yPFN0cmluZzE2PiBhcmdzOwotICAgIG1UcmFuc2NvZGluZ0NsaWVudE1hbmFnZXIuZHVtcEFsbENsaWVudHMoZmQsIGFyZ3MpOworICAgIG1DbGllbnRNYW5hZ2VyLT5kdW1wQWxsQ2xpZW50cyhmZCwgYXJncyk7CisgICAgbVNlc3Npb25Db250cm9sbGVyLT5kdW1wQWxsU2Vzc2lvbnMoZmQsIGFyZ3MpOwogICAgIHJldHVybiBPS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OwotICAgICAgICAgICAgKl9haWRsX3JldHVybiA9IHRydWU7Ci0gICAgICAgICAgICByZXR1cm4gU1RBVFVTX0VSUk9SX0ZNVChFUlJPUl9QRVJNSVNTSU9OX0RFTklFRCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJVbnRydXN0ZWQgY2FsbGVyIChjYWxsaW5nIFBJRCAlZCwgVUlEICVkKSB0cnlpbmcgdG8gIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInVucmVnaXN0ZXIgY2xpZW50IHdpdGggaWQ6ICVkIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxpbmdVaWQsIGNhbGxpbmdQaWQsIGNsaWVudElkKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgICpfYWlkbF9yZXR1cm4gPSAobVRyYW5zY29kaW5nQ2xpZW50TWFuYWdlci5yZW1vdmVDbGllbnQoY2xpZW50SWQpID09IE9LKTsKKyAgICAqX2FpZGxfcmV0dXJuID0gbmV3Q2xpZW50OwogICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CiB9CiAKIFN0YXR1cyBNZWRpYVRyYW5zY29kaW5nU2VydmljZTo6Z2V0TnVtT2ZDbGllbnRzKGludDMyX3QqIF9haWRsX3JldHVybikgewogICAgIEFMT0dEKCJNZWRpYVRyYW5zY29kaW5nU2VydmljZTo6Z2V0TnVtT2ZDbGllbnRzIik7Ci0gICAgKl9haWRsX3JldHVybiA9IG1UcmFuc2NvZGluZ0NsaWVudE1hbmFnZXIuZ2V0TnVtT2ZDbGllbnRzKCk7Ci0gICAgcmV0dXJuIFN0YXR1czo6b2soKTsKLX0KLQotU3RhdHVzIE1lZGlhVHJhbnNjb2RpbmdTZXJ2aWNlOjpzdWJtaXRSZXF1ZXN0KGludDMyX3QgLypjbGllbnRJZCovLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRyYW5zY29kaW5nUmVxdWVzdFBhcmNlbCYgLypyZXF1ZXN0Ki8sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVHJhbnNjb2RpbmdKb2JQYXJjZWwqIC8qam9iKi8sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCogLypfYWlkbF9yZXR1cm4qLykgewotICAgIC8vIFRPRE8oaGt1YW5nKTogQWRkIGltcGxlbWVudGF0aW9uLgotICAgIHJldHVybiBTdGF0dXM6Om9rKCk7Ci19Ci0KLVN0YXR1cyBNZWRpYVRyYW5zY29kaW5nU2VydmljZTo6Y2FuY2VsSm9iKGludDMyX3QgLyppbl9jbGllbnRJZCovLCBpbnQzMl90IC8qaW5fam9iSWQqLywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wqIC8qX2FpZGxfcmV0dXJuKi8pIHsKLSAgICAvLyBUT0RPKGhrdWFuZyk6IEFkZCBpbXBsZW1lbnRhdGlvbi4KLSAgICByZXR1cm4gU3RhdHVzOjpvaygpOwotfQotCi1TdGF0dXMgTWVkaWFUcmFuc2NvZGluZ1NlcnZpY2U6OmdldEpvYldpdGhJZChpbnQzMl90IC8qaW5fam9iSWQqLywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRyYW5zY29kaW5nSm9iUGFyY2VsKiAvKm91dF9qb2IqLywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wqIC8qX2FpZGxfcmV0dXJuKi8pIHsKLSAgICAvLyBUT0RPKGhrdWFuZyk6IEFkZCBpbXBsZW1lbnRhdGlvbi4KKyAgICAqX2FpZGxfcmV0dXJuID0gbUNsaWVudE1hbmFnZXItPmdldE51bU9mQ2xpZW50cygpOwogICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CiB9CiAKZGlmZiAtLWdpdCBhL3NlcnZpY2VzL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VudGx5IGxpdmVzIGluIHRoZSB0cmFuc2NvZGluZyBzZXJ2aWNlLCBhcyBsb25nIGFzCisgICAgLy8gTWVkaWFUcmFuc2NvZGluZ1NlcnZpY2UgaXRzZWxmLgorICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgIC8vIFdhaXQgZm9yIHRoZSBuZXh0IGV2ZW50LgorICAgICAgICB3aGlsZSAobVF1ZXVlLmVtcHR5KCkpIHsKKyAgICAgICAgICAgIGlmICghcnVubmluZykgeworICAgICAgICAgICAgICAgIG1Db25kaXRpb24ud2FpdChsb2NrKTsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIElmIHJ1bm5pbmcsIHdhaXQgZm9yIHRoZSByZW1haW5pbmcgbGlmZSBvZiB0aGlzIHNlc3Npb24uIFJlcG9ydCBmaW5pc2ggaWYgdGltZWQgb3V0LgorICAgICAgICAgICAgU2Vzc2lvbktleVR5cGUga2V5ID0KKyAgICAgICAgICAgICAgICAgICAgc3RkOjptYWtlX3BhaXIobGFzdFJ1bm5pbmdFdmVudC5jbGllbnRJZCwgbGFzdFJ1bm5pbmdFdmVudC5zZXNzaW9uSWQpOworICAgICAgICAgICAgc3RkOjpjdl9zdGF0dXMgc3RhdHVzID0gbUNvbmRpdGlvbi53YWl0X2Zvcihsb2NrLCBtUmVtYWluaW5nVGltZU1hcFtrZXldKTsKKyAgICAgICAgICAgIGlmIChzdGF0dXMgPT0gc3RkOjpjdl9zdGF0dXM6OnRpbWVvdXQpIHsKKyAgICAgICAgICAgICAgICBydW5uaW5nID0gZmFsc2U7CisKKyAgICAgICAgICAgICAgICBhdXRvIGNhbGxiYWNrID0gbUNhbGxiYWNrLmxvY2soKTsKKyAgICAgICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbHB0cikgeworICAgICAgICAgICAgICAgICAgICBtUmVtYWluaW5nVGltZU1hcC5lcmFzZShrZXkpOworCisgICAgICAgICAgICA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igpOworICAgICAgICBtUXVldWUucG9wX2Zyb250KCk7CisKKyAgICAgICAgQUxPR0QoIiVzOiBzZXNzaW9uIHslbGxkLCAlZH06ICVzIiwgX19GVU5DVElPTl9fLCAobG9uZyBsb25nKWV2ZW50LmNsaWVudElkLAorICAgICAgICAgICAgICBldmVudC5zZXNzaW9uSWQsIHRvU3RyaW5nKGV2ZW50LnR5cGUpKTsKKworICAgICAgICBpZiAoZXZlbnQudHlwZSA9PSBFdmVudDo6QWJhbmRvbikgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBTZXNzaW9uS2V5VHlwZSBrZXkgPSBzdGQ6Om1ha2VfcGFpcihldmVudC5jbGllbnRJZCwgZXZlbnQuc2Vzc2lvbklkKTsKKyAgICAgICAgaWYgKCFydW5uaW5nICYmIChldmVudC50eXBlID09IEV2ZW50OjpTdGFydCB8fCBldmVudC50eXBlID09IEV2ZW50OjpSZXN1bWUpKSB7CisgICAgICAgICAgICBydW5uaW5nID0gdHJ1ZTsKKyAgICAgICAgICAgIGxhc3RSdW5uaW5nVGltZSA9IHN0ZDo6Y2hyb25vOjpzdGVhZHlfY2xvY2s6Om5vdygpOworICAgICAgICAgICAgbGFzdFJ1bm5pbmdFdmVudCA9IGV2ZW50OworICAgICAgICAgICAgQUxPR1YoIiVzOiBzZXNzaW9uIHslbGxkLCAlZH06IHJlbWFpbmluZyB0aW1lOiAlbGxkIiwgX19GVU5DVElPTl9fLAorICAgICAgICAgICAgICAgICAgKGxvbmcgbG9uZylldmVudC5jbGllbnRJZCwgZXZlbnQuc2Vzc2lvbklkLAorICAgICAgICAgICAgICAgICAgKGxvbmcgbG9uZyltUmVtYWluaW5nVGltZU1hcFtrZXldLmNvdW50KCkpOworCisgICAgICAgIH0gZWxzZSBpZiAocnVubmluZyAmJiAoZXZlbnQudHlwZSA9PSBFdmVudDo6UGF1c2UgfHwgZXZlbnQudHlwZSA9PSBFdmVudDo6U3RvcCkpIHsKKyAgICAgICAgIC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hY2thZ2VOYW1lLCAwKTsKKyAgICBpZiAodWlkIDw9IDApIHsKKyAgICAgICAgQUxPR0UoIlVua25vd24gcGFja2FnZTogJyVzJyIsIFN0cmluZzgocGFja2FnZU5hbWUpLnN0cmluZygpKTsKKyAgICAgICAgcmV0dXJuIEJBRF9WQUxVRTsKKyAgICB9CisKKyAgICBpZiAodXNlcklkIDwgMCkgeworICAgICAgICBBTE9HRSgiSW52YWxpZCB1c2VyOiAlZCIsIHVzZXJJZCk7CisgICAgICAgIHJldHVybiBCQURfVkFMVUU7CisgICAgfQorCisgICAgdWlkID0gbXVsdGl1c2VyX2dldF91aWQodXNlcklkLCB1aWQpOworICAgIHJldHVybiBOT19FUlJPUjsKK30KKworc3RydWN0IFNoZWxsSGVscGVyIHsKKyAgICBzdGF0aWMgYm9vbCBSdW5DbWQoY29uc3Qgc3RkOjpzdHJpbmcmIGNtZFN0cikgeworICAgICAgICBpbnQgcmV0ID0gc3lzdGVtKGNtZFN0ci5jX3N0cigpKTsKKyAgICAgICAgaWYgKHJldCAhPSAwKSB7CisgICAgICAgICAgICBBTE9HRSgiRmFpbGVkIHRvIHJ1biBjbWQ6ICVzLCBleGl0Y29kZSAlZCIsIGNtZFN0ci5jX3N0cigpLCByZXQpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHN0YXRpYyBib29sIFN0YXJ0KGNvbnN0IGNoYXIqIHBhY2thZ2VOYW1lLCBjb25zdCBjaGFyKiBhY3Rpdml0eU5hbWUpIHsKKyAgICAgICAgcmV0dXJuIFJ1bkNtZCgiYW0gc3RhcnQgLVcgIiArIHN0ZDo6c3RyaW5nKHBhY2thZ2VOYW1lKSArIHN0ZDo6c3RyaW5nKGFjdGl2aXR5TmFtZSkgKworICAgICAgICAgICAgICAgICAgICAgICIgJj4gL2Rldi9udWxsIik7CisgICAgfQorCisgICAgc3RhdGljIGJvb2wgU3RvcChjb25zdCBjaGFyKiBwYWNrYWdlTmFtZSkgeworICAgICAgICByZXR1cm4gUnVuQ21kKCJhbSBmb3JjZS1zdG9wICIgKyBzdGQ6OnN0cmluZyhwYWNrYWdlTmFtZSkpOworICAgIH0KK307CisKK3N0cnVjdCBFdmVudFRyYWNrZXIgeworICAgIHN0cnVjdCBFdmVudCB7CisgICAgICAgIGVudW0geyBOb0V2ZW50LCBTdGFydCwgUGF1c2UsIFJlc3VtZSwgRmluaXNoZWQsIEZhaWxlZCB9IHR5cGU7CisgICAgICAgIGludDY0X3QgY2xpZW50SWQ7CisgICAgICAgIGludDMyX3Qgc2Vzc2lvbklkOworICAgIH07CisKKyNkZWZpbmUgREVDTEFSRV9FVkVOVChhY3Rpb24pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBzdGF0aWMgRXZlbnQgYWN0aW9uKGludDMyX3QgY2xpZW50SWQsIGludDMyX3Qgc2Vzc2lvbklkKSB7IFwKKyAgICAgICAgcmV0dXJuIHtFdmVudDo6YWN0aW9uLCBjbGllbnRJZCwgc2Vzc2lvbklkfTsgICAgICAgICAgIFwKKyAgICB9CisKKyAgICBERUNMQVJFX0VWRU5UKFN0YXJ0KTsKKyAgICBERUNMQVJFX0VWRU5UKFBhdXNlKTsKKyAgICBERUNMQVJFX0VWRU5UKFJlc3VtZSk7CisgICAgREVDTEFSRV9FVkVOVChGaW5pc2hlZCk7CisgICAgREVDTEFSRV9FVkVOVChGYWlsZWQpOworCisgICAgc3RhdGljIGNvbnN0ZXhwciBFdmVudCBOb0V2ZW50ID0ge0V2ZW50OjpOb0V2ZW50LCAwLCAwfTsKKworICAgIHN0YXRpYyBzdGQ6OnN0cmluZyB0b1N0cmluZyhjb25zdCBFdmVudCYgZXZlbnQpIHsKKyAgICAgICAgc3RkOjpzdHJpbmcgZXZlbnRTdHI7CisgICAgICAgIHN3aXRjaCAoZXZlbnQudHlwZSkgeworICAgICAgICBjYXNlIEV2ZW50OjpTdGFydDoKKyAgICAgICAgICAgIGV2ZW50U3RyID0gIlN0YXJ0IjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEV2ZW50OjpQYXVzZToKKyAgICAgICAgICAgIGV2ZW50U3RyID0gIlBhdXNlIjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEV2ZW50OjpSZXN1bWU6CisgICAgICAgICAgICBldmVudFN0ciA9ICJSZXN1bWUiOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgRXZlbnQ6OkZpbmlzaGVkOgorICAgICAgICAgICAgZXZlbnRTdHIgPSAiRmluaXNoZWQiOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgRXZlbnQ6OkZhaWxlZDoKKyAgICAgICAgICAgIGV2ZW50U3RyID0gIkZhaWxlZCI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHJldHVybiAiTm9FdmVudCI7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuICJzZXNzaW9uIHsiICsgc3RkOjp0b19zdHJpbmcoZXZlbnQuY2xpZW50SWQpICsgIiwgIiArCisgICAgICAgICAgICAgICBzdGQ6OnRvX3N0cmluZyhldmVudC5zZXNzaW9uSWQpICsgIn06ICIgKyBldmVudFN0cjsKKyAgICB9CisKKyAgICAvLyBQb3AgMSBldmVudCBmcm9tIGZyb250LCB3YWl0IGZvciB1cCB0byB0aW1lb3V0VXMgaWYgZW1wdHkuCisgICAgY29uc3QgRXZlbnQmIHBvcChpbnQ2NF90IHRpbWVvdXRVcyA9IDApIHsKKyAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1Mb2NrKTsKKworICAgICAgICBpZiAobUV2ZW50UXVldWUuZW1wdHkoKSAmJiB0aW1lb3V0VXMgPiAwKSB7CisgICAgICAgICAgICBtQ29uZGl0aW9uLndhaXRfZm9yKGxvY2ssIHN0ZDo6Y2hyb25vOjptaWNyb3NlY29uZHModGltZW91dFVzKSk7CisgICAgICAgIH0KKworICAgICAgICBpZiAobUV2ZW50UXVldWUuZW1wdHkoKSkgeworICAgICAgICAgICAgbVBvcHBlZEV2ZW50ID0gTm9FdmVudDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1Qb3BwZWRFdmVudCA9ICptRXZlbnRRdWV1ZS5iZWdpbigpOworICAgICAgICAgICAgbUV2ZW50UXVldWUucG9wX2Zyb250KCk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbVBvcHBlZEV2ZW50OworICAgIH0KKworICAgIGJvb2wgd2FpdEZvclNwZWNpZmljRXZlbnRBbmRQb3AoY29uc3QgRXZlbnQmIHRhcmdldCwgc3RkOjpsaXN0PEV2ZW50Piogb3V0RXZlbnRzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50NjRfdCB0aW1lb3V0VXMgPSAwKSB7CisgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtTG9jayk7CisKKyAgICAgICAgYXV0byBzdGFydFRpbWUgPSBzdGQ6OmNocm9ubzo6c3lzdGVtX2Nsb2NrOjpub3coKTsKKyAgICAgICAgaW50NjRfdCByZW1haW5pbmdVcyA9IHRpbWVvdXRVczsKKworICAgICAgICBzdGQ6Omxpc3Q8RXZlbnQ+OjppdGVyYXRvciBpdDsKKyAgICAgICAgd2hpbGUgKCgoaXQgPSBzdGQ6OmZpbmQobUV2ZW50UXVldWUuYmVnaW4oKSwgbUV2ZW50UXVldWUuZW5kKCksIHRhcmdldCkpID09CisgICAgICAgICAgICAgICAgbUV2ZW50UXVldWUuZW5kKCkpICYmCisgICAgICAgICAgICAgICByZW1haW5pbmdVcyA+IDApIHsKKyAgICAgICAgICAgIHN0ZDo6Y3Zfc3RhdHVzIHN0YXR1cyA9CisgICAgICAgICAgICAgICAgICAgIG1Db25kaXRpb24ud2FpdF9mb3IobG9jaywgc3RkOjpjaHJvbm86Om1pY3Jvc2Vjb25kcyhyZW1haW5pbmdVcykpOworICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBzdGQ6OmN2X3N0YXR1czo6dGltZW91dCkgeworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3RkOjpjaHJvbm86Om1pY3Jvc2Vjb25kcyBlbGFwc2VkVGltZSA9IHN0ZDo6Y2hyb25vOjpzeXN0ZW1fY2xvY2s6Om5vdygpIC0gc3RhcnRUaW1lOworICAgICAgICAgICAgcmVtYWluaW5nVXMgPSB0aW1lb3V0VXMgLSBlbGFwc2VkVGltZS5jb3VudCgpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGl0ID09IG1FdmVudFF1ZXVlLmVuZCgpKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICAgICAgKm91dEV2ZW50cyA9IHN0ZDo6bGlzdDxFdmVudD4obUV2ZW50UXVldWUuYmVnaW4oKSwgc3RkOjpuZXh0KGl0KSk7CisgICAgICAgIG1FdmVudFF1ZXVlLmVyYXNlKG1FdmVudFF1ZXVlLmJlZ2luKCksIHN0ZDo6bmV4dChpdCkpOworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICAvLyBQdXNoIDEgZXZlbnQgdG8gYmFjay4KKyAgICB2b2lkIGFwcGVuZChjb25zdCBFdmVudCYgZXZlbnQsCisgICAgICAgICAgICAgICAgY29uc3QgVHJhbnNjb2RpbmdFcnJvckNvZGUgZXJyID0gVHJhbnNjb2RpbmdFcnJvckNvZGU6OmtOb0Vycm9yKSB7CisgICAgICAgIEFMT0dEKCIlcyIsIHRvU3RyaW5nKGV2ZW50KS5jX3N0cigpKTsKKworICAgICAgICBzdGQ6OnVuaXF1ZV9sb2NrIGxvY2sobUxvY2spOworCisgICAgICAgIG1FdmVudFF1ZXVlLnB1c2hfYmFjayhldmVudCk7CisgICAgICAgIGlmIChlcnIgIT0gVHJhbnNjb2RpbmdFcnJvckNvZGU6OmtOb0Vycm9yKSB7CisgICAgICAgICAgICBtTGFzdEVyclF1ZXVlLnB1c2hfYmFjayhlcnIpOworICAgICAgICB9CisgICAgICAgIG1Db25kaXRpb24ubm90aWZ5X29uZSgpOworICAgIH0KKworICAgIHZvaWQgdXBkYXRlUHJvZ3Jlc3MoaW50IHByb2dyZXNzKSB7CisgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtTG9jayk7CisgICAgICAgIG1MYXN0UHJvZ3Jlc3MgPSBwcm9ncmVzczsKKyAgICAgICAgbVVwZGF0ZUNvdW50Kys7CisgICAgfQorCisgICAgaW50IGdldFVwZGF0ZUNvdW50KGludCogbGFzdFByb2dyZXNzKSB7CisgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2sgbG9jayhtTG9jayk7CisgICAgICAgICpsYXN0UHJvZ3Jlc3MgPSBtTGFzdFByb2dyZXNzOworICAgICAgICByZXR1cm4gbVVwZGF0ZUNvdW50OworICAgIH0KKworICAgIFRyYW5zY29kaW5nRXJyb3JDb2RlIGdldExhc3RFcnJvcigpIHsKKyAgICAgICAgc3RkOjp1bmlxdWVfbG9jayBsb2NrKG1Mb2NrKTsKKyAgICAgICAgaWYgKG1MYXN0RXJyUXVldWUuZW1wdHkoKSkgeworICAgICAgICAgICAgcmV0dXJuIFRyYW5zY29kaW5nRXJyb3JDb2RlOjprTm9FcnJvcjsKKyAgICAgICAgfQorICAgICAgICBUcmFuc2NvZGluZ0Vycm9yQ29kZSBlcnIgPSBtTGFzdEVyclF1ZXVlLmZyb250KCk7CisgICAgICAgIG1MYXN0RXJyUXVldWUucG9wX2Zyb250KCk7CisgICAgICAgIHJldHVybiBlcnI7CisgICAgfQorCitwcml2YXRlOgorICAgIHN0ZDo6bXV0ZXggbUxvY2s7CisgICAgc3RkOjpjb25kaXRpb25fdmFyaWFibGUgbUNvbmRpdGlvbjsKKyAgICBFdmVudCBtUG9wcGVkRXZlbnQ7CisgICAgc3RkOjpsaXN0PEV2ZW50Pi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gICA6IG1DbGllbnRJZChpZCksIG1DbGllbnRQaWQoUElEKGlkKSksIG1DbGllbnRVaWQoVUlEKGlkKSksIG1QYWNrYWdlTmFtZShwYWNrYWdlTmFtZSkgeworICAgICAgICBBTE9HSSgiVGVzdENsaWVudENhbGxiYWNrICVkIGNyZWF0ZWQ6IHBpZCAlZCwgdWlkICVkIiwgaWQsIFBJRChpZCksIFVJRChpZCkpOworCisgICAgICAgIC8vIFVzZSBwYWNrYWdlIHVpZCBpZiB0aGF0J3MgYXZhaWxhYmxlLgorICAgICAgICB1aWRfdCBwYWNrYWdlVWlkOworICAgICAgICBpZiAoZ2V0VWlkRm9yUGFja2FnZShTdHJpbmcxNihwYWNrYWdlTmFtZSksIDAgLyp1c2VySWQqLywgcGFja2FnZVVpZCkgPT0gTk9fRVJST1IpIHsKKyAgICAgICAgICAgIG1DbGllbnRVaWQgPSBwYWNrYWdlVWlkOworICAgICAgICB9CisgICAgfQorCisgICAgdmlydHVhbCB+VGVzdENsaWVudENhbGxiYWNrKCkgeyBBTE9HSSgiVGVzdENsaWVudENhbGxiYWNrICVkIGRlc3Ryb3llZCIsIG1DbGllbnRJZCk7IH0KKworICAgIFN0YXR1cyBvcGVuRmlsZURlc2NyaXB0b3IoY29uc3Qgc3RkOjpzdHJpbmcmIGluX2ZpbGVVcmksIGNvbnN0IHN0ZDo6c3RyaW5nJiBpbl9tb2RlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOjpuZGs6OlNjb3BlZEZpbGVEZXNjcmlwdG9yKiBfYWlkbF9yZXR1cm4pIG92ZXJyaWRlIHsKKyAgICAgICAgQUxPR0QoIkBAQCBvcGVuRmlsZURlc2NyaXB0b3I6ICVzIiwgaW5fZmlsZVVyaS5jX3N0cigpKTsKKyAgICAgICAgaW50IGZkOworICAgICAgICBpZiAoaW5fbW9kZSA9PSAidyIgfHwgaW5fbW9kZSA9PSAicnciKSB7CisgICAgICAgICAgICBpbnQga09wZW5GbGFnczsKKyAgICAgICAgICAgIGlmIChpbl9tb2RlID09ICJ3IikgeworICAgICAgICAgICAgICAgIC8vIFdyaXRlLW9ubHksIGNyZWF0ZSBmaWxlIGlmIG5vbi1leGlzdGVudCwgdHJ1bmNhdGUgZXhpc3RpbmcgZmlsZS4KKyAgICAgICAgICAgICAgICBrT3BlbkZsYWdzID0gT19XUk9OTFkgfCBPX0NSRUFUIHwgT19UUlVOQzsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgLy8gUmVhZC1Xcml0ZSwgY3JlYXRlIGlmIG5vbi1leGlzdGVudCwgbm8gdHJ1bmNhdGUgKHNlcnZpY2Ugd2lsbCB0cnVuY2F0ZSBpZiBuZWVkZWQpCisgICAgICAgICAgICAgICAga09wZW5GbGFncyA9IE9fUkRXUiB8IE9fQ1JFQVQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBVc2VyIFIrVyBwZXJtaXNzaW9uLgorICAgICAgICAgICAgY29uc3RleHByIGludCBrRmlsZU1vZGUgPSBTX0lSVVNSIHwgU19JV1VTUjsKKyAgICAgICAgICAgIGZkID0gb3Blbihpbl9maWxlVXJpLmNfc3RyKCksIGtPcGVuRmxhZ3MsIGtGaWxlTW9kZSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBmZCA9IG9wZW4oaW5fZmlsZVVyaS5jX3N0cigpLCBPX1JET05MWSk7CisgICAgICAgIH0KKyAgICAgICAgX2FpZGxfcmV0dXJuLT5zZXQoZmQpOworICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOworICAgIH0KKworICAgIFN0YXR1cyBvblRyYW5zY29kaW5nU3RhcnRlZChpbnQzMl90IGluX3Nlc3Npb25JZCkgb3ZlcnJpZGUgeworICAgICAgICBhcHBlbmQoRXZlbnRUcmFja2VyOjpTdGFydChtQ2xpZW50SWQsIGluX3Nlc3Npb25JZCkpOworICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOworICAgIH0KKworICAgIFN0YXR1cyBvblRyYW5zY29kaW5nUGF1c2VkKGludDMyX3QgaW5fc2Vzc2lvbklkKSBvdmVycmlkZSB7CisgICAgICAgIGFwcGVuZChFdmVudFRyYWNrZXI6OlBhdXNlKG1DbGllbnRJZCwgaW5fc2Vzc2lvbklkKSk7CisgICAgICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CisgICAgfQorCisgICAgU3RhdHVzIG9uVHJhbnNjb2RpbmdSZXN1bWVkKGludDMyX3QgaW5fc2Vzc2lvbklkKSBvdmVycmlkZSB7CisgICAgICAgIGFwcGVuZChFdmVudFRyYWNrZXI6OlJlc3VtZShtQ2xpZW50SWQsIGluX3Nlc3Npb25JZCkpOworICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOworICAgIH0KKworICAgIFN0YXR1cyBvblRyYW5zY29kaW5nRmluaXNoZWQoCisgICAgICAgICAgICBpbnQzMl90IGluX3Nlc3Npb25JZCwKKyAgICAgICAgICAgIGNvbnN0IDo6YWlkbDo6YW5kcm9pZDo6bWVkaWE6OlRyYW5zY29kaW5nUmVzdWx0UGFyY2VsJiAvKiBpbl9yZXN1bHQgKi8pIG92ZXJyaWRlIHsKKyAgICAgICAgYXBwZW5kKEZpbmlzaGVkKG1DbGllbnRJZCwgaW5fc2Vzc2lvbklkKSk7CisgICAgICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CisgICAgfQorCisgICAgU3RhdHVzIG9uVHJhbnNjb2RpbmdGYWlsZWQoaW50MzJfdCBpbl9zZXNzaW9uSWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOjphaWRsOjphbmRyb2lkOjptZWRpYTo6VHJhbnNjb2RpbmdFcnJvckNvZGUgaW5fZXJyb3JDb2RlKSBvdmVycmlkZSB7CisgICAgICAgIGFwcGVuZChGYWlsZWQobUNsaWVudElkLCBpbl9zZXNzaW9uSWQpLCBpbl9lcnJvckNvZGUpOworICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOworICAgIH0KKworICAgIFN0YXR1cyBvbkF3YWl0TnVtYmVyT2ZTZXNzaW9uc0NoYW5nZWQoaW50MzJfdCAvKiBpbl9zZXNzaW9uSWQgKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90IC8qIGluX29sZEF3YWl0TnVtYmVyICovLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCAvKiBpbl9uZXdBd2FpdE51bWJlciAqLykgb3ZlcnJpZGUgeworICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOworICAgIH0KKworICAgIFN0YXR1cyBvblByb2dyZXNzVXBkYXRlKGludDMyX3QgLyogaW5fc2Vzc2lvbklkICovLCBpbnQzMl90IGluX3Byb2dyZXNzKSBvdmVycmlkZSB7CisgICAgICAgIHVwZGF0ZVByb2dyZXNzKGluX3Byb2dyZXNzKTsKKyAgICAgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKKyAgICB9CisKKyAgICBTdGF0dXMgcmVnaXN0ZXJDbGllbnQoY29uc3QgY2hhciogcGFja2FnZU5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c2hhcmVkX3B0cjxJTWVkaWFUcmFuc2NvZGluZ1NlcnZpY2U+JiBzZXJ2aWNlKSB7CisgICAgICAgIC8vIE92ZXJyaWRlIHRoZSBkZWZhdWx0IHVpZCBpZiB0aGUgcGFja2FnZSB1aWQgaXMgZm91bmQuCisgICAgICAgIHVpZF90IHVpZDsKKyAgICAgICAgaWYgKGdldFVpZEZvclBhY2thZ2UoU3RyaW5nMTYocGFja2FnZU5hbWUpLCAwIC8qdXNlcklkKi8sIHVpZCkgPT0gTk9fRVJST1IpIHsKKyAgICAgICAgICAgIG1DbGllbnRVaWQgPSB1aWQ7CisgICAgICAgIH0KKworICAgICAgICBBTE9HRCgicmVnaXN0ZXJpbmcgJXMgd2l0aCB1aWQgJWQiLCBwYWNrYWdlTmFtZSwgbUNsaWVudFVpZCk7CisKKyAgICAgICAgc3RkOjpzaGFyZWRfcHRyPElUcmFuc2NvZGluZ0NsaWVudD4gY2xpZW50OworICAgICAgICBTdGF0dXMgc3RhdHVzID0KKyAgICAgICAgICAgICAgICBzZXJ2aWNlLT5yZWdpc3RlckNsaWVudChzaGFyZWRfZnJvbV90aGlzKCksIGtDbGllbnROYW1lLCBwYWNrYWdlTmFtZSwgJmNsaWVudCk7CisKKyAgICAgICAgbUNsaWVudCA9IHN0YXR1cy5pc09rKCkgPyBjbGllbnQgOiBudWxscHRyOworICAgICAgICByZXR1cm4gc3RhdHVzOworICAgIH0KKworICAgIFN0YXR1cyB1bnJlZ2lzdGVyQ2xpZW50KCkgeworICAgICAgICBTdGF0dXMgc3RhdHVzOworICAgICAgICBpZiAobUNsaWVudCAhPSBudWxscHRyKSB7CisgICAgICAgICAgICBzdGF0dXMgPSBtQ2xpZW50LT51bnJlZ2lzdGVyKCk7CisgICAgICAgICAgICBtQ2xpZW50ID0gbnVsbHB0cjsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gc3RhdHVzOworICAgIH0KKworICAgIHRlbXBsYXRlIDxib29sIGV4cGVjdGF0aW9uID0gc3VjY2Vzcz4KKyAgICBib29sIHN1Ym1pdChpbnQzMl90IHNlc3Npb25JZCwgY29uc3QgY2hhciogc291cmNlRmlsZVBhdGgsIGNvbnN0IGNoYXIqIGRlc3RpbmF0aW9uRmlsZVBhdGgsCisgICAgICAgICAgICAgICAgVHJhbnNjb2RpbmdTZXNzaW9uUHJpb3JpdHkgcHJpb3JpdHkgPSBUcmFuc2NvZGluZ1Nlc3Npb25Qcmlvcml0eTo6a05vcm1hbCwKKyAgICAgICAgICAgICAgICBpbnQgYml0cmF0ZUJwcyA9IC0xLCBpbnQgb3ZlcnJpZGVQaWQgPSAtMSwgaW50IG92ZXJyaWRlVWlkID0gLTEsCisgICAgICAgICAgICAgICAgaW50IHNlc3Npb25EdXJhdGlvbk1zID0gLTEpIHsKKyAgICAgICAgY29uc3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GVzdENsaWVudENhbGxiYWNrPiYgY2FsbGJhY2spIHsKKyAgICAgICAgQUxPR0QoInJlZ2lzdGVyaW5nICVzIHdpdGggdWlkICVkIiwgY2FsbGJhY2stPm1QYWNrYWdlTmFtZS5jX3N0cigpLCBjYWxsYmFjay0+bUNsaWVudFVpZCk7CisKKyAgICAgICAgc3RkOjpzaGFyZWRfcHRyPElUcmFuc2NvZGluZ0NsaWVudD4gY2xpZW50OworICAgICAgICBTdGF0dXMgc3RhdHVzID0KKyAgICAgICAgICAgICAgICBtU2VydmljZS0+cmVnaXN0ZXJDbGllbnQoY2FsbGJhY2ssIGtDbGllbnROYW1lLCBjYWxsYmFjay0+bVBhY2thZ2VOYW1lLCAmY2xpZW50KTsKKworICAgICAgICBpZiAoc3RhdHVzLmlzT2soKSkgeworICAgICAgICAgICAgY2FsbGJhY2stPm1DbGllbnQgPSBjbGllbnQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBjYWxsYmFjay0+bUNsaWVudCA9IG51bGxwdHI7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHN0YXR1czsKKyAgICB9CisKKyAgICB2b2lkIHJlZ2lzdGVyTXVsdGlwbGVDbGllbnRzKCkgeworICAgICAgICAvLyBSZWdpc3RlciAzIGNsaWVudHMuCisgICAgICAgIEVYUEVDVF9UUlVFKHJlZ2lzdGVyT25lQ2xpZW50KG1DbGllbnQxKS5pc09rKCkpOworICAgICAgICBFWFBFQ1RfVFJVRShyZWdpc3Rlck9uZUNsaWVudChtQ2xpZW50MikuaXNPaygpKTsKKyAgICAgICAgRVhQRUNUX1RSVUUocmVnaXN0ZXJPbmVDbGllbnQobUNsaWVudDMpLmlzT2soKSk7CisKKyAgICAgICAgLy8gQ2hlY2sgdGhlIG51bWJlciBvZiBjbGllbnRzLgorICAgICAgICBpbnQzMl90IG51bU9mQ2xpZW50czsKKyAgICAgICAgU3RhdHVzIHN0YXR1cyA9IG1TZXJ2aWNlLT5nZXROdW1PZkNs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sKKyAgICAgICAgICAgIGlmIChpbmZvLmlzRW5jb2RlcigpICE9IGlzRW5jb2RlcikgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQ29kZWNDYXBhYmlsaXRpZXMgY2FwczsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgY2FwcyA9IGluZm8uZ2V0Q2FwYWJpbGl0aWVzRm9yVHlwZShNSU1FKTsKKyAgICAgICAgICAgICAgICBib29sZWFuIHNlY3VyZVBsYXliYWNrU3VwcG9ydGVkID0KKyAgICAgICAgICAgICAgICAgICAgICAgIGNhcHMuaXNGZWF0dXJlU3VwcG9ydGVkKENvZGVjQ2FwYWJpbGl0aWVzLkZFQVRVUkVfU2VjdXJlUGxheWJhY2spOworICAgICAgICAgICAgICAgIGJvb2xlYW4gc2VjdXJlUGxheWJhY2tSZXF1aXJlZCA9CisgICAgICAgICAgICAgICAgICAgICAgICBjYXBzLmlzRmVhdHVyZVJlcXVpcmVkKENvZGVjQ2FwYWJpbGl0aWVzLkZFQVRVUkVfU2VjdXJlUGxheWJhY2spOworICAgICAgICAgICAgICAgIGlmICgoc2VjdXJlUGxheWJhY2sgJiYgc2VjdXJlUGxheWJhY2tTdXBwb3J0ZWQpCisgICAgICAgICAgICAgICAgICAgICAgICB8fCAoIXNlY3VyZVBsYXliYWNrICYmICFzZWN1cmVQbGF5YmFja1JlcXVpcmVkKSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJzZWN1cmVQbGF5YmFjayAiICsgc2VjdXJlUGxheWJhY2sgKyAiIHdpbGwgdXNlICIgKyBpbmZvLmdldE5hbWUoKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAic2VjdXJlUGxheWJhY2sgIiArIHNlY3VyZVBsYXliYWNrICsgIiBza2lwICIgKyBpbmZvLmdldE5hbWUoKSk7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgLy8gbWltZSBpcyBub3Qgc3VwcG9ydGVkCisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gaW5mbzsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHByb3RlY3RlZCBpbnQgYWxsb2NhdGVDb2RlY3MoaW50IG1heCkgeworICAgICAgICBCdW5kbGUgZXh0cmFzID0gZ2V0SW50ZW50KCkuZ2V0RXh0cmFzKCk7CisgICAgICAgIGludCB0eXBlID0gVFlQRV9OT05TRUNVUkU7CisgICAgICAgIGlmIChleHRyYXMgIT0gbnVsbCkgeworICAgICAgICAgICAgdHlwZSA9IGV4dHJhcy5nZXRJbnQoInRlc3QtdHlwZSIsIHR5cGUpOworICAgICAgICAgICAgTG9nLmQoVEFHLCAidHlwZSBpczogIiArIHR5cGUpOworICAgICAgICB9CisKKyAgICAgICAgYm9vbGVhbiBzaG91bGRTa2lwID0gZmFsc2U7CisgICAgICAgIGJvb2xlYW4gc2VjdXJlUGxheWJhY2s7CisgICAgICAgIGlmICh0eXBlID09IFRZUEVfTk9OU0VDVVJFIHx8IHR5cGUgPT0gVFlQRV9NSVgpIHsKKyAgICAgICAgICAgIHNlY3VyZVBsYXliYWNrID0gZmFsc2U7CisgICAgICAgICAgICBNZWRpYUNvZGVjSW5mbyBpbmZvID0gZ2V0VGVzdENvZGVjSW5mbyhzZWN1cmVQbGF5YmFjayk7CisgICAgICAgICAgICBpZiAoaW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYWxsb2NhdGVDb2RlY3MobWF4LCBpbmZvLCBzZWN1cmVQbGF5YmFjayk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHNob3VsZFNraXAgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKCFzaG91bGRTa2lwKSB7CisgICAgICAgICAgICBpZiAodHlwZSA9PSBUWVBFX1NFQ1VSRSB8fCB0eXBlID09IFRZUEVfTUlYKSB7CisgICAgICAgICAgICAgICAgc2VjdXJlUGxheWJhY2sgPSB0cnVlOworICAgICAgICAgICAgICAgIE1lZGlhQ29kZWNJbmZvIGluZm8gPSBnZXRUZXN0Q29kZWNJbmZvKHNlY3VyZVBsYXliYWNrKTsKKyAgICAgICAgICAgICAgICBpZiAoaW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGFsbG9jYXRlQ29kZWNzKG1heCwgaW5mbywgc2VjdXJlUGxheWJhY2spOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHNob3VsZFNraXAgPSB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChzaG91bGRTa2lwKSB7CisgICAgICAgICAgICBMb2cuZChUQUcsICJ0ZXN0IHNraXBwZWQgYXMgdGhlcmUncyBubyBzdXBwb3J0ZWQgY29kZWMuIik7CisgICAgICAgICAgICBmaW5pc2hXaXRoUmVzdWx0KFJFU1VMVF9PSyk7CisgICAgICAgIH0KKworICAgICAgICBMb2cuZChUQUcsICJhbGxvY2F0ZUNvZGVjcyByZXR1cm5lZCAiICsgbUNvZGVjcy5zaXplKCkpOworICAgICAgICByZXR1cm4gbUNvZGVjcy5zaXplKCk7CisgICAgfQorCisgICAgcHJvdGVjdGVkIHZvaWQgYWxsb2NhdGVDb2RlY3MoaW50IG1heCwgTWVkaWFDb2RlY0luZm8gaW5mbywgYm9vbGVhbiBzZWN1cmVQbGF5YmFjaykgeworICAgICAgICBTdHJpbmcgbmFtZSA9IGluZm8uZ2V0TmFtZSgpOworICAgICAgICBDb2RlY0NhcGFiaWxpdGllcyBjYXBzID0gaW5mby5nZXRDYXBhYmlsaXRpZXNGb3JUeXBlKE1JTUUpOworICAgICAgICBNZWRpYUZvcm1hdCBmb3JtYXQgPSBnZXRUZXN0Rm9ybWF0KGNhcHMsIHNlY3VyZVBsYXliYWNrKTsKKyAgICAgICAgTWVkaWFDb2RlYyBjb2RlYyA9IG51bGw7CisgICAgICAgIGZvciAoaW50IGkgPSBtQ29kZWNzLnNpemUoKTsgaSA8IG1heDsgKytpKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIkNyZWF0ZSBjb2RlYyAiICsgbmFtZSArICIgIyIgKyBpKTsKKyAgICAgICAgICAgICAgICBjb2RlYyA9IE1lZGlhQ29kZWMuY3JlYXRlQnlDb2RlY05hbWUobmFtZSk7CisgICAgICAgICAgICAgICAgY29kZWMuc2V0Q2FsbGJhY2sobUNhbGxiYWNrKTsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJDb25maWd1cmUgY29kZWMgIiArIGZvcm1hdCk7CisgICAgICAgICAgICAgICAgY29kZWMuY29uZmlndXJlKGZvcm1hdCwgbnVsbCwgbnVsbCwgMCk7CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiU3RhcnQgY29kZWMgIiArIGZvcm1hdCk7CisgICAgICAgICAgICAgICAgY29kZWMuc3RhcnQoKTsKKyAgICAgICAgICAgICAgICBtQ29kZWNzLmFkZChjb2RlYyk7CisgICAgICAgICAgICAgICAgY29kZWMgPSBudWxsOworICAgICAgICAgICAgfSBjYXRjaCAoSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gIiArIGUuZ2V0TWVzc2FnZSgpKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJJT0V4Y2VwdGlvbiAiICsgZS5nZXRNZXNzYWdlKCkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfSBjYXRjaCAoTWVkaWFDb2RlYy5Db2RlY0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiQ29kZWNFeGNlcHRpb24gMHgiICsgSW50ZWdlci50b0hleFN0cmluZyhlLmdldEVycm9yQ29kZSgpKSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgIGlmIChjb2RlYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgInJlbGVhc2UgY29kZWMiKTsKKyAgICAgICAgICAgICAgICAgICAgY29kZWMucmVsZWFzZSgpOworICAgICAgICAgICAgICAgICAgICBjb2RlYyA9IG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHJvdGVjdGVkIHZvaWQgZmluaXNoV2l0aFJlc3VsdChpbnQgcmVzdWx0KSB7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbUNvZGVjcy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgTG9nLmQoVEFHLCAicmVsZWFzZSBjb2RlYyAjIiArIGkpOworICAgICAgICAgICAgbUNvZGVjcy5nZXQoaSkucmVsZWFzZSgpOworICAgICAgICB9CisgICAgICAgIG1Db2RlY3MuY2xlYXIoKTsKKyAgICAgICAgc2V0UmVzdWx0KHJlc3VsdCk7CisgICAgICAgIGZpbmlzaCgpOworICAgICAgICBMb2cuZChUQUcsICJhY3Rpdml0eSBmaW5pc2hlZCIpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBkb1VzZUNvZGVjcygpIHsKKyAgICAgICAgaW50IGN1cnJlbnQgPSAwOworICAgICAgICB0cnkgewor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NzKCkgeworICAgICAgICBtV29ya2VyVGhyZWFkID0gbmV3IFRocmVhZChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICBsb25nIHN0YXJ0ID0gU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCk7CisgICAgICAgICAgICAgICAgbG9uZyB0aW1lU2luY2VTdGFydGVkTXMgPSAwOworICAgICAgICAgICAgICAgIHdoaWxlIChtVXNlQ29kZWNzICYmICh0aW1lU2luY2VTdGFydGVkTXMgPCBUSU1FT1VUX01TKSkgeworICAgICAgICAgICAgICAgICAgICBkb1VzZUNvZGVjcygpOworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgVGhyZWFkLnNsZWVwKDUwIC8qIG1pbGxpcyAqLyk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB0aW1lU2luY2VTdGFydGVkTXMgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSAtIHN0YXJ0OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobUdvdFJlY2xhaW1lZEV4Y2VwdGlvbikgeworICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJHb3QgZXhwZWN0ZWQgcmVjbGFpbSBleGNlcHRpb24uIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGZpbmlzaFdpdGhSZXN1bHQoUkVTVUxUX09LKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSk7CisgICAgICAgIG1Xb3JrZXJUaHJlYWQuc3RhcnQoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgTUFYX0lOU1RBTk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mNlcyB3aXRob3V0IGhpdHRpbmcgaW5zdWZmaWNpZW50IHJlc291cmNlcy4gT3RoZXJ3aXNlLCBpdCBjb3VsZAorICAgIC8vIGJlIHRoYXQgUmVzb3VyY2VNYW5hZ2VyIHdhcyBub3QgYWJsZSB0byByZWNsYWltIGNvZGVjcyBmcm9tIHRoZSB0cmFuc2NvZGluZworICAgIC8vIHNlcnZpY2UgYXQgYWxsLCB3aGljaCBtZWFucyB0aGUgcmVzb3VyY2UgbWFuYWdlbWVudCBpcyBicm9rZW4uCisgICAgaWYgKGV2ZW50cy5zaXplKCkgPiAxKSB7CisgICAgICAgIEVYUEVDVF9UUlVFKGV2ZW50cy5zaXplKCkgPj0gMyk7CisgICAgICAgIHNpemVfdCBpID0gMDsKKyAgICAgICAgZm9yIChhdXRvJiBldmVudCA6IGV2ZW50cykgeworICAgICAgICAgICAgaWYgKGkgPT0gMCkgeworICAgICAgICAgICAgICAgIEVYUEVDVF9FUShldmVudCwgRXZlbnRUcmFja2VyOjpQYXVzZShDTElFTlQoMSksIDApKTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoaSA9PSBldmVudHMuc2l6ZSgpIC0gMikgeworICAgICAgICAgICAgICAgIEVYUEVDVF9FUShldmVudCwgRXZlbnRUcmFja2VyOjpSZXN1bWUoQ0xJRU5UKDEpLCAwKSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGkgPT0gZXZlbnRzLnNpemUoKSAtIDEpIHsKKyAgICAgICAgICAgICAgICBFWFBFQ1RfRVEoZXZlbnQsIEV2ZW50VHJhY2tlcjo6RmluaXNoZWQoQ0xJRU5UKDEpLCAwKSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIEVYUEVDVF9UUlVFKGV2ZW50ID09IEV2ZW50VHJhY2tlcjo6UGF1c2UoQ0xJRU5UKDEpLCAwKSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50ID09IEV2ZW50VHJhY2tlcjo6UmVz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bmdTZXJ2aWNlU2ltdWxhdGVkVGVzdCgpIHsKKyAgICAgICAgQUxPR0koIk1lZGlhVHJhbnNjb2RpbmdTZXJ2aWNlUmVzb3VyY2VUZXN0IGRlc3Ryb3llZCIpOworICAgIH0KKworICAgIHZvaWQgdGVzdFBhY2VySGVscGVyKGludCBudW1TdWJtaXRzLCBpbnQgc2Vzc2lvbkR1cmF0aW9uTXMsIGludCBleHBlY3RlZFN1Y2Nlc3MpIHsKKyAgICAgICAgLy8gSWRsZSB0byBjbGVhciBvdXQgYnVyc3QgaGlzdG9yeS4KKyAgICAgICAgdXNsZWVwKGtTaW11bGF0ZWRQYWNlckJ1cnN0VGhyZXNob2xkTXMgKiAyICogMTAwMCk7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtU3VibWl0czsgaSsrKSB7CisgICAgICAgICAgICBFWFBFQ1RfVFJVRShtQ2xpZW50My0+c3VibWl0KGksICJ0ZXN0X3NvdXJjZV9maWxlXzAiLCAidGVzdF9kZXN0aW5hdGlvbl9maWxlXzAiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUcmFuc2NvZGluZ1Nlc3Npb25Qcmlvcml0eTo6a05vcm1hbCwgLTEgLypiaXRyYXRlQnBzKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0xIC8qb3ZlcnJpZGVQaWQqLywgLTEgLypvdmVycmlkZVVpZCovLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uRHVyYXRpb25NcykpOworICAgICAgICB9CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZXhwZWN0ZWRTdWNjZXNzOyBpKyspIHsKKyAgICAgICAgICAgIEVYUEVDVF9FUShtQ2xpZW50My0+cG9wKGtQYWRkaW5nVXMpLCBFdmVudFRyYWNrZXI6OlN0YXJ0KENMSUVOVCgzKSwgaSkpOworICAgICAgICAgICAgRVhQRUNUX0V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Rlcjo6U3RhdHVzIHVucmVnaXN0ZXJBdWRpb1RocmVhZChpbnQzMl90IHN0cmVhbUhhbmRsZSwgaW50MzJfdCBjbGllbnRUaHJlYWRJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCogX2FpZGxfcmV0dXJuKSBvdmVycmlkZTsKIAogICAgIGFhdWRpb19yZXN1bHRfdCBzdGFydENsaWVudChhYXVkaW86OmFhdWRpb19oYW5kbGVfdCBzdHJlYW1IYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGFuZHJvaWQ6OkF1ZGlvQ2xpZW50JiBjbGllbnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGF1ZGlvX2F0dHJpYnV0ZXNfdCAqYXR0ciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqY2xpZW50SGFuZGxlKSBvdmVycmlkZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqY2xpZW50SGFuZGxlKTsKIAogICAgIGFhdWRpb19yZXN1bHRfdCBzdG9wQ2xpZW50KGFhdWRpbzo6YWF1ZGlvX2hhbmRsZV90IHN0cmVhbUhhbmRsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgY2xpZW50SGFuZGxlKSBvdmVycmlkZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgY2xpZW50SGFuZGxlKTsKIAogIC8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KICAvLyBUaGUgZm9sbG93aW5nIHB1YmxpYyBtZXRob2RzIGFyZSBvbmx5IGNhbGxlZCBmcm9tIHRoZSBzZXJ2aWNlIGFuZCBOT1QgYnkgQmluZGVyLgpAQCAtMTAxLDYgKzEwMywyOSBAQAogICAgIGFhdWRpb19yZXN1bHRfdCBjbG9zZVN0cmVhbShzcDxhYXVkaW86OkFBdWRpb1NlcnZpY2VTdHJlYW1CYXNlPiBzZXJ2aWNlU3RyZWFtKTsKIAogcHJpdmF0ZToKKyAgICBjbGFzcyBBZGFwdGVyIDogcHVibGljIGFhdWRpbzo6QUF1ZGlvQmluZGVyQWRhcHRlciB7CisgICAgcHVibGljOgorICAgICAgICBleHBsaWNpdCBBZGFwdGVyKEFBdWRpb1NlcnZpY2UgKnNlcnZpY2UpCisgICAgICAgICAgICAgICAgOiBhYXVkaW86OkFBdWRpb0JpbmRlckFkYXB0ZXIoc2VydmljZSksCisgICAgICAgICAgICAgICAgICBtU2VydmljZShzZXJ2aWNlKSB7fQorCisgICAgICAgIGFhdWRpb19yZXN1bHRfdCBzdGFydENsaWVudChhYXVkaW86OmFhdWRpb19oYW5kbGVfdCBzdHJlYW1IYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhbmRyb2lkOjpBdWRpb0NsaWVudCAmY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fYXR0cmlidXRlc190ICphdHRyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqY2xpZW50SGFuZGxlKSBvdmVycmlkZSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UtPnN0YXJ0Q2xpZW50KHN0cmVhbUhhbmRsZSwgY2xpZW50LCBhdHRyLCBjbGllbnRIYW5kbGUpOworICAgICAgICB9CisKKyAgICAgICAgYWF1ZGlvX3Jlc3VsdF90IHN0b3BDbGllbnQoYWF1ZGlvOjphYXVkaW9faGFuZGxlX3Qgc3RyZWFtSGFuZ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nVyc3Q/Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZpZm8tPmdldEVtcHR5RnJhbWVzQXZhaWxhYmxlKCkgPAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RnJhbWVzUGVyQnVyc3QoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW1TaGFyZWQtPmluY3JlbWVudFhSdW5Db3VudCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZm8tPndyaXRlKG1EaXN0cmlidXRpb25CdWZmZXIsIGdldEZyYW1lc1BlckJ1cnN0KCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnRGcmFtZXNXcml0dGVuID0gZmlmby0+Z2V0V3JpdGVDb3VudGVyKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBpZiAoY2xpZW50RnJhbWVzV3JpdHRlbiA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgdGltZXN0YW1wIHJlcHJlc2VudHMgdGhlIGNvbXBsZXRpb24gb2YgZGF0YSBiZWluZyB3cml0dGVuIGludG8gdGhlCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBjbGllbnQgYnVmZmVyLiBJdCBpcyBzZW50IHRvIHRoZSBjbGllbnQgYW5kIHVzZWQgaW4gdGhlIHRpbWluZyBtb2RlbAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gdG8gZGVjaWRlIHdoZW4gZGF0YSB3aWxsIGJlIGF2YWlsYWJsZSB0byByZWFkLgotICAgICAgICAgICAgICAgICAgICAgICAgVGltZXN0YW1wIHRpbWVzdGFtcChjbGllbnRGcmFtZXNXcml0dGVuLCBBdWRpb0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AgICAgICAgICBzdGQ6OnRocmVhZCBhc3luY1Rhc2soW3RoaXMsIGRldmljZUlkXSgpIHsKLSAgICAgICAgICAgICAgICBkaXNjb25uZWN0UmVnaXN0ZXJlZFN0cmVhbXMoKTsKLSAgICAgICAgICAgICAgICBzZXREZXZpY2VJZChkZXZpY2VJZCk7CisgICAgICAgICAgICBhbmRyb2lkOjpzcDxBQXVkaW9TZXJ2aWNlRW5kcG9pbnRNTUFQPiBob2xkRW5kcG9pbnQodGhpcyk7CisgICAgICAgICAgICBzdGQ6OnRocmVhZCBhc3luY1Rhc2soW2hvbGRFbmRwb2ludCwgZGV2aWNlSWRdKCkgeworICAgICAgICAgICAgICAgIEFMT0dEKCJvblJvdXRpbmdDaGFuZ2VkKCkgYXN5bmNUYXNrIGxhdW5jaGVkIik7CisgICAgICAgICAgICAgICAgaG9sZEVuZHBvaW50LT5kaXNjb25uZWN0UmVnaXN0ZXJlZFN0cmVhbXMoKTsKKyAgICAgICAgICAgICAgICBob2xkRW5kcG9pbnQtPnNldERldmljZUlkKGRldmljZUlkKTsKICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgYXN5bmNUYXNrLmRldGFjaCgpOwogICAgICAgICB9IGVsc2UgewpAQCAtMzc4LDMgKzQxOCwxOCBAQAogICAgIHBhcmNlbGFibGUubURvd25EYXRhUXVldWVQYXJjZWxhYmxlLnNldENhcGFjaXR5SW5GcmFtZXMoZ2V0QnVmZmVyQ2FwYWNpdHkoKSk7CiAgICAgcmV0dXJuIEFBVURJT19PSzsKIH0KKworYWF1ZGlvX3Jlc3VsdF90IEFBdWRpb1NlcnZpY2VFbmRwb2ludE1NQVA6OmdldEV4dGVybmFsUG9zaXRpb24odWludDY0X3QgKnBvc2l0aW9uRnJhbWVzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50NjRfdCAqdGltZU5hbm9zKQoreworICAgIGlmICghbUV4dGVybmFsUG9zaXRp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LiBBc3N1bWUgdGhlIHRocmVhZCB3aWxsIGNhbGwgZGVjU3Ryb25nKCkuCisgICAgdGhpcy0+aW5jU3Ryb25nKG51bGxwdHIpOwogICAgIGFhdWRpb19yZXN1bHRfdCByZXN1bHQgPSBnZXRTdHJlYW1JbnRlcm5hbCgpLT5jcmVhdGVUaHJlYWQocGVyaW9kTmFub3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhYXVkaW9fZW5kcG9pbnRfdGhyZWFkX3Byb2MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmRwb2ludEZvclRocmVhZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzKTsKICAgICBpZiAocmVzdWx0ICE9IEFBVURJT19PSykgewotICAgICAgICAvLyBUaGUgdGhyZWFkIGNhbid0IGRlbGV0ZSBpdCBzbyB3ZSBoYXZlIHRvIGRvIGl0IGhlcmUuCi0gICAgICAgIGRlbGV0ZSBlbmRwb2ludEZvclRocmVhZDsKKyAgICAgICAgdGhpcy0+ZGVjU3Ryb25nKG51bGxwdHIpOyAvLyBCZWNhdXNlIHRoZSB0aHJlYWQgd29uJ3QgZG8gaXQuCiAgICAgfQogICAgIHJldHVybiByZXN1bHQ7CiB9CiAKIGFhdWRpb19yZXN1bHRfdCBhYXVkaW86OkFBdWRpb1NlcnZpY2VFbmRwb2ludFNoYXJlZDo6c3RvcFNoYXJpbmdUaHJlYWQoKSB7CiAgICAgbUNhbGxiYWNrRW5hYmxlZC5zdG9yZShmYWxzZSk7Ci0gICAgYWF1ZGlvX3Jlc3VsdF90IHJlc3VsdCA9IGdldFN0cmVhbUludGVybmFsKCktPmpvaW5UaHJlYWQoTlVMTCk7Ci0gICAgcmV0dXJuIHJlc3VsdDsKKyAgICByZXR1cm4gZ2V0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QgY29udHJpYnV0ZWQgYnkgSXR0aWFtIFN5c3RlbXMgUHZ0LiBMdGQsIEJhbmdhbG9yZQorICovCisKK3BhY2thZ2UgeworICAgIC8vIFNlZTogaHR0cDovL2dvL2FuZHJvaWQtbGljZW5zZS1mYXEKKyAgICAvLyBBIGxhcmdlLXNjYWxlLWNoYW5nZSBhZGRlZCAnZGVmYXVsdF9hcHBsaWNhYmxlX2xpY2Vuc2VzJyB0byBpbXBvcnQKKyAgICAvLyBhbGwgb2YgdGhlICdsaWNlbnNlX2tpbmRzJyBmcm9tICJmcmFtZXdvcmtzX2F2X2xpY2Vuc2UiCisgICAgLy8gdG8gZ2V0IHRoZSBiZWxvdyBsaWNlbnNlIGtpbmRzOgorICAgIC8vICAgU1BEWC1saWNlbnNlLWlkZW50aWZpZXItQXBhY2hlLTIuMAorICAgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWyJmcmFtZXdvcmtzX2F2X2xpY2Vuc2UiXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogIm9ib2VzZXJ2aWNlX2Z1enplciIsCisgICAgc3JjczogWworICAgICAgICAib2JvZXNlcnZpY2VfZnV6emVyLmNwcCIsCisgICAgXSwKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGliYWF1ZGlvX2ludGVybmFsIiwKKyAgICAgICAgImxpYmF1ZGlvY2xpZW50IiwKKyAgICAgICAgImxpYmF1ZGlvZmxpbmdlciIsCisgICAgICAgICJsaWJhdWRpb3V0aWxzIiwKKyAgICAgICAgImxpYm1lZGlhX2hlbHBlciIsCisgICAgICAgICJsaWJtZWRpYW1ldHJpY3MiLAorICAgICAgICAibGlibWVkaWF1dGlscyIsCisgICAgICAgICJsaWJiYXNlIiwKKyAgICAgICAgImxpYmJpbmRlciIsCisgICAgICAgICJsaWJjdXRpbHMiLAorICAgICAgICAibGlibG9nIiwKKyAgICAgICAgImxpYnV0aWxzIiwKKyAgICAgICAgImFhdWRpby1haWRsLWNwcCIsCisgICAgICAgICJmcmFtZXdvcmstcGVybWlzc2lvbi1haWRsLWNwcCIsCisgICAgICAgICJsaWJhdWRpb2NsaWVudF9haWRsX2NvbnZlcnNpb24iLAorICAgIF0sCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYmFhdWRpb3NlcnZpY2UiLAorICAgIF0sCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJmcmFtZXdvcmtzL2F2L3NlcnZpY2VzL29ib2VzZXJ2aWNlIiwKKyAgICBdLAorICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJhdWRpb2hhbF9oZWFkZXJzIiwKKyAgICBdLAorICAgIGNmbGFnczogWworICAgICAgICAiLVdhbGwiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgICAgICItV25vLXVudXNlZC1wYXJhbWV0ZXIiLAorICAgIF0sCisgICAgZnV6el9jb25maWc6IHsKKyAgICAgICAgY2M6IFsKKyAgICAgICAgICAgICJhbmRyb2lkLW1lZGlhLWZ1enppbmctcmVwb3J0c0Bnb29nbGUuY29tIiwKKyAgICAgICAgXSwKKyAgICAgICAgY29tcG9uZW50aWQ6IDE1NTI3NiwKKyAgICB9LAorfQpkaWZmIC0tZ2l0IGEvc2VydmljZXMvb2JvZXNlcnZpY2UvZnV6emVyL1JFQURNRS5tZCBiL3NlcnZpY2VzL29ib2VzZXJ2aWNlL2Z1enplci9SRUFETUUubWQKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMDBiODVkZgotLS0gL2Rldi9udWxsCisrKyBiL3NlcnZpY2VzL29ib2VzZXJ2aWNlL2Z1enplci9SRUFETUUubWQKQEAgLTAsMCArMSw2NSBAQAorIyBGdXp6ZXIgZm9yIGxpYmFhdWRpb3NlcnZpY2UKKworIyMgUGx1Z2luIERlc2lnbiBDb25zaWRlcmF0aW9ucworVGhlIGZ1enplciBwbHVnaW4gZm9yIGxpYmFhdWRpb3NlcnZpY2UgaXMgZGVza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VOU1BFQ0lGSUVELAorICAgIEFBVURJT19GT1JNQVRfUENNX0kxNiwKKyAgICBBQVVESU9fRk9STUFUX1BDTV9GTE9BVCwKK307CisKK2FhdWRpb191c2FnZV90IGtBQXVkaW9Vc2FnZXNbXSA9IHsKKyAgICBBQVVESU9fVVNBR0VfTUVESUEsCisgICAgQUFVRElPX1VTQUdFX1ZPSUNFX0NPTU1VTklDQVRJT04sCisgICAgQUFVRElPX1VTQUdFX1ZPSUNFX0NPTU1VTklDQVRJT05fU0lHTkFMTElORywKKyAgICBBQVVESU9fVVNBR0VfQUxBUk0sCisgICAgQUFVRElPX1VTQUdFX05PVElGSUNBVElPTiwKKyAgICBBQVVESU9fVVNBR0VfTk9USUZJQ0FUSU9OX1JJTkdUT05FLAorICAgIEFBVURJT19VU0FHRV9OT1RJRklDQVRJT05fRVZFTlQsCisgICAgQUFVRElPX1VTQUdFX0FTU0lTVEFOQ0VfQUNDRVNTSUJJTElUWSwKKyAgICBBQVVESU9fVVNBR0VfQVNTSVNUQU5DRV9OQVZJR0FUSU9OX0dVSURBTkNFLAorICAgIEFBVURJT19VU0FHRV9BU1NJU1RBTkNFX1NPTklGSUNBVElPTiwKKyAgICBBQVVESU9fVVNBR0VfR0FNRSwKKyAgICBBQVVESU9fVVNBR0VfQVNTSVNUQU5ULAorICAgIEFBVURJT19TWVNURU1fVVNBR0VfRU1FUkdFTkNZLAorICAgIEFBVURJT19TWVNURU1fVVNBR0VfU0FGRVRZLAorICAgIEFBVURJT19TWVNURU1fVVNBR0VfVkVISUNMRV9TVEFUVVMsCisgICAgQUFVRElPX1NZU1RFTV9VU0FHRV9BTk5PVU5DRU1FTlQsCit9OworCithYXVkaW9fY29udGVudF90eXBlX3Qga0FBdWRpb0NvbnRlbnRUeXBlc1tdID0geworICAgIEFBVURJT19DT05URU5UX1RZUEVfU1BFRUNILAorICAgIEFBVURJT19DT05URU5UX1RZUEVfTVVTSUMsCisgICAgQUFVRElPX0NPTlRFTlRfVFlQRV9NT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GxlX3Qgc3RyZWFtSGFuZGxlKSBvdmVycmlkZTsKKworICAgIGFhdWRpb19yZXN1bHRfdCByZWdpc3RlckF1ZGlvVGhyZWFkKGFhdWRpb19oYW5kbGVfdCBzdHJlYW1IYW5kbGUsIHBpZF90IGNsaWVudFRocmVhZElkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDY0X3QgcGVyaW9kTmFub3NlY29uZHMpIG92ZXJyaWRlOworCisgICAgYWF1ZGlvX3Jlc3VsdF90IHVucmVnaXN0ZXJBdWRpb1RocmVhZChhYXVkaW9faGFuZGxlX3Qgc3RyZWFtSGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkX3QgY2xpZW50VGhyZWFkSWQpIG92ZXJyaWRlOworCisgICAgYWF1ZGlvX3Jlc3VsdF90IHN0YXJ0Q2xpZW50KGFhdWRpb19oYW5kbGVfdCBzdHJlYW1IYW5kbGUgVU5VU0VEX1BBUkFNLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBdWRpb0NsaWVudCAmY2xpZW50IFVOVVNFRF9QQVJBTSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYXVkaW9fYXR0cmlidXRlc190ICphdHRyIFVOVVNFRF9QQVJBTSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaW9fcG9ydF9oYW5kbGVfdCAqY2xpZW50SGFuZGxlIFVOVVNFRF9QQVJBTSkgb3ZlcnJpZGUgeworICAgICAgICByZXR1cm4gQUFVRElPX0VSUk9SX1VOQVZBSUxBQkxFOworICAgIH0KKworICAgIGFhdWRpb19yZXN1bHRfdCBzdG9wQ2xpZW50KGFhdWRpb19oYW5kbGVfdCBzdHJlYW1IYW5kbGUgVU5VU0VEX1BBUkFNLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1ZGlvX3BvcnRfaGFuZGxlX3QgY2xpZW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maWd1cmF0aW9uKCkuc2V0Q29udGVudFR5cGUoCisgICAgICAgIGZkcC5Db25zdW1lQm9vbCgpID8gZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQzMl90PigpCisgICAgICAgICAgICAgICAgICAgICAgICAgIDoga0FBdWRpb0NvbnRlbnRUeXBlc1tmZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTxpbnQzMl90PigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwga051bUFBdWRpb0NvbnRlbnRUeXBlcyAtIDEpXSk7CisgICAgcmVxdWVzdC5nZXRDb25maWd1cmF0aW9uKCkuc2V0SW5wdXRQcmVzZXQoCisgICAgICAgIGZkcC5Db25zdW1lQm9vbCgpID8gZmRwLkNvbnN1bWVJbnRlZ3JhbDxpbnQzMl90PigpCisgICAgICAgICAgICAgICAgICAgICAgICAgIDoga0FBdWRpb0lucHV0UHJlc2V0c1tmZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTxpbnQzMl90PigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwga051bUFBdWRpb0lucHV0UHJlc2V0cyAtIDEpXSk7CisgICAgcmVxdWVzdC5nZXRDb25maWd1cmF0aW9uKCkuc2V0UHJpdmFjeVNlbnNpdGl2ZShmZHAuQ29uc3VtZUJvb2woKSk7CisKKyAgICByZXF1ZXN0LmdldENvbmZpZ3VyYXRpb24oKS5zZXRCdWZmZXJDYXBhY2l0eShmZHAuQ29uc3VtZUludGVncmFsPGludDMyX3Q+KCkpOworCisgICAgYWF1ZGlvX2hhbmRsZV90IHN0cmVhbSA9IG1DbGllbnQtPm9wZW5TdHJlYW0ocmVxdWVzdCwgY29uZmlndXJhdGlvbk91dHB1dCk7CisgICAgaWYgKHN0cmVhbSA8IDApIHsKKyAgICAgICAgLy8gaW52YWxpZCByZXF1ZXN0LCBzdHJlYW0gbm90IG9wZW5lZC4KKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICB3aGlsZSAoZmRwLnJlbWFpbmluZ19ieXRlcygpKSB7CisgICAgICAgIEF1ZGlvRW5kcG9pbnRQYXJjZWxhYmxlIGF1ZGlvRW5kcG9pbnRQYXJjZWxhYmxlOworICAgICAgICBpbnQgYWN0aW9uID0gZmRwLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8aW50MzJfdD4oMCwgNCk7CisgICAgICAgIHN3aXRjaCAoYWN0aW9uKSB7CisgICAgICAgICAgICBjYXNlIDA6CisgICAgICAgICAgICAgICAgbUNsaWVudC0+Z2V0U3RyZWFtRGVzY3JpcHRpb24oc3RyZWFtLCBhdWRpb0VuZHBvaW50UGFyY2VsYWJsZSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIDE6CisgICAgICAgICAgICAgICAgbUNsaWVudC0+c3RhcnRTdHJlYW0oc3RyZWFtKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgMjoKKyAgICAgICAgICAgICAgICBtQ2xpZW50LT5wYXVzZVN0cmVhbShzdHJlYW0pOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSAzOgorICAgICAgICAgICAgICAgIG1DbGllbnQtPnN0b3BTdHJlYW0oc3RyZWFtKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgNDoKKyAgICAgICAgICAgICAgICBtQ2xpZW50LT5mbHVzaFN0cmVhbShzdHJlYW0pOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorICAgIG1DbGllbnQtPmNsb3NlU3RyZWFtKHN0cmVhbSk7CisgICAgYXNzZXJ0KG1DbGllbnQtPmdldERlYXRoQ291bnQoKSA9PSAwKTsKK30KKworZXh0ZXJuICJDIiBpbnQgTExWTUZ1enplclRlc3RPbmVJbnB1dChjb25zdCB1aW50OF90ICpkYXRhLCBzaXplX3Qgc2l6ZSkgeworICAgIGlmIChzaXplIDwgMSkgeworICAgIC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uZF9pbmZvIiwKKyAgICBzcmNzOiBbCisgICAgICAgICJhaWRsL2FuZHJvaWQvbWVkaWEvdHYvdHVuZXIvVHVuZXJGcm9udGVuZEluZm8uYWlkbCIsCisgICAgICAgICJhaWRsL2FuZHJvaWQvbWVkaWEvdHYvdHVuZXIvVHVuZXJGcm9udGVuZCpDYXBhYmlsaXRpZXMuYWlkbCIsCisgICAgXSwKKyAgICBwYXRoOiAiYWlkbCIsCit9CisKK2FpZGxfaW50ZXJmYWNlIHsKKyAgICBuYW1lOiAidHZfdHVuZXJfYWlkbF9pbnRlcmZhY2UiLAorICAgIHVuc3RhYmxlOiB0cnVlLAorICAgIGxvY2FsX2luY2x1ZGVfZGlyOiAiYWlkbCIsCisgICAgc3JjczogWworICAgICAgICAiOnR2X3R1bmVyX2FpZGwiLAorICAgIF0sCisgICAgaW1wb3J0czogWworICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5jb21tb24tVjIiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS5jb21tb24uZm1xLVYxIiwKKyAgICBdLAorCisgICAgYmFja2VuZDogeworICAgICAgICBqYXZhOiB7CisgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSwKKyAgICAgICAgfSwKKyAgICAgICAgY3BwOiB7CisgICAgICAgICAgICBlbmFibGVkOiBmYWxzZSwKKyAgICAgICAgfSwKKyAgICAgICAgbmRrOiB7CisgICAgICAgICAgICBlbmFibGVkOiB0cnVlLAorICAgICAgICB9LAorICAgIH0sCit9CisKK2FpZGxfaW50ZXJmYWNlIHsKKyAgICBuYW1lOiAidHZfdHVuZXJfZnJvbnRlbmRfaW5mb19haWRsX2ludGVyZmFjZSIsCisgICAgdW5zdGFibGU6IHRydWUsCisgICAgbG9jYWxfaW5jbHVkZV9kaXI6ICJhaWRsIiwKKyAgICBzcmNzOiBbCisgICAgICAgICI6dHZfdHVuZXJfZnJvbnRlbmRfaW5mbyIsCisgICAgXSwKKworICAgIGJhY2tlbmQ6IHsKKyAgICAgICAgamF2YTogeworICAgICAgICAgICAgZW5hYmxlZDogdHJ1ZSwKKyAgICAgICAgfSwKKyAgICAgICAgY3BwOiB7CisgICAgICAgICAgICBlbmFibGVkOiB0cnVlLAorICAgICAgICB9LAorICAgICAgICBuZGs6IHsKKyAgICAgICAgICAgIGVuYWJsZWQ6IHRydWUsCisgICAgICAgIH0sCisgICAgfSwKK30KKworY2NfbGlicmFyeSB7CisgICAgbmFtZTogImxpYnR1bmVyc2VydmljZSIsCisKKyAgICBzcmNzOiBbCisgICAgICAgICJUdW5lciouY3BwIiwKKyAgICBdLAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUudHYudHVuZXJAMS4wIiwKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUudHYudHVuZXJAMS4xIiwKKyAgICAgICAgImxpYmJhc2UiLAorICAgICAgICAibGliYmluZGVyIiwKKyAgICAgICAgImxpYmJpbmRlcl9uZGsiLAorICAgICAgICAibGliY3V0aWxzIiwKKyAgICAgICAgImxpYmZtcSIsCisgICAgICAgICJsaWJoaWRsYmFzZSIsCisgICAgICAgICJsaWJsb2ciLAorICAgICAgICAibGlibWVkaWEiLAorICAgICAgICAibGlidXRpbHMiLAorICAgICAgICAidHZfdHVuZXJfYWlkbF9pbnRlcmZhY2UtbmRrX3BsYXRmb3JtIiwKKyAgICAgICAgInR2X3R1bmVyX3Jlc291cmNlX21hbmFnZXJfYWlkbF9pbnRlcmZhY2UtbmRrX3BsYXRmb3JtIiwKKyAgICAgICAgInR2X3R1bmVyX3Jlc291cmNlX21hbmFnZXJfYWlkbF9pbnRlcmZhY2UtY3BwIiwKKyAgICBdLAorCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImFuZHJvaWQuaGFyZHdhcmUuY29tbW9uLmZtcS1WMS1uZGtfcGxhdGZvcm0iLAorICAgICAgICAibGliYWlkbGNvbW1vbnN1cHBvcnQiLAorICAgIF0sCisKKyAgICBpbmNsdWRlX2RpcnM6IFsKKyAgICAgICAgImZyYW1ld29ya3MvYXYvaW5jbHVkZSIKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV2Vycm9yIiwKKyAgICAgICAgIi1XYWxsIiwKKyAgICBdLAorCisgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWyIuIl0sCit9CisKKworY2NfYmluYXJ5IHsKKyAgICBuYW1lOiAibWVkaWF0dW5lciIsCisKKyAgICBzcmNzOiBbCisgICAgICAgICJtYWluX3R1bmVyc2VydmljZS5jcHAiLAorICAgIF0sCisKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS50di50dW5lckAxLjAiLAorICAgICAgICAiYW5kcm9pZC5oYXJkd2FyZS50di50dW5lckAxLjEiLAorICAgICAgICAibGliYmFzZSIsCisgICAgICAgICJsaWJiaW5kZXIiLAorICAgICAgICAibGliZm1xIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgICAgICJsaWJ0dW5lcnNlcnZpY2UiLAorICAgICAgICAibGlidXRpbHMiLAorICAgICAgICAidHZfdHVuZXJfcmVzb3VyY2VfbWFuYWdlcl9haWRsX2ludGVyZmFjZS1uZGtfcGxhdGZvcm0iLAorICAgICAgICAidHZfdHVuZXJfcmVzb3VyY2VfbWFuYWdlcl9haWRsX2ludGVyZmFjZS1jcHAiLAorICAgIF0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAidHZfdHVuZXJfYWlkbF9pbnRlcmZhY2UtbmRrX3BsYXRmb3JtIiwKKyAgICBdLAorCisgICAgaW5pdF9yYzogWyJtZWRpYXR1bmVyLnJjIl0sCisKKyAgICBjZmxhZ3M6IFsKKyAgICAgICAgIi1XZXJyb3IiLAorICAgICAgICAiLVdhbGwiLAorICAgIF0sCit9CmRpZmYgLS1naXQgYS9zZXJ2aWNlcy90dW5lci9PV05FUlMgYi9zZXJ2aWNlcy90dW5lci9PV05FUlMKbmV3IGZpb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b25zdCBzaGFyZWRfcHRyPElUdW5lckZpbHRlcj4mIHR1bmVyRmlsdGVyLCBpbnQqIF9haWRsX3JldHVybikgeworICAgIGlmIChtRGVtdXggPT0gbnVsbHB0cikgeworICAgICAgICBBTE9HRSgiSURlbXV4IGlzIG5vdCBpbml0aWFsaXplZC4iKTsKKyAgICAgICAgcmV0dXJuIFN0YXR1czo6ZnJvbVNlcnZpY2VTcGVjaWZpY0Vycm9yKHN0YXRpY19jYXN0PGludDMyX3Q+KFJlc3VsdDo6VU5BVkFJTEFCTEUpKTsKKyAgICB9CisKKyAgICB1aW50MzJfdCBhdlN5bmNId0lkOworICAgIFJlc3VsdCByZXM7CisgICAgc3A8SUZpbHRlcj4gaGFsRmlsdGVyID0gc3RhdGljX2Nhc3Q8VHVuZXJGaWx0ZXIqPih0dW5lckZpbHRlci5nZXQoKSktPmdldEhhbEZpbHRlcigpOworICAgIG1EZW11eC0+Z2V0QXZTeW5jSHdJZChoYWxGaWx0ZXIsCisgICAgICAgICAgICBbJl0oUmVzdWx0IHIsIHVpbnQzMl90IGlkKSB7CisgICAgICAgICAgICAgICAgcmVzID0gcjsKKyAgICAgICAgICAgICAgICBhdlN5bmNId0lkID0gaWQ7CisgICAgICAgICAgICB9KTsKKyAgICBpZiAocmVzICE9IFJlc3VsdDo6U1VDQ0VTUykgeworICAgICAgICByZXR1cm4gU3RhdHVzOjpmcm9tU2VydmljZVNwZWNpZmljRXJyb3Ioc3RhdGljX2Nhc3Q8aW50MzJfdD4ocmVzKSk7CisgICAgfQorCisgICAgKl9haWRsX3JldHVybiA9IChpbnQpYXZTeW5jSHdJZDsKKyAgICByZXR1cm4gU3RhdHVzOjpvaygpOworfQorCitTdGF0dXMgVHVuZXJEZW11eDo6Z2V0QXZTeW5jVGltZShpbnQgYXZTeW5jSHdJZCwgaW50NjRfdCogX2FpZGxfcmV0dXJuKSB7CisgICAgaWYgKG1EZW11eCA9PSBudWxscHRyKSB7CisgICAgICAgIEFMT0dFKCJJRGV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dWludDMyX3Q+KHNldHRpbmdzLmxvd1RocmVzaG9sZCksCisgICAgICAgICAgICAgICAgLmhpZ2hUaHJlc2hvbGQgPSBzdGF0aWNfY2FzdDx1aW50MzJfdD4oc2V0dGluZ3MuaGlnaFRocmVzaG9sZCksCisgICAgICAgICAgICAgICAgLmRhdGFGb3JtYXQgPSBzdGF0aWNfY2FzdDxEYXRhRm9ybWF0PihzZXR0aW5ncy5kYXRhRm9ybWF0KSwKKyAgICAgICAgICAgICAgICAucGFja2V0U2l6ZSA9IHN0YXRpY19jYXN0PHVpbnQ4X3Q+KHNldHRpbmdzLnBhY2tldFNpemUpLAorICAgICAgICAgICAgfSk7CisgICAgICAgICAgICByZXR1cm4gczsKKyAgICAgICAgfQorICAgICAgICBjYXNlIER2clR5cGU6OlJFQ09SRDogeworICAgICAgICAgICAgcy5yZWNvcmQoeworICAgICAgICAgICAgICAgIC5zdGF0dXNNYXNrID0gc3RhdGljX2Nhc3Q8dWludDhfdD4oc2V0dGluZ3Muc3RhdHVzTWFzayksCisgICAgICAgICAgICAgICAgLmxvd1RocmVzaG9sZCA9IHN0YXRpY19jYXN0PHVpbnQzMl90PihzZXR0aW5ncy5sb3dUaHJlc2hvbGQpLAorICAgICAgICAgICAgICAgIC5oaWdoVGhyZXNob2xkID0gc3RhdGljX2Nhc3Q8dWludDMyX3Q+KHNldHRpbmdzLmhpZ2hUaHJlc2hvbGQpLAorICAgICAgICAgICAgICAgIC5kYXRhRm9ybWF0ID0gc3RhdGljX2Nhc3Q8RGF0YUZvcm1hdD4oc2V0dGluZ3MuZGF0YUZvcm1hdCksCisgICAgICAgICAgICAgICAgLnBhY2tldFNpemUgPSBzdGF0aWNfY2FzdDx1aW50OF90PihzZXR0aW5ncy5wYWNrZXRTaXplKSwKKyAgICAgICAgICAgIH0pOworICAgICAgICAgICAgcmV0dXJuIHM7CisgICAgICAgIH0KKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKyAgIC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bHRlclNldHRpbmdzIHNldHRpbmdzOworICAgIHN3aXRjaCAoY29uZmlnLmdldFRhZygpKSB7CisgICAgICAgIGNhc2UgVHVuZXJGaWx0ZXJDb25maWd1cmF0aW9uOjp0czogeworICAgICAgICAgICAgZ2V0SGlkbFRzU2V0dGluZ3MoY29uZmlnLCBzZXR0aW5ncyk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIFR1bmVyRmlsdGVyQ29uZmlndXJhdGlvbjo6bW10cDogeworICAgICAgICAgICAgZ2V0SGlkbE1tdHBTZXR0aW5ncyhjb25maWcsIHNldHRpbmdzKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgVHVuZXJGaWx0ZXJDb25maWd1cmF0aW9uOjppcDogeworICAgICAgICAgICAgZ2V0SGlkbElwU2V0dGluZ3MoY29uZmlnLCBzZXR0aW5ncyk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIFR1bmVyRmlsdGVyQ29uZmlndXJhdGlvbjo6dGx2OiB7CisgICAgICAgICAgICBnZXRIaWRsVGx2U2V0dGluZ3MoY29uZmlnLCBzZXR0aW5ncyk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIFR1bmVyRmlsdGVyQ29uZmlndXJhdGlvbjo6YWxwOiB7CisgICAgICAgICAgICBnZXRIaWRsQWxwU2V0dGluZ3MoY29uZmlnLCBzZXR0aW5ncyk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIFJlc3VsdCByZXMgPSBtRmlsdGVyLT5jb25maWd1cmUoc2V0dGluZ3MpOworICAgIGlmIChyZXMgIT0gUmVzdWx0OjpTVUNDRVNTKSB7CisgICAgICAgIHJldHVybiBTdGF0dXM6OmZyb21TZXJ2aWNlU3BlY2lmaWNFcnJvcihzdGF0aWNfY2FzdDxpbnQzMl90PihyZXMpKTsKKyA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gVHVuZXJGaWx0ZXJTZXR0aW5ncyB0dW5lclNldHRpbmdzID0gdHNDb25mLmZpbHRlclNldHRpbmdzOworICAgIHN3aXRjaCAodHVuZXJTZXR0aW5ncy5nZXRUYWcoKSkgeworICAgICAgICBjYXNlIFR1bmVyRmlsdGVyU2V0dGluZ3M6OmF2OiB7CisgICAgICAgICAgICB0cy5maWx0ZXJTZXR0aW5ncy5hdihnZXRBdlNldHRpbmdzKHR1bmVyU2V0dGluZ3MpKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgVHVuZXJGaWx0ZXJTZXR0aW5nczo6c2VjdGlvbjogeworICAgICAgICAgICAgdHMuZmlsdGVyU2V0dGluZ3Muc2VjdGlvbihnZXRTZWN0aW9uU2V0dGluZ3ModHVuZXJTZXR0aW5ncykpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBUdW5lckZpbHRlclNldHRpbmdzOjpwZXNEYXRhOiB7CisgICAgICAgICAgICB0cy5maWx0ZXJTZXR0aW5ncy5wZXNEYXRhKGdldFBlc0RhdGFTZXR0aW5ncyh0dW5lclNldHRpbmdzKSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIFR1bmVyRmlsdGVyU2V0dGluZ3M6OnJlY29yZDogeworICAgICAgICAgICAgdHMuZmlsdGVyU2V0dGluZ3MucmVjb3JkKGdldFJlY29yZFNldHRpbmdzKHR1bmVyU2V0dGluZ3MpKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGRlZmF1bHQ6IHsKKyAgICAgICAgICAgIHRzLmZpbHRlclNldHRpbmdzLm5vaW5pdCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisgICAgc2V0dGluZ3MudHModHMpOworfQorCit2b2lkIFR1bmVyRmlsdGVyOjpnZXRIaWRsTW10cFNldHRpbmdzKAorICAgICAgICBj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mQ6IHsKKyAgICAgICAgICAgIG1tdHAuZmlsdGVyU2V0dGluZ3MucmVjb3JkKGdldFJlY29yZFNldHRpbmdzKHR1bmVyU2V0dGluZ3MpKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgVHVuZXJGaWx0ZXJTZXR0aW5nczo6ZG93bmxvYWQ6IHsKKyAgICAgICAgICAgIG1tdHAuZmlsdGVyU2V0dGluZ3MuZG93bmxvYWQoZ2V0RG93bmxvYWRTZXR0aW5ncyh0dW5lclNldHRpbmdzKSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBkZWZhdWx0OiB7CisgICAgICAgICAgICBtbXRwLmZpbHRlclNldHRpbmdzLm5vaW5pdCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisgICAgc2V0dGluZ3MubW10cChtbXRwKTsKK30KKwordm9pZCBUdW5lckZpbHRlcjo6Z2V0SGlkbElwU2V0dGluZ3MoCisgICAgICAgIGNvbnN0IFR1bmVyRmlsdGVyQ29uZmlndXJhdGlvbiYgY29uZmlnLCBEZW11eEZpbHRlclNldHRpbmdzJiBzZXR0aW5ncykgeworICAgIGF1dG8gaXBDb25mID0gY29uZmlnLmdldDxUdW5lckZpbHRlckNvbmZpZ3VyYXRpb246OmlwPigpOworICAgIERlbXV4SXBBZGRyZXNzIGlwQWRkcnsKKyAgICAgICAgLnNyY1BvcnQgPSBzdGF0aWNfY2FzdDx1aW50MTZfdD4oaXBDb25mLmlwQWRkci5zcmNQb3J0KSwKKyAgICAgICAgLmRzdFBvcnQgPSBzdGF0aWNfY2FzdDx1aW50MTZfdD4oaXBDb25mLmlwQWRkci5kc3RQb3J0KSwKKyAgICB9OworCisgICAgaXBDb25mLmlwQWRkci5zcmNJcEFkZHJlc3MuaXNJcFY2CisgICAgICAgICAgICA/IGlwQWRkci5zcmNJcEFkZHJlc3MudjYoZ2V0SXBWNkFkZHJlc3MoaXBDb25mLmlwQWRkci5zcmNJcEFkZHJlc3MpKQorICAgICAgICAgICAgOiBpcEFkZHIuc3JjSXBBZGRyZXNzLnY0KGdldElwVjRBZGRyZXNzKGlwQ29uZi5pcEFkZHIuc3JjSXBBZGRyZXNzKSk7CisgICAgaXBDb25mLmlwQWRkci5kc3RJcEFkZHJlc3MuaXNJcFY2CisgICAgICAgICAgICA/IGlwQWRkci5kc3RJcEFkZHJlc3MudjYoZ2V0SXBWNkFkZHJlc3MoaXBDb25mLmlwQWRkci5kc3RJcEFkZHJlc3MpKQorICAgICAgICAgICAgOiBpcEFkZHIuZHN0SXBBZGRyZXNzLnY0KGdldElwVjRBZGRyZXNzKGlwQ29uZi5pcEFkZHIuZHN0SXBBZGRyZXNzKSk7CisgICAgRGVtdXhJcEZpbHRlclNldHRpbmdzIGlweworICAgICAgICAuaXBBZGRyID0gaXBBZGRyLAorICAgIH07CisKKyAgICBUdW5lckZpbHRlclNldHRpbmdzIHR1bmVyU2V0dGluZ3MgPSBpcENvbmYuZmlsdGVyU2V0dGluZ3M7CisgICAgc3dpdGNoICh0dW5lclNldHRpbmdzLmdldFRhZygpKSB7CisgICAgICAgIGNhc2UgVHVuZXJGaWx0ZXJTZXR0aW5nczo6c2VjdGlvbjogeworICAgICAgICAgICAgaXAuZmlsdGVyU2V0dGluZ3Muc2VjdGlvbihnZXRTZWN0aW9uU2V0dGluZ3ModHVuZXJTZXR0aW5ncykpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBUdW5lckZpbHRlclNldHRpbmdzOjppc1Bhc3N0aHJvdWdoOiB7CisgICAgICAgICAgICBpcC5maWx0ZXJTZXR0aW5ncy5iUGFzc3Rocm91Z2godHVuZXJTZXR0aW5ncy5pc1Bhc3N0aHJvdWdoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGRlZmF1bHQ6IHsKKyAgICAgICAgICAgIGlwLmZpbHRlclNldHRpbmdzLm5v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B9OworICAgIHJldHVybiBhdjsKK30KKworRGVtdXhGaWx0ZXJTZWN0aW9uU2V0dGluZ3MgVHVuZXJGaWx0ZXI6OmdldFNlY3Rpb25TZXR0aW5ncyhjb25zdCBUdW5lckZpbHRlclNldHRpbmdzJiBzZXR0aW5ncykgeworICAgIGF1dG8gcyA9IHNldHRpbmdzLmdldDxUdW5lckZpbHRlclNldHRpbmdzOjpzZWN0aW9uPigpOworICAgIERlbXV4RmlsdGVyU2VjdGlvblNldHRpbmdzIHNlY3Rpb257CisgICAgICAgIC5pc0NoZWNrQ3JjID0gcy5pc0NoZWNrQ3JjLAorICAgICAgICAuaXNSZXBlYXQgPSBzLmlzUmVwZWF0LAorICAgICAgICAuaXNSYXcgPSBzLmlzUmF3LAorICAgIH07CisKKyAgICBzd2l0Y2ggKHMuY29uZGl0aW9uLmdldFRhZygpKSB7CisgICAgICAgIGNhc2UgVHVuZXJGaWx0ZXJTZWN0aW9uQ29uZGl0aW9uOjpzZWN0aW9uQml0czogeworICAgICAgICAgICAgYXV0byBzZWN0aW9uQml0cyA9IHMuY29uZGl0aW9uLmdldDxUdW5lckZpbHRlclNlY3Rpb25Db25kaXRpb246OnNlY3Rpb25CaXRzPigpOworICAgICAgICAgICAgdmVjdG9yPHVpbnQ4X3Q+IGZpbHRlcihzZWN0aW9uQml0cy5maWx0ZXIuYmVnaW4oKSwgc2VjdGlvbkJpdHMuZmlsdGVyLmVuZCgpKTsKKyAgICAgICAgICAgIHZlY3Rvcjx1aW50OF90PiBtYXNrKHNlY3Rpb25CaXRzLm1hc2suYmVnaW4oKSwgc2VjdGlvbkJpdHMubWFzay5lbmQoKSk7CisgICAgICAgICAgICB2ZWN0b3I8dWludDhfdD4gbW9kZShzZWN0aW9uQml0cy5tb2RlLmJlZ2luKCksIHNlY3Rpb25CaXRzLm1vZGUuZW5kKCkpOworICAgICAgICAgICAgc2VjdGlvbi5jb25kaXRpb24uc2VjdGlvbkJpdHMoeworICAgICAgICAgICAgICAgIC5maWx0ZXIgPSBmaWx0ZXIsCisgICAgICAgICAgICAgICAgLm1hc2sgPSBtYXNrLAorICAgICAgICAgICAgICAgIC5tb2RlID0gbW9kZSwKKyAgICAgICAgICAgIH0pOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBUdW5lckZpbHRlclNlY3Rpb25Db25kaXRpb246OnRhYmxlSW5mbzogeworICAgICAgICAgICAgYXV0byB0YWJsZUluZm8gPSBzLmNvbmRpdGlvbi5nZXQ8VHVuZXJGaWx0ZXJTZWN0aW9uQ29uZGl0aW9uOjp0YWJsZUluZm8+KCk7CisgICAgICAgICAgICBzZWN0aW9uLmNvbmRpdGlvbi50YWJsZUluZm8oeworICAgICAgICAgICAgICAgIC50YWJsZUlkID0gc3RhdGljX2Nhc3Q8dWludDE2X3Q+KHRhYmxlSW5mby50YWJsZUlkKSwKKyAgICAgICAgICAgICAgICAudmVyc2lvbiA9IHN0YXRpY19jYXN0PHVpbnQxNl90Pih0YWJsZUluZm8udmVyc2lvbiksCisgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGRlZmF1bHQ6IHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiBzZWN0aW9uOworfQorCitEZW11eEZpbHRlclBlc0RhdGFTZXR0aW5ncyBUdW5lckZpbHRlcjo6Z2V0UGVzRGF0YVNldHRpbmdzKGNvbnN0IFR1bmVyRmlsdGVyU2V0dGluZ3MmIHNldHRpbmdzKSB7CisgICAgRGVtdXhGaWx0ZXJQZXNEYXRhU2V0dGluZ3MgcGVzeworICAgICAgICAuc3RyZWFtSWQgPSBzdGF0aWNfY2FzdDxEZW11eFN0cmVhbUlkPigKKyAgICAgICAgICAgICAgICBzZXR0aW5ncy5nZXQ8VHVuZXJGaWx0ZXJTZXR0aW5nczo6cGVzRGF0YT4oKS5zdHJlYW1JZCksCisgICAgICAgIC5pc1Jhdy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ybiBTdGF0dXM6OmZyb21TZXJ2aWNlU3BlY2lmaWNFcnJvcihzdGF0aWNfY2FzdDxpbnQzMl90PihyZXMpKTsKKyAgICB9CisgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKK30KKworc3A8SUZpbHRlcj4gVHVuZXJGaWx0ZXI6OmdldEhhbEZpbHRlcigpIHsKKyAgICByZXR1cm4gbUZpbHRlcjsKK30KKworYm9vbCBUdW5lckZpbHRlcjo6aXNBdWRpb0ZpbHRlcigpIHsKKyAgICByZXR1cm4gKG1NYWluVHlwZSA9PSAoaW50KURlbXV4RmlsdGVyTWFpblR5cGU6OlRTCisgICAgICAgICAgICAgICAgICAgICYmIG1TdWJUeXBlID09IChpbnQpRGVtdXhUc0ZpbHRlclR5cGU6OkFVRElPKQorICAgICAgICAgICAgfHwgKG1NYWluVHlwZSA9PSAoaW50KURlbXV4RmlsdGVyTWFpblR5cGU6Ok1NVFAKKyAgICAgICAgICAgICAgICAgICAgJiYgbVN1YlR5cGUgPT0gKGludClEZW11eE1tdHBGaWx0ZXJUeXBlOjpBVURJTyk7Cit9CisKK2Jvb2wgVHVuZXJGaWx0ZXI6OmlzVmlkZW9GaWx0ZXIoKSB7CisgICAgcmV0dXJuIChtTWFpblR5cGUgPT0gKGludClEZW11eEZpbHRlck1haW5UeXBlOjpUUworICAgICAgICAgICAgICAgICAgICAmJiBtU3ViVHlwZSA9PSAoaW50KURlbXV4VHNGaWx0ZXJUeXBlOjpWSURFTykKKyAgICAgICAgICAgIHx8IChtTWFpblR5cGUgPT0gKGludClEZW11eEZpbHRlck1haW5UeXBlOjpNTVRQCisgICAgICAgICAgICAgICAgICAgICYmIG1TdWJUeXBlID09IChpbnQpRGVtdXhNbXRwRmlsdGVyVHlwZTo6VklERU8pOworfQorCitib29sIFR1bmVyRmlsdGVyOjpnZXRIaWRsQXZTdHJlYW1UeXBlKGludCBhdlN0cmVhbVR5cGUsIEF2U3RyZWFtVHlwZSYgdHlwZSkgeworICAgIGlmIChpc0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KyAgICAgICAgdmVjdG9yPFR1bmVyRmlsdGVyRXZlbnQ+JiB0dW5lckV2ZW50KSB7CisgICAgaWYgKGV2ZW50cy5lbXB0eSgpICYmICFldmVudHNFeHQuZW1wdHkoKSkgeworICAgICAgICBhdXRvIGV2ZW50RXh0ID0gZXZlbnRzRXh0WzBdOworICAgICAgICBzd2l0Y2ggKGV2ZW50RXh0LmdldERpc2NyaW1pbmF0b3IoKSkgeworICAgICAgICAgICAgY2FzZSBEZW11eEZpbHRlckV2ZW50RXh0OjpFdmVudDo6aGlkbF9kaXNjcmltaW5hdG9yOjptb25pdG9yRXZlbnQ6IHsKKyAgICAgICAgICAgICAgICBnZXRNb25pdG9yRXZlbnQoZXZlbnRzRXh0LCB0dW5lckV2ZW50KTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIERlbXV4RmlsdGVyRXZlbnRFeHQ6OkV2ZW50OjpoaWRsX2Rpc2NyaW1pbmF0b3I6OnN0YXJ0SWQ6IHsKKyAgICAgICAgICAgICAgICBnZXRSZXN0YXJ0RXZlbnQoZXZlbnRzRXh0LCB0dW5lckV2ZW50KTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBkZWZhdWx0OiB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGlmICghZXZlbnRzLmVtcHR5KCkpIHsKKyAgICAgICAgYXV0byBldmVudCA9IGV2ZW50c1swXTsKKyAgICAgICAgc3dpdGNoIChldmVudC5nZXREaXNjcmltaW5hdG9yKCkpIHsKKyAgICAgICAgICAgIGNhc2UgRGVtdXhGaWx0ZXJFdmVudDo6RXZlbnQ6OmhpZGxfZGlzY3JpbWluYXRvcjo6bWVkaWE6IHsKKyAgICAgICAgICAgICAgICBnZXRNZWRpYUV2ZW50KGV2ZW50cywgdHVuZXJFdmVudCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIERlbXV4RmlsdGVyRXZlbnQ6OkV2ZW50OjpoaWRsX2Rpc2NyaW1pbmF0b3I6OnNlY3Rpb246IHsKKyAgICAgICAgICAgICAgICBnZXRTZWN0aW9uRXZlbnQoZXZlbnRzLCB0dW5lckV2ZW50KTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRGVtdXhGaWx0ZXJFdmVudDo6RXZlbnQ6OmhpZGxfZGlzY3JpbWluYXRvcjo6cGVzOiB7CisgICAgICAgICAgICAgICAgZ2V0UGVzRXZlbnQoZXZlbnRzLCB0dW5lckV2ZW50KTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRGVtdXhGaWx0ZXJFdmVudDo6RXZlbnQ6OmhpZGxfZGlzY3JpbWluYXRvcjo6dHNSZWNvcmQ6IHsKKyAgICAgICAgICAgICAgICBnZXRUc1JlY29yZEV2ZW50KGV2ZW50cywgZXZlbnRzRXh0LCB0dW5lckV2ZW50KTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRGVtdXhGaWx0ZXJFdmVudDo6RXZlbnQ6OmhpZGxfZGlzY3JpbWluYXRvcjo6bW10cFJlY29yZDogeworICAgICAgICAgICAgICAgIGdldE1tdHBSZWNvcmRFdmVudChldmVudHMsIGV2ZW50c0V4dCwgdHVuZXJFdmVudCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIERlbXV4RmlsdGVyRXZlbnQ6OkV2ZW50OjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmRvd25sb2FkOiB7CisgICAgICAgICAgICAgICAgZ2V0RG93bmxvYWRFdmVudChldmVudHMsIHR1bmVyRXZlbnQpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBEZW11eEZpbHRlckV2ZW50OjpFdmVudDo6aGlkbF9kaXNjcmltaW5hdG9yOjppcFBheWxvYWQ6IHsKKyAgICAgICAgICAgICAgICBnZXRJcFBheWxvYWRFdmVudChldmVudHMsIHR1bmVyRXZlbnQpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBEZW11eEZpbHRlckV2ZW50OjpFdmVudDo6aGlkbF9kaXNjcmltaW5hdG9yOjp0ZW1pOiB7CisgICAgICAgICAgICAgICAgZ2V0VGVtaUV2ZW50KGV2ZW50cywgdHVuZXJFdmVudCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBkZWZhdWx0OiB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CisKK3ZvaWQgVHVuZXJGaWx0ZXI6OkZpbHRlckNhbGxiYWNrOjpnZXRNZWRpYUV2ZW50KAorICAgICAgICB2ZWN0b3I8RGVtdXhGaWx0ZXJFdmVudDo6RXZlbnQ+JiBldmVudHMsIHZlY3RvcjxUdW5lckZpbHRlckV2ZW50PiYgcmVzKSB7CisgICAgZm9yIChEZW11eEZpbHRlckV2ZW50OjpFdmVudCBlIDogZXZlbnRzKSB7CisgICAgICAgIERlbXV4RmlsdGVyTWVkaWFFdmVudCBtZWRpYUV2ZW50ID0gZS5tZWRpYSgpOworICAgICAgICBUdW5lckZpbHRlck1lZGlhRXZlbnQgdHVuZXJNZWRpYTsKKworICAgICAgICB0dW5lck1lZGlhLnN0cmVhbUlkID0gc3RhdGljX2Nhc3Q8Y2hhcjE2X3Q+KG1lZGlhRXZlbnQuc3RyZWFtSWQpOworICAgICAgICB0dW5lck1lZGlhLmlzUHRzUHJlc2VudCA9IG1l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LmV4dHJhTWV0YURhdGEuYXVkaW8oKS5hZEZhZGUpLAorICAgICAgICAgICAgICAgIC5hZFBhbiA9IHN0YXRpY19jYXN0PGludDhfdD4oCisgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYUV2ZW50LmV4dHJhTWV0YURhdGEuYXVkaW8oKS5hZFBhbiksCisgICAgICAgICAgICAgICAgLnZlcnNpb25UZXh0VGFnID0gc3RhdGljX2Nhc3Q8aW50OF90PigKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhRXZlbnQuZXh0cmFNZXRhRGF0YS5hdWRpbygpLnZlcnNpb25UZXh0VGFnKSwKKyAgICAgICAgICAgICAgICAuYWRHYWluQ2VudGVyID0gc3RhdGljX2Nhc3Q8aW50OF90PigKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhRXZlbnQuZXh0cmFNZXRhRGF0YS5hdWRpbygpLmFkR2FpbkNlbnRlciksCisgICAgICAgICAgICAgICAgLmFkR2FpbkZyb250ID0gc3RhdGljX2Nhc3Q8aW50OF90PigKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhRXZlbnQuZXh0cmFNZXRhRGF0YS5hdWRpbygpLmFkR2FpbkZyb250KSwKKyAgICAgICAgICAgICAgICAuYWRHYWluU3Vycm91bmQgPSBzdGF0aWNfY2FzdDxpbnQ4X3Q+KAorICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFFdmVudC5leHRyYU1ldGFEYXRhLmF1ZGlvKCkuYWRHYWluU3Vycm91bmQpLAorICAgICAgICAgICAgfTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHR1bmVyTWVkaWEuaXNBdWRpb0V4dHJhTWV0YURhdGEgPSBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChtZWRpYUV2ZW50LmF2TWVtb3J5LmdldE5hdGl2ZUhhbmRsZSgpICE9IG51bGxwdHIpIHsKKyAgICAgICAgICAgIHR1bmVyTWVkaWEuYXZNZW1vcnk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NzYWdlLmdyb3VwSWRzKCk7CisgICAgICAgICAgICB2ZWN0b3I8dWludDhfdD4gZ3JvdXBJZHMoYmVnaW4oZyksIGVuZChnKSk7CisgICAgICAgICAgICBzY2FuTWVzc2FnZS5zZXQ8VHVuZXJGcm9udGVuZFNjYW5NZXNzYWdlOjpncm91cElkcz4oZ3JvdXBJZHMpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBGcm9udGVuZFNjYW5NZXNzYWdlVHlwZTo6SU5QVVRfU1RSRUFNX0lEUzogeworICAgICAgICAgICAgYXV0byBpID0gbWVzc2FnZS5pbnB1dFN0cmVhbUlkcygpOworICAgICAgICAgICAgdmVjdG9yPGNoYXIxNl90PiBzdHJlYW1JZHMoYmVnaW4oaSksIGVuZChpKSk7CisgICAgICAgICAgICBzY2FuTWVzc2FnZS5zZXQ8VHVuZXJGcm9udGVuZFNjYW5NZXNzYWdlOjppbnB1dFN0cmVhbUlkcz4oc3RyZWFtSWRzKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgRnJvbnRlbmRTY2FuTWVzc2FnZVR5cGU6OlNUQU5EQVJEOiB7CisgICAgICAgICAgICBGcm9udGVuZFNjYW5NZXNzYWdlOjpTdGFuZGFyZCBzdGQgPSBtZXNzYWdlLnN0ZCgpOworICAgICAgICAgICAgaW50IHN0YW5kYXJkOworICAgICAgICAgICAgaWYgKHN0ZC5nZXREaXNjcmltaW5hdG9yKCkgPT0gRnJvbnRlbmRTY2FuTWVzc2FnZTo6U3RhbmRhcmQ6OmhpZGxfZGlzY3JpbWluYXRvcjo6c1N0ZCkgeworICAgICAgICAgICAgICAgIHN0YW5kYXJkID0gKGludCkgc3RkLnNTdGQoKTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RkLmdldERpc2NyaW1pbmF0b3IoKSA9PQorICAgICAgICAgICAgICAgICAgICBGcm9udGVuZFNjYW5NZXNzYWdlOjpTdGFuZGFyZDo6aGlkbF9kaXNjcmltaW5hdG9yOjp0U3RkKSB7CisgICAgICAgICAgICAgICAgc3RhbmRhcmQgPSAoaW50KSBzdGQudFN0ZCgpOworICAgICAgICAgICAgfSBlbHNlIGlmIChzdGQuZ2V0RGlzY3JpbWluYXRvcigpID09CisgICAgICAgICAgICAgICAgICAgIEZyb250ZW5kU2Nhbk1lc3NhZ2U6OlN0YW5kYXJkOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OnNpZlN0ZCkgeworICAgICAgICAgICAgICAgIHN0YW5kYXJkID0gKGludCkgc3RkLnNpZlN0ZCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc2Nhbk1lc3NhZ2Uuc2V0PFR1bmVyRnJvbnRlbmRTY2FuTWVzc2FnZTo6c3RkPihzdGFuZGFyZCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIEZyb250ZW5kU2Nhbk1lc3NhZ2VUeXBlOjpBVFNDM19QTFBfSU5GTzogeworICAgICAgICAgICAgdmVjdG9yPEZyb250ZW5kU2NhbkF0c2MzUGxwSW5mbz4gcGxwSW5mb3MgPSBtZXNzYWdlLmF0c2MzUGxwSW5mb3MoKTsKKyAgICAgICAgICAgIHZlY3RvcjxUdW5lckZyb250ZW5kU2NhbkF0c2MzUGxwSW5mbz4gdHVuZXJQbHBJbmZvczsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcGxwSW5mb3Muc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICBhdXRvIGluZm8gPSBwbHBJbmZvc1tpXTsKKyAgICAgICAgICAgICAgICBpbnQ4X3QgcGxwSWQgPSAoaW50OF90KSBpbmZvLnBscElkOworICAgICAgICAgICAgICAgIGJvb2wgbGxzID0gKGJvb2wpIGluZm8uYkxsc0ZsYWc7CisgICAgICAgICAgICAgICAgVHVuZXJGcm9udGVuZFNjYW5BdHNjM1BscEluZm8gcGxwSW5mb3sKKyAgICAgICAgICAgICAgICAgICAgLnBscElkID0gcGxwSWQsCisgICAgICAgICAgICAgICAgICAgIC5sbHNGbGFnID0gbGxzLAorICAgICAgICAgICAgICAgIH07CisgICAgICAgICAgICAgICAgdHVuZXJQbHBJbmZvcy5wdXNoX2JhY2socGxwSW5mbyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzY2FuTWVzc2FnZS5zZXQ8VHVuZXJGcm9udGVuZFNjYW5NZXNzYWdlOjphdHNjM1BscEluZm9zPih0dW5lclBscEluZm9zKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBicmVhazsKKyAgICB9CisgICAgbVR1bmVyRnJvbnRlbmRDYWxsYmFjay0+b25TY2FuTWVzc2FnZSgoaW50KXR5cGUsIHNjYW5NZXNzYWdlKTsKKyAgICByZXR1cm4gVm9pZCgpOworfQorCitSZXR1cm48dm9pZD4gVHVuZXJGcm9udGVuZDo6RnJvbnRlbmRDYWxsYmFjazo6b25TY2FuTWVzc2FnZUV4dDFfMSgKKyAgICAgICAgRnJvbnRlbmRTY2FuTWVzc2FnZVR5cGVFeHQxXzEgdHlwZSwgY29uc3QgRnJvbnRlbmRTY2FuTWVzc2FnZUV4dDFfMSYgbWVzc2FnZSkgeworICAgIEFMT0dEKCJvblNjYW5NZXNzYWdlRXh0MV8xOjpvblNjYW5NZXNzYWdlLCB0eXBlPSVkIiwgdHlwZSk7CisgICAgVHVuZXJGcm9udGVuZFNjYW5NZXNzYWdlIHNjYW5NZXNzYWdlOworICAgIHN3aXRjaCh0eXBlKSB7CisgICAgICAgIGNhc2UgRnJvbnRlbmRTY2FuTWVzc2FnZVR5cGVFeHQxXzE6Ok1PRFVMQVRJT046IHsKKyAgICAgICAgICAgIEZyb250ZW5kTW9kdWxhdGlvbiBtID0gbWVzc2FnZS5tb2R1bGF0aW9uKCk7CisgICAgICAgICAgICBpbnQgbW9kdWxhdGlvbjsKKyAgICAgICAgICAgIHN3aXRjaCAobS5nZXREaXNjcmltaW5hdG9yKCkpIHsKKyAgICAgICAgICAgICAgICBjYXNlIEZyb250ZW5kTW9kdWxhdGlvbjo6aGlkbF9kaXNjcmltaW5hdG9yOjpkdmJjOgorICAgICAgICAgICAgICAgICAgICBtb2R1bGF0aW9uID0gKGludCkgbS5kdmJjKCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRNb2R1bGF0aW9uOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmR2YnQ6CisgICAgICAgICAgICAgICAgICAgIG1vZHVsYXRpb24gPSAoaW50KSBtLmR2YnQoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZE1vZHVsYXRpb246OmhpZGxfZGlzY3JpbWluYXRvcjo6ZHZiczoKKyAgICAgICAgICAgICAgICAgICAgbW9kdWxhdGlvbiA9IChpbnQpIG0uZHZicygpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIEZyb250ZW5kTW9kdWxhdGlvbjo6aGlkbF9kaXNjcmltaW5hdG9yOjppc2RiczoKKyAgICAgICAgICAgICAgICAgICAgbW9kdWxhdGlvbiA9IChpbnQpIG0uaXNkYnMoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZE1vZHVsYXRpb246OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNkYnMzOgorICAgICAgICAgICAgICAgICAgICBtb2R1bGF0aW9uID0gKGludCkgbS5pc2RiczMoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZE1vZHVsYXRpb246OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNkYnQ6CisgICAgICAgICAgICAgICAgICAgIG1vZHVsYXRpb24gPSAoaW50KSBtLmlzZGJ0KCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRNb2R1bGF0aW9uOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmF0c2M6CisgICAgICAgICAgICAgICAgICAgIG1vZHVsYXRpb24gPSAoaW50KSBtLmF0c2MoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZE1vZHVsYXRpb246OmhpZGxfZGlzY3JpbWluYXRvcjo6YXRzYzM6CisgICAgICAgICAgICAgICAgICAgIG1vZHVsYXRpb24gPSAoaW50KSBtLmF0c2MzKCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRNb2R1bGF0aW9uOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmR0bWI6CisgICAgICAgICAgICAgICAgICAgIG1vZHVsYXRpb24gPSAoaW50KSBtLmR0bWIoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzY2FuTWVzc2FnZS5zZXQ8VHVuZXJGcm9udGVuZFNjYW5NZXNzYWdlOjptb2R1bGF0aW9uPihtb2R1bGF0aW9uKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgRnJvbnRlbmRTY2FuTWVzc2FnZVR5cGVFeHQxXzE6OkRWQkNfQU5ORVg6IHsKKyAgICAgICAgICAgIHNjYW5NZXNzYWdlLnNldDxUdW5lckZyb250ZW5kU2Nhbk1lc3NhZ2U6OmFubmV4PigoaW50KW1lc3NhZ2UuYW5uZXgoKSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIEZyb250ZW5kU2Nhbk1lc3NhZ2VUeXBlRXh0MV8xOjpISUdIX1BSSU9SSVRZOiB7CisgICAgICAgICAgICBzY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RTdGF0dXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6c25yOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjpzbnI+KChpbnQpcy5zbnIoKSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6YmVyOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjpiZXI+KChpbnQpcy5iZXIoKSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6cGVyOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjpwZXI+KChpbnQpcy5wZXIoKSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6cHJlQmVyOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjpwcmVCZXI+KChpbnQpcy5wcmVCZXIoKSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGN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igobG9uZylzLmlubmVyRmVjKCkpOworICAgICAgICAgICAgICAgIGFpZGxTdGF0dXMucHVzaF9iYWNrKHN0YXR1cyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEZyb250ZW5kU3RhdHVzOjpoaWRsX2Rpc2NyaW1pbmF0b3I6Om1vZHVsYXRpb246IHsKKyAgICAgICAgICAgICAgICBzd2l0Y2ggKHMubW9kdWxhdGlvbigpLmdldERpc2NyaW1pbmF0b3IoKSkgeworICAgICAgICAgICAgICAgICAgICBjYXNlIEZyb250ZW5kTW9kdWxhdGlvblN0YXR1czo6aGlkbF9kaXNjcmltaW5hdG9yOjpkdmJjOgorICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjptb2R1bGF0aW9uPigoaW50KXMubW9kdWxhdGlvbigpLmR2YmMoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRNb2R1bGF0aW9uU3RhdHVzOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmR2YnM6CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6Om1vZHVsYXRpb24+KChpbnQpcy5tb2R1bGF0aW9uKCkuZHZicygpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGFpZGxTdGF0dXMucHVzaF9iYWNrKHN0YXR1cyk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZE1vZHVsYXRpb25TdGF0dXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNkYnM6CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6Om1vZHVsYXRpb24+KChpbnQpcy5tb2R1bGF0aW9uKCkuaXNkYnMoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRNb2R1bGF0aW9uU3RhdHVzOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmlzZGJzMzoKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cy5zZXQ8VHVuZXJGcm9udGVuZFN0YXR1czo6bW9kdWxhdGlvbj4oKGludClzLm1vZHVsYXRpb24oKS5pc2RiczMoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRNb2R1bGF0aW9uU3RhdHVzOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmlzZGJ0OgorICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjptb2R1bGF0aW9uPigoaW50KXMubW9kdWxhdGlvbigpLmlzZGJ0KCkpOworICAgICAgICAgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6aW52ZXJzaW9uOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjppbnZlcnNpb24+KChpbnQpcy5pbnZlcnNpb24oKSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6bG5iVm9sdGFnZTogeworICAgICAgICAgICAgICAgIHN0YXR1cy5zZXQ8VHVuZXJGcm9udGVuZFN0YXR1czo6bG5iVm9sdGFnZT4oKGludClzLmxuYlZvbHRhZ2UoKSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6cGxwSWQ6IHsKKyAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OnBscElkPigoaW50OF90KXMucGxwSWQoKSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNFV0JTOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjppc0VXQlM+KHMuaXNFV0JTKCkpOworICAgICAgICAgICAgICAgIGFpZGxTdGF0dXMucHVzaF9iYWNrKHN0YXR1cyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEZyb250ZW5kU3RhdHVzOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmFnYzogeworICAgICAgICAgICAgICAgIHN0YXR1cy5zZXQ8VHVuZXJGcm9udGVuZFN0YXR1czo6YWdjPigoaW50OF90KXMuYWdjKCkpOworICAgICAgICAgICAgICAgIGFpZGxTdGF0dXMucHVzaF9iYWNrKHN0YXR1cyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEZyb250ZW5kU3RhdHVzOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmlzTG5hT246IHsKKyAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OmlzTG5hT24+KHMuaXNMbmFPbigpKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1czo6aGlkbF9kaXNjcmltaW5hdG9yOjppc0xheWVyRXJyb3I6IHsKKyAgICAgICAgICAgICAgICB2ZWN0b3I8Ym9vbD4gZShzLmlzTGF5ZXJFcnJvcigpLmJlZ2luKCksIHMuaXNMYXllckVycm9yKCkuZW5kKCkpOworICAgICAgICAgICAgICAgIHN0YXR1cy5zZXQ8VHVuZXJGcm9udGVuZFN0YXR1czo6aXNMYXllckVycm9yPihlKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1czo6aGlkbF9kaXNjcmltaW5hdG9yOjptZXI6IHsKKyAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6Om1lcj4oKGludClzLm1lcigpKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1czo6aGlkbF9kaXNjcmltaW5hdG9yOjpmcmVxT2Zmc2V0OiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjpmcmVxT2Zmc2V0PigoaW50KXMuZnJlcU9mZnNldCgpKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1czo6aGlkbF9kaXNjcmltaW5hdG9yOjpoaWVyYXJjaHk6IHsKKyAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OmhpZXJhcmNoeT4oKGludClzLmhpZXJhcmNoeSgpKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1czo6aGlkbF9kaXNjcmltaW5hdG9yOjppc1JmTG9ja2VkOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjppc1JmTG9ja2VkPihzLmlzUmZMb2NrZWQoKSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6cGxwSW5mbzogeworICAgICAgICAgICAgICAgIHZlY3RvcjxUdW5lckZyb250ZW5kU3RhdHVzQXRzYzNQbHBJbmZvPiBpbmZvOworICAgICAgICAgICAgICAgIGZvciAoYXV0byBpIDogcy5wbHBJbmZvKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgaW5mby5wdXNoX2JhY2soeworICAgICAgICAgICAgICAgICAgICAgICAgLnBscElkID0gKGludDhfdClpLnBscElkLAorICAgICAgICAgICAgICAgICAgICAgICAgLmlzTG9ja2VkID0gaS5pc0xvY2tlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIC51ZWMgPSAoaW50KWkudWVjLAorICAgICAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjpwbHBJbmZvPihpbmZvKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQorCit2b2lkIFR1bmVyRnJvbnRlbmQ6OmdldEFpZGxGcm9udGVuZFN0YXR1c0V4dCgKKyAgICAgICAgdmVjdG9yPEZyb250ZW5kU3RhdHVzRXh0MV8xPiYgaGlkbFN0YXR1cywgdmVjdG9yPFR1bmVyRnJvbnRlbmRTdGF0dXM+JiBhaWRsU3RhdHVzKSB7CisgICAgZm9yIChGcm9udGVuZFN0YXR1c0V4dDFfMSBzIDogaGlkbFN0YXR1cykgeworICAgICAgICBUdW5lckZyb250ZW5kU3RhdHVzIHN0YXR1czsKKyAgICAgICAgc3dpdGNoIChzLmdldERpc2NyaW1pbmF0b3IoKSkgeworICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1c0V4dDFfMTo6aGlkbF9kaXNjcmltaW5hdG9yOjptb2R1bGF0aW9uczogeworICAgICAgICAgICAgICAgIHZlY3RvcjxpbnQ+IGFpZGxNb2Q7CisgICAgICAgICAgICAgICAgZm9yIChhdXRvIG0gOiBzLm1vZHVsYXRpb25zKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChtLmdldERpc2NyaW1pbmF0b3IoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZE1vZHVsYXRpb246OmhpZGxfZGlzY3JpbWluYXRvcjo6ZHZiYzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBhaWRsTW9kLnB1c2hfYmFjaygoaW50KW0uZHZiYygpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRNb2R1bGF0aW9uOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmR2YnM6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWlkbE1vZC5wdXNoX2JhY2soKGludCltLmR2YnMoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEZyb250ZW5kTW9kdWxhdGlvbjo6aGlkbF9kaXNjcmltaW5hdG9yOjpkdmJ0OgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFpZGxNb2QucHVzaF9iYWNrKChpbnQpbS5kdmJ0KCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZE1vZHVsYXRpb246OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNkYnM6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWlkbE1vZC5wdXNoX2JhY2soKGludCltLmlzZGJzKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZE1vZHVsYXRpb246OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNkYnMzOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFpZGxNb2QucHVzaF9iYWNrKChpbnQpbS5pc2RiczMoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEZyb250ZW5kTW9kdWxhdGlvbjo6aGlkbF9kaXNjcmltaW5hdG9yOjppc2RidDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBhaWRsTW9kLnB1c2hfYmFjaygoaW50KW0uaXNkYnQoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEZyb250ZW5kTW9kdWxhdGlvbjo6aGlkbF9kaXNjcmltaW5hdG9yOjphdHNjOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFpZGxNb2QucHVzaF9iYWNrKChpbnQpbS5hdHNjKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZE1vZHVsYXRpb246OmhpZGxfZGlzY3JpbWluYXRvcjo6YXRzYzM6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWlkbE1vZC5wdXNoX2JhY2soKGludCltLmF0c2MzKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZE1vZHVsYXRpb246OmhpZGxfZGlzY3JpbWluYXRvcjo6ZHRtYjoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBhaWRsTW9kLnB1c2hfYmFjaygoaW50KW0uZHRtYigpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6Om1vZHVsYXRpb25zPihhaWRsTW9kKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1c0V4dDFfMTo6aGlkbF9kaXNjcmltaW5hdG9yOjpiZXJzOiB7CisgICAgICAgICAgICAgICAgdmVjdG9yPGludD4gYihzLmJlcnMoKS5iZWdpbigpLCBzLmJlcnMoKS5lbmQoKSk7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjpiZXJzPihiKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1c0V4dDFfMTo6aGlkbF9kaXNjcmltaW5hdG9yOjpjb2RlUmF0ZXM6IHsKKyAgICAgICAgICAgICAgICB2ZWN0b3I8aW50NjRfdD4gY29kZVJhdGVzOworICAgICAgICAgICAgICAgIGZvciAoYXV0byBjIDogcy5jb2RlUmF0ZXMoKSkgeworICAgICAgICAgICAgICAgICAgICBjb2RlUmF0ZXMucHVzaF9iYWNrKChsb25nKWMpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OmNvZGVSYXRlcz4oY29kZVJhdGVzKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1c0V4dDFfMTo6aGlkbF9kaXNjcmltaW5hdG9yOjpiYW5kd2lkdGg6IHsKKyAgICAgICAgICAgICAgICBzd2l0Y2ggKHMuYmFuZHdpZHRoKCkuZ2V0RGlzY3JpbWluYXRvcigpKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRCYW5kd2lkdGg6OmhpZGxfZGlzY3JpbWluYXRvcjo6YXRzYzM6CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OmJhbmR3aWR0aD4oKGludClzLmJhbmR3aWR0aCgpLmF0c2MzKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRCYW5kd2lkdGg6OmhpZGxfZGlzY3JpbWluYXRvcjo6ZHZiYzoKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cy5zZXQ8VHVuZXJGcm9udGVuZFN0YXR1czo6YmFuZHdpZHRoPigoaW50KXMuYmFuZHdpZHRoKCkuZHZiYygpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIEZyb250ZW5kQmFuZHdpZHRoOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmR2YnQ6CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OmJhbmR3aWR0aD4oKGludClzLmJhbmR3aWR0aCgpLmR2YnQoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZEJhbmR3aWR0aDo6aGlkbF9kaXNjcmltaW5hdG9yOjppc2RidDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cy5zZXQ8VHVuZXJGcm9udGVuZFN0YXR1czo6YmFuZHdpZHRoPigoaW50KXMuYmFuZHdpZHRoKCkuaXNkYnQoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZEJhbmR3aWR0aDo6aGlkbF9kaXNjcmltaW5hdG9yOjpkdG1iOgorICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjpiYW5kd2lkdGg+KChpbnQpcy5iYW5kd2lkdGgoKS5kdG1iKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGFpZGxTdGF0dXMucHVzaF9iYWNrKHN0YXR1cyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEZyb250ZW5kU3RhdHVzRXh0MV8xOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmludGVydmFsOiB7CisgICAgICAgICAgICAgICAgc3dpdGNoIChzLmludGVydmFsKCkuZ2V0RGlzY3JpbWluYXRvcigpKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRHdWFyZEludGVydmFsOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmR2YnQ6CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OmludGVydmFsPigoaW50KXMuaW50ZXJ2YWwoKS5kdmJ0KCkpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRHdWFyZEludGVydmFsOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmlzZGJ0OgorICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjppbnRlcnZhbD4oKGludClzLmludGVydmFsKCkuaXNkYnQoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZEd1YXJkSW50ZXJ2YWw6OmhpZGxfZGlzY3JpbWluYXRvcjo6ZHRtYjoKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cy5zZXQ8VHVuZXJGcm9udGVuZFN0YXR1czo6aW50ZXJ2YWw+KChpbnQpcy5pbnRlcnZhbCgpLmR0bWIoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXNFeHQxXzE6OmhpZGxfZGlzY3JpbWluYXRvcjo6dHJhbnNtaXNzaW9uTW9kZTogeworICAgICAgICAgICAgICAgIHN3aXRjaCAocy50cmFuc21pc3Npb25Nb2RlKCkuZ2V0RGlzY3JpbWluYXRvcigpKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRUcmFuc21pc3Npb25Nb2RlOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmR2YnQ6CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OnRyYW5zbWlzc2lvbk1vZGU+KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50KXMudHJhbnNtaXNzaW9uTW9kZSgpLmR2YnQoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZFRyYW5zbWlzc2lvbk1vZGU6OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNkYnQ6CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OnRyYW5zbWlzc2lvbk1vZGU+KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50KXMudHJhbnNtaXNzaW9uTW9kZSgpLmlzZGJ0KCkpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRUcmFuc21pc3Npb25Nb2RlOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmR0bWI6CisgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OnRyYW5zbWlzc2lvbk1vZGU+KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaW50KXMudHJhbnNtaXNzaW9uTW9kZSgpLmR0bWIoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXNFeHQxXzE6OmhpZGxfZGlzY3JpbWluYXRvcjo6dWVjOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjp1ZWM+KChpbnQpcy51ZWMoKSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXNFeHQxXzE6OmhpZGxfZGlzY3JpbWluYXRvcjo6c3lzdGVtSWQ6IHsKKyAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OnN5c3RlbUlkPigoY2hhcjE2X3Qpcy5zeXN0ZW1JZCgpKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1c0V4dDFfMTo6aGlkbF9kaXNjcmltaW5hdG9yOjppbnRlcmxlYXZpbmc6IHsKKyAgICAgICAgICAgICAgICB2ZWN0b3I8aW50PiBhaWRsSW50ZXI7CisgICAgICAgICAgICAgICAgZm9yIChhdXRvIGkgOiBzLmludGVybGVhdmluZygpKSB7CisgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoaS5nZXREaXNjcmltaW5hdG9yKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRJbnRlcmxlYXZlTW9kZTo6aGlkbF9kaXNjcmltaW5hdG9yOjphdHNjMzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBhaWRsSW50ZXIucHVzaF9iYWNrKChpbnQpaS5hdHNjMygpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRJbnRlcmxlYXZlTW9kZTo6aGlkbF9kaXNjcmltaW5hdG9yOjpkdmJjOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFpZGxJbnRlci5wdXNoX2JhY2soKGludClpLmR2YmMoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEZyb250ZW5kSW50ZXJsZWF2ZU1vZGU6OmhpZGxfZGlzY3JpbWluYXRvcjo6ZHRtYjoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBhaWRsSW50ZXIucHVzaF9iYWNrKChpbnQpaS5kdG1iKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHN0YXR1cy5zZXQ8VHVuZXJGcm9udGVuZFN0YXR1czo6aW50ZXJsZWF2aW5nPihhaWRsSW50ZXIpOworICAgICAgICAgICAgICAgIGFpZGxTdGF0dXMucHVzaF9iYWNrKHN0YXR1cyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEZyb250ZW5kU3RhdHVzRXh0MV8xOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmlzZGJ0U2VnbWVudDogeworICAgICAgICAgICAgICAgIGF1dG8gc2VnID0gcy5pc2RidFNlZ21lbnQoKTsKKyAgICAgICAgICAgICAgICB2ZWN0b3I8dWludDhfdD4gaShzZWcuYmVnaW4oKSwgc2VnLmVuZCgpKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OmlzZGJ0U2VnbWVudD4oaSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXNFeHQxXzE6OmhpZGxfZGlzY3JpbWluYXRvcjo6dHNEYXRhUmF0ZTogeworICAgICAgICAgICAgICAgIHZlY3RvcjxpbnQ+IHRzKHMudHNEYXRhUmF0ZSgpLmJlZ2luKCksIHMudHNEYXRhUmF0ZSgpLmVuZCgpKTsKKyAgICAgICAgICAgICAgICBzdGF0dXMuc2V0PFR1bmVyRnJvbnRlbmRTdGF0dXM6OnRzRGF0YVJhdGU+KHRzKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1c0V4dDFfMTo6aGlkbF9kaXNjcmltaW5hdG9yOjpyb2xsT2ZmOiB7CisgICAgICAgICAgICAgICAgc3dpdGNoIChzLnJvbGxPZmYoKS5nZXREaXNjcmltaW5hdG9yKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBGcm9udGVuZFJvbGxPZmY6OmhpZGxfZGlzY3JpbWluYXRvcjo6ZHZiczoKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cy5zZXQ8VHVuZXJGcm9udGVuZFN0YXR1czo6cm9sbE9mZj4oKGludClzLnJvbGxPZmYoKS5kdmJzKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRSb2xsT2ZmOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmlzZGJzOgorICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjpyb2xsT2ZmPigoaW50KXMucm9sbE9mZigpLmlzZGJzKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRSb2xsT2ZmOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmlzZGJzMzoKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1cy5zZXQ8VHVuZXJGcm9udGVuZFN0YXR1czo6cm9sbE9mZj4oKGludClzLnJvbGxPZmYoKS5pc2RiczMoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgRnJvbnRlbmRTdGF0dXNFeHQxXzE6OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNNaXNvOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjppc01pc28+KHMuaXNNaXNvKCkpOworICAgICAgICAgICAgICAgIGFpZGxTdGF0dXMucHVzaF9iYWNrKHN0YXR1cyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIEZyb250ZW5kU3RhdHVzRXh0MV8xOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmlzTGluZWFyOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjppc0xpbmVhcj4ocy5pc0xpbmVhcigpKTsKKyAgICAgICAgICAgICAgICBhaWRsU3RhdHVzLnB1c2hfYmFjayhzdGF0dXMpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBGcm9udGVuZFN0YXR1c0V4dDFfMTo6aGlkbF9kaXNjcmltaW5hdG9yOjppc1Nob3J0RnJhbWVzOiB7CisgICAgICAgICAgICAgICAgc3RhdHVzLnNldDxUdW5lckZyb250ZW5kU3RhdHVzOjppc1Nob3J0RnJhbWVzPihzLmlzU2hvcnRGcmFtZXMoKSk7CisgICAgICAgICAgICAgICAgYWlkbFN0YXR1cy5wdXNoX2JhY2soc3RhdHVzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KK30KKworaGlkbF92ZWM8RnJvbnRlbmRBdHNjM1BscFNldHRpbmdzPiBUdW5lckZyb250ZW5kOjpnZXRBdHNjM1BscFNldHRpbmdzKAorICAgICAgICBjb25zdCBUdW5lckZyb250ZW5kQXRzYzNTZXR0aW5ncyYgc2V0dGluZ3MpIHsKKyAgICBpbnQgbGVuID0gc2V0dGluZ3MucGxwU2V0dGluZ3Muc2l6ZSgpOworICAgIGhpZGxfdmVjPEZyb250ZW5kQXRzYzNQbHBTZXR0aW5ncz4gcGxwcyA9IGhpZGxfdmVjPEZyb250ZW5kQXRzYzNQbHBTZXR0aW5ncz4obGVuKTsKKyAgICAvLyBwYXJzZSBQTFAgc2V0dGluZ3MKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CisgICAgICAgIHVpbnQ4X3QgcGxwSWQgPSBzdGF0aWNfY2FzdDx1aW50OF90PihzZXR0aW5ncy5wbHBTZXR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biksCisgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgVHVuZXJGcm9udGVuZFVuaW9uU2V0dGluZ3M6OmF0c2MzOiB7CisgICAgICAgICAgICBhdXRvIGF0c2MzID0gc2V0dGluZ3MuZ2V0PFR1bmVyRnJvbnRlbmRVbmlvblNldHRpbmdzOjphdHNjMz4oKTsKKyAgICAgICAgICAgIGZyb250ZW5kU2V0dGluZ3MuYXRzYzMoeworICAgICAgICAgICAgICAgIC5mcmVxdWVuY3kgPSBzdGF0aWNfY2FzdDx1aW50MzJfdD4oYXRzYzMuZnJlcXVlbmN5KSwKKyAgICAgICAgICAgICAgICAuYmFuZHdpZHRoID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmRBdHNjM0JhbmR3aWR0aD4oYXRzYzMuYmFuZHdpZHRoKSwKKyAgICAgICAgICAgICAgICAuZGVtb2RPdXRwdXRGb3JtYXQgPSBzdGF0aWNfY2FzdDxGcm9udGVuZEF0c2MzRGVtb2RPdXRwdXRGb3JtYXQ+KAorICAgICAgICAgICAgICAgICAgICAgICAgYXRzYzMuZGVtb2RPdXRwdXRGb3JtYXQpLAorICAgICAgICAgICAgICAgIC5wbHBTZXR0aW5ncyA9IGdldEF0c2MzUGxwU2V0dGluZ3MoYXRzYzMpLAorICAgICAgICAgICAgfSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIFR1bmVyRnJvbnRlbmRVbmlvblNldHRpbmdzOjpjYWJsZTogeworICAgICAgICAgICAgYXV0byBkdmJjID0gc2V0dGluZ3MuZ2V0PFR1bmVyRnJvbnRlbmRVbmlvblNldHRpbmdzOjpjYWJsZT4oKTsKKyAgICAgICAgICAgIGZyb250ZW5kU2V0dGluZ3MuZHZiYyh7CisgICAgICAgICAgICAgICAgLmZyZXF1ZW5jeSA9IHN0YXRpY19jYXN0PHVpbnQzMl90PihkdmJjLmZyZXF1ZW5jeSksCisgICAgICAgICAgICAgICAgLm1vZHVsYXRpb24gPSBzdGF0aWNfY2FzdDxGcm9udGVuZER2YmNNb2R1bGF0aW9uPihkdmJjLm1vZHVsYXRpb24pLAorICAgICAgICAgICAgICAgIC5mZWMgPSBzdGF0aWNfY2FzdDxGcm9udGVuZElubmVyRmVjPihkdmJjLmlubmVyRmVjKSwKKyAgICAgICAgICAgICAgICAuc3ltYm9sUmF0ZSA9IHN0YXRpY19jYXN0PHVpbnQzMl90PihkdmJjLnN5bWJvbFJhdGUpLAorICAgICAgICAgICAgICAgIC5vdXRlckZlYyA9IHN0YXRpY19jYXN0PEZyb250ZW5kRHZiY091dGVyRmVjPihkdmJjLm91dGVyRmVjKSwKKyAgICAgICAgICAgICAgICAuYW5uZXggPSBzdGF0aWNfY2FzdDxGcm9udGVuZER2YmNBbm5leD4oZHZiYy5hbm5leCksCisgICAgICAgICAgICAgICAgLnNwZWN0cmFsSW52ZXJzaW9uID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmREdmJjU3BlY3RyYWxJbnZlcnNpb24+KAorICAgICAgICAgICAgICAgICAgICAgICAgZHZiYy5zcGVjdHJhbEludmVyc2lvbiksCisgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgVHVuZXJGcm9udGVuZFVuaW9uU2V0dGluZ3M6OmR2YnM6IHsKKyAgICAgICAgICAgIGF1dG8gZHZicyA9IHNldHRpbmdzLmdldDxUdW5lckZyb250ZW5kVW5pb25TZXR0aW5nczo6ZHZicz4oKTsKKyAgICAgICAgICAgIGZyb250ZW5kU2V0dGluZ3MuZHZicyh7CisgICAgICAgICAgICAgICAgLmZyZXF1ZW5jeSA9IHN0YXRpY19jYXN0PHVpbnQzMl90PihkdmJzLmZyZXF1ZW5jeSksCisgICAgICAgICAgICAgICAgLm1vZHVsYXRpb24gPSBzdGF0aWNfY2FzdDxGcm9udGVuZER2YnNNb2R1bGF0aW9uPihkdmJzLm1vZHVsYXRpb24pLAorICAgICAgICAgICAgICAgIC5jb2RlcmF0ZSA9IGdldER2YnNDb2RlUmF0ZShkdmJzLmNvZGVSYXRlKSwKKyAgICAgICAgICAgICAgICAuc3ltYm9sUmF0ZSA9IHN0YXRpY19jYXN0PHVpbnQzMl90PihkdmJzLnN5bWJvbFJhdGUpLAorICAgICAgICAgICAgICAgIC5yb2xsb2ZmID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmREdmJzUm9sbG9mZj4oZHZicy5yb2xsb2ZmKSwKKyAgICAgICAgICAgICAgICAucGlsb3QgPSBzdGF0aWNfY2FzdDxGcm9udGVuZER2YnNQaWxvdD4oZHZicy5waWxvdCksCisgICAgICAgICAgICAgICAgLmlucHV0U3RyZWFtSWQgPSBzdGF0aWNfY2FzdDx1aW50MzJfdD4oZHZicy5pbnB1dFN0cmVhbUlkKSwKKyAgICAgICAgICAgICAgICAuc3RhbmRhcmQgPSBzdGF0aWNfY2FzdDxGcm9udGVuZER2YnNTdGFuZGFyZD4oZHZicy5zdGFuZGFyZCksCisgICAgICAgICAgICAgICAgLnZjbU1vZGUgPSBzdGF0aWNfY2FzdDxGcm9udGVuZER2YnNWY21Nb2RlPihkdmJzLnZjbSksCisgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgVHVuZXJGcm9udGVuZFVuaW9uU2V0dGluZ3M6OmR2YnQ6IHsKKyAgICAgICAgICAgIGF1dG8gZHZidCA9IHNldHRpbmdzLmdldDxUdW5lckZyb250ZW5kVW5pb25TZXR0aW5nczo6ZHZidD4oKTsKKyAgICAgICAgICAgIGZyb250ZW5kU2V0dGluZ3MuZHZidCh7CisgICAgICAgICAgICAgICAgLmZyZXF1ZW5jeSA9IHN0YXRpY19jYXN0PHVpbnQzMl90PihkdmJ0LmZyZXF1ZW5jeSksCisgICAgICAgICAgICAgICAgLnRyYW5zbWlzc2lvbk1vZGUgPSBzdGF0aWNfY2FzdDxGcm9udGVuZER2YnRUcmFuc21pc3Npb25Nb2RlPigKKyAgICAgICAgICAgICAgICAgICAgICAgIGR2YnQudHJhbnNtaXNzaW9uTW9kZSksCisgICAgICAgICAgICAgICAgLmJhbmR3aWR0aCA9IHN0YXRpY19jYXN0PEZyb250ZW5kRHZidEJhbmR3aWR0aD4oZHZidC5iYW5kd2lkdGgpLAorICAgICAgICAgICAgICAgIC5jb25zdGVsbGF0aW9uID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmREdmJ0Q29uc3RlbGxhdGlvbj4oZHZidC5jb25zdGVsbGF0aW9uKSwKKyAgICAgICAgICAgICAgICAuaGllcmFyY2h5ID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmREdmJ0SGllcmFyY2h5PihkdmJ0LmhpZXJhcmNoeSksCisgICAgICAgICAgICAgICAgLmhwQ29kZXJhdGUgPSBzdGF0aWNfY2FzdDxGcm9udGVuZER2YnRDb2RlcmF0ZT4oZHZidC5ocENvZGVSYXRlKSwKKyAgICAgICAgICAgICAgICAubHBDb2RlcmF0ZSA9IHN0YXRpY19jYXN0PEZyb250ZW5kRHZidENvZGVyYXRlPihkdmJ0LmxwQ29kZVJhdGUpLAorICAgICAgICAgICAgICAgIC5ndWFyZEludGVydmFsID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmREdmJ0R3VhcmRJbnRlcnZhbD4oZHZidC5ndWFyZEludGVydmFsKSwKKyAgICAgICAgICAgICAgICAuaXNIaWdoUHJpb3JpdHkgPSBkdmJ0LmlzSGlnaFByaW9yaXR5LAorICAgICAgICAgICAgICAgIC5zdGFuZGFyZCA9IHN0YXRpY19jYXN0PEZyb250ZW5kRHZidFN0YW5kYXJkPihkdmJ0LnN0YW5kYXJkKSwKKyAgICAgICAgICAgICAgICAuaXNNaXNvID0gZHZidC5pc01pc28sCisgICAgICAgICAgICAgICAgLnBscE1vZGUgPSBzdGF0aWNfY2FzdDxGcm9udGVuZER2YnRQbHBNb2RlPihkdmJ0LnBscE1vZGUpLAorICAgICAgICAgICAgICAgIC5wbHBJZCA9IHN0YXRpY19jYXN0PHVpbnQ4X3Q+KGR2YnQucGxwSWQpLAorICAgICAgICAgICAgICAgIC5wbHBHcm91cElkID0gc3RhdGljX2Nhc3Q8dWludDhfdD4oZHZidC5wbHBHcm91cElkKSwKKyAgICAgICAgICAgIH0pOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBUdW5lckZyb250ZW5kVW5pb25TZXR0aW5nczo6aXNkYnM6IHsKKyAgICAgICAgICAgIGF1dG8gaXNkYnMgPSBzZXR0aW5ncy5nZXQ8VHVuZXJGcm9udGVuZFVuaW9uU2V0dGluZ3M6OmlzZGJzPigpOworICAgICAgICAgICAgZnJvbnRlbmRTZXR0aW5ncy5pc2Ricyh7CisgICAgICAgICAgICAgICAgLmZyZXF1ZW5jeSA9IHN0YXRpY19jYXN0PHVpbnQzMl90Pihpc2Ricy5mcmVxdWVuY3kpLAorICAgICAgICAgICAgICAgIC5zdHJlYW1JZCA9IHN0YXRpY19jYXN0PHVpbnQxNl90Pihpc2Ricy5zdHJlYW1JZCksCisgICAgICAgICAgICAgICAgLnN0cmVhbUlkVHlwZSA9IHN0YXRpY19jYXN0PEZyb250ZW5kSXNkYnNTdHJlYW1JZFR5cGU+KGlzZGJzLnN0cmVhbUlkVHlwZSksCisgICAgICAgICAgICAgICAgLm1vZHVsYXRpb24gPSBzdGF0aWNfY2FzdDxGcm9udGVuZElzZGJzTW9kdWxhdGlvbj4oaXNkYnMubW9kdWxhdGlvbiksCisgICAgICAgICAgICAgICAgLmNvZGVyYXRlID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmRJc2Ric0NvZGVyYXRlPihpc2Ricy5jb2RlUmF0ZSksCisgICAgICAgICAgICAgICAgLnN5bWJvbFJhdGUgPSBzdGF0aWNfY2FzdDx1aW50MzJfdD4oaXNkYnMuc3ltYm9sUmF0ZSksCisgICAgICAgICAgICAgICAgLnJvbGxvZmYgPSB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IGJyZWFrOworICAgIH0KKworICAgIHJldHVybiBmcm9udGVuZFNldHRpbmdzOworfQorCitGcm9udGVuZFNldHRpbmdzRXh0MV8xIFR1bmVyRnJvbnRlbmQ6OmdldEhpZGxGcm9udGVuZFNldHRpbmdzRXh0KAorICAgICAgICBjb25zdCBUdW5lckZyb250ZW5kU2V0dGluZ3MmIGFpZGxTZXR0aW5ncykgeworICAgIEZyb250ZW5kU2V0dGluZ3NFeHQxXzEgZnJvbnRlbmRTZXR0aW5nc0V4dHsKKyAgICAgICAgLmVuZEZyZXF1ZW5jeSA9IHN0YXRpY19jYXN0PHVpbnQzMl90PihhaWRsU2V0dGluZ3MuZW5kRnJlcXVlbmN5KSwKKyAgICAgICAgLmludmVyc2lvbiA9IHN0YXRpY19jYXN0PEZyb250ZW5kU3BlY3RyYWxJbnZlcnNpb24+KGFpZGxTZXR0aW5ncy5pbnZlcnNpb24pLAorICAgIH07CisKKyAgICBhdXRvIHNldHRpbmdzID0gYWlkbFNldHRpbmdzLnNldHRpbmdzOworICAgIHN3aXRjaCAoc2V0dGluZ3MuZ2V0VGFnKCkpIHsKKyAgICAgICAgY2FzZSBUdW5lckZyb250ZW5kVW5pb25TZXR0aW5nczo6YW5hbG9nOiB7CisgICAgICAgICAgICBhdXRvIGFuYWxvZyA9IHNldHRpbmdzLmdldDxUdW5lckZyb250ZW5kVW5pb25TZXR0aW5nczo6YW5hbG9nPigpOworICAgICAgICAgICAgaWYgKGFuYWxvZy5pc0V4dGVuZGVkKSB7CisgICAgICAgICAgICAgICAgZnJvbnRlbmRTZXR0aW5nc0V4dC5zZXR0aW5nRXh0LmFuYWxvZyh7CisgICAgICAgICAgICAgICAgICAgIC5hZnRGbGFnID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmRBbmFsb2dBZnRGbGFnPihhbmFsb2cuYWZ0RmxhZyksCisgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGZyb250ZW5kU2V0dGluZ3NFeHQuc2V0dGluZ0V4dC5ub2luaXQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgVHVuZXJGcm9udGVuZFVuaW9uU2V0dGluZ3M6OmNhYmxlOiB7CisgICAgICAgICAgICBhdXRvIGR2YmMgPSBzZXR0aW5ncy5nZXQ8VHVuZXJGcm9udGVuZFVuaW9uU2V0dGluZ3M6OmNhYmxlPigpOworICAgICAgICAgICAgaWYgKGR2YmMuaXNFeHRlbmRlZCkgeworICAgICAgICAgICAgICAgIGZyb250ZW5kU2V0dGluZ3NFeHQuc2V0dGluZ0V4dC5kdmJjKHsKKyAgICAgICAgICAgICAgICAgICAgLmludGVybGVhdmVNb2RlID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmRDYWJsZVRpbWVJbnRlcmxlYXZlTW9kZT4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHZiYy5pbnRlcmxlYXZlTW9kZSksCisgICAgICAgICAgICAgICAgICAgIC5iYW5kd2lkdGggPSBzdGF0aWNfY2FzdDxGcm9udGVuZER2YmNCYW5kd2lkdGg+KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR2YmMuYmFuZHdpZHRoKSwKKyAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZnJvbnRlbmRTZXR0aW5nc0V4dC5zZXR0aW5nRXh0Lm5vaW5pdCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBUdW5lckZyb250ZW5kVW5pb25TZXR0aW5nczo6ZHZiczogeworICAgICAgICAgICAgYXV0byBkdmJzID0gc2V0dGluZ3MuZ2V0PFR1bmVyRnJvbnRlbmRVbmlvblNldHRpbmdzOjpkdmJzPigpOworICAgICAgICAgICAgaWYgKGR2YnMuaXNFeHRlbmRlZCkgeworICAgICAgICAgICAgICAgIGZyb250ZW5kU2V0dGluZ3NFeHQuc2V0dGluZ0V4dC5kdmJzKHsKKyAgICAgICAgICAgICAgICAgICAgLnNjYW5UeXBlID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmREdmJzU2NhblR5cGU+KGR2YnMuc2NhblR5cGUpLAorICAgICAgICAgICAgICAgICAgICAuaXNEaXNlcWNSeE1lc3NhZ2UgPSBkdmJzLmlzRGlzZXFjUnhNZXNzYWdlLAorICAgICAgICAgICAgICAgIH0pOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBmcm9udGVuZFNldHRpbmdzRXh0LnNldHRpbmdFeHQubm9pbml0KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIFR1bmVyRnJvbnRlbmRVbmlvblNldHRpbmdzOjpkdmJ0OiB7CisgICAgICAgICAgICBhdXRvIGR2YnQgPSBzZXR0aW5ncy5nZXQ8VHVuZXJGcm9udGVuZFVuaW9uU2V0dGluZ3M6OmR2YnQ+KCk7CisgICAgICAgICAgICBpZiAoZHZidC5pc0V4dGVuZGVkKSB7CisgICAgICAgICAgICAgICAgZnJvbnRlbmRTZXR0aW5nc0V4dC5zZXR0aW5nRXh0LmR2YnQoeworICAgICAgICAgICAgICAgICAgICAuY29uc3RlbGxhdGlvbiA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8aGFyZHdhcmU6OnR2Ojp0dW5lcjo6VjFfMTo6RnJvbnRlbmREdmJ0Q29uc3RlbGxhdGlvbj4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdmJ0LmNvbnN0ZWxsYXRpb24pLAorICAgICAgICAgICAgICAgICAgICAudHJhbnNtaXNzaW9uTW9kZSA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8aGFyZHdhcmU6OnR2Ojp0dW5lcjo6VjFfMTo6RnJvbnRlbmREdmJ0VHJhbnNtaXNzaW9uTW9kZT4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdmJ0LnRyYW5zbWlzc2lvbk1vZGUpLAorICAgICAgICAgICAgICAgIH0pOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBmcm9udGVuZFNldHRpbmdzRXh0LnNldHRpbmdFeHQubm9pbml0KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIFR1bmVyRnJvbnRlbmRVbmlvblNldHRpbmdzOjpkdG1iOiB7CisgICAgICAgICAgICBhdXRvIGR0bWIgPSBzZXR0aW5ncy5nZXQ8VHVuZXJGcm9udGVuZFVuaW9uU2V0dGluZ3M6OmR0bWI+KCk7CisgICAgICAgICAgICBmcm9udGVuZFNldHRpbmdzRXh0LnNldHRpbmdFeHQuZHRtYih7CisgICAgICAgICAgICAgICAgLmZyZXF1ZW5jeSA9IHN0YXRpY19jYXN0PHVpbnQzMl90PihkdG1iLmZyZXF1ZW5jeSksCisgICAgICAgICAgICAgICAgLnRyYW5zbWlzc2lvbk1vZGUgPSBzdGF0aWNfY2FzdDxGcm9udGVuZER0bWJUcmFuc21pc3Npb25Nb2RlPigKKyAgICAgICAgICAgICAgICAgICAgICAgIGR0bWIudHJhbnNtaXNzaW9uTW9kZSksCisgICAgICAgICAgICAgICAgLmJhbmR3aWR0aCA9IHN0YXRpY19jYXN0PEZyb250ZW5kRHRtYkJhbmR3aWR0aD4oZHRtYi5iYW5kd2lkdGgpLAorICAgICAgICAgICAgICAgIC5tb2R1bGF0aW9uID0gc3RhdGljX2Nhc3Q8RnJvbnRlbmREdG1iTW9kdWxhdGlvbj4oZHRtYi5tb2R1bGF0aW9uKSwKKyAgICAgICAgICAgICAgICAuY29kZVJhdGUgPSBzdGF0aWNfY2FzdDxGcm9udGVuZER0bWJDb2RlUmF0ZT4oZHRtYi5jb2RlUmF0ZSksC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Z2VyTmF0aXZlPihiaW5kZXIpOworICAgIH0KKworICAgIGJvb2wgaGFzRmVhdHVyZSA9IGZhbHNlOworICAgIGlmIChwYWNrYWdlTWdyICE9IG51bGxwdHIpIHsKKyAgICAgICAgYmluZGVyOjpTdGF0dXMgc3RhdHVzID0gcGFja2FnZU1nci0+aGFzU3lzdGVtRmVhdHVyZShGRUFUVVJFX1RVTkVSLCAwLCAmaGFzRmVhdHVyZSk7CisgICAgICAgIGlmICghc3RhdHVzLmlzT2soKSkgeworICAgICAgICAgICAgQUxPR0UoIiVzOiBoYXNTeXN0ZW1GZWF0dXJlIGZhaWxlZDogJXMiLAorICAgICAgICAgICAgICAgICAgICBfX2Z1bmNfXywgc3RhdHVzLmV4Y2VwdGlvbk1lc3NhZ2UoKS5jX3N0cigpKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBpZiAoIWhhc0ZlYXR1cmUpIHsKKyAgICAgICAgICAgIEFMT0dEKCJDdXJyZW50IGRldmljZSBkb2VzIG5vdCBzdXBwb3J0IHR1bmVyIGZlYXVyZS4iKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgIH0gZWxzZSB7CisgICAgICAgIEFMT0dEKCIlczogQ2Fubm90IGZpbmQgcGFja2FnZSBtYW5hZ2VyLiIsIF9fZnVuY19fKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIDo6bmRrOjpTcEFJQmluZGVyIGJpbmRlcihBU2VydmljZU1hbmFnZXJfd2FpdEZvclNlcnZpY2UoInR2X3R1bmVyX3Jlc291cmNlX21nciIpKTsKKyAgICBtVHVuZXJSZXNvdXJjZU1hbmFnZXIgPSBJVHVuZXJSZXNvdXJjZU1hbmFnZXI6OmZyb21CaW5kZXIoYmluZGVyKTsKKyAgICB1cGRhdGVUdW5lclJlc291cmNlcygpOworfQorCitUdW5lclNlcnZpY2U6On5UdW5lclNlcnZpY2UoKSB7fQorCitiaW5kZXJfc3RhdHV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isgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgbVR1bmVyUmVzb3VyY2VNYW5hZ2VyLT5zZXRMbmJJbmZvTGlzdChoYW5kbGVzKTsKK30KKwordmVjdG9yPGludD4gVHVuZXJTZXJ2aWNlOjpnZXRMbmJIYW5kbGVzKCkgeworICAgIHZlY3RvcjxpbnQ+IGxuYkhhbmRsZXM7CisgICAgaWYgKG1UdW5lciAhPSBOVUxMKSB7CisgICAgICAgIFJlc3VsdCByZXM7CisgICAgICAgIHZlY3RvcjxMbmJJZD4gbG5iSWRzOworICAgICAgICBtVHVuZXItPmdldExuYklkcyhbJl0oUmVzdWx0IHIsIGNvbnN0IGhhcmR3YXJlOjpoaWRsX3ZlYzxMbmJJZD4mIGlkcykgeworICAgICAgICAgICAgbG5iSWRzID0gaWRzOworICAgICAgICAgICAgcmVzID0gcjsKKyAgICAgICAgfSk7CisgICAgICAgIGlmIChyZXMgIT0gUmVzdWx0OjpTVUNDRVNTIHx8IGxuYklkcy5zaXplKCkgPT0gMCkgeworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsbmJJZHMuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICBsbmJIYW5kbGVzLnB1c2hfYmFjayhnZXRSZXNvdXJjZUhhbmRsZUZyb21JZCgoaW50KWxuYklkc1tpXSwgTE5CKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gbG5iSGFuZGxlczsKK30KKworUmVzdWx0IFR1bmVyU2VydmljZTo6Z2V0SGlkbEZyb250ZW5kSWRzKGhpZGxfdmVjPEZyb250ZW5kSWQ+JiBpZHMpIHsKKyAgICBpZiAobVR1bmVyID09IE5VTEwpIHsKKyAgICAgICAgcmV0dXJuIFJlc3VsdDo6Tk9UX0lOSVRJQUxJWkVEOworICAgIH0KKyAgICBSZXN1bHQgcmVzOworICAgIG1UdW5lci0+Z2V0RnJvbnRlbmRJZHMoWyZdKFJlc3VsdCByLCBjb25zdCBoaWRsX3ZlYzxGcm9udGVuZElkPiYgZnJvbnRlbmRJZHMpIHsKKyAgICAgICAgaWRzID0gZnJvbnRlbmRJZHM7CisgICAgICAgIHJlcyA9IHI7CisgICAgfSk7CisgICAgcmV0dXJuIHJlczsKK30KKworUmVzdWx0IFR1bmVyU2VydmljZTo6Z2V0SGlkbEZyb250ZW5kSW5mbyhpbnQgaWQsIEZyb250ZW5kSW5mbyYgaW5mbykgeworICAgIGlmIChtVHVuZXIgPT0gTlVMTCkgeworICAgICAgICByZXR1cm4gUmVzdWx0OjpOT1RfSU5JVElBTElaRUQ7CisgICAgfQorICAgIFJlc3VsdCByZXM7CisgICAgbVR1bmVyLT5nZXRGcm9udGVuZEluZm8oaWQsIFsmXShSZXN1bHQgciwgY29uc3QgRnJvbnRlbmRJbmZvJiBmZUluZm8pIHsKKyAgICAgICAgaW5mbyA9IGZlSW5mbzsKKyAgICAgICAgcmVzID0gcjsKKyAgICB9KTsKKyAgICByZXR1cm4gcmVzOworfQorCitUdW5lckRlbXV4Q2FwYWJpbGl0aWVzIFR1bmVyU2VydmljZTo6Z2V0QWlkbERlbXV4Q2FwcyhEZW11eENhcGFiaWxpdGllcyBjYXBzKSB7CisgICAgVHVuZXJEZW11eENhcGFiaWxpdGllcyBhaWRsQ2Fwc3sKKyAgICAgICAgLm51bURlbXV4ID0gKGludCljYXBzLm51bURlbXV4LAorICAgICAgICAubnVtUmVjb3JkID0gKGludCljYXBzLm51bVJlY29yZCwKKyAgICAgICAgLm51bVBsYXliYWNrID0gKGludCljYXBzLm51bVBsYXliYWNrLAorICAgICAgICAubnVtVHNGaWx0ZXIgPSAoaW50KWNhcHMubnVtVHNGaWx0ZXIsCisgICAgICAgIC5udW1TZWN0aW9uRmlsdGVyID0gKGludCljYXBzLm51bVNlY3Rpb25GaWx0ZXIsCisgICAgICAgIC5udW1BdWRpb0ZpbHRlciA9IChpbnQpY2Fwcy5udW1BdWRpb0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0NhcHMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBGcm9udGVuZFR5cGU6OkFUU0M6IHsKKyAgICAgICAgICAgIGlmIChGcm9udGVuZEluZm86OkZyb250ZW5kQ2FwYWJpbGl0aWVzOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmF0c2NDYXBzCisgICAgICAgICAgICAgICAgICAgID09IGhhbEluZm8uZnJvbnRlbmRDYXBzLmdldERpc2NyaW1pbmF0b3IoKSkgeworICAgICAgICAgICAgICAgIFR1bmVyRnJvbnRlbmRBdHNjQ2FwYWJpbGl0aWVzIGF0c2NDYXBzeworICAgICAgICAgICAgICAgICAgICAubW9kdWxhdGlvbkNhcCA9IChpbnQpaGFsSW5mby5mcm9udGVuZENhcHMuYXRzY0NhcHMoKS5tb2R1bGF0aW9uQ2FwLAorICAgICAgICAgICAgICAgIH07CisgICAgICAgICAgICAgICAgY2Fwcy5zZXQ8VHVuZXJGcm9udGVuZENhcGFiaWxpdGllczo6YXRzY0NhcHM+KGF0c2NDYXBzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgRnJvbnRlbmRUeXBlOjpBVFNDMzogeworICAgICAgICAgICAgaWYgKEZyb250ZW5kSW5mbzo6RnJvbnRlbmRDYXBhYmlsaXRpZXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6YXRzYzNDYXBzCisgICAgICAgICAgICAgICAgICAgID09IGhhbEluZm8uZnJvbnRlbmRDYXBzLmdldERpc2NyaW1pbmF0b3IoKSkgeworICAgICAgICAgICAgICAgIFR1bmVyRnJvbnRlbmRBdHNjM0NhcGFiaWxpdGllcyBhdHNjM0NhcHN7CisgICAgICAgICAgICAgICAgICAgIC5iYW5kd2lkdGhDYXAgPSAoaW50KWhhbEluZm8uZnJvbnRlbmRDYXBzLmF0c2MzQ2FwcygpLmJhbmR3aWR0aENhcCwKKyAgICAgICAgICAgICAgICAgICAgLm1vZHVsYXRpb25DYXAgPSAoaW50KWhhbEluZm8uZnJvbnRlbmRDYXBzLmF0c2MzQ2FwcygpLm1vZHVsYXRpb25DYXAsCisgICAgICAgICAgICAgICAgICAgIC50aW1lSW50ZXJsZWF2ZU1vZGVDYXAgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpaGFsSW5mby5mcm9udGVuZENhcHMuYXRzYzNDYXBzKCkudGltZUludGVybGVhdmVNb2RlQ2FwLAorICAgICAgICAgICAgICAgICAgICAuY29kZVJhdGVDYXAgPSAoaW50KWhhbEluZm8uZnJvbnRlbmRDYXBzLmF0c2MzQ2FwcygpLmNvZGVSYXRlQ2FwLAorICAgICAgICAgICAgICAgICAgICAuZGVtb2RPdXRwdXRGb3JtYXRDYXAKKyAgICAgICAgICAgICAgICAgICAgICAgID0gKGludCloYWxJbmZvLmZyb250ZW5kQ2Fwcy5hdHNjM0NhcHMoKS5kZW1vZE91dHB1dEZvcm1hdENhcCwKKyAgICAgICAgICAgICAgICAgICAgLmZlY0NhcCA9IChpbnQpaGFsSW5mby5mcm9udGVuZENhcHMuYXRzYzNDYXBzKCkuZmVjQ2FwLAorICAgICAgICAgICAgICAgIH07CisgICAgICAgICAgICAgICAgY2Fwcy5zZXQ8VHVuZXJGcm9udGVuZENhcGFiaWxpdGllczo6YXRzYzNDYXBzPihhdHNjM0NhcHMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBGcm9udGVuZFR5cGU6OkRWQkM6IHsKKyAgICAgICAgICAgIGlmIChGcm9udGVuZEluZm86OkZyb250ZW5kQ2FwYWJpbGl0aWVzOjpoaWRsX2Rpc2NyaW1pbmF0b3I6OmR2YmNDYXBzCisgICAgICAgICAgICAgICAgICAgID09IGhhbEluZm8uZnJvbnRlbmRDYXBzLmdldERpc2NyaW1pbmF0b3IoKSkgeworICAgICAgICAgICAgICAgIFR1bmVyRnJvbnRlbmRDYWJsZUNhcGFiaWxpdGllcyBjYWJsZUNhcHN7CisgICAgICAgICAgICAgICAgICAgIC5tb2R1bGF0aW9uQ2FwID0gKGludCloYWxJbmZvLmZyb250ZW5kQ2Fwcy5kdmJjQ2FwcygpLm1vZHVsYXRpb25DYXAsCisgICAgICAgICAgICAgICAgICAgIC5jb2RlUmF0ZUNhcCA9IChpbnQ2NF90KWhhbEluZm8uZnJvbnRlbmRDYXBzLmR2YmNDYXBzKCkuZmVjQ2FwLAorICAgICAgICAgICAgICAgICAgICAuYW5uZXhDYXAgPSAoaW50KWhhbEluZm8uZnJvbnRlbmRDYXBzLmR2YmNDYXBzKCkuYW5uZXhDYXAsCisgICAgICAgICAgICAgICAgfTsKKyAgICAgICAgICAgICAgICBjYXBzLnNldDxUdW5lckZyb250ZW5kQ2FwYWJpbGl0aWVzOjpjYWJsZUNhcHM+KGNhYmxlQ2Fwcyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIEZyb250ZW5kVHlwZTo6RFZCUzogeworICAgICAgICAgICAgaWYgKEZyb250ZW5kSW5mbzo6RnJvbnRlbmRDYXBhYmlsaXRpZXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6ZHZic0NhcHMKKyAgICAgICAgICAgICAgICAgICAgPT0gaGFsSW5mby5mcm9udGVuZENhcHMuZ2V0RGlzY3JpbWluYXRvcigpKSB7CisgICAgICAgICAgICAgICAgVHVuZXJGcm9udGVuZER2YnNDYXBhYmlsaXRpZXMgZHZic0NhcHN7CisgICAgICAgICAgICAgICAgICAgIC5tb2R1bGF0aW9uQ2FwID0gKGludCloYWxJbmZvLmZyb250ZW5kQ2Fwcy5kdmJzQ2FwcygpLm1vZHVsYXRpb25DYXAsCisgICAgICAgICAgICAgICAgICAgIC5jb2RlUmF0ZUNhcCA9IChsb25nKWhhbEluZm8uZnJvbnRlbmRDYXBzLmR2YnNDYXBzKCkuaW5uZXJmZWNDYXAsCisgICAgICAgICAgICAgICAgICAgIC5zdGFuZGFyZCA9IChpbnQpaGFsSW5mby5mcm9udGVuZENhcHMuZHZic0NhcHMoKS5zdGFuZGFyZCwKKyAgICAgICAgICAgICAgICB9OworICAgICAgICAgICAgICAgIGNhcHMuc2V0PFR1bmVyRnJvbnRlbmRDYXBhYmlsaXRpZXM6OmR2YnNDYXBzPihkdmJzQ2Fwcyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBjYXNlIEZyb250ZW5kVHlwZTo6RFZCVDogeworICAgICAgICAgICAgaWYgKEZyb250ZW5kSW5mbzo6RnJvbnRlbmRDYXBhYmlsaXRpZXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6ZHZidENhcHMKKyAgICAgICAgICAgICAgICAgICAgPT0gaGFsSW5mby5mcm9udGVuZENhcHMuZ2V0RGlzY3JpbWluYXRvcigpKSB7CisgICAgICAgICAgICAgICAgVHVuZXJGcm9udGVuZER2YnRDYXBhYmlsaXRpZXMgZHZidENhcHN7CisgICAgICAgICAgICAgICAgICAgIC50cmFuc21pc3Npb25Nb2RlQ2FwID0gKGludCloYWxJbmZvLmZyb250ZW5kQ2Fwcy5kdmJ0Q2FwcygpLnRyYW5zbWlzc2lvbk1vZGVDYXAsCisgICAgICAgICAgICAgICAgICAgIC5iYW5kd2lkdGhDYXAgPSAoaW50KWhhbEluZm8uZnJvbnRlbmRDYXBzLmR2YnRDYXBzKCkuYmFuZHdpZHRoQ2FwLAorICAgICAgICAgICAgICAgICAgICAuY29uc3RlbGxhdGlvbkNhcCA9IChpbnQpaGFsSW5mby5mcm9udGVuZENhcHMuZHZidENhcHMoKS5jb25zdGVsbGF0aW9uQ2FwLAorICAgICAgICAgICAgICAgICAgICAuY29kZVJhdGVDYXAgPSAoaW50KWhhbEluZm8uZnJvbnRlbmRDYXBzLmR2YnRDYXBzKCkuY29kZXJhdGVDYXAsCisgICAgICAgICAgICAgICAgICAgIC5oaWVyYXJjaHlDYXAgPSAoaW50KWhhbEluZm8uZnJvbnRlbmRDYXBzLmR2YnRDYXBzKCkuaGllcmFyY2h5Q2FwLAorICAgICAgICAgICAgICAgICAgICAuZ3VhcmRJbnRlcnZhbENhcCA9IChpbnQpaGFsSW5mby5mcm9udGVuZENhcHMuZHZidENhcHMoKS5ndWFyZEludGVydmFsQ2FwLAorICAgICAgICAgICAgICAgICAgICAuaXNUMlN1cHBvcnRlZCA9IChib29sKWhhbEluZm8uZnJvbnRlbmRDYXBzLmR2YnRDYXBzKCkuaXNUMlN1cHBvcnRlZCwKKyAgICAgICAgICAgICAgICAgICAgLmlzTWlzb1N1cHBvcnRlZCA9IChib29sKWhhbEluZm8uZnJvbnRlbmRDYXBzLmR2YnRDYXBzKCkuaXNNaXNvU3VwcG9ydGVkLAorICAgICAgICAgICAgICAgIH07CisgICAgICAgICAgICAgICAgY2Fwcy5zZXQ8VHVuZXJGcm9udGVuZENhcGFiaWxpdGllczo6ZHZidENhcHM+KGR2YnRDYXBzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgRnJvbnRlbmRUeXBlOjpJU0RCUzogeworICAgICAgICAgICAgaWYgKEZyb250ZW5kSW5mbzo6RnJvbnRlbmRDYXBhYmlsaXRpZXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNkYnNDYXBzCisgICAgICAgICAgICAgICAgICAgID09IGhhbEluZm8uZnJvbnRlbmRDYXBzLmdldERpc2NyaW1pbmF0b3IoKSkgeworICAgICAgICAgICAgICAgIFR1bmVyRnJvbnRlbmRJc2Ric0NhcGFiaWxpdGllcyBpc2Ric0NhcHN7CisgICAgICAgICAgICAgICAgICAgIC5tb2R1bGF0aW9uQ2FwID0gKGludCloYWxJbmZvLmZyb250ZW5kQ2Fwcy5pc2Ric0NhcHMoKS5tb2R1bGF0aW9uQ2FwLAorICAgICAgICAgICAgICAgICAgICAuY29kZVJhdGVDYXAgPSAoaW50KWhhbEluZm8uZnJvbnRlbmRDYXBzLmlzZGJzQ2FwcygpLmNvZGVyYXRlQ2FwLAorICAgICAgICAgICAgICAgIH07CisgICAgICAgICAgICAgICAgY2Fwcy5zZXQ8VHVuZXJGcm9udGVuZENhcGFiaWxpdGllczo6aXNkYnNDYXBzPihpc2Ric0NhcHMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBGcm9udGVuZFR5cGU6OklTREJTMzogeworICAgICAgICAgICAgaWYgKEZyb250ZW5kSW5mbzo6RnJvbnRlbmRDYXBhYmlsaXRpZXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNkYnMzQ2FwcworICAgICAgICAgICAgICAgICAgICA9PSBoYWxJbmZvLmZyb250ZW5kQ2Fwcy5nZXREaXNjcmltaW5hdG9yKCkpIHsKKyAgICAgICAgICAgICAgICBUdW5lckZyb250ZW5kSXNkYnMzQ2FwYWJpbGl0aWVzIGlzZGJzM0NhcHN7CisgICAgICAgICAgICAgICAgICAgIC5tb2R1bGF0aW9uQ2FwID0gKGludCloYWxJbmZvLmZyb250ZW5kQ2Fwcy5pc2RiczNDYXBzKCkubW9kdWxhdGlvbkNhcCwKKyAgICAgICAgICAgICAgICAgICAgLmNvZGVSYXRlQ2FwID0gKGludCloYWxJbmZvLmZyb250ZW5kQ2Fwcy5pc2RiczNDYXBzKCkuY29kZXJhdGVDYXAsCisgICAgICAgICAgICAgICAgfTsKKyAgICAgICAgICAgICAgICBjYXBzLnNldDxUdW5lckZyb250ZW5kQ2FwYWJpbGl0aWVzOjppc2RiczNDYXBzPihpc2RiczNDYXBzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgRnJvbnRlbmRUeXBlOjpJU0RCVDogeworICAgICAgICAgICAgaWYgKEZyb250ZW5kSW5mbzo6RnJvbnRlbmRDYXBhYmlsaXRpZXM6OmhpZGxfZGlzY3JpbWluYXRvcjo6aXNkYnRDYXBzCisgICAgICAgICAgICAgICAgICAgID09IGhhbEluZm8uZnJvbnRlbmRDYXBzLmdldERpc2NyaW1pbmF0b3IoKSkgeworICAgICAgICAgICAgICAgIFR1bmVyRnJvbnRlbmRJc2RidENhcGFiaWxpdGllcyBpc2RidENhcHN7CisgICAgICAgICAgICAgICAgICAgIC5tb2RlQ2FwID0gKGludCloYWxJbmZvLmZyb250ZW5kQ2Fwcy5pc2RidENhcHMoKS5tb2RlQ2FwLAorICAgICAgICAgICAgICAgICAgICAuYmFuZHdpZHRoQ2FwID0gKGludCloYWxJbmZvLmZyb250ZW5kQ2Fwcy5pc2RidENhcHMoKS5iYW5kd2lkdGhDYXAsCisgICAgICAgICAgICAgICAgICAgIC5tb2R1bGF0aW9uQ2FwID0gKGludCloYWxJbmZvLmZyb250ZW5kQ2Fwcy5pc2RidENhcHMoKS5tb2R1bGF0aW9uQ2FwLAorICAgICAgICAgICAgICAgICAgICAuY29kZVJhdGVDYXAgPSAoaW50KWhhbEluZm8uZnJvbnRlbmRDYXBzLmlzZGJ0Q2FwcygpLmNvZGVyYXRlQ2FwLAorICAgICAgICAgICAgICAgICAgICAuZ3VhcmRJbnRlcnZhbENhcCA9IChpbnQpaGFsSW5mby5mcm9udGVuZENhcHMuaXNkYnRDYXBzKCkuZ3VhcmRJbnRlcnZhbENhcCwKKyAgICAgICAgICAgICAgICB9OworICAgICAgICAgICAgICAgIGNhcHMuc2V0PFR1bmVyRnJvbnRlbmRDYXBhYmlsaXRpZXM6OmlzZGJ0Q2Fwcz4oaXNkYnRDYXBzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBicmVhazsKKyAgICB9CisKKyAgICBpbmZvLmNhcHMgPSBjYXBzOworICAgIHJldHVybiBpbmZvOworfQorfSAvLyBuYW1lc3BhY2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bnQ2NEJpdDo6SU5WQUxJRF9QUkVTRU5UQVRJT05fVElNRV9TVEFNUDsKKyAgICAgICAgQUxPR0UoIklUaW1lRmlsdGVyIGlzIG5vdCBpbml0aWFsaXplZCIpOworICAgICAgICByZXR1cm4gU3RhdHVzOjpmcm9tU2VydmljZVNwZWNpZmljRXJyb3Ioc3RhdGljX2Nhc3Q8aW50MzJfdD4oUmVzdWx0OjpVTkFWQUlMQUJMRSkpOworICAgIH0KKworICAgIFJlc3VsdCBzdGF0dXM7CisgICAgbVRpbWVGaWx0ZXItPmdldFNvdXJjZVRpbWUoCisgICAgICAgICAgICBbJl0oUmVzdWx0IHIsIHVpbnQ2NF90IHQpIHsKKyAgICAgICAgICAgICAgICBzdGF0dXMgPSByOworICAgICAgICAgICAgICAgICpfYWlkbF9yZXR1cm4gPSB0OworICAgICAgICAgICAgfSk7CisgICAgaWYgKHN0YXR1cyAhPSBSZXN1bHQ6OlNVQ0NFU1MpIHsKKyAgICAgICAgKl9haWRsX3JldHVybiA9IChpbnQ2NF90KUNvbnN0YW50NjRCaXQ6OklOVkFMSURfUFJFU0VOVEFUSU9OX1RJTUVfU1RBTVA7CisgICAgICAgIHJldHVybiBTdGF0dXM6OmZyb21TZXJ2aWNlU3BlY2lmaWNFcnJvcihzdGF0aWNfY2FzdDxpbnQzMl90PihzdGF0dXMpKTsKKyAgICB9CisgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKK30KKworU3RhdHVzIFR1bmVyVGltZUZpbHRlcjo6Z2V0VGltZVN0YW1wKGludDY0X3QqIF9haWRsX3JldHVybikgeworICAgIGlmIChtVGltZUZpbHRlciA9PSBOVUxMKSB7CisgICAgICAgICpfYWlkbF9yZXR1cm4gPSAoaW50NjRfdClDb25zdGFudDY0Qml0OjpJTlZBTElEX1BSRVNFTlRBVElPTl9USU1FX1NUQU1QOworICAgICAgICBBTE9HRSgiSVRpbWVGaWx0ZXIgaXMgbm90IGluaXRpYWxpemVkIik7CisgICAgICAgIHJldHVyb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mIHRoZSBkZW11eC4KKyAgICAgKi8KKyAgICBJVHVuZXJUaW1lRmlsdGVyIG9wZW5UaW1lRmlsdGVyKCk7CisKKyAgICAvKioKKyAgICAgKiBHZXQgaGFyZHdhcmUgc3luYyBJRCBmb3IgYXVkaW8gYW5kIHZpZGVvLgorICAgICAqLworICAgIGludCBnZXRBdlN5bmNId0lkKElUdW5lckZpbHRlciB0dW5lckZpbHRlcik7CisKKyAgICAvKioKKyAgICAgKiBHZXQgY3VycmVudCB0aW1lIHN0YW1wIHRvIHVzZSBmb3IgQS9WIHN5bmMuCisgICAgICovCisgICAgbG9uZyBnZXRBdlN5bmNUaW1lKGluIGludCBhdlN5bmNId0lkKTsKKworICAgIC8qKgorICAgICAqIE9wZW4gYSBEVlIgKERpZ2l0YWwgVmlkZW8gUmVjb3JkKSBpbnN0YW5jZSBpbiB0aGUgZGVtdXguCisgICAgICovCisgICAgSVR1bmVyRHZyIG9wZW5EdnIoaW4gaW50IGR2YlR5cGUsIGluIGludCBidWZmZXJTaXplLCBpbiBJVHVuZXJEdnJDYWxsYmFjayBjYik7CisKKyAgICAvKioKKyAgICAgKiBDb25uZWN0IENvbmRpdGlvbmFsIEFjY2VzcyBNb2R1bGVzIChDQU0pIHRocm91Z2ggQ29tbW9uIEludGVyZmFjZSAoQ0kpLgorICAgICAqLworICAgIHZvaWQgY29ubmVjdENpQ2FtKGluIGludCBjaUNhbUlkKTsKKworICAgIC8qKgorICAgICAqIERpc2Nvbm5lY3QgQ29uZGl0aW9uYWwgQWNjZXNzIE1vZHVsZXMgKENBTSkuCisgICAgICovCisgICAgdm9pZCBkaXNjb25uZWN0Q2lDYW0oKTsKKworICAgIC8qKgorICAgICAqIFJlbGVhc2VzIHRoZSBJVHVuZXJEZW11eCBpbnN0YW5jZS4KKyAgICAgKi8KKyAgICB2b2lkIGNsb3NlKCk7Cit9CmRpZmYgLS1naXQgYS9zZXJ2aWNlcy90dW5lci9haWRsL2FuZHJvaWQvbWVkaWEvdHYvdH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0dGluZ3MpOworCisgICAgLyoqCisgICAgICogQXR0YWNoIG9uZSBmaWx0ZXIgdG8gRFZSIGludGVyZmFjZSBmb3IgcmVjb3JkaW5nLgorICAgICAqLworICAgIHZvaWQgYXR0YWNoRmlsdGVyKGluIElUdW5lckZpbHRlciBmaWx0ZXIpOworCisgICAgLyoqCisgICAgICogRGV0YWNoIG9uZSBmaWx0ZXIgZnJvbSB0aGUgRFZSJ3MgcmVjb3JkaW5nLgorICAgICAqLworICAgIHZvaWQgZGV0YWNoRmlsdGVyKGluIElUdW5lckZpbHRlciBmaWx0ZXIpOworCisgICAgLyoqCisgICAgICogU3RhcnQgRFZSLgorICAgICAqLworICAgIHZvaWQgc3RhcnQoKTsKKworICAgIC8qKgorICAgICAqIFN0b3AgRFZSLgorICAgICAqLworICAgIHZvaWQgc3RvcCgpOworCisgICAgLyoqCisgICAgICogRmx1c2ggRFZSIGRhdGEuCisgICAgICovCisgICAgdm9pZCBmbHVzaCgpOworCisgICAgLyoqCisgICAgICogY2xvc2UgdGhlIERWUiBpbnN0YW5jZSB0byByZWxlYXNlIHJlc291cmNlIGZvciBEVlIuCisgICAgICovCisgICAgdm9pZCBjbG9zZSgpOworfQpkaWZmIC0tZ2l0IGEvc2VydmljZXMvdHVuZXIvYWlkbC9hbmRyb2lkL21lZGlhL3R2L3R1bmVyL0lUdW5lckR2ckNhbGxiYWNrLmFpZGwgYi9zZXJ2aWNlcy90dW5lci9haWRsL2FuZHJvaWQvbWVkaWEvdHYvdHVuZXIvSVR1bmVyRHZyQ2FsbGJhY2suYWlkbApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5lMjM0ZmU1Ci0tLSAvZGV2L251bGwKKysrIGIvc2VydmljZXMvdHVuZXIvYWlkbC9hbmRyb2lkL21lZGlhL3R2L3R1bmVyL0lUdW5lckR2ckNhbGxiYWNrLmFpZGwKQEAgLTAsMCArMSwzNCBAQAorLyoqCisgKiBDb3B5cmlnaHQgMjAyMS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0LWJpdCBmaWx0ZXIgSWQuCisgICAgICovCisgICAgbG9uZyBnZXRJZDY0Qml0KCk7CisKKyAgICAvKioKKyAgICAgKiBHZXQgdGhlIGRlc2NyaXB0b3Igb2YgdGhlIEZpbHRlcidzIEZNUS4KKyAgICAgKi8KKyAgICBNUURlc2NyaXB0b3I8Ynl0ZSwgU3luY2hyb25pemVkUmVhZFdyaXRlPiBnZXRRdWV1ZURlc2MoKTsKKworICAgIC8qKgorICAgICAqIENvbmZpZ3VyZSB0aGUgZmlsdGVyLgorICAgICAqLworICAgIHZvaWQgY29uZmlndXJlKGluIFR1bmVyRmlsdGVyQ29uZmlndXJhdGlvbiBjb25maWcpOworCisgICAgLyoqCisgICAgICogQ29uZmlndXJlIHRoZSBtb25pdG9yIGV2ZW50IG9mIHRoZSBGaWx0ZXIuCisgICAgICovCisgICAgdm9pZCBjb25maWd1cmVNb25pdG9yRXZlbnQoaW4gaW50IG1vbml0b3JFdmVudFR5cGUpOworCisgICAgLyoqCisgICAgICogQ29uZmlndXJlIHRoZSBjb250ZXh0IGlkIG9mIHRoZSBJUCBGaWx0ZXIuCisgICAgICovCisgICAgdm9pZCBjb25maWd1cmVJcEZpbHRlckNvbnRleHRJZChpbiBpbnQgY2lkKTsKKworICAgIC8qKgorICAgICAqIENvbmZpZ3VyZSB0aGUgc3RyZWFtIHR5cGUgb2YgdGhlIG1lZGlhIEZpbHRlci4KKyAgICAgKi8KKyAgICB2b2lkIGNvbmZpZ3VyZUF2U3RyZWFtVHlwZShpbiBpbnQgYXZTdHJlYW1UeXBlKTsKKworICAgIC8qKgorICAgICAqIEdldCB0aGUgYS92IHNoYXJlZCBtZW1vcnkgaGFuZGxlCisgICAgICovCisgICAgVHVuZXJGaWx0ZXJTaGFyZWRIYW5kbGVJbmZvIGdldEF2U2hhcmVkSGFuZGxlSW5mbygpOworCisgICAgLyoqCisgICAgICogUmVsZWFzZSB0aGUgaGFuZGxlIHJlcG9ydGVkIGJ5IHRoZSBIQUwgZm9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HNldENhbGxiYWNrKGluIElUdW5lckZyb250ZW5kQ2FsbGJhY2sgdHVuZXJGcm9udGVuZENhbGxiYWNrKTsKKworICAgIC8qKgorICAgICAqIFR1bmVzIHRoZSBmcm9udGVuZCB0byB1c2luZyB0aGUgc2V0dGluZ3MgZ2l2ZW4uCisgICAgICoKKyAgICAgKiBAcGFyYW0gc2V0dGluZ3MgdGhlIHNldHRpbmdzIHRvIHR1bmUgd2l0aC4KKyAgICAgKi8KKyAgICB2b2lkIHR1bmUoaW4gVHVuZXJGcm9udGVuZFNldHRpbmdzIHNldHRpbmdzKTsKKworICAgIC8qKgorICAgICAqIFN0b3AgdGhlIHByZXZpb3VzIHR1bmluZy4KKyAgICAgKi8KKyAgICB2b2lkIHN0b3BUdW5lKCk7CisKKyAgICAvKioKKyAgICAgKiBTY2FuIHRoZSBmcm9udGVuZCB0byB1c2UgdGhlIHNldHRpbmdzIGdpdmVuLgorICAgICAqCisgICAgICogQHBhcmFtIHNldHRpbmdzIHRoZSBzZXR0aW5ncyB0byBzY2FuIHdpdGguCisgICAgICogQHBhcmFtIGZyb250ZW5kU2NhblR5cGUgc2NhbiB3aXRoIGdpdmVuIHR5cGUuCisgICAgICovCisgICAgdm9pZCBzY2FuKGluIFR1bmVyRnJvbnRlbmRTZXR0aW5ncyBzZXR0aW5ncywgaW4gaW50IGZyb250ZW5kU2NhblR5cGUpOworCisgICAgLyoqCisgICAgICogU3RvcCB0aGUgcHJldmlvdXMgc2Nhbm5pbmcuCisgICAgICovCisgICAgdm9pZCBzdG9wU2NhbigpOworCisgICAgLyoqCisgICAgICogU2V0cyBMb3ctTm9pc2UgQmxvY2sgZG93bmNvbnZlcnRlciAoTE5CKSBmb3Igc2F0ZWxsaXRlIGZyb250ZW5kLgorICAgICAqCisgICAgICogQHBhcmFtIHR1bmVyIGxuYiBpbnRlcmZhY2UuCisgICAgICovCisgICAgdm9pZCBzZXRMbmIoaW4gSVR1bmVyTG5iIGxuYik7CisKKyAgICAvKioKKyAgICAgKiBFbmFibGUgb3IgRGlzYWJsZSBMb3cgTm9pc2UgQW1wbGlmaWVyIChMTkEpLgorICAgICAqCisgICAgICogQHBhcmFtIGJFbmFibGUgZW5hYmxlIExuYSBvciBub3QuCisgICAgICovCisgICAgdm9pZCBzZXRMbmEoaW4gYm9vbGVhbiBiRW5hYmxlKTsKKworICAgIC8qKgorICAgICAqIExpbmsgRnJvbnRlbmQgdG8gdGhlIGNpY2FtIHdpdGggZ2l2ZW4gaWQuCisgICAgICoKKyAgICAgKiBAcmV0dXJuIGx0cyBpZAorICAgICAqLworICAgIGludCBsaW5rQ2lDYW1Ub0Zyb250ZW5kKGluIGludCBjaUNhbUlkKTsKKworICAgIC8qKgorICAgICAqIFVuaW5rIEZyb250ZW5kIHRvIHRoZSBjaWNhbSB3aXRoIGdpdmVuIGlkLgorICAgICAqLworICAgIHZvaWQgdW5saW5rQ2lDYW1Ub0Zyb250ZW5kKGluIGludCBjaUNhbUlkKTsKKworICAgIC8qKgorICAgICAqIFJlbGVhc2VzIHRoZSBJVHVuZXJGcm9udGVuZCBpbnN0YW5jZS4KKyAgICAgKi8KKyAgICB2b2lkIGNsb3NlKCk7CisKKyAgICAvKioKKyAgICAgKiBHZXRzIHRoZSBzdGF0dXNlcyBvZiB0aGUgZnJvbnRlbmQuCisgICAgICovCisgICAgVHVuZXJGcm9udGVuZFN0YXR1c1tdIGdldFN0YXR1cyhpbiBpbnRbXSBzdGF0dXNUeXBlcyk7CisKKyAgICAvKioKKyAgICAgKiBHZXRzIHRoZSAxLjEgZXh0ZW5kZWQgc3RhdHVzZXMgb2YgdGhlIGZyb250ZW5kLgorICAgICAqLworICAgIFR1bmVyRnJvbnRlbmRTdGF0dXNbXSBnZXRTdGF0dXNFeHRlbmRlZF8xXzEoaW4gaW50W10gc3RhdHVzVHlwZXMpOworCisgICAgLyoqCisgICAgICogR2V0cyB0aGUgaWQgb2YgdGhlIGZyb250ZW5kLgorICAgICAqLworICAgIGludCBnZXRGcm9udGVu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gorICoKKyAqIHtAaGlkZX0KKyAqLworcGFyY2VsYWJsZSBUdW5lckZyb250ZW5kQXRzYzNDYXBhYmlsaXRpZXMgeworICAgIC8qKgorICAgICAqIEJhbmR3aWR0aCBjYXBhYmlsaXR5CisgICAgICovCisgICAgaW50IGJhbmR3aWR0aENhcDsKKworICAgIC8qKgorICAgICAqIE1vZHVsYXRpb24gY2FwYWJpbGl0eQorICAgICAqLworICAgIGludCBtb2R1bGF0aW9uQ2FwOworCisgICAgLyoqCisgICAgICogVGltZUludGVybGVhdmVNb2RlIGNhcGFiaWxpdHkKKyAgICAgKi8KKyAgICBpbnQgdGltZUludGVybGVhdmVNb2RlQ2FwOworCisgICAgLyoqCisgICAgICogQ29kZVJhdGUgY2FwYWJpbGl0eQorICAgICAqLworICAgIGludCBjb2RlUmF0ZUNhcDsKKworICAgIC8qKgorICAgICAqIEZFQyBjYXBhYmlsaXR5CisgICAgICovCisgICAgaW50IGZlY0NhcDsKKworICAgIC8qKgorICAgICAqIERlbW9kdWxhdG9yIE91dHB1dCBGb3JtYXQgY2FwYWJpbGl0eQorICAgICAqLworICAgIGludCBkZW1vZE91dHB1dEZvcm1hdENhcDsKK30KZGlmZiAtLWdpdCBhL3NlcnZpY2VzL3R1bmVyL2FpZGwvYW5kcm9pZC9tZWRpYS90di90dW5lci9UdW5lckZyb250ZW5kQXRzYzNQbHBTZXR0aW5ncy5haWRsIGIvc2VydmljZXMvdHVuZXIvYWlkbC9hbmRyb2lkL21lZGlhL3R2L3R1bmVyL1R1bmVyRnJvbnRlbmRBdHNjM1BscFNldHRpbmdzLmFpZGwKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uYjI5ZTFmNwotLS0gL2Rldi9udWxsCisrKyBiL3NlcnZpY2VzL3R1bmVyL2FpZGwvYW5kcm9pZC9tZWRpYS90di90dW5lci9UdW5lckZyb250ZW5kQXRzYzNQbHBTZXR0aW5ncy5haWRsCkBAIC0wLDAgKzEsMzcgQ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AgICogQW5hbG9nIEZyb250ZW5kIENhcGFiaWxpdGllcworICAgICAqLworICAgIFR1bmVyRnJvbnRlbmRBbmFsb2dDYXBhYmlsaXRpZXMgYW5hbG9nQ2FwczsKKworICAgIC8qKgorICAgICAqIEFUU0MgRnJvbnRlbmQgQ2FwYWJpbGl0aWVzCisgICAgICovCisgICAgVHVuZXJGcm9udGVuZEF0c2NDYXBhYmlsaXRpZXMgYXRzY0NhcHM7CisKKyAgICAvKioKKyAgICAgKiBBVFNDMyBGcm9udGVuZCBDYXBhYmlsaXRpZXMKKyAgICAgKi8KKyAgICBUdW5lckZyb250ZW5kQXRzYzNDYXBhYmlsaXRpZXMgYXRzYzNDYXBzOworCisgICAgLyoqCisgICAgICogQ2FibGUgRnJvbnRlbmQgQ2FwYWJpbGl0aWVzCisgICAgICovCisgICAgVHVuZXJGcm9udGVuZENhYmxlQ2FwYWJpbGl0aWVzIGNhYmxlQ2FwczsKKworICAgIC8qKgorICAgICAqIERWQlMgRnJvbnRlbmQgQ2FwYWJpbGl0aWVzCisgICAgICovCisgICAgVHVuZXJGcm9udGVuZER2YnNDYXBhYmlsaXRpZXMgZHZic0NhcHM7CisKKyAgICAvKioKKyAgICAgKiBEVkJUIEZyb250ZW5kIENhcGFiaWxpdGllcworICAgICAqLworICAgIFR1bmVyRnJvbnRlbmREdmJ0Q2FwYWJpbGl0aWVzIGR2YnRDYXBzOworCisgICAgLyoqCisgICAgICogSVNEQi1TIEZyb250ZW5kIENhcGFiaWxpdGllcworICAgICAqLworICAgIFR1bmVyRnJvbnRlbmRJc2Ric0NhcGFiaWxpdGllcyBpc2Ric0NhcHM7CisKKyAgICAvKioKKyAgICAgKiBJU0RCLVMzIEZyb250ZW5kIENhcGFiaWxpdGllcworICAgICAqLworICAgIFR1bmVyRnJvbnRlbmRJc2RiczNDYXBhYmlsaXRpZXMgaXNkYnMzQ2FwczsKKworICAgIC8qKgorICAgICAqIElTREItVCBGcm9udGVuZCBDYXBhYmlsaXRpZXMKK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2YnNTZXR0aW5ncyB7CisgICAgLyoqCisgICAgICogU2lnbmFsIGZyZXF1ZW5jeSBpbiBIZXJ0egorICAgICAqLworICAgIGludCBmcmVxdWVuY3k7CisKKyAgICBpbnQgbW9kdWxhdGlvbjsKKworICAgIFR1bmVyRnJvbnRlbmREdmJzQ29kZVJhdGUgY29kZVJhdGU7CisKKyAgICBpbnQgc3ltYm9sUmF0ZTsKKworICAgIC8qKgorICAgICAqIFJvbGwgb2ZmIHR5cGUuCisgICAgICovCisgICAgaW50IHJvbGxvZmY7CisKKyAgICAvKioKKyAgICAgKiBQaWxvdCBtb2RlLgorICAgICAqLworICAgIGludCBwaWxvdDsKKworICAgIGludCBpbnB1dFN0cmVhbUlkOworCisgICAgaW50IHN0YW5kYXJkOworCisgICAgLyoqCisgICAgICogVmNtIG1vZGUuCisgICAgICovCisgICAgaW50IHZjbTsKKworICAgIC8qKgorICAgICAqIEZpZWxkcyBhZnRlciBpc0V4dGVuZGVkIGFyZSBvbmx5IHZhbGlkIHdoZW4gaXNFeHRlbmRlZCBpcyB0cnVlCisgICAgICovCisgICAgYm9vbGVhbiBpc0V4dGVuZGVkOworCisgICAgaW50IHNjYW5UeXBlOworCisgICAgYm9vbGVhbiBpc0Rpc2VxY1J4TWVzc2FnZTsKK30KZGlmZiAtLWdpdCBhL3NlcnZpY2VzL3R1bmVyL2FpZGwvYW5kcm9pZC9tZWRpYS90di90dW5lci9UdW5lckZyb250ZW5kRHZidENhcGFiaWxpdGllcy5haWRsIGIvc2VydmljZXMvdHVuZXIvYWlkbC9hbmRyb2lkL21lZGlhL3R2L3R1bmVyL1R1bmVyRnJvbnRlbmREdmJ0Q2FwYWJpbGl0aWVzLmFpZGwKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uNzNmMTZkZAotLS0gL2Rldi9udWxsCisrKyBiL3NlcnZpY2VzL3R1bmVyL2FpZGwvYW5kcm9pZC9tZWRpYS90di90dW5lci9UdW5lckZyb250Z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yB7CisgICAgLyoqCisgICAgICogVHJhbnNtaXNzaW9uIE1vZGUgY2FwYWJpbGl0eQorICAgICAqLworICAgIGludCB0cmFuc21pc3Npb25Nb2RlQ2FwOworCisgICAgLyoqCisgICAgICogQmFuZHdpZHRoIGNhcGFiaWxpdHkKKyAgICAgKi8KKyAgICBpbnQgYmFuZHdpZHRoQ2FwOworCisgICAgLyoqCisgICAgICogQ29uc3RlbGxhdGlvbiBjYXBhYmlsaXR5CisgICAgICovCisgICAgaW50IGNvbnN0ZWxsYXRpb25DYXA7CisKKyAgICAvKioKKyAgICAgKiBDb2RlIFJhdGUgY2FwYWJpbGl0eQorICAgICAqLworICAgIGludCBjb2RlUmF0ZUNhcDsKKworICAgIC8qKgorICAgICAqIEhpZXJhcmNoeSBUeXBlIGNhcGFiaWxpdHkKKyAgICAgKi8KKyAgICBpbnQgaGllcmFyY2h5Q2FwOworCisgICAgLyoqCisgICAgICogR3VhcmQgSW50ZXJ2YWwgY2FwYWJpbGl0eQorICAgICAqLworICAgIGludCBndWFyZEludGVydmFsQ2FwOworCisgICAgLyoqCisgICAgICogVDIgU3VwcG9ydCBjYXBhYmlsaXR5CisgICAgICovCisgICAgYm9vbGVhbiBpc1QyU3VwcG9ydGVkOworCisgICAgLyoqCisgICAgICogTWlzbyBTdXBwb3J0IGNhcGFiaWxpdHkKKyAgICAgKi8KKyAgICBib29sZWFuIGlzTWlzb1N1cHBvcnRlZDsKK30KZGlmZiAtLWdpdCBhL3NlcnZpY2VzL3R1bmVyL2FpZGwvYW5kcm9pZC9tZWRpYS90di90dW5lci9UdW5lckZyb250ZW5kRHZidFNldHRpbmdzLmFpZGwgYi9zZXJ2aWNlcy90dW5lci9haWRsL2FuZHJvaWQvbWVkaWEvdHYvdHVuZXIvVHVuZXJGcm9udGVuZER2YnRTZXR0aW5ncy5haWRsCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjE0Yzk0MmEKLS0tIC9kZXYvbnVsbAor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BoaWRlfQorICovCitwYXJjZWxhYmxlIFR1bmVyRnJvbnRlbmREdmJ0U2V0dGluZ3MgeworICAgIC8qKgorICAgICAqIFNpZ25hbCBmcmVxdWVuY3kgaW4gSGVydHoKKyAgICAgKi8KKyAgICBpbnQgZnJlcXVlbmN5OworCisgICAgaW50IHRyYW5zbWlzc2lvbk1vZGU7CisKKyAgICBpbnQgYmFuZHdpZHRoOworCisgICAgaW50IGNvbnN0ZWxsYXRpb247CisKKyAgICBpbnQgaGllcmFyY2h5OworCisgICAgLyoqCisgICAgICogQ29kZSBSYXRlIGZvciBIaWdoIFByaW9yaXR5IGxldmVsCisgICAgICovCisgICAgaW50IGhwQ29kZVJhdGU7CisKKyAgICAvKioKKyAgICAgKiBDb2RlIFJhdGUgZm9yIExvdyBQcmlvcml0eSBsZXZlbAorICAgICAqLworICAgIGludCBscENvZGVSYXRlOworCisgICAgaW50IGd1YXJkSW50ZXJ2YWw7CisKKyAgICBib29sZWFuIGlzSGlnaFByaW9yaXR5OworCisgICAgaW50IHN0YW5kYXJkOworCisgICAgYm9vbGVhbiBpc01pc287CisKKyAgICAvKioKKyAgICAgKiBQaHlzaWNhbCBMYXllciBQaXBlIChQTFApIG1vZGUKKyAgICAgKi8KKyAgICBpbnQgcGxwTW9kZTsKKworICAgIC8qKgorICAgICAqIFBoeXNpY2FsIExheWVyIFBpcGUgKFBMUCkgSWQKKyAgICAgKi8KKyAgICBpbnQgcGxwSWQ7CisKKyAgICAvKioKKyAgICAgKiBQaHlzaWNhbCBMYXllciBQaXBlIChQTFApIEdyb3VwIElkCisgICAgICovCisgICAgaW50IHBscEdyb3VwSWQ7CisKKyAgICAvKioKKyAgICAgKiBGaWVsZHMgYWZ0ZXIgaXNFeHRlbmRlZCBhcmUgb25seSB2YWxpZCB3aGVuIGlzRXh0ZW5kZWQgaXMgdHJ1ZQorICAgICAqLworICAgIGJvb2xlYW4gaXNFeHRlbmRlZDsKK30KZGlmZiAtLWdpdCBhL3NlcnZpY2VzL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HRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCisgKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KKyAqLworCitwYWNrYWdlIGFuZHJvaWQubWVkaWEudHYudHVuZXI7CisKK2ltcG9ydCBhbmRyb2lkLm1lZGlhLnR2LnR1bmVyLlR1bmVyRnJvbnRlbmRDYXBhYmlsaXRpZXM7CisKKy8qKgorICogRnJvbnRlbmRJbmZvIGludGVyZmFjZSB0aGF0IGNhcnJpZXMgdHVuZXIgZnJvbnRlbmQgaW5mb3JtYXRpb24uCisgKgorICogPHA+VGhpcyBpcyB1c2VkIHRvIHVwZGF0ZSB0aGUgVHVuZXJSZXNvdXJjZU1hbmFnZXIgYW5kIHBhc3MgRnJvbnRlbmQKKyAqIGluZm9ybWF0aW9uIGZyb20gSEFMIHRvIHRoZSBjbGllbnQgc2lkZS4KKyAqCisgKiB7QGhpZGV9CisgKi8KK3BhcmNlbGFibGUgVHVuZXJGcm9udGVuZEluZm8geworICAgIC8qKgorICAgICAqIEZyb250ZW5kIEhhbmRsZQorICAgICAqLworICAgIGludCBoYW5kbGU7CisKKyAgICAvKioKKyAgICAgKiBGcm9udGVuZCBUeXBlCisgICAgICovCisgICAgaW50IHR5cGU7CisKKyAgICAvKioKKyAgICAgKiBNaW5pbXVtIEZyZXF1ZW5jeSBpbiBIZXJ0egorICAgICAqLworICAgIGludCBtaW5GcmVxdWVuY3k7CisKKyAgICAvKioKKyAgICAgKiBNYXhpbXVtIEZyZXF1ZW5jeSBpbiBIZXJ0egorICAgICAqLworICAgIGludCBtYXhGcmVxdWVuY3k7CisKKyAgICAvKioKKyAgICAgKiBNaW5pbXVtIHN5bWJvbHMgcGVyIHNlY29uZAorICAgICAqLworICAgIGludCBtaW5TeW1ib2xSYXRlOworCisgICAgLyoqCisgICAgICogTWF4aW11bSBzeW1ib2xzIHBlciBzZWNvbmQKKyAgICAgKi8KKyAgICBp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vZiBlcnJvciBiaXRzIHBlciAxIGJpbGxpb24gYml0cyBiZWZvcmUgRkVDLgorICAgICAqLworICAgIGludCBwcmVCZXI7CisKKyAgICAvKioKKyAgICAgKiBTaWduYWwgUXVhbGl0eSBpbiBwZXJjZW50LgorICAgICAqLworICAgIGludCBzaWduYWxRdWFsaXR5OworCisgICAgLyoqCisgICAgICogU2lnbmFsIFN0cmVuZ3RoIG1lYXN1cmVkIGJ5IDAuMDAxIGRCbS4KKyAgICAgKi8KKyAgICBpbnQgc2lnbmFsU3RyZW5ndGg7CisKKyAgICAvKioKKyAgICAgKiBTeW1ib2xzIHBlciBzZWNvbmQKKyAgICAgKi8KKyAgICBpbnQgc3ltYm9sUmF0ZTsKKworICAgIGxvbmcgaW5uZXJGZWM7CisKKyAgICAvKioKKyAgICAgKiBDaGVjayBmcm9udGVuZCB0eXBlIHRvIGRlY2lkZSB0aGUgaGlkbCB0eXBlIHZhbHVlCisgICAgICovCisgICAgaW50IG1vZHVsYXRpb247CisKKyAgICBpbnQgaW52ZXJzaW9uOworCisgICAgaW50IGxuYlZvbHRhZ2U7CisKKyAgICBieXRlIHBscElkOworCisgICAgYm9vbGVhbiBpc0VXQlM7CisKKyAgICAvKioKKyAgICAgKiBBR0MgdmFsdWUgaXMgbm9ybWFsaXplZCBmcm9tIDAgdG8gMjU1LgorICAgICAqLworICAgIGJ5dGUgYWdjOworCisgICAgYm9vbGVhbiBpc0xuYU9uOworCisgICAgYm9vbGVhbltdIGlzTGF5ZXJFcnJvcjsKKworICAgIC8qKgorICAgICAqIE1FUiB2YWx1ZSBtZWFzdXJlZCBieSAwLjAwMSBkQgorICAgICAqLworICAgIGludCBtZXI7CisKKyAgICAvKioKKyAgICAgKiBGcmVxdWVuY3kgZGlmZmVyZW5jZSBpbiBIZXJ0ei4KKyAgICAgKi8KKyAgICBpbnQgZnJlcU9mZnNldDsKKworICAgIGludCBoaWVyYXJjaHk7CisKKyAgICBib29sZWFuIGlzUmZMb2NrZWQ7CisK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zbWlzc2lvbk1vZGU7CisKKyAgICAvKioKKyAgICAgKiBVbmNvcnJlY3RhYmxlIEVycm9yIENvdW50cyBvZiB0aGUgZnJvbnRlbmQncyBQaHlzaWNhbCBMYXllciBQaXBlIChQTFApCisgICAgICogc2luY2UgdGhlIGxhc3QgdHVuZSBvcGVyYXRpb24uCisgICAgICovCisgICAgaW50IHVlYzsKKworICAgIC8qKgorICAgICAqIFRoZSBjdXJyZW50IERWQi1UMiBzeXN0ZW0gaWQgc3RhdHVzLgorICAgICAqLworICAgIGNoYXIgc3lzdGVtSWQ7CisKKyAgICAvKioKKyAgICAgKiBGcm9udGVuZCBJbnRlcmxlYXZpbmcgTW9kZXMuIENoZWNrIGZyb250ZW5kIHR5cGUgdG8gZGVjaWRlIHRoZSBoaWRsIHR5cGUgdmFsdWUuCisgICAgICovCisgICAgaW50W10gaW50ZXJsZWF2aW5nOworCisgICAgLyoqCisgICAgICogU2VnbWVudHMgaW4gSVNEQi1UIFNwZWNpZmljYXRpb24gb2YgYWxsIHRoZSBjaGFubmVscy4KKyAgICAgKi8KKyAgICBieXRlW10gaXNkYnRTZWdtZW50OworCisgICAgLyoqCisgICAgICogVHJhbnNwb3J0IFN0cmVhbSBEYXRhIFJhdGUgaW4gQlBTIG9mIHRoZSBjdXJyZW50IGNoYW5uZWwuCisgICAgICovCisgICAgaW50W10gdHNEYXRhUmF0ZTsKKworICAgIC8qKgorICAgICAqIFJvbGwgT2ZmIFR5cGUgc3RhdHVzIG9mIHRoZSBmcm9udGVuZC4gQ2hlY2sgZnJvbnRlbmQgdHlwZSB0byBkZWNpZGUgdGhlIGhpZGwgdHlwZSB2YWx1ZS4KKyAgICAgKi8KKyAgICBpbnQgcm9sbE9mZjsKKworICAgIC8qKgorICAgICAqIElmIHRoZSBmcm9udGVuZCBjdXJyZW50bHkgc3VwcG9ydHMgTUlTTyBvciBub3QuCisgICAgICovCisgICAgYm9vbGVhbiBpc01pc287CisKKyAgICAvKioKKyAgICAgKiBJZiB0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nIGlzIGluICR7REVWX0JSQU5DSH0uJHtOT1JNQUx9IgotICAgICAgICBlY2hvIC1lICR7V0FSTklOR19GVUxMfQotICAgICAgICBleGl0IDEKLSAgICBmaQotZG9uZQotCi1pZiBbWyAhICRQV0QgPX4gZnJhbWV3b3Jrcy9hdiBdXTsgdGhlbgotICAgIGV4aXQgMAotZmkKLQotbWFpbmxpbmVfY291bnQ9MAotdG90YWxfY291bnQ9MAotZWNobwotd2hpbGUgcmVhZCAtciBmaWxlIDsgZG8KLSAgICAoKCB0b3RhbF9jb3VudCsrICkpCi0gICAgZm9yIHBhdGggaW4gIiR7TUFJTkxJTkVfRlJBTUVXT1JLU19BVl9QQVRIU1tAXX0iOyBkbwotICAgICAgICBpZiBbWyAkZmlsZSA9fiBeJHBhdGggXV07IHRoZW4KLSAgICAgICAgICAgIGVjaG8gLWUgIiR7UkVEfVRoZSBzb3VyY2Ugb2YgdHJ1dGggZm9yICckZmlsZScgaXMgaW4gJHtERVZfQlJBTkNIfS4ke05PUk1BTH0iCi0gICAgICAgICAgICAoKCBtYWlubGluZV9jb3VudCsrICkpCi0gICAgICAgICAgICBicmVhawotICAgICAgICBmaQotICAgIGRvbmUKLWRvbmUgPCA8KGdpdCBzaG93IC0tbmFtZS1vbmx5IC0tcHJldHR5PWZvcm1hdDogJDEgfCBncmVwIC0tICIkMiIpCi0KLWlmICgoIG1haW5saW5lX2NvdW50ICE9IDAgKSk7IHRoZW4KLSAgICBpZiAoKCBtYWlubGluZV9jb3VudCA9PSB0b3RhbF9jb3VudCApKTsgdGhlbgotICAgICAgICBlY2hvIC1lICR7V0FSTklOR19GVUxMfQotICAgIGVsc2UKLSAgICAgICAgZWNobyAtZSAke1dBUk5JTkdfUEFSVElBTH0KLSAgICBmaQotICAgIGV4aXQgMQotZmkKLWV4aXQgMApkaWZmIC0tZ2l0IGEvdG9vbHMvbWFpbmxpbmVfaG9va19wYXJ0aWFsLnNoIGIvdG9vbHMvbWFpbmxpbmVfaG9va19wYXJ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