// File: /workspace/github_c_makefile_star2_O0/tomka[P]cliaspora/cliaspora.c
// Function: read_stream
static int
read_stream(session_t *sp, const char *url)
{
	int	   status;
	char	   *p;
	ssl_conn_t *cp;
	json_node_t *node, *pstp;

	if ((cp = ssl_connect(sp->host, sp->port)) == NULL)
		return (-1);
	status = http_get(cp, url, sp->cookie,
	    "application/json, */*", 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);
	} else if (status != HTTP_OK) {
		warnx("Server replied with code %d", status);
		ssl_disconnect(cp); return (-1);
	}
	if ((node = new_json_node()) == NULL) {
		warnx("new_json_node()");
		ssl_disconnect(cp); return (-1);
	}
	while ((p = ssl_readln(cp)) != NULL && *p != '[')
		;
	if (p == NULL) {
		warnx("Unexpected server reply");
		ssl_disconnect(cp); return (-1);
	}
	if (parse_json(node, p) == NULL) {
		warnx("parse_json() failed");
		ssl_disconnect(cp); return (-1);
	}
	ssl_disconnect(cp);
	for (pstp = node->val; pstp != NULL; pstp = pstp->next)
		show_post(pstp->val);
	free_json_node(node);
	return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
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 0x3e6a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4015
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xab40(%rip), %rcx      # 0xe9c1
leaq 0xaab4(%rip), %r8       # 0xe93c
callq 0xb0a0
movl %eax, -0x1c(%rbp)
cmpl $0x191, -0x1c(%rbp)     # imm = 0x191
jne 0x3ebc
leaq 0xaaa6(%rip), %rdi      # 0xe946
movb $0x0, %al
callq 0x22f0
movq -0x30(%rbp), %rdi
callq 0xa220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4015
cmpl $-0x1, -0x1c(%rbp)
jne 0x3ed7
movq -0x30(%rbp), %rdi
callq 0xa220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4015
cmpl $0xc8, -0x1c(%rbp)
je 0x3f06
movl -0x1c(%rbp), %esi
leaq 0xad29(%rip), %rdi      # 0xec13
movb $0x0, %al
callq 0x22f0
movq -0x30(%rbp), %rdi
callq 0xa220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4015
jmp 0x3f08
jmp 0x3f0a
callq 0xb820
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x3f3c
leaq 0xac5a(%rip), %rdi      # 0xeb7a
movb $0x0, %al
callq 0x22f0
movq -0x30(%rbp), %rdi
callq 0xa220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4015
jmp 0x3f3e
movq -0x30(%rbp), %rdi
callq 0xa790
movq %rax, %rcx
movq %rcx, -0x28(%rbp)
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x41(%rbp)
je 0x3f69
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5b, %eax
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x3f72
jmp 0x3f74
jmp 0x3f3e
cmpq $0x0, -0x28(%rbp)
jne 0x3f9b
leaq 0xaa15(%rip), %rdi      # 0xe997
movb $0x0, %al
callq 0x22f0
movq -0x30(%rbp), %rdi
callq 0xa220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4015
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xb910
cmpq $0x0, %rax
jne 0x3fce
leaq 0xae11(%rip), %rdi      # 0xedc6
movb $0x0, %al
callq 0x22f0
movq -0x30(%rbp), %rdi
callq 0xa220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4015
movq -0x30(%rbp), %rdi
callq 0xa220
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x4005
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x7ef0
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x3fe3
movq -0x38(%rbp), %rdi
callq 0xb890
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop