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


x86 assembly (clang, -O0):
<writeFLVScriptDataValueString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115c <writeFLVScriptDataValueString+0x3c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <writeFLVScriptDataString@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
movb   $0x2,-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
mov    -0x18(%rbp),%rsi
call   1040 <writeFLVScriptDataString@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFLVScriptDataValueString>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%r12
test   %rsi,%rsi
je     1140 <writeFLVScriptDataValueString+0x20>
mov    %r12,%rdi
call   1040 <writeFLVScriptDataString@plt>
mov    %rax,%r15
jmp    1143 <writeFLVScriptDataValueString+0x23>
xor    %r15d,%r15d
movb   $0x2,0x7(%rsp)
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1030 <fwrite@plt>
mov    %rax,%rbx
add    %r15,%rbx
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <writeFLVScriptDataString@plt>
add    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @writeFLVScriptDataValueString(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %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 2, 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 i8*, i8** %6
%24 = call i64 @writeFLVScriptDataString(i32* %22, i8* %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 @writeFLVScriptDataValueString(i32* %0, i8* %1, i8* %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 2, i8* %4
%10 = call i64 @fwrite(i8* %4, i32 1, i32 1, i32* %0)
%11 = add i64 %10, %9
%12 = tail call i64 @writeFLVScriptDataString(i32* %0, i8* %2)
%13 = add i64 %11, %12
ret i64 %13
}