#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*/ strcat(char *, char *);
void concatenate(int n, char **ss, char *a) {
  char *s;
  a[0] = '\0';
  for (int i = 0; i < n; ++i) {
    s = ss[i];
    strcat(a, s);
    strcat(a, " ");
  }
}


x86 assembly (clang, -O0):
<concatenate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1178 <concatenate+0x68>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1131 <concatenate+0x21>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concatenate>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
movb   $0x0,(%rdx)
test   %edi,%edi
jle    1160 <concatenate+0x50>
mov    %rdx,%r13
mov    %rsi,%r14
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xece(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rsi
mov    %r13,%rdi
call   1030 <strcat@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1030 <strcat@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <concatenate+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define void @concatenate(i32 %0, i8** nocapture %1, i8* %2) {
store i8 0, i8* %2
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = zext i32 %0 to i64
br label %8
7: ; preds = %8, %3
ret void
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %14, %8 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @strcat(i8* %2, i8* %11)
%13 = tail call i32 @strcat(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %7, label %8
}