#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 */

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ ERANGE;
long INT_MAX;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int const, char **, char *);
int /*<<< orphan*/ help();
scalar_t__ malloc(long);
char *optarg;
scalar_t__ opterr;
int optopt;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char const *, ...);
int read(int /*<<< orphan*/, char *, long);
int /*<<< orphan*/ stderr;
scalar_t__ strlen(char const *);
long strtol(char *, int /*<<< orphan*/ *, int);
long strtoul(char *, int /*<<< orphan*/ *, int);
int main(const int argc, char **argv) {
  long line_len, buf_len;
  int print_len;
  const char *nam, *len_sfx, *quals, *char_fmt, *len_typ, *quals_spc;
  size_t tc;
  int i, r;
  char *buf;
  line_len = 8;
  nam = "out";
  len_sfx = "_len";
  quals = "";
  print_len = 0;
  char_fmt = "'\\x%02X'";
  len_typ = "size_t";
  buf_len = 4096;
  opterr = 0;
  while (-1 != (r = getopt(argc, argv, "hl:n:s:q:pf:t:b:"))) {
    switch (r) {
    case 'h':
      help();
      return 0;
      break;
    case 'l':
      line_len = strtol(optarg, NULL, 10);
      if (EINVAL == errno || ERANGE == errno || 1 > line_len ||
          INT_MAX < line_len) {
        fprintf(
            stderr,
            "error: -l takes a reasonably-bounded integer in decimal >= 1\n");
        return 71;
      }
      break;
    case 'n':
      nam = optarg;
      break;
    case 's':
      len_sfx = optarg;
      break;
    case 'q':
      quals = optarg;
      break;
    case 'p':
      print_len = 1;
      break;
    case 'f':
      char_fmt = optarg;
      break;
    case 't':
      len_typ = optarg;
      break;
    case 'b':
      buf_len = strtoul(optarg, NULL, 10);
      if (EINVAL == errno || ERANGE == errno || 0 > buf_len ||
          INT_MAX < buf_len) {
        fprintf(
            stderr,
            "error: -b takes a reasonably-bounded integer in decimal >= 1\n");
        return 98;
      }
      break;
    case '?':
      fprintf(stderr,
              "error: unknown or poorly-used option -%c, use -h for help\n",
              optopt);
      return 105;
      break;
    default:
      fprintf(stderr, "error: option parser internal failure\n");
      return 109;
    }
  }
  buf = (char *)malloc(buf_len * sizeof(char));
  if (NULL == buf) {
    fprintf(stderr, "error: failed to allocate input buffer\n");
    return 116;
  }
  quals_spc = 0 < strlen(quals) ? " " : "";
  printf("%s%schar %s[] = {\n  ", quals, quals_spc, nam);
  for (tc = 0;;) {
    r = read(0, buf, buf_len);
    if (0 > r) {
      perror("read");
      return 127;
    }
    if (0 == r)
      break;
    for (i = 0; i < r; i++, tc++) {
      if (0 < tc) {
        if (tc % line_len == 0)
          printf(",\n  ");
        else
          printf(", ");
      }
      printf(char_fmt, 0xff & buf[i]);
    }
  }
  printf("\n};\n");
  if (print_len)
    printf("%s%s%s %s%s = %zu;\n", quals, quals_spc, len_typ, nam, len_sfx, tc);
  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)
