#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 rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ swap(unsigned char **, unsigned char **);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void jumble(unsigned char arr[][8], int size) {
  srand(time(NULL));
  int x = size - 1;
  for (; x > 0; x--) {
    int j = rand() % (x + 1);
    swap(&arr[x], &arr[j]);
  }
}


x86 assembly (clang, -O0):
<jumble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    11b6 <jumble+0x76>
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
call   1050 <swap@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1168 <jumble+0x28>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jumble>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
cmp    $0x2,%ebp
jl     1189 <jumble+0x49>
mov    %ebp,%ebp
xchg   %ax,%ax
lea    -0x1(%rbp),%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
mov    %ebx,%eax
lea    (%r14,%rax,8),%rdi
movslq %edx,%rax
lea    (%r14,%rax,8),%rsi
call   1050 <swap@plt>
cmp    $0x2,%rbp
mov    %rbx,%rbp
ja     1160 <jumble+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @jumble([8 x i8]* %0, i32 %1) {
%3 = alloca [8 x i8]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store [8 x i8]* %0, [8 x i8]** %3
store i32 %1, i32* %4
%7 = call i32 @time(i32* null)
%8 = call i32 @srand(i32 %7)
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %5
br label %11
11: ; preds = %30, %2
%12 = load i32, i32* %5
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %33
14: ; preds = %11
%15 = call i32 (...) @rand()
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
%18 = srem i32 %15, %17
store i32 %18, i32* %6
%19 = load [8 x i8]*, [8 x i8]** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %19, i64 %21
%23 = bitcast [8 x i8]* %22 to i8**
%24 = load [8 x i8]*, [8 x i8]** %3
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [8 x i8], [8 x i8]* %24, i64 %26
%28 = bitcast [8 x i8]* %27 to i8**
%29 = call i32 @swap(i8** %23, i8** %28)
br label %30
30: ; preds = %14
%31 = load i32, i32* %5
%32 = add nsw i32 %31, -1
store i32 %32, i32* %5
br label %11
33: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @jumble([8 x i8]* %0, i32 %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = icmp sgt i32 %1, 1
br i1 %5, label %6, label %22
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ %7, %6 ], [ %10, %8 ]
%10 = add nsw i64 %9, -1
%11 = tail call i32 (...) @rand()
%12 = trunc i64 %9 to i32
%13 = srem i32 %11, %12
%14 = and i64 %10, 4294967295
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %0, i64 %14
%16 = bitcast [8 x i8]* %15 to i8**
%17 = sext i32 %13 to i64
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %0, i64 %17
%19 = bitcast [8 x i8]* %18 to i8**
%20 = tail call i32 @swap(i8** %16, i8** %19)
%21 = icmp ugt i64 %9, 2
br i1 %21, label %8, label %22
22: ; preds = %8, %2
ret void
}