#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 char _dotprsu2(unsigned int, unsigned int);
unsigned int _pack2(unsigned int, unsigned int);
void vertical_band_4_5_scale_c64(unsigned char *dest, unsigned int dest_pitch,
                                 unsigned int dest_width) {
  unsigned int i;
  unsigned int a, b, c, d, e;
  unsigned int ba, cb, dc, ed;
  unsigned char *restrict src = dest;
  unsigned char *restrict des = dest;
  unsigned int const_51_205, const_102_154, const_205_51, const_154_102;
  const_51_205 = 0x3300CD00;
  const_205_51 = 0xCD003300;
  const_102_154 = 0x66009A00;
  const_154_102 = 0x9A006600;
  a = src[0];
  b = src[dest_pitch];
  c = src[dest_pitch * 2];
  d = src[dest_pitch * 3];
  e = src[dest_pitch * 5];
  src++;
  for (i = 0; i < dest_width; i++) {
    ba = _pack2(b, a);
    cb = _pack2(c, b);
    dc = _pack2(d, c);
    ed = _pack2(e, d);
    a = src[0];
    b = src[dest_pitch];
    c = src[dest_pitch * 2];
    d = src[dest_pitch * 3];
    e = src[dest_pitch * 5];
    src++;
    des[dest_pitch] = _dotprsu2(ba, const_205_51);
    des[dest_pitch * 2] = _dotprsu2(cb, const_154_102);
    des[dest_pitch * 3] = _dotprsu2(dc, const_102_154);
    des[dest_pitch * 4] = _dotprsu2(ed, const_51_205);
    des++;
  }
}


