#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*/ api_boxfilwin(int, int, int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ api_end();
int api_getkey(int);
int /*<<< orphan*/ api_linewin(int, int, int, int, int, int);
int api_openwin(char *, int, int, int, char *);
void HariMain(void) {
  int win, i, j, dis;
  char buf[216 * 237];
  struct POINT {
    int x, y;
  };
  static struct POINT table[16] = {
      {204, 129}, {195, 90},  {172, 58},  {137, 38}, {98, 34},  {61, 46},
      {31, 73},   {15, 110},  {15, 148},  {31, 185}, {61, 212}, {98, 224},
      {137, 220}, {172, 200}, {195, 168}, {204, 129}};
  win = api_openwin(buf, 216, 237, -1, "bball");
  api_boxfilwin(win, 8, 29, 207, 228, 0);
  for (i = 0; i <= 14; i++) {
    for (j = i + 1; j <= 15; j++) {
      dis = j - i;
      if (dis >= 8) {
        dis = 15 - dis;
      }
      if (dis != 0) {
        api_linewin(win, table[i].x, table[i].y, table[j].x, table[j].y,
                    8 - dis);
      }
    }
  }
  for (;;) {
    if (api_getkey(1) == 0x0a) {
      break;
    }
  }
  api_end();
}


x86 assembly (clang, -O0):
<HariMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc810,%rsp
lea    -0xc810(%rbp),%rdi
mov    $0xd8,%esi
mov    $0xed,%edx
mov    $0xffffffff,%ecx
lea    0xe88(%rip),%r8
call   1050 <api_openwin@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
mov    $0x1d,%edx
mov    $0xcf,%ecx
mov    $0xe4,%r8d
xor    %r9d,%r9d
call   1070 <api_boxfilwin@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xe,-0x8(%rbp)
jg     125f <HariMain+0x10f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xf,-0xc(%rbp)
jg     124c <HariMain+0xfc>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jl     11e2 <HariMain+0x92>
mov    $0xf,%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1239 <HariMain+0xe9>
mov    -0x4(%rbp),%edi
movslq -0x8(%rbp),%rcx
lea    0x2e56(%rip),%rax
mov    (%rax,%rcx,8),%esi
movslq -0x8(%rbp),%rcx
lea    0x2e48(%rip),%rax
mov    0x4(%rax,%rcx,8),%edx
movslq -0xc(%rbp),%rcx
lea    0x2e39(%rip),%rax
mov    (%rax,%rcx,8),%ecx
movslq -0xc(%rbp),%r8
lea    0x2e2b(%rip),%rax
mov    0x4(%rax,%r8,8),%r8d
mov    $0x8,%r9d
sub    -0x10(%rbp),%r9d
call   1060 <api_linewin@plt>
jmp    123e <HariMain+0xee>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ba <HariMain+0x6a>
jmp    1251 <HariMain+0x101>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a7 <HariMain+0x57>
jmp    1264 <HariMain+0x114>
mov    $0x1,%edi
call   1040 <api_getkey@plt>
cmp    $0xa,%eax
jne    127c <HariMain+0x12c>
jmp    1281 <HariMain+0x131>
jmp    1264 <HariMain+0x114>
mov    $0x0,%al
call   1030 <api_end@plt>
add    $0xc810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HariMain>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc808,%rsp
lea    0xf18(%rip),%r8
lea    0x10(%rsp),%rdi
mov    $0xd8,%esi
mov    $0xed,%edx
mov    $0xffffffff,%ecx
call   1050 <api_openwin@plt>
mov    %eax,%r15d
xor    %ebp,%ebp
mov    %eax,%edi
mov    $0x8,%esi
mov    $0x1d,%edx
mov    $0xcf,%ecx
mov    $0xe4,%r8d
xor    %r9d,%r9d
call   1070 <api_boxfilwin@plt>
lea    0xe54(%rip),%r12
mov    %r12,%r13
jmp    11cf <HariMain+0x7f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x8,%r13
mov    0x8(%rsp),%rbp
cmp    $0xf,%rbp
je     1240 <HariMain+0xf0>
lea    0x1(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    $0xe,%ebx
mov    $0x1,%r14d
jmp    1205 <HariMain+0xb5>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0xffffffff,%ebx
lea    (%r14,%rbp,1),%rax
add    $0x1,%rax
add    $0x1,%r14
cmp    $0x10,%rax
je     11c0 <HariMain+0x70>
cmp    $0x8,%r14
mov    %r14d,%eax
cmovae %ebx,%eax
test   %eax,%eax
je     11f0 <HariMain+0xa0>
mov    (%r12,%rbp,8),%esi
mov    0x4(%r12,%rbp,8),%edx
mov    0x0(%r13,%r14,8),%ecx
mov    0x4(%r13,%r14,8),%r8d
mov    $0x8,%r9d
sub    %eax,%r9d
mov    %r15d,%edi
call   1060 <api_linewin@plt>
jmp    11f0 <HariMain+0xa0>
nopl   0x0(%rax)
mov    $0x1,%edi
call   1040 <api_getkey@plt>
cmp    $0xa,%eax
jne    1240 <HariMain+0xf0>
xor    %eax,%eax
call   1030 <api_end@plt>
add    $0xc808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.POINT = type { i32, i32 }
@HariMain.table = internal global [16 x %struct.POINT] [%struct.POINT { i32 204, i32 129 }, %struct.POINT { i32 195, i32 90 }, %struct.POINT { i32 172, i32 58 }, %struct.POINT { i32 137, i32 38 }, %struct.POINT { i32 98, i32 34 }, %struct.POINT { i32 61, i32 46 }, %struct.POINT { i32 31, i32 73 }, %struct.POINT { i32 15, i32 110 }, %struct.POINT { i32 15, i32 148 }, %struct.POINT { i32 31, i32 185 }, %struct.POINT { i32 61, i32 212 }, %struct.POINT { i32 98, i32 224 }, %struct.POINT { i32 137, i32 220 }, %struct.POINT { i32 172, i32 200 }, %struct.POINT { i32 195, i32 168 }, %struct.POINT { i32 204, i32 129 }]
@.str = [6 x i8] c"bball\00"
define void @HariMain() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [51192 x i8]
%6 = getelementptr inbounds [51192 x i8], [51192 x i8]* %5, i64 0, i64 0
%7 = call i32 @api_openwin(i8* %6, i32 216, i32 237, i32 -1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %7, i32* %1
%8 = load i32, i32* %1
%9 = call i32 @api_boxfilwin(i32 %8, i32 8, i32 29, i32 207, i32 228, i32 0)
store i32 0, i32* %2
br label %10
10: ; preds = %61, %0
%11 = load i32, i32* %2
%12 = icmp sle i32 %11, 14
br i1 %12, label %13, label %64
13: ; preds = %10
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %16
16: ; preds = %57, %13
%17 = load i32, i32* %3
%18 = icmp sle i32 %17, 15
br i1 %18, label %19, label %60
19: ; preds = %16
%20 = load i32, i32* %3
%21 = load i32, i32* %2
%22 = sub nsw i32 %20, %21
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = icmp sge i32 %23, 8
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = load i32, i32* %4
%27 = sub nsw i32 15, %26
store i32 %27, i32* %4
br label %28
28: ; preds = %25, %19
%29 = load i32, i32* %4
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %56
31: ; preds = %28
%32 = load i32, i32* %1
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [16 x %struct.POINT], [16 x %struct.POINT]* @HariMain.table, i64 0, i64 %34
%36 = getelementptr inbounds %struct.POINT, %struct.POINT* %35, i32 0, i32 0
%37 = load i32, i32* %36
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [16 x %struct.POINT], [16 x %struct.POINT]* @HariMain.table, i64 0, i64 %39
%41 = getelementptr inbounds %struct.POINT, %struct.POINT* %40, i32 0, i32 1
%42 = load i32, i32* %41
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [16 x %struct.POINT], [16 x %struct.POINT]* @HariMain.table, i64 0, i64 %44
%46 = getelementptr inbounds %struct.POINT, %struct.POINT* %45, i32 0, i32 0
%47 = load i32, i32* %46
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [16 x %struct.POINT], [16 x %struct.POINT]* @HariMain.table, i64 0, i64 %49
%51 = getelementptr inbounds %struct.POINT, %struct.POINT* %50, i32 0, i32 1
%52 = load i32, i32* %51
%53 = load i32, i32* %4
%54 = sub nsw i32 8, %53
%55 = call i32 @api_linewin(i32 %32, i32 %37, i32 %42, i32 %47, i32 %52, i32 %54)
br label %56
56: ; preds = %31, %28
br label %57
57: ; preds = %56
%58 = load i32, i32* %3
%59 = add nsw i32 %58, 1
store i32 %59, i32* %3
br label %16
60: ; preds = %16
br label %61
61: ; preds = %60
%62 = load i32, i32* %2
%63 = add nsw i32 %62, 1
store i32 %63, i32* %2
br label %10
64: ; preds = %10
br label %65
65: ; preds = %69, %64
%66 = call i32 @api_getkey(i32 1)
%67 = icmp eq i32 %66, 10
br i1 %67, label %68, label %69
68: ; preds = %65
br label %70
69: ; preds = %65
br label %65
70: ; preds = %68
%71 = call i32 (...) @api_end()
ret void
}

LLVM IR (-O2):
%struct.POINT = type { i32, i32 }
@HariMain.table = internal unnamed_addr constant [16 x %struct.POINT] [%struct.POINT { i32 204, i32 129 }, %struct.POINT { i32 195, i32 90 }, %struct.POINT { i32 172, i32 58 }, %struct.POINT { i32 137, i32 38 }, %struct.POINT { i32 98, i32 34 }, %struct.POINT { i32 61, i32 46 }, %struct.POINT { i32 31, i32 73 }, %struct.POINT { i32 15, i32 110 }, %struct.POINT { i32 15, i32 148 }, %struct.POINT { i32 31, i32 185 }, %struct.POINT { i32 61, i32 212 }, %struct.POINT { i32 98, i32 224 }, %struct.POINT { i32 137, i32 220 }, %struct.POINT { i32 172, i32 200 }, %struct.POINT { i32 195, i32 168 }, %struct.POINT { i32 204, i32 129 }]
@.str = [6 x i8] c"bball\00"
define void @HariMain() {
%1 = alloca [51192 x i8]
%2 = getelementptr inbounds [51192 x i8], [51192 x i8]* %1, i64 0, i64 0
%3 = call i32 @api_openwin(i8* %2, i32 216, i32 237, i32 -1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @api_boxfilwin(i32 %3, i32 8, i32 29, i32 207, i32 228, i32 0)
br label %8
5: ; preds = %34
%6 = add nuw nsw i64 %10, 1
%7 = icmp eq i64 %11, 15
br i1 %7, label %37, label %8
8: ; preds = %5, %0
%9 = phi i64 [ 0, %0 ], [ %11, %5 ]
%10 = phi i64 [ 1, %0 ], [ %6, %5 ]
%11 = add nuw nsw i64 %9, 1
%12 = getelementptr inbounds [16 x %struct.POINT], [16 x %struct.POINT]* @HariMain.table, i64 0, i64 %9, i32 0
%13 = getelementptr inbounds [16 x %struct.POINT], [16 x %struct.POINT]* @HariMain.table, i64 0, i64 %9, i32 1
%14 = trunc i64 %9 to i32
br label %15
15: ; preds = %8, %34
%16 = phi i64 [ %10, %8 ], [ %35, %34 ]
%17 = trunc i64 %16 to i32
%18 = sub nuw nsw i64 %16, %9
%19 = sub i32 %14, %17
%20 = icmp ugt i64 %18, 7
%21 = add i32 %19, 15
%22 = trunc i64 %18 to i32
%23 = select i1 %20, i32 %21, i32 %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %34, label %25
25: ; preds = %15
%26 = load i32, i32* %12
%27 = load i32, i32* %13
%28 = getelementptr inbounds [16 x %struct.POINT], [16 x %struct.POINT]* @HariMain.table, i64 0, i64 %16, i32 0
%29 = load i32, i32* %28
%30 = getelementptr inbounds [16 x %struct.POINT], [16 x %struct.POINT]* @HariMain.table, i64 0, i64 %16, i32 1
%31 = load i32, i32* %30
%32 = sub nsw i32 8, %23
%33 = call i32 @api_linewin(i32 %3, i32 %26, i32 %27, i32 %29, i32 %31, i32 %32)
br label %34
34: ; preds = %15, %25
%35 = add nuw nsw i64 %16, 1
%36 = icmp eq i64 %35, 16
br i1 %36, label %5, label %15
37: ; preds = %5, %37
%38 = call i32 @api_getkey(i32 1)
%39 = icmp eq i32 %38, 10
br i1 %39, label %40, label %37
40: ; preds = %37
%41 = call i32 (...) @api_end()
ret void
}