#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 /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ njColIDCT(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/);
int /*<<< orphan*/ njRowIDCT(int /*<<< orphan*/ *);
void pjpeg_idct_2D_nanojpeg(int32_t in[64], uint8_t *out, uint32_t outstride) {
  int coef;
  for (coef = 0; coef < 64; coef += 8)
    njRowIDCT(&in[coef]);
  for (coef = 0; coef < 8; ++coef)
    njColIDCT(&in[coef], &out[coef], outstride);
}


x86 assembly (clang, -O0):
<pjpeg_idct_2D_nanojpeg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x40,-0x18(%rbp)
jge    1166 <pjpeg_idct_2D_nanojpeg+0x46>
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <njRowIDCT@plt>
mov    -0x18(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <pjpeg_idct_2D_nanojpeg+0x1a>
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    11ab <pjpeg_idct_2D_nanojpeg+0x8b>
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
call   1040 <njColIDCT@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116d <pjpeg_idct_2D_nanojpeg+0x4d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pjpeg_idct_2D_nanojpeg>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <njRowIDCT@plt>
lea    0x20(%rbp),%rdi
call   1030 <njRowIDCT@plt>
lea    0x40(%rbp),%rdi
call   1030 <njRowIDCT@plt>
lea    0x60(%rbp),%rdi
call   1030 <njRowIDCT@plt>
lea    0x80(%rbp),%rdi
call   1030 <njRowIDCT@plt>
lea    0xa0(%rbp),%rdi
call   1030 <njRowIDCT@plt>
lea    0xc0(%rbp),%rdi
call   1030 <njRowIDCT@plt>
lea    0xe0(%rbp),%rdi
call   1030 <njRowIDCT@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1040 <njColIDCT@plt>
lea    0x4(%rbp),%rdi
lea    0x4(%rbx),%rsi
mov    %r14d,%edx
call   1040 <njColIDCT@plt>
lea    0x8(%rbp),%rdi
lea    0x8(%rbx),%rsi
mov    %r14d,%edx
call   1040 <njColIDCT@plt>
lea    0xc(%rbp),%rdi
lea    0xc(%rbx),%rsi
mov    %r14d,%edx
call   1040 <njColIDCT@plt>
lea    0x10(%rbp),%rdi
lea    0x10(%rbx),%rsi
mov    %r14d,%edx
call   1040 <njColIDCT@plt>
lea    0x14(%rbp),%rdi
lea    0x14(%rbx),%rsi
mov    %r14d,%edx
call   1040 <njColIDCT@plt>
lea    0x18(%rbp),%rdi
lea    0x18(%rbx),%rsi
mov    %r14d,%edx
call   1040 <njColIDCT@plt>
add    $0x1c,%rbp
add    $0x1c,%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <njColIDCT@plt>

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

LLVM IR (-O2):
define void @pjpeg_idct_2D_nanojpeg(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32 @njRowIDCT(i32* %0)
%5 = getelementptr inbounds i32, i32* %0, i64 8
%6 = tail call i32 @njRowIDCT(i32* %5)
%7 = getelementptr inbounds i32, i32* %0, i64 16
%8 = tail call i32 @njRowIDCT(i32* %7)
%9 = getelementptr inbounds i32, i32* %0, i64 24
%10 = tail call i32 @njRowIDCT(i32* %9)
%11 = getelementptr inbounds i32, i32* %0, i64 32
%12 = tail call i32 @njRowIDCT(i32* %11)
%13 = getelementptr inbounds i32, i32* %0, i64 40
%14 = tail call i32 @njRowIDCT(i32* %13)
%15 = getelementptr inbounds i32, i32* %0, i64 48
%16 = tail call i32 @njRowIDCT(i32* %15)
%17 = getelementptr inbounds i32, i32* %0, i64 56
%18 = tail call i32 @njRowIDCT(i32* %17)
%19 = tail call i32 @njColIDCT(i32* %0, i32* %1, i32 %2)
%20 = getelementptr inbounds i32, i32* %0, i64 1
%21 = getelementptr inbounds i32, i32* %1, i64 1
%22 = tail call i32 @njColIDCT(i32* %20, i32* %21, i32 %2)
%23 = getelementptr inbounds i32, i32* %0, i64 2
%24 = getelementptr inbounds i32, i32* %1, i64 2
%25 = tail call i32 @njColIDCT(i32* %23, i32* %24, i32 %2)
%26 = getelementptr inbounds i32, i32* %0, i64 3
%27 = getelementptr inbounds i32, i32* %1, i64 3
%28 = tail call i32 @njColIDCT(i32* %26, i32* %27, i32 %2)
%29 = getelementptr inbounds i32, i32* %0, i64 4
%30 = getelementptr inbounds i32, i32* %1, i64 4
%31 = tail call i32 @njColIDCT(i32* %29, i32* %30, i32 %2)
%32 = getelementptr inbounds i32, i32* %0, i64 5
%33 = getelementptr inbounds i32, i32* %1, i64 5
%34 = tail call i32 @njColIDCT(i32* %32, i32* %33, i32 %2)
%35 = getelementptr inbounds i32, i32* %0, i64 6
%36 = getelementptr inbounds i32, i32* %1, i64 6
%37 = tail call i32 @njColIDCT(i32* %35, i32* %36, i32 %2)
%38 = getelementptr inbounds i32, i32* %0, i64 7
%39 = getelementptr inbounds i32, i32* %1, i64 7
%40 = tail call i32 @njColIDCT(i32* %38, i32* %39, i32 %2)
ret void
}