#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 changeCount(int);
int getVal(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int count = 0;
  char card_name[3];
  while (card_name[0] != 'X') {
    puts("Enter the card name: ");
    scanf("%2s", card_name);
    int val = getVal(card_name);
    count = changeCount(val);
    printf("Current count is %i\n", count);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movsbl -0xb(%rbp),%eax
cmp    $0x58,%eax
je     11ba <main+0x6a>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
lea    -0xb(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1060 <scanf@plt>
lea    -0xb(%rbp),%rdi
call   1070 <getVal@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <changeCount@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
jmp    1166 <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
lea    0xea1(%rip),%r14
lea    0xeb0(%rip),%r15
lea    0x5(%rsp),%rbx
lea    0xea8(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1070 <getVal@plt>
mov    %eax,%edi
call   1050 <changeCount@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
cmpb   $0x58,0x5(%rsp)
jne    1180 <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"
@.str.2 = [21 x i8] c"Current count is %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i8]
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %10, %0
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %3, 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 %20
10: ; preds = %5
%11 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%15 = call i32 @getVal(i8* %14)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = call i32 @changeCount(i32 %16)
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %18)
br label %5
20: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter the card name: \00"
@.str.1 = [4 x i8] c"%2s\00"
@.str.2 = [21 x i8] c"Current count is %i\0A\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 @getVal(i8* %2)
%7 = call i32 @changeCount(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i8, i8* %2
%10 = icmp eq i8 %9, 88
br i1 %10, label %11, label %3
11: ; preds = %3
ret i32 0
}