#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*/ addch(char);
int /*<<< orphan*/ addstr(char *);
int /*<<< orphan*/ draw_symbol(int, int, char);
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ refresh();
void display(int cx, int cy, char (*row_ptr)[40 + 1], long score) {
  int x, y = 0, x_coord, y_coord;
  char ch;
  while (y < (cy - 3)) {
    y++;
    row_ptr++;
  };
  move(0, 0);
  addstr("+---------------------------------+");
  move(15, 0);
  addstr("+---------------------------------+");
  for (y = (cy - 3); y <= (cy + 3); y++) {
    y_coord = (y + 3 - cy) * 2;
    if ((y < 0) || (y >= 16)) {
      move(y_coord + 1, 0);
      addstr("|#################################|");
      move(y_coord + 2, 0);
      addstr("|#################################|");
    } else {
      move(y_coord + 1, 0);
      addch('|');
      move(y_coord + 1, 34);
      addch('|');
      move(y_coord + 2, 0);
      addch('|');
      move(y_coord + 2, 34);
      addch('|');
      for (x = (cx - 5); x <= (cx + 5); x++) {
        x_coord = (x + 5 - cx) * 3;
        if ((x < 0) || (x > 40 - 1))
          draw_symbol(x_coord, y_coord, '#');
        else {
          ch = (*row_ptr)[x];
          draw_symbol(x_coord, y_coord, ch);
        }
      };
      row_ptr++;
    }
  }
  move(16, 0);
  refresh();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    1198 <display+0x48>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x29,%rax
mov    %rax,-0x10(%rbp)
jmp    116d <display+0x1d>
xor    %esi,%esi
mov    %esi,%edi
call   1070 <move@plt>
lea    0xe58(%rip),%rdi
call   1060 <addstr@plt>
mov    $0xf,%edi
xor    %esi,%esi
call   1070 <move@plt>
lea    0xe40(%rip),%rdi
call   1060 <addstr@plt>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x3,%ecx
cmp    %ecx,%eax
jg     133c <display+0x1ec>
mov    -0x20(%rbp),%eax
add    $0x3,%eax
sub    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     1202 <display+0xb2>
cmpl   $0x10,-0x20(%rbp)
jl     1239 <display+0xe9>
mov    -0x28(%rbp),%edi
add    $0x1,%edi
xor    %esi,%esi
call   1070 <move@plt>
lea    0xe0e(%rip),%rdi
call   1060 <addstr@plt>
mov    -0x28(%rbp),%edi
add    $0x2,%edi
xor    %esi,%esi
call   1070 <move@plt>
lea    0xdf5(%rip),%rdi
call   1060 <addstr@plt>
jmp    1329 <display+0x1d9>
mov    -0x28(%rbp),%edi
add    $0x1,%edi
xor    %esi,%esi
call   1070 <move@plt>
mov    $0x7c,%edi
call   1040 <addch@plt>
mov    -0x28(%rbp),%edi
add    $0x1,%edi
mov    $0x22,%esi
call   1070 <move@plt>
mov    $0x7c,%edi
call   1040 <addch@plt>
mov    -0x28(%rbp),%edi
add    $0x2,%edi
xor    %esi,%esi
call   1070 <move@plt>
mov    $0x7c,%edi
call   1040 <addch@plt>
mov    -0x28(%rbp),%edi
add    $0x2,%edi
mov    $0x22,%esi
call   1070 <move@plt>
mov    $0x7c,%edi
call   1040 <addch@plt>
mov    -0x4(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x5,%ecx
cmp    %ecx,%eax
jg     131d <display+0x1cd>
mov    -0x1c(%rbp),%eax
add    $0x5,%eax
sub    -0x4(%rbp),%eax
imul   $0x3,%eax,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     12d8 <display+0x188>
cmpl   $0x27,-0x1c(%rbp)
jle    12ed <display+0x19d>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    $0x23,%edx
call   1030 <draw_symbol@plt>
jmp    130a <display+0x1ba>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x29(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
movsbl -0x29(%rbp),%edx
call   1030 <draw_symbol@plt>
jmp    130f <display+0x1bf>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12a4 <display+0x154>
mov    -0x10(%rbp),%rax
add    $0x29,%rax
mov    %rax,-0x10(%rbp)
jmp    132e <display+0x1de>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ce <display+0x7e>
mov    $0x10,%edi
xor    %esi,%esi
call   1070 <move@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r13d
mov    %edi,%ebp
lea    -0x3(%r13),%r14d
lea    -0x4(%r13),%eax
cmp    $0x4,%esi
lea    (%rax,%rax,4),%rcx
lea    (%rax,%rcx,8),%rax
lea    0x29(%rdx,%rax,1),%r15
cmovl  %rdx,%r15
xor    %edi,%edi
xor    %esi,%esi
call   1070 <move@plt>
lea    0xe71(%rip),%rbx
mov    %rbx,%rdi
call   1060 <addstr@plt>
mov    $0xf,%edi
xor    %esi,%esi
call   1070 <move@plt>
mov    %rbx,%rdi
mov    %r14,%rbx
call   1060 <addstr@plt>
mov    $0x3,%eax
sub    %r13d,%eax
mov    %rax,0x10(%rsp)
add    $0x3,%r13d
lea    -0x5(%rbp),%eax
lea    0x5(%rbp),%r12d
cmp    %r12d,%eax
cmovg  %eax,%r12d
cmp    %r13d,%ebx
cmovg  %ebx,%r13d
add    $0xfffffffa,%ebp
mov    %rbp,(%rsp)
jmp    11f7 <display+0xa7>
nopl   (%rax)
add    $0x29,%r15
mov    0x8(%rsp),%rbx
lea    0x1(%rbx),%eax
cmp    %r13d,%ebx
mov    %eax,%ebx
je     12dc <display+0x18c>
mov    0x10(%rsp),%rax
lea    (%rax,%rbx,1),%r14d
lea    (%r14,%r14,1),%ebp
add    $0x1,%ebp
add    %r14d,%r14d
mov    %ebp,%edi
xor    %esi,%esi
call   1070 <move@plt>
cmp    $0x10,%ebx
jb     1240 <display+0xf0>
lea    0xe05(%rip),%rbp
mov    %rbp,%rdi
call   1060 <addstr@plt>
add    $0x2,%r14d
mov    %r14d,%edi
xor    %esi,%esi
call   1070 <move@plt>
mov    %rbp,%rdi
call   1060 <addstr@plt>
jmp    11e9 <display+0x99>
nop
mov    %rbx,0x8(%rsp)
mov    $0x7c,%edi
call   1040 <addch@plt>
mov    %ebp,%edi
mov    $0x22,%esi
call   1070 <move@plt>
mov    $0x7c,%edi
call   1040 <addch@plt>
mov    %r13,%rbx
lea    0x2(%r14),%r13d
xor    %ebp,%ebp
mov    %r13d,%edi
xor    %esi,%esi
call   1070 <move@plt>
mov    $0x7c,%edi
call   1040 <addch@plt>
mov    %r13d,%edi
mov    %rbx,%r13
mov    $0x22,%esi
call   1070 <move@plt>
mov    $0x7c,%edi
call   1040 <addch@plt>
mov    (%rsp),%rax
mov    %eax,%ebx
jmp    12c9 <display+0x179>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edx
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <draw_symbol@plt>
add    $0x3,%ebp
cmp    %ebx,%r12d
je     11e0 <display+0x90>
add    $0x1,%ebx
mov    $0x23,%al
cmp    $0x27,%ebx
ja     12b0 <display+0x160>
mov    %ebx,%eax
movzbl (%r15,%rax,1),%eax
jmp    12b0 <display+0x160>
mov    $0x10,%edi
xor    %esi,%esi
call   1070 <move@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <refresh@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"+---------------------------------+\00"
@.str.1 = [36 x i8] c"|#################################|\00"
define void @display(i32 %0, i32 %1, [41 x i8]* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca [41 x i8]*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store [41 x i8]* %2, [41 x i8]** %7
store i64 %3, i64* %8
store i32 0, i32* %10
br label %14
14: ; preds = %19, %4
%15 = load i32, i32* %10
%16 = load i32, i32* %6
%17 = sub nsw i32 %16, 3
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load i32, i32* %10
%21 = add nsw i32 %20, 1
store i32 %21, i32* %10
%22 = load [41 x i8]*, [41 x i8]** %7
%23 = getelementptr inbounds [41 x i8], [41 x i8]* %22, i32 1
store [41 x i8]* %23, [41 x i8]** %7
br label %14
24: ; preds = %14
%25 = call i32 @move(i32 0, i32 0)
%26 = call i32 @addstr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @move(i32 15, i32 0)
%28 = call i32 @addstr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%29 = load i32, i32* %6
%30 = sub nsw i32 %29, 3
store i32 %30, i32* %10
br label %31
31: ; preds = %113, %24
%32 = load i32, i32* %10
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 3
%35 = icmp sle i32 %32, %34
br i1 %35, label %36, label %116
36: ; preds = %31
%37 = load i32, i32* %10
%38 = add nsw i32 %37, 3
%39 = load i32, i32* %6
%40 = sub nsw i32 %38, %39
%41 = mul nsw i32 %40, 2
store i32 %41, i32* %12
%42 = load i32, i32* %10
%43 = icmp slt i32 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %36
%45 = load i32, i32* %10
%46 = icmp sge i32 %45, 16
br i1 %46, label %47, label %56
47: ; preds = %44, %36
%48 = load i32, i32* %12
%49 = add nsw i32 %48, 1
%50 = call i32 @move(i32 %49, i32 0)
%51 = call i32 @addstr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%52 = load i32, i32* %12
%53 = add nsw i32 %52, 2
%54 = call i32 @move(i32 %53, i32 0)
%55 = call i32 @addstr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
br label %112
56: ; preds = %44
%57 = load i32, i32* %12
%58 = add nsw i32 %57, 1
%59 = call i32 @move(i32 %58, i32 0)
%60 = call i32 @addch(i8 signext 124)
%61 = load i32, i32* %12
%62 = add nsw i32 %61, 1
%63 = call i32 @move(i32 %62, i32 34)
%64 = call i32 @addch(i8 signext 124)
%65 = load i32, i32* %12
%66 = add nsw i32 %65, 2
%67 = call i32 @move(i32 %66, i32 0)
%68 = call i32 @addch(i8 signext 124)
%69 = load i32, i32* %12
%70 = add nsw i32 %69, 2
%71 = call i32 @move(i32 %70, i32 34)
%72 = call i32 @addch(i8 signext 124)
%73 = load i32, i32* %5
%74 = sub nsw i32 %73, 5
store i32 %74, i32* %9
br label %75
75: ; preds = %106, %56
%76 = load i32, i32* %9
%77 = load i32, i32* %5
%78 = add nsw i32 %77, 5
%79 = icmp sle i32 %76, %78
br i1 %79, label %80, label %109
80: ; preds = %75
%81 = load i32, i32* %9
%82 = add nsw i32 %81, 5
%83 = load i32, i32* %5
%84 = sub nsw i32 %82, %83
%85 = mul nsw i32 %84, 3
store i32 %85, i32* %11
%86 = load i32, i32* %9
%87 = icmp slt i32 %86, 0
br i1 %87, label %91, label %88
88: ; preds = %80
%89 = load i32, i32* %9
%90 = icmp sgt i32 %89, 39
br i1 %90, label %91, label %95
91: ; preds = %88, %80
%92 = load i32, i32* %11
%93 = load i32, i32* %12
%94 = call i32 @draw_symbol(i32 %92, i32 %93, i8 signext 35)
br label %105
95: ; preds = %88
%96 = load [41 x i8]*, [41 x i8]** %7
%97 = load i32, i32* %9
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [41 x i8], [41 x i8]* %96, i64 0, i64 %98
%100 = load i8, i8* %99
store i8 %100, i8* %13
%101 = load i32, i32* %11
%102 = load i32, i32* %12
%103 = load i8, i8* %13
%104 = call i32 @draw_symbol(i32 %101, i32 %102, i8 signext %103)
br label %105
105: ; preds = %95, %91
br label %106
106: ; preds = %105
%107 = load i32, i32* %9
%108 = add nsw i32 %107, 1
store i32 %108, i32* %9
br label %75
109: ; preds = %75
%110 = load [41 x i8]*, [41 x i8]** %7
%111 = getelementptr inbounds [41 x i8], [41 x i8]* %110, i32 1
store [41 x i8]* %111, [41 x i8]** %7
br label %112
112: ; preds = %109, %47
br label %113
113: ; preds = %112
%114 = load i32, i32* %10
%115 = add nsw i32 %114, 1
store i32 %115, i32* %10
br label %31
116: ; preds = %31
%117 = call i32 @move(i32 16, i32 0)
%118 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"+---------------------------------+\00"
@.str.1 = [36 x i8] c"|#################################|\00"
define void @display(i32 %0, i32 %1, [41 x i8]* nocapture %2, i64 %3) {
%5 = add i32 %1, -3
%6 = icmp sgt i32 %1, 3
%7 = add nsw i32 %1, -4
%8 = zext i32 %7 to i64
%9 = add nuw nsw i64 %8, 1
%10 = getelementptr [41 x i8], [41 x i8]* %2, i64 %9, i64 0
%11 = bitcast i8* %10 to [41 x i8]*
%12 = select i1 %6, [41 x i8]* %11, [41 x i8]* %2
%13 = tail call i32 @move(i32 0, i32 0)
%14 = tail call i32 @addstr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @move(i32 15, i32 0)
%16 = tail call i32 @addstr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%17 = add i32 %1, 3
%18 = sub i32 3, %1
%19 = add i32 %0, -5
%20 = add i32 %0, 5
%21 = sub i32 5, %0
%22 = call i32 @llvm.smax.i32(i32 %19, i32 %20)
%23 = call i32 @llvm.smax.i32(i32 %5, i32 %17)
br label %24
24: ; preds = %4, %62
%25 = phi [41 x i8]* [ %12, %4 ], [ %63, %62 ]
%26 = phi i32 [ %5, %4 ], [ %64, %62 ]
%27 = add i32 %18, %26
%28 = shl nsw i32 %27, 1
%29 = icmp ugt i32 %26, 15
%30 = or i32 %28, 1
%31 = tail call i32 @move(i32 %30, i32 0)
br i1 %29, label %32, label %37
32: ; preds = %24
%33 = tail call i32 @addstr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%34 = add nuw nsw i32 %28, 2
%35 = tail call i32 @move(i32 %34, i32 0)
%36 = tail call i32 @addstr(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
br label %62
37: ; preds = %24
%38 = tail call i32 @addch(i8 signext 124)
%39 = tail call i32 @move(i32 %30, i32 34)
%40 = tail call i32 @addch(i8 signext 124)
%41 = add nuw nsw i32 %28, 2
%42 = tail call i32 @move(i32 %41, i32 0)
%43 = tail call i32 @addch(i8 signext 124)
%44 = tail call i32 @move(i32 %41, i32 34)
%45 = tail call i32 @addch(i8 signext 124)
br label %46
46: ; preds = %37, %55
%47 = phi i32 [ %19, %37 ], [ %58, %55 ]
%48 = add i32 %21, %47
%49 = mul nuw nsw i32 %48, 3
%50 = icmp ugt i32 %47, 39
br i1 %50, label %55, label %51
51: ; preds = %46
%52 = zext i32 %47 to i64
%53 = getelementptr inbounds [41 x i8], [41 x i8]* %25, i64 0, i64 %52
%54 = load i8, i8* %53
br label %55
55: ; preds = %46, %51
%56 = phi i8 [ %54, %51 ], [ 35, %46 ]
%57 = tail call i32 @draw_symbol(i32 %49, i32 %28, i8 signext %56)
%58 = add i32 %47, 1
%59 = icmp eq i32 %47, %22
br i1 %59, label %60, label %46
60: ; preds = %55
%61 = getelementptr inbounds [41 x i8], [41 x i8]* %25, i64 1
br label %62
62: ; preds = %32, %60
%63 = phi [41 x i8]* [ %25, %32 ], [ %61, %60 ]
%64 = add i32 %26, 1
%65 = icmp eq i32 %26, %23
br i1 %65, label %66, label %24
66: ; preds = %62
%67 = tail call i32 @move(i32 16, i32 0)
%68 = tail call i32 (...) @refresh()
ret void
}