#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 getLine(char *, int);
int /*<<< orphan*/ printf(char *);
void requestName(char *name) {
  int rc = 0;
  do {
    printf("Inserisci nome (MAX 8 caratteri): ");
    rc = getLine(name, sizeof(char[9]));
    if (rc == 2) {
      printf("Nome troppo lungo. Riprovare.\n");
    } else if (rc == 1) {
      printf("Nessun carattere inserito. Riprovare.\n");
    } else if (rc == 3) {
      printf("Nome non valido (evita spazi o invio) . Riprovare.\n");
    }
  } while (rc != 0);
}


x86 assembly (clang, -O0):
<requestName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x9,%esi
call   1040 <getLine@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jne    116b <requestName+0x4b>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
jmp    11a6 <requestName+0x86>
cmpl   $0x1,-0xc(%rbp)
jne    1186 <requestName+0x66>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
jmp    11a1 <requestName+0x81>
cmpl   $0x3,-0xc(%rbp)
jne    119c <requestName+0x7c>
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
jmp    11a1 <requestName+0x81>
jmp    11a6 <requestName+0x86>
jmp    11ab <requestName+0x8b>
cmpl   $0x0,-0xc(%rbp)
jne    1133 <requestName+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<requestName>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xecb(%rip),%r14
lea    0xf40(%rip),%r15
lea    0xead(%rip),%r12
lea    0xf0c(%rip),%r13
lea    0xed2(%rip),%rbp
jmp    1178 <requestName+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1050 <getLine@plt>
cmp    $0x3,%eax
ja     1178 <requestName+0x48>
mov    %eax,%eax
movslq (%r12,%rax,4),%rax
add    %r12,%rax
mov    %r15,%rdi
jmp    *%rax
mov    %r13,%rdi
call   1030 <puts@plt>
jmp    1178 <requestName+0x48>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Inserisci nome (MAX 8 caratteri): \00"
@.str.1 = [31 x i8] c"Nome troppo lungo. Riprovare.\0A\00"
@.str.2 = [39 x i8] c"Nessun carattere inserito. Riprovare.\0A\00"
@.str.3 = [52 x i8] c"Nome non valido (evita spazi o invio) . Riprovare.\0A\00"
define void @requestName(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %25, %1
%5 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 @getLine(i8* %6, i32 9)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %24
12: ; preds = %4
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %23
17: ; preds = %12
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 3
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
br label %23
23: ; preds = %22, %15
br label %24
24: ; preds = %23, %10
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = icmp ne i32 %26, 0
br i1 %27, label %4, label %28
28: ; preds = %25
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"Inserisci nome (MAX 8 caratteri): \00"
@str = [51 x i8] c"Nome non valido (evita spazi o invio) . Riprovare.\00"
@str.4 = [38 x i8] c"Nessun carattere inserito. Riprovare.\00"
@str.5 = [30 x i8] c"Nome troppo lungo. Riprovare.\00"
define void @requestName(i8* %0) {
br label %2
2: ; preds = %8, %1
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @getLine(i8* %0, i32 9)
switch i32 %4, label %8 [
i32 2, label %5
i32 1, label %9
i32 3, label %10
i32 0, label %11
]
5: ; preds = %2, %10, %9
%6 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @str.4, i64 0, i64 0), %9 ], [ getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0), %10 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @str.5, i64 0, i64 0), %2 ]
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
br label %8
8: ; preds = %5, %2
br label %2
9: ; preds = %2
br label %5
10: ; preds = %2
br label %5
11: ; preds = %2
ret void
}