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

/* Variables and functions */
void _USBIndexWrite(uint32_t ui32Base, uint32_t ui32Endpoint,
                    uint32_t ui32IndexedReg, uint32_t ui32Value,
                    uint32_t ui32Size) {
  uint32_t ui32Index;
  ;

  ;
  ;
  ui32Index = (*((volatile uint8_t *)(ui32Base + 0x0000000E)));
  (*((volatile uint8_t *)(ui32Base + 0x0000000E))) = ui32Endpoint;
  if (ui32Size == 1) {
    (*((volatile uint8_t *)(ui32Base + ui32IndexedReg))) = ui32Value;
  } else {
    (*((volatile uint16_t *)(ui32Base + ui32IndexedReg))) = ui32Value;
  }
  (*((volatile uint8_t *)(ui32Base + 0x0000000E))) = ui32Index;
}


x86 assembly (clang, -O0):
<_USBIndexWrite>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0xe,%eax
cltq
mov    %ecx,(%rax)
cmpl   $0x1,-0x14(%rbp)
jne    114a <_USBIndexWrite+0x4a>
mov    -0x10(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
cltq
mov    %ecx,(%rax)
jmp    1157 <_USBIndexWrite+0x57>
mov    -0x10(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
cltq
mov    %ecx,(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0xe,%eax
cltq
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_USBIndexWrite>:
movslq %edi,%rax
mov    0xe(%rax),%edi
mov    %esi,0xe(%rax)
movslq %edx,%rdx
mov    %ecx,(%rdx,%rax,1)
mov    %edi,0xe(%rax)
ret

LLVM IR (-O0):
define void @_USBIndexWrite(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 14
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
store i32 %16, i32* %11
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 14
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
store volatile i32 %17, i32* %21
%22 = load i32, i32* %10
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %31
24: ; preds = %5
%25 = load i32, i32* %9
%26 = load i32, i32* %6
%27 = load i32, i32* %8
%28 = add nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i32*
store volatile i32 %25, i32* %30
br label %38
31: ; preds = %5
%32 = load i32, i32* %9
%33 = load i32, i32* %6
%34 = load i32, i32* %8
%35 = add nsw i32 %33, %34
%36 = sext i32 %35 to i64
%37 = inttoptr i64 %36 to i32*
store volatile i32 %32, i32* %37
br label %38
38: ; preds = %31, %24
%39 = load i32, i32* %11
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 14
%42 = sext i32 %41 to i64
%43 = inttoptr i64 %42 to i32*
store volatile i32 %39, i32* %43
ret void
}

LLVM IR (-O2):
define void @_USBIndexWrite(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = add nsw i32 %0, 14
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
store volatile i32 %1, i32* %8
%10 = add nsw i32 %2, %0
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
store volatile i32 %3, i32* %12
store volatile i32 %9, i32* %8
ret void
}