#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*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(int *);
int getc(int /*<<< orphan*/ *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *, ...);
int *realloc(int *, size_t);
void formatter(FILE *ifp, FILE *ofp, int width) {
  int *file;
  int size = 0;
  int c;
  size_t buff_size = 1024 * sizeof(int);
  file = (int *)malloc(buff_size);
  while ((c = getc(ifp)) != -1) {
    if (size == buff_size / sizeof(int)) {
      file = realloc(file, buff_size *= 2);
    }
    if (c == '\n' && file[size - 1] == ' ' ||
        c == ' ' && file[size - 1] == ' ') {
      continue;
    } else {
      if (c == '\n') {
        file[size] = ' ';
        size++;
        continue;
      } else {
        file[size] = c;
        size++;
      }
    }
  }
  int index = 0;
  int spaces = 0;
  int space_count = 0;
  int total_count = 0;
  int temp_index = width - 1;
  int space_quotient;
  int i;
  int line_count = 1;
  int subs = 0;
  int adds = 0;
  int op_diff = 0;
  int avg_subs = 0;
  int avg_adds = 0;
  int avg_op_diff = 0;
  while (index < size) {
    spaces = 0;
    if (file[temp_index + 1] == ' ') {
      temp_index++;
    } else {
      while (file[temp_index] != ' ') {
        temp_index--;
        spaces++;
      }
      spaces++;
    }
    subs += spaces;
    i = index;
    space_count = 0;
    total_count = 0;
    while (i < temp_index) {
      if (file[i] == ' ') {
        space_count++;
      }
      total_count++;
      i++;
    }
    adds += total_count;
    if (space_count != 0) {
      space_quotient = (spaces / space_count);
    }
    printf("%d. [sc/s/sq] :: (%d/%d/%d) - %d => ", line_count, space_count,
           spaces, space_quotient, total_count);
    while (index < temp_index) {
      if (file[index] == ' ' && spaces > 0 && space_count == 1) {
        while (spaces > 0) {
          fputc(' ', ofp);
          spaces--;
          total_count++;
        }
      } else if (file[index] == ' ' && space_quotient > 0 && spaces > 0) {
        i = 0;
        while (i < space_quotient) {
          fputc(' ', ofp);
          spaces--;
          total_count++;
          i++;
        }
        space_count--;
      } else if (file[index] == ' ' && space_quotient == 0 && spaces > 0) {
        fputc(' ', ofp);
        spaces--;
        space_count--;
        total_count++;
      }
      fputc(file[index], ofp);
      index++;
    }
    index++;
    printf("%d/%d/%d) - %d\n", space_count, spaces, space_quotient,
           total_count);
    fputc('\n', ofp);
    temp_index += width;
    line_count++;
    if (temp_index > size) {
      while (index < size) {
        fputc(file[index], ofp);
        index++;
      }
      break;
    }
  }
  avg_subs = (subs / line_count);
  avg_adds = (adds / line_count);
  op_diff = (adds - subs);
  avg_op_diff = (avg_adds - avg_subs);
  printf("\nFor finding where to properly end a line for a given width:\n");
  printf("Total amount of characters (after removing newlines): %d\n\n",
         size + 1);
  printf("%s\n", "End to start method:");
  printf("Subtractions: %d\nAverage subtractions: %d\n\n", subs, avg_subs);
  printf("%s\n", "Start to end method:");
  printf("Additions: %d\nAverage additions: %d\n\n", adds, avg_adds);
  printf("This method does ~%d less operations in total\n", op_diff);
  printf("With roughly ~%d less operations on average\n\n", avg_op_diff);
  free(file);
}


