/* 
 * 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_8380_struct(4,0,0) script_8380(int a0,int a1,int a2,int a3,int a4,int a5) {
	int v6;
	int v7;
	int v9;
	int v23 = 0;
	int v21 = -1;
	int v25 = 0;
	int v22 = 0;
	int v27 = 0;
	int v8 = 0;
	int v15 = 0;
	int v20 = 0;
	int v11 = 0;
	int v5 = 0;
	int v13 = 0;
	int v0 = 0;
	int v1 = 0;
	int v3 = cs2method_10060(16, 1);
	int v14 = v3;
	int v24 = 0;
	switch (a4) {
		default:
			return new script_8380_struct(a1, a2, a3, a0);
		case 3:
			v9 = a1;
			v6 = a2;
			v7 = cs2method_10060(a2, a0);
			break;
		case 4:
			v9 = cs2method_10060(a1, a3);
			v6 = a2;
			v7 = cs2method_10060(a2, a0);
			break;
		case 1:
			v9 = a2;
			v6 = a1;
			v7 = cs2method_10060(a1, a3);
			break;
		case 6:
			v9 = cs2method_10060(a2, a0);
			v6 = a1;
			v7 = cs2method_10060(a1, a3);
	}
	int v12 = cs2method_10924(7718);
	int v16 = 0;
	while (v16 < v12) {
		flow_7:
			int v18 = idx17mapData('i', 'i', 7718, v16);
			int v10 = idx22mapAttribute(idx17mapData('i', 'J', 7716, v18), 3503);
			IF (cs2method_10609(v10) == 0 && v18 != a5 && idx22mapAttribute(idx17mapData('i', 'J', 7716, v18), 3528) == 1) 
				GOTO	flow_11
			GOTO	flow_34
		flow_11:
			int v19 = cs2method_10191(v10);
			int v4 = cs2method_10152(v10);
			int v17 = cs2method_10236(v10);
			int v26 = cs2method_10823(v10);
			switch (a4) {
				case 3:
				case 4:
					v5 = v19;
					v13 = cs2method_10060(v19, v17);
					v0 = v4;
					v1 = cs2method_10060(v4, v26);
					break;
				case 1:
				case 6:
					v5 = v4;
					v13 = cs2method_10060(v4, v26);
					v0 = v19;
					v1 = cs2method_10060(v19, v17);
			}
			int v2 = cs2method_11048(v3, cs2method_10461(0, v3));
			IF (v9 < cs2method_10060(v5, v2) && v9 > cs2method_10461(v5, v2)) 
				GOTO	flow_17
			GOTO	flow_25
		flow_17:
			IF (v6 > cs2method_10461(v0, v14)) 
				GOTO	flow_18
			GOTO	flow_19
		flow_18:
			IF (v6 < cs2method_10060(v1, v14)) 
				GOTO	flow_23
		flow_19:
			IF (v7 > cs2method_10461(v0, v14)) 
				GOTO	flow_20
			GOTO	flow_21
		flow_20:
			IF (v7 < cs2method_10060(v1, v14)) 
				GOTO	flow_23
		flow_21:
			IF (v0 > v6 && v0 < v7) 
				GOTO	flow_23
			GOTO	flow_24
		flow_23:
			v3 = cs2method_10461(v9, v5);
		flow_24:
			GOTO	flow_34
		flow_25:
			IF (v9 < cs2method_10060(v13, v2) && v9 > cs2method_10461(v13, v2)) 
				GOTO	flow_27
			GOTO	flow_34
		flow_27:
			IF (v6 > cs2method_10461(v0, v14)) 
				GOTO	flow_28
			GOTO	flow_29
		flow_28:
			IF (v6 < cs2method_10060(v1, v14)) 
				GOTO	flow_33
		flow_29:
			IF (v7 > cs2method_10461(v0, v14)) 
				GOTO	flow_30
			GOTO	flow_31
		flow_30:
			IF (v7 < cs2method_10060(v1, v14)) 
				GOTO	flow_33
		flow_31:
			IF (v0 > v6 && v0 < v7) 
				GOTO	flow_33
			GOTO	flow_34
		flow_33:
			v3 = cs2method_10461(v9, v13);
		flow_34:
			v16 = cs2method_10060(v16, 1);
	}
	if (cs2method_11048(v3, cs2method_10461(0, v3)) < 16) {
		switch (a4) {
			case 3:
				a1 = cs2method_10461(a1, v3);
				a3 = cs2method_10060(a3, v3);
				break;
			case 1:
				a2 = cs2method_10461(a2, v3);
				a0 = cs2method_10060(a0, v3);
				break;
			case 4:
				a3 = cs2method_10461(a3, v3);
				break;
			case 6:
				a0 = cs2method_10461(a0, v3);
		}
	}
	return new script_8380_struct(a1, a2, a3, a0);
}
