#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void lcfit2_print_array(const char *name, const size_t n, const double *x) {
  char *sep = "";
  fprintf(stderr, "%s = { ", name);
  for (size_t i = 0; i < n; ++i) {
    fprintf(stderr, "%s%g", sep, x[i]);
    sep = ", ";
  }
  fprintf(stderr, " }\n");
}


x86 assembly (clang, -O0):
<lcfit2_print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xee8(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11a4 <lcfit2_print_array+0x94>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe87(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
lea    0xe7e(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1152 <lcfit2_print_array+0x42>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcfit2_print_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%r13
mov    0x0(%r13),%edi
lea    0xeca(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %rbx,%rbx
je     11a0 <lcfit2_print_array+0x90>
mov    0x0(%r13),%edi
movsd  (%r14),%xmm0
lea    0xeb6(%rip),%rsi
lea    0xeba(%rip),%rdx
mov    $0x1,%al
call   1030 <fprintf@plt>
cmp    $0x1,%rbx
je     11a0 <lcfit2_print_array+0x90>
mov    $0x1,%ebp
lea    0xe96(%rip),%r15
lea    0xe94(%rip),%r12
nopl   0x0(%rax)
mov    0x0(%r13),%edi
movsd  (%r14,%rbp,8),%xmm0
mov    %r15,%rsi
mov    %r12,%rdx
mov    $0x1,%al
call   1030 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1180 <lcfit2_print_array+0x70>
mov    0x0(%r13),%edi
lea    0xe65(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [8 x i8] c"%s = { \00"
@.str.2 = [5 x i8] c"%s%g\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [4 x i8] c" }\0A\00"
define void @lcfit2_print_array(i8* %0, i64 %1, double* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca double*
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store double* %2, double** %6
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %7
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %4
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %10)
store i64 0, i64* %8
br label %12
12: ; preds = %24, %3
%13 = load i64, i64* %8
%14 = load i64, i64* %5
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %27
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %7
%19 = load double*, double** %6
%20 = load i64, i64* %8
%21 = getelementptr inbounds double, double* %19, i64 %20
%22 = load double, double* %21
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %18, double %22)
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %7
br label %24
24: ; preds = %16
%25 = load i64, i64* %8
%26 = add i64 %25, 1
store i64 %26, i64* %8
br label %12
27: ; preds = %12
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [8 x i8] c"%s = { \00"
@.str.2 = [5 x i8] c"%s%g\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [4 x i8] c" }\0A\00"
define void @lcfit2_print_array(i8* %0, i64 %1, double* nocapture %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = icmp eq i64 %1, 0
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = load double, double* %2
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), double %9)
%11 = icmp eq i64 %1, 1
br i1 %11, label %12, label %15
12: ; preds = %15, %7, %3
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
ret void
15: ; preds = %7, %15
%16 = phi i64 [ %21, %15 ], [ 1, %7 ]
%17 = load i32, i32* @stderr
%18 = getelementptr inbounds double, double* %2, i64 %16
%19 = load double, double* %18
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), double %19)
%21 = add nuw i64 %16, 1
%22 = icmp eq i64 %21, %1
br i1 %22, label %12, label %15
}