x86 assembly (clang, -O0):
<formatter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x24(%rbp)
movq   $0x1000,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <getc@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
je     1261 <formatter+0x101>
movslq -0x24(%rbp),%rax
mov    -0x30(%rbp),%rcx
shr    $0x2,%rcx
cmp    %rcx,%rax
jne    11d2 <formatter+0x72>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
shl    $0x1,%rsi
mov    %rsi,-0x30(%rbp)
call   1070 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0xa,-0x28(%rbp)
jne    11f3 <formatter+0x93>
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0x20,(%rax,%rcx,4)
je     1214 <formatter+0xb4>
cmpl   $0x20,-0x28(%rbp)
jne    1219 <formatter+0xb9>
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0x20,(%rax,%rcx,4)
jne    1219 <formatter+0xb9>
jmp    118f <formatter+0x2f>
cmpl   $0xa,-0x28(%rbp)
jne    1240 <formatter+0xe0>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movl   $0x20,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118f <formatter+0x2f>
mov    -0x28(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    125c <formatter+0xfc>
jmp    118f <formatter+0x2f>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x44(%rbp)
movl   $0x1,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    15a5 <formatter+0x445>
movl   $0x0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0x20,(%rax,%rcx,4)
jne    12ef <formatter+0x18f>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1326 <formatter+0x1c6>
jmp    12f4 <formatter+0x194>
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
cmpl   $0x20,(%rax,%rcx,4)
je     131d <formatter+0x1bd>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12f4 <formatter+0x194>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
add    -0x54(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1381 <formatter+0x221>
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
cmpl   $0x20,(%rax,%rcx,4)
jne    136a <formatter+0x20a>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1343 <formatter+0x1e3>
mov    -0x40(%rbp),%eax
add    -0x58(%rbp),%eax
mov    %eax,-0x58(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     139e <formatter+0x23e>
mov    -0x38(%rbp),%eax
cltd
idivl  -0x3c(%rbp)
mov    %eax,-0x48(%rbp)
mov    -0x50(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x48(%rbp),%r8d
mov    -0x40(%rbp),%r9d
lea    0xc4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1518 <formatter+0x3b8>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x20,(%rax,%rcx,4)
jne    1428 <formatter+0x2c8>
cmpl   $0x0,-0x38(%rbp)
jle    1428 <formatter+0x2c8>
cmpl   $0x1,-0x3c(%rbp)
jne    1428 <formatter+0x2c8>
jmp    13f4 <formatter+0x294>
cmpl   $0x0,-0x38(%rbp)
jle    1423 <formatter+0x2c3>
mov    -0x10(%rbp),%rsi
mov    $0x20,%edi
call   1050 <fputc@plt>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    13f4 <formatter+0x294>
jmp    14f6 <formatter+0x396>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x20,(%rax,%rcx,4)
jne    149d <formatter+0x33d>
cmpl   $0x0,-0x48(%rbp)
jle    149d <formatter+0x33d>
cmpl   $0x0,-0x38(%rbp)
jle    149d <formatter+0x33d>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    148f <formatter+0x32f>
mov    -0x10(%rbp),%rsi
mov    $0x20,%edi
call   1050 <fputc@plt>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1455 <formatter+0x2f5>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
jmp    14f1 <formatter+0x391>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x20,(%rax,%rcx,4)
jne    14ec <formatter+0x38c>
cmpl   $0x0,-0x48(%rbp)
jne    14ec <formatter+0x38c>
cmpl   $0x0,-0x38(%rbp)
jle    14ec <formatter+0x38c>
mov    -0x10(%rbp),%rsi
mov    $0x20,%edi
call   1050 <fputc@plt>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    14f1 <formatter+0x391>
jmp    14f6 <formatter+0x396>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rsi
call   1050 <fputc@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13bd <formatter+0x25d>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    -0x40(%rbp),%r8d
lea    0xaf0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    $0xa,%edi
call   1050 <fputc@plt>
mov    -0x14(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    15a0 <formatter+0x440>
jmp    156d <formatter+0x40d>
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    159b <formatter+0x43b>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rsi
call   1050 <fputc@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    156d <formatter+0x40d>
jmp    15a5 <formatter+0x445>
jmp    12b7 <formatter+0x157>
mov    -0x54(%rbp),%eax
cltd
idivl  -0x50(%rbp)
mov    %eax,-0x60(%rbp)
mov    -0x58(%rbp),%eax
cltd
idivl  -0x50(%rbp)
mov    %eax,-0x64(%rbp)
mov    -0x58(%rbp),%eax
sub    -0x54(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x64(%rbp),%eax
sub    -0x60(%rbp),%eax
mov    %eax,-0x68(%rbp)
lea    0xa63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
add    $0x1,%esi
lea    0xa8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xaba(%rip),%rdi
lea    0xab7(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x54(%rbp),%esi
mov    -0x60(%rbp),%edx
lea    0xab8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xa91(%rip),%rdi
lea    0xacf(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x58(%rbp),%esi
mov    -0x64(%rbp),%edx
lea    0xad0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x5c(%rbp),%esi
lea    0xae5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%esi
lea    0xb03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<formatter>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,0x20(%rsp)
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x1000,%r12d
mov    $0x1000,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1090 <getc@plt>
cmp    $0xffffffff,%eax
je     1205 <formatter+0x95>
mov    %eax,%ebp
xor    %r13d,%r13d
jmp    11c7 <formatter+0x57>
cmpl   $0x20,-0x4(%r15,%r13,4)
jne    11fb <formatter+0x8b>
mov    %r14,%rdi
call   1090 <getc@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
je     1208 <formatter+0x98>
mov    %r12,%rax
shr    $0x2,%rax
cmp    %r13,%rax
jne    11e4 <formatter+0x74>
add    %r12,%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1080 <realloc@plt>
mov    %rax,%r15
cmp    $0x20,%ebp
je     11b0 <formatter+0x40>
cmp    $0xa,%ebp
jne    11fb <formatter+0x8b>
cmpl   $0x20,-0x4(%r15,%r13,4)
je     11b8 <formatter+0x48>
mov    $0x20,%ebp
mov    %ebp,(%r15,%r13,4)
add    $0x1,%r13
jmp    11b8 <formatter+0x48>
xor    %r13d,%r13d
mov    %r15,%r12
mov    0x20(%rsp),%rax
lea    -0x1(%rax),%edx
lea    -0x4(%r15),%rax
mov    %rax,0x38(%rsp)
lea    0x30(%r15),%rax
mov    %rax,0x30(%rsp)
mov    $0x1,%esi
movdqa 0xdce(%rip),%xmm6
xor    %r15d,%r15d
xor    %r14d,%r14d
movl   $0x0,0x18(%rsp)
mov    %r12,0x28(%rsp)
mov    %r13,0x40(%rsp)
jmp    12de <formatter+0x16e>
nop
xor    %ebp,%ebp
lea    0xdb7(%rip),%rdi
mov    %eax,%r13d
xor    %edx,%edx
mov    %r14d,%ecx
mov    %r15d,0xc(%rsp)
mov    0x8(%rsp),%r15d
mov    %r15d,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%eax
mov    0xc(%rsp),%ecx
mov    %r14d,%r13d
xor    %r8d,%r8d
add    %eax,%r14d
lea    0x1(%rcx),%eax
lea    0xda3(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%edx
mov    %r15d,0x8(%rsp)
mov    %rcx,%rbp
mov    %r15d,%ecx
mov    %eax,%r15d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    0x14(%rsp),%edx
add    0x20(%rsp),%edx
mov    0x10(%rsp),%esi
add    $0x1,%esi
mov    0x40(%rsp),%r13
cmp    %r13d,%edx
movdqa 0xd28(%rip),%xmm6
jg     1602 <formatter+0x492>
mov    %r14d,%eax
cmp    %r13d,%r15d
jge    1641 <formatter+0x4d1>
movslq %edx,%rcx
cmpl   $0x20,0x4(%r12,%rcx,4)
jne    1300 <formatter+0x190>
add    $0x1,%edx
xor    %r14d,%r14d
jmp    1335 <formatter+0x1c5>
nopl   (%rax)
xor    %r14d,%r14d
cmpl   $0x20,(%r12,%rcx,4)
je     1331 <formatter+0x1c1>
mov    0x38(%rsp),%rdi
lea    (%rdi,%rcx,4),%rcx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
cmpl   $0x20,(%rcx,%r14,4)
lea    -0x1(%r14),%r14
jne    1320 <formatter+0x1b0>
add    %r14d,%edx
neg    %r14d
add    $0x1,%r14d
mov    %edx,%r9d
sub    %r15d,%r9d
mov    %edx,0x14(%rsp)
mov    %esi,0x10(%rsp)
jle    1250 <formatter+0xe0>
movslq %r15d,%rcx
movslq %edx,%r11
mov    %r11,%r10
sub    %rcx,%r10
xor    %ebp,%ebp
cmp    $0x8,%r10
mov    %eax,0x1c(%rsp)
jae    1370 <formatter+0x200>
mov    0x8(%rsp),%eax
jmp    1460 <formatter+0x2f0>
nopw   0x0(%rax,%rax,1)
mov    %r15d,%r13d
mov    %r9d,%r15d
mov    %r10,%r8
and    $0xfffffffffffffff8,%r8
lea    -0x8(%r8),%rdi
mov    %rdi,%r9
shr    $0x3,%r9
add    $0x1,%r9
test   %rdi,%rdi
je     15e5 <formatter+0x475>
mov    %r9,%rdi
and    $0xfffffffffffffffe,%rdi
mov    0x30(%rsp),%rax
lea    (%rax,%rcx,4),%rdx
pxor   %xmm0,%xmm0
xor    %ebp,%ebp
pxor   %xmm1,%xmm1
mov    0x8(%rsp),%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqu -0x30(%rdx,%rbp,4),%xmm2
movdqu -0x20(%rdx,%rbp,4),%xmm3
movdqu -0x10(%rdx,%rbp,4),%xmm4
movdqu (%rdx,%rbp,4),%xmm5
pcmpeqd %xmm6,%xmm2
psubd  %xmm2,%xmm0
pcmpeqd %xmm6,%xmm3
psubd  %xmm3,%xmm1
pcmpeqd %xmm6,%xmm4
psubd  %xmm4,%xmm0
pcmpeqd %xmm6,%xmm5
psubd  %xmm5,%xmm1
add    $0x10,%rbp
add    $0xfffffffffffffffe,%rdi
jne    13c0 <formatter+0x250>
test   $0x1,%r9b
je     1427 <formatter+0x2b7>
add    %rcx,%rbp
movdqu (%r12,%rbp,4),%xmm2
movdqu 0x10(%r12,%rbp,4),%xmm3
pcmpeqd %xmm6,%xmm2
psubd  %xmm2,%xmm0
pcmpeqd %xmm6,%xmm3
psubd  %xmm3,%xmm1
paddd  %xmm1,%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%ebp
cmp    %r8,%r10
mov    %r15d,%r9d
jne    144e <formatter+0x2de>
mov    %r13d,%r15d
jmp    1475 <formatter+0x305>
add    %r8,%rcx
mov    %r13d,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edx,%edx
cmpl   $0x20,(%r12,%rcx,4)
sete   %dl
add    %edx,%ebp
add    $0x1,%rcx
cmp    %rcx,%r11
jne    1460 <formatter+0x2f0>
test   %ebp,%ebp
je     1481 <formatter+0x311>
mov    %r14d,%eax
cltd
idiv   %ebp
jmp    1483 <formatter+0x313>
xor    %ebp,%ebp
add    %r9d,0x18(%rsp)
lea    0xb81(%rip),%rdi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %eax,0x8(%rsp)
mov    %eax,%r8d
mov    %r9d,0xc(%rsp)
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r15d,0x14(%rsp)
jle    15c0 <formatter+0x450>
movslq %r15d,%r15
mov    %r14d,%r13d
jmp    14dd <formatter+0x36d>
nopw   0x0(%rax,%rax,1)
mov    (%r12,%r15,4),%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
add    $0x1,%r15
mov    0x14(%rsp),%eax
cmp    %r15d,%eax
je     15d0 <formatter+0x460>
mov    (%r12,%r15,4),%eax
cmp    $0x20,%eax
jne    1530 <formatter+0x3c0>
test   %r13d,%r13d
jle    1530 <formatter+0x3c0>
cmp    $0x1,%ebp
jne    1530 <formatter+0x3c0>
lea    0x1(%r13),%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1500 <formatter+0x390>
add    %r13d,0xc(%rsp)
mov    $0x1,%ebp
xor    %r13d,%r13d
jmp    14c0 <formatter+0x350>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpl   $0x0,0x8(%rsp)
jle    1580 <formatter+0x410>
cmp    $0x20,%eax
jne    1580 <formatter+0x410>
test   %r13d,%r13d
jle    1580 <formatter+0x410>
mov    0x8(%rsp),%r12d
sub    %r12d,%r13d
nopl   0x0(%rax)
mov    $0x20,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
add    $0xffffffff,%r12d
jne    1550 <formatter+0x3e0>
mov    0xc(%rsp),%eax
add    0x8(%rsp),%eax
mov    %eax,0xc(%rsp)
add    $0xffffffff,%ebp
mov    0x28(%rsp),%r12
jmp    14c0 <formatter+0x350>
nopl   0x0(%rax)
cmpl   $0x0,0x8(%rsp)
jne    14c0 <formatter+0x350>
cmp    $0x20,%eax
jne    14c0 <formatter+0x350>
test   %r13d,%r13d
jle    14c0 <formatter+0x350>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
add    $0xffffffff,%r13d
add    $0xffffffff,%ebp
addl   $0x1,0xc(%rsp)
jmp    14c0 <formatter+0x350>
nopl   0x0(%rax,%rax,1)
mov    %r15d,%ecx
mov    %r14d,%r13d
jmp    15d2 <formatter+0x462>
nopl   0x0(%rax,%rax,1)
mov    %eax,%ecx
mov    0x1c(%rsp),%eax
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%r8d
jmp    1285 <formatter+0x115>
pxor   %xmm0,%xmm0
xor    %ebp,%ebp
pxor   %xmm1,%xmm1
mov    0x8(%rsp),%eax
test   $0x1,%r9b
jne    1407 <formatter+0x297>
jmp    1427 <formatter+0x2b7>
cmp    %r13d,%r15d
jge    163e <formatter+0x4ce>
mov    %r15d,%eax
mov    %esi,0x10(%rsp)
movslq %r15d,%rax
lea    (%r12,%rax,4),%r12
mov    %rbp,%r15
not    %r15d
add    %r13d,%r15d
xor    %ebp,%ebp
mov    (%r12,%rbp,4),%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
add    $0x1,%rbp
cmp    %ebp,%r15d
jne    1620 <formatter+0x4b0>
mov    %r14d,%eax
mov    0x10(%rsp),%esi
jmp    1641 <formatter+0x4d1>
mov    %r14d,%eax
mov    %eax,%r14d
cltd
idiv   %esi
mov    %eax,%r12d
mov    0x18(%rsp),%ebp
mov    %ebp,%eax
cltd
idiv   %esi
mov    %eax,%r15d
mov    %eax,0x8(%rsp)
mov    %ebp,%ebx
sub    %r14d,%ebx
sub    %r12d,%r15d
lea    0xaf0(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13d
lea    0x9cc(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x9f6(%rip),%rdi
call   1040 <puts@plt>
lea    0x9ff(%rip),%rdi
mov    %r14d,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xa17(%rip),%rdi
call   1040 <puts@plt>
lea    0xa20(%rip),%rdi
mov    %ebp,%esi
mov    0x8(%rsp),%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xa32(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xa51(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%rdi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"%d. [sc/s/sq] :: (%d/%d/%d) - %d => \00"
@.str.1 = [16 x i8] c"%d/%d/%d) - %d\0A\00"
@.str.2 = [62 x i8] c"\0AFor finding where to properly end a line for a given width:\0A\00"
@.str.3 = [59 x i8] c"Total amount of characters (after removing newlines): %d\0A\0A\00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [21 x i8] c"End to start method:\00"
@.str.6 = [44 x i8] c"Subtractions: %d\0AAverage subtractions: %d\0A\0A\00"
@.str.7 = [21 x i8] c"Start to end method:\00"
@.str.8 = [38 x i8] c"Additions: %d\0AAverage additions: %d\0A\0A\00"
@.str.9 = [47 x i8] c"This method does ~%d less operations in total\0A\00"
@.str.10 = [46 x i8] c"With roughly ~%d less operations on average\0A\0A\00"
define void @formatter(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 0, i32* %8
store i64 4096, i64* %10
%25 = load i64, i64* %10
%26 = call i64 @malloc(i64 %25)
%27 = inttoptr i64 %26 to i32*
store i32* %27, i32** %7
br label %28
28: ; preds = %85, %69, %65, %3
%29 = load i32*, i32** %4
%30 = call i32 @getc(i32* %29)
store i32 %30, i32* %9
%31 = icmp ne i32 %30, -1
br i1 %31, label %32, label %86
32: ; preds = %28
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = load i64, i64* %10
%36 = udiv i64 %35, 4
%37 = icmp eq i64 %34, %36
br i1 %37, label %38, label %43
38: ; preds = %32
%39 = load i32*, i32** %7
%40 = load i64, i64* %10
%41 = mul i64 %40, 2
store i64 %41, i64* %10
%42 = call i32* @realloc(i32* %39, i64 %41)
store i32* %42, i32** %7
br label %43
43: ; preds = %38, %32
%44 = load i32, i32* %9
%45 = icmp eq i32 %44, 10
br i1 %45, label %46, label %54
46: ; preds = %43
%47 = load i32*, i32** %7
%48 = load i32, i32* %8
%49 = sub nsw i32 %48, 1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i32, i32* %47, i64 %50
%52 = load i32, i32* %51
%53 = icmp eq i32 %52, 32
br i1 %53, label %65, label %54
54: ; preds = %46, %43
%55 = load i32, i32* %9
%56 = icmp eq i32 %55, 32
br i1 %56, label %57, label %66
57: ; preds = %54
%58 = load i32*, i32** %7
%59 = load i32, i32* %8
%60 = sub nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %58, i64 %61
%63 = load i32, i32* %62
%64 = icmp eq i32 %63, 32
br i1 %64, label %65, label %66
65: ; preds = %57, %46
br label %28
66: ; preds = %57, %54
%67 = load i32, i32* %9
%68 = icmp eq i32 %67, 10
br i1 %68, label %69, label %76
69: ; preds = %66
%70 = load i32*, i32** %7
%71 = load i32, i32* %8
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i32, i32* %70, i64 %72
store i32 32, i32* %73
%74 = load i32, i32* %8
%75 = add nsw i32 %74, 1
store i32 %75, i32* %8
br label %28
76: ; preds = %66
%77 = load i32, i32* %9
%78 = load i32*, i32** %7
%79 = load i32, i32* %8
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i32, i32* %78, i64 %80
store i32 %77, i32* %81
%82 = load i32, i32* %8
%83 = add nsw i32 %82, 1
store i32 %83, i32* %8
br label %84
84: ; preds = %76
br label %85
85: ; preds = %84
br label %28
86: ; preds = %28
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
%87 = load i32, i32* %6
%88 = sub nsw i32 %87, 1
store i32 %88, i32* %15
store i32 1, i32* %18
store i32 0, i32* %19
store i32 0, i32* %20
store i32 0, i32* %21
store i32 0, i32* %22
store i32 0, i32* %23
store i32 0, i32* %24
br label %89
89: ; preds = %288, %86
%90 = load i32, i32* %11
%91 = load i32, i32* %8
%92 = icmp slt i32 %90, %91
br i1 %92, label %93, label %289
93: ; preds = %89
store i32 0, i32* %12
%94 = load i32*, i32** %7
%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 = icmp eq i32 %99, 32
br i1 %100, label %101, label %104
101: ; preds = %93
%102 = load i32, i32* %15
%103 = add nsw i32 %102, 1
store i32 %103, i32* %15
br label %120
104: ; preds = %93
br label %105
105: ; preds = %112, %104
%106 = load i32*, i32** %7
%107 = load i32, i32* %15
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i32, i32* %106, i64 %108
%110 = load i32, i32* %109
%111 = icmp ne i32 %110, 32
br i1 %111, label %112, label %117
112: ; preds = %105
%113 = load i32, i32* %15
%114 = add nsw i32 %113, -1
store i32 %114, i32* %15
%115 = load i32, i32* %12
%116 = add nsw i32 %115, 1
store i32 %116, i32* %12
br label %105
117: ; preds = %105
%118 = load i32, i32* %12
%119 = add nsw i32 %118, 1
store i32 %119, i32* %12
br label %120
120: ; preds = %117, %101
%121 = load i32, i32* %12
%122 = load i32, i32* %19
%123 = add nsw i32 %122, %121
store i32 %123, i32* %19
%124 = load i32, i32* %11
store i32 %124, i32* %17
store i32 0, i32* %13
store i32 0, i32* %14
br label %125
125: ; preds = %139, %120
%126 = load i32, i32* %17
%127 = load i32, i32* %15
%128 = icmp slt i32 %126, %127
br i1 %128, label %129, label %144
129: ; preds = %125
%130 = load i32*, i32** %7
%131 = load i32, i32* %17
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i32, i32* %130, i64 %132
%134 = load i32, i32* %133
%135 = icmp eq i32 %134, 32
br i1 %135, label %136, label %139
136: ; preds = %129
%137 = load i32, i32* %13
%138 = add nsw i32 %137, 1
store i32 %138, i32* %13
br label %139
139: ; preds = %136, %129
%140 = load i32, i32* %14
%141 = add nsw i32 %140, 1
store i32 %141, i32* %14
%142 = load i32, i32* %17
%143 = add nsw i32 %142, 1
store i32 %143, i32* %17
br label %125
144: ; preds = %125
%145 = load i32, i32* %14
%146 = load i32, i32* %20
%147 = add nsw i32 %146, %145
store i32 %147, i32* %20
%148 = load i32, i32* %13
%149 = icmp ne i32 %148, 0
br i1 %149, label %150, label %154
150: ; preds = %144
%151 = load i32, i32* %12
%152 = load i32, i32* %13
%153 = sdiv i32 %151, %152
store i32 %153, i32* %16
br label %154
154: ; preds = %150, %144
%155 = load i32, i32* %18
%156 = load i32, i32* %13
%157 = load i32, i32* %12
%158 = load i32, i32* %16
%159 = load i32, i32* %14
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %155, i32 %156, i32 %157, i32 %158, i32 %159)
br label %161
161: ; preds = %244, %154
%162 = load i32, i32* %11
%163 = load i32, i32* %15
%164 = icmp slt i32 %162, %163
br i1 %164, label %165, label %254
165: ; preds = %161
%166 = load i32*, i32** %7
%167 = load i32, i32* %11
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds i32, i32* %166, i64 %168
%170 = load i32, i32* %169
%171 = icmp eq i32 %170, 32
br i1 %171, label %172, label %190
172: ; preds = %165
%173 = load i32, i32* %12
%174 = icmp sgt i32 %173, 0
br i1 %174, label %175, label %190
175: ; preds = %172
%176 = load i32, i32* %13
%177 = icmp eq i32 %176, 1
br i1 %177, label %178, label %190
178: ; preds = %175
br label %179
179: ; preds = %182, %178
%180 = load i32, i32* %12
%181 = icmp sgt i32 %180, 0
br i1 %181, label %182, label %189
182: ; preds = %179
%183 = load i32*, i32** %5
%184 = call i32 @fputc(i32 32, i32* %183)
%185 = load i32, i32* %12
%186 = add nsw i32 %185, -1
store i32 %186, i32* %12
%187 = load i32, i32* %14
%188 = add nsw i32 %187, 1
store i32 %188, i32* %14
br label %179
189: ; preds = %179
br label %244
190: ; preds = %175, %172, %165
%191 = load i32*, i32** %7
%192 = load i32, i32* %11
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds i32, i32* %191, i64 %193
%195 = load i32, i32* %194
%196 = icmp eq i32 %195, 32
br i1 %196, label %197, label %220
197: ; preds = %190
%198 = load i32, i32* %16
%199 = icmp sgt i32 %198, 0
br i1 %199, label %200, label %220
200: ; preds = %197
%201 = load i32, i32* %12
%202 = icmp sgt i32 %201, 0
br i1 %202, label %203, label %220
203: ; preds = %200
store i32 0, i32* %17
br label %204
204: ; preds = %208, %203
%205 = load i32, i32* %17
%206 = load i32, i32* %16
%207 = icmp slt i32 %205, %206
br i1 %207, label %208, label %217
208: ; preds = %204
%209 = load i32*, i32** %5
%210 = call i32 @fputc(i32 32, i32* %209)
%211 = load i32, i32* %12
%212 = add nsw i32 %211, -1
store i32 %212, i32* %12
%213 = load i32, i32* %14
%214 = add nsw i32 %213, 1
store i32 %214, i32* %14
%215 = load i32, i32* %17
%216 = add nsw i32 %215, 1
store i32 %216, i32* %17
br label %204
217: ; preds = %204
%218 = load i32, i32* %13
%219 = add nsw i32 %218, -1
store i32 %219, i32* %13
br label %243
220: ; preds = %200, %197, %190
%221 = load i32*, i32** %7
%222 = load i32, i32* %11
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds i32, i32* %221, i64 %223
%225 = load i32, i32* %224
%226 = icmp eq i32 %225, 32
br i1 %226, label %227, label %242
227: ; preds = %220
%228 = load i32, i32* %16
%229 = icmp eq i32 %228, 0
br i1 %229, label %230, label %242
230: ; preds = %227
%231 = load i32, i32* %12
%232 = icmp sgt i32 %231, 0
br i1 %232, label %233, label %242
233: ; preds = %230
%234 = load i32*, i32** %5
%235 = call i32 @fputc(i32 32, i32* %234)
%236 = load i32, i32* %12
%237 = add nsw i32 %236, -1
store i32 %237, i32* %12
%238 = load i32, i32* %13
%239 = add nsw i32 %238, -1
store i32 %239, i32* %13
%240 = load i32, i32* %14
%241 = add nsw i32 %240, 1
store i32 %241, i32* %14
br label %242
242: ; preds = %233, %230, %227, %220
br label %243
243: ; preds = %242, %217
br label %244
244: ; preds = %243, %189
%245 = load i32*, i32** %7
%246 = load i32, i32* %11
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds i32, i32* %245, i64 %247
%249 = load i32, i32* %248
%250 = load i32*, i32** %5
%251 = call i32 @fputc(i32 %249, i32* %250)
%252 = load i32, i32* %11
%253 = add nsw i32 %252, 1
store i32 %253, i32* %11
br label %161
254: ; preds = %161
%255 = load i32, i32* %11
%256 = add nsw i32 %255, 1
store i32 %256, i32* %11
%257 = load i32, i32* %13
%258 = load i32, i32* %12
%259 = load i32, i32* %16
%260 = load i32, i32* %14
%261 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %257, i32 %258, i32 %259, i32 %260)
%262 = load i32*, i32** %5
%263 = call i32 @fputc(i32 10, i32* %262)
%264 = load i32, i32* %6
%265 = load i32, i32* %15
%266 = add nsw i32 %265, %264
store i32 %266, i32* %15
%267 = load i32, i32* %18
%268 = add nsw i32 %267, 1
store i32 %268, i32* %18
%269 = load i32, i32* %15
%270 = load i32, i32* %8
%271 = icmp sgt i32 %269, %270
br i1 %271, label %272, label %288
272: ; preds = %254
br label %273
273: ; preds = %277, %272
%274 = load i32, i32* %11
%275 = load i32, i32* %8
%276 = icmp slt i32 %274, %275
br i1 %276, label %277, label %287
277: ; preds = %273
%278 = load i32*, i32** %7
%279 = load i32, i32* %11
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds i32, i32* %278, i64 %280
%282 = load i32, i32* %281
%283 = load i32*, i32** %5
%284 = call i32 @fputc(i32 %282, i32* %283)
%285 = load i32, i32* %11
%286 = add nsw i32 %285, 1
store i32 %286, i32* %11
br label %273
287: ; preds = %273
br label %289
288: ; preds = %254
br label %89
289: ; preds = %287, %89
%290 = load i32, i32* %19
%291 = load i32, i32* %18
%292 = sdiv i32 %290, %291
store i32 %292, i32* %22
%293 = load i32, i32* %20
%294 = load i32, i32* %18
%295 = sdiv i32 %293, %294
store i32 %295, i32* %23
%296 = load i32, i32* %20
%297 = load i32, i32* %19
%298 = sub nsw i32 %296, %297
store i32 %298, i32* %21
%299 = load i32, i32* %23
%300 = load i32, i32* %22
%301 = sub nsw i32 %299, %300
store i32 %301, i32* %24
%302 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%303 = load i32, i32* %8
%304 = add nsw i32 %303, 1
%305 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i32 %304)
%306 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%307 = load i32, i32* %19
%308 = load i32, i32* %22
%309 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %307, i32 %308)
%310 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%311 = load i32, i32* %20
%312 = load i32, i32* %23
%313 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i32 %311, i32 %312)
%314 = load i32, i32* %21
%315 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i32 %314)
%316 = load i32, i32* %24
%317 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i32 %316)
%318 = load i32*, i32** %7
%319 = call i32 @free(i32* %318)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"%d. [sc/s/sq] :: (%d/%d/%d) - %d => \00"
@.str.1 = [16 x i8] c"%d/%d/%d) - %d\0A\00"
@.str.3 = [59 x i8] c"Total amount of characters (after removing newlines): %d\0A\0A\00"
@.str.5 = [21 x i8] c"End to start method:\00"
@.str.6 = [44 x i8] c"Subtractions: %d\0AAverage subtractions: %d\0A\0A\00"
@.str.7 = [21 x i8] c"Start to end method:\00"
@.str.8 = [38 x i8] c"Additions: %d\0AAverage additions: %d\0A\0A\00"
@.str.9 = [47 x i8] c"This method does ~%d less operations in total\0A\00"
@.str.10 = [46 x i8] c"With roughly ~%d less operations on average\0A\0A\00"
@str = [61 x i8] c"\0AFor finding where to properly end a line for a given width:\00"
define void @formatter(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = tail call i64 @malloc(i64 4096)
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @getc(i32* %0)
%7 = icmp eq i32 %6, -1
br i1 %7, label %47, label %8
8: ; preds = %3, %37
%9 = phi i64 [ %40, %37 ], [ 0, %3 ]
%10 = phi i32 [ %41, %37 ], [ %6, %3 ]
%11 = phi i64 [ %25, %37 ], [ 4096, %3 ]
%12 = phi i32* [ %24, %37 ], [ %5, %3 ]
%13 = add nsw i64 %9, -1
br label %14
14: ; preds = %8, %34
%15 = phi i32 [ %10, %8 ], [ %35, %34 ]
%16 = phi i64 [ %11, %8 ], [ %25, %34 ]
%17 = phi i32* [ %12, %8 ], [ %24, %34 ]
%18 = lshr i64 %16, 2
%19 = icmp eq i64 %18, %9
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = shl i64 %16, 1
%22 = tail call i32* @realloc(i32* %17, i64 %21)
br label %23
23: ; preds = %20, %14
%24 = phi i32* [ %22, %20 ], [ %17, %14 ]
%25 = phi i64 [ %21, %20 ], [ %16, %14 ]
switch i32 %15, label %37 [
i32 10, label %26
i32 32, label %30
]
26: ; preds = %23
%27 = getelementptr inbounds i32, i32* %24, i64 %13
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 32
br i1 %29, label %34, label %37
30: ; preds = %23
%31 = getelementptr inbounds i32, i32* %24, i64 %13
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 32
br i1 %33, label %34, label %37
34: ; preds = %30, %26
%35 = tail call i32 @getc(i32* %0)
%36 = icmp eq i32 %35, -1
br i1 %36, label %43, label %14
37: ; preds = %26, %30, %23
%38 = phi i32 [ %15, %23 ], [ %15, %30 ], [ 32, %26 ]
%39 = getelementptr inbounds i32, i32* %24, i64 %9
store i32 %38, i32* %39
%40 = add nuw i64 %9, 1
%41 = tail call i32 @getc(i32* %0)
%42 = icmp eq i32 %41, -1
br i1 %42, label %45, label %8
43: ; preds = %34
%44 = trunc i64 %9 to i32
br label %47
45: ; preds = %37
%46 = trunc i64 %40 to i32
br label %47
47: ; preds = %45, %43, %3
%48 = phi i32 [ 0, %3 ], [ %44, %43 ], [ %46, %45 ]
%49 = phi i32* [ %5, %3 ], [ %24, %43 ], [ %24, %45 ]
%50 = add nsw i32 %2, -1
br label %51
51: ; preds = %245, %47
%52 = phi i32 [ 0, %47 ], [ %252, %245 ]
%53 = phi i32 [ %50, %47 ], [ %255, %245 ]
%54 = phi i32 [ undef, %47 ], [ %246, %245 ]
%55 = phi i32 [ 1, %47 ], [ %256, %245 ]
%56 = phi i32 [ 0, %47 ], [ %87, %245 ]
%57 = phi i32 [ 0, %47 ], [ %247, %245 ]
%58 = icmp slt i32 %52, %48
br i1 %58, label %59, label %270
59: ; preds = %51
%60 = add nsw i32 %53, 1
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %49, i64 %61
%63 = load i32, i32* %62
%64 = icmp eq i32 %63, 32
br i1 %64, label %84, label %65
65: ; preds = %59
%66 = sext i32 %53 to i64
%67 = getelementptr inbounds i32, i32* %49, i64 %66
%68 = load i32, i32* %67
%69 = icmp eq i32 %68, 32
br i1 %69, label %80, label %70
70: ; preds = %65, %70
%71 = phi i64 [ %73, %70 ], [ %66, %65 ]
%72 = phi i32 [ %74, %70 ], [ 0, %65 ]
%73 = add i64 %71, -1
%74 = add nuw nsw i32 %72, 1
%75 = getelementptr inbounds i32, i32* %49, i64 %73
%76 = load i32, i32* %75
%77 = icmp eq i32 %76, 32
br i1 %77, label %78, label %70
78: ; preds = %70
%79 = trunc i64 %73 to i32
br label %80
80: ; preds = %78, %65
%81 = phi i32 [ 0, %65 ], [ %74, %78 ]
%82 = phi i32 [ %53, %65 ], [ %79, %78 ]
%83 = add nuw nsw i32 %81, 1
br label %84
84: ; preds = %59, %80
%85 = phi i32 [ %83, %80 ], [ 0, %59 ]
%86 = phi i32 [ %82, %80 ], [ %60, %59 ]
%87 = add nsw i32 %85, %56
%88 = icmp sgt i32 %86, %52
br i1 %88, label %91, label %89
89: ; preds = %84
%90 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %55, i32 0, i32 %85, i32 %54, i32 0)
br label %245
91: ; preds = %84
%92 = sext i32 %52 to i64
%93 = sext i32 %86 to i64
%94 = sub nsw i64 %93, %92
%95 = icmp ult i64 %94, 8
br i1 %95, label %168, label %96
96: ; preds = %91
%97 = and i64 %94, -8
%98 = add nsw i64 %97, %92
%99 = add nsw i64 %97, -8
%100 = lshr exact i64 %99, 3
%101 = add nuw nsw i64 %100, 1
%102 = and i64 %101, 1
%103 = icmp eq i64 %99, 0
br i1 %103, label %141, label %104
104: ; preds = %96
%105 = and i64 %101, 4611686018427387902
br label %106
106: ; preds = %106, %104
%107 = phi i64 [ 0, %104 ], [ %138, %106 ]
%108 = phi <4 x i32> [ zeroinitializer, %104 ], [ %136, %106 ]
%109 = phi <4 x i32> [ zeroinitializer, %104 ], [ %137, %106 ]
%110 = phi i64 [ 0, %104 ], [ %139, %106 ]
%111 = add i64 %107, %92
%112 = getelementptr inbounds i32, i32* %49, i64 %111
%113 = bitcast i32* %112 to <4 x i32>*
%114 = load <4 x i32>, <4 x i32>* %113
%115 = getelementptr inbounds i32, i32* %112, i64 4
%116 = bitcast i32* %115 to <4 x i32>*
%117 = load <4 x i32>, <4 x i32>* %116
%118 = icmp eq <4 x i32> %114, <i32 32, i32 32, i32 32, i32 32>
%119 = icmp eq <4 x i32> %117, <i32 32, i32 32, i32 32, i32 32>
%120 = zext <4 x i1> %118 to <4 x i32>
%121 = zext <4 x i1> %119 to <4 x i32>
%122 = add <4 x i32> %108, %120
%123 = add <4 x i32> %109, %121
%124 = or i64 %107, 8
%125 = add i64 %124, %92
%126 = getelementptr inbounds i32, i32* %49, i64 %125
%127 = bitcast i32* %126 to <4 x i32>*
%128 = load <4 x i32>, <4 x i32>* %127
%129 = getelementptr inbounds i32, i32* %126, i64 4
%130 = bitcast i32* %129 to <4 x i32>*
%131 = load <4 x i32>, <4 x i32>* %130
%132 = icmp eq <4 x i32> %128, <i32 32, i32 32, i32 32, i32 32>
%133 = icmp eq <4 x i32> %131, <i32 32, i32 32, i32 32, i32 32>
%134 = zext <4 x i1> %132 to <4 x i32>
%135 = zext <4 x i1> %133 to <4 x i32>
%136 = add <4 x i32> %122, %134
%137 = add <4 x i32> %123, %135
%138 = add nuw i64 %107, 16
%139 = add i64 %110, 2
%140 = icmp eq i64 %139, %105
br i1 %140, label %141, label %106
141: ; preds = %106, %96
%142 = phi <4 x i32> [ undef, %96 ], [ %136, %106 ]
%143 = phi <4 x i32> [ undef, %96 ], [ %137, %106 ]
%144 = phi i64 [ 0, %96 ], [ %138, %106 ]
%145 = phi <4 x i32> [ zeroinitializer, %96 ], [ %136, %106 ]
%146 = phi <4 x i32> [ zeroinitializer, %96 ], [ %137, %106 ]
%147 = icmp eq i64 %102, 0
br i1 %147, label %162, label %148
148: ; preds = %141
%149 = add i64 %144, %92
%150 = getelementptr inbounds i32, i32* %49, i64 %149
%151 = bitcast i32* %150 to <4 x i32>*
%152 = load <4 x i32>, <4 x i32>* %151
%153 = getelementptr inbounds i32, i32* %150, i64 4
%154 = bitcast i32* %153 to <4 x i32>*
%155 = load <4 x i32>, <4 x i32>* %154
%156 = icmp eq <4 x i32> %152, <i32 32, i32 32, i32 32, i32 32>
%157 = icmp eq <4 x i32> %155, <i32 32, i32 32, i32 32, i32 32>
%158 = zext <4 x i1> %156 to <4 x i32>
%159 = zext <4 x i1> %157 to <4 x i32>
%160 = add <4 x i32> %145, %158
%161 = add <4 x i32> %146, %159
br label %162
162: ; preds = %141, %148
%163 = phi <4 x i32> [ %142, %141 ], [ %160, %148 ]
%164 = phi <4 x i32> [ %143, %141 ], [ %161, %148 ]
%165 = add <4 x i32> %164, %163
%166 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %165)
%167 = icmp eq i64 %94, %97
br i1 %167, label %181, label %168
168: ; preds = %91, %162
%169 = phi i64 [ %92, %91 ], [ %98, %162 ]
%170 = phi i32 [ 0, %91 ], [ %166, %162 ]
br label %171
171: ; preds = %168, %171
%172 = phi i64 [ %179, %171 ], [ %169, %168 ]
%173 = phi i32 [ %178, %171 ], [ %170, %168 ]
%174 = getelementptr inbounds i32, i32* %49, i64 %172
%175 = load i32, i32* %174
%176 = icmp eq i32 %175, 32
%177 = zext i1 %176 to i32
%178 = add nuw nsw i32 %173, %177
%179 = add nsw i64 %172, 1
%180 = icmp eq i64 %179, %93
br i1 %180, label %181, label %171
181: ; preds = %171, %162
%182 = phi i32 [ %166, %162 ], [ %178, %171 ]
%183 = sub i32 %86, %52
%184 = add nuw nsw i32 %183, %57
%185 = icmp eq i32 %182, 0
br i1 %185, label %188, label %186
186: ; preds = %181
%187 = sdiv i32 %85, %182
br label %188
188: ; preds = %186, %181
%189 = phi i32 [ %182, %186 ], [ 0, %181 ]
%190 = phi i32 [ %187, %186 ], [ %54, %181 ]
%191 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %55, i32 %189, i32 %85, i32 %190, i32 %183)
br i1 %88, label %192, label %245
192: ; preds = %188
%193 = icmp sgt i32 %190, 0
%194 = icmp eq i32 %190, 0
%195 = sext i32 %52 to i64
br label %196
196: ; preds = %192, %236
%197 = phi i64 [ %195, %192 ], [ %242, %236 ]
%198 = phi i32 [ %183, %192 ], [ %239, %236 ]
%199 = phi i32 [ %189, %192 ], [ %238, %236 ]
%200 = phi i32 [ %85, %192 ], [ %237, %236 ]
%201 = getelementptr inbounds i32, i32* %49, i64 %197
%202 = load i32, i32* %201
%203 = icmp eq i32 %202, 32
%204 = icmp sgt i32 %200, 0
%205 = select i1 %203, i1 %204, i1 false
%206 = icmp eq i32 %199, 1
%207 = select i1 %205, i1 %206, i1 false
br i1 %207, label %208, label %213
208: ; preds = %196, %208
%209 = phi i32 [ %211, %208 ], [ %200, %196 ]
%210 = tail call i32 @fputc(i32 32, i32* %1)
%211 = add nsw i32 %209, -1
%212 = icmp ugt i32 %209, 1
br i1 %212, label %208, label %234
213: ; preds = %196
%214 = and i1 %193, %203
%215 = select i1 %214, i1 %204, i1 false
br i1 %215, label %216, label %226
216: ; preds = %213
%217 = sub nsw i32 %200, %190
br label %218
218: ; preds = %216, %218
%219 = phi i32 [ %221, %218 ], [ 0, %216 ]
%220 = tail call i32 @fputc(i32 32, i32* %1)
%221 = add nuw nsw i32 %219, 1
%222 = icmp eq i32 %221, %190
br i1 %222, label %223, label %218
223: ; preds = %218
%224 = add i32 %190, %198
%225 = add nsw i32 %199, -1
br label %236
226: ; preds = %213
%227 = and i1 %194, %203
%228 = select i1 %227, i1 %204, i1 false
br i1 %228, label %229, label %236
229: ; preds = %226
%230 = tail call i32 @fputc(i32 32, i32* %1)
%231 = add nsw i32 %200, -1
%232 = add nsw i32 %199, -1
%233 = add nsw i32 %198, 1
br label %236
234: ; preds = %208
%235 = add i32 %200, %198
br label %236
236: ; preds = %234, %223, %229, %226
%237 = phi i32 [ %217, %223 ], [ %231, %229 ], [ %200, %226 ], [ 0, %234 ]
%238 = phi i32 [ %225, %223 ], [ %232, %229 ], [ %199, %226 ], [ 1, %234 ]
%239 = phi i32 [ %224, %223 ], [ %233, %229 ], [ %198, %226 ], [ %235, %234 ]
%240 = load i32, i32* %201
%241 = tail call i32 @fputc(i32 %240, i32* %1)
%242 = add nsw i64 %197, 1
%243 = trunc i64 %242 to i32
%244 = icmp eq i32 %86, %243
br i1 %244, label %245, label %196
245: ; preds = %236, %89, %188
%246 = phi i32 [ %190, %188 ], [ %54, %89 ], [ %190, %236 ]
%247 = phi i32 [ %184, %188 ], [ %57, %89 ], [ %184, %236 ]
%248 = phi i32 [ %52, %188 ], [ %52, %89 ], [ %86, %236 ]
%249 = phi i32 [ %85, %188 ], [ %85, %89 ], [ %237, %236 ]
%250 = phi i32 [ %189, %188 ], [ 0, %89 ], [ %238, %236 ]
%251 = phi i32 [ %183, %188 ], [ 0, %89 ], [ %239, %236 ]
%252 = add nsw i32 %248, 1
%253 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %250, i32 %249, i32 %246, i32 %251)
%254 = tail call i32 @fputc(i32 10, i32* %1)
%255 = add nsw i32 %86, %2
%256 = add nuw nsw i32 %55, 1
%257 = icmp sgt i32 %255, %48
br i1 %257, label %258, label %51
258: ; preds = %245
%259 = icmp slt i32 %252, %48
br i1 %259, label %260, label %270
260: ; preds = %258
%261 = sext i32 %252 to i64
br label %262
262: ; preds = %260, %262
%263 = phi i64 [ %261, %260 ], [ %267, %262 ]
%264 = getelementptr inbounds i32, i32* %49, i64 %263
%265 = load i32, i32* %264
%266 = tail call i32 @fputc(i32 %265, i32* %1)
%267 = add nsw i64 %263, 1
%268 = trunc i64 %267 to i32
%269 = icmp eq i32 %48, %268
br i1 %269, label %270, label %262
270: ; preds = %51, %262, %258
%271 = phi i32 [ %256, %258 ], [ %256, %262 ], [ %55, %51 ]
%272 = phi i32 [ %87, %258 ], [ %87, %262 ], [ %56, %51 ]
%273 = phi i32 [ %247, %258 ], [ %247, %262 ], [ %57, %51 ]
%274 = sdiv i32 %272, %271
%275 = sdiv i32 %273, %271
%276 = sub nsw i32 %273, %272
%277 = sub nsw i32 %275, %274
%278 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%279 = add nsw i32 %48, 1
%280 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i32 %279)
%281 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%282 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %272, i32 %274)
%283 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%284 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i32 %273, i32 %275)
%285 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i32 %276)
%286 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i32 %277)
%287 = tail call i32 @free(i32* %49)
ret void
}