#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 uint8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ VIC_DisableIRQ();
int /*<<< orphan*/ VIC_RestoreIRQ(int /*<<< orphan*/);
int32_t Sleep_Work(void) {
  static uint8_t flip = 0;
  if (flip) {
    (*(volatile unsigned long *)(0x3FFFC000 + 0x18)) = (1 << 31);
  } else {
    (*(volatile unsigned long *)(0x3FFFC000 + 0x1C)) = (1 << 31);
  }
  flip ^= 1;
  uint32_t save = VIC_DisableIRQ();
  (*(volatile unsigned long *)(0xE0000000 + 0x08)) = 0xaa;
  (*(volatile unsigned long *)(0xE0000000 + 0x08)) = 0x55;
  VIC_RestoreIRQ(save);
  return ((uint32_t)(((((double)1 * (double)(5 * 11059200)) / ((double)(7)))) +
                     0.5f));
}


x86 assembly (clang, -O0):
<Sleep_Work>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2f05(%rip)
je     1146 <Sleep_Work+0x26>
mov    $0x3fffc018,%eax
movq   $0xffffffff80000000,(%rax)
jmp    1152 <Sleep_Work+0x32>
mov    $0x3fffc01c,%eax
movq   $0xffffffff80000000,(%rax)
mov    0x2edc(%rip),%eax
xor    $0x1,%eax
mov    %eax,0x2ed3(%rip)
mov    $0x0,%al
call   1030 <VIC_DisableIRQ@plt>
mov    %eax,-0x4(%rbp)
mov    $0xe0000008,%eax
movq   $0xaa,(%rax)
mov    $0xe0000008,%eax
movq   $0x55,(%rax)
mov    -0x4(%rbp),%edi
call   1040 <VIC_RestoreIRQ@plt>
mov    $0x788925,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sleep_Work>:
push   %rax
mov    0x2f0d(%rip),%eax
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
movq   $0xffffffff80000000,0x3fffc018(,%rcx,4)
xor    $0x1,%eax
mov    %eax,0x2ef1(%rip)
xor    %eax,%eax
call   1030 <VIC_DisableIRQ@plt>
mov    $0xe0000008,%ecx
movq   $0xaa,(%rcx)
movq   $0x55,(%rcx)
mov    %eax,%edi
call   1040 <VIC_RestoreIRQ@plt>
mov    $0x788925,%eax
pop    %rcx
ret

LLVM IR (-O0):
@Sleep_Work.flip = internal global i32 0
define i32 @Sleep_Work() {
%1 = alloca i32
%2 = load i32, i32* @Sleep_Work.flip
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store volatile i64 -2147483648, i64* inttoptr (i64 1073725464 to i64*)
br label %6
5: ; preds = %0
store volatile i64 -2147483648, i64* inttoptr (i64 1073725468 to i64*)
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* @Sleep_Work.flip
%8 = xor i32 %7, 1
store i32 %8, i32* @Sleep_Work.flip
%9 = call i32 (...) @VIC_DisableIRQ()
store i32 %9, i32* %1
store volatile i64 170, i64* inttoptr (i64 3758096392 to i64*)
store volatile i64 85, i64* inttoptr (i64 3758096392 to i64*)
%10 = load i32, i32* %1
%11 = call i32 @VIC_RestoreIRQ(i32 %10)
ret i32 7899429
}

LLVM IR (-O2):
@Sleep_Work.flip = internal unnamed_addr global i32 0
define i32 @Sleep_Work() {
%1 = load i32, i32* @Sleep_Work.flip
%2 = icmp eq i32 %1, 0
%3 = select i1 %2, i64* inttoptr (i64 1073725468 to i64*), i64* inttoptr (i64 1073725464 to i64*)
store volatile i64 -2147483648, i64* %3
%4 = xor i32 %1, 1
store i32 %4, i32* @Sleep_Work.flip
%5 = tail call i32 (...) @VIC_DisableIRQ()
store volatile i64 170, i64* inttoptr (i64 3758096392 to i64*)
store volatile i64 85, i64* inttoptr (i64 3758096392 to i64*)
%6 = tail call i32 @VIC_RestoreIRQ(i32 %5)
ret i32 7899429
}