#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 */

/* Variables and functions */
int /*<<< orphan*/ saa7114_read_reg(int, unsigned char *);
unsigned long saa7114_get_decoder_input_offset(void) {
  unsigned long value = 0;
  unsigned char data;
  saa7114_read_reg(0xC4, &data);
  value = (unsigned long)data;
  saa7114_read_reg(0xC5, &data);
  value |= ((unsigned long)data) << 8;
  saa7114_read_reg(0xC8, &data);
  value |= ((unsigned long)data) << 16;
  saa7114_read_reg(0xC9, &data);
  value |= ((unsigned long)data) << 24;
  return (value);
}


x86 assembly (clang, -O0):
<saa7114_get_decoder_input_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0xc4,%edi
lea    -0x9(%rbp),%rsi
call   1030 <saa7114_read_reg@plt>
movzbl -0x9(%rbp),%eax
mov    %rax,-0x8(%rbp)
mov    $0xc5,%edi
lea    -0x9(%rbp),%rsi
call   1030 <saa7114_read_reg@plt>
movzbl -0x9(%rbp),%eax
shl    $0x8,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    $0xc8,%edi
lea    -0x9(%rbp),%rsi
call   1030 <saa7114_read_reg@plt>
movzbl -0x9(%rbp),%eax
shl    $0x10,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    $0xc9,%edi
lea    -0x9(%rbp),%rsi
call   1030 <saa7114_read_reg@plt>
movzbl -0x9(%rbp),%eax
shl    $0x18,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saa7114_get_decoder_input_offset>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xf(%rsp),%r14
mov    $0xc4,%edi
mov    %r14,%rsi
call   1030 <saa7114_read_reg@plt>
movzbl 0xf(%rsp),%r15d
mov    $0xc5,%edi
mov    %r14,%rsi
call   1030 <saa7114_read_reg@plt>
movzbl 0xf(%rsp),%ebx
shl    $0x8,%rbx
or     %r15,%rbx
mov    $0xc8,%edi
mov    %r14,%rsi
call   1030 <saa7114_read_reg@plt>
movzbl 0xf(%rsp),%r15d
shl    $0x10,%r15
or     %rbx,%r15
mov    $0xc9,%edi
mov    %r14,%rsi
call   1030 <saa7114_read_reg@plt>
movzbl 0xf(%rsp),%eax
shl    $0x18,%rax
or     %r15,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @saa7114_get_decoder_input_offset() {
%1 = alloca i64
%2 = alloca i8
store i64 0, i64* %1
%3 = call i32 @saa7114_read_reg(i32 196, i8* %2)
%4 = load i8, i8* %2
%5 = zext i8 %4 to i64
store i64 %5, i64* %1
%6 = call i32 @saa7114_read_reg(i32 197, i8* %2)
%7 = load i8, i8* %2
%8 = zext i8 %7 to i64
%9 = shl i64 %8, 8
%10 = load i64, i64* %1
%11 = or i64 %10, %9
store i64 %11, i64* %1
%12 = call i32 @saa7114_read_reg(i32 200, i8* %2)
%13 = load i8, i8* %2
%14 = zext i8 %13 to i64
%15 = shl i64 %14, 16
%16 = load i64, i64* %1
%17 = or i64 %16, %15
store i64 %17, i64* %1
%18 = call i32 @saa7114_read_reg(i32 201, i8* %2)
%19 = load i8, i8* %2
%20 = zext i8 %19 to i64
%21 = shl i64 %20, 24
%22 = load i64, i64* %1
%23 = or i64 %22, %21
store i64 %23, i64* %1
%24 = load i64, i64* %1
ret i64 %24
}

LLVM IR (-O2):
define i64 @saa7114_get_decoder_input_offset() {
%1 = alloca i8
%2 = call i32 @saa7114_read_reg(i32 196, i8* %1)
%3 = load i8, i8* %1
%4 = zext i8 %3 to i64
%5 = call i32 @saa7114_read_reg(i32 197, i8* %1)
%6 = load i8, i8* %1
%7 = zext i8 %6 to i64
%8 = shl nuw nsw i64 %7, 8
%9 = or i64 %8, %4
%10 = call i32 @saa7114_read_reg(i32 200, i8* %1)
%11 = load i8, i8* %1
%12 = zext i8 %11 to i64
%13 = shl nuw nsw i64 %12, 16
%14 = or i64 %9, %13
%15 = call i32 @saa7114_read_reg(i32 201, i8* %1)
%16 = load i8, i8* %1
%17 = zext i8 %16 to i64
%18 = shl nuw nsw i64 %17, 24
%19 = or i64 %14, %18
ret i64 %19
}