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

/* Variables and functions */
int STDIN_FILENO;
int close_file(int);
scalar_t__ errno;
int extract_packets(int, int /*<<< orphan*/ *, unsigned int, int, int);
int fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprint_err(char *, char *, ...);
int /*<<< orphan*/ fprint_msg(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int open_binary_file(char *, int /*<<< orphan*/);
int /*<<< orphan*/ print_err(char *);
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ redirect_output_stderr();
int /*<<< orphan*/ redirect_output_stdout();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strerror(scalar_t__);
int unsigned_value(char *, char *, char *, int /*<<< orphan*/, unsigned int *);
int main(int argc, char *argv[]) {
  int use_stdout = 0;
  int use_stdin = 0;
  char *input_name = NULL;
  char *output_name = NULL;
  int had_input_name = 0;
  int had_output_name = 0;
  int input = -1;
  FILE *output = NULL;
  unsigned int reorder_buff_size = 4;
  int quiet = 0;
  int verbose = 0;
  int err = 0;
  int ii = 1;
  if (argc < 2) {
    print_usage();
    return 0;
  }
  while (ii < argc) {
    if (argv[ii][0] == '-') {
      if (!strcmp("--help", argv[ii]) || !strcmp("-h", argv[ii]) ||
          !strcmp("-help", argv[ii])) {
        print_usage();
        return 0;
      } else if (!strcmp("-verbose", argv[ii]) || !strcmp("-v", argv[ii])) {
        verbose = 1;
        quiet = 0;
      } else if (!strcmp("-quiet", argv[ii]) || !strcmp("-q", argv[ii])) {
        verbose = 0;
        quiet = 1;
      } else if (!strcmp("-buffer", argv[ii]) || !strcmp("-b", argv[ii])) {
        if ((ii) + 1 == argc) {
          fprintf(stderr, "### %s: missing argument to %s\n", "m2ts2ts",
                  argv[(ii)]);
          return 1;
        };
        err = unsigned_value("m2ts2ts", argv[ii], argv[ii + 1], 0,
                             &reorder_buff_size);
        if (err)
          return 1;
        ii++;
      } else if (!strcmp("-stdin", argv[ii])) {
        use_stdin = 1;
        had_input_name = 1;
      } else if (!strcmp("-stdout", argv[ii])) {
        use_stdout = 1;
        had_output_name = 1;
        redirect_output_stderr();
      } else if (!strcmp("-err", argv[ii])) {
        if ((ii) + 1 == argc) {
          fprintf(stderr, "### %s: missing argument to %s\n", "m2ts2ts",
                  argv[(ii)]);
          return 1;
        };
        if (!strcmp(argv[ii + 1], "stderr"))
          redirect_output_stderr();
        else if (!strcmp(argv[ii + 1], "stdout"))
          redirect_output_stdout();
        else {
          fprint_err("### m2ts2ts: "
                     "Unrecognised option '%s' to -err (not 'stdout' or"
                     " 'stderr')\n",
                     argv[ii + 1]);
          return 1;
        }
        ii++;
      } else {
        fprint_err("### m2ts2ts: "
                   "Unrecognised command line switch '%s'\n",
                   argv[ii]);
        return 1;
      }
    } else {
      if (had_input_name && had_output_name) {
        fprint_err("### m2ts2ts: Unexpected '%s'\n", argv[ii]);
        return 1;
      } else if (had_input_name) {
        output_name = argv[ii];
        had_output_name = 1;
      } else {
        input_name = argv[ii];
        had_input_name = 1;
      }
    }
    ii++;
  }
  if (!had_input_name) {
    print_err("### m2ts2ts: No input file specified\n");
    return 1;
  }
  if (!had_output_name) {
    print_err("### m2ts2ts: No output file specified\n");
    return 1;
  }
  if (use_stdout) {
    verbose = 0;
    quiet = 1;
  }
  if (use_stdin) {
    input = STDIN_FILENO;
  } else {
    input = open_binary_file(input_name, 0);
    if (input == -1) {
      fprint_err("### m2ts2ts: Unable to open input file %s\n", input_name);
      return 1;
    }
  }
  if (!quiet)
    fprint_msg("Reading from %s\n", (use_stdin ? "<stdin>" : input_name));
  if (use_stdout) {
    output = stdout;
  } else {
    output = fopen(output_name, "wb");
    if (output == NULL) {
      if (!use_stdin)
        (void)close_file(input);
      fprint_err("### m2ts2ts: Unable to open output file %s: %s\n",
                 output_name, strerror(errno));
      return 1;
    }
  }
  if (!quiet)
    fprint_msg("Writing to   %s\n", (use_stdout ? "<stdout>" : output_name));
  err = extract_packets(input, output, reorder_buff_size, verbose, quiet);
  if (err) {
    print_err("### m2ts2ts: Error extracting data\n");
    if (!use_stdin)
      (void)close_file(input);
    if (!use_stdout)
      (void)fclose(output);
    return 1;
  }
  if (!use_stdout) {
    errno = 0;
    err = fclose(output);
    if (err) {
      fprint_err("### m2ts2ts: Error closing output file %s: %s\n", output_name,
                 strerror(errno));
      (void)close_file(input);
      return 1;
    }
  }
  if (!use_stdin) {
    err = close_file(input);
    if (err)
      fprint_err("### m2ts2ts: Error closing input file %s\n", input_name);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0xffffffff,-0x34(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0x4,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x1,-0x54(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1284 <main+0x94>
mov    $0x0,%al
call   10f0 <print_usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
jmp    1289 <main+0x99>
mov    -0x54(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    16f5 <main+0x505>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1666 <main+0x476>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd40(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
je     1310 <main+0x120>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd26(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
je     1310 <main+0x120>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xcff(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1323 <main+0x133>
mov    $0x0,%al
call   10f0 <print_usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xcd4(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
je     1365 <main+0x175>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xcbc(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1378 <main+0x188>
movl   $0x1,-0x4c(%rbp)
movl   $0x0,-0x48(%rbp)
jmp    165c <main+0x46c>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc8b(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
je     13ba <main+0x1ca>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc71(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    13cd <main+0x1dd>
movl   $0x0,-0x4c(%rbp)
movl   $0x1,-0x48(%rbp)
jmp    1657 <main+0x467>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc40(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
je     140f <main+0x21f>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc27(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    14a8 <main+0x2b8>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jne    1452 <main+0x262>
mov    0x2bbb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xbf1(%rip),%rsi
lea    0xc0a(%rip),%rdx
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rax
mov    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xbd5(%rip),%rdi
xor    %ecx,%ecx
lea    -0x44(%rbp),%r8
call   1070 <unsigned_value@plt>
mov    %eax,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
je     149a <main+0x2aa>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1652 <main+0x462>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xb98(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    14dc <main+0x2ec>
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    164d <main+0x45d>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xb6b(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1517 <main+0x327>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x30(%rbp)
mov    $0x0,%al
call   1100 <redirect_output_stderr@plt>
jmp    1648 <main+0x458>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xb38(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    161d <main+0x42d>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jne    157b <main+0x38b>
mov    0x2a92(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xac8(%rip),%rsi
lea    0xae1(%rip),%rdx
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
mov    -0x10(%rbp),%rax
mov    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xad4(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    15ad <main+0x3bd>
mov    $0x0,%al
call   1100 <redirect_output_stderr@plt>
jmp    160f <main+0x41f>
mov    -0x10(%rbp),%rax
mov    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xa96(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    15df <main+0x3ef>
mov    $0x0,%al
call   10a0 <redirect_output_stdout@plt>
jmp    160a <main+0x41a>
mov    -0x10(%rbp),%rax
mov    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xa77(%rip),%rdi
mov    $0x0,%al
call   1040 <fprint_err@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
jmp    160f <main+0x41f>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1643 <main+0x453>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xa88(%rip),%rdi
mov    $0x0,%al
call   1040 <fprint_err@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
jmp    1648 <main+0x458>
jmp    164d <main+0x45d>
jmp    1652 <main+0x462>
jmp    1657 <main+0x467>
jmp    165c <main+0x46c>
jmp    1661 <main+0x471>
jmp    16e7 <main+0x4f7>
cmpl   $0x0,-0x2c(%rbp)
je     16a0 <main+0x4b0>
cmpl   $0x0,-0x30(%rbp)
je     16a0 <main+0x4b0>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xa5f(%rip),%rdi
mov    $0x0,%al
call   1040 <fprint_err@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
cmpl   $0x0,-0x2c(%rbp)
je     16c6 <main+0x4d6>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x30(%rbp)
jmp    16dd <main+0x4ed>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    16e2 <main+0x4f2>
jmp    16e7 <main+0x4f7>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1289 <main+0x99>
cmpl   $0x0,-0x2c(%rbp)
jne    1717 <main+0x527>
lea    0xa04(%rip),%rdi
call   1050 <print_err@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
cmpl   $0x0,-0x30(%rbp)
jne    1739 <main+0x549>
lea    0xa08(%rip),%rdi
call   1050 <print_err@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
cmpl   $0x0,-0x14(%rbp)
je     1751 <main+0x561>
movl   $0x0,-0x4c(%rbp)
movl   $0x1,-0x48(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     176c <main+0x57c>
mov    0x2866(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    17a7 <main+0x5b7>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   10d0 <open_binary_file@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    17a2 <main+0x5b2>
mov    -0x20(%rbp),%rsi
lea    0x9c8(%rip),%rdi
mov    $0x0,%al
call   1040 <fprint_err@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
jmp    17a7 <main+0x5b7>
cmpl   $0x0,-0x48(%rbp)
jne    17e3 <main+0x5f3>
cmpl   $0x0,-0x18(%rbp)
je     17cb <main+0x5db>
lea    0x9d1(%rip),%rax
mov    %rax,-0x60(%rbp)
jmp    17d3 <main+0x5e3>
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rsi
lea    0x9a4(%rip),%rdi
call   10b0 <fprint_msg@plt>
cmpl   $0x0,-0x14(%rbp)
je     1800 <main+0x610>
mov    0x27dc(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    186d <main+0x67d>
mov    -0x28(%rbp),%rdi
lea    0x990(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1868 <main+0x678>
cmpl   $0x0,-0x18(%rbp)
jne    1831 <main+0x641>
mov    -0x34(%rbp),%edi
call   1030 <close_file@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    0x2798(%rip),%rax
mov    (%rax),%rdi
call   1110 <strerror@plt>
mov    -0x68(%rbp),%rsi
mov    %eax,%edx
lea    0x949(%rip),%rdi
mov    $0x0,%al
call   1040 <fprint_err@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
jmp    186d <main+0x67d>
cmpl   $0x0,-0x48(%rbp)
jne    18a9 <main+0x6b9>
cmpl   $0x0,-0x14(%rbp)
je     1891 <main+0x6a1>
lea    0x957(%rip),%rax
mov    %rax,-0x70(%rbp)
jmp    1899 <main+0x6a9>
mov    -0x28(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rsi
lea    0x92a(%rip),%rdi
call   10b0 <fprint_msg@plt>
mov    -0x34(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    -0x44(%rbp),%edx
mov    -0x4c(%rbp),%ecx
mov    -0x48(%rbp),%r8d
call   10e0 <extract_packets@plt>
mov    %eax,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
je     1909 <main+0x719>
lea    0x915(%rip),%rdi
call   1050 <print_err@plt>
cmpl   $0x0,-0x18(%rbp)
jne    18ea <main+0x6fa>
mov    -0x34(%rbp),%edi
call   1030 <close_file@plt>
cmpl   $0x0,-0x14(%rbp)
jne    18fd <main+0x70d>
mov    -0x40(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
cmpl   $0x0,-0x14(%rbp)
jne    197b <main+0x78b>
mov    0x26be(%rip),%rax
movq   $0x0,(%rax)
mov    -0x40(%rbp),%rdi
call   1060 <fclose@plt>
mov    %eax,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
je     1976 <main+0x786>
mov    -0x28(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    0x2692(%rip),%rax
mov    (%rax),%rdi
call   1110 <strerror@plt>
mov    -0x78(%rbp),%rsi
mov    %eax,%edx
lea    0x8b1(%rip),%rdi
mov    $0x0,%al
call   1040 <fprint_err@plt>
mov    -0x34(%rbp),%edi
call   1030 <close_file@plt>
movl   $0x1,-0x4(%rbp)
jmp    19b8 <main+0x7c8>
jmp    197b <main+0x78b>
cmpl   $0x0,-0x18(%rbp)
jne    19b1 <main+0x7c1>
mov    -0x34(%rbp),%edi
call   1030 <close_file@plt>
mov    %eax,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
je     19ac <main+0x7bc>
mov    -0x20(%rbp),%rsi
lea    0x896(%rip),%rdi
mov    $0x0,%al
call   1040 <fprint_err@plt>
jmp    19b1 <main+0x7c1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x4,0x24(%rsp)
cmp    $0x2,%edi
jge    1225 <main+0x35>
xor    %ebx,%ebx
xor    %eax,%eax
call   10f0 <print_usage@plt>
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%r12d
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %ecx,%ecx
xor    %edx,%edx
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
jmp    127f <main+0x8f>
nopw   0x0(%rax,%rax,1)
test   %ebx,%ebx
cmove  %r13,%rdx
cmovne %r13,%rcx
mov    $0x1,%ebx
cmovne %ebx,%ebp
add    $0x1,%r12d
cmp    %r15d,%r12d
jge    14c2 <main+0x2d2>
movslq %r12d,%rax
mov    (%r14,%rax,8),%r13
cmpb   $0x2d,0x0(%r13)
jne    1400 <main+0x210>
mov    %rdx,0x18(%rsp)
mov    %rcx,0x10(%rsp)
lea    0xd5e(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     120b <main+0x1b>
lea    0xd4e(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     120b <main+0x1b>
lea    0xd31(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     120b <main+0x1b>
lea    0xd23(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1420 <main+0x230>
lea    0xd15(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1420 <main+0x230>
lea    0xd01(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1432 <main+0x242>
lea    0xcf1(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1432 <main+0x242>
lea    0xcdd(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1451 <main+0x261>
lea    0xcce(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1451 <main+0x261>
lea    0xce2(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1495 <main+0x2a5>
lea    0xcd2(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     14a3 <main+0x2b3>
lea    0xcc3(%rip),%rdi
mov    %r13,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    1703 <main+0x513>
add    $0x1,%r12d
mov    %r15d,%eax
cmp    %r15d,%r12d
je     1646 <main+0x456>
movslq %r12d,%rax
mov    (%r14,%rax,8),%r13
mov    %r13,%rdi
lea    0xc97(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     14b9 <main+0x2c9>
mov    %r13,%rdi
lea    0xc74(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    170f <main+0x51f>
xor    %eax,%eax
call   10a0 <redirect_output_stdout@plt>
jmp    1442 <main+0x252>
nopl   (%rax)
test   %ebx,%ebx
je     1260 <main+0x70>
test   %ebp,%ebp
je     1260 <main+0x70>
jmp    14f8 <main+0x308>
cs nopw 0x0(%rax,%rax,1)
nop
movl   $0x0,0xc(%rsp)
movl   $0x1,0x8(%rsp)
jmp    1442 <main+0x252>
movl   $0x1,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%rdx
jmp    1272 <main+0x82>
add    $0x1,%r12d
mov    %r15d,%eax
cmp    %r15d,%r12d
je     1646 <main+0x456>
movslq %r12d,%rax
mov    (%r14,%rax,8),%rdx
lea    0xbdc(%rip),%rdi
mov    %r13,%rsi
xor    %ecx,%ecx
lea    0x24(%rsp),%r8
call   1070 <unsigned_value@plt>
test   %eax,%eax
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%rdx
je     1272 <main+0x82>
jmp    16ae <main+0x4be>
movl   $0x1,(%rsp)
mov    $0x1,%ebx
jmp    1442 <main+0x252>
xor    %eax,%eax
call   1100 <redirect_output_stderr@plt>
movl   $0x1,0x4(%rsp)
mov    $0x1,%ebp
jmp    1442 <main+0x252>
xor    %eax,%eax
call   1100 <redirect_output_stderr@plt>
jmp    1442 <main+0x252>
test   %ebx,%ebx
je     1513 <main+0x323>
test   %ebp,%ebp
je     151c <main+0x32c>
xor    %ebp,%ebp
cmpl   $0x0,0x4(%rsp)
mov    $0x1,%ebx
cmove  0xc(%rsp),%ebx
cmove  0x8(%rsp),%ebp
cmpl   $0x0,(%rsp)
mov    %rcx,%r14
mov    %rdx,%r15
je     1532 <main+0x342>
mov    0x2ad5(%rip),%rax
mov    (%rax),%r12d
jmp    154b <main+0x35b>
lea    0xbed(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <fprint_err@plt>
mov    $0x1,%ebx
jmp    1214 <main+0x24>
lea    0xbf0(%rip),%rdi
jmp    1523 <main+0x333>
lea    0xc0d(%rip),%rdi
call   1050 <print_err@plt>
mov    $0x1,%ebx
jmp    1214 <main+0x24>
mov    %rdx,%rdi
xor    %esi,%esi
call   10d0 <open_binary_file@plt>
mov    %r15,%rdx
mov    %eax,%r12d
cmp    $0xffffffff,%eax
je     166f <main+0x47f>
test   %ebx,%ebx
jne    156a <main+0x37a>
cmpl   $0x0,(%rsp)
lea    0xc39(%rip),%rsi
cmove  %rdx,%rsi
lea    0xc1d(%rip),%rdi
call   10b0 <fprint_msg@plt>
cmpl   $0x0,0x4(%rsp)
je     157d <main+0x38d>
mov    0x2a58(%rip),%rax
mov    (%rax),%r13
jmp    1598 <main+0x3a8>
lea    0xc17(%rip),%rsi
mov    %r14,%rdi
call   10c0 <fopen@plt>
mov    %rax,%r13
test   %rax,%rax
je     167e <main+0x48e>
test   %ebx,%ebx
jne    15b8 <main+0x3c8>
cmpl   $0x0,0x4(%rsp)
lea    0xc37(%rip),%rsi
cmove  %r14,%rsi
lea    0xc1b(%rip),%rdi
call   10b0 <fprint_msg@plt>
mov    0x24(%rsp),%edx
mov    %r12d,%edi
mov    %r13,%rsi
mov    %ebp,%ecx
mov    %ebx,%r8d
call   10e0 <extract_packets@plt>
test   %eax,%eax
je     1607 <main+0x417>
lea    0xc11(%rip),%rdi
call   1050 <print_err@plt>
cmpl   $0x0,(%rsp)
jne    15ea <main+0x3fa>
mov    %r12d,%edi
call   1030 <close_file@plt>
mov    $0x1,%ebx
cmpl   $0x0,0x4(%rsp)
jne    1214 <main+0x24>
mov    %r13,%rdi
call   1060 <fclose@plt>
jmp    1214 <main+0x24>
cmpl   $0x0,0x4(%rsp)
je     16b8 <main+0x4c8>
xor    %ebx,%ebx
cmpl   $0x0,(%rsp)
jne    1214 <main+0x24>
mov    %r12d,%edi
call   1030 <close_file@plt>
test   %eax,%eax
je     1214 <main+0x24>
lea    0xc06(%rip),%rdi
xor    %ebx,%ebx
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fprint_err@plt>
jmp    1214 <main+0x24>
mov    0x2993(%rip),%rax
mov    (%rax),%edi
lea    0x9d5(%rip),%rsi
lea    0x9ee(%rip),%rdx
mov    %r13,%rcx
call   1090 <fprintf@plt>
mov    $0x1,%ebx
jmp    1214 <main+0x24>
lea    0xae1(%rip),%rdi
mov    %rdx,%rsi
jmp    1502 <main+0x312>
cmpl   $0x0,(%rsp)
jne    168c <main+0x49c>
mov    %r12d,%edi
call   1030 <close_file@plt>
mov    0x2945(%rip),%rax
mov    (%rax),%rdi
call   1110 <strerror@plt>
lea    0xafc(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprint_err@plt>
mov    $0x1,%ebx
jmp    1214 <main+0x24>
mov    0x2919(%rip),%rbx
movq   $0x0,(%rbx)
mov    %r13,%rdi
call   1060 <fclose@plt>
test   %eax,%eax
je     1612 <main+0x422>
mov    (%rbx),%rdi
call   1110 <strerror@plt>
lea    0xb27(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprint_err@plt>
mov    %r12d,%edi
call   1030 <close_file@plt>
mov    $0x1,%ebx
jmp    1214 <main+0x24>
lea    0x9ae(%rip),%rdi
jmp    14ff <main+0x30f>
lea    0x958(%rip),%rdi
jmp    14ff <main+0x30f>

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [6 x i8] c"-help\00"
@.str.3 = [9 x i8] c"-verbose\00"
@.str.4 = [3 x i8] c"-v\00"
@.str.5 = [7 x i8] c"-quiet\00"
@.str.6 = [3 x i8] c"-q\00"
@.str.7 = [8 x i8] c"-buffer\00"
@.str.8 = [3 x i8] c"-b\00"
@stderr = global i32 0
@.str.9 = [32 x i8] c"### %s: missing argument to %s\0A\00"
@.str.10 = [8 x i8] c"m2ts2ts\00"
@.str.11 = [7 x i8] c"-stdin\00"
@.str.12 = [8 x i8] c"-stdout\00"
@.str.13 = [5 x i8] c"-err\00"
@.str.14 = [7 x i8] c"stderr\00"
@.str.15 = [7 x i8] c"stdout\00"
@.str.16 = [74 x i8] c"### m2ts2ts: Unrecognised option '%s' to -err (not 'stdout' or 'stderr')\0A\00"
@.str.17 = [52 x i8] c"### m2ts2ts: Unrecognised command line switch '%s'\0A\00"
@.str.18 = [30 x i8] c"### m2ts2ts: Unexpected '%s'\0A\00"
@.str.19 = [38 x i8] c"### m2ts2ts: No input file specified\0A\00"
@.str.20 = [39 x i8] c"### m2ts2ts: No output file specified\0A\00"
@STDIN_FILENO = global i32 0
@.str.21 = [43 x i8] c"### m2ts2ts: Unable to open input file %s\0A\00"
@.str.22 = [17 x i8] c"Reading from %s\0A\00"
@.str.23 = [8 x i8] c"<stdin>\00"
@stdout = global i32* null
@.str.24 = [3 x i8] c"wb\00"
@.str.25 = [48 x i8] c"### m2ts2ts: Unable to open output file %s: %s\0A\00"
@errno = global i64 0
@.str.26 = [17 x i8] c"Writing to %s\0A\00"
@.str.27 = [9 x i8] c"<stdout>\00"
@.str.28 = [36 x i8] c"### m2ts2ts: Error extracting data\0A\00"
@.str.29 = [47 x i8] c"### m2ts2ts: Error closing output file %s: %s\0A\00"
@.str.30 = [42 x i8] c"### m2ts2ts: Error closing input file %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i8* null, i8** %8
store i8* null, i8** %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 -1, i32* %12
store i32* null, i32** %13
store i32 4, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
store i32 1, i32* %18
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 2
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 (...) @print_usage()
store i32 0, i32* %3
br label %393
23: ; preds = %2
br label %24
24: ; preds = %264, %23
%25 = load i32, i32* %18
%26 = load i32, i32* %4
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %267
28: ; preds = %24
%29 = load i8**, i8*** %5
%30 = load i32, i32* %18
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8, i8* %33, i64 0
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 45
br i1 %37, label %38, label %234
38: ; preds = %28
%39 = load i8**, i8*** %5
%40 = load i32, i32* %18
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = call i32 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %43)
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %62
46: ; preds = %38
%47 = load i8**, i8*** %5
%48 = load i32, i32* %18
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i32 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %51)
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %62
54: ; preds = %46
%55 = load i8**, i8*** %5
%56 = load i32, i32* %18
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
%60 = call i32 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %59)
%61 = icmp ne i32 %60, 0
br i1 %61, label %64, label %62
62: ; preds = %54, %46, %38
%63 = call i32 (...) @print_usage()
store i32 0, i32* %3
br label %393
64: ; preds = %54
%65 = load i8**, i8*** %5
%66 = load i32, i32* %18
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8*, i8** %65, i64 %67
%69 = load i8*, i8** %68
%70 = call i32 @strcmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %69)
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %80
72: ; preds = %64
%73 = load i8**, i8*** %5
%74 = load i32, i32* %18
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %73, i64 %75
%77 = load i8*, i8** %76
%78 = call i32 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %77)
%79 = icmp ne i32 %78, 0
br i1 %79, label %81, label %80
80: ; preds = %72, %64
store i32 1, i32* %16
store i32 0, i32* %15
br label %232
81: ; preds = %72
%82 = load i8**, i8*** %5
%83 = load i32, i32* %18
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8*, i8** %82, i64 %84
%86 = load i8*, i8** %85
%87 = call i32 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %86)
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %97
89: ; preds = %81
%90 = load i8**, i8*** %5
%91 = load i32, i32* %18
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8*, i8** %90, i64 %92
%94 = load i8*, i8** %93
%95 = call i32 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %94)
%96 = icmp ne i32 %95, 0
br i1 %96, label %98, label %97
97: ; preds = %89, %81
store i32 0, i32* %16
store i32 1, i32* %15
br label %231
98: ; preds = %89
%99 = load i8**, i8*** %5
%100 = load i32, i32* %18
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8*, i8** %99, i64 %101
%103 = load i8*, i8** %102
%104 = call i32 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %103)
%105 = icmp ne i32 %104, 0
br i1 %105, label %106, label %114
106: ; preds = %98
%107 = load i8**, i8*** %5
%108 = load i32, i32* %18
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8*, i8** %107, i64 %109
%111 = load i8*, i8** %110
%112 = call i32 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %111)
%113 = icmp ne i32 %112, 0
br i1 %113, label %146, label %114
114: ; preds = %106, %98
%115 = load i32, i32* %18
%116 = add nsw i32 %115, 1
%117 = load i32, i32* %4
%118 = icmp eq i32 %116, %117
br i1 %118, label %119, label %127
119: ; preds = %114
%120 = load i32, i32* @stderr
%121 = load i8**, i8*** %5
%122 = load i32, i32* %18
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i8*, i8** %121, i64 %123
%125 = load i8*, i8** %124
%126 = call i32 @fprintf(i32 %120, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %125)
store i32 1, i32* %3
br label %393
127: ; preds = %114
%128 = load i8**, i8*** %5
%129 = load i32, i32* %18
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8*, i8** %128, i64 %130
%132 = load i8*, i8** %131
%133 = load i8**, i8*** %5
%134 = load i32, i32* %18
%135 = add nsw i32 %134, 1
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds i8*, i8** %133, i64 %136
%138 = load i8*, i8** %137
%139 = call i32 @unsigned_value(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %132, i8* %138, i32 0, i32* %14)
store i32 %139, i32* %17
%140 = load i32, i32* %17
%141 = icmp ne i32 %140, 0
br i1 %141, label %142, label %143
142: ; preds = %127
store i32 1, i32* %3
br label %393
143: ; preds = %127
%144 = load i32, i32* %18
%145 = add nsw i32 %144, 1
store i32 %145, i32* %18
br label %230
146: ; preds = %106
%147 = load i8**, i8*** %5
%148 = load i32, i32* %18
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8*, i8** %147, i64 %149
%151 = load i8*, i8** %150
%152 = call i32 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %151)
%153 = icmp ne i32 %152, 0
br i1 %153, label %155, label %154
154: ; preds = %146
store i32 1, i32* %7
store i32 1, i32* %10
br label %229
155: ; preds = %146
%156 = load i8**, i8*** %5
%157 = load i32, i32* %18
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds i8*, i8** %156, i64 %158
%160 = load i8*, i8** %159
%161 = call i32 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* %160)
%162 = icmp ne i32 %161, 0
br i1 %162, label %165, label %163
163: ; preds = %155
store i32 1, i32* %6
store i32 1, i32* %11
%164 = call i32 (...) @redirect_output_stderr()
br label %228
165: ; preds = %155
%166 = load i8**, i8*** %5
%167 = load i32, i32* %18
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds i8*, i8** %166, i64 %168
%170 = load i8*, i8** %169
%171 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %170)
%172 = icmp ne i32 %171, 0
br i1 %172, label %220, label %173
173: ; preds = %165
%174 = load i32, i32* %18
%175 = add nsw i32 %174, 1
%176 = load i32, i32* %4
%177 = icmp eq i32 %175, %176
br i1 %177, label %178, label %186
178: ; preds = %173
%179 = load i32, i32* @stderr
%180 = load i8**, i8*** %5
%181 = load i32, i32* %18
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds i8*, i8** %180, i64 %182
%184 = load i8*, i8** %183
%185 = call i32 @fprintf(i32 %179, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %184)
store i32 1, i32* %3
br label %393
186: ; preds = %173
%187 = load i8**, i8*** %5
%188 = load i32, i32* %18
%189 = add nsw i32 %188, 1
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i8*, i8** %187, i64 %190
%192 = load i8*, i8** %191
%193 = call i32 @strcmp(i8* %192, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%194 = icmp ne i32 %193, 0
br i1 %194, label %197, label %195
195: ; preds = %186
%196 = call i32 (...) @redirect_output_stderr()
br label %217
197: ; preds = %186
%198 = load i8**, i8*** %5
%199 = load i32, i32* %18
%200 = add nsw i32 %199, 1
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds i8*, i8** %198, i64 %201
%203 = load i8*, i8** %202
%204 = call i32 @strcmp(i8* %203, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%205 = icmp ne i32 %204, 0
br i1 %205, label %208, label %206
206: ; preds = %197
%207 = call i32 (...) @redirect_output_stdout()
br label %216
208: ; preds = %197
%209 = load i8**, i8*** %5
%210 = load i32, i32* %18
%211 = add nsw i32 %210, 1
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds i8*, i8** %209, i64 %212
%214 = load i8*, i8** %213
%215 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.16, i64 0, i64 0), i8* %214)
store i32 1, i32* %3
br label %393
216: ; preds = %206
br label %217
217: ; preds = %216, %195
%218 = load i32, i32* %18
%219 = add nsw i32 %218, 1
store i32 %219, i32* %18
br label %227
220: ; preds = %165
%221 = load i8**, i8*** %5
%222 = load i32, i32* %18
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds i8*, i8** %221, i64 %223
%225 = load i8*, i8** %224
%226 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.17, i64 0, i64 0), i8* %225)
store i32 1, i32* %3
br label %393
227: ; preds = %217
br label %228
228: ; preds = %227, %163
br label %229
229: ; preds = %228, %154
br label %230
230: ; preds = %229, %143
br label %231
231: ; preds = %230, %97
br label %232
232: ; preds = %231, %80
br label %233
233: ; preds = %232
br label %264
234: ; preds = %28
%235 = load i32, i32* %10
%236 = icmp ne i32 %235, 0
br i1 %236, label %237, label %247
237: ; preds = %234
%238 = load i32, i32* %11
%239 = icmp ne i32 %238, 0
br i1 %239, label %240, label %247
240: ; preds = %237
%241 = load i8**, i8*** %5
%242 = load i32, i32* %18
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds i8*, i8** %241, i64 %243
%245 = load i8*, i8** %244
%246 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0), i8* %245)
store i32 1, i32* %3
br label %393
247: ; preds = %237, %234
%248 = load i32, i32* %10
%249 = icmp ne i32 %248, 0
br i1 %249, label %250, label %256
250: ; preds = %247
%251 = load i8**, i8*** %5
%252 = load i32, i32* %18
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds i8*, i8** %251, i64 %253
%255 = load i8*, i8** %254
store i8* %255, i8** %9
store i32 1, i32* %11
br label %262
256: ; preds = %247
%257 = load i8**, i8*** %5
%258 = load i32, i32* %18
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds i8*, i8** %257, i64 %259
%261 = load i8*, i8** %260
store i8* %261, i8** %8
store i32 1, i32* %10
br label %262
262: ; preds = %256, %250
br label %263
263: ; preds = %262
br label %264
264: ; preds = %263, %233
%265 = load i32, i32* %18
%266 = add nsw i32 %265, 1
store i32 %266, i32* %18
br label %24
267: ; preds = %24
%268 = load i32, i32* %10
%269 = icmp ne i32 %268, 0
br i1 %269, label %272, label %270
270: ; preds = %267
%271 = call i32 @print_err(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.19, i64 0, i64 0))
store i32 1, i32* %3
br label %393
272: ; preds = %267
%273 = load i32, i32* %11
%274 = icmp ne i32 %273, 0
br i1 %274, label %277, label %275
275: ; preds = %272
%276 = call i32 @print_err(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.20, i64 0, i64 0))
store i32 1, i32* %3
br label %393
277: ; preds = %272
%278 = load i32, i32* %6
%279 = icmp ne i32 %278, 0
br i1 %279, label %280, label %281
280: ; preds = %277
store i32 0, i32* %16
store i32 1, i32* %15
br label %281
281: ; preds = %280, %277
%282 = load i32, i32* %7
%283 = icmp ne i32 %282, 0
br i1 %283, label %284, label %286
284: ; preds = %281
%285 = load i32, i32* @STDIN_FILENO
store i32 %285, i32* %12
br label %295
286: ; preds = %281
%287 = load i8*, i8** %8
%288 = call i32 @open_binary_file(i8* %287, i32 0)
store i32 %288, i32* %12
%289 = load i32, i32* %12
%290 = icmp eq i32 %289, -1
br i1 %290, label %291, label %294
291: ; preds = %286
%292 = load i8*, i8** %8
%293 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.21, i64 0, i64 0), i8* %292)
store i32 1, i32* %3
br label %393
294: ; preds = %286
br label %295
295: ; preds = %294, %284
%296 = load i32, i32* %15
%297 = icmp ne i32 %296, 0
br i1 %297, label %307, label %298
298: ; preds = %295
%299 = load i32, i32* %7
%300 = icmp ne i32 %299, 0
br i1 %300, label %301, label %302
301: ; preds = %298
br label %304
302: ; preds = %298
%303 = load i8*, i8** %8
br label %304
304: ; preds = %302, %301
%305 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.23, i64 0, i64 0), %301 ], [ %303, %302 ]
%306 = call i32 @fprint_msg(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i64 0, i64 0), i8* %305)
br label %307
307: ; preds = %304, %295
%308 = load i32, i32* %6
%309 = icmp ne i32 %308, 0
br i1 %309, label %310, label %312
310: ; preds = %307
%311 = load i32*, i32** @stdout
store i32* %311, i32** %13
br label %329
312: ; preds = %307
%313 = load i8*, i8** %9
%314 = call i32* @fopen(i8* %313, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0))
store i32* %314, i32** %13
%315 = load i32*, i32** %13
%316 = icmp eq i32* %315, null
br i1 %316, label %317, label %328
317: ; preds = %312
%318 = load i32, i32* %7
%319 = icmp ne i32 %318, 0
br i1 %319, label %323, label %320
320: ; preds = %317
%321 = load i32, i32* %12
%322 = call i32 @close_file(i32 %321)
br label %323
323: ; preds = %320, %317
%324 = load i8*, i8** %9
%325 = load i64, i64* @errno
%326 = call i32 @strerror(i64 %325)
%327 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.25, i64 0, i64 0), i8* %324, i32 %326)
store i32 1, i32* %3
br label %393
328: ; preds = %312
br label %329
329: ; preds = %328, %310
%330 = load i32, i32* %15
%331 = icmp ne i32 %330, 0
br i1 %331, label %341, label %332
332: ; preds = %329
%333 = load i32, i32* %6
%334 = icmp ne i32 %333, 0
br i1 %334, label %335, label %336
335: ; preds = %332
br label %338
336: ; preds = %332
%337 = load i8*, i8** %9
br label %338
338: ; preds = %336, %335
%339 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.27, i64 0, i64 0), %335 ], [ %337, %336 ]
%340 = call i32 @fprint_msg(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.26, i64 0, i64 0), i8* %339)
br label %341
341: ; preds = %338, %329
%342 = load i32, i32* %12
%343 = load i32*, i32** %13
%344 = load i32, i32* %14
%345 = load i32, i32* %16
%346 = load i32, i32* %15
%347 = call i32 @extract_packets(i32 %342, i32* %343, i32 %344, i32 %345, i32 %346)
store i32 %347, i32* %17
%348 = load i32, i32* %17
%349 = icmp ne i32 %348, 0
br i1 %349, label %350, label %364
350: ; preds = %341
%351 = call i32 @print_err(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.28, i64 0, i64 0))
%352 = load i32, i32* %7
%353 = icmp ne i32 %352, 0
br i1 %353, label %357, label %354
354: ; preds = %350
%355 = load i32, i32* %12
%356 = call i32 @close_file(i32 %355)
br label %357
357: ; preds = %354, %350
%358 = load i32, i32* %6
%359 = icmp ne i32 %358, 0
br i1 %359, label %363, label %360
360: ; preds = %357
%361 = load i32*, i32** %13
%362 = call i32 @fclose(i32* %361)
br label %363
363: ; preds = %360, %357
store i32 1, i32* %3
br label %393
364: ; preds = %341
%365 = load i32, i32* %6
%366 = icmp ne i32 %365, 0
br i1 %366, label %380, label %367
367: ; preds = %364
store i64 0, i64* @errno
%368 = load i32*, i32** %13
%369 = call i32 @fclose(i32* %368)
store i32 %369, i32* %17
%370 = load i32, i32* %17
%371 = icmp ne i32 %370, 0
br i1 %371, label %372, label %379
372: ; preds = %367
%373 = load i8*, i8** %9
%374 = load i64, i64* @errno
%375 = call i32 @strerror(i64 %374)
%376 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.29, i64 0, i64 0), i8* %373, i32 %375)
%377 = load i32, i32* %12
%378 = call i32 @close_file(i32 %377)
store i32 1, i32* %3
br label %393
379: ; preds = %367
br label %380
380: ; preds = %379, %364
%381 = load i32, i32* %7
%382 = icmp ne i32 %381, 0
br i1 %382, label %392, label %383
383: ; preds = %380
%384 = load i32, i32* %12
%385 = call i32 @close_file(i32 %384)
store i32 %385, i32* %17
%386 = load i32, i32* %17
%387 = icmp ne i32 %386, 0
br i1 %387, label %388, label %391
388: ; preds = %383
%389 = load i8*, i8** %8
%390 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.30, i64 0, i64 0), i8* %389)
br label %391
391: ; preds = %388, %383
br label %392
392: ; preds = %391, %380
store i32 0, i32* %3
br label %393
393: ; preds = %392, %372, %363, %323, %291, %275, %270, %240, %220, %208, %178, %142, %119, %62, %21
%394 = load i32, i32* %3
ret i32 %394
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [6 x i8] c"-help\00"
@.str.3 = [9 x i8] c"-verbose\00"
@.str.4 = [3 x i8] c"-v\00"
@.str.5 = [7 x i8] c"-quiet\00"
@.str.6 = [3 x i8] c"-q\00"
@.str.7 = [8 x i8] c"-buffer\00"
@.str.8 = [3 x i8] c"-b\00"
@stderr = global i32 0
@.str.9 = [32 x i8] c"### %s: missing argument to %s\0A\00"
@.str.10 = [8 x i8] c"m2ts2ts\00"
@.str.11 = [7 x i8] c"-stdin\00"
@.str.12 = [8 x i8] c"-stdout\00"
@.str.13 = [5 x i8] c"-err\00"
@.str.14 = [7 x i8] c"stderr\00"
@.str.15 = [7 x i8] c"stdout\00"
@.str.16 = [74 x i8] c"### m2ts2ts: Unrecognised option '%s' to -err (not 'stdout' or 'stderr')\0A\00"
@.str.17 = [52 x i8] c"### m2ts2ts: Unrecognised command line switch '%s'\0A\00"
@.str.18 = [30 x i8] c"### m2ts2ts: Unexpected '%s'\0A\00"
@.str.19 = [38 x i8] c"### m2ts2ts: No input file specified\0A\00"
@.str.20 = [39 x i8] c"### m2ts2ts: No output file specified\0A\00"
@STDIN_FILENO = global i32 0
@.str.21 = [43 x i8] c"### m2ts2ts: Unable to open input file %s\0A\00"
@.str.22 = [17 x i8] c"Reading from %s\0A\00"
@.str.23 = [8 x i8] c"<stdin>\00"
@stdout = global i32* null
@.str.24 = [3 x i8] c"wb\00"
@.str.25 = [48 x i8] c"### m2ts2ts: Unable to open output file %s: %s\0A\00"
@errno = global i64 0
@.str.26 = [17 x i8] c"Writing to %s\0A\00"
@.str.27 = [9 x i8] c"<stdout>\00"
@.str.28 = [36 x i8] c"### m2ts2ts: Error extracting data\0A\00"
@.str.29 = [47 x i8] c"### m2ts2ts: Error closing output file %s: %s\0A\00"
@.str.30 = [42 x i8] c"### m2ts2ts: Error closing input file %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @print_usage()
br label %190
8: ; preds = %2, %108
%9 = phi i32 [ %118, %108 ], [ 1, %2 ]
%10 = phi i32 [ %116, %108 ], [ 0, %2 ]
%11 = phi i32 [ %115, %108 ], [ 0, %2 ]
%12 = phi i32 [ %114, %108 ], [ 0, %2 ]
%13 = phi i32 [ %113, %108 ], [ 0, %2 ]
%14 = phi i8* [ %112, %108 ], [ null, %2 ]
%15 = phi i8* [ %111, %108 ], [ null, %2 ]
%16 = phi i32 [ %110, %108 ], [ 0, %2 ]
%17 = phi i32 [ %109, %108 ], [ 0, %2 ]
%18 = sext i32 %9 to i64
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 45
br i1 %22, label %23, label %98
23: ; preds = %8
%24 = call i32 @strcmp(i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %20)
%25 = icmp eq i32 %24, 0
br i1 %25, label %32, label %26
26: ; preds = %23
%27 = call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%28 = icmp eq i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = call i32 @strcmp(i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29, %26, %23
%33 = call i32 (...) @print_usage()
br label %190
34: ; preds = %29
%35 = call i32 @strcmp(i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %20)
%36 = icmp eq i32 %35, 0
br i1 %36, label %108, label %37
37: ; preds = %34
%38 = call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %20)
%39 = icmp eq i32 %38, 0
br i1 %39, label %108, label %40
40: ; preds = %37
%41 = call i32 @strcmp(i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %20)
%42 = icmp eq i32 %41, 0
br i1 %42, label %108, label %43
43: ; preds = %40
%44 = call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %20)
%45 = icmp eq i32 %44, 0
br i1 %45, label %108, label %46
46: ; preds = %43
%47 = call i32 @strcmp(i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %20)
%48 = icmp eq i32 %47, 0
br i1 %48, label %52, label %49
49: ; preds = %46
%50 = call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %20)
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %64
52: ; preds = %49, %46
%53 = add nsw i32 %9, 1
%54 = icmp eq i32 %53, %0
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load i32, i32* @stderr
%57 = call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %20)
br label %190
58: ; preds = %52
%59 = sext i32 %53 to i64
%60 = getelementptr inbounds i8*, i8** %1, i64 %59
%61 = load i8*, i8** %60
%62 = call i32 @unsigned_value(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %20, i8* %61, i32 0, i32* %3)
%63 = icmp eq i32 %62, 0
br i1 %63, label %108, label %190
64: ; preds = %49
%65 = call i32 @strcmp(i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %20)
%66 = icmp eq i32 %65, 0
br i1 %66, label %108, label %67
67: ; preds = %64
%68 = call i32 @strcmp(i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* %20)
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %67
%71 = call i32 (...) @redirect_output_stderr()
br label %108
72: ; preds = %67
%73 = call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %20)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %96
75: ; preds = %72
%76 = add nsw i32 %9, 1
%77 = icmp eq i32 %76, %0
br i1 %77, label %78, label %81
78: ; preds = %75
%79 = load i32, i32* @stderr
%80 = call i32 @fprintf(i32 %79, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %20)
br label %190
81: ; preds = %75
%82 = sext i32 %76 to i64
%83 = getelementptr inbounds i8*, i8** %1, i64 %82
%84 = load i8*, i8** %83
%85 = call i32 @strcmp(i8* dereferenceable(1) %84, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%86 = icmp eq i32 %85, 0
br i1 %86, label %87, label %89
87: ; preds = %81
%88 = call i32 (...) @redirect_output_stderr()
br label %108
89: ; preds = %81
%90 = call i32 @strcmp(i8* dereferenceable(1) %84, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %94
92: ; preds = %89
%93 = call i32 (...) @redirect_output_stdout()
br label %108
94: ; preds = %89
%95 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.16, i64 0, i64 0), i8* %84)
br label %190
96: ; preds = %72
%97 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.17, i64 0, i64 0), i8* %20)
br label %190
98: ; preds = %8
%99 = icmp ne i32 %13, 0
%100 = icmp ne i32 %12, 0
%101 = select i1 %99, i1 %100, i1 false
br i1 %101, label %102, label %104
102: ; preds = %98
%103 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0), i8* %20)
br label %190
104: ; preds = %98
%105 = select i1 %99, i8* %15, i8* %20
%106 = select i1 %99, i8* %20, i8* %14
%107 = select i1 %99, i32 1, i32 %12
br label %108
108: ; preds = %104, %87, %92, %64, %58, %40, %43, %34, %37, %70
%109 = phi i32 [ 1, %70 ], [ %17, %37 ], [ %17, %34 ], [ %17, %43 ], [ %17, %40 ], [ %17, %58 ], [ %17, %64 ], [ %17, %92 ], [ %17, %87 ], [ %17, %104 ]
%110 = phi i32 [ %16, %70 ], [ %16, %37 ], [ %16, %34 ], [ %16, %43 ], [ %16, %40 ], [ %16, %58 ], [ 1, %64 ], [ %16, %92 ], [ %16, %87 ], [ %16, %104 ]
%111 = phi i8* [ %15, %70 ], [ %15, %37 ], [ %15, %34 ], [ %15, %43 ], [ %15, %40 ], [ %15, %58 ], [ %15, %64 ], [ %15, %92 ], [ %15, %87 ], [ %105, %104 ]
%112 = phi i8* [ %14, %70 ], [ %14, %37 ], [ %14, %34 ], [ %14, %43 ], [ %14, %40 ], [ %14, %58 ], [ %14, %64 ], [ %14, %92 ], [ %14, %87 ], [ %106, %104 ]
%113 = phi i32 [ %13, %70 ], [ %13, %37 ], [ %13, %34 ], [ %13, %43 ], [ %13, %40 ], [ %13, %58 ], [ 1, %64 ], [ %13, %92 ], [ %13, %87 ], [ 1, %104 ]
%114 = phi i32 [ 1, %70 ], [ %12, %37 ], [ %12, %34 ], [ %12, %43 ], [ %12, %40 ], [ %12, %58 ], [ %12, %64 ], [ %12, %92 ], [ %12, %87 ], [ %107, %104 ]
%115 = phi i32 [ %11, %70 ], [ 0, %37 ], [ 0, %34 ], [ 1, %43 ], [ 1, %40 ], [ %11, %58 ], [ %11, %64 ], [ %11, %92 ], [ %11, %87 ], [ %11, %104 ]
%116 = phi i32 [ %10, %70 ], [ 1, %37 ], [ 1, %34 ], [ 0, %43 ], [ 0, %40 ], [ %10, %58 ], [ %10, %64 ], [ %10, %92 ], [ %10, %87 ], [ %10, %104 ]
%117 = phi i32 [ %9, %70 ], [ %9, %37 ], [ %9, %34 ], [ %9, %43 ], [ %9, %40 ], [ %53, %58 ], [ %9, %64 ], [ %76, %92 ], [ %76, %87 ], [ %9, %104 ]
%118 = add nsw i32 %117, 1
%119 = icmp slt i32 %118, %0
br i1 %119, label %8, label %120
120: ; preds = %108
%121 = icmp eq i32 %113, 0
br i1 %121, label %122, label %124
122: ; preds = %120
%123 = call i32 @print_err(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.19, i64 0, i64 0))
br label %190
124: ; preds = %120
%125 = icmp eq i32 %114, 0
br i1 %125, label %126, label %128
126: ; preds = %124
%127 = call i32 @print_err(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.20, i64 0, i64 0))
br label %190
128: ; preds = %124
%129 = icmp eq i32 %109, 0
%130 = select i1 %129, i32 %115, i32 1
%131 = select i1 %129, i32 %116, i32 0
%132 = icmp eq i32 %110, 0
br i1 %132, label %135, label %133
133: ; preds = %128
%134 = load i32, i32* @STDIN_FILENO
br label %140
135: ; preds = %128
%136 = call i32 @open_binary_file(i8* %111, i32 0)
%137 = icmp eq i32 %136, -1
br i1 %137, label %138, label %140
138: ; preds = %135
%139 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.21, i64 0, i64 0), i8* %111)
br label %190
140: ; preds = %135, %133
%141 = phi i32 [ %134, %133 ], [ %136, %135 ]
%142 = icmp eq i32 %130, 0
br i1 %142, label %143, label %146
143: ; preds = %140
%144 = select i1 %132, i8* %111, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.23, i64 0, i64 0)
%145 = call i32 @fprint_msg(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i64 0, i64 0), i8* %144)
br label %146
146: ; preds = %143, %140
br i1 %129, label %149, label %147
147: ; preds = %146
%148 = load i32*, i32** @stdout
br label %159
149: ; preds = %146
%150 = call i32* @fopen(i8* %112, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0))
%151 = icmp eq i32* %150, null
br i1 %151, label %152, label %159
152: ; preds = %149
br i1 %132, label %153, label %155
153: ; preds = %152
%154 = call i32 @close_file(i32 %141)
br label %155
155: ; preds = %153, %152
%156 = load i64, i64* @errno
%157 = call i32 @strerror(i64 %156)
%158 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.25, i64 0, i64 0), i8* %112, i32 %157)
br label %190
159: ; preds = %149, %147
%160 = phi i32* [ %148, %147 ], [ %150, %149 ]
br i1 %142, label %161, label %164
161: ; preds = %159
%162 = select i1 %129, i8* %112, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.27, i64 0, i64 0)
%163 = call i32 @fprint_msg(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.26, i64 0, i64 0), i8* %162)
br label %164
164: ; preds = %161, %159
%165 = load i32, i32* %3
%166 = call i32 @extract_packets(i32 %141, i32* %160, i32 %165, i32 %131, i32 %130)
%167 = icmp eq i32 %166, 0
br i1 %167, label %175, label %168
168: ; preds = %164
%169 = call i32 @print_err(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.28, i64 0, i64 0))
br i1 %132, label %170, label %172
170: ; preds = %168
%171 = call i32 @close_file(i32 %141)
br label %172
172: ; preds = %170, %168
br i1 %129, label %173, label %190
173: ; preds = %172
%174 = call i32 @fclose(i32* %160)
br label %190
175: ; preds = %164
br i1 %129, label %176, label %184
176: ; preds = %175
store i64 0, i64* @errno
%177 = call i32 @fclose(i32* %160)
%178 = icmp eq i32 %177, 0
br i1 %178, label %184, label %179
179: ; preds = %176
%180 = load i64, i64* @errno
%181 = call i32 @strerror(i64 %180)
%182 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.29, i64 0, i64 0), i8* %112, i32 %181)
%183 = call i32 @close_file(i32 %141)
br label %190
184: ; preds = %176, %175
br i1 %132, label %185, label %190
185: ; preds = %184
%186 = call i32 @close_file(i32 %141)
%187 = icmp eq i32 %186, 0
br i1 %187, label %190, label %188
188: ; preds = %185
%189 = call i32 (i8*, i8*, ...) @fprint_err(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.30, i64 0, i64 0), i8* %111)
br label %190
190: ; preds = %58, %184, %188, %185, %172, %173, %179, %155, %138, %126, %122, %102, %96, %94, %78, %55, %32, %6
%191 = phi i32 [ 0, %6 ], [ 1, %96 ], [ 1, %78 ], [ 1, %94 ], [ 1, %55 ], [ 0, %32 ], [ 1, %102 ], [ 1, %179 ], [ 1, %155 ], [ 1, %138 ], [ 1, %126 ], [ 1, %122 ], [ 1, %173 ], [ 1, %172 ], [ 0, %185 ], [ 0, %188 ], [ 0, %184 ], [ 1, %58 ]
ret i32 %191
}