#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 */
char **calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *,
                           char *);
int /*<<< orphan*/ memmove(char *, char *, int);
char *mkabsurl(char *, char *);
int /*<<< orphan*/ perror(char *);
char **realloc(char **, int);
char *strstr(char *, char *);
char **extract_links(char *base_link, char *str) {
  char **arr, *p, *k, *n, buf[512], *link;
  int size = 16, elmns = 0, i;
  if (!base_link || !str)
    return NULL;
  p = str;
  if (!(arr = calloc(size, sizeof(char *)))) {
    perror("calloc");
    return NULL;
  }
  while ((p = strstr(p, "<a "))) {
    p += 3;
    i = 0;
    while (*p && *p != '>') {
      if (i < 512)
        buf[i++] = *p;
      p++;
    }
    if (!*p)
      break;
    buf[i] = 0;
    if ((k = strstr(buf, "href"))) {
      while (*k && *k != '"')
        k++;
      if (!*k)
        break;
      k++;
      n = k;
      while (*k && *k != '"')
        k++;
      if (!*k)
        break;
      memmove(buf, n, k - n);
      buf[k - n] = 0;
      if (!(link = mkabsurl(base_link, buf)))
        continue;
      FILE *fp = fopen("mkabs.txt", "a");
      if (!fp)
        exit(1);
      fprintf(fp, "%s, %s, %s\n", base_link, buf, link);
      fclose(fp);
      arr[elmns++] = link;
      if (elmns > size - 1) {
        size *= 2;
        if (!(arr = realloc(arr, size * sizeof(char *))))
          return NULL;
        for (i = elmns; i < size; i++)
          arr[i] = NULL;
      }
    }
  }
  return arr;
}


