#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 *, int);
int /*<<< orphan*/ memcpy(unsigned char *, char *, int);
int mapif_party_message(int party_id, int account_id, char *mes, int len) {
  unsigned char buf[512];
  (*(unsigned short *)(((unsigned char *)((buf))) + ((0)))) = 0x3827;
  (*(unsigned short *)(((unsigned char *)((buf))) + ((2)))) = len + 12;
  (*(unsigned int *)(((unsigned char *)((buf))) + ((4)))) = party_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_party_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movw   $0x3827,-0x220(%rbp)
27 38
mov    -0x14(%rbp),%eax
add    $0xc,%eax
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    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
lea    -0x220(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0xc,%esi
call   1030 <mapif_sendall@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @mapif_party_message(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [512 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %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 14375, i16* %12
%13 = load i32, i32* %8
%14 = add nsw i32 %13, 12
%15 = trunc i32 %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 i32, i32* %8
%31 = call i32 @memcpy(i8* %28, i8* %29, i32 %30)
%32 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 12
%35 = call i32 @mapif_sendall(i8* %32, i32 %34)
ret i32 0
}

LLVM IR (-O2):
define i32 @mapif_party_message(i32 %0, i32 %1, i8* %2, i32 %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 14375, i16* %7
%8 = add nsw i32 %3, 12
%9 = trunc i32 %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, i32 %3)
%18 = call i32 @mapif_sendall(i8* %6, i32 %8)
ret i32 0
}