#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 */
struct stat {
  size_t st_size;
};
typedef int /*<<< orphan*/ memtable_name;
typedef int /*<<< orphan*/ memfile_name;
typedef int /*<<< orphan*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
size_t atol(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ fread(char *, size_t, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, size_t, int /*<<< orphan*/);
char *malloc(size_t);
int /*<<< orphan*/ printf(char *, size_t, size_t, size_t);
int /*<<< orphan*/ show_strings(char *, size_t, size_t);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int sscanf(char *, char *, size_t *, size_t *, char *);
int /*<<< orphan*/ stat(char const *, struct stat *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 3) {
    fprintf(stderr, "usage: %s size_in_bytes min_string_size\n", argv[0]);
    exit(1);
  }
  size_t min_size = atol(argv[2]);
  const char *fname = argv[1];
  FILE *f = fopen(fname, "r");
  if (f) {
    struct stat sb;
    stat(fname, &sb);
    size_t size = sb.st_size;
    char *mem = malloc(size);
    fread(mem, size, 1, f);
    fclose(f);
    show_strings(mem, size, min_size);
    free(mem);
  } else {
    fprintf(stderr, "Failed to open `%s'. Assuming proc request.\n", fname);
    char memtable_name[64];
    char memfile_name[64];
    snprintf(memtable_name, sizeof(memtable_name), "/proc/%s/maps", argv[1]);
    snprintf(memfile_name, sizeof(memfile_name), "/proc/%s/mem", argv[1]);
    FILE *memtable = fopen(memtable_name, "r");
    if (!memtable) {
      fprintf(stderr,
              "Failed to open `%s'. Don't know what to do with request.\n",
              memtable_name);
      exit(1);
    }
    FILE *memfile = fopen(memfile_name, "r");
    if (!memfile) {
      fprintf(stderr, "Couldn't open `%s'. Do you have permissions?\n",
              memfile_name);
      exit(1);
    }
    char line[256];
    while (fgets(line, sizeof(line), memtable)) {
      size_t start;
      size_t end;
      char p;
      if (sscanf(line, "%08x-%08x %c", &start, &end, &p) == 3) {
        size_t size = end - start;
        printf("Searching %08x-%08x (%lu bytes)\n", start, end, size);
        char *mem = malloc(size);
        fseek(memfile, start, SEEK_SET);
        fread(mem, size, 1, memfile);
        show_strings(mem, size, min_size);
        free(mem);
      }
    }
    fclose(memfile);
    fclose(memtable);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1239 <main+0x49>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd6(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10f0 <atol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdc8(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12d5 <main+0xe5>
mov    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   10a0 <stat@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x28(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10d0 <show_strings@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
jmp    14dd <main+0x2ed>
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xd42(%rip),%rsi
call   1090 <fprintf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    $0x40,%esi
lea    0xd52(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0xc0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    $0x40,%esi
lea    0xd40(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0x80(%rbp),%rdi
lea    0xcf3(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0xc8(%rbp)
cmpq   $0x0,-0xc8(%rbp)
jne    1373 <main+0x183>
mov    0x2c89(%rip),%rax
mov    (%rax),%edi
lea    -0x80(%rbp),%rdx
lea    0xd0f(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0xc0(%rbp),%rdi
lea    0xca8(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0xd0(%rbp)
cmpq   $0x0,-0xd0(%rbp)
jne    13c1 <main+0x1d1>
mov    0x2c3e(%rip),%rax
mov    (%rax),%edi
lea    -0xc0(%rbp),%rdx
lea    0xcfb(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    13c6 <main+0x1d6>
lea    -0x1d0(%rbp),%rdi
mov    -0xc8(%rbp),%rdx
mov    $0x100,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     14c5 <main+0x2d5>
lea    -0x1d0(%rbp),%rdi
lea    0xce5(%rip),%rsi
lea    -0x1d8(%rbp),%rdx
lea    -0x1e0(%rbp),%rcx
lea    -0x1e1(%rbp),%r8
call   10c0 <sscanf@plt>
cmp    $0x3,%eax
jne    14c0 <main+0x2d0>
mov    -0x1e0(%rbp),%rax
sub    -0x1d8(%rbp),%rax
mov    %rax,-0x1f0(%rbp)
mov    -0x1d8(%rbp),%rsi
mov    -0x1e0(%rbp),%rdx
mov    -0x1f0(%rbp),%rcx
lea    0xc9e(%rip),%rdi
call   1060 <printf@plt>
mov    -0x1f0(%rbp),%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x1f8(%rbp)
mov    -0xd0(%rbp),%rdi
mov    -0x1d8(%rbp),%rsi
mov    0x2b61(%rip),%rax
mov    (%rax),%edx
call   10e0 <fseek@plt>
mov    -0x1f8(%rbp),%rdi
mov    -0x1f0(%rbp),%rsi
mov    -0xd0(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
mov    -0x1f8(%rbp),%rdi
mov    -0x1f0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10d0 <show_strings@plt>
mov    -0x1f8(%rbp),%rdi
call   1030 <free@plt>
jmp    13c6 <main+0x1d6>
mov    -0xd0(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0xc8(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1b8,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
jne    1450 <main+0x260>
mov    0x10(%r14),%rdi
call   10f0 <atol@plt>
mov    %rax,%r12
mov    0x8(%r14),%rbx
lea    0xe05(%rip),%rsi
mov    %rbx,%rdi
call   1100 <fopen@plt>
test   %rax,%rax
je     128d <main+0x9d>
mov    %rax,%rbp
lea    0xb0(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <stat@plt>
mov    0xb0(%rsp),%rbx
mov    %rbx,%rdi
call   10b0 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1040 <fread@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   10d0 <show_strings@plt>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    143c <main+0x24c>
mov    0x2d4c(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xd8d(%rip),%rsi
mov    %rbx,%rdx
call   1090 <fprintf@plt>
mov    0x8(%r14),%rcx
lea    0xda7(%rip),%rdx
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
call   1070 <snprintf@plt>
mov    0x8(%r14),%rcx
lea    0xd98(%rip),%rdx
lea    0x30(%rsp),%rdi
mov    $0x40,%esi
call   1070 <snprintf@plt>
lea    0xd45(%rip),%rsi
mov    %rbx,%rdi
call   1100 <fopen@plt>
test   %rax,%rax
je     1465 <main+0x275>
mov    %rax,%r15
mov    %r12,0x20(%rsp)
lea    0xd25(%rip),%rsi
lea    0x30(%rsp),%rdi
call   1100 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     1476 <main+0x286>
lea    0xb0(%rsp),%rdi
mov    $0x100,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     142a <main+0x23a>
lea    0xd9a(%rip),%rbx
lea    0xb0(%rsp),%r12
lea    0x10(%rsp),%r14
lea    0x28(%rsp),%r13
lea    0x7(%rsp),%rbp
mov    %r15,0x18(%rsp)
jmp    1379 <main+0x189>
nop
mov    %r12,%rdi
mov    $0x100,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     142a <main+0x23a>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
call   10c0 <sscanf@plt>
cmp    $0x3,%eax
jne    1360 <main+0x170>
mov    0x28(%rsp),%rdx
mov    0x10(%rsp),%rsi
mov    %rdx,%rbp
sub    %rsi,%rbp
lea    0xd3f(%rip),%rdi
mov    %rbp,%rcx
call   1060 <printf@plt>
mov    %rbp,%rdi
call   10b0 <malloc@plt>
mov    %r14,%r15
mov    %rax,%r14
mov    0x10(%rsp),%rsi
mov    0x2c0d(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rbx
mov    %r12,%r13
mov    0x8(%rsp),%r12
mov    %r12,%rdi
call   10e0 <fseek@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x1,%edx
mov    %r12,%rcx
mov    %r13,%r12
mov    %rbx,%r13
call   1040 <fread@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
lea    0x7(%rsp),%rbp
mov    0x20(%rsp),%rdx
call   10d0 <show_strings@plt>
mov    %r14,%rdi
mov    %r15,%r14
mov    0x18(%rsp),%r15
lea    0xcbb(%rip),%rbx
call   1030 <free@plt>
jmp    1360 <main+0x170>
mov    0x8(%rsp),%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x1b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b89(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xb9d(%rip),%rsi
jmp    1485 <main+0x295>
mov    0x0(%rbp),%edi
lea    0xc04(%rip),%rsi
lea    0x70(%rsp),%rdx
jmp    1485 <main+0x295>
mov    0x0(%rbp),%edi
lea    0xc2d(%rip),%rsi
lea    0x30(%rsp),%rdx
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i64 }
@stderr = global i32 0
@.str = [41 x i8] c"usage: %s size_in_bytes min_string_size\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [45 x i8] c"Failed to open `%s'. Assuming proc request.\0A\00"
@.str.3 = [14 x i8] c"/proc/%s/maps\00"
@.str.4 = [13 x i8] c"/proc/%s/mem\00"
@.str.5 = [58 x i8] c"Failed to open `%s'. Don't know what to do with request.\0A\00"
@.str.6 = [46 x i8] c"Couldn't open `%s'. Do you have permissions?\0A\00"
@.str.7 = [13 x i8] c"%08x-%08x %c\00"
@.str.8 = [33 x i8] c"Searching %08x-%08x (%lu bytes)\0A\00"
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca %struct.stat
%10 = alloca i64
%11 = alloca i8*
%12 = alloca [64 x i8]
%13 = alloca [64 x i8]
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca [256 x i8]
%17 = alloca i64
%18 = alloca i64
%19 = alloca i8
%20 = alloca i64
%21 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 3
br i1 %23, label %24, label %31
24: ; preds = %2
%25 = load i32, i32* @stderr
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %2
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = call i64 @atol(i8* %34)
store i64 %35, i64* %6
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
store i8* %38, i8** %7
%39 = load i8*, i8** %7
%40 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %40, i32** %8
%41 = load i32*, i32** %8
%42 = icmp ne i32* %41, null
br i1 %42, label %43, label %62
43: ; preds = %31
%44 = load i8*, i8** %7
%45 = call i32 @stat(i8* %44, %struct.stat* %9)
%46 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%47 = load i64, i64* %46
store i64 %47, i64* %10
%48 = load i64, i64* %10
%49 = call i8* @malloc(i64 %48)
store i8* %49, i8** %11
%50 = load i8*, i8** %11
%51 = load i64, i64* %10
%52 = load i32*, i32** %8
%53 = call i32 @fread(i8* %50, i64 %51, i32 1, i32* %52)
%54 = load i32*, i32** %8
%55 = call i32 @fclose(i32* %54)
%56 = load i8*, i8** %11
%57 = load i64, i64* %10
%58 = load i64, i64* %6
%59 = call i32 @show_strings(i8* %56, i64 %57, i64 %58)
%60 = load i8*, i8** %11
%61 = call i32 @free(i8* %60)
br label %135
62: ; preds = %31
%63 = load i32, i32* @stderr
%64 = load i8*, i8** %7
%65 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %64)
%66 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 1
%69 = load i8*, i8** %68
%70 = call i32 @snprintf(i8* %66, i32 64, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %69)
%71 = getelementptr inbounds [64 x i8], [64 x i8]* %13, i64 0, i64 0
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 1
%74 = load i8*, i8** %73
%75 = call i32 @snprintf(i8* %71, i32 64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %74)
%76 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%77 = call i32* @fopen(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %77, i32** %14
%78 = load i32*, i32** %14
%79 = icmp ne i32* %78, null
br i1 %79, label %85, label %80
80: ; preds = %62
%81 = load i32, i32* @stderr
%82 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%83 = call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.5, i64 0, i64 0), i8* %82)
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %62
%86 = getelementptr inbounds [64 x i8], [64 x i8]* %13, i64 0, i64 0
%87 = call i32* @fopen(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %87, i32** %15
%88 = load i32*, i32** %15
%89 = icmp ne i32* %88, null
br i1 %89, label %95, label %90
90: ; preds = %85
%91 = load i32, i32* @stderr
%92 = getelementptr inbounds [64 x i8], [64 x i8]* %13, i64 0, i64 0
%93 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i8* %92)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %85
br label %96
96: ; preds = %129, %95
%97 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%98 = load i32*, i32** %14
%99 = call i64 @fgets(i8* %97, i32 256, i32* %98)
%100 = icmp ne i64 %99, 0
br i1 %100, label %101, label %130
101: ; preds = %96
%102 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%103 = call i32 @sscanf(i8* %102, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i64* %17, i64* %18, i8* %19)
%104 = icmp eq i32 %103, 3
br i1 %104, label %105, label %129
105: ; preds = %101
%106 = load i64, i64* %18
%107 = load i64, i64* %17
%108 = sub i64 %106, %107
store i64 %108, i64* %20
%109 = load i64, i64* %17
%110 = load i64, i64* %18
%111 = load i64, i64* %20
%112 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i64 %109, i64 %110, i64 %111)
%113 = load i64, i64* %20
%114 = call i8* @malloc(i64 %113)
store i8* %114, i8** %21
%115 = load i32*, i32** %15
%116 = load i64, i64* %17
%117 = load i32, i32* @SEEK_SET
%118 = call i32 @fseek(i32* %115, i64 %116, i32 %117)
%119 = load i8*, i8** %21
%120 = load i64, i64* %20
%121 = load i32*, i32** %15
%122 = call i32 @fread(i8* %119, i64 %120, i32 1, i32* %121)
%123 = load i8*, i8** %21
%124 = load i64, i64* %20
%125 = load i64, i64* %6
%126 = call i32 @show_strings(i8* %123, i64 %124, i64 %125)
%127 = load i8*, i8** %21
%128 = call i32 @free(i8* %127)
br label %129
129: ; preds = %105, %101
br label %96
130: ; preds = %96
%131 = load i32*, i32** %15
%132 = call i32 @fclose(i32* %131)
%133 = load i32*, i32** %14
%134 = call i32 @fclose(i32* %133)
br label %135
135: ; preds = %130, %43
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@stderr = global i32 0
@.str = [41 x i8] c"usage: %s size_in_bytes min_string_size\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [45 x i8] c"Failed to open `%s'. Assuming proc request.\0A\00"
@.str.3 = [14 x i8] c"/proc/%s/maps\00"
@.str.4 = [13 x i8] c"/proc/%s/mem\00"
@.str.5 = [58 x i8] c"Failed to open `%s'. Don't know what to do with request.\0A\00"
@.str.6 = [46 x i8] c"Couldn't open `%s'. Do you have permissions?\0A\00"
@.str.7 = [13 x i8] c"%08x-%08x %c\00"
@.str.8 = [33 x i8] c"Searching %08x-%08x (%lu bytes)\0A\00"
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca [64 x i8]
%5 = alloca [64 x i8]
%6 = alloca [256 x i8]
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8
%10 = icmp eq i32 %0, 3
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %1
%14 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i64 @atol(i8* %18)
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %34, label %24
24: ; preds = %16
%25 = bitcast %struct.stat* %3 to i8*
%26 = call i32 @stat(i8* %21, %struct.stat* %3)
%27 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%28 = load i64, i64* %27
%29 = tail call i8* @malloc(i64 %28)
%30 = tail call i32 @fread(i8* %29, i64 %28, i32 1, i32* %22)
%31 = tail call i32 @fclose(i32* %22)
%32 = tail call i32 @show_strings(i8* %29, i64 %28, i64 %19)
%33 = tail call i32 @free(i8* %29)
br label %84
34: ; preds = %16
%35 = load i32, i32* @stderr
%36 = tail call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%37 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%38 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%39 = load i8*, i8** %20
%40 = call i32 @snprintf(i8* %37, i32 64, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %39)
%41 = load i8*, i8** %20
%42 = call i32 @snprintf(i8* %38, i32 64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %41)
%43 = call i32* @fopen(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %49
45: ; preds = %34
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.5, i64 0, i64 0), i8* %37)
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %34
%50 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%51 = icmp eq i32* %50, null
br i1 %51, label %52, label %56
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i8* %38)
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %49
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%58 = call i64 @fgets(i8* %57, i32 256, i32* %43)
%59 = icmp eq i64 %58, 0
br i1 %59, label %81, label %60
60: ; preds = %56
%61 = bitcast i64* %7 to i8*
%62 = bitcast i64* %8 to i8*
br label %63
63: ; preds = %60, %78
%64 = call i32 @sscanf(i8* %57, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i64* %7, i64* %8, i8* %9)
%65 = icmp eq i32 %64, 3
br i1 %65, label %66, label %78
66: ; preds = %63
%67 = load i64, i64* %8
%68 = load i64, i64* %7
%69 = sub i64 %67, %68
%70 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i64 %68, i64 %67, i64 %69)
%71 = call i8* @malloc(i64 %69)
%72 = load i64, i64* %7
%73 = load i32, i32* @SEEK_SET
%74 = call i32 @fseek(i32* %50, i64 %72, i32 %73)
%75 = call i32 @fread(i8* %71, i64 %69, i32 1, i32* %50)
%76 = call i32 @show_strings(i8* %71, i64 %69, i64 %19)
%77 = call i32 @free(i8* %71)
br label %78
78: ; preds = %66, %63
%79 = call i64 @fgets(i8* %57, i32 256, i32* %43)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %63
81: ; preds = %78, %56
%82 = call i32 @fclose(i32* %50)
%83 = call i32 @fclose(i32* %43)
br label %84
84: ; preds = %81, %24
ret i32 0
}