#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*/ printf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
int write(int, char *, int /*<<< orphan*/);
int client_send(int socket, char *message) {
  char buff[512] = {'\0'};
  strcpy(buff, message);
  strcat(buff, "\r\n");
  printf("%s", buff);
  return write(socket, buff, strlen(buff));
}


x86 assembly (clang, -O0):
<client_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1070 <memset@plt>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x210(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1080 <strcat@plt>
lea    -0x210(%rbp),%rsi
lea    0xe4d(%rip),%rdi
call   1060 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x21c(%rbp)
lea    -0x210(%rbp),%rax
mov    %rax,-0x218(%rbp)
lea    -0x210(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x21c(%rbp),%edi
mov    -0x218(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client_send>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%rbp
mov    %edi,%r14d
mov    %rsp,%rbx
mov    $0x200,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
lea    0xe5f(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0D\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @client_send(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [512 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = bitcast [512 x i8]* %5 to i8*
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %4
%9 = call i32 @strcpy(i8* %7, i8* %8)
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%11 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i32, i32* %3
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = call i32 @write(i32 %14, i8* %15, i32 %17)
ret i32 %18
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @client_send(i32 %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* %1)
%6 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%8 = call i32 @strlen(i8* %4)
%9 = call i32 @write(i32 %0, i8* %4, i32 %8)
ret i32 %9
}