#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*/ mapif_sendall(unsigned char *, size_t);
int /*<<< orphan*/ memcpy(unsigned char *, char const *, size_t);
int mapif_guild_message(int guild_id, int account_id, const char *mes,
                        size_t len) {
  unsigned char buf[512];
  (*(unsigned short *)(((unsigned char *)(buf)) + (0))) = 0x3837;
  (*(unsigned short *)(((unsigned char *)(buf)) + (2))) =
      (unsigned short)(len + 12);
  (*(unsigned int *)(((unsigned char *)(buf)) + (4))) = guild_id;
  (*(unsigned int *)(((unsigned char *)(buf)) + (8))) = account_id;
  memcpy((((unsigned char *)(buf)) + (12)), mes, len);
  mapif_sendall(buf, len + 12);
  return 0;
}


x86 assembly (clang, -O0):
<mapif_guild_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movw   $0x3837,-0x220(%rbp)
37 38
mov    -0x18(%rbp),%rax
add    $0xc,%rax
mov    %ax,-0x21e(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x21c(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x218(%rbp)
lea    -0x220(%rbp),%rdi
add    $0xc,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
lea    -0x220(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0xc,%rsi
call   1030 <mapif_sendall@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapif_guild_message>:
push   %rbx
sub    $0x200,%rsp
movw   $0x3837,(%rsp)
lea    0xc(%rcx),%rbx
mov    %bx,0x2(%rsp)
mov    %edi,0x4(%rsp)
mov    %esi,0x8(%rsp)
lea    0xc(%rsp),%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1040 <memcpy@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <mapif_sendall@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @mapif_guild_message(i32 %0, i32 %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca [512 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = bitcast i8* %11 to i16*
store i16 14391, i16* %12
%13 = load i64, i64* %8
%14 = add i64 %13, 12
%15 = trunc i64 %14 to i16
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%17 = getelementptr inbounds i8, i8* %16, i64 2
%18 = bitcast i8* %17 to i16*
store i16 %15, i16* %18
%19 = load i32, i32* %5
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%21 = getelementptr inbounds i8, i8* %20, i64 4
%22 = bitcast i8* %21 to i32*
store i32 %19, i32* %22
%23 = load i32, i32* %6
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%25 = getelementptr inbounds i8, i8* %24, i64 8
%26 = bitcast i8* %25 to i32*
store i32 %23, i32* %26
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%28 = getelementptr inbounds i8, i8* %27, i64 12
%29 = load i8*, i8** %7
%30 = load i64, i64* %8
%31 = call i32 @memcpy(i8* %28, i8* %29, i64 %30)
%32 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%33 = load i64, i64* %8
%34 = add i64 %33, 12
%35 = call i32 @mapif_sendall(i8* %32, i64 %34)
ret i32 0
}

LLVM IR (-O2):
define i32 @mapif_guild_message(i32 %0, i32 %1, i8* %2, i64 %3) {
%5 = alloca [512 x i8]
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%7 = bitcast [512 x i8]* %5 to i16*
store i16 14391, i16* %7
%8 = add i64 %3, 12
%9 = trunc i64 %8 to i16
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 2
%11 = bitcast i8* %10 to i16*
store i16 %9, i16* %11
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 4
%13 = bitcast i8* %12 to i32*
store i32 %0, i32* %13
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 8
%15 = bitcast i8* %14 to i32*
store i32 %1, i32* %15
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 12
%17 = call i32 @memcpy(i8* %16, i8* %2, i64 %3)
%18 = call i32 @mapif_sendall(i8* %6, i64 %8)
ret i32 0
}