main(argc, argv) char *argv[];
{
  char line[200];
  extern int cin;
  extern char *cspace;
  cspace = getvec(2000 + 100);
  for (;;) {
    if (argc > 1) {
      argc--;
      argv++;
      if (match(*argv, "-ms"))
        *argv = "/usr/lib/tmac.s";
      cin = copen(*argv, 'r');
      if (cin < 0) {
        printf(2, "where is input file %s\n", *argv);
        cexit();
      }
    }
    while (gets(line))
      if (match(line, ".TS"))
        tableput();
      else
        puts(line);
    if (argc <= 1)
      break;
  }
  cexit();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x834,%edi
mov    $0x0,%al
call   10a0 <getvec@plt>
movslq %eax,%rcx
mov    0x2e31(%rip),%rax
mov    %rcx,(%rax)
cmpl   $0x1,-0x8(%rbp)
jle    1251 <main+0xd1>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1090 <match@plt>
cmp    $0x0,%eax
je     11fd <main+0x7d>
mov    -0x10(%rbp),%rax
lea    0xe0a(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x72,%esi
mov    $0x0,%al
call   1040 <copen@plt>
mov    %eax,%ecx
mov    0x2ddf(%rip),%rax
mov    %ecx,(%rax)
mov    0x2dd6(%rip),%rax
cmpl   $0x0,(%rax)
jge    124c <main+0xcc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    $0x2,%edi
lea    0xdd6(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <cexit@plt>
jmp    1251 <main+0xd1>
jmp    1256 <main+0xd6>
lea    -0xe0(%rbp),%rdi
mov    $0x0,%al
call   1070 <gets@plt>
cmp    $0x0,%eax
je     12aa <main+0x12a>
lea    -0xe0(%rbp),%rdi
lea    0xdb1(%rip),%rsi
mov    $0x0,%al
call   1090 <match@plt>
cmp    $0x0,%eax
je     1297 <main+0x117>
mov    $0x0,%al
call   1080 <tableput@plt>
jmp    12a5 <main+0x125>
lea    -0xe0(%rbp),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
jmp    1256 <main+0xd6>
cmpl   $0x1,-0x8(%rbp)
jg     12b9 <main+0x139>
jmp    12be <main+0x13e>
jmp    11b2 <main+0x32>
mov    $0x0,%al
call   1060 <cexit@plt>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,%r12
mov    %edi,%r13d
mov    $0x834,%edi
xor    %eax,%eax
call   10a0 <getvec@plt>
cltq
mov    0x2e34(%rip),%rcx
mov    %rax,(%rcx)
mov    0x2e42(%rip),%r15
lea    0xe47(%rip),%r14
mov    %rsp,%rbx
lea    0xe65(%rip),%rbp
jmp    11da <main+0x5a>
nopl   0x0(%rax)
cmp    $0x1,%r13d
jle    1276 <main+0xf6>
cmp    $0x2,%r13d
jl     1247 <main+0xc7>
mov    0x8(%r12),%rdi
add    $0x8,%r12
lea    0xe10(%rip),%rsi
xor    %eax,%eax
call   1090 <match@plt>
test   %eax,%eax
je     1204 <main+0x84>
mov    %r14,(%r12)
mov    %r14,%rdi
jmp    1208 <main+0x88>
mov    (%r12),%rdi
add    $0xffffffff,%r13d
mov    $0x72,%esi
xor    %eax,%eax
call   1040 <copen@plt>
mov    %eax,(%r15)
test   %eax,%eax
jns    1247 <main+0xc7>
mov    (%r12),%rdx
mov    $0x2,%edi
lea    0xde5(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <cexit@plt>
jmp    1247 <main+0xc7>
nop
xor    %eax,%eax
call   1080 <tableput@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <gets@plt>
test   %eax,%eax
je     11d0 <main+0x50>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <match@plt>
test   %eax,%eax
jne    1240 <main+0xc0>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <puts@plt>
jmp    1247 <main+0xc7>
xor    %eax,%eax
call   1060 <cexit@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@cspace = external global i8*
@.str = [4 x i8] c"-ms\00"
@.str.1 = [16 x i8] c"/usr/lib/tmac.s\00"
@cin = external global i32
@.str.2 = [24 x i8] c"where is input file %s\0A\00"
@.str.3 = [4 x i8] c".TS\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [200 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i32, ...) bitcast (i32 (...)* @getvec to i32 (i32, ...)*)(i32 2100)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** @cspace
br label %10
10: ; preds = %55, %2
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %36
13: ; preds = %10
%14 = load i32, i32* %4
%15 = add nsw i32 %14, -1
store i32 %15, i32* %4
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i32 1
store i8** %17, i8*** %5
%18 = load i8**, i8*** %5
%19 = load i8*, i8** %18
%20 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @match to i32 (i8*, i8*, ...)*)(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = load i8**, i8*** %5
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %23
br label %24
24: ; preds = %22, %13
%25 = load i8**, i8*** %5
%26 = load i8*, i8** %25
%27 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @copen to i32 (i8*, i32, ...)*)(i8* %26, i32 114)
store i32 %27, i32* @cin
%28 = load i32, i32* @cin
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %24
%31 = load i8**, i8*** %5
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 2 to i8*), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %32)
%34 = call i32 (...) @cexit()
br label %35
35: ; preds = %30, %24
br label %36
36: ; preds = %35, %10
br label %37
37: ; preds = %50, %36
%38 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%39 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %38)
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %51
41: ; preds = %37
%42 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%43 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @match to i32 (i8*, i8*, ...)*)(i8* %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i32 (...) @tableput()
br label %50
47: ; preds = %41
%48 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%49 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %48)
br label %50
50: ; preds = %47, %45
br label %37
51: ; preds = %37
%52 = load i32, i32* %4
%53 = icmp sle i32 %52, 1
br i1 %53, label %54, label %55
54: ; preds = %51
br label %56
55: ; preds = %51
br label %10
56: ; preds = %54
%57 = call i32 (...) @cexit()
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@cspace = external global i8*
@.str = [4 x i8] c"-ms\00"
@.str.1 = [16 x i8] c"/usr/lib/tmac.s\00"
@cin = external global i32
@.str.2 = [24 x i8] c"where is input file %s\0A\00"
@.str.3 = [4 x i8] c".TS\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @getvec to i32 (i32, ...)*)(i32 2100)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** @cspace
br label %8
8: ; preds = %44, %2
%9 = phi i32 [ %0, %2 ], [ %30, %44 ]
%10 = phi i8** [ %1, %2 ], [ %31, %44 ]
%11 = icmp sgt i32 %9, 1
br i1 %11, label %12, label %29
12: ; preds = %8
%13 = add nsw i32 %9, -1
%14 = getelementptr inbounds i8*, i8** %10, i64 1
%15 = load i8*, i8** %14
%16 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @match to i32 (i8*, i8*, ...)*)(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = load i8*, i8** %14
br label %21
20: ; preds = %12
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %14
br label %21
21: ; preds = %18, %20
%22 = phi i8* [ %19, %18 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %20 ]
%23 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @copen to i32 (i8*, i32, ...)*)(i8* %22, i32 114)
store i32 %23, i32* @cin
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i8*, i8** %14
%27 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 2 to i8*), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = call i32 (...) @cexit()
br label %29
29: ; preds = %21, %25, %8
%30 = phi i32 [ %13, %25 ], [ %13, %21 ], [ %9, %8 ]
%31 = phi i8** [ %14, %25 ], [ %14, %21 ], [ %10, %8 ]
%32 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %4)
%33 = icmp eq i32 %32, 0
br i1 %33, label %44, label %34
34: ; preds = %29, %41
%35 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @match to i32 (i8*, i8*, ...)*)(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = call i32 (...) @tableput()
br label %41
39: ; preds = %34
%40 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %4)
br label %41
41: ; preds = %39, %37
%42 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %4)
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %34
44: ; preds = %41, %29
%45 = icmp slt i32 %30, 2
br i1 %45, label %46, label %8
46: ; preds = %44
%47 = call i32 (...) @cexit()
ret i32 0
}