#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 atoi(char *);
int /*<<< orphan*/ die(char *, ...);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcmp(char *, char *);
int strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  int last_argc = -1;
  int gigs = 0;
  int bytes = 0;
  char pattern[1024];
  int i, g;
  if (argc) {
    argc--;
    argv++;
  }
  while (argc && last_argc != argc) {
    last_argc = argc;
    if (!strcmp(*argv, "--")) {
      argc--;
      argv++;
      break;
    } else if (!strcmp(*argv, "--help")) {
      fputs("usage: "
            "genhashdata"
            " [options]\n"
            "Options:\n"
            "  --gigs  N     Emit N GiB of test bytes\n"
            "  --bytes DIFF  Stop DIFF bytes earlier or later\n",
            stdout);
      exit(0);
    } else if (!strcmp(*argv, "--gigs")) {
      argc--;
      argv++;
      if (argc) {
        gigs = atoi(*argv);
        argc--;
        argv++;
      }
    } else if (!strcmp(*argv, "--bytes")) {
      argc--;
      argv++;
      if (argc) {
        bytes = atoi(*argv);
        argc--;
        argv++;
      }
    } else if (!strncmp(*argv, "--", 2))
      die("unknown option '%s'", *argv);
  }
  if (gigs < 0 || gigs > 1024 * 1024)
    die("value for --gigs must be in the range 0 to %d", 1024 * 1024);
  if (bytes < -1024 || bytes > 1024)
    die("value for --bytes must be in the range -1024 to 1024");
  if (sizeof pattern != 1024)
    die("internal error");
  if (argc > 1)
    die("arguments are not expected");
  memset(pattern, 'a', sizeof pattern);
  for (g = 0; g < gigs; g++) {
    if (g + 1 == gigs && bytes < 0) {
      for (i = 0; i < 1024 * 1023; i++)
        if (fwrite(pattern, sizeof pattern, 1, stdout) != 1)
          die("writing to stdout failed: %s", strerror(errno));
      for (i = 0; i < 1023; i++)
        if (fwrite(pattern, sizeof pattern, 1, stdout) != 1)
          die("writing to stdout failed: %s", strerror(errno));
      if (fwrite(pattern, sizeof pattern + bytes, 1, stdout) != 1)
        die("writing to stdout failed: %s", strerror(errno));
    } else {
      for (i = 0; i < 1024 * 1024; i++)
        if (fwrite(pattern, sizeof pattern, 1, stdout) != 1)
          die("writing to stdout failed: %s", strerror(errno));
    }
  }
  if (bytes > 0)
    if (fwrite(pattern, bytes, 1, stdout) != 1)
      die("writing to stdout failed: %s", strerror(errno));
  if (fflush(stdout))
    die("writing to stdout failed: %s", strerror(errno));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11ed <main+0x4d>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    11f2 <main+0x52>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x429(%rbp)
