#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 /*<<< orphan*/ int32_t;

/* Variables and functions */
int i2c_read_leint32_array(int, int, int, int /*<<< orphan*/ *, int);
int km2_odometry(int bus, int chip_addr, int32_t *odoL, int32_t *odoR) {
  int32_t values[2];
  int err = i2c_read_leint32_array(bus, chip_addr, 0x01, values, 2);
  if (err == 2) {
    *odoL = values[0];
    *odoR = values[1];
  }
  return err;
}


x86 assembly (clang, -O0):
<km2_odometry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x20(%rbp),%rcx
mov    $0x1,%edx
mov    $0x2,%r8d
call   1030 <i2c_read_leint32_array@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jne    115f <km2_odometry+0x4f>
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<km2_odometry>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsp,%rcx
mov    $0x1,%edx
mov    $0x2,%r8d
call   1030 <i2c_read_leint32_array@plt>
cmp    $0x2,%eax
jne    113e <km2_odometry+0x2e>
mov    (%rsp),%ecx
mov    %ecx,(%rbx)
mov    0x4(%rsp),%ecx
mov    %ecx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @km2_odometry(i32 %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca [2 x i32]
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%14 = call i32 @i2c_read_leint32_array(i32 %11, i32 %12, i32 1, i32* %13, i32 2)
store i32 %14, i32* %10
%15 = load i32, i32* %10
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %24
17: ; preds = %4
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%19 = load i32, i32* %18
%20 = load i32*, i32** %7
store i32 %19, i32* %20
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%22 = load i32, i32* %21
%23 = load i32*, i32** %8
store i32 %22, i32* %23
br label %24
24: ; preds = %17, %4
%25 = load i32, i32* %10
ret i32 %25
}

LLVM IR (-O2):
define i32 @km2_odometry(i32 %0, i32 %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = alloca [2 x i32]
%6 = bitcast [2 x i32]* %5 to i8*
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%8 = call i32 @i2c_read_leint32_array(i32 %0, i32 %1, i32 1, i32* %7, i32 2)
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = load i32, i32* %7
store i32 %11, i32* %2
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%13 = load i32, i32* %12
store i32 %13, i32* %3
br label %14
14: ; preds = %10, %4
ret i32 %8
}