#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*/ printf(char *, ...);
void dispWords(unsigned short *pW, int count) {
  while (count) {
    printf("%x ", *pW);
    pW++;
    count--;
    if (!(count % 8))
      printf("\n");
  }
}


x86 assembly (clang, -O0):
<dispWords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     117a <dispWords+0x6a>
mov    -0x8(%rbp),%rax
movzwl (%rax),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1175 <dispWords+0x65>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    111f <dispWords+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dispWords>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     1168 <dispWords+0x48>
mov    %esi,%ebx
mov    %rdi,%r14
add    $0xffffffff,%ebx
lea    0xec8(%rip),%r15
jmp    1149 <dispWords+0x29>
nopw   0x0(%rax,%rax,1)
add    $0x2,%r14
add    $0xffffffff,%ebx
jae    1168 <dispWords+0x48>
movzwl (%r14),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x7,%bl
jne    1140 <dispWords+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1140 <dispWords+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%x \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @dispWords(i16* %0, i32 %1) {
%3 = alloca i16*
%4 = alloca i32
store i16* %0, i16** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %22, %2
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %5
%9 = load i16*, i16** %3
%10 = load i16, i16* %9
%11 = zext i16 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i16*, i16** %3
%14 = getelementptr inbounds i16, i16* %13, i32 1
store i16* %14, i16** %3
%15 = load i32, i32* %4
%16 = add nsw i32 %15, -1
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = srem i32 %17, 8
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %8
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %8
br label %5
23: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%x \00"
define void @dispWords(i16* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %18, label %4
4: ; preds = %2, %16
%5 = phi i32 [ %11, %16 ], [ %1, %2 ]
%6 = phi i16* [ %10, %16 ], [ %0, %2 ]
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds i16, i16* %6, i64 1
%11 = add nsw i32 %5, -1
%12 = and i32 %11, 7
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %4
%15 = tail call i32 @putchar(i32 10)
br label %16
16: ; preds = %14, %4
%17 = icmp eq i32 %11, 0
br i1 %17, label %18, label %4
18: ; preds = %16, %2
ret void
}