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

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int errno;
int getpid();
int /*<<< orphan*/ memmove(char *, char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int read(int, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int sscanf(char *, char *, size_t *, size_t *, char *, unsigned long long *,
           int *, int *, unsigned long long *, int *);
char *strdup(char *);
int /*<<< orphan*/ *strstr(char *, char *);
int parse_maps(char *libname, char **fullpath, void **base) {
  char name[100] = "";
  char maps[4096];
  int fd = 0, size = 0, rv = 0;
  int line = 0;
  snprintf(name, sizeof(name), "/proc/%i/maps", getpid());
  fd = open(name, O_RDONLY);
  if (fd < 0)
    return errno;
  do {
    rv = read(fd, &maps[size], 4096 - size);
    if (rv == -1) {
      perror("read");
      close(fd);
      return errno;
    }
    size += rv;
    line = 0;
    while (1) {
      size_t start, end;
      char flags[32];
      unsigned long long file_offset, inode;
      int dev_major, dev_minor;
      int line_end = line;
      int num, ptr;
      while (line_end < size && maps[line_end] != '\n')
        line_end++;
      if (line_end == size)
        break;
      maps[line_end] = 0;
      num = sscanf(&maps[line], "%zx-%zx %31s %Lx %x:%x %Lu %n", &start, &end,
                   flags, &file_offset, &dev_major, &dev_minor, &inode, &ptr);
      if (num == 7 && strstr(&maps[line + ptr], libname) != NULL) {
        *base = (void *)start - file_offset;
        *fullpath = strdup(&maps[line + ptr]);
        return 0;
      }
      line = line_end + 1;
    }
    memmove(maps, &maps[line], size - line);
    size = size - line;
    if (size == 4096)
      return 1;
  } while (rv != 0);
  close(fd);
  return 1;
}


x86 assembly (clang, -O0):
<parse_maps>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x1128,%rsp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movl   $0x0,-0x1094(%rbp)
movl   $0x0,-0x1098(%rbp)
movl   $0x0,-0x109c(%rbp)
movl   $0x0,-0x10a0(%rbp)
lea    -0x90(%rbp),%rax
mov    %rax,-0x1100(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x1100(%rbp),%rdi
mov    %eax,%ecx
mov    $0x64,%esi
lea    0xdd3(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x90(%rbp),%rdi
mov    0x2da8(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x1094(%rbp)
cmpl   $0x0,-0x1094(%rbp)
jge    126b <parse_maps+0xbb>
mov    0x2d77(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    14fe <parse_maps+0x34e>
jmp    1270 <parse_maps+0xc0>
mov    -0x1094(%rbp),%edi
movslq -0x1098(%rbp),%rax
lea    -0x1090(%rbp),%rsi
add    %rax,%rsi
mov    $0x1000,%edx
sub    -0x1098(%rbp),%edx
call   1070 <read@plt>
mov    %eax,-0x109c(%rbp)
cmpl   $0xffffffff,-0x109c(%rbp)
jne    12d2 <parse_maps+0x122>
lea    0xd5d(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x1094(%rbp),%edi
call   1060 <close@plt>
mov    0x2d10(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    14fe <parse_maps+0x34e>
mov    -0x109c(%rbp),%eax
add    -0x1098(%rbp),%eax
mov    %eax,-0x1098(%rbp)
movl   $0x0,-0x10a0(%rbp)
mov    -0x10a0(%rbp),%eax
mov    %eax,-0x10ec(%rbp)
mov    -0x10ec(%rbp),%ecx
xor    %eax,%eax
cmp    -0x1098(%rbp),%ecx
mov    %al,-0x1101(%rbp)
jge    132f <parse_maps+0x17f>
movslq -0x10ec(%rbp),%rax
movsbl -0x1090(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
setne  %al
mov    %al,-0x1101(%rbp)
mov    -0x1101(%rbp),%al
test   $0x1,%al
jne    1342 <parse_maps+0x192>
jmp    1356 <parse_maps+0x1a6>
mov    -0x10ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10ec(%rbp)
jmp    12fa <parse_maps+0x14a>
mov    -0x10ec(%rbp),%eax
cmp    -0x1098(%rbp),%eax
jne    136d <parse_maps+0x1bd>
jmp    1483 <parse_maps+0x2d3>
movslq -0x10ec(%rbp),%rax
movb   $0x0,-0x1090(%rbp,%rax,1)
movslq -0x10a0(%rbp),%rax
lea    -0x1090(%rbp),%rdi
add    %rax,%rdi
lea    -0x10d0(%rbp),%r8
lea    0xc78(%rip),%rsi
lea    -0x10a8(%rbp),%rdx
lea    -0x10b0(%rbp),%rcx
lea    -0x10d8(%rbp),%r9
lea    -0x10e4(%rbp),%rbx
lea    -0x10e8(%rbp),%r11
lea    -0x10e0(%rbp),%r10
lea    -0x10f4(%rbp),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1080 <sscanf@plt>
mov    %eax,-0x10f0(%rbp)
cmpl   $0x7,-0x10f0(%rbp)
jne    146f <parse_maps+0x2bf>
mov    -0x10a0(%rbp),%eax
add    -0x10f4(%rbp),%eax
cltq
lea    -0x1090(%rbp),%rdi
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     146f <parse_maps+0x2bf>
mov    -0x10a8(%rbp),%rcx
xor    %eax,%eax
sub    -0x10d8(%rbp),%rax
add    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10a0(%rbp),%eax
add    -0x10f4(%rbp),%eax
cltq
lea    -0x1090(%rbp),%rdi
add    %rax,%rdi
call   10c0 <strdup@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0xc(%rbp)
jmp    14fe <parse_maps+0x34e>
mov    -0x10ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10a0(%rbp)
jmp    12ee <parse_maps+0x13e>
lea    -0x1090(%rbp),%rdi
movslq -0x10a0(%rbp),%rax
lea    -0x1090(%rbp),%rsi
add    %rax,%rsi
mov    -0x1098(%rbp),%edx
sub    -0x10a0(%rbp),%edx
call   1090 <memmove@plt>
mov    -0x1098(%rbp),%eax
sub    -0x10a0(%rbp),%eax
mov    %eax,-0x1098(%rbp)
cmpl   $0x1000,-0x1098(%rbp)
jne    14da <parse_maps+0x32a>
movl   $0x1,-0xc(%rbp)
jmp    14fe <parse_maps+0x34e>
jmp    14df <parse_maps+0x32f>
cmpl   $0x0,-0x109c(%rbp)
jne    1270 <parse_maps+0xc0>
mov    -0x1094(%rbp),%edi
call   1060 <close@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1128,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_maps>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10e8,%rsp
mov    %rdx,0x18(%rsp)
mov    %rsi,%rbp
mov    %rdi,0x20(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movl   $0x0,0xb0(%rsp)
xor    %r13d,%r13d
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xdfc(%rip),%rdx
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %eax,%ecx
call   1040 <snprintf@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1090 <open@plt>
mov    %eax,0x8(%rsp)
test   %eax,%eax
js     13e9 <parse_maps+0x249>
mov    %rbp,0x10(%rsp)
nopw   0x0(%rax,%rax,1)
movslq %r13d,%rax
lea    (%rsp,%rax,1),%rsi
add    $0xe0,%rsi
mov    $0x1000,%edx
sub    %eax,%edx
mov    0x8(%rsp),%edi
call   1060 <read@plt>
cmp    $0xffffffff,%eax
je     13d4 <parse_maps+0x234>
mov    %eax,%ebx
mov    %r13d,%r14d
add    %eax,%r14d
movslq %r14d,%r15
xor    %eax,%eax
jmp    1287 <parse_maps+0xe7>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r12d
mov    %r12d,%eax
mov    %r14d,%r13d
mov    %eax,%r12d
sub    %eax,%r13d
jle    12d3 <parse_maps+0x133>
movslq %eax,%rsi
lea    (%rsp,%rsi,1),%rcx
add    $0xe0,%rcx
mov    %r15,%rdx
sub    %rsi,%rdx
xor    %r12d,%r12d
nopl   0x0(%rax)
cmpb   $0xa,(%rcx,%r12,1)
je     12d0 <parse_maps+0x130>
add    $0x1,%r12
cmp    %r12,%rdx
jne    12b0 <parse_maps+0x110>
jmp    1370 <parse_maps+0x1d0>
cs nopw 0x0(%rax,%rax,1)
nop
add    %eax,%r12d
cmp    %r14d,%r12d
je     1370 <parse_maps+0x1d0>
movslq %r12d,%rcx
movb   $0x0,0xe0(%rsp,%rcx,1)
movslq %eax,%rbp
lea    (%rsp,%rbp,1),%rdi
add    $0xe0,%rdi
lea    0xd17(%rip),%rsi
lea    0x30(%rsp),%rdx
lea    0x48(%rsp),%rcx
lea    0xc0(%rsp),%r8
lea    0x28(%rsp),%r9
lea    0xc(%rsp),%rax
push   %rax
lea    0x48(%rsp),%rax
push   %rax
lea    0x48(%rsp),%rax
push   %rax
lea    0x54(%rsp),%rax
push   %rax
call   1070 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x7,%eax
jne    1280 <parse_maps+0xe0>
movslq 0xc(%rsp),%rax
add    %rbp,%rax
lea    (%rsp,%rax,1),%rbp
add    $0xe0,%rbp
mov    %rbp,%rdi
mov    0x20(%rsp),%rsi
call   10c0 <strstr@plt>
test   %rax,%rax
je     1280 <parse_maps+0xe0>
jmp    13ae <parse_maps+0x20e>
nopl   0x0(%rax,%rax,1)
cltq
lea    (%rsp,%rax,1),%rsi
add    $0xe0,%rsi
lea    0xe0(%rsp),%rdi
mov    %r13d,%edx
call   1080 <memmove@plt>
mov    $0x1,%ebp
cmp    $0x1000,%r13d
je     13f2 <parse_maps+0x252>
test   %ebx,%ebx
jne    1240 <parse_maps+0xa0>
mov    0x8(%rsp),%edi
call   1050 <close@plt>
jmp    13f2 <parse_maps+0x252>
mov    0x30(%rsp),%rax
sub    0x28(%rsp),%rax
mov    0x18(%rsp),%rcx
mov    %rax,(%rcx)
mov    %rbp,%rdi
call   10b0 <strdup@plt>
mov    0x10(%rsp),%rcx
mov    %rax,(%rcx)
xor    %ebp,%ebp
jmp    13f2 <parse_maps+0x252>
lea    0xc33(%rip),%rdi
call   10a0 <perror@plt>
mov    0x8(%rsp),%edi
call   1050 <close@plt>
mov    0x2be8(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%eax
add    $0x10e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"/proc/%i/maps\00"
@O_RDONLY = global i32 0
@errno = global i32 0
@.str.1 = [5 x i8] c"read\00"
@.str.2 = [30 x i8] c"%zx-%zx %31s %Lx %x:%x %Lu %n\00"
define i32 @parse_maps(i8* nocapture %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
%4 = alloca [100 x i8]
%5 = alloca [4096 x i8]
%6 = alloca i64
%7 = alloca i64
%8 = alloca [32 x i8]
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%15 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%16 = tail call i32 (...) @getpid()
%17 = call i32 @snprintf(i8* %14, i32 100, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @O_RDONLY
%19 = call i32 @open(i8* %14, i32 %18)
%20 = icmp slt i32 %19, 0
br i1 %20, label %30, label %21
21: ; preds = %3
%22 = bitcast i64* %6 to i8*
%23 = bitcast i64* %7 to i8*
%24 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%25 = bitcast i64* %9 to i8*
%26 = bitcast i64* %10 to i8*
%27 = bitcast i32* %11 to i8*
%28 = bitcast i32* %12 to i8*
%29 = bitcast i32* %13 to i8*
br label %32
30: ; preds = %3
%31 = load i32, i32* @errno
br label %97
32: ; preds = %21, %93
%33 = phi i32 [ %90, %93 ], [ 0, %21 ]
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 %34
%36 = sub nsw i32 4096, %33
%37 = call i32 @read(i32 %19, i8* %35, i32 %36)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %43
39: ; preds = %32
%40 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%41 = call i32 @close(i32 %19)
%42 = load i32, i32* @errno
br label %97
43: ; preds = %32
%44 = add i32 %37, %33
%45 = sext i32 %44 to i64
br label %46
46: ; preds = %85, %43
%47 = phi i32 [ 0, %43 ], [ %86, %85 ]
%48 = icmp sgt i32 %44, %47
br i1 %48, label %49, label %61
49: ; preds = %46
%50 = sext i32 %47 to i64
br label %51
51: ; preds = %49, %56
%52 = phi i64 [ %50, %49 ], [ %57, %56 ]
%53 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 %52
%54 = load i8, i8* %53
%55 = icmp eq i8 %54, 10
br i1 %55, label %59, label %56
56: ; preds = %51
%57 = add nsw i64 %52, 1
%58 = icmp eq i64 %57, %45
br i1 %58, label %87, label %51
59: ; preds = %51
%60 = trunc i64 %52 to i32
br label %61
61: ; preds = %59, %46
%62 = phi i32 [ %47, %46 ], [ %60, %59 ]
%63 = icmp eq i32 %62, %44
br i1 %63, label %87, label %64
64: ; preds = %61
%65 = sext i32 %62 to i64
%66 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 %65
store i8 0, i8* %66
%67 = sext i32 %47 to i64
%68 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 %67
%69 = call i32 @sscanf(i8* %68, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i64* %6, i64* %7, i8* %24, i64* %9, i32* %11, i32* %12, i64* %10, i32* %13)
%70 = icmp eq i32 %69, 7
br i1 %70, label %71, label %85
71: ; preds = %64
%72 = load i32, i32* %13
%73 = add nsw i32 %72, %47
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 %74
%76 = call i32* @strstr(i8* %75, i8* dereferenceable(1) %0)
%77 = icmp eq i32* %76, null
br i1 %77, label %85, label %78
78: ; preds = %71
%79 = load i64, i64* %6
%80 = inttoptr i64 %79 to i8*
%81 = load i64, i64* %9
%82 = sub i64 0, %81
%83 = getelementptr i8, i8* %80, i64 %82
store i8* %83, i8** %2
%84 = call i8* @strdup(i8* %75)
store i8* %84, i8** %1
br label %97
85: ; preds = %64, %71
%86 = add nsw i32 %62, 1
br label %46
87: ; preds = %61, %56
%88 = sext i32 %47 to i64
%89 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 %88
%90 = sub nsw i32 %44, %47
%91 = call i32 @memmove(i8* %15, i8* %89, i32 %90)
%92 = icmp eq i32 %90, 4096
br i1 %92, label %97, label %93
93: ; preds = %87
%94 = icmp eq i32 %37, 0
br i1 %94, label %95, label %32
95: ; preds = %93
%96 = call i32 @close(i32 %19)
br label %97
97: ; preds = %87, %78, %95, %39, %30
%98 = phi i32 [ %31, %30 ], [ %42, %39 ], [ 1, %95 ], [ 0, %78 ], [ 1, %87 ]
ret i32 %98
}