#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*/ validate_packet;
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int sock_write(int, unsigned char const *, int);
int /*<<< orphan*/ stderr;
ssize_t validate_murmur_connection(int murm_acceptfd) {
  ssize_t n;
  const unsigned char validate_packet[] = {0x49, 0x63, 0x65, 0x50, 0x01,
                                           0x00, 0x01, 0x00, 0x03, 0x00,
                                           0x0e, 0x00, 0x00, 0x00};
  n = sock_write(murm_acceptfd, validate_packet, sizeof(validate_packet));
  if (n != sizeof(validate_packet))
    fprintf(stderr, "Error: Failed to send validate_packet\n");
  return n;
}


x86 assembly (clang, -O0):
<validate_murmur_connection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x16(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0xe(%rbp)
mov    0xec6(%rip),%ax
mov    %ax,-0xa(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x16(%rbp),%rsi
mov    $0xe,%edx
call   1040 <sock_write@plt>
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0xe,%rax
je     1181 <validate_murmur_connection+0x61>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_murmur_connection>:
push   %rbx
sub    $0x10,%rsp
movabs $0xe00030001,%rax
mov    %rax,0x6(%rsp)
movabs $0x1000150656349,%rax
mov    %rax,(%rsp)
mov    %rsp,%rsi
mov    $0xe,%edx
call   1040 <sock_write@plt>
mov    %eax,%ebx
cmp    $0xe,%eax
je     116b <validate_murmur_connection+0x4b>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.validate_murmur_connection.validate_packet = [14 x i8] c"IceP\01\00\01\00\03\00\0E\00\00\00"
@stderr = global i32 0
@.str = [39 x i8] c"Error: Failed to send validate_packet\0A\00"
define i32 @validate_murmur_connection(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [14 x i8]
store i32 %0, i32* %2
%5 = bitcast [14 x i8]* %4 to i8*
%6 = load i32, i32* %2
%7 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%8 = call i32 @sock_write(i32 %6, i8* %7, i32 14)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = icmp ne i64 %10, 14
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %12, %1
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@__const.validate_murmur_connection.validate_packet = [14 x i8] c"IceP\01\00\01\00\03\00\0E\00\00\00"
@stderr = global i32 0
@.str = [39 x i8] c"Error: Failed to send validate_packet\0A\00"
define i32 @validate_murmur_connection(i32 %0) {
%2 = alloca [14 x i8]
%3 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%4 = call i32 @sock_write(i32 %0, i8* %3, i32 14)
%5 = icmp eq i32 %4, 14
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %1
ret i32 %4
}