#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 */
size_t make_pow2(size_t size) {
  int i;
  for (i = 5; i <= 20; i++)
    if ((size_t)(2 << i) > size)
      return 2 << i;
  return ((size_t)0xffffffff);
}


x86 assembly (clang, -O0):
<make_pow2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
jg     1157 <make_pow2+0x57>
mov    -0x14(%rbp),%ecx
mov    $0x2,%eax
shl    %cl,%eax
cltq
cmp    -0x10(%rbp),%rax
jbe    1144 <make_pow2+0x44>
mov    -0x14(%rbp),%ecx
mov    $0x2,%eax
shl    %cl,%eax
cltq
mov    %rax,-0x8(%rbp)
jmp    1160 <make_pow2+0x60>
jmp    1149 <make_pow2+0x49>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <make_pow2+0xf>
mov    $0xffffffff,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_pow2>:
mov    $0x40,%ecx
cmp    $0x40,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x80,%ecx
cmp    $0x80,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x100,%ecx
cmp    $0x100,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x200,%ecx
cmp    $0x200,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x400,%ecx
cmp    $0x400,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x800,%ecx
cmp    $0x800,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x1000,%ecx
cmp    $0x1000,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x2000,%ecx
cmp    $0x2000,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x4000,%ecx
cmp    $0x4000,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x8000,%ecx
cmp    $0x8000,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x10000,%ecx
cmp    $0x10000,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x20000,%ecx
cmp    $0x20000,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x40000,%ecx
cmp    $0x40000,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x80000,%ecx
cmp    $0x80000,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0x100000,%ecx
cmp    $0x100000,%rdi
jb     11fe <make_pow2+0xfe>
mov    $0xffffffff,%eax
mov    $0x200000,%ecx
cmp    $0x1fffff,%rdi
ja     1201 <make_pow2+0x101>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @make_pow2(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 5, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 20
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* %4
%10 = shl i32 2, %9
%11 = sext i32 %10 to i64
%12 = load i64, i64* %3
%13 = icmp ugt i64 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %8
%15 = load i32, i32* %4
%16 = shl i32 2, %15
%17 = sext i32 %16 to i64
store i64 %17, i64* %2
br label %23
18: ; preds = %8
br label %19
19: ; preds = %18
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %5
store i64 4294967295, i64* %2
br label %23
23: ; preds = %22, %14
%24 = load i64, i64* %2
ret i64 %24
}

LLVM IR (-O2):
define i64 @make_pow2(i64 %0) {
%2 = icmp ult i64 %0, 64
br i1 %2, label %33, label %3
3: ; preds = %1
%4 = icmp ult i64 %0, 128
br i1 %4, label %33, label %5
5: ; preds = %3
%6 = icmp ult i64 %0, 256
br i1 %6, label %33, label %7
7: ; preds = %5
%8 = icmp ult i64 %0, 512
br i1 %8, label %33, label %9
9: ; preds = %7
%10 = icmp ult i64 %0, 1024
br i1 %10, label %33, label %11
11: ; preds = %9
%12 = icmp ult i64 %0, 2048
br i1 %12, label %33, label %13
13: ; preds = %11
%14 = icmp ult i64 %0, 4096
br i1 %14, label %33, label %15
15: ; preds = %13
%16 = icmp ult i64 %0, 8192
br i1 %16, label %33, label %17
17: ; preds = %15
%18 = icmp ult i64 %0, 16384
br i1 %18, label %33, label %19
19: ; preds = %17
%20 = icmp ult i64 %0, 32768
br i1 %20, label %33, label %21
21: ; preds = %19
%22 = icmp ult i64 %0, 65536
br i1 %22, label %33, label %23
23: ; preds = %21
%24 = icmp ult i64 %0, 131072
br i1 %24, label %33, label %25
25: ; preds = %23
%26 = icmp ult i64 %0, 262144
br i1 %26, label %33, label %27
27: ; preds = %25
%28 = icmp ult i64 %0, 524288
br i1 %28, label %33, label %29
29: ; preds = %27
%30 = icmp ult i64 %0, 1048576
br i1 %30, label %33, label %31
31: ; preds = %29
%32 = icmp ult i64 %0, 2097152
br i1 %32, label %33, label %35
33: ; preds = %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5, %3, %1
%34 = phi i64 [ 64, %1 ], [ 128, %3 ], [ 256, %5 ], [ 512, %7 ], [ 1024, %9 ], [ 2048, %11 ], [ 4096, %13 ], [ 8192, %15 ], [ 16384, %17 ], [ 32768, %19 ], [ 65536, %21 ], [ 131072, %23 ], [ 262144, %25 ], [ 524288, %27 ], [ 1048576, %29 ], [ 2097152, %31 ]
br label %35
35: ; preds = %31, %33
%36 = phi i64 [ %34, %33 ], [ 4294967295, %31 ]
ret i64 %36
}