#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 */
typedef int k;
typedef int j;

/* Variables and functions */
int rand();
void fatShuffle(int X[((5 + 2) * (10 + 2))]) {
  int j, k, tmp;
  for (k = (5 * 10) - 1; k > 0; k--) {
    j = (rand() % (k + 1));
    tmp = X[((5 + 3) + (j) + 2 * ((j) / 5))];
    X[((5 + 3) + (j) + 2 * ((j) / 5))] = X[((5 + 3) + (k) + 2 * ((k) / 5))];
    X[((5 + 3) + (k) + 2 * ((k) / 5))] = tmp;
  }
}


x86 assembly (clang, -O0):
<fatShuffle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x31,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1208 <fatShuffle+0xf8>
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0xc(%rbp),%ecx
add    $0x8,%ecx
mov    -0xc(%rbp),%eax
mov    $0x5,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x48(%rbp),%rax
shl    $0x1,%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%ecx
add    $0x8,%ecx
mov    -0x10(%rbp),%eax
mov    $0x5,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x40(%rbp),%rax
shl    $0x1,%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%ecx
add    $0x8,%ecx
mov    -0xc(%rbp),%eax
mov    $0x5,%esi
cltd
idiv   %esi
mov    -0x34(%rbp),%edx
mov    %eax,%esi
mov    -0x30(%rbp),%rax
shl    $0x1,%esi
add    %esi,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%ecx
add    $0x8,%ecx
mov    -0x10(%rbp),%eax
mov    $0x5,%esi
cltd
idiv   %esi
mov    -0x24(%rbp),%edx
mov    %eax,%esi
mov    -0x20(%rbp),%rax
shl    $0x1,%esi
add    %esi,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <fatShuffle+0x13>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fatShuffle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x31,%r15d
mov    $0x32,%ebx
mov    $0x39,%r13d
mov    $0xcccccccd,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,%ebp
imul   %r12,%rbp
shr    $0x21,%rbp
and    $0xfffffffe,%ebp
add    %r13d,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
movslq %edx,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x21,%rcx
add    %edx,%ecx
lea    (%rax,%rcx,2),%eax
add    $0x8,%eax
cltq
mov    (%r14,%rax,4),%ecx
mov    (%r14,%rbp,4),%edx
mov    %edx,(%r14,%rax,4)
mov    %ecx,(%r14,%rbp,4)
add    $0xffffffff,%r15d
add    $0xffffffff,%ebx
add    $0xffffffff,%r13d
cmp    $0x1,%ebx
ja     1140 <fatShuffle+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fatShuffle(i32* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 49, %1 ], [ %21, %2 ]
%4 = tail call i32 (...) @rand()
%5 = add nuw nsw i32 %3, 1
%6 = srem i32 %4, %5
%7 = add nsw i32 %6, 8
%8 = sdiv i32 %6, 5
%9 = shl nsw i32 %8, 1
%10 = add nsw i32 %7, %9
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = add nuw nsw i32 %3, 8
%15 = udiv i32 %3, 5
%16 = shl nuw nsw i32 %15, 1
%17 = add nuw nsw i32 %14, %16
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
store i32 %20, i32* %12
store i32 %13, i32* %19
%21 = add nsw i32 %3, -1
%22 = icmp ugt i32 %3, 1
br i1 %22, label %2, label %23
23: ; preds = %2
ret void
}