// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/utils.c
// Function: hexdump
void hexdump(FILE *stream, uint8_t *data, int size, char *fmt, ...) {
	va_list args;
	int i, startaddr;
	char line_hexb[80]; // buffer for hex bytes
	char line_hexw[80]; // buffer for hex words
	char line_ascii[40]; // buffer for ASCII chars

	if (fmt && strlen(fmt)) {
		va_start(args, fmt);
		vfprintf(stream, fmt, args);
		fprintf(stream, "\n");
		va_end(args);
	}
	line_hexb[0] = 0; // clear output
	line_hexw[0] = 0;
	line_ascii[0] = 0;
	for (startaddr = i = 0; i < size; i++) {
		char buff[80];
		char c;
		if ((i % HEXDUMP_BYTESPERLINE) == 0 && i > 0) { // dump cur line
			hexdump_put(stream, startaddr, line_hexb, line_hexw, line_ascii);
			startaddr = i; // label for next line
		} else if ((i % 8) == 0 && i > 0) { // 8er col separator
			strcat(line_hexb, " ");
		}
		// append cur byte to hex and char display line
		sprintf(buff, "%02x", (unsigned) data[i]);
		if (strlen(line_hexb))
			strcat(line_hexb, " ");
		strcat(line_hexb, buff);
		if (i % 2) { // odd: mount word. LSB first
			unsigned w = data[i];
			w = (w << 8) | data[i - 1];
			if (strlen(line_hexw))
				strcat(line_hexw, " ");
			sprintf(buff, "%04x", w);
			strcat(line_hexw, buff);
		}

		c = data[i];
		if (c < 0x20 || c >= 0x7f)
			c = '.';
		sprintf(buff, "%c", c);
		strcat(line_ascii, buff);
	}    // dump rest of lines
	if (strlen(line_hexb))
		hexdump_put(stream, startaddr, line_hexb, line_hexw, line_ascii);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
testb %al, %al
je 0xdf87
movaps %xmm0, -0x200(%rbp)
movaps %xmm1, -0x1f0(%rbp)
movaps %xmm2, -0x1e0(%rbp)
movaps %xmm3, -0x1d0(%rbp)
movaps %xmm4, -0x1c0(%rbp)
movaps %xmm5, -0x1b0(%rbp)
movaps %xmm6, -0x1a0(%rbp)
movaps %xmm7, -0x190(%rbp)
movq %r9, -0x208(%rbp)
movq %r8, -0x210(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xe005
movq -0x20(%rbp), %rdi
callq 0x3190
cmpq $0x0, %rax
je 0xe005
leaq -0x40(%rbp), %rax
leaq -0x230(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x20, (%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x34e0
movq -0x8(%rbp), %rdi
leaq 0xe6c9(%rip), %rsi      # 0x1c6c3
movb $0x0, %al
callq 0x3300
leaq -0x40(%rbp), %rax
movb $0x0, -0xa0(%rbp)
movb $0x0, -0xf0(%rbp)
movb $0x0, -0x120(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xe1ff
movl -0x44(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0xe073
cmpl $0x0, -0x44(%rbp)
jle 0xe073
movq -0x8(%rbp), %rdi
movl -0x48(%rbp), %esi
leaq -0xa0(%rbp), %rdx
leaq -0xf0(%rbp), %rcx
leaq -0x120(%rbp), %r8
callq 0xe240
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0xe09e
movl -0x44(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0xe09c
cmpl $0x0, -0x44(%rbp)
jle 0xe09c
leaq -0xa0(%rbp), %rdi
leaq 0xf6cd(%rip), %rsi      # 0x1d764
callq 0x3500
jmp 0xe09e
leaq -0x170(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl (%rax,%rcx), %edx
leaq 0xe6ee(%rip), %rsi      # 0x1c7a6
movb $0x0, %al
callq 0x3520
leaq -0xa0(%rbp), %rdi
callq 0x3190
cmpq $0x0, %rax
je 0xe0e4
leaq -0xa0(%rbp), %rdi
leaq 0xf685(%rip), %rsi      # 0x1d764
callq 0x3500
leaq -0xa0(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x3500
movl -0x44(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0xe192
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x178(%rbp)
movl -0x178(%rbp), %eax
shll $0x8, %eax
movq -0x10(%rbp), %rcx
movl -0x44(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
orl %ecx, %eax
movl %eax, -0x178(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x3190
cmpq $0x0, %rax
je 0xe164
leaq -0xf0(%rbp), %rdi
leaq 0xf605(%rip), %rsi      # 0x1d764
callq 0x3500
leaq -0x170(%rbp), %rdi
movl -0x178(%rbp), %edx
leaq 0xe633(%rip), %rsi      # 0x1c7ab
movb $0x0, %al
callq 0x3520
leaq -0xf0(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x3500
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x171(%rbp)
movsbl -0x171(%rbp), %eax
cmpl $0x20, %eax
jl 0xe1bb
movsbl -0x171(%rbp), %eax
cmpl $0x7f, %eax
jl 0xe1c2
movb $0x2e, -0x171(%rbp)
leaq -0x170(%rbp), %rdi
movsbl -0x171(%rbp), %edx
leaq 0xe5d9(%rip), %rsi      # 0x1c7b0
movb $0x0, %al
callq 0x3520
leaq -0x120(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x3500
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xe028
leaq -0xa0(%rbp), %rdi
callq 0x3190
cmpq $0x0, %rax
je 0xe232
movq -0x8(%rbp), %rdi
movl -0x48(%rbp), %esi
leaq -0xa0(%rbp), %rdx
leaq -0xf0(%rbp), %rcx
leaq -0x120(%rbp), %r8
callq 0xe240
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopl (%rax,%rax)