#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*/ ACS_HLINE;
int /*<<< orphan*/ ACS_LLCORNER;
int /*<<< orphan*/ ACS_LRCORNER;
int /*<<< orphan*/ ACS_ULCORNER;
int /*<<< orphan*/ ACS_URCORNER;
int /*<<< orphan*/ ACS_VLINE;
int /*<<< orphan*/ addch(int /*<<< orphan*/);
int /*<<< orphan*/ hline(int /*<<< orphan*/, int);
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ vline(int /*<<< orphan*/, int);
void draw_box(int x, int y, int width, int height) {
  move(y, x);
  hline(ACS_HLINE, width);
  move(y, x + width);
  vline(ACS_VLINE, height);
  move(y, x);
  vline(ACS_VLINE, height);
  move(y + height, x);
  hline(ACS_HLINE, width);
  move(y, x);
  addch(ACS_ULCORNER);
  move(y, x + width);
  addch(ACS_URCORNER);
  move(y + height, x);
  addch(ACS_LLCORNER);
  move(y + height, x + width);
  addch(ACS_LRCORNER);
}


x86 assembly (clang, -O0):
<draw_box>:
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    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1060 <move@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%esi
call   1040 <hline@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
add    -0xc(%rbp),%esi
call   1060 <move@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%esi
call   1050 <vline@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1060 <move@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%esi
call   1050 <vline@plt>
mov    -0x8(%rbp),%edi
add    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1060 <move@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%esi
call   1040 <hline@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1060 <move@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
call   1030 <addch@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
add    -0xc(%rbp),%esi
call   1060 <move@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
call   1030 <addch@plt>
mov    -0x8(%rbp),%edi
add    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1060 <move@plt>
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
call   1030 <addch@plt>
mov    -0x8(%rbp),%edi
add    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
add    -0xc(%rbp),%esi
call   1060 <move@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
call   1030 <addch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_box>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r12d
mov    %esi,%ebp
mov    %edi,%r14d
mov    %esi,%edi
mov    %r14d,%esi
call   1060 <move@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
mov    %r12d,%esi
call   1040 <hline@plt>
lea    (%r12,%r14,1),%r15d
mov    %ebp,%edi
mov    %r15d,%esi
call   1060 <move@plt>
mov    0x2e3b(%rip),%r13
mov    0x0(%r13),%edi
mov    %ebx,%esi
call   1050 <vline@plt>
mov    %ebp,%edi
mov    %r14d,%esi
call   1060 <move@plt>
mov    0x0(%r13),%edi
mov    %ebx,%esi
call   1050 <vline@plt>
add    %ebp,%ebx
mov    %ebx,%edi
mov    %r14d,%esi
call   1060 <move@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
mov    %r12d,%esi
call   1040 <hline@plt>
mov    %ebp,%edi
mov    %r14d,%esi
call   1060 <move@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
call   1030 <addch@plt>
mov    %ebp,%edi
mov    %r15d,%esi
call   1060 <move@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
call   1030 <addch@plt>
mov    %ebx,%edi
mov    %r14d,%esi
call   1060 <move@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
call   1030 <addch@plt>
mov    %ebx,%edi
mov    %r15d,%esi
call   1060 <move@plt>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <addch@plt>

