#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  if (n < 0 || n > 1000) {
    printf("WRONG\tn = %d is outside of range [%d, %d]", n, 0, 1000);
    return 1;
  }
  printf("OK\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jl     1156 <main+0x36>
cmpl   $0x3e8,-0x8(%rbp)
jle    117a <main+0x5a>
mov    -0x8(%rbp),%esi
lea    0xea3(%rip),%rdi
xor    %edx,%edx
mov    $0x3e8,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    118f <main+0x6f>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
cmp    $0x3e9,%esi
jb     116a <main+0x3a>
lea    0xeae(%rip),%rdi
xor    %edx,%edx
mov    $0x3e8,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [42 x i8] c"WRONG\09n = %d is outside of range [%d, %d]\00"
@.str.2 = [4 x i8] c"OK\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 1000
br i1 %8, label %9, label %12
9: ; preds = %6, %0
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 0, i32 1000)
store i32 1, i32* %1
br label %14
12: ; preds = %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [42 x i8] c"WRONG\09n = %d is outside of range [%d, %d]\00"
@str = [3 x i8] c"OK\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 ugt i32 %4, 1000
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 0, i32 1000)
br label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = phi i32 [ 1, %6 ], [ 0, %8 ]
ret i32 %11
}