// File: /workspace/github_c_makefile_star2_O1/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 0x5a61(%rip), %rsi      # 0xaea0
leaq 0x30(%rsp), %rdi
movl $0x10, %ecx
rep  movsq (%rsi), %es:(%rdi)
callq 0x2060
movl $0x0, (%rax)
leaq 0x4db1(%rip), %rsi      # 0xa20f
movq %r13, %rdi
callq 0x2450
testl %eax, %eax
je 0x549a
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4f12
cmpl $-0x1, %eax
je 0x5596
leaq 0x62fe(%rip), %rdx      # 0xb783
leaq 0x10(%rsp), %rdi
movl $0x18, %esi
movl %eax, %ecx
xorl %eax, %eax
callq 0x2530
jmp 0x54af
movups 0x5f93(%rip), %xmm0     # 0xb434
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %r12, %r12
je 0x54cc
movq %r12, %rdi
callq 0x9051
movq %rax, %r12
movq %rax, %r13
testq %rax, %rax
jne 0x54d6
jmp 0x55b1
leaq 0x665e(%rip), %r12      # 0xbb31
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x9051
testq %rax, %rax
je 0x55a9
movq %rax, %r15
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movq %r12, %rsi
movq %rax, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x99a1
movq %rax, %r12
movq %r13, %rdi
callq 0x23c0
movq %r15, %rdi
callq 0x23c0
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %r12, %r12
je 0x55b7
movq (%rbx), %rdi
movzwl 0x10(%rbx), %esi
callq 0x7828
testq %rax, %rax
je 0x55cb
movq %rax, %r15
movq 0x8(%rbx), %rdx
movq %r12, (%rsp)
leaq 0x4fb9(%rip), %rsi      # 0xa506
leaq 0x4eac(%rip), %r8       # 0xa400
xorl %r14d, %r14d
movq %rax, %rdi
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x83d9
movl %eax, %ebx
movq %r12, %rdi
callq 0x23c0
cmpl $-0x1, %ebx
je 0x55e5
cmpl $0x12e, %ebx            # imm = 0x12E
je 0x55eb
cmpl $0x191, %ebx            # imm = 0x191
jne 0x55d5
leaq 0x4e7d(%rip), %rdi      # 0xa40a
xorl %eax, %eax
callq 0x22d0
jmp 0x55e5
leaq 0x4c79(%rip), %rdi      # 0xa216
movq %r13, %rsi
xorl %eax, %eax
callq 0x22d0
jmp 0x55b1
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 0x55b7
leaq 0x50fb(%rip), %rdi      # 0xa6d7
movl %ebx, %esi
xorl %eax, %eax
callq 0x22d0
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq %r15, %rdi
callq 0x7a3f
jmp 0x55b7