char *pstring(attr)
int attr;
{
  static char string[80];
  if (attr & 001)
    strcpy(string, "shr ");
  else
    strcpy(string, "prv ");
  if (attr & 002)
    strcat(string, "ins ");
  else if (attr & 004)
    strcat(string, "bss ");
  else
    strcat(string, "dat ");
  if (attr & 020)
    strcat(string, "ovr ");
  else
    strcat(string, "cat ");
  if (attr & 040)
    strcat(string, "rel ");
  else
    strcat(string, "abs ");
  if (attr & 0100)
    strcat(string, "gbl");
  else
    strcat(string, "loc");
  return (string);
}


x86 assembly (clang, -O0):
<pstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1152 <pstring+0x32>
lea    0x2eff(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1165 <pstring+0x45>
lea    0x2ee7(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     118c <pstring+0x6c>
lea    0x2ec5(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1040 <strcat@plt>
jmp    11cb <pstring+0xab>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11b3 <pstring+0x93>
lea    0x2e9e(%rip),%rdi
lea    0xe66(%rip),%rsi
call   1040 <strcat@plt>
jmp    11c6 <pstring+0xa6>
lea    0x2e86(%rip),%rdi
lea    0xe53(%rip),%rsi
call   1040 <strcat@plt>
jmp    11cb <pstring+0xab>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11f2 <pstring+0xd2>
lea    0x2e5f(%rip),%rdi
lea    0xe31(%rip),%rsi
call   1040 <strcat@plt>
jmp    1205 <pstring+0xe5>
lea    0x2e47(%rip),%rdi
lea    0xe1e(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     122c <pstring+0x10c>
lea    0x2e25(%rip),%rdi
lea    0xe01(%rip),%rsi
call   1040 <strcat@plt>
jmp    123f <pstring+0x11f>
lea    0x2e0d(%rip),%rdi
lea    0xdee(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1266 <pstring+0x146>
lea    0x2deb(%rip),%rdi
lea    0xdd1(%rip),%rsi
call   1040 <strcat@plt>
jmp    1279 <pstring+0x159>
lea    0x2dd3(%rip),%rdi
lea    0xdbd(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2dc0(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pstring>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
test   $0x1,%bl
jne    112e <pstring+0x1e>
movb   $0x0,0x2f22(%rip)
movl   $0x20767270,0x2f14(%rip)
72 76 20
jmp    113f <pstring+0x2f>
movb   $0x0,0x2f0f(%rip)
movl   $0x20726873,0x2f01(%rip)
68 72 20
lea    0x2efa(%rip),%r14
mov    %r14,%rdi
test   $0x2,%bl
jne    1167 <pstring+0x57>
call   1030 <strlen@plt>
add    %r14,%rax
test   $0x4,%bl
jne    117c <pstring+0x6c>
movb   $0x0,0x4(%rax)
movl   $0x20746164,(%rax)
jmp    1186 <pstring+0x76>
call   1030 <strlen@plt>
movl   $0x20736e69,(%rax,%r14,1)
20
movb   $0x0,0x4(%rax,%r14,1)
jmp    1186 <pstring+0x76>
movb   $0x0,0x4(%rax)
movl   $0x20737362,(%rax)
lea    0x2eb3(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %r14,%rax
test   $0x10,%bl
jne    11a9 <pstring+0x99>
movb   $0x0,0x4(%rax)
movl   $0x20746163,(%rax)
jmp    11b3 <pstring+0xa3>
movb   $0x0,0x4(%rax)
movl   $0x2072766f,(%rax)
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %r14,%rax
test   $0x20,%bl
jne    11cf <pstring+0xbf>
movb   $0x0,0x4(%rax)
movl   $0x20736261,(%rax)
jmp    11d9 <pstring+0xc9>
movb   $0x0,0x4(%rax)
movl   $0x206c6572,(%rax)
mov    %r14,%rdi
call   1030 <strlen@plt>
test   $0x40,%bl
mov    $0x636f6c,%ecx
mov    $0x6c6267,%edx
cmove  %ecx,%edx
mov    %edx,(%rax,%r14,1)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@pstring.string = internal global [80 x i8] zeroinitializer
@.str = [5 x i8] c"shr \00"
@.str.1 = [5 x i8] c"prv \00"
@.str.2 = [5 x i8] c"ins \00"
@.str.3 = [5 x i8] c"bss \00"
@.str.4 = [5 x i8] c"dat \00"
@.str.5 = [5 x i8] c"ovr \00"
@.str.6 = [5 x i8] c"cat \00"
@.str.7 = [5 x i8] c"rel \00"
@.str.8 = [5 x i8] c"abs \00"
@.str.9 = [4 x i8] c"gbl\00"
@.str.10 = [4 x i8] c"loc\00"
define i8* @pstring(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i8* @strcpy(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %1
%9 = call i8* @strcpy(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* %2
%12 = and i32 %11, 2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i8* @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %25
16: ; preds = %10
%17 = load i32, i32* %2
%18 = and i32 %17, 4
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i8* @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %24
22: ; preds = %16
%23 = call i8* @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
br label %25
25: ; preds = %24, %14
%26 = load i32, i32* %2
%27 = and i32 %26, 16
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i8* @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %33
31: ; preds = %25
%32 = call i8* @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
%34 = load i32, i32* %2
%35 = and i32 %34, 32
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i8* @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %41
39: ; preds = %33
%40 = call i8* @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %41
41: ; preds = %39, %37
%42 = load i32, i32* %2
%43 = and i32 %42, 64
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i8* @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %49
47: ; preds = %41
%48 = call i8* @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
br label %49
49: ; preds = %47, %45
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0)
}

LLVM IR (-O2):
@pstring.string = internal global [80 x i8] zeroinitializer
@.str = [5 x i8] c"shr \00"
@.str.1 = [5 x i8] c"prv \00"
@.str.2 = [5 x i8] c"ins \00"
@.str.3 = [5 x i8] c"bss \00"
@.str.4 = [5 x i8] c"dat \00"
@.str.5 = [5 x i8] c"ovr \00"
@.str.6 = [5 x i8] c"cat \00"
@.str.7 = [5 x i8] c"rel \00"
@.str.8 = [5 x i8] c"abs \00"
define i8* @pstring(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(5) getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 5, i1 false)
br label %6
5: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(5) getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0), i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 5, i1 false)
br label %6
6: ; preds = %5, %4
%7 = and i32 %0, 2
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i64 @strlen(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0))
%11 = getelementptr [80 x i8], [80 x i8]* @pstring.string, i64 0, i64 %10
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %11, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 5, i1 false)
br label %19
12: ; preds = %6
%13 = and i32 %0, 4
%14 = icmp eq i32 %13, 0
%15 = tail call i64 @strlen(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0))
%16 = getelementptr [80 x i8], [80 x i8]* @pstring.string, i64 0, i64 %15
br i1 %14, label %18, label %17
17: ; preds = %12
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %16, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 5, i1 false)
br label %19
18: ; preds = %12
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %16, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 5, i1 false)
br label %19
19: ; preds = %17, %18, %9
%20 = and i32 %0, 16
%21 = icmp eq i32 %20, 0
%22 = tail call i64 @strlen(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0))
%23 = getelementptr [80 x i8], [80 x i8]* @pstring.string, i64 0, i64 %22
br i1 %21, label %25, label %24
24: ; preds = %19
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %23, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 5, i1 false)
br label %26
25: ; preds = %19
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %23, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 5, i1 false)
br label %26
26: ; preds = %25, %24
%27 = and i32 %0, 32
%28 = icmp eq i32 %27, 0
%29 = tail call i64 @strlen(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0))
%30 = getelementptr [80 x i8], [80 x i8]* @pstring.string, i64 0, i64 %29
br i1 %28, label %32, label %31
31: ; preds = %26
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %30, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i64 5, i1 false)
br label %33
32: ; preds = %26
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %30, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i64 5, i1 false)
br label %33
33: ; preds = %32, %31
%34 = and i32 %0, 64
%35 = icmp eq i32 %34, 0
%36 = tail call i64 @strlen(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0))
%37 = getelementptr [80 x i8], [80 x i8]* @pstring.string, i64 0, i64 %36
%38 = bitcast i8* %37 to i32*
%39 = select i1 %35, i32 6516588, i32 7103079
store i32 %39, i32* %38
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @pstring.string, i64 0, i64 0)
}