#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 i2c_rw(int, int);
int getxy(int fd, int *xp, int *yp) {
  int z1, z2;
  *xp = (4096 - (i2c_rw(fd, 0xd4) >> 4));
  *yp = (4096 - (i2c_rw(fd, 0xc4) >> 4));
  z1 = i2c_rw(fd, 0xe4);
  z2 = i2c_rw(fd, 0xf4);
  i2c_rw(fd, 0);
  return (z1 != 0);
}


x86 assembly (clang, -O0):
<getxy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xd4,%esi
call   1030 <i2c_rw@plt>
sar    $0x4,%eax
mov    $0x1000,%ecx
sub    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    $0xc4,%esi
call   1030 <i2c_rw@plt>
sar    $0x4,%eax
mov    $0x1000,%ecx
sub    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    $0xe4,%esi
call   1030 <i2c_rw@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xf4,%esi
call   1030 <i2c_rw@plt>
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <i2c_rw@plt>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getxy>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebx
mov    $0xd4,%esi
call   1030 <i2c_rw@plt>
sar    $0x4,%eax
mov    $0x1000,%ebp
mov    $0x1000,%ecx
sub    %eax,%ecx
mov    %ecx,(%r15)
mov    %ebx,%edi
mov    $0xc4,%esi
call   1030 <i2c_rw@plt>
sar    $0x4,%eax
sub    %eax,%ebp
mov    %ebp,(%r14)
mov    %ebx,%edi
mov    $0xe4,%esi
call   1030 <i2c_rw@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0xf4,%esi
call   1030 <i2c_rw@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <i2c_rw@plt>
xor    %eax,%eax
test   %ebp,%ebp
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getxy(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i32, i32* %4
%10 = call i32 @i2c_rw(i32 %9, i32 212)
%11 = ashr i32 %10, 4
%12 = sub nsw i32 4096, %11
%13 = load i32*, i32** %5
store i32 %12, i32* %13
%14 = load i32, i32* %4
%15 = call i32 @i2c_rw(i32 %14, i32 196)
%16 = ashr i32 %15, 4
%17 = sub nsw i32 4096, %16
%18 = load i32*, i32** %6
store i32 %17, i32* %18
%19 = load i32, i32* %4
%20 = call i32 @i2c_rw(i32 %19, i32 228)
store i32 %20, i32* %7
%21 = load i32, i32* %4
%22 = call i32 @i2c_rw(i32 %21, i32 244)
store i32 %22, i32* %8
%23 = load i32, i32* %4
%24 = call i32 @i2c_rw(i32 %23, i32 0)
%25 = load i32, i32* %7
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @getxy(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = tail call i32 @i2c_rw(i32 %0, i32 212)
%5 = ashr i32 %4, 4
%6 = sub nsw i32 4096, %5
store i32 %6, i32* %1
%7 = tail call i32 @i2c_rw(i32 %0, i32 196)
%8 = ashr i32 %7, 4
%9 = sub nsw i32 4096, %8
store i32 %9, i32* %2
%10 = tail call i32 @i2c_rw(i32 %0, i32 228)
%11 = tail call i32 @i2c_rw(i32 %0, i32 244)
%12 = tail call i32 @i2c_rw(i32 %0, i32 0)
%13 = icmp ne i32 %10, 0
%14 = zext i1 %13 to i32
ret i32 %14
}