#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 /*<<< orphan*/ system(char *);
int main(int argc, char **argv) {
  int i;
  int loop;
  system("clear");
  printf("Enter an integer between 1 and 20:\n");
  scanf("%d", &i);
  if ((1 > i) | (i > 20)) {
    printf("You have entered an incorrect value.\n");
    return (-1);
  }
  for (loop = 1; (loop <= i); ++loop) {
    printf("%d ", loop);
  }
  printf("\n");
  for (loop = i; ((loop <= i) & (loop != 0)); loop--) {
    printf("%d ", loop);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <system@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%eax
cmp    -0x14(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x14,-0x14(%rbp)
setg   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
cmp    $0x0,%eax
je     11b2 <main+0x82>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    124b <main+0x11b>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11e4 <main+0xb4>
mov    -0x18(%rbp),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b9 <main+0x89>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x0,-0x18(%rbp)
setne  %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     123d <main+0x10d>
mov    -0x18(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    11f8 <main+0xc8>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1050 <system@plt>
lea    0xea2(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8f(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffeb,%eax
cmp    $0xffffffec,%eax
jae    11a0 <main+0x50>
lea    0xe9c(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
jmp    1216 <main+0xc6>
lea    0xe62(%rip),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
add    $0x1,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    0xc(%rsp),%ebp
jl     11b0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%ebp
test   %ebp,%ebp
je     120a <main+0xba>
add    $0xffffffff,%ebp
lea    0xe28(%rip),%r14
mov    %ebp,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%rbp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0xffffffff,%ebx
jae    120a <main+0xba>
cmp    0xc(%rsp),%ebp
mov    %ebx,%ebp
jle    11f0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [36 x i8] c"Enter an integer between 1 and 20:\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [38 x i8] c"You have entered an incorrect value.\0A\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%11 = load i32, i32* %6
%12 = icmp sgt i32 1, %11
%13 = zext i1 %12 to i32
%14 = load i32, i32* %6
%15 = icmp sgt i32 %14, 20
%16 = zext i1 %15 to i32
%17 = or i32 %13, %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %53
21: ; preds = %2
store i32 1, i32* %7
br label %22
22: ; preds = %29, %21
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %32
26: ; preds = %22
%27 = load i32, i32* %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %22
32: ; preds = %22
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32, i32* %6
store i32 %34, i32* %7
br label %35
35: ; preds = %48, %32
%36 = load i32, i32* %7
%37 = load i32, i32* %6
%38 = icmp sle i32 %36, %37
%39 = zext i1 %38 to i32
%40 = load i32, i32* %7
%41 = icmp ne i32 %40, 0
%42 = zext i1 %41 to i32
%43 = and i32 %39, %42
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %35
%46 = load i32, i32* %7
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %45
%49 = load i32, i32* %7
%50 = add nsw i32 %49, -1
store i32 %50, i32* %7
br label %35
51: ; preds = %35
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %53
53: ; preds = %51, %19
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d \00"
@str = [35 x i8] c"Enter an integer between 1 and 20:\00"
@str.6 = [37 x i8] c"You have entered an incorrect value.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = add i32 %8, -21
%10 = icmp ult i32 %9, -20
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.6, i64 0, i64 0))
br label %33
13: ; preds = %2, %13
%14 = phi i32 [ %16, %13 ], [ 1, %2 ]
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%16 = add nuw nsw i32 %14, 1
%17 = load i32, i32* %3
%18 = icmp slt i32 %14, %17
br i1 %18, label %13, label %19
19: ; preds = %13
%20 = call i32 @putchar(i32 10)
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 0
br i1 %22, label %31, label %23
23: ; preds = %19, %23
%24 = phi i32 [ %26, %23 ], [ %21, %19 ]
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%26 = add nsw i32 %24, -1
%27 = load i32, i32* %3
%28 = icmp sle i32 %26, %27
%29 = icmp ne i32 %26, 0
%30 = and i1 %29, %28
br i1 %30, label %23, label %31
31: ; preds = %23, %19
%32 = call i32 @putchar(i32 10)
br label %33
33: ; preds = %31, %11
%34 = phi i32 [ -1, %11 ], [ 0, %31 ]
ret i32 %34
}