#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 fgetc(int /*<<< orphan*/ *);
int fget3l(FILE *stream) {
  int b1;
  int b2;
  int b3;
  b1 = fgetc(stream);
  b2 = fgetc(stream);
  b3 = fgetc(stream);
  if ((b1 != EOF) && (b2 != EOF) && (b3 != EOF)) {
    return b1 | (b2 * 0x0100) | (b3 * 0x010000);
  }
  return EOF;
}


x86 assembly (clang, -O0):
<fget3l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%eax
je     1191 <fget3l+0x81>
mov    -0x18(%rbp),%eax
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%eax
je     1191 <fget3l+0x81>
mov    -0x1c(%rbp),%eax
mov    0x2e7a(%rip),%rcx
cmp    (%rcx),%eax
je     1191 <fget3l+0x81>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x1c(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    119d <fget3l+0x8d>
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fget3l>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <fgetc@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    0x2eb0(%rip),%rcx
mov    (%rcx),%edx
mov    %ebp,%esi
shl    $0x8,%esi
or     %r14d,%esi
mov    %eax,%ecx
shl    $0x10,%ecx
or     %esi,%ecx
cmp    %edx,%ebp
cmove  %edx,%ecx
cmp    %edx,%r14d
cmove  %edx,%ecx
cmp    %edx,%eax
cmove  %edx,%ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @fget3l(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
%7 = load i32*, i32** %3
%8 = call i32 @fgetc(i32* %7)
store i32 %8, i32* %4
%9 = load i32*, i32** %3
%10 = call i32 @fgetc(i32* %9)
store i32 %10, i32* %5
%11 = load i32*, i32** %3
%12 = call i32 @fgetc(i32* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %4
%14 = load i32, i32* @EOF
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %32
16: ; preds = %1
%17 = load i32, i32* %5
%18 = load i32, i32* @EOF
%19 = icmp ne i32 %17, %18
br i1 %19, label %20, label %32
20: ; preds = %16
%21 = load i32, i32* %6
%22 = load i32, i32* @EOF
%23 = icmp ne i32 %21, %22
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = mul nsw i32 %26, 256
%28 = or i32 %25, %27
%29 = load i32, i32* %6
%30 = mul nsw i32 %29, 65536
%31 = or i32 %28, %30
store i32 %31, i32* %2
br label %34
32: ; preds = %20, %16, %1
%33 = load i32, i32* @EOF
store i32 %33, i32* %2
br label %34
34: ; preds = %32, %24
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @fget3l(i32* nocapture %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = tail call i32 @fgetc(i32* %0)
%4 = tail call i32 @fgetc(i32* %0)
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %2, %5
%7 = icmp eq i32 %3, %5
%8 = or i1 %6, %7
%9 = icmp eq i32 %4, %5
%10 = or i1 %9, %8
%11 = shl nsw i32 %3, 8
%12 = or i32 %11, %2
%13 = shl nsw i32 %4, 16
%14 = or i32 %12, %13
%15 = select i1 %10, i32 %5, i32 %14
ret i32 %15
}