#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*/ O_RDWR;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ i2c_write(int, int, int, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int mpl3115_init() {
  int fd;
  if ((fd = open("/dev/i2c-3", O_RDWR)) < 0) {
    perror("error openning i2c-3!\n");
    exit(1);
  }
  i2c_write(fd, 0x60, 0x26, 0x38);
  i2c_write(fd, 0x60, 0x13, 0x07);
  i2c_write(fd, 0x60, 0x26, 0x39);
  return fd;
}


x86 assembly (clang, -O0):
<mpl3115_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xea8(%rip),%rdi
call   1040 <open@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    117f <mpl3115_init+0x3f>
lea    0xe9b(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x4(%rbp),%edi
mov    $0x60,%esi
mov    $0x26,%edx
mov    $0x38,%ecx
call   1030 <i2c_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x60,%esi
mov    $0x13,%edx
mov    $0x7,%ecx
call   1030 <i2c_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x60,%esi
mov    $0x26,%edx
mov    $0x39,%ecx
call   1030 <i2c_write@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpl3115_init>:
push   %rbx
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
lea    0xeaf(%rip),%rdi
call   1040 <open@plt>
test   %eax,%eax
js     11a2 <mpl3115_init+0x62>
mov    %eax,%ebx
mov    %eax,%edi
mov    $0x60,%esi
mov    $0x26,%edx
mov    $0x38,%ecx
call   1030 <i2c_write@plt>
mov    %ebx,%edi
mov    $0x60,%esi
mov    $0x13,%edx
mov    $0x7,%ecx
call   1030 <i2c_write@plt>
mov    %ebx,%edi
mov    $0x60,%esi
mov    $0x26,%edx
mov    $0x39,%ecx
call   1030 <i2c_write@plt>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe62(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"/dev/i2c-3\00"
@O_RDWR = global i32 0
@.str.1 = [23 x i8] c"error openning i2c-3!\0A\00"
define i32 @mpl3115_init() {
%1 = alloca i32
%2 = load i32, i32* @O_RDWR
%3 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
store i32 %3, i32* %1
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = load i32, i32* %1
%10 = call i32 @i2c_write(i32 %9, i32 96, i32 38, i32 56)
%11 = load i32, i32* %1
%12 = call i32 @i2c_write(i32 %11, i32 96, i32 19, i32 7)
%13 = load i32, i32* %1
%14 = call i32 @i2c_write(i32 %13, i32 96, i32 38, i32 57)
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [11 x i8] c"/dev/i2c-3\00"
@O_RDWR = global i32 0
@.str.1 = [23 x i8] c"error openning i2c-3!\0A\00"
define i32 @mpl3115_init() {
%1 = load i32, i32* @O_RDWR
%2 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %0
%8 = tail call i32 @i2c_write(i32 %2, i32 96, i32 38, i32 56)
%9 = tail call i32 @i2c_write(i32 %2, i32 96, i32 19, i32 7)
%10 = tail call i32 @i2c_write(i32 %2, i32 96, i32 38, i32 57)
ret i32 %2
}