#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 int64_t;

/* Variables and functions */
int /*<<< orphan*/ generateValues(int, int, double *);
int /*<<< orphan*/ printf(char *, ...);
int sumCurrentAndPriorLayers(int, int);
int main(int argc, char **argv) {
  int i, dimensions, layer;
  int64_t layerSize;
  int64_t layerSizeSum;
  double valueArray[32];
  for (dimensions = 1; dimensions <= 32; dimensions++) {
    printf("dimensions:%i\n", dimensions);
    layer = 0;
    layerSizeSum = sumCurrentAndPriorLayers(dimensions, layer);
    layerSize = layerSizeSum - 0;
    while (layerSizeSum <= 0x100000000) {
      printf("\n");
      printf("layer %i size:%lld\n", layer, layerSize);
      printf("count %lld, starting values:\n", layerSizeSum - layerSize);
      generateValues(dimensions, layerSizeSum - layerSize, &valueArray[0]);
      for (i = 0; i < dimensions; i++) {
        printf("%.10f ", valueArray[i]);
      }
      printf("\n");
      printf("count %lld, ending values:\n", layerSizeSum - 1);
      generateValues(dimensions, layerSizeSum - 1, &valueArray[0]);
      for (i = 0; i < dimensions; i++) {
        printf("%.10f ", valueArray[i]);
      }
      printf("\n");
      layer++;
      layerSizeSum = sumCurrentAndPriorLayers(dimensions, layer);
      layerSize =
          layerSizeSum - sumCurrentAndPriorLayers(dimensions, layer - 1);
    }
    printf("\n\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0x20,-0x18(%rbp)
jg     1304 <main+0x1d4>
mov    -0x18(%rbp),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1050 <sumCurrentAndPriorLayers@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x0,%eax
mov    %eax,-0x20(%rbp)
movslq -0x24(%rbp),%rax
movabs $0x100000000,%rcx
cmp    %rcx,%rax
jg     12e8 <main+0x1b8>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
sub    -0x20(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
mov    -0x24(%rbp),%esi
sub    -0x20(%rbp),%esi
lea    -0x130(%rbp),%rdx
call   1040 <generateValues@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1227 <main+0xf7>
movslq -0x14(%rbp),%rax
movsd  -0x130(%rbp,%rax,8),%xmm0
ff ff
lea    0xe2f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f2 <main+0xc2>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
sub    $0x1,%esi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
mov    -0x24(%rbp),%esi
sub    $0x1,%esi
lea    -0x130(%rbp),%rdx
call   1040 <generateValues@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    129a <main+0x16a>
movslq -0x14(%rbp),%rax
movsd  -0x130(%rbp,%rax,8),%xmm0
ff ff
lea    0xdbc(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1265 <main+0x135>
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1050 <sumCurrentAndPriorLayers@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x134(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
sub    $0x1,%esi
call   1050 <sumCurrentAndPriorLayers@plt>
mov    %eax,%ecx
mov    -0x134(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
jmp    1189 <main+0x59>
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1150 <main+0x20>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
lea    0xea8(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1060 <sumCurrentAndPriorLayers@plt>
mov    %eax,%r14d
lea    0xec7(%rip),%r12
xor    %ebp,%ebp
mov    %eax,%r13d
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe7e(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13d,%r15d
sub    %r14d,%r15d
lea    0xe79(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
mov    %r15d,%esi
mov    %rsp,%rbx
mov    %rbx,%rdx
call   1050 <generateValues@plt>
movsd  (%rsp),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r13d
lea    0xe5d(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
call   1050 <generateValues@plt>
movsd  (%rsp),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%ebx
mov    $0x1,%edi
mov    %ebx,%esi
call   1060 <sumCurrentAndPriorLayers@plt>
mov    %eax,%r13d
mov    $0x1,%edi
mov    %ebp,%esi
call   1060 <sumCurrentAndPriorLayers@plt>
mov    %r13d,%r14d
sub    %eax,%r14d
mov    %ebx,%ebp
jmp    1180 <main+0x40>

LLVM IR (-O0):
@.str = [15 x i8] c"dimensions:%i\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [20 x i8] c"layer %i size:%lld\0A\00"
@.str.3 = [30 x i8] c"count %lld, starting values:\0A\00"
@.str.4 = [7 x i8] c"%.10f \00"
@.str.5 = [28 x i8] c"count %lld, ending values:\0A\00"
@.str.6 = [3 x i8] c"\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [32 x double]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
br label %12
12: ; preds = %93, %2
%13 = load i32, i32* %7
%14 = icmp sle i32 %13, 32
br i1 %14, label %15, label %96
15: ; preds = %12
%16 = load i32, i32* %7
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %16)
store i32 0, i32* %8
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = call i32 @sumCurrentAndPriorLayers(i32 %18, i32 %19)
store i32 %20, i32* %10
%21 = load i32, i32* %10
%22 = sub nsw i32 %21, 0
store i32 %22, i32* %9
br label %23
23: ; preds = %78, %15
%24 = load i32, i32* %10
%25 = sext i32 %24 to i64
%26 = icmp sle i64 %25, 4294967296
br i1 %26, label %27, label %91
27: ; preds = %23
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = load i32, i32* %8
%30 = load i32, i32* %9
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %30)
%32 = load i32, i32* %10
%33 = load i32, i32* %9
%34 = sub nsw i32 %32, %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %7
%37 = load i32, i32* %10
%38 = load i32, i32* %9
%39 = sub nsw i32 %37, %38
%40 = getelementptr inbounds [32 x double], [32 x double]* %11, i64 0, i64 0
%41 = call i32 @generateValues(i32 %36, i32 %39, double* %40)
store i32 0, i32* %6
br label %42
42: ; preds = %52, %27
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %55
46: ; preds = %42
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [32 x double], [32 x double]* %11, i64 0, i64 %48
%50 = load double, double* %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %50)
br label %52
52: ; preds = %46
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %42
55: ; preds = %42
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%57 = load i32, i32* %10
%58 = sub nsw i32 %57, 1
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %58)
%60 = load i32, i32* %7
%61 = load i32, i32* %10
%62 = sub nsw i32 %61, 1
%63 = getelementptr inbounds [32 x double], [32 x double]* %11, i64 0, i64 0
%64 = call i32 @generateValues(i32 %60, i32 %62, double* %63)
store i32 0, i32* %6
br label %65
65: ; preds = %75, %55
%66 = load i32, i32* %6
%67 = load i32, i32* %7
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %78
69: ; preds = %65
%70 = load i32, i32* %6
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [32 x double], [32 x double]* %11, i64 0, i64 %71
%73 = load double, double* %72
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %73)
br label %75
75: ; preds = %69
%76 = load i32, i32* %6
%77 = add nsw i32 %76, 1
store i32 %77, i32* %6
br label %65
78: ; preds = %65
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%80 = load i32, i32* %8
%81 = add nsw i32 %80, 1
store i32 %81, i32* %8
%82 = load i32, i32* %7
%83 = load i32, i32* %8
%84 = call i32 @sumCurrentAndPriorLayers(i32 %82, i32 %83)
store i32 %84, i32* %10
%85 = load i32, i32* %10
%86 = load i32, i32* %7
%87 = load i32, i32* %8
%88 = sub nsw i32 %87, 1
%89 = call i32 @sumCurrentAndPriorLayers(i32 %86, i32 %88)
%90 = sub nsw i32 %85, %89
store i32 %90, i32* %9
br label %23
91: ; preds = %23
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %93
93: ; preds = %91
%94 = load i32, i32* %7
%95 = add nsw i32 %94, 1
store i32 %95, i32* %7
br label %12
96: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"dimensions:%i\0A\00"
@.str.2 = [20 x i8] c"layer %i size:%lld\0A\00"
@.str.3 = [30 x i8] c"count %lld, starting values:\0A\00"
@.str.4 = [7 x i8] c"%.10f \00"
@.str.5 = [28 x i8] c"count %lld, ending values:\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [32 x double]
%4 = bitcast [32 x double]* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = tail call i32 @sumCurrentAndPriorLayers(i32 1, i32 0)
%7 = getelementptr inbounds [32 x double], [32 x double]* %3, i64 0, i64 0
br label %8
8: ; preds = %8, %2
%9 = phi i32 [ 0, %2 ], [ %26, %8 ]
%10 = phi i32 [ %6, %2 ], [ %29, %8 ]
%11 = phi i32 [ %6, %2 ], [ %27, %8 ]
%12 = call i32 @putchar(i32 10)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %10)
%14 = sub nsw i32 %11, %10
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = call i32 @generateValues(i32 1, i32 %14, double* %7)
%17 = load double, double* %7
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %17)
%19 = call i32 @putchar(i32 10)
%20 = add nsw i32 %11, -1
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %20)
%22 = call i32 @generateValues(i32 1, i32 %20, double* %7)
%23 = load double, double* %7
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %23)
%25 = call i32 @putchar(i32 10)
%26 = add nuw nsw i32 %9, 1
%27 = call i32 @sumCurrentAndPriorLayers(i32 1, i32 %26)
%28 = call i32 @sumCurrentAndPriorLayers(i32 1, i32 %9)
%29 = sub nsw i32 %27, %28
br label %8
}