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

/* Variables and functions */
void USBDevEndpointDataAck(uint32_t ui32Base, uint32_t ui32Endpoint,
                           bool bIsLastPacket) {
  ;

  ;
  if (ui32Endpoint == 0x00000000) {
    (*((volatile unsigned char *)(ui32Base + 0x00000102))) =
        0x00000040 | (bIsLastPacket ? 0x00000008 : 0);
  } else {
    (*((volatile unsigned char *)(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    113d <USBDevEndpointDataAck+0x3d>
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x8,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
or     $0x40,%eax
mov    %al,%cl
mov    -0x4(%rbp),%eax
add    $0x102,%eax
cltq
mov    %cl,(%rax)
jmp    1159 <USBDevEndpointDataAck+0x59>
mov    -0x4(%rbp),%eax
add    $0x116,%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%cl
movzbl %cl,%ecx
and    $0xfffffffe,%ecx
mov    %cl,(%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
andb   $0xfe,(%rax)
ret
test   %edx,%edx
setne  %al
shl    $0x3,%al
or     $0x40,%al
movslq %edi,%rcx
mov    %al,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 %20
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 = trunc i32 %14 to i8
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 258
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i8*
store volatile i8 %15, i8* %19
br label %32
20: ; preds = %3
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 278
%23 = load i32, i32* %5
%24 = sub nsw i32 %23, 16
%25 = add nsw i32 %22, %24
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i8*
%28 = load volatile i8, i8* %27
%29 = zext i8 %28 to i32
%30 = and i32 %29, -2
%31 = trunc i32 %30 to i8
store volatile i8 %31, i8* %27
br label %32
32: ; preds = %20, %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, i8 64, i8 72
%8 = add nsw i32 %0, 258
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store volatile i8 %7, i8* %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 i8*
%16 = load volatile i8, i8* %15
%17 = and i8 %16, -2
store volatile i8 %17, i8* %15
br label %18
18: ; preds = %11, %5
ret void
}