#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 uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
uint32_t read_uint32() {
  uint8_t byte[4] = {0x00, 0x00, 0x00, 0x00};
  fread(byte, sizeof(uint8_t), 4, stdin);
  uint32_t result = ((uint32_t)byte[0]) << 0 | ((uint32_t)byte[1]) << 8 |
                    ((uint32_t)byte[2]) << 16 | ((uint32_t)byte[3]) << 24;
  return result;
}


x86 assembly (clang, -O0):
<read_uint32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
lea    -0x10(%rbp),%rdi
mov    0x2ea5(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    -0x10(%rbp),%eax
shl    $0x0,%eax
mov    -0xc(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_uint32>:
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%edx
shl    $0x8,%ecx
or     (%rsp),%ecx
shl    $0x10,%edx
mov    0xc(%rsp),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @read_uint32() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = bitcast [4 x i32]* %1 to i8*
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fread(i32* %4, i32 4, i32 4, i32 %5)
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%8 = load i32, i32* %7
%9 = shl i32 %8, 0
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%11 = load i32, i32* %10
%12 = shl i32 %11, 8
%13 = or i32 %9, %12
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%15 = load i32, i32* %14
%16 = shl i32 %15, 16
%17 = or i32 %13, %16
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%19 = load i32, i32* %18
%20 = shl i32 %19, 24
%21 = or i32 %17, %20
store i32 %21, i32* %2
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @read_uint32() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32 @fread(i32* %3, i32 4, i32 4, i32 %4)
%6 = load i32, i32* %3
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%8 = load i32, i32* %7
%9 = shl i32 %8, 8
%10 = or i32 %9, %6
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%12 = load i32, i32* %11
%13 = shl i32 %12, 16
%14 = or i32 %10, %13
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%16 = load i32, i32* %15
%17 = shl i32 %16, 24
%18 = or i32 %14, %17
ret i32 %18
}