#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*/ uint16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(void *, int, int, int /*<<< orphan*/ *);
void DB_int_AppendTag(FILE *fp, uint16_t Tag, uint16_t Size, void *Data) {
  fseek(fp, 0, SEEK_END);
  fwrite(&Tag, sizeof(uint16_t), 1, fp);
  fwrite(&Size, sizeof(uint16_t), 1, fp);
  fwrite(Data, Size, 1, fp);
}


x86 assembly (clang, -O0):
<DB_int_AppendTag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <fseek@plt>
lea    -0xc(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <fwrite@plt>
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <fwrite@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DB_int_AppendTag>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdi,%rbx
mov    %esi,0x4(%rsp)
mov    %edx,(%rsp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <fseek@plt>
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    (%rsp),%esi
mov    %r14,%rdi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@SEEK_END = global i32 0
define void @DB_int_AppendTag(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i32*, i32** %5
%10 = load i32, i32* @SEEK_END
%11 = call i32 @fseek(i32* %9, i32 0, i32 %10)
%12 = bitcast i32* %6 to i8*
%13 = load i32*, i32** %5
%14 = call i32 @fwrite(i8* %12, i32 4, i32 1, i32* %13)
%15 = bitcast i32* %7 to i8*
%16 = load i32*, i32** %5
%17 = call i32 @fwrite(i8* %15, i32 4, i32 1, i32* %16)
%18 = load i8*, i8** %8
%19 = load i32, i32* %7
%20 = load i32*, i32** %5
%21 = call i32 @fwrite(i8* %18, i32 %19, i32 1, i32* %20)
ret void
}

LLVM IR (-O2):
@SEEK_END = global i32 0
define void @DB_int_AppendTag(i32* nocapture %0, i32 %1, i32 %2, i8* nocapture %3) {
%5 = alloca i32
%6 = alloca i32
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* @SEEK_END
%8 = tail call i32 @fseek(i32* %0, i32 0, i32 %7)
%9 = bitcast i32* %5 to i8*
%10 = call i32 @fwrite(i8* %9, i32 4, i32 1, i32* %0)
%11 = bitcast i32* %6 to i8*
%12 = call i32 @fwrite(i8* %11, i32 4, i32 1, i32* %0)
%13 = load i32, i32* %6
%14 = tail call i32 @fwrite(i8* %3, i32 %13, i32 1, i32* %0)
ret void
}