#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*/ memcpy(char *, char *, char);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strcpy(char *, char *);
char strlen(char *);
void displayError(char *word) {
  char c[32];
  memset(c, 0, 32);
  c[0] = '#';
  char len = strlen(word);
  memcpy(c + 1, word, len);
  c[len + 1] = '#';
  strcpy(word, c);
}


x86 assembly (clang, -O0):
<displayError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
movb   $0x23,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %al,-0x31(%rbp)
lea    -0x30(%rbp),%rdi
add    $0x1,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x31(%rbp),%al
movsbl %al,%edx
call   1060 <memcpy@plt>
movsbl -0x31(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x23,-0x30(%rbp,%rax,1)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayError>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
movb   $0x23,(%rsp)
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rsp),%rdi
movsbl %al,%ebp
mov    %rbx,%rsi
mov    %ebp,%edx
call   1060 <memcpy@plt>
movsbq %bpl,%rax
movb   $0x23,0x1(%rax,%r14,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @displayError(i8* %0) {
%2 = alloca i8*
%3 = alloca [32 x i8]
%4 = alloca i8
store i8* %0, i8** %2
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 32)
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
store i8 35, i8* %7
%8 = load i8*, i8** %2
%9 = call signext i8 @strlen(i8* %8)
store i8 %9, i8* %4
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8*, i8** %2
%13 = load i8, i8* %4
%14 = call i32 @memcpy(i8* %11, i8* %12, i8 signext %13)
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = add nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 %18
store i8 35, i8* %19
%20 = load i8*, i8** %2
%21 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%22 = call i32 @strcpy(i8* %20, i8* %21)
ret void
}

LLVM IR (-O2):
define void @displayError(i8* %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 32)
store i8 35, i8* %3
%5 = call signext i8 @strlen(i8* %0)
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 1
%7 = call i32 @memcpy(i8* %6, i8* %0, i8 signext %5)
%8 = sext i8 %5 to i64
%9 = add nsw i64 %8, 1
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 %9
store i8 35, i8* %10
%11 = call i32 @strcpy(i8* %0, i8* %3)
ret void
}