#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 atoi(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char card_name[3];
  puts("Enter the card_name: ");
  scanf("%2s", card_name);
  puts(card_name);
  int val = 0;
  if (card_name[0] == 'K') {
    val = 10;
  } else if (card_name[0] == 'Q') {
    val = 10;
  } else if (card_name[0] == 'j') {
    val = 10;
  } else if (card_name[0] == 'A') {
    val = 11;
  } else {
    val = atoi(card_name);
  }
  if (3 <= val && val <= 6) {
    puts("Count has gone up");
  } else if (val == 10) {
    puts("Count has gone down");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    -0x7(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x7(%rbp),%rdi
call   1030 <puts@plt>
movl   $0x0,-0xc(%rbp)
movsbl -0x7(%rbp),%eax
cmp    $0x4b,%eax
jne    1184 <main+0x54>
movl   $0xa,-0xc(%rbp)
jmp    11ea <main+0xba>
movsbl -0x7(%rbp),%eax
cmp    $0x51,%eax
jne    119d <main+0x6d>
movl   $0xa,-0xc(%rbp)
jmp    11e5 <main+0xb5>
movsbl -0x7(%rbp),%eax
cmp    $0x6a,%eax
jne    11b6 <main+0x86>
movl   $0xa,-0xc(%rbp)
jmp    11e0 <main+0xb0>
movsbl -0x7(%rbp),%eax
cmp    $0x41,%eax
jne    11cf <main+0x9f>
movl   $0xb,-0xc(%rbp)
jmp    11db <main+0xab>
lea    -0x7(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0xc(%rbp)
jmp    11e0 <main+0xb0>
jmp    11e5 <main+0xb5>
jmp    11ea <main+0xba>
mov    $0x3,%eax
cmp    -0xc(%rbp),%eax
jg     1213 <main+0xe3>
cmpl   $0x6,-0xc(%rbp)
jg     1213 <main+0xe3>
lea    0xe11(%rip),%rdi
call   1030 <puts@plt>
jmp    122e <main+0xfe>
cmpl   $0xa,-0xc(%rbp)
jne    1229 <main+0xf9>
lea    0xe08(%rip),%rdi
call   1030 <puts@plt>
jmp    122e <main+0xfe>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
lea    0xece(%rip),%rdi
lea    0xd(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xec8(%rip),%rbx
mov    0xd(%rsp),%al
cmp    $0x50,%al
jg     1176 <main+0x46>
cmp    $0x41,%al
je     11a6 <main+0x76>
cmp    $0x4b,%al
je     119e <main+0x6e>
jmp    117e <main+0x4e>
cmp    $0x51,%al
je     119e <main+0x6e>
cmp    $0x6a,%al
je     119e <main+0x6e>
lea    0xd(%rsp),%rdi
call   1050 <atoi@plt>
lea    -0x3(%rax),%ecx
cmp    $0x4,%ecx
jae    1199 <main+0x69>
lea    0xe83(%rip),%rbx
jmp    119e <main+0x6e>
cmp    $0xa,%eax
jne    11a6 <main+0x76>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter the card_name: \00"
@.str.1 = [4 x i8] c"%2s\00"
@.str.2 = [18 x i8] c"Count has gone up\00"
@.str.3 = [20 x i8] c"Count has gone down\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%8 = call i32 @puts(i8* %7)
store i32 0, i32* %3
%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 eq i32 %11, 75
br i1 %12, label %13, label %14
13: ; preds = %0
store i32 10, i32* %3
br label %38
14: ; preds = %0
%15 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 81
br i1 %18, label %19, label %20
19: ; preds = %14
store i32 10, i32* %3
br label %37
20: ; preds = %14
%21 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 106
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 10, i32* %3
br label %36
26: ; preds = %20
%27 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 65
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 11, i32* %3
br label %35
32: ; preds = %26
%33 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%34 = call i32 @atoi(i8* %33)
store i32 %34, i32* %3
br label %35
35: ; preds = %32, %31
br label %36
36: ; preds = %35, %25
br label %37
37: ; preds = %36, %19
br label %38
38: ; preds = %37, %13
%39 = load i32, i32* %3
%40 = icmp sle i32 3, %39
br i1 %40, label %41, label %46
41: ; preds = %38
%42 = load i32, i32* %3
%43 = icmp sle i32 %42, 6
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %52
46: ; preds = %41, %38
%47 = load i32, i32* %3
%48 = icmp eq i32 %47, 10
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %49, %46
br label %52
52: ; preds = %51, %44
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 = [18 x i8] c"Count has gone up\00"
@.str.3 = [20 x i8] c"Count has gone down\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @puts(i8* %2)
%6 = load i8, i8* %2
switch i8 %6, label %7 [
i8 75, label %13
i8 81, label %13
i8 106, label %13
i8 65, label %16
]
7: ; preds = %0
%8 = call i32 @atoi(i8* %2)
%9 = add i32 %8, -3
%10 = icmp ult i32 %9, 4
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = icmp eq i32 %8, 10
br i1 %12, label %13, label %16
13: ; preds = %11, %0, %0, %0, %7
%14 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), %11 ]
%15 = call i32 @puts(i8* dereferenceable(1) %14)
br label %16
16: ; preds = %13, %0, %11
ret i32 0
}