#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 long uint32_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;
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *mmap(int /*<<< orphan*/ *, int /*<<< orphan*/, int, int /*<<< orphan*/,
           int, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ sleep(long);
int /*<<< orphan*/ stderr;
double strtod(char *, char **);
long strtol(char *, char **, int);
int /*<<< orphan*/ sysconf(int /*<<< orphan*/);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  int fd, i;
  char *end;
  volatile void *cfg, *sts;
  volatile uint32_t *fifo;
  volatile uint8_t *rst;
  volatile uint32_t *cntr;
  double freq;
  long time;
  uint32_t buffer;
  float corr;
  if (argc != 3) {
    usage();
    return EXIT_FAILURE;
  }
  errno = 0;
  freq = strtod(argv[1], &end);
  if (errno != 0 || end == argv[1] || (freq != 122.88 && freq != 125.0)) {
    usage();
    return EXIT_FAILURE;
  }
  time = strtol(argv[2], &end, 10);
  if (errno != 0 || end == argv[2] || time < 1 || time > 30) {
    usage();
    return EXIT_FAILURE;
  }
  if ((fd = open("/dev/mem", O_RDWR)) < 0) {
    fprintf(stderr, "Cannot open /dev/mem.\n");
    return EXIT_FAILURE;
  }
  sts = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE, MAP_SHARED,
             fd, 0x40040000);
  cfg = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE, MAP_SHARED,
             fd, 0x40041000);
  fifo = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE, MAP_SHARED,
              fd, 0x40042000);
  rst = (uint8_t *)(cfg + 0);
  cntr = (uint32_t *)(sts + 0);
  *rst &= ~1;
  *rst |= 1;
  sleep(time + 1);
  if (*cntr < time) {
    fprintf(stderr, "Not enough PPS pulses.\n");
    return EXIT_FAILURE;
  }
  buffer = 0;
  for (i = 0; i < time; ++i) {
    buffer += *fifo + 1;
  }
  corr = (freq * 1.0e6 * time / buffer - 1.0) * 1.0e6;
  if (corr < -100.0 || corr > 100.0) {
    fprintf(stderr, "Correction value is out of range.\n");
    return EXIT_FAILURE;
  }
  printf("%.2f\n", corr);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11c8 <main+0x38>