x86 assembly (clang, -O0):
<extract_links>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x10,-0x24c(%rbp)
movl   $0x0,-0x250(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11dd <extract_links+0x3d>
cmpq   $0x0,-0x18(%rbp)
jne    11ea <extract_links+0x4a>
movq   $0x0,-0x8(%rbp)
jmp    158d <extract_links+0x3ed>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x24c(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1229 <extract_links+0x89>
lea    0xde9(%rip),%rdi
call   10a0 <perror@plt>
movq   $0x0,-0x8(%rbp)
jmp    158d <extract_links+0x3ed>
jmp    122e <extract_links+0x8e>
mov    -0x28(%rbp),%rdi
lea    0xdce(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1585 <extract_links+0x3e5>
mov    -0x28(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x254(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x261(%rbp)
je     128d <extract_links+0xed>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3e,%eax
setne  %al
mov    %al,-0x261(%rbp)
mov    -0x261(%rbp),%al
test   $0x1,%al
jne    12a0 <extract_links+0x100>
jmp    12e1 <extract_links+0x141>
cmpl   $0x200,-0x254(%rbp)
jge    12d0 <extract_links+0x130>
mov    -0x28(%rbp),%rax
mov    (%rax),%cl
mov    -0x254(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x254(%rbp)
cltq
mov    %cl,-0x240(%rbp,%rax,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1262 <extract_links+0xc2>
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
jne    12f3 <extract_links+0x153>
jmp    1585 <extract_links+0x3e5>
movslq -0x254(%rbp),%rax
movb   $0x0,-0x240(%rbp,%rax,1)
lea    -0x240(%rbp),%rdi
lea    0xcfb(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     1580 <extract_links+0x3e0>
jmp    1328 <extract_links+0x188>
mov    -0x30(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x262(%rbp)
je     1353 <extract_links+0x1b3>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
setne  %al
mov    %al,-0x262(%rbp)
mov    -0x262(%rbp),%al
test   $0x1,%al
jne    1366 <extract_links+0x1c6>
jmp    1377 <extract_links+0x1d7>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1328 <extract_links+0x188>
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1389 <extract_links+0x1e9>
jmp    1585 <extract_links+0x3e5>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x263(%rbp)
je     13c8 <extract_links+0x228>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
setne  %al
mov    %al,-0x263(%rbp)
mov    -0x263(%rbp),%al
test   $0x1,%al
jne    13db <extract_links+0x23b>
jmp    13ec <extract_links+0x24c>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    139d <extract_links+0x1fd>
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
jne    13fe <extract_links+0x25e>
jmp    1585 <extract_links+0x3e5>
lea    -0x240(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1080 <memmove@plt>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    %rcx,%rax
movb   $0x0,-0x240(%rbp,%rax,1)
mov    -0x10(%rbp),%rdi
lea    -0x240(%rbp),%rsi
call   1030 <mkabsurl@plt>
mov    %rax,-0x248(%rbp)
cmp    $0x0,%rax
jne    1454 <extract_links+0x2b4>
jmp    122e <extract_links+0x8e>
lea    0xbb5(%rip),%rdi
lea    0xbb8(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x260(%rbp)
cmpq   $0x0,-0x260(%rbp)
jne    1486 <extract_links+0x2e6>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x260(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x240(%rbp),%rcx
mov    -0x248(%rbp),%r8
lea    0xb76(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x260(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x248(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    -0x250(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x250(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x250(%rbp),%eax
mov    -0x24c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    157b <extract_links+0x3db>
mov    -0x24c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x24c(%rbp)
mov    -0x20(%rbp),%rdi
movslq -0x24c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
call   1070 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1531 <extract_links+0x391>
movq   $0x0,-0x8(%rbp)
jmp    158d <extract_links+0x3ed>
mov    -0x250(%rbp),%eax
mov    %eax,-0x254(%rbp)
mov    -0x254(%rbp),%eax
cmp    -0x24c(%rbp),%eax
jge    1576 <extract_links+0x3d6>
mov    -0x20(%rbp),%rax
movslq -0x254(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x254(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x254(%rbp)
jmp    153d <extract_links+0x39d>
jmp    157b <extract_links+0x3db>
jmp    1580 <extract_links+0x3e0>
jmp    122e <extract_links+0x8e>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_links>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
xor    %r15d,%r15d
test   %rdi,%rdi
je     13d3 <extract_links+0x223>
mov    %rsi,%rbx
test   %rsi,%rsi
je     13d3 <extract_links+0x223>
mov    %rdi,%r14
mov    $0x10,%ebp
mov    $0x10,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
test   %rax,%rax
je     13c4 <extract_links+0x214>
mov    %rax,%r15
lea    0xe04(%rip),%rsi
xor    %r13d,%r13d
lea    -0x1(%rbp),%eax
mov    %eax,0x14(%rsp)
mov    %rbp,0x18(%rsp)
mov    %rbx,%rdi
mov    %rsi,%r12
call   10d0 <strstr@plt>
test   %rax,%rax
je     13d3 <extract_links+0x223>
mov    %rax,%rbx
add    $0x3,%rbx
xor    %eax,%eax
jmp    1244 <extract_links+0x94>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%ecx
test   %cl,%cl
je     13d3 <extract_links+0x223>
cmp    $0x3e,%cl
je     1270 <extract_links+0xc0>
cmp    $0x1ff,%eax
jg     1240 <extract_links+0x90>
movslq %eax,%rdx
add    $0x1,%eax
mov    %cl,0x20(%rsp,%rdx,1)
jmp    1240 <extract_links+0x90>
nopw   0x0(%rax,%rax,1)
cltq
movb   $0x0,0x20(%rsp,%rax,1)
lea    0x20(%rsp),%rdi
lea    0xd88(%rip),%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
je     130d <extract_links+0x15d>
add    $0x1,%rax
mov    %rax,%rsi
nopl   0x0(%rax,%rax,1)
movzbl -0x1(%rsi),%ecx
test   %cl,%cl
je     13d3 <extract_links+0x223>
cmp    $0x22,%cl
je     12bb <extract_links+0x10b>
add    $0x1,%rsi
add    $0x1,%rax
jmp    12a0 <extract_links+0xf0>
xor    %ebp,%ebp
nopl   (%rax)
movzbl (%rsi,%rbp,1),%eax
test   %al,%al
je     13d3 <extract_links+0x223>
cmp    $0x22,%al
je     12d6 <extract_links+0x126>
add    $0x1,%rbp
jmp    12c0 <extract_links+0x110>
mov    %r13,0x8(%rsp)
lea    0x20(%rsp),%r13
mov    %r13,%rdi
mov    %ebp,%edx
call   1090 <memmove@plt>
movb   $0x0,0x20(%rsp,%rbp,1)
mov    %r14,%rdi
mov    %r13,%rsi
mov    0x8(%rsp),%r13
call   1030 <mkabsurl@plt>
test   %rax,%rax
mov    %r12,%rsi
je     1212 <extract_links+0x62>
jmp    1315 <extract_links+0x165>
mov    %r12,%rsi
jmp    1212 <extract_links+0x62>
mov    %rax,%rbp
lea    0xcf1(%rip),%rdi
lea    0xcf4(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13e8 <extract_links+0x238>
mov    %rax,%r13
mov    %rax,%rdi
lea    0xcdb(%rip),%rsi
mov    %r14,%rdx
lea    0x20(%rsp),%rcx
mov    %rbp,%r8
call   1070 <fprintf@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    0x8(%rsp),%rax
lea    0x1(%rax),%r13d
cltq
mov    %rbp,(%r15,%rax,8)
cmp    0x14(%rsp),%eax
mov    %r12,%rsi
mov    0x18(%rsp),%rbp
jl     1212 <extract_links+0x62>
mov    %ebp,%esi
shl    $0x4,%esi
mov    %r15,%rdi
call   1080 <realloc@plt>
test   %rax,%rax
je     13d0 <extract_links+0x220>
mov    %rax,%r15
add    %ebp,%ebp
cmp    %ebp,%r13d
mov    %r12,%rsi
jge    1206 <extract_links+0x56>
movslq %r13d,%rax
lea    (%r15,%rax,8),%rdi
mov    %ebp,%eax
sub    0x8(%rsp),%eax
add    $0xfffffffe,%eax
lea    0x8(,%rax,8),%rdx
xor    %esi,%esi
call   1050 <memset@plt>
mov    %r12,%rsi
jmp    1206 <extract_links+0x56>
lea    0xc35(%rip),%rdi
call   10b0 <perror@plt>
xor    %r15d,%r15d
mov    %r15,%rax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"calloc\00"
@.str.1 = [4 x i8] c"<a \00"
@.str.2 = [5 x i8] c"href\00"
@.str.3 = [10 x i8] c"mkabs.txt\00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [12 x i8] c"%s, %s, %s\0A\00"
define i8** @extract_links(i8* %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [512 x i8]
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 16, i32* %12
store i32 0, i32* %13
%16 = load i8*, i8** %4
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load i8*, i8** %5
%20 = icmp ne i8* %19, null
br i1 %20, label %22, label %21
21: ; preds = %18, %2
store i8** null, i8*** %3
br label %194
22: ; preds = %18
%23 = load i8*, i8** %5
store i8* %23, i8** %7
%24 = load i32, i32* %12
%25 = call i8** @calloc(i32 %24, i32 8)
store i8** %25, i8*** %6
%26 = icmp ne i8** %25, null
br i1 %26, label %29, label %27
27: ; preds = %22
%28 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8** null, i8*** %3
br label %194
29: ; preds = %22
br label %30
30: ; preds = %191, %139, %29
%31 = load i8*, i8** %7
%32 = call i8* @strstr(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i8* %32, i8** %7
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %192
34: ; preds = %30
%35 = load i8*, i8** %7
%36 = getelementptr inbounds i8, i8* %35, i64 3
store i8* %36, i8** %7
store i32 0, i32* %14
br label %37
37: ; preds = %59, %34
%38 = load i8*, i8** %7
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %37
%43 = load i8*, i8** %7
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp ne i32 %45, 62
br label %47
47: ; preds = %42, %37
%48 = phi i1 [ false, %37 ], [ %46, %42 ]
br i1 %48, label %49, label %62
49: ; preds = %47
%50 = load i32, i32* %14
%51 = icmp slt i32 %50, 512
br i1 %51, label %52, label %59
52: ; preds = %49
%53 = load i8*, i8** %7
%54 = load i8, i8* %53
%55 = load i32, i32* %14
%56 = add nsw i32 %55, 1
store i32 %56, i32* %14
%57 = sext i32 %55 to i64
%58 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 %57
store i8 %54, i8* %58
br label %59
59: ; preds = %52, %49
%60 = load i8*, i8** %7
%61 = getelementptr inbounds i8, i8* %60, i32 1
store i8* %61, i8** %7
br label %37
62: ; preds = %47
%63 = load i8*, i8** %7
%64 = load i8, i8* %63
%65 = icmp ne i8 %64, 0
br i1 %65, label %67, label %66
66: ; preds = %62
br label %192
67: ; preds = %62
%68 = load i32, i32* %14
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 %69
store i8 0, i8* %70
%71 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%72 = call i8* @strstr(i8* %71, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i8* %72, i8** %8
%73 = icmp ne i8* %72, null
br i1 %73, label %74, label %191
74: ; preds = %67
br label %75
75: ; preds = %87, %74
%76 = load i8*, i8** %8
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %85
80: ; preds = %75
%81 = load i8*, i8** %8
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp ne i32 %83, 34
br label %85
85: ; preds = %80, %75
%86 = phi i1 [ false, %75 ], [ %84, %80 ]
br i1 %86, label %87, label %90
87: ; preds = %85
%88 = load i8*, i8** %8
%89 = getelementptr inbounds i8, i8* %88, i32 1
store i8* %89, i8** %8
br label %75
90: ; preds = %85
%91 = load i8*, i8** %8
%92 = load i8, i8* %91
%93 = icmp ne i8 %92, 0
br i1 %93, label %95, label %94
94: ; preds = %90
br label %192
95: ; preds = %90
%96 = load i8*, i8** %8
%97 = getelementptr inbounds i8, i8* %96, i32 1
store i8* %97, i8** %8
%98 = load i8*, i8** %8
store i8* %98, i8** %9
br label %99
99: ; preds = %111, %95
%100 = load i8*, i8** %8
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %109
104: ; preds = %99
%105 = load i8*, i8** %8
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp ne i32 %107, 34
br label %109
109: ; preds = %104, %99
%110 = phi i1 [ false, %99 ], [ %108, %104 ]
br i1 %110, label %111, label %114
111: ; preds = %109
%112 = load i8*, i8** %8
%113 = getelementptr inbounds i8, i8* %112, i32 1
store i8* %113, i8** %8
br label %99
114: ; preds = %109
%115 = load i8*, i8** %8
%116 = load i8, i8* %115
%117 = icmp ne i8 %116, 0
br i1 %117, label %119, label %118
118: ; preds = %114
br label %192
119: ; preds = %114
%120 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%121 = load i8*, i8** %9
%122 = load i8*, i8** %8
%123 = load i8*, i8** %9
%124 = ptrtoint i8* %122 to i64
%125 = ptrtoint i8* %123 to i64
%126 = sub i64 %124, %125
%127 = trunc i64 %126 to i32
%128 = call i32 @memmove(i8* %120, i8* %121, i32 %127)
%129 = load i8*, i8** %8
%130 = load i8*, i8** %9
%131 = ptrtoint i8* %129 to i64
%132 = ptrtoint i8* %130 to i64
%133 = sub i64 %131, %132
%134 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 %133
store i8 0, i8* %134
%135 = load i8*, i8** %4
%136 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%137 = call i8* @mkabsurl(i8* %135, i8* %136)
store i8* %137, i8** %11
%138 = icmp ne i8* %137, null
br i1 %138, label %140, label %139
139: ; preds = %119
br label %30
140: ; preds = %119
%141 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %141, i32** %15
%142 = load i32*, i32** %15
%143 = icmp ne i32* %142, null
br i1 %143, label %146, label %144
144: ; preds = %140
%145 = call i32 @exit(i32 1)
unreachable
146: ; preds = %140
%147 = load i32*, i32** %15
%148 = load i8*, i8** %4
%149 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%150 = load i8*, i8** %11
%151 = call i32 @fprintf(i32* %147, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %148, i8* %149, i8* %150)
%152 = load i32*, i32** %15
%153 = call i32 @fclose(i32* %152)
%154 = load i8*, i8** %11
%155 = load i8**, i8*** %6
%156 = load i32, i32* %13
%157 = add nsw i32 %156, 1
store i32 %157, i32* %13
%158 = sext i32 %156 to i64
%159 = getelementptr inbounds i8*, i8** %155, i64 %158
store i8* %154, i8** %159
%160 = load i32, i32* %13
%161 = load i32, i32* %12
%162 = sub nsw i32 %161, 1
%163 = icmp sgt i32 %160, %162
br i1 %163, label %164, label %190
164: ; preds = %146
%165 = load i32, i32* %12
%166 = mul nsw i32 %165, 2
store i32 %166, i32* %12
%167 = load i8**, i8*** %6
%168 = load i32, i32* %12
%169 = sext i32 %168 to i64
%170 = mul i64 %169, 8
%171 = trunc i64 %170 to i32
%172 = call i8** @realloc(i8** %167, i32 %171)
store i8** %172, i8*** %6
%173 = icmp ne i8** %172, null
br i1 %173, label %175, label %174
174: ; preds = %164
store i8** null, i8*** %3
br label %194
175: ; preds = %164
%176 = load i32, i32* %13
store i32 %176, i32* %14
br label %177
177: ; preds = %186, %175
%178 = load i32, i32* %14
%179 = load i32, i32* %12
%180 = icmp slt i32 %178, %179
br i1 %180, label %181, label %189
181: ; preds = %177
%182 = load i8**, i8*** %6
%183 = load i32, i32* %14
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds i8*, i8** %182, i64 %184
store i8* null, i8** %185
br label %186
186: ; preds = %181
%187 = load i32, i32* %14
%188 = add nsw i32 %187, 1
store i32 %188, i32* %14
br label %177
189: ; preds = %177
br label %190
190: ; preds = %189, %146
br label %191
191: ; preds = %190, %67
br label %30
192: ; preds = %118, %94, %66, %30
%193 = load i8**, i8*** %6
store i8** %193, i8*** %3
br label %194
194: ; preds = %192, %174, %27, %21
%195 = load i8**, i8*** %3
ret i8** %195
}

LLVM IR (-O2):
@.str = [7 x i8] c"calloc\00"
@.str.1 = [4 x i8] c"<a \00"
@.str.2 = [5 x i8] c"href\00"
@.str.3 = [10 x i8] c"mkabs.txt\00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [12 x i8] c"%s, %s, %s\0A\00"
define i8** @extract_links(i8* %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = icmp ne i8* %0, null
%6 = icmp ne i8* %1, null
%7 = and i1 %5, %6
br i1 %7, label %8, label %98
8: ; preds = %2
%9 = tail call i8** @calloc(i32 16, i32 8)
%10 = icmp eq i8** %9, null
br i1 %10, label %11, label %87
11: ; preds = %8
%12 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %98
13: ; preds = %96, %49
%14 = phi i8* [ %20, %49 ], [ %97, %96 ]
%15 = call i8* @strstr(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i8* %15, null
br i1 %16, label %98, label %17
17: ; preds = %13
%18 = getelementptr inbounds i8, i8* %15, i64 3
br label %19
19: ; preds = %29, %17
%20 = phi i8* [ %18, %17 ], [ %31, %29 ]
%21 = phi i32 [ 0, %17 ], [ %30, %29 ]
%22 = load i8, i8* %20
switch i8 %22, label %23 [
i8 0, label %98
i8 62, label %32
]
23: ; preds = %19
%24 = icmp slt i32 %21, 512
br i1 %24, label %25, label %29
25: ; preds = %23
%26 = add nsw i32 %21, 1
%27 = sext i32 %21 to i64
%28 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %27
store i8 %22, i8* %28
br label %29
29: ; preds = %25, %23
%30 = phi i32 [ %26, %25 ], [ %21, %23 ]
%31 = getelementptr inbounds i8, i8* %20, i64 1
br label %19
32: ; preds = %19
%33 = sext i32 %21 to i64
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %33
store i8 0, i8* %34
%35 = call i8* @strstr(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp eq i8* %35, null
br i1 %36, label %96, label %37
37: ; preds = %32, %40
%38 = phi i8* [ %41, %40 ], [ %35, %32 ]
%39 = load i8, i8* %38
switch i8 %39, label %40 [
i8 0, label %98
i8 34, label %42
]
40: ; preds = %37
%41 = getelementptr inbounds i8, i8* %38, i64 1
br label %37
42: ; preds = %37
%43 = getelementptr inbounds i8, i8* %38, i64 1
br label %44
44: ; preds = %47, %42
%45 = phi i8* [ %43, %42 ], [ %48, %47 ]
%46 = load i8, i8* %45
switch i8 %46, label %47 [
i8 0, label %98
i8 34, label %49
]
47: ; preds = %44
%48 = getelementptr inbounds i8, i8* %45, i64 1
br label %44
49: ; preds = %44
%50 = ptrtoint i8* %45 to i64
%51 = ptrtoint i8* %43 to i64
%52 = sub i64 %50, %51
%53 = trunc i64 %52 to i32
%54 = call i32 @memmove(i8* %4, i8* %43, i32 %53)
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %52
store i8 0, i8* %55
%56 = call i8* @mkabsurl(i8* %0, i8* %4)
%57 = icmp eq i8* %56, null
br i1 %57, label %13, label %58
58: ; preds = %49
%59 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %58
%64 = call i32 @fprintf(i32* %59, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %0, i8* %4, i8* %56)
%65 = call i32 @fclose(i32* %59)
%66 = add i32 %95, 1
%67 = sext i32 %95 to i64
%68 = getelementptr inbounds i8*, i8** %89, i64 %67
store i8* %56, i8** %68
%69 = icmp slt i32 %95, %92
br i1 %69, label %93, label %70
70: ; preds = %63
%71 = shl i32 %90, 1
%72 = shl i32 %90, 4
%73 = call i8** @realloc(i8** %89, i32 %72)
%74 = icmp eq i8** %73, null
br i1 %74, label %98, label %75
75: ; preds = %70
%76 = icmp slt i32 %66, %71
br i1 %76, label %77, label %86
77: ; preds = %75
%78 = sext i32 %66 to i64
%79 = getelementptr i8*, i8** %73, i64 %78
%80 = bitcast i8** %79 to i8*
%81 = add i32 %71, -2
%82 = sub i32 %81, %95
%83 = zext i32 %82 to i64
%84 = shl nuw nsw i64 %83, 3
%85 = add nuw nsw i64 %84, 8
br label %86
86: ; preds = %77, %75
br label %87
87: ; preds = %8, %86
%88 = phi i8* [ %20, %86 ], [ %1, %8 ]
%89 = phi i8** [ %73, %86 ], [ %9, %8 ]
%90 = phi i32 [ %71, %86 ], [ 16, %8 ]
%91 = phi i32 [ %66, %86 ], [ 0, %8 ]
%92 = add nsw i32 %90, -1
br label %93
93: ; preds = %87, %63
%94 = phi i8* [ %88, %87 ], [ %20, %63 ]
%95 = phi i32 [ %91, %87 ], [ %66, %63 ]
br label %96
96: ; preds = %32, %93
%97 = phi i8* [ %94, %93 ], [ %20, %32 ]
br label %13
98: ; preds = %70, %13, %19, %37, %44, %2, %11
%99 = phi i8** [ null, %11 ], [ null, %2 ], [ %89, %44 ], [ %89, %37 ], [ %89, %19 ], [ %89, %13 ], [ null, %70 ]
ret i8** %99
}