#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 /*<<< orphan*/ pData;

/* Variables and functions */
int /*<<< orphan*/ SendChar(unsigned short);
void SendNU16(unsigned short int *pData, unsigned short int nDataLen) {
  unsigned short int i = 0;
  for (; i < nDataLen; ++i) {
    SendChar(((pData[i]) >> 8) & 0xFF);
    SendChar((pData[i]) & 0xFF);
  }
}


x86 assembly (clang, -O0):
<SendNU16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movw   $0x0,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
movzwl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jge    117f <SendNU16+0x6f>
mov    -0x8(%rbp),%rax
movzwl -0xc(%rbp),%ecx
movzwl (%rax,%rcx,2),%eax
sar    $0x8,%eax
and    $0xff,%eax
movzwl %ax,%edi
call   1030 <SendChar@plt>
mov    -0x8(%rbp),%rax
movzwl -0xc(%rbp),%ecx
movzwl (%rax,%rcx,2),%eax
and    $0xff,%eax
movzwl %ax,%edi
call   1030 <SendChar@plt>
mov    -0xc(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xc(%rbp)
jmp    1129 <SendNU16+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendNU16>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     114e <SendNU16+0x3e>
mov    %rdi,%r15
movzwl %si,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x1(%r15,%rbx,2),%edi
call   1030 <SendChar@plt>
movzbl (%r15,%rbx,2),%edi
call   1030 <SendChar@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <SendNU16+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @SendNU16(i16* %0, i16 zeroext %1) {
%3 = alloca i16*
%4 = alloca i16
%5 = alloca i16
store i16* %0, i16** %3
store i16 %1, i16* %4
store i16 0, i16* %5
br label %6
6: ; preds = %32, %2
%7 = load i16, i16* %5
%8 = zext i16 %7 to i32
%9 = load i16, i16* %4
%10 = zext i16 %9 to i32
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %35
12: ; preds = %6
%13 = load i16*, i16** %3
%14 = load i16, i16* %5
%15 = zext i16 %14 to i64
%16 = getelementptr inbounds i16, i16* %13, i64 %15
%17 = load i16, i16* %16
%18 = zext i16 %17 to i32
%19 = ashr i32 %18, 8
%20 = and i32 %19, 255
%21 = trunc i32 %20 to i16
%22 = call i32 @SendChar(i16 zeroext %21)
%23 = load i16*, i16** %3
%24 = load i16, i16* %5
%25 = zext i16 %24 to i64
%26 = getelementptr inbounds i16, i16* %23, i64 %25
%27 = load i16, i16* %26
%28 = zext i16 %27 to i32
%29 = and i32 %28, 255
%30 = trunc i32 %29 to i16
%31 = call i32 @SendChar(i16 zeroext %30)
br label %32
32: ; preds = %12
%33 = load i16, i16* %5
%34 = add i16 %33, 1
store i16 %34, i16* %5
br label %6
35: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @SendNU16(i16* nocapture %0, i16 zeroext %1) {
%3 = icmp eq i16 %1, 0
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = zext i16 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %15, %6 ]
%8 = getelementptr inbounds i16, i16* %0, i64 %7
%9 = load i16, i16* %8
%10 = lshr i16 %9, 8
%11 = tail call i32 @SendChar(i16 zeroext %10)
%12 = load i16, i16* %8
%13 = and i16 %12, 255
%14 = tail call i32 @SendChar(i16 zeroext %13)
%15 = add nuw nsw i64 %7, 1
%16 = icmp eq i64 %15, %5
br i1 %16, label %17, label %6
17: ; preds = %6, %2
ret void
}