#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_refreshwin(int, int, int, int, int);
char *lineview(int, int, int, int, char *, int, int);
void textview(int win, int w, int h, int xskip, char *p, int tab, int lang) {
  int i;
  api_boxfilwin(win + 1, 8, 29, w * 8 + 7, h * 16 + 28, 7);
  for (i = 0; i < h; i++) {
    p = lineview(win, w, i * 16 + 29, xskip, p, tab, lang);
  }
  api_refreshwin(win, 8, 29, w * 8 + 8, h * 16 + 29);
  return;
}


x86 assembly (clang, -O0):
<textview>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
add    $0x7,%ecx
mov    -0xc(%rbp),%r8d
shl    $0x4,%r8d
add    $0x1c,%r8d
mov    $0x8,%esi
mov    $0x1d,%edx
mov    $0x7,%r9d
call   1050 <api_boxfilwin@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c9 <textview+0x99>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%edx
shl    $0x4,%edx
add    $0x1d,%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <lineview@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1186 <textview+0x56>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
add    $0x8,%ecx
mov    -0xc(%rbp),%r8d
shl    $0x4,%r8d
add    $0x1d,%r8d
mov    $0x8,%esi
mov    $0x1d,%edx
call   1040 <api_refreshwin@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<textview>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9d,0x1c(%rsp)
mov    %r8,%r15
mov    %ecx,0x18(%rsp)
mov    %edx,%ebp
mov    %esi,%r14d
mov    %edi,%ebx
mov    0x60(%rsp),%r13d
lea    0x1(%rbx),%edi
lea    0x0(,%r14,8),%eax
mov    %eax,0x14(%rsp)
lea    0x7(,%r14,8),%ecx
mov    %edx,%eax
shl    $0x4,%eax
mov    %rax,0x20(%rsp)
lea    0x1c(%rax),%r8d
mov    $0x1d,%r12d
mov    $0x8,%esi
mov    $0x1d,%edx
mov    $0x7,%r9d
call   1050 <api_boxfilwin@plt>
test   %ebp,%ebp
jle    11c9 <textview+0x99>
nopw   0x0(%rax,%rax,1)
mov    %r13d,(%rsp)
mov    %ebx,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    0x18(%rsp),%ecx
mov    %r15,%r8
mov    0x1c(%rsp),%r9d
call   1030 <lineview@plt>
mov    %rax,%r15
add    $0x10,%r12d
add    $0xffffffff,%ebp
jne    11a0 <textview+0x70>
mov    0x14(%rsp),%ecx
add    $0x8,%ecx
mov    0x20(%rsp),%r8
add    $0x1d,%r8d
mov    %ebx,%edi
mov    $0x8,%esi
mov    $0x1d,%edx
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <api_refreshwin@plt>

LLVM IR (-O0):
define void @textview(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%16 = load i32, i32* %8
%17 = add nsw i32 %16, 1
%18 = load i32, i32* %9
%19 = mul nsw i32 %18, 8
%20 = add nsw i32 %19, 7
%21 = load i32, i32* %10
%22 = mul nsw i32 %21, 16
%23 = add nsw i32 %22, 28
%24 = call i32 @api_boxfilwin(i32 %17, i32 8, i32 29, i32 %20, i32 %23, i32 7)
store i32 0, i32* %15
br label %25
25: ; preds = %40, %7
%26 = load i32, i32* %15
%27 = load i32, i32* %10
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %43
29: ; preds = %25
%30 = load i32, i32* %8
%31 = load i32, i32* %9
%32 = load i32, i32* %15
%33 = mul nsw i32 %32, 16
%34 = add nsw i32 %33, 29
%35 = load i32, i32* %11
%36 = load i8*, i8** %12
%37 = load i32, i32* %13
%38 = load i32, i32* %14
%39 = call i8* @lineview(i32 %30, i32 %31, i32 %34, i32 %35, i8* %36, i32 %37, i32 %38)
store i8* %39, i8** %12
br label %40
40: ; preds = %29
%41 = load i32, i32* %15
%42 = add nsw i32 %41, 1
store i32 %42, i32* %15
br label %25
43: ; preds = %25
%44 = load i32, i32* %8
%45 = load i32, i32* %9
%46 = mul nsw i32 %45, 8
%47 = add nsw i32 %46, 8
%48 = load i32, i32* %10
%49 = mul nsw i32 %48, 16
%50 = add nsw i32 %49, 29
%51 = call i32 @api_refreshwin(i32 %44, i32 8, i32 29, i32 %47, i32 %50)
ret void
}

LLVM IR (-O2):
define void @textview(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5, i32 %6) {
%8 = add nsw i32 %0, 1
%9 = shl nsw i32 %1, 3
%10 = or i32 %9, 7
%11 = shl nsw i32 %2, 4
%12 = add nsw i32 %11, 28
%13 = tail call i32 @api_boxfilwin(i32 %8, i32 8, i32 29, i32 %10, i32 %12, i32 7)
%14 = icmp sgt i32 %2, 0
br i1 %14, label %15, label %23
15: ; preds = %7, %15
%16 = phi i32 [ %21, %15 ], [ 0, %7 ]
%17 = phi i8* [ %20, %15 ], [ %4, %7 ]
%18 = shl nsw i32 %16, 4
%19 = add nuw nsw i32 %18, 29
%20 = tail call i8* @lineview(i32 %0, i32 %1, i32 %19, i32 %3, i8* %17, i32 %5, i32 %6)
%21 = add nuw nsw i32 %16, 1
%22 = icmp eq i32 %21, %2
br i1 %22, label %23, label %15
23: ; preds = %15, %7
%24 = add nsw i32 %9, 8
%25 = add nsw i32 %11, 29
%26 = tail call i32 @api_refreshwin(i32 %0, i32 8, i32 29, i32 %24, i32 %25)
ret void
}