#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 */
int /*<<< orphan*/ assert(int);
int dpgetprime(int num) {
  int primes[] = {
      1,          2,          3,          5,          7,          11,
      13,         17,         19,         23,         29,         31,
      37,         43,         47,         53,         59,         61,
      71,         79,         83,         89,         103,        109,
      113,        127,        139,        157,        173,        191,
      199,        223,        239,        251,        283,        317,
      349,        383,        409,        443,        479,        509,
      571,        631,        701,        761,        829,        887,
      953,        1021,       1151,       1279,       1399,       1531,
      1663,       1789,       1913,       2039,       2297,       2557,
      2803,       3067,       3323,       3583,       3833,       4093,
      4603,       5119,       5623,       6143,       6653,       7159,
      7673,       8191,       9209,       10223,      11261,      12281,
      13309,      14327,      15359,      16381,      18427,      20479,
      22511,      24571,      26597,      28669,      30713,      32749,
      36857,      40949,      45053,      49139,      53239,      57331,
      61417,      65521,      73727,      81919,      90107,      98299,
      106487,     114679,     122869,     131071,     147451,     163819,
      180221,     196597,     212987,     229373,     245759,     262139,
      294911,     327673,     360439,     393209,     425977,     458747,
      491503,     524287,     589811,     655357,     720887,     786431,
      851957,     917503,     982981,     1048573,    1179641,    1310719,
      1441771,    1572853,    1703903,    1835003,    1966079,    2097143,
      2359267,    2621431,    2883577,    3145721,    3407857,    3670013,
      3932153,    4194301,    4718579,    5242877,    5767129,    6291449,
      6815741,    7340009,    7864301,    8388593,    9437179,    10485751,
      11534329,   12582893,   13631477,   14680063,   15728611,   16777213,
      18874367,   20971507,   23068667,   25165813,   27262931,   29360087,
      31457269,   33554393,   37748717,   41943023,   46137319,   50331599,
      54525917,   58720253,   62914549,   67108859,   75497467,   83886053,
      92274671,   100663291,  109051903,  117440509,  125829103,  134217689,
      150994939,  167772107,  184549373,  201326557,  218103799,  234881011,
      251658227,  268435399,  301989881,  335544301,  369098707,  402653171,
      436207613,  469762043,  503316469,  536870909,  603979769,  671088637,
      738197503,  805306357,  872415211,  939524087,  1006632947, 1073741789,
      1207959503, 1342177237, 1476394991, 1610612711, 1744830457, 1879048183,
      2013265907, -1};
  int i;
  assert(num > 0);
  for (i = 0; primes[i] > 0; i++) {
    if (num <= primes[i])
      return primes[i];
  }
  return primes[i - 1];
}


