#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*/ decomp_8x8(unsigned char *, unsigned char *, int *, int *,
                              int, int);
int ov511_decomp_400(unsigned char *pIn, unsigned char *pOut,
                     unsigned char *pTmp, int w, int h, int inSize) {
  unsigned char *pY = pOut;
  int x, y, iY, iIn = 0;
  for (y = 0; y < h; y += 8) {
    iY = w * y;
    for (x = 0; x < w; x += 8)
      decomp_8x8(pIn, pY, &iIn, &iY, w, 1);
  }
  return w * h;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11ae <ov511_decomp_400+0x9e>
mov    -0x1c(%rbp),%eax
imul   -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    119b <ov511_decomp_400+0x8b>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x1c(%rbp),%r8d
lea    -0x40(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
mov    $0x1,%r9d
call   1030 <decomp_8x8@plt>
mov    -0x34(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x34(%rbp)
jmp    1162 <ov511_decomp_400+0x52>
jmp    11a0 <ov511_decomp_400+0x90>
mov    -0x38(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x38(%rbp)
jmp    1145 <ov511_decomp_400+0x35>
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%ebp
movl   $0x0,0x10(%rsp)
mov    %r8d,0x8(%rsp)
test   %r8d,%r8d
jle    1195 <ov511_decomp_400+0x85>
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %eax,%eax
lea    0x10(%rsp),%r12
lea    0x14(%rsp),%r13
jmp    115d <ov511_decomp_400+0x4d>
cs nopw 0x0(%rax,%rax,1)
mov    0xc(%rsp),%eax
add    $0x8,%eax
cmp    0x8(%rsp),%eax
jge    1195 <ov511_decomp_400+0x85>
mov    %eax,0xc(%rsp)
imul   %ebp,%eax
mov    %eax,0x14(%rsp)
test   %ebp,%ebp
jle    1150 <ov511_decomp_400+0x40>
xor    %r14d,%r14d
nop
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %ebp,%r8d
mov    $0x1,%r9d
call   1030 <decomp_8x8@plt>
add    $0x8,%r14d
cmp    %ebp,%r14d
jl     1170 <ov511_decomp_400+0x60>
jmp    1150 <ov511_decomp_400+0x40>
mov    0x8(%rsp),%eax
imul   %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ov511_decomp_400(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%18 = load i8*, i8** %8
store i8* %18, i8** %13
store i32 0, i32* %17
store i32 0, i32* %15
br label %19
19: ; preds = %40, %6
%20 = load i32, i32* %15
%21 = load i32, i32* %11
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %43
23: ; preds = %19
%24 = load i32, i32* %10
%25 = load i32, i32* %15
%26 = mul nsw i32 %24, %25
store i32 %26, i32* %16
store i32 0, i32* %14
br label %27
27: ; preds = %36, %23
%28 = load i32, i32* %14
%29 = load i32, i32* %10
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %39
31: ; preds = %27
%32 = load i8*, i8** %7
%33 = load i8*, i8** %13
%34 = load i32, i32* %10
%35 = call i32 @decomp_8x8(i8* %32, i8* %33, i32* %17, i32* %16, i32 %34, i32 1)
br label %36
36: ; preds = %31
%37 = load i32, i32* %14
%38 = add nsw i32 %37, 8
store i32 %38, i32* %14
br label %27
39: ; preds = %27
br label %40
40: ; preds = %39
%41 = load i32, i32* %15
%42 = add nsw i32 %41, 8
store i32 %42, i32* %15
br label %19
43: ; preds = %19
%44 = load i32, i32* %10
%45 = load i32, i32* %11
%46 = mul nsw i32 %44, %45
ret i32 %46
}

LLVM IR (-O2):
define i32 @ov511_decomp_400(i8* %0, i8* %1, i8* nocapture readnone %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %7 to i8*
%10 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%11 = icmp sgt i32 %4, 0
br i1 %11, label %12, label %25
12: ; preds = %6
%13 = icmp sgt i32 %3, 0
br label %14
14: ; preds = %12, %22
%15 = phi i32 [ 0, %12 ], [ %23, %22 ]
%16 = mul nsw i32 %15, %3
store i32 %16, i32* %7
br i1 %13, label %17, label %22
17: ; preds = %14, %17
%18 = phi i32 [ %20, %17 ], [ 0, %14 ]
%19 = call i32 @decomp_8x8(i8* %0, i8* %1, i32* %8, i32* %7, i32 %3, i32 1)
%20 = add nuw nsw i32 %18, 8
%21 = icmp slt i32 %20, %3
br i1 %21, label %17, label %22
22: ; preds = %17, %14
%23 = add nuw nsw i32 %15, 8
%24 = icmp slt i32 %23, %4
br i1 %24, label %14, label %25
25: ; preds = %22, %6
%26 = mul nsw i32 %4, %3
ret i32 %26
}