#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 */
size_t id_hyper_length(char ch) {
  size_t bytes_number;
  if ((ch & 0x80) == 0)
    bytes_number = 1;
  else if ((ch & 0xe0) == 0xc0)
    bytes_number = 2;
  else if ((ch & 0xf0) == 0xe0)
    bytes_number = 3;
  else if ((ch & 0xf8) == 0xf0)
    bytes_number = 4;
  else if ((ch & 0xfc) == 0xf8)
    bytes_number = 5;
  else if ((ch & 0xfe) == 0xfc)
    bytes_number = 6;
  else
    bytes_number = 0;
  return bytes_number;
}


x86 assembly (clang, -O0):
<id_hyper_length>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    1129 <id_hyper_length+0x29>
movq   $0x1,-0x10(%rbp)
jmp    11ef <id_hyper_length+0xef>
movsbl -0x1(%rbp),%eax
and    $0xe0,%eax
cmp    $0xc0,%eax
jne    114a <id_hyper_length+0x4a>
movq   $0x2,-0x10(%rbp)
jmp    11ea <id_hyper_length+0xea>
movsbl -0x1(%rbp),%eax
and    $0xf0,%eax
cmp    $0xe0,%eax
jne    116b <id_hyper_length+0x6b>
movq   $0x3,-0x10(%rbp)
jmp    11e5 <id_hyper_length+0xe5>
movsbl -0x1(%rbp),%eax
and    $0xf8,%eax
cmp    $0xf0,%eax
jne    118c <id_hyper_length+0x8c>
movq   $0x4,-0x10(%rbp)
jmp    11e0 <id_hyper_length+0xe0>
movsbl -0x1(%rbp),%eax
and    $0xfc,%eax
cmp    $0xf8,%eax
jne    11ad <id_hyper_length+0xad>
movq   $0x5,-0x10(%rbp)
jmp    11db <id_hyper_length+0xdb>
movsbl -0x1(%rbp),%eax
and    $0xfe,%eax
cmp    $0xfc,%eax
jne    11ce <id_hyper_length+0xce>
movq   $0x6,-0x10(%rbp)
jmp    11d6 <id_hyper_length+0xd6>
movq   $0x0,-0x10(%rbp)
jmp    11db <id_hyper_length+0xdb>
jmp    11e0 <id_hyper_length+0xe0>
jmp    11e5 <id_hyper_length+0xe5>
jmp    11ea <id_hyper_length+0xea>
jmp    11ef <id_hyper_length+0xef>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<id_hyper_length>:
mov    $0x1,%eax
test   $0x80,%dil
je     116b <id_hyper_length+0x6b>
movzbl %dil,%ecx
mov    %ecx,%edx
and    $0xffffffe0,%edx
mov    $0x2,%eax
cmp    $0xc0,%edx
je     116b <id_hyper_length+0x6b>
mov    %ecx,%edx
and    $0xfffffff0,%edx
mov    $0x3,%eax
cmp    $0xe0,%edx
je     116b <id_hyper_length+0x6b>
mov    %ecx,%edx
and    $0xfffffff8,%edx
mov    $0x4,%eax
cmp    $0xf0,%edx
je     116b <id_hyper_length+0x6b>
mov    %ecx,%edx
and    $0xfffffffc,%edx
mov    $0x5,%eax
cmp    $0xf8,%edx
je     116b <id_hyper_length+0x6b>
and    $0xfffffffe,%ecx
xor    %edx,%edx
cmp    $0xfc,%ecx
mov    $0x6,%eax
cmovne %rdx,%rax
ret

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

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