#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ glbPrintDelimiter(int /*<<< orphan*/ *, char);
void glb_channel_printf_mathematica(FILE *stream, const double *energy,
                                    const double **res, size_t l, size_t c) {
  int i, k;
  fprintf(stream, "\n");
  glbPrintDelimiter(stream, 'l');
  for (k = 0; k < c; k++) {
    glbPrintDelimiter(stream, 'l');
    for (i = 0; i < l; i++) {
      glbPrintDelimiter(stream, 'l');
      fprintf(stream, "%f", energy[i]);
      glbPrintDelimiter(stream, 'm');
      fprintf(stream, "%f", res[k][i]);
      glbPrintDelimiter(stream, 'r');
      if (i < l - 1)
        glbPrintDelimiter(stream, 'm');
    }
    glbPrintDelimiter(stream, 'r');
    if (k < c - 1)
      glbPrintDelimiter(stream, 'm');
  }
  glbPrintDelimiter(stream, 'r');
  fprintf(stream, "\n");
}


x86 assembly (clang, -O0):
<glb_channel_printf_mathematica>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x6c,%esi
call   1040 <glbPrintDelimiter@plt>
movl   $0x0,-0x30(%rbp)
movslq -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    127e <glb_channel_printf_mathematica+0x15e>
mov    -0x8(%rbp),%rdi
mov    $0x6c,%esi
call   1040 <glbPrintDelimiter@plt>
movl   $0x0,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    123a <glb_channel_printf_mathematica+0x11a>
mov    -0x8(%rbp),%rdi
mov    $0x6c,%esi
call   1040 <glbPrintDelimiter@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe48(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x6d,%esi
call   1040 <glbPrintDelimiter@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe13(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x72,%esi
call   1040 <glbPrintDelimiter@plt>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    1227 <glb_channel_printf_mathematica+0x107>
mov    -0x8(%rbp),%rdi
mov    $0x6d,%esi
call   1040 <glbPrintDelimiter@plt>
jmp    122c <glb_channel_printf_mathematica+0x10c>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1186 <glb_channel_printf_mathematica+0x66>
mov    -0x8(%rbp),%rdi
mov    $0x72,%esi
call   1040 <glbPrintDelimiter@plt>
movslq -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    126b <glb_channel_printf_mathematica+0x14b>
mov    -0x8(%rbp),%rdi
mov    $0x6d,%esi
call   1040 <glbPrintDelimiter@plt>
jmp    1270 <glb_channel_printf_mathematica+0x150>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1163 <glb_channel_printf_mathematica+0x43>
mov    -0x8(%rbp),%rdi
mov    $0x72,%esi
call   1040 <glbPrintDelimiter@plt>
mov    -0x8(%rbp),%rdi
lea    0xd69(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glb_channel_printf_mathematica>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%rbp
mov    %rcx,%r15
mov    %rdx,0x20(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,%rbx
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
mov    %rbx,%rdi
mov    $0x6c,%esi
call   1050 <glbPrintDelimiter@plt>
mov    %rbp,0x8(%rsp)
test   %rbp,%rbp
je     127a <glb_channel_printf_mathematica+0x14a>
lea    -0x1(%r15),%r14
mov    0x8(%rsp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,0x10(%rsp)
xor    %r12d,%r12d
lea    0xe6b(%rip),%rbp
jmp    11af <glb_channel_printf_mathematica+0x7f>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12
cmp    0x8(%rsp),%r12
je     127a <glb_channel_printf_mathematica+0x14a>
mov    %rbx,%rdi
mov    $0x6c,%esi
call   1050 <glbPrintDelimiter@plt>
test   %r15,%r15
je     1250 <glb_channel_printf_mathematica+0x120>
xor    %r13d,%r13d
jmp    11d9 <glb_channel_printf_mathematica+0xa9>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r13
cmp    %r13,%r15
je     1250 <glb_channel_printf_mathematica+0x120>
mov    %rbx,%rdi
mov    $0x6c,%esi
call   1050 <glbPrintDelimiter@plt>
mov    0x18(%rsp),%rax
movsd  (%rax,%r13,8),%xmm0
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x6d,%esi
call   1050 <glbPrintDelimiter@plt>
mov    0x20(%rsp),%rax
mov    (%rax,%r12,8),%rax
movsd  (%rax,%r13,8),%xmm0
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x72,%esi
call   1050 <glbPrintDelimiter@plt>
cmp    %r13,%r14
jbe    11d0 <glb_channel_printf_mathematica+0xa0>
mov    %rbx,%rdi
mov    $0x6d,%esi
call   1050 <glbPrintDelimiter@plt>
jmp    11d0 <glb_channel_printf_mathematica+0xa0>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x72,%esi
call   1050 <glbPrintDelimiter@plt>
cmp    %r12,0x10(%rsp)
jbe    11a0 <glb_channel_printf_mathematica+0x70>
mov    %rbx,%rdi
mov    $0x6d,%esi
call   1050 <glbPrintDelimiter@plt>
jmp    11a0 <glb_channel_printf_mathematica+0x70>
mov    %rbx,%rdi
mov    $0x72,%esi
call   1050 <glbPrintDelimiter@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [3 x i8] c"%f\00"
define void @glb_channel_printf_mathematica(i32* %0, double* %1, double** %2, i64 %3, i64 %4) {
%6 = alloca i32*
%7 = alloca double*
%8 = alloca double**
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %6
store double* %1, double** %7
store double** %2, double*** %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%13 = load i32*, i32** %6
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = load i32*, i32** %6
%16 = call i32 @glbPrintDelimiter(i32* %15, i8 signext 108)
store i32 0, i32* %12
br label %17
17: ; preds = %79, %5
%18 = load i32, i32* %12
%19 = sext i32 %18 to i64
%20 = load i64, i64* %10
%21 = icmp ult i64 %19, %20
br i1 %21, label %22, label %82
22: ; preds = %17
%23 = load i32*, i32** %6
%24 = call i32 @glbPrintDelimiter(i32* %23, i8 signext 108)
store i32 0, i32* %11
br label %25
25: ; preds = %64, %22
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = load i64, i64* %9
%29 = icmp ult i64 %27, %28
br i1 %29, label %30, label %67
30: ; preds = %25
%31 = load i32*, i32** %6
%32 = call i32 @glbPrintDelimiter(i32* %31, i8 signext 108)
%33 = load i32*, i32** %6
%34 = load double*, double** %7
%35 = load i32, i32* %11
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
%38 = load double, double* %37
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %38)
%40 = load i32*, i32** %6
%41 = call i32 @glbPrintDelimiter(i32* %40, i8 signext 109)
%42 = load i32*, i32** %6
%43 = load double**, double*** %8
%44 = load i32, i32* %12
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double*, double** %43, i64 %45
%47 = load double*, double** %46
%48 = load i32, i32* %11
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %51)
%53 = load i32*, i32** %6
%54 = call i32 @glbPrintDelimiter(i32* %53, i8 signext 114)
%55 = load i32, i32* %11
%56 = sext i32 %55 to i64
%57 = load i64, i64* %9
%58 = sub i64 %57, 1
%59 = icmp ult i64 %56, %58
br i1 %59, label %60, label %63
60: ; preds = %30
%61 = load i32*, i32** %6
%62 = call i32 @glbPrintDelimiter(i32* %61, i8 signext 109)
br label %63
63: ; preds = %60, %30
br label %64
64: ; preds = %63
%65 = load i32, i32* %11
%66 = add nsw i32 %65, 1
store i32 %66, i32* %11
br label %25
67: ; preds = %25
%68 = load i32*, i32** %6
%69 = call i32 @glbPrintDelimiter(i32* %68, i8 signext 114)
%70 = load i32, i32* %12
%71 = sext i32 %70 to i64
%72 = load i64, i64* %10
%73 = sub i64 %72, 1
%74 = icmp ult i64 %71, %73
br i1 %74, label %75, label %78
75: ; preds = %67
%76 = load i32*, i32** %6
%77 = call i32 @glbPrintDelimiter(i32* %76, i8 signext 109)
br label %78
78: ; preds = %75, %67
br label %79
79: ; preds = %78
%80 = load i32, i32* %12
%81 = add nsw i32 %80, 1
store i32 %81, i32* %12
br label %17
82: ; preds = %17
%83 = load i32*, i32** %6
%84 = call i32 @glbPrintDelimiter(i32* %83, i8 signext 114)
%85 = load i32*, i32** %6
%86 = call i32 (i32*, i8*, ...) @fprintf(i32* %85, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
define void @glb_channel_printf_mathematica(i32* %0, double* nocapture %1, double** nocapture %2, i64 %3, i64 %4) {
%6 = tail call i32 @fputc(i32 10, i32* %0)
%7 = tail call i32 @glbPrintDelimiter(i32* %0, i8 signext 108)
%8 = icmp eq i64 %4, 0
br i1 %8, label %44, label %9
9: ; preds = %5
%10 = icmp eq i64 %3, 0
%11 = add i64 %3, -1
%12 = add i64 %4, -1
br label %13
13: ; preds = %9, %41
%14 = phi i64 [ 0, %9 ], [ %42, %41 ]
%15 = tail call i32 @glbPrintDelimiter(i32* %0, i8 signext 108)
br i1 %10, label %36, label %16
16: ; preds = %13
%17 = getelementptr inbounds double*, double** %2, i64 %14
br label %18
18: ; preds = %16, %33
%19 = phi i64 [ 0, %16 ], [ %34, %33 ]
%20 = tail call i32 @glbPrintDelimiter(i32* %0, i8 signext 108)
%21 = getelementptr inbounds double, double* %1, i64 %19
%22 = load double, double* %21
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %22)
%24 = tail call i32 @glbPrintDelimiter(i32* %0, i8 signext 109)
%25 = load double*, double** %17
%26 = getelementptr inbounds double, double* %25, i64 %19
%27 = load double, double* %26
%28 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %27)
%29 = tail call i32 @glbPrintDelimiter(i32* %0, i8 signext 114)
%30 = icmp ugt i64 %11, %19
br i1 %30, label %31, label %33
31: ; preds = %18
%32 = tail call i32 @glbPrintDelimiter(i32* %0, i8 signext 109)
br label %33
33: ; preds = %18, %31
%34 = add nuw i64 %19, 1
%35 = icmp eq i64 %34, %3
br i1 %35, label %36, label %18
36: ; preds = %33, %13
%37 = tail call i32 @glbPrintDelimiter(i32* %0, i8 signext 114)
%38 = icmp ugt i64 %12, %14
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = tail call i32 @glbPrintDelimiter(i32* %0, i8 signext 109)
br label %41
41: ; preds = %36, %39
%42 = add nuw i64 %14, 1
%43 = icmp eq i64 %42, %4
br i1 %43, label %44, label %13
44: ; preds = %41, %5
%45 = tail call i32 @glbPrintDelimiter(i32* %0, i8 signext 114)
%46 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}