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


int script_10019(int a0,int a1,int a2,object a3) {
	int v0;
	int v3 = 1;
	int v1 = cs2method_10805(a2, a1, a3);
	int v2 = idx17mapData('f', 'i', 8630, a1);
	if (v2 < 0) {
		return 0;
	}
	if (a0 == -1 || a0 == 0) {
		a0 = idx17mapData('f', 'i', 8631, a1);
		if (a0 == -1) {
			a0 = v2;
			v3 = 0;
		}
	}
	int v4 = idx17mapData('f', 'i', 8632, a1);
	if (a0 < v4) {
		v0 = cs2method_10051(a0, 2);
	} else {
		v0 = cs2method_10060(a0, v4);
	}
	if (v1 > 1) {
		int v5 = cs2method_10060(cs2method_10051(a0, cs2method_10461(v1, 1)), v2);
		if (v3 == 1) {
			return cs2method_11048(v5, v0);
		}
		return v5;
	}
	if (v1 == 1) {
		return v2;
	}
	return 0;
}
