#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 */
scalar_t__ EOF;
int /*<<< orphan*/ assert(int /*<<< orphan*/ *);
scalar_t__ fputc(int, int /*<<< orphan*/ *);
int IO_Write_LE_WORD(short value, FILE *fp) {
  int c1, c2;
  assert(fp);
  c1 = value & 0xff;
  c2 = (value >> 8) & 0xff;
  return ((fputc(c1, fp) != EOF) && (fputc(c2, fp) != EOF));
}


x86 assembly (clang, -O0):
<IO_Write_LE_WORD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <assert@plt>
movswl -0x2(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
movswl -0x2(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    %rax,%rcx
xor    %eax,%eax
mov    0x2e79(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x19(%rbp)
je     1197 <IO_Write_LE_WORD+0x77>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IO_Write_LE_WORD>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <assert@plt>
movzbl %bpl,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
mov    %rax,%rcx
mov    0x2ea1(%rip),%r14
xor    %eax,%eax
cmp    (%r14),%rcx
je     1167 <IO_Write_LE_WORD+0x47>
movzwl %bp,%edi
shr    $0x8,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    (%r14),%rcx
setne  %al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i64 0
define i32 @IO_Write_LE_WORD(i16 signext %0, i32* %1) {
%3 = alloca i16
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i16 %0, i16* %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = call i32 @assert(i32* %7)
%9 = load i16, i16* %3
%10 = sext i16 %9 to i32
%11 = and i32 %10, 255
store i32 %11, i32* %5
%12 = load i16, i16* %3
%13 = sext i16 %12 to i32
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
store i32 %15, i32* %6
%16 = load i32, i32* %5
%17 = load i32*, i32** %4
%18 = call i64 @fputc(i32 %16, i32* %17)
%19 = load i64, i64* @EOF
%20 = icmp ne i64 %18, %19
br i1 %20, label %21, label %27
21: ; preds = %2
%22 = load i32, i32* %6
%23 = load i32*, i32** %4
%24 = call i64 @fputc(i32 %22, i32* %23)
%25 = load i64, i64* @EOF
%26 = icmp ne i64 %24, %25
br label %27
27: ; preds = %21, %2
%28 = phi i1 [ false, %2 ], [ %26, %21 ]
%29 = zext i1 %28 to i32
ret i32 %29
}

LLVM IR (-O2):
@EOF = global i64 0
define i32 @IO_Write_LE_WORD(i16 signext %0, i32* %1) {
%3 = tail call i32 @assert(i32* %1)
%4 = zext i16 %0 to i32
%5 = and i32 %4, 255
%6 = tail call i64 @fputc(i32 %5, i32* %1)
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %15, label %9
9: ; preds = %2
%10 = lshr i32 %4, 8
%11 = tail call i64 @fputc(i32 %10, i32* %1)
%12 = load i64, i64* @EOF
%13 = icmp ne i64 %11, %12
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %9, %2
%16 = phi i32 [ 0, %2 ], [ %14, %9 ]
ret i32 %16
}