File size: 57,236 Bytes
f5f3a61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
{
 "step": 12000,
 "created": "2026-10-06 12:53",
 "summary": {
  "msvc-x64-Od": {
   "pass": 10,
   "n": 12
  },
  "msvc-x64-O2": {
   "pass": 5,
   "n": 12
  },
  "msvc-x86-Od": {
   "pass": 10,
   "n": 12
  },
  "msvc-x86-O2": {
   "pass": 6,
   "n": 12
  },
  "dos16-small-od": {
   "pass": 10,
   "n": 12
  },
  "dos16-large-ox": {
   "pass": 6,
   "n": 12
  }
 },
 "examples": [
  {
   "id": "count_words",
   "title": "Počet slov",
   "desc": "průchod řetězcem se stavovým příznakem",
   "source": "int count_words(const char *s) {\n    int n = 0, in_word = 0;\n    for (; *s; s++) {\n        if (*s == ' ') in_word = 0;\n        else if (!in_word) { in_word = 1; n++; }\n    }\n    return n;\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV qword ptr [RSP + 8],RCX\nSUB RSP,0x18\nMOV dword ptr [RSP + 4],0\nMOV dword ptr [RSP],0\nJMP LAB_1\nLAB_5:\nMOV RAX,qword ptr [RSP + 0x20]\nINC RAX\nMOV qword ptr [RSP + 0x20],RAX\nLAB_1:\nMOV RAX,qword ptr [RSP + 0x20]\nMOVSX EAX,byte ptr [RAX]\nTEST EAX,EAX\nJE LAB_2\nMOV RAX,qword ptr [RSP + 0x20]\nMOVSX EAX,byte ptr [RAX]\nCMP EAX,0x20\nJNE LAB_3\nMOV dword ptr [RSP],0\nJMP LAB_4\nLAB_3:\nCMP dword ptr [RSP],0\nJNE LAB_4\nMOV dword ptr [RSP],1\nMOV EAX,dword ptr [RSP + 4]\nINC EAX\nMOV dword ptr [RSP + 4],EAX\nLAB_4:\nJMP LAB_5\nLAB_2:\nMOV EAX,dword ptr [RSP + 4]\nADD RSP,0x18\nRET",
     "c": "int count_spaces(char *str)\n{\n int count = 0;\n int i;\n\n for (i = 0; *str != '\\0'; str++) {\n  if (*str == ' ') {\n   i = 0;\n  } else if (i == 0) {\n   i = 1;\n   count++;\n  }\n }\n\n return count;\n}",
     "status": "pass",
     "seconds": 3.93
    },
    "msvc-x64-O2": {
     "asm": "MOVZX EDX,byte ptr [RCX]\nXOR R8D,R8D\nXOR EAX,EAX\nTEST DL,DL\nJE LAB_1\nNOP dword ptr [RAX]\nLAB_4:\nCMP DL,0x20\nJNE LAB_2\nXOR EAX,EAX\nJMP LAB_3\nLAB_2:\nTEST EAX,EAX\nJNE LAB_3\nMOV EAX,1\nINC R8D\nLAB_3:\nMOVZX EDX,byte ptr [RCX + 1]\nINC RCX\nTEST DL,DL\nJNE LAB_4\nMOV EAX,R8D\nLAB_1:\nRET",
     "c": "int count_spaces(char *str)\n{\n int count = 0;\n int i = 0;\n while (str[i] != '\\0') {\n  if (str[i] == ' ') {\n   count = 0;\n  } else if (count == 0) {\n   count++;\n  }\n  i++;\n }\n return count;\n}",
     "status": "fail",
     "seconds": 1.2
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nSUB ESP,8\nMOV dword ptr [EBP + -8],0\nMOV dword ptr [EBP + -4],0\nJMP LAB_1\nLAB_5:\nMOV EAX,dword ptr [EBP + 8]\nADD EAX,1\nMOV dword ptr [EBP + 8],EAX\nLAB_1:\nMOV ECX,dword ptr [EBP + 8]\nMOVSX EDX,byte ptr [ECX]\nTEST EDX,EDX\nJE LAB_2\nMOV EAX,dword ptr [EBP + 8]\nMOVSX ECX,byte ptr [EAX]\nCMP ECX,0x20\nJNE LAB_3\nMOV dword ptr [EBP + -4],0\nJMP LAB_4\nLAB_3:\nCMP dword ptr [EBP + -4],0\nJNE LAB_4\nMOV dword ptr [EBP + -4],1\nMOV EDX,dword ptr [EBP + -8]\nADD EDX,1\nMOV dword ptr [EBP + -8],EDX\nLAB_4:\nJMP LAB_5\nLAB_2:\nMOV EAX,dword ptr [EBP + -8]\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "int count_spaces(char *str)\n{\n int count = 0;\n int i;\n\n for (i = 0; *str != '\\0'; str++) {\n  if (*str == ' ') {\n   i = 0;\n  } else if (i == 0) {\n   i = 1;\n   count++;\n  }\n }\n\n return count;\n}",
     "status": "pass",
     "seconds": 1.23
    },
    "msvc-x86-O2": {
     "asm": "PUSH ESI\nMOV ESI,dword ptr [ESP + 8]\nXOR EDX,EDX\nXOR EAX,EAX\nMOV CL,byte ptr [ESI]\nTEST CL,CL\nJE LAB_1\nNOP\nLAB_4:\nCMP CL,0x20\nJNE LAB_2\nXOR EAX,EAX\nJMP LAB_3\nLAB_2:\nTEST EAX,EAX\nJNE LAB_3\nMOV EAX,1\nINC EDX\nLAB_3:\nMOV CL,byte ptr [ESI + 1]\nINC ESI\nTEST CL,CL\nJNE LAB_4\nMOV EAX,EDX\nLAB_1:\nPOP ESI\nRET",
     "c": "int is_blank(char *s)\n{\n int i = 0;\n int c = 0;\n while (s[i] != '\\0') {\n  if (s[i] == ' ') {\n   c = 0;\n  } else if (c == 0) {\n   c = 1;\n   i++;\n  }\n  i++;\n }\n return c;\n}",
     "status": "fail",
     "seconds": 1.25
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,6\nMOV word ptr [BP +  + -4],0\nMOV word ptr [BP +  + -2],0\nLAB_1:\nMOV BX,word ptr [BP + 8]\nCMP byte ptr [BX],0\nJE LAB_2\nJMP LAB_3\nLAB_2:\nJMP LAB_4\nLAB_3:\nMOV BX,word ptr [BP + 8]\nCMP byte ptr [BX],0x20\nJNE LAB_5\nMOV word ptr [BP +  + -2],0\nJMP LAB_6\nLAB_5:\nCMP word ptr [BP +  + -2],0\nJNE LAB_6\nMOV word ptr [BP +  + -2],1\nINC word ptr [BP +  + -4]\nLAB_6:\nINC word ptr [BP + 8]\nJMP LAB_1\nLAB_4:\nMOV AX,word ptr [BP +  + -4]\nMOV word ptr [BP +  + -6],AX\nMOV AX,word ptr [BP +  + -6]\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "int count_spaces(char *str)\n{\n int count = 0;\n int flag = 0;\n\n while (*str) {\n  if (*str == ' ') {\n   flag = 0;\n  } else if (flag == 0) {\n   flag = 1;\n   count++;\n  }\n  str++;\n }\n\n return count;\n}",
     "status": "pass",
     "seconds": 1.11
    },
    "dos16-large-ox": {
     "asm": "PUSH BP\nMOV BP,SP\nLDS BX,dword ptr [BP + 6]\nXOR DX,DX\nXOR AX,AX\nLAB_1:\nCMP byte ptr [BX],0\nJE LAB_2\nCMP byte ptr [BX],0x20\nJNE LAB_3\nXOR AX,AX\nLAB_4:\nINC BX\nJMP LAB_1\nLAB_3:\nTEST AX,AX\nJNE LAB_4\nMOV AX,1\nADD DX,AX\nJMP LAB_4\nLAB_2:\nMOV AX,DX\nPOP BP\nRETF",
     "c": "int is_palindrome(char *str)\n{\n int i = 0;\n int flag = 0;\n while (str[i] != '\\0')\n {\n  if (str[i] == ' ')\n  {\n   flag = 0;\n  }\n  else if (flag == 0)\n  {\n   i++;\n  }\n }\n return i;\n}",
     "status": "fail",
     "seconds": 1.18
    }
   }
  },
  {
   "id": "sum_array",
   "title": "Součet pole do long",
   "desc": "smyčka, 32bitový součet (na DOS dvojice registrů DX:AX)",
   "source": "long sum_array(const int *a, int n) {\n    long total = 0;\n    int i;\n    for (i = 0; i < n; i++) total += a[i];\n    return total;\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV dword ptr [RSP + 0x10],EDX\nMOV qword ptr [RSP + 8],RCX\nSUB RSP,0x18\nMOV dword ptr [RSP + 4],0\nMOV dword ptr [RSP],0\nJMP LAB_1\nLAB_3:\nMOV EAX,dword ptr [RSP]\nINC EAX\nMOV dword ptr [RSP],EAX\nLAB_1:\nMOV EAX,dword ptr [RSP + 0x28]\nCMP dword ptr [RSP],EAX\nJGE LAB_2\nMOVSXD RAX,dword ptr [RSP]\nMOV RCX,qword ptr [RSP + 0x20]\nMOV EAX,dword ptr [RCX + RAX*4]\nMOV ECX,dword ptr [RSP + 4]\nADD ECX,EAX\nMOV EAX,ECX\nMOV dword ptr [RSP + 4],EAX\nJMP LAB_3\nLAB_2:\nMOV EAX,dword ptr [RSP + 4]\nADD RSP,0x18\nRET",
     "c": "int sum(int *arr, int len) {\n    int sum = 0;\n    for (int i = 0; i < len; i++) {\n        sum += arr[i];\n    }\n    return sum;\n}",
     "status": "pass",
     "seconds": 0.74
    },
    "msvc-x64-O2": {
     "asm": "SUB RSP,8\nXOR R8D,R8D\nMOVSXD R11,EDX\nMOV R9,RCX\nMOV R10D,R8D\nMOV ECX,R8D\nTEST EDX,EDX\nJLE LAB_1\nCMP R11D,8\nJB LAB_1\nMOV RDX,R11\nXORPS XMM2,XMM2\nAND RDX,0xfffffffffffffff8\nXORPS XMM1,XMM1\nMOV EAX,R8D\nNOP dword ptr [RAX]\nLAB_2:\nMOVDQU XMM0,xmmword ptr [R9 + RAX*4]\nADD ECX,8\nPADDD XMM2,XMM0\nMOVDQU XMM0,xmmword ptr [R9 + RAX*4 + 0x10]\nADD RAX,8\nPADDD XMM1,XMM0\nCMP RAX,RDX\nJL LAB_2\nPADDD XMM1,XMM2\nMOVDQA XMM0,XMM1\nPSRLDQ XMM0,8\nPADDD XMM1,XMM0\nMOVDQA XMM0,XMM1\nPSRLDQ XMM0,4\nPADDD XMM1,XMM0\nMOVD R10D,XMM1\nLAB_1:\nMOVSXD RAX,ECX\nMOV EDX,R8D\nCMP RAX,R11\nJGE LAB_3\nMOV RCX,R11\nSUB RCX,RAX\nCMP RCX,2\nJL LAB_4\nMOV qword ptr [RSP],RBX\nLEA RBX,[R11 + -1]\nNOP dword ptr [RAX]\nNOP word ptr [RAX + RAX + 0x0]\nLAB_5:\nADD R8D,dword ptr [R9 + RAX*4]\nADD EDX,dword ptr [R9 + RAX*4 + 4]\nADD RAX,2\nCMP RAX,RBX\nJL LAB_5\nMOV RBX,qword ptr [RSP]\nCMP RAX,R11\nJGE LAB_6\nLAB_4:\nADD R10D,dword ptr [R9 + RAX*4]\nLAB_6:\nLEA EAX,[RDX + R8]\nADD EAX,R10D\nADD RSP,8\nRET\nLAB_3:\nMOV EAX,R10D\nADD RSP,8\nRET",
     "c": "int sum(int *arr, int len)\n{\n int i;\n int sum = 0;\n for (i = 0; i < len; i++)\n  sum += arr[i];\n return sum;\n}",
     "status": "pass",
     "seconds": 0.78
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nSUB ESP,8\nMOV dword ptr [EBP + -8],0\nMOV dword ptr [EBP + -4],0\nJMP LAB_1\nLAB_3:\nMOV EAX,dword ptr [EBP + -4]\nADD EAX,1\nMOV dword ptr [EBP + -4],EAX\nLAB_1:\nMOV ECX,dword ptr [EBP + -4]\nCMP ECX,dword ptr [EBP + 0xc]\nJGE LAB_2\nMOV EDX,dword ptr [EBP + -4]\nMOV EAX,dword ptr [EBP + 8]\nMOV ECX,dword ptr [EBP + -8]\nADD ECX,dword ptr [EAX + EDX*4]\nMOV dword ptr [EBP + -8],ECX\nJMP LAB_3\nLAB_2:\nMOV EAX,dword ptr [EBP + -8]\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "int sum(int *arr, int len) {\n    int sum = 0;\n    for (int i = 0; i < len; i++) {\n        sum += arr[i];\n    }\n    return sum;\n}",
     "status": "pass",
     "seconds": 0.73
    },
    "msvc-x86-O2": {
     "asm": "MOV EDX,dword ptr [ESP + 4]\nXOR EAX,EAX\nPUSH EBX\nPUSH EBP\nMOV EBP,dword ptr [ESP + 0x10]\nXOR EBX,EBX\nPUSH ESI\nPUSH EDI\nTEST EBP,EBP\nJLE LAB_1\nCMP EBP,8\nJB LAB_1\nMOV ECX,EBP\nXORPS XMM2,XMM2\nAND ECX,0xfffffff8\nXORPS XMM1,XMM1\nNOP dword ptr [EAX]\nNOP dword ptr [EAX + EAX + 0x0]\nLAB_2:\nMOVUPS XMM0,xmmword ptr [EDX + EAX*4]\nPADDD XMM2,XMM0\nMOVUPS XMM0,xmmword ptr [EDX + EAX*4 + 0x10]\nADD EAX,8\nPADDD XMM1,XMM0\nCMP EAX,ECX\nJL LAB_2\nPADDD XMM1,XMM2\nMOVAPS XMM0,XMM1\nPSRLDQ XMM0,8\nPADDD XMM1,XMM0\nMOVUPS XMM0,XMM1\nPSRLDQ XMM0,4\nPADDD XMM1,XMM0\nMOVD EBX,XMM1\nLAB_1:\nXOR ESI,ESI\nXOR EDI,EDI\nCMP EAX,EBP\nJGE LAB_3\nMOV ECX,EBP\nSUB ECX,EAX\nCMP ECX,2\nJL LAB_4\nLEA ECX,[EBP + -1]\nMOV dword ptr [ESP + 0x18],ECX\nLAB_5:\nADD ESI,dword ptr [EDX + EAX*4]\nADD EDI,dword ptr [EDX + EAX*4 + 4]\nADD EAX,2\nMOV ECX,EAX\nCMP EAX,dword ptr [ESP + 0x18]\nJL LAB_5\nCMP ECX,EBP\nJGE LAB_6\nLAB_4:\nADD EBX,dword ptr [EDX + EAX*4]\nLAB_6:\nLEA EAX,[EDI + ESI]\nPOP EDI\nPOP ESI\nPOP EBP\nADD EAX,EBX\nPOP EBX\nRET\nLAB_3:\nPOP EDI\nPOP ESI\nPOP EBP\nMOV EAX,EBX\nPOP EBX\nRET",
     "c": "int sum(int *a, int n)\n{\n int sum = 0;\n for (int i = 0; i < n; i++)\n  sum += a[i];\n return sum;\n}",
     "status": "pass",
     "seconds": 0.71
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,0xa\nMOV word ptr [BP +  + -0xa],0\nMOV word ptr [BP +  + -8],0\nMOV word ptr [BP +  + -2],0\nLAB_1:\nMOV AX,word ptr [BP +  + -2]\nCMP AX,word ptr [BP + 0xa]\nJGE LAB_2\nJMP LAB_3\nLAB_2:\nJMP LAB_4\nLAB_3:\nMOV BX,word ptr [BP +  + -2]\nSHL BX,1\nADD BX,word ptr [BP + 8]\nMOV AX,word ptr [BX]\nCWD\nMOV BX,AX\nMOV AX,DX\nADD word ptr [BP +  + -0xa],BX\nADC word ptr [BP +  + -8],AX\nINC word ptr [BP +  + -2]\nJMP LAB_1\nLAB_4:\nMOV AX,word ptr [BP +  + -0xa]\nMOV word ptr [BP +  + -6],AX\nMOV AX,word ptr [BP +  + -8]\nMOV word ptr [BP +  + -4],AX\nMOV AX,word ptr [BP +  + -6]\nMOV DX,word ptr [BP +  + -4]\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "uint32_t sum(uint32_t *arr, int len) {\n    uint32_t sum = 0;\n    for (int i = 0; i < len; i++) {\n        sum += arr[i];\n    }\n    return sum;\n}",
     "status": "pass",
     "seconds": 0.75
    },
    "dos16-large-ox": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nLDS BX,dword ptr [BP + 0xa]\nXOR DI,DI\nXOR SI,SI\nXOR CX,CX\nLAB_1:\nCMP CX,word ptr [BP + 0xe]\nJGE LAB_2\nMOV AX,word ptr [BX]\nCWD\nADD DI,AX\nADC SI,DX\nADD BX,2\nINC CX\nJMP LAB_1\nLAB_2:\nMOV AX,DI\nMOV DX,SI\nPOP BP\nPOP DI\nPOP SI\nRETF",
     "c": "size_t sum(int *arr, int len) {\n    int sum = 0;\n    for (int i = 0; i < len; i++) {\n        sum += arr[i];\n    }\n    return sum;\n}",
     "status": "pass",
     "seconds": 0.7
    }
   }
  },
  {
   "id": "my_strlen",
   "title": "Délka řetězce",
   "desc": "ukazatelová aritmetika",
   "source": "unsigned my_strlen(const char *s) {\n    const char *p = s;\n    while (*p) p++;\n    return (unsigned)(p - s);\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV qword ptr [RSP + 8],RCX\nSUB RSP,0x18\nMOV RAX,qword ptr [RSP + 0x20]\nMOV qword ptr [RSP],RAX\nLAB_2:\nMOV RAX,qword ptr [RSP]\nMOVSX EAX,byte ptr [RAX]\nTEST EAX,EAX\nJE LAB_1\nMOV RAX,qword ptr [RSP]\nINC RAX\nMOV qword ptr [RSP],RAX\nJMP LAB_2\nLAB_1:\nMOV RAX,qword ptr [RSP + 0x20]\nMOV RCX,qword ptr [RSP]\nSUB RCX,RAX\nMOV RAX,RCX\nADD RSP,0x18\nRET",
     "c": "size_t strlen(const char *str)\n{\n const char *s = str;\n while (*s)\n  s++;\n return s - str;\n}",
     "status": "pass",
     "seconds": 0.5
    },
    "msvc-x64-O2": {
     "asm": "CMP byte ptr [RCX],0\nMOV RAX,RCX\nJE LAB_1\nLAB_2:\nINC RAX\nCMP byte ptr [RAX],0\nJNE LAB_2\nLAB_1:\nSUB EAX,ECX\nRET",
     "c": "size_t\nstrnlen(const char *s, size_t maxlen)\n{\n const char *p;\n\n for (p = s; *p; p++)\n  ;\n return (p - s);\n}",
     "status": "compile_error",
     "seconds": 0.68
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nPUSH ECX\nMOV EAX,dword ptr [EBP + 8]\nMOV dword ptr [EBP + -4],EAX\nLAB_2:\nMOV ECX,dword ptr [EBP + -4]\nMOVSX EDX,byte ptr [ECX]\nTEST EDX,EDX\nJE LAB_1\nMOV EAX,dword ptr [EBP + -4]\nADD EAX,1\nMOV dword ptr [EBP + -4],EAX\nJMP LAB_2\nLAB_1:\nMOV EAX,dword ptr [EBP + -4]\nSUB EAX,dword ptr [EBP + 8]\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "size_t strlen(const char *str)\n{\n const char *s = str;\n while (*s)\n  s++;\n return s - str;\n}",
     "status": "pass",
     "seconds": 0.52
    },
    "msvc-x86-O2": {
     "asm": "MOV ECX,dword ptr [ESP + 4]\nMOV EAX,ECX\nCMP byte ptr [ECX],0\nJE LAB_1\nNOP dword ptr [EAX + EAX]\nLAB_2:\nINC EAX\nCMP byte ptr [EAX],0\nJNE LAB_2\nLAB_1:\nSUB EAX,ECX\nRET",
     "c": "size_t strlen(const char *str)\n{\n const char *p = str;\n while (*p)\n  p++;\n return p - str;\n}",
     "status": "pass",
     "seconds": 0.52
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,4\nMOV AX,word ptr [BP + 8]\nMOV word ptr [BP +  + -2],AX\nLAB_1:\nMOV BX,word ptr [BP +  + -2]\nCMP byte ptr [BX],0\nJE LAB_2\nJMP LAB_3\nLAB_2:\nJMP LAB_4\nLAB_3:\nINC word ptr [BP +  + -2]\nJMP LAB_1\nLAB_4:\nMOV BX,word ptr [BP +  + -2]\nSUB BX,word ptr [BP + 8]\nMOV word ptr [BP +  + -4],BX\nMOV AX,word ptr [BP +  + -4]\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "int strlen(const char *str)\n{\n const char *s = str;\n while (*s)\n  s++;\n return s - str;\n}",
     "status": "pass",
     "seconds": 0.53
    },
    "dos16-large-ox": {
     "asm": "PUSH BP\nMOV BP,SP\nMOV AX,word ptr [BP + 6]\nMOV DS,word ptr [BP + 8]\nMOV BX,AX\nLAB_1:\nCMP byte ptr [BX],0\nJE LAB_2\nINC BX\nJMP LAB_1\nLAB_2:\nSUB BX,AX\nMOV AX,BX\nPOP BP\nRETF",
     "c": "int strlen(const char *s)\n{\n const char *p = s;\n\n while (*p)\n  p++;\n\n return p - s;\n}",
     "status": "pass",
     "seconds": 0.53
    }
   }
  },
  {
   "id": "max_index",
   "title": "Index maxima",
   "desc": "hledání maxima v poli",
   "source": "int max_index(const int *a, int n) {\n    int best = 0, i;\n    for (i = 1; i < n; i++)\n        if (a[i] > a[best]) best = i;\n    return best;\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV dword ptr [RSP + 0x10],EDX\nMOV qword ptr [RSP + 8],RCX\nSUB RSP,0x18\nMOV dword ptr [RSP + 4],0\nMOV dword ptr [RSP],1\nJMP LAB_1\nLAB_4:\nMOV EAX,dword ptr [RSP]\nINC EAX\nMOV dword ptr [RSP],EAX\nLAB_1:\nMOV EAX,dword ptr [RSP + 0x28]\nCMP dword ptr [RSP],EAX\nJGE LAB_2\nMOVSXD RAX,dword ptr [RSP]\nMOVSXD RCX,dword ptr [RSP + 4]\nMOV RDX,qword ptr [RSP + 0x20]\nMOV R8,qword ptr [RSP + 0x20]\nMOV ECX,dword ptr [R8 + RCX*4]\nCMP dword ptr [RDX + RAX*4],ECX\nJLE LAB_3\nMOV EAX,dword ptr [RSP]\nMOV dword ptr [RSP + 4],EAX\nLAB_3:\nJMP LAB_4\nLAB_2:\nMOV EAX,dword ptr [RSP + 4]\nADD RSP,0x18\nRET",
     "c": "int max(int *arr, int len)\n{\n    int i, max = 0;\n    for (i = 1; i < len; i++)\n        if (arr[i] > arr[max])\n            max = i;\n    return max;\n}",
     "status": "pass",
     "seconds": 0.85
    },
    "msvc-x64-O2": {
     "asm": "MOV qword ptr [RSP + 8],RBX\nMOV qword ptr [RSP + 0x10],RDI\nXOR R11D,R11D\nMOV R10D,1\nMOV EDI,EDX\nCMP EDX,R10D\nJLE LAB_1\nMOV R9D,4\nMOV EAX,R11D\nNOP dword ptr [RAX]\nNOP word ptr [RAX + RAX + 0x0]\nLAB_2:\nMOV R8D,dword ptr [RAX + RCX]\nMOV EDX,R10D\nCMP dword ptr [R9 + RCX],R8D\nCMOVLE EDX,R11D\nCMOVG RAX,R9\nINC R10D\nADD R9,4\nMOV R11D,EDX\nCMP R10D,EDI\nJL LAB_2\nMOV EAX,EDX\nMOV RBX,qword ptr [RSP + 8]\nMOV RDI,qword ptr [RSP + 0x10]\nRET\nLAB_1:\nMOV RBX,qword ptr [RSP + 8]\nMOV EAX,R11D\nMOV RDI,qword ptr [RSP + 0x10]\nRET",
     "c": "int max(int a[], int n) {\n    int max = 0;\n    for (int i = 1; i < n; i++) {\n        if (a[i] > a[i - 1]) {\n            max = i;\n        }\n    }\n    return max;\n}",
     "status": "fail",
     "seconds": 0.92
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nSUB ESP,8\nPUSH ESI\nMOV dword ptr [EBP + -8],0\nMOV dword ptr [EBP + -4],1\nJMP LAB_1\nLAB_4:\nMOV EAX,dword ptr [EBP + -4]\nADD EAX,1\nMOV dword ptr [EBP + -4],EAX\nLAB_1:\nMOV ECX,dword ptr [EBP + -4]\nCMP ECX,dword ptr [EBP + 0xc]\nJGE LAB_2\nMOV EDX,dword ptr [EBP + -4]\nMOV EAX,dword ptr [EBP + 8]\nMOV ECX,dword ptr [EBP + -8]\nMOV ESI,dword ptr [EBP + 8]\nMOV EDX,dword ptr [EAX + EDX*4]\nCMP EDX,dword ptr [ESI + ECX*4]\nJLE LAB_3\nMOV EAX,dword ptr [EBP + -4]\nMOV dword ptr [EBP + -8],EAX\nLAB_3:\nJMP LAB_4\nLAB_2:\nMOV EAX,dword ptr [EBP + -8]\nPOP ESI\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "int max(int *arr, int len)\n{\n    int max = 0;\n    for (int i = 1; i < len; i++) {\n        if (arr[i] > arr[max]) {\n            max = i;\n        }\n    }\n    return max;\n}",
     "status": "pass",
     "seconds": 0.94
    },
    "msvc-x86-O2": {
     "asm": "XOR EAX,EAX\nPUSH EBP\nMOV EBP,dword ptr [ESP + 0xc]\nPUSH EDI\nLEA EDI,[EAX + 1]\nCMP EBP,EDI\nJLE LAB_1\nPUSH EBX\nPUSH ESI\nXOR EBX,EBX\nLAB_2:\nMOV ECX,dword ptr [ESP + 0x14]\nMOV ESI,EAX\nLEA EAX,[EDI*4 + 0x0]\nMOV EDX,dword ptr [EAX + ECX]\nCMP EDX,dword ptr [EBX + ECX]\nCMOVG EBX,EAX\nMOV EAX,EDI\nCMOVLE EAX,ESI\nINC EDI\nCMP EDI,EBP\nJL LAB_2\nPOP ESI\nPOP EBX\nLAB_1:\nPOP EDI\nPOP EBP\nRET",
     "c": "int max(int a[], int n) {\n    int max = 0;\n    for (int i = 1; i < n; i++) {\n        if (a[i] > a[i-1]) {\n            max = i;\n        }\n    }\n    return max;\n}",
     "status": "fail",
     "seconds": 0.95
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,6\nMOV word ptr [BP +  + -4],0\nMOV word ptr [BP +  + -2],1\nLAB_1:\nMOV AX,word ptr [BP +  + -2]\nCMP AX,word ptr [BP + 0xa]\nJGE LAB_2\nJMP LAB_3\nLAB_2:\nJMP LAB_4\nLAB_3:\nMOV BX,word ptr [BP +  + -2]\nSHL BX,1\nADD BX,word ptr [BP + 8]\nMOV SI,word ptr [BP +  + -4]\nSHL SI,1\nADD SI,word ptr [BP + 8]\nMOV BX,word ptr [BX]\nCMP BX,word ptr [SI]\nJLE LAB_5\nJMP LAB_6\nLAB_5:\nJMP LAB_7\nLAB_6:\nMOV AX,word ptr [BP +  + -2]\nMOV word ptr [BP +  + -4],AX\nLAB_7:\nINC word ptr [BP +  + -2]\nJMP LAB_1\nLAB_4:\nMOV AX,word ptr [BP +  + -4]\nMOV word ptr [BP +  + -6],AX\nMOV AX,word ptr [BP +  + -6]\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "int max(int *arr, int len)\n{\n int max = 0;\n for(int i = 1; i < len; i++)\n {\n  if(arr[i] > arr[max])\n   max = i;\n }\n return max;\n}",
     "status": "pass",
     "seconds": 0.93
    },
    "dos16-large-ox": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nMOV DI,word ptr [BP + 0xc]\nMOV AX,1\nMOV BX,word ptr [BP + 0xa]\nMOV ES,DI\nMOV DS,DI\nXOR DX,DX\nADD BX,2\nLAB_1:\nCMP AX,word ptr [BP + 0xe]\nJGE LAB_2\nMOV SI,DX\nADD SI,DX\nADD SI,word ptr [BP + 0xa]\nMOV CX,word ptr ES:[BX]\nCMP CX,word ptr [SI]\nJG LAB_3\nLAB_4:\nADD BX,2\nINC AX\nJMP LAB_1\nLAB_3:\nMOV DX,AX\nJMP LAB_4\nLAB_2:\nMOV AX,DX\nPOP BP\nPOP DI\nPOP SI\nRETF",
     "c": "int max(int *a, int n)\n{\n int max = 1;\n int i;\n for (i = 0; i < n; i++)\n  if (a[i] > a[i+1])\n   max = i;\n return max;\n}",
     "status": "fail",
     "seconds": 0.92
    }
   }
  },
  {
   "id": "factorial",
   "title": "Faktoriál",
   "desc": "rekurze",
   "source": "unsigned long factorial(unsigned n) {\n    if (n <= 1) return 1;\n    return n * factorial(n - 1);\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV dword ptr [RSP + 8],ECX\nSUB RSP,0x28\nCMP dword ptr [RSP + 0x30],1\nJA LAB_1\nMOV EAX,1\nJMP LAB_2\nLAB_1:\nMOV EAX,dword ptr [RSP + 0x30]\nDEC EAX\nMOV ECX,EAX\nCALL factorial\nMOV ECX,dword ptr [RSP + 0x30]\nIMUL ECX,EAX\nMOV EAX,ECX\nLAB_2:\nADD RSP,0x28\nRET",
     "c": "unsigned int factorial(unsigned int n)\n{\n    if (n <= 1)\n        return 1;\n    return n * factorial(n - 1);\n}",
     "status": "pass",
     "seconds": 0.51
    },
    "msvc-x64-O2": {
     "asm": "PUSH RBX\nSUB RSP,0x20\nMOV EBX,ECX\nCMP ECX,1\nJA LAB_1\nMOV EAX,1\nADD RSP,0x20\nPOP RBX\nRET\nLAB_1:\nDEC ECX\nCALL factorial\nIMUL EAX,EBX\nADD RSP,0x20\nPOP RBX\nRET",
     "c": "int factorial(int n) {\n    if (n <= 0 || n > 1) {\n        return 1;\n    }\n    return n * factorial(n - 1);\n}",
     "status": "fail",
     "seconds": 0.59
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nCMP dword ptr [EBP + 8],1\nJA LAB_1\nMOV EAX,1\nJMP LAB_2\nLAB_1:\nMOV EAX,dword ptr [EBP + 8]\nSUB EAX,1\nPUSH EAX\nCALL _factorial\nADD ESP,4\nIMUL EAX,dword ptr [EBP + 8]\nLAB_2:\nPOP EBP\nRET",
     "c": "unsigned int factorial(unsigned int n)\n{\n    if (n <= 1)\n        return 1;\n    return n * factorial(n - 1);\n}",
     "status": "pass",
     "seconds": 0.5
    },
    "msvc-x86-O2": {
     "asm": "PUSH ESI\nMOV ESI,dword ptr [ESP + 8]\nCMP ESI,1\nJA LAB_1\nMOV EAX,1\nPOP ESI\nRET\nLAB_1:\nLEA EAX,[ESI + -1]\nPUSH EAX\nCALL _factorial\nADD ESP,4\nIMUL EAX,ESI\nPOP ESI\nRET",
     "c": "int factorial(int n) {\n    if (n <= 0 || n > 1) {\n        return 1;\n    }\n    return n * factorial(n - 1);\n}",
     "status": "fail",
     "seconds": 0.56
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,4\nCMP word ptr [BP + 8],1\nJBE LAB_1\nJMP LAB_2\nLAB_1:\nMOV word ptr [BP +  + -4],1\nMOV word ptr [BP +  + -2],0\nJMP LAB_3\nLAB_2:\nMOV AX,word ptr [BP + 8]\nDEC AX\nPUSH AX\nCALL _factorial\nMOV SI,AX\nMOV CX,DX\nADD SP,2\nMOV AX,word ptr [BP + 8]\nXOR DX,DX\nMOV BX,AX\nMOV AX,BX\nMOV BX,SI\nCALL __U4M\nMOV word ptr [BP +  + -4],AX\nMOV word ptr [BP +  + -2],DX\nJMP LAB_3\nLAB_3:\nMOV AX,word ptr [BP +  + -4]\nMOV DX,word ptr [BP +  + -2]\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "unsigned long factorial(unsigned int n)\n{\n    if (n <= 1)\n        return 1;\n    return factorial(n - 1) * n;\n}",
     "status": "pass",
     "seconds": 0.54
    },
    "dos16-large-ox": {
     "asm": "PUSH SI\nPUSH BP\nMOV BP,SP\nMOV SI,word ptr [BP + 8]\nCMP SI,1\nJA LAB_1\nMOV AX,1\nXOR DX,DX\nPOP BP\nPOP SI\nRETF\nLAB_1:\nLEA AX,[SI +  + -1]\nPUSH AX\nMOV AX,SS\nMOV DS,AX\nPUSH CS\nCALL _factorial\nMOV BX,AX\nMOV CX,DX\nADD SP,2\nMOV AX,SI\nXOR DX,DX\nCALL __U4M\nPOP BP\nPOP SI\nRETF",
     "c": "unsigned long factorial(unsigned int n)\n{\n    if (n <= 1)\n        return 1;\n    return n * factorial(n - 1);\n}",
     "status": "pass",
     "seconds": 0.51
    }
   }
  },
  {
   "id": "gcd",
   "title": "Největší společný dělitel",
   "desc": "Eukleidův algoritmus, dělení se zbytkem",
   "source": "int gcd(int a, int b) {\n    while (b != 0) {\n        int t = a % b;\n        a = b;\n        b = t;\n    }\n    return a;\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV dword ptr [RSP + 0x10],EDX\nMOV dword ptr [RSP + 8],ECX\nSUB RSP,0x18\nLAB_2:\nCMP dword ptr [RSP + 0x28],0\nJE LAB_1\nMOV EAX,dword ptr [RSP + 0x20]\nCDQ\nIDIV EAX,dword ptr [RSP + 0x28]\nMOV EAX,EDX\nMOV dword ptr [RSP],EAX\nMOV EAX,dword ptr [RSP + 0x28]\nMOV dword ptr [RSP + 0x20],EAX\nMOV EAX,dword ptr [RSP]\nMOV dword ptr [RSP + 0x28],EAX\nJMP LAB_2\nLAB_1:\nMOV EAX,dword ptr [RSP + 0x20]\nADD RSP,0x18\nRET",
     "c": "uint64_t gcd(uint64_t a, uint64_t b) {\n    uint64_t c;\n    while (b != 0) {\n        c = a % b;\n        a = b;\n        b = c;\n    }\n    return a;\n}",
     "status": "pass",
     "seconds": 0.74
    },
    "msvc-x64-O2": {
     "asm": "MOV R8D,EDX\nTEST EDX,EDX\nJE LAB_1\nNOP word ptr [RAX + RAX + 0x0]\nLAB_2:\nMOV EAX,ECX\nMOV ECX,R8D\nCDQ\nIDIV EAX,R8D\nMOV R8D,EDX\nTEST EDX,EDX\nJNE LAB_2\nLAB_1:\nMOV EAX,ECX\nRET",
     "c": "uint64_t gcd(uint64_t a, uint64_t b) {\n    uint64_t r = b;\n    while (r != 0) {\n        r = a % b;\n        a = b;\n    }\n    return r;\n}",
     "status": "fail",
     "seconds": 0.68
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nPUSH ECX\nLAB_2:\nCMP dword ptr [EBP + 0xc],0\nJE LAB_1\nMOV EAX,dword ptr [EBP + 8]\nCDQ\nIDIV EAX,dword ptr [EBP + 0xc]\nMOV dword ptr [EBP + -4],EDX\nMOV EAX,dword ptr [EBP + 0xc]\nMOV dword ptr [EBP + 8],EAX\nMOV ECX,dword ptr [EBP + -4]\nMOV dword ptr [EBP + 0xc],ECX\nJMP LAB_2\nLAB_1:\nMOV EAX,dword ptr [EBP + 8]\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "int gcd(int a, int b) {\n    int r;\n    while (b != 0) {\n        r = a % b;\n        a = b;\n        b = r;\n    }\n    return a;\n}",
     "status": "pass",
     "seconds": 0.69
    },
    "msvc-x86-O2": {
     "asm": "MOV ECX,dword ptr [ESP + 8]\nMOV EAX,dword ptr [ESP + 4]\nTEST ECX,ECX\nJE LAB_1\nNOP dword ptr [EAX]\nLAB_2:\nCDQ\nIDIV EAX,ECX\nMOV EAX,ECX\nMOV ECX,EDX\nTEST EDX,EDX\nJNE LAB_2\nLAB_1:\nRET",
     "c": "uint64_t gcd(uint64_t a, uint64_t b) {\n    uint64_t r = a;\n    while (b) {\n        r = r % b;\n        b = b / b;\n    }\n    return r;\n}",
     "status": "timeout",
     "seconds": 0.67
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,4\nLAB_1:\nCMP word ptr [BP + 0xa],0\nJNE LAB_2\nJMP LAB_3\nLAB_2:\nMOV AX,word ptr [BP + 8]\nCWD\nIDIV word ptr [BP + 0xa]\nMOV word ptr [BP +  + -4],DX\nMOV AX,word ptr [BP + 0xa]\nMOV word ptr [BP + 8],AX\nMOV AX,word ptr [BP +  + -4]\nMOV word ptr [BP + 0xa],AX\nJMP LAB_1\nLAB_3:\nMOV AX,word ptr [BP + 8]\nMOV word ptr [BP +  + -2],AX\nMOV AX,word ptr [BP +  + -2]\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "int gcd(int a, int b) {\n    while (b != 0) {\n        int temp = a % b;\n        a = b;\n        b = temp;\n    }\n    return a;\n}",
     "status": "pass",
     "seconds": 0.99
    },
    "dos16-large-ox": {
     "asm": "PUSH BP\nMOV BP,SP\nMOV AX,word ptr [BP + 6]\nMOV BX,word ptr [BP + 8]\nLAB_1:\nTEST BX,BX\nJE LAB_2\nCWD\nIDIV BX\nMOV AX,BX\nMOV BX,DX\nJMP LAB_1\nLAB_2:\nPOP BP\nRETF",
     "c": "uint64_t gcd(uint64_t a, uint64_t b) {\n    uint64_t r;\n    while (b != 0) {\n        r = a % b;\n        a = b;\n        b = r;\n    }\n    return r;\n}",
     "status": "fail",
     "seconds": 0.69
    }
   }
  },
  {
   "id": "bubble_sort",
   "title": "Bubble sort",
   "desc": "dvě vnořené smyčky, prohazování prvků",
   "source": "void bubble_sort(int *a, int n) {\n    int i, j, t;\n    for (i = 0; i < n - 1; i++)\n        for (j = 0; j < n - 1 - i; j++)\n            if (a[j] > a[j + 1]) { t = a[j]; a[j] = a[j + 1]; a[j + 1] = t; }\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV dword ptr [RSP + 0x10],EDX\nMOV qword ptr [RSP + 8],RCX\nSUB RSP,0x18\nMOV dword ptr [RSP + 4],0\nJMP LAB_1\nLAB_7:\nMOV EAX,dword ptr [RSP + 4]\nINC EAX\nMOV dword ptr [RSP + 4],EAX\nLAB_1:\nMOV EAX,dword ptr [RSP + 0x28]\nDEC EAX\nCMP dword ptr [RSP + 4],EAX\nJGE LAB_2\nMOV dword ptr [RSP],0\nJMP LAB_3\nLAB_6:\nMOV EAX,dword ptr [RSP]\nINC EAX\nMOV dword ptr [RSP],EAX\nLAB_3:\nMOV EAX,dword ptr [RSP + 0x28]\nDEC EAX\nSUB EAX,dword ptr [RSP + 4]\nCMP dword ptr [RSP],EAX\nJGE LAB_4\nMOVSXD RAX,dword ptr [RSP]\nMOV ECX,dword ptr [RSP]\nINC ECX\nMOVSXD RCX,ECX\nMOV RDX,qword ptr [RSP + 0x20]\nMOV R8,qword ptr [RSP + 0x20]\nMOV ECX,dword ptr [R8 + RCX*4]\nCMP dword ptr [RDX + RAX*4],ECX\nJLE LAB_5\nMOVSXD RAX,dword ptr [RSP]\nMOV RCX,qword ptr [RSP + 0x20]\nMOV EAX,dword ptr [RCX + RAX*4]\nMOV dword ptr [RSP + 8],EAX\nMOV EAX,dword ptr [RSP]\nINC EAX\nCDQE\nMOVSXD RCX,dword ptr [RSP]\nMOV RDX,qword ptr [RSP + 0x20]\nMOV R8,qword ptr [RSP + 0x20]\nMOV EAX,dword ptr [R8 + RAX*4]\nMOV dword ptr [RDX + RCX*4],EAX\nMOV EAX,dword ptr [RSP]\nINC EAX\nCDQE\nMOV RCX,qword ptr [RSP + 0x20]\nMOV EDX,dword ptr [RSP + 8]\nMOV dword ptr [RCX + RAX*4],EDX\nLAB_5:\nJMP LAB_6\nLAB_4:\nJMP LAB_7\nLAB_2:\nADD RSP,0x18\nRET",
     "c": "void bubble_sort(int *array, int size)\n{\n int i, j;\n for (i = 0; i < size - 1; i++)\n  for (j = 0; j < size - 1 - i; j++)\n   if (array[j] > array[j + 1])\n   {\n    int temp = array[j];\n    array[j] = array[j + 1];\n    array[j + 1] = temp;\n   }\n}",
     "status": "pass",
     "seconds": 1.9
    },
    "msvc-x64-O2": {
     "asm": "MOV qword ptr [RSP + 8],RBX\nMOV qword ptr [RSP + 0x10],RDI\nLEA EBX,[RDX + -1]\nXOR R10D,R10D\nMOV EDI,EDX\nMOV R11,RCX\nTEST EBX,EBX\nJLE LAB_1\nNOP dword ptr [RAX + 0x0]\nLAB_5:\nMOV EAX,EDI\nSUB EAX,R10D\nDEC EAX\nTEST EAX,EAX\nJLE LAB_2\nMOV ECX,dword ptr [R11]\nMOV RDX,R11\nMOV R9D,EAX\nLAB_4:\nMOV R8D,ECX\nMOV ECX,dword ptr [RDX + 4]\nCMP R8D,ECX\nJLE LAB_3\nMOV dword ptr [RDX],ECX\nMOV ECX,R8D\nMOV dword ptr [RDX + 4],R8D\nLAB_3:\nADD RDX,4\nSUB R9,1\nJNE LAB_4\nLAB_2:\nINC R10D\nCMP R10D,EBX\nJL LAB_5\nLAB_1:\nMOV RBX,qword ptr [RSP + 8]\nMOV RDI,qword ptr [RSP + 0x10]\nRET",
     "c": "void bubble_sort(int *a, int n)\n{\n int i, j, temp;\n for (i = 0; i < n - 1; i++) {\n  for (j = 0; j < n - i - 1; j++) {\n   if (a[j] > a[j + 1]) {\n    temp = a[j];\n    a[j] = a[j + 1];\n    a[j + 1] = temp;\n   }\n  }\n }\n}",
     "status": "pass",
     "seconds": 1.59
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nSUB ESP,0xc\nPUSH ESI\nMOV dword ptr [EBP + -8],0\nJMP LAB_1\nLAB_7:\nMOV EAX,dword ptr [EBP + -8]\nADD EAX,1\nMOV dword ptr [EBP + -8],EAX\nLAB_1:\nMOV ECX,dword ptr [EBP + 0xc]\nSUB ECX,1\nCMP dword ptr [EBP + -8],ECX\nJGE LAB_2\nMOV dword ptr [EBP + -4],0\nJMP LAB_3\nLAB_6:\nMOV EDX,dword ptr [EBP + -4]\nADD EDX,1\nMOV dword ptr [EBP + -4],EDX\nLAB_3:\nMOV EAX,dword ptr [EBP + 0xc]\nSUB EAX,1\nSUB EAX,dword ptr [EBP + -8]\nCMP dword ptr [EBP + -4],EAX\nJGE LAB_4\nMOV ECX,dword ptr [EBP + -4]\nMOV EDX,dword ptr [EBP + 8]\nMOV EAX,dword ptr [EBP + -4]\nMOV ESI,dword ptr [EBP + 8]\nMOV ECX,dword ptr [EDX + ECX*4]\nCMP ECX,dword ptr [ESI + EAX*4 + 4]\nJLE LAB_5\nMOV EDX,dword ptr [EBP + -4]\nMOV EAX,dword ptr [EBP + 8]\nMOV ECX,dword ptr [EAX + EDX*4]\nMOV dword ptr [EBP + -0xc],ECX\nMOV EDX,dword ptr [EBP + -4]\nMOV EAX,dword ptr [EBP + 8]\nMOV ECX,dword ptr [EBP + -4]\nMOV ESI,dword ptr [EBP + 8]\nMOV ECX,dword ptr [ESI + ECX*4 + 4]\nMOV dword ptr [EAX + EDX*4],ECX\nMOV EDX,dword ptr [EBP + -4]\nMOV EAX,dword ptr [EBP + 8]\nMOV ECX,dword ptr [EBP + -0xc]\nMOV dword ptr [EAX + EDX*4 + 4],ECX\nLAB_5:\nJMP LAB_6\nLAB_4:\nJMP LAB_7\nLAB_2:\nPOP ESI\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "void bubble_sort(int *array, int size)\n{\n int i, j;\n for (i = 0; i < size - 1; i++)\n  for (j = 0; j < size - 1 - i; j++)\n   if (array[j] > array[j + 1])\n   {\n    int tmp = array[j];\n    array[j] = array[j + 1];\n    array[j + 1] = tmp;\n   }\n}",
     "status": "pass",
     "seconds": 1.97
    },
    "msvc-x86-O2": {
     "asm": "MOV ECX,dword ptr [ESP + 8]\nDEC ECX\nTEST ECX,ECX\nJLE LAB_1\nPUSH EBX\nPUSH ESI\nPUSH EDI\nMOV EDI,dword ptr [ESP + 0x10]\nMOV EBX,ECX\nLAB_5:\nXOR EAX,EAX\nTEST ECX,ECX\nJLE LAB_2\nNOP dword ptr [EAX + EAX + 0x0]\nLAB_4:\nMOV EDX,dword ptr [EDI + EAX*4]\nMOV ESI,dword ptr [EDI + EAX*4 + 4]\nCMP EDX,ESI\nJLE LAB_3\nMOV dword ptr [EDI + EAX*4],ESI\nMOV dword ptr [EDI + EAX*4 + 4],EDX\nLAB_3:\nINC EAX\nCMP EAX,ECX\nJL LAB_4\nLAB_2:\nDEC ECX\nSUB EBX,1\nJNE LAB_5\nPOP EDI\nPOP ESI\nPOP EBX\nLAB_1:\nRET",
     "c": "void sort(int *a, int n)\n{\n int i, j;\n for (i = 0; i < n - 1; i++) {\n  for (j = 0; j < n - 1; j++) {\n   if (a[j] > a[j + 1]) {\n    int t = a[j];\n    a[j] = a[j + 1];\n    a[j + 1] = t;\n   }\n  }\n }\n}",
     "status": "pass",
     "seconds": 1.56
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,8\nMOV word ptr [BP +  + -6],0\nLAB_1:\nMOV AX,word ptr [BP + 0xa]\nDEC AX\nCMP AX,word ptr [BP +  + -6]\nJLE LAB_2\nJMP LAB_3\nLAB_2:\nJMP LAB_4\nLAB_3:\nMOV word ptr [BP +  + -4],0\nLAB_5:\nMOV AX,word ptr [BP + 0xa]\nDEC AX\nSUB AX,word ptr [BP +  + -6]\nCMP AX,word ptr [BP +  + -4]\nJG LAB_6\nJMP LAB_7\nLAB_6:\nMOV SI,word ptr [BP +  + -4]\nSHL SI,1\nADD SI,word ptr [BP + 8]\nMOV BX,word ptr [BP +  + -4]\nSHL BX,1\nADD BX,word ptr [BP + 8]\nMOV BX,word ptr [BX]\nCMP BX,word ptr [SI + 2]\nJLE LAB_8\nJMP LAB_9\nLAB_8:\nJMP LAB_10\nLAB_9:\nMOV BX,word ptr [BP +  + -4]\nSHL BX,1\nADD BX,word ptr [BP + 8]\nMOV AX,word ptr [BX]\nMOV word ptr [BP +  + -2],AX\nMOV BX,word ptr [BP +  + -4]\nSHL BX,1\nADD BX,word ptr [BP + 8]\nMOV SI,word ptr [BP +  + -4]\nSHL SI,1\nADD SI,word ptr [BP + 8]\nMOV AX,word ptr [BX + 2]\nMOV word ptr [SI],AX\nMOV BX,word ptr [BP +  + -4]\nSHL BX,1\nADD BX,word ptr [BP + 8]\nMOV AX,word ptr [BP +  + -2]\nMOV word ptr [BX + 2],AX\nJMP LAB_10\nLAB_10:\nINC word ptr [BP +  + -4]\nJMP LAB_5\nLAB_7:\nINC word ptr [BP +  + -6]\nJMP LAB_1\nLAB_4:\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "void sort(int *arr, int len)\n{\n int i, j, tmp;\n for (i = 0; i < len - 1; i++)\n  for (j = 0; j < len - 1 - i; j++)\n   if (arr[j] > arr[j + 1]) {\n    tmp = arr[j];\n    arr[j] = arr[j + 1];\n    arr[j + 1] = tmp;\n   }\n}",
     "status": "pass",
     "seconds": 1.97
    },
    "dos16-large-ox": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,6\nMOV AX,word ptr [BP + 0xe]\nDEC AX\nMOV ES,word ptr [BP + 0xc]\nMOV word ptr [BP +  + -4],AX\nMOV word ptr [BP +  + -2],AX\nMOV AX,word ptr [BP + 0xa]\nXOR DI,DI\nMOV word ptr [BP +  + -6],AX\nLAB_1:\nCMP DI,word ptr [BP +  + -4]\nJGE LAB_2\nMOV SI,word ptr [BP +  + -2]\nMOV BX,word ptr [BP +  + -6]\nMOV DX,ES\nXOR AX,AX\nMOV DS,DX\nLAB_3:\nCMP AX,SI\nJL LAB_4\nDEC word ptr [BP +  + -2]\nINC DI\nJMP LAB_1\nLAB_4:\nMOV DX,word ptr [BX]\nCMP DX,word ptr [BX + 2]\nJG LAB_5\nLAB_6:\nADD BX,2\nINC AX\nJMP LAB_3\nLAB_5:\nMOV CX,word ptr [BX + 2]\nMOV word ptr [BX],CX\nMOV word ptr [BX + 2],DX\nJMP LAB_6\nLAB_2:\nLEAVE\nPOP DI\nPOP SI\nRETF",
     "c": "void insertion_sort(int *array, int size)\n{\n int i, j;\n int temp;\n for (i = 0; i < size - 1; i++) {\n  for (j = 0; j < size - 1 - i; j++) {\n   if (array[j] > array[j + 1]) {\n    temp = array[j];\n    array[j] = array[j + 1];\n    array[j + 1] = temp;\n   }\n  }\n }\n}",
     "status": "pass",
     "seconds": 1.67
    }
   }
  },
  {
   "id": "reverse",
   "title": "Otočení řetězce",
   "desc": "dva ukazatele proti sobě",
   "source": "void reverse(char *s) {\n    char *e = s + strlen(s) - 1, t;\n    while (s < e) { t = *s; *s++ = *e; *e-- = t; }\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV qword ptr [RSP + 8],RCX\nSUB RSP,0x38\nMOV RCX,qword ptr [RSP + 0x40]\nCALL strlen\nMOV RCX,qword ptr [RSP + 0x40]\nLEA RAX,[RCX + RAX + -1]\nMOV qword ptr [RSP + 0x28],RAX\nLAB_2:\nMOV RAX,qword ptr [RSP + 0x28]\nCMP qword ptr [RSP + 0x40],RAX\nJAE LAB_1\nMOV RAX,qword ptr [RSP + 0x40]\nMOVZX EAX,byte ptr [RAX]\nMOV byte ptr [RSP + 0x20],AL\nMOV RAX,qword ptr [RSP + 0x40]\nMOV RCX,qword ptr [RSP + 0x28]\nMOVZX ECX,byte ptr [RCX]\nMOV byte ptr [RAX],CL\nMOV RAX,qword ptr [RSP + 0x40]\nINC RAX\nMOV qword ptr [RSP + 0x40],RAX\nMOV RAX,qword ptr [RSP + 0x28]\nMOVZX ECX,byte ptr [RSP + 0x20]\nMOV byte ptr [RAX],CL\nMOV RAX,qword ptr [RSP + 0x28]\nDEC RAX\nMOV qword ptr [RSP + 0x28],RAX\nJMP LAB_2\nLAB_1:\nADD RSP,0x38\nRET",
     "c": "void reverse(char *str)\n{\n char *end = str + strlen(str) - 1;\n while (str < end) {\n  char tmp = *str;\n  *str = *end;\n  *end = tmp;\n  str++;\n  end--;\n }\n}",
     "status": "pass",
     "seconds": 0.96
    },
    "msvc-x64-O2": {
     "asm": "MOV RAX,0xffffffffffffffff\nLAB_1:\nINC RAX\nCMP byte ptr [RCX + RAX],0\nJNE LAB_1\nLEA R8,[RCX + -1]\nADD R8,RAX\nCMP RCX,R8\nJAE LAB_2\nNOP dword ptr [RAX]\nLAB_3:\nMOVZX EAX,byte ptr [R8]\nMOVZX EDX,byte ptr [RCX]\nMOV byte ptr [RCX],AL\nINC RCX\nMOV byte ptr [R8],DL\nDEC R8\nCMP RCX,R8\nJB LAB_3\nLAB_2:\nRET",
     "c": "void reverse(char *str)\n{\n char *end = str + strlen(str) - 1;\n char tmp;\n while (str < end) {\n  tmp = *str;\n  *str = *end;\n  *end = tmp;\n  str++;\n  end--;\n }\n}",
     "status": "pass",
     "seconds": 1.0
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nSUB ESP,8\nMOV EAX,dword ptr [EBP + 8]\nPUSH EAX\nCALL _strlen\nADD ESP,4\nMOV ECX,dword ptr [EBP + 8]\nLEA EDX,[ECX + EAX + -1]\nMOV dword ptr [EBP + -8],EDX\nLAB_2:\nMOV EAX,dword ptr [EBP + 8]\nCMP EAX,dword ptr [EBP + -8]\nJAE LAB_1\nMOV ECX,dword ptr [EBP + 8]\nMOV DL,byte ptr [ECX]\nMOV byte ptr [EBP + -1],DL\nMOV EAX,dword ptr [EBP + 8]\nMOV ECX,dword ptr [EBP + -8]\nMOV DL,byte ptr [ECX]\nMOV byte ptr [EAX],DL\nMOV EAX,dword ptr [EBP + 8]\nADD EAX,1\nMOV dword ptr [EBP + 8],EAX\nMOV ECX,dword ptr [EBP + -8]\nMOV DL,byte ptr [EBP + -1]\nMOV byte ptr [ECX],DL\nMOV EAX,dword ptr [EBP + -8]\nSUB EAX,1\nMOV dword ptr [EBP + -8],EAX\nJMP LAB_2\nLAB_1:\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "void reverse(char *str)\n{\n char *end = str + strlen(str) - 1;\n while (str < end) {\n  char tmp = *str;\n  *str = *end;\n  *end = tmp;\n  str++;\n  end--;\n }\n}",
     "status": "pass",
     "seconds": 0.95
    },
    "msvc-x86-O2": {
     "asm": "MOV EAX,dword ptr [ESP + 4]\nMOV EDX,EAX\nPUSH ESI\nLEA ESI,[EDX + 1]\nNOP word ptr [EAX + EAX]\nLAB_1:\nMOV CL,byte ptr [EDX]\nINC EDX\nTEST CL,CL\nJNE LAB_1\nSUB EDX,ESI\nLEA ESI,[EAX + -1]\nADD ESI,EDX\nCMP EAX,ESI\nJAE LAB_2\nLAB_3:\nMOV CL,byte ptr [ESI]\nMOV DL,byte ptr [EAX]\nMOV byte ptr [EAX],CL\nINC EAX\nMOV byte ptr [ESI],DL\nDEC ESI\nCMP EAX,ESI\nJB LAB_3\nLAB_2:\nPOP ESI\nRET",
     "c": "void reverse(char *str)\n{\n char *end = str + strlen(str) - 1;\n char tmp;\n char *p = str;\n while (p < end) {\n  tmp = *p;\n  *p = *end;\n  *end = tmp;\n  p++;\n  end--;\n }\n}",
     "status": "pass",
     "seconds": 1.09
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,6\nMOV AX,word ptr [BP + 8]\nCALL strlen_\nADD AX,word ptr [BP + 8]\nDEC AX\nMOV word ptr [BP +  + -4],AX\nJMP LAB_1\nLAB_1:\nMOV BX,word ptr [BP + 8]\nCMP BX,word ptr [BP +  + -4]\nJB LAB_2\nJMP LAB_3\nLAB_2:\nMOV BX,word ptr [BP + 8]\nMOV AL,byte ptr [BX]\nMOV byte ptr [BP +  + -2],AL\nMOV SI,word ptr [BP + 8]\nINC word ptr [BP + 8]\nMOV BX,word ptr [BP +  + -4]\nMOV AL,byte ptr [BX]\nMOV byte ptr [SI],AL\nMOV BX,word ptr [BP +  + -4]\nDEC word ptr [BP +  + -4]\nMOV AL,byte ptr [BP +  + -2]\nMOV byte ptr [BX],AL\nJMP LAB_1\nLAB_3:\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "void reverse(char *str)\n{\n char *end;\n char tmp;\n\n end = str + strlen_(str) - 1;\n while (str < end) {\n  tmp = *str;\n  *str++ = *end;\n  *end-- = tmp;\n }\n}",
     "status": "pass",
     "seconds": 1.01
    },
    "dos16-large-ox": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nLDS BX,dword ptr [BP + 0xa]\nMOV AX,DS\nMOV DI,BX\nMOV ES,AX\nOR CX,0xffff\nXOR AX,AX\nREPNE scasb\nNOT CX\nDEC CX\nMOV SI,CX\nADD SI,BX\nDEC SI\nLAB_1:\nCMP BX,SI\nJAE LAB_2\nMOV AL,byte ptr [BX]\nMOV AH,byte ptr ES:[SI]\nMOV byte ptr [BX],AH\nINC BX\nMOV byte ptr ES:[SI],AL\nADD SI,0xffff\nJMP LAB_1\nLAB_2:\nPOP BP\nPOP DI\nPOP SI\nRETF",
     "c": "void reverse(char *s)\n{\n char *t = s;\n int i = ~0;\n for (i = 0; i < (s + (sizeof(char) * 8 - 1)); i++) {\n  char t = t[i];\n  t[i] = s[i];\n  s[i] = t;\n }\n}",
     "status": "compile_error",
     "seconds": 1.21
    }
   }
  },
  {
   "id": "is_prime",
   "title": "Test prvočísla",
   "desc": "dělení zkusmo do odmocniny",
   "source": "int is_prime(int n) {\n    int d;\n    if (n < 2) return 0;\n    for (d = 2; d * d <= n; d++)\n        if (n % d == 0) return 0;\n    return 1;\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV dword ptr [RSP + 8],ECX\nSUB RSP,0x18\nCMP dword ptr [RSP + 0x20],2\nJGE LAB_1\nXOR EAX,EAX\nJMP LAB_2\nLAB_1:\nMOV dword ptr [RSP],2\nJMP LAB_3\nLAB_6:\nMOV EAX,dword ptr [RSP]\nINC EAX\nMOV dword ptr [RSP],EAX\nLAB_3:\nMOV EAX,dword ptr [RSP]\nIMUL EAX,dword ptr [RSP]\nCMP EAX,dword ptr [RSP + 0x20]\nJG LAB_4\nMOV EAX,dword ptr [RSP + 0x20]\nCDQ\nIDIV EAX,dword ptr [RSP]\nMOV EAX,EDX\nTEST EAX,EAX\nJNE LAB_5\nXOR EAX,EAX\nJMP LAB_2\nLAB_5:\nJMP LAB_6\nLAB_4:\nMOV EAX,1\nLAB_2:\nADD RSP,0x18\nRET",
     "c": "bool isPrime(int n)\n{\n    if (n < 2)\n        return false;\n\n    for (int i = 2; i * i <= n; i++)\n    {\n        if (n % i == 0)\n            return false;\n    }\n\n    return true;\n}",
     "status": "pass",
     "seconds": 0.91
    },
    "msvc-x64-O2": {
     "asm": "CMP ECX,2\nJL LAB_1\nMOV R8D,2\nCMP ECX,4\nJL LAB_2\nLAB_3:\nMOV EAX,ECX\nCDQ\nIDIV EAX,R8D\nTEST EDX,EDX\nJE LAB_1\nINC R8D\nMOV EAX,R8D\nIMUL EAX,R8D\nCMP EAX,ECX\nJLE LAB_3\nLAB_2:\nMOV EAX,1\nRET\nLAB_1:\nXOR EAX,EAX\nRET",
     "c": "bool isPrime(int n) {\n    if (n < 2) {\n        return false;\n    }\n    int i = 2;\n    while (i * i <= n) {\n        if (n % i == 0) {\n            return false;\n        }\n        i++;\n    }\n    return true;\n}",
     "status": "pass",
     "seconds": 1.01
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nPUSH ECX\nCMP dword ptr [EBP + 8],2\nJGE LAB_1\nXOR EAX,EAX\nJMP LAB_2\nLAB_1:\nMOV dword ptr [EBP + -4],2\nJMP LAB_3\nLAB_6:\nMOV EAX,dword ptr [EBP + -4]\nADD EAX,1\nMOV dword ptr [EBP + -4],EAX\nLAB_3:\nMOV ECX,dword ptr [EBP + -4]\nIMUL ECX,dword ptr [EBP + -4]\nCMP ECX,dword ptr [EBP + 8]\nJG LAB_4\nMOV EAX,dword ptr [EBP + 8]\nCDQ\nIDIV EAX,dword ptr [EBP + -4]\nTEST EDX,EDX\nJNE LAB_5\nXOR EAX,EAX\nJMP LAB_2\nLAB_5:\nJMP LAB_6\nLAB_4:\nMOV EAX,1\nLAB_2:\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "bool isPrime(int n)\n{\n    if (n < 2)\n        return false;\n\n    for (int i = 2; i * i <= n; i++)\n        if (n % i == 0)\n            return false;\n\n    return true;\n}",
     "status": "pass",
     "seconds": 0.85
    },
    "msvc-x86-O2": {
     "asm": "PUSH ESI\nMOV ESI,dword ptr [ESP + 8]\nCMP ESI,2\nJL LAB_1\nMOV ECX,2\nCMP ESI,4\nJL LAB_2\nLAB_3:\nMOV EAX,ESI\nCDQ\nIDIV EAX,ECX\nTEST EDX,EDX\nJE LAB_1\nINC ECX\nMOV EAX,ECX\nIMUL EAX,ECX\nCMP EAX,ESI\nJLE LAB_3\nLAB_2:\nMOV EAX,1\nPOP ESI\nRET\nLAB_1:\nXOR EAX,EAX\nPOP ESI\nRET",
     "c": "bool isPrime(int n) {\n    if (n < 2) {\n        return false;\n    }\n    int i;\n    for (i = 2; i * i <= n; i++) {\n        if (n % i == 0) {\n            return false;\n        }\n    }\n    return true;\n}",
     "status": "pass",
     "seconds": 1.01
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,4\nCMP word ptr [BP + 8],2\nJL LAB_1\nJMP LAB_2\nLAB_1:\nMOV word ptr [BP +  + -4],0\nJMP LAB_3\nLAB_2:\nMOV word ptr [BP +  + -2],2\nLAB_4:\nMOV AX,word ptr [BP +  + -2]\nIMUL word ptr [BP +  + -2]\nCMP AX,word ptr [BP + 8]\nJLE LAB_5\nJMP LAB_6\nLAB_5:\nMOV AX,word ptr [BP + 8]\nCWD\nIDIV word ptr [BP +  + -2]\nTEST DX,DX\nJNE LAB_7\nMOV word ptr [BP +  + -4],0\nJMP LAB_3\nLAB_7:\nINC word ptr [BP +  + -2]\nJMP LAB_4\nLAB_6:\nMOV word ptr [BP +  + -4],1\nLAB_3:\nMOV AX,word ptr [BP +  + -4]\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "bool isPrime(int n)\n{\n    if (n < 2)\n        return false;\n\n    for (int i = 2; i * i <= n; i++)\n    {\n        if (n % i == 0)\n            return false;\n    }\n\n    return true;\n}",
     "status": "pass",
     "seconds": 0.93
    },
    "dos16-large-ox": {
     "asm": "PUSH BP\nMOV BP,SP\nMOV CX,word ptr [BP + 6]\nCMP CX,2\nJL LAB_1\nMOV BX,2\nLAB_2:\nMOV AX,BX\nIMUL BX\nCMP AX,CX\nJG LAB_3\nMOV AX,CX\nCWD\nIDIV BX\nTEST DX,DX\nJE LAB_1\nINC BX\nJMP LAB_2\nLAB_1:\nXOR AX,AX\nPOP BP\nRETF\nLAB_3:\nMOV AX,1\nPOP BP\nRETF",
     "c": "bool isPrime(int n) {\n    if (n < 2) {\n        return false;\n    }\n    for (int i = 2; i * i <= n; i++) {\n        if (n % i == 0) {\n            return false;\n        }\n    }\n    return true;\n}",
     "status": "pass",
     "seconds": 0.97
    }
   }
  },
  {
   "id": "checksum",
   "title": "XOR kontrolní součet",
   "desc": "bitové operace a rotace",
   "source": "unsigned char checksum(const unsigned char *p, int n) {\n    unsigned char c = 0;\n    while (n--) c = (unsigned char)(((c << 1) | (c >> 7)) ^ *p++);\n    return c;\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV dword ptr [RSP + 0x10],EDX\nMOV qword ptr [RSP + 8],RCX\nSUB RSP,0x18\nMOV byte ptr [RSP],0\nLAB_2:\nMOV EAX,dword ptr [RSP + 0x28]\nMOV dword ptr [RSP + 4],EAX\nMOV EAX,dword ptr [RSP + 0x28]\nDEC EAX\nMOV dword ptr [RSP + 0x28],EAX\nCMP dword ptr [RSP + 4],0\nJE LAB_1\nMOVZX EAX,byte ptr [RSP]\nSHL EAX,1\nMOVZX ECX,byte ptr [RSP]\nSAR ECX,7\nOR EAX,ECX\nMOV RCX,qword ptr [RSP + 0x20]\nMOVZX ECX,byte ptr [RCX]\nXOR EAX,ECX\nMOV byte ptr [RSP],AL\nMOV RAX,qword ptr [RSP + 0x20]\nINC RAX\nMOV qword ptr [RSP + 0x20],RAX\nJMP LAB_2\nLAB_1:\nMOVZX EAX,byte ptr [RSP]\nADD RSP,0x18\nRET",
     "c": "unsigned char\ncrc16(unsigned char *buf, int len)\n{\n unsigned char crc = 0;\n\n while (len--)\n  crc = (crc << 1) | (crc >> 7);\n\n return crc;\n}",
     "status": "fail",
     "seconds": 0.76
    },
    "msvc-x64-O2": {
     "asm": "XOR AL,AL\nTEST EDX,EDX\nJE LAB_1\nNOP word ptr [RAX + RAX + 0x0]\nLAB_2:\nROL AL,1\nXOR AL,byte ptr [RCX]\nLEA RCX,[RCX + 1]\nSUB EDX,1\nJNE LAB_2\nLAB_1:\nRET",
     "c": "unsigned char\n__bid128_is_zero (BID_UINT128 x, unsigned int n)\n{\n  unsigned char c = 0;\n\n  while (n--)\n    c = (c << 1) ^ x[c];\n\n  return c;\n}",
     "status": "compile_error",
     "seconds": 0.79
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nSUB ESP,8\nMOV byte ptr [EBP + -1],0\nLAB_2:\nMOV EAX,dword ptr [EBP + 0xc]\nMOV dword ptr [EBP + -8],EAX\nMOV ECX,dword ptr [EBP + 0xc]\nSUB ECX,1\nMOV dword ptr [EBP + 0xc],ECX\nCMP dword ptr [EBP + -8],0\nJE LAB_1\nMOVZX EDX,byte ptr [EBP + -1]\nSHL EDX,1\nMOVZX EAX,byte ptr [EBP + -1]\nSAR EAX,7\nOR EDX,EAX\nMOV ECX,dword ptr [EBP + 8]\nMOVZX EAX,byte ptr [ECX]\nXOR EDX,EAX\nMOV byte ptr [EBP + -1],DL\nMOV ECX,dword ptr [EBP + 8]\nADD ECX,1\nMOV dword ptr [EBP + 8],ECX\nJMP LAB_2\nLAB_1:\nMOVZX EAX,byte ptr [EBP + -1]\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "unsigned char\ncrc16(unsigned char *buf, int len)\n{\n unsigned char crc = 0;\n\n while (len--)\n  crc = (crc << 1) | (crc >> 7);\n\n return crc;\n}",
     "status": "fail",
     "seconds": 0.74
    },
    "msvc-x86-O2": {
     "asm": "MOV ECX,dword ptr [ESP + 8]\nXOR AL,AL\nTEST ECX,ECX\nJE LAB_1\nMOV EDX,dword ptr [ESP + 4]\nNOP\nLAB_2:\nROL AL,1\nLEA EDX,[EDX + 1]\nXOR AL,byte ptr [EDX + -1]\nSUB ECX,1\nJNE LAB_2\nLAB_1:\nRET",
     "c": "unsigned char\n__bid128_is_zero (unsigned char * pres, unsigned int len)\n{\n  unsigned char res = 0;\n  unsigned char i;\n\n  for (i = 0; i < len; i++)\n    {\n      res = (res << 1) ^ *(pres++);\n    }\n  return res;\n}",
     "status": "pass",
     "seconds": 1.05
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,4\nMOV byte ptr [BP +  + -2],0\nLAB_1:\nDEC word ptr [BP + 0xa]\nCMP word ptr [BP + 0xa],0xffff\nJE LAB_2\nJMP LAB_3\nLAB_2:\nJMP LAB_4\nLAB_3:\nMOV AL,byte ptr [BP +  + -2]\nXOR AH,AH\nSHL AX,1\nMOV BX,AX\nMOV AL,byte ptr [BP +  + -2]\nXOR AH,AH\nMOV CL,7\nSAR AX,CL\nOR BX,AX\nMOV DX,BX\nMOV BX,word ptr [BP + 8]\nINC word ptr [BP + 8]\nMOV AL,byte ptr [BX]\nXOR AH,AH\nXOR AX,DX\nMOV byte ptr [BP +  + -2],AL\nJMP LAB_1\nLAB_4:\nMOV AL,byte ptr [BP +  + -2]\nMOV byte ptr [BP +  + -4],AL\nMOV AL,byte ptr [BP +  + -4]\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "unsigned char\ncrc16(unsigned char *buf, int len)\n{\n unsigned char crc = 0;\n\n while (len--)\n  crc = (crc << 7) | (crc >> 7);\n\n return crc;\n}",
     "status": "fail",
     "seconds": 0.76
    },
    "dos16-large-ox": {
     "asm": "PUSH BP\nMOV BP,SP\nLDS BX,dword ptr [BP + 6]\nMOV DX,word ptr [BP + 0xa]\nXOR AL,AL\nLAB_1:\nDEC DX\nCMP DX,0xffff\nJE LAB_2\nXOR AH,AH\nMOV CX,AX\nADD CX,AX\nSAR AX,7\nOR CX,AX\nMOV AL,byte ptr [BX]\nXOR AH,AH\nINC BX\nXOR AX,CX\nJMP LAB_1\nLAB_2:\nPOP BP\nRETF",
     "c": "uint32_t\nhash(const void *key, int len)\n{\n const unsigned char *p = key;\n uint32_t h = 0;\n\n while (len--) {\n  h = (h << 1) | (h >> 7);\n  h = (h ^ *p++);\n }\n\n return h;\n}",
     "status": "pass",
     "seconds": 0.99
    }
   }
  },
  {
   "id": "classify",
   "title": "Třídění znaku",
   "desc": "switch / větvení podle rozsahů",
   "source": "int classify(int c) {\n    if (c >= '0' && c <= '9') return 1;\n    if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) return 2;\n    switch (c) {\n    case ' ': case '\\t': case '\\n': return 3;\n    default: return 0;\n    }\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV dword ptr [RSP + 8],ECX\nSUB RSP,0x18\nCMP dword ptr [RSP + 0x20],0x30\nJL LAB_1\nCMP dword ptr [RSP + 0x20],0x39\nJG LAB_1\nMOV EAX,1\nJMP LAB_2\nLAB_1:\nCMP dword ptr [RSP + 0x20],0x61\nJL LAB_3\nCMP dword ptr [RSP + 0x20],0x7a\nJLE LAB_4\nLAB_3:\nCMP dword ptr [RSP + 0x20],0x41\nJL LAB_5\nCMP dword ptr [RSP + 0x20],0x5a\nJG LAB_5\nLAB_4:\nMOV EAX,2\nJMP LAB_2\nLAB_5:\nMOV EAX,dword ptr [RSP + 0x20]\nMOV dword ptr [RSP],EAX\nCMP dword ptr [RSP],9\nJE LAB_6\nCMP dword ptr [RSP],0xa\nJE LAB_6\nCMP dword ptr [RSP],0x20\nJE LAB_6\nJMP LAB_7\nLAB_6:\nMOV EAX,3\nJMP LAB_2\nLAB_7:\nXOR EAX,EAX\nLAB_2:\nADD RSP,0x18\nRET",
     "c": "int\niswprint(wint_t c)\n{\n if (c >= '0' && c <= '9')\n  return 1;\n if (c >= 'a' && c <= 'z')\n  return 2;\n switch (c) {\n case '\\t':\n case '\\n':\n case '\\r':\n case '\\t':\n  return 3;\n default:\n  return 0;\n }\n}",
     "status": "compile_error",
     "seconds": 1.41
    },
    "msvc-x64-O2": {
     "asm": "LEA EAX,[RCX + -0x30]\nCMP EAX,9\nJA LAB_1\nMOV EAX,1\nRET\nLAB_1:\nLEA EAX,[RCX + -0x61]\nCMP EAX,0x19\nJBE LAB_2\nLEA EAX,[RCX + -0x41]\nCMP EAX,0x19\nJBE LAB_2\nSUB ECX,9\nJE LAB_3\nSUB ECX,1\nJE LAB_3\nCMP ECX,0x16\nJE LAB_3\nXOR EAX,EAX\nRET\nLAB_3:\nMOV EAX,3\nRET\nLAB_2:\nMOV EAX,2\nRET",
     "c": "int\nisxdigit(int c)\n{\n if (c >= '0' && c <= '9')\n  return 1;\n if (c >= 'a' && c <= 'z')\n  return 2;\n if (c >= 'A' && c <= 'Z')\n  return 3;\n switch (c) {\n case '0':\n  return 3;\n case '1':\n  return 2;\n case '2':\n  return 1;\n case '3':\n  return 0;\n default:\n  return 0;\n }\n}",
     "status": "fail",
     "seconds": 1.74
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nPUSH ECX\nCMP dword ptr [EBP + 8],0x30\nJL LAB_1\nCMP dword ptr [EBP + 8],0x39\nJG LAB_1\nMOV EAX,1\nJMP LAB_2\nLAB_1:\nCMP dword ptr [EBP + 8],0x61\nJL LAB_3\nCMP dword ptr [EBP + 8],0x7a\nJLE LAB_4\nLAB_3:\nCMP dword ptr [EBP + 8],0x41\nJL LAB_5\nCMP dword ptr [EBP + 8],0x5a\nJG LAB_5\nLAB_4:\nMOV EAX,2\nJMP LAB_2\nLAB_5:\nMOV EAX,dword ptr [EBP + 8]\nMOV dword ptr [EBP + -4],EAX\nCMP dword ptr [EBP + -4],9\nJE LAB_6\nCMP dword ptr [EBP + -4],0xa\nJE LAB_6\nCMP dword ptr [EBP + -4],0x20\nJE LAB_6\nJMP LAB_7\nLAB_6:\nMOV EAX,3\nJMP LAB_2\nLAB_7:\nXOR EAX,EAX\nLAB_2:\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "int\niswprint(wint_t c)\n{\n if (c >= '0' && c <= '9')\n  return 1;\n if (c >= 'a' && c <= 'z')\n  return 2;\n switch (c) {\n case '\\t':\n case '\\n':\n case '\\r':\n case '\\t':\n  return 3;\n default:\n  return 0;\n }\n}",
     "status": "compile_error",
     "seconds": 1.38
    },
    "msvc-x86-O2": {
     "asm": "MOV ECX,dword ptr [ESP + 4]\nLEA EAX,[ECX + -0x30]\nCMP EAX,9\nJA LAB_1\nMOV EAX,1\nRET\nLAB_1:\nCMP ECX,0x61\nJL LAB_2\nCMP ECX,0x7a\nJLE LAB_3\nLAB_2:\nLEA EAX,[ECX + -0x41]\nCMP EAX,0x19\nJA LAB_4\nLAB_3:\nMOV EAX,2\nRET\nLAB_4:\nSUB ECX,9\nJE LAB_5\nSUB ECX,1\nJE LAB_5\nSUB ECX,0x16\nJE LAB_5\nXOR EAX,EAX\nRET\nLAB_5:\nMOV EAX,3\nRET",
     "c": "int\nisxdigit(int c)\n{\n if (c >= '0' && c <= '9')\n  return 1;\n if (c >= 'a' && c <= 'z')\n  return 2;\n if (c >= 'A' && c <= 'Z')\n  return 3;\n switch (c) {\n case '0':\n  return 3;\n case '1':\n  return 4;\n case '2':\n  return 5;\n case '3':\n  return 6;\n case '4':\n  return 7;\n default:\n  return 0;\n }\n}",
     "status": "fail",
     "seconds": 1.9
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,2\nCMP word ptr [BP + 8],0x30\nJGE LAB_1\nJMP LAB_2\nLAB_1:\nCMP word ptr [BP + 8],0x39\nJLE LAB_3\nLAB_2:\nJMP LAB_4\nLAB_3:\nMOV word ptr [BP +  + -2],1\nJMP LAB_5\nLAB_4:\nCMP word ptr [BP + 8],0x61\nJL LAB_6\nCMP word ptr [BP + 8],0x7a\nJG LAB_6\nJMP LAB_7\nLAB_6:\nCMP word ptr [BP + 8],0x41\nJL LAB_8\nCMP word ptr [BP + 8],0x5a\nJLE LAB_7\nLAB_8:\nJMP LAB_9\nLAB_7:\nMOV word ptr [BP +  + -2],2\nJMP LAB_5\nLAB_9:\nCMP word ptr [BP + 8],0x20\nJNE LAB_10\nJMP LAB_11\nLAB_10:\nCMP word ptr [BP + 8],9\nJB LAB_12\nCMP word ptr [BP + 8],0xa\nJA LAB_13\nJMP LAB_11\nLAB_13:\nJMP LAB_14\nLAB_12:\nJMP LAB_14\nLAB_11:\nMOV word ptr [BP +  + -2],3\nJMP LAB_5\nLAB_14:\nMOV word ptr [BP +  + -2],0\nLAB_5:\nMOV AX,word ptr [BP +  + -2]\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "int\niswprint(wint_t c)\n{\n if (c >= '0' && c <= '9')\n  return (1);\n if (c >= 'a' && c <= 'z')\n  return (2);\n if (c == ' ')\n  goto out;\n if (c >= ' ' || c <= '\\t')\n  return (3);\n return (0);\nout:\n return (0);\n}",
     "status": "fail",
     "seconds": 1.45
    },
    "dos16-large-ox": {
     "asm": "PUSH BP\nMOV BP,SP\nMOV AX,word ptr [BP + 6]\nCMP AX,0x30\nJL LAB_1\nCMP AX,0x39\nJLE LAB_2\nLAB_1:\nCMP AX,0x61\nJL LAB_3\nCMP AX,0x7a\nJLE LAB_4\nLAB_3:\nCMP AX,0x41\nJL LAB_5\nCMP AX,0x5a\nJLE LAB_4\nLAB_5:\nCMP AX,0x20\nJE LAB_6\nCMP AX,9\nJB LAB_7\nCMP AX,0xa\nJA LAB_7\nLAB_6:\nMOV AX,3\nPOP BP\nRETF\nLAB_2:\nMOV AX,1\nPOP BP\nRETF\nLAB_4:\nMOV AX,2\nPOP BP\nRETF\nLAB_7:\nXOR AX,AX\nPOP BP\nRETF",
     "c": "int\niswprint(wint_t c)\n{\n if (c >= '0' && c <= '9')\n  return (1);\n if (c >= 'a' && c <= 'z')\n  return (2);\n if (c >= 'A' && c <= 'Z')\n  return (3);\n if (c == ' ' || c == '\\t' || c == '\\n')\n  return (3);\n return (0);\n}",
     "status": "fail",
     "seconds": 1.54
    }
   }
  },
  {
   "id": "count_bits",
   "title": "Počet jedničkových bitů",
   "desc": "posuny a maskování",
   "source": "int count_bits(unsigned x) {\n    int n = 0;\n    while (x) { n += x & 1; x >>= 1; }\n    return n;\n}",
   "variants": {
    "msvc-x64-Od": {
     "asm": "MOV dword ptr [RSP + 8],ECX\nSUB RSP,0x18\nMOV dword ptr [RSP],0\nLAB_2:\nCMP dword ptr [RSP + 0x20],0\nJE LAB_1\nMOV EAX,dword ptr [RSP + 0x20]\nAND EAX,1\nMOV ECX,dword ptr [RSP]\nADD ECX,EAX\nMOV EAX,ECX\nMOV dword ptr [RSP],EAX\nMOV EAX,dword ptr [RSP + 0x20]\nSHR EAX,1\nMOV dword ptr [RSP + 0x20],EAX\nJMP LAB_2\nLAB_1:\nMOV EAX,dword ptr [RSP]\nADD RSP,0x18\nRET",
     "c": "unsigned int\n__bid32_isNegative (unsigned int x ) {\n\n  unsigned int res = 0;\n\n  while (x != 0) {\n    res += x & 1;\n    x >>= 1;\n  }\n\n  return res;\n}",
     "status": "pass",
     "seconds": 0.77
    },
    "msvc-x64-O2": {
     "asm": "XOR EAX,EAX\nTEST ECX,ECX\nJE LAB_1\nNOP word ptr [RAX + RAX + 0x0]\nLAB_2:\nMOV EDX,ECX\nAND EDX,1\nADD EAX,EDX\nSHR ECX,1\nJNE LAB_2\nLAB_1:\nRET",
     "c": "unsigned int\n__hsail_bitcount (unsigned int n)\n{\n  unsigned int sum = 0;\n  while (n)\n    {\n      sum += n & 1;\n      n >>= 1;\n    }\n  return sum;\n}",
     "status": "pass",
     "seconds": 0.74
    },
    "msvc-x86-Od": {
     "asm": "PUSH EBP\nMOV EBP,ESP\nPUSH ECX\nMOV dword ptr [EBP + -4],0\nLAB_2:\nCMP dword ptr [EBP + 8],0\nJE LAB_1\nMOV EAX,dword ptr [EBP + 8]\nAND EAX,1\nADD EAX,dword ptr [EBP + -4]\nMOV dword ptr [EBP + -4],EAX\nMOV ECX,dword ptr [EBP + 8]\nSHR ECX,1\nMOV dword ptr [EBP + 8],ECX\nJMP LAB_2\nLAB_1:\nMOV EAX,dword ptr [EBP + -4]\nMOV ESP,EBP\nPOP EBP\nRET",
     "c": "unsigned int\n__bid32_iszero (unsigned int x ) {\n\n  unsigned int res = 0;\n\n  while (x != 0) {\n    res += x & 1;\n    x >>= 1;\n  }\n\n  return res;\n}",
     "status": "pass",
     "seconds": 0.75
    },
    "msvc-x86-O2": {
     "asm": "MOV EDX,dword ptr [ESP + 4]\nXOR EAX,EAX\nTEST EDX,EDX\nJE LAB_1\nNOP word ptr [EAX + EAX]\nLAB_2:\nMOV ECX,EDX\nAND ECX,1\nADD EAX,ECX\nSHR EDX,1\nJNE LAB_2\nLAB_1:\nRET",
     "c": "size_t bitcount(size_t n)\n{\n size_t count = 0;\n while (n) {\n  n = n >> 1;\n  count += n & 1;\n }\n return count;\n}",
     "status": "fail",
     "seconds": 0.64
    },
    "dos16-small-od": {
     "asm": "PUSH SI\nPUSH DI\nPUSH BP\nMOV BP,SP\nSUB SP,4\nMOV word ptr [BP +  + -2],0\nLAB_1:\nCMP word ptr [BP + 8],0\nJE LAB_2\nJMP LAB_3\nLAB_2:\nJMP LAB_4\nLAB_3:\nMOV AX,word ptr [BP + 8]\nAND AX,1\nADD word ptr [BP +  + -2],AX\nSHR word ptr [BP + 8],1\nJMP LAB_1\nLAB_4:\nMOV AX,word ptr [BP +  + -2]\nMOV word ptr [BP +  + -4],AX\nMOV AX,word ptr [BP +  + -4]\nMOV SP,BP\nPOP BP\nPOP DI\nPOP SI\nRET",
     "c": "unsigned int\n__bid32_isNegative (unsigned int x ) {\n\n  unsigned int res = 0;\n\n  while (x != 0) {\n    res += x & 1;\n    x >>= 1;\n  }\n\n  return res;\n}",
     "status": "pass",
     "seconds": 0.79
    },
    "dos16-large-ox": {
     "asm": "PUSH BP\nMOV BP,SP\nMOV AX,word ptr [BP + 6]\nXOR DX,DX\nLAB_1:\nTEST AX,AX\nJE LAB_2\nMOV BX,AX\nXOR BH,AH\nAND BL,1\nSHR AX,1\nADD DX,BX\nJMP LAB_1\nLAB_2:\nMOV AX,DX\nPOP BP\nRETF",
     "c": "int\n__bid32_iszero (unsigned int x ) {\n\n  int res;\n  unsigned int z;\n\n  z = 0;\n  while (x != 0) {\n    res = x & 1;\n    z = z + (x & 1);\n    x = x >> 1;\n  }\n  return (res);\n}",
     "status": "fail",
     "seconds": 1.03
    }
   }
  }
 ]
}