#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*/ pokech(int, int, int, int);
void box(int toprow, int leftcolumn, int bottomrow, int rightcolumn,
         int color) {
  int saved_rightcolumn = rightcolumn;
  pokech(bottomrow, rightcolumn, 217, color);
  pokech(toprow, rightcolumn, 191, color);
  pokech(bottomrow, leftcolumn, 192, color);
  pokech(toprow, leftcolumn, 218, color);
  while (--rightcolumn > leftcolumn) {
    pokech(bottomrow, rightcolumn, 196, color);
    pokech(toprow, rightcolumn, 196, color);
  }
  rightcolumn = saved_rightcolumn;
  while (--bottomrow > toprow) {
    pokech(bottomrow, leftcolumn, 179, color);
    pokech(bottomrow, rightcolumn, 179, color);
  }
}


x86 assembly (clang, -O0):
<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    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%ecx
mov    $0xd9,%edx
call   1030 <pokech@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%ecx
mov    $0xbf,%edx
call   1030 <pokech@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%ecx
mov    $0xc0,%edx
call   1030 <pokech@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%ecx
mov    $0xda,%edx
call   1030 <pokech@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    -0x8(%rbp),%eax
jle    11b7 <box+0xa7>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%ecx
mov    $0xc4,%edx
call   1030 <pokech@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%ecx
mov    $0xc4,%edx
call   1030 <pokech@plt>
jmp    117a <box+0x6a>
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmp    -0x4(%rbp),%eax
jle    11fa <box+0xea>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%ecx
mov    $0xb3,%edx
call   1030 <pokech@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%ecx
mov    $0xb3,%edx
call   1030 <pokech@plt>
jmp    11bd <box+0xad>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<box>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r13d
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r15d
mov    %edi,%r12d
mov    %edx,%edi
mov    %ecx,%esi
mov    $0xd9,%edx
mov    %r8d,%ecx
call   1030 <pokech@plt>
mov    %r12d,%edi
mov    %r14d,%esi
mov    $0xbf,%edx
mov    %r13d,%ecx
call   1030 <pokech@plt>
mov    %ebp,%edi
mov    %r15d,%esi
mov    $0xc0,%edx
mov    %r13d,%ecx
call   1030 <pokech@plt>
mov    %r12d,%edi
mov    %r15d,%esi
mov    $0xda,%edx
mov    %r13d,%ecx
call   1030 <pokech@plt>
lea    -0x1(%r14),%ebx
cmp    %r15d,%ebx
jle    11d4 <box+0xc4>
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0xc4,%edx
mov    %r13d,%ecx
call   1030 <pokech@plt>
mov    %r12d,%edi
mov    %ebx,%esi
mov    $0xc4,%edx
mov    %r13d,%ecx
call   1030 <pokech@plt>
add    $0xffffffff,%ebx
cmp    %r15d,%ebx
jg     1180 <box+0x70>
jmp    11d4 <box+0xc4>
nopl   (%rax)
mov    %ebp,%edi
mov    %r15d,%esi
mov    $0xb3,%edx
mov    %r13d,%ecx
call   1030 <pokech@plt>
mov    %ebp,%edi
mov    %r14d,%esi
mov    $0xb3,%edx
mov    %r13d,%ecx
call   1030 <pokech@plt>
add    $0xffffffff,%ebp
cmp    %r12d,%ebp
jg     11b0 <box+0xa0>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @box(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
%11 = 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
%12 = load i32, i32* %9
store i32 %12, i32* %11
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32 @pokech(i32 %13, i32 %14, i32 217, i32 %15)
%17 = load i32, i32* %6
%18 = load i32, i32* %9
%19 = load i32, i32* %10
%20 = call i32 @pokech(i32 %17, i32 %18, i32 191, i32 %19)
%21 = load i32, i32* %8
%22 = load i32, i32* %7
%23 = load i32, i32* %10
%24 = call i32 @pokech(i32 %21, i32 %22, i32 192, i32 %23)
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = load i32, i32* %10
%28 = call i32 @pokech(i32 %25, i32 %26, i32 218, i32 %27)
br label %29
29: ; preds = %34, %5
%30 = load i32, i32* %9
%31 = add nsw i32 %30, -1
store i32 %31, i32* %9
%32 = load i32, i32* %7
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %43
34: ; preds = %29
%35 = load i32, i32* %8
%36 = load i32, i32* %9
%37 = load i32, i32* %10
%38 = call i32 @pokech(i32 %35, i32 %36, i32 196, i32 %37)
%39 = load i32, i32* %6
%40 = load i32, i32* %9
%41 = load i32, i32* %10
%42 = call i32 @pokech(i32 %39, i32 %40, i32 196, i32 %41)
br label %29
43: ; preds = %29
%44 = load i32, i32* %11
store i32 %44, i32* %9
br label %45
45: ; preds = %50, %43
%46 = load i32, i32* %8
%47 = add nsw i32 %46, -1
store i32 %47, i32* %8
%48 = load i32, i32* %6
%49 = icmp sgt i32 %47, %48
br i1 %49, label %50, label %59
50: ; preds = %45
%51 = load i32, i32* %8
%52 = load i32, i32* %7
%53 = load i32, i32* %10
%54 = call i32 @pokech(i32 %51, i32 %52, i32 179, i32 %53)
%55 = load i32, i32* %8
%56 = load i32, i32* %9
%57 = load i32, i32* %10
%58 = call i32 @pokech(i32 %55, i32 %56, i32 179, i32 %57)
br label %45
59: ; preds = %45
ret void
}

LLVM IR (-O2):
define void @box(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @pokech(i32 %2, i32 %3, i32 217, i32 %4)
%7 = tail call i32 @pokech(i32 %0, i32 %3, i32 191, i32 %4)
%8 = tail call i32 @pokech(i32 %2, i32 %1, i32 192, i32 %4)
%9 = tail call i32 @pokech(i32 %0, i32 %1, i32 218, i32 %4)
%10 = add nsw i32 %3, -1
%11 = icmp sgt i32 %10, %1
br i1 %11, label %15, label %12
12: ; preds = %15, %5
%13 = add nsw i32 %2, -1
%14 = icmp sgt i32 %13, %0
br i1 %14, label %21, label %27
15: ; preds = %5, %15
%16 = phi i32 [ %19, %15 ], [ %10, %5 ]
%17 = tail call i32 @pokech(i32 %2, i32 %16, i32 196, i32 %4)
%18 = tail call i32 @pokech(i32 %0, i32 %16, i32 196, i32 %4)
%19 = add nsw i32 %16, -1
%20 = icmp sgt i32 %19, %1
br i1 %20, label %15, label %12
21: ; preds = %12, %21
%22 = phi i32 [ %25, %21 ], [ %13, %12 ]
%23 = tail call i32 @pokech(i32 %22, i32 %1, i32 179, i32 %4)
%24 = tail call i32 @pokech(i32 %22, i32 %3, i32 179, i32 %4)
%25 = add nsw i32 %22, -1
%26 = icmp sgt i32 %25, %0
br i1 %26, label %21, label %27
27: ; preds = %21, %12
ret void
}