#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 /*<<< orphan*/ system(char *);
main() {
  system("title Programa para saber que día da semana lle corresponde ó número "
         "escrito");
  system("cls");
  system("color 80");
  printf("\nDIA DA SEMANA CORRESPONDENTE A UN NUMERO:\n");
  printf("========================================\n");
  int a;
  printf("Introduce un n\243mero\n");
  scanf("%i", &a);
  if ((a > 7) || (a < 1)) {
    printf("O n\243mero introducido non corresponde a ning\243n d\241a da "
           "semana\n");
  } else {
    switch (a) {
    case 1:
      printf("O d\241a da semana \202 Luns\n");
      break;
    case 2:
      printf("O d\241a da semana \202 Martes\n");
      break;
    case 3:
      printf("O d\241a da semana \202 Mercores\n");
      break;
    case 4:
      printf("O d\241a da semana \202 Xoves\n");
      break;
    case 5:
      printf("O d\241a da semana \202 Venres\n");
      break;
    case 6:
      printf("O d\241a da semana \202 S\240bado\n");
      break;
    case 7:
      printf("O d\241a da semana \202 Domingo\n");
      break;
    }
  }
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed6(%rip),%rdi
call   1030 <system@plt>
lea    0xf1a(%rip),%rdi
call   1030 <system@plt>
lea    0xf12(%rip),%rdi
call   1030 <system@plt>
lea    0xf0f(%rip),%rdi
call   1040 <printf@plt>
lea    0xf2f(%rip),%rdi
call   1040 <printf@plt>
lea    0xf4d(%rip),%rdi
call   1040 <printf@plt>
lea    0xf56(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x7,-0x8(%rbp)
jg     11ab <main+0x7b>
cmpl   $0x1,-0x8(%rbp)
jge    11bc <main+0x8c>
lea    0xf35(%rip),%rdi
call   1040 <printf@plt>
jmp    125c <main+0x12c>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x6,%eax
ja     1257 <main+0x127>
mov    -0x10(%rbp),%rax
lea    0xe24(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf38(%rip),%rdi
call   1040 <printf@plt>
jmp    1257 <main+0x127>
lea    0xf3f(%rip),%rdi
call   1040 <printf@plt>
jmp    1257 <main+0x127>
lea    0xf48(%rip),%rdi
call   1040 <printf@plt>
jmp    1257 <main+0x127>
lea    0xf53(%rip),%rdi
call   1040 <printf@plt>
jmp    1257 <main+0x127>
lea    0xf5b(%rip),%rdi
call   1040 <printf@plt>
jmp    1257 <main+0x127>
lea    0xf64(%rip),%rdi
call   1040 <printf@plt>
jmp    1257 <main+0x127>
lea    0xf6d(%rip),%rdi
call   1040 <printf@plt>
jmp    125c <main+0x12c>
lea    0xf77(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <system@plt>
lea    0xf0c(%rip),%rdi
call   1040 <system@plt>
lea    0xf04(%rip),%rdi
call   1040 <system@plt>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf29(%rip),%rdi
call   1030 <puts@plt>
lea    0xf46(%rip),%rdi
call   1030 <puts@plt>
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x8(%rax),%ecx
cmp    $0xfffffff9,%ecx
jae    119f <main+0x6f>
lea    0xfe0(%rip),%rdi
jmp    11b7 <main+0x87>
add    $0xffffffff,%eax
cmp    $0x6,%eax
ja     11bc <main+0x8c>
cltq
lea    0x100c(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [80 x i8] c"title Programa para saber que d\C3\ADa da semana lle corresponde \C3\B3 n\C3\BAmero escrito\00"
@.str.1 = [4 x i8] c"cls\00"
@.str.2 = [9 x i8] c"color 80\00"
@.str.3 = [44 x i8] c"\0ADIA DA SEMANA CORRESPONDENTE A UN NUMERO:\0A\00"
@.str.4 = [42 x i8] c"========================================\0A\00"
@.str.5 = [21 x i8] c"Introduce un n\A3mero\0A\00"
@.str.6 = [3 x i8] c"%i\00"
@.str.7 = [61 x i8] c"O n\A3mero introducido non corresponde a ning\A3n d\A1a da semana\0A\00"
@.str.8 = [24 x i8] c"O d\A1a da semana \82 Luns\0A\00"
@.str.9 = [26 x i8] c"O d\A1a da semana \82 Martes\0A\00"
@.str.10 = [28 x i8] c"O d\A1a da semana \82 Mercores\0A\00"
@.str.11 = [25 x i8] c"O d\A1a da semana \82 Xoves\0A\00"
@.str.12 = [26 x i8] c"O d\A1a da semana \82 Venres\0A\00"
@.str.13 = [26 x i8] c"O d\A1a da semana \82 S\A0bado\0A\00"
@.str.14 = [27 x i8] c"O d\A1a da semana \82 Domingo\0A\00"
@.str.15 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @system(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 7
br i1 %11, label %15, label %12
12: ; preds = %0
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %12, %0
%16 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0))
br label %34
17: ; preds = %12
%18 = load i32, i32* %2
switch i32 %18, label %33 [
i32 1, label %19
i32 2, label %21
i32 3, label %23
i32 4, label %25
i32 5, label %27
i32 6, label %29
i32 7, label %31
]
19: ; preds = %17
%20 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
br label %33
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
br label %33
23: ; preds = %17
%24 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0))
br label %33
25: ; preds = %17
%26 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
br label %33
27: ; preds = %17
%28 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
br label %33
29: ; preds = %17
%30 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0))
br label %33
31: ; preds = %17
%32 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
br label %33
33: ; preds = %17, %31, %29, %27, %25, %23, %21, %19
br label %34
34: ; preds = %33, %15
%35 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str = [80 x i8] c"title Programa para saber que d\C3\ADa da semana lle corresponde \C3\B3 n\C3\BAmero escrito\00"
@.str.1 = [4 x i8] c"cls\00"
@.str.2 = [9 x i8] c"color 80\00"
@.str.6 = [3 x i8] c"%i\00"
@.str.15 = [6 x i8] c"pause\00"
@str = [43 x i8] c"\0ADIA DA SEMANA CORRESPONDENTE A UN NUMERO:\00"
@str.16 = [41 x i8] c"========================================\00"
@str.17 = [20 x i8] c"Introduce un n\A3mero\00"
@str.18 = [26 x i8] c"O d\A1a da semana \82 Domingo\00"
@str.19 = [25 x i8] c"O d\A1a da semana \82 S\A0bado\00"
@str.20 = [25 x i8] c"O d\A1a da semana \82 Venres\00"
@str.21 = [24 x i8] c"O d\A1a da semana \82 Xoves\00"
@str.22 = [27 x i8] c"O d\A1a da semana \82 Mercores\00"
@str.23 = [25 x i8] c"O d\A1a da semana \82 Martes\00"
@str.24 = [23 x i8] c"O d\A1a da semana \82 Luns\00"
@str.25 = [60 x i8] c"O n\A3mero introducido non corresponde a ning\A3n d\A1a da semana\00"
@reltable.main = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @str.24 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @str.23 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @str.22 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str.21 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @str.20 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @str.19 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @str.18 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @system(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.16, i64 0, i64 0))
%7 = bitcast i32* %1 to i8*
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.17, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = add i32 %10, -8
%12 = icmp ult i32 %11, -7
br i1 %12, label %20, label %13
13: ; preds = %0
%14 = add i32 %10, -1
%15 = icmp ult i32 %14, 7
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = sext i32 %14 to i64
%18 = shl i64 %17, 2
%19 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.main to i8*), i64 %18)
br label %20
20: ; preds = %16, %0
%21 = phi i8* [ getelementptr inbounds ([60 x i8], [60 x i8]* @str.25, i64 0, i64 0), %0 ], [ %19, %16 ]
%22 = call i32 @puts(i8* dereferenceable(1) %21)
br label %23
23: ; preds = %13, %20
%24 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
ret i32 0
}