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

/* Variables and functions */
int get_file_length();
int get_file_name();
int get_files_length_path();
int get_info_hash();
int get_peer_id();
int get_piece_length();
int get_pieces();
int is_multi_files();
int /*<<< orphan*/ printf(char *, char *, int);
int read_announce_list();
int read_metafile(char *);
int parse_metafile(char *metafile) {
  int ret;
  ret = read_metafile(metafile);
  if (ret < 0) {
    printf("%s:%d wrong",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/"
           "W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c",
           461);
    return -1;
  }
  ret = read_announce_list();
  if (ret < 0) {
    printf("%s:%d wrong",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/"
           "W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c",
           465);
    return -1;
  }
  ret = is_multi_files();
  if (ret < 0) {
    printf("%s:%d wrong",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/"
           "W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c",
           469);
    return -1;
  }
  ret = get_piece_length();
  if (ret < 0) {
    printf("%s:%d wrong",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/"
           "W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c",
           473);
    return -1;
  }
  ret = get_pieces();
  if (ret < 0) {
    printf("%s:%d wrong",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/"
           "W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c",
           477);
    return -1;
  }
  ret = get_file_name();
  if (ret < 0) {
    printf("%s:%d wrong",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/"
           "W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c",
           481);
    return -1;
  }
  ret = get_files_length_path();
  if (ret < 0) {
    printf("%s:%d wrong",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/"
           "W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c",
           485);
    return -1;
  }
  ret = get_file_length();
  if (ret < 0) {
    printf("%s:%d wrong",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/"
           "W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c",
           489);
    return -1;
  }
  ret = get_info_hash();
  if (ret < 0) {
    printf("%s:%d wrong",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/"
           "W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c",
           493);
    return -1;
  }
  ret = get_peer_id();
  if (ret < 0) {
    printf("%s:%d wrong",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/"
           "W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c",
           495);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<parse_metafile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <read_metafile@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11f6 <parse_metafile+0x46>
lea    0xe27(%rip),%rdi
lea    0xe2c(%rip),%rsi
mov    $0x1cd,%edx
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <parse_metafile+0x245>
mov    $0x0,%al
call   10d0 <read_announce_list@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    122e <parse_metafile+0x7e>
lea    0xdef(%rip),%rdi
lea    0xdf4(%rip),%rsi
mov    $0x1d1,%edx
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <parse_metafile+0x245>
mov    $0x0,%al
call   1080 <is_multi_files@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1266 <parse_metafile+0xb6>
lea    0xdb7(%rip),%rdi
lea    0xdbc(%rip),%rsi
mov    $0x1d5,%edx
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <parse_metafile+0x245>
mov    $0x0,%al
call   1090 <get_piece_length@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    129e <parse_metafile+0xee>
lea    0xd7f(%rip),%rdi
lea    0xd84(%rip),%rsi
mov    $0x1d9,%edx
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <parse_metafile+0x245>
mov    $0x0,%al
call   1050 <get_pieces@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12d6 <parse_metafile+0x126>
lea    0xd47(%rip),%rdi
lea    0xd4c(%rip),%rsi
mov    $0x1dd,%edx
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <parse_metafile+0x245>
mov    $0x0,%al
call   10c0 <get_file_name@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    130e <parse_metafile+0x15e>
lea    0xd0f(%rip),%rdi
lea    0xd14(%rip),%rsi
mov    $0x1e1,%edx
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <parse_metafile+0x245>
mov    $0x0,%al
call   1040 <get_files_length_path@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1346 <parse_metafile+0x196>
lea    0xcd7(%rip),%rdi
lea    0xcdc(%rip),%rsi
mov    $0x1e5,%edx
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <parse_metafile+0x245>
mov    $0x0,%al
call   1030 <get_file_length@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    137e <parse_metafile+0x1ce>
lea    0xc9f(%rip),%rdi
lea    0xca4(%rip),%rsi
mov    $0x1e9,%edx
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <parse_metafile+0x245>
mov    $0x0,%al
call   10a0 <get_info_hash@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    13b6 <parse_metafile+0x206>
lea    0xc67(%rip),%rdi
lea    0xc6c(%rip),%rsi
mov    $0x1ed,%edx
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <parse_metafile+0x245>
mov    $0x0,%al
call   10b0 <get_peer_id@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    13ee <parse_metafile+0x23e>
lea    0xc2f(%rip),%rdi
lea    0xc34(%rip),%rsi
mov    $0x1ef,%edx
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <parse_metafile+0x245>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_metafile>:
push   %rbx
call   1060 <read_metafile@plt>
test   %eax,%eax
js     1226 <parse_metafile+0x76>
xor    %eax,%eax
call   10d0 <read_announce_list@plt>
test   %eax,%eax
js     122d <parse_metafile+0x7d>
xor    %eax,%eax
call   1080 <is_multi_files@plt>
test   %eax,%eax
js     1234 <parse_metafile+0x84>
xor    %eax,%eax
call   1090 <get_piece_length@plt>
test   %eax,%eax
js     123b <parse_metafile+0x8b>
xor    %eax,%eax
call   1050 <get_pieces@plt>
test   %eax,%eax
js     1242 <parse_metafile+0x92>
xor    %eax,%eax
call   10c0 <get_file_name@plt>
test   %eax,%eax
js     1249 <parse_metafile+0x99>
xor    %eax,%eax
call   1040 <get_files_length_path@plt>
test   %eax,%eax
js     1250 <parse_metafile+0xa0>
xor    %eax,%eax
call   1030 <get_file_length@plt>
test   %eax,%eax
js     1257 <parse_metafile+0xa7>
xor    %ebx,%ebx
xor    %eax,%eax
call   10a0 <get_info_hash@plt>
test   %eax,%eax
js     125e <parse_metafile+0xae>
xor    %eax,%eax
call   10b0 <get_peer_id@plt>
test   %eax,%eax
jns    127b <parse_metafile+0xcb>
mov    $0x1ef,%edx
jmp    1263 <parse_metafile+0xb3>
mov    $0x1cd,%edx
jmp    1263 <parse_metafile+0xb3>
mov    $0x1d1,%edx
jmp    1263 <parse_metafile+0xb3>
mov    $0x1d5,%edx
jmp    1263 <parse_metafile+0xb3>
mov    $0x1d9,%edx
jmp    1263 <parse_metafile+0xb3>
mov    $0x1dd,%edx
jmp    1263 <parse_metafile+0xb3>
mov    $0x1e1,%edx
jmp    1263 <parse_metafile+0xb3>
mov    $0x1e5,%edx
jmp    1263 <parse_metafile+0xb3>
mov    $0x1e9,%edx
jmp    1263 <parse_metafile+0xb3>
mov    $0x1ed,%edx
lea    0xd96(%rip),%rdi
lea    0xd9b(%rip),%rsi
call   1070 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%s:%d wrong\00"
@.str.1 = [178 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c\00"
define i32 @parse_metafile(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @read_metafile(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 461)
store i32 -1, i32* %2
br label %66
11: ; preds = %1
%12 = call i32 (...) @read_announce_list()
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 465)
store i32 -1, i32* %2
br label %66
17: ; preds = %11
%18 = call i32 (...) @is_multi_files()
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 469)
store i32 -1, i32* %2
br label %66
23: ; preds = %17
%24 = call i32 (...) @get_piece_length()
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 473)
store i32 -1, i32* %2
br label %66
29: ; preds = %23
%30 = call i32 (...) @get_pieces()
store i32 %30, i32* %4
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 477)
store i32 -1, i32* %2
br label %66
35: ; preds = %29
%36 = call i32 (...) @get_file_name()
store i32 %36, i32* %4
%37 = load i32, i32* %4
%38 = icmp slt i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 481)
store i32 -1, i32* %2
br label %66
41: ; preds = %35
%42 = call i32 (...) @get_files_length_path()
store i32 %42, i32* %4
%43 = load i32, i32* %4
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 485)
store i32 -1, i32* %2
br label %66
47: ; preds = %41
%48 = call i32 (...) @get_file_length()
store i32 %48, i32* %4
%49 = load i32, i32* %4
%50 = icmp slt i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 489)
store i32 -1, i32* %2
br label %66
53: ; preds = %47
%54 = call i32 (...) @get_info_hash()
store i32 %54, i32* %4
%55 = load i32, i32* %4
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 493)
store i32 -1, i32* %2
br label %66
59: ; preds = %53
%60 = call i32 (...) @get_peer_id()
store i32 %60, i32* %4
%61 = load i32, i32* %4
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %59
%64 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 495)
store i32 -1, i32* %2
br label %66
65: ; preds = %59
store i32 0, i32* %2
br label %66
66: ; preds = %65, %63, %57, %51, %45, %39, %33, %27, %21, %15, %9
%67 = load i32, i32* %2
ret i32 %67
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s:%d wrong\00"
@.str.1 = [178 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/arm8686/W7500P-Tau/refs/heads/master/W7500P-Tau-FW/Utilities/BT_C_code/parse_metafile.c\00"
define i32 @parse_metafile(i8* %0) {
%2 = tail call i32 @read_metafile(i8* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %31, label %4
4: ; preds = %1
%5 = tail call i32 (...) @read_announce_list()
%6 = icmp slt i32 %5, 0
br i1 %6, label %31, label %7
7: ; preds = %4
%8 = tail call i32 (...) @is_multi_files()
%9 = icmp slt i32 %8, 0
br i1 %9, label %31, label %10
10: ; preds = %7
%11 = tail call i32 (...) @get_piece_length()
%12 = icmp slt i32 %11, 0
br i1 %12, label %31, label %13
13: ; preds = %10
%14 = tail call i32 (...) @get_pieces()
%15 = icmp slt i32 %14, 0
br i1 %15, label %31, label %16
16: ; preds = %13
%17 = tail call i32 (...) @get_file_name()
%18 = icmp slt i32 %17, 0
br i1 %18, label %31, label %19
19: ; preds = %16
%20 = tail call i32 (...) @get_files_length_path()
%21 = icmp slt i32 %20, 0
br i1 %21, label %31, label %22
22: ; preds = %19
%23 = tail call i32 (...) @get_file_length()
%24 = icmp slt i32 %23, 0
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = tail call i32 (...) @get_info_hash()
%27 = icmp slt i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = tail call i32 (...) @get_peer_id()
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %28, %25, %22, %19, %16, %13, %10, %7, %4, %1
%32 = phi i32 [ 461, %1 ], [ 465, %4 ], [ 469, %7 ], [ 473, %10 ], [ 477, %13 ], [ 481, %16 ], [ 485, %19 ], [ 489, %22 ], [ 493, %25 ], [ 495, %28 ]
%33 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %28
%35 = phi i32 [ 0, %28 ], [ -1, %31 ]
ret i32 %35
}