void lst(fname) char *fname;
{
  char sname[7];
  char *sattr;
  int pnumb;
  char *lsstring();
  printf("\n\nLocal Symbols:\n\n");
  ch_input(fname, 022);
  while (morebytes()) {
    dc_symbol(sname);
    sattr = lsstring(getbyte());
    pnumb = getbyte();
    printf("%s  %06o  section: %03o  %s\n", sname, getword(), pnumb, sattr);
  }
}


x86 assembly (clang, -O0):
<lst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x12,%esi
mov    $0x0,%al
call   1050 <ch_input@plt>
mov    $0x0,%al
call   1080 <morebytes@plt>
cmp    $0x0,%eax
je     1202 <lst+0x92>
lea    -0xf(%rbp),%rdi
mov    $0x0,%al
call   1030 <dc_symbol@plt>
mov    $0x0,%al
call   1040 <getbyte@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1090 <lsstring@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getbyte@plt>
mov    %eax,-0x1c(%rbp)
lea    -0xf(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1070 <getword@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    119a <lst+0x2a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lst>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xe8c(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
xor    %eax,%eax
call   1060 <ch_input@plt>
xor    %eax,%eax
call   1090 <morebytes@plt>
test   %eax,%eax
je     120c <lst+0x8c>
lea    0x1(%rsp),%r15
lea    0xe44(%rip),%r14
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <dc_symbol@plt>
xor    %eax,%eax
call   1040 <getbyte@plt>
mov    %eax,%edi
xor    %eax,%eax
call   10a0 <lsstring@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <getbyte@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1080 <getword@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
mov    %ebp,%ecx
mov    %rbx,%r8
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1090 <morebytes@plt>
test   %eax,%eax
jne    11c0 <lst+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0A\0ALocal Symbols:\0A\0A\00"
@.str.1 = [29 x i8] c"%s %06o section: %03o %s\0A\00"
define void @lst(i8* %0) {
%2 = alloca i8*
%3 = alloca [7 x i8]
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %2
%8 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @ch_input to i32 (i8*, i32, ...)*)(i8* %7, i32 18)
br label %9
9: ; preds = %12, %1
%10 = call i32 (...) @morebytes()
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %23
12: ; preds = %9
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @dc_symbol to i32 (i8*, ...)*)(i8* %13)
%15 = call i32 (...) @getbyte()
%16 = call i8* (i32, ...) bitcast (i8* (...)* @lsstring to i8* (i32, ...)*)(i32 %15)
store i8* %16, i8** %4
%17 = call i32 (...) @getbyte()
store i32 %17, i32* %5
%18 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%19 = call i32 (...) @getword()
%20 = load i32, i32* %5
%21 = load i8*, i8** %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %18, i32 %19, i32 %20, i8* %21)
br label %9
23: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str.1 = [29 x i8] c"%s %06o section: %03o %s\0A\00"
@str = [18 x i8] c"\0A\0ALocal Symbols:\0A\00"
define void @lst(i8* %0) {
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @ch_input to i32 (i8*, i32, ...)*)(i8* %0, i32 18)
%6 = call i32 (...) @morebytes()
%7 = icmp eq i32 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %1, %8
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @dc_symbol to i32 (i8*, ...)*)(i8* %3)
%10 = call i32 (...) @getbyte()
%11 = call i8* (i32, ...) bitcast (i8* (...)* @lsstring to i8* (i32, ...)*)(i32 %10)
%12 = call i32 (...) @getbyte()
%13 = call i32 (...) @getword()
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 %13, i32 %12, i8* %11)
%15 = call i32 (...) @morebytes()
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %8
17: ; preds = %8, %1
ret void
}