#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 get_card_value(char *);
int /*<<< orphan*/ read_input(char *, char *, char *);
int /*<<< orphan*/ update_card_count(int, int *);
int main() {
  char card_name[3];
  int val;
  int count = 0;
  do {
    read_input("Enter the card name: ", "%2s", card_name);
    val = get_card_value(card_name);
    update_card_count(val, &count);
  } while (card_name[0] != 'X');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x7(%rbp),%rdx
lea    0xeaf(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1050 <read_input@plt>
lea    -0x7(%rbp),%rdi
call   1030 <get_card_value@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <update_card_count@plt>
movsbl -0x7(%rbp),%eax
cmp    $0x58,%eax
jne    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeb9(%rip),%r14
lea    0xec8(%rip),%r15
lea    0x1(%rsp),%rbx
lea    0x4(%rsp),%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <read_input@plt>
mov    %rbx,%rdi
call   1030 <get_card_value@plt>
mov    %eax,%edi
mov    %r12,%rsi
call   1040 <update_card_count@plt>
cmpb   $0x58,0x1(%rsp)
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter the card name: \00"
@.str.1 = [4 x i8] c"%2s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %5
5: ; preds = %12, %0
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%7 = call i32 @read_input(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%9 = call i32 @get_card_value(i8* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @update_card_count(i32 %10, i32* %4)
br label %12
12: ; preds = %5
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 88
br i1 %16, label %5, label %17
17: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter the card name: \00"
@.str.1 = [4 x i8] c"%2s\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
br label %5
5: ; preds = %5, %0
%6 = call i32 @read_input(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 @get_card_value(i8* %3)
%8 = call i32 @update_card_count(i32 %7, i32* %2)
%9 = load i8, i8* %3
%10 = icmp eq i8 %9, 88
br i1 %10, label %11, label %5
11: ; preds = %5
ret i32 0
}