__attribute__((no, noclone)) char *bar(char *p) {
  char buf[26];
  char *r;
  if (strlen(p) + 9 > 26)
    return ((void *)0);
  *buf = '\0';
  strcat(buf, p);
  strcat(buf, "/");
  r = strchr(buf, '\0');
  *r = '\0';
  strcat(buf, "abcde");
  return strdup(buf);
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x9,%rax
cmp    $0x1a,%rax
jbe    1170 <bar+0x30>
movq   $0x0,-0x8(%rbp)
jmp    11c4 <bar+0x84>
movb   $0x0,-0x30(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x30(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
call   1040 <strchr@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x30(%rbp),%rdi
lea    0xe50(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x30(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%rbx
call   1030 <strlen@plt>
add    $0xffffffffffffffee,%rax
cmp    $0xffffffffffffffe5,%rax
jae    114d <bar+0x1d>
xor    %eax,%eax
jmp    1197 <bar+0x67>
movb   $0x0,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcat@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
movw   $0x2f,(%rsp,%rax,1)
mov    %r14,%rdi
call   1030 <strlen@plt>
movb   $0x0,(%rsp,%rax,1)
mov    %r14,%rdi
call   1030 <strlen@plt>
movl   $0x64636261,(%rsp,%rax,1)
movw   $0x65,0x4(%rsp,%rax,1)
mov    %r14,%rdi
call   1050 <strdup@plt>
add    $0x28,%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* @bar(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [26 x i8]
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = add i64 %7, 9
%9 = icmp ugt i64 %8, 26
br i1 %9, label %10, label %11
10: ; preds = %1
store i8* null, i8** %2
br label %25
11: ; preds = %1
%12 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
store i8 0, i8* %12
%13 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%14 = load i8*, i8** %3
%15 = call i8* @strcat(i8* %13, i8* %14)
%16 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%17 = call i8* @strcat(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%19 = call i8* @strchr(i8* %18, i32 0)
store i8* %19, i8** %5
%20 = load i8*, i8** %5
store i8 0, i8* %20
%21 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%22 = call i8* @strcat(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%23 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%24 = call i8* @strdup(i8* %23)
store i8* %24, i8** %2
br label %25
25: ; preds = %11, %10
%26 = load i8*, i8** %2
ret i8* %26
}

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