unsigned int v_size_is_p2(unsigned int _size) {
  switch (_size) {
  case 1:
    return (0);
    break;
  case 2:
    return (1);
    break;
  case 4:
    return (2);
    break;
  case 8:
    return (3);
    break;
  case 16:
    return (4);
    break;
  case 32:
    return (5);
    break;
  case 64:
    return (6);
    break;
  case 128:
    return (7);
    break;
  case 256:
    return (8);
    break;
  case 512:
    return (9);
    break;
  case 1024:
    return (10);
    break;
  case 2048:
    return (11);
    break;
  case 4096:
    return (12);
    break;
  case 8192:
    return (13);
    break;
  case 16384:
    return (14);
    break;
  case 32768:
    return (15);
    break;
  case 65536:
    return (16);
    break;
  case 131072:
    return (17);
    break;
  case 262144:
    return (18);
    break;
  case 524288:
    return (19);
    break;
  case 1048576:
    return (20);
    break;
  case 2097152:
    return (21);
    break;
  case 4194304:
    return (22);
    break;
  case 8388608:
    return (23);
    break;
  case 16777216:
    return (24);
    break;
  case 33554432:
    return (25);
    break;
  case 67108864:
    return (26);
    break;
  case 134217728:
    return (27);
    break;
  case 268435456:
    return (28);
    break;
  case 536870912:
    return (29);
    break;
  case 1073741824:
    return (30);
    break;
  case 2147483648:
    return (31);
    break;
  default:
    return (0);
  }
}


