#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 */
union i2c_smbus_data {
  int word;
};
typedef int /*<<< orphan*/ __u8;
typedef int __u16;
typedef int __s32;

/* Variables and functions */
int /*<<< orphan*/ I2C_SMBUS_PROC_CALL;
int /*<<< orphan*/ I2C_SMBUS_WRITE;
scalar_t__ i2c_smbus_access(int, int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/, union i2c_smbus_data *);
extern __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value) {
  union i2c_smbus_data data;
  data.word = value;
  if (i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_PROC_CALL,
                       &data))
    return -1;
  else
    return 0x0FFFF & data.word;
}


x86 assembly (clang, -O0):
<i2c_smbus_process_call>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
mov    0x2ea3(%rip),%rax
mov    (%rax),%ecx
lea    -0x18(%rbp),%r8
call   1030 <i2c_smbus_access@plt>
cmp    $0x0,%rax
je     115e <i2c_smbus_process_call+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <i2c_smbus_process_call+0x59>
mov    -0x18(%rbp),%eax
and    $0xffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_smbus_process_call>:
push   %rax
mov    %esi,%eax
mov    %edx,(%rsp)
mov    0x2ebb(%rip),%rcx
mov    (%rcx),%esi
mov    0x2eba(%rip),%rcx
mov    (%rcx),%ecx
mov    %rsp,%r8
mov    %eax,%edx
call   1030 <i2c_smbus_access@plt>
movzwl (%rsp),%ecx
neg    %rax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%union.i2c_smbus_data = type { i32 }
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_PROC_CALL = global i32 0
define i32 @i2c_smbus_process_call(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %union.i2c_smbus_data
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %7
%10 = bitcast %union.i2c_smbus_data* %8 to i32*
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32, i32* @I2C_SMBUS_WRITE
%13 = load i32, i32* %6
%14 = load i32, i32* @I2C_SMBUS_PROC_CALL
%15 = call i64 @i2c_smbus_access(i32 %11, i32 %12, i32 %13, i32 %14, %union.i2c_smbus_data* %8)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 -1, i32* %4
br label %22
18: ; preds = %3
%19 = bitcast %union.i2c_smbus_data* %8 to i32*
%20 = load i32, i32* %19
%21 = and i32 65535, %20
store i32 %21, i32* %4
br label %22
22: ; preds = %18, %17
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
%union.i2c_smbus_data = type { i32 }
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_PROC_CALL = global i32 0
define i32 @i2c_smbus_process_call(i32 %0, i32 %1, i32 %2) {
%4 = alloca %union.i2c_smbus_data
%5 = bitcast %union.i2c_smbus_data* %4 to i8*
%6 = getelementptr inbounds %union.i2c_smbus_data, %union.i2c_smbus_data* %4, i64 0, i32 0
store i32 %2, i32* %6
%7 = load i32, i32* @I2C_SMBUS_WRITE
%8 = load i32, i32* @I2C_SMBUS_PROC_CALL
%9 = call i64 @i2c_smbus_access(i32 %0, i32 %7, i32 %1, i32 %8, %union.i2c_smbus_data* %4)
%10 = icmp eq i64 %9, 0
%11 = load i32, i32* %6
%12 = and i32 %11, 65535
%13 = select i1 %10, i32 %12, i32 -1
ret i32 %13
}