// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce.c
// Function: ce_utf8_decode
CeRune_t ce_utf8_decode(const char* string, int64_t* bytes_consumed){
     CeRune_t rune = CE_UTF8_INVALID;

     // 0xxxxxxx is just ascii
     if((*string & 0x80) == 0){
          *bytes_consumed = 1;
          rune = string[0];
     // 110xxxxx is a 2 byte utf8 string
     }else if((*string & 0xE0) == 0xC0){
          *bytes_consumed = 2;
          rune = string[0] & 0x1F;
          rune <<= 6;
          rune |= string[1] & 0x3F;
     // 1110xxxx is a 3 byte utf8 string
     }else if((*string & 0xF0) == 0xE0){
          *bytes_consumed = 3;
          rune = string[0] & 0x0F;
          rune <<= 6;
          rune |= string[1] & 0x3F;
          rune <<= 6;
          rune |= string[2] & 0x3F;
     // 11110xxx is a 4 byte utf8 string
     }else if((*string & 0xF8) == 0xF0){
          *bytes_consumed = 4;
          rune = string[0] & 0x0F;
          rune <<= 6;
          rune |= string[1] & 0x3F;
          rune <<= 6;
          rune |= string[2] & 0x3F;
          rune <<= 6;
          rune |= string[3] & 0x3F;
     }

     return rune;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0xedfe
movq -0x10(%rbp), %rax
movq $0x1, (%rax)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x14(%rbp)
jmp 0xef28
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
andl $0xe0, %eax
cmpl $0xc0, %eax
jne 0xee48
movq -0x10(%rbp), %rax
movq $0x2, (%rax)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
andl $0x1f, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shll $0x6, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
andl $0x3f, %eax
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0xef26
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
andl $0xf0, %eax
cmpl $0xe0, %eax
jne 0xeea9
movq -0x10(%rbp), %rax
movq $0x3, (%rax)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
andl $0xf, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shll $0x6, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
andl $0x3f, %eax
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shll $0x6, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
andl $0x3f, %eax
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0xef24
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
andl $0xf8, %eax
cmpl $0xf0, %eax
jne 0xef22
movq -0x10(%rbp), %rax
movq $0x4, (%rax)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
andl $0xf, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shll $0x6, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
andl $0x3f, %eax
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shll $0x6, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
andl $0x3f, %eax
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shll $0x6, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x3(%rax), %eax
andl $0x3f, %eax
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0xef24
jmp 0xef26
jmp 0xef28
movl -0x14(%rbp), %eax
popq %rbp
retq
nopl (%rax)