movq   $0x8,-0x18(%rbp)
lea    0xf10(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xf09(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xf9f(%rip),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xef1(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xeef(%rip),%rax
mov    %rax,-0x50(%rbp)
movq   $0x1000,-0x20(%rbp)
mov    0x2da2(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xece(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,%ecx
mov    %ecx,-0x68(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     1460 <main+0x2c0>
mov    -0x68(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x78(%rbp)
sub    $0x35,%eax
ja     1438 <main+0x298>
mov    -0x78(%rbp),%rax
lea    0xda6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10c0 <help@plt>
movl   $0x0,-0x4(%rbp)
jmp    1610 <main+0x470>
mov    0x2d7b(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,-0x18(%rbp)
mov    0x2d0f(%rip),%rax
mov    (%rax),%eax
mov    0x2d16(%rip),%rcx
cmp    (%rcx),%eax
je     12e5 <main+0x145>
mov    0x2d1f(%rip),%rax
mov    (%rax),%eax
mov    0x2cfe(%rip),%rcx
cmp    (%rcx),%eax
je     12e5 <main+0x145>
mov    $0x1,%eax
cmp    -0x18(%rbp),%rax
jg     12e5 <main+0x145>
mov    0x2d08(%rip),%rax
mov    (%rax),%rax
cmp    -0x18(%rbp),%rax
jge    1308 <main+0x168>
mov    0x2cd4(%rip),%rax
mov    (%rax),%edi
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x47,-0x4(%rbp)
jmp    1610 <main+0x470>
jmp    145b <main+0x2bb>
mov    0x2ce4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    145b <main+0x2bb>
mov    0x2cd1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    145b <main+0x2bb>
mov    0x2cbe(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    145b <main+0x2bb>
movl   $0x1,-0x24(%rbp)
jmp    145b <main+0x2bb>
mov    0x2c9f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    145b <main+0x2bb>
mov    0x2c8c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    145b <main+0x2bb>
mov    0x2c79(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10b0 <strtoul@plt>
mov    %rax,-0x20(%rbp)
mov    0x2c0d(%rip),%rax
mov    (%rax),%eax
mov    0x2c14(%rip),%rcx
cmp    (%rcx),%eax
je     13e4 <main+0x244>
mov    0x2c1d(%rip),%rax
mov    (%rax),%eax
mov    0x2bfc(%rip),%rcx
cmp    (%rcx),%eax
je     13e4 <main+0x244>
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jg     13e4 <main+0x244>
mov    0x2c09(%rip),%rax
mov    (%rax),%rax
cmp    -0x20(%rbp),%rax
jge    1407 <main+0x267>
mov    0x2bd5(%rip),%rax
mov    (%rax),%edi
lea    0xd4c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x62,-0x4(%rbp)
jmp    1610 <main+0x470>
jmp    145b <main+0x2bb>
mov    0x2bad(%rip),%rax
mov    (%rax),%edi
mov    0x2bbc(%rip),%rax
mov    (%rax),%edx
lea    0xd59(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x69,-0x4(%rbp)
jmp    1610 <main+0x470>
mov    0x2b81(%rip),%rax
mov    (%rax),%edi
lea    0xd71(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x6d,-0x4(%rbp)
jmp    1610 <main+0x470>
jmp    1215 <main+0x75>
mov    -0x20(%rbp),%rdi
shl    $0x0,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x70(%rbp)
xor    %eax,%eax
cmp    -0x70(%rbp),%rax
jne    14a0 <main+0x300>
mov    0x2b3c(%rip),%rax
mov    (%rax),%edi
lea    0xd53(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x74,-0x4(%rbp)
jmp    1610 <main+0x470>
mov    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
xor    %eax,%eax
mov    %eax,%edx
lea    0xcc6(%rip),%rax
lea    0xd67(%rip),%rcx
cmp    %rsi,%rdx
cmovl  %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x40(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x60(%rbp)
mov    -0x70(%rbp),%rsi
mov    -0x20(%rbp),%rdx
xor    %edi,%edi
call   1050 <read@plt>
mov    %eax,-0x68(%rbp)
xor    %eax,%eax
cmp    -0x68(%rbp),%eax
jle    1520 <main+0x380>
lea    0xd0e(%rip),%rdi
call   1090 <perror@plt>
movl   $0x7f,-0x4(%rbp)
jmp    1610 <main+0x470>
xor    %eax,%eax
cmp    -0x68(%rbp),%eax
jne    1530 <main+0x390>
jmp    15c7 <main+0x427>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x68(%rbp),%eax
jge    15c2 <main+0x422>
xor    %eax,%eax
cmp    -0x60(%rbp),%rax
jae    158b <main+0x3eb>
mov    -0x60(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
cmp    $0x0,%rdx
jne    1578 <main+0x3d8>
lea    0xcb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1586 <main+0x3e6>
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    158b <main+0x3eb>
mov    -0x48(%rbp),%rdi
mov    -0x70(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
and    $0xff,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
jmp    1537 <main+0x397>
jmp    14eb <main+0x34b>
lea    0xc5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x24(%rbp)
je     1609 <main+0x469>
mov    -0x40(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    -0x60(%rbp),%rax
lea    0xc31(%rip),%rdi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
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    $0x48,%rsp
mov    %rsi,%rbp
mov    %edi,%r12d
mov    0x2de5(%rip),%rax
movq   $0x0,(%rax)
mov    $0x8,%r15d
lea    0xf0b(%rip),%r14
lea    0xefb(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xf8b(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xede(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xece(%rip),%rax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
mov    $0x1000,%ecx
mov    %rcx,0x8(%rsp)
lea    0xdde(%rip),%rbx
jmp    1240 <main+0x90>
mov    0x2dcd(%rip),%rax
mov    (%rax),%r14
mov    %r13d,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%r13d
mov    %r12d,%edi
mov    %rbp,%rsi
lea    0xea1(%rip),%rdx
call   10b0 <getopt@plt>
lea    -0x3f(%rax),%ecx
cmp    $0x35,%ecx
ja     13d2 <main+0x222>
mov    $0x1,%eax
movslq (%rbx,%rcx,4),%rcx
add    %rbx,%rcx
jmp    *%rcx
mov    0x2d82(%rip),%rax
mov    (%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10c0 <strtoul@plt>
mov    %rax,0x8(%rsp)
mov    0x2d27(%rip),%rax
mov    (%rax),%eax
mov    0x2d0e(%rip),%rcx
cmp    %eax,(%rcx)
je     1390 <main+0x1e0>
mov    0x2d27(%rip),%rcx
cmp    %eax,(%rcx)
je     1390 <main+0x1e0>
cmpq   $0x0,0x8(%rsp)
js     1390 <main+0x1e0>
mov    %r13d,%eax
mov    0x8(%rsp),%rcx
mov    0x2d14(%rip),%rdx
cmp    %rcx,(%rdx)
jge    1240 <main+0x90>
jmp    1390 <main+0x1e0>
mov    0x2d17(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x28(%rsp)
mov    %r13d,%eax
jmp    1240 <main+0x90>
mov    0x2d00(%rip),%rax
mov    (%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %rax,%r15
mov    0x2ca7(%rip),%rax
mov    (%rax),%eax
mov    0x2c8e(%rip),%rcx
cmp    %eax,(%rcx)
je     13b1 <main+0x201>
mov    0x2ca7(%rip),%rcx
cmp    %eax,(%rcx)
je     13b1 <main+0x201>
test   %r15,%r15
jle    13b1 <main+0x201>
mov    %r13d,%eax
mov    0x2ca0(%rip),%rcx
cmp    %r15,(%rcx)
jge    1240 <main+0x90>
jmp    13b1 <main+0x201>
mov    0x2ca6(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x18(%rsp)
mov    %r13d,%eax
jmp    1240 <main+0x90>
mov    0x2c8f(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
mov    %r13d,%eax
jmp    1240 <main+0x90>
mov    0x2c78(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x20(%rsp)
mov    %r13d,%eax
jmp    1240 <main+0x90>
mov    0x2c29(%rip),%rax
mov    (%rax),%edi
lea    0xda0(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x62,%ebx
jmp    15ae <main+0x3fe>
mov    0x2c08(%rip),%rax
mov    (%rax),%edi
lea    0xd41(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x47,%ebx
jmp    15ae <main+0x3fe>
cmp    $0xffffffff,%eax
jne    14ea <main+0x33a>
mov    0x8(%rsp),%r12
mov    %r12,%rdi
call   1090 <malloc@plt>
test   %rax,%rax
je     157b <main+0x3cb>
mov    %rax,%rbx
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
lea    0xe1a(%rip),%rax
lea    0xd6b(%rip),%rdx
cmovg  %rax,%rdx
lea    0xdeb(%rip),%rdi
mov    %rbp,%rsi
mov    %rdx,0x30(%rsp)
mov    0x18(%rsp),%rcx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1060 <read@plt>
test   %eax,%eax
js     159d <main+0x3ed>
xor    %ebp,%ebp
mov    %r14,0x38(%rsp)
jmp    1478 <main+0x2c8>
nop
mov    0x40(%rsp),%rax
add    %rax,%rbp
add    $0x1,%rbp
xor    %edi,%edi
mov    %rbx,%rsi
mov    0x8(%rsp),%rdx
call   1060 <read@plt>
test   %eax,%eax
mov    0x38(%rsp),%r14
js     159d <main+0x3ed>
test   %eax,%eax
je     153d <main+0x38d>
lea    -0x1(%rax),%ecx
mov    %rcx,0x40(%rsp)
mov    %eax,%r12d
xor    %r14d,%r14d
jmp    14b1 <main+0x301>
xor    %eax,%eax
call   1050 <printf@plt>
movzbl (%rbx,%r14,1),%esi
mov    0x28(%rsp),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r12
je     1450 <main+0x2a0>
mov    %rbp,%rax
add    %r14,%rax
je     1497 <main+0x2e7>
mov    %rax,%rcx
or     %r15,%rcx
shr    $0x20,%rcx
je     14d0 <main+0x320>
xor    %edx,%edx
div    %r15
jmp    14d5 <main+0x325>
nopl   0x0(%rax)
xor    %edx,%edx
div    %r15d
lea    0xd46(%rip),%rdi
test   %rdx,%rdx
je     1490 <main+0x2e0>
lea    0xd3f(%rip),%rdi
jmp    1490 <main+0x2e0>
mov    0x2acf(%rip),%rax
mov    (%rax),%edi
lea    0xcbf(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x6d,%ebx
jmp    15ae <main+0x3fe>
mov    0x2aae(%rip),%rax
mov    (%rax),%edi
mov    0x2abd(%rip),%rax
mov    (%rax),%edx
lea    0xc5a(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x69,%ebx
jmp    15ae <main+0x3fe>
xor    %ebx,%ebx
xor    %eax,%eax
call   10d0 <help@plt>
jmp    15ae <main+0x3fe>
lea    0xcfa(%rip),%rdi
call   1030 <puts@plt>
test   %r13d,%r13d
je     1599 <main+0x3e9>
mov    %rbp,(%rsp)
lea    0xcd1(%rip),%rdi
xor    %ebx,%ebx
mov    0x10(%rsp),%rsi
mov    0x30(%rsp),%rdx
mov    %r14,%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
xor    %eax,%eax
call   1050 <printf@plt>
jmp    15ae <main+0x3fe>
mov    0x2a3e(%rip),%rax
mov    (%rax),%edi
lea    0xc55(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x74,%ebx
jmp    15ae <main+0x3fe>
xor    %ebx,%ebx
jmp    15ae <main+0x3fe>
lea    0xc79(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x7f,%ebx
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"out\00"
@.str.1 = [5 x i8] c"_len\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [9 x i8] c"'\\x%02X'\00"
@.str.4 = [7 x i8] c"size_t\00"
@opterr = global i64 0
@.str.5 = [17 x i8] c"hl:n:s:q:pf:t:b:\00"
@optarg = global i8* null
@EINVAL = global i32 0
@errno = global i32 0
@ERANGE = global i32 0
@INT_MAX = global i64 0
@stderr = global i32 0
@.str.6 = [62 x i8] c"error: -l takes a reasonably-bounded integer in decimal >= 1\0A\00"
@.str.7 = [62 x i8] c"error: -b takes a reasonably-bounded integer in decimal >= 1\0A\00"
@.str.8 = [59 x i8] c"error: unknown or poorly-used option -%c, use -h for help\0A\00"
@optopt = global i32 0
@.str.9 = [39 x i8] c"error: option parser internal failure\0A\00"
@.str.10 = [40 x i8] c"error: failed to allocate input buffer\0A\00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [21 x i8] c"%s%schar %s[] = {\0A \00"
@.str.13 = [5 x i8] c"read\00"
@.str.14 = [5 x i8] c",\0A \00"
@.str.15 = [3 x i8] c", \00"
@.str.16 = [5 x i8] c"\0A};\0A\00"
@.str.17 = [20 x i8] c"%s%s%s %s%s = %zu;\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 8, i64* %6
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %11
store i32 0, i32* %8
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %12
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %13
store i64 4096, i64* %7
store i64 0, i64* @opterr
br label %19
19: ; preds = %88, %2
%20 = load i32, i32* %4
%21 = load i8**, i8*** %5
%22 = call i32 @getopt(i32 %20, i8** %21, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
store i32 %22, i32* %17
%23 = icmp ne i32 -1, %22
br i1 %23, label %24, label %89
24: ; preds = %19
%25 = load i32, i32* %17
switch i32 %25, label %85 [
i32 104, label %26
i32 108, label %28
i32 110, label %49
i32 115, label %51
i32 113, label %53
i32 112, label %55
i32 102, label %56
i32 116, label %58
i32 98, label %60
i32 63, label %81
]
26: ; preds = %24
%27 = call i32 (...) @help()
store i32 0, i32* %3
br label %168
28: ; preds = %24
%29 = load i8*, i8** @optarg
%30 = call i64 @strtol(i8* %29, i32* null, i32 10)
store i64 %30, i64* %6
%31 = load i32, i32* @EINVAL
%32 = load i32, i32* @errno
%33 = icmp eq i32 %31, %32
br i1 %33, label %45, label %34
34: ; preds = %28
%35 = load i32, i32* @ERANGE
%36 = load i32, i32* @errno
%37 = icmp eq i32 %35, %36
br i1 %37, label %45, label %38
38: ; preds = %34
%39 = load i64, i64* %6
%40 = icmp sgt i64 1, %39
br i1 %40, label %45, label %41
41: ; preds = %38
%42 = load i64, i64* @INT_MAX
%43 = load i64, i64* %6
%44 = icmp slt i64 %42, %43
br i1 %44, label %45, label %48
45: ; preds = %41, %38, %34, %28
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.6, i64 0, i64 0))
store i32 71, i32* %3
br label %168
48: ; preds = %41
br label %88
49: ; preds = %24
%50 = load i8*, i8** @optarg
store i8* %50, i8** %9
br label %88
51: ; preds = %24
%52 = load i8*, i8** @optarg
store i8* %52, i8** %10
br label %88
53: ; preds = %24
%54 = load i8*, i8** @optarg
store i8* %54, i8** %11
br label %88
55: ; preds = %24
store i32 1, i32* %8
br label %88
56: ; preds = %24
%57 = load i8*, i8** @optarg
store i8* %57, i8** %12
br label %88
58: ; preds = %24
%59 = load i8*, i8** @optarg
store i8* %59, i8** %13
br label %88
60: ; preds = %24
%61 = load i8*, i8** @optarg
%62 = call i64 @strtoul(i8* %61, i32* null, i32 10)
store i64 %62, i64* %7
%63 = load i32, i32* @EINVAL
%64 = load i32, i32* @errno
%65 = icmp eq i32 %63, %64
br i1 %65, label %77, label %66
66: ; preds = %60
%67 = load i32, i32* @ERANGE
%68 = load i32, i32* @errno
%69 = icmp eq i32 %67, %68
br i1 %69, label %77, label %70
70: ; preds = %66
%71 = load i64, i64* %7
%72 = icmp sgt i64 0, %71
br i1 %72, label %77, label %73
73: ; preds = %70
%74 = load i64, i64* @INT_MAX
%75 = load i64, i64* %7
%76 = icmp slt i64 %74, %75
br i1 %76, label %77, label %80
77: ; preds = %73, %70, %66, %60
%78 = load i32, i32* @stderr
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0))
store i32 98, i32* %3
br label %168
80: ; preds = %73
br label %88
81: ; preds = %24
%82 = load i32, i32* @stderr
%83 = load i32, i32* @optopt
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0), i32 %83)
store i32 105, i32* %3
br label %168
85: ; preds = %24
%86 = load i32, i32* @stderr
%87 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
store i32 109, i32* %3
br label %168
88: ; preds = %80, %58, %56, %55, %53, %51, %49, %48
br label %19
89: ; preds = %19
%90 = load i64, i64* %7
%91 = mul i64 %90, 1
%92 = call i64 @malloc(i64 %91)
%93 = inttoptr i64 %92 to i8*
store i8* %93, i8** %18
%94 = load i8*, i8** %18
%95 = icmp eq i8* null, %94
br i1 %95, label %96, label %99
96: ; preds = %89
%97 = load i32, i32* @stderr
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0))
store i32 116, i32* %3
br label %168
99: ; preds = %89
%100 = load i8*, i8** %11
%101 = call i64 @strlen(i8* %100)
%102 = icmp slt i64 0, %101
%103 = zext i1 %102 to i64
%104 = select i1 %102, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
store i8* %104, i8** %14
%105 = load i8*, i8** %11
%106 = load i8*, i8** %14
%107 = load i8*, i8** %9
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i8* %105, i8* %106, i8* %107)
store i64 0, i64* %15
br label %109
109: ; preds = %154, %99
%110 = load i8*, i8** %18
%111 = load i64, i64* %7
%112 = call i32 @read(i32 0, i8* %110, i64 %111)
store i32 %112, i32* %17
%113 = load i32, i32* %17
%114 = icmp sgt i32 0, %113
br i1 %114, label %115, label %117
115: ; preds = %109
%116 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
store i32 127, i32* %3
br label %168
117: ; preds = %109
%118 = load i32, i32* %17
%119 = icmp eq i32 0, %118
br i1 %119, label %120, label %121
120: ; preds = %117
br label %155
121: ; preds = %117
store i32 0, i32* %16
br label %122
122: ; preds = %149, %121
%123 = load i32, i32* %16
%124 = load i32, i32* %17
%125 = icmp slt i32 %123, %124
br i1 %125, label %126, label %154
126: ; preds = %122
%127 = load i64, i64* %15
%128 = icmp ult i64 0, %127
br i1 %128, label %129, label %139
129: ; preds = %126
%130 = load i64, i64* %15
%131 = load i64, i64* %6
%132 = urem i64 %130, %131
%133 = icmp eq i64 %132, 0
br i1 %133, label %134, label %136
134: ; preds = %129
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
br label %138
136: ; preds = %129
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
br label %138
138: ; preds = %136, %134
br label %139
139: ; preds = %138, %126
%140 = load i8*, i8** %12
%141 = load i8*, i8** %18
%142 = load i32, i32* %16
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8, i8* %141, i64 %143
%145 = load i8, i8* %144
%146 = sext i8 %145 to i32
%147 = and i32 255, %146
%148 = call i32 (i8*, ...) @printf(i8* %140, i32 %147)
br label %149
149: ; preds = %139
%150 = load i32, i32* %16
%151 = add nsw i32 %150, 1
store i32 %151, i32* %16
%152 = load i64, i64* %15
%153 = add i64 %152, 1
store i64 %153, i64* %15
br label %122
154: ; preds = %122
br label %109
155: ; preds = %120
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0))
%157 = load i32, i32* %8
%158 = icmp ne i32 %157, 0
br i1 %158, label %159, label %167
159: ; preds = %155
%160 = load i8*, i8** %11
%161 = load i8*, i8** %14
%162 = load i8*, i8** %13
%163 = load i8*, i8** %9
%164 = load i8*, i8** %10
%165 = load i64, i64* %15
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0), i8* %160, i8* %161, i8* %162, i8* %163, i8* %164, i64 %165)
br label %167
167: ; preds = %159, %155
store i32 0, i32* %3
br label %168
168: ; preds = %167, %115, %96, %85, %81, %77, %45, %26
%169 = load i32, i32* %3
ret i32 %169
}

LLVM IR (-O2):
@.str = [4 x i8] c"out\00"
@.str.1 = [5 x i8] c"_len\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [9 x i8] c"'\\x%02X'\00"
@.str.4 = [7 x i8] c"size_t\00"
@opterr = global i64 0
@.str.5 = [17 x i8] c"hl:n:s:q:pf:t:b:\00"
@optarg = global i8* null
@EINVAL = global i32 0
@errno = global i32 0
@ERANGE = global i32 0
@INT_MAX = global i64 0
@stderr = global i32 0
@.str.6 = [62 x i8] c"error: -l takes a reasonably-bounded integer in decimal >= 1\0A\00"
@.str.7 = [62 x i8] c"error: -b takes a reasonably-bounded integer in decimal >= 1\0A\00"
@.str.8 = [59 x i8] c"error: unknown or poorly-used option -%c, use -h for help\0A\00"
@optopt = global i32 0
@.str.9 = [39 x i8] c"error: option parser internal failure\0A\00"
@.str.10 = [40 x i8] c"error: failed to allocate input buffer\0A\00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [21 x i8] c"%s%schar %s[] = {\0A \00"
@.str.13 = [5 x i8] c"read\00"
@.str.14 = [5 x i8] c",\0A \00"
@.str.15 = [3 x i8] c", \00"
@.str.17 = [20 x i8] c"%s%s%s %s%s = %zu;\0A\00"
@str = [4 x i8] c"\0A};\00"
define i32 @main(i32 %0, i8** %1) {
store i64 0, i64* @opterr
br label %3
3: ; preds = %56, %2
%4 = phi i64 [ 4096, %2 ], [ %57, %56 ]
%5 = phi i32 [ 0, %2 ], [ %58, %56 ]
%6 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %2 ], [ %59, %56 ]
%7 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %2 ], [ %60, %56 ]
%8 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %2 ], [ %61, %56 ]
%9 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), %2 ], [ %62, %56 ]
%10 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), %2 ], [ %63, %56 ]
%11 = phi i64 [ 8, %2 ], [ %64, %56 ]
%12 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
switch i32 %12, label %72 [
i32 -1, label %75
i32 104, label %13
i32 108, label %15
i32 110, label %32
i32 115, label %34
i32 113, label %36
i32 112, label %56
i32 102, label %38
i32 116, label %40
i32 98, label %42
i32 63, label %68
]
13: ; preds = %3
%14 = tail call i32 (...) @help()
br label %126
15: ; preds = %3
%16 = load i8*, i8** @optarg
%17 = tail call i64 @strtol(i8* nocapture %16, i32* null, i32 10)
%18 = load i32, i32* @EINVAL
%19 = load i32, i32* @errno
%20 = icmp eq i32 %18, %19
br i1 %20, label %29, label %21
21: ; preds = %15
%22 = load i32, i32* @ERANGE
%23 = icmp eq i32 %22, %19
%24 = icmp slt i64 %17, 1
%25 = select i1 %23, i1 true, i1 %24
%26 = load i64, i64* @INT_MAX
%27 = icmp slt i64 %26, %17
%28 = select i1 %25, i1 true, i1 %27
br i1 %28, label %29, label %56
29: ; preds = %21, %15
%30 = load i32, i32* @stderr
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.6, i64 0, i64 0))
br label %126
32: ; preds = %3
%33 = load i8*, i8** @optarg
br label %56
34: ; preds = %3
%35 = load i8*, i8** @optarg
br label %56
36: ; preds = %3
%37 = load i8*, i8** @optarg
br label %56
38: ; preds = %3
%39 = load i8*, i8** @optarg
br label %56
40: ; preds = %3
%41 = load i8*, i8** @optarg
br label %56
42: ; preds = %3
%43 = load i8*, i8** @optarg
%44 = tail call i64 @strtoul(i8* nocapture %43, i32* null, i32 10)
%45 = load i32, i32* @EINVAL
%46 = load i32, i32* @errno
%47 = icmp eq i32 %45, %46
br i1 %47, label %65, label %48
48: ; preds = %42
%49 = load i32, i32* @ERANGE
%50 = icmp eq i32 %49, %46
%51 = icmp slt i64 %44, 0
%52 = select i1 %50, i1 true, i1 %51
%53 = load i64, i64* @INT_MAX
%54 = icmp slt i64 %53, %44
%55 = select i1 %52, i1 true, i1 %54
br i1 %55, label %65, label %56
56: ; preds = %48, %3, %21, %40, %38, %36, %34, %32
%57 = phi i64 [ %4, %40 ], [ %4, %38 ], [ %4, %36 ], [ %4, %34 ], [ %4, %32 ], [ %4, %21 ], [ %4, %3 ], [ %44, %48 ]
%58 = phi i32 [ %5, %40 ], [ %5, %38 ], [ %5, %36 ], [ %5, %34 ], [ %5, %32 ], [ %5, %21 ], [ 1, %3 ], [ %5, %48 ]
%59 = phi i8* [ %6, %40 ], [ %6, %38 ], [ %6, %36 ], [ %6, %34 ], [ %33, %32 ], [ %6, %21 ], [ %6, %3 ], [ %6, %48 ]
%60 = phi i8* [ %7, %40 ], [ %7, %38 ], [ %7, %36 ], [ %35, %34 ], [ %7, %32 ], [ %7, %21 ], [ %7, %3 ], [ %7, %48 ]
%61 = phi i8* [ %8, %40 ], [ %8, %38 ], [ %37, %36 ], [ %8, %34 ], [ %8, %32 ], [ %8, %21 ], [ %8, %3 ], [ %8, %48 ]
%62 = phi i8* [ %9, %40 ], [ %39, %38 ], [ %9, %36 ], [ %9, %34 ], [ %9, %32 ], [ %9, %21 ], [ %9, %3 ], [ %9, %48 ]
%63 = phi i8* [ %41, %40 ], [ %10, %38 ], [ %10, %36 ], [ %10, %34 ], [ %10, %32 ], [ %10, %21 ], [ %10, %3 ], [ %10, %48 ]
%64 = phi i64 [ %11, %40 ], [ %11, %38 ], [ %11, %36 ], [ %11, %34 ], [ %11, %32 ], [ %17, %21 ], [ %11, %3 ], [ %11, %48 ]
br label %3
65: ; preds = %48, %42
%66 = load i32, i32* @stderr
%67 = tail call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0))
br label %126
68: ; preds = %3
%69 = load i32, i32* @stderr
%70 = load i32, i32* @optopt
%71 = tail call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0), i32 %70)
br label %126
72: ; preds = %3
%73 = load i32, i32* @stderr
%74 = tail call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
br label %126
75: ; preds = %3
%76 = tail call i64 @malloc(i64 %4)
%77 = inttoptr i64 %76 to i8*
%78 = icmp eq i64 %76, 0
br i1 %78, label %79, label %82
79: ; preds = %75
%80 = load i32, i32* @stderr
%81 = tail call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0))
br label %126
82: ; preds = %75
%83 = tail call i64 @strlen(i8* dereferenceable(1) %8)
%84 = icmp sgt i64 %83, 0
%85 = select i1 %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i8* %8, i8* %85, i8* %6)
%87 = tail call i32 @read(i32 0, i8* %77, i64 %4)
%88 = icmp slt i32 %87, 0
br i1 %88, label %94, label %96
89: ; preds = %113
%90 = add i64 %98, 1
%91 = add i64 %90, %102
%92 = tail call i32 @read(i32 0, i8* %77, i64 %4)
%93 = icmp slt i32 %92, 0
br i1 %93, label %94, label %96
94: ; preds = %89, %82
%95 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
br label %126
96: ; preds = %82, %89
%97 = phi i32 [ %92, %89 ], [ %87, %82 ]
%98 = phi i64 [ %91, %89 ], [ 0, %82 ]
%99 = icmp eq i32 %97, 0
br i1 %99, label %121, label %100
100: ; preds = %96
%101 = add nsw i32 %97, -1
%102 = zext i32 %101 to i64
%103 = zext i32 %97 to i64
br label %104
104: ; preds = %100, %113
%105 = phi i64 [ 0, %100 ], [ %118, %113 ]
%106 = phi i64 [ %98, %100 ], [ %119, %113 ]
%107 = icmp eq i64 %106, 0
br i1 %107, label %113, label %108
108: ; preds = %104
%109 = urem i64 %106, %11
%110 = icmp eq i64 %109, 0
%111 = select i1 %110, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0)
%112 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %111)
br label %113
113: ; preds = %108, %104
%114 = getelementptr inbounds i8, i8* %77, i64 %105
%115 = load i8, i8* %114
%116 = zext i8 %115 to i32
%117 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %9, i32 %116)
%118 = add nuw nsw i64 %105, 1
%119 = add i64 %106, 1
%120 = icmp eq i64 %118, %103
br i1 %120, label %89, label %104
121: ; preds = %96
%122 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%123 = icmp eq i32 %5, 0
br i1 %123, label %126, label %124
124: ; preds = %121
%125 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0), i8* %8, i8* %85, i8* %10, i8* %6, i8* %7, i64 %98)
br label %126
126: ; preds = %121, %124, %94, %79, %72, %68, %65, %29, %13
%127 = phi i32 [ 109, %72 ], [ 105, %68 ], [ 98, %65 ], [ 71, %29 ], [ 0, %13 ], [ 116, %79 ], [ 127, %94 ], [ 0, %124 ], [ 0, %121 ]
ret i32 %127
}