#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 */
unsigned int stb_power_of_two_nearest_prime(int n) {
  static signed char tab[32] = {0,  0,  0,  0,  1,  0,  -1, 0,  1, -1, -1,
                                3,  -1, 0,  -1, 2,  1,  0,  2,  0, -1, -4,
                                -1, 5,  -1, 18, -2, 15, 2,  -1, 2, 0};
  if (!tab[0]) {
    int i;
    for (i = 0; i < 32; ++i)
      tab[i] = (1 << i) + 2 * tab[i] - 1;
    tab[1] = 2;
    tab[0] = 1;
  }
  if (n >= 32)
    return 0xfffffffb;
  return tab[n];
}


x86 assembly (clang, -O0):
<stb_power_of_two_nearest_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpb   $0x0,0x2f22(%rip)
jne    1172 <stb_power_of_two_nearest_prime+0x72>
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1164 <stb_power_of_two_nearest_prime+0x64>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq -0xc(%rbp),%rdx
lea    0x2ef6(%rip),%rcx
movsbl (%rcx,%rdx,1),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
sub    $0x1,%eax
mov    %al,%dl
movslq -0xc(%rbp),%rcx
lea    0x2edd(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111b <stb_power_of_two_nearest_prime+0x1b>
movb   $0x2,0x2ec6(%rip)
movb   $0x1,0x2ebe(%rip)
cmpl   $0x20,-0x8(%rbp)
jl     1188 <stb_power_of_two_nearest_prime+0x88>
movl   $0xfffffffb,-0x4(%rbp)
jmp    119a <stb_power_of_two_nearest_prime+0x9a>
movslq -0x8(%rbp),%rcx
lea    0x2e9d(%rip),%rax
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stb_power_of_two_nearest_prime>:
cmpb   $0x0,0x2f29(%rip)
jne    122e <stb_power_of_two_nearest_prime+0x12e>
movb   $0x0,0x2f1c(%rip)
movdqu 0x2f15(%rip),%xmm0
paddb  %xmm0,%xmm0
paddb  0xed8(%rip),%xmm0
movdqu %xmm0,0x2f01(%rip)
mov    0x2f0b(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2f01(%rip)
mov    0x2efc(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2ef2(%rip)
mov    0x2eed(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2ee3(%rip)
mov    0x2ede(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2ed4(%rip)
mov    0x2ecf(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2ec5(%rip)
mov    0x2ec0(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2eb6(%rip)
mov    0x2eb1(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2ea7(%rip)
mov    0x2ea2(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2e98(%rip)
mov    0x2e93(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2e89(%rip)
mov    0x2e84(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2e7a(%rip)
mov    0x2e75(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2e6b(%rip)
mov    0x2e66(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2e5c(%rip)
mov    0x2e57(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2e4d(%rip)
mov    0x2e48(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2e3e(%rip)
mov    0x2e39(%rip),%al
add    %al,%al
add    $0xff,%al
mov    %al,0x2e2f(%rip)
movb   $0x2,0x2e0a(%rip)
movb   $0x1,0x2e02(%rip)
mov    $0xfffffffb,%eax
cmp    $0x1f,%edi
jg     1246 <stb_power_of_two_nearest_prime+0x146>
movslq %edi,%rax
lea    0x2dee(%rip),%rcx
movsbl (%rax,%rcx,1),%eax
ret

LLVM IR (-O0):
@stb_power_of_two_nearest_prime.tab = internal global [32 x i8] c"\00\00\00\00\01\00\FF\00\01\FF\FF\03\FF\00\FF\02\01\00\02\00\FF\FC\FF\05\FF\12\FE\0F\02\FF\02\00"
define i32 @stb_power_of_two_nearest_prime(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 0)
%6 = icmp ne i8 %5, 0
br i1 %6, label %30, label %7
7: ; preds = %1
store i32 0, i32* %4
br label %8
8: ; preds = %26, %7
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 32
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i32, i32* %4
%13 = shl i32 1, %12
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = mul nsw i32 2, %18
%20 = add nsw i32 %13, %19
%21 = sub nsw i32 %20, 1
%22 = trunc i32 %21 to i8
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 %24
store i8 %22, i8* %25
br label %26
26: ; preds = %11
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %8
29: ; preds = %8
store i8 2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 1)
store i8 1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 0)
br label %30
30: ; preds = %29, %1
%31 = load i32, i32* %3
%32 = icmp sge i32 %31, 32
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 -5, i32* %2
br label %40
34: ; preds = %30
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
store i32 %39, i32* %2
br label %40
40: ; preds = %34, %33
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
@stb_power_of_two_nearest_prime.tab = internal unnamed_addr global [32 x i8] c"\00\00\00\00\01\00\FF\00\01\FF\FF\03\FF\00\FF\02\01\00\02\00\FF\FC\FF\05\FF\12\FE\0F\02\FF\02\00"
define i32 @stb_power_of_two_nearest_prime(i32 %0) {
%2 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 0)
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %53
4: ; preds = %1
store i8 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 0)
%5 = load <16 x i8>, <16 x i8>* bitcast (i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 1) to <16 x i8>*)
%6 = shl <16 x i8> %5, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
%7 = add <16 x i8> %6, <i8 1, i8 3, i8 7, i8 15, i8 31, i8 63, i8 127, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
store <16 x i8> %7, <16 x i8>* bitcast (i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 1) to <16 x i8>*)
%8 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 17)
%9 = shl i8 %8, 1
%10 = add i8 %9, -1
store i8 %10, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 17)
%11 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 18)
%12 = shl i8 %11, 1
%13 = add i8 %12, -1
store i8 %13, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 18)
%14 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 19)
%15 = shl i8 %14, 1
%16 = add i8 %15, -1
store i8 %16, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 19)
%17 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 20)
%18 = shl i8 %17, 1
%19 = add i8 %18, -1
store i8 %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 20)
%20 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 21)
%21 = shl i8 %20, 1
%22 = add i8 %21, -1
store i8 %22, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 21)
%23 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 22)
%24 = shl i8 %23, 1
%25 = add i8 %24, -1
store i8 %25, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 22)
%26 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 23)
%27 = shl i8 %26, 1
%28 = add i8 %27, -1
store i8 %28, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 23)
%29 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 24)
%30 = shl i8 %29, 1
%31 = add i8 %30, -1
store i8 %31, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 24)
%32 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 25)
%33 = shl i8 %32, 1
%34 = add i8 %33, -1
store i8 %34, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 25)
%35 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 26)
%36 = shl i8 %35, 1
%37 = add i8 %36, -1
store i8 %37, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 26)
%38 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 27)
%39 = shl i8 %38, 1
%40 = add i8 %39, -1
store i8 %40, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 27)
%41 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 28)
%42 = shl i8 %41, 1
%43 = add i8 %42, -1
store i8 %43, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 28)
%44 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 29)
%45 = shl i8 %44, 1
%46 = add i8 %45, -1
store i8 %46, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 29)
%47 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 30)
%48 = shl i8 %47, 1
%49 = add i8 %48, -1
store i8 %49, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 30)
%50 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 31)
%51 = shl i8 %50, 1
%52 = add i8 %51, -1
store i8 %52, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 31)
store i8 2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 1)
store i8 1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 0)
br label %53
53: ; preds = %4, %1
%54 = icmp sgt i32 %0, 31
br i1 %54, label %60, label %55
55: ; preds = %53
%56 = sext i32 %0 to i64
%57 = getelementptr inbounds [32 x i8], [32 x i8]* @stb_power_of_two_nearest_prime.tab, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
br label %60
60: ; preds = %53, %55
%61 = phi i32 [ %59, %55 ], [ -5, %53 ]
ret i32 %61
}