#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*/ gotoxy(int, int);
int /*<<< orphan*/ printf(char *, char *);
void printScreenBorder(int width, int height) {
  char line[width + 1];
  char noline[width + 1];
  int i;
  line[0] = '|';
  noline[0] = '|';
  line[width - 1] = '|';
  noline[width - 1] = '|';
  line[width] = 0;
  noline[width] = 0;
  for (i = 1; i < width - 1; i++) {
    line[i] = '-';
    noline[i] = ' ';
  }
  gotoxy(1, 1);
  printf("%s", line);
  for (i = 2; i < 5; i++) {
    gotoxy(1, i);
    printf("%s", noline);
  }
  gotoxy(1, 5);
  printf("%s", line);
  for (i = 6; i < height; i++) {
    gotoxy(1, i);
    printf("%s", noline);
  }
  gotoxy(1, height);
  printf("%s", line);
}


x86 assembly (clang, -O0):
<printScreenBorder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,%edx
mov    %rdx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rax
sub    %rsi,%rax
mov    %rax,-0x30(%rbp)
mov    %rax,%rsp
mov    %rdx,-0x20(%rbp)
movb   $0x7c,(%rcx)
movb   $0x7c,(%rax)
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movb   $0x7c,(%rcx,%rdx,1)
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movb   $0x7c,(%rax,%rdx,1)
movslq -0x4(%rbp),%rdx
movb   $0x0,(%rcx,%rdx,1)
movslq -0x4(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11e9 <printScreenBorder+0xc9>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
movslq -0x24(%rbp),%rdx
movb   $0x2d,(%rcx,%rdx,1)
movslq -0x24(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b2 <printScreenBorder+0x92>
mov    $0x1,%esi
mov    %esi,%edi
call   1040 <gotoxy@plt>
mov    -0x38(%rbp),%rsi
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
movl   $0x2,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1241 <printScreenBorder+0x121>
mov    -0x24(%rbp),%esi
mov    $0x1,%edi
call   1040 <gotoxy@plt>
mov    -0x30(%rbp),%rsi
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    120c <printScreenBorder+0xec>
mov    $0x1,%edi
mov    $0x5,%esi
call   1040 <gotoxy@plt>
mov    -0x38(%rbp),%rsi
lea    0xda5(%rip),%rdi
call   1030 <printf@plt>
movl   $0x6,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    129e <printScreenBorder+0x17e>
mov    -0x24(%rbp),%esi
mov    $0x1,%edi
call   1040 <gotoxy@plt>
mov    -0x30(%rbp),%rsi
lea    0xd75(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1267 <printScreenBorder+0x147>
mov    -0x8(%rbp),%esi
mov    $0x1,%edi
call   1040 <gotoxy@plt>
mov    -0x38(%rbp),%rsi
lea    0xd4a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printScreenBorder>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,%r12d
lea    0x1(%r12),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
movb   $0x7c,(%r14)
movb   $0x7c,0x0(%r13)
movslq %edi,%rax
movb   $0x7c,-0x1(%r14,%rax,1)
movb   $0x7c,-0x1(%r13,%rax,1)
movb   $0x0,(%r14,%rax,1)
movb   $0x0,0x0(%r13,%rax,1)
cmp    $0x3,%eax
jl     11b1 <printScreenBorder+0x81>
lea    0x1(%r14),%rdi
add    $0xfffffffe,%r12d
mov    $0x2d,%esi
mov    %r12,%rdx
call   1040 <memset@plt>
lea    0x1(%r13),%rdi
mov    $0x20,%esi
mov    %r12,%rdx
call   1040 <memset@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <gotoxy@plt>
lea    0xe39(%rip),%r12
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1050 <gotoxy@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
mov    $0x3,%esi
call   1050 <gotoxy@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
mov    $0x4,%esi
call   1050 <gotoxy@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
mov    $0x5,%esi
call   1050 <gotoxy@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
cmp    $0x7,%r15d
jl     126f <printScreenBorder+0x13f>
mov    $0x6,%ebx
lea    0xdb4(%rip),%r12
nopl   0x0(%rax)
mov    $0x1,%edi
mov    %ebx,%esi
call   1050 <gotoxy@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%r15d
jne    1250 <printScreenBorder+0x120>
mov    $0x1,%edi
mov    %r15d,%esi
call   1050 <gotoxy@plt>
lea    0xd7d(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @printScreenBorder(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i8, i64 %11
store i64 %11, i64* %6
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
%16 = zext i32 %15 to i64
%17 = alloca i8, i64 %16
store i64 %16, i64* %7
%18 = getelementptr inbounds i8, i8* %13, i64 0
store i8 124, i8* %18
%19 = getelementptr inbounds i8, i8* %17, i64 0
store i8 124, i8* %19
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %13, i64 %22
store i8 124, i8* %23
%24 = load i32, i32* %3
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %17, i64 %26
store i8 124, i8* %27
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %13, i64 %29
store i8 0, i8* %30
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %17, i64 %32
store i8 0, i8* %33
store i32 1, i32* %8
br label %34
34: ; preds = %46, %2
%35 = load i32, i32* %8
%36 = load i32, i32* %3
%37 = sub nsw i32 %36, 1
%38 = icmp slt i32 %35, %37
br i1 %38, label %39, label %49
39: ; preds = %34
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %13, i64 %41
store i8 45, i8* %42
%43 = load i32, i32* %8
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %17, i64 %44
store i8 32, i8* %45
br label %46
46: ; preds = %39
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
br label %34
49: ; preds = %34
%50 = call i32 @gotoxy(i32 1, i32 1)
%51 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 2, i32* %8
br label %52
52: ; preds = %59, %49
%53 = load i32, i32* %8
%54 = icmp slt i32 %53, 5
br i1 %54, label %55, label %62
55: ; preds = %52
%56 = load i32, i32* %8
%57 = call i32 @gotoxy(i32 1, i32 %56)
%58 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %59
59: ; preds = %55
%60 = load i32, i32* %8
%61 = add nsw i32 %60, 1
store i32 %61, i32* %8
br label %52
62: ; preds = %52
%63 = call i32 @gotoxy(i32 1, i32 5)
%64 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 6, i32* %8
br label %65
65: ; preds = %73, %62
%66 = load i32, i32* %8
%67 = load i32, i32* %4
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %76
69: ; preds = %65
%70 = load i32, i32* %8
%71 = call i32 @gotoxy(i32 1, i32 %70)
%72 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %73
73: ; preds = %69
%74 = load i32, i32* %8
%75 = add nsw i32 %74, 1
store i32 %75, i32* %8
br label %65
76: ; preds = %65
%77 = load i32, i32* %4
%78 = call i32 @gotoxy(i32 1, i32 %77)
%79 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
%80 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @printScreenBorder(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 1
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = alloca i8, i64 %4
store i8 124, i8* %5
store i8 124, i8* %6
%7 = add nsw i32 %0, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
store i8 124, i8* %9
%10 = getelementptr inbounds i8, i8* %6, i64 %8
store i8 124, i8* %10
%11 = sext i32 %0 to i64
%12 = getelementptr inbounds i8, i8* %5, i64 %11
store i8 0, i8* %12
%13 = getelementptr inbounds i8, i8* %6, i64 %11
store i8 0, i8* %13
%14 = icmp sgt i32 %0, 2
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = getelementptr inbounds i8, i8* %5, i64 1
%17 = add nsw i32 %0, -2
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %6, i64 1
br label %20
20: ; preds = %15, %2
%21 = tail call i32 @gotoxy(i32 1, i32 1)
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%23 = call i32 @gotoxy(i32 1, i32 2)
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%25 = call i32 @gotoxy(i32 1, i32 3)
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%27 = call i32 @gotoxy(i32 1, i32 4)
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%29 = call i32 @gotoxy(i32 1, i32 5)
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%31 = icmp sgt i32 %1, 6
br i1 %31, label %32, label %38
32: ; preds = %20, %32
%33 = phi i32 [ %36, %32 ], [ 6, %20 ]
%34 = call i32 @gotoxy(i32 1, i32 %33)
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%36 = add nuw nsw i32 %33, 1
%37 = icmp eq i32 %36, %1
br i1 %37, label %38, label %32
38: ; preds = %32, %20
%39 = call i32 @gotoxy(i32 1, i32 %1)
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}