#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_HLine(int x1, int x2, int y, int colour) {
  x1 += VL_GetScrollX() & 8;
  x2 += VL_GetScrollX() & 8;
  y += VL_GetScrollY();
  if (VH_MarkUpdateBlock(x1, y, x2 - x1 + 1, 1))
    VL_ScreenRect(x1, y, x2 - x1 + 1, 1, colour);
}


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

x86 assembly (clang, -O2):
<VHB_HLine>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %esi,%r13d
mov    %edi,%r15d
xor    %eax,%eax
call   1040 <VL_GetScrollX@plt>
and    $0x8,%eax
add    %eax,%r15d
xor    %eax,%eax
call   1040 <VL_GetScrollX@plt>
mov    %eax,%ebx
and    $0x8,%ebx
xor    %eax,%eax
call   1050 <VL_GetScrollY@plt>
mov    %rax,%rbp
add    %r12d,%ebp
add    %r13d,%ebx
sub    %r15d,%ebx
add    $0x1,%ebx
mov    %r15d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x1,%ecx
call   1060 <VH_MarkUpdateBlock@plt>
test   %rax,%rax
je     11be <VHB_HLine+0x7e>
mov    %r15d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x1,%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_HLine(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* %5
%12 = add nsw i32 %11, %10
store i32 %12, i32* %5
%13 = call i32 (...) @VL_GetScrollX()
%14 = and i32 %13, 8
%15 = load i32, i32* %6
%16 = add nsw i32 %15, %14
store i32 %16, i32* %6
%17 = call i64 (...) @VL_GetScrollY()
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = add nsw i64 %19, %17
%21 = trunc i64 %20 to i32
store i32 %21, i32* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = load i32, i32* %5
%26 = sub nsw i32 %24, %25
%27 = add nsw i32 %26, 1
%28 = call i64 @VH_MarkUpdateBlock(i32 %22, i32 %23, i32 %27, i32 1)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %39
30: ; preds = %4
%31 = load i32, i32* %5
%32 = load i32, i32* %7
%33 = load i32, i32* %6
%34 = load i32, i32* %5
%35 = sub nsw i32 %33, %34
%36 = add nsw i32 %35, 1
%37 = load i32, i32* %8
%38 = call i32 @VL_ScreenRect(i32 %31, i32 %32, i32 %36, i32 1, i32 %37)
br label %39
39: ; preds = %30, %4
ret void
}

LLVM IR (-O2):
define void @VHB_HLine(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 (...) @VL_GetScrollX()
%6 = and i32 %5, 8
%7 = add nsw i32 %6, %0
%8 = tail call i32 (...) @VL_GetScrollX()
%9 = and i32 %8, 8
%10 = tail call i64 (...) @VL_GetScrollY()
%11 = trunc i64 %10 to i32
%12 = add i32 %11, %2
%13 = add i32 %1, 1
%14 = add i32 %13, %9
%15 = sub i32 %14, %7
%16 = tail call i64 @VH_MarkUpdateBlock(i32 %7, i32 %12, i32 %15, i32 1)
%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 %12, i32 %15, i32 1, i32 %3)
br label %20
20: ; preds = %18, %4
ret void
}