#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void fit_quote_size(const uint8_t quote_size,
                    uint8_t *restrict quote_tablet_size) {
  assert(quote_tablet_size != NULL);
  assert(quote_size > 0);
  assert(quote_size < 16);
  if (quote_size == 1) {
    *quote_tablet_size = 0x0;
  } else if (quote_size == 2) {
    *quote_tablet_size = 0x1;
  } else if (quote_size > 2 && quote_size <= 4) {
    *quote_tablet_size = 0x2;
  } else if (quote_size > 4 && quote_size <= 8) {
    *quote_tablet_size = 0x4;
  } else if (quote_size > 8 && quote_size <= 16) {
    *quote_tablet_size = 0x8;
  }
}


x86 assembly (clang, -O0):
<fit_quote_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x10,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x1,-0x4(%rbp)
jne    116c <fit_quote_size+0x5c>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    11fd <fit_quote_size+0xed>
cmpl   $0x2,-0x4(%rbp)
jne    1185 <fit_quote_size+0x75>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    11f8 <fit_quote_size+0xe8>
cmpl   $0x2,-0x4(%rbp)
jle    11a8 <fit_quote_size+0x98>
cmpl   $0x4,-0x4(%rbp)
jg     11a8 <fit_quote_size+0x98>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
jmp    11f3 <fit_quote_size+0xe3>
cmpl   $0x4,-0x4(%rbp)
jle    11cb <fit_quote_size+0xbb>
cmpl   $0x8,-0x4(%rbp)
jg     11cb <fit_quote_size+0xbb>
mov    -0x10(%rbp),%rax
movl   $0x4,(%rax)
jmp    11ee <fit_quote_size+0xde>
cmpl   $0x8,-0x4(%rbp)
jle    11e9 <fit_quote_size+0xd9>
cmpl   $0x10,-0x4(%rbp)
jg     11e9 <fit_quote_size+0xd9>
mov    -0x10(%rbp),%rax
movl   $0x8,(%rax)
jmp    11ee <fit_quote_size+0xde>
jmp    11f3 <fit_quote_size+0xe3>
jmp    11f8 <fit_quote_size+0xe8>
jmp    11fd <fit_quote_size+0xed>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fit_quote_size>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %ebx,%ebx
setg   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmp    $0x10,%ebx
setl   %dil
call   1030 <assert@plt>
cmp    $0x1,%ebx
je     1153 <fit_quote_size+0x43>
cmp    $0x2,%ebx
jne    1157 <fit_quote_size+0x47>
mov    $0x1,%eax
jmp    117e <fit_quote_size+0x6e>
xor    %eax,%eax
jmp    117e <fit_quote_size+0x6e>
lea    -0x3(%rbx),%ecx
mov    $0x2,%eax
cmp    $0x2,%ecx
jb     117e <fit_quote_size+0x6e>
lea    -0x5(%rbx),%ecx
mov    $0x4,%eax
cmp    $0x4,%ecx
jb     117e <fit_quote_size+0x6e>
add    $0xfffffff7,%ebx
mov    $0x8,%eax
cmp    $0x7,%ebx
ja     1181 <fit_quote_size+0x71>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @fit_quote_size(i32 %0, i32* noalias %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = icmp ne i32* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 16
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = load i32*, i32** %4
store i32 0, i32* %20
br label %54
21: ; preds = %2
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load i32*, i32** %4
store i32 1, i32* %25
br label %53
26: ; preds = %21
%27 = load i32, i32* %3
%28 = icmp sgt i32 %27, 2
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = load i32, i32* %3
%31 = icmp sle i32 %30, 4
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = load i32*, i32** %4
store i32 2, i32* %33
br label %52
34: ; preds = %29, %26
%35 = load i32, i32* %3
%36 = icmp sgt i32 %35, 4
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load i32, i32* %3
%39 = icmp sle i32 %38, 8
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = load i32*, i32** %4
store i32 4, i32* %41
br label %51
42: ; preds = %37, %34
%43 = load i32, i32* %3
%44 = icmp sgt i32 %43, 8
br i1 %44, label %45, label %50
45: ; preds = %42
%46 = load i32, i32* %3
%47 = icmp sle i32 %46, 16
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = load i32*, i32** %4
store i32 8, i32* %49
br label %50
50: ; preds = %48, %45, %42
br label %51
51: ; preds = %50, %40
br label %52
52: ; preds = %51, %32
br label %53
53: ; preds = %52, %24
br label %54
54: ; preds = %53, %19
ret void
}

LLVM IR (-O2):
define void @fit_quote_size(i32 %0, i32* noalias writeonly %1) {
%3 = icmp ne i32* %1, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp sgt i32 %0, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = icmp slt i32 %0, 16
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
switch i32 %0, label %13 [
i32 1, label %22
i32 2, label %12
]
12: ; preds = %2
br label %22
13: ; preds = %2
%14 = add i32 %0, -3
%15 = icmp ult i32 %14, 2
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = add i32 %0, -5
%18 = icmp ult i32 %17, 4
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = add i32 %0, -9
%21 = icmp ult i32 %20, 8
br i1 %21, label %22, label %24
22: ; preds = %19, %16, %13, %2, %12
%23 = phi i32 [ 1, %12 ], [ 0, %2 ], [ 2, %13 ], [ 4, %16 ], [ 8, %19 ]
store i32 %23, i32* %1
br label %24
24: ; preds = %22, %19
ret void
}