#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;
scalar_t__ fputc(unsigned int, int /*<<< orphan*/ *);
int wlWriteDWord(unsigned int dword, FILE *file) {
  if (fputc(dword & 0xff, file) == EOF)
    return 0;
  if (fputc((dword >> 8) & 0xff, file) == EOF)
    return 0;
  if (fputc((dword >> 16) & 0xff, file) == EOF)
    return 0;
  if (fputc((dword >> 24) & 0xff, file) == EOF)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<wlWriteDWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
and    $0xff,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    0x2eb0(%rip),%rcx
cmp    (%rcx),%rax
jne    114d <wlWriteDWord+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    11e7 <wlWriteDWord+0xd7>
mov    -0x8(%rbp),%edi
shr    $0x8,%edi
and    $0xff,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%rax
jne    117e <wlWriteDWord+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    11e7 <wlWriteDWord+0xd7>
mov    -0x8(%rbp),%edi
shr    $0x10,%edi
and    $0xff,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    0x2e4e(%rip),%rcx
cmp    (%rcx),%rax
jne    11af <wlWriteDWord+0x9f>
movl   $0x0,-0x4(%rbp)
jmp    11e7 <wlWriteDWord+0xd7>
mov    -0x8(%rbp),%edi
shr    $0x18,%edi
and    $0xff,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    0x2e1d(%rip),%rcx
cmp    (%rcx),%rax
jne    11e0 <wlWriteDWord+0xd0>
movl   $0x0,-0x4(%rbp)
jmp    11e7 <wlWriteDWord+0xd7>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wlWriteDWord>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbp
mov    %edi,%ebx
movzbl %bl,%edi
call   1030 <fputc@plt>
mov    0x2ebd(%rip),%r15
xor    %r14d,%r14d
cmp    (%r15),%rax
je     116f <wlWriteDWord+0x5f>
movzbl %bh,%edi
mov    %rbp,%rsi
call   1030 <fputc@plt>
cmp    (%r15),%rax
je     116f <wlWriteDWord+0x5f>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
mov    %rbp,%rsi
call   1030 <fputc@plt>
cmp    (%r15),%rax
je     116f <wlWriteDWord+0x5f>
shr    $0x18,%ebx
mov    %ebx,%edi
mov    %rbp,%rsi
call   1030 <fputc@plt>
xor    %r14d,%r14d
cmp    (%r15),%rax
setne  %r14b
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i64 0
define i32 @wlWriteDWord(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
%6 = load i32, i32* %4
%7 = and i32 %6, 255
%8 = load i32*, i32** %5
%9 = call i64 @fputc(i32 %7, i32* %8)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %41
13: ; preds = %2
%14 = load i32, i32* %4
%15 = lshr i32 %14, 8
%16 = and i32 %15, 255
%17 = load i32*, i32** %5
%18 = call i64 @fputc(i32 %16, i32* %17)
%19 = load i64, i64* @EOF
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %13
store i32 0, i32* %3
br label %41
22: ; preds = %13
%23 = load i32, i32* %4
%24 = lshr i32 %23, 16
%25 = and i32 %24, 255
%26 = load i32*, i32** %5
%27 = call i64 @fputc(i32 %25, i32* %26)
%28 = load i64, i64* @EOF
%29 = icmp eq i64 %27, %28
br i1 %29, label %30, label %31
30: ; preds = %22
store i32 0, i32* %3
br label %41
31: ; preds = %22
%32 = load i32, i32* %4
%33 = lshr i32 %32, 24
%34 = and i32 %33, 255
%35 = load i32*, i32** %5
%36 = call i64 @fputc(i32 %34, i32* %35)
%37 = load i64, i64* @EOF
%38 = icmp eq i64 %36, %37
br i1 %38, label %39, label %40
39: ; preds = %31
store i32 0, i32* %3
br label %41
40: ; preds = %31
store i32 1, i32* %3
br label %41
41: ; preds = %40, %39, %30, %21, %12
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@EOF = global i64 0
define i32 @wlWriteDWord(i32 %0, i32* nocapture %1) {
%3 = and i32 %0, 255
%4 = tail call i64 @fputc(i32 %3, i32* %1)
%5 = load i64, i64* @EOF
%6 = icmp eq i64 %4, %5
br i1 %6, label %25, label %7
7: ; preds = %2
%8 = lshr i32 %0, 8
%9 = and i32 %8, 255
%10 = tail call i64 @fputc(i32 %9, i32* %1)
%11 = load i64, i64* @EOF
%12 = icmp eq i64 %10, %11
br i1 %12, label %25, label %13
13: ; preds = %7
%14 = lshr i32 %0, 16
%15 = and i32 %14, 255
%16 = tail call i64 @fputc(i32 %15, i32* %1)
%17 = load i64, i64* @EOF
%18 = icmp eq i64 %16, %17
br i1 %18, label %25, label %19
19: ; preds = %13
%20 = lshr i32 %0, 24
%21 = tail call i64 @fputc(i32 %20, i32* %1)
%22 = load i64, i64* @EOF
%23 = icmp ne i64 %21, %22
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %19, %13, %7, %2
%26 = phi i32 [ 0, %2 ], [ 0, %7 ], [ 0, %13 ], [ %24, %19 ]
ret i32 %26
}