#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 startAddress;

/* Variables and functions */
int /*<<< orphan*/ SendChar(int);
int /*<<< orphan*/ SendNU8(unsigned char *, unsigned short);
void WriteUserFlash(unsigned long startAddress, unsigned short int length,
                    unsigned char *_data) {
  SendChar((0XEE) & 0xFF);
  SendChar((0x87) & 0xFF);
  SendChar((((startAddress) >> 16) >> 8) & 0xFF);
  SendChar(((startAddress) >> 16) & 0xFF);
  SendChar((((startAddress)&0xFFFF) >> 8) & 0xFF);
  SendChar(((startAddress)&0xFFFF) & 0xFF);
  SendNU8((unsigned char *)_data, length);
  SendChar((((0XFFFCFFFF) >> 16) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) >> 16) & 0xFF);
  SendChar((((0XFFFCFFFF) & 0xFFFF) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) & 0xFFFF) & 0xFF);
}


x86 assembly (clang, -O0):
<WriteUserFlash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0xee,%edi
call   1040 <SendChar@plt>
mov    $0x87,%edi
call   1040 <SendChar@plt>
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %eax,%edi
call   1040 <SendChar@plt>
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %eax,%edi
call   1040 <SendChar@plt>
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %eax,%edi
call   1040 <SendChar@plt>
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
and    $0xff,%rax
mov    %eax,%edi
call   1040 <SendChar@plt>
mov    -0x18(%rbp),%rdi
movzwl -0xa(%rbp),%esi
call   1030 <SendNU8@plt>
mov    $0xff,%edi
call   1040 <SendChar@plt>
mov    $0xfc,%edi
call   1040 <SendChar@plt>
mov    $0xff,%edi
call   1040 <SendChar@plt>
mov    $0xff,%edi
call   1040 <SendChar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteUserFlash>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0xee,%edi
call   1040 <SendChar@plt>
mov    $0x87,%edi
call   1040 <SendChar@plt>
mov    %ebx,%eax
shr    $0x18,%eax
mov    %eax,%edi
call   1040 <SendChar@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
call   1040 <SendChar@plt>
movzbl %bh,%edi
call   1040 <SendChar@plt>
movzbl %bl,%edi
call   1040 <SendChar@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <SendNU8@plt>
mov    $0xff,%edi
call   1040 <SendChar@plt>
mov    $0xfc,%edi
call   1040 <SendChar@plt>
mov    $0xff,%edi
call   1040 <SendChar@plt>
mov    $0xff,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <SendChar@plt>

LLVM IR (-O0):
define void @WriteUserFlash(i64 %0, i16 zeroext %1, i8* %2) {
%4 = alloca i64
%5 = alloca i16
%6 = alloca i8*
store i64 %0, i64* %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%7 = call i32 @SendChar(i32 238)
%8 = call i32 @SendChar(i32 135)
%9 = load i64, i64* %4
%10 = lshr i64 %9, 16
%11 = lshr i64 %10, 8
%12 = and i64 %11, 255
%13 = trunc i64 %12 to i32
%14 = call i32 @SendChar(i32 %13)
%15 = load i64, i64* %4
%16 = lshr i64 %15, 16
%17 = and i64 %16, 255
%18 = trunc i64 %17 to i32
%19 = call i32 @SendChar(i32 %18)
%20 = load i64, i64* %4
%21 = and i64 %20, 65535
%22 = lshr i64 %21, 8
%23 = and i64 %22, 255
%24 = trunc i64 %23 to i32
%25 = call i32 @SendChar(i32 %24)
%26 = load i64, i64* %4
%27 = and i64 %26, 65535
%28 = and i64 %27, 255
%29 = trunc i64 %28 to i32
%30 = call i32 @SendChar(i32 %29)
%31 = load i8*, i8** %6
%32 = load i16, i16* %5
%33 = call i32 @SendNU8(i8* %31, i16 zeroext %32)
%34 = call i32 @SendChar(i32 255)
%35 = call i32 @SendChar(i32 252)
%36 = call i32 @SendChar(i32 255)
%37 = call i32 @SendChar(i32 255)
ret void
}

LLVM IR (-O2):
define void @WriteUserFlash(i64 %0, i16 zeroext %1, i8* %2) {
%4 = tail call i32 @SendChar(i32 238)
%5 = tail call i32 @SendChar(i32 135)
%6 = trunc i64 %0 to i32
%7 = lshr i32 %6, 24
%8 = tail call i32 @SendChar(i32 %7)
%9 = lshr i32 %6, 16
%10 = and i32 %9, 255
%11 = tail call i32 @SendChar(i32 %10)
%12 = lshr i32 %6, 8
%13 = and i32 %12, 255
%14 = tail call i32 @SendChar(i32 %13)
%15 = and i32 %6, 255
%16 = tail call i32 @SendChar(i32 %15)
%17 = tail call i32 @SendNU8(i8* %2, i16 zeroext %1)
%18 = tail call i32 @SendChar(i32 255)
%19 = tail call i32 @SendChar(i32 252)
%20 = tail call i32 @SendChar(i32 255)
%21 = tail call i32 @SendChar(i32 255)
ret void
}