#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*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
char toupper(char);
int main(int argc, char **argv) {
  FILE *input;
  FILE *output;
  char *inputarray;
  char c = '\0';
  if (argc != 3) {
    printf("Usage: %s [input lithuania file] [output file]\n", argv[0]);
    exit(0);
  }
  input = fopen(argv[1], "r");
  if (!input) {
    printf("Failed to open %s.Check if it exists\n", argv[1]);
    exit(0);
  }
  printf("Warning, this will overwrite %s, beginning in 3 seconds\n", argv[2]);
  for (int i = 3; i > 0; i--) {
    printf("%d...", i);
    fflush(stdout);
    sleep(1);
  }
  putchar('\n');
  output = fopen(argv[2], "w");
  fseek(input, 0L, SEEK_END);
  int size = ftell(input);
  fseek(input, 0L, SEEK_SET);
  inputarray = malloc(size * sizeof(char));
  for (int i = 0; i < size; i++) {
    inputarray[i] = fgetc(input);
  }
  int j = 0;
  for (int i = 0; i < size - 9; i++) {
    if (toupper(inputarray[i]) == 'K' && toupper(inputarray[i + 1]) == 'E' &&
        toupper(inputarray[i + 2]) == 'B' &&
        toupper(inputarray[i + 3]) == 'A' &&
        toupper(inputarray[i + 4]) == 'B' &&
        toupper(inputarray[i + 5]) == 'A' &&
        toupper(inputarray[i + 6]) == 'S') {
      c |= (1 << (7 - j));
      i += 4;
      j++;
    } else if (toupper(inputarray[i]) == 'A' &&
               toupper(inputarray[i + 1]) == 'L' &&
               toupper(inputarray[i + 2]) == 'U' &&
               toupper(inputarray[i + 3]) == 'S') {
      i += 9;
      j++;
    }
    if (j == 8) {
      fputc(c, output);
      j = 0;
      c = '\0';
    }
  }
  return 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)
