#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 /*<<< orphan*/ check_format(char *);
int eval_5cards(int, int, int, int, int);
int extract_rank(char);
int extract_suit(char);
int find_card(int, int, int *);
int hand_rank(int);
int /*<<< orphan*/ init_deck(int *);
int /*<<< orphan*/ print_rank(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc != 6) {
    printf("Usage: ./allfive card1 card2 card3 card4 card5\n");
    return -1;
  }
  if (!check_format(argv[1]) || !check_format(argv[2]) ||
      !check_format(argv[3]) || !check_format(argv[4]) ||
      !check_format(argv[5])) {
    printf("Invalid card format\n");
    return -1;
  }
  int deck[52];
  init_deck(deck);
  int r1 = extract_rank(argv[1][0]);
  int s1 = extract_suit(argv[1][1]);
  int r2 = extract_rank(argv[2][0]);
  int s2 = extract_suit(argv[2][1]);
  int r3 = extract_rank(argv[3][0]);
  int s3 = extract_suit(argv[3][1]);
  int r4 = extract_rank(argv[4][0]);
  int s4 = extract_suit(argv[4][1]);
  int r5 = extract_rank(argv[5][0]);
  int s5 = extract_suit(argv[5][1]);
  int c1_index = find_card(r1, s1, deck);
  int c2_index = find_card(r2, s2, deck);
  int c3_index = find_card(r3, s3, deck);
  int c4_index = find_card(r4, s4, deck);
  int c5_index = find_card(r5, s5, deck);
  if (c1_index == -1 || r1 == 99 || s1 == 99)
    printf("!!!!! c1_index is invalid !!!!!\n");
  if (c2_index == -1 || r2 == 99 || s2 == 99)
    printf("!!!!! c2_index is invalid !!!!!\n");
  if (c3_index == -1 || r3 == 99 || s3 == 99)
    printf("!!!!! c3_index is invalid !!!!!\n");
  if (c4_index == -1 || r4 == 99 || s4 == 99)
    printf("!!!!! c4_index is invalid !!!!!\n");
  if (c5_index == -1 || r5 == 99 || s5 == 99)
    printf("!!!!! c5_index is invalid !!!!!\n");
  int c1 = deck[c1_index];
  int c2 = deck[c2_index];
  int c3 = deck[c3_index];
  int c4 = deck[c4_index];
  int c5 = deck[c5_index];
  printf("Hand: %d-%d %d-%d %d-%d %d-%d %d-%d\n", r1, s1, r2, s2, r3, s3, r4,
         s4, r5, s5);
  printf("eval_5cards: %d\n", eval_5cards(c1, c2, c3, c4, c5));
  int rank = hand_rank(eval_5cards(c1, c2, c3, c4, c5));
  print_rank(rank);
  return rank;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x160,%rsp
