#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*/ idct_dequant_0_2x_neon(short *, short, unsigned char *, int);
int /*<<< orphan*/ idct_dequant_full_2x_neon(short *, short *, unsigned char *,
                                             int);
void vp8_dequant_idct_add_y_block_neon(short *q, short *dq, unsigned char *dst,
                                       int stride, char *eobs) {
  int i;
  for (i = 0; i < 4; i++) {
    if (((short *)(eobs))[0]) {
      if (((short *)eobs)[0] & 0xfefe)
        idct_dequant_full_2x_neon(q, dq, dst, stride);
      else
        idct_dequant_0_2x_neon(q, dq[0], dst, stride);
    }
    if (((short *)(eobs))[1]) {
      if (((short *)eobs)[1] & 0xfefe)
        idct_dequant_full_2x_neon(q + 32, dq, dst + 8, stride);
      else
        idct_dequant_0_2x_neon(q + 32, dq[0], dst + 8, stride);
    }
    q += 64;
    dst += 4 * stride;
    eobs += 4;
  }
}


x86 assembly (clang, -O0):
<vp8_dequant_idct_add_y_block_neon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x2c(%rbp)
jge    1250 <vp8_dequant_idct_add_y_block_neon+0x130>
mov    -0x28(%rbp),%rax
cmpw   $0x0,(%rax)
je     11a7 <vp8_dequant_idct_add_y_block_neon+0x87>
mov    -0x28(%rbp),%rax
movswl (%rax),%eax
and    $0xfefe,%eax
cmp    $0x0,%eax
je     1188 <vp8_dequant_idct_add_y_block_neon+0x68>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <idct_dequant_full_2x_neon@plt>
jmp    11a2 <vp8_dequant_idct_add_y_block_neon+0x82>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%ax
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
movswl %ax,%esi
call   1030 <idct_dequant_0_2x_neon@plt>
jmp    11a7 <vp8_dequant_idct_add_y_block_neon+0x87>
mov    -0x28(%rbp),%rax
cmpw   $0x0,0x2(%rax)
je     1214 <vp8_dequant_idct_add_y_block_neon+0xf4>
mov    -0x28(%rbp),%rax
movswl 0x2(%rax),%eax
and    $0xfefe,%eax
cmp    $0x0,%eax
je     11ed <vp8_dequant_idct_add_y_block_neon+0xcd>
mov    -0x8(%rbp),%rdi
add    $0x40,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <idct_dequant_full_2x_neon@plt>
jmp    120f <vp8_dequant_idct_add_y_block_neon+0xef>
mov    -0x8(%rbp),%rdi
add    $0x40,%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%ax
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x1c(%rbp),%ecx
movswl %ax,%esi
call   1030 <idct_dequant_0_2x_neon@plt>
jmp    1214 <vp8_dequant_idct_add_y_block_neon+0xf4>
mov    -0x8(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1142 <vp8_dequant_idct_add_y_block_neon+0x22>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_dequant_idct_add_y_block_neon>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %ecx,%r14d
mov    %rdx,%r13
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0x0(,%r14,4),%eax
cltq
mov    %rax,(%rsp)
xor    %ebp,%ebp
jmp    1172 <vp8_dequant_idct_add_y_block_neon+0x52>
nopl   0x0(%rax)
movswl (%r12),%esi
lea    0x8(%r13),%rdx
mov    %r14d,%ecx
call   1030 <idct_dequant_0_2x_neon@plt>
sub    $0xffffffffffffff80,%rbx
add    (%rsp),%r13
add    $0x1,%rbp
cmp    $0x4,%ebp
je     11da <vp8_dequant_idct_add_y_block_neon+0xba>
movzwl (%r15,%rbp,4),%eax
test   %ax,%ax
je     11b3 <vp8_dequant_idct_add_y_block_neon+0x93>
test   $0xfefe,%eax
je     11a0 <vp8_dequant_idct_add_y_block_neon+0x80>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %r14d,%ecx
call   1040 <idct_dequant_full_2x_neon@plt>
jmp    11b3 <vp8_dequant_idct_add_y_block_neon+0x93>
cs nopw 0x0(%rax,%rax,1)
movswl (%r12),%esi
mov    %rbx,%rdi
mov    %r13,%rdx
mov    %r14d,%ecx
call   1030 <idct_dequant_0_2x_neon@plt>
movzwl 0x2(%r15,%rbp,4),%eax
test   %ax,%ax
je     1161 <vp8_dequant_idct_add_y_block_neon+0x41>
lea    0x40(%rbx),%rdi
test   $0xfefe,%eax
je     1150 <vp8_dequant_idct_add_y_block_neon+0x30>
lea    0x8(%r13),%rdx
mov    %r12,%rsi
mov    %r14d,%ecx
call   1040 <idct_dequant_full_2x_neon@plt>
jmp    1161 <vp8_dequant_idct_add_y_block_neon+0x41>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @vp8_dequant_idct_add_y_block_neon(i16* %0, i16* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i16*
%7 = alloca i16*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
store i16* %0, i16** %6
store i16* %1, i16** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
store i32 0, i32* %11
br label %12
12: ; preds = %87, %5
%13 = load i32, i32* %11
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %90
15: ; preds = %12
%16 = load i8*, i8** %10
%17 = bitcast i8* %16 to i16*
%18 = getelementptr inbounds i16, i16* %17, i64 0
%19 = load i16, i16* %18
%20 = icmp ne i16 %19, 0
br i1 %20, label %21, label %44
21: ; preds = %15
%22 = load i8*, i8** %10
%23 = bitcast i8* %22 to i16*
%24 = getelementptr inbounds i16, i16* %23, i64 0
%25 = load i16, i16* %24
%26 = sext i16 %25 to i32
%27 = and i32 %26, 65278
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %21
%30 = load i16*, i16** %6
%31 = load i16*, i16** %7
%32 = load i8*, i8** %8
%33 = load i32, i32* %9
%34 = call i32 @idct_dequant_full_2x_neon(i16* %30, i16* %31, i8* %32, i32 %33)
br label %43
35: ; preds = %21
%36 = load i16*, i16** %6
%37 = load i16*, i16** %7
%38 = getelementptr inbounds i16, i16* %37, i64 0
%39 = load i16, i16* %38
%40 = load i8*, i8** %8
%41 = load i32, i32* %9
%42 = call i32 @idct_dequant_0_2x_neon(i16* %36, i16 signext %39, i8* %40, i32 %41)
br label %43
43: ; preds = %35, %29
br label %44
44: ; preds = %43, %15
%45 = load i8*, i8** %10
%46 = bitcast i8* %45 to i16*
%47 = getelementptr inbounds i16, i16* %46, i64 1
%48 = load i16, i16* %47
%49 = icmp ne i16 %48, 0
br i1 %49, label %50, label %77
50: ; preds = %44
%51 = load i8*, i8** %10
%52 = bitcast i8* %51 to i16*
%53 = getelementptr inbounds i16, i16* %52, i64 1
%54 = load i16, i16* %53
%55 = sext i16 %54 to i32
%56 = and i32 %55, 65278
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %66
58: ; preds = %50
%59 = load i16*, i16** %6
%60 = getelementptr inbounds i16, i16* %59, i64 32
%61 = load i16*, i16** %7
%62 = load i8*, i8** %8
%63 = getelementptr inbounds i8, i8* %62, i64 8
%64 = load i32, i32* %9
%65 = call i32 @idct_dequant_full_2x_neon(i16* %60, i16* %61, i8* %63, i32 %64)
br label %76
66: ; preds = %50
%67 = load i16*, i16** %6
%68 = getelementptr inbounds i16, i16* %67, i64 32
%69 = load i16*, i16** %7
%70 = getelementptr inbounds i16, i16* %69, i64 0
%71 = load i16, i16* %70
%72 = load i8*, i8** %8
%73 = getelementptr inbounds i8, i8* %72, i64 8
%74 = load i32, i32* %9
%75 = call i32 @idct_dequant_0_2x_neon(i16* %68, i16 signext %71, i8* %73, i32 %74)
br label %76
76: ; preds = %66, %58
br label %77
77: ; preds = %76, %44
%78 = load i16*, i16** %6
%79 = getelementptr inbounds i16, i16* %78, i64 64
store i16* %79, i16** %6
%80 = load i32, i32* %9
%81 = mul nsw i32 4, %80
%82 = load i8*, i8** %8
%83 = sext i32 %81 to i64
%84 = getelementptr inbounds i8, i8* %82, i64 %83
store i8* %84, i8** %8
%85 = load i8*, i8** %10
%86 = getelementptr inbounds i8, i8* %85, i64 4
store i8* %86, i8** %10
br label %87
87: ; preds = %77
%88 = load i32, i32* %11
%89 = add nsw i32 %88, 1
store i32 %89, i32* %11
br label %12
90: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @vp8_dequant_idct_add_y_block_neon(i16* %0, i16* %1, i8* %2, i32 %3, i8* nocapture %4) {
%6 = shl nsw i32 %3, 2
%7 = sext i32 %6 to i64
br label %8
8: ; preds = %5, %40
%9 = phi i32 [ 0, %5 ], [ %44, %40 ]
%10 = phi i8* [ %4, %5 ], [ %43, %40 ]
%11 = phi i16* [ %0, %5 ], [ %41, %40 ]
%12 = phi i8* [ %2, %5 ], [ %42, %40 ]
%13 = bitcast i8* %10 to i16*
%14 = load i16, i16* %13
%15 = icmp eq i16 %14, 0
br i1 %15, label %24, label %16
16: ; preds = %8
%17 = and i16 %14, -258
%18 = icmp eq i16 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 @idct_dequant_full_2x_neon(i16* %11, i16* %1, i8* %12, i32 %3)
br label %24
21: ; preds = %16
%22 = load i16, i16* %1
%23 = tail call i32 @idct_dequant_0_2x_neon(i16* %11, i16 signext %22, i8* %12, i32 %3)
br label %24
24: ; preds = %19, %21, %8
%25 = getelementptr inbounds i8, i8* %10, i64 2
%26 = bitcast i8* %25 to i16*
%27 = load i16, i16* %26
%28 = icmp eq i16 %27, 0
br i1 %28, label %40, label %29
29: ; preds = %24
%30 = and i16 %27, -258
%31 = icmp eq i16 %30, 0
%32 = getelementptr inbounds i16, i16* %11, i64 32
br i1 %31, label %36, label %33
33: ; preds = %29
%34 = getelementptr inbounds i8, i8* %12, i64 8
%35 = tail call i32 @idct_dequant_full_2x_neon(i16* %32, i16* %1, i8* %34, i32 %3)
br label %40
36: ; preds = %29
%37 = load i16, i16* %1
%38 = getelementptr inbounds i8, i8* %12, i64 8
%39 = tail call i32 @idct_dequant_0_2x_neon(i16* %32, i16 signext %37, i8* %38, i32 %3)
br label %40
40: ; preds = %33, %36, %24
%41 = getelementptr inbounds i16, i16* %11, i64 64
%42 = getelementptr inbounds i8, i8* %12, i64 %7
%43 = getelementptr inbounds i8, i8* %10, i64 4
%44 = add nuw nsw i32 %9, 1
%45 = icmp eq i32 %44, 4
br i1 %45, label %46, label %8
46: ; preds = %40
ret void
}