#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*/ gfx_decoder_software_reset();
int /*<<< orphan*/ saa7114_write_reg(int, unsigned char);
int saa7114_set_decoder_input_offset(unsigned short x, unsigned short y) {
  saa7114_write_reg(0xC4, (unsigned char)(x & 0x00FF));
  saa7114_write_reg(0xC5, (unsigned char)(x >> 8));
  saa7114_write_reg(0xC8, (unsigned char)(y & 0x00FF));
  saa7114_write_reg(0xC9, (unsigned char)(y >> 8));
  gfx_decoder_software_reset();
  return (0);
}


x86 assembly (clang, -O0):
<saa7114_set_decoder_input_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
and    $0xff,%eax
mov    $0xc4,%edi
movzbl %al,%esi
call   1030 <saa7114_write_reg@plt>
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
mov    $0xc5,%edi
movzbl %al,%esi
call   1030 <saa7114_write_reg@plt>
movzwl -0x4(%rbp),%eax
and    $0xff,%eax
mov    $0xc8,%edi
movzbl %al,%esi
call   1030 <saa7114_write_reg@plt>
movzwl -0x4(%rbp),%eax
sar    $0x8,%eax
mov    $0xc9,%edi
movzbl %al,%esi
call   1030 <saa7114_write_reg@plt>
mov    $0x0,%al
call   1040 <gfx_decoder_software_reset@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saa7114_set_decoder_input_offset>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
movzbl %bpl,%esi
mov    $0xc4,%edi
call   1030 <saa7114_write_reg@plt>
shr    $0x8,%ebp
mov    $0xc5,%edi
mov    %ebp,%esi
call   1030 <saa7114_write_reg@plt>
movzbl %bl,%esi
mov    $0xc8,%edi
call   1030 <saa7114_write_reg@plt>
shr    $0x8,%ebx
mov    $0xc9,%edi
mov    %ebx,%esi
call   1030 <saa7114_write_reg@plt>
xor    %eax,%eax
call   1040 <gfx_decoder_software_reset@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @saa7114_set_decoder_input_offset(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = call i32 @saa7114_write_reg(i32 196, i8 zeroext %8)
%10 = load i16, i16* %3
%11 = zext i16 %10 to i32
%12 = ashr i32 %11, 8
%13 = trunc i32 %12 to i8
%14 = call i32 @saa7114_write_reg(i32 197, i8 zeroext %13)
%15 = load i16, i16* %4
%16 = zext i16 %15 to i32
%17 = and i32 %16, 255
%18 = trunc i32 %17 to i8
%19 = call i32 @saa7114_write_reg(i32 200, i8 zeroext %18)
%20 = load i16, i16* %4
%21 = zext i16 %20 to i32
%22 = ashr i32 %21, 8
%23 = trunc i32 %22 to i8
%24 = call i32 @saa7114_write_reg(i32 201, i8 zeroext %23)
%25 = call i32 (...) @gfx_decoder_software_reset()
ret i32 0
}

LLVM IR (-O2):
define i32 @saa7114_set_decoder_input_offset(i16 zeroext %0, i16 zeroext %1) {
%3 = trunc i16 %0 to i8
%4 = tail call i32 @saa7114_write_reg(i32 196, i8 zeroext %3)
%5 = lshr i16 %0, 8
%6 = trunc i16 %5 to i8
%7 = tail call i32 @saa7114_write_reg(i32 197, i8 zeroext %6)
%8 = trunc i16 %1 to i8
%9 = tail call i32 @saa7114_write_reg(i32 200, i8 zeroext %8)
%10 = lshr i16 %1, 8
%11 = trunc i16 %10 to i8
%12 = tail call i32 @saa7114_write_reg(i32 201, i8 zeroext %11)
%13 = tail call i32 (...) @gfx_decoder_software_reset()
ret i32 0
}