#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 mpu_write_mem(int, int, unsigned char *);
int dmp_set_tap_axes(unsigned char axis) {
  unsigned char tmp = 0;
  if (axis & (0x01))
    tmp |= 0x30;
  if (axis & (0x02))
    tmp |= 0x0C;
  if (axis & (0x04))
    tmp |= 0x03;
  return mpu_write_mem((256 + 72), 1, &tmp);
}


x86 assembly (clang, -O0):
<dmp_set_tap_axes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     113c <dmp_set_tap_axes+0x2c>
movzbl -0x2(%rbp),%eax
or     $0x30,%eax
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1156 <dmp_set_tap_axes+0x46>
movzbl -0x2(%rbp),%eax
or     $0xc,%eax
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1170 <dmp_set_tap_axes+0x60>
movzbl -0x2(%rbp),%eax
or     $0x3,%eax
mov    %al,-0x2(%rbp)
mov    $0x148,%edi
mov    $0x1,%esi
lea    -0x2(%rbp),%rdx
call   1030 <mpu_write_mem@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmp_set_tap_axes>:
push   %rax
mov    %edi,%eax
and    $0x1,%eax
mov    $0x30,%ecx
cmove  %eax,%ecx
lea    0xc(%rcx),%eax
test   $0x2,%dil
movzbl %al,%eax
cmove  %ecx,%eax
mov    %eax,%ecx
or     $0x3,%cl
test   $0x4,%dil
movzbl %cl,%ecx
cmove  %eax,%ecx
mov    %cl,0x7(%rsp)
lea    0x7(%rsp),%rdx
mov    $0x148,%edi
mov    $0x1,%esi
call   1030 <mpu_write_mem@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dmp_set_tap_axes(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
store i8 0, i8* %3
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = and i32 %5, 1
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = or i32 %10, 48
%12 = trunc i32 %11 to i8
store i8 %12, i8* %3
br label %13
13: ; preds = %8, %1
%14 = load i8, i8* %2
%15 = zext i8 %14 to i32
%16 = and i32 %15, 2
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %13
%19 = load i8, i8* %3
%20 = zext i8 %19 to i32
%21 = or i32 %20, 12
%22 = trunc i32 %21 to i8
store i8 %22, i8* %3
br label %23
23: ; preds = %18, %13
%24 = load i8, i8* %2
%25 = zext i8 %24 to i32
%26 = and i32 %25, 4
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = load i8, i8* %3
%30 = zext i8 %29 to i32
%31 = or i32 %30, 3
%32 = trunc i32 %31 to i8
store i8 %32, i8* %3
br label %33
33: ; preds = %28, %23
%34 = call i32 @mpu_write_mem(i32 328, i32 1, i8* %3)
ret i32 %34
}

LLVM IR (-O2):
define i32 @dmp_set_tap_axes(i8 zeroext %0) {
%2 = alloca i8
%3 = zext i8 %0 to i32
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8 0, i8 48
%7 = and i32 %3, 2
%8 = icmp eq i32 %7, 0
%9 = or i8 %6, 12
%10 = select i1 %8, i8 %6, i8 %9
%11 = and i32 %3, 4
%12 = icmp eq i32 %11, 0
%13 = or i8 %10, 3
%14 = select i1 %12, i8 %10, i8 %13
store i8 %14, i8* %2
%15 = call i32 @mpu_write_mem(i32 328, i32 1, i8* %2)
ret i32 %15
}