#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 */

/* Variables and functions */
int /*<<< orphan*/ mpu6050_read(int, char *, int);
void mpu6050_read_gyro(short *pBuffer) {
  char gyro_buffer[6];
  mpu6050_read(0x43, gyro_buffer, 6);
  pBuffer[0] = ((gyro_buffer[0] << 8) + gyro_buffer[1]);
  pBuffer[1] = ((gyro_buffer[2] << 8) + gyro_buffer[3]);
  pBuffer[2] = ((gyro_buffer[4] << 8) + gyro_buffer[5]);
}


x86 assembly (clang, -O0):
<mpu6050_read_gyro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xe(%rbp),%rsi
mov    $0x43,%edi
mov    $0x6,%edx
call   1030 <mpu6050_read@plt>
movsbl -0xe(%rbp),%eax
shl    $0x8,%eax
movsbl -0xd(%rbp),%ecx
add    %ecx,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
movsbl -0xc(%rbp),%eax
shl    $0x8,%eax
movsbl -0xb(%rbp),%ecx
add    %ecx,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,0x2(%rax)
movsbl -0xa(%rbp),%eax
shl    $0x8,%eax
movsbl -0x9(%rbp),%ecx
add    %ecx,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,0x4(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpu6050_read_gyro>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xa(%rsp),%rsi
mov    $0x43,%edi
mov    $0x6,%edx
call   1030 <mpu6050_read@plt>
movzbl 0xa(%rsp),%eax
shl    $0x8,%eax
movsbl 0xb(%rsp),%ecx
add    %eax,%ecx
mov    %cx,(%rbx)
movzbl 0xc(%rsp),%eax
shl    $0x8,%eax
movsbl 0xd(%rsp),%ecx
add    %eax,%ecx
mov    %cx,0x2(%rbx)
movzbl 0xe(%rsp),%eax
shl    $0x8,%eax
movsbl 0xf(%rsp),%ecx
add    %eax,%ecx
mov    %cx,0x4(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @mpu6050_read_gyro(i16* %0) {
%2 = alloca i16*
%3 = alloca [6 x i8]
store i16* %0, i16** %2
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%5 = call i32 @mpu6050_read(i32 67, i8* %4, i32 6)
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = shl i32 %8, 8
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = add nsw i32 %9, %12
%14 = trunc i32 %13 to i16
%15 = load i16*, i16** %2
%16 = getelementptr inbounds i16, i16* %15, i64 0
store i16 %14, i16* %16
%17 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 2
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = add nsw i32 %20, %23
%25 = trunc i32 %24 to i16
%26 = load i16*, i16** %2
%27 = getelementptr inbounds i16, i16* %26, i64 1
store i16 %25, i16* %27
%28 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 4
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = shl i32 %30, 8
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 5
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = add nsw i32 %31, %34
%36 = trunc i32 %35 to i16
%37 = load i16*, i16** %2
%38 = getelementptr inbounds i16, i16* %37, i64 2
store i16 %36, i16* %38
ret void
}

LLVM IR (-O2):
define void @mpu6050_read_gyro(i16* nocapture writeonly %0) {
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%4 = call i32 @mpu6050_read(i32 67, i8* %3, i32 6)
%5 = load i8, i8* %3
%6 = zext i8 %5 to i16
%7 = shl nuw i16 %6, 8
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i16
%11 = add i16 %7, %10
store i16 %11, i16* %0
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 2
%13 = load i8, i8* %12
%14 = zext i8 %13 to i16
%15 = shl nuw i16 %14, 8
%16 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i16
%19 = add i16 %15, %18
%20 = getelementptr inbounds i16, i16* %0, i64 1
store i16 %19, i16* %20
%21 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 4
%22 = load i8, i8* %21
%23 = zext i8 %22 to i16
%24 = shl nuw i16 %23, 8
%25 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 5
%26 = load i8, i8* %25
%27 = sext i8 %26 to i16
%28 = add i16 %24, %27
%29 = getelementptr inbounds i16, i16* %0, i64 2
store i16 %28, i16* %29
ret void
}