#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 */
int size_uint32(int);
unsigned size_uint64(uint64_t v) {
  uint32_t upper_v = (uint32_t)(v >> 32);
  if (upper_v == 0)
    return size_uint32((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):
<size_uint64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1142 <size_uint64+0x32>
mov    -0x8(%rbp),%edi
call   1030 <size_uint32@plt>
mov    %eax,-0x4(%rbp)
jmp    11c3 <size_uint64+0xb3>
cmpl   $0x8,-0xc(%rbp)
jge    1158 <size_uint64+0x48>
movl   $0x5,-0x4(%rbp)
jmp    11c3 <size_uint64+0xb3>
cmpl   $0x400,-0xc(%rbp)
jge    1171 <size_uint64+0x61>
movl   $0x6,-0x4(%rbp)
jmp    11c3 <size_uint64+0xb3>
cmpl   $0x20000,-0xc(%rbp)
jge    118a <size_uint64+0x7a>
movl   $0x7,-0x4(%rbp)
jmp    11c3 <size_uint64+0xb3>
cmpl   $0x1000000,-0xc(%rbp)
jge    11a3 <size_uint64+0x93>
movl   $0x8,-0x4(%rbp)
jmp    11c3 <size_uint64+0xb3>
cmpl   $0x80000000,-0xc(%rbp)
jae    11bc <size_uint64+0xac>
movl   $0x9,-0x4(%rbp)
jmp    11c3 <size_uint64+0xb3>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @size_uint64(i32 %0) {
%2 = alloca i32
%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 i32 @size_uint32(i32 %10)
store i32 %11, i32* %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 i32 5, i32* %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 i32 6, i32* %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 i32 7, i32* %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 i32 8, i32* %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 i32 9, i32* %2
br label %33
32: ; preds = %28
store i32 10, i32* %2
br label %33
33: ; preds = %32, %31, %27, %23, %19, %15, %9
%34 = load i32, i32* %2
ret i32 %34
}

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