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


int script_8495(int a0,int a1,int a2,int a3,int a4,int a5,int a6,object a7,object a8) {
	object v2;
	object v6;
	int v0;
	int v5 = -1;
	object v1 = "";
	object v4 = "";
	object v3 = (string)a8 + ": ";
	if (a6 == 0) {
		v2 = "Turn ON";
		v6 = cs2method_10427(v3, "Off");
		v0 = script_8497(a4, 0);
		if (client_configs['cfg3680'].bitcfg22315 == 1) {
			script_3786(a4, 0);
		}
	} else if (a5 == 1) {
		v0 = script_8497(a4, 1);
		if (client_configs['cfg3680'].bitcfg22315 == 1) {
			script_3786(a4, 1);
		}
		v2 = "Turn OFF";
		switch (a3) {
			case 18:
				if (a4 == 1) {
					v2 = "Turn ON";
				}
				break;
			case 19:
				if (a4 == 2) {
					v2 = "Turn ON";
				}
				break;
			case 20:
				if (a4 == 3) {
					v2 = "Turn ON";
				}
				break;
			case 21:
				if (a4 == 4) {
					v2 = "Turn ON";
				}
				break;
			case 22:
				if (a4 == 5) {
					v2 = "Turn ON";
				}
		}
		v6 = cs2method_10427(v3, a7);
	} else {
		v0 = script_8497(a4, 2);
		if (client_configs['cfg3680'].bitcfg22315 == 1) {
			script_3786(a4, 2);
		}
		v6 = cs2method_10427(v3, "On");
		v2 = "Filter";
	}
	cs2method_10758(v0, a0);
	if (client_configs['cfg3680'].bitcfg22315 == 0) {
		cs2method_11127(1, a1, v2);
		cs2method_10316(a1, a8);
		cs2method_20486(new function<script_8494>(object a0,int a1,int a2,int a3,int a4,object a5,int a6) {
			int v6;
			if (client_configs['cfg1295'] < 1000) {
				cs2method_10810("You can't do this while in the tutorial.");
				return;
			}
			if (client_configs['cfg1293'].bitcfg3617 == 1) {
				cs2method_10810("You cannot change your chat filters while you are in the tutorial as you might miss important messages that will help with your progress.");
				return;
			}
			int v0 = 0;
			int v35 = 0;
			int v16 = 0;
			int v23 = 0;
			int v46 = 0;
			int v10 = 0;
			int v47 = 0;
			int v50 = 0;
			int v14 = 0;
			int v43 = 0;
			int v36 = 0;
			int v45 = 0;
			int v42 = 0;
			int v13 = 0;
			int v1 = 0;
			int v5 = 0;
			int v33 = 0;
			int v39 = 0;
			int v31 = 0;
			int v32 = 0;
			int v20 = a4;
			script_8546_struct(9,0,0) v15 = script_8546(v20);
			int v19 = v15.intpart_8;
			int v3 = v15.intpart_7;
			int v12 = v15.intpart_6;
			int v49 = v15.intpart_5;
			int v25 = v15.intpart_4;
			int v40 = v15.intpart_3;
			int v18 = v15.intpart_2;
			int v24 = v15.intpart_1;
			int v26 = v15.intpart_0;
			int v29 = script_3778();
			int v17 = a4;
			script_8547_struct(8,0,0) v44 = script_8547(v17);
			int v41 = v44.intpart_7;
			int v21 = v44.intpart_6;
			int v38 = v44.intpart_5;
			int v9 = v44.intpart_4;
			int v27 = v44.intpart_3;
			int v48 = v44.intpart_2;
			int v34 = v44.intpart_1;
			int v2 = v44.intpart_0;
			switch (a2) {
				case 0:
					v31 = v26;
					v32 = v2;
					break;
				case 1:
					v31 = v40;
					v32 = v27;
					break;
				case 2:
					v31 = v25;
					v32 = v9;
					break;
				case 3:
					v31 = v49;
					v32 = v38;
					break;
				case 4:
					v31 = v12;
					v32 = v21;
					break;
				case 5:
					v31 = v3;
					v32 = v21;
					break;
				case 6:
					v31 = v24;
					v32 = v34;
					break;
				case 7:
					v31 = v18;
					v32 = v48;
			}
			if (v31 == 0) {
				v31 = 1;
			} else if (v32 == 1) {
				v31 = 0;
				v32 = 0;
			} else {
				v32 = 1;
			}
			switch (a2) {
				case 0:
					script_8528(a4, v31, v32);
					break;
				case 1:
					script_8529(a4, v31, v32);
					break;
				case 2:
					if (a4 == 19 && v31 == 0) {
						v31 = 1;
					}
					script_8530(a4, v31, v32);
					break;
				case 3:
					if (a4 == 20 && v31 == 0) {
						v31 = 1;
					}
					script_8531(a4, v31, v32);
					break;
				case 4:
					if (a4 == 21 && v31 == 0) {
						v31 = 1;
					}
					script_8532(a4, v31, v32);
					break;
				case 5:
					if (a4 == 22 && v31 == 0) {
						v31 = 1;
					}
					script_8533(a4, v31, v32);
					break;
				case 6:
					script_8534(a4, v31, v32);
					break;
				case 7:
					script_8535(a4, v31, v32);
					break;
				case 8:
					cs2_configs['cfg2834'] = cs2method_10461(1, cs2method_11048(0, cs2_configs['cfg2834']));
					v31 = cs2_configs['cfg2834'];
					v32 = 0;
					break;
				case 10:
					script_9213(a4, cs2method_10461(1, v19));
					v31 = client_configs['cfg1774'].bitcfg20828;
					v32 = 0;
					break;
				case 9:
					int v54 = cs2method_10149();
					if (v54 == 2) {
						v6 = 0;
						cs2method_10841(0, v6, cs2method_10610());
					} else {
						v6 = cs2method_10060(v54, 1);
						cs2method_10841(0, v6, cs2method_10610());
					}
					if (v6 == 2) {
						v31 = 0;
						v32 = 0;
					} else if (v6 == 1) {
						v31 = 1;
						v32 = 1;
					} else {
						v31 = 1;
						v32 = 0;
					}
					break;
				case 11:
					if (client_configs['cfg1775'].bitcfg21020 == 1) {
						v31 = 1;
						v32 = 0;
					} else {
						v31 = 0;
						v32 = 0;
					}
					break;
				case 13:
					client_configs['cfg1775'].bitcfg21712 = cs2method_10461(1, client_configs['cfg1775'].bitcfg21712);
					v31 = client_configs['cfg1775'].bitcfg21712;
					v32 = 0;
					script_1985(client_configs['cfg1775'].bitcfg21712);
			}
			script_8808();
			int v4 = a1;
			int v37 = 18;
			if (a2 == 8 || a2 == 9 || a2 == 11 || a2 == 13) {
				if (v37 <= 23) {
					switch (a2) {
						case 8:
							int v61 = v37;
							script_8578_struct(2,0,0) v63 = script_8578(v61);
							a3 = v63.intpart_1;
							a1 = v63.intpart_0;
							break;
						case 9:
							int v55 = v37;
							script_8580_struct(2,0,0) v62 = script_8580(v55);
							a3 = v62.intpart_1;
							a1 = v62.intpart_0;
							break;
						case 11:
							int v58 = v37;
							script_9378_struct(2,0,0) v56 = script_9378(v58);
							a3 = v56.intpart_1;
							a1 = v56.intpart_0;
							break;
						case 13:
							int v60 = v37;
							script_1988_struct(2,0,0) v57 = script_1988(v60);
							a3 = v57.intpart_1;
							a1 = v57.intpart_0;
					}
					int v59 = script_8495(v37, a2, a1, a3, a5, cs2method_10191(a1), v31, v32, a0);
					/* 
						java.lang.RuntimeException: Stack underflow
							at mgi.tools.jagdecs2.CS2Stack.pop(CS2Stack.java:46)
							at mgi.tools.jagdecs2.FlowBlocksGenerator.processFlowBlock(FlowBlocksGenerator.java:191)
							at mgi.tools.jagdecs2.FlowBlocksGenerator.processGeneration(FlowBlocksGenerator.java:52)
							at mgi.tools.jagdecs2.FlowBlocksGenerator.generate(FlowBlocksGenerator.java:35)
							at mgi.tools.jagdecs2.CS2Decompiler.decompile(CS2Decompiler.java:77)
							at mgi.tools.jagdecs2.FlowBlocksGenerator.cast(FlowBlocksGenerator.java:546)
							at mgi.tools.jagdecs2.FlowBlocksGenerator.analyzeCall(FlowBlocksGenerator.java:278)
							at mgi.tools.jagdecs2.FlowBlocksGenerator.processFlowBlock(FlowBlocksGenerator.java:235)
							at mgi.tools.jagdecs2.FlowBlocksGenerator.processGeneration(FlowBlocksGenerator.java:52)
							at mgi.tools.jagdecs2.FlowBlocksGenerator.generate(FlowBlocksGenerator.java:35)
							at mgi.tools.jagdecs2.CS2Decompiler.decompile(CS2Decompiler.java:77)
							at tests.Main.main(Main.java:69)
						
					 */
				}
			} else {
				int v55 = script_8495(a4, a2, a1, a3, a5, cs2method_10191(a1), v31, v32, a0);
				/* 
					java.lang.RuntimeException: Stack underflow
						at mgi.tools.jagdecs2.CS2Stack.pop(CS2Stack.java:46)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.processFlowBlock(FlowBlocksGenerator.java:191)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.processGeneration(FlowBlocksGenerator.java:52)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.generate(FlowBlocksGenerator.java:35)
						at mgi.tools.jagdecs2.CS2Decompiler.decompile(CS2Decompiler.java:77)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.cast(FlowBlocksGenerator.java:546)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.analyzeCall(FlowBlocksGenerator.java:278)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.processFlowBlock(FlowBlocksGenerator.java:235)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.processGeneration(FlowBlocksGenerator.java:52)
						at mgi.tools.jagdecs2.FlowBlocksGenerator.generate(FlowBlocksGenerator.java:35)
						at mgi.tools.jagdecs2.CS2Decompiler.decompile(CS2Decompiler.java:77)
						at tests.Main.main(Main.java:69)
					
				 */
			}
			if (v4 != a1) {
				a1 = v4;
			}
			int v7 = a4;
			int v53 = a2;
			int v8 = a1;
			int v30 = a3;
			int v28 = cs2method_10191(a1);
			object v22 = a0;
			script_8499_struct(2,0,0) v52 = script_8499(v7, v53, v8, v30, v22, v28);
			int v11 = v52.intpart_0;
			int v51 = v52.intpart_1;
			/* 
				java.lang.RuntimeException: Stack underflow
					at mgi.tools.jagdecs2.CS2Stack.pop(CS2Stack.java:46)
					at mgi.tools.jagdecs2.FlowBlocksGenerator.processFlowBlock(FlowBlocksGenerator.java:191)
					at mgi.tools.jagdecs2.FlowBlocksGenerator.processGeneration(FlowBlocksGenerator.java:52)
					at mgi.tools.jagdecs2.FlowBlocksGenerator.generate(FlowBlocksGenerator.java:35)
					at mgi.tools.jagdecs2.CS2Decompiler.decompile(CS2Decompiler.java:77)
					at mgi.tools.jagdecs2.FlowBlocksGenerator.cast(FlowBlocksGenerator.java:546)
					at mgi.tools.jagdecs2.FlowBlocksGenerator.analyzeCall(FlowBlocksGenerator.java:278)
					at mgi.tools.jagdecs2.FlowBlocksGenerator.processFlowBlock(FlowBlocksGenerator.java:235)
					at mgi.tools.jagdecs2.FlowBlocksGenerator.processGeneration(FlowBlocksGenerator.java:52)
					at mgi.tools.jagdecs2.FlowBlocksGenerator.generate(FlowBlocksGenerator.java:35)
					at mgi.tools.jagdecs2.CS2Decompiler.decompile(CS2Decompiler.java:77)
					at tests.Main.main(Main.java:69)
				
			 */
		}, a3, a4, new WidgetPointer(a1), new WidgetPointer(a0), a2, (string)a8, (string)a7, "iiIIiss", new WidgetPointer(a1));
		cs2method_21121(new function<script_8799>(int a0,object a1,int a2) {
			script_8800(a2, a0, a1);
			return;
		}, (string)v6, new WidgetPointer(a1), -1, "sIi", new WidgetPointer(a1));
		cs2method_20750(new function<script_8805>() {
			script_8808();
			return;
		}, "", new WidgetPointer(a1));
		cs2method_10112(a2, 0, 0, 1, a1);
	} else {
		cs2method_20486(new function<script_3784>(int a0,int a1,int a2,object a3,int a4,int a5,object a6,int a7) {
			if (client_configs['cfg1295'] < 1000) {
				cs2method_10810("You can't do this while in the tutorial.");
				return;
			}
			if (client_configs['cfg1293'].bitcfg3617 == 1) {
				cs2method_10810("You cannot change your chat filters while you are in the tutorial as you might miss important messages that will help with your progress.");
				return;
			}
			switch (a2) {
				case 1:
					if (cs2method_10614() != 2) {
						if (cs2_configs['cfg41'] == a0) {
							cs2_configs['cfg41'] = -1;
							script_3810();
						} else if (cs2_configs['cfg41'] == -1) {
							cs2_configs['cfg41'] = a0;
							script_3810();
						} else {
							cs2_configs['cfg41'] = a0;
						}
					}
					script_3781(a0);
					break;
				case 2:
					script_3783(a0, 1, 0);
					break;
				case 3:
					script_3783(a0, 1, 1);
					break;
				case 4:
					switch (a0) {
						default:
							break;
						case 99:
							client_configs['cfg1775'].bitcfg21712 = cs2method_10461(1, client_configs['cfg1775'].bitcfg21712);
							script_1985(client_configs['cfg1775'].bitcfg21712);
							break;
						case 0:
							client_configs['cfg1772'].bitcfg18797 = 0;
							break;
						case 1:
							client_configs['cfg1772'].bitcfg18800 = 0;
							break;
						case 2:
							client_configs['cfg1772'].bitcfg18801 = 0;
							cs2method_10841(0, 2, cs2method_10610());
							break;
						case 3:
							client_configs['cfg1772'].bitcfg18802 = 0;
							break;
						case 4:
							client_configs['cfg1772'].bitcfg18803 = 0;
							break;
						case 5:
							client_configs['cfg1772'].bitcfg18804 = 0;
							break;
						case 6:
							client_configs['cfg1772'].bitcfg18798 = 0;
							break;
						case 7:
							client_configs['cfg1772'].bitcfg18799 = 0;
					}
			}
			script_8491(a1);
			return;
		}, -2147483644, a3, a4, new WidgetPointer(a1), new WidgetPointer(a0), a2, (string)a8, (string)a7, "iiiIIiss", new WidgetPointer(a1));
	}
	return cs2method_10060(a2, cs2method_10236(a1));
}
