#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ DrawHorizontalLine(int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ DrawVerticalLine(int, int, int, int /*<<< orphan*/);
void DrawEmptyRectangle(int x, int y, int xsize, int ysize, uint8_t color) {
  DrawHorizontalLine(x, y, xsize, color);
  DrawHorizontalLine(x, y + ysize - 1, xsize, color);
  DrawVerticalLine(x, y, ysize, color);
  DrawVerticalLine(x + xsize - 1, y, ysize, color);
}


x86 assembly (clang, -O0):
<DrawEmptyRectangle>:
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   1040 <DrawHorizontalLine@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   1040 <DrawHorizontalLine@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <DrawVerticalLine@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   1030 <DrawVerticalLine@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawEmptyRectangle>:
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   1040 <DrawHorizontalLine@plt>
lea    (%rbx,%r14,1),%esi
add    $0xffffffff,%esi
mov    %ebp,%edi
mov    %r15d,%edx
mov    %r12d,%ecx
call   1040 <DrawHorizontalLine@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
call   1030 <DrawVerticalLine@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    1030 <DrawVerticalLine@plt>

LLVM IR (-O0):
define void @DrawEmptyRectangle(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 @DrawHorizontalLine(i32 %11, i32 %12, i32 %13, i32 %14)
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = load i32, i32* %9
%19 = add nsw i32 %17, %18
%20 = sub nsw i32 %19, 1
%21 = load i32, i32* %8
%22 = load i32, i32* %10
%23 = call i32 @DrawHorizontalLine(i32 %16, i32 %20, i32 %21, i32 %22)
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = load i32, i32* %9
%27 = load i32, i32* %10
%28 = call i32 @DrawVerticalLine(i32 %24, 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 @DrawVerticalLine(i32 %32, i32 %33, i32 %34, i32 %35)
ret void
}

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