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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ perror(char *);
scalar_t__ putc(unsigned int, int /*<<< orphan*/ *);
int sscanf(char *, char *, unsigned int *, char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  FILE *f;
  int i;
  unsigned int size, iirandom, z, csum;
  char sizec, scratchc;
  if (3 > argc || 4 < argc) {
  usage:
    fprintf(stderr, "usage: %s filename length [seed]\n", argv[0]);
    exit(1);
  }
  f = fopen(argv[1], "rb");
  if (f) {
    fclose(f);
    fprintf(stderr, "File %s already exists\n", argv[1]);
    goto usage;
  }
  i = sscanf(argv[2], "%u%1c%1c", &size, &sizec, &scratchc);
  if (0 >= i || 2 < i)
    goto usage;
  if (2 == i)
    switch (sizec) {
    case 'G':
      size *= 1024;
    case 'M':
      size *= 1024;
    case 'k':
      size *= 1024;
      break;
    case 'b':
      size *= 512;
      break;
    default:
      goto usage;
    }
  iirandom = 0;
  if (4 == argc) {
    i = sscanf(argv[3], "%u%1c", &iirandom, &scratchc);
    if (0 >= i || 1 < i)
      goto usage;
  }
  f = fopen(argv[1], "wb");
  if (!f) {
    perror("fopen [create]");
    goto usage;
  }
  csum = 0;
  iirandom += 0x23164920;
  if (size > 4)
    i = size - 4;
  else
    i = size;
  for (; i > 0; i--) {
    iirandom = iirandom * 91 + 137;
    iirandom ^= iirandom >> 14 | iirandom << 7;
    z = (i ^ iirandom) & 0xff;
    csum += z;
    csum = (csum >> (z & 31)) ^ (csum << (32 - (z & 31)));
    if (0 > putc(z, f)) {
      perror("putc");
      fclose(f);
      exit(1);
    }
  }
  for (i = 4; i < size && i > 0; i--) {
    z = csum & 0xff;
    csum >>= 8;
    if (0 > putc(z, f)) {
      perror("putc");
      fclose(f);
      exit(1);
    }
  }
  fclose(f);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
jg     11a2 <main+0x32>
mov    $0x4,%eax
cmp    -0x8(%rbp),%eax
jge    11cd <main+0x5d>
jmp    11a7 <main+0x37>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xed6(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeda(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     121b <main+0xab>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xea8(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11a7 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xea7(%rip),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x2d(%rbp),%rcx
lea    -0x2e(%rbp),%r8
mov    $0x0,%al
call   1060 <sscanf@plt>
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
cmp    -0x1c(%rbp),%eax
jge    1259 <main+0xe9>
mov    $0x2,%eax
cmp    -0x1c(%rbp),%eax
jge    125e <main+0xee>
jmp    11a7 <main+0x37>
mov    $0x2,%eax
cmp    -0x1c(%rbp),%eax
jne    12ce <main+0x15e>
movsbl -0x2d(%rbp),%eax
add    $0xffffffb9,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x24,%eax
ja     12c4 <main+0x154>
mov    -0x38(%rbp),%rax
lea    0xd73(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x20(%rbp),%eax
shl    $0xa,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
shl    $0xa,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
shl    $0xa,%eax
mov    %eax,-0x20(%rbp)
jmp    12c9 <main+0x159>
mov    -0x20(%rbp),%eax
shl    $0x9,%eax
mov    %eax,-0x20(%rbp)
jmp    12c9 <main+0x159>
jmp    11a7 <main+0x37>
jmp    12ce <main+0x15e>
movl   $0x0,-0x24(%rbp)
mov    $0x4,%eax
cmp    -0x8(%rbp),%eax
jne    1327 <main+0x1b7>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xde8(%rip),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x2e(%rbp),%rcx
mov    $0x0,%al
call   1060 <sscanf@plt>
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
cmp    -0x1c(%rbp),%eax
jge    131d <main+0x1ad>
mov    $0x1,%eax
cmp    -0x1c(%rbp),%eax
jge    1322 <main+0x1b2>
jmp    11a7 <main+0x37>
jmp    1327 <main+0x1b7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdaa(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    135b <main+0x1eb>
lea    0xd92(%rip),%rdi
call   1080 <perror@plt>
jmp    11a7 <main+0x37>
movl   $0x0,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
add    $0x23164920,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x4,-0x20(%rbp)
jbe    1385 <main+0x215>
mov    -0x20(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x1c(%rbp)
jmp    138b <main+0x21b>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1390 <main+0x220>
cmpl   $0x0,-0x1c(%rbp)
jle    1441 <main+0x2d1>
imul   $0x5b,-0x24(%rbp),%eax
add    $0x89,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
shr    $0xe,%eax
mov    -0x24(%rbp),%ecx
shl    $0x7,%ecx
or     %ecx,%eax
xor    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
xor    -0x24(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x28(%rbp),%ecx
and    $0x1f,%ecx
shr    %cl,%eax
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%esi
and    $0x1f,%esi
mov    $0x20,%ecx
sub    %esi,%ecx
shl    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <putc@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    142e <main+0x2be>
lea    0xcdc(%rip),%rdi
call   1080 <perror@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1433 <main+0x2c3>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1390 <main+0x220>
movl   $0x4,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x20(%rbp),%ecx
mov    %al,-0x39(%rbp)
jae    1463 <main+0x2f3>
cmpl   $0x0,-0x1c(%rbp)
setg   %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    1473 <main+0x303>
jmp    14d3 <main+0x363>
mov    -0x2c(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
shr    $0x8,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <putc@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    14c0 <main+0x350>
lea    0xc4a(%rip),%rdi
call   1080 <perror@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    14c5 <main+0x355>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1448 <main+0x2d8>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
lea    -0x5(%rbx),%eax
cmp    $0xfffffffd,%eax
jbe    126a <main+0xfa>
mov    0x8(%r14),%rdi
lea    0xf20(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
jne    128c <main+0x11c>
mov    0x10(%r14),%rdi
lea    0xf22(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x13(%rsp),%rcx
lea    0x12(%rsp),%r8
xor    %eax,%eax
call   1060 <sscanf@plt>
lea    -0x3(%rax),%ecx
cmp    $0xfffffffe,%ecx
jb     126a <main+0xfa>
cmp    $0x2,%eax
jne    121b <main+0xab>
movsbl 0x13(%rsp),%eax
add    $0xffffffb9,%eax
cmp    $0x24,%eax
ja     126a <main+0xfa>
lea    0xe12(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0xc(%rsp),%eax
shl    $0xa,%eax
jmp    1204 <main+0x94>
mov    0xc(%rsp),%eax
shl    $0xa,%eax
jmp    1214 <main+0xa4>
shll   $0x9,0xc(%rsp)
jmp    121b <main+0xab>
mov    0xc(%rsp),%eax
shl    $0xa,%eax
mov    %eax,0xc(%rsp)
movl   $0x0,0x14(%rsp)
cmp    $0x4,%ebx
jne    1249 <main+0xd9>
mov    0x18(%r14),%rdi
lea    0xea7(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x12(%rsp),%rcx
xor    %eax,%eax
call   1060 <sscanf@plt>
cmp    $0x1,%eax
jne    126a <main+0xfa>
mov    0x8(%r14),%rdi
lea    0xe8c(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
jne    12af <main+0x13f>
lea    0xe7e(%rip),%rdi
call   1080 <perror@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe17(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xe11(%rip),%rsi
call   1050 <fprintf@plt>
jmp    126a <main+0xfa>
mov    %rax,%r15
mov    $0x23164920,%ecx
add    0x14(%rsp),%ecx
mov    %ecx,0x14(%rsp)
mov    0xc(%rsp),%eax
lea    -0x4(%rax),%r14d
cmp    $0x5,%eax
cmovb  %eax,%r14d
xor    %ebp,%ebp
test   %r14d,%r14d
jle    1356 <main+0x1e6>
imul   $0x5b,%ecx,%eax
add    $0x89,%eax
mov    %eax,%ecx
shr    $0xe,%ecx
mov    %eax,%ebx
shl    $0x7,%ebx
or     %ecx,%ebx
xor    %eax,%ebx
mov    %ebx,0x14(%rsp)
xor    %r14d,%ebx
movzbl %bl,%ebp
mov    %ebp,%edi
nopl   0x0(%rax,%rax,1)
mov    %r15,%rsi
call   1040 <putc@plt>
test   %rax,%rax
js     1391 <main+0x221>
mov    %ebp,%eax
mov    %ebx,%ecx
shr    %cl,%eax
and    $0x1f,%bl
neg    %bl
mov    %ebx,%ecx
shl    %cl,%ebp
xor    %eax,%ebp
cmp    $0x2,%r14d
jl     1352 <main+0x1e2>
add    $0xffffffff,%r14d
imul   $0x5b,0x14(%rsp),%eax
add    $0x89,%eax
mov    %eax,%ecx
shr    $0xe,%ecx
mov    %eax,%ebx
shl    $0x7,%ebx
or     %ecx,%ebx
xor    %eax,%ebx
mov    %ebx,0x14(%rsp)
xor    %r14d,%ebx
movzbl %bl,%edi
add    %edi,%ebp
jmp    1300 <main+0x190>
mov    0xc(%rsp),%eax
cmp    $0x5,%eax
jb     1382 <main+0x212>
mov    $0x4,%ebx
movzbl %bpl,%edi
mov    %r15,%rsi
call   1040 <putc@plt>
test   %rax,%rax
js     1391 <main+0x221>
cmp    $0x2,%ebx
jb     1382 <main+0x212>
shr    $0x8,%ebp
add    $0xffffffff,%ebx
cmp    0xc(%rsp),%ebx
jb     1360 <main+0x1f0>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xd5a(%rip),%rdi
call   1080 <perror@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"usage: %s filename length [seed]\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [24 x i8] c"File %s already exists\0A\00"
@.str.3 = [9 x i8] c"%u%1c%1c\00"
@.str.4 = [6 x i8] c"%u%1c\00"
@.str.5 = [3 x i8] c"wb\00"
@.str.6 = [15 x i8] c"fopen [create]\00"
@.str.7 = [5 x i8] c"putc\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 i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
%13 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp sgt i32 3, %14
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = load i32, i32* %4
%18 = icmp slt i32 4, %17
br i1 %18, label %19, label %27
19: ; preds = %16, %2
br label %20
20: ; preds = %95, %86, %71, %52, %34, %19
%21 = load i32, i32* @stderr
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %16
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %31, i32** %6
%32 = load i32*, i32** %6
%33 = icmp ne i32* %32, null
br i1 %33, label %34, label %42
34: ; preds = %27
%35 = load i32*, i32** %6
%36 = call i32 @fclose(i32* %35)
%37 = load i32, i32* @stderr
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %40)
br label %20
42: ; preds = %27
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 2
%45 = load i8*, i8** %44
%46 = call i32 (i8*, i8*, i32*, i8*, ...) @sscanf(i8* %45, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %8, i8* %12, i8* %13)
store i32 %46, i32* %7
%47 = load i32, i32* %7
%48 = icmp sge i32 0, %47
br i1 %48, label %52, label %49
49: ; preds = %42
%50 = load i32, i32* %7
%51 = icmp slt i32 2, %50
br i1 %51, label %52, label %53
52: ; preds = %49, %42
br label %20
53: ; preds = %49
%54 = load i32, i32* %7
%55 = icmp eq i32 2, %54
br i1 %55, label %56, label %73
56: ; preds = %53
%57 = load i8, i8* %12
%58 = sext i8 %57 to i32
switch i32 %58, label %71 [
i32 71, label %59
i32 77, label %62
i32 107, label %65
i32 98, label %68
]
59: ; preds = %56
%60 = load i32, i32* %8
%61 = mul i32 %60, 1024
store i32 %61, i32* %8
br label %62
62: ; preds = %56, %59
%63 = load i32, i32* %8
%64 = mul i32 %63, 1024
store i32 %64, i32* %8
br label %65
65: ; preds = %56, %62
%66 = load i32, i32* %8
%67 = mul i32 %66, 1024
store i32 %67, i32* %8
br label %72
68: ; preds = %56
%69 = load i32, i32* %8
%70 = mul i32 %69, 512
store i32 %70, i32* %8
br label %72
71: ; preds = %56
br label %20
72: ; preds = %68, %65
br label %73
73: ; preds = %72, %53
store i32 0, i32* %9
%74 = load i32, i32* %4
%75 = icmp eq i32 4, %74
br i1 %75, label %76, label %88
76: ; preds = %73
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 3
%79 = load i8*, i8** %78
%80 = call i32 (i8*, i8*, i32*, i8*, ...) @sscanf(i8* %79, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %9, i8* %13)
store i32 %80, i32* %7
%81 = load i32, i32* %7
%82 = icmp sge i32 0, %81
br i1 %82, label %86, label %83
83: ; preds = %76
%84 = load i32, i32* %7
%85 = icmp slt i32 1, %84
br i1 %85, label %86, label %87
86: ; preds = %83, %76
br label %20
87: ; preds = %83
br label %88
88: ; preds = %87, %73
%89 = load i8**, i8*** %5
%90 = getelementptr inbounds i8*, i8** %89, i64 1
%91 = load i8*, i8** %90
%92 = call i32* @fopen(i8* %91, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %92, i32** %6
%93 = load i32*, i32** %6
%94 = icmp ne i32* %93, null
br i1 %94, label %97, label %95
95: ; preds = %88
%96 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %20
97: ; preds = %88
store i32 0, i32* %11
%98 = load i32, i32* %9
%99 = add i32 %98, 588663072
store i32 %99, i32* %9
%100 = load i32, i32* %8
%101 = icmp ugt i32 %100, 4
br i1 %101, label %102, label %105
102: ; preds = %97
%103 = load i32, i32* %8
%104 = sub i32 %103, 4
store i32 %104, i32* %7
br label %107
105: ; preds = %97
%106 = load i32, i32* %8
store i32 %106, i32* %7
br label %107
107: ; preds = %105, %102
br label %108
108: ; preds = %149, %107
%109 = load i32, i32* %7
%110 = icmp sgt i32 %109, 0
br i1 %110, label %111, label %152
111: ; preds = %108
%112 = load i32, i32* %9
%113 = mul i32 %112, 91
%114 = add i32 %113, 137
store i32 %114, i32* %9
%115 = load i32, i32* %9
%116 = lshr i32 %115, 14
%117 = load i32, i32* %9
%118 = shl i32 %117, 7
%119 = or i32 %116, %118
%120 = load i32, i32* %9
%121 = xor i32 %120, %119
store i32 %121, i32* %9
%122 = load i32, i32* %7
%123 = load i32, i32* %9
%124 = xor i32 %122, %123
%125 = and i32 %124, 255
store i32 %125, i32* %10
%126 = load i32, i32* %10
%127 = load i32, i32* %11
%128 = add i32 %127, %126
store i32 %128, i32* %11
%129 = load i32, i32* %11
%130 = load i32, i32* %10
%131 = and i32 %130, 31
%132 = lshr i32 %129, %131
%133 = load i32, i32* %11
%134 = load i32, i32* %10
%135 = and i32 %134, 31
%136 = sub i32 32, %135
%137 = shl i32 %133, %136
%138 = xor i32 %132, %137
store i32 %138, i32* %11
%139 = load i32, i32* %10
%140 = load i32*, i32** %6
%141 = call i64 @putc(i32 %139, i32* %140)
%142 = icmp sgt i64 0, %141
br i1 %142, label %143, label %148
143: ; preds = %111
%144 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%145 = load i32*, i32** %6
%146 = call i32 @fclose(i32* %145)
%147 = call i32 @exit(i32 1)
unreachable
148: ; preds = %111
br label %149
149: ; preds = %148
%150 = load i32, i32* %7
%151 = add nsw i32 %150, -1
store i32 %151, i32* %7
br label %108
152: ; preds = %108
store i32 4, i32* %7
br label %153
153: ; preds = %177, %152
%154 = load i32, i32* %7
%155 = load i32, i32* %8
%156 = icmp ult i32 %154, %155
br i1 %156, label %157, label %160
157: ; preds = %153
%158 = load i32, i32* %7
%159 = icmp sgt i32 %158, 0
br label %160
160: ; preds = %157, %153
%161 = phi i1 [ false, %153 ], [ %159, %157 ]
br i1 %161, label %162, label %180
162: ; preds = %160
%163 = load i32, i32* %11
%164 = and i32 %163, 255
store i32 %164, i32* %10
%165 = load i32, i32* %11
%166 = lshr i32 %165, 8
store i32 %166, i32* %11
%167 = load i32, i32* %10
%168 = load i32*, i32** %6
%169 = call i64 @putc(i32 %167, i32* %168)
%170 = icmp sgt i64 0, %169
br i1 %170, label %171, label %176
171: ; preds = %162
%172 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%173 = load i32*, i32** %6
%174 = call i32 @fclose(i32* %173)
%175 = call i32 @exit(i32 1)
unreachable
176: ; preds = %162
br label %177
177: ; preds = %176
%178 = load i32, i32* %7
%179 = add nsw i32 %178, -1
store i32 %179, i32* %7
br label %153
180: ; preds = %160
%181 = load i32*, i32** %6
%182 = call i32 @fclose(i32* %181)
%183 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"usage: %s filename length [seed]\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [24 x i8] c"File %s already exists\0A\00"
@.str.3 = [9 x i8] c"%u%1c%1c\00"
@.str.4 = [6 x i8] c"%u%1c\00"
@.str.5 = [3 x i8] c"wb\00"
@.str.6 = [15 x i8] c"fopen [create]\00"
@.str.7 = [5 x i8] c"putc\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = add i32 %0, -5
%10 = icmp ult i32 %9, -2
br i1 %10, label %11, label %16
11: ; preds = %55, %34, %26, %2, %64, %21
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %1
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %26, label %21
21: ; preds = %16
%22 = tail call i32 @fclose(i32* %19)
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %17
%25 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %11
26: ; preds = %16
%27 = getelementptr inbounds i8*, i8** %1, i64 2
%28 = load i8*, i8** %27
%29 = call i32 (i8*, i8*, i32*, i8*, ...) @sscanf(i8* %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %3, i8* %5, i8* %6)
%30 = add i32 %29, -3
%31 = icmp ult i32 %30, -2
br i1 %31, label %11, label %32
32: ; preds = %26
%33 = icmp eq i32 %29, 2
br i1 %33, label %34, label %53
34: ; preds = %32
%35 = load i8, i8* %5
%36 = sext i8 %35 to i32
switch i32 %36, label %11 [
i32 71, label %41
i32 77, label %39
i32 107, label %37
i32 98, label %50
]
37: ; preds = %34
%38 = load i32, i32* %3
br label %47
39: ; preds = %34
%40 = load i32, i32* %3
br label %44
41: ; preds = %34
%42 = load i32, i32* %3
%43 = shl i32 %42, 10
br label %44
44: ; preds = %39, %41
%45 = phi i32 [ %40, %39 ], [ %43, %41 ]
%46 = shl i32 %45, 10
br label %47
47: ; preds = %37, %44
%48 = phi i32 [ %38, %37 ], [ %46, %44 ]
%49 = shl i32 %48, 10
store i32 %49, i32* %3
br label %53
50: ; preds = %34
%51 = load i32, i32* %3
%52 = shl i32 %51, 9
store i32 %52, i32* %3
br label %53
53: ; preds = %47, %50, %32
store i32 0, i32* %4
%54 = icmp eq i32 %0, 4
br i1 %54, label %55, label %60
55: ; preds = %53
%56 = getelementptr inbounds i8*, i8** %1, i64 3
%57 = load i8*, i8** %56
%58 = call i32 (i8*, i8*, i32*, i8*, ...) @sscanf(i8* %57, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %4, i8* %6)
%59 = icmp eq i32 %58, 1
br i1 %59, label %60, label %11
60: ; preds = %55, %53
%61 = load i8*, i8** %17
%62 = call i32* @fopen(i8* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%63 = icmp eq i32* %62, null
br i1 %63, label %64, label %66
64: ; preds = %60
%65 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %11
66: ; preds = %60
%67 = load i32, i32* %4
%68 = add i32 %67, 588663072
store i32 %68, i32* %4
%69 = load i32, i32* %3
%70 = icmp ugt i32 %69, 4
%71 = add i32 %69, -4
%72 = select i1 %70, i32 %71, i32 %69
%73 = icmp sgt i32 %72, 0
br i1 %73, label %74, label %87
74: ; preds = %66
%75 = mul i32 %68, 91
%76 = add i32 %75, 137
%77 = lshr i32 %76, 14
%78 = shl i32 %76, 7
%79 = or i32 %77, %78
%80 = xor i32 %79, %76
store i32 %80, i32* %4
%81 = xor i32 %80, %72
%82 = and i32 %81, 255
%83 = call i64 @putc(i32 %82, i32* %62)
%84 = icmp slt i64 %83, 0
br i1 %84, label %91, label %95
85: ; preds = %95
%86 = load i32, i32* %3
br label %87
87: ; preds = %85, %66
%88 = phi i32 [ %69, %66 ], [ %86, %85 ]
%89 = phi i32 [ 0, %66 ], [ %103, %85 ]
%90 = icmp ugt i32 %88, 4
br i1 %90, label %119, label %136
91: ; preds = %105, %74
%92 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%93 = call i32 @fclose(i32* %62)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %74, %105
%96 = phi i32 [ %114, %105 ], [ %81, %74 ]
%97 = phi i32 [ %116, %105 ], [ %82, %74 ]
%98 = phi i32 [ %106, %105 ], [ %72, %74 ]
%99 = and i32 %96, 31
%100 = lshr i32 %97, %99
%101 = sub nuw nsw i32 32, %99
%102 = shl i32 %97, %101
%103 = xor i32 %100, %102
%104 = icmp sgt i32 %98, 1
br i1 %104, label %105, label %85
105: ; preds = %95
%106 = add nsw i32 %98, -1
%107 = load i32, i32* %4
%108 = mul i32 %107, 91
%109 = add i32 %108, 137
%110 = lshr i32 %109, 14
%111 = shl i32 %109, 7
%112 = or i32 %110, %111
%113 = xor i32 %112, %109
store i32 %113, i32* %4
%114 = xor i32 %113, %106
%115 = and i32 %114, 255
%116 = add i32 %115, %103
%117 = call i64 @putc(i32 %115, i32* %62)
%118 = icmp slt i64 %117, 0
br i1 %118, label %91, label %95
119: ; preds = %87, %129
%120 = phi i32 [ %130, %129 ], [ %89, %87 ]
%121 = phi i32 [ %131, %129 ], [ 4, %87 ]
%122 = and i32 %120, 255
%123 = call i64 @putc(i32 %122, i32* %62)
%124 = icmp slt i64 %123, 0
br i1 %124, label %125, label %129
125: ; preds = %119
%126 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%127 = call i32 @fclose(i32* %62)
%128 = call i32 @exit(i32 1)
unreachable
129: ; preds = %119
%130 = lshr i32 %120, 8
%131 = add nsw i32 %121, -1
%132 = load i32, i32* %3
%133 = icmp ult i32 %131, %132
%134 = icmp ugt i32 %121, 1
%135 = and i1 %134, %133
br i1 %135, label %119, label %136
136: ; preds = %129, %87
%137 = call i32 @fclose(i32* %62)
%138 = call i32 @exit(i32 0)
unreachable
}