#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 clock_t;

/* Variables and functions */
int clock();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned long long *);
long long sqrt(unsigned long long);
int main() {
  clock_t start, finish;
  unsigned long long int s, f;
  printf("Enter your starting number: ");
  scanf("%lld", &s);
  printf("Enter your finishing number: ");
  scanf("%lld", &f);
  start = clock();
  if (s > f)
    printf("Wrong information!\a\nstarting number is bigger.\a\n");
  else if (s < 1 || f < 2)
    printf("\aError!\a");
  else {
    if (s % 2 == 0)
      s = (s + 1);
    unsigned long long int x;
    long long int y, y2;
    char a = 0;
    char z;
    printf("\nThe first prime is: 2\nYour requirements are given bellow:\n\n");
    for (x = s; x <= f; x = x + 2) {
      y2 = sqrt(x);
      z = 1;
      for (y = 3; y <= y2; y = y + 2) {
        if (x % y == 0) {
          z = 0;
          break;
        }
      }
      if (z == 1) {
        printf("%lld,\t", x);
        a++;
        if (a % 10 == 0) {
          printf("\n");
          a = 0;
        }
      }
    }
    printf("\n\n");
  }
  finish = clock();
  printf("TIME: %d.%.3d sec \n\n", (finish - start) / 1000,
         (finish - start) % 1000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    11b6 <main+0x76>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12fd <main+0x1bd>
cmpq   $0x1,-0x18(%rbp)
jb     11cc <main+0x8c>
cmpq   $0x2,-0x20(%rbp)
jae    11df <main+0x9f>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f8 <main+0x1b8>
mov    -0x18(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    11fd <main+0xbd>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
movb   $0x0,-0x39(%rbp)
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
ja     12ea <main+0x1aa>
mov    -0x28(%rbp),%rdi
call   1060 <sqrt@plt>
mov    %rax,-0x38(%rbp)
movb   $0x1,-0x3a(%rbp)
movq   $0x3,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x38(%rbp),%rax
jg     1281 <main+0x141>
mov    -0x28(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x30(%rbp)
cmp    $0x0,%rdx
jne    126b <main+0x12b>
movb   $0x0,-0x3a(%rbp)
jmp    1281 <main+0x141>
jmp    1270 <main+0x130>
mov    -0x30(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
jmp    123e <main+0xfe>
movsbl -0x3a(%rbp),%eax
cmp    $0x1,%eax
jne    12d4 <main+0x194>
mov    -0x28(%rbp),%rsi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x39(%rbp),%al
add    $0x1,%al
mov    %al,-0x39(%rbp)
movsbl -0x39(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12cf <main+0x18f>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x0,-0x39(%rbp)
jmp    12d4 <main+0x194>
jmp    12d9 <main+0x199>
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
jmp    1217 <main+0xd7>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12fd <main+0x1bd>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe9e(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %eax,%r14d
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rcx
cmp    %rcx,%rax
jbe    11c9 <main+0x69>
lea    0xeda(%rip),%rdi
jmp    1200 <main+0xa0>
test   %rax,%rax
je     1207 <main+0xa7>
cmp    $0x1,%rcx
jbe    1207 <main+0xa7>
test   $0x1,%al
jne    11e1 <main+0x81>
add    $0x1,%rax
mov    %rax,0x10(%rsp)
lea    0xe7d(%rip),%rdi
call   1040 <puts@plt>
mov    0x10(%rsp),%rbx
cmp    0x8(%rsp),%rbx
jbe    1259 <main+0xf9>
lea    0xe63(%rip),%rdi
call   1040 <puts@plt>
jmp    1215 <main+0xb5>
lea    0xe32(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
sub    %r14d,%eax
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x26,%rsi
add    %eax,%esi
imul   $0x3e8,%esi,%eax
sub    %eax,%edx
lea    0xe0b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xde9(%rip),%r15
xor    %ebp,%ebp
jmp    129f <main+0x13f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%bpl
movzbl %bpl,%eax
imul   $0xffffffcd,%eax,%eax
add    $0x18,%al
ror    %al
cmp    $0x18,%al
jbe    1300 <main+0x1a0>
add    $0x2,%rbx
cmp    0x8(%rsp),%rbx
ja     11f9 <main+0x99>
mov    %rbx,%rdi
call   1080 <sqrt@plt>
cmp    $0x3,%rax
jl     1270 <main+0x110>
mov    %rax,%rcx
mov    $0x3,%esi
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     12e0 <main+0x180>
mov    %rbx,%rax
xor    %edx,%edx
div    %rsi
jmp    12e6 <main+0x186>
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%eax
xor    %edx,%edx
div    %esi
test   %rdx,%rdx
je     1290 <main+0x130>
add    $0x2,%rsi
cmp    %rcx,%rsi
jle    12c0 <main+0x160>
jmp    1270 <main+0x110>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
jmp    1290 <main+0x130>

LLVM IR (-O0):
@.str = [29 x i8] c"Enter your starting number: \00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [30 x i8] c"Enter your finishing number: \00"
@.str.3 = [49 x i8] c"Wrong information!\07\0Astarting number is bigger.\07\0A\00"
@.str.4 = [9 x i8] c"\07Error!\07\00"
@.str.5 = [61 x i8] c"\0AThe first prime is: 2\0AYour requirements are given bellow:\0A\0A\00"
@.str.6 = [7 x i8] c"%lld,\09\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [3 x i8] c"\0A\0A\00"
@.str.9 = [21 x i8] c"TIME: %d.%.3d sec \0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8
%10 = alloca i8
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %4)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %5)
%15 = call i32 (...) @clock()
store i32 %15, i32* %2
%16 = load i64, i64* %4
%17 = load i64, i64* %5
%18 = icmp ugt i64 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
br label %83
21: ; preds = %0
%22 = load i64, i64* %4
%23 = icmp ult i64 %22, 1
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i64, i64* %5
%26 = icmp ult i64 %25, 2
br i1 %26, label %27, label %29
27: ; preds = %24, %21
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %82
29: ; preds = %24
%30 = load i64, i64* %4
%31 = urem i64 %30, 2
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = load i64, i64* %4
%35 = add i64 %34, 1
store i64 %35, i64* %4
br label %36
36: ; preds = %33, %29
store i8 0, i8* %9
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0))
%38 = load i64, i64* %4
store i64 %38, i64* %6
br label %39
39: ; preds = %77, %36
%40 = load i64, i64* %6
%41 = load i64, i64* %5
%42 = icmp ule i64 %40, %41
br i1 %42, label %43, label %80
43: ; preds = %39
%44 = load i64, i64* %6
%45 = call i64 @sqrt(i64 %44)
store i64 %45, i64* %8
store i8 1, i8* %10
store i64 3, i64* %7
br label %46
46: ; preds = %57, %43
%47 = load i64, i64* %7
%48 = load i64, i64* %8
%49 = icmp sle i64 %47, %48
br i1 %49, label %50, label %60
50: ; preds = %46
%51 = load i64, i64* %6
%52 = load i64, i64* %7
%53 = urem i64 %51, %52
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %50
store i8 0, i8* %10
br label %60
56: ; preds = %50
br label %57
57: ; preds = %56
%58 = load i64, i64* %7
%59 = add nsw i64 %58, 2
store i64 %59, i64* %7
br label %46
60: ; preds = %55, %46
%61 = load i8, i8* %10
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 1
br i1 %63, label %64, label %76
64: ; preds = %60
%65 = load i64, i64* %6
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i64 %65)
%67 = load i8, i8* %9
%68 = add i8 %67, 1
store i8 %68, i8* %9
%69 = load i8, i8* %9
%70 = sext i8 %69 to i32
%71 = srem i32 %70, 10
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %64
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i8 0, i8* %9
br label %75
75: ; preds = %73, %64
br label %76
76: ; preds = %75, %60
br label %77
77: ; preds = %76
%78 = load i64, i64* %6
%79 = add i64 %78, 2
store i64 %79, i64* %6
br label %39
80: ; preds = %39
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %82
82: ; preds = %80, %27
br label %83
83: ; preds = %82, %19
%84 = call i32 (...) @clock()
store i32 %84, i32* %3
%85 = load i32, i32* %3
%86 = load i32, i32* %2
%87 = sub nsw i32 %85, %86
%88 = sdiv i32 %87, 1000
%89 = load i32, i32* %3
%90 = load i32, i32* %2
%91 = sub nsw i32 %89, %90
%92 = srem i32 %91, 1000
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %88, i32 %92)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Enter your starting number: \00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [30 x i8] c"Enter your finishing number: \00"
@.str.4 = [9 x i8] c"\07Error!\07\00"
@.str.6 = [7 x i8] c"%lld,\09\00"
@.str.9 = [21 x i8] c"TIME: %d.%.3d sec \0A\0A\00"
@str = [60 x i8] c"\0AThe first prime is: 2\0AYour requirements are given bellow:\0A\00"
@str.10 = [2 x i8] c"\0A\00"
@str.11 = [48 x i8] c"Wrong information!\07\0Astarting number is bigger.\07\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%9 = call i32 (...) @clock()
%10 = load i64, i64* %1
%11 = load i64, i64* %2
%12 = icmp ugt i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.11, i64 0, i64 0))
br label %57
15: ; preds = %0
%16 = icmp eq i64 %10, 0
%17 = icmp ult i64 %11, 2
%18 = select i1 %16, i1 true, i1 %17
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %57
21: ; preds = %15
%22 = and i64 %10, 1
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = add nuw i64 %10, 1
store i64 %25, i64* %1
br label %26
26: ; preds = %24, %21
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
%28 = load i64, i64* %1
%29 = load i64, i64* %2
%30 = icmp ugt i64 %28, %29
br i1 %30, label %55, label %31
31: ; preds = %26, %50
%32 = phi i8 [ %51, %50 ], [ 0, %26 ]
%33 = phi i64 [ %52, %50 ], [ %28, %26 ]
%34 = call i64 @sqrt(i64 %33)
%35 = icmp slt i64 %34, 3
br i1 %35, label %43, label %38
36: ; preds = %38
%37 = icmp sgt i64 %42, %34
br i1 %37, label %43, label %38
38: ; preds = %31, %36
%39 = phi i64 [ %42, %36 ], [ 3, %31 ]
%40 = urem i64 %33, %39
%41 = icmp eq i64 %40, 0
%42 = add nuw nsw i64 %39, 2
br i1 %41, label %50, label %36
43: ; preds = %36, %31
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i64 %33)
%45 = add i8 %32, 1
%46 = srem i8 %45, 10
%47 = icmp eq i8 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %43
%49 = call i32 @putchar(i32 10)
br label %50
50: ; preds = %38, %48, %43
%51 = phi i8 [ 0, %48 ], [ %45, %43 ], [ %32, %38 ]
%52 = add i64 %33, 2
%53 = load i64, i64* %2
%54 = icmp ugt i64 %52, %53
br i1 %54, label %55, label %31
55: ; preds = %50, %26
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
br label %57
57: ; preds = %19, %55, %13
%58 = call i32 (...) @clock()
%59 = sub nsw i32 %58, %9
%60 = sdiv i32 %59, 1000
%61 = srem i32 %59, 1000
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %60, i32 %61)
ret i32 0
}