// File: /workspace/github_c_makefile_star2_O0/tomka[P]cliaspora/cliaspora.c
// Function: main
int
main(int argc, char *argv[])
{
	int	  ch, eflag, mflag, i, len, aspect_id, user_id, pm_id; 
	bool	  public, have_cfg;
	char	  *account, *host, *user, *pass, *p, *ans, *buf, url[256];
	session_t *sp;
	contact_t *contacts;

	if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) {
		warnx("Failed to set locale to \"en_US.UTF-8\". Using " \
		    "default locale.");
		if (setlocale(LC_CTYPE, "C") == NULL)
			warnx("Failed to set default locale.");
		warnx("Expect messed up output");
	}

	eflag = mflag = 0; account = NULL;
	while ((ch = getopt(argc, argv, "a:emh")) != -1) {
		switch (ch) {
		case 'a':
			account = optarg;
			break;
		case 'e':
			eflag = 1;
			break;
		case 'm':
			mflag = 1;
			break;
		case 'h':
		case '?':
		default:
			usage();
			break;
		}
	}
	argc -= optind;
	argv += optind;

	if (argc == 0)
		usage();

	(void)signal(SIGINT, cleanup);
	(void)signal(SIGTERM, cleanup);
	(void)signal(SIGHUP, cleanup);
	(void)signal(SIGQUIT, cleanup);

	switch (read_config(account)) {
	case  0:
		have_cfg = true;
		break;
	case -1:
		errx(EXIT_FAILURE, "Failed to read config file");
		/* NOTREACHED */
	default:
		have_cfg = false;
	}
	sp = NULL;
	if (strcmp(argv[0], "session") == 0) {
		if (argc < 2)
			usage();
		if (strcmp(argv[1], "close") == 0) {
			if (!have_cfg)
				errx(EXIT_FAILURE, "There is no session.");
			if ((sp = create_session()) == NULL) {
				errx(EXIT_FAILURE,
				    "Failed to create session.");
			}
			close_session(sp);
			return (EXIT_SUCCESS);
		}
		if (strcmp(argv[1], "new") != 0 || argc < 3)
			usage();
		if ((user = strtok(argv[2], "@")) == NULL)
			usage();
		if ((host = strtok(NULL, "@")) == NULL)
			usage();
		if (argc > 3)
			pass = argv[3];
		else if ((pass = readpass()) == NULL)
			errx(EXIT_FAILURE, "readpass() failed");
		sp = new_session(host, SSL_PORT, user, pass);
		if (sp == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
	} else if (!have_cfg)
		errx(EXIT_FAILURE, "Please create a session first.");
	else if (strcmp(argv[0], "show") == 0) {
		if (argc < 2)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		if (strcmp(argv[1], "stream") == 0)
			read_stream(sp, "/stream");
		else if (strcmp(argv[1], "activity") == 0)
			read_stream(sp, "/activity");
		else if (strcmp(argv[1], "mystream") == 0) {
			if (cfg.user == NULL || cfg.user[0] == '\0') {
				errx(EXIT_FAILURE, "Username not set. " \
				    "Please create a new session.");
			}
			(void)snprintf(url, sizeof(url), "/u/%s", cfg.user);
			read_stream(sp, url);
		} else
			usage();
	} else if (strcmp(argv[0], "lookup") == 0) {
		if (argc < 2)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		if ((contacts = lookup_user(sp, argv[1])) == NULL)
			errx(EXIT_FAILURE, "Failed to look up %s", argv[1]);
		show_contacts(contacts);
	} else if (strcmp(argv[0], "list") == 0) {
		if (argc < 2)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		if (strcmp(argv[1], "contacts") == 0) {
			if (get_contacts(sp) == NULL)
				errx(EXIT_FAILURE, "Failed to get contacts");
			show_contacts(sp->contacts);
		} else if (strcmp(argv[1], "messages") == 0) {
			if (get_contacts(sp) == NULL)
				warnx("Failed to get contacts");
			if (get_msg_index(sp) == NULL) {
				errx(EXIT_FAILURE,
				    "Failed to get message index");
			}
			show_msg_index(sp);
			exit(0);
		} else if (strcmp(argv[1], "aspects") == 0)
			show_aspects(sp);
		else
			usage();
	} else if (strcmp(argv[0], "like") == 0) {
		if (argc < 2)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		if (like(sp, strtol(argv[1], NULL, 10)) == -1)
			errx(EXIT_FAILURE, "Failed to \"like\" post");
	} else if (strcmp(argv[0], "delete") == 0) {
		if (argc < 2)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		if (delete_post(sp, strtol(argv[1], NULL, 10)) == -1)
			errx(EXIT_FAILURE, "Failed to delete post");
	} else if (strcmp(argv[0], "upload") == 0) {
		if (argc < 3)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		if (strcmp(argv[1], "public") != 0 &&
		    get_aspect_id(sp, argv[1]) == -1) {
			errx(EXIT_FAILURE, "Unknown aspect '%s'", argv[1]);
		}
		if (mflag == 1)
			buf = get_input(eflag == 1 ? false : true);
		if (upload(sp, argv[1], mflag ? buf : NULL, &argv[2]) == -1)
			errx(EXIT_FAILURE, "Failed to upload file(s).");
		if (mflag == 1 && eflag == 1)
			delete_postponed();
	} else if (strcmp(argv[0], "poll") == 0) {
		if (argc < 5)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		for (ans = NULL, len = 0, i = 3; i < argc; i++) {
			if ((p = json_escape_str(argv[i])) == NULL)
				err(EXIT_FAILURE, "json_escape_str()");
			len += strlen(p) + 4;
			if ((ans = realloc(ans, len)) == NULL)
				err(EXIT_FAILURE, "realloc()");
			if (i == 3)
				/* First iteration. Initialize 'ans' */
				*ans = '\0';
			(void)sprintf(ans + strlen(ans), "\"%s\"%s", p,
			    argc - 1 > i ? "," : "");
			free(p);
		}
		if (mflag == 1)
			buf = get_input(eflag == 1 ? false : true);
		if (dpoll(sp, argv[1], mflag ? buf : NULL, argv[2], ans) == -1)
			errx(EXIT_FAILURE, "Failed to start poll.");
		if (mflag == 1 && eflag == 1)
			delete_postponed();
	} else if (strcmp(argv[0], "reshare") == 0) {
		if (argc < 2)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		if (reshare(sp, strtol(argv[1], NULL, 10)) == -1)
			errx(EXIT_FAILURE, "Failed to reshare post");
 	} else if (strcmp(argv[0], "follow") == 0) {
		if (argc < 3)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE,  "Failed to create session.");
		if (strcmp(argv[1], "tag") == 0) {
			if (follow_tag(sp, argv[2]) == -1)
				errx(EXIT_FAILURE, "Failed to follow tag.");
		} else if (strcmp(argv[1], "user") == 0) {
			if (argc < 4)
				usage();
			contacts = lookup_user(sp, argv[2]);
			if (contacts == NULL) {
				errx(EXIT_FAILURE, "Failed to lookup '%s'",
				    argv[2]);
			}
			user_id = get_contact_id(contacts, argv[2]);
			if (user_id == -1) {
				errx(EXIT_FAILURE, "Couldn't find '%s'",
				    argv[2]);
			}
			aspect_id = get_aspect_id(sp, argv[3]);
			if (aspect_id == -1) {
				errx(EXIT_FAILURE, "Aspect '%s' not found",
				    argv[3]);
			}
			if (add_contact(sp, aspect_id, user_id) == -1)
				errx(EXIT_FAILURE, "Failed to follow");
		} else
			usage();
	} else if (strcmp(argv[0], "add") == 0) {
		if (argc < 4)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		if (strcmp(argv[1], "aspect") == 0) {
			public = false;
			if (strcmp(argv[3], "public") == 0)
				public = true;
			else if (strcmp(argv[3], "private") == 0)
				public = false;
			else
				usage();
			if (add_aspect(sp, argv[2], public) == -1)
				errx(EXIT_FAILURE, "Failed to add aspect");
		} else
			usage();
	} else if (strcmp(argv[0], "post") == 0) {
		if (argc < 2)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		if (strcmp(argv[1], "public") != 0 &&
		    get_aspect_id(sp, argv[1]) == -1) {
			errx(EXIT_FAILURE, "Unknown aspect '%s'", argv[1]);
		}
		buf = get_input(eflag == 1 ? false : true);
		if (post(sp, buf, argv[1]) == -1)
			errx(EXIT_FAILURE, "Failed to post");
		if (eflag == 1)
			delete_postponed();
	} else if (strcmp(argv[0], "comment") == 0) {
		if (argc < 2)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		buf = get_input(eflag == 1 ? false : true);
		if (comment(sp, buf, strtol(argv[1], NULL, 10)) == -1)
			errx(EXIT_FAILURE, "Failed to send comment");
		if (eflag == 1)
			delete_postponed();
	} else if (strcmp(argv[0], "message") == 0) {
		if (argc < 2)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		if (get_contacts(sp) == NULL)
			errx(EXIT_FAILURE, "Failed to get contacts");
		if ((pm_id = get_pm_id(sp, argv[1])) == -1) {
			errx(EXIT_FAILURE, "Failed to get %s's PM ID",
			    argv[1]);
		}
		buf = get_input(eflag == 1 ? false : true);
		if (message(sp, argc > 2 ? argv[2] : "No subject", buf,
		    pm_id) == -1)
			errx(EXIT_FAILURE, "Failed to send message");
		if (eflag == 1)
			delete_postponed();
	} else if (strcmp(argv[0], "reply") == 0) {
		if (argc < 2)
			usage();
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		buf = get_input(eflag == 1 ? false : true);
		if (reply(sp, buf, strtol(argv[1], NULL, 10)) == -1) {
			errx(EXIT_FAILURE, "Failed to reply to message %d",
			    (int)strtol(argv[1], NULL, 10));
		}
		if (eflag == 1)
			delete_postponed();
	} else if (strcmp(argv[0], "status") == 0) {
		if ((sp = create_session()) == NULL)
			errx(EXIT_FAILURE, "Failed to create session.");
		(void)puts("NOTIFICATIONS  NEW MESSAGES");
		(void)printf("%-13d  %d\n", sp->attr.nc, sp->attr.mc);
	} else
		usage();
	exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
