#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 passwd {
  scalar_t__ pw_uid;
  char *pw_name;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ append(char **, char *, unsigned int, unsigned int);
int /*<<< orphan*/ endpwent();
int /*<<< orphan*/ error(int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
char *getenv(char *);
scalar_t__ getgid();
scalar_t__ getline(char **, size_t *, int /*<<< orphan*/ *);
char *getlogin();
struct passwd *getpwnam(char *);
struct passwd *getpwuid(scalar_t__);
scalar_t__ getuid();
int sscanf(char *, char *, unsigned int *, unsigned int *, size_t *);
scalar_t__ strchr(char *, char);
char *string(char *, unsigned int);
size_t strlen(char *);
scalar_t__ strncmp(char *, char *, size_t);
char *readranges(int type) {
  char *line = NULL, *range, *user;
  size_t end, size;
  struct passwd *passwd;
  unsigned length, start;
  FILE *file;
  range = string("%u:1", ((unsigned)((type) == 0 ? getgid() : getuid())));
  if (!(file = fopen(((type) == 0 ? "/etc/subgid" : "/etc/subuid"), "r")))
    return range;
  user = getenv("USER");
  user = user ? user : getenv("LOGNAME");
  user = user ? user : getlogin();
  if (!user || !(passwd = getpwnam(user)) || passwd->pw_uid != getuid()) {
    if (!(passwd = getpwuid(getuid())))
      error(1, 0, "Failed to validate your username");
    user = passwd->pw_name;
  }
  endpwent();
  while (getline(&line, &size, file) >= 0) {
    if (strncmp(line, user, strlen(user)))
      continue;
    if (sscanf(line + strlen(user), ":%u:%u%zn", &start, &length, &end) < 2)
      continue;
    if (strchr(":\n", line[end + strlen(user) + 1]))
      append(&range, ",%u:%u", start, length);
  }
  free(line);
  fclose(file);
  return range;
}


x86 assembly (clang, -O0):
<readranges>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1250 <readranges+0x30>
mov    $0x0,%al
call   10e0 <getgid@plt>
mov    %rax,-0x58(%rbp)
jmp    125b <readranges+0x3b>
mov    $0x0,%al
call   10a0 <getuid@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %eax,%esi
lea    0xd98(%rip),%rdi
call   10c0 <string@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%ecx
lea    0xd96(%rip),%rdi
lea    0xd83(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rdi
lea    0xd8d(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    12b0 <readranges+0x90>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    14bc <readranges+0x29c>
lea    0xd68(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12d8 <readranges+0xb8>
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    12e8 <readranges+0xc8>
lea    0xd45(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1308 <readranges+0xe8>
mov    -0x28(%rbp),%rax
mov    %rax,-0x68(%rbp)
jmp    1313 <readranges+0xf3>
mov    $0x0,%al
call   1110 <getlogin@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     135f <readranges+0x13f>
mov    -0x28(%rbp),%rdi
call   10d0 <getpwnam@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     135f <readranges+0x13f>
mov    -0x40(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    $0x0,%al
call   10a0 <getuid@plt>
mov    %rax,%rcx
mov    -0x70(%rbp),%rax
cmp    %rcx,%rax
je     139b <readranges+0x17b>
mov    $0x0,%al
call   10a0 <getuid@plt>
mov    %rax,%rdi
call   1080 <getpwuid@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    138f <readranges+0x16f>
mov    $0x1,%edi
xor    %esi,%esi
lea    0xca2(%rip),%rdx
call   1120 <error@plt>
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   10f0 <endpwent@plt>
mov    -0x50(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1140 <getline@plt>
cmp    $0x0,%rax
jl     14a2 <readranges+0x282>
mov    -0x18(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x28(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x80(%rbp),%rdi
mov    -0x78(%rbp),%rsi
mov    %rax,%rdx
call   1060 <strncmp@plt>
cmp    $0x0,%rax
je     13f5 <readranges+0x1d5>
jmp    13a2 <readranges+0x182>
mov    -0x18(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x28(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x88(%rbp),%rdi
add    %rax,%rdi
lea    0xc33(%rip),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x44(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   1100 <sscanf@plt>
cmp    $0x2,%eax
jge    1439 <readranges+0x219>
jmp    13a2 <readranges+0x182>
mov    -0x18(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x28(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x98(%rbp),%rcx
mov    %rax,%rdx
mov    -0x90(%rbp),%rax
add    %rdx,%rcx
lea    0xbe4(%rip),%rdi
movsbl 0x1(%rax,%rcx,1),%esi
call   10b0 <strchr@plt>
cmp    $0x0,%rax
je     149d <readranges+0x27d>
mov    -0x48(%rbp),%edx
mov    -0x44(%rbp),%ecx
lea    -0x20(%rbp),%rdi
lea    0xbc2(%rip),%rsi
call   1050 <append@plt>
jmp    13a2 <readranges+0x182>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
mov    -0x50(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readranges>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x0,(%rsp)
xor    %eax,%eax
test   %edi,%edi
je     124d <readranges+0x2d>
call   10a0 <getuid@plt>
mov    %rax,%rsi
lea    0xdc6(%rip),%rbx
jmp    125c <readranges+0x3c>
call   10e0 <getgid@plt>
mov    %rax,%rsi
lea    0xda9(%rip),%rbx
lea    0xd9d(%rip),%rdi
call   10c0 <string@plt>
mov    %rax,%rbp
mov    %rax,0x10(%rsp)
lea    0xda6(%rip),%rsi
mov    %rbx,%rdi
call   1130 <fopen@plt>
test   %rax,%rax
je     140b <readranges+0x1eb>
mov    %rax,%r14
lea    0xd8d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    12c2 <readranges+0xa2>
lea    0xd7e(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    12c2 <readranges+0xa2>
xor    %eax,%eax
call   1110 <getlogin@plt>
mov    %rax,%rbx
test   %rax,%rax
je     12de <readranges+0xbe>
mov    %rbx,%rdi
call   10d0 <getpwnam@plt>
test   %rax,%rax
je     12de <readranges+0xbe>
mov    (%rax),%rbp
xor    %eax,%eax
call   10a0 <getuid@plt>
cmp    %rax,%rbp
je     130c <readranges+0xec>
xor    %eax,%eax
call   10a0 <getuid@plt>
mov    %rax,%rdi
call   1080 <getpwuid@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1308 <readranges+0xe8>
lea    0xd30(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
call   1120 <error@plt>
mov    0x8(%rbx),%rbx
xor    %eax,%eax
call   10f0 <endpwent@plt>
mov    %rsp,%rdi
lea    0x18(%rsp),%rsi
mov    %r14,%rdx
call   1140 <getline@plt>
test   %rax,%rax
js     13f5 <readranges+0x1d5>
mov    %rsp,%r15
lea    0x18(%rsp),%r12
jmp    1357 <readranges+0x137>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1140 <getline@plt>
test   %rax,%rax
js     13f5 <readranges+0x1d5>
mov    (%rsp),%r13
mov    %rbx,%rdi
call   1090 <strlen@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1060 <strncmp@plt>
test   %rax,%rax
jne    1340 <readranges+0x120>
mov    (%rsp),%rbp
mov    %rbx,%rdi
call   1090 <strlen@plt>
add    %rax,%rbp
mov    %rbp,%rdi
lea    0xcbe(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x20(%rsp),%r8
call   1100 <sscanf@plt>
cmp    $0x2,%eax
jl     1340 <readranges+0x120>
mov    (%rsp),%r13
mov    0x20(%rsp),%rbp
mov    %rbx,%rdi
call   1090 <strlen@plt>
add    %rbp,%rax
movsbl 0x1(%r13,%rax,1),%esi
lea    0xc8e(%rip),%rdi
call   10b0 <strchr@plt>
test   %rax,%rax
je     1340 <readranges+0x120>
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0x10(%rsp),%rdi
lea    0xc6f(%rip),%rsi
call   1050 <append@plt>
jmp    1340 <readranges+0x120>
mov    (%rsp),%rdi
call   1040 <free@plt>
mov    %r14,%rdi
call   1070 <fclose@plt>
mov    0x10(%rsp),%rbp
mov    %rbp,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.passwd = type { i64, i8* }
@.str = [5 x i8] c"%u:1\00"
@.str.1 = [12 x i8] c"/etc/subgid\00"
@.str.2 = [12 x i8] c"/etc/subuid\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [5 x i8] c"USER\00"
@.str.5 = [8 x i8] c"LOGNAME\00"
@.str.6 = [33 x i8] c"Failed to validate your username\00"
@.str.7 = [10 x i8] c":%u:%u%zn\00"
@.str.8 = [3 x i8] c":\0A\00"
@.str.9 = [7 x i8] c",%u:%u\00"
define i8* @readranges(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca %struct.passwd*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
store i32 %0, i32* %3
store i8* null, i8** %4
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %1
%16 = call i64 (...) @getgid()
br label %19
17: ; preds = %1
%18 = call i64 (...) @getuid()
br label %19
19: ; preds = %17, %15
%20 = phi i64 [ %16, %15 ], [ %18, %17 ]
%21 = trunc i64 %20 to i32
%22 = call i8* @string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %21)
store i8* %22, i8** %5
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i64
%26 = select i1 %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0)
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %27, i32** %12
%28 = icmp ne i32* %27, null
br i1 %28, label %31, label %29
29: ; preds = %19
%30 = load i8*, i8** %5
store i8* %30, i8** %2
br label %115
31: ; preds = %19
%32 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
store i8* %32, i8** %6
%33 = load i8*, i8** %6
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = load i8*, i8** %6
br label %39
37: ; preds = %31
%38 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
%40 = phi i8* [ %36, %35 ], [ %38, %37 ]
store i8* %40, i8** %6
%41 = load i8*, i8** %6
%42 = icmp ne i8* %41, null
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = load i8*, i8** %6
br label %47
45: ; preds = %39
%46 = call i8* (...) @getlogin()
br label %47
47: ; preds = %45, %43
%48 = phi i8* [ %44, %43 ], [ %46, %45 ]
store i8* %48, i8** %6
%49 = load i8*, i8** %6
%50 = icmp ne i8* %49, null
br i1 %50, label %51, label %61
51: ; preds = %47
%52 = load i8*, i8** %6
%53 = call %struct.passwd* @getpwnam(i8* %52)
store %struct.passwd* %53, %struct.passwd** %9
%54 = icmp ne %struct.passwd* %53, null
br i1 %54, label %55, label %61
55: ; preds = %51
%56 = load %struct.passwd*, %struct.passwd** %9
%57 = getelementptr inbounds %struct.passwd, %struct.passwd* %56, i32 0, i32 0
%58 = load i64, i64* %57
%59 = call i64 (...) @getuid()
%60 = icmp ne i64 %58, %59
br i1 %60, label %61, label %71
61: ; preds = %55, %51, %47
%62 = call i64 (...) @getuid()
%63 = call %struct.passwd* @getpwuid(i64 %62)
store %struct.passwd* %63, %struct.passwd** %9
%64 = icmp ne %struct.passwd* %63, null
br i1 %64, label %67, label %65
65: ; preds = %61
%66 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %67
67: ; preds = %65, %61
%68 = load %struct.passwd*, %struct.passwd** %9
%69 = getelementptr inbounds %struct.passwd, %struct.passwd* %68, i32 0, i32 1
%70 = load i8*, i8** %69
store i8* %70, i8** %6
br label %71
71: ; preds = %67, %55
%72 = call i32 (...) @endpwent()
br label %73
73: ; preds = %108, %92, %84, %71
%74 = load i32*, i32** %12
%75 = call i64 @getline(i8** %4, i64* %8, i32* %74)
%76 = icmp sge i64 %75, 0
br i1 %76, label %77, label %109
77: ; preds = %73
%78 = load i8*, i8** %4
%79 = load i8*, i8** %6
%80 = load i8*, i8** %6
%81 = call i64 @strlen(i8* %80)
%82 = call i64 @strncmp(i8* %78, i8* %79, i64 %81)
%83 = icmp ne i64 %82, 0
br i1 %83, label %84, label %85
84: ; preds = %77
br label %73
85: ; preds = %77
%86 = load i8*, i8** %4
%87 = load i8*, i8** %6
%88 = call i64 @strlen(i8* %87)
%89 = getelementptr inbounds i8, i8* %86, i64 %88
%90 = call i32 @sscanf(i8* %89, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32* %11, i32* %10, i64* %7)
%91 = icmp slt i32 %90, 2
br i1 %91, label %92, label %93
92: ; preds = %85
br label %73
93: ; preds = %85
%94 = load i8*, i8** %4
%95 = load i64, i64* %7
%96 = load i8*, i8** %6
%97 = call i64 @strlen(i8* %96)
%98 = add i64 %95, %97
%99 = add i64 %98, 1
%100 = getelementptr inbounds i8, i8* %94, i64 %99
%101 = load i8, i8* %100
%102 = call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8 signext %101)
%103 = icmp ne i64 %102, 0
br i1 %103, label %104, label %108
104: ; preds = %93
%105 = load i32, i32* %11
%106 = load i32, i32* %10
%107 = call i32 @append(i8** %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %105, i32 %106)
br label %108
108: ; preds = %104, %93
br label %73
109: ; preds = %73
%110 = load i8*, i8** %4
%111 = call i32 @free(i8* %110)
%112 = load i32*, i32** %12
%113 = call i32 @fclose(i32* %112)
%114 = load i8*, i8** %5
store i8* %114, i8** %2
br label %115
115: ; preds = %109, %29
%116 = load i8*, i8** %2
ret i8* %116
}

LLVM IR (-O2):
%struct.passwd = type { i64, i8* }
@.str = [5 x i8] c"%u:1\00"
@.str.1 = [12 x i8] c"/etc/subgid\00"
@.str.2 = [12 x i8] c"/etc/subuid\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [5 x i8] c"USER\00"
@.str.5 = [8 x i8] c"LOGNAME\00"
@.str.6 = [33 x i8] c"Failed to validate your username\00"
@.str.7 = [10 x i8] c":%u:%u%zn\00"
@.str.8 = [3 x i8] c":\0A\00"
@.str.9 = [7 x i8] c",%u:%u\00"
define i8* @readranges(i32 %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%9 = bitcast i8** %3 to i8*
%10 = bitcast i64* %4 to i8*
%11 = bitcast i64* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = bitcast i32* %7 to i8*
%14 = icmp eq i32 %0, 0
br i1 %14, label %15, label %17
15: ; preds = %1
%16 = tail call i64 (...) @getgid()
br label %19
17: ; preds = %1
%18 = tail call i64 (...) @getuid()
br label %19
19: ; preds = %17, %15
%20 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %17 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %15 ]
%21 = phi i64 [ %18, %17 ], [ %16, %15 ]
%22 = trunc i64 %21 to i32
%23 = tail call i8* @string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %22)
store i8* %23, i8** %3
%24 = tail call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %91, label %26
26: ; preds = %19
%27 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = tail call i8* (...) @getlogin()
%34 = icmp eq i8* %33, null
br i1 %34, label %44, label %35
35: ; preds = %26, %29, %32
%36 = phi i8* [ %33, %32 ], [ %30, %29 ], [ %27, %26 ]
%37 = tail call %struct.passwd* @getpwnam(i8* %36)
%38 = icmp eq %struct.passwd* %37, null
br i1 %38, label %44, label %39
39: ; preds = %35
%40 = getelementptr inbounds %struct.passwd, %struct.passwd* %37, i64 0, i32 0
%41 = load i64, i64* %40
%42 = tail call i64 (...) @getuid()
%43 = icmp eq i64 %41, %42
br i1 %43, label %53, label %44
44: ; preds = %39, %35, %32
%45 = tail call i64 (...) @getuid()
%46 = tail call %struct.passwd* @getpwuid(i64 %45)
%47 = icmp eq %struct.passwd* %46, null
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = tail call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
%51 = getelementptr inbounds %struct.passwd, %struct.passwd* %46, i64 0, i32 1
%52 = load i8*, i8** %51
br label %53
53: ; preds = %50, %39
%54 = phi i8* [ %52, %50 ], [ %36, %39 ]
%55 = tail call i32 (...) @endpwent()
%56 = call i64 @getline(i8** %2, i64* %5, i32* %24)
%57 = icmp sgt i64 %56, -1
br i1 %57, label %58, label %86
58: ; preds = %53, %83
%59 = load i8*, i8** %2
%60 = call i64 @strlen(i8* dereferenceable(1) %54)
%61 = call i64 @strncmp(i8* %59, i8* %54, i64 %60)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %83
63: ; preds = %58
%64 = load i8*, i8** %2
%65 = call i64 @strlen(i8* dereferenceable(1) %54)
%66 = getelementptr inbounds i8, i8* %64, i64 %65
%67 = call i32 @sscanf(i8* %66, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32* %7, i32* %6, i64* %4)
%68 = icmp slt i32 %67, 2
br i1 %68, label %83, label %69
69: ; preds = %63
%70 = load i8*, i8** %2
%71 = load i64, i64* %4
%72 = call i64 @strlen(i8* dereferenceable(1) %54)
%73 = add i64 %71, 1
%74 = add i64 %73, %72
%75 = getelementptr inbounds i8, i8* %70, i64 %74
%76 = load i8, i8* %75
%77 = call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8 signext %76)
%78 = icmp eq i64 %77, 0
br i1 %78, label %83, label %79
79: ; preds = %69
%80 = load i32, i32* %7
%81 = load i32, i32* %6
%82 = call i32 @append(i8** %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %80, i32 %81)
br label %83
83: ; preds = %69, %79, %58, %63
%84 = call i64 @getline(i8** %2, i64* %5, i32* %24)
%85 = icmp sgt i64 %84, -1
br i1 %85, label %58, label %86
86: ; preds = %83, %53
%87 = load i8*, i8** %2
%88 = call i32 @free(i8* %87)
%89 = call i32 @fclose(i32* %24)
%90 = load i8*, i8** %3
br label %91
91: ; preds = %19, %86
%92 = phi i8* [ %23, %19 ], [ %90, %86 ]
ret i8* %92
}