#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 */

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(unsigned char *);
size_t freeRAM();
unsigned char *malloc(size_t);
int /*<<< orphan*/ memset(unsigned char *, unsigned char, size_t);
int /*<<< orphan*/ stderr;
double timedouble();
size_t totalswap();
int main(int argc, char *argv[]) {
  size_t ram = freeRAM(), swap = totalswap();
  if (swap != 0) {
    fprintf(stderr, "*warning* turn off swap with swapoff -a\n");
    exit(1);
  }
  fprintf(stderr, "*info* ram to test %zd MiB\n", ram / 1024 / 1024);
  unsigned char *c = NULL;
  do {
    c = malloc(ram);
    if (!c) {
      fprintf(stderr, "No ram in %zd chunk\n", ram);
      ram = ram * 0.99;
    }
  } while (c == NULL);
  fprintf(stderr, "*info* allocated %zd chunk\n", ram);
  size_t errors = 0;
  unsigned char pattern[3] = {0xff, 0x00, 0x01 + 0x04 + 0x10 + 0x40};
  for (size_t pat = 0; pat < 3; pat++) {
    fprintf(stderr, "*info* setting pattern to %2x\n", pattern[pat]);
    memset(c, pattern[pat], ram);
    double starttime = timedouble();
    double runtime = 5 * 60;
    size_t pass = 1;
    while (timedouble() - starttime < runtime) {
      fprintf(stderr,
              "*info* pass %zd looking for non %2x (%.0lf secs remain)\n",
              pass++, pattern[pat], runtime - (timedouble() - starttime));
      if (errors) {
        fprintf(stderr, "**ERROR** memory errors: %zd\n", errors);
      }
      unsigned char *p = c;
      for (size_t i = 0; i < ram; i++) {
        if (*p != pattern[pat]) {
          fprintf(stderr, "error at [%zd]: was %2x instead of %2x\n", i, *p,
                  pattern[pat]);
          errors++;
        }
        p++;
      }
    }
  }
  free(c);
  if (errors)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10a0 <freeRAM@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <totalswap@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11db <main+0x5b>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
shr    $0xa,%rdx
shr    $0xa,%rdx
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1296 <main+0x116>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe4b(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movaps 0xdc0(%rip),%xmm1
movq   -0x18(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xdbf(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
movsd  0xda5(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    129b <main+0x11b>
cmpq   $0x0,-0x28(%rbp)
je     1206 <main+0x86>
mov    0x2d33(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xdd8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movq   $0x0,-0x30(%rbp)
mov    0xe7c(%rip),%ax
mov    %ax,-0x33(%rbp)
mov    0xe74(%rip),%al
mov    %al,-0x31(%rbp)
movq   $0x0,-0x40(%rbp)
cmpq   $0x3,-0x40(%rbp)
jae    149b <main+0x31b>
mov    0x2ce9(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rax
movzbl -0x33(%rbp,%rax,1),%edx
lea    0xda5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    -0x33(%rbp,%rax,1),%al
mov    -0x18(%rbp),%rdx
movzbl %al,%esi
call   1050 <memset@plt>
mov    $0x0,%al
call   1070 <timedouble@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  0xcf4(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movq   $0x1,-0x58(%rbp)
mov    $0x0,%al
call   1070 <timedouble@plt>
movaps %xmm0,%xmm1
subsd  -0x48(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1485 <main+0x305>
mov    0x2c72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x80(%rbp)
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x40(%rbp),%rax
movzbl -0x33(%rbp,%rax,1),%eax
mov    %eax,-0x74(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    $0x0,%al
call   1070 <timedouble@plt>
mov    -0x84(%rbp),%edi
mov    -0x80(%rbp),%rdx
mov    -0x74(%rbp),%ecx
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm1
subsd  %xmm1,%xmm0
lea    0xd05(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
cmpq   $0x0,-0x30(%rbp)
je     13f5 <main+0x275>
mov    0x2bff(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xd18(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
movq   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1480 <main+0x300>
mov    -0x60(%rbp),%rax
movzbl (%rax),%eax
mov    -0x40(%rbp),%rcx
movzbl -0x33(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     1463 <main+0x2e3>
mov    0x2bae(%rip),%rax
mov    (%rax),%edi
mov    -0x68(%rbp),%rdx
mov    -0x60(%rbp),%rax
movzbl (%rax),%ecx
mov    -0x40(%rbp),%rax
movzbl -0x33(%rbp,%rax,1),%r8d
lea    0xcd4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
jmp    1405 <main+0x285>
jmp    1349 <main+0x1c9>
jmp    148a <main+0x30a>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    12e5 <main+0x165>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x30(%rbp)
je     14bb <main+0x33b>
movl   $0x1,-0x4(%rbp)
jmp    14c2 <main+0x342>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   10a0 <freeRAM@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1040 <totalswap@plt>
mov    0x2e3a(%rip),%rbp
mov    0x0(%rbp),%edi
test   %rax,%rax
jne    13e4 <main+0x264>
mov    %r14,%rdx
shr    $0x14,%rdx
lea    0xea1(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   1080 <malloc@plt>
test   %rax,%rax
jne    1245 <main+0xc5>
lea    0xea2(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
movq   %r14,%xmm0
punpckldq 0xe03(%rip),%xmm0
subpd  0xe0b(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0xe07(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xdfb(%rip),%xmm1
cvttsd2si %xmm1,%r14
and    %rcx,%r14
or     %rax,%r14
mov    %r14,%rdi
call   1080 <malloc@plt>
test   %rax,%rax
je     11e0 <main+0x60>
mov    %rax,%r12
mov    0x0(%rbp),%edi
lea    0xe40(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %ecx,%ecx
xor    %ebx,%ebx
jmp    1286 <main+0x106>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x10(%rsp),%rcx
add    $0x1,%rcx
cmp    $0x3,%rcx
mov    %r13,%rbp
je     13c5 <main+0x245>
mov    %rbp,%r13
mov    0x0(%rbp),%edi
lea    0xeb9(%rip),%rax
mov    %rcx,0x10(%rsp)
movzbl (%rcx,%rax,1),%r15d
lea    0xe0a(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
call   1050 <memset@plt>
xor    %eax,%eax
call   1070 <timedouble@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <timedouble@plt>
movsd  (%rsp),%xmm2
subsd  %xmm2,%xmm0
movsd  0xd50(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1270 <main+0xf0>
mov    $0x1,%ebp
jmp    131b <main+0x19b>
nopl   (%rax)
mov    0x8(%rsp),%rbp
add    $0x1,%rbp
xor    %eax,%eax
call   1070 <timedouble@plt>
movsd  (%rsp),%xmm2
subsd  %xmm2,%xmm0
movsd  0xd1f(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1270 <main+0xf0>
mov    %rbp,0x8(%rsp)
mov    0x0(%r13),%ebp
xor    %eax,%eax
call   1070 <timedouble@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
addsd  0xcf4(%rip),%xmm1
mov    %ebp,%edi
lea    0xd88(%rip),%rsi
mov    0x8(%rsp),%rdx
mov    %r15d,%ecx
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1060 <fprintf@plt>
test   %rbx,%rbx
je     1377 <main+0x1f7>
mov    0x2c7c(%rip),%rax
mov    (%rax),%edi
lea    0xd99(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
test   %r14,%r14
je     12f0 <main+0x170>
xor    %ebp,%ebp
jmp    139d <main+0x21d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbp
cmp    %rbp,%r14
je     12f0 <main+0x170>
movzbl (%r12,%rbp,1),%ecx
cmp    %r15b,%cl
je     1390 <main+0x210>
mov    0x0(%r13),%edi
lea    0xd72(%rip),%rsi
mov    %rbp,%rdx
mov    %r15d,%r8d
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x1,%rbx
jmp    1390 <main+0x210>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
test   %rbx,%rbx
setne  %al
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc4d(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"*warning* turn off swap with swapoff -a\0A\00"
@.str.1 = [28 x i8] c"*info* ram to test %zd MiB\0A\00"
@.str.2 = [21 x i8] c"No ram in %zd chunk\0A\00"
@.str.3 = [28 x i8] c"*info* allocated %zd chunk\0A\00"
@__const.main.pattern = [3 x i8] c"\FF\00U"
@.str.4 = [31 x i8] c"*info* setting pattern to %2x\0A\00"
@.str.5 = [57 x i8] c"*info* pass %zd looking for non %2x (%.0lf secs remain)\0A\00"
@.str.6 = [30 x i8] c"**ERROR** memory errors: %zd\0A\00"
@.str.7 = [40 x i8] c"error at [%zd]: was %2x instead of %2x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
%10 = alloca [3 x i8]
%11 = alloca i64
%12 = alloca double
%13 = alloca double
%14 = alloca i64
%15 = alloca i8*
%16 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = call i64 (...) @freeRAM()
store i64 %17, i64* %6
%18 = call i64 (...) @totalswap()
store i64 %18, i64* %7
%19 = load i64, i64* %7
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %2
%26 = load i32, i32* @stderr
%27 = load i64, i64* %6
%28 = udiv i64 %27, 1024
%29 = udiv i64 %28, 1024
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 %29)
store i8* null, i8** %8
br label %31
31: ; preds = %45, %25
%32 = load i64, i64* %6
%33 = call i8* @malloc(i64 %32)
store i8* %33, i8** %8
%34 = load i8*, i8** %8
%35 = icmp ne i8* %34, null
br i1 %35, label %44, label %36
36: ; preds = %31
%37 = load i32, i32* @stderr
%38 = load i64, i64* %6
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i64 %38)
%40 = load i64, i64* %6
%41 = uitofp i64 %40 to double
%42 = fmul double %41, 0x3FEFAE147AE147AE
%43 = fptoui double %42 to i64
store i64 %43, i64* %6
br label %44
44: ; preds = %36, %31
br label %45
45: ; preds = %44
%46 = load i8*, i8** %8
%47 = icmp eq i8* %46, null
br i1 %47, label %31, label %48
48: ; preds = %45
%49 = load i32, i32* @stderr
%50 = load i64, i64* %6
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 %50)
store i64 0, i64* %9
%52 = bitcast [3 x i8]* %10 to i8*
store i64 0, i64* %11
br label %53
53: ; preds = %132, %48
%54 = load i64, i64* %11
%55 = icmp ult i64 %54, 3
br i1 %55, label %56, label %135
56: ; preds = %53
%57 = load i32, i32* @stderr
%58 = load i64, i64* %11
%59 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 %58
%60 = load i8, i8* %59
%61 = zext i8 %60 to i32
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %61)
%63 = load i8*, i8** %8
%64 = load i64, i64* %11
%65 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = load i64, i64* %6
%68 = call i32 @memset(i8* %63, i8 zeroext %66, i64 %67)
%69 = call double (...) @timedouble()
store double %69, double* %12
store double 3.000000e+02, double* %13
store i64 1, i64* %14
br label %70
70: ; preds = %130, %56
%71 = call double (...) @timedouble()
%72 = load double, double* %12
%73 = fsub double %71, %72
%74 = load double, double* %13
%75 = fcmp olt double %73, %74
br i1 %75, label %76, label %131
76: ; preds = %70
%77 = load i32, i32* @stderr
%78 = load i64, i64* %14
%79 = add i64 %78, 1
store i64 %79, i64* %14
%80 = load i64, i64* %11
%81 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 %80
%82 = load i8, i8* %81
%83 = zext i8 %82 to i32
%84 = load double, double* %13
%85 = call double (...) @timedouble()
%86 = load double, double* %12
%87 = fsub double %85, %86
%88 = fsub double %84, %87
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), i64 %78, i32 %83, double %88)
%90 = load i64, i64* %9
%91 = icmp ne i64 %90, 0
br i1 %91, label %92, label %96
92: ; preds = %76
%93 = load i32, i32* @stderr
%94 = load i64, i64* %9
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %93, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i64 %94)
br label %96
96: ; preds = %92, %76
%97 = load i8*, i8** %8
store i8* %97, i8** %15
store i64 0, i64* %16
br label %98
98: ; preds = %127, %96
%99 = load i64, i64* %16
%100 = load i64, i64* %6
%101 = icmp ult i64 %99, %100
br i1 %101, label %102, label %130
102: ; preds = %98
%103 = load i8*, i8** %15
%104 = load i8, i8* %103
%105 = zext i8 %104 to i32
%106 = load i64, i64* %11
%107 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 %106
%108 = load i8, i8* %107
%109 = zext i8 %108 to i32
%110 = icmp ne i32 %105, %109
br i1 %110, label %111, label %124
111: ; preds = %102
%112 = load i32, i32* @stderr
%113 = load i64, i64* %16
%114 = load i8*, i8** %15
%115 = load i8, i8* %114
%116 = zext i8 %115 to i32
%117 = load i64, i64* %11
%118 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 %117
%119 = load i8, i8* %118
%120 = zext i8 %119 to i32
%121 = call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i64 %113, i32 %116, i32 %120)
%122 = load i64, i64* %9
%123 = add i64 %122, 1
store i64 %123, i64* %9
br label %124
124: ; preds = %111, %102
%125 = load i8*, i8** %15
%126 = getelementptr inbounds i8, i8* %125, i32 1
store i8* %126, i8** %15
br label %127
127: ; preds = %124
%128 = load i64, i64* %16
%129 = add i64 %128, 1
store i64 %129, i64* %16
br label %98
130: ; preds = %98
br label %70
131: ; preds = %70
br label %132
132: ; preds = %131
%133 = load i64, i64* %11
%134 = add i64 %133, 1
store i64 %134, i64* %11
br label %53
135: ; preds = %53
%136 = load i8*, i8** %8
%137 = call i32 @free(i8* %136)
%138 = load i64, i64* %9
%139 = icmp ne i64 %138, 0
br i1 %139, label %140, label %141
140: ; preds = %135
store i32 1, i32* %3
br label %142
141: ; preds = %135
store i32 0, i32* %3
br label %142
142: ; preds = %141, %140
%143 = load i32, i32* %3
ret i32 %143
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"*warning* turn off swap with swapoff -a\0A\00"
@.str.1 = [28 x i8] c"*info* ram to test %zd MiB\0A\00"
@.str.2 = [21 x i8] c"No ram in %zd chunk\0A\00"
@.str.3 = [28 x i8] c"*info* allocated %zd chunk\0A\00"
@__const.main.pattern = [3 x i8] c"\FF\00U"
@.str.4 = [31 x i8] c"*info* setting pattern to %2x\0A\00"
@.str.5 = [57 x i8] c"*info* pass %zd looking for non %2x (%.0lf secs remain)\0A\00"
@.str.6 = [30 x i8] c"**ERROR** memory errors: %zd\0A\00"
@.str.7 = [40 x i8] c"error at [%zd]: was %2x instead of %2x\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @freeRAM()
%4 = tail call i64 (...) @totalswap()
%5 = icmp eq i64 %4, 0
%6 = load i32, i32* @stderr
br i1 %5, label %10, label %7
7: ; preds = %2
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = lshr i64 %3, 20
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 %11)
%13 = tail call i8* @malloc(i64 %3)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %24
15: ; preds = %10, %15
%16 = phi i64 [ %21, %15 ], [ %3, %10 ]
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i64 %16)
%19 = uitofp i64 %16 to double
%20 = fmul double %19, 0x3FEFAE147AE147AE
%21 = fptoui double %20 to i64
%22 = tail call i8* @malloc(i64 %21)
%23 = icmp eq i8* %22, null
br i1 %23, label %15, label %24
24: ; preds = %15, %10
%25 = phi i64 [ %3, %10 ], [ %21, %15 ]
%26 = phi i8* [ %13, %10 ], [ %22, %15 ]
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 %25)
%29 = icmp eq i64 %25, 0
br label %34
30: ; preds = %82
%31 = tail call i32 @free(i8* %26)
%32 = icmp ne i64 %83, 0
%33 = zext i1 %32 to i32
ret i32 %33
34: ; preds = %24, %82
%35 = phi i64 [ 0, %24 ], [ %84, %82 ]
%36 = phi i64 [ 0, %24 ], [ %83, %82 ]
%37 = load i32, i32* @stderr
%38 = getelementptr inbounds [3 x i8], [3 x i8]* @__const.main.pattern, i64 0, i64 %35
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %40)
%42 = tail call i32 @memset(i8* %26, i8 zeroext %39, i64 %25)
%43 = tail call double (...) @timedouble()
%44 = tail call double (...) @timedouble()
%45 = fsub double %44, %43
%46 = fcmp olt double %45, 3.000000e+02
br i1 %46, label %52, label %82
47: ; preds = %77, %65
%48 = phi i64 [ %54, %65 ], [ %78, %77 ]
%49 = tail call double (...) @timedouble()
%50 = fsub double %49, %43
%51 = fcmp olt double %50, 3.000000e+02
br i1 %51, label %52, label %82
52: ; preds = %34, %47
%53 = phi i64 [ %56, %47 ], [ 1, %34 ]
%54 = phi i64 [ %48, %47 ], [ %36, %34 ]
%55 = load i32, i32* @stderr
%56 = add i64 %53, 1
%57 = tail call double (...) @timedouble()
%58 = fsub double %43, %57
%59 = fadd double %58, 3.000000e+02
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), i64 %53, i32 %40, double %59)
%61 = icmp eq i64 %54, 0
br i1 %61, label %65, label %62
62: ; preds = %52
%63 = load i32, i32* @stderr
%64 = tail call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i64 %54)
br label %65
65: ; preds = %62, %52
br i1 %29, label %47, label %66
66: ; preds = %65, %77
%67 = phi i64 [ %80, %77 ], [ 0, %65 ]
%68 = phi i8* [ %79, %77 ], [ %26, %65 ]
%69 = phi i64 [ %78, %77 ], [ %54, %65 ]
%70 = load i8, i8* %68
%71 = icmp eq i8 %70, %39
br i1 %71, label %77, label %72
72: ; preds = %66
%73 = zext i8 %70 to i32
%74 = load i32, i32* @stderr
%75 = tail call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i64 %67, i32 %73, i32 %40)
%76 = add i64 %69, 1
br label %77
77: ; preds = %72, %66
%78 = phi i64 [ %76, %72 ], [ %69, %66 ]
%79 = getelementptr inbounds i8, i8* %68, i64 1
%80 = add nuw i64 %67, 1
%81 = icmp eq i64 %80, %25
br i1 %81, label %47, label %66
82: ; preds = %47, %34
%83 = phi i64 [ %36, %34 ], [ %48, %47 ]
%84 = add nuw nsw i64 %35, 1
%85 = icmp eq i64 %84, 3
br i1 %85, label %30, label %34
}