#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 uint32_t;
typedef int uint16_t;
typedef int int64_t;
typedef int int16_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ O_RDWR;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ _SC_PAGESIZE;
double expf(double);
scalar_t__ floor(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
double logf(double);
void *mmap(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/, int, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int sysconf(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int fd, i;
  uint16_t value, cntr, fall, rise, scale;
  int64_t r[3];
  volatile void *cfg;
  volatile uint32_t *fifo, *bram;
  if ((fd = open("/dev/mem", O_RDWR)) < 0) {
    fprintf(stderr, "Cannot open /dev/mem.\n");
    return EXIT_FAILURE;
  }
  cfg = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE, MAP_SHARED,
             fd, 0x40001000);
  fifo = mmap(NULL, 16 * sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE,
              MAP_SHARED, fd, 0x40010000);
  bram = mmap(NULL, 16 * sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE,
              MAP_SHARED, fd, 0x40030000);
  *(uint8_t *)(cfg + 0) &= ~1;
  fall = (uint16_t)floor(expf(-logf(2.0) / 125.0 / 100) * 65536.0 + 0.5);
  rise =
      (uint16_t)floor(expf(-logf(2.0) / 125.0 / 100 * 1.0e3) * 65536.0 + 0.5);
  cntr = 0;
  r[0] = 4095 << 9;
  r[1] = 0;
  r[2] = 0;
  while (r[2] <= r[1]) {
    ++cntr;
    r[2] = r[1];
    r[1] = r[0] + r[1] * rise / 65536;
    r[0] = r[0] * fall / 65536;
  }
  scale = (uint16_t)(4095 * 65535 / (r[2] >> 9));
  for (i = 0; i < 1024; ++i) {
    bram[i] = 0;
  }
  bram[8] = 4095;
  *(uint16_t *)(cfg + 4) = 1024;
  *(uint16_t *)(cfg + 6) = scale;
  *(uint16_t *)(cfg + 8) = fall;
  *(uint16_t *)(cfg + 10) = rise;
  *(int16_t *)(cfg + 12) = -8192;
  *(int16_t *)(cfg + 14) = 8191;
  *(uint8_t *)(cfg + 0) |= 1;
  sleep(1);
  for (i = 0; i < cntr + 10; ++i) {
    value = *fifo;
    printf("%d\n", value);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e2b(%rip),%rax
mov    (%rax),%esi
lea    0xe7a(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    11ed <main+0x5d>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
lea    0xe62(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2dd5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    14ea <main+0x35a>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
call   1090 <sysconf@plt>
mov    %eax,%esi
mov    0x2df4(%rip),%rax
mov    (%rax),%edx
mov    0x2da3(%rip),%rax
or     (%rax),%edx
mov    0x2dd2(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x40001000,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x40(%rbp)
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
call   1090 <sysconf@plt>
mov    %eax,%esi
shl    $0x4,%esi
mov    0x2daf(%rip),%rax
mov    (%rax),%edx
mov    0x2d5e(%rip),%rax
or     (%rax),%edx
mov    0x2d8d(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x40010000,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x48(%rbp)
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
call   1090 <sysconf@plt>
mov    %eax,%esi
shl    $0x4,%esi
mov    0x2d6a(%rip),%rax
mov    (%rax),%edx
mov    0x2d19(%rip),%rax
or     (%rax),%edx
mov    0x2d48(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x40030000,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    %ecx,(%rax)
movsd  0xd5c(%rip),%xmm0
call   1030 <logf@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd30(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd1c(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <expf@plt>
movsd  0xcf3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcef(%rip),%xmm1
addsd  %xmm1,%xmm0
call   10b0 <floor@plt>
mov    %eax,-0x24(%rbp)
movsd  0xcfb(%rip),%xmm0
call   1030 <logf@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xccf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xcbb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xca7(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1060 <expf@plt>
movsd  0xc86(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc82(%rip),%xmm1
addsd  %xmm1,%xmm0
call   10b0 <floor@plt>
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1ffe00,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
jg     13ff <main+0x26f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x34(%rbp),%eax
imul   -0x28(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%eax
imul   -0x24(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
jmp    13ae <main+0x21e>
mov    -0x30(%rbp),%ecx
sar    $0x9,%ecx
mov    $0xffef001,%eax
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x400,-0x18(%rbp)
jge    1441 <main+0x2b1>
mov    -0x50(%rbp),%rax
movslq -0x18(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1417 <main+0x287>
mov    -0x50(%rbp),%rax
movl   $0xfff,0x20(%rax)
mov    -0x40(%rbp),%rax
movl   $0x400,0x4(%rax)
mov    -0x2c(%rbp),%ecx
mov    -0x40(%rbp),%rax
mov    %ecx,0x6(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x40(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x40(%rbp),%rax
mov    %ecx,0xa(%rax)
mov    -0x40(%rbp),%rax
movl   $0xffffe000,0xc(%rax)
mov    -0x40(%rbp),%rax
movl   $0x1fff,0xe(%rax)
mov    -0x40(%rbp),%rax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
mov    $0x1,%edi
call   10a0 <sleep@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0xa,%ecx
cmp    %ecx,%eax
jge    14de <main+0x34e>
mov    -0x48(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xb85(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    14a7 <main+0x317>
mov    0x2ac3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e56(%rip),%rax
mov    (%rax),%esi
lea    0xe85(%rip),%rdi
call   1060 <open@plt>
test   %eax,%eax
js     1382 <main+0x212>
mov    %eax,%ebp
mov    0x2e2f(%rip),%r12
mov    (%r12),%edi
call   1070 <sysconf@plt>
mov    0x2e47(%rip),%rcx
mov    0x2df8(%rip),%r13
mov    0x0(%r13),%edx
or     (%rcx),%edx
mov    0x2e23(%rip),%r15
mov    (%r15),%ecx
xor    %ebx,%ebx
xor    %edi,%edi
mov    %eax,%esi
mov    %ebp,%r8d
mov    $0x40001000,%r9d
call   1030 <mmap@plt>
mov    %rax,%r14
mov    (%r12),%edi
call   1070 <sysconf@plt>
shl    $0x4,%eax
mov    0x0(%r13),%edx
mov    0x2e02(%rip),%rcx
or     (%rcx),%edx
mov    (%r15),%ecx
xor    %edi,%edi
mov    %eax,%esi
mov    %ebp,%r8d
mov    $0x40010000,%r9d
call   1030 <mmap@plt>
mov    %rax,%r15
mov    (%r12),%edi
call   1070 <sysconf@plt>
shl    $0x4,%eax
mov    0x0(%r13),%edx
mov    0x2dd1(%rip),%rcx
or     (%rcx),%edx
mov    0x2db8(%rip),%rcx
mov    (%rcx),%ecx
xor    %edi,%edi
mov    %eax,%esi
mov    %ebp,%r8d
mov    $0x40030000,%r9d
call   1030 <mmap@plt>
mov    %rax,%r13
andb   $0xfe,(%r14)
movsd  0xdad(%rip),%xmm0
call   1090 <floor@plt>
mov    %rax,%r12
movsd  0xda5(%rip),%xmm0
call   1090 <floor@plt>
mov    %rax,%rcx
mov    $0x1ffe00,%eax
mov    $0xa,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%esi
mov    %ebx,%edx
imul   %ecx,%edx
lea    0xffff(%rdx),%ebx
test   %edx,%edx
cmovns %edx,%ebx
sar    $0x10,%ebx
add    %eax,%ebx
imul   %r12d,%eax
lea    0xffff(%rax),%edx
test   %eax,%eax
cmovns %eax,%edx
sar    $0x10,%edx
add    $0x1,%ebp
mov    %edx,%eax
cmp    %ebx,%esi
jle    1280 <main+0x110>
sar    $0x9,%esi
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movl   $0x0,0x0(%r13,%rax,4)
movl   $0x0,0x4(%r13,%rax,4)
movl   $0x0,0x8(%r13,%rax,4)
movl   $0x0,0xc(%r13,%rax,4)
movl   $0x0,0x10(%r13,%rax,4)
movl   $0x0,0x14(%r13,%rax,4)
movl   $0x0,0x18(%r13,%rax,4)
movl   $0x0,0x1c(%r13,%rax,4)
add    $0x8,%rax
cmp    $0x400,%rax
jne    12c0 <main+0x150>
mov    $0xffef001,%eax
xor    %edx,%edx
idiv   %esi
movl   $0xfff,0x20(%r13)
movl   $0x400,0x4(%r14)
mov    %eax,0x6(%r14)
mov    %r12d,0x8(%r14)
mov    %ecx,0xa(%r14)
movl   $0xffffe000,0xc(%r14)
ff
movl   $0x1fff,0xe(%r14)
orb    $0x1,(%r14)
mov    $0x1,%edi
call   1080 <sleep@plt>
lea    0xcd2(%rip),%rbx
mov    0x2c43(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1370 <main+0x200>
jmp    139e <main+0x22e>
mov    0x2c37(%rip),%rax
mov    (%rax),%edi
lea    0xc87(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2c1a(%rip),%r14
mov    (%r14),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"Cannot open /dev/mem.\0A\00"
@EXIT_FAILURE = global i32 0
@_SC_PAGESIZE = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [3 x i32]
%14 = alloca i8*
%15 = alloca i32*
%16 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* @O_RDWR
%18 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %17)
store i32 %18, i32* %6
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
store i32 %23, i32* %3
br label %166
24: ; preds = %2
%25 = load i32, i32* @_SC_PAGESIZE
%26 = call i32 @sysconf(i32 %25)
%27 = load i32, i32* @PROT_READ
%28 = load i32, i32* @PROT_WRITE
%29 = or i32 %27, %28
%30 = load i32, i32* @MAP_SHARED
%31 = load i32, i32* %6
%32 = call i8* @mmap(i32* null, i32 %26, i32 %29, i32 %30, i32 %31, i32 1073745920)
store i8* %32, i8** %14
%33 = load i32, i32* @_SC_PAGESIZE
%34 = call i32 @sysconf(i32 %33)
%35 = mul nsw i32 16, %34
%36 = load i32, i32* @PROT_READ
%37 = load i32, i32* @PROT_WRITE
%38 = or i32 %36, %37
%39 = load i32, i32* @MAP_SHARED
%40 = load i32, i32* %6
%41 = call i8* @mmap(i32* null, i32 %35, i32 %38, i32 %39, i32 %40, i32 1073807360)
%42 = bitcast i8* %41 to i32*
store i32* %42, i32** %15
%43 = load i32, i32* @_SC_PAGESIZE
%44 = call i32 @sysconf(i32 %43)
%45 = mul nsw i32 16, %44
%46 = load i32, i32* @PROT_READ
%47 = load i32, i32* @PROT_WRITE
%48 = or i32 %46, %47
%49 = load i32, i32* @MAP_SHARED
%50 = load i32, i32* %6
%51 = call i8* @mmap(i32* null, i32 %45, i32 %48, i32 %49, i32 %50, i32 1073938432)
%52 = bitcast i8* %51 to i32*
store i32* %52, i32** %16
%53 = load i8*, i8** %14
%54 = getelementptr i8, i8* %53, i64 0
%55 = bitcast i8* %54 to i32*
%56 = load i32, i32* %55
%57 = and i32 %56, -2
store i32 %57, i32* %55
%58 = call double @logf(double 2.000000e+00)
%59 = fneg double %58
%60 = fdiv double %59, 1.250000e+02
%61 = fdiv double %60, 1.000000e+02
%62 = call double @expf(double %61)
%63 = call double @llvm.fmuladd.f64(double %62, double 6.553600e+04, double 5.000000e-01)
%64 = call i64 @floor(double %63)
%65 = trunc i64 %64 to i32
store i32 %65, i32* %10
%66 = call double @logf(double 2.000000e+00)
%67 = fneg double %66
%68 = fdiv double %67, 1.250000e+02
%69 = fdiv double %68, 1.000000e+02
%70 = fmul double %69, 1.000000e+03
%71 = call double @expf(double %70)
%72 = call double @llvm.fmuladd.f64(double %71, double 6.553600e+04, double 5.000000e-01)
%73 = call i64 @floor(double %72)
%74 = trunc i64 %73 to i32
store i32 %74, i32* %11
store i32 0, i32* %9
%75 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 0
store i32 2096640, i32* %75
%76 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 1
store i32 0, i32* %76
%77 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 2
store i32 0, i32* %77
br label %78
78: ; preds = %84, %24
%79 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 2
%80 = load i32, i32* %79
%81 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 1
%82 = load i32, i32* %81
%83 = icmp sle i32 %80, %82
br i1 %83, label %84, label %105
84: ; preds = %78
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 1
store i32 %86, i32* %9
%87 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 1
%88 = load i32, i32* %87
%89 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 2
store i32 %88, i32* %89
%90 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 0
%91 = load i32, i32* %90
%92 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 1
%93 = load i32, i32* %92
%94 = load i32, i32* %11
%95 = mul nsw i32 %93, %94
%96 = sdiv i32 %95, 65536
%97 = add nsw i32 %91, %96
%98 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 1
store i32 %97, i32* %98
%99 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 0
%100 = load i32, i32* %99
%101 = load i32, i32* %10
%102 = mul nsw i32 %100, %101
%103 = sdiv i32 %102, 65536
%104 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 0
store i32 %103, i32* %104
br label %78
105: ; preds = %78
%106 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 2
%107 = load i32, i32* %106
%108 = ashr i32 %107, 9
%109 = sdiv i32 268365825, %108
store i32 %109, i32* %12
store i32 0, i32* %7
br label %110
110: ; preds = %118, %105
%111 = load i32, i32* %7
%112 = icmp slt i32 %111, 1024
br i1 %112, label %113, label %121
113: ; preds = %110
%114 = load i32*, i32** %16
%115 = load i32, i32* %7
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i32, i32* %114, i64 %116
store volatile i32 0, i32* %117
br label %118
118: ; preds = %113
%119 = load i32, i32* %7
%120 = add nsw i32 %119, 1
store i32 %120, i32* %7
br label %110
121: ; preds = %110
%122 = load i32*, i32** %16
%123 = getelementptr inbounds i32, i32* %122, i64 8
store volatile i32 4095, i32* %123
%124 = load i8*, i8** %14
%125 = getelementptr i8, i8* %124, i64 4
%126 = bitcast i8* %125 to i32*
store i32 1024, i32* %126
%127 = load i32, i32* %12
%128 = load i8*, i8** %14
%129 = getelementptr i8, i8* %128, i64 6
%130 = bitcast i8* %129 to i32*
store i32 %127, i32* %130
%131 = load i32, i32* %10
%132 = load i8*, i8** %14
%133 = getelementptr i8, i8* %132, i64 8
%134 = bitcast i8* %133 to i32*
store i32 %131, i32* %134
%135 = load i32, i32* %11
%136 = load i8*, i8** %14
%137 = getelementptr i8, i8* %136, i64 10
%138 = bitcast i8* %137 to i32*
store i32 %135, i32* %138
%139 = load i8*, i8** %14
%140 = getelementptr i8, i8* %139, i64 12
%141 = bitcast i8* %140 to i32*
store i32 -8192, i32* %141
%142 = load i8*, i8** %14
%143 = getelementptr i8, i8* %142, i64 14
%144 = bitcast i8* %143 to i32*
store i32 8191, i32* %144
%145 = load i8*, i8** %14
%146 = getelementptr i8, i8* %145, i64 0
%147 = bitcast i8* %146 to i32*
%148 = load i32, i32* %147
%149 = or i32 %148, 1
store i32 %149, i32* %147
%150 = call i32 @sleep(i32 1)
store i32 0, i32* %7
br label %151
151: ; preds = %161, %121
%152 = load i32, i32* %7
%153 = load i32, i32* %9
%154 = add nsw i32 %153, 10
%155 = icmp slt i32 %152, %154
br i1 %155, label %156, label %164
156: ; preds = %151
%157 = load i32*, i32** %15
%158 = load volatile i32, i32* %157
store i32 %158, i32* %8
%159 = load i32, i32* %8
%160 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %159)
br label %161
161: ; preds = %156
%162 = load i32, i32* %7
%163 = add nsw i32 %162, 1
store i32 %163, i32* %7
br label %151
164: ; preds = %151
%165 = load i32, i32* @EXIT_SUCCESS
store i32 %165, i32* %3
br label %166
166: ; preds = %164, %20
%167 = load i32, i32* %3
ret i32 %167
}

LLVM IR (-O2):
@.str = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"Cannot open /dev/mem.\0A\00"
@EXIT_FAILURE = global i32 0
@_SC_PAGESIZE = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @O_RDWR
%4 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %100
9: ; preds = %2
%10 = load i32, i32* @_SC_PAGESIZE
%11 = tail call i32 @sysconf(i32 %10)
%12 = load i32, i32* @PROT_READ
%13 = load i32, i32* @PROT_WRITE
%14 = or i32 %13, %12
%15 = load i32, i32* @MAP_SHARED
%16 = tail call i8* @mmap(i32* null, i32 %11, i32 %14, i32 %15, i32 %4, i32 1073745920)
%17 = load i32, i32* @_SC_PAGESIZE
%18 = tail call i32 @sysconf(i32 %17)
%19 = shl nsw i32 %18, 4
%20 = load i32, i32* @PROT_READ
%21 = load i32, i32* @PROT_WRITE
%22 = or i32 %21, %20
%23 = load i32, i32* @MAP_SHARED
%24 = tail call i8* @mmap(i32* null, i32 %19, i32 %22, i32 %23, i32 %4, i32 1073807360)
%25 = load i32, i32* @_SC_PAGESIZE
%26 = tail call i32 @sysconf(i32 %25)
%27 = shl nsw i32 %26, 4
%28 = load i32, i32* @PROT_READ
%29 = load i32, i32* @PROT_WRITE
%30 = or i32 %29, %28
%31 = load i32, i32* @MAP_SHARED
%32 = tail call i8* @mmap(i32* null, i32 %27, i32 %30, i32 %31, i32 %4, i32 1073938432)
%33 = bitcast i8* %16 to i32*
%34 = load i32, i32* %33
%35 = and i32 %34, -2
store i32 %35, i32* %33
%36 = tail call i64 @floor(double 0x40EFFF9BB6617426)
%37 = trunc i64 %36 to i32
%38 = tail call i64 @floor(double 0x40EE462AAF9A2624)
%39 = trunc i64 %38 to i32
br label %40
40: ; preds = %9, %40
%41 = phi i32 [ 0, %9 ], [ %44, %40 ]
%42 = phi i32 [ 2096640, %9 ], [ %49, %40 ]
%43 = phi i32 [ 0, %9 ], [ %47, %40 ]
%44 = add nuw nsw i32 %41, 1
%45 = mul nsw i32 %43, %39
%46 = sdiv i32 %45, 65536
%47 = add nsw i32 %46, %42
%48 = mul nsw i32 %42, %37
%49 = sdiv i32 %48, 65536
%50 = icmp sgt i32 %43, %47
br i1 %50, label %51, label %40
51: ; preds = %40
%52 = bitcast i8* %32 to i32*
%53 = ashr i32 %43, 9
br label %54
54: ; preds = %54, %51
%55 = phi i64 [ 0, %51 ], [ %71, %54 ]
%56 = getelementptr inbounds i32, i32* %52, i64 %55
store volatile i32 0, i32* %56
%57 = or i64 %55, 1
%58 = getelementptr inbounds i32, i32* %52, i64 %57
store volatile i32 0, i32* %58
%59 = or i64 %55, 2
%60 = getelementptr inbounds i32, i32* %52, i64 %59
store volatile i32 0, i32* %60
%61 = or i64 %55, 3
%62 = getelementptr inbounds i32, i32* %52, i64 %61
store volatile i32 0, i32* %62
%63 = or i64 %55, 4
%64 = getelementptr inbounds i32, i32* %52, i64 %63
store volatile i32 0, i32* %64
%65 = or i64 %55, 5
%66 = getelementptr inbounds i32, i32* %52, i64 %65
store volatile i32 0, i32* %66
%67 = or i64 %55, 6
%68 = getelementptr inbounds i32, i32* %52, i64 %67
store volatile i32 0, i32* %68
%69 = or i64 %55, 7
%70 = getelementptr inbounds i32, i32* %52, i64 %69
store volatile i32 0, i32* %70
%71 = add nuw nsw i64 %55, 8
%72 = icmp eq i64 %71, 1024
br i1 %72, label %73, label %54
73: ; preds = %54
%74 = bitcast i8* %24 to i32*
%75 = sdiv i32 268365825, %53
%76 = getelementptr inbounds i8, i8* %32, i64 32
%77 = bitcast i8* %76 to i32*
store volatile i32 4095, i32* %77
%78 = getelementptr i8, i8* %16, i64 4
%79 = bitcast i8* %78 to i32*
store i32 1024, i32* %79
%80 = getelementptr i8, i8* %16, i64 6
%81 = bitcast i8* %80 to i32*
store i32 %75, i32* %81
%82 = getelementptr i8, i8* %16, i64 8
%83 = bitcast i8* %82 to i32*
store i32 %37, i32* %83
%84 = getelementptr i8, i8* %16, i64 10
%85 = bitcast i8* %84 to i32*
store i32 %39, i32* %85
%86 = getelementptr i8, i8* %16, i64 12
%87 = bitcast i8* %86 to i32*
store i32 -8192, i32* %87
%88 = getelementptr i8, i8* %16, i64 14
%89 = bitcast i8* %88 to i32*
store i32 8191, i32* %89
%90 = load i32, i32* %33
%91 = or i32 %90, 1
store i32 %91, i32* %33
%92 = tail call i32 @sleep(i32 1)
%93 = add nuw i32 %41, 10
br label %94
94: ; preds = %73, %94
%95 = phi i32 [ 0, %73 ], [ %98, %94 ]
%96 = load volatile i32, i32* %74
%97 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %96)
%98 = add nuw i32 %95, 1
%99 = icmp eq i32 %95, %93
br i1 %99, label %100, label %94
100: ; preds = %94, %6
%101 = phi i32* [ @EXIT_FAILURE, %6 ], [ @EXIT_SUCCESS, %94 ]
%102 = load i32, i32* %101
ret i32 %102
}