#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 EOF;
int fputc(int, int /*<<< orphan*/ *);
int fput3l(int value, FILE *stream) {
  int result;
  result = fputc(value & 0xff, stream);
  if (result != EOF) {
    result = fputc((value >> 8) & 0xff, stream);
    if (result != EOF) {
      result = fputc((value >> 16) & 0xff, stream);
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<fput3l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
and    $0xff,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%eax
je     118d <fput3l+0x7d>
mov    -0x4(%rbp),%edi
sar    $0x8,%edi
and    $0xff,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%eax
je     1188 <fput3l+0x78>
mov    -0x4(%rbp),%edi
sar    $0x10,%edi
and    $0xff,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    %eax,-0x14(%rbp)
jmp    118d <fput3l+0x7d>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fput3l>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
movzbl %bl,%edi
call   1030 <fputc@plt>
mov    0x2ebf(%rip),%r15
cmp    (%r15),%eax
je     113e <fput3l+0x2e>
movzbl %bh,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
cmp    (%r15),%eax
jne    1144 <fput3l+0x34>
pop    %rbx
pop    %r14
pop    %r15
ret
shr    $0x10,%ebx
movzbl %bl,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fputc@plt>

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

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