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


void script_9582(int a0,int a1,int a2) {
	if (a0 == -1) {
		return;
	}
	globalarray_0 = new WidgetPointer[10];
	int v2 = 8;
	int v0 = 0;
	int v1 = cs2method_10191(a0);
	if (cs2method_10324(a0) == 1) {
		if (interfaceDefsAttribute(4052) == -1) {
			cs2method_10995(4052, a2);
		}
		if (interfaceDefsAttribute(4053) == -1) {
			cs2method_10995(4053, a1);
		}
	}
	if (cs2method_10324(cs2method_10155(a0)) == 1) {
		globalarray_0[9] = interfaceDefsAttribute(4050);
		if (globalarray_0[9] != -1) {
			return;
		}
		globalarray_0[0] = interfaceDefsAttribute(4041);
		globalarray_0[1] = interfaceDefsAttribute(4042);
		globalarray_0[2] = interfaceDefsAttribute(4043);
		globalarray_0[3] = interfaceDefsAttribute(4044);
		globalarray_0[4] = interfaceDefsAttribute(4045);
		globalarray_0[5] = interfaceDefsAttribute(4046);
		globalarray_0[6] = interfaceDefsAttribute(4047);
		globalarray_0[7] = interfaceDefsAttribute(4048);
		globalarray_0[8] = interfaceDefsAttribute(4049);
		while (v0 == 0) {
			if (v2 == -1) {
				globalarray_0[0] = a0;
				v0 = 1;
			} else {
				if (globalarray_0[v2] != -1) {
					if (v1 < cs2method_10191(globalarray_0[v2])) {
						globalarray_0[cs2method_10060(v2, 1)] = globalarray_0[v2];
					} else {
						globalarray_0[cs2method_10060(v2, 1)] = a0;
						v0 = 1;
					}
				}
			}
			v2 = cs2method_10461(v2, 1);
		}
		cs2method_10995(4041, globalarray_0[0]);
		cs2method_10995(4042, globalarray_0[1]);
		cs2method_10995(4043, globalarray_0[2]);
		cs2method_10995(4044, globalarray_0[3]);
		cs2method_10995(4045, globalarray_0[4]);
		cs2method_10995(4046, globalarray_0[5]);
		cs2method_10995(4047, globalarray_0[6]);
		cs2method_10995(4048, globalarray_0[7]);
		cs2method_10995(4049, globalarray_0[8]);
		cs2method_10995(4050, globalarray_0[9]);
	}
	return;
}
