#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  unsigned long rm_so;
};
typedef TYPE_1__ regmatch_t;
typedef int /*<<< orphan*/ regex_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ MS_SYNC;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ PROT_WRITE;
size_t alignedNumber(size_t, size_t);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int fscanf(int /*<<< orphan*/ *, char *, size_t *);
char *getSuffix(char *);
int getopt(int, char **, char const *);
int /*<<< orphan*/ help();
char *malloc(int const);
void *mmap(int /*<<< orphan*/, size_t, int /*<<< orphan*/, int /*<<< orphan*/,
           int, int /*<<< orphan*/);
int /*<<< orphan*/ msync(void *, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ munmap(int /*<<< orphan*/, size_t);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ perror(char *);
int regcomp(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int regexec(int /*<<< orphan*/ *, char *, int, TYPE_1__ *, int /*<<< orphan*/);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strdup(int /*<<< orphan*/);
int /*<<< orphan*/ strncpy(char *, char *, int const);
int main(int argc, char *argv[]) {
  char *suffix = NULL, *dev = NULL;
  int opt = 0, command = 0, verbose = 0;
  const char *getoptstring = "4kaf:v";
  while ((opt = getopt(argc, argv, getoptstring)) != -1) {
    switch (opt) {
    case 'f':
      dev = strdup(optarg);
      suffix = getSuffix(dev);
      fprintf(stdout, "*info* device = '%s'\n", dev);
      break;
    case '4':
      command = 4;
      break;
    case 'a':
      command = 1;
      break;
    case 'v':
      verbose++;
      break;
    default:
      break;
    }
  }
  if (suffix == NULL || (command == 0)) {
    help();
    exit(1);
  }
  size_t sz = 0;
  char sys[1000];
  char *path = "/sys/class/dax/";
  fprintf(stdout, "*info* opening ... %s%s\n", path, suffix);
  sprintf(sys, "%s%s/device/align", path, suffix);
  FILE *fp = fopen(sys, "rt");
  if (!fp) {
    fprintf(stdout, "*error* not a dax?\n");
    exit(1);
  }
  size_t align = 0;
  int ret = fscanf(fp, "%lu", &align);
  fclose(fp);
  fprintf(stdout, "*info* align %zd\n", align);
  sprintf(sys, "%s%s/size", path, suffix);
  free(suffix);
  fp = fopen(sys, "rt");
  if (!fp) {
    fprintf(stdout, "*error* not a dax?\n");
    exit(1);
  }
  size_t maxsz = 0;
  ret = fscanf(fp, "%lu", &maxsz);
  fclose(fp);
  fprintf(stdout, "*info* max size %zd\n", maxsz);
  maxsz = alignedNumber(maxsz, align);
  if (ret != 1)
    maxsz = 0;
  if (sz > maxsz) {
    sz = maxsz;
  }
  if (sz == 0) {
    sz = maxsz;
  }
  fprintf(stdout,
          "*info* logical size of device %zd (%.1lf GiB), aligned to %zd\n",
          maxsz, ((maxsz) / 1024.0 / 1024 / 1024), align);
  fprintf(
      stdout,
      "*info* opening '%s', wrecking %zd bytes (%.1lf GiB), in 4096 steps\n",
      dev, sz, ((sz) / 1024.0 / 1024 / 1024));
  int fd = open(dev, O_RDWR);
  if (fd < 0) {
    perror(dev);
    return 1;
  }
  void *src = mmap(0, sz, PROT_WRITE, MAP_SHARED, fd, 0);
  if (!src) {
    fprintf(stdout, "*error* mmap failed\n");
    exit(1);
  }
  unsigned char *s = (unsigned char *)src;
  if (command == 4) {
    size_t changes = 0;
    for (unsigned long i = 0; i < sz; i += 4096) {
      if (verbose)
        fprintf(stderr, "[0x%lx] %d -> %d\n", i, s[i], 255 ^ s[i]);
      s[i] = 255 ^ s[i];
      changes++;
    }
    fprintf(stdout, "*info* commandType '%d': applied %zd changes\n", command,
            changes);
  } else if (command == 1) {
    size_t changes = 0;
    const int len = 8;
    char *mstring = malloc(len + 1);
    for (unsigned long i = 0; i < sz; i += 4096) {
      regex_t regex;
      regmatch_t match;
      int reti;
      reti = regcomp(&regex, "[A-z][A-z][A-z][A-z][A-z][A-z][A-z][A-z]", 0);
      if (reti) {
        fprintf(stderr, "Could not compile regex\n");
        exit(1);
      }
      char buf[4097];
      strncpy(buf, (char *)(s + i), 4096);
      buf[4096] = 0;
      reti = regexec(&regex, buf, 1, &match, 0);
      if (!reti) {
        unsigned long pos = i + match.rm_so;
        strncpy(mstring, (char *)(s + pos), len);
        mstring[len] = 0;
        if (verbose)
          fprintf(stderr, "[0x%lx] changing '%s'\n", i, mstring);
        for (int z = 0; z < len; z++) {
          char t = s[pos + z] + 1;
          s[pos + z] = t;
        }
      }
      changes++;
      regfree(&regex);
    }
    fprintf(stdout, "*info* commandType '%d': applied %zd changes\n", command,
            changes);
  }
  msync(src, sz, MS_SYNC);
  munmap(0, sz);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1500,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xd7b(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1140 <getopt@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     1397 <main+0x127>
mov    -0x24(%rbp),%eax
mov    %eax,-0x14d4(%rbp)
sub    $0x34,%eax
je     1367 <main+0xf7>
jmp    12ec <main+0x7c>
mov    -0x14d4(%rbp),%eax
sub    $0x61,%eax
je     1373 <main+0x103>
jmp    1300 <main+0x90>
mov    -0x14d4(%rbp),%eax
sub    $0x66,%eax
je     1328 <main+0xb8>
jmp    1314 <main+0xa4>
mov    -0x14d4(%rbp),%eax
sub    $0x76,%eax
je     137f <main+0x10f>
jmp    138d <main+0x11d>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
call   1190 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1180 <getSuffix@plt>
mov    %rax,-0x18(%rbp)
mov    0x2c62(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xcdc(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1392 <main+0x122>
movl   $0x4,-0x28(%rbp)
jmp    1392 <main+0x122>
movl   $0x1,-0x28(%rbp)
jmp    1392 <main+0x122>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1392 <main+0x122>
jmp    1392 <main+0x122>
jmp    12b9 <main+0x49>
cmpq   $0x0,-0x18(%rbp)
je     13ac <main+0x13c>
cmpl   $0x0,-0x28(%rbp)
jne    13bd <main+0x14d>
mov    $0x0,%al
call   1150 <help@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
movq   $0x0,-0x40(%rbp)
lea    0xc81(%rip),%rax
mov    %rax,-0x438(%rbp)
mov    0x2bd6(%rip),%rax
mov    (%rax),%edi
mov    -0x438(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xc6f(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
lea    -0x430(%rbp),%rdi
mov    -0x438(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xc68(%rip),%rsi
call   1160 <sprintf@plt>
lea    -0x430(%rbp),%rdi
lea    0xc67(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x440(%rbp)
cmpq   $0x0,-0x440(%rbp)
jne    145c <main+0x1ec>
mov    0x2b6e(%rip),%rax
mov    (%rax),%edi
lea    0xc40(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
movq   $0x0,-0x448(%rbp)
mov    -0x440(%rbp),%rdi
lea    0xc2a(%rip),%rsi
lea    -0x448(%rbp),%rdx
call   1090 <fscanf@plt>
mov    %eax,-0x44c(%rbp)
mov    -0x440(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2b16(%rip),%rax
mov    (%rax),%edi
mov    -0x448(%rbp),%rdx
lea    0xbf9(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
lea    -0x430(%rbp),%rdi
mov    -0x438(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xbeb(%rip),%rsi
call   1160 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
lea    -0x430(%rbp),%rdi
lea    0xba2(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x440(%rbp)
cmpq   $0x0,-0x440(%rbp)
jne    1521 <main+0x2b1>
mov    0x2aa9(%rip),%rax
mov    (%rax),%edi
lea    0xb7b(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
movq   $0x0,-0x458(%rbp)
mov    -0x440(%rbp),%rdi
lea    0xb65(%rip),%rsi
lea    -0x458(%rbp),%rdx
call   1090 <fscanf@plt>
mov    %eax,-0x44c(%rbp)
mov    -0x440(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2a51(%rip),%rax
mov    (%rax),%edi
mov    -0x458(%rbp),%rdx
lea    0xb50(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x458(%rbp),%rdi
mov    -0x448(%rbp),%rsi
call   10a0 <alignedNumber@plt>
mov    %rax,-0x458(%rbp)
cmpl   $0x1,-0x44c(%rbp)
je     15a8 <main+0x338>
movq   $0x0,-0x458(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x458(%rbp),%rax
jbe    15c4 <main+0x354>
mov    -0x458(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    15da <main+0x36a>
mov    -0x458(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x29cf(%rip),%rax
mov    %rax,-0x14e0(%rbp)
mov    (%rax),%edi
mov    -0x458(%rbp),%rdx
movq   %rdx,%xmm0
movaps 0xa13(%rip),%xmm1
movaps %xmm1,-0x1500(%rbp)
punpckldq %xmm1,%xmm0
movapd 0xa10(%rip),%xmm1
movaps %xmm1,-0x14f0(%rbp)
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x9d2(%rip),%xmm1
divsd  %xmm1,%xmm0
divsd  %xmm1,%xmm0
divsd  %xmm1,%xmm0
mov    -0x448(%rbp),%rcx
lea    0xa8c(%rip),%rsi
mov    $0x1,%al
call   10d0 <fprintf@plt>
movaps -0x1500(%rbp),%xmm2
movaps -0x14f0(%rbp),%xmm1
mov    -0x14e0(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x40(%rbp),%rcx
movq   %rcx,%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x972(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0x966(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0x95a(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xa62(%rip),%rsi
mov    $0x1,%al
call   10d0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    0x2915(%rip),%rax
mov    (%rax),%esi
call   1110 <open@plt>
mov    %eax,-0x45c(%rbp)
cmpl   $0x0,-0x45c(%rbp)
jge    16f2 <main+0x482>
mov    -0x20(%rbp),%rdi
call   1130 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1ac5 <main+0x855>
mov    -0x40(%rbp),%rsi
mov    0x28bb(%rip),%rax
mov    (%rax),%edx
mov    0x28e2(%rip),%rax
mov    (%rax),%ecx
mov    -0x45c(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%edi
call   1080 <mmap@plt>
mov    %rax,-0x468(%rbp)
cmpq   $0x0,-0x468(%rbp)
jne    1750 <main+0x4e0>
mov    0x287a(%rip),%rax
mov    (%rax),%edi
lea    0xa18(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x468(%rbp),%rax
mov    %rax,-0x470(%rbp)
cmpl   $0x4,-0x28(%rbp)
jne    185e <main+0x5ee>
movq   $0x0,-0x478(%rbp)
movq   $0x0,-0x480(%rbp)
mov    -0x480(%rbp),%rax
cmp    -0x40(%rbp),%rax
jae    1838 <main+0x5c8>
cmpl   $0x0,-0x2c(%rbp)
je     17e3 <main+0x573>
mov    0x2828(%rip),%rax
mov    (%rax),%edi
mov    -0x480(%rbp),%rdx
mov    -0x470(%rbp),%rax
mov    -0x480(%rbp),%rcx
movzbl (%rax,%rcx,1),%ecx
mov    -0x470(%rbp),%rax
mov    -0x480(%rbp),%rsi
movzbl (%rax,%rsi,1),%r8d
xor    $0xff,%r8d
lea    0x990(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x470(%rbp),%rax
mov    -0x480(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
xor    $0xff,%eax
mov    %al,%dl
mov    -0x470(%rbp),%rax
mov    -0x480(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x478(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x478(%rbp)
mov    -0x480(%rbp),%rax
add    $0x1000,%rax
mov    %rax,-0x480(%rbp)
jmp    177e <main+0x50e>
mov    0x2771(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
mov    -0x478(%rbp),%rcx
lea    0x92c(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1a8f <main+0x81f>
cmpl   $0x1,-0x28(%rbp)
jne    1a8a <main+0x81a>
movq   $0x0,-0x488(%rbp)
movl   $0x8,-0x48c(%rbp)
mov    $0x9,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x498(%rbp)
movq   $0x0,-0x4a0(%rbp)
mov    -0x4a0(%rbp),%rax
cmp    -0x40(%rbp),%rax
jae    1a69 <main+0x7f9>
lea    -0x4a4(%rbp),%rdi
lea    0x8f4(%rip),%rsi
xor    %edx,%edx
call   10c0 <regcomp@plt>
mov    %eax,-0x4b4(%rbp)
cmpl   $0x0,-0x4b4(%rbp)
je     18f3 <main+0x683>
mov    0x26ef(%rip),%rax
mov    (%rax),%edi
lea    0x8f3(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
lea    -0x14c0(%rbp),%rdi
mov    -0x470(%rbp),%rsi
add    -0x4a0(%rbp),%rsi
mov    $0x1000,%edx
call   1040 <strncpy@plt>
movb   $0x0,-0x4c0(%rbp)
lea    -0x14c0(%rbp),%rsi
lea    -0x4a4(%rbp),%rdi
mov    $0x1,%edx
lea    -0x4b0(%rbp),%rcx
xor    %r8d,%r8d
call   10f0 <regexec@plt>
mov    %eax,-0x4b4(%rbp)
cmpl   $0x0,-0x4b4(%rbp)
jne    1a32 <main+0x7c2>
mov    -0x4a0(%rbp),%rax
add    -0x4b0(%rbp),%rax
mov    %rax,-0x14c8(%rbp)
mov    -0x498(%rbp),%rdi
mov    -0x470(%rbp),%rsi
add    -0x14c8(%rbp),%rsi
mov    $0x8,%edx
call   1040 <strncpy@plt>
mov    -0x498(%rbp),%rax
movb   $0x0,0x8(%rax)
cmpl   $0x0,-0x2c(%rbp)
je     19bc <main+0x74c>
mov    0x262a(%rip),%rax
mov    (%rax),%edi
mov    -0x4a0(%rbp),%rdx
mov    -0x498(%rbp),%rcx
lea    0x839(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x0,-0x14cc(%rbp)
cmpl   $0x8,-0x14cc(%rbp)
jge    1a2d <main+0x7bd>
mov    -0x470(%rbp),%rax
mov    -0x14c8(%rbp),%rcx
movslq -0x14cc(%rbp),%rdx
add    %rdx,%rcx
movzbl (%rax,%rcx,1),%eax
add    $0x1,%eax
mov    %al,-0x14cd(%rbp)
mov    -0x14cd(%rbp),%dl
mov    -0x470(%rbp),%rax
mov    -0x14c8(%rbp),%rcx
movslq -0x14cc(%rbp),%rsi
add    %rsi,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14cc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14cc(%rbp)
jmp    19c6 <main+0x756>
jmp    1a32 <main+0x7c2>
mov    -0x488(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x488(%rbp)
lea    -0x4a4(%rbp),%rdi
call   1070 <regfree@plt>
mov    -0x4a0(%rbp),%rax
add    $0x1000,%rax
mov    %rax,-0x4a0(%rbp)
jmp    1899 <main+0x629>
mov    0x2540(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
mov    -0x488(%rbp),%rcx
lea    0x6fb(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1a8f <main+0x81f>
mov    -0x468(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    0x251f(%rip),%rax
mov    (%rax),%edx
call   1060 <msync@plt>
mov    -0x40(%rbp),%rsi
xor    %edi,%edi
call   1100 <munmap@plt>
mov    -0x45c(%rbp),%edi
call   10b0 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1500,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1448,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
lea    0xd9b(%rip),%r12
lea    0xd9b(%rip),%r13
movl   $0x0,0xc(%rsp)
movl   $0x0,(%rsp)
xor    %r14d,%r14d
xor    %r15d,%r15d
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1140 <getopt@plt>
cmp    $0x60,%eax
jle    1310 <main+0xa0>
cmp    $0x61,%eax
je     1323 <main+0xb3>
cmp    $0x76,%eax
je     132c <main+0xbc>
cmp    $0x66,%eax
jne    12b0 <main+0x40>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
call   1190 <strdup@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1180 <getSuffix@plt>
mov    %rax,%r15
mov    0x2cbc(%rip),%rax
mov    (%rax),%edi
mov    %r13,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    12b0 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0xffffffff,%eax
je     1336 <main+0xc6>
cmp    $0x34,%eax
jne    12b0 <main+0x40>
movl   $0x4,(%rsp)
jmp    12b0 <main+0x40>
movl   $0x1,(%rsp)
jmp    12b0 <main+0x40>
addl   $0x1,0xc(%rsp)
jmp    12b0 <main+0x40>
test   %r15,%r15
je     17b8 <main+0x548>
cmpl   $0x0,(%rsp)
je     17b8 <main+0x548>
mov    0x2c60(%rip),%r13
mov    0x0(%r13),%edi
lea    0xcfa(%rip),%rsi
lea    0xce3(%rip),%rbx
mov    %rbx,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   10d0 <fprintf@plt>
lea    0xcf8(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1160 <sprintf@plt>
lea    0xcf0(%rip),%rsi
mov    %rbp,%rdi
call   1120 <fopen@plt>
test   %rax,%rax
je     17ab <main+0x53b>
mov    %rax,%rbx
movq   $0x0,0x18(%rsp)
lea    0xce3(%rip),%rsi
lea    0x18(%rsp),%rdx
mov    %rax,%rdi
call   1090 <fscanf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x0(%r13),%edi
mov    0x18(%rsp),%rdx
lea    0xcc2(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
lea    0xcc6(%rip),%rsi
lea    0xc57(%rip),%rdx
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rcx
call   1160 <sprintf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xc73(%rip),%rsi
mov    %rbx,%rdi
call   1120 <fopen@plt>
test   %rax,%rax
je     17ab <main+0x53b>
mov    %rax,%rbx
movq   $0x0,0x10(%rsp)
lea    0xc66(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rax,%rdi
call   1090 <fscanf@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x0(%r13),%edi
mov    0x10(%rsp),%rdx
lea    0xc5f(%rip),%rsi
xor    %r12d,%r12d
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rsi
call   10a0 <alignedNumber@plt>
cmp    $0x1,%ebp
cmove  %rax,%r12
mov    %r12,0x10(%rsp)
movq   %r12,%xmm0
punpckldq 0xb76(%rip),%xmm0
subpd  0xb7e(%rip),%xmm0
mov    0x0(%r13),%edi
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xb76(%rip),%xmm0
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movapd %xmm1,0x20(%rsp)
mov    0x18(%rsp),%rcx
lea    0xc00(%rip),%rsi
mov    %r12,%rdx
mov    $0x1,%al
call   10d0 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xc2a(%rip),%rsi
mov    %r14,%rdx
mov    %r12,%rcx
movaps 0x20(%rsp),%xmm0
mov    $0x1,%al
call   10d0 <fprintf@plt>
mov    0x2ade(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1110 <open@plt>
test   %eax,%eax
js     178a <main+0x51a>
mov    %eax,%ebp
mov    0x2aa3(%rip),%rax
mov    (%rax),%edx
mov    0x2aca(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r12,%rsi
mov    %ebp,%r8d
xor    %r9d,%r9d
call   1080 <mmap@plt>
test   %rax,%rax
je     17c9 <main+0x559>
mov    %rax,%r13
mov    (%rsp),%eax
cmp    $0x1,%eax
je     15b2 <main+0x342>
cmp    $0x4,%eax
jne    174f <main+0x4df>
mov    %ebp,0x8(%rsp)
test   %r12,%r12
je     16fc <main+0x48c>
mov    0x2a67(%rip),%r15
lea    0xbfc(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1589 <main+0x319>
xchg   %ax,%ax
notb   0x0(%r13,%rbp,1)
add    $0x1,%rbx
add    $0x1000,%rbp
cmp    %r12,%rbp
jae    16fe <main+0x48e>
cmpl   $0x0,0xc(%rsp)
je     1570 <main+0x300>
mov    (%r15),%edi
movzbl 0x0(%r13,%rbp,1),%ecx
mov    %ecx,%r8d
xor    $0xff,%r8d
mov    %r14,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1570 <main+0x300>
mov    %r13,(%rsp)
mov    %ebp,0x8(%rsp)
mov    $0x9,%edi
call   10e0 <malloc@plt>
mov    %r12,%r13
test   %r12,%r12
je     1723 <main+0x4b3>
mov    %rax,0x20(%rsp)
lea    0xbc8(%rip),%rbp
lea    0x4c(%rsp),%r12
xor    %r14d,%r14d
xor    %ebx,%ebx
mov    %r13,0x38(%rsp)
jmp    164b <main+0x3db>
nopl   (%rax)
addb   $0x1,0x0(%rbp,%r14,1)
addb   $0x1,0x1(%r14,%rbp,1)
addb   $0x1,0x2(%r14,%rbp,1)
addb   $0x1,0x3(%r14,%rbp,1)
addb   $0x1,0x4(%r14,%rbp,1)
addb   $0x1,0x5(%r14,%rbp,1)
addb   $0x1,0x6(%r14,%rbp,1)
addb   $0x1,0x7(%r14,%rbp,1)
mov    0x38(%rsp),%r13
lea    0xb78(%rip),%rbp
mov    %r15,%r12
add    $0x1,%rbx
mov    %r12,%rdi
call   1070 <regfree@plt>
add    $0x1000,%r14
cmp    %r13,%r14
jae    1725 <main+0x4b5>
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %edx,%edx
call   10c0 <regcomp@plt>
test   %eax,%eax
jne    1799 <main+0x529>
mov    (%rsp),%rax
lea    (%rax,%r14,1),%rsi
lea    0x440(%rsp),%r15
mov    %r15,%rdi
mov    $0x1000,%edx
call   1040 <strncpy@plt>
movb   $0x0,0x1440(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
lea    0x40(%rsp),%rcx
xor    %r8d,%r8d
call   10f0 <regexec@plt>
test   %eax,%eax
jne    162f <main+0x3bf>
mov    %r12,%r15
mov    0x40(%rsp),%rsi
mov    (%rsp),%rax
lea    (%rax,%rsi,1),%rbp
add    %r14,%rsi
add    %rax,%rsi
mov    0x20(%rsp),%r12
mov    %r12,%rdi
mov    $0x8,%edx
call   1040 <strncpy@plt>
movb   $0x0,0x8(%r12)
cmpl   $0x0,0xc(%rsp)
je     15f0 <main+0x380>
mov    0x28e7(%rip),%rax
mov    (%rax),%edi
lea    0xafc(%rip),%rsi
mov    %r14,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    15f0 <main+0x380>
xor    %ebx,%ebx
mov    0x28ab(%rip),%rax
mov    (%rax),%edi
lea    0xa68(%rip),%rsi
mov    $0x4,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0x8(%rsp),%ebp
jmp    174f <main+0x4df>
xor    %ebx,%ebx
mov    0x2884(%rip),%rax
mov    (%rax),%edi
lea    0xa41(%rip),%rsi
mov    $0x1,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0x8(%rsp),%ebp
mov    %r13,%r12
mov    (%rsp),%r13
mov    0x286a(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    %r12,%rsi
call   1060 <msync@plt>
xor    %ebx,%ebx
xor    %edi,%edi
mov    %r12,%rsi
call   1100 <munmap@plt>
mov    %ebp,%edi
call   10b0 <close@plt>
mov    %ebx,%eax
add    $0x1448,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rdi
call   1130 <perror@plt>
mov    $0x1,%ebx
jmp    1776 <main+0x506>
mov    0x2828(%rip),%rax
mov    (%rax),%edi
lea    0xa24(%rip),%rsi
jmp    17d9 <main+0x569>
mov    0x0(%r13),%edi
lea    0x8cd(%rip),%rsi
jmp    17d9 <main+0x569>
xor    %eax,%eax
call   1150 <help@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    0x27e0(%rip),%rax
mov    (%rax),%edi
lea    0x976(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
@.str = [7 x i8] c"4kaf:v\00"
@optarg = global i32 0
@stdout = global i32 0
@.str.1 = [22 x i8] c"*info* device = '%s'\0A\00"
@.str.2 = [16 x i8] c"/sys/class/dax/\00"
@.str.3 = [25 x i8] c"*info* opening ... %s%s\0A\00"
@.str.4 = [18 x i8] c"%s%s/device/align\00"
@.str.5 = [3 x i8] c"rt\00"
@.str.6 = [20 x i8] c"*error* not a dax?\0A\00"
@.str.7 = [4 x i8] c"%lu\00"
@.str.8 = [18 x i8] c"*info* align %zd\0A\00"
@.str.9 = [10 x i8] c"%s%s/size\00"
@.str.10 = [21 x i8] c"*info* max size %zd\0A\00"
@.str.11 = [63 x i8] c"*info* logical size of device %zd (%.1lf GiB), aligned to %zd\0A\00"
@.str.12 = [68 x i8] c"*info* opening '%s', wrecking %zd bytes (%.1lf GiB), in 4096 steps\0A\00"
@O_RDWR = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.13 = [21 x i8] c"*error* mmap failed\0A\00"
@stderr = global i32 0
@.str.14 = [18 x i8] c"[0x%lx] %d -> %d\0A\00"
@.str.15 = [46 x i8] c"*info* commandType '%d': applied %zd changes\0A\00"
@.str.16 = [41 x i8] c"[A-z][A-z][A-z][A-z][A-z][A-z][A-z][A-z]\00"
@.str.17 = [25 x i8] c"Could not compile regex\0A\00"
@.str.18 = [23 x i8] c"[0x%lx] changing '%s'\0A\00"
@MS_SYNC = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca [1000 x i8]
%14 = alloca i8*
%15 = alloca i32*
%16 = alloca i64
%17 = alloca i32
%18 = alloca i64
%19 = alloca i32
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca i64
%23 = alloca i64
%24 = alloca i64
%25 = alloca i32
%26 = alloca i8*
%27 = alloca i64
%28 = alloca i32
%29 = alloca %struct.TYPE_3__
%30 = alloca i32
%31 = alloca [4097 x i8]
%32 = alloca i64
%33 = alloca i32
%34 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %11
br label %35
35: ; preds = %57, %2
%36 = load i32, i32* %4
%37 = load i8**, i8*** %5
%38 = load i8*, i8** %11
%39 = call i32 @getopt(i32 %36, i8** %37, i8* %38)
store i32 %39, i32* %8
%40 = icmp ne i32 %39, -1
br i1 %40, label %41, label %58
41: ; preds = %35
%42 = load i32, i32* %8
switch i32 %42, label %56 [
i32 102, label %43
i32 52, label %51
i32 97, label %52
i32 118, label %53
]
43: ; preds = %41
%44 = load i32, i32* @optarg
%45 = call i8* @strdup(i32 %44)
store i8* %45, i8** %7
%46 = load i8*, i8** %7
%47 = call i8* @getSuffix(i8* %46)
store i8* %47, i8** %6
%48 = load i32, i32* @stdout
%49 = load i8*, i8** %7
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %49)
br label %57
51: ; preds = %41
store i32 4, i32* %9
br label %57
52: ; preds = %41
store i32 1, i32* %9
br label %57
53: ; preds = %41
%54 = load i32, i32* %10
%55 = add nsw i32 %54, 1
store i32 %55, i32* %10
br label %57
56: ; preds = %41
br label %57
57: ; preds = %56, %53, %52, %51, %43
br label %35
58: ; preds = %35
%59 = load i8*, i8** %6
%60 = icmp eq i8* %59, null
br i1 %60, label %64, label %61
61: ; preds = %58
%62 = load i32, i32* %9
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %61, %58
%65 = call i32 (...) @help()
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %61
store i64 0, i64* %12
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8** %14
%68 = load i32, i32* @stdout
%69 = load i8*, i8** %14
%70 = load i8*, i8** %6
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %69, i8* %70)
%72 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%73 = load i8*, i8** %14
%74 = load i8*, i8** %6
%75 = call i32 @sprintf(i8* %72, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %73, i8* %74)
%76 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%77 = call i32* @fopen(i8* %76, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %77, i32** %15
%78 = load i32*, i32** %15
%79 = icmp ne i32* %78, null
br i1 %79, label %84, label %80
80: ; preds = %67
%81 = load i32, i32* @stdout
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %67
store i64 0, i64* %16
%85 = load i32*, i32** %15
%86 = call i32 @fscanf(i32* %85, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64* %16)
store i32 %86, i32* %17
%87 = load i32*, i32** %15
%88 = call i32 @fclose(i32* %87)
%89 = load i32, i32* @stdout
%90 = load i64, i64* %16
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i64 %90)
%92 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%93 = load i8*, i8** %14
%94 = load i8*, i8** %6
%95 = call i32 @sprintf(i8* %92, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %93, i8* %94)
%96 = load i8*, i8** %6
%97 = call i32 @free(i8* %96)
%98 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%99 = call i32* @fopen(i8* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %99, i32** %15
%100 = load i32*, i32** %15
%101 = icmp ne i32* %100, null
br i1 %101, label %106, label %102
102: ; preds = %84
%103 = load i32, i32* @stdout
%104 = call i32 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%105 = call i32 @exit(i32 1)
unreachable
106: ; preds = %84
store i64 0, i64* %18
%107 = load i32*, i32** %15
%108 = call i32 @fscanf(i32* %107, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64* %18)
store i32 %108, i32* %17
%109 = load i32*, i32** %15
%110 = call i32 @fclose(i32* %109)
%111 = load i32, i32* @stdout
%112 = load i64, i64* %18
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %111, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i64 %112)
%114 = load i64, i64* %18
%115 = load i64, i64* %16
%116 = call i64 @alignedNumber(i64 %114, i64 %115)
store i64 %116, i64* %18
%117 = load i32, i32* %17
%118 = icmp ne i32 %117, 1
br i1 %118, label %119, label %120
119: ; preds = %106
store i64 0, i64* %18
br label %120
120: ; preds = %119, %106
%121 = load i64, i64* %12
%122 = load i64, i64* %18
%123 = icmp ugt i64 %121, %122
br i1 %123, label %124, label %126
124: ; preds = %120
%125 = load i64, i64* %18
store i64 %125, i64* %12
br label %126
126: ; preds = %124, %120
%127 = load i64, i64* %12
%128 = icmp eq i64 %127, 0
br i1 %128, label %129, label %131
129: ; preds = %126
%130 = load i64, i64* %18
store i64 %130, i64* %12
br label %131
131: ; preds = %129, %126
%132 = load i32, i32* @stdout
%133 = load i64, i64* %18
%134 = load i64, i64* %18
%135 = uitofp i64 %134 to double
%136 = fdiv double %135, 1.024000e+03
%137 = fdiv double %136, 1.024000e+03
%138 = fdiv double %137, 1.024000e+03
%139 = load i64, i64* %16
%140 = call i32 (i32, i8*, ...) @fprintf(i32 %132, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.11, i64 0, i64 0), i64 %133, double %138, i64 %139)
%141 = load i32, i32* @stdout
%142 = load i8*, i8** %7
%143 = load i64, i64* %12
%144 = load i64, i64* %12
%145 = uitofp i64 %144 to double
%146 = fdiv double %145, 1.024000e+03
%147 = fdiv double %146, 1.024000e+03
%148 = fdiv double %147, 1.024000e+03
%149 = call i32 (i32, i8*, ...) @fprintf(i32 %141, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.12, i64 0, i64 0), i8* %142, i64 %143, double %148)
%150 = load i8*, i8** %7
%151 = load i32, i32* @O_RDWR
%152 = call i32 @open(i8* %150, i32 %151)
store i32 %152, i32* %19
%153 = load i32, i32* %19
%154 = icmp slt i32 %153, 0
br i1 %154, label %155, label %158
155: ; preds = %131
%156 = load i8*, i8** %7
%157 = call i32 @perror(i8* %156)
store i32 1, i32* %3
br label %313
158: ; preds = %131
%159 = load i64, i64* %12
%160 = load i32, i32* @PROT_WRITE
%161 = load i32, i32* @MAP_SHARED
%162 = load i32, i32* %19
%163 = call i8* @mmap(i32 0, i64 %159, i32 %160, i32 %161, i32 %162, i32 0)
store i8* %163, i8** %20
%164 = load i8*, i8** %20
%165 = icmp ne i8* %164, null
br i1 %165, label %170, label %166
166: ; preds = %158
%167 = load i32, i32* @stdout
%168 = call i32 (i32, i8*, ...) @fprintf(i32 %167, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
%169 = call i32 @exit(i32 1)
unreachable
170: ; preds = %158
%171 = load i8*, i8** %20
store i8* %171, i8** %21
%172 = load i32, i32* %9
%173 = icmp eq i32 %172, 4
br i1 %173, label %174, label %218
174: ; preds = %170
store i64 0, i64* %22
store i64 0, i64* %23
br label %175
175: ; preds = %210, %174
%176 = load i64, i64* %23
%177 = load i64, i64* %12
%178 = icmp ult i64 %176, %177
br i1 %178, label %179, label %213
179: ; preds = %175
%180 = load i32, i32* %10
%181 = icmp ne i32 %180, 0
br i1 %181, label %182, label %197
182: ; preds = %179
%183 = load i32, i32* @stderr
%184 = load i64, i64* %23
%185 = load i8*, i8** %21
%186 = load i64, i64* %23
%187 = getelementptr inbounds i8, i8* %185, i64 %186
%188 = load i8, i8* %187
%189 = zext i8 %188 to i32
%190 = load i8*, i8** %21
%191 = load i64, i64* %23
%192 = getelementptr inbounds i8, i8* %190, i64 %191
%193 = load i8, i8* %192
%194 = zext i8 %193 to i32
%195 = xor i32 255, %194
%196 = call i32 (i32, i8*, ...) @fprintf(i32 %183, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i64 %184, i32 %189, i32 %195)
br label %197
197: ; preds = %182, %179
%198 = load i8*, i8** %21
%199 = load i64, i64* %23
%200 = getelementptr inbounds i8, i8* %198, i64 %199
%201 = load i8, i8* %200
%202 = zext i8 %201 to i32
%203 = xor i32 255, %202
%204 = trunc i32 %203 to i8
%205 = load i8*, i8** %21
%206 = load i64, i64* %23
%207 = getelementptr inbounds i8, i8* %205, i64 %206
store i8 %204, i8* %207
%208 = load i64, i64* %22
%209 = add i64 %208, 1
store i64 %209, i64* %22
br label %210
210: ; preds = %197
%211 = load i64, i64* %23
%212 = add i64 %211, 4096
store i64 %212, i64* %23
br label %175
213: ; preds = %175
%214 = load i32, i32* @stdout
%215 = load i32, i32* %9
%216 = load i64, i64* %22
%217 = call i32 (i32, i8*, ...) @fprintf(i32 %214, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.15, i64 0, i64 0), i32 %215, i64 %216)
br label %304
218: ; preds = %170
%219 = load i32, i32* %9
%220 = icmp eq i32 %219, 1
br i1 %220, label %221, label %303
221: ; preds = %218
store i64 0, i64* %24
store i32 8, i32* %25
%222 = call i8* @malloc(i32 9)
store i8* %222, i8** %26
store i64 0, i64* %27
br label %223
223: ; preds = %295, %221
%224 = load i64, i64* %27
%225 = load i64, i64* %12
%226 = icmp ult i64 %224, %225
br i1 %226, label %227, label %298
227: ; preds = %223
%228 = call i32 @regcomp(i32* %28, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.16, i64 0, i64 0), i32 0)
store i32 %228, i32* %30
%229 = load i32, i32* %30
%230 = icmp ne i32 %229, 0
br i1 %230, label %231, label %235
231: ; preds = %227
%232 = load i32, i32* @stderr
%233 = call i32 (i32, i8*, ...) @fprintf(i32 %232, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0))
%234 = call i32 @exit(i32 1)
unreachable
235: ; preds = %227
%236 = getelementptr inbounds [4097 x i8], [4097 x i8]* %31, i64 0, i64 0
%237 = load i8*, i8** %21
%238 = load i64, i64* %27
%239 = getelementptr inbounds i8, i8* %237, i64 %238
%240 = call i32 @strncpy(i8* %236, i8* %239, i32 4096)
%241 = getelementptr inbounds [4097 x i8], [4097 x i8]* %31, i64 0, i64 4096
store i8 0, i8* %241
%242 = getelementptr inbounds [4097 x i8], [4097 x i8]* %31, i64 0, i64 0
%243 = call i32 @regexec(i32* %28, i8* %242, i32 1, %struct.TYPE_3__* %29, i32 0)
store i32 %243, i32* %30
%244 = load i32, i32* %30
%245 = icmp ne i32 %244, 0
br i1 %245, label %291, label %246
246: ; preds = %235
%247 = load i64, i64* %27
%248 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %29, i32 0, i32 0
%249 = load i64, i64* %248
%250 = add i64 %247, %249
store i64 %250, i64* %32
%251 = load i8*, i8** %26
%252 = load i8*, i8** %21
%253 = load i64, i64* %32
%254 = getelementptr inbounds i8, i8* %252, i64 %253
%255 = call i32 @strncpy(i8* %251, i8* %254, i32 8)
%256 = load i8*, i8** %26
%257 = getelementptr inbounds i8, i8* %256, i64 8
store i8 0, i8* %257
%258 = load i32, i32* %10
%259 = icmp ne i32 %258, 0
br i1 %259, label %260, label %265
260: ; preds = %246
%261 = load i32, i32* @stderr
%262 = load i64, i64* %27
%263 = load i8*, i8** %26
%264 = call i32 (i32, i8*, ...) @fprintf(i32 %261, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i64 %262, i8* %263)
br label %265
265: ; preds = %260, %246
store i32 0, i32* %33
br label %266
266: ; preds = %287, %265
%267 = load i32, i32* %33
%268 = icmp slt i32 %267, 8
br i1 %268, label %269, label %290
269: ; preds = %266
%270 = load i8*, i8** %21
%271 = load i64, i64* %32
%272 = load i32, i32* %33
%273 = sext i32 %272 to i64
%274 = add i64 %271, %273
%275 = getelementptr inbounds i8, i8* %270, i64 %274
%276 = load i8, i8* %275
%277 = zext i8 %276 to i32
%278 = add nsw i32 %277, 1
%279 = trunc i32 %278 to i8
store i8 %279, i8* %34
%280 = load i8, i8* %34
%281 = load i8*, i8** %21
%282 = load i64, i64* %32
%283 = load i32, i32* %33
%284 = sext i32 %283 to i64
%285 = add i64 %282, %284
%286 = getelementptr inbounds i8, i8* %281, i64 %285
store i8 %280, i8* %286
br label %287
287: ; preds = %269
%288 = load i32, i32* %33
%289 = add nsw i32 %288, 1
store i32 %289, i32* %33
br label %266
290: ; preds = %266
br label %291
291: ; preds = %290, %235
%292 = load i64, i64* %24
%293 = add i64 %292, 1
store i64 %293, i64* %24
%294 = call i32 @regfree(i32* %28)
br label %295
295: ; preds = %291
%296 = load i64, i64* %27
%297 = add i64 %296, 4096
store i64 %297, i64* %27
br label %223
298: ; preds = %223
%299 = load i32, i32* @stdout
%300 = load i32, i32* %9
%301 = load i64, i64* %24
%302 = call i32 (i32, i8*, ...) @fprintf(i32 %299, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.15, i64 0, i64 0), i32 %300, i64 %301)
br label %303
303: ; preds = %298, %218
br label %304
304: ; preds = %303, %213
%305 = load i8*, i8** %20
%306 = load i64, i64* %12
%307 = load i32, i32* @MS_SYNC
%308 = call i32 @msync(i8* %305, i64 %306, i32 %307)
%309 = load i64, i64* %12
%310 = call i32 @munmap(i32 0, i64 %309)
%311 = load i32, i32* %19
%312 = call i32 @close(i32 %311)
store i32 0, i32* %3
br label %313
313: ; preds = %304, %155
%314 = load i32, i32* %3
ret i32 %314
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
@.str = [7 x i8] c"4kaf:v\00"
@optarg = global i32 0
@stdout = global i32 0
@.str.1 = [22 x i8] c"*info* device = '%s'\0A\00"
@.str.2 = [16 x i8] c"/sys/class/dax/\00"
@.str.3 = [25 x i8] c"*info* opening ... %s%s\0A\00"
@.str.4 = [18 x i8] c"%s%s/device/align\00"
@.str.5 = [3 x i8] c"rt\00"
@.str.6 = [20 x i8] c"*error* not a dax?\0A\00"
@.str.7 = [4 x i8] c"%lu\00"
@.str.8 = [18 x i8] c"*info* align %zd\0A\00"
@.str.9 = [10 x i8] c"%s%s/size\00"
@.str.10 = [21 x i8] c"*info* max size %zd\0A\00"
@.str.11 = [63 x i8] c"*info* logical size of device %zd (%.1lf GiB), aligned to %zd\0A\00"
@.str.12 = [68 x i8] c"*info* opening '%s', wrecking %zd bytes (%.1lf GiB), in 4096 steps\0A\00"
@O_RDWR = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.13 = [21 x i8] c"*error* mmap failed\0A\00"
@stderr = global i32 0
@.str.14 = [18 x i8] c"[0x%lx] %d -> %d\0A\00"
@.str.15 = [46 x i8] c"*info* commandType '%d': applied %zd changes\0A\00"
@.str.16 = [41 x i8] c"[A-z][A-z][A-z][A-z][A-z][A-z][A-z][A-z]\00"
@.str.17 = [25 x i8] c"Could not compile regex\0A\00"
@.str.18 = [23 x i8] c"[0x%lx] changing '%s'\0A\00"
@MS_SYNC = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [1000 x i8]
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca %struct.TYPE_3__
%8 = alloca [4097 x i8]
br label %9
9: ; preds = %32, %2
%10 = phi i32 [ %33, %32 ], [ 0, %2 ]
%11 = phi i32 [ %15, %32 ], [ 0, %2 ]
%12 = phi i8* [ %19, %32 ], [ null, %2 ]
%13 = phi i8* [ %20, %32 ], [ null, %2 ]
br label %14
14: ; preds = %30, %9
%15 = phi i32 [ %11, %9 ], [ %31, %30 ]
%16 = phi i8* [ %12, %9 ], [ %19, %30 ]
%17 = phi i8* [ %13, %9 ], [ %20, %30 ]
br label %18
18: ; preds = %14, %23
%19 = phi i8* [ %16, %14 ], [ %25, %23 ]
%20 = phi i8* [ %17, %14 ], [ %26, %23 ]
br label %21
21: ; preds = %18, %21
%22 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
switch i32 %22, label %21 [
i32 -1, label %34
i32 102, label %23
i32 52, label %30
i32 97, label %29
i32 118, label %32
]
23: ; preds = %21
%24 = load i32, i32* @optarg
%25 = tail call i8* @strdup(i32 %24)
%26 = tail call i8* @getSuffix(i8* %25)
%27 = load i32, i32* @stdout
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %18
29: ; preds = %21
br label %30
30: ; preds = %21, %29
%31 = phi i32 [ 1, %29 ], [ 4, %21 ]
br label %14
32: ; preds = %21
%33 = add nuw nsw i32 %10, 1
br label %9
34: ; preds = %21
%35 = icmp eq i8* %20, null
%36 = icmp eq i32 %15, 0
%37 = select i1 %35, i1 true, i1 %36
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = tail call i32 (...) @help()
%40 = tail call i32 @exit(i32 1)
unreachable
41: ; preds = %34
%42 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%43 = load i32, i32* @stdout
%44 = tail call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%45 = call i32 @sprintf(i8* %42, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%46 = call i32* @fopen(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %52
48: ; preds = %41
%49 = load i32, i32* @stdout
%50 = tail call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%51 = tail call i32 @exit(i32 1)
unreachable
52: ; preds = %41
%53 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%54 = call i32 @fscanf(i32* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64* %4)
%55 = call i32 @fclose(i32* %46)
%56 = load i32, i32* @stdout
%57 = load i64, i64* %4
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i64 %57)
%59 = call i32 @sprintf(i8* %42, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%60 = call i32 @free(i8* %20)
%61 = call i32* @fopen(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%62 = icmp eq i32* %61, null
br i1 %62, label %63, label %67
63: ; preds = %52
%64 = load i32, i32* @stdout
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %52
%68 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%69 = call i32 @fscanf(i32* %61, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64* %5)
%70 = call i32 @fclose(i32* %61)
%71 = load i32, i32* @stdout
%72 = load i64, i64* %5
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i64 %72)
%74 = load i64, i64* %5
%75 = load i64, i64* %4
%76 = call i64 @alignedNumber(i64 %74, i64 %75)
%77 = icmp eq i32 %69, 1
%78 = select i1 %77, i64 %76, i64 0
store i64 %78, i64* %5
%79 = load i32, i32* @stdout
%80 = uitofp i64 %78 to double
%81 = fmul double %80, 0x3F50000000000000
%82 = fmul double %81, 0x3F50000000000000
%83 = fmul double %82, 0x3F50000000000000
%84 = load i64, i64* %4
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.11, i64 0, i64 0), i64 %78, double %83, i64 %84)
%86 = load i32, i32* @stdout
%87 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.12, i64 0, i64 0), i8* %19, i64 %78, double %83)
%88 = load i32, i32* @O_RDWR
%89 = call i32 @open(i8* %19, i32 %88)
%90 = icmp slt i32 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %67
%92 = call i32 @perror(i8* %19)
br label %206
93: ; preds = %67
%94 = load i32, i32* @PROT_WRITE
%95 = load i32, i32* @MAP_SHARED
%96 = call i8* @mmap(i32 0, i64 %78, i32 %94, i32 %95, i32 %89, i32 0)
%97 = icmp eq i8* %96, null
br i1 %97, label %98, label %102
98: ; preds = %93
%99 = load i32, i32* @stdout
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
%101 = call i32 @exit(i32 1)
unreachable
102: ; preds = %93
switch i32 %15, label %201 [
i32 4, label %103
i32 1, label %128
]
103: ; preds = %102
%104 = icmp eq i64 %78, 0
br i1 %104, label %107, label %105
105: ; preds = %103
%106 = icmp eq i32 %10, 0
br label %111
107: ; preds = %121, %103
%108 = phi i64 [ 0, %103 ], [ %125, %121 ]
%109 = load i32, i32* @stdout
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.15, i64 0, i64 0), i32 4, i64 %108)
br label %201
111: ; preds = %105, %121
%112 = phi i64 [ 0, %105 ], [ %126, %121 ]
%113 = phi i64 [ 0, %105 ], [ %125, %121 ]
br i1 %106, label %121, label %114
114: ; preds = %111
%115 = load i32, i32* @stderr
%116 = getelementptr inbounds i8, i8* %96, i64 %112
%117 = load i8, i8* %116
%118 = zext i8 %117 to i32
%119 = xor i32 %118, 255
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i64 %112, i32 %118, i32 %119)
br label %121
121: ; preds = %114, %111
%122 = getelementptr inbounds i8, i8* %96, i64 %112
%123 = load i8, i8* %122
%124 = xor i8 %123, -1
store i8 %124, i8* %122
%125 = add i64 %113, 1
%126 = add i64 %112, 4096
%127 = icmp ult i64 %126, %78
br i1 %127, label %111, label %107
128: ; preds = %102
%129 = call dereferenceable_or_null(9) i8* @malloc(i32 9)
%130 = icmp eq i64 %78, 0
br i1 %130, label %139, label %131
131: ; preds = %128
%132 = bitcast i32* %6 to i8*
%133 = bitcast %struct.TYPE_3__* %7 to i8*
%134 = getelementptr inbounds [4097 x i8], [4097 x i8]* %8, i64 0, i64 0
%135 = getelementptr inbounds [4097 x i8], [4097 x i8]* %8, i64 0, i64 4096
%136 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i64 0, i32 0
%137 = getelementptr inbounds i8, i8* %129, i64 8
%138 = icmp eq i32 %10, 0
br label %143
139: ; preds = %196, %128
%140 = phi i64 [ 0, %128 ], [ %197, %196 ]
%141 = load i32, i32* @stdout
%142 = call i32 (i32, i8*, ...) @fprintf(i32 %141, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.15, i64 0, i64 0), i32 1, i64 %140)
br label %201
143: ; preds = %131, %196
%144 = phi i64 [ 0, %131 ], [ %199, %196 ]
%145 = phi i64 [ 0, %131 ], [ %197, %196 ]
%146 = call i32 @regcomp(i32* %6, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.16, i64 0, i64 0), i32 0)
%147 = icmp eq i32 %146, 0
br i1 %147, label %152, label %148
148: ; preds = %143
%149 = load i32, i32* @stderr
%150 = call i32 (i32, i8*, ...) @fprintf(i32 %149, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0))
%151 = call i32 @exit(i32 1)
unreachable
152: ; preds = %143
%153 = getelementptr inbounds i8, i8* %96, i64 %144
%154 = call i32 @strncpy(i8* %134, i8* %153, i32 4096)
store i8 0, i8* %135
%155 = call i32 @regexec(i32* %6, i8* %134, i32 1, %struct.TYPE_3__* %7, i32 0)
%156 = icmp eq i32 %155, 0
br i1 %156, label %157, label %196
157: ; preds = %152
%158 = load i64, i64* %136
%159 = add i64 %158, %144
%160 = getelementptr inbounds i8, i8* %96, i64 %159
%161 = call i32 @strncpy(i8* %129, i8* %160, i32 8)
store i8 0, i8* %137
br i1 %138, label %165, label %162
162: ; preds = %157
%163 = load i32, i32* @stderr
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %163, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i64 %144, i8* %129)
br label %165
165: ; preds = %162, %157
%166 = load i8, i8* %160
%167 = add i8 %166, 1
store i8 %167, i8* %160
%168 = add i64 %159, 1
%169 = getelementptr inbounds i8, i8* %96, i64 %168
%170 = load i8, i8* %169
%171 = add i8 %170, 1
store i8 %171, i8* %169
%172 = add i64 %159, 2
%173 = getelementptr inbounds i8, i8* %96, i64 %172
%174 = load i8, i8* %173
%175 = add i8 %174, 1
store i8 %175, i8* %173
%176 = add i64 %159, 3
%177 = getelementptr inbounds i8, i8* %96, i64 %176
%178 = load i8, i8* %177
%179 = add i8 %178, 1
store i8 %179, i8* %177
%180 = add i64 %159, 4
%181 = getelementptr inbounds i8, i8* %96, i64 %180
%182 = load i8, i8* %181
%183 = add i8 %182, 1
store i8 %183, i8* %181
%184 = add i64 %159, 5
%185 = getelementptr inbounds i8, i8* %96, i64 %184
%186 = load i8, i8* %185
%187 = add i8 %186, 1
store i8 %187, i8* %185
%188 = add i64 %159, 6
%189 = getelementptr inbounds i8, i8* %96, i64 %188
%190 = load i8, i8* %189
%191 = add i8 %190, 1
store i8 %191, i8* %189
%192 = add i64 %159, 7
%193 = getelementptr inbounds i8, i8* %96, i64 %192
%194 = load i8, i8* %193
%195 = add i8 %194, 1
store i8 %195, i8* %193
br label %196
196: ; preds = %165, %152
%197 = add i64 %145, 1
%198 = call i32 @regfree(i32* %6)
%199 = add i64 %144, 4096
%200 = icmp ult i64 %199, %78
br i1 %200, label %143, label %139
201: ; preds = %102, %139, %107
%202 = load i32, i32* @MS_SYNC
%203 = call i32 @msync(i8* %96, i64 %78, i32 %202)
%204 = call i32 @munmap(i32 0, i64 %78)
%205 = call i32 @close(i32 %89)
br label %206
206: ; preds = %201, %91
%207 = phi i32 [ 1, %91 ], [ 0, %201 ]
ret i32 %207
}