#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*/ getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strrev(char *);
int main() {
  char name[25];
  char name_cp[50];
  char new_name[255];
  int string_length;
  string_length = strlen(name);
  printf("\nLength of [name] before assignment %d", string_length);
  printf("\nEnter name: ");
  scanf("%s", &*name);
  string_length = strlen(name);
  printf("\nLength of [name] after assignment %d", string_length);
  printf("\nYou've entrered name [%s]", name);
  strcpy(name_cp, name);
  printf("\nCopy name into name_cp [%s] into [%s]", name, name_cp);
  printf("\nEnter your name again please: ");
  gets(new_name);
  printf("\nGets input is [%s]", new_name);
  strcat(name, name_cp);
  printf("\nName now is : %s", name);
  strrev(name);
  printf("\nName after reverse of the name : %s", name);
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x164(%rbp)
mov    -0x164(%rbp),%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xf3e(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x164(%rbp)
mov    -0x164(%rbp),%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x160(%rbp),%rdi
call   1070 <gets@plt>
lea    -0x160(%rbp),%rsi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   10a0 <strcat@plt>
lea    -0x20(%rbp),%rsi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1090 <strrev@plt>
lea    -0x20(%rbp),%rsi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x160,%rsp
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    0xe62(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf49(%rip),%rdi
mov    %r15,%rsi
call   1080 <scanf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    0xe62(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe78(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xe72(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <gets@plt>
lea    0xe8a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   10a0 <strcat@plt>
lea    0xe82(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1090 <strrev@plt>
lea    0xe7b(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [39 x i8] c"\0ALength of [name] before assignment %d\00"
@.str.1 = [14 x i8] c"\0AEnter name: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [38 x i8] c"\0ALength of [name] after assignment %d\00"
@.str.4 = [27 x i8] c"\0AYou've entrered name [%s]\00"
@.str.5 = [39 x i8] c"\0ACopy name into name_cp [%s] into [%s]\00"
@.str.6 = [32 x i8] c"\0AEnter your name again please: \00"
@.str.7 = [20 x i8] c"\0AGets input is [%s]\00"
@.str.8 = [18 x i8] c"\0AName now is : %s\00"
@.str.9 = [37 x i8] c"\0AName after reverse of the name : %s\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = alloca [50 x i8]
%3 = alloca [255 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%20 = call i32 @strcpy(i8* %18, i8* %19)
%21 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%22 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %21, i8* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
%25 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%26 = call i32 @gets(i8* %25)
%27 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %27)
%29 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%31 = call i32 @strcat(i8* %29, i8* %30)
%32 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%35 = call i32 @strrev(i8* %34)
%36 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i8* %36)
%38 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [39 x i8] c"\0ALength of [name] before assignment %d\00"
@.str.1 = [14 x i8] c"\0AEnter name: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [38 x i8] c"\0ALength of [name] after assignment %d\00"
@.str.4 = [27 x i8] c"\0AYou've entrered name [%s]\00"
@.str.5 = [39 x i8] c"\0ACopy name into name_cp [%s] into [%s]\00"
@.str.6 = [32 x i8] c"\0AEnter your name again please: \00"
@.str.7 = [20 x i8] c"\0AGets input is [%s]\00"
@.str.8 = [18 x i8] c"\0AName now is : %s\00"
@.str.9 = [37 x i8] c"\0AName after reverse of the name : %s\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = alloca [50 x i8]
%3 = alloca [255 x i8]
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%7 = call i32 @strlen(i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%11 = call i32 @strlen(i8* %4)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%14 = call i32 @strcpy(i8* %5, i8* %4)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %4, i8* %5)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @gets(i8* %6)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %6)
%19 = call i32 @strcat(i8* %4, i8* %5)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i8* %4)
%21 = call i32 @strrev(i8* %4)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i8* %4)
%23 = call i32 (...) @getchar()
ret i32 0
}