#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*/ flushall();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
void main() {
  int i = 0;
  int j = 0;
  int count = 15;
  char name[50], new_name[50];
  printf("Please enter your first name: ");
  gets(name);
  printf("\n");
  puts(name);
  printf("\n");
  getchar();
  for (i = 0; i < count; i++) {
    new_name[j] = name[i];
    j++;
    new_name[j] = ' ';
    j++;
  }
  puts(new_name);
  flushall();
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xf,-0xc(%rbp)
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1070 <gets@plt>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <puts@plt>
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f9 <main+0xa9>
movslq -0x4(%rbp),%rax
mov    -0x40(%rbp,%rax,1),%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movb   $0x20,-0x80(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b4 <main+0x64>
lea    -0x80(%rbp),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <flushall@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
lea    0xe91(%rip),%rdi
call   1050 <printf@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <gets@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    0x40(%rsp),%al
mov    0x41(%rsp),%cl
mov    %al,(%rsp)
movb   $0x20,0x1(%rsp)
mov    %cl,0x2(%rsp)
movb   $0x20,0x3(%rsp)
mov    0x42(%rsp),%al
mov    %al,0x4(%rsp)
movb   $0x20,0x5(%rsp)
mov    0x43(%rsp),%al
mov    %al,0x6(%rsp)
movb   $0x20,0x7(%rsp)
mov    0x44(%rsp),%al
mov    %al,0x8(%rsp)
movb   $0x20,0x9(%rsp)
mov    0x45(%rsp),%al
mov    %al,0xa(%rsp)
movb   $0x20,0xb(%rsp)
mov    0x46(%rsp),%al
mov    0x47(%rsp),%cl
mov    %al,0xc(%rsp)
movb   $0x20,0xd(%rsp)
mov    %cl,0xe(%rsp)
movb   $0x20,0xf(%rsp)
mov    0x48(%rsp),%al
mov    %al,0x10(%rsp)
movb   $0x20,0x11(%rsp)
mov    0x49(%rsp),%al
mov    %al,0x12(%rsp)
movb   $0x20,0x13(%rsp)
mov    0x4a(%rsp),%al
mov    %al,0x14(%rsp)
movb   $0x20,0x15(%rsp)
mov    0x4b(%rsp),%al
mov    %al,0x16(%rsp)
movb   $0x20,0x17(%rsp)
mov    0x4c(%rsp),%al
mov    %al,0x18(%rsp)
movb   $0x20,0x19(%rsp)
mov    0x4d(%rsp),%al
mov    %al,0x1a(%rsp)
movb   $0x20,0x1b(%rsp)
mov    0x4e(%rsp),%al
mov    %al,0x1c(%rsp)
movb   $0x20,0x1d(%rsp)
mov    %rsp,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <flushall@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Please enter your first name: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [50 x i8]
%5 = alloca [50 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 15, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%11 = call i32 @puts(i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (...) @getchar()
store i32 0, i32* %1
br label %14
14: ; preds = %33, %0
%15 = load i32, i32* %1
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %36
18: ; preds = %14
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 %24
store i8 %22, i8* %25
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
%28 = load i32, i32* %2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 %29
store i8 32, i8* %30
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %33
33: ; preds = %18
%34 = load i32, i32* %1
%35 = add nsw i32 %34, 1
store i32 %35, i32* %1
br label %14
36: ; preds = %14
%37 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%38 = call i32 @puts(i8* %37)
%39 = call i32 (...) @flushall()
%40 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Please enter your first name: \00"
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i32 @putchar(i32 10)
%8 = call i32 @puts(i8* %3)
%9 = call i32 @putchar(i32 10)
%10 = call i32 (...) @getchar()
%11 = load i8, i8* %3
store i8 %11, i8* %4
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 1
store i8 32, i8* %12
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 1
%14 = load i8, i8* %13
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 2
store i8 %14, i8* %15
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 3
store i8 32, i8* %16
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 2
%18 = load i8, i8* %17
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 4
store i8 %18, i8* %19
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 5
store i8 32, i8* %20
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 3
%22 = load i8, i8* %21
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 6
store i8 %22, i8* %23
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 7
store i8 32, i8* %24
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 4
%26 = load i8, i8* %25
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 8
store i8 %26, i8* %27
%28 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 9
store i8 32, i8* %28
%29 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 5
%30 = load i8, i8* %29
%31 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 10
store i8 %30, i8* %31
%32 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 11
store i8 32, i8* %32
%33 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 6
%34 = load i8, i8* %33
%35 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 12
store i8 %34, i8* %35
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 13
store i8 32, i8* %36
%37 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 7
%38 = load i8, i8* %37
%39 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 14
store i8 %38, i8* %39
%40 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 15
store i8 32, i8* %40
%41 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 8
%42 = load i8, i8* %41
%43 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 16
store i8 %42, i8* %43
%44 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 17
store i8 32, i8* %44
%45 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 9
%46 = load i8, i8* %45
%47 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 18
store i8 %46, i8* %47
%48 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 19
store i8 32, i8* %48
%49 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 10
%50 = load i8, i8* %49
%51 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 20
store i8 %50, i8* %51
%52 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 21
store i8 32, i8* %52
%53 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 11
%54 = load i8, i8* %53
%55 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 22
store i8 %54, i8* %55
%56 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 23
store i8 32, i8* %56
%57 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 12
%58 = load i8, i8* %57
%59 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 24
store i8 %58, i8* %59
%60 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 25
store i8 32, i8* %60
%61 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 13
%62 = load i8, i8* %61
%63 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 26
store i8 %62, i8* %63
%64 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 27
store i8 32, i8* %64
%65 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 14
%66 = load i8, i8* %65
%67 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 28
store i8 %66, i8* %67
%68 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 29
store i8 32, i8* %68
%69 = call i32 @puts(i8* %4)
%70 = call i32 (...) @flushall()
%71 = call i32 (...) @getchar()
ret void
}