#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 EXIT_SUCCESS;
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
char *reverse_copy(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char str[100] = "abcdefgh";
  char str2[100];
  strcpy(str2, str);
  printf("%s %s\n", str, str2);
  char *str3 = reverse_copy(str);
  printf("%s %s\n", str, str3);
  free(str3);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x64,%edx
call   1070 <memcpy@plt>
lea    -0xf0(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x80(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
lea    0xec4(%rip),%rdi
call   1050 <printf@plt>
lea    -0x80(%rbp),%rdi
call   1060 <reverse_copy@plt>
mov    %rax,-0xf8(%rbp)
lea    -0x80(%rbp),%rsi
mov    -0xf8(%rbp),%rdx
lea    0xe9d(%rip),%rdi
call   1050 <printf@plt>
mov    -0xf8(%rbp),%rdi
call   1030 <free@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xd8,%rsp
movaps 0xefb(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe6f(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0x70(%rsp),%r14
mov    %rsp,%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
lea    0xead(%rip),%r15
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1050 <printf@plt>
mov    %r12,%rdi
call   1060 <reverse_copy@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rax,%rdx
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.str = [100 x i8] c"abcdefgh\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [7 x i8] c"%s %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [100 x i8]* %6 to i8*
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%17 = call i8* @reverse_copy(i8* %16)
store i8* %17, i8** %8
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%19 = load i8*, i8** %8
%20 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %18, i8* %19)
%21 = load i8*, i8** %8
%22 = call i32 @free(i8* %21)
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}

LLVM IR (-O2):
@__const.main.str = [100 x i8] c"abcdefgh\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [7 x i8] c"%s %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = call i32 @strcpy(i8* %6, i8* %5)
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%9 = call i8* @reverse_copy(i8* %5)
%10 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %9)
%11 = call i32 @free(i8* %9)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}