#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*/ VH_DrawTile8M(int, int, int);
scalar_t__ VH_MarkUpdateBlock(int, int, int, int);
int VL_GetScrollX();
scalar_t__ VL_GetScrollY();
void VHB_DrawTile8M(int x, int y, int tile) {
  x += VL_GetScrollX() & 8;
  y += VL_GetScrollY();
  if (VH_MarkUpdateBlock(x, y, x + 7, y + 7))
    VH_DrawTile8M(x, y, tile);
}


x86 assembly (clang, -O0):
<VHB_DrawTile8M>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1040 <VL_GetScrollX@plt>
and    $0x8,%eax
add    -0x4(%rbp),%eax
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    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
add    $0x7,%edx
mov    -0x8(%rbp),%ecx
add    $0x7,%ecx
call   1060 <VH_MarkUpdateBlock@plt>
cmp    $0x0,%rax
je     11a4 <VHB_DrawTile8M+0x64>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <VH_DrawTile8M@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

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