#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*/ printf(char *, ...);
int main(int argc, char **argv) {
  printf("int OD_DIRECTION_OFFSETS_TABLE[8][3] = {\n");
  int offset[3];
  for (int dir = 0; dir < 8; dir++) {
    int k;
    int f;
    printf("  {");
    if (dir <= 4) {
      f = dir - 2;
      for (int k = 1; k <= 3; k++) {
        printf("%2i*OD_FILT_BSTRIDE + %2i", f * k / 2, k);
        if (k < 3) {
          printf(",");
        }
      }
    } else {
      f = 6 - dir;
      for (int k = 1; k <= 3; k++) {
        printf("%2i*OD_FILT_BSTRIDE + %2i", k, f * k / 2);
        if (k < 3) {
          printf(",");
        }
      }
    }
    printf(" }");
    if (dir < 15) {
      printf(",\n");
    }
  }
  printf("\n};\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x8,-0x20(%rbp)
jge    1270 <main+0x160>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x4,-0x20(%rbp)
jg     11c9 <main+0xb9>
mov    -0x20(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jg     11c4 <main+0xb4>
mov    -0x28(%rbp),%eax
imul   -0x2c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x2c(%rbp),%edx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x2c(%rbp)
jge    11b1 <main+0xa1>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b6 <main+0xa6>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    116d <main+0x5d>
jmp    1237 <main+0x127>
mov    $0x6,%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jg     1232 <main+0x122>
mov    -0x30(%rbp),%esi
mov    -0x28(%rbp),%eax
imul   -0x30(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x30(%rbp)
jge    121f <main+0x10f>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1224 <main+0x114>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11db <main+0xcb>
jmp    1237 <main+0x127>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xf,-0x20(%rbp)
jge    125d <main+0x14d>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x152>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113b <main+0x2b>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xedf(%rip),%rdi
call   1040 <puts@plt>
mov    $0x6,%ebp
mov    $0x12,%r14d
mov    $0xfffffffe,%ebx
mov    $0xfa,%r12b
lea    0xea3(%rip),%r15
jmp    11f4 <main+0xc4>
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edx
shr    $0x1f,%edx
add    %ebp,%edx
sar    %edx
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2c,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    $0x2,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2c,%edi
call   1030 <putchar@plt>
mov    %r14d,%edx
shr    $0x1f,%edx
add    %r14d,%edx
sar    %edx
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe50(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe72(%rip),%rdi
call   1040 <puts@plt>
add    $0xffffffff,%ebp
add    $0xfffffffd,%r14d
add    $0x1,%ebx
add    $0x3,%r12b
cmp    $0xfffffffe,%ebp
je     126b <main+0x13b>
lea    0x2(%rbx),%r13d
lea    0xe01(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x4,%r13d
ja     1170 <main+0x40>
mov    %ebx,%eax
shr    $0x7,%al
add    %bl,%al
sar    %al
movsbl %al,%esi
mov    %r15,%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2c,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2c,%edi
call   1030 <putchar@plt>
mov    %r12d,%eax
shr    $0x7,%al
add    %r12b,%al
sar    %al
movsbl %al,%esi
mov    %r15,%rdi
mov    $0x3,%edx
jmp    11c0 <main+0x90>
lea    0xdd8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"int OD_DIRECTION_OFFSETS_TABLE[8][3] = {\0A\00"
@.str.1 = [4 x i8] c" {\00"
@.str.2 = [26 x i8] c"%2i*OD_FILT_BSTRIDE + %2i\00"
@.str.3 = [2 x i8] c",\00"
@.str.4 = [3 x i8] c" }\00"
@.str.5 = [3 x i8] c",\0A\00"
@.str.6 = [5 x i8] c"\0A};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %13
13: ; preds = %71, %2
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 8
br i1 %15, label %16, label %74
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* %7
%19 = icmp sle i32 %18, 4
br i1 %19, label %20, label %42
20: ; preds = %16
%21 = load i32, i32* %7
%22 = sub nsw i32 %21, 2
store i32 %22, i32* %9
store i32 1, i32* %10
br label %23
23: ; preds = %38, %20
%24 = load i32, i32* %10
%25 = icmp sle i32 %24, 3
br i1 %25, label %26, label %41
26: ; preds = %23
%27 = load i32, i32* %9
%28 = load i32, i32* %10
%29 = mul nsw i32 %27, %28
%30 = sdiv i32 %29, 2
%31 = load i32, i32* %10
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %31)
%33 = load i32, i32* %10
%34 = icmp slt i32 %33, 3
br i1 %34, label %35, label %37
35: ; preds = %26
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %26
br label %38
38: ; preds = %37
%39 = load i32, i32* %10
%40 = add nsw i32 %39, 1
store i32 %40, i32* %10
br label %23
41: ; preds = %23
br label %64
42: ; preds = %16
%43 = load i32, i32* %7
%44 = sub nsw i32 6, %43
store i32 %44, i32* %9
store i32 1, i32* %11
br label %45
45: ; preds = %60, %42
%46 = load i32, i32* %11
%47 = icmp sle i32 %46, 3
br i1 %47, label %48, label %63
48: ; preds = %45
%49 = load i32, i32* %11
%50 = load i32, i32* %9
%51 = load i32, i32* %11
%52 = mul nsw i32 %50, %51
%53 = sdiv i32 %52, 2
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %49, i32 %53)
%55 = load i32, i32* %11
%56 = icmp slt i32 %55, 3
br i1 %56, label %57, label %59
57: ; preds = %48
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %59
59: ; preds = %57, %48
br label %60
60: ; preds = %59
%61 = load i32, i32* %11
%62 = add nsw i32 %61, 1
store i32 %62, i32* %11
br label %45
63: ; preds = %45
br label %64
64: ; preds = %63, %41
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%66 = load i32, i32* %7
%67 = icmp slt i32 %66, 15
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %70
70: ; preds = %68, %64
br label %71
71: ; preds = %70
%72 = load i32, i32* %7
%73 = add nsw i32 %72, 1
store i32 %73, i32* %7
br label %13
74: ; preds = %13
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%76 = load i32, i32* %3
ret i32 %76
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c" {\00"
@.str.2 = [26 x i8] c"%2i*OD_FILT_BSTRIDE + %2i\00"
@.str.4 = [3 x i8] c" }\00"
@str = [41 x i8] c"int OD_DIRECTION_OFFSETS_TABLE[8][3] = {\00"
@str.7 = [4 x i8] c"\0A};\00"
@str.8 = [2 x i8] c",\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %6
4: ; preds = %34
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.7, i64 0, i64 0))
ret i32 0
6: ; preds = %2, %34
%7 = phi i32 [ 0, %2 ], [ %37, %34 ]
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ult i32 %7, 5
br i1 %9, label %10, label %24
10: ; preds = %6
%11 = add nsw i32 %7, -2
%12 = trunc i32 %11 to i8
%13 = sdiv i8 %12, 2
%14 = sext i8 %13 to i32
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 1)
%16 = tail call i32 @putchar(i32 44)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 2)
%18 = tail call i32 @putchar(i32 44)
%19 = trunc i32 %11 to i8
%20 = mul i8 %19, 3
%21 = sdiv i8 %20, 2
%22 = sext i8 %21 to i32
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 3)
br label %34
24: ; preds = %6
%25 = sub nsw i32 6, %7
%26 = sdiv i32 %25, 2
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %26)
%28 = tail call i32 @putchar(i32 44)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 %25)
%30 = tail call i32 @putchar(i32 44)
%31 = mul nsw i32 %25, 3
%32 = sdiv i32 %31, 2
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 %32)
br label %34
34: ; preds = %24, %10
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
%37 = add nuw nsw i32 %7, 1
%38 = icmp eq i32 %37, 8
br i1 %38, label %4, label %6
}