#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 catxc(char *sxout, char **spt, int n, char c) {
  int i;
  char cc[2];
  sxout[0] = '\0';
  cc[0] = c;
  cc[1] = '\0';
  for (i = 0; i < n; i++) {
    strcat(sxout, spt[i]);
    if (i < (n - 1))
      strcat(sxout, cc);
  }
}


x86 assembly (clang, -O0):
<catxc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x15(%rbp),%al
mov    %al,-0x1e(%rbp)
movb   $0x0,-0x1d(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1192 <catxc+0x82>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcat@plt>
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    117f <catxc+0x6f>
mov    -0x8(%rbp),%rdi
lea    -0x1e(%rbp),%rsi
call   1030 <strcat@plt>
jmp    1184 <catxc+0x74>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1140 <catxc+0x30>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<catxc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movb   $0x0,(%rdi)
mov    %cl,0x6(%rsp)
movb   $0x0,0x7(%rsp)
test   %edx,%edx
jle    1177 <catxc+0x67>
mov    %rsi,%r14
mov    %rdi,%rbx
lea    -0x1(%rdx),%r12d
mov    %edx,%r13d
xor    %ebp,%ebp
lea    0x6(%rsp),%r15
jmp    1159 <catxc+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%r13
je     1177 <catxc+0x67>
mov    (%r14,%rbp,8),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
cmp    %r12,%rbp
jae    1150 <catxc+0x40>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcat@plt>
jmp    1150 <catxc+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @catxc(i8* %0, i8** %1, i32 %2, i8 signext %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8
%9 = alloca i32
%10 = alloca [2 x i8]
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i8 %3, i8* %8
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 0
store i8 0, i8* %12
%13 = load i8, i8* %8
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
store i8 %13, i8* %14
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 1
store i8 0, i8* %15
store i32 0, i32* %9
br label %16
16: ; preds = %37, %4
%17 = load i32, i32* %9
%18 = load i32, i32* %7
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %40
20: ; preds = %16
%21 = load i8*, i8** %5
%22 = load i8**, i8*** %6
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @strcat(i8* %21, i8* %26)
%28 = load i32, i32* %9
%29 = load i32, i32* %7
%30 = sub nsw i32 %29, 1
%31 = icmp slt i32 %28, %30
br i1 %31, label %32, label %36
32: ; preds = %20
%33 = load i8*, i8** %5
%34 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
%35 = call i32 @strcat(i8* %33, i8* %34)
br label %36
36: ; preds = %32, %20
br label %37
37: ; preds = %36
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 1
store i32 %39, i32* %9
br label %16
40: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @catxc(i8* %0, i8** nocapture %1, i32 %2, i8 signext %3) {
%5 = alloca [2 x i8]
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 0, i8* %0
store i8 %3, i8* %6
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
store i8 0, i8* %7
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %24
9: ; preds = %4
%10 = add nsw i32 %2, -1
%11 = zext i32 %10 to i64
%12 = zext i32 %2 to i64
br label %13
13: ; preds = %9, %21
%14 = phi i64 [ 0, %9 ], [ %22, %21 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @strcat(i8* %0, i8* %16)
%18 = icmp ult i64 %14, %11
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 @strcat(i8* %0, i8* %6)
br label %21
21: ; preds = %13, %19
%22 = add nuw nsw i64 %14, 1
%23 = icmp eq i64 %22, %12
br i1 %23, label %24, label %13
24: ; preds = %21, %4
ret void
}