#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*/ normal(int, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ recursive(int, char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int number;
  char name[50];
  printf("Digite o seu nome:\n");
  scanf(" %s", name);
  printf("Digite quantas vezes será exibido:\n");
  scanf("%d", &number);
  printf("Forma normal:\n");
  normal(number, name);
  printf("\nForma recursiva:\n");
  recursive(number, name);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1060 <normal@plt>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1050 <recursive@plt>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
lea    0xe98(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe9c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe7a(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1070 <normal@plt>
lea    0xe97(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1060 <recursive@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Digite o seu nome:\0A\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [37 x i8] c"Digite quantas vezes ser\C3\A1 exibido:\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [15 x i8] c"Forma normal:\0A\00"
@.str.5 = [19 x i8] c"\0AForma recursiva:\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [50 x i8]
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%12 = call i32 @normal(i32 %10, i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%14 = load i32, i32* %2
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%16 = call i32 @recursive(i32 %14, i8* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c" %s\00"
@.str.3 = [3 x i8] c"%d\00"
@str = [19 x i8] c"Digite o seu nome:\00"
@str.7 = [36 x i8] c"Digite quantas vezes ser\C3\A1 exibido:\00"
@str.8 = [14 x i8] c"Forma normal:\00"
@str.9 = [18 x i8] c"\0AForma recursiva:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.7, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.8, i64 0, i64 0))
%10 = load i32, i32* %1
%11 = call i32 @normal(i32 %10, i8* %4)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.9, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = call i32 @recursive(i32 %13, i8* %4)
%15 = call i32 @putchar(i32 10)
ret i32 0
}