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

/* Variables and functions */
int realtek_mst_i2c_spi_write_register(int, int, int /*<<< orphan*/);
int realtek_mst_i2c_spi_map_page(int fd, uint8_t block_idx, uint8_t page_idx,
                                 uint8_t byte_idx) {
  int ret = 0;
  ret |= realtek_mst_i2c_spi_write_register(fd, 0x64, block_idx);
  ret |= realtek_mst_i2c_spi_write_register(fd, 0x65, page_idx);
  ret |= realtek_mst_i2c_spi_write_register(fd, 0x66, byte_idx);
  return ret ? -1 : 0;
}


x86 assembly (clang, -O0):
<realtek_mst_i2c_spi_map_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0x64,%esi
call   1030 <realtek_mst_i2c_spi_write_register@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%edx
mov    $0x65,%esi
call   1030 <realtek_mst_i2c_spi_write_register@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%edx
mov    $0x66,%esi
call   1030 <realtek_mst_i2c_spi_write_register@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realtek_mst_i2c_spi_map_page>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%edx
mov    %edi,%ebx
mov    $0x64,%esi
call   1030 <realtek_mst_i2c_spi_write_register@plt>
mov    %eax,%r12d
mov    %ebx,%edi
mov    $0x65,%esi
mov    %r15d,%edx
call   1030 <realtek_mst_i2c_spi_write_register@plt>
mov    %eax,%ebp
or     %r12d,%ebp
mov    %ebx,%edi
mov    $0x66,%esi
mov    %r14d,%edx
call   1030 <realtek_mst_i2c_spi_write_register@plt>
xor    %ecx,%ecx
or     %ebp,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @realtek_mst_i2c_spi_map_page(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @realtek_mst_i2c_spi_write_register(i32 %10, i32 100, i32 %11)
%13 = load i32, i32* %9
%14 = or i32 %13, %12
store i32 %14, i32* %9
%15 = load i32, i32* %5
%16 = load i32, i32* %7
%17 = call i32 @realtek_mst_i2c_spi_write_register(i32 %15, i32 101, i32 %16)
%18 = load i32, i32* %9
%19 = or i32 %18, %17
store i32 %19, i32* %9
%20 = load i32, i32* %5
%21 = load i32, i32* %8
%22 = call i32 @realtek_mst_i2c_spi_write_register(i32 %20, i32 102, i32 %21)
%23 = load i32, i32* %9
%24 = or i32 %23, %22
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i64
%28 = select i1 %26, i32 -1, i32 0
ret i32 %28
}

LLVM IR (-O2):
define i32 @realtek_mst_i2c_spi_map_page(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @realtek_mst_i2c_spi_write_register(i32 %0, i32 100, i32 %1)
%6 = tail call i32 @realtek_mst_i2c_spi_write_register(i32 %0, i32 101, i32 %2)
%7 = or i32 %6, %5
%8 = tail call i32 @realtek_mst_i2c_spi_write_register(i32 %0, i32 102, i32 %3)
%9 = or i32 %7, %8
%10 = icmp ne i32 %9, 0
%11 = sext i1 %10 to i32
ret i32 %11
}