#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*/ i2c_read_start0(int, int, unsigned char *, int);
int /*<<< orphan*/ i2c_read_start1(int, int, unsigned char *, int);
int I2C_read_nonblock(int mask, int i2c_addr, unsigned char *p, int len) {
  if (mask & 0x01) {
    i2c_read_start0(i2c_addr, -1, p, len);
  }
  if (mask & 0x02) {
    i2c_read_start1(i2c_addr, -1, p, len);
  }
  return 0;
}


x86 assembly (clang, -O0):
<I2C_read_nonblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1158 <I2C_read_nonblock+0x38>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0xffffffff,%esi
call   1030 <i2c_read_start0@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     117b <I2C_read_nonblock+0x5b>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0xffffffff,%esi
call   1040 <i2c_read_start1@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2C_read_nonblock>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %esi,%ebp
mov    %edi,%ebx
test   $0x1,%bl
je     1148 <I2C_read_nonblock+0x28>
mov    %ebp,%edi
mov    $0xffffffff,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1030 <i2c_read_start0@plt>
test   $0x2,%bl
je     115f <I2C_read_nonblock+0x3f>
mov    %ebp,%edi
mov    $0xffffffff,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1040 <i2c_read_start1@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @I2C_read_nonblock(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = and i32 %9, 1
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = load i32, i32* %6
%14 = load i8*, i8** %7
%15 = load i32, i32* %8
%16 = call i32 @i2c_read_start0(i32 %13, i32 -1, i8* %14, i32 %15)
br label %17
17: ; preds = %12, %4
%18 = load i32, i32* %5
%19 = and i32 %18, 2
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = load i32, i32* %6
%23 = load i8*, i8** %7
%24 = load i32, i32* %8
%25 = call i32 @i2c_read_start1(i32 %22, i32 -1, i8* %23, i32 %24)
br label %26
26: ; preds = %21, %17
ret i32 0
}

LLVM IR (-O2):
define i32 @I2C_read_nonblock(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = and i32 %0, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @i2c_read_start0(i32 %1, i32 -1, i8* %2, i32 %3)
br label %9
9: ; preds = %7, %4
%10 = and i32 %0, 2
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 @i2c_read_start1(i32 %1, i32 -1, i8* %2, i32 %3)
br label %14
14: ; preds = %12, %9
ret i32 0
}