#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_CUR;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
unsigned char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fputc(unsigned char, int /*<<< orphan*/ *);
int fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int write_bits_to_file(FILE *fp, unsigned char *src, int length,
                       int file_size) {
  unsigned char val = 0;
  int offset = 0;
  int copied_count = 0;
  int status;
  do {
    if (0)
      fprintf(stderr, "file size=%d, length=%d\n", file_size, length);
  } while (0);
  status = fseek(fp, file_size / 8, SEEK_SET);
  if ((status == 0) != true) {
    fprintf(stderr, "info: %s:%d:\t",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/UTILS/"
            "test/test_bitops.c",
            105);
    fprintf(stderr, "Failed to seek file pointer to position to write to\n");
    assert(status == 0);
  };
  do {
    if (0)
      fprintf(stderr, "Starting position =%ld\n", ftell(fp));
  } while (0);
  if (file_size % 8 != 0) {
    do {
      if (0)
        fprintf(stderr, "Position before getting an element=%ld\n", ftell(fp));
    } while (0);
    val = fgetc(fp);
    do {
      if (0)
        fprintf(stderr, " Position after getting bit =%ld\n", ftell(fp));
    } while (0);
    if (!feof(fp) && ftell(fp) != 0) {
      int prev_locn = ftell(fp);
      status = fseek(fp, -1, SEEK_CUR);
      int new_locn = ftell(fp);
      if ((prev_locn - new_locn == 1) != true) {
        fprintf(stderr, "info: %s:%d:\t",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/UTILS/test/test_bitops.c",
                120);
        fprintf(stderr, "Failed to seek pointer back to original position\n");
        assert(prev_locn - new_locn == 1);
      };
    }
    do {
      if (0)
        fprintf(stderr, " Positionafter getting bit and stepping back =%ld\n",
                ftell(fp));
    } while (0);
    offset = file_size % 8;
    for (int i = 0; i + offset < 8 && i < length; i++) {
      copied_count++;
      int src_bit = (((src)[(i) / 8] & (1 << ((i) % 8))) > 0);
      do {
        if (0)
          fprintf(stderr, "Setting src bit %d at bit position %d\n", src_bit,
                  file_size + i);
      } while (0);
      if (src_bit) {
        (&val)[(offset + i) / 8] |= (1 << ((offset + i) % 8));
      } else {
        (&val)[(offset + i) / 8] &= ~(1 << ((offset + i) % 8));
      }
    }
    do {
      if (0)
        fprintf(stderr, "Position before putting the char back=%ld\n",
                ftell(fp));
    } while (0);
    status = fputc(val, fp);
    if ((status == val) != true) {
      fprintf(stderr, "info: %s:%d:\t",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/"
              "UTILS/test/test_bitops.c",
              144);
      fprintf(stderr, "Value returned by fputc must match\n");
      assert(status == val);
    };
    do {
      if (0)
        fprintf(stderr, "Position after putting the char back=%ld\n",
                ftell(fp));
    } while (0);
    val = 0;
  }
  val = 0;
  do {
    if (0)
      fprintf(stderr, "My copied count is %d and length is %d\n", copied_count,
              length);
  } while (0);
  for (int i = 0; i + copied_count < length; i++) {
    int src_index = i + copied_count;
    if (i % 8 == 0 && i != 0) {
      status = fputc(val, fp);
      if ((status == val) != true) {
        fprintf(stderr, "info: %s:%d:\t",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/UTILS/test/test_bitops.c",
                158);
        fprintf(stderr, "Value returned by fputc must match\n");
        assert(status == val);
      };
      val = 0;
    }
    int src_bit = (((src)[(src_index) / 8] & (1 << ((src_index) % 8))) > 0);
    do {
      if (0)
        fprintf(stderr, "Setting src bit %d at bit position %ld\n", src_bit,
                ftell(fp) * 8 + i % 8);
    } while (0);
    if (src_bit != 0) {
      (&val)[(i % 8) / 8] |= (1 << ((i % 8) % 8));
    } else {
      (&val)[(i % 8) / 8] &= ~(1 << ((i % 8) % 8));
    }
  }
  if (copied_count < length) {
    status = fputc(val, fp);
    if ((status == val) != true) {
      fprintf(stderr, "info: %s:%d:\t",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/"
              "UTILS/test/test_bitops.c",
              178);
      fprintf(stderr, "Value returned by fputc must match\n");
      assert(status == val);
    };
    val = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<write_bits_to_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movb   $0x0,-0x19(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
jmp    11a0 <write_bits_to_file+0x30>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    0x2e18(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
je     1222 <write_bits_to_file+0xb2>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
lea    0xe19(%rip),%rsi
lea    0xe20(%rip),%rdx
mov    $0x69,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0x0,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
jmp    1227 <write_bits_to_file+0xb7>
jmp    122c <write_bits_to_file+0xbc>
mov    -0x18(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     14f2 <write_bits_to_file+0x382>
jmp    1245 <write_bits_to_file+0xd5>
jmp    124a <write_bits_to_file+0xda>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x19(%rbp)
jmp    125b <write_bits_to_file+0xeb>
mov    -0x8(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
jne    1320 <write_bits_to_file+0x1b0>
mov    -0x8(%rbp),%rdi
call   1070 <ftell@plt>
cmp    $0x0,%eax
je     1320 <write_bits_to_file+0x1b0>
mov    -0x8(%rbp),%rdi
call   1070 <ftell@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2d52(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1090 <fseek@plt>
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <ftell@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
sub    -0x30(%rbp),%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
je     131b <write_bits_to_file+0x1ab>
mov    0x2d06(%rip),%rax
mov    (%rax),%edi
lea    0xd25(%rip),%rsi
lea    0xd2c(%rip),%rdx
mov    $0x78,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2ce3(%rip),%rax
mov    (%rax),%edi
lea    0xdda(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x2c(%rbp),%eax
sub    -0x30(%rbp),%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
jmp    1320 <write_bits_to_file+0x1b0>
jmp    1325 <write_bits_to_file+0x1b5>
jmp    132a <write_bits_to_file+0x1ba>
mov    -0x18(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
add    -0x20(%rbp),%ecx
xor    %eax,%eax
cmp    $0x8,%ecx
mov    %al,-0x45(%rbp)
jge    135f <write_bits_to_file+0x1ef>
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
setl   %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    136f <write_bits_to_file+0x1ff>
jmp    145e <write_bits_to_file+0x2ee>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x4c(%rbp),%eax
mov    %edx,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x38(%rbp)
jmp    13c9 <write_bits_to_file+0x259>
cmpl   $0x0,-0x38(%rbp)
je     1410 <write_bits_to_file+0x2a0>
mov    -0x20(%rbp),%eax
add    -0x34(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x20(%rbp),%eax
add    -0x34(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x5c(%rbp),%edx
cltq
movzbl -0x19(%rbp,%rax,1),%ecx
or     %edx,%ecx
mov    %cl,-0x19(%rbp,%rax,1)
jmp    144b <write_bits_to_file+0x2db>
mov    -0x20(%rbp),%eax
add    -0x34(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x60(%rbp)
mov    -0x20(%rbp),%eax
add    -0x34(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x60(%rbp),%edx
cltq
movzbl -0x19(%rbp,%rax,1),%ecx
and    %edx,%ecx
mov    %cl,-0x19(%rbp,%rax,1)
jmp    1450 <write_bits_to_file+0x2e0>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    133f <write_bits_to_file+0x1cf>
jmp    1463 <write_bits_to_file+0x2f3>
jmp    1468 <write_bits_to_file+0x2f8>
mov    -0x19(%rbp),%al
mov    -0x8(%rbp),%rsi
movzbl %al,%edi
call   1040 <fputc@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
movzbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
je     14e4 <write_bits_to_file+0x374>
mov    0x2b3d(%rip),%rax
mov    (%rax),%edi
lea    0xb5c(%rip),%rsi
lea    0xb63(%rip),%rdx
mov    $0x90,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2b1a(%rip),%rax
mov    (%rax),%edi
lea    0xc43(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%eax
movzbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
jmp    14e9 <write_bits_to_file+0x379>
jmp    14ee <write_bits_to_file+0x37e>
movb   $0x0,-0x19(%rbp)
movb   $0x0,-0x19(%rbp)
jmp    14fb <write_bits_to_file+0x38b>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    16ba <write_bits_to_file+0x54a>
mov    -0x3c(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    15b8 <write_bits_to_file+0x448>
cmpl   $0x0,-0x3c(%rbp)
je     15b8 <write_bits_to_file+0x448>
mov    -0x19(%rbp),%al
mov    -0x8(%rbp),%rsi
movzbl %al,%edi
call   1040 <fputc@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
movzbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
je     15b4 <write_bits_to_file+0x444>
mov    0x2a6d(%rip),%rax
mov    (%rax),%edi
lea    0xa8c(%rip),%rsi
lea    0xa93(%rip),%rdx
mov    $0x9e,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2a4a(%rip),%rax
mov    (%rax),%edi
lea    0xb73(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%eax
movzbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movb   $0x0,-0x19(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x40(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x70(%rbp),%rax
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x64(%rbp)
mov    -0x40(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x64(%rbp),%eax
mov    %edx,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x44(%rbp)
jmp    1609 <write_bits_to_file+0x499>
cmpl   $0x0,-0x44(%rbp)
je     165e <write_bits_to_file+0x4ee>
mov    -0x3c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x74(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x74(%rbp),%edx
cltq
movzbl -0x19(%rbp,%rax,1),%ecx
or     %edx,%ecx
mov    %cl,-0x19(%rbp,%rax,1)
jmp    16a7 <write_bits_to_file+0x537>
mov    -0x3c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x78(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x78(%rbp),%edx
cltq
movzbl -0x19(%rbp,%rax,1),%ecx
and    %edx,%ecx
mov    %cl,-0x19(%rbp,%rax,1)
jmp    16ac <write_bits_to_file+0x53c>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1502 <write_bits_to_file+0x392>
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1746 <write_bits_to_file+0x5d6>
mov    -0x19(%rbp),%al
mov    -0x8(%rbp),%rsi
movzbl %al,%edi
call   1040 <fputc@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
movzbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
je     1742 <write_bits_to_file+0x5d2>
mov    0x28df(%rip),%rax
mov    (%rax),%edi
lea    0x8fe(%rip),%rsi
lea    0x905(%rip),%rdx
mov    $0xb2,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x28bc(%rip),%rax
mov    (%rax),%edi
lea    0x9e5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%eax
movzbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movb   $0x0,-0x19(%rbp)
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_bits_to_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%ebp
mov    %edx,%r15d
mov    %rsi,(%rsp)
lea    0x7(%rbp),%esi
test   %ecx,%ecx
cmovns %ecx,%esi
mov    %esi,%eax
and    $0xfffffff8,%eax
sub    %eax,%ebp
sar    $0x3,%esi
mov    0x2e30(%rip),%rax
mov    (%rax),%edx
mov    %rdi,0x8(%rsp)
call   1090 <fseek@plt>
test   %eax,%eax
je     11ea <write_bits_to_file+0x7a>
mov    0x2e21(%rip),%rbx
mov    (%rbx),%edi
lea    0xe40(%rip),%rsi
lea    0xe47(%rip),%rdx
mov    $0x69,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0xec7(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1050 <assert@plt>
test   %ebp,%ebp
je     12b6 <write_bits_to_file+0x146>
mov    0x8(%rsp),%r14
mov    %r14,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     1401 <write_bits_to_file+0x291>
xor    %r14d,%r14d
test   %r15d,%r15d
jle    1267 <write_bits_to_file+0xf7>
mov    (%rsp),%rdi
nopl   (%rax)
mov    %r14d,%eax
lea    0x1(%rax),%r14d
mov    %eax,%ecx
shr    $0x3,%rcx
movzbl (%rdi,%rcx,1),%edx
and    $0x7,%al
movzbl %al,%eax
mov    %ebp,%ecx
and    $0x7,%cl
mov    $0x1,%esi
shl    %cl,%esi
mov    %ebx,%ecx
or     %sil,%cl
not    %sil
and    %bl,%sil
bt     %eax,%edx
movzbl %cl,%eax
movzbl %sil,%ebx
cmovb  %eax,%ebx
cmp    %r15d,%r14d
jge    1267 <write_bits_to_file+0xf7>
add    $0x1,%ebp
cmp    $0x8,%ebp
jl     1220 <write_bits_to_file+0xb0>
movzbl %bl,%ebx
mov    %ebx,%edi
mov    0x8(%rsp),%rsi
call   1040 <fputc@plt>
cmp    %ebx,%eax
je     12b9 <write_bits_to_file+0x149>
mov    0x2d57(%rip),%rbx
mov    (%rbx),%edi
lea    0xd76(%rip),%rsi
lea    0xd7d(%rip),%rdx
mov    $0x90,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe64(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1050 <assert@plt>
jmp    12b9 <write_bits_to_file+0x149>
xor    %r14d,%r14d
mov    (%rsp),%rsi
mov    %r14d,%edi
sub    %r15d,%edi
jge    13f0 <write_bits_to_file+0x280>
mov    %r15d,0x14(%rsp)
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    1368 <write_bits_to_file+0x1f8>
nopl   0x0(%rax,%rax,1)
mov    0x2cf1(%rip),%rax
mov    (%rax),%edi
xor    %ebp,%ebp
lea    0xd0e(%rip),%rsi
lea    0xd15(%rip),%rdx
mov    $0x9e,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
lea    0xdf5(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1050 <assert@plt>
mov    (%rsp),%rsi
mov    %ebx,%edi
mov    %r12d,%eax
shr    $0x3,%rax
movzbl (%rsi,%rax,1),%eax
mov    $0x1,%edx
mov    %r13d,%ecx
shl    %cl,%edx
and    $0x7,%r12b
movzbl %r12b,%ecx
mov    %edx,%ebx
not    %bl
and    %bpl,%bl
or     %dl,%bpl
bt     %ecx,%eax
movzbl %bpl,%eax
movzbl %bl,%ebp
cmovb  %eax,%ebp
add    $0x1,%r15d
mov    %edi,%eax
add    %r15d,%eax
je     139b <write_bits_to_file+0x22b>
lea    (%r14,%r15,1),%r12d
mov    %r15d,%r13d
and    $0x7,%r13d
test   %r15d,%r15d
je     1329 <write_bits_to_file+0x1b9>
test   %r13d,%r13d
jne    1329 <write_bits_to_file+0x1b9>
mov    %edi,%ebx
movzbl %bpl,%ebp
mov    %ebp,%edi
mov    0x8(%rsp),%rsi
call   1040 <fputc@plt>
cmp    %ebp,%eax
jne    12e0 <write_bits_to_file+0x170>
xor    %ebp,%ebp
jmp    1323 <write_bits_to_file+0x1b3>
cmp    0x14(%rsp),%r14d
jge    13f0 <write_bits_to_file+0x280>
movzbl %bpl,%ebp
mov    %ebp,%edi
mov    0x8(%rsp),%rsi
call   1040 <fputc@plt>
cmp    %ebp,%eax
je     13f0 <write_bits_to_file+0x280>
mov    0x2c1b(%rip),%rbx
mov    (%rbx),%edi
lea    0xc3a(%rip),%rsi
lea    0xc41(%rip),%rdx
mov    $0xb2,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0xd28(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsp),%rdi
call   1070 <ftell@plt>
test   %eax,%eax
je     1211 <write_bits_to_file+0xa1>
mov    0x8(%rsp),%r14
mov    %r14,%rdi
call   1070 <ftell@plt>
mov    %eax,%r13d
mov    0x2bbe(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0xffffffff,%esi
call   1090 <fseek@plt>
mov    %r14,%rdi
call   1070 <ftell@plt>
sub    %eax,%r13d
cmp    $0x1,%r13d
je     1211 <write_bits_to_file+0xa1>
mov    0x2b83(%rip),%r14
mov    (%r14),%edi
lea    0xba1(%rip),%rsi
lea    0xba8(%rip),%rdx
mov    $0x78,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
lea    0xc5c(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1050 <assert@plt>
jmp    1211 <write_bits_to_file+0xa1>

LLVM IR (-O0):
@SEEK_SET = global i32 0
@stderr = global i32 0
@.str = [14 x i8] c"info: %s:%d:\09\00"
@.str.1 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/UTILS/test/test_bitops.c\00"
@.str.2 = [53 x i8] c"Failed to seek file pointer to position to write to\0A\00"
@SEEK_CUR = global i32 0
@.str.3 = [50 x i8] c"Failed to seek pointer back to original position\0A\00"
@.str.4 = [36 x i8] c"Value returned by fputc must match\0A\00"
define i32 @write_bits_to_file(i32* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i32
%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
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i8 0, i8* %9
store i32 0, i32* %10
store i32 0, i32* %11
br label %20
20: ; preds = %4
br label %21
21: ; preds = %20
%22 = load i32*, i32** %5
%23 = load i32, i32* %8
%24 = sdiv i32 %23, 8
%25 = load i32, i32* @SEEK_SET
%26 = call i32 @fseek(i32* %22, i32 %24, i32 %25)
store i32 %26, i32* %12
%27 = load i32, i32* %12
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = icmp ne i32 %29, 1
br i1 %30, label %31, label %40
31: ; preds = %21
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 105)
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%36 = load i32, i32* %12
%37 = icmp eq i32 %36, 0
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
br label %40
40: ; preds = %31, %21
br label %41
41: ; preds = %40
br label %42
42: ; preds = %41
%43 = load i32, i32* %8
%44 = srem i32 %43, 8
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %185
46: ; preds = %42
br label %47
47: ; preds = %46
br label %48
48: ; preds = %47
%49 = load i32*, i32** %5
%50 = call zeroext i8 @fgetc(i32* %49)
store i8 %50, i8* %9
br label %51
51: ; preds = %48
br label %52
52: ; preds = %51
%53 = load i32*, i32** %5
%54 = call i32 @feof(i32* %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %86, label %56
56: ; preds = %52
%57 = load i32*, i32** %5
%58 = call i32 @ftell(i32* %57)
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %86
60: ; preds = %56
%61 = load i32*, i32** %5
%62 = call i32 @ftell(i32* %61)
store i32 %62, i32* %13
%63 = load i32*, i32** %5
%64 = load i32, i32* @SEEK_CUR
%65 = call i32 @fseek(i32* %63, i32 -1, i32 %64)
store i32 %65, i32* %12
%66 = load i32*, i32** %5
%67 = call i32 @ftell(i32* %66)
store i32 %67, i32* %14
%68 = load i32, i32* %13
%69 = load i32, i32* %14
%70 = sub nsw i32 %68, %69
%71 = icmp eq i32 %70, 1
%72 = zext i1 %71 to i32
%73 = icmp ne i32 %72, 1
br i1 %73, label %74, label %85
74: ; preds = %60
%75 = load i32, i32* @stderr
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 120)
%77 = load i32, i32* @stderr
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%79 = load i32, i32* %13
%80 = load i32, i32* %14
%81 = sub nsw i32 %79, %80
%82 = icmp eq i32 %81, 1
%83 = zext i1 %82 to i32
%84 = call i32 @assert(i32 %83)
br label %85
85: ; preds = %74, %60
br label %86
86: ; preds = %85, %56, %52
br label %87
87: ; preds = %86
br label %88
88: ; preds = %87
%89 = load i32, i32* %8
%90 = srem i32 %89, 8
store i32 %90, i32* %10
store i32 0, i32* %15
br label %91
91: ; preds = %156, %88
%92 = load i32, i32* %15
%93 = load i32, i32* %10
%94 = add nsw i32 %92, %93
%95 = icmp slt i32 %94, 8
br i1 %95, label %96, label %100
96: ; preds = %91
%97 = load i32, i32* %15
%98 = load i32, i32* %7
%99 = icmp slt i32 %97, %98
br label %100
100: ; preds = %96, %91
%101 = phi i1 [ false, %91 ], [ %99, %96 ]
br i1 %101, label %102, label %159
102: ; preds = %100
%103 = load i32, i32* %11
%104 = add nsw i32 %103, 1
store i32 %104, i32* %11
%105 = load i8*, i8** %6
%106 = load i32, i32* %15
%107 = sdiv i32 %106, 8
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8, i8* %105, i64 %108
%110 = load i8, i8* %109
%111 = zext i8 %110 to i32
%112 = load i32, i32* %15
%113 = srem i32 %112, 8
%114 = shl i32 1, %113
%115 = and i32 %111, %114
%116 = icmp sgt i32 %115, 0
%117 = zext i1 %116 to i32
store i32 %117, i32* %16
br label %118
118: ; preds = %102
br label %119
119: ; preds = %118
%120 = load i32, i32* %16
%121 = icmp ne i32 %120, 0
br i1 %121, label %122, label %138
122: ; preds = %119
%123 = load i32, i32* %10
%124 = load i32, i32* %15
%125 = add nsw i32 %123, %124
%126 = srem i32 %125, 8
%127 = shl i32 1, %126
%128 = load i32, i32* %10
%129 = load i32, i32* %15
%130 = add nsw i32 %128, %129
%131 = sdiv i32 %130, 8
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i8, i8* %9, i64 %132
%134 = load i8, i8* %133
%135 = zext i8 %134 to i32
%136 = or i32 %135, %127
%137 = trunc i32 %136 to i8
store i8 %137, i8* %133
br label %155
138: ; preds = %119
%139 = load i32, i32* %10
%140 = load i32, i32* %15
%141 = add nsw i32 %139, %140
%142 = srem i32 %141, 8
%143 = shl i32 1, %142
%144 = xor i32 %143, -1
%145 = load i32, i32* %10
%146 = load i32, i32* %15
%147 = add nsw i32 %145, %146
%148 = sdiv i32 %147, 8
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8, i8* %9, i64 %149
%151 = load i8, i8* %150
%152 = zext i8 %151 to i32
%153 = and i32 %152, %144
%154 = trunc i32 %153 to i8
store i8 %154, i8* %150
br label %155
155: ; preds = %138, %122
br label %156
156: ; preds = %155
%157 = load i32, i32* %15
%158 = add nsw i32 %157, 1
store i32 %158, i32* %15
br label %91
159: ; preds = %100
br label %160
160: ; preds = %159
br label %161
161: ; preds = %160
%162 = load i8, i8* %9
%163 = load i32*, i32** %5
%164 = call i32 @fputc(i8 zeroext %162, i32* %163)
store i32 %164, i32* %12
%165 = load i32, i32* %12
%166 = load i8, i8* %9
%167 = zext i8 %166 to i32
%168 = icmp eq i32 %165, %167
%169 = zext i1 %168 to i32
%170 = icmp ne i32 %169, 1
br i1 %170, label %171, label %182
171: ; preds = %161
%172 = load i32, i32* @stderr
%173 = call i32 (i32, i8*, ...) @fprintf(i32 %172, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 144)
%174 = load i32, i32* @stderr
%175 = call i32 (i32, i8*, ...) @fprintf(i32 %174, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%176 = load i32, i32* %12
%177 = load i8, i8* %9
%178 = zext i8 %177 to i32
%179 = icmp eq i32 %176, %178
%180 = zext i1 %179 to i32
%181 = call i32 @assert(i32 %180)
br label %182
182: ; preds = %171, %161
br label %183
183: ; preds = %182
br label %184
184: ; preds = %183
store i8 0, i8* %9
br label %185
185: ; preds = %184, %42
store i8 0, i8* %9
br label %186
186: ; preds = %185
br label %187
187: ; preds = %186
store i32 0, i32* %17
br label %188
188: ; preds = %274, %187
%189 = load i32, i32* %17
%190 = load i32, i32* %11
%191 = add nsw i32 %189, %190
%192 = load i32, i32* %7
%193 = icmp slt i32 %191, %192
br i1 %193, label %194, label %277
194: ; preds = %188
%195 = load i32, i32* %17
%196 = load i32, i32* %11
%197 = add nsw i32 %195, %196
store i32 %197, i32* %18
%198 = load i32, i32* %17
%199 = srem i32 %198, 8
%200 = icmp eq i32 %199, 0
br i1 %200, label %201, label %226
201: ; preds = %194
%202 = load i32, i32* %17
%203 = icmp ne i32 %202, 0
br i1 %203, label %204, label %226
204: ; preds = %201
%205 = load i8, i8* %9
%206 = load i32*, i32** %5
%207 = call i32 @fputc(i8 zeroext %205, i32* %206)
store i32 %207, i32* %12
%208 = load i32, i32* %12
%209 = load i8, i8* %9
%210 = zext i8 %209 to i32
%211 = icmp eq i32 %208, %210
%212 = zext i1 %211 to i32
%213 = icmp ne i32 %212, 1
br i1 %213, label %214, label %225
214: ; preds = %204
%215 = load i32, i32* @stderr
%216 = call i32 (i32, i8*, ...) @fprintf(i32 %215, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 158)
%217 = load i32, i32* @stderr
%218 = call i32 (i32, i8*, ...) @fprintf(i32 %217, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%219 = load i32, i32* %12
%220 = load i8, i8* %9
%221 = zext i8 %220 to i32
%222 = icmp eq i32 %219, %221
%223 = zext i1 %222 to i32
%224 = call i32 @assert(i32 %223)
br label %225
225: ; preds = %214, %204
store i8 0, i8* %9
br label %226
226: ; preds = %225, %201, %194
%227 = load i8*, i8** %6
%228 = load i32, i32* %18
%229 = sdiv i32 %228, 8
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds i8, i8* %227, i64 %230
%232 = load i8, i8* %231
%233 = zext i8 %232 to i32
%234 = load i32, i32* %18
%235 = srem i32 %234, 8
%236 = shl i32 1, %235
%237 = and i32 %233, %236
%238 = icmp sgt i32 %237, 0
%239 = zext i1 %238 to i32
store i32 %239, i32* %19
br label %240
240: ; preds = %226
br label %241
241: ; preds = %240
%242 = load i32, i32* %19
%243 = icmp ne i32 %242, 0
br i1 %243, label %244, label %258
244: ; preds = %241
%245 = load i32, i32* %17
%246 = srem i32 %245, 8
%247 = srem i32 %246, 8
%248 = shl i32 1, %247
%249 = load i32, i32* %17
%250 = srem i32 %249, 8
%251 = sdiv i32 %250, 8
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds i8, i8* %9, i64 %252
%254 = load i8, i8* %253
%255 = zext i8 %254 to i32
%256 = or i32 %255, %248
%257 = trunc i32 %256 to i8
store i8 %257, i8* %253
br label %273
258: ; preds = %241
%259 = load i32, i32* %17
%260 = srem i32 %259, 8
%261 = srem i32 %260, 8
%262 = shl i32 1, %261
%263 = xor i32 %262, -1
%264 = load i32, i32* %17
%265 = srem i32 %264, 8
%266 = sdiv i32 %265, 8
%267 = sext i32 %266 to i64
%268 = getelementptr inbounds i8, i8* %9, i64 %267
%269 = load i8, i8* %268
%270 = zext i8 %269 to i32
%271 = and i32 %270, %263
%272 = trunc i32 %271 to i8
store i8 %272, i8* %268
br label %273
273: ; preds = %258, %244
br label %274
274: ; preds = %273
%275 = load i32, i32* %17
%276 = add nsw i32 %275, 1
store i32 %276, i32* %17
br label %188
277: ; preds = %188
%278 = load i32, i32* %11
%279 = load i32, i32* %7
%280 = icmp slt i32 %278, %279
br i1 %280, label %281, label %303
281: ; preds = %277
%282 = load i8, i8* %9
%283 = load i32*, i32** %5
%284 = call i32 @fputc(i8 zeroext %282, i32* %283)
store i32 %284, i32* %12
%285 = load i32, i32* %12
%286 = load i8, i8* %9
%287 = zext i8 %286 to i32
%288 = icmp eq i32 %285, %287
%289 = zext i1 %288 to i32
%290 = icmp ne i32 %289, 1
br i1 %290, label %291, label %302
291: ; preds = %281
%292 = load i32, i32* @stderr
%293 = call i32 (i32, i8*, ...) @fprintf(i32 %292, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 178)
%294 = load i32, i32* @stderr
%295 = call i32 (i32, i8*, ...) @fprintf(i32 %294, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%296 = load i32, i32* %12
%297 = load i8, i8* %9
%298 = zext i8 %297 to i32
%299 = icmp eq i32 %296, %298
%300 = zext i1 %299 to i32
%301 = call i32 @assert(i32 %300)
br label %302
302: ; preds = %291, %281
store i8 0, i8* %9
br label %303
303: ; preds = %302, %277
ret i32 0
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@stderr = global i32 0
@.str = [14 x i8] c"info: %s:%d:\09\00"
@.str.1 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/UTILS/test/test_bitops.c\00"
@.str.2 = [53 x i8] c"Failed to seek file pointer to position to write to\0A\00"
@SEEK_CUR = global i32 0
@.str.3 = [50 x i8] c"Failed to seek pointer back to original position\0A\00"
@.str.4 = [36 x i8] c"Value returned by fputc must match\0A\00"
define i32 @write_bits_to_file(i32* nocapture %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = sdiv i32 %3, 8
%6 = srem i32 %3, 8
%7 = load i32, i32* @SEEK_SET
%8 = tail call i32 @fseek(i32* %0, i32 %5, i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %4
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 105)
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @assert(i32 0)
br label %16
16: ; preds = %4, %10
%17 = icmp eq i32 %6, 0
br i1 %17, label %77, label %18
18: ; preds = %16
%19 = tail call zeroext i8 @fgetc(i32* %0)
%20 = tail call i32 @feof(i32* %0)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = tail call i32 @ftell(i32* %0)
%24 = icmp eq i32 %23, 0
br i1 %24, label %38, label %25
25: ; preds = %22
%26 = tail call i32 @ftell(i32* %0)
%27 = load i32, i32* @SEEK_CUR
%28 = tail call i32 @fseek(i32* %0, i32 -1, i32 %27)
%29 = tail call i32 @ftell(i32* %0)
%30 = sub nsw i32 %26, %29
%31 = icmp eq i32 %30, 1
br i1 %31, label %38, label %32
32: ; preds = %25
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 120)
%35 = load i32, i32* @stderr
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%37 = tail call i32 @assert(i32 0)
br label %38
38: ; preds = %25, %32, %18, %22
%39 = icmp sgt i32 %2, 0
br i1 %39, label %46, label %40
40: ; preds = %46, %38
%41 = phi i8 [ %19, %38 ], [ %66, %46 ]
%42 = phi i32 [ 0, %38 ], [ %50, %46 ]
%43 = tail call i32 @fputc(i8 zeroext %41, i32* %0)
%44 = zext i8 %41 to i32
%45 = icmp eq i32 %43, %44
br i1 %45, label %77, label %71
46: ; preds = %38, %46
%47 = phi i32 [ %67, %46 ], [ %6, %38 ]
%48 = phi i32 [ %50, %46 ], [ 0, %38 ]
%49 = phi i8 [ %66, %46 ], [ %19, %38 ]
%50 = add nuw nsw i32 %48, 1
%51 = lshr i32 %48, 3
%52 = zext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %1, i64 %52
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
%56 = and i32 %48, 7
%57 = shl nuw nsw i32 1, %56
%58 = and i32 %57, %55
%59 = icmp eq i32 %58, 0
%60 = and i32 %47, 7
%61 = shl nuw nsw i32 1, %60
%62 = trunc i32 %61 to i8
%63 = or i8 %49, %62
%64 = xor i8 %62, -1
%65 = and i8 %49, %64
%66 = select i1 %59, i8 %65, i8 %63
%67 = add nsw i32 %50, %6
%68 = icmp slt i32 %67, 8
%69 = icmp slt i32 %50, %2
%70 = and i1 %69, %68
br i1 %70, label %46, label %40
71: ; preds = %40
%72 = load i32, i32* @stderr
%73 = tail call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 144)
%74 = load i32, i32* @stderr
%75 = tail call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%76 = tail call i32 @assert(i32 0)
br label %77
77: ; preds = %71, %40, %16
%78 = phi i32 [ 0, %16 ], [ %42, %40 ], [ %42, %71 ]
%79 = icmp slt i32 %78, %2
br i1 %79, label %80, label %131
80: ; preds = %77
%81 = sub i32 %2, %78
br label %83
82: ; preds = %101
br i1 %79, label %121, label %131
83: ; preds = %80, %101
%84 = phi i32 [ %119, %101 ], [ %78, %80 ]
%85 = phi i32 [ %118, %101 ], [ 0, %80 ]
%86 = phi i8 [ %117, %101 ], [ 0, %80 ]
%87 = and i32 %85, 7
%88 = icmp eq i32 %87, 0
%89 = icmp ne i32 %85, 0
%90 = and i1 %89, %88
br i1 %90, label %91, label %101
91: ; preds = %83
%92 = tail call i32 @fputc(i8 zeroext %86, i32* %0)
%93 = zext i8 %86 to i32
%94 = icmp eq i32 %92, %93
br i1 %94, label %101, label %95
95: ; preds = %91
%96 = load i32, i32* @stderr
%97 = tail call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 158)
%98 = load i32, i32* @stderr
%99 = tail call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%100 = tail call i32 @assert(i32 0)
br label %101
101: ; preds = %91, %95, %83
%102 = phi i8 [ %86, %83 ], [ 0, %95 ], [ 0, %91 ]
%103 = lshr i32 %84, 3
%104 = zext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %1, i64 %104
%106 = load i8, i8* %105
%107 = zext i8 %106 to i32
%108 = and i32 %84, 7
%109 = shl nuw nsw i32 1, %108
%110 = and i32 %109, %107
%111 = icmp eq i32 %110, 0
%112 = shl nuw nsw i32 1, %87
%113 = trunc i32 %112 to i8
%114 = xor i8 %113, -1
%115 = and i8 %102, %114
%116 = or i8 %102, %113
%117 = select i1 %111, i8 %115, i8 %116
%118 = add nuw nsw i32 %85, 1
%119 = add nuw nsw i32 %118, %78
%120 = icmp eq i32 %118, %81
br i1 %120, label %82, label %83
121: ; preds = %82
%122 = tail call i32 @fputc(i8 zeroext %117, i32* %0)
%123 = zext i8 %117 to i32
%124 = icmp eq i32 %122, %123
br i1 %124, label %131, label %125
125: ; preds = %121
%126 = load i32, i32* @stderr
%127 = tail call i32 (i32, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 178)
%128 = load i32, i32* @stderr
%129 = tail call i32 (i32, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%130 = tail call i32 @assert(i32 0)
br label %131
131: ; preds = %77, %121, %125, %82
ret i32 0
}