#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, unsigned long,
                         int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, char *, unsigned long *);
int /*<<< orphan*/ strcmp(char *, char *);
int generateFasta(char sourceFasta[100], char indexFasta[100],
                  char outputFasta[100], char bedFile[100], int width) {
  FILE *file;
  FILE *fasta;
  FILE *outputFile;
  char buffer[256];
  int k;
  int i;
  int chroLength;
  char caps[100][100];
  unsigned long temp[100];
  unsigned long rats, line;
  char chro[100];
  unsigned long summit, start;
  char output[2000];
  file = fopen(indexFasta, "r");
  fasta = fopen(sourceFasta, "r");
  k = 0;
  while (fgets(buffer, 100, file)) {
    sscanf(buffer, "%s\t%lu", caps[k], &temp[k]);
    k++;
  }
  fclose(file);
  chroLength = k;
  outputFile = fopen(outputFasta, "w");
  file = fopen(bedFile, "r");
  while (fgets(buffer, 256, file)) {
    sscanf(buffer, "%s\t%lu", chro, &summit);
    start = summit;
    for (i = 0; i < chroLength; i++) {
      if (!strcmp(caps[i], chro)) {
        line = start / 50;
        rats = start + temp[i] + line;
        fseek(fasta, rats, SEEK_SET);
        fprintf(outputFile, ">%s:%lu-%lu\n", chro, start, start + width);
        for (k = 0; k < width; k++) {
          fread(buffer, 1, 1, fasta);
          if (buffer[0] == '\n')
            k--;
          else
            fprintf(outputFile, "%c", buffer[0]);
        }
        fprintf(outputFile, "\n");
      }
    }
  }
  fclose(outputFile);
  fclose(file);
  fclose(fasta);
  return 0;
}


