char *str2cat(char *f1, char *ext) {
  char *p;
  static char buf[69];
  p = buf;
  while (*f1)
    *p++ = *f1++;
  *p++ = '.';
  while ((*p++ = *ext++) != 0)
    continue;
  return (buf);
}


x86 assembly (clang, -O0):
<str2cat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <str2cat+0x4b>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1117 <str2cat+0x17>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x2e,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1190 <str2cat+0x90>
jmp    115d <str2cat+0x5d>
lea    0x2e99(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str2cat>:
mov    (%rdi),%cl
test   %cl,%cl
je     1133 <str2cat+0x33>
add    $0x1,%rdi
lea    0x2f1f(%rip),%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1120 <str2cat+0x20>
jmp    113a <str2cat+0x3a>
lea    0x2ef6(%rip),%rax
movb   $0x2e,(%rax)
xor    %ecx,%ecx
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,0x1(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1140 <str2cat+0x40>
lea    0x2ed9(%rip),%rax
ret

LLVM IR (-O0):
@str2cat.buf = internal global [69 x i8] zeroinitializer
define i8* @str2cat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i8* getelementptr inbounds ([69 x i8], [69 x i8]* @str2cat.buf, i64 0, i64 0), i8** %5
br label %6
6: ; preds = %10, %2
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %5
store i8 %13, i8* %14
br label %6
16: ; preds = %6
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %5
store i8 46, i8* %17
br label %19
19: ; preds = %27, %16
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
%22 = load i8, i8* %20
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %5
store i8 %22, i8* %23
%25 = sext i8 %22 to i32
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %19
br label %19
28: ; preds = %19
ret i8* getelementptr inbounds ([69 x i8], [69 x i8]* @str2cat.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@str2cat.buf = internal global [69 x i8] zeroinitializer
define i8* @str2cat(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ getelementptr inbounds ([69 x i8], [69 x i8]* @str2cat.buf, i64 0, i64 0), %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %6, i8* %7
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ getelementptr inbounds ([69 x i8], [69 x i8]* @str2cat.buf, i64 0, i64 0), %2 ], [ %10, %5 ]
store i8 46, i8* %14
br label %15
15: ; preds = %15, %13
%16 = phi i8* [ %1, %13 ], [ %19, %15 ]
%17 = phi i8* [ %14, %13 ], [ %18, %15 ]
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = getelementptr inbounds i8, i8* %16, i64 1
%20 = load i8, i8* %16
store i8 %20, i8* %18
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %15
22: ; preds = %15
ret i8* getelementptr inbounds ([69 x i8], [69 x i8]* @str2cat.buf, i64 0, i64 0)
}