#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*/ assert(int);
int /*<<< orphan*/ decode_base64(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ is_comment(char *);
scalar_t__ is_empty(char *);
int /*<<< orphan*/ replace_quote(char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
scalar_t__ split_keyval(char *, char **, char **);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strncat_delimit(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
scalar_t__ trim_nl(char *);
int main(int argc, char *argv[]) {
  FILE *in_ptr = NULL;
  FILE *out_ptr = NULL;
  char line[1024];
  char *key = NULL;
  char *val = NULL;
  char keys[128][128];
  unsigned long key_count = 0;
  unsigned long cur_key;
  char vals[128][2048];
  int new_record;
  unsigned long record_count;
  if (argc != 3) {
    fprintf(stderr, "Usage: %s <input_file> <output_file>\n", argv[0]);
    return 1;
  }
  in_ptr = fopen(argv[1], "r");
  if (in_ptr == NULL) {
    fprintf(stderr, "Error opening file for reading\n");
    return 1;
  }
  out_ptr = fopen(argv[2], "w");
  if (out_ptr == NULL) {
    fprintf(stderr, "Error opening file for writing\n");
    return 1;
  }
  fprintf(stdout, "Detecting keys...\n");
  while (fgets(line, 1024, in_ptr) != NULL) {
    if ((trim_nl(line) != 0) && !feof(in_ptr))
      fprintf(stderr, "Line Truncated: %s, Increase MAX_LINE_LEN\n", line);
    if (!is_empty(line) && !is_comment(line) &&
        (split_keyval(line, &key, &val) == 0)) {
      for (cur_key = 0; cur_key < key_count; cur_key++) {
        if (strncmp(key, keys[cur_key], 128) == 0)
          break;
      }
      if (cur_key == key_count) {
        if (key_count < 128) {
          strncpy(keys[key_count], key, 128);
          if (keys[key_count][128 - 1] != '\0') {
            fprintf(stderr,
                    "Key Truncated: %s (ignored), Increase MAX_KEY_LEN\n", key);
            keys[key_count][128 - 1] = '\0';
          } else {
            fprintf(stdout, "Key Detected: %s\n", keys[key_count]);
            key_count++;
          }
        } else {
          fprintf(stderr, "Key Ignored: %s, Increase MAX_KEY\n", key);
        }
      }
    }
  }
  fprintf(stdout, "Key Count: %lu\n\n", key_count);
  rewind(in_ptr);
  fprintf(stdout, "Serializing CSV...\n");
  for (cur_key = 0; cur_key < key_count; cur_key++) {
    if (cur_key != 0)
      fputs(",", out_ptr);
    replace_quote(keys[cur_key]);
    fprintf(out_ptr, "\"%s\"", keys[cur_key]);
    *(vals[cur_key]) = '\0';
  }
  fputs("\n", out_ptr);
  new_record = 0;
  record_count = 0;
  while (fgets(line, 1024, in_ptr) != NULL) {
    if (is_empty(line) && new_record) {
      for (cur_key = 0; cur_key < key_count; cur_key++) {
        if (cur_key != 0)
          fputs(",", out_ptr);
        replace_quote(vals[cur_key]);
        fprintf(out_ptr, "\"%s\"", vals[cur_key]);
        *(vals[cur_key]) = '\0';
      }
      fputs("\n", out_ptr);
      new_record = 0;
      record_count++;
    } else if (!is_comment(line)) {
      if ((trim_nl(line) != 0) && !feof(in_ptr))
        fprintf(stderr, "Line Truncated: %s, Increase MAX_LINE_LEN\n", line);
      if (split_keyval(line, &key, &val) == 0) {
        for (cur_key = 0; cur_key < key_count; cur_key++) {
          if (strncmp(key, keys[cur_key], 128) == 0) {
            assert(cur_key < 128);
            if ((*val == ':') && (*(val + 1) == ' '))
              decode_base64(val);
            if (*(vals[cur_key]) == '\0') {
              strncpy(vals[cur_key], val, 2048);
              if (vals[cur_key][2048 - 1] != '\0') {
                fprintf(stderr, "Value Truncated: %s, Increase MAX_VAL_LEN\n",
                        val);
                vals[cur_key][2048 - 1] = '\0';
              }
            } else
              strncat_delimit(vals[cur_key], val);
            new_record = 1;
            break;
          }
        }
      }
    }
  }
  if (new_record) {
    for (cur_key = 0; cur_key < key_count; cur_key++) {
      if (cur_key != 0)
        fputs(",", out_ptr);
      replace_quote(vals[cur_key]);
      fprintf(out_ptr, "\"%s\"", vals[cur_key]);
      *(vals[cur_key]) = '\0';
    }
    fputs("\n", out_ptr);
    new_record = 0;
    record_count++;
  }
  fprintf(stdout, "Record Count: %lu\n\n", record_count);
  fclose(out_ptr);
  fclose(in_ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x44450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x428(%rbp)
movq   $0x0,-0x430(%rbp)
movq   $0x0,-0x4438(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     128e <main+0x7e>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd85(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1ae5 <main+0x8d5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd89(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12d4 <main+0xc4>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
lea    0xd67(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1ae5 <main+0x8d5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd65(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    131a <main+0x10a>
mov    0x2ce2(%rip),%rax
mov    (%rax),%edi
lea    0xd43(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1ae5 <main+0x8d5>
mov    0x2cb7(%rip),%rax
mov    (%rax),%edi
lea    0xd40(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
je     156e <main+0x35e>
lea    -0x420(%rbp),%rdi
call   1110 <trim_nl@plt>
cmp    $0x0,%rax
je     1396 <main+0x186>
mov    -0x18(%rbp),%rdi
call   10e0 <feof@plt>
cmp    $0x0,%eax
jne    1396 <main+0x186>
mov    0x2c61(%rip),%rax
mov    (%rax),%edi
lea    -0x420(%rbp),%rdx
lea    0xcee(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
lea    -0x420(%rbp),%rdi
call   10a0 <is_empty@plt>
cmp    $0x0,%rax
jne    1569 <main+0x359>
lea    -0x420(%rbp),%rdi
call   10f0 <is_comment@plt>
cmp    $0x0,%eax
jne    1569 <main+0x359>
lea    -0x420(%rbp),%rdi
lea    -0x428(%rbp),%rsi
lea    -0x430(%rbp),%rdx
call   1080 <split_keyval@plt>
cmp    $0x0,%rax
jne    1569 <main+0x359>
movq   $0x0,-0x4440(%rbp)
mov    -0x4440(%rbp),%rax
cmp    -0x4438(%rbp),%rax
jae    1455 <main+0x245>
mov    -0x428(%rbp),%rdi
mov    -0x4440(%rbp),%rax
lea    -0x4430(%rbp),%rsi
shl    $0x7,%rax
add    %rax,%rsi
mov    $0x80,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
jne    1439 <main+0x229>
jmp    1455 <main+0x245>
jmp    143e <main+0x22e>
mov    -0x4440(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4440(%rbp)
jmp    13f0 <main+0x1e0>
mov    -0x4440(%rbp),%rax
cmp    -0x4438(%rbp),%rax
jne    1564 <main+0x354>
cmpq   $0x80,-0x4438(%rbp)
jae    1541 <main+0x331>
mov    -0x4438(%rbp),%rax
lea    -0x4430(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
mov    -0x428(%rbp),%rsi
mov    $0x80,%edx
call   1040 <strncpy@plt>
mov    -0x4438(%rbp),%rcx
lea    -0x4430(%rbp),%rax
shl    $0x7,%rcx
add    %rcx,%rax
movsbl 0x7f(%rax),%eax
cmp    $0x0,%eax
je     14fe <main+0x2ee>
mov    0x2b17(%rip),%rax
mov    (%rax),%edi
mov    -0x428(%rbp),%rdx
lea    0xbcf(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x4438(%rbp),%rcx
lea    -0x4430(%rbp),%rax
shl    $0x7,%rcx
add    %rcx,%rax
movb   $0x0,0x7f(%rax)
jmp    153c <main+0x32c>
mov    0x2ad3(%rip),%rax
mov    (%rax),%edi
mov    -0x4438(%rbp),%rax
lea    -0x4430(%rbp),%rdx
shl    $0x7,%rax
add    %rax,%rdx
lea    0xbb8(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x4438(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4438(%rbp)
jmp    155f <main+0x34f>
mov    0x2a98(%rip),%rax
mov    (%rax),%edi
mov    -0x428(%rbp),%rdx
lea    0xb95(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1564 <main+0x354>
jmp    1569 <main+0x359>
jmp    1331 <main+0x121>
mov    0x2a63(%rip),%rax
mov    (%rax),%edi
mov    -0x4438(%rbp),%rdx
lea    0xb8b(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1070 <rewind@plt>
mov    0x2a3c(%rip),%rax
mov    (%rax),%edi
lea    0xb7c(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movq   $0x0,-0x4440(%rbp)
mov    -0x4440(%rbp),%rax
cmp    -0x4438(%rbp),%rax
jae    165b <main+0x44b>
cmpq   $0x0,-0x4440(%rbp)
je     15e9 <main+0x3d9>
mov    -0x20(%rbp),%rsi
lea    0xb51(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x4440(%rbp),%rax
lea    -0x4430(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
call   1100 <replace_quote@plt>
mov    -0x20(%rbp),%rax
mov    %eax,%edi
mov    -0x4440(%rbp),%rax
lea    -0x4430(%rbp),%rdx
shl    $0x7,%rax
add    %rax,%rdx
lea    0xb12(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x4440(%rbp),%rcx
lea    -0x44440(%rbp),%rax
shl    $0xb,%rcx
add    %rcx,%rax
movb   $0x0,(%rax)
mov    -0x4440(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4440(%rbp)
jmp    15b7 <main+0x3a7>
mov    -0x20(%rbp),%rsi
lea    0xb13(%rip),%rdi
call   1090 <fputs@plt>
movl   $0x0,-0x44444(%rbp)
movq   $0x0,-0x44450(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
je     19c6 <main+0x7b6>
lea    -0x420(%rbp),%rdi
call   10a0 <is_empty@plt>
cmp    $0x0,%rax
je     17a2 <main+0x592>
cmpl   $0x0,-0x44444(%rbp)
je     17a2 <main+0x592>
movq   $0x0,-0x4440(%rbp)
mov    -0x4440(%rbp),%rax
cmp    -0x4438(%rbp),%rax
jae    1771 <main+0x561>
cmpq   $0x0,-0x4440(%rbp)
je     16ff <main+0x4ef>
mov    -0x20(%rbp),%rsi
lea    0xa3b(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x4440(%rbp),%rax
lea    -0x44440(%rbp),%rdi
shl    $0xb,%rax
add    %rax,%rdi
call   1100 <replace_quote@plt>
mov    -0x20(%rbp),%rax
mov    %eax,%edi
mov    -0x4440(%rbp),%rax
lea    -0x44440(%rbp),%rdx
shl    $0xb,%rax
add    %rax,%rdx
lea    0x9fc(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x4440(%rbp),%rcx
lea    -0x44440(%rbp),%rax
shl    $0xb,%rcx
add    %rcx,%rax
movb   $0x0,(%rax)
mov    -0x4440(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4440(%rbp)
jmp    16cd <main+0x4bd>
mov    -0x20(%rbp),%rsi
lea    0x9fd(%rip),%rdi
call   1090 <fputs@plt>
movl   $0x0,-0x44444(%rbp)
mov    -0x44450(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x44450(%rbp)
jmp    19c1 <main+0x7b1>
lea    -0x420(%rbp),%rdi
call   10f0 <is_comment@plt>
cmp    $0x0,%eax
jne    19bc <main+0x7ac>
lea    -0x420(%rbp),%rdi
call   1110 <trim_nl@plt>
cmp    $0x0,%rax
je     17fd <main+0x5ed>
mov    -0x18(%rbp),%rdi
call   10e0 <feof@plt>
cmp    $0x0,%eax
jne    17fd <main+0x5ed>
mov    0x27fa(%rip),%rax
mov    (%rax),%edi
lea    -0x420(%rbp),%rdx
lea    0x887(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
lea    -0x420(%rbp),%rdi
lea    -0x428(%rbp),%rsi
lea    -0x430(%rbp),%rdx
call   1080 <split_keyval@plt>
cmp    $0x0,%rax
jne    19b7 <main+0x7a7>
movq   $0x0,-0x4440(%rbp)
mov    -0x4440(%rbp),%rax
cmp    -0x4438(%rbp),%rax
jae    19b2 <main+0x7a2>
mov    -0x428(%rbp),%rdi
mov    -0x4440(%rbp),%rax
lea    -0x4430(%rbp),%rsi
shl    $0x7,%rax
add    %rax,%rsi
mov    $0x80,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
jne    1996 <main+0x786>
cmpq   $0x80,-0x4440(%rbp)
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   10c0 <assert@plt>
mov    -0x430(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    18bb <main+0x6ab>
mov    -0x430(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x20,%eax
jne    18bb <main+0x6ab>
mov    -0x430(%rbp),%rdi
call   1120 <decode_base64@plt>
mov    -0x4440(%rbp),%rcx
lea    -0x44440(%rbp),%rax
shl    $0xb,%rcx
add    %rcx,%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1966 <main+0x756>
mov    -0x4440(%rbp),%rax
lea    -0x44440(%rbp),%rdi
shl    $0xb,%rax
add    %rax,%rdi
mov    -0x430(%rbp),%rsi
mov    $0x800,%edx
call   1040 <strncpy@plt>
mov    -0x4440(%rbp),%rcx
lea    -0x44440(%rbp),%rax
shl    $0xb,%rcx
add    %rcx,%rax
movsbl 0x7ff(%rax),%eax
cmp    $0x0,%eax
je     1961 <main+0x751>
mov    0x26b2(%rip),%rax
mov    (%rax),%edi
mov    -0x430(%rbp),%rdx
lea    0x7fe(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x4440(%rbp),%rcx
lea    -0x44440(%rbp),%rax
shl    $0xb,%rcx
add    %rcx,%rax
movb   $0x0,0x7ff(%rax)
jmp    1987 <main+0x777>
mov    -0x4440(%rbp),%rax
lea    -0x44440(%rbp),%rdi
shl    $0xb,%rax
add    %rax,%rdi
mov    -0x430(%rbp),%rsi
call   1030 <strncat_delimit@plt>
movl   $0x1,-0x44444(%rbp)
jmp    19b2 <main+0x7a2>
jmp    199b <main+0x78b>
mov    -0x4440(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4440(%rbp)
jmp    182c <main+0x61c>
jmp    19b7 <main+0x7a7>
jmp    19bc <main+0x7ac>
jmp    19c1 <main+0x7b1>
jmp    1680 <main+0x470>
cmpl   $0x0,-0x44444(%rbp)
je     1aae <main+0x89e>
movq   $0x0,-0x4440(%rbp)
mov    -0x4440(%rbp),%rax
cmp    -0x4438(%rbp),%rax
jae    1a82 <main+0x872>
cmpq   $0x0,-0x4440(%rbp)
je     1a10 <main+0x800>
mov    -0x20(%rbp),%rsi
lea    0x72a(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x4440(%rbp),%rax
lea    -0x44440(%rbp),%rdi
shl    $0xb,%rax
add    %rax,%rdi
call   1100 <replace_quote@plt>
mov    -0x20(%rbp),%rax
mov    %eax,%edi
mov    -0x4440(%rbp),%rax
lea    -0x44440(%rbp),%rdx
shl    $0xb,%rax
add    %rax,%rdx
lea    0x6eb(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x4440(%rbp),%rcx
lea    -0x44440(%rbp),%rax
shl    $0xb,%rcx
add    %rcx,%rax
movb   $0x0,(%rax)
mov    -0x4440(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x4440(%rbp)
jmp    19de <main+0x7ce>
mov    -0x20(%rbp),%rsi
lea    0x6ec(%rip),%rdi
call   1090 <fputs@plt>
movl   $0x0,-0x44444(%rbp)
mov    -0x44450(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x44450(%rbp)
mov    0x2523(%rip),%rax
mov    (%rax),%edi
mov    -0x44450(%rbp),%rdx
lea    0x6a2(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x44450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x44438,%rsp
mov    %rsi,%rbx
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
cmp    $0x3,%edi
jne    1471 <main+0x261>
mov    0x8(%rbx),%rdi
lea    0xddc(%rip),%rsi
call   1130 <fopen@plt>
test   %rax,%rax
je     1495 <main+0x285>
mov    %rax,%rbp
mov    0x10(%rbx),%rdi
lea    0xde2(%rip),%rsi
call   1130 <fopen@plt>
test   %rax,%rax
je     14a7 <main+0x297>
mov    %rax,%r15
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
lea    0xde3(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
lea    0x30(%rsp),%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
mov    %rbp,0x8(%rsp)
je     14c8 <main+0x2b8>
lea    0x30(%rsp),%r14
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%r13
mov    0x2d1c(%rip),%rbx
xor    %eax,%eax
mov    %rax,(%rsp)
jmp    12f6 <main+0xe6>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1090 <is_empty@plt>
test   %rax,%rax
je     1330 <main+0x120>
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     14ce <main+0x2be>
mov    %r14,%rdi
call   1110 <trim_nl@plt>
test   %rax,%rax
je     12d0 <main+0xc0>
mov    %rbp,%rdi
call   10e0 <feof@plt>
test   %eax,%eax
jne    12d0 <main+0xc0>
mov    (%rbx),%edi
lea    0xd65(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    12d0 <main+0xc0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   10f0 <is_comment@plt>
test   %eax,%eax
jne    12dd <main+0xcd>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1080 <split_keyval@plt>
test   %rax,%rax
jne    12dd <main+0xcd>
cmpq   $0x0,(%rsp)
je     1387 <main+0x177>
lea    0x430(%rsp),%rbp
xor    %ebx,%ebx
mov    0x18(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x80,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     1389 <main+0x179>
add    $0x1,%rbx
sub    $0xffffffffffffff80,%rbp
cmp    %rbx,(%rsp)
jne    1360 <main+0x150>
jmp    138f <main+0x17f>
xor    %ebx,%ebx
cmp    (%rsp),%rbx
jne    13f7 <main+0x1e7>
mov    %r12,%r13
mov    (%rsp),%r12
cmp    $0x7f,%r12
ja     1408 <main+0x1f8>
mov    %r12,%rbx
shl    $0x7,%rbx
lea    (%rsp,%rbx,1),%rbp
add    $0x430,%rbp
mov    0x18(%rsp),%rsi
mov    %rbp,%rdi
mov    $0x80,%edx
call   1040 <strncpy@plt>
cmpb   $0x0,0x4af(%rsp,%rbx,1)
je     1436 <main+0x226>
lea    (%rsp,%rbx,1),%rbp
add    $0x4af,%rbp
mov    0x2c04(%rip),%rbx
mov    (%rbx),%edi
mov    0x18(%rsp),%rdx
lea    0xcbe(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
movb   $0x0,0x0(%rbp)
jmp    1424 <main+0x214>
mov    0x8(%rsp),%rbp
mov    0x2bdd(%rip),%rbx
jmp    12dd <main+0xcd>
mov    0x2bd1(%rip),%rbx
mov    (%rbx),%edi
mov    0x18(%rsp),%rdx
lea    0xcd0(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0x8(%rsp),%rbp
mov    %r13,%r12
lea    0x10(%rsp),%r13
jmp    12dd <main+0xcd>
mov    0x2b9b(%rip),%rax
mov    (%rax),%edi
lea    0xc95(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
add    $0x1,%r12
mov    %r12,(%rsp)
mov    0x8(%rsp),%rbp
mov    %r13,%r12
lea    0x10(%rsp),%r13
mov    0x2b74(%rip),%rbx
jmp    12dd <main+0xcd>
mov    0x2b68(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xb7c(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%ebp
jmp    1901 <main+0x6f1>
mov    0x2b44(%rip),%rax
mov    (%rax),%edi
lea    0xb83(%rip),%rsi
jmp    14b7 <main+0x2a7>
mov    0x2b32(%rip),%rax
mov    (%rax),%edi
lea    0xb93(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%ebp
jmp    1901 <main+0x6f1>
xor    %eax,%eax
mov    %rax,(%rsp)
mov    0x2b03(%rip),%r14
mov    (%r14),%edi
lea    0xc31(%rip),%rsi
mov    (%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %rbp,%rdi
call   1070 <rewind@plt>
mov    (%r14),%edi
lea    0xc22(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
test   %rbx,%rbx
je     15a9 <main+0x399>
lea    0x430(%rsp),%rbp
mov    %rbp,%rdi
call   1100 <replace_quote@plt>
lea    0xc0f(%rip),%rsi
mov    %r15d,%edi
mov    %rbp,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
movb   $0x0,0x4430(%rsp)
cmpq   $0x1,(%rsp)
je     15a9 <main+0x399>
mov    (%rsp),%rax
lea    -0x1(%rax),%r12
lea    0x4b0(%rsp),%rbp
lea    0x4c30(%rsp),%rbx
lea    0xbd4(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2c,%edi
mov    %r15,%rsi
call   10a0 <fputc@plt>
mov    %rbp,%rdi
call   1100 <replace_quote@plt>
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
movb   $0x0,(%rbx)
sub    $0xffffffffffffff80,%rbp
add    $0x800,%rbx
add    $0xffffffffffffffff,%r12
jne    1570 <main+0x360>
mov    $0xa,%edi
mov    %r15,%rsi
call   10a0 <fputc@plt>
lea    0x30(%rsp),%rdi
mov    $0x400,%esi
mov    0x8(%rsp),%rbx
mov    %rbx,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     18cd <main+0x6bd>
mov    (%rsp),%r14
lea    -0x1(%r14),%rax
mov    %rax,0x28(%rsp)
lea    0x30(%rsp),%rbp
lea    0xb46(%rip),%r12
xor    %eax,%eax
mov    %rax,0x20(%rsp)
xor    %r13d,%r13d
jmp    1629 <main+0x419>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   10f0 <is_comment@plt>
test   %eax,%eax
je     16db <main+0x4cb>
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     1827 <main+0x617>
mov    %rbp,%rdi
call   1090 <is_empty@plt>
test   %rax,%rax
je     1600 <main+0x3f0>
test   %r13d,%r13d
je     1600 <main+0x3f0>
test   %r14,%r14
je     16b6 <main+0x4a6>
lea    0x4430(%rsp),%rbx
mov    %rbx,%rdi
call   1100 <replace_quote@plt>
mov    %r15d,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
movb   $0x0,0x4430(%rsp)
cmp    $0x1,%r14
je     16b6 <main+0x4a6>
lea    0x4c30(%rsp),%rbp
mov    0x28(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    $0x2c,%edi
mov    %r15,%rsi
call   10a0 <fputc@plt>
mov    %rbp,%rdi
call   1100 <replace_quote@plt>
mov    %r15d,%edi
mov    %r12,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
movb   $0x0,0x0(%rbp)
add    $0x800,%rbp
add    $0xffffffffffffffff,%rbx
jne    1680 <main+0x470>
mov    $0xa,%edi
mov    %r15,%rsi
call   10a0 <fputc@plt>
addq   $0x1,0x20(%rsp)
xor    %r13d,%r13d
mov    0x8(%rsp),%rbx
lea    0x30(%rsp),%rbp
jmp    1610 <main+0x400>
mov    %rbp,%rdi
call   1110 <trim_nl@plt>
test   %rax,%rax
je     170e <main+0x4fe>
mov    %rbx,%rdi
call   10e0 <feof@plt>
test   %eax,%eax
jne    170e <main+0x4fe>
mov    0x28e5(%rip),%rax
mov    (%rax),%edi
lea    0x979(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %rbp,%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1080 <split_keyval@plt>
test   %rax,%rax
jne    1610 <main+0x400>
test   %r14,%r14
je     1610 <main+0x400>
lea    0x430(%rsp),%rbp
lea    0x4430(%rsp),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x80,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     178a <main+0x57a>
add    $0x1,%rbx
add    $0x800,%r14
sub    $0xffffffffffffff80,%rbp
cmp    %rbx,(%rsp)
jne    1750 <main+0x540>
mov    0x8(%rsp),%rbx
mov    (%rsp),%r14
jmp    16d1 <main+0x4c1>
xor    %edi,%edi
cmp    $0x80,%rbx
setb   %dil
call   10c0 <assert@plt>
mov    0x10(%rsp),%rdi
cmpb   $0x3a,(%rdi)
jne    17b1 <main+0x5a1>
cmpb   $0x20,0x1(%rdi)
jne    17b1 <main+0x5a1>
call   1120 <decode_base64@plt>
cmpb   $0x0,(%r14)
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rbx
lea    0x30(%rsp),%rbp
je     17dd <main+0x5cd>
mov    %r14,%rdi
call   1030 <strncat_delimit@plt>
mov    $0x1,%r13d
mov    (%rsp),%r14
jmp    1610 <main+0x400>
mov    %r14,%rdi
mov    $0x800,%edx
call   1040 <strncpy@plt>
mov    $0x1,%r13d
cmpb   $0x0,0x7ff(%r14)
je     181e <main+0x60e>
mov    0x27df(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rdx
lea    0x92b(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
movb   $0x0,0x7ff(%r14)
mov    (%rsp),%r14
jmp    1610 <main+0x400>
test   %r13d,%r13d
je     18d1 <main+0x6c1>
test   %r14,%r14
lea    0x4c30(%rsp),%rbx
je     18b5 <main+0x6a5>
lea    0x4430(%rsp),%rbp
mov    %rbp,%rdi
call   1100 <replace_quote@plt>
lea    0x8e1(%rip),%rsi
mov    %r15d,%edi
mov    %rbp,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
movb   $0x0,0x4430(%rsp)
cmp    $0x1,%r14
je     18b5 <main+0x6a5>
add    $0xffffffffffffffff,%r14
lea    0x8bb(%rip),%rbp
nopw   0x0(%rax,%rax,1)
mov    $0x2c,%edi
mov    %r15,%rsi
call   10a0 <fputc@plt>
mov    %rbx,%rdi
call   1100 <replace_quote@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
movb   $0x0,(%rbx)
add    $0x800,%rbx
add    $0xffffffffffffffff,%r14
jne    1880 <main+0x670>
mov    $0xa,%edi
mov    %r15,%rsi
call   10a0 <fputc@plt>
mov    0x20(%rsp),%rdx
add    $0x1,%rdx
jmp    18d6 <main+0x6c6>
xor    %edx,%edx
jmp    18d6 <main+0x6c6>
mov    0x20(%rsp),%rdx
mov    0x26fb(%rip),%rax
mov    (%rax),%edi
lea    0x87f(%rip),%rsi
xor    %ebp,%ebp
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r15,%rdi
call   1060 <fclose@plt>
mov    0x8(%rsp),%rdi
call   1060 <fclose@plt>
mov    %ebp,%eax
add    $0x44438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"Usage: %s <input_file> <output_file>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [32 x i8] c"Error opening file for reading\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [32 x i8] c"Error opening file for writing\0A\00"
@stdout = global i32 0
@.str.5 = [19 x i8] c"Detecting keys...\0A\00"
@.str.6 = [43 x i8] c"Line Truncated: %s, Increase MAX_LINE_LEN\0A\00"
@.str.7 = [51 x i8] c"Key Truncated: %s (ignored), Increase MAX_KEY_LEN\0A\00"
@.str.8 = [18 x i8] c"Key Detected: %s\0A\00"
@.str.9 = [35 x i8] c"Key Ignored: %s, Increase MAX_KEY\0A\00"
@.str.10 = [17 x i8] c"Key Count: %lu\0A\0A\00"
@.str.11 = [20 x i8] c"Serializing CSV...\0A\00"
@.str.12 = [2 x i8] c",\00"
@.str.13 = [5 x i8] c"\22%s\22\00"
@.str.14 = [2 x i8] c"\0A\00"
@.str.15 = [43 x i8] c"Value Truncated: %s, Increase MAX_VAL_LEN\0A\00"
@.str.16 = [20 x i8] c"Record Count: %lu\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [1024 x i8]
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [128 x [128 x i8]]
%12 = alloca i64
%13 = alloca i64
%14 = alloca [128 x [2048 x i8]]
%15 = alloca i32
%16 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i32* null, i32** %7
store i8* null, i8** %9
store i8* null, i8** %10
store i64 0, i64* %12
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 3
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %23)
store i32 1, i32* %3
br label %355
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %29, i32** %6
%30 = load i32*, i32** %6
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %35
32: ; preds = %25
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %355
35: ; preds = %25
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %39, i32** %7
%40 = load i32*, i32** %7
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %45
42: ; preds = %35
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %355
45: ; preds = %35
%46 = load i32, i32* @stdout
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %48
48: ; preds = %135, %45
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%50 = load i32*, i32** %6
%51 = call i32* @fgets(i8* %49, i32 1024, i32* %50)
%52 = icmp ne i32* %51, null
br i1 %52, label %53, label %136
53: ; preds = %48
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%55 = call i64 @trim_nl(i8* %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %65
57: ; preds = %53
%58 = load i32*, i32** %6
%59 = call i32 @feof(i32* %58)
%60 = icmp ne i32 %59, 0
br i1 %60, label %65, label %61
61: ; preds = %57
%62 = load i32, i32* @stderr
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %63)
br label %65
65: ; preds = %61, %57, %53
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%67 = call i64 @is_empty(i8* %66)
%68 = icmp ne i64 %67, 0
br i1 %68, label %135, label %69
69: ; preds = %65
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%71 = call i32 @is_comment(i8* %70)
%72 = icmp ne i32 %71, 0
br i1 %72, label %135, label %73
73: ; preds = %69
%74 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%75 = call i64 @split_keyval(i8* %74, i8** %9, i8** %10)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %135
77: ; preds = %73
store i64 0, i64* %13
br label %78
78: ; preds = %91, %77
%79 = load i64, i64* %13
%80 = load i64, i64* %12
%81 = icmp ult i64 %79, %80
br i1 %81, label %82, label %94
82: ; preds = %78
%83 = load i8*, i8** %9
%84 = load i64, i64* %13
%85 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %84
%86 = getelementptr inbounds [128 x i8], [128 x i8]* %85, i64 0, i64 0
%87 = call i64 @strncmp(i8* %83, i8* %86, i32 128)
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %82
br label %94
90: ; preds = %82
br label %91
91: ; preds = %90
%92 = load i64, i64* %13
%93 = add i64 %92, 1
store i64 %93, i64* %13
br label %78
94: ; preds = %89, %78
%95 = load i64, i64* %13
%96 = load i64, i64* %12
%97 = icmp eq i64 %95, %96
br i1 %97, label %98, label %134
98: ; preds = %94
%99 = load i64, i64* %12
%100 = icmp ult i64 %99, 128
br i1 %100, label %101, label %129
101: ; preds = %98
%102 = load i64, i64* %12
%103 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %102
%104 = getelementptr inbounds [128 x i8], [128 x i8]* %103, i64 0, i64 0
%105 = load i8*, i8** %9
%106 = call i32 @strncpy(i8* %104, i8* %105, i32 128)
%107 = load i64, i64* %12
%108 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %107
%109 = getelementptr inbounds [128 x i8], [128 x i8]* %108, i64 0, i64 127
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = icmp ne i32 %111, 0
br i1 %112, label %113, label %120
113: ; preds = %101
%114 = load i32, i32* @stderr
%115 = load i8*, i8** %9
%116 = call i32 (i32, i8*, ...) @fprintf(i32 %114, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0), i8* %115)
%117 = load i64, i64* %12
%118 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %117
%119 = getelementptr inbounds [128 x i8], [128 x i8]* %118, i64 0, i64 127
store i8 0, i8* %119
br label %128
120: ; preds = %101
%121 = load i32, i32* @stdout
%122 = load i64, i64* %12
%123 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %122
%124 = getelementptr inbounds [128 x i8], [128 x i8]* %123, i64 0, i64 0
%125 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i8* %124)
%126 = load i64, i64* %12
%127 = add i64 %126, 1
store i64 %127, i64* %12
br label %128
128: ; preds = %120, %113
br label %133
129: ; preds = %98
%130 = load i32, i32* @stderr
%131 = load i8*, i8** %9
%132 = call i32 (i32, i8*, ...) @fprintf(i32 %130, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0), i8* %131)
br label %133
133: ; preds = %129, %128
br label %134
134: ; preds = %133, %94
br label %135
135: ; preds = %134, %73, %69, %65
br label %48
136: ; preds = %48
%137 = load i32, i32* @stdout
%138 = load i64, i64* %12
%139 = call i32 (i32, i8*, ...) @fprintf(i32 %137, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i64 %138)
%140 = load i32*, i32** %6
%141 = call i32 @rewind(i32* %140)
%142 = load i32, i32* @stdout
%143 = call i32 (i32, i8*, ...) @fprintf(i32 %142, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
store i64 0, i64* %13
br label %144
144: ; preds = %168, %136
%145 = load i64, i64* %13
%146 = load i64, i64* %12
%147 = icmp ult i64 %145, %146
br i1 %147, label %148, label %171
148: ; preds = %144
%149 = load i64, i64* %13
%150 = icmp ne i64 %149, 0
br i1 %150, label %151, label %154
151: ; preds = %148
%152 = load i32*, i32** %7
%153 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32* %152)
br label %154
154: ; preds = %151, %148
%155 = load i64, i64* %13
%156 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %155
%157 = getelementptr inbounds [128 x i8], [128 x i8]* %156, i64 0, i64 0
%158 = call i32 @replace_quote(i8* %157)
%159 = load i32*, i32** %7
%160 = ptrtoint i32* %159 to i32
%161 = load i64, i64* %13
%162 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %161
%163 = getelementptr inbounds [128 x i8], [128 x i8]* %162, i64 0, i64 0
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %160, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %163)
%165 = load i64, i64* %13
%166 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %165
%167 = getelementptr inbounds [2048 x i8], [2048 x i8]* %166, i64 0, i64 0
store i8 0, i8* %167
br label %168
168: ; preds = %154
%169 = load i64, i64* %13
%170 = add i64 %169, 1
store i64 %170, i64* %13
br label %144
171: ; preds = %144
%172 = load i32*, i32** %7
%173 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i32* %172)
store i32 0, i32* %15
store i64 0, i64* %16
br label %174
174: ; preds = %310, %171
%175 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%176 = load i32*, i32** %6
%177 = call i32* @fgets(i8* %175, i32 1024, i32* %176)
%178 = icmp ne i32* %177, null
br i1 %178, label %179, label %311
179: ; preds = %174
%180 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%181 = call i64 @is_empty(i8* %180)
%182 = icmp ne i64 %181, 0
br i1 %182, label %183, label %219
183: ; preds = %179
%184 = load i32, i32* %15
%185 = icmp ne i32 %184, 0
br i1 %185, label %186, label %219
186: ; preds = %183
store i64 0, i64* %13
br label %187
187: ; preds = %211, %186
%188 = load i64, i64* %13
%189 = load i64, i64* %12
%190 = icmp ult i64 %188, %189
br i1 %190, label %191, label %214
191: ; preds = %187
%192 = load i64, i64* %13
%193 = icmp ne i64 %192, 0
br i1 %193, label %194, label %197
194: ; preds = %191
%195 = load i32*, i32** %7
%196 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32* %195)
br label %197
197: ; preds = %194, %191
%198 = load i64, i64* %13
%199 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %198
%200 = getelementptr inbounds [2048 x i8], [2048 x i8]* %199, i64 0, i64 0
%201 = call i32 @replace_quote(i8* %200)
%202 = load i32*, i32** %7
%203 = ptrtoint i32* %202 to i32
%204 = load i64, i64* %13
%205 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %204
%206 = getelementptr inbounds [2048 x i8], [2048 x i8]* %205, i64 0, i64 0
%207 = call i32 (i32, i8*, ...) @fprintf(i32 %203, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %206)
%208 = load i64, i64* %13
%209 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %208
%210 = getelementptr inbounds [2048 x i8], [2048 x i8]* %209, i64 0, i64 0
store i8 0, i8* %210
br label %211
211: ; preds = %197
%212 = load i64, i64* %13
%213 = add i64 %212, 1
store i64 %213, i64* %13
br label %187
214: ; preds = %187
%215 = load i32*, i32** %7
%216 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i32* %215)
store i32 0, i32* %15
%217 = load i64, i64* %16
%218 = add i64 %217, 1
store i64 %218, i64* %16
br label %310
219: ; preds = %183, %179
%220 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%221 = call i32 @is_comment(i8* %220)
%222 = icmp ne i32 %221, 0
br i1 %222, label %309, label %223
223: ; preds = %219
%224 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%225 = call i64 @trim_nl(i8* %224)
%226 = icmp ne i64 %225, 0
br i1 %226, label %227, label %235
227: ; preds = %223
%228 = load i32*, i32** %6
%229 = call i32 @feof(i32* %228)
%230 = icmp ne i32 %229, 0
br i1 %230, label %235, label %231
231: ; preds = %227
%232 = load i32, i32* @stderr
%233 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%234 = call i32 (i32, i8*, ...) @fprintf(i32 %232, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %233)
br label %235
235: ; preds = %231, %227, %223
%236 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%237 = call i64 @split_keyval(i8* %236, i8** %9, i8** %10)
%238 = icmp eq i64 %237, 0
br i1 %238, label %239, label %308
239: ; preds = %235
store i64 0, i64* %13
br label %240
240: ; preds = %304, %239
%241 = load i64, i64* %13
%242 = load i64, i64* %12
%243 = icmp ult i64 %241, %242
br i1 %243, label %244, label %307
244: ; preds = %240
%245 = load i8*, i8** %9
%246 = load i64, i64* %13
%247 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %246
%248 = getelementptr inbounds [128 x i8], [128 x i8]* %247, i64 0, i64 0
%249 = call i64 @strncmp(i8* %245, i8* %248, i32 128)
%250 = icmp eq i64 %249, 0
br i1 %250, label %251, label %303
251: ; preds = %244
%252 = load i64, i64* %13
%253 = icmp ult i64 %252, 128
%254 = zext i1 %253 to i32
%255 = call i32 @assert(i32 %254)
%256 = load i8*, i8** %10
%257 = load i8, i8* %256
%258 = sext i8 %257 to i32
%259 = icmp eq i32 %258, 58
br i1 %259, label %260, label %269
260: ; preds = %251
%261 = load i8*, i8** %10
%262 = getelementptr inbounds i8, i8* %261, i64 1
%263 = load i8, i8* %262
%264 = sext i8 %263 to i32
%265 = icmp eq i32 %264, 32
br i1 %265, label %266, label %269
266: ; preds = %260
%267 = load i8*, i8** %10
%268 = call i32 @decode_base64(i8* %267)
br label %269
269: ; preds = %266, %260, %251
%270 = load i64, i64* %13
%271 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %270
%272 = getelementptr inbounds [2048 x i8], [2048 x i8]* %271, i64 0, i64 0
%273 = load i8, i8* %272
%274 = sext i8 %273 to i32
%275 = icmp eq i32 %274, 0
br i1 %275, label %276, label %296
276: ; preds = %269
%277 = load i64, i64* %13
%278 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %277
%279 = getelementptr inbounds [2048 x i8], [2048 x i8]* %278, i64 0, i64 0
%280 = load i8*, i8** %10
%281 = call i32 @strncpy(i8* %279, i8* %280, i32 2048)
%282 = load i64, i64* %13
%283 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %282
%284 = getelementptr inbounds [2048 x i8], [2048 x i8]* %283, i64 0, i64 2047
%285 = load i8, i8* %284
%286 = sext i8 %285 to i32
%287 = icmp ne i32 %286, 0
br i1 %287, label %288, label %295
288: ; preds = %276
%289 = load i32, i32* @stderr
%290 = load i8*, i8** %10
%291 = call i32 (i32, i8*, ...) @fprintf(i32 %289, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.15, i64 0, i64 0), i8* %290)
%292 = load i64, i64* %13
%293 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %292
%294 = getelementptr inbounds [2048 x i8], [2048 x i8]* %293, i64 0, i64 2047
store i8 0, i8* %294
br label %295
295: ; preds = %288, %276
br label %302
296: ; preds = %269
%297 = load i64, i64* %13
%298 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %297
%299 = getelementptr inbounds [2048 x i8], [2048 x i8]* %298, i64 0, i64 0
%300 = load i8*, i8** %10
%301 = call i32 @strncat_delimit(i8* %299, i8* %300)
br label %302
302: ; preds = %296, %295
store i32 1, i32* %15
br label %307
303: ; preds = %244
br label %304
304: ; preds = %303
%305 = load i64, i64* %13
%306 = add i64 %305, 1
store i64 %306, i64* %13
br label %240
307: ; preds = %302, %240
br label %308
308: ; preds = %307, %235
br label %309
309: ; preds = %308, %219
br label %310
310: ; preds = %309, %214
br label %174
311: ; preds = %174
%312 = load i32, i32* %15
%313 = icmp ne i32 %312, 0
br i1 %313, label %314, label %347
314: ; preds = %311
store i64 0, i64* %13
br label %315
315: ; preds = %339, %314
%316 = load i64, i64* %13
%317 = load i64, i64* %12
%318 = icmp ult i64 %316, %317
br i1 %318, label %319, label %342
319: ; preds = %315
%320 = load i64, i64* %13
%321 = icmp ne i64 %320, 0
br i1 %321, label %322, label %325
322: ; preds = %319
%323 = load i32*, i32** %7
%324 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32* %323)
br label %325
325: ; preds = %322, %319
%326 = load i64, i64* %13
%327 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %326
%328 = getelementptr inbounds [2048 x i8], [2048 x i8]* %327, i64 0, i64 0
%329 = call i32 @replace_quote(i8* %328)
%330 = load i32*, i32** %7
%331 = ptrtoint i32* %330 to i32
%332 = load i64, i64* %13
%333 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %332
%334 = getelementptr inbounds [2048 x i8], [2048 x i8]* %333, i64 0, i64 0
%335 = call i32 (i32, i8*, ...) @fprintf(i32 %331, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %334)
%336 = load i64, i64* %13
%337 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %14, i64 0, i64 %336
%338 = getelementptr inbounds [2048 x i8], [2048 x i8]* %337, i64 0, i64 0
store i8 0, i8* %338
br label %339
339: ; preds = %325
%340 = load i64, i64* %13
%341 = add i64 %340, 1
store i64 %341, i64* %13
br label %315
342: ; preds = %315
%343 = load i32*, i32** %7
%344 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i32* %343)
store i32 0, i32* %15
%345 = load i64, i64* %16
%346 = add i64 %345, 1
store i64 %346, i64* %16
br label %347
347: ; preds = %342, %311
%348 = load i32, i32* @stdout
%349 = load i64, i64* %16
%350 = call i32 (i32, i8*, ...) @fprintf(i32 %348, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0), i64 %349)
%351 = load i32*, i32** %7
%352 = call i32 @fclose(i32* %351)
%353 = load i32*, i32** %6
%354 = call i32 @fclose(i32* %353)
store i32 0, i32* %3
br label %355
355: ; preds = %347, %42, %32, %19
%356 = load i32, i32* %3
ret i32 %356
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"Usage: %s <input_file> <output_file>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [32 x i8] c"Error opening file for reading\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [32 x i8] c"Error opening file for writing\0A\00"
@stdout = global i32 0
@.str.5 = [19 x i8] c"Detecting keys...\0A\00"
@.str.6 = [43 x i8] c"Line Truncated: %s, Increase MAX_LINE_LEN\0A\00"
@.str.7 = [51 x i8] c"Key Truncated: %s (ignored), Increase MAX_KEY_LEN\0A\00"
@.str.8 = [18 x i8] c"Key Detected: %s\0A\00"
@.str.9 = [35 x i8] c"Key Ignored: %s, Increase MAX_KEY\0A\00"
@.str.10 = [17 x i8] c"Key Count: %lu\0A\0A\00"
@.str.11 = [20 x i8] c"Serializing CSV...\0A\00"
@.str.13 = [5 x i8] c"\22%s\22\00"
@.str.15 = [43 x i8] c"Value Truncated: %s, Increase MAX_VAL_LEN\0A\00"
@.str.16 = [20 x i8] c"Record Count: %lu\0A\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [128 x [128 x i8]]
%7 = alloca [128 x [2048 x i8]]
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%10 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%11 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %6, i64 0, i64 0, i64 0
%12 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %7, i64 0, i64 0, i64 0
%13 = icmp eq i32 %0, 3
br i1 %13, label %18, label %14
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %235
18: ; preds = %2
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = tail call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %235
26: ; preds = %18
%27 = getelementptr inbounds i8*, i8** %1, i64 2
%28 = load i8*, i8** %27
%29 = tail call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %34
31: ; preds = %26
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %235
34: ; preds = %26
%35 = load i32, i32* @stdout
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%37 = call i32* @fgets(i8* %8, i32 1024, i32* %21)
%38 = icmp eq i32* %37, null
br i1 %38, label %97, label %39
39: ; preds = %34, %93
%40 = phi i64 [ %94, %93 ], [ 0, %34 ]
%41 = call i64 @trim_nl(i8* %8)
%42 = icmp eq i64 %41, 0
br i1 %42, label %49, label %43
43: ; preds = %39
%44 = call i32 @feof(i32* %21)
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %8)
br label %49
49: ; preds = %46, %43, %39
%50 = call i64 @is_empty(i8* %8)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %93
52: ; preds = %49
%53 = call i32 @is_comment(i8* %8)
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %93
55: ; preds = %52
%56 = call i64 @split_keyval(i8* %8, i8** %4, i8** %5)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %93
58: ; preds = %55
%59 = icmp eq i64 %40, 0
br i1 %59, label %69, label %60
60: ; preds = %58, %66
%61 = phi i64 [ %67, %66 ], [ 0, %58 ]
%62 = load i8*, i8** %4
%63 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %6, i64 0, i64 %61, i64 0
%64 = call i64 @strncmp(i8* %62, i8* %63, i32 128)
%65 = icmp eq i64 %64, 0
br i1 %65, label %69, label %66
66: ; preds = %60
%67 = add nuw i64 %61, 1
%68 = icmp eq i64 %67, %40
br i1 %68, label %72, label %60
69: ; preds = %60, %58
%70 = phi i64 [ 0, %58 ], [ %61, %60 ]
%71 = icmp eq i64 %70, %40
br i1 %71, label %72, label %93
72: ; preds = %66, %69
%73 = icmp ult i64 %40, 128
br i1 %73, label %74, label %89
74: ; preds = %72
%75 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %6, i64 0, i64 %40, i64 0
%76 = load i8*, i8** %4
%77 = call i32 @strncpy(i8* %75, i8* %76, i32 128)
%78 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %6, i64 0, i64 %40, i64 127
%79 = load i8, i8* %78
%80 = icmp eq i8 %79, 0
br i1 %80, label %85, label %81
81: ; preds = %74
%82 = load i32, i32* @stderr
%83 = load i8*, i8** %4
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0), i8* %83)
store i8 0, i8* %78
br label %93
85: ; preds = %74
%86 = load i32, i32* @stdout
%87 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i8* %75)
%88 = add nuw nsw i64 %40, 1
br label %93
89: ; preds = %72
%90 = load i32, i32* @stderr
%91 = load i8*, i8** %4
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0), i8* %91)
br label %93
93: ; preds = %69, %81, %85, %89, %55, %52, %49
%94 = phi i64 [ %40, %49 ], [ %40, %52 ], [ %40, %81 ], [ %88, %85 ], [ %40, %89 ], [ %40, %69 ], [ %40, %55 ]
%95 = call i32* @fgets(i8* %8, i32 1024, i32* %21)
%96 = icmp eq i32* %95, null
br i1 %96, label %97, label %39
97: ; preds = %93, %34
%98 = phi i64 [ 0, %34 ], [ %94, %93 ]
%99 = load i32, i32* @stdout
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i64 %98)
%101 = call i32 @rewind(i32* %21)
%102 = load i32, i32* @stdout
%103 = call i32 (i32, i8*, ...) @fprintf(i32 %102, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
%104 = icmp eq i64 %98, 0
br i1 %104, label %120, label %105
105: ; preds = %97
%106 = ptrtoint i32* %29 to i64
%107 = trunc i64 %106 to i32
%108 = call i32 @replace_quote(i8* %11)
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %11)
store i8 0, i8* %12
%110 = icmp eq i64 %98, 1
br i1 %110, label %120, label %111
111: ; preds = %105, %111
%112 = phi i64 [ %118, %111 ], [ 1, %105 ]
%113 = call i32 @fputc(i32 44, i32* %29)
%114 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %6, i64 0, i64 %112, i64 0
%115 = call i32 @replace_quote(i8* %114)
%116 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %114)
%117 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %7, i64 0, i64 %112, i64 0
store i8 0, i8* %117
%118 = add nuw i64 %112, 1
%119 = icmp eq i64 %118, %98
br i1 %119, label %120, label %111
120: ; preds = %111, %105, %97
%121 = call i32 @fputc(i32 10, i32* %29)
%122 = call i32* @fgets(i8* %8, i32 1024, i32* %21)
%123 = icmp eq i32* %122, null
br i1 %123, label %229, label %124
124: ; preds = %120
%125 = ptrtoint i32* %29 to i64
%126 = trunc i64 %125 to i32
%127 = icmp eq i64 %98, 1
br label %128
128: ; preds = %124, %204
%129 = phi i64 [ 0, %124 ], [ %206, %204 ]
%130 = phi i32 [ 0, %124 ], [ %205, %204 ]
%131 = call i64 @is_empty(i8* %8)
%132 = icmp ne i64 %131, 0
%133 = icmp ne i32 %130, 0
%134 = select i1 %132, i1 %133, i1 false
br i1 %134, label %135, label %150
135: ; preds = %128
br i1 %104, label %147, label %136
136: ; preds = %135
%137 = call i32 @replace_quote(i8* %12)
%138 = call i32 (i32, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %12)
store i8 0, i8* %12
br i1 %127, label %147, label %139
139: ; preds = %136, %139
%140 = phi i64 [ %145, %139 ], [ 1, %136 ]
%141 = call i32 @fputc(i32 44, i32* %29)
%142 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %7, i64 0, i64 %140, i64 0
%143 = call i32 @replace_quote(i8* %142)
%144 = call i32 (i32, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %142)
store i8 0, i8* %142
%145 = add nuw i64 %140, 1
%146 = icmp eq i64 %145, %98
br i1 %146, label %147, label %139
147: ; preds = %139, %136, %135
%148 = call i32 @fputc(i32 10, i32* %29)
%149 = add i64 %129, 1
br label %204
150: ; preds = %128
%151 = call i32 @is_comment(i8* %8)
%152 = icmp eq i32 %151, 0
br i1 %152, label %153, label %204
153: ; preds = %150
%154 = call i64 @trim_nl(i8* %8)
%155 = icmp eq i64 %154, 0
br i1 %155, label %162, label %156
156: ; preds = %153
%157 = call i32 @feof(i32* %21)
%158 = icmp eq i32 %157, 0
br i1 %158, label %159, label %162
159: ; preds = %156
%160 = load i32, i32* @stderr
%161 = call i32 (i32, i8*, ...) @fprintf(i32 %160, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %8)
br label %162
162: ; preds = %159, %156, %153
%163 = call i64 @split_keyval(i8* %8, i8** %4, i8** %5)
%164 = icmp ne i64 %163, 0
%165 = or i1 %164, %104
br i1 %165, label %204, label %166
166: ; preds = %162, %201
%167 = phi i64 [ %202, %201 ], [ 0, %162 ]
%168 = load i8*, i8** %4
%169 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %6, i64 0, i64 %167, i64 0
%170 = call i64 @strncmp(i8* %168, i8* %169, i32 128)
%171 = icmp eq i64 %170, 0
br i1 %171, label %172, label %201
172: ; preds = %166
%173 = icmp ult i64 %167, 128
%174 = zext i1 %173 to i32
%175 = call i32 @assert(i32 %174)
%176 = load i8*, i8** %5
%177 = load i8, i8* %176
%178 = icmp eq i8 %177, 58
br i1 %178, label %179, label %185
179: ; preds = %172
%180 = getelementptr inbounds i8, i8* %176, i64 1
%181 = load i8, i8* %180
%182 = icmp eq i8 %181, 32
br i1 %182, label %183, label %185
183: ; preds = %179
%184 = call i32 @decode_base64(i8* %176)
br label %185
185: ; preds = %183, %179, %172
%186 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %7, i64 0, i64 %167, i64 0
%187 = load i8, i8* %186
%188 = icmp eq i8 %187, 0
%189 = load i8*, i8** %5
br i1 %188, label %190, label %199
190: ; preds = %185
%191 = call i32 @strncpy(i8* %186, i8* %189, i32 2048)
%192 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %7, i64 0, i64 %167, i64 2047
%193 = load i8, i8* %192
%194 = icmp eq i8 %193, 0
br i1 %194, label %204, label %195
195: ; preds = %190
%196 = load i32, i32* @stderr
%197 = load i8*, i8** %5
%198 = call i32 (i32, i8*, ...) @fprintf(i32 %196, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.15, i64 0, i64 0), i8* %197)
store i8 0, i8* %192
br label %204
199: ; preds = %185
%200 = call i32 @strncat_delimit(i8* %186, i8* %189)
br label %204
201: ; preds = %166
%202 = add nuw i64 %167, 1
%203 = icmp eq i64 %202, %98
br i1 %203, label %204, label %166
204: ; preds = %201, %162, %199, %195, %190, %150, %147
%205 = phi i32 [ 0, %147 ], [ %130, %150 ], [ %130, %162 ], [ 1, %190 ], [ 1, %195 ], [ 1, %199 ], [ %130, %201 ]
%206 = phi i64 [ %149, %147 ], [ %129, %150 ], [ %129, %162 ], [ %129, %190 ], [ %129, %195 ], [ %129, %199 ], [ %129, %201 ]
%207 = call i32* @fgets(i8* %8, i32 1024, i32* %21)
%208 = icmp eq i32* %207, null
br i1 %208, label %209, label %128
209: ; preds = %204
%210 = icmp eq i32 %205, 0
br i1 %210, label %229, label %211
211: ; preds = %209
br i1 %104, label %226, label %212
212: ; preds = %211
%213 = ptrtoint i32* %29 to i64
%214 = trunc i64 %213 to i32
%215 = call i32 @replace_quote(i8* %12)
%216 = call i32 (i32, i8*, ...) @fprintf(i32 %214, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %12)
store i8 0, i8* %12
%217 = icmp eq i64 %98, 1
br i1 %217, label %226, label %218
218: ; preds = %212, %218
%219 = phi i64 [ %224, %218 ], [ 1, %212 ]
%220 = call i32 @fputc(i32 44, i32* %29)
%221 = getelementptr inbounds [128 x [2048 x i8]], [128 x [2048 x i8]]* %7, i64 0, i64 %219, i64 0
%222 = call i32 @replace_quote(i8* %221)
%223 = call i32 (i32, i8*, ...) @fprintf(i32 %214, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %221)
store i8 0, i8* %221
%224 = add nuw i64 %219, 1
%225 = icmp eq i64 %224, %98
br i1 %225, label %226, label %218
226: ; preds = %218, %212, %211
%227 = call i32 @fputc(i32 10, i32* %29)
%228 = add i64 %206, 1
br label %229
229: ; preds = %120, %226, %209
%230 = phi i64 [ %228, %226 ], [ %206, %209 ], [ 0, %120 ]
%231 = load i32, i32* @stdout
%232 = call i32 (i32, i8*, ...) @fprintf(i32 %231, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0), i64 %230)
%233 = call i32 @fclose(i32* %29)
%234 = call i32 @fclose(i32* %21)
br label %235
235: ; preds = %229, %31, %23, %14
%236 = phi i32 [ 1, %14 ], [ 1, %23 ], [ 1, %31 ], [ 0, %229 ]
ret i32 %236
}