#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 check_prime(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int N, i;
  scanf("%d", &N);
  i = N;
  while (i >= N) {
    if (check_prime(i) == 1)
      break;
    i++;
  }
  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>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1185 <main+0x55>
mov    -0xc(%rbp),%edi
call   1030 <check_prime@plt>
cmp    $0x1,%eax
jne    1177 <main+0x47>
jmp    1185 <main+0x55>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1155 <main+0x25>
mov    -0xc(%rbp),%esi
lea    0xe71(%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
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <check_prime@plt>
cmp    $0x1,%eax
je     1165 <main+0x35>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jge    1150 <main+0x20>
lea    0xe94(%rip),%rdi
mov    %ebx,%esi
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
store i32 %5, i32* %3
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp sge i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i32, i32* %3
%12 = call i32 @check_prime(i32 %11)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %10
br label %18
15: ; preds = %10
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %6
18: ; preds = %14, %6
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %19)
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
br label %5
5: ; preds = %0, %9
%6 = phi i32 [ %10, %9 ], [ %4, %0 ]
%7 = call i32 @check_prime(i32 %6)
%8 = icmp eq i32 %7, 1
br i1 %8, label %13, label %9
9: ; preds = %5
%10 = add nsw i32 %6, 1
%11 = load i32, i32* %1
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %5
13: ; preds = %9, %5
%14 = phi i32 [ %10, %9 ], [ %6, %5 ]
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}