#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
size_t strcspn(char *, char *);
size_t strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, size_t);
char *strstr(char *, char *);
unsigned int getModuleFamily(char *moduleName) {
  char buf[256], hardware[128] = {0};
  FILE *file = NULL;
  char *start = NULL, *numStr = NULL, *end = NULL;
  size_t len = 0;
  file = fopen("/proc/cpuinfo", "r");
  if (file) {
    while (fgets(buf, 255, file)) {
      if (strstr(buf, "Hardware")) {
        numStr = strstr(&buf[7], ":");
        sprintf(hardware, "%s", numStr);
      }
    }
    fclose(file);
    start = strstr(hardware, "Toradex");
    if (start != NULL) {
      start += 8;
      end = strstr(start, "Module");
      if (end)
        len = end - start - 1;
      else
        len = strcspn(start, "\n");
    } else {
      file = fopen("/sys/firmware/devicetree/base/model", "r");
      if (file == NULL) {
        file = fopen("/sys/bus/soc/devices/soc0/machine", "r");
      }
      if (file) {
        while (fgets(buf, 255, file)) {
          start = strstr(buf, "Toradex");
          if (start == NULL) {
            printf("Invalid Machine!");
            exit(-1);
          }
          start += 8;
          end = strstr(start, "on");
          if (end)
            len = end - start - 1;
          else
            len = strlen(start);
        }
        fclose(file);
      }
    }
  } else {
    printf("CPU info not available!");
    exit(-1);
  }
  strncpy(moduleName, start, len);
  if (strstr(moduleName, "Colibri")) {
    return 0;
  } else if (strstr(moduleName, "Apalis")) {
    return 1;
  }
  return -1;
}


