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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movsbl -0x7(%rbp),%eax
cmp    $0x58,%eax
je     11a8 <main+0x68>
lea    -0x7(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1040 <getCard@plt>
movl   $0x0,-0x10(%rbp)
lea    -0x7(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <updateVal@plt>
lea    -0x10(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <updateCount@plt>
mov    -0xc(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
jmp    1156 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x4(%rsp)
lea    0xea4(%rip),%r14
lea    0x9(%rsp),%r15
lea    0xc(%rsp),%rbx
lea    0x4(%rsp),%r12
lea    0xea4(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <getCard@plt>
movl   $0x0,0xc(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <updateVal@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <updateCount@plt>
mov    0x4(%rsp),%esi
mov    %r13,%rdi
call   1030 <printf@plt>
cmpb   $0x58,0x9(%rsp)
jne    1180 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter the card_name: \00"
@.str.1 = [19 x i8] c"Current count: %i\0A\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* %3
br label %5
5: ; preds = %10, %0
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 88
br i1 %9, label %10, label %18
10: ; preds = %5
%11 = bitcast [3 x i8]* %2 to i8**
%12 = call i32 @getCard(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8** %11)
store i32 0, i32* %4
%13 = bitcast [3 x i8]* %2 to i8**
%14 = call i32 @updateVal(i8** %13, i32* %4)
%15 = call i32 @updateCount(i32* %4, i32* %3)
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %5
18: ; preds = %5
ret i32 0
}

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