#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 *, void const *, int);
int mapif_guild_basicinfochanged(int guild_id, int type, const void *data,
                                 int len) {
  unsigned char buf[2048];
  (*(unsigned short *)(((unsigned char *)(buf)) + (0))) = 0x3839;
  (*(unsigned short *)(((unsigned char *)(buf)) + (2))) = len + 10;
  (*(unsigned int *)(((unsigned char *)(buf)) + (4))) = guild_id;
  (*(unsigned short *)(((unsigned char *)(buf)) + (8))) = type;
  memcpy((((unsigned char *)(buf)) + (10)), data, len);
  mapif_sendall(buf, len + 10);
  return 0;
}


x86 assembly (clang, -O0):
<mapif_guild_basicinfochanged>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movw   $0x3839,-0x820(%rbp)
39 38
mov    -0x14(%rbp),%eax
add    $0xa,%eax
mov    %ax,-0x81e(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x81c(%rbp)
mov    -0x8(%rbp),%eax
mov    %ax,-0x818(%rbp)
lea    -0x820(%rbp),%rdi
add    $0xa,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
lea    -0x820(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0xa,%esi
call   1030 <mapif_sendall@plt>
xor    %eax,%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapif_guild_basicinfochanged>:
push   %rbx
sub    $0x800,%rsp
movw   $0x3839,(%rsp)
lea    0xa(%rcx),%ebx
mov    %bx,0x2(%rsp)
mov    %edi,0x4(%rsp)
mov    %si,0x8(%rsp)
lea    0xa(%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    $0x800,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @mapif_guild_basicinfochanged(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [2048 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 [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = bitcast i8* %11 to i16*
store i16 14393, i16* %12
%13 = load i32, i32* %8
%14 = add nsw i32 %13, 10
%15 = trunc i32 %14 to i16
%16 = getelementptr inbounds [2048 x i8], [2048 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 [2048 x i8], [2048 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 = trunc i32 %23 to i16
%25 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%26 = getelementptr inbounds i8, i8* %25, i64 8
%27 = bitcast i8* %26 to i16*
store i16 %24, i16* %27
%28 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%29 = getelementptr inbounds i8, i8* %28, i64 10
%30 = load i8*, i8** %7
%31 = load i32, i32* %8
%32 = call i32 @memcpy(i8* %29, i8* %30, i32 %31)
%33 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 10
%36 = call i32 @mapif_sendall(i8* %33, i32 %35)
ret i32 0
}

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