#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 dealACard();
int /*<<< orphan*/ printCardName(int const **, int);
int /*<<< orphan*/ rankHand(int const **, int *, int *);
int /*<<< orphan*/ sortHand(int const **, int *);
void dealAHand(const int wDeck[][13], int *wHand) {
  int i;
  int playerHandRank[3] = {0};
  for (i = 0; i < 5; i++)
    wHand[i] = dealACard();
  sortHand(wDeck, wHand);
  for (i = 0; i < 5; i++)
    printCardName(wDeck, wHand[i]);
  rankHand(wDeck, wHand, playerHandRank);
}


x86 assembly (clang, -O0):
<dealAHand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1030 <memset@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    11a3 <dealAHand+0x53>
mov    $0x0,%al
call   1070 <dealACard@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <dealAHand+0x27>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <sortHand@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    11e3 <dealAHand+0x93>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1060 <printCardName@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b7 <dealAHand+0x67>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <rankHand@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dealAHand>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
xor    %eax,%eax
call   1060 <dealACard@plt>
mov    %eax,(%rbx)
xor    %eax,%eax
call   1060 <dealACard@plt>
mov    %eax,0x4(%rbx)
xor    %eax,%eax
call   1060 <dealACard@plt>
mov    %eax,0x8(%rbx)
xor    %eax,%eax
call   1060 <dealACard@plt>
mov    %eax,0xc(%rbx)
xor    %eax,%eax
call   1060 <dealACard@plt>
mov    %eax,0x10(%rbx)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <sortHand@plt>
mov    (%rbx),%esi
mov    %r14,%rdi
call   1050 <printCardName@plt>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
call   1050 <printCardName@plt>
mov    0x8(%rbx),%esi
mov    %r14,%rdi
call   1050 <printCardName@plt>
mov    0xc(%rbx),%esi
mov    %r14,%rdi
call   1050 <printCardName@plt>
mov    0x10(%rbx),%esi
mov    %r14,%rdi
call   1050 <printCardName@plt>
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <rankHand@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @dealAHand([13 x i32]* %0, i32* %1) {
%3 = alloca [3 x i32]
%4 = bitcast [3 x i32]* %3 to i8*
%5 = tail call i32 (...) @dealACard()
store i32 %5, i32* %1
%6 = tail call i32 (...) @dealACard()
%7 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %6, i32* %7
%8 = tail call i32 (...) @dealACard()
%9 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %8, i32* %9
%10 = tail call i32 (...) @dealACard()
%11 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %10, i32* %11
%12 = tail call i32 (...) @dealACard()
%13 = getelementptr inbounds i32, i32* %1, i64 4
store i32 %12, i32* %13
%14 = bitcast [13 x i32]* %0 to i32**
%15 = tail call i32 @sortHand(i32** %14, i32* %1)
%16 = load i32, i32* %1
%17 = tail call i32 @printCardName(i32** %14, i32 %16)
%18 = load i32, i32* %7
%19 = tail call i32 @printCardName(i32** %14, i32 %18)
%20 = load i32, i32* %9
%21 = tail call i32 @printCardName(i32** %14, i32 %20)
%22 = load i32, i32* %11
%23 = tail call i32 @printCardName(i32** %14, i32 %22)
%24 = load i32, i32* %13
%25 = tail call i32 @printCardName(i32** %14, i32 %24)
%26 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%27 = call i32 @rankHand(i32** %14, i32* %1, i32* %26)
ret void
}