#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*/ do_action(char *);
int /*<<< orphan*/ my_putstr(char *);
char *readLine();
void read_user() {
  char *get;
  my_putstr("\n\n\e[0;31m");
  my_putstr("     Bienvenue dans l'interface de Chappie\n");
  my_putstr("     1) Voir le stock\n");
  my_putstr("     2) Cuisiner\n");
  my_putstr("     3) Mettre a jour les ingredients\n");
  my_putstr("     4) Quitter\n\n");
  my_putstr("     \e[0m");
  my_putstr("\n\n     Choisir une option : ");
  get = readLine();
  my_putstr("\n");
  do_action(get);
}


x86 assembly (clang, -O0):
<read_user>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xebf(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xedf(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xeea(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xef0(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xf0b(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xf11(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xf0f(%rip),%rdi
call   1050 <my_putstr@plt>
mov    $0x0,%al
call   1040 <readLine@plt>
mov    %rax,-0x8(%rbp)
lea    0xeec(%rip),%rdi
call   1050 <my_putstr@plt>
mov    -0x8(%rbp),%rdi
call   1030 <do_action@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_user>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xec6(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xee6(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xef1(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xef7(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xf12(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xf18(%rip),%rdi
call   1050 <my_putstr@plt>
lea    0xf16(%rip),%rdi
call   1050 <my_putstr@plt>
xor    %eax,%eax
call   1040 <readLine@plt>
mov    %rax,%rbx
lea    0xef4(%rip),%rdi
call   1050 <my_putstr@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <do_action@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"\0A\0A\1B[0;31m\00"
@.str.1 = [44 x i8] c" Bienvenue dans l'interface de Chappie\0A\00"
@.str.2 = [23 x i8] c" 1) Voir le stock\0A\00"
@.str.3 = [18 x i8] c" 2) Cuisiner\0A\00"
@.str.4 = [39 x i8] c" 3) Mettre a jour les ingredients\0A\00"
@.str.5 = [18 x i8] c" 4) Quitter\0A\0A\00"
@.str.6 = [10 x i8] c" \1B[0m\00"
@.str.7 = [29 x i8] c"\0A\0A Choisir une option : \00"
@.str.8 = [2 x i8] c"\0A\00"
define void @read_user() {
%1 = alloca i8*
%2 = call i32 @my_putstr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @my_putstr(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @my_putstr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @my_putstr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @my_putstr(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @my_putstr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @my_putstr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%9 = call i32 @my_putstr(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%10 = call i8* (...) @readLine()
store i8* %10, i8** %1
%11 = call i32 @my_putstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%12 = load i8*, i8** %1
%13 = call i32 @do_action(i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"\0A\0A\1B[0;31m\00"
@.str.1 = [44 x i8] c" Bienvenue dans l'interface de Chappie\0A\00"
@.str.2 = [23 x i8] c" 1) Voir le stock\0A\00"
@.str.3 = [18 x i8] c" 2) Cuisiner\0A\00"
@.str.4 = [39 x i8] c" 3) Mettre a jour les ingredients\0A\00"
@.str.5 = [18 x i8] c" 4) Quitter\0A\0A\00"
@.str.6 = [10 x i8] c" \1B[0m\00"
@.str.7 = [29 x i8] c"\0A\0A Choisir une option : \00"
@.str.8 = [2 x i8] c"\0A\00"
define void @read_user() {
%1 = tail call i32 @my_putstr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @my_putstr(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @my_putstr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @my_putstr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @my_putstr(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @my_putstr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%7 = tail call i32 @my_putstr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%8 = tail call i32 @my_putstr(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%9 = tail call i8* (...) @readLine()
%10 = tail call i32 @my_putstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%11 = tail call i32 @do_action(i8* %9)
ret void
}