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


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
add    %rax,%rdi
add    $0x40,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1192 <foo+0x52>
movq   $0x0,-0x8(%rbp)
jmp    11d4 <foo+0x94>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

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

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

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