#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);
int rand();
int /*<<< orphan*/ swap(int *, int *);
int main(int argc, char *argv[]) {
  int perm[256];
  int i, j, k;
  for (i = 0; i < 256; ++i) {
    perm[i] = i;
  }
  for (i = 0; i < 256; ++i) {
    j = rand() % 256;
    k = rand() % 256;
    swap(&perm[j], &perm[k]);
  }
  printf("%d", perm[0]);
  for (i = 1; i < 256; ++i) {
    printf(", %d", perm[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x414(%rbp)
cmpl   $0x100,-0x414(%rbp)
jge    118b <main+0x5b>
mov    -0x414(%rbp),%ecx
movslq -0x414(%rbp),%rax
mov    %ecx,-0x410(%rbp,%rax,4)
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    1153 <main+0x23>
movl   $0x0,-0x414(%rbp)
cmpl   $0x100,-0x414(%rbp)
jge    1212 <main+0xe2>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x418(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x41c(%rbp)
movslq -0x418(%rbp),%rax
lea    -0x410(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
movslq -0x41c(%rbp),%rax
lea    -0x410(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
call   1040 <swap@plt>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    1195 <main+0x65>
mov    -0x410(%rbp),%esi
lea    0xde3(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x414(%rbp)
cmpl   $0x100,-0x414(%rbp)
jge    126c <main+0x13c>
movslq -0x414(%rbp),%rax
mov    -0x410(%rbp,%rax,4),%esi
lea    0xdad(%rip),%rdi
call   1030 <printf@plt>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    122e <main+0xfe>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x408,%rsp
movdqa 0xebf(%rip),%xmm0
xor    %eax,%eax
movdqa 0xec4(%rip),%xmm8
movdqa 0xecb(%rip),%xmm9
movdqa 0xed2(%rip),%xmm10
movdqa 0xeda(%rip),%xmm4
movdqa 0xee2(%rip),%xmm5
movdqa 0xeea(%rip),%xmm6
movdqa 0xef2(%rip),%xmm7
movdqa 0xefa(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqa %xmm0,(%rsp,%rax,4)
movdqa %xmm2,0x10(%rsp,%rax,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqa %xmm2,0x20(%rsp,%rax,4)
movdqa %xmm3,0x30(%rsp,%rax,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqa %xmm2,0x40(%rsp,%rax,4)
movdqa %xmm3,0x50(%rsp,%rax,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqa %xmm2,0x60(%rsp,%rax,4)
movdqa %xmm3,0x70(%rsp,%rax,4)
add    $0x20,%rax
paddd  %xmm1,%xmm0
cmp    $0x100,%rax
jne    1190 <main+0x60>
mov    $0x100,%ebp
nop
xor    %eax,%eax
call   1050 <rand@plt>
mov    %eax,%ebx
lea    0xff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffffff00,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
lea    0xff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffff00,%ecx
sub    %ecx,%eax
movslq %ebx,%rcx
lea    (%rsp,%rcx,4),%rdi
cltq
lea    (%rsp,%rax,4),%rsi
call   1040 <swap@plt>
add    $0xffffffff,%ebp
jne    1210 <main+0xe0>
mov    (%rsp),%esi
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%ebp
lea    0xe19(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rsp,%rbp,4),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    $0x100,%rbp
jne    1280 <main+0x150>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c", %d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %10
10: ; preds = %18, %2
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 256
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i32, i32* %7
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 %16
store i32 %14, i32* %17
br label %18
18: ; preds = %13
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %10
21: ; preds = %10
store i32 0, i32* %7
br label %22
22: ; preds = %37, %21
%23 = load i32, i32* %7
%24 = icmp slt i32 %23, 256
br i1 %24, label %25, label %40
25: ; preds = %22
%26 = call i32 (...) @rand()
%27 = srem i32 %26, 256
store i32 %27, i32* %8
%28 = call i32 (...) @rand()
%29 = srem i32 %28, 256
store i32 %29, i32* %9
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 %31
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 %34
%36 = call i32 @swap(i32* %32, i32* %35)
br label %37
37: ; preds = %25
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %22
40: ; preds = %22
%41 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 0
%42 = load i32, i32* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %42)
store i32 1, i32* %7
br label %44
44: ; preds = %53, %40
%45 = load i32, i32* %7
%46 = icmp slt i32 %45, 256
br i1 %46, label %47, label %56
47: ; preds = %44
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %47
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %44
56: ; preds = %44
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c", %d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i32]
%4 = bitcast [256 x i32]* %3 to i8*
br label %5
5: ; preds = %5, %2
%6 = phi i64 [ 0, %2 ], [ %34, %5 ]
%7 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %2 ], [ %35, %5 ]
%8 = add <4 x i32> %7, <i32 4, i32 4, i32 4, i32 4>
%9 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %6
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> %7, <4 x i32>* %10
%11 = getelementptr inbounds i32, i32* %9, i64 4
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> %8, <4 x i32>* %12
%13 = or i64 %6, 8
%14 = add <4 x i32> %7, <i32 8, i32 8, i32 8, i32 8>
%15 = add <4 x i32> %7, <i32 12, i32 12, i32 12, i32 12>
%16 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %13
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> %14, <4 x i32>* %17
%18 = getelementptr inbounds i32, i32* %16, i64 4
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> %15, <4 x i32>* %19
%20 = or i64 %6, 16
%21 = add <4 x i32> %7, <i32 16, i32 16, i32 16, i32 16>
%22 = add <4 x i32> %7, <i32 20, i32 20, i32 20, i32 20>
%23 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %20
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> %21, <4 x i32>* %24
%25 = getelementptr inbounds i32, i32* %23, i64 4
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> %22, <4 x i32>* %26
%27 = or i64 %6, 24
%28 = add <4 x i32> %7, <i32 24, i32 24, i32 24, i32 24>
%29 = add <4 x i32> %7, <i32 28, i32 28, i32 28, i32 28>
%30 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %27
%31 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> %28, <4 x i32>* %31
%32 = getelementptr inbounds i32, i32* %30, i64 4
%33 = bitcast i32* %32 to <4 x i32>*
store <4 x i32> %29, <4 x i32>* %33
%34 = add nuw nsw i64 %6, 32
%35 = add <4 x i32> %7, <i32 32, i32 32, i32 32, i32 32>
%36 = icmp eq i64 %34, 256
br i1 %36, label %37, label %5
37: ; preds = %5, %37
%38 = phi i32 [ %48, %37 ], [ 0, %5 ]
%39 = call i32 (...) @rand()
%40 = srem i32 %39, 256
%41 = call i32 (...) @rand()
%42 = srem i32 %41, 256
%43 = sext i32 %40 to i64
%44 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %43
%45 = sext i32 %42 to i64
%46 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %45
%47 = call i32 @swap(i32* %44, i32* %46)
%48 = add nuw nsw i32 %38, 1
%49 = icmp eq i32 %48, 256
br i1 %49, label %50, label %37
50: ; preds = %37
%51 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 0
%52 = load i32, i32* %51
%53 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %50, %54
%55 = phi i64 [ 1, %50 ], [ %59, %54 ]
%56 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %57)
%59 = add nuw nsw i64 %55, 1
%60 = icmp eq i64 %59, 256
br i1 %60, label %61, label %54
61: ; preds = %54
ret i32 0
}