movl   $0x0,-0x14(%rbp)
mov    %edi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
cmpl   $0x6,-0x18(%rbp)
je     11d0 <main+0x40>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    1626 <main+0x496>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <check_format@plt>
cmp    $0x0,%eax
je     123e <main+0xae>
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <check_format@plt>
cmp    $0x0,%eax
je     123e <main+0xae>
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rdi
call   1090 <check_format@plt>
cmp    $0x0,%eax
je     123e <main+0xae>
mov    -0x20(%rbp),%rax
mov    0x20(%rax),%rdi
call   1090 <check_format@plt>
cmp    $0x0,%eax
je     123e <main+0xae>
mov    -0x20(%rbp),%rax
mov    0x28(%rax),%rdi
call   1090 <check_format@plt>
cmp    $0x0,%eax
jne    1258 <main+0xc8>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    1626 <main+0x496>
lea    -0xf0(%rbp),%rdi
call   1040 <init_deck@plt>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%edi
call   1070 <extract_rank@plt>
mov    %eax,-0xf4(%rbp)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%edi
call   10a0 <extract_suit@plt>
mov    %eax,-0xf8(%rbp)
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%edi
call   1070 <extract_rank@plt>
mov    %eax,-0xfc(%rbp)
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x1(%rax),%edi
call   10a0 <extract_suit@plt>
mov    %eax,-0x100(%rbp)
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rax
movsbl (%rax),%edi
call   1070 <extract_rank@plt>
mov    %eax,-0x104(%rbp)
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rax
movsbl 0x1(%rax),%edi
call   10a0 <extract_suit@plt>
mov    %eax,-0x108(%rbp)
mov    -0x20(%rbp),%rax
mov    0x20(%rax),%rax
movsbl (%rax),%edi
call   1070 <extract_rank@plt>
mov    %eax,-0x10c(%rbp)
mov    -0x20(%rbp),%rax
mov    0x20(%rax),%rax
movsbl 0x1(%rax),%edi
call   10a0 <extract_suit@plt>
mov    %eax,-0x110(%rbp)
mov    -0x20(%rbp),%rax
mov    0x28(%rax),%rax
movsbl (%rax),%edi
call   1070 <extract_rank@plt>
mov    %eax,-0x114(%rbp)
mov    -0x20(%rbp),%rax
mov    0x28(%rax),%rax
movsbl 0x1(%rax),%edi
call   10a0 <extract_suit@plt>
mov    %eax,-0x118(%rbp)
mov    -0xf4(%rbp),%edi
mov    -0xf8(%rbp),%esi
lea    -0xf0(%rbp),%rdx
call   10b0 <find_card@plt>
mov    %eax,-0x11c(%rbp)
mov    -0xfc(%rbp),%edi
mov    -0x100(%rbp),%esi
lea    -0xf0(%rbp),%rdx
call   10b0 <find_card@plt>
mov    %eax,-0x120(%rbp)
mov    -0x104(%rbp),%edi
mov    -0x108(%rbp),%esi
lea    -0xf0(%rbp),%rdx
call   10b0 <find_card@plt>
mov    %eax,-0x124(%rbp)
mov    -0x10c(%rbp),%edi
mov    -0x110(%rbp),%esi
lea    -0xf0(%rbp),%rdx
call   10b0 <find_card@plt>
mov    %eax,-0x128(%rbp)
mov    -0x114(%rbp),%edi
mov    -0x118(%rbp),%esi
lea    -0xf0(%rbp),%rdx
call   10b0 <find_card@plt>
mov    %eax,-0x12c(%rbp)
cmpl   $0xffffffff,-0x11c(%rbp)
je     1402 <main+0x272>
cmpl   $0x63,-0xf4(%rbp)
je     1402 <main+0x272>
cmpl   $0x63,-0xf8(%rbp)
jne    1410 <main+0x280>
lea    0xc3c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0xffffffff,-0x120(%rbp)
je     1437 <main+0x2a7>
cmpl   $0x63,-0xfc(%rbp)
je     1437 <main+0x2a7>
cmpl   $0x63,-0x100(%rbp)
jne    1445 <main+0x2b5>
lea    0xc28(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0xffffffff,-0x124(%rbp)
je     146c <main+0x2dc>
cmpl   $0x63,-0x104(%rbp)
je     146c <main+0x2dc>
cmpl   $0x63,-0x108(%rbp)
jne    147a <main+0x2ea>
lea    0xc14(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0xffffffff,-0x128(%rbp)
je     14a1 <main+0x311>
cmpl   $0x63,-0x10c(%rbp)
je     14a1 <main+0x311>
cmpl   $0x63,-0x110(%rbp)
jne    14af <main+0x31f>
lea    0xc00(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0xffffffff,-0x12c(%rbp)
je     14d6 <main+0x346>
cmpl   $0x63,-0x114(%rbp)
je     14d6 <main+0x346>
cmpl   $0x63,-0x118(%rbp)
jne    14e4 <main+0x354>
lea    0xbec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movslq -0x11c(%rbp),%rax
mov    -0xf0(%rbp,%rax,4),%eax
mov    %eax,-0x130(%rbp)
movslq -0x120(%rbp),%rax
mov    -0xf0(%rbp,%rax,4),%eax
mov    %eax,-0x134(%rbp)
movslq -0x124(%rbp),%rax
mov    -0xf0(%rbp,%rax,4),%eax
mov    %eax,-0x138(%rbp)
movslq -0x128(%rbp),%rax
mov    -0xf0(%rbp,%rax,4),%eax
mov    %eax,-0x13c(%rbp)
movslq -0x12c(%rbp),%rax
mov    -0xf0(%rbp,%rax,4),%eax
mov    %eax,-0x140(%rbp)
mov    -0xf4(%rbp),%esi
mov    -0xf8(%rbp),%edx
mov    -0xfc(%rbp),%ecx
mov    -0x100(%rbp),%r8d
mov    -0x104(%rbp),%r9d
mov    -0x108(%rbp),%r14d
mov    -0x10c(%rbp),%ebx
mov    -0x110(%rbp),%r11d
mov    -0x114(%rbp),%r10d
mov    -0x118(%rbp),%eax
lea    0xb5a(%rip),%rdi
mov    %r14d,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x130(%rbp),%edi
mov    -0x134(%rbp),%esi
mov    -0x138(%rbp),%edx
mov    -0x13c(%rbp),%ecx
mov    -0x140(%rbp),%r8d
call   1050 <eval_5cards@plt>
mov    %eax,%esi
lea    0xb35(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x130(%rbp),%edi
mov    -0x134(%rbp),%esi
mov    -0x138(%rbp),%edx
mov    -0x13c(%rbp),%ecx
mov    -0x140(%rbp),%r8d
call   1050 <eval_5cards@plt>
mov    %eax,%edi
call   1030 <hand_rank@plt>
mov    %eax,-0x144(%rbp)
mov    -0x144(%rbp),%edi
call   1080 <print_rank@plt>
mov    -0x144(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x160,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
cmp    $0x6,%edi
jne    1492 <main+0x2f2>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   10a0 <check_format@plt>
test   %eax,%eax
je     149b <main+0x2fb>
mov    0x10(%rbx),%rdi
call   10a0 <check_format@plt>
test   %eax,%eax
je     149b <main+0x2fb>
mov    0x18(%rbx),%rdi
call   10a0 <check_format@plt>
test   %eax,%eax
je     149b <main+0x2fb>
mov    0x20(%rbx),%rdi
call   10a0 <check_format@plt>
test   %eax,%eax
je     149b <main+0x2fb>
mov    0x28(%rbx),%rdi
call   10a0 <check_format@plt>
test   %eax,%eax
je     149b <main+0x2fb>
lea    0x50(%rsp),%rdi
call   1050 <init_deck@plt>
mov    0x8(%rbx),%rax
movsbl (%rax),%edi
call   1080 <extract_rank@plt>
mov    %eax,%r12d
mov    0x8(%rbx),%rax
movsbl 0x1(%rax),%edi
call   10b0 <extract_suit@plt>
mov    %eax,%r13d
mov    %eax,0x14(%rsp)
mov    0x10(%rbx),%rax
movsbl (%rax),%edi
call   1080 <extract_rank@plt>
mov    %eax,0xc(%rsp)
mov    0x10(%rbx),%rax
movsbl 0x1(%rax),%edi
call   10b0 <extract_suit@plt>
mov    %eax,0x4(%rsp)
mov    0x18(%rbx),%rax
movsbl (%rax),%edi
call   1080 <extract_rank@plt>
mov    %eax,0x8(%rsp)
mov    0x18(%rbx),%rax
movsbl 0x1(%rax),%edi
call   10b0 <extract_suit@plt>
mov    %rax,0x18(%rsp)
mov    0x20(%rbx),%rax
movsbl (%rax),%edi
call   1080 <extract_rank@plt>
mov    %eax,%ebp
mov    0x20(%rbx),%rax
movsbl 0x1(%rax),%edi
call   10b0 <extract_suit@plt>
mov    %eax,%r15d
mov    0x28(%rbx),%rax
movsbl (%rax),%edi
call   1080 <extract_rank@plt>
mov    %eax,%r14d
mov    0x28(%rbx),%rax
movsbl 0x1(%rax),%edi
call   10b0 <extract_suit@plt>
mov    %eax,%ebx
mov    %r12d,%edi
mov    %r13d,%esi
lea    0x50(%rsp),%r13
mov    %r13,%rdx
call   10c0 <find_card@plt>
mov    %eax,0x24(%rsp)
mov    0xc(%rsp),%edi
mov    0x4(%rsp),%esi
mov    %r13,%rdx
call   10c0 <find_card@plt>
mov    %eax,0x2c(%rsp)
mov    0x8(%rsp),%edi
mov    0x18(%rsp),%rsi
mov    %r13,%rdx
call   10c0 <find_card@plt>
mov    %eax,0x28(%rsp)
mov    %rbp,0x48(%rsp)
mov    %ebp,%edi
mov    %r15,0x38(%rsp)
mov    %r15d,%esi
mov    %r13,%rdx
call   10c0 <find_card@plt>
mov    %eax,%ebp
mov    %r14,0x40(%rsp)
mov    %r14d,%edi
mov    0x14(%rsp),%r14d
mov    %rbx,0x30(%rsp)
mov    %ebx,%esi
mov    0x24(%rsp),%ebx
mov    %r13,%rdx
call   10c0 <find_card@plt>
mov    %eax,0x10(%rsp)
mov    %ebx,%r13d
cmp    $0xffffffff,%ebx
je     134f <main+0x1af>
cmp    $0x63,%r12d
je     134f <main+0x1af>
cmp    $0x63,%r14d
jne    135b <main+0x1bb>
lea    0xd74(%rip),%rdi
call   1030 <puts@plt>
mov    0x2c(%rsp),%r14d
cmp    $0xffffffff,%r14d
je     1374 <main+0x1d4>
cmpl   $0x63,0xc(%rsp)
je     1374 <main+0x1d4>
cmpl   $0x63,0x4(%rsp)
jne    1380 <main+0x1e0>
lea    0xd2f(%rip),%rdi
call   1030 <puts@plt>
mov    0x28(%rsp),%ebx
cmp    $0xffffffff,%ebx
je     1397 <main+0x1f7>
cmpl   $0x63,0x8(%rsp)
je     1397 <main+0x1f7>
cmpl   $0x63,0x18(%rsp)
jne    13a3 <main+0x203>
lea    0xcec(%rip),%rdi
call   1030 <puts@plt>
cmp    $0xffffffff,%ebp
je     13b6 <main+0x216>
cmpl   $0x63,0x48(%rsp)
je     13b6 <main+0x216>
cmpl   $0x63,0x38(%rsp)
jne    13c2 <main+0x222>
lea    0xcad(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0xffffffff,0x10(%rsp)
je     13d7 <main+0x237>
cmpl   $0x63,0x40(%rsp)
je     13d7 <main+0x237>
cmpl   $0x63,0x30(%rsp)
jne    13e3 <main+0x243>
lea    0xc6c(%rip),%rdi
call   1030 <puts@plt>
movslq %r13d,%rax
mov    0x50(%rsp,%rax,4),%r13d
movslq %r14d,%rax
mov    0x50(%rsp,%rax,4),%r14d
movslq %ebx,%rax
mov    0x50(%rsp,%rax,4),%r15d
movslq %ebp,%rax
mov    0x50(%rsp,%rax,4),%ebx
movslq 0x10(%rsp),%rax
mov    0x50(%rsp,%rax,4),%ebp
sub    $0x8,%rsp
lea    0xbea(%rip),%rdi
mov    %r12d,%esi
mov    0x1c(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    0x10(%rsp),%r9d
xor    %eax,%eax
push   0x38(%rsp)
push   0x50(%rsp)
push   0x50(%rsp)
push   0x68(%rsp)
push   0x40(%rsp)
call   1070 <printf@plt>
add    $0x30,%rsp
mov    %r13d,%edi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
call   1060 <eval_5cards@plt>
lea    0xbc1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13d,%edi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
call   1060 <eval_5cards@plt>
mov    %eax,%edi
call   1040 <hand_rank@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1090 <print_rank@plt>
jmp    14ac <main+0x30c>
lea    0xc51(%rip),%rdi
jmp    14a2 <main+0x302>
lea    0xb94(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Usage: ./allfive card1 card2 card3 card4 card5\0A\00"
@.str.1 = [21 x i8] c"Invalid card format\0A\00"
@.str.2 = [33 x i8] c"!!!!! c1_index is invalid !!!!!\0A\00"
@.str.3 = [33 x i8] c"!!!!! c2_index is invalid !!!!!\0A\00"
@.str.4 = [33 x i8] c"!!!!! c3_index is invalid !!!!!\0A\00"
@.str.5 = [33 x i8] c"!!!!! c4_index is invalid !!!!!\0A\00"
@.str.6 = [33 x i8] c"!!!!! c5_index is invalid !!!!!\0A\00"
@.str.7 = [37 x i8] c"Hand: %d-%d %d-%d %d-%d %d-%d %d-%d\0A\00"
@.str.8 = [17 x i8] c"eval_5cards: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [52 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 6
br i1 %29, label %30, label %32
30: ; preds = %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %250
32: ; preds = %2
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @check_format(i8* %35)
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %62
38: ; preds = %32
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32 @check_format(i8* %41)
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %62
44: ; preds = %38
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 3
%47 = load i8*, i8** %46
%48 = call i32 @check_format(i8* %47)
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %62
50: ; preds = %44
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 4
%53 = load i8*, i8** %52
%54 = call i32 @check_format(i8* %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %62
56: ; preds = %50
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 5
%59 = load i8*, i8** %58
%60 = call i32 @check_format(i8* %59)
%61 = icmp ne i32 %60, 0
br i1 %61, label %64, label %62
62: ; preds = %56, %50, %44, %38, %32
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %250
64: ; preds = %56
%65 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 0
%66 = call i32 @init_deck(i32* %65)
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 1
%69 = load i8*, i8** %68
%70 = getelementptr inbounds i8, i8* %69, i64 0
%71 = load i8, i8* %70
%72 = call i32 @extract_rank(i8 signext %71)
store i32 %72, i32* %7
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = load i8*, i8** %74
%76 = getelementptr inbounds i8, i8* %75, i64 1
%77 = load i8, i8* %76
%78 = call i32 @extract_suit(i8 signext %77)
store i32 %78, i32* %8
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 2
%81 = load i8*, i8** %80
%82 = getelementptr inbounds i8, i8* %81, i64 0
%83 = load i8, i8* %82
%84 = call i32 @extract_rank(i8 signext %83)
store i32 %84, i32* %9
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 2
%87 = load i8*, i8** %86
%88 = getelementptr inbounds i8, i8* %87, i64 1
%89 = load i8, i8* %88
%90 = call i32 @extract_suit(i8 signext %89)
store i32 %90, i32* %10
%91 = load i8**, i8*** %5
%92 = getelementptr inbounds i8*, i8** %91, i64 3
%93 = load i8*, i8** %92
%94 = getelementptr inbounds i8, i8* %93, i64 0
%95 = load i8, i8* %94
%96 = call i32 @extract_rank(i8 signext %95)
store i32 %96, i32* %11
%97 = load i8**, i8*** %5
%98 = getelementptr inbounds i8*, i8** %97, i64 3
%99 = load i8*, i8** %98
%100 = getelementptr inbounds i8, i8* %99, i64 1
%101 = load i8, i8* %100
%102 = call i32 @extract_suit(i8 signext %101)
store i32 %102, i32* %12
%103 = load i8**, i8*** %5
%104 = getelementptr inbounds i8*, i8** %103, i64 4
%105 = load i8*, i8** %104
%106 = getelementptr inbounds i8, i8* %105, i64 0
%107 = load i8, i8* %106
%108 = call i32 @extract_rank(i8 signext %107)
store i32 %108, i32* %13
%109 = load i8**, i8*** %5
%110 = getelementptr inbounds i8*, i8** %109, i64 4
%111 = load i8*, i8** %110
%112 = getelementptr inbounds i8, i8* %111, i64 1
%113 = load i8, i8* %112
%114 = call i32 @extract_suit(i8 signext %113)
store i32 %114, i32* %14
%115 = load i8**, i8*** %5
%116 = getelementptr inbounds i8*, i8** %115, i64 5
%117 = load i8*, i8** %116
%118 = getelementptr inbounds i8, i8* %117, i64 0
%119 = load i8, i8* %118
%120 = call i32 @extract_rank(i8 signext %119)
store i32 %120, i32* %15
%121 = load i8**, i8*** %5
%122 = getelementptr inbounds i8*, i8** %121, i64 5
%123 = load i8*, i8** %122
%124 = getelementptr inbounds i8, i8* %123, i64 1
%125 = load i8, i8* %124
%126 = call i32 @extract_suit(i8 signext %125)
store i32 %126, i32* %16
%127 = load i32, i32* %7
%128 = load i32, i32* %8
%129 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 0
%130 = call i32 @find_card(i32 %127, i32 %128, i32* %129)
store i32 %130, i32* %17
%131 = load i32, i32* %9
%132 = load i32, i32* %10
%133 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 0
%134 = call i32 @find_card(i32 %131, i32 %132, i32* %133)
store i32 %134, i32* %18
%135 = load i32, i32* %11
%136 = load i32, i32* %12
%137 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 0
%138 = call i32 @find_card(i32 %135, i32 %136, i32* %137)
store i32 %138, i32* %19
%139 = load i32, i32* %13
%140 = load i32, i32* %14
%141 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 0
%142 = call i32 @find_card(i32 %139, i32 %140, i32* %141)
store i32 %142, i32* %20
%143 = load i32, i32* %15
%144 = load i32, i32* %16
%145 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 0
%146 = call i32 @find_card(i32 %143, i32 %144, i32* %145)
store i32 %146, i32* %21
%147 = load i32, i32* %17
%148 = icmp eq i32 %147, -1
br i1 %148, label %155, label %149
149: ; preds = %64
%150 = load i32, i32* %7
%151 = icmp eq i32 %150, 99
br i1 %151, label %155, label %152
152: ; preds = %149
%153 = load i32, i32* %8
%154 = icmp eq i32 %153, 99
br i1 %154, label %155, label %157
155: ; preds = %152, %149, %64
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %157
157: ; preds = %155, %152
%158 = load i32, i32* %18
%159 = icmp eq i32 %158, -1
br i1 %159, label %166, label %160
160: ; preds = %157
%161 = load i32, i32* %9
%162 = icmp eq i32 %161, 99
br i1 %162, label %166, label %163
163: ; preds = %160
%164 = load i32, i32* %10
%165 = icmp eq i32 %164, 99
br i1 %165, label %166, label %168
166: ; preds = %163, %160, %157
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %168
168: ; preds = %166, %163
%169 = load i32, i32* %19
%170 = icmp eq i32 %169, -1
br i1 %170, label %177, label %171
171: ; preds = %168
%172 = load i32, i32* %11
%173 = icmp eq i32 %172, 99
br i1 %173, label %177, label %174
174: ; preds = %171
%175 = load i32, i32* %12
%176 = icmp eq i32 %175, 99
br i1 %176, label %177, label %179
177: ; preds = %174, %171, %168
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
br label %179
179: ; preds = %177, %174
%180 = load i32, i32* %20
%181 = icmp eq i32 %180, -1
br i1 %181, label %188, label %182
182: ; preds = %179
%183 = load i32, i32* %13
%184 = icmp eq i32 %183, 99
br i1 %184, label %188, label %185
185: ; preds = %182
%186 = load i32, i32* %14
%187 = icmp eq i32 %186, 99
br i1 %187, label %188, label %190
188: ; preds = %185, %182, %179
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %190
190: ; preds = %188, %185
%191 = load i32, i32* %21
%192 = icmp eq i32 %191, -1
br i1 %192, label %199, label %193
193: ; preds = %190
%194 = load i32, i32* %15
%195 = icmp eq i32 %194, 99
br i1 %195, label %199, label %196
196: ; preds = %193
%197 = load i32, i32* %16
%198 = icmp eq i32 %197, 99
br i1 %198, label %199, label %201
199: ; preds = %196, %193, %190
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %201
201: ; preds = %199, %196
%202 = load i32, i32* %17
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 %203
%205 = load i32, i32* %204
store i32 %205, i32* %22
%206 = load i32, i32* %18
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 %207
%209 = load i32, i32* %208
store i32 %209, i32* %23
%210 = load i32, i32* %19
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 %211
%213 = load i32, i32* %212
store i32 %213, i32* %24
%214 = load i32, i32* %20
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 %215
%217 = load i32, i32* %216
store i32 %217, i32* %25
%218 = load i32, i32* %21
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds [52 x i32], [52 x i32]* %6, i64 0, i64 %219
%221 = load i32, i32* %220
store i32 %221, i32* %26
%222 = load i32, i32* %7
%223 = load i32, i32* %8
%224 = load i32, i32* %9
%225 = load i32, i32* %10
%226 = load i32, i32* %11
%227 = load i32, i32* %12
%228 = load i32, i32* %13
%229 = load i32, i32* %14
%230 = load i32, i32* %15
%231 = load i32, i32* %16
%232 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i32 %222, i32 %223, i32 %224, i32 %225, i32 %226, i32 %227, i32 %228, i32 %229, i32 %230, i32 %231)
%233 = load i32, i32* %22
%234 = load i32, i32* %23
%235 = load i32, i32* %24
%236 = load i32, i32* %25
%237 = load i32, i32* %26
%238 = call i32 @eval_5cards(i32 %233, i32 %234, i32 %235, i32 %236, i32 %237)
%239 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %238)
%240 = load i32, i32* %22
%241 = load i32, i32* %23
%242 = load i32, i32* %24
%243 = load i32, i32* %25
%244 = load i32, i32* %26
%245 = call i32 @eval_5cards(i32 %240, i32 %241, i32 %242, i32 %243, i32 %244)
%246 = call i32 @hand_rank(i32 %245)
store i32 %246, i32* %27
%247 = load i32, i32* %27
%248 = call i32 @print_rank(i32 %247)
%249 = load i32, i32* %27
store i32 %249, i32* %3
br label %250
250: ; preds = %201, %62, %30
%251 = load i32, i32* %3
ret i32 %251
}

LLVM IR (-O2):
@.str.7 = [37 x i8] c"Hand: %d-%d %d-%d %d-%d %d-%d %d-%d\0A\00"
@.str.8 = [17 x i8] c"eval_5cards: %d\0A\00"
@str = [20 x i8] c"Invalid card format\00"
@str.9 = [32 x i8] c"!!!!! c5_index is invalid !!!!!\00"
@str.10 = [32 x i8] c"!!!!! c4_index is invalid !!!!!\00"
@str.11 = [32 x i8] c"!!!!! c3_index is invalid !!!!!\00"
@str.12 = [32 x i8] c"!!!!! c2_index is invalid !!!!!\00"
@str.13 = [32 x i8] c"!!!!! c1_index is invalid !!!!!\00"
@str.14 = [47 x i8] c"Usage: ./allfive card1 card2 card3 card4 card5\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [52 x i32]
%4 = icmp eq i32 %0, 6
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.14, i64 0, i64 0))
br label %139
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @check_format(i8* %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %32, label %12
12: ; preds = %7
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @check_format(i8* %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %32, label %17
17: ; preds = %12
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = tail call i32 @check_format(i8* %19)
%21 = icmp eq i32 %20, 0
br i1 %21, label %32, label %22
22: ; preds = %17
%23 = getelementptr inbounds i8*, i8** %1, i64 4
%24 = load i8*, i8** %23
%25 = tail call i32 @check_format(i8* %24)
%26 = icmp eq i32 %25, 0
br i1 %26, label %32, label %27
27: ; preds = %22
%28 = getelementptr inbounds i8*, i8** %1, i64 5
%29 = load i8*, i8** %28
%30 = tail call i32 @check_format(i8* %29)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %27, %22, %17, %12, %7
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %139
34: ; preds = %27
%35 = bitcast [52 x i32]* %3 to i8*
%36 = getelementptr inbounds [52 x i32], [52 x i32]* %3, i64 0, i64 0
%37 = call i32 @init_deck(i32* %36)
%38 = load i8*, i8** %8
%39 = load i8, i8* %38
%40 = call i32 @extract_rank(i8 signext %39)
%41 = load i8*, i8** %8
%42 = getelementptr inbounds i8, i8* %41, i64 1
%43 = load i8, i8* %42
%44 = call i32 @extract_suit(i8 signext %43)
%45 = load i8*, i8** %13
%46 = load i8, i8* %45
%47 = call i32 @extract_rank(i8 signext %46)
%48 = load i8*, i8** %13
%49 = getelementptr inbounds i8, i8* %48, i64 1
%50 = load i8, i8* %49
%51 = call i32 @extract_suit(i8 signext %50)
%52 = load i8*, i8** %18
%53 = load i8, i8* %52
%54 = call i32 @extract_rank(i8 signext %53)
%55 = load i8*, i8** %18
%56 = getelementptr inbounds i8, i8* %55, i64 1
%57 = load i8, i8* %56
%58 = call i32 @extract_suit(i8 signext %57)
%59 = load i8*, i8** %23
%60 = load i8, i8* %59
%61 = call i32 @extract_rank(i8 signext %60)
%62 = load i8*, i8** %23
%63 = getelementptr inbounds i8, i8* %62, i64 1
%64 = load i8, i8* %63
%65 = call i32 @extract_suit(i8 signext %64)
%66 = load i8*, i8** %28
%67 = load i8, i8* %66
%68 = call i32 @extract_rank(i8 signext %67)
%69 = load i8*, i8** %28
%70 = getelementptr inbounds i8, i8* %69, i64 1
%71 = load i8, i8* %70
%72 = call i32 @extract_suit(i8 signext %71)
%73 = call i32 @find_card(i32 %40, i32 %44, i32* %36)
%74 = call i32 @find_card(i32 %47, i32 %51, i32* %36)
%75 = call i32 @find_card(i32 %54, i32 %58, i32* %36)
%76 = call i32 @find_card(i32 %61, i32 %65, i32* %36)
%77 = call i32 @find_card(i32 %68, i32 %72, i32* %36)
%78 = icmp eq i32 %73, -1
%79 = icmp eq i32 %40, 99
%80 = select i1 %78, i1 true, i1 %79
%81 = icmp eq i32 %44, 99
%82 = select i1 %80, i1 true, i1 %81
br i1 %82, label %83, label %85
83: ; preds = %34
%84 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.13, i64 0, i64 0))
br label %85
85: ; preds = %34, %83
%86 = icmp eq i32 %74, -1
%87 = icmp eq i32 %47, 99
%88 = select i1 %86, i1 true, i1 %87
%89 = icmp eq i32 %51, 99
%90 = select i1 %88, i1 true, i1 %89
br i1 %90, label %91, label %93
91: ; preds = %85
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.12, i64 0, i64 0))
br label %93
93: ; preds = %85, %91
%94 = icmp eq i32 %75, -1
%95 = icmp eq i32 %54, 99
%96 = select i1 %94, i1 true, i1 %95
%97 = icmp eq i32 %58, 99
%98 = select i1 %96, i1 true, i1 %97
br i1 %98, label %99, label %101
99: ; preds = %93
%100 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.11, i64 0, i64 0))
br label %101
101: ; preds = %93, %99
%102 = icmp eq i32 %76, -1
%103 = icmp eq i32 %61, 99
%104 = select i1 %102, i1 true, i1 %103
%105 = icmp eq i32 %65, 99
%106 = select i1 %104, i1 true, i1 %105
br i1 %106, label %107, label %109
107: ; preds = %101
%108 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.10, i64 0, i64 0))
br label %109
109: ; preds = %101, %107
%110 = icmp eq i32 %77, -1
%111 = icmp eq i32 %68, 99
%112 = select i1 %110, i1 true, i1 %111
%113 = icmp eq i32 %72, 99
%114 = select i1 %112, i1 true, i1 %113
br i1 %114, label %115, label %117
115: ; preds = %109
%116 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0))
br label %117
117: ; preds = %109, %115
%118 = sext i32 %73 to i64
%119 = getelementptr inbounds [52 x i32], [52 x i32]* %3, i64 0, i64 %118
%120 = load i32, i32* %119
%121 = sext i32 %74 to i64
%122 = getelementptr inbounds [52 x i32], [52 x i32]* %3, i64 0, i64 %121
%123 = load i32, i32* %122
%124 = sext i32 %75 to i64
%125 = getelementptr inbounds [52 x i32], [52 x i32]* %3, i64 0, i64 %124
%126 = load i32, i32* %125
%127 = sext i32 %76 to i64
%128 = getelementptr inbounds [52 x i32], [52 x i32]* %3, i64 0, i64 %127
%129 = load i32, i32* %128
%130 = sext i32 %77 to i64
%131 = getelementptr inbounds [52 x i32], [52 x i32]* %3, i64 0, i64 %130
%132 = load i32, i32* %131
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i32 %40, i32 %44, i32 %47, i32 %51, i32 %54, i32 %58, i32 %61, i32 %65, i32 %68, i32 %72)
%134 = call i32 @eval_5cards(i32 %120, i32 %123, i32 %126, i32 %129, i32 %132)
%135 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %134)
%136 = call i32 @eval_5cards(i32 %120, i32 %123, i32 %126, i32 %129, i32 %132)
%137 = call i32 @hand_rank(i32 %136)
%138 = call i32 @print_rank(i32 %137)
br label %139
139: ; preds = %117, %32, %5
%140 = phi i32 [ -1, %5 ], [ %137, %117 ], [ -1, %32 ]
ret i32 %140
}