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


x86 assembly (clang, -O0):
<vp8_dequant_idct_add_y_block_sse2>:
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    1244 <vp8_dequant_idct_add_y_block_sse2+0x124>
mov    -0x28(%rbp),%rax
cmpw   $0x0,(%rax)
je     11a1 <vp8_dequant_idct_add_y_block_sse2+0x81>
mov    -0x28(%rbp),%rax
movswl (%rax),%eax
and    $0xfefe,%eax
cmp    $0x0,%eax
je     1188 <vp8_dequant_idct_add_y_block_sse2+0x68>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <vp8_idct_dequant_full_2x_sse2@plt>
jmp    119c <vp8_dequant_idct_add_y_block_sse2+0x7c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <vp8_idct_dequant_0_2x_sse2@plt>
jmp    11a1 <vp8_dequant_idct_add_y_block_sse2+0x81>
mov    -0x28(%rbp),%rax
cmpw   $0x0,0x2(%rax)
je     1208 <vp8_dequant_idct_add_y_block_sse2+0xe8>
mov    -0x28(%rbp),%rax
movswl 0x2(%rax),%eax
and    $0xfefe,%eax
cmp    $0x0,%eax
je     11e7 <vp8_dequant_idct_add_y_block_sse2+0xc7>
mov    -0x8(%rbp),%rdi
add    $0x40,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <vp8_idct_dequant_full_2x_sse2@plt>
jmp    1203 <vp8_dequant_idct_add_y_block_sse2+0xe3>
mov    -0x8(%rbp),%rdi
add    $0x40,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <vp8_idct_dequant_0_2x_sse2@plt>
jmp    1208 <vp8_dequant_idct_add_y_block_sse2+0xe8>
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_sse2+0x22>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_dequant_idct_add_y_block_sse2>:
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    1166 <vp8_dequant_idct_add_y_block_sse2+0x46>
nopl   0x0(%rax)
call   1040 <vp8_idct_dequant_0_2x_sse2@plt>
sub    $0xffffffffffffff80,%rbx
add    (%rsp),%r13
add    $0x1,%rbp
cmp    $0x4,%ebp
je     11bc <vp8_dequant_idct_add_y_block_sse2+0x9c>
movzwl (%r15,%rbp,4),%eax
test   %ax,%ax
je     1195 <vp8_dequant_idct_add_y_block_sse2+0x75>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %r14d,%ecx
test   $0xfefe,%eax
je     1190 <vp8_dequant_idct_add_y_block_sse2+0x70>
call   1030 <vp8_idct_dequant_full_2x_sse2@plt>
jmp    1195 <vp8_dequant_idct_add_y_block_sse2+0x75>
nopw   0x0(%rax,%rax,1)
call   1040 <vp8_idct_dequant_0_2x_sse2@plt>
movzwl 0x2(%r15,%rbp,4),%eax
test   %ax,%ax
je     1155 <vp8_dequant_idct_add_y_block_sse2+0x35>
lea    0x40(%rbx),%rdi
lea    0x8(%r13),%rdx
mov    %r12,%rsi
mov    %r14d,%ecx
test   $0xfefe,%eax
je     1150 <vp8_dequant_idct_add_y_block_sse2+0x30>
call   1030 <vp8_idct_dequant_full_2x_sse2@plt>
jmp    1155 <vp8_dequant_idct_add_y_block_sse2+0x35>
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_sse2(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 = %83, %5
%13 = load i32, i32* %11
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %86
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 %42
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 @vp8_idct_dequant_full_2x_sse2(i16* %30, i16* %31, i8* %32, i32 %33)
br label %41
35: ; preds = %21
%36 = load i16*, i16** %6
%37 = load i16*, i16** %7
%38 = load i8*, i8** %8
%39 = load i32, i32* %9
%40 = call i32 @vp8_idct_dequant_0_2x_sse2(i16* %36, i16* %37, i8* %38, i32 %39)
br label %41
41: ; preds = %35, %29
br label %42
42: ; preds = %41, %15
%43 = load i8*, i8** %10
%44 = bitcast i8* %43 to i16*
%45 = getelementptr inbounds i16, i16* %44, i64 1
%46 = load i16, i16* %45
%47 = icmp ne i16 %46, 0
br i1 %47, label %48, label %73
48: ; preds = %42
%49 = load i8*, i8** %10
%50 = bitcast i8* %49 to i16*
%51 = getelementptr inbounds i16, i16* %50, i64 1
%52 = load i16, i16* %51
%53 = sext i16 %52 to i32
%54 = and i32 %53, 65278
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %64
56: ; preds = %48
%57 = load i16*, i16** %6
%58 = getelementptr inbounds i16, i16* %57, i64 32
%59 = load i16*, i16** %7
%60 = load i8*, i8** %8
%61 = getelementptr inbounds i8, i8* %60, i64 8
%62 = load i32, i32* %9
%63 = call i32 @vp8_idct_dequant_full_2x_sse2(i16* %58, i16* %59, i8* %61, i32 %62)
br label %72
64: ; preds = %48
%65 = load i16*, i16** %6
%66 = getelementptr inbounds i16, i16* %65, i64 32
%67 = load i16*, i16** %7
%68 = load i8*, i8** %8
%69 = getelementptr inbounds i8, i8* %68, i64 8
%70 = load i32, i32* %9
%71 = call i32 @vp8_idct_dequant_0_2x_sse2(i16* %66, i16* %67, i8* %69, i32 %70)
br label %72
72: ; preds = %64, %56
br label %73
73: ; preds = %72, %42
%74 = load i16*, i16** %6
%75 = getelementptr inbounds i16, i16* %74, i64 64
store i16* %75, i16** %6
%76 = load i32, i32* %9
%77 = mul nsw i32 %76, 4
%78 = load i8*, i8** %8
%79 = sext i32 %77 to i64
%80 = getelementptr inbounds i8, i8* %78, i64 %79
store i8* %80, i8** %8
%81 = load i8*, i8** %10
%82 = getelementptr inbounds i8, i8* %81, i64 4
store i8* %82, i8** %10
br label %83
83: ; preds = %73
%84 = load i32, i32* %11
%85 = add nsw i32 %84, 1
store i32 %85, i32* %11
br label %12
86: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @vp8_dequant_idct_add_y_block_sse2(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, %37
%9 = phi i32 [ 0, %5 ], [ %41, %37 ]
%10 = phi i8* [ %4, %5 ], [ %40, %37 ]
%11 = phi i16* [ %0, %5 ], [ %38, %37 ]
%12 = phi i8* [ %2, %5 ], [ %39, %37 ]
%13 = bitcast i8* %10 to i16*
%14 = load i16, i16* %13
%15 = icmp eq i16 %14, 0
br i1 %15, label %23, 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 @vp8_idct_dequant_full_2x_sse2(i16* %11, i16* %1, i8* %12, i32 %3)
br label %23
21: ; preds = %16
%22 = tail call i32 @vp8_idct_dequant_0_2x_sse2(i16* %11, i16* %1, i8* %12, i32 %3)
br label %23
23: ; preds = %19, %21, %8
%24 = getelementptr inbounds i8, i8* %10, i64 2
%25 = bitcast i8* %24 to i16*
%26 = load i16, i16* %25
%27 = icmp eq i16 %26, 0
br i1 %27, label %37, label %28
28: ; preds = %23
%29 = and i16 %26, -258
%30 = icmp eq i16 %29, 0
%31 = getelementptr inbounds i16, i16* %11, i64 32
%32 = getelementptr inbounds i8, i8* %12, i64 8
br i1 %30, label %35, label %33
33: ; preds = %28
%34 = tail call i32 @vp8_idct_dequant_full_2x_sse2(i16* %31, i16* %1, i8* %32, i32 %3)
br label %37
35: ; preds = %28
%36 = tail call i32 @vp8_idct_dequant_0_2x_sse2(i16* %31, i16* %1, i8* %32, i32 %3)
br label %37
37: ; preds = %33, %35, %23
%38 = getelementptr inbounds i16, i16* %11, i64 64
%39 = getelementptr inbounds i8, i8* %12, i64 %7
%40 = getelementptr inbounds i8, i8* %10, i64 4
%41 = add nuw nsw i32 %9, 1
%42 = icmp eq i32 %41, 4
br i1 %42, label %43, label %8
43: ; preds = %37
ret void
}