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

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


x86 assembly (clang, -O0):
<int32_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1120 <int32_size+0x20>
movq   $0xa,-0x8(%rbp)
jmp    1194 <int32_size+0x94>
cmpq   $0x80,-0x10(%rbp)
jge    113b <int32_size+0x3b>
movq   $0x1,-0x8(%rbp)
jmp    1194 <int32_size+0x94>
cmpq   $0x4000,-0x10(%rbp)
jge    1156 <int32_size+0x56>
movq   $0x2,-0x8(%rbp)
jmp    1194 <int32_size+0x94>
cmpq   $0x200000,-0x10(%rbp)
jge    1171 <int32_size+0x71>
movq   $0x3,-0x8(%rbp)
jmp    1194 <int32_size+0x94>
cmpq   $0x10000000,-0x10(%rbp)
10
jge    118c <int32_size+0x8c>
movq   $0x4,-0x8(%rbp)
jmp    1194 <int32_size+0x94>
movq   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int32_size>:
test   %rdi,%rdi
js     1140 <int32_size+0x40>
mov    $0x1,%eax
cmp    $0x80,%rdi
jb     113f <int32_size+0x3f>
mov    $0x2,%eax
cmp    $0x4000,%rdi
jb     113f <int32_size+0x3f>
mov    $0x3,%eax
cmp    $0x200000,%rdi
jb     113f <int32_size+0x3f>
cmp    $0x10000000,%rdi
mov    $0x5,%eax
sbb    $0x0,%rax
ret
mov    $0xa,%eax
ret

LLVM IR (-O0):
define i64 @int32_size(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp slt i64 %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 i64, i64* %3
%9 = icmp slt i64 %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 i64, i64* %3
%13 = icmp slt i64 %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 i64, i64* %3
%17 = icmp slt i64 %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 i64, i64* %3
%21 = icmp slt i64 %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(i64 %0) {
%2 = icmp slt i64 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp ult i64 %0, 128
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = icmp ult i64 %0, 16384
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = icmp ult i64 %0, 2097152
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = icmp ult i64 %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
}