#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 writeFLVPreviousTagSize(FILE *fp, size_t tagsize) {
  unsigned char bytes[4];
  bytes[0] = ((tagsize >> 24) & 0xff);
  bytes[1] = ((tagsize >> 16) & 0xff);
  bytes[2] = ((tagsize >> 8) & 0xff);
  bytes[3] = ((tagsize >> 0) & 0xff);
  fwrite(bytes, 4, 1, fp);
  return 0;
}


x86 assembly (clang, -O0):
<writeFLVPreviousTagSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x18,%rax
and    $0xff,%rax
mov    %al,-0x14(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,-0x13(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x0,%rax
and    $0xff,%rax
mov    %al,-0x11(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFLVPreviousTagSize>:
push   %rax
mov    %rdi,%rcx
bswap  %esi
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @writeFLVPreviousTagSize(i32* nocapture %0, i64 %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = lshr i64 %1, 24
%6 = trunc i64 %5 to i8
store i8 %6, i8* %4
%7 = lshr i64 %1, 16
%8 = trunc i64 %7 to i8
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %8, i8* %9
%10 = lshr i64 %1, 8
%11 = trunc i64 %10 to i8
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %11, i8* %12
%13 = trunc i64 %1 to i8
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 %13, i8* %14
%15 = call i32 @fwrite(i8* %4, i32 4, i32 1, i32* %0)
ret i32 0
}