#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 */
typedef int uint;

/* Variables and functions */
int /*<<< orphan*/ deckShuffle(int *, int);
int eval(int *);
int /*<<< orphan*/ memcpy(int *, int *, int);
int play(int n, uint *cards, int reserved) {
  uint player[7] = {0, 0, 0, 0, 0, 0, 0};
  uint i, t;
  deckShuffle(cards, reserved);
  memcpy(player + 2, cards + 2, sizeof(uint) * 5);
  player[0] = cards[0];
  player[1] = cards[1];
  t = eval(player);
  for (i = 1; i < n; i++) {
    player[0] = cards[5 + i * 2];
    player[1] = cards[6 + i * 2];
    if (eval(player) > t)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<play>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <deckShuffle@plt>
lea    -0x30(%rbp),%rdi
add    $0x8,%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    $0x14,%edx
call   1050 <memcpy@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x30(%rbp),%rdi
call   1060 <eval@plt>
mov    %eax,-0x38(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1217 <play+0xd7>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
add    $0x6,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x30(%rbp),%rdi
call   1060 <eval@plt>
cmp    -0x38(%rbp),%eax
jle    1204 <play+0xc4>
movl   $0x0,-0x4(%rbp)
jmp    121e <play+0xde>
jmp    1209 <play+0xc9>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ae <play+0x6e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<play>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %edi,%r15d
xorps  %xmm0,%xmm0
movups %xmm0,0xc(%rsp)
movaps %xmm0,(%rsp)
mov    %rsi,%rdi
mov    %edx,%esi
call   1030 <deckShuffle@plt>
lea    0x8(%rsp),%rdi
lea    0x8(%rbx),%rsi
mov    $0x14,%edx
call   1040 <memcpy@plt>
mov    (%rbx),%eax
mov    %eax,(%rsp)
mov    0x4(%rbx),%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%rdi
call   1050 <eval@plt>
mov    $0x1,%r14d
cmp    $0x2,%r15d
jl     11ca <play+0x9a>
mov    %eax,%r12d
mov    %r15d,%r13d
add    $0xffffffffffffffff,%r13
xor    %ebp,%ebp
mov    %rsp,%r15
nopl   0x0(%rax)
mov    0x1c(%rbx,%rbp,8),%eax
mov    %eax,(%rsp)
mov    0x20(%rbx,%rbp,8),%eax
mov    %eax,0x4(%rsp)
mov    %r15,%rdi
call   1050 <eval@plt>
cmp    %r12d,%eax
jg     11c7 <play+0x97>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    11a0 <play+0x70>
jmp    11ca <play+0x9a>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @play(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca [7 x i32]
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%11 = bitcast [7 x i32]* %8 to i8*
%12 = load i32*, i32** %6
%13 = load i32, i32* %7
%14 = call i32 @deckShuffle(i32* %12, i32 %13)
%15 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
%16 = getelementptr inbounds i32, i32* %15, i64 2
%17 = load i32*, i32** %6
%18 = getelementptr inbounds i32, i32* %17, i64 2
%19 = call i32 @memcpy(i32* %16, i32* %18, i32 20)
%20 = load i32*, i32** %6
%21 = getelementptr inbounds i32, i32* %20, i64 0
%22 = load i32, i32* %21
%23 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
store i32 %22, i32* %23
%24 = load i32*, i32** %6
%25 = getelementptr inbounds i32, i32* %24, i64 1
%26 = load i32, i32* %25
%27 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 1
store i32 %26, i32* %27
%28 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
%29 = call i32 @eval(i32* %28)
store i32 %29, i32* %10
store i32 1, i32* %9
br label %30
30: ; preds = %57, %3
%31 = load i32, i32* %9
%32 = load i32, i32* %5
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %60
34: ; preds = %30
%35 = load i32*, i32** %6
%36 = load i32, i32* %9
%37 = mul nsw i32 %36, 2
%38 = add nsw i32 5, %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %35, i64 %39
%41 = load i32, i32* %40
%42 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
store i32 %41, i32* %42
%43 = load i32*, i32** %6
%44 = load i32, i32* %9
%45 = mul nsw i32 %44, 2
%46 = add nsw i32 6, %45
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %43, i64 %47
%49 = load i32, i32* %48
%50 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 1
store i32 %49, i32* %50
%51 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
%52 = call i32 @eval(i32* %51)
%53 = load i32, i32* %10
%54 = icmp sgt i32 %52, %53
br i1 %54, label %55, label %56
55: ; preds = %34
store i32 0, i32* %4
br label %61
56: ; preds = %34
br label %57
57: ; preds = %56
%58 = load i32, i32* %9
%59 = add nsw i32 %58, 1
store i32 %59, i32* %9
br label %30
60: ; preds = %30
store i32 1, i32* %4
br label %61
61: ; preds = %60, %55
%62 = load i32, i32* %4
ret i32 %62
}

LLVM IR (-O2):
define i32 @play(i32 %0, i32* %1, i32 %2) {
%4 = alloca [7 x i32]
%5 = bitcast [7 x i32]* %4 to i8*
%6 = tail call i32 @deckShuffle(i32* %1, i32 %2)
%7 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 0
%8 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 2
%9 = getelementptr inbounds i32, i32* %1, i64 2
%10 = call i32 @memcpy(i32* %8, i32* %9, i32 20)
%11 = load i32, i32* %1
store i32 %11, i32* %7
%12 = getelementptr inbounds i32, i32* %1, i64 1
%13 = load i32, i32* %12
%14 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 1
store i32 %13, i32* %14
%15 = call i32 @eval(i32* %7)
%16 = icmp sgt i32 %0, 1
br i1 %16, label %17, label %33
17: ; preds = %3
%18 = zext i32 %0 to i64
br label %21
19: ; preds = %21
%20 = icmp eq i64 %32, %18
br i1 %20, label %33, label %21
21: ; preds = %17, %19
%22 = phi i64 [ 1, %17 ], [ %32, %19 ]
%23 = shl nuw nsw i64 %22, 1
%24 = add nuw nsw i64 %23, 5
%25 = getelementptr inbounds i32, i32* %1, i64 %24
%26 = load i32, i32* %25
store i32 %26, i32* %7
%27 = add nuw nsw i64 %23, 6
%28 = getelementptr inbounds i32, i32* %1, i64 %27
%29 = load i32, i32* %28
store i32 %29, i32* %14
%30 = call i32 @eval(i32* %7)
%31 = icmp sgt i32 %30, %15
%32 = add nuw nsw i64 %22, 1
br i1 %31, label %33, label %19
33: ; preds = %21, %19, %3
%34 = phi i32 [ 1, %3 ], [ 1, %19 ], [ 0, %21 ]
ret i32 %34
}