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


x86 assembly (clang, -O0):
<fget4b>:
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    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e92(%rip),%rcx
cmp    (%rcx),%eax
je     11b7 <fget4b+0xa7>
mov    -0x18(%rbp),%eax
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%eax
je     11b7 <fget4b+0xa7>
mov    -0x1c(%rbp),%eax
mov    0x2e6e(%rip),%rcx
cmp    (%rcx),%eax
je     11b7 <fget4b+0xa7>
mov    -0x20(%rbp),%eax
mov    0x2e5c(%rip),%rcx
cmp    (%rcx),%eax
je     11b7 <fget4b+0xa7>
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    11c3 <fget4b+0xb3>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fget4b>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbp
call   1030 <fgetc@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1030 <fgetc@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1030 <fgetc@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
call   1030 <fgetc@plt>
mov    0x2ea2(%rip),%rcx
mov    (%rcx),%ecx
cmp    %ecx,%eax
je     116f <fget4b+0x5f>
cmp    %ecx,%r15d
je     116f <fget4b+0x5f>
cmp    %ecx,%ebx
je     116f <fget4b+0x5f>
cmp    %ecx,%r14d
je     116f <fget4b+0x5f>
shl    $0x8,%r15d
shl    $0x10,%r14d
shl    $0x18,%ebx
or     %r14d,%ebx
or     %r15d,%ebx
or     %eax,%ebx
mov    %ebx,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @fget4b(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 = tail call i32 @fgetc(i32* %0)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %2, %6
%8 = icmp eq i32 %3, %6
%9 = or i1 %7, %8
%10 = icmp eq i32 %4, %6
%11 = or i1 %10, %9
%12 = icmp eq i32 %5, %6
%13 = or i1 %12, %11
br i1 %13, label %21, label %14
14: ; preds = %1
%15 = shl nsw i32 %4, 8
%16 = shl nsw i32 %3, 16
%17 = shl nsw i32 %2, 24
%18 = or i32 %16, %17
%19 = or i32 %18, %15
%20 = or i32 %19, %5
br label %21
21: ; preds = %1, %14
%22 = phi i32 [ %20, %14 ], [ %6, %1 ]
ret i32 %22
}