#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, int);
int sscanf(char *, char *, char *, char *, char *, char *, char *, char *,
           char *, char *, char *, char *);
scalar_t__ winner(char **, char **);
int main(int argc, char *argv[]) {
  int count = 0;
  FILE *hFile = fopen("poker.txt", "r");
  char p1Hand[5][3] = {{0}};
  char p2Hand[5][3] = {{0}};
  char line[64] = {'\0'};
  while (!feof(hFile)) {
    memset(line, '\0', 64);
    if (NULL == fgets(line, 64, hFile))
      break;
    int total_scanned =
        sscanf(line, "%2c %2c %2c %2c %2c %2c %2c %2c %2c %2c", p1Hand[0],
               p1Hand[1], p1Hand[2], p1Hand[3], p1Hand[4], p2Hand[0], p2Hand[1],
               p2Hand[2], p2Hand[3], p2Hand[4]);
    if (total_scanned != 10)
      continue;
    if (winner(p1Hand, p2Hand)) {
      count++;
    }
  }
  fclose(hFile);
  printf("%i", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc8,%rsp
movl   $0x0,-0x1c(%rbp)
mov    %edi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xe54(%rip),%rdi
lea    0xe57(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x38(%rbp)
lea    -0x47(%rbp),%rdi
xor    %esi,%esi
mov    $0xf,%edx
call   1050 <memset@plt>
lea    -0x56(%rbp),%rdi
xor    %esi,%esi
mov    $0xf,%edx
call   1050 <memset@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
mov    -0x38(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    120d <main+0x8d>
jmp    12fd <main+0x17d>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    $0x40,%esi
call   1060 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1248 <main+0xc8>
jmp    12fd <main+0x17d>
lea    -0xa0(%rbp),%rdi
lea    -0x47(%rbp),%rdx
lea    -0x47(%rbp),%rcx
add    $0x3,%rcx
lea    -0x47(%rbp),%r8
add    $0x6,%r8
lea    -0x47(%rbp),%r9
add    $0x9,%r9
lea    -0x47(%rbp),%r15
add    $0xc,%r15
lea    -0x56(%rbp),%r14
lea    -0x56(%rbp),%rbx
add    $0x3,%rbx
lea    -0x56(%rbp),%r11
add    $0x6,%r11
lea    -0x56(%rbp),%r10
add    $0x9,%r10
lea    -0x56(%rbp),%rax
add    $0xc,%rax
lea    0xd6e(%rip),%rsi
mov    %r15,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1080 <sscanf@plt>
mov    %eax,-0xa4(%rbp)
cmpl   $0xa,-0xa4(%rbp)
je     12d8 <main+0x158>
jmp    11ef <main+0x6f>
lea    -0x47(%rbp),%rdi
lea    -0x56(%rbp),%rsi
call   10a0 <winner@plt>
cmp    $0x0,%rax
je     12f8 <main+0x178>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ef <main+0x6f>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x2c(%rbp),%esi
lea    0xd24(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xe6b(%rip),%rdi
lea    0xe6e(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
movq   $0x0,0x17(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x7(%rsp)
movq   $0x0,(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
mov    %rax,%rdi
call   1070 <feof@plt>
xor    %r13d,%r13d
test   %eax,%eax
je     1215 <main+0x95>
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xe38(%rip),%rdi
mov    %r13d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r13d,%r13d
lea    0x20(%rsp),%rbp
mov    %rsp,%r14
lea    0xde5(%rip),%r15
lea    0x10(%rsp),%r12
jmp    123c <main+0xbc>
xchg   %ax,%ax
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    11ed <main+0x6d>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
mov    %rbp,%rdi
mov    $0x40,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11ed <main+0x6d>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
lea    0x13(%rsp),%rcx
lea    0x16(%rsp),%r8
lea    0x19(%rsp),%r9
lea    0xc(%rsp),%rax
push   %rax
lea    0x11(%rsp),%rax
push   %rax
lea    0x16(%rsp),%rax
push   %rax
lea    0x1b(%rsp),%rax
push   %rax
push   %r14
lea    0x44(%rsp),%rax
push   %rax
call   1080 <sscanf@plt>
add    $0x30,%rsp
cmp    $0xa,%eax
jne    1230 <main+0xb0>
mov    %r12,%rdi
mov    %r14,%rsi
call   10a0 <winner@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%r13d
jmp    1230 <main+0xb0>

LLVM IR (-O0):
@.str = [10 x i8] c"poker.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [40 x i8] c"%2c %2c %2c %2c %2c %2c %2c %2c %2c %2c\00"
@.str.3 = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca [5 x [3 x i8]]
%9 = alloca [5 x [3 x i8]]
%10 = alloca [64 x i8]
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%12 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %7
%13 = bitcast [5 x [3 x i8]]* %8 to i8*
%14 = bitcast [5 x [3 x i8]]* %9 to i8*
%15 = bitcast [64 x i8]* %10 to i8*
br label %16
16: ; preds = %65, %54, %2
%17 = load i32*, i32** %7
%18 = call i32 @feof(i32* %17)
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
br i1 %20, label %21, label %66
21: ; preds = %16
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%23 = call i32 @memset(i8* %22, i8 signext 0, i32 64)
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%25 = load i32*, i32** %7
%26 = call i32* @fgets(i8* %24, i32 64, i32* %25)
%27 = icmp eq i32* null, %26
br i1 %27, label %28, label %29
28: ; preds = %21
br label %66
29: ; preds = %21
%30 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%31 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %8, i64 0, i64 0
%32 = getelementptr inbounds [3 x i8], [3 x i8]* %31, i64 0, i64 0
%33 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %8, i64 0, i64 1
%34 = getelementptr inbounds [3 x i8], [3 x i8]* %33, i64 0, i64 0
%35 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %8, i64 0, i64 2
%36 = getelementptr inbounds [3 x i8], [3 x i8]* %35, i64 0, i64 0
%37 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %8, i64 0, i64 3
%38 = getelementptr inbounds [3 x i8], [3 x i8]* %37, i64 0, i64 0
%39 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %8, i64 0, i64 4
%40 = getelementptr inbounds [3 x i8], [3 x i8]* %39, i64 0, i64 0
%41 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %9, i64 0, i64 0
%42 = getelementptr inbounds [3 x i8], [3 x i8]* %41, i64 0, i64 0
%43 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %9, i64 0, i64 1
%44 = getelementptr inbounds [3 x i8], [3 x i8]* %43, i64 0, i64 0
%45 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %9, i64 0, i64 2
%46 = getelementptr inbounds [3 x i8], [3 x i8]* %45, i64 0, i64 0
%47 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %9, i64 0, i64 3
%48 = getelementptr inbounds [3 x i8], [3 x i8]* %47, i64 0, i64 0
%49 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %9, i64 0, i64 4
%50 = getelementptr inbounds [3 x i8], [3 x i8]* %49, i64 0, i64 0
%51 = call i32 @sscanf(i8* %30, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %32, i8* %34, i8* %36, i8* %38, i8* %40, i8* %42, i8* %44, i8* %46, i8* %48, i8* %50)
store i32 %51, i32* %11
%52 = load i32, i32* %11
%53 = icmp ne i32 %52, 10
br i1 %53, label %54, label %55
54: ; preds = %29
br label %16
55: ; preds = %29
%56 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %8, i64 0, i64 0
%57 = bitcast [3 x i8]* %56 to i8**
%58 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %9, i64 0, i64 0
%59 = bitcast [3 x i8]* %58 to i8**
%60 = call i64 @winner(i8** %57, i8** %59)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %55
%63 = load i32, i32* %6
%64 = add nsw i32 %63, 1
store i32 %64, i32* %6
br label %65
65: ; preds = %62, %55
br label %16
66: ; preds = %28, %16
%67 = load i32*, i32** %7
%68 = call i32 @fclose(i32* %67)
%69 = load i32, i32* %6
%70 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %69)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"poker.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [40 x i8] c"%2c %2c %2c %2c %2c %2c %2c %2c %2c %2c\00"
@.str.3 = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x [3 x i8]]
%4 = alloca [5 x [3 x i8]]
%5 = alloca [64 x i8]
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %3, i64 0, i64 0, i64 0
%8 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %4, i64 0, i64 0, i64 0
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%10 = call i32 @feof(i32* %6)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %40
12: ; preds = %2
%13 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %3, i64 0, i64 1, i64 0
%14 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %3, i64 0, i64 2, i64 0
%15 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %3, i64 0, i64 3, i64 0
%16 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %3, i64 0, i64 4, i64 0
%17 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %4, i64 0, i64 1, i64 0
%18 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %4, i64 0, i64 2, i64 0
%19 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %4, i64 0, i64 3, i64 0
%20 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %4, i64 0, i64 4, i64 0
%21 = bitcast [5 x [3 x i8]]* %3 to i8**
%22 = bitcast [5 x [3 x i8]]* %4 to i8**
br label %23
23: ; preds = %12, %36
%24 = phi i32 [ 0, %12 ], [ %37, %36 ]
%25 = call i32 @memset(i8* %9, i8 signext 0, i32 64)
%26 = call i32* @fgets(i8* %9, i32 64, i32* %6)
%27 = icmp eq i32* %26, null
br i1 %27, label %40, label %28
28: ; preds = %23
%29 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %13, i8* %14, i8* %15, i8* %16, i8* %8, i8* %17, i8* %18, i8* %19, i8* %20)
%30 = icmp eq i32 %29, 10
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = call i64 @winner(i8** %21, i8** %22)
%33 = icmp ne i64 %32, 0
%34 = zext i1 %33 to i32
%35 = add nsw i32 %24, %34
br label %36
36: ; preds = %28, %31
%37 = phi i32 [ %35, %31 ], [ %24, %28 ]
%38 = call i32 @feof(i32* %6)
%39 = icmp eq i32 %38, 0
br i1 %39, label %23, label %40
40: ; preds = %36, %23, %2
%41 = phi i32 [ 0, %2 ], [ %24, %23 ], [ %37, %36 ]
%42 = call i32 @fclose(i32* %6)
%43 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %41)
ret i32 0
}