#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 */
scalar_t__ fwrite(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ writeFLVDouble(int /*<<< orphan*/ *, double);
scalar_t__ writeFLVScriptDataString(int /*<<< orphan*/ *, char const *);
size_t writeFLVScriptDataValueDouble(FILE *fp, const char *name, double value) {
  size_t datasize = 0;
  char type;
  if (name != NULL)
    datasize += writeFLVScriptDataString(fp, name);
  type = 0;
  datasize += fwrite(&type, 1, 1, fp);
  datasize += writeFLVDouble(fp, value);
  return datasize;
}


x86 assembly (clang, -O0):
<writeFLVScriptDataValueDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116d <writeFLVScriptDataValueDouble+0x3d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <writeFLVScriptDataString@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
movb   $0x0,-0x21(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x21(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fwrite@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
call   1040 <writeFLVDouble@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFLVScriptDataValueDouble>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%r15
test   %rsi,%rsi
je     1154 <writeFLVScriptDataValueDouble+0x24>
mov    %r15,%rdi
call   1050 <writeFLVScriptDataString@plt>
mov    %rax,%r14
jmp    1157 <writeFLVScriptDataValueDouble+0x27>
xor    %r14d,%r14d
movb   $0x0,0x7(%rsp)
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1030 <fwrite@plt>
mov    %rax,%rbx
add    %r14,%rbx
mov    %r15,%rdi
movsd  0x8(%rsp),%xmm0
call   1040 <writeFLVDouble@plt>
add    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @writeFLVScriptDataValueDouble(i32* %0, i8* %1, double %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca double
%7 = alloca i64
%8 = alloca i8
store i32* %0, i32** %4
store i8* %1, i8** %5
store double %2, double* %6
store i64 0, i64* %7
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i8*, i8** %5
%14 = call i64 @writeFLVScriptDataString(i32* %12, i8* %13)
%15 = load i64, i64* %7
%16 = add i64 %15, %14
store i64 %16, i64* %7
br label %17
17: ; preds = %11, %3
store i8 0, i8* %8
%18 = load i32*, i32** %4
%19 = call i64 @fwrite(i8* %8, i32 1, i32 1, i32* %18)
%20 = load i64, i64* %7
%21 = add i64 %20, %19
store i64 %21, i64* %7
%22 = load i32*, i32** %4
%23 = load double, double* %6
%24 = call i64 @writeFLVDouble(i32* %22, double %23)
%25 = load i64, i64* %7
%26 = add i64 %25, %24
store i64 %26, i64* %7
%27 = load i64, i64* %7
ret i64 %27
}

LLVM IR (-O2):
define i64 @writeFLVScriptDataValueDouble(i32* %0, i8* %1, double %2) {
%4 = alloca i8
%5 = icmp eq i8* %1, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i64 @writeFLVScriptDataString(i32* %0, i8* %1)
br label %8
8: ; preds = %6, %3
%9 = phi i64 [ %7, %6 ], [ 0, %3 ]
store i8 0, i8* %4
%10 = call i64 @fwrite(i8* %4, i32 1, i32 1, i32* %0)
%11 = add i64 %10, %9
%12 = tail call i64 @writeFLVDouble(i32* %0, double %2)
%13 = add i64 %11, %12
ret i64 %13
}