#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 */
int /*<<< orphan*/ ASSERT(int);
int32_t USBEndpointDataSend(uint32_t ui32Base, uint32_t ui32Endpoint,
                            uint32_t ui32TransType) {
  uint32_t ui32TxPktRdy;
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Endpoint == 0x00000000) || (ui32Endpoint == 0x00000010) ||
         (ui32Endpoint == 0x00000020) || (ui32Endpoint == 0x00000030) ||
         (ui32Endpoint == 0x00000040) || (ui32Endpoint == 0x00000050) ||
         (ui32Endpoint == 0x00000060) || (ui32Endpoint == 0x00000070));
  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
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x40050000,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x15(%rbp)
je     11a8 <USBEndpointDataSend+0x98>
mov    $0x1,%al
cmpl   $0x10,-0xc(%rbp)
mov    %al,-0x15(%rbp)
je     11a8 <USBEndpointDataSend+0x98>
mov    $0x1,%al
cmpl   $0x20,-0xc(%rbp)
mov    %al,-0x15(%rbp)
je     11a8 <USBEndpointDataSend+0x98>
mov    $0x1,%al
cmpl   $0x30,-0xc(%rbp)
mov    %al,-0x15(%rbp)
je     11a8 <USBEndpointDataSend+0x98>
mov    $0x1,%al
cmpl   $0x40,-0xc(%rbp)
mov    %al,-0x15(%rbp)
je     11a8 <USBEndpointDataSend+0x98>
mov    $0x1,%al
cmpl   $0x50,-0xc(%rbp)
mov    %al,-0x15(%rbp)
je     11a8 <USBEndpointDataSend+0x98>
mov    $0x1,%al
cmpl   $0x60,-0xc(%rbp)
mov    %al,-0x15(%rbp)
je     11a8 <USBEndpointDataSend+0x98>
cmpl   $0x70,-0xc(%rbp)
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x0,-0xc(%rbp)
jne    11f3 <USBEndpointDataSend+0xe3>
mov    -0x8(%rbp),%eax
add    $0x102,%eax
cltq
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11e3 <USBEndpointDataSend+0xd3>
movl   $0xffffffff,-0x4(%rbp)
jmp    1241 <USBEndpointDataSend+0x131>
mov    -0x10(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
jmp    1228 <USBEndpointDataSend+0x118>
mov    -0x8(%rbp),%eax
add    $0x102,%eax
add    -0xc(%rbp),%eax
cltq
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     121a <USBEndpointDataSend+0x10a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1241 <USBEndpointDataSend+0x131>
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
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBEndpointDataSend>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x40050000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
mov    %ebp,%eax
rol    $0x1c,%eax
cmp    $0x7,%eax
setb   %al
cmp    $0x70,%ebp
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1030 <ASSERT@plt>
movslq %ebx,%rcx
add    $0x102,%rcx
test   %ebp,%ebp
je     116f <USBEndpointDataSend+0x5f>
movslq %ebp,%rdx
mov    (%rcx,%rdx,1),%esi
mov    $0xffffffff,%eax
test   $0x1,%sil
jne    1189 <USBEndpointDataSend+0x79>
add    %rdx,%rcx
shr    $0x8,%r14d
jmp    1181 <USBEndpointDataSend+0x71>
mov    $0xffffffff,%eax
testl  $0x2,(%rcx)
jne    1189 <USBEndpointDataSend+0x79>
add    %ebp,%ecx
movslq %ecx,%rcx
movzbl %r14b,%eax
mov    %eax,(%rcx)
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
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* %5
%10 = icmp eq i32 %9, 1074069504
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %36, label %15
15: ; preds = %3
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 16
br i1 %17, label %36, label %18
18: ; preds = %15
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 32
br i1 %20, label %36, label %21
21: ; preds = %18
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 48
br i1 %23, label %36, label %24
24: ; preds = %21
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 64
br i1 %26, label %36, label %27
27: ; preds = %24
%28 = load i32, i32* %6
%29 = icmp eq i32 %28, 80
br i1 %29, label %36, label %30
30: ; preds = %27
%31 = load i32, i32* %6
%32 = icmp eq i32 %31, 96
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = load i32, i32* %6
%35 = icmp eq i32 %34, 112
br label %36
36: ; preds = %33, %30, %27, %24, %21, %18, %15, %3
%37 = phi i1 [ true, %30 ], [ true, %27 ], [ true, %24 ], [ true, %21 ], [ true, %18 ], [ true, %15 ], [ true, %3 ], [ %35, %33 ]
%38 = zext i1 %37 to i32
%39 = call i32 @ASSERT(i32 %38)
%40 = load i32, i32* %6
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %54
42: ; preds = %36
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 258
%45 = sext i32 %44 to i64
%46 = inttoptr i64 %45 to i32*
%47 = load volatile i32, i32* %46
%48 = and i32 %47, 2
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %42
store i32 -1, i32* %4
br label %77
51: ; preds = %42
%52 = load i32, i32* %7
%53 = and i32 %52, 255
store i32 %53, i32* %8
br label %69
54: ; preds = %36
%55 = load i32, i32* %5
%56 = add nsw i32 %55, 258
%57 = load i32, i32* %6
%58 = add nsw i32 %56, %57
%59 = sext i32 %58 to i64
%60 = inttoptr i64 %59 to i32*
%61 = load volatile i32, i32* %60
%62 = and i32 %61, 1
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %65
64: ; preds = %54
store i32 -1, i32* %4
br label %77
65: ; preds = %54
%66 = load i32, i32* %7
%67 = ashr i32 %66, 8
%68 = and i32 %67, 255
store i32 %68, i32* %8
br label %69
69: ; preds = %65, %51
%70 = load i32, i32* %8
%71 = load i32, i32* %5
%72 = add nsw i32 %71, 258
%73 = load i32, i32* %6
%74 = add nsw i32 %72, %73
%75 = sext i32 %74 to i64
%76 = inttoptr i64 %75 to i32*
store volatile i32 %70, i32* %76
store i32 0, i32* %4
br label %77
77: ; preds = %69, %64, %50
%78 = load i32, i32* %4
ret i32 %78
}

LLVM IR (-O2):
define i32 @USBEndpointDataSend(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 1074069504
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = icmp eq i32 %1, 0
%8 = tail call i32 @llvm.fshl.i32(i32 %1, i32 %1, i32 28)
%9 = icmp ult i32 %8, 7
%10 = icmp eq i32 %1, 112
%11 = or i1 %10, %9
%12 = zext i1 %11 to i32
%13 = tail call i32 @ASSERT(i32 %12)
%14 = add nsw i32 %0, 258
br i1 %7, label %15, label %25
15: ; preds = %3
%16 = sext i32 %14 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
%19 = and i32 %18, 2
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %38
21: ; preds = %15
%22 = add nuw nsw i32 %14, %1
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
br label %34
25: ; preds = %3
%26 = add nsw i32 %14, %1
%27 = sext i32 %26 to i64
%28 = inttoptr i64 %27 to i32*
%29 = load volatile i32, i32* %28
%30 = and i32 %29, 1
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %25
%33 = lshr i32 %2, 8
br label %34
34: ; preds = %21, %32
%35 = phi i32* [ %24, %21 ], [ %28, %32 ]
%36 = phi i32 [ %2, %21 ], [ %33, %32 ]
%37 = and i32 %36, 255
store volatile i32 %37, i32* %35
br label %38
38: ; preds = %25, %15, %34
%39 = phi i32 [ 0, %34 ], [ -1, %15 ], [ -1, %25 ]
ret i32 %39
}