#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int N, i;
  scanf("%d", &N);
  if (N == 1) {
    printf("%d", N + 1);
  }
  for (i = N; i <= N * N; i++) {
    if (check_prime(i)) {
      break;
    }
  }
  printf("%d", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    116b <main+0x3b>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     11ad <main+0x7d>
mov    -0xc(%rbp),%edi
call   1030 <check_prime@plt>
cmp    $0x0,%rax
je     119a <main+0x6a>
jmp    11ad <main+0x7d>
jmp    119f <main+0x6f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1171 <main+0x41>
mov    -0xc(%rbp),%esi
lea    0xe49(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
cmp    $0x1,%ebx
jne    1164 <main+0x34>
lea    0xeaa(%rip),%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%eax
imul   %ebx,%eax
cmp    %eax,%ebx
jle    1180 <main+0x50>
mov    %ebx,%esi
jmp    119c <main+0x6c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <check_prime@plt>
test   %rax,%rax
jne    116d <main+0x3d>
lea    0x1(%rbx),%esi
mov    0xc(%rsp),%eax
imul   %eax,%eax
cmp    %eax,%ebx
mov    %esi,%ebx
jl     1180 <main+0x50>
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\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* %2)
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %7, %0
%12 = load i32, i32* %2
store i32 %12, i32* %3
br label %13
13: ; preds = %25, %11
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = mul nsw i32 %15, %16
%18 = icmp sle i32 %14, %17
br i1 %18, label %19, label %28
19: ; preds = %13
%20 = load i32, i32* %3
%21 = call i64 @check_prime(i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %19
br label %28
24: ; preds = %19
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %13
28: ; preds = %23, %13
%29 = load i32, i32* %3
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %29)
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 %6, label %9
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%8 = load i32, i32* %1
br label %9
9: ; preds = %6, %0
%10 = phi i32 [ %8, %6 ], [ %4, %0 ]
%11 = mul nsw i32 %10, %10
%12 = icmp sgt i32 %10, %11
br i1 %12, label %22, label %13
13: ; preds = %9, %17
%14 = phi i32 [ %18, %17 ], [ %10, %9 ]
%15 = call i64 @check_prime(i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = add nsw i32 %14, 1
%19 = load i32, i32* %1
%20 = mul nsw i32 %19, %19
%21 = icmp slt i32 %14, %20
br i1 %21, label %13, label %22
22: ; preds = %17, %13, %9
%23 = phi i32 [ %10, %9 ], [ %14, %13 ], [ %18, %17 ]
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
ret i32 0
}