#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/, char *, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  int dia;
  char diaext[51];
  printf("\nDigite o número do dia da semana (1-7): ");
  fscanf(stdin, "%d", &dia);
  switch (dia) {
  case 1:
    strcpy(diaext, "Domingo");
    break;
  case 2:
    strcpy(diaext, "Segunda-Feira");
    break;
  case 3:
    strcpy(diaext, "Terça-Feira");
    break;
  case 4:
    strcpy(diaext, "Qaurta-Feira");
    break;
  case 5:
    strcpy(diaext, "Quinta-Feira");
    break;
  case 6:
    strcpy(diaext, "Sexta-Feira");
    break;
  case 7:
    strcpy(diaext, "Sábado");
    break;
  default:
    fprintf(stderr, "\n***ERRO: Valor Inválido***\n");
    return EXIT_FAILURE;
  }
  fprintf(stdout, "\nO dia %d corresponde ao dia: %s\n", dia, diaext);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x6,%eax
ja     1230 <main+0xf0>
mov    -0x48(%rbp),%rax
lea    0xe6c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x40(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1258 <main+0x118>
lea    -0x40(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1258 <main+0x118>
lea    -0x40(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1258 <main+0x118>
lea    -0x40(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1258 <main+0x118>
lea    -0x40(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1258 <main+0x118>
lea    -0x40(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1258 <main+0x118>
lea    -0x40(%rbp),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1258 <main+0x118>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
lea    0xe5b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1282 <main+0x142>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    -0x40(%rbp),%rcx
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1050 <fscanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x7,%eax
jae    11bb <main+0x7b>
cltq
lea    0xf40(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
mov    0xc(%rsp),%edx
lea    0xef5(%rip),%rsi
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2e07(%rip),%rax
jmp    11d9 <main+0x99>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"\0ADigite o n\C3\BAmero do dia da semana (1-7): \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"Domingo\00"
@.str.3 = [14 x i8] c"Segunda-Feira\00"
@.str.4 = [13 x i8] c"Ter\C3\A7a-Feira\00"
@.str.5 = [13 x i8] c"Qaurta-Feira\00"
@.str.6 = [13 x i8] c"Quinta-Feira\00"
@.str.7 = [12 x i8] c"Sexta-Feira\00"
@.str.8 = [8 x i8] c"S\C3\A1bado\00"
@stderr = global i32 0
@.str.9 = [30 x i8] c"\0A***ERRO: Valor Inv\C3\A1lido***\0A\00"
@EXIT_FAILURE = global i32 0
@stdout = global i32 0
@.str.10 = [34 x i8] c"\0AO dia %d corresponde ao dia: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [51 x i8]
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stdin
%6 = call i32 @fscanf(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
switch i32 %7, label %29 [
i32 1, label %8
i32 2, label %11
i32 3, label %14
i32 4, label %17
i32 5, label %20
i32 6, label %23
i32 7, label %26
]
8: ; preds = %0
%9 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %33
11: ; preds = %0
%12 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %33
14: ; preds = %0
%15 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%16 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %33
17: ; preds = %0
%18 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%19 = call i32 @strcpy(i8* %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %33
20: ; preds = %0
%21 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%22 = call i32 @strcpy(i8* %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %33
23: ; preds = %0
%24 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%25 = call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
br label %33
26: ; preds = %0
%27 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%28 = call i32 @strcpy(i8* %27, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %33
29: ; preds = %0
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%32 = load i32, i32* @EXIT_FAILURE
store i32 %32, i32* %1
br label %39
33: ; preds = %26, %23, %20, %17, %14, %11, %8
%34 = load i32, i32* @stdout
%35 = load i32, i32* %2
%36 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i32 %35, i8* %36)
%38 = load i32, i32* @EXIT_SUCCESS
store i32 %38, i32* %1
br label %39
39: ; preds = %33, %29
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str = [43 x i8] c"\0ADigite o n\C3\BAmero do dia da semana (1-7): \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"Domingo\00"
@.str.3 = [14 x i8] c"Segunda-Feira\00"
@.str.4 = [13 x i8] c"Ter\C3\A7a-Feira\00"
@.str.5 = [13 x i8] c"Qaurta-Feira\00"
@.str.6 = [13 x i8] c"Quinta-Feira\00"
@.str.7 = [12 x i8] c"Sexta-Feira\00"
@.str.8 = [8 x i8] c"S\C3\A1bado\00"
@stderr = global i32 0
@.str.9 = [30 x i8] c"\0A***ERRO: Valor Inv\C3\A1lido***\0A\00"
@EXIT_FAILURE = global i32 0
@stdout = global i32 0
@.str.10 = [34 x i8] c"\0AO dia %d corresponde ao dia: %s\0A\00"
@EXIT_SUCCESS = global i32 0
@reltable.main = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.7 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.8 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i32
%2 = alloca [51 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [51 x i8], [51 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fscanf(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = add i32 %8, -1
%10 = icmp ult i32 %9, 7
br i1 %10, label %14, label %11
11: ; preds = %0
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
br label %22
14: ; preds = %0
%15 = sext i32 %9 to i64
%16 = shl i64 %15, 2
%17 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.main to i8*), i64 %16)
%18 = call i32 @strcpy(i8* %4, i8* %17)
%19 = load i32, i32* @stdout
%20 = load i32, i32* %1
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i32 %20, i8* %4)
br label %22
22: ; preds = %14, %11
%23 = phi i32* [ @EXIT_FAILURE, %11 ], [ @EXIT_SUCCESS, %14 ]
%24 = load i32, i32* %23
ret i32 %24
}