#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char card_name[3];
  int val = 0;
  printf("Enter the card name : ");
  scanf("%2s", card_name);
  if ((card_name[0] == 'K') || (card_name[0] == 'Q') || (card_name[0] == 'J')) {
    val = 10;
  } else if (card_name[0] == 'A') {
    val = 11;
  } else {
    val = atoi(card_name);
  }
  printf("The value of the card is : %i\n", val);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1040 <scanf@plt>
movsbl -0x7(%rbp),%eax
cmp    $0x4b,%eax
je     119b <main+0x5b>
movsbl -0x7(%rbp),%eax
cmp    $0x51,%eax
je     119b <main+0x5b>
movsbl -0x7(%rbp),%eax
cmp    $0x4a,%eax
jne    11a7 <main+0x67>
movl   $0xa,-0xc(%rbp)
jmp    11d1 <main+0x91>
movsbl -0x7(%rbp),%eax
cmp    $0x41,%eax
jne    11c0 <main+0x80>
movl   $0xb,-0xc(%rbp)
jmp    11cc <main+0x8c>
lea    -0x7(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0xc(%rbp)
jmp    11d1 <main+0x91>
mov    -0xc(%rbp),%esi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    0x5(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0xa,%esi
mov    0x5(%rsp),%al
lea    -0x4a(%rax),%ecx
cmp    $0x2,%cl
jb     118c <main+0x4c>
cmp    $0x51,%al
je     118c <main+0x4c>
cmp    $0x41,%al
jne    1180 <main+0x40>
mov    $0xb,%esi
jmp    118c <main+0x4c>
lea    0x5(%rsp),%rdi
call   1050 <atoi@plt>
mov    %eax,%esi
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Enter the card name : \00"
@.str.1 = [4 x i8] c"%2s\00"
@.str.2 = [31 x i8] c"The value of the card is : %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 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 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 75
br i1 %10, label %21, label %11
11: ; preds = %0
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 81
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 74
br i1 %20, label %21, label %22
21: ; preds = %16, %11, %0
store i32 10, i32* %3
br label %32
22: ; preds = %16
%23 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 65
br i1 %26, label %27, label %28
27: ; preds = %22
store i32 11, i32* %3
br label %31
28: ; preds = %22
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %3
br label %31
31: ; preds = %28, %27
br label %32
32: ; preds = %31, %21
%33 = load i32, i32* %3
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter the card name : \00"
@.str.1 = [4 x i8] c"%2s\00"
@.str.2 = [31 x i8] c"The value of the card 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
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 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 = load i8, i8* %2
switch i8 %5, label %7 [
i8 81, label %9
i8 75, label %9
i8 74, label %9
i8 65, label %6
]
6: ; preds = %0
br label %9
7: ; preds = %0
%8 = call i32 @atoi(i8* %2)
br label %9
9: ; preds = %0, %0, %0, %6, %7
%10 = phi i32 [ 11, %6 ], [ %8, %7 ], [ 10, %0 ], [ 10, %0 ], [ 10, %0 ]
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = call i32 @exit(i32 0)
unreachable
}