#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 */
struct _stringpool {
  int dummy;
};

/* Variables and functions */
char const *_pbcS_build(struct _stringpool *, char const *, int);
scalar_t__ alloca(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
const char *_concat_name(struct _stringpool *p, const char *prefix,
                         int prefix_sz, const char *name, int name_sz,
                         int *sz) {
  if (prefix_sz == 0) {
    if (sz) {
      *sz = name_sz;
    }
    return _pbcS_build(p, name, name_sz);
  }
  char *temp = (char *)alloca(name_sz + prefix_sz + 2);
  memcpy(temp, prefix, prefix_sz);
  temp[prefix_sz] = '.';
  memcpy(temp + prefix_sz + 1, name, name_sz);
  temp[name_sz + prefix_sz + 1] = '\0';
  if (sz) {
    *sz = name_sz + prefix_sz + 1;
  }
  const char *ret = _pbcS_build(p, temp, name_sz + prefix_sz + 1);
  return ret;
}


x86 assembly (clang, -O0):
<_concat_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9,-0x38(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1186 <_concat_name+0x56>
cmpq   $0x0,-0x38(%rbp)
je     116d <_concat_name+0x3d>
mov    -0x2c(%rbp),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1030 <_pbcS_build@plt>
mov    %rax,-0x8(%rbp)
jmp    121f <_concat_name+0xef>
mov    -0x2c(%rbp),%edi
add    -0x1c(%rbp),%edi
add    $0x2,%edi
call   1040 <alloca@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x40(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x40(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
cmpq   $0x0,-0x38(%rbp)
je     11fd <_concat_name+0xcd>
mov    -0x2c(%rbp),%ecx
add    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x2c(%rbp),%edx
add    -0x1c(%rbp),%edx
add    $0x1,%edx
call   1030 <_pbcS_build@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_concat_name>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r15
mov    %r8d,%r13d
mov    %rcx,%r12
test   %edx,%edx
je     11b2 <_concat_name+0x82>
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,0x10(%rsp)
lea    0x0(%r13,%rbp,1),%eax
mov    %eax,0xc(%rsp)
lea    0x2(%r13,%rbp,1),%edi
call   1040 <alloca@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1050 <memcpy@plt>
movslq %ebp,%rax
movb   $0x2e,(%rbx,%rax,1)
lea    (%rbx,%rax,1),%rdi
add    $0x1,%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1050 <memcpy@plt>
movslq 0xc(%rsp),%rdx
movb   $0x0,0x1(%rbx,%rdx,1)
add    $0x1,%rdx
test   %r15,%r15
je     11a8 <_concat_name+0x78>
mov    %edx,(%r15)
mov    0x10(%rsp),%rdi
mov    %rbx,%rsi
jmp    11c0 <_concat_name+0x90>
test   %r15,%r15
je     11ba <_concat_name+0x8a>
mov    %r13d,(%r15)
mov    %r12,%rsi
mov    %r13d,%edx
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <_pbcS_build@plt>

LLVM IR (-O0):
%struct._stringpool = type { i32 }
define i8* @_concat_name(%struct._stringpool* %0, i8* %1, i32 %2, i8* %3, i32 %4, i32* %5) {
%7 = alloca i8*
%8 = alloca %struct._stringpool*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i8*
%15 = alloca i8*
store %struct._stringpool* %0, %struct._stringpool** %8
store i8* %1, i8** %9
store i32 %2, i32* %10
store i8* %3, i8** %11
store i32 %4, i32* %12
store i32* %5, i32** %13
%16 = load i32, i32* %10
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %6
%19 = load i32*, i32** %13
%20 = icmp ne i32* %19, null
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %12
%23 = load i32*, i32** %13
store i32 %22, i32* %23
br label %24
24: ; preds = %21, %18
%25 = load %struct._stringpool*, %struct._stringpool** %8
%26 = load i8*, i8** %11
%27 = load i32, i32* %12
%28 = call i8* @_pbcS_build(%struct._stringpool* %25, i8* %26, i32 %27)
store i8* %28, i8** %7
br label %76
29: ; preds = %6
%30 = load i32, i32* %12
%31 = load i32, i32* %10
%32 = add nsw i32 %30, %31
%33 = add nsw i32 %32, 2
%34 = call i64 @alloca(i32 %33)
%35 = inttoptr i64 %34 to i8*
store i8* %35, i8** %14
%36 = load i8*, i8** %14
%37 = load i8*, i8** %9
%38 = load i32, i32* %10
%39 = call i32 @memcpy(i8* %36, i8* %37, i32 %38)
%40 = load i8*, i8** %14
%41 = load i32, i32* %10
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
store i8 46, i8* %43
%44 = load i8*, i8** %14
%45 = load i32, i32* %10
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = getelementptr inbounds i8, i8* %47, i64 1
%49 = load i8*, i8** %11
%50 = load i32, i32* %12
%51 = call i32 @memcpy(i8* %48, i8* %49, i32 %50)
%52 = load i8*, i8** %14
%53 = load i32, i32* %12
%54 = load i32, i32* %10
%55 = add nsw i32 %53, %54
%56 = add nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %52, i64 %57
store i8 0, i8* %58
%59 = load i32*, i32** %13
%60 = icmp ne i32* %59, null
br i1 %60, label %61, label %67
61: ; preds = %29
%62 = load i32, i32* %12
%63 = load i32, i32* %10
%64 = add nsw i32 %62, %63
%65 = add nsw i32 %64, 1
%66 = load i32*, i32** %13
store i32 %65, i32* %66
br label %67
67: ; preds = %61, %29
%68 = load %struct._stringpool*, %struct._stringpool** %8
%69 = load i8*, i8** %14
%70 = load i32, i32* %12
%71 = load i32, i32* %10
%72 = add nsw i32 %70, %71
%73 = add nsw i32 %72, 1
%74 = call i8* @_pbcS_build(%struct._stringpool* %68, i8* %69, i32 %73)
store i8* %74, i8** %15
%75 = load i8*, i8** %15
store i8* %75, i8** %7
br label %76
76: ; preds = %67, %24
%77 = load i8*, i8** %7
ret i8* %77
}

LLVM IR (-O2):
%struct._stringpool = type { i32 }
define i8* @_concat_name(%struct._stringpool* %0, i8* %1, i32 %2, i8* %3, i32 %4, i32* writeonly %5) {
%7 = icmp eq i32 %2, 0
br i1 %7, label %8, label %13
8: ; preds = %6
%9 = icmp eq i32* %5, null
br i1 %9, label %11, label %10
10: ; preds = %8
store i32 %4, i32* %5
br label %11
11: ; preds = %10, %8
%12 = tail call i8* @_pbcS_build(%struct._stringpool* %0, i8* %3, i32 %4)
br label %30
13: ; preds = %6
%14 = add nsw i32 %4, %2
%15 = add nsw i32 %14, 2
%16 = tail call i64 @alloca(i32 %15)
%17 = inttoptr i64 %16 to i8*
%18 = tail call i32 @memcpy(i8* %17, i8* %1, i32 %2)
%19 = sext i32 %2 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
store i8 46, i8* %20
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = tail call i32 @memcpy(i8* %21, i8* %3, i32 %4)
%23 = add nsw i32 %14, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %17, i64 %24
store i8 0, i8* %25
%26 = icmp eq i32* %5, null
br i1 %26, label %28, label %27
27: ; preds = %13
store i32 %23, i32* %5
br label %28
28: ; preds = %27, %13
%29 = tail call i8* @_pbcS_build(%struct._stringpool* %0, i8* %17, i32 %23)
br label %30
30: ; preds = %28, %11
%31 = phi i8* [ %12, %11 ], [ %29, %28 ]
ret i8* %31
}