#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*/ buf;
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*/ fieldcpy(char *, char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
scalar_t__ strncasecmp(char *, char *, int);
void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile, char *fieldname,
                     char **in_pkgs, int pkgc) {
  char buf[1000];
  char cur_field[1000];
  char cur_pkg[1000];
  char cur_ver[1000];
  char cur_arch[1000];
  char cur_size[1000];
  char cur_md5[1000];
  char cur_filename[1000];
  char *pkgs[100];
  int i;
  FILE *f;
  cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_filename[0] = '\0';
  for (i = 0; i < pkgc; i++)
    pkgs[i] = in_pkgs[i];
  f = fopen(pkgsfile, "r");
  if (f == NULL) {
    perror(pkgsfile);
    exit(1);
  }
  while (fgets(buf, sizeof(buf), f)) {
    if (*buf && buf[strlen(buf) - 1] == '\n')
      buf[strlen(buf) - 1] = '\0';
    if (strncasecmp(buf, fieldname, strlen(fieldname)) == 0) {
      fieldcpy(cur_field, buf);
    }
    if (strncasecmp(buf, "Package:", 8) == 0) {
      fieldcpy(cur_pkg, buf);
    } else if (strncasecmp(buf, "Version:", 8) == 0) {
      fieldcpy(cur_ver, buf);
    } else if (strncasecmp(buf, "Architecture:", 13) == 0) {
      fieldcpy(cur_arch, buf);
    } else if (strncasecmp(buf, "Size:", 5) == 0) {
      fieldcpy(cur_size, buf);
    } else if (strncasecmp(buf, "MD5sum:", 7) == 0) {
      fieldcpy(cur_md5, buf);
    } else if (strncasecmp(buf, "Filename:", 9) == 0) {
      fieldcpy(cur_filename, buf);
    } else if (!*buf) {
      int any = 0;
      for (i = 0; i < pkgc; i++) {
        if (!pkgs[i])
          continue;
        any = 1;
        if (strcmp(cur_field, pkgs[i]) == 0) {
          printf("%s %s %s %s %s %s %s\n", cur_pkg, cur_ver, cur_arch, mirror,
                 cur_filename, cur_md5, cur_size);
          if (uniq)
            pkgs[i] = NULL;
          break;
        }
      }
      if (!any)
        break;
    }
  }
  fclose(f);
  if (uniq) {
    for (i = 0; i < pkgc; i++) {
      if (pkgs[i]) {
        printf("%s -\n", pkgs[i]);
      }
    }
  }
}


