#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 /*<<< orphan*/ ACS_CKBOARD;
int /*<<< orphan*/ ACS_VLINE;
int /*<<< orphan*/ mvvline(int, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ standout();
void draw_scrollbar(int sy, int sx, int by1, int by2, int by3, int by4) {
  int x, y;
  int len;
  x = sx;
  y = sy;
  len = by2;
  if (len > 0) {
    mvvline(y, x, ACS_VLINE, len);
    y += len;
  }
  len = by3 - by2;
  mvvline(y, x, ACS_CKBOARD, len);
  y += len;
  len = by4 - by3;
  if (len > 0) {
    mvvline(y, x, ACS_VLINE, len);
  }
  standout();
}


x86 assembly (clang, -O0):
<draw_scrollbar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    1178 <draw_scrollbar+0x58>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
mov    -0x24(%rbp),%ecx
call   1040 <mvvline@plt>
mov    -0x24(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    0x2e5a(%rip),%rax
mov    (%rax),%edx
mov    -0x24(%rbp),%ecx
call   1040 <mvvline@plt>
mov    -0x24(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    11cb <draw_scrollbar+0xab>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    0x2e17(%rip),%rax
mov    (%rax),%edx
mov    -0x24(%rbp),%ecx
call   1040 <mvvline@plt>
mov    $0x0,%al
call   1030 <standout@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_scrollbar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r15d
mov    %r8d,%r12d
mov    %ecx,%ebx
mov    %esi,%r14d
mov    %edi,%r13d
test   %ecx,%ecx
jle    1156 <draw_scrollbar+0x36>
mov    0x2e94(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
mov    %r14d,%esi
mov    %ebx,%ecx
call   1040 <mvvline@plt>
add    %ebx,%r13d
mov    %r12d,%ebp
sub    %ebx,%ebp
mov    0x2e86(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
mov    %r14d,%esi
mov    %ebp,%ecx
call   1040 <mvvline@plt>
sub    %r12d,%r15d
jle    1190 <draw_scrollbar+0x70>
add    %ebp,%r13d
mov    0x2e58(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
mov    %r14d,%esi
mov    %r15d,%ecx
call   1040 <mvvline@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <standout@plt>

LLVM IR (-O0):
@ACS_VLINE = global i32 0
@ACS_CKBOARD = global i32 0
define void @draw_scrollbar(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%16 = load i32, i32* %8
store i32 %16, i32* %13
%17 = load i32, i32* %7
store i32 %17, i32* %14
%18 = load i32, i32* %10
store i32 %18, i32* %15
%19 = load i32, i32* %15
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %6
%22 = load i32, i32* %14
%23 = load i32, i32* %13
%24 = load i32, i32* @ACS_VLINE
%25 = load i32, i32* %15
%26 = call i32 @mvvline(i32 %22, i32 %23, i32 %24, i32 %25)
%27 = load i32, i32* %15
%28 = load i32, i32* %14
%29 = add nsw i32 %28, %27
store i32 %29, i32* %14
br label %30
30: ; preds = %21, %6
%31 = load i32, i32* %11
%32 = load i32, i32* %10
%33 = sub nsw i32 %31, %32
store i32 %33, i32* %15
%34 = load i32, i32* %14
%35 = load i32, i32* %13
%36 = load i32, i32* @ACS_CKBOARD
%37 = load i32, i32* %15
%38 = call i32 @mvvline(i32 %34, i32 %35, i32 %36, i32 %37)
%39 = load i32, i32* %15
%40 = load i32, i32* %14
%41 = add nsw i32 %40, %39
store i32 %41, i32* %14
%42 = load i32, i32* %12
%43 = load i32, i32* %11
%44 = sub nsw i32 %42, %43
store i32 %44, i32* %15
%45 = load i32, i32* %15
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %53
47: ; preds = %30
%48 = load i32, i32* %14
%49 = load i32, i32* %13
%50 = load i32, i32* @ACS_VLINE
%51 = load i32, i32* %15
%52 = call i32 @mvvline(i32 %48, i32 %49, i32 %50, i32 %51)
br label %53
53: ; preds = %47, %30
%54 = call i32 (...) @standout()
ret void
}

LLVM IR (-O2):
@ACS_VLINE = global i32 0
@ACS_CKBOARD = global i32 0
define void @draw_scrollbar(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %12
8: ; preds = %6
%9 = load i32, i32* @ACS_VLINE
%10 = tail call i32 @mvvline(i32 %0, i32 %1, i32 %9, i32 %3)
%11 = add nsw i32 %3, %0
br label %12
12: ; preds = %8, %6
%13 = phi i32 [ %11, %8 ], [ %0, %6 ]
%14 = sub nsw i32 %4, %3
%15 = load i32, i32* @ACS_CKBOARD
%16 = tail call i32 @mvvline(i32 %13, i32 %1, i32 %15, i32 %14)
%17 = sub nsw i32 %5, %4
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %12
%20 = add nsw i32 %13, %14
%21 = load i32, i32* @ACS_VLINE
%22 = tail call i32 @mvvline(i32 %20, i32 %1, i32 %21, i32 %17)
br label %23
23: ; preds = %19, %12
%24 = tail call i32 (...) @standout()
ret void
}