#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 find_greatest(int *, int);
int is_four_suits(int hand[]) {
  int temp[4] = {0};
  int i;
  for (i = 0; i < 4; i++) {
    int suit = hand[i] / 13;
    temp[suit]++;
  }
  return (1 == find_greatest(temp, 4));
}


x86 assembly (clang, -O0):
<is_four_suits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    1180 <is_four_suits+0x60>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1143 <is_four_suits+0x23>
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
call   1030 <find_greatest@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_four_suits>:
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movslq (%rdi),%rax
imul   $0x4ec4ec4f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
cltq
addl   $0x1,(%rsp,%rax,4)
movslq 0x4(%rdi),%rax
imul   $0x4ec4ec4f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
cltq
addl   $0x1,(%rsp,%rax,4)
movslq 0x8(%rdi),%rax
imul   $0x4ec4ec4f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
cltq
addl   $0x1,(%rsp,%rax,4)
movslq 0xc(%rdi),%rax
imul   $0x4ec4ec4f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
cltq
addl   $0x1,(%rsp,%rax,4)
mov    %rsp,%rdi
mov    $0x4,%esi
call   1030 <find_greatest@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
mov    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @is_four_suits(i32* %0) {
%2 = alloca i32*
%3 = alloca [4 x i32]
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
%6 = bitcast [4 x i32]* %3 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %22, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %25
10: ; preds = %7
%11 = load i32*, i32** %2
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = sdiv i32 %15, 13
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = add nsw i32 %20, 1
store i32 %21, i32* %19
br label %22
22: ; preds = %10
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %7
25: ; preds = %7
%26 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%27 = call i32 @find_greatest(i32* %26, i32 4)
%28 = icmp eq i32 1, %27
%29 = zext i1 %28 to i32
ret i32 %29
}

LLVM IR (-O2):
define i32 @is_four_suits(i32* nocapture %0) {
%2 = alloca [4 x i32]
%3 = bitcast [4 x i32]* %2 to i8*
%4 = load i32, i32* %0
%5 = sdiv i32 %4, 13
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 %6
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1
store i32 %9, i32* %7
%10 = getelementptr inbounds i32, i32* %0, i64 1
%11 = load i32, i32* %10
%12 = sdiv i32 %11, 13
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
%17 = getelementptr inbounds i32, i32* %0, i64 2
%18 = load i32, i32* %17
%19 = sdiv i32 %18, 13
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1
store i32 %23, i32* %21
%24 = getelementptr inbounds i32, i32* %0, i64 3
%25 = load i32, i32* %24
%26 = sdiv i32 %25, 13
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = add nsw i32 %29, 1
store i32 %30, i32* %28
%31 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%32 = call i32 @find_greatest(i32* %31, i32 4)
%33 = icmp eq i32 %32, 1
%34 = zext i1 %33 to i32
ret i32 %34
}