#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*/ display_fillbox_wh(int, int, int, int, int, int);
int /*<<< orphan*/ display_vline_wh(int, int, int, int, int);
void display_ddd_box(int x1, int y1, int w, int h, int tl_color, int rd_color) {
  display_fillbox_wh(x1, y1, w, 1, tl_color, 1);
  display_fillbox_wh(x1, y1 + h - 1, w, 1, rd_color, 1);
  h -= 2;
  display_vline_wh(x1, y1 + 1, h, tl_color, 1);
  display_vline_wh(x1 + w - 1, y1 + 1, h, rd_color, 1);
}


x86 assembly (clang, -O0):
<display_ddd_box>:
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    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%r8d
mov    $0x1,%r9d
mov    %r9d,%ecx
call   1040 <display_fillbox_wh@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    -0x10(%rbp),%esi
sub    $0x1,%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%r8d
mov    $0x1,%r9d
mov    %r9d,%ecx
call   1040 <display_fillbox_wh@plt>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    $0x1,%r8d
call   1030 <display_vline_wh@plt>
mov    -0x4(%rbp),%edi
add    -0xc(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    $0x1,%r8d
call   1030 <display_vline_wh@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_ddd_box>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%r13d
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,%r12d
mov    $0x1,%ecx
mov    $0x1,%r9d
call   1040 <display_fillbox_wh@plt>
lea    (%rbx,%rbp,1),%esi
add    $0xffffffff,%esi
mov    %r12d,%edi
mov    %r15d,%edx
mov    $0x1,%ecx
mov    %r14d,%r8d
mov    $0x1,%r9d
call   1040 <display_fillbox_wh@plt>
add    $0xfffffffe,%ebx
add    $0x1,%ebp
mov    %r12d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r13d,%ecx
mov    $0x1,%r8d
call   1030 <display_vline_wh@plt>
lea    (%r12,%r15,1),%edi
add    $0xffffffff,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    $0x1,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <display_vline_wh@plt>

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

LLVM IR (-O2):
define void @display_ddd_box(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @display_fillbox_wh(i32 %0, i32 %1, i32 %2, i32 1, i32 %4, i32 1)
%8 = add i32 %1, -1
%9 = add i32 %8, %3
%10 = tail call i32 @display_fillbox_wh(i32 %0, i32 %9, i32 %2, i32 1, i32 %5, i32 1)
%11 = add nsw i32 %3, -2
%12 = add nsw i32 %1, 1
%13 = tail call i32 @display_vline_wh(i32 %0, i32 %12, i32 %11, i32 %4, i32 1)
%14 = add i32 %0, -1
%15 = add i32 %14, %2
%16 = tail call i32 @display_vline_wh(i32 %15, i32 %12, i32 %11, i32 %5, i32 1)
ret void
}