#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_initmalloc();
char *api_malloc(int);
int api_openwin(char *, int, int, int, char *);
int /*<<< orphan*/ api_point(int, int, int, int);
void HariMain(void) {
  char *buf;
  int win;
  api_initmalloc();
  buf = api_malloc(150 * 100);
  win = api_openwin(buf, 150, 100, -1, "star1");
  api_boxfilwin(win, 6, 26, 143, 93, 0);
  api_point(win, 75, 59, 3);
  for (;;) {
    if (api_getkey(1) == 0x0a) {
      break;
    }
  }
  api_end();
}


x86 assembly (clang, -O0):
<HariMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <api_initmalloc@plt>
mov    $0x3a98,%edi
call   1050 <api_malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x96,%esi
mov    $0x64,%edx
mov    $0xffffffff,%ecx
lea    0xe59(%rip),%r8
call   1080 <api_openwin@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x6,%esi
mov    $0x1a,%edx
mov    $0x8f,%ecx
mov    $0x5d,%r8d
xor    %r9d,%r9d
call   1090 <api_boxfilwin@plt>
mov    -0xc(%rbp),%edi
mov    $0x4b,%esi
mov    $0x3b,%edx
mov    $0x3,%ecx
call   1060 <api_point@plt>
mov    $0x1,%edi
call   1070 <api_getkey@plt>
cmp    $0xa,%eax
jne    11fe <HariMain+0x8e>
jmp    1203 <HariMain+0x93>
jmp    11e6 <HariMain+0x76>
mov    $0x0,%al
call   1030 <api_end@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HariMain>:
push   %rbx
xor    %eax,%eax
call   1040 <api_initmalloc@plt>
mov    $0x3a98,%edi
call   1050 <api_malloc@plt>
lea    0xe77(%rip),%r8
mov    %rax,%rdi
mov    $0x96,%esi
mov    $0x64,%edx
mov    $0xffffffff,%ecx
call   1080 <api_openwin@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    $0x6,%esi
mov    $0x1a,%edx
mov    $0x8f,%ecx
mov    $0x5d,%r8d
xor    %r9d,%r9d
call   1090 <api_boxfilwin@plt>
mov    %ebx,%edi
mov    $0x4b,%esi
mov    $0x3b,%edx
mov    $0x3,%ecx
call   1060 <api_point@plt>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1070 <api_getkey@plt>
cmp    $0xa,%eax
jne    11e0 <HariMain+0x70>
xor    %eax,%eax
pop    %rbx
jmp    1030 <api_end@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"star1\00"
define void @HariMain() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i32 (...) @api_initmalloc()
%4 = call i8* @api_malloc(i32 15000)
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = call i32 @api_openwin(i8* %5, i32 150, i32 100, i32 -1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @api_boxfilwin(i32 %7, i32 6, i32 26, i32 143, i32 93, i32 0)
%9 = load i32, i32* %2
%10 = call i32 @api_point(i32 %9, i32 75, i32 59, i32 3)
br label %11
11: ; preds = %15, %0
%12 = call i32 @api_getkey(i32 1)
%13 = icmp eq i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %11
br label %16
15: ; preds = %11
br label %11
16: ; preds = %14
%17 = call i32 (...) @api_end()
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"star1\00"
define void @HariMain() {
%1 = tail call i32 (...) @api_initmalloc()
%2 = tail call i8* @api_malloc(i32 15000)
%3 = tail call i32 @api_openwin(i8* %2, i32 150, i32 100, i32 -1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @api_boxfilwin(i32 %3, i32 6, i32 26, i32 143, i32 93, i32 0)
%5 = tail call i32 @api_point(i32 %3, i32 75, i32 59, i32 3)
br label %6
6: ; preds = %6, %0
%7 = tail call i32 @api_getkey(i32 1)
%8 = icmp eq i32 %7, 10
br i1 %8, label %9, label %6
9: ; preds = %6
%10 = tail call i32 (...) @api_end()
ret void
}