#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 /*<<< orphan*/ printf(char *, ...);
void afficher_carte(short num) {
  if ((num < 0) && (num > 51)) {
    printf("Carte incorrecte.");
    return;
  }
  if (num % 13 == 10) {
    printf("valet");
  } else if (num % 13 == 11) {
    printf("dame");
  } else if (num % 13 == 12) {
    printf("roi");
  } else if (num % 13 == 0) {
    printf("as");
  } else {
    printf("%i", num % 13 + 1);
  }
  printf(" ");
  if ((num >= 0) && (num <= 12)) {
    printf("de coeur");
  } else if ((num >= 13) && (num <= 25)) {
    printf("de carreau");
  } else if ((num >= 26) && (num <= 38)) {
    printf("de pique");
  } else if ((num >= 39) && (num <= 51)) {
    printf("de trefle");
  }
  printf("\n");
  return;
}


x86 assembly (clang, -O0):
<afficher_carte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x0,%eax
jge    114c <afficher_carte+0x3c>
movswl -0x2(%rbp),%eax
cmp    $0x33,%eax
jle    114c <afficher_carte+0x3c>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f4 <afficher_carte+0x1e4>
movswl -0x2(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
cmp    $0xa,%edx
jne    1174 <afficher_carte+0x64>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121a <afficher_carte+0x10a>
movswl -0x2(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
cmp    $0xb,%edx
jne    119c <afficher_carte+0x8c>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1215 <afficher_carte+0x105>
movswl -0x2(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
cmp    $0xc,%edx
jne    11c4 <afficher_carte+0xb4>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1210 <afficher_carte+0x100>
movswl -0x2(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ec <afficher_carte+0xdc>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120b <afficher_carte+0xfb>
movswl -0x2(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1,%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1210 <afficher_carte+0x100>
jmp    1215 <afficher_carte+0x105>
jmp    121a <afficher_carte+0x10a>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0x2(%rbp),%eax
cmp    $0x0,%eax
jl     1255 <afficher_carte+0x145>
movswl -0x2(%rbp),%eax
cmp    $0xc,%eax
jg     1255 <afficher_carte+0x145>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e6 <afficher_carte+0x1d6>
movswl -0x2(%rbp),%eax
cmp    $0xd,%eax
jl     1282 <afficher_carte+0x172>
movswl -0x2(%rbp),%eax
cmp    $0x19,%eax
jg     1282 <afficher_carte+0x172>
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <afficher_carte+0x1d1>
movswl -0x2(%rbp),%eax
cmp    $0x1a,%eax
jl     12af <afficher_carte+0x19f>
movswl -0x2(%rbp),%eax
cmp    $0x26,%eax
jg     12af <afficher_carte+0x19f>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12dc <afficher_carte+0x1cc>
movswl -0x2(%rbp),%eax
cmp    $0x27,%eax
jl     12d7 <afficher_carte+0x1c7>
movswl -0x2(%rbp),%eax
cmp    $0x33,%eax
jg     12d7 <afficher_carte+0x1c7>
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12dc <afficher_carte+0x1cc>
jmp    12e1 <afficher_carte+0x1d1>
jmp    12e6 <afficher_carte+0x1d6>
lea    0xd63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<afficher_carte>:
push   %rbx
mov    %edi,%ebx
imul   $0x4ec5,%edi,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x12,%eax
add    %ecx,%eax
lea    (%rax,%rax,2),%ecx
lea    (%rax,%rcx,4),%eax
mov    %edi,%ecx
sub    %eax,%ecx
movswl %cx,%esi
cmp    $0xc,%esi
ja     115e <afficher_carte+0x3e>
lea    0xeb4(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xee7(%rip),%rdi
jmp    118a <afficher_carte+0x6a>
add    $0x1,%esi
lea    0xede(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1191 <afficher_carte+0x71>
lea    0xebc(%rip),%rdi
jmp    118a <afficher_carte+0x6a>
lea    0xeb9(%rip),%rdi
jmp    118a <afficher_carte+0x6a>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    $0xd,%bx
jae    11aa <afficher_carte+0x8a>
lea    0xea1(%rip),%rdi
jmp    11de <afficher_carte+0xbe>
lea    -0xd(%rbx),%eax
cmp    $0xd,%ax
jae    11bc <afficher_carte+0x9c>
lea    0xe98(%rip),%rdi
jmp    11de <afficher_carte+0xbe>
lea    -0x1a(%rbx),%eax
cmp    $0xd,%ax
jae    11ce <afficher_carte+0xae>
lea    0xe91(%rip),%rdi
jmp    11de <afficher_carte+0xbe>
lea    -0x27(%rbx),%eax
cmp    $0xc,%ax
ja     11e5 <afficher_carte+0xc5>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Carte incorrecte.\00"
@.str.1 = [6 x i8] c"valet\00"
@.str.2 = [5 x i8] c"dame\00"
@.str.3 = [4 x i8] c"roi\00"
@.str.4 = [3 x i8] c"as\00"
@.str.5 = [3 x i8] c"%i\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [9 x i8] c"de coeur\00"
@.str.8 = [11 x i8] c"de carreau\00"
@.str.9 = [9 x i8] c"de pique\00"
@.str.10 = [10 x i8] c"de trefle\00"
@.str.11 = [2 x i8] c"\0A\00"
define void @afficher_carte(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i16, i16* %2
%8 = sext i16 %7 to i32
%9 = icmp sgt i32 %8, 51
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %95
12: ; preds = %6, %1
%13 = load i16, i16* %2
%14 = sext i16 %13 to i32
%15 = srem i32 %14, 13
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %49
19: ; preds = %12
%20 = load i16, i16* %2
%21 = sext i16 %20 to i32
%22 = srem i32 %21, 13
%23 = icmp eq i32 %22, 11
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %48
26: ; preds = %19
%27 = load i16, i16* %2
%28 = sext i16 %27 to i32
%29 = srem i32 %28, 13
%30 = icmp eq i32 %29, 12
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %47
33: ; preds = %26
%34 = load i16, i16* %2
%35 = sext i16 %34 to i32
%36 = srem i32 %35, 13
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %46
40: ; preds = %33
%41 = load i16, i16* %2
%42 = sext i16 %41 to i32
%43 = srem i32 %42, 13
%44 = add nsw i32 %43, 1
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %40, %38
br label %47
47: ; preds = %46, %31
br label %48
48: ; preds = %47, %24
br label %49
49: ; preds = %48, %17
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%51 = load i16, i16* %2
%52 = sext i16 %51 to i32
%53 = icmp sge i32 %52, 0
br i1 %53, label %54, label %60
54: ; preds = %49
%55 = load i16, i16* %2
%56 = sext i16 %55 to i32
%57 = icmp sle i32 %56, 12
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %93
60: ; preds = %54, %49
%61 = load i16, i16* %2
%62 = sext i16 %61 to i32
%63 = icmp sge i32 %62, 13
br i1 %63, label %64, label %70
64: ; preds = %60
%65 = load i16, i16* %2
%66 = sext i16 %65 to i32
%67 = icmp sle i32 %66, 25
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
br label %92
70: ; preds = %64, %60
%71 = load i16, i16* %2
%72 = sext i16 %71 to i32
%73 = icmp sge i32 %72, 26
br i1 %73, label %74, label %80
74: ; preds = %70
%75 = load i16, i16* %2
%76 = sext i16 %75 to i32
%77 = icmp sle i32 %76, 38
br i1 %77, label %78, label %80
78: ; preds = %74
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %91
80: ; preds = %74, %70
%81 = load i16, i16* %2
%82 = sext i16 %81 to i32
%83 = icmp sge i32 %82, 39
br i1 %83, label %84, label %90
84: ; preds = %80
%85 = load i16, i16* %2
%86 = sext i16 %85 to i32
%87 = icmp sle i32 %86, 51
br i1 %87, label %88, label %90
88: ; preds = %84
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
br label %90
90: ; preds = %88, %84, %80
br label %91
91: ; preds = %90, %78
br label %92
92: ; preds = %91, %68
br label %93
93: ; preds = %92, %58
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
br label %95
95: ; preds = %93, %10
ret void
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"valet\00"
@.str.2 = [5 x i8] c"dame\00"
@.str.3 = [4 x i8] c"roi\00"
@.str.4 = [3 x i8] c"as\00"
@.str.5 = [3 x i8] c"%i\00"
@.str.7 = [9 x i8] c"de coeur\00"
@.str.8 = [11 x i8] c"de carreau\00"
@.str.9 = [9 x i8] c"de pique\00"
@.str.10 = [10 x i8] c"de trefle\00"
define void @afficher_carte(i16 signext %0) {
%2 = srem i16 %0, 13
%3 = sext i16 %2 to i32
switch i32 %3, label %12 [
i32 10, label %4
i32 11, label %6
i32 12, label %8
i32 0, label %10
]
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %15
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %15
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %15
10: ; preds = %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %15
12: ; preds = %1
%13 = add nsw i32 %3, 1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %6, %10, %12, %8, %4
%16 = tail call i32 @putchar(i32 32)
%17 = icmp ult i16 %0, 13
br i1 %17, label %27, label %18
18: ; preds = %15
%19 = add i16 %0, -13
%20 = icmp ult i16 %19, 13
br i1 %20, label %27, label %21
21: ; preds = %18
%22 = add i16 %0, -26
%23 = icmp ult i16 %22, 13
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = add i16 %0, -39
%26 = icmp ult i16 %25, 13
br i1 %26, label %27, label %30
27: ; preds = %24, %21, %18, %15
%28 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), %15 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), %18 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), %21 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), %24 ]
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %28)
br label %30
30: ; preds = %27, %24
%31 = tail call i32 @putchar(i32 10)
ret void
}