#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 */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
char ft_wchrbin(int /*<<< orphan*/);
char ft_wchrsize_utf8(wchar_t c) {
  char bin;
  bin = ft_wchrbin(c);
  if (bin <= (7))
    return (1);
  else if (bin <= (11))
    return (2);
  else if (bin <= (16))
    return (3);
  else if (bin <= (21))
    return (4);
  else
    return (-1);
}


x86 assembly (clang, -O0):
<ft_wchrsize_utf8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <ft_wchrbin@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x7,%eax
jg     113c <ft_wchrsize_utf8+0x2c>
movb   $0x1,-0x1(%rbp)
jmp    1182 <ft_wchrsize_utf8+0x72>
movsbl -0x9(%rbp),%eax
cmp    $0xb,%eax
jg     1152 <ft_wchrsize_utf8+0x42>
movb   $0x2,-0x1(%rbp)
jmp    1182 <ft_wchrsize_utf8+0x72>
movsbl -0x9(%rbp),%eax
cmp    $0x10,%eax
jg     1168 <ft_wchrsize_utf8+0x58>
movb   $0x3,-0x1(%rbp)
jmp    1182 <ft_wchrsize_utf8+0x72>
movsbl -0x9(%rbp),%eax
cmp    $0x15,%eax
jg     117e <ft_wchrsize_utf8+0x6e>
movb   $0x4,-0x1(%rbp)
jmp    1182 <ft_wchrsize_utf8+0x72>
movb   $0xff,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_wchrsize_utf8>:
push   %rax
call   1030 <ft_wchrbin@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x8,%cl
jl     113d <ft_wchrsize_utf8+0x2d>
mov    $0x2,%al
cmp    $0xc,%cl
jb     113d <ft_wchrsize_utf8+0x2d>
mov    $0x3,%al
cmp    $0x11,%cl
jb     113d <ft_wchrsize_utf8+0x2d>
cmp    $0x16,%cl
mov    $0x4,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @ft_wchrsize_utf8(i32 %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call signext i8 @ft_wchrbin(i32 %5)
store i8 %6, i8* %4
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 7
br i1 %9, label %10, label %11
10: ; preds = %1
store i8 1, i8* %2
br label %27
11: ; preds = %1
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
%14 = icmp sle i32 %13, 11
br i1 %14, label %15, label %16
15: ; preds = %11
store i8 2, i8* %2
br label %27
16: ; preds = %11
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 16
br i1 %19, label %20, label %21
20: ; preds = %16
store i8 3, i8* %2
br label %27
21: ; preds = %16
%22 = load i8, i8* %4
%23 = sext i8 %22 to i32
%24 = icmp sle i32 %23, 21
br i1 %24, label %25, label %26
25: ; preds = %21
store i8 4, i8* %2
br label %27
26: ; preds = %21
store i8 -1, i8* %2
br label %27
27: ; preds = %26, %25, %20, %15, %10
%28 = load i8, i8* %2
ret i8 %28
}

LLVM IR (-O2):
define signext i8 @ft_wchrsize_utf8(i32 %0) {
%2 = tail call signext i8 @ft_wchrbin(i32 %0)
%3 = icmp slt i8 %2, 8
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = icmp ult i8 %2, 12
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = icmp ult i8 %2, 17
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = icmp ult i8 %2, 22
%10 = select i1 %9, i8 4, i8 -1
br label %11
11: ; preds = %8, %6, %4, %1
%12 = phi i8 [ 1, %1 ], [ 2, %4 ], [ 3, %6 ], [ %10, %8 ]
ret i8 %12
}