#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 */

/* Variables and functions */
int /*<<< orphan*/ free_array(char **, int);
int /*<<< orphan*/ printf(char *, ...);
char **split_by_n(char *, int, int *);
scalar_t__ strcmp(char *, char *);
void test_split_by_n() {
  printf("Testing split_string_by_n\n\n");
  int correct, i;
  int len;
  int answer1_len = 2;
  char *answer1[2] = {"ace", "bdf"};
  char **result = split_by_n("abcdef", 2, &len);
  if (result == NULL)
    return;
  printf("split_by_n on \"abcdef\" with n=2 returns numFields=%d:\n", len);
  for (i = 0; i < len; i++)
    printf("   \"%s\"%s", result[i], (i == len - 1 ? "" : ", "));
  correct = (len == answer1_len);
  for (i = 0; i < len; i++)
    correct = correct && (strcmp(answer1[i], result[i]) == 0);
  printf("     (%s)\n\n", correct ? "Correct" : "Failed");
  free_array(result, len);
  int answer2_len = 3;
  char *answer2[3] = {"ad", "be", "cf"};
  result = split_by_n("abcdef", 3, &len);
  printf("split_by_n on \"abcdef\" with n=3 returns numFields=%d:\n", len);
  for (i = 0; i < len; i++)
    printf("   \"%s\"%s", result[i], (i == len - 1 ? "" : ", "));
  correct = (len == answer2_len);
  for (i = 0; i < len; i++)
    correct = correct && (strcmp(answer2[i], result[i]) == 0);
  printf("     (%s)\n\n", correct ? "Correct" : "Failed");
  free_array(result, len);
  int answer3_len = 4;
  char *answer3[4] = {"ae", "bf", "c", "d"};
  result = split_by_n("abcdef", 4, &len);
  printf("split_by_n on \"abcdef\" with n=4 returns numFields=%d:\n", len);
  for (i = 0; i < len; i++)
    printf("   \"%s\"%s", result[i], (i == len - 1 ? "" : ", "));
  correct = (len == answer3_len);
  for (i = 0; i < len; i++)
    correct = correct && (strcmp(answer3[i], result[i]) == 0);
  printf("     (%s)\n\n", correct ? "Correct" : "Failed");
  free_array(result, len);
  int answer4_len = 6;
  char *answer4[6] = {"a", "b", "c", "d", "e", "f"};
  result = split_by_n("abcdef", 8, &len);
  printf("split_by_n on \"abcdef\" with n=8 returns numFields=%d:\n", len);
  for (i = 0; i < len; i++)
    printf("   \"%s\"%s", result[i], (i == len - 1 ? "" : ", "));
  correct = (len == answer4_len);
  for (i = 0; i < len; i++)
    correct = correct && (strcmp(answer4[i], result[i]) == 0);
  printf("     (%s)\n\n", correct ? "Correct" : "Failed");
  free_array(result, len);
  int answer5_len = 0;
  result = split_by_n("", 7, &len);
  printf("split_by_n on \"\" with n=7 returns numFields=%d:\n", len);
  for (i = 0; i < len; i++)
    printf("   \"%s\"%s", result[i], (i == len - 1 ? "" : ", "));
  correct = (len == answer5_len) && result == NULL;
  printf("     (%s)\n\n", correct ? "Correct" : "Failed");
  free_array(result, len);
  int answer6_len = 2;
  char *answer6[2] = {"a", "b"};
  result = split_by_n("ab", 7, &len);
  printf("split_by_n on \"ab\" with n=7 returns numFields=%d:\n", len);
  for (i = 0; i < len; i++)
    printf("   \"%s\"%s", result[i], (i == len - 1 ? "" : ", "));
  correct = (len == answer6_len);
  for (i = 0; i < len; i++)
    correct = correct && (strcmp(answer6[i], result[i]) == 0);
  printf("     (%s)\n\n", correct ? "Correct" : "Failed");
  free_array(result, len);
  int answer7_len = 1;
  char *answer7[1] = {"a"};
  result = split_by_n("a", 3, &len);
  printf("split_by_n on \"a\" with n=3 returns numFields=%d:\n", len);
  for (i = 0; i < len; i++)
    printf("   \"%s\"%s", result[i], (i == len - 1 ? "" : ", "));
  correct = (len == answer7_len);
  for (i = 0; i < len; i++)
    correct = correct && (strcmp(answer7[i], result[i]) == 0);
  printf("     (%s)\n\n", correct ? "Correct" : "Failed");
  free_array(result, len);
  int answer8_len = 1;
  char *answer8[1] = {"a"};
  result = split_by_n("a", 1, &len);
  printf("split_by_n on \"a\" with n=1 returns numFields=%d:\n", len);
  for (i = 0; i < len; i++)
    printf("   \"%s\"%s", result[i], (i == len - 1 ? "" : ", "));
  correct = (len == answer8_len);
  for (i = 0; i < len; i++)
    correct = correct && (strcmp(answer8[i], result[i]) == 0);
  printf("     (%s)\n\n", correct ? "Correct" : "Failed");
  free_array(result, len);
}


