#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 scalar_t__ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ VT_Move(int, char);
int /*<<< orphan*/ VT_Print(char *);
int /*<<< orphan*/ VT_Transmit(char);
void VT_Draw_Box(uint8_t width, uint8_t height) {
  uint8_t i;
  height -= 2;
  VT_Print("\x1B[s");
  for (i = width; i > 0; i--) {
    VT_Transmit('=');
  }
  VT_Move(1, 'B');
  VT_Move(1, 'D');
  for (i = height; i > 0; i--) {
    VT_Transmit('|');
    VT_Move(1, 'B');
    VT_Move(1, 'D');
  }
  VT_Print("\x1B[u");
  VT_Move(1, 'B');
  for (i = height; i > 0; i--) {
    VT_Transmit('|');
    VT_Move(1, 'B');
    VT_Move(1, 'D');
  }
  for (i = width; i > 0; i--) {
    VT_Transmit('=');
  }
  VT_Print("\x1B[u");
}


x86 assembly (clang, -O0):
<VT_Draw_Box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    $0x2,%rax
mov    %rax,-0x10(%rbp)
lea    0xead(%rip),%rdi
call   1050 <VT_Print@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jle    1186 <VT_Draw_Box+0x56>
mov    $0x3d,%edi
call   1030 <VT_Transmit@plt>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1160 <VT_Draw_Box+0x30>
mov    $0x1,%edi
mov    $0x42,%esi
call   1040 <VT_Move@plt>
mov    $0x1,%edi
mov    $0x44,%esi
call   1040 <VT_Move@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jle    11f0 <VT_Draw_Box+0xc0>
mov    $0x7c,%edi
call   1030 <VT_Transmit@plt>
mov    $0x1,%edi
mov    $0x42,%esi
call   1040 <VT_Move@plt>
mov    $0x1,%edi
mov    $0x44,%esi
call   1040 <VT_Move@plt>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    11ac <VT_Draw_Box+0x7c>
lea    0xe0d(%rip),%rdi
call   1050 <VT_Print@plt>
mov    $0x1,%edi
mov    $0x42,%esi
call   1040 <VT_Move@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jle    1257 <VT_Draw_Box+0x127>
mov    $0x7c,%edi
call   1030 <VT_Transmit@plt>
mov    $0x1,%edi
mov    $0x42,%esi
call   1040 <VT_Move@plt>
mov    $0x1,%edi
mov    $0x44,%esi
call   1040 <VT_Move@plt>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1213 <VT_Draw_Box+0xe3>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jle    1285 <VT_Draw_Box+0x155>
mov    $0x3d,%edi
call   1030 <VT_Transmit@plt>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    125f <VT_Draw_Box+0x12f>
lea    0xd78(%rip),%rdi
call   1050 <VT_Print@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VT_Draw_Box>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xebe(%rip),%rdi
call   1050 <VT_Print@plt>
test   %r15,%r15
jle    1164 <VT_Draw_Box+0x34>
lea    0x1(%r15),%rbx
mov    $0x3d,%edi
call   1030 <VT_Transmit@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1150 <VT_Draw_Box+0x20>
mov    $0x1,%edi
mov    $0x42,%esi
call   1040 <VT_Move@plt>
mov    $0x1,%edi
mov    $0x44,%esi
call   1040 <VT_Move@plt>
cmp    $0x3,%r14
jl     1224 <VT_Draw_Box+0xf4>
lea    -0x1(%r14),%rbx
mov    $0x7c,%edi
call   1030 <VT_Transmit@plt>
mov    $0x1,%edi
mov    $0x42,%esi
call   1040 <VT_Move@plt>
mov    $0x1,%edi
mov    $0x44,%esi
call   1040 <VT_Move@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1190 <VT_Draw_Box+0x60>
lea    0xe3b(%rip),%rdi
call   1050 <VT_Print@plt>
mov    $0x1,%edi
mov    $0x42,%esi
call   1040 <VT_Move@plt>
cmp    $0x3,%r14
jl     123f <VT_Draw_Box+0x10f>
add    $0xffffffffffffffff,%r14
nopw   0x0(%rax,%rax,1)
mov    $0x7c,%edi
call   1030 <VT_Transmit@plt>
mov    $0x1,%edi
mov    $0x42,%esi
call   1040 <VT_Move@plt>
mov    $0x1,%edi
mov    $0x44,%esi
call   1040 <VT_Move@plt>
add    $0xffffffffffffffff,%r14
cmp    $0x1,%r14
ja     11f0 <VT_Draw_Box+0xc0>
jmp    123f <VT_Draw_Box+0x10f>
lea    0xdd9(%rip),%rdi
call   1050 <VT_Print@plt>
mov    $0x1,%edi
mov    $0x42,%esi
call   1040 <VT_Move@plt>
test   %r15,%r15
jle    1264 <VT_Draw_Box+0x134>
add    $0x1,%r15
nopl   0x0(%rax,%rax,1)
mov    $0x3d,%edi
call   1030 <VT_Transmit@plt>
add    $0xffffffffffffffff,%r15
cmp    $0x1,%r15
ja     1250 <VT_Draw_Box+0x120>
lea    0xd99(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <VT_Print@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[s\00"
@.str.1 = [4 x i8] c"\1B[u\00"
define void @VT_Draw_Box(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = sub nsw i64 %6, 2
store i64 %7, i64* %4
%8 = call i32 @VT_Print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = load i64, i64* %3
store i64 %9, i64* %5
br label %10
10: ; preds = %15, %2
%11 = load i64, i64* %5
%12 = icmp sgt i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = call i32 @VT_Transmit(i8 signext 61)
br label %15
15: ; preds = %13
%16 = load i64, i64* %5
%17 = add nsw i64 %16, -1
store i64 %17, i64* %5
br label %10
18: ; preds = %10
%19 = call i32 @VT_Move(i32 1, i8 signext 66)
%20 = call i32 @VT_Move(i32 1, i8 signext 68)
%21 = load i64, i64* %4
store i64 %21, i64* %5
br label %22
22: ; preds = %29, %18
%23 = load i64, i64* %5
%24 = icmp sgt i64 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = call i32 @VT_Transmit(i8 signext 124)
%27 = call i32 @VT_Move(i32 1, i8 signext 66)
%28 = call i32 @VT_Move(i32 1, i8 signext 68)
br label %29
29: ; preds = %25
%30 = load i64, i64* %5
%31 = add nsw i64 %30, -1
store i64 %31, i64* %5
br label %22
32: ; preds = %22
%33 = call i32 @VT_Print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @VT_Move(i32 1, i8 signext 66)
%35 = load i64, i64* %4
store i64 %35, i64* %5
br label %36
36: ; preds = %43, %32
%37 = load i64, i64* %5
%38 = icmp sgt i64 %37, 0
br i1 %38, label %39, label %46
39: ; preds = %36
%40 = call i32 @VT_Transmit(i8 signext 124)
%41 = call i32 @VT_Move(i32 1, i8 signext 66)
%42 = call i32 @VT_Move(i32 1, i8 signext 68)
br label %43
43: ; preds = %39
%44 = load i64, i64* %5
%45 = add nsw i64 %44, -1
store i64 %45, i64* %5
br label %36
46: ; preds = %36
%47 = load i64, i64* %3
store i64 %47, i64* %5
br label %48
48: ; preds = %53, %46
%49 = load i64, i64* %5
%50 = icmp sgt i64 %49, 0
br i1 %50, label %51, label %56
51: ; preds = %48
%52 = call i32 @VT_Transmit(i8 signext 61)
br label %53
53: ; preds = %51
%54 = load i64, i64* %5
%55 = add nsw i64 %54, -1
store i64 %55, i64* %5
br label %48
56: ; preds = %48
%57 = call i32 @VT_Print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[s\00"
@.str.1 = [4 x i8] c"\1B[u\00"
define void @VT_Draw_Box(i64 %0, i64 %1) {
%3 = add nsw i64 %1, -2
%4 = tail call i32 @VT_Print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp sgt i64 %0, 0
br i1 %5, label %6, label %11
6: ; preds = %2, %6
%7 = phi i64 [ %9, %6 ], [ %0, %2 ]
%8 = tail call i32 @VT_Transmit(i8 signext 61)
%9 = add nsw i64 %7, -1
%10 = icmp ugt i64 %7, 1
br i1 %10, label %6, label %11
11: ; preds = %6, %2
%12 = tail call i32 @VT_Move(i32 1, i8 signext 66)
%13 = tail call i32 @VT_Move(i32 1, i8 signext 68)
%14 = icmp sgt i64 %1, 2
br i1 %14, label %15, label %25
15: ; preds = %11, %15
%16 = phi i64 [ %20, %15 ], [ %3, %11 ]
%17 = tail call i32 @VT_Transmit(i8 signext 124)
%18 = tail call i32 @VT_Move(i32 1, i8 signext 66)
%19 = tail call i32 @VT_Move(i32 1, i8 signext 68)
%20 = add nsw i64 %16, -1
%21 = icmp ugt i64 %16, 1
br i1 %21, label %15, label %22
22: ; preds = %15
%23 = tail call i32 @VT_Print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%24 = tail call i32 @VT_Move(i32 1, i8 signext 66)
br i1 %14, label %29, label %28
25: ; preds = %11
%26 = tail call i32 @VT_Print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%27 = tail call i32 @VT_Move(i32 1, i8 signext 66)
br label %28
28: ; preds = %29, %25, %22
br i1 %5, label %36, label %41
29: ; preds = %22, %29
%30 = phi i64 [ %34, %29 ], [ %3, %22 ]
%31 = tail call i32 @VT_Transmit(i8 signext 124)
%32 = tail call i32 @VT_Move(i32 1, i8 signext 66)
%33 = tail call i32 @VT_Move(i32 1, i8 signext 68)
%34 = add nsw i64 %30, -1
%35 = icmp ugt i64 %30, 1
br i1 %35, label %29, label %28
36: ; preds = %28, %36
%37 = phi i64 [ %39, %36 ], [ %0, %28 ]
%38 = tail call i32 @VT_Transmit(i8 signext 61)
%39 = add nsw i64 %37, -1
%40 = icmp ugt i64 %37, 1
br i1 %40, label %36, label %41
41: ; preds = %36, %28
%42 = tail call i32 @VT_Print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}