#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 union i2c_smbus_data {
  int dummy;
} i2c_smbus_data;
struct i2c_smbus_ioctl_data {
  char read_write;
  int command;
  int size;
  union i2c_smbus_data *data;
};
typedef int /*<<< orphan*/ __s32;

/* Variables and functions */
int /*<<< orphan*/ I2C_SMBUS;
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/,
                         struct i2c_smbus_ioctl_data *);
__s32 i2c_smbus_access(int fd, char rw, int cmd, int size,
                       union i2c_smbus_data *data) {
  struct i2c_smbus_ioctl_data args;
  args.read_write = rw;
  args.command = cmd;
  args.size = size;
  args.data = data;
  return ioctl(fd, I2C_SMBUS, &args);
}


x86 assembly (clang, -O0):
<i2c_smbus_access>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x5(%rbp),%al
mov    %al,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1030 <ioctl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_smbus_access>:
sub    $0x18,%rsp
mov    %sil,(%rsp)
mov    %edx,0x4(%rsp)
mov    %ecx,0x8(%rsp)
mov    %r8,0x10(%rsp)
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
call   1030 <ioctl@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%union.i2c_smbus_data = type { i32 }
%struct.i2c_smbus_ioctl_data = type { i8, i32, i32, %union.i2c_smbus_data* }
@I2C_SMBUS = global i32 0
define i32 @i2c_smbus_access(i32 %0, i8 signext %1, i32 %2, i32 %3, %union.i2c_smbus_data* %4) {
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca %union.i2c_smbus_data*
%11 = alloca %struct.i2c_smbus_ioctl_data
store i32 %0, i32* %6
store i8 %1, i8* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store %union.i2c_smbus_data* %4, %union.i2c_smbus_data** %10
%12 = load i8, i8* %7
%13 = getelementptr inbounds %struct.i2c_smbus_ioctl_data, %struct.i2c_smbus_ioctl_data* %11, i32 0, i32 0
store i8 %12, i8* %13
%14 = load i32, i32* %8
%15 = getelementptr inbounds %struct.i2c_smbus_ioctl_data, %struct.i2c_smbus_ioctl_data* %11, i32 0, i32 1
store i32 %14, i32* %15
%16 = load i32, i32* %9
%17 = getelementptr inbounds %struct.i2c_smbus_ioctl_data, %struct.i2c_smbus_ioctl_data* %11, i32 0, i32 2
store i32 %16, i32* %17
%18 = load %union.i2c_smbus_data*, %union.i2c_smbus_data** %10
%19 = getelementptr inbounds %struct.i2c_smbus_ioctl_data, %struct.i2c_smbus_ioctl_data* %11, i32 0, i32 3
store %union.i2c_smbus_data* %18, %union.i2c_smbus_data** %19
%20 = load i32, i32* %6
%21 = load i32, i32* @I2C_SMBUS
%22 = call i32 @ioctl(i32 %20, i32 %21, %struct.i2c_smbus_ioctl_data* %11)
ret i32 %22
}

LLVM IR (-O2):
%union.i2c_smbus_data = type { i32 }
%struct.i2c_smbus_ioctl_data = type { i8, i32, i32, %union.i2c_smbus_data* }
@I2C_SMBUS = global i32 0
define i32 @i2c_smbus_access(i32 %0, i8 signext %1, i32 %2, i32 %3, %union.i2c_smbus_data* %4) {
%6 = alloca %struct.i2c_smbus_ioctl_data
%7 = getelementptr inbounds %struct.i2c_smbus_ioctl_data, %struct.i2c_smbus_ioctl_data* %6, i64 0, i32 0
store i8 %1, i8* %7
%8 = getelementptr inbounds %struct.i2c_smbus_ioctl_data, %struct.i2c_smbus_ioctl_data* %6, i64 0, i32 1
store i32 %2, i32* %8
%9 = getelementptr inbounds %struct.i2c_smbus_ioctl_data, %struct.i2c_smbus_ioctl_data* %6, i64 0, i32 2
store i32 %3, i32* %9
%10 = getelementptr inbounds %struct.i2c_smbus_ioctl_data, %struct.i2c_smbus_ioctl_data* %6, i64 0, i32 3
store %union.i2c_smbus_data* %4, %union.i2c_smbus_data** %10
%11 = load i32, i32* @I2C_SMBUS
%12 = call i32 @ioctl(i32 %0, i32 %11, %struct.i2c_smbus_ioctl_data* %6)
ret i32 %12
}