// File: /workspace/github_c_makefile_star2_O3/tomka[P]cliaspora/cliaspora.c
// Function: dpoll
static int
dpoll(session_t *sp, const char *aspect, const char *msg, const char *question,
	const char *ansl)
{
	int	   aid, ret, status;
	char	   *rq, *mp, *qp, idstr[24];
	ssl_conn_t *cp;
	const char tmpl[] = "{\"status_message\":{\"text\":\"%s\","	      \
			    "\"provider_display_name\":\"cliaspora\"},"	      \
			    "\"aspect_ids\":\"%s\",\"poll_question\":\"%s\"," \
			    "\"poll_answers\":[%s]}";

	errno = 0;
	if (strcmp(aspect, "public") == 0)
		(void)strncpy(idstr, "public", sizeof(idstr));
	else if ((aid = get_aspect_id(sp, aspect)) == -1) {
                warnx("Unknown aspect '%s'", aspect); return (-1);
	} else
		(void)snprintf(idstr, sizeof(idstr), "%d", aid);
	if (msg != NULL) {
		if ((mp = json_escape_str(msg)) == NULL)
			return (-1);
	} else
		mp = NULL;
	if ((qp = json_escape_str(question)) == NULL) {
		free(mp); return (-1);
	}
	rq = strduprintf(tmpl, msg != NULL ? mp : "", idstr, qp, ansl);
	free(mp); free(qp);
	if (rq == NULL)
		return (-1);
	if ((cp = ssl_connect(sp->host, sp->port)) == NULL) {
		free(rq); return (-1);
	}
	status = http_post(cp, "/status_messages", sp->cookie, NULL,
	    USER_AGENT, HTTP_POST_TYPE_JSON, rq);
	free(rq);
	if (status == HTTP_UNAUTHORIZED) {
		warnx("You're not logged in. Please create a new session");
		ret = -1;
	} else if (status == HTTP_FOUND)
		ret = 0;
	else if (status == -1)
		ret = -1;
	else {
		warnx("Server replied with code %d", status);
		ret = -1;
	}
	ssl_disconnect(cp);
	return (ret);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb0, %rsp
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x5a9f(%rip), %rsi      # 0xae80
leaq 0x30(%rsp), %rdi
movl $0x10, %ecx
rep  movsq (%rsi), %es:(%rdi)
callq 0x2060
movl $0x0, (%rax)
leaq 0x4e0f(%rip), %rsi      # 0xa20f
movq %r13, %rdi
callq 0x2450
testl %eax, %eax
je 0x543c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4ec6
cmpl $-0x1, %eax
je 0x5538
leaq 0x633c(%rip), %rdx      # 0xb763
leaq 0x10(%rsp), %rdi
movl $0x18, %esi
movl %eax, %ecx
xorl %eax, %eax
callq 0x2530
jmp 0x5451
movups 0x5fd1(%rip), %xmm0     # 0xb414
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %r12, %r12
je 0x546e
movq %r12, %rdi
callq 0x8eb3
movq %rax, %r12
movq %rax, %r13
testq %rax, %rax
jne 0x5478
jmp 0x5553
leaq 0x66cc(%rip), %r12      # 0xbb41
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x8eb3
testq %rax, %rax
je 0x554b
movq %rax, %r15
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movq %r12, %rsi
movq %rax, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x9772
movq %rax, %r12
movq %r13, %rdi
callq 0x23c0
movq %r15, %rdi
callq 0x23c0
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %r12, %r12
je 0x5559
movq (%rbx), %rdi
movzwl 0x10(%rbx), %esi
callq 0x7710
testq %rax, %rax
je 0x556d
movq %rax, %r15
movq 0x8(%rbx), %rdx
movq %r12, (%rsp)
leaq 0x4ffb(%rip), %rsi      # 0xa4ea
leaq 0x4f0a(%rip), %r8       # 0xa400
xorl %r14d, %r14d
movq %rax, %rdi
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x8281
movl %eax, %ebx
movq %r12, %rdi
callq 0x23c0
cmpl $-0x1, %ebx
je 0x5587
cmpl $0x12e, %ebx            # imm = 0x12E
je 0x558d
cmpl $0x191, %ebx            # imm = 0x191
jne 0x5577
leaq 0x4edb(%rip), %rdi      # 0xa40a
xorl %eax, %eax
callq 0x22d0
jmp 0x5587
leaq 0x4cd7(%rip), %rdi      # 0xa216
movq %r13, %rsi
xorl %eax, %eax
callq 0x22d0
jmp 0x5553
movq %r13, %rdi
callq 0x23c0
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r12, %rdi
callq 0x23c0
jmp 0x5559
leaq 0x513d(%rip), %rdi      # 0xa6bb
movl %ebx, %esi
xorl %eax, %eax
callq 0x22d0
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq %r15, %rdi
callq 0x7921
jmp 0x5559