#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*/ dumpShort(unsigned short);
void dumpClassInterfaces(const unsigned short *interfaces) {
  if (interfaces) {
    unsigned short size = *interfaces++;
    dumpShort(size);
    while (size) {
      dumpShort(*interfaces++);
      size--;
    }
  } else {
    dumpShort(0);
  }
}


x86 assembly (clang, -O0):
<dumpClassInterfaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     117e <dumpClassInterfaces+0x6e>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x2,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%ax
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%edi
call   1030 <dumpShort@plt>
cmpw   $0x0,-0xa(%rbp)
je     1179 <dumpClassInterfaces+0x69>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x2,%rcx
mov    %rcx,-0x8(%rbp)
movzwl (%rax),%edi
call   1030 <dumpShort@plt>
mov    -0xa(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0xa(%rbp)
jmp    1146 <dumpClassInterfaces+0x36>
jmp    1185 <dumpClassInterfaces+0x75>
xor    %edi,%edi
call   1030 <dumpShort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpClassInterfaces>:
test   %rdi,%rdi
je     114b <dumpClassInterfaces+0x3b>
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
movzwl (%rdi),%r15d
mov    %r15d,%edi
call   1030 <dumpShort@plt>
test   %r15d,%r15d
je     1145 <dumpClassInterfaces+0x35>
xor    %ebx,%ebx
movzwl 0x2(%r14,%rbx,2),%edi
call   1030 <dumpShort@plt>
add    $0x1,%rbx
cmp    %bx,%r15w
jne    1130 <dumpClassInterfaces+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %edi,%edi
jmp    1030 <dumpShort@plt>

LLVM IR (-O0):
define void @dumpClassInterfaces(i16* %0) {
%2 = alloca i16*
%3 = alloca i16
store i16* %0, i16** %2
%4 = load i16*, i16** %2
%5 = icmp ne i16* %4, null
br i1 %5, label %6, label %23
6: ; preds = %1
%7 = load i16*, i16** %2
%8 = getelementptr inbounds i16, i16* %7, i32 1
store i16* %8, i16** %2
%9 = load i16, i16* %7
store i16 %9, i16* %3
%10 = load i16, i16* %3
%11 = call i32 @dumpShort(i16 zeroext %10)
br label %12
12: ; preds = %15, %6
%13 = load i16, i16* %3
%14 = icmp ne i16 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i16*, i16** %2
%17 = getelementptr inbounds i16, i16* %16, i32 1
store i16* %17, i16** %2
%18 = load i16, i16* %16
%19 = call i32 @dumpShort(i16 zeroext %18)
%20 = load i16, i16* %3
%21 = add i16 %20, -1
store i16 %21, i16* %3
br label %12
22: ; preds = %12
br label %25
23: ; preds = %1
%24 = call i32 @dumpShort(i16 zeroext 0)
br label %25
25: ; preds = %23, %22
ret void
}

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