#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int i, j, c = 0, n, flag = 0;
  printf("Enter the value of n :");
  scanf("%d", &n);
  for (i = 2;; i++) {
    for (j = 2; j <= i / 2; j++) {
      if (i % j == 0) {
        printf("%d\n", i);
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      printf("%d\n", i);
      c++;
    }
    flag = 0;
    if (c == n)
      break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x2,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jg     11c7 <main+0xa7>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    11b4 <main+0x94>
mov    -0x8(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    11c7 <main+0xa7>
jmp    11b9 <main+0x99>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1169 <main+0x49>
cmpl   $0x0,-0x18(%rbp)
jne    11eb <main+0xcb>
mov    -0x8(%rbp),%esi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1203 <main+0xe3>
jmp    1216 <main+0xf6>
jmp    1208 <main+0xe8>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1162 <main+0x42>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0x2,%r14d
lea    0xec7(%rip),%r15
mov    $0x2,%ebp
xor    %ebx,%ebx
jmp    1178 <main+0x58>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
add    $0x1,%ebp
cmp    0x4(%rsp),%ebx
je     11be <main+0x9e>
mov    %ebp,%ecx
shr    %ecx
cmp    $0x3,%ecx
cmovb  %r14d,%ecx
cmp    $0x4,%ebp
jb     1160 <main+0x40>
neg    %ecx
mov    $0x2,%esi
nop
mov    %ebp,%eax
xor    %edx,%edx
div    %esi
test   %edx,%edx
je     11b0 <main+0x90>
lea    (%rcx,%rsi,1),%eax
add    $0x1,%eax
mov    %esi,%edx
add    $0x1,%edx
mov    %edx,%esi
cmp    $0x1,%eax
jne    1190 <main+0x70>
jmp    1160 <main+0x40>
xchg   %ax,%ax
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    116f <main+0x4f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [23 x i8] c"Enter the value of n :\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %5
5: ; preds = %23, %0
%6 = phi i32 [ 2, %0 ], [ %27, %23 ]
%7 = phi i32 [ 0, %0 ], [ %24, %23 ]
%8 = lshr i32 %6, 1
%9 = call i32 @llvm.umax.i32(i32 %8, i32 2)
%10 = icmp ult i32 %6, 4
br i1 %10, label %20, label %14
11: ; preds = %14
%12 = add nuw nsw i32 %15, 1
%13 = icmp eq i32 %15, %9
br i1 %13, label %20, label %14
14: ; preds = %5, %11
%15 = phi i32 [ %12, %11 ], [ 2, %5 ]
%16 = urem i32 %6, %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %11
18: ; preds = %14
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %6)
br label %23
20: ; preds = %11, %5
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%22 = add nsw i32 %7, 1
br label %23
23: ; preds = %18, %20
%24 = phi i32 [ %22, %20 ], [ %7, %18 ]
%25 = load i32, i32* %1
%26 = icmp eq i32 %24, %25
%27 = add nuw nsw i32 %6, 1
br i1 %26, label %28, label %5
28: ; preds = %23
ret i32 0
}