#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 */
scalar_t__ check_prime(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, N;
  scanf("%d", &N);
  a = 0;
  if (N == 1)
    printf("2");
  else {
    while (a == 0) {
      if (check_prime(N)) {
        printf("%d", N);
        a = 1;
      } else
        N = N + 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1173 <main+0x43>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11c4 <main+0x94>
jmp    1178 <main+0x48>
cmpl   $0x0,-0x8(%rbp)
jne    11bf <main+0x8f>
mov    -0xc(%rbp),%edi
call   1030 <check_prime@plt>
cmp    $0x0,%rax
je     11b1 <main+0x81>
mov    -0xc(%rbp),%esi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
jmp    11ba <main+0x8a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1178 <main+0x48>
jmp    11c4 <main+0x94>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
cmp    $0x1,%edi
jne    1170 <main+0x30>
mov    $0x32,%edi
call   1030 <putchar@plt>
jmp    1197 <main+0x57>
nopw   0x0(%rax,%rax,1)
call   1040 <check_prime@plt>
mov    0x4(%rsp),%esi
test   %rax,%rax
jne    1189 <main+0x49>
add    $0x1,%esi
mov    %esi,0x4(%rsp)
mov    %esi,%edi
jmp    1170 <main+0x30>
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"2\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %2
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %25
9: ; preds = %0
br label %10
10: ; preds = %23, %9
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = load i32, i32* %3
%15 = call i64 @check_prime(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 1, i32* %2
br label %23
20: ; preds = %13
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %23
23: ; preds = %20, %17
br label %10
24: ; preds = %10
br label %25
25: ; preds = %24, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 1
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = call i64 @check_prime(i32 %4)
%8 = icmp eq i64 %7, 0
%9 = load i32, i32* %1
br i1 %8, label %12, label %18
10: ; preds = %0
%11 = call i32 @putchar(i32 50)
br label %21
12: ; preds = %6, %12
%13 = phi i32 [ %17, %12 ], [ %9, %6 ]
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
%15 = call i64 @check_prime(i32 %14)
%16 = icmp eq i64 %15, 0
%17 = load i32, i32* %1
br i1 %16, label %12, label %18
18: ; preds = %12, %6
%19 = phi i32 [ %9, %6 ], [ %17, %12 ]
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %10
ret i32 0
}