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TUEgIDAyMTEwLTEzMDEgIFVTQQorICoKKyAqIEF1dGhvcnM6CisgKiAgIFRob21hcyBIZWxsc3Ry9m0gPHRob21hcy1hdC10dW5nc3RlbmdyYXBoaWNzLWRvdC1jb20+CisgKi8KKworI2lmbmRlZiBfVkVSTUlMSU9OX0hfCisjZGVmaW5lIF9WRVJNSUxJT05fSF8KKworI2luY2x1ZGUgPGxpbnV4L2tlcm5lbC5oPgorI2luY2x1ZGUgPGxpbnV4L3ZlcnNpb24uaD4KKyNpbmNsdWRlIDxsaW51eC9wY2kuaD4KKyNpbmNsdWRlIDxhc20vYXRvbWljLmg+CisjaW5jbHVkZSA8bGludXgvbXV0ZXguaD4KKworI2RlZmluZSBWTUxfREVWSUNFX0dQVSAweDUwMDIKKyNkZWZpbmUgVk1MX0RFVklDRV9WREMgMHg1MDA5CisKKyNkZWZpbmUgVk1MX1ZSQU1fQVJFQVMgMworI2RlZmluZSBWTUxfTUFYX1hSRVMgMTAyNAorI2RlZmluZSBWTUxfTUFYX1lSRVMgNzY4CisjZGVmaW5lIFZNTF9NQVhfWFJFU19WSVJUVUFMIDEwNDAKKworLyoKKyAqIERpc3BsYXkgY29udHJvbGxlciByZWdpc3RlcnM6CisgKi8KKworLyogRGlzcGxheSBjb250cm9sbGVyIDEwLWJpdCBjb2xvciByZXByZXNlbnRhdGlvbiAqLworCisjZGVmaW5lIFZNTF9SX01BU0sgICAgICAgICAgICAgICAgICAgMHgzRkYwMDAwMAorI2RlZmluZSBWTUxfUl9TSElGVCAgICAgICAgICAgICAgICAgIDIwCisjZGVmaW5lIFZNTF9HX01BU0sgICAgICAgICAgICAgICAgICAgMHgwMDBGRkMwMAorI2RlZmluZSBWTUxfR19TSElGVCAgICAgICAgICAgICAgICAgIDEwCisjZGVmaW5lIFZNTF9CX01BU0sgICAgICAgICAgICAgICAgICAgMHgwMDAwMDNGRgorI2RlZmluZSBWTUxfQl9TSElGVCAgICAgICAgICAgICAgICAgIDAKKworLyogR3JhcGhpY3M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TkZJR19DTEtfSU5WICAgICAgICAgICAweDAwMDQwMDAwCisjZGVmaW5lIFZNTF9DT05GSUdfQ0xLX0RJVjIgICAgICAgICAgMHgwMDAxMDAwMAorI2RlZmluZSBWTUxfQ09ORklHX0VTVFJCX0lOViAgICAgICAgIDB4MDAwMDgwMDAKKworLyogUGlwZSBBIEhvcml6b250YWwgdG90YWwgcmVnaXN0ZXIgKi8KKyNkZWZpbmUgVk1MX0hUT1RBTF9BICAgICAgICAgICAgICAgICAweDAwMDYwMDAwCisjZGVmaW5lIFZNTF9IVE9UQUxfTUFTSyAgICAgICAgICAgICAgMHgxRkZGMDAwMAorI2RlZmluZSBWTUxfSFRPVEFMX1NISUZUICAgICAgICAgICAgIDE2CisjZGVmaW5lIFZNTF9IVE9UQUxfVkFMICAgICAgICAgICAgICAgODE5MgorI2RlZmluZSBWTUxfSEFDVElWRV9NQVNLICAgICAgICAgICAgIDB4MDAwMDA3RkYKKyNkZWZpbmUgVk1MX0hBQ1RJVkVfU0hJRlQgICAgICAgICAgICAwCisjZGVmaW5lIFZNTF9IQUNUSVZFX1ZBTCAgICAgICAgICAgICAgNDA5NgorCisvKiBQaXBlIEEgSG9yaXpvbnRhbCBCbGFuayByZWdpc3RlciAqLworI2RlZmluZSBWTUxfSEJMQU5LX0EgICAgICAgICAgICAgICAgIDB4MDAwNjAwMDQKKyNkZWZpbmUgVk1MX0hCTEFOS19FTkRfTUFTSyAgICAgICAgICAweDFGRkYwMDAwCisjZGVmaW5lIFZNTF9IQkxBTktfRU5EX1NISUZUICAgICAgICAgMTYKKyNkZWZpbmUgVk1MX0hCTEFOS19FTkRfVkFMICAgICAgICAgICA4MTkyCisjZGVmaW5lIFZNTF9IQkxBTktfU1RBUlRfTUFTSyAgICAgICAgMHgwMDAwMUZGRgorI2RlZmluZSBWTUxfSEJMQU5LX1NUQVJUX1NISUZUICAgICAgIDAKKyNkZWZpbmUgVk1MX0hCTEFOS19TVEFSVF9WQUwgICAgICAgICA4MTkyCisKK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