#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 *block;
};
typedef int __u8;
typedef int /*<<< orphan*/ __s32;

/* Variables and functions */
int /*<<< orphan*/ i2c_smbus_access(int, int /*<<< orphan*/, int, int,
                                    union i2c_smbus_data *);
__s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length,
                                 __u8 *values) {
  union i2c_smbus_data data;
  int i;
  if (length > 32)
    length = 32;
  for (i = 1; i <= length; i++)
    data.block[i] = values[i - 1];
  data.block[0] = length;
  return i2c_smbus_access(file, 0, command, 5, &data);
}


x86 assembly (clang, -O0):
<i2c_smbus_write_block_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
cmpl   $0x20,-0xc(%rbp)
jle    1136 <i2c_smbus_write_block_data+0x26>
movl   $0x20,-0xc(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1172 <i2c_smbus_write_block_data+0x62>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113d <i2c_smbus_write_block_data+0x2d>
mov    -0xc(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
xor    %esi,%esi
mov    $0x5,%ecx
lea    -0x20(%rbp),%r8
call   1030 <i2c_smbus_access@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
%union.i2c_smbus_data = type { i32* }
define i32 @i2c_smbus_write_block_data(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca %union.i2c_smbus_data
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%11 = load i32, i32* %7
%12 = icmp sgt i32 %11, 32
br i1 %12, label %13, label %14
13: ; preds = %4
store i32 32, i32* %7
br label %14
14: ; preds = %13, %4
store i32 1, i32* %10
br label %15
15: ; preds = %31, %14
%16 = load i32, i32* %10
%17 = load i32, i32* %7
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = load i32*, i32** %8
%21 = load i32, i32* %10
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %20, i64 %23
%25 = load i32, i32* %24
%26 = bitcast %union.i2c_smbus_data* %9 to i32**
%27 = load i32*, i32** %26
%28 = load i32, i32* %10
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
store i32 %25, i32* %30
br label %31
31: ; preds = %19
%32 = load i32, i32* %10
%33 = add nsw i32 %32, 1
store i32 %33, i32* %10
br label %15
34: ; preds = %15
%35 = load i32, i32* %7
%36 = bitcast %union.i2c_smbus_data* %9 to i32**
%37 = load i32*, i32** %36
%38 = getelementptr inbounds i32, i32* %37, i64 0
store i32 %35, i32* %38
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = call i32 @i2c_smbus_access(i32 %39, i32 0, i32 %40, i32 5, %union.i2c_smbus_data* %9)
ret i32 %41
}

LLVM IR (-O2):