#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 *loadPrimeNumbers() {
  bool primeBits[140000];
  int i;
  int j;
  for (i = 2; i < 140000; i++) {
    for (j = 2 * i; j < 140000; j += i) {
      primeBits[j] = 1;
    }
  }
  static int primeNumbers[13000];
  int counter = 0;
  for (i = 2; i < 140000 && counter < 13000; i++) {
    if (primeBits[i] == 0) {
      primeNumbers[counter++] = i;
    }
  }
  return primeNumbers;
}


x86 assembly (clang, -O0):
<loadPrimeNumbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x88b10,%rsp
movl   $0x2,-0x88b84(%rbp)
cmpl   $0x222e0,-0x88b84(%rbp)
jge    1186 <loadPrimeNumbers+0x86>
mov    -0x88b84(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x88b88(%rbp)
cmpl   $0x222e0,-0x88b88(%rbp)
jge    116d <loadPrimeNumbers+0x6d>
movslq -0x88b88(%rbp),%rax
movl   $0x1,-0x88b80(%rbp,%rax,4)
mov    -0x88b84(%rbp),%eax
add    -0x88b88(%rbp),%eax
mov    %eax,-0x88b88(%rbp)
jmp    1134 <loadPrimeNumbers+0x34>
jmp    1172 <loadPrimeNumbers+0x72>
mov    -0x88b84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88b84(%rbp)
jmp    1115 <loadPrimeNumbers+0x15>
movl   $0x0,-0x88b8c(%rbp)
movl   $0x2,-0x88b84(%rbp)
xor    %eax,%eax
cmpl   $0x222e0,-0x88b84(%rbp)
mov    %al,-0x88b8d(%rbp)
jge    11c5 <loadPrimeNumbers+0xc5>
cmpl   $0x32c8,-0x88b8c(%rbp)
setl   %al
mov    %al,-0x88b8d(%rbp)
mov    -0x88b8d(%rbp),%al
test   $0x1,%al
jne    11d8 <loadPrimeNumbers+0xd8>
jmp    122a <loadPrimeNumbers+0x12a>
movslq -0x88b84(%rbp),%rax
cmpl   $0x0,-0x88b80(%rbp,%rax,4)
jne    1211 <loadPrimeNumbers+0x111>
mov    -0x88b84(%rbp),%edx
mov    -0x88b8c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x88b8c(%rbp)
movslq %eax,%rcx
lea    0x2e22(%rip),%rax
mov    %edx,(%rax,%rcx,4)
jmp    1216 <loadPrimeNumbers+0x116>
mov    -0x88b84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88b84(%rbp)
jmp    119a <loadPrimeNumbers+0x9a>
lea    0x2dff(%rip),%rax
add    $0x88b10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadPrimeNumbers>:
sub    $0x88b08,%rsp
lea    -0x70(%rsp),%r8
lea    -0x68(%rsp),%r9
mov    $0x4,%r10d
mov    $0x2,%ecx
mov    $0x8,%r11d
mov    $0xc,%eax
jmp    1151 <loadPrimeNumbers+0x51>
nopl   0x0(%rax)
add    $0x2,%rcx
add    $0x4,%r10
add    $0x10,%r8
add    $0x8,%r11
add    $0x10,%r9
add    $0x8,%rax
cmp    $0x222e0,%rcx
je     11a7 <loadPrimeNumbers+0xa7>
cmp    $0x1116f,%rcx
ja     1175 <loadPrimeNumbers+0x75>
mov    %r8,%rdx
mov    %r10,%rsi
movl   $0x1,(%rdx)
add    %rcx,%rsi
add    %r11,%rdx
cmp    $0x222e0,%rsi
jb     1160 <loadPrimeNumbers+0x60>
cmp    $0x1116e,%rcx
ja     1130 <loadPrimeNumbers+0x30>
mov    %rcx,%rsi
or     $0x1,%rsi
mov    %r10,%rdx
or     $0x2,%rdx
mov    %r9,%rdi
nop
add    %rsi,%rdx
movl   $0x1,(%rdi)
add    %rax,%rdi
cmp    $0x222e0,%rdx
jb     1190 <loadPrimeNumbers+0x90>
jmp    1130 <loadPrimeNumbers+0x30>
xor    %eax,%eax
mov    $0x2,%ecx
lea    0x2e7b(%rip),%rdx
cs nopw 0x0(%rax,%rax,1)
nop
cmpl   $0x0,-0x80(%rsp,%rcx,4)
jne    11d0 <loadPrimeNumbers+0xd0>
movslq %eax,%rsi
add    $0x1,%eax
mov    %ecx,(%rdx,%rsi,4)
cmp    $0x222de,%rcx
ja     11e4 <loadPrimeNumbers+0xe4>
add    $0x1,%rcx
cmp    $0x32c8,%eax
jl     11c0 <loadPrimeNumbers+0xc0>
lea    0x2e45(%rip),%rax
add    $0x88b08,%rsp
ret

LLVM IR (-O0):
@loadPrimeNumbers.primeNumbers = internal global [13000 x i32] zeroinitializer
define i32* @loadPrimeNumbers() {
%1 = alloca [140000 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 2, i32* %2
br label %5
5: ; preds = %23, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 140000
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = load i32, i32* %2
%10 = mul nsw i32 2, %9
store i32 %10, i32* %3
br label %11
11: ; preds = %18, %8
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 140000
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [140000 x i32], [140000 x i32]* %1, i64 0, i64 %16
store i32 1, i32* %17
br label %18
18: ; preds = %14
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = add nsw i32 %20, %19
store i32 %21, i32* %3
br label %11
22: ; preds = %11
br label %23
23: ; preds = %22
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %5
26: ; preds = %5
store i32 0, i32* %4
store i32 2, i32* %2
br label %27
27: ; preds = %48, %26
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 140000
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 13000
br label %33
33: ; preds = %30, %27
%34 = phi i1 [ false, %27 ], [ %32, %30 ]
br i1 %34, label %35, label %51
35: ; preds = %33
%36 = load i32, i32* %2
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [140000 x i32], [140000 x i32]* %1, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %47
41: ; preds = %35
%42 = load i32, i32* %2
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
%45 = sext i32 %43 to i64
%46 = getelementptr inbounds [13000 x i32], [13000 x i32]* @loadPrimeNumbers.primeNumbers, i64 0, i64 %45
store i32 %42, i32* %46
br label %47
47: ; preds = %41, %35
br label %48
48: ; preds = %47
%49 = load i32, i32* %2
%50 = add nsw i32 %49, 1
store i32 %50, i32* %2
br label %27
51: ; preds = %33
ret i32* getelementptr inbounds ([13000 x i32], [13000 x i32]* @loadPrimeNumbers.primeNumbers, i64 0, i64 0)
}

LLVM IR (-O2):
@loadPrimeNumbers.primeNumbers = internal global [13000 x i32] zeroinitializer
define i32* @loadPrimeNumbers() {
%1 = alloca [140000 x i32]
%2 = bitcast [140000 x i32]* %1 to i8*
br label %3
3: ; preds = %22, %0
%4 = phi i64 [ 2, %0 ], [ %23, %22 ]
%5 = phi i64 [ 4, %0 ], [ %24, %22 ]
%6 = icmp ult i64 %4, 70000
br i1 %6, label %7, label %12
7: ; preds = %3, %7
%8 = phi i64 [ %10, %7 ], [ %5, %3 ]
%9 = getelementptr inbounds [140000 x i32], [140000 x i32]* %1, i64 0, i64 %8
store i32 1, i32* %9
%10 = add nuw nsw i64 %8, %4
%11 = icmp ult i64 %10, 140000
br i1 %11, label %7, label %12
12: ; preds = %7, %3
%13 = or i64 %4, 1
%14 = icmp ult i64 %4, 69999
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = or i64 %5, 2
br label %17
17: ; preds = %17, %15
%18 = phi i64 [ %20, %17 ], [ %16, %15 ]
%19 = getelementptr inbounds [140000 x i32], [140000 x i32]* %1, i64 0, i64 %18
store i32 1, i32* %19
%20 = add nuw nsw i64 %18, %13
%21 = icmp ult i64 %20, 140000
br i1 %21, label %17, label %22
22: ; preds = %17, %12
%23 = add nuw nsw i64 %4, 2
%24 = add nuw nsw i64 %5, 4
%25 = icmp eq i64 %23, 140000
br i1 %25, label %26, label %3
26: ; preds = %22, %37
%27 = phi i64 [ %39, %37 ], [ 2, %22 ]
%28 = phi i32 [ %38, %37 ], [ 0, %22 ]
%29 = getelementptr inbounds [140000 x i32], [140000 x i32]* %1, i64 0, i64 %27
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %26
%33 = add nsw i32 %28, 1
%34 = sext i32 %28 to i64
%35 = getelementptr inbounds [13000 x i32], [13000 x i32]* @loadPrimeNumbers.primeNumbers, i64 0, i64 %34
%36 = trunc i64 %27 to i32
store i32 %36, i32* %35
br label %37
37: ; preds = %26, %32
%38 = phi i32 [ %33, %32 ], [ %28, %26 ]
%39 = add nuw nsw i64 %27, 1
%40 = icmp ult i64 %27, 139999
%41 = icmp slt i32 %38, 13000
%42 = select i1 %40, i1 %41, i1 false
br i1 %42, label %26, label %43
43: ; preds = %37
ret i32* getelementptr inbounds ([13000 x i32], [13000 x i32]* @loadPrimeNumbers.primeNumbers, i64 0, i64 0)
}