#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*/ strcpy(char *, char const *);
int /*<<< orphan*/ walk(int *, int);
void hello(const char *input) {
  int local = 0xefbeadde;
  char buf[8];
  walk(&local + 3, 40);
  strcpy(buf, input);
  printf("\nYou entered: '%s'\n\n", buf);
  walk(&local + 3, 40);
  printf("%04hhx\n", local);
}


x86 assembly (clang, -O0):
<hello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xefbeadde,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
add    $0xc,%rdi
mov    $0x28,%esi
call   1050 <walk@plt>
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x14(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xc(%rbp),%rdi
add    $0xc,%rdi
mov    $0x28,%esi
call   1050 <walk@plt>
mov    -0xc(%rbp),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0xefbeadde,0x4(%rsp)
ef
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x28,%esi
call   1050 <walk@plt>
lea    0x8(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe93(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x28,%esi
call   1050 <walk@plt>
mov    0x4(%rsp),%esi
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0AYou entered: '%s'\0A\0A\00"
@.str.1 = [8 x i8] c"%04hhx\0A\00"
define void @hello(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [8 x i8]
store i8* %0, i8** %2
store i32 -272716322, i32* %3
%5 = getelementptr inbounds i32, i32* %3, i64 3
%6 = call i32 @walk(i32* %5, i32 40)
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%8 = load i8*, i8** %2
%9 = call i32 @strcpy(i8* %7, i8* %8)
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds i32, i32* %3, i64 3
%13 = call i32 @walk(i32* %12, i32 40)
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0AYou entered: '%s'\0A\0A\00"
@.str.1 = [8 x i8] c"%04hhx\0A\00"
define void @hello(i8* %0) {
%2 = alloca i32
%3 = alloca [8 x i8]
%4 = bitcast i32* %2 to i8*
store i32 -272716322, i32* %2
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds i32, i32* %2, i64 3
%7 = call i32 @walk(i32* %6, i32 40)
%8 = call i32 @strcpy(i8* %5, i8* %0)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5)
%10 = call i32 @walk(i32* %6, i32 40)
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret void
}