#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 EMACTimestampSysTimeSet(uint32_t ui32Base, uint32_t ui32Seconds,
                             uint32_t ui32SubSeconds) {
  ASSERT(ui32Base == 0x400EC000);
  (*((volatile uint32_t *)(ui32Base + 0x00000710))) = ui32Seconds;
  (*((volatile uint32_t *)(ui32Base + 0x00000714))) = ui32SubSeconds;
  while ((*((volatile uint32_t *)(ui32Base + 0x00000700))) & 0x00000004) {
  }
  (*((volatile uint32_t *)(ui32Base + 0x00000700))) |= 0x00000004;
}


x86 assembly (clang, -O0):
<EMACTimestampSysTimeSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x400ec000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x710,%eax
cltq
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x714,%eax
cltq
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x700,%eax
cltq
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1170 <EMACTimestampSysTimeSet+0x60>
jmp    1153 <EMACTimestampSysTimeSet+0x43>
mov    -0x4(%rbp),%eax
add    $0x700,%eax
cltq
mov    (%rax),%ecx
or     $0x4,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACTimestampSysTimeSet>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x400ec000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
mov    %ebp,0x710(%rax)
mov    %r14d,0x714(%rax)
nopl   0x0(%rax)
testl  $0x4,0x700(%rax)
jne    1140 <EMACTimestampSysTimeSet+0x30>
orl    $0x4,0x700(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @EMACTimestampSysTimeSet(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, 1074708480
%9 = zext i1 %8 to i32
%10 = call i32 @ASSERT(i32 %9)
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1808
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
store volatile i32 %11, i32* %15
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1812
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
store volatile i32 %16, i32* %20
br label %21
21: ; preds = %29, %3
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1792
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = and i32 %26, 4
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %21
br label %21
30: ; preds = %21
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1792
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to i32*
%35 = load volatile i32, i32* %34
%36 = or i32 %35, 4
store volatile i32 %36, i32* %34
ret void
}

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