#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 */
typedef int /*<<< orphan*/ c_textToSend;

/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int S_IFIFO;
char *concat(char *, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ mknod(char *, int, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int write(int, char *, int);
void sendTextToClient(char *pid, char *p_textToSend) {
  char pipeName[20];
  char *p_pipeName;
  int fd_client;
  char c_textToSend[strlen(p_textToSend) + 1];
  strcpy(c_textToSend, p_textToSend);
  p_pipeName = (char *)malloc(strlen("data/") + strlen(pid) + 1);
  p_pipeName = concat("data/", pid);
  strcpy(pipeName, p_pipeName);
  mknod(pipeName, S_IFIFO | 0666, 0);
  if (1)
    printf("[DEBUG] Writing '%s' (size: %lu) to '%s'\n", c_textToSend,
           sizeof(c_textToSend), pipeName);
  fd_client = open(pipeName, O_RDWR);
  int res = write(fd_client, c_textToSend, sizeof(c_textToSend));
  if (1)
    printf("[DEBUG] Written %d elements\n", res);
}


x86 assembly (clang, -O0):
<sendTextToClient>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
mov    %rax,-0x60(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x68(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    0xe2d(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x6c(%rbp),%edi
add    %eax,%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe00(%rip),%rdi
call   1070 <concat@plt>
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rdi
mov    0x2db7(%rip),%rax
mov    (%rax),%esi
or     $0x1b6,%esi
xor    %edx,%edx
call   1080 <mknod@plt>
mov    -0x60(%rbp),%rdx
mov    -0x68(%rbp),%rsi
lea    -0x30(%rbp),%rcx
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    0x2d93(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    -0x68(%rbp),%rsi
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
mov    %ecx,-0x3c(%rbp)
mov    -0x3c(%rbp),%edi
mov    %eax,%edx
call   1040 <write@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%esi
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x48(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendTextToClient>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r12
mov    %rdi,%r15
mov    %rsi,%rdi
call   1050 <strlen@plt>
mov    %rsp,-0x30(%rbp)
lea    0x1(%rax),%r14d
mov    %rsp,%rbx
lea    0xf(%r14),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
lea    0xe36(%rip),%r12
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,%r13d
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    (%rax,%r13,1),%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1070 <concat@plt>
lea    -0x50(%rbp),%r15
mov    %r15,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    0x2dce(%rip),%rax
mov    $0x1b6,%esi
or     (%rax),%esi
mov    %r15,%rdi
xor    %edx,%edx
call   1080 <mknod@plt>
lea    0xde4(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   10a0 <open@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1040 <write@plt>
lea    0xdd9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x30(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"data/\00"
@S_IFIFO = global i32 0
@.str.1 = [42 x i8] c"[DEBUG] Writing '%s' (size: %lu) to '%s'\0A\00"
@O_RDWR = global i32 0
@.str.2 = [29 x i8] c"[DEBUG] Written %d elements\0A\00"
define void @sendTextToClient(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [20 x i8]
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
%13 = add nsw i32 %12, 1
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %8
%16 = alloca i8, i64 %14
store i64 %14, i64* %9
%17 = load i8*, i8** %4
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%20 = load i8*, i8** %3
%21 = call i32 @strlen(i8* %20)
%22 = add nsw i32 %19, %21
%23 = add nsw i32 %22, 1
%24 = call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %6
%26 = load i8*, i8** %3
%27 = call i8* @concat(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %26)
store i8* %27, i8** %6
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%29 = load i8*, i8** %6
%30 = call i32 @strcpy(i8* %28, i8* %29)
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%32 = load i32, i32* @S_IFIFO
%33 = or i32 %32, 438
%34 = call i32 @mknod(i8* %31, i32 %33, i32 0)
%35 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %16, i64 %14, i8* %35)
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%38 = load i32, i32* @O_RDWR
%39 = call i32 @open(i8* %37, i32 %38)
store i32 %39, i32* %7
%40 = load i32, i32* %7
%41 = trunc i64 %14 to i32
%42 = call i32 @write(i32 %40, i8* %16, i32 %41)
store i32 %42, i32* %10
%43 = load i32, i32* %10
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = load i8*, i8** %8
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"data/\00"
@S_IFIFO = global i32 0
@.str.1 = [42 x i8] c"[DEBUG] Writing '%s' (size: %lu) to '%s'\0A\00"
@O_RDWR = global i32 0
@.str.2 = [29 x i8] c"[DEBUG] Written %d elements\0A\00"
define void @sendTextToClient(i8* %0, i8* %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @strlen(i8* %1)
%6 = add nsw i32 %5, 1
%7 = zext i32 %6 to i64
%8 = tail call i8* @llvm.stacksave()
%9 = alloca i8, i64 %7
%10 = call i32 @strcpy(i8* %9, i8* %1)
%11 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @strlen(i8* %0)
%13 = add i32 %11, 1
%14 = add i32 %13, %12
%15 = call i64 @malloc(i32 %14)
%16 = call i8* @concat(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%17 = call i32 @strcpy(i8* %4, i8* %16)
%18 = load i32, i32* @S_IFIFO
%19 = or i32 %18, 438
%20 = call i32 @mknod(i8* %4, i32 %19, i32 0)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %9, i64 %7, i8* %4)
%22 = load i32, i32* @O_RDWR
%23 = call i32 @open(i8* %4, i32 %22)
%24 = call i32 @write(i32 %23, i8* %9, i32 %6)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %24)
ret void
}