#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 */
scalar_t__ VH_MarkUpdateBlock(int, int, int, int);
int VL_GetScrollX();
scalar_t__ VL_GetScrollY();
int /*<<< orphan*/ VL_ScreenRect(int, int, int, int, int);
void VHB_VLine(int y1, int y2, int x, int colour) {
  x += VL_GetScrollX() & 8;
  y1 += VL_GetScrollY();
  y2 += VL_GetScrollY();
  if (VH_MarkUpdateBlock(x, y1, 1, y2 - y1 + 1))
    VL_ScreenRect(x, y1, 1, y2 - y1 + 1, colour);
}


x86 assembly (clang, -O0):
<VHB_VLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    $0x0,%al
call   1040 <VL_GetScrollX@plt>
and    $0x8,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <VL_GetScrollY@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <VL_GetScrollY@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
mov    $0x1,%edx
call   1060 <VH_MarkUpdateBlock@plt>
cmp    $0x0,%rax
je     11cc <VHB_VLine+0x8c>
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%r8d
mov    $0x1,%edx
call   1030 <VL_ScreenRect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VHB_VLine>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%r12d
mov    %edi,%r13d
xor    %eax,%eax
call   1040 <VL_GetScrollX@plt>
mov    %eax,%ebp
and    $0x8,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1050 <VL_GetScrollY@plt>
mov    %rax,%r15
add    %r13d,%r15d
xor    %eax,%eax
call   1050 <VL_GetScrollY@plt>
mov    %rax,%rbx
add    %r12d,%ebx
sub    %r15d,%ebx
add    $0x1,%ebx
mov    %ebp,%edi
mov    %r15d,%esi
mov    $0x1,%edx
mov    %ebx,%ecx
call   1060 <VH_MarkUpdateBlock@plt>
test   %rax,%rax
je     11bc <VHB_VLine+0x7c>
mov    %ebp,%edi
mov    %r15d,%esi
mov    $0x1,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <VL_ScreenRect@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @VHB_VLine(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = call i32 (...) @VL_GetScrollX()
%10 = and i32 %9, 8
%11 = load i32, i32* %7
%12 = add nsw i32 %11, %10
store i32 %12, i32* %7
%13 = call i64 (...) @VL_GetScrollY()
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = add nsw i64 %15, %13
%17 = trunc i64 %16 to i32
store i32 %17, i32* %5
%18 = call i64 (...) @VL_GetScrollY()
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = add nsw i64 %20, %18
%22 = trunc i64 %21 to i32
store i32 %22, i32* %6
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = load i32, i32* %5
%27 = sub nsw i32 %25, %26
%28 = add nsw i32 %27, 1
%29 = call i64 @VH_MarkUpdateBlock(i32 %23, i32 %24, i32 1, i32 %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %40
31: ; preds = %4
%32 = load i32, i32* %7
%33 = load i32, i32* %5
%34 = load i32, i32* %6
%35 = load i32, i32* %5
%36 = sub nsw i32 %34, %35
%37 = add nsw i32 %36, 1
%38 = load i32, i32* %8
%39 = call i32 @VL_ScreenRect(i32 %32, i32 %33, i32 1, i32 %37, i32 %38)
br label %40
40: ; preds = %31, %4
ret void
}

LLVM IR (-O2):
define void @VHB_VLine(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 (...) @VL_GetScrollX()
%6 = and i32 %5, 8
%7 = add nsw i32 %6, %2
%8 = tail call i64 (...) @VL_GetScrollY()
%9 = trunc i64 %8 to i32
%10 = add i32 %9, %0
%11 = tail call i64 (...) @VL_GetScrollY()
%12 = trunc i64 %11 to i32
%13 = add i32 %1, 1
%14 = add i32 %13, %12
%15 = sub i32 %14, %10
%16 = tail call i64 @VH_MarkUpdateBlock(i32 %7, i32 %10, i32 1, i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %4
%19 = tail call i32 @VL_ScreenRect(i32 %7, i32 %10, i32 1, i32 %15, i32 %3)
br label %20
20: ; preds = %18, %4
ret void
}