#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char card_name[3];
  printf("Wpisz nazwę karty: ");
  scanf("%2s", 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);
  }
  printf("Wartosc karty to: %i\n", val);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
movsbl -0x7(%rbp),%eax
cmp    $0x4b,%eax
jne    117d <main+0x4d>
movl   $0xa,-0xc(%rbp)
jmp    11e3 <main+0xb3>
movsbl -0x7(%rbp),%eax
cmp    $0x51,%eax
jne    1196 <main+0x66>
movl   $0xa,-0xc(%rbp)
jmp    11de <main+0xae>
movsbl -0x7(%rbp),%eax
cmp    $0x4a,%eax
jne    11af <main+0x7f>
movl   $0xa,-0xc(%rbp)
jmp    11d9 <main+0xa9>
movsbl -0x7(%rbp),%eax
cmp    $0x41,%eax
jne    11c8 <main+0x98>
movl   $0xb,-0xc(%rbp)
jmp    11d4 <main+0xa4>
lea    -0x7(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0xc(%rbp)
jmp    11d9 <main+0xa9>
jmp    11de <main+0xae>
jmp    11e3 <main+0xb3>
mov    -0xc(%rbp),%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecf(%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     117c <main+0x4c>
cmp    $0x51,%al
je     117c <main+0x4c>
cmp    $0x41,%al
jne    1170 <main+0x40>
mov    $0xb,%esi
jmp    117c <main+0x4c>
lea    0x5(%rsp),%rdi
call   1050 <atoi@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Wpisz nazw\C4\99 karty: \00"
@.str.1 = [4 x i8] c"%2s\00"
@.str.2 = [22 x i8] c"Wartosc karty to: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 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)
store i32 0, i32* %3
%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 %11, label %12
11: ; preds = %0
store i32 10, i32* %3
br label %36
12: ; preds = %0
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 81
br i1 %16, label %17, label %18
17: ; preds = %12
store i32 10, i32* %3
br label %35
18: ; preds = %12
%19 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 74
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 10, i32* %3
br label %34
24: ; preds = %18
%25 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 65
br i1 %28, label %29, label %30
29: ; preds = %24
store i32 11, i32* %3
br label %33
30: ; preds = %24
%31 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %3
br label %33
33: ; preds = %30, %29
br label %34
34: ; preds = %33, %23
br label %35
35: ; preds = %34, %17
br label %36
36: ; preds = %35, %11
%37 = load i32, i32* %3
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Wpisz nazw\C4\99 karty: \00"
@.str.1 = [4 x i8] c"%2s\00"
@.str.2 = [22 x i8] c"Wartosc karty to: %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 ([21 x i8], [21 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 75, label %9
i8 81, 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 ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 0
}