#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int get_character_size(unsigned char code) {
  size_t byte = 0;
  if ((code & 0x80) == 0x00)
    byte = 1;
  else if ((code & 0xE0) == 0xC0)
    byte = 2;
  else if ((code & 0xF0) == 0xE0)
    byte = 3;
  else if ((code & 0xF8) == 0xF0)
    byte = 4;
  else if ((code & 0xFC) == 0xF8)
    byte = 5;
  else if ((code & 0xFE) == 0xFC)
    byte = 6;
  else
    return -1;
  return byte;
}


x86 assembly (clang, -O0):
<get_character_size>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movq   $0x0,-0x10(%rbp)
movzbl -0x5(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    1131 <get_character_size+0x31>
movq   $0x1,-0x10(%rbp)
jmp    11fb <get_character_size+0xfb>
movzbl -0x5(%rbp),%eax
and    $0xe0,%eax
cmp    $0xc0,%eax
jne    1152 <get_character_size+0x52>
movq   $0x2,-0x10(%rbp)
jmp    11f6 <get_character_size+0xf6>
movzbl -0x5(%rbp),%eax
and    $0xf0,%eax
cmp    $0xe0,%eax
jne    1173 <get_character_size+0x73>
movq   $0x3,-0x10(%rbp)
jmp    11f1 <get_character_size+0xf1>
movzbl -0x5(%rbp),%eax
and    $0xf8,%eax
cmp    $0xf0,%eax
jne    1194 <get_character_size+0x94>
movq   $0x4,-0x10(%rbp)
jmp    11ec <get_character_size+0xec>
movzbl -0x5(%rbp),%eax
and    $0xfc,%eax
cmp    $0xf8,%eax
jne    11b5 <get_character_size+0xb5>
movq   $0x5,-0x10(%rbp)
jmp    11e7 <get_character_size+0xe7>
movzbl -0x5(%rbp),%eax
and    $0xfe,%eax
cmp    $0xfc,%eax
jne    11d6 <get_character_size+0xd6>
movq   $0x6,-0x10(%rbp)
jmp    11e2 <get_character_size+0xe2>
movl   $0xffffffff,-0x4(%rbp)
jmp    1202 <get_character_size+0x102>
jmp    11e7 <get_character_size+0xe7>
jmp    11ec <get_character_size+0xec>
jmp    11f1 <get_character_size+0xf1>
jmp    11f6 <get_character_size+0xf6>
jmp    11fb <get_character_size+0xfb>
mov    -0x10(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_character_size>:
mov    $0x1,%ecx
test   $0x80,%dil
je     1164 <get_character_size+0x64>
mov    %edi,%eax
and    $0xffffffe0,%eax
mov    $0x2,%ecx
cmp    $0xc0,%eax
je     1164 <get_character_size+0x64>
mov    %edi,%eax
and    $0xfffffff0,%eax
mov    $0x3,%ecx
cmp    $0xe0,%eax
je     1164 <get_character_size+0x64>
mov    %edi,%eax
and    $0xfffffff8,%eax
mov    $0x4,%ecx
cmp    $0xf0,%eax
je     1164 <get_character_size+0x64>
mov    %edi,%eax
and    $0xfffffffc,%eax
mov    $0x5,%ecx
cmp    $0xf8,%eax
je     1164 <get_character_size+0x64>
and    $0xfffffffe,%edi
mov    $0xffffffff,%eax
mov    $0x6,%ecx
cmp    $0xfc,%edi
jne    1166 <get_character_size+0x66>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @get_character_size(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i64
store i8 %0, i8* %3
store i64 0, i64* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = and i32 %6, 128
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i64 1, i64* %4
br label %46
10: ; preds = %1
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = and i32 %12, 224
%14 = icmp eq i32 %13, 192
br i1 %14, label %15, label %16
15: ; preds = %10
store i64 2, i64* %4
br label %45
16: ; preds = %10
%17 = load i8, i8* %3
%18 = zext i8 %17 to i32
%19 = and i32 %18, 240
%20 = icmp eq i32 %19, 224
br i1 %20, label %21, label %22
21: ; preds = %16
store i64 3, i64* %4
br label %44
22: ; preds = %16
%23 = load i8, i8* %3
%24 = zext i8 %23 to i32
%25 = and i32 %24, 248
%26 = icmp eq i32 %25, 240
br i1 %26, label %27, label %28
27: ; preds = %22
store i64 4, i64* %4
br label %43
28: ; preds = %22
%29 = load i8, i8* %3
%30 = zext i8 %29 to i32
%31 = and i32 %30, 252
%32 = icmp eq i32 %31, 248
br i1 %32, label %33, label %34
33: ; preds = %28
store i64 5, i64* %4
br label %42
34: ; preds = %28
%35 = load i8, i8* %3
%36 = zext i8 %35 to i32
%37 = and i32 %36, 254
%38 = icmp eq i32 %37, 252
br i1 %38, label %39, label %40
39: ; preds = %34
store i64 6, i64* %4
br label %41
40: ; preds = %34
store i32 -1, i32* %2
br label %49
41: ; preds = %39
br label %42
42: ; preds = %41, %33
br label %43
43: ; preds = %42, %27
br label %44
44: ; preds = %43, %21
br label %45
45: ; preds = %44, %15
br label %46
46: ; preds = %45, %9
%47 = load i64, i64* %4
%48 = trunc i64 %47 to i32
store i32 %48, i32* %2
br label %49
49: ; preds = %46, %40
%50 = load i32, i32* %2
ret i32 %50
}

LLVM IR (-O2):
define i32 @get_character_size(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 128
%4 = icmp eq i32 %3, 0
br i1 %4, label %20, label %5
5: ; preds = %1
%6 = and i32 %2, 224
%7 = icmp eq i32 %6, 192
br i1 %7, label %20, label %8
8: ; preds = %5
%9 = and i32 %2, 240
%10 = icmp eq i32 %9, 224
br i1 %10, label %20, label %11
11: ; preds = %8
%12 = and i32 %2, 248
%13 = icmp eq i32 %12, 240
br i1 %13, label %20, label %14
14: ; preds = %11
%15 = and i32 %2, 252
%16 = icmp eq i32 %15, 248
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = and i32 %2, 254
%19 = icmp eq i32 %18, 252
br i1 %19, label %20, label %22
20: ; preds = %17, %14, %11, %8, %5, %1
%21 = phi i32 [ 1, %1 ], [ 2, %5 ], [ 3, %8 ], [ 4, %11 ], [ 5, %14 ], [ 6, %17 ]
br label %22
22: ; preds = %17, %20
%23 = phi i32 [ %21, %20 ], [ -1, %17 ]
ret i32 %23
}