mov    $0x0,%al
call   1080 <usage@plt>
mov    0x2df2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1546 <main+0x3b6>
mov    0x2de9(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x50(%rbp)
mov    0x2dc5(%rip),%rax
cmpq   $0x0,(%rax)
jne    1253 <main+0xc3>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     1253 <main+0xc3>
movsd  -0x50(%rbp),%xmm0
movsd  0xde4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1231 <main+0xa1>
jp     1231 <main+0xa1>
jmp    126b <main+0xdb>
movsd  -0x50(%rbp),%xmm0
movsd  0xdca(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1253 <main+0xc3>
jp     1253 <main+0xc3>
jmp    126b <main+0xdb>
mov    $0x0,%al
call   1080 <usage@plt>
mov    0x2d4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1546 <main+0x3b6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,-0x58(%rbp)
mov    0x2d2c(%rip),%rax
cmpq   $0x0,(%rax)
jne    12be <main+0x12e>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    0x10(%rcx),%rax
je     12be <main+0x12e>
cmpq   $0x1,-0x58(%rbp)
jl     12be <main+0x12e>
cmpq   $0x1e,-0x58(%rbp)
jle    12d6 <main+0x146>
mov    $0x0,%al
call   1080 <usage@plt>
mov    0x2ce4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1546 <main+0x3b6>
mov    0x2cfb(%rip),%rax
mov    (%rax),%esi
lea    0xd4a(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    131d <main+0x18d>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
lea    0xd32(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2c9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1546 <main+0x3b6>
mov    0x2cac(%rip),%rax
mov    (%rax),%edi
call   10a0 <sysconf@plt>
mov    %eax,%esi
mov    0x2cc4(%rip),%rax
mov    (%rax),%edx
mov    0x2c6b(%rip),%rax
or     (%rax),%edx
mov    0x2ca2(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x40040000,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x30(%rbp)
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
call   10a0 <sysconf@plt>
mov    %eax,%esi
mov    0x2c82(%rip),%rax
mov    (%rax),%edx
mov    0x2c29(%rip),%rax
or     (%rax),%edx
mov    0x2c60(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x40041000,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    0x2c28(%rip),%rax
mov    (%rax),%edi
call   10a0 <sysconf@plt>
mov    %eax,%esi
mov    0x2c40(%rip),%rax
mov    (%rax),%edx
mov    0x2be7(%rip),%rax
or     (%rax),%edx
mov    0x2c1e(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x40042000,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    %ecx,(%rax)
mov    -0x40(%rbp),%rax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x58(%rbp),%rdi
add    $0x1,%rdi
call   10b0 <sleep@plt>
mov    -0x48(%rbp),%rax
mov    (%rax),%rax
cmp    -0x58(%rbp),%rax
jge    144d <main+0x2bd>
mov    0x2b92(%rip),%rax
mov    (%rax),%edi
lea    0xc19(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2b6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1546 <main+0x3b6>
movq   $0x0,-0x60(%rbp)
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    -0x58(%rbp),%rax
jge    148b <main+0x2fb>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
add    $0x1,%rax
add    -0x60(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    145c <main+0x2cc>
movsd  0xb85(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
cvtsi2sdq -0x58(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdq -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xb6c(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xb58(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x64(%rbp)
movss  -0x64(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xb32(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1503 <main+0x373>
movss  -0x64(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xb2f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1529 <main+0x399>
mov    0x2ab6(%rip),%rax
mov    (%rax),%edi
lea    0xb55(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2a91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1546 <main+0x3b6>
movss  -0x64(%rbp),%xmm0
lea    0xb56(%rip),%rdi
call   1050 <printf@plt>
mov    0x2a5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x3,%edi
jne    11c8 <main+0x38>
mov    %rsi,%rbx
mov    0x2e0b(%rip),%rbp
movq   $0x0,0x0(%rbp)
mov    0x8(%rsi),%rdi
mov    %rsp,%rsi
call   1030 <strtod@plt>
cmpq   $0x0,0x0(%rbp)
je     11e7 <main+0x57>
xor    %eax,%eax
call   1080 <usage@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rsp),%rax
cmp    0x8(%rbx),%rax
je     11c8 <main+0x38>
ucomisd 0xe07(%rip),%xmm0
jne    11fd <main+0x6d>
jnp    1209 <main+0x79>
ucomisd 0xe03(%rip),%xmm0
jne    11c8 <main+0x38>
jp     11c8 <main+0x38>
movsd  %xmm0,0x10(%rsp)
mov    0x10(%rbx),%rdi
mov    %rsp,%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
cmpq   $0x0,0x0(%rbp)
jne    11c8 <main+0x38>
mov    %rax,%r14
mov    (%rsp),%rax
cmp    0x10(%rbx),%rax
je     11c8 <main+0x38>
test   %r14,%r14
jle    11c8 <main+0x38>
cmp    $0x1f,%r14
jge    11c8 <main+0x38>
mov    0x2d92(%rip),%rax
mov    (%rax),%esi
lea    0xdd9(%rip),%rdi
call   1090 <open@plt>
test   %eax,%eax
js     1331 <main+0x1a1>
mov    %eax,%ebx
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
mov    %rax,%r12
call   10a0 <sysconf@plt>
mov    0x2d82(%rip),%rcx
mov    0x2d2b(%rip),%r15
mov    (%r15),%edx
or     (%rcx),%edx
mov    %rcx,%rbp
mov    0x2d5c(%rip),%r13
mov    0x0(%r13),%ecx
xor    %edi,%edi
mov    %eax,%esi
mov    %ebx,%r8d
mov    $0x40040000,%r9d
call   1040 <mmap@plt>
mov    %rax,0x8(%rsp)
mov    (%r12),%edi
call   10a0 <sysconf@plt>
mov    (%r15),%edx
or     0x0(%rbp),%edx
mov    0x0(%r13),%ecx
xor    %edi,%edi
mov    %eax,%esi
mov    %ebx,%r8d
mov    $0x40041000,%r9d
call   1040 <mmap@plt>
mov    %rax,%r12
mov    0x2cfa(%rip),%rax
mov    (%rax),%edi
call   10a0 <sysconf@plt>
mov    (%r15),%edx
or     0x0(%rbp),%edx
mov    0x0(%r13),%ecx
xor    %edi,%edi
mov    %eax,%esi
mov    %ebx,%r8d
mov    $0x40042000,%r9d
call   1040 <mmap@plt>
mov    %rax,%rbx
andl   $0xfffffffe,(%r12)
orl    $0x1,(%r12)
lea    0x1(%r14),%rdi
call   10b0 <sleep@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%rax
cmp    %r14,%rax
jge    1346 <main+0x1b6>
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
lea    0xd1c(%rip),%rsi
jmp    1406 <main+0x276>
mov    0x2c88(%rip),%rax
mov    (%rax),%edi
lea    0xcf0(%rip),%rsi
jmp    1406 <main+0x276>
lea    -0x1(%r14),%rcx
mov    %r14d,%eax
and    $0x3,%eax
cmp    $0x3,%rcx
jae    135a <main+0x1ca>
xor    %ecx,%ecx
jmp    137c <main+0x1ec>
mov    %r14,%rdx
and    $0xfffffffffffffffc,%rdx
xor    %ecx,%ecx
add    (%rbx),%rcx
add    (%rbx),%rcx
add    (%rbx),%rcx
mov    (%rbx),%rsi
add    %rsi,%rcx
add    $0x4,%rcx
add    $0xfffffffffffffffc,%rdx
jne    1363 <main+0x1d3>
test   %rax,%rax
je     1391 <main+0x201>
mov    (%rbx),%rdx
add    %rdx,%rcx
add    $0x1,%rcx
add    $0xffffffffffffffff,%rax
jne    1381 <main+0x1f1>
cvtsi2sd %rcx,%xmm0
movsd  0xc72(%rip),%xmm1
movsd  0x10(%rsp),%xmm3
mulsd  %xmm1,%xmm3
cvtsi2sd %r14,%xmm2
mulsd  %xmm3,%xmm2
divsd  %xmm0,%xmm2
addsd  0xc5b(%rip),%xmm2
mulsd  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
movss  0xc50(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     13f6 <main+0x266>
ucomiss 0xc48(%rip),%xmm0
ja     13f6 <main+0x266>
lea    0xc9e(%rip),%rdi
call   1050 <printf@plt>
mov    0x2baf(%rip),%rax
jmp    11d6 <main+0x46>
mov    0x2bc3(%rip),%rax
mov    (%rax),%edi
lea    0xc5a(%rip),%rsi
call   1060 <fprintf@plt>
jmp    11cf <main+0x3f>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@errno = global i64 0
@.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"
@_SC_PAGESIZE = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.2 = [24 x i8] c"Not enough PPS pulses.\0A\00"
@.str.3 = [35 x i8] c"Correction value is out of range.\0A\00"
@.str.4 = [6 x i8] c"%.2f\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 i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i64*
%12 = alloca i32*
%13 = alloca i64*
%14 = alloca double
%15 = alloca i64
%16 = alloca i64
%17 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 3
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = call i32 (...) @usage()
%22 = load i32, i32* @EXIT_FAILURE
store i32 %22, i32* %3
br label %166
23: ; preds = %2
store i64 0, i64* @errno
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call double @strtod(i8* %26, i8** %8)
store double %27, double* %14
%28 = load i64, i64* @errno
%29 = icmp ne i64 %28, 0
br i1 %29, label %42, label %30
30: ; preds = %23
%31 = load i8*, i8** %8
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = icmp eq i8* %31, %34
br i1 %35, label %42, label %36
36: ; preds = %30
%37 = load double, double* %14
%38 = fcmp une double %37, 1.228800e+02
br i1 %38, label %39, label %45
39: ; preds = %36
%40 = load double, double* %14
%41 = fcmp une double %40, 1.250000e+02
br i1 %41, label %42, label %45
42: ; preds = %39, %30, %23
%43 = call i32 (...) @usage()
%44 = load i32, i32* @EXIT_FAILURE
store i32 %44, i32* %3
br label %166
45: ; preds = %39, %36
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = call i64 @strtol(i8* %48, i8** %8, i32 10)
store i64 %49, i64* %15
%50 = load i64, i64* @errno
%51 = icmp ne i64 %50, 0
br i1 %51, label %64, label %52
52: ; preds = %45
%53 = load i8*, i8** %8
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 2
%56 = load i8*, i8** %55
%57 = icmp eq i8* %53, %56
br i1 %57, label %64, label %58
58: ; preds = %52
%59 = load i64, i64* %15
%60 = icmp slt i64 %59, 1
br i1 %60, label %64, label %61
61: ; preds = %58
%62 = load i64, i64* %15
%63 = icmp sgt i64 %62, 30
br i1 %63, label %64, label %67
64: ; preds = %61, %58, %52, %45
%65 = call i32 (...) @usage()
%66 = load i32, i32* @EXIT_FAILURE
store i32 %66, i32* %3
br label %166
67: ; preds = %61
%68 = load i32, i32* @O_RDWR
%69 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %68)
store i32 %69, i32* %6
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %75
71: ; preds = %67
%72 = load i32, i32* @stderr
%73 = call i32 @fprintf(i32 %72, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%74 = load i32, i32* @EXIT_FAILURE
store i32 %74, i32* %3
br label %166
75: ; preds = %67
%76 = load i32, i32* @_SC_PAGESIZE
%77 = call i32 @sysconf(i32 %76)
%78 = load i32, i32* @PROT_READ
%79 = load i32, i32* @PROT_WRITE
%80 = or i32 %78, %79
%81 = load i32, i32* @MAP_SHARED
%82 = load i32, i32* %6
%83 = call i8* @mmap(i32* null, i32 %77, i32 %80, i32 %81, i32 %82, i32 1074003968)
store i8* %83, i8** %10
%84 = load i32, i32* @_SC_PAGESIZE
%85 = call i32 @sysconf(i32 %84)
%86 = load i32, i32* @PROT_READ
%87 = load i32, i32* @PROT_WRITE
%88 = or i32 %86, %87
%89 = load i32, i32* @MAP_SHARED
%90 = load i32, i32* %6
%91 = call i8* @mmap(i32* null, i32 %85, i32 %88, i32 %89, i32 %90, i32 1074008064)
store i8* %91, i8** %9
%92 = load i32, i32* @_SC_PAGESIZE
%93 = call i32 @sysconf(i32 %92)
%94 = load i32, i32* @PROT_READ
%95 = load i32, i32* @PROT_WRITE
%96 = or i32 %94, %95
%97 = load i32, i32* @MAP_SHARED
%98 = load i32, i32* %6
%99 = call i8* @mmap(i32* null, i32 %93, i32 %96, i32 %97, i32 %98, i32 1074012160)
%100 = bitcast i8* %99 to i64*
store i64* %100, i64** %11
%101 = load i8*, i8** %9
%102 = getelementptr i8, i8* %101, i64 0
%103 = bitcast i8* %102 to i32*
store i32* %103, i32** %12
%104 = load i8*, i8** %10
%105 = getelementptr i8, i8* %104, i64 0
%106 = bitcast i8* %105 to i64*
store i64* %106, i64** %13
%107 = load i32*, i32** %12
%108 = load volatile i32, i32* %107
%109 = and i32 %108, -2
store volatile i32 %109, i32* %107
%110 = load i32*, i32** %12
%111 = load volatile i32, i32* %110
%112 = or i32 %111, 1
store volatile i32 %112, i32* %110
%113 = load i64, i64* %15
%114 = add nsw i64 %113, 1
%115 = call i32 @sleep(i64 %114)
%116 = load i64*, i64** %13
%117 = load volatile i64, i64* %116
%118 = load i64, i64* %15
%119 = icmp slt i64 %117, %118
br i1 %119, label %120, label %124
120: ; preds = %75
%121 = load i32, i32* @stderr
%122 = call i32 @fprintf(i32 %121, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%123 = load i32, i32* @EXIT_FAILURE
store i32 %123, i32* %3
br label %166
124: ; preds = %75
store i64 0, i64* %16
store i32 0, i32* %7
br label %125
125: ; preds = %136, %124
%126 = load i32, i32* %7
%127 = sext i32 %126 to i64
%128 = load i64, i64* %15
%129 = icmp slt i64 %127, %128
br i1 %129, label %130, label %139
130: ; preds = %125
%131 = load i64*, i64** %11
%132 = load volatile i64, i64* %131
%133 = add nsw i64 %132, 1
%134 = load i64, i64* %16
%135 = add nsw i64 %134, %133
store i64 %135, i64* %16
br label %136
136: ; preds = %130
%137 = load i32, i32* %7
%138 = add nsw i32 %137, 1
store i32 %138, i32* %7
br label %125
139: ; preds = %125
%140 = load double, double* %14
%141 = fmul double %140, 1.000000e+06
%142 = load i64, i64* %15
%143 = sitofp i64 %142 to double
%144 = fmul double %141, %143
%145 = load i64, i64* %16
%146 = sitofp i64 %145 to double
%147 = fdiv double %144, %146
%148 = fsub double %147, 1.000000e+00
%149 = fmul double %148, 1.000000e+06
%150 = fptrunc double %149 to float
store float %150, float* %17
%151 = load float, float* %17
%152 = fpext float %151 to double
%153 = fcmp olt double %152, -1.000000e+02
br i1 %153, label %158, label %154
154: ; preds = %139
%155 = load float, float* %17
%156 = fpext float %155 to double
%157 = fcmp ogt double %156, 1.000000e+02
br i1 %157, label %158, label %162
158: ; preds = %154, %139
%159 = load i32, i32* @stderr
%160 = call i32 @fprintf(i32 %159, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%161 = load i32, i32* @EXIT_FAILURE
store i32 %161, i32* %3
br label %166
162: ; preds = %154
%163 = load float, float* %17
%164 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), float %163)
%165 = load i32, i32* @EXIT_SUCCESS
store i32 %165, i32* %3
br label %166
166: ; preds = %162, %158, %120, %71, %64, %42, %20
%167 = load i32, i32* %3
ret i32 %167
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@errno = global i64 0
@.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"
@_SC_PAGESIZE = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.2 = [24 x i8] c"Not enough PPS pulses.\0A\00"
@.str.3 = [35 x i8] c"Correction value is out of range.\0A\00"
@.str.4 = [6 x i8] c"%.2f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp eq i32 %0, 3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @usage()
br label %136
8: ; preds = %2
store i64 0, i64* @errno
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call double @strtod(i8* %10, i8** %3)
%12 = load i64, i64* @errno
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %8
%15 = load i8*, i8** %3
%16 = load i8*, i8** %9
%17 = icmp eq i8* %15, %16
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = fcmp une double %11, 1.228800e+02
%20 = fcmp une double %11, 1.250000e+02
%21 = and i1 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %18, %14, %8
%23 = tail call i32 (...) @usage()
br label %136
24: ; preds = %18
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = call i64 @strtol(i8* %26, i8** %3, i32 10)
%28 = load i64, i64* @errno
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %38
30: ; preds = %24
%31 = load i8*, i8** %3
%32 = load i8*, i8** %25
%33 = icmp eq i8* %31, %32
%34 = icmp slt i64 %27, 1
%35 = select i1 %33, i1 true, i1 %34
%36 = icmp sgt i64 %27, 30
%37 = select i1 %35, i1 true, i1 %36
br i1 %37, label %38, label %40
38: ; preds = %30, %24
%39 = tail call i32 (...) @usage()
br label %136
40: ; preds = %30
%41 = load i32, i32* @O_RDWR
%42 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i32, i32* @stderr
%46 = tail call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %136
47: ; preds = %40
%48 = load i32, i32* @_SC_PAGESIZE
%49 = tail call i32 @sysconf(i32 %48)
%50 = load i32, i32* @PROT_READ
%51 = load i32, i32* @PROT_WRITE
%52 = or i32 %51, %50
%53 = load i32, i32* @MAP_SHARED
%54 = tail call i8* @mmap(i32* null, i32 %49, i32 %52, i32 %53, i32 %42, i32 1074003968)
%55 = load i32, i32* @_SC_PAGESIZE
%56 = tail call i32 @sysconf(i32 %55)
%57 = load i32, i32* @PROT_READ
%58 = load i32, i32* @PROT_WRITE
%59 = or i32 %58, %57
%60 = load i32, i32* @MAP_SHARED
%61 = tail call i8* @mmap(i32* null, i32 %56, i32 %59, i32 %60, i32 %42, i32 1074008064)
%62 = load i32, i32* @_SC_PAGESIZE
%63 = tail call i32 @sysconf(i32 %62)
%64 = load i32, i32* @PROT_READ
%65 = load i32, i32* @PROT_WRITE
%66 = or i32 %65, %64
%67 = load i32, i32* @MAP_SHARED
%68 = tail call i8* @mmap(i32* null, i32 %63, i32 %66, i32 %67, i32 %42, i32 1074012160)
%69 = bitcast i8* %68 to i64*
%70 = bitcast i8* %61 to i32*
%71 = bitcast i8* %54 to i64*
%72 = load volatile i32, i32* %70
%73 = and i32 %72, -2
store volatile i32 %73, i32* %70
%74 = load volatile i32, i32* %70
%75 = or i32 %74, 1
store volatile i32 %75, i32* %70
%76 = add nuw nsw i64 %27, 1
%77 = tail call i32 @sleep(i64 %76)
%78 = load volatile i64, i64* %71
%79 = icmp slt i64 %78, %27
br i1 %79, label %86, label %80
80: ; preds = %47
%81 = add i64 %27, -1
%82 = and i64 %27, 3
%83 = icmp ult i64 %81, 3
br i1 %83, label %106, label %84
84: ; preds = %80
%85 = and i64 %27, -4
br label %89
86: ; preds = %47
%87 = load i32, i32* @stderr
%88 = tail call i32 @fprintf(i32 %87, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %136
89: ; preds = %89, %84
%90 = phi i64 [ 0, %84 ], [ %103, %89 ]
%91 = phi i64 [ 0, %84 ], [ %104, %89 ]
%92 = load volatile i64, i64* %69
%93 = add i64 %90, 1
%94 = add i64 %93, %92
%95 = load volatile i64, i64* %69
%96 = add i64 %94, 1
%97 = add i64 %96, %95
%98 = load volatile i64, i64* %69
%99 = add i64 %97, 1
%100 = add i64 %99, %98
%101 = load volatile i64, i64* %69
%102 = add i64 %100, 1
%103 = add i64 %102, %101
%104 = add i64 %91, 4
%105 = icmp eq i64 %104, %85
br i1 %105, label %106, label %89
106: ; preds = %89, %80
%107 = phi i64 [ undef, %80 ], [ %103, %89 ]
%108 = phi i64 [ 0, %80 ], [ %103, %89 ]
%109 = icmp eq i64 %82, 0
br i1 %109, label %118, label %110
110: ; preds = %106, %110
%111 = phi i64 [ %115, %110 ], [ %108, %106 ]
%112 = phi i64 [ %116, %110 ], [ 0, %106 ]
%113 = load volatile i64, i64* %69
%114 = add i64 %111, 1
%115 = add i64 %114, %113
%116 = add i64 %112, 1
%117 = icmp eq i64 %116, %82
br i1 %117, label %118, label %110
118: ; preds = %110, %106
%119 = phi i64 [ %107, %106 ], [ %115, %110 ]
%120 = sitofp i64 %119 to double
%121 = fmul double %11, 1.000000e+06
%122 = sitofp i64 %27 to double
%123 = fmul double %121, %122
%124 = fdiv double %123, %120
%125 = fadd double %124, -1.000000e+00
%126 = fmul double %125, 1.000000e+06
%127 = fptrunc double %126 to float
%128 = fcmp olt float %127, -1.000000e+02
%129 = fcmp ogt float %127, 1.000000e+02
%130 = or i1 %128, %129
br i1 %130, label %131, label %134
131: ; preds = %118
%132 = load i32, i32* @stderr
%133 = tail call i32 @fprintf(i32 %132, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %136
134: ; preds = %118
%135 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), float %127)
br label %136
136: ; preds = %134, %131, %86, %44, %38, %22, %6
%137 = phi i32* [ @EXIT_FAILURE, %6 ], [ @EXIT_FAILURE, %22 ], [ @EXIT_FAILURE, %38 ], [ @EXIT_FAILURE, %44 ], [ @EXIT_FAILURE, %86 ], [ @EXIT_FAILURE, %131 ], [ @EXIT_SUCCESS, %134 ]
%138 = load i32, i32* %137
ret i32 %138
}