#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*/ debugPrintStr(char *, char *);
int /*<<< orphan*/ perror(char *);
int send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int sendData(int streamID, char *message) {
  if (send(streamID, message, strlen(message), 0) == -1) {
    debugPrintStr("msn : connection : sendData : Error sending message : ",
                  message);
    perror("send");
    return -1;
  } else {
    debugPrintStr("msn : connection : sent : ", message);
    return 0;
  }
}


x86 assembly (clang, -O0):
<sendData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
cmp    $0xffffffff,%eax
jne    11a7 <sendData+0x67>
mov    -0x10(%rbp),%rsi
lea    0xe76(%rip),%rdi
call   1030 <debugPrintStr@plt>
lea    0xea1(%rip),%rdi
call   1060 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11be <sendData+0x7e>
mov    -0x10(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1030 <debugPrintStr@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendData>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
xor    %r14d,%r14d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
cmp    $0xffffffff,%eax
je     117e <sendData+0x3e>
lea    0xece(%rip),%rdi
mov    %rbx,%rsi
call   1030 <debugPrintStr@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
call   1030 <debugPrintStr@plt>
lea    0xea3(%rip),%rdi
call   1060 <perror@plt>
mov    $0xffffffff,%r14d
jmp    1176 <sendData+0x36>

LLVM IR (-O0):
@.str = [55 x i8] c"msn : connection : sendData : Error sending message : \00"
@.str.1 = [5 x i8] c"send\00"
@.str.2 = [27 x i8] c"msn : connection : sent : \00"
define i32 @sendData(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = load i8*, i8** %5
%8 = load i8*, i8** %5
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @send(i32 %6, i8* %7, i32 %9, i32 0)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i32 @debugPrintStr(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %19
16: ; preds = %2
%17 = load i8*, i8** %5
%18 = call i32 @debugPrintStr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %17)
store i32 0, i32* %3
br label %19
19: ; preds = %16, %12
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [55 x i8] c"msn : connection : sendData : Error sending message : \00"
@.str.1 = [5 x i8] c"send\00"
@.str.2 = [27 x i8] c"msn : connection : sent : \00"
define i32 @sendData(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @send(i32 %0, i8* %1, i32 %3, i32 0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @debugPrintStr(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %1)
%8 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %11
9: ; preds = %2
%10 = tail call i32 @debugPrintStr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ -1, %6 ], [ 0, %9 ]
ret i32 %12
}