#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*/ _chdir(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
size_t fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(unsigned char *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ show_help();
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ *stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *in_dir, *out_file;
  FILE *fp_in, *fp_out;
  char in_file[16];
  unsigned char buf[2048];
  int i;
  size_t dw;
  int digs;
  in_dir = (argc < 2) ? "" : argv[1];
  out_file = (argc < 3) ? "nscript.dat" : argv[2];
  if (strcmp(out_file, "-"))
    fp_out = fopen(out_file, "wb");
  else
    fp_out = stdout;
  if (!fp_out) {
    printf("Cannot open output file %s!!!", out_file);
    return -1;
  }
  _chdir(in_dir);
  fp_in = fopen("0.txt", "rt");
  if (!fp_in) {
    fp_in = fopen("00.txt", "rt");
    if (!fp_in) {
      fp_in = fopen("000.txt", "rt");
      if (!fp_in) {
        show_help();
        return -1;
      } else
        digs = 3;
    } else
      digs = 2;
  } else
    digs = 1;
  i = 0;
  while (fp_in) {
    while (!feof(fp_in)) {
      dw = fread(buf, 1, 2048, fp_in);
      for (i = 0; i < dw; i++) {
        buf[i] ^= 0x84;
      }
      fwrite(buf, 1, dw, fp_out);
    }
    fputc('\n', fp_out);
    fclose(fp_in);
    switch (digs) {
    case 1:
      sprintf(in_file, "%d", i);
      break;
    case 2:
      sprintf(in_file, "%02d", i);
      break;
    case 3:
      sprintf(in_file, "%03d", i);
      break;
    default:
      in_file[0] = 0;
    }
    fp_in = fopen(in_file, "rt");
  }
  fclose(fp_out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x870,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11e6 <main+0x36>
lea    0xe54(%rip),%rax
mov    %rax,-0x860(%rbp)
jmp    11f5 <main+0x45>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x860(%rbp)
mov    -0x860(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    121d <main+0x6d>
lea    0xdef(%rip),%rax
mov    %rax,-0x868(%rbp)
jmp    122c <main+0x7c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x868(%rbp)
mov    -0x868(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     126a <main+0xba>
mov    -0x20(%rbp),%rdi
lea    0xdb2(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
jmp    1278 <main+0xc8>
mov    0x2d6f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    129f <main+0xef>
mov    -0x20(%rbp),%rsi
lea    0xd83(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14e8 <main+0x338>
mov    -0x18(%rbp),%rdi
call   10b0 <_chdir@plt>
lea    0xd85(%rip),%rdi
lea    0xd79(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    133f <main+0x18f>
lea    0xd62(%rip),%rdi
lea    0xd57(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1330 <main+0x180>
lea    0xd3f(%rip),%rdi
lea    0xd35(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1321 <main+0x171>
mov    $0x0,%al
call   1090 <show_help@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14e8 <main+0x338>
movl   $0x3,-0x854(%rbp)
jmp    133a <main+0x18a>
movl   $0x2,-0x854(%rbp)
jmp    1349 <main+0x199>
movl   $0x1,-0x854(%rbp)
movl   $0x0,-0x844(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     14d8 <main+0x328>
jmp    1363 <main+0x1b3>
mov    -0x28(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1381 <main+0x1d1>
jmp    1411 <main+0x261>
lea    -0x840(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
mov    $0x800,%edx
call   1030 <fread@plt>
mov    %rax,-0x850(%rbp)
movl   $0x0,-0x844(%rbp)
movslq -0x844(%rbp),%rax
cmp    -0x850(%rbp),%rax
jae    13f0 <main+0x240>
movslq -0x844(%rbp),%rax
movzbl -0x840(%rbp,%rax,1),%ecx
ff
xor    $0x84,%ecx
mov    %cl,-0x840(%rbp,%rax,1)
mov    -0x844(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x844(%rbp)
jmp    13ac <main+0x1fc>
lea    -0x840(%rbp),%rdi
mov    -0x850(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    $0x1,%esi
call   10d0 <fwrite@plt>
jmp    1363 <main+0x1b3>
mov    -0x30(%rbp),%rsi
mov    $0xa,%edi
call   1060 <fputc@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x854(%rbp),%eax
mov    %eax,-0x86c(%rbp)
sub    $0x1,%eax
je     146a <main+0x2ba>
jmp    1442 <main+0x292>
mov    -0x86c(%rbp),%eax
sub    $0x2,%eax
je     1485 <main+0x2d5>
jmp    1456 <main+0x2a6>
mov    -0x86c(%rbp),%eax
sub    $0x3,%eax
je     14a0 <main+0x2f0>
jmp    14bb <main+0x30b>
lea    -0x40(%rbp),%rdi
mov    -0x844(%rbp),%edx
lea    0xbbf(%rip),%rsi
call   10c0 <sprintf@plt>
jmp    14bf <main+0x30f>
lea    -0x40(%rbp),%rdi
mov    -0x844(%rbp),%edx
lea    0xba7(%rip),%rsi
call   10c0 <sprintf@plt>
jmp    14bf <main+0x30f>
lea    -0x40(%rbp),%rdi
mov    -0x844(%rbp),%edx
lea    0xb91(%rip),%rsi
call   10c0 <sprintf@plt>
jmp    14bf <main+0x30f>
movb   $0x0,-0x40(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xb65(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
jmp    1353 <main+0x1a3>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x870,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x818,%rsp
lea    0xe48(%rip),%rbx
cmp    $0x2,%edi
jge    11d6 <main+0x26>
lea    0xe6a(%rip),%rbp
jmp    11e0 <main+0x30>
mov    0x8(%rsi),%rbp
je     11e0 <main+0x30>
mov    0x10(%rsi),%rbx
lea    0xe35(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1236 <main+0x86>
lea    0xe23(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r14
test   %r14,%r14
je     1245 <main+0x95>
mov    %rbp,%rdi
call   10b0 <_chdir@plt>
lea    0xe2a(%rip),%rdi
lea    0xe1e(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     125e <main+0xae>
mov    %rax,%rbp
mov    $0x1,%r13d
jmp    12a6 <main+0xf6>
mov    0x2da3(%rip),%rax
mov    (%rax),%r14
test   %r14,%r14
jne    120b <main+0x5b>
lea    0xdd5(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    $0xffffffff,%eax
jmp    149d <main+0x2ed>
lea    0xdde(%rip),%rdi
lea    0xdd3(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1281 <main+0xd1>
mov    %rax,%rbp
mov    $0x2,%r13d
jmp    12a6 <main+0xf6>
lea    0xdba(%rip),%rdi
lea    0xdb0(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     14af <main+0x2ff>
mov    %rax,%rbp
mov    $0x3,%r13d
xor    %r15d,%r15d
lea    0x10(%rsp),%rbx
movabs $0x8484848484848484,%r12
84 84 84
jmp    12d6 <main+0x126>
nopw   0x0(%rax,%rax,1)
mov    %eax,%r15d
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
mov    %r14,%rcx
call   10d0 <fwrite@plt>
mov    %rbp,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    13f3 <main+0x243>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x800,%edx
mov    %rbp,%rcx
call   1030 <fread@plt>
test   %rax,%rax
je     1310 <main+0x160>
cmp    $0x8,%rax
jae    1320 <main+0x170>
xor    %ecx,%ecx
jmp    1480 <main+0x2d0>
nopl   (%rax)
xor    %r15d,%r15d
jmp    12c3 <main+0x113>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x20,%rax
movaps 0xcd5(%rip),%xmm2
jae    1334 <main+0x184>
xor    %ecx,%ecx
jmp    13ce <main+0x21e>
mov    %rax,%rcx
and    $0xffffffffffffffe0,%rcx
lea    -0x20(%rcx),%rsi
mov    %rsi,%rdx
shr    $0x5,%rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     1429 <main+0x279>
mov    %rdx,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
nopl   0x0(%rax)
movaps 0x10(%rsp,%rsi,1),%xmm0
xorps  %xmm2,%xmm0
movaps 0x20(%rsp,%rsi,1),%xmm1
xorps  %xmm2,%xmm1
movaps %xmm0,0x10(%rsp,%rsi,1)
movaps %xmm1,0x20(%rsp,%rsi,1)
movaps 0x30(%rsp,%rsi,1),%xmm0
xorps  %xmm2,%xmm0
movaps 0x40(%rsp,%rsi,1),%xmm1
xorps  %xmm2,%xmm1
movaps %xmm0,0x30(%rsp,%rsi,1)
movaps %xmm1,0x40(%rsp,%rsi,1)
add    $0x40,%rsi
add    $0xfffffffffffffffe,%rdi
jne    1360 <main+0x1b0>
test   $0x1,%dl
je     13bd <main+0x20d>
movaps 0x10(%rsp,%rsi,1),%xmm0
xorps  %xmm2,%xmm0
movaps 0x20(%rsp,%rsi,1),%xmm1
xorps  %xmm2,%xmm1
movaps %xmm0,0x10(%rsp,%rsi,1)
movaps %xmm1,0x20(%rsp,%rsi,1)
cmp    %rcx,%rax
je     12c0 <main+0x110>
test   $0x18,%al
je     1480 <main+0x2d0>
mov    %rcx,%rdx
mov    %rax,%rcx
and    $0xfffffffffffffff8,%rcx
nopl   0x0(%rax,%rax,1)
xor    %r12,0x10(%rsp,%rdx,1)
add    $0x8,%rdx
cmp    %rdx,%rcx
jne    13e0 <main+0x230>
jmp    1489 <main+0x2d9>
mov    $0xa,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
cmp    $0x3,%r13d
je     1436 <main+0x286>
cmp    $0x2,%r13d
je     1445 <main+0x295>
cmp    $0x1,%r13d
mov    %rsp,%rbp
jne    145c <main+0x2ac>
mov    %rbp,%rdi
lea    0xc23(%rip),%rsi
jmp    1452 <main+0x2a2>
xor    %esi,%esi
test   $0x1,%dl
jne    13a3 <main+0x1f3>
jmp    13bd <main+0x20d>
mov    %rsp,%rbp
mov    %rbp,%rdi
lea    0xc0f(%rip),%rsi
jmp    1452 <main+0x2a2>
mov    %rsp,%rbp
mov    %rbp,%rdi
lea    0xbfb(%rip),%rsi
mov    %r15d,%edx
call   10c0 <sprintf@plt>
jmp    1460 <main+0x2b0>
movb   $0x0,(%rsp)
mov    %rbp,%rdi
lea    0xbd5(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    12d6 <main+0x126>
jmp    1493 <main+0x2e3>
nopl   (%rax)
xorb   $0x84,0x10(%rsp,%rcx,1)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1480 <main+0x2d0>
jmp    12c0 <main+0x110>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1090 <show_help@plt>
mov    $0xffffffff,%eax
jmp    149d <main+0x2ed>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [12 x i8] c"nscript.dat\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [3 x i8] c"wb\00"
@stdout = global i32* null
@.str.4 = [30 x i8] c"Cannot open output file %s!!!\00"
@.str.5 = [6 x i8] c"0.txt\00"
@.str.6 = [3 x i8] c"rt\00"
@.str.7 = [7 x i8] c"00.txt\00"
@.str.8 = [8 x i8] c"000.txt\00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [5 x i8] c"%02d\00"
@.str.11 = [5 x i8] c"%03d\00"
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 [16 x i8]
%11 = alloca [2048 x i8]
%12 = alloca i32
%13 = alloca i64
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %18
17: ; preds = %2
br label %22
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
br label %22
22: ; preds = %18, %17
%23 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %17 ], [ %21, %18 ]
store i8* %23, i8** %6
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 3
br i1 %25, label %26, label %27
26: ; preds = %22
br label %31
27: ; preds = %22
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
br label %31
31: ; preds = %27, %26
%32 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %26 ], [ %30, %27 ]
store i8* %32, i8** %7
%33 = load i8*, i8** %7
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = load i8*, i8** %7
%38 = call i32* @fopen(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %38, i32** %9
br label %41
39: ; preds = %31
%40 = load i32*, i32** @stdout
store i32* %40, i32** %9
br label %41
41: ; preds = %39, %36
%42 = load i32*, i32** %9
%43 = icmp ne i32* %42, null
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = load i8*, i8** %7
%46 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %45)
store i32 -1, i32* %3
br label %129
47: ; preds = %41
%48 = load i8*, i8** %6
%49 = call i32 @_chdir(i8* %48)
%50 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %50, i32** %8
%51 = load i32*, i32** %8
%52 = icmp ne i32* %51, null
br i1 %52, label %67, label %53
53: ; preds = %47
%54 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %54, i32** %8
%55 = load i32*, i32** %8
%56 = icmp ne i32* %55, null
br i1 %56, label %65, label %57
57: ; preds = %53
%58 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %58, i32** %8
%59 = load i32*, i32** %8
%60 = icmp ne i32* %59, null
br i1 %60, label %63, label %61
61: ; preds = %57
%62 = call i32 (...) @show_help()
store i32 -1, i32* %3
br label %129
63: ; preds = %57
store i32 3, i32* %14
br label %64
64: ; preds = %63
br label %66
65: ; preds = %53
store i32 2, i32* %14
br label %66
66: ; preds = %65, %64
br label %68
67: ; preds = %47
store i32 1, i32* %14
br label %68
68: ; preds = %67, %66
store i32 0, i32* %12
br label %69
69: ; preds = %123, %68
%70 = load i32*, i32** %8
%71 = icmp ne i32* %70, null
br i1 %71, label %72, label %126
72: ; preds = %69
br label %73
73: ; preds = %98, %72
%74 = load i32*, i32** %8
%75 = call i32 @feof(i32* %74)
%76 = icmp ne i32 %75, 0
%77 = xor i1 %76, true
br i1 %77, label %78, label %103
78: ; preds = %73
%79 = getelementptr inbounds [2048 x i8], [2048 x i8]* %11, i64 0, i64 0
%80 = load i32*, i32** %8
%81 = call i64 @fread(i8* %79, i32 1, i32 2048, i32* %80)
store i64 %81, i64* %13
store i32 0, i32* %12
br label %82
82: ; preds = %95, %78
%83 = load i32, i32* %12
%84 = sext i32 %83 to i64
%85 = load i64, i64* %13
%86 = icmp ult i64 %84, %85
br i1 %86, label %87, label %98
87: ; preds = %82
%88 = load i32, i32* %12
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [2048 x i8], [2048 x i8]* %11, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = zext i8 %91 to i32
%93 = xor i32 %92, 132
%94 = trunc i32 %93 to i8
store i8 %94, i8* %90
br label %95
95: ; preds = %87
%96 = load i32, i32* %12
%97 = add nsw i32 %96, 1
store i32 %97, i32* %12
br label %82
98: ; preds = %82
%99 = getelementptr inbounds [2048 x i8], [2048 x i8]* %11, i64 0, i64 0
%100 = load i64, i64* %13
%101 = load i32*, i32** %9
%102 = call i32 @fwrite(i8* %99, i32 1, i64 %100, i32* %101)
br label %73
103: ; preds = %73
%104 = load i32*, i32** %9
%105 = call i32 @fputc(i8 signext 10, i32* %104)
%106 = load i32*, i32** %8
%107 = call i32 @fclose(i32* %106)
%108 = load i32, i32* %14
switch i32 %108, label %121 [
i32 1, label %109
i32 2, label %113
i32 3, label %117
]
109: ; preds = %103
%110 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%111 = load i32, i32* %12
%112 = call i32 @sprintf(i8* %110, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %111)
br label %123
113: ; preds = %103
%114 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%115 = load i32, i32* %12
%116 = call i32 @sprintf(i8* %114, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 %115)
br label %123
117: ; preds = %103
%118 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%119 = load i32, i32* %12
%120 = call i32 @sprintf(i8* %118, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 %119)
br label %123
121: ; preds = %103
%122 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
store i8 0, i8* %122
br label %123
123: ; preds = %121, %117, %113, %109
%124 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%125 = call i32* @fopen(i8* %124, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %125, i32** %8
br label %69
126: ; preds = %69
%127 = load i32*, i32** %9
%128 = call i32 @fclose(i32* %127)
store i32 0, i32* %3
br label %129
129: ; preds = %126, %61, %44
%130 = load i32, i32* %3
ret i32 %130
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [12 x i8] c"nscript.dat\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [3 x i8] c"wb\00"
@stdout = global i32* null
@.str.4 = [30 x i8] c"Cannot open output file %s!!!\00"
@.str.5 = [6 x i8] c"0.txt\00"
@.str.6 = [3 x i8] c"rt\00"
@.str.7 = [7 x i8] c"00.txt\00"
@.str.8 = [8 x i8] c"000.txt\00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [5 x i8] c"%02d\00"
@.str.11 = [5 x i8] c"%03d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = alloca [2048 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %15, label %8
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i32 %0, 2
br i1 %11, label %15, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
br label %15
15: ; preds = %2, %8, %12
%16 = phi i8* [ %10, %12 ], [ %10, %8 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%17 = phi i8* [ %14, %12 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %8 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %2 ]
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %15
%21 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %24
22: ; preds = %15
%23 = load i32*, i32** @stdout
br label %24
24: ; preds = %22, %20
%25 = phi i32* [ %21, %20 ], [ %23, %22 ]
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %17)
br label %157
29: ; preds = %24
%30 = tail call i32 @_chdir(i8* %16)
%31 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %41
33: ; preds = %29
%34 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = tail call i32 (...) @show_help()
br label %157
41: ; preds = %36, %33, %29
%42 = phi i32* [ %37, %36 ], [ %34, %33 ], [ %31, %29 ]
%43 = phi i32 [ 3, %36 ], [ 2, %33 ], [ 1, %29 ]
br label %44
44: ; preds = %41, %152
%45 = phi i32 [ %142, %152 ], [ 0, %41 ]
%46 = phi i32* [ %153, %152 ], [ %42, %41 ]
%47 = tail call i32 @feof(i32* %46)
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %141
49: ; preds = %44, %136
%50 = call i64 @fread(i8* %6, i32 1, i32 2048, i32* %46)
%51 = icmp eq i64 %50, 0
br i1 %51, label %136, label %52
52: ; preds = %49
%53 = icmp ult i64 %50, 8
br i1 %53, label %125, label %54
54: ; preds = %52
%55 = icmp ult i64 %50, 32
br i1 %55, label %111, label %56
56: ; preds = %54
%57 = and i64 %50, -32
%58 = add i64 %57, -32
%59 = lshr exact i64 %58, 5
%60 = add nuw nsw i64 %59, 1
%61 = and i64 %60, 1
%62 = icmp eq i64 %58, 0
br i1 %62, label %92, label %63
63: ; preds = %56
%64 = and i64 %60, 1152921504606846974
br label %65
65: ; preds = %65, %63
%66 = phi i64 [ 0, %63 ], [ %89, %65 ]
%67 = phi i64 [ 0, %63 ], [ %90, %65 ]
%68 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %66
%69 = bitcast i8* %68 to <16 x i8>*
%70 = load <16 x i8>, <16 x i8>* %69
%71 = getelementptr inbounds i8, i8* %68, i64 16
%72 = bitcast i8* %71 to <16 x i8>*
%73 = load <16 x i8>, <16 x i8>* %72
%74 = xor <16 x i8> %70, <i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124>
%75 = xor <16 x i8> %73, <i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124>
%76 = bitcast i8* %68 to <16 x i8>*
store <16 x i8> %74, <16 x i8>* %76
%77 = bitcast i8* %71 to <16 x i8>*
store <16 x i8> %75, <16 x i8>* %77
%78 = or i64 %66, 32
%79 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %78
%80 = bitcast i8* %79 to <16 x i8>*
%81 = load <16 x i8>, <16 x i8>* %80
%82 = getelementptr inbounds i8, i8* %79, i64 16
%83 = bitcast i8* %82 to <16 x i8>*
%84 = load <16 x i8>, <16 x i8>* %83
%85 = xor <16 x i8> %81, <i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124>
%86 = xor <16 x i8> %84, <i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124>
%87 = bitcast i8* %79 to <16 x i8>*
store <16 x i8> %85, <16 x i8>* %87
%88 = bitcast i8* %82 to <16 x i8>*
store <16 x i8> %86, <16 x i8>* %88
%89 = add nuw i64 %66, 64
%90 = add i64 %67, 2
%91 = icmp eq i64 %90, %64
br i1 %91, label %92, label %65
92: ; preds = %65, %56
%93 = phi i64 [ 0, %56 ], [ %89, %65 ]
%94 = icmp eq i64 %61, 0
br i1 %94, label %106, label %95
95: ; preds = %92
%96 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %93
%97 = bitcast i8* %96 to <16 x i8>*
%98 = load <16 x i8>, <16 x i8>* %97
%99 = getelementptr inbounds i8, i8* %96, i64 16
%100 = bitcast i8* %99 to <16 x i8>*
%101 = load <16 x i8>, <16 x i8>* %100
%102 = xor <16 x i8> %98, <i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124>
%103 = xor <16 x i8> %101, <i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124>
%104 = bitcast i8* %96 to <16 x i8>*
store <16 x i8> %102, <16 x i8>* %104
%105 = bitcast i8* %99 to <16 x i8>*
store <16 x i8> %103, <16 x i8>* %105
br label %106
106: ; preds = %92, %95
%107 = icmp eq i64 %50, %57
br i1 %107, label %134, label %108
108: ; preds = %106
%109 = and i64 %50, 24
%110 = icmp eq i64 %109, 0
br i1 %110, label %125, label %111
111: ; preds = %54, %108
%112 = phi i64 [ %57, %108 ], [ 0, %54 ]
%113 = and i64 %50, -8
br label %114
114: ; preds = %114, %111
%115 = phi i64 [ %112, %111 ], [ %121, %114 ]
%116 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %115
%117 = bitcast i8* %116 to <8 x i8>*
%118 = load <8 x i8>, <8 x i8>* %117
%119 = xor <8 x i8> %118, <i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124, i8 -124>
%120 = bitcast i8* %116 to <8 x i8>*
store <8 x i8> %119, <8 x i8>* %120
%121 = add nuw i64 %115, 8
%122 = icmp eq i64 %121, %113
br i1 %122, label %123, label %114
123: ; preds = %114
%124 = icmp eq i64 %50, %113
br i1 %124, label %134, label %125
125: ; preds = %52, %108, %123
%126 = phi i64 [ 0, %52 ], [ %57, %108 ], [ %113, %123 ]
br label %127
127: ; preds = %125, %127
%128 = phi i64 [ %132, %127 ], [ %126, %125 ]
%129 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %128
%130 = load i8, i8* %129
%131 = xor i8 %130, -124
store i8 %131, i8* %129
%132 = add nuw nsw i64 %128, 1
%133 = icmp eq i64 %132, %50
br i1 %133, label %134, label %127
134: ; preds = %127, %123, %106
%135 = trunc i64 %50 to i32
br label %136
136: ; preds = %134, %49
%137 = phi i32 [ 0, %49 ], [ %135, %134 ]
%138 = call i32 @fwrite(i8* %6, i32 1, i64 %50, i32* %25)
%139 = tail call i32 @feof(i32* %46)
%140 = icmp eq i32 %139, 0
br i1 %140, label %49, label %141
141: ; preds = %136, %44
%142 = phi i32 [ %45, %44 ], [ %137, %136 ]
%143 = tail call i32 @fputc(i8 signext 10, i32* %25)
%144 = tail call i32 @fclose(i32* %46)
switch i32 %43, label %151 [
i32 1, label %145
i32 2, label %147
i32 3, label %149
]
145: ; preds = %141
%146 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %142)
br label %152
147: ; preds = %141
%148 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 %142)
br label %152
149: ; preds = %141
%150 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 %142)
br label %152
151: ; preds = %141
store i8 0, i8* %5
br label %152
152: ; preds = %151, %149, %147, %145
%153 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%154 = icmp eq i32* %153, null
br i1 %154, label %155, label %44
155: ; preds = %152
%156 = tail call i32 @fclose(i32* %25)
br label %157
157: ; preds = %155, %39, %27
%158 = phi i32 [ 0, %155 ], [ -1, %39 ], [ -1, %27 ]
ret i32 %158
}