#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 Decompress420HiNoMMX(unsigned char *, unsigned char *, int, int, int);
int /*<<< orphan*/ remove0blocks(unsigned char *, int *);
int /*<<< orphan*/ yuv420raw_to_yuv420p(unsigned char *, unsigned char *, int,
                                        int);
int v4lconvert_ov511_to_yuv420(unsigned char *src, unsigned char *dest, int w,
                               int h, int yvu, int src_size) {
  int rc = 0;
  src_size -= 11;
  remove0blocks(src, &src_size);
  if (src[8] & 0x40)
    rc = Decompress420HiNoMMX(src + 9, dest, w, h, src_size);
  else
    yuv420raw_to_yuv420p(src + 9, dest, w, h);
  return rc;
}


x86 assembly (clang, -O0):
<v4lconvert_ov511_to_yuv420>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%eax
sub    $0xb,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <remove0blocks@plt>
mov    -0x8(%rbp),%rax
movzbl 0x8(%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     11a2 <v4lconvert_ov511_to_yuv420+0x72>
mov    -0x8(%rbp),%rdi
add    $0x9,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <Decompress420HiNoMMX@plt>
mov    %eax,-0x24(%rbp)
jmp    11b9 <v4lconvert_ov511_to_yuv420+0x89>
mov    -0x8(%rbp),%rdi
add    $0x9,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1040 <yuv420raw_to_yuv420p@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v4lconvert_ov511_to_yuv420>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
add    $0xfffffff5,%r9d
mov    %r9d,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1050 <remove0blocks@plt>
lea    0x9(%rbp),%rdi
testb  $0x40,0x8(%rbp)
jne    1172 <v4lconvert_ov511_to_yuv420+0x42>
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1040 <yuv420raw_to_yuv420p@plt>
xor    %eax,%eax
jmp    1185 <v4lconvert_ov511_to_yuv420+0x55>
mov    0x4(%rsp),%r8d
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1030 <Decompress420HiNoMMX@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @v4lconvert_ov511_to_yuv420(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
store i32 0, i32* %13
%14 = load i32, i32* %12
%15 = sub nsw i32 %14, 11
store i32 %15, i32* %12
%16 = load i8*, i8** %7
%17 = call i32 @remove0blocks(i8* %16, i32* %12)
%18 = load i8*, i8** %7
%19 = getelementptr inbounds i8, i8* %18, i64 8
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = and i32 %21, 64
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %32
24: ; preds = %6
%25 = load i8*, i8** %7
%26 = getelementptr inbounds i8, i8* %25, i64 9
%27 = load i8*, i8** %8
%28 = load i32, i32* %9
%29 = load i32, i32* %10
%30 = load i32, i32* %12
%31 = call i32 @Decompress420HiNoMMX(i8* %26, i8* %27, i32 %28, i32 %29, i32 %30)
store i32 %31, i32* %13
br label %39
32: ; preds = %6
%33 = load i8*, i8** %7
%34 = getelementptr inbounds i8, i8* %33, i64 9
%35 = load i8*, i8** %8
%36 = load i32, i32* %9
%37 = load i32, i32* %10
%38 = call i32 @yuv420raw_to_yuv420p(i8* %34, i8* %35, i32 %36, i32 %37)
br label %39
39: ; preds = %32, %24
%40 = load i32, i32* %13
ret i32 %40
}

LLVM IR (-O2):
define i32 @v4lconvert_ov511_to_yuv420(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = add nsw i32 %5, -11
store i32 %8, i32* %7
%9 = call i32 @remove0blocks(i8* %0, i32* %7)
%10 = getelementptr inbounds i8, i8* %0, i64 8
%11 = load i8, i8* %10
%12 = and i8 %11, 64
%13 = icmp eq i8 %12, 0
%14 = getelementptr inbounds i8, i8* %0, i64 9
br i1 %13, label %18, label %15
15: ; preds = %6
%16 = load i32, i32* %7
%17 = call i32 @Decompress420HiNoMMX(i8* %14, i8* %1, i32 %2, i32 %3, i32 %16)
br label %20
18: ; preds = %6
%19 = call i32 @yuv420raw_to_yuv420p(i8* %14, i8* %1, i32 %2, i32 %3)
br label %20
20: ; preds = %18, %15
%21 = phi i32 [ %17, %15 ], [ 0, %18 ]
ret i32 %21
}