__attribute__((no, noclone)) char *foo(char *x) {
  char b[64];
  char *q = malloc(strlen(x) + 64);
  char *p = strcpy(b, x);
  char *r;
  if (q == ((void *)0))
    return ((void *)0);
  *q = '\0';
  strcat(q, p);
  strcat(q, "/");
  r = strchr(q, '\0');
  *r = '\0';
  strcat(q, "abcde");
  return q;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x40,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    119e <foo+0x4e>
movq   $0x0,-0x8(%rbp)
jmp    11f0 <foo+0xa0>
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x58(%rbp),%rdi
lea    0xe43(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x58(%rbp),%rdi
xor    %esi,%esi
call   1050 <strchr@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x58(%rbp),%rdi
lea    0xe1f(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x58(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x40(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
test   %rbx,%rbx
je     11a9 <foo+0x69>
movb   $0x0,(%rbx)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movw   $0x2f,(%rbx,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
movl   $0x64636261,(%rbx,%rax,1)
movw   $0x65,0x4(%rbx,%rax,1)
mov    %rbx,%rax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [6 x i8] c"abcde\00"
define i8* @foo(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [64 x i8]
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
%10 = add i64 %9, 64
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %5
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%13 = load i8*, i8** %3
%14 = call i8* @strcpy(i8* %12, i8* %13)
store i8* %14, i8** %6
%15 = load i8*, i8** %5
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %1
store i8* null, i8** %2
br label %31
18: ; preds = %1
%19 = load i8*, i8** %5
store i8 0, i8* %19
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = call i8* @strcat(i8* %20, i8* %21)
%23 = load i8*, i8** %5
%24 = call i8* @strcat(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = load i8*, i8** %5
%26 = call i8* @strchr(i8* %25, i32 0)
store i8* %26, i8** %7
%27 = load i8*, i8** %7
store i8 0, i8* %27
%28 = load i8*, i8** %5
%29 = call i8* @strcat(i8* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%30 = load i8*, i8** %5
store i8* %30, i8** %2
br label %31
31: ; preds = %18, %17
%32 = load i8*, i8** %2
ret i8* %32
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"abcde\00"
define i8* @foo(i8* nocapture %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = add i64 %4, 64
%6 = tail call i8* @malloc(i64 %5)
%7 = call i8* @strcpy(i8* %3, i8* dereferenceable(1) %0)
%8 = icmp eq i8* %6, null
br i1 %8, label %18, label %9
9: ; preds = %1
store i8 0, i8* %6
%10 = call i8* @strcat(i8* %6, i8* %3)
%11 = call i64 @strlen(i8* %6)
%12 = getelementptr i8, i8* %6, i64 %11
%13 = bitcast i8* %12 to i16*
store i16 47, i16* %13
%14 = call i64 @strlen(i8* %6)
%15 = getelementptr i8, i8* %6, i64 %14
store i8 0, i8* %15
%16 = call i64 @strlen(i8* %6)
%17 = getelementptr i8, i8* %6, i64 %16
br label %18
18: ; preds = %1, %9
ret i8* %6
}