// File: /workspace/github_c_makefile_star2_O0/tomka[P]cliaspora/ssl.c
// Function: ssl_readln
char *
ssl_readln(ssl_conn_t *cp)
{
	int  i, n;
	char *p;
	
	if (cp->lnbuf == NULL) {
		if ((cp->lnbuf = malloc(_POSIX2_LINE_MAX)) == NULL)
			return (NULL);
		cp->bufsz = _POSIX2_LINE_MAX;
	}
	n = 0;
	do {
		cp->rd += n;
		if (cp->slen > 0) {
			for (i = 0; i < cp->rd - cp->slen; i++)
				cp->lnbuf[i] = cp->lnbuf[i + cp->slen];
		}
		cp->rd	-= cp->slen;
		cp->slen = 0;
		for (i = 0; i < cp->rd && cp->lnbuf[i] != '\n'; i++)
			;
		if (i < cp->rd && cp->lnbuf[i] == '\n') {
			if (i > 0 && cp->lnbuf[i - 1] == '\r')
				cp->lnbuf[i - 1] = '\0';
			cp->slen = i + 1;
			if (cp->slen >= cp->bufsz)
				cp->slen = cp->rd = 0;
			cp->lnbuf[i] = '\0';
			return (cp->lnbuf);
		}
		if (cp->rd >= cp->bufsz) {
			p = realloc(cp->lnbuf, cp->bufsz + _POSIX2_LINE_MAX);
			if (p == NULL)
				return (NULL);
			cp->lnbuf  = p;
			cp->bufsz += _POSIX2_LINE_MAX;
		}
	} while ((n = ssl_read(cp, 20, cp->lnbuf + cp->rd,
	    cp->bufsz - cp->rd)) > 0);
	if (cp->rd > 0) {
		cp->lnbuf[cp->rd] = '\0';
		cp->slen = cp->rd = 0;
		return (cp->lnbuf);
	}
	cp->slen = cp->rd = 0;

	return (NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xa7d6
movl $0x800, %edi            # imm = 0x800
callq 0x2430
movq -0x10(%rbp), %rcx
movq %rax, 0x20(%rcx)
cmpq $0x0, %rax
jne 0xa7cc
movq $0x0, -0x8(%rbp)
jmp 0xaa52
movq -0x10(%rbp), %rax
movl $0x800, (%rax)          # imm = 0x800
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jle 0xa844
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x4(%rcx), %ecx
movq -0x10(%rbp), %rdx
subl 0x8(%rdx), %ecx
cmpl %ecx, %eax
jge 0xa842
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rdx
addl 0x8(%rdx), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xa7fb
jmp 0xa844
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rdx
xorl %eax, %eax
cmpl 0x4(%rdx), %ecx
movb %al, -0x21(%rbp)
jge 0xa893
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0xa89c
jmp 0xa8a9
jmp 0xa89e
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xa869
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0xa95a
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0xa95a
cmpl $0x0, -0x14(%rbp)
jle 0xa907
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0xa907
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jl 0xa939
movq -0x10(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0xaa52
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jl 0xa9b6
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %eax
addl $0x800, %eax            # imm = 0x800
movslq %eax, %rsi
callq 0x2550
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xa99c
movq $0x0, -0x8(%rbp)
jmp 0xaa52
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x800, %ecx            # imm = 0x800
movl %ecx, (%rax)
jmp 0xa9b8
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x10(%rbp), %rax
movslq 0x4(%rax), %rax
addq %rax, %rdx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
subl 0x4(%rax), %ecx
movl $0x14, %esi
callq 0xa2b0
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jg 0xa7dd
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jle 0xaa34
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0xaa52
movq -0x10(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)