#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, i;
  scanf("%d", &n);
  if (n < 0 || n > 1000) {
    printf("WRONG\tn = %d is outside of range [%d, %d]", n, 0, 1000);
    return 1;
  }
  for (i = 0; i < 100; i++) {
    printf("A");
  }
  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    11bc <main+0x9c>
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jge    11a7 <main+0x87>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1181 <main+0x61>
lea    0xe81(%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   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x3e8,%esi
jbe    117e <main+0x3e>
lea    0xe9a(%rip),%rdi
xor    %edx,%edx
mov    $0x3e8,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
jmp    11ad <main+0x6d>
mov    $0x64,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x41,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1190 <main+0x50>
lea    0xe87(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
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 = [2 x i8] c"A\00"
@.str.3 = [4 x i8] c"OK\0A\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 slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 1000
br i1 %9, label %10, label %13
10: ; preds = %7, %0
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 0, i32 1000)
store i32 1, i32* %1
br label %24
13: ; preds = %7
store i32 0, i32* %3
br label %14
14: ; preds = %19, %13
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 100
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %14
22: ; preds = %14
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %24
24: ; preds = %22, %10
%25 = load i32, i32* %1
ret i32 %25
}

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 %15
8: ; preds = %0, %8
%9 = phi i32 [ %11, %8 ], [ 0, %0 ]
%10 = call i32 @putchar(i32 65)
%11 = add nuw nsw i32 %9, 1
%12 = icmp eq i32 %11, 100
br i1 %12, label %13, label %8
13: ; preds = %8
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %6
%16 = phi i32 [ 1, %6 ], [ 0, %13 ]
ret i32 %16
}