x86 assembly (clang, -O0):
<generateFasta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x33e0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe42(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x144(%rbp)
lea    -0x140(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x64,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1241 <generateFasta+0xc1>
lea    -0x140(%rbp),%rdi
movslq -0x144(%rbp),%rax
lea    -0x2860(%rbp),%rdx
imul   $0x64,%rax,%rax
add    %rax,%rdx
movslq -0x144(%rbp),%rax
lea    -0x2b80(%rbp),%rcx
shl    $0x3,%rax
add    %rax,%rcx
lea    0xdda(%rip),%rsi
call   1080 <sscanf@plt>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    11d1 <generateFasta+0x51>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x144(%rbp),%eax
mov    %eax,-0x14c(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xda8(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xd8b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
lea    -0x140(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x100,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     144b <generateFasta+0x2cb>
lea    -0x140(%rbp),%rdi
lea    -0x2c00(%rbp),%rdx
lea    0xd50(%rip),%rsi
lea    -0x2c08(%rbp),%rcx
call   1080 <sscanf@plt>
mov    -0x2c08(%rbp),%rax
mov    %rax,-0x2c10(%rbp)
movl   $0x0,-0x148(%rbp)
mov    -0x148(%rbp),%eax
cmp    -0x14c(%rbp),%eax
jge    1446 <generateFasta+0x2c6>
movslq -0x148(%rbp),%rax
lea    -0x2860(%rbp),%rdi
imul   $0x64,%rax,%rax
add    %rax,%rdi
lea    -0x2c00(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    142d <generateFasta+0x2ad>
mov    -0x2c10(%rbp),%rax
mov    $0x32,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x2b90(%rbp)
mov    -0x2c10(%rbp),%rax
movslq -0x148(%rbp),%rcx
add    -0x2b80(%rbp,%rcx,8),%rax
ff
add    -0x2b90(%rbp),%rax
mov    %rax,-0x2b88(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x2b88(%rbp),%rsi
mov    0x2c80(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
mov    -0x40(%rbp),%rdi
lea    -0x2c00(%rbp),%rdx
mov    -0x2c10(%rbp),%rcx
mov    -0x2c10(%rbp),%r8
movslq -0x24(%rbp),%rax
add    %rax,%r8
lea    0xc7d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x144(%rbp)
mov    -0x144(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    141b <generateFasta+0x29b>
lea    -0x140(%rbp),%rdi
mov    -0x38(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movsbl -0x140(%rbp),%eax
cmp    $0xa,%eax
jne    13e9 <generateFasta+0x269>
mov    -0x144(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x144(%rbp)
jmp    1402 <generateFasta+0x282>
mov    -0x40(%rbp),%rdi
movsbl -0x140(%rbp),%edx
lea    0xc1d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1407 <generateFasta+0x287>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    139f <generateFasta+0x21f>
mov    -0x40(%rbp),%rdi
lea    0xbf0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1432 <generateFasta+0x2b2>
mov    -0x148(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x148(%rbp)
jmp    12d6 <generateFasta+0x156>
jmp    127e <generateFasta+0xfe>
mov    -0x40(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x33e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateFasta>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2be8,%rsp
mov    %r8d,%ebp
mov    %rcx,0x10(%rsp)
mov    %rdx,0x8(%rsp)
mov    %rdi,%rbx
lea    0xe48(%rip),%r14
mov    %rsi,%rdi
mov    %r14,%rsi
call   10b0 <fopen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbx
lea    0xb0(%rsp),%rdi
mov    $0x64,%esi
mov    %r15,%r14
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
mov    %r15,(%rsp)
je     1251 <generateFasta+0xc1>
lea    0x1b0(%rsp),%r13
lea    0x4d0(%rsp),%r15
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
lea    0xb0(%rsp),%r14
mov    %r14,%rdi
lea    0xde0(%rip),%rsi
mov    %r15,%rdx
mov    %r13,%rcx
call   1090 <sscanf@plt>
mov    %r14,%rdi
mov    $0x64,%esi
mov    (%rsp),%rdx
call   1060 <fgets@plt>
add    $0x8,%r13
add    $0x64,%r15
add    $0x1,%r12d
test   %rax,%rax
jne    1210 <generateFasta+0x80>
jmp    1254 <generateFasta+0xc4>
xor    %r12d,%r12d
mov    (%rsp),%rdi
call   1040 <fclose@plt>
lea    0xda5(%rip),%rsi
mov    0x8(%rsp),%rdi
call   10b0 <fopen@plt>
mov    %rax,%r14
lea    0xd88(%rip),%rsi
mov    0x10(%rsp),%rdi
call   10b0 <fopen@plt>
lea    0xb0(%rsp),%rdi
mov    $0x100,%esi
mov    %rax,0x20(%rsp)
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     141d <generateFasta+0x28d>
movslq %ebp,%rax
mov    %rax,0x28(%rsp)
mov    %r12d,%r15d
lea    0xb0(%rsp),%r13
mov    %r12d,0x1c(%rsp)
mov    %r15,0x30(%rsp)
jmp    12f0 <generateFasta+0x160>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
mov    $0x100,%esi
mov    0x20(%rsp),%rdx
call   1060 <fgets@plt>
test   %rax,%rax
mov    0x1c(%rsp),%r12d
je     141d <generateFasta+0x28d>
mov    %r13,%rdi
lea    0xd08(%rip),%rsi
lea    0x40(%rsp),%rdx
lea    0x38(%rsp),%rcx
call   1090 <sscanf@plt>
test   %r12d,%r12d
je     12d0 <generateFasta+0x140>
mov    0x38(%rsp),%rsi
mov    %rsi,%rax
shr    %rax
movabs $0xa3d70a3d70a3d70b,%rcx
0a d7 a3
mul    %rcx
shr    $0x4,%rdx
add    %rsi,%rdx
mov    %rdx,0x10(%rsp)
mov    0x28(%rsp),%rax
mov    %rsi,(%rsp)
add    %rsi,%rax
mov    %rax,0x8(%rsp)
xor    %r12d,%r12d
jmp    136f <generateFasta+0x1df>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
mov    0x30(%rsp),%r15
add    $0x1,%r12
cmp    %r15,%r12
je     12d0 <generateFasta+0x140>
imul   $0x64,%r12,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x4d0,%rdi
lea    0x40(%rsp),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
jne    1362 <generateFasta+0x1d2>
mov    0x1b0(%rsp,%r12,8),%rsi
add    0x10(%rsp),%rsi
mov    0x2c40(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   10a0 <fseek@plt>
mov    %r14,%rdi
lea    0xc57(%rip),%rsi
lea    0x40(%rsp),%rdx
mov    (%rsp),%rcx
mov    0x8(%rsp),%r8
xor    %eax,%eax
call   1080 <fprintf@plt>
test   %ebp,%ebp
jle    1350 <generateFasta+0x1c0>
xor    %r15d,%r15d
jmp    13f5 <generateFasta+0x265>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rsi
call   1050 <fputc@plt>
add    $0x1,%r15d
cmp    %ebp,%r15d
jge    1350 <generateFasta+0x1c0>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
movsbl 0xb0(%rsp),%edi
cmp    $0xa,%edi
jne    13e0 <generateFasta+0x250>
add    $0xffffffff,%r15d
jmp    13e8 <generateFasta+0x258>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x2be8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [7 x i8] c"%s\09%lu\00"
@.str.2 = [2 x i8] c"w\00"
@SEEK_SET = global i32 0
@.str.3 = [13 x i8] c">%s:%lu-%lu\0A\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @generateFasta(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca [256 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca [100 x [100 x i8]]
%19 = alloca [100 x i64]
%20 = alloca i64
%21 = alloca i64
%22 = alloca [100 x i8]
%23 = alloca i64
%24 = alloca i64
%25 = alloca [2000 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%26 = load i8*, i8** %7
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %27, i32** %11
%28 = load i8*, i8** %6
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %29, i32** %12
store i32 0, i32* %15
br label %30
30: ; preds = %35, %5
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%32 = load i32*, i32** %11
%33 = call i64 @fgets(i8* %31, i32 100, i32* %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %47
35: ; preds = %30
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%37 = load i32, i32* %15
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %18, i64 0, i64 %38
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %39, i64 0, i64 0
%41 = load i32, i32* %15
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100 x i64], [100 x i64]* %19, i64 0, i64 %42
%44 = call i32 @sscanf(i8* %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %40, i64* %43)
%45 = load i32, i32* %15
%46 = add nsw i32 %45, 1
store i32 %46, i32* %15
br label %30
47: ; preds = %30
%48 = load i32*, i32** %11
%49 = call i32 @fclose(i32* %48)
%50 = load i32, i32* %15
store i32 %50, i32* %17
%51 = load i8*, i8** %8
%52 = call i32* @fopen(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %52, i32** %13
%53 = load i8*, i8** %9
%54 = call i32* @fopen(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %54, i32** %11
br label %55
55: ; preds = %132, %47
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%57 = load i32*, i32** %11
%58 = call i64 @fgets(i8* %56, i32 256, i32* %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %133
60: ; preds = %55
%61 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%62 = getelementptr inbounds [100 x i8], [100 x i8]* %22, i64 0, i64 0
%63 = call i32 @sscanf(i8* %61, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %62, i64* %23)
%64 = load i64, i64* %23
store i64 %64, i64* %24
store i32 0, i32* %16
br label %65
65: ; preds = %129, %60
%66 = load i32, i32* %16
%67 = load i32, i32* %17
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %132
69: ; preds = %65
%70 = load i32, i32* %16
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %18, i64 0, i64 %71
%73 = getelementptr inbounds [100 x i8], [100 x i8]* %72, i64 0, i64 0
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %22, i64 0, i64 0
%75 = call i32 @strcmp(i8* %73, i8* %74)
%76 = icmp ne i32 %75, 0
br i1 %76, label %128, label %77
77: ; preds = %69
%78 = load i64, i64* %24
%79 = udiv i64 %78, 50
store i64 %79, i64* %21
%80 = load i64, i64* %24
%81 = load i32, i32* %16
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [100 x i64], [100 x i64]* %19, i64 0, i64 %82
%84 = load i64, i64* %83
%85 = add i64 %80, %84
%86 = load i64, i64* %21
%87 = add i64 %85, %86
store i64 %87, i64* %20
%88 = load i32*, i32** %12
%89 = load i64, i64* %20
%90 = load i32, i32* @SEEK_SET
%91 = call i32 @fseek(i32* %88, i64 %89, i32 %90)
%92 = load i32*, i32** %13
%93 = getelementptr inbounds [100 x i8], [100 x i8]* %22, i64 0, i64 0
%94 = load i64, i64* %24
%95 = load i64, i64* %24
%96 = load i32, i32* %10
%97 = sext i32 %96 to i64
%98 = add i64 %95, %97
%99 = call i32 (i32*, i8*, ...) @fprintf(i32* %92, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %93, i64 %94, i64 %98)
store i32 0, i32* %15
br label %100
100: ; preds = %122, %77
%101 = load i32, i32* %15
%102 = load i32, i32* %10
%103 = icmp slt i32 %101, %102
br i1 %103, label %104, label %125
104: ; preds = %100
%105 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%106 = load i32*, i32** %12
%107 = call i32 @fread(i8* %105, i32 1, i32 1, i32* %106)
%108 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%109 = load i8, i8* %108
%110 = sext i8 %109 to i32
%111 = icmp eq i32 %110, 10
br i1 %111, label %112, label %115
112: ; preds = %104
%113 = load i32, i32* %15
%114 = add nsw i32 %113, -1
store i32 %114, i32* %15
br label %121
115: ; preds = %104
%116 = load i32*, i32** %13
%117 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%118 = load i8, i8* %117
%119 = sext i8 %118 to i32
%120 = call i32 (i32*, i8*, ...) @fprintf(i32* %116, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %119)
br label %121
121: ; preds = %115, %112
br label %122
122: ; preds = %121
%123 = load i32, i32* %15
%124 = add nsw i32 %123, 1
store i32 %124, i32* %15
br label %100
125: ; preds = %100
%126 = load i32*, i32** %13
%127 = call i32 (i32*, i8*, ...) @fprintf(i32* %126, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %128
128: ; preds = %125, %69
br label %129
129: ; preds = %128
%130 = load i32, i32* %16
%131 = add nsw i32 %130, 1
store i32 %131, i32* %16
br label %65
132: ; preds = %65
br label %55
133: ; preds = %55
%134 = load i32*, i32** %13
%135 = call i32 @fclose(i32* %134)
%136 = load i32*, i32** %11
%137 = call i32 @fclose(i32* %136)
%138 = load i32*, i32** %12
%139 = call i32 @fclose(i32* %138)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [7 x i8] c"%s\09%lu\00"
@.str.2 = [2 x i8] c"w\00"
@SEEK_SET = global i32 0
@.str.3 = [13 x i8] c">%s:%lu-%lu\0A\00"
define i32 @generateFasta(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2, i8* nocapture %3, i32 %4) {
%6 = alloca [256 x i8]
%7 = alloca [100 x [100 x i8]]
%8 = alloca [100 x i64]
%9 = alloca [100 x i8]
%10 = alloca i64
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %7, i64 0, i64 0, i64 0
%13 = bitcast [100 x i64]* %8 to i8*
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%15 = bitcast i64* %10 to i8*
%16 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = call i64 @fgets(i8* %11, i32 100, i32* %16)
%19 = icmp eq i64 %18, 0
br i1 %19, label %30, label %20
20: ; preds = %5, %20
%21 = phi i64 [ %25, %20 ], [ 0, %5 ]
%22 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %7, i64 0, i64 %21, i64 0
%23 = getelementptr inbounds [100 x i64], [100 x i64]* %8, i64 0, i64 %21
%24 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %22, i64* %23)
%25 = add nuw i64 %21, 1
%26 = call i64 @fgets(i8* %11, i32 100, i32* %16)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %20
28: ; preds = %20
%29 = trunc i64 %25 to i32
br label %30
30: ; preds = %28, %5
%31 = phi i32 [ 0, %5 ], [ %29, %28 ]
%32 = call i32 @fclose(i32* %16)
%33 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32* @fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%35 = call i64 @fgets(i8* %11, i32 256, i32* %34)
%36 = icmp eq i64 %35, 0
br i1 %36, label %83, label %37
37: ; preds = %30
%38 = icmp eq i32 %31, 0
%39 = sext i32 %4 to i64
%40 = icmp sgt i32 %4, 0
%41 = zext i32 %31 to i64
br label %45
42: ; preds = %80, %45
%43 = call i64 @fgets(i8* %11, i32 256, i32* %34)
%44 = icmp eq i64 %43, 0
br i1 %44, label %83, label %45
45: ; preds = %37, %42
%46 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %14, i64* %10)
%47 = load i64, i64* %10
br i1 %38, label %42, label %48
48: ; preds = %45
%49 = udiv i64 %47, 50
%50 = add i64 %49, %47
%51 = add i64 %47, %39
br label %52
52: ; preds = %48, %80
%53 = phi i64 [ 0, %48 ], [ %81, %80 ]
%54 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %7, i64 0, i64 %53, i64 0
%55 = call i32 @strcmp(i8* %54, i8* %14)
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %80
57: ; preds = %52
%58 = getelementptr inbounds [100 x i64], [100 x i64]* %8, i64 0, i64 %53
%59 = load i64, i64* %58
%60 = add i64 %50, %59
%61 = load i32, i32* @SEEK_SET
%62 = call i32 @fseek(i32* %17, i64 %60, i32 %61)
%63 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %14, i64 %47, i64 %51)
br i1 %40, label %64, label %78
64: ; preds = %57, %74
%65 = phi i32 [ %76, %74 ], [ 0, %57 ]
%66 = call i32 @fread(i8* %11, i32 1, i32 1, i32* %17)
%67 = load i8, i8* %11
%68 = icmp eq i8 %67, 10
br i1 %68, label %69, label %71
69: ; preds = %64
%70 = add nsw i32 %65, -1
br label %74
71: ; preds = %64
%72 = sext i8 %67 to i32
%73 = call i32 @fputc(i32 %72, i32* %33)
br label %74
74: ; preds = %69, %71
%75 = phi i32 [ %70, %69 ], [ %65, %71 ]
%76 = add nsw i32 %75, 1
%77 = icmp slt i32 %76, %4
br i1 %77, label %64, label %78
78: ; preds = %74, %57
%79 = call i32 @fputc(i32 10, i32* %33)
br label %80
80: ; preds = %52, %78
%81 = add nuw nsw i64 %53, 1
%82 = icmp eq i64 %81, %41
br i1 %82, label %42, label %52
83: ; preds = %42, %30
%84 = call i32 @fclose(i32* %33)
%85 = call i32 @fclose(i32* %34)
%86 = call i32 @fclose(i32* %17)
ret i32 0
}