#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*/ _con_out(char);
int /*<<< orphan*/ cprintf(char *, char *);
int /*<<< orphan*/ prtreg(short);
void putrlist(const short *ap, short mask) {
  register short i;
  register const short *p;
  register short lmsk;
  register short j;
  lmsk = mask;
  p = ap;
  j = -1;
  for (i = 0; i < 16; i++) {
    if (lmsk & *p++) {
      if (j == 0)
        _con_out((char)'/');
      if (j != 1) {
        prtreg(i);
        _con_out((char)'-');
      }
      j = 1;
    } else if (j == 1) {
      prtreg(i - 1);
      j = 0;
    }
  }
  if (j == 1)
    cprintf("%s", "A7");
}


x86 assembly (clang, -O0):
<putrlist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%ax
mov    %ax,-0x1a(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movw   $0xffff,-0x1c(%rbp)
movw   $0x0,-0xc(%rbp)
movswl -0xc(%rbp),%eax
cmp    $0x10,%eax
jge    120c <putrlist+0xdc>
movswl -0x1a(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x2,%rdx
mov    %rdx,-0x18(%rbp)
movswl (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11cf <putrlist+0x9f>
movswl -0x1c(%rbp),%eax
cmp    $0x0,%eax
jne    11a4 <putrlist+0x74>
mov    $0x2f,%edi
call   1030 <_con_out@plt>
movswl -0x1c(%rbp),%eax
cmp    $0x1,%eax
je     11c4 <putrlist+0x94>
movswl -0xc(%rbp),%edi
call   1050 <prtreg@plt>
mov    $0x2d,%edi
call   1030 <_con_out@plt>
movw   $0x1,-0x1c(%rbp)
jmp    11f6 <putrlist+0xc6>
movswl -0x1c(%rbp),%eax
cmp    $0x1,%eax
jne    11f1 <putrlist+0xc1>
movswl -0xc(%rbp),%eax
sub    $0x1,%eax
movswl %ax,%edi
call   1050 <prtreg@plt>
movw   $0x0,-0x1c(%rbp)
jmp    11f6 <putrlist+0xc6>
jmp    11fb <putrlist+0xcb>
mov    -0xc(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xc(%rbp)
jmp    115f <putrlist+0x2f>
movswl -0x1c(%rbp),%eax
cmp    $0x1,%eax
jne    122c <putrlist+0xfc>
lea    0xde0(%rip),%rdi
lea    0xddc(%rip),%rsi
call   1040 <cprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putrlist>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
mov    $0xffff,%ax
xor    %ebp,%ebp
jmp    116f <putrlist+0x3f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movswl %bp,%edi
call   1050 <prtreg@plt>
mov    $0x2d,%edi
call   1030 <_con_out@plt>
mov    $0x1,%ax
add    $0x1,%ebp
cmp    $0x10,%bp
je     11be <putrlist+0x8e>
mov    %rbx,%rcx
add    $0x2,%rbx
test   %r14w,(%rcx)
je     11a0 <putrlist+0x70>
cmp    $0x1,%ax
je     1166 <putrlist+0x36>
test   %ax,%ax
jne    1150 <putrlist+0x20>
mov    $0x2f,%edi
call   1030 <_con_out@plt>
jmp    1150 <putrlist+0x20>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x1,%ax
jne    1166 <putrlist+0x36>
lea    -0x1(%rbp),%eax
movswl %ax,%edi
call   1050 <prtreg@plt>
add    $0x1,%ebp
xor    %eax,%eax
cmp    $0x10,%bp
jne    116f <putrlist+0x3f>
jmp    11db <putrlist+0xab>
cmp    $0x1,%ax
jne    11db <putrlist+0xab>
lea    0xe35(%rip),%rdi
lea    0xe31(%rip),%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <cprintf@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"A7\00"
define void @putrlist(i16* %0, i16 signext %1) {
%3 = alloca i16*
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16*
%7 = alloca i16
%8 = alloca i16
store i16* %0, i16** %3
store i16 %1, i16* %4
%9 = load i16, i16* %4
store i16 %9, i16* %7
%10 = load i16*, i16** %3
store i16* %10, i16** %6
store i16 -1, i16* %8
store i16 0, i16* %5
br label %11
11: ; preds = %51, %2
%12 = load i16, i16* %5
%13 = sext i16 %12 to i32
%14 = icmp slt i32 %13, 16
br i1 %14, label %15, label %54
15: ; preds = %11
%16 = load i16, i16* %7
%17 = sext i16 %16 to i32
%18 = load i16*, i16** %6
%19 = getelementptr inbounds i16, i16* %18, i32 1
store i16* %19, i16** %6
%20 = load i16, i16* %18
%21 = sext i16 %20 to i32
%22 = and i32 %17, %21
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %39
24: ; preds = %15
%25 = load i16, i16* %8
%26 = sext i16 %25 to i32
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @_con_out(i8 signext 47)
br label %30
30: ; preds = %28, %24
%31 = load i16, i16* %8
%32 = sext i16 %31 to i32
%33 = icmp ne i32 %32, 1
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i16, i16* %5
%36 = call i32 @prtreg(i16 signext %35)
%37 = call i32 @_con_out(i8 signext 45)
br label %38
38: ; preds = %34, %30
store i16 1, i16* %8
br label %50
39: ; preds = %15
%40 = load i16, i16* %8
%41 = sext i16 %40 to i32
%42 = icmp eq i32 %41, 1
br i1 %42, label %43, label %49
43: ; preds = %39
%44 = load i16, i16* %5
%45 = sext i16 %44 to i32
%46 = sub nsw i32 %45, 1
%47 = trunc i32 %46 to i16
%48 = call i32 @prtreg(i16 signext %47)
store i16 0, i16* %8
br label %49
49: ; preds = %43, %39
br label %50
50: ; preds = %49, %38
br label %51
51: ; preds = %50
%52 = load i16, i16* %5
%53 = add i16 %52, 1
store i16 %53, i16* %5
br label %11
54: ; preds = %11
%55 = load i16, i16* %8
%56 = sext i16 %55 to i32
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = call i32 @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %60
60: ; preds = %58, %54
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"A7\00"
define void @putrlist(i16* nocapture %0, i16 signext %1) {
br label %3
3: ; preds = %23, %2
%4 = phi i16 [ -1, %2 ], [ %24, %23 ]
%5 = phi i16 [ 0, %2 ], [ %25, %23 ]
%6 = phi i16* [ %0, %2 ], [ %7, %23 ]
%7 = getelementptr inbounds i16, i16* %6, i64 1
%8 = load i16, i16* %6
%9 = and i16 %8, %1
%10 = icmp eq i16 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %3
switch i16 %4, label %14 [
i16 0, label %12
i16 1, label %19
]
12: ; preds = %11
%13 = tail call i32 @_con_out(i8 signext 47)
br label %14
14: ; preds = %12, %11
%15 = tail call i32 @prtreg(i16 signext %5)
%16 = tail call i32 @_con_out(i8 signext 45)
br label %19
17: ; preds = %3
%18 = icmp eq i16 %4, 1
br i1 %18, label %26, label %19
19: ; preds = %14, %11, %17
%20 = phi i16 [ %4, %17 ], [ %4, %11 ], [ 1, %14 ]
%21 = add nuw nsw i16 %5, 1
%22 = icmp eq i16 %21, 16
br i1 %22, label %31, label %23
23: ; preds = %19, %26
%24 = phi i16 [ %20, %19 ], [ 0, %26 ]
%25 = phi i16 [ %21, %19 ], [ %29, %26 ]
br label %3
26: ; preds = %17
%27 = add nsw i16 %5, -1
%28 = tail call i32 @prtreg(i16 signext %27)
%29 = add nuw nsw i16 %5, 1
%30 = icmp eq i16 %29, 16
br i1 %30, label %35, label %23
31: ; preds = %19
%32 = icmp eq i16 %20, 1
br i1 %32, label %33, label %35
33: ; preds = %31
%34 = tail call i32 @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %26, %33, %31
ret void
}