x86 assembly (clang, -O0):
<getModuleFamily>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1070 <memset@plt>
movq   $0x0,-0x198(%rbp)
movq   $0x0,-0x1a0(%rbp)
movq   $0x0,-0x1a8(%rbp)
movq   $0x0,-0x1b0(%rbp)
movq   $0x0,-0x1b8(%rbp)
lea    0xdf0(%rip),%rdi
lea    0xdf7(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x198(%rbp)
cmpq   $0x0,-0x198(%rbp)
je     149e <getModuleFamily+0x2ee>
jmp    1236 <getModuleFamily+0x86>
lea    -0x110(%rbp),%rdi
mov    -0x198(%rbp),%rdx
mov    $0xff,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     12b2 <getModuleFamily+0x102>
lea    -0x110(%rbp),%rdi
lea    0xdaa(%rip),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     12ad <getModuleFamily+0xfd>
lea    -0x110(%rbp),%rdi
add    $0x7,%rdi
lea    0xd92(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x1a8(%rbp)
lea    -0x190(%rbp),%rdi
mov    -0x1a8(%rbp),%rdx
lea    0xd73(%rip),%rsi
call   10b0 <sprintf@plt>
jmp    1236 <getModuleFamily+0x86>
mov    -0x198(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x190(%rbp),%rdi
lea    0xd52(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x1a0(%rbp)
cmpq   $0x0,-0x1a0(%rbp)
je     1360 <getModuleFamily+0x1b0>
mov    -0x1a0(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x1a0(%rbp)
mov    -0x1a0(%rbp),%rdi
lea    0xd20(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x1b0(%rbp)
cmpq   $0x0,-0x1b0(%rbp)
je     1341 <getModuleFamily+0x191>
mov    -0x1b0(%rbp),%rax
mov    -0x1a0(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
mov    %rax,-0x1b8(%rbp)
jmp    135b <getModuleFamily+0x1ab>
mov    -0x1a0(%rbp),%rdi
lea    0xcde(%rip),%rsi
call   1080 <strcspn@plt>
mov    %rax,-0x1b8(%rbp)
jmp    1499 <getModuleFamily+0x2e9>
lea    0xcc8(%rip),%rdi
lea    0xca0(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x198(%rbp)
cmpq   $0x0,-0x198(%rbp)
jne    13a2 <getModuleFamily+0x1f2>
lea    0xcc4(%rip),%rdi
lea    0xc78(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x198(%rbp)
cmpq   $0x0,-0x198(%rbp)
je     1494 <getModuleFamily+0x2e4>
jmp    13b5 <getModuleFamily+0x205>
lea    -0x110(%rbp),%rdi
mov    -0x198(%rbp),%rdx
mov    $0xff,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     1488 <getModuleFamily+0x2d8>
lea    -0x110(%rbp),%rdi
lea    0xc39(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x1a0(%rbp)
cmpq   $0x0,-0x1a0(%rbp)
jne    1415 <getModuleFamily+0x265>
lea    0xc6f(%rip),%rdi
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x1a0(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x1a0(%rbp)
mov    -0x1a0(%rbp),%rdi
lea    0xc51(%rip),%rsi
call   10d0 <strstr@plt>
mov    %rax,-0x1b0(%rbp)
cmpq   $0x0,-0x1b0(%rbp)
je     1470 <getModuleFamily+0x2c0>
mov    -0x1b0(%rbp),%rax
mov    -0x1a0(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
mov    %rax,-0x1b8(%rbp)
jmp    1483 <getModuleFamily+0x2d3>
mov    -0x1a0(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x1b8(%rbp)
jmp    13b5 <getModuleFamily+0x205>
mov    -0x198(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1499 <getModuleFamily+0x2e9>
jmp    14b4 <getModuleFamily+0x304>
lea    0xbe4(%rip),%rdi
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    -0x1a0(%rbp),%rsi
mov    -0x1b8(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xbcb(%rip),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     14f1 <getModuleFamily+0x341>
movl   $0x0,-0x4(%rbp)
jmp    1523 <getModuleFamily+0x373>
mov    -0x10(%rbp),%rdi
lea    0xbad(%rip),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     1517 <getModuleFamily+0x367>
movl   $0x1,-0x4(%rbp)
jmp    1523 <getModuleFamily+0x373>
jmp    151c <getModuleFamily+0x36c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getModuleFamily>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x198,%rsp
mov    %rdi,%r13
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xe07(%rip),%rdi
lea    0xe0e(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     144d <getModuleFamily+0x29d>
mov    %rax,%rbx
lea    0x90(%rsp),%rdi
mov    $0xff,%esi
mov    %rax,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     128f <getModuleFamily+0xdf>
lea    0x97(%rsp),%r14
lea    0xdd6(%rip),%r15
lea    0x90(%rsp),%rbp
lea    0x10(%rsp),%r12
jmp    1265 <getModuleFamily+0xb5>
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    $0xff,%esi
mov    %rbx,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     128f <getModuleFamily+0xdf>
mov    %rbp,%rdi
mov    %r15,%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
je     1250 <getModuleFamily+0xa0>
mov    %r14,%rdi
mov    $0x3a,%esi
call   1070 <strchr@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
jmp    1250 <getModuleFamily+0xa0>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xd7b(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10d0 <strstr@plt>
test   %rax,%rax
je     12dd <getModuleFamily+0x12d>
mov    %rax,%rbx
add    $0x8,%rbx
lea    0xd66(%rip),%rsi
mov    %rbx,%rdi
call   10d0 <strstr@plt>
test   %rax,%rax
je     13b9 <getModuleFamily+0x209>
mov    %rax,%r12
mov    %rbx,%rax
not    %rax
add    %rax,%r12
jmp    13df <getModuleFamily+0x22f>
lea    0xd46(%rip),%rdi
lea    0xd23(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1317 <getModuleFamily+0x167>
lea    0xd4f(%rip),%rdi
lea    0xd08(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
je     1430 <getModuleFamily+0x280>
mov    %r13,0x8(%rsp)
lea    0x90(%rsp),%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     13cd <getModuleFamily+0x21d>
lea    0xcd8(%rip),%r13
lea    0x90(%rsp),%rbp
lea    0xd31(%rip),%r14
jmp    1380 <getModuleFamily+0x1d0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %rax,%r12
mov    %rbp,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     13d2 <getModuleFamily+0x222>
mov    %rbp,%rdi
mov    %r13,%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
je     1437 <getModuleFamily+0x287>
mov    %rax,%rbx
add    $0x8,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
je     1360 <getModuleFamily+0x1b0>
mov    %rax,%r12
mov    %rbx,%rax
not    %rax
add    %rax,%r12
jmp    136b <getModuleFamily+0x1bb>
lea    0xc68(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcspn@plt>
mov    %rax,%r12
jmp    13df <getModuleFamily+0x22f>
xor    %ebx,%ebx
xor    %r12d,%r12d
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    0x8(%rsp),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1030 <strncpy@plt>
lea    0xca8(%rip),%rsi
mov    %r13,%rdi
call   10d0 <strstr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    141e <getModuleFamily+0x26e>
lea    0xc97(%rip),%rsi
mov    %r13,%rdi
call   10d0 <strstr@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
or     $0x1,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
xor    %r12d,%r12d
jmp    13df <getModuleFamily+0x22f>
lea    0xc32(%rip),%rdi
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
lea    0xc30(%rip),%rdi
jmp    143e <getModuleFamily+0x28e>

LLVM IR (-O0):
@.str = [14 x i8] c"/proc/cpuinfo\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"Hardware\00"
@.str.3 = [2 x i8] c":\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [8 x i8] c"Toradex\00"
@.str.6 = [7 x i8] c"Module\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [36 x i8] c"/sys/firmware/devicetree/base/model\00"
@.str.9 = [34 x i8] c"/sys/bus/soc/devices/soc0/machine\00"
@.str.10 = [17 x i8] c"Invalid Machine!\00"
@.str.11 = [3 x i8] c"on\00"
@.str.12 = [24 x i8] c"CPU info not available!\00"
@.str.13 = [8 x i8] c"Colibri\00"
@.str.14 = [7 x i8] c"Apalis\00"
define i32 @getModuleFamily(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [256 x i8]
%5 = alloca [128 x i8]
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
store i8* %0, i8** %3
%11 = bitcast [128 x i8]* %5 to i8*
store i32* null, i32** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
store i64 0, i64* %10
%12 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %6
%13 = load i32*, i32** %6
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %103
15: ; preds = %1
br label %16
16: ; preds = %31, %15
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%18 = load i32*, i32** %6
%19 = call i64 @fgets(i8* %17, i32 255, i32* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %32
21: ; preds = %16
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%23 = call i8* @strstr(i8* %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %31
25: ; preds = %21
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 7
%27 = call i8* @strstr(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %27, i8** %8
%28 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%29 = load i8*, i8** %8
%30 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %25, %21
br label %16
32: ; preds = %16
%33 = load i32*, i32** %6
%34 = call i32 @fclose(i32* %33)
%35 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%36 = call i8* @strstr(i8* %35, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
store i8* %36, i8** %7
%37 = load i8*, i8** %7
%38 = icmp ne i8* %37, null
br i1 %38, label %39, label %57
39: ; preds = %32
%40 = load i8*, i8** %7
%41 = getelementptr inbounds i8, i8* %40, i64 8
store i8* %41, i8** %7
%42 = load i8*, i8** %7
%43 = call i8* @strstr(i8* %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
store i8* %43, i8** %9
%44 = load i8*, i8** %9
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %53
46: ; preds = %39
%47 = load i8*, i8** %9
%48 = load i8*, i8** %7
%49 = ptrtoint i8* %47 to i64
%50 = ptrtoint i8* %48 to i64
%51 = sub i64 %49, %50
%52 = sub nsw i64 %51, 1
store i64 %52, i64* %10
br label %56
53: ; preds = %39
%54 = load i8*, i8** %7
%55 = call i64 @strcspn(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i64 %55, i64* %10
br label %56
56: ; preds = %53, %46
br label %102
57: ; preds = %32
%58 = call i32* @fopen(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %58, i32** %6
%59 = load i32*, i32** %6
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = call i32* @fopen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %62, i32** %6
br label %63
63: ; preds = %61, %57
%64 = load i32*, i32** %6
%65 = icmp ne i32* %64, null
br i1 %65, label %66, label %101
66: ; preds = %63
br label %67
67: ; preds = %97, %66
%68 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%69 = load i32*, i32** %6
%70 = call i64 @fgets(i8* %68, i32 255, i32* %69)
%71 = icmp ne i64 %70, 0
br i1 %71, label %72, label %98
72: ; preds = %67
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%74 = call i8* @strstr(i8* %73, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
store i8* %74, i8** %7
%75 = load i8*, i8** %7
%76 = icmp eq i8* %75, null
br i1 %76, label %77, label %80
77: ; preds = %72
%78 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
%79 = call i32 @exit(i32 -1)
unreachable
80: ; preds = %72
%81 = load i8*, i8** %7
%82 = getelementptr inbounds i8, i8* %81, i64 8
store i8* %82, i8** %7
%83 = load i8*, i8** %7
%84 = call i8* @strstr(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
store i8* %84, i8** %9
%85 = load i8*, i8** %9
%86 = icmp ne i8* %85, null
br i1 %86, label %87, label %94
87: ; preds = %80
%88 = load i8*, i8** %9
%89 = load i8*, i8** %7
%90 = ptrtoint i8* %88 to i64
%91 = ptrtoint i8* %89 to i64
%92 = sub i64 %90, %91
%93 = sub nsw i64 %92, 1
store i64 %93, i64* %10
br label %97
94: ; preds = %80
%95 = load i8*, i8** %7
%96 = call i64 @strlen(i8* %95)
store i64 %96, i64* %10
br label %97
97: ; preds = %94, %87
br label %67
98: ; preds = %67
%99 = load i32*, i32** %6
%100 = call i32 @fclose(i32* %99)
br label %101
101: ; preds = %98, %63
br label %102
102: ; preds = %101, %56
br label %106
103: ; preds = %1
%104 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0))
%105 = call i32 @exit(i32 -1)
unreachable
106: ; preds = %102
%107 = load i8*, i8** %3
%108 = load i8*, i8** %7
%109 = load i64, i64* %10
%110 = call i32 @strncpy(i8* %107, i8* %108, i64 %109)
%111 = load i8*, i8** %3
%112 = call i8* @strstr(i8* %111, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%113 = icmp ne i8* %112, null
br i1 %113, label %114, label %115
114: ; preds = %106
store i32 0, i32* %2
br label %122
115: ; preds = %106
%116 = load i8*, i8** %3
%117 = call i8* @strstr(i8* %116, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%118 = icmp ne i8* %117, null
br i1 %118, label %119, label %120
119: ; preds = %115
store i32 1, i32* %2
br label %122
120: ; preds = %115
br label %121
121: ; preds = %120
store i32 -1, i32* %2
br label %122
122: ; preds = %121, %119, %114
%123 = load i32, i32* %2
ret i32 %123
}

LLVM IR (-O2):
@.str = [14 x i8] c"/proc/cpuinfo\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"Hardware\00"
@.str.5 = [8 x i8] c"Toradex\00"
@.str.6 = [7 x i8] c"Module\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [36 x i8] c"/sys/firmware/devicetree/base/model\00"
@.str.9 = [34 x i8] c"/sys/bus/soc/devices/soc0/machine\00"
@.str.10 = [17 x i8] c"Invalid Machine!\00"
@.str.11 = [3 x i8] c"on\00"
@.str.12 = [24 x i8] c"CPU info not available!\00"
@.str.13 = [8 x i8] c"Colibri\00"
@.str.14 = [7 x i8] c"Apalis\00"
define i32 @getModuleFamily(i8* %0) {
%2 = alloca [256 x i8]
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %72, label %8
8: ; preds = %1
%9 = call i64 @fgets(i8* %4, i32 255, i32* %6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %22, label %11
11: ; preds = %8
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 7
br label %13
13: ; preds = %11, %19
%14 = call i8* @strstr(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i8* %14, null
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = call i8* @strchr(i8* %12, i32 58)
%18 = call i8* @strcpy(i8* %5, i8* dereferenceable(1) %17)
br label %19
19: ; preds = %16, %13
%20 = call i64 @fgets(i8* %4, i32 255, i32* %6)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %13
22: ; preds = %19, %8
%23 = call i32 @fclose(i32* %6)
%24 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i8* %24, null
br i1 %25, label %37, label %26
26: ; preds = %22
%27 = getelementptr inbounds i8, i8* %24, i64 8
%28 = call i8* @strstr(i8* %27, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%29 = icmp eq i8* %28, null
br i1 %29, label %35, label %30
30: ; preds = %26
%31 = ptrtoint i8* %28 to i64
%32 = ptrtoint i8* %27 to i64
%33 = xor i64 %32, -1
%34 = add i64 %31, %33
br label %75
35: ; preds = %26
%36 = call i64 @strcspn(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %75
37: ; preds = %22
%38 = call i32* @fopen(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%39 = icmp eq i32* %38, null
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = call i32* @fopen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%42 = icmp eq i32* %41, null
br i1 %42, label %75, label %43
43: ; preds = %37, %40
%44 = phi i32* [ %41, %40 ], [ %38, %37 ]
%45 = call i64 @fgets(i8* %4, i32 255, i32* %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %68, label %47
47: ; preds = %43, %64
%48 = call i8* @strstr(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp eq i8* %48, null
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
%52 = call i32 @exit(i32 -1)
unreachable
53: ; preds = %47
%54 = getelementptr inbounds i8, i8* %48, i64 8
%55 = call i8* @strstr(i8* %54, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%56 = icmp eq i8* %55, null
br i1 %56, label %62, label %57
57: ; preds = %53
%58 = ptrtoint i8* %55 to i64
%59 = ptrtoint i8* %54 to i64
%60 = xor i64 %59, -1
%61 = add i64 %58, %60
br label %64
62: ; preds = %53
%63 = call i64 @strlen(i8* %54)
br label %64
64: ; preds = %62, %57
%65 = phi i64 [ %61, %57 ], [ %63, %62 ]
%66 = call i64 @fgets(i8* %4, i32 255, i32* %44)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %47
68: ; preds = %64, %43
%69 = phi i8* [ null, %43 ], [ %54, %64 ]
%70 = phi i64 [ 0, %43 ], [ %65, %64 ]
%71 = call i32 @fclose(i32* %44)
br label %75
72: ; preds = %1
%73 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0))
%74 = tail call i32 @exit(i32 -1)
unreachable
75: ; preds = %35, %30, %68, %40
%76 = phi i8* [ %27, %30 ], [ %27, %35 ], [ %69, %68 ], [ null, %40 ]
%77 = phi i64 [ %34, %30 ], [ %36, %35 ], [ %70, %68 ], [ 0, %40 ]
%78 = call i32 @strncpy(i8* %0, i8* %76, i64 %77)
%79 = call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%80 = icmp eq i8* %79, null
br i1 %80, label %81, label %85
81: ; preds = %75
%82 = call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%83 = icmp eq i8* %82, null
%84 = select i1 %83, i32 -1, i32 1
br label %85
85: ; preds = %81, %75
%86 = phi i32 [ 0, %75 ], [ %84, %81 ]
ret i32 %86
}