#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int *malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ shuffle(int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  srand(time(NULL));
  int *numeros = malloc((1000000 - 1) * sizeof(int));
  if (!numeros)
    exit(EXIT_FAILURE);
  for (int i = 0; i < 1000000 - 1; i++)
    numeros[i] = i + 1;
  shuffle(numeros);
  for (int i = 0; i < 10000; i++)
    printf("%d\n", numeros[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x3d08fc,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a6 <main+0x46>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xf423f,-0x14(%rbp)
jge    11d9 <main+0x79>
mov    -0x14(%rbp),%edx
add    $0x1,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ad <main+0x4d>
mov    -0x10(%rbp),%rdi
call   1030 <shuffle@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x2710,-0x18(%rbp)
jge    121b <main+0xbb>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdf8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11e9 <main+0x89>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x3d08fc,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     1281 <main+0x121>
mov    %rax,%r15
movaps 0xe70(%rip),%xmm0
movaps 0xe79(%rip),%xmm1
mov    $0xc,%eax
pcmpeqd %xmm2,%xmm2
movdqa 0xe78(%rip),%xmm3
movdqa 0xe80(%rip),%xmm4
movdqa 0xe88(%rip),%xmm5
nopl   0x0(%rax,%rax,1)
movaps %xmm1,%xmm6
shufps $0x88,%xmm0,%xmm6
movaps %xmm6,%xmm7
psubd  %xmm2,%xmm7
paddd  %xmm3,%xmm6
movdqu %xmm7,-0x30(%r15,%rax,4)
movdqu %xmm6,-0x20(%r15,%rax,4)
cmp    $0xf423c,%rax
je     1220 <main+0xc0>
movaps %xmm1,%xmm6
paddq  %xmm4,%xmm6
movaps %xmm0,%xmm7
paddq  %xmm4,%xmm7
shufps $0x88,%xmm7,%xmm6
movaps %xmm6,%xmm7
psubd  %xmm2,%xmm7
paddd  %xmm3,%xmm6
movdqu %xmm7,-0x10(%r15,%rax,4)
movdqu %xmm6,(%r15,%rax,4)
paddq  %xmm5,%xmm1
paddq  %xmm5,%xmm0
add    $0x10,%rax
jmp    11c0 <main+0x60>
movaps 0xe29(%rip),%xmm0
movups %xmm0,0x3d08e0(%r15)
movabs $0xf423e000f423d,%rax
mov    %rax,0x3d08f0(%r15)
movl   $0xf423f,0x3d08f8(%r15)
mov    %r15,%rdi
call   1030 <shuffle@plt>
xor    %ebx,%ebx
lea    0xe04(%rip),%r14
nopl   0x0(%rax)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x2710,%rbx
jne    1260 <main+0x100>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
%7 = call i32* @malloc(i32 3999996)
store i32* %7, i32** %2
%8 = load i32*, i32** %2
%9 = icmp ne i32* %8, null
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %0
store i32 0, i32* %3
br label %14
14: ; preds = %24, %13
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 999999
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
%20 = load i32*, i32** %2
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %19, i32* %23
br label %24
24: ; preds = %17
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %14
27: ; preds = %14
%28 = load i32*, i32** %2
%29 = call i32 @shuffle(i32* %28)
store i32 0, i32* %4
br label %30
30: ; preds = %40, %27
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 10000
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = load i32*, i32** %2
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %33
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %30
43: ; preds = %30
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32* @malloc(i32 3999996)
%4 = icmp eq i32* %3, null
br i1 %4, label %30, label %5
5: ; preds = %0, %19
%6 = phi i64 [ %28, %19 ], [ 0, %0 ]
%7 = phi <4 x i64> [ %29, %19 ], [ <i64 0, i64 1, i64 2, i64 3>, %0 ]
%8 = getelementptr inbounds i32, i32* %3, i64 %6
%9 = trunc <4 x i64> %7 to <4 x i32>
%10 = add <4 x i32> %9, <i32 1, i32 1, i32 1, i32 1>
%11 = trunc <4 x i64> %7 to <4 x i32>
%12 = add <4 x i32> %11, <i32 5, i32 5, i32 5, i32 5>
%13 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> %10, <4 x i32>* %13
%14 = getelementptr inbounds i32, i32* %8, i64 4
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> %12, <4 x i32>* %15
%16 = or i64 %6, 8
%17 = add <4 x i64> %7, <i64 8, i64 8, i64 8, i64 8>
%18 = icmp eq i64 %16, 999992
br i1 %18, label %33, label %19
19: ; preds = %5
%20 = getelementptr inbounds i32, i32* %3, i64 %16
%21 = trunc <4 x i64> %17 to <4 x i32>
%22 = add <4 x i32> %21, <i32 1, i32 1, i32 1, i32 1>
%23 = trunc <4 x i64> %17 to <4 x i32>
%24 = add <4 x i32> %23, <i32 5, i32 5, i32 5, i32 5>
%25 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> %22, <4 x i32>* %25
%26 = getelementptr inbounds i32, i32* %20, i64 4
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> %24, <4 x i32>* %27
%28 = add nuw nsw i64 %6, 16
%29 = add <4 x i64> %7, <i64 16, i64 16, i64 16, i64 16>
br label %5
30: ; preds = %0
%31 = load i32, i32* @EXIT_FAILURE
%32 = tail call i32 @exit(i32 %31)
unreachable
33: ; preds = %5
%34 = getelementptr inbounds i32, i32* %3, i64 999992
store i32 999993, i32* %34
%35 = getelementptr inbounds i32, i32* %3, i64 999993
store i32 999994, i32* %35
%36 = getelementptr inbounds i32, i32* %3, i64 999994
store i32 999995, i32* %36
%37 = getelementptr inbounds i32, i32* %3, i64 999995
store i32 999996, i32* %37
%38 = getelementptr inbounds i32, i32* %3, i64 999996
store i32 999997, i32* %38
%39 = getelementptr inbounds i32, i32* %3, i64 999997
store i32 999998, i32* %39
%40 = getelementptr inbounds i32, i32* %3, i64 999998
store i32 999999, i32* %40
%41 = tail call i32 @shuffle(i32* %3)
br label %43
42: ; preds = %43
ret i32 0
43: ; preds = %33, %43
%44 = phi i64 [ 0, %33 ], [ %48, %43 ]
%45 = getelementptr inbounds i32, i32* %3, i64 %44
%46 = load i32, i32* %45
%47 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %46)
%48 = add nuw nsw i64 %44, 1
%49 = icmp eq i64 %48, 10000
br i1 %49, label %42, label %43
}