#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*/ uint8_t;
struct ether_addr {
  int dummy;
};
typedef int /*<<< orphan*/ in_mac;
typedef int /*<<< orphan*/ full_path;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ debugfs_make_path(char *, char *, char *, int);
char *debugfs_mount(int /*<<< orphan*/ *);
struct ether_addr *ether_aton(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memcmp(struct ether_addr *, struct ether_addr *, int);
int /*<<< orphan*/ memcpy(struct ether_addr *, struct ether_addr *, int);
int strlen(char *);
char *strtok_r(char *, char *, char **);
int /*<<< orphan*/ strtol(char *, int /*<<< orphan*/ *, int);
uint8_t get_tq(char *mesh_iface, struct ether_addr *mac) {
  enum {
    orig_mac,
    orig_lastseen,
    orig_tqstart,
    orig_tqvalue,
  } pos;
  char full_path[256 + 1];
  char *debugfs_mnt;
  static struct ether_addr in_mac;
  struct ether_addr *mac_tmp;
  FILE *f = NULL;
  size_t len = 0;
  char *line = NULL;
  char *input, *saveptr, *token;
  int line_invalid;
  uint8_t tq = 0;
  memcpy(&in_mac, mac, sizeof(in_mac));
  debugfs_mnt = debugfs_mount(NULL);
  if (!debugfs_mnt)
    goto out;
  debugfs_make_path("%s/batman_adv/%s"
                    "/"
                    "originators",
                    mesh_iface, full_path, sizeof(full_path));
  f = fopen(full_path, "r");
  if (!f)
    goto out;
  while (getline(&line, &len, f) != -1) {
    line_invalid = 0;
    pos = orig_mac;
    input = line;
    while ((token = strtok_r(input, " \t", &saveptr))) {
      input = NULL;
      switch (pos) {
      case orig_mac:
        mac_tmp = ether_aton(token);
        if (!mac_tmp || memcmp(mac_tmp, &in_mac, sizeof(in_mac)) != 0)
          line_invalid = 1;
        else
          pos = orig_lastseen;
        break;
      case orig_lastseen:
        pos = orig_tqstart;
        break;
      case orig_tqstart:
        if (strlen(token) == 0) {
          line_invalid = 1;
          break;
        } else if (token[0] != '(') {
          line_invalid = 1;
          break;
        } else if (strlen(token) == 1) {
          pos = orig_tqvalue;
          break;
        } else {
          token++;
        }
      case orig_tqvalue:
        if (token[strlen(token) - 1] != ')') {
          line_invalid = 1;
        } else {
          token[strlen(token) - 1] = '\0';
          tq = strtol(token, NULL, 10);
          goto out;
        }
        break;
      }
      if (line_invalid)
        break;
    }
  }
out:
  if (f)
    fclose(f);
  free(line);
  return tq;
}


x86 assembly (clang, -O0):
<get_tq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x138(%rbp)
movq   $0x0,-0x140(%rbp)
movq   $0x0,-0x148(%rbp)
movl   $0x0,-0x168(%rbp)
mov    -0x10(%rbp),%rsi
lea    0x2e7b(%rip),%rdi
mov    $0x4,%edx
call   10a0 <memcpy@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10e0 <debugfs_mount@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
jne    1236 <get_tq+0x76>
jmp    14d0 <get_tq+0x310>
mov    -0x8(%rbp),%rsi
lea    -0x120(%rbp),%rdx
lea    0xdc8(%rip),%rdi
mov    $0x101,%ecx
call   1060 <debugfs_make_path@plt>
lea    -0x120(%rbp),%rdi
lea    0xdcd(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x138(%rbp)
cmpq   $0x0,-0x138(%rbp)
jne    127f <get_tq+0xbf>
jmp    14d0 <get_tq+0x310>
jmp    1284 <get_tq+0xc4>
mov    -0x138(%rbp),%rdx
lea    -0x148(%rbp),%rdi
lea    -0x140(%rbp),%rsi
call   10d0 <getline@plt>
cmp    $0xffffffff,%eax
je     14cb <get_tq+0x30b>
movl   $0x0,-0x164(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x148(%rbp),%rax
mov    %rax,-0x150(%rbp)
mov    -0x150(%rbp),%rdi
lea    0xd5b(%rip),%rsi
lea    -0x158(%rbp),%rdx
call   1070 <strtok_r@plt>
mov    %rax,-0x160(%rbp)
cmp    $0x0,%rax
je     14c6 <get_tq+0x306>
movq   $0x0,-0x150(%rbp)
mov    -0x14(%rbp),%eax
mov    %rax,-0x170(%rbp)
sub    $0x3,%rax
ja     14af <get_tq+0x2ef>
mov    -0x170(%rbp),%rax
lea    0xce2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x160(%rbp),%rdi
call   10b0 <ether_aton@plt>
mov    %rax,-0x130(%rbp)
cmpq   $0x0,-0x130(%rbp)
je     1369 <get_tq+0x1a9>
mov    -0x130(%rbp),%rdi
lea    0x2d2e(%rip),%rsi
mov    $0x4,%edx
call   1080 <memcmp@plt>
cmp    $0x0,%eax
je     1378 <get_tq+0x1b8>
movl   $0x1,-0x164(%rbp)
jmp    137f <get_tq+0x1bf>
movl   $0x1,-0x14(%rbp)
jmp    14af <get_tq+0x2ef>
movl   $0x2,-0x14(%rbp)
jmp    14af <get_tq+0x2ef>
mov    -0x160(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    13b4 <get_tq+0x1f4>
movl   $0x1,-0x164(%rbp)
jmp    14af <get_tq+0x2ef>
mov    -0x160(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x28,%eax
je     13d6 <get_tq+0x216>
movl   $0x1,-0x164(%rbp)
jmp    14af <get_tq+0x2ef>
mov    -0x160(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x1,%eax
jne    13f7 <get_tq+0x237>
movl   $0x3,-0x14(%rbp)
jmp    14af <get_tq+0x2ef>
mov    -0x160(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x160(%rbp)
jmp    140e <get_tq+0x24e>
jmp    1413 <get_tq+0x253>
jmp    1418 <get_tq+0x258>
mov    -0x160(%rbp),%rax
mov    %rax,-0x178(%rbp)
mov    -0x160(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x178(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x29,%eax
je     145d <get_tq+0x29d>
movl   $0x1,-0x164(%rbp)
jmp    14aa <get_tq+0x2ea>
mov    -0x160(%rbp),%rax
mov    %rax,-0x180(%rbp)
mov    -0x160(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x180(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x160(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1090 <strtol@plt>
mov    %eax,-0x168(%rbp)
jmp    14d0 <get_tq+0x310>
jmp    14af <get_tq+0x2ef>
cmpl   $0x0,-0x164(%rbp)
je     14c1 <get_tq+0x301>
jmp    14c6 <get_tq+0x306>
jmp    12c6 <get_tq+0x106>
jmp    1284 <get_tq+0xc4>
jmp    14d0 <get_tq+0x310>
cmpq   $0x0,-0x138(%rbp)
je     14ea <get_tq+0x32a>
mov    -0x138(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x148(%rbp),%rdi
call   1030 <free@plt>
mov    -0x168(%rbp),%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_tq>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
mov    %rdi,%r14
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x2e97(%rip),%rdi
mov    $0x4,%edx
call   10a0 <memcpy@plt>
xor    %ebp,%ebp
xor    %edi,%edi
call   10e0 <debugfs_mount@plt>
mov    $0x0,%ebx
test   %rax,%rax
je     138f <get_tq+0x1cf>
lea    0xdfb(%rip),%rdi
lea    0x20(%rsp),%rbx
mov    %r14,%rsi
mov    %rbx,%rdx
mov    $0x101,%ecx
call   1060 <debugfs_make_path@plt>
lea    0xdfc(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     138b <get_tq+0x1cb>
mov    %rax,%rbp
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %rax,%rdx
call   10d0 <getline@plt>
cmp    $0xffffffff,%eax
je     137a <get_tq+0x1ba>
lea    0xdc8(%rip),%r15
lea    0x18(%rsp),%rbx
lea    0xd8d(%rip),%r13
jmp    12ab <get_tq+0xeb>
mov    %r12,%rdi
call   1050 <strlen@plt>
cltq
cmpb   $0x29,-0x1(%rax,%r12,1)
je     13ab <get_tq+0x1eb>
nopl   0x0(%rax,%rax,1)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %rbp,%rdx
call   10d0 <getline@plt>
cmp    $0xffffffff,%eax
je     137a <get_tq+0x1ba>
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1070 <strtok_r@plt>
test   %rax,%rax
je     1290 <get_tq+0xd0>
mov    %rax,%r12
xor    %ecx,%ecx
jmp    12eb <get_tq+0x12b>
nopw   0x0(%rax,%rax,1)
mov    %ecx,%r14d
xor    %edi,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1070 <strtok_r@plt>
mov    %rax,%r12
mov    %r14d,%ecx
test   %rax,%rax
je     1290 <get_tq+0xd0>
cmp    $0x3,%ecx
ja     12d0 <get_tq+0x110>
mov    $0x2,%r14d
mov    %ecx,%eax
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
mov    %r12,%rdi
call   10b0 <ether_aton@plt>
test   %rax,%rax
je     1290 <get_tq+0xd0>
mov    %rax,%rdi
lea    0x2d6b(%rip),%rsi
mov    $0x4,%edx
call   1080 <memcmp@plt>
mov    $0x1,%r14d
test   %eax,%eax
je     12d3 <get_tq+0x113>
jmp    1290 <get_tq+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
je     1290 <get_tq+0xd0>
cmpb   $0x28,(%r12)
jne    1290 <get_tq+0xd0>
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    $0x3,%ecx
cmp    $0x1,%eax
je     12d0 <get_tq+0x110>
add    $0x1,%r12
jmp    1275 <get_tq+0xb5>
xor    %ebx,%ebx
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    0x8(%rsp),%rbp
jmp    138f <get_tq+0x1cf>
xor    %ebp,%ebp
xor    %ebx,%ebx
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r12,1)
mov    %r12,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1090 <strtol@plt>
mov    %eax,%ebx
jmp    137c <get_tq+0x1bc>

LLVM IR (-O0):
%struct.ether_addr = type { i32 }
@get_tq.in_mac = internal global %struct.ether_addr zeroinitializer
@.str = [29 x i8] c"%s/batman_adv/%s/originators\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c" \09\00"
define i32 @get_tq(i8* %0, %struct.ether_addr* %1) {
%3 = alloca i8*
%4 = alloca %struct.ether_addr*
%5 = alloca i32
%6 = alloca [257 x i8]
%7 = alloca i8*
%8 = alloca %struct.ether_addr*
%9 = alloca i32*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %3
store %struct.ether_addr* %1, %struct.ether_addr** %4
store i32* null, i32** %9
store i64 0, i64* %10
store i8* null, i8** %11
store i32 0, i32* %16
%17 = load %struct.ether_addr*, %struct.ether_addr** %4
%18 = call i32 @memcpy(%struct.ether_addr* @get_tq.in_mac, %struct.ether_addr* %17, i32 4)
%19 = call i8* @debugfs_mount(i32* null)
store i8* %19, i8** %7
%20 = load i8*, i8** %7
%21 = icmp ne i8* %20, null
br i1 %21, label %23, label %22
22: ; preds = %2
br label %109
23: ; preds = %2
%24 = load i8*, i8** %3
%25 = getelementptr inbounds [257 x i8], [257 x i8]* %6, i64 0, i64 0
%26 = call i32 @debugfs_make_path(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %24, i8* %25, i32 257)
%27 = getelementptr inbounds [257 x i8], [257 x i8]* %6, i64 0, i64 0
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %28, i32** %9
%29 = load i32*, i32** %9
%30 = icmp ne i32* %29, null
br i1 %30, label %32, label %31
31: ; preds = %23
br label %109
32: ; preds = %23
br label %33
33: ; preds = %107, %32
%34 = load i32*, i32** %9
%35 = call i32 @getline(i8** %11, i64* %10, i32* %34)
%36 = icmp ne i32 %35, -1
br i1 %36, label %37, label %108
37: ; preds = %33
store i32 0, i32* %15
store i32 0, i32* %5
%38 = load i8*, i8** %11
store i8* %38, i8** %12
br label %39
39: ; preds = %106, %37
%40 = load i8*, i8** %12
%41 = call i8* @strtok_r(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %13)
store i8* %41, i8** %14
%42 = icmp ne i8* %41, null
br i1 %42, label %43, label %107
43: ; preds = %39
store i8* null, i8** %12
%44 = load i32, i32* %5
switch i32 %44, label %102 [
i32 0, label %45
i32 1, label %57
i32 2, label %58
i32 3, label %81
]
45: ; preds = %43
%46 = load i8*, i8** %14
%47 = call %struct.ether_addr* @ether_aton(i8* %46)
store %struct.ether_addr* %47, %struct.ether_addr** %8
%48 = load %struct.ether_addr*, %struct.ether_addr** %8
%49 = icmp ne %struct.ether_addr* %48, null
br i1 %49, label %50, label %54
50: ; preds = %45
%51 = load %struct.ether_addr*, %struct.ether_addr** %8
%52 = call i32 @memcmp(%struct.ether_addr* %51, %struct.ether_addr* @get_tq.in_mac, i32 4)
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %50, %45
store i32 1, i32* %15
br label %56
55: ; preds = %50
store i32 1, i32* %5
br label %56
56: ; preds = %55, %54
br label %102
57: ; preds = %43
store i32 2, i32* %5
br label %102
58: ; preds = %43
%59 = load i8*, i8** %14
%60 = call i32 @strlen(i8* %59)
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %58
store i32 1, i32* %15
br label %102
63: ; preds = %58
%64 = load i8*, i8** %14
%65 = getelementptr inbounds i8, i8* %64, i64 0
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp ne i32 %67, 40
br i1 %68, label %69, label %70
69: ; preds = %63
store i32 1, i32* %15
br label %102
70: ; preds = %63
%71 = load i8*, i8** %14
%72 = call i32 @strlen(i8* %71)
%73 = icmp eq i32 %72, 1
br i1 %73, label %74, label %75
74: ; preds = %70
store i32 3, i32* %5
br label %102
75: ; preds = %70
%76 = load i8*, i8** %14
%77 = getelementptr inbounds i8, i8* %76, i32 1
store i8* %77, i8** %14
br label %78
78: ; preds = %75
br label %79
79: ; preds = %78
br label %80
80: ; preds = %79
br label %81
81: ; preds = %43, %80
%82 = load i8*, i8** %14
%83 = load i8*, i8** %14
%84 = call i32 @strlen(i8* %83)
%85 = sub nsw i32 %84, 1
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %82, i64 %86
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = icmp ne i32 %89, 41
br i1 %90, label %91, label %92
91: ; preds = %81
store i32 1, i32* %15
br label %101
92: ; preds = %81
%93 = load i8*, i8** %14
%94 = load i8*, i8** %14
%95 = call i32 @strlen(i8* %94)
%96 = sub nsw i32 %95, 1
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %93, i64 %97
store i8 0, i8* %98
%99 = load i8*, i8** %14
%100 = call i32 @strtol(i8* %99, i32* null, i32 10)
store i32 %100, i32* %16
br label %109
101: ; preds = %91
br label %102
102: ; preds = %43, %101, %74, %69, %62, %57, %56
%103 = load i32, i32* %15
%104 = icmp ne i32 %103, 0
br i1 %104, label %105, label %106
105: ; preds = %102
br label %107
106: ; preds = %102
br label %39
107: ; preds = %105, %39
br label %33
108: ; preds = %33
br label %109
109: ; preds = %108, %92, %31, %22
%110 = load i32*, i32** %9
%111 = icmp ne i32* %110, null
br i1 %111, label %112, label %115
112: ; preds = %109
%113 = load i32*, i32** %9
%114 = call i32 @fclose(i32* %113)
br label %115
115: ; preds = %112, %109
%116 = load i8*, i8** %11
%117 = call i32 @free(i8* %116)
%118 = load i32, i32* %16
ret i32 %118
}

LLVM IR (-O2):
%struct.ether_addr = type { i32 }
@get_tq.in_mac = internal global %struct.ether_addr zeroinitializer
@.str = [29 x i8] c"%s/batman_adv/%s/originators\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c" \09\00"
define i32 @get_tq(i8* %0, %struct.ether_addr* %1) {
%3 = alloca [257 x i8]
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i8*
%7 = getelementptr inbounds [257 x i8], [257 x i8]* %3, i64 0, i64 0
%8 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%9 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%10 = bitcast i8** %6 to i8*
%11 = tail call i32 @memcpy(%struct.ether_addr* @get_tq.in_mac, %struct.ether_addr* %1, i32 4)
%12 = tail call i8* @debugfs_mount(i32* null)
%13 = icmp eq i8* %12, null
br i1 %13, label %72, label %14
14: ; preds = %2
%15 = call i32 @debugfs_make_path(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %7, i32 257)
%16 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %72, label %18
18: ; preds = %14
%19 = call i32 @getline(i8** %5, i64* %4, i32* %16)
%20 = icmp eq i32 %19, -1
br i1 %20, label %68, label %21
21: ; preds = %18, %65
%22 = load i8*, i8** %5
%23 = call i8* @strtok_r(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %6)
%24 = icmp eq i8* %23, null
br i1 %24, label %65, label %25
25: ; preds = %21, %34
%26 = phi i8* [ %36, %34 ], [ %23, %21 ]
%27 = phi i32 [ %35, %34 ], [ 0, %21 ]
switch i32 %27, label %63 [
i32 0, label %28
i32 1, label %34
i32 2, label %38
i32 3, label %49
]
28: ; preds = %25
%29 = call %struct.ether_addr* @ether_aton(i8* %26)
%30 = icmp eq %struct.ether_addr* %29, null
br i1 %30, label %65, label %31
31: ; preds = %28
%32 = call i32 @memcmp(%struct.ether_addr* %29, %struct.ether_addr* @get_tq.in_mac, i32 4)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %65
34: ; preds = %31, %63, %25
%35 = phi i32 [ %64, %63 ], [ 1, %31 ], [ 2, %25 ]
%36 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %6)
%37 = icmp eq i8* %36, null
br i1 %37, label %65, label %25
38: ; preds = %25
%39 = call i32 @strlen(i8* %26)
%40 = icmp eq i32 %39, 0
br i1 %40, label %65, label %41
41: ; preds = %38
%42 = load i8, i8* %26
%43 = icmp eq i8 %42, 40
br i1 %43, label %44, label %65
44: ; preds = %41
%45 = call i32 @strlen(i8* %26)
%46 = icmp eq i32 %45, 1
br i1 %46, label %63, label %47
47: ; preds = %44
%48 = getelementptr inbounds i8, i8* %26, i64 1
br label %49
49: ; preds = %25, %47
%50 = phi i8* [ %48, %47 ], [ %26, %25 ]
%51 = call i32 @strlen(i8* %50)
%52 = add nsw i32 %51, -1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %50, i64 %53
%55 = load i8, i8* %54
%56 = icmp eq i8 %55, 41
br i1 %56, label %57, label %65
57: ; preds = %49
%58 = call i32 @strlen(i8* %50)
%59 = add nsw i32 %58, -1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %50, i64 %60
store i8 0, i8* %61
%62 = call i32 @strtol(i8* nocapture %50, i32* null, i32 10)
br label %68
63: ; preds = %44, %25
%64 = phi i32 [ %27, %25 ], [ 3, %44 ]
br label %34
65: ; preds = %34, %31, %28, %38, %41, %21, %49
%66 = call i32 @getline(i8** %5, i64* %4, i32* %16)
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %21
68: ; preds = %65, %18, %57
%69 = phi i32 [ %62, %57 ], [ 0, %18 ], [ 0, %65 ]
%70 = call i32 @fclose(i32* %16)
%71 = load i8*, i8** %5
br label %72
72: ; preds = %2, %14, %68
%73 = phi i8* [ %71, %68 ], [ null, %14 ], [ null, %2 ]
%74 = phi i32 [ %69, %68 ], [ 0, %14 ], [ 0, %2 ]
%75 = call i32 @free(i8* %73)
ret i32 %74
}