#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*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
char *get_host_from_url(char *);
char getopt(int, char **, char *);
scalar_t__ malloc(int);
char *optarg;
int /*<<< orphan*/ pacparser_cleanup();
char *pacparser_find_proxy(char *, char *);
int /*<<< orphan*/ pacparser_init();
int /*<<< orphan*/ pacparser_parse_pac_file(char *);
int /*<<< orphan*/ pacparser_parse_pac_string(char *);
int /*<<< orphan*/ pacparser_setmyip(char *);
char *pacparser_version();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
char *realloc(char *, size_t);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  char *pacfile = NULL, *url = NULL, *host = NULL, *urlslist = NULL,
       *client_ip = NULL;
  if (argv[1] && ((strcmp((argv[1]), ("--help")) == 0) ||
                  (strcmp((argv[1]), ("--helpshort")) == 0))) {
    usage(argv[0]);
  }
  signed char c;
  while ((c = getopt(argc, argv, "evp:u:h:f:c:")) != -1)
    switch (c) {
    case 'v':
      printf("%s\n", pacparser_version());
      return 0;
    case 'p':
      pacfile = optarg;
      break;
    case 'u':
      url = optarg;
      break;
    case 'h':
      host = optarg;
      break;
    case 'f':
      urlslist = optarg;
      break;
    case 'c':
      client_ip = optarg;
      break;
    case 'e':
      break;
    case '?':
      usage(argv[0]);
    default:
      abort();
    }
  if (!pacfile) {
    fprintf(stderr, "pactester.c: You didn't specify the PAC file\n");
    usage(argv[0]);
  }
  if (!url && !urlslist) {
    fprintf(stderr, "pactester.c: You didn't specify the URL\n");
    usage(argv[0]);
  }
  if (!pacparser_init()) {
    fprintf(stderr, "pactester.c: Could not initialize pacparser\n");
    return 1;
  }
  if ((strcmp(("-"), (pacfile)) == 0)) {
    char *script;
    size_t script_size = 1;
    char buffer[4096];
    script = (char *)malloc(sizeof(char) * 4096);
    if (script == NULL) {
      perror("pactetser.c: Failed to allocate the memory for the script");
      return 1;
    }
    script[0] = '\0';
    while (fgets(buffer, 4096, stdin)) {
      if (strlen(buffer) == 0)
        break;
      char *old = script;
      script_size += strlen(buffer);
      if (script_size > (1024 * 1024)) {
        fprintf(stderr, "Input file is too big. Maximum allowed size is: %d",
                (1024 * 1024));
        free(script);
        return 1;
      }
      script = realloc(script, script_size);
      if (script == NULL) {
        perror("pactester.c: Failed to allocate the memory for the script");
        free(old);
        return 1;
      }
      strcat(script, buffer);
    }
    if (ferror(stdin)) {
      free(script);
      perror("pactester.c: Error reading from stdin");
      return 1;
    }
    if (!pacparser_parse_pac_string(script)) {
      fprintf(stderr, "pactester.c: Could not parse the pac script: %s\n",
              script);
      free(script);
      pacparser_cleanup();
      return 1;
    }
    free(script);
  } else {
    if (!pacparser_parse_pac_file(pacfile)) {
      fprintf(stderr, "pactester.c: Could not parse the pac file: %s\n",
              pacfile);
      pacparser_cleanup();
      return 1;
    }
  }
  if (client_ip)
    pacparser_setmyip(client_ip);
  char *proxy;
  if (url) {
    host = host ? host : get_host_from_url(url);
    if (!host) {
      return 1;
    }
    proxy = pacparser_find_proxy(url, host);
    if (proxy == NULL) {
      fprintf(stderr, "pactester.c: %s %s.\n", "Problem in finding proxy for",
              url);
      pacparser_cleanup();
      return 1;
    }
    printf("%s\n", proxy);
  } else if (urlslist) {
    char line[4096];
    FILE *fp;
    if (!(fp = fopen(urlslist, "r"))) {
      fprintf(stderr, "pactester.c: Could not open urlslist: %s", urlslist);
      pacparser_cleanup();
      return 1;
    }
    while (fgets(line, sizeof(line), fp)) {
      char *url = line;
      while (*url == ' ' || *url == '\t')
        url++;
      if (*url == '#') {
        printf("%s", url);
        continue;
      }
      char *urlend = url;
      while (*urlend != '\r' && *urlend != '\n' && *urlend != '\0' &&
             *urlend != ' ' && *urlend != '\t')
        urlend++;
      *urlend = '\0';
      if (!(host = get_host_from_url(url)))
        continue;
      proxy = NULL;
      proxy = pacparser_find_proxy(url, host);
      if (proxy == NULL) {
        fprintf(stderr, "pactester.c: %s %s.\n", "Problem in finding proxy for",
                url);
        pacparser_cleanup();
        return 1;
      }
      if (proxy)
        printf("%s : %s\n", url, proxy);
    }
    fclose(fp);
  }
  pacparser_cleanup();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2090,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1318 <main+0x98>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe01(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
je     130c <main+0x8c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdea(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1318 <main+0x98>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1130 <usage@plt>
jmp    131d <main+0x9d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdc8(%rip),%rdx
call   1170 <getopt@plt>
mov    %al,-0x39(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     140f <main+0x18f>
movsbl -0x39(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x2080(%rbp)
sub    $0x37,%eax
ja     1403 <main+0x183>
mov    -0x2080(%rbp),%rax
lea    0xc9a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1070 <pacparser_version@plt>
mov    %rax,%rsi
lea    0xf93(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
mov    0x2c5e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    140a <main+0x18a>
mov    0x2c4b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    140a <main+0x18a>
mov    0x2c38(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    140a <main+0x18a>
mov    0x2c25(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    140a <main+0x18a>
mov    0x2c12(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    140a <main+0x18a>
jmp    140a <main+0x18a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1130 <usage@plt>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    131d <main+0x9d>
cmpq   $0x0,-0x18(%rbp)
jne    143d <main+0x1bd>
mov    0x2baf(%rip),%rax
mov    (%rax),%edi
lea    0xcd6(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1130 <usage@plt>
cmpq   $0x0,-0x20(%rbp)
jne    1476 <main+0x1f6>
cmpq   $0x0,-0x30(%rbp)
jne    1476 <main+0x1f6>
mov    0x2b76(%rip),%rax
mov    (%rax),%edi
lea    0xccb(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1130 <usage@plt>
mov    $0x0,%al
call   1080 <pacparser_init@plt>
cmp    $0x0,%eax
jne    14a9 <main+0x229>
mov    0x2b43(%rip),%rax
mov    (%rax),%edi
lea    0xcc1(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
mov    -0x18(%rbp),%rsi
lea    0xcd0(%rip),%rdi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1687 <main+0x407>
movq   $0x1,-0x50(%rbp)
mov    $0x1000,%edi
call   1110 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    14fc <main+0x27c>
lea    0xc9b(%rip),%rdi
call   1160 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x1050(%rbp),%rdi
mov    0x2acf(%rip),%rax
mov    (%rax),%rdx
mov    $0x1000,%esi
call   10d0 <fgets@plt>
cmp    $0x0,%rax
je     15f6 <main+0x376>
lea    -0x1050(%rbp),%rdi
call   10b0 <strlen@plt>
cmp    $0x0,%rax
jne    1543 <main+0x2c3>
jmp    15f6 <main+0x376>
mov    -0x48(%rbp),%rax
mov    %rax,-0x1058(%rbp)
lea    -0x1050(%rbp),%rdi
call   10b0 <strlen@plt>
add    -0x50(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpq   $0x100000,-0x50(%rbp)
jbe    15a1 <main+0x321>
mov    0x2a59(%rip),%rax
mov    (%rax),%edi
lea    0xc40(%rip),%rsi
mov    $0x100000,%edx
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   1120 <realloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    15e1 <main+0x361>
lea    0xc2f(%rip),%rdi
call   1160 <perror@plt>
mov    -0x1058(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
mov    -0x48(%rbp),%rdi
lea    -0x1050(%rbp),%rsi
call   1190 <strcat@plt>
jmp    1503 <main+0x283>
mov    0x29e3(%rip),%rax
mov    (%rax),%rdi
call   1060 <ferror@plt>
cmp    $0x0,%rax
je     1630 <main+0x3b0>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
lea    0xc0e(%rip),%rdi
call   1160 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
mov    -0x48(%rbp),%rdi
call   1180 <pacparser_parse_pac_string@plt>
cmp    $0x0,%eax
jne    1679 <main+0x3f9>
mov    0x2987(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rdx
lea    0xbfd(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1140 <pacparser_cleanup@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
jmp    16cc <main+0x44c>
mov    -0x18(%rbp),%rdi
call   1050 <pacparser_parse_pac_file@plt>
cmp    $0x0,%eax
jne    16c7 <main+0x447>
mov    0x2930(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xbd7(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x0,%al
call   1140 <pacparser_cleanup@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
jmp    16cc <main+0x44c>
cmpq   $0x0,-0x38(%rbp)
je     16e0 <main+0x460>
mov    -0x38(%rbp),%rdi
call   10a0 <pacparser_setmyip@plt>
cmpq   $0x0,-0x20(%rbp)
je     17a9 <main+0x529>
cmpq   $0x0,-0x28(%rbp)
je     1706 <main+0x486>
mov    -0x28(%rbp),%rax
mov    %rax,-0x2088(%rbp)
jmp    1716 <main+0x496>
mov    -0x20(%rbp),%rdi
call   11a0 <get_host_from_url@plt>
mov    %rax,-0x2088(%rbp)
mov    -0x2088(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1738 <main+0x4b8>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1100 <pacparser_find_proxy@plt>
mov    %rax,-0x1060(%rbp)
cmpq   $0x0,-0x1060(%rbp)
jne    178f <main+0x50f>
mov    0x286f(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rcx
lea    0xb45(%rip),%rsi
lea    0xb53(%rip),%rdx
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x0,%al
call   1140 <pacparser_cleanup@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
mov    -0x1060(%rbp),%rsi
lea    0xb76(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
jmp    1a4b <main+0x7cb>
cmpq   $0x0,-0x30(%rbp)
je     1a46 <main+0x7c6>
mov    -0x30(%rbp),%rdi
lea    0xb24(%rip),%rsi
call   1150 <fopen@plt>
mov    %rax,-0x2068(%rbp)
cmp    $0x0,%rax
jne    1803 <main+0x583>
mov    0x27f4(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xafc(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x0,%al
call   1140 <pacparser_cleanup@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
jmp    1808 <main+0x588>
lea    -0x2060(%rbp),%rdi
mov    -0x2068(%rbp),%rdx
mov    $0x1000,%esi
call   10d0 <fgets@plt>
cmp    $0x0,%rax
je     1a3a <main+0x7ba>
lea    -0x2060(%rbp),%rax
mov    %rax,-0x2070(%rbp)
mov    -0x2070(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2089(%rbp)
je     1869 <main+0x5e9>
mov    -0x2070(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x2089(%rbp)
mov    -0x2089(%rbp),%al
test   $0x1,%al
jne    187c <main+0x5fc>
jmp    1893 <main+0x613>
mov    -0x2070(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x2070(%rbp)
jmp    1838 <main+0x5b8>
mov    -0x2070(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    18c0 <main+0x640>
mov    -0x2070(%rbp),%rsi
lea    0xa57(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
jmp    1808 <main+0x588>
mov    -0x2070(%rbp),%rax
mov    %rax,-0x2078(%rbp)
mov    -0x2078(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0x208a(%rbp)
je     1950 <main+0x6d0>
mov    -0x2078(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x208a(%rbp)
je     1950 <main+0x6d0>
mov    -0x2078(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x208a(%rbp)
je     1950 <main+0x6d0>
mov    -0x2078(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x208a(%rbp)
je     1950 <main+0x6d0>
mov    -0x2078(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
setne  %al
mov    %al,-0x208a(%rbp)
mov    -0x208a(%rbp),%al
test   $0x1,%al
jne    1963 <main+0x6e3>
jmp    197a <main+0x6fa>
mov    -0x2078(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x2078(%rbp)
jmp    18ce <main+0x64e>
mov    -0x2078(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x2070(%rbp),%rdi
call   11a0 <get_host_from_url@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    19a3 <main+0x723>
jmp    1808 <main+0x588>
movq   $0x0,-0x1060(%rbp)
mov    -0x2070(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1100 <pacparser_find_proxy@plt>
mov    %rax,-0x1060(%rbp)
cmpq   $0x0,-0x1060(%rbp)
jne    1a0b <main+0x78b>
mov    0x25f6(%rip),%rax
mov    (%rax),%edi
mov    -0x2070(%rbp),%rcx
lea    0x8c9(%rip),%rsi
lea    0x8d7(%rip),%rdx
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x0,%al
call   1140 <pacparser_cleanup@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a59 <main+0x7d9>
cmpq   $0x0,-0x1060(%rbp)
je     1a35 <main+0x7b5>
mov    -0x2070(%rbp),%rsi
mov    -0x1060(%rbp),%rdx
lea    0x8e0(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
jmp    1808 <main+0x588>
mov    -0x2068(%rbp),%rdi
call   1090 <fclose@plt>
jmp    1a4b <main+0x7cb>
mov    $0x0,%al
call   1140 <pacparser_cleanup@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2090,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1028,%rsp
mov    %rsi,%rbx
mov    %edi,%r15d
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     12ce <main+0x4e>
lea    0xe39(%rip),%rsi
call   10e0 <strcmp@plt>
test   %rax,%rax
je     12c6 <main+0x46>
mov    0x8(%rbx),%rdi
lea    0xe2b(%rip),%rsi
call   10e0 <strcmp@plt>
test   %rax,%rax
jne    12ce <main+0x4e>
mov    (%rbx),%rdi
call   1130 <usage@plt>
lea    0xe1e(%rip),%rdx
mov    %r15d,%edi
mov    %rbx,%rsi
call   1170 <getopt@plt>
cmp    $0xff,%al
je     1388 <main+0x108>
xor    %ebp,%ebp
lea    0xd0f(%rip),%r14
mov    0x2d00(%rip),%r13
lea    0xdf4(%rip),%r12
xor    %ecx,%ecx
mov    %rcx,0x18(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x10(%rsp)
xor    %ecx,%ecx
mov    %rcx,(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x8(%rsp)
jmp    1332 <main+0xb2>
mov    0x0(%r13),%rbp
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1170 <getopt@plt>
cmp    $0xff,%al
je     1375 <main+0xf5>
movsbl %al,%eax
add    $0xffffffc1,%eax
cmp    $0x37,%eax
ja     17b4 <main+0x534>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    0x0(%r13),%rax
mov    %rax,0x10(%rsp)
jmp    1320 <main+0xa0>
mov    0x0(%r13),%rax
mov    %rax,(%rsp)
jmp    1320 <main+0xa0>
mov    0x0(%r13),%rax
mov    %rax,0x8(%rsp)
jmp    1320 <main+0xa0>
mov    0x0(%r13),%rax
mov    %rax,0x18(%rsp)
jmp    1320 <main+0xa0>
mov    %rbp,%r14
test   %rbp,%rbp
mov    0x18(%rsp),%r13
mov    (%rsp),%rbp
jne    13bd <main+0x13d>
jmp    139b <main+0x11b>
xor    %r13d,%r13d
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    0x2c2e(%rip),%rax
mov    (%rax),%edi
lea    0xd55(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    (%rbx),%rdi
call   1130 <usage@plt>
mov    %r13,%rax
or     %rbp,%rax
jne    13e4 <main+0x164>
mov    0x2c04(%rip),%rax
mov    (%rax),%edi
lea    0xd59(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    (%rbx),%rdi
call   1130 <usage@plt>
xor    %eax,%eax
call   1080 <pacparser_init@plt>
test   %eax,%eax
je     1432 <main+0x1b2>
lea    0xd8e(%rip),%rdi
mov    %r14,%rsi
call   10e0 <strcmp@plt>
test   %rax,%rax
je     144e <main+0x1ce>
mov    %r14,%rdi
call   1050 <pacparser_parse_pac_file@plt>
test   %eax,%eax
jne    1548 <main+0x2c8>
mov    0x2bb6(%rip),%rax
mov    (%rax),%edi
lea    0xe61(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10f0 <fprintf@plt>
jmp    16fd <main+0x47d>
mov    0x2b97(%rip),%rax
mov    (%rax),%edi
lea    0xd15(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
jmp    1704 <main+0x484>
mov    $0x1000,%edi
call   1110 <malloc@plt>
test   %rax,%rax
je     175b <main+0x4db>
mov    %rax,%rbx
mov    %rbp,(%rsp)
movb   $0x0,(%rax)
mov    0x2b6e(%rip),%r14
mov    (%r14),%rdx
lea    0x20(%rsp),%rdi
mov    $0x1000,%esi
call   10d0 <fgets@plt>
test   %rax,%rax
je     151b <main+0x29b>
mov    $0x1,%ebp
lea    0x20(%rsp),%r12
mov    %rbx,%r15
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   10b0 <strlen@plt>
test   %rax,%rax
je     1518 <main+0x298>
add    %rax,%rbp
cmp    $0x100001,%rbp
jae    171d <main+0x49d>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1120 <realloc@plt>
test   %rax,%rax
je     179e <main+0x51e>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1190 <strcat@plt>
mov    (%r14),%rdx
mov    %r12,%rdi
mov    $0x1000,%esi
call   10d0 <fgets@plt>
mov    %rbx,%r15
test   %rax,%rax
jne    14a0 <main+0x220>
jmp    151b <main+0x29b>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <pacparser_version@plt>
lea    0xe0a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
jmp    1709 <main+0x489>
mov    %r15,%rbx
mov    (%r14),%rdi
call   1060 <ferror@plt>
test   %rax,%rax
jne    1769 <main+0x4e9>
mov    %rbx,%rdi
call   1180 <pacparser_parse_pac_string@plt>
test   %eax,%eax
je     16db <main+0x45b>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    (%rsp),%rbp
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     1557 <main+0x2d7>
call   10a0 <pacparser_setmyip@plt>
test   %r13,%r13
je     15a1 <main+0x321>
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
jne    157a <main+0x2fa>
mov    %r13,%rdi
call   11a0 <get_host_from_url@plt>
mov    %rax,%rsi
test   %rax,%rax
je     1704 <main+0x484>
mov    %r13,%rdi
call   1100 <pacparser_find_proxy@plt>
test   %rax,%rax
je     16b8 <main+0x438>
lea    0xd81(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
jmp    16ad <main+0x42d>
test   %rbp,%rbp
je     16ad <main+0x42d>
lea    0xd32(%rip),%rsi
mov    %rbp,%rdi
call   1150 <fopen@plt>
test   %rax,%rax
je     1743 <main+0x4c3>
mov    %rax,%rbx
lea    0x20(%rsp),%r12
mov    %r12,%rdi
mov    $0x1000,%esi
mov    %rax,%rdx
call   10d0 <fgets@plt>
test   %rax,%rax
je     16a5 <main+0x425>
lea    0xd21(%rip),%r14
movabs $0x100002601,%r13
lea    0xd13(%rip),%r15
mov    %r12,%rbp
jmp    1604 <main+0x384>
add    $0x1,%rbp
mov    0x0(%rbp),%al
cmp    $0x9,%al
je     1600 <main+0x380>
cmp    $0x20,%al
je     1600 <main+0x380>
cmp    $0x23,%al
jne    1630 <main+0x3b0>
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
jmp    1689 <main+0x409>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rbp),%rcx
jmp    1647 <main+0x3c7>
cs nopw 0x0(%rax,%rax,1)
movzbl (%rcx),%eax
add    $0x1,%rcx
cmp    $0x20,%al
ja     1640 <main+0x3c0>
movzbl %al,%eax
bt     %rax,%r13
jae    1640 <main+0x3c0>
movb   $0x0,-0x1(%rcx)
mov    %rbp,%rdi
call   11a0 <get_host_from_url@plt>
test   %rax,%rax
je     1689 <main+0x409>
mov    %rbp,%rdi
mov    %rax,%rsi
call   1100 <pacparser_find_proxy@plt>
test   %rax,%rax
je     177f <main+0x4ff>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r12,%rdi
mov    $0x1000,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
mov    %r12,%rbp
test   %rax,%rax
jne    1604 <main+0x384>
mov    %rbx,%rdi
call   1090 <fclose@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1140 <pacparser_cleanup@plt>
jmp    1709 <main+0x489>
mov    0x2911(%rip),%rax
mov    (%rax),%edi
lea    0xbeb(%rip),%rsi
lea    0xbf9(%rip),%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   10f0 <fprintf@plt>
jmp    16fd <main+0x47d>
mov    0x28ee(%rip),%rax
mov    (%rax),%edi
lea    0xb68(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1140 <pacparser_cleanup@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x1028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x28ac(%rip),%rax
mov    (%rax),%edi
lea    0xa93(%rip),%rsi
mov    $0x100000,%edx
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
jmp    1704 <main+0x484>
mov    0x2886(%rip),%rax
mov    (%rax),%edi
lea    0xb92(%rip),%rsi
mov    %rbp,%rdx
jmp    1426 <main+0x1a6>
lea    0xa24(%rip),%rdi
call   1160 <perror@plt>
jmp    1704 <main+0x484>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xab5(%rip),%rdi
call   1160 <perror@plt>
jmp    1704 <main+0x484>
mov    0x284a(%rip),%rax
mov    (%rax),%edi
lea    0xb24(%rip),%rsi
lea    0xb32(%rip),%rdx
mov    %rbp,%rcx
jmp    16d2 <main+0x452>
lea    0xa4e(%rip),%rdi
call   1160 <perror@plt>
jmp    1739 <main+0x4b9>
mov    (%rbx),%rdi
call   1130 <usage@plt>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [12 x i8] c"--helpshort\00"
@.str.2 = [13 x i8] c"evp:u:h:f:c:\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.4 = [46 x i8] c"pactester.c: You didn't specify the PAC file\0A\00"
@.str.5 = [41 x i8] c"pactester.c: You didn't specify the URL\0A\00"
@.str.6 = [45 x i8] c"pactester.c: Could not initialize pacparser\0A\00"
@.str.7 = [2 x i8] c"-\00"
@.str.8 = [58 x i8] c"pactetser.c: Failed to allocate the memory for the script\00"
@stdin = global i32* null
@.str.9 = [51 x i8] c"Input file is too big. Maximum allowed size is: %d\00"
@.str.10 = [58 x i8] c"pactester.c: Failed to allocate the memory for the script\00"
@.str.11 = [38 x i8] c"pactester.c: Error reading from stdin\00"
@.str.12 = [49 x i8] c"pactester.c: Could not parse the pac script: %s\0A\00"
@.str.13 = [47 x i8] c"pactester.c: Could not parse the pac file: %s\0A\00"
@.str.14 = [21 x i8] c"pactester.c: %s %s.\0A\00"
@.str.15 = [29 x i8] c"Problem in finding proxy for\00"
@.str.16 = [2 x i8] c"r\00"
@.str.17 = [41 x i8] c"pactester.c: Could not open urlslist: %s\00"
@.str.18 = [3 x i8] c"%s\00"
@.str.19 = [9 x i8] c"%s : %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8
%12 = alloca i8*
%13 = alloca i64
%14 = alloca [4096 x i8]
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca [4096 x i8]
%18 = alloca i32*
%19 = alloca i8*
%20 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
store i8* null, i8** %10
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %42
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %37, label %31
31: ; preds = %25
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %42
37: ; preds = %31, %25
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
%41 = call i32 @usage(i8* %40)
br label %42
42: ; preds = %37, %31, %2
br label %43
43: ; preds = %73, %42
%44 = load i32, i32* %4
%45 = load i8**, i8*** %5
%46 = call signext i8 @getopt(i32 %44, i8** %45, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i8 %46, i8* %11
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, -1
br i1 %48, label %49, label %74
49: ; preds = %43
%50 = load i8, i8* %11
%51 = sext i8 %50 to i32
switch i32 %51, label %71 [
i32 118, label %52
i32 112, label %55
i32 117, label %57
i32 104, label %59
i32 102, label %61
i32 99, label %63
i32 101, label %65
i32 63, label %66
]
52: ; preds = %49
%53 = call i8* (...) @pacparser_version()
%54 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %53)
store i32 0, i32* %3
br label %328
55: ; preds = %49
%56 = load i8*, i8** @optarg
store i8* %56, i8** %6
br label %73
57: ; preds = %49
%58 = load i8*, i8** @optarg
store i8* %58, i8** %7
br label %73
59: ; preds = %49
%60 = load i8*, i8** @optarg
store i8* %60, i8** %8
br label %73
61: ; preds = %49
%62 = load i8*, i8** @optarg
store i8* %62, i8** %9
br label %73
63: ; preds = %49
%64 = load i8*, i8** @optarg
store i8* %64, i8** %10
br label %73
65: ; preds = %49
br label %73
66: ; preds = %49
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 0
%69 = load i8*, i8** %68
%70 = call i32 @usage(i8* %69)
br label %71
71: ; preds = %49, %66
%72 = call i32 (...) @abort()
unreachable
73: ; preds = %65, %63, %61, %59, %57, %55
br label %43
74: ; preds = %43
%75 = load i8*, i8** %6
%76 = icmp ne i8* %75, null
br i1 %76, label %84, label %77
77: ; preds = %74
%78 = load i32, i32* @stderr
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%80 = load i8**, i8*** %5
%81 = getelementptr inbounds i8*, i8** %80, i64 0
%82 = load i8*, i8** %81
%83 = call i32 @usage(i8* %82)
br label %84
84: ; preds = %77, %74
%85 = load i8*, i8** %7
%86 = icmp ne i8* %85, null
br i1 %86, label %97, label %87
87: ; preds = %84
%88 = load i8*, i8** %9
%89 = icmp ne i8* %88, null
br i1 %89, label %97, label %90
90: ; preds = %87
%91 = load i32, i32* @stderr
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 0
%95 = load i8*, i8** %94
%96 = call i32 @usage(i8* %95)
br label %97
97: ; preds = %90, %87, %84
%98 = call i32 (...) @pacparser_init()
%99 = icmp ne i32 %98, 0
br i1 %99, label %103, label %100
100: ; preds = %97
%101 = load i32, i32* @stderr
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %328
103: ; preds = %97
%104 = load i8*, i8** %6
%105 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* %104)
%106 = icmp eq i64 %105, 0
br i1 %106, label %107, label %176
107: ; preds = %103
store i64 1, i64* %13
%108 = call i64 @malloc(i32 4096)
%109 = inttoptr i64 %108 to i8*
store i8* %109, i8** %12
%110 = load i8*, i8** %12
%111 = icmp eq i8* %110, null
br i1 %111, label %112, label %114
112: ; preds = %107
%113 = call i32 @perror(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %328
114: ; preds = %107
%115 = load i8*, i8** %12
%116 = getelementptr inbounds i8, i8* %115, i64 0
store i8 0, i8* %116
br label %117
117: ; preds = %150, %114
%118 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%119 = load i32*, i32** @stdin
%120 = call i64 @fgets(i8* %118, i32 4096, i32* %119)
%121 = icmp ne i64 %120, 0
br i1 %121, label %122, label %154
122: ; preds = %117
%123 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%124 = call i64 @strlen(i8* %123)
%125 = icmp eq i64 %124, 0
br i1 %125, label %126, label %127
126: ; preds = %122
br label %154
127: ; preds = %122
%128 = load i8*, i8** %12
store i8* %128, i8** %15
%129 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%130 = call i64 @strlen(i8* %129)
%131 = load i64, i64* %13
%132 = add i64 %131, %130
store i64 %132, i64* %13
%133 = load i64, i64* %13
%134 = icmp ugt i64 %133, 1048576
br i1 %134, label %135, label %140
135: ; preds = %127
%136 = load i32, i32* @stderr
%137 = call i32 (i32, i8*, ...) @fprintf(i32 %136, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.9, i64 0, i64 0), i32 1048576)
%138 = load i8*, i8** %12
%139 = call i32 @free(i8* %138)
store i32 1, i32* %3
br label %328
140: ; preds = %127
%141 = load i8*, i8** %12
%142 = load i64, i64* %13
%143 = call i8* @realloc(i8* %141, i64 %142)
store i8* %143, i8** %12
%144 = load i8*, i8** %12
%145 = icmp eq i8* %144, null
br i1 %145, label %146, label %150
146: ; preds = %140
%147 = call i32 @perror(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.10, i64 0, i64 0))
%148 = load i8*, i8** %15
%149 = call i32 @free(i8* %148)
store i32 1, i32* %3
br label %328
150: ; preds = %140
%151 = load i8*, i8** %12
%152 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%153 = call i32 @strcat(i8* %151, i8* %152)
br label %117
154: ; preds = %126, %117
%155 = load i32*, i32** @stdin
%156 = call i64 @ferror(i32* %155)
%157 = icmp ne i64 %156, 0
br i1 %157, label %158, label %162
158: ; preds = %154
%159 = load i8*, i8** %12
%160 = call i32 @free(i8* %159)
%161 = call i32 @perror(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %328
162: ; preds = %154
%163 = load i8*, i8** %12
%164 = call i32 @pacparser_parse_pac_string(i8* %163)
%165 = icmp ne i32 %164, 0
br i1 %165, label %173, label %166
166: ; preds = %162
%167 = load i32, i32* @stderr
%168 = load i8*, i8** %12
%169 = call i32 (i32, i8*, ...) @fprintf(i32 %167, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.12, i64 0, i64 0), i8* %168)
%170 = load i8*, i8** %12
%171 = call i32 @free(i8* %170)
%172 = call i32 (...) @pacparser_cleanup()
store i32 1, i32* %3
br label %328
173: ; preds = %162
%174 = load i8*, i8** %12
%175 = call i32 @free(i8* %174)
br label %186
176: ; preds = %103
%177 = load i8*, i8** %6
%178 = call i32 @pacparser_parse_pac_file(i8* %177)
%179 = icmp ne i32 %178, 0
br i1 %179, label %185, label %180
180: ; preds = %176
%181 = load i32, i32* @stderr
%182 = load i8*, i8** %6
%183 = call i32 (i32, i8*, ...) @fprintf(i32 %181, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.13, i64 0, i64 0), i8* %182)
%184 = call i32 (...) @pacparser_cleanup()
store i32 1, i32* %3
br label %328
185: ; preds = %176
br label %186
186: ; preds = %185, %173
%187 = load i8*, i8** %10
%188 = icmp ne i8* %187, null
br i1 %188, label %189, label %192
189: ; preds = %186
%190 = load i8*, i8** %10
%191 = call i32 @pacparser_setmyip(i8* %190)
br label %192
192: ; preds = %189, %186
%193 = load i8*, i8** %7
%194 = icmp ne i8* %193, null
br i1 %194, label %195, label %222
195: ; preds = %192
%196 = load i8*, i8** %8
%197 = icmp ne i8* %196, null
br i1 %197, label %198, label %200
198: ; preds = %195
%199 = load i8*, i8** %8
br label %203
200: ; preds = %195
%201 = load i8*, i8** %7
%202 = call i8* @get_host_from_url(i8* %201)
br label %203
203: ; preds = %200, %198
%204 = phi i8* [ %199, %198 ], [ %202, %200 ]
store i8* %204, i8** %8
%205 = load i8*, i8** %8
%206 = icmp ne i8* %205, null
br i1 %206, label %208, label %207
207: ; preds = %203
store i32 1, i32* %3
br label %328
208: ; preds = %203
%209 = load i8*, i8** %7
%210 = load i8*, i8** %8
%211 = call i8* @pacparser_find_proxy(i8* %209, i8* %210)
store i8* %211, i8** %16
%212 = load i8*, i8** %16
%213 = icmp eq i8* %212, null
br i1 %213, label %214, label %219
214: ; preds = %208
%215 = load i32, i32* @stderr
%216 = load i8*, i8** %7
%217 = call i32 (i32, i8*, ...) @fprintf(i32 %215, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i64 0, i64 0), i8* %216)
%218 = call i32 (...) @pacparser_cleanup()
store i32 1, i32* %3
br label %328
219: ; preds = %208
%220 = load i8*, i8** %16
%221 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %220)
br label %326
222: ; preds = %192
%223 = load i8*, i8** %9
%224 = icmp ne i8* %223, null
br i1 %224, label %225, label %325
225: ; preds = %222
%226 = load i8*, i8** %9
%227 = call i32* @fopen(i8* %226, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
store i32* %227, i32** %18
%228 = icmp ne i32* %227, null
br i1 %228, label %234, label %229
229: ; preds = %225
%230 = load i32, i32* @stderr
%231 = load i8*, i8** %9
%232 = call i32 (i32, i8*, ...) @fprintf(i32 %230, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.17, i64 0, i64 0), i8* %231)
%233 = call i32 (...) @pacparser_cleanup()
store i32 1, i32* %3
br label %328
234: ; preds = %225
br label %235
235: ; preds = %321, %302, %262, %234
%236 = getelementptr inbounds [4096 x i8], [4096 x i8]* %17, i64 0, i64 0
%237 = load i32*, i32** %18
%238 = call i64 @fgets(i8* %236, i32 4096, i32* %237)
%239 = icmp ne i64 %238, 0
br i1 %239, label %240, label %322
240: ; preds = %235
%241 = getelementptr inbounds [4096 x i8], [4096 x i8]* %17, i64 0, i64 0
store i8* %241, i8** %19
br label %242
242: ; preds = %254, %240
%243 = load i8*, i8** %19
%244 = load i8, i8* %243
%245 = sext i8 %244 to i32
%246 = icmp eq i32 %245, 32
br i1 %246, label %252, label %247
247: ; preds = %242
%248 = load i8*, i8** %19
%249 = load i8, i8* %248
%250 = sext i8 %249 to i32
%251 = icmp eq i32 %250, 9
br label %252
252: ; preds = %247, %242
%253 = phi i1 [ true, %242 ], [ %251, %247 ]
br i1 %253, label %254, label %257
254: ; preds = %252
%255 = load i8*, i8** %19
%256 = getelementptr inbounds i8, i8* %255, i32 1
store i8* %256, i8** %19
br label %242
257: ; preds = %252
%258 = load i8*, i8** %19
%259 = load i8, i8* %258
%260 = sext i8 %259 to i32
%261 = icmp eq i32 %260, 35
br i1 %261, label %262, label %265
262: ; preds = %257
%263 = load i8*, i8** %19
%264 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i64 0, i64 0), i8* %263)
br label %235
265: ; preds = %257
%266 = load i8*, i8** %19
store i8* %266, i8** %20
br label %267
267: ; preds = %294, %265
%268 = load i8*, i8** %20
%269 = load i8, i8* %268
%270 = sext i8 %269 to i32
%271 = icmp ne i32 %270, 13
br i1 %271, label %272, label %292
272: ; preds = %267
%273 = load i8*, i8** %20
%274 = load i8, i8* %273
%275 = sext i8 %274 to i32
%276 = icmp ne i32 %275, 10
br i1 %276, label %277, label %292
277: ; preds = %272
%278 = load i8*, i8** %20
%279 = load i8, i8* %278
%280 = sext i8 %279 to i32
%281 = icmp ne i32 %280, 0
br i1 %281, label %282, label %292
282: ; preds = %277
%283 = load i8*, i8** %20
%284 = load i8, i8* %283
%285 = sext i8 %284 to i32
%286 = icmp ne i32 %285, 32
br i1 %286, label %287, label %292
287: ; preds = %282
%288 = load i8*, i8** %20
%289 = load i8, i8* %288
%290 = sext i8 %289 to i32
%291 = icmp ne i32 %290, 9
br label %292
292: ; preds = %287, %282, %277, %272, %267
%293 = phi i1 [ false, %282 ], [ false, %277 ], [ false, %272 ], [ false, %267 ], [ %291, %287 ]
br i1 %293, label %294, label %297
294: ; preds = %292
%295 = load i8*, i8** %20
%296 = getelementptr inbounds i8, i8* %295, i32 1
store i8* %296, i8** %20
br label %267
297: ; preds = %292
%298 = load i8*, i8** %20
store i8 0, i8* %298
%299 = load i8*, i8** %19
%300 = call i8* @get_host_from_url(i8* %299)
store i8* %300, i8** %8
%301 = icmp ne i8* %300, null
br i1 %301, label %303, label %302
302: ; preds = %297
br label %235
303: ; preds = %297
store i8* null, i8** %16
%304 = load i8*, i8** %19
%305 = load i8*, i8** %8
%306 = call i8* @pacparser_find_proxy(i8* %304, i8* %305)
store i8* %306, i8** %16
%307 = load i8*, i8** %16
%308 = icmp eq i8* %307, null
br i1 %308, label %309, label %314
309: ; preds = %303
%310 = load i32, i32* @stderr
%311 = load i8*, i8** %19
%312 = call i32 (i32, i8*, ...) @fprintf(i32 %310, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i64 0, i64 0), i8* %311)
%313 = call i32 (...) @pacparser_cleanup()
store i32 1, i32* %3
br label %328
314: ; preds = %303
%315 = load i8*, i8** %16
%316 = icmp ne i8* %315, null
br i1 %316, label %317, label %321
317: ; preds = %314
%318 = load i8*, i8** %19
%319 = load i8*, i8** %16
%320 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.19, i64 0, i64 0), i8* %318, i8* %319)
br label %321
321: ; preds = %317, %314
br label %235
322: ; preds = %235
%323 = load i32*, i32** %18
%324 = call i32 @fclose(i32* %323)
br label %325
325: ; preds = %322, %222
br label %326
326: ; preds = %325, %219
%327 = call i32 (...) @pacparser_cleanup()
store i32 0, i32* %3
br label %328
328: ; preds = %326, %309, %229, %214, %207, %180, %166, %158, %146, %135, %112, %100, %52
%329 = load i32, i32* %3
ret i32 %329
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.1 = [12 x i8] c"--helpshort\00"
@.str.2 = [13 x i8] c"evp:u:h:f:c:\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.4 = [46 x i8] c"pactester.c: You didn't specify the PAC file\0A\00"
@.str.5 = [41 x i8] c"pactester.c: You didn't specify the URL\0A\00"
@.str.6 = [45 x i8] c"pactester.c: Could not initialize pacparser\0A\00"
@.str.7 = [2 x i8] c"-\00"
@.str.8 = [58 x i8] c"pactetser.c: Failed to allocate the memory for the script\00"
@stdin = global i32* null
@.str.9 = [51 x i8] c"Input file is too big. Maximum allowed size is: %d\00"
@.str.10 = [58 x i8] c"pactester.c: Failed to allocate the memory for the script\00"
@.str.11 = [38 x i8] c"pactester.c: Error reading from stdin\00"
@.str.12 = [49 x i8] c"pactester.c: Could not parse the pac script: %s\0A\00"
@.str.13 = [47 x i8] c"pactester.c: Could not parse the pac file: %s\0A\00"
@.str.14 = [21 x i8] c"pactester.c: %s %s.\0A\00"
@.str.15 = [29 x i8] c"Problem in finding proxy for\00"
@.str.16 = [2 x i8] c"r\00"
@.str.17 = [41 x i8] c"pactester.c: Could not open urlslist: %s\00"
@.str.18 = [3 x i8] c"%s\00"
@.str.19 = [9 x i8] c"%s : %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [4096 x i8]
%4 = alloca [4096 x i8]
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %18, label %8
8: ; preds = %2
%9 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = load i8*, i8** %5
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11, %8
%16 = load i8*, i8** %1
%17 = tail call i32 @usage(i8* %16)
br label %18
18: ; preds = %15, %11, %2
%19 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i8 %19, -1
br i1 %20, label %57, label %21
21: ; preds = %18, %47
%22 = phi i8 [ %53, %47 ], [ %19, %18 ]
%23 = phi i8* [ %52, %47 ], [ null, %18 ]
%24 = phi i8* [ %51, %47 ], [ null, %18 ]
%25 = phi i8* [ %50, %47 ], [ null, %18 ]
%26 = phi i8* [ %49, %47 ], [ null, %18 ]
%27 = phi i8* [ %48, %47 ], [ null, %18 ]
%28 = sext i8 %22 to i32
switch i32 %28, label %45 [
i32 118, label %29
i32 112, label %32
i32 117, label %34
i32 104, label %36
i32 102, label %38
i32 99, label %40
i32 101, label %47
i32 63, label %42
]
29: ; preds = %21
%30 = tail call i8* (...) @pacparser_version()
%31 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %30)
br label %215
32: ; preds = %21
%33 = load i8*, i8** @optarg
br label %47
34: ; preds = %21
%35 = load i8*, i8** @optarg
br label %47
36: ; preds = %21
%37 = load i8*, i8** @optarg
br label %47
38: ; preds = %21
%39 = load i8*, i8** @optarg
br label %47
40: ; preds = %21
%41 = load i8*, i8** @optarg
br label %47
42: ; preds = %21
%43 = load i8*, i8** %1
%44 = tail call i32 @usage(i8* %43)
br label %45
45: ; preds = %21, %42
%46 = tail call i32 (...) @abort()
unreachable
47: ; preds = %21, %40, %38, %36, %34, %32
%48 = phi i8* [ %27, %21 ], [ %27, %40 ], [ %27, %38 ], [ %37, %36 ], [ %27, %34 ], [ %27, %32 ]
%49 = phi i8* [ %26, %21 ], [ %26, %40 ], [ %39, %38 ], [ %26, %36 ], [ %26, %34 ], [ %26, %32 ]
%50 = phi i8* [ %25, %21 ], [ %41, %40 ], [ %25, %38 ], [ %25, %36 ], [ %25, %34 ], [ %25, %32 ]
%51 = phi i8* [ %24, %21 ], [ %24, %40 ], [ %24, %38 ], [ %24, %36 ], [ %35, %34 ], [ %24, %32 ]
%52 = phi i8* [ %23, %21 ], [ %23, %40 ], [ %23, %38 ], [ %23, %36 ], [ %23, %34 ], [ %33, %32 ]
%53 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%54 = icmp eq i8 %53, -1
br i1 %54, label %55, label %21
55: ; preds = %47
%56 = icmp eq i8* %52, null
br i1 %56, label %57, label %66
57: ; preds = %18, %55
%58 = phi i8* [ %51, %55 ], [ null, %18 ]
%59 = phi i8* [ %50, %55 ], [ null, %18 ]
%60 = phi i8* [ %49, %55 ], [ null, %18 ]
%61 = phi i8* [ %48, %55 ], [ null, %18 ]
%62 = load i32, i32* @stderr
%63 = tail call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%64 = load i8*, i8** %1
%65 = tail call i32 @usage(i8* %64)
br label %66
66: ; preds = %57, %55
%67 = phi i8* [ null, %57 ], [ %52, %55 ]
%68 = phi i8* [ %58, %57 ], [ %51, %55 ]
%69 = phi i8* [ %59, %57 ], [ %50, %55 ]
%70 = phi i8* [ %60, %57 ], [ %49, %55 ]
%71 = phi i8* [ %61, %57 ], [ %48, %55 ]
%72 = icmp ne i8* %68, null
%73 = icmp ne i8* %70, null
%74 = select i1 %72, i1 true, i1 %73
br i1 %74, label %80, label %75
75: ; preds = %66
%76 = load i32, i32* @stderr
%77 = tail call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%78 = load i8*, i8** %1
%79 = tail call i32 @usage(i8* %78)
br label %80
80: ; preds = %75, %66
%81 = tail call i32 (...) @pacparser_init()
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %86
83: ; preds = %80
%84 = load i32, i32* @stderr
%85 = tail call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
br label %215
86: ; preds = %80
%87 = tail call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* %67)
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %142
89: ; preds = %86
%90 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%91 = tail call i64 @malloc(i32 4096)
%92 = inttoptr i64 %91 to i8*
%93 = icmp eq i64 %91, 0
br i1 %93, label %94, label %96
94: ; preds = %89
%95 = tail call i32 @perror(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.8, i64 0, i64 0))
br label %139
96: ; preds = %89
store i8 0, i8* %92
%97 = load i32*, i32** @stdin
%98 = call i64 @fgets(i8* %90, i32 4096, i32* %97)
%99 = icmp eq i64 %98, 0
br i1 %99, label %123, label %100
100: ; preds = %96, %118
%101 = phi i64 [ %106, %118 ], [ 1, %96 ]
%102 = phi i8* [ %113, %118 ], [ %92, %96 ]
%103 = call i64 @strlen(i8* %90)
%104 = icmp eq i64 %103, 0
br i1 %104, label %123, label %105
105: ; preds = %100
%106 = add i64 %103, %101
%107 = icmp ugt i64 %106, 1048576
br i1 %107, label %108, label %112
108: ; preds = %105
%109 = load i32, i32* @stderr
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.9, i64 0, i64 0), i32 1048576)
%111 = call i32 @free(i8* %102)
br label %139
112: ; preds = %105
%113 = call i8* @realloc(i8* %102, i64 %106)
%114 = icmp eq i8* %113, null
br i1 %114, label %115, label %118
115: ; preds = %112
%116 = call i32 @perror(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.10, i64 0, i64 0))
%117 = call i32 @free(i8* %102)
br label %139
118: ; preds = %112
%119 = call i32 @strcat(i8* %113, i8* %90)
%120 = load i32*, i32** @stdin
%121 = call i64 @fgets(i8* %90, i32 4096, i32* %120)
%122 = icmp eq i64 %121, 0
br i1 %122, label %123, label %100
123: ; preds = %118, %100, %96
%124 = phi i8* [ %92, %96 ], [ %102, %100 ], [ %113, %118 ]
%125 = load i32*, i32** @stdin
%126 = call i64 @ferror(i32* %125)
%127 = icmp eq i64 %126, 0
br i1 %127, label %131, label %128
128: ; preds = %123
%129 = call i32 @free(i8* %124)
%130 = call i32 @perror(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0))
br label %139
131: ; preds = %123
%132 = call i32 @pacparser_parse_pac_string(i8* %124)
%133 = icmp eq i32 %132, 0
br i1 %133, label %134, label %140
134: ; preds = %131
%135 = load i32, i32* @stderr
%136 = call i32 (i32, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.12, i64 0, i64 0), i8* %124)
%137 = call i32 @free(i8* %124)
%138 = call i32 (...) @pacparser_cleanup()
br label %139
139: ; preds = %134, %128, %94, %115, %108
br label %215
140: ; preds = %131
%141 = call i32 @free(i8* %124)
br label %149
142: ; preds = %86
%143 = tail call i32 @pacparser_parse_pac_file(i8* %67)
%144 = icmp eq i32 %143, 0
br i1 %144, label %145, label %149
145: ; preds = %142
%146 = load i32, i32* @stderr
%147 = tail call i32 (i32, i8*, ...) @fprintf(i32 %146, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.13, i64 0, i64 0), i8* %67)
%148 = tail call i32 (...) @pacparser_cleanup()
br label %215
149: ; preds = %140, %142
%150 = icmp eq i8* %69, null
br i1 %150, label %153, label %151
151: ; preds = %149
%152 = call i32 @pacparser_setmyip(i8* %69)
br label %153
153: ; preds = %151, %149
br i1 %72, label %154, label %169
154: ; preds = %153
%155 = icmp eq i8* %71, null
br i1 %155, label %156, label %159
156: ; preds = %154
%157 = call i8* @get_host_from_url(i8* %68)
%158 = icmp eq i8* %157, null
br i1 %158, label %215, label %159
159: ; preds = %154, %156
%160 = phi i8* [ %157, %156 ], [ %71, %154 ]
%161 = call i8* @pacparser_find_proxy(i8* %68, i8* %160)
%162 = icmp eq i8* %161, null
br i1 %162, label %163, label %167
163: ; preds = %159
%164 = load i32, i32* @stderr
%165 = call i32 (i32, i8*, ...) @fprintf(i32 %164, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i64 0, i64 0), i8* %68)
%166 = call i32 (...) @pacparser_cleanup()
br label %215
167: ; preds = %159
%168 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %161)
br label %213
169: ; preds = %153
br i1 %73, label %170, label %213
170: ; preds = %169
%171 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%172 = call i32* @fopen(i8* %70, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%173 = icmp eq i32* %172, null
br i1 %173, label %177, label %174
174: ; preds = %170
%175 = call i64 @fgets(i8* %171, i32 4096, i32* %172)
%176 = icmp eq i64 %175, 0
br i1 %176, label %211, label %180
177: ; preds = %170
%178 = load i32, i32* @stderr
%179 = call i32 (i32, i8*, ...) @fprintf(i32 %178, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.17, i64 0, i64 0), i8* %70)
br label %209
180: ; preds = %174, %185
%181 = phi i8* [ %186, %185 ], [ %171, %174 ]
%182 = load i8, i8* %181
switch i8 %182, label %189 [
i8 32, label %183
i8 9, label %183
i8 35, label %187
]
183: ; preds = %180, %180
%184 = getelementptr inbounds i8, i8* %181, i64 1
br label %185
185: ; preds = %183, %206
%186 = phi i8* [ %184, %183 ], [ %171, %206 ]
br label %180
187: ; preds = %180
%188 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i64 0, i64 0), i8* %181)
br label %206
189: ; preds = %180, %192
%190 = phi i8 [ %194, %192 ], [ %182, %180 ]
%191 = phi i8* [ %193, %192 ], [ %181, %180 ]
switch i8 %190, label %192 [
i8 13, label %195
i8 10, label %195
i8 0, label %195
i8 32, label %195
i8 9, label %195
]
192: ; preds = %189
%193 = getelementptr inbounds i8, i8* %191, i64 1
%194 = load i8, i8* %193
br label %189
195: ; preds = %189, %189, %189, %189, %189
store i8 0, i8* %191
%196 = call i8* @get_host_from_url(i8* %181)
%197 = icmp eq i8* %196, null
br i1 %197, label %206, label %198
198: ; preds = %195
%199 = call i8* @pacparser_find_proxy(i8* %181, i8* %196)
%200 = icmp eq i8* %199, null
br i1 %200, label %201, label %204
201: ; preds = %198
%202 = load i32, i32* @stderr
%203 = call i32 (i32, i8*, ...) @fprintf(i32 %202, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i64 0, i64 0), i8* %181)
br label %209
204: ; preds = %198
%205 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.19, i64 0, i64 0), i8* %181, i8* %199)
br label %206
206: ; preds = %204, %195, %187
%207 = call i64 @fgets(i8* %171, i32 4096, i32* %172)
%208 = icmp eq i64 %207, 0
br i1 %208, label %211, label %185
209: ; preds = %177, %201
%210 = call i32 (...) @pacparser_cleanup()
br label %215
211: ; preds = %206, %174
%212 = call i32 @fclose(i32* %172)
br label %213
213: ; preds = %211, %169, %167
%214 = call i32 (...) @pacparser_cleanup()
br label %215
215: ; preds = %209, %139, %163, %213, %156, %145, %83, %29
%216 = phi i32 [ 0, %29 ], [ 1, %145 ], [ 1, %83 ], [ 1, %163 ], [ 0, %213 ], [ 1, %156 ], [ 1, %139 ], [ 1, %209 ]
ret i32 %216
}