x86 assembly (clang, -O0):
<vertical_band_4_5_scale_c64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0x3300cd00,-0x4c(%rbp)
movl   $0xcd003300,-0x54(%rbp)
movl   $0x66009a00,-0x50(%rbp)
movl   $0x9a006600,-0x58(%rbp)
mov    -0x40(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x40(%rbp),%rax
mov    -0xc(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x40(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
mov    -0x40(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x24(%rbp)
mov    -0x40(%rbp),%rax
imul   $0x5,-0xc(%rbp),%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x28(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    12de <vertical_band_4_5_scale_c64+0x1be>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <_pack2@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1030 <_pack2@plt>
mov    %eax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1030 <_pack2@plt>
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1030 <_pack2@plt>
mov    %eax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x40(%rbp),%rax
mov    -0xc(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x40(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
mov    -0x40(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x24(%rbp)
mov    -0x40(%rbp),%rax
imul   $0x5,-0xc(%rbp),%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x28(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x54(%rbp),%esi
call   1040 <_dotprsu2@plt>
mov    %al,%dl
mov    -0x48(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%edi
mov    -0x58(%rbp),%esi
call   1040 <_dotprsu2@plt>
mov    %al,%dl
mov    -0x48(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
mov    %ecx,%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x34(%rbp),%edi
mov    -0x50(%rbp),%esi
call   1040 <_dotprsu2@plt>
mov    %al,%dl
mov    -0x48(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
mov    %ecx,%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x38(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1040 <_dotprsu2@plt>
mov    %al,%dl
mov    -0x48(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
mov    %ecx,%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11be <vertical_band_4_5_scale_c64+0x9e>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vertical_band_4_5_scale_c64>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdi,0x10(%rsp)
test   %edx,%edx
je     129f <vertical_band_4_5_scale_c64+0x17f>
mov    %esi,%eax
lea    (%rsi,%rsi,1),%ecx
lea    (%rsi,%rsi,2),%ebp
lea    (%rsi,%rsi,4),%r10d
mov    0x10(%rsp),%rdi
mov    (%rdi,%rbp,1),%r8b
mov    (%rdi,%rcx,1),%r11b
mov    (%rdi,%rax,1),%bl
mov    (%rdi,%r10,1),%r14b
mov    (%rdi),%r9b
shl    $0x2,%esi
add    %rdi,%rsi
mov    %rsi,0x40(%rsp)
lea    (%rdi,%rbp,1),%rsi
add    $0x1,%rsi
mov    %rsi,0x38(%rsp)
lea    0x1(%rdi,%rcx,1),%rcx
mov    %rcx,0x30(%rsp)
lea    0x1(%rdi,%rax,1),%rax
mov    %rax,0x28(%rsp)
lea    0x1(%rdi,%r10,1),%rax
mov    %rax,0x20(%rsp)
mov    %edx,%eax
mov    %rax,0x18(%rsp)
xor    %r15d,%r15d
xchg   %ax,%ax
movzbl %bl,%ebp
movzbl %r11b,%ebx
movzbl %r8b,%r12d
movzbl %r9b,%esi
movzbl %r14b,%r13d
mov    %ebp,%edi
call   1030 <_pack2@plt>
mov    %eax,%r14d
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <_pack2@plt>
mov    %eax,%ebp
mov    %r12d,%edi
mov    %ebx,%esi
call   1030 <_pack2@plt>
mov    %eax,0x8(%rsp)
mov    %r13d,%edi
mov    %r12d,%esi
call   1030 <_pack2@plt>
mov    %eax,0xc(%rsp)
mov    0x10(%rsp),%rax
movzbl 0x1(%rax,%r15,1),%eax
mov    %al,0x7(%rsp)
mov    0x28(%rsp),%r13
movzbl 0x0(%r13,%r15,1),%eax
mov    %al,0x6(%rsp)
mov    0x30(%rsp),%rbx
movzbl (%rbx,%r15,1),%eax
mov    %al,0x5(%rsp)
mov    0x38(%rsp),%r12
movzbl (%r12,%r15,1),%eax
mov    %al,0x4(%rsp)
mov    0x20(%rsp),%rax
movzbl (%rax,%r15,1),%eax
mov    %r14d,%edi
mov    %eax,%r14d
mov    $0xcd003300,%esi
call   1040 <_dotprsu2@plt>
mov    %al,-0x1(%r13,%r15,1)
mov    %ebp,%edi
mov    $0x9a006600,%esi
call   1040 <_dotprsu2@plt>
mov    %al,-0x1(%rbx,%r15,1)
mov    0x8(%rsp),%edi
mov    $0x66009a00,%esi
call   1040 <_dotprsu2@plt>
mov    %al,-0x1(%r12,%r15,1)
mov    0xc(%rsp),%edi
mov    $0x3300cd00,%esi
call   1040 <_dotprsu2@plt>
movzbl 0x6(%rsp),%ebx
movzbl 0x5(%rsp),%r11d
movzbl 0x7(%rsp),%r9d
movzbl 0x4(%rsp),%r8d
mov    0x40(%rsp),%rcx
mov    %al,(%rcx,%r15,1)
add    $0x1,%r15
cmp    %r15d,0x18(%rsp)
jne    11a0 <vertical_band_4_5_scale_c64+0x80>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @vertical_band_4_5_scale_c64(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%23 = load i8*, i8** %4
store i8* %23, i8** %17
%24 = load i8*, i8** %4
store i8* %24, i8** %18
store i32 855690496, i32* %19
store i32 -855624960, i32* %21
store i32 1711315456, i32* %20
store i32 -1711249920, i32* %22
%25 = load i8*, i8** %17
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
store i32 %28, i32* %8
%29 = load i8*, i8** %17
%30 = load i32, i32* %5
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
store i32 %34, i32* %9
%35 = load i8*, i8** %17
%36 = load i32, i32* %5
%37 = mul i32 %36, 2
%38 = zext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %35, i64 %38
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
store i32 %41, i32* %10
%42 = load i8*, i8** %17
%43 = load i32, i32* %5
%44 = mul i32 %43, 3
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %42, i64 %45
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
store i32 %48, i32* %11
%49 = load i8*, i8** %17
%50 = load i32, i32* %5
%51 = mul i32 %50, 5
%52 = zext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %49, i64 %52
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
store i32 %55, i32* %12
%56 = load i8*, i8** %17
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %17
store i32 0, i32* %7
br label %58
58: ; preds = %141, %3
%59 = load i32, i32* %7
%60 = load i32, i32* %6
%61 = icmp ult i32 %59, %60
br i1 %61, label %62, label %144
62: ; preds = %58
%63 = load i32, i32* %9
%64 = load i32, i32* %8
%65 = call i32 @_pack2(i32 %63, i32 %64)
store i32 %65, i32* %13
%66 = load i32, i32* %10
%67 = load i32, i32* %9
%68 = call i32 @_pack2(i32 %66, i32 %67)
store i32 %68, i32* %14
%69 = load i32, i32* %11
%70 = load i32, i32* %10
%71 = call i32 @_pack2(i32 %69, i32 %70)
store i32 %71, i32* %15
%72 = load i32, i32* %12
%73 = load i32, i32* %11
%74 = call i32 @_pack2(i32 %72, i32 %73)
store i32 %74, i32* %16
%75 = load i8*, i8** %17
%76 = getelementptr inbounds i8, i8* %75, i64 0
%77 = load i8, i8* %76
%78 = zext i8 %77 to i32
store i32 %78, i32* %8
%79 = load i8*, i8** %17
%80 = load i32, i32* %5
%81 = zext i32 %80 to i64
%82 = getelementptr inbounds i8, i8* %79, i64 %81
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
store i32 %84, i32* %9
%85 = load i8*, i8** %17
%86 = load i32, i32* %5
%87 = mul i32 %86, 2
%88 = zext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %85, i64 %88
%90 = load i8, i8* %89
%91 = zext i8 %90 to i32
store i32 %91, i32* %10
%92 = load i8*, i8** %17
%93 = load i32, i32* %5
%94 = mul i32 %93, 3
%95 = zext i32 %94 to i64
%96 = getelementptr inbounds i8, i8* %92, i64 %95
%97 = load i8, i8* %96
%98 = zext i8 %97 to i32
store i32 %98, i32* %11
%99 = load i8*, i8** %17
%100 = load i32, i32* %5
%101 = mul i32 %100, 5
%102 = zext i32 %101 to i64
%103 = getelementptr inbounds i8, i8* %99, i64 %102
%104 = load i8, i8* %103
%105 = zext i8 %104 to i32
store i32 %105, i32* %12
%106 = load i8*, i8** %17
%107 = getelementptr inbounds i8, i8* %106, i32 1
store i8* %107, i8** %17
%108 = load i32, i32* %13
%109 = load i32, i32* %21
%110 = call zeroext i8 @_dotprsu2(i32 %108, i32 %109)
%111 = load i8*, i8** %18
%112 = load i32, i32* %5
%113 = zext i32 %112 to i64
%114 = getelementptr inbounds i8, i8* %111, i64 %113
store i8 %110, i8* %114
%115 = load i32, i32* %14
%116 = load i32, i32* %22
%117 = call zeroext i8 @_dotprsu2(i32 %115, i32 %116)
%118 = load i8*, i8** %18
%119 = load i32, i32* %5
%120 = mul i32 %119, 2
%121 = zext i32 %120 to i64
%122 = getelementptr inbounds i8, i8* %118, i64 %121
store i8 %117, i8* %122
%123 = load i32, i32* %15
%124 = load i32, i32* %20
%125 = call zeroext i8 @_dotprsu2(i32 %123, i32 %124)
%126 = load i8*, i8** %18
%127 = load i32, i32* %5
%128 = mul i32 %127, 3
%129 = zext i32 %128 to i64
%130 = getelementptr inbounds i8, i8* %126, i64 %129
store i8 %125, i8* %130
%131 = load i32, i32* %16
%132 = load i32, i32* %19
%133 = call zeroext i8 @_dotprsu2(i32 %131, i32 %132)
%134 = load i8*, i8** %18
%135 = load i32, i32* %5
%136 = mul i32 %135, 4
%137 = zext i32 %136 to i64
%138 = getelementptr inbounds i8, i8* %134, i64 %137
store i8 %133, i8* %138
%139 = load i8*, i8** %18
%140 = getelementptr inbounds i8, i8* %139, i32 1
store i8* %140, i8** %18
br label %141
141: ; preds = %62
%142 = load i32, i32* %7
%143 = add i32 %142, 1
store i32 %143, i32* %7
br label %58
144: ; preds = %58
ret void
}

LLVM IR (-O2):
define void @vertical_band_4_5_scale_c64(i8* nocapture %0, i32 %1, i32 %2) {
%4 = zext i32 %1 to i64
%5 = shl i32 %1, 1
%6 = zext i32 %5 to i64
%7 = mul i32 %1, 3
%8 = zext i32 %7 to i64
%9 = mul i32 %1, 5
%10 = zext i32 %9 to i64
%11 = icmp eq i32 %2, 0
br i1 %11, label %61, label %12
12: ; preds = %3
%13 = getelementptr inbounds i8, i8* %0, i64 %8
%14 = load i8, i8* %13
%15 = getelementptr inbounds i8, i8* %0, i64 %6
%16 = load i8, i8* %15
%17 = getelementptr inbounds i8, i8* %0, i64 %4
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %0, i64 %10
%20 = load i8, i8* %19
%21 = load i8, i8* %0
%22 = shl i32 %1, 2
%23 = zext i32 %22 to i64
br label %24
24: ; preds = %12, %24
%25 = phi i8 [ %14, %12 ], [ %48, %24 ]
%26 = phi i8 [ %16, %12 ], [ %46, %24 ]
%27 = phi i8 [ %18, %12 ], [ %44, %24 ]
%28 = phi i8* [ %0, %12 ], [ %32, %24 ]
%29 = phi i32 [ 0, %12 ], [ %59, %24 ]
%30 = phi i8 [ %21, %12 ], [ %42, %24 ]
%31 = phi i8 [ %20, %12 ], [ %50, %24 ]
%32 = getelementptr inbounds i8, i8* %28, i64 1
%33 = zext i8 %27 to i32
%34 = zext i8 %26 to i32
%35 = zext i8 %25 to i32
%36 = zext i8 %30 to i32
%37 = zext i8 %31 to i32
%38 = tail call i32 @_pack2(i32 %33, i32 %36)
%39 = tail call i32 @_pack2(i32 %34, i32 %33)
%40 = tail call i32 @_pack2(i32 %35, i32 %34)
%41 = tail call i32 @_pack2(i32 %37, i32 %35)
%42 = load i8, i8* %32
%43 = getelementptr inbounds i8, i8* %32, i64 %4
%44 = load i8, i8* %43
%45 = getelementptr inbounds i8, i8* %32, i64 %6
%46 = load i8, i8* %45
%47 = getelementptr inbounds i8, i8* %32, i64 %8
%48 = load i8, i8* %47
%49 = getelementptr inbounds i8, i8* %32, i64 %10
%50 = load i8, i8* %49
%51 = tail call zeroext i8 @_dotprsu2(i32 %38, i32 -855624960)
%52 = getelementptr inbounds i8, i8* %28, i64 %4
store i8 %51, i8* %52
%53 = tail call zeroext i8 @_dotprsu2(i32 %39, i32 -1711249920)
%54 = getelementptr inbounds i8, i8* %28, i64 %6
store i8 %53, i8* %54
%55 = tail call zeroext i8 @_dotprsu2(i32 %40, i32 1711315456)
%56 = getelementptr inbounds i8, i8* %28, i64 %8
store i8 %55, i8* %56
%57 = tail call zeroext i8 @_dotprsu2(i32 %41, i32 855690496)
%58 = getelementptr inbounds i8, i8* %28, i64 %23
store i8 %57, i8* %58
%59 = add nuw i32 %29, 1
%60 = icmp eq i32 %59, %2
br i1 %60, label %61, label %24
61: ; preds = %24, %3
ret void
}