#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 uint64_t;
typedef int uint32_t;

/* Variables and functions */
size_t uint32_size(int);
size_t uint64_size(uint64_t v) {
  uint32_t upper_v = (uint32_t)(v >> 32);
  if (upper_v == 0) {
    return uint32_size((uint32_t)v);
  } else if (upper_v < (1 << 3)) {
    return 5;
  } else if (upper_v < (1 << 10)) {
    return 6;
  } else if (upper_v < (1 << 17)) {
    return 7;
  } else if (upper_v < (1 << 24)) {
    return 8;
  } else if (upper_v < (1U << 31)) {
    return 9;
  } else {
    return 10;
  }
}


x86 assembly (clang, -O0):
<uint64_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1143 <uint64_size+0x33>
mov    -0xc(%rbp),%edi
call   1030 <uint32_size@plt>
mov    %rax,-0x8(%rbp)
jmp    11ca <uint64_size+0xba>
cmpl   $0x8,-0x10(%rbp)
jge    115a <uint64_size+0x4a>
movq   $0x5,-0x8(%rbp)
jmp    11ca <uint64_size+0xba>
cmpl   $0x400,-0x10(%rbp)
jge    1174 <uint64_size+0x64>
movq   $0x6,-0x8(%rbp)
jmp    11ca <uint64_size+0xba>
cmpl   $0x20000,-0x10(%rbp)
jge    118e <uint64_size+0x7e>
movq   $0x7,-0x8(%rbp)
jmp    11ca <uint64_size+0xba>
cmpl   $0x1000000,-0x10(%rbp)
jge    11a8 <uint64_size+0x98>
movq   $0x8,-0x8(%rbp)
jmp    11ca <uint64_size+0xba>
cmpl   $0x80000000,-0x10(%rbp)
jae    11c2 <uint64_size+0xb2>
movq   $0x9,-0x8(%rbp)
jmp    11ca <uint64_size+0xba>
movq   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint64_size>:
mov    $0xa,%eax
ret

LLVM IR (-O0):
define i64 @uint64_size(i32 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = ashr i32 %5, 32
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %3
%11 = call i64 @uint32_size(i32 %10)
store i64 %11, i64* %2
br label %33
12: ; preds = %1
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 8
br i1 %14, label %15, label %16
15: ; preds = %12
store i64 5, i64* %2
br label %33
16: ; preds = %12
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 1024
br i1 %18, label %19, label %20
19: ; preds = %16
store i64 6, i64* %2
br label %33
20: ; preds = %16
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 131072
br i1 %22, label %23, label %24
23: ; preds = %20
store i64 7, i64* %2
br label %33
24: ; preds = %20
%25 = load i32, i32* %4
%26 = icmp slt i32 %25, 16777216
br i1 %26, label %27, label %28
27: ; preds = %24
store i64 8, i64* %2
br label %33
28: ; preds = %24
%29 = load i32, i32* %4
%30 = icmp ult i32 %29, -2147483648
br i1 %30, label %31, label %32
31: ; preds = %28
store i64 9, i64* %2
br label %33
32: ; preds = %28
store i64 10, i64* %2
br label %33
33: ; preds = %32, %31, %27, %23, %19, %15, %9
%34 = load i64, i64* %2
ret i64 %34
}

LLVM IR (-O2):
define i64 @uint64_size(i32 %0) {
ret i64 10
}