#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 uint8_t;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ idct_block(int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int32_t g[] = {-416, -33, -60, 32,  48, -40, 0,   0,   0, -24, -56, 19,  26,
                 0,    0,   0,   -42, 13, 80,  -24, -40, 0, 0,   0,   -42, 17,
                 44,   -29, 0,   0,   0,  0,   18,  0,   0, 0,   0,   0,   0,
                 0,    0,   0,   0,   0,  0,   0,   0,   0, 0,   0,   0,   0,
                 0,    0,   0,   0,   0,  0,   0,   0,   0, 0,   0,   0};
  int32_t f[] = {-27, -168, 80, -45, -45, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 0,   0,    0,  0,   0,   0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,
                 0,   0,    0,  0,   0,   0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,
                 0,   0,    0,  0,   0,   0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0};
  for (uint8_t i = 0; i < 8; i++) {
    for (uint8_t j = 0; j < 8; j++)
      printf("%d ", g[i * 8 + j]);
    printf("\n");
  }
  printf("\n");
  uint8_t G[64];
  idct_block(f, G);
  printf("\n");
  for (uint8_t i = 0; i < 8; i++) {
    for (uint8_t j = 0; j < 8; j++)
      printf("%d ", G[i * 8 + j]);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x100,%edx
call   1040 <memcpy@plt>
lea    -0x210(%rbp),%rdi
lea    0xf98(%rip),%rsi
mov    $0x100,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x214(%rbp)
cmpl   $0x8,-0x214(%rbp)
jge    11fc <main+0xcc>
movl   $0x0,-0x218(%rbp)
cmpl   $0x8,-0x218(%rbp)
jge    11da <main+0xaa>
mov    -0x214(%rbp),%eax
shl    $0x3,%eax
add    -0x218(%rbp),%eax
cltq
mov    -0x110(%rbp,%rax,4),%esi
lea    0x1041(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    1193 <main+0x63>
lea    0x1023(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
jmp    117c <main+0x4c>
lea    0x1001(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x210(%rbp),%rdi
lea    -0x320(%rbp),%rsi
call   1050 <idct_block@plt>
lea    0xfe0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x324(%rbp)
cmpl   $0x8,-0x324(%rbp)
jge    12b5 <main+0x185>
movl   $0x0,-0x328(%rbp)
cmpl   $0x8,-0x328(%rbp)
jge    1293 <main+0x163>
mov    -0x324(%rbp),%eax
shl    $0x3,%eax
add    -0x328(%rbp),%eax
cltq
mov    -0x320(%rbp,%rax,4),%esi
lea    0xf88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x328(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x328(%rbp)
jmp    124c <main+0x11c>
lea    0xf6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x324(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x324(%rbp)
jmp    1235 <main+0x105>
xor    %eax,%eax
add    $0x330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x208,%rsp
lea    0xfac(%rip),%rsi
lea    0x100(%rsp),%rdi
mov    $0x100,%edx
call   1050 <memcpy@plt>
lea    0xe93(%rip),%r14
lea    0x108c(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%rbx,%r14,1),%esi
mov    0x4(%rbx,%r14,1),%ebp
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx,%r14,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rbx,%r14,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx,%r14,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rbx,%r14,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rbx,%r14,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rbx,%r14,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rbx
cmp    $0x100,%rbx
jne    1180 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x100(%rsp),%rdi
mov    %rsp,%rsi
call   1060 <idct_block@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xfc1(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rbp
cmp    $0x100,%rbp
jne    1250 <main+0x110>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.g = <{ [33 x i32], [31 x i32] }> <{ [33 x i32] [i32 -416, i32 -33, i32 -60, i32 32, i32 48, i32 -40, i32 0, i32 0, i32 0, i32 -24, i32 -56, i32 19, i32 26, i32 0, i32 0, i32 0, i32 -42, i32 13, i32 80, i32 -24, i32 -40, i32 0, i32 0, i32 0, i32 -42, i32 17, i32 44, i32 -29, i32 0, i32 0, i32 0, i32 0, i32 18], [31 x i32] zeroinitializer }>
@__const.main.f = <{ i32, i32, i32, i32, i32, i32, i32, [57 x i32] }> <{ i32 -27, i32 -168, i32 80, i32 -45, i32 -45, i32 16, i32 16, [57 x i32] zeroinitializer }>
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [64 x i32]
%3 = alloca [64 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca [64 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [64 x i32]* %2 to i8*
%10 = bitcast [64 x i32]* %3 to i8*
store i32 0, i32* %4
br label %11
11: ; preds = %32, %0
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %35
14: ; preds = %11
store i32 0, i32* %5
br label %15
15: ; preds = %27, %14
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 8
br i1 %17, label %18, label %30
18: ; preds = %15
%19 = load i32, i32* %4
%20 = mul nsw i32 %19, 8
%21 = load i32, i32* %5
%22 = add nsw i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %18
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %15
30: ; preds = %15
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %11
35: ; preds = %11
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%37 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%38 = getelementptr inbounds [64 x i32], [64 x i32]* %6, i64 0, i64 0
%39 = call i32 @idct_block(i32* %37, i32* %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %7
br label %41
41: ; preds = %62, %35
%42 = load i32, i32* %7
%43 = icmp slt i32 %42, 8
br i1 %43, label %44, label %65
44: ; preds = %41
store i32 0, i32* %8
br label %45
45: ; preds = %57, %44
%46 = load i32, i32* %8
%47 = icmp slt i32 %46, 8
br i1 %47, label %48, label %60
48: ; preds = %45
%49 = load i32, i32* %7
%50 = mul nsw i32 %49, 8
%51 = load i32, i32* %8
%52 = add nsw i32 %50, %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [64 x i32], [64 x i32]* %6, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %48
%58 = load i32, i32* %8
%59 = add nsw i32 %58, 1
store i32 %59, i32* %8
br label %45
60: ; preds = %45
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %62
62: ; preds = %60
%63 = load i32, i32* %7
%64 = add nsw i32 %63, 1
store i32 %64, i32* %7
br label %41
65: ; preds = %41
ret i32 0
}

LLVM IR (-O2):
@__const.main.g = <{ [33 x i32], [31 x i32] }> <{ [33 x i32] [i32 -416, i32 -33, i32 -60, i32 32, i32 48, i32 -40, i32 0, i32 0, i32 0, i32 -24, i32 -56, i32 19, i32 26, i32 0, i32 0, i32 0, i32 -42, i32 13, i32 80, i32 -24, i32 -40, i32 0, i32 0, i32 0, i32 -42, i32 17, i32 44, i32 -29, i32 0, i32 0, i32 0, i32 0, i32 18], [31 x i32] zeroinitializer }>
@__const.main.f = <{ i32, i32, i32, i32, i32, i32, i32, [57 x i32] }> <{ i32 -27, i32 -168, i32 80, i32 -45, i32 -45, i32 16, i32 16, [57 x i32] zeroinitializer }>
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [64 x i32]
%2 = alloca [64 x i32]
%3 = bitcast [64 x i32]* %1 to i8*
br label %4
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %39, %4 ]
%6 = shl nsw i64 %5, 3
%7 = getelementptr inbounds [64 x i32], [64 x i32]* bitcast (<{ [33 x i32], [31 x i32] }>* @__const.main.g to [64 x i32]*), i64 0, i64 %6
%8 = load i32, i32* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = or i64 %6, 1
%11 = getelementptr inbounds [64 x i32], [64 x i32]* bitcast (<{ [33 x i32], [31 x i32] }>* @__const.main.g to [64 x i32]*), i64 0, i64 %10
%12 = load i32, i32* %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = or i64 %6, 2
%15 = getelementptr inbounds [64 x i32], [64 x i32]* bitcast (<{ [33 x i32], [31 x i32] }>* @__const.main.g to [64 x i32]*), i64 0, i64 %14
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = or i64 %6, 3
%19 = getelementptr inbounds [64 x i32], [64 x i32]* bitcast (<{ [33 x i32], [31 x i32] }>* @__const.main.g to [64 x i32]*), i64 0, i64 %18
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = or i64 %6, 4
%23 = getelementptr inbounds [64 x i32], [64 x i32]* bitcast (<{ [33 x i32], [31 x i32] }>* @__const.main.g to [64 x i32]*), i64 0, i64 %22
%24 = load i32, i32* %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = or i64 %6, 5
%27 = getelementptr inbounds [64 x i32], [64 x i32]* bitcast (<{ [33 x i32], [31 x i32] }>* @__const.main.g to [64 x i32]*), i64 0, i64 %26
%28 = load i32, i32* %27
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = or i64 %6, 6
%31 = getelementptr inbounds [64 x i32], [64 x i32]* bitcast (<{ [33 x i32], [31 x i32] }>* @__const.main.g to [64 x i32]*), i64 0, i64 %30
%32 = load i32, i32* %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = or i64 %6, 7
%35 = getelementptr inbounds [64 x i32], [64 x i32]* bitcast (<{ [33 x i32], [31 x i32] }>* @__const.main.g to [64 x i32]*), i64 0, i64 %34
%36 = load i32, i32* %35
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = tail call i32 @putchar(i32 10)
%39 = add nuw nsw i64 %5, 1
%40 = icmp eq i64 %39, 8
br i1 %40, label %41, label %4
41: ; preds = %4
%42 = tail call i32 @putchar(i32 10)
%43 = bitcast [64 x i32]* %2 to i8*
%44 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 0
%45 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
%46 = call i32 @idct_block(i32* %44, i32* %45)
%47 = call i32 @putchar(i32 10)
br label %48
48: ; preds = %41, %48
%49 = phi i64 [ 0, %41 ], [ %83, %48 ]
%50 = shl nsw i64 %49, 3
%51 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %52)
%54 = or i64 %50, 1
%55 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %56)
%58 = or i64 %50, 2
%59 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %60)
%62 = or i64 %50, 3
%63 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %64)
%66 = or i64 %50, 4
%67 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %66
%68 = load i32, i32* %67
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %68)
%70 = or i64 %50, 5
%71 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %70
%72 = load i32, i32* %71
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %72)
%74 = or i64 %50, 6
%75 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %74
%76 = load i32, i32* %75
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %76)
%78 = or i64 %50, 7
%79 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %78
%80 = load i32, i32* %79
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %80)
%82 = call i32 @putchar(i32 10)
%83 = add nuw nsw i64 %49, 1
%84 = icmp eq i64 %83, 8
br i1 %84, label %85, label %48
85: ; preds = %48
ret i32 0
}