#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 int16_t;

/* Variables and functions */
int i2c_smbus_read_byte_data(int, int);
void readIMU(int fd, int16_t *output) {
  output[0] = i2c_smbus_read_byte_data(fd, 0x41) << 8 |
              i2c_smbus_read_byte_data(fd, 0x42);
  output[1] = i2c_smbus_read_byte_data(fd, 0x3b) << 8 |
              i2c_smbus_read_byte_data(fd, 0x3c);
  output[2] = i2c_smbus_read_byte_data(fd, 0x3d) << 8 |
              i2c_smbus_read_byte_data(fd, 0x3e);
  output[3] = i2c_smbus_read_byte_data(fd, 0x3f) << 8 |
              i2c_smbus_read_byte_data(fd, 0x40);
  output[4] = i2c_smbus_read_byte_data(fd, 0x43) << 8 |
              i2c_smbus_read_byte_data(fd, 0x44);
  output[5] = i2c_smbus_read_byte_data(fd, 0x45) << 8 |
              i2c_smbus_read_byte_data(fd, 0x46);
  output[6] = i2c_smbus_read_byte_data(fd, 0x47) << 8 |
              i2c_smbus_read_byte_data(fd, 0x48);
}


x86 assembly (clang, -O0):
<readIMU>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x41,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
shl    $0x8,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x42,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    -0x2c(%rbp),%ecx
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    $0x3b,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
shl    $0x8,%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x3c,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    -0x28(%rbp),%ecx
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%edi
mov    $0x3d,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
shl    $0x8,%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x3e,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    -0x24(%rbp),%ecx
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x4(%rbp),%edi
mov    $0x3f,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
shl    $0x8,%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x40,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    -0x20(%rbp),%ecx
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x4(%rbp),%edi
mov    $0x43,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
shl    $0x8,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x44,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    -0x1c(%rbp),%ecx
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x4(%rbp),%edi
mov    $0x45,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
shl    $0x8,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x46,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    -0x18(%rbp),%ecx
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x4(%rbp),%edi
mov    $0x47,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x48,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    -0x14(%rbp),%ecx
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x18(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readIMU>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x41,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    %ebp,%edi
mov    $0x42,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
or     %ebx,%eax
mov    %eax,(%r14)
mov    %ebp,%edi
mov    $0x3b,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    %ebp,%edi
mov    $0x3c,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
or     %ebx,%eax
mov    %eax,0x4(%r14)
mov    %ebp,%edi
mov    $0x3d,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    %ebp,%edi
mov    $0x3e,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
or     %ebx,%eax
mov    %eax,0x8(%r14)
mov    %ebp,%edi
mov    $0x3f,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    %ebp,%edi
mov    $0x40,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
or     %ebx,%eax
mov    %eax,0xc(%r14)
mov    %ebp,%edi
mov    $0x43,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    %ebp,%edi
mov    $0x44,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
or     %ebx,%eax
mov    %eax,0x10(%r14)
mov    %ebp,%edi
mov    $0x45,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    %ebp,%edi
mov    $0x46,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
or     %ebx,%eax
mov    %eax,0x14(%r14)
mov    %ebp,%edi
mov    $0x47,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    %ebp,%edi
mov    $0x48,%esi
call   1030 <i2c_smbus_read_byte_data@plt>
or     %ebx,%eax
mov    %eax,0x18(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @readIMU(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = call i32 @i2c_smbus_read_byte_data(i32 %5, i32 65)
%7 = shl i32 %6, 8
%8 = load i32, i32* %3
%9 = call i32 @i2c_smbus_read_byte_data(i32 %8, i32 66)
%10 = or i32 %7, %9
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 0
store i32 %10, i32* %12
%13 = load i32, i32* %3
%14 = call i32 @i2c_smbus_read_byte_data(i32 %13, i32 59)
%15 = shl i32 %14, 8
%16 = load i32, i32* %3
%17 = call i32 @i2c_smbus_read_byte_data(i32 %16, i32 60)
%18 = or i32 %15, %17
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 1
store i32 %18, i32* %20
%21 = load i32, i32* %3
%22 = call i32 @i2c_smbus_read_byte_data(i32 %21, i32 61)
%23 = shl i32 %22, 8
%24 = load i32, i32* %3
%25 = call i32 @i2c_smbus_read_byte_data(i32 %24, i32 62)
%26 = or i32 %23, %25
%27 = load i32*, i32** %4
%28 = getelementptr inbounds i32, i32* %27, i64 2
store i32 %26, i32* %28
%29 = load i32, i32* %3
%30 = call i32 @i2c_smbus_read_byte_data(i32 %29, i32 63)
%31 = shl i32 %30, 8
%32 = load i32, i32* %3
%33 = call i32 @i2c_smbus_read_byte_data(i32 %32, i32 64)
%34 = or i32 %31, %33
%35 = load i32*, i32** %4
%36 = getelementptr inbounds i32, i32* %35, i64 3
store i32 %34, i32* %36
%37 = load i32, i32* %3
%38 = call i32 @i2c_smbus_read_byte_data(i32 %37, i32 67)
%39 = shl i32 %38, 8
%40 = load i32, i32* %3
%41 = call i32 @i2c_smbus_read_byte_data(i32 %40, i32 68)
%42 = or i32 %39, %41
%43 = load i32*, i32** %4
%44 = getelementptr inbounds i32, i32* %43, i64 4
store i32 %42, i32* %44
%45 = load i32, i32* %3
%46 = call i32 @i2c_smbus_read_byte_data(i32 %45, i32 69)
%47 = shl i32 %46, 8
%48 = load i32, i32* %3
%49 = call i32 @i2c_smbus_read_byte_data(i32 %48, i32 70)
%50 = or i32 %47, %49
%51 = load i32*, i32** %4
%52 = getelementptr inbounds i32, i32* %51, i64 5
store i32 %50, i32* %52
%53 = load i32, i32* %3
%54 = call i32 @i2c_smbus_read_byte_data(i32 %53, i32 71)
%55 = shl i32 %54, 8
%56 = load i32, i32* %3
%57 = call i32 @i2c_smbus_read_byte_data(i32 %56, i32 72)
%58 = or i32 %55, %57
%59 = load i32*, i32** %4
%60 = getelementptr inbounds i32, i32* %59, i64 6
store i32 %58, i32* %60
ret void
}

LLVM IR (-O2):
define void @readIMU(i32 %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 65)
%4 = shl i32 %3, 8
%5 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 66)
%6 = or i32 %4, %5
store i32 %6, i32* %1
%7 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 59)
%8 = shl i32 %7, 8
%9 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 60)
%10 = or i32 %8, %9
%11 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %10, i32* %11
%12 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 61)
%13 = shl i32 %12, 8
%14 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 62)
%15 = or i32 %13, %14
%16 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %15, i32* %16
%17 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 63)
%18 = shl i32 %17, 8
%19 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 64)
%20 = or i32 %18, %19
%21 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %20, i32* %21
%22 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 67)
%23 = shl i32 %22, 8
%24 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 68)
%25 = or i32 %23, %24
%26 = getelementptr inbounds i32, i32* %1, i64 4
store i32 %25, i32* %26
%27 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 69)
%28 = shl i32 %27, 8
%29 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 70)
%30 = or i32 %28, %29
%31 = getelementptr inbounds i32, i32* %1, i64 5
store i32 %30, i32* %31
%32 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 71)
%33 = shl i32 %32, 8
%34 = tail call i32 @i2c_smbus_read_byte_data(i32 %0, i32 72)
%35 = or i32 %33, %34
%36 = getelementptr inbounds i32, i32* %1, i64 6
store i32 %35, i32* %36
ret void
}