#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 */
int /*<<< orphan*/ ASSERT(int);
void QEIVelocityConfigure(uint32_t ui32Base, uint32_t ui32PreDiv,
                          uint32_t ui32Period) {
  ASSERT((ui32Base == 0x4002C000) || (ui32Base == 0x4002D000));
  ASSERT(!(ui32PreDiv & ~(0x000001C0)));
  ASSERT(ui32Period != 0);
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) =
      (((*((volatile uint32_t *)(ui32Base + 0x00000000))) & ~(0x000001C0)) |
       ui32PreDiv);
  (*((volatile uint32_t *)(ui32Base + 0x00000010))) = ui32Period - 1;
}


x86 assembly (clang, -O0):
<QEIVelocityConfigure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x4002c000,-0x4(%rbp)
mov    %al,-0xd(%rbp)
je     1140 <QEIVelocityConfigure+0x30>
cmpl   $0x4002d000,-0x4(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%eax
and    $0xfffffe3f,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x0,-0xc(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffe3f,%ecx
or     -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x4(%rbp),%eax
add    $0x10,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIVelocityConfigure>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x4002c000,%eax
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
test   $0xfffffe3f,%r14d
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
add    $0xffffffff,%ebx
setb   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
mov    $0xfffffe3f,%ecx
and    (%rax),%ecx
or     %r14d,%ecx
mov    %ecx,(%rax)
mov    %ebx,0x10(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @QEIVelocityConfigure(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, 1073922048
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1073926144
br label %12
12: ; preds = %9, %3
%13 = phi i1 [ true, %3 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
%15 = call i32 @ASSERT(i32 %14)
%16 = load i32, i32* %5
%17 = and i32 %16, -449
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
%21 = call i32 @ASSERT(i32 %20)
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @ASSERT(i32 %24)
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 0
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = load volatile i32, i32* %29
%31 = and i32 %30, -449
%32 = load i32, i32* %5
%33 = or i32 %31, %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 0
%36 = sext i32 %35 to i64
%37 = inttoptr i64 %36 to i32*
store volatile i32 %33, i32* %37
%38 = load i32, i32* %6
%39 = sub nsw i32 %38, 1
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 16
%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 @QEIVelocityConfigure(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %0, -4097
%5 = icmp eq i32 %4, 1073922048
%6 = zext i1 %5 to i32
%7 = tail call i32 @ASSERT(i32 %6)
%8 = and i32 %1, -449
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i32 @ASSERT(i32 %10)
%12 = icmp ne i32 %2, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @ASSERT(i32 %13)
%15 = sext i32 %0 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
%18 = and i32 %17, -449
%19 = or i32 %18, %1
store volatile i32 %19, i32* %16
%20 = add nsw i32 %2, -1
%21 = add nsw i32 %0, 16
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
store volatile i32 %20, i32* %23
ret void
}