x86 assembly (clang, -O0):
<test_split_by_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2,-0x10(%rbp)
mov    0x2c39(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c36(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x2,%esi
lea    -0xc(%rbp),%rdx
call   1030 <split_by_n@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11af <test_split_by_n+0x5f>
jmp    1bfc <test_split_by_n+0xaac>
mov    -0xc(%rbp),%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1218 <test_split_by_n+0xc8>
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
lea    0xe7d(%rip),%rdx
lea    0xe84(%rip),%rax
cmp    %edi,%ecx
cmove  %rax,%rdx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c7 <test_split_by_n+0x77>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1291 <test_split_by_n+0x141>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x101(%rbp)
je     1275 <test_split_by_n+0x125>
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rdi
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x101(%rbp)
mov    -0x101(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1230 <test_split_by_n+0xe0>
mov    -0x4(%rbp),%ecx
lea    0xde8(%rip),%rsi
lea    0xdd9(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <free_array@plt>
movl   $0x3,-0x2c(%rbp)
mov    0x2aef(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2aec(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0x2ae9(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xd32(%rip),%rdi
mov    $0x3,%esi
lea    -0xc(%rbp),%rdx
call   1030 <split_by_n@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    136d <test_split_by_n+0x21d>
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
lea    0xd28(%rip),%rdx
lea    0xd2f(%rip),%rax
cmp    %edi,%ecx
cmove  %rax,%rdx
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    131c <test_split_by_n+0x1cc>
mov    -0xc(%rbp),%eax
cmp    -0x2c(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13e6 <test_split_by_n+0x296>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x102(%rbp)
je     13ca <test_split_by_n+0x27a>
movslq -0x8(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x102(%rbp)
mov    -0x102(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1385 <test_split_by_n+0x235>
mov    -0x4(%rbp),%ecx
lea    0xc93(%rip),%rsi
lea    0xc84(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xc6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <free_array@plt>
movl   $0x4,-0x54(%rbp)
mov    0x29ba(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0x29b7(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0x29b4(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0x29b1(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xbd2(%rip),%rdi
mov    $0x4,%esi
lea    -0xc(%rbp),%rdx
call   1030 <split_by_n@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%esi
lea    0xc64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    14cd <test_split_by_n+0x37d>
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
lea    0xbc8(%rip),%rdx
lea    0xbcf(%rip),%rax
cmp    %edi,%ecx
cmove  %rax,%rdx
lea    0xbaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    147c <test_split_by_n+0x32c>
mov    -0xc(%rbp),%eax
cmp    -0x54(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1546 <test_split_by_n+0x3f6>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x103(%rbp)
je     152a <test_split_by_n+0x3da>
movslq -0x8(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rdi
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x103(%rbp)
mov    -0x103(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    14e5 <test_split_by_n+0x395>
mov    -0x4(%rbp),%ecx
lea    0xb33(%rip),%rsi
lea    0xb24(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xb0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <free_array@plt>
movl   $0x6,-0x84(%rbp)
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1050 <memset@plt>
lea    0xb6d(%rip),%rax
mov    %rax,-0xc0(%rbp)
lea    0xbca(%rip),%rax
mov    %rax,-0xb8(%rbp)
lea    0xb18(%rip),%rax
mov    %rax,-0xb0(%rbp)
lea    0xac5(%rip),%rax
mov    %rax,-0xa8(%rbp)
lea    0xaf7(%rip),%rax
mov    %rax,-0xa0(%rbp)
lea    0xaec(%rip),%rax
mov    %rax,-0x98(%rbp)
lea    0xa34(%rip),%rdi
mov    $0x8,%esi
lea    -0xc(%rbp),%rdx
call   1030 <split_by_n@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%esi
lea    0xaff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    166b <test_split_by_n+0x51b>
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
lea    0xa2a(%rip),%rdx
lea    0xa31(%rip),%rax
cmp    %edi,%ecx
cmove  %rax,%rdx
lea    0xa0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    161a <test_split_by_n+0x4ca>
mov    -0xc(%rbp),%eax
cmp    -0x84(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    16ea <test_split_by_n+0x59a>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x104(%rbp)
je     16ce <test_split_by_n+0x57e>
movslq -0x8(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rdi
ff
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x104(%rbp)
mov    -0x104(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1686 <test_split_by_n+0x536>
mov    -0x4(%rbp),%ecx
lea    0x98f(%rip),%rsi
lea    0x980(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0x966(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <free_array@plt>
movl   $0x0,-0xc4(%rbp)
lea    0x94d(%rip),%rdi
mov    $0x7,%esi
lea    -0xc(%rbp),%rdx
call   1030 <split_by_n@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%esi
lea    0x9f9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    17a8 <test_split_by_n+0x658>
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
lea    0x8ed(%rip),%rdx
lea    0x8f4(%rip),%rax
cmp    %edi,%ecx
cmove  %rax,%rdx
lea    0x8cf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1757 <test_split_by_n+0x607>
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc4(%rbp),%ecx
mov    %al,-0x105(%rbp)
jne    17cd <test_split_by_n+0x67d>
cmpq   $0x0,-0x28(%rbp)
sete   %al
mov    %al,-0x105(%rbp)
mov    -0x105(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
lea    0x89e(%rip),%rsi
lea    0x88f(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0x875(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <free_array@plt>
movl   $0x2,-0xc8(%rbp)
mov    0x25e2(%rip),%rax
mov    %rax,-0xe0(%rbp)
mov    0x25dc(%rip),%rax
mov    %rax,-0xd8(%rbp)
lea    0x939(%rip),%rdi
mov    $0x7,%esi
lea    -0xc(%rbp),%rdx
call   1030 <split_by_n@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%esi
lea    0x920(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    18b5 <test_split_by_n+0x765>
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
lea    0x7e0(%rip),%rdx
lea    0x7e7(%rip),%rax
cmp    %edi,%ecx
cmove  %rax,%rdx
lea    0x7c2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1864 <test_split_by_n+0x714>
mov    -0xc(%rbp),%eax
cmp    -0xc8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1934 <test_split_by_n+0x7e4>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x106(%rbp)
je     1918 <test_split_by_n+0x7c8>
movslq -0x8(%rbp),%rax
mov    -0xe0(%rbp,%rax,8),%rdi
ff
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x106(%rbp)
mov    -0x106(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    18d0 <test_split_by_n+0x780>
mov    -0x4(%rbp),%ecx
lea    0x745(%rip),%rsi
lea    0x736(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0x71c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <free_array@plt>
movl   $0x1,-0xe4(%rbp)
mov    0x2499(%rip),%rax
mov    %rax,-0xf0(%rbp)
lea    0x784(%rip),%rdi
mov    $0x3,%esi
lea    -0xc(%rbp),%rdx
call   1030 <split_by_n@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%esi
lea    0x808(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1a00 <test_split_by_n+0x8b0>
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
lea    0x695(%rip),%rdx
lea    0x69c(%rip),%rax
cmp    %edi,%ecx
cmove  %rax,%rdx
lea    0x677(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    19af <test_split_by_n+0x85f>
mov    -0xc(%rbp),%eax
cmp    -0xe4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1a7f <test_split_by_n+0x92f>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x107(%rbp)
je     1a63 <test_split_by_n+0x913>
movslq -0x8(%rbp),%rax
mov    -0xf0(%rbp,%rax,8),%rdi
ff
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x107(%rbp)
mov    -0x107(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1a1b <test_split_by_n+0x8cb>
mov    -0x4(%rbp),%ecx
lea    0x5fa(%rip),%rsi
lea    0x5eb(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0x5d1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <free_array@plt>
movl   $0x1,-0xf4(%rbp)
mov    0x2356(%rip),%rax
mov    %rax,-0x100(%rbp)
lea    0x639(%rip),%rdi
mov    $0x1,%esi
lea    -0xc(%rbp),%rdx
call   1030 <split_by_n@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%esi
lea    0x6ef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1b4b <test_split_by_n+0x9fb>
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
lea    0x54a(%rip),%rdx
lea    0x551(%rip),%rax
cmp    %edi,%ecx
cmove  %rax,%rdx
lea    0x52c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1afa <test_split_by_n+0x9aa>
mov    -0xc(%rbp),%eax
cmp    -0xf4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1bca <test_split_by_n+0xa7a>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x108(%rbp)
je     1bae <test_split_by_n+0xa5e>
movslq -0x8(%rbp),%rax
mov    -0x100(%rbp,%rax,8),%rdi
ff
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x108(%rbp)
mov    -0x108(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1b66 <test_split_by_n+0xa16>
mov    -0x4(%rbp),%ecx
lea    0x4af(%rip),%rsi
lea    0x4a0(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0x486(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <free_array@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_split_by_n>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0x108c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe97(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    $0x2,%esi
call   1040 <split_by_n@plt>
test   %rax,%rax
je     1958 <test_split_by_n+0x808>
mov    %rax,%r15
mov    0xc(%rsp),%esi
lea    0xe78(%rip),%rdi
xor    %r12d,%r12d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1256 <test_split_by_n+0x106>
lea    0xeaa(%rip),%r12
lea    0xe95(%rip),%rbp
lea    0xe84(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15,%rbx,8),%rsi
add    $0xffffffff,%eax
cmp    %rax,%rbx
mov    %rbp,%rdx
cmove  %r12,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11d0 <test_split_by_n+0x80>
cmp    $0x2,%eax
sete   %r12b
test   %eax,%eax
jle    1256 <test_split_by_n+0x106>
lea    0x1001(%rip),%r14
xor    %ebx,%ebx
mov    %r14,%rbp
jmp    124b <test_split_by_n+0xfb>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq 0x0(%rbp),%rdi
add    %r14,%rdi
mov    (%r15,%rbx,8),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
sete   %r12b
mov    0xc(%rsp),%eax
add    $0x1,%rbx
movslq %eax,%rcx
add    $0x4,%rbp
cmp    %rcx,%rbx
jge    1256 <test_split_by_n+0x106>
test   $0x1,%r12b
jne    1220 <test_split_by_n+0xd0>
xor    %r12d,%r12d
jmp    123b <test_split_by_n+0xeb>
lea    0xe02(%rip),%rax
lea    0xe03(%rip),%rsi
test   %r12b,%r12b
cmovne %rax,%rsi
lea    0xde1(%rip),%rdi
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1060 <free_array@plt>
lea    0xd79(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    $0x3,%esi
call   1040 <split_by_n@plt>
mov    %rax,%r15
mov    0xc(%rsp),%esi
lea    0xdcb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1366 <test_split_by_n+0x216>
lea    0xd98(%rip),%r14
lea    0xd83(%rip),%r12
lea    0xd72(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rbp,8),%rsi
add    $0xffffffff,%eax
cmp    %rax,%rbp
mov    %r12,%rdx
cmove  %r14,%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jl     12e0 <test_split_by_n+0x190>
cmp    $0x3,%eax
sete   %r13b
test   %eax,%eax
jle    1366 <test_split_by_n+0x216>
lea    0xef9(%rip),%r12
xor    %ebx,%ebx
mov    %r12,%rbp
jmp    135b <test_split_by_n+0x20b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq 0x0(%rbp),%rdi
add    %r12,%rdi
mov    (%r15,%rbx,8),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
sete   %r13b
mov    0xc(%rsp),%eax
add    $0x1,%rbx
movslq %eax,%rcx
add    $0x4,%rbp
cmp    %rcx,%rbx
jge    1366 <test_split_by_n+0x216>
test   $0x1,%r13b
jne    1330 <test_split_by_n+0x1e0>
xor    %r13d,%r13d
jmp    134b <test_split_by_n+0x1fb>
test   %r13b,%r13b
lea    0xcf7(%rip),%rsi
lea    0xce8(%rip),%rax
cmovne %rax,%rsi
lea    0xcd1(%rip),%rdi
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1060 <free_array@plt>
lea    0xc69(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    $0x4,%esi
call   1040 <split_by_n@plt>
mov    %rax,%r15
mov    0xc(%rsp),%esi
lea    0xcfa(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1475 <test_split_by_n+0x325>
lea    0xc88(%rip),%r14
lea    0xc73(%rip),%r12
lea    0xc62(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rbp,8),%rsi
add    $0xffffffff,%eax
cmp    %rax,%rbp
mov    %r12,%rdx
cmove  %r14,%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jl     13f0 <test_split_by_n+0x2a0>
cmp    $0x4,%eax
sete   %r13b
test   %eax,%eax
jle    1475 <test_split_by_n+0x325>
lea    0xdf5(%rip),%r12
xor    %ebp,%ebp
mov    %r12,%rbx
jmp    146a <test_split_by_n+0x31a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq (%rbx),%rdi
add    %r12,%rdi
mov    (%r15,%rbp,8),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
sete   %r13b
mov    0xc(%rsp),%eax
add    $0x1,%rbp
movslq %eax,%rcx
add    $0x4,%rbx
cmp    %rcx,%rbp
jge    1475 <test_split_by_n+0x325>
test   $0x1,%r13b
jne    1440 <test_split_by_n+0x2f0>
xor    %r13d,%r13d
jmp    145a <test_split_by_n+0x30a>
test   %r13b,%r13b
lea    0xbe8(%rip),%r13
mov    %r13,%rsi
lea    0xbd6(%rip),%rax
cmovne %rax,%rsi
lea    0xbbf(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
call   1060 <free_array@plt>
lea    0xc3d(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xc9c(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xbec(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xb9b(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xbcf(%rip),%rax
mov    %rax,0x30(%rsp)
lea    0xbc6(%rip),%rax
mov    %rax,0x38(%rsp)
lea    0xb10(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    $0x8,%esi
call   1040 <split_by_n@plt>
mov    %rax,%r14
mov    0xc(%rsp),%esi
lea    0xbda(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    15af <test_split_by_n+0x45f>
lea    0xb2f(%rip),%r12
lea    0xb1a(%rip),%rbp
lea    0xb09(%rip),%r15
xor    %ebx,%ebx
nop
mov    (%r14,%rbx,8),%rsi
add    $0xffffffff,%eax
cmp    %rax,%rbx
mov    %rbp,%rdx
cmove  %r12,%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1540 <test_split_by_n+0x3f0>
cmp    $0x6,%eax
sete   %bpl
test   %eax,%eax
jle    15af <test_split_by_n+0x45f>
xor    %ebx,%ebx
jmp    15a5 <test_split_by_n+0x455>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp,%rbx,8),%rdi
mov    (%r14,%rbx,8),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
sete   %bpl
mov    0xc(%rsp),%eax
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    15af <test_split_by_n+0x45f>
test   $0x1,%bpl
jne    1580 <test_split_by_n+0x430>
xor    %ebp,%ebp
jmp    1599 <test_split_by_n+0x449>
test   %bpl,%bpl
mov    %r13,%rsi
lea    0xaa3(%rip),%rax
cmovne %rax,%rsi
lea    0xa8c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
call   1060 <free_array@plt>
lea    0xa7d(%rip),%r15
lea    0xc(%rsp),%rdx
mov    %r15,%rdi
mov    $0x7,%esi
call   1040 <split_by_n@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%esi
lea    0xb25(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1649 <test_split_by_n+0x4f9>
lea    0xa39(%rip),%r14
lea    0xa28(%rip),%r12
xor    %ebp,%ebp
mov    (%rbx,%rbp,8),%rsi
add    $0xffffffff,%eax
cmp    %rax,%rbp
mov    %r14,%rdx
cmove  %r15,%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jl     1620 <test_split_by_n+0x4d0>
test   %rbx,%rbx
mov    %r13,%rsi
lea    0xa09(%rip),%rcx
cmove  %rcx,%rsi
test   %eax,%eax
cmovne %r13,%rsi
lea    0x9ec(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1060 <free_array@plt>
lea    0xad4(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    $0x7,%esi
call   1040 <split_by_n@plt>
mov    %rax,%r12
mov    0xc(%rsp),%esi
lea    0xaba(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1754 <test_split_by_n+0x604>
lea    0x996(%rip),%r14
lea    0x985(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r12,%rbp,8),%rsi
add    $0xffffffff,%eax
cmp    %rax,%rbp
mov    %r14,%rdx
cmove  %r15,%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jl     16d0 <test_split_by_n+0x580>
cmp    $0x2,%eax
sete   %bpl
test   %eax,%eax
jle    1754 <test_split_by_n+0x604>
lea    0xb25(%rip),%r14
xor    %r13d,%r13d
mov    %r14,%rbx
jmp    174a <test_split_by_n+0x5fa>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq (%rbx),%rdi
add    %r14,%rdi
mov    (%r12,%r13,8),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
sete   %bpl
mov    0xc(%rsp),%eax
add    $0x1,%r13
movslq %eax,%rcx
add    $0x4,%rbx
cmp    %rcx,%r13
jge    1754 <test_split_by_n+0x604>
test   $0x1,%bpl
jne    1720 <test_split_by_n+0x5d0>
xor    %ebp,%ebp
jmp    173a <test_split_by_n+0x5ea>
test   %bpl,%bpl
lea    0x909(%rip),%r13
mov    %r13,%rsi
lea    0x8f7(%rip),%rax
cmovne %rax,%rsi
lea    0x8e0(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r12,%rdi
call   1060 <free_array@plt>
lea    0x95e(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    $0x3,%esi
call   1040 <split_by_n@plt>
mov    %rax,%r14
mov    0xc(%rsp),%esi
lea    0x9e1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    183d <test_split_by_n+0x6ed>
lea    0x88a(%rip),%rbx
lea    0x879(%rip),%r12
xor    %ebp,%ebp
nop
mov    (%r14,%rbp,8),%rsi
add    $0xffffffff,%eax
cmp    %rax,%rbp
mov    %rbx,%rdx
cmove  %r15,%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jl     17d0 <test_split_by_n+0x680>
cmp    $0x1,%eax
sete   %bpl
jl     183d <test_split_by_n+0x6ed>
xor    %ebx,%ebx
lea    0x8e2(%rip),%r12
jmp    1833 <test_split_by_n+0x6e3>
nopl   (%rax)
mov    (%r14,%rbx,8),%rsi
mov    %r12,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
sete   %bpl
mov    0xc(%rsp),%eax
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    183d <test_split_by_n+0x6ed>
test   $0x1,%bpl
jne    1810 <test_split_by_n+0x6c0>
xor    %ebp,%ebp
jmp    1827 <test_split_by_n+0x6d7>
test   %bpl,%bpl
mov    %r13,%rsi
lea    0x815(%rip),%rax
cmovne %rax,%rsi
lea    0x7fe(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
call   1060 <free_array@plt>
lea    0x87c(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    $0x1,%esi
call   1040 <split_by_n@plt>
mov    %rax,%r14
mov    0xc(%rsp),%esi
lea    0x931(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    192d <test_split_by_n+0x7dd>
lea    0x7a8(%rip),%rbx
lea    0x797(%rip),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbp,8),%rsi
add    $0xffffffff,%eax
cmp    %rax,%rbp
mov    %rbx,%rdx
cmove  %r15,%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jl     18c0 <test_split_by_n+0x770>
cmp    $0x1,%eax
sete   %bpl
jl     192d <test_split_by_n+0x7dd>
xor    %ebx,%ebx
lea    0x7f2(%rip),%r15
jmp    1923 <test_split_by_n+0x7d3>
nopl   (%rax)
mov    (%r14,%rbx,8),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
sete   %bpl
mov    0xc(%rsp),%eax
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    192d <test_split_by_n+0x7dd>
test   $0x1,%bpl
jne    1900 <test_split_by_n+0x7b0>
xor    %ebp,%ebp
jmp    1917 <test_split_by_n+0x7c7>
test   %bpl,%bpl
lea    0x728(%rip),%rax
cmovne %rax,%r13
lea    0x711(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
call   1060 <free_array@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Testing split_string_by_n\0A\0A\00"
@.str.1 = [4 x i8] c"ace\00"
@.str.2 = [4 x i8] c"bdf\00"
@__const.test_split_by_n.answer1 = [2 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [7 x i8] c"abcdef\00"
@.str.4 = [55 x i8] c"split_by_n on \22abcdef\22 with n=2 returns numFields=%d:\0A\00"
@.str.5 = [10 x i8] c" \22%s\22%s\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [3 x i8] c", \00"
@.str.8 = [12 x i8] c" (%s)\0A\0A\00"
@.str.9 = [8 x i8] c"Correct\00"
@.str.10 = [7 x i8] c"Failed\00"
@.str.11 = [3 x i8] c"ad\00"
@.str.12 = [3 x i8] c"be\00"
@.str.13 = [3 x i8] c"cf\00"
@__const.test_split_by_n.answer2 = [3 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0)]
@.str.14 = [55 x i8] c"split_by_n on \22abcdef\22 with n=3 returns numFields=%d:\0A\00"
@.str.15 = [3 x i8] c"ae\00"
@.str.16 = [3 x i8] c"bf\00"
@.str.17 = [2 x i8] c"c\00"
@.str.18 = [2 x i8] c"d\00"
@__const.test_split_by_n.answer3 = [4 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i32 0, i32 0)]
@.str.19 = [55 x i8] c"split_by_n on \22abcdef\22 with n=4 returns numFields=%d:\0A\00"
@.str.20 = [2 x i8] c"a\00"
@.str.21 = [2 x i8] c"b\00"
@.str.22 = [2 x i8] c"e\00"
@.str.23 = [2 x i8] c"f\00"
@.str.24 = [55 x i8] c"split_by_n on \22abcdef\22 with n=8 returns numFields=%d:\0A\00"
@.str.25 = [49 x i8] c"split_by_n on \22\22 with n=7 returns numFields=%d:\0A\00"
@__const.test_split_by_n.answer6 = [2 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i32 0, i32 0)]
@.str.26 = [3 x i8] c"ab\00"
@.str.27 = [51 x i8] c"split_by_n on \22ab\22 with n=7 returns numFields=%d:\0A\00"
@__const.test_split_by_n.answer7 = [1 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i32 0, i32 0)]
@.str.28 = [50 x i8] c"split_by_n on \22a\22 with n=3 returns numFields=%d:\0A\00"
@__const.test_split_by_n.answer8 = [1 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i32 0, i32 0)]
@.str.29 = [50 x i8] c"split_by_n on \22a\22 with n=1 returns numFields=%d:\0A\00"
define void @test_split_by_n() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2 x i8*]
%6 = alloca i8**
%7 = alloca i32
%8 = alloca [3 x i8*]
%9 = alloca i32
%10 = alloca [4 x i8*]
%11 = alloca i32
%12 = alloca [6 x i8*]
%13 = alloca i32
%14 = alloca i32
%15 = alloca [2 x i8*]
%16 = alloca i32
%17 = alloca [1 x i8*]
%18 = alloca i32
%19 = alloca [1 x i8*]
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %4
%21 = bitcast [2 x i8*]* %5 to i8*
%22 = call i8** @split_by_n(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 2, i32* %3)
store i8** %22, i8*** %6
%23 = load i8**, i8*** %6
%24 = icmp eq i8** %23, null
br i1 %24, label %25, label %26
25: ; preds = %0
br label %514
26: ; preds = %0
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0), i32 %27)
store i32 0, i32* %2
br label %29
29: ; preds = %46, %26
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %49
33: ; preds = %29
%34 = load i8**, i8*** %6
%35 = load i32, i32* %2
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = load i32, i32* %2
%40 = load i32, i32* %3
%41 = sub nsw i32 %40, 1
%42 = icmp eq i32 %39, %41
%43 = zext i1 %42 to i64
%44 = select i1 %42, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %38, i8* %44)
br label %46
46: ; preds = %33
%47 = load i32, i32* %2
%48 = add nsw i32 %47, 1
store i32 %48, i32* %2
br label %29
49: ; preds = %29
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = icmp eq i32 %50, %51
%53 = zext i1 %52 to i32
store i32 %53, i32* %1
store i32 0, i32* %2
br label %54
54: ; preds = %76, %49
%55 = load i32, i32* %2
%56 = load i32, i32* %3
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %79
58: ; preds = %54
%59 = load i32, i32* %1
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %73
61: ; preds = %58
%62 = load i32, i32* %2
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [2 x i8*], [2 x i8*]* %5, i64 0, i64 %63
%65 = load i8*, i8** %64
%66 = load i8**, i8*** %6
%67 = load i32, i32* %2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = call i64 @strcmp(i8* %65, i8* %70)
%72 = icmp eq i64 %71, 0
br label %73
73: ; preds = %61, %58
%74 = phi i1 [ false, %58 ], [ %72, %61 ]
%75 = zext i1 %74 to i32
store i32 %75, i32* %1
br label %76
76: ; preds = %73
%77 = load i32, i32* %2
%78 = add nsw i32 %77, 1
store i32 %78, i32* %2
br label %54
79: ; preds = %54
%80 = load i32, i32* %1
%81 = icmp ne i32 %80, 0
%82 = zext i1 %81 to i64
%83 = select i1 %81, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %83)
%85 = load i8**, i8*** %6
%86 = load i32, i32* %3
%87 = call i32 @free_array(i8** %85, i32 %86)
store i32 3, i32* %7
%88 = bitcast [3 x i8*]* %8 to i8*
%89 = call i8** @split_by_n(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 3, i32* %3)
store i8** %89, i8*** %6
%90 = load i32, i32* %3
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.14, i64 0, i64 0), i32 %90)
store i32 0, i32* %2
br label %92
92: ; preds = %109, %79
%93 = load i32, i32* %2
%94 = load i32, i32* %3
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %112
96: ; preds = %92
%97 = load i8**, i8*** %6
%98 = load i32, i32* %2
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8*, i8** %97, i64 %99
%101 = load i8*, i8** %100
%102 = load i32, i32* %2
%103 = load i32, i32* %3
%104 = sub nsw i32 %103, 1
%105 = icmp eq i32 %102, %104
%106 = zext i1 %105 to i64
%107 = select i1 %105, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %101, i8* %107)
br label %109
109: ; preds = %96
%110 = load i32, i32* %2
%111 = add nsw i32 %110, 1
store i32 %111, i32* %2
br label %92
112: ; preds = %92
%113 = load i32, i32* %3
%114 = load i32, i32* %7
%115 = icmp eq i32 %113, %114
%116 = zext i1 %115 to i32
store i32 %116, i32* %1
store i32 0, i32* %2
br label %117
117: ; preds = %139, %112
%118 = load i32, i32* %2
%119 = load i32, i32* %3
%120 = icmp slt i32 %118, %119
br i1 %120, label %121, label %142
121: ; preds = %117
%122 = load i32, i32* %1
%123 = icmp ne i32 %122, 0
br i1 %123, label %124, label %136
124: ; preds = %121
%125 = load i32, i32* %2
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 %126
%128 = load i8*, i8** %127
%129 = load i8**, i8*** %6
%130 = load i32, i32* %2
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8*, i8** %129, i64 %131
%133 = load i8*, i8** %132
%134 = call i64 @strcmp(i8* %128, i8* %133)
%135 = icmp eq i64 %134, 0
br label %136
136: ; preds = %124, %121
%137 = phi i1 [ false, %121 ], [ %135, %124 ]
%138 = zext i1 %137 to i32
store i32 %138, i32* %1
br label %139
139: ; preds = %136
%140 = load i32, i32* %2
%141 = add nsw i32 %140, 1
store i32 %141, i32* %2
br label %117
142: ; preds = %117
%143 = load i32, i32* %1
%144 = icmp ne i32 %143, 0
%145 = zext i1 %144 to i64
%146 = select i1 %144, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %146)
%148 = load i8**, i8*** %6
%149 = load i32, i32* %3
%150 = call i32 @free_array(i8** %148, i32 %149)
store i32 4, i32* %9
%151 = bitcast [4 x i8*]* %10 to i8*
%152 = call i8** @split_by_n(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 4, i32* %3)
store i8** %152, i8*** %6
%153 = load i32, i32* %3
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.19, i64 0, i64 0), i32 %153)
store i32 0, i32* %2
br label %155
155: ; preds = %172, %142
%156 = load i32, i32* %2
%157 = load i32, i32* %3
%158 = icmp slt i32 %156, %157
br i1 %158, label %159, label %175
159: ; preds = %155
%160 = load i8**, i8*** %6
%161 = load i32, i32* %2
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds i8*, i8** %160, i64 %162
%164 = load i8*, i8** %163
%165 = load i32, i32* %2
%166 = load i32, i32* %3
%167 = sub nsw i32 %166, 1
%168 = icmp eq i32 %165, %167
%169 = zext i1 %168 to i64
%170 = select i1 %168, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %164, i8* %170)
br label %172
172: ; preds = %159
%173 = load i32, i32* %2
%174 = add nsw i32 %173, 1
store i32 %174, i32* %2
br label %155
175: ; preds = %155
%176 = load i32, i32* %3
%177 = load i32, i32* %9
%178 = icmp eq i32 %176, %177
%179 = zext i1 %178 to i32
store i32 %179, i32* %1
store i32 0, i32* %2
br label %180
180: ; preds = %202, %175
%181 = load i32, i32* %2
%182 = load i32, i32* %3
%183 = icmp slt i32 %181, %182
br i1 %183, label %184, label %205
184: ; preds = %180
%185 = load i32, i32* %1
%186 = icmp ne i32 %185, 0
br i1 %186, label %187, label %199
187: ; preds = %184
%188 = load i32, i32* %2
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds [4 x i8*], [4 x i8*]* %10, i64 0, i64 %189
%191 = load i8*, i8** %190
%192 = load i8**, i8*** %6
%193 = load i32, i32* %2
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds i8*, i8** %192, i64 %194
%196 = load i8*, i8** %195
%197 = call i64 @strcmp(i8* %191, i8* %196)
%198 = icmp eq i64 %197, 0
br label %199
199: ; preds = %187, %184
%200 = phi i1 [ false, %184 ], [ %198, %187 ]
%201 = zext i1 %200 to i32
store i32 %201, i32* %1
br label %202
202: ; preds = %199
%203 = load i32, i32* %2
%204 = add nsw i32 %203, 1
store i32 %204, i32* %2
br label %180
205: ; preds = %180
%206 = load i32, i32* %1
%207 = icmp ne i32 %206, 0
%208 = zext i1 %207 to i64
%209 = select i1 %207, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%210 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %209)
%211 = load i8**, i8*** %6
%212 = load i32, i32* %3
%213 = call i32 @free_array(i8** %211, i32 %212)
store i32 6, i32* %11
%214 = bitcast [6 x i8*]* %12 to i8*
%215 = bitcast i8* %214 to [6 x i8*]*
%216 = getelementptr inbounds [6 x i8*], [6 x i8*]* %215, i32 0, i32 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i32 0, i32 0), i8** %216
%217 = getelementptr inbounds [6 x i8*], [6 x i8*]* %215, i32 0, i32 1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i32 0, i32 0), i8** %217
%218 = getelementptr inbounds [6 x i8*], [6 x i8*]* %215, i32 0, i32 2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i32 0, i32 0), i8** %218
%219 = getelementptr inbounds [6 x i8*], [6 x i8*]* %215, i32 0, i32 3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i32 0, i32 0), i8** %219
%220 = getelementptr inbounds [6 x i8*], [6 x i8*]* %215, i32 0, i32 4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i32 0, i32 0), i8** %220
%221 = getelementptr inbounds [6 x i8*], [6 x i8*]* %215, i32 0, i32 5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.23, i32 0, i32 0), i8** %221
%222 = call i8** @split_by_n(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 8, i32* %3)
store i8** %222, i8*** %6
%223 = load i32, i32* %3
%224 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.24, i64 0, i64 0), i32 %223)
store i32 0, i32* %2
br label %225
225: ; preds = %242, %205
%226 = load i32, i32* %2
%227 = load i32, i32* %3
%228 = icmp slt i32 %226, %227
br i1 %228, label %229, label %245
229: ; preds = %225
%230 = load i8**, i8*** %6
%231 = load i32, i32* %2
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds i8*, i8** %230, i64 %232
%234 = load i8*, i8** %233
%235 = load i32, i32* %2
%236 = load i32, i32* %3
%237 = sub nsw i32 %236, 1
%238 = icmp eq i32 %235, %237
%239 = zext i1 %238 to i64
%240 = select i1 %238, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%241 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %234, i8* %240)
br label %242
242: ; preds = %229
%243 = load i32, i32* %2
%244 = add nsw i32 %243, 1
store i32 %244, i32* %2
br label %225
245: ; preds = %225
%246 = load i32, i32* %3
%247 = load i32, i32* %11
%248 = icmp eq i32 %246, %247
%249 = zext i1 %248 to i32
store i32 %249, i32* %1
store i32 0, i32* %2
br label %250
250: ; preds = %272, %245
%251 = load i32, i32* %2
%252 = load i32, i32* %3
%253 = icmp slt i32 %251, %252
br i1 %253, label %254, label %275
254: ; preds = %250
%255 = load i32, i32* %1
%256 = icmp ne i32 %255, 0
br i1 %256, label %257, label %269
257: ; preds = %254
%258 = load i32, i32* %2
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds [6 x i8*], [6 x i8*]* %12, i64 0, i64 %259
%261 = load i8*, i8** %260
%262 = load i8**, i8*** %6
%263 = load i32, i32* %2
%264 = sext i32 %263 to i64
%265 = getelementptr inbounds i8*, i8** %262, i64 %264
%266 = load i8*, i8** %265
%267 = call i64 @strcmp(i8* %261, i8* %266)
%268 = icmp eq i64 %267, 0
br label %269
269: ; preds = %257, %254
%270 = phi i1 [ false, %254 ], [ %268, %257 ]
%271 = zext i1 %270 to i32
store i32 %271, i32* %1
br label %272
272: ; preds = %269
%273 = load i32, i32* %2
%274 = add nsw i32 %273, 1
store i32 %274, i32* %2
br label %250
275: ; preds = %250
%276 = load i32, i32* %1
%277 = icmp ne i32 %276, 0
%278 = zext i1 %277 to i64
%279 = select i1 %277, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%280 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %279)
%281 = load i8**, i8*** %6
%282 = load i32, i32* %3
%283 = call i32 @free_array(i8** %281, i32 %282)
store i32 0, i32* %13
%284 = call i8** @split_by_n(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32 7, i32* %3)
store i8** %284, i8*** %6
%285 = load i32, i32* %3
%286 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.25, i64 0, i64 0), i32 %285)
store i32 0, i32* %2
br label %287
287: ; preds = %304, %275
%288 = load i32, i32* %2
%289 = load i32, i32* %3
%290 = icmp slt i32 %288, %289
br i1 %290, label %291, label %307
291: ; preds = %287
%292 = load i8**, i8*** %6
%293 = load i32, i32* %2
%294 = sext i32 %293 to i64
%295 = getelementptr inbounds i8*, i8** %292, i64 %294
%296 = load i8*, i8** %295
%297 = load i32, i32* %2
%298 = load i32, i32* %3
%299 = sub nsw i32 %298, 1
%300 = icmp eq i32 %297, %299
%301 = zext i1 %300 to i64
%302 = select i1 %300, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%303 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %296, i8* %302)
br label %304
304: ; preds = %291
%305 = load i32, i32* %2
%306 = add nsw i32 %305, 1
store i32 %306, i32* %2
br label %287
307: ; preds = %287
%308 = load i32, i32* %3
%309 = load i32, i32* %13
%310 = icmp eq i32 %308, %309
br i1 %310, label %311, label %314
311: ; preds = %307
%312 = load i8**, i8*** %6
%313 = icmp eq i8** %312, null
br label %314
314: ; preds = %311, %307
%315 = phi i1 [ false, %307 ], [ %313, %311 ]
%316 = zext i1 %315 to i32
store i32 %316, i32* %1
%317 = load i32, i32* %1
%318 = icmp ne i32 %317, 0
%319 = zext i1 %318 to i64
%320 = select i1 %318, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%321 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %320)
%322 = load i8**, i8*** %6
%323 = load i32, i32* %3
%324 = call i32 @free_array(i8** %322, i32 %323)
store i32 2, i32* %14
%325 = bitcast [2 x i8*]* %15 to i8*
%326 = call i8** @split_by_n(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.26, i64 0, i64 0), i32 7, i32* %3)
store i8** %326, i8*** %6
%327 = load i32, i32* %3
%328 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.27, i64 0, i64 0), i32 %327)
store i32 0, i32* %2
br label %329
329: ; preds = %346, %314
%330 = load i32, i32* %2
%331 = load i32, i32* %3
%332 = icmp slt i32 %330, %331
br i1 %332, label %333, label %349
333: ; preds = %329
%334 = load i8**, i8*** %6
%335 = load i32, i32* %2
%336 = sext i32 %335 to i64
%337 = getelementptr inbounds i8*, i8** %334, i64 %336
%338 = load i8*, i8** %337
%339 = load i32, i32* %2
%340 = load i32, i32* %3
%341 = sub nsw i32 %340, 1
%342 = icmp eq i32 %339, %341
%343 = zext i1 %342 to i64
%344 = select i1 %342, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%345 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %338, i8* %344)
br label %346
346: ; preds = %333
%347 = load i32, i32* %2
%348 = add nsw i32 %347, 1
store i32 %348, i32* %2
br label %329
349: ; preds = %329
%350 = load i32, i32* %3
%351 = load i32, i32* %14
%352 = icmp eq i32 %350, %351
%353 = zext i1 %352 to i32
store i32 %353, i32* %1
store i32 0, i32* %2
br label %354
354: ; preds = %376, %349
%355 = load i32, i32* %2
%356 = load i32, i32* %3
%357 = icmp slt i32 %355, %356
br i1 %357, label %358, label %379
358: ; preds = %354
%359 = load i32, i32* %1
%360 = icmp ne i32 %359, 0
br i1 %360, label %361, label %373
361: ; preds = %358
%362 = load i32, i32* %2
%363 = sext i32 %362 to i64
%364 = getelementptr inbounds [2 x i8*], [2 x i8*]* %15, i64 0, i64 %363
%365 = load i8*, i8** %364
%366 = load i8**, i8*** %6
%367 = load i32, i32* %2
%368 = sext i32 %367 to i64
%369 = getelementptr inbounds i8*, i8** %366, i64 %368
%370 = load i8*, i8** %369
%371 = call i64 @strcmp(i8* %365, i8* %370)
%372 = icmp eq i64 %371, 0
br label %373
373: ; preds = %361, %358
%374 = phi i1 [ false, %358 ], [ %372, %361 ]
%375 = zext i1 %374 to i32
store i32 %375, i32* %1
br label %376
376: ; preds = %373
%377 = load i32, i32* %2
%378 = add nsw i32 %377, 1
store i32 %378, i32* %2
br label %354
379: ; preds = %354
%380 = load i32, i32* %1
%381 = icmp ne i32 %380, 0
%382 = zext i1 %381 to i64
%383 = select i1 %381, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%384 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %383)
%385 = load i8**, i8*** %6
%386 = load i32, i32* %3
%387 = call i32 @free_array(i8** %385, i32 %386)
store i32 1, i32* %16
%388 = bitcast [1 x i8*]* %17 to i8*
%389 = call i8** @split_by_n(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0), i32 3, i32* %3)
store i8** %389, i8*** %6
%390 = load i32, i32* %3
%391 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.28, i64 0, i64 0), i32 %390)
store i32 0, i32* %2
br label %392
392: ; preds = %409, %379
%393 = load i32, i32* %2
%394 = load i32, i32* %3
%395 = icmp slt i32 %393, %394
br i1 %395, label %396, label %412
396: ; preds = %392
%397 = load i8**, i8*** %6
%398 = load i32, i32* %2
%399 = sext i32 %398 to i64
%400 = getelementptr inbounds i8*, i8** %397, i64 %399
%401 = load i8*, i8** %400
%402 = load i32, i32* %2
%403 = load i32, i32* %3
%404 = sub nsw i32 %403, 1
%405 = icmp eq i32 %402, %404
%406 = zext i1 %405 to i64
%407 = select i1 %405, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%408 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %401, i8* %407)
br label %409
409: ; preds = %396
%410 = load i32, i32* %2
%411 = add nsw i32 %410, 1
store i32 %411, i32* %2
br label %392
412: ; preds = %392
%413 = load i32, i32* %3
%414 = load i32, i32* %16
%415 = icmp eq i32 %413, %414
%416 = zext i1 %415 to i32
store i32 %416, i32* %1
store i32 0, i32* %2
br label %417
417: ; preds = %439, %412
%418 = load i32, i32* %2
%419 = load i32, i32* %3
%420 = icmp slt i32 %418, %419
br i1 %420, label %421, label %442
421: ; preds = %417
%422 = load i32, i32* %1
%423 = icmp ne i32 %422, 0
br i1 %423, label %424, label %436
424: ; preds = %421
%425 = load i32, i32* %2
%426 = sext i32 %425 to i64
%427 = getelementptr inbounds [1 x i8*], [1 x i8*]* %17, i64 0, i64 %426
%428 = load i8*, i8** %427
%429 = load i8**, i8*** %6
%430 = load i32, i32* %2
%431 = sext i32 %430 to i64
%432 = getelementptr inbounds i8*, i8** %429, i64 %431
%433 = load i8*, i8** %432
%434 = call i64 @strcmp(i8* %428, i8* %433)
%435 = icmp eq i64 %434, 0
br label %436
436: ; preds = %424, %421
%437 = phi i1 [ false, %421 ], [ %435, %424 ]
%438 = zext i1 %437 to i32
store i32 %438, i32* %1
br label %439
439: ; preds = %436
%440 = load i32, i32* %2
%441 = add nsw i32 %440, 1
store i32 %441, i32* %2
br label %417
442: ; preds = %417
%443 = load i32, i32* %1
%444 = icmp ne i32 %443, 0
%445 = zext i1 %444 to i64
%446 = select i1 %444, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%447 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %446)
%448 = load i8**, i8*** %6
%449 = load i32, i32* %3
%450 = call i32 @free_array(i8** %448, i32 %449)
store i32 1, i32* %18
%451 = bitcast [1 x i8*]* %19 to i8*
%452 = call i8** @split_by_n(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0), i32 1, i32* %3)
store i8** %452, i8*** %6
%453 = load i32, i32* %3
%454 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.29, i64 0, i64 0), i32 %453)
store i32 0, i32* %2
br label %455
455: ; preds = %472, %442
%456 = load i32, i32* %2
%457 = load i32, i32* %3
%458 = icmp slt i32 %456, %457
br i1 %458, label %459, label %475
459: ; preds = %455
%460 = load i8**, i8*** %6
%461 = load i32, i32* %2
%462 = sext i32 %461 to i64
%463 = getelementptr inbounds i8*, i8** %460, i64 %462
%464 = load i8*, i8** %463
%465 = load i32, i32* %2
%466 = load i32, i32* %3
%467 = sub nsw i32 %466, 1
%468 = icmp eq i32 %465, %467
%469 = zext i1 %468 to i64
%470 = select i1 %468, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%471 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %464, i8* %470)
br label %472
472: ; preds = %459
%473 = load i32, i32* %2
%474 = add nsw i32 %473, 1
store i32 %474, i32* %2
br label %455
475: ; preds = %455
%476 = load i32, i32* %3
%477 = load i32, i32* %18
%478 = icmp eq i32 %476, %477
%479 = zext i1 %478 to i32
store i32 %479, i32* %1
store i32 0, i32* %2
br label %480
480: ; preds = %502, %475
%481 = load i32, i32* %2
%482 = load i32, i32* %3
%483 = icmp slt i32 %481, %482
br i1 %483, label %484, label %505
484: ; preds = %480
%485 = load i32, i32* %1
%486 = icmp ne i32 %485, 0
br i1 %486, label %487, label %499
487: ; preds = %484
%488 = load i32, i32* %2
%489 = sext i32 %488 to i64
%490 = getelementptr inbounds [1 x i8*], [1 x i8*]* %19, i64 0, i64 %489
%491 = load i8*, i8** %490
%492 = load i8**, i8*** %6
%493 = load i32, i32* %2
%494 = sext i32 %493 to i64
%495 = getelementptr inbounds i8*, i8** %492, i64 %494
%496 = load i8*, i8** %495
%497 = call i64 @strcmp(i8* %491, i8* %496)
%498 = icmp eq i64 %497, 0
br label %499
499: ; preds = %487, %484
%500 = phi i1 [ false, %484 ], [ %498, %487 ]
%501 = zext i1 %500 to i32
store i32 %501, i32* %1
br label %502
502: ; preds = %499
%503 = load i32, i32* %2
%504 = add nsw i32 %503, 1
store i32 %504, i32* %2
br label %480
505: ; preds = %480
%506 = load i32, i32* %1
%507 = icmp ne i32 %506, 0
%508 = zext i1 %507 to i64
%509 = select i1 %507, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%510 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %509)
%511 = load i8**, i8*** %6
%512 = load i32, i32* %3
%513 = call i32 @free_array(i8** %511, i32 %512)
br label %514
514: ; preds = %505, %25
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"ace\00"
@.str.2 = [4 x i8] c"bdf\00"
@reltable.test_split_by_n = [2 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([2 x i32]* @reltable.test_split_by_n to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([2 x i32]* @reltable.test_split_by_n to i64)) to i32)]
@.str.3 = [7 x i8] c"abcdef\00"
@.str.4 = [55 x i8] c"split_by_n on \22abcdef\22 with n=2 returns numFields=%d:\0A\00"
@.str.5 = [10 x i8] c" \22%s\22%s\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [3 x i8] c", \00"
@.str.8 = [12 x i8] c" (%s)\0A\0A\00"
@.str.9 = [8 x i8] c"Correct\00"
@.str.10 = [7 x i8] c"Failed\00"
@.str.11 = [3 x i8] c"ad\00"
@.str.12 = [3 x i8] c"be\00"
@.str.13 = [3 x i8] c"cf\00"
@reltable.test_split_by_n.30 = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.11 to i64), i64 ptrtoint ([3 x i32]* @reltable.test_split_by_n.30 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.12 to i64), i64 ptrtoint ([3 x i32]* @reltable.test_split_by_n.30 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.13 to i64), i64 ptrtoint ([3 x i32]* @reltable.test_split_by_n.30 to i64)) to i32)]
@.str.14 = [55 x i8] c"split_by_n on \22abcdef\22 with n=3 returns numFields=%d:\0A\00"
@.str.15 = [3 x i8] c"ae\00"
@.str.16 = [3 x i8] c"bf\00"
@.str.17 = [2 x i8] c"c\00"
@.str.18 = [2 x i8] c"d\00"
@reltable.test_split_by_n.31 = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.15 to i64), i64 ptrtoint ([4 x i32]* @reltable.test_split_by_n.31 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.16 to i64), i64 ptrtoint ([4 x i32]* @reltable.test_split_by_n.31 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.17 to i64), i64 ptrtoint ([4 x i32]* @reltable.test_split_by_n.31 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.18 to i64), i64 ptrtoint ([4 x i32]* @reltable.test_split_by_n.31 to i64)) to i32)]
@.str.19 = [55 x i8] c"split_by_n on \22abcdef\22 with n=4 returns numFields=%d:\0A\00"
@.str.20 = [2 x i8] c"a\00"
@.str.21 = [2 x i8] c"b\00"
@.str.22 = [2 x i8] c"e\00"
@.str.23 = [2 x i8] c"f\00"
@.str.24 = [55 x i8] c"split_by_n on \22abcdef\22 with n=8 returns numFields=%d:\0A\00"
@.str.25 = [49 x i8] c"split_by_n on \22\22 with n=7 returns numFields=%d:\0A\00"
@reltable.test_split_by_n.32 = [2 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.20 to i64), i64 ptrtoint ([2 x i32]* @reltable.test_split_by_n.32 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.21 to i64), i64 ptrtoint ([2 x i32]* @reltable.test_split_by_n.32 to i64)) to i32)]
@.str.26 = [3 x i8] c"ab\00"
@.str.27 = [51 x i8] c"split_by_n on \22ab\22 with n=7 returns numFields=%d:\0A\00"
@.str.28 = [50 x i8] c"split_by_n on \22a\22 with n=3 returns numFields=%d:\0A\00"
@.str.29 = [50 x i8] c"split_by_n on \22a\22 with n=1 returns numFields=%d:\0A\00"
@str = [27 x i8] c"Testing split_string_by_n\0A\00"
define void @test_split_by_n() {
%1 = alloca i32
%2 = alloca [6 x i8*]
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = call i8** @split_by_n(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 2, i32* %1)
%6 = icmp eq i8** %5, null
br i1 %6, label %360, label %7
7: ; preds = %0
%8 = load i32, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %47
12: ; preds = %7, %12
%13 = phi i64 [ %22, %12 ], [ 0, %7 ]
%14 = phi i32 [ %23, %12 ], [ %10, %7 ]
%15 = getelementptr inbounds i8*, i8** %5, i64 %13
%16 = load i8*, i8** %15
%17 = add nsw i32 %14, -1
%18 = zext i32 %17 to i64
%19 = icmp eq i64 %13, %18
%20 = select i1 %19, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %16, i8* %20)
%22 = add nuw nsw i64 %13, 1
%23 = load i32, i32* %1
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %22, %24
br i1 %25, label %12, label %26
26: ; preds = %12
%27 = icmp eq i32 %23, 2
%28 = icmp sgt i32 %23, 0
br i1 %28, label %29, label %47
29: ; preds = %26, %41
%30 = phi i32 [ %42, %41 ], [ %23, %26 ]
%31 = phi i64 [ %44, %41 ], [ 0, %26 ]
%32 = phi i1 [ %43, %41 ], [ %27, %26 ]
br i1 %32, label %33, label %41
33: ; preds = %29
%34 = shl i64 %31, 2
%35 = call i8* @llvm.load.relative.i64(i8* bitcast ([2 x i32]* @reltable.test_split_by_n to i8*), i64 %34)
%36 = getelementptr inbounds i8*, i8** %5, i64 %31
%37 = load i8*, i8** %36
%38 = call i64 @strcmp(i8* %35, i8* %37)
%39 = icmp eq i64 %38, 0
%40 = load i32, i32* %1
br label %41
41: ; preds = %33, %29
%42 = phi i32 [ %30, %29 ], [ %40, %33 ]
%43 = phi i1 [ false, %29 ], [ %39, %33 ]
%44 = add nuw nsw i64 %31, 1
%45 = sext i32 %42 to i64
%46 = icmp slt i64 %44, %45
br i1 %46, label %29, label %47
47: ; preds = %41, %7, %26
%48 = phi i1 [ %27, %26 ], [ false, %7 ], [ %43, %41 ]
%49 = select i1 %48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %49)
%51 = load i32, i32* %1
%52 = call i32 @free_array(i8** %5, i32 %51)
%53 = call i8** @split_by_n(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 3, i32* %1)
%54 = load i32, i32* %1
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.14, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %1
%57 = icmp sgt i32 %56, 0
br i1 %57, label %58, label %93
58: ; preds = %47, %58
%59 = phi i64 [ %68, %58 ], [ 0, %47 ]
%60 = phi i32 [ %69, %58 ], [ %56, %47 ]
%61 = getelementptr inbounds i8*, i8** %53, i64 %59
%62 = load i8*, i8** %61
%63 = add nsw i32 %60, -1
%64 = zext i32 %63 to i64
%65 = icmp eq i64 %59, %64
%66 = select i1 %65, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %62, i8* %66)
%68 = add nuw nsw i64 %59, 1
%69 = load i32, i32* %1
%70 = sext i32 %69 to i64
%71 = icmp slt i64 %68, %70
br i1 %71, label %58, label %72
72: ; preds = %58
%73 = icmp eq i32 %69, 3
%74 = icmp sgt i32 %69, 0
br i1 %74, label %75, label %93
75: ; preds = %72, %87
%76 = phi i32 [ %88, %87 ], [ %69, %72 ]
%77 = phi i64 [ %90, %87 ], [ 0, %72 ]
%78 = phi i1 [ %89, %87 ], [ %73, %72 ]
br i1 %78, label %79, label %87
79: ; preds = %75
%80 = shl i64 %77, 2
%81 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.test_split_by_n.30 to i8*), i64 %80)
%82 = getelementptr inbounds i8*, i8** %53, i64 %77
%83 = load i8*, i8** %82
%84 = call i64 @strcmp(i8* %81, i8* %83)
%85 = icmp eq i64 %84, 0
%86 = load i32, i32* %1
br label %87
87: ; preds = %79, %75
%88 = phi i32 [ %76, %75 ], [ %86, %79 ]
%89 = phi i1 [ false, %75 ], [ %85, %79 ]
%90 = add nuw nsw i64 %77, 1
%91 = sext i32 %88 to i64
%92 = icmp slt i64 %90, %91
br i1 %92, label %75, label %93
93: ; preds = %87, %47, %72
%94 = phi i1 [ %73, %72 ], [ false, %47 ], [ %89, %87 ]
%95 = select i1 %94, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %95)
%97 = load i32, i32* %1
%98 = call i32 @free_array(i8** %53, i32 %97)
%99 = call i8** @split_by_n(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 4, i32* %1)
%100 = load i32, i32* %1
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.19, i64 0, i64 0), i32 %100)
%102 = load i32, i32* %1
%103 = icmp sgt i32 %102, 0
br i1 %103, label %104, label %139
104: ; preds = %93, %104
%105 = phi i64 [ %114, %104 ], [ 0, %93 ]
%106 = phi i32 [ %115, %104 ], [ %102, %93 ]
%107 = getelementptr inbounds i8*, i8** %99, i64 %105
%108 = load i8*, i8** %107
%109 = add nsw i32 %106, -1
%110 = zext i32 %109 to i64
%111 = icmp eq i64 %105, %110
%112 = select i1 %111, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %108, i8* %112)
%114 = add nuw nsw i64 %105, 1
%115 = load i32, i32* %1
%116 = sext i32 %115 to i64
%117 = icmp slt i64 %114, %116
br i1 %117, label %104, label %118
118: ; preds = %104
%119 = icmp eq i32 %115, 4
%120 = icmp sgt i32 %115, 0
br i1 %120, label %121, label %139
121: ; preds = %118, %133
%122 = phi i32 [ %134, %133 ], [ %115, %118 ]
%123 = phi i64 [ %136, %133 ], [ 0, %118 ]
%124 = phi i1 [ %135, %133 ], [ %119, %118 ]
br i1 %124, label %125, label %133
125: ; preds = %121
%126 = shl i64 %123, 2
%127 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.test_split_by_n.31 to i8*), i64 %126)
%128 = getelementptr inbounds i8*, i8** %99, i64 %123
%129 = load i8*, i8** %128
%130 = call i64 @strcmp(i8* %127, i8* %129)
%131 = icmp eq i64 %130, 0
%132 = load i32, i32* %1
br label %133
133: ; preds = %125, %121
%134 = phi i32 [ %122, %121 ], [ %132, %125 ]
%135 = phi i1 [ false, %121 ], [ %131, %125 ]
%136 = add nuw nsw i64 %123, 1
%137 = sext i32 %134 to i64
%138 = icmp slt i64 %136, %137
br i1 %138, label %121, label %139
139: ; preds = %133, %93, %118
%140 = phi i1 [ %119, %118 ], [ false, %93 ], [ %135, %133 ]
%141 = select i1 %140, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%142 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %141)
%143 = load i32, i32* %1
%144 = call i32 @free_array(i8** %99, i32 %143)
%145 = bitcast [6 x i8*]* %2 to i8*
%146 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0), i8** %146
%147 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i64 0, i64 0), i8** %147
%148 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0), i8** %148
%149 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0), i8** %149
%150 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0), i8** %150
%151 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.23, i64 0, i64 0), i8** %151
%152 = call i8** @split_by_n(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 8, i32* %1)
%153 = load i32, i32* %1
%154 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.24, i64 0, i64 0), i32 %153)
%155 = load i32, i32* %1
%156 = icmp sgt i32 %155, 0
br i1 %156, label %157, label %192
157: ; preds = %139, %157
%158 = phi i64 [ %167, %157 ], [ 0, %139 ]
%159 = phi i32 [ %168, %157 ], [ %155, %139 ]
%160 = getelementptr inbounds i8*, i8** %152, i64 %158
%161 = load i8*, i8** %160
%162 = add nsw i32 %159, -1
%163 = zext i32 %162 to i64
%164 = icmp eq i64 %158, %163
%165 = select i1 %164, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%166 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %161, i8* %165)
%167 = add nuw nsw i64 %158, 1
%168 = load i32, i32* %1
%169 = sext i32 %168 to i64
%170 = icmp slt i64 %167, %169
br i1 %170, label %157, label %171
171: ; preds = %157
%172 = icmp eq i32 %168, 6
%173 = icmp sgt i32 %168, 0
br i1 %173, label %174, label %192
174: ; preds = %171, %186
%175 = phi i32 [ %187, %186 ], [ %168, %171 ]
%176 = phi i64 [ %189, %186 ], [ 0, %171 ]
%177 = phi i1 [ %188, %186 ], [ %172, %171 ]
br i1 %177, label %178, label %186
178: ; preds = %174
%179 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 %176
%180 = load i8*, i8** %179
%181 = getelementptr inbounds i8*, i8** %152, i64 %176
%182 = load i8*, i8** %181
%183 = call i64 @strcmp(i8* %180, i8* %182)
%184 = icmp eq i64 %183, 0
%185 = load i32, i32* %1
br label %186
186: ; preds = %178, %174
%187 = phi i32 [ %175, %174 ], [ %185, %178 ]
%188 = phi i1 [ false, %174 ], [ %184, %178 ]
%189 = add nuw nsw i64 %176, 1
%190 = sext i32 %187 to i64
%191 = icmp slt i64 %189, %190
br i1 %191, label %174, label %192
192: ; preds = %186, %139, %171
%193 = phi i1 [ %172, %171 ], [ false, %139 ], [ %188, %186 ]
%194 = select i1 %193, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%195 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %194)
%196 = load i32, i32* %1
%197 = call i32 @free_array(i8** %152, i32 %196)
%198 = call i8** @split_by_n(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32 7, i32* %1)
%199 = load i32, i32* %1
%200 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.25, i64 0, i64 0), i32 %199)
%201 = load i32, i32* %1
%202 = icmp sgt i32 %201, 0
br i1 %202, label %203, label %217
203: ; preds = %192, %203
%204 = phi i64 [ %213, %203 ], [ 0, %192 ]
%205 = phi i32 [ %214, %203 ], [ %201, %192 ]
%206 = getelementptr inbounds i8*, i8** %198, i64 %204
%207 = load i8*, i8** %206
%208 = add nsw i32 %205, -1
%209 = zext i32 %208 to i64
%210 = icmp eq i64 %204, %209
%211 = select i1 %210, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%212 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %207, i8* %211)
%213 = add nuw nsw i64 %204, 1
%214 = load i32, i32* %1
%215 = sext i32 %214 to i64
%216 = icmp slt i64 %213, %215
br i1 %216, label %203, label %217
217: ; preds = %203, %192
%218 = phi i32 [ %201, %192 ], [ %214, %203 ]
%219 = icmp eq i32 %218, 0
%220 = icmp eq i8** %198, null
%221 = select i1 %219, i1 %220, i1 false
%222 = select i1 %221, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%223 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %222)
%224 = load i32, i32* %1
%225 = call i32 @free_array(i8** %198, i32 %224)
%226 = call i8** @split_by_n(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.26, i64 0, i64 0), i32 7, i32* %1)
%227 = load i32, i32* %1
%228 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.27, i64 0, i64 0), i32 %227)
%229 = load i32, i32* %1
%230 = icmp sgt i32 %229, 0
br i1 %230, label %231, label %266
231: ; preds = %217, %231
%232 = phi i64 [ %241, %231 ], [ 0, %217 ]
%233 = phi i32 [ %242, %231 ], [ %229, %217 ]
%234 = getelementptr inbounds i8*, i8** %226, i64 %232
%235 = load i8*, i8** %234
%236 = add nsw i32 %233, -1
%237 = zext i32 %236 to i64
%238 = icmp eq i64 %232, %237
%239 = select i1 %238, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%240 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %235, i8* %239)
%241 = add nuw nsw i64 %232, 1
%242 = load i32, i32* %1
%243 = sext i32 %242 to i64
%244 = icmp slt i64 %241, %243
br i1 %244, label %231, label %245
245: ; preds = %231
%246 = icmp eq i32 %242, 2
%247 = icmp sgt i32 %242, 0
br i1 %247, label %248, label %266
248: ; preds = %245, %260
%249 = phi i32 [ %261, %260 ], [ %242, %245 ]
%250 = phi i64 [ %263, %260 ], [ 0, %245 ]
%251 = phi i1 [ %262, %260 ], [ %246, %245 ]
br i1 %251, label %252, label %260
252: ; preds = %248
%253 = shl i64 %250, 2
%254 = call i8* @llvm.load.relative.i64(i8* bitcast ([2 x i32]* @reltable.test_split_by_n.32 to i8*), i64 %253)
%255 = getelementptr inbounds i8*, i8** %226, i64 %250
%256 = load i8*, i8** %255
%257 = call i64 @strcmp(i8* %254, i8* %256)
%258 = icmp eq i64 %257, 0
%259 = load i32, i32* %1
br label %260
260: ; preds = %252, %248
%261 = phi i32 [ %249, %248 ], [ %259, %252 ]
%262 = phi i1 [ false, %248 ], [ %258, %252 ]
%263 = add nuw nsw i64 %250, 1
%264 = sext i32 %261 to i64
%265 = icmp slt i64 %263, %264
br i1 %265, label %248, label %266
266: ; preds = %260, %217, %245
%267 = phi i1 [ %246, %245 ], [ false, %217 ], [ %262, %260 ]
%268 = select i1 %267, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%269 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %268)
%270 = load i32, i32* %1
%271 = call i32 @free_array(i8** %226, i32 %270)
%272 = call i8** @split_by_n(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0), i32 3, i32* %1)
%273 = load i32, i32* %1
%274 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.28, i64 0, i64 0), i32 %273)
%275 = load i32, i32* %1
%276 = icmp sgt i32 %275, 0
br i1 %276, label %277, label %310
277: ; preds = %266, %277
%278 = phi i64 [ %287, %277 ], [ 0, %266 ]
%279 = phi i32 [ %288, %277 ], [ %275, %266 ]
%280 = getelementptr inbounds i8*, i8** %272, i64 %278
%281 = load i8*, i8** %280
%282 = add nsw i32 %279, -1
%283 = zext i32 %282 to i64
%284 = icmp eq i64 %278, %283
%285 = select i1 %284, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%286 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %281, i8* %285)
%287 = add nuw nsw i64 %278, 1
%288 = load i32, i32* %1
%289 = sext i32 %288 to i64
%290 = icmp slt i64 %287, %289
br i1 %290, label %277, label %291
291: ; preds = %277
%292 = icmp eq i32 %288, 1
%293 = icmp sgt i32 %288, 0
br i1 %293, label %294, label %310
294: ; preds = %291, %304
%295 = phi i32 [ %305, %304 ], [ %288, %291 ]
%296 = phi i64 [ %307, %304 ], [ 0, %291 ]
%297 = phi i1 [ %306, %304 ], [ %292, %291 ]
br i1 %297, label %298, label %304
298: ; preds = %294
%299 = getelementptr inbounds i8*, i8** %272, i64 %296
%300 = load i8*, i8** %299
%301 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0), i8* %300)
%302 = icmp eq i64 %301, 0
%303 = load i32, i32* %1
br label %304
304: ; preds = %298, %294
%305 = phi i32 [ %295, %294 ], [ %303, %298 ]
%306 = phi i1 [ false, %294 ], [ %302, %298 ]
%307 = add nuw nsw i64 %296, 1
%308 = sext i32 %305 to i64
%309 = icmp slt i64 %307, %308
br i1 %309, label %294, label %310
310: ; preds = %304, %266, %291
%311 = phi i1 [ %292, %291 ], [ false, %266 ], [ %306, %304 ]
%312 = select i1 %311, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%313 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %312)
%314 = load i32, i32* %1
%315 = call i32 @free_array(i8** %272, i32 %314)
%316 = call i8** @split_by_n(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0), i32 1, i32* %1)
%317 = load i32, i32* %1
%318 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.29, i64 0, i64 0), i32 %317)
%319 = load i32, i32* %1
%320 = icmp sgt i32 %319, 0
br i1 %320, label %321, label %354
321: ; preds = %310, %321
%322 = phi i64 [ %331, %321 ], [ 0, %310 ]
%323 = phi i32 [ %332, %321 ], [ %319, %310 ]
%324 = getelementptr inbounds i8*, i8** %316, i64 %322
%325 = load i8*, i8** %324
%326 = add nsw i32 %323, -1
%327 = zext i32 %326 to i64
%328 = icmp eq i64 %322, %327
%329 = select i1 %328, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%330 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %325, i8* %329)
%331 = add nuw nsw i64 %322, 1
%332 = load i32, i32* %1
%333 = sext i32 %332 to i64
%334 = icmp slt i64 %331, %333
br i1 %334, label %321, label %335
335: ; preds = %321
%336 = icmp eq i32 %332, 1
%337 = icmp sgt i32 %332, 0
br i1 %337, label %338, label %354
338: ; preds = %335, %348
%339 = phi i32 [ %349, %348 ], [ %332, %335 ]
%340 = phi i64 [ %351, %348 ], [ 0, %335 ]
%341 = phi i1 [ %350, %348 ], [ %336, %335 ]
br i1 %341, label %342, label %348
342: ; preds = %338
%343 = getelementptr inbounds i8*, i8** %316, i64 %340
%344 = load i8*, i8** %343
%345 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0), i8* %344)
%346 = icmp eq i64 %345, 0
%347 = load i32, i32* %1
br label %348
348: ; preds = %342, %338
%349 = phi i32 [ %339, %338 ], [ %347, %342 ]
%350 = phi i1 [ false, %338 ], [ %346, %342 ]
%351 = add nuw nsw i64 %340, 1
%352 = sext i32 %349 to i64
%353 = icmp slt i64 %351, %352
br i1 %353, label %338, label %354
354: ; preds = %348, %310, %335
%355 = phi i1 [ %336, %335 ], [ false, %310 ], [ %350, %348 ]
%356 = select i1 %355, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0)
%357 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %356)
%358 = load i32, i32* %1
%359 = call i32 @free_array(i8** %316, i32 %358)
br label %360
360: ; preds = %0, %354
ret void
}