#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*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int writeFLVDataTag(FILE *fp, int type, int timestamp, size_t datasize) {
  unsigned char bytes[11];
  bytes[0] = type;
  bytes[1] = ((datasize >> 16) & 0xff);
  bytes[2] = ((datasize >> 8) & 0xff);
  bytes[3] = ((datasize >> 0) & 0xff);
  bytes[4] = ((timestamp >> 16) & 0xff);
  bytes[5] = ((timestamp >> 8) & 0xff);
  bytes[6] = ((timestamp >> 0) & 0xff);
  bytes[7] = ((timestamp >> 24) & 0xff);
  bytes[8] = 0;
  bytes[9] = 0;
  bytes[10] = 0;
  fwrite(bytes, 11, 1, fp);
  return 0;
}


x86 assembly (clang, -O0):
<writeFLVDataTag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0x23(%rbp)
mov    -0x18(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,-0x22(%rbp)
mov    -0x18(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,-0x21(%rbp)
mov    -0x18(%rbp),%rax
shr    $0x0,%rax
and    $0xff,%rax
mov    %al,-0x20(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,-0x1f(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x1e(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %al,-0x1d(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,-0x1c(%rbp)
movb   $0x0,-0x1b(%rbp)
movb   $0x0,-0x1a(%rbp)
movb   $0x0,-0x19(%rbp)
lea    -0x23(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0xb,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFLVDataTag>:
sub    $0x18,%rsp
mov    %rcx,%rax
mov    %rdi,%rcx
mov    %sil,0xd(%rsp)
mov    %rax,%rsi
shr    $0x10,%rsi
mov    %sil,0xe(%rsp)
mov    %ah,0xf(%rsp)
mov    %al,0x10(%rsp)
mov    %edx,%eax
shr    $0x10,%eax
mov    %al,0x11(%rsp)
mov    %dh,0x12(%rsp)
mov    %dl,0x13(%rsp)
shr    $0x18,%edx
mov    %dl,0x14(%rsp)
movw   $0x0,0x15(%rsp)
movb   $0x0,0x17(%rsp)
lea    0xd(%rsp),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @writeFLVDataTag(i32* %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca [11 x i8]
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%10 = load i32, i32* %6
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 0
store i8 %11, i8* %12
%13 = load i64, i64* %8
%14 = lshr i64 %13, 16
%15 = and i64 %14, 255
%16 = trunc i64 %15 to i8
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 1
store i8 %16, i8* %17
%18 = load i64, i64* %8
%19 = lshr i64 %18, 8
%20 = and i64 %19, 255
%21 = trunc i64 %20 to i8
%22 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 2
store i8 %21, i8* %22
%23 = load i64, i64* %8
%24 = lshr i64 %23, 0
%25 = and i64 %24, 255
%26 = trunc i64 %25 to i8
%27 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 3
store i8 %26, i8* %27
%28 = load i32, i32* %7
%29 = ashr i32 %28, 16
%30 = and i32 %29, 255
%31 = trunc i32 %30 to i8
%32 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 4
store i8 %31, i8* %32
%33 = load i32, i32* %7
%34 = ashr i32 %33, 8
%35 = and i32 %34, 255
%36 = trunc i32 %35 to i8
%37 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 5
store i8 %36, i8* %37
%38 = load i32, i32* %7
%39 = ashr i32 %38, 0
%40 = and i32 %39, 255
%41 = trunc i32 %40 to i8
%42 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 6
store i8 %41, i8* %42
%43 = load i32, i32* %7
%44 = ashr i32 %43, 24
%45 = and i32 %44, 255
%46 = trunc i32 %45 to i8
%47 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 7
store i8 %46, i8* %47
%48 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 8
store i8 0, i8* %48
%49 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 9
store i8 0, i8* %49
%50 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 10
store i8 0, i8* %50
%51 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 0
%52 = load i32*, i32** %5
%53 = call i32 @fwrite(i8* %51, i32 11, i32 1, i32* %52)
ret i32 0
}

LLVM IR (-O2):
define i32 @writeFLVDataTag(i32* nocapture %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca [11 x i8]
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%7 = trunc i32 %1 to i8
store i8 %7, i8* %6
%8 = lshr i64 %3, 16
%9 = trunc i64 %8 to i8
%10 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 1
store i8 %9, i8* %10
%11 = lshr i64 %3, 8
%12 = trunc i64 %11 to i8
%13 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 2
store i8 %12, i8* %13
%14 = trunc i64 %3 to i8
%15 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 3
store i8 %14, i8* %15
%16 = lshr i32 %2, 16
%17 = trunc i32 %16 to i8
%18 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 4
store i8 %17, i8* %18
%19 = lshr i32 %2, 8
%20 = trunc i32 %19 to i8
%21 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 5
store i8 %20, i8* %21
%22 = trunc i32 %2 to i8
%23 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 6
store i8 %22, i8* %23
%24 = lshr i32 %2, 24
%25 = trunc i32 %24 to i8
%26 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 7
store i8 %25, i8* %26
%27 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 8
store i8 0, i8* %27
%28 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 9
store i8 0, i8* %28
%29 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 10
store i8 0, i8* %29
%30 = call i32 @fwrite(i8* %6, i32 11, i32 1, i32* %0)
ret i32 0
}