import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Random;

public class Class97 {
	static final int method366(final long var0, final String var2) {
		final Random var3 = new Random();
		final Class109_Sub14 var4 = new Class109_Sub14(128);
		final Class109_Sub14 var5 = new Class109_Sub14(128);
		final int[] var6 = new int[] { var3.nextInt(), var3.nextInt(), (int) (var0 >> 32), (int) var0 };
		var4.method552(10);

		int var7;
		for (var7 = 0; var7 < 4; ++var7)
			var4.method555(var3.nextInt());

		var4.method555(var6[0]);
		var4.method555(var6[1]);
		var4.method586(var0);
		var4.method586(0L);

		for (var7 = 0; var7 < 4; ++var7)
			var4.method555(var3.nextInt());

		var4.method579(Class29.aBigInteger267, Class29.aBigInteger266);
		var5.method552(10);

		for (var7 = 0; var7 < 3; ++var7)
			var5.method555(var3.nextInt());

		var5.method586(var3.nextLong());
		var5.method556(var3.nextLong());
		Class8_Sub2.method497(var5);
		var5.method586(var3.nextLong());
		var5.method579(Class29.aBigInteger267, Class29.aBigInteger266);
		var7 = Class32.method140(var2);
		if ((var7 % 8) != 0)
			var7 += 8 - (var7 % 8);

		final Class109_Sub14 var8 = new Class109_Sub14(var7);
		var8.method557(var2);
		var8.anInt1055 = var7;
		var8.method576(var6);
		Class109_Sub14 var9 = new Class109_Sub14(var8.anInt1055 + var5.anInt1055 + var4.anInt1055 + 5);
		var9.method552(2);
		var9.method552(var4.anInt1055);
		var9.method603(var4.aByteArray1054, 0, var4.anInt1055);
		var9.method552(var5.anInt1055);
		var9.method603(var5.aByteArray1054, 0, var5.anInt1055);
		var9.method553(var8.anInt1055);
		var9.method603(var8.aByteArray1054, 0, var8.anInt1055);
		final byte[] var10 = var9.aByteArray1054;
		final String var11 = Class56.method267(var10, 0, var10.length);
		final String var12 = var11;

		try {
			final URL var13 = new URL(
					Class109_Sub21_Sub15_Sub1.method890("services", false) + "m=accountappeal/login.ws");
			final URLConnection var14 = var13.openConnection();
			var14.setDoInput(true);
			var14.setDoOutput(true);
			var14.setConnectTimeout(5000);
			final OutputStreamWriter var15 = new OutputStreamWriter(var14.getOutputStream());
			var15.write(
					"data2=" + Class8_Sub2.method498(var12) + "&dest=" + Class8_Sub2.method498("passwordchoice.ws"));
			var15.flush();
			final InputStream var16 = var14.getInputStream();
			var9 = new Class109_Sub14(new byte[1000]);

			do {
				final int var17 = var16.read(var9.aByteArray1054, var9.anInt1055, 1000 - var9.anInt1055);
				if (var17 == -1) {
					var15.close();
					var16.close();
					String var18 = new String(var9.aByteArray1054);
					if (var18.startsWith("OFFLINE"))
						return 4;
					else if (var18.startsWith("WRONG"))
						return 7;
					else if (var18.startsWith("RELOAD"))
						return 3;
					else if (var18.startsWith("Not permitted for social network accounts."))
						return 6;
					else {
						var9.method577(var6);

						while ((var9.anInt1055 > 0) && (var9.aByteArray1054[var9.anInt1055 - 1] == 0))
							--var9.anInt1055;

						var18 = new String(var9.aByteArray1054, 0, var9.anInt1055);
						boolean var19;
						if (var18 == null)
							var19 = false;
						else
							label72: {
								try {
									new URL(var18);
								} catch (final MalformedURLException var21) {
									var19 = false;
									break label72;
								}

								var19 = true;
							}

						if (var19) {
							Class109_Sub21_Sub15_Sub6.method979(var18, true, false);
							return 2;
						} else
							return 5;
					}
				}

				var9.anInt1055 += var17;
			} while (var9.anInt1055 < 1000);

			return 5;
		} catch (final Throwable var22) {
			var22.printStackTrace();
			return 5;
		}
	}
}
