#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 */
void EMACTimestampSysTimeUpdate(uint32_t ui32Base, uint32_t ui32Seconds,
                                uint32_t ui32SubSeconds, bool bInc) {
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000710))) = ui32Seconds;
  (*((volatile uint32_t *)(ui32Base + 0x00000714))) =
      ui32SubSeconds | (bInc ? 0 : 0x80000000);
  while ((*((volatile uint32_t *)(ui32Base + 0x00000700))) & 0x00000008) {
  }
  (*((volatile uint32_t *)(ui32Base + 0x00000700))) |= 0x00000008;
}


x86 assembly (clang, -O0):
<EMACTimestampSysTimeUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x710,%eax
cltq
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%esi
mov    $0x80000000,%eax
xor    %edx,%edx
cmp    $0x0,%esi
cmovne %edx,%eax
or     %eax,%ecx
mov    -0x4(%rbp),%eax
add    $0x714,%eax
cltq
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x700,%eax
cltq
mov    (%rax),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     115d <EMACTimestampSysTimeUpdate+0x5d>
jmp    1140 <EMACTimestampSysTimeUpdate+0x40>
mov    -0x4(%rbp),%eax
add    $0x700,%eax
cltq
mov    (%rax),%ecx
or     $0x8,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACTimestampSysTimeUpdate>:
movslq %edi,%rax
mov    %esi,0x710(%rax)
xor    %esi,%esi
test   %ecx,%ecx
sete   %sil
shl    $0x1f,%esi
or     %edx,%esi
mov    %esi,0x714(%rax)
nopl   0x0(%rax)
testl  $0x8,0x700(%rax)
jne    1120 <EMACTimestampSysTimeUpdate+0x20>
orl    $0x8,0x700(%rax)
ret

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

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