#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();
void shuffle(unsigned int wDeck[][13]) {
  size_t row;
  size_t column;
  size_t row2;
  size_t column2;
  unsigned int temp;
  row = 0;
  do {
    column = 0;
    do {
      row2 = rand() % 4;
      column2 = rand() % 13;
      temp = wDeck[row][column];
      wDeck[row][column] = wDeck[row2][column2];
      wDeck[row2][column2] = temp;
      column++;
    } while (column < 13);
    row++;
  } while (row < 4);
  return;
}


x86 assembly (clang, -O0):
<shuffle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xd,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x34,-0x10(%rbp),%rcx
add    %rcx,%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x34,-0x20(%rbp),%rcx
add    %rcx,%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
imul   $0x34,-0x10(%rbp),%rcx
add    %rcx,%rax
mov    -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%edx
mov    -0x8(%rbp),%rax
imul   $0x34,-0x20(%rbp),%rcx
add    %rcx,%rax
mov    -0x28(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0xd,-0x18(%rbp)
jb     112c <shuffle+0x1c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x4,-0x10(%rbp)
jb     1124 <shuffle+0x14>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shuffle>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%eax
movslq %eax,%r15
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
lea    (%rcx,%rdx,4),%ecx
sub    %ecx,%eax
cltq
mov    (%r14,%rbx,4),%ecx
imul   $0x34,%r15,%rdx
add    %r14,%rdx
mov    (%rdx,%rax,4),%esi
mov    %esi,(%r14,%rbx,4)
mov    %ecx,(%rdx,%rax,4)
add    $0x1,%rbx
cmp    $0xd,%rbx
jne    1120 <shuffle+0x10>
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1030 <rand@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%eax
movslq %eax,%r15
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
lea    (%rcx,%rdx,4),%ecx
sub    %ecx,%eax
cltq
mov    0x34(%r14,%rbx,4),%ecx
imul   $0x34,%r15,%rdx
add    %r14,%rdx
mov    (%rdx,%rax,4),%esi
mov    %esi,0x34(%r14,%rbx,4)
mov    %ecx,(%rdx,%rax,4)
add    $0x1,%rbx
cmp    $0xd,%rbx
jne    1180 <shuffle+0x70>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%eax
movslq %eax,%r15
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
lea    (%rcx,%rdx,4),%ecx
sub    %ecx,%eax
cltq
mov    0x68(%r14,%rbx,4),%ecx
imul   $0x34,%r15,%rdx
add    %r14,%rdx
mov    (%rdx,%rax,4),%esi
mov    %esi,0x68(%r14,%rbx,4)
mov    %ecx,(%rdx,%rax,4)
add    $0x1,%rbx
cmp    $0xd,%rbx
jne    11f0 <shuffle+0xe0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%eax
movslq %eax,%r15
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
lea    (%rcx,%rdx,4),%ecx
sub    %ecx,%eax
cltq
mov    0x9c(%r14,%rbx,4),%ecx
imul   $0x34,%r15,%rdx
add    %r14,%rdx
mov    (%rdx,%rax,4),%esi
mov    %esi,0x9c(%r14,%rbx,4)
mov    %ecx,(%rdx,%rax,4)
add    $0x1,%rbx
cmp    $0xd,%rbx
jne    1260 <shuffle+0x150>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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