long dlog(data, maxl, rcp)
char *data;
long maxl;
struct res *rcp;
{
  char title[128];
  int vis, goaway, pid;
  long ref;
  int r1, r2, r3, r4;
  int iid;
  char *skipsp(), *getline(), *lp;
  char *datap = data;
  char *outp(), *outs(), *outl(), *outc();
  char *strcpy();
  if ((lp = getline()) == 0 ||
      sscanf(lp, "%d %d %d %d", &r1, &r2, &r3, &r4) != 4)
    fatal("bad rectangle");
  lp = skipsp(getline());
  vis = (*lp == 'V' || *lp == 'v' ? 1 : 0);
  if ((lp = getline()) == 0 || sscanf(lp, "%d", &pid) != 1)
    fatal("bad proc id");
  lp = skipsp(getline());
  goaway = (*lp == 'G' || *lp == 'g' ? 1 : 0);
  if ((lp = getline()) == 0 || sscanf(lp, "%ld", &ref) != 1)
    fatal("bad refcon");
  if ((lp = getline()) == 0 || sscanf(lp, "%d", &iid) != 1)
    fatal("bad items id");
  strcpy(title, skipsp(getline()));
  datap = outs(datap, r1, &maxl);
  datap = outs(datap, r2, &maxl);
  datap = outs(datap, r3, &maxl);
  datap = outs(datap, r4, &maxl);
  datap = outs(datap, pid, &maxl);
  datap = outc(datap, (char)vis, &maxl);
  datap = outc(datap, (char)0, &maxl);
  datap = outc(datap, (char)goaway, &maxl);
  datap = outc(datap, (char)0, &maxl);
  datap = outl(datap, (long)ref, &maxl);
  datap = outs(datap, iid, &maxl);
  datap = outp(datap, title, &maxl, 1);
  return (datap - data);
}


