#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 EMACTimestampPPSCommandModeSet(uint32_t ui32Base, uint32_t ui32Config) {
  ASSERT(ui32Base == 0x400EC000);
  ASSERT(!(ui32Config & (0x00000000 | 0x00000060 | 0x00000040)));
  while ((*((volatile uint32_t *)(ui32Base + 0x0000072C))) & 0x0000000F) {
  }
  (*((volatile uint32_t *)(ui32Base + 0x0000072C))) = (0x00000010 | ui32Config);
}


x86 assembly (clang, -O0):
<EMACTimestampPPSCommandModeSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x400ec000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%eax
and    $0x60,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x72c,%eax
cltq
mov    (%rax),%eax
and    $0xf,%eax
cmp    $0x0,%eax
je     1167 <EMACTimestampPPSCommandModeSet+0x57>
jmp    114a <EMACTimestampPPSCommandModeSet+0x3a>
mov    -0x8(%rbp),%ecx
or     $0x10,%ecx
mov    -0x4(%rbp),%eax
add    $0x72c,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACTimestampPPSCommandModeSet>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x400ec000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
test   $0x60,%bl
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
nopl   0x0(%rax)
testl  $0xf,0x72c(%rax)
jne    1140 <EMACTimestampPPSCommandModeSet+0x30>
or     $0x10,%ebx
mov    %ebx,0x72c(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @EMACTimestampPPSCommandModeSet(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1074708480
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = and i32 %1, 96
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @ASSERT(i32 %8)
%10 = add nsw i32 %0, 1836
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
br label %13
13: ; preds = %13, %2
%14 = load volatile i32, i32* %12
%15 = and i32 %14, 15
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %13
17: ; preds = %13
%18 = or i32 %1, 16
store volatile i32 %18, i32* %12
ret void
}