#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*/ write_named_array_f64(int /*<<< orphan*/ *, char *,
                                         double const *, unsigned int const);
void write_data_as_json(FILE *f, const double *x, const double *C,
                        const unsigned int len) {
  fprintf(f, "{");
  write_named_array_f64(f, "x", x, len);
  fprintf(f, ",");
  write_named_array_f64(f, "C", C, len);
  fprintf(f, "}");
}


x86 assembly (clang, -O0):
<write_data_as_json>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xea9(%rip),%rsi
call   1040 <write_named_array_f64@plt>
mov    -0x8(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xe86(%rip),%rsi
call   1040 <write_named_array_f64@plt>
mov    -0x8(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_data_as_json>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    $0x7b,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
lea    0xeba(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %ebp,%ecx
call   1040 <write_named_array_f64@plt>
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %ebp,%ecx
call   1040 <write_named_array_f64@plt>
mov    $0x7d,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"{\00"
@.str.1 = [2 x i8] c"x\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [2 x i8] c"C\00"
@.str.4 = [2 x i8] c"}\00"
define void @write_data_as_json(i32* %0, double* %1, double* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
store i32* %0, i32** %5
store double* %1, double** %6
store double* %2, double** %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = load i32*, i32** %5
%12 = load double*, double** %6
%13 = load i32, i32* %8
%14 = call i32 @write_named_array_f64(i32* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), double* %12, i32 %13)
%15 = load i32*, i32** %5
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32*, i32** %5
%18 = load double*, double** %7
%19 = load i32, i32* %8
%20 = call i32 @write_named_array_f64(i32* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), double* %18, i32 %19)
%21 = load i32*, i32** %5
%22 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"x\00"
@.str.3 = [2 x i8] c"C\00"
define void @write_data_as_json(i32* %0, double* %1, double* %2, i32 %3) {
%5 = tail call i32 @fputc(i32 123, i32* %0)
%6 = tail call i32 @write_named_array_f64(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), double* %1, i32 %3)
%7 = tail call i32 @fputc(i32 44, i32* %0)
%8 = tail call i32 @write_named_array_f64(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), double* %2, i32 %3)
%9 = tail call i32 @fputc(i32 125, i32* %0)
ret void
}