Написание программы на С#, реализующей сортировку методом Шелла, страница 3

00000205  jb          0000020E

00000207  xor         ecx,ecx

for (j = i-h; j >= lb && (a[j] > t); j -= h) a[j+h] = a[j];

00000209  call        762B6BFF

0000020e  movzx       eax,word ptr [edx+eax*2+8]

00000213  cmp         eax,dword ptr [ebp-2Ch]

00000216  jg          00000142

a[j+h] = t;

0000021c  mov         eax,dword ptr [ebp-28h]

0000021f  mov         edx,dword ptr [ebp-24h]

00000222  add         eax,esi

00000224  adc         edx,edi

00000226  test        eax,eax

00000228  jl          00000237

0000022a  test        edx,edx

0000022c  je          00000235

0000022e  xor         ecx,ecx

00000230  call        7636AB77

00000235  jmp         00000243

00000237  cmp         edx,0FFFFFFFFh

0000023a  je          00000243

0000023c  xor         ecx,ecx

0000023e  call        7636AB77

00000243  mov         edx,dword ptr [ebp-8]

00000246  cmp         eax,dword ptr [edx+4]

00000249  jb          00000252

0000024b  xor         ecx,ecx

0000024d  call        762B6BFF

00000252  mov         ecx,dword ptr [ebp-2Ch]

00000255  mov         word ptr [edx+eax*2+8],cx

for (i = lb + h; i <= ub; i++)

0000025a  mov         eax,dword ptr [ebp-20h]

0000025d  mov         edx,dword ptr [ebp-1Ch]

00000260  add         eax,1

00000263  adc         edx,0

for (i = lb + h; i <= ub; i++)

00000266  mov         dword ptr [ebp-20h],eax

00000269  mov         dword ptr [ebp-1Ch],edx

0000026c  mov         eax,dword ptr [ebp-20h]

0000026f  mov         edx,dword ptr [ebp-1Ch]

00000272  cmp         edx,dword ptr [ebp+0Ch]

00000275  jg          00000286

00000277  jl          000000F2

0000027d  cmp         eax,dword ptr [ebp+8]

00000280  jbe         000000F2

h /= 3;

00000286  push        edi 

00000287  push        esi 

00000288  push        0   

0000028a  push        3   

0000028c  call        76369ED1

00000291  mov         esi,eax

00000293  mov         edi,edx

while (h > 0)

00000295  test        edi,edi

00000297  jl          000002A7

00000299  jg          000000DC

0000029f  test        esi,esi

000002a1  ja          000000DC

}

000002a7  nop             

000002a8  pop         ebx 

000002a9  pop         esi 

000002aa  pop         edi 

000002ab  mov         esp,ebp

000002ad  pop         ebp 

000002ae  ret         10h 

Код на MSIL

.method private hidebysig instance void

shellSort(char[] a,

int64 lb,

int64 ub) cil managed

{

// Code size       137 (0x89)

.maxstack  4

.locals init ([0] int64 n,

[1] int64 h,

[2] int64 i,

[3] int64 j,

[4] char t)

.line 36:3

IL_0000:  ldarg.3

IL_0001:  ldarg.2

IL_0002:  sub

IL_0003:  ldc.i4.1

IL_0004:  conv.i8

IL_0005:  add

IL_0006:  stloc.0

.line 37:3

IL_0007:  ldc.i4.1

IL_0008:  conv.i8

IL_0009:  stloc.1

.line 38:3

IL_000a:  ldloc.0

IL_000b:  ldc.i4.s   14

IL_000d:  conv.i8

IL_000e:  bge.s      IL_0015

.line 39:4

IL_0010:  ldc.i4.1

IL_0011:  conv.i8

IL_0012:  stloc.1

IL_0013:  br.s       IL_003f

.line 40:8

IL_0015:  ldloc.0

IL_0016:  ldc.i4     0x7354

IL_001b:  conv.i8

IL_001c:  ble.s      IL_0027

.line 41:4

IL_001e:  ldc.i4     0xcd0

IL_0023:  conv.i8

IL_0024:  stloc.1

IL_0025:  br.s       IL_003f

IL_0027:  br.s       IL_0031

.line 44:18

IL_0029:  ldc.i4.3

IL_002a:  conv.i8

IL_002b:  ldloc.1

IL_002c:  mul

IL_002d:  ldc.i4.1

IL_002e:  conv.i8

IL_002f:  add

IL_0030:  stloc.1

.line 44:4

IL_0031:  ldloc.1

IL_0032:  ldloc.0

IL_0033:  blt.s      IL_0029

.line 45:4

IL_0035:  ldloc.1

IL_0036:  ldc.i4.3

IL_0037:  conv.i8

IL_0038:  div

IL_0039:  stloc.1

.line 46:4

IL_003a:  ldloc.1

IL_003b:  ldc.i4.3

IL_003c:  conv.i8

IL_003d:  div

IL_003e:  stloc.1

IL_003f:  br.s       IL_0083

.line 53:9

IL_0041:  ldarg.2

IL_0042:  ldloc.1

IL_0043:  add

IL_0044:  stloc.2

IL_0045:  br.s       IL_007a

.line 55:5

IL_0047:  ldarg.1

IL_0048:  ldloc.2

IL_0049:  conv.ovf.i

IL_004a:  ldelem.u2

IL_004b:  stloc.s    t

.line 56:10

IL_004d:  ldloc.2

IL_004e:  ldloc.1

IL_004f:  sub

IL_0050:  stloc.3

IL_0051:  br.s       IL_0061

.line 56:50

IL_0053:  ldarg.1

IL_0054:  ldloc.3

IL_0055:  ldloc.1

IL_0056:  add

IL_0057:  conv.ovf.i

IL_0058:  ldarg.1

IL_0059:  ldloc.3

IL_005a:  conv.ovf.i

IL_005b:  ldelem.u2

IL_005c:  stelem.i2

.line 56:42

IL_005d:  ldloc.3

IL_005e:  ldloc.1

IL_005f:  sub

IL_0060:  stloc.3

.line 56:19

IL_0061:  ldloc.3

IL_0062:  ldarg.2

IL_0063:  blt.s      IL_006d

IL_0065:  ldarg.1

IL_0066:  ldloc.3

IL_0067:  conv.ovf.i

IL_0068:  ldelem.u2

IL_0069:  ldloc.s    t

IL_006b:  bgt.s      IL_0053

.line 58:5

IL_006d:  ldarg.1

IL_006e:  ldloc.3

IL_006f:  ldloc.1

IL_0070:  add

IL_0071:  conv.ovf.i

IL_0072:  ldloc.s    t

IL_0074:  stelem.i2

.line 53:30

IL_0075:  ldloc.2

IL_0076:  ldc.i4.1

IL_0077:  conv.i8

IL_0078:  add

IL_0079:  stloc.2

.line 53:21

IL_007a:  ldloc.2

IL_007b:  ldarg.3

IL_007c:  ble.s      IL_0047

.line 62:4

IL_007e:  ldloc.1

IL_007f:  ldc.i4.3

IL_0080:  conv.i8

IL_0081:  div

IL_0082:  stloc.1

.line 49:3

IL_0083:  ldloc.1

IL_0084:  ldc.i4.0

IL_0085:  conv.i8

IL_0086:  bgt.s      IL_0041

.line 64:2

IL_0088:  ret

} // end of method MyMainObject::shellSort