#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 */
void USBDevEndpointDataAck(uint32_t ui32Base, uint32_t ui32Endpoint,
                           bool bIsLastPacket) {
  ;

  ;
  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
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113b <USBDevEndpointDataAck+0x3b>
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    1154 <USBDevEndpointDataAck+0x54>
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)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBDevEndpointDataAck>:
test   %esi,%esi
je     1112 <USBDevEndpointDataAck+0x12>
lea    (%rdi,%rsi,1),%eax
add    $0x106,%eax
cltq
andl   $0xfffffffe,(%rax)
ret
xor    %eax,%eax
test   %edx,%edx
setne  %al
lea    0x40(,%rax,8),%eax
movslq %edi,%rcx
mov    %eax,0x102(%rcx)
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* %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %3
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 8, i32 0
%14 = or i32 64, %13
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 258
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
store volatile i32 %14, i32* %18
br label %29
19: ; preds = %3
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 278
%22 = load i32, i32* %5
%23 = sub nsw i32 %22, 16
%24 = add nsw i32 %21, %23
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to i32*
%27 = load volatile i32, i32* %26
%28 = and i32 %27, -2
store volatile i32 %28, i32* %26
br label %29
29: ; preds = %19, %9
ret void
}

LLVM IR (-O2):
define void @USBDevEndpointDataAck(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %5, label %11
5: ; preds = %3
%6 = icmp eq i32 %2, 0
%7 = select i1 %6, i32 64, i32 72
%8 = add nsw i32 %0, 258
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
store volatile i32 %7, i32* %10
br label %18
11: ; preds = %3
%12 = add i32 %0, 262
%13 = add i32 %12, %1
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = and i32 %16, -2
store volatile i32 %17, i32* %15
br label %18
18: ; preds = %11, %5
ret void
}