#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);
scalar_t__ calloc(unsigned long, int);
scalar_t__ errno;
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ free_2d_array(char ***, unsigned long);
scalar_t__ malloc(int);
int /*<<< orphan*/ print_error(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int tail_minus(FILE *file, unsigned long int lines_requested) {
  char s[1026] = {'\0'};
  unsigned long int lines_saved = 0;
  char **line_buffer = (char **)calloc(lines_requested, sizeof(char *));
  if (!((line_buffer))) {
    fprintf(stderr, "[ERROR] (%s:%d) ",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/mkollaro/c_snippets/refs/heads/master/"
            "src/tail.c",
            134);
    print_error("Out of memory.");
    errno = 0;
    goto error;
  };
  unsigned int i;
  for (i = 0; fgets(s, 1026, file) != NULL; i++, i = i % lines_requested) {
    if (strlen(s) >= (1026 - 1) && s[1026 - 2] != '\n') {
      {
        fprintf(stderr, "[ERROR] (%s:%d) ",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/mkollaro/c_snippets/refs/"
                "heads/master/src/tail.c",
                140);
        print_error("Line too long (longer lines not implemented)");
        errno = 0;
        goto error;
      };
    }
    if (lines_requested > lines_saved) {
      assert(i <= lines_requested);
      line_buffer[i] = (char *)malloc(1026 * sizeof(char));
      if (!((line_buffer[i]))) {
        fprintf(stderr, "[ERROR] (%s:%d) ",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/mkollaro/c_snippets/refs/"
                "heads/master/src/tail.c",
                148);
        print_error("Out of memory.");
        errno = 0;
        goto error;
      };
      strncpy(line_buffer[i], s, 1026);
      lines_saved++;
    } else {
      strncpy(line_buffer[i], s, 1026);
    }
  }
  unsigned int j = 0;
  for (; j < lines_saved; i++, j++) {
    i = i % lines_saved;
    printf("%s", line_buffer[i]);
  }
  free_2d_array(&line_buffer, lines_requested);
  return 0;
error:
  free_2d_array(&line_buffer, lines_requested);
  return -1;
}


x86 assembly (clang, -O0):
<tail_minus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x402,%edx
call   1070 <memset@plt>
movq   $0x0,-0x428(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0x430(%rbp)
cmpq   $0x0,-0x430(%rbp)
jne    1244 <tail_minus+0x94>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
lea    0xdec(%rip),%rsi
lea    0xdf6(%rip),%rdx
mov    $0x86,%ecx
call   10b0 <fprintf@plt>
lea    0xe70(%rip),%rdi
call   1040 <print_error@plt>
mov    0x2da0(%rip),%rax
movq   $0x0,(%rax)
jmp    148b <tail_minus+0x2db>
movl   $0x0,-0x434(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x402,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     13f9 <tail_minus+0x249>
lea    -0x420(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x401,%eax
jl     12d1 <tail_minus+0x121>
movsbl -0x20(%rbp),%eax
cmp    $0xa,%eax
je     12d1 <tail_minus+0x121>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
lea    0xd5f(%rip),%rsi
lea    0xd69(%rip),%rdx
mov    $0x8c,%ecx
call   10b0 <fprintf@plt>
lea    0xdf2(%rip),%rdi
call   1040 <print_error@plt>
mov    0x2d13(%rip),%rax
movq   $0x0,(%rax)
jmp    148b <tail_minus+0x2db>
mov    -0x18(%rbp),%rax
cmp    -0x428(%rbp),%rax
jbe    13a8 <tail_minus+0x1f8>
mov    -0x434(%rbp),%eax
cmp    -0x18(%rbp),%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    $0x402,%edi
call   10c0 <malloc@plt>
mov    %rax,%rdx
mov    -0x430(%rbp),%rax
mov    -0x434(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
mov    -0x430(%rbp),%rax
mov    -0x434(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
jne    136f <tail_minus+0x1bf>
mov    0x2caa(%rip),%rax
mov    (%rax),%edi
lea    0xcc1(%rip),%rsi
lea    0xccb(%rip),%rdx
mov    $0x94,%ecx
call   10b0 <fprintf@plt>
lea    0xd45(%rip),%rdi
call   1040 <print_error@plt>
mov    0x2c75(%rip),%rax
movq   $0x0,(%rax)
jmp    148b <tail_minus+0x2db>
mov    -0x430(%rbp),%rax
mov    -0x434(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
lea    -0x420(%rbp),%rsi
mov    $0x402,%edx
call   1030 <strncpy@plt>
mov    -0x428(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x428(%rbp)
jmp    13ca <tail_minus+0x21a>
mov    -0x430(%rbp),%rax
mov    -0x434(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
lea    -0x420(%rbp),%rsi
mov    $0x402,%edx
call   1030 <strncpy@plt>
jmp    13cf <tail_minus+0x21f>
mov    -0x434(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x434(%rbp)
mov    -0x434(%rbp),%eax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %edx,%eax
mov    %eax,-0x434(%rbp)
jmp    124e <tail_minus+0x9e>
movl   $0x0,-0x438(%rbp)
mov    -0x438(%rbp),%eax
cmp    -0x428(%rbp),%rax
jae    146f <tail_minus+0x2bf>
mov    -0x434(%rbp),%eax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x428(%rbp)
mov    %edx,%eax
mov    %eax,-0x434(%rbp)
mov    -0x430(%rbp),%rax
mov    -0x434(%rbp),%ecx
mov    (%rax,%rcx,8),%rsi
lea    0xc91(%rip),%rdi
call   1060 <printf@plt>
mov    -0x434(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x434(%rbp)
mov    -0x438(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x438(%rbp)
jmp    1403 <tail_minus+0x253>
mov    -0x18(%rbp),%rsi
lea    -0x430(%rbp),%rdi
call   10d0 <free_2d_array@plt>
movl   $0x0,-0x4(%rbp)
jmp    14a2 <tail_minus+0x2f2>
mov    -0x18(%rbp),%rsi
lea    -0x430(%rbp),%rdi
call   10d0 <free_2d_array@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tail_minus>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rsi,%r13
mov    %rdi,%r15
lea    0x20(%rsp),%rdi
xor    %ebx,%ebx
mov    $0x402,%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    %r13,%rdi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
je     12eb <tail_minus+0x13b>
mov    %rax,%r12
lea    0x20(%rsp),%rdi
mov    $0x402,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1355 <tail_minus+0x1a5>
xor    %ebx,%ebx
lea    0x20(%rsp),%r14
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    %r13,0x10(%rsp)
jmp    1249 <tail_minus+0x99>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x402,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1376 <tail_minus+0x1c6>
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    $0x401,%eax
jl     1266 <tail_minus+0xb6>
cmpb   $0xa,0x420(%rsp)
0a
jne    1315 <tail_minus+0x165>
mov    %ebx,%ebp
cmp    %r13,0x8(%rsp)
jae    12c0 <tail_minus+0x110>
xor    %edi,%edi
cmp    %r13,%rbp
setbe  %dil
call   10a0 <assert@plt>
mov    $0x402,%edi
call   10c0 <malloc@plt>
mov    %rax,(%r12,%rbp,8)
mov    0x18(%rsp),%rax
mov    (%rax,%rbp,8),%rdi
test   %rdi,%rdi
je     13d3 <tail_minus+0x223>
mov    %rax,%r12
mov    %r14,%rsi
mov    $0x402,%edx
call   1030 <strncpy@plt>
addq   $0x1,0x8(%rsp)
mov    0x10(%rsp),%r13
jmp    12d1 <tail_minus+0x121>
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rbp,8),%rdi
mov    %r14,%rsi
mov    $0x402,%edx
call   1030 <strncpy@plt>
add    $0x1,%ebx
cmp    %r13,%rbx
jb     1230 <tail_minus+0x80>
mov    %ebx,%eax
xor    %edx,%edx
div    %r13d
mov    %edx,%ebx
jmp    1230 <tail_minus+0x80>
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
lea    0xd05(%rip),%rsi
lea    0xd0f(%rip),%rdx
mov    $0x86,%ecx
call   10b0 <fprintf@plt>
lea    0xd89(%rip),%rdi
jmp    133d <tail_minus+0x18d>
mov    0x2cc4(%rip),%rax
mov    (%rax),%edi
lea    0xcdb(%rip),%rsi
lea    0xce5(%rip),%rdx
mov    $0x8c,%ecx
call   10b0 <fprintf@plt>
lea    0xd6e(%rip),%rdi
call   1040 <print_error@plt>
mov    0x2c8f(%rip),%rax
movq   $0x0,(%rax)
mov    $0xffffffff,%ebx
lea    0x18(%rsp),%rdi
mov    %r13,%rsi
call   10d0 <free_2d_array@plt>
mov    %ebx,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsp),%r15
test   %r15,%r15
je     140a <tail_minus+0x25a>
mov    %r13,%r14
mov    $0x1,%ebp
lea    0xd45(%rip),%r13
jmp    13ba <tail_minus+0x20a>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,8),%rsi
mov    %r13,%rdi
call   1060 <printf@plt>
add    $0x1,%rbx
mov    %ebp,%eax
add    $0x1,%ebp
cmp    %rax,%r15
jbe    13cc <tail_minus+0x21c>
mov    %ebx,%ebx
cmp    %r15,%rbx
jb     13a0 <tail_minus+0x1f0>
mov    %ebx,%eax
xor    %edx,%edx
div    %r15d
mov    %edx,%ebx
jmp    13a0 <tail_minus+0x1f0>
xor    %ebx,%ebx
mov    %r14,%r13
jmp    1355 <tail_minus+0x1a5>
mov    0x2c06(%rip),%rax
mov    (%rax),%edi
lea    0xc1d(%rip),%rsi
lea    0xc27(%rip),%rdx
mov    $0x94,%ecx
call   10b0 <fprintf@plt>
lea    0xca1(%rip),%rdi
call   1040 <print_error@plt>
mov    0x10(%rsp),%r13
jmp    1342 <tail_minus+0x192>
xor    %ebx,%ebx
jmp    1355 <tail_minus+0x1a5>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"[ERROR] (%s:%d) \00"
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mkollaro/c_snippets/refs/heads/master/src/tail.c\00"
@.str.2 = [15 x i8] c"Out of memory.\00"
@errno = global i64 0
@.str.3 = [45 x i8] c"Line too long (longer lines not implemented)\00"
@.str.4 = [3 x i8] c"%s\00"
define i32 @tail_minus(i32* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i64
%6 = alloca [1026 x i8]
%7 = alloca i64
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %4
store i64 %1, i64* %5
%11 = bitcast [1026 x i8]* %6 to i8*
store i64 0, i64* %7
%12 = load i64, i64* %5
%13 = call i64 @calloc(i64 %12, i32 8)
%14 = inttoptr i64 %13 to i8**
store i8** %14, i8*** %8
%15 = load i8**, i8*** %8
%16 = icmp ne i8** %15, null
br i1 %16, label %21, label %17
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 134)
%20 = call i32 @print_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i64 0, i64* @errno
br label %120
21: ; preds = %2
store i32 0, i32* %9
br label %22
22: ; preds = %86, %21
%23 = getelementptr inbounds [1026 x i8], [1026 x i8]* %6, i64 0, i64 0
%24 = load i32*, i32** %4
%25 = call i32* @fgets(i8* %23, i32 1026, i32* %24)
%26 = icmp ne i32* %25, null
br i1 %26, label %27, label %94
27: ; preds = %22
%28 = getelementptr inbounds [1026 x i8], [1026 x i8]* %6, i64 0, i64 0
%29 = call i32 @strlen(i8* %28)
%30 = icmp sge i32 %29, 1025
br i1 %30, label %31, label %40
31: ; preds = %27
%32 = getelementptr inbounds [1026 x i8], [1026 x i8]* %6, i64 0, i64 1024
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 10
br i1 %35, label %36, label %40
36: ; preds = %31
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 140)
%39 = call i32 @print_error(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
store i64 0, i64* @errno
br label %120
40: ; preds = %31, %27
%41 = load i64, i64* %5
%42 = load i64, i64* %7
%43 = icmp ugt i64 %41, %42
br i1 %43, label %44, label %77
44: ; preds = %40
%45 = load i32, i32* %9
%46 = zext i32 %45 to i64
%47 = load i64, i64* %5
%48 = icmp ule i64 %46, %47
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = call i64 @malloc(i32 1026)
%52 = inttoptr i64 %51 to i8*
%53 = load i8**, i8*** %8
%54 = load i32, i32* %9
%55 = zext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
store i8* %52, i8** %56
%57 = load i8**, i8*** %8
%58 = load i32, i32* %9
%59 = zext i32 %58 to i64
%60 = getelementptr inbounds i8*, i8** %57, i64 %59
%61 = load i8*, i8** %60
%62 = icmp ne i8* %61, null
br i1 %62, label %67, label %63
63: ; preds = %44
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 148)
%66 = call i32 @print_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i64 0, i64* @errno
br label %120
67: ; preds = %44
%68 = load i8**, i8*** %8
%69 = load i32, i32* %9
%70 = zext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %68, i64 %70
%72 = load i8*, i8** %71
%73 = getelementptr inbounds [1026 x i8], [1026 x i8]* %6, i64 0, i64 0
%74 = call i32 @strncpy(i8* %72, i8* %73, i32 1026)
%75 = load i64, i64* %7
%76 = add i64 %75, 1
store i64 %76, i64* %7
br label %85
77: ; preds = %40
%78 = load i8**, i8*** %8
%79 = load i32, i32* %9
%80 = zext i32 %79 to i64
%81 = getelementptr inbounds i8*, i8** %78, i64 %80
%82 = load i8*, i8** %81
%83 = getelementptr inbounds [1026 x i8], [1026 x i8]* %6, i64 0, i64 0
%84 = call i32 @strncpy(i8* %82, i8* %83, i32 1026)
br label %85
85: ; preds = %77, %67
br label %86
86: ; preds = %85
%87 = load i32, i32* %9
%88 = add i32 %87, 1
store i32 %88, i32* %9
%89 = load i32, i32* %9
%90 = zext i32 %89 to i64
%91 = load i64, i64* %5
%92 = urem i64 %90, %91
%93 = trunc i64 %92 to i32
store i32 %93, i32* %9
br label %22
94: ; preds = %22
store i32 0, i32* %10
br label %95
95: ; preds = %112, %94
%96 = load i32, i32* %10
%97 = zext i32 %96 to i64
%98 = load i64, i64* %7
%99 = icmp ult i64 %97, %98
br i1 %99, label %100, label %117
100: ; preds = %95
%101 = load i32, i32* %9
%102 = zext i32 %101 to i64
%103 = load i64, i64* %7
%104 = urem i64 %102, %103
%105 = trunc i64 %104 to i32
store i32 %105, i32* %9
%106 = load i8**, i8*** %8
%107 = load i32, i32* %9
%108 = zext i32 %107 to i64
%109 = getelementptr inbounds i8*, i8** %106, i64 %108
%110 = load i8*, i8** %109
%111 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %110)
br label %112
112: ; preds = %100
%113 = load i32, i32* %9
%114 = add i32 %113, 1
store i32 %114, i32* %9
%115 = load i32, i32* %10
%116 = add i32 %115, 1
store i32 %116, i32* %10
br label %95
117: ; preds = %95
%118 = load i64, i64* %5
%119 = call i32 @free_2d_array(i8*** %8, i64 %118)
store i32 0, i32* %3
br label %123
120: ; preds = %63, %36, %17
%121 = load i64, i64* %5
%122 = call i32 @free_2d_array(i8*** %8, i64 %121)
store i32 -1, i32* %3
br label %123
123: ; preds = %120, %117
%124 = load i32, i32* %3
ret i32 %124
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"[ERROR] (%s:%d) \00"
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mkollaro/c_snippets/refs/heads/master/src/tail.c\00"
@.str.2 = [15 x i8] c"Out of memory.\00"
@errno = global i64 0
@.str.3 = [45 x i8] c"Line too long (longer lines not implemented)\00"
@.str.4 = [3 x i8] c"%s\00"
define i32 @tail_minus(i32* nocapture %0, i64 %1) {
%3 = alloca [1026 x i8]
%4 = alloca i8**
%5 = getelementptr inbounds [1026 x i8], [1026 x i8]* %3, i64 0, i64 0
%6 = bitcast i8*** %4 to i8*
%7 = tail call i64 @calloc(i64 %1, i32 8)
%8 = inttoptr i64 %7 to i8**
store i8** %8, i8*** %4
%9 = icmp eq i64 %7, 0
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = call i32* @fgets(i8* %5, i32 1026, i32* %0)
%12 = icmp eq i32* %11, null
br i1 %12, label %81, label %13
13: ; preds = %10
%14 = getelementptr inbounds [1026 x i8], [1026 x i8]* %3, i64 0, i64 1024
br label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 134)
%18 = tail call i32 @print_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %80
19: ; preds = %59
%20 = icmp eq i64 %61, 0
br i1 %20, label %81, label %68
21: ; preds = %13, %59
%22 = phi i8** [ %8, %13 ], [ %60, %59 ]
%23 = phi i32 [ 0, %13 ], [ %65, %59 ]
%24 = phi i64 [ 0, %13 ], [ %61, %59 ]
%25 = call i32 @strlen(i8* %5)
%26 = icmp sgt i32 %25, 1024
%27 = load i8, i8* %14
%28 = icmp ne i8 %27, 10
%29 = select i1 %26, i1 %28, i1 false
br i1 %29, label %30, label %34
30: ; preds = %21
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 140)
%33 = call i32 @print_error(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %80
34: ; preds = %21
%35 = icmp ult i64 %24, %1
%36 = zext i32 %23 to i64
br i1 %35, label %37, label %55
37: ; preds = %34
%38 = icmp ule i64 %36, %1
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = call i64 @malloc(i32 1026)
%42 = inttoptr i64 %41 to i8*
%43 = getelementptr inbounds i8*, i8** %22, i64 %36
store i8* %42, i8** %43
%44 = load i8**, i8*** %4
%45 = getelementptr inbounds i8*, i8** %44, i64 %36
%46 = load i8*, i8** %45
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %52
48: ; preds = %37
%49 = load i32, i32* @stderr
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 148)
%51 = call i32 @print_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %80
52: ; preds = %37
%53 = call i32 @strncpy(i8* %46, i8* %5, i32 1026)
%54 = add nuw i64 %24, 1
br label %59
55: ; preds = %34
%56 = getelementptr inbounds i8*, i8** %22, i64 %36
%57 = load i8*, i8** %56
%58 = call i32 @strncpy(i8* %57, i8* %5, i32 1026)
br label %59
59: ; preds = %52, %55
%60 = phi i8** [ %44, %52 ], [ %22, %55 ]
%61 = phi i64 [ %54, %52 ], [ %24, %55 ]
%62 = add i32 %23, 1
%63 = zext i32 %62 to i64
%64 = urem i64 %63, %1
%65 = trunc i64 %64 to i32
%66 = call i32* @fgets(i8* %5, i32 1026, i32* %0)
%67 = icmp eq i32* %66, null
br i1 %67, label %19, label %21
68: ; preds = %19, %68
%69 = phi i32 [ %77, %68 ], [ 0, %19 ]
%70 = phi i64 [ %76, %68 ], [ %64, %19 ]
%71 = and i64 %70, 4294967295
%72 = urem i64 %71, %61
%73 = getelementptr inbounds i8*, i8** %60, i64 %72
%74 = load i8*, i8** %73
%75 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %74)
%76 = add nuw nsw i64 %72, 1
%77 = add i32 %69, 1
%78 = zext i32 %77 to i64
%79 = icmp ugt i64 %61, %78
br i1 %79, label %68, label %81
80: ; preds = %48, %30, %15
store i64 0, i64* @errno
br label %81
81: ; preds = %68, %19, %10, %80
%82 = phi i32 [ -1, %80 ], [ 0, %10 ], [ 0, %19 ], [ 0, %68 ]
%83 = call i32 @free_2d_array(i8*** %4, i64 %1)
ret i32 %82
}