#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 *, char const *, char const *, char);
int rand();
void shuffleAndDeal(int wDeck[][13], const char *wFace[], const char *wSuit[]) {
  int row;
  int column;
  int card;
  for (card = 1; card <= 52; card++) {
    do {
      row = rand() % 4;
      column = rand() % 13;
    } while (wDeck[row][column] != 0);
    wDeck[row][column] = card;
    printf("%5s of %-8s%c", wFace[column], wSuit[row],
           card % 2 == 0 ? '\n' : '\t');
  }
}


x86 assembly (clang, -O0):
<shuffleAndDeal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x34,-0x24(%rbp)
jg     11fe <shuffleAndDeal+0xde>
jmp    114a <shuffleAndDeal+0x2a>
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x34,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    114a <shuffleAndDeal+0x2a>
mov    -0x24(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x34,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
mov    -0x30(%rbp),%rdx
mov    $0x9,%eax
mov    $0xa,%ecx
cmp    $0x0,%edi
cmove  %ecx,%eax
lea    0xe18(%rip),%rdi
movsbl %al,%ecx
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113b <shuffleAndDeal+0x1b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shuffleAndDeal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
mov    $0x1,%ebp
lea    0xec0(%rip),%r12
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebx
lea    0x3(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffffc,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%rcx
imul   $0x4ec4ec4f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
lea    (%rax,%rax,2),%edx
lea    (%rax,%rdx,4),%eax
sub    %eax,%ecx
movslq %ebx,%rax
movslq %ecx,%rcx
imul   $0x34,%rax,%rdx
add    %r13,%rdx
cmpl   $0x0,(%rdx,%rcx,4)
jne    1140 <shuffleAndDeal+0x20>
lea    (%rdx,%rcx,4),%rdx
mov    %ebp,(%rdx)
mov    (%r15,%rcx,8),%rsi
mov    (%r14,%rax,8),%rdx
mov    %ebp,%eax
and    $0x1,%eax
mov    $0xa,%ecx
sub    %eax,%ecx
mov    %r12,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x35,%ebp
jne    1140 <shuffleAndDeal+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"%5s of %-8s%c\00"
define void @shuffleAndDeal([13 x i32]* nocapture %0, i8** nocapture %1, i8** nocapture %2) {
br label %4
4: ; preds = %3, %16
%5 = phi i32 [ 1, %3 ], [ %25, %16 ]
br label %6
6: ; preds = %4, %6
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 4
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 13
%11 = sext i32 %8 to i64
%12 = sext i32 %10 to i64
%13 = getelementptr inbounds [13 x i32], [13 x i32]* %0, i64 %11, i64 %12
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6
store i32 %5, i32* %13
%17 = getelementptr inbounds i8*, i8** %1, i64 %12
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8*, i8** %2, i64 %11
%20 = load i8*, i8** %19
%21 = and i32 %5, 1
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i8 10, i8 9
%24 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %18, i8* %20, i8 signext %23)
%25 = add nuw nsw i32 %5, 1
%26 = icmp eq i32 %25, 53
br i1 %26, label %27, label %4
27: ; preds = %16
ret void
}