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

/* Variables and functions */
int /*<<< orphan*/ Eratosthenes(unsigned long *);
int FatalError(char *, long, long);
int /*<<< orphan*/ printf(char *, unsigned long);
int main(void) {
  unsigned long pole[(89000000L - 1L) / (sizeof(unsigned long) * 8) + 2L] = {0};
  pole[0] = (unsigned long)89000000L;
  Eratosthenes(pole);
  unsigned long prims[10] = {0};
  int primIndex = 10;
  for (unsigned long i = (pole[0]) - 1L; (i > 1L && primIndex > 0); i--)
    if ((i < 0 || i >= pole[0]) ? (FatalError("Index %ld mimo rozsah 0..%ld",
                                              (long)i, (long)(pole[0] - 1)),
                                   2)
                                : ((pole[((i) / (sizeof(pole[0]) * 8) + 1L)] &
                                    (1L << (i - ((i / (sizeof(pole[0]) * 8)) *
                                                 (sizeof(pole[0]) * 8)))))
                                       ? 1
                                       : 0) == 0)
      prims[--primIndex] = i;
  for (int i = primIndex; i < 10; i++)
    printf("%lu\n", prims[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa9c190,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xa9c120(%rbp),%rdi
xor    %esi,%esi
mov    $0xa9c110,%edx
call   1040 <memset@plt>
movq   $0x54e0840,-0xa9c120(%rbp)
40 08 4e 05
lea    -0xa9c120(%rbp),%rdi
call   1060 <Eratosthenes@plt>
lea    -0xa9c170(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
movl   $0xa,-0xa9c174(%rbp)
mov    -0xa9c120(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0xa9c180(%rbp)
xor    %eax,%eax
cmpq   $0x1,-0xa9c180(%rbp)
01
mov    %al,-0xa9c185(%rbp)
jbe    11d1 <main+0x91>
cmpl   $0x0,-0xa9c174(%rbp)
setg   %al
mov    %al,-0xa9c185(%rbp)
mov    -0xa9c185(%rbp),%al
test   $0x1,%al
jne    11e4 <main+0xa4>
jmp    12bd <main+0x17d>
cmpq   $0x0,-0xa9c180(%rbp)
jb     1206 <main+0xc6>
mov    -0xa9c180(%rbp),%rax
cmp    -0xa9c120(%rbp),%rax
jb     1233 <main+0xf3>
mov    -0xa9c180(%rbp),%rsi
mov    -0xa9c120(%rbp),%rdx
sub    $0x1,%rdx
lea    0xde1(%rip),%rdi
call   1050 <FatalError@plt>
mov    $0x1,%al
test   $0x1,%al
jne    1281 <main+0x141>
jmp    12a1 <main+0x161>
mov    -0xa9c180(%rbp),%rax
shr    $0x6,%rax
mov    -0xa9c118(%rbp,%rax,8),%rdx
ff
mov    -0xa9c180(%rbp),%rcx
mov    -0xa9c180(%rbp),%rax
shr    $0x6,%rax
shl    $0x6,%rax
sub    %rax,%rcx
mov    $0x1,%eax
shl    %cl,%rax
and    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
cmp    $0x0,%eax
jne    12a1 <main+0x161>
mov    -0xa9c180(%rbp),%rcx
mov    -0xa9c174(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xa9c174(%rbp)
cltq
mov    %rcx,-0xa9c170(%rbp,%rax,8)
ff
jmp    12a6 <main+0x166>
mov    -0xa9c180(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0xa9c180(%rbp)
jmp    11ab <main+0x6b>
mov    -0xa9c174(%rbp),%eax
mov    %eax,-0xa9c184(%rbp)
cmpl   $0xa,-0xa9c184(%rbp)
jge    1305 <main+0x1c5>
movslq -0xa9c184(%rbp),%rax
mov    -0xa9c170(%rbp,%rax,8),%rsi
ff
lea    0xd31(%rip),%rdi
call   1030 <printf@plt>
mov    -0xa9c184(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa9c184(%rbp)
jmp    12c9 <main+0x189>
xor    %eax,%eax
add    $0xa9c190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa9c168,%rsp
lea    0x50(%rsp),%rbx
mov    $0xa9c110,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
movq   $0x54e0840,0x50(%rsp)
4e 05
mov    %rbx,%rdi
call   1060 <Eratosthenes@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    0x50(%rsp),%rdx
lea    -0x1(%rdx),%rax
cmp    $0x2,%rax
jb     1245 <main+0x105>
lea    -0x2(%rdx),%r12
mov    $0xa,%r15d
lea    0xe4e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%r12),%rbx
cmp    %rdx,%rbx
jae    11f0 <main+0xb0>
mov    %rbx,%rax
shr    $0x6,%rax
mov    0x58(%rsp,%rax,8),%rax
bt     %rbx,%rax
jae    11ff <main+0xbf>
cmp    $0x2,%r12
jae    120d <main+0xcd>
jmp    121d <main+0xdd>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffffffffffff,%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <FatalError@plt>
add    $0xffffffff,%r15d
mov    %rbx,(%rsp,%r15,8)
cmp    $0x2,%r12
jb     121d <main+0xdd>
test   %r15d,%r15d
je     121d <main+0xdd>
mov    0x50(%rsp),%rdx
add    $0xffffffffffffffff,%r12
jmp    11c0 <main+0x80>
cmp    $0x9,%r15d
ja     1245 <main+0x105>
mov    %r15d,%ebx
lea    0xdf0(%rip),%r14
nopl   (%rax)
mov    (%rsp,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0xa,%ebx
jne    1230 <main+0xf0>
xor    %eax,%eax
add    $0xa9c168,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Index %ld mimo rozsah 0..%ld\00"
@.str.1 = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1390626 x i64]
%3 = alloca [10 x i64]
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [1390626 x i64]* %2 to i8*
%8 = getelementptr inbounds [1390626 x i64], [1390626 x i64]* %2, i64 0, i64 0
store i64 89000000, i64* %8
%9 = getelementptr inbounds [1390626 x i64], [1390626 x i64]* %2, i64 0, i64 0
%10 = call i32 @Eratosthenes(i64* %9)
%11 = bitcast [10 x i64]* %3 to i8*
store i32 10, i32* %4
%12 = getelementptr inbounds [1390626 x i64], [1390626 x i64]* %2, i64 0, i64 0
%13 = load i64, i64* %12
%14 = sub i64 %13, 1
store i64 %14, i64* %5
br label %15
15: ; preds = %61, %0
%16 = load i64, i64* %5
%17 = icmp ugt i64 %16, 1
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 0
br label %21
21: ; preds = %18, %15
%22 = phi i1 [ false, %15 ], [ %20, %18 ]
br i1 %22, label %23, label %64
23: ; preds = %21
%24 = load i64, i64* %5
%25 = icmp ult i64 %24, 0
br i1 %25, label %31, label %26
26: ; preds = %23
%27 = load i64, i64* %5
%28 = getelementptr inbounds [1390626 x i64], [1390626 x i64]* %2, i64 0, i64 0
%29 = load i64, i64* %28
%30 = icmp uge i64 %27, %29
br i1 %30, label %31, label %37
31: ; preds = %26, %23
%32 = load i64, i64* %5
%33 = getelementptr inbounds [1390626 x i64], [1390626 x i64]* %2, i64 0, i64 0
%34 = load i64, i64* %33
%35 = sub i64 %34, 1
%36 = call i32 @FatalError(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 %32, i64 %35)
br i1 true, label %54, label %60
37: ; preds = %26
%38 = load i64, i64* %5
%39 = udiv i64 %38, 64
%40 = add i64 %39, 1
%41 = getelementptr inbounds [1390626 x i64], [1390626 x i64]* %2, i64 0, i64 %40
%42 = load i64, i64* %41
%43 = load i64, i64* %5
%44 = load i64, i64* %5
%45 = udiv i64 %44, 64
%46 = mul i64 %45, 64
%47 = sub i64 %43, %46
%48 = shl i64 1, %47
%49 = and i64 %42, %48
%50 = icmp ne i64 %49, 0
%51 = zext i1 %50 to i64
%52 = select i1 %50, i32 1, i32 0
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %60
54: ; preds = %37, %31
%55 = load i64, i64* %5
%56 = load i32, i32* %4
%57 = add nsw i32 %56, -1
store i32 %57, i32* %4
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 %58
store i64 %55, i64* %59
br label %60
60: ; preds = %54, %37, %31
br label %61
61: ; preds = %60
%62 = load i64, i64* %5
%63 = add i64 %62, -1
store i64 %63, i64* %5
br label %15
64: ; preds = %21
%65 = load i32, i32* %4
store i32 %65, i32* %6
br label %66
66: ; preds = %75, %64
%67 = load i32, i32* %6
%68 = icmp slt i32 %67, 10
br i1 %68, label %69, label %78
69: ; preds = %66
%70 = load i32, i32* %6
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 %71
%73 = load i64, i64* %72
%74 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %73)
br label %75
75: ; preds = %69
%76 = load i32, i32* %6
%77 = add nsw i32 %76, 1
store i32 %77, i32* %6
br label %66
78: ; preds = %66
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Index %ld mimo rozsah 0..%ld\00"
@.str.1 = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = alloca [1390626 x i64]
%2 = alloca [10 x i64]
%3 = bitcast [1390626 x i64]* %1 to i8*
%4 = getelementptr inbounds [1390626 x i64], [1390626 x i64]* %1, i64 0, i64 0
store i64 89000000, i64* %4
%5 = call i32 @Eratosthenes(i64* %4)
%6 = bitcast [10 x i64]* %2 to i8*
%7 = load i64, i64* %4
%8 = add i64 %7, -1
%9 = icmp ugt i64 %8, 1
br i1 %9, label %14, label %43
10: ; preds = %35
%11 = icmp ult i32 %36, 10
br i1 %11, label %12, label %43
12: ; preds = %10
%13 = zext i32 %36 to i64
br label %44
14: ; preds = %0, %41
%15 = phi i64 [ %42, %41 ], [ %7, %0 ]
%16 = phi i64 [ %37, %41 ], [ %8, %0 ]
%17 = phi i32 [ %36, %41 ], [ 10, %0 ]
%18 = icmp ult i64 %16, %15
br i1 %18, label %22, label %19
19: ; preds = %14
%20 = add i64 %15, -1
%21 = call i32 @FatalError(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 %16, i64 %20)
br label %31
22: ; preds = %14
%23 = lshr i64 %16, 6
%24 = add nuw nsw i64 %23, 1
%25 = getelementptr inbounds [1390626 x i64], [1390626 x i64]* %1, i64 0, i64 %24
%26 = load i64, i64* %25
%27 = and i64 %16, 63
%28 = shl nuw i64 1, %27
%29 = and i64 %26, %28
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %19, %22
%32 = add nsw i32 %17, -1
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds [10 x i64], [10 x i64]* %2, i64 0, i64 %33
store i64 %16, i64* %34
br label %35
35: ; preds = %22, %31
%36 = phi i32 [ %32, %31 ], [ %17, %22 ]
%37 = add i64 %16, -1
%38 = icmp ugt i64 %37, 1
%39 = icmp ne i32 %36, 0
%40 = select i1 %38, i1 %39, i1 false
br i1 %40, label %41, label %10
41: ; preds = %35
%42 = load i64, i64* %4
br label %14
43: ; preds = %44, %0, %10
ret i32 0
44: ; preds = %12, %44
%45 = phi i64 [ %13, %12 ], [ %49, %44 ]
%46 = getelementptr inbounds [10 x i64], [10 x i64]* %2, i64 0, i64 %45
%47 = load i64, i64* %46
%48 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %47)
%49 = add nuw nsw i64 %45, 1
%50 = trunc i64 %49 to i32
%51 = icmp eq i32 %50, 10
br i1 %51, label %43, label %44
}