// File: /workspace/github_c_makefile_star2_O3/NedFreed[P]msglint/msglint.c
// Function: wordwrap
static void wordwrap(const char *str, int len, int indent,
		     int *ppos, char *wbuf, int buflen, int *bufused)
{
    char *wptr = wbuf + *bufused;
    char *wend = wbuf + buflen - 1;
    const char *end = str + len;
    int pos = *ppos;

    /* loop over words */
    do {
	/* copy word to buffer */
	if (str != NULL) {
	    while (str < end && !isspace(*str) && wptr < wend) {
		*wptr = *str;
		++wptr, ++str;
	    }
	    if (str == end) break;
	}
	
	/* check if we need to word wrap
	 *  word wrap at 78 chars unless at beginning of line,
	 *  word wouldn't fit on new line or we're on the last word and it
	 *  will barely squeeze in under 80 columns
	 */
	if (pos > indent && wptr - wbuf + pos >= 78 &&
	    wptr - wbuf + indent < 80 &&
	    (str != NULL || wptr - wbuf + pos > 79)) {
	    fprintf(outfile, NEWLINE);
	    fprintf(outfile, "%.*s", indent, pad_str);
	    pos = indent;
	}
	pos += wptr - wbuf;

	/* deal with spaces */
	if (str != NULL) {
	    while (str < end && isspace(*str) && wptr < wend && pos < 78) {
		*wptr = *str;
		if (*str == '\n') {
		    pos = 78;
		    ++str;
		} else {
		    ++wptr, ++str, ++pos;
		}
	    }
	    while (str < end && isspace(*str)) ++str;
	}

	/* print it */
	*wptr = '\0';
	fprintf(outfile, "%s", wbuf);
	wptr = wbuf;

	/* check for end case */
	if (str == NULL) {
	    fprintf(outfile, NEWLINE);
	    break;
	}
    } while (str < end);
	
    /* set results */
    *ppos = pos;
    *bufused = wptr - wbuf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r14
movq %rdi, %r13
movq %r9, 0x18(%rsp)
movslq (%r9), %rbp
movslq %esi, %r12
addq %rdi, %r12
movq %rcx, 0x10(%rsp)
movl (%rcx), %ebx
movl %edx, 0xc(%rsp)
movslq %edx, %rax
movl $0x50, %ecx
subq %rax, %rcx
movq %rcx, 0x20(%rsp)
testq %r13, %r13
je 0x3a45
cmpq %r12, %r13
jae 0x3a37
callq 0x2200
movq (%rax), %rdx
movsbq (%r13), %rcx
testb $0x20, 0x1(%rdx,%rcx,2)
jne 0x3a37
cmpq $0xfe, %rbp
jg 0x3a37
movb %cl, (%r14,%rbp)
incq %rbp
incq %r13
cmpq %r12, %r13
jb 0x3a10
leaq (%r14,%rbp), %rax
cmpq %r12, %r13
jne 0x3a48
jmp 0x3b60
xorl %r13d, %r13d
leaq (%r14,%rbp), %r15
cmpl 0xc(%rsp), %ebx
jle 0x3aaa
movslq %ebx, %rax
addq %rbp, %rax
cmpq $0x4e, %rax
jl 0x3aaa
cmpq 0x20(%rsp), %rbp
jge 0x3aaa
testq %r13, %r13
jne 0x3a77
cmpq $0x4f, %rax
ja 0x3a77
addl %ebp, %ebx
jmp 0x3b21
movq 0xe07a(%rip), %rsi      # 0x11af8
movl $0xa, %edi
callq 0x2100
movq 0xe069(%rip), %rdi      # 0x11af8
leaq 0xb4e6(%rip), %rsi      # 0xef7c
movl 0xc(%rsp), %ebx
movl %ebx, %edx
leaq 0x832d(%rip), %rcx      # 0xbdd0
xorl %eax, %eax
callq 0x2120
addl %ebp, %ebx
testq %r13, %r13
je 0x3b21
cmpq %r12, %r13
jae 0x3afe
callq 0x2200
movq (%rax), %rdx
movsbq (%r13), %rcx
testb $0x20, 0x1(%rdx,%rcx,2)
je 0x3afe
cmpq $0xfe, %rbp
jg 0x3afe
cmpl $0x4d, %ebx
jg 0x3afe
movb %cl, (%r15)
incl %ebx
xorl %ecx, %ecx
cmpb $0xa, (%r13)
setne %cl
movl $0x4e, %edx
cmovel %edx, %ebx
addq %rcx, %rbp
incq %r13
leaq (%r14,%rbp), %r15
cmpq %r12, %r13
jb 0x3abb
cmpq %r12, %r13
jae 0x3b24
callq 0x2200
movq (%rax), %rax
movsbq (%r13), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x3b24
incq %r13
cmpq %r12, %r13
jb 0x3b0b
jmp 0x3b24
xorl %r13d, %r13d
movb $0x0, (%r15)
movq 0xdfc9(%rip), %rsi      # 0x11af8
movq %r14, %rdi
callq 0x20e0
testq %r13, %r13
je 0x3b4c
movl $0x0, %ebp
cmpq %r12, %r13
jb 0x3a01
jmp 0x3b5d
movq 0xdfa5(%rip), %rsi      # 0x11af8
movl $0xa, %edi
callq 0x2100
movq %r14, %rax
movq 0x10(%rsp), %rcx
movl %ebx, (%rcx)
subl %r14d, %eax
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq