// File: karel-brinda[P]ococo/ext/htslib/md5.c
// Function: hts_md5_final
void hts_md5_final(unsigned char *result, hts_md5_context *ctx)
{
	unsigned long used, available;

	used = ctx->lo & 0x3f;

	ctx->buffer[used++] = 0x80;

	available = 64 - used;

	if (available < 8) {
		memset(&ctx->buffer[used], 0, available);
		body(ctx, ctx->buffer, 64);
		used = 0;
		available = 64;
	}

	memset(&ctx->buffer[used], 0, available - 8);

	ctx->lo <<= 3;
	ctx->buffer[56] = ctx->lo;
	ctx->buffer[57] = ctx->lo >> 8;
	ctx->buffer[58] = ctx->lo >> 16;
	ctx->buffer[59] = ctx->lo >> 24;
	ctx->buffer[60] = ctx->hi;
	ctx->buffer[61] = ctx->hi >> 8;
	ctx->buffer[62] = ctx->hi >> 16;
	ctx->buffer[63] = ctx->hi >> 24;

	body(ctx, ctx->buffer, 64);

	result[0] = ctx->a;
	result[1] = ctx->a >> 8;
	result[2] = ctx->a >> 16;
	result[3] = ctx->a >> 24;
	result[4] = ctx->b;
	result[5] = ctx->b >> 8;
	result[6] = ctx->b >> 16;
	result[7] = ctx->b >> 24;
	result[8] = ctx->c;
	result[9] = ctx->c >> 8;
	result[10] = ctx->c >> 16;
	result[11] = ctx->c >> 24;
	result[12] = ctx->d;
	result[13] = ctx->d >> 8;
	result[14] = ctx->d >> 16;
	result[15] = ctx->d >> 24;

	memset(ctx, 0, sizeof(*ctx));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x3f, %eax
movl %eax, %eax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x18(%rbp)
movb $-0x80, 0x18(%rax,%rcx)
movl $0x40, %eax
subq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x8, -0x20(%rbp)
jae 0x6da48
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
addq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rdx
xorl %esi, %esi
callq 0x42d0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
movl $0x40, %edx
callq 0x6c990
movq $0x0, -0x18(%rbp)
movq $0x40, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
addq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rdx
subq $0x8, %rdx
xorl %esi, %esi
callq 0x42d0
movq -0x10(%rbp), %rax
movl (%rax), %ecx
shll $0x3, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x50(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x51(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x52(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x53(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x54(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x55(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x56(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x57(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
movl $0x40, %edx
callq 0x6c990
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x4(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x5(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x6(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x7(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x9(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0xa(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0xb(%rax)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0xc(%rax)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0xd(%rax)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0xe(%rax)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0xf(%rax)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x42d0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)