x86 assembly (clang, -O0):
<dlog>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    $0x0,%al
call   1080 <getline@plt>
mov    %rax,-0xd8(%rbp)
cmp    $0x0,%rax
je     1204 <dlog+0x74>
mov    -0xd8(%rbp),%rdi
lea    0xe28(%rip),%rsi
lea    -0xbc(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
lea    -0xc4(%rbp),%r8
lea    -0xc8(%rbp),%r9
mov    $0x0,%al
call   1060 <sscanf@plt>
cmp    $0x4,%eax
je     1212 <dlog+0x82>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   10b0 <fatal@plt>
mov    $0x0,%al
call   1080 <getline@plt>
mov    %rax,%rdi
mov    $0x0,%al
call   1090 <skipsp@plt>
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x56,%ecx
mov    %al,-0xe1(%rbp)
je     125b <dlog+0xcb>
mov    -0xd8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x76,%eax
sete   %al
mov    %al,-0xe1(%rbp)
mov    -0xe1(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0xa4(%rbp)
mov    $0x0,%al
call   1080 <getline@plt>
mov    %rax,-0xd8(%rbp)
cmp    $0x0,%rax
je     12b1 <dlog+0x121>
mov    -0xd8(%rbp),%rdi
lea    0xd6f(%rip),%rsi
lea    -0xac(%rbp),%rdx
mov    $0x0,%al
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     12bf <dlog+0x12f>
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   10b0 <fatal@plt>
mov    $0x0,%al
call   1080 <getline@plt>
mov    %rax,%rdi
mov    $0x0,%al
call   1090 <skipsp@plt>
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x47,%ecx
mov    %al,-0xe2(%rbp)
je     1308 <dlog+0x178>
mov    -0xd8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x67,%eax
sete   %al
mov    %al,-0xe2(%rbp)
mov    -0xe2(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0xa8(%rbp)
mov    $0x0,%al
call   1080 <getline@plt>
mov    %rax,-0xd8(%rbp)
cmp    $0x0,%rax
je     135e <dlog+0x1ce>
mov    -0xd8(%rbp),%rdi
lea    0xcdf(%rip),%rsi
lea    -0xb8(%rbp),%rdx
mov    $0x0,%al
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     136c <dlog+0x1dc>
lea    0xcc5(%rip),%rdi
mov    $0x0,%al
call   10b0 <fatal@plt>
mov    $0x0,%al
call   1080 <getline@plt>
mov    %rax,-0xd8(%rbp)
cmp    $0x0,%rax
je     13a9 <dlog+0x219>
mov    -0xd8(%rbp),%rdi
lea    0xc77(%rip),%rsi
lea    -0xcc(%rbp),%rdx
mov    $0x0,%al
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     13b7 <dlog+0x227>
lea    0xc85(%rip),%rdi
mov    $0x0,%al
call   10b0 <fatal@plt>
lea    -0xa0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    $0x0,%al
call   1080 <getline@plt>
mov    %rax,%rdi
mov    $0x0,%al
call   1090 <skipsp@plt>
mov    -0xf0(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0xe0(%rbp),%rdi
mov    -0xbc(%rbp),%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   10a0 <outs@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
mov    -0xc0(%rbp),%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   10a0 <outs@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
mov    -0xc4(%rbp),%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   10a0 <outs@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
mov    -0xc8(%rbp),%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   10a0 <outs@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
mov    -0xac(%rbp),%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   10a0 <outs@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
mov    -0xa4(%rbp),%eax
movsbl %al,%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1070 <outc@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
xor    %esi,%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1070 <outc@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
mov    -0xa8(%rbp),%eax
movsbl %al,%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1070 <outc@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
xor    %esi,%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1070 <outc@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
mov    -0xb8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1050 <outl@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
mov    -0xcc(%rbp),%esi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   10a0 <outs@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x1,%ecx
mov    $0x0,%al
call   1040 <outp@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlog>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xb0,%rsp
mov    %rdi,%r14
mov    %rsi,0x28(%rsp)
xor    %eax,%eax
call   1080 <getline@plt>
test   %rax,%rax
je     11dd <dlog+0x4d>
lea    0xe46(%rip),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <sscanf@plt>
cmp    $0x4,%eax
je     11eb <dlog+0x5b>
lea    0xe28(%rip),%rdi
xor    %eax,%eax
call   10b0 <fatal@plt>
xor    %eax,%eax
call   1080 <getline@plt>
mov    %rax,%rdi
xor    %eax,%eax
call   1090 <skipsp@plt>
mov    (%rax),%r15b
xor    %eax,%eax
call   1080 <getline@plt>
test   %rax,%rax
je     1226 <dlog+0x96>
lea    0xdf7(%rip),%rsi
lea    0x1c(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     1234 <dlog+0xa4>
lea    0xded(%rip),%rdi
xor    %eax,%eax
call   10b0 <fatal@plt>
xor    %eax,%eax
call   1080 <getline@plt>
mov    %rax,%rdi
xor    %eax,%eax
call   1090 <skipsp@plt>
mov    (%rax),%bl
xor    %eax,%eax
call   1080 <getline@plt>
test   %rax,%rax
je     126e <dlog+0xde>
lea    0xdcc(%rip),%rsi
lea    0x20(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     127c <dlog+0xec>
lea    0xdb5(%rip),%rdi
xor    %eax,%eax
call   10b0 <fatal@plt>
xor    %eax,%eax
call   1080 <getline@plt>
test   %rax,%rax
je     12a3 <dlog+0x113>
lea    0xd7a(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     12b1 <dlog+0x121>
lea    0xd8b(%rip),%rdi
xor    %eax,%eax
call   10b0 <fatal@plt>
and    $0xdf,%bl
xor    %r12d,%r12d
cmp    $0x47,%bl
sete   %r12b
and    $0xdf,%r15b
xor    %ebp,%ebp
cmp    $0x56,%r15b
sete   %bpl
xor    %eax,%eax
call   1080 <getline@plt>
mov    %rax,%rdi
xor    %eax,%eax
call   1090 <skipsp@plt>
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    0x18(%rsp),%esi
lea    0x28(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <outs@plt>
mov    0x14(%rsp),%esi
mov    %rax,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <outs@plt>
mov    0x10(%rsp),%esi
mov    %rax,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <outs@plt>
mov    0xc(%rsp),%esi
mov    %rax,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <outs@plt>
mov    0x1c(%rsp),%esi
mov    %rax,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <outs@plt>
mov    %rax,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <outc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <outc@plt>
mov    %rax,%rdi
mov    %r12d,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <outc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <outc@plt>
mov    0x20(%rsp),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <outl@plt>
mov    0x8(%rsp),%esi
mov    %rax,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <outs@plt>
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <outp@plt>
sub    %r14,%rax
add    $0xb0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.res = type opaque
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [14 x i8] c"bad rectangle\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"bad proc id\00"
@.str.4 = [4 x i8] c"%ld\00"
@.str.5 = [11 x i8] c"bad refcon\00"
@.str.6 = [13 x i8] c"bad items id\00"
define i64 @dlog(i8* %0, i64 %1, %struct.res* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca %struct.res*
%7 = alloca [128 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store %struct.res* %2, %struct.res** %6
%19 = load i8*, i8** %4
store i8* %19, i8** %18
%20 = call i8* (...) @getline()
store i8* %20, i8** %17
%21 = icmp eq i8* %20, null
br i1 %21, label %26, label %22
22: ; preds = %3
%23 = load i8*, i8** %17
%24 = call i32 (i8*, i8*, ...) @sscanf(i8* %23, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %12, i32* %13, i32* %14, i32* %15)
%25 = icmp ne i32 %24, 4
br i1 %25, label %26, label %28
26: ; preds = %22, %3
%27 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
%29 = call i8* (...) @getline()
%30 = call i8* (i8*, ...) bitcast (i8* (...)* @skipsp to i8* (i8*, ...)*)(i8* %29)
store i8* %30, i8** %17
%31 = load i8*, i8** %17
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 86
br i1 %34, label %40, label %35
35: ; preds = %28
%36 = load i8*, i8** %17
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 118
br label %40
40: ; preds = %35, %28
%41 = phi i1 [ true, %28 ], [ %39, %35 ]
%42 = zext i1 %41 to i64
%43 = select i1 %41, i32 1, i32 0
store i32 %43, i32* %8
%44 = call i8* (...) @getline()
store i8* %44, i8** %17
%45 = icmp eq i8* %44, null
br i1 %45, label %50, label %46
46: ; preds = %40
%47 = load i8*, i8** %17
%48 = call i32 (i8*, i8*, ...) @sscanf(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%49 = icmp ne i32 %48, 1
br i1 %49, label %50, label %52
50: ; preds = %46, %40
%51 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %52
52: ; preds = %50, %46
%53 = call i8* (...) @getline()
%54 = call i8* (i8*, ...) bitcast (i8* (...)* @skipsp to i8* (i8*, ...)*)(i8* %53)
store i8* %54, i8** %17
%55 = load i8*, i8** %17
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 71
br i1 %58, label %64, label %59
59: ; preds = %52
%60 = load i8*, i8** %17
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 103
br label %64
64: ; preds = %59, %52
%65 = phi i1 [ true, %52 ], [ %63, %59 ]
%66 = zext i1 %65 to i64
%67 = select i1 %65, i32 1, i32 0
store i32 %67, i32* %9
%68 = call i8* (...) @getline()
store i8* %68, i8** %17
%69 = icmp eq i8* %68, null
br i1 %69, label %74, label %70
70: ; preds = %64
%71 = load i8*, i8** %17
%72 = call i32 (i8*, i8*, ...) @sscanf(i8* %71, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64* %11)
%73 = icmp ne i32 %72, 1
br i1 %73, label %74, label %76
74: ; preds = %70, %64
%75 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %76
76: ; preds = %74, %70
%77 = call i8* (...) @getline()
store i8* %77, i8** %17
%78 = icmp eq i8* %77, null
br i1 %78, label %83, label %79
79: ; preds = %76
%80 = load i8*, i8** %17
%81 = call i32 (i8*, i8*, ...) @sscanf(i8* %80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %16)
%82 = icmp ne i32 %81, 1
br i1 %82, label %83, label %85
83: ; preds = %79, %76
%84 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %85
85: ; preds = %83, %79
%86 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%87 = call i8* (...) @getline()
%88 = call i8* (i8*, ...) bitcast (i8* (...)* @skipsp to i8* (i8*, ...)*)(i8* %87)
%89 = call i8* @strcpy(i8* %86, i8* %88)
%90 = load i8*, i8** %18
%91 = load i32, i32* %12
%92 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %90, i32 %91, i64* %5)
store i8* %92, i8** %18
%93 = load i8*, i8** %18
%94 = load i32, i32* %13
%95 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %93, i32 %94, i64* %5)
store i8* %95, i8** %18
%96 = load i8*, i8** %18
%97 = load i32, i32* %14
%98 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %96, i32 %97, i64* %5)
store i8* %98, i8** %18
%99 = load i8*, i8** %18
%100 = load i32, i32* %15
%101 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %99, i32 %100, i64* %5)
store i8* %101, i8** %18
%102 = load i8*, i8** %18
%103 = load i32, i32* %10
%104 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %102, i32 %103, i64* %5)
store i8* %104, i8** %18
%105 = load i8*, i8** %18
%106 = load i32, i32* %8
%107 = trunc i32 %106 to i8
%108 = sext i8 %107 to i32
%109 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outc to i8* (i8*, i32, i64*, ...)*)(i8* %105, i32 %108, i64* %5)
store i8* %109, i8** %18
%110 = load i8*, i8** %18
%111 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outc to i8* (i8*, i32, i64*, ...)*)(i8* %110, i32 0, i64* %5)
store i8* %111, i8** %18
%112 = load i8*, i8** %18
%113 = load i32, i32* %9
%114 = trunc i32 %113 to i8
%115 = sext i8 %114 to i32
%116 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outc to i8* (i8*, i32, i64*, ...)*)(i8* %112, i32 %115, i64* %5)
store i8* %116, i8** %18
%117 = load i8*, i8** %18
%118 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outc to i8* (i8*, i32, i64*, ...)*)(i8* %117, i32 0, i64* %5)
store i8* %118, i8** %18
%119 = load i8*, i8** %18
%120 = load i64, i64* %11
%121 = call i8* (i8*, i64, i64*, ...) bitcast (i8* (...)* @outl to i8* (i8*, i64, i64*, ...)*)(i8* %119, i64 %120, i64* %5)
store i8* %121, i8** %18
%122 = load i8*, i8** %18
%123 = load i32, i32* %16
%124 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %122, i32 %123, i64* %5)
store i8* %124, i8** %18
%125 = load i8*, i8** %18
%126 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%127 = call i8* (i8*, i8*, i64*, i32, ...) bitcast (i8* (...)* @outp to i8* (i8*, i8*, i64*, i32, ...)*)(i8* %125, i8* %126, i64* %5, i32 1)
store i8* %127, i8** %18
%128 = load i8*, i8** %18
%129 = load i8*, i8** %4
%130 = ptrtoint i8* %128 to i64
%131 = ptrtoint i8* %129 to i64
%132 = sub i64 %130, %131
ret i64 %132
}

