#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*/ STDOUT_FILENO;
unsigned char *convert_to_byte_string(int /*<<< orphan*/, int *);
char getopt(int, char **, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ usage(char *);
int /*<<< orphan*/ write(int /*<<< orphan*/, ...);
int main(int argc, char *argv[]) {
  unsigned char *byte_buffer;
  int byte_buffer_size;
  int cnt = 1;
  int i;
  char c;
  while ((c = getopt(argc, argv, "nh")) != -1)
    switch (c) {
    case 'h':
      usage(argv[0]);
      return 0;
    case 'n':
      cnt = 5;
      break;
    default:
      usage(argv[0]);
      return -1;
    }
  byte_buffer = convert_to_byte_string(stdin, &byte_buffer_size);
  if (byte_buffer == NULL)
    return -1;
  for (i = 0; i < cnt; i++) {
    char terminator = '\n';
    write(STDOUT_FILENO, byte_buffer, byte_buffer_size);
    write(STDOUT_FILENO, &terminator, 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   $0x1,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe95(%rip),%rdx
call   1060 <getopt@plt>
mov    %al,-0x25(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     11e6 <main+0xa6>
movsbl -0x25(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x68,%eax
je     11a5 <main+0x65>
jmp    1194 <main+0x54>
mov    -0x2c(%rbp),%eax
sub    $0x6e,%eax
je     11bd <main+0x7d>
jmp    11c9 <main+0x89>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    126f <main+0x12f>
movl   $0x5,-0x20(%rbp)
jmp    11e1 <main+0xa1>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    126f <main+0x12f>
jmp    115d <main+0x1d>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
lea    -0x1c(%rbp),%rsi
call   1040 <convert_to_byte_string@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1213 <main+0xd3>
movl   $0xffffffff,-0x4(%rbp)
jmp    126f <main+0x12f>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1268 <main+0x128>
movb   $0xa,-0x26(%rbp)
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
lea    -0x26(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    121a <main+0xda>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xea8(%rip),%rdx
call   1060 <getopt@plt>
cmp    $0xff,%al
je     1199 <main+0x59>
lea    0xe98(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl %al,%eax
cmp    $0x6e,%eax
jne    1190 <main+0x50>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
cmp    $0xff,%al
jne    1170 <main+0x30>
mov    $0x5,%ebx
jmp    119e <main+0x5e>
cmp    $0x68,%eax
jne    1201 <main+0xc1>
xor    %ebp,%ebp
jmp    1206 <main+0xc6>
mov    $0x1,%ebx
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
lea    0xc(%rsp),%rsi
call   1040 <convert_to_byte_string@plt>
test   %rax,%rax
je     1210 <main+0xd0>
mov    %rax,%r15
mov    0x2e30(%rip),%r12
lea    0xb(%rsp),%r14
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movb   $0xa,0xb(%rsp)
mov    (%r12),%edi
mov    0xc(%rsp),%edx
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <write@plt>
mov    (%r12),%edi
mov    %r14,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <write@plt>
add    $0xffffffff,%ebx
jne    11d0 <main+0x90>
jmp    1215 <main+0xd5>
mov    $0xffffffff,%ebp
mov    (%rbx),%rdi
call   1050 <usage@plt>
jmp    1215 <main+0xd5>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"nh\00"
@stdin = global i32 0
@STDOUT_FILENO = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %8
br label %12
12: ; preds = %32, %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call signext i8 @getopt(i32 %13, i8** %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8 %15, i8* %10
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, -1
br i1 %17, label %18, label %33
18: ; preds = %12
%19 = load i8, i8* %10
%20 = sext i8 %19 to i32
switch i32 %20, label %27 [
i32 104, label %21
i32 110, label %26
]
21: ; preds = %18
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 @usage(i8* %24)
store i32 0, i32* %3
br label %55
26: ; preds = %18
store i32 5, i32* %8
br label %32
27: ; preds = %18
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = call i32 @usage(i8* %30)
store i32 -1, i32* %3
br label %55
32: ; preds = %26
br label %12
33: ; preds = %12
%34 = load i32, i32* @stdin
%35 = call i8* @convert_to_byte_string(i32 %34, i32* %7)
store i8* %35, i8** %6
%36 = load i8*, i8** %6
%37 = icmp eq i8* %36, null
br i1 %37, label %38, label %39
38: ; preds = %33
store i32 -1, i32* %3
br label %55
39: ; preds = %33
store i32 0, i32* %9
br label %40
40: ; preds = %51, %39
%41 = load i32, i32* %9
%42 = load i32, i32* %8
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %54
44: ; preds = %40
store i8 10, i8* %11
%45 = load i32, i32* @STDOUT_FILENO
%46 = load i8*, i8** %6
%47 = load i32, i32* %7
%48 = call i32 (i32, ...) @write(i32 %45, i8* %46, i32 %47)
%49 = load i32, i32* @STDOUT_FILENO
%50 = call i32 (i32, ...) @write(i32 %49, i8* %11, i32 1)
br label %51
51: ; preds = %44
%52 = load i32, i32* %9
%53 = add nsw i32 %52, 1
store i32 %53, i32* %9
br label %40
54: ; preds = %40
store i32 0, i32* %3
br label %55
55: ; preds = %54, %38, %27, %21
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@.str = [3 x i8] c"nh\00"
@stdin = global i32 0
@STDOUT_FILENO = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8
%5 = bitcast i32* %3 to i8*
%6 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i8 %6, -1
br i1 %7, label %14, label %11
8: ; preds = %11
%9 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i8 %9, -1
br i1 %10, label %14, label %11
11: ; preds = %2, %8
%12 = phi i8 [ %9, %8 ], [ %6, %2 ]
%13 = sext i8 %12 to i32
switch i32 %13, label %28 [
i32 104, label %29
i32 110, label %8
]
14: ; preds = %8, %2
%15 = phi i32 [ 1, %2 ], [ 5, %8 ]
%16 = load i32, i32* @stdin
%17 = call i8* @convert_to_byte_string(i32 %16, i32* %3)
%18 = icmp eq i8* %17, null
br i1 %18, label %33, label %19
19: ; preds = %14, %19
%20 = phi i32 [ %26, %19 ], [ 0, %14 ]
store i8 10, i8* %4
%21 = load i32, i32* @STDOUT_FILENO
%22 = load i32, i32* %3
%23 = call i32 (i32, ...) @write(i32 %21, i8* %17, i32 %22)
%24 = load i32, i32* @STDOUT_FILENO
%25 = call i32 (i32, ...) @write(i32 %24, i8* %4, i32 1)
%26 = add nuw nsw i32 %20, 1
%27 = icmp eq i32 %26, %15
br i1 %27, label %33, label %19
28: ; preds = %11
br label %29
29: ; preds = %11, %28
%30 = phi i32 [ -1, %28 ], [ 0, %11 ]
%31 = load i8*, i8** %1
%32 = tail call i32 @usage(i8* %31)
br label %33
33: ; preds = %19, %29, %14
%34 = phi i32 [ -1, %14 ], [ %30, %29 ], [ 0, %19 ]
ret i32 %34
}