#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 uint8_t;
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
int32_t USBEndpointDataSend(uint32_t ui32Base, uint32_t ui32Endpoint,
                            uint32_t ui32TransType) {
  uint32_t ui32TxPktRdy;
  ;

  ;
  if (ui32Endpoint == 0x00000000) {
    if ((*((volatile uint8_t *)(ui32Base + 0x00000102))) & 0x00000002) {
      return (-1);
    }
    ui32TxPktRdy = ui32TransType & 0xff;
  } else {
    if ((*((volatile uint8_t *)(ui32Base + 0x00000102 + ui32Endpoint))) &
        0x00000001) {
      return (-1);
    }
    ui32TxPktRdy = (ui32TransType >> 8) & 0xff;
  }
  (*((volatile uint8_t *)(ui32Base + 0x00000102 + ui32Endpoint))) =
      ui32TxPktRdy;
  return (0);
}


x86 assembly (clang, -O0):
<USBEndpointDataSend>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114b <USBEndpointDataSend+0x4b>
mov    -0x8(%rbp),%eax
add    $0x102,%eax
cltq
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     113b <USBEndpointDataSend+0x3b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1199 <USBEndpointDataSend+0x99>
mov    -0x10(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
jmp    1180 <USBEndpointDataSend+0x80>
mov    -0x8(%rbp),%eax
add    $0x102,%eax
add    -0xc(%rbp),%eax
cltq
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1172 <USBEndpointDataSend+0x72>
movl   $0xffffffff,-0x4(%rbp)
jmp    1199 <USBEndpointDataSend+0x99>
mov    -0x10(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%eax
add    $0x102,%eax
add    -0xc(%rbp),%eax
cltq
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBEndpointDataSend>:
movslq %edi,%rcx
add    $0x102,%rcx
test   %esi,%esi
je     1127 <USBEndpointDataSend+0x27>
movslq %esi,%rsi
mov    (%rcx,%rsi,1),%edi
mov    $0xffffffff,%eax
test   $0x1,%dil
jne    1140 <USBEndpointDataSend+0x40>
add    %rsi,%rcx
shr    $0x8,%edx
jmp    1139 <USBEndpointDataSend+0x39>
mov    $0xffffffff,%eax
testl  $0x2,(%rcx)
jne    1140 <USBEndpointDataSend+0x40>
add    %esi,%ecx
movslq %ecx,%rcx
movzbl %dl,%eax
mov    %eax,(%rcx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @USBEndpointDataSend(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* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %3
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 258
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = and i32 %16, 2
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %11
store i32 -1, i32* %4
br label %46
20: ; preds = %11
%21 = load i32, i32* %7
%22 = and i32 %21, 255
store i32 %22, i32* %8
br label %38
23: ; preds = %3
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 258
%26 = load i32, i32* %6
%27 = add nsw i32 %25, %26
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = load volatile i32, i32* %29
%31 = and i32 %30, 1
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %23
store i32 -1, i32* %4
br label %46
34: ; preds = %23
%35 = load i32, i32* %7
%36 = ashr i32 %35, 8
%37 = and i32 %36, 255
store i32 %37, i32* %8
br label %38
38: ; preds = %34, %20
%39 = load i32, i32* %8
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 258
%42 = load i32, i32* %6
%43 = add nsw i32 %41, %42
%44 = sext i32 %43 to i64
%45 = inttoptr i64 %44 to i32*
store volatile i32 %39, i32* %45
store i32 0, i32* %4
br label %46
46: ; preds = %38, %33, %19
%47 = load i32, i32* %4
ret i32 %47
}

LLVM IR (-O2):
define i32 @USBEndpointDataSend(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
%5 = add nsw i32 %0, 258
br i1 %4, label %6, label %16
6: ; preds = %3
%7 = sext i32 %5 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, 2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %6
%13 = add nuw nsw i32 %5, %1
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
br label %25
16: ; preds = %3
%17 = add nsw i32 %5, %1
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
%21 = and i32 %20, 1
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %16
%24 = lshr i32 %2, 8
br label %25
25: ; preds = %12, %23
%26 = phi i32* [ %15, %12 ], [ %19, %23 ]
%27 = phi i32 [ %2, %12 ], [ %24, %23 ]
%28 = and i32 %27, 255
store volatile i32 %28, i32* %26
br label %29
29: ; preds = %16, %6, %25
%30 = phi i32 [ 0, %25 ], [ -1, %6 ], [ -1, %16 ]
ret i32 %30
}