#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  printf("\tPrograma que Ilustra el uso de Switch\n\n");
  printf("Introduce el valor de a: ");
  scanf("%d", &a);
  printf("El número %d en letra es: ", a);
  switch (a) {
  case 0:
    printf("cero.\n");
    break;
  case 1:
    printf("uno.\n");
    break;
  case 2:
    printf("dos.\n");
    break;
  case 3:
    printf("tres.\n");
    break;
  case 4:
    printf("cuatro.\n");
    break;
  case 5:
    printf("cinco.\n");
    break;
  case 6:
    printf("seis.\n");
    break;
  case 7:
    printf("siete.\n");
    break;
  case 8:
    printf("ocho.\n");
    break;
  case 9:
    printf("nueve.\n");
    break;
  default:
    printf("El caracter introducido no es un dígito.\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xef2(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xf07(%rip),%rdi
call   1030 <printf@plt>
lea    0xf15(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x11(%rbp),%al
mov    -0x8(%rbp),%esi
lea    0xf02(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x9,%rax
ja     1254 <main+0x134>
mov    -0x10(%rbp),%rax
lea    0xe73(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x4(%rsp),%rax
cmp    $0x9,%rax
ja     1189 <main+0x59>
lea    0xf4c(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1190 <main+0x60>
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"\09Programa que Ilustra el uso de Switch\0A\0A\00"
@.str.1 = [26 x i8] c"Introduce el valor de a: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [28 x i8] c"El n\C3\BAmero %d en letra es: \00"
@.str.4 = [7 x i8] c"cero.\0A\00"
@.str.5 = [6 x i8] c"uno.\0A\00"
@.str.6 = [6 x i8] c"dos.\0A\00"
@.str.7 = [7 x i8] c"tres.\0A\00"
@.str.8 = [9 x i8] c"cuatro.\0A\00"
@.str.9 = [8 x i8] c"cinco.\0A\00"
@.str.10 = [7 x i8] c"seis.\0A\00"
@.str.11 = [8 x i8] c"siete.\0A\00"
@.str.12 = [7 x i8] c"ocho.\0A\00"
@.str.13 = [8 x i8] c"nueve.\0A\00"
@.str.14 = [43 x i8] c"El caracter introducido no es un d\C3\ADgito.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %2
switch i32 %8, label %29 [
i32 0, label %9
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 4, label %17
i32 5, label %19
i32 6, label %21
i32 7, label %23
i32 8, label %25
i32 9, label %27
]
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %31
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %31
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %31
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %31
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %31
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %31
21: ; preds = %0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %31
23: ; preds = %0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
br label %31
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
br label %31
27: ; preds = %0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
br label %31
29: ; preds = %0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.14, i64 0, i64 0))
br label %31
31: ; preds = %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [26 x i8] c"Introduce el valor de a: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [28 x i8] c"El n\C3\BAmero %d en letra es: \00"
@str = [40 x i8] c"\09Programa que Ilustra el uso de Switch\0A\00"
@str.15 = [7 x i8] c"nueve.\00"
@str.16 = [6 x i8] c"ocho.\00"
@str.17 = [7 x i8] c"siete.\00"
@str.18 = [6 x i8] c"seis.\00"
@str.19 = [7 x i8] c"cinco.\00"
@str.20 = [8 x i8] c"cuatro.\00"
@str.21 = [6 x i8] c"tres.\00"
@str.22 = [5 x i8] c"dos.\00"
@str.23 = [5 x i8] c"uno.\00"
@str.24 = [6 x i8] c"cero.\00"
@str.25 = [42 x i8] c"El caracter introducido no es un d\C3\ADgito.\00"
@reltable.main = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.24 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @str.23 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @str.22 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.21 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @str.20 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @str.19 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.18 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @str.17 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.16 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @str.15 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %1
%9 = icmp ult i32 %8, 10
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = sext i32 %8 to i64
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.main to i8*), i64 %12)
br label %14
14: ; preds = %0, %10
%15 = phi i8* [ %13, %10 ], [ getelementptr inbounds ([42 x i8], [42 x i8]* @str.25, i64 0, i64 0), %0 ]
%16 = call i32 @puts(i8* dereferenceable(1) %15)
ret i32 0
}