LLVM IR (-O0):
@ACS_HLINE = global i32 0
@ACS_VLINE = global i32 0
@ACS_ULCORNER = global i32 0
@ACS_URCORNER = global i32 0
@ACS_LLCORNER = global i32 0
@ACS_LRCORNER = global i32 0
define void @draw_box(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 = load i32, i32* %6
%10 = load i32, i32* %5
%11 = call i32 @move(i32 %9, i32 %10)
%12 = load i32, i32* @ACS_HLINE
%13 = load i32, i32* %7
%14 = call i32 @hline(i32 %12, i32 %13)
%15 = load i32, i32* %6
%16 = load i32, i32* %5
%17 = load i32, i32* %7
%18 = add nsw i32 %16, %17
%19 = call i32 @move(i32 %15, i32 %18)
%20 = load i32, i32* @ACS_VLINE
%21 = load i32, i32* %8
%22 = call i32 @vline(i32 %20, i32 %21)
%23 = load i32, i32* %6
%24 = load i32, i32* %5
%25 = call i32 @move(i32 %23, i32 %24)
%26 = load i32, i32* @ACS_VLINE
%27 = load i32, i32* %8
%28 = call i32 @vline(i32 %26, i32 %27)
%29 = load i32, i32* %6
%30 = load i32, i32* %8
%31 = add nsw i32 %29, %30
%32 = load i32, i32* %5
%33 = call i32 @move(i32 %31, i32 %32)
%34 = load i32, i32* @ACS_HLINE
%35 = load i32, i32* %7
%36 = call i32 @hline(i32 %34, i32 %35)
%37 = load i32, i32* %6
%38 = load i32, i32* %5
%39 = call i32 @move(i32 %37, i32 %38)
%40 = load i32, i32* @ACS_ULCORNER
%41 = call i32 @addch(i32 %40)
%42 = load i32, i32* %6
%43 = load i32, i32* %5
%44 = load i32, i32* %7
%45 = add nsw i32 %43, %44
%46 = call i32 @move(i32 %42, i32 %45)
%47 = load i32, i32* @ACS_URCORNER
%48 = call i32 @addch(i32 %47)
%49 = load i32, i32* %6
%50 = load i32, i32* %8
%51 = add nsw i32 %49, %50
%52 = load i32, i32* %5
%53 = call i32 @move(i32 %51, i32 %52)
%54 = load i32, i32* @ACS_LLCORNER
%55 = call i32 @addch(i32 %54)
%56 = load i32, i32* %6
%57 = load i32, i32* %8
%58 = add nsw i32 %56, %57
%59 = load i32, i32* %5
%60 = load i32, i32* %7
%61 = add nsw i32 %59, %60
%62 = call i32 @move(i32 %58, i32 %61)
%63 = load i32, i32* @ACS_LRCORNER
%64 = call i32 @addch(i32 %63)
ret void
}

LLVM IR (-O2):
@ACS_HLINE = global i32 0
@ACS_VLINE = global i32 0
@ACS_ULCORNER = global i32 0
@ACS_URCORNER = global i32 0
@ACS_LLCORNER = global i32 0
@ACS_LRCORNER = global i32 0
define void @draw_box(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @move(i32 %1, i32 %0)
%6 = load i32, i32* @ACS_HLINE
%7 = tail call i32 @hline(i32 %6, i32 %2)
%8 = add nsw i32 %2, %0
%9 = tail call i32 @move(i32 %1, i32 %8)
%10 = load i32, i32* @ACS_VLINE
%11 = tail call i32 @vline(i32 %10, i32 %3)
%12 = tail call i32 @move(i32 %1, i32 %0)
%13 = load i32, i32* @ACS_VLINE
%14 = tail call i32 @vline(i32 %13, i32 %3)
%15 = add nsw i32 %3, %1
%16 = tail call i32 @move(i32 %15, i32 %0)
%17 = load i32, i32* @ACS_HLINE
%18 = tail call i32 @hline(i32 %17, i32 %2)
%19 = tail call i32 @move(i32 %1, i32 %0)
%20 = load i32, i32* @ACS_ULCORNER
%21 = tail call i32 @addch(i32 %20)
%22 = tail call i32 @move(i32 %1, i32 %8)
%23 = load i32, i32* @ACS_URCORNER
%24 = tail call i32 @addch(i32 %23)
%25 = tail call i32 @move(i32 %15, i32 %0)
%26 = load i32, i32* @ACS_LLCORNER
%27 = tail call i32 @addch(i32 %26)
%28 = tail call i32 @move(i32 %15, i32 %8)
%29 = load i32, i32* @ACS_LRCORNER
%30 = tail call i32 @addch(i32 %29)
ret void
}