// File: /workspace/github_c_makefile_star2_O0/rakitzis[P]rc/glom.c
// Function: bqinput
static List *bqinput(List *ifs, int fd) {
	char *end, *bufend, *s;
	List *r, *top, *prev;
	size_t remain, bufsize;
	char isifs[256];
	int n, state; /* a simple FSA is used to read in data */

	memzero(isifs, sizeof isifs);
	for (isifs['\0'] = TRUE; ifs != NULL; ifs = ifs->n)
		for (s = ifs->w; *s != '\0'; s++)
			isifs[*(unsigned char *)s] = TRUE;
	remain = bufsize = BUFSIZE;
	top = r = nnew(List);
	r->w = end = nalloc(bufsize + 1);
	r->m = NULL;
	state = 0;
	prev = NULL;

	while (1) {
		if (remain == 0) { /* is the string bigger than the buffer? */
			size_t m = end - r->w;
			char *buf;
			while (bufsize < m + BUFSIZE)
				bufsize *= 2;
			buf = nalloc(bufsize + 1);
			memcpy(buf, r->w, m);
			r->w = buf;
			end = &buf[m];
			remain = bufsize - m;
		}
		if ((n = rc_read(fd, end, remain)) <= 0) {
			if (n == 0)
	/* break */		break;
			else if (errno == EINTR)
				return NULL; /* interrupted, wait for subproc */
			else {
				uerror("backquote read");
				rc_error(NULL);
			}
		}
		remain -= n;
		for (bufend = &end[n]; end < bufend; end++)
			if (state == 0) {
				if (!isifs[*(unsigned char *)end]) {
					state = 1;
					r->w = end;
					r->m = NULL;
				}
			} else {
				if (isifs[*(unsigned char *)end]) {
					state = 0;
					*end = '\0';
					prev = r;
					r = r->n = nnew(List);
					r->w = end+1;
					r->m = NULL;
				}
			}
	}
	if (state == 1) { /* terminate last string */
		*end = '\0';
		r->n = NULL;
	} else {
		if (prev == NULL) /* no input at all? */
			top = NULL;
		else
			prev->n = NULL; /* else terminate list */
	}
	return top;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
leaq -0x160(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x3150
movb $0x1, -0x160(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x91b7
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x91a7
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
movb $0x1, -0x160(%rbp,%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x917e
jmp 0x91a9
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x916c
movq $0x3e8, -0x58(%rbp)     # imm = 0x3E8
movq $0x3e8, -0x50(%rbp)     # imm = 0x3E8
movl $0x18, %edi
callq 0xd4c0
movq %rax, -0x38(%rbp)
movq %rax, -0x40(%rbp)
movq -0x58(%rbp), %rdi
addq $0x1, %rdi
callq 0xd4c0
movq %rax, %rcx
movq %rcx, -0x20(%rbp)
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x8(%rax)
movl $0x0, -0x168(%rbp)
movq $0x0, -0x48(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x92b3
movq -0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x170(%rbp)
movq -0x58(%rbp), %rax
movq -0x170(%rbp), %rcx
addq $0x3e8, %rcx            # imm = 0x3E8
cmpq %rcx, %rax
jae 0x9256
movq -0x58(%rbp), %rax
shlq %rax
movq %rax, -0x58(%rbp)
jmp 0x9232
movq -0x58(%rbp), %rdi
addq $0x1, %rdi
callq 0xd4c0
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq -0x170(%rbp), %rdx
callq 0x3220
movq -0x178(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x178(%rbp), %rax
addq -0x170(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x58(%rbp), %rax
subq -0x170(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x14(%rbp), %edi
movq -0x20(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x31b0
movl %eax, -0x164(%rbp)
cmpl $0x0, %eax
jg 0x930c
cmpl $0x0, -0x164(%rbp)
jne 0x92dc
jmp 0x93f0
callq 0x3040
cmpl $0x4, (%rax)
jne 0x92f3
movq $0x0, -0x8(%rbp)
jmp 0x9435
leaq 0xc5b0(%rip), %rdi      # 0x158aa
callq 0x11c10
xorl %eax, %eax
movl %eax, %edi
callq 0x50d0
jmp 0x930a
jmp 0x930c
movslq -0x164(%rbp), %rcx
movq -0x50(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movslq -0x164(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x93eb
cmpl $0x0, -0x168(%rbp)
jne 0x937b
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpb $0x0, -0x160(%rbp,%rax)
jne 0x9379
movl $0x1, -0x168(%rbp)
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x8(%rax)
jmp 0x93d8
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpb $0x0, -0x160(%rbp,%rax)
je 0x93d6
movl $0x0, -0x168(%rbp)
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x18, %edi
callq 0xd4c0
movq -0x38(%rbp), %rcx
movq %rax, 0x10(%rcx)
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rcx
addq $0x1, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x8(%rax)
jmp 0x93d8
jmp 0x93da
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x9330
jmp 0x9212
cmpl $0x1, -0x168(%rbp)
jne 0x940e
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x10(%rax)
jmp 0x942d
cmpq $0x0, -0x48(%rbp)
jne 0x941f
movq $0x0, -0x40(%rbp)
jmp 0x942b
movq -0x48(%rbp), %rax
movq $0x0, 0x10(%rax)
jmp 0x942d
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)