const char *wsnode_flagstr(int flags) {
  static char retbuf[6];
  char *p = retbuf;
  if (flags & 0x02)
    *p++ = 'w';
  else if (flags & 0x01)
    *p++ = 'n';
  else
    *p++ = '-';
  if (flags & 0x04)
    *p++ = 'q';
  else
    *p++ = '-';
  if (flags & 0x08)
    *p++ = 'E';
  else
    *p++ = '-';
  if (flags & 0x10)
    *p++ = 'j';
  else
    *p++ = '-';
  if (flags & 0x20)
    *p++ = 's';
  else
    *p++ = '-';
  *p = 0;
  return retbuf;
}


x86 assembly (clang, -O0):
<wsnode_flagstr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0x2f13(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1138 <wsnode_flagstr+0x38>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x77,(%rax)
jmp    1175 <wsnode_flagstr+0x75>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     115e <wsnode_flagstr+0x5e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x6e,(%rax)
jmp    1170 <wsnode_flagstr+0x70>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2d,(%rax)
jmp    1175 <wsnode_flagstr+0x75>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     119b <wsnode_flagstr+0x9b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x71,(%rax)
jmp    11ad <wsnode_flagstr+0xad>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2d,(%rax)
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11d3 <wsnode_flagstr+0xd3>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x45,(%rax)
jmp    11e5 <wsnode_flagstr+0xe5>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2d,(%rax)
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     120b <wsnode_flagstr+0x10b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x6a,(%rax)
jmp    121d <wsnode_flagstr+0x11d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2d,(%rax)
mov    -0x4(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1243 <wsnode_flagstr+0x143>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x73,(%rax)
jmp    1255 <wsnode_flagstr+0x155>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2d,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2dbe(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wsnode_flagstr>:
test   $0x1,%dil
mov    $0x2d,%ecx
mov    $0x6e,%eax
cmove  %ecx,%eax
test   $0x2,%dil
mov    $0x77,%edx
cmove  %eax,%edx
mov    %dl,0x2efe(%rip)
test   $0x4,%dil
mov    $0x71,%eax
cmove  %ecx,%eax
mov    %al,0x2eed(%rip)
test   $0x8,%dil
mov    $0x45,%eax
cmove  %ecx,%eax
mov    %al,0x2edc(%rip)
test   $0x10,%dil
mov    $0x6a,%edx
cmove  %ecx,%edx
lea    0x2ec7(%rip),%rax
mov    %dl,0x2ec4(%rip)
test   $0x20,%dil
mov    $0x73,%edx
cmove  %ecx,%edx
mov    %dl,0x2eb3(%rip)
movb   $0x0,0x2ead(%rip)
ret

LLVM IR (-O0):
@wsnode_flagstr.retbuf = internal global [6 x i8] zeroinitializer
define i8* @wsnode_flagstr(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @wsnode_flagstr.retbuf, i64 0, i64 0), i8** %3
%4 = load i32, i32* %2
%5 = and i32 %4, 2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %3
store i8 119, i8* %8
br label %21
10: ; preds = %1
%11 = load i32, i32* %2
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
store i8 110, i8* %15
br label %20
17: ; preds = %10
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
store i8 45, i8* %18
br label %20
20: ; preds = %17, %14
br label %21
21: ; preds = %20, %7
%22 = load i32, i32* %2
%23 = and i32 %22, 4
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %3
store i8 113, i8* %26
br label %31
28: ; preds = %21
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
store i8 45, i8* %29
br label %31
31: ; preds = %28, %25
%32 = load i32, i32* %2
%33 = and i32 %32, 8
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i8*, i8** %3
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %3
store i8 69, i8* %36
br label %41
38: ; preds = %31
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %3
store i8 45, i8* %39
br label %41
41: ; preds = %38, %35
%42 = load i32, i32* %2
%43 = and i32 %42, 16
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = load i8*, i8** %3
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %3
store i8 106, i8* %46
br label %51
48: ; preds = %41
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %3
store i8 45, i8* %49
br label %51
51: ; preds = %48, %45
%52 = load i32, i32* %2
%53 = and i32 %52, 32
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = load i8*, i8** %3
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %3
store i8 115, i8* %56
br label %61
58: ; preds = %51
%59 = load i8*, i8** %3
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %3
store i8 45, i8* %59
br label %61
61: ; preds = %58, %55
%62 = load i8*, i8** %3
store i8 0, i8* %62
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @wsnode_flagstr.retbuf, i64 0, i64 0)
}

LLVM IR (-O2):
@wsnode_flagstr.retbuf = internal global [6 x i8] zeroinitializer
define i8* @wsnode_flagstr(i32 %0) {
%2 = and i32 %0, 2
%3 = icmp eq i32 %2, 0
%4 = and i32 %0, 1
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8 45, i8 110
%7 = select i1 %3, i8 %6, i8 119
store i8 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @wsnode_flagstr.retbuf, i64 0, i64 0)
%8 = and i32 %0, 4
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8 45, i8 113
store i8 %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @wsnode_flagstr.retbuf, i64 0, i64 1)
%11 = and i32 %0, 8
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i8 45, i8 69
store i8 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @wsnode_flagstr.retbuf, i64 0, i64 2)
%14 = and i32 %0, 16
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i8 45, i8 106
store i8 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @wsnode_flagstr.retbuf, i64 0, i64 3)
%17 = and i32 %0, 32
%18 = icmp eq i32 %17, 0
%19 = select i1 %18, i8 45, i8 115
store i8 %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @wsnode_flagstr.retbuf, i64 0, i64 4)
store i8 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @wsnode_flagstr.retbuf, i64 0, i64 5)
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @wsnode_flagstr.retbuf, i64 0, i64 0)
}