#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fputc_err(unsigned long, int /*<<< orphan*/ *);
void WriteDWORDBE(FILE *outf, unsigned long data) {
  (assert(outf != NULL));
  fputc_err((data >> 24) & 0xFF, outf);
  fputc_err((data >> 16) & 0xFF, outf);
  fputc_err((data >> 8) & 0xFF, outf);
  fputc_err(data & 0xFF, outf);
}


x86 assembly (clang, -O0):
<WriteDWORDBE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
shr    $0x18,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1040 <fputc_err@plt>
mov    -0x10(%rbp),%rdi
shr    $0x10,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1040 <fputc_err@plt>
mov    -0x10(%rbp),%rdi
shr    $0x8,%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1040 <fputc_err@plt>
mov    -0x10(%rbp),%rdi
and    $0xff,%rdi
mov    -0x8(%rbp),%rsi
call   1040 <fputc_err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteDWORDBE>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %r14d,%edi
shr    $0x18,%edi
mov    %rbx,%rsi
call   1040 <fputc_err@plt>
mov    %r14d,%eax
shr    $0x10,%eax
movzbl %al,%edi
mov    %rbx,%rsi
call   1040 <fputc_err@plt>
mov    %r14,%rax
movzbl %ah,%edi
mov    %rbx,%rsi
call   1040 <fputc_err@plt>
movzbl %r14b,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fputc_err@plt>

LLVM IR (-O0):
define void @WriteDWORDBE(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i32*, i32** %3
%6 = icmp ne i32* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i64, i64* %4
%10 = lshr i64 %9, 24
%11 = and i64 %10, 255
%12 = load i32*, i32** %3
%13 = call i32 @fputc_err(i64 %11, i32* %12)
%14 = load i64, i64* %4
%15 = lshr i64 %14, 16
%16 = and i64 %15, 255
%17 = load i32*, i32** %3
%18 = call i32 @fputc_err(i64 %16, i32* %17)
%19 = load i64, i64* %4
%20 = lshr i64 %19, 8
%21 = and i64 %20, 255
%22 = load i32*, i32** %3
%23 = call i32 @fputc_err(i64 %21, i32* %22)
%24 = load i64, i64* %4
%25 = and i64 %24, 255
%26 = load i32*, i32** %3
%27 = call i32 @fputc_err(i64 %25, i32* %26)
ret void
}

LLVM IR (-O2):
define void @WriteDWORDBE(i32* %0, i64 %1) {
%3 = icmp ne i32* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = lshr i64 %1, 24
%7 = and i64 %6, 255
%8 = tail call i32 @fputc_err(i64 %7, i32* %0)
%9 = lshr i64 %1, 16
%10 = and i64 %9, 255
%11 = tail call i32 @fputc_err(i64 %10, i32* %0)
%12 = lshr i64 %1, 8
%13 = and i64 %12, 255
%14 = tail call i32 @fputc_err(i64 %13, i32* %0)
%15 = and i64 %1, 255
%16 = tail call i32 @fputc_err(i64 %15, i32* %0)
ret void
}