#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*/ printf(char *, long long);
int main() {
  int primes = 1;
  long long int i, number = 1;
  while (primes < 10001) {
    number += 2;
    for (i = 3; i < number; i += 2) {
      if (number % i == 0)
        break;
    }
    if (i == number)
      primes++;
  }
  printf("%lld", number);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movq   $0x1,-0x18(%rbp)
cmpl   $0x2711,-0x8(%rbp)
jge    11a8 <main+0x98>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
movq   $0x3,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    118c <main+0x7c>
mov    -0x18(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
jne    1176 <main+0x66>
jmp    118c <main+0x7c>
jmp    117b <main+0x6b>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    114f <main+0x3f>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    11a3 <main+0x93>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112e <main+0x1e>
mov    -0x18(%rbp),%rsi
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%r8d
mov    $0x1,%esi
jmp    1137 <main+0x27>
nopl   (%rax)
mov    %rcx,%rax
xor    %ecx,%ecx
cmp    %rsi,%rax
sete   %cl
add    %ecx,%r8d
cmp    $0x2711,%r8d
jae    1189 <main+0x79>
mov    %rsi,%rdi
add    $0x2,%rsi
mov    $0x3,%eax
cmp    $0x2,%rdi
jb     1123 <main+0x13>
mov    $0x3,%ecx
xchg   %ax,%ax
mov    %rsi,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1170 <main+0x60>
mov    %rsi,%rax
xor    %edx,%edx
div    %rcx
test   %rdx,%rdx
jne    117b <main+0x6b>
jmp    1120 <main+0x10>
nopl   0x0(%rax,%rax,1)
mov    %esi,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
je     1120 <main+0x10>
lea    0x2(%rcx),%rax
cmp    %rdi,%rcx
mov    %rax,%rcx
jb     1150 <main+0x40>
jmp    1123 <main+0x13>
push   %rax
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i32 1, i32* %2
store i64 1, i64* %4
br label %5
5: ; preds = %32, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 10001
br i1 %7, label %8, label %33
8: ; preds = %5
%9 = load i64, i64* %4
%10 = add nsw i64 %9, 2
store i64 %10, i64* %4
store i64 3, i64* %3
br label %11
11: ; preds = %22, %8
%12 = load i64, i64* %3
%13 = load i64, i64* %4
%14 = icmp slt i64 %12, %13
br i1 %14, label %15, label %25
15: ; preds = %11
%16 = load i64, i64* %4
%17 = load i64, i64* %3
%18 = srem i64 %16, %17
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
br label %25
21: ; preds = %15
br label %22
22: ; preds = %21
%23 = load i64, i64* %3
%24 = add nsw i64 %23, 2
store i64 %24, i64* %3
br label %11
25: ; preds = %20, %11
%26 = load i64, i64* %3
%27 = load i64, i64* %4
%28 = icmp eq i64 %26, %27
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %32
32: ; preds = %29, %25
br label %5
33: ; preds = %5
%34 = load i64, i64* %4
%35 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
define i32 @main() {
br label %1
1: ; preds = %0, %13
%2 = phi i64 [ 1, %0 ], [ %4, %13 ]
%3 = phi i32 [ 1, %0 ], [ %17, %13 ]
%4 = add nuw nsw i64 %2, 2
%5 = icmp ugt i64 %2, 1
br i1 %5, label %6, label %13
6: ; preds = %1, %10
%7 = phi i64 [ %11, %10 ], [ 3, %1 ]
%8 = urem i64 %4, %7
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = add nuw nsw i64 %7, 2
%12 = icmp ult i64 %7, %2
br i1 %12, label %6, label %13
13: ; preds = %10, %6, %1
%14 = phi i64 [ 3, %1 ], [ %7, %6 ], [ %11, %10 ]
%15 = icmp eq i64 %14, %4
%16 = zext i1 %15 to i32
%17 = add nuw nsw i32 %3, %16
%18 = icmp ult i32 %17, 10001
br i1 %18, label %1, label %19
19: ; preds = %13
%20 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %4)
ret i32 0
}