#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int LINES;
int /*<<< orphan*/ move(int, int /*<<< orphan*/);
char *nextline(char *);
int /*<<< orphan*/ ptarg(int /*<<< orphan*/);
scalar_t__ screenlines(char *);
int skips(int);
char *winstart();
void drawlinelbls(int lvl, int off) {
  int count = 0;
  char *p = winstart();
  int toskip = off;
  for (int line = 0; line < LINES - 1;) {
    if (toskip == 0) {
      move(line, 0);
      ptarg(count++);
      toskip = skips(lvl);
    } else {
      toskip--;
    }
    line += screenlines(p);
    p = nextline(p);
  }
}


x86 assembly (clang, -O0):
<drawlinelbls>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1060 <winstart@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    0x2e51(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1209 <drawlinelbls+0xa9>
cmpl   $0x0,-0x1c(%rbp)
jne    11d8 <drawlinelbls+0x78>
mov    -0x20(%rbp),%edi
xor    %esi,%esi
call   1080 <move@plt>
mov    -0xc(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
call   1040 <ptarg@plt>
mov    -0x4(%rbp),%edi
call   1030 <skips@plt>
mov    %eax,-0x1c(%rbp)
jmp    11e1 <drawlinelbls+0x81>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <screenlines@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <nextline@plt>
mov    %rax,-0x18(%rbp)
jmp    118d <drawlinelbls+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawlinelbls>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,0x4(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <winstart@plt>
mov    0x2e66(%rip),%r13
cmpl   $0x2,0x0(%r13)
jl     11f0 <drawlinelbls+0x90>
mov    %rax,%rbx
xor    %r12d,%r12d
jmp    11c4 <drawlinelbls+0x64>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%r15d
mov    %rbx,%rdi
call   1070 <screenlines@plt>
add    %eax,%ebp
mov    %rbx,%rdi
call   1050 <nextline@plt>
mov    %rax,%rbx
mov    0x0(%r13),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebp
jge    11f0 <drawlinelbls+0x90>
test   %r15d,%r15d
jne    11a0 <drawlinelbls+0x40>
mov    %ebp,%edi
xor    %esi,%esi
call   1080 <move@plt>
lea    0x1(%r12),%r14d
mov    %r12d,%edi
call   1040 <ptarg@plt>
mov    0x4(%rsp),%edi
call   1030 <skips@plt>
mov    %eax,%r15d
mov    %r14d,%r12d
jmp    11a4 <drawlinelbls+0x44>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@LINES = global i32 0
define void @drawlinelbls(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%9 = call i8* (...) @winstart()
store i8* %9, i8** %6
%10 = load i32, i32* %4
store i32 %10, i32* %7
store i32 0, i32* %8
br label %11
11: ; preds = %30, %2
%12 = load i32, i32* %8
%13 = load i32, i32* @LINES
%14 = sub nsw i32 %13, 1
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %39
16: ; preds = %11
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i32, i32* %8
%21 = call i32 @move(i32 %20, i32 0)
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
%24 = call i32 @ptarg(i32 %22)
%25 = load i32, i32* %3
%26 = call i32 @skips(i32 %25)
store i32 %26, i32* %7
br label %30
27: ; preds = %16
%28 = load i32, i32* %7
%29 = add nsw i32 %28, -1
store i32 %29, i32* %7
br label %30
30: ; preds = %27, %19
%31 = load i8*, i8** %6
%32 = call i64 @screenlines(i8* %31)
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = add nsw i64 %34, %32
%36 = trunc i64 %35 to i32
store i32 %36, i32* %8
%37 = load i8*, i8** %6
%38 = call i8* @nextline(i8* %37)
store i8* %38, i8** %6
br label %11
39: ; preds = %11
ret void
}

LLVM IR (-O2):
@LINES = global i32 0
define void @drawlinelbls(i32 %0, i32 %1) {
%3 = tail call i8* (...) @winstart()
%4 = load i32, i32* @LINES
%5 = icmp sgt i32 %4, 1
br i1 %5, label %7, label %6
6: ; preds = %20, %2
ret void
7: ; preds = %2, %20
%8 = phi i32 [ %25, %20 ], [ 0, %2 ]
%9 = phi i32 [ %22, %20 ], [ %1, %2 ]
%10 = phi i8* [ %26, %20 ], [ %3, %2 ]
%11 = phi i32 [ %21, %20 ], [ 0, %2 ]
%12 = icmp eq i32 %9, 0
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = tail call i32 @move(i32 %8, i32 0)
%15 = add nsw i32 %11, 1
%16 = tail call i32 @ptarg(i32 %11)
%17 = tail call i32 @skips(i32 %0)
br label %20
18: ; preds = %7
%19 = add nsw i32 %9, -1
br label %20
20: ; preds = %18, %13
%21 = phi i32 [ %15, %13 ], [ %11, %18 ]
%22 = phi i32 [ %17, %13 ], [ %19, %18 ]
%23 = tail call i64 @screenlines(i8* %10)
%24 = trunc i64 %23 to i32
%25 = add i32 %8, %24
%26 = tail call i8* @nextline(i8* %10)
%27 = load i32, i32* @LINES
%28 = add nsw i32 %27, -1
%29 = icmp slt i32 %25, %28
br i1 %29, label %7, label %6
}