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

/* Variables and functions */
size_t int32_size(int32_t v) {
  if (v < 0) {
    return 10;
  } else if (v < (1 << 7)) {
    return 1;
  } else if (v < (1 << 14)) {
    return 2;
  } else if (v < (1 << 21)) {
    return 3;
  } else if (v < (1 << 28)) {
    return 4;
  } else {
    return 5;
  }
}


x86 assembly (clang, -O0):
<int32_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    111e <int32_size+0x1e>
movq   $0xa,-0x8(%rbp)
jmp    118e <int32_size+0x8e>
cmpl   $0x80,-0xc(%rbp)
jge    1138 <int32_size+0x38>
movq   $0x1,-0x8(%rbp)
jmp    118e <int32_size+0x8e>
cmpl   $0x4000,-0xc(%rbp)
jge    1152 <int32_size+0x52>
movq   $0x2,-0x8(%rbp)
jmp    118e <int32_size+0x8e>
cmpl   $0x200000,-0xc(%rbp)
jge    116c <int32_size+0x6c>
movq   $0x3,-0x8(%rbp)
jmp    118e <int32_size+0x8e>
cmpl   $0x10000000,-0xc(%rbp)
jge    1186 <int32_size+0x86>
movq   $0x4,-0x8(%rbp)
jmp    118e <int32_size+0x8e>
movq   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int32_size>:
test   %edi,%edi
js     113b <int32_size+0x3b>
mov    $0x1,%eax
cmp    $0x80,%edi
jb     113a <int32_size+0x3a>
mov    $0x2,%eax
cmp    $0x4000,%edi
jb     113a <int32_size+0x3a>
mov    $0x3,%eax
cmp    $0x200000,%edi
jb     113a <int32_size+0x3a>
cmp    $0x10000000,%edi
mov    $0x5,%eax
sbb    $0x0,%rax
ret
mov    $0xa,%eax
ret

LLVM IR (-O0):
define i64 @int32_size(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 10, i64* %2
br label %24
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 128
br i1 %9, label %10, label %11
10: ; preds = %7
store i64 1, i64* %2
br label %24
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 16384
br i1 %13, label %14, label %15
14: ; preds = %11
store i64 2, i64* %2
br label %24
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 2097152
br i1 %17, label %18, label %19
18: ; preds = %15
store i64 3, i64* %2
br label %24
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 268435456
br i1 %21, label %22, label %23
22: ; preds = %19
store i64 4, i64* %2
br label %24
23: ; preds = %19
store i64 5, i64* %2
br label %24
24: ; preds = %23, %22, %18, %14, %10, %6
%25 = load i64, i64* %2
ret i64 %25
}

LLVM IR (-O2):
define i64 @int32_size(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 128
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 16384
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 2097152
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = icmp ult i32 %0, 268435456
%11 = select i1 %10, i64 4, i64 5
br label %12
12: ; preds = %9, %7, %5, %3, %1
%13 = phi i64 [ 10, %1 ], [ 1, %3 ], [ 2, %5 ], [ 3, %7 ], [ %11, %9 ]
ret i64 %13
}