#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_end();
int /*<<< orphan*/ init_mem();
scalar_t__ malloc(int);
int /*<<< orphan*/ win_fill(int, int, int, int, int, int);
int win_open(char *, int, int, int, char *);
int /*<<< orphan*/ win_puts(int, int, int, int /*<<< orphan*/, int, char *);
void HariMain(void) {
  char *buf;
  int win;
  init_mem();
  buf = (char *)malloc(150 * 50);
  win = win_open(buf, 150, 50, -1, "Window-Hello");
  win_fill(win, 8, 36, 141, 43, 6);
  win_puts(win, 28, 28, 0, 13, "Hello, world!");
  api_end();
}


x86 assembly (clang, -O0):
<HariMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <init_mem@plt>
mov    $0x1d4c,%edi
call   1060 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x96,%esi
mov    $0x32,%edx
mov    $0xffffffff,%ecx
lea    0xe69(%rip),%r8
call   1080 <win_open@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x8,%esi
mov    $0x24,%edx
mov    $0x8d,%ecx
mov    $0x2b,%r8d
mov    $0x6,%r9d
call   1040 <win_fill@plt>
mov    -0xc(%rbp),%edi
mov    $0x1c,%edx
xor    %ecx,%ecx
mov    $0xd,%r8d
lea    0xe34(%rip),%r9
mov    %edx,%esi
call   1070 <win_puts@plt>
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   1050 <init_mem@plt>
mov    $0x1d4c,%edi
call   1060 <malloc@plt>
lea    0xe87(%rip),%r8
mov    %rax,%rdi
mov    $0x96,%esi
mov    $0x32,%edx
mov    $0xffffffff,%ecx
call   1080 <win_open@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    $0x8,%esi
mov    $0x24,%edx
mov    $0x8d,%ecx
mov    $0x2b,%r8d
mov    $0x6,%r9d
call   1040 <win_fill@plt>
lea    0xe52(%rip),%r9
mov    %ebx,%edi
mov    $0x1c,%esi
mov    $0x1c,%edx
xor    %ecx,%ecx
mov    $0xd,%r8d
call   1070 <win_puts@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <api_end@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Window-Hello\00"
@.str.1 = [14 x i8] c"Hello, world!\00"
define void @HariMain() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i32 (...) @init_mem()
%4 = call i64 @malloc(i32 7500)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @win_open(i8* %6, i32 150, i32 50, i32 -1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @win_fill(i32 %8, i32 8, i32 36, i32 141, i32 43, i32 6)
%10 = load i32, i32* %2
%11 = call i32 @win_puts(i32 %10, i32 28, i32 28, i32 0, i32 13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (...) @api_end()
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Window-Hello\00"
@.str.1 = [14 x i8] c"Hello, world!\00"
define void @HariMain() {
%1 = tail call i32 (...) @init_mem()
%2 = tail call i64 @malloc(i32 7500)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @win_open(i8* %3, i32 150, i32 50, i32 -1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @win_fill(i32 %4, i32 8, i32 36, i32 141, i32 43, i32 6)
%6 = tail call i32 @win_puts(i32 %4, i32 28, i32 28, i32 0, i32 13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 (...) @api_end()
ret void
}