#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 EOF;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
scalar_t__ malloc(int);
void writeNewTab(FILE **inputTab, FILE **outputTab, int shift) {
  char *sharps[12] = {"C",  "C#", "D",  "D#", "E",  "F",
                      "F#", "G",  "G#", "A",  "A#", "B"};
  char *flats[12] = {"C",  "Db", "D",  "Eb", "E",  "F",
                     "Gb", "G",  "Ab", "A",  "Bb", "B"};
  int *file;
  long size;
  int c;
  size_t index = 0;
  int whiteChars = 0;
  int nonWhiteChars = 0;
  fseek(*inputTab, 0, SEEK_END);
  size = ftell(*inputTab);
  fseek(*inputTab, 0, SEEK_SET);
  file = (int *)malloc(sizeof(int) * size);
  if (size == 0)
    return;
  while ((c = fgetc(*inputTab)) != EOF) {
    switch (file[index++] = c) {
    case '\t':
    case ' ':
      whiteChars++;
      break;
    case '\n':
    case '\r':
      if (whiteChars > nonWhiteChars) {
        for (int i = 0; i < index; i++) {
          int output = (char)file[i];
          int offset = 0;
          char *newValue;
          if ((char)file[i + 1] == '#')
            offset = 1;
          if ((char)file[i + 1] == 'b')
            offset = -1;
          if (output == 'a' || output == 'A') {
            int newIndex = (9 + offset + shift) % 12;
            newValue = sharps[newIndex];
          } else if (output == 'b' || output == 'B') {
            int newIndex = (11 + offset + shift) % 12;
            newValue = sharps[newIndex];
          } else if (output == 'c' || output == 'C') {
            int newIndex = (0 + offset + shift) % 12;
            newValue = sharps[newIndex];
          } else if (output == 'd' || output == 'D') {
            int newIndex = (2 + offset + shift) % 12;
            newValue = sharps[newIndex];
          } else if (output == 'e' || output == 'E') {
            int newIndex = (4 + offset + shift) % 12;
            newValue = sharps[newIndex];
          } else if (output == 'f' || output == 'F') {
            int newIndex = (5 + offset + shift) % 12;
            newValue = sharps[newIndex];
          } else if (output == 'g' || output == 'G') {
            int newIndex = (7 + offset + shift) % 12;
            newValue = sharps[newIndex];
          } else {
            char str[2] = "\0";
            str[0] = output;
            newValue = str;
          }
          fprintf(*outputTab, "%s", newValue);
        }
      } else {
        for (int i = 0; i < index; i++) {
          fputc(file[i], *outputTab);
        }
      }
      whiteChars = 0;
      nonWhiteChars = 0;
      index = 0;
      break;
    default:
      nonWhiteChars++;
    }
  }
  free(file);
}


