#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*/ VdrawHLine(int, int, int, unsigned int);
int /*<<< orphan*/ VdrawVLine(int, int, int, unsigned int);
void VdrawRect(int x, int y, int width, int height, unsigned int color) {
  VdrawHLine(x, y, width, color);
  VdrawVLine(x, y, height, color);
  VdrawHLine(x, y + height - 1, width, color);
  VdrawVLine(x + width - 1, y, height, color);
}


x86 assembly (clang, -O0):
<VdrawRect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <VdrawHLine@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <VdrawVLine@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    -0x10(%rbp),%esi
sub    $0x1,%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <VdrawHLine@plt>
mov    -0x4(%rbp),%edi
add    -0xc(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <VdrawVLine@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VdrawRect>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r12d
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%ebp
mov    %r8d,%ecx
call   1030 <VdrawHLine@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
call   1040 <VdrawVLine@plt>
lea    (%rbx,%r14,1),%esi
add    $0xffffffff,%esi
mov    %ebp,%edi
mov    %r15d,%edx
mov    %r12d,%ecx
call   1030 <VdrawHLine@plt>
lea    (%r15,%rbp,1),%edi
add    $0xffffffff,%edi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <VdrawVLine@plt>

LLVM IR (-O0):
define void @VdrawRect(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %10
%15 = call i32 @VdrawHLine(i32 %11, i32 %12, i32 %13, i32 %14)
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = load i32, i32* %9
%19 = load i32, i32* %10
%20 = call i32 @VdrawVLine(i32 %16, i32 %17, i32 %18, i32 %19)
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %9
%24 = add nsw i32 %22, %23
%25 = sub nsw i32 %24, 1
%26 = load i32, i32* %8
%27 = load i32, i32* %10
%28 = call i32 @VdrawHLine(i32 %21, i32 %25, i32 %26, i32 %27)
%29 = load i32, i32* %6
%30 = load i32, i32* %8
%31 = add nsw i32 %29, %30
%32 = sub nsw i32 %31, 1
%33 = load i32, i32* %7
%34 = load i32, i32* %9
%35 = load i32, i32* %10
%36 = call i32 @VdrawVLine(i32 %32, i32 %33, i32 %34, i32 %35)
ret void
}

LLVM IR (-O2):
define void @VdrawRect(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @VdrawHLine(i32 %0, i32 %1, i32 %2, i32 %4)
%7 = tail call i32 @VdrawVLine(i32 %0, i32 %1, i32 %3, i32 %4)
%8 = add i32 %1, -1
%9 = add i32 %8, %3
%10 = tail call i32 @VdrawHLine(i32 %0, i32 %9, i32 %2, i32 %4)
%11 = add i32 %0, -1
%12 = add i32 %11, %2
%13 = tail call i32 @VdrawVLine(i32 %12, i32 %1, i32 %3, i32 %4)
ret void
}