#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*/ cprint(int, char, int, char);
int /*<<< orphan*/ gotoxy(char, char, char);
void drawbox(char top, char left, char bot, char right, char attr, char page) {
  char x;
  gotoxy(top, left, page);
  cprint(218, attr, 1, page);
  gotoxy(top, left + 1, page);
  cprint(196, attr, right - left, page);
  gotoxy(top, right, page);
  cprint(191, attr, 1, page);
  gotoxy(bot, left, page);
  cprint(192, attr, 1, page);
  gotoxy(bot, left + 1, page);
  cprint(196, attr, right - left, page);
  gotoxy(bot, right, page);
  cprint(217, attr, 1, page);
  for (x = top + 1; x < bot; x++) {
    gotoxy(x, left, page);
    cprint(179, attr, 1, page);
    gotoxy(x, right, page);
    cprint(179, attr, 1, page);
  }
}


x86 assembly (clang, -O0):
<drawbox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8d,-0x18(%rbp)
mov    %ecx,%eax
mov    -0x18(%rbp),%ecx
mov    %eax,-0x14(%rbp)
mov    %edx,%eax
mov    -0x14(%rbp),%edx
mov    %eax,-0x10(%rbp)
mov    %esi,%eax
mov    -0x10(%rbp),%esi
mov    %eax,-0xc(%rbp)
mov    %edi,%r8d
mov    -0xc(%rbp),%edi
mov    %r9b,%al
mov    %r8b,-0x1(%rbp)
mov    %dil,-0x2(%rbp)
mov    %sil,-0x3(%rbp)
mov    %dl,-0x4(%rbp)
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x2(%rbp),%al
movsbl %cl,%edi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1040 <gotoxy@plt>
mov    -0x5(%rbp),%al
mov    $0xda,%edi
mov    $0x1,%edx
movsbl %al,%esi
movsbl -0x6(%rbp),%ecx
call   1030 <cprint@plt>
mov    -0x1(%rbp),%cl
movsbl -0x2(%rbp),%eax
add    $0x1,%eax
movsbl %cl,%edi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1040 <gotoxy@plt>
mov    -0x5(%rbp),%al
movsbl -0x4(%rbp),%edx
movsbl -0x2(%rbp),%ecx
sub    %ecx,%edx
mov    $0xc4,%edi
movsbl %al,%esi
movsbl -0x6(%rbp),%ecx
call   1030 <cprint@plt>
mov    -0x1(%rbp),%cl
mov    -0x4(%rbp),%al
movsbl %cl,%edi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1040 <gotoxy@plt>
mov    -0x5(%rbp),%al
mov    $0xbf,%edi
mov    $0x1,%edx
movsbl %al,%esi
movsbl -0x6(%rbp),%ecx
call   1030 <cprint@plt>
mov    -0x3(%rbp),%cl
mov    -0x2(%rbp),%al
movsbl %cl,%edi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1040 <gotoxy@plt>
mov    -0x5(%rbp),%al
mov    $0xc0,%edi
mov    $0x1,%edx
movsbl %al,%esi
movsbl -0x6(%rbp),%ecx
call   1030 <cprint@plt>
mov    -0x3(%rbp),%cl
movsbl -0x2(%rbp),%eax
add    $0x1,%eax
movsbl %cl,%edi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1040 <gotoxy@plt>
mov    -0x5(%rbp),%al
movsbl -0x4(%rbp),%edx
movsbl -0x2(%rbp),%ecx
sub    %ecx,%edx
mov    $0xc4,%edi
movsbl %al,%esi
movsbl -0x6(%rbp),%ecx
call   1030 <cprint@plt>
mov    -0x3(%rbp),%cl
mov    -0x4(%rbp),%al
movsbl %cl,%edi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1040 <gotoxy@plt>
mov    -0x5(%rbp),%al
mov    $0xd9,%edi
mov    $0x1,%edx
movsbl %al,%esi
movsbl -0x6(%rbp),%ecx
call   1030 <cprint@plt>
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
movsbl -0x3(%rbp),%ecx
cmp    %ecx,%eax
jge    130b <drawbox+0x1eb>
mov    -0x7(%rbp),%cl
mov    -0x2(%rbp),%al
movsbl %cl,%edi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1040 <gotoxy@plt>
mov    -0x5(%rbp),%al
mov    $0xb3,%edi
mov    $0x1,%edx
movsbl %al,%esi
movsbl -0x6(%rbp),%ecx
call   1030 <cprint@plt>
mov    -0x7(%rbp),%cl
mov    -0x4(%rbp),%al
movsbl %cl,%edi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1040 <gotoxy@plt>
mov    -0x5(%rbp),%al
mov    $0xb3,%edi
mov    $0x1,%edx
movsbl %al,%esi
movsbl -0x6(%rbp),%ecx
call   1030 <cprint@plt>
mov    -0x7(%rbp),%al
add    $0x1,%al
mov    %al,-0x7(%rbp)
jmp    1292 <drawbox+0x172>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawbox>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r15d
mov    %r8d,%ebp
mov    %ecx,%r13d
mov    %edx,%r12d
mov    %esi,%r14d
mov    %edi,%ebx
mov    %r9d,%edx
call   1040 <gotoxy@plt>
mov    $0xda,%edi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %r15d,%ecx
call   1030 <cprint@plt>
lea    0x1(%r14),%eax
movsbl %al,%esi
mov    %esi,0xc(%rsp)
mov    %ebx,%edi
mov    %r15d,%edx
call   1040 <gotoxy@plt>
mov    %r13d,%edx
sub    %r14d,%edx
mov    %edx,0x8(%rsp)
mov    $0xc4,%edi
mov    %ebp,%esi
mov    %r15d,%ecx
call   1030 <cprint@plt>
mov    %ebx,%edi
mov    %r13d,%esi
mov    %r15d,%edx
call   1040 <gotoxy@plt>
mov    $0xbf,%edi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %r15d,%ecx
call   1030 <cprint@plt>
mov    %r12d,%edi
mov    %r14,0x10(%rsp)
mov    %r14d,%esi
mov    %r15d,%edx
call   1040 <gotoxy@plt>
mov    $0xc0,%edi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %r15d,%ecx
call   1030 <cprint@plt>
mov    %r12d,%edi
mov    0xc(%rsp),%esi
mov    %r15d,%edx
call   1040 <gotoxy@plt>
mov    $0xc4,%edi
mov    %ebp,%esi
mov    0x8(%rsp),%edx
mov    %r15d,%ecx
call   1030 <cprint@plt>
mov    %r12d,%edi
mov    %r13d,%esi
mov    %r15d,%edx
call   1040 <gotoxy@plt>
mov    $0xd9,%edi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %r15d,%ecx
call   1030 <cprint@plt>
add    $0x1,%ebx
cmp    %r12b,%bl
jge    127c <drawbox+0x15c>
mov    %ebp,%eax
movsbl 0x10(%rsp),%r14d
movsbl %r15b,%ebp
movsbl %al,%r15d
nopl   (%rax)
movsbl %bl,%ebx
mov    %ebx,%edi
mov    %r14d,%esi
mov    %ebp,%edx
call   1040 <gotoxy@plt>
mov    $0xb3,%edi
mov    %r15d,%esi
mov    $0x1,%edx
mov    %ebp,%ecx
call   1030 <cprint@plt>
movsbl %r13b,%esi
mov    %ebx,%edi
mov    %ebp,%edx
call   1040 <gotoxy@plt>
mov    $0xb3,%edi
mov    %r15d,%esi
mov    $0x1,%edx
mov    %ebp,%ecx
call   1030 <cprint@plt>
add    $0x1,%bl
cmp    %bl,%r12b
jne    1230 <drawbox+0x110>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @drawbox(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3, i8 signext %4, i8 signext %5) {
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
store i8 %0, i8* %7
store i8 %1, i8* %8
store i8 %2, i8* %9
store i8 %3, i8* %10
store i8 %4, i8* %11
store i8 %5, i8* %12
%14 = load i8, i8* %7
%15 = load i8, i8* %8
%16 = load i8, i8* %12
%17 = call i32 @gotoxy(i8 signext %14, i8 signext %15, i8 signext %16)
%18 = load i8, i8* %11
%19 = load i8, i8* %12
%20 = call i32 @cprint(i32 218, i8 signext %18, i32 1, i8 signext %19)
%21 = load i8, i8* %7
%22 = load i8, i8* %8
%23 = sext i8 %22 to i32
%24 = add nsw i32 %23, 1
%25 = trunc i32 %24 to i8
%26 = load i8, i8* %12
%27 = call i32 @gotoxy(i8 signext %21, i8 signext %25, i8 signext %26)
%28 = load i8, i8* %11
%29 = load i8, i8* %10
%30 = sext i8 %29 to i32
%31 = load i8, i8* %8
%32 = sext i8 %31 to i32
%33 = sub nsw i32 %30, %32
%34 = load i8, i8* %12
%35 = call i32 @cprint(i32 196, i8 signext %28, i32 %33, i8 signext %34)
%36 = load i8, i8* %7
%37 = load i8, i8* %10
%38 = load i8, i8* %12
%39 = call i32 @gotoxy(i8 signext %36, i8 signext %37, i8 signext %38)
%40 = load i8, i8* %11
%41 = load i8, i8* %12
%42 = call i32 @cprint(i32 191, i8 signext %40, i32 1, i8 signext %41)
%43 = load i8, i8* %9
%44 = load i8, i8* %8
%45 = load i8, i8* %12
%46 = call i32 @gotoxy(i8 signext %43, i8 signext %44, i8 signext %45)
%47 = load i8, i8* %11
%48 = load i8, i8* %12
%49 = call i32 @cprint(i32 192, i8 signext %47, i32 1, i8 signext %48)
%50 = load i8, i8* %9
%51 = load i8, i8* %8
%52 = sext i8 %51 to i32
%53 = add nsw i32 %52, 1
%54 = trunc i32 %53 to i8
%55 = load i8, i8* %12
%56 = call i32 @gotoxy(i8 signext %50, i8 signext %54, i8 signext %55)
%57 = load i8, i8* %11
%58 = load i8, i8* %10
%59 = sext i8 %58 to i32
%60 = load i8, i8* %8
%61 = sext i8 %60 to i32
%62 = sub nsw i32 %59, %61
%63 = load i8, i8* %12
%64 = call i32 @cprint(i32 196, i8 signext %57, i32 %62, i8 signext %63)
%65 = load i8, i8* %9
%66 = load i8, i8* %10
%67 = load i8, i8* %12
%68 = call i32 @gotoxy(i8 signext %65, i8 signext %66, i8 signext %67)
%69 = load i8, i8* %11
%70 = load i8, i8* %12
%71 = call i32 @cprint(i32 217, i8 signext %69, i32 1, i8 signext %70)
%72 = load i8, i8* %7
%73 = sext i8 %72 to i32
%74 = add nsw i32 %73, 1
%75 = trunc i32 %74 to i8
store i8 %75, i8* %13
br label %76
76: ; preds = %97, %6
%77 = load i8, i8* %13
%78 = sext i8 %77 to i32
%79 = load i8, i8* %9
%80 = sext i8 %79 to i32
%81 = icmp slt i32 %78, %80
br i1 %81, label %82, label %100
82: ; preds = %76
%83 = load i8, i8* %13
%84 = load i8, i8* %8
%85 = load i8, i8* %12
%86 = call i32 @gotoxy(i8 signext %83, i8 signext %84, i8 signext %85)
%87 = load i8, i8* %11
%88 = load i8, i8* %12
%89 = call i32 @cprint(i32 179, i8 signext %87, i32 1, i8 signext %88)
%90 = load i8, i8* %13
%91 = load i8, i8* %10
%92 = load i8, i8* %12
%93 = call i32 @gotoxy(i8 signext %90, i8 signext %91, i8 signext %92)
%94 = load i8, i8* %11
%95 = load i8, i8* %12
%96 = call i32 @cprint(i32 179, i8 signext %94, i32 1, i8 signext %95)
br label %97
97: ; preds = %82
%98 = load i8, i8* %13
%99 = add i8 %98, 1
store i8 %99, i8* %13
br label %76
100: ; preds = %76
ret void
}

