#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 */

/* Variables and functions */
int bufcon_lenp(unsigned int p) {
  if (p < 0x10)
    return 1;
  if (p < 0x100)
    return 2;
  if (p < 0x1000)
    return 3;
  if (p < 0x10000)
    return 4;
  if (p < 0x100000)
    return 5;
  if (p < 0x1000000)
    return 6;
  if (p < 0x10000000)
    return 7;
  return 8;
}


x86 assembly (clang, -O0):
<bufcon_lenp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jae    111d <bufcon_lenp+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    11ba <bufcon_lenp+0xba>
cmpl   $0x100,-0x8(%rbp)
jae    1136 <bufcon_lenp+0x36>
movl   $0x2,-0x4(%rbp)
jmp    11ba <bufcon_lenp+0xba>
cmpl   $0x1000,-0x8(%rbp)
jae    114f <bufcon_lenp+0x4f>
movl   $0x3,-0x4(%rbp)
jmp    11ba <bufcon_lenp+0xba>
cmpl   $0x10000,-0x8(%rbp)
jae    1168 <bufcon_lenp+0x68>
movl   $0x4,-0x4(%rbp)
jmp    11ba <bufcon_lenp+0xba>
cmpl   $0x100000,-0x8(%rbp)
jae    1181 <bufcon_lenp+0x81>
movl   $0x5,-0x4(%rbp)
jmp    11ba <bufcon_lenp+0xba>
cmpl   $0x1000000,-0x8(%rbp)
jae    119a <bufcon_lenp+0x9a>
movl   $0x6,-0x4(%rbp)
jmp    11ba <bufcon_lenp+0xba>
cmpl   $0x10000000,-0x8(%rbp)
jae    11b3 <bufcon_lenp+0xb3>
movl   $0x7,-0x4(%rbp)
jmp    11ba <bufcon_lenp+0xba>
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bufcon_lenp>:
mov    $0x1,%eax
cmp    $0x10,%edi
jb     1159 <bufcon_lenp+0x59>
mov    $0x2,%eax
cmp    $0x100,%edi
jb     1159 <bufcon_lenp+0x59>
mov    $0x3,%eax
cmp    $0x1000,%edi
jb     1159 <bufcon_lenp+0x59>
mov    $0x4,%eax
cmp    $0x10000,%edi
jb     1159 <bufcon_lenp+0x59>
mov    $0x5,%eax
cmp    $0x100000,%edi
jb     1159 <bufcon_lenp+0x59>
mov    $0x6,%eax
cmp    $0x1000000,%edi
jb     1159 <bufcon_lenp+0x59>
cmp    $0x10000000,%edi
mov    $0x8,%eax
sbb    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @bufcon_lenp(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ult i32 %4, 16
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %32
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp ult i32 %8, 256
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 2, i32* %2
br label %32
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp ult i32 %12, 4096
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 3, i32* %2
br label %32
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp ult i32 %16, 65536
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 4, i32* %2
br label %32
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp ult i32 %20, 1048576
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 5, i32* %2
br label %32
23: ; preds = %19
%24 = load i32, i32* %3
%25 = icmp ult i32 %24, 16777216
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 6, i32* %2
br label %32
27: ; preds = %23
%28 = load i32, i32* %3
%29 = icmp ult i32 %28, 268435456
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 7, i32* %2
br label %32
31: ; preds = %27
store i32 8, i32* %2
br label %32
32: ; preds = %31, %30, %26, %22, %18, %14, %10, %6
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
define i32 @bufcon_lenp(i32 %0) {
%2 = icmp ult i32 %0, 16
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 256
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 4096
br i1 %6, label %16, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 65536
br i1 %8, label %16, label %9
9: ; preds = %7
%10 = icmp ult i32 %0, 1048576
br i1 %10, label %16, label %11
11: ; preds = %9
%12 = icmp ult i32 %0, 16777216
br i1 %12, label %16, label %13
13: ; preds = %11
%14 = icmp ult i32 %0, 268435456
%15 = select i1 %14, i32 7, i32 8
br label %16
16: ; preds = %13, %11, %9, %7, %5, %3, %1
%17 = phi i32 [ 1, %1 ], [ 2, %3 ], [ 3, %5 ], [ 4, %7 ], [ 5, %9 ], [ 6, %11 ], [ %15, %13 ]
ret i32 %17
}