#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 getVal(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int updateCount(int, int);
int main() {
  char card_name[3];
  int count = 0;
  while (card_name[0] != 'X') {
    int val = 0;
    puts("Enter the card_name: ");
    scanf("%2s", card_name);
    val = getVal(card_name);
    if (val == 0) {
      continue;
    }
    count = 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     11d3 <main+0x83>
movl   $0x0,-0x10(%rbp)
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
lea    -0x7(%rbp),%rsi
lea    0xe85(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x7(%rbp),%rdi
call   1070 <getVal@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11b1 <main+0x61>
jmp    1166 <main+0x16>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <updateCount@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe51(%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   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %ebp,%ebp
lea    0xe9b(%rip),%r14
lea    0xeaa(%rip),%r15
lea    0xd(%rsp),%rbx
lea    0xea2(%rip),%r12
jmp    1187 <main+0x37>
nopw   0x0(%rax,%rax,1)
cmpb   $0x58,0xd(%rsp)
je     11bd <main+0x6d>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1070 <getVal@plt>
test   %eax,%eax
je     1180 <main+0x30>
mov    %eax,%edi
mov    %ebp,%esi
call   1050 <updateCount@plt>
mov    %eax,%ebp
mov    %r12,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
jmp    1180 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter the card_name: \00"
@.str.1 = [4 x i8] c"%2s\00"
@.str.2 = [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 = %19, %18, %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 %25
10: ; preds = %5
store i32 0, i32* %4
%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]* %2, 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]* %2, i64 0, i64 0
%15 = call i32 @getVal(i8* %14)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %10
br label %5
19: ; preds = %10
%20 = load i32, i32* %4
%21 = load i32, i32* %3
%22 = call i32 @updateCount(i32 %20, i32 %21)
store i32 %22, i32* %3
%23 = load i32, i32* %3
%24 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %5
25: ; 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 = [19 x i8] c"Current count: %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, %12
%4 = phi i32 [ %13, %12 ], [ 0, %0 ]
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%7 = call i32 @getVal(i8* %2)
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = call i32 @updateCount(i32 %7, i32 %4)
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %3, %9
%13 = phi i32 [ %10, %9 ], [ %4, %3 ]
%14 = load i8, i8* %2
%15 = icmp eq i8 %14, 88
br i1 %15, label %16, label %3
16: ; preds = %12
ret i32 0
}