je     1213 <main+0x73>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
setne  %al
mov    %al,-0x429(%rbp)
mov    -0x429(%rbp),%al
test   $0x1,%al
jne    1226 <main+0x86>
jmp    13b1 <main+0x211>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdc6(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1262 <main+0xc2>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    13b1 <main+0x211>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd93(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    129a <main+0xfa>
mov    0x2d53(%rip),%rax
mov    (%rax),%esi
lea    0xd7c(%rip),%rdi
call   1040 <fputs@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xde3(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    12fe <main+0x15e>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     12f9 <main+0x159>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    13a2 <main+0x202>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd86(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1362 <main+0x1c2>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     135d <main+0x1bd>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    139d <main+0x1fd>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xc90(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1398 <main+0x1f8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1080 <die@plt>
jmp    139d <main+0x1fd>
jmp    13a2 <main+0x202>
jmp    13a7 <main+0x207>
jmp    13ac <main+0x20c>
jmp    11f2 <main+0x52>
cmpl   $0x0,-0x18(%rbp)
jl     13c8 <main+0x228>
cmpl   $0x100000,-0x18(%rbp)
jle    13db <main+0x23b>
lea    0xcdf(%rip),%rdi
mov    $0x100000,%esi
mov    $0x0,%al
call   1080 <die@plt>
cmpl   $0xfffffc00,-0x1c(%rbp)
jl     13f5 <main+0x255>
cmpl   $0x400,-0x1c(%rbp)
jle    1403 <main+0x263>
lea    0xce0(%rip),%rdi
mov    $0x0,%al
call   1080 <die@plt>
cmpl   $0x1,-0x8(%rbp)
jle    141b <main+0x27b>
lea    0xcfd(%rip),%rdi
mov    $0x0,%al
call   1080 <die@plt>
lea    -0x420(%rbp),%rdi
mov    $0x61,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
movl   $0x0,-0x428(%rbp)
mov    -0x428(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1641 <main+0x4a1>
mov    -0x428(%rbp),%eax
add    $0x1,%eax
cmp    -0x18(%rbp),%eax
jne    15aa <main+0x40a>
cmpl   $0x0,-0x1c(%rbp)
jge    15aa <main+0x40a>
movl   $0x0,-0x424(%rbp)
cmpl   $0xffc00,-0x424(%rbp)
jge    14df <main+0x33f>
lea    -0x420(%rbp),%rdi
mov    0x2b4a(%rip),%rax
mov    (%rax),%ecx
mov    $0x400,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     14c6 <main+0x326>
mov    0x2b31(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %eax,%esi
lea    0xc6d(%rip),%rdi
mov    $0x0,%al
call   1080 <die@plt>
jmp    14cb <main+0x32b>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    1470 <main+0x2d0>
movl   $0x0,-0x424(%rbp)
cmpl   $0x3ff,-0x424(%rbp)
jge    1558 <main+0x3b8>
lea    -0x420(%rbp),%rdi
mov    0x2ad1(%rip),%rax
mov    (%rax),%ecx
mov    $0x400,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     153f <main+0x39f>
mov    0x2ab8(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %eax,%esi
lea    0xbf4(%rip),%rdi
mov    $0x0,%al
call   1080 <die@plt>
jmp    1544 <main+0x3a4>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    14e9 <main+0x349>
lea    -0x420(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    $0x400,%rax
mov    %eax,%esi
mov    0x2a66(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     15a5 <main+0x405>
mov    0x2a52(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %eax,%esi
lea    0xb8e(%rip),%rdi
mov    $0x0,%al
call   1080 <die@plt>
jmp    1628 <main+0x488>
movl   $0x0,-0x424(%rbp)
cmpl   $0x100000,-0x424(%rbp)
jge    1623 <main+0x483>
lea    -0x420(%rbp),%rdi
mov    0x2a06(%rip),%rax
mov    (%rax),%ecx
mov    $0x400,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     160a <main+0x46a>
mov    0x29ed(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %eax,%esi
lea    0xb29(%rip),%rdi
mov    $0x0,%al
call   1080 <die@plt>
jmp    160f <main+0x46f>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    15b4 <main+0x414>
jmp    1628 <main+0x488>
jmp    162d <main+0x48d>
mov    -0x428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x428(%rbp)
jmp    143b <main+0x29b>
cmpl   $0x0,-0x1c(%rbp)
jle    1694 <main+0x4f4>
lea    -0x420(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    0x297c(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     168f <main+0x4ef>
mov    0x2968(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %eax,%esi
lea    0xaa4(%rip),%rdi
mov    $0x0,%al
call   1080 <die@plt>
jmp    1694 <main+0x4f4>
mov    0x293d(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
cmp    $0x0,%rax
je     16ca <main+0x52a>
mov    0x292d(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    %eax,%esi
lea    0xa69(%rip),%rdi
mov    $0x0,%al
call   1080 <die@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
xor    %eax,%eax
mov    %edi,%r15d
sub    $0x1,%r15d
cmovb  %eax,%r15d
lea    -0x1(%r15),%eax
cmp    $0xfffffffe,%eax
jae    12d2 <main+0x132>
xor    %eax,%eax
test   %edi,%edi
setne  %al
lea    (%rsi,%rax,8),%rbp
lea    0xe23(%rip),%r14
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
mov    0x0(%rbp),%r13
mov    %r13,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     12eb <main+0x14b>
mov    %r13,%rdi
lea    0xdf2(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1585 <main+0x3e5>
mov    %r13,%rdi
lea    0xe63(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1280 <main+0xe0>
mov    %r13,%rdi
lea    0xe57(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     12a0 <main+0x100>
mov    %r13,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    126a <main+0xca>
mov    0x0(%rbp),%rsi
lea    0xe37(%rip),%rdi
xor    %eax,%eax
call   1080 <die@plt>
mov    %r15d,%ebx
test   %ebx,%ebx
jne    12c4 <main+0x124>
jmp    12ff <main+0x15f>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x1,%r15d
je     12fd <main+0x15d>
mov    0x8(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,%r12d
jmp    12b8 <main+0x118>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x1,%r15d
je     1571 <main+0x3d1>
mov    0x8(%rbp),%rdi
call   1090 <atoi@plt>
mov    %rax,0x8(%rsp)
lea    -0x2(%r15),%ebx
add    $0x10,%rbp
test   %ebx,%ebx
je     12ff <main+0x15f>
cmp    %ebx,%r15d
mov    %ebx,%r15d
jne    11f0 <main+0x50>
jmp    12ff <main+0x15f>
lea    0x20(%rsp),%rdi
mov    $0x61,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
jmp    152c <main+0x38c>
add    $0xffffffff,%r15d
mov    %r15d,%ebx
cmp    $0x100001,%r12d
jae    1308 <main+0x168>
jmp    131b <main+0x17b>
xor    %ebx,%ebx
cmp    $0x100001,%r12d
jb     131b <main+0x17b>
lea    0xd9f(%rip),%rdi
mov    $0x100000,%esi
xor    %eax,%eax
call   1080 <die@plt>
mov    0x8(%rsp),%rbp
lea    -0x401(%rbp),%eax
cmp    $0xfffff7fe,%eax
ja     133b <main+0x19b>
lea    0xda8(%rip),%rdi
xor    %eax,%eax
call   1080 <die@plt>
cmp    $0x2,%ebx
jl     134e <main+0x1ae>
lea    0xdca(%rip),%rdi
xor    %eax,%eax
call   1080 <die@plt>
lea    0x20(%rsp),%rdi
mov    $0x61,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
test   %r12d,%r12d
jle    14eb <main+0x34b>
lea    0x400(%rbp),%eax
mov    %eax,0x14(%rsp)
mov    0x2c5c(%rip),%r15
lea    0x20(%rsp),%rbx
mov    0x2c58(%rip),%r14
lea    0xd9d(%rip),%r13
xor    %eax,%eax
mov    %r12d,0x18(%rsp)
jmp    13b2 <main+0x212>
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%r12d
mov    0x1c(%rsp),%eax
cmp    %r12d,%eax
je     14eb <main+0x34b>
add    $0x1,%eax
mov    %eax,0x1c(%rsp)
cmp    %r12d,%eax
jne    1410 <main+0x270>
test   %ebp,%ebp
jns    1410 <main+0x270>
mov    $0xffc00,%ebp
jmp    13d9 <main+0x239>
nopl   0x0(%rax)
add    $0xffffffff,%ebp
je     1460 <main+0x2c0>
mov    (%r15),%ecx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     13d0 <main+0x230>
mov    (%r14),%edi
call   10c0 <strerror@plt>
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <die@plt>
jmp    13d0 <main+0x230>
nopl   0x0(%rax)
mov    $0x100000,%r12d
jmp    142a <main+0x28a>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%r12d
je     13a0 <main+0x200>
mov    (%r15),%ecx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     1420 <main+0x280>
mov    (%r14),%edi
call   10c0 <strerror@plt>
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <die@plt>
jmp    1420 <main+0x280>
nopw   0x0(%rax,%rax,1)
mov    $0x3ff,%ebp
jmp    1475 <main+0x2d5>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
je     14b0 <main+0x310>
mov    (%r15),%ecx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     1470 <main+0x2d0>
mov    (%r14),%edi
call   10c0 <strerror@plt>
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <die@plt>
jmp    1470 <main+0x2d0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15),%ecx
mov    %rbx,%rdi
mov    0x14(%rsp),%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
mov    0x8(%rsp),%rbp
je     13a0 <main+0x200>
mov    (%r14),%edi
call   10c0 <strerror@plt>
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <die@plt>
jmp    13a0 <main+0x200>
test   %ebp,%ebp
jle    152c <main+0x38c>
mov    0x2ae2(%rip),%rax
mov    (%rax),%ecx
lea    0x20(%rsp),%rdi
mov    %ebp,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     152c <main+0x38c>
mov    0x2acb(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xc09(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <die@plt>
mov    0x2aa5(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
test   %rax,%rax
je     155d <main+0x3bd>
mov    0x2a9a(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xbd8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <die@plt>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
cmp    $0x100001,%r12d
jae    1308 <main+0x168>
jmp    131b <main+0x17b>
mov    0x2a4c(%rip),%rax
mov    (%rax),%esi
lea    0xa75(%rip),%rdi
call   1040 <fputs@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"--\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [129 x i8] c"usage: genhashdata [options]\0AOptions:\0A --gigs N Emit N GiB of test bytes\0A --bytes DIFF Stop DIFF bytes earlier or later\0A\00"
@stdout = global i32 0
@.str.3 = [7 x i8] c"--gigs\00"
@.str.4 = [8 x i8] c"--bytes\00"
@.str.5 = [20 x i8] c"unknown option '%s'\00"
@.str.6 = [46 x i8] c"value for --gigs must be in the range 0 to %d\00"
@.str.7 = [53 x i8] c"value for --bytes must be in the range -1024 to 1024\00"
@.str.8 = [27 x i8] c"arguments are not expected\00"
@.str.9 = [29 x i8] c"writing to stdout failed: %s\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i32, i32* %4
%16 = add nsw i32 %15, -1
store i32 %16, i32* %4
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i32 1
store i8** %18, i8*** %5
br label %19
19: ; preds = %14, %2
br label %20
20: ; preds = %104, %19
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32, i32* %6
%25 = load i32, i32* %4
%26 = icmp ne i32 %24, %25
br label %27
27: ; preds = %23, %20
%28 = phi i1 [ false, %20 ], [ %26, %23 ]
br i1 %28, label %29, label %105
29: ; preds = %27
%30 = load i32, i32* %4
store i32 %30, i32* %6
%31 = load i8**, i8*** %5
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %40, label %35
35: ; preds = %29
%36 = load i32, i32* %4
%37 = add nsw i32 %36, -1
store i32 %37, i32* %4
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i32 1
store i8** %39, i8*** %5
br label %105
40: ; preds = %29
%41 = load i8**, i8*** %5
%42 = load i8*, i8** %41
%43 = call i32 @strcmp(i8* %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %49, label %45
45: ; preds = %40
%46 = load i32, i32* @stdout
%47 = call i32 @fputs(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str.2, i64 0, i64 0), i32 %46)
%48 = call i32 @exit(i32 0)
unreachable
49: ; preds = %40
%50 = load i8**, i8*** %5
%51 = load i8*, i8** %50
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %70, label %54
54: ; preds = %49
%55 = load i32, i32* %4
%56 = add nsw i32 %55, -1
store i32 %56, i32* %4
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i32 1
store i8** %58, i8*** %5
%59 = load i32, i32* %4
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %69
61: ; preds = %54
%62 = load i8**, i8*** %5
%63 = load i8*, i8** %62
%64 = call i32 @atoi(i8* %63)
store i32 %64, i32* %7
%65 = load i32, i32* %4
%66 = add nsw i32 %65, -1
store i32 %66, i32* %4
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i32 1
store i8** %68, i8*** %5
br label %69
69: ; preds = %61, %54
br label %102
70: ; preds = %49
%71 = load i8**, i8*** %5
%72 = load i8*, i8** %71
%73 = call i32 @strcmp(i8* %72, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%74 = icmp ne i32 %73, 0
br i1 %74, label %91, label %75
75: ; preds = %70
%76 = load i32, i32* %4
%77 = add nsw i32 %76, -1
store i32 %77, i32* %4
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i32 1
store i8** %79, i8*** %5
%80 = load i32, i32* %4
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %90
82: ; preds = %75
%83 = load i8**, i8*** %5
%84 = load i8*, i8** %83
%85 = call i32 @atoi(i8* %84)
store i32 %85, i32* %8
%86 = load i32, i32* %4
%87 = add nsw i32 %86, -1
store i32 %87, i32* %4
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i32 1
store i8** %89, i8*** %5
br label %90
90: ; preds = %82, %75
br label %101
91: ; preds = %70
%92 = load i8**, i8*** %5
%93 = load i8*, i8** %92
%94 = call i32 @strncmp(i8* %93, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%95 = icmp ne i32 %94, 0
br i1 %95, label %100, label %96
96: ; preds = %91
%97 = load i8**, i8*** %5
%98 = load i8*, i8** %97
%99 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %98)
br label %100
100: ; preds = %96, %91
br label %101
101: ; preds = %100, %90
br label %102
102: ; preds = %101, %69
br label %103
103: ; preds = %102
br label %104
104: ; preds = %103
br label %20
105: ; preds = %35, %27
%106 = load i32, i32* %7
%107 = icmp slt i32 %106, 0
br i1 %107, label %111, label %108
108: ; preds = %105
%109 = load i32, i32* %7
%110 = icmp sgt i32 %109, 1048576
br i1 %110, label %111, label %113
111: ; preds = %108, %105
%112 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i32 1048576)
br label %113
113: ; preds = %111, %108
%114 = load i32, i32* %8
%115 = icmp slt i32 %114, -1024
br i1 %115, label %119, label %116
116: ; preds = %113
%117 = load i32, i32* %8
%118 = icmp sgt i32 %117, 1024
br i1 %118, label %119, label %121
119: ; preds = %116, %113
%120 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0))
br label %121
121: ; preds = %119, %116
%122 = load i32, i32* %4
%123 = icmp sgt i32 %122, 1
br i1 %123, label %124, label %126
124: ; preds = %121
%125 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %126
126: ; preds = %124, %121
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%128 = call i32 @memset(i8* %127, i8 signext 97, i32 1024)
store i32 0, i32* %11
br label %129
129: ; preds = %208, %126
%130 = load i32, i32* %11
%131 = load i32, i32* %7
%132 = icmp slt i32 %130, %131
br i1 %132, label %133, label %211
133: ; preds = %129
%134 = load i32, i32* %11
%135 = add nsw i32 %134, 1
%136 = load i32, i32* %7
%137 = icmp eq i32 %135, %136
br i1 %137, label %138, label %189
138: ; preds = %133
%139 = load i32, i32* %8
%140 = icmp slt i32 %139, 0
br i1 %140, label %141, label %189
141: ; preds = %138
store i32 0, i32* %10
br label %142
142: ; preds = %155, %141
%143 = load i32, i32* %10
%144 = icmp slt i32 %143, 1047552
br i1 %144, label %145, label %158
145: ; preds = %142
%146 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%147 = load i32, i32* @stdout
%148 = call i32 @fwrite(i8* %146, i32 1024, i32 1, i32 %147)
%149 = icmp ne i32 %148, 1
br i1 %149, label %150, label %154
150: ; preds = %145
%151 = load i32, i32* @errno
%152 = call i32 @strerror(i32 %151)
%153 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %152)
br label %154
154: ; preds = %150, %145
br label %155
155: ; preds = %154
%156 = load i32, i32* %10
%157 = add nsw i32 %156, 1
store i32 %157, i32* %10
br label %142
158: ; preds = %142
store i32 0, i32* %10
br label %159
159: ; preds = %172, %158
%160 = load i32, i32* %10
%161 = icmp slt i32 %160, 1023
br i1 %161, label %162, label %175
162: ; preds = %159
%163 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%164 = load i32, i32* @stdout
%165 = call i32 @fwrite(i8* %163, i32 1024, i32 1, i32 %164)
%166 = icmp ne i32 %165, 1
br i1 %166, label %167, label %171
167: ; preds = %162
%168 = load i32, i32* @errno
%169 = call i32 @strerror(i32 %168)
%170 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %169)
br label %171
171: ; preds = %167, %162
br label %172
172: ; preds = %171
%173 = load i32, i32* %10
%174 = add nsw i32 %173, 1
store i32 %174, i32* %10
br label %159
175: ; preds = %159
%176 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%177 = load i32, i32* %8
%178 = sext i32 %177 to i64
%179 = add i64 1024, %178
%180 = trunc i64 %179 to i32
%181 = load i32, i32* @stdout
%182 = call i32 @fwrite(i8* %176, i32 %180, i32 1, i32 %181)
%183 = icmp ne i32 %182, 1
br i1 %183, label %184, label %188
184: ; preds = %175
%185 = load i32, i32* @errno
%186 = call i32 @strerror(i32 %185)
%187 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %186)
br label %188
188: ; preds = %184, %175
br label %207
189: ; preds = %138, %133
store i32 0, i32* %10
br label %190
190: ; preds = %203, %189
%191 = load i32, i32* %10
%192 = icmp slt i32 %191, 1048576
br i1 %192, label %193, label %206
193: ; preds = %190
%194 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%195 = load i32, i32* @stdout
%196 = call i32 @fwrite(i8* %194, i32 1024, i32 1, i32 %195)
%197 = icmp ne i32 %196, 1
br i1 %197, label %198, label %202
198: ; preds = %193
%199 = load i32, i32* @errno
%200 = call i32 @strerror(i32 %199)
%201 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %200)
br label %202
202: ; preds = %198, %193
br label %203
203: ; preds = %202
%204 = load i32, i32* %10
%205 = add nsw i32 %204, 1
store i32 %205, i32* %10
br label %190
206: ; preds = %190
br label %207
207: ; preds = %206, %188
br label %208
208: ; preds = %207
%209 = load i32, i32* %11
%210 = add nsw i32 %209, 1
store i32 %210, i32* %11
br label %129
211: ; preds = %129
%212 = load i32, i32* %8
%213 = icmp sgt i32 %212, 0
br i1 %213, label %214, label %225
214: ; preds = %211
%215 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%216 = load i32, i32* %8
%217 = load i32, i32* @stdout
%218 = call i32 @fwrite(i8* %215, i32 %216, i32 1, i32 %217)
%219 = icmp ne i32 %218, 1
br i1 %219, label %220, label %224
220: ; preds = %214
%221 = load i32, i32* @errno
%222 = call i32 @strerror(i32 %221)
%223 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %222)
br label %224
224: ; preds = %220, %214
br label %225
225: ; preds = %224, %211
%226 = load i32, i32* @stdout
%227 = call i64 @fflush(i32 %226)
%228 = icmp ne i64 %227, 0
br i1 %228, label %229, label %233
229: ; preds = %225
%230 = load i32, i32* @errno
%231 = call i32 @strerror(i32 %230)
%232 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %231)
br label %233
233: ; preds = %229, %225
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"--\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [129 x i8] c"usage: genhashdata [options]\0AOptions:\0A --gigs N Emit N GiB of test bytes\0A --bytes DIFF Stop DIFF bytes earlier or later\0A\00"
@stdout = global i32 0
@.str.3 = [7 x i8] c"--gigs\00"
@.str.4 = [8 x i8] c"--bytes\00"
@.str.5 = [20 x i8] c"unknown option '%s'\00"
@.str.6 = [46 x i8] c"value for --gigs must be in the range 0 to %d\00"
@.str.7 = [53 x i8] c"value for --bytes must be in the range -1024 to 1024\00"
@.str.8 = [27 x i8] c"arguments are not expected\00"
@.str.9 = [29 x i8] c"writing to stdout failed: %s\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 0
%6 = add nsw i32 %0, -1
%7 = select i1 %5, i32 0, i32 %6
%8 = add i32 %7, -1
%9 = icmp ult i32 %8, -2
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 @memset(i8* %4, i8 signext 97, i32 1024)
br label %152
12: ; preds = %2
%13 = xor i1 %5, true
%14 = zext i1 %13 to i64
%15 = getelementptr i8*, i8** %1, i64 %14
br label %16
16: ; preds = %12, %61
%17 = phi i32 [ %65, %61 ], [ 0, %12 ]
%18 = phi i32 [ %64, %61 ], [ 0, %12 ]
%19 = phi i8** [ %63, %61 ], [ %15, %12 ]
%20 = phi i32 [ %62, %61 ], [ %7, %12 ]
%21 = load i8*, i8** %19
%22 = tail call i32 @strcmp(i8* dereferenceable(1) %21, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %16
%25 = add nsw i32 %20, -1
br label %69
26: ; preds = %16
%27 = tail call i32 @strcmp(i8* dereferenceable(1) %21, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = load i32, i32* @stdout
%31 = tail call i32 @fputs(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = tail call i32 @exit(i32 0)
unreachable
33: ; preds = %26
%34 = tail call i32 @strcmp(i8* dereferenceable(1) %21, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %44
36: ; preds = %33
%37 = icmp eq i32 %20, 1
br i1 %37, label %69, label %38
38: ; preds = %36
%39 = getelementptr inbounds i8*, i8** %19, i64 1
%40 = load i8*, i8** %39
%41 = tail call i32 @atoi(i8* %40)
%42 = add nsw i32 %20, -2
%43 = getelementptr inbounds i8*, i8** %19, i64 2
br label %61
44: ; preds = %33
%45 = tail call i32 @strcmp(i8* dereferenceable(1) %21, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %55
47: ; preds = %44
%48 = icmp eq i32 %20, 1
br i1 %48, label %69, label %49
49: ; preds = %47
%50 = getelementptr inbounds i8*, i8** %19, i64 1
%51 = load i8*, i8** %50
%52 = tail call i32 @atoi(i8* %51)
%53 = add nsw i32 %20, -2
%54 = getelementptr inbounds i8*, i8** %19, i64 2
br label %61
55: ; preds = %44
%56 = tail call i32 @strncmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %55
%59 = load i8*, i8** %19
%60 = tail call i32 (i8*, ...) @die(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %59)
br label %61
61: ; preds = %49, %58, %55, %38
%62 = phi i32 [ %20, %55 ], [ %20, %58 ], [ %53, %49 ], [ %42, %38 ]
%63 = phi i8** [ %19, %55 ], [ %19, %58 ], [ %54, %49 ], [ %43, %38 ]
%64 = phi i32 [ %18, %55 ], [ %18, %58 ], [ %18, %49 ], [ %41, %38 ]
%65 = phi i32 [ %17, %55 ], [ %17, %58 ], [ %52, %49 ], [ %17, %38 ]
%66 = icmp ne i32 %62, 0
%67 = icmp ne i32 %20, %62
%68 = and i1 %66, %67
br i1 %68, label %16, label %69
69: ; preds = %36, %47, %61, %24
%70 = phi i32 [ %18, %24 ], [ %18, %36 ], [ %18, %47 ], [ %64, %61 ]
%71 = phi i32 [ %17, %24 ], [ %17, %36 ], [ %17, %47 ], [ %65, %61 ]
%72 = phi i32 [ %25, %24 ], [ 0, %36 ], [ 0, %47 ], [ %62, %61 ]
%73 = icmp ugt i32 %70, 1048576
br i1 %73, label %74, label %76
74: ; preds = %69
%75 = tail call i32 (i8*, ...) @die(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i32 1048576)
br label %76
76: ; preds = %69, %74
%77 = add i32 %71, -1025
%78 = icmp ult i32 %77, -2049
br i1 %78, label %79, label %81
79: ; preds = %76
%80 = tail call i32 (i8*, ...) @die(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0))
br label %81
81: ; preds = %76, %79
%82 = icmp sgt i32 %72, 1
br i1 %82, label %83, label %85
83: ; preds = %81
%84 = tail call i32 (i8*, ...) @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %85
85: ; preds = %83, %81
%86 = call i32 @memset(i8* %4, i8 signext 97, i32 1024)
%87 = icmp sgt i32 %70, 0
br i1 %87, label %88, label %142
88: ; preds = %85
%89 = icmp slt i32 %71, 0
%90 = add i32 %71, 1024
br label %91
91: ; preds = %88, %140
%92 = phi i32 [ 0, %88 ], [ %93, %140 ]
%93 = add nuw nsw i32 %92, 1
%94 = icmp eq i32 %93, %70
%95 = select i1 %94, i1 %89, i1 false
br i1 %95, label %96, label %128
96: ; preds = %91, %105
%97 = phi i32 [ %106, %105 ], [ 0, %91 ]
%98 = load i32, i32* @stdout
%99 = call i32 @fwrite(i8* %4, i32 1024, i32 1, i32 %98)
%100 = icmp eq i32 %99, 1
br i1 %100, label %105, label %101
101: ; preds = %96
%102 = load i32, i32* @errno
%103 = call i32 @strerror(i32 %102)
%104 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %103)
br label %105
105: ; preds = %96, %101
%106 = add nuw nsw i32 %97, 1
%107 = icmp eq i32 %106, 1047552
br i1 %107, label %108, label %96
108: ; preds = %105, %117
%109 = phi i32 [ %118, %117 ], [ 0, %105 ]
%110 = load i32, i32* @stdout
%111 = call i32 @fwrite(i8* %4, i32 1024, i32 1, i32 %110)
%112 = icmp eq i32 %111, 1
br i1 %112, label %117, label %113
113: ; preds = %108
%114 = load i32, i32* @errno
%115 = call i32 @strerror(i32 %114)
%116 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %115)
br label %117
117: ; preds = %108, %113
%118 = add nuw nsw i32 %109, 1
%119 = icmp eq i32 %118, 1023
br i1 %119, label %120, label %108
120: ; preds = %117
%121 = load i32, i32* @stdout
%122 = call i32 @fwrite(i8* %4, i32 %90, i32 1, i32 %121)
%123 = icmp eq i32 %122, 1
br i1 %123, label %140, label %124
124: ; preds = %120
%125 = load i32, i32* @errno
%126 = call i32 @strerror(i32 %125)
%127 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %126)
br label %140
128: ; preds = %91, %137
%129 = phi i32 [ %138, %137 ], [ 0, %91 ]
%130 = load i32, i32* @stdout
%131 = call i32 @fwrite(i8* %4, i32 1024, i32 1, i32 %130)
%132 = icmp eq i32 %131, 1
br i1 %132, label %137, label %133
133: ; preds = %128
%134 = load i32, i32* @errno
%135 = call i32 @strerror(i32 %134)
%136 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %135)
br label %137
137: ; preds = %128, %133
%138 = add nuw nsw i32 %129, 1
%139 = icmp eq i32 %138, 1048576
br i1 %139, label %140, label %128
140: ; preds = %137, %124, %120
%141 = icmp eq i32 %93, %70
br i1 %141, label %142, label %91
142: ; preds = %140, %85
%143 = icmp sgt i32 %71, 0
br i1 %143, label %144, label %152
144: ; preds = %142
%145 = load i32, i32* @stdout
%146 = call i32 @fwrite(i8* %4, i32 %71, i32 1, i32 %145)
%147 = icmp eq i32 %146, 1
br i1 %147, label %152, label %148
148: ; preds = %144
%149 = load i32, i32* @errno
%150 = call i32 @strerror(i32 %149)
%151 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %150)
br label %152
152: ; preds = %10, %144, %148, %142
%153 = load i32, i32* @stdout
%154 = call i64 @fflush(i32 %153)
%155 = icmp eq i64 %154, 0
br i1 %155, label %160, label %156
156: ; preds = %152
%157 = load i32, i32* @errno
%158 = call i32 @strerror(i32 %157)
%159 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %158)
br label %160
160: ; preds = %156, %152
ret i32 0
}