#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 Nnatural(int a[]) {
  int i, n;
  printf("Enter the range\n");
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    a[i] = i + 1;
  printf("Generated\n");
  return n;
}


x86 assembly (clang, -O0):
<Nnatural>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    117a <Nnatural+0x5a>
mov    -0xc(%rbp),%edx
add    $0x1,%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <Nnatural+0x2f>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Nnatural>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xf44(%rip),%rdi
call   1030 <puts@plt>
lea    0xf35(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    124f <Nnatural+0x12f>
cmp    $0x8,%eax
jae    115d <Nnatural+0x3d>
xor    %ecx,%ecx
jmp    1240 <Nnatural+0x120>
mov    %eax,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rsi
mov    %rsi,%rdx
shr    $0x3,%rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     1265 <Nnatural+0x145>
mov    %rdx,%rdi
and    $0xfffffffffffffffe,%rdi
movaps 0xe88(%rip),%xmm1
movaps 0xe91(%rip),%xmm0
xor    %esi,%esi
pcmpeqd %xmm8,%xmm8
movdqa 0xe91(%rip),%xmm9
movdqa 0xe99(%rip),%xmm4
movdqa 0xea1(%rip),%xmm5
movdqa 0xea9(%rip),%xmm6
nopw   0x0(%rax,%rax,1)
movaps %xmm0,%xmm7
shufps $0x88,%xmm1,%xmm7
movaps %xmm7,%xmm2
psubd  %xmm8,%xmm2
movaps %xmm7,%xmm3
paddd  %xmm9,%xmm3
movdqu %xmm2,(%rbx,%rsi,4)
movdqu %xmm3,0x10(%rbx,%rsi,4)
movaps %xmm7,%xmm2
paddd  %xmm4,%xmm2
paddd  %xmm5,%xmm7
movdqu %xmm2,0x20(%rbx,%rsi,4)
movdqu %xmm7,0x30(%rbx,%rsi,4)
add    $0x10,%rsi
paddq  %xmm6,%xmm0
paddq  %xmm6,%xmm1
add    $0xfffffffffffffffe,%rdi
jne    11c0 <Nnatural+0xa0>
shufps $0x88,%xmm1,%xmm0
test   $0x1,%dl
je     1232 <Nnatural+0x112>
pcmpeqd %xmm1,%xmm1
movaps %xmm0,%xmm2
psubd  %xmm1,%xmm2
paddd  0xe09(%rip),%xmm0
movdqu %xmm2,(%rbx,%rsi,4)
movdqu %xmm0,0x10(%rbx,%rsi,4)
cmp    %rax,%rcx
je     124f <Nnatural+0x12f>
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rdx
mov    %edx,(%rbx,%rcx,4)
mov    %rdx,%rcx
cmp    %rdx,%rax
jne    1240 <Nnatural+0x120>
lea    0xe2d(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret
movaps 0xd94(%rip),%xmm0
xor    %esi,%esi
test   $0x1,%dl
jne    1214 <Nnatural+0xf4>
jmp    1232 <Nnatural+0x112>

LLVM IR (-O0):
@.str = [17 x i8] c"Enter the range\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"Generated\0A\00"
define i32 @Nnatural(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %3
br label %7
7: ; preds = %18, %1
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
%14 = load i32*, i32** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
store i32 %13, i32* %17
br label %18
18: ; preds = %11
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %7
21: ; preds = %7
%22 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [16 x i8] c"Enter the range\00"
@str.3 = [10 x i8] c"Generated\00"
define i32 @Nnatural(i32* nocapture writeonly %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %69
8: ; preds = %1
%9 = zext i32 %6 to i64
%10 = icmp ult i32 %6, 8
br i1 %10, label %61, label %11
11: ; preds = %8
%12 = and i64 %9, 4294967288
%13 = add nsw i64 %12, -8
%14 = lshr exact i64 %13, 3
%15 = add nuw nsw i64 %14, 1
%16 = and i64 %15, 1
%17 = icmp eq i64 %13, 0
br i1 %17, label %48, label %18
18: ; preds = %11
%19 = and i64 %15, 4611686018427387902
br label %20
20: ; preds = %20, %18
%21 = phi i64 [ 0, %18 ], [ %42, %20 ]
%22 = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %18 ], [ %43, %20 ]
%23 = phi i64 [ 0, %18 ], [ %44, %20 ]
%24 = getelementptr inbounds i32, i32* %0, i64 %21
%25 = trunc <4 x i64> %22 to <4 x i32>
%26 = add <4 x i32> %25, <i32 1, i32 1, i32 1, i32 1>
%27 = trunc <4 x i64> %22 to <4 x i32>
%28 = add <4 x i32> %27, <i32 5, i32 5, i32 5, i32 5>
%29 = bitcast i32* %24 to <4 x i32>*
store <4 x i32> %26, <4 x i32>* %29
%30 = getelementptr inbounds i32, i32* %24, i64 4
%31 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> %28, <4 x i32>* %31
%32 = or i64 %21, 8
%33 = add <4 x i64> %22, <i64 8, i64 8, i64 8, i64 8>
%34 = getelementptr inbounds i32, i32* %0, i64 %32
%35 = trunc <4 x i64> %33 to <4 x i32>
%36 = add <4 x i32> %35, <i32 1, i32 1, i32 1, i32 1>
%37 = trunc <4 x i64> %33 to <4 x i32>
%38 = add <4 x i32> %37, <i32 5, i32 5, i32 5, i32 5>
%39 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> %36, <4 x i32>* %39
%40 = getelementptr inbounds i32, i32* %34, i64 4
%41 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> %38, <4 x i32>* %41
%42 = add nuw i64 %21, 16
%43 = add <4 x i64> %22, <i64 16, i64 16, i64 16, i64 16>
%44 = add i64 %23, 2
%45 = icmp eq i64 %44, %19
br i1 %45, label %46, label %20
46: ; preds = %20
%47 = trunc <4 x i64> %43 to <4 x i32>
br label %48
48: ; preds = %46, %11
%49 = phi i64 [ 0, %11 ], [ %42, %46 ]
%50 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %11 ], [ %47, %46 ]
%51 = icmp eq i64 %16, 0
br i1 %51, label %59, label %52
52: ; preds = %48
%53 = getelementptr inbounds i32, i32* %0, i64 %49
%54 = add <4 x i32> %50, <i32 1, i32 1, i32 1, i32 1>
%55 = add <4 x i32> %50, <i32 5, i32 5, i32 5, i32 5>
%56 = bitcast i32* %53 to <4 x i32>*
store <4 x i32> %54, <4 x i32>* %56
%57 = getelementptr inbounds i32, i32* %53, i64 4
%58 = bitcast i32* %57 to <4 x i32>*
store <4 x i32> %55, <4 x i32>* %58
br label %59
59: ; preds = %48, %52
%60 = icmp eq i64 %12, %9
br i1 %60, label %69, label %61
61: ; preds = %8, %59
%62 = phi i64 [ 0, %8 ], [ %12, %59 ]
br label %63
63: ; preds = %61, %63
%64 = phi i64 [ %65, %63 ], [ %62, %61 ]
%65 = add nuw nsw i64 %64, 1
%66 = getelementptr inbounds i32, i32* %0, i64 %64
%67 = trunc i64 %65 to i32
store i32 %67, i32* %66
%68 = icmp eq i64 %65, %9
br i1 %68, label %69, label %63
69: ; preds = %63, %59, %1
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.3, i64 0, i64 0))
%71 = load i32, i32* %2
ret i32 %71
}