#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 func(int, int, int const **);
void PerformIDCT(int outBlock[8][8], const int inBlock[8][8]) {
  for (int y = 0; y < 8; y++) {
    for (int x = 0; x < 8; x++) {
      outBlock[x][y] = func(x, y, inBlock);
    }
  }
}


x86 assembly (clang, -O0):
<PerformIDCT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    118a <PerformIDCT+0x7a>
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    1177 <PerformIDCT+0x67>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <func@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1138 <PerformIDCT+0x28>
jmp    117c <PerformIDCT+0x6c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <PerformIDCT+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PerformIDCT>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   (%rax)
xor    %edi,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <func@plt>
mov    %eax,(%r15,%rbx,4)
mov    $0x1,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <func@plt>
mov    %eax,0x20(%r15,%rbx,4)
mov    $0x2,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <func@plt>
mov    %eax,0x40(%r15,%rbx,4)
mov    $0x3,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <func@plt>
mov    %eax,0x60(%r15,%rbx,4)
mov    $0x4,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <func@plt>
mov    %eax,0x80(%r15,%rbx,4)
mov    $0x5,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <func@plt>
mov    %eax,0xa0(%r15,%rbx,4)
mov    $0x6,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <func@plt>
mov    %eax,0xc0(%r15,%rbx,4)
mov    $0x7,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <func@plt>
mov    %eax,0xe0(%r15,%rbx,4)
add    $0x1,%rbx
cmp    $0x8,%rbx
jne    1120 <PerformIDCT+0x10>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @PerformIDCT([8 x i32]* %0, [8 x i32]* %1) {
%3 = alloca [8 x i32]*
%4 = alloca [8 x i32]*
%5 = alloca i32
%6 = alloca i32
store [8 x i32]* %0, [8 x i32]** %3
store [8 x i32]* %1, [8 x i32]** %4
store i32 0, i32* %5
br label %7
7: ; preds = %31, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %34
10: ; preds = %7
store i32 0, i32* %6
br label %11
11: ; preds = %27, %10
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %30
14: ; preds = %11
%15 = load i32, i32* %6
%16 = load i32, i32* %5
%17 = load [8 x i32]*, [8 x i32]** %4
%18 = bitcast [8 x i32]* %17 to i32**
%19 = call i32 @func(i32 %15, i32 %16, i32** %18)
%20 = load [8 x i32]*, [8 x i32]** %3
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [8 x i32], [8 x i32]* %20, i64 %22
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [8 x i32], [8 x i32]* %23, i64 0, i64 %25
store i32 %19, i32* %26
br label %27
27: ; preds = %14
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %11
30: ; preds = %11
br label %31
31: ; preds = %30
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %7
34: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @PerformIDCT([8 x i32]* nocapture writeonly %0, [8 x i32]* %1) {
%3 = bitcast [8 x i32]* %1 to i32**
br label %4
4: ; preds = %2, %4
%5 = phi i64 [ 0, %2 ], [ %23, %4 ]
%6 = trunc i64 %5 to i32
%7 = tail call i32 @func(i32 0, i32 %6, i32** %3)
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 0, i64 %5
store i32 %7, i32* %8
%9 = tail call i32 @func(i32 1, i32 %6, i32** %3)
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 1, i64 %5
store i32 %9, i32* %10
%11 = tail call i32 @func(i32 2, i32 %6, i32** %3)
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 2, i64 %5
store i32 %11, i32* %12
%13 = tail call i32 @func(i32 3, i32 %6, i32** %3)
%14 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 3, i64 %5
store i32 %13, i32* %14
%15 = tail call i32 @func(i32 4, i32 %6, i32** %3)
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 4, i64 %5
store i32 %15, i32* %16
%17 = tail call i32 @func(i32 5, i32 %6, i32** %3)
%18 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 5, i64 %5
store i32 %17, i32* %18
%19 = tail call i32 @func(i32 6, i32 %6, i32** %3)
%20 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 6, i64 %5
store i32 %19, i32* %20
%21 = tail call i32 @func(i32 7, i32 %6, i32** %3)
%22 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 7, i64 %5
store i32 %21, i32* %22
%23 = add nuw nsw i64 %5, 1
%24 = icmp eq i64 %23, 8
br i1 %24, label %25, label %4
25: ; preds = %4
ret void
}