#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);
int /*<<< orphan*/ api_end();
int api_getkey(int);
int api_openwin(char *, int, int, int, char *);
int /*<<< orphan*/ api_putstrwin(int, int, int, int /*<<< orphan*/, int,
                                 char *);
void HariMain(void) {
  int win;
  char buf[150 * 50];
  win = api_openwin(buf, 150, 50, -1, "hello");
  api_boxfilwin(win, 8, 36, 141, 43, 3);
  api_putstrwin(win, 28, 28, 0, 12, "hello, world");
  for (;;) {
    if (api_getkey(1) == 0x0a) {
      break;
    }
  }
  api_end();
}


x86 assembly (clang, -O0):
<HariMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d50,%rsp
lea    -0x1d50(%rbp),%rdi
mov    $0x96,%esi
mov    $0x32,%edx
mov    $0xffffffff,%ecx
lea    0xe88(%rip),%r8
call   1060 <api_openwin@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
mov    $0x24,%edx
mov    $0x8d,%ecx
mov    $0x2b,%r8d
mov    $0x3,%r9d
call   1070 <api_boxfilwin@plt>
mov    -0x4(%rbp),%edi
mov    $0x1c,%edx
xor    %ecx,%ecx
mov    $0xc,%r8d
lea    0xe4c(%rip),%r9
mov    %edx,%esi
call   1050 <api_putstrwin@plt>
mov    $0x1,%edi
call   1040 <api_getkey@plt>
cmp    $0xa,%eax
jne    11d9 <HariMain+0x89>
jmp    11de <HariMain+0x8e>
jmp    11c1 <HariMain+0x71>
mov    $0x0,%al
call   1030 <api_end@plt>
add    $0x1d50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HariMain>:
push   %rbx
sub    $0x1d50,%rsp
lea    0xea1(%rip),%r8
mov    %rsp,%rdi
mov    $0x96,%esi
mov    $0x32,%edx
mov    $0xffffffff,%ecx
call   1060 <api_openwin@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    $0x8,%esi
mov    $0x24,%edx
mov    $0x8d,%ecx
mov    $0x2b,%r8d
mov    $0x3,%r9d
call   1070 <api_boxfilwin@plt>
lea    0xe65(%rip),%r9
mov    %ebx,%edi
mov    $0x1c,%esi
mov    $0x1c,%edx
xor    %ecx,%ecx
mov    $0xc,%r8d
call   1050 <api_putstrwin@plt>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1040 <api_getkey@plt>
cmp    $0xa,%eax
jne    11c0 <HariMain+0x70>
xor    %eax,%eax
call   1030 <api_end@plt>
add    $0x1d50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [13 x i8] c"hello, world\00"
define void @HariMain() {
%1 = alloca i32
%2 = alloca [7500 x i8]
%3 = getelementptr inbounds [7500 x i8], [7500 x i8]* %2, i64 0, i64 0
%4 = call i32 @api_openwin(i8* %3, i32 150, i32 50, i32 -1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @api_boxfilwin(i32 %5, i32 8, i32 36, i32 141, i32 43, i32 3)
%7 = load i32, i32* %1
%8 = call i32 @api_putstrwin(i32 %7, i32 28, i32 28, i32 0, i32 12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %13, %0
%10 = call i32 @api_getkey(i32 1)
%11 = icmp eq i32 %10, 10
br i1 %11, label %12, label %13
12: ; preds = %9
br label %14
13: ; preds = %9
br label %9
14: ; preds = %12
%15 = call i32 (...) @api_end()
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [13 x i8] c"hello, world\00"
define void @HariMain() {
%1 = alloca [7500 x i8]
%2 = getelementptr inbounds [7500 x i8], [7500 x i8]* %1, i64 0, i64 0
%3 = call i32 @api_openwin(i8* %2, i32 150, i32 50, 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 36, i32 141, i32 43, i32 3)
%5 = call i32 @api_putstrwin(i32 %3, i32 28, i32 28, i32 0, i32 12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %6, %0
%7 = call i32 @api_getkey(i32 1)
%8 = icmp eq i32 %7, 10
br i1 %8, label %9, label %6
9: ; preds = %6
%10 = call i32 (...) @api_end()
ret void
}