#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_close(int);
int /*<<< orphan*/ win_line(int, int, int, int, int, int);
int win_open(char *, int, int, int, char *);
int /*<<< orphan*/ win_refresh(int, int, int, int, int);
void HariMain(void) {
  char *buf;
  int win;
  int i;
  init_mem();
  buf = (char *)malloc(160 * 100);
  win = win_open(buf, 160, 100, -1, "Win-Lines");
  for (i = 0; i < 8; ++i) {
    win_line(win + 1, 8, 26, 77, i * 9 + 26, i);
    win_line(win + 1, 88, 26, i * 9 + 88, 89, i);
  }
  win_refresh(win, 6, 26, 154, 90);
  win_close(win);
  api_end();
}


x86 assembly (clang, -O0):
<HariMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <init_mem@plt>
mov    $0x3e80,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa0,%esi
mov    $0x64,%edx
mov    $0xffffffff,%ecx
lea    0xe59(%rip),%r8
call   1090 <win_open@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    121b <HariMain+0xab>
mov    -0xc(%rbp),%edi
add    $0x1,%edi
imul   $0x9,-0x10(%rbp),%r8d
add    $0x1a,%r8d
mov    -0x10(%rbp),%r9d
mov    $0x8,%esi
mov    $0x1a,%edx
mov    $0x4d,%ecx
call   1040 <win_line@plt>
mov    -0xc(%rbp),%edi
add    $0x1,%edi
imul   $0x9,-0x10(%rbp),%ecx
add    $0x58,%ecx
mov    -0x10(%rbp),%r9d
mov    $0x58,%esi
mov    $0x1a,%edx
mov    $0x59,%r8d
call   1040 <win_line@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b6 <HariMain+0x46>
mov    -0xc(%rbp),%edi
mov    $0x6,%esi
mov    $0x1a,%edx
mov    $0x9a,%ecx
mov    $0x5a,%r8d
call   1080 <win_refresh@plt>
mov    -0xc(%rbp),%edi
call   1050 <win_close@plt>
mov    $0x0,%al
call   1030 <api_end@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HariMain>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <init_mem@plt>
mov    $0x3e80,%edi
call   1070 <malloc@plt>
lea    0xe75(%rip),%r8
mov    %rax,%rdi
mov    $0xa0,%esi
mov    $0x64,%edx
mov    $0xffffffff,%ecx
call   1090 <win_open@plt>
mov    %eax,%ebx
lea    0x1(%rbx),%ebp
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x1a,%edx
mov    $0x4d,%ecx
mov    $0x1a,%r8d
xor    %r9d,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x58,%esi
mov    $0x1a,%edx
mov    $0x58,%ecx
mov    $0x59,%r8d
xor    %r9d,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x1a,%edx
mov    $0x4d,%ecx
mov    $0x23,%r8d
mov    $0x1,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x58,%esi
mov    $0x1a,%edx
mov    $0x61,%ecx
mov    $0x59,%r8d
mov    $0x1,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x1a,%edx
mov    $0x4d,%ecx
mov    $0x2c,%r8d
mov    $0x2,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x58,%esi
mov    $0x1a,%edx
mov    $0x6a,%ecx
mov    $0x59,%r8d
mov    $0x2,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x1a,%edx
mov    $0x4d,%ecx
mov    $0x35,%r8d
mov    $0x3,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x58,%esi
mov    $0x1a,%edx
mov    $0x73,%ecx
mov    $0x59,%r8d
mov    $0x3,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x1a,%edx
mov    $0x4d,%ecx
mov    $0x3e,%r8d
mov    $0x4,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x58,%esi
mov    $0x1a,%edx
mov    $0x7c,%ecx
mov    $0x59,%r8d
mov    $0x4,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x1a,%edx
mov    $0x4d,%ecx
mov    $0x47,%r8d
mov    $0x5,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x58,%esi
mov    $0x1a,%edx
mov    $0x85,%ecx
mov    $0x59,%r8d
mov    $0x5,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x1a,%edx
mov    $0x4d,%ecx
mov    $0x50,%r8d
mov    $0x6,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x58,%esi
mov    $0x1a,%edx
mov    $0x8e,%ecx
mov    $0x59,%r8d
mov    $0x6,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x1a,%edx
mov    $0x4d,%ecx
mov    $0x59,%r8d
mov    $0x7,%r9d
call   1040 <win_line@plt>
mov    %ebp,%edi
mov    $0x58,%esi
mov    $0x1a,%edx
mov    $0x97,%ecx
mov    $0x59,%r8d
mov    $0x7,%r9d
call   1040 <win_line@plt>
mov    %ebx,%edi
mov    $0x6,%esi
mov    $0x1a,%edx
mov    $0x9a,%ecx
mov    $0x5a,%r8d
call   1080 <win_refresh@plt>
mov    %ebx,%edi
call   1050 <win_close@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <api_end@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Win-Lines\00"
define void @HariMain() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @init_mem()
%5 = call i64 @malloc(i32 16000)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %1
%7 = load i8*, i8** %1
%8 = call i32 @win_open(i8* %7, i32 160, i32 100, i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %8, i32* %2
store i32 0, i32* %3
br label %9
9: ; preds = %27, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 8
br i1 %11, label %12, label %30
12: ; preds = %9
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
%15 = load i32, i32* %3
%16 = mul nsw i32 %15, 9
%17 = add nsw i32 %16, 26
%18 = load i32, i32* %3
%19 = call i32 @win_line(i32 %14, i32 8, i32 26, i32 77, i32 %17, i32 %18)
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %3
%23 = mul nsw i32 %22, 9
%24 = add nsw i32 %23, 88
%25 = load i32, i32* %3
%26 = call i32 @win_line(i32 %21, i32 88, i32 26, i32 %24, i32 89, i32 %25)
br label %27
27: ; preds = %12
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %9
30: ; preds = %9
%31 = load i32, i32* %2
%32 = call i32 @win_refresh(i32 %31, i32 6, i32 26, i32 154, i32 90)
%33 = load i32, i32* %2
%34 = call i32 @win_close(i32 %33)
%35 = call i32 (...) @api_end()
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Win-Lines\00"
define void @HariMain() {
%1 = tail call i32 (...) @init_mem()
%2 = tail call i64 @malloc(i32 16000)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @win_open(i8* %3, i32 160, i32 100, i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = add nsw i32 %4, 1
%6 = tail call i32 @win_line(i32 %5, i32 8, i32 26, i32 77, i32 26, i32 0)
%7 = tail call i32 @win_line(i32 %5, i32 88, i32 26, i32 88, i32 89, i32 0)
%8 = tail call i32 @win_line(i32 %5, i32 8, i32 26, i32 77, i32 35, i32 1)
%9 = tail call i32 @win_line(i32 %5, i32 88, i32 26, i32 97, i32 89, i32 1)
%10 = tail call i32 @win_line(i32 %5, i32 8, i32 26, i32 77, i32 44, i32 2)
%11 = tail call i32 @win_line(i32 %5, i32 88, i32 26, i32 106, i32 89, i32 2)
%12 = tail call i32 @win_line(i32 %5, i32 8, i32 26, i32 77, i32 53, i32 3)
%13 = tail call i32 @win_line(i32 %5, i32 88, i32 26, i32 115, i32 89, i32 3)
%14 = tail call i32 @win_line(i32 %5, i32 8, i32 26, i32 77, i32 62, i32 4)
%15 = tail call i32 @win_line(i32 %5, i32 88, i32 26, i32 124, i32 89, i32 4)
%16 = tail call i32 @win_line(i32 %5, i32 8, i32 26, i32 77, i32 71, i32 5)
%17 = tail call i32 @win_line(i32 %5, i32 88, i32 26, i32 133, i32 89, i32 5)
%18 = tail call i32 @win_line(i32 %5, i32 8, i32 26, i32 77, i32 80, i32 6)
%19 = tail call i32 @win_line(i32 %5, i32 88, i32 26, i32 142, i32 89, i32 6)
%20 = tail call i32 @win_line(i32 %5, i32 8, i32 26, i32 77, i32 89, i32 7)
%21 = tail call i32 @win_line(i32 %5, i32 88, i32 26, i32 151, i32 89, i32 7)
%22 = tail call i32 @win_refresh(i32 %4, i32 6, i32 26, i32 154, i32 90)
%23 = tail call i32 @win_close(i32 %4)
%24 = tail call i32 (...) @api_end()
ret void
}