#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*/ *);
void fa_write_u32(unsigned long in, FILE *fp) {
  unsigned char temp[4];
  temp[0] = in & 0xff;
  in >>= 8;
  temp[1] = in & 0xff;
  in >>= 8;
  temp[2] = in & 0xff;
  in >>= 8;
  temp[3] = in & 0xff;
  fwrite(temp, sizeof(*temp), 4, fp);
}


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

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

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

LLVM IR (-O2):
define void @fa_write_u32(i64 %0, i32* nocapture %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = trunc i64 %0 to i8
store i8 %5, i8* %4
%6 = lshr i64 %0, 8
%7 = trunc i64 %6 to i8
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %7, i8* %8
%9 = lshr i64 %0, 16
%10 = trunc i64 %9 to i8
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %10, i8* %11
%12 = lshr i64 %0, 24
%13 = trunc i64 %12 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 1, i32 4, i32* %1)
ret void
}