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


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

x86 assembly (clang, -O2):
<fput3b>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
mov    %edi,%eax
shr    $0x10,%eax
movzbl %al,%edi
call   1030 <fputc@plt>
mov    0x2eba(%rip),%r15
cmp    (%r15),%eax
je     1143 <fput3b+0x33>
movzbl %bh,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
cmp    (%r15),%eax
jne    1149 <fput3b+0x39>
pop    %rbx
pop    %r14
pop    %r15
ret
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 @fput3b(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 = lshr i32 %6, 16
%8 = and i32 %7, 255
%9 = load i32*, i32** %4
%10 = call i32 @fputc(i32 %8, i32* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %29
14: ; preds = %2
%15 = load i32, i32* %3
%16 = lshr i32 %15, 8
%17 = and i32 %16, 255
%18 = load i32*, i32** %4
%19 = call i32 @fputc(i32 %17, i32* %18)
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = load i32, i32* @EOF
%22 = icmp ne i32 %20, %21
br i1 %22, label %23, label %28
23: ; preds = %14
%24 = load i32, i32* %3
%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 = %23, %14
br label %29
29: ; preds = %28, %2
%30 = load i32, i32* %5
ret i32 %30
}

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