// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-util.c
// Function: do_hexdump_row
static void do_hexdump_row(deark *c, struct hexdump_ctx *hctx)
{
	char offset_formatted[32];
	char linebuf[3*16+32];
	char asciibuf[64];
	int asciibufpos;
	int linebufpos;
	i64 k;

	linebufpos = 0;
	asciibufpos = 0;
	asciibuf[asciibufpos++] = '\"';
	for(k=0; k<hctx->bytesthisrow; k++) {
		u8 b;
		b = hctx->rowbuf[k];
		linebuf[linebufpos++] = de_get_hexchar(b/16);
		linebuf[linebufpos++] = de_get_hexchar(b%16);
		linebuf[linebufpos++] = ' ';
		if(b>=32 && b<=126) {
			asciibuf[asciibufpos++] = (char)b;
		}
		else {
			asciibuf[asciibufpos++] = '\x01'; // DE_CODEPOINT_HL
			asciibuf[asciibufpos++] = '.';
			// We'll often turn off highlighting only to turn it back on
			// again for the next character. The OFF+ON sequences will be
			// optimized out later, though, so there's no reason to worry
			// about that here.
			asciibuf[asciibufpos++] = '\x02'; // DE_CODEPOINT_UNHL
		}
	}

	// Pad and terminate the hex values
	while(linebufpos<48) {
		linebuf[linebufpos++] = ' ';
	}
	linebuf[linebufpos] = '\0';

	// Terminate or erase the ASCII representation
	if(hctx->flags&0x1) {
		asciibuf[asciibufpos++] = '\"';
		asciibuf[asciibufpos++] = '\0';
	}
	else {
		asciibuf[0] = '\0';
	}

	// Careful: With a variable format string, the compiler won't be able to
	// detect errors.
	de_snprintf(offset_formatted, sizeof(offset_formatted), hctx->offset_fmtstr,
		(i64)hctx->row_offset);

	de_snprintf(hctx->outbuf_sz, sizeof(hctx->outbuf_sz), "%s%s%s: %s%s",
		hctx->prefix, hctx->prefix_sep, offset_formatted, linebuf, asciibuf);
	hctx->printlinefn(c, hctx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0xc8(%rbp)
movl $0x0, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc4(%rbp)
cltq
movb $0x22, -0xc0(%rbp,%rax)
movq $0x0, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jge 0x15fc21
movq -0x10(%rbp), %rax
movq -0xd0(%rbp), %rcx
movb 0x50(%rax,%rcx), %al
movb %al, -0xd1(%rbp)
movzbl -0xd1(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, %edi
callq 0x160080
movb %al, %cl
movl -0xc8(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0xc8(%rbp)
cltq
movb %cl, -0x80(%rbp,%rax)
movzbl -0xd1(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %edx, %edi
callq 0x160080
movb %al, %cl
movl -0xc8(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0xc8(%rbp)
cltq
movb %cl, -0x80(%rbp,%rax)
movl -0xc8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc8(%rbp)
cltq
movb $0x20, -0x80(%rbp,%rax)
movzbl -0xd1(%rbp), %eax
cmpl $0x20, %eax
jl 0x15fbb7
movzbl -0xd1(%rbp), %eax
cmpl $0x7e, %eax
jg 0x15fbb7
movb -0xd1(%rbp), %cl
movl -0xc4(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0xc4(%rbp)
cltq
movb %cl, -0xc0(%rbp,%rax)
jmp 0x15fc08
movl -0xc4(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc4(%rbp)
cltq
movb $0x1, -0xc0(%rbp,%rax)
movl -0xc4(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc4(%rbp)
cltq
movb $0x2e, -0xc0(%rbp,%rax)
movl -0xc4(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc4(%rbp)
cltq
movb $0x2, -0xc0(%rbp,%rax)
jmp 0x15fc0a
movq -0xd0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd0(%rbp)
jmp 0x15fadd
jmp 0x15fc23
cmpl $0x30, -0xc8(%rbp)
jge 0x15fc46
movl -0xc8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc8(%rbp)
cltq
movb $0x20, -0x80(%rbp,%rax)
jmp 0x15fc23
movslq -0xc8(%rbp), %rax
movb $0x0, -0x80(%rbp,%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x15fc99
movl -0xc4(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc4(%rbp)
cltq
movb $0x22, -0xc0(%rbp,%rax)
movl -0xc4(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc4(%rbp)
cltq
movb $0x0, -0xc0(%rbp,%rax)
jmp 0x15fca0
movb $0x0, -0xc0(%rbp)
leaq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x20, %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
movl $0x20, %esi
movb $0x0, %al
callq 0x15a980
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %r8
leaq -0x30(%rbp), %r9
leaq -0x80(%rbp), %r10
leaq -0xc0(%rbp), %rax
movl $0xc8, %esi
leaq 0x7235b(%rip), %rdx     # 0x1d204d
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x15a980
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq *%rax
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax)