#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ err(int, char *, char const *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
size_t fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
size_t fwrite(unsigned char *, int, size_t, int /*<<< orphan*/ *);
int getopt(int, char **, char *);
int /*<<< orphan*/ init_rand();
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, size_t);
char *optarg;
size_t rand();
unsigned char *realloc(unsigned char *, size_t);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
scalar_t__ strcmp(char const *, char *);
int strtol(char *, char **, int);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ warnx(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fi, *fo;
  int i;
  const char *input_file_name;
  const char *output_file_name;
  int no_bytes;
  char *ep;
  int ch;
  unsigned char *data;
  size_t data_size;
  size_t data_pos;
  size_t input_data_size;
  unsigned char buf[1024];
  input_file_name = "-";
  output_file_name = "-";
  no_bytes = 1024;
  while ((ch = getopt(argc, argv, "hi:o:n:")) != -1) {
    switch (ch) {
    case 'i':
      input_file_name = optarg;
      break;
    case 'n':
      no_bytes = strtol(optarg, &ep, 10);
      if (no_bytes < 0 || *ep != '\0') {
        warnx("illegal number -- %s", argv[2]);
        usage();
      }
      break;
    case 'o':
      output_file_name = optarg;
      break;
    case 'h':
    case '?':
    default:
      usage();
    }
  }
  if (strcmp(input_file_name, "-") == 0) {
    fi = stdin;
  } else {
    fi = fopen(input_file_name, "rb");
    if (fi == NULL) {
      err(1, "%s", input_file_name);
    }
  }
  data = NULL;
  data_size = 0;
  data_pos = 0;
  while ((input_data_size = fread(buf, 1, sizeof(buf), fi)) != 0) {
    if (data_pos + input_data_size >= data_size) {
      data_size = (data_size + input_data_size) * 2;
      assert((data = realloc(data, data_size)) != NULL);
    }
    memcpy(data + data_pos, buf, input_data_size);
    data_pos += input_data_size;
  }
  fclose(fi);
  init_rand();
  for (i = 0; i < no_bytes; i++) {
    data[rand() % data_pos] = rand();
  }
  if (strcmp(output_file_name, "-") == 0) {
    fo = stdout;
  } else {
    fo = fopen(output_file_name, "wb");
    if (fo == NULL) {
      err(1, "%s", output_file_name);
    }
  }
  assert(fwrite(data, 1, data_pos, fo) == data_pos);
  fclose(fo);
  free(data);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea4(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe99(%rip),%rax
mov    %rax,-0x38(%rbp)
movl   $0x400,-0x3c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe82(%rip),%rdx
call   10f0 <getopt@plt>
mov    %eax,-0x4c(%rbp)
cmp    $0xffffffff,%eax
je     1310 <main+0x110>
mov    -0x4c(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x478(%rbp)
sub    $0x30,%eax
ja     1304 <main+0x104>
mov    -0x478(%rbp),%rax
lea    0xd85(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d6d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    130b <main+0x10b>
mov    0x2d5a(%rip),%rax
mov    (%rax),%rdi
lea    -0x48(%rbp),%rsi
mov    $0xa,%edx
call   1090 <strtol@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jl     12cc <main+0xcc>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     12e7 <main+0xe7>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xdf3(%rip),%rdi
call   1060 <warnx@plt>
mov    $0x0,%al
call   10d0 <usage@plt>
jmp    130b <main+0x10b>
mov    0x2d05(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    130b <main+0x10b>
jmp    1304 <main+0x104>
mov    $0x0,%al
call   10d0 <usage@plt>
jmp    1236 <main+0x36>
mov    -0x30(%rbp),%rdi
lea    0xda9(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    133d <main+0x13d>
mov    0x2caf(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1376 <main+0x176>
mov    -0x30(%rbp),%rdi
lea    0xd9b(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1371 <main+0x171>
mov    -0x30(%rbp),%rdx
mov    $0x1,%edi
lea    0xd74(%rip),%rsi
call   10b0 <err@plt>
jmp    1376 <main+0x176>
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
movq   $0x0,-0x68(%rbp)
lea    -0x470(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1040 <fread@plt>
mov    %rax,-0x70(%rbp)
cmp    $0x0,%rax
je     1423 <main+0x223>
mov    -0x68(%rbp),%rax
add    -0x70(%rbp),%rax
cmp    -0x60(%rbp),%rax
jb     13fa <main+0x1fa>
mov    -0x60(%rbp),%rax
add    -0x70(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
call   10c0 <realloc@plt>
mov    %rax,-0x58(%rbp)
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x58(%rbp),%rdi
add    -0x68(%rbp),%rdi
lea    -0x470(%rbp),%rsi
mov    -0x70(%rbp),%rdx
call   10a0 <memcpy@plt>
mov    -0x70(%rbp),%rax
add    -0x68(%rbp),%rax
mov    %rax,-0x68(%rbp)
jmp    138e <main+0x18e>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0x0,%al
call   1100 <init_rand@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1489 <main+0x289>
mov    $0x0,%al
call   1120 <rand@plt>
mov    %al,-0x481(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x480(%rbp)
mov    $0x0,%al
call   1120 <rand@plt>
mov    -0x481(%rbp),%cl
xor    %edx,%edx
divq   -0x68(%rbp)
mov    -0x480(%rbp),%rax
mov    %cl,(%rax,%rdx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    143a <main+0x23a>
mov    -0x38(%rbp),%rdi
lea    0xc30(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    14b6 <main+0x2b6>
mov    0x2b26(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    14ef <main+0x2ef>
mov    -0x38(%rbp),%rdi
lea    0xc25(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    14ea <main+0x2ea>
mov    -0x38(%rbp),%rdx
mov    $0x1,%edi
lea    0xbfb(%rip),%rsi
call   10b0 <err@plt>
jmp    14ef <main+0x2ef>
mov    -0x58(%rbp),%rdi
mov    -0x68(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1110 <fwrite@plt>
cmp    -0x68(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rsi,%rbx
mov    %edi,%r12d
mov    $0x400,%ebp
lea    0xddd(%rip),%r15
lea    0xdd8(%rip),%r13
mov    0x2dc7(%rip),%r14
mov    %r15,0x8(%rsp)
jmp    1257 <main+0x57>
mov    0x10(%rbx),%rsi
lea    0xdc7(%rip),%rdi
call   1060 <warnx@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10d0 <usage@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10f0 <getopt@plt>
cmp    $0x6d,%eax
jg     1280 <main+0x80>
cmp    $0xffffffff,%eax
je     12b8 <main+0xb8>
cmp    $0x69,%eax
jne    1250 <main+0x50>
mov    (%r14),%r15
jmp    1257 <main+0x57>
nopl   0x0(%rax)
cmp    $0x6e,%eax
je     1294 <main+0x94>
cmp    $0x6f,%eax
jne    1250 <main+0x50>
mov    (%r14),%rax
mov    %rax,0x8(%rsp)
jmp    1257 <main+0x57>
mov    (%r14),%rdi
lea    0x18(%rsp),%rsi
mov    $0xa,%edx
call   1090 <strtol@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1238 <main+0x38>
mov    0x18(%rsp),%rax
cmpb   $0x0,(%rax)
jne    1238 <main+0x38>
jmp    1257 <main+0x57>
lea    0xd41(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12fb <main+0xfb>
lea    0xd4c(%rip),%rsi
mov    %r15,%rdi
call   10e0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1305 <main+0x105>
lea    0xd32(%rip),%rsi
mov    $0x1,%edi
mov    %r15,%rdx
call   10b0 <err@plt>
xor    %ebx,%ebx
jmp    1305 <main+0x105>
mov    0x2cde(%rip),%rax
mov    (%rax),%rbx
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
test   %rax,%rax
mov    %rbx,0x10(%rsp)
je     13a5 <main+0x1a5>
mov    %rax,%r14
xor    %ebx,%ebx
xor    %r12d,%r12d
xor    %r15d,%r15d
jmp    1378 <main+0x178>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    %r15,%rbx
mov    %rbx,%rdi
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
mov    %r14,%rdx
call   10a0 <memcpy@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    0x10(%rsp),%rcx
call   1040 <fread@plt>
mov    %rax,%r14
mov    %r13,%rbx
test   %rax,%rax
je     13ab <main+0x1ab>
lea    (%r14,%rbx,1),%r13
cmp    %r12,%r13
jb     1340 <main+0x140>
add    %r14,%r12
add    %r12,%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   10c0 <realloc@plt>
mov    %rax,%r15
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1080 <assert@plt>
jmp    1340 <main+0x140>
xor    %r15d,%r15d
xor    %r13d,%r13d
mov    0x10(%rsp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
call   1100 <init_rand@plt>
test   %ebp,%ebp
mov    0x8(%rsp),%r14
jg     141e <main+0x21e>
lea    0xc34(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1442 <main+0x242>
lea    0xc42(%rip),%rsi
mov    %r14,%rdi
call   10e0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    144c <main+0x24c>
lea    0xc25(%rip),%rsi
mov    $0x1,%edi
mov    %r14,%rdx
call   10b0 <err@plt>
xor    %ebx,%ebx
jmp    144c <main+0x24c>
nopl   0x0(%rax,%rax,1)
xor    %edx,%edx
div    %r13
mov    %bl,(%r15,%rdx,1)
add    $0xffffffff,%ebp
je     13c5 <main+0x1c5>
xor    %eax,%eax
call   1120 <rand@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1120 <rand@plt>
mov    %rax,%rcx
or     %r13,%rcx
shr    $0x20,%rcx
jne    1410 <main+0x210>
xor    %edx,%edx
div    %r13d
jmp    1415 <main+0x215>
mov    0x2b87(%rip),%rax
mov    (%rax),%rbx
mov    %r15,%rdi
mov    $0x1,%esi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1110 <fwrite@plt>
xor    %edi,%edi
cmp    %r13,%rax
sete   %dil
call   1080 <assert@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [8 x i8] c"hi:o:n:\00"
@optarg = global i8* null
@.str.2 = [21 x i8] c"illegal number -- %s\00"
@stdin = global i32* null
@.str.3 = [3 x i8] c"rb\00"
@.str.4 = [3 x i8] c"%s\00"
@stdout = global i32* null
@.str.5 = [3 x i8] c"wb\00"
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 i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %10
store i32 1024, i32* %11
br label %19
19: ; preds = %50, %2
%20 = load i32, i32* %4
%21 = load i8**, i8*** %5
%22 = call i32 @getopt(i32 %20, i8** %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 %22, i32* %13
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %51
24: ; preds = %19
%25 = load i32, i32* %13
switch i32 %25, label %48 [
i32 105, label %26
i32 110, label %28
i32 111, label %45
i32 104, label %47
i32 63, label %47
]
26: ; preds = %24
%27 = load i8*, i8** @optarg
store i8* %27, i8** %9
br label %50
28: ; preds = %24
%29 = load i8*, i8** @optarg
%30 = call i32 @strtol(i8* %29, i8** %12, i32 10)
store i32 %30, i32* %11
%31 = load i32, i32* %11
%32 = icmp slt i32 %31, 0
br i1 %32, label %38, label %33
33: ; preds = %28
%34 = load i8*, i8** %12
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %33, %28
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32 @warnx(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %41)
%43 = call i32 (...) @usage()
br label %44
44: ; preds = %38, %33
br label %50
45: ; preds = %24
%46 = load i8*, i8** @optarg
store i8* %46, i8** %10
br label %50
47: ; preds = %24, %24
br label %48
48: ; preds = %24, %47
%49 = call i32 (...) @usage()
br label %50
50: ; preds = %48, %45, %44, %26
br label %19
51: ; preds = %19
%52 = load i8*, i8** %9
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = load i32*, i32** @stdin
store i32* %56, i32** %6
br label %66
57: ; preds = %51
%58 = load i8*, i8** %9
%59 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %59, i32** %6
%60 = load i32*, i32** %6
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %65
62: ; preds = %57
%63 = load i8*, i8** %9
%64 = call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %63)
br label %65
65: ; preds = %62, %57
br label %66
66: ; preds = %65, %55
store i8* null, i8** %14
store i64 0, i64* %15
store i64 0, i64* %16
br label %67
67: ; preds = %89, %66
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%69 = load i32*, i32** %6
%70 = call i64 @fread(i8* %68, i32 1, i32 1024, i32* %69)
store i64 %70, i64* %17
%71 = icmp ne i64 %70, 0
br i1 %71, label %72, label %99
72: ; preds = %67
%73 = load i64, i64* %16
%74 = load i64, i64* %17
%75 = add i64 %73, %74
%76 = load i64, i64* %15
%77 = icmp uge i64 %75, %76
br i1 %77, label %78, label %89
78: ; preds = %72
%79 = load i64, i64* %15
%80 = load i64, i64* %17
%81 = add i64 %79, %80
%82 = mul i64 %81, 2
store i64 %82, i64* %15
%83 = load i8*, i8** %14
%84 = load i64, i64* %15
%85 = call i8* @realloc(i8* %83, i64 %84)
store i8* %85, i8** %14
%86 = icmp ne i8* %85, null
%87 = zext i1 %86 to i32
%88 = call i32 @assert(i32 %87)
br label %89
89: ; preds = %78, %72
%90 = load i8*, i8** %14
%91 = load i64, i64* %16
%92 = getelementptr inbounds i8, i8* %90, i64 %91
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%94 = load i64, i64* %17
%95 = call i32 @memcpy(i8* %92, i8* %93, i64 %94)
%96 = load i64, i64* %17
%97 = load i64, i64* %16
%98 = add i64 %97, %96
store i64 %98, i64* %16
br label %67
99: ; preds = %67
%100 = load i32*, i32** %6
%101 = call i32 @fclose(i32* %100)
%102 = call i32 (...) @init_rand()
store i32 0, i32* %8
br label %103
103: ; preds = %115, %99
%104 = load i32, i32* %8
%105 = load i32, i32* %11
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %118
107: ; preds = %103
%108 = call i64 (...) @rand()
%109 = trunc i64 %108 to i8
%110 = load i8*, i8** %14
%111 = call i64 (...) @rand()
%112 = load i64, i64* %16
%113 = urem i64 %111, %112
%114 = getelementptr inbounds i8, i8* %110, i64 %113
store i8 %109, i8* %114
br label %115
115: ; preds = %107
%116 = load i32, i32* %8
%117 = add nsw i32 %116, 1
store i32 %117, i32* %8
br label %103
118: ; preds = %103
%119 = load i8*, i8** %10
%120 = call i64 @strcmp(i8* %119, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%121 = icmp eq i64 %120, 0
br i1 %121, label %122, label %124
122: ; preds = %118
%123 = load i32*, i32** @stdout
store i32* %123, i32** %7
br label %133
124: ; preds = %118
%125 = load i8*, i8** %10
%126 = call i32* @fopen(i8* %125, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %126, i32** %7
%127 = load i32*, i32** %7
%128 = icmp eq i32* %127, null
br i1 %128, label %129, label %132
129: ; preds = %124
%130 = load i8*, i8** %10
%131 = call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %130)
br label %132
132: ; preds = %129, %124
br label %133
133: ; preds = %132, %122
%134 = load i8*, i8** %14
%135 = load i64, i64* %16
%136 = load i32*, i32** %7
%137 = call i64 @fwrite(i8* %134, i32 1, i64 %135, i32* %136)
%138 = load i64, i64* %16
%139 = icmp eq i64 %137, %138
%140 = zext i1 %139 to i32
%141 = call i32 @assert(i32 %140)
%142 = load i32*, i32** %7
%143 = call i32 @fclose(i32* %142)
%144 = load i8*, i8** %14
%145 = call i32 @free(i8* %144)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [8 x i8] c"hi:o:n:\00"
@optarg = global i8* null
@.str.2 = [21 x i8] c"illegal number -- %s\00"
@stdin = global i32* null
@.str.3 = [3 x i8] c"rb\00"
@.str.4 = [3 x i8] c"%s\00"
@stdout = global i32* null
@.str.5 = [3 x i8] c"wb\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = bitcast i8** %3 to i8*
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds i8*, i8** %1, i64 2
br label %8
8: ; preds = %19, %2
%9 = phi i8* [ %20, %19 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %2 ]
%10 = phi i8* [ %13, %19 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %2 ]
%11 = phi i32 [ %16, %19 ], [ 1024, %2 ]
br label %12
12: ; preds = %8, %34
%13 = phi i8* [ %10, %8 ], [ %35, %34 ]
%14 = phi i32 [ %11, %8 ], [ %16, %34 ]
br label %15
15: ; preds = %33, %12
%16 = phi i32 [ %14, %12 ], [ %23, %33 ]
br label %17
17: ; preds = %15, %36
%18 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
switch i32 %18, label %36 [
i32 -1, label %38
i32 105, label %19
i32 110, label %21
i32 111, label %34
]
19: ; preds = %17
%20 = load i8*, i8** @optarg
br label %8
21: ; preds = %17
%22 = load i8*, i8** @optarg
%23 = call i32 @strtol(i8* %22, i8** %3, i32 10)
%24 = icmp slt i32 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %33, label %29
29: ; preds = %25, %21
%30 = load i8*, i8** %7
%31 = tail call i32 @warnx(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = tail call i32 (...) @usage()
br label %33
33: ; preds = %29, %25
br label %15
34: ; preds = %17
%35 = load i8*, i8** @optarg
br label %12
36: ; preds = %17
%37 = tail call i32 (...) @usage()
br label %17
38: ; preds = %17
%39 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = load i32*, i32** @stdin
br label %48
43: ; preds = %38
%44 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
br label %48
48: ; preds = %43, %46, %41
%49 = phi i32* [ %42, %41 ], [ null, %46 ], [ %44, %43 ]
%50 = call i64 @fread(i8* %6, i32 1, i32 1024, i32* %49)
%51 = icmp eq i64 %50, 0
br i1 %51, label %73, label %52
52: ; preds = %48, %66
%53 = phi i64 [ %71, %66 ], [ %50, %48 ]
%54 = phi i64 [ %57, %66 ], [ 0, %48 ]
%55 = phi i64 [ %68, %66 ], [ 0, %48 ]
%56 = phi i8* [ %67, %66 ], [ null, %48 ]
%57 = add i64 %53, %54
%58 = icmp ult i64 %57, %55
br i1 %58, label %66, label %59
59: ; preds = %52
%60 = add i64 %53, %55
%61 = shl i64 %60, 1
%62 = call i8* @realloc(i8* %56, i64 %61)
%63 = icmp ne i8* %62, null
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
br label %66
66: ; preds = %59, %52
%67 = phi i8* [ %62, %59 ], [ %56, %52 ]
%68 = phi i64 [ %61, %59 ], [ %55, %52 ]
%69 = getelementptr inbounds i8, i8* %67, i64 %54
%70 = call i32 @memcpy(i8* %69, i8* %6, i64 %53)
%71 = call i64 @fread(i8* %6, i32 1, i32 1024, i32* %49)
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %52
73: ; preds = %66, %48
%74 = phi i8* [ null, %48 ], [ %67, %66 ]
%75 = phi i64 [ 0, %48 ], [ %57, %66 ]
%76 = call i32 @fclose(i32* %49)
%77 = call i32 (...) @init_rand()
%78 = icmp sgt i32 %16, 0
br i1 %78, label %79, label %88
79: ; preds = %73, %79
%80 = phi i32 [ %86, %79 ], [ 0, %73 ]
%81 = call i64 (...) @rand()
%82 = trunc i64 %81 to i8
%83 = call i64 (...) @rand()
%84 = urem i64 %83, %75
%85 = getelementptr inbounds i8, i8* %74, i64 %84
store i8 %82, i8* %85
%86 = add nuw nsw i32 %80, 1
%87 = icmp eq i32 %86, %16
br i1 %87, label %88, label %79
88: ; preds = %79, %73
%89 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %88
%92 = load i32*, i32** @stdout
br label %98
93: ; preds = %88
%94 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%95 = icmp eq i32* %94, null
br i1 %95, label %96, label %98
96: ; preds = %93
%97 = call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %13)
br label %98
98: ; preds = %93, %96, %91
%99 = phi i32* [ %92, %91 ], [ null, %96 ], [ %94, %93 ]
%100 = call i64 @fwrite(i8* %74, i32 1, i64 %75, i32* %99)
%101 = icmp eq i64 %100, %75
%102 = zext i1 %101 to i32
%103 = call i32 @assert(i32 %102)
%104 = call i32 @fclose(i32* %99)
%105 = call i32 @free(i8* %74)
ret i32 0
}