#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;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void USBDevEndpointDataAck(uint32_t ui32Base, uint32_t ui32Endpoint,
                           bool bIsLastPacket) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Endpoint == 0x00000000) || (ui32Endpoint == 0x00000010) ||
         (ui32Endpoint == 0x00000020) || (ui32Endpoint == 0x00000030) ||
         (ui32Endpoint == 0x00000040) || (ui32Endpoint == 0x00000050) ||
         (ui32Endpoint == 0x00000060) || (ui32Endpoint == 0x00000070));
  if (ui32Endpoint == 0x00000000) {
    (*((volatile uint8_t *)(ui32Base + 0x00000102))) =
        0x00000040 | (bIsLastPacket ? 0x00000008 : 0);
  } else {
    (*((volatile uint8_t *)(ui32Base + 0x00000116 + (ui32Endpoint - 0x10)))) &=
        ~(0x00000001);
  }
}


x86 assembly (clang, -O0):
<USBDevEndpointDataAck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a8 <USBDevEndpointDataAck+0x98>
mov    $0x1,%al
cmpl   $0x10,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a8 <USBDevEndpointDataAck+0x98>
mov    $0x1,%al
cmpl   $0x20,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a8 <USBDevEndpointDataAck+0x98>
mov    $0x1,%al
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a8 <USBDevEndpointDataAck+0x98>
mov    $0x1,%al
cmpl   $0x40,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a8 <USBDevEndpointDataAck+0x98>
mov    $0x1,%al
cmpl   $0x50,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a8 <USBDevEndpointDataAck+0x98>
mov    $0x1,%al
cmpl   $0x60,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a8 <USBDevEndpointDataAck+0x98>
cmpl   $0x70,-0x8(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11e3 <USBDevEndpointDataAck+0xd3>
mov    -0xc(%rbp),%edx
xor    %ecx,%ecx
mov    $0x8,%eax
cmp    $0x0,%edx
cmovne %eax,%ecx
or     $0x40,%ecx
mov    -0x4(%rbp),%eax
add    $0x102,%eax
cltq
mov    %ecx,(%rax)
jmp    11fc <USBDevEndpointDataAck+0xec>
mov    -0x4(%rbp),%eax
add    $0x116,%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBDevEndpointDataAck>:
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>
test   %ebp,%ebp
je     115a <USBDevEndpointDataAck+0x4a>
lea    (%rbx,%rbp,1),%eax
add    $0x106,%eax
cltq
andl   $0xfffffffe,(%rax)
jmp    1172 <USBDevEndpointDataAck+0x62>
xor    %eax,%eax
test   %r14d,%r14d
setne  %al
lea    0x40(,%rax,8),%eax
movslq %ebx,%rcx
mov    %eax,0x102(%rcx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @USBDevEndpointDataAck(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1074069504
%9 = zext i1 %8 to i32
%10 = call i32 @ASSERT(i32 %9)
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 0
br i1 %12, label %34, label %13
13: ; preds = %3
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 16
br i1 %15, label %34, label %16
16: ; preds = %13
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 32
br i1 %18, label %34, label %19
19: ; preds = %16
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 48
br i1 %21, label %34, label %22
22: ; preds = %19
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 64
br i1 %24, label %34, label %25
25: ; preds = %22
%26 = load i32, i32* %5
%27 = icmp eq i32 %26, 80
br i1 %27, label %34, label %28
28: ; preds = %25
%29 = load i32, i32* %5
%30 = icmp eq i32 %29, 96
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 112
br label %34
34: ; preds = %31, %28, %25, %22, %19, %16, %13, %3
%35 = phi i1 [ true, %28 ], [ true, %25 ], [ true, %22 ], [ true, %19 ], [ true, %16 ], [ true, %13 ], [ true, %3 ], [ %33, %31 ]
%36 = zext i1 %35 to i32
%37 = call i32 @ASSERT(i32 %36)
%38 = load i32, i32* %5
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %50
40: ; preds = %34
%41 = load i32, i32* %6
%42 = icmp ne i32 %41, 0
%43 = zext i1 %42 to i64
%44 = select i1 %42, i32 8, i32 0
%45 = or i32 64, %44
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 258
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to i32*
store volatile i32 %45, i32* %49
br label %60
50: ; preds = %34
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 278
%53 = load i32, i32* %5
%54 = sub nsw i32 %53, 16
%55 = add nsw i32 %52, %54
%56 = sext i32 %55 to i64
%57 = inttoptr i64 %56 to i32*
%58 = load volatile i32, i32* %57
%59 = and i32 %58, -2
store volatile i32 %59, i32* %57
br label %60
60: ; preds = %50, %40
ret void
}

LLVM IR (-O2):
define void @USBDevEndpointDataAck(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)
br i1 %7, label %14, label %20
14: ; preds = %3
%15 = icmp eq i32 %2, 0
%16 = select i1 %15, i32 64, i32 72
%17 = add nsw i32 %0, 258
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
store volatile i32 %16, i32* %19
br label %27
20: ; preds = %3
%21 = add i32 %0, 262
%22 = add i32 %21, %1
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
%25 = load volatile i32, i32* %24
%26 = and i32 %25, -2
store volatile i32 %26, i32* %24
br label %27
27: ; preds = %20, %14
ret void
}