{"id":324080,"date":"2021-05-31T21:00:17","date_gmt":"2021-05-31T21:00:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=324080"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=324080","title":{"rendered":"Duff&#8217;s device \u0438\u043b\u0438 loop unrolling \u0432 \u0421\u0438 \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c \u0421++ \u043a\u043e\u0434\u043e\u043c? \u0415\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043a\u0430\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b?<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt;  int main() {   int number = 11;        int count  = number \/ 4;   int i = 0;      switch (number % 4) {     case 0:        do {     \t  ++i;     case 3: ++i;     case 2: ++i;     case 1: ++i;       } while (count-- &gt; 0);   }    std::cout &lt;&lt; i; }<\/code><\/pre>\n<p>\u0421 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043a\u0430\u0448\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <em>switch<\/em> \u0438 \u0446\u0438\u043a\u043b <em>do-while<\/em> \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u044b \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u044f\u0437\u044b\u043a\u0430 , \u0437\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0437\u0430\u043a\u043e\u043d\u043d\u043e.<\/p>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0437\u0434\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u043d \u0446\u0438\u043a\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>i <\/em>\u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 <em>number<\/em> \u0440\u0430\u0437, \u0438, \u043a\u0430\u043a \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0447\u0438\u0441\u043b\u043e 11. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u0434 \u0432\u044b\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e &#171;\u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c&#187; \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt;  int main() {   int number = 11;   int i = 0;      while (number-- &gt; 0) {     ++i;   }    std::cout &lt;&lt; i; }<\/code><\/pre>\n<p>\u041d\u043e \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0436\u0435 \u0442\u043e\u0433\u0434\u0430 \u0438\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0438 \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u0442\u044c <em>do-while<\/em> \u0438 <em>switch<\/em>? <\/p>\n<h2>Duff&#8217;s device (\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0414\u0430\u0444\u0444\u0430)<\/h2>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u0435\u043c \u0431\u044b\u043b \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d \u0435\u0449\u0451 \u0432 1983 \u0433\u043e\u0434\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u043f\u043e \u0438\u043c\u0435\u043d\u0438 <em>Tom Duff<\/em>, \u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0421\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0442\u0430\u043a\u0443\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e, \u043a\u0430\u043a <em>loop unrolling<\/em>. <\/p>\n<p>\u0417\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c. \u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0446\u0438\u043a\u043b\u043e\u0432 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f \u043b\u0438 \u0446\u0438\u043a\u043b \u0438 \u043d\u0435 \u043f\u043e\u0440\u0430 \u043b\u0438 \u0438\u0437 \u043d\u0435\u0433\u043e \u0432\u044b\u0439\u0442\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0447\u0442\u043e <em>number<\/em> \u0435\u0449\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433 \u043d\u0443\u043b\u044f. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u044f <em>loop unroling<\/em> (\u0438\u043b\u0438 <em>\u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430<\/em>), \u043c\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0442\u0435\u043c, \u0447\u0442\u043e \u0437\u0430 \u043e\u0434\u043d\u0443 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0435 \u043e\u0434\u043d\u043e \u0442\u0435\u043b\u043e \u0446\u0438\u043a\u043b\u0430, \u0430 \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0442\u0435\u043b\u043e\u043c \u0446\u0438\u043a\u043b\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>i. <\/em>\u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0446\u0438\u043a\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f, \u044f \u0431\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u2014 <em>\u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0446\u0438\u043a\u043b<\/em>.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043d\u0435 \u043e\u0434\u043d\u043e \u0442\u0435\u043b\u043e \u0446\u0438\u043a\u043b\u0430, \u0430 \u0447\u0435\u0442\u044b\u0440\u0435. \u041a\u0430\u043a \u043d\u0430\u043c \u0431\u044b\u0442\u044c \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0435 \u043a\u0440\u0430\u0442\u043d\u043e \u0447\u0435\u0442\u044b\u0440\u0435\u043c? \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u043d\u0430\u0439\u0442\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u0442\u0435\u043b\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430, \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430. \u0422\u043e\u0433\u0434\u0430 \u043d\u0430\u0448 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434,<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt;  int main() {      int number = 11;      int i = 0;         while (number-- &gt; 0) {     ++i;   }         std::cout &lt;&lt; i;  }<\/code><\/pre>\n<p>\u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u043f\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u0435\u043b\u0430 \u0446\u0438\u043a\u043b\u0430 \u0437\u0430 \u0440\u0430\u0437:<\/p>\n<pre><code class=\"cpp\">int main() {   int number = 11; \/\/ \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 = 11.      \/\/ \u0432 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u043e 4 \u0442\u0435\u043b\u0430 \u0446\u0438\u043a\u043b\u0430 \u0437\u0430 \u0440\u0430\u0437.   int count  = number \/ 4; \/\/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430.   int left   = number % 4; \/\/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043d\u0435\u0433\u043e \"\u043d\u0435 \u0432\u043b\u0435\u0437\u043b\u0438\".   int i = 0;      \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \"\u043d\u0435\u0432\u043b\u0435\u0437\u0448\u0438\u0435\" \u0432 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0446\u0438\u043a\u043b \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438   \/\/ \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e \u0446\u0438\u043a\u043b\u0430.   while (left-- &gt; 0) {     i++;   }    \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0446\u0438\u043a\u043b \u043f\u043e 4 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430 \u0440\u0430\u0437.   while (count-- &gt; 0) {     i++;     i++;     i++;     i++;   }        std::cout &lt;&lt; i; }<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u043d\u0435 11 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430, \u043a\u0430\u043a \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0430 <em>number \/ 4 + number % 4<\/em> \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e 5, \u043f\u0440\u0438 <em>number <\/em>\u0440\u0430\u0432\u043d\u043e\u043c<em> 11<\/em>.<\/p>\n<p>\u041d\u043e \u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u043d\u0430 <em>Assembly<\/em> \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0438\u0437\u044f\u0449\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b: \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f <em>jump<\/em> \u043d\u0430 \u0435\u0433\u043e \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439. \u0418 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0414\u0430\u0444\u0444\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0432 \u0421\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0449\u0435 \u0440\u0430\u0437 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435:<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt;  int main() {   int number = 11; \/\/ \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0440\u0430\u0432\u043d\u043e 11.   int count = number \/ 4; \/\/ \u0447\u0438\u0441\u043b\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430.   int i = 0;    \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439   \/\/ \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a \u044d\u0442\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438   \/\/ \u0432\u043d\u0443\u0442\u0440\u044c \u0442\u0435\u043b\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430.   switch (number % 4) {     case 0:        do {           ++i;     case 3: ++i; \/\/ &lt;- \u043d\u0430\u0448 \u0441\u043b\u0443\u0447\u0430\u0439. \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430 \u043d\u0430\u0447\u043d\u0435\u0442\u0441\u044f \u043e\u0442\u0441\u044e\u0434\u0430 \u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u0439     case 2: ++i; \/\/ \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u043d\u0435 \u0447\u0435\u0442\u044b\u0440\u0435, \u0430      case 1: ++i; \/\/ \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0438 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 (11 % 4 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439).       } while (count-- &gt; 0);    }      std::cout &lt;&lt; i; }<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e <em>number \/ 4 <\/em>\u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0434\u0438\u043d\u043d\u0430\u0434\u0446\u0430\u0442\u0438. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <em>switch<\/em> \u0432 \u0421\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 &#171;\u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f&#187; \u0438\u0437 \u0431\u043b\u043e\u043a\u0430 \u043e\u0434\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0438 <em>case<\/em> \u0432 \u0431\u043b\u043e\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>break<\/em>. \u041d\u043e, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043c\u0435\u0442\u043a\u0443 <em>case<\/em> \u043f\u043e\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u0446\u0438\u043a\u043b <em>do-while<\/em> \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u041d\u043e \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043c\u0435\u0442\u043a\u0430 <em>case<\/em> \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 <em>switch,<\/em> \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0437\u0430 \u043d\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e, \u0447\u0442\u043e \u0431\u044b \u0442\u0430\u043c \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c.<\/p>\n<p>\u0412 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0414\u0430\u0444\u0444\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">send(to, from, count) \/\/ to - \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u044b\u0439 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c. \u041e\u043d \u043d\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \/\/ \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0446\u043a\u043b\u0430. \/\/ from - \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 'to' register short *to, *from; register count; {     \/\/ \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0446\u0438\u043a\u043b \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u0441\u044f \u043f\u043e 8 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u0440\u0430\u0437     register n = (count + 7) \/ 8;     switch (count % 8) {     case 0: do { *to = *from++;     case 7:      *to = *from++;     case 6:      *to = *from++;     case 5:      *to = *from++;     case 4:      *to = *from++;     case 3:      *to = *from++;     case 2:      *to = *from++;     case 1:      *to = *from++;             } while (--n &gt; 0);     } }<\/code><\/pre>\n<h2>\u041f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b<\/h2>\n<p>\u0423 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0435\u043c\u0430 \u0435\u0441\u0442\u044c \u043a\u0430\u043a \u043f\u043b\u044e\u0441\u044b, \u0442\u0430\u043a \u0438 \u043c\u0438\u043d\u0443\u0441\u044b. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043f\u043b\u044e\u0441\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u043d\u043e, \u043f\u043e\u043c\u0438\u043c\u043e \u0443\u0445\u0443\u0434\u0448\u0435\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043c\u0438\u043d\u0443\u0441\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u0432\u0435\u0434\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u043d\u0435\u043c \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430. \u041d\u043e \u0442\u0430\u043a \u043b\u0438 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435?<\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0432\u043e \u0447\u0442\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <a href=\"https:\/\/godbolt.org\/\" rel=\"noopener noreferrer nofollow\">Compiler Explorer<\/a>&#8216;\u043e\u043c \u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c gcc 11.1 \u0434\u043b\u044f x86-64 \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0446\u0438\u0439. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u0434\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0435\u0437 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0448 \u0446\u0438\u043a\u043b \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"cpp\">...  ; \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 while ; [rbp-4] - \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f number = 11 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 ; [rbp-8] - \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f i = 0 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435         jmp     .L2  .L3:         add     DWORD PTR [rbp-8], 1    ; \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0438 i \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 .L2:         mov     eax, DWORD PTR [rbp-4]  ; \u043a\u043b\u0430\u0434\u0435\u043c \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 eax \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 number         lea     edx, [rax-1]            ; \u043e\u0442\u043d\u0438\u043c\u0430\u0435\u043c \u043e\u0442 number \u0435\u0434\u0438\u043d\u0438\u0446\u0443         mov     DWORD PTR [rbp-4], edx  ; \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 number-1 \u043d\u0430 \u0441\u0442\u0435\u043a         test    eax, eax                ; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e number \u0435\u0449\u0435 \u043d\u0435 \u0441\u0442\u0430\u043b 0         jg      .L3                     ; \u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0442\u0430\u043b, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u0446\u0438\u043a\u043b \u0435\u0449\u0435 \u0440\u0430\u0437 ...<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043c\u0435\u0442\u043a\u0438 .L2, \u0438, \u043a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0440\u0430\u043d\u0435\u0435, \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0430 11 \u0440\u0430\u0437. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0437\u0433\u044f\u043d\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0414\u0430\u0444\u0444\u0430.<\/p>\n<pre><code class=\"cpp\">... ; \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 switch ; \u0432 [rbp-4] \u0438 [rbp-8] \u0432\u0441\u0435 \u043a\u0430\u043a \u0438 \u0431\u044b\u043b\u043e ; [rbp-12] - \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f count          mov     eax, DWORD PTR [rbp-4] ; \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0434\u043e \u043c\u0435\u0442\u043a\u0438 .L8 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f          cdq                            ; \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e         shr     edx, 30                ; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e         add     eax, edx               ; \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e         and     eax, 3                 ; \u0446\u0438\u043a\u043b\u0430 \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043a \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438.         sub     eax, edx                        cmp     eax, 3\t\t\t\t\t\t\t\t ; \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043c\u044b \u043f\u0440\u044b\u0433\u0430\u0435\u043c \u043d\u0430:         je      .L2                    ; \u0432\u0442\u043e\u0440\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e         cmp     eax, 3         jg      .L3\t\t\t\t         cmp     eax, 2         je      .L4\t\t\t\t\t\t\t\t\t\t ; \u0442\u0440\u0435\u0442\u044c\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e         cmp     eax, 2         jg      .L3         test    eax, eax         je      .L5                    ; \u043f\u0435\u0440\u0432\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e         cmp     eax, 1         je      .L6                    ; \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e         jmp     .L3                    ; \u0434\u0430, \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0434\u043e\u0439\u0434\u0435\u043c \u0430\u0436 \u0434\u043e \u0441\u044e\u0434\u0430                                        ; \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0432 \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435. .L8:         nop .L5:                                   ; \u0430 \u0432\u043e\u0442 \u043d\u0430\u0448\u0438 \"\u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438\":         add     DWORD PTR [rbp-8], 1   ; \u043f\u0435\u0440\u044b\u0439 i++ .L2:         add     DWORD PTR [rbp-8], 1   ; \u0432\u0442\u043e\u0440\u043e\u0439 i++ .L4:         add     DWORD PTR [rbp-8], 1   ; \u0442\u0440\u0435\u0442\u0438\u0439 i++ .L6:         add     DWORD PTR [rbp-8], 1   ; \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 i++         mov     eax, DWORD PTR [rbp-4] ; \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435, \u043a\u0430\u043a         lea     edx, [rax-1]           ; \u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f         mov     DWORD PTR [rbp-4], edx ; \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430         test    eax, eax         jg      .L8 .L3:          ; \u0442\u0443\u0442 \u0438\u0434\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b ...<\/code><\/pre>\n<p>\u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u0447\u0442\u043e \u043a\u043e\u0434\u0430 \u0441\u0442\u0430\u043b\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u0412\u043e \u0432\u0442\u043e\u0440\u044b\u0445, \u0445\u043e\u0442\u044f \u043c\u044b \u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441 11 \u0434\u043e 2, \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043d\u0430 \u043d\u0443\u0436\u043d\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u0432 \u043d\u0430\u0447\u0430\u043b\u0435. <\/p>\n<p>\u0412\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u043e\u0443\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435, \u043e\u0441\u0442\u0430\u0435\u0442\u044c\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c. \u0412\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u044d\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 \u043f\u043e\u0434 \u044d\u0442\u0443 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443. \u0412 \u043a\u0430\u043a\u0438\u0445 \u0442\u043e \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0434\u0432\u0443\u043c\u044f \u0446\u0438\u043a\u043b\u0430\u043c\u0438, \u0433\u0434\u0435 \u0441\u043f\u0435\u0440\u0432\u0430 \u0438\u0434\u0435\u0442 \u0446\u0438\u043a\u043b \u0441 &#171;\u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c\u0438&#187;, \u0430 \u043f\u043e\u0442\u043e\u043c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0446\u0438\u043a\u043b. \u0422\u0430\u043a \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0414\u0430\u0444\u0444\u0430 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434. \u0422\u0430\u043a \u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0443\u0436\u0435 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 1983 \u0433\u043e\u0434, \u0438 \u0432 \u043d\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0441\u0430\u043c\u0438 \u0443\u043c\u0435\u044e\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u043e\u0432, \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0438\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043d\u0438\u0445, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p><a href=\"https:\/\/t.me\/eignatenko_blog\" rel=\"noopener noreferrer nofollow\"><strong>\u041c\u043e\u0439 \u0431\u043b\u043e\u0433 \u0432 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0435<\/strong><\/a>  <\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/560320\/\"> https:\/\/habr.com\/ru\/post\/560320\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c \u0421++ \u043a\u043e\u0434\u043e\u043c? \u0415\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043a\u0430\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b?<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt;  int main() {   int number = 11;        int count  = number \/ 4;   int i = 0;      switch (number % 4) {     case 0:        do {     \t  ++i;     case 3: ++i;     case 2: ++i;     case 1: ++i;       } while (count-- &gt; 0);   }    std::cout &lt;&lt; i; }<\/code><\/pre>\n<p>\u0421 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043a\u0430\u0448\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <em>switch<\/em> \u0438 \u0446\u0438\u043a\u043b <em>do-while<\/em> \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u044b \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u044f\u0437\u044b\u043a\u0430 , \u0437\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0437\u0430\u043a\u043e\u043d\u043d\u043e.<\/p>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0437\u0434\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u043d \u0446\u0438\u043a\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>i <\/em>\u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 <em>number<\/em> \u0440\u0430\u0437, \u0438, \u043a\u0430\u043a \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0447\u0438\u0441\u043b\u043e 11. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u0434 \u0432\u044b\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e &#171;\u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c&#187; \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt;  int main() {   int number = 11;   int i = 0;      while (number-- &gt; 0) {     ++i;   }    std::cout &lt;&lt; i; }<\/code><\/pre>\n<p>\u041d\u043e \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0436\u0435 \u0442\u043e\u0433\u0434\u0430 \u0438\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0438 \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u0442\u044c <em>do-while<\/em> \u0438 <em>switch<\/em>? <\/p>\n<h2>Duff&#8217;s device (\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0414\u0430\u0444\u0444\u0430)<\/h2>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u0435\u043c \u0431\u044b\u043b \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d \u0435\u0449\u0451 \u0432 1983 \u0433\u043e\u0434\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u043f\u043e \u0438\u043c\u0435\u043d\u0438 <em>Tom Duff<\/em>, \u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0421\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0442\u0430\u043a\u0443\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e, \u043a\u0430\u043a <em>loop unrolling<\/em>. <\/p>\n<p>\u0417\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c. \u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0446\u0438\u043a\u043b\u043e\u0432 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f \u043b\u0438 \u0446\u0438\u043a\u043b \u0438 \u043d\u0435 \u043f\u043e\u0440\u0430 \u043b\u0438 \u0438\u0437 \u043d\u0435\u0433\u043e \u0432\u044b\u0439\u0442\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0447\u0442\u043e <em>number<\/em> \u0435\u0449\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433 \u043d\u0443\u043b\u044f. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u044f <em>loop unroling<\/em> (\u0438\u043b\u0438 <em>\u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430<\/em>), \u043c\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0442\u0435\u043c, \u0447\u0442\u043e \u0437\u0430 \u043e\u0434\u043d\u0443 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0435 \u043e\u0434\u043d\u043e \u0442\u0435\u043b\u043e \u0446\u0438\u043a\u043b\u0430, \u0430 \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0442\u0435\u043b\u043e\u043c \u0446\u0438\u043a\u043b\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>i. <\/em>\u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0446\u0438\u043a\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f, \u044f \u0431\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u2014 <em>\u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0446\u0438\u043a\u043b<\/em>.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043d\u0435 \u043e\u0434\u043d\u043e \u0442\u0435\u043b\u043e \u0446\u0438\u043a\u043b\u0430, \u0430 \u0447\u0435\u0442\u044b\u0440\u0435. \u041a\u0430\u043a \u043d\u0430\u043c \u0431\u044b\u0442\u044c \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0435 \u043a\u0440\u0430\u0442\u043d\u043e \u0447\u0435\u0442\u044b\u0440\u0435\u043c? \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u043d\u0430\u0439\u0442\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u0442\u0435\u043b\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430, \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430. \u0422\u043e\u0433\u0434\u0430 \u043d\u0430\u0448 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434,<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt;  int main() {      int number = 11;      int i = 0;         while (number-- &gt; 0) {     ++i;   }         std::cout &lt;&lt; i;  }<\/code><\/pre>\n<p>\u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u043f\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u0435\u043b\u0430 \u0446\u0438\u043a\u043b\u0430 \u0437\u0430 \u0440\u0430\u0437:<\/p>\n<pre><code class=\"cpp\">int main() {   int number = 11; \/\/ \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 = 11.      \/\/ \u0432 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u043e 4 \u0442\u0435\u043b\u0430 \u0446\u0438\u043a\u043b\u0430 \u0437\u0430 \u0440\u0430\u0437.   int count  = number \/ 4; \/\/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430.   int left   = number % 4; \/\/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043d\u0435\u0433\u043e \"\u043d\u0435 \u0432\u043b\u0435\u0437\u043b\u0438\".   int i = 0;      \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \"\u043d\u0435\u0432\u043b\u0435\u0437\u0448\u0438\u0435\" \u0432 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0446\u0438\u043a\u043b \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438   \/\/ \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e \u0446\u0438\u043a\u043b\u0430.   while (left-- &gt; 0) {     i++;   }    \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0446\u0438\u043a\u043b \u043f\u043e 4 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430 \u0440\u0430\u0437.   while (count-- &gt; 0) {     i++;     i++;     i++;     i++;   }        std::cout &lt;&lt; i; }<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u043d\u0435 11 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430, \u043a\u0430\u043a \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0430 <em>number \/ 4 + number % 4<\/em> \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e 5, \u043f\u0440\u0438 <em>number <\/em>\u0440\u0430\u0432\u043d\u043e\u043c<em> 11<\/em>.<\/p>\n<p>\u041d\u043e \u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u043d\u0430 <em>Assembly<\/em> \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0438\u0437\u044f\u0449\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b: \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f <em>jump<\/em> \u043d\u0430 \u0435\u0433\u043e \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439. \u0418 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0414\u0430\u0444\u0444\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0432 \u0421\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0449\u0435 \u0440\u0430\u0437 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435:<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt;  int main() {   int number = 11; \/\/ \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0440\u0430\u0432\u043d\u043e 11.   int count = number \/ 4; \/\/ \u0447\u0438\u0441\u043b\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430.   int i = 0;    \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439   \/\/ \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a \u044d\u0442\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438   \/\/ \u0432\u043d\u0443\u0442\u0440\u044c \u0442\u0435\u043b\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430.   switch (number % 4) {     case 0:        do {           ++i;     case 3: ++i; \/\/ &lt;- \u043d\u0430\u0448 \u0441\u043b\u0443\u0447\u0430\u0439. \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430 \u043d\u0430\u0447\u043d\u0435\u0442\u0441\u044f \u043e\u0442\u0441\u044e\u0434\u0430 \u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u0439     case 2: ++i; \/\/ \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u043d\u0435 \u0447\u0435\u0442\u044b\u0440\u0435, \u0430      case 1: ++i; \/\/ \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0438 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 (11 % 4 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439).       } while (count-- &gt; 0);    }      std::cout &lt;&lt; i; }<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e <em>number \/ 4 <\/em>\u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0434\u0438\u043d\u043d\u0430\u0434\u0446\u0430\u0442\u0438. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <em>switch<\/em> \u0432 \u0421\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 &#171;\u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f&#187; \u0438\u0437 \u0431\u043b\u043e\u043a\u0430 \u043e\u0434\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0438 <em>case<\/em> \u0432 \u0431\u043b\u043e\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>break<\/em>. \u041d\u043e, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043c\u0435\u0442\u043a\u0443 <em>case<\/em> \u043f\u043e\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u0446\u0438\u043a\u043b <em>do-while<\/em> \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u041d\u043e \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043c\u0435\u0442\u043a\u0430 <em>case<\/em> \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 <em>switch,<\/em> \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0437\u0430 \u043d\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e, \u0447\u0442\u043e \u0431\u044b \u0442\u0430\u043c \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c.<\/p>\n<p>\u0412 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0414\u0430\u0444\u0444\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">send(to, from, count) \/\/ to - \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u044b\u0439 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c. \u041e\u043d \u043d\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \/\/ \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0446\u043a\u043b\u0430. \/\/ from - \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 'to' register short *to, *from; register count; {     \/\/ \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0446\u0438\u043a\u043b \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u0441\u044f \u043f\u043e 8 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u0440\u0430\u0437     register n = (count + 7) \/ 8;     switch (count % 8) {     case 0: do { *to = *from++;     case 7:      *to = *from++;     case 6:      *to = *from++;     case 5:      *to = *from++;     case 4:      *to = *from++;     case 3:      *to = *from++;     case 2:      *to = *from++;     case 1:      *to = *from++;             } while (--n &gt; 0);     } }<\/code><\/pre>\n<h2>\u041f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b<\/h2>\n<p>\u0423 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0435\u043c\u0430 \u0435\u0441\u0442\u044c \u043a\u0430\u043a \u043f\u043b\u044e\u0441\u044b, \u0442\u0430\u043a \u0438 \u043c\u0438\u043d\u0443\u0441\u044b. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043f\u043b\u044e\u0441\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u043d\u043e, \u043f\u043e\u043c\u0438\u043c\u043e \u0443\u0445\u0443\u0434\u0448\u0435\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043c\u0438\u043d\u0443\u0441\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u0432\u0435\u0434\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u043d\u0435\u043c \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430. \u041d\u043e \u0442\u0430\u043a \u043b\u0438 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435?<\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0432\u043e \u0447\u0442\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <a href=\"https:\/\/godbolt.org\/\" rel=\"noopener noreferrer nofollow\">Compiler Explorer<\/a>&#8216;\u043e\u043c \u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c gcc 11.1 \u0434\u043b\u044f x86-64 \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0446\u0438\u0439. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u0434\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0435\u0437 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0448 \u0446\u0438\u043a\u043b \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"cpp\">...  ; \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 while ; [rbp-4] - \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f number = 11 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 ; [rbp-8] - \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f i = 0 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435         jmp     .L2  .L3:         add     DWORD PTR [rbp-8], 1    ; \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0438 i \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 .L2:         mov     eax, DWORD PTR [rbp-4]  ; \u043a\u043b\u0430\u0434\u0435\u043c \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 eax \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 number         lea     edx, [rax-1]            ; \u043e\u0442\u043d\u0438\u043c\u0430\u0435\u043c \u043e\u0442 number \u0435\u0434\u0438\u043d\u0438\u0446\u0443         mov     DWORD PTR [rbp-4], edx  ; \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 number-1 \u043d\u0430 \u0441\u0442\u0435\u043a         test    eax, eax                ; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e number \u0435\u0449\u0435 \u043d\u0435 \u0441\u0442\u0430\u043b 0         jg      .L3                     ; \u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0442\u0430\u043b, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u0446\u0438\u043a\u043b \u0435\u0449\u0435 \u0440\u0430\u0437 ...<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043c\u0435\u0442\u043a\u0438 .L2, \u0438, \u043a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0440\u0430\u043d\u0435\u0435, \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0430 11 \u0440\u0430\u0437. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0437\u0433\u044f\u043d\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0414\u0430\u0444\u0444\u0430.<\/p>\n<pre><code class=\"cpp\">... ; \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 switch ; \u0432 [rbp-4] \u0438 [rbp-8] \u0432\u0441\u0435 \u043a\u0430\u043a \u0438 \u0431\u044b\u043b\u043e ; [rbp-12] - \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f count          mov     eax, DWORD PTR [rbp-4] ; \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0434\u043e \u043c\u0435\u0442\u043a\u0438 .L8 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f          cdq                            ; \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e         shr     edx, 30                ; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e         add     eax, edx               ; \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e         and     eax, 3                 ; \u0446\u0438\u043a\u043b\u0430 \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043a \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438.         sub     eax, edx                        cmp     eax, 3\t\t\t\t\t\t\t\t ; \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043c\u044b \u043f\u0440\u044b\u0433\u0430\u0435\u043c \u043d\u0430:         je      .L2                    ; \u0432\u0442\u043e\u0440\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e         cmp     eax, 3         jg      .L3\t\t\t\t         cmp     eax, 2         je      .L4\t\t\t\t\t\t\t\t\t\t ; \u0442\u0440\u0435\u0442\u044c\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e         cmp     eax, 2         jg      .L3         test    eax, eax         je      .L5                    ; \u043f\u0435\u0440\u0432\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e         cmp     eax, 1         je      .L6                    ; \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e         jmp     .L3                    ; \u0434\u0430, \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0434\u043e\u0439\u0434\u0435\u043c \u0430\u0436 \u0434\u043e \u0441\u044e\u0434\u0430                                        ; \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0432 \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435. .L8:         nop .L5:                                   ; \u0430 \u0432\u043e\u0442 \u043d\u0430\u0448\u0438 \"\u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438\":         add     DWORD PTR [rbp-8], 1   ; \u043f\u0435\u0440\u044b\u0439 i++ .L2:         add     DWORD PTR [rbp-8], 1   ; \u0432\u0442\u043e\u0440\u043e\u0439 i++ .L4:         add     DWORD PTR [rbp-8], 1   ; \u0442\u0440\u0435\u0442\u0438\u0439 i++ .L6:         add     DWORD PTR [rbp-8], 1   ; \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 i++         mov     eax, DWORD PTR [rbp-4] ; \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435, \u043a\u0430\u043a         lea     edx, [rax-1]           ; \u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f         mov     DWORD PTR [rbp-4], edx ; \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430         test    eax, eax         jg      .L8 .L3:          ; \u0442\u0443\u0442 \u0438\u0434\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b ...<\/code><\/pre>\n<p>\u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u0447\u0442\u043e \u043a\u043e\u0434\u0430 \u0441\u0442\u0430\u043b\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u0412\u043e \u0432\u0442\u043e\u0440\u044b\u0445, \u0445\u043e\u0442\u044f \u043c\u044b \u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441 11 \u0434\u043e 2, \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043d\u0430 \u043d\u0443\u0436\u043d\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u0432 \u043d\u0430\u0447\u0430\u043b\u0435. <\/p>\n<p>\u0412\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u043e\u0443\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435, \u043e\u0441\u0442\u0430\u0435\u0442\u044c\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c. \u0412\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u044d\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 \u043f\u043e\u0434 \u044d\u0442\u0443 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443. \u0412 \u043a\u0430\u043a\u0438\u0445 \u0442\u043e \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0434\u0432\u0443\u043c\u044f \u0446\u0438\u043a\u043b\u0430\u043c\u0438, \u0433\u0434\u0435 \u0441\u043f\u0435\u0440\u0432\u0430 \u0438\u0434\u0435\u0442 \u0446\u0438\u043a\u043b \u0441 &#171;\u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c\u0438&#187;, \u0430 \u043f\u043e\u0442\u043e\u043c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0446\u0438\u043a\u043b. \u0422\u0430\u043a \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0414\u0430\u0444\u0444\u0430 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434. \u0422\u0430\u043a \u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0443\u0436\u0435 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 1983 \u0433\u043e\u0434, \u0438 \u0432 \u043d\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0441\u0430\u043c\u0438 \u0443\u043c\u0435\u044e\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u043e\u0432, \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0438\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043d\u0438\u0445, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p><a href=\"https:\/\/t.me\/eignatenko_blog\" rel=\"noopener noreferrer nofollow\"><strong>\u041c\u043e\u0439 \u0431\u043b\u043e\u0433 \u0432 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0435<\/strong><\/a>  <\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/560320\/\"> https:\/\/habr.com\/ru\/post\/560320\/<\/a><br \/><\/br><\/br><\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-324080","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=324080"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324080\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=324080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=324080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=324080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}