// File: /workspace/github_c_makefile_star2_O0/tomka[P]cliaspora/cliaspora.c
// Function: get_attributs
static int
get_attributs(session_t *sp)
{
	int	    status, n;
	char	    *p, *q;
	ssl_conn_t  *cp;	
	json_node_t *jnode, *jp;

	errno = 0;
	if ((cp = ssl_connect(sp->host, sp->port)) == NULL)
		return (-1);
	status = http_get(cp, "/stream", sp->cookie, "*/*", USER_AGENT);
	if (status == HTTP_UNAUTHORIZED) {
		warnx("You're not logged in. Please create a new session");
		ssl_disconnect(cp); return (-1);
	} else if (status == -1) {
		ssl_disconnect(cp); return (-1);
	}
	while ((p = ssl_readln(cp)) != NULL) {
		if ((q = strstr(p, "gon.user")) != NULL ||
		    (q = strstr(p, "window.current_user_attributes")) != NULL)
			break;
	}
	if (q == NULL) {
		warnx("Unexpected server reply"); ssl_disconnect(cp);
		return (-1);
	}
	p = q;
	if ((q = strchr(p, '=')) != NULL) {
		while (*q != '\0' && *q != '{')
			q++;
	}
	n = 0; p = q;
	do {
		if (*p == '{')
			n++;
		else if (*p == '}')
			n--;
		p++;
	} while (n > 0);
	*p = '\0';

	if ((jnode = new_json_node()) == NULL)
		return (-1);
	if (parse_json(jnode, q) == NULL) {
		free_json_node(jnode); return (-1);
	}
	ssl_disconnect(cp);

	free(sp->attr.name);
	free(sp->attr.did);
	free_aspects(sp->attr.aspects);

	sp->attr.aspects = get_aspects(jnode);

	if ((jp = find_json_node(jnode, "id")) != NULL)
		sp->attr.id = *(int *)jp->val;
	if ((jp = find_json_node(jnode, "guid")) != NULL)
		sp->attr.guid = *(int *)jp->val;
	if ((jp = find_json_node(jnode, "notifications_count")) != NULL)
		sp->attr.nc = *(int *)jp->val;
	if ((jp = find_json_node(jnode, "unread_messages_count")) != NULL)
		sp->attr.mc = *(int *)jp->val;
	if ((jp = find_json_node(jnode, "following_count")) != NULL)
		sp->attr.fc = *(int *)jp->val;
	if ((jp = find_json_node(jnode, "avatar")) != NULL) {
		if ((jp = find_json_node(jp, "medium")) != NULL) {
			sp->attr.avatar = strdup((char *)jp->val);
			if (sp->attr.avatar == NULL)
				return (-1);
		}
	}
	if ((jp = find_json_node(jnode, "name")) != NULL) {
		if ((sp->attr.name = strdup((char *)jp->val)) == NULL)
			return (-1);
	}
	if ((jp = find_json_node(jnode, "diaspora_id")) != NULL) {
		if ((sp->attr.did = strdup((char *)jp->val)) == NULL)
			return (-1);
	}
	free_json_node(jnode);

	return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
callq 0x2060
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movzwl 0x10(%rax), %esi
callq 0x9f10
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x76d1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ac1
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x6aef(%rip), %rsi      # 0xe1d3
leaq 0x72e8(%rip), %rcx      # 0xe9d3
leaq 0x724a(%rip), %r8       # 0xe93c
callq 0xb0a0
movl %eax, -0x14(%rbp)
cmpl $0x191, -0x14(%rbp)     # imm = 0x191
jne 0x7726
leaq 0x723c(%rip), %rdi      # 0xe946
movb $0x0, %al
callq 0x22f0
movq -0x30(%rbp), %rdi
callq 0xa220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ac1
cmpl $-0x1, -0x14(%rbp)
jne 0x7741
movq -0x30(%rbp), %rdi
callq 0xa220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ac1
jmp 0x7743
jmp 0x7745
movq -0x30(%rbp), %rdi
callq 0xa790
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x7790
movq -0x20(%rbp), %rdi
leaq 0x756e(%rip), %rsi      # 0xecd1
callq 0x20e0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x778c
movq -0x20(%rbp), %rdi
leaq 0x755d(%rip), %rsi      # 0xecda
callq 0x20e0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x778e
jmp 0x7790
jmp 0x7745
cmpq $0x0, -0x28(%rbp)
jne 0x77ba
leaq 0x71f9(%rip), %rdi      # 0xe997
movb $0x0, %al
callq 0x22f0
movq -0x30(%rbp), %rdi
callq 0xa220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ac1
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movl $0x3d, %esi
callq 0x2130
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x7816
jmp 0x77dc
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x41(%rbp)
je 0x77fd
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7b, %eax
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x7806
jmp 0x7814
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x77dc
jmp 0x7816
movl $0x0, -0x18(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7b, %eax
jne 0x783c
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x7853
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7d, %eax
jne 0x7851
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x7853
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, -0x18(%rbp)
jg 0x7825
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
callq 0xb820
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x7887
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ac1
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xb910
cmpq $0x0, %rax
jne 0x78af
movq -0x38(%rbp), %rdi
callq 0xb890
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ac1
movq -0x30(%rbp), %rdi
callq 0xa220
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x23d0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x23d0
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x7ad0
movq -0x38(%rbp), %rdi
callq 0x7b20
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x38(%rbp), %rdi
leaq 0x7445(%rip), %rsi      # 0xed43
callq 0xc430
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x791e
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x38(%rbp), %rdi
leaq 0x7276(%rip), %rsi      # 0xeb9f
callq 0xc430
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x7949
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x38(%rbp), %rdi
leaq 0x73a5(%rip), %rsi      # 0xecf9
callq 0xc430
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x7974
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x38(%rbp), %rdi
leaq 0x738e(%rip), %rsi      # 0xed0d
callq 0xc430
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x799f
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x38(%rbp), %rdi
leaq 0x7379(%rip), %rsi      # 0xed23
callq 0xc430
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x79ca
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x38(%rbp), %rdi
leaq 0x703c(%rip), %rsi      # 0xea11
callq 0xc430
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x7a31
movq -0x40(%rbp), %rdi
leaq 0x7344(%rip), %rsi      # 0xed33
callq 0xc430
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x7a2f
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2580
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0x7a2d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ac1
jmp 0x7a2f
jmp 0x7a31
movq -0x38(%rbp), %rdi
leaq 0x6fd0(%rip), %rsi      # 0xea0c
callq 0xc430
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x7a71
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2580
movq -0x10(%rbp), %rcx
movq %rax, 0x40(%rcx)
cmpq $0x0, %rax
jne 0x7a6f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ac1
jmp 0x7a71
movq -0x38(%rbp), %rdi
leaq 0x72be(%rip), %rsi      # 0xed3a
callq 0xc430
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x7ab1
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2580
movq -0x10(%rbp), %rcx
movq %rax, 0x48(%rcx)
cmpq $0x0, %rax
jne 0x7aaf
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7ac1
jmp 0x7ab1
movq -0x38(%rbp), %rdi
callq 0xb890
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)