#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 sqrt(long);
int main(void) {
  long count, currentNumber, sum;
  sum = 2;
  for (currentNumber = 3; currentNumber < 2000000000; currentNumber += 2) {
    printf("current number: %li", currentNumber);
    long sqrtNum = sqrt(currentNumber);
    for (count = 3; count < sqrtNum; count = count + 2) {
      if (currentNumber % count == 0)
        break;
    }
    if (count >= sqrtNum) {
      sum += currentNumber;
      printf("yes");
    }
    printf("\n");
  }
  printf("Sum: %li", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x2,-0x20(%rbp)
movq   $0x3,-0x18(%rbp)
cmpq   $0x77359400,-0x18(%rbp)
77
jge    11f8 <main+0xd8>
mov    -0x18(%rbp),%rsi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <sqrt@plt>
mov    %rax,-0x28(%rbp)
movq   $0x3,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    11b1 <main+0x91>
mov    -0x18(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
jne    119b <main+0x7b>
jmp    11b1 <main+0x91>
jmp    11a0 <main+0x80>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    1174 <main+0x54>
mov    -0x10(%rbp),%rax
cmp    -0x28(%rbp),%rax
jl     11d9 <main+0xb9>
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    113f <main+0x1f>
mov    -0x10(%rbp),%rsi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x3,%r12d
lea    0xebb(%rip),%r14
lea    0xec8(%rip),%r15
jmp    1175 <main+0x45>
xchg   %ax,%ax
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x2(%r12),%rax
cmp    $0x773593fe,%r12
mov    %rax,%r12
jae    11da <main+0xaa>
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
call   1050 <sqrt@plt>
mov    $0x3,%ebx
cmp    $0x4,%rax
jl     1150 <main+0x20>
mov    %rax,%rcx
mov    $0x3,%ebx
nopl   (%rax)
mov    %r12,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     11c0 <main+0x90>
mov    %r12,%rax
xor    %edx,%edx
div    %rbx
test   %rdx,%rdx
jne    11cc <main+0x9c>
jmp    115a <main+0x2a>
nopl   0x0(%rax,%rax,1)
mov    %r12d,%eax
xor    %edx,%edx
div    %ebx
test   %rdx,%rdx
je     115a <main+0x2a>
add    $0x2,%rbx
cmp    %rcx,%rbx
jl     11a0 <main+0x70>
jmp    1150 <main+0x20>
lea    0xe37(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"current number: %li\00"
@.str.1 = [4 x i8] c"yes\00"
@.str.3 = [9 x i8] c"Sum: %li\00"
define i32 @main() {
br label %1
1: ; preds = %0, %16
%2 = phi i64 [ 3, %0 ], [ %19, %16 ]
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i64 @sqrt(i64 %2)
%5 = icmp sgt i64 %4, 3
br i1 %5, label %6, label %13
6: ; preds = %1, %10
%7 = phi i64 [ %11, %10 ], [ 3, %1 ]
%8 = urem i64 %2, %7
%9 = icmp eq i64 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %6
%11 = add nuw nsw i64 %7, 2
%12 = icmp slt i64 %11, %4
br i1 %12, label %6, label %13
13: ; preds = %10, %1
%14 = phi i64 [ 3, %1 ], [ %11, %10 ]
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %6, %13
%17 = phi i64 [ %14, %13 ], [ %7, %6 ]
%18 = tail call i32 @putchar(i32 10)
%19 = add nuw nsw i64 %2, 2
%20 = icmp ult i64 %2, 1999999998
br i1 %20, label %1, label %21
21: ; preds = %16
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 %17)
ret i32 0
}