#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 /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ uint16_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*/ floor(long);
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 *);
int /*<<< orphan*/ stderr;
int strtol(char *, char **, int);
int /*<<< orphan*/ sysconf(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int fd, i;
  char *end;
  volatile void *cfg;
  long number[3];
  for (i = 0; i < 3; ++i) {
    errno = 0;
    number[i] = (argc == 4) ? strtol(argv[i + 1], &end, 10) : -1;
    if (errno != 0 || end == argv[i + 1]) {
      printf("Usage: gen [1-2] [0-32766] [0-61440000]\n");
      return EXIT_FAILURE;
    }
  }
  if (number[0] < 1 || number[0] > 2 || number[1] < 0 || number[1] > 32766 ||
      number[2] < 0 || number[2] > 61440000) {
    printf("Usage: gen [1-2] [0-32766] [0-61440000]\n");
    return EXIT_FAILURE;
  }
  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);
  switch (number[0]) {
  case 1:
    *(uint32_t *)(cfg + 16) =
        (uint32_t)floor(number[2] / 122.88e6 * (1 << 30) + 0.5);
    *(uint16_t *)(cfg + 24) = (uint16_t)number[1];
    break;
  case 2:
    *(uint32_t *)(cfg + 20) =
        (uint32_t)floor(number[2] / 122.88e6 * (1 << 30) + 0.5);
    *(uint16_t *)(cfg + 26) = (uint16_t)number[1];
    break;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    124e <main+0xde>
mov    0x2e1a(%rip),%rax
movq   $0x0,(%rax)
cmpl   $0x4,-0x8(%rbp)
jne    11d6 <main+0x66>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,-0x44(%rbp)
jmp    11e3 <main+0x73>
mov    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    11e3 <main+0x73>
mov    -0x44(%rbp),%eax
movslq %eax,%rcx
movslq -0x18(%rbp),%rax
mov    %rcx,-0x40(%rbp,%rax,8)
mov    0x2dbf(%rip),%rax
cmpq   $0x0,(%rax)
jne    121e <main+0xae>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,8),%rax
jne    123b <main+0xcb>
lea    0xdf3(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    140d <main+0x29d>
jmp    1240 <main+0xd0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118d <main+0x1d>
cmpq   $0x1,-0x40(%rbp)
jl     1296 <main+0x126>
cmpq   $0x2,-0x40(%rbp)
jg     1296 <main+0x126>
cmpq   $0x0,-0x38(%rbp)
jl     1296 <main+0x126>
cmpq   $0x7ffe,-0x38(%rbp)
jg     1296 <main+0x126>
cmpq   $0x0,-0x30(%rbp)
jl     1296 <main+0x126>
cmpq   $0x3a98000,-0x30(%rbp)
03
jle    12b3 <main+0x143>
lea    0xd7b(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d07(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    140d <main+0x29d>
mov    0x2d1e(%rip),%rax
mov    (%rax),%esi
lea    0xd7e(%rip),%rdi
call   1070 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    12fa <main+0x18a>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
lea    0xd66(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2cc0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    140d <main+0x29d>
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
call   1080 <sysconf@plt>
mov    %eax,%esi
mov    0x2ce7(%rip),%rax
mov    (%rax),%edx
mov    0x2c8e(%rip),%rax
mov    (%rax),%eax
or     %eax,%edx
mov    0x2cc3(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x40001000,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
sub    $0x1,%rax
je     1368 <main+0x1f8>
jmp    1355 <main+0x1e5>
mov    -0x50(%rbp),%rax
sub    $0x2,%rax
je     13b7 <main+0x247>
jmp    1401 <main+0x291>
cvtsi2sdq -0x30(%rbp),%xmm0
movsd  0xc9a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xc7e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc7a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1090 <floor@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x38(%rbp),%rax
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x18(%rax)
jmp    1401 <main+0x291>
cvtsi2sdq -0x30(%rbp),%xmm0
movsd  0xc4b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xc2f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc2b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1090 <floor@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x38(%rbp),%rax
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x1a(%rax)
mov    0x2b98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2e35(%rip),%r12
movq   $0x0,(%r12)
mov    $0xffffffffffffffff,%rbp
mov    $0xffffffffffffffff,%r14
mov    $0xffffffffffffffff,%r15
cmp    $0x4,%edi
jne    1251 <main+0xe1>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
cmpq   $0x0,(%r12)
jne    132d <main+0x1bd>
mov    %eax,%ebp
mov    0x8(%rsp),%rax
cmp    0x8(%rbx),%rax
je     132d <main+0x1bd>
movq   $0x0,(%r12)
mov    0x10(%rbx),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
cmpq   $0x0,(%r12)
jne    132d <main+0x1bd>
mov    %eax,%r14d
mov    0x8(%rsp),%rax
cmp    0x10(%rbx),%rax
je     132d <main+0x1bd>
movq   $0x0,(%r12)
mov    0x18(%rbx),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
cmpq   $0x0,(%r12)
jne    132d <main+0x1bd>
mov    0x8(%rsp),%rcx
cmp    0x18(%rbx),%rcx
je     132d <main+0x1bd>
movslq %ebp,%r15
movslq %r14d,%r14
movslq %eax,%rbp
lea    -0x3(%r15),%rax
cmp    $0xfffffffffffffffe,%rax
jb     132d <main+0x1bd>
test   %r14,%r14
js     132d <main+0x1bd>
cmp    $0x7ffe,%r14
jg     132d <main+0x1bd>
test   %rbp,%rbp
js     132d <main+0x1bd>
cmp    $0x3a98001,%rbp
jge    132d <main+0x1bd>
mov    0x2d46(%rip),%rax
mov    (%rax),%esi
lea    0xd7d(%rip),%rdi
call   1070 <open@plt>
test   %eax,%eax
js     134f <main+0x1df>
mov    %eax,%ebx
mov    0x2d1f(%rip),%rax
mov    (%rax),%edi
call   1080 <sysconf@plt>
mov    0x2d39(%rip),%rcx
mov    0x2ce2(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2d17(%rip),%rcx
mov    (%rcx),%ecx
xor    %edi,%edi
mov    %eax,%esi
mov    %ebx,%r8d
mov    $0x40001000,%r9d
call   1040 <mmap@plt>
mov    %rax,%r12
mov    0x2cb1(%rip),%rbx
cmp    $0x2,%r15
je     1366 <main+0x1f6>
cmp    $0x1,%r15
jne    1340 <main+0x1d0>
cvtsi2sd %ebp,%xmm0
divsd  0xcf9(%rip),%xmm0
mulsd  0xcf9(%rip),%xmm0
addsd  0xcf9(%rip),%xmm0
cvttsd2si %xmm0,%rdi
call   1090 <floor@plt>
mov    %eax,0x10(%r12)
mov    %r14d,0x18(%r12)
jmp    1340 <main+0x1d0>
lea    0xd04(%rip),%rdi
call   1030 <puts@plt>
mov    0x2c70(%rip),%rbx
mov    (%rbx),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
lea    0xcc2(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1339 <main+0x1c9>
cvtsi2sd %ebp,%xmm0
divsd  0xc8e(%rip),%xmm0
mulsd  0xc8e(%rip),%xmm0
addsd  0xc8e(%rip),%xmm0
cvttsd2si %xmm0,%rdi
call   1090 <floor@plt>
mov    %eax,0x14(%r12)
mov    %r14d,0x1a(%r12)
jmp    1340 <main+0x1d0>

LLVM IR (-O0):
@errno = global i64 0
@.str = [41 x i8] c"Usage: gen [1-2] [0-32766] [0-61440000]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.2 = [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
@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 [3 x i64]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %11
11: ; preds = %47, %2
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %50
14: ; preds = %11
store i64 0, i64* @errno
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 4
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load i8**, i8*** %5
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %18, i64 %21
%23 = load i8*, i8** %22
%24 = call i32 @strtol(i8* %23, i8** %8, i32 10)
br label %26
25: ; preds = %14
br label %26
26: ; preds = %25, %17
%27 = phi i32 [ %24, %17 ], [ -1, %25 ]
%28 = sext i32 %27 to i64
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 %30
store i64 %28, i64* %31
%32 = load i64, i64* @errno
%33 = icmp ne i64 %32, 0
br i1 %33, label %43, label %34
34: ; preds = %26
%35 = load i8*, i8** %8
%36 = load i8**, i8*** %5
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %36, i64 %39
%41 = load i8*, i8** %40
%42 = icmp eq i8* %35, %41
br i1 %42, label %43, label %46
43: ; preds = %34, %26
%44 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%45 = load i32, i32* @EXIT_FAILURE
store i32 %45, i32* %3
br label %132
46: ; preds = %34
br label %47
47: ; preds = %46
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %11
50: ; preds = %11
%51 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 0
%52 = load i64, i64* %51
%53 = icmp slt i64 %52, 1
br i1 %53, label %74, label %54
54: ; preds = %50
%55 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 0
%56 = load i64, i64* %55
%57 = icmp sgt i64 %56, 2
br i1 %57, label %74, label %58
58: ; preds = %54
%59 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 1
%60 = load i64, i64* %59
%61 = icmp slt i64 %60, 0
br i1 %61, label %74, label %62
62: ; preds = %58
%63 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 1
%64 = load i64, i64* %63
%65 = icmp sgt i64 %64, 32766
br i1 %65, label %74, label %66
66: ; preds = %62
%67 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 2
%68 = load i64, i64* %67
%69 = icmp slt i64 %68, 0
br i1 %69, label %74, label %70
70: ; preds = %66
%71 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 2
%72 = load i64, i64* %71
%73 = icmp sgt i64 %72, 61440000
br i1 %73, label %74, label %77
74: ; preds = %70, %66, %62, %58, %54, %50
%75 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%76 = load i32, i32* @EXIT_FAILURE
store i32 %76, i32* %3
br label %132
77: ; preds = %70
%78 = load i32, i32* @O_RDWR
%79 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %78)
store i32 %79, i32* %6
%80 = icmp slt i32 %79, 0
br i1 %80, label %81, label %85
81: ; preds = %77
%82 = load i32, i32* @stderr
%83 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%84 = load i32, i32* @EXIT_FAILURE
store i32 %84, i32* %3
br label %132
85: ; preds = %77
%86 = load i32, i32* @_SC_PAGESIZE
%87 = call i32 @sysconf(i32 %86)
%88 = load i32, i32* @PROT_READ
%89 = load i32, i32* @PROT_WRITE
%90 = or i32 %88, %89
%91 = load i32, i32* @MAP_SHARED
%92 = load i32, i32* %6
%93 = call i8* @mmap(i32* null, i32 %87, i32 %90, i32 %91, i32 %92, i32 1073745920)
store i8* %93, i8** %9
%94 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 0
%95 = load i64, i64* %94
switch i64 %95, label %130 [
i64 1, label %96
i64 2, label %113
]
96: ; preds = %85
%97 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 2
%98 = load i64, i64* %97
%99 = sitofp i64 %98 to double
%100 = fdiv double %99, 1.228800e+08
%101 = call double @llvm.fmuladd.f64(double %100, double 0x41D0000000000000, double 5.000000e-01)
%102 = fptosi double %101 to i64
%103 = call i32 @floor(i64 %102)
%104 = load i8*, i8** %9
%105 = getelementptr i8, i8* %104, i64 16
%106 = bitcast i8* %105 to i32*
store i32 %103, i32* %106
%107 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 1
%108 = load i64, i64* %107
%109 = trunc i64 %108 to i32
%110 = load i8*, i8** %9
%111 = getelementptr i8, i8* %110, i64 24
%112 = bitcast i8* %111 to i32*
store i32 %109, i32* %112
br label %130
113: ; preds = %85
%114 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 2
%115 = load i64, i64* %114
%116 = sitofp i64 %115 to double
%117 = fdiv double %116, 1.228800e+08
%118 = call double @llvm.fmuladd.f64(double %117, double 0x41D0000000000000, double 5.000000e-01)
%119 = fptosi double %118 to i64
%120 = call i32 @floor(i64 %119)
%121 = load i8*, i8** %9
%122 = getelementptr i8, i8* %121, i64 20
%123 = bitcast i8* %122 to i32*
store i32 %120, i32* %123
%124 = getelementptr inbounds [3 x i64], [3 x i64]* %10, i64 0, i64 1
%125 = load i64, i64* %124
%126 = trunc i64 %125 to i32
%127 = load i8*, i8** %9
%128 = getelementptr i8, i8* %127, i64 26
%129 = bitcast i8* %128 to i32*
store i32 %126, i32* %129
br label %130
130: ; preds = %85, %113, %96
%131 = load i32, i32* @EXIT_SUCCESS
store i32 %131, i32* %3
br label %132
132: ; preds = %130, %81, %74, %43
%133 = load i32, i32* %3
ret i32 %133
}

LLVM IR (-O2):
@errno = global i64 0
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.2 = [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
@EXIT_SUCCESS = global i32 0
@str.3 = [40 x i8] c"Usage: gen [1-2] [0-32766] [0-61440000]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp eq i32 %0, 4
store i64 0, i64* @errno
br i1 %5, label %6, label %44
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @strtol(i8* %8, i8** %3, i32 10)
%10 = load i64, i64* @errno
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %42
12: ; preds = %6
%13 = sext i32 %9 to i64
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = icmp eq i8* %14, %16
br i1 %17, label %42, label %18
18: ; preds = %12
store i64 0, i64* @errno
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @strtol(i8* %20, i8** %3, i32 10)
%22 = load i64, i64* @errno
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %42
24: ; preds = %18
%25 = sext i32 %21 to i64
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8*, i8** %1, i64 2
%28 = load i8*, i8** %27
%29 = icmp eq i8* %26, %28
br i1 %29, label %42, label %30
30: ; preds = %24
store i64 0, i64* @errno
%31 = getelementptr inbounds i8*, i8** %1, i64 3
%32 = load i8*, i8** %31
%33 = call i32 @strtol(i8* %32, i8** %3, i32 10)
%34 = load i64, i64* @errno
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %42
36: ; preds = %30
%37 = sext i32 %33 to i64
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8*, i8** %1, i64 3
%40 = load i8*, i8** %39
%41 = icmp eq i8* %38, %40
br i1 %41, label %42, label %44
42: ; preds = %36, %30, %24, %18, %12, %6
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.3, i64 0, i64 0))
br label %97
44: ; preds = %2, %36
%45 = phi i64 [ %37, %36 ], [ -1, %2 ]
%46 = phi i64 [ %25, %36 ], [ -1, %2 ]
%47 = phi i64 [ %13, %36 ], [ -1, %2 ]
%48 = add nsw i64 %47, -3
%49 = icmp ult i64 %48, -2
%50 = icmp slt i64 %46, 0
%51 = select i1 %49, i1 true, i1 %50
%52 = icmp sgt i64 %46, 32766
%53 = select i1 %51, i1 true, i1 %52
%54 = icmp slt i64 %45, 0
%55 = select i1 %53, i1 true, i1 %54
%56 = icmp sgt i64 %45, 61440000
%57 = select i1 %55, i1 true, i1 %56
br i1 %57, label %58, label %60
58: ; preds = %44
%59 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.3, i64 0, i64 0))
br label %97
60: ; preds = %44
%61 = load i32, i32* @O_RDWR
%62 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %60
%65 = load i32, i32* @stderr
%66 = tail call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %97
67: ; preds = %60
%68 = load i32, i32* @_SC_PAGESIZE
%69 = tail call i32 @sysconf(i32 %68)
%70 = load i32, i32* @PROT_READ
%71 = load i32, i32* @PROT_WRITE
%72 = or i32 %71, %70
%73 = load i32, i32* @MAP_SHARED
%74 = tail call i8* @mmap(i32* null, i32 %69, i32 %72, i32 %73, i32 %62, i32 1073745920)
switch i64 %47, label %97 [
i64 1, label %75
i64 2, label %86
]
75: ; preds = %67
%76 = sitofp i64 %45 to double
%77 = fdiv double %76, 1.228800e+08
%78 = tail call double @llvm.fmuladd.f64(double %77, double 0x41D0000000000000, double 5.000000e-01)
%79 = fptosi double %78 to i64
%80 = tail call i32 @floor(i64 %79)
%81 = getelementptr i8, i8* %74, i64 16
%82 = bitcast i8* %81 to i32*
store i32 %80, i32* %82
%83 = trunc i64 %46 to i32
%84 = getelementptr i8, i8* %74, i64 24
%85 = bitcast i8* %84 to i32*
store i32 %83, i32* %85
br label %97
86: ; preds = %67
%87 = sitofp i64 %45 to double
%88 = fdiv double %87, 1.228800e+08
%89 = tail call double @llvm.fmuladd.f64(double %88, double 0x41D0000000000000, double 5.000000e-01)
%90 = fptosi double %89 to i64
%91 = tail call i32 @floor(i64 %90)
%92 = getelementptr i8, i8* %74, i64 20
%93 = bitcast i8* %92 to i32*
store i32 %91, i32* %93
%94 = trunc i64 %46 to i32
%95 = getelementptr i8, i8* %74, i64 26
%96 = bitcast i8* %95 to i32*
store i32 %94, i32* %96
br label %97
97: ; preds = %75, %86, %67, %64, %58, %42
%98 = phi i32* [ @EXIT_FAILURE, %42 ], [ @EXIT_FAILURE, %58 ], [ @EXIT_FAILURE, %64 ], [ @EXIT_SUCCESS, %67 ], [ @EXIT_SUCCESS, %86 ], [ @EXIT_SUCCESS, %75 ]
%99 = load i32, i32* %98
ret i32 %99
}