#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef int int16_t;

/* Variables and functions */
int /*<<< orphan*/ block_add(int *const, int /*<<< orphan*/ *const, int const);
int /*<<< orphan*/ block_add_DC(int *const, int /*<<< orphan*/ *const,
                                int const, int);
int /*<<< orphan*/ block_zero(int *const);
int /*<<< orphan*/ mmx_idct(int *const);
void mpeg2_idct_add_mmx(const int last, int16_t *const block,
                        uint8_t *const dest, const int stride) {
  if (last != 129 || (block[0] & 7) == 4) {
    mmx_idct(block);
    block_add(block, dest, stride);
    block_zero(block);
  } else
    block_add_DC(block, dest, stride, 1);
}


x86 assembly (clang, -O0):
<mpeg2_idct_add_mmx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x81,-0x4(%rbp)
jne    1175 <mpeg2_idct_add_mmx+0x35>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x7,%eax
cmp    $0x4,%eax
jne    119c <mpeg2_idct_add_mmx+0x5c>
mov    -0x10(%rbp),%rdi
call   1030 <mmx_idct@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1060 <block_add@plt>
mov    -0x10(%rbp),%rdi
call   1050 <block_zero@plt>
jmp    11b1 <mpeg2_idct_add_mmx+0x71>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    $0x1,%ecx
call   1040 <block_add_DC@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpeg2_idct_add_mmx>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %rsi,%rbx
cmp    $0x81,%edi
jne    115f <mpeg2_idct_add_mmx+0x1f>
mov    (%rbx),%eax
and    $0x7,%eax
cmp    $0x4,%eax
jne    1181 <mpeg2_idct_add_mmx+0x41>
mov    %rbx,%rdi
call   1030 <mmx_idct@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1060 <block_add@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <block_zero@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
mov    $0x1,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <block_add_DC@plt>

LLVM IR (-O0):
define void @mpeg2_idct_add_mmx(i32 %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 129
br i1 %10, label %17, label %11
11: ; preds = %4
%12 = load i32*, i32** %6
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
%15 = and i32 %14, 7
%16 = icmp eq i32 %15, 4
br i1 %16, label %17, label %26
17: ; preds = %11, %4
%18 = load i32*, i32** %6
%19 = call i32 @mmx_idct(i32* %18)
%20 = load i32*, i32** %6
%21 = load i32*, i32** %7
%22 = load i32, i32* %8
%23 = call i32 @block_add(i32* %20, i32* %21, i32 %22)
%24 = load i32*, i32** %6
%25 = call i32 @block_zero(i32* %24)
br label %31
26: ; preds = %11
%27 = load i32*, i32** %6
%28 = load i32*, i32** %7
%29 = load i32, i32* %8
%30 = call i32 @block_add_DC(i32* %27, i32* %28, i32 %29, i32 1)
br label %31
31: ; preds = %26, %17
ret void
}

LLVM IR (-O2):
define void @mpeg2_idct_add_mmx(i32 %0, i32* %1, i32* %2, i32 %3) {
%5 = icmp eq i32 %0, 129
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = load i32, i32* %1
%8 = and i32 %7, 7
%9 = icmp eq i32 %8, 4
br i1 %9, label %10, label %14
10: ; preds = %6, %4
%11 = tail call i32 @mmx_idct(i32* %1)
%12 = tail call i32 @block_add(i32* %1, i32* %2, i32 %3)
%13 = tail call i32 @block_zero(i32* %1)
br label %16
14: ; preds = %6
%15 = tail call i32 @block_add_DC(i32* %1, i32* %2, i32 %3, i32 1)
br label %16
16: ; preds = %14, %10
ret void
}