#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);
uint32_t PWMClockGet(uint32_t ui32Base) {
  ASSERT((ui32Base == 0x40028000) || (ui32Base == 0x40029000));
  if (!((*((volatile uint32_t *)(ui32Base + 0x00000FC8))) & 0x00000100)) {
    return (0x00000000);
  } else {
    return ((*((volatile uint32_t *)(ui32Base + 0x00000FC8))) &
            (0x00000100 | 0x00000007));
  }
}


x86 assembly (clang, -O0):
<PWMClockGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x40028000,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     113a <PWMClockGet+0x2a>
cmpl   $0x40029000,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%eax
add    $0xfc8,%eax
cltq
mov    (%rax),%eax
and    $0x100,%eax
cmp    $0x0,%eax
jne    116d <PWMClockGet+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    1181 <PWMClockGet+0x71>
mov    -0x8(%rbp),%eax
add    $0xfc8,%eax
cltq
mov    (%rax),%eax
and    $0x107,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMClockGet>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x40028000,%eax
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rcx
xor    %eax,%eax
testl  $0x100,0xfc8(%rcx)
je     1146 <PWMClockGet+0x36>
mov    $0x107,%eax
and    0xfc8(%rcx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @PWMClockGet(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1073905664
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 1073909760
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ true, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 4040
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
%18 = and i32 %17, 256
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %9
store i32 0, i32* %2
br label %28
21: ; preds = %9
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 4040
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = and i32 %26, 263
store i32 %27, i32* %2
br label %28
28: ; preds = %21, %20
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @PWMClockGet(i32 %0) {
%2 = and i32 %0, -4097
%3 = icmp eq i32 %2, 1073905664
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = add nsw i32 %0, 4040
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, 256
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %1
%13 = load volatile i32, i32* %8
%14 = and i32 %13, 263
br label %15
15: ; preds = %1, %12
%16 = phi i32 [ %14, %12 ], [ 0, %1 ]
ret i32 %16
}