// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/xxdp.c
// Function: render_ufd
static void render_ufd(xxdp_filesystem_t *_this) {
	int file_idx ;
	unsigned n;
	// link blocks
	xxdp_blocklist_set(_this, _this->ufd_blocklist);
	//
	for (file_idx = 0; file_idx < _this->file_count; file_idx++) {
		char buff[80];
		xxdp_blocknr_t ufd_blknr = _this->radi.ufd_block_1 + (file_idx / XXDP_UFD_ENTRIES_PER_BLOCK);
		// word nr of cur entry in cur block. skip link word.
		int ufd_word_offset = 1 + (file_idx % XXDP_UFD_ENTRIES_PER_BLOCK) * XXDP_UFD_ENTRY_WORDCOUNT;
		xxdp_file_t *f = _this->file[file_idx];

		xxdp_blocklist_set(_this, &f->blocklist);

		// filename chars 0..2
		strncpy(buff, f->filnam, 3);
		buff[3] = 0;
		xxdp_image_set_word(_this, ufd_blknr, ufd_word_offset + 0, rad50_encode(buff));
		// filename chars 3..5
		if (strlen(f->filnam) < 4)
			buff[0] = 0;
		else
			strncpy(buff, f->filnam + 3, 3);
		buff[3] = 0;
		xxdp_image_set_word(_this, ufd_blknr, ufd_word_offset + 1, rad50_encode(buff));
		// ext
		xxdp_image_set_word(_this, ufd_blknr, ufd_word_offset + 2, rad50_encode(f->ext));

		xxdp_image_set_word(_this, ufd_blknr, ufd_word_offset + 3, dos11date_encode(f->date));

		xxdp_image_set_word(_this, ufd_blknr, ufd_word_offset + 4, 0); // ACT-11 logical end
		xxdp_image_set_word(_this, ufd_blknr, ufd_word_offset + 5, f->blocklist.blocknr[0]); // 1st block
		xxdp_image_set_word(_this, ufd_blknr, ufd_word_offset + 6, f->blocklist.count); // file length in blocks
		n = f->blocklist.blocknr[f->blocklist.count - 1];
		xxdp_image_set_word(_this, ufd_blknr, ufd_word_offset + 7, n); // last block
		xxdp_image_set_word(_this, ufd_blknr, ufd_word_offset + 8, 0); // ACT-11 logical 52
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rsi
callq 0x134b0
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xa8(%rcx), %eax
jge 0x11aa7
movq -0x8(%rbp), %rax
movzwl 0x2c(%rax), %eax
movl %eax, -0x84(%rbp)
movl -0xc(%rbp), %eax
movl $0x1c, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x84(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x62(%rbp)
movl -0xc(%rbp), %eax
movl $0x1c, %ecx
cltd
idivl %ecx
imull $0x9, %edx, %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0xb0(%rax,%rcx,8), %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x134b0
leaq -0x60(%rbp), %rdi
movq -0x70(%rbp), %rsi
addq $0x808, %rsi            # imm = 0x808
movl $0x3, %edx
callq 0x3090
movb $0x0, -0x5d(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movw -0x62(%rbp), %ax
movw %ax, -0x74(%rbp)
movl -0x68(%rbp), %eax
addl $0x0, %eax
movb %al, -0x71(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xdaa0
movq -0x80(%rbp), %rdi
movw -0x74(%rbp), %dx
movb -0x71(%rbp), %cl
movzwl %dx, %esi
movzbl %cl, %edx
movzwl %ax, %ecx
callq 0x13540
movq -0x70(%rbp), %rdi
addq $0x808, %rdi            # imm = 0x808
callq 0x3190
cmpq $0x4, %rax
jae 0x118ad
movb $0x0, -0x60(%rbp)
jmp 0x118ca
leaq -0x60(%rbp), %rdi
movq -0x70(%rbp), %rsi
addq $0x808, %rsi            # imm = 0x808
addq $0x3, %rsi
movl $0x3, %edx
callq 0x3090
movb $0x0, -0x5d(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movw -0x62(%rbp), %ax
movw %ax, -0xa4(%rbp)
movl -0x68(%rbp), %eax
addl $0x1, %eax
movb %al, -0xa1(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xdaa0
movq -0xb0(%rbp), %rdi
movw -0xa4(%rbp), %dx
movb -0xa1(%rbp), %cl
movzwl %dx, %esi
movzbl %cl, %edx
movzwl %ax, %ecx
callq 0x13540
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movw -0x62(%rbp), %ax
movw %ax, -0x94(%rbp)
movl -0x68(%rbp), %eax
addl $0x2, %eax
movb %al, -0x91(%rbp)
movq -0x70(%rbp), %rdi
addq $0x858, %rdi            # imm = 0x858
callq 0xdaa0
movq -0xa0(%rbp), %rdi
movw -0x94(%rbp), %dx
movb -0x91(%rbp), %cl
movzwl %dx, %esi
movzbl %cl, %edx
movzwl %ax, %ecx
callq 0x13540
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movw -0x62(%rbp), %ax
movw %ax, -0x88(%rbp)
movl -0x68(%rbp), %eax
addl $0x3, %eax
movb %al, -0x85(%rbp)
movq -0x70(%rbp), %rcx
addq $0x890, %rcx            # imm = 0x890
movq 0x30(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x30(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xde90
movq -0x90(%rbp), %rdi
movw -0x88(%rbp), %dx
movb -0x85(%rbp), %cl
movzwl %dx, %esi
movzbl %cl, %edx
movzwl %ax, %ecx
callq 0x13540
movq -0x8(%rbp), %rdi
movw -0x62(%rbp), %dx
movl -0x68(%rbp), %eax
addl $0x4, %eax
xorl %ecx, %ecx
movzwl %dx, %esi
movzbl %al, %edx
callq 0x13540
movq -0x8(%rbp), %rdi
movw -0x62(%rbp), %dx
movl -0x68(%rbp), %eax
addl $0x5, %eax
movb %al, %cl
movq -0x70(%rbp), %rax
movzwl %dx, %esi
movzbl %cl, %edx
movzwl 0x4(%rax), %ecx
callq 0x13540
movq -0x8(%rbp), %rdi
movw -0x62(%rbp), %dx
movl -0x68(%rbp), %eax
addl $0x6, %eax
movb %al, %cl
movq -0x70(%rbp), %rax
movl (%rax), %eax
movzwl %dx, %esi
movzbl %cl, %edx
movzwl %ax, %ecx
callq 0x13540
movq -0x70(%rbp), %rax
movq -0x70(%rbp), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movzwl 0x4(%rax,%rcx,2), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movw -0x62(%rbp), %dx
movl -0x68(%rbp), %eax
addl $0x7, %eax
movb %al, %cl
movl -0x10(%rbp), %eax
movzwl %dx, %esi
movzbl %cl, %edx
movzwl %ax, %ecx
callq 0x13540
movq -0x8(%rbp), %rdi
movw -0x62(%rbp), %dx
movl -0x68(%rbp), %eax
addl $0x8, %eax
xorl %ecx, %ecx
movzwl %dx, %esi
movzbl %al, %edx
callq 0x13540
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x117ca
addq $0xf0, %rsp
popq %rbp
retq