// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %rbx
movl %edi, %r14d
leaq 0x7826(%rip), %rsi      # 0xa020
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x2240
testq %rax, %rax
jne 0x2845
leaq 0x781d(%rip), %rdi      # 0xa02c
xorl %eax, %eax
callq 0x22d0
leaq 0x784c(%rip), %rsi      # 0xa069
xorl %edi, %edi
callq 0x2240
testq %rax, %rax
jne 0x2837
leaq 0x783b(%rip), %rdi      # 0xa06b
xorl %eax, %eax
callq 0x22d0
leaq 0x784b(%rip), %rdi      # 0xa089
xorl %eax, %eax
callq 0x22d0
movb $0x1, %al
movl %eax, 0xc(%rsp)
leaq 0x784f(%rip), %r12      # 0xa0a1
movq 0xc767(%rip), %r13      # 0xefc0
movq $0x0, 0x10(%rsp)
xorl %r15d, %r15d
movl %ebp, %ecx
movl %ecx, %ebp
movl %r14d, %edi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x20e0
movl $0x1, %ecx
cmpl $0x65, %eax
je 0x2867
cmpl $-0x1, %eax
je 0x28ab
cmpl $0x6d, %eax
je 0x289a
cmpl $0x61, %eax
jne 0x33bb
movq (%r13), %r15
jmp 0x2865
movb $0x1, %al
movq %rax, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
jmp 0x2865
movq 0xc72e(%rip), %rax      # 0xefe0
movslq (%rax), %r13
subl %r13d, %r14d
je 0x33bb
leaq 0xbe3(%rip), %r12       # 0x34a8
movl $0x2, %edi
movq %r12, %rsi
callq 0x23b0
movl $0xf, %edi
movq %r12, %rsi
callq 0x23b0
movl $0x1, %edi
movq %r12, %rsi
callq 0x23b0
movl $0x3, %edi
movq %r12, %rsi
callq 0x23b0
movq %r15, %rdi
callq 0x69db
testl %eax, %eax
je 0x2913
cmpl $-0x1, %eax
je 0x2a8b
movb $0x1, %r12b
jmp 0x2916
xorl %r12d, %r12d
leaq (%rbx,%r13,8), %rbx
movq (%rbx), %r15
leaq 0x7b10(%rip), %rsi      # 0xa434
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x29fe
cmpl $0x1, %r14d
jle 0x33bb
movq 0x8(%rbx), %r15
leaq 0x7779(%rip), %rsi      # 0xa0c2
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2a13
testb %r12b, %r12b
jne 0x2a7f
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movq (%rax), %rdi
movzwl 0x10(%rax), %esi
callq 0x7828
testq %rax, %rax
je 0x29ea
movq %rax, %rbx
movq 0x8(%r14), %rdx
leaq 0x7b55(%rip), %rax      # 0xa4e7
movq %rax, (%rsp)
leaq 0x7b59(%rip), %rsi      # 0xa4f6
leaq 0x7af3(%rip), %rcx      # 0xa497
leaq 0x7a55(%rip), %r8       # 0xa400
movq %rbx, %rdi
movl $0x3, %r9d
callq 0x83d9
cmpl $-0x1, %eax
je 0x29e2
cmpl $0x12e, %eax            # imm = 0x12E
sete %cl
cmpl $0x12c, %eax            # imm = 0x12C
setl %dl
orb %cl, %dl
jne 0x29e2
leaq 0x7cfe(%rip), %rdi      # 0xa6d7
movl %eax, %esi
xorl %eax, %eax
callq 0x22d0
movq %rbx, %rdi
callq 0x7a3f
xorl %eax, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %r12b, %r12b
je 0x2a97
leaq 0x7701(%rip), %rsi      # 0xa10f
jmp 0x2c34
leaq 0x76dd(%rip), %rsi      # 0xa0f7
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
sete %al
cmpl $0x2, %r14d
setne %cl
testb %cl, %al
je 0x33bb
movq 0x10(%rbx), %rdi
leaq 0x76ba(%rip), %rsi      # 0xa0fb
callq 0x2500
testq %rax, %rax
je 0x33bb
movq %rax, %r15
leaq 0x76a2(%rip), %rsi      # 0xa0fb
xorl %edi, %edi
callq 0x2500
testq %rax, %rax
je 0x33bb
movq %rax, %r12
cmpl $0x4, %r14d
jl 0x2c03
movq 0x18(%rbx), %rdx
jmp 0x2c19
leaq 0x7642(%rip), %rsi      # 0xa0c8
jmp 0x2c34
leaq 0x7615(%rip), %rsi      # 0xa0a7
jmp 0x2c34
leaq 0x7690(%rip), %rsi      # 0xa12e
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2aec
cmpl $0x1, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movq 0x8(%rbx), %rbx
leaq 0x8d93(%rip), %rsi      # 0xb863
movq %rbx, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2c40
leaq 0x764c(%rip), %rsi      # 0xa133
jmp 0x2c5a
leaq 0x7690(%rip), %rsi      # 0xa183
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2b43
cmpl $0x1, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x41d5
testq %rax, %rax
jne 0x2cbd
movq 0x8(%rbx), %rdx
leaq 0x7653(%rip), %rsi      # 0xa18a
movl $0x1, %edi
xorl %eax, %eax
callq 0x2590
leaq 0x7655(%rip), %rsi      # 0xa19f
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2ba9
cmpl $0x1, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movq 0x8(%rbx), %rbx
leaq 0x787b(%rip), %rsi      # 0xa3f7
movq %rbx, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2d7d
movq %r14, %rdi
callq 0x4573
testq %rax, %rax
jne 0x2efc
leaq 0x7600(%rip), %rsi      # 0xa1a4
jmp 0x2c34
leaq 0x7627(%rip), %rsi      # 0xa1d7
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2c64
cmpl $0x1, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2460
movq %r14, %rdi
movl %eax, %esi
callq 0x4d6b
cmpl $-0x1, %eax
jne 0x2cc5
leaq 0x75db(%rip), %rsi      # 0xa1dc
jmp 0x2c34
callq 0x9889
movq %rax, %rdx
testq %rax, %rax
jne 0x2c19
leaq 0x74e6(%rip), %rsi      # 0xa0fd
jmp 0x2c34
movq %r12, %rdi
movq %r15, %rsi
callq 0x356b
testq %rax, %rax
jne 0x2cc5
leaq 0x74a9(%rip), %rsi      # 0xa0dd
movl $0x1, %edi
xorl %eax, %eax
callq 0x2590
leaq 0x74f5(%rip), %rsi      # 0xa13c
movq %rbx, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2ccc
leaq 0x74e1(%rip), %rsi      # 0xa13b
movq %r14, %rdi
callq 0x3ae8
jmp 0x2cc5
leaq 0x7884(%rip), %rsi      # 0xa4ef
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2d08
cmpl $0x1, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2460
movq %r14, %rdi
movl %eax, %esi
callq 0x4e48
cmpl $-0x1, %eax
jne 0x2cc5
leaq 0x753a(%rip), %rsi      # 0xa1f2
jmp 0x2c34
movq %rax, %rdi
callq 0x44c4
xorl %edi, %edi
callq 0x23e0
leaq 0x7472(%rip), %rsi      # 0xa145
movq %rbx, %rdi
callq 0x2450
testl %eax, %eax
jne 0x33bb
leaq 0xc716(%rip), %rax      # 0xf400
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x2cfc
cmpb $0x0, (%rcx)
jne 0x2f86
leaq 0x744b(%rip), %rsi      # 0xa14e
jmp 0x2c34
leaq 0x74f9(%rip), %rsi      # 0xa208
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2dcc
cmpl $0x2, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movq 0x8(%rbx), %r15
leaq 0x74ca(%rip), %rsi      # 0xa20f
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
je 0x3027
movq %r14, %rdi
movq %r15, %rsi
callq 0x4f12
cmpl $-0x1, %eax
jne 0x3027
leaq 0x74a6(%rip), %rsi      # 0xa216
movl $0x1, %edi
movq %r15, %rdx
jmp 0x2b3c
leaq 0x788f(%rip), %rsi      # 0xa613
movq %rbx, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2f05
movq %r14, %rdi
callq 0x4573
testq %rax, %rax
jne 0x2daf
leaq 0x73fc(%rip), %rdi      # 0xa1a4
xorl %eax, %eax
callq 0x22d0
movq %r14, %rdi
callq 0x4862
testq %rax, %rax
jne 0x2fac
leaq 0x73f4(%rip), %rsi      # 0xa1bb
jmp 0x2c34
leaq 0x7471(%rip), %rsi      # 0xa244
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2f29
cmpl $0x4, %r14d
jle 0x33bb
callq 0x34c1
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x2c2d
leal -0x1(%r14), %eax
cltq
movq %rax, 0x28(%rsp)
movl %r14d, %eax
movq %rax, 0x20(%rsp)
movl $0x3, %r12d
xorl %r14d, %r14d
xorl %r13d, %r13d
movq (%rbx,%r12,8), %rdi
callq 0x9051
testq %rax, %rax
je 0x31b5
movq %rax, %r15
movq %rax, %rdi
callq 0x2150
movslq %r13d, %rcx
addq %rcx, %rax
addq $0x4, %rax
movq %rax, %r13
movslq %eax, %rsi
movq %r14, %rdi
callq 0x2540
testq %rax, %rax
je 0x31be
movq %rax, %r14
cmpq $0x3, %r12
jne 0x2e6a
movb $0x0, (%r14)
movq %r14, %rdi
callq 0x2150
movq %r14, %rdi
addq %rax, %rdi
cmpq 0x28(%rsp), %r12
leaq 0x8cad(%rip), %rcx      # 0xbb31
leaq 0x76ac(%rip), %rax      # 0xa537
cmovlq %rax, %rcx
leaq 0x73cf(%rip), %rsi      # 0xa265
movq %r15, %rdx
xorl %eax, %eax
callq 0x20c0
movq %r15, %rdi
callq 0x23c0
incq %r12
cmpq %r12, 0x20(%rsp)
jne 0x2e1f
testb $0x1, 0x10(%rsp)
je 0x2ec7
movl %ebp, %edi
xorl $0x1, %edi
callq 0x931f
xorl %edx, %edx
testb $0x1, 0xc(%rsp)
cmoveq %rax, %rdx
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rcx
movq 0x18(%rsp), %rdi
movq %r14, %r8
callq 0x5419
cmpl $-0x1, %eax
jne 0x310b
leaq 0x7375(%rip), %rsi      # 0xa26c
jmp 0x2c34
movq 0x20(%r14), %rdi
jmp 0x2cc0
leaq 0x775d(%rip), %rsi      # 0xa669
movq %rbx, %rdi
callq 0x2450
testl %eax, %eax
jne 0x33bb
movq %r14, %rdi
callq 0x4ce4
jmp 0x2cc5
leaq 0x7352(%rip), %rsi      # 0xa282
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x2fb9
cmpl $0x1, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2460
movq %r14, %rdi
movl %eax, %esi
callq 0x55f5
cmpl $-0x1, %eax
jne 0x2cc5
leaq 0x7309(%rip), %rsi      # 0xa28a
jmp 0x2c34
leaq 0x71f0(%rip), %rdx      # 0xa17d
leaq 0x30(%rsp), %rbx
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2530
movq %r14, %rdi
movq %rbx, %rsi
jmp 0x2c5d
movq %r14, %rdi
callq 0x4bd0
jmp 0x2cc5
leaq 0x7344(%rip), %rsi      # 0xa304
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x306b
cmpl $0x2, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r15
movq 0x8(%rbx), %r12
leaq 0x72ab(%rip), %rsi      # 0xa2a1
movq %r12, %rdi
callq 0x2450
testl %eax, %eax
jne 0x3242
movq 0x10(%rbx), %rsi
movq %r15, %rdi
callq 0x58c7
cmpl $-0x1, %eax
jne 0x2cc5
leaq 0x7283(%rip), %rsi      # 0xa2a5
jmp 0x2c34
testb $0x1, 0x10(%rsp)
je 0x3038
movl %ebp, %edi
xorl $0x1, %edi
callq 0x931f
movq 0x8(%rbx), %rsi
xorl %edx, %edx
testb $0x1, 0xc(%rsp)
cmoveq %rax, %rdx
addq $0x10, %rbx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x4f4e
cmpl $-0x1, %eax
jne 0x310b
leaq 0x71c4(%rip), %rsi      # 0xa22a
jmp 0x2c34
leaq 0x7299(%rip), %rsi      # 0xa30b
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x312a
cmpl $0x3, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movq 0x8(%rbx), %rdi
leaq 0x727d(%rip), %rsi      # 0xa325
callq 0x2450
testl %eax, %eax
jne 0x33bb
movq 0x18(%rbx), %r15
leaq 0x714f(%rip), %rsi      # 0xa20f
movq %r15, %rdi
callq 0x2450
movl $0x1, %edx
testl %eax, %eax
je 0x30ea
leaq 0x7237(%rip), %rsi      # 0xa30f
movq %r15, %rdi
callq 0x2450
xorl %edx, %edx
testl %eax, %eax
jne 0x33bb
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x5ade
cmpl $-0x1, %eax
jne 0x2cc5
leaq 0x7211(%rip), %rsi      # 0xa317
jmp 0x2c34
testl %ebp, %ebp
setne %al
movq 0x10(%rsp), %rcx
andb %al, %cl
cmpb $0x1, %cl
jne 0x2cc5
callq 0x91a0
jmp 0x2cc5
leaq 0x70bc(%rip), %rsi      # 0xa1ed
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x31d1
cmpl $0x1, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movq 0x8(%rbx), %r15
leaq 0x70a8(%rip), %rsi      # 0xa20f
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
je 0x3187
movq %r14, %rdi
movq %r15, %rsi
callq 0x4f12
cmpl $-0x1, %eax
je 0x2d69
movl %ebp, %edi
xorl $0x1, %edi
callq 0x931f
movq 0x8(%rbx), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x5c02
cmpl $-0x1, %eax
jne 0x349b
leaq 0x717c(%rip), %rsi      # 0xa32c
jmp 0x2c34
leaq 0x708d(%rip), %rsi      # 0xa249
jmp 0x31c5
leaq 0x7096(%rip), %rsi      # 0xa25b
movl $0x1, %edi
xorl %eax, %eax
callq 0x2250
leaq 0x7172(%rip), %rsi      # 0xa34a
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x3288
cmpl $0x1, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movl %ebp, %edi
xorl $0x1, %edi
callq 0x931f
movq %rax, %r15
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2460
movq %r14, %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x5d94
cmpl $-0x1, %eax
jne 0x349b
leaq 0x70fe(%rip), %rsi      # 0xa33b
jmp 0x2c34
leaq 0x7550(%rip), %rsi      # 0xa799
movq %r12, %rdi
callq 0x2450
testl %eax, %eax
jne 0x33bb
cmpl $0x3, %r14d
je 0x33bb
movq 0x10(%rbx), %rsi
movq %r15, %rdi
callq 0x41d5
movq 0x10(%rbx), %r14
testq %rax, %rax
jne 0x33d1
leaq 0x7038(%rip), %rsi      # 0xa2bb
jmp 0x3406
leaq 0x70f6(%rip), %rsi      # 0xa385
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x32ec
cmpl $0x1, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r15
movq %rax, %rdi
callq 0x4573
testq %rax, %rax
je 0x2b9d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0x5ed6
cmpl $-0x1, %eax
jne 0x343b
movq 0x8(%rbx), %rdx
leaq 0x706b(%rip), %rsi      # 0xa352
jmp 0x2b37
leaq 0x717a(%rip), %rsi      # 0xa46d
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x3372
cmpl $0x1, %r14d
jle 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %r14
movl %ebp, %edi
xorl $0x1, %edi
callq 0x931f
movq %rax, %r15
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2460
movq %r14, %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x6167
cmpl $-0x1, %eax
jne 0x349b
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2460
leaq 0x7029(%rip), %rsi      # 0xa38d
movl $0x1, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x2590
leaq 0x7032(%rip), %rsi      # 0xa3ab
movq %r15, %rdi
callq 0x2450
testl %eax, %eax
jne 0x33bb
callq 0x34c1
testq %rax, %rax
je 0x2c2d
movq %rax, %rbx
leaq 0x7015(%rip), %rdi      # 0xa3b2
callq 0x24e0
movl 0x2c(%rbx), %esi
movl 0x30(%rbx), %edx
leaq 0x701f(%rip), %rdi      # 0xa3ce
xorl %eax, %eax
callq 0x2070
jmp 0x2cc5
leaq 0x75d8(%rip), %rdi      # 0xa99a
callq 0x24e0
movl $0x1, %edi
callq 0x23e0
movq %rax, %r12
movq 0x10(%r12), %rdi
movq %r14, %rsi
callq 0x2450
testl %eax, %eax
je 0x33f6
movq 0x28(%r12), %r12
testq %r12, %r12
jne 0x33d4
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x33fa
movl (%r12), %ebp
cmpl $-0x1, %ebp
jne 0x3413
leaq 0x6ecb(%rip), %rsi      # 0xa2d1
movl $0x1, %edi
movq %r14, %rdx
jmp 0x2b3c
movq 0x18(%rbx), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4f12
cmpl $-0x1, %eax
jne 0x3457
leaq 0x6eb6(%rip), %rsi      # 0xa2e4
movl $0x1, %edi
movq %rbx, %rdx
jmp 0x2b3c
movl %eax, %r12d
movl %ebp, %edi
xorl $0x1, %edi
callq 0x931f
cmpl $0x2, %r14d
jne 0x3478
leaq 0x6f16(%rip), %rsi      # 0xa36b
jmp 0x347c
movq %r15, %rdi
movl %eax, %esi
movl %ebp, %edx
callq 0x59d1
cmpl $-0x1, %eax
jne 0x2cc5
leaq 0x6e87(%rip), %rsi      # 0xa2fa
jmp 0x2c34
movq 0x10(%rbx), %rsi
movq %r15, %rdi
movq %rax, %rdx
movl %r12d, %ecx
callq 0x601d
cmpl $-0x1, %eax
jne 0x349b
leaq 0x6ee0(%rip), %rsi      # 0xa376
jmp 0x2c34
testl %ebp, %ebp
je 0x2cc5
jmp 0x3120