#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 {
  unsigned int word;
};

/* Variables and functions */
int /*<<< orphan*/ I2C_SMBUS_PROC_CALL;
int /*<<< orphan*/ I2C_SMBUS_WRITE;
scalar_t__ i2c_smbus_access(int, int /*<<< orphan*/, unsigned char,
                            int /*<<< orphan*/, union i2c_smbus_data *);
long i2c_smbus_process_call(int file, unsigned char command,
                            unsigned int 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    %sil,%al
mov    %edi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
mov    -0xd(%rbp),%al
mov    0x2ea0(%rip),%rcx
mov    (%rcx),%ecx
lea    -0x18(%rbp),%r8
movzbl %al,%edx
call   1030 <i2c_smbus_access@plt>
cmp    $0x0,%rax
je     1165 <i2c_smbus_process_call+0x55>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1173 <i2c_smbus_process_call+0x63>
mov    -0x18(%rbp),%eax
and    $0xffff,%eax
mov    %eax,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
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    %rax,%rax
or     %rcx,%rax
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 i64 @i2c_smbus_process_call(i32 %0, i8 zeroext %1, i32 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca %union.i2c_smbus_data
store i32 %0, i32* %5
store i8 %1, i8* %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 i8, i8* %6
%14 = load i32, i32* @I2C_SMBUS_PROC_CALL
%15 = call i64 @i2c_smbus_access(i32 %11, i32 %12, i8 zeroext %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 i64 -1, i64* %4
br label %23
18: ; preds = %3
%19 = bitcast %union.i2c_smbus_data* %8 to i32*
%20 = load i32, i32* %19
%21 = and i32 65535, %20
%22 = zext i32 %21 to i64
store i64 %22, i64* %4
br label %23
23: ; preds = %18, %17
%24 = load i64, i64* %4
ret i64 %24
}

LLVM IR (-O2):
%union.i2c_smbus_data = type { i32 }
@I2C_SMBUS_WRITE = global i32 0
@I2C_SMBUS_PROC_CALL = global i32 0
define i64 @i2c_smbus_process_call(i32 %0, i8 zeroext %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, i8 zeroext %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 = zext i32 %12 to i64
%14 = select i1 %10, i64 %13, i64 -1
ret i64 %14
}