#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char buffer[1024];
  int with_ff = 0;
  if (argc == 2) {
    if (strcmp(argv[1], "ff") != 0) {
      fprintf(stderr, "Usage: nl.e [ff]\n");
      exit(1);
    } else
      with_ff = 1;
  }
  while (get_line(buffer, stdin)) {
    printf("%s\r\n", buffer);
  }
  if (with_ff)
    printf("%c", 12);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x414(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11c9 <main+0x79>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe74(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11ba <main+0x6a>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe58(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
movl   $0x1,-0x414(%rbp)
jmp    11c9 <main+0x79>
jmp    11ce <main+0x7e>
lea    -0x410(%rbp),%rdi
mov    0x2e0c(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     1207 <main+0xb7>
lea    -0x410(%rbp),%rsi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ce <main+0x7e>
cmpl   $0x0,-0x414(%rbp)
je     1227 <main+0xd7>
lea    0xdff(%rip),%rdi
mov    $0xc,%esi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %edi,%r14d
cmp    $0x2,%edi
jne    118a <main+0x2a>
mov    0x8(%rsi),%rdi
lea    0xe80(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11ed <main+0x8d>
mov    0x2e57(%rip),%r15
mov    (%r15),%esi
mov    %rsp,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
je     11cd <main+0x6d>
lea    0xe6d(%rip),%rbx
mov    %rsp,%rbp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r15),%esi
mov    %rbp,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
jne    11b0 <main+0x50>
cmp    $0x2,%r14d
jne    11dd <main+0x7d>
mov    $0xc,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
lea    0xe06(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"ff\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"Usage: nl.e [ff]\0A\00"
@stdin = global i32 0
@.str.2 = [5 x i8] c"%s\0D\0A\00"
@.str.3 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %22
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %10
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %10
store i32 1, i32* %7
br label %21
21: ; preds = %20
br label %22
22: ; preds = %21, %2
br label %23
23: ; preds = %28, %22
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%25 = load i32, i32* @stdin
%26 = call i64 @get_line(i8* %24, i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %29)
br label %23
31: ; preds = %23
%32 = load i32, i32* %7
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 12)
br label %36
36: ; preds = %34, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"ff\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"Usage: nl.e [ff]\0A\00"
@stdin = global i32 0
@.str.2 = [5 x i8] c"%s\0D\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %6, %2
%16 = load i32, i32* @stdin
%17 = call i64 @get_line(i8* %4, i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %15, %19
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%21 = load i32, i32* @stdin
%22 = call i64 @get_line(i8* %4, i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %19
24: ; preds = %19, %15
br i1 %5, label %25, label %27
25: ; preds = %24
%26 = call i32 @putchar(i32 12)
br label %27
27: ; preds = %25, %24
ret i32 0
}