/* 
 * Script decompiled by jagdecs2 v3.2
 * Decompiler opts:
 * --------------
 * t1LocalAnalyzer:true
 * t2LocalAnalyzer:true
 * beautifier:true
 * --------------
 * Made by mgi125 ;)
 */
// Beautifier was aborted, because this function contains unsolved flow blocks.


script_4726_struct(5,0,0) script_4726(int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8,int a9,int a10) {
	object v0;
	object v9;
	object v11;
	int v16;
	int v18;
	object v21;
	int v37;
	int v38;
	int v49 = 74907736;
	int v51 = 0;
	int v5 = -1;
	object v43 = "";
	int v42 = 0;
	globalarray_0 = new int[cs2method_10924(a5)];
	int v36 = 0;
	int v41 = -1;
	int v4 = 0;
	while (v4 < cs2method_10924(a5)) {
		globalarray_0[v4] = idx17mapData('i', 'J', a5, v4);
		v4 = cs2method_10060(v4, 1);
	}
	int v52 = 0;
	int v6 = 1;
	int v33 = 0;
	int v46 = 0;
	object v53 = "";
	object v45 = "";
	int v12 = 0;
	int v50 = 0;
	switch (cs2_configs['cfg1659']) {
		while (true) {
			default:
				if (v6 == 1) {
					v6 = 0;
					int v3 = cs2method_10461(cs2method_10924(a5), 1);
					while (v3 > 0) {
						if (idx22mapAttribute(globalarray_0[v3], 1933) > 0) {
							v38 = idx22mapAttribute(globalarray_0[v3], 1933);
						} else {
							v38 = idx22mapAttribute(globalarray_0[v3], 1932);
						}
						if (idx22mapAttribute(globalarray_0[cs2method_10461(v3, 1)], 1933) > 0) {
							v18 = idx22mapAttribute(globalarray_0[cs2method_10461(v3, 1)], 1933);
						} else {
							v18 = idx22mapAttribute(globalarray_0[cs2method_10461(v3, 1)], 1932);
						}
						if (v38 < v18) {
							v6 = 1;
							int v47 = globalarray_0[cs2method_10461(v3, 1)];
							globalarray_0[cs2method_10461(v3, 1)] = globalarray_0[v3];
							globalarray_0[v3] = v47;
						}
						v3 = cs2method_10461(v3, 1);
					}
				}
		}
		flow_17:
			GOTO	flow_65
			while (true) {
				case 1:
					if (v6 == 1) {
						v6 = 0;
						int v8 = cs2method_10461(cs2method_10924(a5), 1);
						while (v8 > 0) {
							if (idx22mapAttribute(globalarray_0[v8], 1933) > 0) {
								v16 = idx22mapAttribute(globalarray_0[v8], 1933);
							} else {
								v16 = idx22mapAttribute(globalarray_0[v8], 1932);
							}
							if (idx22mapAttribute(globalarray_0[cs2method_10461(v8, 1)], 1933) > 0) {
								v37 = idx22mapAttribute(globalarray_0[cs2method_10461(v8, 1)], 1933);
							} else {
								v37 = idx22mapAttribute(globalarray_0[cs2method_10461(v8, 1)], 1932);
							}
							if (v16 > v37) {
								v6 = 1;
								int v26 = globalarray_0[cs2method_10461(v8, 1)];
								globalarray_0[cs2method_10461(v8, 1)] = globalarray_0[v8];
								globalarray_0[v8] = v26;
							}
							v8 = cs2method_10461(v8, 1);
						}
					}
			}
		flow_31:
			GOTO	flow_65
			while (true) {
				case 2:
					if (v6 == 1) {
						v6 = 0;
						int v25 = cs2method_10461(cs2method_10924(a5), 1);
						while (v25 > 0) {
							if (idx22mapAttribute(globalarray_0[v25], 1937) == 4) {
								if (cs2method_11010() == 0) {
									int v44 = idx17mapData('J', 'i', 5185, globalarray_0[v25]);
									v11 = idx17mapData('i', 's', 5186, v44);
								} else {
									int v28 = idx17mapData('J', 'i', 5185, globalarray_0[v25]);
									v11 = idx17mapData('i', 's', 5187, v28);
								}
								if (cs2method_11010() == 0) {
									int v23 = idx17mapData('J', 'i', 5185, globalarray_0[cs2method_10461(v25, 1)]);
									v0 = idx17mapData('i', 's', 5186, v23);
								} else {
									int v1 = idx17mapData('J', 'i', 5185, globalarray_0[cs2method_10461(v25, 1)]);
									v0 = idx17mapData('i', 's', 5187, v1);
								}
							} else {
								v11 = idx22mapAttribute(globalarray_0[v25], 1930);
								v0 = idx22mapAttribute(globalarray_0[cs2method_10461(v25, 1)], 1930);
							}
							if (cs2method_10846(v11, v0) < 0) {
								v6 = 1;
								int v10 = globalarray_0[cs2method_10461(v25, 1)];
								globalarray_0[cs2method_10461(v25, 1)] = globalarray_0[v25];
								globalarray_0[v25] = v10;
							}
							v25 = cs2method_10461(v25, 1);
						}
					}
			}
		flow_48:
			GOTO	flow_65
			while (true) {
				case 3:
					if (v6 == 1) {
						v6 = 0;
						int v7 = cs2method_10461(cs2method_10924(a5), 1);
						while (v7 > 0) {
							if (idx22mapAttribute(globalarray_0[v7], 1937) == 4) {
								if (cs2method_11010() == 0) {
									int v2 = idx17mapData('J', 'i', 5185, globalarray_0[v7]);
									v9 = idx17mapData('i', 's', 5186, v2);
								} else {
									int v30 = idx17mapData('J', 'i', 5185, globalarray_0[v7]);
									v9 = idx17mapData('i', 's', 5187, v30);
								}
								if (cs2method_11010() == 0) {
									int v35 = idx17mapData('J', 'i', 5185, globalarray_0[cs2method_10461(v7, 1)]);
									v21 = idx17mapData('i', 's', 5186, v35);
								} else {
									int v27 = idx17mapData('J', 'i', 5185, globalarray_0[cs2method_10461(v7, 1)]);
									v21 = idx17mapData('i', 's', 5187, v27);
								}
							} else {
								v9 = idx22mapAttribute(globalarray_0[v7], 1930);
								v21 = idx22mapAttribute(globalarray_0[cs2method_10461(v7, 1)], 1930);
							}
							if (cs2method_10846(v9, v21) > 0) {
								v6 = 1;
								int v19 = globalarray_0[cs2method_10461(v7, 1)];
								globalarray_0[cs2method_10461(v7, 1)] = globalarray_0[v7];
								globalarray_0[v7] = v19;
							}
							v7 = cs2method_10461(v7, 1);
						}
					}
			}
	}
	flow_65:
		int v20 = 0;
		while (v20 < cs2method_10924(a5)) {
			int v24 = globalarray_0[v20];
			int v48 = v24;
			int v17 = a1;
			int v34 = a6;
			int v15 = a3;
			int v14 = a0;
			int v39 = a9;
			int v31 = a7;
			int v22 = a10;
			int v32 = a4;
			int v29 = a8;
			int v13 = a2;
			script_5351_struct(5,0,0) v40 = script_5351(v48, v17, v34, v15, v14, v39, v31, v22, v32, v29, v13);
			a7 = v40.intpart_4;
			a0 = v40.intpart_3;
			a3 = v40.intpart_2;
			a6 = v40.intpart_1;
			a1 = v40.intpart_0;
			v20 = cs2method_10060(v20, 1);
		}
		return new script_4726_struct(a1, a6, a3, a0, a7);
}
