#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 card_value(char *, int *);
int /*<<< orphan*/ get_card_name(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ update_count(int, int *);
int main() {
  char card_name[3];
  char prompt[] = "Enter the card_name: ";
  int ct = 0;
  while (card_name[0] != 'X') {
    int val = 0;
    int toCont;
    get_card_name(prompt, card_name);
    toCont = card_value(card_name, &val);
    if (toCont) {
      continue;
    }
    update_count(val, &ct);
    printf("Current count: %i\n", ct);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xe9f(%rip),%ax
mov    %ax,-0xc(%rbp)
movl   $0x0,-0x24(%rbp)
movsbl -0x7(%rbp),%eax
cmp    $0x58,%eax
je     11e0 <main+0xa0>
movl   $0x0,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x7(%rbp),%rsi
call   1050 <get_card_name@plt>
lea    -0x7(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <card_value@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     11c0 <main+0x80>
jmp    1180 <main+0x40>
mov    -0x28(%rbp),%edi
lea    -0x24(%rbp),%rsi
call   1060 <update_count@plt>
mov    -0x24(%rbp),%esi
lea    0xe40(%rip),%rdi
call   1040 <printf@plt>
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x203a656d616e5f,%rax
mov    %rax,0x1e(%rsp)
movl   $0x0,0x8(%rsp)
lea    0x10(%rsp),%r14
lea    0xd(%rsp),%rbx
lea    0x4(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0xe8b(%rip),%r13
jmp    1197 <main+0x57>
nopl   (%rax)
cmpb   $0x58,0xd(%rsp)
je     11d3 <main+0x93>
movl   $0x0,0x4(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <get_card_name@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <card_value@plt>
test   %eax,%eax
jne    1190 <main+0x50>
mov    0x4(%rsp),%edi
mov    %r12,%rsi
call   1060 <update_count@plt>
mov    0x8(%rsp),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.prompt = [22 x i8] c"Enter the card_name: \00"
@.str = [19 x i8] c"Current count: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca [22 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [22 x i8]* %3 to i8*
store i32 0, i32* %4
br label %8
8: ; preds = %22, %21, %0
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 88
br i1 %12, label %13, label %27
13: ; preds = %8
store i32 0, i32* %5
%14 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%16 = call i32 @get_card_name(i8* %14, i8* %15)
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%18 = call i32 @card_value(i8* %17, i32* %5)
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %13
br label %8
22: ; preds = %13
%23 = load i32, i32* %5
%24 = call i32 @update_count(i32 %23, i32* %4)
%25 = load i32, i32* %4
%26 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %8
27: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@__const.main.prompt = [22 x i8] c"Enter the card_name: \00"
@.str = [19 x i8] c"Current count: %i\0A\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = alloca [22 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [22 x i8], [22 x i8]* %2, i64 0, i64 0
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
br label %9
9: ; preds = %0, %18
store i32 0, i32* %4
%10 = call i32 @get_card_name(i8* %6, i8* %5)
%11 = call i32 @card_value(i8* %5, i32* %4)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = load i32, i32* %4
%15 = call i32 @update_count(i32 %14, i32* %3)
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %9, %13
%19 = load i8, i8* %5
%20 = icmp eq i8 %19, 88
br i1 %20, label %21, label %9
21: ; preds = %18
ret i32 0
}