// File: /workspace/github_c_makefile_star2_O0/ksherlock[P]nroff_man/render.c
// Function: flush
void flush(unsigned justify) {
	unsigned i;
	int padding;
	int holes;


	/* removing trailing whitespace. */
	i = buffer_offset;
	if (!i) return;
	while (i) {
		uint_fast8_t c;
		c = buffer[i-1];
		if (c == ' ' || c == XSPACE ){ --i; --buffer_width; }
		else break;
	}
	if (!i) goto exit;
	buffer[i] = 0;


	buffer_flip_flop = !buffer_flip_flop;
	padding = width - buffer_width;
	holes = buffer_words - 1;
	if (padding <= 0 || holes <= 0) justify = 0;


	if (na || ad == 'l') {
		print(buffer, 0);
		goto exit;
	}
	if (ad == 'r') {
		while(padding--) fputc(' ', stdout);
		print(buffer, 0);
		goto exit;
	}
	if (ad == 'c') {
		/* if (buffer_flip_flop) ++padding; */
		padding >>= 1;
		while(padding--) fputc(' ', stdout);
		print(buffer, 0);
		goto exit;
	}

	/* indent. */
	indent();
	padding += holes;

	for (i = 0; ; ++i) {
		uint_fast8_t c = buffer[i];
		if (c == 0) break;
		switch(c) {
			case XSPACE:
				if (justify) {
					int j;
					int fudge;
					/* taken from rosenkrantz nroff
					 * which was taken from Software Tools
					 * which was taken from Doug McIlroy's BCPL roff.
					 */
					if (buffer_flip_flop) 
						fudge = padding / holes;
					else
						fudge = (padding - 1) / holes + 1;

					padding -= fudge;
					holes -= 1;
					for (j = 0; j < fudge; ++j) fputc(' ', stdout);


				} else fputc(' ', stdout);
				break;

			case FONT_R: case FONT_B: case FONT_I: case FONT_P: case FONT_X:
				set_font(c);
				break;
			case HYPHEN: case ZWSPACE: break;
			case NBSPACE: fputc(' ', stdout); break;
			default:
				if (flags.T == FMT_ASCII) {
					if (ft == FONT_B) {
						fputc(c, stdout);
						fputc(8, stdout);
					}
					if (ft == FONT_I) {
						fputs("_\x08", stdout);
					}
				}
				fputc(c, stdout);
				break;
		}
	}


exit:
	fputc('\n', stdout); ++line;

	buffer_width = 0;
	buffer_offset = 0;
	buffer_words = 0;
	buffer[0] = 0;
	return;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl 0x92b7(%rip), %eax      # 0x12918
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jne 0x966f
jmp 0x99cf
jmp 0x9671
cmpl $0x0, -0x8(%rbp)
je 0x96c0
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x9298(%rip), %rax      # 0x12920
movb (%rax,%rcx), %al
movb %al, -0x11(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x20, %eax
je 0x96a2
movzbl -0x11(%rbp), %eax
cmpl $0x81, %eax
jne 0x96bc
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
movl 0x9263(%rip), %eax      # 0x12914
addl $-0x1, %eax
movl %eax, 0x925a(%rip)      # 0x12914
jmp 0x96be
jmp 0x96c0
jmp 0x9671
cmpl $0x0, -0x8(%rbp)
jne 0x96cb
jmp 0x9981
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x9249(%rip), %rax      # 0x12920
movb $0x0, (%rax,%rcx)
cmpl $0x0, 0x922e(%rip)      # 0x12910
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x921e(%rip)      # 0x12910
leaq 0x4c3b(%rip), %rax      # 0xe334
movl (%rax), %eax
subl 0x9213(%rip), %eax      # 0x12914
movl %eax, -0xc(%rbp)
movl 0x9212(%rip), %eax      # 0x1291c
subl $0x1, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0xc(%rbp)
jle 0x971c
cmpl $0x0, -0x10(%rbp)
jg 0x9723
movl $0x0, -0x4(%rbp)
leaq 0x6b9a(%rip), %rax      # 0x102c4
cmpl $0x0, (%rax)
jne 0x973b
leaq 0x4bde(%rip), %rax      # 0xe314
cmpl $0x6c, (%rax)
jne 0x974e
leaq 0x91de(%rip), %rdi      # 0x12920
xorl %esi, %esi
callq 0x8de0
jmp 0x9981
leaq 0x4bbf(%rip), %rax      # 0xe314
cmpl $0x72, (%rax)
jne 0x9795
jmp 0x975c
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xc(%rbp)
cmpl $0x0, %eax
je 0x9782
movq 0x484d(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
movl $0x20, %edi
callq 0x40e0
jmp 0x975c
leaq 0x9197(%rip), %rdi      # 0x12920
xorl %esi, %esi
callq 0x8de0
jmp 0x9981
leaq 0x4b78(%rip), %rax      # 0xe314
cmpl $0x63, (%rax)
jne 0x97e2
movl -0xc(%rbp), %eax
sarl %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xc(%rbp)
cmpl $0x0, %eax
je 0x97cf
movq 0x4800(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
movl $0x20, %edi
callq 0x40e0
jmp 0x97a9
leaq 0x914a(%rip), %rdi      # 0x12920
xorl %esi, %esi
callq 0x8de0
jmp 0x9981
callq 0x8fa0
movl -0x10(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x911d(%rip), %rax      # 0x12920
movb (%rax,%rcx), %al
movb %al, -0x12(%rbp)
movzbl -0x12(%rbp), %eax
cmpl $0x0, %eax
jne 0x9817
jmp 0x997f
movzbl -0x12(%rbp), %eax
addl $-0x80, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x8, %eax
ja 0x98f2
movq -0x28(%rbp), %rax
leaq 0x2bb4(%rip), %rcx      # 0xc3ec
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, -0x4(%rbp)
je 0x98b0
cmpl $0x0, 0x90c2(%rip)      # 0x12910
je 0x985c
movl -0xc(%rbp), %eax
cltd
idivl -0x10(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x986c
movl -0xc(%rbp), %eax
subl $0x1, %eax
cltd
idivl -0x10(%rbp)
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
movl -0xc(%rbp), %eax
subl %ecx, %eax
movl %eax, -0xc(%rbp)
movl -0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x98ae
movq 0x472a(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
movl $0x20, %edi
callq 0x40e0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x9887
jmp 0x98c4
movq 0x4709(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
movl $0x20, %edi
callq 0x40e0
jmp 0x996f
movzbl -0x12(%rbp), %edi
callq 0x8a00
jmp 0x996f
jmp 0x996f
movq 0x46dd(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
movl $0x20, %edi
callq 0x40e0
jmp 0x996f
leaq 0x69df(%rip), %rax      # 0x102d8
cmpl $0x1, 0x20(%rax)
jne 0x995c
leaq 0x4a1a(%rip), %rax      # 0xe320
cmpl $0x84, (%rax)
jne 0x9935
movzbl -0x12(%rbp), %edi
movq 0x46a7(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
callq 0x40e0
movq 0x4698(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
movl $0x8, %edi
callq 0x40e0
leaq 0x49e4(%rip), %rax      # 0xe320
cmpl $0x85, (%rax)
jne 0x995a
movq 0x4675(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
leaq 0x2abb(%rip), %rdi      # 0xc410
callq 0x40c0
jmp 0x995c
movzbl -0x12(%rbp), %edi
movq 0x4659(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
callq 0x40e0
jmp 0x9971
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x97f7
jmp 0x9981
movq 0x4638(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
movl $0xa, %edi
callq 0x40e0
leaq 0x499c(%rip), %rax      # 0xe338
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x4990(%rip), %rax      # 0xe338
movl %ecx, (%rax)
movl $0x0, 0x8f60(%rip)      # 0x12914
movl $0x0, 0x8f5a(%rip)      # 0x12918
movl $0x0, 0x8f54(%rip)      # 0x1291c
movb $0x0, 0x8f51(%rip)      # 0x12920
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)