x86 assembly (clang, -O0):
<dopkgmirrorpkgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2310,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movb   $0x0,-0x1fb0(%rbp)
movb   $0x0,-0x13e0(%rbp)
movb   $0x0,-0xff0(%rbp)
movb   $0x0,-0xc00(%rbp)
movl   $0x0,-0x22d4(%rbp)
mov    -0x22d4(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1229 <dopkgmirrorpkgs+0x89>
mov    -0x28(%rbp),%rax
movslq -0x22d4(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
movslq -0x22d4(%rbp),%rax
mov    %rcx,-0x22d0(%rbp,%rax,8)
ff
mov    -0x22d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x22d4(%rbp)
jmp    11e8 <dopkgmirrorpkgs+0x48>
mov    -0x18(%rbp),%rdi
lea    0xdcc(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x22e0(%rbp)
cmpq   $0x0,-0x22e0(%rbp)
jne    1261 <dopkgmirrorpkgs+0xc1>
mov    -0x18(%rbp),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
jmp    1266 <dopkgmirrorpkgs+0xc6>
lea    -0x420(%rbp),%rdi
mov    -0x22e0(%rbp),%rdx
mov    $0x3e8,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     15b7 <dopkgmirrorpkgs+0x417>
movsbl -0x420(%rbp),%eax
cmp    $0x0,%eax
je     12d3 <dopkgmirrorpkgs+0x133>
lea    -0x420(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x420(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    12d3 <dopkgmirrorpkgs+0x133>
lea    -0x420(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x420(%rbp,%rax,1)
lea    -0x420(%rbp),%rax
mov    %rax,-0x22f8(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x22f0(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x22f8(%rbp),%rdi
mov    -0x22f0(%rbp),%rsi
mov    %eax,%edx
call   1080 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1327 <dopkgmirrorpkgs+0x187>
lea    -0x810(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   10c0 <fieldcpy@plt>
lea    -0x420(%rbp),%rdi
lea    0xccd(%rip),%rsi
mov    $0x8,%edx
call   1080 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1361 <dopkgmirrorpkgs+0x1c1>
lea    -0xc00(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   10c0 <fieldcpy@plt>
jmp    15b2 <dopkgmirrorpkgs+0x412>
lea    -0x420(%rbp),%rdi
lea    0xc9c(%rip),%rsi
mov    $0x8,%edx
call   1080 <strncasecmp@plt>
cmp    $0x0,%rax
jne    139b <dopkgmirrorpkgs+0x1fb>
lea    -0xff0(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   10c0 <fieldcpy@plt>
jmp    15ad <dopkgmirrorpkgs+0x40d>
lea    -0x420(%rbp),%rdi
lea    0xc6b(%rip),%rsi
mov    $0xd,%edx
call   1080 <strncasecmp@plt>
cmp    $0x0,%rax
jne    13d5 <dopkgmirrorpkgs+0x235>
lea    -0x13e0(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   10c0 <fieldcpy@plt>
jmp    15a8 <dopkgmirrorpkgs+0x408>
lea    -0x420(%rbp),%rdi
lea    0xc3f(%rip),%rsi
mov    $0x5,%edx
call   1080 <strncasecmp@plt>
cmp    $0x0,%rax
jne    140f <dopkgmirrorpkgs+0x26f>
lea    -0x17d0(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   10c0 <fieldcpy@plt>
jmp    15a3 <dopkgmirrorpkgs+0x403>
lea    -0x420(%rbp),%rdi
lea    0xc0b(%rip),%rsi
mov    $0x7,%edx
call   1080 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1449 <dopkgmirrorpkgs+0x2a9>
lea    -0x1bc0(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   10c0 <fieldcpy@plt>
jmp    159e <dopkgmirrorpkgs+0x3fe>
lea    -0x420(%rbp),%rdi
lea    0xbd9(%rip),%rsi
mov    $0x9,%edx
call   1080 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1483 <dopkgmirrorpkgs+0x2e3>
lea    -0x1fb0(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   10c0 <fieldcpy@plt>
jmp    1599 <dopkgmirrorpkgs+0x3f9>
cmpb   $0x0,-0x420(%rbp)
jne    1594 <dopkgmirrorpkgs+0x3f4>
movl   $0x0,-0x22e4(%rbp)
movl   $0x0,-0x22d4(%rbp)
mov    -0x22d4(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    157d <dopkgmirrorpkgs+0x3dd>
movslq -0x22d4(%rbp),%rax
cmpq   $0x0,-0x22d0(%rbp,%rax,8)
jne    14ce <dopkgmirrorpkgs+0x32e>
jmp    1569 <dopkgmirrorpkgs+0x3c9>
movl   $0x1,-0x22e4(%rbp)
lea    -0x810(%rbp),%rdi
movslq -0x22d4(%rbp),%rax
mov    -0x22d0(%rbp,%rax,8),%rsi
ff
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1564 <dopkgmirrorpkgs+0x3c4>
lea    -0xc00(%rbp),%rsi
lea    -0xff0(%rbp),%rdx
lea    -0x13e0(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    -0x1fb0(%rbp),%r9
lea    -0x1bc0(%rbp),%r10
lea    -0x17d0(%rbp),%rax
lea    0xb08(%rip),%rdi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
je     155f <dopkgmirrorpkgs+0x3bf>
movslq -0x22d4(%rbp),%rax
movq   $0x0,-0x22d0(%rbp,%rax,8)
jmp    157d <dopkgmirrorpkgs+0x3dd>
jmp    1569 <dopkgmirrorpkgs+0x3c9>
mov    -0x22d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x22d4(%rbp)
jmp    14a4 <dopkgmirrorpkgs+0x304>
cmpl   $0x0,-0x22e4(%rbp)
jne    158f <dopkgmirrorpkgs+0x3ef>
jmp    15b7 <dopkgmirrorpkgs+0x417>
jmp    1594 <dopkgmirrorpkgs+0x3f4>
jmp    1599 <dopkgmirrorpkgs+0x3f9>
jmp    159e <dopkgmirrorpkgs+0x3fe>
jmp    15a3 <dopkgmirrorpkgs+0x403>
jmp    15a8 <dopkgmirrorpkgs+0x408>
jmp    15ad <dopkgmirrorpkgs+0x40d>
jmp    15b2 <dopkgmirrorpkgs+0x412>
jmp    1266 <dopkgmirrorpkgs+0xc6>
mov    -0x22e0(%rbp),%rdi
call   1030 <fclose@plt>
cmpl   $0x0,-0x4(%rbp)
je     1637 <dopkgmirrorpkgs+0x497>
movl   $0x0,-0x22d4(%rbp)
mov    -0x22d4(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1632 <dopkgmirrorpkgs+0x492>
movslq -0x22d4(%rbp),%rax
cmpq   $0x0,-0x22d0(%rbp,%rax,8)
je     1619 <dopkgmirrorpkgs+0x479>
movslq -0x22d4(%rbp),%rax
mov    -0x22d0(%rbp,%rax,8),%rsi
ff
lea    0xa3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    161e <dopkgmirrorpkgs+0x47e>
mov    -0x22d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x22d4(%rbp)
jmp    15d7 <dopkgmirrorpkgs+0x437>
jmp    1637 <dopkgmirrorpkgs+0x497>
add    $0x2310,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dopkgmirrorpkgs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x22b8,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,0x18(%rsp)
mov    %edi,0x8(%rsp)
movb   $0x0,0x340(%rsp)
movb   $0x0,0x730(%rsp)
movb   $0x0,0xb20(%rsp)
movb   $0x0,0xf10(%rsp)
mov    %r9d,%ebp
mov    %r9d,0xc(%rsp)
test   %r9d,%r9d
jle    1212 <dopkgmirrorpkgs+0x62>
lea    0x0(,%rbp,8),%rdx
lea    0x20(%rsp),%rdi
mov    %r8,%rsi
call   1080 <memcpy@plt>
mov    %rbp,0x10(%rsp)
lea    0xde2(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     14f9 <dopkgmirrorpkgs+0x349>
mov    %rax,%r13
lea    0x1300(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1497 <dopkgmirrorpkgs+0x2e7>
lea    0xda8(%rip),%r12
lea    0xdcf(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,0x1300(%rsp)
je     129a <dopkgmirrorpkgs+0xea>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    129a <dopkgmirrorpkgs+0xea>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1090 <strncasecmp@plt>
test   %rax,%rax
jne    12c4 <dopkgmirrorpkgs+0x114>
lea    0x1ed0(%rsp),%rdi
mov    %rbx,%rsi
call   10d0 <fieldcpy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x8,%edx
call   1090 <strncasecmp@plt>
test   %rax,%rax
je     1430 <dopkgmirrorpkgs+0x280>
mov    %rbx,%rdi
lea    0xd24(%rip),%rsi
mov    $0x8,%edx
call   1090 <strncasecmp@plt>
test   %rax,%rax
je     1440 <dopkgmirrorpkgs+0x290>
mov    %rbx,%rdi
lea    0xd10(%rip),%rsi
mov    $0xd,%edx
call   1090 <strncasecmp@plt>
test   %rax,%rax
je     144a <dopkgmirrorpkgs+0x29a>
mov    %rbx,%rdi
lea    0xd01(%rip),%rsi
mov    $0x5,%edx
call   1090 <strncasecmp@plt>
test   %rax,%rax
je     1454 <dopkgmirrorpkgs+0x2a4>
mov    %rbx,%rdi
lea    0xcea(%rip),%rsi
mov    $0x7,%edx
call   1090 <strncasecmp@plt>
test   %rax,%rax
je     145e <dopkgmirrorpkgs+0x2ae>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
test   %rax,%rax
je     1468 <dopkgmirrorpkgs+0x2b8>
cmpb   $0x0,0x1300(%rsp)
jne    1478 <dopkgmirrorpkgs+0x2c8>
cmpl   $0x0,0xc(%rsp)
jle    14df <dopkgmirrorpkgs+0x32f>
xor    %r15d,%r15d
xor    %ecx,%ecx
jmp    139f <dopkgmirrorpkgs+0x1ef>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15
cmp    %r15,0x10(%rsp)
je     1493 <dopkgmirrorpkgs+0x2e3>
mov    0x20(%rsp,%r15,8),%rsi
test   %rsi,%rsi
je     1390 <dopkgmirrorpkgs+0x1e0>
lea    0x1ed0(%rsp),%rdi
call   1070 <strcmp@plt>
mov    $0x1,%ecx
test   %rax,%rax
jne    1390 <dopkgmirrorpkgs+0x1e0>
lea    0xc73(%rip),%rdi
lea    0xf10(%rsp),%rsi
lea    0xb20(%rsp),%rdx
lea    0x730(%rsp),%rcx
mov    0x18(%rsp),%r8
lea    0x340(%rsp),%r9
xor    %eax,%eax
mov    %rbp,%r11
lea    0x1ae0(%rsp),%rbp
push   %rbp
lea    0x16f8(%rsp),%rbp
push   %rbp
mov    %r11,%rbp
call   1050 <printf@plt>
add    $0x10,%rsp
cmpl   $0x0,0x8(%rsp)
je     1478 <dopkgmirrorpkgs+0x2c8>
movq   $0x0,0x20(%rsp,%r15,8)
jmp    1478 <dopkgmirrorpkgs+0x2c8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xf10(%rsp),%rdi
jmp    1470 <dopkgmirrorpkgs+0x2c0>
nopw   0x0(%rax,%rax,1)
lea    0xb20(%rsp),%rdi
jmp    1470 <dopkgmirrorpkgs+0x2c0>
lea    0x730(%rsp),%rdi
jmp    1470 <dopkgmirrorpkgs+0x2c0>
lea    0x1ae0(%rsp),%rdi
jmp    1470 <dopkgmirrorpkgs+0x2c0>
lea    0x16f0(%rsp),%rdi
jmp    1470 <dopkgmirrorpkgs+0x2c0>
lea    0x340(%rsp),%rdi
mov    %rbx,%rsi
call   10d0 <fieldcpy@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %r13,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
jne    1270 <dopkgmirrorpkgs+0xc0>
jmp    1497 <dopkgmirrorpkgs+0x2e7>
test   %ecx,%ecx
jne    1478 <dopkgmirrorpkgs+0x2c8>
mov    %r13,%rdi
call   1030 <fclose@plt>
cmpl   $0x0,0x8(%rsp)
mov    0x10(%rsp),%rbx
je     14e7 <dopkgmirrorpkgs+0x337>
cmpl   $0x0,0xc(%rsp)
jle    14e7 <dopkgmirrorpkgs+0x337>
lea    0xb97(%rip),%r14
xor    %ebp,%ebp
jmp    14c9 <dopkgmirrorpkgs+0x319>
nopl   (%rax)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     14e7 <dopkgmirrorpkgs+0x337>
mov    0x20(%rsp,%rbp,8),%rsi
test   %rsi,%rsi
je     14c0 <dopkgmirrorpkgs+0x310>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    14c0 <dopkgmirrorpkgs+0x310>
mov    %r13,%rdi
call   1030 <fclose@plt>
add    $0x22b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [9 x i8] c"Package:\00"
@.str.2 = [9 x i8] c"Version:\00"
@.str.3 = [14 x i8] c"Architecture:\00"
@.str.4 = [6 x i8] c"Size:\00"
@.str.5 = [8 x i8] c"MD5sum:\00"
@.str.6 = [10 x i8] c"Filename:\00"
@.str.7 = [22 x i8] c"%s %s %s %s %s %s %s\0A\00"
@.str.8 = [6 x i8] c"%s -\0A\00"
define void @dopkgmirrorpkgs(i32 %0, i8* %1, i8* %2, i8* %3, i8** %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8**
%12 = alloca i32
%13 = alloca [1000 x i8]
%14 = alloca [1000 x i8]
%15 = alloca [1000 x i8]
%16 = alloca [1000 x i8]
%17 = alloca [1000 x i8]
%18 = alloca [1000 x i8]
%19 = alloca [1000 x i8]
%20 = alloca [1000 x i8]
%21 = alloca [100 x i8*]
%22 = alloca i32
%23 = alloca i32*
%24 = alloca i32
store i32 %0, i32* %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8** %4, i8*** %11
store i32 %5, i32* %12
%25 = getelementptr inbounds [1000 x i8], [1000 x i8]* %20, i64 0, i64 0
store i8 0, i8* %25
%26 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
store i8 0, i8* %26
%27 = getelementptr inbounds [1000 x i8], [1000 x i8]* %16, i64 0, i64 0
store i8 0, i8* %27
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
store i8 0, i8* %28
store i32 0, i32* %22
br label %29
29: ; preds = %42, %6
%30 = load i32, i32* %22
%31 = load i32, i32* %12
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %45
33: ; preds = %29
%34 = load i8**, i8*** %11
%35 = load i32, i32* %22
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = load i32, i32* %22
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [100 x i8*], [100 x i8*]* %21, i64 0, i64 %40
store i8* %38, i8** %41
br label %42
42: ; preds = %33
%43 = load i32, i32* %22
%44 = add nsw i32 %43, 1
store i32 %44, i32* %22
br label %29
45: ; preds = %29
%46 = load i8*, i8** %9
%47 = call i32* @fopen(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %47, i32** %23
%48 = load i32*, i32** %23
%49 = icmp eq i32* %48, null
br i1 %49, label %50, label %54
50: ; preds = %45
%51 = load i8*, i8** %9
%52 = call i32 @perror(i8* %51)
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %45
br label %55
55: ; preds = %194, %54
%56 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%57 = load i32*, i32** %23
%58 = call i64 @fgets(i8* %56, i32 1000, i32* %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %195
60: ; preds = %55
%61 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %80
65: ; preds = %60
%66 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%67 = call i32 @strlen(i8* %66)
%68 = sub nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 %69
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 10
br i1 %73, label %74, label %80
74: ; preds = %65
%75 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%76 = call i32 @strlen(i8* %75)
%77 = sub nsw i32 %76, 1
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 %78
store i8 0, i8* %79
br label %80
80: ; preds = %74, %65, %60
%81 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%82 = load i8*, i8** %10
%83 = load i8*, i8** %10
%84 = call i32 @strlen(i8* %83)
%85 = call i64 @strncasecmp(i8* %81, i8* %82, i32 %84)
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %91
87: ; preds = %80
%88 = getelementptr inbounds [1000 x i8], [1000 x i8]* %14, i64 0, i64 0
%89 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%90 = call i32 @fieldcpy(i8* %88, i8* %89)
br label %91
91: ; preds = %87, %80
%92 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%93 = call i64 @strncasecmp(i8* %92, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%94 = icmp eq i64 %93, 0
br i1 %94, label %95, label %99
95: ; preds = %91
%96 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%97 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%98 = call i32 @fieldcpy(i8* %96, i8* %97)
br label %194
99: ; preds = %91
%100 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%101 = call i64 @strncasecmp(i8* %100, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 8)
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %107
103: ; preds = %99
%104 = getelementptr inbounds [1000 x i8], [1000 x i8]* %16, i64 0, i64 0
%105 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%106 = call i32 @fieldcpy(i8* %104, i8* %105)
br label %193
107: ; preds = %99
%108 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%109 = call i64 @strncasecmp(i8* %108, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 13)
%110 = icmp eq i64 %109, 0
br i1 %110, label %111, label %115
111: ; preds = %107
%112 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%113 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%114 = call i32 @fieldcpy(i8* %112, i8* %113)
br label %192
115: ; preds = %107
%116 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%117 = call i64 @strncasecmp(i8* %116, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 5)
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %123
119: ; preds = %115
%120 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%121 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%122 = call i32 @fieldcpy(i8* %120, i8* %121)
br label %191
123: ; preds = %115
%124 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%125 = call i64 @strncasecmp(i8* %124, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 7)
%126 = icmp eq i64 %125, 0
br i1 %126, label %127, label %131
127: ; preds = %123
%128 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%129 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%130 = call i32 @fieldcpy(i8* %128, i8* %129)
br label %190
131: ; preds = %123
%132 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%133 = call i64 @strncasecmp(i8* %132, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 9)
%134 = icmp eq i64 %133, 0
br i1 %134, label %135, label %139
135: ; preds = %131
%136 = getelementptr inbounds [1000 x i8], [1000 x i8]* %20, i64 0, i64 0
%137 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%138 = call i32 @fieldcpy(i8* %136, i8* %137)
br label %189
139: ; preds = %131
%140 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%141 = load i8, i8* %140
%142 = icmp ne i8 %141, 0
br i1 %142, label %188, label %143
143: ; preds = %139
store i32 0, i32* %24
store i32 0, i32* %22
br label %144
144: ; preds = %180, %143
%145 = load i32, i32* %22
%146 = load i32, i32* %12
%147 = icmp slt i32 %145, %146
br i1 %147, label %148, label %183
148: ; preds = %144
%149 = load i32, i32* %22
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [100 x i8*], [100 x i8*]* %21, i64 0, i64 %150
%152 = load i8*, i8** %151
%153 = icmp ne i8* %152, null
br i1 %153, label %155, label %154
154: ; preds = %148
br label %180
155: ; preds = %148
store i32 1, i32* %24
%156 = getelementptr inbounds [1000 x i8], [1000 x i8]* %14, i64 0, i64 0
%157 = load i32, i32* %22
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [100 x i8*], [100 x i8*]* %21, i64 0, i64 %158
%160 = load i8*, i8** %159
%161 = call i64 @strcmp(i8* %156, i8* %160)
%162 = icmp eq i64 %161, 0
br i1 %162, label %163, label %179
163: ; preds = %155
%164 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%165 = getelementptr inbounds [1000 x i8], [1000 x i8]* %16, i64 0, i64 0
%166 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%167 = load i8*, i8** %8
%168 = getelementptr inbounds [1000 x i8], [1000 x i8]* %20, i64 0, i64 0
%169 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%170 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%171 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %164, i8* %165, i8* %166, i8* %167, i8* %168, i8* %169, i8* %170)
%172 = load i32, i32* %7
%173 = icmp ne i32 %172, 0
br i1 %173, label %174, label %178
174: ; preds = %163
%175 = load i32, i32* %22
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds [100 x i8*], [100 x i8*]* %21, i64 0, i64 %176
store i8* null, i8** %177
br label %178
178: ; preds = %174, %163
br label %183
179: ; preds = %155
br label %180
180: ; preds = %179, %154
%181 = load i32, i32* %22
%182 = add nsw i32 %181, 1
store i32 %182, i32* %22
br label %144
183: ; preds = %178, %144
%184 = load i32, i32* %24
%185 = icmp ne i32 %184, 0
br i1 %185, label %187, label %186
186: ; preds = %183
br label %195
187: ; preds = %183
br label %188
188: ; preds = %187, %139
br label %189
189: ; preds = %188, %135
br label %190
190: ; preds = %189, %127
br label %191
191: ; preds = %190, %119
br label %192
192: ; preds = %191, %111
br label %193
193: ; preds = %192, %103
br label %194
194: ; preds = %193, %95
br label %55
195: ; preds = %186, %55
%196 = load i32*, i32** %23
%197 = call i32 @fclose(i32* %196)
%198 = load i32, i32* %7
%199 = icmp ne i32 %198, 0
br i1 %199, label %200, label %222
200: ; preds = %195
store i32 0, i32* %22
br label %201
201: ; preds = %218, %200
%202 = load i32, i32* %22
%203 = load i32, i32* %12
%204 = icmp slt i32 %202, %203
br i1 %204, label %205, label %221
205: ; preds = %201
%206 = load i32, i32* %22
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds [100 x i8*], [100 x i8*]* %21, i64 0, i64 %207
%209 = load i8*, i8** %208
%210 = icmp ne i8* %209, null
br i1 %210, label %211, label %217
211: ; preds = %205
%212 = load i32, i32* %22
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds [100 x i8*], [100 x i8*]* %21, i64 0, i64 %213
%215 = load i8*, i8** %214
%216 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* %215)
br label %217
217: ; preds = %211, %205
br label %218
218: ; preds = %217
%219 = load i32, i32* %22
%220 = add nsw i32 %219, 1
store i32 %220, i32* %22
br label %201
221: ; preds = %201
br label %222
222: ; preds = %221, %195
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [9 x i8] c"Package:\00"
@.str.2 = [9 x i8] c"Version:\00"
@.str.3 = [14 x i8] c"Architecture:\00"
@.str.4 = [6 x i8] c"Size:\00"
@.str.5 = [8 x i8] c"MD5sum:\00"
@.str.6 = [10 x i8] c"Filename:\00"
@.str.7 = [22 x i8] c"%s %s %s %s %s %s %s\0A\00"
@.str.8 = [6 x i8] c"%s -\0A\00"
define void @dopkgmirrorpkgs(i32 %0, i8* %1, i8* nocapture %2, i8* %3, i8** nocapture %4, i32 %5) {
%7 = alloca [1000 x i8]
%8 = alloca [1000 x i8]
%9 = alloca [1000 x i8]
%10 = alloca [1000 x i8]
%11 = alloca [1000 x i8]
%12 = alloca [1000 x i8]
%13 = alloca [1000 x i8]
%14 = alloca [1000 x i8]
%15 = alloca [100 x i8*]
%16 = bitcast [100 x i8*]* %15 to i8*
%17 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%18 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%21 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%24 = getelementptr inbounds [1000 x i8], [1000 x i8]* %14, i64 0, i64 0
store i8 0, i8* %24
store i8 0, i8* %21
store i8 0, i8* %20
store i8 0, i8* %19
%25 = icmp sgt i32 %5, 0
br i1 %25, label %26, label %30
26: ; preds = %6
%27 = bitcast i8** %4 to i8*
%28 = zext i32 %5 to i64
%29 = shl nuw nsw i64 %28, 3
br label %30
30: ; preds = %26, %6
%31 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %39, label %33
33: ; preds = %30
%34 = call i64 @fgets(i8* %17, i32 1000, i32* %31)
%35 = icmp eq i64 %34, 0
br i1 %35, label %122, label %36
36: ; preds = %33
%37 = icmp eq i32 %0, 0
%38 = zext i32 %5 to i64
br label %42
39: ; preds = %30
%40 = tail call i32 @perror(i8* %2)
%41 = tail call i32 @exit(i32 1)
unreachable
42: ; preds = %36, %119
%43 = load i8, i8* %17
%44 = icmp eq i8 %43, 0
br i1 %44, label %57, label %45
45: ; preds = %42
%46 = call i32 @strlen(i8* %17)
%47 = add nsw i32 %46, -1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = icmp eq i8 %50, 10
br i1 %51, label %52, label %57
52: ; preds = %45
%53 = call i32 @strlen(i8* %17)
%54 = add nsw i32 %53, -1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %55
store i8 0, i8* %56
br label %57
57: ; preds = %52, %45, %42
%58 = call i32 @strlen(i8* %3)
%59 = call i64 @strncasecmp(i8* %17, i8* %3, i32 %58)
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = call i32 @fieldcpy(i8* %18, i8* %17)
br label %63
63: ; preds = %61, %57
%64 = call i64 @strncasecmp(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 @fieldcpy(i8* %19, i8* %17)
br label %119
68: ; preds = %63
%69 = call i64 @strncasecmp(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 8)
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %68
%72 = call i32 @fieldcpy(i8* %20, i8* %17)
br label %119
73: ; preds = %68
%74 = call i64 @strncasecmp(i8* %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 13)
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %73
%77 = call i32 @fieldcpy(i8* %21, i8* %17)
br label %119
78: ; preds = %73
%79 = call i64 @strncasecmp(i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 5)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %78
%82 = call i32 @fieldcpy(i8* %22, i8* %17)
br label %119
83: ; preds = %78
%84 = call i64 @strncasecmp(i8* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 7)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = call i32 @fieldcpy(i8* %23, i8* %17)
br label %119
88: ; preds = %83
%89 = call i64 @strncasecmp(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 9)
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %88
%92 = call i32 @fieldcpy(i8* %24, i8* %17)
br label %119
93: ; preds = %88
%94 = load i8, i8* %17
%95 = icmp eq i8 %94, 0
br i1 %95, label %96, label %119
96: ; preds = %93
br i1 %25, label %99, label %97
97: ; preds = %96
%98 = call i32 @fclose(i32* %31)
br label %138
99: ; preds = %96, %113
%100 = phi i64 [ %115, %113 ], [ 0, %96 ]
%101 = phi i32 [ %114, %113 ], [ 0, %96 ]
%102 = getelementptr inbounds [100 x i8*], [100 x i8*]* %15, i64 0, i64 %100
%103 = load i8*, i8** %102
%104 = icmp eq i8* %103, null
br i1 %104, label %113, label %105
105: ; preds = %99
%106 = call i64 @strcmp(i8* %18, i8* %103)
%107 = icmp eq i64 %106, 0
br i1 %107, label %108, label %113
108: ; preds = %105
%109 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %19, i8* %20, i8* %21, i8* %1, i8* %24, i8* %23, i8* %22)
br i1 %37, label %119, label %110
110: ; preds = %108
%111 = and i64 %100, 4294967295
%112 = getelementptr inbounds [100 x i8*], [100 x i8*]* %15, i64 0, i64 %111
store i8* null, i8** %112
br label %119
113: ; preds = %105, %99
%114 = phi i32 [ 1, %105 ], [ %101, %99 ]
%115 = add nuw nsw i64 %100, 1
%116 = icmp eq i64 %115, %38
br i1 %116, label %117, label %99
117: ; preds = %113
%118 = icmp eq i32 %114, 0
br i1 %118, label %122, label %119
119: ; preds = %108, %110, %117, %71, %81, %91, %93, %86, %76, %66
%120 = call i64 @fgets(i8* %17, i32 1000, i32* %31)
%121 = icmp eq i64 %120, 0
br i1 %121, label %122, label %42
122: ; preds = %119, %117, %33
%123 = call i32 @fclose(i32* %31)
%124 = icmp ne i32 %0, 0
%125 = and i1 %124, %25
br i1 %125, label %126, label %138
126: ; preds = %122
%127 = zext i32 %5 to i64
br label %128
128: ; preds = %126, %135
%129 = phi i64 [ 0, %126 ], [ %136, %135 ]
%130 = getelementptr inbounds [100 x i8*], [100 x i8*]* %15, i64 0, i64 %129
%131 = load i8*, i8** %130
%132 = icmp eq i8* %131, null
br i1 %132, label %135, label %133
133: ; preds = %128
%134 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* %131)
br label %135
135: ; preds = %128, %133
%136 = add nuw nsw i64 %129, 1
%137 = icmp eq i64 %136, %127
br i1 %137, label %138, label %128
138: ; preds = %135, %97, %122
ret void
}