x86 assembly (clang, -O0):
<dpgetprime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x380,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x370(%rbp),%rdi
lea    0xec4(%rip),%rsi
mov    $0x368,%edx
call   1040 <memcpy@plt>
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x374(%rbp)
movslq -0x374(%rbp),%rax
cmpl   $0x0,-0x370(%rbp,%rax,4)
jle    11bc <dpgetprime+0x9c>
mov    -0x8(%rbp),%eax
movslq -0x374(%rbp),%rcx
cmp    -0x370(%rbp,%rcx,4),%eax
jg     11a3 <dpgetprime+0x83>
movslq -0x374(%rbp),%rax
mov    -0x370(%rbp,%rax,4),%eax
mov    %eax,-0x4(%rbp)
jmp    11d1 <dpgetprime+0xb1>
jmp    11a8 <dpgetprime+0x88>
mov    -0x374(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x374(%rbp)
jmp    1161 <dpgetprime+0x41>
mov    -0x374(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x370(%rbp,%rax,4),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x380,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dpgetprime>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
test   %ebx,%ebx
setg   %dil
call   1030 <assert@plt>
mov    $0x1,%eax
mov    $0x4,%ecx
lea    0xecf(%rip),%rdx
cmp    %ebx,%eax
jge    116c <dpgetprime+0x5c>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0xdc,%rcx
je     116e <dpgetprime+0x5e>
mov    -0xc(%rdx,%rcx,4),%eax
cmp    %ebx,%eax
jge    116c <dpgetprime+0x5c>
mov    -0x8(%rdx,%rcx,4),%eax
cmp    %ebx,%eax
jge    116c <dpgetprime+0x5c>
mov    -0x4(%rdx,%rcx,4),%eax
cmp    %ebx,%eax
jge    116c <dpgetprime+0x5c>
mov    (%rdx,%rcx,4),%eax
add    $0x4,%rcx
cmp    %ebx,%eax
jl     1140 <dpgetprime+0x30>
pop    %rbx
ret
mov    $0x77fffff3,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.dpgetprime.primes = [218 x i32] [i32 1, i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19, i32 23, i32 29, i32 31, i32 37, i32 43, i32 47, i32 53, i32 59, i32 61, i32 71, i32 79, i32 83, i32 89, i32 103, i32 109, i32 113, i32 127, i32 139, i32 157, i32 173, i32 191, i32 199, i32 223, i32 239, i32 251, i32 283, i32 317, i32 349, i32 383, i32 409, i32 443, i32 479, i32 509, i32 571, i32 631, i32 701, i32 761, i32 829, i32 887, i32 953, i32 1021, i32 1151, i32 1279, i32 1399, i32 1531, i32 1663, i32 1789, i32 1913, i32 2039, i32 2297, i32 2557, i32 2803, i32 3067, i32 3323, i32 3583, i32 3833, i32 4093, i32 4603, i32 5119, i32 5623, i32 6143, i32 6653, i32 7159, i32 7673, i32 8191, i32 9209, i32 10223, i32 11261, i32 12281, i32 13309, i32 14327, i32 15359, i32 16381, i32 18427, i32 20479, i32 22511, i32 24571, i32 26597, i32 28669, i32 30713, i32 32749, i32 36857, i32 40949, i32 45053, i32 49139, i32 53239, i32 57331, i32 61417, i32 65521, i32 73727, i32 81919, i32 90107, i32 98299, i32 106487, i32 114679, i32 122869, i32 131071, i32 147451, i32 163819, i32 180221, i32 196597, i32 212987, i32 229373, i32 245759, i32 262139, i32 294911, i32 327673, i32 360439, i32 393209, i32 425977, i32 458747, i32 491503, i32 524287, i32 589811, i32 655357, i32 720887, i32 786431, i32 851957, i32 917503, i32 982981, i32 1048573, i32 1179641, i32 1310719, i32 1441771, i32 1572853, i32 1703903, i32 1835003, i32 1966079, i32 2097143, i32 2359267, i32 2621431, i32 2883577, i32 3145721, i32 3407857, i32 3670013, i32 3932153, i32 4194301, i32 4718579, i32 5242877, i32 5767129, i32 6291449, i32 6815741, i32 7340009, i32 7864301, i32 8388593, i32 9437179, i32 10485751, i32 11534329, i32 12582893, i32 13631477, i32 14680063, i32 15728611, i32 16777213, i32 18874367, i32 20971507, i32 23068667, i32 25165813, i32 27262931, i32 29360087, i32 31457269, i32 33554393, i32 37748717, i32 41943023, i32 46137319, i32 50331599, i32 54525917, i32 58720253, i32 62914549, i32 67108859, i32 75497467, i32 83886053, i32 92274671, i32 100663291, i32 109051903, i32 117440509, i32 125829103, i32 134217689, i32 150994939, i32 167772107, i32 184549373, i32 201326557, i32 218103799, i32 234881011, i32 251658227, i32 268435399, i32 301989881, i32 335544301, i32 369098707, i32 402653171, i32 436207613, i32 469762043, i32 503316469, i32 536870909, i32 603979769, i32 671088637, i32 738197503, i32 805306357, i32 872415211, i32 939524087, i32 1006632947, i32 1073741789, i32 1207959503, i32 1342177237, i32 1476394991, i32 1610612711, i32 1744830457, i32 1879048183, i32 2013265907, i32 -1]
define i32 @dpgetprime(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [218 x i32]
%5 = alloca i32
store i32 %0, i32* %3
%6 = bitcast [218 x i32]* %4 to i8*
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
store i32 0, i32* %5
br label %11
11: ; preds = %30, %1
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [218 x i32], [218 x i32]* %4, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %33
17: ; preds = %11
%18 = load i32, i32* %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [218 x i32], [218 x i32]* %4, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = icmp sle i32 %18, %22
br i1 %23, label %24, label %29
24: ; preds = %17
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [218 x i32], [218 x i32]* %4, i64 0, i64 %26
%28 = load i32, i32* %27
store i32 %28, i32* %2
br label %39
29: ; preds = %17
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %11
33: ; preds = %11
%34 = load i32, i32* %5
%35 = sub nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [218 x i32], [218 x i32]* %4, i64 0, i64 %36
%38 = load i32, i32* %37
store i32 %38, i32* %2
br label %39
39: ; preds = %33, %24
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
@__const.dpgetprime.primes = [218 x i32] [i32 1, i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19, i32 23, i32 29, i32 31, i32 37, i32 43, i32 47, i32 53, i32 59, i32 61, i32 71, i32 79, i32 83, i32 89, i32 103, i32 109, i32 113, i32 127, i32 139, i32 157, i32 173, i32 191, i32 199, i32 223, i32 239, i32 251, i32 283, i32 317, i32 349, i32 383, i32 409, i32 443, i32 479, i32 509, i32 571, i32 631, i32 701, i32 761, i32 829, i32 887, i32 953, i32 1021, i32 1151, i32 1279, i32 1399, i32 1531, i32 1663, i32 1789, i32 1913, i32 2039, i32 2297, i32 2557, i32 2803, i32 3067, i32 3323, i32 3583, i32 3833, i32 4093, i32 4603, i32 5119, i32 5623, i32 6143, i32 6653, i32 7159, i32 7673, i32 8191, i32 9209, i32 10223, i32 11261, i32 12281, i32 13309, i32 14327, i32 15359, i32 16381, i32 18427, i32 20479, i32 22511, i32 24571, i32 26597, i32 28669, i32 30713, i32 32749, i32 36857, i32 40949, i32 45053, i32 49139, i32 53239, i32 57331, i32 61417, i32 65521, i32 73727, i32 81919, i32 90107, i32 98299, i32 106487, i32 114679, i32 122869, i32 131071, i32 147451, i32 163819, i32 180221, i32 196597, i32 212987, i32 229373, i32 245759, i32 262139, i32 294911, i32 327673, i32 360439, i32 393209, i32 425977, i32 458747, i32 491503, i32 524287, i32 589811, i32 655357, i32 720887, i32 786431, i32 851957, i32 917503, i32 982981, i32 1048573, i32 1179641, i32 1310719, i32 1441771, i32 1572853, i32 1703903, i32 1835003, i32 1966079, i32 2097143, i32 2359267, i32 2621431, i32 2883577, i32 3145721, i32 3407857, i32 3670013, i32 3932153, i32 4194301, i32 4718579, i32 5242877, i32 5767129, i32 6291449, i32 6815741, i32 7340009, i32 7864301, i32 8388593, i32 9437179, i32 10485751, i32 11534329, i32 12582893, i32 13631477, i32 14680063, i32 15728611, i32 16777213, i32 18874367, i32 20971507, i32 23068667, i32 25165813, i32 27262931, i32 29360087, i32 31457269, i32 33554393, i32 37748717, i32 41943023, i32 46137319, i32 50331599, i32 54525917, i32 58720253, i32 62914549, i32 67108859, i32 75497467, i32 83886053, i32 92274671, i32 100663291, i32 109051903, i32 117440509, i32 125829103, i32 134217689, i32 150994939, i32 167772107, i32 184549373, i32 201326557, i32 218103799, i32 234881011, i32 251658227, i32 268435399, i32 301989881, i32 335544301, i32 369098707, i32 402653171, i32 436207613, i32 469762043, i32 503316469, i32 536870909, i32 603979769, i32 671088637, i32 738197503, i32 805306357, i32 872415211, i32 939524087, i32 1006632947, i32 1073741789, i32 1207959503, i32 1342177237, i32 1476394991, i32 1610612711, i32 1744830457, i32 1879048183, i32 2013265907, i32 -1]
define i32 @dpgetprime(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
br label %5
5: ; preds = %26, %1
%6 = phi i64 [ 0, %1 ], [ %27, %26 ]
%7 = phi i32 [ 1, %1 ], [ %29, %26 ]
%8 = icmp slt i32 %7, %0
br i1 %8, label %9, label %30
9: ; preds = %5
%10 = or i64 %6, 1
%11 = getelementptr inbounds [218 x i32], [218 x i32]* @__const.dpgetprime.primes, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i64 %10, 217
br i1 %13, label %30, label %14
14: ; preds = %9
%15 = icmp slt i32 %12, %0
br i1 %15, label %16, label %30
16: ; preds = %14
%17 = or i64 %6, 2
%18 = getelementptr inbounds [218 x i32], [218 x i32]* @__const.dpgetprime.primes, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = icmp slt i32 %19, %0
br i1 %20, label %21, label %30
21: ; preds = %16
%22 = or i64 %6, 3
%23 = getelementptr inbounds [218 x i32], [218 x i32]* @__const.dpgetprime.primes, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp slt i32 %24, %0
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = add nuw nsw i64 %6, 4
%28 = getelementptr inbounds [218 x i32], [218 x i32]* @__const.dpgetprime.primes, i64 0, i64 %27
%29 = load i32, i32* %28
br label %5
30: ; preds = %21, %16, %14, %5, %9
%31 = phi i32 [ 2013265907, %9 ], [ %7, %5 ], [ %12, %14 ], [ %19, %16 ], [ %24, %21 ]
ret i32 %31
}