#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *get_day(int);
int /*<<< orphan*/ help(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int nday;
  char *day_of_week = NULL;
  help("Please, type");
  scanf("%1d", &nday);
  if (nday < 1 || nday > 7) {
    help("Error, it was");
    exit(EXIT_FAILURE);
  }
  day_of_week = get_day(nday);
  printf("%s\n", day_of_week);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xe8b(%rip),%rdi
call   1060 <help@plt>
lea    0xe8c(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jl     119e <main+0x4e>
cmpl   $0x7,-0x14(%rbp)
jle    11b8 <main+0x68>
lea    0xe6c(%rip),%rdi
call   1060 <help@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x14(%rbp),%edi
call   1030 <get_day@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1060 <help@plt>
lea    0xea9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
lea    -0x8(%rdi),%eax
cmp    $0xfffffff8,%eax
jbe    1199 <main+0x49>
call   1030 <get_day@plt>
lea    0xe99(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret
lea    0xe71(%rip),%rdi
call   1060 <help@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Please, type\00"
@.str.1 = [4 x i8] c"%1d\00"
@.str.2 = [14 x i8] c"Error, it was\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
%8 = call i32 @help(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 1
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load i32, i32* %6
%14 = icmp sgt i32 %13, 7
br i1 %14, label %15, label %19
15: ; preds = %12, %2
%16 = call i32 @help(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %12
%20 = load i32, i32* %6
%21 = call i8* @get_day(i32 %20)
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}

LLVM IR (-O2):
@.str = [13 x i8] c"Please, type\00"
@.str.1 = [4 x i8] c"%1d\00"
@.str.2 = [14 x i8] c"Error, it was\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @help(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = add i32 %7, -8
%9 = icmp ult i32 %8, -7
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = call i32 @help(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = call i8* @get_day(i32 %7)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}