#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*/ putc(unsigned int, int /*<<< orphan*/ *);
int wrtieee_header(unsigned int n, FILE *output) {
  unsigned h4[4];
  h4[0] = n & 255;
  h4[1] = (n >> 8) & 255;
  h4[2] = (n >> 16) & 255;
  h4[3] = (n >> 24) & 255;
  putc(h4[3], output);
  putc(h4[2], output);
  putc(h4[1], output);
  putc(h4[0], output);
  return 0;
}


x86 assembly (clang, -O0):
<wrtieee_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <putc@plt>
mov    -0x20(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <putc@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrtieee_header>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%eax
movzbl %al,%r14d
movzbl %ah,%ecx
mov    %ecx,%r15d
mov    %edi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ebp
shr    $0x18,%eax
mov    %eax,%edi
call   1030 <putc@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <putc@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
call   1030 <putc@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1030 <putc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @wrtieee_header(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [4 x i32]
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32, i32* %3
%7 = and i32 %6, 255
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
store i32 %7, i32* %8
%9 = load i32, i32* %3
%10 = lshr i32 %9, 8
%11 = and i32 %10, 255
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 1
store i32 %11, i32* %12
%13 = load i32, i32* %3
%14 = lshr i32 %13, 16
%15 = and i32 %14, 255
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 2
store i32 %15, i32* %16
%17 = load i32, i32* %3
%18 = lshr i32 %17, 24
%19 = and i32 %18, 255
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 3
store i32 %19, i32* %20
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 3
%22 = load i32, i32* %21
%23 = load i32*, i32** %4
%24 = call i32 @putc(i32 %22, i32* %23)
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 2
%26 = load i32, i32* %25
%27 = load i32*, i32** %4
%28 = call i32 @putc(i32 %26, i32* %27)
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 1
%30 = load i32, i32* %29
%31 = load i32*, i32** %4
%32 = call i32 @putc(i32 %30, i32* %31)
%33 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%34 = load i32, i32* %33
%35 = load i32*, i32** %4
%36 = call i32 @putc(i32 %34, i32* %35)
ret i32 0
}

LLVM IR (-O2):
define i32 @wrtieee_header(i32 %0, i32* nocapture %1) {
%3 = and i32 %0, 255
%4 = lshr i32 %0, 8
%5 = and i32 %4, 255
%6 = lshr i32 %0, 16
%7 = and i32 %6, 255
%8 = lshr i32 %0, 24
%9 = tail call i32 @putc(i32 %8, i32* %1)
%10 = tail call i32 @putc(i32 %7, i32* %1)
%11 = tail call i32 @putc(i32 %5, i32* %1)
%12 = tail call i32 @putc(i32 %3, i32* %1)
ret i32 0
}