#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 */
unsigned short blend_half(unsigned short);
void mixed_vline(unsigned short *dst, int height, int scr_w,
                 unsigned short mixcol) {
  mixcol = blend_half(mixcol);
  for (; height--; dst += scr_w)
    *dst = blend_half(*dst) + mixcol;
}


x86 assembly (clang, -O0):
<mixed_vline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cx,%ax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movzwl -0x12(%rbp),%edi
call   1030 <blend_half@plt>
mov    %ax,-0x12(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     1183 <mixed_vline+0x73>
mov    -0x8(%rbp),%rax
movzwl (%rax),%edi
call   1030 <blend_half@plt>
movzwl %ax,%eax
movzwl -0x12(%rbp),%ecx
add    %ecx,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x1,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1136 <mixed_vline+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mixed_vline>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %ecx,%edi
call   1030 <blend_half@plt>
test   %ebp,%ebp
je     1156 <mixed_vline+0x46>
mov    %eax,%r14d
movslq %r15d,%r15
add    %r15,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzwl (%rbx),%edi
call   1030 <blend_half@plt>
add    %r14d,%eax
mov    %ax,(%rbx)
add    %r15,%rbx
add    $0xffffffff,%ebp
jne    1140 <mixed_vline+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @mixed_vline(i16* %0, i32 %1, i32 %2, i16 zeroext %3) {
%5 = alloca i16*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i16
store i16* %0, i16** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i16 %3, i16* %8
%9 = load i16, i16* %8
%10 = call zeroext i16 @blend_half(i16 zeroext %9)
store i16 %10, i16* %8
br label %11
11: ; preds = %25, %4
%12 = load i32, i32* %6
%13 = add nsw i32 %12, -1
store i32 %13, i32* %6
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %30
15: ; preds = %11
%16 = load i16*, i16** %5
%17 = load i16, i16* %16
%18 = call zeroext i16 @blend_half(i16 zeroext %17)
%19 = zext i16 %18 to i32
%20 = load i16, i16* %8
%21 = zext i16 %20 to i32
%22 = add nsw i32 %19, %21
%23 = trunc i32 %22 to i16
%24 = load i16*, i16** %5
store i16 %23, i16* %24
br label %25
25: ; preds = %15
%26 = load i32, i32* %7
%27 = load i16*, i16** %5
%28 = sext i32 %26 to i64
%29 = getelementptr inbounds i16, i16* %27, i64 %28
store i16* %29, i16** %5
br label %11
30: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @mixed_vline(i16* nocapture %0, i32 %1, i32 %2, i16 zeroext %3) {
%5 = tail call zeroext i16 @blend_half(i16 zeroext %3)
%6 = icmp eq i32 %1, 0
br i1 %6, label %18, label %7
7: ; preds = %4
%8 = sext i32 %2 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i16* [ %0, %7 ], [ %16, %9 ]
%11 = phi i32 [ %1, %7 ], [ %12, %9 ]
%12 = add nsw i32 %11, -1
%13 = load i16, i16* %10
%14 = tail call zeroext i16 @blend_half(i16 zeroext %13)
%15 = add i16 %14, %5
store i16 %15, i16* %10
%16 = getelementptr inbounds i16, i16* %10, i64 %8
%17 = icmp eq i32 %12, 0
br i1 %17, label %18, label %9
18: ; preds = %9, %4
ret void
}