#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*/ mcurses_addch(int, int, char);
int mcurses_vlineyl(int x, int y, int length, char c) {
  if (y + length > 15) {
    length = 16 - y;
  }
  int i;
  for (i = 0; i < length; i++) {
    mcurses_addch(x, y, c);
    y++;
  }
}


x86 assembly (clang, -O0):
<mcurses_vlineyl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    $0xf,%eax
jle    1140 <mcurses_vlineyl+0x30>
mov    $0x10,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1179 <mcurses_vlineyl+0x69>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
movsbl -0x11(%rbp),%edx
call   1030 <mcurses_addch@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1147 <mcurses_vlineyl+0x37>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcurses_vlineyl>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
lea    (%rdx,%rbx,1),%eax
mov    $0x10,%ebp
sub    %esi,%ebp
cmp    $0x10,%eax
cmovl  %edx,%ebp
test   %ebp,%ebp
jle    1155 <mcurses_vlineyl+0x45>
mov    %edi,%r14d
movsbl %cl,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%edi
mov    %ebx,%esi
mov    %r15d,%edx
call   1030 <mcurses_addch@plt>
add    $0x1,%ebx
add    $0xffffffff,%ebp
jne    1140 <mcurses_vlineyl+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @mcurses_vlineyl(i32 %0, i32 %1, i32 %2, i8 signext %3) {
%5 = add nsw i32 %2, %1
%6 = icmp sgt i32 %5, 15
%7 = sub nsw i32 16, %1
%8 = select i1 %6, i32 %7, i32 %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %4, %10
%11 = phi i32 [ %15, %10 ], [ 0, %4 ]
%12 = phi i32 [ %14, %10 ], [ %1, %4 ]
%13 = tail call i32 @mcurses_addch(i32 %0, i32 %12, i8 signext %3)
%14 = add nsw i32 %12, 1
%15 = add nuw nsw i32 %11, 1
%16 = icmp eq i32 %15, %8
br i1 %16, label %17, label %10
17: ; preds = %10, %4
ret i32 undef
}