// File: /workspace/github_c_makefile_star2_O3/neosploit[P]compiler/libfort/lib/fort.c
// Function: utf8cwidth
int utf8cwidth(utf8_int32_t c)
{
    // TODO: add non printable characters check
    if (c == 0)
        return 0;

    if (c < 0x1100)
        return 1;

    // Fullwidth
    if ((0x3000 == c) ||
        (0xFF01 <= c && c <= 0xFF60) ||
        (0xFFE0 <= c && c <= 0xFFE6)) {
        return 2;
    }

    // Wide
    if ((0x1100 <= c && c <= 0x115F) ||
        (0x11A3 <= c && c <= 0x11A7) ||
        (0x11FA <= c && c <= 0x11FF) ||
        (0x2329 <= c && c <= 0x232A) ||
        (0x2E80 <= c && c <= 0x2E99) ||
        (0x2E9B <= c && c <= 0x2EF3) ||
        (0x2F00 <= c && c <= 0x2FD5) ||
        (0x2FF0 <= c && c <= 0x2FFB) ||
        (0x3001 <= c && c <= 0x303E) ||
        (0x3041 <= c && c <= 0x3096) ||
        (0x3099 <= c && c <= 0x30FF) ||
        (0x3105 <= c && c <= 0x312D) ||
        (0x3131 <= c && c <= 0x318E) ||
        (0x3190 <= c && c <= 0x31BA) ||
        (0x31C0 <= c && c <= 0x31E3) ||
        (0x31F0 <= c && c <= 0x321E) ||
        (0x3220 <= c && c <= 0x3247) ||
        (0x3250 <= c && c <= 0x32FE) ||
        (0x3300 <= c && c <= 0x4DBF) ||
        (0x4E00 <= c && c <= 0xA48C) ||
        (0xA490 <= c && c <= 0xA4C6) ||
        (0xA960 <= c && c <= 0xA97C) ||
        (0xAC00 <= c && c <= 0xD7A3) ||
        (0xD7B0 <= c && c <= 0xD7C6) ||
        (0xD7CB <= c && c <= 0xD7FB) ||
        (0xF900 <= c && c <= 0xFAFF) ||
        (0xFE10 <= c && c <= 0xFE19) ||
        (0xFE30 <= c && c <= 0xFE52) ||
        (0xFE54 <= c && c <= 0xFE66) ||
        (0xFE68 <= c && c <= 0xFE6B) ||
        (0x1B000 <= c && c <= 0x1B001) ||
        (0x1F200 <= c && c <= 0x1F202) ||
        (0x1F210 <= c && c <= 0x1F23A) ||
        (0x1F240 <= c && c <= 0x1F248) ||
        (0x1F250 <= c && c <= 0x1F251) ||
        (0x20000 <= c && c <= 0x2F73F) ||
        (0x2B740 <= c && c <= 0x2FFFD) ||
        (0x30000 <= c && c <= 0x3FFFD)) {
        return 2;
    }

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testl %edi, %edi
je 0xdde6
movl $0x1, %eax
cmpl $0x1100, %edi           # imm = 0x1100
jl 0xdde8
leal -0xff01(%rdi), %ecx
movl $0x2, %eax
cmpl $0x60, %ecx
jb 0xdde8
leal -0xffe0(%rdi), %ecx
cmpl $0x7, %ecx
jb 0xdde8
cmpl $0x3000, %edi           # imm = 0x3000
je 0xdde8
cmpl $0x1160, %edi           # imm = 0x1160
setb %al
leal -0x11a3(%rdi), %ecx
cmpl $0x5, %ecx
setb %cl
orb %al, %cl
leal -0x11fa(%rdi), %eax
cmpl $0x6, %eax
setb %al
leal -0x2329(%rdi), %edx
cmpl $0x2, %edx
setb %dl
orb %al, %dl
orb %cl, %dl
leal -0x2e80(%rdi), %eax
cmpl $0x1a, %eax
setb %al
leal -0x2e9b(%rdi), %ecx
cmpl $0x59, %ecx
setb %cl
orb %al, %cl
leal -0x2f00(%rdi), %eax
cmpl $0xd6, %eax
setb %al
orb %cl, %al
orb %dl, %al
leal -0x2ff0(%rdi), %ecx
cmpl $0xc, %ecx
setb %cl
leal -0x3001(%rdi), %edx
cmpl $0x3e, %edx
setb %dl
orb %cl, %dl
leal -0x3041(%rdi), %ecx
cmpl $0x56, %ecx
setb %sil
orb %dl, %sil
leal -0x3099(%rdi), %ecx
cmpl $0x67, %ecx
setb %cl
orb %sil, %cl
orb %al, %cl
leal -0x3105(%rdi), %eax
cmpl $0x29, %eax
setb %al
leal -0x3131(%rdi), %edx
cmpl $0x5e, %edx
setb %dl
orb %al, %dl
leal -0x3190(%rdi), %eax
cmpl $0x2b, %eax
setb %al
orb %dl, %al
leal -0x31c0(%rdi), %edx
cmpl $0x24, %edx
setb %dl
orb %al, %dl
leal -0x31f0(%rdi), %eax
cmpl $0x2f, %eax
setb %al
orb %dl, %al
orb %cl, %al
leal -0x3220(%rdi), %ecx
cmpl $0x28, %ecx
setb %cl
leal -0x3250(%rdi), %edx
cmpl $0xaf, %edx
setb %dl
orb %cl, %dl
leal -0x3300(%rdi), %ecx
cmpl $0x1ac0, %ecx           # imm = 0x1AC0
setb %cl
orb %dl, %cl
leal -0x4e00(%rdi), %edx
cmpl $0x568d, %edx           # imm = 0x568D
setb %dl
orb %cl, %dl
leal -0xa490(%rdi), %ecx
cmpl $0x37, %ecx
setb %sil
orb %dl, %sil
leal -0xa960(%rdi), %ecx
cmpl $0x1d, %ecx
setb %cl
orb %sil, %cl
orb %al, %cl
leal -0xac00(%rdi), %eax
cmpl $0x2ba4, %eax           # imm = 0x2BA4
setb %al
leal -0xd7b0(%rdi), %edx
cmpl $0x17, %edx
setb %dl
orb %al, %dl
leal -0xd7cb(%rdi), %eax
cmpl $0x31, %eax
setb %al
orb %dl, %al
leal -0xf900(%rdi), %edx
cmpl $0x200, %edx            # imm = 0x200
setb %dl
orb %al, %dl
leal -0xfe10(%rdi), %eax
cmpl $0xa, %eax
setb %al
orb %dl, %al
leal -0xfe30(%rdi), %edx
cmpl $0x23, %edx
setb %dl
orb %al, %dl
leal -0xfe54(%rdi), %eax
cmpl $0x13, %eax
setb %al
orb %dl, %al
orb %cl, %al
movl %edi, %ecx
andl $0x7ffffffc, %ecx       # imm = 0x7FFFFFFC
cmpl $0xfe68, %ecx           # imm = 0xFE68
sete %cl
movl %edi, %edx
andl $0x7ffffffe, %edx       # imm = 0x7FFFFFFE
cmpl $0x1b000, %edx          # imm = 0x1B000
sete %sil
orb %cl, %sil
leal -0x1f200(%rdi), %ecx
cmpl $0x3, %ecx
setb %cl
orb %sil, %cl
leal -0x1f210(%rdi), %esi
cmpl $0x2b, %esi
setb %sil
orb %cl, %sil
leal -0x1f240(%rdi), %ecx
cmpl $0x9, %ecx
setb %cl
orb %sil, %cl
cmpl $0x1f250, %edx          # imm = 0x1F250
sete %dl
orb %cl, %dl
leal -0x20000(%rdi), %ecx
cmpl $0xf740, %ecx           # imm = 0xF740
setb %cl
orb %dl, %cl
leal -0x2b740(%rdi), %edx
cmpl $0x48be, %edx           # imm = 0x48BE
setb %dl
orb %cl, %dl
orb %al, %dl
addl $0xfffd0000, %edi       # imm = 0xFFFD0000
cmpl $0xfffe, %edi           # imm = 0xFFFE
setb %al
orb %dl, %al
movzbl %al, %eax
andl $0x1, %eax
incl %eax
jmp 0xdde8
xorl %eax, %eax
popq %rbp
retq