#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 *, ...);
void table_print(int N, double **Q, double **C) {
  int i, j;
  printf("\n--------- Q Table ---------\n");
  for (j = 0; j < 3; j++) {
    for (i = 0; i < N; i++) {
      printf("%f   ", Q[i][j]);
    }
    printf("\n");
  }
  printf("\n\n--------- C Table ---------\n");
  for (j = 0; j < 3; j++) {
    for (i = 0; i < N; i++) {
      printf("%f   ", C[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<table_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    11a2 <table_print+0x92>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1186 <table_print+0x76>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xead(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1149 <table_print+0x39>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1138 <table_print+0x28>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    1221 <table_print+0x111>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1205 <table_print+0xf5>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe2e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c8 <table_print+0xb8>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b7 <table_print+0xa7>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<table_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %edi,%r14d
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%r13d
test   %r14d,%r14d
jle    120f <table_print+0xdf>
xor    %ebx,%ebx
lea    0xe9b(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%rbp,%rbx,8),%rax
movsd  (%rax),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1170 <table_print+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    1219 <table_print+0xe9>
xor    %ebx,%ebx
lea    0xe5c(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%rbp,%rbx,8),%rax
movsd  0x8(%rax),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11b0 <table_print+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    12ee <table_print+0x1be>
xor    %ebx,%ebx
lea    0xe17(%rip),%r12
nopl   0x0(%rax)
mov    0x0(%rbp,%rbx,8),%rax
movsd  0x10(%rax),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11f0 <table_print+0xc0>
jmp    1223 <table_print+0xf3>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdef(%rip),%rdi
call   1040 <puts@plt>
test   %r14d,%r14d
jle    1304 <table_print+0x1d4>
xor    %ebx,%ebx
lea    0xdb5(%rip),%rbp
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rax
movsd  (%rax),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1250 <table_print+0x120>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    130e <table_print+0x1de>
xor    %ebx,%ebx
lea    0xd79(%rip),%rbp
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rax
movsd  0x8(%rax),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1290 <table_print+0x160>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    1318 <table_print+0x1e8>
xor    %ebx,%ebx
lea    0xd3c(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15,%rbx,8),%rax
movsd  0x10(%rax),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    12d0 <table_print+0x1a0>
jmp    1318 <table_print+0x1e8>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd24(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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