#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);
  } else {
    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    1170 <main+0x40>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
jmp    11c1 <main+0x91>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     11b2 <main+0x82>
mov    -0xc(%rbp),%edi
call   1030 <check_prime@plt>
cmp    $0x0,%rax
je     119f <main+0x6f>
jmp    11b2 <main+0x82>
jmp    11a4 <main+0x74>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <main+0x46>
mov    -0xc(%rbp),%esi
lea    0xe44(%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
mov    $0x2,%esi
cmp    $0x1,%ebx
je     118c <main+0x5c>
mov    %ebx,%eax
imul   %ebx,%eax
cmp    %eax,%ebx
jle    1170 <main+0x40>
mov    %ebx,%esi
jmp    118c <main+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <check_prime@plt>
test   %rax,%rax
jne    115d <main+0x2d>
lea    0x1(%rbx),%esi
mov    0xc(%rsp),%eax
imul   %eax,%eax
cmp    %eax,%ebx
mov    %esi,%ebx
jl     1170 <main+0x40>
lea    0xe6d(%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 %31
11: ; preds = %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)
br label %31
31: ; preds = %28, %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 %18, label %6
6: ; preds = %0
%7 = mul nsw i32 %4, %4
%8 = icmp sgt i32 %4, %7
br i1 %8, label %18, label %9
9: ; preds = %6, %13
%10 = phi i32 [ %14, %13 ], [ %4, %6 ]
%11 = call i64 @check_prime(i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = add nsw i32 %10, 1
%15 = load i32, i32* %1
%16 = mul nsw i32 %15, %15
%17 = icmp slt i32 %10, %16
br i1 %17, label %9, label %18
18: ; preds = %9, %13, %6, %0
%19 = phi i32 [ 2, %0 ], [ %4, %6 ], [ %10, %9 ], [ %14, %13 ]
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %19)
ret i32 0
}