xorl %edi, %edi
leaq 0xb9ae(%rip), %rsi      # 0xe0c0
callq 0x2260
cmpq $0x0, %rax
jne 0x275b
leaq 0xb9a8(%rip), %rdi      # 0xe0cc
movb $0x0, %al
callq 0x22f0
xorl %edi, %edi
leaq 0xb9d5(%rip), %rsi      # 0xe109
callq 0x2260
cmpq $0x0, %rax
jne 0x274d
leaq 0xb9c5(%rip), %rdi      # 0xe10b
movb $0x0, %al
callq 0x22f0
leaq 0xb9d5(%rip), %rdi      # 0xe129
movb $0x0, %al
callq 0x22f0
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x18(%rbp)
movq $0x0, -0x40(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0xb9c2(%rip), %rdx      # 0xe141
callq 0x20f0
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x27e2
movl -0x14(%rbp), %eax
addl $-0x3f, %eax
movl %eax, %ecx
movq %rcx, -0x188(%rbp)
subl $0x2e, %eax
ja 0x27db
movq -0x188(%rbp), %rax
leaq 0xb856(%rip), %rcx      # 0xe004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xf802(%rip), %rax      # 0x11fc0
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x27e0
movl $0x1, -0x18(%rbp)
jmp 0x27e0
movl $0x1, -0x1c(%rbp)
jmp 0x27e0
jmp 0x27db
callq 0x3980
jmp 0x2771
movq 0xf7f7(%rip), %rax      # 0x11fe0
movl (%rax), %ecx
movl -0x8(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x8(%rbp)
movq 0xf7e6(%rip), %rax      # 0x11fe0
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
cmpl $0x0, -0x8(%rbp)
jne 0x2819
callq 0x3980
leaq 0x1180(%rip), %rsi      # 0x39a0
movq %rsi, -0x198(%rbp)
movl $0x2, %edi
callq 0x23c0
movq -0x198(%rbp), %rsi
movl $0xf, %edi
callq 0x23c0
movq -0x198(%rbp), %rsi
movl $0x1, %edi
callq 0x23c0
movq -0x198(%rbp), %rsi
movl $0x3, %edi
callq 0x23c0
movq -0x40(%rbp), %rdi
callq 0x8920
movl %eax, %ecx
movl %ecx, -0x18c(%rbp)
subl $-0x1, %eax
je 0x2891
jmp 0x287c
movl -0x18c(%rbp), %eax
testl %eax, %eax
jne 0x28a4
jmp 0x2888
movl $0x1, -0x38(%rbp)
jmp 0x28ab
movl $0x1, %edi
leaq 0xb8aa(%rip), %rsi      # 0xe147
movb $0x0, %al
callq 0x25a0
movl $0x0, -0x38(%rbp)
movq $0x0, -0x178(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xc0ac(%rip), %rsi      # 0xe970
callq 0x2460
cmpl $0x0, %eax
jne 0x2a28
cmpl $0x2, -0x8(%rbp)
jge 0x28dd
callq 0x3980
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xb876(%rip), %rsi      # 0xe162
callq 0x2460
cmpl $0x0, %eax
jne 0x294b
cmpl $0x0, -0x38(%rbp)
jne 0x290f
movl $0x1, %edi
leaq 0xb860(%rip), %rsi      # 0xe168
movb $0x0, %al
callq 0x25a0
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x2934
movl $0x1, %edi
leaq 0xb850(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rdi
callq 0x3b10
xorl %eax, %eax
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xb83d(%rip), %rsi      # 0xe197
callq 0x2460
cmpl $0x0, %eax
jne 0x296a
cmpl $0x3, -0x8(%rbp)
jge 0x296f
callq 0x3980
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xb81d(%rip), %rsi      # 0xe19b
callq 0x2510
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
jne 0x2992
callq 0x3980
xorl %eax, %eax
movl %eax, %edi
leaq 0xb7fe(%rip), %rsi      # 0xe19b
callq 0x2510
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
jne 0x29b1
callq 0x3980
cmpl $0x3, -0x8(%rbp)
jle 0x29c5
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x29e9
callq 0xd290
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
jne 0x29e7
movl $0x1, %edi
leaq 0xb7bd(%rip), %rsi      # 0xe19d
movb $0x0, %al
callq 0x25a0
jmp 0x29e9
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
movl $0x1bb, %esi            # imm = 0x1BB
callq 0x3bf0
movq %rax, -0x178(%rbp)
cmpq $0x0, -0x178(%rbp)
jne 0x2a23
movl $0x1, %edi
leaq 0xb761(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
jmp 0x3976
cmpl $0x0, -0x38(%rbp)
jne 0x2a41
movl $0x1, %edi
leaq 0xb775(%rip), %rsi      # 0xe1af
movb $0x0, %al
callq 0x25a0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xb77f(%rip), %rsi      # 0xe1ce
callq 0x2460
cmpl $0x0, %eax
jne 0x2b84
cmpl $0x2, -0x8(%rbp)
jge 0x2a68
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x2a8d
movl $0x1, %edi
leaq 0xb6f7(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xce4b(%rip), %rsi      # 0xf8e7
callq 0x2460
cmpl $0x0, %eax
jne 0x2abe
movq -0x178(%rbp), %rdi
leaq 0xb71f(%rip), %rsi      # 0xe1d3
callq 0x3e30
jmp 0x2b7f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xb70f(%rip), %rsi      # 0xe1dc
callq 0x2460
cmpl $0x0, %eax
jne 0x2aef
movq -0x178(%rbp), %rdi
leaq 0xb6f6(%rip), %rsi      # 0xe1db
callq 0x3e30
jmp 0x2b7d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xb6e7(%rip), %rsi      # 0xe1e5
callq 0x2460
cmpl $0x0, %eax
jne 0x2b76
leaq 0xf901(%rip), %rax      # 0x12410
cmpq $0x0, 0x8(%rax)
je 0x2b29
leaq 0xf8f3(%rip), %rax      # 0x12410
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x2b3c
movl $0x1, %edi
leaq 0xb6b9(%rip), %rsi      # 0xe1ee
movb $0x0, %al
callq 0x25a0
leaq -0x170(%rbp), %rdi
leaq 0xf8c6(%rip), %rax      # 0x12410
movq 0x8(%rax), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0xb6c3(%rip), %rdx      # 0xe21d
movb $0x0, %al
callq 0x2540
movq -0x178(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x3e30
jmp 0x2b7b
callq 0x3980
jmp 0x2b7d
jmp 0x2b7f
jmp 0x3972
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xb691(%rip), %rsi      # 0xe223
callq 0x2460
cmpl $0x0, %eax
jne 0x2c19
cmpl $0x2, -0x8(%rbp)
jge 0x2ba7
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x2bcc
movl $0x1, %edi
leaq 0xb5b8(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x4020
movq %rax, -0x180(%rbp)
cmpq $0x0, %rax
jne 0x2c08
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1, %edi
leaq 0xb629(%rip), %rsi      # 0xe22a
movb $0x0, %al
callq 0x25a0
movq -0x180(%rbp), %rdi
callq 0x4490
jmp 0x3970
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xb618(%rip), %rsi      # 0xe23f
callq 0x2460
cmpl $0x0, %eax
jne 0x2d5e
cmpl $0x2, -0x8(%rbp)
jge 0x2c40
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x2c65
movl $0x1, %edi
leaq 0xb51f(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xbcbf(%rip), %rsi      # 0xe933
callq 0x2460
cmpl $0x0, %eax
jne 0x2cb8
movq -0x178(%rbp), %rdi
callq 0x4570
cmpq $0x0, %rax
jne 0x2ca3
movl $0x1, %edi
leaq 0xb5a8(%rip), %rsi      # 0xe244
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x4490
jmp 0x2d59
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xbe88(%rip), %rsi      # 0xeb4f
callq 0x2460
cmpl $0x0, %eax
jne 0x2d29
movq -0x178(%rbp), %rdi
callq 0x4570
cmpq $0x0, %rax
jne 0x2cf1
leaq 0xb55a(%rip), %rdi      # 0xe244
movb $0x0, %al
callq 0x22f0
movq -0x178(%rbp), %rdi
callq 0x4990
cmpq $0x0, %rax
jne 0x2d16
movl $0x1, %edi
leaq 0xb54c(%rip), %rsi      # 0xe25b
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rdi
callq 0x4e80
xorl %edi, %edi
callq 0x23f0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xbe6d(%rip), %rsi      # 0xeba5
callq 0x2460
cmpl $0x0, %eax
jne 0x2d50
movq -0x178(%rbp), %rdi
callq 0x5020
jmp 0x2d55
callq 0x3980
jmp 0x2d57
jmp 0x2d59
jmp 0x396e
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xb50b(%rip), %rsi      # 0xe277
callq 0x2460
cmpl $0x0, %eax
jne 0x2df5
cmpl $0x2, -0x8(%rbp)
jge 0x2d81
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x2da6
movl $0x1, %edi
leaq 0xb3de(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x2470
movq -0x1a0(%rbp), %rdi
movl %eax, %esi
callq 0x50d0
cmpl $-0x1, %eax
jne 0x2df0
movl $0x1, %edi
leaq 0xb493(%rip), %rsi      # 0xe27c
movb $0x0, %al
callq 0x25a0
jmp 0x396c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xbc28(%rip), %rsi      # 0xea2b
callq 0x2460
cmpl $0x0, %eax
jne 0x2e8c
cmpl $0x2, -0x8(%rbp)
jge 0x2e18
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x2e3d
movl $0x1, %edi
leaq 0xb347(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x2470
movq -0x1a8(%rbp), %rdi
movl %eax, %esi
callq 0x5200
cmpl $-0x1, %eax
jne 0x2e87
movl $0x1, %edi
leaq 0xb412(%rip), %rsi      # 0xe292
movb $0x0, %al
callq 0x25a0
jmp 0x396a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xb40e(%rip), %rsi      # 0xe2a8
callq 0x2460
cmpl $0x0, %eax
jne 0x2fcf
cmpl $0x3, -0x8(%rbp)
jge 0x2eb3
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x2ed8
movl $0x1, %edi
leaq 0xb2ac(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xb3c8(%rip), %rsi      # 0xe2af
callq 0x2460
cmpl $0x0, %eax
je 0x2f25
movq -0x178(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x5320
cmpl $-0x1, %eax
jne 0x2f25
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1, %edi
leaq 0xb398(%rip), %rsi      # 0xe2b6
movb $0x0, %al
callq 0x25a0
cmpl $0x1, -0x1c(%rbp)
jne 0x2f44
movl -0x18(%rbp), %ecx
movl $0x1, %edi
xorl %eax, %eax
cmpl $0x1, %ecx
cmovel %eax, %edi
callq 0xcae0
movq %rax, -0x70(%rbp)
movq -0x178(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1b0(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x2f74
movq -0x70(%rbp), %rax
movq %rax, -0x1c0(%rbp)
jmp 0x2f7f
xorl %eax, %eax
movq %rax, -0x1c0(%rbp)
jmp 0x2f7f
movq -0x1b0(%rbp), %rsi
movq -0x1b8(%rbp), %rdi
movq -0x1c0(%rbp), %rdx
movq -0x10(%rbp), %rcx
addq $0x10, %rcx
callq 0x5390
cmpl $-0x1, %eax
jne 0x2fb9
movl $0x1, %edi
leaq 0xb318(%rip), %rsi      # 0xe2ca
movb $0x0, %al
callq 0x25a0
cmpl $0x1, -0x1c(%rbp)
jne 0x2fca
cmpl $0x1, -0x18(%rbp)
jne 0x2fca
callq 0xc910
jmp 0x3968
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xb307(%rip), %rsi      # 0xe2e4
callq 0x2460
cmpl $0x0, %eax
jne 0x31d0
cmpl $0x5, -0x8(%rbp)
jge 0x2ff6
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x301b
movl $0x1, %edi
leaq 0xb169(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq $0x0, -0x68(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x3, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x3122
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xc550
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
jne 0x306b
movl $0x1, %edi
leaq 0xb285(%rip), %rsi      # 0xe2e9
movb $0x0, %al
callq 0x2270
movq -0x60(%rbp), %rdi
callq 0x2160
movq %rax, %rcx
addq $0x4, %rcx
movslq -0x24(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x24(%rbp)
movq -0x68(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x2550
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
jne 0x30af
movl $0x1, %edi
leaq 0xb253(%rip), %rsi      # 0xe2fb
movb $0x0, %al
callq 0x2270
cmpl $0x3, -0x20(%rbp)
jne 0x30bc
movq -0x68(%rbp), %rax
movb $0x0, (%rax)
movq -0x68(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq -0x68(%rbp), %rdi
callq 0x2160
movq -0x1c8(%rbp), %rdi
addq %rax, %rdi
movq -0x60(%rbp), %rdx
movl -0x8(%rbp), %esi
subl $0x1, %esi
movl -0x20(%rbp), %r8d
leaq 0xcc13(%rip), %rcx      # 0xfd02
leaq 0xb97d(%rip), %rax      # 0xea73
cmpl %r8d, %esi
cmovgq %rax, %rcx
leaq 0xb201(%rip), %rsi      # 0xe305
movb $0x0, %al
callq 0x20d0
movq -0x60(%rbp), %rdi
callq 0x23d0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x3031
cmpl $0x1, -0x1c(%rbp)
jne 0x3141
movl -0x18(%rbp), %ecx
movl $0x1, %edi
xorl %eax, %eax
cmpl $0x1, %ecx
cmovel %eax, %edi
callq 0xcae0
movq %rax, -0x70(%rbp)
movq -0x178(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1d0(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x3171
movq -0x70(%rbp), %rax
movq %rax, -0x1e0(%rbp)
jmp 0x317c
xorl %eax, %eax
movq %rax, -0x1e0(%rbp)
jmp 0x317c
movq -0x1d0(%rbp), %rsi
movq -0x1d8(%rbp), %rdi
movq -0x1e0(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x68(%rbp), %r8
callq 0x5720
cmpl $-0x1, %eax
jne 0x31ba
movl $0x1, %edi
leaq 0xb159(%rip), %rsi      # 0xe30c
movb $0x0, %al
callq 0x25a0
cmpl $0x1, -0x1c(%rbp)
jne 0x31cb
cmpl $0x1, -0x18(%rbp)
jne 0x31cb
callq 0xc910
jmp 0x3966
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xb144(%rip), %rsi      # 0xe322
callq 0x2460
cmpl $0x0, %eax
jne 0x3267
cmpl $0x2, -0x8(%rbp)
jge 0x31f3
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x3218
movl $0x1, %edi
leaq 0xaf6c(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x2470
movq -0x1e8(%rbp), %rdi
movl %eax, %esi
callq 0x59a0
cmpl $-0x1, %eax
jne 0x3262
movl $0x1, %edi
leaq 0xb0cf(%rip), %rsi      # 0xe32a
movb $0x0, %al
callq 0x25a0
jmp 0x3964
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xb12f(%rip), %rsi      # 0xe3a4
callq 0x2460
cmpl $0x0, %eax
jne 0x340d
cmpl $0x3, -0x8(%rbp)
jge 0x328e
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x32b3
movl $0x1, %edi
leaq 0xaed1(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xb07f(%rip), %rsi      # 0xe341
callq 0x2460
cmpl $0x0, %eax
jne 0x32fd
movq -0x178(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5b10
cmpl $-0x1, %eax
jne 0x32f8
movl $0x1, %edi
leaq 0xb054(%rip), %rsi      # 0xe345
movb $0x0, %al
callq 0x25a0
jmp 0x3408
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xb9c9(%rip), %rsi      # 0xecd5
callq 0x2460
cmpl $0x0, %eax
jne 0x3401
cmpl $0x4, -0x8(%rbp)
jge 0x3325
callq 0x3980
movq -0x178(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x4020
movq %rax, -0x180(%rbp)
cmpq $0x0, -0x180(%rbp)
jne 0x3365
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
movl $0x1, %edi
leaq 0xaffd(%rip), %rsi      # 0xe35b
movb $0x0, %al
callq 0x25a0
movq -0x180(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5ca0
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x339d
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
movl $0x1, %edi
leaq 0xafdb(%rip), %rsi      # 0xe371
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x5320
movl %eax, -0x28(%rbp)
cmpl $-0x1, -0x28(%rbp)
jne 0x33d5
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
movl $0x1, %edi
leaq 0xafb6(%rip), %rsi      # 0xe384
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rdi
movl -0x28(%rbp), %esi
movl -0x2c(%rbp), %edx
callq 0x5d00
cmpl $-0x1, %eax
jne 0x33ff
movl $0x1, %edi
leaq 0xafa2(%rip), %rsi      # 0xe39a
movb $0x0, %al
callq 0x25a0
jmp 0x3406
callq 0x3980
jmp 0x3408
jmp 0x3962
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xaf90(%rip), %rsi      # 0xe3ab
callq 0x2460
cmpl $0x0, %eax
jne 0x3503
cmpl $0x4, -0x8(%rbp)
jge 0x3434
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x3459
movl $0x1, %edi
leaq 0xad2b(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xaf5d(%rip), %rsi      # 0xe3c5
callq 0x2460
cmpl $0x0, %eax
jne 0x34f9
movl $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0xae23(%rip), %rsi      # 0xe2af
callq 0x2460
cmpl $0x0, %eax
jne 0x349f
movl $0x1, -0x34(%rbp)
jmp 0x34c8
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0xaf01(%rip), %rsi      # 0xe3af
callq 0x2460
cmpl $0x0, %eax
jne 0x34c1
movl $0x0, -0x34(%rbp)
jmp 0x34c6
callq 0x3980
jmp 0x34c8
movq -0x178(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x34(%rbp), %edx
callq 0x5e40
cmpl $-0x1, %eax
jne 0x34f7
movl $0x1, %edi
leaq 0xaec7(%rip), %rsi      # 0xe3b7
movb $0x0, %al
callq 0x25a0
jmp 0x34fe
callq 0x3980
jmp 0x3960
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xad7c(%rip), %rsi      # 0xe28d
callq 0x2460
cmpl $0x0, %eax
jne 0x35f5
cmpl $0x2, -0x8(%rbp)
jge 0x352a
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x354f
movl $0x1, %edi
leaq 0xac35(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xad51(%rip), %rsi      # 0xe2af
callq 0x2460
cmpl $0x0, %eax
je 0x359c
movq -0x178(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x5320
cmpl $-0x1, %eax
jne 0x359c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1, %edi
leaq 0xad21(%rip), %rsi      # 0xe2b6
movb $0x0, %al
callq 0x25a0
movl -0x18(%rbp), %ecx
movl $0x1, %edi
xorl %eax, %eax
cmpl $0x1, %ecx
cmovel %eax, %edi
callq 0xcae0
movq %rax, -0x70(%rbp)
movq -0x178(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x5fa0
cmpl $-0x1, %eax
jne 0x35e5
movl $0x1, %edi
leaq 0xadee(%rip), %rsi      # 0xe3cc
movb $0x0, %al
callq 0x25a0
cmpl $0x1, -0x18(%rbp)
jne 0x35f0
callq 0xc910
jmp 0x395e
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xade7(%rip), %rsi      # 0xe3ea
callq 0x2460
cmpl $0x0, %eax
jne 0x36c6
cmpl $0x2, -0x8(%rbp)
jge 0x361c
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x3641
movl $0x1, %edi
leaq 0xab43(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movl -0x18(%rbp), %ecx
movl $0x1, %edi
xorl %eax, %eax
cmpl $0x1, %ecx
cmovel %eax, %edi
callq 0xcae0
movq %rax, -0x70(%rbp)
movq -0x178(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x2470
movq -0x1f8(%rbp), %rdi
movq -0x1f0(%rbp), %rsi
movl %eax, %edx
callq 0x6190
cmpl $-0x1, %eax
jne 0x36b6
movl $0x1, %edi
leaq 0xad2c(%rip), %rsi      # 0xe3db
movb $0x0, %al
callq 0x25a0
cmpl $0x1, -0x18(%rbp)
jne 0x36c1
callq 0xc910
jmp 0x395c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xad51(%rip), %rsi      # 0xe425
callq 0x2460
cmpl $0x0, %eax
jne 0x37fe
cmpl $0x2, -0x8(%rbp)
jge 0x36ed
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x3712
movl $0x1, %edi
leaq 0xaa72(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rdi
callq 0x4570
cmpq $0x0, %rax
jne 0x3737
movl $0x1, %edi
leaq 0xab14(%rip), %rsi      # 0xe244
movb $0x0, %al
callq 0x25a0
movq -0x178(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6340
movl %eax, -0x30(%rbp)
cmpl $-0x1, %eax
jne 0x376e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1, %edi
leaq 0xac8b(%rip), %rsi      # 0xe3f2
movb $0x0, %al
callq 0x25a0
movl -0x18(%rbp), %ecx
movl $0x1, %edi
xorl %eax, %eax
cmpl $0x1, %ecx
cmovel %eax, %edi
callq 0xcae0
movq %rax, -0x70(%rbp)
movq -0x178(%rbp), %rax
movq %rax, -0x200(%rbp)
cmpl $0x2, -0x8(%rbp)
jle 0x37ac
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x208(%rbp)
jmp 0x37bc
leaq 0xac58(%rip), %rax      # 0xe40b
movq %rax, -0x208(%rbp)
jmp 0x37bc
movq -0x200(%rbp), %rdi
movq -0x208(%rbp), %rsi
movq -0x70(%rbp), %rdx
movl -0x30(%rbp), %ecx
callq 0x6580
cmpl $-0x1, %eax
jne 0x37ee
movl $0x1, %edi
leaq 0xac2f(%rip), %rsi      # 0xe416
movb $0x0, %al
callq 0x25a0
cmpl $0x1, -0x18(%rbp)
jne 0x37f9
callq 0xc910
jmp 0x395a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xb19d(%rip), %rsi      # 0xe9a9
callq 0x2460
cmpl $0x0, %eax
jne 0x38e4
cmpl $0x2, -0x8(%rbp)
jge 0x3825
callq 0x3980
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x384a
movl $0x1, %edi
leaq 0xa93a(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
movl -0x18(%rbp), %ecx
movl $0x1, %edi
xorl %eax, %eax
cmpl $0x1, %ecx
cmovel %eax, %edi
callq 0xcae0
movq %rax, -0x70(%rbp)
movq -0x178(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x2470
movq -0x218(%rbp), %rdi
movq -0x210(%rbp), %rsi
movl %eax, %edx
callq 0x6740
cmpl $-0x1, %eax
jne 0x38d7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x2470
movl %eax, %edx
movl $0x1, %edi
leaq 0xab5d(%rip), %rsi      # 0xe42d
movb $0x0, %al
callq 0x25a0
cmpl $0x1, -0x18(%rbp)
jne 0x38e2
callq 0xc910
jmp 0x3958
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xab59(%rip), %rsi      # 0xe44b
callq 0x2460
cmpl $0x0, %eax
jne 0x3951
callq 0x39d0
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
jne 0x3921
movl $0x1, %edi
leaq 0xa863(%rip), %rsi      # 0xe17d
movb $0x0, %al
callq 0x25a0
leaq 0xab2a(%rip), %rdi      # 0xe452
callq 0x24f0
movq -0x178(%rbp), %rax
movl 0x2c(%rax), %esi
movq -0x178(%rbp), %rax
movl 0x30(%rax), %edx
leaq 0xab26(%rip), %rdi      # 0xe46e
movb $0x0, %al
callq 0x2070
jmp 0x3956
callq 0x3980
jmp 0x3958
jmp 0x395a
jmp 0x395c
jmp 0x395e
jmp 0x3960
jmp 0x3962
jmp 0x3964
jmp 0x3966
jmp 0x3968
jmp 0x396a
jmp 0x396c
jmp 0x396e
jmp 0x3970
jmp 0x3972
jmp 0x3974
jmp 0x3976
xorl %edi, %edi
callq 0x23f0
nopl (%rax)