#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 const);
int isOnePair(const int wDeck[][13], const int *hand) {
  int i, card;
  int prevCard = getCardFace(wDeck, hand[0]);
  for (i = 1; i < 5; i++) {
    card = getCardFace(wDeck, hand[i]);
    if (card == prevCard)
      return card;
    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)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1030 <getCardFace@plt>
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    1185 <isOnePair+0x75>
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    -0x24(%rbp),%eax
jne    1171 <isOnePair+0x61>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118c <isOnePair+0x7c>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1139 <isOnePair+0x29>
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
store [13 x i32]* %0, [13 x i32]** %4
store i32* %1, i32** %5
%9 = load [13 x i32]*, [13 x i32]** %4
%10 = bitcast [13 x i32]* %9 to i32**
%11 = load i32*, i32** %5
%12 = getelementptr inbounds i32, i32* %11, i64 0
%13 = load i32, i32* %12
%14 = call i32 @getCardFace(i32** %10, i32 %13)
store i32 %14, i32* %8
store i32 1, i32* %6
br label %15
15: ; preds = %34, %2
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 5
br i1 %17, label %18, label %37
18: ; preds = %15
%19 = load [13 x i32]*, [13 x i32]** %4
%20 = bitcast [13 x i32]* %19 to i32**
%21 = load i32*, i32** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = call i32 @getCardFace(i32** %20, i32 %25)
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = load i32, i32* %8
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %18
%31 = load i32, i32* %7
store i32 %31, i32* %3
br label %38
32: ; preds = %18
%33 = load i32, i32* %7
store i32 %33, i32* %8
br label %34
34: ; preds = %32
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %15
37: ; preds = %15
store i32 -1, i32* %3
br label %38
38: ; preds = %37, %30
%39 = load i32, i32* %3
ret i32 %39
}

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
}