LLVM IR (-O2):
define void @drawbox(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3, i8 signext %4, i8 signext %5) {
%7 = tail call i32 @gotoxy(i8 signext %0, i8 signext %1, i8 signext %5)
%8 = tail call i32 @cprint(i32 218, i8 signext %4, i32 1, i8 signext %5)
%9 = sext i8 %1 to i32
%10 = add i8 %1, 1
%11 = tail call i32 @gotoxy(i8 signext %0, i8 signext %10, i8 signext %5)
%12 = sext i8 %3 to i32
%13 = sub nsw i32 %12, %9
%14 = tail call i32 @cprint(i32 196, i8 signext %4, i32 %13, i8 signext %5)
%15 = tail call i32 @gotoxy(i8 signext %0, i8 signext %3, i8 signext %5)
%16 = tail call i32 @cprint(i32 191, i8 signext %4, i32 1, i8 signext %5)
%17 = tail call i32 @gotoxy(i8 signext %2, i8 signext %1, i8 signext %5)
%18 = tail call i32 @cprint(i32 192, i8 signext %4, i32 1, i8 signext %5)
%19 = tail call i32 @gotoxy(i8 signext %2, i8 signext %10, i8 signext %5)
%20 = tail call i32 @cprint(i32 196, i8 signext %4, i32 %13, i8 signext %5)
%21 = tail call i32 @gotoxy(i8 signext %2, i8 signext %3, i8 signext %5)
%22 = tail call i32 @cprint(i32 217, i8 signext %4, i32 1, i8 signext %5)
%23 = add i8 %0, 1
%24 = icmp slt i8 %23, %2
br i1 %24, label %25, label %33
25: ; preds = %6, %25
%26 = phi i8 [ %31, %25 ], [ %23, %6 ]
%27 = tail call i32 @gotoxy(i8 signext %26, i8 signext %1, i8 signext %5)
%28 = tail call i32 @cprint(i32 179, i8 signext %4, i32 1, i8 signext %5)
%29 = tail call i32 @gotoxy(i8 signext %26, i8 signext %3, i8 signext %5)
%30 = tail call i32 @cprint(i32 179, i8 signext %4, i32 1, i8 signext %5)
%31 = add i8 %26, 1
%32 = icmp eq i8 %31, %2
br i1 %32, label %33, label %25
33: ; preds = %25, %6
ret void
}