#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_sendallwos(int, unsigned char *, unsigned short);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, unsigned short);
int mapif_account_reg(int fd, unsigned char *src) {
  unsigned char buf[4096];
  memcpy((((unsigned char *)(buf)) + (0)), src,
         (*(unsigned short *)(((unsigned char *)((src))) + ((2)))));
  (*(unsigned short *)(((unsigned char *)((buf))) + ((0)))) = 0x3804;
  mapif_sendallwos(fd, buf,
                   (*(unsigned short *)(((unsigned char *)((buf))) + ((2)))));
  return 0;
}


x86 assembly (clang, -O0):
<mapif_account_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1010(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%ax
movzwl %ax,%edx
call   1040 <memcpy@plt>
movw   $0x3804,-0x1010(%rbp)
04 38
mov    -0x4(%rbp),%edi
lea    -0x1010(%rbp),%rsi
movzwl -0x100e(%rbp),%edx
call   1030 <mapif_sendallwos@plt>
xor    %eax,%eax
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapif_account_reg>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
mov    %edi,%ebx
movzwl 0x2(%rsi),%edx
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <memcpy@plt>
movw   $0x3804,(%rsp)
movzwl 0x2(%rsp),%edx
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <mapif_sendallwos@plt>
xor    %eax,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @mapif_account_reg(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [4096 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8*, i8** %4
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 2
%11 = bitcast i8* %10 to i16*
%12 = load i16, i16* %11
%13 = call i32 @memcpy(i8* %7, i8* %8, i16 zeroext %12)
%14 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = bitcast i8* %15 to i16*
store i16 14340, i16* %16
%17 = load i32, i32* %3
%18 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%19 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds i8, i8* %19, i64 2
%21 = bitcast i8* %20 to i16*
%22 = load i16, i16* %21
%23 = call i32 @mapif_sendallwos(i32 %17, i8* %18, i16 zeroext %22)
ret i32 0
}

LLVM IR (-O2):
define i32 @mapif_account_reg(i32 %0, i8* %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8, i8* %1, i64 2
%6 = bitcast i8* %5 to i16*
%7 = load i16, i16* %6
%8 = call i32 @memcpy(i8* %4, i8* %1, i16 zeroext %7)
%9 = bitcast [4096 x i8]* %3 to i16*
store i16 14340, i16* %9
%10 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 2
%11 = bitcast i8* %10 to i16*
%12 = load i16, i16* %11
%13 = call i32 @mapif_sendallwos(i32 %0, i8* %4, i16 zeroext %12)
ret i32 0
}