#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 get_screen_rows();
int /*<<< orphan*/ gotoxy(int, int);
int /*<<< orphan*/ putchar(int);
void linev(int x, int y, int length, int character) {
  int count;
  if ((y + length - 1) <= get_screen_rows()) {
    gotoxy(x, y);
    for (count = 0; count < length; count++) {
      gotoxy(x, y + count);
      putchar(character);
    }
  }
}


x86 assembly (clang, -O0):
<linev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <get_screen_rows@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jg     11ab <linev+0x7b>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <gotoxy@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a6 <linev+0x76>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    -0x14(%rbp),%esi
call   1050 <gotoxy@plt>
mov    -0x10(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1176 <linev+0x46>
jmp    11ab <linev+0x7b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linev>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r15d
lea    (%rbx,%rbp,1),%r12d
add    $0xffffffff,%r12d
xor    %eax,%eax
call   1040 <get_screen_rows@plt>
cmp    %eax,%r12d
jg     118a <linev+0x5a>
mov    %r15d,%edi
mov    %ebp,%esi
call   1050 <gotoxy@plt>
test   %ebx,%ebx
jle    118a <linev+0x5a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15d,%edi
mov    %ebp,%esi
call   1050 <gotoxy@plt>
mov    %r14d,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
add    $0xffffffff,%ebx
jne    1170 <linev+0x40>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @linev(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = add nsw i32 %10, %11
%13 = sub nsw i32 %12, 1
%14 = call i32 (...) @get_screen_rows()
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %36
16: ; preds = %4
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = call i32 @gotoxy(i32 %17, i32 %18)
store i32 0, i32* %9
br label %20
20: ; preds = %32, %16
%21 = load i32, i32* %9
%22 = load i32, i32* %7
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %35
24: ; preds = %20
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = load i32, i32* %9
%28 = add nsw i32 %26, %27
%29 = call i32 @gotoxy(i32 %25, i32 %28)
%30 = load i32, i32* %8
%31 = call i32 @putchar(i32 %30)
br label %32
32: ; preds = %24
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
store i32 %34, i32* %9
br label %20
35: ; preds = %20
br label %36
36: ; preds = %35, %4
ret void
}

LLVM IR (-O2):
define void @linev(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add i32 %1, -1
%6 = add i32 %5, %2
%7 = tail call i32 (...) @get_screen_rows()
%8 = icmp sgt i32 %6, %7
br i1 %8, label %19, label %9
9: ; preds = %4
%10 = tail call i32 @gotoxy(i32 %0, i32 %1)
%11 = icmp sgt i32 %2, 0
br i1 %11, label %12, label %19
12: ; preds = %9, %12
%13 = phi i32 [ %17, %12 ], [ 0, %9 ]
%14 = add nsw i32 %13, %1
%15 = tail call i32 @gotoxy(i32 %0, i32 %14)
%16 = tail call i32 @putchar(i32 %3)
%17 = add nuw nsw i32 %13, 1
%18 = icmp eq i32 %17, %2
br i1 %18, label %19, label %12
19: ; preds = %12, %9, %4
ret void
}