#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*/ strlen(char *);
char *strcat(register char *s, register const char *t) {
  char *dest = s;
  s += strlen(s);
  for (;;) {
    if (!(*s = *t))
      break;
    ++s;
    ++t;
    if (!(*s = *t))
      break;
    ++s;
    ++t;
    if (!(*s = *t))
      break;
    ++s;
    ++t;
    if (!(*s = *t))
      break;
    ++s;
    ++t;
  }
  return dest;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
jne    115a <strcat+0x4a>
jmp    120a <strcat+0xfa>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
jne    118b <strcat+0x7b>
jmp    120a <strcat+0xfa>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
jne    11bc <strcat+0xac>
jmp    120a <strcat+0xfa>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
jne    11ed <strcat+0xdd>
jmp    120a <strcat+0xfa>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1141 <strcat+0x31>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
cltq
mov    (%rbx),%cl
mov    %cl,(%r14,%rax,1)
test   %cl,%cl
je     1176 <strcat+0x66>
add    %r14,%rax
mov    $0x4,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl -0x3(%rbx,%rcx,1),%edx
mov    %dl,-0x3(%rax,%rcx,1)
test   %dl,%dl
je     1176 <strcat+0x66>
movzbl -0x2(%rbx,%rcx,1),%edx
mov    %dl,-0x2(%rax,%rcx,1)
test   %dl,%dl
je     1176 <strcat+0x66>
movzbl -0x1(%rbx,%rcx,1),%edx
mov    %dl,-0x1(%rax,%rcx,1)
test   %dl,%dl
je     1176 <strcat+0x66>
movzbl (%rbx,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x4,%rcx
test   %dl,%dl
jne    1140 <strcat+0x30>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = load i8*, i8** %3
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds i8, i8* %9, i64 %10
store i8* %11, i8** %3
br label %12
12: ; preds = %48, %2
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = load i8*, i8** %3
store i8 %14, i8* %15
%16 = icmp ne i8 %14, 0
br i1 %16, label %18, label %17
17: ; preds = %12
br label %53
18: ; preds = %12
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %4
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = load i8*, i8** %3
store i8 %24, i8* %25
%26 = icmp ne i8 %24, 0
br i1 %26, label %28, label %27
27: ; preds = %18
br label %53
28: ; preds = %18
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
%31 = load i8*, i8** %4
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %4
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = load i8*, i8** %3
store i8 %34, i8* %35
%36 = icmp ne i8 %34, 0
br i1 %36, label %38, label %37
37: ; preds = %28
br label %53
38: ; preds = %28
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %3
%41 = load i8*, i8** %4
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %4
%43 = load i8*, i8** %4
%44 = load i8, i8* %43
%45 = load i8*, i8** %3
store i8 %44, i8* %45
%46 = icmp ne i8 %44, 0
br i1 %46, label %48, label %47
47: ; preds = %38
br label %53
48: ; preds = %38
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %3
%51 = load i8*, i8** %4
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %4
br label %12
53: ; preds = %47, %37, %27, %17
%54 = load i8*, i8** %5
ret i8* %54
}

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %1
store i8 %6, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %30, label %8
8: ; preds = %2, %25
%9 = phi i8* [ %26, %25 ], [ %5, %2 ]
%10 = phi i8* [ %27, %25 ], [ %1, %2 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = getelementptr inbounds i8, i8* %10, i64 1
%13 = load i8, i8* %12
store i8 %13, i8* %11
%14 = icmp eq i8 %13, 0
br i1 %14, label %30, label %15
15: ; preds = %8
%16 = getelementptr inbounds i8, i8* %9, i64 2
%17 = getelementptr inbounds i8, i8* %10, i64 2
%18 = load i8, i8* %17
store i8 %18, i8* %16
%19 = icmp eq i8 %18, 0
br i1 %19, label %30, label %20
20: ; preds = %15
%21 = getelementptr inbounds i8, i8* %9, i64 3
%22 = getelementptr inbounds i8, i8* %10, i64 3
%23 = load i8, i8* %22
store i8 %23, i8* %21
%24 = icmp eq i8 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %20
%26 = getelementptr inbounds i8, i8* %9, i64 4
%27 = getelementptr inbounds i8, i8* %10, i64 4
%28 = load i8, i8* %27
store i8 %28, i8* %26
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %8
30: ; preds = %25, %8, %15, %20, %2
ret i8* %0
}