#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 main() {
  int idade = 0;
  printf("Hello! How old are you? ");
  scanf("%d\n", &idade);
  while (idade == 0) {
    printf("\nAge cannot be 0 nor be decimal. Re-enter your age: ");
    scanf("%d", &idade);
  }
  char nome[21];
  scanf(" %[^\n]s", nome);
  printf("\nHello %s, aged %d!\n", nome, idade);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1185 <main+0x65>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    1156 <main+0x36>
lea    -0x20(%rbp),%rsi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%edx
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
movl   $0x0,0xc(%rsp)
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jne    118e <main+0x6e>
lea    0xebd(%rip),%r14
lea    0xeeb(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     1170 <main+0x50>
lea    0xec0(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Hello! How old are you? \00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [53 x i8] c"\0AAge cannot be 0 nor be decimal. Re-enter your age: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [8 x i8] c" %[^\0A]s\00"
@.str.5 = [21 x i8] c"\0AHello %s, aged %d!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [21 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
br label %6
12: ; preds = %6
%13 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %15, i32 %16)
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [25 x i8] c"Hello! How old are you? \00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [53 x i8] c"\0AAge cannot be 0 nor be decimal. Re-enter your age: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [8 x i8] c" %[^\0A]s\00"
@.str.5 = [21 x i8] c"\0AHello %s, aged %d!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i8]
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %0, %8
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 0
br i1 %12, label %8, label %13
13: ; preds = %8, %0
%14 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %1
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %14, i32 %16)
ret i32 0
}