#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 *);
char *strchr(char *, char);
int strchrind(char *, char);
int /*<<< orphan*/ strncat(char *, char *, int);
void strcpybtw(char **pstrDestination, char *strSource, char *strBetween,
               char chrSep) {
  char *fin;
  int indice;
  fin = strchr(strSource, chrSep);
  indice = strchrind(strSource, chrSep);
  *pstrDestination[0] = '\0';
  strncat(*pstrDestination, strSource, indice);
  strcat(*pstrDestination, strBetween);
  strcat(*pstrDestination, fin);
}


x86 assembly (clang, -O0):
<strcpybtw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x10(%rbp),%rdi
movsbl -0x19(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
movsbl -0x19(%rbp),%esi
call   1050 <strchrind@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1040 <strncat@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <strcat@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpybtw>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r15d
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rsi,%rdi
mov    %ecx,%esi
call   1030 <strchr@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    %r15d,%esi
call   1050 <strchrind@plt>
mov    0x0(%rbp),%rcx
movb   $0x0,(%rcx)
mov    0x0(%rbp),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <strncat@plt>
mov    0x0(%rbp),%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    0x0(%rbp),%rdi
mov    %r12,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <strcat@plt>

LLVM IR (-O0):
define void @strcpybtw(i8** %0, i8* %1, i8* %2, i8 signext %3) {
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i32
store i8** %0, i8*** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8 %3, i8* %8
%11 = load i8*, i8** %6
%12 = load i8, i8* %8
%13 = call i8* @strchr(i8* %11, i8 signext %12)
store i8* %13, i8** %9
%14 = load i8*, i8** %6
%15 = load i8, i8* %8
%16 = call i32 @strchrind(i8* %14, i8 signext %15)
store i32 %16, i32* %10
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
store i8 0, i8* %19
%20 = load i8**, i8*** %5
%21 = load i8*, i8** %20
%22 = load i8*, i8** %6
%23 = load i32, i32* %10
%24 = call i32 @strncat(i8* %21, i8* %22, i32 %23)
%25 = load i8**, i8*** %5
%26 = load i8*, i8** %25
%27 = load i8*, i8** %7
%28 = call i32 @strcat(i8* %26, i8* %27)
%29 = load i8**, i8*** %5
%30 = load i8*, i8** %29
%31 = load i8*, i8** %9
%32 = call i32 @strcat(i8* %30, i8* %31)
ret void
}

LLVM IR (-O2):
define void @strcpybtw(i8** nocapture %0, i8* %1, i8* %2, i8 signext %3) {
%5 = tail call i8* @strchr(i8* dereferenceable(1) %1, i8 signext %3)
%6 = tail call i32 @strchrind(i8* %1, i8 signext %3)
%7 = load i8*, i8** %0
store i8 0, i8* %7
%8 = load i8*, i8** %0
%9 = tail call i32 @strncat(i8* %8, i8* %1, i32 %6)
%10 = load i8*, i8** %0
%11 = tail call i32 @strcat(i8* %10, i8* %2)
%12 = load i8*, i8** %0
%13 = tail call i32 @strcat(i8* %12, i8* %5)
ret void
}