#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*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
int st103_get_epreg(int /*<<< orphan*/);
int /*<<< orphan*/ st103_set_epreg(int /*<<< orphan*/, int);
void st103_ep_set_rxtx_status(uint8_t ep_num, uint16_t st_rx, uint16_t st_tx) {
  uint16_t value = st103_get_epreg(ep_num);
  value &= (((0x8000) | (0x0800) | (0x0600) | (0x0100) | (0x0080) | (0x000F)) |
            (0x3000) | (0x0030));
  value ^= ((0x1000) & st_rx);
  value ^= ((0x2000) & st_rx);
  value ^= ((0x0010) & st_tx);
  value ^= ((0x0020) & st_tx);
  value |= (0x8000) | (0x0080);
  st103_set_epreg(ep_num, value);
}


x86 assembly (clang, -O0):
<st103_ep_set_rxtx_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <st103_get_epreg@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0xbfbf,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1000,%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    $0x2000,%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x10,%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x20,%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     $0x8080,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <st103_set_epreg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<st103_ep_set_rxtx_status>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
call   1040 <st103_get_epreg@plt>
and    $0x3f3f,%eax
and    $0x3000,%ebp
and    $0x30,%ebx
or     %ebp,%ebx
xor    %eax,%ebx
or     $0x8080,%ebx
mov    %r14d,%edi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <st103_set_epreg@plt>

LLVM IR (-O0):
define void @st103_ep_set_rxtx_status(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = call i32 @st103_get_epreg(i32 %8)
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = and i32 %10, 49087
store i32 %11, i32* %7
%12 = load i32, i32* %5
%13 = and i32 4096, %12
%14 = load i32, i32* %7
%15 = xor i32 %14, %13
store i32 %15, i32* %7
%16 = load i32, i32* %5
%17 = and i32 8192, %16
%18 = load i32, i32* %7
%19 = xor i32 %18, %17
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = and i32 16, %20
%22 = load i32, i32* %7
%23 = xor i32 %22, %21
store i32 %23, i32* %7
%24 = load i32, i32* %6
%25 = and i32 32, %24
%26 = load i32, i32* %7
%27 = xor i32 %26, %25
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = or i32 %28, 32896
store i32 %29, i32* %7
%30 = load i32, i32* %4
%31 = load i32, i32* %7
%32 = call i32 @st103_set_epreg(i32 %30, i32 %31)
ret void
}

LLVM IR (-O2):
define void @st103_ep_set_rxtx_status(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @st103_get_epreg(i32 %0)
%5 = and i32 %4, 16191
%6 = and i32 %1, 12288
%7 = and i32 %2, 48
%8 = or i32 %7, %6
%9 = xor i32 %8, %5
%10 = or i32 %9, 32896
%11 = tail call i32 @st103_set_epreg(i32 %0, i32 %10)
ret void
}