#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 */
unsigned int ustrlen(unsigned char *);
void uconcat(unsigned char dest[], unsigned char source[]) {
  unsigned int i, j;
  j = ustrlen(dest);
  for (i = 0; i <= ustrlen(source); i++) {
    dest[i + j] = source[i];
  }
}


x86 assembly (clang, -O0):
<uconcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ustrlen@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ustrlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
ja     1176 <uconcat+0x66>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
mov    %ecx,%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <uconcat+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uconcat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
call   1030 <ustrlen@plt>
mov    %eax,%r15d
mov    %r12,%rdi
call   1030 <ustrlen@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
movzbl (%r12,%rax,1),%eax
lea    (%r15,%rbx,1),%ecx
mov    %al,(%r14,%rcx,1)
add    $0x1,%ebx
mov    %r12,%rdi
call   1030 <ustrlen@plt>
cmp    %eax,%ebx
jbe    1130 <uconcat+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @uconcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @ustrlen(i8* %7)
store i32 %8, i32* %6
store i32 0, i32* %5
br label %9
9: ; preds = %26, %2
%10 = load i32, i32* %5
%11 = load i8*, i8** %4
%12 = call i32 @ustrlen(i8* %11)
%13 = icmp ule i32 %10, %12
br i1 %13, label %14, label %29
14: ; preds = %9
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = load i8*, i8** %3
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = add i32 %21, %22
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %20, i64 %24
store i8 %19, i8* %25
br label %26
26: ; preds = %14
%27 = load i32, i32* %5
%28 = add i32 %27, 1
store i32 %28, i32* %5
br label %9
29: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @uconcat(i8* %0, i8* %1) {
%3 = tail call i32 @ustrlen(i8* %0)
%4 = tail call i32 @ustrlen(i8* %1)
br label %5
5: ; preds = %2, %5
%6 = phi i32 [ 0, %2 ], [ %13, %5 ]
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = load i8, i8* %8
%10 = add i32 %6, %3
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
store i8 %9, i8* %12
%13 = add i32 %6, 1
%14 = tail call i32 @ustrlen(i8* %1)
%15 = icmp ugt i32 %13, %14
br i1 %15, label %16, label %5
16: ; preds = %5
ret void
}