#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 voxowl_socket_t {
  int dummy;
};

/* Variables and functions */
int voxowl_send(struct voxowl_socket_t *, void *, int);
int voxowl_sendline(struct voxowl_socket_t *sock, const char *line,
                    size_t len) {
  if (voxowl_send(sock, (void *)line, len) != len)
    return -1;
  char *eot = "\n";
  if (voxowl_send(sock, (void *)eot, 1) != 1)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<voxowl_sendline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    %eax,%edx
call   1030 <voxowl_send@plt>
cltq
cmp    -0x20(%rbp),%rax
je     114f <voxowl_sendline+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1188 <voxowl_sendline+0x78>
lea    0xeaa(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x1,%edx
call   1030 <voxowl_send@plt>
cmp    $0x1,%eax
je     1181 <voxowl_sendline+0x71>
movl   $0xffffffff,-0x4(%rbp)
jmp    1188 <voxowl_sendline+0x78>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<voxowl_sendline>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
call   1030 <voxowl_send@plt>
movslq %eax,%rcx
mov    $0xffffffff,%eax
cmp    %rbx,%rcx
jne    114c <voxowl_sendline+0x3c>
lea    0xecd(%rip),%rsi
mov    %r14,%rdi
mov    $0x1,%edx
call   1030 <voxowl_send@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
setne  %al
neg    %eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.voxowl_socket_t = type { i32 }
@.str = [2 x i8] c"\0A\00"
define i32 @voxowl_sendline(%struct.voxowl_socket_t* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca %struct.voxowl_socket_t*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
store %struct.voxowl_socket_t* %0, %struct.voxowl_socket_t** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%9 = load %struct.voxowl_socket_t*, %struct.voxowl_socket_t** %5
%10 = load i8*, i8** %6
%11 = load i64, i64* %7
%12 = trunc i64 %11 to i32
%13 = call i32 @voxowl_send(%struct.voxowl_socket_t* %9, i8* %10, i32 %12)
%14 = sext i32 %13 to i64
%15 = load i64, i64* %7
%16 = icmp ne i64 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 -1, i32* %4
br label %25
18: ; preds = %3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %8
%19 = load %struct.voxowl_socket_t*, %struct.voxowl_socket_t** %5
%20 = load i8*, i8** %8
%21 = call i32 @voxowl_send(%struct.voxowl_socket_t* %19, i8* %20, i32 1)
%22 = icmp ne i32 %21, 1
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 -1, i32* %4
br label %25
24: ; preds = %18
store i32 0, i32* %4
br label %25
25: ; preds = %24, %23, %17
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
%struct.voxowl_socket_t = type { i32 }
@.str = [2 x i8] c"\0A\00"
define i32 @voxowl_sendline(%struct.voxowl_socket_t* %0, i8* %1, i64 %2) {
%4 = trunc i64 %2 to i32
%5 = tail call i32 @voxowl_send(%struct.voxowl_socket_t* %0, i8* %1, i32 %4)
%6 = sext i32 %5 to i64
%7 = icmp eq i64 %6, %2
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = tail call i32 @voxowl_send(%struct.voxowl_socket_t* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%10 = icmp ne i32 %9, 1
%11 = sext i1 %10 to i32
br label %12
12: ; preds = %3, %8
%13 = phi i32 [ %11, %8 ], [ -1, %3 ]
ret i32 %13
}