#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 */
unsigned int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  unsigned int max;
  unsigned int num;
  unsigned int count;
  unsigned int i;
  unsigned char found;
  if (3 != argc) {
    fprintf(stderr, "usage: %s <start> <n>\n", argv[0]);
    return 1;
  }
  num = atoi(argv[1]);
  max = atoi(argv[2]);
  count = 0;
  while (count < max) {
    found = 1;
    for (i = 2; i < num; i++) {
      if (num % i == 0) {
        found = 0;
        break;
      }
    }
    if (found) {
      printf("%i\n", num);
      count++;
    }
    num++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
je     117c <main+0x4c>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe95(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    122a <main+0xfa>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1223 <main+0xf3>
movb   $0x1,-0x21(%rbp)
movl   $0x2,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    11f3 <main+0xc3>
mov    -0x18(%rbp),%eax
xor    %edx,%edx
divl   -0x20(%rbp)
cmp    $0x0,%edx
jne    11e0 <main+0xb0>
movb   $0x0,-0x21(%rbp)
jmp    11f3 <main+0xc3>
jmp    11e5 <main+0xb5>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ba <main+0x8a>
cmpb   $0x0,-0x21(%rbp)
je     1215 <main+0xe5>
mov    -0x18(%rbp),%esi
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a3 <main+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbp
cmp    $0x3,%edi
jne    11a3 <main+0x73>
mov    0x10(%rbp),%rdi
call   1050 <atoi@plt>
test   %eax,%eax
je     11c3 <main+0x93>
mov    %eax,%r15d
mov    0x8(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
xor    %ebx,%ebx
lea    0xeb4(%rip),%r14
jmp    1185 <main+0x55>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
add    $0x1,%ebp
cmp    %r15d,%ebx
jae    11c3 <main+0x93>
cmp    $0x3,%ebp
jb     1170 <main+0x40>
mov    $0x2,%ecx
nop
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
test   %edx,%edx
je     117d <main+0x4d>
add    $0x1,%ecx
cmp    %ecx,%ebp
jne    1190 <main+0x60>
jmp    1170 <main+0x40>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xe49(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    11c5 <main+0x95>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"usage: %s <start> <n>\0A\00"
@.str.1 = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 3, %11
br i1 %12, label %13, label %19
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %17)
store i32 1, i32* %3
br label %59
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %7
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %6
store i32 0, i32* %8
br label %28
28: ; preds = %55, %19
%29 = load i32, i32* %8
%30 = load i32, i32* %6
%31 = icmp ult i32 %29, %30
br i1 %31, label %32, label %58
32: ; preds = %28
store i8 1, i8* %10
store i32 2, i32* %9
br label %33
33: ; preds = %44, %32
%34 = load i32, i32* %9
%35 = load i32, i32* %7
%36 = icmp ult i32 %34, %35
br i1 %36, label %37, label %47
37: ; preds = %33
%38 = load i32, i32* %7
%39 = load i32, i32* %9
%40 = urem i32 %38, %39
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %37
store i8 0, i8* %10
br label %47
43: ; preds = %37
br label %44
44: ; preds = %43
%45 = load i32, i32* %9
%46 = add i32 %45, 1
store i32 %46, i32* %9
br label %33
47: ; preds = %42, %33
%48 = load i8, i8* %10
%49 = icmp ne i8 %48, 0
br i1 %49, label %50, label %55
50: ; preds = %47
%51 = load i32, i32* %7
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %8
%54 = add i32 %53, 1
store i32 %54, i32* %8
br label %55
55: ; preds = %50, %47
%56 = load i32, i32* %7
%57 = add i32 %56, 1
store i32 %57, i32* %7
br label %28
58: ; preds = %28
store i32 0, i32* %3
br label %59
59: ; preds = %58, %13
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"usage: %s <start> <n>\0A\00"
@.str.1 = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %35
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %35, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
br label %17
17: ; preds = %13, %31
%18 = phi i32 [ %32, %31 ], [ 0, %13 ]
%19 = phi i32 [ %33, %31 ], [ %16, %13 ]
%20 = icmp ugt i32 %19, 2
br i1 %20, label %23, label %28
21: ; preds = %23
%22 = icmp eq i32 %27, %19
br i1 %22, label %28, label %23
23: ; preds = %17, %21
%24 = phi i32 [ %27, %21 ], [ 2, %17 ]
%25 = urem i32 %19, %24
%26 = icmp eq i32 %25, 0
%27 = add nuw i32 %24, 1
br i1 %26, label %31, label %21
28: ; preds = %21, %17
%29 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%30 = add i32 %18, 1
br label %31
31: ; preds = %23, %28
%32 = phi i32 [ %30, %28 ], [ %18, %23 ]
%33 = add i32 %19, 1
%34 = icmp ult i32 %32, %11
br i1 %34, label %17, label %35
35: ; preds = %31, %8, %4
%36 = phi i32 [ 1, %4 ], [ 0, %8 ], [ 0, %31 ]
ret i32 %36
}