#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, c, p;
  scanf("%d", &N);
  for (p = N; p <= N * 2; p++) {
    c = check_prime(p);
    if (c == 0)
      break;
  }
  printf("%d", p);
  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,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jg     1193 <main+0x63>
mov    -0x10(%rbp),%edi
call   1030 <check_prime@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1180 <main+0x50>
jmp    1193 <main+0x63>
jmp    1185 <main+0x55>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1155 <main+0x25>
mov    -0x10(%rbp),%esi
lea    0xe63(%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
lea    (%rbx,%rbx,1),%eax
cmp    %eax,%ebx
jle    1160 <main+0x30>
mov    %ebx,%esi
jmp    117a <main+0x4a>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1030 <check_prime@plt>
test   %eax,%eax
je     1151 <main+0x21>
lea    0x1(%rbx),%esi
mov    0xc(%rsp),%eax
add    %eax,%eax
cmp    %eax,%ebx
mov    %esi,%ebx
jl     1160 <main+0x30>
lea    0xe7f(%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
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
store i32 %6, i32* %4
br label %7
7: ; preds = %19, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %2
%10 = mul nsw i32 %9, 2
%11 = icmp sle i32 %8, %10
br i1 %11, label %12, label %22
12: ; preds = %7
%13 = load i32, i32* %4
%14 = call i32 @check_prime(i32 %13)
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12
br label %22
18: ; preds = %12
br label %19
19: ; preds = %18
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %7
22: ; preds = %17, %7
%23 = load i32, i32* %4
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
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 = shl nsw i32 %4, 1
%6 = icmp sgt i32 %4, %5
br i1 %6, label %16, label %7
7: ; preds = %0, %11
%8 = phi i32 [ %12, %11 ], [ %4, %0 ]
%9 = call i32 @check_prime(i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %7
%12 = add nsw i32 %8, 1
%13 = load i32, i32* %1
%14 = shl nsw i32 %13, 1
%15 = icmp slt i32 %8, %14
br i1 %15, label %7, label %16
16: ; preds = %11, %7, %0
%17 = phi i32 [ %4, %0 ], [ %8, %7 ], [ %12, %11 ]
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
ret i32 0
}