#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ stdout;
void weights_growth(double(**obs_ptr), int num_eps, unsigned long convpoint,
                    FILE *file_ptr) {
  double sum;
  fprintf(file_ptr, "%lu ", convpoint);
  for (int dim1 = 0; dim1 < num_eps; ++dim1) {
    sum = 0.0;
    for (int dim2 = 0; dim2 < 10; ++dim2) {
      sum += obs_ptr[dim1][dim2];
    }
    fprintf(file_ptr, "%e ", sum);
  }
  fprintf(file_ptr, "\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<weights_growth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cb <weights_growth+0xab>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0xa,-0x30(%rbp)
jge    11a6 <weights_growth+0x86>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    116f <weights_growth+0x4f>
mov    -0x20(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
lea    0xe4f(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1154 <weights_growth+0x34>
mov    -0x20(%rbp),%rdi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<weights_growth>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r12
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xec1(%rip),%rsi
mov    %rcx,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %ebp,%ebp
jle    11b3 <weights_growth+0x83>
mov    %ebp,%ebp
xor    %ebx,%ebx
lea    0xead(%rip),%r15
mov    (%r14,%rbx,8),%rax
movsd  (%rax),%xmm0
addsd  0xe90(%rip),%xmm0
addsd  0x8(%rax),%xmm0
addsd  0x10(%rax),%xmm0
addsd  0x18(%rax),%xmm0
addsd  0x20(%rax),%xmm0
addsd  0x28(%rax),%xmm0
addsd  0x30(%rax),%xmm0
addsd  0x38(%rax),%xmm0
addsd  0x40(%rax),%xmm0
addsd  0x48(%rax),%xmm0
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <weights_growth+0x30>
mov    $0xa,%edi
mov    %r12,%rsi
call   1030 <fputc@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%lu \00"
@.str.1 = [4 x i8] c"%e \00"
@.str.2 = [2 x i8] c"\0A\00"
@stdout = global i32 0
define void @weights_growth(double** %0, i32 %1, i64 %2, i32* %3) {
%5 = alloca double**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32*
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
store double** %0, double*** %5
store i32 %1, i32* %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%12 = load i32*, i32** %8
%13 = load i64, i64* %7
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %13)
store i32 0, i32* %10
br label %15
15: ; preds = %42, %4
%16 = load i32, i32* %10
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %45
19: ; preds = %15
store double 0.000000e+00, double* %9
store i32 0, i32* %11
br label %20
20: ; preds = %35, %19
%21 = load i32, i32* %11
%22 = icmp slt i32 %21, 10
br i1 %22, label %23, label %38
23: ; preds = %20
%24 = load double**, double*** %5
%25 = load i32, i32* %10
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double*, double** %24, i64 %26
%28 = load double*, double** %27
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
%33 = load double, double* %9
%34 = fadd double %33, %32
store double %34, double* %9
br label %35
35: ; preds = %23
%36 = load i32, i32* %11
%37 = add nsw i32 %36, 1
store i32 %37, i32* %11
br label %20
38: ; preds = %20
%39 = load i32*, i32** %8
%40 = load double, double* %9
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %40)
br label %42
42: ; preds = %38
%43 = load i32, i32* %10
%44 = add nsw i32 %43, 1
store i32 %44, i32* %10
br label %15
45: ; preds = %15
%46 = load i32*, i32** %8
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%48 = load i32, i32* @stdout
%49 = call i32 @fflush(i32 %48)
ret void
}

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