#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 *, double);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite_repr(char *, int, int /*<<< orphan*/ *);
int zset_val(void *ctx, char *val, int vallen, double score) {
  FILE *fp = ctx;
  fputs("{\"data\":", fp);
  fwrite_repr(val, vallen, fp);
  fprintf(fp, ",\"score\":%.17g},", score);
  return 0;
}


x86 assembly (clang, -O0):
<zset_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   1050 <fwrite_repr@plt>
mov    -0x28(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zset_val>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xeb2(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %rbp,%rdx
call   1050 <fwrite_repr@plt>
lea    0xe94(%rip),%rsi
mov    %rbp,%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"{\22data\22:\00"
@.str.1 = [17 x i8] c",\22score\22:%.17g},\00"
define i32 @zset_val(i8* %0, i8* %1, i32 %2, double %3) {
%5 = bitcast i8* %0 to i32*
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 8, i64 1, i32* %5)
%7 = tail call i32 @fwrite_repr(i8* %1, i32 %2, i32* %5)
%8 = tail call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %3)
ret i32 0
}