#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 /*<<< orphan*/ primes;

/* Variables and functions */
int /*<<< orphan*/ abort();
int prime_size(int size, int *prime_offset) {
  static const int primes[] = {
      13,        19,         29,         41,         59,        79,
      107,       149,        197,        263,        347,       457,
      599,       787,        1031,       1361,       1777,      2333,
      3037,      3967,       5167,       6719,       8737,      11369,
      14783,     19219,      24989,      32491,      42257,     54941,
      71429,     92861,      120721,     156941,     204047,    265271,
      344857,    448321,     582821,     757693,     985003,    1280519,
      1664681,   2164111,    2813353,    3657361,    4754591,   6180989,
      8035301,   10445899,   13579681,   17653589,   22949669,  29834603,
      38784989,  50420551,   65546729,   85210757,   110774011, 144006217,
      187208107, 243370577,  316381771,  411296309,  534685237, 695090819,
      903618083, 1174703521, 1527114613, 1837299131, 2147483647};
  int i;
  for (i = *prime_offset; i < (sizeof(primes) / sizeof((primes)[0])); i++)
    if (primes[i] >= size) {
      *prime_offset = i + 1;
      return primes[i];
    }
  abort();
}


x86 assembly (clang, -O0):
<prime_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x47,%rax
jae    1180 <prime_size+0x70>
movslq -0x14(%rbp),%rcx
lea    0xebf(%rip),%rax
mov    (%rax,%rcx,4),%eax
cmp    -0x4(%rbp),%eax
jl     116d <prime_size+0x5d>
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movslq -0x14(%rbp),%rcx
lea    0xe9c(%rip),%rax
mov    (%rax,%rcx,4),%eax
add    $0x20,%rsp
pop    %rbp
ret
jmp    1172 <prime_size+0x62>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1128 <prime_size+0x18>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<prime_size>:
push   %rax
mov    (%rsi),%eax
cmp    $0x46,%rax
ja     1142 <prime_size+0x32>
lea    0x1(%rax),%ecx
lea    0xedd(%rip),%rdx
lea    (%rdx,%rax,4),%rdx
nopw   0x0(%rax,%rax,1)
mov    (%rdx),%eax
cmp    %edi,%eax
jge    1149 <prime_size+0x39>
add    $0x1,%ecx
add    $0x4,%rdx
cmp    $0x48,%ecx
jne    1130 <prime_size+0x20>
xor    %eax,%eax
call   1030 <abort@plt>
mov    %ecx,(%rsi)
pop    %rcx
ret

LLVM IR (-O0):
@prime_size.primes = internal constant [71 x i32] [i32 13, i32 19, i32 29, i32 41, i32 59, i32 79, i32 107, i32 149, i32 197, i32 263, i32 347, i32 457, i32 599, i32 787, i32 1031, i32 1361, i32 1777, i32 2333, i32 3037, i32 3967, i32 5167, i32 6719, i32 8737, i32 11369, i32 14783, i32 19219, i32 24989, i32 32491, i32 42257, i32 54941, i32 71429, i32 92861, i32 120721, i32 156941, i32 204047, i32 265271, i32 344857, i32 448321, i32 582821, i32 757693, i32 985003, i32 1280519, i32 1664681, i32 2164111, i32 2813353, i32 3657361, i32 4754591, i32 6180989, i32 8035301, i32 10445899, i32 13579681, i32 17653589, i32 22949669, i32 29834603, i32 38784989, i32 50420551, i32 65546729, i32 85210757, i32 110774011, i32 144006217, i32 187208107, i32 243370577, i32 316381771, i32 411296309, i32 534685237, i32 695090819, i32 903618083, i32 1174703521, i32 1527114613, i32 1837299131, i32 2147483647]
define i32 @prime_size(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
store i32 %7, i32* %5
br label %8
8: ; preds = %28, %2
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 71
br i1 %11, label %12, label %31
12: ; preds = %8
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [71 x i32], [71 x i32]* @prime_size.primes, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = load i32, i32* %3
%18 = icmp sge i32 %16, %17
br i1 %18, label %19, label %27
19: ; preds = %12
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
%22 = load i32*, i32** %4
store i32 %21, i32* %22
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [71 x i32], [71 x i32]* @prime_size.primes, i64 0, i64 %24
%26 = load i32, i32* %25
ret i32 %26
27: ; preds = %12
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %8
31: ; preds = %8
%32 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@prime_size.primes = internal unnamed_addr constant [71 x i32] [i32 13, i32 19, i32 29, i32 41, i32 59, i32 79, i32 107, i32 149, i32 197, i32 263, i32 347, i32 457, i32 599, i32 787, i32 1031, i32 1361, i32 1777, i32 2333, i32 3037, i32 3967, i32 5167, i32 6719, i32 8737, i32 11369, i32 14783, i32 19219, i32 24989, i32 32491, i32 42257, i32 54941, i32 71429, i32 92861, i32 120721, i32 156941, i32 204047, i32 265271, i32 344857, i32 448321, i32 582821, i32 757693, i32 985003, i32 1280519, i32 1664681, i32 2164111, i32 2813353, i32 3657361, i32 4754591, i32 6180989, i32 8035301, i32 10445899, i32 13579681, i32 17653589, i32 22949669, i32 29834603, i32 38784989, i32 50420551, i32 65546729, i32 85210757, i32 110774011, i32 144006217, i32 187208107, i32 243370577, i32 316381771, i32 411296309, i32 534685237, i32 695090819, i32 903618083, i32 1174703521, i32 1527114613, i32 1837299131, i32 2147483647]
define i32 @prime_size(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = icmp ult i32 %3, 71
br i1 %4, label %5, label %19
5: ; preds = %2
%6 = zext i32 %3 to i64
br label %7
7: ; preds = %5, %15
%8 = phi i64 [ %6, %5 ], [ %16, %15 ]
%9 = getelementptr inbounds [71 x i32], [71 x i32]* @prime_size.primes, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = icmp slt i32 %10, %0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = trunc i64 %8 to i32
%14 = add nuw nsw i32 %13, 1
store i32 %14, i32* %1
ret i32 %10
15: ; preds = %7
%16 = add nuw nsw i64 %8, 1
%17 = trunc i64 %16 to i32
%18 = icmp eq i32 %17, 71
br i1 %18, label %19, label %7
19: ; preds = %15, %2
%20 = tail call i32 (...) @abort()
unreachable
}