#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 getCardFace(int const **, int);
int isOnePair(const int wDeck[][13], int hand[]) {
  int i, card, count = 1;
  int prevCard = getCardFace(wDeck, hand[0]);
  for (i = 1; i < 5; i++) {
    card = getCardFace(wDeck, hand[i]);
    if (card == prevCard) {
      count++;
      if (count == 2) {
        return card;
      }
    } else
      count = 1;
    prevCard = card;
  }
  return -1;
}


x86 assembly (clang, -O0):
<isOnePair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1030 <getCardFace@plt>
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    11ab <isOnePair+0x9b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <getCardFace@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jne    1190 <isOnePair+0x80>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jne    118b <isOnePair+0x7b>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b2 <isOnePair+0xa2>
jmp    1197 <isOnePair+0x87>
movl   $0x1,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1140 <isOnePair+0x30>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isOnePair>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
mov    (%rsi),%esi
call   1030 <getCardFace@plt>
mov    %eax,%ebp
mov    0x4(%r12),%esi
mov    %r14,%rdi
call   1030 <getCardFace@plt>
cmp    %ebp,%eax
je     1184 <isOnePair+0x74>
mov    %eax,%ebx
mov    0x8(%r12),%esi
mov    %r14,%rdi
call   1030 <getCardFace@plt>
mov    %ebx,%ebp
cmp    %ebx,%eax
je     1184 <isOnePair+0x74>
mov    %eax,%r13d
mov    0xc(%r12),%esi
mov    %r14,%rdi
call   1030 <getCardFace@plt>
mov    %r13d,%ebp
cmp    %r13d,%eax
je     1184 <isOnePair+0x74>
mov    %eax,%r15d
mov    0x10(%r12),%esi
mov    %r14,%rdi
call   1030 <getCardFace@plt>
cmp    %r15d,%eax
mov    $0xffffffff,%ebp
cmove  %r15d,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isOnePair([13 x i32]* %0, i32* nocapture %1) {
%3 = bitcast [13 x i32]* %0 to i32**
%4 = load i32, i32* %1
%5 = tail call i32 @getCardFace(i32** %3, i32 %4)
%6 = getelementptr inbounds i32, i32* %1, i64 1
%7 = load i32, i32* %6
%8 = tail call i32 @getCardFace(i32** %3, i32 %7)
%9 = icmp eq i32 %8, %5
br i1 %9, label %26, label %10
10: ; preds = %2
%11 = getelementptr inbounds i32, i32* %1, i64 2
%12 = load i32, i32* %11
%13 = tail call i32 @getCardFace(i32** %3, i32 %12)
%14 = icmp eq i32 %13, %8
br i1 %14, label %26, label %15
15: ; preds = %10
%16 = getelementptr inbounds i32, i32* %1, i64 3
%17 = load i32, i32* %16
%18 = tail call i32 @getCardFace(i32** %3, i32 %17)
%19 = icmp eq i32 %18, %13
br i1 %19, label %26, label %20
20: ; preds = %15
%21 = getelementptr inbounds i32, i32* %1, i64 4
%22 = load i32, i32* %21
%23 = tail call i32 @getCardFace(i32** %3, i32 %22)
%24 = icmp eq i32 %23, %18
%25 = select i1 %24, i32 %18, i32 -1
br label %26
26: ; preds = %20, %15, %10, %2
%27 = phi i32 [ %5, %2 ], [ %8, %10 ], [ %13, %15 ], [ %25, %20 ]
ret i32 %27
}