From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12503 invoked by alias); 14 May 2003 13:16:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 12479 invoked by uid 71); 14 May 2003 13:16:00 -0000 Resent-Date: 14 May 2003 13:16:00 -0000 Resent-Message-ID: <20030514131600.12478.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, hijaszu@mail.novo-iram.hu Received: (qmail 32495 invoked by uid 48); 14 May 2003 13:11:00 -0000 Message-Id: <20030514131100.32494.qmail@sources.redhat.com> Date: Wed, 14 May 2003 13:16:00 -0000 From: hijaszu@mail.novo-iram.hu Reply-To: hijaszu@mail.novo-iram.hu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/10780: compiler crash on code with error X-SW-Source: 2003-05/txt/msg01636.txt.bz2 List-Id: >Number: 10780 >Category: c++ >Synopsis: compiler crash on code with error >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed May 14 13:16:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Zimler Attila >Release: gcc 3.2.3 >Organization: >Environment: i686 Linux >Description: compiler crash on the code. >How-To-Repeat: g++ main.ii (which is attached) >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="main.ii" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="main.ii" IyAxICJtYWluLmNwcCIKIyAxICI8YnVpbHQtaW4+IgojIDEgIjxjb21tYW5kIGxpbmU+IgojIDEg Im1haW4uY3BwIgojIDEgIi91c3IvaW5jbHVkZS9nK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uc3QgY2hhciAq X19zMikKICAgICB0aHJvdyAoKSBfX2F0dHJpYnV0ZV9fICgoX19wdXJlX18pKTsKCgpleHRlcm4g aW50IHN0cm5jYXNlY21wIChfX2NvbnN0IGNoYXIgKl9fczEsIF9fY29uc3QgY2hhciAqX19zMiwg c2l6ZV90IF9fbikKICAgICB0aHJvdyAoKSBfX2F0dHJpYnV0ZV9fICgoX19wdXJlX18pKTsKCgoK CgpleHRlcm4gaW50IF9fc3RyY2FzZWNtcF9sIChfX2NvbnN0IGNoYXIgKl9fczEsIF9fY29uc3Qg Y2hhciAqX19zMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgX19sb2NhbGVfdCBfX2xvYykg dGhyb3cgKCkgX19hdHRyaWJ1dGVfXyAoKF9fcHVyZV9fKSk7CgpleHRlcm4gaW50IF9fc3RybmNh c2VjbXBfbCAoX19jb25zdCBjaGFyICpfX3MxLCBfX2NvbnN0IGNoYXIgKl9fczIsCiAgICAgICAg ICAgICAgICAgICAgICAgICAgICBzaXplX3QgX19uLCBfX2xvY2FsZV90IF9fbG9jKQogICAgIHRo cm93ICgpIF9fYXR0cmlidXRlX18gKChfX3B1cmVfXykpOwoKCgoKCmV4dGVybiBjaGFyICpzdHJz ZXAgKGNoYXIgKipfX3Jlc3RyaWN0IF9fc3RyaW5ncCwKICAgICAgICAgICAgICAgICAgICAgX19j b25zdCBjaGFyICpfX3Jlc3RyaWN0IF9fZGVsaW0pIHRocm93ICgpOwoKCgoKZXh0ZXJuIGludCBz dHJ2ZXJzY21wIChfX2NvbnN0IGNoYXIgKl9fczEsIF9fY29uc3QgY2hhciAqX19zMikKICAgICB0 aHJvdyAoKSBfX2F0dHJpYnV0ZV9fICgoX19wdXJlX18pKTsKCgpleHRlcm4gY2hhciAqc3Ryc2ln bmFsIChpbnQgX19zaWcpIHRocm93ICgpOwoKCmV4dGVybiBjaGFyICpfX3N0cGNweSAoY2hhciAq X19yZXN0cmljdCBfX2Rlc3QsIF9fY29uc3QgY2hh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9z dGVwICopOwp0eXBlZGVmIHZvaWQgKCpfX2djb252X2VuZF9mY3QpIChzdHJ1Y3QgX19nY29udl9z dGVwICopOwoKCgp0eXBlZGVmIGludCAoKl9fZ2NvbnZfdHJhbnNfZmN0KSAoc3RydWN0IF9fZ2Nv bnZfc3RlcCAqLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0IF9fZ2Nv bnZfc3RlcF9kYXRhICosIHZvaWQgKiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IF9fY29uc3QgdW5zaWduZWQgY2hhciAqLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgX19jb25zdCB1bnNpZ25lZCBjaGFyICoqLAogICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgX19jb25zdCB1bnNpZ25lZCBjaGFyICosIHVuc2lnbmVkIGNoYXIgKiosCiAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgKik7CgoKdHlwZWRlZiBpbnQgKCpfX2dj b252X3RyYW5zX2NvbnRleHRfZmN0KSAodm9pZCAqLCBfX2NvbnN0IHVuc2lnbmVkIGNoYXIgKiwK ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19jb25zdCB1bnNpZ25l ZCBjaGFyICosCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuc2ln bmVkIGNoYXIgKiwgdW5zaWduZWQgY2hhciAqKTsKCgp0eXBlZGVmIGludCAoKl9fZ2NvbnZfdHJh bnNfcXVlcnlfZmN0KSAoX19jb25zdCBjaGFyICosIF9fY29uc3QgY2hhciAqKiosCiAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgKik7CgoKdHlwZWRlZiBpbnQg KCpfX2djb252X3RyYW5zX2luaXRfZmN0KSAodm9pZCAqKiwgY29uc3QgY2hhciAqKTsKdHlwZWRl ZiB2b2lkICgqX19nY29udl90cmFu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90ICoqLCBjaGFyICos CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgKiwgY2hh ciAqKik7CiAgZW51bSBfX2NvZGVjdnRfcmVzdWx0ICgqX19jb2RlY3Z0X2RvX3Vuc2hpZnQpIChz dHJ1Y3QgX0lPX2NvZGVjdnQgKiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIF9fbWJzdGF0ZV90ICosIGNoYXIgKiwKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgKiwgY2hhciAqKik7CiAgZW51bSBfX2Nv ZGVjdnRfcmVzdWx0ICgqX19jb2RlY3Z0X2RvX2luKSAoc3RydWN0IF9JT19jb2RlY3Z0ICosCiAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19tYnN0YXRlX3QgKiwK ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICos IGNvbnN0IGNoYXIgKiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBjb25zdCBjaGFyICoqLCB3Y2hhcl90ICosCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgd2NoYXJfdCAqLCB3Y2hhcl90ICoqKTsKICBpbnQgKCpfX2NvZGVjdnRf ZG9fZW5jb2RpbmcpIChzdHJ1Y3QgX0lPX2NvZGVjdnQgKik7CiAgaW50ICgqX19jb2RlY3Z0X2Rv X2Fsd2F5c19ub2NvbnYpIChzdHJ1Y3QgX0lPX2NvZGVjdnQgKik7CiAgaW50ICgqX19jb2RlY3Z0 X2RvX2xlbmd0aCkgKHN0cnVjdCBfSU9fY29kZWN2dCAqLCBfX21ic3RhdGVfdCAqLAogICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICosIGNvbnN0IGNoYXIgKiwgc2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3N0ZGlvLmgiIDMKZXh0ZXJuIEZJTEUgKmZv cGVuNjQgKF9fY29uc3QgY2hhciAqX19yZXN0cmljdCBfX2ZpbGVuYW1lLAogICAgICAgICAgICAg ICAgICAgICAgX19jb25zdCBjaGFyICpfX3Jlc3RyaWN0IF9fbW9kZXMpIHRocm93ICgpOwpleHRl cm4gRklMRSAqZnJlb3BlbjY0IChfX2NvbnN0IGNoYXIgKl9fcmVzdHJpY3QgX19maWxlbmFtZSwK ICAgICAgICAgICAgICAgICAgICAgICAgX19jb25zdCBjaGFyICpfX3Jlc3RyaWN0IF9fbW9kZXMs CiAgICAgICAgICAgICAgICAgICAgICAgIEZJTEUgKl9fcmVzdHJpY3QgX19zdHJlYW0pIHRocm93 ICgpOwoKCgoKZXh0ZXJuIEZJTEUgKmZkb3BlbiAoaW50IF9fZmQsIF9fY29uc3QgY2hhciAqX19t b2RlcykgdGhyb3cgKCk7CgoKCgoKZXh0ZXJuIEZJTEUgKmZvcGVuY29va2llICh2b2lkICpfX3Jl c3RyaWN0IF9fbWFnaWNfY29va2llLAogICAgICAgICAgICAgICAgICAgICAgICAgIF9fY29uc3Qg Y2hhciAqX19yZXN0cmljdCBfX21vZGVzLAogICAgICAgICAgICAgICAgICAgICAgICAgIF9JT19j b29raWVfaW9fZnVuY3Rpb25zX3QgX19pb19mdW5jcykgdGhyb3cgKCk7CgoKZXh0ZXJuIEZJTEUg KmZtZW1vcGVuICh2b2lkICpfX3MsIHNpemVfdCBfX2xlbiwgX19jb25zdCBjaGFyICpfX21vZGVz KSB0aHJvdyAoKTsKCgoKCmV4dGVybiBGSUxFICpvcGVuX21lbXN0cmVhbSAoY2hhciAqKl9fcmVz dHJpY3QgX19idWZsb2MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90ICpfX3Jl c3RyaWN0IF9fc2l6ZWxvYykgdGhyb3cgKCk7CgoKCgoKZXh0ZXJuIHZvaWQgc2V0YnVmIChGSUxF ICpfX3Jlc3RyaWN0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XN0cmljdCBfX2xpbmVwdHIsCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBzaXplX3QgKl9fcmVzdHJpY3QgX19uLCBpbnQgX19kZWxpbWl0 ZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGSUxFICpfX3Jlc3RyaWN0IF9fc3Ry ZWFtKSB0aHJvdyAoKTsKZXh0ZXJuIF9fc3NpemVfdCBnZXRkZWxpbSAoY2hhciAqKl9fcmVzdHJp Y3QgX19saW5lcHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCAqX19yZXN0 cmljdCBfX24sIGludCBfX2RlbGltaXRlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBG SUxFICpfX3Jlc3RyaWN0IF9fc3RyZWFtKSB0aHJvdyAoKTsKCgpleHRlcm4gX19zc2l6ZV90IGdl dGxpbmUgKGNoYXIgKipfX3Jlc3RyaWN0IF9fbGluZXB0ciwKICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHNpemVfdCAqX19yZXN0cmljdCBfX24sCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICBGSUxFICpfX3Jlc3RyaWN0IF9fc3RyZWFtKSB0aHJvdyAoKTsKCgoKCmV4dGVybiBpbnQgZnB1 dHMgKF9fY29uc3QgY2hhciAqX19yZXN0cmljdCBfX3MsIEZJTEUgKl9fcmVzdHJpY3QgX19zdHJl YW0pCiAgICAgdGhyb3cgKCk7CgoKCmV4dGVybiBpbnQgZnB1dHNfdW5sb2NrZWQgKF9fY29uc3Qg Y2hhciAqX19yZXN0cmljdCBfX3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJTEUgKl9f cmVzdHJpY3QgX19zdHJlYW0pIHRocm93ICgpOwoKCgpleHRlcm4gaW50IHB1dHMgKF9fY29uc3Qg Y2hhciAqX19zKSB0aHJvdyAoKTsKCgoKZXh0ZXJuIGludCB1bmdldGMgKGludCBfX2MsIEZJTEUg Kl9fc3RyZWFtKSB0aH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TsKCgoKCgoKCmV4dGVybiBpbnQgcHRocmVhZF9hdHRyX2luaXQgKHB0aHJlYWRf YXR0cl90ICpfX2F0dHIpIHRocm93ICgpOwoKCmV4dGVybiBpbnQgcHRocmVhZF9hdHRyX2Rlc3Ry b3kgKHB0aHJlYWRfYXR0cl90ICpfX2F0dHIpIHRocm93ICgpOwoKCmV4dGVybiBpbnQgcHRocmVh ZF9hdHRyX3NldGRldGFjaHN0YXRlIChwdGhyZWFkX2F0dHJfdCAqX19hdHRyLAogICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IF9fZGV0YWNoc3RhdGUpIHRocm93ICgp OwoKCmV4dGVybiBpbnQgcHRocmVhZF9hdHRyX2dldGRldGFjaHN0YXRlIChfX2NvbnN0IHB0aHJl YWRfYXR0cl90ICpfX2F0dHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBpbnQgKl9fZGV0YWNoc3RhdGUpIHRocm93ICgpOwoKCmV4dGVybiBpbnQgcHRocmVhZF9hdHRy X3NldHNjaGVkcGFyYW0gKHB0aHJlYWRfYXR0cl90ICpfX3Jlc3RyaWN0IF9fYXR0ciwKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19jb25zdCBzdHJ1Y3Qgc2NoZWRfcGFy YW0gKl9fcmVzdHJpY3QKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19w YXJhbSkgdGhyb3cgKCk7CgoKZXh0ZXJuIGludCBwdGhyZWFkX2F0dHJfZ2V0c2NoZWRwYXJhbSAo X19jb25zdCBwdGhyZWFkX2F0dHJfdCAqX19yZXN0cmljdAogICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBfX2F0dHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHN0cnVjdCBzY2hlZF9wYXJhbSAqX19yZXN0cmljdCBfX3BhcmFtKQogICAgIHRocm93 ICgpOwoKCmV4dGVybiBpbnQgcHRocmVhZF9hdHRyX3NldHNjaGVkcG9saWN5IChwdGhyZWFkX2F0 dHJfdCAqX19hdHRyLCBpbnQgX19wb2xpY3kpCiAgICAgdGhyb3cgKCk7CgoKZXh0ZXJuIGludCBw dGhyZWFkX2F0dHJfZ2V0c2NoZWRwb2xpY3kgKF9fY29uc3QgcHRocmVhZF9hdHRyX3QgKl9fcmVz dHJpY3QKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fYXR0ciwgaW50 ICpfX3Jlc3RyaWN0IF9fcG9saWN5KQogICAgIHRocm93ICgpOwoKCmV4dGVybiBpbnQgcHRocmVh ZF9hdHRyX3NldGluaGVyaXRzY2hlZCAocHRocmVhZF9hdHRyX3QgKl9fYXR0ciwKICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgX19pbmhlcml0KSB0aHJvdyAoKTsK CgpleHRlcm4gaW50IHB0aHJlYWRfYXR0cl9nZXRpbmhlcml0c2NoZWQgKF9fY29uc3QgcHRocmVh ZF9hdHRyX3QgKl9fcmVzdHJpY3QKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBfX2F0dHIsIGludCAqX19yZXN0cmljdCBfX2luaGVyaXQpCiAgICAgdGhyb3cgKCk7CgoK ZXh0ZXJuIGludCBwdGhyZWFkX2F0dHJfc2V0c2NvcGUgKHB0aHJlYWRfYXR0cl90ICpfX2F0dHIs IGludCBfX3Njb3BlKQogICAgIHRocm93ICgpOwoKCmV4dGVybiBpbnQgcHRocmVhZF9hdHRyX2dl dHNjb3BlIChfX2NvbnN0IHB0aHJlYWRfYXR0cl90ICpfX3Jlc3RyaWN0IF9fYXR0ciwKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCAqX19yZXN0cmljdCBfX3Njb3BlKSB0aHJv dyAoKTsKCgoKZXh0ZXJuIGludCBwdGhyZWFkX2F0dHJfc2V0Z3VhcmRzaXplIChwdGhyZWFkX2F0 dHJfdCAqX19hdHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVf dCBfX2d1YXJkc2l6ZSkgdGhyb3cgKCk7CgoKZXh0ZXJuIGludCBwdGhyZWFkX2F0dHJfZ2V0Z3Vh cmRzaXplIChfX2NvbnN0IHB0aHJlYWRfYXR0cl90ICpfX3Jlc3RyaWN0CiAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgX19hdHRyLCBzaXplX3QgKl9fcmVzdHJpY3QgX19ndWFy ZHNpemUpCiAgICAgdGhyb3cgKCk7CgoKCgoKCmV4dGVybiBpbnQgcHRocmVhZF9hdHRyX3NldHN0 YWNrYWRkciAocHRocmVhZF9hdHRyX3QgKl9fYXR0ciwKICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICB2b2lkICpfX3N0YWNrYWRkcikgdGhyb3cgKCk7CgoKZXh0ZXJuIGludCBw dGhyZWFkX2F0dHJfZ2V0c3RhY2thZGRyIChfX2NvbnN0IHB0aHJlYWRfYXR0cl90ICpfX3Jlc3Ry aWN0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19hdHRyLCB2b2lkICoq X19yZXN0cmljdCBfX3N0YWNrYWRkcikKICAgICB0aHJvdyAoKTsKCgoKCgpleHRlcm4gaW50IHB0 aHJlYWRfYXR0cl9zZXRzdGFjayAocHRocmVhZF9hdHRyX3QgKl9fYXR0ciwgdm9pZCAqX19zdGFj a2FkZHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgX19zdGFja3Np emUpIHRocm93ICgpOwoKCmV4dGVybiBpbnQgcHRocmVhZF9hdHRyX2dldHN0YWNrIChfX2NvbnN0 IHB0aHJlYWRfYXR0cl90ICpfX3Jlc3RyaWN0IF9fYXR0ciwKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHZvaWQgKipfX3Jlc3RyaWN0IF9fc3RhY2thZGRyLAogICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgc2l6ZV90ICpfX3Jlc3RyaWN0IF9fc3RhY2tzaXplKSB0aHJv dyAoKTsKCgoKCgpleHRlcm4gaW50IHB0aHJlYWRfYXR0cl9zZXRzdGFja3NpemUgKHB0aHJlYWRf YXR0cl90ICpfX2F0dHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6 ZV90IF9fc3RhY2tzaXplKSB0aHJvdyAoKTsKCgpleHRlcm4gaW50IHB0aHJlYWRfYXR0cl9nZXRz dGFja3NpemUgKF9fY29uc3QgcHRocmVhZF9hdHRyX3QgKl9fcmVzdHJpY3QKICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBfX2F0dHIsIHNpemVfdCAqX19yZXN0cmljdCBfX3N0 YWNrc2l6ZSkKICAgICB0aHJvdyAoKTsKCgoKZXh0ZXJuIGludCBwdGhyZWFkX2dldGF0dHJfbnAg KHB0aHJlYWRfdCBfX3RoLCBwdGhyZWFkX2F0dHJfdCAqX19hdHRyKSB0aHJvdyAoKTsKCgoKCgoK ZXh0ZXJuIGludCBwdGhyZWFkX3NldHNjaGVkcGFyYW0gKHB0aHJlYWRfdCBfX3RhcmdldF90aHJl YWQsIGludCBfX3BvbGljeSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fY29u c3Qgc3RydWN0IHNjaGVkX3BhcmFtICpfX3BhcmFtKQogICAgIHRocm93ICgpOwoKCmV4dGVybiBp bnQgcHRocmVhZF9nZXRzY2hlZHBhcmFtIChwdGhyZWFkX3QgX190YXJnZXRfdGhyZWFkLAogICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ICpfX3Jlc3RyaWN0IF9fcG9saWN5LAog ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0IHNjaGVkX3BhcmFtICpfX3Jl c3RyaWN0IF9fcGFyYW0pCiAgICAgdGhyb3cgKCk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Fk X211dGV4X3QgKl9fbXV0ZXgpIHRocm93ICgpOwoKCgoKCgpleHRlcm4gaW50IHB0aHJlYWRfbXV0 ZXhhdHRyX2luaXQgKHB0aHJlYWRfbXV0ZXhhdHRyX3QgKl9fYXR0cikgdGhyb3cgKCk7CgoKZXh0 ZXJuIGludCBwdGhyZWFkX211dGV4YXR0cl9kZXN0cm95IChwdGhyZWFkX211dGV4YXR0cl90ICpf X2F0dHIpIHRocm93ICgpOwoKCmV4dGVybiBpbnQgcHRocmVhZF9tdXRleGF0dHJfZ2V0cHNoYXJl ZCAoX19jb25zdCBwdGhyZWFkX211dGV4YXR0cl90ICoKICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBfX3Jlc3RyaWN0IF9fYXR0ciwKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBpbnQgKl9fcmVzdHJpY3QgX19wc2hhcmVkKSB0aHJvdyAoKTsK CgpleHRlcm4gaW50IHB0aHJlYWRfbXV0ZXhhdHRyX3NldHBzaGFyZWQgKHB0aHJlYWRfbXV0ZXhh dHRyX3QgKl9fYXR0ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBp bnQgX19wc2hhcmVkKSB0aHJvdyAoKTsKCgoKCgpleHRlcm4gaW50IHB0aHJlYWRfbXV0ZXhhdHRy X3NldHR5cGUgKHB0aHJlYWRfbXV0ZXhhdHRyX3QgKl9fYXR0ciwgaW50IF9fa2luZCkKICAgICB0 aHJvdyAoKTsKCgpleHRlcm4gaW50IHB0aHJlYWRfbXV0ZXhhdHRyX2dldHR5cGUgKF9fY29uc3Qg cHRocmVhZF9tdXRleGF0dHJfdCAqX19yZXN0cmljdAogICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIF9fYXR0ciwgaW50ICpfX3Jlc3RyaWN0IF9fa2luZCkgdGhyb3cgKCk7CgoK CgoKCgpleHRlcm4gaW50IHB0aHJlYWRfY29uZF9pbml0IChwdGhyZWFkX2NvbmRfdCAqX19yZXN0 cmljdCBfX2NvbmQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fY29uc3QgcHRocmVh ZF9jb25kYXR0cl90ICpfX3Jlc3RyaWN0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9f Y29uZF9hdHRyKSB0aHJvdyAoKTsKCgpleHRlcm4gaW50IHB0aHJlYWRfY29uZF9kZXN0cm95IChw dGhyZWFkX2NvbmRfdCAqX19jb25kKSB0aHJvdyAoKTsKCgpleHRlcm4gaW50IHB0aHJlYWRfY29u ZF9zaWduYWwgKHB0aHJlYWRfY29uZF90ICpfX2NvbmQpIHRocm93ICgpOwoKCmV4dGVybiBpbnQg cHRocmVhZF9jb25kX2Jyb2FkY2FzdCAocHRocmVhZF9jb25kX3QgKl9fY29uZCkgdGhyb3cgKCk7 CgoKCmV4dGVybiBpbnQgcHRocmVhZF9jb25kX3dhaXQgKHB0aHJlYWRfY29uZF90ICpfX3Jlc3Ry aWN0IF9fY29uZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHRocmVhZF9tdXRleF90 ICpfX3Jlc3RyaWN0IF9fbXV0ZXgpIHRocm93ICgpOwoKCgoKCmV4dGVybiBpbnQgcHRocmVhZF9j b25kX3RpbWVkd2FpdCAocHRocmVhZF9jb25kX3QgKl9fcmVzdHJpY3QgX19jb25kLAogICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB0aHJlYWRfbXV0ZXhfdCAqX19yZXN0cmljdCBf X211dGV4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fY29uc3Qgc3RydWN0 IHRpbWVzcGVjICpfX3Jlc3RyaWN0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg X19hYnN0aW1lKSB0aHJvdyAoKTsKCgoKCmV4dGVybiBpbnQgcHRocmVhZF9jb25kYXR0cl9pbml0 IChwdGhyZWFkX2NvbmRhdHRyX3QgKl9fYXR0cikgdGhyb3cgKCk7CgoKZXh0ZXJuIGludCBwdGhy ZWFkX2NvbmRhdHRyX2Rlc3Ryb3kgKHB0aHJlYWRfY29uZGF0dHJfdCAqX19hdHRyKSB0aHJvdyAo KTsKCgpleHRlcm4gaW50IHB0aHJlYWRfY29uZGF0dHJfZ2V0cHNoYXJlZCAoX19jb25zdCBwdGhy ZWFkX2NvbmRhdHRyX3QgKgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg X19yZXN0cmljdCBfX2F0dHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBpbnQgKl9fcmVzdHJpY3QgX19wc2hhcmVkKSB0aHJvdyAoKTsKCgpleHRlcm4gaW50IHB0aHJl YWRfY29uZGF0dHJfc2V0cHNoYXJlZCAocHRocmVhZF9jb25kYXR0cl90ICpfX2F0dHIsCiAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgX19wc2hhcmVkKSB0aHJvdyAo KTsKCgoKCgoKCmV4dGVybiBpbnQgcHRocmVhZF9yd2xvY2tfaW5pdCAocHRocmVhZF9yd2xvY2tf dCAqX19yZXN0cmljdCBfX3J3bG9jaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBf X2NvbnN0IHB0aHJlYWRfcndsb2NrYXR0cl90ICpfX3Jlc3RyaWN0CiAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgX19hdHRyKSB0aHJvdyAoKTsKCgpleHRlcm4gaW50IHB0aHJlYWRfcnds b2NrX2Rlc3Ryb3kgKHB0aHJlYWRfcndsb2NrX3QgKl9fcndsb2NrKSB0aHJvdyAoKTsKCgpleHRl cm4gaW50IHB0aHJlYWRfcndsb2NrX3JkbG9jayAocHRocmVhZF9yd2xvY2tfdCAqX19yd2xvY2sp IHRocm93ICgpOwoKCmV4dGVybiBpbnQgcHRocmVhZF9yd2xvY2tfdHJ5cmRsb2NrIChwdGhyZWFk X3J3bG9ja190ICpfX3J3bG9jaykgdGhyb3cgKCk7CgoKCmV4dGVybiBpbnQgcHRocmVhZF9yd2xv Y2tfdGltZWRyZGxvY2sgKHB0aHJlYWRfcndsb2NrX3QgKl9fcmVzdHJpY3QgX19yd2xvY2ssCiAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fY29uc3Qgc3RydWN0IHRpbWVz cGVjICpfX3Jlc3RyaWN0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9f YWJzdGltZSkgdGhyb3cgKCk7CgoKCmV4dGVybiBpbnQgcHRocmVhZF9yd2xvY2tfd3Jsb2NrIChw dGhyZWFkX3J3bG9ja190ICpfX3J3bG9jaykgdGhyb3cgKCk7CgoKZXh0ZXJuIGludCBwdGhyZWFk X3J3bG9ja190cnl3cmxvY2sgKHB0aHJlYWRfcndsb2NrX3QgKl9fcndsb2NrKSB0aHJvdyAoKTsK CgoKZXh0ZXJuIGludCBwdGhyZWFkX3J3bG9ja190aW1lZHdybG9jayAocHRocmVhZF9yd2xvY2tf dCAqX19yZXN0cmljdCBfX3J3bG9jaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgX19jb25zdCBzdHJ1Y3QgdGltZXNwZWMgKl9fcmVzdHJpY3QKICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgX19hYnN0aW1lKSB0aHJvdyAoKTsKCgoKZXh0ZXJuIGlu dCBwdGhyZWFkX3J3bG9ja191bmxvY2sgKHB0aHJlYWRfcndsb2NrX3QgKl9fcndsb2NrKSB0aHJv dyAoKTsKCgoKCgpleHRlcm4gaW50IHB0aHJlYWRfcndsb2NrYXR0cl9pbml0IChwdGhyZWFkX3J3 bG9ja2F0dHJfdCAqX19hdHRyKSB0aHJvdyAoKTsKCgpleHRlcm4gaW50IHB0aHJlYWRfcndsb2Nr YXR0cl9kZXN0cm95IChwdGhyZWFkX3J3bG9ja2F0dHJfdCAqX19hdHRyKSB0aHJvdyAoKTsKCgpl eHRlcm4gaW50IHB0aHJlYWRfcndsb2NrYXR0cl9nZXRwc2hhcmVkIChfX2NvbnN0IHB0aHJlYWRf cndsb2NrYXR0cl90ICoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg X19yZXN0cmljdCBfX2F0dHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIGludCAqX19yZXN0cmljdCBfX3BzaGFyZWQpIHRocm93ICgpOwoKCmV4dGVybiBpbnQgcHRo cmVhZF9yd2xvY2thdHRyX3NldHBzaGFyZWQgKHB0aHJlYWRfcndsb2NrYXR0cl90ICpfX2F0dHIs CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBfX3BzaGFyZWQp IHRocm93ICgpOwoKCmV4dGVybiBpbnQgcHRocmVhZF9yd2xvY2thdHRyX2dldGtpbmRfbnAgKF9f Y29uc3QgcHRocmVhZF9yd2xvY2thdHRyX3QgKl9fYXR0ciwKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgaW50ICpfX3ByZWYpIHRocm93ICgpOwoKCmV4dGVybiBpbnQg cHRocmVhZF9yd2xvY2thdHRyX3NldGtpbmRfbnAgKHB0aHJlYWRfcndsb2NrYXR0cl90ICpfX2F0 dHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBfX3ByZWYp IHRocm93ICgpOwojIDUwOSAiL3Vzci9pbmNsdWRlL3B0aHJlYWQuaCIgMwpleHRlcm4gaW50IHB0 aHJlYWRfc3Bpbl9pbml0IChwdGhyZWFkX3NwaW5sb2NrX3QgKl9fbG9jaywgaW50IF9fcHNoYXJl ZCkKICAgICB0aHJvdyAoKTsKCgpleHRlcm4gaW50IHB0aHJlYWRfc3Bpbl9kZXN0cm95IChwdGhy ZWFkX3NwaW5sb2NrX3QgKl9fbG9jaykgdGhyb3cgKCk7CgoKZXh0ZXJuIGludCBwdGhyZWFkX3Nw aW5fbG9jayAocHRocmVhZF9zcGlubG9ja190ICpfX2xvY2spIHRocm93ICgpOwoKCmV4dGVybiBp bnQgcHRocmVhZF9zcGluX3RyeWxvY2sgKHB0aHJlYWRfc3BpbmxvY2tfdCAqX19sb2NrKSB0aHJv dyAoKTsKCgpleHRlcm4gaW50IHB0aHJlYWRfc3Bpbl91bmxvY2sgKHB0aHJlYWRfc3BpbmxvY2tf dCAqX19sb2NrKSB0aHJvdyAoKTsKCgoKCmV4dGVybiBpbnQgcHRocmVhZF9iYXJyaWVyX2luaXQg KHB0aHJlYWRfYmFycmllcl90ICpfX3Jlc3RyaWN0IF9fYmFycmllciwKICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgX19jb25zdCBwdGhyZWFkX2JhcnJpZXJhdHRyX3QgKl9fcmVzdHJp Y3QKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19hdHRyLCB1bnNpZ25lZCBpbnQg X19jb3VudCkgdGhyb3cgKCk7CgpleHRlcm4gaW50IHB0aHJlYWRfYmFycmllcl9kZXN0cm95IChw dGhyZWFkX2JhcnJpZXJfdCAqX19iYXJyaWVyKSB0aHJvdyAoKTsKCmV4dGVybiBpbnQgcHRocmVh ZF9iYXJyaWVyYXR0cl9pbml0IChwdGhyZWFkX2JhcnJpZXJhdHRyX3QgKl9fYXR0cikgdGhyb3cg KCk7CgpleHRlcm4gaW50IHB0aHJlYWRfYmFycmllcmF0dHJfZGVzdHJveSAocHRocmVhZF9iYXJy aWVyYXR0cl90ICpfX2F0dHIpIHRocm93ICgpOwoKZXh0ZXJuIGludCBwdGhyZWFkX2JhcnJpZXJh dHRyX2dldHBzaGFyZWQgKF9fY29uc3QgcHRocmVhZF9iYXJyaWVyYXR0cl90ICoKICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fcmVzdHJpY3QgX19hdHRyLAogICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ICpfX3Jlc3RyaWN0IF9f cHNoYXJlZCkgdGhyb3cgKCk7CgpleHRlcm4gaW50IHB0aHJlYWRfYmFycmllcmF0dHJfc2V0cHNo YXJlZCAocHRocmVhZF9iYXJyaWVyYXR0cl90ICpfX2F0dHIsCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBpbnQgX19wc2hhcmVkKSB0aHJvdyAoKTsKCmV4dGVybiBp bnQgcHRocmVhZF9iYXJyaWVyX3dhaXQgKHB0aHJlYWRfYmFycmllcl90ICpfX2JhcnJpZXIpIHRo cm93ICgpOwojIDU1NiAiL3Vzci9pbmNsdWRlL3B0aHJlYWQuaCIgMwpleHRlcm4gaW50IHB0aHJl YWRfa2V5X2NyZWF0ZSAocHRocmVhZF9rZXlfdCAqX19rZXksCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICB2b2lkICgqX19kZXN0cl9mdW5jdGlvbikgKHZvaWQgKikpIHRocm93ICgpOwoK CmV4dGVybiBpbnQgcHRocmVhZF9rZXlfZGVsZXRlIChwdGhyZWFkX2tleV90IF9fa2V5KSB0aHJv dyAoKTsKCgpleHRlcm4gaW50IHB0aHJlYWRfc2V0c3BlY2lmaWMgKHB0aHJlYWRfa2V5X3QgX19r ZXksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19jb25zdCB2b2lkICpfX3BvaW50 ZXIpIHRocm93ICgpOwoKCmV4dGVybiB2b2lkICpwdGhyZWFkX2dldHNwZWNpZmljIChwdGhyZWFk X2tleV90IF9fa2V5KSB0aHJvdyAoKTsKIyA1NzYgIi91c3IvaW5jbHVkZS9wdGhyZWFkLmgiIDMK ZXh0ZXJuIGludCBwdGhyZWFkX29uY2UgKHB0aHJlYWRfb25jZV90ICpfX29uY2VfY29udHJvbCwK ICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgKCpfX2luaXRfcm91dGluZSkgKHZvaWQpKSB0 aHJvdyAoKTsKCgoKCgoKZXh0ZXJuI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ICAg ICAgICAgICAgICAgICAgICAgICB2b2lkICpfX2FyZykgdGhyb3cgKCk7CiMgNjQyICIvdXNyL2lu Y2x1ZGUvcHRocmVhZC5oIiAzCmV4dGVybiB2b2lkIF9wdGhyZWFkX2NsZWFudXBfcG9wX3Jlc3Rv cmUgKHN0cnVjdCBfcHRocmVhZF9jbGVhbnVwX2J1ZmZlciAqX19idWZmZXIsCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBfX2V4ZWN1dGUpIHRocm93ICgpOwoK CgoKCmV4dGVybiBpbnQgcHRocmVhZF9nZXRjcHVjbG9ja2lkIChwdGhyZWFkX3QgX190aHJlYWRf aWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbG9ja2lkX3QgKl9fY2xvY2tf aWQpIHRocm93ICgpOwoKCgoKIyAxICIvdXNyL2luY2x1ZGUvYml0cy9zaWd0aHJlYWQuaCIgMSAz CiMgMzEgIi91c3IvaW5jbHVkZS9iaXRzL3NpZ3RocmVhZC5oIiAzCmV4dGVybiBpbnQgcHRocmVh ZF9zaWdtYXNrIChpbnQgX19ob3csCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX2NvbnN0 IF9fc2lnc2V0X3QgKl9fcmVzdHJpY3QgX19uZXdtYXNrLAogICAgICAgICAgICAgICAgICAgICAg ICAgICAgX19zaWdzZXRfdCAqX19yZXN0cmljdCBfX29sZG1hc2spdGhyb3cgKCk7CgoKZXh0ZXJu IGludCBwdGhyZWFkX2tpbGwgKHB0aHJlYWRfdCBfX3RocmVhZCwgaW50IF9fc2lnbm8pIHRocm93 ICgpOwojIDY1NiAiL3Vzci9pbmNsdWRlL3B0aHJlYWQuaCIgMiAzCiMgNjcxICIvdXNyL2luY2x1 ZGUvcHRocmVhZC5oIiAzCmV4dGVybiBpbnQgcHRocmVhZF9hdGZvcmsgKHZvaWQgKCpfX3ByZXBh cmUpICh2b2lkKSwKICAgICAgICAgICAgICAgICAgICAgICAg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l9fczIsCiAgICAgICAgICAgICAgICAgICAgICAgIHNp emVfdCBfX24pIHRocm93ICgpOwoKCgoKCmV4dGVybiBpbnQgX193Y3NjYXNlY21wX2wgKF9fY29u c3Qgd2NoYXJfdCAqX19zMSwgX19jb25zdCB3Y2hhcl90ICpfX3MyLAogICAgICAgICAgICAgICAg ICAgICAgICAgICBfX2xvY2FsZV90IF9fbG9jKSB0aHJvdyAoKTsKCmV4dGVybiBpbnQgX193Y3Nu Y2FzZWNtcF9sIChfX2NvbnN0IHdjaGFyX3QgKl9fczEsIF9fY29uc3Qgd2NoYXJfdCAqX19zMiwK ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCBfX24sIF9fbG9jYWxlX3QgX19sb2Mp IHRocm93ICgpOwoKCgoKZXh0ZXJuIGludCB3Y3Njb2xsIChfX2NvbnN0IHdjaGFyX3QgKl9fczEs IF9fY29uc3Qgd2NoYXJfdCAqX19zMikgdGhyb3cgKCk7CgoKCmV4dGVybiBzaXplX3Qgd2NzeGZy bSAod2NoYXJfdCAqX19yZXN0cmljdCBfX3MxLAogICAgICAgICAgICAgICAgICAgICAgIF9fY29u c3Qgd2NoYXJfdCAqX19yZXN0cmljdCBfX3MyLCBzaXplX3QgX19uKSB0aHJvdyAoKTsKCgoKCgoK CmV4dGVybiBpbnQgX193Y3Njb2xsX2wgKF9fY29uc3Qgd2NoYXJfdCAqX19zMSwgX19jb25zdCB3 Y2hhcl90ICpfX3MyLAogICAgICAgICAgICAgICAgICAgICAgICBfX2xvY2FsZV90IF9fbG9jKSB0 aHJvdyAoKTsKCgoKZXh0ZXJuIHNpemVfdCBfX3djc3hmcm1fbCAod2NoYXJfdCAqX19zMSwgX19j b25zdCB3Y2hhcl90ICpfX3MyLAogICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgX19u LCBfX2xvY2FsZV90IF9fbG9jKSB0aHJvdyAoKTsKCgpleHRlcm4gd2NoYXJfdCAqd2NzZHVwIChf X2NvbnN0IHdja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ZXN0cmljdCBfX3MsIHdjaGFyX3QgX193YywKICAgICAgICAgICAgICAgICAgICAgICBtYnN0 YXRlX3QgKl9fcmVzdHJpY3QgX19wcykgdGhyb3cgKCk7CgoKZXh0ZXJuIHNpemVfdCBfX21icmxl biAoX19jb25zdCBjaGFyICpfX3Jlc3RyaWN0IF9fcywgc2l6ZV90IF9fbiwKICAgICAgICAgICAg ICAgICAgICAgICAgbWJzdGF0ZV90ICpfX3Jlc3RyaWN0IF9fcHMpIHRocm93ICgpOwpleHRlcm4g c2l6ZV90IG1icmxlbiAoX19jb25zdCBjaGFyICpfX3Jlc3RyaWN0IF9fcywgc2l6ZV90IF9fbiwK ICAgICAgICAgICAgICAgICAgICAgIG1ic3RhdGVfdCAqX19yZXN0cmljdCBfX3BzKSB0aHJvdyAo KTsKIyAyOTcgIi91c3IvaW5jbHVkZS93Y2hhci5oIiAzCmV4dGVybiBzaXplX3QgbWJzcnRvd2Nz ICh3Y2hhcl90ICpfX3Jlc3RyaWN0IF9fZHN0LAogICAgICAgICAgICAgICAgICAgICAgICAgX19j b25zdCBjaGFyICoqX19yZXN0cmljdCBfX3NyYywgc2l6ZV90IF9fbGVuLAogICAgICAgICAgICAg ICAgICAgICAgICAgbWJzdGF0ZV90ICpfX3Jlc3RyaWN0IF9fcHMpIHRocm93ICgpOwoKCgpleHRl cm4gc2l6ZV90IHdjc3J0b21icyAoY2hhciAqX19yZXN0cmljdCBfX2RzdCwKICAgICAgICAgICAg ICAgICAgICAgICAgIF9fY29uc3Qgd2NoYXJfdCAqKl9fcmVzdHJpY3QgX19zcmMsIHNpemVfdCBf X2xlbiwKICAgICAgICAgICAgICAgICAgICAgICAgIG1ic3RhdGVfdCAqX19yZXN0cmljdCBfX3Bz KSB0aHJvdyAoKTsKCgoKCgpleHRlcm4gc2l6ZV90IG1ic25ydG93Y3MgKHdjaGFyX3QgKl9fcmVz dHJpY3QgX19kc3QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgX19jb25zdCBjaGFyICoqX19y ZXN0cmljdCBfX3NyYywgc2l6ZV90IF9fbm1jLAogICAgICAgICAgICAgICAgICAgICAgICAgIHNp emVfdCBfX2xlbiwgbWJzdGF0ZV90ICpfX3Jlc3RyaWN0IF9fcHMpIHRocm93ICgpOwoKCgpleHRl cm4gc2l6ZV90IHdjc25ydG9tYnMgKGNoYXIgKl9fcmVzdHJpY3QgX19kc3QsCiAgICAgICAgICAg ICAgICAgICAgICAgICAgX19jb25zdCB3Y2hhcl90ICoqX19yZXN0cmljdCBfX3NyYywKICAgICAg ICAgICAgICAgICAgICAgICAgICBzaXplX3QgX19ud2MsIHNpemVfdCBfX2xlbiwKICAgICAgICAg ICAgICAgICAgICAgICAgICBtYnN0YXRlX3QgKl9fcmVzdHJpY3QgX19wcykgdGhyb3cgKCk7CgoK CgoKCmV4dGVybiBpbnQgd2N3aWR0aCAod2NoYXJfdCBfX2MpIHRocm93ICgpOwoKCgpleHRlcm4g aW50IHdjc3dpZHRoIChfX2NvbnN0IHdjaGFyX3QgKl9fcywgc2l6ZV90IF9fbikgdGhyb3cgKCk7 CgoKCgoKZXh0ZXJuIGRvdWJsZSB3Y3N0b2QgKF9fY29uc3Qgd2NoYXJfdCAqX19yZXN0cmljdCBf X25wdHIsCiAgICAgICAgICAgICAgICAgICAgICB3Y2hhcl90ICoqX19yZXN0cmljdCBfX2VuZHB0 cikgdGhyb3cgKCk7CgoKCmV4dGVybiBmbG9hdCB3Y3N0b2YgKF9fY29uc3Qgd2NoYXJfdCAqX19y ZXN0cmljdCBfX25wdHIsCiAgICAgICAgICAgICAgICAgICAgIHdjaGFyX3QgKipfX3Jlc3RyaWN0 IF9fZW5kcHRyKSB0aHJvdyAoKTsKZXh0ZXJuIGxvbmcgZG91YmxlIHdjc3RvbGQgKF9fY29uc3Qg d2NoYXJfdCAqX19yZXN0cmljdCBfX25wdHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3 Y2hhcl90ICoqX19yZXN0cmljdCBfX2VuZHB0cikg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CAqKl9fcmVzdHJpY3QgX19lbmRwdHIsIGludCBfX2Jhc2UpCiAgICAgdGhyb3cgKCk7 CgoKCl9fZXh0ZW5zaW9uX18KZXh0ZXJuIHVuc2lnbmVkIGxvbmcgbG9uZyBpbnQgd2NzdG91bGwg KF9fY29uc3Qgd2NoYXJfdCAqX19yZXN0cmljdCBfX25wdHIsCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICB3Y2hhcl90ICoqX19yZXN0cmljdCBfX2VuZHB0ciwKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBfX2Jhc2UpIHRocm93ICgpOwoj IDQxMCAiL3Vzci9pbmNsdWRlL3djaGFyLmgiIDMKZXh0ZXJuIGxvbmcgaW50IF9fd2NzdG9sX2wg KF9fY29uc3Qgd2NoYXJfdCAqX19yZXN0cmljdCBfX25wdHIsCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICB3Y2hhcl90ICoqX19yZXN0cmljdCBfX2VuZHB0ciwgaW50IF9fYmFzZSwKICAgICAg ICAgICAgICAgICAgICAgICAgICAgIF9fbG9jYWxlX3QgX19sb2MpIHRocm93ICgpOwoKZXh0ZXJu IHVuc2lnbmVkIGxvbmcgaW50IF9fd2NzdG91bF9sIChfX2NvbnN0IHdjaGFyX3QgKl9fcmVzdHJp Y3QgX19ucHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdjaGFyX3Qg KipfX3Jlc3RyaWN0IF9fZW5kcHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIGludCBfX2Jhc2UsIF9fbG9jYWxlX3QgX19sb2MpIHRocm93ICgpOwoKX19leHRlbnNpb25f XwpleHRlcm4gbG9uZyBsb25nIGludCBfX3djc3RvbGxfbCAoX19jb25zdCB3Y2hhcl90ICpfX3Jl c3RyaWN0IF9fbnB0ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdjaGFyX3Qg KipfX3Jlc3RyaWN0IF9fZW5kcHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg aW50IF9fYmFzZSwgX19sb2NhbGVfdCBfX2xvYykgdGhyb3cgKCk7CgpfX2V4dGVuc2lvbl9fCmV4 dGVybiB1bnNpZ25lZCBsb25nIGxvbmcgaW50IF9fd2NzdG91bGxfbCAoX19jb25zdCB3Y2hhcl90 ICpfX3Jlc3RyaWN0IF9fbnB0ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICB3Y2hhcl90ICoqX19yZXN0cmljdCBfX2VuZHB0ciwKICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgX19iYXNlLCBfX2xvY2FsZV90IF9fbG9jKQog ICAgIHRocm93ICgpOwoKZXh0ZXJuIGRvdWJsZSBfX3djc3RvZF9sIChfX2NvbnN0IHdjaGFyX3Qg Kl9fcmVzdHJpY3QgX19ucHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgIHdjaGFyX3QgKipf X3Jlc3RyaWN0IF9fZW5kcHRyLCBfX2xvY2FsZV90IF9fbG9jKQogICAgIHRocm93ICgpOwoKZXh0 ZXJuIGZsb2F0IF9fd2NzdG9mX2wgKF9fY29uc3Qgd2NoYXJfdCAqX19yZXN0cmljdCBfX25wdHIs CiAgICAgICAgICAgICAgICAgICAgICAgICB3Y2hhcl90ICoqX19yZXN0cmljdCBfX2VuZHB0ciwg X19sb2NhbGVfdCBfX2xvYykKICAgICB0aHJvdyAoKTsKCmV4dGVybiBsb25nIGRvdWJsZSBfX3dj c3RvbGRfbCAoX19jb25zdCB3Y2hhcl90ICpfX3Jlc3RyaWN0IF9fbnB0ciwKICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICB3Y2hhcl90ICoqX19yZXN0cmljdCBfX2VuZHB0ciwKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBfX2xvY2FsZV90IF9fbG9jKSB0aHJvdyAoKTsKCgoK CgpleHRlcm4gZG91YmxlIF9fd2NzdG9kX2ludGVybmFsIChfX2NvbnN0IHdjaGFyX3QgKl9fcmVz dHJpY3QgX19ucHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3Y2hhcl90ICoq X19yZXN0cmljdCBfX2VuZHB0ciwgaW50IF9fZ3JvdXApCiAgICAgdGhyb3cgKCk7CmV4dGVybiBm bG9hdCBfX3djc3RvZl9pbnRlcm5hbCAoX19jb25zdCB3Y2hhcl90ICpfX3Jlc3RyaWN0IF9fbnB0 ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3Y2hhcl90ICoqX19yZXN0cmljdCBf X2VuZHB0ciwgaW50IF9fZ3JvdXApCiAgICAgdGhyb3cgKCk7CmV4dGVybiBsb25nIGRvdWJsZSBf X3djc3RvbGRfaW50ZXJuYWwgKF9fY29uc3Qgd2NoYXJfdCAqX19yZXN0cmljdCBfX25wdHIsCiAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdjaGFyX3QgKipfX3Jlc3RyaWN0 IF9fZW5kcHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgX19n cm91cCkgdGhyb3cgKCk7CgoKZXh0ZXJuIGxvbmcgaW50IF9fd2NzdG9sX2ludGVybmFsIChfX2Nv bnN0IHdjaGFyX3QgKl9fcmVzdHJpY3QgX19ucHRyLAogICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIHdjaGFyX3QgKipfX3Jlc3RyaWN0IF9fZW5kcHRyLAogICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIGludCBfX2Jhc2UsIGludCBfX2dyb3VwKSB0aHJvdyAoKTsKCgoK ZXh0ZXJuIHVuc2lnbmVkIGxvbmcgaW50IF9fd2NzdG91bF9pbnRlcm5hbCAoX19jb25zdCB3Y2hh cl90ICpfX3Jlc3RyaWN0IF9fbnB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICB3Y2hhcl90ICoqX19yZXN0cmljdCBfX2VuZHB0ciwKICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IF9fYmFzZSwgaW50IF9fZ3JvdXApIHRo cm93ICgpOwoKCgpfX2V4dGVuc2lvbl9fCmV4dGVybiBsb25nIGxvbmcgaW50IF9fd2NzdG9sbF9p bnRlcm5hbCAoX19jb25zdCB3Y2hhcl90ICpfX3Jlc3RyaWN0IF9fbnB0ciwKICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3Y2hhcl90ICoqX19yZXN0cmljdCBfX2VuZHB0 ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgX19iYXNlLCBp bnQgX19ncm91cCkgdGhyb3cgKCk7CgoKCl9fZXh0ZW5zaW9uX18KZXh0ZXJuIHVuc2lnbmVkIGxv bmcgbG9uZyBpbnQgX193Y3N0b3VsbF9pbnRlcm5hbCAoX19jb25zdCB3Y2hhcl90ICoKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19yZXN0cmljdCBf X25wdHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IHdjaGFyX3QgKioKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgX19yZXN0cmljdCBfX2VuZHB0ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgaW50IF9fYmFzZSwKICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IF9fZ3JvdXApIHRocm93ICgpOwojIDUyOCAi L3Vzci9pbmNsdWRlL3djaGFyLmgiIDMKZXh0ZXJuIHdjaGFyX3QgKndjcGNweSAod2NoYXJfdCAq X19kZXN0LCBfX2NvbnN0IHdjaGFy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HlwZSBfX3N0KSB7IF9NX3N0ID0gX19zdDsgfQoKCgogICAgICBmcG9zKCk6IF9NX29mZihzdHJl YW1vZmYoKSksIF9NX3N0KF9fc3RhdGVfdHlwZSgpKSB7IH0KCiAgICAgIGZwb3Moc3RyZWFtb2Zm IF9fb2ZmLCBfX3N0YXRlX3R5cGUgX19zdCA9IF9fc3RhdGVfdHlwZSgpKQogICAgICA6IF9NX29m ZihfX29mZiksIF9NX3N0KF9fc3QpIHsgfQoKICAgICAgb3BlcmF0b3Igc3RyZWFtb2ZmKCkgY29u c3QgeyByZXR1cm4gX01fb2ZmOyB9CgogICAgICBmcG9zJgogICAgICBvcGVyYXRvcis9KHN0cmVh bW9mZiBfX29mZikgeyBfTV9vZmYgKz0gX19vZmY7IHJldHVybiAqdGhpczsgfQoKICAgICAgZnBv cyYKICAgICAgb3BlcmF0b3ItPShzdHJlYW1vZmYgX19vZmYpIHsgX01fb2ZmIC09IF9fb2ZmOyBy ZXR1cm4gKnRoaXM7IH0KCiAgICAgIGZwb3MKICAgICAgb3BlcmF0b3IrKHN0cmVhbW9mZiBfX29m ZikKICAgICAgewogICAgICAgIGZwb3MgX190KCp0aGlzKTsKICAgICAgICBfX3QgKz0gX19vZmY7 CiAgICAgICAgcmV0dXJuIF9fdDsKICAgICAgfQoKICAgICAgZnBvcwogICAgICBvcGVyYXRvci0o c3RyZWFtb2ZmIF9fb2ZmKQogICAgICB7CiAgICAgICAgZnBvcyBfX3QoKnRoaXMpOwogICAgICAg IF9fdCAtPSBfX29mZjsKICAgICAgICByZXR1cm4gX190OwogICAgICB9CgogICAgICBib29sCiAg ICAgIG9wZXJhdG9yPT0oY29uc3QgZnBvcyYgX19wb3MpIGNvbnN0CiAgICAgIHsgcmV0dXJuIF9N X29mZiA9PSBfX3Bvcy5fTV9vZmY7IH0KCiAgICAgIGJvb2wKICAgICAgb3BlcmF0b3IhPShjb25z dCBmcG9zJiBfX3BvcykgY29uc3QKICAgICAgeyByZXR1cm4gX01fb2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F9fczEsIGNv bnN0IGNoYXJfdHlwZSogX19zMiwgc2l6ZV90IF9fbik7CgogICAgICBzdGF0aWMgc2l6ZV90CiAg ICAgIGxlbmd0aChjb25zdCBjaGFyX3R5cGUqIF9fcyk7CgogICAgICBzdGF0aWMgY29uc3QgY2hh cl90eXBlKgogICAgICBmaW5kKGNvbnN0IGNoYXJfdHlwZSogX19zLCBzaXplX3QgX19uLCBjb25z dCBjaGFyX3R5cGUmIF9fYSk7CgogICAgICBzdGF0aWMgY2hhcl90eXBlKgogICAgICBtb3ZlKGNo YXJfdHlwZSogX19zMSwgY29uc3QgY2hhcl90eXBlKiBfX3MyLCBzaXplX3QgX19uKTsKCiAgICAg IHN0YXRpYyBjaGFyX3R5cGUqCiAgICAgIGNvcHkoY2hhcl90eXBlKiBfX3MxLCBjb25zdCBjaGFy X3R5cGUqIF9fczIsIHNpemVfdCBfX24pOwoKICAgICAgc3RhdGljIGNoYXJfdHlwZSoKICAgICAg YXNzaWduKGNoYXJfdHlwZSogX19zLCBzaXplX3QgX19uLCBjaGFyX3R5cGUgX19hKTsKCiAgICAg IHN0YXRpYyBjaGFyX3R5cGUKICAgICAgdG9fY2hhcl90eXBlKGNvbnN0IGludF90eXBlJiBfX2Mp OwoKICAgICAgc3RhdGljIGludF90eXBlCiAgICAgIHRvX2ludF90eXBlKGNvbnN0IGNoYXJfdHlw ZSYgX19jKTsKCiAgICAgIHN0YXRpYyBib29sCiAgICAgIGVxX2ludF90eXBlKGNvbnN0IGludF90 eXBlJiBfX2MxLCBjb25zdCBpbnRfdHlwZSYgX19jMik7CgogICAgICBzdGF0aWMgaW50X3R5cGUK ICAgICAgZW9mKCk7CgogICAgICBzdGF0aWMgaW50X3R5cGUKICAgICAgbm90X2VvZihjb25zdCBp bnRfdHlwZSYgX19jKTsKICAgIH07CgoKCiAgdGVtcGxhdGU8PgogICAgc3RydWN0IGNoYXJfdHJh aXRzPGNoYXI+CiAgICB7CiAgICAgIHR5cGVkZWYgY2hhciBjaGFyX3R5cGU7CiAgICAgIHR5cGVk ZWYgaW50IGludF90eXBlOwogICAgICB0eXBlZGVmIHN0cmVhbXBvcyBwb3NfdHlwZTsKICAgICAg dHlwZWRlZiBzdHJlYW1vZmYgb2ZmX3R5cGU7CiAgICAgIHR5cGVkZWYgbWJzdGF0ZV90IHN0YXRl X3R5cGU7CgogICAgICBzdGF0aWMgdm9pZAogICAgICBhc3NpZ24oY2hhcl90eXBlJiBfX2MxLCBj b25zdCBjaGFyX3R5cGUmIF9fYzIpCiAgICAgIHsgX19jMSA9IF9fYzI7IH0KCiAgICAgIHN0YXRp YyBib29sCiAgICAgIGVxKGNvbnN0IGNoYXJfdHlwZSYgX19jMSwgY29uc3QgY2hhcl90eXBlJiBf X2MyKQogICAgICB7IHJldHVybiBfX2MxID09IF9fYzI7IH0KCiAgICAgIHN0YXRpYyBib29sCiAg ICAgIGx0KGNvbnN0IGNoYXJfdHlwZSYgX19jMSwgY29uc3QgY2hhcl90eXBlJiBfX2MyKQogICAg ICB7IHJldHVybiBfX2MxIDwgX19jMjsgfQoKICAgICAgc3RhdGljIGludAogICAgICBjb21wYXJl KGNvbnN0IGNoYXJfdHlwZSogX19zMSwgY29uc3QgY2hhcl90eXBlKiBfX3MyLCBzaXplX3QgX19u KQogICAgICB7IHJldHVybiBtZW1jbXAoX19zMSwgX19zMiwgX19uKTsgfQoKICAgICAgc3RhdGlj IHNpemVfdAogICAgICBsZW5ndGgoY29uc3QgY2hhcl90eXBlKiBfX3MpCiAgICAgIHsgcmV0dXJu IHN0cmxlbihfX3MpOyB9CgogICAgICBzdGF0aWMgY29uc3QgY2hhcl90eXBlKgogICAgICBmaW5k KGNvbnN0IGNoYXJfdHlwZSogX19zLCBzaXplX3QgX19uLCBjb25zdCBjaGFyX3R5cGUmIF9fYSkK ICAgICAgeyByZXR1cm4gc3RhdGljX2Nhc3Q8Y29uc3QgY2hhcl90eXBlKj4obWVtY2hyKF9fcywg X19hLCBfX24pKTsgfQoKICAgICAgc3Rh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ICAgICBlb2YoKSB7IHJldHVybiBzdGF0aWNfY2FzdDxpbnRfdHlwZT4oKC0xKSk7IH0KCiAgICAg IHN0YXRpYyBpbnRfdHlwZQogICAgICBub3RfZW9mKGNvbnN0IGludF90eXBlJiBfX2MpCiAgICAg IHsgcmV0dXJuIChfX2MgPT0gZW9mKCkpID8gMCA6IF9fYzsgfQogIH07CgoKCiAgdGVtcGxhdGU8 PgogICAgc3RydWN0IGNoYXJfdHJhaXRzPHdjaGFyX3Q+CiAgICB7CiAgICAgIHR5cGVkZWYgd2No YXJfdCBjaGFyX3R5cGU7CiAgICAgIHR5cGVkZWYgd2ludF90IGludF90eXBlOwogICAgICB0eXBl ZGVmIHN0cmVhbW9mZiBvZmZfdHlwZTsKICAgICAgdHlwZWRlZiB3c3RyZWFtcG9zIHBvc190eXBl OwogICAgICB0eXBlZGVmIG1ic3RhdGVfdCBzdGF0ZV90eXBlOwoKICAgICAgc3RhdGljIHZvaWQK ICAgICAgYXNzaWduKGNoYXJfdHlwZSYgX19jMSwgY29uc3QgY2hhcl90eXBlJiBfX2MyKQogICAg ICB7IF9fYzEgPSBfX2MyOyB9CgogICAgICBzdGF0aWMgYm9vbAogICAgICBlcShjb25zdCBjaGFy X3R5cGUmIF9fYzEsIGNvbnN0IGNoYXJfdHlwZSYgX19jMikKICAgICAgeyByZXR1cm4gX19jMSA9 PSBfX2MyOyB9CgogICAgICBzdGF0aWMgYm9vbAogICAgICBsdChjb25zdCBjaGFyX3R5cGUmIF9f YzEsIGNvbnN0IGNoYXJfdHlwZSYgX19jMikKICAgICAgeyByZXR1cm4gX19jMSA8IF9fYzI7IH0K CiAgICAgIHN0YXRpYyBpbnQKICAgICAgY29tcGFyZShjb25zdCBjaGFyX3R5cGUqIF9fczEsIGNv bnN0IGNoYXJfdHlwZSogX19zMiwgc2l6ZV90IF9fbikKICAgICAgeyByZXR1cm4gd21lbWNtcChf X3MxLCBfX3MyLCBfX24pOyB9CgogICAgICBzdGF0aWMgc2l6ZV90CiAgICAgIGxlbmd0aChjb25z dCBjaGFyX3R5cGUqIF9fcykKICAgICAgeyByZXR1cm4gd2NzbGVuKF9fcyk7IH0KCiAgICAgIHN0 YXRpYyBjb25zdCBjaGFyX3R5cGUqCiAgICAgIGZpbmQoY29uc3QgY2hhcl90eXBlKiBfX3MsIHNp emVfdCBfX24sIGNvbnN0IGNoYXJfdHlwZSYgX19hKQogICAgICB7IHJldHVybiB3bWVtY2hyKF9f cywgX19hLCBfX24pOyB9CgogICAgICBzdGF0aWMgY2hhcl90eXBlKgogICAgICBtb3ZlKGNoYXJf dHlwZSogX19zMSwgY29uc3QgY2hhcl90eXBlKiBfX3MyLCBpbnRfdHlwZSBfX24pCiAgICAgIHsg cmV0dXJuIHdtZW1tb3ZlKF9fczEsIF9fczIsIF9fbik7IH0KCiAgICAgIHN0YXRpYyBjaGFyX3R5 cGUqCiAgICAgIGNvcHkoY2hhcl90eXBlKiBfX3MxLCBjb25zdCBjaGFyX3R5cGUqIF9fczIsIHNp emVfdCBfX24pCiAgICAgIHsgcmV0dXJuIHdtZW1jcHkoX19zMSwgX19zMiwgX19uKTsgfQoKICAg ICAgc3RhdGljIGNoYXJfdHlwZSoKICAgICAgYXNzaWduKGNoYXJfdHlwZSogX19zLCBzaXplX3Qg X19uLCBjaGFyX3R5cGUgX19hKQogICAgICB7IHJldHVybiB3bWVtc2V0KF9fcywgX19hLCBfX24p OyB9CgogICAgICBzdGF0aWMgY2hhcl90eXBlCiAgICAgIHRvX2NoYXJfdHlwZShjb25zdCBpbnRf dHlwZSYgX19jKSB7IHJldHVybiBjaGFyX3R5cGUoX19jKTsgfQoKICAgICAgc3RhdGljIGludF90 eXBlCiAgICAgIHRvX2ludF90eXBlKGNvbnN0IGNoYXJfdHlwZSYgX19jKSB7IHJldHVybiBpbnRf dHlwZShfX2MpOyB9CgogICAgICBzdGF0aWMgYm9vbAogICAgICBlcV9pbnRfdHlwZShjb25zdCBp bnRfdHlwZSYgX19jMSwgY29uc3QgaW50X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Jlc3RyaWN0IF9fbnB0ciwKICAgICAgICAgICAgICAgICAgICAgY2hhciAqKl9fcmVzdHJp Y3QgX19lbmRwdHIpIHRocm93ICgpOwoKZXh0ZXJuIGxvbmcgZG91YmxlIHN0cnRvbGQgKF9fY29u c3QgY2hhciAqX19yZXN0cmljdCBfX25wdHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBj aGFyICoqX19yZXN0cmljdCBfX2VuZHB0cikgdGhyb3cgKCk7CgoKCmV4dGVybiBsb25nIGludCBz dHJ0b2wgKF9fY29uc3QgY2hhciAqX19yZXN0cmljdCBfX25wdHIsCiAgICAgICAgICAgICAgICAg ICAgICAgIGNoYXIgKipfX3Jlc3RyaWN0IF9fZW5kcHRyLCBpbnQgX19iYXNlKSB0aHJvdyAoKTsK CmV4dGVybiB1bnNpZ25lZCBsb25nIGludCBzdHJ0b3VsIChfX2NvbnN0IGNoYXIgKl9fcmVzdHJp Y3QgX19ucHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAqKl9fcmVz dHJpY3QgX19lbmRwdHIsIGludCBfX2Jhc2UpCiAgICAgdGhyb3cgKCk7CgoKCl9fZXh0ZW5zaW9u X18KZXh0ZXJuIGxvbmcgbG9uZyBpbnQgc3RydG9xIChfX2NvbnN0IGNoYXIgKl9fcmVzdHJpY3Qg X19ucHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgKipfX3Jlc3RyaWN0IF9f ZW5kcHRyLCBpbnQgX19iYXNlKSB0aHJvdyAoKTsKCl9fZXh0ZW5zaW9uX18KZXh0ZXJuIHVuc2ln bmVkIGxvbmcgbG9uZyBpbnQgc3RydG91cSAoX19jb25zdCBjaGFyICpfX3Jlc3RyaWN0IF9fbnB0 ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAqKl9fcmVzdHJp Y3QgX19lbmRwdHIsIGludCBfX2Jhc2UpCiAgICAgdGhyb3cgKCk7CgoKCgoKCl9fZXh0ZW5zaW9u X18KZXh0ZXJuIGxvbmcgbG9uZyBpbnQgc3RydG9sbCAoX19jb25zdCBjaGFyICpfX3Jlc3RyaWN0 IF9fbnB0ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAqKl9fcmVzdHJpY3Qg X19lbmRwdHIsIGludCBfX2Jhc2UpIHRocm93ICgpOwoKX19leHRlbnNpb25fXwpleHRlcm4gdW5z aWduZWQgbG9uZyBsb25nIGludCBzdHJ0b3VsbCAoX19jb25zdCBjaGFyICpfX3Jlc3RyaWN0IF9f bnB0ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgKipfX3Jl c3RyaWN0IF9fZW5kcHRyLCBpbnQgX19iYXNlKQogICAgIHRocm93ICgpOwojIDIxNSAiL3Vzci9p bmNsdWRlL3N0ZGxpYi5oIiAzCmV4dGVybiBsb25nIGludCBfX3N0cnRvbF9sIChfX2NvbnN0IGNo YXIgKl9fcmVzdHJpY3QgX19ucHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAq Kl9fcmVzdHJpY3QgX19lbmRwdHIsIGludCBfX2Jhc2UsCiAgICAgICAgICAgICAgICAgICAgICAg ICAgICBfX2xvY2FsZV90IF9fbG9jKSB0aHJvdyAoKTsKCmV4dGVybiB1bnNpZ25lZCBsb25nIGlu dCBfX3N0cnRvdWxfbCAoX19jb25zdCBjaGFyICpfX3Jlc3RyaWN0IF9fbnB0ciwKICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICoqX19yZXN0cmljdCBfX2VuZHB0ciwK ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgX19iYXNlLCBfX2xvY2Fs ZV90IF9fbG9jKSB0aHJvdyAoKTsKCl9fZXh0ZW5zaW9uX18KZXh0ZXJuIGxvbmcgbG9uZyBpbnQg X19zdHJ0b2xsX2wgKF9fY29uc3QgY2hhciAqX19yZXN0cmljdCBfX25wdHIsCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBjaGFyICoqX19yZXN0cmljdCBfX2VuZHB0ciwgaW50IF9f YmFzZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fbG9jYWxlX3QgX19sb2Mp IHRocm93ICgpOwoKX19leHRlbnNpb25fXwpleHRlcm4gdW5zaWduZWQgbG9uZyBsb25nIGludCBf X3N0cnRvdWxsX2wgKF9fY29uc3QgY2hhciAqX19yZXN0cmljdCBfX25wdHIsCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAqKl9fcmVzdHJpY3QgX19lbmRw dHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IF9fYmFz ZSwgX19sb2NhbGVfdCBfX2xvYykKICAgICB0aHJvdyAoKTsKCmV4dGVybiBkb3VibGUgX19zdHJ0 b2RfbCAoX19jb25zdCBjaGFyICpfX3Jlc3RyaWN0IF9fbnB0ciwKICAgICAgICAgICAgICAgICAg ICAgICAgICBjaGFyICoqX19yZXN0cmljdCBfX2VuZHB0ciwgX19sb2NhbGVfdCBfX2xvYykKICAg ICB0aHJvdyAoKTsKCmV4dGVybiBmbG9hdCBfX3N0cnRvZl9sIChfX2NvbnN0IGNoYXIgKl9fcmVz dHJpY3QgX19ucHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAqKl9fcmVzdHJpY3Qg X19lbmRwdHIsIF9fbG9jYWxlX3QgX19sb2MpIHRocm93ICgpOwoKZXh0ZXJuIGxvbmcgZG91Ymxl IF9fc3RydG9sZF9sIChfX2NvbnN0IGNoYXIgKl9fcmVzdHJpY3QgX19ucHRyLAogICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIGNoYXIgKipfX3Jlc3RyaWN0IF9fZW5kcHRyLAogICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIF9fbG9jYWxlX3QgX19sb2MpIHRocm93ICgpOwoKCgoK CgpleHRlcm4gZG91YmxlIF9fc3RydG9kX2ludGVybmFsIChfX2NvbnN0IGNoYXIgKl9fcmVzdHJp Y3QgX19ucHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICoqX19yZXN0 cmljdCBfX2VuZHB0ciwgaW50IF9fZ3JvdXApCiAgICAgdGhyb3cgKCk7CmV4dGVybiBmbG9hdCBf X3N0cnRvZl9pbnRlcm5hbCAoX19jb25zdCBjaGFyICpfX3Jlc3RyaWN0IF9fbnB0ciwKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICoqX19yZXN0cmljdCBfX2VuZHB0ciwgaW50 IF9fZ3JvdXApCiAgICAgdGhyb3cgKCk7CmV4dGVybiBsb25nIGRvdWJsZSBfX3N0cnRvbGRfaW50 ZXJuYWwgKF9fY29uc3QgY2hhciAqX19yZXN0cmljdCBfX25wdHIsCiAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIGNoYXIgKipfX3Jlc3RyaWN0IF9fZW5kcHRyLAogICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgX19ncm91cCkgdGhyb3cgKCk7Cgpl eHRlcm4gbG9uZyBpbnQgX19zdHJ0b2xfaW50ZXJuYWwgKF9fY29uc3QgY2hhciAqX19yZXN0cmlj dCBfX25wdHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciAqKl9fcmVz dHJpY3QgX19lbmRwdHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IF9f YmFzZSwgaW50IF9fZ3JvdXApIHRocm93ICgpOwoKCgpleHRlcm4gdW5zaWduZWQgbG9uZyBpbnQg X19zdHJ0b3VsX2ludGVybmFsIChfX2NvbnN0IGNoYXIgKl9fcmVzdHJpY3QgX19ucHRyLAogICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyICoqX19yZXN0cmlj dCBfX2VuZHB0ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg aW50IF9fYmFzZSwgaW50IF9fZ3JvdXApIHRocm93ICgpOwoKCgoKX19leHRlbnNpb25fXwpleHRl cm4gbG9uZyBsb25nIGludCBfX3N0cnRvbGxfaW50ZXJuYWwgKF9fY29uc3QgY2hhciAqX19yZXN0 cmljdCBfX25wdHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hh ciAqKl9fcmVzdHJpY3QgX19lbmRwdHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgaW50IF9fYmFzZSwgaW50IF9fZ3JvdXApIHRocm93ICgpOwoKCgpfX2V4dGVuc2lv bl9fCmV4dGVybiB1bnNpZ25lZCBsb25nIGxvbmcgaW50IF9fc3RydG91bGxfaW50ZXJuYWwgKF9f Y29uc3QgY2hhciAqCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIF9fcmVzdHJpY3QgX19ucHRyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBjaGFyICoqX19yZXN0cmljdCBfX2VuZHB0ciwKICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IF9fYmFzZSwgaW50 IF9fZ3JvdXApCiAgICAgdGhyb3cgKCk7CiMgMzg0ICIvdXNyL2luY2x1ZGUvc3RkbGliLmgiIDMK ZXh0ZXJuIGNoYXIgKmw2NGEgKGxvbmcgaW50IF9fbikgdGhyb3cgKCk7CgoKZXh0ZXJuIGxvbmcg aW50IGE2NGwgKF9fY29uc3QgY2hhciAqX19zKSB0aHJvdyAoKSBfX2F0dHJpYnV0ZV9fICgoX19w dXJlX18pKTsKCgojIDEgIi91c3IvaW5jbHVkZS9zeXMvdHlwZXMuaCIgMSAzCiMgMjggIi91c3Iv aW5jbH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yBpbnQgKl9fcmVzdHJp Y3QgX19yZXN1bHQpIHRocm93ICgpOwoKCmV4dGVybiBpbnQgbXJhbmQ0OF9yIChzdHJ1Y3QgZHJh bmQ0OF9kYXRhICpfX3Jlc3RyaWN0IF9fYnVmZmVyLAogICAgICAgICAgICAgICAgICAgICAgbG9u ZyBpbnQgKl9fcmVzdHJpY3QgX19yZXN1bHQpIHRocm93ICgpOwpleHRlcm4gaW50IGpyYW5kNDhf ciAodW5zaWduZWQgc2hvcnQgaW50IF9feHN1YmlbM10sCiAgICAgICAgICAgICAgICAgICAgICBz dHJ1Y3QgZHJhbmQ0OF9kYXRhICpfX3Jlc3RyaWN0IF9fYnVmZmVyLAogICAgICAgICAgICAgICAg ICAgICAgbG9uZyBpbnQgKl9fcmVzdHJpY3QgX19yZXN1bHQpIHRocm93ICgpOwoKCmV4dGVybiBp bnQgc3JhbmQ0OF9yIChsb25nIGludCBfX3NlZWR2YWwsIHN0cnVjdCBkcmFuZDQ4X2RhdGEgKl9f YnVmZmVyKQogICAgIHRocm93ICgpOwoKZXh0ZXJuIGludCBzZWVkNDhfciAodW5zaWduZWQgc2hv cnQgaW50IF9fc2VlZDE2dlszXSwKICAgICAgICAgICAgICAgICAgICAgc3RydWN0IGRyYW5kNDhf ZGF0YSAqX19idWZmZXIpIHRocm93ICgpOwoKZXh0ZXJuIGludCBsY29uZzQ4X3IgKHVuc2lnbmVk IHNob3J0IGludCBfX3BhcmFtWzddLAogICAgICAgICAgICAgICAgICAgICAgc3RydWN0IGRyYW5k NDhfZGF0YSAqX19idWZmZXIpIHRocm93ICgpOwojIDUyNyAiL3Vzci9pbmNsdWRlL3N0ZGxpYi5o IiAzCmV4dGVybiB2b2lkICptYWxsb2MgKHNpemVfdCBfX3NpemUpIHRocm93ICgpIF9fYXR0cmli dXRlX18gKChfX21hbGxvY19fKSk7CgpleHRlcm4gdm9pZCAqY2FsbG9jIChzaXplX3QgX19ubWVt Yiwgc2l6ZV90IF9fc2l6ZSkKICAgIC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oKSBfX2F0dHJpYnV0ZV9fICgoX19jb25zdF9fKSk7CmV4dGVybiBsb25nIGludCBsYWJzIChs b25nIGludCBfX3gpIHRocm93ICgpIF9fYXR0cmlidXRlX18gKChfX2NvbnN0X18pKTsKCl9fZXh0 ZW5zaW9uX18gZXh0ZXJuIGxvbmcgbG9uZyBpbnQgbGxhYnMgKGxvbmcgbG9uZyBpbnQgX194KQog ICAgIHRocm93ICgpIF9fYXR0cmlidXRlX18gKChfX2NvbnN0X18pKTsKCgoKCgoKZXh0ZXJuIGRp dl90IGRpdiAoaW50IF9fbnVtZXIsIGludCBfX2Rlbm9tKQogICAgIHRocm93ICgpIF9fYXR0cmli dXRlX18gKChfX2NvbnN0X18pKTsKZXh0ZXJuIGxkaXZfdCBsZGl2IChsb25nIGludCBfX251bWVy LCBsb25nIGludCBfX2Rlbm9tKQogICAgIHRocm93ICgpIF9fYXR0cmlidXRlX18gKChfX2NvbnN0 X18pKTsKCl9fZXh0ZW5zaW9uX18gZXh0ZXJuIGxsZGl2X3QgbGxkaXYgKGxvbmcgbG9uZyBpbnQg X19udW1lciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9uZyBsb25nIGlu dCBfX2Rlbm9tKQogICAgIHRocm93ICgpIF9fYXR0cmlidXRlX18gKChfX2NvbnN0X18pKTsKIyA3 MjggIi91c3IvaW5jbHVkZS9zdGRsaWIuaCIgMwpleHRlcm4gY2hhciAqZWN2dCAoZG91YmxlIF9f dmFsdWUsIGludCBfX25kaWdpdCwgaW50ICpfX3Jlc3RyaWN0IF9fZGVjcHQsCiAgICAgICAgICAg ICAgICAgICBpbnQgKl9fcmVzdHJpY3QgX19zaWduKSB0aHJvdyAoKTsKCgoKCmV4dGVybiBjaGFy ICpmY3Z0IChkb3VibGUgX192YWx1ZSwgaW50IF9fbmRpZ2l0LCBpbnQgKl9fcmVzdHJpY3QgX19k ZWNwdCwKICAgICAgICAgICAgICAgICAgIGludCAqX19yZXN0cmljdCBfX3N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gICAgIC0tY3Vy cmVudDsKICAgICAgICByZXR1cm4gX190bXA7CiAgICAgIH0KCgoKCgoKICAgICAgcmV2ZXJzZV9p dGVyYXRvciYKICAgICAgb3BlcmF0b3ItLSgpCiAgICAgIHsKICAgICAgICArK2N1cnJlbnQ7CiAg ICAgICAgcmV0dXJuICp0aGlzOwogICAgICB9CgoKCgoKCiAgICAgIHJldmVyc2VfaXRlcmF0b3Ig b3BlcmF0b3ItLShpbnQpCiAgICAgIHsKICAgICAgICByZXZlcnNlX2l0ZXJhdG9yIF9fdG1wID0g KnRoaXM7CiAgICAgICAgKytjdXJyZW50OwogICAgICAgIHJldHVybiBfX3RtcDsKICAgICAgfQoK CgoKCgogICAgICByZXZlcnNlX2l0ZXJhdG9yCiAgICAgIG9wZXJhdG9yKyhkaWZmZXJlbmNlX3R5 cGUgX19uKSBjb25zdAogICAgICB7IHJldHVybiByZXZlcnNlX2l0ZXJhdG9yKGN1cnJlbnQgLSBf X24pOyB9CgoKCgoKCiAgICAgIHJldmVyc2VfaXRlcmF0b3ImCiAgICAgIG9wZXJhdG9yKz0oZGlm ZmVyZW5jZV90eXBlIF9fbikKICAgICAgewogICAgICAgIGN1cnJlbnQgLT0gX19uOwogICAgICAg IHJldHVybiAqdGhpczsKICAgICAgfQoKCgoKCgogICAgICByZXZlcnNlX2l0ZXJhdG9yCiAgICAg IG9wZXJhdG9yLShkaWZmZXJlbmNlX3R5cGUgX19uKSBjb25zdAogICAgICB7IHJldHVybiByZXZl cnNlX2l0ZXJhdG9yKGN1cnJlbnQgKyBfX24pOyB9CgoKCgoKCiAgICAgIHJldmVyc2VfaXRlcmF0 b3ImCiAgICAgIG9wZXJhdG9yLT0oZGlmZmVyZW5jZV90eXBlIF9fbikKICAgICAgewogICAgICAg IGN1cnJlbnQgKz0gX19uOwogICAgICAgIHJldHVybiAqdGhpczsKICAgICAgfQoKCgoKCgogICAg ICByZWZlcmVuY2UKICAgICAgb3BlcmF0b3JbXShkaWZmZXJlbmNlX3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5lciYgX194LCB0eXBlbmFtZSBfQ29u dGFpbmVyOjppdGVyYXRvciBfX2kpCiAgICAgIDogY29udGFpbmVyKCZfX3gpLCBpdGVyKF9faSkg e30KIyA1MTIgIi91c3IvaW5jbHVkZS9nKysvYml0cy9zdGxfaXRlcmF0b3IuaCIgMwogICAgICBp bnNlcnRfaXRlcmF0b3ImCiAgICAgIG9wZXJhdG9yPShjb25zdCB0eXBlbmFtZSBfQ29udGFpbmVy Ojpjb25zdF9yZWZlcmVuY2UgX192YWx1ZSkKICAgICAgewogICAgICAgIGl0ZXIgPSBjb250YWlu ZXItPmluc2VydChpdGVyLCBfX3ZhbHVlKTsKICAgICAgICArK2l0ZXI7CiAgICAgICAgcmV0dXJu ICp0aGlzOwogICAgICB9CgoKICAgICAgaW5zZXJ0X2l0ZXJhdG9yJgogICAgICBvcGVyYXRvcioo KSB7IHJldHVybiAqdGhpczsgfQoKCiAgICAgIGluc2VydF9pdGVyYXRvciYKICAgICAgb3BlcmF0 b3IrKygpIHsgcmV0dXJuICp0aGlzOyB9CgoKICAgICAgaW5zZXJ0X2l0ZXJhdG9yJgogICAgICBv cGVyYXRvcisrKGludCkgeyByZXR1cm4gKnRoaXM7IH0KICAgIH07CiMgNTQ0ICIvdXNyL2luY2x1 ZGUvZysrL2JpdHMvc3RsX2l0ZXJhdG9yLmgiIDMKICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ29udGFp bmVyLCB0eXBlbmFtZSBfSXRlcmF0b3I+CiAgICBpbmxpbmUgaW5zZXJ0X2l0ZXJhdG9yPF9Db250 YWluZXI+CiAgICBpbnNlcnRlcihfQ29udGFpbmVyJiBfX3gsIF9JdGVyYXRvciBfX2kpCiAgICB7 CiAgICAgIHJldHVybiBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4oX194LAogICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVuYW1lIF9Db250YWluZXI6Oml0ZXJh dG9yKF9faSkpOwogIC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OwogICAgICB0eXBlZGVmIHR5cGVu YW1lIGl0ZXJhdG9yX3RyYWl0czxfSXRlcmF0b3I+Ojpwb2ludGVyIHBvaW50ZXI7CgogICAgICBf X25vcm1hbF9pdGVyYXRvcigpIDogX01fY3VycmVudChfSXRlcmF0b3IoKSkgeyB9CgogICAgICBl eHBsaWNpdAogICAgICBfX25vcm1hbF9pdGVyYXRvcihjb25zdCBfSXRlcmF0b3ImIF9faSkgOiBf TV9jdXJyZW50KF9faSkgeyB9CgoKICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0l0ZXI+CiAgICAg IGlubGluZSBfX25vcm1hbF9pdGVyYXRvcihjb25zdCBfX25vcm1hbF9pdGVyYXRvcjxfSXRlciwg X0NvbnRhaW5lcj4mIF9faSkKICAgICAgICA6IF9NX2N1cnJlbnQoX19pLmJhc2UoKSkgeyB9CgoK ICAgICAgcmVmZXJlbmNlCiAgICAgIG9wZXJhdG9yKigpIGNvbnN0IHsgcmV0dXJuICpfTV9jdXJy ZW50OyB9CgogICAgICBwb2ludGVyCiAgICAgIG9wZXJhdG9yLT4oKSBjb25zdCB7IHJldHVybiBf TV9jdXJyZW50OyB9CgogICAgICBfX25vcm1hbF9pdGVyYXRvciYKICAgICAgb3BlcmF0b3IrKygp IHsgKytfTV9jdXJyZW50OyByZXR1cm4gKnRoaXM7IH0KCiAgICAgIF9fbm9ybWFsX2l0ZXJhdG9y CiAgICAgIG9wZXJhdG9yKysoaW50KSB7IHJldHVybiBfX25vcm1hbF9pdGVyYXRvcihfTV9jdXJy ZW50KyspOyB9CgoKICAgICAgX19ub3JtYWxfaXRlcmF0b3ImCiAgICAgIG9wZXJhdG9yLS0oKSB7 IC0tX01fY3VycmVudDsgcmV0dXJuICp0aGlzOyB9CgogICAgICBfX25vcm1hbF9pdGVyYXRvcgog ICAgICBvcGVyYXRvci0tKGludCkgeyByZXR1cm4gX19ub3JtYWxfaXRlcmF0b3IoX01fY3VycmVu dC0tKTsgfQoKCiAgICAgIHJl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bChf X2ZpcnN0LCBfX2ZpcnN0ICsgX19uLCBfX2MpOwogICAgICByZXR1cm4gX19maXJzdCArIF9fbjsK ICAgIH0KCiAgdGVtcGxhdGU8dHlwZW5hbWUgX1NpemU+CiAgICBpbmxpbmUgc2lnbmVkIGNoYXIq CiAgICBmaWxsX24oY2hhciogX19maXJzdCwgX1NpemUgX19uLCBjb25zdCBzaWduZWQgY2hhciYg X19jKQogICAgewogICAgICBmaWxsKF9fZmlyc3QsIF9fZmlyc3QgKyBfX24sIF9fYyk7CiAgICAg IHJldHVybiBfX2ZpcnN0ICsgX19uOwogICAgfQoKICB0ZW1wbGF0ZTx0eXBlbmFtZSBfU2l6ZT4K ICAgIGlubGluZSBjaGFyKgogICAgZmlsbF9uKGNoYXIqIF9fZmlyc3QsIF9TaXplIF9fbiwgY29u c3QgY2hhciYgX19jKQogICAgewogICAgICBmaWxsKF9fZmlyc3QsIF9fZmlyc3QgKyBfX24sIF9f Yyk7CiAgICAgIHJldHVybiBfX2ZpcnN0ICsgX19uOwogICAgfQojIDYwNiAiL3Vzci9pbmNsdWRl L2crKy9iaXRzL3N0bF9hbGdvYmFzZS5oIiAzCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0lucHV0SXRl cjEsIHR5cGVuYW1lIF9JbnB1dEl0ZXIyPgogICAgcGFpcjxfSW5wdXRJdGVyMSwgX0lucHV0SXRl cjI+CiAgICBtaXNtYXRjaChfSW5wdXRJdGVyMSBfX2ZpcnN0MSwgX0lucHV0SXRlcjEgX19sYXN0 MSwKICAgICAgICAgICAgIF9JbnB1dEl0ZXIyIF9fZmlyc3QyKQogICAgewoKICAgICAKICAgICAK ICAgICAKCiAgICAgCgoKICAgICAgd2hpbGUgKF9fZmlyc3QxICE9IF9fbGFzdDEgJiYgKl9fZmly c3QxID09ICpfX2ZpcnN0MikgewogICAgICAgICsrX19maXJzdDE7CiAgICAgICAgKytfX2ZpcnN0 MjsKICAgICAgfQogICAgICByZXR1cm4gcGFpcjxfSW5wd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0MikKICAgIHsKCiAgICAgCiAgICAgCiAgICAgCgogICAgIAoK CiAgICAgIGZvciAoIDsgX19maXJzdDEgIT0gX19sYXN0MSAmJiBfX2ZpcnN0MiAhPSBfX2xhc3Qy CiAgICAgICAgICAgIDsgKytfX2ZpcnN0MSwgKytfX2ZpcnN0MikgewogICAgICAgIGlmICgqX19m aXJzdDEgPCAqX19maXJzdDIpCiAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICBpZiAoKl9f Zmlyc3QyIDwgKl9fZmlyc3QxKQogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICB9CiAgICAg IHJldHVybiBfX2ZpcnN0MSA9PSBfX2xhc3QxICYmIF9fZmlyc3QyICE9IF9fbGFzdDI7CiAgICB9 CiMgNzY3ICIvdXNyL2luY2x1ZGUvZysrL2JpdHMvc3RsX2FsZ29iYXNlLmgiIDMKICB0ZW1wbGF0 ZTx0eXBlbmFtZSBfSW5wdXRJdGVyMSwgdHlwZW5hbWUgX0lucHV0SXRlcjIsIHR5cGVuYW1lIF9D b21wYXJlPgogICAgYm9vbAogICAgbGV4aWNvZ3JhcGhpY2FsX2NvbXBhcmUoX0lucHV0SXRlcjEg X19maXJzdDEsIF9JbnB1dEl0ZXIxIF9fbGFzdDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICBfSW5wdXRJdGVyMiBfX2ZpcnN0MiwgX0lucHV0SXRlcjIgX19sYXN0MiwKICAgICAgICAgICAg ICAgICAgICAgICAgICAgIF9Db21wYXJlIF9fY29tcCkKICAgIHsKCiAgICAgCiAgICAgCgogICAg ICBmb3IgKCA7IF9fZmlyc3QxICE9IF9fbGFzdDEgJiYgX19maXJzdDIgIT0gX19sYXN0MgogICAg ICAgICAgICA7ICsrX19maXJzdDEsICsrX19maXJzdDIpIHsKICAgICAgICBpZiAoX19jb21wKCpf X2ZpcnN0MSwgKl9fZmlyc3QyKSkKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIGlmIChf X2NvbXAoKl9fZmlyc3QyLCAqX19maXJzdDEpKQogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAg ICB9CiAgICAgIHJldHVybiBfX2ZpcnN0MSA9PSBfX2xhc3QxICYmIF9fZmlyc3QyICE9IF9fbGFz dDI7CiAgICB9CgogIGlubGluZSBib29sCiAgbGV4aWNvZ3JhcGhpY2FsX2NvbXBhcmUoY29uc3Qg dW5zaWduZWQgY2hhciogX19maXJzdDEsIGNvbnN0IHVuc2lnbmVkIGNoYXIqIF9fbGFzdDEsCiAg ICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdW5zaWduZWQgY2hhciogX19maXJzdDIsIGNv bnN0IHVuc2lnbmVkIGNoYXIqIF9fbGFzdDIpCiAgewogICAgY29uc3Qgc2l6ZV90IF9fbGVuMSA9 IF9fbGFzdDEgLSBfX2ZpcnN0MTsKICAgIGNvbnN0IHNpemVfdCBfX2xlbjIgPSBfX2xhc3QyIC0g X19maXJzdDI7CiAgICBjb25zdCBpbnQgX19yZXN1bHQgPSBtZW1jbXAoX19maXJzdDEsIF9fZmly c3QyLCBtaW4oX19sZW4xLCBfX2xlbjIpKTsKICAgIHJldHVybiBfX3Jlc3VsdCAhPSAwID8gX19y ZXN1bHQgPCAwIDogX19sZW4xIDwgX19sZW4yOwogIH0KCiAgaW5saW5lIGJvb2wKICBsZXhpY29n cmFwaGljYWxfY29tcGFyZShjb25zdCBjaGFyKiBfX2ZpcnN0MSwgY29uc3QgY2hhciogX19sYXN0 MSwKICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyKiBfX2ZpcnN0MiwgY29uc3Qg Y2hhciogX19sYXN0MikKICB7CgogICAgcmV0dXJuIGxleGljb2dyYXBoaWNhbF9jb21wYXJlKChj b25zdCBzaWduZWQgY2hhciopIF9fZmlyc3QxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIChjb25zdCBzaWduZWQgY2hhciopIF9fbGFzdDEsCiAgICAgICAgICAgICAgICA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0dXJuIF9fcmVzdWx0OwogIH0KIyAxNTEgIi91c3IvaW5j bHVkZS9nKysvYml0cy9zdGxfdGhyZWFkcy5oIiAzCiAgc3RydWN0IF9TVExfbXV0ZXhfbG9jawog IHsKCgoKCgogICAgX19ndGhyZWFkX211dGV4X3QgX01fbG9jazsKCiAgICB2b2lkCiAgICBfTV9p bml0aWFsaXplKCkKICAgIHsKIyAxODQgIi91c3IvaW5jbHVkZS9nKysvYml0cy9zdGxfdGhyZWFk cy5oIiAzCiAgICB9CgogICAgdm9pZAogICAgX01fYWNxdWlyZV9sb2NrKCkKICAgIHsKCgoKICAg ICAgX19ndGhyZWFkX211dGV4X2xvY2soJl9NX2xvY2spOwogICAgfQoKICAgIHZvaWQKICAgIF9N X3JlbGVhc2VfbG9jaygpCiAgICB7CgoKCiAgICAgIF9fZ3RocmVhZF9tdXRleF91bmxvY2soJl9N X2xvY2spOwogICAgfQogIH07CiMgMjIwICIvdXNyL2luY2x1ZGUvZysrL2JpdHMvc3RsX3RocmVh ZHMuaCIgMwogIHN0cnVjdCBfU1RMX2F1dG9fbG9jawogIHsKICAgIF9TVExfbXV0ZXhfbG9jayYg X01fbG9jazsKCiAgICBfU1RMX2F1dG9fbG9jayhfU1RMX211dGV4X2xvY2smIF9fbG9jaykgOiBf TV9sb2NrKF9fbG9jaykKICAgIHsgX01fbG9jay5fTV9hY3F1aXJlX2xvY2soKTsgfQoKICAgIH5f U1RMX2F1dG9fbG9jaygpIHsgX01fbG9jay5fTV9yZWxlYXNlX2xvY2soKTsgfQoKICBwcml2YXRl OgogICAgdm9pZCBvcGVyYXRvcj0oY29uc3QgX1NUTF9hdXRvX2xvY2smKTsKICAgIF9TVExfYXV0 b19sb2NrKGNvbnN0IF9TVExfYXV0b19sb2NrJik7CiAgfTsKCn0KIyA5MSAiL3Vzci9pbmNsdWRl L2crKy9iaXRzL3N0bF9hbGxvYy5oIiAyIDMKCiMgMSAiL3Vzci9pbmNsdWRlL2crKy9pNjg2LXBj LWxp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cmVzdWx0ID0gcmVhbGxvYyhfX3AsIF9fbmV3X3N6KTsKICAgICAgICBpZiAo X19idWlsdGluX2V4cGVjdChfX3Jlc3VsdCA9PSAwLCAwKSkKICAgICAgICAgIF9fcmVzdWx0ID0g X1Nfb29tX3JlYWxsb2MoX19wLCBfX25ld19zeik7CiAgICAgICAgcmV0dXJuIF9fcmVzdWx0Owog ICAgICB9CgogICAgICBzdGF0aWMgdm9pZCAoKiBfX3NldF9tYWxsb2NfaGFuZGxlcih2b2lkICgq X19mKSgpKSkoKQogICAgICB7CiAgICAgICAgdm9pZCAoKiBfX29sZCkoKSA9IF9fbWFsbG9jX2Fs bG9jX29vbV9oYW5kbGVyOwogICAgICAgIF9fbWFsbG9jX2FsbG9jX29vbV9oYW5kbGVyID0gX19m OwogICAgICAgIHJldHVybiBfX29sZDsKICAgICAgfQogICAgfTsKCgogIHRlbXBsYXRlPGludCBf X2luc3Q+CiAgICB2b2lkICgqIF9fbWFsbG9jX2FsbG9jX3RlbXBsYXRlPF9faW5zdD46Ol9fbWFs bG9jX2FsbG9jX29vbV9oYW5kbGVyKSgpID0gMDsKCiAgdGVtcGxhdGU8aW50IF9faW5zdD4KICAg IHZvaWQqCiAgICBfX21hbGxvY19hbGxvY190ZW1wbGF0ZTxfX2luc3Q+OjoKICAgIF9TX29vbV9t YWxsb2Moc2l6ZV90IF9fbikKICAgIHsKICAgICAgdm9pZCAoKiBfX215X21hbGxvY19oYW5kbGVy KSgpOwogICAgICB2b2lkKiBfX3Jlc3VsdDsKCiAgICAgIGZvciAoOzspCiAgICAgICAgewogICAg ICAgICAgX19teV9tYWxsb2NfaGFuZGxlciA9IF9fbWFsbG9jX2FsbG9jX29vbV9oYW5kbGVyOwog ICAgICAgICAgaWYgKF9fYnVpbHRpbl9leHBlY3QoX19teV9tYWxsb2NfaGFuZGxlciA9PSAwLCAw KSkKICAgICAgICAgICAgX190aHJvd19iYWRfYWxsb2MoKTsKICAgICAgICAgICgqX19teV9tYWxs b2NfaGFuZGxlcikoKTsKICAgICAgICAgIF9fcmVzdWx0ID0gbWFsbG9jKF9fbik7CiAgICAgICAg ICBpZiAoX19yZXN1bHQpCiAgICAgICAgICAgIHJldHVybiBfX3Jlc3VsdDsKICAgICAgICB9CiAg ICB9CgoKICB0ZW1wbGF0ZTxpbnQgX19pbnN0PgogICAgdm9pZCoKICAgIF9fbWFsbG9jX2FsbG9j X3RlbXBsYXRlPF9faW5zdD46OgogICAgX1Nfb29tX3JlYWxsb2Modm9pZCogX19wLCBzaXplX3Qg X19uKQogICAgewogICAgICB2b2lkICgqIF9fbXlfbWFsbG9jX2hhbmRsZXIpKCk7CiAgICAgIHZv aWQqIF9fcmVzdWx0OwoKICAgICAgZm9yICg7OykKICAgICAgICB7CiAgICAgICAgICBfX215X21h bGxvY19oYW5kbGVyID0gX19tYWxsb2NfYWxsb2Nfb29tX2hhbmRsZXI7CiAgICAgICAgICBpZiAo X19idWlsdGluX2V4cGVjdChfX215X21hbGxvY19oYW5kbGVyID09IDAsIDApKQogICAgICAgICAg ICBfX3Rocm93X2JhZF9hbGxvYygpOwogICAgICAgICAgKCpfX215X21hbGxvY19oYW5kbGVyKSgp OwogICAgICAgICAgX19yZXN1bHQgPSByZWFsbG9jKF9fcCwgX19uKTsKICAgICAgICAgIGlmIChf X3Jlc3VsdCkKICAgICAgICAgICAgcmV0dXJuIF9fcmVzdWx0OwogICAgICAgIH0KICAgIH0KCgog IHR5cGVkZWYgX19uZXdfYWxsb2MgX19tZW1faW50ZXJmYWNlOwojIDIyOSAiL3Vzci9pbmNsdWRl L2crKy9iaXRzL3N0bF9hbGxvYy5oIiAzCiAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFt ZSBfQWxsb2M+CiAgICBjbGFzcyBfX3NpbXBsZV9hbGxvYwogICAgewogICAgcHVibGljOgogICAg ICBzdGF0aWMgX1RwKgogICAgICBhbGxvY2F0ZShzaXplX3QgX19uKQogICAgICB7CiAgICAgICAg X1RwKiBfX3JldCA9IDA7CiAgICAgICAgaWYgKF9fbikKICAgICAgICAgIF9fcmV0ID0gc3RhdGlj X2Nhc3Q8X1RwKj4oX0FsbG9jOjphbGxvY2F0ZShfX24gKiBzaXplb2YoX1RwKSkpOwogICAgICAg IHJldHVybiBfX3JldDsKICAgICAgfQoKICAgICAgc3RhdGljIF9UcCoKICAgICAgYWxsb2NhdGUo KQogICAgICB7IHJldHVybiAoX1RwKikgX0FsbG9jOjphbGxvY2F0ZShzaXplb2YgKF9UcCkpOyB9 CgogICAgICBzdGF0aWMgdm9pZAogICAgICBkZWFsbG9jYXRlKF9UcCogX19wLCBzaXplX3QgX19u KQogICAgICB7IGlmICgwICE9IF9fbikgX0FsbG9jOjpkZWFsbG9jYXRlKF9fcCwgX19uICogc2l6 ZW9mIChfVHApKTsgfQoKICAgICAgc3RhdGljIHZvaWQKICAgICAgZGVhbGxvY2F0ZShfVHAqIF9f cCkKICAgICAgeyBfQWxsb2M6OmRlYWxsb2NhdGUoX19wLCBzaXplb2YgKF9UcCkpOyB9CiAgICB9 OwojIDI3MCAiL3Vzci9pbmNsdWRlL2crKy9iaXRzL3N0bF9hbGxvYy5oIiAzCiAgdGVtcGxhdGU8 dHlwZW5hbWUgX0FsbG9jPgogICAgY2xhc3MgX19kZWJ1Z19hbGxvYwogICAgewogICAgcHJpdmF0 ZToKCgogICAgICBlbnVtIHtfU19leHRyYSA9IDh9OwoKICAgIHB1YmxpYzoKICAgICAgc3RhdGlj IHZvaWQqCiAgICAgIGFsbG9jYXRlKHNpemVfdCBfX24pCiAgICAgIHsKICAgICAgICBjaGFyKiBf X3Jlc3VsdCA9IChjaGFyKilfQWxsb2M6OmFsbG9jYXRlKF9fbiArIChpbnQpIF9TX2V4dHJhKTsK ICAgICAgICAqKHNpemVfdCopX19yZXN1bHQgPSBfX247CiAgICAgICAgcmV0dXJuIF9fcmVzdWx0 ICsgKGludCkgX1NfZXh0cmE7CiAgICAgIH0KCiAgICAgIHN0YXRpYyB2b2lkCiAgICAgIGRlYWxs b2NhdGUodm9pZCogX19wLCBzaXplX3QgX19uKQogICAgICB7CiAgICAgICAgY2hhciogX19yZWFs X3AgPSAoY2hhciopX19wIC0gKGludCkgX1NfZXh0cmE7CiAgICAgICAgKHN0YXRpY19jYXN0PHZv aWQ+ICgoKihzaXplX3QqKV9fcmVhbF9wID09IF9fbikgPyAwIDogKF9fYXNzZXJ0X2ZhaWwgKCIq KHNpemVfdCopX19yZWFsX3AgPT0gX19uIiwgIi91c3IvaW5jbHVkZS9nKysvYml0cy9zdGxfYWxs b2MuaCIsIDI5MSwgX19QUkVUVFlfRlVOQ1RJT05fXyksIDApKSk7CiAgICAgICAgX0FsbG9jOjpk ZWFsbG9jYXRlKF9fcmVhbF9wLCBfX24gKyAoaW50KSBfU19leHRyYSk7CiAgICAgIH0KCgogICAg ICBzdGF0aWMgdm9pZCoKICAgICAgcmVhbGxvY2F0ZSh2b2lkKiBfX3AsIHNpemVfdCBfX29sZF9z eiwgc2l6ZV90IF9fbmV3X3N6KQogICAgICB7CiAgICAgICAgY2hhciogX19yZWFsX3AgPSAoY2hh ciopX19wIC0gKGludCkgX1NfZXh0cmE7CiAgICAgICAgKHN0YXRpY19jYXN0PHZvaWQ+ICgoKihz aXplX3QqKV9fcmVhbF9wID09IF9fb2xkX3N6KSA/IDAgOiAoX19hc3NlcnRfZmFpbCAoIiooc2l6 ZV90KilfX3JlYWxfcCA9PSBfX29sZF9zeiIsICIvdXNyL2luY2x1ZGUvZysrL2JpdHMvc3RsX2Fs bG9jLmgiLCAzMDAsIF9fUFJFVFRZX0ZVTkNUSU9OX18pLCAwKSkpOwogICAgICAgIGNoYXIqIF9f cmVzdWx0ID0gKGNoYXIqKSBfQWxsb2M6OnJlYWxsb2NhdGUoX19yZWFsX3AsCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX29sZF9zeiArIChpbnQp IF9TX2V4dHJhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgX19uZXdfc3ogKyAoaW50KSBfU19leHRyYSk7CiAgICAgICAgKihzaXplX3QqKV9fcmVz dWx0ID0gX19uZXdfc3o7CiAgICAgICAgcmV0dXJuIF9fcmVzdWx0ICsgKGludCkgX1NfZXh0cmE7 CiAgICAgIH0KICAgIH07CiMgMzQwICIvdXNyL2luY2x1ZGUvZysrL2JpdHMvc3RsX2FsbG9jLmgi IDMKICB0ZW1wbGF0ZTxib29sIF9fdGhyZWFkcywgaW50IF9faW5zdD4KICAgIGNsYXNzIF9fZGVm YXVsdF9hbGxvY190ZW1wbGF0ZQogICAgewogICAgcHJpdmF0ZToKICAgICAgZW51bSB7X0FMSUdO ID0gOH07CiAgICAgIGVudW0ge19NQVhfQllURVMgPSAxMjh9OwogICAgICBlbnVtIHtfTkZSRUVM SVNUUyA9IF9NQVhfQllURVMgLyBfQUxJR059OwoKICAgICAgdW5pb24gX09iagogICAgICB7CiAg ICAgICAgdW5pb24gX09iaiogX01fZnJlZV9saXN0X2xpbms7CiAgICAgICAgY2hhciBfTV9jbGll bnRfZGF0YVsxXTsKICAgICAgfTsKCiAgICAgIHN0YXRpYyBfT2JqKiB2b2xhdGlsZSBfU19mcmVl X2xpc3RbX05GUkVFTElTVFNdOwoKCiAgICAgIHN0YXRpYyBjaGFyKiBfU19zdGFydF9mcmVlOwog ICAgICBzdGF0aWMgY2hhciogX1NfZW5kX2ZyZWU7CiAgICAgIHN0YXRpYyBzaXplX3QgX1NfaGVh cF9zaXplOwoKICAgICAgc3RhdGljIF9TVExfbXV0ZXhfbG9jayBfU19ub2RlX2FsbG9jYXRvcl9s b2NrOwoKICAgICAgc3RhdGljIHNpemVfdAogICAgICBfU19yb3VuZF91cChzaXplX3QgX19ieXRl cykKICAgICAgeyByZXR1cm4gKCgoX19ieXRlcykgKyAoc2l6ZV90KSBfQUxJR04tMSkgJiB+KChz aXplX3QpIF9BTElHTiAtIDEpKTsgfQoKICAgICAgc3RhdGljIHNpemVfdAogICAgICBfU19mcmVl bGlzdF9pbmRleChzaXplX3QgX19ieXRlcykKICAgICAgeyByZXR1cm4gKCgoX19ieXRlcykgKyAo c2l6ZV90KV9BTElHTiAtIDEpLyhzaXplX3QpX0FMSUdOIC0gMSk7IH0KCgoKICAgICAgc3RhdGlj IHZvaWQqCiAgICAgIF9TX3JlZmlsbChzaXplX3QgX19uKTsKCgoKICAgICAgc3RhdGljIGNoYXIq CiAgICAgIF9TX2NodW5rX2FsbG9jKHNpemVfdCBfX3NpemUsIGludCYgX19ub2Jqcyk7CgoKCiAg ICAgIHN0cnVjdCBfTG9jawogICAgICB7CiAgICAgICAgX0xvY2soKSB7IGlmIChfX3RocmVhZHMp IF9TX25vZGVfYWxsb2NhdG9yX2xvY2suX01fYWNxdWlyZV9sb2NrKCk7IH0KICAgICAgICB+X0xv Y2soKSB7IGlmIChfX3RocmVhZHMpIF9TX25vZGVfYWxsb2NhdG9yX2xvY2suX01fcmVsZWFzZV9s b2NrKCk7IH0KICAgICAgfSBfX2F0dHJpYnV0ZV9fICgoX191bnVzZWRfXykpOwogICAgICBmcmll bmQgc3RydWN0IF9Mb2NrOwoKICAgICAgc3RhdGljIF9BdG9taWNfd29yZCBfU19mb3JjZV9uZXc7 CgogICAgcHVibGljOgoKICAgICAgc3RhdGljIHZvaWQqCiAgICAgIGFsbG9jYXRlKHNpemVfdCBf X24pCiAgICAgIHsKICAgICAgICB2b2lkKiBfX3JldCA9IDA7CgoKCgogICAgICAgIGlmIChfU19m b3JjZV9uZXcgPT0gMCkKICAgICAgICAgIHsKICAgICAgICAgICAgaWYgKGdldGVudigiR0xJQkNQ UF9GT1JDRV9ORVciKSkKICAgICAgICAgICAgICBfX2F0b21pY19hZGQoJl9TX2ZvcmNlX25ldywg MSk7CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICBfX2F0b21pY19hZGQoJl9TX2ZvcmNl X25ldywgLTEpOwoKICAgICAgICAgICAgKHN0YXRpY19jYXN0PHZvaWQ+ICgoX1NfZm9yY2VfbmV3 ICE9IDApID8gMCA6IChfX2Fzc2VydF9mYWlsICgiX1NfZm9yY2VfbmV3ICE9IDAiLCAiL3Vzci9p bmNsdWRlL2crKy9iaXRzL3N0bF9hbGxvYy5oIiwgNDA5LCBfX1BSRVRUWV9GVU5DVElPTl9fKSwg MCkpKTsKICAgICAgICAgIH0KCiAgICAgICAgaWYgKChfX24gPiAoc2l6ZV90KSBfTUFYX0JZVEVT KSB8fCAoX1NfZm9yY2VfbmV3ID4gMCkpCiAgICAgICAgICBfX3JldCA9IF9fbmV3X2FsbG9jOjph bGxvY2F0ZShfX24pOwogICAgICAgIGVsc2UKICAgICAgICAgIHsKICAgICAgICAgICAgX09iaiog dm9sYXRpbGUqIF9fbXlfZnJlZV9saXN0ID0gX1NfZnJlZV9saXN0CiAgICAgICAgICAgICAgKyBf U19mcmVlbGlzdF9pbmRleChfX24pOwoKCgogICAgICAgICAgICBfTG9jayBfX2xvY2tfaW5zdGFu Y2U7CiAgICAgICAgICAgIF9PYmoqIF9fcmVzdHJpY3RfXyBfX3Jlc3VsdCA9ICpfX215X2ZyZWVf bGlzdDsKICAgICAgICAgICAgaWYgKF9fYnVpbHRpbl9leHBlY3QoX19yZXN1bHQgPT0gMCwgMCkp CiAgICAgICAgICAgICAgX19yZXQgPSBfU19yZWZpbGwoX1Nfcm91bmRfdXAoX19uKSk7CiAgICAg ICAgICAgIGVsc2UKICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAqX19teV9mcmVlX2xp c3QgPSBfX3Jlc3VsdCAtPiBfTV9mcmVlX2xpc3RfbGluazsKICAgICAgICAgICAgICAgIF9fcmV0 ID0gX19yZXN1bHQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoX19idWlsdGluX2V4 cGVjdChfX3JldCA9PSAwLCAwKSkKICAgICAgICAgICAgICBfX3Rocm93X2JhZF9hbGxvYygpOwog ICAgICAgICAgfQogICAgICAgIHJldHVybiBfX3JldDsKICAgICAgfQoKCiAgICAgIHN0YXRpYyB2 b2lkCiAgICAgIGRlYWxsb2NhdGUodm9pZCogX19wLCBzaXplX3QgX19uKQogICAgICB7CiAgICAg ICAgaWYgKChfX24gPiAoc2l6ZV90KSBfTUFYX0JZVEVTKSB8fCAoX1NfZm9yY2VfbmV3ID4gMCkp CiAgICAgICAgICBfX25ld19hbGxvYzo6ZGVhbGxvY2F0ZShfX3AsIF9fbik7CiAgICAgICAgZWxz ZQogICAgICAgICAgewogICAgICAgICAgICBfT2JqKiB2b2xhdGlsZSogX19teV9mcmVlX2xpc3Qg PSBfU19mcmVlX2xpc3QKICAgICAgICAgICAgICArIF9TX2ZyZWVsaXN0X2luZGV4KF9fbik7CiAg ICAgICAgICAgIF9PYmoqIF9fcSA9IChfT2JqKilfX3A7CgoKCgogICAgICAgICAgICBfTG9jayBf X2xvY2tfaW5zdGFuY2U7CiAgICAgICAgICAgIF9fcSAtPiBfTV9mcmVlX2xpc3RfbGluayA9ICpf X215X2ZyZWVfbGlzdDsKICAgICAgICAgICAgKl9fbXlfZnJlZV9saXN0ID0gX19xOwogICAgICAg ICAgfQogICAgICB9CgoKICAgICAgc3RhdGljIHZvaWQqCiAgICAgIHJlYWxsb2NhdGUodm9pZCog X19wLCBzaXplX3QgX19vbGRfc3osIHNpemVfdCBfX25ld19zeik7CiAgICB9OwoKICB0ZW1wbGF0 ZTxib29sIF9fdGhyZWFkcywgaW50IF9faW5zdD4gX0F0b21pY193b3JkCiAgX19kZWZhdWx0X2Fs bG9jX3RlbXBsYXRlPF9fdGhyZWFkcywgX19pbnN0Pjo6X1NfZm9yY2VfbmV3ID0gMDsKCiAgdGVt cGxhdGU8Ym9vbCBfX3RocmVhZHMsIGludCBfX2luc3Q+CiAgICBpbmxpbmUgYm9vbAogICAgb3Bl cmF0b3I9PShjb25zdCBfX2RlZmF1bHRfYWxsb2NfdGVtcGxhdGU8X190aHJlYWRzLF9faW5zdD4m LAogICAgICAgICAgICAgICBjb25zdCBf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ICAg ICAgX190b3RhbF9ieXRlcyA9IF9fc2l6ZSAqIF9fbm9ianM7CiAgICAgICAgICBfX3Jlc3VsdCA9 IF9TX3N0YXJ0X2ZyZWU7CiAgICAgICAgICBfU19zdGFydF9mcmVlICs9IF9fdG90YWxfYnl0ZXM7 CiAgICAgICAgICByZXR1cm4gX19yZXN1bHQ7CiAgICAgICAgfQogICAgICBlbHNlCiAgICAgICAg ewogICAgICAgICAgc2l6ZV90IF9fYnl0ZXNfdG9fZ2V0ID0KICAgICAgICAgICAgMiAqIF9fdG90 YWxfYnl0ZXMgKyBfU19yb3VuZF91cChfU19oZWFwX3NpemUgPj4gNCk7CgogICAgICAgICAgaWYg KF9fYnl0ZXNfbGVmdCA+IDApCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICBfT2JqKiB2b2xh dGlsZSogX19teV9mcmVlX2xpc3QgPQogICAgICAgICAgICAgICAgX1NfZnJlZV9saXN0ICsgX1Nf ZnJlZWxpc3RfaW5kZXgoX19ieXRlc19sZWZ0KTsKCiAgICAgICAgICAgICAgKChfT2JqKilfU19z dGFydF9mcmVlKSAtPiBfTV9mcmVlX2xpc3RfbGluayA9ICpfX215X2ZyZWVfbGlzdDsKICAgICAg ICAgICAgICAqX19teV9mcmVlX2xpc3QgPSAoX09iaiopX1Nfc3RhcnRfZnJlZTsKICAgICAgICAg ICAgfQogICAgICAgICAgX1Nfc3RhcnRfZnJlZSA9IChjaGFyKikgX19uZXdfYWxsb2M6OmFsbG9j YXRlKF9fYnl0ZXNfdG9fZ2V0KTsKICAgICAgICAgIGlmIChfU19zdGFydF9mcmVlID09IDApCiAg ICAgICAgICAgIHsKICAgICAgICAgICAgICBzaXplX3QgX19pOwogICAgICAgICAgICAgIF9PYmoq IHZvbGF0aWxlKiBfX215X2ZyZWVfbGlzdDsKICAgICAgICAgICAgICBfT2JqKiBfX3A7CgoKCiAg ICAgICAgICAgICAgX19pID0gX19zaXplOwogICAgICAgICAgICAgIGZvciAoOyBfX2kgPD0gKHNp emVfdCkgX01BWF9CWVRFUzsgX19pICs9IChzaXplX3QpIF9BTElHTikKICAgICAgICAgICAgICAg IHsKICAgICAgICAgICAgICAgICAgX19teV9mcmVlX2xpc3QgPSBfU19mcmVlX2xpc3QgKyBfU19m cmVlbGlzdF9pbmRleChfX2kpOwogICAgICAgICAgICAgICAgICBfX3AgPSAqX19teV9mcmVlX2xp c3Q7CiAgICAgICAgICAgICAgICAgIGlmIChfX3AgIT0gMCkKICAgICAgICAgICAgICAgICAgICB7 CiAgICAgICAgICAgICAgICAgICAgICAqX19teV9mcmVlX2xpc3QgPSBfX3AgLT4gX01fZnJlZV9s aXN0X2xpbms7CiAgICAgICAgICAgICAgICAgICAgICBfU19zdGFydF9mcmVlID0gKGNoYXIqKV9f cDsKICAgICAgICAgICAgICAgICAgICAgIF9TX2VuZF9mcmVlID0gX1Nfc3RhcnRfZnJlZSArIF9f aTsKICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfU19jaHVua19hbGxvYyhfX3NpemUsIF9f bm9ianMpOwoKCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAg ICAgICAgIF9TX2VuZF9mcmVlID0gMDsKICAgICAgICAgICAgICBfU19zdGFydF9mcmVlID0gKGNo YXIqKV9fbmV3X2FsbG9jOjphbGxvY2F0ZShfX2J5dGVzX3RvX2dldCk7CgoKICAgICAgICAgICAg fQogICAgICAgICAgX1NfaGVhcF9zaXplICs9IF9fYnl0ZXNfdG9fZ2V0OwogICAgICAgICAgX1Nf ZW5kX2ZyZWUgPSBfU19zdGFydF9mcmVlICsgX19ieXRlc190b19nZXQ7CiAgICAgICAgICByZXR1 cm4gX1NfY2h1bmtfYWxsb2MoX19zaXplLCBfX25vYmpzKTsKICAgICAgICB9CiAgICB9CgoKCgoK ICB0ZW1wbGF0ZTxib29sIF9fdGhyZWFkcywgaW50IF9faW5zdD4KICAgIHZvaWQqCiAgICBfX2Rl ZmF1bHRfYWxsb2NfdGVtcGxhdGU8X190aHJlYWRzLCBfX2luc3Q+OjpfU19yZWZpbGwoc2l6ZV90 IF9fbikKICAgIHsKICAgICAgaW50IF9fbm9ianMgPSAyMDsKICAgICAgY2hhciogX19jaHVuayA9 IF9TX2NodW5rX2FsbG9jKF9fbiwgX19ub2Jqcyk7CiAgICAgIF9PYmoqIHZvbGF0aWxlKiBfX215 X2ZyZWVfbGlzdDsKICAgICAgX09iaiogX19yZXN1bHQ7CiAgICAgIF9PYmoqIF9fY3VycmVudF9v Ymo7CiAgICAgIF9PYmoqIF9fbmV4dF9vYmo7CiAgICAgIGludCBfX2k7CgogICAgICBpZiAoMSA9 PSBfX25vYmpzKQogICAgICAgIHJldHVybiBfX2NodW5rOwogICAgICBfX215X2ZyZWVfbGlzdCA9 IF9TX2ZyZWVfbGlzdCArIF9TX2ZyZWVsaXN0X2luZGV4KF9fbik7CgoKICAgICAgX19yZXN1bHQg PSAoX09iaiopX19jaHVuazsKICAgICAgKl9fbXlfZnJlZV9saXN0ID0gX19uZXh0X29iaiA9IChf T2JqKikoX19jaHVuayArIF9fbik7CiAgICAgIGZvciAoX19pID0gMTsgOyBfX2krKykKICAgICAg ICB7CiAgICAgICAgICBfX2N1cnJlbnRfb2JqID0gX19uZXh0X29iajsKICAgICAgICAgIF9fbmV4 dF9vYmogPSAoX09iaiopKChjaGFyKilfX25leHRfb2JqICsgX19uKTsKICAgICAgICAgIGlmIChf X25vYmpzIC0gMSA9PSBfX2kpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICBfX2N1cnJlbnRf b2JqIC0+IF9NX2ZyZWVfbGlzdF9saW5rID0gMDsKICAgICAgICAgICAgICBicmVhazsKICAgICAg ICAgICAgfQogICAgICAgICAgZWxzZQogICAgICAgICAgICBfX2N1cnJlbnRfb2JqIC0+IF9NX2Zy ZWVfbGlzdF9saW5rID0gX19uZXh0X29iajsKICAgICAgICB9CiAgICAgIHJldHVybiBfX3Jlc3Vs dDsKICAgIH0KCgoKICB0ZW1wbGF0ZTxib29sIHRocmVhZHMsIGludCBpbnN0PgogICAgdm9pZCoK ICAgIF9fZGVmYXVsdF9hbGxvY190ZW1wbGF0ZTx0aHJlYWRzLCBpbnN0Pjo6CiAgICByZWFsbG9j YXRlKHZvaWQqIF9fcCwgc2l6ZV90IF9fb2xkX3N6LCBzaXplX3QgX19uZXdfc3opCiAgICB7CiAg ICAgIHZvaWQqIF9fcmVzdWx0OwogICAgICBzaXplX3QgX19jb3B5X3N6OwoKICAgICAgaWYgKF9f b2xkX3N6ID4gKHNpemVfdCkgX01BWF9CWVRFUyAmJiBfX25ld19zeiA+IChzaXplX3QpIF9NQVhf QllURVMpCiAgICAgICAgcmV0dXJuKHJlYWxsb2MoX19wLCBfX25ld19zeikpOwogICAgICBpZiAo X1Nfcm91bmRfdXAoX19vbGRfc3opID09IF9TX3JvdW5kX3VwKF9fbmV3X3N6KSkKICAgICAgICBy ZXR1cm4oX19wKTsKICAgICAgX19yZXN1bHQgPSBhbGxvY2F0ZShfX25ld19zeik7CiAgICAgIF9f Y29weV9zeiA9IF9fbmV3X3N6ID4gX19vbGRfc3o/IF9fb2xkX3N6IDogX19uZXdfc3o7CiAgICAg IG1lbWNweShfX3Jlc3VsdCwgX19wLCBfX2NvcHlfc3opOwogICAgICBkZWFsbG9jYXRlKF9fcCwg X19vbGRfc3opOwogICAgICByZXR1cm4gX19yZXN1bHQ7CiAgICB9CgogIHRlbXBsYXRlPGJvb2wg X190aHJlYWRzLCBpbnQgX19pbnN0PgogICAgX1NUTF9tdXRleF9sb2NrCiAgICBfX2RlZmF1bHRf YWxsb2NfdGVtcGxhdGU8X190aHJlYWRzLF9faW5zdD46Ol9TX25vZGVfYWxsb2NhdG9yX2xvY2sK ICAgID0geyB7MCwgMCwgMCwgUFRIUkVBRF9NVVRFWF9USU1FRF9OUCwgeyAwLCAwIH19IH07Cgog IHRlbXBsYXRlPGJvb2wgX190aHJlYWRzLCBpbnQgX19pbnN0PgogICAgY2hhciogX19kZWZhdWx0 X2Fsb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Ghyb3coKSB7IHJldHVybiBfTV9wdHI7IH0KIyAyOTUg Ii91c3IvaW5jbHVkZS9nKysvbWVtb3J5IiAzCiAgZWxlbWVudF90eXBlKgogIGdldCgpIGNvbnN0 IHRocm93KCkgeyByZXR1cm4gX01fcHRyOyB9CiMgMzA5ICIvdXNyL2luY2x1ZGUvZysrL21lbW9y eSIgMwogIGVsZW1lbnRfdHlwZSoKICByZWxlYXNlKCkgdGhyb3coKQogICAgewogICAgICBlbGVt ZW50X3R5cGUqIF9fdG1wID0gX01fcHRyOwogICAgICBfTV9wdHIgPSAwOwogICAgICByZXR1cm4g X190bXA7CiAgICB9CiMgMzI0ICIvdXNyL2luY2x1ZGUvZysrL21lbW9yeSIgMwogIHZvaWQKICBy ZXNldChlbGVtZW50X3R5cGUqIF9fcCA9IDApIHRocm93KCkKICAgIHsKICAgICAgaWYgKF9fcCAh PSBfTV9wdHIpCiAgICAgICAgewogICAgICAgICAgZGVsZXRlIF9NX3B0cjsKICAgICAgICAgIF9N X3B0ciA9IF9fcDsKICAgICAgICB9CiAgICB9CiMgMzQ1ICIvdXNyL2luY2x1ZGUvZysrL21lbW9y eSIgMwogIGF1dG9fcHRyKGF1dG9fcHRyX3JlZjxlbGVtZW50X3R5cGU+IF9fcmVmKSB0aHJvdygp CiAgICA6IF9NX3B0cihfX3JlZi5fTV9wdHIpIHt9CgogIGF1dG9fcHRyJgogIG9wZXJhdG9yPShh dXRvX3B0cl9yZWY8ZWxlbWVudF90eXBlPiBfX3JlZikgdGhyb3coKQogICAgewogICAgICBpZiAo X19yZWYuX01fcHRyICE9IHRoaXMtPmdldCgpKQogICAgICAgIHsKICAgICAgICAgIGRlbGV0ZSBf TV9wdHI7CiAgICAgICAgICBfTV9wdHIgPSBfX3JlZi5fTV9wdHI7CiAgICAgICAgfQogICAgICBy ZXR1cm4gKnRoaXM7CiAgICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9UcDE+CiAgICBvcGVyYXRv ciBhdXRvX3B0cl9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gICAgICAgX0NoYXJUKgogICAgICAgIF9NX3JlZmRhdGEoKSB0aHJvdygpCiAgICAg ICAgeyByZXR1cm4gcmVpbnRlcnByZXRfY2FzdDxfQ2hhclQqPih0aGlzICsgMSk7IH0KCiAgICAg ICAgX0NoYXJUJgogICAgICAgIG9wZXJhdG9yW10oc2l6ZV90IF9fcykgdGhyb3coKQogICAgICAg IHsgcmV0dXJuIF9NX3JlZmRhdGEoKSBbX19zXTsgfQoKICAgICAgICBfQ2hhclQqCiAgICAgICAg X01fZ3JhYihjb25zdCBfQWxsb2MmIF9fYWxsb2MxLCBjb25zdCBfQWxsb2MmIF9fYWxsb2MyKQog ICAgICAgIHsKICAgICAgICAgIHJldHVybiAoIV9NX2lzX2xlYWtlZCgpICYmIF9fYWxsb2MxID09 IF9fYWxsb2MyKQogICAgICAgICAgICAgICAgICA/IF9NX3JlZmNvcHkoKSA6IF9NX2Nsb25lKF9f YWxsb2MxKTsKICAgICAgICB9CgoKICAgICAgICBzdGF0aWMgX1JlcCoKICAgICAgICBfU19jcmVh dGUoc2l6ZV90LCBjb25zdCBfQWxsb2MmKTsKCiAgICAgICAgdm9pZAogICAgICAgIF9NX2Rpc3Bv c2UoY29uc3QgX0FsbG9jJiBfX2EpCiAgICAgICAgewogICAgICAgICAgaWYgKF9fZXhjaGFuZ2Vf YW5kX2FkZCgmX01fcmVmZXJlbmNlcywgLTEpIDw9IDApCiAgICAgICAgICAgIF9NX2Rlc3Ryb3ko X19hKTsKICAgICAgICB9CgogICAgICAgIHZvaWQKICAgICAgICBfTV9kZXN0cm95KGNvbnN0IF9B bGxvYyYpIHRocm93KCk7CgogICAgICAgIF9DaGFyVCoKICAgICAgICBfTV9yZWZjb3B5KCkgdGhy b3coKQogICAgICAgIHsKICAgICAgICAgIF9fYXRvbWljX2FkZCgmX01fcmVmZXJlbmNlcywgMSk7 CiAgICAgICAgICByZXR1cm4gX01fcmVmZGF0YSgpOwogICAgICAgIH0KCiAgICAgICAgX0NoYXJU Kgog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KCiAgICAgIGl0ZXJhdG9yCiAgICAgIF9NX2llbmQoKSBj b25zdCB7IHJldHVybiBpdGVyYXRvcihfTV9kYXRhKCkgKyB0aGlzLT5zaXplKCkpOyB9CgogICAg ICB2b2lkCiAgICAgIF9NX2xlYWsoKQogICAgICB7CiAgICAgICAgaWYgKCFfTV9yZXAoKS0+X01f aXNfbGVha2VkKCkpCiAgICAgICAgICBfTV9sZWFrX2hhcmQoKTsKICAgICAgfQoKICAgICAgaXRl cmF0b3IKICAgICAgX01fY2hlY2soc2l6ZV90eXBlIF9fcG9zKSBjb25zdAogICAgICB7CiAgICAg ICAgaWYgKF9fcG9zID4gdGhpcy0+c2l6ZSgpKQogICAgICAgICAgX190aHJvd19vdXRfb2ZfcmFu Z2UoImJhc2ljX3N0cmluZzo6X01fY2hlY2siKTsKICAgICAgICByZXR1cm4gX01faWJlZ2luKCkg KyBfX3BvczsKICAgICAgfQoKCiAgICAgIGl0ZXJhdG9yCiAgICAgIF9NX2ZvbGQoc2l6ZV90eXBl IF9fcG9zLCBzaXplX3R5cGUgX19vZmYpIGNvbnN0CiAgICAgIHsKICAgICAgICBib29sIF9fdGVz dG9mZiA9IF9fb2ZmIDwgdGhpcy0+c2l6ZSgpIC0gX19wb3M7CiAgICAgICAgc2l6ZV90eXBlIF9f bmV3b2ZmID0gX190ZXN0b2ZmID8gX19vZmYgOiB0aGlzLT5zaXplKCkgLSBfX3BvczsKICAgICAg ICByZXR1cm4gKF9NX2liZWdpbigpICsgX19wb3MgKyBfX25ld29mZik7CiAgICAgIH0KCgoKICAg ICAgdGVtcGxhdGU8Y2xhc3MgX0l0ZXJhdG9yPgogICAgICAgIHN0YXRpYyB2b2lkCiAgICAgICAg X1NfY29weV9jaGFycyhfQ2hhclQqIF9fcCwgX0l0ZXJhdG9yIF9fazEsIF9JdGVyYXRvciBfX2sy KQogICAgICAgIHsKICAgICAgICAgIGZvciAoOyBfX2sxICE9IF9fazI7ICsrX19rMSwgKytfX3Ap CiAgICAgIC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cm4gdGhpcy0+c2l6ZSgpID09IDA7IH0KCgogICAgICBj b25zdF9yZWZlcmVuY2UKICAgICAgb3BlcmF0b3JbXSAoc2l6ZV90eXBlIF9fcG9zKSBjb25zdAog ICAgICB7IHJldHVybiBfTV9kYXRhKClbX19wb3NdOyB9CgogICAgICByZWZlcmVuY2UKICAgICAg b3BlcmF0b3JbXShzaXplX3R5cGUgX19wb3MpCiAgICAgIHsKICAgICAgICBfTV9sZWFrKCk7CiAg ICAgICAgcmV0dXJuIF9NX2RhdGEoKVtfX3Bvc107CiAgICAgIH0KCiAgICAgIGNvbnN0X3JlZmVy ZW5jZQogICAgICBhdChzaXplX3R5cGUgX19uKSBjb25zdAogICAgICB7CiAgICAgICAgaWYgKF9f biA+PSB0aGlzLT5zaXplKCkpCiAgICAgICAgICBfX3Rocm93X291dF9vZl9yYW5nZSgiYmFzaWNf c3RyaW5nOjphdCIpOwogICAgICAgIHJldHVybiBfTV9kYXRhKClbX19uXTsKICAgICAgfQoKICAg ICAgcmVmZXJlbmNlCiAgICAgIGF0KHNpemVfdHlwZSBfX24pCiAgICAgIHsKICAgICAgICBpZiAo X19uID49IHNpemUoKSkKICAgICAgICAgIF9fdGhyb3dfb3V0X29mX3JhbmdlKCJiYXNpY19zdHJp bmc6OmF0Iik7CiAgICAgICAgX01fbGVhaygpOwogICAgICAgIHJldHVybiBfTV9kYXRhKClbX19u XTsKICAgICAgfQoKCiAgICAgIGJhc2ljX3N0cmluZyYKICAgICAgb3BlcmF0b3IrPShjb25zdCBi YXNpY19zdHJpbmcmIF9fc3RyKSB7IHJldHVybiB0aGlzLT5hcHBlbmQoX19zdHIpOyB9CgogICAg ICBiYXNpY19zdHJpbmcmCiAgICAgIG9wZXJhdG9yKz0oY29uc3QgX0NoYXJUKiBfX3MpIHsgcmV0 dXJuIHRoaXMtPmFwcGVuZChfX3MpOyB9CgogICAgICBiYXNpY19zdHJpbmcmCiAgICAgIG9wZXJh dG9yKz0oX0NoYXJUIF9fYykgeyBy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vbnN0 IGJhc2ljX3N0cmluZyYgX19zdHIsIHNpemVfdHlwZSBfX3Bvcywgc2l6ZV90eXBlIF9fbikKICAg ICAgewogICAgICAgIGNvbnN0IHNpemVfdHlwZSBfX3N0cnNpemUgPSBfX3N0ci5zaXplKCk7CiAg ICAgICAgaWYgKF9fcG9zID4gX19zdHJzaXplKQogICAgICAgICAgX190aHJvd19vdXRfb2ZfcmFu Z2UoImJhc2ljX3N0cmluZzo6YXNzaWduIik7CiAgICAgICAgY29uc3QgYm9vbCBfX3Rlc3RuID0g X19uIDwgX19zdHJzaXplIC0gX19wb3M7CiAgICAgICAgY29uc3Qgc2l6ZV90eXBlIF9fbmV3c2l6 ZSA9IF9fdGVzdG4gPyBfX24gOiBfX3N0cnNpemUgLSBfX3BvczsKICAgICAgICByZXR1cm4gdGhp cy0+YXNzaWduKF9fc3RyLl9NX2RhdGEoKSArIF9fcG9zLCBfX25ld3NpemUpOwogICAgICB9Cgog ICAgICBiYXNpY19zdHJpbmcmCiAgICAgIGFzc2lnbihjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90 eXBlIF9fbikKICAgICAgewogICAgICAgIGlmIChfX24gPiB0aGlzLT5tYXhfc2l6ZSgpKQogICAg ICAgICAgX190aHJvd19sZW5ndGhfZXJyb3IoImJhc2ljX3N0cmluZzo6YXNzaWduIik7CiAgICAg ICAgaWYgKF9NX3JlcCgpLT5fTV9pc19zaGFyZWQoKSB8fCBsZXNzPGNvbnN0IF9DaGFyVCo+KCko X19zLCBfTV9kYXRhKCkpCiAgICAgICAgICAgIHx8IGxlc3M8Y29uc3QgX0NoYXJUKj4oKShfTV9k YXRhKCkgKyB0aGlzLT5zaXplKCksIF9fcykpCiAgICAgICAgICByZXR1cm4gX01fcmVwbGFjZV9z YWZlKF9NX2liZWdpbigpLCBfTV9pZW5kKCksIF9fcywgX19zICsgX19uKTsKICAgICAgICBlbHNl CiAgICAgICAgICB7CgogICAgICAgICAgICBjb25zdCBzaXplX3R5cGUgX19wb3MgPSBfX3MgLSBf TV9kYXRhKCk7CiAgICAgICAgICAgIGlmIChfX3BvcyA+PSBfX24pCiAgICAgICAgICAgICAgdHJh aXRzX3R5cGU6OmNvcHkoX01fZGF0YSgpLCBfX3MsIF9fbik7CiAgICAgICAgICAgIGVsc2UgaWYg KF9fcG9zKQogICAgICAgICAgICAgIHRyYWl0c190eXBlOjptb3ZlKF9NX2RhdGEoKSwgX19zLCBf X24pOwogICAgICAgICAgICBfTV9yZXAoKS0+X01fbGVuZ3RoID0gX19uOwogICAgICAgICAgICBf TV9kYXRhKClbX19uXSA9IF9SZXA6Ol9TX3Rlcm1pbmFsOwogICAgICAgICAgICByZXR1cm4gKnRo aXM7CiAgICAgICAgICB9CiAgICAgIH0KCiAgICAgIGJhc2ljX3N0cmluZyYKICAgICAgYXNzaWdu KGNvbnN0IF9DaGFyVCogX19zKQogICAgICB7IHJldHVybiB0aGlzLT5hc3NpZ24oX19zLCB0cmFp dHNfdHlwZTo6bGVuZ3RoKF9fcykpOyB9CgogICAgICBiYXNpY19zdHJpbmcmCiAgICAgIGFzc2ln bihzaXplX3R5cGUgX19uLCBfQ2hhclQgX19jKQogICAgICB7IHJldHVybiB0aGlzLT5yZXBsYWNl KF9NX2liZWdpbigpLCBfTV9pZW5kKCksIF9fbiwgX19jKTsgfQoKICAgICAgdGVtcGxhdGU8Y2xh c3MgX0lucHV0SXRlcmF0b3I+CiAgICAgICAgYmFzaWNfc3RyaW5nJgogICAgICAgIGFzc2lnbihf SW5wdXRJdGVyYXRvciBfX2ZpcnN0LCBfSW5wdXRJdGVyYXRvciBfX2xhc3QpCiAgICAgICAgeyBy ZXR1cm4gdGhpcy0+cmVwbGFjZShfTV9pYmVnaW4oKSwgX01faWVuZCgpLCBfX2ZpcnN0LCBfX2xh c3QpOyB9CgogICAgICB2b2lkCiAgICAgIGluc2VydChpdGVyYXRvciBfX3AsIHNpemVfdHlwZSBf X24sIF9DaGFyVCBfX2MpCiAgICAgIHsgdGhpcy0+cm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XNpY19zdHJpbmcmCiAgICAgIGluc2VydChzaXplX3R5cGUgX19wb3MsIGNvbnN0IF9DaGFy VCogX19zLCBzaXplX3R5cGUgX19uKQogICAgICB7CiAgICAgICAgY29uc3Qgc2l6ZV90eXBlIF9f c2l6ZSA9IHRoaXMtPnNpemUoKTsKICAgICAgICBpZiAoX19wb3MgPiBfX3NpemUpCiAgICAgICAg ICBfX3Rocm93X291dF9vZl9yYW5nZSgiYmFzaWNfc3RyaW5nOjppbnNlcnQiKTsKICAgICAgICBp ZiAoX19zaXplID4gdGhpcy0+bWF4X3NpemUoKSAtIF9fbikKICAgICAgICAgIF9fdGhyb3dfbGVu Z3RoX2Vycm9yKCJiYXNpY19zdHJpbmc6Omluc2VydCIpOwogICAgICAgIGlmIChfTV9yZXAoKS0+ X01faXNfc2hhcmVkKCkgfHwgbGVzczxjb25zdCBfQ2hhclQqPigpKF9fcywgX01fZGF0YSgpKQog ICAgICAgICAgICB8fCBsZXNzPGNvbnN0IF9DaGFyVCo+KCkoX01fZGF0YSgpICsgX19zaXplLCBf X3MpKQogICAgICAgICAgcmV0dXJuIF9NX3JlcGxhY2Vfc2FmZShfTV9pYmVnaW4oKSArIF9fcG9z LCBfTV9pYmVnaW4oKSArIF9fcG9zLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBf X3MsIF9fcyArIF9fbik7CiAgICAgICAgZWxzZQogICAgICAgICAgewoKCgogICAgICAgICAgICBj b25zdCBzaXplX3R5cGUgX19vZmYgPSBfX3MgLSBfTV9kYXRhKCk7CiAgICAgICAgICAgIF9NX211 dGF0ZShfX3BvcywgMCwgX19uKTsKICAgICAgICAgICAgX19zID0gX01fZGF0YSgpICsgX19vZmY7 CiAgICAgICAgICAgIF9DaGFyVCogX19wID0gX01fZGF0YSgpICsgX19wb3M7CiAgICAgICAgICAg IGlmIChfX3MgKyBfX24gPD0gX19wKQogICAgICAgICAgICAgIHRyYWl0c190eXBlOjpjb3B5KF9f cCwgX19zLCBfX24pOwogICAgICAgICAgICBlbHNlIGlmIChfX3MgPj0gX19wKQogICAgICAgICAg ICAgIHRyYWl0c190eXBlOjpjb3B5KF9fcCwgX19zICsgX19uLCBfX24pOwogICAgICAgICAgICBl bHNlCiAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdHJhaXRzX3R5cGU6OmNvcHkoX19w LCBfX3MsIF9fcCAtIF9fcyk7CiAgICAgICAgICAgICAgICB0cmFpdHNfdHlwZTo6Y29weShfX3Ag KyAoX19wIC0gX19zKSwgX19wICsgX19uLCBfX24gLSAoX19wIC0gX19zKSk7CiAgICAgICAgICAg ICAgfQogICAgICAgICAgICByZXR1cm4gKnRoaXM7CiAgICAgICAgICB9CiAgICAgICB9CgogICAg ICBiYXNpY19zdHJpbmcmCiAgICAgIGluc2VydChzaXplX3R5cGUgX19wb3MsIGNvbnN0IF9DaGFy VCogX19zKQogICAgICB7IHJldHVybiB0aGlzLT5pbnNlcnQoX19wb3MsIF9fcywgdHJhaXRzX3R5 cGU6Omxlbmd0aChfX3MpKTsgfQoKICAgICAgYmFzaWNfc3RyaW5nJgogICAgICBpbnNlcnQoc2l6 ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uLCBfQ2hhclQgX19jKQogICAgICB7CiAgICAgICAg dGhpcy0+aW5zZXJ0KF9NX2NoZWNrKF9fcG9zKSwgX19uLCBfX2MpOwogICAgICAgIHJldHVybiAq dGhpczsKICAgICAgfQoKICAgICAgaXRlcmF0b3IKICAgICAgaW5zZXJ0KGl0ZXJhdG9yIF9fcCwg X0NoYXJUIF9fYyA9IF9DaGFyVCgpKQogICAgICB7CiAgICAgICAgc2l6ZV90eXBlIF9fcG9zID0g X19wIC0gX01faWJlZ2luKCk7CiAgICAgICAgdGhpcy0+aW5zZXJ0KF9NX2NoZWNrKF9fcG9zKSwg c2l6ZV90eXBlKDEpLCBfX2MpOwogICAgICAgIF9NX3JlcCgpLT5fTV9zZXRfbGVha2VkKCk7CiAg ICAgICAgcmV0dXJuIHRoaXMtPl9NX2liZWdpbigpICsgX19wb3M7CiAgICAgIH0KCiAgICAgIGJh c2ljX3N0cmluZyYKICAgICAgZXJhc2Uoc2l6ZV90eXBlIF9fcG9zID0gMCwgc2l6ZV90eXBlIF9f biA9IG5wb3MpCiAgICAgIHsKICAgICAgICByZXR1cm4gdGhpcy0+cmVwbGFjZShfTV9jaGVjayhf X3BvcyksIF9NX2ZvbGQoX19wb3MsIF9fbiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg X01fZGF0YSgpLCBfTV9kYXRhKCkpOwogICAgICB9CgogICAgICBpdGVyYXRvcgogICAgICBlcmFz ZShpdGVyYXRvciBfX3Bvc2l0aW9uKQogICAgICB7CiAgICAgICAgc2l6ZV90eXBlIF9faSA9IF9f cG9zaXRpb24gLSBfTV9pYmVnaW4oKTsKICAgICAgICB0aGlzLT5yZXBsYWNlKF9fcG9zaXRpb24s IF9fcG9zaXRpb24gKyAxLCBfTV9kYXRhKCksIF9NX2RhdGEoKSk7CiAgICAgICAgX01fcmVwKCkt Pl9NX3NldF9sZWFrZWQoKTsKICAgICAgICByZXR1cm4gX01faWJlZ2luKCkgKyBfX2k7CiAgICAg IH0KCiAgICAgIGl0ZXJhdG9yCiAgICAgIGVyYXNlKGl0ZXJhdG9yIF9fZmlyc3QsIGl0ZXJhdG9y IF9fbGFzdCkKICAgICAgewogICAgICAgIHNpemVfdHlwZSBfX2kgPSBfX2ZpcnN0IC0gX01faWJl Z2luKCk7CiAgICAgICAgdGhpcy0+cmVwbGFjZShfX2ZpcnN0LCBfX2xhc3QsIF9NX2RhdGEoKSwg X01fZGF0YSgpKTsKICAgICAgICBfTV9yZXAoKS0+X01fc2V0X2xlYWtlZCgpOwogICAgICAgcmV0 dXJuIF9NX2liZWdpbigpICsgX19pOwogICAgICB9CgogICAgICBiYXNpY19zdHJpbmcmCiAgICAg IHJlcGxhY2Uoc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uLCBjb25zdCBiYXNpY19zdHJp bmcmIF9fc3RyKQogICAgICB7IHJldHVybiB0aGlzLT5yZXBsYWNlKF9fcG9zLCBfX24sIF9fc3Ry Ll9NX2RhdGEoKSwgX19zdHIuc2l6ZSgpKTsgfQoKICAgICAgYmFzaWNfc3RyaW5nJgogICAgICBy ZXBsYWNlKHNpemVfdHlwZSBfX3BvczEsIHNpemVfdHlwZSBfX24xLCBjb25zdCBiYXNpY19zdHJp bmcmIF9fc3RyLAogICAgICAgICAgICAgIHNpemVfdHlwZSBfX3BvczIsIHNpemVfdHlwZSBfX24y KTsKCiAgICAgIGJhc2ljX3N0cmluZyYKICAgICAgcmVwbGFjZShzaXplX3R5cGUgX19wb3MsIHNp emVfdHlwZSBfX24xLCBjb25zdCBfQ2hhclQqIF9fcywKICAgICAgICAgICAgICBzaXplX3R5cGUg X19uMikKICAgICAgewogICAgICAgIGNvbnN0IHNpemVfdHlwZSBfX3NpemUgPSB0aGlzLT5zaXpl KCk7CiAgICAgICAgaWYgKF9fcG9zID4gX19zaXplKQogICAgICAgICAgX190aHJvd19vdXRfb2Zf cmFuZ2UoImJhc2ljX3N0cmluZzo6cmVwbGFjZSIpOwogICAgICAgIGNvbnN0IGJvb2wgX190ZXN0 bjEgPSBfX24xIDwgX19zaXplIC0gX19wb3M7CiAgICAgICAgY29uc3Qgc2l6ZV90eXBlIF9fZm9s ZG4xID0gX190ZXN0bjEgPyBfX24xIDogX19zaXplIC0gX19wb3M7CiAgICAgICAgaWYgKF9fc2l6 ZSAtIF9fZm9sZG4xID4gdGhpcy0+bWF4X3NpemUoKSAtIF9fbjIpCiAgICAgICAgICBfX3Rocm93 X2xlbmd0aF9lcnJvcigiYmFzaWNfc3RyaW5nOjpyZXBsYWNlIik7CiAgICAgICAgaWYgKF9NX3Jl cCgpLT5fTV9pc19zaGFyZWQoKSB8fCBsZXNzPGNvbnN0IF9DaGFyVCo+KCkoX19zLCBfTV9kYXRh KCkpCiAgICAgICAgICAgIHx8IGxlc3M8Y29uc3QgX0NoYXJUKj4oKShfTV9kYXRhKCkgKyBfX3Np emUsIF9fcykpCiAgICAgICAgICByZXR1cm4gX01fcmVwbGFjZV9zYWZlKF9NX2liZWdpbigpICsg X19wb3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9NX2liZWdpbigpICsgX19w b3MgKyBfX2ZvbGRuMSwgX19zLCBfX3MgKyBfX24yKTsKCiAgICAgICAgZWxzZSByZXR1cm4KICAg ICAgICAgICAgICAgX01fcmVwbGFjZShfTV9pYmVnaW4oKSArIF9fcG9zLCBfTV9pYmVnaW4oKSAr IF9fcG9zICsgX19mb2xkbjEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgX19zLCBfX3MgKyBf X24yLAogICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVuYW1lIGl0ZXJhdG9yX3RyYWl0czxj b25zdCBfQ2hhclQqPjo6aXRlcmF0b3JfY2F0ZWdvcnkoKSk7CiAgICAgIH0KCiAgICAgIGJhc2lj X3N0cmluZyYKICAgICAgcmVwbGFjZShzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX24xLCBj b25zdCBfQ2hhclQqIF9fcykKICAgICAgeyByZXR1cm4gdGhpcy0+cmVwbGFjZShfX3BvcywgX19u MSwgX19zLCB0cmFpdHNfdHlwZTo6bGVuZ3RoKF9fcykpOyB9CgogICAgICBiYXNpY19zdHJpbmcm CiAgICAgIHJlcGxhY2Uoc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uMSwgc2l6ZV90eXBl IF9fbjIsIF9DaGFyVCBfX2MpCiAgICAgIHsgcmV0dXJuIHRoaXMtPnJlcGxhY2UoX01fY2hlY2so X19wb3MpLCBfTV9mb2xkKF9fcG9zLCBfX24xKSwgX19uMiwgX19jKTsgfQoKICAgICAgYmFzaWNf c3RyaW5nJgogICAgICByZXBsYWNlKGl0ZXJhdG9yIF9faTEsIGl0ZXJhdG9yIF9faTIsIGNvbnN0 IGJhc2ljX3N0cmluZyYgX19zdHI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gICBi YXNpY19zdHJpbmcmCiAgICAgIHJlcGxhY2UoaXRlcmF0b3IgX19pMSwgaXRlcmF0b3IgX19pMiwg X0NoYXJUKiBfX2sxLCBfQ2hhclQqIF9fazIpCiAgICAgICAgeyByZXR1cm4gdGhpcy0+cmVwbGFj ZShfX2kxIC0gX01faWJlZ2luKCksIF9faTIgLSBfX2kxLAogICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgX19rMSwgX19rMiAtIF9fazEpOyB9CgogICAgICBiYXNpY19zdHJpbmcmCiAgICAg IHJlcGxhY2UoaXRlcmF0b3IgX19pMSwgaXRlcmF0b3IgX19pMiwgY29uc3QgX0NoYXJUKiBfX2sx LCBjb25zdCBfQ2hhclQqIF9fazIpCiAgICAgICAgeyByZXR1cm4gdGhpcy0+cmVwbGFjZShfX2kx IC0gX01faWJlZ2luKCksIF9faTIgLSBfX2kxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgX19rMSwgX19rMiAtIF9fazEpOyB9CgogICAgICBiYXNpY19zdHJpbmcmCiAgICAgIHJlcGxh Y2UoaXRlcmF0b3IgX19pMSwgaXRlcmF0b3IgX19pMiwgaXRlcmF0b3IgX19rMSwgaXRlcmF0b3Ig X19rMikKICAgICAgICB7IHJldHVybiB0aGlzLT5yZXBsYWNlKF9faTEgLSBfTV9pYmVnaW4oKSwg X19pMiAtIF9faTEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX2sxLmJhc2UoKSwg X19rMiAtIF9fazEpOwogICAgICAgIH0KCiAgICAgIGJhc2ljX3N0cmluZyYKICAgICAgcmVwbGFj ZShpdGVyYXRvciBfX2kxLCBpdGVyYXRvciBfX2kyLCBjb25zdF9pdGVyYXRvciBfX2sxLCBjb25z dF9pdGVyYXRvciBfX2syKQogICAgICAgIHsgcmV0dXJuIHRoaXMtPnJlcGxhY2UoX19pMSAtIF9N X2liZWdpbigpLCBfX2kyIC0gX19pMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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gICAgICAgICAg ICAgICAgIGZvcndhcmRfaXRlcmF0b3JfdGFnKTsKCiAgICAgIHN0YXRpYyBfQ2hhclQqCiAgICAg IF9TX2NvbnN0cnVjdChzaXplX3R5cGUgX19yZXEsIF9DaGFyVCBfX2MsIGNvbnN0IF9BbGxvYyYg X19hKTsKCiAgICBwdWJsaWM6CgogICAgICBzaXplX3R5cGUKICAgICAgY29weShfQ2hhclQqIF9f cywgc2l6ZV90eXBlIF9fbiwgc2l6ZV90eXBlIF9fcG9zID0gMCkgY29uc3Q7CgogICAgICB2b2lk CiAgICAgIHN3YXAoYmFzaWNfc3RyaW5nPF9DaGFyVCwgX1RyYWl0cywgX0FsbG9jPiYgX19zKTsK CgogICAgICBjb25zdCBfQ2hhclQqCiAgICAgIGNfc3RyKCkgY29uc3QKICAgICAgewoKICAgICAg ICBzaXplX3R5cGUgX19uID0gdGhpcy0+c2l6ZSgpOwogICAgICAgIHRyYWl0c190eXBlOjphc3Np Z24oX01fZGF0YSgpW19fbl0sIF9SZXA6Ol9TX3Rlcm1pbmFsKTsKICAgICAgICByZXR1cm4gX01f ZGF0YSgpOwogICAgICB9CgogICAgICBjb25zdCBfQ2hhclQqCiAgICAgIGRhdGEoKSBjb25zdCB7 IHJldHVybiBfTV9kYXRhKCk7IH0KCiAgICAgIGFsbG9jYXRvcl90eXBlCiAgICAgIGdldF9hbGxv Y2F0b3IoKSBjb25zdCB7IHJldHVybiBfTV9kYXRhcGx1czsgfQoKICAgICAgc2l6ZV90eXBlCiAg ICAgIGZpbmQoY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX3Bvcywgc2l6ZV90eXBlIF9f bikgY29uc3Q7CgogICAgICBzaXplX3R5cGUKICAgICAgZmluZChjb25zdCBiYXNpY19zdHJpbmcm IF9fc3RyLCBzaXplX3R5cGUgX19wb3MgPSAwKSBjb25zdAogICAgICB7IHJldHVybiB0aGlzLT5m aW5kKF9fc3RyLmRhdGEoKSwgX19wb3MsIF9fc3Ry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R5cGUKICAgICAgZmluZF9sYXN0X25vdF9vZihjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90eXBl IF9fcG9zLAogICAgICAgICAgICAgICAgICAgICAgIHNpemVfdHlwZSBfX24pIGNvbnN0OwogICAg ICBzaXplX3R5cGUKICAgICAgZmluZF9sYXN0X25vdF9vZihjb25zdCBfQ2hhclQqIF9fcywgc2l6 ZV90eXBlIF9fcG9zID0gbnBvcykgY29uc3QKICAgICAgeyByZXR1cm4gdGhpcy0+ZmluZF9sYXN0 X25vdF9vZihfX3MsIF9fcG9zLCB0cmFpdHNfdHlwZTo6bGVuZ3RoKF9fcykpOyB9CgogICAgICBz aXplX3R5cGUKICAgICAgZmluZF9sYXN0X25vdF9vZihfQ2hhclQgX19jLCBzaXplX3R5cGUgX19w b3MgPSBucG9zKSBjb25zdDsKCiAgICAgIGJhc2ljX3N0cmluZwogICAgICBzdWJzdHIoc2l6ZV90 eXBlIF9fcG9zID0gMCwgc2l6ZV90eXBlIF9fbiA9IG5wb3MpIGNvbnN0CiAgICAgIHsKICAgICAg ICBpZiAoX19wb3MgPiB0aGlzLT5zaXplKCkpCiAgICAgICAgICBfX3Rocm93X291dF9vZl9yYW5n ZSgiYmFzaWNfc3RyaW5nOjpzdWJzdHIiKTsKICAgICAgICByZXR1cm4gYmFzaWNfc3RyaW5nKCp0 aGlzLCBfX3BvcywgX19uKTsKICAgICAgfQoKICAgICAgaW50CiAgICAgIGNvbXBhcmUoY29uc3Qg YmFzaWNfc3RyaW5nJiBfX3N0cikgY29uc3QKICAgICAgewogICAgICAgIHNpemVfdHlwZSBfX3Np emUgPSB0aGlzLT5zaXplKCk7CiAgICAgICAgc2l6ZV90eXBlIF9fb3NpemUgPSBfX3N0ci5zaXpl KCk7CiAgICAgICAgc2l6ZV90eXBlIF9fbGVuID0gbWluKF9fc2l6ZSwgX19vc2l6ZSk7CgogICAg ICAgIGludCBfX3IgPSB0cmFpdHNfdHlwZTo6Y29tcGFyZShfTV9kYXRhKCksIF9fc3RyLmRhdGEo KSwgX19sZW4pOwogICAgICAgIGlmICghX19yKQogICAgICAgICAgX19yID0gX19zaXplIC0gX19v c2l6ZTsKICAgICAgICByZXR1cm4gX19yOwogICAgICB9CgogICAgICBpbnQKICAgICAgY29tcGFy ZShzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX24sIGNvbnN0IGJhc2ljX3N0cmluZyYgX19z dHIpIGNvbnN0OwoKICAgICAgaW50CiAgICAgIGNvbXBhcmUoc2l6ZV90eXBlIF9fcG9zMSwgc2l6 ZV90eXBlIF9fbjEsIGNvbnN0IGJhc2ljX3N0cmluZyYgX19zdHIsCiAgICAgICAgICAgICAgc2l6 ZV90eXBlIF9fcG9zMiwgc2l6ZV90eXBlIF9fbjIpIGNvbnN0OwoKICAgICAgaW50CiAgICAgIGNv bXBhcmUoY29uc3QgX0NoYXJUKiBfX3MpIGNvbnN0OwoKCgogICAgICBpbnQKICAgICAgY29tcGFy ZShzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX24xLCBjb25zdCBfQ2hhclQqIF9fcykgY29u c3Q7CgogICAgICBpbnQKICAgICAgY29tcGFyZShzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBf X24xLCBjb25zdCBfQ2hhclQqIF9fcywKICAgICAgICAgICAgICBzaXplX3R5cGUgX19uMikgY29u c3Q7CiAgfTsKCgogIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cywg dHlwZW5hbWUgX0FsbG9jPgogICAgaW5saW5lIGJhc2ljX3N0cmluZzxfQ2hhclQsIF9UcmFpdHMs IF9BbGxvYz46OgogICAgYmFzaWNfc3RyaW5nKCkKICAgIDogX01fZGF0YXBsdXMoX1NfZW1wdHlf cmVwKCkuX01fcmVmY29weSgpLCBfQWxsb2MoKSkgeyB9CgoKICB0ZW1wbGF0ZTx0eXBlbmFtZSBf Q2hhclQsIHR5cGVuYW1lIF9UcmFpdHMsIHR5c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zdCBfVHAmCiAgICBfX21lZGlhbihjb25zdCBfVHAmIF9fYSwgY29uc3QgX1Rw JiBfX2IsIGNvbnN0IF9UcCYgX19jKQogICAgewoKICAgICAKICAgICAgaWYgKF9fYSA8IF9fYikK ICAgICAgICBpZiAoX19iIDwgX19jKQogICAgICAgICAgcmV0dXJuIF9fYjsKICAgICAgICBlbHNl IGlmIChfX2EgPCBfX2MpCiAgICAgICAgICByZXR1cm4gX19jOwogICAgICAgIGVsc2UKICAgICAg ICAgIHJldHVybiBfX2E7CiAgICAgIGVsc2UgaWYgKF9fYSA8IF9fYykKICAgICAgICByZXR1cm4g X19hOwogICAgICBlbHNlIGlmIChfX2IgPCBfX2MpCiAgICAgICAgcmV0dXJuIF9fYzsKICAgICAg ZWxzZQogICAgICAgIHJldHVybiBfX2I7CiAgICB9CiMgMTE4ICIvdXNyL2luY2x1ZGUvZysrL2Jp dHMvc3RsX2FsZ28uaCIgMwogIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0NvbXBh cmU+CiAgICBpbmxpbmUgY29uc3QgX1RwJgogICAgX19tZWRpYW4oY29uc3QgX1RwJiBfX2EsIGNv bnN0IF9UcCYgX19iLCBjb25zdCBfVHAmIF9fYywgX0NvbXBhcmUgX19jb21wKQogICAgewoKICAg ICAKICAgICAgaWYgKF9fY29tcChfX2EsIF9fYikpCiAgICAgICAgaWYgKF9fY29tcChfX2IsIF9f YykpCiAgICAgICAgICByZXR1cm4gX19iOwogICAgICAgIGVsc2UgaWYgKF9fY29tcChfX2EsIF9f YykpCiAgICAgICAgICByZXR1cm4gX19jOwogICAgICAgIGVsc2UKICAgICAgICAgIHJldHVybiBf X2E7CiAgICAgIGVsc2UgaWYgKF9fY29tcChfX2EsIF9fYykpCiAgICAgICAgcmV0dXJuIF9fYTsK ICAgICAgZWxzZSBpZiAoX19jb21wKF9fYiwgX19jKSkKICAgICAgICByZXR1cm4gX19jOwogICAg ICBlbHNlCiAgICAgICAgcmV0d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ICBfX3AxID0gX19maXJzdDI7ICsrX19w MTsKCiAgICAgIF9Gb3J3YXJkSXRlcjEgX19jdXJyZW50ID0gX19maXJzdDE7CgogICAgICB3aGls ZSAoX19maXJzdDEgIT0gX19sYXN0MSkgewogICAgICAgIF9fZmlyc3QxID0gZmluZChfX2ZpcnN0 MSwgX19sYXN0MSwgKl9fZmlyc3QyKTsKICAgICAgICBpZiAoX19maXJzdDEgPT0gX19sYXN0MSkK ICAgICAgICAgIHJldHVybiBfX2xhc3QxOwoKICAgICAgICBfX3AgPSBfX3AxOwogICAgICAgIF9f Y3VycmVudCA9IF9fZmlyc3QxOwogICAgICAgIGlmICgrK19fY3VycmVudCA9PSBfX2xhc3QxKQog ICAgICAgICAgcmV0dXJuIF9fbGFzdDE7CgogICAgICAgIHdoaWxlICgqX19jdXJyZW50ID09ICpf X3ApIHsKICAgICAgICAgIGlmICgrK19fcCA9PSBfX2xhc3QyKQogICAgICAgICAgICByZXR1cm4g X19maXJzdDE7CiAgICAgICAgICBpZiAoKytfX2N1cnJlbnQgPT0gX19sYXN0MSkKICAgICAgICAg ICAgcmV0dXJuIF9fbGFzdDE7CiAgICAgICAgfQoKICAgICAgICArK19fZmlyc3QxOwogICAgICB9 CiAgICAgIHJldHVybiBfX2ZpcnN0MTsKICAgIH0KIyA1MjIgIi91c3IvaW5jbHVkZS9nKysvYml0 cy9zdGxfYWxnby5oIiAzCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0ZvcndhcmRJdGVyMSwgdHlwZW5h bWUgX0ZvcndhcmRJdGVyMiwgdHlwZW5hbWUgX0JpbmFyeVByZWQ+CiAgICBfRm9yd2FyZEl0ZXIx CiAgICBzZWFyY2goX0ZvcndhcmRJdGVyMSBfX2ZpcnN0MSwgX0ZvcndhcmRJdGVyMSBfX2xhc3Qx LAogICAgICAgICAgIF9Gb3J3YXJkSXRlcjIgX19maXJzdDIsIF9Gb3J3YXJkSXRlcjIgX19sYXN0 MiwKICAgICAgICAgICBfQmluYXJ5UHJlZCBfX3ByZWRpY2F0ZSkKICAgIHsKCiAgICAgCiAgICAg CiAgICAgCgoKCgogICAgICBpZiAoX19maXJzdDEgPT0gX19sYXN0MSB8fCBfX2ZpcnN0MiA9PSBf X2xhc3QyKQogICAgICAgIHJldHVybiBfX2ZpcnN0MTsKCgogICAgICBfRm9yd2FyZEl0ZXIyIF9f dG1wKF9fZmlyc3QyKTsKICAgICAgKytfX3RtcDsKICAgICAgaWYgKF9fdG1wID09IF9fbGFzdDIp IHsKICAgICAgICB3aGlsZSAoX19maXJzdDEgIT0gX19sYXN0MSAmJiAhX19wcmVkaWNhdGUoKl9f Zmlyc3QxLCAqX19maXJzdDIpKQogICAgICAgICAgKytfX2ZpcnN0MTsKICAgICAgICByZXR1cm4g X19maXJzdDE7CiAgICAgIH0KCgoKICAgICAgX0ZvcndhcmRJdGVyMiBfX3AxLCBfX3A7CgogICAg ICBfX3AxID0gX19maXJzdDI7ICsrX19wMTsKCiAgICAgIF9Gb3J3YXJkSXRlcjEgX19jdXJyZW50 ID0gX19maXJzdDE7CgogICAgICB3aGlsZSAoX19maXJzdDEgIT0gX19sYXN0MSkgewogICAgICAg IHdoaWxlIChfX2ZpcnN0MSAhPSBfX2xhc3QxKSB7CiAgICAgICAgICBpZiAoX19wcmVkaWNhdGUo Kl9fZmlyc3QxLCAqX19maXJzdDIpKQogICAgICAgICAgICBicmVhazsKICAgICAgICAgICsrX19m aXJzdDE7CiAgICAgICAgfQogICAgICAgIHdoaWxlIChfX2ZpcnN0MSAhPSBfX2xhc3QxICYmICFf X3ByZWRpY2F0ZSgqX19maXJzdDEsICpfX2ZpcnN0MikpCiAgICAgICAgICArK19fZmlyc3QxOwog ICAgICAgIGlmIChfX2ZpcnN0MSA9PSBfX2xhc3QxKQogICAgICAgICAgcmV0dXJuIF9fbGFzdDE7 CgogICAgICAgIF9fcCA9IF9fcDE7CiAgICAgICAgX19jdXJyZW50ID0gX19maXJzdDE7CiAgICAg ICAgaWYgKCsrX19jdXJyZW50ID09IF9fbGFzdDEpIHJldHVybiBfX2xhc3QxOwoKICAgICAgICB3 aGlsZSAoX19wcmVkaWNhdGUoKl9fY3VycmVudCwgKl9fcCkpIHsKICAgICAgICAgIGlmICgrK19f cCA9PSBfX2xhc3QyKQogICAgICAgICAgICByZXR1cm4gX19maXJzdDE7CiAgICAgICAgICBpZiAo KytfX2N1cnJlbnQgPT0gX19sYXN0MSkKICAgICAgICAgICAgcmV0dXJuIF9fbGFzdDE7CiAgICAg ICAgfQoKICAgICAgICArK19fZmlyc3QxOwogICAgICB9CiAgICAgIHJldHVybiBfX2ZpcnN0MTsK ICAgIH0KIyA1OTYgIi91c3IvaW5jbHVkZS9nKysvYml0cy9zdGxfYWxnby5oIiAzCiAgdGVtcGxh dGU8dHlwZW5hbWUgX0ZvcndhcmRJdGVyLCB0eXBlbmFtZSBfSW50ZWdlciwgdHlwZW5hbWUgX1Rw PgogICAgX0ZvcndhcmRJdGVyCiAgICBzZWFyY2hfbihfRm9yd2FyZEl0ZXIgX19maXJzdCwgX0Zv cndhcmRJdGVyIF9fbGFzdCwKICAgICAgICAgICAgIF9JbnRlZ2VyIF9fY291bnQsIGNvbnN0IF9U cCYgX192YWwpCiAgICB7CgogICAgIAogICAgIAoKICAgICAKCiAgICAgIGlmIChfX2NvdW50IDw9 IDApCiAgICAgICAgcmV0dXJuIF9fZmlyc3Q7CiAgICAgIGVsc2UgewogICAgICAgIF9fZmlyc3Qg PSBmaW5kKF9fZmlyc3QsIF9fbGFzdCwgX192YWwpOwogICAgICAgIHdoaWxlIChfX2ZpcnN0ICE9 IF9fbGFzdCkgewogICAgICAgICAgX0ludGVnZXIgX19uID0gX19jb3VudCAtIDE7CiAgICAgICAg ICBfRm9yd2FyZEl0ZXIgX19pID0gX19maXJzdDsKICAgICAgICAgICsrX19pOwogICAgICAgICAg d2hpbGUgKF9faSAhPSBfX2xhc3QgJiYgX19uICE9IDAgJiYgKl9faSA9PSBfX3ZhbCkgewogICAg ICAgICAgICArK19faTsKICAgICAgICAgICAgLS1fX247CiAgICAgICAgICB9CiAgICAgICAgICBp ZiAoX19uID09IDApCiAgICAgICAgICAgIHJldHVybiBfX2ZpcnN0OwogICAgICAgICAgZWxzZQog ICAgICAgICAgICBfX2ZpcnN0ID0gZmluZChfX2ksIF9fbGFzdCwgX192YWwpOwogICAgICAgIH0K ICAgICAgICByZXR1cm4gX19sYXN0OwogICAgICB9CiAgICB9CiMgNjQzICIvdXNyL2luY2x1ZGUv ZysrL2JpdHMvc3RsX2FsZ28uaCIgMwogIHRlbXBsYXRlPHR5cGVuYW1lIF9Gb3J3YXJkSXRlciwg dHlwZW5hbWUgX0ludGVnZXIsIHR5cGVuYW1lIF9UcCwKICAgICAgICAgICB0eXBlbmFtZSBfQmlu YXJ5UHJlZD4KICAgIF9Gb3J3YXJkSXRlcgogICAgc2VhcmNoX24oX0ZvcndhcmRJdGVyIF9fZmly c3QsIF9Gb3J3YXJkSXRlciBfX2xhc3QsCiAgICAgICAgICAgICBfSW50ZWdlciBfX2NvdW50LCBj b25zdCBfVHAmIF9fdmFsLAogICAgICAgICAgICAgX0JpbmFyeVByZWQgX19iaW5hcnlfcHJlZCkK ICAgIHsKCiAgICAgCiAgICAgCgoKICAgICAgaWYgKF9fY291bnQgPD0gMCkKICAgICAgICByZXR1 cm4gX19maXJzdDsKICAgICAgZWxzZSB7CiAgICAgICAgd2hpbGUgKF9fZmlyc3QgIT0gX19sYXN0 KSB7CiAgICAgICAgICBpZiAoX19iaW5hcnlfcHJlZCgqX19maXJzdCwgX192YWwpKQogICAgICAg ICAgICBicmVhazsKICAgICAgICAgICsrX19maXJzdDsKICAgICAgICB9CiAgICAgICAgd2hpbGUg KF9fZmlyc3QgIT0gX19sYXN0KSB7CiAgICAgICAgICBfSW50ZWdlciBfX24gPSBfX2NvdW50IC0g MTsKICAgICAgICAgIF9Gb3J3YXJkSXRlciBfX2kgPSBfX2ZpcnN0OwogICAgICAgICAgKytfX2k7 CiAgICAgICAgICB3aGlsZSAoX19pICE9IF9fbGFzdCAmJiBfX24gIT0gMCAmJiBfX2JpbmFyeV9w cmVkKCpfX2ksIF9fdmFsKSkgewogICAgICAgICAgICArK19faTsKICAgICAgICAgICAgLS1fX247 CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoX19uID09IDApCiAgICAgICAgICAgIHJldHVybiBf X2ZpcnN0OwogICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHdoaWxlIChfX2kgIT0gX19sYXN0 KSB7CiAgICAgICAgICAgICAgaWYgKF9fYmluYXJ5X3ByZWQoKl9faSwgX192YWwpKQogICAgICAg ICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgKytfX2k7CiAgICAgICAgICAgIH0KICAgICAg ICAgICAgX19maXJzdCA9IF9faTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJu IF9fbGFzdDsKICAgICAgfQogICAgfQojIDY5NyAiL3Vzci9pbmNsdWRlL2crKy9iaXRzL3N0bF9h bGdvLmgiIDMKICB0ZW1wbGF0ZTx0eXBlbmFtZSBfRm9yd2FyZEl0ZXIxLCB0eXBlbmFtZSBfRm9y d2FyZEl0ZXIyPgogICAgX0ZvcndhcmRJdGVyMgogICAgc3dhcF9yYW5nZXMoX0ZvcndhcmRJdGVy MSBfX2ZpcnN0MSwgX0ZvcndhcmRJdGVyMSBfX2xhc3QxLAogICAgICAgICAgICAgICAgX0Zvcndh cmRJdGVyMiBfX2ZpcnN0MikKICAgIHsKCiAgICAgCiAgICAgCiAgICAgCgoKICAgICAKCgoKICAg ICAgZm9yICggOyBfX2ZpcnN0MSAhPSBfX2xhc3QxOyArK19fZmlyc3QxLCArK19fZmlyc3QyKQog ICAgICAgIGl0ZXJfc3dhcChfX2ZpcnN0MSwgX19maXJzdDIpOwogICAgICByZXR1cm4gX19maXJz dDI7CiAgICB9CiMgNzMyICIvdXNyL2luY2x1ZGUvZysrL2JpdHMvc3RsX2FsZ28uaCIgMwogIHRl bXBsYXRlPHR5cG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WUgX1RwPgogICAgX091dHB1dEl0ZXIKICAgIHJl bW92ZV9jb3B5KF9JbnB1dEl0ZXIgX19maXJzdCwgX0lucHV0SXRlciBfX2xhc3QsCiAgICAgICAg ICAgICAgICBfT3V0cHV0SXRlciBfX3Jlc3VsdCwgY29uc3QgX1RwJiBfX3ZhbHVlKQogICAgewoK ICAgICAKICAgICAKCiAgICAgCgoKICAgICAgZm9yICggOyBfX2ZpcnN0ICE9IF9fbGFzdDsgKytf X2ZpcnN0KQogICAgICAgIGlmICghKCpfX2ZpcnN0ID09IF9fdmFsdWUpKSB7CiAgICAgICAgICAq X19yZXN1bHQgPSAqX19maXJzdDsKICAgICAgICAgICsrX19yZXN1bHQ7CiAgICAgICAgfQogICAg ICByZXR1cm4gX19yZXN1bHQ7CiAgICB9CiMgMTAwMyAiL3Vzci9pbmNsdWRlL2crKy9iaXRzL3N0 bF9hbGdvLmgiIDMKICB0ZW1wbGF0ZTx0eXBlbmFtZSBfSW5wdXRJdGVyLCB0eXBlbmFtZSBfT3V0 cHV0SXRlciwgdHlwZW5hbWUgX1ByZWRpY2F0ZT4KICAgIF9PdXRwdXRJdGVyCiAgICByZW1vdmVf Y29weV9pZihfSW5wdXRJdGVyIF9fZmlyc3QsIF9JbnB1dEl0ZXIgX19sYXN0LAogICAgICAgICAg ICAgICAgICAgX091dHB1dEl0ZXIgX19yZXN1bHQsIF9QcmVkaWNhdGUgX19wcmVkKQogICAgewoK ICAgICAKICAgICAKCiAgICAgCgoKICAgICAgZm9yICggOyBfX2ZpcnN0ICE9IF9fbGFzdDsgKytf X2ZpcnN0KQogICAgICAgIGlmICghX19wcmVkKCpfX2ZpcnN0KSkgewogICAgICAgICAgKl9fcmVz dWx0ID0gKl9fZmlyc3Q7CiAgICAgICAgICArK19fcmVzdWx0OwogICAgICAgIH0KICAgICAgcmV0 dXJuIF9fcmVzdWx0OwogICAgfQojIDEwMzkgIi91c3IvaW5jbHVkZS9nKysvYml0cy9zdGxfYWxn by5oIiAzCi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fcmVzdWx0ID0gKl9fbGFzdDsKICAgICAgICArK19fcmVz dWx0OwogICAgICB9CiAgICAgIHJldHVybiBfX3Jlc3VsdDsKICAgIH0KIyAxMzk5ICIvdXNyL2lu Y2x1ZGUvZysrL2JpdHMvc3RsX2FsZ28uaCIgMwogIHRlbXBsYXRlPHR5cGVuYW1lIF9FdWNsaWRl YW5SaW5nRWxlbWVudD4KICAgIF9FdWNsaWRlYW5SaW5nRWxlbWVudAogICAgX19nY2QoX0V1Y2xp ZGVhblJpbmdFbGVtZW50IF9fbSwgX0V1Y2xpZGVhblJpbmdFbGVtZW50IF9fbikKICAgIHsKICAg ICAgd2hpbGUgKF9fbiAhPSAwKSB7CiAgICAgICAgX0V1Y2xpZGVhblJpbmdFbGVtZW50IF9fdCA9 IF9fbSAlIF9fbjsKICAgICAgICBfX20gPSBfX247CiAgICAgICAgX19uID0gX190OwogICAgICB9 CiAgICAgIHJldHVybiBfX207CiAgICB9CgoKCgoKCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0Zvcndh cmRJdGVyPgogICAgdm9pZAogICAgX19yb3RhdGUoX0ZvcndhcmRJdGVyIF9fZmlyc3QsCiAgICAg ICAgICAgICBfRm9yd2FyZEl0ZXIgX19taWRkbGUsCiAgICAgICAgICAgICBfRm9yd2FyZEl0ZXIg X19sYXN0LAogICAgICAgICAgICAgIGZvcndhcmRfaXRlcmF0b3JfdGFnKQogICAgewogICAgICBp ZiAoKF9fZmlyc3QgPT0gX19taWRkbGUpIHx8IChfX2xhc3QgPT0gX19taWRkbGUpKQogICAgICAg IHJldHVybjsKCiAgICAgIF9Gb3J3YXJkSXRlciBfX2ZpcnN0MiA9IF9fbWlkZGxlOwogICAgICBk byB7CiAgICAgICAgc3dhcCgqX19maXJzdCsrLCAqX19maXJzdDIrKyk7CiAgICAgICAgaWYgKF9f Zmlyc3QgPT0gX19taWRkbGUpCiAgICAgICAgICBfX21pZGRsZSA9IF9fZmlyc3QyOwogICAgICB9 IHdoaWxlIChfX2ZpcnN0MiAhPSBfX2xhc3QpOwoKICAgICAgX19maXJzdDIgPSBfX21pZGRsZTsK CiAgICAgIHdoaWxlIChfX2ZpcnN0MiAhPSBfX2xhc3QpIHsKICAgICAgICBzd2FwKCpfX2ZpcnN0 KyssICpfX2ZpcnN0MisrKTsKICAgICAgICBpZiAoX19maXJzdCA9PSBfX21pZGRsZSkKICAgICAg ICAgIF9fbWlkZGxlID0gX19maXJzdDI7CiAgICAgICAgZWxzZSBpZiAoX19maXJzdDIgPT0gX19s YXN0KQogICAgICAgICAgX19maXJzdDIgPSBfX21pZGRsZTsKICAgICAgfQogICAgfQoKCgoKCgog IHRlbXBsYXRlPHR5cGVuYW1lIF9CaWRpcmVjdGlvbmFsSXRlcj4KICAgIHZvaWQKICAgIF9fcm90 YXRlKF9CaWRpcmVjdGlvbmFsSXRlciBfX2ZpcnN0LAogICAgICAgICAgICAgX0JpZGlyZWN0aW9u YWxJdGVyIF9fbWlkZGxlLAogICAgICAgICAgICAgX0JpZGlyZWN0aW9uYWxJdGVyIF9fbGFzdCwK ICAgICAgICAgICAgICBiaWRpcmVjdGlvbmFsX2l0ZXJhdG9yX3RhZykKICAgIHsKCiAgICAgCgoK ICAgICAgaWYgKChfX2ZpcnN0ID09IF9fbWlkZGxlKSB8fCAoX19sYXN0ID09IF9fbWlkZGxlKSkK ICAgICAgICByZXR1cm47CgogICAgICBfX3JldmVyc2UoX19maXJzdCwgX19taWRkbGUsIGJpZGly ZWN0aW9uYWxfaXRlcmF0b3JfdGFnKCkpOwogICAgICBfX3JldmVyc2UoX19taWRkbGUsIF9fbGFz dCwgYmlkaXJlY3Rpb25hbF9pdGVyYXRvcl90YWcoKSk7CgogICAgICB3aGlsZSAoX19maXJzdCAh PSBfX21pZGRsZSAmJiBfX21pZGRsZSAhPSBfX2xhc3QpCiAgICAgICAgc3dhcCAoKl9fZmlyc3Qr KywgKi0tX19sYXN0KTsKCiAgICAgIGlmIChfX2ZpcnN0ID09IF9fbWlkZGxlK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wgX19taWRkbGUsIF9fbWlkZGxlKTsKICAgICAgICByZXR1cm47CiAgICAgIH0KCiAgICAg IF9EaXN0YW5jZSBfX2QgPSBfX2djZChfX24sIF9fayk7CgogICAgICBmb3IgKF9EaXN0YW5jZSBf X2kgPSAwOyBfX2kgPCBfX2Q7IF9faSsrKSB7CiAgICAgICAgX1ZhbHVlVHlwZSBfX3RtcCA9ICpf X2ZpcnN0OwogICAgICAgIF9SYW5kb21BY2Nlc3NJdGVyIF9fcCA9IF9fZmlyc3Q7CgogICAgICAg IGlmIChfX2sgPCBfX2wpIHsKICAgICAgICAgIGZvciAoX0Rpc3RhbmNlIF9faiA9IDA7IF9faiA8 IF9fbC9fX2Q7IF9faisrKSB7CiAgICAgICAgICAgIGlmIChfX3AgPiBfX2ZpcnN0ICsgX19sKSB7 CiAgICAgICAgICAgICAgKl9fcCA9ICooX19wIC0gX19sKTsKICAgICAgICAgICAgICBfX3AgLT0g X19sOwogICAgICAgICAgICB9CgogICAgICAgICAgICAqX19wID0gKihfX3AgKyBfX2spOwogICAg ICAgICAgICBfX3AgKz0gX19rOwogICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgZWxzZSB7 CiAgICAgICAgICBmb3IgKF9EaXN0YW5jZSBfX2ogPSAwOyBfX2ogPCBfX2svX19kIC0gMTsgX19q ICsrKSB7CiAgICAgICAgICAgIGlmIChfX3AgPCBfX2xhc3QgLSBfX2spIHsKICAgICAgICAgICAg ICAqX19wID0gKihfX3AgKyBfX2spOwogICAgICAgICAgICAgIF9fcCArPSBfX2s7CiAgICAgICAg ICAgIH0KCiAgICAgICAgICAgICpfX3AgPSAqIChfX3AgLSBfX2wpOwogICAgICAgICAgICBfX3Ag LT0gX19sOwogICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgKl9fcCA9IF9fdG1wOwogICAg ICAgICsrX19maXJzdDsKICAgICAgfQogICAgfQojIDE1NjEgIi91c3IvaW5jbHVkZS9nKysvYml0 cy9zdGxfYWxnby5oIiA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lPHR5cGVuYW1lIF9G b3J3YXJkSXRlciwgdHlwZW5hbWUgX1ByZWRpY2F0ZT4KICAgIF9Gb3J3YXJkSXRlcgogICAgX19w YXJ0aXRpb24oX0ZvcndhcmRJdGVyIF9fZmlyc3QsIF9Gb3J3YXJkSXRlciBfX2xhc3QsCiAgICAg ICAgICAgICAgICBfUHJlZGljYXRlIF9fcHJlZCwKICAgICAgICAgICAgICAgIGZvcndhcmRfaXRl cmF0b3JfdGFnKQogICAgewogICAgICBpZiAoX19maXJzdCA9PSBfX2xhc3QpIHJldHVybiBfX2Zp cnN0OwoKICAgICAgd2hpbGUgKF9fcHJlZCgqX19maXJzdCkpCiAgICAgICAgaWYgKCsrX19maXJz dCA9PSBfX2xhc3QpIHJldHVybiBfX2ZpcnN0OwoKICAgICAgX0ZvcndhcmRJdGVyIF9fbmV4dCA9 IF9fZmlyc3Q7CgogICAgICB3aGlsZSAoKytfX25leHQgIT0gX19sYXN0KQogICAgICAgIGlmIChf X3ByZWQoKl9fbmV4dCkpIHsKICAgICAgICAgIHN3YXAoKl9fZmlyc3QsICpfX25leHQpOwogICAg ICAgICAgKytfX2ZpcnN0OwogICAgICAgIH0KCiAgICAgIHJldHVybiBfX2ZpcnN0OwogICAgfQoK CgoKCgogIHRlbXBsYXRlPHR5cGVuYW1lIF9CaWRpcmVjdGlvbmFsSXRlciwgdHlwZW5hbWUgX1By ZWRpY2F0ZT4KICAgIF9CaWRpcmVjdGlvbmFsSXRlcgogICAgX19wYXJ0aXRpb24oX0JpZGlyZWN0 aW9uYWxJdGVyIF9fZmlyc3QsIF9CaWRpcmVjdGlvbmFsSXRlciBfX2xhc3QsCiAgICAgICAgICAg ICAgICBfUHJlZGljYXRlIF9fcHJlZCwKICAgICAgICAgICAgICAgIGJpZGlyZWN0aW9uYWxfaXRl cmF0b3JfdGFnKQogICAgewogICAgICB3aGlsZSAodHJ1ZSkgewogICAgICAgIHdoaWxlICh0cnVl KQogICAgICAgICAgaWYgKF9fZmlyc3QgPT0gX19sYXN0KQogICAgICAgICAgICByZXR1cm4gX19m aXJzdDsKICAgICAgICAgIGVsc2UgaWYgKF9fcHJlZCgqX19maXJzdCkpCiAgICAgICAgICAgICsr X19maXJzdDsKICAgICAgICAgIGVsc2UKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgLS1fX2xh c3Q7CiAgICAgICAgd2hpbGUgKHRydWUpCiAgICAgICAgICBpZiAoX19maXJzdCA9PSBfX2xhc3Qp CiAgICAgICAgICAgIHJldHVybiBfX2ZpcnN0OwogICAgICAgICAgZWxzZSBpZiAoIV9fcHJlZCgq X19sYXN0KSkKICAgICAgICAgICAgLS1fX2xhc3Q7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAg IGJyZWFrOwogICAgICAgIGl0ZXJfc3dhcChfX2ZpcnN0LCBfX2xhc3QpOwogICAgICAgICsrX19m aXJzdDsKICAgICAgfQogICAgfQojIDE3NDggIi91c3IvaW5jbHVkZS9nKysvYml0cy9zdGxfYWxn by5oIiAzCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0ZvcndhcmRJdGVyLCB0eXBlbmFtZSBfUHJlZGlj YXRlPgogICAgaW5saW5lIF9Gb3J3YXJkSXRlcgogICAgcGFydGl0aW9uKF9Gb3J3YXJkSXRlciBf X2ZpcnN0LCBfRm9yd2FyZEl0ZXIgX19sYXN0LAogICAgICAgICAgICAgIF9QcmVkaWNhdGUgX19w cmVkKQogICAgewoKICAgICAKICAgICAKCgogICAgICByZXR1cm4gX19wYXJ0aXRpb24oX19maXJz dCwgX19sYXN0LCBfX3ByZWQsIF9faXRlcmF0b3JfY2F0ZWdvcnkoX19maXJzdCkpOwogICAgfQoK CgoKCgoKICB0ZW1wbGF0ZTx0eXBlbmFtZSBfRm9yd2FyZEl0ZXIsIHR5cGVuYW1lIF9QcmVkaWNh dGUsIHR5cGVuYW1lIF9EaXN0YW5jZT4KICAgIF9Gb3J3YXJkSXRlcgogICAgX19pbnBsYWNlX3N0 YWJsZV9wYXJ0aXRpb24oX0ZvcndhcmRJdGVyIF9fZmlyc3QsIF9Gb3J3YXJkSXRlciBfX2xhc3Qs CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfUHJlZGljYXRlIF9fcHJlZCwgX0Rpc3Rh bmNlIF9fbGVuKQogICAgewogICAgICBpZiAoX19sZW4gPT0gMSkKICAgICAgICByZXR1cm4gX19w cmVkKCpfX2ZpcnN0KSA/IF9fbGFzdCA6IF9fZmlyc3Q7CiAgICAgIF9Gb3J3YXJkSXRlciBfX21p ZGRsZSA9IF9fZmlyc3Q7CiAgICAgIGFkdmFuY2UoX19taWRkbGUsIF9fbGVuIC8gMik7CiAgICAg IF9Gb3J3YXJkSXRlciBfX2JlZ2luID0gX19pbnBsYWNlX3N0YWJsZV9wYXJ0aXRpb24oX19maXJz dCwgX19taWRkbGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgX19wcmVkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIF9fbGVuIC8gMik7CiAgICAgIF9Gb3J3YXJkSXRlciBfX2VuZCA9 IF9faW5wbGFjZV9zdGFibGVfcGFydGl0aW9uKF9fbWlkZGxlLCBfX2xhc3QsCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fcHJlZCwKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19sZW4gLSBf X2xlbiAvIDIpOwogICAgICByb3RhdGUoX19iZWdpbiwgX19taWRkbGUsIF9fZW5kKTsKICAgICAg YWR2YW5jZShfX2JlZ2luLCBkaXN0YW5jZShfX21pZGRsZSwgX19lbmQpKTsKICAgICAgcmV0dXJu IF9fYmVnaW47CiAgICB9CgoKCgoKCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0ZvcndhcmRJdGVyLCB0 eXBlbmFtZSBfUG9pbnRlciwgdHlwZW5hbWUgX1ByZWRpY2F0ZSwKICAgICAgICAgICB0eXBlbmFt ZSBfRGlzdGFuY2U+CiAgICBfRm9yd2FyZEl0ZXIKICAgIF9fc3RhYmxlX3BhcnRpdGlvbl9hZGFw dGl2ZShfRm9yd2FyZEl0ZXIgX19maXJzdCwgX0ZvcndhcmRJdGVyIF9fbGFzdCwKICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBfUHJlZGljYXRlIF9fcHJlZCwgX0Rpc3RhbmNlIF9fbGVu LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9Qb2ludGVyIF9fYnVmZmVyLAogICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9EaXN0YW5jZSBfX2J1ZmZlcl9zaXplKQogICAg ewogICAgICBpZiAoX19sZW4gPD0gX19idWZmZXJfc2l6ZSkgewogICAgICAgIF9Gb3J3YXJkSXRl ciBfX3Jlc3VsdDEgPSBfX2ZpcnN0OwogICAgICAgIF9Qb2ludGVyIF9fcmVzdWx0MiA9IF9fYnVm ZmVyOwogICAgICAgIGZvciAoIDsgX19maXJzdCAhPSBfX2xhc3QgOyArK19fZmlyc3QpCiAgICAg ICAgICBpZiAoX19wcmVkKCpfX2ZpcnN0KSkgewogICAgICAgICAgICAqX19yZXN1bHQxID0gKl9f Zmlyc3Q7CiAgICAgICAgICAgICsrX19yZXN1bHQxOwogICAgICAgICAgfQogICAgICAgICAgZWxz ZSB7CiAgICAgICAgICAgICpfX3Jlc3VsdDIgPSAqX19maXJzdDsKICAgICAgICAgICAgKytfX3Jl c3VsdDI7CiAgICAgICAgICB9CiAgICAgICAgY29weShfX2J1ZmZlciwgX19yZXN1bHQyLCBfX3Jl c3VsdDEpOwogICAgICAgIHJldHVybiBfX3Jlc3VsdDE7CiAgICAgIH0KICAgICAgZWxzZSB7CiAg ICAgICAgX0ZvcndhcmRJdGVyIF9fbWlkZGxlID0gX19maXJzdDsKICAgICAgICBhZHZhbmNlKF9f bWlkZGxlLCBfX2xlbiAvIDIpOwogICAgICAgIF9Gb3J3YXJkSXRlciBfX2JlZ2luID0gX19zdGFi bGVfcGFydGl0aW9uX2FkYXB0aXZlKF9fZmlyc3QsIF9fbWlkZGxlLAogICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fcHJlZCwKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX2xl biAvIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgX19idWZmZXIsIF9fYnVmZmVyX3NpemUpOwogICAgICAgIF9Gb3J3YXJkSXRlciBf X2VuZCA9IF9fc3RhYmxlX3BhcnRpdGlvbl9hZGFwdGl2ZSggX19taWRkbGUsIF9fbGFzdCwKICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9f cHJlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIF9fbGVuIC0gX19sZW4gLyAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgX19idWZmZXIsIF9fYnVmZmVyX3NpemUpOwogICAg ICAgIHJvdGF0ZShfX2JlZ2luLCBfX21pZGRsZSwgX19lbmQpOwogICAgICAgIGFkdmFuY2UoX19i ZWdpbiwgZGlzdGFuY2UoX19taWRkbGUsIF9fZW5kKSk7CiAgICAgICAgcmV0dXJuIF9fYmVnaW47 CiAgICAgIH0KICAgIH0KIyAxODQ4ICIvdXNyL2luY2x1ZGUvZysrL2JpdHMvc3RsX2FsZ28uaCIg MwogIHRlbXBsYXRlPHR5cGVuYW1lIF9Gb3J3YXJkSXRlciwgdHlwZW5hbWUgX1ByZWRpY2F0ZT4K ICAgIF9Gb3J3YXJkSXRlcgogICAgc3RhYmxlX3BhcnRpdGlvbihfRm9yd2FyZEl0ZXIgX19maXJz dCwgX0ZvcndhcmRJdGVyIF9fbGFzdCwKICAgICAgICAgICAgICAgICAgICAgX1ByZWRpY2F0ZSBf X3ByZWQpCiAgICB7CgogICAgIAogICAgIAoKCiAgICAgIGlmIChfX2ZpcnN0ID09IF9fbGFzdCkK ICAgICAgICByZXR1cm4gX19maXJzdDsKICAgICAgZWxzZQogICAgICB7CiAgICAgICAgdHlwZWRl ZiB0eXBlbmFtZSBpdGVyYXRvcl90cmFpdHM8X0ZvcndhcmRJdGVyPjo6dmFsdWVfdHlwZSBfVmFs dWVUeXBlOwogICAgICAgIHR5cGVkZWYgdHlwZW5hbWUgaXRlcmF0b3JfdHJhaXRzPF9Gb3J3YXJk SXRlcj46OmRpZmZlcmVuY2VfdHlwZSBfRGlzdGFuY2VUeXBlOwoKICAgICAgICBfVGVtcG9yYXJ5 X2J1ZmZlcjxfRm9yd2FyZEl0ZXIsIF9WYWx1ZVR5cGU+IF9fYnVmKF9fZmlyc3QsIF9fbGFzdCk7 CiAgICAgICAgaWYgKF9fYnVmLnNpemUoKSA+IDApCiAgICAgICAgICByZXR1cm4gX19zdGFibGVf cGFydGl0aW9uX2FkYXB0aXZlKF9fZmlyc3QsIF9fbGFzdCwgX19wcmVkLAogICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfRGlzdGFuY2VUeXBlKF9fYnVmLnJlcXVl c3RlZF9zaXplKCkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBfX2J1Zi5iZWdpbigpLCBfX2J1Zi5zaXplKCkpOwogICAgICAgIGVsc2UKICAgICAgICAgIHJl dHVybiBfX2lucGxhY2Vfc3RhYmxlX3BhcnRpdGlvbihfX2ZpcnN0LCBfX2xhc3QsIF9fcHJlZCwK ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfRGlzdGFuY2VUeXBl KF9fYnVmL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gICAgIHR5cGVkZWYgdHlwZW5hbWUgaXRlcmF0b3JfdHJhaXRzPF9SYW5kb21B Y2Nlc3NJdGVyPjo6dmFsdWVfdHlwZSBfVmFsdWVUeXBlOwoKICAgICAgd2hpbGUgKF9fbGFzdCAt IF9fZmlyc3QgPiBfTV90aHJlc2hvbGQpIHsKICAgICAgICBpZiAoX19kZXB0aF9saW1pdCA9PSAw KSB7CiAgICAgICAgICBwYXJ0aWFsX3NvcnQoX19maXJzdCwgX19sYXN0LCBfX2xhc3QpOwogICAg ICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICAtLV9fZGVwdGhfbGltaXQ7CiAgICAgICAg X1JhbmRvbUFjY2Vzc0l0ZXIgX19jdXQgPQogICAgICAgICAgX191bmd1YXJkZWRfcGFydGl0aW9u KF9fZmlyc3QsIF9fbGFzdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfVmFsdWVU eXBlKF9fbWVkaWFuKCpfX2ZpcnN0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgKihfX2ZpcnN0ICsgKF9fbGFzdCAtIF9fZmlyc3QpLzIpLAogICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihfX2xhc3Qg LSAxKSkpKTsKICAgICAgICBfX2ludHJvc29ydF9sb29wKF9fY3V0LCBfX2xhc3QsIF9fZGVwdGhf bGltaXQpOwogICAgICAgIF9fbGFzdCA9IF9fY3V0OwogICAgICB9CiAgICB9CgoKCgoKCiAgdGVt cGxhdGU8dHlwZW5hbWUgX1JhbmRvbUFjY2Vzc0l0ZXIsIHR5cGVuYW1lIF9TaXplLCB0eXBlbmFt ZSBfQ29tcGFyZT4KICAgIHZvaWQKICAgIF9faW50cm9zb3J0X2xvb3AoX1JhbmRvbUFjY2Vzc0l0 ZXIgX19maXJzdCwgX1JhbmRvbUFjY2Vzc0l0ZXIgX19sYXN0LAogICAgICAgICAgICAgICAgICAg ICBfU2l6ZSBfX2RlcHRoX2xpbWl0LCBfQ29tcGFyZSBfX2NvbXApCiAgICB7CiAgICAgIHR5cGVk ZWYgdHlwZW5hbWUgaXRlcmF0b3JfdHJhaXRzPF9SYW5kb21BY2Nlc3NJdGVyPjo6dmFsdWVfdHlw ZSBfVmFsdWVUeXBlOwoKICAgICAgd2hpbGUgKF9fbGFzdCAtIF9fZmlyc3QgPiBfTV90aHJlc2hv bGQpIHsKICAgICAgICBpZiAoX19kZXB0aF9saW1pdCA9PSAwKSB7CiAgICAgICAgICBwYXJ0aWFs X3NvcnQoX19maXJzdCwgX19sYXN0LCBfX2xhc3QsIF9fY29tcCk7CiAgICAgICAgICByZXR1cm47 CiAgICAgICAgfQogICAgICAgIC0tX19kZXB0aF9saW1pdDsKICAgICAgICBfUmFuZG9tQWNjZXNz SXRlciBfX2N1dCA9CiAgICAgICAgICBfX3VuZ3VhcmRlZF9wYXJ0aXRpb24oX19maXJzdCwgX19s YXN0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9WYWx1ZVR5cGUoX19tZWRpYW4o Kl9fZmlyc3QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAqKF9fZmlyc3QgKyAoX19sYXN0IC0gX19maXJzdCkvMiksCiAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqKF9fbGFzdCAtIDEpLCBfX2NvbXAp KSwKICAgICAgICAgICBfX2NvbXApOwogICAgICAgIF9faW50cm9zb3J0X2xvb3AoX19jdXQsIF9f bGFzdCwgX19kZXB0aF9saW1pdCwgX19jb21wKTsKICAgICAgICBfX2xhc3QgPSBfX2N1dDsKICAg ICAgfQogICAgfQojIDIxNjYgIi91c3IvaW5jbHVkZS9nKysvYml0cy9zdGxfYWxnby5oIiAzCiAg dGVtcGxhdGU8dHlwZW5hbWUgX1JhbmRvbUFjY2Vzc0l0ZXI+CiAgICBpbmx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AgICAgICAgICAgICAgICAgICAgICAgICBfX2ZpcnN0 ICsgX19zdGVwX3NpemUsIF9fZmlyc3QgKyBfX3R3b19zdGVwLAogICAgICAgICAgICAgICAgICAg ICAgICAgX19yZXN1bHQsCiAgICAgICAgICAgICAgICAgICAgICAgICBfX2NvbXApOwogICAgICAg IF9fZmlyc3QgKz0gX190d29fc3RlcDsKICAgICAgfQogICAgICBfX3N0ZXBfc2l6ZSA9IG1pbihf RGlzdGFuY2UoX19sYXN0IC0gX19maXJzdCksIF9fc3RlcF9zaXplKTsKCiAgICAgIG1lcmdlKF9f Zmlyc3QsIF9fZmlyc3QgKyBfX3N0ZXBfc2l6ZSwKICAgICAgICAgICAgX19maXJzdCArIF9fc3Rl cF9zaXplLCBfX2xhc3QsCiAgICAgICAgICAgIF9fcmVzdWx0LAogICAgICAgICAgICBfX2NvbXAp OwogICAgfQoKICBlbnVtIHsgX01fY2h1bmtfc2l6ZSA9IDcgfTsKCiAgdGVtcGxhdGU8dHlwZW5h bWUgX1JhbmRvbUFjY2Vzc0l0ZXIsIHR5cGVuYW1lIF9EaXN0YW5jZT4KICAgIHZvaWQKICAgIF9f Y2h1bmtfaW5zZXJ0aW9uX3NvcnQoX1JhbmRvbUFjY2Vzc0l0ZXIgX19maXJzdCwgX1JhbmRvbUFj Y2Vzc0l0ZXIgX19sYXN0LAogICAgICAgICAgICAgICAgICAgICAgICAgICBfRGlzdGFuY2UgX19j aHVua19zaXplKQogICAgewogICAgICB3aGlsZSAoX19sYXN0IC0gX19maXJzdCA+PSBfX2NodW5r X3NpemUpIHsKICAgICAgICBfX2luc2VydGlvbl9zb3J0KF9fZmlyc3QsIF9fZmlyc3QgKyBfX2No dW5rX3NpemUpOwogICAgICAgIF9fZmlyc3QgKz0gX19jaHVua19zaXplOwogICAgICB9CiAgICAg IF9faW5zZXJ0aW9uX3NvcnQoX19maXJzdCwgX19sYXN0KTsKICAgIH0KCiAgdGVtcGxhdGU8dHlw ZW5hbWUgX1JhbmRvbU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YWx1ZVR5cGUoKl9fZmlyc3QpLAogICAgICAg ICAgICAgICAgICAgICAgICBfX2NvbXApOwogICAgICAgICsrX19maXJzdDsKICAgICAgfQogICAg ICBzb3J0X2hlYXAoX19yZXN1bHRfZmlyc3QsIF9fcmVzdWx0X3JlYWxfbGFzdCwgX19jb21wKTsK ICAgICAgcmV0dXJuIF9fcmVzdWx0X3JlYWxfbGFzdDsKICAgIH0KIyAyNjg2ICIvdXNyL2luY2x1 ZGUvZysrL2JpdHMvc3RsX2FsZ28uaCIgMwogIHRlbXBsYXRlPHR5cGVuYW1lIF9SYW5kb21BY2Nl c3NJdGVyPgogICAgdm9pZAogICAgbnRoX2VsZW1lbnQoX1JhbmRvbUFjY2Vzc0l0ZXIgX19maXJz dCwKICAgICAgICAgICAgICAgIF9SYW5kb21BY2Nlc3NJdGVyIF9fbnRoLAogICAgICAgICAgICAg ICAgX1JhbmRvbUFjY2Vzc0l0ZXIgX19sYXN0KQogICAgewogICAgICB0eXBlZGVmIHR5cGVuYW1l IGl0ZXJhdG9yX3RyYWl0czxfUmFuZG9tQWNjZXNzSXRlcj46OnZhbHVlX3R5cGUgX1ZhbHVlVHlw ZTsKCgogICAgIAogICAgIAoKICAgICAgd2hpbGUgKF9fbGFzdCAtIF9fZmlyc3QgPiAzKSB7CiAg ICAgICAgX1JhbmRvbUFjY2Vzc0l0ZXIgX19jdXQgPQogICAgICAgICAgX191bmd1YXJkZWRfcGFy dGl0aW9uKF9fZmlyc3QsIF9fbGFzdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBf VmFsdWVUeXBlKF9fbWVkaWFuKCpfX2ZpcnN0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgKihfX2ZpcnN0ICsgKF9fbGFzdCAtIF9fZmlyc3QpLzIp LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKihf X2xhc3QgLSAxKSkpKTsKICAgICAgICBpZiAoX19jdXQgPD0gX19udGgpCiAgICAgICAgICBfX2Zp cnN0ID0gX19jdXQ7CiAgICAgICAgZWxzZQogICAgICAgICAgX19sYXN0ID0gX19jdXQ7CiAgICAg IH0KICAgICAgX19pbnNlcnRpb25fc29ydChfX2ZpcnN0LCBfX2xhc3QpOwogICAgfQojIDI3Mjgg Ii91c3IvaW5jbHVkZS9nKysvYml0cy9zdGxfYWxnby5oIiAzCiAgdGVtcGxhdGU8dHlwZW5hbWUg X1JhbmRvbUFjY2Vzc0l0ZXIsIHR5cGVuYW1lIF9Db21wYXJlPgogICAgdm9pZAogICAgbnRoX2Vs ZW1lbnQoX1JhbmRvbUFjY2Vzc0l0ZXIgX19maXJzdCwKICAgICAgICAgICAgICAgIF9SYW5kb21B Y2Nlc3NJdGVyIF9fbnRoLAogICAgICAgICAgICAgICAgX1JhbmRvbUFjY2Vzc0l0ZXIgX19sYXN0 LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgX0NvbXBhcmUgX19jb21wKQogICAgewogICAg ICB0eXBlZGVmIHR5cGVuYW1lIGl0ZXJhdG9yX3RyYWl0czxfUmFuZG9tQWNjZXNzSXRlcj46OnZh bHVlX3R5cGUgX1ZhbHVlVHlwZTsKCgogICAgIAogICAgIAoKCiAgICAgIHdoaWxlIChfX2xhc3Qg LSBfX2ZpcnN0ID4gMykgewogICAgICAgIF9SYW5kb21BY2Nlc3NJdGVyIF9fY3V0ID0KICAgICAg ICAgIF9fdW5ndWFyZGVkX3BhcnRpdGlvbihfX2ZpcnN0LCBfX2xhc3QsCiAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgX1ZhbHVlVHlwZShfX21lZGlhbigqX19maXJzdCwKICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICooX19maXJzdCArIChf X2xhc3QgLSBfX2ZpcnN0KS8yKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICooX19sYXN0IC0gMSksCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBfX2NvbXApKSwKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBfX2NvbXApOwogICAgICAgIGlmIChfX2N1dCA8PSBfX250aCkKICAgICAgICAg IF9fZmlyc3QgPSBfX2N1dDsKICAgICAgICBlbHNlCiAgICAgICAgICBfX2xhc3QgPSBfX2N1dDsK ICAgICAgfQogICAgICBfX2luc2VydGlvbl9zb3J0KF9fZmlyc3QsIF9fbGFzdCwgX19jb21wKTsK ICAgIH0KIyAyNzY4ICIvdXNyL2luY2x1ZGUvZysrL2JpdHMvc3RsX2FsZ28uaCIgMwogIHRlbXBs YXRlPHR5cGVuYW1lIF9Gb3J3YXJkSXRlciwgdHlwZW5hbWUgX1RwPgogICAgX0ZvcndhcmRJdGVy CiAgICBsb3dlcl9ib3VuZChfRm9yd2FyZEl0ZXIgX19maXJzdCwgX0ZvcndhcmRJdGVyIF9fbGFz dCwgY29uc3QgX1RwJiBfX3ZhbCkKICAgIHsKICAgICAgdHlwZWRlZiB0eXBlbmFtZSBpdGVyYXRv cl90cmFpdHM8X0ZvcndhcmRJdGVyPjo6dmFsdWVfdHlwZSBfVmFsdWVUeXBlOwogICAgICB0eXBl ZGVmIHR5cGVuYW1lIGl0ZXJhdG9yX3RyYWl0czxfRm9yd2FyZEl0ZXI+OjpkaWZmZXJlbmNlX3R5 cGUgX0Rpc3RhbmNlVHlwZTsKCgoKCgoKICAgICAKICAgICAKICAgICAKCiAgICAgIF9EaXN0YW5j ZVR5cGUgX19sZW4gPSBkaXN0YW5jZShfX2ZpcnN0LCBfX2xhc3QpOwogICAgICBfRGlzdGFuY2VU eXBlIF9faGFsZjsKICAgICAgX0ZvcndhcmRJdGVyIF9fbWlkZGxlOwoKICAgICAgd2hpbGUgKF9f bGVuID4gMCkgewogICAgICAgIF9faGFsZiA9IF9fbGVuID4+IDE7CiAgICAgICAgX19taWRk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bGFzdCwKICAgICAgICAgICAgICAgICAgY29uc3QgX1Rw JiBfX3ZhbCwgX0NvbXBhcmUgX19jb21wKQogICAgewoKICAgICAKICAgICAKCiAgICAgCgoKICAg ICAgX0ZvcndhcmRJdGVyIF9faSA9IGxvd2VyX2JvdW5kKF9fZmlyc3QsIF9fbGFzdCwgX192YWws IF9fY29tcCk7CiAgICAgIHJldHVybiBfX2kgIT0gX19sYXN0ICYmICFfX2NvbXAoX192YWwsICpf X2kpOwogICAgfQojIDMxMTUgIi91c3IvaW5jbHVkZS9nKysvYml0cy9zdGxfYWxnby5oIiAzCiAg dGVtcGxhdGU8dHlwZW5hbWUgX0lucHV0SXRlcjEsIHR5cGVuYW1lIF9JbnB1dEl0ZXIyLCB0eXBl bmFtZSBfT3V0cHV0SXRlcj4KICAgIF9PdXRwdXRJdGVyCiAgICBtZXJnZShfSW5wdXRJdGVyMSBf X2ZpcnN0MSwgX0lucHV0SXRlcjEgX19sYXN0MSwKICAgICAgICAgIF9JbnB1dEl0ZXIyIF9fZmly c3QyLCBfSW5wdXRJdGVyMiBfX2xhc3QyLAogICAgICAgICAgX091dHB1dEl0ZXIgX19yZXN1bHQp CiAgICB7CgogICAgIAogICAgIAogICAgIAoKICAgICAKCgogICAgIAoKCiAgICAgIHdoaWxlIChf X2ZpcnN0MSAhPSBfX2xhc3QxICYmIF9fZmlyc3QyICE9IF9fbGFzdDIpIHsKICAgICAgICBpZiAo Kl9fZmlyc3QyIDwgKl9fZmlyc3QxKSB7CiAgICAgICAgICAqX19yZXN1bHQgPSAqX19maXJzdDI7 CiAgICAgICAgICArK19fZmlyc3QyOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAg ICpfX3Jlc3VsdCA9ICpfX2ZpcnN0MTsKICAgICAgICAgICsrX19maXJzdDE7CiAgICAgICAgfQog ICAgICAgICsrX19yZXN1bHQ7CiAgICAgIH0KICAgICAgcmV0dXJuIGNvcHkoX19maXJzdDIsIF9f bGFzdDIsIGNvcH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2b2lkCiAgICBfX21lcmdl X3dpdGhvdXRfYnVmZmVyKF9CaWRpcmVjdGlvbmFsSXRlciBfX2ZpcnN0LAogICAgICAgICAgICAg ICAgICAgICAgICAgICBfQmlkaXJlY3Rpb25hbEl0ZXIgX19taWRkbGUsCiAgICAgICAgICAgICAg ICAgICAgICAgICAgIF9CaWRpcmVjdGlvbmFsSXRlciBfX2xhc3QsCiAgICAgICAgICAgICAgICAg ICAgICAgICAgIF9EaXN0YW5jZSBfX2xlbjEsIF9EaXN0YW5jZSBfX2xlbjIpCiAgICB7CiAgICAg IGlmIChfX2xlbjEgPT0gMCB8fCBfX2xlbjIgPT0gMCkKICAgICAgICByZXR1cm47CiAgICAgIGlm IChfX2xlbjEgKyBfX2xlbjIgPT0gMikgewogICAgICAgIGlmICgqX19taWRkbGUgPCAqX19maXJz dCkKICAgICAgICAgICAgICBpdGVyX3N3YXAoX19maXJzdCwgX19taWRkbGUpOwogICAgICAgIHJl dHVybjsKICAgICAgfQogICAgICBfQmlkaXJlY3Rpb25hbEl0ZXIgX19maXJzdF9jdXQgPSBfX2Zp cnN0OwogICAgICBfQmlkaXJlY3Rpb25hbEl0ZXIgX19zZWNvbmRfY3V0ID0gX19taWRkbGU7CiAg ICAgIF9EaXN0YW5jZSBfX2xlbjExID0gMDsKICAgICAgX0Rpc3RhbmNlIF9fbGVuMjIgPSAwOwog ICAgICBpZiAoX19sZW4xID4gX19sZW4yKSB7CiAgICAgICAgX19sZW4xMSA9IF9fbGVuMSAvIDI7 CiAgICAgICAgYWR2YW5jZShfX2ZpcnN0X2N1dCwgX19sZW4xMSk7CiAgICAgICAgX19zZWNvbmRf Y3V0ID0gbG93ZXJfYm91bmQoX19taWRkbGUsIF9fbGFzdCwgKl9fZmlyc3RfY3V0KTsKICAgICAg ICBfX2xlbjIyID0gZGlzdGFuY2UoX19taWRkbGUsIF9fc2Vjb25kX2N1dCk7CiAgICAgIH0KICAg ICAgZWxzZSB7CiAgICAgICAgX19sZW4yMiA9I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gICAg IF9CaWRpcmVjdGlvbmFsSXRlciBfX2xhc3QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgIF9E aXN0YW5jZSBfX2xlbjEsIF9EaXN0YW5jZSBfX2xlbjIsCiAgICAgICAgICAgICAgICAgICAgICAg ICAgIF9Db21wYXJlIF9fY29tcCkKICAgIHsKICAgICAgaWYgKF9fbGVuMSA9PSAwIHx8IF9fbGVu MiA9PSAwKQogICAgICAgIHJldHVybjsKICAgICAgaWYgKF9fbGVuMSArIF9fbGVuMiA9PSAyKSB7 CiAgICAgICAgaWYgKF9fY29tcCgqX19taWRkbGUsICpfX2ZpcnN0KSkKICAgICAgICAgICAgICBp dGVyX3N3YXAoX19maXJzdCwgX19taWRkbGUpOwogICAgICAgIHJldHVybjsKICAgICAgfQogICAg ICBfQmlkaXJlY3Rpb25hbEl0ZXIgX19maXJzdF9jdXQgPSBfX2ZpcnN0OwogICAgICBfQmlkaXJl Y3Rpb25hbEl0ZXIgX19zZWNvbmRfY3V0ID0gX19taWRkbGU7CiAgICAgIF9EaXN0YW5jZSBfX2xl bjExID0gMDsKICAgICAgX0Rpc3RhbmNlIF9fbGVuMjIgPSAwOwogICAgICBpZiAoX19sZW4xID4g X19sZW4yKSB7CiAgICAgICAgX19sZW4xMSA9IF9fbGVuMSAvIDI7CiAgICAgICAgYWR2YW5jZShf X2ZpcnN0X2N1dCwgX19sZW4xMSk7CiAgICAgICAgX19zZWNvbmRfY3V0ID0gbG93ZXJfYm91bmQo X19taWRkbGUsIF9fbGFzdCwgKl9fZmlyc3RfY3V0LCBfX2NvbXApOwogICAgICAgIF9fbGVuMjIg PSBkaXN0YW5jZShfX21pZGRsZSwgX19zZWNvbmRfY3V0KTsKICAgICAgfQogICAgICBlbHNlIHsK ICAgICAgICBfX2xlbjIyID0gX19sZW4yIC8gMjsKICAgICAgICBhZHZhbmNlKF9fc2Vjb25kX2N1 dCwgX19sZW4yMik7CiAgICAgICAgX19maXJzdF9jdXQgPSB1cHBlcl9ib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ZXIxLCB0eXBlbmFtZSBf QmlkaXJlY3Rpb25hbEl0ZXIyLAogICAgICAgICAgIHR5cGVuYW1lIF9CaWRpcmVjdGlvbmFsSXRl cjM+CiAgICBfQmlkaXJlY3Rpb25hbEl0ZXIzCiAgICBfX21lcmdlX2JhY2t3YXJkKF9CaWRpcmVj dGlvbmFsSXRlcjEgX19maXJzdDEsIF9CaWRpcmVjdGlvbmFsSXRlcjEgX19sYXN0MSwKICAgICAg ICAgICAgICAgICAgICAgX0JpZGlyZWN0aW9uYWxJdGVyMiBfX2ZpcnN0MiwgX0JpZGlyZWN0aW9u YWxJdGVyMiBfX2xhc3QyLAogICAgICAgICAgICAgICAgICAgICBfQmlkaXJlY3Rpb25hbEl0ZXIz IF9fcmVzdWx0KQogICAgewogICAgICBpZiAoX19maXJzdDEgPT0gX19sYXN0MSkKICAgICAgICBy ZXR1cm4gY29weV9iYWNrd2FyZChfX2ZpcnN0MiwgX19sYXN0MiwgX19yZXN1bHQpOwogICAgICBp ZiAoX19maXJzdDIgPT0gX19sYXN0MikKICAgICAgICByZXR1cm4gY29weV9iYWNrd2FyZChfX2Zp cnN0MSwgX19sYXN0MSwgX19yZXN1bHQpOwogICAgICAtLV9fbGFzdDE7CiAgICAgIC0tX19sYXN0 MjsKICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICBpZiAoKl9fbGFzdDIgPCAqX19sYXN0MSkg ewogICAgICAgICAgKi0tX19yZXN1bHQgPSAqX19sYXN0MTsKICAgICAgICAgIGlmIChfX2ZpcnN0 MSA9PSBfX2xhc3QxKQogICAgICAgICAgICByZXR1cm4gY29weV9iYWNrd2FyZChfX2ZpcnN0Miwg KytfX2xhc3QyLCBfX3Jlc3VsdCk7CiAgICAgICAgICAtLV9fbGFzdDE7CiAgICAgICAgfQogICAg ICAgIGVsc2UgewogICAgICAgICAgKi0tX19yZXN1bHQgPSAqX19sYXN0MjsKICAgICAgICAgIGlm IChfX2ZpcnN0MiA9PSBfX2xhc3QyKQogICA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sIF9fYnVmZmVyKTsKICAgICAgICAgICAgbWVyZ2UoX19idWZm ZXIsIF9fYnVmZmVyX2VuZCwgX19taWRkbGUsIF9fbGFzdCwgX19maXJzdCk7CiAgICAgICAgICB9 CiAgICAgICAgICBlbHNlIGlmIChfX2xlbjIgPD0gX19idWZmZXJfc2l6ZSkgewogICAgICAgICAg ICBfUG9pbnRlciBfX2J1ZmZlcl9lbmQgPSBjb3B5KF9fbWlkZGxlLCBfX2xhc3QsIF9fYnVmZmVy KTsKICAgICAgICAgICAgX19tZXJnZV9iYWNrd2FyZChfX2ZpcnN0LCBfX21pZGRsZSwgX19idWZm ZXIsIF9fYnVmZmVyX2VuZCwgX19sYXN0KTsKICAgICAgICAgIH0KICAgICAgICAgIGVsc2Ugewog ICAgICAgICAgICBfQmlkaXJlY3Rpb25hbEl0ZXIgX19maXJzdF9jdXQgPSBfX2ZpcnN0OwogICAg ICAgICAgICBfQmlkaXJlY3Rpb25hbEl0ZXIgX19zZWNvbmRfY3V0ID0gX19taWRkbGU7CiAgICAg ICAgICAgIF9EaXN0YW5jZSBfX2xlbjExID0gMDsKICAgICAgICAgICAgX0Rpc3RhbmNlIF9fbGVu MjIgPSAwOwogICAgICAgICAgICBpZiAoX19sZW4xID4gX19sZW4yKSB7CiAgICAgICAgICAgICAg ICAgIF9fbGVuMTEgPSBfX2xlbjEgLyAyOwogICAgICAgICAgICAgICAgICBhZHZhbmNlKF9fZmly c3RfY3V0LCBfX2xlbjExKTsKICAgICAgICAgICAgICAgICAgX19zZWNvbmRfY3V0ID0gbG93ZXJf Ym91bmQoX19taWRkbGUsIF9fbGFzdCwgKl9fZmlyc3RfY3V0KTsKICAgICAgICAgICAgICAgICAg X19sZW4yMiA9IGRpc3RhbmNlKF9fbWlkZGxlLCBfX3NlY29uZF9jdXQpOwogICAgICAgICAgICB9 CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICBfX2xlbjIyID0gX19sZW4yIC8g MjsKICAgICAgICAgICAgICAgICAgYWR2YW5jZShfX3NlY29uZF9jdXQsIF9fbGVuMjIpOwogICAg ICAgICAgICAgICAgICBfX2ZpcnN0X2N1dCA9IHVwcGVyX2JvdW5kKF9fZmlyc3QsIF9fbWlkZGxl LCAqX19zZWNvbmRfY3V0KTsKICAgICAgICAgICAgICAgICAgX19sZW4xMSA9IGRpc3RhbmNlKF9f Zmlyc3QsIF9fZmlyc3RfY3V0KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBfQmlkaXJlY3Rp b25hbEl0ZXIgX19uZXdfbWlkZGxlID0KICAgICAgICAgICAgICAgICAgX19yb3RhdGVfYWRhcHRp dmUoX19maXJzdF9jdXQsIF9fbWlkZGxlLCBfX3NlY29uZF9jdXQsCiAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIF9fbGVuMSAtIF9fbGVuMTEsIF9fbGVuMjIsIF9fYnVmZmVyLAog ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX2J1ZmZlcl9zaXplKTsKICAgICAg ICAgICAgX19tZXJnZV9hZGFwdGl2ZShfX2ZpcnN0LCBfX2ZpcnN0X2N1dCwgX19uZXdfbWlkZGxl LCBfX2xlbjExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fbGVuMjIsIF9fYnVmZmVy LCBfX2J1ZmZlcl9zaXplKTsKICAgICAgICAgICAgX19tZXJnZV9hZGFwdGl2ZShfX25ld19taWRk bGUsIF9fc2Vjb25kX2N1dCwgX19sYXN0LCBfX2xlbjEgLSBfX2xlbjExLAogICAgICAgICAgICAg ICAgICAgICAgICAgICAgIF9fbGVuMiAtIF9fbGVuMjIsIF9fYnVmZmVyLCBfX2J1ZmZlcl9zaXpl KTsKICAgICAgICAgIH0KICAgIH0KCgoKCgoKICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQmlkaXJlY3Rp b25hbEl0ZXIsIHR5cGVuYW1lIF9EaXN0YW5jZSwgdHlwZW5hbWUgX1BvaW50ZXIsCiAgICAgICAg ICAgdHlwZW5hbWUgX0NvbXBhcmU+CiAgICB2b2lkCiAgICBfX21lcmdlX2FkYXB0aXZlKF9CaWRp cmVjdGlvbmFsSXRlciBfX2ZpcnN0LAogICAgICAgICAgICAgICAgICAgICBfQmlkaXJlY3Rpb25h bEl0ZXIgX19taWRkbGUsCiAgICAgICAgICAgICAgICAgICAgIF9CaWRpcmVjdGlvbmFsSXRlciBf X2xhc3QsCiAgICAgICAgICAgICAgICAgICAgIF9EaXN0YW5jZSBfX2xlbjEsIF9EaXN0YW5jZSBf X2xlbjIsCiAgICAgICAgICAgICAgICAgICAgIF9Qb2ludGVyIF9fYnVmZmVyLCBfRGlzdGFuY2Ug X19idWZmZXJfc2l6ZSwKICAgICAgICAgICAgICAgICAgICAgX0NvbXBhcmUgX19jb21wKQogICAg ewogICAgICAgICAgaWYgKF9fbGVuMSA8PSBfX2xlbjIgJiYgX19sZW4xIDw9IF9fYnVmZmVyX3Np emUpIHsKICAgICAgICAgICAgX1BvaW50ZXIgX19idWZmZXJfZW5kID0gY29weShfX2ZpcnN0LCBf X21pZGRsZSwgX19idWZmZXIpOwogICAgICAgICAgICBtZXJnZShfX2J1ZmZlciwgX19idWZmZXJf ZW5kLCBfX21pZGRsZSwgX19sYXN0LCBfX2ZpcnN0LCBfX2NvbXApOwogICAgICAgICAgfQogICAg ICAgICAgZWxzZSBpZiAoX19sZW4yIDw9IF9fYnVmZmVyX3NpemUpIHsKICAgICAgICAgICAgX1Bv aW50ZXIgX19idWZmZXJfZW5kID0gY29weShfX21pZGRsZSwgX19sYXN0LCBfX2J1ZmZlcik7CiAg ICAgICAgICAgIF9fbWVyZ2VfYmFja3dhcmQoX19maXJzdCwgX19taWRkbGUsIF9fYnVmZmVyLCBf X2J1ZmZlcl9lbmQsIF9fbGFzdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgX19jb21wKTsKICAgICAgICAgIH0KICAgICAgICAgIGVsc2UgewogICAgICAgICAg ICBfQmlkaXJlY3Rpb25hbEl0ZXIgX19maXJzdF9jdXQgPSBfX2ZpcnN0OwogICAgICAgICAgICBf QmlkaXJlY3Rpb25hbEl0ZXIgX19zZWNvbmRfY3V0ID0gX19taWRkbGU7CiAgICAgICAgICAgIF9E aXN0YW5jZSBfX2xlbjExID0gMDsKICAgICAgICAgICAgX0Rpc3RhbmNlIF9fbGVuMjIgPSAwOwog ICAgICAgICAgICBpZiAoX19sZW4xID4gX19sZW4yKSB7CiAgICAgICAgICAgICAgICAgIF9fbGVu MTEgPSBfX2xlbjEgLyAyOwogICAgICAgICAgICAgICAgICBhZHZhbmNlKF9fZmlyc3RfY3V0LCBf X2xlbjExKTsKICAgICAgICAgICAgICAgICAgX19zZWNvbmRfY3V0ID0gbG93ZXJfYm91bmQoX19t aWRkbGUsIF9fbGFzdCwgKl9fZmlyc3RfY3V0LCBfX2NvbXApOwogICAgICAgICAgICAgICAgICBf X2xlbjIyID0gZGlzdGFuY2UoX19taWRkbGUsIF9fc2Vjb25kX2N1dCk7CiAgICAgICAgICAgIH0K ICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgIF9fbGVuMjIgPSBfX2xlbjIgLyAy OwogICAgICAgICAgICAgICAgICBhZHZhbmNlKF9fc2Vjb25kX2N1dCwgX19sZW4yMik7CiAgICAg ICAgICAgICAgICAgIF9fZmlyc3RfY3V0ID0gdXBwZXJfYm91bmQoX19maXJzdCwgX19taWRkbGUs ICpfX3NlY29uZF9jdXQsIF9fY29tcCk7CiAgICAgICAgICAgICAgICAgIF9fbGVuMTEgPSBkaXN0 YW5jZShfX2ZpcnN0LCBfX2ZpcnN0X2N1dCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgX0Jp ZGlyZWN0aW9uYWxJdGVyIF9fbmV3X21pZGRsZSA9CiAgICAgICAgICAgICAgICAgIF9fcm90YXRl X2FkYXB0aXZlKF9fZmlyc3RfY3V0LCBfX21pZGRsZSwgX19zZWNvbmRfY3V0LAogICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBfX2xlbjEgLSBfX2xlbjExLCBfX2xlbjIyLCBfX2J1 ZmZlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19idWZmZXJfc2l6ZSk7 CiAgICAgICAgICAgIF9fbWVyZ2VfYWRhcHRpdmUoX19maXJzdCwgX19maXJzdF9jdXQsIF9fbmV3 X21pZGRsZSwgX19sZW4xMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX2xlbjIyLCBf X2J1ZmZlciwgX19idWZmZXJfc2l6ZSwgX19jb21wKTsKICAgICAgICAgICAgX19tZXJnZV9hZGFw dGl2ZShfX25ld19taWRkbGUsIF9fc2Vjb25kX2N1dCwgX19sYXN0LCBfX2xlbjEgLSBfX2xlbjEx LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fbGVuMiAtIF9fbGVuMjIsIF9fYnVmZmVy LCBfX2J1ZmZlcl9zaXplLCBfX2NvbXApOwogICAgICAgICAgfQogICAgfQojIDM1MDggIi91c3Iv aW5jbHVkZS9nKysvYml0cy9zdGxfYWxnby5oIiAzCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0JpZGly ZWN0aW9uYWxJdGVyPgogICAgdm9pZAogICAgaW5wbGFjZV9tZXJnZShfQmlkaXJlY3Rpb25hbEl0 ZXIgX19maXJzdCwKICAgICAgICAgICAgICAgICAgX0JpZGlyZWN0aW9uYWxJdGVyIF9fbWlkZGxl LAogICAgICAgICAgICAgICAgICBfQmlkaXJlY3Rpb25hbEl0ZXIgX19sYXN0KQogICAgewogICAg ICB0eXBlZGVmIHR5cGVuYW1lIGl0ZXJhdG9yX3RyYWl0czxfQmlkaXJlY3Rpb25hbEl0ZXI+Ojp2 YWx1ZV90eXBlCiAgICAgICAgICBfVmFsdWVUeXBlOwogICAgICB0eXBlZGVmIHR5cGVuYW1lIGl0 ZXJhdG9yX3RyYWl0czxfQmlkaXJlY3Rpb25hbEl0ZXI+OjpkaW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Ck7CiAgICB9CgoKCgoKCiAgdGVtcGxhdGU8dHlwZW5h bWUgX0lucHV0SXRlcjEsIHR5cGVuYW1lIF9JbnB1dEl0ZXIyPgogICAgYm9vbAogICAgaW5jbHVk ZXMoX0lucHV0SXRlcjEgX19maXJzdDEsIF9JbnB1dEl0ZXIxIF9fbGFzdDEsCiAgICAgICAgICAg ICBfSW5wdXRJdGVyMiBfX2ZpcnN0MiwgX0lucHV0SXRlcjIgX19sYXN0MikKICAgIHsKCiAgICAg CiAgICAgCiAgICAgCgoKICAgICAKCgogICAgICB3aGlsZSAoX19maXJzdDEgIT0gX19sYXN0MSAm JiBfX2ZpcnN0MiAhPSBfX2xhc3QyKQogICAgICAgIGlmICgqX19maXJzdDIgPCAqX19maXJzdDEp CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgZWxzZSBpZigqX19maXJzdDEgPCAqX19m aXJzdDIpCiAgICAgICAgICArK19fZmlyc3QxOwogICAgICAgIGVsc2UKICAgICAgICAgICsrX19m aXJzdDEsICsrX19maXJzdDI7CgogICAgICByZXR1cm4gX19maXJzdDIgPT0gX19sYXN0MjsKICAg IH0KCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0lucHV0SXRlcjEsIHR5cGVuYW1lIF9JbnB1dEl0ZXIy LCB0eXBlbmFtZSBfQ29tcGFyZT4KICAgIGJvb2wKICAgIGluY2x1ZGVzKF9JbnB1dEl0ZXIxIF9f Zmlyc3QxLCBfSW5wdXRJdGVyMSBfX2xhc3QxLAogICAgICAgICAgICAgX0lucHV0SXRlcjIgX19m aXJzdDIsIF9JbnB1dEl0ZXIyIF9fbGFzdDIsIF9Db21wYXJlIF9fY29tcCkKICAgIHsKCiAgICAg CiAgICAgCiAgICAgCgoKICAgICAKCgoKICAgICAgd2hpbGUgKF9fZmlyc3QxICE9IF9fbGFzdDEg JiYgX19maXJzdDIgIT0gX19sYXN0MikKICAgICAgICBpZiAoX19jb21wKCpfX2ZpcnN0MiwgKl9f Zmlyc3QxKSkKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICBlbHNlIGlmKF9fY29tcCgq X19maXJzdDEsICpfX2ZpcnN0MikpCiAgICAgICAgICArK19fZmlyc3QxOwogICAgICAgIGVsc2UK ICAgICAgICAgICsrX19maXJzdDEsICsrX19maXJzdDI7CgogICAgICByZXR1cm4gX19maXJzdDIg PT0gX19sYXN0MjsKICAgIH0KCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0lucHV0SXRlcjEsIHR5cGVu YW1lIF9JbnB1dEl0ZXIyLCB0eXBlbmFtZSBfT3V0cHV0SXRlcj4KICAgIF9PdXRwdXRJdGVyCiAg ICBzZXRfdW5pb24oX0lucHV0SXRlcjEgX19maXJzdDEsIF9JbnB1dEl0ZXIxIF9fbGFzdDEsCiAg ICAgICAgICAgICAgX0lucHV0SXRlcjIgX19maXJzdDIsIF9JbnB1dEl0ZXIyIF9fbGFzdDIsCiAg ICAgICAgICAgICAgX091dHB1dEl0ZXIgX19yZXN1bHQpCiAgICB7CgogICAgIAogICAgIAogICAg IAoKICAgICAKCgogICAgIAoKCiAgICAgIHdoaWxlIChfX2ZpcnN0MSAhPSBfX2xhc3QxICYmIF9f Zmlyc3QyICE9IF9fbGFzdDIpIHsKICAgICAgICBpZiAoKl9fZmlyc3QxIDwgKl9fZmlyc3QyKSB7 CiAgICAgICAgICAqX19yZXN1bHQgPSAqX19maXJzdDE7CiAgICAgICAgICArK19fZmlyc3QxOwog ICAgICAgIH0KICAgICAgICBlbHNlIGlmICgqX19maXJzdDIgPCAqX19maXJzdDEpIHsKICAgICAg ICAgICpfX3Jlc3VsdCA9ICpfX2ZpcnN0MjsKICAgICAgICAgICsrX19maXJzdDI7CiAgICAgICAg fQogICAgICAgIGVsc2UgewogICAgICAgICAgKl9fcmVzdWx0ID0gKl9fZmlyc3QxOwogICAgICAg ICAgKytfX2ZpcnN0MTsKICAgICAgICAgICsrX19maXJzdDI7CiAgICAgICAgfQogICAgICAgICsr X19yZXN1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AgIH0KICAgICAgcmV0dXJu IGNvcHkoX19maXJzdDIsIF9fbGFzdDIsIGNvcHkoX19maXJzdDEsIF9fbGFzdDEsIF9fcmVzdWx0 KSk7CiAgICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9JbnB1dEl0ZXIxLCB0eXBlbmFtZSBfSW5w dXRJdGVyMiwgdHlwZW5hbWUgX091dHB1dEl0ZXI+CiAgICBfT3V0cHV0SXRlcgogICAgc2V0X2lu dGVyc2VjdGlvbihfSW5wdXRJdGVyMSBfX2ZpcnN0MSwgX0lucHV0SXRlcjEgX19sYXN0MSwKICAg ICAgICAgICAgICAgICAgICAgX0lucHV0SXRlcjIgX19maXJzdDIsIF9JbnB1dEl0ZXIyIF9fbGFz dDIsCiAgICAgICAgICAgICAgICAgICAgIF9PdXRwdXRJdGVyIF9fcmVzdWx0KQogICAgewoKICAg ICAKICAgICAKICAgICAKCiAgICAgCgoKICAgICAKCgogICAgICB3aGlsZSAoX19maXJzdDEgIT0g X19sYXN0MSAmJiBfX2ZpcnN0MiAhPSBfX2xhc3QyKQogICAgICAgIGlmICgqX19maXJzdDEgPCAq X19maXJzdDIpCiAgICAgICAgICArK19fZmlyc3QxOwogICAgICAgIGVsc2UgaWYgKCpfX2ZpcnN0 MiA8ICpfX2ZpcnN0MSkKICAgICAgICAgICsrX19maXJzdDI7CiAgICAgICAgZWxzZSB7CiAgICAg ICAgICAqX19yZXN1bHQgPSAqX19maXJzdDE7CiAgICAgICAgICArK19fZmlyc3QxOwogICAgICAg ICAgKytfX2ZpcnN0MjsKICAgICAgICAgICsrX19yZXN1bHQ7CiAgICAgICAgfQogICAgICByZXR1 cm4gX19yZXN1bHQ7CiAgICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9JbnB1dEl0ZXIxLCB0eXBl bmFtZSBfSW5wdXRJdGVyMiwgdHlwZW5hbWUgX091dHB1dEl0ZXIsCiAgICAgICAgICAgdHlwZW5h bWUgX0NvbXBhcmU+CiAgICBfT3V0cHV0SXRlcgogICAgc2V0X2ludGVyc2VjdGlvbihfSW5wdXRJ dGVyMSBfX2ZpcnN0MSwgX0lucHV0SXRlcjEgX19sYXN0MSwKICAgICAgICAgICAgICAgICAgICAg X0lucHV0SXRlcjIgX19maXJzdDIsIF9JbnB1dEl0ZXIyIF9fbGFzdDIsCiAgICAgICAgICAgICAg ICAgICAgIF9PdXRwdXRJdGVyIF9fcmVzdWx0LCBfQ29tcGFyZSBfX2NvbXApCiAgICB7CgogICAg IAogICAgIAogICAgIAoKCiAgICAgCgogICAgIAoKCgogICAgICB3aGlsZSAoX19maXJzdDEgIT0g X19sYXN0MSAmJiBfX2ZpcnN0MiAhPSBfX2xhc3QyKQogICAgICAgIGlmIChfX2NvbXAoKl9fZmly c3QxLCAqX19maXJzdDIpKQogICAgICAgICAgKytfX2ZpcnN0MTsKICAgICAgICBlbHNlIGlmIChf X2NvbXAoKl9fZmlyc3QyLCAqX19maXJzdDEpKQogICAgICAgICAgKytfX2ZpcnN0MjsKICAgICAg ICBlbHNlIHsKICAgICAgICAgICpfX3Jlc3VsdCA9ICpfX2ZpcnN0MTsKICAgICAgICAgICsrX19m aXJzdDE7CiAgICAgICAgICArK19fZmlyc3QyOwogICAgICAgICAgKytfX3Jlc3VsdDsKICAgICAg ICB9CiAgICAgIHJldHVybiBfX3Jlc3VsdDsKICAgIH0KCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0lu cHV0SXRlcjEsIHR5cGVuYW1lIF9JbnB1dEl0ZXIyLCB0eXBlbmFtZSBfT3V0cHV0SXRlcj4KICAg IF9PdXRwdXRJdGVyCiAgICBzZXRfZGlmZmVyZW5jZShfSW5wdXRJdGVyMSBfX2ZpcnN0MSwgX0lu cHV0SXRlcjEgX19sYXN0MSwKICAgICAgICAgICAgICAgICAgIF9JbnB1dEl0ZXIyIF9fZmlyc3Qy LCBfSW5wdXRJdGVyMiBfX2xhc3QyLAogICAgICAgICAgICAgICAgICAgX091dHB1dEl0ZXIgX19y ZXN1bHQpCiAgICB7CgogICAgIAogICAgIAogICAgIAoKICAgICAKCgogICAgIAoKCiAgICAgIHdo aWxlIChfX2ZpcnN0MSAhPSBfX2xhc3QxICYmIF9fZmlyc3QyICE9IF9fbGFzdDIpCiAgICAgICAg aWYgKCpfX2ZpcnN0MSA8ICpfX2ZpcnN0MikgewogICAgICAgICAgKl9fcmVzdWx0ID0gKl9fZmly c3QxOwogICAgICAgICAgKytfX2ZpcnN0MTsKICAgICAgICAgICsrX19yZXN1bHQ7CiAgICAgICAg fQogICAgICAgIGVsc2UgaWYgKCpfX2ZpcnN0MiA8ICpfX2ZpcnN0MSkKICAgICAgICAgICsrX19m aXJzdDI7CiAgICAgICAgZWxzZSB7CiAgICAgICAgICArK19fZmlyc3QxOwogICAgICAgICAgKytf X2ZpcnN0MjsKICAgICAgICB9CiAgICAgIHJldHVybiBjb3B5KF9fZmlyc3QxLCBfX2xhc3QxLCBf X3Jlc3VsdCk7CiAgICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9JbnB1dEl0ZXIxLCB0eXBlbmFt ZSBfSW5wdXRJdGVyMiwgdHlwZW5hbWUgX091dHB1dEl0ZXIsCiAgICAgICAgICAgdHlwZW5hbWUg X0NvbXBhcmU+CiAgICBfT3V0cHV0SXRlcgogICAgc2V0X2RpZmZlcmVuY2UoX0lucHV0SXRlcjEg X19maXJzdDEsIF9JbnB1dEl0ZXIxIF9fbGFzdDEsCiAgICAgICAgICAgICAgICAgICBfSW5wdXRJ dGVyMiBfX2ZpcnN0MiwgX0lucHV0SXRlcjIgX19sYXN0MiwKICAgICAgICAgICAgICAgICAgIF9P dXRwdXRJdGVyIF9fcmVzdWx0LCBfQ29tcGFyZSBfX2NvbXApCiAgICB7CgogICAgIAogICAgIAog ICAgIAoKCiAgICAgCgogICAgIAoKCgogICAgICB3aGlsZSAoX19maXJzdDEgIT0gX19sYXN0MSAm JiBfX2ZpcnN0MiAhPSBfX2xhc3QyKQogICAgICAgIGlmIChfX2NvbXAoKl9fZmlyc3QxLCAqX19m aXJzdDIpKSB7CiAgICAgICAgICAqX19yZXN1bHQgPSAqX19maXJzdDE7CiAgICAgICAgICArK19f Zmlyc3QxOwogICAgICAgICAgKytfX3Jlc3VsdDsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAo X19jb21wKCpfX2ZpcnN0MiwgKl9fZmlyc3QxKSkKICAgICAgICAgICsrX19maXJzdDI7CiAgICAg ICAgZWxzZSB7CiAgICAgICAgICArK19fZmlyc3QxOwogICAgICAgICAgKytfX2ZpcnN0MjsKICAg ICAgICB9CiAgICAgIHJldHVybiBjb3B5KF9fZmlyc3QxLCBfX2xhc3QxLCBfX3Jlc3VsdCk7CiAg ICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9JbnB1dEl0ZXIxLCB0eXBlbmFtZSBfSW5wdXRJdGVy MiwgdHlwZW5hbWUgX091dHB1dEl0ZXI+CiAgICBfT3V0cHV0SXRlcgogICAgc2V0X3N5bW1ldHJp Y19kaWZmZXJlbmNlKF9JbnB1dEl0ZXIxIF9fZmlyc3QxLCBfSW5wdXRJdGVyMSBfX2xhc3QxLAog ICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9JbnB1dEl0ZXIyIF9fZmlyc3QyLCBfSW5wdXRJ dGVyMiBfX2xhc3QyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9PdXRwdXRJdGVyIF9f cmVzdWx0KQogICAgewoKICAgICAKICAgICAKICAgICAKCiAgICAgCgoKICAgICAKCgogICAgICB3 aGlsZSAoX19maXJzdDEgIT0gX19sYXN0MSAmJiBfX2ZpcnN0MiAhPSBfX2xhc3QyKQogICAgICAg IGlmICgqX19maXJzdDEgPCAqX19maXJzdDIpIHsKICAgICAgICAgICpfX3Jlc3VsdCA9ICpfX2Zp cnN0MTsKICAgICAgICAgICsrX19maXJzdDE7CiAgICAgICAgICArK19fcmVzdWx0OwogICAgICAg IH0KICAgICAgICBlbHNlIGlmICgqX19maXJzdDIgPCAqX19maXJzdDEpIHsKICAgICAgICAgICpf X3Jlc3VsdCA9ICpfX2ZpcnN0MjsKICAgICAgICAgICsrX19maXJzdDI7CiAgICAgICAgICArK19f cmVzdWx0OwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICsrX19maXJzdDE7CiAg ICAgICAgICArK19fZmlyc3QyOwogICAgICAgIH0KICAgICAgcmV0dXJuIGNvcHkoX19maXJzdDIs IF9fbGFzdDIsIGNvcHkoX19maXJzdDEsIF9fbGFzdDEsIF9fcmVzdWx0KSk7CiAgICB9CgogIHRl bXBsYXRlPHR5cGVuYW1lIF9JbnB1dEl0ZXIxLCB0eXBlbmFtZSBfSW5wdXRJdGVyMiwgdHlwZW5h bWUgX091dHB1dEl0ZXIsCiAgICAgICAgICAgdHlwZW5hbWUgX0NvbXBhcmU+CiAgICBfT3V0cHV0 SXRlcgogICAgc2V0X3N5bW1ldHJpY19kaWZmZXJlbmNlKF9JbnB1dEl0ZXIxIF9fZmlyc3QxLCBf SW5wdXRJdGVyMSBfX2xhc3QxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9JbnB1dEl0 ZXIyIF9fZmlyc3QyLCBfSW5wdXRJdGVyMiBfX2xhc3QyLAogICAgICAgICAgICAgICAgICAgICAg ICAgICAgIF9PdXRwdXRJdGVyIF9fcmVzdWx0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAg IF9Db21wYXJlIF9fY29tcCkKICAgIHsKCiAgICAgCiAgICAgCiAgICAgCgoKICAgICAKCiAgICAg CgoKCiAgICAgIHdoaWxlIChfX2ZpcnN0MSAhPSBfX2xhc3QxICYmIF9fZmlyc3QyICE9IF9fbGFz dDIpCiAgICAgICAgaWYgKF9fY29tcCgqX19maXJzdDEsICpfX2ZpcnN0MikpIHsKICAgICAgICAg ICpfX3Jlc3VsdCA9ICpfX2ZpcnN0MTsKICAgICAgICAgICsrX19maXJzdDE7CiAgICAgICAgICAr K19fcmVzdWx0OwogICAgICAgIH0KICAgICAgICBlbH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dCAhPSBfX2xhc3QpCiAgICAgICAgaWYgKF9fY29tcCgq X19maXJzdCwgKl9fcmVzdWx0KSkKICAgICAgICAgIF9fcmVzdWx0ID0gX19maXJzdDsKICAgICAg cmV0dXJuIF9fcmVzdWx0OwogICAgfQoKCgoKICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQmlkaXJlY3Rp b25hbEl0ZXI+CiAgICBib29sCiAgICBuZXh0X3Blcm11dGF0aW9uKF9CaWRpcmVjdGlvbmFsSXRl ciBfX2ZpcnN0LCBfQmlkaXJlY3Rpb25hbEl0ZXIgX19sYXN0KQogICAgewoKICAgICAKICAgICAK CgogICAgICBpZiAoX19maXJzdCA9PSBfX2xhc3QpCiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAg ICBfQmlkaXJlY3Rpb25hbEl0ZXIgX19pID0gX19maXJzdDsKICAgICAgKytfX2k7CiAgICAgIGlm IChfX2kgPT0gX19sYXN0KQogICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgX19pID0gX19sYXN0 OwogICAgICAtLV9faTsKCiAgICAgIGZvcig7OykgewogICAgICAgIF9CaWRpcmVjdGlvbmFsSXRl ciBfX2lpID0gX19pOwogICAgICAgIC0tX19pOwogICAgICAgIGlmICgqX19pIDwgKl9faWkpIHsK ICAgICAgICAgIF9CaWRpcmVjdGlvbmFsSXRlciBfX2ogPSBfX2xhc3Q7CiAgICAgICAgICB3aGls ZSAoISgqX19pIDwgKi0tX19qKSkKICAgICAgICAgICAge30KICAgICAgICAgIGl0ZXJfc3dhcChf X2ksIF9faik7CiAgICAgICAgICByZXZlcnNlKF9faWksIF9fbGFzdCk7CiAgICAgICAgICByZXR1 cm4gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgaWYgKF9faSA9PSBfX2ZpcnN0KSB7CiAgICAgICAg ICByZXZlcnNlKF9fZmlyc3QsIF9fbGFzdCk7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAg ICAgfQogICAgICB9CiAgICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9CaWRpcmVjdGlvbmFsSXRl ciwgdHlwZW5hbWUgX0NvbXBhcmU+CiAgICBib29sCiAgICBuZXh0X3Blcm11dGF0aW9uKF9CaWRp cmVjdGlvbmFsSXRlciBfX2ZpcnN0LCBfQmlkaXJlY3Rpb25hbEl0ZXIgX19sYXN0LAogICAgICAg ICAgICAgICAgICAgICBfQ29tcGFyZSBfX2NvbXApCiAgICB7CgogICAgIAogICAgIAoKCgogICAg ICBpZiAoX19maXJzdCA9PSBfX2xhc3QpCiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICBfQmlk aXJlY3Rpb25hbEl0ZXIgX19pID0gX19maXJzdDsKICAgICAgKytfX2k7CiAgICAgIGlmIChfX2kg PT0gX19sYXN0KQogICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgX19pID0gX19sYXN0OwogICAg ICAtLV9faTsKCiAgICAgIGZvcig7OykgewogICAgICAgIF9CaWRpcmVjdGlvbmFsSXRlciBfX2lp ID0gX19pOwogICAgICAgIC0tX19pOwogICAgICAgIGlmIChfX2NvbXAoKl9faSwgKl9faWkpKSB7 CiAgICAgICAgICBfQmlkaXJlY3Rpb25hbEl0ZXIgX19qID0gX19sYXN0OwogICAgICAgICAgd2hp bGUgKCFfX2NvbXAoKl9faSwgKi0tX19qKSkKICAgICAgICAgICAge30KICAgICAgICAgIGl0ZXJf c3dhcChfX2ksIF9faik7CiAgICAgICAgICByZXZlcnNlKF9faWksIF9fbGFzdCk7CiAgICAgICAg ICByZXR1cm4gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgaWYgKF9faSA9PSBfX2ZpcnN0KSB7CiAg ICAgICAgICByZXZlcnNlKF9fZmlyc3QsIF9fbGFzdCk7CiAgICAgICAgICByZXR1cm4gZmFsc2U7 CiAgICAgICAgfQogICAgICB9CiAgICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9CaWRpcmVjdGlv bmFsSXRlcj4KICAgIGJvb2wKICAgIHByZXZfcGVybXV0YXRpb24oX0JpZGlyZWN0aW9uYWxJdGVy IF9fZmlyc3QsIF9CaWRpcmVjdGlvbmFsSXRlciBfX2xhc3QpCiAgICB7CgogICAgIAogICAgIAoK CiAgICAgIGlmIChfX2ZpcnN0ID09IF9fbGFzdCkKICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAg IF9CaWRpcmVjdGlvbmFsSXRlciBfX2kgPSBfX2ZpcnN0OwogICAgICArK19faTsKICAgICAgaWYg KF9faSA9PSBfX2xhc3QpCiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICBfX2kgPSBfX2xhc3Q7 CiAgICAgIC0tX19pOwoKICAgICAgZm9yKDs7KSB7CiAgICAgICAgX0JpZGlyZWN0aW9uYWxJdGVy IF9faWkgPSBfX2k7CiAgICAgICAgLS1fX2k7CiAgICAgICAgaWYgKCpfX2lpIDwgKl9faSkgewog ICAgICAgICAgX0JpZGlyZWN0aW9uYWxJdGVyIF9faiA9IF9fbGFzdDsKICAgICAgICAgIHdoaWxl ICghKCotLV9faiA8ICpfX2kpKQogICAgICAgICAgICB7fQogICAgICAgICAgaXRlcl9zd2FwKF9f aSwgX19qKTsKICAgICAgICAgIHJldmVyc2UoX19paSwgX19sYXN0KTsKICAgICAgICAgIHJldHVy biB0cnVlOwogICAgICAgIH0KICAgICAgICBpZiAoX19pID09IF9fZmlyc3QpIHsKICAgICAgICAg IHJldmVyc2UoX19maXJzdCwgX19sYXN0KTsKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAg ICB9CiAgICAgIH0KICAgIH0KCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0JpZGlyZWN0aW9uYWxJdGVy LCB0eXBlbmFtZSBfQ29tcGFyZT4KICAgIGJvb2wKICAgIHByZXZfcGVybXV0YXRpb24oX0JpZGly ZWN0aW9uYWxJdGVyIF9fZmlyc3QsIF9CaWRpcmVjdGlvbmFsSXRlciBfX2xhc3QsCiAgICAgICAg ICAgICAgICAgICAgIF9Db21wYXJlIF9fY29tcCkKICAgIHsKCiAgICAgCiAgICAgCgoKCiAgICAg IGlmIChfX2ZpcnN0ID09IF9fbGFzdCkKICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgIF9CaWRp cmVjdGlvbmFsSXRlciBfX2kgPSBfX2ZpcnN0OwogICAgICArK19faTsKICAgICAgaWYgKF9faSA9 PSBfX2xhc3QpCiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICBfX2kgPSBfX2xhc3Q7CiAgICAg IC0tX19pOwoKICAgICAgZm9yKDs7KSB7CiAgICAgICAgX0JpZGlyZWN0aW9uYWxJdGVyIF9faWkg PSBfX2k7CiAgICAgICAgLS1fX2k7CiAgICAgICAgaWYgKF9fY29tcCgqX19paSwgKl9faSkpIHsK ICAgICAgICAgIF9CaWRpcmVjdGlvbmFsSXRlciBfX2ogPSBfX2xhc3Q7CiAgICAgICAgICB3aGls ZSAoIV9fY29tcCgqLS1fX2osICpfX2kpKQogICAgICAgICAgICB7fQogICAgICAgICAgaXRlcl9z d2FwKF9faSwgX19qKTsKICAgICAgICAgIHJldmVyc2UoX19paSwgX19sYXN0KTsKICAgICAgICAg IHJldHVybiB0cnVlOwogICAgICAgIH0KICAgICAgICBpZiAoX19pID09IF9fZmlyc3QpIHsKICAg ICAgICAgIHJldmVyc2UoX19maXJzdCwgX19sYXN0KTsKICAgICAgICAgIHJldHVybiBmYWxzZTsK ICAgICAgICB9CiAgICAgIH0KICAgIH0KCgoKICB0ZW1wbGF0ZTx0eXBlbmFtZSBfSW5wdXRJdGVy LCB0eXBlbmFtZSBfRm9yd2FyZEl0ZXI+CiAgICBfSW5wdXRJdGVyCiAgICBmaW5kX2ZpcnN0X29m KF9JbnB1dEl0ZXIgX19maXJzdDEsIF9JbnB1dEl0ZXIgX19sYXN0MSwKICAgICAgICAgICAgICAg ICAgX0ZvcndhcmRJdGVyIF9fZmlyc3QyLCBfRm9yd2FyZEl0ZXIgX19sYXN0MikKICAgIHsKCiAg ICAgCiAgICAgC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W1wdHlfcmVwKCkuX01fcmVmY29w eSgpOwoKICAgICAgICBfQ2hhclQgX19idWZbMTAwXTsKICAgICAgICBzaXplX3R5cGUgX19pID0g MDsKICAgICAgICB3aGlsZSAoX19iZWcgIT0gX19lbmQgJiYgX19pIDwgc2l6ZW9mKF9fYnVmKSAv IHNpemVvZihfQ2hhclQpKQogICAgICAgICAgewogICAgICAgICAgICBfX2J1ZltfX2krK10gPSAq X19iZWc7CiAgICAgICAgICAgICsrX19iZWc7CiAgICAgICAgICB9CiAgICAgICAgX1JlcCogX19y ID0gX1JlcDo6X1NfY3JlYXRlKF9faSwgX19hKTsKICAgICAgICB0cmFpdHNfdHlwZTo6Y29weShf X3ItPl9NX3JlZmRhdGEoKSwgX19idWYsIF9faSk7CiAgICAgICAgX19yLT5fTV9sZW5ndGggPSBf X2k7CiAgICAgICAgdHJ5CiAgICAgICAgICB7CgoKCiAgICAgICAgICAgIGZvciAoOzspCiAgICAg ICAgICAgICAgewogICAgICAgICAgICAgICAgX0NoYXJUKiBfX3AgPSBfX3ItPl9NX3JlZmRhdGEo KSArIF9fci0+X01fbGVuZ3RoOwogICAgICAgICAgICAgICAgX0NoYXJUKiBfX2xhc3QgPSBfX3It Pl9NX3JlZmRhdGEoKSArIF9fci0+X01fY2FwYWNpdHk7CiAgICAgICAgICAgICAgICBmb3IgKDs7 KQogICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWYgKF9fYmVnID09IF9f ZW5kKQogICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBfX3It Pl9NX2xlbmd0aCA9IF9fcCAtIF9fci0+X01fcmVmZGF0YSgpOwogICAgICAgICAgICAgICAgICAg ICAgICAqX19wID0gX1JlcDo6X1NfdGVybWluYWw7CiAgICAgICAgICAgICAgICAgICAgICAgIHJl dHVybiBfX3ItPl9NX3JlZmRhdGEoKTsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAg ICAgICAgICAgICBpZiAoX19wID09IF9fbGFzdCkKICAgICAgICAgICAgICAgICAgICAgIGJyZWFr OwogICAgICAgICAgICAgICAgICAgICpfX3ArKyA9ICpfX2JlZzsKICAgICAgICAgICAgICAgICAg ICArK19fYmVnOwogICAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgc2l6ZV90eXBl IF9fbGVuID0gX19wIC0gX19yLT5fTV9yZWZkYXRhKCk7CiAgICAgICAgICAgICAgICBfUmVwKiBf X2Fub3RoZXIgPSBfUmVwOjpfU19jcmVhdGUoX19sZW4gKyAxLCBfX2EpOwogICAgICAgICAgICAg ICAgdHJhaXRzX3R5cGU6OmNvcHkoX19hbm90aGVyLT5fTV9yZWZkYXRhKCksCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBfX3ItPl9NX3JlZmRhdGEoKSwgX19sZW4pOwogICAgICAg ICAgICAgICAgX19yLT5fTV9kZXN0cm95KF9fYSk7CiAgICAgICAgICAgICAgICBfX3IgPSBfX2Fu b3RoZXI7CiAgICAgICAgICAgICAgICBfX3ItPl9NX2xlbmd0aCA9IF9fbGVuOwogICAgICAgICAg ICAgIH0KICAgICAgICAgIH0KICAgICAgICBjYXRjaCguLi4pCiAgICAgICAgICB7CiAgICAgICAg ICAgIF9fci0+X01fZGVzdHJveShfX2EpOwogICAgICAgICAgICB0aHJvdzsKICAgICAgICAgIH0K ICAgICAgICByZXR1cm4gMDsKICAgICAgfQoKICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hhclQsIHR5 cGVuYW1lIF9UcmFpdHMsIHR5cGVuYW1lIF9BbGxvYz4KICAgIHRlbXBsYXRlIDxjbGFzcyBfSW5J dGVyPgogICAgICBfQ2hhclQqCiAgICAgIGJhc2ljX3N0cmluZzxfQ2hhclQsIF9UcmFpdHMsIF9B bGxvYz46OgogICAgICBfU19jb25zdHJ1Y3QoX0luSXRlciBfX2JlZywgX0luSXRlciBfX2VuZCwg Y29uc3QgX0FsbG9jJiBfX2EsCiAgICAg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X1NfY29uc3Ry dWN0KHNpemVfdHlwZSBfX24sIF9DaGFyVCBfX2MsIGNvbnN0IF9BbGxvYyYgX19hKQogICAgewog ICAgICBpZiAoX19uID09IDAgJiYgX19hID09IF9BbGxvYygpKQogICAgICAgIHJldHVybiBfU19l bXB0eV9yZXAoKS5fTV9yZWZjb3B5KCk7CgoKICAgICAgX1JlcCogX19yID0gX1JlcDo6X1NfY3Jl YXRlKF9fbiwgX19hKTsKICAgICAgdHJ5CiAgICAgICAgewogICAgICAgICAgaWYgKF9fbikKICAg ICAgICAgICAgdHJhaXRzX3R5cGU6OmFzc2lnbihfX3ItPl9NX3JlZmRhdGEoKSwgX19uLCBfX2Mp OwogICAgICAgIH0KICAgICAgY2F0Y2goLi4uKQogICAgICAgIHsKICAgICAgICAgIF9fci0+X01f ZGVzdHJveShfX2EpOwogICAgICAgICAgdGhyb3c7CiAgICAgICAgfQogICAgICBfX3ItPl9NX2xl bmd0aCA9IF9fbjsKICAgICAgX19yLT5fTV9yZWZkYXRhKClbX19uXSA9IF9SZXA6Ol9TX3Rlcm1p bmFsOwogICAgICByZXR1cm4gX19yLT5fTV9yZWZkYXRhKCk7CiAgICB9CgogIHRlbXBsYXRlPHR5 cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cywgdHlwZW5hbWUgX0FsbG9jPgogICAgYmFz aWNfc3RyaW5nPF9DaGFyVCwgX1RyYWl0cywgX0FsbG9jPjo6CiAgICBiYXNpY19zdHJpbmcoY29u c3QgYmFzaWNfc3RyaW5nJiBfX3N0cikKICAgIDogX01fZGF0YXBsdXMoX19zdHIuX01fcmVwKCkt Pl9NX2dyYWIoX0FsbG9jKCksIF9fc3RyLmdldF9hbGxvY2F0b3IoKSksCiAgICAgICAgICAgICAg ICAgX19zdHIuZ2V0X2FsbG9jYXRvcigpKQogICAgeyB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9D aGFyVCwgdHlwZW5hbWUgX1RyYWl0cywgdHlwZW5hbWU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aGFyVCogX19zcmMgPSBfTV9kYXRh KCkgKyBfX3BvcyArIF9fbGVuMTsKICAgICAgY29uc3Qgc2l6ZV90eXBlIF9faG93X211Y2ggPSBf X29sZF9zaXplIC0gX19wb3MgLSBfX2xlbjE7CgogICAgICBpZiAoX01fcmVwKCktPl9NX2lzX3No YXJlZCgpIHx8IF9fbmV3X3NpemUgPiBjYXBhY2l0eSgpKQogICAgICAgIHsKCiAgICAgICAgICBh bGxvY2F0b3JfdHlwZSBfX2EgPSBnZXRfYWxsb2NhdG9yKCk7CgoKICAgICAgICAgIGNvbnN0IHNp emVfdHlwZSBfX3BhZ2VzaXplID0gNDA5NjsKICAgICAgICAgIGNvbnN0IHNpemVfdHlwZSBfX21h bGxvY19oZWFkZXJfc2l6ZSA9IDQgKiBzaXplb2YgKHZvaWQqKTsKCiAgICAgICAgICBjb25zdCBz aXplX3R5cGUgX19wYWdlX2NhcGFjaXR5ID0gKF9fcGFnZXNpemUgLSBfX21hbGxvY19oZWFkZXJf c2l6ZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHNpemVv ZihfUmVwKSAtIHNpemVvZihfQ2hhclQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAvIHNpemVvZihfQ2hhclQpOwogICAgICAgICAgX1JlcCogX19yOwogICAg ICAgICAgaWYgKF9fbmV3X3NpemUgPiBjYXBhY2l0eSgpICYmIF9fbmV3X3NpemUgPiBfX3BhZ2Vf Y2FwYWNpdHkpCgogICAgICAgICAgICBfX3IgPSBfUmVwOjpfU19jcmVhdGUoX19uZXdfc2l6ZSA+ IDIqY2FwYWNpdHkoKSA/CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX25ld19z aXplIDogMipjYXBhY2l0eSgpLCBfX2EpOwogICAgICAgICAgZWxzZQogICAgICAgICAgICBfX3Ig PSBfUmVwOjpfU19jcmVhdGUoX19uZXdfc2l6ZSwgX19hKTsKICAgICAgICAgIHRyeQogICAgICAg ICAgICB7CiAgICAgICAgICAgICAgaWYgKF9fcG9zKQogICAgICAgICAgICAgICAgdHJhaXRzX3R5 cGU6OmNvcHkoX19yLT5fTV9yZWZkYXRhKCksIF9NX2RhdGEoKSwgX19wb3MpOwogICAgICAgICAg ICAgIGlmIChfX2hvd19tdWNoKQogICAgICAgICAgICAgICAgdHJhaXRzX3R5cGU6OmNvcHkoX19y LT5fTV9yZWZkYXRhKCkgKyBfX3BvcyArIF9fbGVuMiwKICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIF9fc3JjLCBfX2hvd19tdWNoKTsKICAgICAgICAgICAgfQogICAgICAgICAgY2F0 Y2goLi4uKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgX19yLT5fTV9kaXNwb3NlKGdldF9h bGxvY2F0b3IoKSk7CiAgICAgICAgICAgICAgdGhyb3c7CiAgICAgICAgICAgIH0KICAgICAgICAg IF9NX3JlcCgpLT5fTV9kaXNwb3NlKF9fYSk7CiAgICAgICAgICBfTV9kYXRhKF9fci0+X01fcmVm ZGF0YSgpKTsKICAgICAgfQogICAgICBlbHNlIGlmIChfX2hvd19tdWNoICYmIF9fbGVuMSAhPSBf X2xlbjIpCiAgICAgICAgewoKICAgICAgICAgIHRyYWl0c190eXBlOjptb3ZlKF9NX2RhdGEoKSAr IF9fcG9zICsgX19sZW4yLCBfX3NyYywgX19ob3dfbXVjaCk7CiAgICAgICAgfQogICAgICBfTV9y ZXAoKS0+X01fc2V0X3NoYXJhYmxlKCk7CiAgICAgIF9NX3JlcCgpLT5fTV9sZW5ndGggPSBfX25l d19zaXplOwogICAgICBfTV9kYXRhKClbX19uZXdfc2l6ZV0gPSBfUmVwOjpfU190ZXJtaW5hbDsK CiAgICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cywgdHlw ZW5hbWUgX0FsbG9jPgogICAgdm9pZAogICAgYmFzaWNfc3RyaW5n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CgoKCgogICAgICBzaXplX3Qg X19zaXplID0gKF9fY2FwYWNpdHkgKyAxKSAqIHNpemVvZihfQ2hhclQpICsgc2l6ZW9mKF9SZXAp OwojIDQyMSAiL3Vzci9pbmNsdWRlL2crKy9iaXRzL2Jhc2ljX3N0cmluZy50Y2MiIDMKICAgICAg Y29uc3Qgc2l6ZV90IF9fcGFnZXNpemUgPSA0MDk2OwogICAgICBjb25zdCBzaXplX3QgX19zdWJw YWdlc2l6ZSA9IDEyODsKICAgICAgY29uc3Qgc2l6ZV90IF9fbWFsbG9jX2hlYWRlcl9zaXplID0g NCAqIHNpemVvZiAodm9pZCopOwogICAgICBpZiAoKF9fc2l6ZSArIF9fbWFsbG9jX2hlYWRlcl9z aXplKSA+IF9fcGFnZXNpemUpCiAgICAgICAgewogICAgICAgICAgc2l6ZV90IF9fZXh0cmEgPQog ICAgICAgICAgICAoX19wYWdlc2l6ZSAtICgoX19zaXplICsgX19tYWxsb2NfaGVhZGVyX3NpemUp ICUgX19wYWdlc2l6ZSkpCiAgICAgICAgICAgICUgX19wYWdlc2l6ZTsKICAgICAgICAgIF9fY2Fw YWNpdHkgKz0gX19leHRyYSAvIHNpemVvZihfQ2hhclQpOwogICAgICAgICAgX19zaXplID0gKF9f Y2FwYWNpdHkgKyAxKSAqIHNpemVvZihfQ2hhclQpICsgc2l6ZW9mKF9SZXApOwogICAgICAgIH0K ICAgICAgZWxzZSBpZiAoX19zaXplID4gX19zdWJwYWdlc2l6ZSkKICAgICAgICB7CiAgICAgICAg ICBzaXplX3QgX19leHRyYSA9CiAgICAgICAgICAgIChfX3N1YnBhZ2VzaXplIC0gKChfX3NpemUg KyBfX21hbGxvY19oZWFkZXJfc2l6ZSkgJSBfX3N1YnBhZ2VzaXplKSkKICAgICAgICAgICAgJSBf X3N1YnBhZ2VzaXplOwogICAgICAgICAgX19jYXBhY2l0eSArPSBfX2V4dHJhIC8gc2l6ZW9mKF9D aGFyVCk7CiAgICAgICAgICBfX3NpemUgPSAoX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XRlcmF0b3IgX19pMSwgaXRlcmF0b3Ig X19pMiwgX0ZvcndhcmRJdGVyIF9fazEsCiAgICAgICAgICAgICAgICAgICAgICBfRm9yd2FyZEl0 ZXIgX19rMikKICAgICAgewogICAgICAgIHNpemVfdHlwZSBfX2RuZXcgPSBzdGF0aWNfY2FzdDxz aXplX3R5cGU+KGRpc3RhbmNlKF9fazEsIF9fazIpKTsKICAgICAgICBzaXplX3R5cGUgX19kb2xk ID0gX19pMiAtIF9faTE7CiAgICAgICAgc2l6ZV90eXBlIF9fZG1heCA9IHRoaXMtPm1heF9zaXpl KCk7CgogICAgICAgIGlmIChfX2RtYXggPD0gX19kbmV3KQogICAgICAgICAgX190aHJvd19sZW5n dGhfZXJyb3IoImJhc2ljX3N0cmluZzo6X01fcmVwbGFjZSIpOwogICAgICAgIHNpemVfdHlwZSBf X29mZiA9IF9faTEgLSBfTV9pYmVnaW4oKTsKICAgICAgICBfTV9tdXRhdGUoX19vZmYsIF9fZG9s ZCwgX19kbmV3KTsKCgogICAgICAgIGlmIChfX2RuZXcpCiAgICAgICAgICBfU19jb3B5X2NoYXJz KF9NX2RhdGEoKSArIF9fb2ZmLCBfX2sxLCBfX2syKTsKCiAgICAgICAgcmV0dXJuICp0aGlzOwog ICAgICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cywgdHlw ZW5hbWUgX0FsbG9jPgogICAgYmFzaWNfc3RyaW5nPF9DaGFyVCwgX1RyYWl0cywgX0FsbG9jPiYK ICAgIGJhc2ljX3N0cmluZzxfQ2hhclQsIF9UcmFpdHMsIF9BbGxvYz46OgogICAgcmVwbGFjZShz aXplX3R5cGUgX19wb3MxLCBzaXplX3R5cGUgX19uMSwgY29uc3QgYmFzaWNfc3RyaW5nJiBfX3N0 ciwKICAgICAgICAgICAgc2l6ZV90eXBlIF9fcG9zMiwgc2l6ZV90eXBlIF9fbjIpCiAgICB7CiAg ICAgIGNvbnN0IHNpem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gdGhpcy0+c2l6ZSgpOwogICAgICBzaXplX3R5cGUgX19yZXQgPSBucG9zOwogICAgICBp ZiAoX19wb3MgPCBfX3NpemUpCiAgICAgICAgewogICAgICAgICAgY29uc3QgX0NoYXJUKiBfX2Rh dGEgPSBfTV9kYXRhKCk7CiAgICAgICAgICBzaXplX3R5cGUgX19uID0gX19zaXplIC0gX19wb3M7 CiAgICAgICAgICBjb25zdCBfQ2hhclQqIF9fcCA9IHRyYWl0c190eXBlOjpmaW5kKF9fZGF0YSAr IF9fcG9zLCBfX24sIF9fYyk7CiAgICAgICAgICBpZiAoX19wKQogICAgICAgICAgICBfX3JldCA9 IF9fcCAtIF9fZGF0YTsKICAgICAgICB9CiAgICAgIHJldHVybiBfX3JldDsKICAgIH0KCgogIHRl bXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cywgdHlwZW5hbWUgX0FsbG9j PgogICAgdHlwZW5hbWUgYmFzaWNfc3RyaW5nPF9DaGFyVCwgX1RyYWl0cywgX0FsbG9jPjo6c2l6 ZV90eXBlCiAgICBiYXNpY19zdHJpbmc8X0NoYXJULCBfVHJhaXRzLCBfQWxsb2M+OjoKICAgIHJm aW5kKGNvbnN0IF9DaGFyVCogX19zLCBzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX24pIGNv bnN0CiAgICB7CiAgICAgIHNpemVfdHlwZSBfX3NpemUgPSB0aGlzLT5zaXplKCk7CiAgICAgIGlm IChfX24gPD0gX19zaXplKQogICAgICAgIHsKICAgICAgICAgIF9fcG9zID0gc3RkOjptaW4oX19z aXplIC0gX19uLCBfX3Bvcyk7CiAgICAgICAgICBjb25zdCBfQ2hhclQqIF9fZGF0YSA9IF9NX2Rh dGEoKTsKICAgICAgICAgIGRvCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICBpZiAodHJhaXRz X3R5cGU6OmNvbXBhcmUoX19kYXRhICsgX19wb3MsIF9fcywgX19uKSA9PSAwKQogICAgICAgICAg ICAgICAgcmV0dXJuIF9fcG9zOwogICAgICAgICAgICB9CiAgICAgICAgICB3aGlsZSAoX19wb3Mt LSA+IDApOwogICAgICAgIH0KICAgICAgcmV0dXJuIG5wb3M7CiAgICB9CgogIHRlbXBsYXRlPHR5 cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cywgdHlwZW5hbWUgX0FsbG9jPgogICAgdHlw ZW5hbWUgYmFzaWNfc3RyaW5nPF9DaGFyVCwgX1RyYWl0cywgX0FsbG9jPjo6c2l6ZV90eXBlCiAg ICBiYXNpY19zdHJpbmc8X0NoYXJULCBfVHJhaXRzLCBfQWxsb2M+OjoKICAgIHJmaW5kKF9DaGFy VCBfX2MsIHNpemVfdHlwZSBfX3BvcykgY29uc3QKICAgIHsKICAgICAgc2l6ZV90eXBlIF9fc2l6 ZSA9IHRoaXMtPnNpemUoKTsKICAgICAgaWYgKF9fc2l6ZSkKICAgICAgICB7CiAgICAgICAgICBz aXplX3QgX194cG9zID0gX19zaXplIC0gMTsKICAgICAgICAgIGlmIChfX3hwb3MgPiBfX3BvcykK ICAgICAgICAgICAgX194cG9zID0gX19wb3M7CgogICAgICAgICAgZm9yICgrK19feHBvczsgX194 cG9zLS0gPiAwOyApCiAgICAgICAgICAgIGlmICh0cmFpdHNfdHlwZTo6ZXEoX01fZGF0YSgpW19f eHBvc10sIF9fYykpCiAgICAgICAgICAgICAgcmV0dXJuIF9feHBvczsKICAgICAgICB9CiAgICAg IHJldHVybiBucG9zOwogICAgfQoKICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hhclQsIHR5cGVuYW1l IF9UcmFpdHMsIHR5cGVuYW1lIF9BbGxvYz4KICAgIHR5cGVuYW1lIGJhc2ljX3N0cmluZzxfQ2hh clQsIF9UcmFpdHMsIF9BbGxvYz46OnNpemVfdHlwZQogICAgYmFzaWNfc3RyaW5nPF9DaGFyVCwg X1RyYWl0cywgX0FsbG9jPjo6CiAgICBmaW5kX2ZpcnN0X29mKGNvbnN0IF9DaGFyVCogX19zLCBz aXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX24pIGNvbnN0CiAgICB7CiAgICAgIGZvciAoOyBf X24gJiYgX19wb3MgPCB0aGlzLT5zaXplKCk7ICsrX19wb3MpCiAgICAgICAgewogICAgICAgICAg Y29uc3QgX0NoYXJUKiBfX3AgPSB0cmFpdHNfdHlwZTo6ZmluZChfX3MsIF9fbiwgX01fZGF0YSgp W19fcG9zXSk7CiAgICAgICAgICBpZiAoX19wKQogICAgICAgICAgICByZXR1cm4gX19wb3M7CiAg ICAgICAgfQogICAgICByZXR1cm4gbnBvczsKICAgIH0KCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0No YXJULCB0eXBlbmFtZSBfVHJhaXRzLCB0eXBlbmFtZSBfQWxsb2M+CiAgICB0eXBlbmFtZSBiYXNp Y19zdHJpbmc8X0NoYXJULCBfVHJhaXRzLCBfQWxsb2M+OjpzaXplX3R5cGUKICAgIGJhc2ljX3N0 cmluZzxfQ2hhclQsIF9UcmFpdHMsIF9BbGxvYz46OgogICAgZmluZF9sYXN0X29mKGNvbnN0IF9D aGFyVCogX19zLCBzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX24pIGNvbnN0CiAgICB7CiAg ICAgIHNpemVfdHlwZSBfX3NpemUgPSB0aGlzLT5zaXplKCk7CiAgICAgIGlmIChfX3NpemUgJiYg X19uKQogICAgICAgIHsKICAgICAgICAgIGlmICgtLV9fc2l6ZSA+IF9fcG9zKQogICAgICAgICAg ICBfX3NpemUgPSBfX3BvczsKICAgICAgICAgIGRvCiAgICAgICAgICAgIHsKICAgICAgICAgICAg ICBpZiAodHJhaXRzX3R5cGU6OmZpbmQoX19zLCBfX24sIF9NX2RhdGEoKVtfX3NpemVdKSkKICAg ICAgICAgICAgICAgIHJldHVybiBfX3NpemU7CiAgICAgICAgICAgIH0KICAgICAgICAgIHdoaWxl IChfX3NpemUtLSAhPSAwKTsKICAgICAgICB9CiAgICA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CiAgICAgICAgICByZXR1cm4gX194cG9zOwogICAgICByZXR1cm4gbnBvczsKICAgIH0KCiAgdGVt cGxhdGU8dHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRzLCB0eXBlbmFtZSBfQWxsb2M+ CiAgICB0eXBlbmFtZSBiYXNpY19zdHJpbmc8X0NoYXJULCBfVHJhaXRzLCBfQWxsb2M+OjpzaXpl X3R5cGUKICAgIGJhc2ljX3N0cmluZzxfQ2hhclQsIF9UcmFpdHMsIF9BbGxvYz46OgogICAgZmlu ZF9sYXN0X25vdF9vZihjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5 cGUgX19uKSBjb25zdAogICAgewogICAgICBzaXplX3R5cGUgX19zaXplID0gdGhpcy0+c2l6ZSgp OwogICAgICBpZiAoX19zaXplKQogICAgICAgIHsKICAgICAgICAgIGlmICgtLV9fc2l6ZSA+IF9f cG9zKQogICAgICAgICAgICBfX3NpemUgPSBfX3BvczsKICAgICAgICAgIGRvCiAgICAgICAgICAg IHsKICAgICAgICAgICAgICBpZiAoIXRyYWl0c190eXBlOjpmaW5kKF9fcywgX19uLCBfTV9kYXRh KClbX19zaXplXSkpCiAgICAgICAgICAgICAgICByZXR1cm4gX19zaXplOwogICAgICAgICAgICB9 CiAgICAgICAgICB3aGlsZSAoX19zaXplLS0pOwogICAgICAgIH0KICAgICAgcmV0dXJuIG5wb3M7 CiAgICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cywgdHlw ZW5hbWUgX0FsbG9jPgogICAgdHlwZW5hbWUgYmFzaWNfc3RyaW5nPF9DaGFyVCwgX1RyYWl0cywg X0FsbG9jPjo6c2l6ZV90eXBlCiAgICBiYXNpY19zdHJpbmc8X0NoYXJULCBfVHJhaXRzLCBfQWxs b2M+OjoKICAgIGZpbmRfbGFzdF9ub3Rfb2YoX0NoYXJUIF9fYywgc2l6ZV90eXBlIF9fcG9zKSBj b25zdAogICAgewogICAgICBzaXplX3R5cGUgX19zaXplID0gdGhpcy0+c2l6ZSgpOwogICAgICBp ZiAoX19zaXplKQogICAgICAgIHsKICAgICAgICAgIGlmICgtLV9fc2l6ZSA+IF9fcG9zKQogICAg ICAgICAgICBfX3NpemUgPSBfX3BvczsKICAgICAgICAgIGRvCiAgICAgICAgICAgIHsKICAgICAg ICAgICAgICBpZiAoIXRyYWl0c190eXBlOjplcShfTV9kYXRhKClbX19zaXplXSwgX19jKSkKICAg ICAgICAgICAgICAgIHJldHVybiBfX3NpemU7CiAgICAgICAgICAgIH0KICAgICAgICAgIHdoaWxl IChfX3NpemUtLSk7CiAgICAgICAgfQogICAgICByZXR1cm4gbnBvczsKICAgIH0KCiAgdGVtcGxh dGU8dHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRzLCB0eXBlbmFtZSBfQWxsb2M+CiAg ICBpbnQKICAgIGJhc2ljX3N0cmluZzxfQ2hhclQsIF9UcmFpdHMsIF9BbGxvYz46OgogICAgY29t cGFyZShzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX24sIGNvbnN0IGJhc2ljX3N0cmluZyYg X19zdHIpIGNvbnN0CiAgICB7CiAgICAgIHNpemVfdHlwZSBfX3NpemUgPSB0aGlzLT5zaXplKCk7 CiAgICAgIHNpemVfdHlwZSBfX29zaXplID0gX19zdHIuc2l6ZSgpOwogICAgICBpZiAoX19wb3Mg PiBfX3NpemUpCiAgICAgICAgX190aHJvd19vdXRfb2ZfcmFuZ2UoImJhc2ljX3N0cmluZzo6Y29t cGFyZSIpOwoKICAgICAgc2l6ZV90eXBlIF9fcnNpemU9IG1pbihfX3NpemUgLSBfX3BvcywgX19u KTsKICAgICAgc2l6ZV90eXBlIF9fbGVuID0gbWluKF9fcnNpemUsIF9fb3NpemUpOwogICAgICBp bnQgX19yID0gdHJhaXRzX3R5cGU6OmNvbXBhcmUoX01fZGF0YSgpICsgX19wb3MsIF9fc3RyLmRh dGEoKSwgX19sZW4pOwogICAgICBpZiAoIV9fcikKICAgICAgICBfX3IgPSBfX3JzaXplIC0gX19v c2l6ZTsKICAgICAgcmV0dXJuIF9fcjsKICAgIH0KCiAgdGVtcGxhdGU8dHlwZW5hbWUgX0NoYXJU LCB0eXBlbmFtZSBfVHJhaXRzLCB0eXBlbmFtZSBfQWxsb2M+CiAgICBpbnQKICAgIGJhc2ljX3N0 cmluZzxfQ2hhclQsIF9UcmFpdHMsIF9BbGxvYz46OgogICAgY29tcGFyZShzaXplX3R5cGUgX19w b3MxLCBzaXplX3R5cGUgX19uMSwgY29uc3QgYmFzaWNfc3RyaW5nJiBfX3N0ciwKICAgICAgICAg ICAgc2l6ZV90eXBlIF9fcG9zMiwgc2l6ZV90eXBlIF9fbjIpIGNvbnN0CiAgICB7CiAgICAgIHNp emVfdHlwZSBfX3NpemUgPSB0aGlzLT5zaXplKCk7CiAgICAgIHNpemVfdHlwZSBfX29zaXplID0g X19zdHIuc2l6ZSgpOwogICAgICBpZiAoX19wb3MxID4gX19zaXplIHx8IF9fcG9zMiA+IF9fb3Np emUpCiAgICAgICAgX190aHJvd19vdXRfb2ZfcmFuZ2UoImJhc2ljX3N0cmluZzo6Y29tcGFyZSIp OwoKICAgICAgc2l6ZV90eXBlIF9fcnNpemUgPSBtaW4oX19zaXplIC0gX19wb3MxLCBfX24xKTsK ICAgICAgc2l6ZV90eXBlIF9fcm9zaXplID0gbWluKF9fb3NpemUgLSBfX3BvczIsIF9fbjIpOwog ICAgICBzaXplX3R5cGUgX19sZW4gPSBtaW4oX19yc2l6ZSwgX19yb3NpemUpOwogICAgICBpbnQg X19yID0gdHJhaXRzX3R5cGU6OmNvbXBhcmUoX01fZGF0YSgpICsgX19wb3MxLAogICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgX19zdHIuZGF0YSgpICsgX19wb3MyLCBfX2xlbik7 CiAgICAgIGlmICghX19yKQogICAgICAgIF9fciA9IF9fcnNp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0aChfX3MpOwogICAgICBzaXplX3R5cGUgX19yc2l6ZSA9IG1pbihfX3NpemUgLSBf X3BvcywgX19uMSk7CiAgICAgIHNpemVfdHlwZSBfX2xlbiA9IG1pbihfX3JzaXplLCBfX29zaXpl KTsKICAgICAgaW50IF9fciA9IHRyYWl0c190eXBlOjpjb21wYXJlKF9NX2RhdGEoKSArIF9fcG9z LCBfX3MsIF9fbGVuKTsKICAgICAgaWYgKCFfX3IpCiAgICAgICAgX19yID0gX19yc2l6ZSAtIF9f b3NpemU7CiAgICAgIHJldHVybiBfX3I7CiAgICB9CgogIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFy VCwgdHlwZW5hbWUgX1RyYWl0cywgdHlwZW5hbWUgX0FsbG9jPgogICAgaW50CiAgICBiYXNpY19z dHJpbmcgPF9DaGFyVCwgX1RyYWl0cywgX0FsbG9jPjo6CiAgICBjb21wYXJlKHNpemVfdHlwZSBf X3Bvcywgc2l6ZV90eXBlIF9fbjEsIGNvbnN0IF9DaGFyVCogX19zLAogICAgICAgICAgICBzaXpl X3R5cGUgX19uMikgY29uc3QKICAgIHsKICAgICAgc2l6ZV90eXBlIF9fc2l6ZSA9IHRoaXMtPnNp emUoKTsKICAgICAgaWYgKF9fcG9zID4gX19zaXplKQogICAgICAgIF9fdGhyb3dfb3V0X29mX3Jh bmdlKCJiYXNpY19zdHJpbmc6OmNvbXBhcmUiKTsKCiAgICAgIHNpemVfdHlwZSBfX29zaXplID0g bWluKHRyYWl0c190eXBlOjpsZW5ndGgoX19zKSwgX19uMik7CiAgICAgIHNpemVfdHlwZSBfX3Jz aXplID0gbWluKF9fc2l6ZSAtIF9fcG9zLCBfX24xKTsKICAgICAgc2l6ZV90eXBlIF9fbGVuID0g bWluKF9fcnNpemUsIF9fb3NpemUpOwogICAgICBpbnQgX19yID0gdHJhaXRzX3R5cGU6OmNvbXBh cmUoX01fZGF0YSgpICsgX19wb3MsIF9fcywgX19sZW4pOwogICAgICBpZiAoIV9fcikKICAgIC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9OwoKdm9pZCBiKCkgdGhyb3cgKCkKewogICAgICAg IGludCB4ID0gMDsKICAgICAgICBzd2l0Y2ggKHgpIHsKICAgICAgICAgICAgICAgIGNhc2UgMDoK ICAgICAgICAgICAgICAgICAgICAgICAgQSBhKCIiKTsKICAgICAgICAgICAgICAgICAgICAgICAg YnJlYWs7CgogICAgICAgICAgICAgICAgZGVmYXVsdDogOwogICAgICAgIH0KfQo=