#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*/ getCardName(char *, char *);
int /*<<< orphan*/ getCardValue(int *, int *, char *, char *);
int /*<<< orphan*/ updateCount(int, int *);
int main() {
  char card_name[3];
  char *promptInput = "Enter the card_name: ";
  char *promptInval = "I don't understand the value!";
  int count = 0;
  int val = 0;
  int notX = 1;
  while (notX) {
    getCardName(card_name, promptInput);
    getCardValue(&val, &notX, card_name, promptInval);
    if (notX) {
      updateCount(val, &count);
    }
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec5(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11b1 <main+0x81>
lea    -0x7(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <getCardName@plt>
lea    -0x7(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    -0x20(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1030 <getCardValue@plt>
cmpl   $0x0,-0x24(%rbp)
je     11ac <main+0x7c>
mov    -0x20(%rbp),%edi
lea    -0x1c(%rbp),%rsi
call   1040 <updateCount@plt>
jmp    116a <main+0x3a>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x1,0x8(%rsp)
lea    0xea3(%rip),%r14
lea    0x15(%rsp),%rbx
lea    0xead(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0x10(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <getCardName@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1030 <getCardValue@plt>
cmpl   $0x0,0x8(%rsp)
je     11b6 <main+0x86>
mov    0xc(%rsp),%edi
mov    %rbp,%rsi
call   1040 <updateCount@plt>
cmpl   $0x0,0x8(%rsp)
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter the card_name: \00"
@.str.1 = [30 x i8] c"I don't understand the value!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 1, i32* %7
br label %8
8: ; preds = %23, %0
%9 = load i32, i32* %7
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%13 = load i8*, i8** %3
%14 = call i32 @getCardName(i8* %12, i8* %13)
%15 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%16 = load i8*, i8** %4
%17 = call i32 @getCardValue(i32* %6, i32* %7, i8* %15, i8* %16)
%18 = load i32, i32* %7
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %11
%21 = load i32, i32* %6
%22 = call i32 @updateCount(i32 %21, i32* %5)
br label %23
23: ; preds = %20, %11
br label %8
24: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter the card_name: \00"
@.str.1 = [30 x i8] c"I don't understand the value!\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 1, i32* %4
br label %9
9: ; preds = %0, %14
%10 = call i32 @getCardName(i8* %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @getCardValue(i32* %3, i32* %4, i8* %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = load i32, i32* %3
%16 = call i32 @updateCount(i32 %15, i32* %2)
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %9
19: ; preds = %9, %14
ret i32 0
}