#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 */
uint32_t _USBIndexRead(uint32_t ui32Base, uint32_t ui32Endpoint,
                       uint32_t ui32IndexedReg, uint32_t ui32Size) {
  uint8_t ui8Index;
  uint8_t ui8Value;
  ;

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


x86 assembly (clang, -O0):
<_USBIndexRead>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0xe,%eax
cltq
mov    %ecx,(%rax)
cmpl   $0x1,-0x10(%rbp)
jne    1146 <_USBIndexRead+0x46>
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    1153 <_USBIndexRead+0x53>
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0xe,%eax
cltq
mov    %ecx,(%rax)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_USBIndexRead>:
movslq %edi,%rcx
mov    0xe(%rcx),%edi
mov    %esi,0xe(%rcx)
movslq %edx,%rax
mov    (%rax,%rcx,1),%eax
mov    %edi,0xe(%rcx)
ret

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

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