// File: /workspace/github_c_makefile_star2_O0/mloar[P]charset/utf8.c
// Function: write_utf8
int write_utf8(charset_spec const *charset, long int input_chr,
	       charset_state *state,
	       void (*emit)(void *ctx, long int output),
	       void *emitctx)
{
    UNUSEDARG(charset);
    UNUSEDARG(state);

    if (input_chr == -1)
	return TRUE;		       /* stateless; no cleanup required */

    /*
     * Refuse to output any illegal code points.
     */
    if (input_chr == 0xFFFE || input_chr == 0xFFFF ||
	(input_chr >= 0xD800 && input_chr < 0xE000)) {
	return FALSE;
    } else if (input_chr < 0x80) {     /* one-byte character */
	emit(emitctx, input_chr);
	return TRUE;
    } else if (input_chr < 0x800) {    /* two-byte character */
	emit(emitctx, 0xC0 | (0x1F & (input_chr >>  6)));
	emit(emitctx, 0x80 | (0x3F & (input_chr      )));
	return TRUE;
    } else if (input_chr < 0x10000) {  /* three-byte character */
	emit(emitctx, 0xE0 | (0x0F & (input_chr >> 12)));
	emit(emitctx, 0x80 | (0x3F & (input_chr >>  6)));
	emit(emitctx, 0x80 | (0x3F & (input_chr      )));
	return TRUE;
    } else if (input_chr < 0x200000) { /* four-byte character */
	emit(emitctx, 0xF0 | (0x07 & (input_chr >> 18)));
	emit(emitctx, 0x80 | (0x3F & (input_chr >> 12)));
	emit(emitctx, 0x80 | (0x3F & (input_chr >>  6)));
	emit(emitctx, 0x80 | (0x3F & (input_chr      )));
	return TRUE;
    } else if (input_chr < 0x4000000) {/* five-byte character */
	emit(emitctx, 0xF8 | (0x03 & (input_chr >> 24)));
	emit(emitctx, 0x80 | (0x3F & (input_chr >> 18)));
	emit(emitctx, 0x80 | (0x3F & (input_chr >> 12)));
	emit(emitctx, 0x80 | (0x3F & (input_chr >>  6)));
	emit(emitctx, 0x80 | (0x3F & (input_chr      )));
	return TRUE;
    } else {			       /* six-byte character */
	emit(emitctx, 0xFC | (0x01 & (input_chr >> 30)));
	emit(emitctx, 0x80 | (0x3F & (input_chr >> 24)));
	emit(emitctx, 0x80 | (0x3F & (input_chr >> 18)));
	emit(emitctx, 0x80 | (0x3F & (input_chr >> 12)));
	emit(emitctx, 0x80 | (0x3F & (input_chr >>  6)));
	emit(emitctx, 0x80 | (0x3F & (input_chr      )));
	return TRUE;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $-0x1, -0x18(%rbp)
jne 0xc53f
movl $0x1, -0x4(%rbp)
jmp 0xc82a
cmpq $0xfffe, -0x18(%rbp)    # imm = 0xFFFE
je 0xc567
cmpq $0xffff, -0x18(%rbp)    # imm = 0xFFFF
je 0xc567
cmpq $0xd800, -0x18(%rbp)    # imm = 0xD800
jl 0xc573
cmpq $0xe000, -0x18(%rbp)    # imm = 0xE000
jge 0xc573
movl $0x0, -0x4(%rbp)
jmp 0xc82a
cmpq $0x80, -0x18(%rbp)
jge 0xc597
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq *%rax
movl $0x1, -0x4(%rbp)
jmp 0xc82a
cmpq $0x800, -0x18(%rbp)     # imm = 0x800
jge 0xc5e3
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x6, %rsi
andq $0x1f, %rsi
orq $0xc0, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movl $0x1, -0x4(%rbp)
jmp 0xc82a
cmpq $0x10000, -0x18(%rbp)   # imm = 0x10000
jge 0xc64c
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0xc, %rsi
andq $0xf, %rsi
orq $0xe0, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x6, %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movl $0x1, -0x4(%rbp)
jmp 0xc82a
cmpq $0x200000, -0x18(%rbp)  # imm = 0x200000
jge 0xc6d2
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x12, %rsi
andq $0x7, %rsi
orq $0xf0, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0xc, %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x6, %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movl $0x1, -0x4(%rbp)
jmp 0xc82a
cmpq $0x4000000, -0x18(%rbp) # imm = 0x4000000
jge 0xc779
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x18, %rsi
andq $0x3, %rsi
orq $0xf8, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x12, %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0xc, %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x6, %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movl $0x1, -0x4(%rbp)
jmp 0xc82a
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x1e, %rsi
andq $0x1, %rsi
orq $0xfc, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x18, %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x12, %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0xc, %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
sarq $0x6, %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
andq $0x3f, %rsi
orq $0x80, %rsi
callq *%rax
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)