#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 uint8_t;
typedef int int16_t;

/* Variables and functions */
int /*<<< orphan*/ i2c_read(int, int, int, int *);
int16_t mpl3115_get_press(int fd) {
  uint8_t ah, ac, al;
  i2c_read(fd, 0x60, 0x01, &ah);
  i2c_read(fd, 0x60, 0x02, &ac);
  i2c_read(fd, 0x60, 0x03, &al);
  return ((ah << 10) + (ac << 2) + (al >> 6)) / 10;
}


x86 assembly (clang, -O0):
<mpl3115_get_press>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x60,%esi
mov    $0x1,%edx
lea    -0x8(%rbp),%rcx
call   1030 <i2c_read@plt>
mov    -0x4(%rbp),%edi
mov    $0x60,%esi
mov    $0x2,%edx
lea    -0xc(%rbp),%rcx
call   1030 <i2c_read@plt>
mov    -0x4(%rbp),%edi
mov    $0x60,%esi
mov    $0x3,%edx
lea    -0x10(%rbp),%rcx
call   1030 <i2c_read@plt>
mov    -0x8(%rbp),%eax
shl    $0xa,%eax
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%ecx
sar    $0x6,%ecx
add    %ecx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpl3115_get_press>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xc(%rsp),%rcx
mov    $0x60,%esi
mov    $0x1,%edx
call   1030 <i2c_read@plt>
lea    0x8(%rsp),%rcx
mov    %ebx,%edi
mov    $0x60,%esi
mov    $0x2,%edx
call   1030 <i2c_read@plt>
lea    0x4(%rsp),%rcx
mov    %ebx,%edi
mov    $0x60,%esi
mov    $0x3,%edx
call   1030 <i2c_read@plt>
mov    0xc(%rsp),%eax
shl    $0xa,%eax
mov    0x8(%rsp),%ecx
lea    (%rax,%rcx,4),%eax
mov    0x4(%rsp),%ecx
sar    $0x6,%ecx
add    %eax,%ecx
movslq %ecx,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @mpl3115_get_press(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @i2c_read(i32 %6, i32 96, i32 1, i32* %3)
%8 = load i32, i32* %2
%9 = call i32 @i2c_read(i32 %8, i32 96, i32 2, i32* %4)
%10 = load i32, i32* %2
%11 = call i32 @i2c_read(i32 %10, i32 96, i32 3, i32* %5)
%12 = load i32, i32* %3
%13 = shl i32 %12, 10
%14 = load i32, i32* %4
%15 = shl i32 %14, 2
%16 = add nsw i32 %13, %15
%17 = load i32, i32* %5
%18 = ashr i32 %17, 6
%19 = add nsw i32 %16, %18
%20 = sdiv i32 %19, 10
ret i32 %20
}

LLVM IR (-O2):
define i32 @mpl3115_get_press(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = call i32 @i2c_read(i32 %0, i32 96, i32 1, i32* %2)
%9 = call i32 @i2c_read(i32 %0, i32 96, i32 2, i32* %3)
%10 = call i32 @i2c_read(i32 %0, i32 96, i32 3, i32* %4)
%11 = load i32, i32* %2
%12 = shl i32 %11, 10
%13 = load i32, i32* %3
%14 = shl i32 %13, 2
%15 = add nsw i32 %14, %12
%16 = load i32, i32* %4
%17 = ashr i32 %16, 6
%18 = add nsw i32 %15, %17
%19 = sdiv i32 %18, 10
ret i32 %19
}