#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 *, ...);
int /*<<< orphan*/ rangeAndSuitOfCard(int const, char *, char *);
void printCardsOnHand(const int card[]) {
  int i;
  for (i = 0; i < 20; i++) {
    if (i % 5 == 0) {
      printf("P%d: ", i / 5 + 1);
    }
    char range, suit;
    rangeAndSuitOfCard(card[i], &range, &suit);
    printf("%c%c ", range, suit);
    if (i % 5 == 4) {
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<printCardsOnHand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x14,-0xc(%rbp)
jge    11d2 <printCardsOnHand+0xb2>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116f <printCardsOnHand+0x4f>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
add    $0x1,%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
lea    -0xd(%rbp),%rsi
lea    -0xe(%rbp),%rdx
call   1040 <rangeAndSuitOfCard@plt>
movsbl -0xd(%rbp),%esi
movsbl -0xe(%rbp),%edx
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x4,%edx
jne    11bf <printCardsOnHand+0x9f>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c4 <printCardsOnHand+0xa4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <printCardsOnHand+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printCardsOnHand>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0x6(%rsp),%r12
lea    0xebc(%rip),%r13
xor    %ebp,%ebp
jmp    115a <printCardsOnHand+0x2a>
xchg   %ax,%ax
add    $0x1,%rbp
cmp    $0x14,%rbp
je     11c8 <printCardsOnHand+0x98>
movzbl %bpl,%eax
imul   $0xcd,%eax,%eax
shr    $0xa,%eax
lea    (%rax,%rax,4),%ecx
neg    %ecx
movzbl %cl,%r14d
lea    (%r14,%rbp,1),%rcx
test   %cl,%cl
jne    118b <printCardsOnHand+0x5b>
add    $0x1,%al
movzbl %al,%esi
lea    0xe7c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%r14,%rbp,1),%rbx
add    $0xfffffffffffffffc,%rbx
mov    (%r15,%rbp,4),%edi
lea    0x7(%rsp),%rsi
mov    %r12,%rdx
call   1050 <rangeAndSuitOfCard@plt>
movsbl 0x7(%rsp),%esi
movsbl 0x6(%rsp),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %bl,%bl
jne    1150 <printCardsOnHand+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <printCardsOnHand+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"P%d: \00"
@.str.1 = [6 x i8] c"%c%c \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @printCardsOnHand(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i32* %0, i32** %2
store i32 0, i32* %3
br label %6
6: ; preds = %36, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 20
br i1 %8, label %9, label %39
9: ; preds = %6
%10 = load i32, i32* %3
%11 = srem i32 %10, 5
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = load i32, i32* %3
%15 = sdiv i32 %14, 5
%16 = add nsw i32 %15, 1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %13, %9
%19 = load i32*, i32** %2
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
%24 = call i32 @rangeAndSuitOfCard(i32 %23, i8* %4, i8* %5)
%25 = load i8, i8* %4
%26 = sext i8 %25 to i32
%27 = load i8, i8* %5
%28 = sext i8 %27 to i32
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 %28)
%30 = load i32, i32* %3
%31 = srem i32 %30, 5
%32 = icmp eq i32 %31, 4
br i1 %32, label %33, label %35
33: ; preds = %18
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33, %18
br label %36
36: ; preds = %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %6
39: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"P%d: \00"
@.str.1 = [6 x i8] c"%c%c \00"
define void @printCardsOnHand(i32* nocapture %0) {
%2 = alloca i8
%3 = alloca i8
br label %4
4: ; preds = %1, %26
%5 = phi i64 [ 0, %1 ], [ %27, %26 ]
%6 = trunc i64 %5 to i8
%7 = urem i8 %6, 5
%8 = udiv i8 %6, 5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = add nuw nsw i8 %8, 1
%12 = zext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %10, %4
%15 = getelementptr inbounds i32, i32* %0, i64 %5
%16 = load i32, i32* %15
%17 = call i32 @rangeAndSuitOfCard(i32 %16, i8* %2, i8* %3)
%18 = load i8, i8* %2
%19 = sext i8 %18 to i32
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %21)
%23 = icmp eq i8 %7, 4
br i1 %23, label %24, label %26
24: ; preds = %14
%25 = call i32 @putchar(i32 10)
br label %26
26: ; preds = %24, %14
%27 = add nuw nsw i64 %5, 1
%28 = icmp eq i64 %27, 20
br i1 %28, label %29, label %4
29: ; preds = %26
ret void
}