x86 assembly (clang, -O0):
<v_size_is_p2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x80000000,%eax
je     14d0 <v_size_is_p2+0x3d0>
jmp    111d <v_size_is_p2+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     135c <v_size_is_p2+0x25c>
jmp    112e <v_size_is_p2+0x2e>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1368 <v_size_is_p2+0x268>
jmp    113f <v_size_is_p2+0x3f>
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
je     1374 <v_size_is_p2+0x274>
jmp    1150 <v_size_is_p2+0x50>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     1380 <v_size_is_p2+0x280>
jmp    1161 <v_size_is_p2+0x61>
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
je     138c <v_size_is_p2+0x28c>
jmp    1172 <v_size_is_p2+0x72>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
je     1398 <v_size_is_p2+0x298>
jmp    1183 <v_size_is_p2+0x83>
mov    -0xc(%rbp),%eax
sub    $0x40,%eax
je     13a4 <v_size_is_p2+0x2a4>
jmp    1194 <v_size_is_p2+0x94>
mov    -0xc(%rbp),%eax
sub    $0x80,%eax
je     13b0 <v_size_is_p2+0x2b0>
jmp    11a7 <v_size_is_p2+0xa7>
mov    -0xc(%rbp),%eax
sub    $0x100,%eax
je     13bc <v_size_is_p2+0x2bc>
jmp    11ba <v_size_is_p2+0xba>
mov    -0xc(%rbp),%eax
sub    $0x200,%eax
je     13c8 <v_size_is_p2+0x2c8>
jmp    11cd <v_size_is_p2+0xcd>
mov    -0xc(%rbp),%eax
sub    $0x400,%eax
je     13d4 <v_size_is_p2+0x2d4>
jmp    11e0 <v_size_is_p2+0xe0>
mov    -0xc(%rbp),%eax
sub    $0x800,%eax
je     13e0 <v_size_is_p2+0x2e0>
jmp    11f3 <v_size_is_p2+0xf3>
mov    -0xc(%rbp),%eax
sub    $0x1000,%eax
je     13ec <v_size_is_p2+0x2ec>
jmp    1206 <v_size_is_p2+0x106>
mov    -0xc(%rbp),%eax
sub    $0x2000,%eax
je     13f8 <v_size_is_p2+0x2f8>
jmp    1219 <v_size_is_p2+0x119>
mov    -0xc(%rbp),%eax
sub    $0x4000,%eax
je     1404 <v_size_is_p2+0x304>
jmp    122c <v_size_is_p2+0x12c>
mov    -0xc(%rbp),%eax
sub    $0x8000,%eax
je     1410 <v_size_is_p2+0x310>
jmp    123f <v_size_is_p2+0x13f>
mov    -0xc(%rbp),%eax
sub    $0x10000,%eax
je     141c <v_size_is_p2+0x31c>
jmp    1252 <v_size_is_p2+0x152>
mov    -0xc(%rbp),%eax
sub    $0x20000,%eax
je     1428 <v_size_is_p2+0x328>
jmp    1265 <v_size_is_p2+0x165>
mov    -0xc(%rbp),%eax
sub    $0x40000,%eax
je     1434 <v_size_is_p2+0x334>
jmp    1278 <v_size_is_p2+0x178>
mov    -0xc(%rbp),%eax
sub    $0x80000,%eax
je     1440 <v_size_is_p2+0x340>
jmp    128b <v_size_is_p2+0x18b>
mov    -0xc(%rbp),%eax
sub    $0x100000,%eax
je     144c <v_size_is_p2+0x34c>
jmp    129e <v_size_is_p2+0x19e>
mov    -0xc(%rbp),%eax
sub    $0x200000,%eax
je     1458 <v_size_is_p2+0x358>
jmp    12b1 <v_size_is_p2+0x1b1>
mov    -0xc(%rbp),%eax
sub    $0x400000,%eax
je     1464 <v_size_is_p2+0x364>
jmp    12c4 <v_size_is_p2+0x1c4>
mov    -0xc(%rbp),%eax
sub    $0x800000,%eax
je     1470 <v_size_is_p2+0x370>
jmp    12d7 <v_size_is_p2+0x1d7>
mov    -0xc(%rbp),%eax
sub    $0x1000000,%eax
je     147c <v_size_is_p2+0x37c>
jmp    12ea <v_size_is_p2+0x1ea>
mov    -0xc(%rbp),%eax
sub    $0x2000000,%eax
je     1488 <v_size_is_p2+0x388>
jmp    12fd <v_size_is_p2+0x1fd>
mov    -0xc(%rbp),%eax
sub    $0x4000000,%eax
je     1494 <v_size_is_p2+0x394>
jmp    1310 <v_size_is_p2+0x210>
mov    -0xc(%rbp),%eax
sub    $0x8000000,%eax
je     14a0 <v_size_is_p2+0x3a0>
jmp    1323 <v_size_is_p2+0x223>
mov    -0xc(%rbp),%eax
sub    $0x10000000,%eax
je     14ac <v_size_is_p2+0x3ac>
jmp    1336 <v_size_is_p2+0x236>
mov    -0xc(%rbp),%eax
sub    $0x20000000,%eax
je     14b8 <v_size_is_p2+0x3b8>
jmp    1349 <v_size_is_p2+0x249>
mov    -0xc(%rbp),%eax
sub    $0x40000000,%eax
je     14c4 <v_size_is_p2+0x3c4>
jmp    14dc <v_size_is_p2+0x3dc>
movl   $0x0,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x1,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x2,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x3,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x4,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x5,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x6,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x7,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x8,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x9,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0xa,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0xb,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0xc,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0xd,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0xe,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0xf,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x10,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x11,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x12,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x13,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x14,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x15,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x16,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x17,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x18,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x19,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x1a,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x1b,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x1c,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x1d,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x1e,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x1f,-0x4(%rbp)
jmp    14e3 <v_size_is_p2+0x3e3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<v_size_is_p2>:
xor    %eax,%eax
cmp    $0x7fff,%edi
jle    1148 <v_size_is_p2+0x48>
cmp    $0x7fffff,%edi
jg     1183 <v_size_is_p2+0x83>
cmp    $0x7ffff,%edi
jg     11db <v_size_is_p2+0xdb>
cmp    $0x1ffff,%edi
jg     1274 <v_size_is_p2+0x174>
cmp    $0x8000,%edi
je     1314 <v_size_is_p2+0x214>
cmp    $0x10000,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0x10,%eax
ret
cmp    $0x7f,%edi
jle    11b9 <v_size_is_p2+0xb9>
cmp    $0x7ff,%edi
jg     1205 <v_size_is_p2+0x105>
cmp    $0x1ff,%edi
jg     1292 <v_size_is_p2+0x192>
cmp    $0x80,%edi
je     131a <v_size_is_p2+0x21a>
cmp    $0x100,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0x8,%eax
ret
cmp    $0x7ffffff,%edi
jg     122f <v_size_is_p2+0x12f>
cmp    $0x1ffffff,%edi
jg     12b0 <v_size_is_p2+0x1b0>
cmp    $0x800000,%edi
je     1320 <v_size_is_p2+0x220>
cmp    $0x1000000,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0x18,%eax
ret
lea    -0x2(%rdi),%ecx
cmp    $0x1e,%ecx
ja     1259 <v_size_is_p2+0x159>
lea    0xe34(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x1,%eax
ret
cmp    $0x1fffff,%edi
jg     12ce <v_size_is_p2+0x1ce>
cmp    $0x80000,%edi
je     133e <v_size_is_p2+0x23e>
cmp    $0x100000,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0x14,%eax
ret
cmp    $0x1fff,%edi
jg     12e8 <v_size_is_p2+0x1e8>
cmp    $0x800,%edi
je     1344 <v_size_is_p2+0x244>
cmp    $0x1000,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0xc,%eax
ret
cmp    $0x1fffffff,%edi
jg     12fe <v_size_is_p2+0x1fe>
cmp    $0x8000000,%edi
je     134a <v_size_is_p2+0x24a>
cmp    $0x10000000,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0x1c,%eax
ret
cmp    $0x80000000,%edi
je     1350 <v_size_is_p2+0x250>
cmp    $0x40,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0x6,%eax
ret
cmp    $0x20000,%edi
je     1356 <v_size_is_p2+0x256>
cmp    $0x40000,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0x12,%eax
ret
cmp    $0x200,%edi
je     135c <v_size_is_p2+0x25c>
cmp    $0x400,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0xa,%eax
ret
cmp    $0x2000000,%edi
je     1362 <v_size_is_p2+0x262>
cmp    $0x4000000,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0x1a,%eax
ret
cmp    $0x200000,%edi
je     1368 <v_size_is_p2+0x268>
cmp    $0x400000,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0x16,%eax
ret
cmp    $0x2000,%edi
je     136e <v_size_is_p2+0x26e>
cmp    $0x4000,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0xe,%eax
ret
cmp    $0x20000000,%edi
je     1374 <v_size_is_p2+0x274>
cmp    $0x40000000,%edi
jne    1355 <v_size_is_p2+0x255>
mov    $0x1e,%eax
ret
mov    $0xf,%eax
ret
mov    $0x7,%eax
ret
mov    $0x17,%eax
ret
mov    $0x2,%eax
ret
mov    $0x3,%eax
ret
mov    $0x4,%eax
ret
mov    $0x5,%eax
ret
mov    $0x13,%eax
ret
mov    $0xb,%eax
ret
mov    $0x1b,%eax
ret
mov    $0x1f,%eax
ret
mov    $0x11,%eax
ret
mov    $0x9,%eax
ret
mov    $0x19,%eax
ret
mov    $0x15,%eax
ret
mov    $0xd,%eax
ret
mov    $0x1d,%eax
ret

LLVM IR (-O0):
define i32 @v_size_is_p2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %37 [
i32 1, label %5
i32 2, label %6
i32 4, label %7
i32 8, label %8
i32 16, label %9
i32 32, label %10
i32 64, label %11
i32 128, label %12
i32 256, label %13
i32 512, label %14
i32 1024, label %15
i32 2048, label %16
i32 4096, label %17
i32 8192, label %18
i32 16384, label %19
i32 32768, label %20
i32 65536, label %21
i32 131072, label %22
i32 262144, label %23
i32 524288, label %24
i32 1048576, label %25
i32 2097152, label %26
i32 4194304, label %27
i32 8388608, label %28
i32 16777216, label %29
i32 33554432, label %30
i32 67108864, label %31
i32 134217728, label %32
i32 268435456, label %33
i32 536870912, label %34
i32 1073741824, label %35
i32 -2147483648, label %36
]
5: ; preds = %1
store i32 0, i32* %2
br label %38
6: ; preds = %1
store i32 1, i32* %2
br label %38
7: ; preds = %1
store i32 2, i32* %2
br label %38
8: ; preds = %1
store i32 3, i32* %2
br label %38
9: ; preds = %1
store i32 4, i32* %2
br label %38
10: ; preds = %1
store i32 5, i32* %2
br label %38
11: ; preds = %1
store i32 6, i32* %2
br label %38
12: ; preds = %1
store i32 7, i32* %2
br label %38
13: ; preds = %1
store i32 8, i32* %2
br label %38
14: ; preds = %1
store i32 9, i32* %2
br label %38
15: ; preds = %1
store i32 10, i32* %2
br label %38
16: ; preds = %1
store i32 11, i32* %2
br label %38
17: ; preds = %1
store i32 12, i32* %2
br label %38
18: ; preds = %1
store i32 13, i32* %2
br label %38
19: ; preds = %1
store i32 14, i32* %2
br label %38
20: ; preds = %1
store i32 15, i32* %2
br label %38
21: ; preds = %1
store i32 16, i32* %2
br label %38
22: ; preds = %1
store i32 17, i32* %2
br label %38
23: ; preds = %1
store i32 18, i32* %2
br label %38
24: ; preds = %1
store i32 19, i32* %2
br label %38
25: ; preds = %1
store i32 20, i32* %2
br label %38
26: ; preds = %1
store i32 21, i32* %2
br label %38
27: ; preds = %1
store i32 22, i32* %2
br label %38
28: ; preds = %1
store i32 23, i32* %2
br label %38
29: ; preds = %1
store i32 24, i32* %2
br label %38
30: ; preds = %1
store i32 25, i32* %2
br label %38
31: ; preds = %1
store i32 26, i32* %2
br label %38
32: ; preds = %1
store i32 27, i32* %2
br label %38
33: ; preds = %1
store i32 28, i32* %2
br label %38
34: ; preds = %1
store i32 29, i32* %2
br label %38
35: ; preds = %1
store i32 30, i32* %2
br label %38
36: ; preds = %1
store i32 31, i32* %2
br label %38
37: ; preds = %1
store i32 0, i32* %2
br label %38
38: ; preds = %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
define i32 @v_size_is_p2(i32 %0) {
switch i32 %0, label %33 [
i32 -2147483648, label %32
i32 2, label %2
i32 4, label %3
i32 8, label %4
i32 16, label %5
i32 32, label %6
i32 64, label %7
i32 128, label %8
i32 256, label %9
i32 512, label %10
i32 1024, label %11
i32 2048, label %12
i32 4096, label %13
i32 8192, label %14
i32 16384, label %15
i32 32768, label %16
i32 65536, label %17
i32 131072, label %18
i32 262144, label %19
i32 524288, label %20
i32 1048576, label %21
i32 2097152, label %22
i32 4194304, label %23
i32 8388608, label %24
i32 16777216, label %25
i32 33554432, label %26
i32 67108864, label %27
i32 134217728, label %28
i32 268435456, label %29
i32 536870912, label %30
i32 1073741824, label %31
]
2: ; preds = %1
br label %33
3: ; preds = %1
br label %33
4: ; preds = %1
br label %33
5: ; preds = %1
br label %33
6: ; preds = %1
br label %33
7: ; preds = %1
br label %33
8: ; preds = %1
br label %33
9: ; preds = %1
br label %33
10: ; preds = %1
br label %33
11: ; preds = %1
br label %33
12: ; preds = %1
br label %33
13: ; preds = %1
br label %33
14: ; preds = %1
br label %33
15: ; preds = %1
br label %33
16: ; preds = %1
br label %33
17: ; preds = %1
br label %33
18: ; preds = %1
br label %33
19: ; preds = %1
br label %33
20: ; preds = %1
br label %33
21: ; preds = %1
br label %33
22: ; preds = %1
br label %33
23: ; preds = %1
br label %33
24: ; preds = %1
br label %33
25: ; preds = %1
br label %33
26: ; preds = %1
br label %33
27: ; preds = %1
br label %33
28: ; preds = %1
br label %33
29: ; preds = %1
br label %33
30: ; preds = %1
br label %33
31: ; preds = %1
br label %33
32: ; preds = %1
br label %33
33: ; preds = %1, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%34 = phi i32 [ 31, %32 ], [ 30, %31 ], [ 29, %30 ], [ 28, %29 ], [ 27, %28 ], [ 26, %27 ], [ 25, %26 ], [ 24, %25 ], [ 23, %24 ], [ 22, %23 ], [ 21, %22 ], [ 20, %21 ], [ 19, %20 ], [ 18, %19 ], [ 17, %18 ], [ 16, %17 ], [ 15, %16 ], [ 14, %15 ], [ 13, %14 ], [ 12, %13 ], [ 11, %12 ], [ 10, %11 ], [ 9, %10 ], [ 8, %9 ], [ 7, %8 ], [ 6, %7 ], [ 5, %6 ], [ 4, %5 ], [ 3, %4 ], [ 2, %3 ], [ 1, %2 ], [ 0, %1 ]
ret i32 %34
}