/* 
 * Script decompiled by jagdecs2 v3.2
 * Decompiler opts:
 * --------------
 * t1LocalAnalyzer:true
 * t2LocalAnalyzer:true
 * beautifier:true
 * --------------
 * Made by mgi125 ;)
 */


void script_5698(int a0,int a1,int a2,int a3) {
	int v8 = cs2method_10968(cs2method_10060(a2, a1), 2);
	int v7 = globalarray_0[v8];
	globalarray_0[v8] = globalarray_0[a1];
	globalarray_0[a1] = v7;
	for (int v9 = a2, int v4 = a2, int v2 = 0, object v12 = "", object v0 = "", int v10 = -1, int v6 = -1; v4 < a1; v4 = cs2method_10060(v4, 1)) {
		int v5 = idx22mapAttribute(idx17mapData('i', 'J', a0, globalarray_0[v4]), 2213);
		int v1 = idx22mapAttribute(idx17mapData('i', 'J', a0, v7), 2213);
		object v11 = idx22mapAttribute(idx17mapData('i', 'J', a0, globalarray_0[v4]), 2210);
		if (v5 != -1 && cs2method_10265(v11) == 0) {
			v11 = cs2method_10018(v5);
		}
		object v3 = idx22mapAttribute(idx17mapData('i', 'J', a0, v7), 2210);
		if (v1 != -1 && cs2method_10265(v3) == 0) {
			v3 = cs2method_10018(v1);
		}
		if (cs2method_10846(v11, v3) < cs2method_10147(v4, 1)) {
			int v13 = globalarray_0[v4];
			globalarray_0[v4] = globalarray_0[v9];
			globalarray_0[v9] = v13;
			v9 = cs2method_10060(v9, 1);
		}
	}
	globalarray_0[a1] = globalarray_0[v9];
	globalarray_0[v9] = v7;
	if (a2 < cs2method_10461(v9, 1)) {
		script_5698(0, a2, cs2method_10461(v9, 1), a0);
	}
	if (cs2method_10060(v9, 1) < a1) {
		script_5698(0, cs2method_10060(v9, 1), a1, a0);
	}
	return;
}