x86 assembly (clang, -O0):
<writeNewTab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x80(%rbp),%rdi
lea    0x2b8f(%rip),%rsi
mov    $0x60,%edx
call   1090 <memcpy@plt>
lea    -0xe0(%rbp),%rdi
lea    0x2bd7(%rip),%rsi
mov    $0x60,%edx
call   1090 <memcpy@plt>
movq   $0x0,-0x100(%rbp)
movl   $0x0,-0x104(%rbp)
movl   $0x0,-0x108(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    0x2de0(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1080 <ftell@plt>
mov    %rax,-0xf0(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    0x2d9e(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    -0xf0(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0xe8(%rbp)
cmpq   $0x0,-0xf0(%rbp)
jne    125f <writeNewTab+0xcf>
jmp    16c0 <writeNewTab+0x530>
jmp    1264 <writeNewTab+0xd4>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0xf4(%rbp)
mov    0x2d5b(%rip),%rcx
cmp    (%rcx),%eax
je     16b4 <writeNewTab+0x524>
mov    -0xf4(%rbp),%eax
mov    -0xe8(%rbp),%rcx
mov    -0x100(%rbp),%rdx
mov    %rdx,%rsi
add    $0x1,%rsi
mov    %rsi,-0x100(%rbp)
mov    %eax,(%rcx,%rdx,4)
add    $0xfffffff7,%eax
mov    %eax,%ecx
mov    %rcx,-0x150(%rbp)
sub    $0x17,%eax
ja     16a0 <writeNewTab+0x510>
mov    -0x150(%rbp),%rax
lea    0xd33(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    16af <writeNewTab+0x51f>
mov    -0x104(%rbp),%eax
cmp    -0x108(%rbp),%eax
jle    1628 <writeNewTab+0x498>
movl   $0x0,-0x10c(%rbp)
movslq -0x10c(%rbp),%rax
cmp    -0x100(%rbp),%rax
jae    1623 <writeNewTab+0x493>
mov    -0xe8(%rbp),%rax
movslq -0x10c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
movsbl %al,%eax
mov    %eax,-0x110(%rbp)
movl   $0x0,-0x114(%rbp)
mov    -0xe8(%rbp),%rax
mov    -0x10c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
movsbl %al,%eax
cmp    $0x23,%eax
jne    136a <writeNewTab+0x1da>
movl   $0x1,-0x114(%rbp)
mov    -0xe8(%rbp),%rax
mov    -0x10c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
movsbl %al,%eax
cmp    $0x62,%eax
jne    1396 <writeNewTab+0x206>
movl   $0xffffffff,-0x114(%rbp)
ff ff ff
cmpl   $0x61,-0x110(%rbp)
je     13b0 <writeNewTab+0x220>
cmpl   $0x41,-0x110(%rbp)
jne    13e2 <writeNewTab+0x252>
mov    -0x114(%rbp),%eax
add    $0x9,%eax
add    -0x14(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x124(%rbp)
movslq -0x124(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rax
mov    %rax,-0x120(%rbp)
jmp    15f5 <writeNewTab+0x465>
cmpl   $0x62,-0x110(%rbp)
je     13fc <writeNewTab+0x26c>
cmpl   $0x42,-0x110(%rbp)
jne    142e <writeNewTab+0x29e>
mov    -0x114(%rbp),%eax
add    $0xb,%eax
add    -0x14(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x128(%rbp)
movslq -0x128(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rax
mov    %rax,-0x120(%rbp)
jmp    15f0 <writeNewTab+0x460>
cmpl   $0x63,-0x110(%rbp)
je     1448 <writeNewTab+0x2b8>
cmpl   $0x43,-0x110(%rbp)
jne    147a <writeNewTab+0x2ea>
mov    -0x114(%rbp),%eax
add    $0x0,%eax
add    -0x14(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x12c(%rbp)
movslq -0x12c(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rax
mov    %rax,-0x120(%rbp)
jmp    15eb <writeNewTab+0x45b>
cmpl   $0x64,-0x110(%rbp)
je     1494 <writeNewTab+0x304>
cmpl   $0x44,-0x110(%rbp)
jne    14c6 <writeNewTab+0x336>
mov    -0x114(%rbp),%eax
add    $0x2,%eax
add    -0x14(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x130(%rbp)
movslq -0x130(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rax
mov    %rax,-0x120(%rbp)
jmp    15e6 <writeNewTab+0x456>
cmpl   $0x65,-0x110(%rbp)
je     14e0 <writeNewTab+0x350>
cmpl   $0x45,-0x110(%rbp)
jne    1512 <writeNewTab+0x382>
mov    -0x114(%rbp),%eax
add    $0x4,%eax
add    -0x14(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x134(%rbp)
movslq -0x134(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rax
mov    %rax,-0x120(%rbp)
jmp    15e1 <writeNewTab+0x451>
cmpl   $0x66,-0x110(%rbp)
je     152c <writeNewTab+0x39c>
cmpl   $0x46,-0x110(%rbp)
jne    155e <writeNewTab+0x3ce>
mov    -0x114(%rbp),%eax
add    $0x5,%eax
add    -0x14(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x138(%rbp)
movslq -0x138(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rax
mov    %rax,-0x120(%rbp)
jmp    15dc <writeNewTab+0x44c>
cmpl   $0x67,-0x110(%rbp)
je     1578 <writeNewTab+0x3e8>
cmpl   $0x47,-0x110(%rbp)
jne    15aa <writeNewTab+0x41a>
mov    -0x114(%rbp),%eax
add    $0x7,%eax
add    -0x14(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x13c(%rbp)
movslq -0x13c(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rax
mov    %rax,-0x120(%rbp)
jmp    15d7 <writeNewTab+0x447>
lea    -0x13e(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <memset@plt>
mov    -0x110(%rbp),%eax
mov    %al,-0x13e(%rbp)
lea    -0x13e(%rbp),%rax
mov    %rax,-0x120(%rbp)
jmp    15dc <writeNewTab+0x44c>
jmp    15e1 <writeNewTab+0x451>
jmp    15e6 <writeNewTab+0x456>
jmp    15eb <writeNewTab+0x45b>
jmp    15f0 <writeNewTab+0x460>
jmp    15f5 <writeNewTab+0x465>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x120(%rbp),%rdx
lea    0xa82(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10c(%rbp)
jmp    1306 <writeNewTab+0x176>
jmp    167c <writeNewTab+0x4ec>
movl   $0x0,-0x144(%rbp)
movslq -0x144(%rbp),%rax
cmp    -0x100(%rbp),%rax
jae    1677 <writeNewTab+0x4e7>
mov    -0xe8(%rbp),%rax
movslq -0x144(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1060 <fputc@plt>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    1632 <writeNewTab+0x4a2>
jmp    167c <writeNewTab+0x4ec>
movl   $0x0,-0x104(%rbp)
movl   $0x0,-0x108(%rbp)
movq   $0x0,-0x100(%rbp)
jmp    16af <writeNewTab+0x51f>
mov    -0x108(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x108(%rbp)
jmp    1264 <writeNewTab+0xd4>
mov    -0xe8(%rbp),%rdi
call   1030 <free@plt>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeNewTab>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,%ebp
mov    %rsi,%r12
mov    %rdi,%r14
mov    (%rdi),%rdi
mov    0x2e58(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    (%r14),%rdi
call   1070 <ftell@plt>
mov    %rax,%r13
mov    (%r14),%rdi
mov    0x2e22(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
lea    0x0(,%r13,4),%edi
call   1080 <malloc@plt>
test   %r13,%r13
je     11fa <writeNewTab+0x8a>
mov    %rax,%rbx
mov    %r14,0x20(%rsp)
mov    (%r14),%rdi
call   1050 <fgetc@plt>
mov    0x2e00(%rip),%rcx
cmp    (%rcx),%eax
jne    1209 <writeNewTab+0x99>
mov    %rbx,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r13d,%r13d
lea    0xe69(%rip),%r15
xor    %r14d,%r14d
xor    %ecx,%ecx
mov    %rcx,0x8(%rsp)
mov    %rbp,0x18(%rsp)
jmp    124c <writeNewTab+0xdc>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r14d
mov    0x20(%rsp),%rax
mov    (%rax),%rdi
call   1050 <fgetc@plt>
mov    0x2d98(%rip),%rcx
cmp    (%rcx),%eax
je     11e4 <writeNewTab+0x74>
mov    %eax,(%rbx,%r13,4)
add    $0x1,%r13
add    $0xfffffff7,%eax
cmp    $0x17,%eax
ja     1350 <writeNewTab+0x1e0>
lea    0xd99(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmp    0x8(%rsp),%r14d
jle    1370 <writeNewTab+0x200>
test   %r13,%r13
je     13b0 <writeNewTab+0x240>
xor    %r14d,%r14d
jmp    12c9 <writeNewTab+0x159>
add    %ebp,%eax
add    $0x7,%eax
xchg   %ax,%ax
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x21,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
cltq
movslq (%r15,%rax,4),%rdi
add    %r15,%rdi
mov    (%r12),%rsi
call   1040 <fputs@plt>
cmp    %r14,%r13
je     13b0 <writeNewTab+0x240>
movzbl (%rbx,%r14,4),%ecx
movzbl 0x4(%rbx,%r14,4),%edx
add    $0x1,%r14
xor    %eax,%eax
cmp    $0x23,%edx
sete   %al
cmp    $0x62,%edx
mov    $0xffffffff,%edx
cmove  %edx,%eax
and    $0xdf,%cl
add    $0xbf,%cl
lea    0x16(%rsp),%rdi
cmp    $0x6,%cl
ja     12b7 <writeNewTab+0x147>
movzbl %cl,%ecx
lea    0xd5b(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
add    %ebp,%eax
add    $0x9,%eax
jmp    1290 <writeNewTab+0x120>
add    %ebp,%eax
add    $0xb,%eax
jmp    1290 <writeNewTab+0x120>
add    %ebp,%eax
jmp    1290 <writeNewTab+0x120>
add    %ebp,%eax
add    $0x2,%eax
jmp    1290 <writeNewTab+0x120>
add    %ebp,%eax
add    $0x4,%eax
jmp    1290 <writeNewTab+0x120>
add    %ebp,%eax
add    $0x5,%eax
jmp    1290 <writeNewTab+0x120>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x8(%rsp)
jmp    1234 <writeNewTab+0xc4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %r13,%r13
je     13b0 <writeNewTab+0x240>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,4),%edi
mov    (%r12),%rsi
call   1060 <fputc@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1380 <writeNewTab+0x210>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %r14d,%r14d
xor    %r13d,%r13d
mov    0x18(%rsp),%rbp
jmp    1234 <writeNewTab+0xc4>
nopl   0x0(%rax)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    1234 <writeNewTab+0xc4>

LLVM IR (-O0):
@.str = [2 x i8] c"C\00"
@.str.1 = [3 x i8] c"C#\00"
@.str.2 = [2 x i8] c"D\00"
@.str.3 = [3 x i8] c"D#\00"
@.str.4 = [2 x i8] c"E\00"
@.str.5 = [2 x i8] c"F\00"
@.str.6 = [3 x i8] c"F#\00"
@.str.7 = [2 x i8] c"G\00"
@.str.8 = [3 x i8] c"G#\00"
@.str.9 = [2 x i8] c"A\00"
@.str.10 = [3 x i8] c"A#\00"
@.str.11 = [2 x i8] c"B\00"
@__const.writeNewTab.sharps = [12 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [3 x i8] c"Db\00"
@.str.13 = [3 x i8] c"Eb\00"
@.str.14 = [3 x i8] c"Gb\00"
@.str.15 = [3 x i8] c"Ab\00"
@.str.16 = [3 x i8] c"Bb\00"
@__const.writeNewTab.flats = [12 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i32 0, i32 0)]
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@EOF = global i32 0
@.str.17 = [3 x i8] c"%s\00"
define void @writeNewTab(i32** %0, i32** %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32**
%6 = alloca i32
%7 = alloca [12 x i8*]
%8 = alloca [12 x i8*]
%9 = alloca i32*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca [2 x i8]
%27 = alloca i32
store i32** %0, i32*** %4
store i32** %1, i32*** %5
store i32 %2, i32* %6
%28 = bitcast [12 x i8*]* %7 to i8*
%29 = bitcast [12 x i8*]* %8 to i8*
store i64 0, i64* %12
store i32 0, i32* %13
store i32 0, i32* %14
%30 = load i32**, i32*** %4
%31 = load i32*, i32** %30
%32 = load i32, i32* @SEEK_END
%33 = call i32 @fseek(i32* %31, i32 0, i32 %32)
%34 = load i32**, i32*** %4
%35 = load i32*, i32** %34
%36 = call i64 @ftell(i32* %35)
store i64 %36, i64* %10
%37 = load i32**, i32*** %4
%38 = load i32*, i32** %37
%39 = load i32, i32* @SEEK_SET
%40 = call i32 @fseek(i32* %38, i32 0, i32 %39)
%41 = load i64, i64* %10
%42 = mul i64 4, %41
%43 = trunc i64 %42 to i32
%44 = call i64 @malloc(i32 %43)
%45 = inttoptr i64 %44 to i32*
store i32* %45, i32** %9
%46 = load i64, i64* %10
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %3
br label %264
49: ; preds = %3
br label %50
50: ; preds = %260, %49
%51 = load i32**, i32*** %4
%52 = load i32*, i32** %51
%53 = call i32 @fgetc(i32* %52)
store i32 %53, i32* %11
%54 = load i32, i32* @EOF
%55 = icmp ne i32 %53, %54
br i1 %55, label %56, label %261
56: ; preds = %50
%57 = load i32, i32* %11
%58 = load i32*, i32** %9
%59 = load i64, i64* %12
%60 = add i64 %59, 1
store i64 %60, i64* %12
%61 = getelementptr inbounds i32, i32* %58, i64 %59
store i32 %57, i32* %61
switch i32 %57, label %257 [
i32 9, label %62
i32 32, label %62
i32 10, label %65
i32 13, label %65
]
62: ; preds = %56, %56
%63 = load i32, i32* %13
%64 = add nsw i32 %63, 1
store i32 %64, i32* %13
br label %260
65: ; preds = %56, %56
%66 = load i32, i32* %13
%67 = load i32, i32* %14
%68 = icmp sgt i32 %66, %67
br i1 %68, label %69, label %237
69: ; preds = %65
store i32 0, i32* %15
br label %70
70: ; preds = %233, %69
%71 = load i32, i32* %15
%72 = sext i32 %71 to i64
%73 = load i64, i64* %12
%74 = icmp ult i64 %72, %73
br i1 %74, label %75, label %236
75: ; preds = %70
%76 = load i32*, i32** %9
%77 = load i32, i32* %15
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32, i32* %76, i64 %78
%80 = load i32, i32* %79
%81 = trunc i32 %80 to i8
%82 = sext i8 %81 to i32
store i32 %82, i32* %16
store i32 0, i32* %17
%83 = load i32*, i32** %9
%84 = load i32, i32* %15
%85 = add nsw i32 %84, 1
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32, i32* %83, i64 %86
%88 = load i32, i32* %87
%89 = trunc i32 %88 to i8
%90 = sext i8 %89 to i32
%91 = icmp eq i32 %90, 35
br i1 %91, label %92, label %93
92: ; preds = %75
store i32 1, i32* %17
br label %93
93: ; preds = %92, %75
%94 = load i32*, i32** %9
%95 = load i32, i32* %15
%96 = add nsw i32 %95, 1
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i32, i32* %94, i64 %97
%99 = load i32, i32* %98
%100 = trunc i32 %99 to i8
%101 = sext i8 %100 to i32
%102 = icmp eq i32 %101, 98
br i1 %102, label %103, label %104
103: ; preds = %93
store i32 -1, i32* %17
br label %104
104: ; preds = %103, %93
%105 = load i32, i32* %16
%106 = icmp eq i32 %105, 97
br i1 %106, label %110, label %107
107: ; preds = %104
%108 = load i32, i32* %16
%109 = icmp eq i32 %108, 65
br i1 %109, label %110, label %120
110: ; preds = %107, %104
%111 = load i32, i32* %17
%112 = add nsw i32 9, %111
%113 = load i32, i32* %6
%114 = add nsw i32 %112, %113
%115 = srem i32 %114, 12
store i32 %115, i32* %19
%116 = load i32, i32* %19
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [12 x i8*], [12 x i8*]* %7, i64 0, i64 %117
%119 = load i8*, i8** %118
store i8* %119, i8** %18
br label %228
120: ; preds = %107
%121 = load i32, i32* %16
%122 = icmp eq i32 %121, 98
br i1 %122, label %126, label %123
123: ; preds = %120
%124 = load i32, i32* %16
%125 = icmp eq i32 %124, 66
br i1 %125, label %126, label %136
126: ; preds = %123, %120
%127 = load i32, i32* %17
%128 = add nsw i32 11, %127
%129 = load i32, i32* %6
%130 = add nsw i32 %128, %129
%131 = srem i32 %130, 12
store i32 %131, i32* %20
%132 = load i32, i32* %20
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [12 x i8*], [12 x i8*]* %7, i64 0, i64 %133
%135 = load i8*, i8** %134
store i8* %135, i8** %18
br label %227
136: ; preds = %123
%137 = load i32, i32* %16
%138 = icmp eq i32 %137, 99
br i1 %138, label %142, label %139
139: ; preds = %136
%140 = load i32, i32* %16
%141 = icmp eq i32 %140, 67
br i1 %141, label %142, label %152
142: ; preds = %139, %136
%143 = load i32, i32* %17
%144 = add nsw i32 0, %143
%145 = load i32, i32* %6
%146 = add nsw i32 %144, %145
%147 = srem i32 %146, 12
store i32 %147, i32* %21
%148 = load i32, i32* %21
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds [12 x i8*], [12 x i8*]* %7, i64 0, i64 %149
%151 = load i8*, i8** %150
store i8* %151, i8** %18
br label %226
152: ; preds = %139
%153 = load i32, i32* %16
%154 = icmp eq i32 %153, 100
br i1 %154, label %158, label %155
155: ; preds = %152
%156 = load i32, i32* %16
%157 = icmp eq i32 %156, 68
br i1 %157, label %158, label %168
158: ; preds = %155, %152
%159 = load i32, i32* %17
%160 = add nsw i32 2, %159
%161 = load i32, i32* %6
%162 = add nsw i32 %160, %161
%163 = srem i32 %162, 12
store i32 %163, i32* %22
%164 = load i32, i32* %22
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds [12 x i8*], [12 x i8*]* %7, i64 0, i64 %165
%167 = load i8*, i8** %166
store i8* %167, i8** %18
br label %225
168: ; preds = %155
%169 = load i32, i32* %16
%170 = icmp eq i32 %169, 101
br i1 %170, label %174, label %171
171: ; preds = %168
%172 = load i32, i32* %16
%173 = icmp eq i32 %172, 69
br i1 %173, label %174, label %184
174: ; preds = %171, %168
%175 = load i32, i32* %17
%176 = add nsw i32 4, %175
%177 = load i32, i32* %6
%178 = add nsw i32 %176, %177
%179 = srem i32 %178, 12
store i32 %179, i32* %23
%180 = load i32, i32* %23
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds [12 x i8*], [12 x i8*]* %7, i64 0, i64 %181
%183 = load i8*, i8** %182
store i8* %183, i8** %18
br label %224
184: ; preds = %171
%185 = load i32, i32* %16
%186 = icmp eq i32 %185, 102
br i1 %186, label %190, label %187
187: ; preds = %184
%188 = load i32, i32* %16
%189 = icmp eq i32 %188, 70
br i1 %189, label %190, label %200
190: ; preds = %187, %184
%191 = load i32, i32* %17
%192 = add nsw i32 5, %191
%193 = load i32, i32* %6
%194 = add nsw i32 %192, %193
%195 = srem i32 %194, 12
store i32 %195, i32* %24
%196 = load i32, i32* %24
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds [12 x i8*], [12 x i8*]* %7, i64 0, i64 %197
%199 = load i8*, i8** %198
store i8* %199, i8** %18
br label %223
200: ; preds = %187
%201 = load i32, i32* %16
%202 = icmp eq i32 %201, 103
br i1 %202, label %206, label %203
203: ; preds = %200
%204 = load i32, i32* %16
%205 = icmp eq i32 %204, 71
br i1 %205, label %206, label %216
206: ; preds = %203, %200
%207 = load i32, i32* %17
%208 = add nsw i32 7, %207
%209 = load i32, i32* %6
%210 = add nsw i32 %208, %209
%211 = srem i32 %210, 12
store i32 %211, i32* %25
%212 = load i32, i32* %25
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds [12 x i8*], [12 x i8*]* %7, i64 0, i64 %213
%215 = load i8*, i8** %214
store i8* %215, i8** %18
br label %222
216: ; preds = %203
%217 = bitcast [2 x i8]* %26 to i8*
%218 = load i32, i32* %16
%219 = trunc i32 %218 to i8
%220 = getelementptr inbounds [2 x i8], [2 x i8]* %26, i64 0, i64 0
store i8 %219, i8* %220
%221 = getelementptr inbounds [2 x i8], [2 x i8]* %26, i64 0, i64 0
store i8* %221, i8** %18
br label %222
222: ; preds = %216, %206
br label %223
223: ; preds = %222, %190
br label %224
224: ; preds = %223, %174
br label %225
225: ; preds = %224, %158
br label %226
226: ; preds = %225, %142
br label %227
227: ; preds = %226, %126
br label %228
228: ; preds = %227, %110
%229 = load i32**, i32*** %5
%230 = load i32*, i32** %229
%231 = load i8*, i8** %18
%232 = call i32 @fprintf(i32* %230, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i8* %231)
br label %233
233: ; preds = %228
%234 = load i32, i32* %15
%235 = add nsw i32 %234, 1
store i32 %235, i32* %15
br label %70
236: ; preds = %70
br label %256
237: ; preds = %65
store i32 0, i32* %27
br label %238
238: ; preds = %252, %237
%239 = load i32, i32* %27
%240 = sext i32 %239 to i64
%241 = load i64, i64* %12
%242 = icmp ult i64 %240, %241
br i1 %242, label %243, label %255
243: ; preds = %238
%244 = load i32*, i32** %9
%245 = load i32, i32* %27
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds i32, i32* %244, i64 %246
%248 = load i32, i32* %247
%249 = load i32**, i32*** %5
%250 = load i32*, i32** %249
%251 = call i32 @fputc(i32 %248, i32* %250)
br label %252
252: ; preds = %243
%253 = load i32, i32* %27
%254 = add nsw i32 %253, 1
store i32 %254, i32* %27
br label %238
255: ; preds = %238
br label %256
256: ; preds = %255, %236
store i32 0, i32* %13
store i32 0, i32* %14
store i64 0, i64* %12
br label %260
257: ; preds = %56
%258 = load i32, i32* %14
%259 = add nsw i32 %258, 1
store i32 %259, i32* %14
br label %260
260: ; preds = %257, %256, %62
br label %50
261: ; preds = %50
%262 = load i32*, i32** %9
%263 = call i32 @free(i32* %262)
br label %264
264: ; preds = %261, %48
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"C\00"
@.str.1 = [3 x i8] c"C#\00"
@.str.2 = [2 x i8] c"D\00"
@.str.3 = [3 x i8] c"D#\00"
@.str.4 = [2 x i8] c"E\00"
@.str.5 = [2 x i8] c"F\00"
@.str.6 = [3 x i8] c"F#\00"
@.str.7 = [2 x i8] c"G\00"
@.str.8 = [3 x i8] c"G#\00"
@.str.9 = [2 x i8] c"A\00"
@.str.10 = [3 x i8] c"A#\00"
@.str.11 = [2 x i8] c"B\00"
@reltable.writeNewTab = [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.2 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.4 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.8 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.9 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.10 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.11 to i64), i64 ptrtoint ([12 x i32]* @reltable.writeNewTab to i64)) to i32)]
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@EOF = global i32 0
define void @writeNewTab(i32** nocapture %0, i32** nocapture %1, i32 %2) {
%4 = alloca i16
%5 = load i32*, i32** %0
%6 = load i32, i32* @SEEK_END
%7 = tail call i32 @fseek(i32* %5, i32 0, i32 %6)
%8 = load i32*, i32** %0
%9 = tail call i64 @ftell(i32* %8)
%10 = load i32*, i32** %0
%11 = load i32, i32* @SEEK_SET
%12 = tail call i32 @fseek(i32* %10, i32 0, i32 %11)
%13 = trunc i64 %9 to i32
%14 = shl i32 %13, 2
%15 = tail call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i32*
%17 = icmp eq i64 %9, 0
br i1 %17, label %104, label %18
18: ; preds = %3
%19 = load i32*, i32** %0
%20 = tail call i32 @fgetc(i32* %19)
%21 = load i32, i32* @EOF
%22 = icmp eq i32 %20, %21
br i1 %22, label %102, label %23
23: ; preds = %18
%24 = bitcast i16* %4 to i8*
br label %25
25: ; preds = %23, %94
%26 = phi i32 [ %20, %23 ], [ %99, %94 ]
%27 = phi i64 [ 0, %23 ], [ %97, %94 ]
%28 = phi i32 [ 0, %23 ], [ %96, %94 ]
%29 = phi i32 [ 0, %23 ], [ %95, %94 ]
%30 = add i64 %27, 1
%31 = getelementptr inbounds i32, i32* %16, i64 %27
store i32 %26, i32* %31
switch i32 %26, label %92 [
i32 9, label %32
i32 32, label %32
i32 10, label %34
i32 13, label %34
]
32: ; preds = %25, %25
%33 = add nsw i32 %28, 1
br label %94
34: ; preds = %25, %25
%35 = icmp sgt i32 %28, %29
%36 = icmp eq i64 %30, 0
br i1 %35, label %38, label %37
37: ; preds = %34
br i1 %36, label %94, label %84
38: ; preds = %34
br i1 %36, label %94, label %39
39: ; preds = %38, %79
%40 = phi i64 [ %43, %79 ], [ 0, %38 ]
%41 = getelementptr inbounds i32, i32* %16, i64 %40
%42 = load i32, i32* %41
%43 = add nuw nsw i64 %40, 1
%44 = getelementptr inbounds i32, i32* %16, i64 %43
%45 = load i32, i32* %44
%46 = and i32 %45, 255
%47 = icmp eq i32 %46, 35
%48 = zext i1 %47 to i32
%49 = icmp eq i32 %46, 98
%50 = select i1 %49, i32 -1, i32 %48
%51 = trunc i32 %42 to i8
%52 = and i8 %51, -33
switch i8 %52, label %79 [
i8 65, label %53
i8 66, label %56
i8 67, label %59
i8 68, label %61
i8 69, label %64
i8 70, label %67
i8 71, label %70
]
53: ; preds = %39
%54 = add i32 %50, %2
%55 = add i32 %54, 9
br label %73
56: ; preds = %39
%57 = add i32 %50, %2
%58 = add i32 %57, 11
br label %73
59: ; preds = %39
%60 = add nsw i32 %50, %2
br label %73
61: ; preds = %39
%62 = add i32 %50, %2
%63 = add i32 %62, 2
br label %73
64: ; preds = %39
%65 = add i32 %50, %2
%66 = add i32 %65, 4
br label %73
67: ; preds = %39
%68 = add i32 %50, %2
%69 = add i32 %68, 5
br label %73
70: ; preds = %39
%71 = add i32 %50, %2
%72 = add i32 %71, 7
br label %73
73: ; preds = %53, %59, %64, %70, %67, %61, %56
%74 = phi i32 [ %58, %56 ], [ %63, %61 ], [ %69, %67 ], [ %72, %70 ], [ %66, %64 ], [ %60, %59 ], [ %55, %53 ]
%75 = srem i32 %74, 12
%76 = sext i32 %75 to i64
%77 = shl i64 %76, 2
%78 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.writeNewTab to i8*), i64 %77)
br label %79
79: ; preds = %73, %39
%80 = phi i8* [ %24, %39 ], [ %78, %73 ]
%81 = load i32*, i32** %1
%82 = call i32 @fputs(i8* %80, i32* %81)
%83 = icmp eq i64 %40, %27
br i1 %83, label %94, label %39
84: ; preds = %37, %84
%85 = phi i64 [ %90, %84 ], [ 0, %37 ]
%86 = getelementptr inbounds i32, i32* %16, i64 %85
%87 = load i32, i32* %86
%88 = load i32*, i32** %1
%89 = tail call i32 @fputc(i32 %87, i32* %88)
%90 = add nuw i64 %85, 1
%91 = icmp eq i64 %85, %27
br i1 %91, label %94, label %84
92: ; preds = %25
%93 = add nsw i32 %29, 1
br label %94
94: ; preds = %84, %79, %37, %38, %92, %32
%95 = phi i32 [ %93, %92 ], [ %29, %32 ], [ 0, %38 ], [ 0, %37 ], [ 0, %79 ], [ 0, %84 ]
%96 = phi i32 [ %28, %92 ], [ %33, %32 ], [ 0, %38 ], [ 0, %37 ], [ 0, %79 ], [ 0, %84 ]
%97 = phi i64 [ %30, %92 ], [ %30, %32 ], [ 0, %38 ], [ 0, %37 ], [ 0, %79 ], [ 0, %84 ]
%98 = load i32*, i32** %0
%99 = tail call i32 @fgetc(i32* %98)
%100 = load i32, i32* @EOF
%101 = icmp eq i32 %99, %100
br i1 %101, label %102, label %25
102: ; preds = %94, %18
%103 = tail call i32 @free(i32* %16)
br label %104
104: ; preds = %3, %102
ret void
}