#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*/ SEEK_SET;
scalar_t__ calloc(scalar_t__, int);
scalar_t__ ferror(int /*<<< orphan*/ *);
int find_country(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
char *get_mirrors(int /*<<< orphan*/ *);
char *ltrim(char *, char);
char *malloc(int);
char *next_entry(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
char *rtrim(char *, char);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ str_toupper(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *strstr(char *, char *);
char *strtok(char *, char *);
char *trim(char *, char);
int build_country_file(FILE *config_p, FILE *infile_p, FILE *mirror_list,
                       char *country_list) {
  char *country_code;
  char *inputline;
  char *token;
  int infilePos;
  char *dirs;
  char *aliasList;
  char *dst;
  char *mirrorData;
  int found = 0;
  str_toupper(country_list);
  country_code = strtok(country_list, ",");
  while (country_code != NULL) {
    if (find_country(mirror_list, country_code) == 1) {
      fprintf(stderr, "Couldn't find country %s. Skipping.\n", country_code);
      found = 0;
    } else {
      found = 1;
    }
    if (found == 1) {
      inputline = malloc(180);
      while ((inputline = get_mirrors(mirror_list)) != NULL) {
        if (strstr(inputline, "  (") == NULL) {
          infilePos = ftell(infile_p);
          fputs(inputline, infile_p);
          if (ferror(infile_p)) {
            free(country_code);
            free(inputline);
            return 1;
          }
        } else {
          fseek(infile_p, infilePos, SEEK_SET);
          mirrorData = next_entry(infile_p);
          aliasList = trim(inputline, ' ');
          aliasList = ltrim(aliasList, '(');
          aliasList = rtrim(aliasList, ')');
          dirs = strstr(mirrorData, ":");
          token = strtok(aliasList, ", ");
          while (token != NULL) {
            dst = (char *)calloc(strlen(token) + strlen(mirrorData) + 1,
                                 sizeof(char));
            strcpy(dst, token);
            strcat(dst, dirs);
            fputs(dst, infile_p);
            token = strtok(NULL, ", ");
            printf("--- %s\n", dst);
            free(dst);
          }
        }
      }
      free(inputline);
    }
    country_code = strtok(NULL, ",");
  }
  free(country_code);
  if (found == 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<build_country_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x28(%rbp),%rdi
call   1140 <str_toupper@plt>
mov    -0x28(%rbp),%rdi
lea    0xd7a(%rip),%rsi
call   1130 <strtok@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     14b3 <build_country_file+0x263>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1160 <find_country@plt>
cmp    $0x1,%eax
jne    12d5 <build_country_file+0x85>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xd3e(%rip),%rsi
call   10d0 <fprintf@plt>
movl   $0x0,-0x6c(%rbp)
jmp    12dc <build_country_file+0x8c>
movl   $0x1,-0x6c(%rbp)
cmpl   $0x1,-0x6c(%rbp)
jne    149a <build_country_file+0x24a>
mov    $0xb4,%edi
call   1100 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1090 <get_mirrors@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     1491 <build_country_file+0x241>
mov    -0x38(%rbp),%rdi
lea    0xd11(%rip),%rsi
call   1170 <strstr@plt>
cmp    $0x0,%rax
jne    1374 <build_country_file+0x124>
mov    -0x18(%rbp),%rdi
call   10e0 <ftell@plt>
mov    %eax,-0x44(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <fputs@plt>
mov    -0x18(%rbp),%rdi
call   1050 <ferror@plt>
cmp    $0x0,%rax
je     136f <build_country_file+0x11f>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    14d9 <build_country_file+0x289>
jmp    148c <build_country_file+0x23c>
mov    -0x18(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    0x2c56(%rip),%rax
mov    (%rax),%edx
call   1110 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1120 <next_entry@plt>
mov    %rax,-0x68(%rbp)
mov    -0x38(%rbp),%rdi
mov    $0x20,%esi
call   1080 <trim@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    $0x28,%esi
call   10f0 <ltrim@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    $0x29,%esi
call   10c0 <rtrim@plt>
mov    %rax,-0x58(%rbp)
mov    -0x68(%rbp),%rdi
lea    0xc54(%rip),%rsi
call   1170 <strstr@plt>
mov    %rax,-0x50(%rbp)
mov    -0x58(%rbp),%rdi
lea    0xc42(%rip),%rsi
call   1130 <strtok@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     1487 <build_country_file+0x237>
mov    -0x40(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x78(%rbp)
mov    -0x68(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x78(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   10b0 <calloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x60(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   1150 <strcat@plt>
mov    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <fputs@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xbcd(%rip),%rsi
call   1130 <strtok@plt>
mov    %rax,-0x40(%rbp)
mov    -0x60(%rbp),%rsi
lea    0xbbc(%rip),%rdi
call   1070 <printf@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
jmp    13f4 <build_country_file+0x1a4>
jmp    148c <build_country_file+0x23c>
jmp    12f4 <build_country_file+0xa4>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xb5b(%rip),%rsi
call   1130 <strtok@plt>
mov    %rax,-0x30(%rbp)
jmp    128f <build_country_file+0x3f>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x6c(%rbp)
jne    14d2 <build_country_file+0x282>
movl   $0x1,-0x4(%rbp)
jmp    14d9 <build_country_file+0x289>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_country_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%rbp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rcx,%rdi
call   1140 <str_toupper@plt>
lea    0xd8a(%rip),%rsi
mov    %rbp,%rdi
call   1130 <strtok@plt>
test   %rax,%rax
je     149a <build_country_file+0x24a>
lea    0xd99(%rip),%r15
lea    0xd96(%rip),%r13
mov    %r14,0x20(%rsp)
mov    %rbx,0x10(%rsp)
jmp    12e1 <build_country_file+0x91>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
lea    0xd42(%rip),%rsi
mov    %rbp,%rdx
call   10e0 <fprintf@plt>
xor    %ebp,%ebp
xor    %edi,%edi
lea    0xd2d(%rip),%rsi
call   1130 <strtok@plt>
test   %rax,%rax
je     149c <build_country_file+0x24c>
mov    %r14,%rdi
mov    %rax,%rsi
mov    %rax,%rbp
call   1160 <find_country@plt>
cmp    $0x1,%eax
je     12b0 <build_country_file+0x60>
mov    %rbp,0x18(%rsp)
jmp    1328 <build_country_file+0xd8>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10f0 <ftell@plt>
mov    %eax,0xc(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10b0 <fputs@plt>
mov    %rbx,%rdi
call   1050 <ferror@plt>
test   %rax,%rax
jne    1481 <build_country_file+0x231>
mov    %r14,%rdi
call   10a0 <get_mirrors@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1470 <build_country_file+0x220>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1170 <strstr@plt>
test   %rax,%rax
je     1300 <build_country_file+0xb0>
mov    0x2c85(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    0xc(%rsp),%esi
call   1110 <fseek@plt>
mov    %rbx,%r15
mov    %rbx,%rdi
call   1120 <next_entry@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
mov    $0x20,%esi
call   1090 <trim@plt>
mov    %rax,%rdi
mov    $0x28,%esi
call   1100 <ltrim@plt>
mov    %rax,%rdi
mov    $0x29,%esi
call   10d0 <rtrim@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1070 <strchr@plt>
mov    %r13,%rsi
mov    %rax,%r12
mov    %rbp,%rdi
call   1130 <strtok@plt>
test   %rax,%rax
je     1460 <build_country_file+0x210>
mov    %rax,%rbp
lea    0xc67(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   10c0 <calloc@plt>
mov    %rbx,%r15
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1150 <strcat@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   10b0 <fputs@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1130 <strtok@plt>
mov    %rax,%rbp
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rbx
call   1030 <free@plt>
test   %rbp,%rbp
jne    13d0 <build_country_file+0x180>
mov    0x20(%rsp),%r14
lea    0xbd5(%rip),%r15
mov    0x10(%rsp),%rbx
jmp    1328 <build_country_file+0xd8>
nopl   0x0(%rax)
mov    %r15,%rbx
lea    0xbbd(%rip),%r15
jmp    1328 <build_country_file+0xd8>
nop
xor    %edi,%edi
call   1030 <free@plt>
mov    $0x1,%ebp
jmp    12ca <build_country_file+0x7a>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    $0x1,%eax
jmp    14aa <build_country_file+0x25a>
xor    %ebp,%ebp
xor    %edi,%edi
call   1030 <free@plt>
xor    %eax,%eax
test   %ebp,%ebp
sete   %al
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c",\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"Couldn't find country %s. Skipping.\0A\00"
@.str.2 = [4 x i8] c" (\00"
@SEEK_SET = global i32 0
@.str.3 = [2 x i8] c":\00"
@.str.4 = [3 x i8] c", \00"
@.str.5 = [8 x i8] c"--- %s\0A\00"
define i32 @build_country_file(i32* %0, i32* %1, i32* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i8* %3, i8** %9
store i32 0, i32* %18
%19 = load i8*, i8** %9
%20 = call i32 @str_toupper(i8* %19)
%21 = load i8*, i8** %9
%22 = call i8* @strtok(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %22, i8** %10
br label %23
23: ; preds = %112, %4
%24 = load i8*, i8** %10
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %114
26: ; preds = %23
%27 = load i32*, i32** %8
%28 = load i8*, i8** %10
%29 = call i32 @find_country(i32* %27, i8* %28)
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %35
31: ; preds = %26
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %10
%34 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %33)
store i32 0, i32* %18
br label %36
35: ; preds = %26
store i32 1, i32* %18
br label %36
36: ; preds = %35, %31
%37 = load i32, i32* %18
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %112
39: ; preds = %36
%40 = call i8* @malloc(i32 180)
store i8* %40, i8** %11
br label %41
41: ; preds = %108, %39
%42 = load i32*, i32** %8
%43 = call i8* @get_mirrors(i32* %42)
store i8* %43, i8** %11
%44 = icmp ne i8* %43, null
br i1 %44, label %45, label %109
45: ; preds = %41
%46 = load i8*, i8** %11
%47 = call i8* @strstr(i8* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%48 = icmp eq i8* %47, null
br i1 %48, label %49, label %64
49: ; preds = %45
%50 = load i32*, i32** %7
%51 = call i32 @ftell(i32* %50)
store i32 %51, i32* %13
%52 = load i8*, i8** %11
%53 = load i32*, i32** %7
%54 = call i32 @fputs(i8* %52, i32* %53)
%55 = load i32*, i32** %7
%56 = call i64 @ferror(i32* %55)
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %63
58: ; preds = %49
%59 = load i8*, i8** %10
%60 = call i32 @free(i8* %59)
%61 = load i8*, i8** %11
%62 = call i32 @free(i8* %61)
store i32 1, i32* %5
br label %121
63: ; preds = %49
br label %108
64: ; preds = %45
%65 = load i32*, i32** %7
%66 = load i32, i32* %13
%67 = load i32, i32* @SEEK_SET
%68 = call i32 @fseek(i32* %65, i32 %66, i32 %67)
%69 = load i32*, i32** %7
%70 = call i8* @next_entry(i32* %69)
store i8* %70, i8** %17
%71 = load i8*, i8** %11
%72 = call i8* @trim(i8* %71, i8 signext 32)
store i8* %72, i8** %15
%73 = load i8*, i8** %15
%74 = call i8* @ltrim(i8* %73, i8 signext 40)
store i8* %74, i8** %15
%75 = load i8*, i8** %15
%76 = call i8* @rtrim(i8* %75, i8 signext 41)
store i8* %76, i8** %15
%77 = load i8*, i8** %17
%78 = call i8* @strstr(i8* %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %78, i8** %14
%79 = load i8*, i8** %15
%80 = call i8* @strtok(i8* %79, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i8* %80, i8** %12
br label %81
81: ; preds = %84, %64
%82 = load i8*, i8** %12
%83 = icmp ne i8* %82, null
br i1 %83, label %84, label %107
84: ; preds = %81
%85 = load i8*, i8** %12
%86 = call i64 @strlen(i8* %85)
%87 = load i8*, i8** %17
%88 = call i64 @strlen(i8* %87)
%89 = add nsw i64 %86, %88
%90 = add nsw i64 %89, 1
%91 = call i64 @calloc(i64 %90, i32 1)
%92 = inttoptr i64 %91 to i8*
store i8* %92, i8** %16
%93 = load i8*, i8** %16
%94 = load i8*, i8** %12
%95 = call i32 @strcpy(i8* %93, i8* %94)
%96 = load i8*, i8** %16
%97 = load i8*, i8** %14
%98 = call i32 @strcat(i8* %96, i8* %97)
%99 = load i8*, i8** %16
%100 = load i32*, i32** %7
%101 = call i32 @fputs(i8* %99, i32* %100)
%102 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i8* %102, i8** %12
%103 = load i8*, i8** %16
%104 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %103)
%105 = load i8*, i8** %16
%106 = call i32 @free(i8* %105)
br label %81
107: ; preds = %81
br label %108
108: ; preds = %107, %63
br label %41
109: ; preds = %41
%110 = load i8*, i8** %11
%111 = call i32 @free(i8* %110)
br label %112
112: ; preds = %109, %36
%113 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %113, i8** %10
br label %23
114: ; preds = %23
%115 = load i8*, i8** %10
%116 = call i32 @free(i8* %115)
%117 = load i32, i32* %18
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %120
119: ; preds = %114
store i32 1, i32* %5
br label %121
120: ; preds = %114
store i32 0, i32* %5
br label %121
121: ; preds = %120, %119, %58
%122 = load i32, i32* %5
ret i32 %122
}

LLVM IR (-O2):
@.str = [2 x i8] c",\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"Couldn't find country %s. Skipping.\0A\00"
@.str.2 = [4 x i8] c" (\00"
@SEEK_SET = global i32 0
@.str.4 = [3 x i8] c", \00"
@.str.5 = [8 x i8] c"--- %s\0A\00"
define i32 @build_country_file(i32* nocapture readnone %0, i32* %1, i32* %2, i8* %3) {
%5 = tail call i32 @str_toupper(i8* %3)
%6 = tail call i8* @strtok(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i8* %6, null
br i1 %7, label %69, label %8
8: ; preds = %4, %64
%9 = phi i8* [ %67, %64 ], [ %6, %4 ]
%10 = phi i32 [ %66, %64 ], [ undef, %4 ]
%11 = tail call i32 @find_country(i32* %2, i8* %9)
%12 = icmp eq i32 %11, 1
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = tail call i8* @get_mirrors(i32* %2)
%15 = icmp eq i8* %14, null
br i1 %15, label %61, label %19
16: ; preds = %8
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %64
19: ; preds = %13, %57
%20 = phi i8* [ %59, %57 ], [ %14, %13 ]
%21 = phi i32 [ %58, %57 ], [ %10, %13 ]
%22 = tail call i8* @strstr(i8* %20, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %32
24: ; preds = %19
%25 = tail call i32 @ftell(i32* %1)
%26 = tail call i32 @fputs(i8* %20, i32* %1)
%27 = tail call i64 @ferror(i32* %1)
%28 = icmp eq i64 %27, 0
br i1 %28, label %57, label %29
29: ; preds = %24
%30 = tail call i32 @free(i8* %9)
%31 = tail call i32 @free(i8* %20)
br label %74
32: ; preds = %19
%33 = load i32, i32* @SEEK_SET
%34 = tail call i32 @fseek(i32* %1, i32 %21, i32 %33)
%35 = tail call i8* @next_entry(i32* %1)
%36 = tail call i8* @trim(i8* %20, i8 signext 32)
%37 = tail call i8* @ltrim(i8* %36, i8 signext 40)
%38 = tail call i8* @rtrim(i8* %37, i8 signext 41)
%39 = tail call i8* @strchr(i8* dereferenceable(1) %35, i32 58)
%40 = tail call i8* @strtok(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp eq i8* %40, null
br i1 %41, label %57, label %42
42: ; preds = %32, %42
%43 = phi i8* [ %53, %42 ], [ %40, %32 ]
%44 = tail call i64 @strlen(i8* %43)
%45 = tail call i64 @strlen(i8* dereferenceable(1) %35)
%46 = add i64 %44, 1
%47 = add i64 %46, %45
%48 = tail call i64 @calloc(i64 %47, i32 1)
%49 = inttoptr i64 %48 to i8*
%50 = tail call i32 @strcpy(i8* %49, i8* %43)
%51 = tail call i32 @strcat(i8* %49, i8* %39)
%52 = tail call i32 @fputs(i8* %49, i32* %1)
%53 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%54 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %49)
%55 = tail call i32 @free(i8* %49)
%56 = icmp eq i8* %53, null
br i1 %56, label %57, label %42
57: ; preds = %42, %32, %24
%58 = phi i32 [ %25, %24 ], [ %21, %32 ], [ %21, %42 ]
%59 = tail call i8* @get_mirrors(i32* %2)
%60 = icmp eq i8* %59, null
br i1 %60, label %61, label %19
61: ; preds = %57, %13
%62 = phi i32 [ %10, %13 ], [ %58, %57 ]
%63 = tail call i32 @free(i8* null)
br label %64
64: ; preds = %16, %61
%65 = phi i32 [ 1, %61 ], [ 0, %16 ]
%66 = phi i32 [ %62, %61 ], [ %10, %16 ]
%67 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%68 = icmp eq i8* %67, null
br i1 %68, label %69, label %8
69: ; preds = %64, %4
%70 = phi i32 [ 0, %4 ], [ %65, %64 ]
%71 = tail call i32 @free(i8* null)
%72 = icmp eq i32 %70, 0
%73 = zext i1 %72 to i32
br label %74
74: ; preds = %69, %29
%75 = phi i32 [ 1, %29 ], [ %73, %69 ]
ret i32 %75
}