PageRenderTime 22ms CodeModel.GetById 11ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/doc/Dissertation/Evolution/06_Find_loops.cs

http://github.com/icsharpcode/ILSpy
C# | 87 lines | 87 code | 0 blank | 0 comment | 8 complexity | 5b487a7f5b747e1e6cc7782c7625e2fe MD5 | raw file
 1using System;
 2abstract class QuickSortProgram
 3{
 4    public static void Main(System.String[] args)
 5    {
 6        BasicBlock_1:
 7        System.Int32[] V_0 = new int[((int)args.Length)];
 8        int i = 0;
 9        goto Loop_8;
10        Loop_8:
11        for (;;) {
12            BasicBlock_3:
13            if (i < ((int)V_0.Length)) goto BasicBlock_2; 
14            break;
15            BasicBlock_2:
16            V_0[i] = System.Int32.Parse(args[i]);
17            i = (i + 1);
18            continue;
19        }
20        BasicBlock_4:
21        QuickSortProgram.QuickSort(V_0, 0, (((int)V_0.Length) - 1));
22        int j = 0;
23        goto Loop_11;
24        Loop_11:
25        for (;;) {
26            BasicBlock_6:
27            if (j < ((int)V_0.Length)) goto BasicBlock_5; 
28            break;
29            BasicBlock_5:
30            System.Console.Write(System.String.Concat((V_0[j]).ToString(), " "));
31            j = (j + 1);
32            continue;
33        }
34        BasicBlock_7:
35        return;
36    }
37    public static void QuickSort(System.Int32[] array, int left, int right)
38    {
39        BasicBlock_15:
40        if (right <= left) goto BasicBlock_17; 
41        goto BasicBlock_16;
42        BasicBlock_16:
43        int i = ((left + right) / 2);
44        int j = QuickSortProgram.Partition(array, left, right, i);
45        QuickSortProgram.QuickSort(array, left, (j - 1));
46        QuickSortProgram.QuickSort(array, (j + 1), right);
47        goto BasicBlock_17;
48        BasicBlock_17:
49        return;
50    }
51    private static int Partition(System.Int32[] array, int left, int right, int pivotIndex)
52    {
53        BasicBlock_21:
54        int i = array[pivotIndex];
55        QuickSortProgram.Swap(array, pivotIndex, right);
56        int j = left;
57        int k = left;
58        goto Loop_29;
59        Loop_29:
60        for (;;) {
61            BasicBlock_25:
62            if (k < right) goto BasicBlock_22; 
63            break;
64            BasicBlock_22:
65            if (array[k] > i) goto BasicBlock_24; 
66            goto BasicBlock_23;
67            BasicBlock_23:
68            QuickSortProgram.Swap(array, j, k);
69            j = (j + 1);
70            goto BasicBlock_24;
71            BasicBlock_24:
72            k = (k + 1);
73            continue;
74        }
75        BasicBlock_26:
76        QuickSortProgram.Swap(array, right, j);
77        return j;
78    }
79    private static void Swap(System.Int32[] array, int index1, int index2)
80    {
81        BasicBlock_33:
82        int i = array[index1];
83        array[index1] = array[index2];
84        array[index2] = i;
85        return;
86    }
87}