#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 EOF;
int /*<<< orphan*/ abort();
int getchar();
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
scalar_t__ optind;
int printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int strtol(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  int c, count, linepos, maxcount, pretty, radix;
  maxcount = 0;
  pretty = 0;
  radix = 10;
  while ((c = getopt(argc, argv, "n:sx")) != -1) {
    switch (c) {
    case 'n':
      maxcount = strtol(optarg, NULL, 10);
      break;
    case 's':
      pretty = 1;
      break;
    case 'x':
      radix = 16;
      break;
    case '?':
    default:
      usage();
    }
  }
  argc -= optind;
  argv += optind;
  if (argc > 0)
    printf("%s\n", argv[0]);
  count = linepos = 0;
  while ((c = getchar()) != EOF) {
    if (count) {
      putchar(',');
      linepos++;
    }
    if ((maxcount == 0 && linepos > 70) ||
        (maxcount > 0 && count >= maxcount)) {
      putchar('\n');
      count = linepos = 0;
    }
    if (pretty) {
      if (count) {
        putchar(' ');
        linepos++;
      } else {
        putchar('\t');
        linepos += 8;
      }
    }
    switch (radix) {
    case 10:
      linepos += printf("%d", c);
      break;
    case 16:
      linepos += printf("0x%02x", c);
      break;
    default:
      abort();
    }
    count++;
  }
  putchar('\n');
  if (argc > 1)
    printf("%s\n", argv[1]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0xa,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe57(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1249 <main+0xd9>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x3f,%eax
je     1238 <main+0xc8>
jmp    11ce <main+0x5e>
mov    -0x2c(%rbp),%eax
sub    $0x6e,%eax
je     1201 <main+0x91>
jmp    11df <main+0x6f>
mov    -0x2c(%rbp),%eax
sub    $0x73,%eax
je     1220 <main+0xb0>
jmp    11f0 <main+0x80>
mov    -0x2c(%rbp),%eax
sub    $0x78,%eax
je     122c <main+0xbc>
jmp    123d <main+0xcd>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,-0x20(%rbp)
jmp    1244 <main+0xd4>
movl   $0x1,-0x24(%rbp)
jmp    1244 <main+0xd4>
movl   $0x10,-0x28(%rbp)
jmp    1244 <main+0xd4>
jmp    123d <main+0xcd>
mov    $0x0,%al
call   1080 <usage@plt>
jmp    119b <main+0x2b>
mov    0x2d88(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2d74(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1292 <main+0x122>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2d2f(%rip),%rcx
cmp    (%rcx),%eax
je     13ce <main+0x25e>
cmpl   $0x0,-0x18(%rbp)
je     12d6 <main+0x166>
mov    $0x2c,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    12ea <main+0x17a>
cmpl   $0x46,-0x1c(%rbp)
jg     1300 <main+0x190>
cmpl   $0x0,-0x20(%rbp)
jle    1318 <main+0x1a8>
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     1318 <main+0x1a8>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     135c <main+0x1ec>
cmpl   $0x0,-0x18(%rbp)
je     1344 <main+0x1d4>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1357 <main+0x1e7>
mov    $0x9,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x1c(%rbp)
jmp    135c <main+0x1ec>
mov    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0xa,%eax
je     1381 <main+0x211>
jmp    1370 <main+0x200>
mov    -0x30(%rbp),%eax
sub    $0x10,%eax
je     139d <main+0x22d>
jmp    13b9 <main+0x249>
mov    -0x14(%rbp),%esi
lea    0xc7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    13c0 <main+0x250>
mov    -0x14(%rbp),%esi
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    13c0 <main+0x250>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12a0 <main+0x130>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x1,-0x8(%rbp)
jle    13f8 <main+0x288>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xc14(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
movl   $0xa,0xc(%rsp)
lea    0xe5e(%rip),%rbx
mov    0x2e4f(%rip),%r12
movl   $0x0,0x8(%rsp)
xor    %r14d,%r14d
jmp    11c7 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <usage@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   10a0 <getopt@plt>
cmp    $0x72,%eax
jg     1200 <main+0x80>
cmp    $0xffffffff,%eax
je     121e <main+0x9e>
cmp    $0x6e,%eax
jne    11c0 <main+0x40>
mov    (%r12),%edi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,%r14d
jmp    11c7 <main+0x47>
nopl   0x0(%rax,%rax,1)
cmp    $0x73,%eax
je     1214 <main+0x94>
cmp    $0x78,%eax
jne    11c0 <main+0x40>
movl   $0x10,0xc(%rsp)
jmp    11c7 <main+0x47>
movl   $0x1,0x8(%rsp)
jmp    11c7 <main+0x47>
mov    0x2db3(%rip),%rax
mov    (%rax),%rbx
sub    %ebx,%ebp
test   %ebp,%ebp
jle    1237 <main+0xb7>
mov    (%r15,%rbx,8),%rdi
call   1050 <puts@plt>
mov    %rbx,0x10(%rsp)
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %eax,%ebx
mov    0x2d94(%rip),%rax
cmp    (%rax),%ebx
jne    127f <main+0xff>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebp
jl     126e <main+0xee>
mov    0x10(%rsp),%rax
mov    0x8(%r15,%rax,8),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r13d,%r13d
xor    %r12d,%r12d
jmp    12b4 <main+0x134>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    %eax,%r13d
add    $0x1,%r12d
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %eax,%ebx
mov    0x2d30(%rip),%rax
cmp    (%rax),%ebx
je     1250 <main+0xd0>
test   %r12d,%r12d
je     12c7 <main+0x147>
mov    $0x2c,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
test   %r14d,%r14d
jne    12d2 <main+0x152>
cmp    $0x46,%r13d
jg     12dc <main+0x15c>
test   %r14d,%r14d
jle    1330 <main+0x1b0>
cmp    %r14d,%r12d
jl     1330 <main+0x1b0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r13d,%r13d
mov    $0x0,%r12d
cmpl   $0x0,0x8(%rsp)
je     1307 <main+0x187>
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0x8,%r13d
xor    %r12d,%r12d
lea    0xcf7(%rip),%rdi
cmpl   $0xa,0xc(%rsp)
je     1290 <main+0x110>
cmpl   $0x10,0xc(%rsp)
jne    134c <main+0x1cc>
lea    0xce1(%rip),%rdi
jmp    1290 <main+0x110>
nopl   0x0(%rax)
cmpl   $0x0,0x8(%rsp)
je     1307 <main+0x187>
test   %r12d,%r12d
je     12f6 <main+0x176>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
jmp    1307 <main+0x187>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"n:sx\00"
@optarg = global i32 0
@optind = global i64 0
@.str.1 = [4 x i8] c"%s\0A\00"
@EOF = global i32 0
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [7 x i8] c"0x%02x\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32 0, i32* %10
store i32 10, i32* %11
br label %12
12: ; preds = %27, %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call i32 @getopt(i32 %13, i8** %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %15, i32* %6
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %28
17: ; preds = %12
%18 = load i32, i32* %6
switch i32 %18, label %25 [
i32 110, label %19
i32 115, label %22
i32 120, label %23
i32 63, label %24
]
19: ; preds = %17
%20 = load i32, i32* @optarg
%21 = call i32 @strtol(i32 %20, i32* null, i32 10)
store i32 %21, i32* %9
br label %27
22: ; preds = %17
store i32 1, i32* %10
br label %27
23: ; preds = %17
store i32 16, i32* %11
br label %27
24: ; preds = %17
br label %25
25: ; preds = %17, %24
%26 = call i32 (...) @usage()
br label %27
27: ; preds = %25, %23, %22, %19
br label %12
28: ; preds = %12
%29 = load i64, i64* @optind
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = sub nsw i64 %31, %29
%33 = trunc i64 %32 to i32
store i32 %33, i32* %4
%34 = load i64, i64* @optind
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 %34
store i8** %36, i8*** %5
%37 = load i32, i32* %4
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %28
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 0
%42 = load i8*, i8** %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %42)
br label %44
44: ; preds = %39, %28
store i32 0, i32* %8
store i32 0, i32* %7
br label %45
45: ; preds = %100, %44
%46 = call i32 (...) @getchar()
store i32 %46, i32* %6
%47 = load i32, i32* @EOF
%48 = icmp ne i32 %46, %47
br i1 %48, label %49, label %103
49: ; preds = %45
%50 = load i32, i32* %7
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %56
52: ; preds = %49
%53 = call i32 @putchar(i8 signext 44)
%54 = load i32, i32* %8
%55 = add nsw i32 %54, 1
store i32 %55, i32* %8
br label %56
56: ; preds = %52, %49
%57 = load i32, i32* %9
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = load i32, i32* %8
%61 = icmp sgt i32 %60, 70
br i1 %61, label %69, label %62
62: ; preds = %59, %56
%63 = load i32, i32* %9
%64 = icmp sgt i32 %63, 0
br i1 %64, label %65, label %71
65: ; preds = %62
%66 = load i32, i32* %7
%67 = load i32, i32* %9
%68 = icmp sge i32 %66, %67
br i1 %68, label %69, label %71
69: ; preds = %65, %59
%70 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %8
store i32 0, i32* %7
br label %71
71: ; preds = %69, %65, %62
%72 = load i32, i32* %10
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %86
74: ; preds = %71
%75 = load i32, i32* %7
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %74
%78 = call i32 @putchar(i8 signext 32)
%79 = load i32, i32* %8
%80 = add nsw i32 %79, 1
store i32 %80, i32* %8
br label %85
81: ; preds = %74
%82 = call i32 @putchar(i8 signext 9)
%83 = load i32, i32* %8
%84 = add nsw i32 %83, 8
store i32 %84, i32* %8
br label %85
85: ; preds = %81, %77
br label %86
86: ; preds = %85, %71
%87 = load i32, i32* %11
switch i32 %87, label %98 [
i32 10, label %88
i32 16, label %93
]
88: ; preds = %86
%89 = load i32, i32* %6
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %89)
%91 = load i32, i32* %8
%92 = add nsw i32 %91, %90
store i32 %92, i32* %8
br label %100
93: ; preds = %86
%94 = load i32, i32* %6
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %94)
%96 = load i32, i32* %8
%97 = add nsw i32 %96, %95
store i32 %97, i32* %8
br label %100
98: ; preds = %86
%99 = call i32 (...) @abort()
unreachable
100: ; preds = %93, %88
%101 = load i32, i32* %7
%102 = add nsw i32 %101, 1
store i32 %102, i32* %7
br label %45
103: ; preds = %45
%104 = call i32 @putchar(i8 signext 10)
%105 = load i32, i32* %4
%106 = icmp sgt i32 %105, 1
br i1 %106, label %107, label %112
107: ; preds = %103
%108 = load i8**, i8*** %5
%109 = getelementptr inbounds i8*, i8** %108, i64 1
%110 = load i8*, i8** %109
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %110)
br label %112
112: ; preds = %107, %103
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"n:sx\00"
@optarg = global i32 0
@optind = global i64 0
@EOF = global i32 0
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [7 x i8] c"0x%02x\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %14, %2
%4 = phi i32 [ %16, %14 ], [ 0, %2 ]
%5 = phi i32 [ %8, %14 ], [ 0, %2 ]
%6 = phi i32 [ %11, %14 ], [ 10, %2 ]
br label %7
7: ; preds = %12, %3
%8 = phi i32 [ %5, %3 ], [ 1, %12 ]
%9 = phi i32 [ %6, %3 ], [ %11, %12 ]
br label %10
10: ; preds = %12, %7
%11 = phi i32 [ %9, %7 ], [ 16, %12 ]
br label %12
12: ; preds = %10, %17
%13 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %13, label %17 [
i32 -1, label %19
i32 110, label %14
i32 115, label %7
i32 120, label %10
]
14: ; preds = %12
%15 = load i32, i32* @optarg
%16 = tail call i32 @strtol(i32 %15, i32* null, i32 10)
br label %3
17: ; preds = %12
%18 = tail call i32 (...) @usage()
br label %12
19: ; preds = %12
%20 = load i64, i64* @optind
%21 = trunc i64 %20 to i32
%22 = sub i32 %0, %21
%23 = getelementptr inbounds i8*, i8** %1, i64 %20
%24 = icmp sgt i32 %22, 0
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = load i8*, i8** %23
%27 = tail call i32 @puts(i8* dereferenceable(1) %26)
br label %28
28: ; preds = %25, %19
%29 = tail call i32 (...) @getchar()
%30 = load i32, i32* @EOF
%31 = icmp eq i32 %29, %30
br i1 %31, label %76, label %32
32: ; preds = %28
%33 = icmp eq i32 %4, 0
%34 = icmp slt i32 %4, 1
%35 = icmp eq i32 %8, 0
br label %36
36: ; preds = %32, %68
%37 = phi i32 [ %29, %32 ], [ %73, %68 ]
%38 = phi i32 [ 0, %32 ], [ %71, %68 ]
%39 = phi i32 [ 0, %32 ], [ %72, %68 ]
%40 = icmp eq i32 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %36
%42 = tail call i32 @putchar(i8 signext 44)
%43 = add nsw i32 %38, 1
br label %44
44: ; preds = %41, %36
%45 = phi i32 [ %43, %41 ], [ %38, %36 ]
%46 = icmp sgt i32 %45, 70
%47 = select i1 %33, i1 %46, i1 false
br i1 %47, label %52, label %48
48: ; preds = %44
%49 = icmp slt i32 %39, %4
%50 = select i1 %34, i1 true, i1 %49
br i1 %50, label %51, label %52
51: ; preds = %48
br i1 %35, label %62, label %54
52: ; preds = %44, %48
%53 = tail call i32 @putchar(i8 signext 10)
br i1 %35, label %62, label %58
54: ; preds = %51
br i1 %40, label %58, label %55
55: ; preds = %54
%56 = tail call i32 @putchar(i8 signext 32)
%57 = add nsw i32 %45, 1
br label %62
58: ; preds = %52, %54
%59 = phi i32 [ %45, %54 ], [ 0, %52 ]
%60 = tail call i32 @putchar(i8 signext 9)
%61 = add nsw i32 %59, 8
br label %62
62: ; preds = %52, %55, %58, %51
%63 = phi i32 [ %39, %55 ], [ 0, %58 ], [ %39, %51 ], [ 0, %52 ]
%64 = phi i32 [ %57, %55 ], [ %61, %58 ], [ %45, %51 ], [ 0, %52 ]
switch i32 %11, label %66 [
i32 10, label %68
i32 16, label %65
]
65: ; preds = %62
br label %68
66: ; preds = %62
%67 = tail call i32 (...) @abort()
unreachable
68: ; preds = %62, %65
%69 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %65 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %62 ]
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %69, i32 %37)
%71 = add nsw i32 %70, %64
%72 = add nsw i32 %63, 1
%73 = tail call i32 (...) @getchar()
%74 = load i32, i32* @EOF
%75 = icmp eq i32 %73, %74
br i1 %75, label %76, label %36
76: ; preds = %68, %28
%77 = tail call i32 @putchar(i8 signext 10)
%78 = icmp sgt i32 %22, 1
br i1 %78, label %79, label %83
79: ; preds = %76
%80 = getelementptr inbounds i8*, i8** %23, i64 1
%81 = load i8*, i8** %80
%82 = tail call i32 @puts(i8* dereferenceable(1) %81)
br label %83
83: ; preds = %79, %76
ret i32 0
}