LLVM IR (-O2):
%struct.res = type opaque
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [14 x i8] c"bad rectangle\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"bad proc id\00"
@.str.4 = [4 x i8] c"%ld\00"
@.str.5 = [11 x i8] c"bad refcon\00"
@.str.6 = [13 x i8] c"bad items id\00"
define i64 @dlog(i8* %0, i64 %1, %struct.res* nocapture readnone %2) {
%4 = alloca i64
%5 = alloca [128 x i8]
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i64 %1, i64* %4
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%14 = bitcast i32* %6 to i8*
%15 = bitcast i64* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = bitcast i32* %9 to i8*
%18 = bitcast i32* %10 to i8*
%19 = bitcast i32* %11 to i8*
%20 = bitcast i32* %12 to i8*
%21 = tail call i8* (...) @getline()
%22 = icmp eq i8* %21, null
br i1 %22, label %26, label %23
23: ; preds = %3
%24 = call i32 (i8*, i8*, ...) @sscanf(i8* %21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %8, i32* %9, i32* %10, i32* %11)
%25 = icmp eq i32 %24, 4
br i1 %25, label %28, label %26
26: ; preds = %23, %3
%27 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
%29 = call i8* (...) @getline()
%30 = call i8* (i8*, ...) bitcast (i8* (...)* @skipsp to i8* (i8*, ...)*)(i8* %29)
%31 = load i8, i8* %30
%32 = call i8* (...) @getline()
%33 = icmp eq i8* %32, null
br i1 %33, label %37, label %34
34: ; preds = %28
%35 = call i32 (i8*, i8*, ...) @sscanf(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%36 = icmp eq i32 %35, 1
br i1 %36, label %39, label %37
37: ; preds = %34, %28
%38 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = call i8* (...) @getline()
%41 = call i8* (i8*, ...) bitcast (i8* (...)* @skipsp to i8* (i8*, ...)*)(i8* %40)
%42 = load i8, i8* %41
%43 = call i8* (...) @getline()
%44 = icmp eq i8* %43, null
br i1 %44, label %48, label %45
45: ; preds = %39
%46 = call i32 (i8*, i8*, ...) @sscanf(i8* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64* %7)
%47 = icmp eq i32 %46, 1
br i1 %47, label %50, label %48
48: ; preds = %45, %39
%49 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %50
50: ; preds = %48, %45
%51 = call i8* (...) @getline()
%52 = icmp eq i8* %51, null
br i1 %52, label %56, label %53
53: ; preds = %50
%54 = call i32 (i8*, i8*, ...) @sscanf(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %12)
%55 = icmp eq i32 %54, 1
br i1 %55, label %58, label %56
56: ; preds = %53, %50
%57 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %58
58: ; preds = %56, %53
%59 = and i8 %42, -33
%60 = icmp eq i8 %59, 71
%61 = zext i1 %60 to i32
%62 = and i8 %31, -33
%63 = icmp eq i8 %62, 86
%64 = zext i1 %63 to i32
%65 = call i8* (...) @getline()
%66 = call i8* (i8*, ...) bitcast (i8* (...)* @skipsp to i8* (i8*, ...)*)(i8* %65)
%67 = call i8* @strcpy(i8* %13, i8* dereferenceable(1) %66)
%68 = load i32, i32* %8
%69 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %0, i32 %68, i64* %4)
%70 = load i32, i32* %9
%71 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %69, i32 %70, i64* %4)
%72 = load i32, i32* %10
%73 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %71, i32 %72, i64* %4)
%74 = load i32, i32* %11
%75 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %73, i32 %74, i64* %4)
%76 = load i32, i32* %6
%77 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %75, i32 %76, i64* %4)
%78 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outc to i8* (i8*, i32, i64*, ...)*)(i8* %77, i32 %64, i64* %4)
%79 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outc to i8* (i8*, i32, i64*, ...)*)(i8* %78, i32 0, i64* %4)
%80 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outc to i8* (i8*, i32, i64*, ...)*)(i8* %79, i32 %61, i64* %4)
%81 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outc to i8* (i8*, i32, i64*, ...)*)(i8* %80, i32 0, i64* %4)
%82 = load i64, i64* %7
%83 = call i8* (i8*, i64, i64*, ...) bitcast (i8* (...)* @outl to i8* (i8*, i64, i64*, ...)*)(i8* %81, i64 %82, i64* %4)
%84 = load i32, i32* %12
%85 = call i8* (i8*, i32, i64*, ...) bitcast (i8* (...)* @outs to i8* (i8*, i32, i64*, ...)*)(i8* %83, i32 %84, i64* %4)
%86 = call i8* (i8*, i8*, i64*, i32, ...) bitcast (i8* (...)* @outp to i8* (i8*, i8*, i64*, i32, ...)*)(i8* %85, i8* %13, i64* %4, i32 1)
%87 = ptrtoint i8* %86 to i64
%88 = ptrtoint i8* %0 to i64
%89 = sub i64 %87, %88
ret i64 %89
}