movb   $0x0,-0x29(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1200 <main+0x40>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe21(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1240 <main+0x80>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x3,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    129e <main+0xde>
mov    -0x30(%rbp),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10e0 <sleep@plt>
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    125d <main+0x9d>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xde0(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d1d(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1080 <ftell@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2ceb(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <fseek@plt>
movslq -0x34(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1342 <main+0x182>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,%dl
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1312 <main+0x152>
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x9,%ecx
cmp    %ecx,%eax
jge    154c <main+0x38c>
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x4b,%eax
jne    147b <main+0x2bb>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x45,%eax
jne    147b <main+0x2bb>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x42,%eax
jne    147b <main+0x2bb>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x41,%eax
jne    147b <main+0x2bb>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x42,%eax
jne    147b <main+0x2bb>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x41,%eax
jne    147b <main+0x2bb>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x6,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x53,%eax
jne    147b <main+0x2bb>
mov    $0x7,%ecx
sub    -0x3c(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
movsbl -0x29(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x29(%rbp)
mov    -0x40(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1515 <main+0x355>
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x41,%eax
jne    1510 <main+0x350>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x4c,%eax
jne    1510 <main+0x350>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x55,%eax
jne    1510 <main+0x350>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x53,%eax
jne    1510 <main+0x350>
mov    -0x40(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1515 <main+0x355>
cmpl   $0x8,-0x3c(%rbp)
jne    1539 <main+0x379>
mov    -0x29(%rbp),%al
mov    -0x20(%rbp),%rsi
movsbl %al,%edi
call   1070 <fputc@plt>
movl   $0x0,-0x3c(%rbp)
movb   $0x0,-0x29(%rbp)
jmp    153e <main+0x37e>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1350 <main+0x190>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    1459 <main+0x299>
mov    0x8(%rbx),%rdi
lea    0xe4b(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1465 <main+0x2a5>
mov    %rax,%r12
mov    0x10(%rbx),%rsi
lea    0xe57(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe82(%rip),%r14
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2dab(%rip),%r15
mov    (%r15),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10e0 <sleep@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r15),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10e0 <sleep@plt>
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r15),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10e0 <sleep@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rbx),%rdi
lea    0xe09(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,0x10(%rsp)
mov    0x2d49(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %r12,%rdi
call   1080 <ftell@plt>
mov    %eax,%r15d
mov    0x2d1b(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %r15d,%edi
call   1090 <malloc@plt>
test   %r15d,%r15d
jle    1448 <main+0x288>
mov    %rax,%r13
mov    %r15d,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
call   1060 <fgetc@plt>
mov    %al,0x0(%r13,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12f0 <main+0x130>
cmp    $0xa,%r15d
jl     1448 <main+0x288>
add    $0xfffffff7,%r15d
xor    %ebx,%ebx
xor    %r14d,%r14d
movl   $0x0,0xc(%rsp)
jmp    133c <main+0x17c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebx
cmp    %r15d,%ebx
jge    1448 <main+0x288>
movslq %ebx,%r12
movsbl 0x0(%r13,%r12,1),%ebp
mov    %ebp,%edi
call   1040 <toupper@plt>
cmp    $0x4b,%al
jne    13d0 <main+0x210>
movsbl 0x1(%r12,%r13,1),%edi
call   1040 <toupper@plt>
cmp    $0x45,%al
jne    13d0 <main+0x210>
movsbl 0x2(%r12,%r13,1),%edi
call   1040 <toupper@plt>
cmp    $0x42,%al
jne    13d0 <main+0x210>
movsbl 0x3(%r12,%r13,1),%edi
call   1040 <toupper@plt>
cmp    $0x41,%al
jne    13d0 <main+0x210>
movsbl 0x4(%r13,%r12,1),%edi
call   1040 <toupper@plt>
cmp    $0x42,%al
jne    13d0 <main+0x210>
movsbl 0x5(%r12,%r13,1),%edi
call   1040 <toupper@plt>
cmp    $0x41,%al
jne    13d0 <main+0x210>
movsbl 0x6(%r12,%r13,1),%edi
call   1040 <toupper@plt>
cmp    $0x53,%al
jne    13d0 <main+0x210>
add    $0x4,%r12
mov    $0x7,%cl
sub    %r14b,%cl
mov    $0x1,%eax
shl    %cl,%eax
mov    0xc(%rsp),%ecx
or     %al,%cl
mov    %ecx,0xc(%rsp)
mov    %r12d,%ebx
jmp    141b <main+0x25b>
nopl   (%rax)
mov    %ebp,%edi
call   1040 <toupper@plt>
cmp    $0x41,%al
jne    1330 <main+0x170>
movsbl 0x1(%r12,%r13,1),%edi
call   1040 <toupper@plt>
cmp    $0x4c,%al
jne    1330 <main+0x170>
movsbl 0x2(%r12,%r13,1),%edi
call   1040 <toupper@plt>
cmp    $0x55,%al
jne    1330 <main+0x170>
movsbl 0x3(%r12,%r13,1),%edi
call   1040 <toupper@plt>
cmp    $0x53,%al
jne    1330 <main+0x170>
add    $0x9,%ebx
add    $0x1,%r14d
cmp    $0x8,%r14d
jne    1330 <main+0x170>
movsbl 0xc(%rsp),%edi
mov    0x10(%rsp),%rsi
call   1070 <fputc@plt>
movl   $0x0,0xc(%rsp)
xor    %r14d,%r14d
jmp    1330 <main+0x170>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rsi
lea    0xb9d(%rip),%rdi
jmp    1470 <main+0x2b0>
mov    0x8(%rbx),%rsi
lea    0xbc2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"Usage: %s [input lithuania file] [output file]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [38 x i8] c"Failed to open %s.Check if it exists\0A\00"
@.str.3 = [57 x i8] c"Warning, this will overwrite %s, beginning in 3 seconds\0A\00"
@.str.4 = [6 x i8] c"%d...\00"
@stdout = global i32 0
@.str.5 = [2 x i8] c"w\00"
@SEEK_END = global i32 0
@SEEK_SET = 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 i8*
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 0, i8* %9
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 3
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %27, i32** %6
%28 = load i32*, i32** %6
%29 = icmp ne i32* %28, null
br i1 %29, label %36, label %30
30: ; preds = %23
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = call i32 @exit(i32 0)
unreachable
36: ; preds = %23
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), i8* %39)
store i32 3, i32* %10
br label %41
41: ; preds = %50, %36
%42 = load i32, i32* %10
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %53
44: ; preds = %41
%45 = load i32, i32* %10
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %45)
%47 = load i32, i32* @stdout
%48 = call i32 @fflush(i32 %47)
%49 = call i32 @sleep(i32 1)
br label %50
50: ; preds = %44
%51 = load i32, i32* %10
%52 = add nsw i32 %51, -1
store i32 %52, i32* %10
br label %41
53: ; preds = %41
%54 = call i32 @putchar(i8 signext 10)
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 2
%57 = load i8*, i8** %56
%58 = call i32* @fopen(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %58, i32** %7
%59 = load i32*, i32** %6
%60 = load i32, i32* @SEEK_END
%61 = call i32 @fseek(i32* %59, i64 0, i32 %60)
%62 = load i32*, i32** %6
%63 = call i32 @ftell(i32* %62)
store i32 %63, i32* %11
%64 = load i32*, i32** %6
%65 = load i32, i32* @SEEK_SET
%66 = call i32 @fseek(i32* %64, i64 0, i32 %65)
%67 = load i32, i32* %11
%68 = sext i32 %67 to i64
%69 = mul i64 %68, 1
%70 = trunc i64 %69 to i32
%71 = call i8* @malloc(i32 %70)
store i8* %71, i8** %8
store i32 0, i32* %12
br label %72
72: ; preds = %83, %53
%73 = load i32, i32* %12
%74 = load i32, i32* %11
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %86
76: ; preds = %72
%77 = load i32*, i32** %6
%78 = call signext i8 @fgetc(i32* %77)
%79 = load i8*, i8** %8
%80 = load i32, i32* %12
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8, i8* %79, i64 %81
store i8 %78, i8* %82
br label %83
83: ; preds = %76
%84 = load i32, i32* %12
%85 = add nsw i32 %84, 1
store i32 %85, i32* %12
br label %72
86: ; preds = %72
store i32 0, i32* %13
store i32 0, i32* %14
br label %87
87: ; preds = %226, %86
%88 = load i32, i32* %14
%89 = load i32, i32* %11
%90 = sub nsw i32 %89, 9
%91 = icmp slt i32 %88, %90
br i1 %91, label %92, label %229
92: ; preds = %87
%93 = load i8*, i8** %8
%94 = load i32, i32* %14
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i8, i8* %93, i64 %95
%97 = load i8, i8* %96
%98 = call signext i8 @toupper(i8 signext %97)
%99 = sext i8 %98 to i32
%100 = icmp eq i32 %99, 75
br i1 %100, label %101, label %173
101: ; preds = %92
%102 = load i8*, i8** %8
%103 = load i32, i32* %14
%104 = add nsw i32 %103, 1
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i8, i8* %102, i64 %105
%107 = load i8, i8* %106
%108 = call signext i8 @toupper(i8 signext %107)
%109 = sext i8 %108 to i32
%110 = icmp eq i32 %109, 69
br i1 %110, label %111, label %173
111: ; preds = %101
%112 = load i8*, i8** %8
%113 = load i32, i32* %14
%114 = add nsw i32 %113, 2
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i8, i8* %112, i64 %115
%117 = load i8, i8* %116
%118 = call signext i8 @toupper(i8 signext %117)
%119 = sext i8 %118 to i32
%120 = icmp eq i32 %119, 66
br i1 %120, label %121, label %173
121: ; preds = %111
%122 = load i8*, i8** %8
%123 = load i32, i32* %14
%124 = add nsw i32 %123, 3
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i8, i8* %122, i64 %125
%127 = load i8, i8* %126
%128 = call signext i8 @toupper(i8 signext %127)
%129 = sext i8 %128 to i32
%130 = icmp eq i32 %129, 65
br i1 %130, label %131, label %173
131: ; preds = %121
%132 = load i8*, i8** %8
%133 = load i32, i32* %14
%134 = add nsw i32 %133, 4
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8, i8* %132, i64 %135
%137 = load i8, i8* %136
%138 = call signext i8 @toupper(i8 signext %137)
%139 = sext i8 %138 to i32
%140 = icmp eq i32 %139, 66
br i1 %140, label %141, label %173
141: ; preds = %131
%142 = load i8*, i8** %8
%143 = load i32, i32* %14
%144 = add nsw i32 %143, 5
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i8, i8* %142, i64 %145
%147 = load i8, i8* %146
%148 = call signext i8 @toupper(i8 signext %147)
%149 = sext i8 %148 to i32
%150 = icmp eq i32 %149, 65
br i1 %150, label %151, label %173
151: ; preds = %141
%152 = load i8*, i8** %8
%153 = load i32, i32* %14
%154 = add nsw i32 %153, 6
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds i8, i8* %152, i64 %155
%157 = load i8, i8* %156
%158 = call signext i8 @toupper(i8 signext %157)
%159 = sext i8 %158 to i32
%160 = icmp eq i32 %159, 83
br i1 %160, label %161, label %173
161: ; preds = %151
%162 = load i32, i32* %13
%163 = sub nsw i32 7, %162
%164 = shl i32 1, %163
%165 = load i8, i8* %9
%166 = sext i8 %165 to i32
%167 = or i32 %166, %164
%168 = trunc i32 %167 to i8
store i8 %168, i8* %9
%169 = load i32, i32* %14
%170 = add nsw i32 %169, 4
store i32 %170, i32* %14
%171 = load i32, i32* %13
%172 = add nsw i32 %171, 1
store i32 %172, i32* %13
br label %218
173: ; preds = %151, %141, %131, %121, %111, %101, %92
%174 = load i8*, i8** %8
%175 = load i32, i32* %14
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds i8, i8* %174, i64 %176
%178 = load i8, i8* %177
%179 = call signext i8 @toupper(i8 signext %178)
%180 = sext i8 %179 to i32
%181 = icmp eq i32 %180, 65
br i1 %181, label %182, label %217
182: ; preds = %173
%183 = load i8*, i8** %8
%184 = load i32, i32* %14
%185 = add nsw i32 %184, 1
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds i8, i8* %183, i64 %186
%188 = load i8, i8* %187
%189 = call signext i8 @toupper(i8 signext %188)
%190 = sext i8 %189 to i32
%191 = icmp eq i32 %190, 76
br i1 %191, label %192, label %217
192: ; preds = %182
%193 = load i8*, i8** %8
%194 = load i32, i32* %14
%195 = add nsw i32 %194, 2
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds i8, i8* %193, i64 %196
%198 = load i8, i8* %197
%199 = call signext i8 @toupper(i8 signext %198)
%200 = sext i8 %199 to i32
%201 = icmp eq i32 %200, 85
br i1 %201, label %202, label %217
202: ; preds = %192
%203 = load i8*, i8** %8
%204 = load i32, i32* %14
%205 = add nsw i32 %204, 3
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds i8, i8* %203, i64 %206
%208 = load i8, i8* %207
%209 = call signext i8 @toupper(i8 signext %208)
%210 = sext i8 %209 to i32
%211 = icmp eq i32 %210, 83
br i1 %211, label %212, label %217
212: ; preds = %202
%213 = load i32, i32* %14
%214 = add nsw i32 %213, 9
store i32 %214, i32* %14
%215 = load i32, i32* %13
%216 = add nsw i32 %215, 1
store i32 %216, i32* %13
br label %217
217: ; preds = %212, %202, %192, %182, %173
br label %218
218: ; preds = %217, %161
%219 = load i32, i32* %13
%220 = icmp eq i32 %219, 8
br i1 %220, label %221, label %225
221: ; preds = %218
%222 = load i8, i8* %9
%223 = load i32*, i32** %7
%224 = call i32 @fputc(i8 signext %222, i32* %223)
store i32 0, i32* %13
store i8 0, i8* %9
br label %225
225: ; preds = %221, %218
br label %226
226: ; preds = %225
%227 = load i32, i32* %14
%228 = add nsw i32 %227, 1
store i32 %228, i32* %14
br label %87
229: ; preds = %87
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"Usage: %s [input lithuania file] [output file]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [38 x i8] c"Failed to open %s.Check if it exists\0A\00"
@.str.3 = [57 x i8] c"Warning, this will overwrite %s, beginning in 3 seconds\0A\00"
@.str.4 = [6 x i8] c"%d...\00"
@stdout = global i32 0
@.str.5 = [2 x i8] c"w\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i8*, i8** %9
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = tail call i32 @exit(i32 0)
unreachable
17: ; preds = %8
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), i8* %19)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 3)
%22 = load i32, i32* @stdout
%23 = tail call i32 @fflush(i32 %22)
%24 = tail call i32 @sleep(i32 1)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 2)
%26 = load i32, i32* @stdout
%27 = tail call i32 @fflush(i32 %26)
%28 = tail call i32 @sleep(i32 1)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 1)
%30 = load i32, i32* @stdout
%31 = tail call i32 @fflush(i32 %30)
%32 = tail call i32 @sleep(i32 1)
%33 = tail call i32 @putchar(i8 signext 10)
%34 = load i8*, i8** %18
%35 = tail call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%36 = load i32, i32* @SEEK_END
%37 = tail call i32 @fseek(i32* %11, i64 0, i32 %36)
%38 = tail call i32 @ftell(i32* %11)
%39 = load i32, i32* @SEEK_SET
%40 = tail call i32 @fseek(i32* %11, i64 0, i32 %39)
%41 = tail call i8* @malloc(i32 %38)
%42 = icmp sgt i32 %38, 0
br i1 %42, label %43, label %54
43: ; preds = %17
%44 = zext i32 %38 to i64
br label %48
45: ; preds = %48
%46 = add nsw i32 %38, -9
%47 = icmp sgt i32 %38, 9
br i1 %47, label %55, label %54
48: ; preds = %43, %48
%49 = phi i64 [ 0, %43 ], [ %52, %48 ]
%50 = tail call signext i8 @fgetc(i32* %11)
%51 = getelementptr inbounds i8, i8* %41, i64 %49
store i8 %50, i8* %51
%52 = add nuw nsw i64 %49, 1
%53 = icmp eq i64 %52, %44
br i1 %53, label %45, label %48
54: ; preds = %144, %17, %45
ret i32 0
55: ; preds = %45, %144
%56 = phi i32 [ %148, %144 ], [ 0, %45 ]
%57 = phi i32 [ %147, %144 ], [ 0, %45 ]
%58 = phi i8 [ %146, %144 ], [ 0, %45 ]
%59 = sext i32 %56 to i64
%60 = getelementptr inbounds i8, i8* %41, i64 %59
%61 = load i8, i8* %60
%62 = tail call signext i8 @toupper(i8 signext %61)
%63 = icmp eq i8 %62, 75
br i1 %63, label %64, label %111
64: ; preds = %55
%65 = add nsw i32 %56, 1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %41, i64 %66
%68 = load i8, i8* %67
%69 = tail call signext i8 @toupper(i8 signext %68)
%70 = icmp eq i8 %69, 69
br i1 %70, label %71, label %111
71: ; preds = %64
%72 = add nsw i32 %56, 2
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %41, i64 %73
%75 = load i8, i8* %74
%76 = tail call signext i8 @toupper(i8 signext %75)
%77 = icmp eq i8 %76, 66
br i1 %77, label %78, label %111
78: ; preds = %71
%79 = add nsw i32 %56, 3
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %41, i64 %80
%82 = load i8, i8* %81
%83 = tail call signext i8 @toupper(i8 signext %82)
%84 = icmp eq i8 %83, 65
br i1 %84, label %85, label %111
85: ; preds = %78
%86 = add nsw i32 %56, 4
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %41, i64 %87
%89 = load i8, i8* %88
%90 = tail call signext i8 @toupper(i8 signext %89)
%91 = icmp eq i8 %90, 66
br i1 %91, label %92, label %111
92: ; preds = %85
%93 = add nsw i32 %56, 5
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %41, i64 %94
%96 = load i8, i8* %95
%97 = tail call signext i8 @toupper(i8 signext %96)
%98 = icmp eq i8 %97, 65
br i1 %98, label %99, label %111
99: ; preds = %92
%100 = add nsw i32 %56, 6
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %41, i64 %101
%103 = load i8, i8* %102
%104 = tail call signext i8 @toupper(i8 signext %103)
%105 = icmp eq i8 %104, 83
br i1 %105, label %106, label %111
106: ; preds = %99
%107 = sub nsw i32 7, %57
%108 = shl nuw i32 1, %107
%109 = trunc i32 %108 to i8
%110 = or i8 %58, %109
br label %137
111: ; preds = %99, %92, %85, %78, %71, %64, %55
%112 = tail call signext i8 @toupper(i8 signext %61)
%113 = icmp eq i8 %112, 65
br i1 %113, label %114, label %144
114: ; preds = %111
%115 = add nsw i32 %56, 1
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i8, i8* %41, i64 %116
%118 = load i8, i8* %117
%119 = tail call signext i8 @toupper(i8 signext %118)
%120 = icmp eq i8 %119, 76
br i1 %120, label %121, label %144
121: ; preds = %114
%122 = add nsw i32 %56, 2
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i8, i8* %41, i64 %123
%125 = load i8, i8* %124
%126 = tail call signext i8 @toupper(i8 signext %125)
%127 = icmp eq i8 %126, 85
br i1 %127, label %128, label %144
128: ; preds = %121
%129 = add nsw i32 %56, 3
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %41, i64 %130
%132 = load i8, i8* %131
%133 = tail call signext i8 @toupper(i8 signext %132)
%134 = icmp eq i8 %133, 83
br i1 %134, label %135, label %144
135: ; preds = %128
%136 = add nsw i32 %56, 9
br label %137
137: ; preds = %135, %106
%138 = phi i8 [ %110, %106 ], [ %58, %135 ]
%139 = phi i32 [ %86, %106 ], [ %136, %135 ]
%140 = add nsw i32 %57, 1
%141 = icmp eq i32 %140, 8
br i1 %141, label %142, label %144
142: ; preds = %137
%143 = tail call i32 @fputc(i8 signext %138, i32* %35)
br label %144
144: ; preds = %111, %114, %121, %128, %137, %142
%145 = phi i32 [ %139, %142 ], [ %139, %137 ], [ %56, %128 ], [ %56, %121 ], [ %56, %114 ], [ %56, %111 ]
%146 = phi i8 [ 0, %142 ], [ %138, %137 ], [ %58, %128 ], [ %58, %121 ], [ %58, %114 ], [ %58, %111 ]
%147 = phi i32 [ 0, %142 ], [ %140, %137 ], [ %57, %128 ], [ %57, %121 ], [ %57, %114 ], [ %57, %111 ]
%148 = add nsw i32 %145, 1
%149 = icmp slt i32 %148, %46
br i1 %149, label %55, label %54
}